mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-27 18:55:41 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57bdc689cc | ||
|
|
062fd4d5a9 | ||
|
|
4810eb2d74 | ||
|
|
79a32f40c6 | ||
|
|
a997246655 | ||
|
|
3b8fd4ab3d | ||
|
|
9416336d73 | ||
|
|
5715467245 | ||
|
|
8e8b383f4c | ||
|
|
1fd744795d | ||
|
|
bec63111f1 | ||
|
|
dbba977ab8 | ||
|
|
29179ba27f | ||
|
|
dcdd327cdf | ||
|
|
91613f516d | ||
|
|
31aa498a5b | ||
|
|
8037d79330 | ||
|
|
8c002cc750 | ||
|
|
237cfe91f1 | ||
|
|
d4fd6dcafd | ||
|
|
518e58cd63 | ||
|
|
82dcf7821e | ||
|
|
5d003d9613 | ||
|
|
9868ebc11c |
@@ -1,5 +1,49 @@
|
||||
# Changelog
|
||||
|
||||
## 0.18.1 - 2026-11-27
|
||||
|
||||
- **Host metadata instructions:** Set host-wide instructions once to guide language, tone, and formatting for generated workspace titles, branch names, commit messages, and pull requests. ([#11064](https://github.com/getpaseo/paseo/pull/11064))
|
||||
- **Enterprise spending usage:** Usage now shows Claude extra-usage spending and Codex individual spending limits with reset times. ([#8976](https://github.com/getpaseo/paseo/pull/8976) by [@mcowger](https://github.com/mcowger), [@JasprW](https://github.com/JasprW))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed Android agent push notifications arriving minutes late during Doze ([#8501](https://github.com/getpaseo/paseo/pull/8501) by [@truelecter](https://github.com/truelecter))
|
||||
- Fixed Command Center results reordering mid-word while typing ([#11085](https://github.com/getpaseo/paseo/pull/11085))
|
||||
- Fixed composer slash and `@` autocomplete stopping after closing a web overlay or opening while a prompt submits ([#11041](https://github.com/getpaseo/paseo/pull/11041))
|
||||
- Fixed the Starting ref popover in New Workspace jumping in height and shifting rows on first open ([#11042](https://github.com/getpaseo/paseo/pull/11042))
|
||||
- Fixed the iOS Home Screen web app status bar overlapping focus-mode tabs, the overlay sidebar, and the Mermaid fullscreen viewer on wide layouts ([#9970](https://github.com/getpaseo/paseo/pull/9970) by [@mywaffles](https://github.com/mywaffles))
|
||||
- Fixed Mark as read on a workspace not clearing finished terminal attention ([#11040](https://github.com/getpaseo/paseo/pull/11040))
|
||||
- Fixed GitLab merge request checks and pipeline details failing with 404 when the pipeline runs in a fork project ([#11074](https://github.com/getpaseo/paseo/pull/11074))
|
||||
- Fixed messages sent while Pi runs a turn it started itself failing instead of queuing ([#11077](https://github.com/getpaseo/paseo/pull/11077))
|
||||
- Fixed OpenCode v2 tool approvals staying stuck after OpenCode already dropped the request ([#11061](https://github.com/getpaseo/paseo/pull/11061) by [@rhettjay](https://github.com/rhettjay))
|
||||
- Fixed idle cleanup keeping OpenCode v2 chats in memory while another session runs on the shared server ([#11039](https://github.com/getpaseo/paseo/pull/11039))
|
||||
- Fixed idle ACP agents failing permanently after their process exits instead of reopening on the next message ([#11047](https://github.com/getpaseo/paseo/pull/11047))
|
||||
- Fixed Kimi usage failing or showing an expired login for global `kimi.ai` accounts ([#8505](https://github.com/getpaseo/paseo/pull/8505) by [@benthecarman](https://github.com/benthecarman))
|
||||
- Fixed the Z.ai Usage card missing when GLM Agent is signed in via `Z_AI_API_KEY` or its credentials file ([#8376](https://github.com/getpaseo/paseo/pull/8376) by [@Peanut-HZM](https://github.com/Peanut-HZM))
|
||||
|
||||
### Plugins
|
||||
|
||||
- Added OMP tool-call intent to `item.metadata.intent` for timeline plugins ([#10727](https://github.com/getpaseo/paseo/pull/10727) by [@mcowger](https://github.com/mcowger))
|
||||
|
||||
## 0.18.0 - 2026-11-27
|
||||
|
||||
- **Remote workspace browser proxy:** Desktop browser tabs in remote workspaces now route through the workspace daemon, so remote `localhost` servers open directly in Paseo. ([#10944](https://github.com/getpaseo/paseo/pull/10944) by [@airon-assustadus](https://github.com/airon-assustadus))
|
||||
- **Per-device notification preferences:** Each device can choose which agent, terminal, and plugin events send notifications, and plugins can send notifications and handle taps. ([#10888](https://github.com/getpaseo/paseo/pull/10888))
|
||||
- **Agent profile system prompts:** Save an optional system prompt on an agent profile to apply it to new agents started from that profile. ([#10996](https://github.com/getpaseo/paseo/pull/10996))
|
||||
- **More syntax highlighting:** Syntax highlighting now covers diff and patch files along with Ruby, Kotlin, TOML, SQL, Lua, Protobuf, PowerShell, Groovy, Gradle, Scala, CMake, Properties, INI, R, Perl, and LaTeX. ([#11026](https://github.com/getpaseo/paseo/pull/11026) by [@hmalaspina](https://github.com/hmalaspina), [@kukicola](https://github.com/kukicola), [@MaximeConan](https://github.com/MaximeConan), [@singleton11](https://github.com/singleton11), [@chandlerok](https://github.com/chandlerok))
|
||||
|
||||
### Changed
|
||||
|
||||
- Changed ACP providers to cache model catalogs across daemon restarts instead of probing in the background, and cleaned up Antigravity ACP flags and metadata. Requires [Antigravity CLI 1.5.1 or later](https://paseo.sh/docs/supported-providers/antigravity) ([#10992](https://github.com/getpaseo/paseo/pull/10992))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed Paseo iOS crashing shortly after connecting when an enabled client plugin imports `react-native` ([#11011](https://github.com/getpaseo/paseo/pull/11011))
|
||||
- Fixed OpenCode v2 agents staying stuck in running after Stop when stream events were missed or chat history was large ([#10955](https://github.com/getpaseo/paseo/pull/10955))
|
||||
- Fixed steering a Pi agent during a run it started on its own aborting the run instead of steering it ([#10977](https://github.com/getpaseo/paseo/pull/10977) by [@viiqswim](https://github.com/viiqswim))
|
||||
- Fixed creating a workspace from a pull request in a fork clone checking out the fork's pull request with the same number ([#10987](https://github.com/getpaseo/paseo/pull/10987))
|
||||
- Fixed dropping images or files onto the composer leaving the input unfocused ([#11022](https://github.com/getpaseo/paseo/pull/11022))
|
||||
|
||||
## 0.17.6 - 2026-11-27
|
||||
|
||||
### Improved
|
||||
|
||||
@@ -1,5 +1,49 @@
|
||||
# Changelog
|
||||
|
||||
## 0.18.1 - 2026-11-27
|
||||
|
||||
- **主机元数据指令**:设置一次主机级指令,即可统一控制自动生成的工作区标题、分支名、提交信息和 PR 的语言、语气与格式。([#11064](https://github.com/getpaseo/paseo/pull/11064))
|
||||
- **企业消费用量**:使用情况现已显示 Claude 额外消费用量以及 Codex 个人消费限额和重置时间。([#8976](https://github.com/getpaseo/paseo/pull/8976),贡献者:[@mcowger](https://github.com/mcowger), [@JasprW](https://github.com/JasprW))
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复 Android 在 Doze 休眠模式下 Agent 推送通知延迟数分钟送达的问题 ([#8501](https://github.com/getpaseo/paseo/pull/8501),贡献者:[@truelecter](https://github.com/truelecter))
|
||||
- 修复在命令中心输入时结果顺序在单词输入中途跳动的问题 ([#11085](https://github.com/getpaseo/paseo/pull/11085))
|
||||
- 修复关闭网页浮层后 Composer 的斜杠与 `@` 自动补全失效,以及提交提示词时自动补全弹出的问题 ([#11041](https://github.com/getpaseo/paseo/pull/11041))
|
||||
- 修复在“新建工作区”中首次打开“起始 ref”浮层时高度跳动和行位偏移的问题 ([#11042](https://github.com/getpaseo/paseo/pull/11042))
|
||||
- 修复宽屏布局下 iOS 主屏幕网页应用的状态栏遮挡专注模式标签栏、覆盖侧边栏和 Mermaid 全屏查看器的问题 ([#9970](https://github.com/getpaseo/paseo/pull/9970),贡献者:[@mywaffles](https://github.com/mywaffles))
|
||||
- 修复将工作区标记为已读时未清除已完成终端提醒的问题 ([#11040](https://github.com/getpaseo/paseo/pull/11040))
|
||||
- 修复 GitLab 合并请求的流水线运行在 fork 项目中时,检查状态和流水线详情返回 404 的问题 ([#11074](https://github.com/getpaseo/paseo/pull/11074))
|
||||
- 修复 Pi 运行其自行启动的轮次时发送的消息直接失败而不是排队的问题 ([#11077](https://github.com/getpaseo/paseo/pull/11077))
|
||||
- 修复 OpenCode v2 已丢弃工具审批请求后,审批卡片仍一直卡住的问题 ([#11061](https://github.com/getpaseo/paseo/pull/11061),贡献者:[@rhettjay](https://github.com/rhettjay))
|
||||
- 修复共享服务器上运行其他会话时,空闲清理不会卸载闲置 OpenCode v2 对话的问题 ([#11039](https://github.com/getpaseo/paseo/pull/11039))
|
||||
- 修复空闲 ACP Agent 的进程意外退出后永久失败,而不是在下一条消息时重新打开会话的问题 ([#11047](https://github.com/getpaseo/paseo/pull/11047))
|
||||
- 修复使用全局 `kimi.ai` 账号登录时 Kimi 用量加载失败或显示登录已过期的问题 ([#8505](https://github.com/getpaseo/paseo/pull/8505),贡献者:[@benthecarman](https://github.com/benthecarman))
|
||||
- 修复通过 `Z_AI_API_KEY` 或凭据文件登录 GLM Agent 时缺少 Z.ai 使用情况卡片的问题 ([#8376](https://github.com/getpaseo/paseo/pull/8376),贡献者:[@Peanut-HZM](https://github.com/Peanut-HZM))
|
||||
|
||||
### 插件
|
||||
|
||||
- 为时间线插件在 `item.metadata.intent` 中新增 OMP 工具调用意图 ([#10727](https://github.com/getpaseo/paseo/pull/10727),贡献者:[@mcowger](https://github.com/mcowger))
|
||||
|
||||
## 0.18.0 - 2026-11-27
|
||||
|
||||
- **远程工作区浏览器代理**:远程工作区中的桌面端浏览器标签页现在会通过该工作区的 daemon 转发流量,远程 `localhost` 服务可以直接在 Paseo 中打开。([#10944](https://github.com/getpaseo/paseo/pull/10944),贡献者:[@airon-assustadus](https://github.com/airon-assustadus))
|
||||
- **按设备配置通知偏好**:每台设备都可以分别选择哪些 Agent、终端和插件事件发送通知,插件现在也可以发送通知并处理点击。([#10888](https://github.com/getpaseo/paseo/pull/10888))
|
||||
- **智能体配置文件系统提示词**:在智能体配置文件中保存可选的系统提示词,以便在通过该配置启动新 Agent 时应用。([#10996](https://github.com/getpaseo/paseo/pull/10996))
|
||||
- **更多语法高亮语言**:语法高亮现已支持 diff 和 patch 文件,以及 Ruby、Kotlin、TOML、SQL、Lua、Protobuf、PowerShell、Groovy、Gradle、Scala、CMake、Properties、INI、R、Perl 和 LaTeX。([#11026](https://github.com/getpaseo/paseo/pull/11026),贡献者:[@hmalaspina](https://github.com/hmalaspina), [@kukicola](https://github.com/kukicola), [@MaximeConan](https://github.com/MaximeConan), [@singleton11](https://github.com/singleton11), [@chandlerok](https://github.com/chandlerok))
|
||||
|
||||
### 变更
|
||||
|
||||
- ACP Provider 现在会在 daemon 重启间将已发现的模型目录缓存到磁盘,不再在后台轮询,同时清理了多余的 Antigravity ACP 参数和元数据。需要 [Antigravity CLI 1.5.1 或更高版本](https://paseo.sh/zh-CN/docs/supported-providers/antigravity) ([#10992](https://github.com/getpaseo/paseo/pull/10992))
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复已启用的客户端插件导入 `react-native` 时,Paseo iOS 在连接后不久崩溃的问题 ([#11011](https://github.com/getpaseo/paseo/pull/11011))
|
||||
- 修复流事件丢失或对话历史较大时,OpenCode v2 Agent 在点击停止后仍停留在运行中的问题 ([#10955](https://github.com/getpaseo/paseo/pull/10955))
|
||||
- 修复在 Pi Agent 运行其自行启动的轮次时发送引导消息会中止该轮次而不是引导它的问题 ([#10977](https://github.com/getpaseo/paseo/pull/10977),贡献者:[@viiqswim](https://github.com/viiqswim))
|
||||
- 修复在 fork 克隆中根据 PR 创建工作区时,检出到 fork 中同编号 PR 的问题 ([#10987](https://github.com/getpaseo/paseo/pull/10987))
|
||||
- 修复向 Composer 拖放图片或文件后输入框未获得焦点的问题 ([#11022](https://github.com/getpaseo/paseo/pull/11022))
|
||||
|
||||
## 0.17.6 - 2026-11-27
|
||||
|
||||
### 改进
|
||||
|
||||
@@ -80,7 +80,9 @@ Provider checks follow the signals their runtimes expose:
|
||||
- Codex queries background terminals for loaded threads, including native children, and protects
|
||||
pending provider requests. App servers without the terminal-list RPC stay resident.
|
||||
- OpenCode checks active executions and descendants. V1 checks PTYs; v2 also checks shell and
|
||||
inbox inventories. The shared server remains leased while a session vetoes collection.
|
||||
inbox inventories. The shared server remains leased while a session vetoes collection. V2 lets
|
||||
another session's execution veto only when releasing the lease would stop the server; the shared
|
||||
server stays up after its last lease goes.
|
||||
- Pi checks streaming, compaction, pending replies, and adapter-owned operations. Known native
|
||||
subagent signals also protect their parent through the daemon's subagent store.
|
||||
- OMP additionally requires `get_state.isSettled: true` and `hasPendingAsyncWork: false`.
|
||||
|
||||
+3
-2
@@ -240,7 +240,8 @@ snapshot so a mixed edit can apply its live subset and still name the paths that
|
||||
// `extends` (one of the built-ins or `"acp"`) and `label`. See `provider-launch-config.ts`.
|
||||
providers: Record<providerId, ProviderOverride>,
|
||||
metadataGeneration: {
|
||||
providers: [{ provider, model?, thinkingOptionId? }]
|
||||
providers: [{ provider, model?, thinkingOptionId? }],
|
||||
instructions?: string
|
||||
}
|
||||
},
|
||||
pluginsEnabled: boolean,
|
||||
@@ -319,7 +320,7 @@ Paseo tools; otherwise the provider policy applies. Provider and global policy a
|
||||
session is created, resumed, imported, or reloaded, so configuration changes affect the next
|
||||
session rather than an already-running one.
|
||||
|
||||
`agents.metadataGeneration.providers` selects the models for daemon-side metadata tasks: commit messages, PR text, branch names, and generated titles. An empty list is Automatic; a non-empty list is Manual and only those models are tried. See [public-docs/metadata-generation.md](../public-docs/metadata-generation.md#how-a-model-is-chosen).
|
||||
`agents.metadataGeneration.providers` selects the models for daemon-side metadata tasks: commit messages, PR text, branch names, and generated titles. An empty list is Automatic; a non-empty list is Manual and only those models are tried. `agents.metadataGeneration.instructions` adds host-wide guidance to every metadata generation prompt alongside the built-in or per-project style. See [public-docs/metadata-generation.md](../public-docs/metadata-generation.md#how-a-model-is-chosen).
|
||||
|
||||
### Git process limits
|
||||
|
||||
|
||||
+1
-1
@@ -177,7 +177,7 @@ Electron window controls are top-corner obstructions, not a compact-layout condi
|
||||
|
||||
Windows and Linux controls are fixed window chrome, outside scrolling header content. A tab rail that reaches them ends at their obstruction and shows the shared overflow fade. On macOS, the Explorer toggle occupies a fixed top-right window slot so opening and closing Explorer does not move the pointer target.
|
||||
|
||||
Each window edge has one safe-area owner. `WindowLayoutProvider` publishes the bottom inset that every surface reads through `useSafeAreaInsets()`: on iOS 27.1 and later it is UIKit's bottom-bar clearance, which refines the rectangular home-indicator inset to the screen's corners, and elsewhere the system inset. Surfaces apply that value once and never stack their own spacing under it; `WindowLayoutSurface` owns the horizontal insets the same way.
|
||||
Each window edge has one safe-area owner. `WindowLayoutProvider` publishes the bottom inset that every surface reads through `useSafeAreaInsets()`: on iOS 27.1 and later it is UIKit's bottom-bar clearance, which refines the rectangular home-indicator inset to the screen's corners, and elsewhere the system inset. Surfaces apply that value once and never stack their own spacing under it; `WindowLayoutSurface` owns the horizontal insets the same way, and on wide web layouts it also owns the top inset: it pads the status bar of an iOS Home Screen web app once and gives its content a top inset of 0. Content inside the surface that draws against the window instead of the padded content reads the window's insets; see Gotcha 8 in `docs/floating-panels.md`.
|
||||
|
||||
A new list+detail feature copies the settings shell. A new workspace-shaped feature copies the workspace shell. Inventing a third shape happens in design review, not in a PR.
|
||||
|
||||
|
||||
+16
-5
@@ -459,10 +459,15 @@ Wrapping providers _around_ the modal does nothing. They land on the wrong side.
|
||||
|
||||
## Gotcha 8 — Read safe-area insets where the overlay draws
|
||||
|
||||
A compact sheet tab's body (`SheetBottomInset` in `adaptive-modal-sheet.tsx`) pads the bottom
|
||||
inset and gives its content a bottom inset of 0, so the composer dock sits the same in a sheet as
|
||||
in a tab. An overlay opened from that content and calling `useSafeAreaInsets()` at its call site
|
||||
gets that 0 and draws over the navigation bar.
|
||||
Two containers spend an inset and give their content 0 for that edge:
|
||||
|
||||
- A compact sheet tab's body (`SheetBottomInset` in `adaptive-modal-sheet.tsx`) pads the bottom
|
||||
inset, so the composer dock sits the same in a sheet as in a tab.
|
||||
- `WindowLayoutSurface` on a wide web layout pads the top inset, the status bar of an iOS Home
|
||||
Screen web app (`docs/design.md`, section 9).
|
||||
|
||||
An overlay opened from that content and calling `useSafeAreaInsets()` at its call site gets that 0
|
||||
and draws over the navigation bar or under the status bar. Read the inset where the overlay draws:
|
||||
|
||||
- A Gorhom sheet reads the inset inside its children, which render in the app's sheet host. See
|
||||
`SheetVisibleFrame` (used by `CompactSheetBody` and `ComboboxSheetFrame`) and `MenuSheetScrollView`.
|
||||
@@ -470,7 +475,13 @@ gets that 0 and draws over the navigation bar.
|
||||
`WindowSafeArea` from `@/window-layout` and read the inset below that. It provides the insets of
|
||||
the whole window, published by `WindowLayoutProvider`. Do not put a `SafeAreaProvider` inside the
|
||||
modal: on Android it measures the dialog window, whose bottom inset reads 24, then 0, then 24
|
||||
again over the first frames, and everything padded by it jumps. See `attachment-lightbox.tsx`.
|
||||
again over the first frames, and everything padded by it jumps. See `attachment-lightbox.tsx`
|
||||
and the Mermaid fullscreen viewer.
|
||||
- A panel in a `FloatingPanelPortalHost` reads `useSafeAreaInsets()` inside the portal, where it
|
||||
resolves at the host's position (Gotcha 2): the root host sits outside the layout surface and
|
||||
gets the window's inset, a workspace host inside it gets 0. See the autocomplete `PopoverFrame`.
|
||||
- An absolutely positioned view that covers the surface's padding, such as the overlay left
|
||||
sidebar, reads the window's insets with `useWindowSafeAreaInsets()`.
|
||||
|
||||
## Recipe for a new anchored panel
|
||||
|
||||
|
||||
@@ -972,6 +972,10 @@ reply text once, forks at its message, and shows its duration and stats. Read th
|
||||
`getAssistantReply` (`packages/app/src/types/stream.ts`) instead of checking `kind ===
|
||||
"assistant_message"`.
|
||||
|
||||
A provider-only fact about a tool call goes in the item's `metadata`, which transformers already
|
||||
receive. Do not add a shared tool-call field for it. OMP's intent string is
|
||||
[`metadata.intent`](../public-docs/plugins/reference.md#timeline-items).
|
||||
|
||||
Transformers run synchronously and must be deterministic. When several transformers match, the
|
||||
first one that returns a result owns that source item. Plugin and registration ordering is stable.
|
||||
See `plugin-examples/timeline-items` for the complete contract.
|
||||
|
||||
@@ -340,6 +340,9 @@ See the [public usage source reference](../public-docs/plugins/reference.md#usag
|
||||
contract, account and window identity, provider-derived period names, login fallback, and
|
||||
read-only credential rules. Usage adapters own the interpretation of provider fields; the app
|
||||
renders their names and resolves pins without provider-specific duration guesses.
|
||||
Claude's OAuth usage endpoint is undocumented. Extra-usage amounts are reported in minor currency
|
||||
units and displayed only for USD; the balance contract does not represent other currencies.
|
||||
Codex individual spending limits provide percentages, not dollar amounts.
|
||||
|
||||
---
|
||||
|
||||
|
||||
+109
-71
@@ -4,29 +4,41 @@ All workspaces share one version and release together.
|
||||
|
||||
## Two steps
|
||||
|
||||
A release has exactly two steps. The agent does the first, the user authorizes the second.
|
||||
A release has two steps. The agent runs Preparation before approval, and the user authorizes Ship.
|
||||
|
||||
**Preparation** (reversible — agent does this on the release branch):
|
||||
### Preparation
|
||||
|
||||
- resolve the [release base](#release-base-and-source) and get the [release inventory](#release-inventory) approved when one applies
|
||||
- classify the diff from the previous stable to the release source as patch or minor, then show the
|
||||
target version and rationale to the user
|
||||
- draft `CHANGELOG.md` and `CHANGELOG.zh-CN.md`, show the draft to the user, and wait for review
|
||||
- run the pre-release sanity check (stable only) and surface findings to the user
|
||||
- commit the approved changelog and any requested ACP update, run format, lint, and typecheck, then
|
||||
run `npm run release:prep:<mode>` to create the `chore(release): cut <version>` commit without a tag
|
||||
- push the `release/vX.Y.Z` or `release/vX.Y.Z-beta.N` branch and confirm its `CI` and
|
||||
`Desktop Packages` runs pass (never wait on `main` CI)
|
||||
- run the [pre-release dependency checks](#pre-release-dependency-checks) on the release commit
|
||||
Preparation is reversible and runs on the release branch before the user authorizes shipping.
|
||||
|
||||
**Go-ahead** (user says "go ahead"):
|
||||
1. Resolve the [release base](#release-base-and-source) and get the [release inventory](#release-inventory) approved when one applies.
|
||||
2. Classify the diff from the previous stable release to the release source as patch or minor, then show the target version and rationale to the user.
|
||||
3. Draft `CHANGELOG.md` and `CHANGELOG.zh-CN.md`, show the draft to the user, and wait for approval.
|
||||
4. Run the [pre-release sanity check](#pre-release-sanity-check) for stable releases, and report any findings to the user.
|
||||
5. Commit the approved changelog and any requested ACP update, then run `npm run format`, `npm run lint`, and `npm run typecheck`.
|
||||
6. Run `npm run release:prep:<mode>` to create the `chore(release): cut <version>` commit without a tag.
|
||||
7. Push `release/vX.Y.Z` or `release/vX.Y.Z-beta.N` and wait for `CI` and `Desktop Packages` on that branch to pass (never wait on `main` CI).
|
||||
8. Run the [pre-release dependency checks](#pre-release-dependency-checks) on the release commit.
|
||||
|
||||
- run `npm run release:ship` (stable) or `npm run release:ship:beta` (beta), which publishes npm
|
||||
with retry and registry visibility checks, advances the `beta` dist-tag on stable when newer, and
|
||||
pushes the tag on the already-verified commit
|
||||
- create the release heartbeat immediately and babysit it to completion
|
||||
- open the [reconcile `main`](#reconcile-main) PR right away so its CI runs in parallel with release
|
||||
builds, then delete the remote release branch once the PR merges
|
||||
### Ship
|
||||
|
||||
Ship starts after the user says "go ahead". All tag-triggered GitHub Actions workflows and EAS workflows build from the checked-out tag commit with local workspace packages, so none of them install `@getpaseo/*` from the public npm registry.
|
||||
|
||||
1. Run `npm run release:push` first to verify the clean release branch and push `vX.Y.Z` or `vX.Y.Z-beta.N`. Pushing the tag takes a few seconds and starts `Desktop Release`, `Android APK Release`, `Docker`, `Release Notes Sync`, and (for stable tags) `Deploy App` on GitHub Actions, plus `Release Mobile` (stable) or `Release iOS Beta` (beta) on EAS. (`Deploy Website` runs later on the `release: published` event when `Desktop Release` publishes the stable GitHub Release.)
|
||||
2. Run `npm run release:publish` (stable) or `npm run release:publish:beta` (beta) in parallel with the remote builds. `scripts/publish-release-packages.mjs` publishes the seven `@getpaseo/*` packages in dependency waves and polls npm visibility between packages to avoid `E409` or `E404` propagation races.
|
||||
3. Open the [reconcile `main`](#reconcile-main) PR from `reconcile/vX.Y.Z` or `reconcile/vX.Y.Z-beta.N` right after `npm run release:push` finishes, so its CI run overlaps with npm publication and the release builds.
|
||||
4. Create the release heartbeat immediately with `create_heartbeat` to track every ship step to completion.
|
||||
|
||||
### Sync gates
|
||||
|
||||
Wait until every gate below passes before deleting the remote release branch or reporting the release as shipped:
|
||||
|
||||
- All seven `@getpaseo/*` npm packages are visible on `latest` (stable) or `beta` (beta), and on stable the `beta` dist-tag points to the shipped version unless an active newer beta exists.
|
||||
- All tag-triggered GitHub Actions workflows are green (`Desktop Release`, `Android APK Release`, `Docker`, `Release Notes Sync`, and `Deploy App` for stable), and `Deploy Website` ran after stable publication.
|
||||
- The GitHub Release is published and non-draft (marked prerelease for beta) with the synced changelog body, all macOS, Linux, and Windows assets, the Android APK asset, and all three channel manifests (`latest-mac.yml`, `latest-linux.yml`, `latest.yml` for stable; `beta-mac.yml`, `beta-linux.yml`, `beta.yml` for beta).
|
||||
- The matching EAS workflow is green (`Release Mobile` with all six build, distribution, screenshot, and review-submission jobs for stable; `Release iOS Beta` for beta).
|
||||
- The reconcile PR is merged into `main`.
|
||||
|
||||
Once all sync gates pass, delete the remote release branch (`git push origin --delete release/vX.Y.Z` or `release/vX.Y.Z-beta.N`), delete the heartbeat, and report the release as shipped.
|
||||
|
||||
Rules that apply to both steps:
|
||||
|
||||
@@ -110,18 +122,20 @@ An explicit user instruction can select another base.
|
||||
runs on every merge. Wait for both runs on the release branch commit to pass before shipping.
|
||||
Complete the [pre-release dependency checks](#pre-release-dependency-checks) on that commit.
|
||||
Pushing a `release/**` branch without a `v*` tag triggers no publish workflows.
|
||||
6. After go-ahead, run `npm run release:ship` (stable) or `npm run release:ship:beta` (beta). This
|
||||
publishes to npm and pushes the `v*` tag on the already-verified commit. Because the release
|
||||
branch is already pushed at `HEAD`, no second CI run starts and only the tag release workflows
|
||||
run.
|
||||
7. Start [Reconcile `main`](#reconcile-main) immediately so its PR checks overlap with desktop and
|
||||
EAS builds.
|
||||
6. After go-ahead, push the tag first with `npm run release:push` so remote builds start right away.
|
||||
Because the release branch is already pushed at `HEAD`, no second branch CI run starts, and only
|
||||
the tag release workflows run.
|
||||
7. Immediately in parallel after `npm run release:push` finishes: publish npm packages with
|
||||
`npm run release:publish` (stable) or `npm run release:publish:beta` (beta), start
|
||||
[Reconcile `main`](#reconcile-main) so its PR checks overlap with desktop and EAS builds, and
|
||||
create the release heartbeat. (`npm run release:ship` and `npm run release:ship:beta` also run
|
||||
`release:push` before `release:publish`, so tag builds never wait behind npm.)
|
||||
|
||||
When promoting or branching from a tag created before `release:prep:*`, `release:ship`, and the
|
||||
`release/**` workflow triggers existed (for example `v0.17.0-beta.1`), either cherry-pick the
|
||||
release-tooling commit onto the release branch (leaving product code unchanged) or follow the
|
||||
older tag's scripts (`version:all:*`, manual `gh workflow run ci.yml --ref <branch>`,
|
||||
`release:publish`, and `release:push`) until the next tag carries the new tooling.
|
||||
`release:push`, and `release:publish`) until the next tag carries the new tooling.
|
||||
|
||||
A stable hotfix can take the version a patch beta line would promote to, such as `0.13.3`
|
||||
shipping while `0.13.3-beta.2` soaks. Never republish or reuse a shipped version. Continue the line
|
||||
@@ -130,7 +144,7 @@ computes that from a prerelease, so run `npm run release:check`, bump with
|
||||
`npm version 0.13.4-beta.1 --include-workspace-root --no-git-tag-version && git commit -m "chore(release): cut 0.13.4-beta.1"`,
|
||||
push the release branch for `CI` and `Desktop Packages`, and complete the
|
||||
[pre-release dependency checks](#pre-release-dependency-checks) before shipping with
|
||||
`npm run release:ship:beta`.
|
||||
`npm run release:push` and `npm run release:publish:beta` (or `npm run release:ship:beta`).
|
||||
Record the tested beta tag as its source so its soak still counts for the unchanged content.
|
||||
|
||||
## Release inventory
|
||||
@@ -159,8 +173,7 @@ For a promotion, every item defaults to defer.
|
||||
|
||||
## Reconcile main
|
||||
|
||||
Right after the tag push (in parallel with desktop and EAS builds), open a PR into `main` from a
|
||||
fresh branch off `origin/main` named `reconcile/vX.Y.Z` or `reconcile/vX.Y.Z-beta.N`:
|
||||
Right after `npm run release:push` pushes the tag (in parallel with npm publication and all desktop, APK, Docker, and EAS builds), open a PR into `main` from a fresh branch off `origin/main` named `reconcile/vX.Y.Z` or `reconcile/vX.Y.Z-beta.N`. Reconcile reads only the tagged git commit, so it does not wait for npm or any release build:
|
||||
|
||||
```bash
|
||||
git fetch origin --tags
|
||||
@@ -180,10 +193,10 @@ hunks from the release base:
|
||||
- Leaves unshipped work on `main` untouched and makes no claims about unshipped work in the
|
||||
changelog entry.
|
||||
|
||||
Commit, open the PR into `main`, and merge once its checks pass. After the reconcile PR merges and
|
||||
the release completes, delete the remote release branch (`git push origin --delete release/vX.Y.Z`
|
||||
or `release/vX.Y.Z-beta.N`). The tag is the record of shipped source; Paseo maintains no release
|
||||
track besides `main`.
|
||||
Commit, open the PR into `main`, and merge once its checks pass. Delete the remote release branch
|
||||
(`git push origin --delete release/vX.Y.Z` or `release/vX.Y.Z-beta.N`) only after the reconcile PR
|
||||
merges and every [sync gate](#sync-gates) passes. The tag is the record of shipped source, and
|
||||
Paseo maintains no release track besides `main`.
|
||||
|
||||
## ACP catalog updates
|
||||
|
||||
@@ -240,24 +253,30 @@ npm run release:prep:minor
|
||||
git push -u origin HEAD
|
||||
# Complete the pre-release dependency checks on this commit.
|
||||
|
||||
# 3. After go-ahead and green release-branch checks: publish npm and push the tag.
|
||||
npm run release:ship
|
||||
# 3. After go-ahead and green release-branch checks: push the tag first to start builds.
|
||||
npm run release:push
|
||||
|
||||
# 4. Run these in parallel immediately after step 3:
|
||||
npm run release:publish
|
||||
# Also open the reconcile/vX.Y.Z PR into main and create the release heartbeat.
|
||||
# (`npm run release:ship` runs `release:push` before `release:publish` if used standalone.)
|
||||
```
|
||||
|
||||
`release:ship` runs `scripts/publish-release-packages.mjs` and `scripts/push-current-release-tag.mjs`:
|
||||
`scripts/push-current-release-tag.mjs` refuses non-`release/*` branches, checks that `HEAD` matches `origin/release/*`, tags `HEAD` with `vX.Y.Z`, and pushes the tag. Because `HEAD` is already on the pushed release branch, no second branch CI run starts.
|
||||
|
||||
- Publishes all seven `@getpaseo/*` packages in dependency order, skips versions already on npm,
|
||||
retries transient 429/5xx/network errors, and waits until each version is visible on npm before
|
||||
continuing.
|
||||
- Checks `npm view @getpaseo/cli dist-tags` and moves npm's `beta` dist-tag to the new stable
|
||||
version across all seven packages whenever the stable version is newer than `beta` (leaving
|
||||
`beta` untouched during a stable hotfix on an older line).
|
||||
- Refuses non-`release/*` branches, tags `HEAD` with `vX.Y.Z`, and pushes the tag. Because `HEAD`
|
||||
is already on the release branch, no second CI run starts.
|
||||
`scripts/publish-release-packages.mjs` publishes the seven `@getpaseo/*` packages in dependency-wave order:
|
||||
|
||||
The tag push triggers `Desktop Release`, `Android APK Release`, `Docker`, and `Release Notes Sync` on GitHub Actions. The workflows create the GitHub Release as a draft while builds and release-note sync run. EAS picks up the same tag via the EAS GitHub app and starts the iOS + Android store builds in parallel (see "Mobile builds (EAS)" below) — there is no mobile-release workflow under `.github/workflows`.
|
||||
1. Wave 1: `@getpaseo/highlight`, `@getpaseo/relay`, and `@getpaseo/protocol` (no `@getpaseo/*` dependencies).
|
||||
2. Wave 2: `@getpaseo/client` (depends on `@getpaseo/protocol` and `@getpaseo/relay`).
|
||||
3. Wave 3: `@getpaseo/plugin` (depends on `@getpaseo/client` and `@getpaseo/protocol`).
|
||||
4. Wave 4: `@getpaseo/server` (depends on `@getpaseo/client`, `@getpaseo/highlight`, `@getpaseo/plugin`, `@getpaseo/protocol`, and `@getpaseo/relay`).
|
||||
5. Wave 5: `@getpaseo/cli` (depends on `@getpaseo/client`, `@getpaseo/protocol`, and `@getpaseo/server`).
|
||||
|
||||
Verify `npm view @getpaseo/cli dist-tags` shows `latest` at the shipped version, and `beta` at the shipped version or an active newer beta, before considering the stable release complete.
|
||||
After each `npm publish`, the script polls `npm view` (up to 12 checks, 5 seconds apart) until the published version is visible on npm before moving to the next package. Waiting for registry visibility prevents dependent publishes and manual retries from hitting `E409` conflicts or `E404` propagation lag. On stable releases, the script also checks `npm view @getpaseo/cli dist-tags` and moves npm's `beta` dist-tag to the new stable version across all seven packages whenever the stable version is newer than `beta` (leaving `beta` untouched during a stable hotfix on an older line).
|
||||
|
||||
The tag push triggers `Desktop Release`, `Android APK Release`, `Docker`, `Release Notes Sync`, and `Deploy App` (`app.paseo.sh`, stable tags only) on GitHub Actions. `Desktop Release` and `Release Notes Sync` create the GitHub Release as a draft while builds and release-note sync run. `Deploy Website` triggers later on `release: published` when `Desktop Release` publishes the non-draft stable GitHub Release. EAS picks up the same tag through the EAS GitHub app and starts `Release Mobile` (iOS and Android store builds) in parallel, with no mobile-release workflow under `.github/workflows`. None of these workflows install `@getpaseo/*` from the public npm registry because all of them build from the checked-out tag commit and workspace packages.
|
||||
|
||||
Confirm that `npm view @getpaseo/cli dist-tags` shows `latest` at the shipped version, and `beta` at the shipped version or an active newer beta, before considering the stable release complete.
|
||||
|
||||
The Docker workflow builds images from the checked-out source tree on `main` as non-publishing checks (cancelling superseded `main` runs). Stable `vX.Y.Z` tag pushes publish `ghcr.io/getpaseo/paseo:X.Y.Z` and `ghcr.io/getpaseo/paseo:latest`; beta `vX.Y.Z-beta.N` tag pushes publish only `ghcr.io/getpaseo/paseo:X.Y.Z-beta.N` and never move `latest`.
|
||||
|
||||
@@ -276,8 +295,10 @@ npm run version:all:minor
|
||||
git push -u origin HEAD # Trigger CI + Desktop Packages on release/vX.Y.Z
|
||||
# Wait for CI and Desktop Packages and complete the pre-release dependency checks.
|
||||
# After go-ahead:
|
||||
npm run release:push # Create tag vX.Y.Z on HEAD and push (starts release builds)
|
||||
# In parallel right after release:push:
|
||||
npm run release:publish # Publish to npm (idempotent, with propagation + beta dist-tag sync)
|
||||
npm run release:push # Create tag vX.Y.Z on HEAD and push (triggers release workflows)
|
||||
# Open reconcile/vX.Y.Z PR into main and create the release heartbeat.
|
||||
```
|
||||
|
||||
## Beta flow
|
||||
@@ -294,15 +315,19 @@ npm run release:prep:beta:next # Cut X.Y.Z-beta.2, beta.3, ...
|
||||
git push -u origin HEAD
|
||||
# Complete the pre-release dependency checks on this commit.
|
||||
|
||||
# 3. After go-ahead:
|
||||
npm run release:ship:beta
|
||||
# 3. After go-ahead: push the tag first, then run npm publish, reconcile, and heartbeat in parallel:
|
||||
npm run release:push
|
||||
npm run release:publish:beta
|
||||
# (Or run `npm run release:ship:beta` in one shell while opening reconcile/vX.Y.Z-beta.N.)
|
||||
|
||||
# Later, after soak, promote on release/vX.Y.Z:
|
||||
npm run release:prep:promote
|
||||
git push -u origin HEAD
|
||||
# Wait for CI + Desktop Packages and complete the pre-release dependency checks.
|
||||
# After go-ahead:
|
||||
npm run release:ship
|
||||
npm run release:push
|
||||
npm run release:publish
|
||||
# Open reconcile/vX.Y.Z PR into main and create the release heartbeat in parallel.
|
||||
```
|
||||
|
||||
- Beta tags are published GitHub prereleases like `v0.1.41-beta.1`
|
||||
@@ -489,7 +514,7 @@ macOS 13 maps to Darwin 22. The two values use different version domains; do not
|
||||
iOS and Android store builds are not in `.github/workflows`. They are triggered by the EAS GitHub app the moment the `v*` tag is pushed:
|
||||
|
||||
- **Android (Play Store)** — EAS builds with profile `production` and auto-submits to the Play Store via `eas submit` (EAS-managed credentials). A Fastlane lane then replaces the store screenshots.
|
||||
- **iOS (TestFlight + App Store)** — EAS builds with profile `production`, uploads once through a `testflight` job, distributes the build to the `Paseo Beta` external group with Beta App Review submission, and a Fastlane lane uploads the store screenshots and submits that same build for App Store review.
|
||||
- **iOS (TestFlight + App Store)** — EAS builds with profile `production`, uploads once through a `testflight` job, distributes the build to the `Paseo Beta` external group with Beta App Review submission, and a Fastlane lane uploads the store screenshots and submits that same build for App Store review. When an earlier iOS version is already in Apple's review or release queue (`WAITING_FOR_REVIEW`, `IN_REVIEW`, `PENDING_APPLE_RELEASE`, `PENDING_DEVELOPER_RELEASE`, `PROCESSING_FOR_DISTRIBUTION`, `WAITING_FOR_EXPORT_COMPLIANCE`, or `ACCEPTED`), `submit_review` leaves it untouched, logs `IOS_REVIEW_SKIPPED` with the in-review version and the waiting TestFlight build, and exits `0` so `Release Mobile` stays green.
|
||||
- **Android APK (GitHub Release asset)** — separate, via `.github/workflows/android-apk-release.yml`. This is the only Android-related workflow that lives in this repo.
|
||||
|
||||
EAS uses the local app version source. `packages/app/app.config.js` derives the native version from the package version. Android `versionCode` is `major * 1_000_000 + minor * 1_000 + patch`. iOS reserves 1,000 build slots per app version: beta `N` uses slot `N`, and stable uses slot `999`. For example, `0.2.6-beta.2` appears in App Store Connect as version `0.2.6` build `2006002`; stable uses build `2006999`. Rebuilding the same tag produces the same native build number; if a store has already accepted a binary and you need a different binary, cut the next beta or patch instead of relying on EAS remote auto-increment.
|
||||
@@ -535,11 +560,22 @@ npx eas build:view <build-id>
|
||||
# and submit_ios_for_review.
|
||||
npx eas workflow:view <workflow-run-id> --json
|
||||
|
||||
# Read failed submit/review job logs.
|
||||
# Read submit/review job logs (also check for IOS_REVIEW_SKIPPED on green runs).
|
||||
npx eas workflow:logs <workflow-job-id> --all-steps --non-interactive
|
||||
|
||||
# Stream logs for a build.
|
||||
npx eas build:view <build-id> --json | jq '.logFiles[]'
|
||||
|
||||
# Check live App Store Connect review state + top 5 recent iOS TestFlight builds.
|
||||
npx eas workflow:run ios-review-status.yml
|
||||
|
||||
# Submit a waiting TestFlight build once the review slot is free (default replace_in_review=false skips if still active).
|
||||
npx eas workflow:run resubmit-ios-review.yml
|
||||
# Or force-replace an in-flight review for an urgent iOS hotfix:
|
||||
npx eas workflow:run resubmit-ios-review.yml -F app_version=0.18.1 -F app_build_version=18001999 -F replace_in_review=true
|
||||
|
||||
# Cancel an active in-flight iOS App Store review (pass expected_version to guard against version drift).
|
||||
npx eas workflow:run cancel-ios-review.yml -F expected_version=0.18.0
|
||||
```
|
||||
|
||||
A build's `gitCommitHash` must match the release tag commit. `status` walks through `NEW` → `IN_QUEUE` → `IN_PROGRESS` → `FINISHED` (or `ERRORED`/`CANCELED`). The EAS workflow run's `gitCommitHash` and `trigger` must also match the release tag.
|
||||
@@ -555,15 +591,14 @@ For the `Release Mobile` EAS workflow, these jobs must pass:
|
||||
- `submit_android` — Android binary submitted to the Play Store
|
||||
- `upload_android_screenshots` — Google Play screenshots replaced from the repo
|
||||
|
||||
Do not treat `build_ios: SUCCESS` or `distribute_ios: SUCCESS` as a completed iOS release. `submit_ios_for_review: FAILURE` means the iOS release is blocked even if the build is visible in TestFlight.
|
||||
Do not treat `build_ios: SUCCESS` or `distribute_ios: SUCCESS` as a completed iOS release. `submit_ios_for_review: FAILURE` means the iOS release is blocked even if the build is visible in TestFlight. Even when `submit_ios_for_review` passes, inspect its log with `npx eas workflow:logs <workflow-job-id> --all-steps --non-interactive` for `IOS_REVIEW_SKIPPED`. If App Store submission was skipped because an earlier version is already in flight, explicitly notify the maintainer with both the in-review version/state and the waiting TestFlight version/build so they can either let the current review finish and run `npx eas workflow:run resubmit-ios-review.yml` later, or replace it with `replace_in_review=true`.
|
||||
|
||||
To confirm the submission landed, inspect the EAS workflow with `npx eas workflow:view <workflow-run-id> --json`. App Store Connect (review state for the matching version/build) and the Play Console track are the final ground truth.
|
||||
|
||||
## Release completion and heartbeat
|
||||
|
||||
A release is **in progress** after npm publication and tag push. Report it as
|
||||
**shipped** only after every applicable build, publication, asset, manifest, and
|
||||
store submission passes the completion checklist.
|
||||
A release is in progress once the tag is pushed. Report it as shipped only after every applicable
|
||||
[sync gate](#sync-gates) and completion checklist item passes.
|
||||
|
||||
Immediately after every beta, stable, or promotion tag push, create a heartbeat
|
||||
that resumes the release in the current conversation. Create it automatically
|
||||
@@ -572,9 +607,10 @@ the completion checklist or finds a failure that needs new user authority.
|
||||
|
||||
Each heartbeat checks the release tag commit, `CI` and `Desktop Packages` for the release branch,
|
||||
every tag-triggered GitHub Actions run (`Desktop Release`, `Android APK Release`, `Docker`,
|
||||
`Release Notes Sync`), npm dist-tags, the GitHub Release body and assets, desktop updater
|
||||
manifests, the published Docker image, the applicable EAS workflow, the reconcile PR, and remote
|
||||
release branch cleanup. Inspect the GitHub Release itself and confirm that the macOS, Linux,
|
||||
`Release Notes Sync`, and `Deploy App` for stable), `Deploy Website` after stable release
|
||||
publication, npm dist-tags, the GitHub Release body and assets, desktop updater manifests, the
|
||||
published Docker image, the applicable EAS workflow, the reconcile PR, and remote release branch
|
||||
cleanup. Inspect the GitHub Release itself and confirm that the macOS, Linux,
|
||||
Windows, and Android APK assets are present along with the channel manifests
|
||||
(`latest-mac.yml`, `latest-linux.yml`, and `latest.yml` for stable;
|
||||
`beta-mac.yml`, `beta-linux.yml`, and `beta.yml` for beta).
|
||||
@@ -597,7 +633,7 @@ Pattern:
|
||||
"timezone": "UTC",
|
||||
"maxRuns": 120,
|
||||
"expiresIn": "24h",
|
||||
"prompt": "Resume the vX.Y.Z release babysit for commit <sha>. Check npm tags; CI and Desktop Packages on release/vX.Y.Z; every tag-triggered GitHub Actions run; the published GitHub Release body, expected desktop/APK assets, and channel manifests; the Docker image; the matching EAS workflow; and the reconcile PR into main. Completion requires every applicable checklist item. For stable, require build_ios, distribute_ios (Paseo Beta external distribution and Beta App Review submission), submit_ios_for_review, build_android, and submit_android to succeed. For beta, require the beta TestFlight distribution and Beta App Review path. If work is pending, wait for the next heartbeat. If a failure can be retried safely for the same version, follow the failed-release procedure; otherwise report the blocker. When every applicable completion-checklist item passes and the reconcile PR is merged, delete origin/release/vX.Y.Z, delete THIS heartbeat, report shipped, and stop.",
|
||||
"prompt": "Resume the vX.Y.Z release babysit for commit <sha>. Check npm tags; CI and Desktop Packages on release/vX.Y.Z; every tag-triggered GitHub Actions run (Desktop Release, Android APK Release, Docker, Release Notes Sync, and Deploy App on stable) plus Deploy Website after release publish; the published GitHub Release body, expected desktop/APK assets, and channel manifests; the Docker image; the matching EAS workflow; and the reconcile PR into main. Completion requires every applicable checklist item. For stable, require build_ios, distribute_ios (Paseo Beta external distribution and Beta App Review submission), submit_ios_for_review, build_android, submit_android, and upload_android_screenshots to succeed, and inspect the submit_ios_for_review log for IOS_REVIEW_SKIPPED (if skipped, explicitly report both the in-review version and the waiting TestFlight build to the maintainer). For beta, require the beta TestFlight distribution and Beta App Review path. If work is pending, wait for the next heartbeat. If a failure can be retried safely for the same version, follow the failed-release procedure; otherwise report the blocker. When every applicable completion-checklist item passes and the reconcile PR is merged, delete origin/release/vX.Y.Z, delete THIS heartbeat, report shipped, and stop.",
|
||||
}
|
||||
```
|
||||
|
||||
@@ -622,6 +658,8 @@ The GitHub Release body is populated automatically by the `Release Notes Sync` w
|
||||
|
||||
**NEVER bump the version to fix a build problem.** New versions are reserved for meaningful product changes (features, fixes, improvements). Build/CI failures are fixed on the current version.
|
||||
|
||||
If `npm run release:publish` or `npm run release:publish:beta` fails after `npm run release:push` pushed the tag, fix the npm authentication, OTP, or local build issue and rerun the publish command on the same commit. Do not move or force-push the `v*` tag, because `scripts/publish-release-packages.mjs` skips packages already visible on npm and resumes from the remaining packages.
|
||||
|
||||
**Do not rely on `workflow_dispatch` for tagged code fixes.** The `workflow_dispatch` trigger runs the workflow file from the default branch but checks out the code at the tag ref (`ref: ${{ inputs.tag }}`). That means fixes committed to `main` won't change the tagged source tree being built. `workflow_dispatch` only helps when the fix lives in the workflow file itself.
|
||||
|
||||
For Docker-only retries, **do not push or force-push a `v*` release tag**.
|
||||
@@ -706,9 +744,7 @@ intentionally unavailable to desktop updater clients.
|
||||
- The npm `version` lifecycle regenerates F-Droid changelog files from `CHANGELOG.md` for stable releases only (`npm run fdroid:changelogs`) and stages them, so the release commit and tag carry them. Betas are a no-op. A stable run **aborts the release** if `CHANGELOG.md` has no entry for the version being cut — commit the changelog entry first. See [docs/android.md](android.md) for why these files are generated per ABI.
|
||||
- `release:prepare` refreshes workspace `node_modules` links to prevent stale types.
|
||||
- `npm run dev:desktop` and `npm run build:desktop` target the Electron desktop package in `packages/desktop`.
|
||||
- `release:publish` and `release:publish:beta` run `scripts/publish-release-packages.mjs`: if a run
|
||||
fails partway through, re-running skips versions already published on npm, retries transient
|
||||
registry errors, and waits for each version to become visible on npm before continuing.
|
||||
- `release:publish` and `release:publish:beta` run `scripts/publish-release-packages.mjs`. They publish the seven `@getpaseo/*` packages in dependency waves, skip versions already visible on npm, retry transient registry errors, and poll `npm view` between packages so dependents do not hit `E409` or `E404` propagation lag. `release:ship` and `release:ship:beta` run `release:push` before `release:publish` or `release:publish:beta`.
|
||||
- The website uses GitHub's latest published release API for download links, so published beta prereleases do not replace the stable download target.
|
||||
|
||||
## Changelog format
|
||||
@@ -969,8 +1005,8 @@ Every entry covers `previous stable release → release source`: first beta, lat
|
||||
- [ ] The diff from the previous stable to the resolved release source is classified as patch or minor, with the target version and rationale approved
|
||||
- [ ] `npm run release:prep:beta:patch`, `release:prep:beta:minor`, or `release:prep:beta:next` created the version commit on `release/vX.Y.Z-beta.N` without a tag, and the pushed branch passed `CI` and `Desktop Packages` before shipping (never relying on `main` CI)
|
||||
- [ ] Complete the [pre-release dependency checks](#pre-release-dependency-checks) on the release commit
|
||||
- [ ] After go-ahead, `npm run release:ship:beta` published npm and pushed the `vX.Y.Z-beta.N` tag without triggering a second CI run
|
||||
- [ ] npm shows the version under the `beta` dist-tag, not `latest`
|
||||
- [ ] After go-ahead, `npm run release:push` pushed the `vX.Y.Z-beta.N` tag without triggering a second CI run, while `npm run release:publish:beta`, the `reconcile/vX.Y.Z-beta.N` PR, and the release heartbeat started in parallel
|
||||
- [ ] All seven `@getpaseo/*` npm packages show the version under the `beta` dist-tag, not `latest`
|
||||
- [ ] The GitHub prerelease was published only after the three beta manifests were uploaded, and it has the changelog body and every expected macOS, Linux, Windows, and Android APK asset
|
||||
- [ ] GitHub `Desktop Release` workflow for the `v*-beta.N` tag is green
|
||||
- [ ] The GitHub prerelease contains `beta-mac.yml`, `beta-linux.yml`, and `beta.yml`
|
||||
@@ -978,7 +1014,7 @@ Every entry covers `previous stable release → release source`: first beta, lat
|
||||
- [ ] GitHub `Docker` workflow is green and the versioned beta image is published without moving `latest`
|
||||
- [ ] GitHub `Release Notes Sync` mirrored the beta entry into the prerelease body
|
||||
- [ ] EAS `Release iOS Beta` completed its build, TestFlight distribution, external beta group, and Beta App Review path
|
||||
- [ ] The [reconcile PR](#reconcile-main) brought the shipped changelog entries and version into `main`, and `origin/release/vX.Y.Z-beta.N` was deleted
|
||||
- [ ] The [reconcile PR](#reconcile-main) brought the shipped changelog entries and version into `main` and merged before cleanup, and `origin/release/vX.Y.Z-beta.N` was deleted after all sync gates passed
|
||||
- [ ] The release heartbeat was created after the tag push and deleted only after every item above passed
|
||||
|
||||
### Stable release (or promotion)
|
||||
@@ -988,13 +1024,13 @@ Every entry covers `previous stable release → release source`: first beta, lat
|
||||
- [ ] The release base and changes match the [release base table](#release-base-and-source) and any approved [inventory](#release-inventory)
|
||||
- [ ] A promotion ships the tested beta's product content after its soak, unless the user explicitly overrode either default
|
||||
- [ ] Every PR in the release range has been opened, and its full description and every linked issue have been read before drafting the changelog
|
||||
- [ ] Update `CHANGELOG.md` with user-facing release notes (features, fixes — not refactors). Promotion renames the series' `## X.Y.Z-beta.N` entry to `## X.Y.Z - YYYY-MM-DD` and re-checks it covers the full release. Commit the matching [`CHANGELOG.zh-CN.md` entry](#changelog-translations) with it
|
||||
- [ ] Update `CHANGELOG.md` with user-facing release notes (features, fixes, not refactors). Promotion renames the series' `## X.Y.Z-beta.N` entry to `## X.Y.Z - YYYY-MM-DD` and re-checks it covers the full release. Commit the matching [`CHANGELOG.zh-CN.md` entry](#changelog-translations) with it
|
||||
- [ ] Verify the changelog heading follows strict `## X.Y.Z - YYYY-MM-DD` format
|
||||
- [ ] Ensure local format, lint, and typecheck pass and the working tree is clean before running `release:prep:*`
|
||||
- [ ] `npm run release:prep:patch`, `release:prep:minor`, or `release:prep:promote` created the version commit on `release/vX.Y.Z` without a tag, and the pushed branch passed `CI` and `Desktop Packages` before shipping (never relying on `main` CI)
|
||||
- [ ] Complete the [pre-release dependency checks](#pre-release-dependency-checks) on the release commit
|
||||
- [ ] After go-ahead, `npm run release:ship` published npm, updated dist-tags, and pushed the `vX.Y.Z` tag without triggering a second CI run
|
||||
- [ ] `latest` resolves to the new stable, and `beta` resolves to it too unless an active newer beta holds `beta`
|
||||
- [ ] After go-ahead, `npm run release:push` pushed the `vX.Y.Z` tag without triggering a second CI run, while `npm run release:publish`, the `reconcile/vX.Y.Z` PR, and the release heartbeat started in parallel
|
||||
- [ ] All seven `@getpaseo/*` npm packages show `latest` at the new stable, and `beta` at the new stable too unless an active newer beta holds `beta`
|
||||
- [ ] The GitHub Release was published only after the three stable manifests were uploaded, and it has the changelog body and every expected macOS, Linux, Windows, and Android APK asset
|
||||
- [ ] GitHub `Desktop Release` workflow for the `v*` tag is green
|
||||
- [ ] The GitHub Release contains `latest-mac.yml`, `latest-linux.yml`, and `latest.yml`
|
||||
@@ -1002,11 +1038,13 @@ Every entry covers `previous stable release → release source`: first beta, lat
|
||||
- [ ] GitHub `Android APK Release` workflow for the same tag is green
|
||||
- [ ] GitHub `Docker` workflow is green and both the versioned and `latest` images are published
|
||||
- [ ] GitHub `Release Notes Sync` is green and the release body matches the stable changelog entry
|
||||
- [ ] GitHub `Deploy App` workflow for the same tag is green, and `Deploy Website` succeeded after the release published
|
||||
- [ ] EAS `Release Mobile` workflow for the same tag is green
|
||||
- [ ] EAS iOS `build_ios` completes for the same tag
|
||||
- [ ] EAS iOS `distribute_ios` succeeds, uploading the binary once, distributing it to `Paseo Beta`, and submitting it for Beta App Review
|
||||
- [ ] EAS iOS `submit_ios_for_review` succeeds, putting the build into App Store review
|
||||
- [ ] EAS iOS `submit_ios_for_review` succeeds, putting the build into App Store review (or its log was checked for `IOS_REVIEW_SKIPPED` and the maintainer was notified with both the in-review version and the waiting TestFlight build)
|
||||
- [ ] EAS Android `build_android` completes for the same tag
|
||||
- [ ] EAS Android `submit_android` succeeds, putting the build on its Play Store track
|
||||
- [ ] The [reconcile PR](#reconcile-main) brought the shipped changelog entries, F-Droid changelogs, and version into `main`, and `origin/release/vX.Y.Z` was deleted
|
||||
- [ ] EAS Android `upload_android_screenshots` succeeds for the same tag
|
||||
- [ ] The [reconcile PR](#reconcile-main) brought the shipped changelog entries, F-Droid changelogs, and version into `main` and merged before cleanup, and `origin/release/vX.Y.Z` was deleted after all sync gates passed
|
||||
- [ ] The release heartbeat was created after the tag push and deleted only after every item above passed
|
||||
|
||||
@@ -30,7 +30,7 @@ Terminal directory snapshots (`terminalsChanged`) and workspace contribution cha
|
||||
|
||||
Each `onChange` delivers both the new snapshot and the `previous` one (`{ state, changedAt }`). The transition flows unchanged up through `TerminalSession.onActivityChange` (as `{ activity, previous }`), the worker protocol's `terminalActivityChange` event, and the manager-level `subscribeTerminalActivity(listener)` stream (`{ terminalId, name, cwd, activity, previous }`).
|
||||
|
||||
The daemon consumes these transitions, not snapshots. When a transition moves from `working` to `idle`, the tracker records finished attention, so the terminal shows the same green finished dot as an idle agent that needs review. The websocket layer also fires a "Terminal finished" attention notification. A terminal that exits while still working emits no turn-end notification.
|
||||
The daemon consumes these transitions, not snapshots. When a transition moves from `working` to `idle`, the tracker records finished attention, so the terminal shows the same green finished dot as an idle agent that needs review. Focusing the terminal tab or using Mark as read on its owning workspace clears finished attention. Mark as read leaves needs-input attention alone, the same way it leaves an agent's pending permission. The websocket layer also fires a "Terminal finished" attention notification. A terminal that exits while still working emits no turn-end notification.
|
||||
|
||||
Terminal list visibility is `workspaceId`-scoped: a terminal belongs to the workspace that created it, and same-`cwd` sibling workspaces do not see it in their terminal lists. Terminal status routing starts from that owning workspace, uses the owning workspace's `cwd`, then fans the status bucket out to every active workspace with the same `cwd`.
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
- Remote workspace browser proxy: Desktop browser tabs in remote workspaces now route through the workspace daemon, so remote localhost servers open directly in Paseo.
|
||||
- Per-device notification preferences: Each device can choose which agent, terminal, and plugin events send notifications, and plugins can send notifications and handle taps.
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,4 @@
|
||||
- Remote workspace browser proxy: Desktop browser tabs in remote workspaces now route through the workspace daemon, so remote localhost servers open directly in Paseo.
|
||||
- Per-device notification preferences: Each device can choose which agent, terminal, and plugin events send notifications, and plugins can send notifications and handle taps.
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,4 @@
|
||||
- Remote workspace browser proxy: Desktop browser tabs in remote workspaces now route through the workspace daemon, so remote localhost servers open directly in Paseo.
|
||||
- Per-device notification preferences: Each device can choose which agent, terminal, and plugin events send notifications, and plugins can send notifications and handle taps.
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,4 @@
|
||||
- Remote workspace browser proxy: Desktop browser tabs in remote workspaces now route through the workspace daemon, so remote localhost servers open directly in Paseo.
|
||||
- Per-device notification preferences: Each device can choose which agent, terminal, and plugin events send notifications, and plugins can send notifications and handle taps.
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,8 @@
|
||||
- Host metadata instructions: Set host-wide instructions once to guide language, tone, and formatting for generated workspace titles, branch names, commit messages, and pull requests.
|
||||
- Enterprise spending usage: Usage now shows Claude extra-usage spending and Codex individual spending limits with reset times.
|
||||
|
||||
Fixed
|
||||
- Fixed Android agent push notifications arriving minutes late during Doze
|
||||
- Fixed Command Center results reordering mid-word while typing
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,8 @@
|
||||
- Host metadata instructions: Set host-wide instructions once to guide language, tone, and formatting for generated workspace titles, branch names, commit messages, and pull requests.
|
||||
- Enterprise spending usage: Usage now shows Claude extra-usage spending and Codex individual spending limits with reset times.
|
||||
|
||||
Fixed
|
||||
- Fixed Android agent push notifications arriving minutes late during Doze
|
||||
- Fixed Command Center results reordering mid-word while typing
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,8 @@
|
||||
- Host metadata instructions: Set host-wide instructions once to guide language, tone, and formatting for generated workspace titles, branch names, commit messages, and pull requests.
|
||||
- Enterprise spending usage: Usage now shows Claude extra-usage spending and Codex individual spending limits with reset times.
|
||||
|
||||
Fixed
|
||||
- Fixed Android agent push notifications arriving minutes late during Doze
|
||||
- Fixed Command Center results reordering mid-word while typing
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,8 @@
|
||||
- Host metadata instructions: Set host-wide instructions once to guide language, tone, and formatting for generated workspace titles, branch names, commit messages, and pull requests.
|
||||
- Enterprise spending usage: Usage now shows Claude extra-usage spending and Codex individual spending limits with reset times.
|
||||
|
||||
Fixed
|
||||
- Fixed Android agent push notifications arriving minutes late during Doze
|
||||
- Fixed Command Center results reordering mid-word while typing
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
+1
-1
@@ -1 +1 @@
|
||||
sha256-kzMT9+KlfYhaEa643XUTzxOA4Y8+zdpdXEs2QguED7w=
|
||||
sha256-SZV3WTKLb+JhxWNo/jWyx+2sipzfL93YbbqQSihd3Wo=
|
||||
|
||||
Generated
+29
-29
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "paseo",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "paseo",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"workspaces": [
|
||||
@@ -37541,7 +37541,7 @@
|
||||
},
|
||||
"packages/app": {
|
||||
"name": "@getpaseo/app",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"dependencies": {
|
||||
"@codemirror/commands": "6.10.4",
|
||||
"@codemirror/language": "6.12.4",
|
||||
@@ -39694,13 +39694,13 @@
|
||||
},
|
||||
"packages/cli": {
|
||||
"name": "@getpaseo/cli",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^1.0.0",
|
||||
"@getpaseo/client": "0.17.6",
|
||||
"@getpaseo/protocol": "0.17.6",
|
||||
"@getpaseo/server": "0.17.6",
|
||||
"@getpaseo/client": "0.18.1",
|
||||
"@getpaseo/protocol": "0.18.1",
|
||||
"@getpaseo/server": "0.18.1",
|
||||
"chalk": "^5.3.0",
|
||||
"commander": "^12.0.0",
|
||||
"mime-types": "^2.1.35",
|
||||
@@ -39947,11 +39947,11 @@
|
||||
},
|
||||
"packages/client": {
|
||||
"name": "@getpaseo/client",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@getpaseo/protocol": "0.17.6",
|
||||
"@getpaseo/relay": "0.17.6",
|
||||
"@getpaseo/protocol": "0.18.1",
|
||||
"@getpaseo/relay": "0.18.1",
|
||||
"ws": "^8.20.0",
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
@@ -39963,7 +39963,7 @@
|
||||
},
|
||||
"packages/desktop": {
|
||||
"name": "@getpaseo/desktop",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@getpaseo/cli": "*",
|
||||
@@ -40206,7 +40206,7 @@
|
||||
},
|
||||
"packages/expo-two-way-audio": {
|
||||
"name": "@getpaseo/expo-two-way-audio",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.14",
|
||||
@@ -40252,7 +40252,7 @@
|
||||
},
|
||||
"packages/highlight": {
|
||||
"name": "@getpaseo/highlight",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@codemirror/language": "6.12.4",
|
||||
@@ -40282,7 +40282,7 @@
|
||||
},
|
||||
"packages/plugin": {
|
||||
"name": "@getpaseo/plugin",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "^1.4.0",
|
||||
@@ -40290,8 +40290,8 @@
|
||||
"use-sync-external-store": "^1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@getpaseo/client": "0.17.6",
|
||||
"@getpaseo/protocol": "0.17.6",
|
||||
"@getpaseo/client": "0.18.1",
|
||||
"@getpaseo/protocol": "0.18.1",
|
||||
"@types/node": "^20.9.0",
|
||||
"@types/react": "~19.2.0",
|
||||
"react": "19.2.3",
|
||||
@@ -40301,8 +40301,8 @@
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@getpaseo/client": "0.17.6",
|
||||
"@getpaseo/protocol": "0.17.6",
|
||||
"@getpaseo/client": "0.18.1",
|
||||
"@getpaseo/protocol": "0.18.1",
|
||||
"react": ">=19.1.0 <20",
|
||||
"react-native": ">=0.81.5",
|
||||
"zod": "^4.4.3"
|
||||
@@ -40324,7 +40324,7 @@
|
||||
},
|
||||
"packages/protocol": {
|
||||
"name": "@getpaseo/protocol",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"semver": "^7.8.5",
|
||||
@@ -40351,7 +40351,7 @@
|
||||
}
|
||||
},
|
||||
"packages/react-native-enriched-markdown": {
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
@@ -40367,7 +40367,7 @@
|
||||
},
|
||||
"packages/relay": {
|
||||
"name": "@getpaseo/relay",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@noble/ciphers": "^2.4.0",
|
||||
@@ -40589,17 +40589,17 @@
|
||||
},
|
||||
"packages/server": {
|
||||
"name": "@getpaseo/server",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "^0.17.1",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.3.326",
|
||||
"@anthropic-ai/sdk": "^0.104.2",
|
||||
"@getpaseo/client": "0.17.6",
|
||||
"@getpaseo/highlight": "0.17.6",
|
||||
"@getpaseo/plugin": "0.17.6",
|
||||
"@getpaseo/protocol": "0.17.6",
|
||||
"@getpaseo/relay": "0.17.6",
|
||||
"@getpaseo/client": "0.18.1",
|
||||
"@getpaseo/highlight": "0.18.1",
|
||||
"@getpaseo/plugin": "0.18.1",
|
||||
"@getpaseo/protocol": "0.18.1",
|
||||
"@getpaseo/relay": "0.18.1",
|
||||
"@isaacs/ttlcache": "^2.1.4",
|
||||
"@modelcontextprotocol/node": "2.1.2",
|
||||
"@modelcontextprotocol/sdk": "1.29.0",
|
||||
@@ -41550,7 +41550,7 @@
|
||||
},
|
||||
"packages/website": {
|
||||
"name": "@getpaseo/website",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"dependencies": {
|
||||
"@cloudflare/vite-plugin": "^1.29.1",
|
||||
"@cloudflare/workers-types": "^4.20260317.1",
|
||||
@@ -43161,7 +43161,7 @@
|
||||
},
|
||||
"plugins": {
|
||||
"name": "@getpaseo/builtin-plugins",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"dependencies": {
|
||||
"@getpaseo/plugin": "*",
|
||||
"zod": "^4.4.3"
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "paseo",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"private": true,
|
||||
"description": "Paseo: voice-controlled development environment for local AI coding agents",
|
||||
"keywords": [
|
||||
@@ -124,8 +124,8 @@
|
||||
"release:publish": "node scripts/publish-release-packages.mjs",
|
||||
"release:publish:beta": "node scripts/publish-release-packages.mjs --beta",
|
||||
"release:push": "node scripts/push-current-release-tag.mjs",
|
||||
"release:ship": "node scripts/push-current-release-tag.mjs --check && npm run release:publish && npm run release:push",
|
||||
"release:ship:beta": "node scripts/push-current-release-tag.mjs --check && npm run release:publish:beta && npm run release:push",
|
||||
"release:ship": "npm run release:push && npm run release:publish",
|
||||
"release:ship:beta": "npm run release:push && npm run release:publish:beta",
|
||||
"release:reconcile": "node scripts/reconcile-release.mjs"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
name: Cancel iOS App Store review
|
||||
|
||||
# Cancel an active in-flight iOS App Store review submission on App Store
|
||||
# Connect. Pass expected_version to abort safely if Apple has already moved on
|
||||
# to a different version.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
expected_version:
|
||||
type: string
|
||||
required: false
|
||||
description: "Expected marketing version currently in review, e.g. 0.18.0. Fails without cancelling if the active submission is for a different version."
|
||||
|
||||
jobs:
|
||||
cancel_ios_review:
|
||||
name: Cancel iOS App Store review
|
||||
environment: production
|
||||
runs_on: macos-medium
|
||||
steps:
|
||||
- uses: eas/checkout
|
||||
- name: Install fastlane
|
||||
run: bundle install
|
||||
- name: Cancel review
|
||||
run: |
|
||||
export EXPECTED_VERSION="${{ inputs.expected_version }}"
|
||||
bundle exec fastlane ios cancel_review
|
||||
@@ -0,0 +1,20 @@
|
||||
name: Check iOS App Store review status
|
||||
|
||||
# Inspect live App Store Connect state for sh.paseo: the live App Store
|
||||
# version, any active or pending App Store versions, active review submissions,
|
||||
# and the five most recently uploaded iOS TestFlight builds.
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
|
||||
jobs:
|
||||
check_ios_review_status:
|
||||
name: Check iOS App Store review status
|
||||
environment: production
|
||||
runs_on: macos-medium
|
||||
steps:
|
||||
- uses: eas/checkout
|
||||
- name: Install fastlane
|
||||
run: bundle install
|
||||
- name: Check review status
|
||||
run: bundle exec fastlane ios review_status
|
||||
@@ -69,4 +69,5 @@ jobs:
|
||||
run: |
|
||||
export APP_VERSION="${{ needs.build_ios.outputs.app_version }}"
|
||||
export APP_BUILD_VERSION="${{ needs.build_ios.outputs.app_build_version }}"
|
||||
export REPLACE_IN_REVIEW="false"
|
||||
bundle exec fastlane ios submit_review
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
name: Resubmit iOS for App Store review
|
||||
|
||||
# Standalone re-trigger for the App Store review submission step. The iOS
|
||||
# binary is already uploaded to TestFlight via the EAS GitHub app's tag-push
|
||||
# build; this workflow just runs the fastlane submit_review lane against the
|
||||
# latest TestFlight build, without rebuilding or re-uploading.
|
||||
# Standalone trigger for the App Store review submission step. The iOS binary
|
||||
# is already uploaded to TestFlight via the EAS GitHub app's tag-push build;
|
||||
# this workflow runs fastlane ios submit_review without rebuilding or
|
||||
# re-uploading. By default (replace_in_review=false) it skips cleanly if
|
||||
# another App Store review is already in flight; pass replace_in_review=true
|
||||
# to cancel an in-flight review and submit an urgent replacement.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -16,6 +18,11 @@ on:
|
||||
type: string
|
||||
required: false
|
||||
description: "CFBundleVersion to resubmit, e.g. 2. Only used when app_version is set."
|
||||
replace_in_review:
|
||||
type: boolean
|
||||
required: false
|
||||
default: false
|
||||
description: "Cancel an in-flight App Store review and submit this build instead. Leave false to skip safely while another review is active."
|
||||
|
||||
jobs:
|
||||
submit_ios_for_review:
|
||||
@@ -30,4 +37,5 @@ jobs:
|
||||
run: |
|
||||
export APP_VERSION="${{ inputs.app_version }}"
|
||||
export APP_BUILD_VERSION="${{ inputs.app_build_version }}"
|
||||
export REPLACE_IN_REVIEW="${{ inputs.replace_in_review }}"
|
||||
bundle exec fastlane ios submit_review
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { Locator } from "@playwright/test";
|
||||
import { test, expect, type Page } from "../support/fixtures";
|
||||
import { gotoAppShell } from "../support/helpers/app";
|
||||
import { daemonWsRoutePattern } from "../support/helpers/daemon-port";
|
||||
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
|
||||
import { seedWorkspace, type SeededWorkspace } from "../support/helpers/seed-client";
|
||||
import { getServerId } from "../support/helpers/server-id";
|
||||
|
||||
@@ -142,6 +143,38 @@ test.describe("Command center workspace management", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("keeps Rename workspace ahead of Rename agent across renam and rename", async ({ page }) => {
|
||||
const workspace = await seedMockAgentWorkspace({
|
||||
repoPrefix: "cc-rename-order-",
|
||||
title: "Command center rename order",
|
||||
model: "five-minute-stream",
|
||||
});
|
||||
|
||||
try {
|
||||
await openAgentRoute(page, workspace);
|
||||
const panel = await openCommandCenter(page);
|
||||
const searchInput = panel.getByTestId("command-center-input");
|
||||
const renameWorkspace = action(panel, "Rename workspace");
|
||||
const renameAgent = action(panel, "Rename agent");
|
||||
|
||||
for (const query of ["renam", "rename"]) {
|
||||
await searchInput.fill(query);
|
||||
await expect(renameWorkspace).toBeVisible({ timeout: 15_000 });
|
||||
await expect(renameAgent).toBeVisible({ timeout: 15_000 });
|
||||
const workspaceTop = (await renameWorkspace.boundingBox())?.y ?? Number.NaN;
|
||||
const agentTop = (await renameAgent.boundingBox())?.y ?? Number.NaN;
|
||||
expect(workspaceTop, query).toBeLessThan(agentTop);
|
||||
}
|
||||
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(page.getByTestId("workspace-rename-modal-global-input")).toBeFocused({
|
||||
timeout: 15_000,
|
||||
});
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("copies the workspace path and confirms with a toast", async ({ page }) => {
|
||||
const workspace = await seedWorkspace({ repoPrefix: "cc-copy-path-" });
|
||||
|
||||
|
||||
@@ -12,14 +12,25 @@ import {
|
||||
import { expectWorkspaceTabVisible, openSessions } from "../support/helpers/archive-tab";
|
||||
import { daemonWsRoutePattern } from "../support/helpers/daemon-port";
|
||||
import { getServerId } from "../support/helpers/server-id";
|
||||
import { switchWorkspaceViaSidebar } from "../support/helpers/workspace-ui";
|
||||
import {
|
||||
switchWorkspaceViaSidebar,
|
||||
waitForSidebarHydration,
|
||||
} from "../support/helpers/workspace-ui";
|
||||
import {
|
||||
closeMobileAgentSidebar,
|
||||
expectMobileAgentSidebarHidden,
|
||||
expectMobileAgentSidebarVisible,
|
||||
openMobileAgentSidebar,
|
||||
} from "../support/helpers/sidebar";
|
||||
import { expectNewWorkspaceProjectSelected } from "../support/helpers/new-workspace";
|
||||
import {
|
||||
expectNewWorkspaceProjectSelected,
|
||||
openGlobalNewWorkspaceComposer,
|
||||
openStartingRefPicker,
|
||||
selectBranchInPicker,
|
||||
selectWorkspaceIsolation,
|
||||
} from "../support/helpers/new-workspace";
|
||||
import { gotoAppShell } from "../support/helpers/app";
|
||||
import { seedWorkspace } from "../support/helpers/seed-client";
|
||||
|
||||
const TEST_COMMANDS = [
|
||||
{
|
||||
@@ -119,11 +130,18 @@ const TEST_COMMANDS_REPLY: ListCommandsReply = { commands: TEST_COMMANDS, error:
|
||||
async function installListCommandsStub(
|
||||
page: Page,
|
||||
reply: () => ListCommandsReply | Promise<ListCommandsReply> = () => TEST_COMMANDS_REPLY,
|
||||
options?: {
|
||||
onClientMessage?: (message: string | Buffer, forward: () => void) => void;
|
||||
},
|
||||
): Promise<void> {
|
||||
await page.routeWebSocket(daemonWsRoutePattern(), (ws) => {
|
||||
const server = ws.connectToServer();
|
||||
|
||||
ws.onMessage((message) => {
|
||||
if (options?.onClientMessage) {
|
||||
options.onClientMessage(message, () => server.send(message));
|
||||
return;
|
||||
}
|
||||
server.send(message);
|
||||
});
|
||||
|
||||
@@ -169,6 +187,24 @@ async function installListCommandsStub(
|
||||
});
|
||||
}
|
||||
|
||||
async function holdWorkspaceCreateWithCommandsStub(page: Page): Promise<{ release: () => void }> {
|
||||
let release: (() => void) | null = null;
|
||||
await installListCommandsStub(page, undefined, {
|
||||
onClientMessage(message, forward) {
|
||||
if (typeof message === "string" && message.includes('"workspace.create.request"')) {
|
||||
release = forward;
|
||||
return;
|
||||
}
|
||||
forward();
|
||||
},
|
||||
});
|
||||
return {
|
||||
release: () => {
|
||||
release?.();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function createHeldReply(): {
|
||||
reply: () => Promise<ListCommandsReply>;
|
||||
release: () => void;
|
||||
@@ -450,6 +486,44 @@ test.describe("Composer autocomplete", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("shows autocomplete after closing the New Workspace branch picker and hides it while submitting", async ({
|
||||
page,
|
||||
}) => {
|
||||
const heldCreate = await holdWorkspaceCreateWithCommandsStub(page);
|
||||
|
||||
const seeded = await seedWorkspace({ repoPrefix: "autocomplete-branch-picker-" });
|
||||
try {
|
||||
await gotoAppShell(page);
|
||||
await waitForSidebarHydration(page);
|
||||
await openGlobalNewWorkspaceComposer(page);
|
||||
|
||||
const input = composerLocator(page);
|
||||
await expect(input).toBeEditable({ timeout: 30_000 });
|
||||
await selectWorkspaceIsolation(page, "worktree");
|
||||
await expect(page.getByTestId("new-workspace-ref-picker-trigger")).toBeVisible({
|
||||
timeout: 30_000,
|
||||
});
|
||||
|
||||
await openStartingRefPicker(page);
|
||||
await selectBranchInPicker(page, "main");
|
||||
await expect(input).toBeFocused();
|
||||
|
||||
await page.keyboard.type("/h");
|
||||
const popover = page.getByTestId("composer-autocomplete-popover");
|
||||
await expect(popover.getByText("/help", { exact: true }).first()).toBeVisible({
|
||||
timeout: 30_000,
|
||||
});
|
||||
|
||||
// Submitting while locked hides the autocomplete popover instead of leaving it over loading.
|
||||
await page.getByTestId("workspace-create-submit").click();
|
||||
await expect(input).not.toBeEditable({ timeout: 10_000 });
|
||||
await expect(popover).toHaveCount(0);
|
||||
} finally {
|
||||
heldCreate.release();
|
||||
await seeded.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("keeps New workspace off the running-agent command list before a project is chosen", async ({
|
||||
page,
|
||||
}) => {
|
||||
|
||||
@@ -111,3 +111,102 @@ test("replaces only the first configured metadata model", async ({ page }) => {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test("saves and clears host-wide metadata instructions without overwriting providers", async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
const client = await connectNewWorkspaceDaemonClient({ ownProjects: false });
|
||||
const previousConfig = await client.getDaemonConfig();
|
||||
|
||||
try {
|
||||
await client.patchDaemonConfig({
|
||||
metadataGeneration: {
|
||||
providers: [{ provider: "mock", model: "ten-second-stream" }],
|
||||
instructions: "",
|
||||
},
|
||||
});
|
||||
await openMetadataGenerationSettings(page);
|
||||
|
||||
const instructionsRow = page.getByTestId("metadata-generation-instructions-row");
|
||||
await expect(instructionsRow).toBeVisible();
|
||||
await page.screenshot({
|
||||
path: testInfo.outputPath("metadata-instructions-tucked-empty.png"),
|
||||
fullPage: true,
|
||||
});
|
||||
|
||||
await instructionsRow.click();
|
||||
|
||||
const instructionsSheet = page.getByTestId("metadata-generation-instructions-sheet");
|
||||
const instructionsInput = page.getByTestId("metadata-generation-instructions-input");
|
||||
const saveButton = page.getByTestId("metadata-generation-instructions-save");
|
||||
|
||||
await expect(instructionsSheet).toBeVisible();
|
||||
await expect(saveButton).toBeDisabled();
|
||||
await page.screenshot({
|
||||
path: testInfo.outputPath("metadata-instructions-sheet-empty.png"),
|
||||
fullPage: true,
|
||||
animations: "disabled",
|
||||
});
|
||||
|
||||
await instructionsInput.fill("Write in Simplified Chinese. Do not use em dashes.");
|
||||
await expect(saveButton).toBeEnabled();
|
||||
await saveButton.click();
|
||||
|
||||
await expect(instructionsSheet).toHaveCount(0);
|
||||
await expect
|
||||
.poll(async () => (await client.getDaemonConfig()).config.metadataGeneration)
|
||||
.toEqual({
|
||||
providers: [{ provider: "mock", model: "ten-second-stream" }],
|
||||
instructions: "Write in Simplified Chinese. Do not use em dashes.",
|
||||
});
|
||||
|
||||
await page.reload();
|
||||
await expect(
|
||||
page
|
||||
.getByTestId("metadata-generation-instructions-row")
|
||||
.getByText("Write in Simplified Chinese. Do not use em dashes."),
|
||||
).toBeVisible();
|
||||
await page.screenshot({
|
||||
path: testInfo.outputPath("metadata-instructions-tucked-saved.png"),
|
||||
fullPage: true,
|
||||
});
|
||||
|
||||
// Verify compact layout keeps the tucked row and bottom sheet clean.
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await expect(page.getByTestId("metadata-generation-instructions-row")).toBeVisible();
|
||||
await page.screenshot({
|
||||
path: testInfo.outputPath("metadata-instructions-compact-row.png"),
|
||||
fullPage: true,
|
||||
});
|
||||
await page.getByTestId("metadata-generation-instructions-row").click();
|
||||
await expect(page.getByTestId("metadata-generation-instructions-input")).toHaveValue(
|
||||
"Write in Simplified Chinese. Do not use em dashes.",
|
||||
);
|
||||
await page.screenshot({
|
||||
path: testInfo.outputPath("metadata-instructions-compact-sheet.png"),
|
||||
fullPage: true,
|
||||
});
|
||||
|
||||
await page.getByTestId("metadata-generation-instructions-input").fill("");
|
||||
await expect(page.getByTestId("metadata-generation-instructions-save")).toBeEnabled();
|
||||
await page.getByTestId("metadata-generation-instructions-save").click();
|
||||
|
||||
await expect(page.getByTestId("metadata-generation-instructions-sheet")).toHaveCount(0);
|
||||
await expect
|
||||
.poll(async () => (await client.getDaemonConfig()).config.metadataGeneration)
|
||||
.toEqual({
|
||||
providers: [{ provider: "mock", model: "ten-second-stream" }],
|
||||
});
|
||||
} finally {
|
||||
try {
|
||||
await client.patchDaemonConfig({
|
||||
metadataGeneration: {
|
||||
providers: previousConfig.config.metadataGeneration.providers,
|
||||
instructions: previousConfig.config.metadataGeneration.instructions ?? "",
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
await client.close().catch(() => undefined);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
openStartingRefPicker,
|
||||
selectBranchInPicker,
|
||||
selectWorkspaceIsolation,
|
||||
watchBrowserBranchSuggestions,
|
||||
} from "../support/helpers/new-workspace";
|
||||
import { seedWorkspace, type SeededWorkspace } from "../support/helpers/seed-client";
|
||||
import { getServerId } from "../support/helpers/server-id";
|
||||
@@ -16,6 +17,21 @@ const LONG_HOST_NAME =
|
||||
"development-macbook-pro.local-connected-through-a-very-long-private-hostname";
|
||||
const LONG_BRANCH_NAME =
|
||||
"feat/app/add-amoled-theme-with-a-very-long-pull-request-and-branch-description";
|
||||
const MANY_BRANCHES = Array.from(
|
||||
{ length: 12 },
|
||||
(_, index) => `feat/branch-${String(index + 1).padStart(2, "0")}`,
|
||||
);
|
||||
|
||||
interface PopoverFrameSample {
|
||||
t: number;
|
||||
opacity: number;
|
||||
top: number;
|
||||
left: number;
|
||||
width: number;
|
||||
height: number;
|
||||
rowCount: number;
|
||||
mainTop: number | null;
|
||||
}
|
||||
|
||||
function measureControlRightEdges(controls: HTMLElement[]) {
|
||||
const measurements: Array<{ label: string | null; right: number }> = [];
|
||||
@@ -26,13 +42,69 @@ function measureControlRightEdges(controls: HTMLElement[]) {
|
||||
return measurements;
|
||||
}
|
||||
|
||||
async function startPopoverFrameSampler(page: import("@playwright/test").Page): Promise<void> {
|
||||
await page.evaluate(() => {
|
||||
const win = window as unknown as {
|
||||
__popoverFrames?: PopoverFrameSample[];
|
||||
__popoverSamplerStop?: () => void;
|
||||
};
|
||||
const samples: PopoverFrameSample[] = [];
|
||||
const start = performance.now();
|
||||
let stopped = false;
|
||||
let rafId = 0;
|
||||
const tick = () => {
|
||||
if (stopped) return;
|
||||
const el = document.querySelector<HTMLElement>('[data-testid="combobox-desktop-container"]');
|
||||
if (el) {
|
||||
const style = getComputedStyle(el);
|
||||
const opacity = Number.parseFloat(style.opacity || "1");
|
||||
const rect = el.getBoundingClientRect();
|
||||
const rows = el.querySelectorAll("[data-combobox-option-index]");
|
||||
const mainEl = el.querySelector<HTMLElement>(
|
||||
'[data-testid="new-workspace-ref-picker-branch-main"]',
|
||||
);
|
||||
samples.push({
|
||||
t: Math.round(performance.now() - start),
|
||||
opacity,
|
||||
top: Math.round(rect.top),
|
||||
left: Math.round(rect.left),
|
||||
width: Math.round(rect.width),
|
||||
height: Math.round(rect.height),
|
||||
rowCount: rows.length,
|
||||
mainTop: mainEl ? Math.round(mainEl.getBoundingClientRect().top) : null,
|
||||
});
|
||||
}
|
||||
rafId = requestAnimationFrame(tick);
|
||||
};
|
||||
rafId = requestAnimationFrame(tick);
|
||||
win.__popoverFrames = samples;
|
||||
win.__popoverSamplerStop = () => {
|
||||
stopped = true;
|
||||
cancelAnimationFrame(rafId);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
async function stopPopoverFrameSampler(
|
||||
page: import("@playwright/test").Page,
|
||||
): Promise<PopoverFrameSample[]> {
|
||||
return page.evaluate(() => {
|
||||
const win = window as unknown as {
|
||||
__popoverFrames?: PopoverFrameSample[];
|
||||
__popoverSamplerStop?: () => void;
|
||||
};
|
||||
win.__popoverSamplerStop?.();
|
||||
return win.__popoverFrames ?? [];
|
||||
});
|
||||
}
|
||||
|
||||
test.describe("New workspace metadata row layout", () => {
|
||||
let workspace: SeededWorkspace;
|
||||
|
||||
test.beforeEach(async () => {
|
||||
workspace = await seedWorkspace({
|
||||
repoPrefix: "new-workspace-layout-",
|
||||
repo: { branches: [LONG_BRANCH_NAME] },
|
||||
repo: { branches: [LONG_BRANCH_NAME, ...MANY_BRANCHES] },
|
||||
});
|
||||
});
|
||||
|
||||
@@ -84,4 +156,110 @@ test.describe("New workspace metadata row layout", () => {
|
||||
).toBeLessThanOrEqual(composerRightRail + 1);
|
||||
}
|
||||
});
|
||||
|
||||
test("starting ref popover holds height and row positions on a cold first open", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 1280, height: 900 });
|
||||
const branchWatch = await watchBrowserBranchSuggestions(page, { hold: true });
|
||||
|
||||
await gotoAppShell(page);
|
||||
await waitForSidebarHydration(page);
|
||||
await openNewWorkspaceComposer(page, {
|
||||
projectKey: workspace.projectKey,
|
||||
projectDisplayName: workspace.projectDisplayName,
|
||||
});
|
||||
await selectWorkspaceIsolation(page, "worktree");
|
||||
|
||||
await startPopoverFrameSampler(page);
|
||||
await openStartingRefPicker(page);
|
||||
|
||||
const popover = page.getByTestId("combobox-desktop-container");
|
||||
await expect(popover).toBeVisible({ timeout: 10_000 });
|
||||
await branchWatch.waitForResponse();
|
||||
|
||||
// Give the loading state several frames to paint before releasing the branch list.
|
||||
await page.waitForTimeout(120);
|
||||
const loadingBox = await popover.boundingBox();
|
||||
expect(loadingBox).not.toBeNull();
|
||||
|
||||
branchWatch.release();
|
||||
await expect(page.getByTestId("new-workspace-ref-picker-branch-feat/branch-12")).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
await page.waitForTimeout(80);
|
||||
const settledBox = await popover.boundingBox();
|
||||
expect(settledBox).not.toBeNull();
|
||||
|
||||
const samples = await stopPopoverFrameSampler(page);
|
||||
const visibleSamples = samples.filter((s) => s.opacity > 0.9);
|
||||
expect(visibleSamples.length).toBeGreaterThan(0);
|
||||
|
||||
const heights = visibleSamples.map((s) => s.height);
|
||||
const tops = visibleSamples.map((s) => s.top);
|
||||
const mainTops = visibleSamples
|
||||
.map((s) => s.mainTop)
|
||||
.filter((value): value is number => value !== null);
|
||||
|
||||
expect(
|
||||
Math.max(...heights) - Math.min(...heights),
|
||||
`popover height shifted across visible frames: ${JSON.stringify(visibleSamples)}`,
|
||||
).toBeLessThanOrEqual(1);
|
||||
expect(
|
||||
Math.max(...tops) - Math.min(...tops),
|
||||
`popover top shifted across visible frames: ${JSON.stringify(visibleSamples)}`,
|
||||
).toBeLessThanOrEqual(1);
|
||||
expect(
|
||||
mainTops.length > 0 ? Math.max(...mainTops) - Math.min(...mainTops) : 0,
|
||||
`main row jumped vertically across visible frames: ${JSON.stringify(visibleSamples)}`,
|
||||
).toBeLessThanOrEqual(1);
|
||||
|
||||
// Switching to Pull requests keeps the same frame height.
|
||||
await page.getByTestId("new-workspace-ref-picker-tab-pull-requests").click();
|
||||
await page.waitForTimeout(80);
|
||||
const prBox = await popover.boundingBox();
|
||||
expect(prBox).not.toBeNull();
|
||||
expect(Math.abs(prBox!.height - settledBox!.height)).toBeLessThanOrEqual(1);
|
||||
});
|
||||
|
||||
test("starting ref popover prefetches branches before the first click and clamps to short viewports", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 1280, height: 900 });
|
||||
const branchWatch = await watchBrowserBranchSuggestions(page, { hold: false });
|
||||
|
||||
await gotoAppShell(page);
|
||||
await waitForSidebarHydration(page);
|
||||
await openNewWorkspaceComposer(page, {
|
||||
projectKey: workspace.projectKey,
|
||||
projectDisplayName: workspace.projectDisplayName,
|
||||
});
|
||||
await selectWorkspaceIsolation(page, "worktree");
|
||||
|
||||
// Branches must prefetch before the user ever clicks the trigger.
|
||||
await branchWatch.waitForResponse();
|
||||
await page.waitForTimeout(100);
|
||||
|
||||
await startPopoverFrameSampler(page);
|
||||
await openStartingRefPicker(page);
|
||||
await expect(page.getByTestId("new-workspace-ref-picker-branch-feat/branch-12")).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
await page.waitForTimeout(80);
|
||||
const samples = await stopPopoverFrameSampler(page);
|
||||
const firstVisible = samples.find((s) => s.opacity > 0.9);
|
||||
expect(firstVisible).toBeDefined();
|
||||
expect(firstVisible!.rowCount).toBeGreaterThan(5);
|
||||
|
||||
// Close and verify short viewport clamping keeps the popover inside the window.
|
||||
await page.keyboard.press("Escape");
|
||||
await page.setViewportSize({ width: 1280, height: 500 });
|
||||
await openStartingRefPicker(page);
|
||||
const popover = page.getByTestId("combobox-desktop-container");
|
||||
await expect(popover).toBeVisible({ timeout: 10_000 });
|
||||
await page.waitForTimeout(100);
|
||||
const shortBox = await popover.boundingBox();
|
||||
expect(shortBox).not.toBeNull();
|
||||
expect(shortBox!.y + shortBox!.height).toBeLessThanOrEqual(500);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -739,6 +739,70 @@ export async function delayBrowserWorkspaceCreatedResponse(
|
||||
};
|
||||
}
|
||||
|
||||
export interface BranchSuggestionsControl {
|
||||
release(): void;
|
||||
waitForRequest(): Promise<void>;
|
||||
waitForResponse(): Promise<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intercepts `branch_suggestions_request` / `branch_suggestions_response` frames over the daemon
|
||||
* WebSocket. Pass `hold: true` to keep responses queued until `release()` is called, or `hold: false`
|
||||
* to observe prefetched responses without delaying them.
|
||||
*/
|
||||
export async function watchBrowserBranchSuggestions(
|
||||
page: Page,
|
||||
options: { hold: boolean },
|
||||
): Promise<BranchSuggestionsControl> {
|
||||
const frames = await loadSessionMessageReaders();
|
||||
const daemonPortPattern = daemonWsRoutePattern();
|
||||
const delayedForwards: Array<() => void> = [];
|
||||
let releaseRequested = !options.hold;
|
||||
let resolveRequest: (() => void) | null = null;
|
||||
let resolveResponse: (() => void) | null = null;
|
||||
const requestSeen = new Promise<void>((resolve) => {
|
||||
resolveRequest = resolve;
|
||||
});
|
||||
const responseSeen = new Promise<void>((resolve) => {
|
||||
resolveResponse = resolve;
|
||||
});
|
||||
|
||||
await page.routeWebSocket(daemonPortPattern, (ws) => {
|
||||
const server = ws.connectToServer();
|
||||
|
||||
ws.onMessage((message) => {
|
||||
const sessionMessage = frames.client(message);
|
||||
if (sessionMessage?.type === "branch_suggestions_request") {
|
||||
resolveRequest?.();
|
||||
}
|
||||
server.send(message);
|
||||
});
|
||||
|
||||
server.onMessage((message) => {
|
||||
const sessionMessage = frames.server(message);
|
||||
if (sessionMessage?.type === "branch_suggestions_response") {
|
||||
resolveResponse?.();
|
||||
if (!releaseRequested) {
|
||||
delayedForwards.push(() => ws.send(message));
|
||||
return;
|
||||
}
|
||||
}
|
||||
ws.send(message);
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
release() {
|
||||
releaseRequested = true;
|
||||
for (const forward of delayedForwards.splice(0)) {
|
||||
forward();
|
||||
}
|
||||
},
|
||||
waitForRequest: () => requestSeen,
|
||||
waitForResponse: () => responseSeen,
|
||||
};
|
||||
}
|
||||
|
||||
type WorkspaceEntry = Awaited<
|
||||
ReturnType<NewWorkspaceDaemonClient["fetchWorkspaces"]>
|
||||
>["entries"][number];
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
require "fileutils"
|
||||
require "tmpdir"
|
||||
require_relative "ios_review"
|
||||
|
||||
default_platform(:ios)
|
||||
|
||||
@@ -42,8 +43,20 @@ def stage_google_play_screenshots
|
||||
root
|
||||
end
|
||||
|
||||
def connect_ios_review_client
|
||||
client = IosReview::SpaceshipClient.new
|
||||
client.authenticate!(
|
||||
key_id: ENV.fetch("ASC_KEY_ID"),
|
||||
issuer_id: ENV.fetch("ASC_ISSUER_ID"),
|
||||
key_filepath: ENV.fetch("ASC_KEY_P8"),
|
||||
)
|
||||
app = client.find_app(APP_IDENTIFIER)
|
||||
UI.user_error!("Could not find app #{APP_IDENTIFIER} on App Store Connect") if app.nil?
|
||||
[client, app]
|
||||
end
|
||||
|
||||
platform :ios do
|
||||
desc "Submit the latest TestFlight build to App Store Review"
|
||||
desc "Submit the latest TestFlight build to App Store Review (non-destructive by default)"
|
||||
lane :submit_review do
|
||||
api_key = app_store_connect_api_key(
|
||||
key_id: ENV.fetch("ASC_KEY_ID"),
|
||||
@@ -51,89 +64,60 @@ platform :ios do
|
||||
key_filepath: ENV.fetch("ASC_KEY_P8"),
|
||||
)
|
||||
|
||||
require "spaceship"
|
||||
Spaceship::ConnectAPI.token = Spaceship::ConnectAPI::Token.create(
|
||||
key_id: ENV.fetch("ASC_KEY_ID"),
|
||||
issuer_id: ENV.fetch("ASC_ISSUER_ID"),
|
||||
filepath: ENV.fetch("ASC_KEY_P8"),
|
||||
client, app = connect_ios_review_client
|
||||
|
||||
IosReview.submit_review(
|
||||
client: client,
|
||||
app: app,
|
||||
ui: UI,
|
||||
target_version: ENV["APP_VERSION"],
|
||||
target_build: ENV["APP_BUILD_VERSION"],
|
||||
replace_in_review: IosReview.parse_bool(ENV["REPLACE_IN_REVIEW"]),
|
||||
deliver_runner: lambda do |app_version:, build_number:, reject_if_possible:|
|
||||
deliver(
|
||||
api_key: api_key,
|
||||
app_identifier: APP_IDENTIFIER,
|
||||
app_version: app_version,
|
||||
build_number: build_number.to_s,
|
||||
submit_for_review: true,
|
||||
automatic_release: true,
|
||||
reject_if_possible: reject_if_possible,
|
||||
release_notes: {
|
||||
"en-US" => "Bug fixes and improvements.",
|
||||
},
|
||||
force: true,
|
||||
skip_binary_upload: true,
|
||||
screenshots_path: stage_app_store_screenshots,
|
||||
overwrite_screenshots: true,
|
||||
precheck_include_in_app_purchases: false,
|
||||
submission_information: {
|
||||
add_id_info_uses_idfa: false,
|
||||
export_compliance_uses_encryption: false,
|
||||
},
|
||||
)
|
||||
end,
|
||||
)
|
||||
app = Spaceship::ConnectAPI::App.find(APP_IDENTIFIER)
|
||||
UI.user_error!("Could not find app #{APP_IDENTIFIER} on App Store Connect") if app.nil?
|
||||
end
|
||||
|
||||
# The release workflow forwards the marketing version and CFBundleVersion of
|
||||
# the binary it just built. Use them to identify the exact build, since
|
||||
# CFBundleVersion is not unique across marketing versions in this project
|
||||
# (the production profile resets it per app_version). The resubmit workflow
|
||||
# leaves these unset and falls back to "most recently uploaded iOS build".
|
||||
target_version = ENV["APP_VERSION"].to_s.strip
|
||||
target_build = ENV["APP_BUILD_VERSION"].to_s.strip
|
||||
target_version = nil if target_version.empty?
|
||||
target_build = nil if target_build.empty?
|
||||
|
||||
if target_version
|
||||
UI.message("Targeting App Store version #{target_version}#{target_build ? " build #{target_build}" : ""} from workflow input")
|
||||
else
|
||||
UI.message("No APP_VERSION provided; selecting the most recently uploaded iOS build")
|
||||
end
|
||||
|
||||
valid_build = nil
|
||||
deadline = Time.now + (30 * 60)
|
||||
loop do
|
||||
builds = Spaceship::ConnectAPI::Build.all(
|
||||
app_id: app.id,
|
||||
sort: "-uploadedDate",
|
||||
limit: 100,
|
||||
).select { |b| b.pre_release_version&.platform == "IOS" }
|
||||
builds = builds.select { |b| b.pre_release_version&.version == target_version } if target_version
|
||||
builds = builds.select { |b| b.version == target_build } if target_build
|
||||
|
||||
build = builds.first
|
||||
if build.nil?
|
||||
UI.user_error!("Timed out waiting for build to appear on App Store Connect.") if Time.now > deadline
|
||||
UI.message("No matching iOS build visible on App Store Connect yet; waiting...")
|
||||
sleep(30)
|
||||
next
|
||||
end
|
||||
|
||||
state = build.processing_state
|
||||
UI.message("Build #{build.pre_release_version.version} (#{build.version}) processing state: #{state || 'unknown'}")
|
||||
if state == "VALID"
|
||||
valid_build = build
|
||||
break
|
||||
end
|
||||
if state == "INVALID" || state == "FAILED"
|
||||
UI.user_error!("Build #{build.version} failed App Store processing (state: #{state}).")
|
||||
end
|
||||
if Time.now > deadline
|
||||
UI.user_error!("Timed out waiting for build #{build.version} to finish processing on App Store Connect.")
|
||||
end
|
||||
sleep(30)
|
||||
end
|
||||
|
||||
app_version = valid_build.pre_release_version.version
|
||||
build_number = valid_build.version
|
||||
UI.message("Submitting build #{build_number} as App Store version #{app_version} for review")
|
||||
|
||||
deliver(
|
||||
api_key: api_key,
|
||||
desc "Print live App Store version, active/pending versions, review submissions, and recent TestFlight builds"
|
||||
lane :review_status do
|
||||
client, app = connect_ios_review_client
|
||||
IosReview.review_status(
|
||||
client: client,
|
||||
app: app,
|
||||
ui: UI,
|
||||
app_identifier: APP_IDENTIFIER,
|
||||
app_version: app_version,
|
||||
build_number: build_number.to_s,
|
||||
submit_for_review: true,
|
||||
automatic_release: true,
|
||||
reject_if_possible: true,
|
||||
release_notes: {
|
||||
"en-US" => "Bug fixes and improvements.",
|
||||
},
|
||||
force: true,
|
||||
skip_binary_upload: true,
|
||||
screenshots_path: stage_app_store_screenshots,
|
||||
overwrite_screenshots: true,
|
||||
precheck_include_in_app_purchases: false,
|
||||
submission_information: {
|
||||
add_id_info_uses_idfa: false,
|
||||
export_compliance_uses_encryption: false,
|
||||
},
|
||||
)
|
||||
end
|
||||
|
||||
desc "Cancel the active in-flight iOS App Store review submission"
|
||||
lane :cancel_review do
|
||||
client, app = connect_ios_review_client
|
||||
IosReview.cancel_review(
|
||||
client: client,
|
||||
app: app,
|
||||
ui: UI,
|
||||
expected_version: ENV["EXPECTED_VERSION"],
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,635 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module IosReview
|
||||
PLATFORM_IOS = "IOS"
|
||||
|
||||
# Valid App Store Connect API v1 filter[appVersionState] values (fastlane 2.241.1
|
||||
# Spaceship::ConnectAPI::AppStoreVersion::AppVersionState) that block a new
|
||||
# App Store review submission.
|
||||
BLOCKING_API_VERSION_STATES = %w[
|
||||
WAITING_FOR_REVIEW
|
||||
IN_REVIEW
|
||||
PENDING_DEVELOPER_RELEASE
|
||||
PENDING_APPLE_RELEASE
|
||||
PROCESSING_FOR_DISTRIBUTION
|
||||
WAITING_FOR_EXPORT_COMPLIANCE
|
||||
ACCEPTED
|
||||
].freeze
|
||||
|
||||
# In-memory check also recognizes the deprecated AppStoreState alias
|
||||
# PROCESSING_FOR_APP_STORE (never sent in filter[appVersionState]).
|
||||
BLOCKING_VERSION_STATES = (BLOCKING_API_VERSION_STATES + %w[
|
||||
PROCESSING_FOR_APP_STORE
|
||||
]).freeze
|
||||
|
||||
# Valid filter[appVersionState] values shown in review_status under active/pending versions.
|
||||
ACTIVE_API_VERSION_STATES = (BLOCKING_API_VERSION_STATES + %w[
|
||||
PREPARE_FOR_SUBMISSION
|
||||
READY_FOR_REVIEW
|
||||
DEVELOPER_REJECTED
|
||||
REJECTED
|
||||
METADATA_REJECTED
|
||||
INVALID_BINARY
|
||||
]).freeze
|
||||
|
||||
# ReviewSubmission states representing an active submission already in Apple's queue
|
||||
# (or mid-cancellation). UNRESOLVED_ISSUES is intentionally excluded here so a
|
||||
# rejected version's free slot is not treated as an in-flight review; stale
|
||||
# UNRESOLVED_ISSUES submissions are cleared separately right before deliver runs.
|
||||
IN_FLIGHT_SUBMISSION_STATES = %w[
|
||||
WAITING_FOR_REVIEW
|
||||
IN_REVIEW
|
||||
CANCELING
|
||||
].freeze
|
||||
|
||||
UNRESOLVED_SUBMISSION_STATES = %w[
|
||||
UNRESOLVED_ISSUES
|
||||
].freeze
|
||||
|
||||
# ReviewSubmission states that can be cancelled via ReviewSubmission#cancel_submission
|
||||
# (or waited on if already CANCELING).
|
||||
CANCELLABLE_SUBMISSION_STATES = %w[
|
||||
WAITING_FOR_REVIEW
|
||||
IN_REVIEW
|
||||
UNRESOLVED_ISSUES
|
||||
CANCELING
|
||||
].freeze
|
||||
|
||||
STATUS_SUBMISSION_STATES = %w[
|
||||
WAITING_FOR_REVIEW
|
||||
IN_REVIEW
|
||||
UNRESOLVED_ISSUES
|
||||
CANCELING
|
||||
READY_FOR_REVIEW
|
||||
].freeze
|
||||
|
||||
DEFAULT_BUILD_TIMEOUT_SECONDS = 30 * 60
|
||||
DEFAULT_BUILD_POLL_INTERVAL = 30
|
||||
DEFAULT_CANCEL_TIMEOUT_SECONDS = 5 * 60
|
||||
DEFAULT_CANCEL_POLL_INTERVAL = 15
|
||||
|
||||
# Thin adapter around Spaceship::ConnectAPI (fastlane 2.241.1).
|
||||
# Injected into IosReview operations so all workflow logic is unit-testable
|
||||
# against in-memory fakes without requiring live ASC credentials.
|
||||
class SpaceshipClient
|
||||
def authenticate!(key_id:, issuer_id:, key_filepath:)
|
||||
require "spaceship"
|
||||
Spaceship::ConnectAPI.token = Spaceship::ConnectAPI::Token.create(
|
||||
key_id: key_id,
|
||||
issuer_id: issuer_id,
|
||||
filepath: key_filepath,
|
||||
)
|
||||
end
|
||||
|
||||
def find_app(bundle_id)
|
||||
Spaceship::ConnectAPI::App.find(bundle_id)
|
||||
end
|
||||
|
||||
def live_version(app)
|
||||
app.get_live_app_store_version(platform: PLATFORM_IOS, includes: "build")
|
||||
end
|
||||
|
||||
def ios_versions(app, states:)
|
||||
app.get_app_store_versions(
|
||||
filter: {
|
||||
platform: PLATFORM_IOS,
|
||||
appVersionState: states.join(","),
|
||||
},
|
||||
includes: "build",
|
||||
)
|
||||
end
|
||||
|
||||
def get_app_store_version(app_store_version_id)
|
||||
Spaceship::ConnectAPI::AppStoreVersion.get(
|
||||
app_store_version_id: app_store_version_id,
|
||||
includes: "build",
|
||||
)
|
||||
end
|
||||
|
||||
def review_submissions(app, states:)
|
||||
app.get_review_submissions(
|
||||
filter: {
|
||||
platform: PLATFORM_IOS,
|
||||
state: states.join(","),
|
||||
},
|
||||
includes: "appStoreVersionForReview",
|
||||
)
|
||||
end
|
||||
|
||||
def get_review_submission(review_submission_id)
|
||||
Spaceship::ConnectAPI::ReviewSubmission.get(
|
||||
review_submission_id: review_submission_id,
|
||||
includes: "appStoreVersionForReview",
|
||||
)
|
||||
end
|
||||
|
||||
def cancel_review_submission(submission)
|
||||
submission.cancel_submission
|
||||
end
|
||||
|
||||
def find_ios_builds(app, version: nil, build_number: nil)
|
||||
if version.nil? && build_number.nil?
|
||||
return recent_ios_builds(app, limit: 25)
|
||||
end
|
||||
|
||||
Spaceship::ConnectAPI::Build.all(
|
||||
app_id: app.id,
|
||||
version: version,
|
||||
build_number: build_number,
|
||||
platform: PLATFORM_IOS,
|
||||
sort: "-uploadedDate",
|
||||
limit: 100,
|
||||
)
|
||||
end
|
||||
|
||||
def recent_ios_builds(app, limit: 5)
|
||||
fetch_limit = [limit * 4, 25].max
|
||||
builds = Spaceship::ConnectAPI.get_builds(
|
||||
filter: { app: app.id },
|
||||
includes: "preReleaseVersion",
|
||||
sort: "-uploadedDate",
|
||||
limit: fetch_limit,
|
||||
).to_models
|
||||
builds.select { |b| b.pre_release_version&.platform == PLATFORM_IOS }.first(limit)
|
||||
end
|
||||
end
|
||||
|
||||
module_function
|
||||
|
||||
def parse_bool(value)
|
||||
value.to_s.strip.casecmp("true").zero?
|
||||
end
|
||||
|
||||
def normalize_optional_string(value)
|
||||
str = value.to_s.strip
|
||||
str.empty? ? nil : str
|
||||
end
|
||||
|
||||
def version_state(version)
|
||||
return nil if version.nil?
|
||||
|
||||
state = version.respond_to?(:app_version_state) ? version.app_version_state : nil
|
||||
state = nil if state.to_s.strip.empty?
|
||||
return state unless state.nil?
|
||||
|
||||
fallback = version.respond_to?(:app_store_state) ? version.app_store_state : nil
|
||||
fallback.to_s.strip.empty? ? nil : fallback
|
||||
end
|
||||
|
||||
def blocking_version_state?(state)
|
||||
BLOCKING_VERSION_STATES.include?(state.to_s)
|
||||
end
|
||||
|
||||
def sort_versions_descending(versions)
|
||||
versions.sort_by do |version|
|
||||
begin
|
||||
Gem::Version.new(version.version_string.to_s)
|
||||
rescue ArgumentError
|
||||
Gem::Version.new("0")
|
||||
end
|
||||
end.reverse
|
||||
end
|
||||
|
||||
def find_blocking_review(client:, app:)
|
||||
versions = client.ios_versions(app, states: BLOCKING_API_VERSION_STATES)
|
||||
.select { |v| blocking_version_state?(version_state(v)) }
|
||||
|
||||
if !versions.empty?
|
||||
version = sort_versions_descending(versions).first
|
||||
return {
|
||||
source: :app_store_version,
|
||||
version: version.version_string,
|
||||
state: version_state(version),
|
||||
build: version.respond_to?(:build) ? version.build&.version : nil,
|
||||
version_record: version,
|
||||
}
|
||||
end
|
||||
|
||||
submissions = client.review_submissions(app, states: IN_FLIGHT_SUBMISSION_STATES)
|
||||
.select { |s| IN_FLIGHT_SUBMISSION_STATES.include?(s.state.to_s) }
|
||||
|
||||
if !submissions.empty?
|
||||
submission = submissions.first
|
||||
assoc_version = submission.respond_to?(:app_store_version_for_review) ? submission.app_store_version_for_review : nil
|
||||
return {
|
||||
source: :review_submission,
|
||||
version: assoc_version&.version_string || "unknown",
|
||||
state: submission.state,
|
||||
build: assoc_version&.respond_to?(:build) ? assoc_version.build&.version : nil,
|
||||
submission: submission,
|
||||
version_record: assoc_version,
|
||||
}
|
||||
end
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
def wait_for_valid_build(
|
||||
client:,
|
||||
app:,
|
||||
target_version:,
|
||||
target_build:,
|
||||
ui:,
|
||||
timeout_seconds: DEFAULT_BUILD_TIMEOUT_SECONDS,
|
||||
poll_interval: DEFAULT_BUILD_POLL_INTERVAL,
|
||||
sleep_fn: Kernel.method(:sleep),
|
||||
clock: Time.method(:now)
|
||||
)
|
||||
if target_version
|
||||
ui.message("Targeting App Store version #{target_version}#{target_build ? " build #{target_build}" : ""} from workflow input")
|
||||
else
|
||||
ui.message("No APP_VERSION provided; selecting the most recently uploaded iOS build")
|
||||
end
|
||||
|
||||
deadline = clock.call + timeout_seconds
|
||||
loop do
|
||||
builds = client.find_ios_builds(app, version: target_version, build_number: target_build)
|
||||
.select { |b| b.pre_release_version&.platform == PLATFORM_IOS }
|
||||
builds = builds.select { |b| b.pre_release_version&.version == target_version } if target_version
|
||||
builds = builds.select { |b| b.version.to_s == target_build.to_s } if target_build
|
||||
|
||||
build = builds.first
|
||||
if build.nil?
|
||||
if clock.call >= deadline
|
||||
ui.user_error!("Timed out waiting for build to appear on App Store Connect.")
|
||||
end
|
||||
ui.message("No matching iOS build visible on App Store Connect yet; waiting...")
|
||||
sleep_fn.call(poll_interval)
|
||||
next
|
||||
end
|
||||
|
||||
state = build.processing_state
|
||||
ui.message("Build #{build.pre_release_version.version} (#{build.version}) processing state: #{state || 'unknown'}")
|
||||
return build if state == "VALID"
|
||||
|
||||
if state == "INVALID" || state == "FAILED"
|
||||
ui.user_error!("Build #{build.version} failed App Store processing (state: #{state}).")
|
||||
end
|
||||
|
||||
if clock.call >= deadline
|
||||
ui.user_error!("Timed out waiting for build #{build.version} to finish processing on App Store Connect.")
|
||||
end
|
||||
sleep_fn.call(poll_interval)
|
||||
end
|
||||
end
|
||||
|
||||
def resolve_waiting_build_summary(client:, app:, target_version:, target_build:)
|
||||
return [target_version, target_build] if target_version && target_build
|
||||
|
||||
builds = client.find_ios_builds(app, version: target_version, build_number: target_build)
|
||||
.select { |b| b.pre_release_version&.platform == PLATFORM_IOS }
|
||||
builds = builds.select { |b| b.pre_release_version&.version == target_version } if target_version
|
||||
builds = builds.select { |b| b.version.to_s == target_build.to_s } if target_build
|
||||
latest = builds.first
|
||||
|
||||
[
|
||||
target_version || latest&.pre_release_version&.version || "unknown",
|
||||
target_build || latest&.version&.to_s || "unknown",
|
||||
]
|
||||
end
|
||||
|
||||
def submit_review(
|
||||
client:,
|
||||
app:,
|
||||
ui:,
|
||||
deliver_runner:,
|
||||
target_version: nil,
|
||||
target_build: nil,
|
||||
replace_in_review: false,
|
||||
build_timeout_seconds: DEFAULT_BUILD_TIMEOUT_SECONDS,
|
||||
build_poll_interval: DEFAULT_BUILD_POLL_INTERVAL,
|
||||
cancel_timeout_seconds: DEFAULT_CANCEL_TIMEOUT_SECONDS,
|
||||
cancel_poll_interval: DEFAULT_CANCEL_POLL_INTERVAL,
|
||||
sleep_fn: Kernel.method(:sleep),
|
||||
clock: Time.method(:now)
|
||||
)
|
||||
target_version = normalize_optional_string(target_version)
|
||||
target_build = normalize_optional_string(target_build)
|
||||
|
||||
blocking = find_blocking_review(client: client, app: app)
|
||||
|
||||
if blocking && !replace_in_review
|
||||
return emit_skipped_result(
|
||||
client: client,
|
||||
app: app,
|
||||
ui: ui,
|
||||
blocking: blocking,
|
||||
target_version: target_version,
|
||||
target_build: target_build,
|
||||
)
|
||||
end
|
||||
|
||||
valid_build = wait_for_valid_build(
|
||||
client: client,
|
||||
app: app,
|
||||
target_version: target_version,
|
||||
target_build: target_build,
|
||||
ui: ui,
|
||||
timeout_seconds: build_timeout_seconds,
|
||||
poll_interval: build_poll_interval,
|
||||
sleep_fn: sleep_fn,
|
||||
clock: clock,
|
||||
)
|
||||
|
||||
app_version = valid_build.pre_release_version.version
|
||||
build_number = valid_build.version.to_s
|
||||
|
||||
if replace_in_review
|
||||
cancel_result = cancel_review(
|
||||
client: client,
|
||||
app: app,
|
||||
ui: ui,
|
||||
expected_version: nil,
|
||||
timeout_seconds: cancel_timeout_seconds,
|
||||
poll_interval: cancel_poll_interval,
|
||||
sleep_fn: sleep_fn,
|
||||
clock: clock,
|
||||
)
|
||||
if cancel_result[:status] == :canceled
|
||||
ui.message("Proceeding to submit replacement build #{build_number} as App Store version #{app_version}")
|
||||
end
|
||||
else
|
||||
# Re-check after waiting for TestFlight processing so a review submitted
|
||||
# in the meantime is never disturbed.
|
||||
post_wait_blocking = find_blocking_review(client: client, app: app)
|
||||
if post_wait_blocking
|
||||
return emit_skipped_result(
|
||||
client: client,
|
||||
app: app,
|
||||
ui: ui,
|
||||
blocking: post_wait_blocking,
|
||||
target_version: app_version,
|
||||
target_build: build_number,
|
||||
)
|
||||
end
|
||||
|
||||
# Fastlane's Deliver::SubmitForReview#create_review_submission fails if a
|
||||
# prior rejected ReviewSubmission remains in UNRESOLVED_ISSUES. Clear only
|
||||
# UNRESOLVED_ISSUES submissions here while keeping reject_if_possible: false
|
||||
# so an in-flight WAITING_FOR_REVIEW or IN_REVIEW submission is never cancelled.
|
||||
clear_unresolved_issues_submissions(
|
||||
client: client,
|
||||
app: app,
|
||||
ui: ui,
|
||||
timeout_seconds: cancel_timeout_seconds,
|
||||
poll_interval: cancel_poll_interval,
|
||||
sleep_fn: sleep_fn,
|
||||
clock: clock,
|
||||
)
|
||||
end
|
||||
|
||||
ui.message("Submitting build #{build_number} as App Store version #{app_version} for review (reject_if_possible=#{replace_in_review})")
|
||||
deliver_runner.call(
|
||||
app_version: app_version,
|
||||
build_number: build_number,
|
||||
reject_if_possible: replace_in_review,
|
||||
)
|
||||
|
||||
{
|
||||
status: :submitted,
|
||||
app_version: app_version,
|
||||
build_number: build_number,
|
||||
reject_if_possible: replace_in_review,
|
||||
}
|
||||
end
|
||||
|
||||
def emit_skipped_result(client:, app:, ui:, blocking:, target_version:, target_build:)
|
||||
waiting_version, waiting_build = resolve_waiting_build_summary(
|
||||
client: client,
|
||||
app: app,
|
||||
target_version: target_version,
|
||||
target_build: target_build,
|
||||
)
|
||||
summary = "IOS_REVIEW_SKIPPED in_review_version=#{blocking[:version]} in_review_state=#{blocking[:state]} waiting_version=#{waiting_version} waiting_build=#{waiting_build}"
|
||||
ui.important(summary)
|
||||
ui.message(
|
||||
"Leaving iOS App Store version #{blocking[:version]} (#{blocking[:state]}) untouched. " \
|
||||
"TestFlight build #{waiting_version} (#{waiting_build}) is ready to submit later via " \
|
||||
"resubmit-ios-review.yml (or with replace_in_review=true to replace the in-flight review).",
|
||||
)
|
||||
{
|
||||
status: :skipped,
|
||||
summary: summary,
|
||||
in_review_version: blocking[:version],
|
||||
in_review_state: blocking[:state],
|
||||
waiting_version: waiting_version,
|
||||
waiting_build: waiting_build,
|
||||
}
|
||||
end
|
||||
|
||||
def clear_unresolved_issues_submissions(
|
||||
client:,
|
||||
app:,
|
||||
ui:,
|
||||
timeout_seconds: DEFAULT_CANCEL_TIMEOUT_SECONDS,
|
||||
poll_interval: DEFAULT_CANCEL_POLL_INTERVAL,
|
||||
sleep_fn: Kernel.method(:sleep),
|
||||
clock: Time.method(:now)
|
||||
)
|
||||
stale_submissions = client.review_submissions(app, states: UNRESOLVED_SUBMISSION_STATES)
|
||||
.select { |s| UNRESOLVED_SUBMISSION_STATES.include?(s.state.to_s) }
|
||||
|
||||
stale_submissions.each do |submission|
|
||||
assoc_version = submission.respond_to?(:app_store_version_for_review) ? submission.app_store_version_for_review : nil
|
||||
ui.message(
|
||||
"Clearing stale rejected review submission #{submission.id} " \
|
||||
"(version #{assoc_version&.version_string || 'unknown'}, state: #{submission.state}) before submitting...",
|
||||
)
|
||||
client.cancel_review_submission(submission)
|
||||
wait_for_submission_cancellation(
|
||||
client: client,
|
||||
submission: submission,
|
||||
assoc_version: assoc_version,
|
||||
ui: ui,
|
||||
timeout_seconds: timeout_seconds,
|
||||
poll_interval: poll_interval,
|
||||
sleep_fn: sleep_fn,
|
||||
clock: clock,
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def wait_for_submission_cancellation(
|
||||
client:,
|
||||
submission:,
|
||||
assoc_version:,
|
||||
ui:,
|
||||
timeout_seconds:,
|
||||
poll_interval:,
|
||||
sleep_fn:,
|
||||
clock:
|
||||
)
|
||||
deadline = clock.call + timeout_seconds
|
||||
final_submission_state = submission.state
|
||||
final_version_state = version_state(assoc_version)
|
||||
|
||||
loop do
|
||||
refreshed = client.get_review_submission(submission.id)
|
||||
final_submission_state = refreshed ? refreshed.state : "COMPLETE"
|
||||
submission_done = refreshed.nil? || !CANCELLABLE_SUBMISSION_STATES.include?(refreshed.state.to_s)
|
||||
|
||||
version_done = true
|
||||
if assoc_version&.id
|
||||
refreshed_version = client.get_app_store_version(assoc_version.id)
|
||||
final_version_state = version_state(refreshed_version) || final_version_state
|
||||
version_done = !%w[WAITING_FOR_REVIEW IN_REVIEW].include?(final_version_state.to_s)
|
||||
end
|
||||
|
||||
return [final_submission_state, final_version_state] if submission_done && version_done
|
||||
|
||||
if clock.call >= deadline
|
||||
ui.user_error!(
|
||||
"Timed out waiting for iOS review submission #{submission.id} cancellation to complete " \
|
||||
"(submission_state=#{final_submission_state}, version_state=#{final_version_state || 'unknown'}).",
|
||||
)
|
||||
end
|
||||
|
||||
ui.message("Waiting for cancellation to take effect (submission=#{final_submission_state}, version=#{final_version_state || 'unknown'})...")
|
||||
sleep_fn.call(poll_interval)
|
||||
end
|
||||
end
|
||||
|
||||
def cancel_review(
|
||||
client:,
|
||||
app:,
|
||||
ui:,
|
||||
expected_version: nil,
|
||||
timeout_seconds: DEFAULT_CANCEL_TIMEOUT_SECONDS,
|
||||
poll_interval: DEFAULT_CANCEL_POLL_INTERVAL,
|
||||
sleep_fn: Kernel.method(:sleep),
|
||||
clock: Time.method(:now)
|
||||
)
|
||||
expected_version = normalize_optional_string(expected_version)
|
||||
|
||||
submissions = client.review_submissions(app, states: CANCELLABLE_SUBMISSION_STATES)
|
||||
.select { |s| CANCELLABLE_SUBMISSION_STATES.include?(s.state.to_s) }
|
||||
blocking_versions = client.ios_versions(app, states: BLOCKING_API_VERSION_STATES)
|
||||
.select { |v| blocking_version_state?(version_state(v)) }
|
||||
|
||||
if submissions.empty?
|
||||
non_cancellable = sort_versions_descending(blocking_versions).first
|
||||
if non_cancellable
|
||||
state = version_state(non_cancellable)
|
||||
ui.user_error!(
|
||||
"Cannot cancel iOS App Store version #{non_cancellable.version_string} (state: #{state}): " \
|
||||
"no cancellable review submission is in progress on App Store Connect.",
|
||||
)
|
||||
end
|
||||
|
||||
suffix = expected_version ? " expected_version=#{expected_version}" : ""
|
||||
summary = "IOS_REVIEW_CANCEL_NOOP reason=no_active_review#{suffix}"
|
||||
ui.message(summary)
|
||||
ui.message("No iOS App Store review submission is currently in flight.")
|
||||
return { status: :noop, summary: summary }
|
||||
end
|
||||
|
||||
submission = submissions.first
|
||||
assoc_version = submission.respond_to?(:app_store_version_for_review) ? submission.app_store_version_for_review : nil
|
||||
if assoc_version.nil?
|
||||
assoc_version = sort_versions_descending(blocking_versions).find do |v|
|
||||
%w[WAITING_FOR_REVIEW IN_REVIEW].include?(version_state(v))
|
||||
end
|
||||
end
|
||||
|
||||
active_version = assoc_version&.version_string
|
||||
if expected_version && active_version != expected_version
|
||||
ui.user_error!(
|
||||
"Refusing to cancel iOS review: expected version #{expected_version}, " \
|
||||
"but active review submission #{submission.id} is for version #{active_version || 'unknown'} (state: #{submission.state}).",
|
||||
)
|
||||
end
|
||||
|
||||
if submission.state == "CANCELING"
|
||||
ui.message("Review submission #{submission.id} (version #{active_version || 'unknown'}) is already CANCELING; waiting for completion...")
|
||||
else
|
||||
ui.message("Cancelling iOS review submission #{submission.id} for version #{active_version || 'unknown'} (state: #{submission.state})...")
|
||||
client.cancel_review_submission(submission)
|
||||
end
|
||||
|
||||
final_submission_state, final_version_state = wait_for_submission_cancellation(
|
||||
client: client,
|
||||
submission: submission,
|
||||
assoc_version: assoc_version,
|
||||
ui: ui,
|
||||
timeout_seconds: timeout_seconds,
|
||||
poll_interval: poll_interval,
|
||||
sleep_fn: sleep_fn,
|
||||
clock: clock,
|
||||
)
|
||||
|
||||
summary = "IOS_REVIEW_CANCELED version=#{active_version || 'unknown'} submission_id=#{submission.id} submission_state=#{final_submission_state} version_state=#{final_version_state || 'unknown'}"
|
||||
ui.success(summary)
|
||||
|
||||
{
|
||||
status: :canceled,
|
||||
summary: summary,
|
||||
version: active_version,
|
||||
submission_id: submission.id,
|
||||
submission_state: final_submission_state,
|
||||
version_state: final_version_state,
|
||||
}
|
||||
end
|
||||
|
||||
def review_status(client:, app:, ui:, app_identifier: "sh.paseo", recent_build_limit: 5)
|
||||
live = client.live_version(app)
|
||||
active_versions = sort_versions_descending(
|
||||
client.ios_versions(app, states: ACTIVE_API_VERSION_STATES),
|
||||
)
|
||||
active_submissions = client.review_submissions(app, states: STATUS_SUBMISSION_STATES)
|
||||
recent_builds = client.recent_ios_builds(app, limit: recent_build_limit)
|
||||
|
||||
lines = ["=== iOS App Store Review Status (#{app_identifier}) ==="]
|
||||
|
||||
lines << "Live App Store version:"
|
||||
if live
|
||||
lines << format_version_line(live)
|
||||
else
|
||||
lines << " (none)"
|
||||
end
|
||||
|
||||
lines << "Active / pending App Store versions:"
|
||||
if active_versions.empty?
|
||||
lines << " (none)"
|
||||
else
|
||||
active_versions.each { |v| lines << format_version_line(v) }
|
||||
end
|
||||
|
||||
lines << "Active review submissions:"
|
||||
if active_submissions.empty?
|
||||
lines << " (none)"
|
||||
else
|
||||
active_submissions.each do |s|
|
||||
assoc = s.respond_to?(:app_store_version_for_review) ? s.app_store_version_for_review : nil
|
||||
submitted = s.respond_to?(:submitted_date) && s.submitted_date ? s.submitted_date : "none"
|
||||
lines << " id=#{s.id} | version=#{assoc&.version_string || 'unknown'} | state=#{s.state} | submitted_date=#{submitted}"
|
||||
end
|
||||
end
|
||||
|
||||
lines << "Recent iOS TestFlight builds (top #{recent_build_limit}):"
|
||||
if recent_builds.empty?
|
||||
lines << " (none)"
|
||||
else
|
||||
recent_builds.each_with_index do |b, idx|
|
||||
ver = b.pre_release_version&.version || "unknown"
|
||||
lines << " #{idx + 1}. version=#{ver} | build=#{b.version} | processing_state=#{b.processing_state || 'unknown'} | uploaded_date=#{b.uploaded_date || 'unknown'}"
|
||||
end
|
||||
end
|
||||
|
||||
report = lines.join("\n")
|
||||
ui.message(report)
|
||||
|
||||
{
|
||||
live_version: live,
|
||||
active_versions: active_versions,
|
||||
active_submissions: active_submissions,
|
||||
recent_builds: recent_builds,
|
||||
report: report,
|
||||
}
|
||||
end
|
||||
|
||||
def format_version_line(version)
|
||||
state = version_state(version) || "unknown"
|
||||
build_number = version.respond_to?(:build) ? version.build&.version : nil
|
||||
" version=#{version.version_string} | state=#{state} | build=#{build_number || 'none'}"
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,595 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "minitest/autorun"
|
||||
require_relative "ios_review"
|
||||
|
||||
class IosReviewTest < Minitest::Test
|
||||
FakeApp = Struct.new(:id, :bundle_id, keyword_init: true)
|
||||
FakePreReleaseVersion = Struct.new(:version, :platform, keyword_init: true)
|
||||
FakeBuild = Struct.new(:version, :processing_state, :uploaded_date, :pre_release_version, keyword_init: true)
|
||||
FakeAppStoreVersion = Struct.new(:id, :version_string, :app_version_state, :app_store_state, :build, keyword_init: true)
|
||||
FakeReviewSubmission = Struct.new(:id, :state, :submitted_date, :app_store_version_for_review, keyword_init: true)
|
||||
|
||||
class FakeUserError < StandardError; end
|
||||
|
||||
class FakeUI
|
||||
attr_reader :messages, :importants, :successes
|
||||
|
||||
def initialize
|
||||
@messages = []
|
||||
@importants = []
|
||||
@successes = []
|
||||
end
|
||||
|
||||
def message(text)
|
||||
@messages << text
|
||||
end
|
||||
|
||||
def important(text)
|
||||
@importants << text
|
||||
end
|
||||
|
||||
def success(text)
|
||||
@successes << text
|
||||
end
|
||||
|
||||
def user_error!(text)
|
||||
raise FakeUserError, text
|
||||
end
|
||||
end
|
||||
|
||||
class FakeClock
|
||||
attr_reader :now
|
||||
|
||||
def initialize(start = 1_000)
|
||||
@now = start
|
||||
end
|
||||
|
||||
def call
|
||||
@now
|
||||
end
|
||||
|
||||
def advance(seconds)
|
||||
@now += seconds
|
||||
end
|
||||
end
|
||||
|
||||
# In-memory fake matching the SpaceshipClient surface.
|
||||
class FakeClient
|
||||
attr_accessor :live_version_record, :versions, :submissions, :builds
|
||||
attr_reader :canceled_submission_ids, :queried_version_state_filters, :queried_submission_state_filters
|
||||
|
||||
def initialize(
|
||||
live_version_record: nil,
|
||||
versions: [],
|
||||
submissions: [],
|
||||
builds: [],
|
||||
submission_poll_states: nil,
|
||||
version_poll_states: nil
|
||||
)
|
||||
@live_version_record = live_version_record
|
||||
@versions = versions
|
||||
@submissions = submissions
|
||||
@builds = builds
|
||||
@submission_poll_states = submission_poll_states || {}
|
||||
@version_poll_states = version_poll_states || {}
|
||||
@canceled_submission_ids = []
|
||||
@queried_version_state_filters = []
|
||||
@queried_submission_state_filters = []
|
||||
end
|
||||
|
||||
def live_version(_app)
|
||||
@live_version_record
|
||||
end
|
||||
|
||||
def ios_versions(_app, states:)
|
||||
@queried_version_state_filters << states
|
||||
@versions.select do |v|
|
||||
state = IosReview.version_state(v)
|
||||
states.include?(state) || (state == "PROCESSING_FOR_APP_STORE" && states.include?("PROCESSING_FOR_DISTRIBUTION"))
|
||||
end
|
||||
end
|
||||
|
||||
def get_app_store_version(app_store_version_id)
|
||||
version = @versions.find { |v| v.id == app_store_version_id }
|
||||
return nil if version.nil?
|
||||
|
||||
queue = @version_poll_states[app_store_version_id]
|
||||
if queue && !queue.empty?
|
||||
next_state = queue.shift
|
||||
version.app_version_state = next_state
|
||||
end
|
||||
version
|
||||
end
|
||||
|
||||
def review_submissions(_app, states:)
|
||||
@queried_submission_state_filters << states
|
||||
@submissions.select { |s| states.include?(s.state) }
|
||||
end
|
||||
|
||||
def get_review_submission(review_submission_id)
|
||||
submission = @submissions.find { |s| s.id == review_submission_id }
|
||||
return nil if submission.nil?
|
||||
|
||||
queue = @submission_poll_states[review_submission_id]
|
||||
if queue && !queue.empty?
|
||||
submission.state = queue.shift
|
||||
end
|
||||
submission
|
||||
end
|
||||
|
||||
def cancel_review_submission(submission)
|
||||
@canceled_submission_ids << submission.id
|
||||
submission.state = "CANCELING"
|
||||
submission
|
||||
end
|
||||
|
||||
def find_ios_builds(_app, version: nil, build_number: nil)
|
||||
result = @builds.select { |b| b.pre_release_version&.platform == "IOS" }
|
||||
result = result.select { |b| b.pre_release_version&.version == version } if version
|
||||
result = result.select { |b| b.version.to_s == build_number.to_s } if build_number
|
||||
result
|
||||
end
|
||||
|
||||
def recent_ios_builds(_app, limit: 5)
|
||||
@builds.select { |b| b.pre_release_version&.platform == "IOS" }.first(limit)
|
||||
end
|
||||
end
|
||||
|
||||
def setup
|
||||
@app = FakeApp.new(id: "app-1", bundle_id: "sh.paseo")
|
||||
@ui = FakeUI.new
|
||||
@clock = FakeClock.new
|
||||
@sleep_fn = lambda { |seconds| @clock.advance(seconds) }
|
||||
end
|
||||
|
||||
def make_build(version, build_number, processing_state: "VALID", uploaded_date: "2026-11-27T10:00:00Z", platform: "IOS")
|
||||
FakeBuild.new(
|
||||
version: build_number,
|
||||
processing_state: processing_state,
|
||||
uploaded_date: uploaded_date,
|
||||
pre_release_version: FakePreReleaseVersion.new(version: version, platform: platform),
|
||||
)
|
||||
end
|
||||
|
||||
def test_submit_review_skips_when_blocking_version_is_in_flight_by_default
|
||||
blocking_states = %w[
|
||||
WAITING_FOR_REVIEW
|
||||
IN_REVIEW
|
||||
PENDING_DEVELOPER_RELEASE
|
||||
PENDING_APPLE_RELEASE
|
||||
PROCESSING_FOR_DISTRIBUTION
|
||||
PROCESSING_FOR_APP_STORE
|
||||
WAITING_FOR_EXPORT_COMPLIANCE
|
||||
ACCEPTED
|
||||
]
|
||||
|
||||
blocking_states.each do |state|
|
||||
ui = FakeUI.new
|
||||
in_flight = if state == "PROCESSING_FOR_APP_STORE"
|
||||
FakeAppStoreVersion.new(id: "v-1", version_string: "0.18.0", app_version_state: nil, app_store_state: state)
|
||||
else
|
||||
FakeAppStoreVersion.new(id: "v-1", version_string: "0.18.0", app_version_state: state)
|
||||
end
|
||||
|
||||
client = FakeClient.new(
|
||||
versions: [in_flight],
|
||||
builds: [make_build("0.18.1", "18001999")],
|
||||
)
|
||||
deliver_calls = []
|
||||
|
||||
result = IosReview.submit_review(
|
||||
client: client,
|
||||
app: @app,
|
||||
ui: ui,
|
||||
target_version: "0.18.1",
|
||||
target_build: "18001999",
|
||||
replace_in_review: false,
|
||||
deliver_runner: ->(args) { deliver_calls << args },
|
||||
sleep_fn: @sleep_fn,
|
||||
clock: @clock,
|
||||
)
|
||||
|
||||
assert_equal :skipped, result[:status], "Expected skip for blocking state #{state}"
|
||||
assert_equal "0.18.0", result[:in_review_version]
|
||||
assert_equal state, result[:in_review_state]
|
||||
assert_equal "0.18.1", result[:waiting_version]
|
||||
assert_equal "18001999", result[:waiting_build]
|
||||
assert_empty client.canceled_submission_ids, "Must never cancel when replace_in_review is false (#{state})"
|
||||
assert_empty deliver_calls, "Must not invoke deliver when skipping (#{state})"
|
||||
assert_includes ui.importants.first, "IOS_REVIEW_SKIPPED in_review_version=0.18.0 in_review_state=#{state} waiting_version=0.18.1 waiting_build=18001999"
|
||||
end
|
||||
end
|
||||
|
||||
def test_submit_review_never_sends_deprecated_app_store_state_in_api_filter
|
||||
client = FakeClient.new(
|
||||
versions: [FakeAppStoreVersion.new(id: "v-1", version_string: "0.18.0", app_version_state: "READY_FOR_DISTRIBUTION")],
|
||||
builds: [make_build("0.18.1", "18001999")],
|
||||
)
|
||||
|
||||
IosReview.submit_review(
|
||||
client: client,
|
||||
app: @app,
|
||||
ui: @ui,
|
||||
target_version: "0.18.1",
|
||||
target_build: "18001999",
|
||||
replace_in_review: false,
|
||||
deliver_runner: ->(_args) {},
|
||||
sleep_fn: @sleep_fn,
|
||||
clock: @clock,
|
||||
)
|
||||
|
||||
client.queried_version_state_filters.each do |states|
|
||||
refute_includes states, "PROCESSING_FOR_APP_STORE"
|
||||
refute_includes states, "READY_FOR_SALE"
|
||||
end
|
||||
end
|
||||
|
||||
def test_submit_review_skips_and_resolves_latest_testflight_build_when_inputs_unset
|
||||
in_flight = FakeAppStoreVersion.new(id: "v-1", version_string: "0.18.0", app_version_state: "IN_REVIEW")
|
||||
client = FakeClient.new(
|
||||
versions: [in_flight],
|
||||
builds: [make_build("0.18.2", "18002999")],
|
||||
)
|
||||
deliver_calls = []
|
||||
|
||||
result = IosReview.submit_review(
|
||||
client: client,
|
||||
app: @app,
|
||||
ui: @ui,
|
||||
target_version: "",
|
||||
target_build: "",
|
||||
replace_in_review: false,
|
||||
deliver_runner: ->(args) { deliver_calls << args },
|
||||
sleep_fn: @sleep_fn,
|
||||
clock: @clock,
|
||||
)
|
||||
|
||||
assert_equal :skipped, result[:status]
|
||||
assert_equal "0.18.2", result[:waiting_version]
|
||||
assert_equal "18002999", result[:waiting_build]
|
||||
assert_empty client.canceled_submission_ids
|
||||
assert_empty deliver_calls
|
||||
assert_includes @ui.importants.first, "IOS_REVIEW_SKIPPED in_review_version=0.18.0 in_review_state=IN_REVIEW waiting_version=0.18.2 waiting_build=18002999"
|
||||
end
|
||||
|
||||
def test_submit_review_auto_submits_when_slot_is_free
|
||||
free_states = %w[
|
||||
READY_FOR_DISTRIBUTION
|
||||
READY_FOR_SALE
|
||||
PREPARE_FOR_SUBMISSION
|
||||
DEVELOPER_REJECTED
|
||||
REJECTED
|
||||
METADATA_REJECTED
|
||||
]
|
||||
|
||||
free_states.each do |state|
|
||||
ui = FakeUI.new
|
||||
existing = FakeAppStoreVersion.new(
|
||||
id: "v-1",
|
||||
version_string: "0.18.0",
|
||||
app_version_state: state == "READY_FOR_SALE" ? nil : state,
|
||||
app_store_state: state == "READY_FOR_SALE" ? state : nil,
|
||||
)
|
||||
client = FakeClient.new(
|
||||
versions: [existing],
|
||||
builds: [make_build("0.18.1", "18001999")],
|
||||
)
|
||||
deliver_calls = []
|
||||
|
||||
result = IosReview.submit_review(
|
||||
client: client,
|
||||
app: @app,
|
||||
ui: ui,
|
||||
target_version: "0.18.1",
|
||||
target_build: "18001999",
|
||||
replace_in_review: false,
|
||||
deliver_runner: ->(args) { deliver_calls << args },
|
||||
sleep_fn: @sleep_fn,
|
||||
clock: @clock,
|
||||
)
|
||||
|
||||
assert_equal :submitted, result[:status], "Expected auto-submit when state is #{state}"
|
||||
assert_equal false, result[:reject_if_possible]
|
||||
assert_empty client.canceled_submission_ids
|
||||
assert_equal [{ app_version: "0.18.1", build_number: "18001999", reject_if_possible: false }], deliver_calls
|
||||
end
|
||||
end
|
||||
|
||||
def test_submit_review_clears_stale_unresolved_issues_submission_on_rejected_version_by_default
|
||||
rejected = FakeAppStoreVersion.new(id: "v-1", version_string: "0.18.0", app_version_state: "REJECTED")
|
||||
stale_submission = FakeReviewSubmission.new(
|
||||
id: "sub-rejected",
|
||||
state: "UNRESOLVED_ISSUES",
|
||||
app_store_version_for_review: rejected,
|
||||
)
|
||||
client = FakeClient.new(
|
||||
versions: [rejected],
|
||||
submissions: [stale_submission],
|
||||
builds: [make_build("0.18.1", "18001999")],
|
||||
submission_poll_states: { "sub-rejected" => %w[CANCELING COMPLETE] },
|
||||
version_poll_states: { "v-1" => %w[REJECTED DEVELOPER_REJECTED] },
|
||||
)
|
||||
deliver_calls = []
|
||||
|
||||
result = IosReview.submit_review(
|
||||
client: client,
|
||||
app: @app,
|
||||
ui: @ui,
|
||||
target_version: "0.18.1",
|
||||
target_build: "18001999",
|
||||
replace_in_review: false,
|
||||
deliver_runner: ->(args) { deliver_calls << args },
|
||||
sleep_fn: @sleep_fn,
|
||||
clock: @clock,
|
||||
)
|
||||
|
||||
assert_equal :submitted, result[:status]
|
||||
assert_equal false, result[:reject_if_possible]
|
||||
assert_equal ["sub-rejected"], client.canceled_submission_ids
|
||||
assert_equal "COMPLETE", stale_submission.state
|
||||
assert_equal [{ app_version: "0.18.1", build_number: "18001999", reject_if_possible: false }], deliver_calls
|
||||
end
|
||||
|
||||
def test_submit_review_skips_if_review_starts_while_waiting_for_build_processing
|
||||
processing_build = make_build("0.18.1", "18001999", processing_state: "PROCESSING")
|
||||
client = FakeClient.new(versions: [], submissions: [], builds: [processing_build])
|
||||
deliver_calls = []
|
||||
|
||||
sleep_and_start_review = lambda do |seconds|
|
||||
@clock.advance(seconds)
|
||||
processing_build.processing_state = "VALID"
|
||||
client.versions << FakeAppStoreVersion.new(id: "v-race", version_string: "0.18.0", app_version_state: "WAITING_FOR_REVIEW")
|
||||
end
|
||||
|
||||
result = IosReview.submit_review(
|
||||
client: client,
|
||||
app: @app,
|
||||
ui: @ui,
|
||||
target_version: "0.18.1",
|
||||
target_build: "18001999",
|
||||
replace_in_review: false,
|
||||
deliver_runner: ->(args) { deliver_calls << args },
|
||||
sleep_fn: sleep_and_start_review,
|
||||
clock: @clock,
|
||||
)
|
||||
|
||||
assert_equal :skipped, result[:status]
|
||||
assert_equal "0.18.0", result[:in_review_version]
|
||||
assert_equal "WAITING_FOR_REVIEW", result[:in_review_state]
|
||||
assert_empty client.canceled_submission_ids
|
||||
assert_empty deliver_calls
|
||||
assert_includes @ui.importants.first, "IOS_REVIEW_SKIPPED in_review_version=0.18.0 in_review_state=WAITING_FOR_REVIEW waiting_version=0.18.1 waiting_build=18001999"
|
||||
end
|
||||
|
||||
def test_submit_review_with_replace_in_review_cancels_after_validating_build_and_passes_reject_if_possible
|
||||
in_flight_version = FakeAppStoreVersion.new(id: "v-1", version_string: "0.18.0", app_version_state: "IN_REVIEW")
|
||||
submission = FakeReviewSubmission.new(id: "sub-1", state: "IN_REVIEW", app_store_version_for_review: in_flight_version)
|
||||
|
||||
client = FakeClient.new(
|
||||
versions: [in_flight_version],
|
||||
submissions: [submission],
|
||||
builds: [make_build("0.18.1", "18001999", processing_state: "VALID")],
|
||||
submission_poll_states: { "sub-1" => %w[CANCELING COMPLETE] },
|
||||
version_poll_states: { "v-1" => %w[IN_REVIEW DEVELOPER_REJECTED] },
|
||||
)
|
||||
deliver_calls = []
|
||||
|
||||
result = IosReview.submit_review(
|
||||
client: client,
|
||||
app: @app,
|
||||
ui: @ui,
|
||||
target_version: "0.18.1",
|
||||
target_build: "18001999",
|
||||
replace_in_review: true,
|
||||
deliver_runner: ->(args) { deliver_calls << args },
|
||||
sleep_fn: @sleep_fn,
|
||||
clock: @clock,
|
||||
)
|
||||
|
||||
assert_equal :submitted, result[:status]
|
||||
assert_equal true, result[:reject_if_possible]
|
||||
assert_equal ["sub-1"], client.canceled_submission_ids
|
||||
assert_equal "DEVELOPER_REJECTED", in_flight_version.app_version_state
|
||||
assert_equal [{ app_version: "0.18.1", build_number: "18001999", reject_if_possible: true }], deliver_calls
|
||||
end
|
||||
|
||||
def test_submit_review_with_replace_in_review_does_not_cancel_if_replacement_build_is_invalid
|
||||
in_flight_version = FakeAppStoreVersion.new(id: "v-1", version_string: "0.18.0", app_version_state: "WAITING_FOR_REVIEW")
|
||||
submission = FakeReviewSubmission.new(id: "sub-1", state: "WAITING_FOR_REVIEW", app_store_version_for_review: in_flight_version)
|
||||
|
||||
client = FakeClient.new(
|
||||
versions: [in_flight_version],
|
||||
submissions: [submission],
|
||||
builds: [make_build("0.18.1", "18001999", processing_state: "INVALID")],
|
||||
)
|
||||
deliver_calls = []
|
||||
|
||||
error = assert_raises(FakeUserError) do
|
||||
IosReview.submit_review(
|
||||
client: client,
|
||||
app: @app,
|
||||
ui: @ui,
|
||||
target_version: "0.18.1",
|
||||
target_build: "18001999",
|
||||
replace_in_review: true,
|
||||
deliver_runner: ->(args) { deliver_calls << args },
|
||||
sleep_fn: @sleep_fn,
|
||||
clock: @clock,
|
||||
)
|
||||
end
|
||||
|
||||
assert_match(/failed App Store processing/, error.message)
|
||||
assert_empty client.canceled_submission_ids, "Must not cancel active review if replacement build is INVALID"
|
||||
assert_empty deliver_calls
|
||||
end
|
||||
|
||||
def test_cancel_review_cancels_active_submission_and_logs_resulting_state
|
||||
in_flight_version = FakeAppStoreVersion.new(id: "v-1", version_string: "0.18.0", app_version_state: "WAITING_FOR_REVIEW")
|
||||
submission = FakeReviewSubmission.new(id: "sub-99", state: "WAITING_FOR_REVIEW", app_store_version_for_review: in_flight_version)
|
||||
|
||||
client = FakeClient.new(
|
||||
versions: [in_flight_version],
|
||||
submissions: [submission],
|
||||
submission_poll_states: { "sub-99" => %w[CANCELING COMPLETE] },
|
||||
version_poll_states: { "v-1" => %w[WAITING_FOR_REVIEW DEVELOPER_REJECTED] },
|
||||
)
|
||||
|
||||
result = IosReview.cancel_review(
|
||||
client: client,
|
||||
app: @app,
|
||||
ui: @ui,
|
||||
expected_version: "0.18.0",
|
||||
sleep_fn: @sleep_fn,
|
||||
clock: @clock,
|
||||
)
|
||||
|
||||
assert_equal :canceled, result[:status]
|
||||
assert_equal "0.18.0", result[:version]
|
||||
assert_equal "sub-99", result[:submission_id]
|
||||
assert_equal "COMPLETE", result[:submission_state]
|
||||
assert_equal "DEVELOPER_REJECTED", result[:version_state]
|
||||
assert_equal ["sub-99"], client.canceled_submission_ids
|
||||
assert_includes @ui.successes.last, "IOS_REVIEW_CANCELED version=0.18.0 submission_id=sub-99 submission_state=COMPLETE version_state=DEVELOPER_REJECTED"
|
||||
end
|
||||
|
||||
def test_cancel_review_refuses_on_expected_version_mismatch
|
||||
in_flight_version = FakeAppStoreVersion.new(id: "v-1", version_string: "0.18.1", app_version_state: "IN_REVIEW")
|
||||
submission = FakeReviewSubmission.new(id: "sub-99", state: "IN_REVIEW", app_store_version_for_review: in_flight_version)
|
||||
|
||||
client = FakeClient.new(
|
||||
versions: [in_flight_version],
|
||||
submissions: [submission],
|
||||
)
|
||||
|
||||
error = assert_raises(FakeUserError) do
|
||||
IosReview.cancel_review(
|
||||
client: client,
|
||||
app: @app,
|
||||
ui: @ui,
|
||||
expected_version: "0.18.0",
|
||||
sleep_fn: @sleep_fn,
|
||||
clock: @clock,
|
||||
)
|
||||
end
|
||||
|
||||
assert_match(/expected version 0\.18\.0.*version 0\.18\.1/i, error.message)
|
||||
assert_empty client.canceled_submission_ids
|
||||
end
|
||||
|
||||
def test_cancel_review_exits_cleanly_when_no_review_is_in_flight
|
||||
client = FakeClient.new(versions: [], submissions: [])
|
||||
|
||||
result = IosReview.cancel_review(
|
||||
client: client,
|
||||
app: @app,
|
||||
ui: @ui,
|
||||
expected_version: "0.18.0",
|
||||
sleep_fn: @sleep_fn,
|
||||
clock: @clock,
|
||||
)
|
||||
|
||||
assert_equal :noop, result[:status]
|
||||
assert_empty client.canceled_submission_ids
|
||||
assert_includes @ui.messages.first, "IOS_REVIEW_CANCEL_NOOP reason=no_active_review expected_version=0.18.0"
|
||||
end
|
||||
|
||||
def test_cancel_review_errors_clearly_when_version_is_already_pending_release
|
||||
pending = FakeAppStoreVersion.new(id: "v-1", version_string: "0.18.0", app_version_state: "PENDING_APPLE_RELEASE")
|
||||
client = FakeClient.new(versions: [pending], submissions: [])
|
||||
|
||||
error = assert_raises(FakeUserError) do
|
||||
IosReview.cancel_review(
|
||||
client: client,
|
||||
app: @app,
|
||||
ui: @ui,
|
||||
expected_version: "0.18.0",
|
||||
sleep_fn: @sleep_fn,
|
||||
clock: @clock,
|
||||
)
|
||||
end
|
||||
|
||||
assert_match(/Cannot cancel iOS App Store version 0\.18\.0 \(state: PENDING_APPLE_RELEASE\)/, error.message)
|
||||
assert_empty client.canceled_submission_ids
|
||||
end
|
||||
|
||||
def test_cancel_review_waits_without_duplicate_cancel_when_already_canceling
|
||||
in_flight_version = FakeAppStoreVersion.new(id: "v-1", version_string: "0.18.0", app_version_state: "WAITING_FOR_REVIEW")
|
||||
submission = FakeReviewSubmission.new(id: "sub-5", state: "CANCELING", app_store_version_for_review: in_flight_version)
|
||||
|
||||
client = FakeClient.new(
|
||||
versions: [in_flight_version],
|
||||
submissions: [submission],
|
||||
submission_poll_states: { "sub-5" => %w[COMPLETE] },
|
||||
version_poll_states: { "v-1" => %w[DEVELOPER_REJECTED] },
|
||||
)
|
||||
|
||||
result = IosReview.cancel_review(
|
||||
client: client,
|
||||
app: @app,
|
||||
ui: @ui,
|
||||
sleep_fn: @sleep_fn,
|
||||
clock: @clock,
|
||||
)
|
||||
|
||||
assert_equal :canceled, result[:status]
|
||||
assert_empty client.canceled_submission_ids
|
||||
assert_equal "DEVELOPER_REJECTED", result[:version_state]
|
||||
end
|
||||
|
||||
def test_review_status_formats_live_active_submissions_and_top_five_testflight_builds
|
||||
live = FakeAppStoreVersion.new(
|
||||
id: "v-live",
|
||||
version_string: "0.17.1",
|
||||
app_version_state: "READY_FOR_DISTRIBUTION",
|
||||
build: FakeBuild.new(version: "17001999"),
|
||||
)
|
||||
active = FakeAppStoreVersion.new(
|
||||
id: "v-active",
|
||||
version_string: "0.18.0",
|
||||
app_version_state: "WAITING_FOR_REVIEW",
|
||||
build: FakeBuild.new(version: "18000999"),
|
||||
)
|
||||
submission = FakeReviewSubmission.new(
|
||||
id: "sub-10",
|
||||
state: "WAITING_FOR_REVIEW",
|
||||
submitted_date: "2026-11-26T12:00:00Z",
|
||||
app_store_version_for_review: active,
|
||||
)
|
||||
builds = [
|
||||
make_build("0.18.2", "18002999", processing_state: "PROCESSING", uploaded_date: "2026-11-27T11:00:00Z"),
|
||||
make_build("0.18.1", "18001999", processing_state: "VALID", uploaded_date: "2026-11-27T09:00:00Z"),
|
||||
make_build("0.18.0", "18000999", processing_state: "VALID", uploaded_date: "2026-11-26T11:30:00Z"),
|
||||
make_build("0.18.0", "18000001", processing_state: "VALID", uploaded_date: "2026-11-25T10:00:00Z"),
|
||||
make_build("0.17.1", "17001999", processing_state: "VALID", uploaded_date: "2026-11-20T08:00:00Z"),
|
||||
make_build("0.17.0", "17000999", processing_state: "VALID", uploaded_date: "2026-11-15T08:00:00Z"),
|
||||
]
|
||||
|
||||
client = FakeClient.new(
|
||||
live_version_record: live,
|
||||
versions: [live, active],
|
||||
submissions: [submission],
|
||||
builds: builds,
|
||||
)
|
||||
|
||||
result = IosReview.review_status(client: client, app: @app, ui: @ui)
|
||||
report = result[:report]
|
||||
|
||||
assert_equal 5, result[:recent_builds].length
|
||||
assert_includes report, "=== iOS App Store Review Status (sh.paseo) ==="
|
||||
assert_includes report, "version=0.17.1 | state=READY_FOR_DISTRIBUTION | build=17001999"
|
||||
assert_includes report, "version=0.18.0 | state=WAITING_FOR_REVIEW | build=18000999"
|
||||
assert_includes report, "id=sub-10 | version=0.18.0 | state=WAITING_FOR_REVIEW | submitted_date=2026-11-26T12:00:00Z"
|
||||
assert_includes report, "1. version=0.18.2 | build=18002999 | processing_state=PROCESSING | uploaded_date=2026-11-27T11:00:00Z"
|
||||
assert_includes report, "5. version=0.17.1 | build=17001999 | processing_state=VALID | uploaded_date=2026-11-20T08:00:00Z"
|
||||
refute_includes report, "0.17.0"
|
||||
end
|
||||
|
||||
def test_review_status_formats_empty_sections_cleanly
|
||||
client = FakeClient.new
|
||||
result = IosReview.review_status(client: client, app: @app, ui: @ui)
|
||||
report = result[:report]
|
||||
|
||||
assert_equal 4, report.scan(" (none)").length
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/app",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"private": true,
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
|
||||
@@ -366,6 +366,111 @@ describe("Command Center relevance ordering", () => {
|
||||
expect(sectionResultIds(sections)).toEqual(["z-first", "a-second"]);
|
||||
});
|
||||
|
||||
it("does not flip a higher-ranked prefix match when a shorter title completes on the last letter", () => {
|
||||
const contributions = [
|
||||
action({
|
||||
id: "workspace:rename",
|
||||
group: "workspace",
|
||||
groupRank: -1,
|
||||
rank: 21,
|
||||
title: "Rename workspace",
|
||||
}),
|
||||
action({
|
||||
id: "tab:rename-current",
|
||||
group: "workspace",
|
||||
groupRank: -1,
|
||||
rank: 33,
|
||||
title: "Rename",
|
||||
}),
|
||||
];
|
||||
|
||||
for (const query of ["r", "re", "ren", "rena", "renam", "rename"]) {
|
||||
expect(sectionResultIds(buildContributionSections(contributions, query)), query).toEqual([
|
||||
"workspace:rename",
|
||||
"tab:rename-current",
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
it("does not let a mid-phrase whole word leapfrog a start-of-title prefix mid-word", () => {
|
||||
const contributions = [
|
||||
action({
|
||||
id: "workspace:pin",
|
||||
group: "workspace",
|
||||
groupRank: -1,
|
||||
rank: 20,
|
||||
title: "Pin to top",
|
||||
}),
|
||||
action({
|
||||
id: "workspace:toggle-explorer-sidebar",
|
||||
group: "workspace",
|
||||
groupRank: -1,
|
||||
rank: 25,
|
||||
title: "Toggle Explorer sidebar",
|
||||
}),
|
||||
];
|
||||
|
||||
for (const query of ["t", "to"]) {
|
||||
expect(sectionResultIds(buildContributionSections(contributions, query)), query).toEqual([
|
||||
"workspace:toggle-explorer-sidebar",
|
||||
"workspace:pin",
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps start-of-title priority even when the same token also appears as a whole word later", () => {
|
||||
const contributions = [
|
||||
action({
|
||||
id: "later-only",
|
||||
group: "workspace",
|
||||
groupRank: -1,
|
||||
rank: 1,
|
||||
title: "Pin to top",
|
||||
}),
|
||||
action({
|
||||
id: "starts-with-and-contains",
|
||||
group: "workspace",
|
||||
groupRank: -1,
|
||||
rank: 2,
|
||||
title: "Toggle to main",
|
||||
}),
|
||||
];
|
||||
|
||||
for (const query of ["t", "to"]) {
|
||||
expect(sectionResultIds(buildContributionSections(contributions, query)), query).toEqual([
|
||||
"starts-with-and-contains",
|
||||
"later-only",
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
it("does not flip word-start matches when one word finishes earlier than another", () => {
|
||||
const contributions = [
|
||||
action({
|
||||
id: "workspace:toggle-explorer-sidebar",
|
||||
group: "workspace",
|
||||
groupRank: -1,
|
||||
rank: 25,
|
||||
title: "Toggle Explorer sidebar",
|
||||
}),
|
||||
action({
|
||||
id: "tab:open:pull-request:side-pane",
|
||||
group: "workspace",
|
||||
groupRank: -1,
|
||||
rank: 14,
|
||||
title: "Open Pull request in side pane",
|
||||
}),
|
||||
];
|
||||
|
||||
// Registry order puts the lower-index item first; neither should jump past the other on "side".
|
||||
for (const query of ["si", "sid", "side"]) {
|
||||
expect(sectionResultIds(buildContributionSections(contributions, query)), query).toEqual([
|
||||
"workspace:toggle-explorer-sidebar",
|
||||
"tab:open:pull-request:side-pane",
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps Workspaces below contributions even on a perfect match", () => {
|
||||
const projection = projectCommandCenterRows(
|
||||
[
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import {
|
||||
compareMatchScores,
|
||||
type MatchClass,
|
||||
type MatchScore,
|
||||
scoreTextFields,
|
||||
scoreMatch,
|
||||
textFieldsMatchClass,
|
||||
tokenizeQuery,
|
||||
} from "@getpaseo/protocol/search/text-match";
|
||||
import type { CommandCenterContribution } from "./contributions";
|
||||
import type { CommandCenterListMetrics } from "./list-metrics";
|
||||
@@ -20,10 +19,26 @@ const VISIBLE_FIELD_RANK = 0;
|
||||
/** At least one token only matched a hidden keyword. */
|
||||
const KEYWORD_FIELD_RANK = 1;
|
||||
|
||||
/**
|
||||
* Left-edge match ranks for Command Center scoring, best to worst.
|
||||
*
|
||||
* Right-edge promotions (`TIER_EXACT`, `TIER_WHOLE_WORD`) are deliberately excluded here:
|
||||
* whether a word or title happens to end on the latest keystroke flips row order mid-word as
|
||||
* the user types (e.g., `"renam"` → `"rename"` jumping a shorter title ahead of `"Rename
|
||||
* workspace"`, or `"t"` → `"to"` jumping `"Pin to top"` ahead of `"Toggle Explorer sidebar"`).
|
||||
* Left-edge ranks can only stay the same or worsen as characters are appended to a token, so
|
||||
* two rows that keep matching at the same left edge never swap places.
|
||||
*/
|
||||
const FIELD_START_RANK = 0;
|
||||
const WORD_START_RANK = 1;
|
||||
const INSIDE_WORD_RANK = 2;
|
||||
const SCATTERED_RANK = 3;
|
||||
|
||||
export interface CommandCenterScore {
|
||||
/** VISIBLE_FIELD_RANK or KEYWORD_FIELD_RANK. Compared before match quality. */
|
||||
fieldRank: number;
|
||||
match: MatchScore;
|
||||
/** Sum of per-token left-edge ranks (FIELD_START..SCATTERED). Lower is better. */
|
||||
matchRank: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,7 +59,7 @@ export function compareCommandCenterScores(
|
||||
left: CommandCenterScore,
|
||||
right: CommandCenterScore,
|
||||
): number {
|
||||
return left.fieldRank - right.fieldRank || compareMatchScores(left.match, right.match);
|
||||
return left.fieldRank - right.fieldRank || left.matchRank - right.matchRank;
|
||||
}
|
||||
|
||||
export interface CommandCenterWorkspaceProject {
|
||||
@@ -148,12 +163,41 @@ export interface CommandCenterSearchFields {
|
||||
hidden: readonly string[];
|
||||
}
|
||||
|
||||
function scoreTokenInField(token: string, field: string): number | null {
|
||||
// Check start-of-field first: `scoreMatch` prefers a later whole word (tier 1) over a leading
|
||||
// prefix (tier 2), which would otherwise demote a field starting with the token when the same
|
||||
// token also appears as a standalone word later in the field.
|
||||
if (field.toLowerCase().startsWith(token)) return FIELD_START_RANK;
|
||||
const score = scoreMatch(token, field);
|
||||
if (!score) return null;
|
||||
if (score.tier <= 3) return WORD_START_RANK;
|
||||
if (score.tier === 4) return INSIDE_WORD_RANK;
|
||||
return SCATTERED_RANK;
|
||||
}
|
||||
|
||||
function scoreFieldsLeftEdge(tokens: readonly string[], fields: readonly string[]): number | null {
|
||||
let total = 0;
|
||||
for (const token of tokens) {
|
||||
let best: number | null = null;
|
||||
for (const field of fields) {
|
||||
const rank = scoreTokenInField(token, field);
|
||||
if (rank !== null && (best === null || rank < best)) {
|
||||
best = rank;
|
||||
if (best === FIELD_START_RANK) break;
|
||||
}
|
||||
}
|
||||
if (best === null) return null;
|
||||
total += best;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
/**
|
||||
* The one definition of "how well did this row match", shared by every scored row kind. Null
|
||||
* means the row is filtered out, so scoring and filtering are the same pass — a separate boolean
|
||||
* predicate would throw this result away and force the token scan a second time.
|
||||
*
|
||||
* Matching is per-token (`scoreTextFields` splits on whitespace and every token must land in
|
||||
* Matching is per-token (`tokenizeQuery` splits on whitespace and every token must land in
|
||||
* some field), so token order does not matter and `lab des` finds "Label as Design". This can
|
||||
* only ever widen the result set: tokens hold no whitespace, so any token that was found in the
|
||||
* old space-joined haystack lies entirely within one field and is still found here.
|
||||
@@ -165,11 +209,12 @@ export function scoreSearchFields(
|
||||
query: string,
|
||||
fields: CommandCenterSearchFields,
|
||||
): CommandCenterScore | null {
|
||||
const visible = scoreTextFields(query, [...fields.visible]);
|
||||
if (visible) return { fieldRank: VISIBLE_FIELD_RANK, match: visible };
|
||||
const tokens = tokenizeQuery(query);
|
||||
const visible = scoreFieldsLeftEdge(tokens, fields.visible);
|
||||
if (visible !== null) return { fieldRank: VISIBLE_FIELD_RANK, matchRank: visible };
|
||||
if (fields.hidden.length === 0) return null;
|
||||
const match = scoreTextFields(query, [...fields.visible, ...fields.hidden]);
|
||||
return match ? { fieldRank: KEYWORD_FIELD_RANK, match } : null;
|
||||
const matchRank = scoreFieldsLeftEdge(tokens, [...fields.visible, ...fields.hidden]);
|
||||
return matchRank !== null ? { fieldRank: KEYWORD_FIELD_RANK, matchRank } : null;
|
||||
}
|
||||
|
||||
/** How closely the query matched the fields; see `MatchClass`. Null when it does not match. */
|
||||
@@ -245,16 +290,6 @@ export function compareByRecency(left: CommandCenterRecentRow, right: CommandCen
|
||||
return (right.activityAt?.getTime() ?? 0) - (left.activityAt?.getTime() ?? 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rank built-in rows by the kind of match they made: which fields matched, then the matcher's
|
||||
* tier. Offset and spread are deliberately left out. They only say where in the title the word
|
||||
* happened to sit, so "usage" in "Deliver sidebar usage" and in "expose usage data" would be
|
||||
* ordered by sentence position. Leaving them out makes those rows equal, and recency decides.
|
||||
*/
|
||||
export function compareBuiltInScores(left: CommandCenterScore, right: CommandCenterScore): number {
|
||||
return left.fieldRank - right.fieldRank || left.match.tier - right.match.tier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Group contributions into their sections, ranked by the query. `includeQueryOnly` lists the
|
||||
* contributions that otherwise wait for a query, for a list whose whole job is browsing them.
|
||||
|
||||
@@ -49,7 +49,8 @@ function source(gitActions: GitActions): {
|
||||
previousTab: "Previous tab",
|
||||
nextTab: "Next tab",
|
||||
closeCurrentTab: "Close current tab",
|
||||
renameTab: "Rename",
|
||||
renameAgent: "Rename agent",
|
||||
renameTerminal: "Rename terminal",
|
||||
reloadAgent: "Reload agent",
|
||||
copyResumeCommand: "Copy resume command",
|
||||
copyAgentId: "Copy agent id",
|
||||
@@ -282,6 +283,26 @@ describe("workspace command center contributions", () => {
|
||||
expect(fixture.dispatched).toEqual([{ id: "workspace.rename", scope: "workspace" }]);
|
||||
});
|
||||
|
||||
it("labels active tab rename by the active tab kind", () => {
|
||||
const agentFixture = source({ primary: null, secondary: [], menu: [] });
|
||||
agentFixture.value.activeTabCount = 1;
|
||||
agentFixture.value.activeTabIndex = 0;
|
||||
agentFixture.value.activeTabKind = "agent";
|
||||
const agentRename = buildWorkspaceCommandCenterContributions(agentFixture.value).find(
|
||||
(item) => item.id === "tab:rename-current",
|
||||
);
|
||||
expect(agentRename?.presentation).toMatchObject({ title: "Rename agent" });
|
||||
|
||||
const terminalFixture = source({ primary: null, secondary: [], menu: [] });
|
||||
terminalFixture.value.activeTabCount = 1;
|
||||
terminalFixture.value.activeTabIndex = 0;
|
||||
terminalFixture.value.activeTabKind = "terminal";
|
||||
const terminalRename = buildWorkspaceCommandCenterContributions(terminalFixture.value).find(
|
||||
(item) => item.id === "tab:rename-current",
|
||||
);
|
||||
expect(terminalRename?.presentation).toMatchObject({ title: "Rename terminal" });
|
||||
});
|
||||
|
||||
it("copies the workspace path without going through the dispatcher", () => {
|
||||
const fixture = source({ primary: null, secondary: [], menu: [] });
|
||||
const contributions = buildWorkspaceCommandCenterContributions(fixture.value);
|
||||
|
||||
@@ -29,7 +29,8 @@ export interface WorkspaceCommandCenterLabels {
|
||||
previousTab: string;
|
||||
nextTab: string;
|
||||
closeCurrentTab: string;
|
||||
renameTab: string;
|
||||
renameAgent: string;
|
||||
renameTerminal: string;
|
||||
reloadAgent: string;
|
||||
copyResumeCommand: string;
|
||||
copyAgentId: string;
|
||||
@@ -299,7 +300,10 @@ function buildActiveTabContributions(
|
||||
buildQueryAction(source, {
|
||||
id: "tab:rename-current",
|
||||
rank: 33,
|
||||
title: source.labels.renameTab,
|
||||
title:
|
||||
source.activeTabKind === "agent"
|
||||
? source.labels.renameAgent
|
||||
: source.labels.renameTerminal,
|
||||
keywords: ["tab", "rename", "current"],
|
||||
icon: source.icons.rename,
|
||||
action: { id: "workspace.tab.rename-current", scope: "workspace" },
|
||||
|
||||
@@ -249,7 +249,8 @@ export function useWorkspaceCommandCenterActions(): void {
|
||||
previousTab: t("settings.shortcuts.help.previousTab"),
|
||||
nextTab: t("settings.shortcuts.help.nextTab"),
|
||||
closeCurrentTab: t("settings.shortcuts.help.closeCurrentTab"),
|
||||
renameTab: t("workspace.tabs.menu.rename"),
|
||||
renameAgent: t("workspace.tabs.menu.renameAgent"),
|
||||
renameTerminal: t("workspace.tabs.menu.renameTerminal"),
|
||||
reloadAgent: t("workspace.tabs.menu.reloadAgent"),
|
||||
copyResumeCommand: t("workspace.tabs.menu.copyResumeCommand"),
|
||||
copyAgentId: t("workspace.tabs.menu.copyAgentId"),
|
||||
|
||||
@@ -94,7 +94,7 @@ describe("workspace ranking", () => {
|
||||
expect(ids([text, subject], "42")).toEqual(["payments", "a-text"]);
|
||||
});
|
||||
|
||||
it("orders workspaces in the same match tier by recency", () => {
|
||||
it("orders workspaces in the same match class by recency at every prefix", () => {
|
||||
const older = workspace({
|
||||
id: "older",
|
||||
title: "Usage hover card",
|
||||
@@ -105,7 +105,25 @@ describe("workspace ranking", () => {
|
||||
title: "Deliver sidebar usage",
|
||||
activityAt: new Date("2026-10-17T00:00:00Z"),
|
||||
});
|
||||
expect(ids([older, newer], "usage")).toEqual(["newer", "older"]);
|
||||
for (const query of ["u", "us", "usa", "usag", "usage"]) {
|
||||
expect(ids([older, newer], query), query).toEqual(["newer", "older"]);
|
||||
}
|
||||
});
|
||||
|
||||
it("does not flip a newer workspace below an older exact-title workspace on the final character", () => {
|
||||
const newer = workspace({
|
||||
id: "newer",
|
||||
title: "paseo command center",
|
||||
activityAt: new Date("2026-10-17T00:00:00Z"),
|
||||
});
|
||||
const older = workspace({
|
||||
id: "older",
|
||||
title: "paseo",
|
||||
activityAt: new Date("2026-10-01T00:00:00Z"),
|
||||
});
|
||||
for (const query of ["p", "pa", "pas", "pase", "paseo"]) {
|
||||
expect(ids([newer, older], query), query).toEqual(["newer", "older"]);
|
||||
}
|
||||
});
|
||||
|
||||
it("lists every workspace most recent first when the query is empty", () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { compareMatchClasses, type MatchClass } from "@getpaseo/protocol/search/text-match";
|
||||
import {
|
||||
compareBuiltInScores,
|
||||
compareByRecency,
|
||||
compareCommandCenterScores,
|
||||
scoreSearchFields,
|
||||
searchFieldsMatchClass,
|
||||
type CommandCenterScore,
|
||||
@@ -69,13 +69,14 @@ function scoreCandidate(query: string, fields: CommandCenterSearchFields): Candi
|
||||
function compareCandidates(left: Candidate, right: Candidate): number {
|
||||
return (
|
||||
compareMatchClasses(left.matchClass, right.matchClass) ||
|
||||
compareBuiltInScores(left.score, right.score)
|
||||
compareCommandCenterScores(left.score, right.score)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change-request hits first, host-only matches last; then match class, the workspace's own text
|
||||
* ahead of an agent, match quality, and recency.
|
||||
* ahead of an agent, and recency. Positional sub-tiers inside a match class are deliberately
|
||||
* omitted so workspaces do not flip mid-word as a prefix finishes a word or title.
|
||||
*/
|
||||
function compareScoredWorkspaces(left: ScoredWorkspace, right: ScoredWorkspace): number {
|
||||
if (left.changeRequestHit !== right.changeRequestHit) {
|
||||
@@ -89,10 +90,6 @@ function compareScoredWorkspaces(left: ScoredWorkspace, right: ScoredWorkspace):
|
||||
if (classDelta !== 0) return classDelta;
|
||||
}
|
||||
if (left.via !== right.via) return left.via - right.via;
|
||||
if (left.candidate && right.candidate) {
|
||||
const scoreDelta = compareBuiltInScores(left.candidate.score, right.candidate.score);
|
||||
if (scoreDelta !== 0) return scoreDelta;
|
||||
}
|
||||
return compareByRecency(left.workspace, right.workspace);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
resolveDesktopAppChromeLayout,
|
||||
resolveDesktopAppContentMinimum,
|
||||
resolveDesktopSidebarInsetLeft,
|
||||
resolveDesktopSidebarInsetTop,
|
||||
resolveDesktopSidebarVisibility,
|
||||
resolveSidebarActivity,
|
||||
resolveDesktopSidebarWidth,
|
||||
@@ -248,3 +249,13 @@ it("insets an overlay sidebar's content by the left safe area and leaves the doc
|
||||
expect(resolveDesktopSidebarInsetLeft({ overlay: true, safeAreaLeft: 20 })).toBe(20);
|
||||
expect(resolveDesktopSidebarInsetLeft({ overlay: false, safeAreaLeft: 20 })).toBe(0);
|
||||
});
|
||||
|
||||
it("gives the overlay sidebar the window's top inset, which a wide layout surface spends", () => {
|
||||
// A wide web surface pads the status bar itself and leaves its content a top inset of 0.
|
||||
expect(
|
||||
resolveDesktopSidebarInsetTop({ overlay: true, safeAreaTop: 0, windowSafeAreaTop: 32 }),
|
||||
).toBe(32);
|
||||
expect(
|
||||
resolveDesktopSidebarInsetTop({ overlay: false, safeAreaTop: 0, windowSafeAreaTop: 32 }),
|
||||
).toBe(0);
|
||||
});
|
||||
|
||||
@@ -52,6 +52,18 @@ export function resolveDesktopSidebarInsetLeft(input: {
|
||||
return input.overlay ? input.safeAreaLeft : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* The overlay sidebar also starts at the window's top edge, over the layout surface's top padding,
|
||||
* so it takes the window's top inset. The dock reads the inset the surface leaves its content.
|
||||
*/
|
||||
export function resolveDesktopSidebarInsetTop(input: {
|
||||
overlay: boolean;
|
||||
safeAreaTop: number;
|
||||
windowSafeAreaTop: number;
|
||||
}): number {
|
||||
return input.overlay ? input.windowSafeAreaTop : input.safeAreaTop;
|
||||
}
|
||||
|
||||
export function resolveDesktopAppChromeLayout(input: {
|
||||
desktopSidebarRendered: boolean;
|
||||
hasTopLeftWindowControls: boolean;
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
import React, { act, useMemo } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { View } from "react-native";
|
||||
import { Gesture, GestureHandlerRootView } from "react-native-gesture-handler";
|
||||
import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
import { afterEach, expect, it, vi } from "vitest";
|
||||
import { resolveDesktopSidebarInsetTop } from "@/components/desktop-sidebar-layout";
|
||||
import { MobilePanelOverlay } from "@/mobile-panels/presentation";
|
||||
import { MobilePanelsProvider } from "@/mobile-panels/provider";
|
||||
import { usePanelStore } from "@/stores/panel-store";
|
||||
import {
|
||||
WindowLayoutProvider,
|
||||
WindowLayoutSurface,
|
||||
useWindowSafeAreaInsets,
|
||||
} from "@/window-layout";
|
||||
|
||||
vi.stubGlobal("React", React);
|
||||
const statusBarInsets = { top: 24, right: 0, bottom: 0, left: 0 };
|
||||
const fill = { flex: 1 };
|
||||
const rowStyle = { height: 40 };
|
||||
const container = document.createElement("div");
|
||||
container.style.height = "800px";
|
||||
document.body.appendChild(container);
|
||||
const root = createRoot(container);
|
||||
afterEach(() => {
|
||||
act(() => root.render(null));
|
||||
});
|
||||
|
||||
/** The first row of the sidebar, padded the way `DesktopSidebar` pads it. */
|
||||
function SidebarFirstRow({ overlay }: { overlay: boolean }) {
|
||||
const insetTop = resolveDesktopSidebarInsetTop({
|
||||
overlay,
|
||||
safeAreaTop: useSafeAreaInsets().top,
|
||||
windowSafeAreaTop: useWindowSafeAreaInsets().top,
|
||||
});
|
||||
const style = useMemo(() => ({ paddingTop: insetTop }), [insetTop]);
|
||||
return (
|
||||
<View style={style}>
|
||||
<View testID="sidebar-first-row" style={rowStyle} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
function firstRowTop(): number {
|
||||
const row = document.querySelector<HTMLElement>('[data-testid="sidebar-first-row"]');
|
||||
expect(row).not.toBeNull();
|
||||
return row!.getBoundingClientRect().top - container.getBoundingClientRect().top;
|
||||
}
|
||||
|
||||
async function renderSidebar(overlay: boolean) {
|
||||
const closeGesture = Gesture.Pan();
|
||||
await act(async () => {
|
||||
root.render(
|
||||
<GestureHandlerRootView style={fill}>
|
||||
<SafeAreaInsetsContext.Provider value={statusBarInsets}>
|
||||
<WindowLayoutProvider>
|
||||
<WindowLayoutSurface compact={false} style={fill}>
|
||||
<MobilePanelsProvider>
|
||||
<MobilePanelOverlay
|
||||
panel="agent-list"
|
||||
presentation={overlay ? "overlay" : "dock"}
|
||||
dockVisible={!overlay}
|
||||
closeGesture={closeGesture}
|
||||
>
|
||||
<SidebarFirstRow overlay={overlay} />
|
||||
</MobilePanelOverlay>
|
||||
</MobilePanelsProvider>
|
||||
</WindowLayoutSurface>
|
||||
</WindowLayoutProvider>
|
||||
</SafeAreaInsetsContext.Provider>
|
||||
</GestureHandlerRootView>,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
it("keeps the overlay sidebar's first row below the status bar on a wide layout", async () => {
|
||||
usePanelStore.getState().showMobileAgentList();
|
||||
await renderSidebar(true);
|
||||
expect(firstRowTop()).toBe(statusBarInsets.top);
|
||||
});
|
||||
|
||||
it("keeps the docked sidebar's first row below the status bar without padding it twice", async () => {
|
||||
await renderSidebar(false);
|
||||
expect(firstRowTop()).toBe(statusBarInsets.top);
|
||||
});
|
||||
@@ -44,9 +44,15 @@ import {
|
||||
import { SidebarCloseButton } from "@/components/headers/sidebar-close-button";
|
||||
import {
|
||||
resolveDesktopSidebarInsetLeft,
|
||||
resolveDesktopSidebarInsetTop,
|
||||
resolveDesktopSidebarWidth,
|
||||
} from "@/components/desktop-sidebar-layout";
|
||||
import { useTopBand, useWindowLayout, resolveDesktopDivisionLayout } from "@/window-layout";
|
||||
import {
|
||||
useTopBand,
|
||||
useWindowLayout,
|
||||
useWindowSafeAreaInsets,
|
||||
resolveDesktopDivisionLayout,
|
||||
} from "@/window-layout";
|
||||
import {
|
||||
SIDEBAR_RESIZE_ACTIVATION_OFFSET,
|
||||
SIDEBAR_RESIZE_FAIL_OFFSET,
|
||||
@@ -173,6 +179,7 @@ export const LeftSidebar = memo(function LeftSidebar({
|
||||
const { theme } = useUnistyles();
|
||||
const { t } = useTranslation();
|
||||
const insets = useSafeAreaInsets();
|
||||
const windowInsets = useWindowSafeAreaInsets();
|
||||
const isCompactLayout = useIsCompactFormFactor();
|
||||
const activeWorkspace = useActiveWorkspaceSelection();
|
||||
const showMobileAgent = usePanelStore((state) => state.showMobileAgent);
|
||||
@@ -289,7 +296,11 @@ export const LeftSidebar = memo(function LeftSidebar({
|
||||
<DesktopSidebar
|
||||
{...sharedProps}
|
||||
{...handlers}
|
||||
insetsTop={insets.top}
|
||||
insetsTop={resolveDesktopSidebarInsetTop({
|
||||
overlay: desktopOverlay,
|
||||
safeAreaTop: insets.top,
|
||||
windowSafeAreaTop: windowInsets.top,
|
||||
})}
|
||||
active={active}
|
||||
overlay={desktopOverlay}
|
||||
/>
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import React, { act } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { SafeAreaInsetsContext } from "react-native-safe-area-context";
|
||||
import { afterEach, expect, it, vi } from "vitest";
|
||||
import { WindowLayoutProvider, WindowLayoutSurface } from "@/window-layout";
|
||||
import { MermaidFullscreenViewer } from "./fullscreen-viewer.web";
|
||||
|
||||
vi.stubGlobal("React", React);
|
||||
const statusBarInsets = { top: 32, right: 0, bottom: 20, left: 0 };
|
||||
const surfaceStyle = { flex: 1 };
|
||||
function noClose() {}
|
||||
const container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
const root = createRoot(container);
|
||||
afterEach(() => {
|
||||
act(() => root.render(null));
|
||||
});
|
||||
|
||||
it("keeps the close button below the status bar when opened from a wide layout", async () => {
|
||||
await act(async () => {
|
||||
root.render(
|
||||
<SafeAreaInsetsContext.Provider value={statusBarInsets}>
|
||||
<WindowLayoutProvider>
|
||||
<WindowLayoutSurface compact={false} style={surfaceStyle}>
|
||||
<MermaidFullscreenViewer
|
||||
source={"graph TD\n A --> B"}
|
||||
colorScheme="light"
|
||||
onClose={noClose}
|
||||
/>
|
||||
</WindowLayoutSurface>
|
||||
</WindowLayoutProvider>
|
||||
</SafeAreaInsetsContext.Provider>,
|
||||
);
|
||||
});
|
||||
|
||||
const close = document.querySelector<HTMLElement>('[data-testid="mermaid-fullscreen-close"]');
|
||||
expect(close).not.toBeNull();
|
||||
expect(close!.getBoundingClientRect().top).toBeGreaterThanOrEqual(statusBarInsets.top);
|
||||
});
|
||||
@@ -8,6 +8,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
import { ZoomableViewport } from "@/components/zoomable-viewport";
|
||||
import { SPACING } from "@/styles/theme";
|
||||
import { WindowChromeRootRegion } from "@/utils/desktop-window";
|
||||
import { WindowSafeArea } from "@/window-layout";
|
||||
import { MermaidIframeRuntime, type MermaidRenderedMessage } from "./iframe-runtime.web";
|
||||
import type { DiagramColorScheme } from "./render-model";
|
||||
import { useMermaidRenderModel } from "./use-render-model";
|
||||
@@ -23,11 +24,25 @@ interface MermaidFullscreenViewerProps {
|
||||
const FALLBACK_SIZE = { width: 240, height: 240 };
|
||||
const VIEWER_FIT = { padding: SPACING[6] };
|
||||
|
||||
export function MermaidFullscreenViewer({
|
||||
source,
|
||||
colorScheme,
|
||||
onClose,
|
||||
}: MermaidFullscreenViewerProps) {
|
||||
export function MermaidFullscreenViewer(props: MermaidFullscreenViewerProps) {
|
||||
return (
|
||||
<Modal
|
||||
transparent
|
||||
animationType="fade"
|
||||
statusBarTranslucent
|
||||
visible
|
||||
onRequestClose={props.onClose}
|
||||
>
|
||||
{/* The modal draws over the whole window: its insets are the window's, not the ones left
|
||||
where the diagram was opened (wide layouts spend the top one above the content). */}
|
||||
<WindowSafeArea>
|
||||
<MermaidFullscreenContent {...props} />
|
||||
</WindowSafeArea>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
function MermaidFullscreenContent({ source, colorScheme, onClose }: MermaidFullscreenViewerProps) {
|
||||
const { t } = useTranslation();
|
||||
const insets = useSafeAreaInsets();
|
||||
const { state, request, rendered, renderFailed } = useMermaidRenderModel({
|
||||
@@ -93,35 +108,33 @@ export function MermaidFullscreenViewer({
|
||||
);
|
||||
|
||||
return (
|
||||
<Modal transparent animationType="fade" statusBarTranslucent visible onRequestClose={onClose}>
|
||||
<WindowChromeRootRegion corners="both">
|
||||
<View style={styles.root}>
|
||||
<View style={styles.backdrop} />
|
||||
<View style={contentLayerStyle}>
|
||||
{/* biome-ignore lint/a11y/noNoninteractiveTabindex: focus holder for the Escape shortcut */}
|
||||
<div ref={contentLayerRef} style={focusLayerDomStyle} tabIndex={-1}>
|
||||
<ZoomableViewport
|
||||
accessibilityLabel={t("message.diagram.diagram")}
|
||||
actions={actions}
|
||||
contentSize={contentSize}
|
||||
fit={VIEWER_FIT}
|
||||
minScale={1}
|
||||
onPressOutsideContent={onClose}
|
||||
style={styles.viewport}
|
||||
testID="mermaid-fullscreen-viewport"
|
||||
wheelActivation="always"
|
||||
>
|
||||
<MermaidIframeRuntime
|
||||
request={request}
|
||||
onRendered={handleRendered}
|
||||
onRenderFailed={renderFailed}
|
||||
/>
|
||||
</ZoomableViewport>
|
||||
</div>
|
||||
</View>
|
||||
<WindowChromeRootRegion corners="both">
|
||||
<View style={styles.root}>
|
||||
<View style={styles.backdrop} />
|
||||
<View style={contentLayerStyle}>
|
||||
{/* biome-ignore lint/a11y/noNoninteractiveTabindex: focus holder for the Escape shortcut */}
|
||||
<div ref={contentLayerRef} style={focusLayerDomStyle} tabIndex={-1}>
|
||||
<ZoomableViewport
|
||||
accessibilityLabel={t("message.diagram.diagram")}
|
||||
actions={actions}
|
||||
contentSize={contentSize}
|
||||
fit={VIEWER_FIT}
|
||||
minScale={1}
|
||||
onPressOutsideContent={onClose}
|
||||
style={styles.viewport}
|
||||
testID="mermaid-fullscreen-viewport"
|
||||
wheelActivation="always"
|
||||
>
|
||||
<MermaidIframeRuntime
|
||||
request={request}
|
||||
onRendered={handleRendered}
|
||||
onRenderFailed={renderFailed}
|
||||
/>
|
||||
</ZoomableViewport>
|
||||
</div>
|
||||
</View>
|
||||
</WindowChromeRootRegion>
|
||||
</Modal>
|
||||
</View>
|
||||
</WindowChromeRootRegion>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -135,7 +148,11 @@ const focusLayerDomStyle: React.CSSProperties = {
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
root: { flex: 1, minHeight: 0, minWidth: 0 },
|
||||
backdrop: { position: "absolute", inset: 0, backgroundColor: theme.colors.surface0 },
|
||||
backdrop: {
|
||||
position: "absolute",
|
||||
inset: 0,
|
||||
backgroundColor: theme.colors.surface0,
|
||||
},
|
||||
contentLayer: { position: "absolute", inset: 0 },
|
||||
viewport: { flex: 1 },
|
||||
}));
|
||||
|
||||
@@ -4,10 +4,11 @@ import { createRoot, type Root } from "react-dom/client";
|
||||
import { PortalProvider } from "@gorhom/portal";
|
||||
import { View } from "react-native";
|
||||
import { KeyboardProvider } from "react-native-keyboard-controller";
|
||||
import { SafeAreaProvider } from "react-native-safe-area-context";
|
||||
import { SafeAreaInsetsContext, SafeAreaProvider } from "react-native-safe-area-context";
|
||||
import { afterEach, beforeEach, expect, it, vi } from "vitest";
|
||||
import { RetainedPanel } from "@/components/retained-panel";
|
||||
import { KeyboardShiftProvider } from "@/keyboard/shift";
|
||||
import { WindowLayoutProvider, WindowLayoutSurface } from "@/window-layout";
|
||||
import type { AutocompleteOption } from "./autocomplete";
|
||||
import { AutocompletePopover } from "./autocomplete-popover";
|
||||
import { FloatingPanelPortalHost } from "./floating-panel-portal";
|
||||
@@ -572,3 +573,64 @@ it("scrolls towards rows further from the composer when the wheel turns up", asy
|
||||
expect(isRowInView("/skill-7")).toBe(true);
|
||||
expect(popover.getBoundingClientRect().bottom).toBe(rectOf("composer-input")!.top - 12);
|
||||
});
|
||||
|
||||
const STATUS_BAR_INSETS = { top: 32, left: 0, right: 0, bottom: 0 };
|
||||
const SURFACE_STYLE = { flex: 1 };
|
||||
const COMPOSER_NEAR_TOP_STYLE = { position: "absolute" as const, top: 60, left: 16, width: 358 };
|
||||
|
||||
/**
|
||||
* A wide browser layout surface pads the status bar and gives its content a top inset of 0. The
|
||||
* root portal host sits outside that surface, against the window's top edge, so a composer inside
|
||||
* the surface that portals there still has to keep the popover below the status bar.
|
||||
*/
|
||||
function ComposerNearTop(): ReactNode {
|
||||
return (
|
||||
<View style={COMPOSER_NEAR_TOP_STYLE}>
|
||||
<AutocompletePopover
|
||||
visible
|
||||
options={OPTIONS}
|
||||
selectedIndex={OPTIONS.length - 1}
|
||||
onSelect={ignoreSelection}
|
||||
>
|
||||
<View testID="composer-input" style={inputStyle(40)} />
|
||||
</AutocompletePopover>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
/** A composer near the top of a wide surface, portalling into the root host outside it. */
|
||||
function WideSurfaceScreen(): ReactNode {
|
||||
return (
|
||||
<View style={SCREEN_STYLE}>
|
||||
<WindowLayoutSurface compact={false} style={SURFACE_STYLE}>
|
||||
<ComposerNearTop />
|
||||
</WindowLayoutSurface>
|
||||
<FloatingPanelPortalHost />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
function WideSurfaceWindow(): ReactNode {
|
||||
return (
|
||||
<Providers>
|
||||
<SafeAreaInsetsContext.Provider value={STATUS_BAR_INSETS}>
|
||||
<WindowLayoutProvider>
|
||||
<RetainedPanel active>
|
||||
<WideSurfaceScreen />
|
||||
</RetainedPanel>
|
||||
</WindowLayoutProvider>
|
||||
</SafeAreaInsetsContext.Provider>
|
||||
</Providers>
|
||||
);
|
||||
}
|
||||
|
||||
it("keeps its top below the status bar when it portals out of a wide layout surface", async () => {
|
||||
render(<WideSurfaceWindow />);
|
||||
const popover = await waitForPopover();
|
||||
await new Promise((resolve) => setTimeout(resolve, 200));
|
||||
|
||||
const screenTop = container!.getBoundingClientRect().top;
|
||||
expect(popover.getBoundingClientRect().top - screenTop).toBeGreaterThanOrEqual(
|
||||
STATUS_BAR_INSETS.top,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
import { Portal } from "@gorhom/portal";
|
||||
import { useAnimatedReaction, useAnimatedRef } from "react-native-reanimated";
|
||||
import { scheduleOnRN } from "react-native-worklets";
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
import {
|
||||
Autocomplete,
|
||||
type AutocompleteOption,
|
||||
@@ -56,7 +55,6 @@ export function AutocompletePopover({
|
||||
);
|
||||
const [anchorAtRest, setAnchorAtRest] = useState<AnchorAtRest | null>(null);
|
||||
const windowDimensions = useWindowDimensions();
|
||||
const safeAreaInsets = useSafeAreaInsets();
|
||||
const portalHostName = useFloatingPanelPortalHostName();
|
||||
const { isMoving } = useKeyboardShift();
|
||||
const anchor = useKeyboardAnchor();
|
||||
@@ -132,7 +130,6 @@ export function AutocompletePopover({
|
||||
anchorRef={anchorRef}
|
||||
anchorAtRest={anchorAtRest}
|
||||
reservedLift={anchor.reservedLift}
|
||||
topInset={safeAreaInsets.top}
|
||||
>
|
||||
<Autocomplete
|
||||
options={options}
|
||||
|
||||
@@ -5,6 +5,7 @@ import Animated, {
|
||||
useFrameCallback,
|
||||
useSharedValue,
|
||||
} from "react-native-reanimated";
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
import { placeAboveAnchor, type PopoverFrameProps } from "./placement";
|
||||
|
||||
/**
|
||||
@@ -20,11 +21,13 @@ export function PopoverFrame({
|
||||
anchorRef,
|
||||
anchorAtRest,
|
||||
reservedLift,
|
||||
topInset,
|
||||
children,
|
||||
}: PopoverFrameProps): ReactElement {
|
||||
"use no memo";
|
||||
// React Compiler memoizes effect captures by reading SharedValue.value during render.
|
||||
// The frame renders in the portal host, so these are the host's insets, not the composer's: a
|
||||
// host against the window's top edge keeps the popover below the status bar.
|
||||
const topInset = useSafeAreaInsets().top;
|
||||
const anchorHeight = useSharedValue(anchorAtRest.height);
|
||||
const anchorLost = useSharedValue(false);
|
||||
const readAnchorHeight = useCallback(() => {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useLayoutEffect, useRef, useState, type ReactElement } from "react";
|
||||
import { flushSync } from "react-dom";
|
||||
import { View } from "react-native";
|
||||
import { inlineUnistylesStyle } from "@/styles/unistyles-inline-style";
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
import { placeAboveAnchor, type AnchorAtRest, type PopoverFrameProps } from "./placement";
|
||||
|
||||
type AnchorRect = Omit<AnchorAtRest, "height">;
|
||||
@@ -26,11 +27,13 @@ export function PopoverFrame({
|
||||
anchorRef,
|
||||
anchorAtRest,
|
||||
reservedLift,
|
||||
topInset,
|
||||
children,
|
||||
}: PopoverFrameProps): ReactElement {
|
||||
"use no memo";
|
||||
// React Compiler memoizes effect captures by reading SharedValue.value during render.
|
||||
// The frame renders in the portal host, so these are the host's insets, not the composer's: a
|
||||
// host against the window's top edge keeps the popover below the status bar.
|
||||
const topInset = useSafeAreaInsets().top;
|
||||
const frameRef = useRef<View>(null);
|
||||
const [anchor, setAnchor] = useState<AnchorRect>(anchorAtRest);
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ export interface PopoverFrameProps {
|
||||
/** Taken asynchronously; the frame follows the anchor's live size between measurements. */
|
||||
anchorAtRest: AnchorAtRest;
|
||||
reservedLift: DerivedValue<number>;
|
||||
topInset: number;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,4 +70,34 @@ describe("buildDesktopFrameStyle", () => {
|
||||
|
||||
expect(frameStyle).toMatchObject({ width: 360, minWidth: 360, maxWidth: 360 });
|
||||
});
|
||||
|
||||
it("clamps a fixed height's minHeight and maxHeight to the available viewport height", () => {
|
||||
const styles = buildDesktopFrameStyle({
|
||||
desktopMinWidth: 440,
|
||||
desktopLockWidth: false,
|
||||
referenceWidth: 120,
|
||||
desktopFixedHeight: 400,
|
||||
desktopPositionStyle: { left: 0, top: 0 },
|
||||
shouldHideDesktopContent: false,
|
||||
availableHeight: 280,
|
||||
}) as Array<ViewStyle | null>;
|
||||
|
||||
expect(styles[1]).toEqual({ minHeight: 280, maxHeight: 280 });
|
||||
expect(styles[4]).toBeNull();
|
||||
});
|
||||
|
||||
it("keeps the requested fixed height when viewport space exceeds it", () => {
|
||||
const styles = buildDesktopFrameStyle({
|
||||
desktopMinWidth: 440,
|
||||
desktopLockWidth: false,
|
||||
referenceWidth: 120,
|
||||
desktopFixedHeight: 400,
|
||||
desktopPositionStyle: { left: 0, top: 0 },
|
||||
shouldHideDesktopContent: false,
|
||||
availableHeight: 600,
|
||||
}) as Array<ViewStyle | null>;
|
||||
|
||||
expect(styles[1]).toEqual({ minHeight: 400, maxHeight: 400 });
|
||||
expect(styles[4]).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,6 +10,17 @@ export interface DesktopFrameStyleInput {
|
||||
availableHeight: number | undefined;
|
||||
}
|
||||
|
||||
function resolveFixedHeight(
|
||||
desktopFixedHeight: number | undefined,
|
||||
availableHeight: number | undefined,
|
||||
): number | null {
|
||||
if (desktopFixedHeight == null) return null;
|
||||
if (typeof availableHeight === "number") {
|
||||
return Math.min(availableHeight, desktopFixedHeight);
|
||||
}
|
||||
return desktopFixedHeight;
|
||||
}
|
||||
|
||||
export function buildDesktopFrameStyle(input: DesktopFrameStyleInput): StyleProp<ViewStyle> {
|
||||
const {
|
||||
desktopMinWidth,
|
||||
@@ -20,14 +31,15 @@ export function buildDesktopFrameStyle(input: DesktopFrameStyleInput): StyleProp
|
||||
shouldHideDesktopContent,
|
||||
availableHeight,
|
||||
} = input;
|
||||
const resolvedFixedHeight = resolveFixedHeight(desktopFixedHeight, availableHeight);
|
||||
const fixedHeightStyle =
|
||||
desktopFixedHeight != null
|
||||
? { minHeight: desktopFixedHeight, maxHeight: desktopFixedHeight }
|
||||
resolvedFixedHeight != null
|
||||
? { minHeight: resolvedFixedHeight, maxHeight: resolvedFixedHeight }
|
||||
: null;
|
||||
const hiddenStyle = shouldHideDesktopContent ? { opacity: 0 } : null;
|
||||
const availableHeightStyle =
|
||||
typeof availableHeight === "number"
|
||||
? { maxHeight: Math.min(availableHeight, desktopFixedHeight ?? 400) }
|
||||
resolvedFixedHeight == null && typeof availableHeight === "number"
|
||||
? { maxHeight: Math.min(availableHeight, 400) }
|
||||
: null;
|
||||
const floor = Math.max(desktopMinWidth ?? 0, referenceWidth ?? 200);
|
||||
const widthStyle = desktopLockWidth
|
||||
|
||||
@@ -29,6 +29,10 @@ const FIELD_CHROME = { sm: "chromeSm", md: "chromeMd" } as const satisfies Recor
|
||||
ControlSize,
|
||||
string
|
||||
>;
|
||||
const FIELD_MULTILINE_CHROME = {
|
||||
sm: "chromeMultilineSm",
|
||||
md: "chromeMultilineMd",
|
||||
} as const satisfies Record<ControlSize, string>;
|
||||
const FIELD_TEXT = { sm: "inputSm", md: "inputMd" } as const satisfies Record<ControlSize, string>;
|
||||
|
||||
interface FieldProps {
|
||||
@@ -179,6 +183,9 @@ export const FormTextInput = forwardRef<EditingTextInputHandle, FormTextInputPro
|
||||
const size = sizeProp ?? containedSize ?? "md";
|
||||
const isDisabled = editable === false;
|
||||
const chromeSizeStyle = formInputStyles[FIELD_CHROME[size]];
|
||||
const chromeMultilineStyle = props.multiline
|
||||
? formInputStyles[FIELD_MULTILINE_CHROME[size]]
|
||||
: null;
|
||||
const inputSizeStyle = formInputStyles[FIELD_TEXT[size]];
|
||||
const splitStyle = useMemo(() => splitFormTextInputStyle(style), [style]);
|
||||
const setInputRef = useCallback(
|
||||
@@ -209,6 +216,7 @@ export const FormTextInput = forwardRef<EditingTextInputHandle, FormTextInputPro
|
||||
({ hovered = false }: PressableStateCallbackType & { hovered?: boolean }) => [
|
||||
formInputStyles.chrome,
|
||||
chromeSizeStyle,
|
||||
chromeMultilineStyle,
|
||||
leading ? formInputStyles.chromeWithLeading : null,
|
||||
resolveControlInteractionStyles(
|
||||
{
|
||||
@@ -226,7 +234,15 @@ export const FormTextInput = forwardRef<EditingTextInputHandle, FormTextInputPro
|
||||
invalid ? formInputStyles.controlInvalid : null,
|
||||
splitStyle.chromeStyle,
|
||||
],
|
||||
[chromeSizeStyle, focused, invalid, isDisabled, leading, splitStyle.chromeStyle],
|
||||
[
|
||||
chromeMultilineStyle,
|
||||
chromeSizeStyle,
|
||||
focused,
|
||||
invalid,
|
||||
isDisabled,
|
||||
leading,
|
||||
splitStyle.chromeStyle,
|
||||
],
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -292,6 +308,12 @@ const formInputStyles = StyleSheet.create((theme) => {
|
||||
chromeMd: {
|
||||
...geometry.fieldControlMd,
|
||||
},
|
||||
chromeMultilineSm: {
|
||||
paddingVertical: theme.spacing[2],
|
||||
},
|
||||
chromeMultilineMd: {
|
||||
paddingVertical: theme.spacing[3],
|
||||
},
|
||||
controlRest: {
|
||||
...geometry.controlRest,
|
||||
},
|
||||
|
||||
@@ -2609,7 +2609,7 @@ function ComposerContentImpl({
|
||||
recall={recall}
|
||||
inputRef={messageInputRef}
|
||||
anchorStyle={messageInputContainerStyle}
|
||||
show={mode.showAutocomplete && !isFullscreen}
|
||||
show={mode.showAutocomplete && !isFullscreen && !isComposerLocked}
|
||||
ref={autocompleteRef}
|
||||
configuration={autocompleteConfiguration}
|
||||
>
|
||||
|
||||
@@ -2568,7 +2568,7 @@ export const ar: TranslationResources = {
|
||||
metadataGeneration: {
|
||||
title: "إنشاء البيانات الوصفية",
|
||||
description:
|
||||
"اختر النموذج الذي يستخدمه Paseo لعناوين مساحات العمل وأسماء الفروع ورسائل الالتزام ومسودات طلبات السحب",
|
||||
"اختر النموذج والتعليمات التي يستخدمها Paseo لعناوين مساحات العمل وأسماء الفروع ورسائل الالتزام ومسودات طلبات السحب",
|
||||
selection: "اختيار النموذج",
|
||||
automatic: "تلقائي",
|
||||
preferred: "يدوي",
|
||||
@@ -2576,6 +2576,10 @@ export const ar: TranslationResources = {
|
||||
preferredHint: "اختر النموذج الذي يستخدمه Paseo",
|
||||
model: "النموذج",
|
||||
modelHint: "يُستخدم هذا النموذج فقط. إذا فشل، لا يجرّب Paseo نموذجًا آخر",
|
||||
instructions: "التعليمات",
|
||||
instructionsHint: "تُطبَّق على جميع البيانات الوصفية المنشأة على هذا المضيف",
|
||||
instructionsPlaceholder:
|
||||
"مثال: اكتب باللغة العربية. حافظ على أسلوب متسق بين العناوين ورسائل الالتزام. لا تستخدم الشرطات الطويلة.",
|
||||
docs: "الوثائق",
|
||||
saveError: "تعذر تحديث إنشاء البيانات الوصفية",
|
||||
},
|
||||
|
||||
@@ -2666,7 +2666,7 @@ export const en = {
|
||||
metadataGeneration: {
|
||||
title: "Metadata generation",
|
||||
description:
|
||||
"Choose the model Paseo uses for workspace titles, branch names, commit messages, and pull request drafts",
|
||||
"Choose the model and instructions Paseo uses for workspace titles, branch names, commit messages, and pull request drafts",
|
||||
selection: "Model selection",
|
||||
automatic: "Automatic",
|
||||
preferred: "Manual",
|
||||
@@ -2674,6 +2674,10 @@ export const en = {
|
||||
preferredHint: "Choose the model Paseo uses",
|
||||
model: "Model",
|
||||
modelHint: "Only this model is used. If it fails, Paseo does not try another model",
|
||||
instructions: "Instructions",
|
||||
instructionsHint: "Applied to all generated metadata on this host",
|
||||
instructionsPlaceholder:
|
||||
"Example: Write in Simplified Chinese. Keep phrasing consistent across titles and commits. Do not use em dashes.",
|
||||
docs: "Docs",
|
||||
saveError: "Unable to update metadata generation",
|
||||
},
|
||||
|
||||
@@ -2590,7 +2590,7 @@ export const es: TranslationResources = {
|
||||
metadataGeneration: {
|
||||
title: "Generación de metadatos",
|
||||
description:
|
||||
"Elige el modelo que Paseo usa para títulos de espacios de trabajo, nombres de ramas, mensajes de commit y borradores de pull requests",
|
||||
"Elige el modelo y las instrucciones que Paseo usa para títulos de espacios de trabajo, nombres de ramas, mensajes de commit y borradores de pull requests",
|
||||
selection: "Selección de modelo",
|
||||
automatic: "Automática",
|
||||
preferred: "Manual",
|
||||
@@ -2598,6 +2598,10 @@ export const es: TranslationResources = {
|
||||
preferredHint: "Elige el modelo que usa Paseo",
|
||||
model: "Modelo",
|
||||
modelHint: "Solo se usa este modelo. Si falla, Paseo no prueba otro modelo",
|
||||
instructions: "Instrucciones",
|
||||
instructionsHint: "Se aplican a todos los metadatos generados en este host",
|
||||
instructionsPlaceholder:
|
||||
"Ejemplo: Escribe en español. Mantén un estilo coherente entre títulos y commits. No uses rayas largas.",
|
||||
docs: "Documentación",
|
||||
saveError: "No se pudo actualizar la generación de metadatos",
|
||||
},
|
||||
|
||||
@@ -2590,7 +2590,7 @@ export const fr: TranslationResources = {
|
||||
metadataGeneration: {
|
||||
title: "Génération de métadonnées",
|
||||
description:
|
||||
"Choisissez le modèle utilisé par Paseo pour les titres d’espaces de travail, les noms de branches, les messages de commit et les brouillons de pull request",
|
||||
"Choisissez le modèle et les instructions utilisés par Paseo pour les titres d’espaces de travail, les noms de branches, les messages de commit et les brouillons de pull request",
|
||||
selection: "Sélection du modèle",
|
||||
automatic: "Automatique",
|
||||
preferred: "Manuel",
|
||||
@@ -2598,6 +2598,10 @@ export const fr: TranslationResources = {
|
||||
preferredHint: "Choisissez le modèle utilisé par Paseo",
|
||||
model: "Modèle",
|
||||
modelHint: "Seul ce modèle est utilisé. S’il échoue, Paseo n’essaie pas d’autre modèle",
|
||||
instructions: "Instructions",
|
||||
instructionsHint: "Appliquées à toutes les métadonnées générées sur cet hôte",
|
||||
instructionsPlaceholder:
|
||||
"Exemple : Écrire en français. Garder une formulation cohérente entre les titres et les commits. Ne pas utiliser de tirets cadratins.",
|
||||
docs: "Documentation",
|
||||
saveError: "Impossible de mettre à jour la génération de métadonnées",
|
||||
},
|
||||
|
||||
@@ -2558,7 +2558,7 @@ export const ja: TranslationResources = {
|
||||
metadataGeneration: {
|
||||
title: "メタデータ生成",
|
||||
description:
|
||||
"ワークスペースのタイトル、ブランチ名、コミットメッセージ、プルリクエストの下書きに使用するモデルを選択します",
|
||||
"ワークスペースのタイトル、ブランチ名、コミットメッセージ、プルリクエストの下書きに使用するモデルと指示を選択します",
|
||||
selection: "モデル選択",
|
||||
automatic: "自動",
|
||||
preferred: "手動",
|
||||
@@ -2566,6 +2566,10 @@ export const ja: TranslationResources = {
|
||||
preferredHint: "Paseo が使用するモデルを選択します",
|
||||
model: "モデル",
|
||||
modelHint: "このモデルのみを使用します。失敗しても、Paseo は別のモデルを試しません",
|
||||
instructions: "指示",
|
||||
instructionsHint: "このホストで生成されるすべてのメタデータに適用されます",
|
||||
instructionsPlaceholder:
|
||||
"例:日本語で書く。タイトルとコミットメッセージの表現を統一する。全角ダッシュを使わない。",
|
||||
docs: "ドキュメント",
|
||||
saveError: "メタデータ生成を更新できません",
|
||||
},
|
||||
|
||||
@@ -2544,7 +2544,7 @@ export const ko: TranslationResources = {
|
||||
metadataGeneration: {
|
||||
title: "메타데이터 생성",
|
||||
description:
|
||||
"워크스페이스 제목, 브랜치 이름, 커밋 메시지 및 풀 리퀘스트 초안에 사용할 모델을 선택하세요",
|
||||
"워크스페이스 제목, 브랜치 이름, 커밋 메시지 및 풀 리퀘스트 초안에 사용할 모델과 지침을 선택하세요",
|
||||
selection: "모델 선택",
|
||||
automatic: "자동",
|
||||
preferred: "수동",
|
||||
@@ -2552,6 +2552,10 @@ export const ko: TranslationResources = {
|
||||
preferredHint: "Paseo에서 사용할 모델을 선택하세요",
|
||||
model: "모델",
|
||||
modelHint: "이 모델만 사용합니다. 실패해도 Paseo는 다른 모델을 시도하지 않습니다",
|
||||
instructions: "지침",
|
||||
instructionsHint: "이 호스트에서 생성되는 모든 메타데이터에 적용됩니다",
|
||||
instructionsPlaceholder:
|
||||
"예: 한국어로 작성하세요. 제목과 커밋 메시지의 문체를 일관되게 유지하세요. 긴 대시(—)는 사용하지 마세요.",
|
||||
docs: "문서",
|
||||
saveError: "메타데이터 생성을 업데이트할 수 없습니다",
|
||||
},
|
||||
|
||||
@@ -2575,7 +2575,7 @@ export const ptBR: TranslationResources = {
|
||||
metadataGeneration: {
|
||||
title: "Geração de metadados",
|
||||
description:
|
||||
"Escolha o modelo usado pelo Paseo para títulos de espaços de trabalho, nomes de branches, mensagens de commit e rascunhos de pull request",
|
||||
"Escolha o modelo e as instruções usados pelo Paseo para títulos de espaços de trabalho, nomes de branches, mensagens de commit e rascunhos de pull request",
|
||||
selection: "Seleção de modelo",
|
||||
automatic: "Automática",
|
||||
preferred: "Manual",
|
||||
@@ -2583,6 +2583,10 @@ export const ptBR: TranslationResources = {
|
||||
preferredHint: "Escolha o modelo que o Paseo usa",
|
||||
model: "Modelo",
|
||||
modelHint: "Somente este modelo é usado. Se ele falhar, o Paseo não tenta outro modelo",
|
||||
instructions: "Instruções",
|
||||
instructionsHint: "Aplicadas a todos os metadados gerados neste host",
|
||||
instructionsPlaceholder:
|
||||
"Exemplo: Escreva em português. Mantenha o estilo coerente entre títulos e commits. Não use travessões.",
|
||||
docs: "Documentação",
|
||||
saveError: "Não foi possível atualizar a geração de metadados",
|
||||
},
|
||||
|
||||
@@ -2575,7 +2575,7 @@ export const ru: TranslationResources = {
|
||||
metadataGeneration: {
|
||||
title: "Генерация метаданных",
|
||||
description:
|
||||
"Выберите модель, которую Paseo будет использовать для названий рабочих пространств и веток, сообщений коммитов и черновиков PR",
|
||||
"Выберите модель и инструкции, которые Paseo будет использовать для названий рабочих пространств и веток, сообщений коммитов и черновиков PR",
|
||||
selection: "Выбор модели",
|
||||
automatic: "Автоматически",
|
||||
preferred: "Вручную",
|
||||
@@ -2584,6 +2584,10 @@ export const ru: TranslationResources = {
|
||||
model: "Модель",
|
||||
modelHint:
|
||||
"Используется только эта модель. Если она не сработает, Paseo не будет пробовать другую модель",
|
||||
instructions: "Инструкции",
|
||||
instructionsHint: "Применяются ко всем метаданным, создаваемым на этом хосте",
|
||||
instructionsPlaceholder:
|
||||
"Пример: Пиши на русском языке. Сохраняй единый стиль в названиях и коммитах. Не используй длинное тире.",
|
||||
docs: "Документация",
|
||||
saveError: "Не удалось обновить настройки генерации метаданных",
|
||||
},
|
||||
|
||||
@@ -2507,7 +2507,7 @@ export const zhCN: TranslationResources = {
|
||||
plugins: pluginSettings["zh-CN"],
|
||||
metadataGeneration: {
|
||||
title: "元数据生成",
|
||||
description: "选择 Paseo 用于工作区标题、分支名称、提交消息和拉取请求草稿的模型",
|
||||
description: "选择 Paseo 用于工作区标题、分支名称、提交消息和拉取请求草稿的模型和指令",
|
||||
selection: "模型选择",
|
||||
automatic: "自动",
|
||||
preferred: "手动",
|
||||
@@ -2515,6 +2515,10 @@ export const zhCN: TranslationResources = {
|
||||
preferredHint: "选择 Paseo 使用的模型",
|
||||
model: "模型",
|
||||
modelHint: "只使用此模型。如果失败,Paseo 不会尝试其他模型",
|
||||
instructions: "指令",
|
||||
instructionsHint: "应用于此主机上生成的所有元数据",
|
||||
instructionsPlaceholder:
|
||||
"例如:使用简体中文编写。保持标题与提交信息的风格一致。不要使用破折号。",
|
||||
docs: "文档",
|
||||
saveError: "无法更新元数据生成设置",
|
||||
},
|
||||
|
||||
@@ -17,7 +17,28 @@ function isFocusTarget(value: unknown): value is FocusTarget {
|
||||
}
|
||||
|
||||
function canRestoreFocusTo(target: FocusTarget): boolean {
|
||||
return !(target instanceof HTMLElement) || document.contains(target);
|
||||
if (typeof document === "undefined") return false;
|
||||
return (
|
||||
typeof HTMLElement === "undefined" ||
|
||||
!(target instanceof HTMLElement) ||
|
||||
document.contains(target)
|
||||
);
|
||||
}
|
||||
|
||||
function shouldRestoreFocusAfterRemoval(
|
||||
removedScope: HTMLElement | null,
|
||||
openerElement: Element | null,
|
||||
activeAtRemove: Element | null,
|
||||
): boolean {
|
||||
if (typeof document === "undefined") return false;
|
||||
const current = document.activeElement;
|
||||
if (!current || current === document.body || current === document.documentElement) {
|
||||
return true;
|
||||
}
|
||||
if (removedScope?.contains(current)) {
|
||||
return true;
|
||||
}
|
||||
return openerElement !== null && current === openerElement && activeAtRemove === openerElement;
|
||||
}
|
||||
|
||||
interface WebOverlayEntry {
|
||||
@@ -26,6 +47,7 @@ interface WebOverlayEntry {
|
||||
getScope: () => HTMLElement | null;
|
||||
getKeyHandler: () => WebOverlayKeyHandler;
|
||||
restoreFocus: FocusTarget | null;
|
||||
openerElement: Element | null;
|
||||
manageFocus: boolean;
|
||||
}
|
||||
|
||||
@@ -35,6 +57,7 @@ let webOverlayFocusCheckQueued = false;
|
||||
|
||||
interface RemoveWebOverlayOptions {
|
||||
restoreFocus?: boolean;
|
||||
deferFocusRestore?: boolean;
|
||||
}
|
||||
|
||||
function getTopWebOverlay(): WebOverlayEntry | undefined {
|
||||
@@ -165,17 +188,48 @@ function addWebOverlay(entry: WebOverlayEntry): (options?: RemoveWebOverlayOptio
|
||||
}
|
||||
});
|
||||
|
||||
let removed = false;
|
||||
let removedScope: HTMLElement | null = null;
|
||||
let activeAtRemove: Element | null = null;
|
||||
let topAfterRemove: OverlayEntry | undefined;
|
||||
|
||||
return (options) => {
|
||||
window.cancelAnimationFrame(focusFrame);
|
||||
remove();
|
||||
detachWebOverlayListeners();
|
||||
if (!removed) {
|
||||
removed = true;
|
||||
removedScope = entry.getScope();
|
||||
activeAtRemove = typeof document !== "undefined" ? document.activeElement : null;
|
||||
remove();
|
||||
topAfterRemove = overlays.getTop();
|
||||
detachWebOverlayListeners();
|
||||
}
|
||||
if (
|
||||
entry.manageFocus &&
|
||||
options?.restoreFocus !== false &&
|
||||
entry.restoreFocus &&
|
||||
canRestoreFocusTo(entry.restoreFocus)
|
||||
!entry.manageFocus ||
|
||||
options?.restoreFocus === false ||
|
||||
!entry.restoreFocus ||
|
||||
!canRestoreFocusTo(entry.restoreFocus)
|
||||
) {
|
||||
entry.restoreFocus.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
const target = entry.restoreFocus;
|
||||
const restore = () => {
|
||||
if (
|
||||
overlays.getTop() === topAfterRemove &&
|
||||
shouldRestoreFocusAfterRemoval(removedScope, entry.openerElement, activeAtRemove) &&
|
||||
canRestoreFocusTo(target)
|
||||
) {
|
||||
target.focus();
|
||||
}
|
||||
};
|
||||
|
||||
if (options?.deferFocusRestore) {
|
||||
// Unmount cleanups run during React's mutation commit phase while its DOM event
|
||||
// system is disabled, which drops synchronous focusin events (breaking onFocus
|
||||
// and onSelect on restored text inputs). Defer focus restoration until the commit ends.
|
||||
queueMicrotask(restore);
|
||||
} else {
|
||||
restore();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -199,6 +253,7 @@ export function useOverlayRegistration({
|
||||
const layerRef = useRef(layer);
|
||||
const keyHandlerRef = useRef(onKeyDown);
|
||||
const capturedRestoreFocusRef = useRef<FocusTarget | null>(null);
|
||||
const capturedOpenerElementRef = useRef<Element | null>(null);
|
||||
const removeEntryRef = useRef<((options?: RemoveWebOverlayOptions) => void) | null>(null);
|
||||
const detachedRemoveEntryRef = useRef<((options?: RemoveWebOverlayOptions) => void) | null>(null);
|
||||
const registeredRef = useRef(false);
|
||||
@@ -209,12 +264,16 @@ export function useOverlayRegistration({
|
||||
layerRef.current = layer;
|
||||
keyHandlerRef.current = onKeyDown;
|
||||
if (active && !wasActiveRef.current && typeof document !== "undefined") {
|
||||
const activeElement =
|
||||
typeof HTMLElement !== "undefined" && document.activeElement instanceof HTMLElement
|
||||
? document.activeElement
|
||||
: null;
|
||||
capturedOpenerElementRef.current = activeElement;
|
||||
const requestedRestoreTarget = preferredRestoreFocusRef?.current;
|
||||
if (isFocusTarget(requestedRestoreTarget)) {
|
||||
capturedRestoreFocusRef.current = requestedRestoreTarget;
|
||||
} else {
|
||||
capturedRestoreFocusRef.current =
|
||||
document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
||||
capturedRestoreFocusRef.current = activeElement;
|
||||
}
|
||||
}
|
||||
wasActiveRef.current = active;
|
||||
@@ -224,8 +283,9 @@ export function useOverlayRegistration({
|
||||
activeRef.current && typeof window !== "undefined" && typeof document !== "undefined";
|
||||
if (!shouldRegister) {
|
||||
const shouldRestoreFocus = !activeRef.current;
|
||||
const removeEntry = removeEntryRef.current ?? detachedRemoveEntryRef.current;
|
||||
if (registeredRef.current || shouldRestoreFocus) {
|
||||
removeEntryRef.current?.({ restoreFocus: shouldRestoreFocus });
|
||||
removeEntry?.({ restoreFocus: shouldRestoreFocus });
|
||||
}
|
||||
registeredRef.current = false;
|
||||
if (shouldRestoreFocus) {
|
||||
@@ -243,6 +303,7 @@ export function useOverlayRegistration({
|
||||
getScope: () => scopeRef.current,
|
||||
getKeyHandler: () => keyHandlerRef.current,
|
||||
restoreFocus: capturedRestoreFocusRef.current,
|
||||
openerElement: capturedOpenerElementRef.current,
|
||||
manageFocus,
|
||||
};
|
||||
removeEntryRef.current = addWebOverlay(entry);
|
||||
@@ -251,16 +312,24 @@ export function useOverlayRegistration({
|
||||
|
||||
const setScope = useCallback(
|
||||
(node: unknown) => {
|
||||
scopeRef.current =
|
||||
const nextScope =
|
||||
typeof HTMLElement !== "undefined" && node instanceof HTMLElement ? node : null;
|
||||
if (!scopeRef.current && activeRef.current) {
|
||||
if (!nextScope) {
|
||||
// Detach from the overlay stack before clearing scopeRef so removeEntry records
|
||||
// the departing scope. Focus restoration runs in the layout effect when active
|
||||
// flips false (after React re-enables DOM events and before passive effects run),
|
||||
// or in unmount cleanup if the host unmounts while active.
|
||||
const removeEntry = removeEntryRef.current;
|
||||
removeEntry?.({ restoreFocus: false });
|
||||
detachedRemoveEntryRef.current = removeEntry;
|
||||
removeEntryRef.current = null;
|
||||
registeredRef.current = false;
|
||||
if (removeEntry) {
|
||||
removeEntry({ restoreFocus: false });
|
||||
detachedRemoveEntryRef.current = removeEntry;
|
||||
removeEntryRef.current = null;
|
||||
registeredRef.current = false;
|
||||
}
|
||||
scopeRef.current = null;
|
||||
return;
|
||||
}
|
||||
scopeRef.current = nextScope;
|
||||
// Host refs attach before descendant layout effects and autofocus. Register
|
||||
// here so the previous overlay cannot redirect that pending focus.
|
||||
syncRegistration();
|
||||
@@ -268,16 +337,24 @@ export function useOverlayRegistration({
|
||||
[syncRegistration],
|
||||
);
|
||||
|
||||
// Register and deactivate during the layout phase, when React's DOM event system is
|
||||
// enabled (so synchronous focus restoration delivers onFocus/onSelect) and before
|
||||
// passive effects run.
|
||||
useLayoutEffect(() => {
|
||||
syncRegistration();
|
||||
}, [active, syncRegistration]);
|
||||
|
||||
// Unmount cleanup runs during React's mutation phase while DOM events are disabled,
|
||||
// so focus restoration on unmount-while-active defers to a microtask.
|
||||
useLayoutEffect(() => {
|
||||
return () => {
|
||||
const removeEntry = removeEntryRef.current ?? detachedRemoveEntryRef.current;
|
||||
removeEntry?.();
|
||||
removeEntry?.({ deferFocusRestore: true });
|
||||
removeEntryRef.current = null;
|
||||
detachedRemoveEntryRef.current = null;
|
||||
registeredRef.current = false;
|
||||
};
|
||||
}, [active, syncRegistration]);
|
||||
}, []);
|
||||
|
||||
return setScope;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useGlobalOverlayLayer } from "./overlay-root";
|
||||
import { useOverlayRegistration } from "@/keyboard";
|
||||
import React, { type RefCallback } from "react";
|
||||
import React, { useCallback, useEffect, useRef, type RefCallback } from "react";
|
||||
import { flushSync } from "react-dom";
|
||||
import { createRoot, type Root } from "react-dom/client";
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
@@ -24,6 +24,129 @@ function OverlayHarness({ active, showScope }: { active: boolean; showScope: boo
|
||||
) : null;
|
||||
}
|
||||
|
||||
function InnerOverlay({
|
||||
active,
|
||||
restoreFocusRef,
|
||||
}: {
|
||||
active: boolean;
|
||||
restoreFocusRef?: React.RefObject<unknown>;
|
||||
}) {
|
||||
const setScope = useOverlayRegistration({
|
||||
keys: ["Escape"],
|
||||
active,
|
||||
layer: 20,
|
||||
onKeyDown: () => false,
|
||||
restoreFocusRef,
|
||||
});
|
||||
return active ? (
|
||||
<div ref={setScope as RefCallback<HTMLDivElement>} tabIndex={-1}>
|
||||
<input data-testid="overlay-search" />
|
||||
</div>
|
||||
) : null;
|
||||
}
|
||||
|
||||
function TextareaOverlayHarness({
|
||||
open,
|
||||
mountOverlay = true,
|
||||
useExplicitRestoreRef,
|
||||
events,
|
||||
selections,
|
||||
}: {
|
||||
open: boolean;
|
||||
mountOverlay?: boolean;
|
||||
useExplicitRestoreRef: boolean;
|
||||
events: string[];
|
||||
selections: number[];
|
||||
}) {
|
||||
const textareaRef = useRef<HTMLTextAreaElement | null>(null);
|
||||
const focusHandleRef = useRef<{ focus: () => void }>({
|
||||
focus: () => textareaRef.current?.focus(),
|
||||
});
|
||||
const handleFocus = useCallback(() => {
|
||||
events.push("focus");
|
||||
}, [events]);
|
||||
const handleBlur = useCallback(() => {
|
||||
events.push("blur");
|
||||
}, [events]);
|
||||
const handleSelect = useCallback(
|
||||
(event: React.SyntheticEvent<HTMLTextAreaElement>) => {
|
||||
selections.push(event.currentTarget.selectionStart);
|
||||
},
|
||||
[selections],
|
||||
);
|
||||
return (
|
||||
<div>
|
||||
<textarea
|
||||
ref={textareaRef}
|
||||
data-testid="restored-textarea"
|
||||
onFocus={handleFocus}
|
||||
onBlur={handleBlur}
|
||||
onSelect={handleSelect}
|
||||
/>
|
||||
{mountOverlay ? (
|
||||
<InnerOverlay
|
||||
active={open}
|
||||
restoreFocusRef={useExplicitRestoreRef ? focusHandleRef : undefined}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function AutofocusReplacementHarness({
|
||||
open,
|
||||
showInlineInput,
|
||||
blurs,
|
||||
}: {
|
||||
open: boolean;
|
||||
showInlineInput: boolean;
|
||||
blurs: string[];
|
||||
}) {
|
||||
const handleBlur = useCallback(() => {
|
||||
blurs.push("blur");
|
||||
}, [blurs]);
|
||||
return (
|
||||
<div>
|
||||
<InnerOverlay active={open} />
|
||||
{showInlineInput ? (
|
||||
<input autoFocus data-testid="inline-autofocus-input" onBlur={handleBlur} />
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function PassiveFocusOrderHarness({
|
||||
open,
|
||||
openedAfterClose,
|
||||
}: {
|
||||
open: boolean;
|
||||
openedAfterClose: string[];
|
||||
}) {
|
||||
const triggerRef = useRef<HTMLButtonElement | null>(null);
|
||||
useEffect(() => {
|
||||
const trigger = triggerRef.current;
|
||||
if (!trigger) return;
|
||||
const onFocusIn = (event: FocusEvent) => {
|
||||
if (!open && trigger.contains(event.target as Node)) {
|
||||
openedAfterClose.push("focusin-while-enabled");
|
||||
}
|
||||
};
|
||||
document.addEventListener("focusin", onFocusIn);
|
||||
return () => {
|
||||
document.removeEventListener("focusin", onFocusIn);
|
||||
};
|
||||
}, [open, openedAfterClose]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<button ref={triggerRef} type="button" data-testid="passive-trigger">
|
||||
Trigger
|
||||
</button>
|
||||
<InnerOverlay active={open} restoreFocusRef={triggerRef} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
describe("useOverlayRegistration in the browser", () => {
|
||||
let root: Root;
|
||||
let container: HTMLDivElement;
|
||||
@@ -74,6 +197,192 @@ describe("useOverlayRegistration in the browser", () => {
|
||||
|
||||
expect(openerFocusCalls).toBe(1);
|
||||
});
|
||||
|
||||
it("delivers React onFocus and onSelect after restoring focus to a textarea", async () => {
|
||||
const events: string[] = [];
|
||||
const selections: number[] = [];
|
||||
|
||||
// Case 1: explicit restoreFocusRef handle closing via active: true -> false
|
||||
flushSync(() =>
|
||||
root.render(
|
||||
<TextareaOverlayHarness
|
||||
open={false}
|
||||
useExplicitRestoreRef
|
||||
events={events}
|
||||
selections={selections}
|
||||
/>,
|
||||
),
|
||||
);
|
||||
const textarea = document.querySelector<HTMLTextAreaElement>(
|
||||
'[data-testid="restored-textarea"]',
|
||||
)!;
|
||||
textarea.focus();
|
||||
events.length = 0;
|
||||
selections.length = 0;
|
||||
|
||||
flushSync(() =>
|
||||
root.render(
|
||||
<TextareaOverlayHarness
|
||||
open
|
||||
useExplicitRestoreRef
|
||||
events={events}
|
||||
selections={selections}
|
||||
/>,
|
||||
),
|
||||
);
|
||||
await nextFrame();
|
||||
document.querySelector<HTMLInputElement>('[data-testid="overlay-search"]')?.focus();
|
||||
expect(document.activeElement).not.toBe(textarea);
|
||||
|
||||
flushSync(() =>
|
||||
root.render(
|
||||
<TextareaOverlayHarness
|
||||
open={false}
|
||||
useExplicitRestoreRef
|
||||
events={events}
|
||||
selections={selections}
|
||||
/>,
|
||||
),
|
||||
);
|
||||
await nextFrame();
|
||||
expect(document.activeElement).toBe(textarea);
|
||||
expect(events).toContain("focus");
|
||||
|
||||
textarea.value = "/h";
|
||||
textarea.setSelectionRange(2, 2);
|
||||
textarea.dispatchEvent(new KeyboardEvent("keyup", { key: "h", bubbles: true }));
|
||||
expect(selections).toContain(2);
|
||||
|
||||
// Case 2: captured activeElement closing via unmount while active
|
||||
events.length = 0;
|
||||
selections.length = 0;
|
||||
textarea.value = "";
|
||||
textarea.setSelectionRange(0, 0);
|
||||
flushSync(() =>
|
||||
root.render(
|
||||
<TextareaOverlayHarness
|
||||
open
|
||||
mountOverlay
|
||||
useExplicitRestoreRef={false}
|
||||
events={events}
|
||||
selections={selections}
|
||||
/>,
|
||||
),
|
||||
);
|
||||
await nextFrame();
|
||||
document.querySelector<HTMLInputElement>('[data-testid="overlay-search"]')?.focus();
|
||||
expect(document.activeElement).not.toBe(textarea);
|
||||
|
||||
flushSync(() =>
|
||||
root.render(
|
||||
<TextareaOverlayHarness
|
||||
open
|
||||
mountOverlay={false}
|
||||
useExplicitRestoreRef={false}
|
||||
events={events}
|
||||
selections={selections}
|
||||
/>,
|
||||
),
|
||||
);
|
||||
await nextFrame();
|
||||
expect(document.activeElement).toBe(textarea);
|
||||
expect(events).toContain("focus");
|
||||
|
||||
textarea.value = "/help";
|
||||
textarea.setSelectionRange(5, 5);
|
||||
textarea.dispatchEvent(new KeyboardEvent("keyup", { key: "p", bubbles: true }));
|
||||
expect(selections).toContain(5);
|
||||
});
|
||||
|
||||
it("does not steal focus when another overlay opens in the same commit", async () => {
|
||||
function StackedHarness({ which }: { which: "first" | "second" }) {
|
||||
const firstScope = useOverlayRegistration({
|
||||
keys: ["Escape"],
|
||||
active: which === "first",
|
||||
layer: 20,
|
||||
onKeyDown: () => false,
|
||||
});
|
||||
const secondScope = useOverlayRegistration({
|
||||
keys: ["Escape"],
|
||||
active: which === "second",
|
||||
layer: 30,
|
||||
onKeyDown: () => false,
|
||||
});
|
||||
return (
|
||||
<div>
|
||||
{which === "first" ? (
|
||||
<div ref={firstScope as RefCallback<HTMLDivElement>} tabIndex={-1}>
|
||||
<input data-testid="first-input" />
|
||||
</div>
|
||||
) : (
|
||||
<div ref={secondScope as RefCallback<HTMLDivElement>} tabIndex={-1}>
|
||||
<input data-testid="second-input" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
flushSync(() => root.render(<StackedHarness which="first" />));
|
||||
await nextFrame();
|
||||
document.querySelector<HTMLInputElement>('[data-testid="first-input"]')?.focus();
|
||||
|
||||
flushSync(() => root.render(<StackedHarness which="second" />));
|
||||
const secondInput = document.querySelector<HTMLInputElement>('[data-testid="second-input"]')!;
|
||||
secondInput.focus();
|
||||
await nextFrame();
|
||||
|
||||
expect(document.activeElement).toBe(secondInput);
|
||||
});
|
||||
|
||||
it("does not steal focus from an autofocused input mounted in the same commit", async () => {
|
||||
const blurs: string[] = [];
|
||||
|
||||
flushSync(() =>
|
||||
root.render(<AutofocusReplacementHarness open showInlineInput={false} blurs={blurs} />),
|
||||
);
|
||||
await nextFrame();
|
||||
document.querySelector<HTMLInputElement>('[data-testid="overlay-search"]')?.focus();
|
||||
expect(document.activeElement).not.toBe(opener);
|
||||
|
||||
flushSync(() =>
|
||||
root.render(<AutofocusReplacementHarness open={false} showInlineInput blurs={blurs} />),
|
||||
);
|
||||
await nextFrame();
|
||||
|
||||
const inlineInput = document.querySelector<HTMLInputElement>(
|
||||
'[data-testid="inline-autofocus-input"]',
|
||||
);
|
||||
expect(inlineInput).toBeTruthy();
|
||||
expect(document.activeElement).toBe(inlineInput);
|
||||
expect(blurs).toEqual([]);
|
||||
});
|
||||
|
||||
it("restores focus during layout effects before passive focusin listeners re-enable", async () => {
|
||||
const openedAfterClose: string[] = [];
|
||||
|
||||
flushSync(() =>
|
||||
root.render(<PassiveFocusOrderHarness open={false} openedAfterClose={openedAfterClose} />),
|
||||
);
|
||||
const trigger = document.querySelector<HTMLButtonElement>('[data-testid="passive-trigger"]')!;
|
||||
trigger.focus();
|
||||
openedAfterClose.length = 0;
|
||||
|
||||
flushSync(() =>
|
||||
root.render(<PassiveFocusOrderHarness open openedAfterClose={openedAfterClose} />),
|
||||
);
|
||||
await nextFrame();
|
||||
document.querySelector<HTMLInputElement>('[data-testid="overlay-search"]')?.focus();
|
||||
expect(document.activeElement).not.toBe(trigger);
|
||||
|
||||
flushSync(() =>
|
||||
root.render(<PassiveFocusOrderHarness open={false} openedAfterClose={openedAfterClose} />),
|
||||
);
|
||||
await nextFrame();
|
||||
|
||||
expect(document.activeElement).toBe(trigger);
|
||||
expect(openedAfterClose).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("hasOpenDomPopover", () => {
|
||||
|
||||
@@ -53,6 +53,35 @@ describe("plugin timeline projection", () => {
|
||||
},
|
||||
);
|
||||
|
||||
it("passes tool-call metadata to timeline transformers", () => {
|
||||
const source: StreamItem = {
|
||||
kind: "tool_call",
|
||||
id: "tool-intent",
|
||||
timestamp: new Date(0),
|
||||
payload: {
|
||||
source: "agent",
|
||||
data: {
|
||||
provider: "omp",
|
||||
callId: "call-1",
|
||||
name: "bash",
|
||||
status: "running",
|
||||
error: null,
|
||||
detail: { type: "unknown", input: null, output: null },
|
||||
metadata: { intent: "Inspect files" },
|
||||
},
|
||||
},
|
||||
};
|
||||
const seen: unknown[] = [];
|
||||
const transform: TimelineItemTransform = ({ item }) => {
|
||||
if (item.type === "tool_call") seen.push(item.metadata?.intent);
|
||||
return undefined;
|
||||
};
|
||||
|
||||
projectPluginTimelineItems([source], transform);
|
||||
|
||||
expect(seen).toEqual(["Inspect files"]);
|
||||
});
|
||||
|
||||
it("does not expose mutable tool detail from stream state", () => {
|
||||
const detail = { type: "read" as const, filePath: "/repo/original.ts" };
|
||||
const source: StreamItem = {
|
||||
|
||||
@@ -1365,6 +1365,7 @@ it("retains semantic agent messages across disk-cache reconstruction", async ()
|
||||
status: "completed",
|
||||
error: null,
|
||||
detail: { type: "plain_text", text: "Done" },
|
||||
metadata: { intent: "Deliver result" },
|
||||
agentMessage: {
|
||||
event: "finished",
|
||||
sender: { id: "remote::worker", title: "Reviewer" },
|
||||
|
||||
@@ -1034,6 +1034,10 @@ export function NewWorkspaceScreen({
|
||||
|
||||
useEffect(() => {
|
||||
const trimmed = pickerSearchQuery.trim();
|
||||
if (!trimmed) {
|
||||
setDebouncedPickerSearchQuery("");
|
||||
return;
|
||||
}
|
||||
const timer = setTimeout(() => setDebouncedPickerSearchQuery(trimmed), 180);
|
||||
return () => clearTimeout(timer);
|
||||
}, [pickerSearchQuery]);
|
||||
@@ -1136,8 +1140,6 @@ export function NewWorkspaceScreen({
|
||||
}, [selectedServerId, t]);
|
||||
|
||||
const clientReady = isConnected && Boolean(client);
|
||||
const hasSelectedSourceDirectory = selectedSourceDirectory !== null;
|
||||
const pickerQueryEnabled = pickerOpen && clientReady && hasSelectedSourceDirectory;
|
||||
|
||||
const { status: checkoutStatus } = useCheckoutStatusQuery({
|
||||
serverId: selectedServerId,
|
||||
@@ -1159,56 +1161,27 @@ export function NewWorkspaceScreen({
|
||||
projectDirectory: selectedSourceDirectory,
|
||||
});
|
||||
|
||||
const branchSuggestionsQuery = useQuery({
|
||||
queryKey: [
|
||||
"branch-suggestions",
|
||||
selectedServerId,
|
||||
selectedSourceDirectory,
|
||||
debouncedPickerSearchQuery,
|
||||
],
|
||||
queryFn: async () => {
|
||||
if (!selectedSourceDirectory) {
|
||||
throw new Error("Choose a project");
|
||||
}
|
||||
const connectedClient = withConnectedClient();
|
||||
return connectedClient.getBranchSuggestions({
|
||||
cwd: selectedSourceDirectory,
|
||||
query: debouncedPickerSearchQuery || undefined,
|
||||
limit: 20,
|
||||
});
|
||||
},
|
||||
enabled: pickerQueryEnabled,
|
||||
staleTime: 15_000,
|
||||
});
|
||||
|
||||
const changeRequestContext = useChangeRequestContext({
|
||||
serverId: selectedServerId,
|
||||
cwd: selectedSourceDirectory,
|
||||
pickerOpen: pickerQueryEnabled,
|
||||
selectedItem,
|
||||
});
|
||||
|
||||
const githubPrSearchQuery = useForgeSearchQuery({
|
||||
const {
|
||||
branchDetails,
|
||||
prItems,
|
||||
changeRequestContext,
|
||||
isBranchesLoading,
|
||||
isBranchesFetching,
|
||||
isPrsFetching,
|
||||
} = useRefPickerQueries({
|
||||
client,
|
||||
clientReady,
|
||||
serverId: selectedServerId,
|
||||
cwd: selectedSourceDirectory ?? "",
|
||||
query: debouncedPickerSearchQuery,
|
||||
kinds: ["change_request"],
|
||||
sourceDirectory: selectedSourceDirectory,
|
||||
pickerOpen,
|
||||
showRefPicker,
|
||||
isScreenFocused,
|
||||
debouncedSearchQuery: debouncedPickerSearchQuery,
|
||||
supportsForgeSearch,
|
||||
enabled: pickerQueryEnabled,
|
||||
selectedItem,
|
||||
withConnectedClient,
|
||||
});
|
||||
|
||||
const branchDetails = useMemo(
|
||||
() => normalizeBranchDetails(branchSuggestionsQuery.data),
|
||||
[branchSuggestionsQuery.data],
|
||||
);
|
||||
const forgeSearchAuthenticated =
|
||||
!githubPrSearchQuery.data || githubPrSearchQuery.data.authState === "authenticated";
|
||||
const prItems: ForgeSearchItem[] = useMemo(() => {
|
||||
if (!forgeSearchAuthenticated) return [];
|
||||
return githubPrSearchQuery.data?.items ?? [];
|
||||
}, [forgeSearchAuthenticated, githubPrSearchQuery.data?.items]);
|
||||
|
||||
const baseItem = useMemo(
|
||||
() => selectedItem ?? (checkoutStatus ? defaultBasePickerItem(checkoutStatus) : null),
|
||||
[checkoutStatus, selectedItem],
|
||||
@@ -1584,11 +1557,6 @@ export function NewWorkspaceScreen({
|
||||
[composerState, isPending],
|
||||
);
|
||||
|
||||
const pickerEmptyText =
|
||||
branchSuggestionsQuery.isFetching || githubPrSearchQuery.isFetching
|
||||
? t("newWorkspace.refPicker.searching")
|
||||
: t("newWorkspace.refPicker.noMatchingRefs");
|
||||
|
||||
// The prompt is where the user types; when a field's picker closes, focus returns there rather
|
||||
// than to whatever had focus when the picker opened. A terminal profile that takes no prompt
|
||||
// shows a read-only command preview, so its pickers keep returning focus to their field.
|
||||
@@ -1655,7 +1623,9 @@ export function NewWorkspaceScreen({
|
||||
selectedOptionId,
|
||||
onSelect: handleSelectOption,
|
||||
setSearchQuery: setPickerSearchQuery,
|
||||
emptyText: pickerEmptyText,
|
||||
isBranchesLoading,
|
||||
isBranchesFetching,
|
||||
isPrsFetching,
|
||||
showRefPicker,
|
||||
worktrees: projectWorktrees,
|
||||
actionFor: refActionFor,
|
||||
@@ -1912,9 +1882,111 @@ const styles = StyleSheet.create((theme) => ({
|
||||
},
|
||||
}));
|
||||
|
||||
/**
|
||||
* The ref picker's branch, change-request, and forge-wording queries. Default branch suggestions
|
||||
* and forge wording warm while the picker trigger is visible so the first open paints settled;
|
||||
* change-request search stays gated on opening the picker.
|
||||
*/
|
||||
function useRefPickerQueries(input: {
|
||||
client: ReturnType<typeof useHostRuntimeClient>;
|
||||
clientReady: boolean;
|
||||
serverId: string;
|
||||
sourceDirectory: string | null;
|
||||
pickerOpen: boolean;
|
||||
showRefPicker: boolean;
|
||||
isScreenFocused: boolean;
|
||||
debouncedSearchQuery: string;
|
||||
supportsForgeSearch: boolean;
|
||||
selectedItem: PickerItem | null;
|
||||
withConnectedClient: () => DaemonClient;
|
||||
}) {
|
||||
const {
|
||||
client,
|
||||
clientReady,
|
||||
serverId,
|
||||
sourceDirectory,
|
||||
pickerOpen,
|
||||
showRefPicker,
|
||||
isScreenFocused,
|
||||
debouncedSearchQuery,
|
||||
supportsForgeSearch,
|
||||
selectedItem,
|
||||
withConnectedClient,
|
||||
} = input;
|
||||
const hasDirectory = sourceDirectory !== null;
|
||||
const pickerQueryEnabled = pickerOpen && clientReady && hasDirectory;
|
||||
const warmEnabled = showRefPicker && isScreenFocused && clientReady && hasDirectory;
|
||||
const branchSuggestionsEnabled =
|
||||
(pickerOpen || (warmEnabled && debouncedSearchQuery === "")) && clientReady && hasDirectory;
|
||||
|
||||
const branchSuggestionsQuery = useQuery({
|
||||
queryKey: ["branch-suggestions", serverId, sourceDirectory, debouncedSearchQuery],
|
||||
queryFn: async () => {
|
||||
if (!sourceDirectory) {
|
||||
throw new Error("Choose a project");
|
||||
}
|
||||
const connectedClient = withConnectedClient();
|
||||
return connectedClient.getBranchSuggestions({
|
||||
cwd: sourceDirectory,
|
||||
query: debouncedSearchQuery || undefined,
|
||||
limit: 20,
|
||||
});
|
||||
},
|
||||
// Keep the previous result while typing a search query in the same project so rows do not
|
||||
// blank out mid-search, without carrying branches across project or host switches.
|
||||
placeholderData: (previousData, previousQuery) => {
|
||||
const prevKey = previousQuery?.queryKey;
|
||||
if (Array.isArray(prevKey) && prevKey[1] === serverId && prevKey[2] === sourceDirectory) {
|
||||
return previousData;
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
enabled: branchSuggestionsEnabled,
|
||||
staleTime: 15_000,
|
||||
});
|
||||
|
||||
const changeRequestContext = useChangeRequestContext({
|
||||
serverId,
|
||||
cwd: sourceDirectory,
|
||||
pickerOpen: pickerQueryEnabled || warmEnabled,
|
||||
selectedItem,
|
||||
});
|
||||
|
||||
const githubPrSearchQuery = useForgeSearchQuery({
|
||||
client,
|
||||
serverId,
|
||||
cwd: sourceDirectory ?? "",
|
||||
query: debouncedSearchQuery,
|
||||
kinds: ["change_request"],
|
||||
supportsForgeSearch,
|
||||
enabled: pickerQueryEnabled,
|
||||
});
|
||||
|
||||
const branchDetails = useMemo(
|
||||
() => normalizeBranchDetails(branchSuggestionsQuery.data),
|
||||
[branchSuggestionsQuery.data],
|
||||
);
|
||||
const forgeSearchAuthenticated =
|
||||
!githubPrSearchQuery.data || githubPrSearchQuery.data.authState === "authenticated";
|
||||
const prItems: ForgeSearchItem[] = useMemo(() => {
|
||||
if (!forgeSearchAuthenticated) return [];
|
||||
return githubPrSearchQuery.data?.items ?? [];
|
||||
}, [forgeSearchAuthenticated, githubPrSearchQuery.data?.items]);
|
||||
|
||||
return {
|
||||
branchDetails,
|
||||
prItems,
|
||||
changeRequestContext,
|
||||
isBranchesLoading:
|
||||
branchSuggestionsQuery.data === undefined && branchSuggestionsQuery.isFetching,
|
||||
isBranchesFetching: branchSuggestionsQuery.isFetching,
|
||||
isPrsFetching: githubPrSearchQuery.isFetching,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The project's forge names its change requests: pull requests, or merge requests on GitLab.
|
||||
* The forge is looked up once the ref picker opens or a change request is chosen.
|
||||
* The forge is looked up while the ref picker is shown or a change request is chosen.
|
||||
*/
|
||||
function useChangeRequestContext(input: {
|
||||
serverId: string;
|
||||
|
||||
@@ -109,7 +109,10 @@ export interface NewWorkspaceFormProps {
|
||||
selectedOptionId: string;
|
||||
onSelect: (id: string) => void;
|
||||
setSearchQuery: (query: string) => void;
|
||||
emptyText: string;
|
||||
/** True while the initial branch list for this project has not arrived yet. */
|
||||
isBranchesLoading: boolean;
|
||||
isBranchesFetching: boolean;
|
||||
isPrsFetching: boolean;
|
||||
showRefPicker: boolean;
|
||||
/** Every git worktree of the project, to say where a branch is already checked out. */
|
||||
worktrees: readonly CheckoutWorktree[];
|
||||
@@ -296,10 +299,12 @@ function useRefPicker(base: NewWorkspaceFormProps["base"], isPending: boolean) {
|
||||
const context = base.changeRequestContext;
|
||||
const [list, setList] = useState<RefList>("branch");
|
||||
const action = actionFor[list];
|
||||
const options = useMemo(
|
||||
() => refListOptions({ options: allOptions, itemById, selectedOptionId, kind: list, action }),
|
||||
[action, allOptions, itemById, list, selectedOptionId],
|
||||
);
|
||||
const options = useMemo(() => {
|
||||
// Wait for the initial branch list instead of painting a lone base row at index 0 that
|
||||
// jumps down the moment newer branches arrive; the trigger already names the current base.
|
||||
if (list === "branch" && base.isBranchesLoading) return [];
|
||||
return refListOptions({ options: allOptions, itemById, selectedOptionId, kind: list, action });
|
||||
}, [action, allOptions, base.isBranchesLoading, itemById, list, selectedOptionId]);
|
||||
// Opens on the list the current pick is in.
|
||||
const open = useCallback(() => {
|
||||
setList(refListOf(selectedItem));
|
||||
@@ -351,12 +356,17 @@ function useRefPicker(base: NewWorkspaceFormProps["base"], isPending: boolean) {
|
||||
: t("newWorkspace.refPicker.branch"),
|
||||
qualifier: undefined,
|
||||
};
|
||||
const isCurrentListFetching = list === "github-pr" ? base.isPrsFetching : base.isBranchesFetching;
|
||||
const emptyText = isCurrentListFetching
|
||||
? t("newWorkspace.refPicker.searching")
|
||||
: t("newWorkspace.refPicker.noMatchingRefs");
|
||||
return {
|
||||
options,
|
||||
open,
|
||||
onSelect,
|
||||
renderOption,
|
||||
toolbar,
|
||||
emptyText,
|
||||
searchPlaceholder:
|
||||
list === "github-pr"
|
||||
? t("newWorkspace.refPicker.searchPullRequests", { context })
|
||||
@@ -572,9 +582,10 @@ export function useNewWorkspaceForm(props: NewWorkspaceFormProps): ReactElement
|
||||
onSearchQueryChange={base.setSearchQuery}
|
||||
desktopPlacement="bottom-start"
|
||||
desktopMinWidth={440}
|
||||
desktopFixedHeight={400}
|
||||
anchorRef={base.anchorRef}
|
||||
restoreFocusRef={restoreFocusRef}
|
||||
emptyText={base.emptyText}
|
||||
emptyText={refPicker.emptyText}
|
||||
toolbar={refPicker.toolbar}
|
||||
renderOption={refPicker.renderOption}
|
||||
/>
|
||||
|
||||
@@ -3,24 +3,179 @@ import { Alert, Text, View } from "react-native";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import type { AgentProvider } from "@getpaseo/protocol/agent-types";
|
||||
import type { MutableDaemonConfigPatch } from "@getpaseo/protocol/messages";
|
||||
import { AdaptiveModalSheet, type SheetHeader } from "@/components/adaptive-modal-sheet";
|
||||
import { CombinedModelSelector } from "@/components/combined-model-selector";
|
||||
import {
|
||||
SettingsCard,
|
||||
SettingsDetailRow,
|
||||
SettingsRow,
|
||||
SettingsSection,
|
||||
} from "@/components/settings";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { FormTextInput } from "@/components/ui/form-field";
|
||||
import { LoadingSpinner } from "@/components/ui/loading-spinner";
|
||||
import { SegmentedControl } from "@/components/ui/segmented-control";
|
||||
import { useDaemonConfig } from "@/hooks/use-daemon-config";
|
||||
import { useProvidersSnapshot } from "@/hooks/use-providers-snapshot";
|
||||
import { buildSelectableProviderSelectorProviders } from "@/provider-selection/provider-selection";
|
||||
import { SettingsSection } from "@/components/settings/headings/settings-section";
|
||||
import { useHostFeature } from "@/runtime/host-features";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
|
||||
const METADATA_GENERATION_DOCS_URL = "https://paseo.sh/docs/metadata-generation";
|
||||
type SelectionMode = "automatic" | "preferred";
|
||||
|
||||
export function MetadataGenerationPage({ serverId }: { serverId: string }) {
|
||||
function MetadataInstructionsSheet({
|
||||
initialInstructions,
|
||||
patchConfig,
|
||||
onClose,
|
||||
}: {
|
||||
initialInstructions: string;
|
||||
patchConfig: (patch: MutableDaemonConfigPatch) => Promise<unknown>;
|
||||
onClose: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [draft, setDraft] = useState(initialInstructions);
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const header = useMemo<SheetHeader>(
|
||||
() => ({
|
||||
title: t("settings.metadataGeneration.instructions"),
|
||||
subtitle: (
|
||||
<Text style={styles.sheetSubtitle}>
|
||||
{t("settings.metadataGeneration.instructionsHint")}
|
||||
</Text>
|
||||
),
|
||||
}),
|
||||
[t],
|
||||
);
|
||||
|
||||
const normalizedDraft = draft.trim();
|
||||
const canSave = normalizedDraft !== initialInstructions && !isSaving;
|
||||
|
||||
const handleChangeText = useCallback((nextText: string) => {
|
||||
setDraft(nextText);
|
||||
setError(null);
|
||||
}, []);
|
||||
|
||||
const handleClose = useCallback(() => {
|
||||
if (isSaving) return;
|
||||
onClose();
|
||||
}, [isSaving, onClose]);
|
||||
|
||||
const handleSave = useCallback(async () => {
|
||||
setIsSaving(true);
|
||||
setError(null);
|
||||
try {
|
||||
const updated = await patchConfig({
|
||||
metadataGeneration: { instructions: normalizedDraft },
|
||||
});
|
||||
if (!updated) {
|
||||
throw new Error(t("workspace.terminal.hostDisconnected"));
|
||||
}
|
||||
onClose();
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
} finally {
|
||||
setIsSaving(false);
|
||||
}
|
||||
}, [normalizedDraft, onClose, patchConfig, t]);
|
||||
|
||||
return (
|
||||
<AdaptiveModalSheet
|
||||
header={header}
|
||||
visible
|
||||
onClose={handleClose}
|
||||
testID="metadata-generation-instructions-sheet"
|
||||
desktopMaxWidth={560}
|
||||
>
|
||||
<FormTextInput
|
||||
initialValue={initialInstructions}
|
||||
onChangeText={handleChangeText}
|
||||
placeholder={t("settings.metadataGeneration.instructionsPlaceholder")}
|
||||
accessibilityLabel={t("settings.metadataGeneration.instructions")}
|
||||
multiline
|
||||
numberOfLines={4}
|
||||
textAlignVertical="top"
|
||||
autoFocus
|
||||
editable={!isSaving}
|
||||
invalid={error !== null}
|
||||
style={styles.instructionsInput}
|
||||
testID="metadata-generation-instructions-input"
|
||||
/>
|
||||
{error ? (
|
||||
<Text
|
||||
accessibilityRole="alert"
|
||||
style={settingsStyles.rowError}
|
||||
testID="metadata-generation-instructions-error"
|
||||
>
|
||||
{error}
|
||||
</Text>
|
||||
) : null}
|
||||
<View style={styles.sheetActions}>
|
||||
<Button variant="ghost" onPress={handleClose} disabled={isSaving}>
|
||||
{t("common.actions.cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="default"
|
||||
onPress={handleSave}
|
||||
disabled={!canSave}
|
||||
loading={isSaving}
|
||||
testID="metadata-generation-instructions-save"
|
||||
>
|
||||
{t("common.actions.save")}
|
||||
</Button>
|
||||
</View>
|
||||
</AdaptiveModalSheet>
|
||||
);
|
||||
}
|
||||
|
||||
function MetadataInstructionsRow({
|
||||
savedInstructions,
|
||||
patchConfig,
|
||||
}: {
|
||||
savedInstructions: string;
|
||||
patchConfig: (patch: MutableDaemonConfigPatch) => Promise<unknown>;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
const summary = savedInstructions ? savedInstructions.replace(/\s+/g, " ") : undefined;
|
||||
|
||||
const handleOpen = useCallback(() => setIsEditing(true), []);
|
||||
const handleClose = useCallback(() => setIsEditing(false), []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<SettingsDetailRow
|
||||
label={t("settings.metadataGeneration.instructions")}
|
||||
hint={t("settings.metadataGeneration.instructionsHint")}
|
||||
summary={summary}
|
||||
onPress={handleOpen}
|
||||
testID="metadata-generation-instructions-row"
|
||||
/>
|
||||
{isEditing ? (
|
||||
<MetadataInstructionsSheet
|
||||
initialInstructions={savedInstructions}
|
||||
patchConfig={patchConfig}
|
||||
onClose={handleClose}
|
||||
/>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function MetadataModelSelectionRows({
|
||||
serverId,
|
||||
configuredProviders,
|
||||
patchConfig,
|
||||
}: {
|
||||
serverId: string;
|
||||
configuredProviders: Array<{ provider: string; model?: string; thinkingOptionId?: string }>;
|
||||
patchConfig: (patch: MutableDaemonConfigPatch) => Promise<unknown>;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const { config, isLoading: isConfigLoading, patchConfig } = useDaemonConfig(serverId);
|
||||
const snapshot = useProvidersSnapshot(serverId);
|
||||
const configuredProviders = config?.metadataGeneration.providers;
|
||||
const configuredProvider = configuredProviders?.[0] ?? null;
|
||||
const configuredProvider = configuredProviders[0] ?? null;
|
||||
const providers = useMemo(
|
||||
() =>
|
||||
buildSelectableProviderSelectorProviders(snapshot.entries, {
|
||||
@@ -78,7 +233,7 @@ export function MetadataGenerationPage({ serverId }: { serverId: string }) {
|
||||
setDraftMode("preferred");
|
||||
void saveProviders([
|
||||
{ provider, ...(model ? { model } : {}) },
|
||||
...(configuredProviders?.slice(1) ?? []),
|
||||
...configuredProviders.slice(1),
|
||||
]);
|
||||
},
|
||||
[configuredProviders, saveProviders],
|
||||
@@ -91,6 +246,56 @@ export function MetadataGenerationPage({ serverId }: { serverId: string }) {
|
||||
(provider: AgentProvider) => snapshot.refresh([provider]),
|
||||
[snapshot],
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<SettingsRow
|
||||
label={t("settings.metadataGeneration.selection")}
|
||||
hint={
|
||||
mode === "automatic"
|
||||
? t("settings.metadataGeneration.automaticHint")
|
||||
: t("settings.metadataGeneration.preferredHint")
|
||||
}
|
||||
>
|
||||
<SegmentedControl
|
||||
options={modeOptions}
|
||||
value={mode}
|
||||
onValueChange={handleModeChange}
|
||||
testID="metadata-generation-mode"
|
||||
/>
|
||||
</SettingsRow>
|
||||
{mode === "preferred" ? (
|
||||
<View style={settingsStyles.rowBorder}>
|
||||
<SettingsRow
|
||||
label={t("settings.metadataGeneration.model")}
|
||||
hint={t("settings.metadataGeneration.modelHint")}
|
||||
>
|
||||
<CombinedModelSelector
|
||||
providers={providers}
|
||||
selectedProvider={configuredProvider?.provider ?? ""}
|
||||
selectedModel={configuredProvider?.model ?? ""}
|
||||
onSelect={handleModelSelect}
|
||||
isLoading={snapshot.isLoading || snapshot.isFetching}
|
||||
onOpen={handleSelectorOpen}
|
||||
onRetryProvider={handleRetryProvider}
|
||||
isRetryingProvider={snapshot.isRefreshing}
|
||||
disabled={isSaving}
|
||||
serverId={serverId}
|
||||
desktopPlacement="bottom-start"
|
||||
desktopMinWidth={360}
|
||||
/>
|
||||
</SettingsRow>
|
||||
</View>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export function MetadataGenerationPage({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const { config, isLoading: isConfigLoading, patchConfig } = useDaemonConfig(serverId);
|
||||
// COMPAT(metadataGenerationInstructions): added in v0.18.0, remove gate after 2027-06-01.
|
||||
const supportsInstructions = useHostFeature(serverId, "metadataGenerationInstructions");
|
||||
const docsLink = useMemo(
|
||||
() => ({ href: METADATA_GENERATION_DOCS_URL, label: t("settings.metadataGeneration.docs") }),
|
||||
[t],
|
||||
@@ -111,50 +316,20 @@ export function MetadataGenerationPage({ serverId }: { serverId: string }) {
|
||||
link={docsLink}
|
||||
testID="metadata-generation-settings"
|
||||
>
|
||||
<View style={settingsStyles.card}>
|
||||
<View style={settingsStyles.row}>
|
||||
<View style={settingsStyles.rowContent}>
|
||||
<Text style={settingsStyles.rowTitle}>
|
||||
{t("settings.metadataGeneration.selection")}
|
||||
</Text>
|
||||
<Text style={settingsStyles.rowHint}>
|
||||
{mode === "automatic"
|
||||
? t("settings.metadataGeneration.automaticHint")
|
||||
: t("settings.metadataGeneration.preferredHint")}
|
||||
</Text>
|
||||
</View>
|
||||
<SegmentedControl
|
||||
options={modeOptions}
|
||||
value={mode}
|
||||
onValueChange={handleModeChange}
|
||||
testID="metadata-generation-mode"
|
||||
<SettingsCard>
|
||||
<MetadataModelSelectionRows
|
||||
serverId={serverId}
|
||||
configuredProviders={config.metadataGeneration.providers}
|
||||
patchConfig={patchConfig}
|
||||
/>
|
||||
{supportsInstructions ? (
|
||||
<MetadataInstructionsRow
|
||||
key={serverId}
|
||||
savedInstructions={config.metadataGeneration.instructions ?? ""}
|
||||
patchConfig={patchConfig}
|
||||
/>
|
||||
</View>
|
||||
{mode === "preferred" ? (
|
||||
<View style={[settingsStyles.row, settingsStyles.rowBorder]}>
|
||||
<View style={settingsStyles.rowContent}>
|
||||
<Text style={settingsStyles.rowTitle}>{t("settings.metadataGeneration.model")}</Text>
|
||||
<Text style={settingsStyles.rowHint}>
|
||||
{t("settings.metadataGeneration.modelHint")}
|
||||
</Text>
|
||||
</View>
|
||||
<CombinedModelSelector
|
||||
providers={providers}
|
||||
selectedProvider={configuredProvider?.provider ?? ""}
|
||||
selectedModel={configuredProvider?.model ?? ""}
|
||||
onSelect={handleModelSelect}
|
||||
isLoading={snapshot.isLoading || snapshot.isFetching}
|
||||
onOpen={handleSelectorOpen}
|
||||
onRetryProvider={handleRetryProvider}
|
||||
isRetryingProvider={snapshot.isRefreshing}
|
||||
disabled={isSaving}
|
||||
serverId={serverId}
|
||||
desktopPlacement="bottom-start"
|
||||
desktopMinWidth={360}
|
||||
/>
|
||||
</View>
|
||||
) : null}
|
||||
</View>
|
||||
</SettingsCard>
|
||||
</SettingsSection>
|
||||
);
|
||||
}
|
||||
@@ -168,4 +343,16 @@ const styles = StyleSheet.create((theme) => ({
|
||||
spinnerColor: {
|
||||
color: theme.colors.foregroundMuted,
|
||||
},
|
||||
sheetSubtitle: {
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontSize: theme.fontSize.sm,
|
||||
},
|
||||
instructionsInput: {
|
||||
minHeight: 112,
|
||||
},
|
||||
sheetActions: {
|
||||
flexDirection: "row",
|
||||
justifyContent: "flex-end",
|
||||
gap: theme.spacing[2],
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -631,6 +631,37 @@ describe("stream reducer tool call idempotency", () => {
|
||||
});
|
||||
|
||||
describe("stream reducer canonical tool calls", () => {
|
||||
it("keeps metadata.intent across lifecycle updates that omit it", () => {
|
||||
const base = { provider: "codex" as const, callId: "call-intent", name: "shell" };
|
||||
const state = hydrateStreamState([
|
||||
{
|
||||
event: canonicalToolTimeline({
|
||||
...base,
|
||||
status: "running",
|
||||
metadata: { intent: "Inspect" },
|
||||
}),
|
||||
timestamp: new Date(0),
|
||||
},
|
||||
{
|
||||
event: canonicalToolTimeline({ ...base, status: "running" }),
|
||||
timestamp: new Date(1),
|
||||
},
|
||||
{
|
||||
event: canonicalToolTimeline({
|
||||
...base,
|
||||
status: "completed",
|
||||
metadata: { exitReason: "done" },
|
||||
}),
|
||||
timestamp: new Date(2),
|
||||
},
|
||||
]);
|
||||
|
||||
expect(findToolByCallId(state, base.callId)?.payload.data.metadata).toEqual({
|
||||
intent: "Inspect",
|
||||
exitReason: "done",
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps repeated call ids in different turns as distinct timeline rows", () => {
|
||||
const callId = "tool-reused-across-turns";
|
||||
const state = hydrateStreamState([
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import React, { act } from "react";
|
||||
import React, { act, useMemo } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { PortalProvider } from "@gorhom/portal";
|
||||
import { afterEach, expect, it, vi } from "vitest";
|
||||
import { Text } from "react-native";
|
||||
import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
import { page } from "vitest/browser";
|
||||
import {
|
||||
DropdownMenu,
|
||||
@@ -14,7 +15,7 @@ import { HeaderToggleButton } from "@/components/headers/header-toggle-button";
|
||||
import type { WindowLayout } from "./model";
|
||||
import { WindowLayoutContext } from "./context";
|
||||
import { WindowLayoutActions, WindowLayoutActionsHost } from "./actions";
|
||||
import { WindowLayoutDivisionGap } from "./surface";
|
||||
import { WindowLayoutDivisionGap, WindowLayoutSurface } from "./surface";
|
||||
import { lightTheme } from "@/styles/theme";
|
||||
|
||||
vi.stubGlobal("React", React);
|
||||
@@ -32,6 +33,40 @@ afterEach(() => {
|
||||
act(() => root.render(null));
|
||||
});
|
||||
|
||||
const statusBarInsets = { top: 24, left: 0, right: 0, bottom: 20 };
|
||||
const statusBarSurfaceStyle = { height: 200 };
|
||||
it("clears the status bar in wide layouts without applying the top inset twice", () => {
|
||||
function Header() {
|
||||
const insets = useSafeAreaInsets();
|
||||
const style = useMemo(() => ({ paddingTop: insets.top }), [insets.top]);
|
||||
return (
|
||||
<button type="button" style={style}>
|
||||
Tabs
|
||||
</button>
|
||||
);
|
||||
}
|
||||
for (const compact of [false, true]) {
|
||||
act(() =>
|
||||
root.render(
|
||||
<SafeAreaInsetsContext.Provider value={statusBarInsets}>
|
||||
<WindowLayoutSurface compact={compact} style={statusBarSurfaceStyle}>
|
||||
<Header />
|
||||
</WindowLayoutSurface>
|
||||
</SafeAreaInsetsContext.Provider>,
|
||||
),
|
||||
);
|
||||
const surface = container.firstElementChild as HTMLElement;
|
||||
const button = container.querySelector("button")!;
|
||||
expect(getComputedStyle(surface).paddingTop).toBe(compact ? "0px" : "24px");
|
||||
expect(getComputedStyle(button).paddingTop).toBe(compact ? "24px" : "0px");
|
||||
if (!compact) {
|
||||
expect(button.getBoundingClientRect().top - surface.getBoundingClientRect().top).toBe(24);
|
||||
const rect = button.getBoundingClientRect();
|
||||
expect(document.elementFromPoint(rect.left + rect.width / 2, rect.top + 1)).toBe(button);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it("paints the reserved division with the sidebar surface", () => {
|
||||
act(() =>
|
||||
root.render(<WindowLayoutDivisionGap layout={layout} sidebarVisible compact={false} />),
|
||||
|
||||
@@ -14,7 +14,7 @@ export { useWindowLayout } from "./context";
|
||||
export { WindowLayoutActions, WindowLayoutActionsHost } from "./actions";
|
||||
export { WindowLayoutSurface, WindowLayoutDivisionGap } from "./surface";
|
||||
export { useTopBand } from "./context";
|
||||
export { WindowSafeArea } from "./window-safe-area";
|
||||
export { WindowSafeArea, useWindowSafeAreaInsets } from "./window-safe-area";
|
||||
export {
|
||||
resolveDesktopDivisionLayout,
|
||||
resolveWorkspaceActionPlacement,
|
||||
|
||||
@@ -6,7 +6,7 @@ export { useWindowLayout } from "./context";
|
||||
export { WindowLayoutActions, WindowLayoutActionsHost } from "./actions";
|
||||
export { WindowLayoutSurface, WindowLayoutDivisionGap } from "./surface";
|
||||
export { useTopBand } from "./context";
|
||||
export { WindowSafeArea } from "./window-safe-area";
|
||||
export { WindowSafeArea, useWindowSafeAreaInsets } from "./window-safe-area";
|
||||
export {
|
||||
resolveDesktopDivisionLayout,
|
||||
resolveWorkspaceActionPlacement,
|
||||
|
||||
@@ -2,10 +2,11 @@ import { useMemo, type ReactNode } from "react";
|
||||
import { View, type StyleProp, type ViewStyle } from "react-native";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
import { isWeb } from "@/constants/platform";
|
||||
import { useWindowLayout } from "./context";
|
||||
import { resolveWorkspaceActionPlacement, type DesktopDivisionLayout } from "./model";
|
||||
|
||||
/** Consume horizontal safe areas once, including compact content beside a vertical bar. */
|
||||
/** Consume safe areas once; compact headers own their top inset. */
|
||||
export function WindowLayoutSurface({
|
||||
children,
|
||||
compact,
|
||||
@@ -17,16 +18,24 @@ export function WindowLayoutSurface({
|
||||
}) {
|
||||
const insets = useSafeAreaInsets();
|
||||
const usesBar = resolveWorkspaceActionPlacement(useWindowLayout()) === "vertical-bar";
|
||||
// Wide browser layouts have no compact header to clear the standalone iOS status bar.
|
||||
// Native window chrome owns its own top band.
|
||||
const consumesTop = isWeb && !compact;
|
||||
const surfaceStyle = useMemo(
|
||||
() => [
|
||||
style,
|
||||
consumesTop && { paddingTop: insets.top },
|
||||
(!compact || usesBar) && { paddingLeft: insets.left, paddingRight: insets.right },
|
||||
],
|
||||
[style, compact, usesBar, insets.left, insets.right],
|
||||
[style, compact, usesBar, consumesTop, insets.top, insets.left, insets.right],
|
||||
);
|
||||
const contentInsets = useMemo(
|
||||
() => (compact && usesBar ? { ...insets, left: 0, right: 0 } : insets),
|
||||
[compact, usesBar, insets],
|
||||
() => ({
|
||||
...insets,
|
||||
...(consumesTop ? { top: 0 } : {}),
|
||||
...(compact && usesBar ? { left: 0, right: 0 } : {}),
|
||||
}),
|
||||
[compact, usesBar, consumesTop, insets],
|
||||
);
|
||||
return (
|
||||
<View style={surfaceStyle}>
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
import { useContext, type ReactNode } from "react";
|
||||
import { SafeAreaInsetsContext } from "react-native-safe-area-context";
|
||||
import { SafeAreaInsetsContext, type EdgeInsets } from "react-native-safe-area-context";
|
||||
import { WindowInsetsContext } from "./context";
|
||||
|
||||
/**
|
||||
* The window's insets, for content that draws against the window instead of the surface it was
|
||||
* rendered in: an overlay over the layout surface, or a panel in a portal host outside it.
|
||||
*/
|
||||
export function useWindowSafeAreaInsets(): EdgeInsets {
|
||||
const insets = useContext(WindowInsetsContext);
|
||||
if (!insets) {
|
||||
throw new Error("useWindowSafeAreaInsets must be used inside WindowLayoutProvider");
|
||||
}
|
||||
return insets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives an overlay that draws over the whole window, such as an RN `Modal`, the window's insets
|
||||
* instead of the ones its call site was given. Read them below it with `useSafeAreaInsets()`.
|
||||
*/
|
||||
export function WindowSafeArea({ children }: { children: ReactNode }) {
|
||||
const insets = useContext(WindowInsetsContext);
|
||||
if (!insets) {
|
||||
throw new Error("WindowSafeArea must render inside WindowLayoutProvider");
|
||||
}
|
||||
const insets = useWindowSafeAreaInsets();
|
||||
return <SafeAreaInsetsContext.Provider value={insets}>{children}</SafeAreaInsetsContext.Provider>;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/cli",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"description": "Paseo CLI - control your AI coding agents from the command line",
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
@@ -29,9 +29,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^1.0.0",
|
||||
"@getpaseo/client": "0.17.6",
|
||||
"@getpaseo/protocol": "0.17.6",
|
||||
"@getpaseo/server": "0.17.6",
|
||||
"@getpaseo/client": "0.18.1",
|
||||
"@getpaseo/protocol": "0.18.1",
|
||||
"@getpaseo/server": "0.18.1",
|
||||
"chalk": "^5.3.0",
|
||||
"commander": "^12.0.0",
|
||||
"mime-types": "^2.1.35",
|
||||
|
||||
@@ -22,6 +22,10 @@ async function port() {
|
||||
return value;
|
||||
}
|
||||
|
||||
// Port zero lets the daemon bind its own port, with no gap for another
|
||||
// process to take a reserved one. Use it when the test needs no fixed port.
|
||||
const ownPort = "127.0.0.1:0";
|
||||
|
||||
async function fixture() {
|
||||
const root = await mkdtemp(path.join(tmpdir(), "paseo lifecycle "));
|
||||
const env = {
|
||||
@@ -201,7 +205,7 @@ test("local status uses the credential and reports the server id of a password-p
|
||||
const f = await fixture();
|
||||
const home = f.homes[0]!;
|
||||
try {
|
||||
await f.configure(home, `127.0.0.1:${await port()}`);
|
||||
await f.configure(home, ownPort);
|
||||
const configPath = path.join(home, "config.json");
|
||||
const config = JSON.parse(await readFile(configPath, "utf8"));
|
||||
config.daemon.auth = { password: await hashDaemonPassword("secret") };
|
||||
@@ -415,7 +419,7 @@ test("empty explicit selectors never select the ambient daemon or create local s
|
||||
const f = await fixture();
|
||||
const home = f.homes[0]!;
|
||||
try {
|
||||
await f.configure(home, `127.0.0.1:${await port()}`);
|
||||
await f.configure(home, ownPort);
|
||||
await f.ok(["start", "--home", home]);
|
||||
const before = await f.liveStatus(home);
|
||||
for (const args of [
|
||||
@@ -489,8 +493,8 @@ test("raw log following subscribes to a stored agent that exists only in B", asy
|
||||
const [a, b] = f.homes as [string, string];
|
||||
let follower: ReturnType<typeof spawn> | undefined;
|
||||
try {
|
||||
await f.configure(a, `127.0.0.1:${await port()}`);
|
||||
await f.configure(b, `127.0.0.1:${await port()}`);
|
||||
await f.configure(a, ownPort);
|
||||
await f.configure(b, ownPort);
|
||||
const agentId = "4de8b157-7614-4c38-b189-e50e57fb9498";
|
||||
const now = new Date().toISOString();
|
||||
await mkdir(path.join(b, "agents"));
|
||||
|
||||
@@ -2,6 +2,11 @@ const { randomUUID } = require("node:crypto");
|
||||
const { appendFileSync } = require("node:fs");
|
||||
const { createInterface } = require("node:readline");
|
||||
|
||||
if (process.argv.slice(2).includes("--version")) {
|
||||
process.stdout.write("1.5.18\n");
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const eventsPath = process.argv[2];
|
||||
const record = (event) => appendFileSync(eventsPath, JSON.stringify(event) + "\n");
|
||||
const modes = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/client",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"description": "Paseo client SDK package",
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
@@ -49,8 +49,8 @@
|
||||
"measure:diff-materialization": "tsx scripts/measure-diff-materialization.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@getpaseo/protocol": "0.17.6",
|
||||
"@getpaseo/relay": "0.17.6",
|
||||
"@getpaseo/protocol": "0.18.1",
|
||||
"@getpaseo/relay": "0.18.1",
|
||||
"ws": "^8.20.0",
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/desktop",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"private": true,
|
||||
"description": "Paseo desktop app (Electron wrapper)",
|
||||
"homepage": "https://paseo.sh",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/expo-two-way-audio",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"description": "Native module for two way audio streaming",
|
||||
"keywords": [
|
||||
"ExpoTwoWayAudio",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/highlight",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
"dist",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/plugin",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"description": "Paseo plugin SDK package",
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
@@ -83,8 +83,8 @@
|
||||
"use-sync-external-store": "^1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@getpaseo/client": "0.17.6",
|
||||
"@getpaseo/protocol": "0.17.6",
|
||||
"@getpaseo/client": "0.18.1",
|
||||
"@getpaseo/protocol": "0.18.1",
|
||||
"@types/node": "^20.9.0",
|
||||
"@types/react": "~19.2.0",
|
||||
"react": "19.2.3",
|
||||
@@ -94,8 +94,8 @@
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@getpaseo/client": "0.17.6",
|
||||
"@getpaseo/protocol": "0.17.6",
|
||||
"@getpaseo/client": "0.18.1",
|
||||
"@getpaseo/protocol": "0.18.1",
|
||||
"react": ">=19.1.0 <20",
|
||||
"react-native": ">=0.81.5",
|
||||
"zod": "^4.4.3"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/protocol",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"description": "Paseo shared protocol schemas and wire types",
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
|
||||
@@ -204,6 +204,16 @@ const MutableStructuredGenerationProviderSchema = z
|
||||
const MutableMetadataGenerationConfigSchema = z
|
||||
.object({
|
||||
providers: z.array(MutableStructuredGenerationProviderSchema).default([]),
|
||||
// COMPAT(metadataGenerationInstructions): added in v0.18.0, keep optional while older daemons omit it.
|
||||
instructions: z.string().optional(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
const MutableMetadataGenerationConfigPatchSchema = z
|
||||
.object({
|
||||
providers: z.array(MutableStructuredGenerationProviderSchema).optional(),
|
||||
// COMPAT(metadataGenerationInstructions): added in v0.18.0, keep optional while older daemons omit it.
|
||||
instructions: z.string().optional(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
@@ -282,7 +292,7 @@ export const MutableDaemonConfigPatchSchema = z
|
||||
.record(z.string(), MutableDaemonProviderConfigSchema.partial().passthrough())
|
||||
.optional(),
|
||||
removeProviders: z.array(z.string().min(1)).optional(),
|
||||
metadataGeneration: MutableMetadataGenerationConfigSchema.partial().optional(),
|
||||
metadataGeneration: MutableMetadataGenerationConfigPatchSchema.optional(),
|
||||
autoArchiveAfterMerge: z.boolean().optional(),
|
||||
enableTerminalAgentHooks: z.boolean().optional(),
|
||||
idleRuntimeCleanup: z.boolean().optional(),
|
||||
@@ -4116,6 +4126,8 @@ export const ServerInfoStatusPayloadSchema = z
|
||||
idleRuntimeCleanupSetting: z.boolean().optional(),
|
||||
// COMPAT(restartRecovery): added in v0.14.0, remove gate after 2027-04-28.
|
||||
resumeOnStartupSetting: z.boolean().optional(),
|
||||
// COMPAT(metadataGenerationInstructions): added in v0.18.0, remove gate after 2027-06-01.
|
||||
metadataGenerationInstructions: z.boolean().optional(),
|
||||
// COMPAT(terminalRestoreModes): added in v0.1.81, remove gate after 2026-11-23.
|
||||
"terminal-restore-modes": z.boolean().optional(),
|
||||
// COMPAT(terminalInputModeReplay): added in v0.2.6, remove gate after 2027-02-02.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-enriched-markdown",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"private": true,
|
||||
"description": "Markdown-based Rich Text solution for React Native",
|
||||
"main": "./lib/module/index",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/relay",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"description": "Paseo relay for bridging daemon and client connections",
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/server",
|
||||
"version": "0.17.6",
|
||||
"version": "0.18.1",
|
||||
"description": "Paseo backend server",
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
@@ -90,7 +90,7 @@
|
||||
"speech:transcribe:local": "tsx scripts/transcribe-local-wav.ts",
|
||||
"test": "npm run test:unit && npm run test:integration",
|
||||
"test:unit": "vitest run --fileParallelism --exclude \"**/*.e2e.test.ts\"",
|
||||
"test:integration": "vitest run --fileParallelism --maxWorkers=3 src/server/git-filename-diffs.e2e.test.ts src/server/daemon-e2e/checkout-diff-content.e2e.test.ts src/server/daemon-e2e/create-agent-mode.e2e.test.ts src/server/daemon-e2e/filesystem.e2e.test.ts src/server/daemon-e2e/file-download.e2e.test.ts src/server/daemon-e2e/cli-logs-follow.e2e.test.ts src/server/creation/creation.e2e.test.ts src/server/daemon-e2e/creation-status.e2e.test.ts src/server/daemon-e2e/persisted-creation-caller.e2e.test.ts src/server/daemon-e2e/terminal-workspace-sdk.e2e.test.ts src/server/daemon-e2e/terminal-worker-lifecycle.e2e.test.ts src/server/workspace-create-worktree-source.e2e.test.ts src/server/daemon-e2e/models.e2e.test.ts src/server/daemon-e2e/live-preferences.e2e.test.ts src/server/daemon-e2e/oversized-message.e2e.test.ts src/server/agent/model-catalog.e2e.test.ts src/server/plugins/plugin-paseo-api.e2e.test.ts src/server/plugins/usage-sources.e2e.test.ts src/server/plugins/lifecycle.e2e.test.ts src/server/plugins/agent-configuration.e2e.test.ts src/server/plugins/worktree-manager.e2e.test.ts src/server/connected-hosts/hosts.e2e.test.ts src/server/owned-subscriptions.e2e.test.ts && vitest run --fileParallelism --maxWorkers=3 src/server/agent/providers/omp/history.e2e.test.ts src/server/daemon-e2e/git-operations.e2e.test.ts src/server/session.create-agent-worktree-autoarchive.e2e.test.ts src/server/agent/providers/opencode-bridge.local.e2e.test.ts src/server/daemon-e2e/relay-transport.e2e.test.ts src/server/agent/agent-mcp.e2e.test.ts src/server/plugins/agent-tools.e2e.test.ts -t \"agent MCP protocol negotiation|merges into|creates a worktree and auto-archives both|versioned runtime|oversized attachments|connected hosts|password-protected daemon refuses|replays selected OMP history|changes the launch wrap\"",
|
||||
"test:integration": "vitest run --fileParallelism --maxWorkers=3 src/server/git-filename-diffs.e2e.test.ts src/server/daemon-e2e/checkout-diff-content.e2e.test.ts src/server/daemon-e2e/create-agent-mode.e2e.test.ts src/server/daemon-e2e/filesystem.e2e.test.ts src/server/daemon-e2e/file-download.e2e.test.ts src/server/daemon-e2e/cli-logs-follow.e2e.test.ts src/server/creation/creation.e2e.test.ts src/server/daemon-e2e/creation-status.e2e.test.ts src/server/daemon-e2e/persisted-creation-caller.e2e.test.ts src/server/daemon-e2e/terminal-workspace-sdk.e2e.test.ts src/server/daemon-e2e/terminal-worker-lifecycle.e2e.test.ts src/server/workspace-create-worktree-source.e2e.test.ts src/server/daemon-e2e/models.e2e.test.ts src/server/daemon-e2e/acp-child-exit-recovery.e2e.test.ts src/server/daemon-e2e/live-preferences.e2e.test.ts src/server/daemon-e2e/oversized-message.e2e.test.ts src/server/agent/model-catalog.e2e.test.ts src/server/plugins/plugin-paseo-api.e2e.test.ts src/server/plugins/usage-sources.e2e.test.ts src/server/plugins/lifecycle.e2e.test.ts src/server/plugins/agent-configuration.e2e.test.ts src/server/plugins/worktree-manager.e2e.test.ts src/server/connected-hosts/hosts.e2e.test.ts src/server/owned-subscriptions.e2e.test.ts && vitest run --fileParallelism --maxWorkers=3 src/server/agent/providers/omp/history.e2e.test.ts src/server/daemon-e2e/git-operations.e2e.test.ts src/server/session.create-agent-worktree-autoarchive.e2e.test.ts src/server/agent/providers/opencode-bridge.local.e2e.test.ts src/server/daemon-e2e/relay-transport.e2e.test.ts src/server/agent/agent-mcp.e2e.test.ts src/server/plugins/agent-tools.e2e.test.ts -t \"agent MCP protocol negotiation|merges into|creates a worktree and auto-archives both|versioned runtime|oversized attachments|connected hosts|password-protected daemon refuses|replays selected OMP history|changes the launch wrap\"",
|
||||
"test:hub-cli-contract": "vitest run --maxWorkers=1 src/server/hub/hub-cli-contract.test.ts",
|
||||
"test:integration:all": "npm run test:e2e",
|
||||
"test:integration:real": "vitest run real.e2e.test.ts",
|
||||
@@ -109,11 +109,11 @@
|
||||
"@agentclientprotocol/sdk": "^0.17.1",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.3.326",
|
||||
"@anthropic-ai/sdk": "^0.104.2",
|
||||
"@getpaseo/client": "0.17.6",
|
||||
"@getpaseo/highlight": "0.17.6",
|
||||
"@getpaseo/plugin": "0.17.6",
|
||||
"@getpaseo/protocol": "0.17.6",
|
||||
"@getpaseo/relay": "0.17.6",
|
||||
"@getpaseo/client": "0.18.1",
|
||||
"@getpaseo/highlight": "0.18.1",
|
||||
"@getpaseo/plugin": "0.18.1",
|
||||
"@getpaseo/protocol": "0.18.1",
|
||||
"@getpaseo/relay": "0.18.1",
|
||||
"@isaacs/ttlcache": "^2.1.4",
|
||||
"@modelcontextprotocol/node": "2.1.2",
|
||||
"@modelcontextprotocol/sdk": "1.29.0",
|
||||
|
||||
@@ -120,6 +120,7 @@ import {
|
||||
resolveDefaultAgentCreateConfig,
|
||||
} from "../create-agent-mode.js";
|
||||
import { importSessionFromPersistence } from "../provider-session-import.js";
|
||||
import { StaleProviderSessionError } from "../stale-provider-session-error.js";
|
||||
import {
|
||||
checkProviderLaunchAvailable,
|
||||
createProviderEnv,
|
||||
@@ -2240,6 +2241,12 @@ export class ACPAgentSession implements AgentSession, ACPClient {
|
||||
this.settleCommandsReady();
|
||||
}
|
||||
|
||||
private canResumeSession(): boolean {
|
||||
return Boolean(
|
||||
this.agentCapabilities?.loadSession || this.agentCapabilities?.sessionCapabilities?.resume,
|
||||
);
|
||||
}
|
||||
|
||||
private async closeAfterInitializationFailure(error: unknown): Promise<never> {
|
||||
try {
|
||||
await this.close();
|
||||
@@ -2280,7 +2287,12 @@ export class ACPAgentSession implements AgentSession, ACPClient {
|
||||
throw new Error(`${this.provider} session is not initialized`);
|
||||
}
|
||||
if (this.connection.signal.aborted) {
|
||||
throw new Error(describeACPDisconnect(this.child));
|
||||
const disconnect = describeACPDisconnect(this.child);
|
||||
// The caller reopens a resumable session from persistence, on a new process.
|
||||
if (this.canResumeSession()) {
|
||||
throw new StaleProviderSessionError(this.sessionId, `after ${disconnect}`);
|
||||
}
|
||||
throw new Error(disconnect);
|
||||
}
|
||||
if (this.activeForegroundTurnId) {
|
||||
throw new Error("A foreground turn is already active");
|
||||
@@ -3323,6 +3335,10 @@ export class ACPAgentSession implements AgentSession, ACPClient {
|
||||
if (this.closed || this.historyRuntimeReleased) {
|
||||
return;
|
||||
}
|
||||
this.logger.warn(
|
||||
{ pid: child.pid, code, signal, idle: !this.activeForegroundTurnId },
|
||||
"ACP agent process exited unexpectedly",
|
||||
);
|
||||
if (this.activeForegroundTurnId) {
|
||||
this.synthesizeCanceledToolCalls();
|
||||
this.finishTurn({
|
||||
|
||||
@@ -981,6 +981,84 @@ describe("OMP agent client and session", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
test("preserves tool intent across live updates and completion", async () => {
|
||||
const omp = new OmpHarness();
|
||||
await omp.start();
|
||||
omp.emit(
|
||||
OmpRuntimeEventSchema.parse({
|
||||
type: "tool_execution_start",
|
||||
toolCallId: "intent-call",
|
||||
toolName: "bash",
|
||||
args: { command: "echo hello" },
|
||||
intent: "Inspect output",
|
||||
}),
|
||||
);
|
||||
omp.emit({
|
||||
type: "tool_execution_update",
|
||||
toolCallId: "intent-call",
|
||||
toolName: "bash",
|
||||
partialResult: { output: "hello" },
|
||||
});
|
||||
omp.emit({
|
||||
type: "tool_execution_end",
|
||||
toolCallId: "intent-call",
|
||||
toolName: "bash",
|
||||
result: { output: "hello" },
|
||||
});
|
||||
expect(omp.timeline().filter((item) => item.type === "tool_call")).toMatchObject([
|
||||
{ status: "running", metadata: { intent: "Inspect output" } },
|
||||
{ status: "running", metadata: { intent: "Inspect output" } },
|
||||
{ status: "completed", metadata: { intent: "Inspect output" } },
|
||||
]);
|
||||
});
|
||||
|
||||
test("does not treat a live tool argument named i as intent", async () => {
|
||||
const omp = new OmpHarness();
|
||||
await omp.start();
|
||||
omp.emit(
|
||||
OmpRuntimeEventSchema.parse({
|
||||
type: "tool_execution_start",
|
||||
toolCallId: "ordinary-i",
|
||||
toolName: "bash",
|
||||
args: { command: "echo hello", i: "ordinary input" },
|
||||
}),
|
||||
);
|
||||
expect(omp.timeline().find((item) => item.type === "tool_call")).not.toHaveProperty("metadata");
|
||||
});
|
||||
|
||||
test.each([
|
||||
{ outcome: "failed", isError: true },
|
||||
{ outcome: "canceled", isError: false },
|
||||
])("keeps tool intent on a $outcome live tool call", async ({ outcome, isError }) => {
|
||||
const omp = new OmpHarness();
|
||||
await omp.start();
|
||||
await omp.startTurn("run it");
|
||||
omp.emit({ type: "agent_start" });
|
||||
omp.emit({
|
||||
type: "tool_execution_start",
|
||||
toolCallId: "intent-call",
|
||||
toolName: "bash",
|
||||
args: { command: "sleep 10" },
|
||||
intent: "Wait for output",
|
||||
});
|
||||
if (isError) {
|
||||
omp.emit({
|
||||
type: "tool_execution_end",
|
||||
toolCallId: "intent-call",
|
||||
toolName: "bash",
|
||||
result: { output: "boom" },
|
||||
isError,
|
||||
});
|
||||
} else {
|
||||
await omp.interrupt();
|
||||
}
|
||||
|
||||
expect(omp.timeline().findLast((item) => item.type === "tool_call")).toMatchObject({
|
||||
status: outcome,
|
||||
metadata: { intent: "Wait for output" },
|
||||
});
|
||||
});
|
||||
|
||||
test("shows a concise error for a failed tool while keeping shell output", async () => {
|
||||
const omp = new OmpHarness();
|
||||
await omp.start();
|
||||
|
||||
@@ -95,6 +95,7 @@ import type {
|
||||
} from "./rpc-types.js";
|
||||
import {
|
||||
parseToolArgs,
|
||||
withOmpToolIntent,
|
||||
parseToolResult,
|
||||
toolFailureMessage,
|
||||
isOmpToolFailure,
|
||||
@@ -1946,7 +1947,7 @@ export class OmpAgentSession implements AgentSession {
|
||||
return;
|
||||
case "tool_execution_start": {
|
||||
this.turnMeter.toolStarted(event.toolCallId, Date.now());
|
||||
const toolCall = parseToolArgs(event.toolName, event.args);
|
||||
const toolCall = parseToolArgs(event.toolName, event.args, event.intent);
|
||||
this.activeToolCalls.set(event.toolCallId, toolCall);
|
||||
this.questionUi.start(event.toolName, event.args);
|
||||
this.emitToolCallEvent(event.toolCallId, toolCall, "running", null, null);
|
||||
@@ -2223,7 +2224,7 @@ export class OmpAgentSession implements AgentSession {
|
||||
type: "timeline",
|
||||
provider: this.provider,
|
||||
turnId,
|
||||
item,
|
||||
item: withOmpToolIntent(item, toolCall),
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -62,6 +62,70 @@ describe("OMP history mapper", () => {
|
||||
);
|
||||
});
|
||||
|
||||
test("replays stored intent on historical tool starts and results", async () => {
|
||||
const events = await collectHistory([
|
||||
{
|
||||
role: "assistant",
|
||||
content: [
|
||||
{
|
||||
type: "toolCall",
|
||||
id: "intent-1",
|
||||
name: "read",
|
||||
arguments: { path: "file", i: "Inspect file." },
|
||||
intent: "Inspect file",
|
||||
},
|
||||
{
|
||||
type: "toolCall",
|
||||
id: "intent-2",
|
||||
name: "bash",
|
||||
arguments: { command: "false" },
|
||||
intent: "Check failure",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
role: "toolResult",
|
||||
toolCallId: "intent-1",
|
||||
toolName: "read",
|
||||
content: [{ type: "text", text: "contents" }],
|
||||
},
|
||||
{
|
||||
role: "toolResult",
|
||||
toolCallId: "intent-2",
|
||||
toolName: "bash",
|
||||
content: [{ type: "text", text: "failed" }],
|
||||
isError: true,
|
||||
},
|
||||
]);
|
||||
expect(events.map((event) => event.item)).toMatchObject([
|
||||
{ callId: "intent-1", status: "running", metadata: { intent: "Inspect file" } },
|
||||
{ callId: "intent-2", status: "running", metadata: { intent: "Check failure" } },
|
||||
{ callId: "intent-1", status: "completed", metadata: { intent: "Inspect file" } },
|
||||
{ callId: "intent-2", status: "failed", metadata: { intent: "Check failure" } },
|
||||
]);
|
||||
});
|
||||
|
||||
test("does not replay a tool argument named i as intent", async () => {
|
||||
const events = await collectHistory([
|
||||
{
|
||||
role: "assistant",
|
||||
content: [
|
||||
{ type: "toolCall", id: "own-i", name: "search", arguments: { i: "ordinary input" } },
|
||||
],
|
||||
},
|
||||
{
|
||||
role: "toolResult",
|
||||
toolCallId: "own-i",
|
||||
toolName: "search",
|
||||
content: [{ type: "text", text: "found" }],
|
||||
},
|
||||
]);
|
||||
expect(events).toHaveLength(2);
|
||||
for (const event of events) {
|
||||
expect(event.item).not.toHaveProperty("metadata");
|
||||
}
|
||||
});
|
||||
|
||||
test("replays a web search details error as failed when OMP sets isError false", async () => {
|
||||
const events = await collectHistory([
|
||||
{
|
||||
@@ -162,6 +226,61 @@ describe("OMP history mapper", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("ignores non-string persisted tool intents during journal replay", async () => {
|
||||
const dir = await mkdtemp(join(tmpdir(), "omp-intent-history-"));
|
||||
try {
|
||||
const sessionFile = join(dir, "session.jsonl");
|
||||
await writeFile(
|
||||
sessionFile,
|
||||
[
|
||||
{ type: "session", id: "root" },
|
||||
{
|
||||
type: "message",
|
||||
id: "assistant",
|
||||
parentId: "root",
|
||||
message: {
|
||||
role: "assistant",
|
||||
content: [
|
||||
{
|
||||
type: "toolCall",
|
||||
id: "valid",
|
||||
name: "read",
|
||||
arguments: { path: "file" },
|
||||
intent: "Read file",
|
||||
},
|
||||
{
|
||||
type: "toolCall",
|
||||
id: "number",
|
||||
name: "read",
|
||||
arguments: { path: "file" },
|
||||
intent: 42,
|
||||
},
|
||||
{
|
||||
type: "toolCall",
|
||||
id: "object",
|
||||
name: "read",
|
||||
arguments: { path: "file" },
|
||||
intent: { text: "invalid" },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
.map((entry) => JSON.stringify(entry))
|
||||
.join("\n"),
|
||||
);
|
||||
const items: AgentStreamEvent["item"][] = [];
|
||||
for await (const event of streamOmpHistory({ sessionFile, provider: "omp" }))
|
||||
items.push(event.item);
|
||||
expect(items).toHaveLength(3);
|
||||
expect(items[0]).toMatchObject({ callId: "valid", metadata: { intent: "Read file" } });
|
||||
expect(items[1]).not.toHaveProperty("metadata");
|
||||
expect(items[2]).not.toHaveProperty("metadata");
|
||||
} finally {
|
||||
await rm(dir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("restores blocked and abandoned todo state from a session file", async () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), "omp-todo-state-history-"));
|
||||
const sessionFile = join(dir, "session.jsonl");
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { mapCustomMessageToToolCall } from "../custom-message.js";
|
||||
import type { AgentStreamEvent, AgentTimelineItem, ToolCallDetail } from "../../agent-sdk-types.js";
|
||||
import type {
|
||||
AgentStreamEvent,
|
||||
ToolCallDetail,
|
||||
ToolCallTimelineItem,
|
||||
} from "../../agent-sdk-types.js";
|
||||
import type { OmpAgentMessage, OmpImageContent, OmpTextContent } from "./rpc-types.js";
|
||||
import type { OmpBridgedToolIdentity } from "./mcp-bridge.js";
|
||||
import {
|
||||
@@ -14,6 +18,7 @@ import {
|
||||
resolveToolCallName,
|
||||
toolFailureMessage,
|
||||
isOmpToolFailure,
|
||||
withOmpToolIntent,
|
||||
type OmpToolResult,
|
||||
type OmpTrackedToolCall,
|
||||
} from "./tool-call-detail.js";
|
||||
@@ -186,7 +191,7 @@ export class OmpHistoryMapper {
|
||||
continue;
|
||||
}
|
||||
if (content.type === "toolCall") {
|
||||
const tracked = parseToolArgs(content.name, content.arguments);
|
||||
const tracked = parseToolArgs(content.name, content.arguments, content.intent);
|
||||
this.pendingToolCalls.set(content.id, tracked);
|
||||
const detail = this.mapToolDetail(content.id, tracked, null);
|
||||
if (!detail) {
|
||||
@@ -195,14 +200,17 @@ export class OmpHistoryMapper {
|
||||
events.push({
|
||||
type: "timeline",
|
||||
provider: this.provider,
|
||||
item: {
|
||||
type: "tool_call",
|
||||
callId: this.resolveToolCallId(content.id, tracked),
|
||||
name: this.toolName(tracked, null),
|
||||
status: "running",
|
||||
detail,
|
||||
error: null,
|
||||
},
|
||||
item: withOmpToolIntent(
|
||||
{
|
||||
type: "tool_call",
|
||||
callId: this.resolveToolCallId(content.id, tracked),
|
||||
name: this.toolName(tracked, null),
|
||||
status: "running",
|
||||
detail,
|
||||
error: null,
|
||||
},
|
||||
tracked,
|
||||
),
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -223,13 +231,16 @@ export class OmpHistoryMapper {
|
||||
return {
|
||||
type: "timeline",
|
||||
provider: this.provider,
|
||||
item: toToolResultTimelineItem({
|
||||
callId: this.resolveToolCallId(message.toolCallId, tracked),
|
||||
name: this.toolName(tracked, result),
|
||||
isError: isOmpToolFailure(tracked, result, Boolean(message.isError)),
|
||||
detail,
|
||||
errorText: toolFailureMessage(result),
|
||||
}),
|
||||
item: withOmpToolIntent(
|
||||
toToolResultTimelineItem({
|
||||
callId: this.resolveToolCallId(message.toolCallId, tracked),
|
||||
name: this.toolName(tracked, result),
|
||||
isError: isOmpToolFailure(tracked, result, Boolean(message.isError)),
|
||||
detail,
|
||||
errorText: toolFailureMessage(result),
|
||||
}),
|
||||
tracked,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -300,7 +311,7 @@ function toToolResultTimelineItem(input: {
|
||||
isError: boolean;
|
||||
detail: ToolCallDetail;
|
||||
errorText: string;
|
||||
}): AgentTimelineItem {
|
||||
}): ToolCallTimelineItem {
|
||||
if (input.isError) {
|
||||
return {
|
||||
type: "tool_call",
|
||||
|
||||
@@ -26,6 +26,7 @@ export const OmpToolCallContentSchema = z
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
arguments: z.unknown(),
|
||||
intent: z.string().optional(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
@@ -323,6 +324,7 @@ export const OmpAgentSessionEventSchema = z.discriminatedUnion("type", [
|
||||
toolCallId: z.string(),
|
||||
toolName: z.string(),
|
||||
args: z.unknown(),
|
||||
intent: z.string().optional(),
|
||||
})
|
||||
.passthrough(),
|
||||
z
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import type { ToolCallDetail } from "../../agent-sdk-types.js";
|
||||
import type { ToolCallDetail, ToolCallTimelineItem } from "../../agent-sdk-types.js";
|
||||
import { omitNullArgs } from "../tool-call-args.js";
|
||||
|
||||
interface BashToolInput {
|
||||
@@ -129,7 +129,7 @@ interface OmpUnknownToolCall {
|
||||
args: unknown;
|
||||
}
|
||||
|
||||
export type OmpTrackedToolCall =
|
||||
export type OmpTrackedToolCall = (
|
||||
| OmpBashToolCall
|
||||
| OmpReadToolCall
|
||||
| OmpEditToolCall
|
||||
@@ -137,7 +137,8 @@ export type OmpTrackedToolCall =
|
||||
| OmpFindToolCall
|
||||
| OmpGrepToolCall
|
||||
| OmpLsToolCall
|
||||
| OmpUnknownToolCall;
|
||||
| OmpUnknownToolCall
|
||||
) & { intent?: string };
|
||||
|
||||
interface ToolCallOutputSummary {
|
||||
output?: string;
|
||||
@@ -319,7 +320,29 @@ export function isOmpToolFailure(
|
||||
);
|
||||
}
|
||||
|
||||
export function parseToolArgs(toolName: string, rawArgs: unknown): OmpTrackedToolCall {
|
||||
/**
|
||||
* `intent` is the harness-level value OMP reports beside the arguments. Never derive it from
|
||||
* `rawArgs.i`: OMP copies its own `i` into `intent`, and any other `i` belongs to the tool.
|
||||
*/
|
||||
export function parseToolArgs(
|
||||
toolName: string,
|
||||
rawArgs: unknown,
|
||||
intent?: unknown,
|
||||
): OmpTrackedToolCall {
|
||||
const toolCall = parseToolArgsByName(toolName, rawArgs);
|
||||
// Replayed session files are unvalidated, so a non-string intent is dropped here.
|
||||
return typeof intent === "string" ? { ...toolCall, intent } : toolCall;
|
||||
}
|
||||
|
||||
export function withOmpToolIntent(
|
||||
item: ToolCallTimelineItem,
|
||||
toolCall: OmpTrackedToolCall,
|
||||
): ToolCallTimelineItem {
|
||||
if (toolCall.intent === undefined) return item;
|
||||
return { ...item, metadata: { ...item.metadata, intent: toolCall.intent } };
|
||||
}
|
||||
|
||||
function parseToolArgsByName(toolName: string, rawArgs: unknown): OmpTrackedToolCall {
|
||||
if (toolName === "edit") {
|
||||
return parseEditToolArgs(rawArgs);
|
||||
}
|
||||
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterEach, beforeEach, expect, test } from "vitest";
|
||||
|
||||
import { createTestLogger } from "../../../test-utils/test-logger.js";
|
||||
import type { AgentSession } from "../agent-sdk-types.js";
|
||||
import { OpenCodeV2AgentClient } from "./opencode/v2/agent.js";
|
||||
import {
|
||||
OPENCODE_V2_COMMAND,
|
||||
SCRIPTED_MODEL,
|
||||
ScriptedOpenCodeService,
|
||||
scriptedCall,
|
||||
} from "./opencode/test-utils/v2-scripted-server.js";
|
||||
|
||||
interface Fixture {
|
||||
root: string;
|
||||
service: ScriptedOpenCodeService;
|
||||
client: OpenCodeV2AgentClient;
|
||||
}
|
||||
|
||||
let fixture: Fixture | undefined;
|
||||
|
||||
beforeEach(async () => {
|
||||
const root = await mkdtemp(path.join(os.tmpdir(), "paseo-opencode-v2-pending-approval-"));
|
||||
const service = await ScriptedOpenCodeService.start();
|
||||
const client = new OpenCodeV2AgentClient({
|
||||
logger: createTestLogger(),
|
||||
settings: {
|
||||
command: { mode: "replace", argv: [OPENCODE_V2_COMMAND] },
|
||||
env: service.ownedEnvironment,
|
||||
},
|
||||
});
|
||||
fixture = { root, service, client };
|
||||
}, 60_000);
|
||||
|
||||
afterEach(async () => {
|
||||
if (!fixture) return;
|
||||
await fixture.client.shutdown();
|
||||
await fixture.service.stop();
|
||||
await rm(fixture.root, { recursive: true, force: true });
|
||||
fixture = undefined;
|
||||
}, 60_000);
|
||||
|
||||
/** Starts a shell call that OpenCode holds for approval, and waits until Paseo lists it. */
|
||||
async function startApprovalTurn(): Promise<{
|
||||
session: AgentSession;
|
||||
turnId: string;
|
||||
requestId: string;
|
||||
}> {
|
||||
const project = path.join(fixture!.root, "project");
|
||||
await mkdir(project, { recursive: true });
|
||||
const session = await fixture!.client.createSession(
|
||||
{
|
||||
provider: "opencode",
|
||||
cwd: project,
|
||||
model: SCRIPTED_MODEL,
|
||||
providerOptions: { permission: { bash: "ask" } },
|
||||
},
|
||||
undefined,
|
||||
{ persistSession: false },
|
||||
);
|
||||
const { turnId } = await session.startTurn(
|
||||
scriptedCall("shell", { command: "printf PASEO_PROBE", description: "Probe" }),
|
||||
);
|
||||
await expect.poll(() => session.getPendingPermissions().length, { timeout: 30_000 }).toBe(1);
|
||||
return { session, turnId, requestId: session.getPendingPermissions()[0].id };
|
||||
}
|
||||
|
||||
test("a message sent while an approval is open clears the approval", async () => {
|
||||
const { session, turnId } = await startApprovalTurn();
|
||||
await expect(
|
||||
session.steerActiveTurn!("Never mind, reply OK.", {
|
||||
expectedTurnId: turnId,
|
||||
clearPendingPermissions: true,
|
||||
}),
|
||||
).resolves.toEqual({ status: "accepted" });
|
||||
expect(session.getPendingPermissions()).toEqual([]);
|
||||
}, 120_000);
|
||||
|
||||
// OpenCode drops the approval of an interrupted tool call without a reply event.
|
||||
test("stopping while an approval is open clears the approval", async () => {
|
||||
const { session, requestId } = await startApprovalTurn();
|
||||
await session.interrupt();
|
||||
await expect.poll(() => session.getPendingPermissions(), { timeout: 10_000 }).toEqual([]);
|
||||
// A client that still shows the card can answer it without an error.
|
||||
await expect(session.respondToPermission(requestId, { behavior: "deny" })).resolves.toBe(
|
||||
undefined,
|
||||
);
|
||||
}, 120_000);
|
||||
@@ -14,3 +14,9 @@ export class OpenCodeHttpError extends Error {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/** True when OpenCode answered 404, directly or as the cause of the client's transport error. */
|
||||
export function isOpenCodeNotFound(error: unknown): boolean {
|
||||
const failure = error instanceof OpenCodeHttpError ? error : (error as Error | null)?.cause;
|
||||
return failure instanceof OpenCodeHttpError && failure.status === 404;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user