mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-17 14:52:36 +00:00
Compare commits
26
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd25057bbb | ||
|
|
ed53a71939 | ||
|
|
84c0239448 | ||
|
|
5d6a6bda1f | ||
|
|
cb86d02bd0 | ||
|
|
7595325095 | ||
|
|
f1b097a563 | ||
|
|
76804cba66 | ||
|
|
ab10a6694c | ||
|
|
2a151a4494 | ||
|
|
9fcae41c98 | ||
|
|
b352dad2e3 | ||
|
|
1ae979d3d0 | ||
|
|
d46164ce0d | ||
|
|
a591320409 | ||
|
|
ee6deda079 | ||
|
|
0555c877d0 | ||
|
|
b6454d7ea4 | ||
|
|
1b88f16124 | ||
|
|
1fae8e89f7 | ||
|
|
22488d4502 | ||
|
|
2a5264c188 | ||
|
|
8ddeb79c8d | ||
|
|
c90587e5b7 | ||
|
|
56f4fca9e4 | ||
|
|
28f7528588 |
@@ -93,3 +93,6 @@ app.json
|
||||
|
||||
# Heap snapshots dumped by --heapsnapshot-near-heap-limit; keep them for debugging.
|
||||
*.heapsnapshot
|
||||
|
||||
# Project-local Serena configuration and memories.
|
||||
.serena/
|
||||
|
||||
+69
-8
@@ -1,12 +1,49 @@
|
||||
# Changelog
|
||||
|
||||
## 0.11.0-beta.5 - 2026-10-06
|
||||
## 0.11.3 - 2026-10-15
|
||||
|
||||
### Added
|
||||
|
||||
- Added Hoplite as an opt-in provider in the ACP provider catalog ([#6953](https://github.com/getpaseo/paseo/pull/6953) by [@odinglyn0](https://github.com/odinglyn0))
|
||||
- Added search to the Add provider catalog ([#6953](https://github.com/getpaseo/paseo/pull/6953), [#7030](https://github.com/getpaseo/paseo/pull/7030))
|
||||
|
||||
### Changed
|
||||
|
||||
- Changed Add provider failures to show as a toast ([#7030](https://github.com/getpaseo/paseo/pull/7030))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed Remove being offered for plugin providers such as Antigravity and Muse Code ([#6568](https://github.com/getpaseo/paseo/pull/6568) by [@Ctrl-Creeper](https://github.com/Ctrl-Creeper))
|
||||
|
||||
## 0.11.2 - 2026-10-09
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed intermittent text clipping in iOS chats and Markdown previews ([#6445](https://github.com/getpaseo/paseo/pull/6445))
|
||||
|
||||
## 0.11.1 - 2026-10-07
|
||||
|
||||
### Added
|
||||
|
||||
- Added Claude Haiku 5.5 for Claude Code 2.1.293 and newer ([#6332](https://github.com/getpaseo/paseo/pull/6332))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed Claude tool calls that run longer than 30 seconds, such as WebFetch or MCP tools, showing up as subagents ([#6308](https://github.com/getpaseo/paseo/pull/6308))
|
||||
- Fixed subagents that finish while the app is disconnected staying "working" until one is opened ([#6316](https://github.com/getpaseo/paseo/pull/6316))
|
||||
- Fixed a Claude agent's history showing "No activity to display" after a daemon restart when its transcript is in another project folder, such as after moving the daemon or running Windows Claude Code from WSL ([#6301](https://github.com/getpaseo/paseo/pull/6301))
|
||||
|
||||
## 0.11.0 - 2026-10-07
|
||||
|
||||
Paseo 0.11 adds support for the [plugin registry](https://paseo.sh/plugins). Browse community plugins there, install one with `paseo plugin add owner/slug`, or [submit your own](https://paseo.sh/docs/plugins/publishing#plugin-registry).
|
||||
|
||||
**Before upgrading:** `paseo plugin add owner/repo` now installs from the registry, so use `github:owner/repo` to install straight from GitHub and `./path` for a local directory.
|
||||
|
||||
### Added
|
||||
|
||||
- Added Muse Code as a provider, with model, approval mode, and reasoning effort controls ([#5719](https://github.com/getpaseo/paseo/pull/5719), [#5775](https://github.com/getpaseo/paseo/pull/5775) by [@millerben95](https://github.com/millerben95))
|
||||
- Added Antigravity as a provider that drives the installed `agy` CLI, always in Full access ([#5714](https://github.com/getpaseo/paseo/pull/5714), [#5795](https://github.com/getpaseo/paseo/pull/5795))
|
||||
- Added a Usage screen, opened from the sidebar footer, showing each subscription account's quota windows with Refresh ([#5465](https://github.com/getpaseo/paseo/pull/5465), [#5685](https://github.com/getpaseo/paseo/pull/5685), [#5786](https://github.com/getpaseo/paseo/pull/5786), [#5805](https://github.com/getpaseo/paseo/pull/5805), [#5921](https://github.com/getpaseo/paseo/pull/5921))
|
||||
- Added Usage, opened from the sidebar footer as a dialog on desktop and a sheet on mobile, showing each subscription account's quota windows with Refresh ([#5465](https://github.com/getpaseo/paseo/pull/5465), [#5685](https://github.com/getpaseo/paseo/pull/5685), [#5786](https://github.com/getpaseo/paseo/pull/5786), [#5805](https://github.com/getpaseo/paseo/pull/5805), [#5921](https://github.com/getpaseo/paseo/pull/5921), [#6216](https://github.com/getpaseo/paseo/pull/6216))
|
||||
- Added an opt-in Usage summary to the sidebar footer that shows the windows you pin ([#5903](https://github.com/getpaseo/paseo/pull/5903), [#5975](https://github.com/getpaseo/paseo/pull/5975), [#6089](https://github.com/getpaseo/paseo/pull/6089))
|
||||
- Added Usage discovery of ChatGPT logins from Codex CLI, OpenCode, Pi, and OMP ([#5844](https://github.com/getpaseo/paseo/pull/5844))
|
||||
- Added Usage discovery of Claude logins from the Claude Code credential file, the macOS keychain, Pi, and OMP ([#5844](https://github.com/getpaseo/paseo/pull/5844))
|
||||
@@ -16,21 +53,26 @@
|
||||
- Added Fast mode and an Auto thinking level to OMP ([#5550](https://github.com/getpaseo/paseo/pull/5550) by [@n24q02m](https://github.com/n24q02m), [@abhi-wan-kenobi](https://github.com/abhi-wan-kenobi))
|
||||
- Added MCP servers to OMP schedules and Hub runs ([#5550](https://github.com/getpaseo/paseo/pull/5550) by [@omercnet](https://github.com/omercnet))
|
||||
- Added a Content width setting for the maximum width of chat and Markdown files on wide screens ([#5680](https://github.com/getpaseo/paseo/pull/5680))
|
||||
- Added syntax highlighting for Vue files ([#6205](https://github.com/getpaseo/paseo/pull/6205) by [@Davnn1](https://github.com/Davnn1))
|
||||
- Added `agents.providers.<id>.options` in `config.json` as default options for every provider, with per-agent overrides ([#5780](https://github.com/getpaseo/paseo/pull/5780))
|
||||
- Added the terminal key bar and Paste to terminal panes on iPad and Android tablets ([#5712](https://github.com/getpaseo/paseo/pull/5712) by [@lardissone](https://github.com/lardissone))
|
||||
- Added screens and sidebar header and footer items to the plugin SDK ([#5685](https://github.com/getpaseo/paseo/pull/5685))
|
||||
|
||||
### Plugins
|
||||
|
||||
- Changed `paseo plugin add owner/slug` to install the reviewed plugin from the plugin registry, so local directories need a path such as `./slug` and direct GitHub installs need `github:owner/repo` ([#6224](https://github.com/getpaseo/paseo/pull/6224))
|
||||
- Added [screens and sidebar header and footer items](https://paseo.sh/docs/plugins/reference#screens-and-sidebar-items) to the plugin SDK ([#5685](https://github.com/getpaseo/paseo/pull/5685))
|
||||
- Added usage sources to the plugin SDK ([#5465](https://github.com/getpaseo/paseo/pull/5465), [#5876](https://github.com/getpaseo/paseo/pull/5876))
|
||||
- Added `spawnProcess()`, `execCommand()`, and `terminateProcess()` to the plugin SDK for launching CLIs, including Windows `.cmd` and `.bat` scripts ([#6151](https://github.com/getpaseo/paseo/pull/6151))
|
||||
- Added `client.playAudio()` to the plugin SDK for playing audio on every client ([#5976](https://github.com/getpaseo/paseo/pull/5976))
|
||||
- Added an `agent.closed` plugin lifecycle event ([#5971](https://github.com/getpaseo/paseo/pull/5971) by [@ilteoood](https://github.com/ilteoood))
|
||||
- Added command and environment overrides and availability diagnostics for plugin providers ([#5707](https://github.com/getpaseo/paseo/pull/5707))
|
||||
- Added a display name, icon, screenshots, and videos to the plugin manifest ([#6263](https://github.com/getpaseo/paseo/pull/6263))
|
||||
- Added an `OVERVIEW.md` template to `paseo plugin init` for plugin registry listings ([#6226](https://github.com/getpaseo/paseo/pull/6226))
|
||||
|
||||
### Changed
|
||||
|
||||
- Enabled the plugin registry by default: `paseo plugin add owner/slug` installs a reviewed artifact even when a local directory matches; use explicit local paths (including `.`, `..`, and Windows drive or UNC paths), and use `github:owner/repository` for direct GitHub installs. Registry connection, missing-ID, and `--ref` errors include recovery steps.
|
||||
|
||||
- Changed the context window details to show usage for the account the agent runs under, including custom `CLAUDE_CONFIG_DIR` and `CODEX_HOME` homes ([#5465](https://github.com/getpaseo/paseo/pull/5465))
|
||||
- Changed the context window details on desktop to a hover card with Refresh ([#5975](https://github.com/getpaseo/paseo/pull/5975))
|
||||
- Changed the context window details on desktop to a hover card with Refresh ([#5975](https://github.com/getpaseo/paseo/pull/5975), [#6185](https://github.com/getpaseo/paseo/pull/6185))
|
||||
- Changed the context window meter to show before an agent's first turn ([#6089](https://github.com/getpaseo/paseo/pull/6089))
|
||||
- Changed Codex Fast to a Speed menu listing the Normal, Fast, and Ultrafast speeds each model offers, shown as a lightning bolt on desktop that turns yellow while Fast or Ultrafast is selected ([#5708](https://github.com/getpaseo/paseo/pull/5708), [#6152](https://github.com/getpaseo/paseo/pull/6152) by [@Nurshot](https://github.com/Nurshot))
|
||||
- Changed Explorer tabs to work like workspace tabs, with a + menu, drag and drop, and Close for Files and Changes ([#5942](https://github.com/getpaseo/paseo/pull/5942))
|
||||
@@ -46,12 +88,18 @@
|
||||
### Fixed
|
||||
|
||||
- Fixed Claude agents never showing Thought rows on Claude Opus 4.7 and later ([#4355](https://github.com/getpaseo/paseo/pull/4355) by [@ThePharmer](https://github.com/ThePharmer))
|
||||
- Fixed a background Claude subagent's card showing as a bare "Task" that stayed running, or as "Agent" after a daemon restart ([#6067](https://github.com/getpaseo/paseo/pull/6067), [#6100](https://github.com/getpaseo/paseo/pull/6100))
|
||||
- Fixed a Claude agent showing as running while only its background helpers worked, and a send or Stop killing those helpers ([#6295](https://github.com/getpaseo/paseo/pull/6295) by [@IsakPersson](https://github.com/IsakPersson))
|
||||
- Fixed a Claude agent in Auto mode failing to switch modes when Claude Code uses Bedrock or Vertex ([#6272](https://github.com/getpaseo/paseo/pull/6272))
|
||||
- Fixed a Claude subagent's auto-mode report showing as a raw SubagentHandback tool card instead of markdown ([#6248](https://github.com/getpaseo/paseo/pull/6248))
|
||||
- Fixed background Claude subagent cards showing as a bare "Task" that stayed running, as "Agent" after a daemon restart, or unlabeled when two launch together ([#6067](https://github.com/getpaseo/paseo/pull/6067), [#6100](https://github.com/getpaseo/paseo/pull/6100), [#6268](https://github.com/getpaseo/paseo/pull/6268))
|
||||
- Fixed Claude Code terminals not showing as needing input when Claude is idle ([#6022](https://github.com/getpaseo/paseo/pull/6022))
|
||||
- Fixed Claude usage calling a rate-limited login again before its retry time ([#6089](https://github.com/getpaseo/paseo/pull/6089))
|
||||
- Fixed a Claude agent that entered plan mode on its own still showing and storing its previous mode ([#6074](https://github.com/getpaseo/paseo/pull/6074))
|
||||
- Fixed a resumed agent returning to its creation-time mode after its mode was changed in the session ([#5140](https://github.com/getpaseo/paseo/pull/5140) by [@ThePlenkov](https://github.com/ThePlenkov))
|
||||
- Fixed ACP plugin providers failing to launch a `.cmd` or `.bat` CLI on Windows ([#6151](https://github.com/getpaseo/paseo/pull/6151))
|
||||
- Fixed ACP agents running on their default model when the configured model is one the agent does not advertise ([#6273](https://github.com/getpaseo/paseo/pull/6273))
|
||||
- Fixed archiving an ACP agent leaving its provider running when the provider never answers close ([#6213](https://github.com/getpaseo/paseo/pull/6213) by [@apple-ouyang](https://github.com/apple-ouyang))
|
||||
- Fixed an archived ACP agent showing an empty chat after its worktree was removed ([#6228](https://github.com/getpaseo/paseo/pull/6228))
|
||||
- Fixed ACP agents rejecting every following message after a turn failed with a permission request open ([#6045](https://github.com/getpaseo/paseo/pull/6045))
|
||||
- Fixed the context window meter never appearing for ACP agents that report context usage ([#4848](https://github.com/getpaseo/paseo/pull/4848) by [@apple-ouyang](https://github.com/apple-ouyang))
|
||||
- Fixed schedule runs and workspace metadata recording `[object Object]` when an ACP agent rejects a session setting ([#5765](https://github.com/getpaseo/paseo/pull/5765))
|
||||
@@ -66,12 +114,14 @@
|
||||
- Fixed opening an archived OMP agent starting an `omp` process that stayed running ([#5550](https://github.com/getpaseo/paseo/pull/5550) by [@thomasvan](https://github.com/thomasvan))
|
||||
- Fixed an OMP turn staying running forever when the run contains a message Paseo does not show, such as an OMP rule reminder ([#6112](https://github.com/getpaseo/paseo/pull/6112))
|
||||
- Fixed a prompt OMP rejects, such as for a missing API key, ending as a completed turn with no error ([#6110](https://github.com/getpaseo/paseo/pull/6110), [#6115](https://github.com/getpaseo/paseo/pull/6115))
|
||||
- Fixed reopened OMP chats showing "Custom message" rows for compactions and other entries OMP writes on its own ([#6198](https://github.com/getpaseo/paseo/pull/6198), [#6215](https://github.com/getpaseo/paseo/pull/6215))
|
||||
- Fixed Pi and OMP sessions whose model was removed failing to import or reopen ([#6061](https://github.com/getpaseo/paseo/pull/6061))
|
||||
- Fixed Pi agents on Pi 0.99 starting without Paseo's MCP servers when `pi-mcp-adapter` is not installed ([#5762](https://github.com/getpaseo/paseo/pull/5762) by [@ArietidsZ](https://github.com/ArietidsZ))
|
||||
- Fixed a running Pi subagent showing an empty transcript until it finished ([#5755](https://github.com/getpaseo/paseo/pull/5755))
|
||||
- Fixed a grouped Tintinweb pi-subagents completion marking only its first agent completed and leaving the rest on working ([#5826](https://github.com/getpaseo/paseo/pull/5826))
|
||||
- Fixed OpenCode `ask` rules for `paseo_*` tools running the tool without a prompt ([#5801](https://github.com/getpaseo/paseo/pull/5801) by [@ymarcus93](https://github.com/ymarcus93))
|
||||
- Fixed the first OpenCode prompt waiting for the event stream timeout when the OpenCode server was slow to become ready ([#5873](https://github.com/getpaseo/paseo/pull/5873) by [@axsuul](https://github.com/axsuul))
|
||||
- Fixed OpenCode v2 agents staying running after a question is dismissed or a tool permission is denied ([#6177](https://github.com/getpaseo/paseo/pull/6177), [#6188](https://github.com/getpaseo/paseo/pull/6188))
|
||||
- Fixed the Nix packages failing to start the daemon and to open terminals ([#5523](https://github.com/getpaseo/paseo/pull/5523) by [@wongcallum](https://github.com/wongcallum))
|
||||
- Fixed OpenCode v2 agents failing to start on the Nix packages ([#5988](https://github.com/getpaseo/paseo/pull/5988))
|
||||
- Fixed each Paseo skill appearing twice in Codex's skill list ([#5827](https://github.com/getpaseo/paseo/pull/5827) by [@3ae3ae](https://github.com/3ae3ae))
|
||||
@@ -85,12 +135,18 @@
|
||||
- Fixed Codex terminal rows reading only "Terminal" without the command on current Codex ([#5774](https://github.com/getpaseo/paseo/pull/5774))
|
||||
- Fixed the composer showing the catalog default thinking level instead of the one the agent runs on ([#5804](https://github.com/getpaseo/paseo/pull/5804))
|
||||
- Fixed the composer showing another model's label when the agent's model is missing from the loaded catalog ([#5796](https://github.com/getpaseo/paseo/pull/5796))
|
||||
- Fixed the chat jumping back by several screens when scrolling up through older history on web and desktop ([#5945](https://github.com/getpaseo/paseo/pull/5945), [#5970](https://github.com/getpaseo/paseo/pull/5970))
|
||||
- Fixed the chat jumping back by several screens when scrolling up through older history on web and desktop ([#5945](https://github.com/getpaseo/paseo/pull/5945), [#5970](https://github.com/getpaseo/paseo/pull/5970), [#6172](https://github.com/getpaseo/paseo/pull/6172))
|
||||
- Fixed images in chat shifting the text below them when they finish loading ([#5970](https://github.com/getpaseo/paseo/pull/5970))
|
||||
- Fixed copying all the code in a chat code block sometimes including its ``` fence lines ([#6138](https://github.com/getpaseo/paseo/pull/6138))
|
||||
- Fixed copying across a code block nested in a numbered list item renumbering the next item ([#6158](https://github.com/getpaseo/paseo/pull/6158))
|
||||
- Fixed copying a chat selection across an image losing its alt text and source, or including the image when the selection started below it ([#6181](https://github.com/getpaseo/paseo/pull/6181), [#6195](https://github.com/getpaseo/paseo/pull/6195))
|
||||
- Fixed relative `path:line` file links in chat opening at the first line referenced for that file ([#5653](https://github.com/getpaseo/paseo/pull/5653) by [@3ae3ae](https://github.com/3ae3ae))
|
||||
- Fixed PR comments with linked pictures showing raw HTML tags and losing the image link ([#5968](https://github.com/getpaseo/paseo/pull/5968))
|
||||
- Fixed text typed by the browser tool appearing in your message box instead of the browser tab ([#6207](https://github.com/getpaseo/paseo/pull/6207))
|
||||
- Fixed Astro expressions losing their colors after a nested template string ([#6219](https://github.com/getpaseo/paseo/pull/6219))
|
||||
- Fixed downloading files whose names contain non-ASCII characters ([#6278](https://github.com/getpaseo/paseo/pull/6278), [#6281](https://github.com/getpaseo/paseo/pull/6281) by [@dillonzq](https://github.com/dillonzq), [@jasonhnd](https://github.com/jasonhnd))
|
||||
- Fixed the PR panel, sidebar workspace status, and "Worked for" line showing English in other app languages ([#6196](https://github.com/getpaseo/paseo/pull/6196), [#6208](https://github.com/getpaseo/paseo/pull/6208), [#6225](https://github.com/getpaseo/paseo/pull/6225) by [@dillonzq](https://github.com/dillonzq))
|
||||
- Fixed French translations that read as word-for-word machine translation ([#6004](https://github.com/getpaseo/paseo/pull/6004) by [@fxlelouarn](https://github.com/fxlelouarn))
|
||||
- Fixed the desktop window not dragging from the workspace header after scrolling a long chat ([#5233](https://github.com/getpaseo/paseo/pull/5233) by [@Zhou-Ruichen](https://github.com/Zhou-Ruichen))
|
||||
- Fixed opening an agent on a touch screen in the desktop layout raising the on-screen keyboard ([#5477](https://github.com/getpaseo/paseo/pull/5477) by [@dinhphieu](https://github.com/dinhphieu))
|
||||
- Fixed Option+arrow, Cmd+arrow, and Cmd+Backspace line editing in the macOS terminal ([#3339](https://github.com/getpaseo/paseo/pull/3339) by [@gpambrozio](https://github.com/gpambrozio))
|
||||
@@ -98,12 +154,16 @@
|
||||
- Fixed a new worktree workspace being archived when its `paseo.json` cannot be parsed ([#6036](https://github.com/getpaseo/paseo/pull/6036) by [@3ae3ae](https://github.com/3ae3ae))
|
||||
- Fixed workspace script status not updating in other connected clients ([#6007](https://github.com/getpaseo/paseo/pull/6007) by [@swbiggart](https://github.com/swbiggart))
|
||||
- Fixed agents and terminals inheriting the voice library path, which truncated Git Bash's PATH on Windows ([#5987](https://github.com/getpaseo/paseo/pull/5987) by [@hanh9898](https://github.com/hanh9898))
|
||||
- Fixed dictation failing until the model was deleted by hand when the daemon stopped while extracting a local speech model ([#6210](https://github.com/getpaseo/paseo/pull/6210) by [@3ae3ae](https://github.com/3ae3ae))
|
||||
- Fixed macOS hosts showing as `UNKNOWN` when the network supplies no hostname ([#5922](https://github.com/getpaseo/paseo/pull/5922))
|
||||
- Fixed `paseo daemon status` reporting a daemon in a Linux VM as stopped after the host wakes from sleep ([#6279](https://github.com/getpaseo/paseo/pull/6279))
|
||||
- Fixed relay reconnects being ignored after a relay connection stalled before its handshake ([#5648](https://github.com/getpaseo/paseo/pull/5648) by [@3ae3ae](https://github.com/3ae3ae))
|
||||
- Fixed `paseo daemon run` exiting with "Daemon failed to start" when the program that launched it stops reading its output ([#6117](https://github.com/getpaseo/paseo/pull/6117))
|
||||
- Fixed CLI commands crashing with `EPIPE`, and the Windows desktop app showing an error dialog, when their output stops being read ([#6097](https://github.com/getpaseo/paseo/pull/6097))
|
||||
- Fixed daemon self-update on a linked global install giving the wrong reason for refusing ([#6095](https://github.com/getpaseo/paseo/pull/6095))
|
||||
- Fixed daemon self-update failing for an npm install under a prefix other than npm's global prefix ([#5649](https://github.com/getpaseo/paseo/pull/5649) by [@3ae3ae](https://github.com/3ae3ae))
|
||||
- Fixed opening an archived agent whose worktree was removed showing "Workspace unavailable" when the workspace had no recorded branch ([#5694](https://github.com/getpaseo/paseo/pull/5694))
|
||||
- Fixed a failed send to an archived agent whose directory was removed taking it out of History ([#6255](https://github.com/getpaseo/paseo/pull/6255))
|
||||
- Fixed a host's version staying stale on the host page after its daemon restarts ([#5351](https://github.com/getpaseo/paseo/pull/5351) by [@bashrusakh](https://github.com/bashrusakh))
|
||||
- Fixed Remote SSH hosts failing to connect to a password-protected daemon, with a new Daemon password field ([#6081](https://github.com/getpaseo/paseo/pull/6081) by [@royenheart](https://github.com/royenheart))
|
||||
- Fixed removing a host during its first connection attempt not stopping the connection ([#5722](https://github.com/getpaseo/paseo/pull/5722))
|
||||
@@ -123,6 +183,7 @@
|
||||
- Fixed `paseo schedule update --no-max-runs` and `--no-expires-in` failing before reaching the daemon ([#5973](https://github.com/getpaseo/paseo/pull/5973) by [@Mar-garet](https://github.com/Mar-garet))
|
||||
- Fixed `daemon.log` saying nothing when a resumed Claude agent's transcript is missing or cannot be read ([#5818](https://github.com/getpaseo/paseo/pull/5818) by [@gabrielgiordan](https://github.com/gabrielgiordan))
|
||||
- Fixed reloading a plugin adding `[System Error] Provider connection closed` to finished chats on its provider ([#5579](https://github.com/getpaseo/paseo/pull/5579))
|
||||
- Fixed `paseo plugin add .` looking for the plugin in the daemon's directory instead of the CLI's ([#6239](https://github.com/getpaseo/paseo/pull/6239))
|
||||
- Fixed plugin settings screens on desktop having no way back to the Plugins page ([#5620](https://github.com/getpaseo/paseo/pull/5620))
|
||||
- Fixed plugin client code failing to import npm packages that declare only `main` or `module` ([#5838](https://github.com/getpaseo/paseo/pull/5838))
|
||||
- Fixed the SDK's `send()` and `run()` rejecting `activeTurnBehavior` in TypeScript ([#5605](https://github.com/getpaseo/paseo/pull/5605) by [@wjxdy](https://github.com/wjxdy))
|
||||
|
||||
@@ -50,6 +50,8 @@ Paseo is a desktop, mobile, web, and CLI app for coding agents. Open the desktop
|
||||
- **Cross-device:** iOS, Android, desktop, web, and CLI. Start work at your desk, check in from your phone, script it from the terminal.
|
||||
- **Privacy-first:** Paseo doesn't have any telemetry, tracking, or forced log-ins.
|
||||
|
||||
[Run parallel tasks in Paseo](https://paseo.sh/docs/parallel-development): start agents in separate worktrees, review their diffs, run each app, and check it in the built-in browser.
|
||||
|
||||
## Plugins
|
||||
|
||||
Plugins run on the daemon and show up in every client you connect, with the same UI on desktop, web,
|
||||
|
||||
@@ -197,10 +197,11 @@ Claude Code announces subagent lifecycle on the SDK stream (`task_started` / `ta
|
||||
|
||||
- **Not every announced task belongs in the track.** Task subagents announce as `local_agent` and workflows as `local_workflow`; a backgrounded shell announces as `local_bash` with the same `tool_use_id` shape, and ambient housekeeping sets `skip_transcript`. The Claude provider normalizes a workflow to a generic provider-subagent descriptor titled `Workflow`, using Claude's summary as its description and timeline opener. Shared storage, protocol, and UI do not distinguish it from another provider subagent.
|
||||
- **A task that was never declared gets no descriptor, by any route.** Filtered tasks still emit `task_notification`s carrying a `tool_use_id`, and still emit frames carrying `parent_tool_use_id`. Attributing either produces a descriptor with no identity and a defaulted `running` status — a nameless row that never finishes. Status, presentation updates, and sidechain frames all route through the declaration table.
|
||||
- **Task ids are session-scoped, not turn-scoped.** Cancelling a turn must not clear the routing table: a backgrounded child settles after the interrupt and needs its descriptor to still exist. Cancellation instead terminalizes the declared children that were running in the foreground, and a later `task_notification` is free to correct that guess. Backgrounded children are identified by `task_updated.patch.is_backgrounded`.
|
||||
- **Task ids are session-scoped, not turn-scoped.** Cancelling a turn must not clear the routing table: a backgrounded child settles after the interrupt and needs its descriptor to still exist. Cancellation instead terminalizes the declared children that were running in the foreground, and a later `task_notification` is free to correct that guess. Backgrounded children are identified by `is_backgrounded` on `task_started` (set at spawn; a resumed subagent is always background) or, when moved there later, on `task_updated.patch`.
|
||||
- **A resumed task can be announced again with a new `tool_use_id`.** The first Task tool id remains the canonical descriptor and later ids are routing aliases for the same session-scoped task. The resumed prompt is added to that child timeline.
|
||||
- **Effort is only reachable through hooks.** It appears nowhere on the message stream at any depth, and the level Paseo requests is not necessarily the level that runs — a model that does not support it is silently downgraded. A hook firing inside a subagent reports the active post-downgrade level next to its `agent_id`, which is the same id `task_started` calls `task_id`.
|
||||
- **Backgrounded subagents emit no frames carrying `parent_tool_use_id` at all.** Everything keyed off that field sees nothing for one; they are visible only because the task protocol announces them.
|
||||
- **Only `system/init` and `result` bracket a main-session turn.** Background subagents emit neither on the main stream, while their task frames, their own background jobs' `task_notification`, and `rate_limit_event` arrive with no `parent_tool_use_id`, the same shape as main-session work. `session_state_changed` stays `running` for as long as any background subagent lives (Claude Code 2.1.280), so it cannot open a turn; its `idle` can close one.
|
||||
- **Nested ownership comes from the launching sidechain, not `spawn_depth` alone.** A sidechain's Agent or Bash tool call records the direct owner of that `tool_use_id`; the following `task_started` inherits it. This routes a grandchild descriptor and child-owned background notifications without relying on labels or flattening them into the managed parent.
|
||||
- **On replay, `<session>/subagents/` holds every descendant beside the root.** Resolve the tree one proven generation at a time: the root transcript admits direct children, then each admitted sidechain transcript admits its children by `toolUseId`. `spawnDepth` orders candidates but does not establish ownership. Unresolved sidecars remain excluded as ambient or unrelated work.
|
||||
- **Replay `totalTokens` is a context-size reading, not cumulative spend.** Claude Code finalizes a subagent by summing the _last_ assistant message's usage block and shipping that as `usage.total_tokens`. Summing per-entry usage instead multiplies the cached prefix by the turn count and reports a number several times larger than the live path.
|
||||
|
||||
@@ -484,7 +484,7 @@ The [Agent Client Protocol (ACP)](https://agentclientprotocol.com) is an open st
|
||||
|
||||
ACP agents communicate over JSON-RPC 2.0 on stdio. Paseo spawns the agent process and talks to it through stdin/stdout.
|
||||
|
||||
Paseo also ships an in-app ACP provider catalog for common agents, including CodeWhale, Cursor, DeepAgents, DimCode, Gemini CLI, Hermes, Qwen Code, and Kimi Code. Catalog entries create the same `extends: "acp"` provider config shown below.
|
||||
Paseo also ships an in-app ACP provider catalog for common agents, including CodeWhale, Cursor, DeepAgents, DimCode, Gemini CLI, Hermes, Qwen Code, and Kimi Code. Most catalog entries create the same `extends: "acp"` provider config shown below. Hoplite activates its [bundled provider](plugins.md#built-in-plugins) instead.
|
||||
|
||||
### Adding a generic ACP provider
|
||||
|
||||
|
||||
@@ -107,6 +107,12 @@ absent from the installed plugin list and source configuration; their client bun
|
||||
appear in the plugin catalog. Editing one in development requires a daemon restart.
|
||||
Directory, Git, and npm installs cannot use a built-in ID.
|
||||
|
||||
A provider registration with `requiresConfiguration: true` participates only while its ID exists
|
||||
under `agents.providers`. Hoplite uses this for catalog opt-in. Add writes `{ "enabled": true }`
|
||||
without `extends`, so it selects the bundled adapter. Remove deletes the config entry; setting
|
||||
`enabled: false` keeps the entry. The bundled JavaScript still loads at startup, but an absent
|
||||
provider does not enter executable resolution or catalog discovery.
|
||||
|
||||
Provider plugins use separate installation and provider IDs. `muse-provider` registers the
|
||||
selectable `muse` provider (Muse Code) and a usage source. Its `status({ launch })` reports
|
||||
availability and a diagnostic after the daemon resolves the executable. Configure command,
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@ OpenCode owns user message IDs. Do not pass Paseo-generated IDs to OpenCode prom
|
||||
|
||||
Active-turn steering is an optional `AgentSession.steerActiveTurn` operation. The manager owns admission against its exact foreground turn, canonical user-message creation, echo reconciliation, and falls back to the normal interrupt-and-replace path only when the adapter reports `unavailable`. An adapter error leaves the steer's fate ambiguous and must surface without an interrupt or retry. Codex calls `turn/steer` with the native expected turn and Paseo client user-message ID. Claude pushes an admitted steer into the exact active SDK query input; isolated control commands remain unavailable. OpenCode calls `session/prompt_async` with an OpenCode-generated message ID; the server queues the prompt while busy and the next LLM call in the same Paseo turn includes it. Pi sends its native `steer` RPC, which queues the message for delivery after the in-flight assistant turn's tool calls. Slash-command inputs report `unavailable` because pi rejects extension commands on the steer path, and echo identity is correlated by message text because pi's steer RPC takes no message ID. A missing session reports `unavailable` and uses the normal interrupt fallback.
|
||||
|
||||
A steering adapter also owes its interrupt: stopping a turn must discard the steers the provider has not read yet, or one of them resumes the turn the user just stopped. Codex clears pending input when it aborts a turn; Claude does not, so its adapter cancels the SDK messages it queued before calling `query.interrupt()`. Pi requires `clear_queue` before `abort`; older binaries without that RPC retain their native queue behavior until the pi compatibility floor reaches 0.84.4.
|
||||
A steering adapter also owes its interrupt: stopping a turn must discard the steers the provider has not read yet, or one of them resumes the turn the user just stopped. Codex clears pending input when it aborts a turn; Claude does not, so its adapter cancels the SDK messages it queued before calling `query.interrupt()`. It calls `query.interrupt()` only while a main-session turn is in flight (between `system/init` and that turn's `result`): with the main session idle, an interrupt reaches only background subagents and no result follows it, so the adapter withdraws its unstarted messages and stops there. The adapter also declares `perTaskStopAffordance`, because without it the CLI kills every background subagent on interrupt. Pi requires `clear_queue` before `abort`; older binaries without that RPC retain their native queue behavior until the pi compatibility floor reaches 0.84.4.
|
||||
|
||||
`SteerActiveTurnOptions.clearPendingPermissions` makes permission release part of the provider contract. A provider that accepts such a steer queues it first, denies permissions blocking its delivery, and stops once the steer is read. Steers without the flag leave permissions open. A denied plan remains in the timeline because the pending card was the only other copy of its text.
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
Added
|
||||
- Added Muse Code as a provider, with model, approval mode, and reasoning effort controls
|
||||
- Added Antigravity as a provider that drives the installed agy CLI, always in Full access
|
||||
- Added Usage, opened from the sidebar footer as a dialog on desktop and a sheet on mobile, showing each subscription account's quota windows with Refresh
|
||||
- Added an opt-in Usage summary to the sidebar footer that shows the windows you pin
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,7 @@
|
||||
Added
|
||||
- Added Muse Code as a provider, with model, approval mode, and reasoning effort controls
|
||||
- Added Antigravity as a provider that drives the installed agy CLI, always in Full access
|
||||
- Added Usage, opened from the sidebar footer as a dialog on desktop and a sheet on mobile, showing each subscription account's quota windows with Refresh
|
||||
- Added an opt-in Usage summary to the sidebar footer that shows the windows you pin
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,7 @@
|
||||
Added
|
||||
- Added Muse Code as a provider, with model, approval mode, and reasoning effort controls
|
||||
- Added Antigravity as a provider that drives the installed agy CLI, always in Full access
|
||||
- Added Usage, opened from the sidebar footer as a dialog on desktop and a sheet on mobile, showing each subscription account's quota windows with Refresh
|
||||
- Added an opt-in Usage summary to the sidebar footer that shows the windows you pin
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,7 @@
|
||||
Added
|
||||
- Added Muse Code as a provider, with model, approval mode, and reasoning effort controls
|
||||
- Added Antigravity as a provider that drives the installed agy CLI, always in Full access
|
||||
- Added Usage, opened from the sidebar footer as a dialog on desktop and a sheet on mobile, showing each subscription account's quota windows with Refresh
|
||||
- Added an opt-in Usage summary to the sidebar footer that shows the windows you pin
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,8 @@
|
||||
Added
|
||||
- Added Claude Haiku 5.5 for Claude Code 2.1.293 and newer
|
||||
|
||||
Fixed
|
||||
- Fixed Claude tool calls that run longer than 30 seconds, such as WebFetch or MCP tools, showing up as subagents
|
||||
- Fixed subagents that finish while the app is disconnected staying "working" until one is opened
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,8 @@
|
||||
Added
|
||||
- Added Claude Haiku 5.5 for Claude Code 2.1.293 and newer
|
||||
|
||||
Fixed
|
||||
- Fixed Claude tool calls that run longer than 30 seconds, such as WebFetch or MCP tools, showing up as subagents
|
||||
- Fixed subagents that finish while the app is disconnected staying "working" until one is opened
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,8 @@
|
||||
Added
|
||||
- Added Claude Haiku 5.5 for Claude Code 2.1.293 and newer
|
||||
|
||||
Fixed
|
||||
- Fixed Claude tool calls that run longer than 30 seconds, such as WebFetch or MCP tools, showing up as subagents
|
||||
- Fixed subagents that finish while the app is disconnected staying "working" until one is opened
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,8 @@
|
||||
Added
|
||||
- Added Claude Haiku 5.5 for Claude Code 2.1.293 and newer
|
||||
|
||||
Fixed
|
||||
- Fixed Claude tool calls that run longer than 30 seconds, such as WebFetch or MCP tools, showing up as subagents
|
||||
- Fixed subagents that finish while the app is disconnected staying "working" until one is opened
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,4 @@
|
||||
Fixed
|
||||
- Fixed intermittent text clipping in iOS chats and Markdown previews
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,4 @@
|
||||
Fixed
|
||||
- Fixed intermittent text clipping in iOS chats and Markdown previews
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,4 @@
|
||||
Fixed
|
||||
- Fixed intermittent text clipping in iOS chats and Markdown previews
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,4 @@
|
||||
Fixed
|
||||
- Fixed intermittent text clipping in iOS chats and Markdown previews
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,11 @@
|
||||
Added
|
||||
- Added Hoplite as an opt-in provider in the ACP provider catalog
|
||||
- Added search to the Add provider catalog
|
||||
|
||||
Changed
|
||||
- Changed Add provider failures to show as a toast
|
||||
|
||||
Fixed
|
||||
- Fixed Remove being offered for plugin providers such as Antigravity and Muse Code
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,11 @@
|
||||
Added
|
||||
- Added Hoplite as an opt-in provider in the ACP provider catalog
|
||||
- Added search to the Add provider catalog
|
||||
|
||||
Changed
|
||||
- Changed Add provider failures to show as a toast
|
||||
|
||||
Fixed
|
||||
- Fixed Remove being offered for plugin providers such as Antigravity and Muse Code
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,11 @@
|
||||
Added
|
||||
- Added Hoplite as an opt-in provider in the ACP provider catalog
|
||||
- Added search to the Add provider catalog
|
||||
|
||||
Changed
|
||||
- Changed Add provider failures to show as a toast
|
||||
|
||||
Fixed
|
||||
- Fixed Remove being offered for plugin providers such as Antigravity and Muse Code
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,11 @@
|
||||
Added
|
||||
- Added Hoplite as an opt-in provider in the ACP provider catalog
|
||||
- Added search to the Add provider catalog
|
||||
|
||||
Changed
|
||||
- Changed Add provider failures to show as a toast
|
||||
|
||||
Fixed
|
||||
- Fixed Remove being offered for plugin providers such as Antigravity and Muse Code
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
+1
-1
@@ -1 +1 @@
|
||||
sha256-zL3+gbScK8eMkjQUtKDX4UJTXt4BMeqMSyeWB017MA4=
|
||||
sha256-AKY6OMZgHeyn/To/2zsmtfb5C4fKniUp8gvpEYaR7/o=
|
||||
|
||||
Generated
+28
-28
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "paseo",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "paseo",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"workspaces": [
|
||||
@@ -36413,7 +36413,7 @@
|
||||
},
|
||||
"packages/app": {
|
||||
"name": "@getpaseo/app",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"dependencies": {
|
||||
"@codemirror/commands": "6.10.4",
|
||||
"@codemirror/language": "6.12.4",
|
||||
@@ -37496,12 +37496,12 @@
|
||||
},
|
||||
"packages/cli": {
|
||||
"name": "@getpaseo/cli",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^1.0.0",
|
||||
"@getpaseo/client": "0.11.0-beta.5",
|
||||
"@getpaseo/protocol": "0.11.0-beta.5",
|
||||
"@getpaseo/server": "0.11.0-beta.5",
|
||||
"@getpaseo/client": "0.11.3",
|
||||
"@getpaseo/protocol": "0.11.3",
|
||||
"@getpaseo/server": "0.11.3",
|
||||
"chalk": "^5.3.0",
|
||||
"commander": "^12.0.0",
|
||||
"mime-types": "^2.1.35",
|
||||
@@ -37748,10 +37748,10 @@
|
||||
},
|
||||
"packages/client": {
|
||||
"name": "@getpaseo/client",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"dependencies": {
|
||||
"@getpaseo/protocol": "0.11.0-beta.5",
|
||||
"@getpaseo/relay": "0.11.0-beta.5",
|
||||
"@getpaseo/protocol": "0.11.3",
|
||||
"@getpaseo/relay": "0.11.3",
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -37762,7 +37762,7 @@
|
||||
},
|
||||
"packages/desktop": {
|
||||
"name": "@getpaseo/desktop",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@getpaseo/cli": "*",
|
||||
@@ -38006,7 +38006,7 @@
|
||||
},
|
||||
"packages/expo-two-way-audio": {
|
||||
"name": "@getpaseo/expo-two-way-audio",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.14",
|
||||
@@ -38902,7 +38902,7 @@
|
||||
},
|
||||
"packages/highlight": {
|
||||
"name": "@getpaseo/highlight",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"dependencies": {
|
||||
"@codemirror/language": "6.12.4",
|
||||
"@codemirror/legacy-modes": "^6.5.3",
|
||||
@@ -38931,14 +38931,14 @@
|
||||
},
|
||||
"packages/plugin": {
|
||||
"name": "@getpaseo/plugin",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "^1.4.0",
|
||||
"use-sync-external-store": "^1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@getpaseo/client": "0.11.0-beta.5",
|
||||
"@getpaseo/protocol": "0.11.0-beta.5",
|
||||
"@getpaseo/client": "0.11.3",
|
||||
"@getpaseo/protocol": "0.11.3",
|
||||
"@types/node": "^20.9.0",
|
||||
"@types/react": "~19.2.0",
|
||||
"react": "19.1.0",
|
||||
@@ -38948,8 +38948,8 @@
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@getpaseo/client": "0.11.0-beta.5",
|
||||
"@getpaseo/protocol": "0.11.0-beta.5",
|
||||
"@getpaseo/client": "0.11.3",
|
||||
"@getpaseo/protocol": "0.11.3",
|
||||
"react": "~19.1.0",
|
||||
"react-native": ">=0.81.5",
|
||||
"zod": "^4.4.3"
|
||||
@@ -38971,7 +38971,7 @@
|
||||
},
|
||||
"packages/protocol": {
|
||||
"name": "@getpaseo/protocol",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"dependencies": {
|
||||
"semver": "^7.8.5",
|
||||
"zod": "^4.4.3"
|
||||
@@ -38998,7 +38998,7 @@
|
||||
},
|
||||
"packages/relay": {
|
||||
"name": "@getpaseo/relay",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"dependencies": {
|
||||
"base64-js": "^1.5.1",
|
||||
"tweetnacl": "^1.0.3",
|
||||
@@ -39216,16 +39216,16 @@
|
||||
},
|
||||
"packages/server": {
|
||||
"name": "@getpaseo/server",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "^0.17.1",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.3.246",
|
||||
"@anthropic-ai/sdk": "^0.104.2",
|
||||
"@getpaseo/client": "0.11.0-beta.5",
|
||||
"@getpaseo/highlight": "0.11.0-beta.5",
|
||||
"@getpaseo/plugin": "0.11.0-beta.5",
|
||||
"@getpaseo/protocol": "0.11.0-beta.5",
|
||||
"@getpaseo/relay": "0.11.0-beta.5",
|
||||
"@getpaseo/client": "0.11.3",
|
||||
"@getpaseo/highlight": "0.11.3",
|
||||
"@getpaseo/plugin": "0.11.3",
|
||||
"@getpaseo/protocol": "0.11.3",
|
||||
"@getpaseo/relay": "0.11.3",
|
||||
"@isaacs/ttlcache": "^2.1.4",
|
||||
"@modelcontextprotocol/sdk": "1.29.0",
|
||||
"@opencode-ai/sdk": "1.14.46",
|
||||
@@ -40146,7 +40146,7 @@
|
||||
},
|
||||
"packages/website": {
|
||||
"name": "@getpaseo/website",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"dependencies": {
|
||||
"@cloudflare/vite-plugin": "^1.29.1",
|
||||
"@cloudflare/workers-types": "^4.20260317.1",
|
||||
@@ -41754,7 +41754,7 @@
|
||||
},
|
||||
"plugins": {
|
||||
"name": "@getpaseo/builtin-plugins",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"dependencies": {
|
||||
"@getpaseo/plugin": "*",
|
||||
"zod": "^4.4.3"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "paseo",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"private": true,
|
||||
"description": "Paseo: voice-controlled development environment for local AI coding agents",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,13 +1,24 @@
|
||||
import { test } from "../support/fixtures";
|
||||
import {
|
||||
closeModelPicker,
|
||||
openModelPicker,
|
||||
seedAgentProfiles,
|
||||
} from "../support/helpers/agent-profiles";
|
||||
import { expectComposerVisible } from "../support/helpers/composer";
|
||||
import { clickNewChat, gotoWorkspace } from "../support/helpers/launcher";
|
||||
import { seedWorkspace } from "../support/helpers/seed-client";
|
||||
import { writeFile } from "node:fs/promises";
|
||||
import { expect, test } from "../support/fixtures";
|
||||
import { gotoAppShell, openSettings } from "../support/helpers/app";
|
||||
import { connectDaemonClient } from "../support/helpers/daemon-client-loader";
|
||||
import { getServerId } from "../support/helpers/server-id";
|
||||
import {
|
||||
expectProviderInstalledInSettings,
|
||||
findAcpCatalogProvider,
|
||||
installAcpCatalogProvider,
|
||||
openAddProviderArea,
|
||||
openSettingsHost,
|
||||
openSettingsHostSection,
|
||||
seedSavedSettingsHosts,
|
||||
} from "../support/helpers/settings";
|
||||
|
||||
const ACP_PROVIDER = {
|
||||
@@ -16,8 +27,13 @@ const ACP_PROVIDER = {
|
||||
};
|
||||
|
||||
interface ProviderCatalogDaemonClient {
|
||||
getLastServerInfoMessage(): {
|
||||
features?: { hopliteProvider?: boolean; plugins?: boolean };
|
||||
} | null;
|
||||
connect(): Promise<void>;
|
||||
close(): Promise<void>;
|
||||
getDaemonConfig(): Promise<{ config: { providers?: Record<string, unknown> } }>;
|
||||
getProvidersSnapshot(): Promise<{ entries: Array<{ provider: string }> }>;
|
||||
patchDaemonConfig(config: { removeProviders?: string[] }): Promise<unknown>;
|
||||
}
|
||||
|
||||
@@ -41,3 +57,124 @@ test.describe("ACP provider catalog", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
for (const theme of ["light", "dark"] as const) {
|
||||
test(`adds Hoplite from the catalog in ${theme} theme`, async ({ page }, testInfo) => {
|
||||
const client = await connectDaemonClient<ProviderCatalogDaemonClient>({
|
||||
clientIdPrefix: "hoplite-catalog-e2e",
|
||||
});
|
||||
try {
|
||||
expect(client.getLastServerInfoMessage()?.features?.hopliteProvider).toBe(true);
|
||||
await client.patchDaemonConfig({ removeProviders: ["hoplite"] });
|
||||
expect(
|
||||
(await client.getProvidersSnapshot()).entries.some((entry) => entry.provider === "hoplite"),
|
||||
).toBe(false);
|
||||
await page.addInitScript((value) => {
|
||||
localStorage.setItem("@paseo:app-settings", JSON.stringify({ theme: value }));
|
||||
}, theme);
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await openSettingsHost(page, getServerId());
|
||||
await openSettingsHostSection(page, getServerId(), "providers");
|
||||
await expect(
|
||||
page.getByRole("button", { name: "Hoplite provider details", exact: true }),
|
||||
).toHaveCount(0);
|
||||
await openAddProviderArea(page);
|
||||
await findAcpCatalogProvider(page, "Hoplite");
|
||||
await page.screenshot({ path: testInfo.outputPath(`hoplite-catalog-${theme}.png`) });
|
||||
await installAcpCatalogProvider(page, "Hoplite");
|
||||
await expectProviderInstalledInSettings(page, "Hoplite");
|
||||
await page.screenshot({ path: testInfo.outputPath(`hoplite-installed-${theme}.png`) });
|
||||
expect((await client.getDaemonConfig()).config.providers?.hoplite).toEqual({ enabled: true });
|
||||
await writeFile(
|
||||
testInfo.outputPath(`hoplite-added-${theme}.json`),
|
||||
JSON.stringify(await client.getProvidersSnapshot(), null, 2),
|
||||
);
|
||||
await removeHoplite(page);
|
||||
await expect(
|
||||
page.getByRole("button", { name: "Hoplite provider details", exact: true }),
|
||||
).toHaveCount(0);
|
||||
expect((await client.getDaemonConfig()).config.providers?.hoplite).toBeUndefined();
|
||||
expect(
|
||||
(await client.getProvidersSnapshot()).entries.some((entry) => entry.provider === "hoplite"),
|
||||
).toBe(false);
|
||||
await writeFile(
|
||||
testInfo.outputPath(`hoplite-removed-${theme}.json`),
|
||||
JSON.stringify(await client.getProvidersSnapshot(), null, 2),
|
||||
);
|
||||
await openAddProviderArea(page);
|
||||
await findAcpCatalogProvider(page, "Hoplite");
|
||||
await page.screenshot({ path: testInfo.outputPath(`hoplite-removed-${theme}.png`) });
|
||||
await installAcpCatalogProvider(page, "Hoplite");
|
||||
await expectProviderInstalledInSettings(page, "Hoplite");
|
||||
} finally {
|
||||
await client.patchDaemonConfig({ removeProviders: ["hoplite"] }).catch(() => undefined);
|
||||
await client.close().catch(() => undefined);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function removeHoplite(page: import("@playwright/test").Page): Promise<void> {
|
||||
await page.getByTestId("provider-actions-hoplite").click();
|
||||
page.once("dialog", (dialog) => {
|
||||
void dialog.accept();
|
||||
});
|
||||
await page.getByTestId("provider-remove-hoplite").click();
|
||||
}
|
||||
|
||||
test("unsupported host asks for an update without writing Hoplite config", async ({
|
||||
page,
|
||||
outdatedDaemon,
|
||||
}, testInfo) => {
|
||||
const client = await connectDaemonClient<ProviderCatalogDaemonClient>({
|
||||
clientIdPrefix: "hoplite-unsupported",
|
||||
port: Number(new URL(`http://${outdatedDaemon.endpoint}`).port),
|
||||
});
|
||||
try {
|
||||
expect(client.getLastServerInfoMessage()?.features?.plugins).toBe(true);
|
||||
expect(client.getLastServerInfoMessage()?.features?.hopliteProvider).toBe(false);
|
||||
const before = await client.getDaemonConfig();
|
||||
await seedSavedSettingsHosts(page, [outdatedDaemon]);
|
||||
await page.reload();
|
||||
await openSettings(page);
|
||||
await openSettingsHost(page, outdatedDaemon.serverId);
|
||||
await openSettingsHostSection(page, outdatedDaemon.serverId, "providers");
|
||||
await openAddProviderArea(page);
|
||||
await page.getByRole("button", { name: "Add Hoplite", exact: true }).click();
|
||||
const errorToast = page.getByTestId("app-toast-message");
|
||||
await expect(errorToast).toHaveText("Update the host to add Hoplite.");
|
||||
await expect(errorToast).toBeInViewport();
|
||||
expect((await client.getDaemonConfig()).config).toEqual(before.config);
|
||||
await expect(
|
||||
page.getByRole("button", { name: "Hoplite provider details", exact: true }),
|
||||
).toHaveCount(0);
|
||||
await page.screenshot({ path: testInfo.outputPath("hoplite-update-host.png") });
|
||||
} finally {
|
||||
await client.close();
|
||||
}
|
||||
});
|
||||
|
||||
test("model selector excludes Hoplite before opt-in", async ({ page }, testInfo) => {
|
||||
const client = await connectDaemonClient<ProviderCatalogDaemonClient>({
|
||||
clientIdPrefix: "hoplite-picker",
|
||||
});
|
||||
const profiles = await seedAgentProfiles([
|
||||
{ id: "hoplite-picker-anchor", name: "Picker anchor", provider: "mock" },
|
||||
]);
|
||||
const workspace = await seedWorkspace({ repoPrefix: "hoplite-picker-" });
|
||||
try {
|
||||
await client.patchDaemonConfig({ removeProviders: ["hoplite"] });
|
||||
await gotoWorkspace(page, workspace.workspaceId);
|
||||
await clickNewChat(page);
|
||||
await expectComposerVisible(page);
|
||||
await openModelPicker(page);
|
||||
await expect(page.getByTestId("model-provider-mock")).toBeVisible();
|
||||
await expect(page.getByTestId("model-provider-hoplite")).toHaveCount(0);
|
||||
await page.screenshot({ path: testInfo.outputPath("hoplite-model-selector-absent.png") });
|
||||
await closeModelPicker(page);
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
await profiles.restore();
|
||||
await client.close();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -133,6 +133,58 @@ test("scroll detector accounts for delayed wheel input and growth below the new
|
||||
).toHaveLength(1);
|
||||
});
|
||||
|
||||
test("scroll detector follows the entered image through resize and virtual offset correction", () => {
|
||||
for (const height of [225, 1632]) {
|
||||
const before: ScrollFrame = {
|
||||
at: 1000,
|
||||
scrollTop: 2208,
|
||||
scrollHeight: 5000,
|
||||
viewportHeight: 516,
|
||||
virtualized: true,
|
||||
loading: false,
|
||||
rows: [
|
||||
{ id: "image", top: -704, height: 560 },
|
||||
{ id: "caption", top: -144, height: 100 },
|
||||
{ id: "old-reader", top: -44, height: 127 },
|
||||
],
|
||||
anchor: "old-reader",
|
||||
wheelTotal: 0,
|
||||
lastWheelAt: 0,
|
||||
inputFinishedAt: null,
|
||||
imageLoads: 0,
|
||||
mounted: 3,
|
||||
unmounted: 0,
|
||||
};
|
||||
const resize = height - 560;
|
||||
const after: ScrollFrame = {
|
||||
...before,
|
||||
at: 1060,
|
||||
// The virtualizer corrects 110px of estimates while the wheel moves 160px.
|
||||
scrollTop: 1938,
|
||||
scrollHeight: 5000 + resize - 110,
|
||||
wheelTotal: 160,
|
||||
lastWheelAt: 1020,
|
||||
imageLoads: 1,
|
||||
rows: [
|
||||
{ id: "image", top: -544, height },
|
||||
{ id: "caption", top: 16 + resize, height: 100 },
|
||||
{ id: "old-reader", top: 116 + resize, height: 127 },
|
||||
],
|
||||
};
|
||||
expect(findScrollJumps([before, after])).toEqual([]);
|
||||
// Resizing must not excuse additional viewport movement.
|
||||
expect(
|
||||
findScrollJumps([
|
||||
before,
|
||||
{
|
||||
...after,
|
||||
rows: after.rows.map((row) => ({ id: row.id, height: row.height, top: row.top + 100 })),
|
||||
},
|
||||
]),
|
||||
).toHaveLength(1);
|
||||
}
|
||||
});
|
||||
|
||||
for (const cadence of scrollCadences) {
|
||||
test(`varied timeline preserves reading position during ${cadence.name} upward scrolling`, async ({
|
||||
page,
|
||||
|
||||
@@ -10,16 +10,29 @@ import {
|
||||
openSettingsHost,
|
||||
openSettingsHostSection,
|
||||
} from "../support/helpers/settings";
|
||||
import { copyPluginExample } from "../support/helpers/plugin-fixture";
|
||||
|
||||
const CUSTOM_PROVIDER = {
|
||||
id: "junie",
|
||||
name: "Junie",
|
||||
} as const;
|
||||
|
||||
const PLUGIN_PROVIDER = {
|
||||
id: "direct-example",
|
||||
name: "Direct provider example",
|
||||
pluginId: "provider-direct-example",
|
||||
} as const;
|
||||
|
||||
interface ProviderRemovalDaemonClient {
|
||||
connect(): Promise<void>;
|
||||
close(): Promise<void>;
|
||||
patchDaemonConfig(config: { removeProviders?: string[] }): Promise<unknown>;
|
||||
getDaemonConfig(): Promise<{ config: { pluginsEnabled?: boolean } }>;
|
||||
patchDaemonConfig(config: {
|
||||
removeProviders?: string[];
|
||||
pluginsEnabled?: boolean;
|
||||
}): Promise<unknown>;
|
||||
installDirectoryPlugin(path: string): Promise<unknown>;
|
||||
removePlugin(pluginId: string): Promise<void>;
|
||||
getProvidersSnapshot(): Promise<{
|
||||
entries: Array<{ provider: string; source?: "builtin" | "custom" }>;
|
||||
}>;
|
||||
@@ -93,4 +106,45 @@ test.describe("provider removal", () => {
|
||||
await client.close().catch(() => undefined);
|
||||
}
|
||||
});
|
||||
|
||||
test("does not offer Remove for a plugin-registered provider", async ({ page }) => {
|
||||
test.setTimeout(120_000);
|
||||
const client = await connectDaemonClient<ProviderRemovalDaemonClient>({
|
||||
clientIdPrefix: "provider-removal-e2e",
|
||||
});
|
||||
|
||||
const plugin = await copyPluginExample("provider-direct");
|
||||
try {
|
||||
const previous = await client.getDaemonConfig();
|
||||
try {
|
||||
await client.patchDaemonConfig({ pluginsEnabled: true });
|
||||
await client.installDirectoryPlugin(plugin.directory);
|
||||
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await openSettingsHost(page, getServerId());
|
||||
await openSettingsHostSection(page, getServerId(), "providers");
|
||||
|
||||
const pluginProviderRow = page.getByRole("button", {
|
||||
name: `${PLUGIN_PROVIDER.name} provider details`,
|
||||
exact: true,
|
||||
});
|
||||
await expect(pluginProviderRow).toBeVisible();
|
||||
await expect(page.getByTestId(`provider-actions-${PLUGIN_PROVIDER.id}`)).toHaveCount(0);
|
||||
|
||||
// The provider survives a removeProviders patch pointed at it: the
|
||||
// plugin, not config.json, owns the definition.
|
||||
await client.patchDaemonConfig({ removeProviders: [PLUGIN_PROVIDER.id] });
|
||||
await expect(pluginProviderRow).toBeVisible();
|
||||
} finally {
|
||||
await client.removePlugin(PLUGIN_PROVIDER.pluginId).catch(() => undefined);
|
||||
await client
|
||||
.patchDaemonConfig({ pluginsEnabled: previous.config.pluginsEnabled })
|
||||
.catch(() => undefined);
|
||||
}
|
||||
} finally {
|
||||
await client.close().catch(() => undefined);
|
||||
await plugin.cleanup();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
# Native iOS text geometry regression
|
||||
|
||||
Run on the Namespace Mac with a fresh simulator development build. Use the PID
|
||||
returned by `xcrun simctl launch <your-task-simulator-UDID> sh.paseo.debug`.
|
||||
Attach only to your task's app, while no device replay is running:
|
||||
|
||||
```sh
|
||||
PASEO_NATIVE_TEXT_REFLOW_PID=12345 \
|
||||
PASEO_NATIVE_TEXT_REFLOW_LOG=/Volumes/devbox/workspace/native-text-reflow.log \
|
||||
bash packages/app/e2e/mobile/native-text-reflow/ios.sh
|
||||
```
|
||||
|
||||
The probe constructs the installed `RNUITextView`, fills its real UIKit text view,
|
||||
and resizes its content container from 500 to 240 and back to 500 points. It
|
||||
asserts the inner frame follows both widths and the same selection survives.
|
||||
It uses public UIView/UITextView operations, without mocking React Native.
|
||||
LLDB detaches after the probe. An assertion failure or evaluation error fails the
|
||||
shell command; the log distinguishes them.
|
||||
|
||||
This covers native container resizing and selection retention. It does not cover
|
||||
Fabric event delivery, chat row height, reader anchoring, or the on-screen copy
|
||||
menu. Those require the real chat journey: read an older multiline response,
|
||||
open/close Explorer, resize/rotate, inspect complete paragraphs and bullets,
|
||||
retain expanded/collapsed details, and check a stationary reader's position.
|
||||
Accessibility exposes full text even when glyphs are clipped, so a text wait
|
||||
alone does not verify that journey.
|
||||
@@ -1,55 +0,0 @@
|
||||
import lldb
|
||||
|
||||
|
||||
def __lldb_init_module(debugger, _internal_dict):
|
||||
debugger.HandleCommand("expression -l objc++ -- @import UIKit")
|
||||
frame = debugger.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
|
||||
options = lldb.SBExpressionOptions()
|
||||
options.SetLanguage(lldb.eLanguageTypeObjC_plus_plus)
|
||||
result = frame.EvaluateExpression(
|
||||
r'''({
|
||||
UIView *host = (UIView *)[[NSClassFromString(@"RNUITextView") alloc] init];
|
||||
auto hostFrame = host.frame;
|
||||
hostFrame.size.width = 500;
|
||||
hostFrame.size.height = 200;
|
||||
host.frame = hostFrame;
|
||||
UIView *container = (UIView *)[host performSelector:@selector(contentView)];
|
||||
container.frame = host.bounds;
|
||||
UITextView *text = nil;
|
||||
for (UIView *child in host.subviews) {
|
||||
if ([child isKindOfClass:UITextView.class]) text = (UITextView *)child;
|
||||
for (UIView *nested in child.subviews) {
|
||||
if ([nested isKindOfClass:UITextView.class]) text = (UITextView *)nested;
|
||||
}
|
||||
}
|
||||
text.frame = container.bounds;
|
||||
text.font = [UIFont systemFontOfSize:16];
|
||||
text.text = @"A realistic multiline paragraph must reflow when Explorer narrows the available chat width, then fill the restored width without replacing the text view or discarding a selection.";
|
||||
auto range = text.selectedRange;
|
||||
range.location = 12;
|
||||
range.length = 9;
|
||||
text.selectedRange = range;
|
||||
auto frame = container.frame;
|
||||
frame.size.width = 240;
|
||||
container.frame = frame;
|
||||
[container layoutIfNeeded];
|
||||
CGFloat narrow = text.frame.size.width;
|
||||
auto selection = text.selectedRange;
|
||||
frame.size.width = 500;
|
||||
container.frame = frame;
|
||||
[container layoutIfNeeded];
|
||||
CGFloat wide = text.frame.size.width;
|
||||
BOOL ok = text != nil && narrow == 240 && wide == 500 &&
|
||||
selection.location == text.selectedRange.location &&
|
||||
selection.length == text.selectedRange.length &&
|
||||
selection.location == 12 && selection.length == 9;
|
||||
[NSString stringWithFormat:@"NATIVE_REFLOW_%@ narrow=%.0f wide=%.0f selection=%lu:%lu",
|
||||
ok ? @"PASS" : @"FAIL", narrow, wide,
|
||||
(unsigned long)text.selectedRange.location,
|
||||
(unsigned long)text.selectedRange.length];
|
||||
})''',
|
||||
options,
|
||||
)
|
||||
if result.GetError().Fail():
|
||||
raise RuntimeError(result.GetError().GetCString())
|
||||
print(result.GetObjectDescription())
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
: "${PASEO_NATIVE_TEXT_REFLOW_PID:?Set the PID of your task-owned Paseo iOS simulator app}"
|
||||
: "${PASEO_NATIVE_TEXT_REFLOW_LOG:?Set the test output log path}"
|
||||
|
||||
if [[ "$(ps -p "$PASEO_NATIVE_TEXT_REFLOW_PID" -o comm=)" != *PaseoDebug.app/PaseoDebug ]]; then
|
||||
echo "Expected a running PaseoDebug simulator app" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
probe_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
xcrun lldb --batch -p "$PASEO_NATIVE_TEXT_REFLOW_PID" \
|
||||
-o "command script import $probe_dir/ios.py" \
|
||||
-o "process detach" -o quit > "$PASEO_NATIVE_TEXT_REFLOW_LOG" 2>&1
|
||||
|
||||
grep '^NATIVE_REFLOW_' "$PASEO_NATIVE_TEXT_REFLOW_LOG"
|
||||
grep -q '^NATIVE_REFLOW_PASS narrow=240 wide=500 selection=12:9$' "$PASEO_NATIVE_TEXT_REFLOW_LOG"
|
||||
@@ -370,7 +370,7 @@ export async function findAcpCatalogProvider(page: Page, providerName: string):
|
||||
|
||||
export async function installAcpCatalogProvider(page: Page, providerName: string): Promise<void> {
|
||||
await findAcpCatalogProvider(page, providerName);
|
||||
await page.getByRole("button", { name: "Add", exact: true }).click();
|
||||
await page.getByRole("button", { name: `Add ${providerName}`, exact: true }).click();
|
||||
}
|
||||
|
||||
export async function expectProviderInstalledInSettings(
|
||||
|
||||
@@ -297,11 +297,7 @@ export function findScrollJumps(frames: ScrollFrame[]) {
|
||||
// Follow that intended row, not text now below the image.
|
||||
const recent = frames.findLast((frame) => frame.at <= previous.at - 100);
|
||||
const wheelBudget = current.wheelTotal - (recent?.wheelTotal ?? 0);
|
||||
const frameScroll = Math.max(0, previous.scrollTop - current.scrollTop);
|
||||
const availableScroll = Math.min(frameScroll, wheelBudget, previous.scrollTop);
|
||||
const readingLine = 8 - availableScroll;
|
||||
const currentRows = new Map(current.rows.map((row) => [row.id, row]));
|
||||
const intendedRow = previous.rows.find((row) => row.top + row.height > readingLine);
|
||||
const anchor = previous.anchor;
|
||||
const before = currentRows.has(anchor)
|
||||
? previous.rows.find((row) => row.id === anchor)!
|
||||
@@ -316,25 +312,33 @@ export function findScrollJumps(frames: ScrollFrame[]) {
|
||||
// A busy main thread can deliver wheel movement hundreds of milliseconds
|
||||
// after its event. Only assert idle stability after the driver stops input.
|
||||
const idle = current.inputFinishedAt !== null && previous.at - current.inputFinishedAt > 250;
|
||||
// Wheel events can precede their scroll update, or include input already
|
||||
// applied in earlier frames. Locate the reader with this frame's scroll,
|
||||
// bounded by recent input. Growth below it can move the old anchor without
|
||||
// moving the reading line.
|
||||
const readerFollowsInput =
|
||||
intendedRow &&
|
||||
currentRows.has(intendedRow.id) &&
|
||||
Math.abs(currentRows.get(intendedRow.id)!.top - intendedRow.top - availableScroll) <= 32;
|
||||
const enteredRowGrowth = readerFollowsInput
|
||||
// scrollTop also includes virtualizer estimate corrections. Locate the row
|
||||
// entered by wheel input from its viewport movement instead. Its old height
|
||||
// identifies the reader before a simultaneous image resize takes effect.
|
||||
const intendedRow = previous.rows.find((row) => {
|
||||
const next = currentRows.get(row.id);
|
||||
if (!next || idle || wheelBudget <= 0) return false;
|
||||
const travel = next.top - row.top;
|
||||
return (
|
||||
travel >= -8 &&
|
||||
travel <= Math.min(wheelBudget, previous.scrollTop) + 32 &&
|
||||
(next.top <= 8 || current.scrollTop === 0) &&
|
||||
next.top + row.height > 8
|
||||
);
|
||||
});
|
||||
const enteredRowResize = intendedRow
|
||||
? previous.rows.reduce((growth, row) => {
|
||||
if (row.top < intendedRow.top || row.top >= before.top) return growth;
|
||||
const height = currentRows.get(row.id)?.height ?? row.height;
|
||||
return growth + Math.max(0, height - row.height);
|
||||
return growth + height - row.height;
|
||||
}, 0)
|
||||
: 0;
|
||||
const excessForward = movement > wheelBudget + enteredRowGrowth + 32;
|
||||
const readingMovement = movement - enteredRowResize;
|
||||
const excessForward = readingMovement > wheelBudget + 32;
|
||||
// Upward wheel input moves the same text DOWN the viewport. A negative move
|
||||
// is a reversal, independent of legitimate scrollTop compensation on prepend.
|
||||
if (movement >= -8 && (!idle || Math.abs(movement) <= 8) && !excessForward) return [];
|
||||
if (readingMovement >= -8 && (!idle || Math.abs(readingMovement) <= 8) && !excessForward)
|
||||
return [];
|
||||
return [
|
||||
{
|
||||
frame: index,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/app",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"private": true,
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
|
||||
@@ -48,6 +48,8 @@ export const ACP_PROVIDER_ICON_SVGS = {
|
||||
goose:
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24">\n <path fill="currentColor" d="M20.9093 19.3861L19.5185 18.2413C18.7624 17.619 18.1189 16.8713 17.6157 16.0313C16.9205 14.8706 15.9599 13.8912 14.8133 13.1735L14.2533 12.8475C14.0614 12.7141 13.9276 12.5062 13.9086 12.2716C13.8963 12.1204 13.9326 11.9852 14.0171 11.8662C14.3087 11.4553 15.896 9.74698 16.1722 9.51845C16.528 9.22442 16.9243 8.97987 17.2921 8.69986C17.3443 8.66 17.3968 8.62035 17.4485 8.57989C17.4503 8.57808 17.4529 8.57668 17.4545 8.57508C17.5725 8.48195 17.6838 8.383 17.7724 8.26563C18.2036 7.76631 18.195 7.3443 18.195 7.3443C18.195 7.3443 18.1954 7.3439 18.1956 7.3437C18.1497 7.23133 17.9847 6.88163 17.6492 6.71759C17.9458 6.71178 18.2805 6.82294 18.4323 6.97156C18.6148 6.68534 18.7328 6.49967 18.9162 6.18762C18.9599 6.11352 18.9831 5.97652 18.8996 5.89981C18.8996 5.89981 18.8992 5.89981 18.8988 5.89981C18.8988 5.89981 18.8988 5.8994 18.8988 5.899C18.8972 5.8974 18.8952 5.8962 18.8936 5.8946C18.892 5.893 18.891 5.89119 18.8892 5.88939C18.8892 5.88939 18.8888 5.88939 18.8884 5.88939C18.8884 5.88939 18.8884 5.88899 18.8884 5.88859C18.885 5.88518 18.8812 5.88258 18.8776 5.87938C18.8754 5.87717 18.8736 5.87457 18.8716 5.87217C18.8692 5.87016 18.8665 5.86836 18.8643 5.86616C18.8609 5.86275 18.8587 5.85855 18.8551 5.85534C18.8551 5.85534 18.8545 5.85514 18.8543 5.85534C18.8543 5.85534 18.8543 5.85494 18.8543 5.85454C18.8527 5.85294 18.8507 5.85174 18.8491 5.85013C18.8475 5.84853 18.8463 5.84653 18.8447 5.84493C18.8447 5.84493 18.8441 5.84473 18.8439 5.84493C18.8439 5.84493 18.8439 5.84453 18.8439 5.84413C18.7672 5.7606 18.6302 5.78384 18.5561 5.8275C18.1503 6.06625 17.7555 6.32322 17.3996 6.54855C17.3996 6.54855 16.9778 6.53973 16.4783 6.97116C16.3607 7.05989 16.2618 7.17125 16.1688 7.28902C16.167 7.29082 16.1654 7.29322 16.164 7.29503C16.1234 7.3465 16.0837 7.39898 16.0441 7.45145C15.7639 7.81939 15.5195 8.21556 15.2255 8.57128C14.9971 8.84768 13.2887 10.4348 12.8777 10.7264C12.7587 10.8109 12.6237 10.8474 12.4723 10.835C12.2379 10.8161 12.0298 10.6821 11.8965 10.4903L11.5704 9.93024C10.8527 8.78318 9.87332 7.82299 8.71264 7.12778C7.87262 6.62466 7.12514 5.98092 6.50264 5.22503L5.35778 3.83421C5.3013 3.76571 5.19314 3.77693 5.15268 3.85585C5.02249 4.10941 4.77393 4.64479 4.58346 5.36483C4.57885 5.38186 4.58286 5.39988 4.59407 5.4135C4.83082 5.69952 5.37901 6.32983 6.03196 6.863C6.07742 6.90005 6.04017 6.97336 5.98369 6.95774C5.42047 6.80432 4.87288 6.55796 4.46308 6.34805C4.42964 6.33103 4.38918 6.35226 4.38437 6.38951C4.32068 6.89985 4.30425 7.46027 4.37155 8.05112C4.37355 8.07035 4.38577 8.08697 4.4036 8.09479C4.87088 8.29808 5.61816 8.59311 6.40269 8.78078C6.45958 8.7944 6.45777 8.87632 6.40029 8.88733C5.78941 9.0023 5.14968 9.02794 4.62973 9.02113C4.59327 9.02073 4.56643 9.05518 4.57625 9.09023C4.6806 9.45896 4.822 9.8339 5.00847 10.2115C5.08559 10.3811 5.16951 10.5475 5.25944 10.7104C5.27486 10.7382 5.3047 10.7548 5.33655 10.7534C5.76577 10.7324 6.28452 10.6871 6.80608 10.595C6.89501 10.5794 6.94268 10.6964 6.86757 10.7466C6.51345 10.9834 6.13571 11.1873 5.7844 11.3551C5.73733 11.3777 5.72211 11.4378 5.75315 11.4797C5.96186 11.7625 6.19139 12.0301 6.44075 12.2794C6.44075 12.2794 7.66853 13.5441 7.70198 13.6432C8.41841 12.9096 9.59612 12.0964 10.8966 11.3864C9.15488 12.8036 8.18387 13.8499 7.69517 14.4444L7.35447 14.9225C7.17742 15.1708 7.02379 15.4346 6.89541 15.7112C6.46579 16.6356 5.75756 18.5051 5.75756 18.5051C5.70328 18.6515 5.74754 18.7959 5.84168 18.89C5.84388 18.8922 5.84609 18.8944 5.84849 18.8964C5.85069 18.8986 5.8527 18.901 5.8549 18.9032C5.94924 18.9976 6.09345 19.0416 6.23986 18.9874C6.23986 18.9874 8.10897 18.2791 9.03371 17.8495C9.31031 17.7211 9.57429 17.5673 9.82245 17.3905L10.349 17.0153C10.6278 16.8166 11.0096 16.8483 11.2517 17.0904L12.4655 18.3042C12.7148 18.5535 12.9824 18.7831 13.2652 18.9918C13.3073 19.0226 13.3672 19.0076 13.3898 18.9605C13.5579 18.6094 13.7618 18.2313 13.9983 17.8774C14.0486 17.8022 14.1657 17.8501 14.1499 17.9388C14.0576 18.4606 14.0127 18.9794 13.9915 19.4084C13.9899 19.44 14.0067 19.4701 14.0345 19.4855C14.1972 19.5756 14.3636 19.6595 14.5335 19.7364C14.911 19.9229 15.2862 20.0645 15.6547 20.1687C15.6897 20.1785 15.7242 20.1516 15.7238 20.1152C15.7168 19.595 15.7424 18.9553 15.8576 18.3446C15.8684 18.2869 15.9503 18.2851 15.9641 18.3422C16.1516 19.127 16.4466 19.8742 16.6501 20.3413C16.6579 20.3591 16.6744 20.3712 16.6938 20.3734C17.2847 20.4407 17.8451 20.4242 18.3554 20.3606C18.3929 20.3559 18.4141 20.3155 18.3969 20.2818C18.187 19.872 17.9406 19.3241 17.7872 18.7612C17.7718 18.7046 17.8449 18.6675 17.8819 18.713C18.4151 19.3659 19.0454 19.9141 19.3314 20.1508C19.345 20.1621 19.3633 20.1659 19.3801 20.1615C20.1003 19.9712 20.6357 19.7226 20.8891 19.5922C20.968 19.5518 20.9792 19.4436 20.9107 19.3871L20.9093 19.3861Z"/>\n</svg>\n',
|
||||
grok: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 1024 1024" fill="none">\n <path fill="currentColor" d="M395.479 633.828L735.91 381.105C752.599 368.715 776.454 373.548 784.406 392.792C826.26 494.285 807.561 616.253 724.288 699.996C641.016 783.739 525.151 802.104 419.247 760.277L303.556 814.143C469.49 928.202 670.987 899.995 796.901 773.282C896.776 672.843 927.708 535.937 898.785 412.476L899.047 412.739C857.105 231.37 909.358 158.874 1016.4 10.6326C1018.93 7.11771 1021.47 3.60279 1024 0L883.144 141.651V141.212L395.392 633.916"/>\n <path fill="currentColor" d="M325.226 695.251C206.128 580.84 226.662 403.776 328.285 301.668C403.431 226.097 526.549 195.254 634.026 240.596L749.454 186.994C728.657 171.88 702.007 155.623 671.424 144.2C533.19 86.9942 367.693 115.465 255.323 228.382C147.234 337.081 113.244 504.215 171.613 646.833C215.216 753.423 143.739 828.818 71.7385 904.916C46.2237 931.893 20.6216 958.87 0 987.429L325.139 695.339"/>\n</svg>\n',
|
||||
hoplite:
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="1.394 1.679 8.494 7.828" fill="currentColor"><path d="M8.237 7.813C8.276 7.789 8.327 7.796 8.358 7.83L9.741 9.346C9.797 9.407 9.754 9.506 9.671 9.507H8.977C8.924 9.507 8.881 9.463 8.881 9.41V9.125C8.881 9.089 8.861 9.057 8.83 9.04L7.589 8.379C7.524 8.344 7.521 8.251 7.584 8.212L8.237 7.813ZM3.944 1.679C4.502 1.679 5.052 1.82 5.54 2.09L5.962 2.323C6.024 2.358 6.029 2.446 5.97 2.486L5.091 3.09C5.065 3.108 5.05 3.137 5.05 3.169V3.495C5.05 3.529 5.032 3.561 5.003 3.578L4.68 3.769C4.594 3.82 4.498 3.722 4.549 3.637L4.592 3.566C4.63 3.502 4.584 3.421 4.51 3.421H4.028C3.925 3.421 3.894 3.562 3.989 3.604L4.377 3.775C4.448 3.806 4.455 3.904 4.389 3.944L3.77 4.323C3.755 4.332 3.737 4.337 3.72 4.337H3.361C3.309 4.337 3.268 4.379 3.268 4.431C3.268 4.484 3.309 4.526 3.361 4.526H3.779C3.797 4.526 3.814 4.521 3.829 4.513L7.599 2.272C8.135 1.954 8.815 2.008 9.294 2.407C9.307 2.418 9.314 2.434 9.314 2.451V2.729C9.315 2.812 9.413 2.856 9.475 2.8L9.728 2.57C9.789 2.514 9.888 2.558 9.888 2.641V5.812C9.888 5.865 9.845 5.908 9.792 5.908H9.359C9.331 5.908 9.303 5.895 9.285 5.873L8.374 4.773C8.337 4.728 8.268 4.728 8.229 4.771L7.468 5.625C7.429 5.669 7.438 5.737 7.487 5.769L9.038 6.776C9.098 6.815 9.096 6.903 9.035 6.939L6.618 8.363C6.556 8.4 6.478 8.358 6.474 8.286L6.439 7.633C6.437 7.578 6.48 7.532 6.535 7.532H6.925C6.948 7.532 6.971 7.523 6.988 7.508L7.211 7.31C7.276 7.252 7.236 7.144 7.148 7.142L5.991 7.118H1.49C1.437 7.118 1.394 7.075 1.394 7.022V3.308C1.394 3.255 1.437 3.212 1.49 3.212H2.544C2.597 3.212 2.64 3.169 2.64 3.116V2.969C2.64 2.916 2.597 2.873 2.544 2.873H1.461C1.366 2.873 1.329 2.75 1.408 2.697L2.134 2.221C2.672 1.867 3.301 1.679 3.944 1.679Z"/></svg>\n',
|
||||
junie:
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 40 40" fill="none">\n <path d="M25 15H35V16.75C35 29 30.5001 35 16.5001 35H15V25H16.5001C22.6251 25 25 22.875 25 16.75V15Z" fill="currentColor"/>\n <rect x="5" y="15" width="10" height="10" fill="currentColor"/>\n <rect x="15" y="5" width="10" height="10" fill="currentColor"/>\n</svg>\n',
|
||||
kilo: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 40 40">\n <path fill="currentColor" d="M27.9998324,34.6666921h6.6666279v5.3333023h-8.3809037l-3.6190266-3.6190266v-8.3809037h5.3333023v6.6666279ZM39.9997627,26.2857884l-3.6190266-3.6190266h-8.3809037v5.3333023h6.6666279v6.6666279h5.3333023v-8.3809037ZM17.3332326,22.6667578h-5.3333023v5.3333023h5.3333023v-5.3333023ZM0,36.3809638l3.6190266,3.6190266h13.714206v-5.3333023H5.3333023v-11.9999302H0v13.714206ZM33.9600959,11.9999247V3.619021L30.3410693-.0000056h-7.6745392v5.3333023h5.9602634v6.6666279h-5.9602634v5.3333023h17.3332326v-5.3333023h-6.0396668ZM5.3333023,0H0v17.3332326h5.3333023v-5.9999651h6.6666279v5.9999651h5.3333023v-5.9999651l-5.3333023-5.3333023h-6.6666279V0ZM17.3332326,0h-5.3333023v5.9999651h5.3333023V0Z"/>\n</svg>\n',
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="1.394 1.679 8.494 7.828" fill="currentColor"><path d="M8.237 7.813C8.276 7.789 8.327 7.796 8.358 7.83L9.741 9.346C9.797 9.407 9.754 9.506 9.671 9.507H8.977C8.924 9.507 8.881 9.463 8.881 9.41V9.125C8.881 9.089 8.861 9.057 8.83 9.04L7.589 8.379C7.524 8.344 7.521 8.251 7.584 8.212L8.237 7.813ZM3.944 1.679C4.502 1.679 5.052 1.82 5.54 2.09L5.962 2.323C6.024 2.358 6.029 2.446 5.97 2.486L5.091 3.09C5.065 3.108 5.05 3.137 5.05 3.169V3.495C5.05 3.529 5.032 3.561 5.003 3.578L4.68 3.769C4.594 3.82 4.498 3.722 4.549 3.637L4.592 3.566C4.63 3.502 4.584 3.421 4.51 3.421H4.028C3.925 3.421 3.894 3.562 3.989 3.604L4.377 3.775C4.448 3.806 4.455 3.904 4.389 3.944L3.77 4.323C3.755 4.332 3.737 4.337 3.72 4.337H3.361C3.309 4.337 3.268 4.379 3.268 4.431C3.268 4.484 3.309 4.526 3.361 4.526H3.779C3.797 4.526 3.814 4.521 3.829 4.513L7.599 2.272C8.135 1.954 8.815 2.008 9.294 2.407C9.307 2.418 9.314 2.434 9.314 2.451V2.729C9.315 2.812 9.413 2.856 9.475 2.8L9.728 2.57C9.789 2.514 9.888 2.558 9.888 2.641V5.812C9.888 5.865 9.845 5.908 9.792 5.908H9.359C9.331 5.908 9.303 5.895 9.285 5.873L8.374 4.773C8.337 4.728 8.268 4.728 8.229 4.771L7.468 5.625C7.429 5.669 7.438 5.737 7.487 5.769L9.038 6.776C9.098 6.815 9.096 6.903 9.035 6.939L6.618 8.363C6.556 8.4 6.478 8.358 6.474 8.286L6.439 7.633C6.437 7.578 6.48 7.532 6.535 7.532H6.925C6.948 7.532 6.971 7.523 6.988 7.508L7.211 7.31C7.276 7.252 7.236 7.144 7.148 7.142L5.991 7.118H1.49C1.437 7.118 1.394 7.075 1.394 7.022V3.308C1.394 3.255 1.437 3.212 1.49 3.212H2.544C2.597 3.212 2.64 3.169 2.64 3.116V2.969C2.64 2.916 2.597 2.873 2.544 2.873H1.461C1.366 2.873 1.329 2.75 1.408 2.697L2.134 2.221C2.672 1.867 3.301 1.679 3.944 1.679Z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
@@ -1,19 +1,21 @@
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Pressable, Text, View } from "react-native";
|
||||
import { Text, View, type LayoutChangeEvent } from "react-native";
|
||||
import { SvgXml } from "react-native-svg";
|
||||
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||
import { ExternalLink, PackagePlus, Search } from "lucide-react-native";
|
||||
import { PackagePlus } from "lucide-react-native";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { isWeb } from "@/constants/platform";
|
||||
import { ExternalLink } from "@/components/ui/external-link";
|
||||
import { SearchField } from "@/components/ui/search-field";
|
||||
import { StatusBadge } from "@/components/ui/status-badge";
|
||||
import { rankProviderCatalog } from "@/components/provider-catalog-search";
|
||||
import {
|
||||
useAcpProviderCatalog,
|
||||
type AcpProviderCatalogItem,
|
||||
} from "@/hooks/use-acp-provider-catalog";
|
||||
import { useProvidersSnapshot } from "@/hooks/use-providers-snapshot";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
import { openExternalUrl } from "@/utils/open-external-url";
|
||||
import { EditingTextInput as TextInput } from "@/components/ui/text-input";
|
||||
import { SPACING, type Theme } from "@/styles/theme";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
|
||||
interface ProviderCatalogListProps {
|
||||
serverId: string;
|
||||
@@ -21,52 +23,43 @@ interface ProviderCatalogListProps {
|
||||
onInstall: (entry: AcpProviderCatalogItem) => Promise<void> | void;
|
||||
}
|
||||
|
||||
const SEARCH_ICON_SIZE = 16;
|
||||
const PROVIDER_FALLBACK_ICON_SIZE = 20;
|
||||
const PROVIDER_REMOTE_ICON_SIZE = 24;
|
||||
const TILE_GAP = SPACING[3];
|
||||
/** Narrowest tile that keeps the icon, type badge, install link, and Add on one row. */
|
||||
const MIN_TILE_WIDTH = 300;
|
||||
const MAX_COLUMNS = 4;
|
||||
|
||||
const ThemedPackagePlus = withUnistyles(PackagePlus);
|
||||
const ThemedSvgXml = withUnistyles(SvgXml);
|
||||
const ThemedSearch = withUnistyles(Search);
|
||||
const ThemedExternalLink = withUnistyles(ExternalLink);
|
||||
const ThemedTextInput = withUnistyles(TextInput, (theme) => ({
|
||||
placeholderTextColor: theme.colors.foregroundMuted,
|
||||
}));
|
||||
|
||||
const foregroundColorMapping = (theme: Theme) => ({ color: theme.colors.foreground });
|
||||
const foregroundMutedColorMapping = (theme: Theme) => ({
|
||||
color: theme.colors.foregroundMuted,
|
||||
});
|
||||
|
||||
function matchesSearch(entry: AcpProviderCatalogItem, query: string): boolean {
|
||||
const normalized = query.trim().toLowerCase();
|
||||
if (!normalized) return true;
|
||||
return [entry.title, entry.id, entry.description].some((value) =>
|
||||
value.toLowerCase().includes(normalized),
|
||||
);
|
||||
function columnCountForWidth(width: number): number {
|
||||
const fits = Math.floor((width + TILE_GAP) / (MIN_TILE_WIDTH + TILE_GAP));
|
||||
return Math.min(MAX_COLUMNS, Math.max(1, fits));
|
||||
}
|
||||
|
||||
interface CatalogRowProps {
|
||||
interface CatalogTileProps {
|
||||
entry: AcpProviderCatalogItem;
|
||||
/** `undefined` until the grid is measured, or in a single column; the tile fills the row. */
|
||||
width: number | undefined;
|
||||
installing: boolean;
|
||||
onInstall: (entry: AcpProviderCatalogItem) => void;
|
||||
}
|
||||
|
||||
function CatalogRow({ entry, installing, onInstall }: CatalogRowProps) {
|
||||
function CatalogTile({ entry, width, installing, onInstall }: CatalogTileProps) {
|
||||
const { t } = useTranslation();
|
||||
const actionLabel = installing
|
||||
? t("providerCatalog.actions.adding")
|
||||
: t("providerCatalog.actions.add");
|
||||
const handleInstall = useCallback(() => {
|
||||
onInstall(entry);
|
||||
}, [entry, onInstall]);
|
||||
|
||||
const handleOpenInstallLink = useCallback(() => {
|
||||
void openExternalUrl(entry.installLink);
|
||||
}, [entry.installLink]);
|
||||
const tileStyle = useMemo(
|
||||
() => [settingsStyles.card, styles.tile, width === undefined ? styles.tileFull : { width }],
|
||||
[width],
|
||||
);
|
||||
|
||||
return (
|
||||
<View style={styles.row}>
|
||||
<View style={tileStyle} testID={`provider-catalog-tile-${entry.id}`}>
|
||||
<View style={styles.iconFrame}>
|
||||
{entry.iconSvg ? (
|
||||
<ThemedSvgXml
|
||||
@@ -79,42 +72,33 @@ function CatalogRow({ entry, installing, onInstall }: CatalogRowProps) {
|
||||
<ThemedPackagePlus size={PROVIDER_FALLBACK_ICON_SIZE} uniProps={foregroundColorMapping} />
|
||||
)}
|
||||
</View>
|
||||
<View style={styles.textColumn}>
|
||||
<View style={styles.titleRow}>
|
||||
<Text style={styles.name} numberOfLines={1}>
|
||||
{entry.title}
|
||||
</Text>
|
||||
<Text style={styles.version} numberOfLines={1}>
|
||||
{entry.version}
|
||||
</Text>
|
||||
</View>
|
||||
<Text style={styles.description} numberOfLines={1}>
|
||||
{entry.description || entry.id}
|
||||
<View style={styles.details}>
|
||||
<Text style={styles.name} numberOfLines={1}>
|
||||
{entry.title}
|
||||
</Text>
|
||||
<Pressable
|
||||
accessibilityRole="link"
|
||||
accessibilityLabel={t("providerCatalog.actions.installInstructionsFor", {
|
||||
provider: entry.title,
|
||||
})}
|
||||
onPress={handleOpenInstallLink}
|
||||
style={styles.installLink}
|
||||
>
|
||||
<Text style={styles.installLinkText} numberOfLines={1}>
|
||||
{t("providerCatalog.actions.installInstructions")}
|
||||
</Text>
|
||||
<ThemedExternalLink size={12} uniProps={foregroundMutedColorMapping} />
|
||||
</Pressable>
|
||||
<View style={styles.metaRow}>
|
||||
{/* The catalog is the ACP registry, so every entry it offers is an ACP provider. */}
|
||||
<StatusBadge label={t("providerCatalog.types.acp")} size="xs" />
|
||||
<ExternalLink
|
||||
href={entry.installLink}
|
||||
label={t("providerCatalog.actions.installInstructions")}
|
||||
accessibilityLabel={t("providerCatalog.actions.installInstructionsFor", {
|
||||
provider: entry.title,
|
||||
})}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="default"
|
||||
size="xs"
|
||||
variant="outline"
|
||||
disabled={installing}
|
||||
loading={installing}
|
||||
onPress={handleInstall}
|
||||
style={styles.actionButton}
|
||||
accessibilityLabel={t("providerCatalog.actions.addProvider", { provider: entry.title })}
|
||||
style={styles.addButton}
|
||||
testID={`install-provider-${entry.id}`}
|
||||
>
|
||||
{actionLabel}
|
||||
{installing ? t("providerCatalog.actions.adding") : t("providerCatalog.actions.add")}
|
||||
</Button>
|
||||
</View>
|
||||
);
|
||||
@@ -129,6 +113,7 @@ export function ProviderCatalogList({
|
||||
const { entries: catalogEntries } = useAcpProviderCatalog();
|
||||
const { entries: providerEntries } = useProvidersSnapshot(serverId);
|
||||
const [search, setSearch] = useState("");
|
||||
const [gridWidth, setGridWidth] = useState<number | null>(null);
|
||||
|
||||
const installedIds = useMemo(
|
||||
() => new Set(providerEntries?.map((entry) => entry.provider) ?? []),
|
||||
@@ -137,41 +122,48 @@ export function ProviderCatalogList({
|
||||
|
||||
const availableEntries = useMemo(
|
||||
() =>
|
||||
catalogEntries
|
||||
.filter((entry) => !installedIds.has(entry.id))
|
||||
.filter((entry) => matchesSearch(entry, search)),
|
||||
rankProviderCatalog(
|
||||
catalogEntries.filter((entry) => !installedIds.has(entry.id)),
|
||||
search,
|
||||
),
|
||||
[catalogEntries, installedIds, search],
|
||||
);
|
||||
|
||||
const handleGridLayout = useCallback((event: LayoutChangeEvent) => {
|
||||
setGridWidth(event.nativeEvent.layout.width);
|
||||
}, []);
|
||||
|
||||
const tileWidth = useMemo(() => {
|
||||
if (gridWidth === null) return undefined;
|
||||
const columns = columnCountForWidth(gridWidth);
|
||||
if (columns === 1) return undefined;
|
||||
return Math.floor((gridWidth - TILE_GAP * (columns - 1)) / columns);
|
||||
}, [gridWidth]);
|
||||
|
||||
return (
|
||||
<View>
|
||||
<View style={styles.searchField}>
|
||||
<View style={styles.searchIcon}>
|
||||
<ThemedSearch size={SEARCH_ICON_SIZE} uniProps={foregroundMutedColorMapping} />
|
||||
</View>
|
||||
<ThemedTextInput
|
||||
testID="provider-catalog-search"
|
||||
initialValue={search}
|
||||
<View style={styles.searchRail}>
|
||||
<SearchField
|
||||
value={search}
|
||||
onChangeText={setSearch}
|
||||
accessibilityLabel={t("providerCatalog.search")}
|
||||
placeholder={t("providerCatalog.search")}
|
||||
// @ts-expect-error - outlineStyle is web-only
|
||||
style={[styles.searchInput, isWeb && { outlineStyle: "none" }]}
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
clearAccessibilityLabel={t("providerCatalog.clearSearch")}
|
||||
testID="provider-catalog-search"
|
||||
clearTestID="provider-catalog-search-clear"
|
||||
/>
|
||||
</View>
|
||||
|
||||
{availableEntries.length === 0 ? (
|
||||
<View style={styles.stateBox}>
|
||||
<View style={[settingsStyles.card, styles.stateBox]}>
|
||||
<Text style={styles.stateText}>{t("providerCatalog.noProviders")}</Text>
|
||||
</View>
|
||||
) : (
|
||||
<View style={styles.list}>
|
||||
<View style={styles.grid} onLayout={handleGridLayout}>
|
||||
{availableEntries.map((entry) => (
|
||||
<CatalogRow
|
||||
<CatalogTile
|
||||
key={entry.id}
|
||||
entry={entry}
|
||||
width={tileWidth}
|
||||
installing={installingProviderId === entry.id}
|
||||
onInstall={onInstall}
|
||||
/>
|
||||
@@ -183,101 +175,56 @@ export function ProviderCatalogList({
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
searchField: {
|
||||
searchRail: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[2],
|
||||
backgroundColor: theme.colors.surface2,
|
||||
borderRadius: theme.borderRadius.lg,
|
||||
borderWidth: 1,
|
||||
borderColor: theme.colors.border,
|
||||
paddingHorizontal: theme.spacing[3],
|
||||
marginBottom: theme.spacing[3],
|
||||
},
|
||||
searchIcon: {
|
||||
width: 18,
|
||||
alignItems: "center",
|
||||
grid: {
|
||||
flexDirection: "row",
|
||||
flexWrap: "wrap",
|
||||
gap: TILE_GAP,
|
||||
},
|
||||
searchInput: {
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
paddingVertical: theme.spacing[3],
|
||||
color: theme.colors.foreground,
|
||||
fontSize: theme.fontSize.base,
|
||||
},
|
||||
list: {
|
||||
borderRadius: theme.borderRadius.lg,
|
||||
borderWidth: 1,
|
||||
borderColor: theme.colors.border,
|
||||
overflow: "hidden",
|
||||
},
|
||||
row: {
|
||||
tile: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[3],
|
||||
padding: theme.spacing[3],
|
||||
borderBottomWidth: 1,
|
||||
borderBottomColor: theme.colors.border,
|
||||
},
|
||||
tileFull: {
|
||||
width: "100%",
|
||||
},
|
||||
details: {
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
gap: theme.spacing[1],
|
||||
},
|
||||
iconFrame: {
|
||||
flexShrink: 0,
|
||||
width: 36,
|
||||
height: 36,
|
||||
borderRadius: theme.borderRadius.md,
|
||||
backgroundColor: theme.colors.surface2,
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
},
|
||||
addButton: {
|
||||
flexShrink: 0,
|
||||
},
|
||||
textColumn: {
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
gap: theme.spacing[1],
|
||||
},
|
||||
titleRow: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[2],
|
||||
minWidth: 0,
|
||||
},
|
||||
name: {
|
||||
color: theme.colors.foreground,
|
||||
fontSize: theme.fontSize.base,
|
||||
fontWeight: theme.fontWeight.medium,
|
||||
flexShrink: 1,
|
||||
fontWeight: theme.fontWeight.normal,
|
||||
},
|
||||
version: {
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontSize: theme.fontSize.sm,
|
||||
flexShrink: 0,
|
||||
},
|
||||
description: {
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontSize: theme.fontSize.sm,
|
||||
},
|
||||
installLink: {
|
||||
alignSelf: "flex-start",
|
||||
metaRow: {
|
||||
flexDirection: "row",
|
||||
flexWrap: "wrap",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[1],
|
||||
maxWidth: "100%",
|
||||
},
|
||||
installLinkText: {
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontSize: theme.fontSize.sm,
|
||||
},
|
||||
actionButton: {
|
||||
width: 92,
|
||||
flexShrink: 0,
|
||||
gap: theme.spacing[2],
|
||||
},
|
||||
stateBox: {
|
||||
minHeight: 96,
|
||||
borderRadius: theme.borderRadius.lg,
|
||||
borderWidth: 1,
|
||||
borderColor: theme.colors.border,
|
||||
backgroundColor: theme.colors.surface1,
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
gap: theme.spacing[3],
|
||||
padding: theme.spacing[4],
|
||||
},
|
||||
stateText: {
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { rankProviderCatalog } from "./provider-catalog-search";
|
||||
|
||||
const entries = [
|
||||
{ id: "kiro-cli", title: "Kiro CLI" },
|
||||
{ id: "goose", title: "goose" },
|
||||
{ id: "kimi", title: "Kimi Code CLI" },
|
||||
{ id: "gemini", title: "Gemini CLI" },
|
||||
{ id: "qwen-code", title: "Qwen Code" },
|
||||
{ id: "codex-acp", title: "Codex" },
|
||||
];
|
||||
|
||||
function titles(list: { title: string }[]): string[] {
|
||||
return list.map((entry) => entry.title);
|
||||
}
|
||||
|
||||
describe("rankProviderCatalog", () => {
|
||||
it("lists every provider alphabetically by name without a query", () => {
|
||||
expect(titles(rankProviderCatalog(entries, " "))).toEqual([
|
||||
"Codex",
|
||||
"Gemini CLI",
|
||||
"goose",
|
||||
"Kimi Code CLI",
|
||||
"Kiro CLI",
|
||||
"Qwen Code",
|
||||
]);
|
||||
});
|
||||
|
||||
it("ranks the strongest match first and drops providers that do not match", () => {
|
||||
expect(titles(rankProviderCatalog(entries, "cod"))).toEqual([
|
||||
"Codex",
|
||||
"Kimi Code CLI",
|
||||
"Qwen Code",
|
||||
]);
|
||||
});
|
||||
|
||||
it("matches in-word subsequences and multiple tokens like the other pickers", () => {
|
||||
expect(titles(rankProviderCatalog(entries, "gmni"))).toEqual(["Gemini CLI"]);
|
||||
expect(titles(rankProviderCatalog(entries, "qw cod"))).toEqual(["Qwen Code"]);
|
||||
});
|
||||
|
||||
it("matches the provider id", () => {
|
||||
expect(titles(rankProviderCatalog(entries, "kiro-cli"))).toEqual(["Kiro CLI"]);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,34 @@
|
||||
import {
|
||||
compareMatchScores,
|
||||
scoreTextFields,
|
||||
type MatchScore,
|
||||
} from "@getpaseo/protocol/search/text-match";
|
||||
|
||||
export interface SearchableCatalogEntry {
|
||||
id: string;
|
||||
title: string;
|
||||
}
|
||||
|
||||
function compareTitles(a: SearchableCatalogEntry, b: SearchableCatalogEntry): number {
|
||||
return a.title.localeCompare(b.title, undefined, { sensitivity: "base" });
|
||||
}
|
||||
|
||||
/**
|
||||
* Orders the Add provider catalog. Without a query the list is alphabetical by
|
||||
* name. With a query it uses the pickers' ranked matcher over the fields the
|
||||
* tile shows (name and id), best match first, ties alphabetical.
|
||||
*/
|
||||
export function rankProviderCatalog<T extends SearchableCatalogEntry>(
|
||||
entries: readonly T[],
|
||||
query: string,
|
||||
): T[] {
|
||||
if (!query.trim()) return [...entries].sort(compareTitles);
|
||||
|
||||
const scored: { entry: T; score: MatchScore }[] = [];
|
||||
for (const entry of entries) {
|
||||
const score = scoreTextFields(query, [entry.title, entry.id]);
|
||||
if (score) scored.push({ entry, score });
|
||||
}
|
||||
scored.sort((a, b) => compareMatchScores(a.score, b.score) || compareTitles(a.entry, b.entry));
|
||||
return scored.map(({ entry }) => entry);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ import { useToast } from "@/contexts/toast-context";
|
||||
import { toErrorMessage } from "@/utils/error-messages";
|
||||
import { showProviderNoticeToast } from "@/utils/provider-notice-toast";
|
||||
import { applyCheckoutStatusUpdateFromEvent } from "@/git/checkout-status-cache";
|
||||
import { useProviderSubagentStore } from "@/subagents/provider-store";
|
||||
import { resyncProviderSubagents, useProviderSubagentStore } from "@/subagents/provider-store";
|
||||
|
||||
// Re-export types from session-store and draft-store for backward compatibility
|
||||
export type { DraftInput } from "@/stores/draft-store";
|
||||
@@ -532,9 +532,14 @@ function SessionProviderInternal({ children, serverId, client }: SessionProvider
|
||||
}
|
||||
});
|
||||
|
||||
const unsubProviderSubagentUpdate = onFeed("agent.provider_subagents.update", (message) => {
|
||||
if (message.type !== "agent.provider_subagents.update") return;
|
||||
useProviderSubagentStore.getState().applyUpdate(serverId, message.payload);
|
||||
const unsubProviderSubagentUpdate = feeds.subscribe({
|
||||
snapshot: () => {
|
||||
void resyncProviderSubagents(client, serverId);
|
||||
},
|
||||
update: (message) => {
|
||||
if (message.type !== "agent.provider_subagents.update") return;
|
||||
useProviderSubagentStore.getState().applyUpdate(serverId, message.payload);
|
||||
},
|
||||
});
|
||||
|
||||
const unsubCheckoutStatusUpdate = onFeed("checkout_status_update", (message) => {
|
||||
|
||||
@@ -8,6 +8,7 @@ export interface AcpProviderCatalogEntry {
|
||||
iconSvg: string | null;
|
||||
installLink: string;
|
||||
command: readonly [string, ...string[]];
|
||||
bundledProvider?: boolean;
|
||||
env?: Readonly<Record<string, string>>;
|
||||
params?: Readonly<Record<string, unknown>>;
|
||||
}
|
||||
@@ -238,6 +239,16 @@ const CATALOG_DATA = [
|
||||
installLink: "https://hermes-agent.nousresearch.com/docs/user-guide/features/acp",
|
||||
command: ["hermes", "acp"],
|
||||
},
|
||||
{
|
||||
id: "hoplite",
|
||||
bundledProvider: true,
|
||||
title: "Hoplite",
|
||||
description: "Cloud coding agent through the local hoplite acp bridge",
|
||||
version: "manual",
|
||||
iconId: "hoplite",
|
||||
installLink: "https://hoplite.sh/docs/cli#install",
|
||||
command: ["hoplite", "acp"],
|
||||
},
|
||||
{
|
||||
id: "junie",
|
||||
title: "Junie",
|
||||
@@ -389,6 +400,7 @@ export const ACP_PROVIDER_CATALOG: AcpProviderCatalogEntry[] = CATALOG_DATA.map(
|
||||
version: entry.version,
|
||||
installLink: entry.installLink,
|
||||
command: entry.command,
|
||||
bundledProvider: "bundledProvider" in entry ? entry.bundledProvider : undefined,
|
||||
env: "env" in entry ? entry.env : undefined,
|
||||
params: "params" in entry ? entry.params : undefined,
|
||||
iconSvg: entry.iconId ? (ACP_PROVIDER_ICON_SVGS[entry.iconId] ?? null) : null,
|
||||
|
||||
@@ -44,6 +44,7 @@ describe("ACP provider catalog", () => {
|
||||
expect(findProvider("codewhale").command).toEqual(["codewhale", "serve", "--acp"]);
|
||||
expect(findProvider("devin").command).toEqual(["devin", "acp"]);
|
||||
expect(findProvider("goose").command).toEqual(["goose", "acp"]);
|
||||
expect(findProvider("hoplite").command).toEqual(["hoplite", "acp"]);
|
||||
expect(findProvider("junie").command).toEqual(["junie", "--acp", "true"]);
|
||||
expect(findProvider("kiro").command).toEqual(["kiro-cli", "acp"]);
|
||||
expect(findProvider("poolside").command).toEqual(["pool", "acp"]);
|
||||
@@ -59,6 +60,32 @@ describe("ACP provider catalog", () => {
|
||||
expect(findProvider("minimax-code").iconSvg).toContain("<svg");
|
||||
});
|
||||
|
||||
it("offers Hoplite through its local ACP bridge with the Hoplite mark", () => {
|
||||
expect(findProvider("hoplite")).toMatchObject({
|
||||
title: "Hoplite",
|
||||
command: ["hoplite", "acp"],
|
||||
installLink: "https://hoplite.sh/docs/cli#install",
|
||||
});
|
||||
expect(buildAcpProviderConfigPatch(findProvider("hoplite"), true)).toEqual({
|
||||
providers: {
|
||||
hoplite: { enabled: true },
|
||||
},
|
||||
});
|
||||
const ids = getAcpProviderCatalog().map((entry) => entry.id);
|
||||
expect(ids.indexOf("hermes")).toBeLessThan(ids.indexOf("hoplite"));
|
||||
expect(ids.indexOf("hoplite")).toBeLessThan(ids.indexOf("junie"));
|
||||
expect(findProvider("hoplite").iconSvg).toContain('fill="currentColor"');
|
||||
});
|
||||
|
||||
it.each([undefined, false])(
|
||||
"rejects unsupported bundled Hoplite before producing a patch (%s)",
|
||||
(supported) => {
|
||||
expect(() => buildAcpProviderConfigPatch(findProvider("hoplite"), supported)).toThrow(
|
||||
"Update the host to add Hoplite.",
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
it("maps a catalog entry to the daemon provider config patch", () => {
|
||||
expect(buildAcpProviderConfigPatch(findProvider("amp-acp"))).toEqual({
|
||||
providers: {
|
||||
|
||||
@@ -10,7 +10,13 @@ export function getAcpProviderCatalog(): AcpProviderCatalogItem[] {
|
||||
|
||||
export function buildAcpProviderConfigPatch(
|
||||
entry: AcpProviderCatalogItem,
|
||||
supportsHopliteProvider = false,
|
||||
): MutableDaemonConfigPatch {
|
||||
if (entry.bundledProvider) {
|
||||
// COMPAT(hopliteProvider): added after v0.11.2, remove after 2027-04-15 once host floor includes the bundled adapter.
|
||||
if (!supportsHopliteProvider) throw new Error("Update the host to add Hoplite.");
|
||||
return { providers: { [entry.id]: { enabled: true } } };
|
||||
}
|
||||
return {
|
||||
providers: {
|
||||
[entry.id]: {
|
||||
|
||||
@@ -1650,14 +1650,19 @@ export const ar: TranslationResources = {
|
||||
title: "إضافة مزود",
|
||||
search: "مقدمي البحث",
|
||||
noProviders: "لم يتم العثور على مقدمي الخدمات",
|
||||
clearSearch: "مسح البحث",
|
||||
actions: {
|
||||
add: "يضيف",
|
||||
addProvider: "إضافة {{provider}}",
|
||||
adding: "إضافة",
|
||||
installed: "تم التثبيت",
|
||||
cancel: "يلغي",
|
||||
installInstructions: "تعليمات التثبيت",
|
||||
installInstructionsFor: "تعليمات تثبيت{{provider}}",
|
||||
},
|
||||
types: {
|
||||
acp: "ACP",
|
||||
},
|
||||
errors: {
|
||||
unableToInstall: "غير قادر على تثبيت الموفر",
|
||||
},
|
||||
|
||||
@@ -1675,14 +1675,19 @@ export const en = {
|
||||
title: "Add provider",
|
||||
search: "Search providers",
|
||||
noProviders: "No providers found",
|
||||
clearSearch: "Clear search",
|
||||
actions: {
|
||||
add: "Add",
|
||||
addProvider: "Add {{provider}}",
|
||||
adding: "Adding",
|
||||
installed: "Installed",
|
||||
cancel: "Cancel",
|
||||
installInstructions: "Install instructions",
|
||||
installInstructionsFor: "{{provider}} install instructions",
|
||||
},
|
||||
types: {
|
||||
acp: "ACP",
|
||||
},
|
||||
errors: {
|
||||
unableToInstall: "Unable to install provider",
|
||||
},
|
||||
|
||||
@@ -1696,14 +1696,19 @@ export const es: TranslationResources = {
|
||||
title: "Agregar proveedor",
|
||||
search: "Proveedores de búsqueda",
|
||||
noProviders: "No se encontraron proveedores",
|
||||
clearSearch: "Borrar búsqueda",
|
||||
actions: {
|
||||
add: "Agregar",
|
||||
addProvider: "Añadir {{provider}}",
|
||||
adding: "Añadiendo",
|
||||
installed: "Instalado",
|
||||
cancel: "Cancelar",
|
||||
installInstructions: "Instrucciones de instalación",
|
||||
installInstructionsFor: "Instrucciones de instalación de{{provider}}",
|
||||
},
|
||||
types: {
|
||||
acp: "ACP",
|
||||
},
|
||||
errors: {
|
||||
unableToInstall: "No se puede instalar el proveedor",
|
||||
},
|
||||
|
||||
@@ -1692,14 +1692,19 @@ export const fr: TranslationResources = {
|
||||
title: "Ajouter un fournisseur",
|
||||
search: "Rechercher des fournisseurs",
|
||||
noProviders: "Aucun fournisseur trouvé",
|
||||
clearSearch: "Effacer la recherche",
|
||||
actions: {
|
||||
add: "Ajouter",
|
||||
addProvider: "Ajouter {{provider}}",
|
||||
adding: "Ajout…",
|
||||
installed: "Installé",
|
||||
cancel: "Annuler",
|
||||
installInstructions: "Instructions d’installation",
|
||||
installInstructionsFor: "Instructions d’installation de {{provider}}",
|
||||
},
|
||||
types: {
|
||||
acp: "ACP",
|
||||
},
|
||||
errors: {
|
||||
unableToInstall: "Impossible d’installer le fournisseur",
|
||||
},
|
||||
|
||||
@@ -1667,14 +1667,19 @@ export const ja: TranslationResources = {
|
||||
title: "プロバイダーを追加",
|
||||
search: "プロバイダーを検索",
|
||||
noProviders: "プロバイダーが見つかりません",
|
||||
clearSearch: "検索をクリア",
|
||||
actions: {
|
||||
add: "追加",
|
||||
addProvider: "{{provider}} を追加",
|
||||
adding: "追加中",
|
||||
installed: "インストール済み",
|
||||
cancel: "キャンセル",
|
||||
installInstructions: "インストール手順",
|
||||
installInstructionsFor: "{{provider}}のインストール手順",
|
||||
},
|
||||
types: {
|
||||
acp: "ACP",
|
||||
},
|
||||
errors: {
|
||||
unableToInstall: "プロバイダーをインストールできません",
|
||||
},
|
||||
|
||||
@@ -1660,14 +1660,19 @@ export const ko: TranslationResources = {
|
||||
title: "프로바이더 추가",
|
||||
search: "프로바이더 검색",
|
||||
noProviders: "프로바이더를 찾을 수 없습니다",
|
||||
clearSearch: "검색 지우기",
|
||||
actions: {
|
||||
add: "추가",
|
||||
addProvider: "{{provider}} 추가",
|
||||
adding: "추가 중",
|
||||
installed: "설치됨",
|
||||
cancel: "취소",
|
||||
installInstructions: "설치 안내",
|
||||
installInstructionsFor: "{{provider}} 설치 안내",
|
||||
},
|
||||
types: {
|
||||
acp: "ACP",
|
||||
},
|
||||
errors: {
|
||||
unableToInstall: "프로바이더를 설치할 수 없습니다",
|
||||
},
|
||||
|
||||
@@ -1681,14 +1681,19 @@ export const ptBR: TranslationResources = {
|
||||
title: "Adicionar provedor",
|
||||
search: "Buscar provedores",
|
||||
noProviders: "Nenhum provedor encontrado",
|
||||
clearSearch: "Limpar pesquisa",
|
||||
actions: {
|
||||
add: "Adicionar",
|
||||
addProvider: "Adicionar {{provider}}",
|
||||
adding: "Adicionando",
|
||||
installed: "Instalado",
|
||||
cancel: "Cancelar",
|
||||
installInstructions: "Instruções de instalação",
|
||||
installInstructionsFor: "Instruções de instalação de {{provider}}",
|
||||
},
|
||||
types: {
|
||||
acp: "ACP",
|
||||
},
|
||||
errors: {
|
||||
unableToInstall: "Não foi possível instalar provedor",
|
||||
},
|
||||
|
||||
@@ -1679,14 +1679,19 @@ export const ru: TranslationResources = {
|
||||
title: "Добавить провайдера",
|
||||
search: "Поиск провайдеров",
|
||||
noProviders: "Провайдеры не найдены",
|
||||
clearSearch: "Очистить поиск",
|
||||
actions: {
|
||||
add: "Добавить",
|
||||
addProvider: "Добавить {{provider}}",
|
||||
adding: "Добавление",
|
||||
installed: "Установлено",
|
||||
cancel: "Отмена",
|
||||
installInstructions: "Инструкции по установке",
|
||||
installInstructionsFor: "Инструкции по установке {{provider}}",
|
||||
},
|
||||
types: {
|
||||
acp: "ACP",
|
||||
},
|
||||
errors: {
|
||||
unableToInstall: "Не удалось установить провайдера",
|
||||
},
|
||||
|
||||
@@ -1633,14 +1633,19 @@ export const zhCN: TranslationResources = {
|
||||
title: "添加 provider",
|
||||
search: "搜索 providers",
|
||||
noProviders: "未找到 providers",
|
||||
clearSearch: "清除搜索",
|
||||
actions: {
|
||||
add: "添加",
|
||||
addProvider: "添加 {{provider}}",
|
||||
adding: "正在添加",
|
||||
installed: "已安装",
|
||||
cancel: "取消",
|
||||
installInstructions: "安装说明",
|
||||
installInstructionsFor: "{{provider}} 安装说明",
|
||||
},
|
||||
types: {
|
||||
acp: "ACP",
|
||||
},
|
||||
errors: {
|
||||
unableToInstall: "无法安装 provider",
|
||||
},
|
||||
|
||||
@@ -3047,6 +3047,34 @@ describe("HostRuntimeStore", () => {
|
||||
useSessionStore.getState().clearSession(host.serverId);
|
||||
});
|
||||
|
||||
it("drains a queued message as a steer so a turn the agent just started is not interrupted", async () => {
|
||||
const host = makeHost({ serverId: "srv_steer_queue_drain" });
|
||||
const fakeClient = new FakeDaemonClient();
|
||||
const store = new HostRuntimeStore({
|
||||
deps: {
|
||||
createClient: () => fakeClient as unknown as DaemonClient,
|
||||
connectToDaemon: async () => ({
|
||||
client: fakeClient as unknown as DaemonClient,
|
||||
serverId: host.serverId,
|
||||
hostname: null,
|
||||
}),
|
||||
getClientId: async () => "cid_steer_queue_drain",
|
||||
},
|
||||
});
|
||||
const sessionStore = useSessionStore.getState();
|
||||
sessionStore.initializeSession(host.serverId, fakeClient as unknown as DaemonClient, 1);
|
||||
sessionStore.setQueuedMessages(
|
||||
host.serverId,
|
||||
new Map([["agent", [{ id: "queued", text: "next task", attachments: [] }]]]),
|
||||
);
|
||||
|
||||
store.drainQueuedAgentMessage(host.serverId, "agent");
|
||||
await fakeClient.waitForSentMessages(1);
|
||||
|
||||
expect(fakeClient.sentAgentMessages[0]?.[2]?.activeTurnBehavior).toBe("steer");
|
||||
sessionStore.clearSession(host.serverId);
|
||||
});
|
||||
|
||||
it("uses legacy GitHub attachments when draining a queue for an old daemon", async () => {
|
||||
const host = makeHost({ serverId: "srv_legacy_queue_attachment" });
|
||||
const fakeClient = new FakeDaemonClient();
|
||||
|
||||
@@ -2426,6 +2426,11 @@ export class HostRuntimeStore {
|
||||
}),
|
||||
encodeImages,
|
||||
submission: createMessageSubmissionWriter(serverId),
|
||||
// The queue drains when the agent goes idle, but the agent can start a turn of its own
|
||||
// in that same moment (a wake-up after background work). Steering folds the message
|
||||
// into that turn instead of interrupting it; with no turn running, the daemon starts
|
||||
// a normal one.
|
||||
activeTurnBehavior: "steer",
|
||||
});
|
||||
},
|
||||
})
|
||||
|
||||
@@ -6,6 +6,7 @@ import { createRoot, type Root } from "react-dom/client";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { ProviderSnapshotEntry } from "@getpaseo/protocol/agent-types";
|
||||
import type { MutableDaemonConfig } from "@getpaseo/protocol/messages";
|
||||
import { ToastApiProvider } from "@/contexts/toast-api-context";
|
||||
|
||||
const { theme, snapshotState, configState, patchConfigMock, openProviderSettingsMock } = vi.hoisted(
|
||||
() => ({
|
||||
@@ -281,6 +282,12 @@ vi.mock("@/utils/confirm-dialog", () => ({
|
||||
|
||||
import { ProvidersSection } from "./providers-section";
|
||||
|
||||
function unexpectedToast(): never {
|
||||
throw new Error("Provider row interactions should not display a toast");
|
||||
}
|
||||
|
||||
const toastApi = { show: unexpectedToast, copied: unexpectedToast, error: unexpectedToast };
|
||||
|
||||
const claudeEntry: ProviderSnapshotEntry = {
|
||||
provider: "claude",
|
||||
status: "ready",
|
||||
@@ -366,7 +373,11 @@ describe("ProvidersSection", () => {
|
||||
|
||||
function render(): void {
|
||||
act(() => {
|
||||
root?.render(<ProvidersSection serverId="server-1" />);
|
||||
root?.render(
|
||||
<ToastApiProvider api={toastApi}>
|
||||
<ProvidersSection serverId="server-1" />
|
||||
</ToastApiProvider>,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
} from "react-native";
|
||||
import { StyleSheet, useUnistyles } from "react-native-unistyles";
|
||||
import { useIsCompactFormFactor } from "@/constants/layout";
|
||||
import { useToast } from "@/contexts/toast-api-context";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
import { useHostRuntimeIsConnected } from "@/runtime/host-runtime";
|
||||
import { useHostFeature } from "@/runtime/host-features";
|
||||
@@ -19,6 +20,7 @@ import { useDaemonConfig } from "@/hooks/use-daemon-config";
|
||||
import { buildProviderDefinitions } from "@/utils/provider-definitions";
|
||||
import {
|
||||
buildAcpProviderConfigPatch,
|
||||
getAcpProviderCatalog,
|
||||
type AcpProviderCatalogItem,
|
||||
} from "@/hooks/use-acp-provider-catalog";
|
||||
import { ProviderCatalogList } from "@/components/provider-catalog-list";
|
||||
@@ -325,10 +327,12 @@ export interface ProvidersSectionProps {
|
||||
|
||||
export function ProvidersSection({ serverId }: ProvidersSectionProps) {
|
||||
const { t } = useTranslation();
|
||||
const toast = useToast();
|
||||
const isConnected = useHostRuntimeIsConnected(serverId);
|
||||
const supportsHopliteProvider = useHostFeature(serverId, "hopliteProvider");
|
||||
const supportsProviderRemoval = useHostFeature(serverId, "providerRemoval");
|
||||
const { entries, isLoading, refresh } = useProvidersSnapshot(serverId);
|
||||
const { patchConfig } = useDaemonConfig(serverId);
|
||||
const { config, patchConfig } = useDaemonConfig(serverId);
|
||||
const openProviderSettings = useProviderSettingsStore((state) => state.open);
|
||||
const [pendingProviderId, setPendingProviderId] = useState<string | null>(null);
|
||||
const [removingProviderId, setRemovingProviderId] = useState<string | null>(null);
|
||||
@@ -338,6 +342,19 @@ export function ProvidersSection({ serverId }: ProvidersSectionProps) {
|
||||
const providerDefinitions = useMemo(() => buildProviderDefinitions(entries), [entries]);
|
||||
const hasServer = serverId.length > 0;
|
||||
|
||||
/** Config owns derived providers and opt-in bundled catalog providers. */
|
||||
const isConfigOwnedProvider = useCallback(
|
||||
(providerId: string) =>
|
||||
Boolean(
|
||||
config?.providers?.[providerId] &&
|
||||
(config.providers[providerId].extends ||
|
||||
getAcpProviderCatalog().some(
|
||||
(entry) => entry.id === providerId && entry.bundledProvider,
|
||||
)),
|
||||
),
|
||||
[config],
|
||||
);
|
||||
|
||||
const handleOpenProviderSettings = useCallback(
|
||||
(providerId: string) => {
|
||||
openProviderSettings({ serverId, provider: providerId });
|
||||
@@ -399,18 +416,15 @@ export function ProvidersSection({ serverId }: ProvidersSectionProps) {
|
||||
if (installingProviderId) return;
|
||||
setInstallingProviderId(entry.id);
|
||||
try {
|
||||
await patchConfig(buildAcpProviderConfigPatch(entry));
|
||||
await patchConfig(buildAcpProviderConfigPatch(entry, supportsHopliteProvider));
|
||||
await refresh([entry.id]);
|
||||
} catch (error) {
|
||||
Alert.alert(
|
||||
t("settings.providers.addErrorTitle"),
|
||||
error instanceof Error ? error.message : String(error),
|
||||
);
|
||||
toast.error(error instanceof Error ? error.message : String(error));
|
||||
} finally {
|
||||
setInstallingProviderId((current) => (current === entry.id ? null : current));
|
||||
}
|
||||
},
|
||||
[installingProviderId, patchConfig, refresh, t],
|
||||
[installingProviderId, patchConfig, refresh, supportsHopliteProvider, toast],
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -444,7 +458,11 @@ export function ProvidersSection({ serverId }: ProvidersSectionProps) {
|
||||
enabled={entry.enabled ?? true}
|
||||
isToggling={pendingProviderId === def.id}
|
||||
isRemoving={removingProviderId === def.id}
|
||||
canRemove={supportsProviderRemoval && entry.source === "custom"}
|
||||
canRemove={
|
||||
supportsProviderRemoval &&
|
||||
entry.source === "custom" &&
|
||||
isConfigOwnedProvider(def.id)
|
||||
}
|
||||
isFirst={index === 0}
|
||||
onPress={handleOpenProviderSettings}
|
||||
onToggleEnabled={handleToggleEnabled}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { DaemonConnectionError } from "@getpaseo/client/internal/daemon-client";
|
||||
import { afterEach, describe, expect, test } from "vitest";
|
||||
import type { ProviderSubagentDescriptorPayload } from "@getpaseo/protocol/messages";
|
||||
import {
|
||||
observeProviderSubagentTimeline,
|
||||
providerSubagentKey,
|
||||
refreshProviderSubagents,
|
||||
resyncProviderSubagents,
|
||||
useProviderSubagentStore,
|
||||
} from "./provider-store";
|
||||
|
||||
@@ -15,6 +18,7 @@ afterEach(() => {
|
||||
descriptors: new Map(),
|
||||
timelines: new Map(),
|
||||
hiddenFromTrack: new Set(),
|
||||
trackedParents: new Set(),
|
||||
});
|
||||
});
|
||||
|
||||
@@ -727,3 +731,96 @@ describe("projected child history", () => {
|
||||
expect(current().lastSeq).toBe(2000);
|
||||
});
|
||||
});
|
||||
|
||||
describe("resyncing after the update feed resubscribes", () => {
|
||||
function child(
|
||||
id: string,
|
||||
parentAgentId: string,
|
||||
status: ProviderSubagentDescriptorPayload["status"],
|
||||
): ProviderSubagentDescriptorPayload {
|
||||
return {
|
||||
id,
|
||||
parentAgentId,
|
||||
provider: "claude",
|
||||
title: "Explore",
|
||||
description: null,
|
||||
status,
|
||||
createdAt: "2026-10-07T10:00:00.000Z",
|
||||
updatedAt: "2026-10-07T10:00:00.000Z",
|
||||
toolCallId: id,
|
||||
};
|
||||
}
|
||||
|
||||
function fakeDaemon(lists: Record<string, ProviderSubagentDescriptorPayload[]>) {
|
||||
const requested: string[] = [];
|
||||
return {
|
||||
requested,
|
||||
lists,
|
||||
client: {
|
||||
listProviderSubagents: async (parentAgentId: string) => {
|
||||
requested.push(parentAgentId);
|
||||
return {
|
||||
requestId: "list",
|
||||
parentAgentId,
|
||||
subagents: lists[parentAgentId] ?? [],
|
||||
error: null,
|
||||
};
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const status = (parentAgentId: string, subagentId: string) =>
|
||||
useProviderSubagentStore
|
||||
.getState()
|
||||
.descriptors.get(providerSubagentKey(SERVER_ID, parentAgentId, subagentId))?.status;
|
||||
|
||||
test("catches up on children that finished or started while updates were not delivered", async () => {
|
||||
const daemon = fakeDaemon({ [PARENT_ID]: [child("child-1", PARENT_ID, "running")] });
|
||||
await refreshProviderSubagents(daemon.client, SERVER_ID, PARENT_ID);
|
||||
expect(status(PARENT_ID, "child-1")).toBe("running");
|
||||
|
||||
// The connection dropped: the daemon finished child-1 and ran child-2 without telling us.
|
||||
daemon.lists[PARENT_ID] = [
|
||||
child("child-1", PARENT_ID, "completed"),
|
||||
child("child-2", PARENT_ID, "completed"),
|
||||
];
|
||||
await resyncProviderSubagents(daemon.client, SERVER_ID);
|
||||
|
||||
expect(status(PARENT_ID, "child-1")).toBe("completed");
|
||||
expect(status(PARENT_ID, "child-2")).toBe("completed");
|
||||
});
|
||||
|
||||
test("catches up on a parent whose first list failed while disconnected", async () => {
|
||||
const daemon = fakeDaemon({});
|
||||
const disconnected = {
|
||||
listProviderSubagents: async () => {
|
||||
throw new DaemonConnectionError("Transport not connected");
|
||||
},
|
||||
};
|
||||
await expect(
|
||||
refreshProviderSubagents(disconnected, SERVER_ID, PARENT_ID),
|
||||
).rejects.toBeInstanceOf(DaemonConnectionError);
|
||||
useProviderSubagentStore.getState().applyUpdate(SERVER_ID, {
|
||||
kind: "upsert",
|
||||
subagent: child("child-1", PARENT_ID, "running"),
|
||||
});
|
||||
|
||||
// The connection dropped again: the daemon finished child-1 without telling us.
|
||||
daemon.lists[PARENT_ID] = [child("child-1", PARENT_ID, "completed")];
|
||||
await resyncProviderSubagents(daemon.client, SERVER_ID);
|
||||
|
||||
expect(status(PARENT_ID, "child-1")).toBe("completed");
|
||||
});
|
||||
|
||||
test("lists again only the parents this server was showing", async () => {
|
||||
const daemon = fakeDaemon({});
|
||||
await refreshProviderSubagents(daemon.client, SERVER_ID, PARENT_ID);
|
||||
await refreshProviderSubagents(daemon.client, "server-2", "other-parent");
|
||||
daemon.requested.length = 0;
|
||||
|
||||
await resyncProviderSubagents(daemon.client, SERVER_ID);
|
||||
|
||||
expect(daemon.requested).toEqual([PARENT_ID]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -28,6 +28,9 @@ interface ProviderSubagentState {
|
||||
descriptors: Map<string, ProviderSubagentDescriptorPayload>;
|
||||
timelines: Map<string, ProviderSubagentTimelineState>;
|
||||
hiddenFromTrack: Set<string>;
|
||||
/** Parents whose list this client asked for, so a resubscribed update feed can catch them up. */
|
||||
trackedParents: Set<string>;
|
||||
trackParent(serverId: string, parentAgentId: string): void;
|
||||
hideFromTrack(serverId: string, parentAgentId: string, subagentIds: readonly string[]): void;
|
||||
replaceList(
|
||||
serverId: string,
|
||||
@@ -84,6 +87,7 @@ export function refreshProviderSubagents(
|
||||
const pending = clientRequests.get(requestKey);
|
||||
if (pending) return pending;
|
||||
|
||||
useProviderSubagentStore.getState().trackParent(serverId, parentAgentId);
|
||||
const request = client
|
||||
.listProviderSubagents(parentAgentId)
|
||||
.then((payload) => {
|
||||
@@ -101,6 +105,27 @@ function parentPrefix(serverId: string, parentAgentId: string): string {
|
||||
return `${serverId}\0${parentAgentId}\0`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates are not replayed across a reconnect, so a child that finished or started while the
|
||||
* update feed was down stays stale until its parent is listed again. Call this once the feed has
|
||||
* resubscribed, so every update after the list is delivered.
|
||||
*/
|
||||
export async function resyncProviderSubagents(
|
||||
client: ProviderSubagentListClient,
|
||||
serverId: string,
|
||||
): Promise<void> {
|
||||
const serverPrefix = `${serverId}\0`;
|
||||
const parentAgentIds = [...useProviderSubagentStore.getState().trackedParents]
|
||||
.filter((key) => key.startsWith(serverPrefix))
|
||||
.map((key) => key.slice(serverPrefix.length, -1));
|
||||
await Promise.all(
|
||||
parentAgentIds.map((parentAgentId) =>
|
||||
// A parent that was archived meanwhile has nothing left to catch up.
|
||||
refreshProviderSubagents(client, serverId, parentAgentId).catch(() => undefined),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
const EMPTY_TIMELINE: ProviderSubagentTimelineState = {
|
||||
tail: [],
|
||||
head: [],
|
||||
@@ -147,6 +172,14 @@ export const useProviderSubagentStore = create<ProviderSubagentState>((set) => (
|
||||
descriptors: new Map(),
|
||||
timelines: new Map(),
|
||||
hiddenFromTrack: new Set(),
|
||||
trackedParents: new Set(),
|
||||
trackParent(serverId, parentAgentId) {
|
||||
set((state) => {
|
||||
const prefix = parentPrefix(serverId, parentAgentId);
|
||||
if (state.trackedParents.has(prefix)) return state;
|
||||
return { trackedParents: new Set(state.trackedParents).add(prefix) };
|
||||
});
|
||||
},
|
||||
hideFromTrack(serverId, parentAgentId, subagentIds) {
|
||||
set((state) => {
|
||||
const hiddenFromTrack = new Set(state.hiddenFromTrack);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/cli",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"description": "Paseo CLI - control your AI coding agents from the command line",
|
||||
"bin": {
|
||||
"paseo": "bin/paseo"
|
||||
@@ -28,9 +28,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^1.0.0",
|
||||
"@getpaseo/client": "0.11.0-beta.5",
|
||||
"@getpaseo/protocol": "0.11.0-beta.5",
|
||||
"@getpaseo/server": "0.11.0-beta.5",
|
||||
"@getpaseo/client": "0.11.3",
|
||||
"@getpaseo/protocol": "0.11.3",
|
||||
"@getpaseo/server": "0.11.3",
|
||||
"chalk": "^5.3.0",
|
||||
"commander": "^12.0.0",
|
||||
"mime-types": "^2.1.35",
|
||||
|
||||
@@ -122,10 +122,15 @@ const EXPECTED_CLAUDE_MODELS = [
|
||||
model: "Opus 4.6",
|
||||
descriptionFragment: "Most capable",
|
||||
},
|
||||
{
|
||||
id: "claude-haiku-5-5",
|
||||
model: "Haiku 5.5",
|
||||
descriptionFragment: "Fastest",
|
||||
},
|
||||
{
|
||||
id: "claude-haiku-4-5",
|
||||
model: "Haiku 4.5",
|
||||
descriptionFragment: "Fastest",
|
||||
descriptionFragment: "Previous release",
|
||||
},
|
||||
] as const;
|
||||
|
||||
@@ -435,8 +440,8 @@ try {
|
||||
"--quiet should print the same ordered model IDs returned by --json",
|
||||
);
|
||||
assert(
|
||||
claudeModelsFromJson.some((m) => m.id === "claude-sonnet-5-5"),
|
||||
"captured --json output should include the current Claude everyday model id",
|
||||
claudeModelsFromJson.some((m) => m.id === "claude-haiku-5-5"),
|
||||
"captured --json output should include the current Claude quick-answer model id",
|
||||
);
|
||||
console.log("✓ provider models --quiet outputs model IDs only\n");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/client",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"description": "Paseo client SDK package",
|
||||
"files": [
|
||||
"dist",
|
||||
@@ -39,8 +39,8 @@
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
"@getpaseo/protocol": "0.11.0-beta.5",
|
||||
"@getpaseo/relay": "0.11.0-beta.5",
|
||||
"@getpaseo/protocol": "0.11.3",
|
||||
"@getpaseo/relay": "0.11.3",
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/desktop",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"private": true,
|
||||
"description": "Paseo desktop app (Electron wrapper)",
|
||||
"homepage": "https://paseo.sh",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/expo-two-way-audio",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"description": "Native module for two way audio streaming",
|
||||
"keywords": [
|
||||
"ExpoTwoWayAudio",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/highlight",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"files": [
|
||||
"dist",
|
||||
"!dist/**/*.map",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/plugin",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"description": "Paseo plugin SDK package",
|
||||
"files": [
|
||||
"dist",
|
||||
@@ -70,8 +70,8 @@
|
||||
"use-sync-external-store": "^1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@getpaseo/client": "0.11.0-beta.5",
|
||||
"@getpaseo/protocol": "0.11.0-beta.5",
|
||||
"@getpaseo/client": "0.11.3",
|
||||
"@getpaseo/protocol": "0.11.3",
|
||||
"@types/node": "^20.9.0",
|
||||
"@types/react": "~19.2.0",
|
||||
"react": "19.1.0",
|
||||
@@ -81,8 +81,8 @@
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@getpaseo/client": "0.11.0-beta.5",
|
||||
"@getpaseo/protocol": "0.11.0-beta.5",
|
||||
"@getpaseo/client": "0.11.3",
|
||||
"@getpaseo/protocol": "0.11.3",
|
||||
"react": "~19.1.0",
|
||||
"react-native": ">=0.81.5",
|
||||
"zod": "^4.4.3"
|
||||
|
||||
@@ -359,6 +359,8 @@ class AcpRuntime {
|
||||
private emit: (event: ProviderEvent) => void;
|
||||
private readonly messages = new Map<string, string>();
|
||||
private readonly toolCalls = new Map<string, AcpToolCallSnapshot>();
|
||||
// Running tool rows published by transformers; the turn's terminal closes any left open.
|
||||
private readonly vendorToolCalls = new Map<string, ToolCallTimelineItem>();
|
||||
private readonly pendingCompactions = new Set<string>();
|
||||
private readonly permissions = new Map<
|
||||
string,
|
||||
@@ -595,10 +597,13 @@ class AcpRuntime {
|
||||
turnId,
|
||||
state: "started",
|
||||
});
|
||||
// The SDK dispatches notifications without awaiting them, so the prompt response can resolve
|
||||
// while earlier session updates are still queued. Apply them before the turn ends.
|
||||
const settled = this.call(
|
||||
this.connection.prompt({ sessionId: this.nativeSessionId, prompt }),
|
||||
).then(
|
||||
(response): void => {
|
||||
async (response): Promise<void> => {
|
||||
await this.drainNotifications();
|
||||
const state = response.stopReason === "cancelled" ? "canceled" : "completed";
|
||||
this.fallbackChunkIds.clear();
|
||||
this.terminalizeTransientItems(state);
|
||||
@@ -610,7 +615,8 @@ class AcpRuntime {
|
||||
});
|
||||
return undefined;
|
||||
},
|
||||
(error): void => {
|
||||
async (error): Promise<void> => {
|
||||
await this.drainNotifications();
|
||||
this.fallbackChunkIds.clear();
|
||||
this.terminalizeTransientItems("failed");
|
||||
this.emit({
|
||||
@@ -1027,9 +1033,17 @@ class AcpRuntime {
|
||||
this.emit({
|
||||
type: "timeline.item",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
item: toolTimelineItem(completed),
|
||||
item: terminalToolItem(toolTimelineItem(snapshot), state),
|
||||
});
|
||||
}
|
||||
for (const item of this.vendorToolCalls.values()) {
|
||||
this.emit({
|
||||
type: "timeline.item",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
item: terminalToolItem(item, state),
|
||||
});
|
||||
}
|
||||
this.vendorToolCalls.clear();
|
||||
for (const id of this.pendingCompactions) {
|
||||
this.emit({
|
||||
type: "timeline.item",
|
||||
@@ -1076,6 +1090,10 @@ class AcpRuntime {
|
||||
if (this.configTransaction) this.stagedTransformerConfig = update.config;
|
||||
else this.emitConfigSnapshot(update.config);
|
||||
} else if (update.type === "timeline") {
|
||||
if (update.item.type === "tool_call") {
|
||||
if (update.item.status === "running") this.vendorToolCalls.set(update.item.id, update.item);
|
||||
else this.vendorToolCalls.delete(update.item.id);
|
||||
}
|
||||
this.emit({
|
||||
type: "timeline.item",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
@@ -1383,7 +1401,9 @@ function configValues(
|
||||
return Object.fromEntries(options.map((option) => [option.id, option.currentValue]));
|
||||
}
|
||||
|
||||
function toolTimelineItem(snapshot: AcpToolCallSnapshot): ProviderTimelineItem {
|
||||
type ToolCallTimelineItem = Extract<ProviderTimelineItem, { type: "tool_call" }>;
|
||||
|
||||
function toolTimelineItem(snapshot: AcpToolCallSnapshot): ToolCallTimelineItem {
|
||||
const input = jsonRecord(snapshot.input);
|
||||
const isEdit = snapshot.kind === "edit" || snapshot.name?.toLowerCase().includes("edit") === true;
|
||||
const detail = isEdit
|
||||
@@ -1411,6 +1431,18 @@ function toolTimelineItem(snapshot: AcpToolCallSnapshot): ProviderTimelineItem {
|
||||
return { ...base, status, error: null };
|
||||
}
|
||||
|
||||
// A row the turn left open ends with the turn. The wire contract requires a non-null error on a
|
||||
// failed tool call, so a canceled turn cancels its rows instead of failing them.
|
||||
function terminalToolItem(
|
||||
item: ToolCallTimelineItem,
|
||||
state: "completed" | "failed" | "canceled",
|
||||
): ToolCallTimelineItem {
|
||||
if (state === "failed") {
|
||||
return { ...item, status: "failed", error: item.error ?? { message: "Turn failed" } };
|
||||
}
|
||||
return { ...item, status: state, error: null };
|
||||
}
|
||||
|
||||
function jsonValue(value: unknown) {
|
||||
return z.json().parse(value);
|
||||
}
|
||||
|
||||
@@ -619,6 +619,146 @@ lines.on("line", (line) => {
|
||||
await connection.close();
|
||||
});
|
||||
|
||||
it.each([
|
||||
["end_turn", "completed", "completed"],
|
||||
["cancelled", "canceled", "canceled"],
|
||||
] as const)(
|
||||
"closes a transformer's running tool row when the turn ends with %s",
|
||||
async (stopReason, turnState, rowStatus) => {
|
||||
const harness = connectorHarness({
|
||||
handleMessage(instance, message) {
|
||||
if (!("method" in message) || !("id" in message)) return false;
|
||||
if (message.method !== "session/prompt") return false;
|
||||
instance.notify("vendor/phase", { id: "phase-1", label: "Preparing" });
|
||||
instance.respond(message as AcpRequestMessage, { stopReason });
|
||||
return true;
|
||||
},
|
||||
});
|
||||
const registration = runAcpProvider({
|
||||
id: "vendor-row-acp",
|
||||
label: "Vendor row ACP",
|
||||
connector: harness.connector,
|
||||
transformers: [
|
||||
{
|
||||
notification(notification) {
|
||||
if (notification.method !== "vendor/phase") return null;
|
||||
return {
|
||||
type: "timeline",
|
||||
item: {
|
||||
type: "tool_call",
|
||||
id: "phase-1",
|
||||
callId: "phase-1",
|
||||
name: "Vendor phase",
|
||||
detail: { type: "plain_text", label: "Preparing" },
|
||||
status: "running",
|
||||
error: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
const connection = await registration.connect({
|
||||
versions: [1],
|
||||
capabilities: ["prompt.message"],
|
||||
});
|
||||
const events: ProviderEvent[] = [];
|
||||
connection.onEvent((event) => events.push(event));
|
||||
await connection.send(openInput());
|
||||
await waitForEvent(events, (event) => event.type === "session.ready");
|
||||
|
||||
await connection.send({
|
||||
type: "session.prompt",
|
||||
sessionId: "session-1",
|
||||
prompt: {
|
||||
clientMessageId: "first",
|
||||
delivery: "auto",
|
||||
input: { type: "message", content: [{ type: "text", text: "first" }] },
|
||||
},
|
||||
});
|
||||
await waitForEvent(
|
||||
events,
|
||||
(event) => event.type === "session.turn" && event.state === turnState,
|
||||
);
|
||||
|
||||
const rows = events.flatMap((event) =>
|
||||
event.type === "timeline.item" && event.item.id === "phase-1" ? [event.item] : [],
|
||||
);
|
||||
expect(rows.map((row) => row.type === "tool_call" && row.status)).toEqual([
|
||||
"running",
|
||||
rowStatus,
|
||||
]);
|
||||
const closed = events.findIndex(
|
||||
(event) =>
|
||||
event.type === "timeline.item" &&
|
||||
event.item.id === "phase-1" &&
|
||||
event.item.type === "tool_call" &&
|
||||
event.item.status === rowStatus,
|
||||
);
|
||||
const terminal = events.findIndex(
|
||||
(event) => event.type === "session.turn" && event.state === turnState,
|
||||
);
|
||||
expect(closed).toBeLessThan(terminal);
|
||||
// The wire contract only accepts a failed tool call with a non-null error.
|
||||
expect(rows.at(-1)).toMatchObject({ error: null });
|
||||
await connection.close();
|
||||
},
|
||||
);
|
||||
|
||||
it("cancels an in-progress ACP tool call with the canceled turn instead of failing it without an error", async () => {
|
||||
const harness = connectorHarness({
|
||||
handleMessage(instance, message) {
|
||||
if (!("method" in message) || !("id" in message)) return false;
|
||||
if (message.method !== "session/prompt") return false;
|
||||
instance.notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: {
|
||||
sessionUpdate: "tool_call",
|
||||
toolCallId: "tool-1",
|
||||
title: "Run tests",
|
||||
kind: "execute",
|
||||
status: "in_progress",
|
||||
},
|
||||
});
|
||||
instance.respond(message as AcpRequestMessage, { stopReason: "cancelled" });
|
||||
return true;
|
||||
},
|
||||
});
|
||||
const registration = runAcpProvider({
|
||||
id: "cancel-tool-acp",
|
||||
label: "Cancel tool ACP",
|
||||
connector: harness.connector,
|
||||
});
|
||||
const connection = await registration.connect({
|
||||
versions: [1],
|
||||
capabilities: ["prompt.message"],
|
||||
});
|
||||
const events: ProviderEvent[] = [];
|
||||
connection.onEvent((event) => events.push(event));
|
||||
await connection.send(openInput());
|
||||
await waitForEvent(events, (event) => event.type === "session.ready");
|
||||
|
||||
await connection.send({
|
||||
type: "session.prompt",
|
||||
sessionId: "session-1",
|
||||
prompt: {
|
||||
clientMessageId: "first",
|
||||
delivery: "auto",
|
||||
input: { type: "message", content: [{ type: "text", text: "first" }] },
|
||||
},
|
||||
});
|
||||
await waitForEvent(
|
||||
events,
|
||||
(event) => event.type === "session.turn" && event.state === "canceled",
|
||||
);
|
||||
|
||||
const rows = events.flatMap((event) =>
|
||||
event.type === "timeline.item" && event.item.id === "tool-1" ? [event.item] : [],
|
||||
);
|
||||
expect(rows.at(-1)).toMatchObject({ type: "tool_call", status: "canceled", error: null });
|
||||
await connection.close();
|
||||
});
|
||||
|
||||
it("serializes configuration mutations", async () => {
|
||||
let releaseMutation: (() => void) | null = null;
|
||||
const configOptions = [
|
||||
|
||||
@@ -26,6 +26,8 @@ export const PROVIDER_CAPABILITIES = [
|
||||
export type ProviderCapability = (typeof PROVIDER_CAPABILITIES)[number];
|
||||
|
||||
export interface ProviderRegistration {
|
||||
/** Activate only while agents.providers contains this provider ID, independently of enabled. */
|
||||
requiresConfiguration?: boolean;
|
||||
/** Equal keys share discovery within this provider. Include effective configuration and execution environment. */
|
||||
getCatalogCacheKey?(options: ProviderCatalogOptions): Promise<string | undefined>;
|
||||
/** Default executable and arguments; the daemon resolves overrides before status/connect. */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/protocol",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"description": "Paseo shared protocol schemas and wire types",
|
||||
"files": [
|
||||
"dist",
|
||||
|
||||
@@ -812,3 +812,14 @@ describe("checkout PR schemas", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test.each([undefined, false, true])(
|
||||
"accepts optional Hoplite capability (%s)",
|
||||
(hopliteProvider) => {
|
||||
const features = hopliteProvider === undefined ? {} : { hopliteProvider };
|
||||
expect(
|
||||
ServerInfoStatusPayloadSchema.parse({ status: "server_info", serverId: "test", features })
|
||||
.features,
|
||||
).toEqual(features);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -3680,6 +3680,8 @@ export const ServerInfoStatusPayloadSchema = z
|
||||
commitBaseClassification: z.boolean().optional(),
|
||||
// COMPAT(providerRemoval): added in v0.1.105, drop the gate when floor >= v0.1.105.
|
||||
providerRemoval: z.boolean().optional(),
|
||||
// COMPAT(hopliteProvider): added after v0.11.2, remove after 2027-04-15 once host floor includes the bundled adapter.
|
||||
hopliteProvider: z.boolean().optional(),
|
||||
// COMPAT(importSessionWorkspaceTarget): added in v0.1.110, remove gate after 2027-01-16.
|
||||
importSessionWorkspaceTarget: z.boolean().optional(),
|
||||
// COMPAT(importSessionSearch): added in v0.8.0, remove gate after 2027-03-02.
|
||||
|
||||
@@ -31,6 +31,7 @@ export const ACP_PROVIDER_ICON_NAMES = [
|
||||
"glm-acp-agent",
|
||||
"goose",
|
||||
"grok",
|
||||
"hoplite",
|
||||
"junie",
|
||||
"kilo",
|
||||
"kimi",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/relay",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"description": "Paseo relay for bridging daemon and client connections",
|
||||
"files": [
|
||||
"dist",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/server",
|
||||
"version": "0.11.0-beta.5",
|
||||
"version": "0.11.3",
|
||||
"description": "Paseo backend server",
|
||||
"files": [
|
||||
"dist/server",
|
||||
@@ -107,11 +107,11 @@
|
||||
"@agentclientprotocol/sdk": "^0.17.1",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.3.246",
|
||||
"@anthropic-ai/sdk": "^0.104.2",
|
||||
"@getpaseo/client": "0.11.0-beta.5",
|
||||
"@getpaseo/highlight": "0.11.0-beta.5",
|
||||
"@getpaseo/plugin": "0.11.0-beta.5",
|
||||
"@getpaseo/protocol": "0.11.0-beta.5",
|
||||
"@getpaseo/relay": "0.11.0-beta.5",
|
||||
"@getpaseo/client": "0.11.3",
|
||||
"@getpaseo/highlight": "0.11.3",
|
||||
"@getpaseo/plugin": "0.11.3",
|
||||
"@getpaseo/protocol": "0.11.3",
|
||||
"@getpaseo/relay": "0.11.3",
|
||||
"@isaacs/ttlcache": "^2.1.4",
|
||||
"@modelcontextprotocol/sdk": "1.29.0",
|
||||
"@opencode-ai/sdk": "1.14.46",
|
||||
|
||||
@@ -1121,3 +1121,50 @@ describe("plugin provider launch and status", () => {
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
test("config-required plugin membership is independent of enablement and other providers", async () => {
|
||||
const logger = createTestLogger();
|
||||
const plugins = new PluginAgentClientRegistry(logger);
|
||||
const harness = createProviderHarness();
|
||||
let connections = 0;
|
||||
let probes = 0;
|
||||
plugins.replace([
|
||||
{
|
||||
...harness.registration,
|
||||
requiresConfiguration: true,
|
||||
async status() {
|
||||
probes++;
|
||||
return { available: true };
|
||||
},
|
||||
async connect(request) {
|
||||
connections++;
|
||||
return harness.registration.connect(request);
|
||||
},
|
||||
},
|
||||
]);
|
||||
const build = (providerOverrides = {}) =>
|
||||
buildProviderRegistry(logger, {
|
||||
pluginProviders: plugins.definitions(),
|
||||
providerOverrides,
|
||||
});
|
||||
try {
|
||||
const before = build();
|
||||
expect(before["plugin-direct"]).toBeUndefined();
|
||||
expect({ probes, connections }).toEqual({ probes: 0, connections: 0 });
|
||||
const added = build({ "plugin-direct": {} });
|
||||
expect(added["plugin-direct"].enabled).toBe(true);
|
||||
const client = added["plugin-direct"].createClient(logger);
|
||||
expect(await client.isAvailable()).toBe(true);
|
||||
const catalog = await client.fetchCatalog({ scope: "global" });
|
||||
expect(catalog.models.map((model) => model.id)).toEqual(["plugin-model"]);
|
||||
expect({ probes, connections }).toEqual({ probes: 1, connections: 1 });
|
||||
const disabled = build({ "plugin-direct": { enabled: false } });
|
||||
expect(disabled["plugin-direct"].enabled).toBe(false);
|
||||
expect(Object.keys(build())).toEqual(Object.keys(before));
|
||||
for (const id of Object.keys(before)) {
|
||||
expect(added[id].enabled).toBe(before[id].enabled);
|
||||
}
|
||||
} finally {
|
||||
await plugins.shutdown();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -885,6 +885,7 @@ function createPluginProviderDefinition(
|
||||
label: registration.label,
|
||||
description: registration.description ?? `Plugin provider ${registration.label}`,
|
||||
iconSvg: registration.icon,
|
||||
requiresConfiguration: registration.requiresConfiguration,
|
||||
defaultModeId: null,
|
||||
modes: [],
|
||||
supportsExactMcpPreapproval: true,
|
||||
|
||||
@@ -97,6 +97,7 @@ export interface ProviderDefinition extends AgentProviderDefinition {
|
||||
|
||||
/** Provider metadata and an unconfigured factory; the registry owns override application. */
|
||||
export interface RegisteredProviderDefinition extends AgentProviderDefinition {
|
||||
requiresConfiguration?: boolean;
|
||||
iconSvg?: string;
|
||||
supportsExactMcpPreapproval: boolean;
|
||||
createClient: (logger: Logger, runtimeSettings?: ProviderRuntimeSettings) => AgentClient;
|
||||
@@ -925,6 +926,8 @@ export function buildProviderRegistry(
|
||||
throw new Error(`Plugin provider '${provider}' conflicts with a built-in provider`);
|
||||
}
|
||||
const override = providerOverrides[provider];
|
||||
if (definition.requiresConfiguration && !override) continue;
|
||||
|
||||
if (override?.extends) {
|
||||
logger.warn({ provider }, "Plugin provider shadowed by configured provider");
|
||||
continue;
|
||||
|
||||
@@ -348,6 +348,10 @@ export class ProviderSnapshotManager {
|
||||
return Object.prototype.hasOwnProperty.call(this.generation.definitions, provider);
|
||||
}
|
||||
|
||||
supportsConfigRequiredProvider(provider: AgentProvider): boolean {
|
||||
return this.pluginProviders.definitions()[provider]?.requiresConfiguration === true;
|
||||
}
|
||||
|
||||
getProviderLabel(provider: AgentProvider): string {
|
||||
return this.generation.definitions[provider]?.label ?? provider;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ function createQueryMock(events: unknown[]): Query {
|
||||
describe("Claude SDK env", () => {
|
||||
test("forwards launch-context env through Claude process env", async () => {
|
||||
let capturedEnv: Record<string, string | undefined> | undefined;
|
||||
let capturedPerTaskStopAffordance: boolean | undefined;
|
||||
const launchContext: AgentLaunchContext = {
|
||||
env: {
|
||||
PASEO_AGENT_ID: "00000000-0000-4000-8000-000000000201",
|
||||
@@ -39,6 +40,7 @@ describe("Claude SDK env", () => {
|
||||
};
|
||||
const queryFactory = vi.fn(({ options }: ClaudeQueryInput) => {
|
||||
capturedEnv = options.env;
|
||||
capturedPerTaskStopAffordance = options.perTaskStopAffordance;
|
||||
return createQueryMock([
|
||||
{
|
||||
type: "system",
|
||||
@@ -91,6 +93,10 @@ describe("Claude SDK env", () => {
|
||||
expect(capturedEnv?.MCP_TIMEOUT).toBe("claude-startup-timeout");
|
||||
expect(capturedEnv?.MCP_TOOL_TIMEOUT).toBe("claude-tool-timeout");
|
||||
expect(session.usageSession?.()?.env).toBe(capturedEnv);
|
||||
// Paseo reads session_state_changed to know when an autonomous turn is over.
|
||||
expect(capturedEnv?.CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS).toBe("1");
|
||||
// Without it, Stop and replace kill every background subagent along with the turn.
|
||||
expect(capturedPerTaskStopAffordance).toBe(true);
|
||||
} finally {
|
||||
await session.close();
|
||||
expect(session.usageSession?.()).toBeNull();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mkdirSync, mkdtempSync, rmSync } from "node:fs";
|
||||
import { chmodSync, mkdirSync, mkdtempSync, rmSync } from "node:fs";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import pino from "pino";
|
||||
@@ -90,4 +90,29 @@ describe("ClaudeAgentSession persisted history load", () => {
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
// chmod does not remove read access on Windows, or for root.
|
||||
test.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
|
||||
"logs a warning with the error when Claude's project folders cannot be listed",
|
||||
async () => {
|
||||
// The transcript is not under cwd's folder, so the lookup lists the other project folders.
|
||||
mkdirSync(path.join(configDir, "projects"), { recursive: true });
|
||||
chmodSync(path.join(configDir, "projects"), 0o000);
|
||||
|
||||
try {
|
||||
await resume();
|
||||
} finally {
|
||||
chmodSync(path.join(configDir, "projects"), 0o755);
|
||||
}
|
||||
|
||||
expect(records).toContainEqual(
|
||||
expect.objectContaining({
|
||||
level: pino.levels.values.warn,
|
||||
msg: "Failed to load Claude history from transcript",
|
||||
sessionId: SESSION_ID,
|
||||
err: expect.objectContaining({ message: expect.stringContaining("EACCES") }),
|
||||
}),
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
+60
-20
@@ -91,6 +91,17 @@ function buildUsage() {
|
||||
};
|
||||
}
|
||||
|
||||
/** Claude opening a turn of its own. Every main-session turn starts with one. */
|
||||
function buildTurnInit(sessionId: string) {
|
||||
return {
|
||||
type: "system",
|
||||
subtype: "init",
|
||||
session_id: sessionId,
|
||||
permissionMode: "default",
|
||||
model: "opus",
|
||||
};
|
||||
}
|
||||
|
||||
function buildSuccessResult(sessionId: string) {
|
||||
return {
|
||||
type: "result",
|
||||
@@ -153,13 +164,7 @@ function createScriptedQuery(params: {
|
||||
},
|
||||
} satisfies ScriptedQuery;
|
||||
|
||||
scriptedQuery.emit({
|
||||
type: "system",
|
||||
subtype: "init",
|
||||
session_id: params.sessionId,
|
||||
permissionMode: "default",
|
||||
model: "opus",
|
||||
});
|
||||
scriptedQuery.emit(buildTurnInit(params.sessionId));
|
||||
|
||||
void (async () => {
|
||||
for await (const prompt of params.prompt) {
|
||||
@@ -252,6 +257,21 @@ async function waitFor(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Paseo interrupts Claude only while a main-session turn is in flight, which it learns from the
|
||||
* init. The pump asks for its next frame only after routing the last one, so a second next() call
|
||||
* proves the init was read.
|
||||
*/
|
||||
async function waitForInitRouted(
|
||||
query: () => { next: ReturnType<typeof vi.fn> } | null | undefined,
|
||||
) {
|
||||
await waitFor(() => (query()?.next.mock.calls.length ?? 0) >= 2);
|
||||
}
|
||||
|
||||
function buildCommandLifecycle(commandUuid: string | null | undefined, state: string) {
|
||||
return { type: "command_lifecycle", command_uuid: commandUuid, state };
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
queryFactory.mockReset();
|
||||
});
|
||||
@@ -282,6 +302,7 @@ test("interrupt only calls query.interrupt and leaves the query open", async ()
|
||||
const firstTurn = streamSession(session, "first prompt");
|
||||
await firstTurn.next();
|
||||
await waitFor(() => queries[0]?.prompts.length === 1);
|
||||
await waitForInitRouted(() => queries[0]);
|
||||
|
||||
await session.interrupt();
|
||||
await waitFor(() => queries[0]?.interrupt.mock.calls.length === 1);
|
||||
@@ -322,6 +343,7 @@ async function startSteeredTurn(sessionId: string): Promise<{
|
||||
throw new Error("Expected the original Claude turn to start");
|
||||
}
|
||||
await waitFor(() => query?.prompts.length === 1);
|
||||
await waitForInitRouted(() => query);
|
||||
|
||||
const steered = await session.steerActiveTurn!("queued steer", {
|
||||
expectedTurnId: start.value.turnId,
|
||||
@@ -371,11 +393,8 @@ test("interrupt still stops the turn when Claude has already dequeued the steer"
|
||||
test("a steer Claude has already read is no longer discardable on interrupt", async () => {
|
||||
const { session, query, turn } = await startSteeredTurn("queued-steer-completed-session");
|
||||
|
||||
query()?.emit({
|
||||
type: "command_lifecycle",
|
||||
command_uuid: query()?.prompts[1]?.uuid,
|
||||
state: "completed",
|
||||
});
|
||||
query()?.emit(buildCommandLifecycle(query()?.prompts[0]?.uuid, "started"));
|
||||
query()?.emit(buildCommandLifecycle(query()?.prompts[1]?.uuid, "completed"));
|
||||
// Frames are translated in order, so the marker landing proves the lifecycle frame was read.
|
||||
query()?.emit({ type: "assistant", message: { content: "STEER_READ" } });
|
||||
await consumeUntil(turn, (event) => collectAssistantText([event]).includes("STEER_READ"));
|
||||
@@ -388,6 +407,23 @@ test("a steer Claude has already read is no longer discardable on interrupt", as
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test("a steer Claude cancelled is no longer withdrawn on interrupt", async () => {
|
||||
const { session, query, turn } = await startSteeredTurn("queued-steer-cancelled-session");
|
||||
|
||||
query()?.emit(buildCommandLifecycle(query()?.prompts[0]?.uuid, "started"));
|
||||
// "cancelled" is terminal: API errors, interrupts and "now" pre-emption all end a message.
|
||||
query()?.emit(buildCommandLifecycle(query()?.prompts[1]?.uuid, "cancelled"));
|
||||
query()?.emit({ type: "assistant", message: { content: "STEER_CANCELLED" } });
|
||||
await consumeUntil(turn, (event) => collectAssistantText([event]).includes("STEER_CANCELLED"));
|
||||
|
||||
await session.interrupt();
|
||||
await waitFor(() => query()?.interrupt.mock.calls.length === 1);
|
||||
|
||||
expect(query()?.cancelAsyncMessage).not.toHaveBeenCalled();
|
||||
await collectUntilTerminal(turn);
|
||||
await session.close();
|
||||
});
|
||||
|
||||
function buildStoppedTaskNotification(sessionId: string) {
|
||||
return {
|
||||
type: "system",
|
||||
@@ -473,6 +509,7 @@ async function startInterruptedToolTurn(sessionId: string): Promise<{
|
||||
const turn = streamSession(session, "run the slow tool");
|
||||
await turn.next();
|
||||
await waitFor(() => query?.prompts.length === 1);
|
||||
await waitForInitRouted(() => query);
|
||||
|
||||
await session.interrupt();
|
||||
await collectUntilTerminal(turn);
|
||||
@@ -523,6 +560,7 @@ test("Claude can still wake into an autonomous turn once the interrupted request
|
||||
|
||||
query()?.emit(buildStoppedTaskNotification(sessionId));
|
||||
query()?.emit(buildAbortedResult(sessionId));
|
||||
query()?.emit(buildTurnInit(sessionId));
|
||||
query()?.emit({
|
||||
type: "assistant",
|
||||
message: { content: "AUTONOMOUS_WAKE_RESPONSE" },
|
||||
@@ -579,6 +617,7 @@ test("reuses the existing query after interrupt before starting the next prompt"
|
||||
const firstTurn = streamSession(session, "first prompt");
|
||||
await firstTurn.next();
|
||||
await waitFor(() => queries[0]?.prompts.length === 1);
|
||||
await waitForInitRouted(() => queries[0]);
|
||||
|
||||
await session.interrupt();
|
||||
await collectUntilTerminal(firstTurn);
|
||||
@@ -652,6 +691,7 @@ test("recovers when the query pump sees a single interrupt abort before the next
|
||||
const output = createAsyncQueue<Record<string, unknown>>();
|
||||
const prompts: PromptRecord[] = [];
|
||||
let throwAbortOnNext = false;
|
||||
let queryRef: Pick<ScriptedQuery, "next"> | null = null;
|
||||
|
||||
queryFactory.mockImplementation(({ prompt }: { prompt: AsyncIterable<unknown> }) => {
|
||||
const scriptedQuery = {
|
||||
@@ -685,13 +725,8 @@ test("recovers when the query pump sees a single interrupt abort before the next
|
||||
},
|
||||
} satisfies ScriptedQuery;
|
||||
|
||||
scriptedQuery.emit({
|
||||
type: "system",
|
||||
subtype: "init",
|
||||
session_id: "interrupt-abort-recovery-session",
|
||||
permissionMode: "default",
|
||||
model: "opus",
|
||||
});
|
||||
queryRef = scriptedQuery;
|
||||
scriptedQuery.emit(buildTurnInit("interrupt-abort-recovery-session"));
|
||||
|
||||
void (async () => {
|
||||
for await (const promptMessage of prompt) {
|
||||
@@ -730,6 +765,7 @@ test("recovers when the query pump sees a single interrupt abort before the next
|
||||
|
||||
const firstTurn = streamSession(session, "first prompt");
|
||||
await firstTurn.next();
|
||||
await waitForInitRouted(() => queryRef);
|
||||
await session.interrupt();
|
||||
await collectUntilTerminal(firstTurn);
|
||||
|
||||
@@ -768,6 +804,7 @@ test("stale abort result after replacement start does not poison the new foregro
|
||||
const firstTurn = streamSession(session, "first prompt");
|
||||
const firstStarted = await firstTurn.next();
|
||||
await waitFor(() => queryRef?.prompts.length === 1);
|
||||
await waitForInitRouted(() => queryRef);
|
||||
|
||||
await session.interrupt();
|
||||
const firstTurnEvents = [firstStarted.value!, ...(await collectUntilTerminal(firstTurn))];
|
||||
@@ -812,7 +849,7 @@ test("stale abort result after replacement start does not poison the new foregro
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test("creates an autonomous live turn when assistant output arrives without a foreground run", async () => {
|
||||
test("creates an autonomous live turn when Claude starts a turn without a foreground run", async () => {
|
||||
const logger = createTestLogger();
|
||||
let queryRef: ScriptedQuery | null = null;
|
||||
|
||||
@@ -848,6 +885,7 @@ test("creates an autonomous live turn when assistant output arrives without a fo
|
||||
await collectUntilTerminal(streamSession(session, "seed prompt"));
|
||||
|
||||
const subscribedEvents = subscribeToEvents(session);
|
||||
queryRef?.emit(buildTurnInit("autonomous-live-session"));
|
||||
queryRef?.emit({
|
||||
type: "assistant",
|
||||
message: { content: "AUTONOMOUS_WAKE_RESPONSE" },
|
||||
@@ -916,6 +954,7 @@ test("steers an autonomous turn through its existing query without restarting it
|
||||
|
||||
await collectUntilTerminal(streamSession(session, "seed prompt"));
|
||||
const autonomousEvents = subscribeToEvents(session);
|
||||
queryRef?.emit(buildTurnInit("autonomous-steer-session"));
|
||||
queryRef?.emit({
|
||||
type: "assistant",
|
||||
message: { content: "AUTONOMOUS_RESPONSE" },
|
||||
@@ -999,6 +1038,7 @@ test("auto-completes an open autonomous turn when a foreground prompt starts", a
|
||||
await collectUntilTerminal(streamSession(session, "seed prompt"));
|
||||
|
||||
const subscribedEvents = subscribeToEvents(session);
|
||||
queryRef?.emit(buildTurnInit("autonomous-handoff-session"));
|
||||
queryRef?.emit({
|
||||
type: "assistant",
|
||||
message: { content: "BACKGROUND_ONLY_RESPONSE" },
|
||||
|
||||
@@ -486,6 +486,7 @@ test("interruptActiveTurn only interrupts the active query without info logs", a
|
||||
} | null;
|
||||
input: { end: () => void } | null;
|
||||
queryRestartNeeded: boolean;
|
||||
mainTurnInFlight: boolean;
|
||||
interruptActiveTurn: () => Promise<void>;
|
||||
} = asInternals(session);
|
||||
const interrupt = vi.fn(async () => undefined);
|
||||
@@ -498,6 +499,7 @@ test("interruptActiveTurn only interrupts the active query without info logs", a
|
||||
};
|
||||
internal.input = { end };
|
||||
internal.queryRestartNeeded = false;
|
||||
internal.mainTurnInFlight = true;
|
||||
|
||||
try {
|
||||
await internal.interruptActiveTurn();
|
||||
@@ -1191,6 +1193,7 @@ test("reuses one autonomous run for unbound stream_event bursts with no foregrou
|
||||
const queryMock = createBaseQueryMock(vi.fn(async () => ({ done: true, value: undefined })));
|
||||
|
||||
internal.turnState = "idle";
|
||||
await internal.routeSdkMessageFromPump(claudeTurnInit(), queryMock);
|
||||
await internal.routeSdkMessageFromPump(
|
||||
{
|
||||
type: "stream_event",
|
||||
@@ -1233,6 +1236,468 @@ test("reuses one autonomous run for unbound stream_event bursts with no foregrou
|
||||
await session.close();
|
||||
});
|
||||
|
||||
interface SessionStateInternals {
|
||||
turnState: "idle" | "foreground" | "autonomous";
|
||||
routeSdkMessageFromPump: (
|
||||
message: Record<string, unknown>,
|
||||
activeQuery: QueryMock,
|
||||
) => Promise<void>;
|
||||
autonomousTurn: { id: string } | null;
|
||||
activeForegroundTurnId: string | null;
|
||||
}
|
||||
|
||||
function sessionState(state: "idle" | "running" | "requires_action") {
|
||||
return {
|
||||
type: "system",
|
||||
subtype: "session_state_changed",
|
||||
state,
|
||||
uuid: `state-${state}`,
|
||||
session_id: "sess-1",
|
||||
};
|
||||
}
|
||||
|
||||
/** Claude opening a turn of its own. Every main-session turn starts with one. */
|
||||
function claudeTurnInit() {
|
||||
return {
|
||||
type: "system",
|
||||
subtype: "init",
|
||||
session_id: "sess-1",
|
||||
permissionMode: "default",
|
||||
model: "opus",
|
||||
};
|
||||
}
|
||||
|
||||
function successResult() {
|
||||
return { type: "result", subtype: "success", usage: buildUsage(), total_cost_usd: 0 };
|
||||
}
|
||||
|
||||
function commandLifecycle(
|
||||
commandUuid: string,
|
||||
state: "queued" | "started" | "completed" | "cancelled",
|
||||
) {
|
||||
return { type: "command_lifecycle", command_uuid: commandUuid, state };
|
||||
}
|
||||
|
||||
function unboundTextDelta(text: string) {
|
||||
return {
|
||||
type: "stream_event",
|
||||
parent_tool_use_id: null,
|
||||
event: { type: "content_block_delta", delta: { type: "text_delta", text } },
|
||||
};
|
||||
}
|
||||
|
||||
// What a background subagent emits on the main stream with no parent tool use id, so by frame
|
||||
// shape alone each looks like main-session work. Verified on the wire: none arrives inside a turn
|
||||
// Claude opened, and no result follows any of them.
|
||||
const helperTaskStarted = {
|
||||
type: "system",
|
||||
subtype: "task_started",
|
||||
task_id: "helper-task",
|
||||
tool_use_id: "toolu_helper",
|
||||
task_type: "local_agent",
|
||||
subagent_type: "general-purpose",
|
||||
description: "Background helper",
|
||||
is_backgrounded: true,
|
||||
uuid: "uuid-task-started",
|
||||
session_id: "sess-1",
|
||||
};
|
||||
const helperTaskProgress = {
|
||||
type: "system",
|
||||
subtype: "task_progress",
|
||||
task_id: "helper-task",
|
||||
tool_use_id: "toolu_helper",
|
||||
description: "Background helper",
|
||||
usage: { total_tokens: 1200, tool_uses: 3, duration_ms: 900 },
|
||||
last_tool_name: "Bash",
|
||||
uuid: "uuid-task-progress",
|
||||
session_id: "sess-1",
|
||||
};
|
||||
// A subagent's own background Bash job completing.
|
||||
const subagentOwnedTaskNotification = {
|
||||
type: "system",
|
||||
subtype: "task_notification",
|
||||
task_id: "bg-job-of-subagent",
|
||||
tool_use_id: "toolu_subagent_bash",
|
||||
status: "completed",
|
||||
summary: "Background command completed",
|
||||
output_file: "/tmp/bg-job-of-subagent.output",
|
||||
uuid: "uuid-task-notification",
|
||||
session_id: "sess-1",
|
||||
};
|
||||
const helperCompleted = {
|
||||
type: "system",
|
||||
subtype: "task_notification",
|
||||
task_id: "helper-task",
|
||||
tool_use_id: "toolu_helper",
|
||||
status: "completed",
|
||||
summary: "Background helper finished",
|
||||
output_file: "/tmp/helper-task.output",
|
||||
uuid: "uuid-helper-completed",
|
||||
session_id: "sess-1",
|
||||
};
|
||||
const rateLimitEvent = {
|
||||
type: "rate_limit_event",
|
||||
rate_limit_info: { status: "allowed" },
|
||||
uuid: "uuid-rate-limit",
|
||||
session_id: "sess-1",
|
||||
};
|
||||
|
||||
function createPendingQueryMock(): QueryMock {
|
||||
return createBaseQueryMock(vi.fn(() => new Promise<never>(() => {})));
|
||||
}
|
||||
|
||||
test("a main-session frame opens no turn until Claude starts one", async () => {
|
||||
const session = await createSession();
|
||||
const internal: SessionStateInternals = asInternals(session);
|
||||
const queryMock = createPendingQueryMock();
|
||||
|
||||
// Main-session output only ever arrives inside a turn Claude opened with system/init, so a
|
||||
// stray unbound frame is not the start of one.
|
||||
await internal.routeSdkMessageFromPump(unboundTextDelta("stray"), queryMock);
|
||||
expect(internal.autonomousTurn).toBeNull();
|
||||
|
||||
// The wake-up case autonomous turns exist for: a completed background subagent makes the main
|
||||
// session start a turn of its own, with no prompt from the user.
|
||||
await internal.routeSdkMessageFromPump(claudeTurnInit(), queryMock);
|
||||
await internal.routeSdkMessageFromPump(unboundTextDelta("picking this up"), queryMock);
|
||||
expect(internal.autonomousTurn?.id).toBe("autonomous-turn-1");
|
||||
|
||||
await internal.routeSdkMessageFromPump(successResult(), queryMock);
|
||||
expect(internal.autonomousTurn).toBeNull();
|
||||
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test("a background subagent's frames never open a turn while the main session is idle", async () => {
|
||||
sdkQueryFactory.mockImplementation(() => createPendingQueryMock());
|
||||
const session = await createSession();
|
||||
const internal: SessionStateInternals = asInternals(session);
|
||||
const queryMock = createPendingQueryMock();
|
||||
|
||||
// Claude Code 2.1.280 reports "running" for as long as any background subagent is alive.
|
||||
await internal.routeSdkMessageFromPump(sessionState("running"), queryMock);
|
||||
for (const frame of [
|
||||
helperTaskStarted,
|
||||
helperTaskProgress,
|
||||
subagentOwnedTaskNotification,
|
||||
rateLimitEvent,
|
||||
helperCompleted,
|
||||
]) {
|
||||
await internal.routeSdkMessageFromPump(frame, queryMock);
|
||||
expect(internal.autonomousTurn).toBeNull();
|
||||
expect(internal.turnState).toBe("idle");
|
||||
}
|
||||
|
||||
// The next user message starts its own foreground turn rather than landing on a phantom one.
|
||||
const { turnId } = await session.startTurn("PING");
|
||||
expect(internal.activeForegroundTurnId).toBe(turnId);
|
||||
expect(internal.autonomousTurn).toBeNull();
|
||||
expect(internal.turnState).toBe("foreground");
|
||||
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test("Claude waking up after a helper finishes gets an autonomous turn that its result closes", async () => {
|
||||
const session = await createSession();
|
||||
const internal: SessionStateInternals = asInternals(session);
|
||||
const queryMock = createPendingQueryMock();
|
||||
const events: AgentStreamEvent[] = [];
|
||||
session.subscribe((event) => events.push(event));
|
||||
|
||||
// The helper's completion arrives outside any turn. Claude then starts one to react to it.
|
||||
await internal.routeSdkMessageFromPump(helperTaskStarted, queryMock);
|
||||
await internal.routeSdkMessageFromPump(helperCompleted, queryMock);
|
||||
expect(internal.autonomousTurn).toBeNull();
|
||||
|
||||
await internal.routeSdkMessageFromPump(claudeTurnInit(), queryMock);
|
||||
expect(internal.autonomousTurn?.id).toBe("autonomous-turn-1");
|
||||
expect(internal.turnState).toBe("autonomous");
|
||||
|
||||
await internal.routeSdkMessageFromPump(unboundTextDelta("the helper is done"), queryMock);
|
||||
await internal.routeSdkMessageFromPump(successResult(), queryMock);
|
||||
expect(internal.autonomousTurn).toBeNull();
|
||||
expect(internal.turnState).toBe("idle");
|
||||
expect(events.filter((event) => event.type === "turn_started")).toHaveLength(1);
|
||||
expect(events.filter((event) => event.type === "turn_completed")).toHaveLength(1);
|
||||
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test("a steer folded into a turn keeps one turn, and a turn Claude starts after it gets its own", async () => {
|
||||
sdkQueryFactory.mockImplementation(() => createPendingQueryMock());
|
||||
const session = await createSession();
|
||||
const internal: SessionStateInternals = asInternals(session);
|
||||
const queryMock = createPendingQueryMock();
|
||||
const events: AgentStreamEvent[] = [];
|
||||
session.subscribe((event) => events.push(event));
|
||||
|
||||
const { turnId } = await session.startTurn("hello");
|
||||
await internal.routeSdkMessageFromPump(claudeTurnInit(), queryMock);
|
||||
// A message pushed mid-turn is folded in at the next tool boundary: Claude acknowledges it, but
|
||||
// starts no new turn.
|
||||
await internal.routeSdkMessageFromPump(commandLifecycle("folded-steer", "queued"), queryMock);
|
||||
await internal.routeSdkMessageFromPump(commandLifecycle("folded-steer", "started"), queryMock);
|
||||
expect(internal.activeForegroundTurnId).toBe(turnId);
|
||||
expect(internal.autonomousTurn).toBeNull();
|
||||
|
||||
await internal.routeSdkMessageFromPump(successResult(), queryMock);
|
||||
expect(internal.activeForegroundTurnId).toBeNull();
|
||||
expect(internal.turnState).toBe("idle");
|
||||
|
||||
// A message that arrived while Claude wrote its final answer runs as a turn of its own.
|
||||
await internal.routeSdkMessageFromPump(claudeTurnInit(), queryMock);
|
||||
expect(internal.autonomousTurn?.id).toBe("autonomous-turn-2");
|
||||
await internal.routeSdkMessageFromPump(successResult(), queryMock);
|
||||
expect(internal.autonomousTurn).toBeNull();
|
||||
expect(internal.turnState).toBe("idle");
|
||||
expect(events.filter((event) => event.type === "turn_started")).toHaveLength(2);
|
||||
expect(events.filter((event) => event.type === "turn_completed")).toHaveLength(2);
|
||||
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test("session state never opens a turn", async () => {
|
||||
const session = await createSession();
|
||||
const internal: SessionStateInternals = asInternals(session);
|
||||
const queryMock = createPendingQueryMock();
|
||||
const events: AgentStreamEvent[] = [];
|
||||
session.subscribe((event) => events.push(event));
|
||||
|
||||
// "running" covers background subagents too, so it says nothing about the main session.
|
||||
for (const state of ["idle", "running", "requires_action", "idle"] as const) {
|
||||
await internal.routeSdkMessageFromPump(sessionState(state), queryMock);
|
||||
expect(internal.autonomousTurn).toBeNull();
|
||||
expect(internal.turnState).toBe("idle");
|
||||
}
|
||||
// State frames are bookkeeping, never timeline content.
|
||||
expect(events).toEqual([]);
|
||||
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test("an idle session state closes an autonomous turn that no result closed", async () => {
|
||||
const session = await createSession();
|
||||
const internal: SessionStateInternals = asInternals(session);
|
||||
const queryMock = createPendingQueryMock();
|
||||
const events: AgentStreamEvent[] = [];
|
||||
session.subscribe((event) => events.push(event));
|
||||
|
||||
await internal.routeSdkMessageFromPump(claudeTurnInit(), queryMock);
|
||||
expect(internal.autonomousTurn?.id).toBe("autonomous-turn-1");
|
||||
|
||||
// Safety net: Claude says nothing at all is running any more.
|
||||
await internal.routeSdkMessageFromPump(sessionState("idle"), queryMock);
|
||||
expect(internal.autonomousTurn).toBeNull();
|
||||
expect(internal.turnState).toBe("idle");
|
||||
expect(events.filter((event) => event.type === "turn_completed")).toHaveLength(1);
|
||||
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test("session state never opens or closes a foreground turn", async () => {
|
||||
sdkQueryFactory.mockImplementation(() => createPendingQueryMock());
|
||||
const session = await createSession();
|
||||
const internal: SessionStateInternals = asInternals(session);
|
||||
const queryMock = createPendingQueryMock();
|
||||
|
||||
await internal.routeSdkMessageFromPump(sessionState("idle"), queryMock);
|
||||
const { turnId } = await session.startTurn("hello");
|
||||
|
||||
// The send's own running, then an idle that trails the previous turn and lands late.
|
||||
await internal.routeSdkMessageFromPump(sessionState("running"), queryMock);
|
||||
await internal.routeSdkMessageFromPump(sessionState("idle"), queryMock);
|
||||
expect(internal.activeForegroundTurnId).toBe(turnId);
|
||||
expect(internal.autonomousTurn).toBeNull();
|
||||
expect(internal.turnState).toBe("foreground");
|
||||
|
||||
await internal.routeSdkMessageFromPump(
|
||||
{ type: "result", subtype: "success", usage: buildUsage(), total_cost_usd: 0 },
|
||||
queryMock,
|
||||
);
|
||||
expect(internal.activeForegroundTurnId).toBeNull();
|
||||
expect(internal.turnState).toBe("idle");
|
||||
|
||||
await session.close();
|
||||
});
|
||||
|
||||
interface InterruptInternals extends SessionStateInternals {
|
||||
pendingInterruptAbort: boolean;
|
||||
}
|
||||
|
||||
type InterruptibleQueryMock = QueryMock & { cancelAsyncMessage: ReturnType<typeof vi.fn> };
|
||||
|
||||
function createInterruptibleQueryMock(): InterruptibleQueryMock {
|
||||
return Object.assign(createPendingQueryMock(), {
|
||||
cancelAsyncMessage: vi.fn(async () => true),
|
||||
});
|
||||
}
|
||||
|
||||
/** The uuid Paseo stamped on the first message it pushed into the SDK input. */
|
||||
async function readFirstPromptUuid(): Promise<string | null> {
|
||||
const input = sdkQueryFactory.mock.calls[0]?.[0] as { prompt: AsyncIterable<unknown> };
|
||||
return await createPromptUuidReader(input.prompt)();
|
||||
}
|
||||
|
||||
function abortedResult() {
|
||||
return {
|
||||
type: "result",
|
||||
subtype: "error_during_execution",
|
||||
errors: [],
|
||||
usage: buildUsage(),
|
||||
total_cost_usd: 0,
|
||||
};
|
||||
}
|
||||
|
||||
test("an interrupt before Claude starts the message withdraws it instead of interrupting", async () => {
|
||||
const queryMock = createInterruptibleQueryMock();
|
||||
sdkQueryFactory.mockImplementation(() => queryMock);
|
||||
const session = await createSession();
|
||||
const internal: InterruptInternals = asInternals(session);
|
||||
const events: AgentStreamEvent[] = [];
|
||||
session.subscribe((event) => events.push(event));
|
||||
|
||||
await session.startTurn("hello");
|
||||
// Claude has not acknowledged the message yet: no init, no command_lifecycle "started".
|
||||
await session.interrupt();
|
||||
|
||||
await vi.waitFor(() => expect(queryMock.cancelAsyncMessage).toHaveBeenCalledTimes(1));
|
||||
expect(queryMock.cancelAsyncMessage).toHaveBeenCalledWith(await readFirstPromptUuid());
|
||||
expect(queryMock.interrupt).not.toHaveBeenCalled();
|
||||
// No result follows an interrupt that never happened, so no flag may wait for one.
|
||||
expect(internal.pendingInterruptAbort).toBe(false);
|
||||
expect(events.filter((event) => event.type === "turn_canceled")).toHaveLength(1);
|
||||
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test("an interrupt after Claude took the message but before it started stops it", async () => {
|
||||
const queryMock = createInterruptibleQueryMock();
|
||||
// Claude has dequeued the message for its next turn, so withdrawing it is a no-op.
|
||||
queryMock.cancelAsyncMessage.mockImplementation(async () => false);
|
||||
sdkQueryFactory.mockImplementation(() => queryMock);
|
||||
const session = await createSession();
|
||||
const internal: InterruptInternals = asInternals(session);
|
||||
|
||||
await session.startTurn("hello");
|
||||
// No command_lifecycle "started" or init has reached Paseo yet.
|
||||
await session.interrupt();
|
||||
|
||||
await vi.waitFor(() => expect(queryMock.interrupt).toHaveBeenCalledTimes(1));
|
||||
expect(queryMock.cancelAsyncMessage).toHaveBeenCalledWith(await readFirstPromptUuid());
|
||||
expect(internal.pendingInterruptAbort).toBe(true);
|
||||
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test("a prompt sent while a stopped prompt is being withdrawn is not withdrawn too", async () => {
|
||||
const queryMock = createInterruptibleQueryMock();
|
||||
let settleWithdrawal: (cancelled: boolean) => void = () => {};
|
||||
queryMock.cancelAsyncMessage.mockImplementationOnce(
|
||||
() => new Promise<boolean>((resolve) => (settleWithdrawal = resolve)),
|
||||
);
|
||||
sdkQueryFactory.mockImplementation(() => queryMock);
|
||||
const session = await createSession();
|
||||
|
||||
await session.startTurn("first");
|
||||
const firstUuid = await readFirstPromptUuid();
|
||||
await session.interrupt();
|
||||
await vi.waitFor(() => expect(queryMock.cancelAsyncMessage).toHaveBeenCalledTimes(1));
|
||||
|
||||
await session.startTurn("second");
|
||||
settleWithdrawal(false);
|
||||
|
||||
await vi.waitFor(() => expect(queryMock.interrupt).toHaveBeenCalledTimes(1));
|
||||
expect(queryMock.cancelAsyncMessage).toHaveBeenCalledTimes(1);
|
||||
expect(queryMock.cancelAsyncMessage).toHaveBeenCalledWith(firstUuid);
|
||||
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test("an interrupt while only background subagents run never reaches Claude", async () => {
|
||||
const queryMock = createInterruptibleQueryMock();
|
||||
sdkQueryFactory.mockImplementation(() => queryMock);
|
||||
const session = await createSession();
|
||||
const internal: InterruptInternals = asInternals(session);
|
||||
|
||||
await session.startTurn("delegate to a helper");
|
||||
const promptUuid = await readFirstPromptUuid();
|
||||
await internal.routeSdkMessageFromPump(commandLifecycle(promptUuid ?? "", "started"), queryMock);
|
||||
await internal.routeSdkMessageFromPump(claudeTurnInit(), queryMock);
|
||||
await internal.routeSdkMessageFromPump(helperTaskStarted, queryMock);
|
||||
await internal.routeSdkMessageFromPump(successResult(), queryMock);
|
||||
// The main session is done; its helper keeps working.
|
||||
await internal.routeSdkMessageFromPump(sessionState("running"), queryMock);
|
||||
await internal.routeSdkMessageFromPump(helperTaskProgress, queryMock);
|
||||
|
||||
// Without perTaskStopAffordance, an interrupt here kills every running helper.
|
||||
await session.interrupt();
|
||||
|
||||
expect(queryMock.interrupt).not.toHaveBeenCalled();
|
||||
expect(queryMock.cancelAsyncMessage).not.toHaveBeenCalled();
|
||||
expect(internal.pendingInterruptAbort).toBe(false);
|
||||
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test("an interrupt during a main turn interrupts Claude once and drops the aborted result", async () => {
|
||||
const queryMock = createInterruptibleQueryMock();
|
||||
sdkQueryFactory.mockImplementation(() => queryMock);
|
||||
const session = await createSession();
|
||||
const internal: InterruptInternals = asInternals(session);
|
||||
const events: AgentStreamEvent[] = [];
|
||||
session.subscribe((event) => events.push(event));
|
||||
|
||||
await session.startTurn("long task");
|
||||
const promptUuid = await readFirstPromptUuid();
|
||||
await internal.routeSdkMessageFromPump(commandLifecycle(promptUuid ?? "", "started"), queryMock);
|
||||
await internal.routeSdkMessageFromPump(claudeTurnInit(), queryMock);
|
||||
|
||||
await session.interrupt();
|
||||
await vi.waitFor(() => expect(queryMock.interrupt).toHaveBeenCalledTimes(1));
|
||||
// Claude already started the message, so there is nothing to withdraw.
|
||||
expect(queryMock.cancelAsyncMessage).not.toHaveBeenCalled();
|
||||
expect(internal.pendingInterruptAbort).toBe(true);
|
||||
|
||||
// A replacement starts before the aborted turn reports its result.
|
||||
const { turnId } = await session.startTurn("replacement");
|
||||
await internal.routeSdkMessageFromPump(abortedResult(), queryMock);
|
||||
expect(internal.activeForegroundTurnId).toBe(turnId);
|
||||
expect(internal.pendingInterruptAbort).toBe(false);
|
||||
expect(events.filter((event) => event.type === "turn_failed")).toHaveLength(0);
|
||||
|
||||
await internal.routeSdkMessageFromPump(claudeTurnInit(), queryMock);
|
||||
await internal.routeSdkMessageFromPump(successResult(), queryMock);
|
||||
expect(internal.activeForegroundTurnId).toBeNull();
|
||||
expect(queryMock.interrupt).toHaveBeenCalledTimes(1);
|
||||
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test("a new turn clears an interrupt flag no result will consume", async () => {
|
||||
const session = await createSession();
|
||||
const internal: InterruptInternals = asInternals(session);
|
||||
const queryMock = createPendingQueryMock();
|
||||
const events: AgentStreamEvent[] = [];
|
||||
session.subscribe((event) => events.push(event));
|
||||
|
||||
// An interrupt that landed just after its turn had ended: Claude emits no result for it.
|
||||
internal.pendingInterruptAbort = true;
|
||||
|
||||
await internal.routeSdkMessageFromPump(claudeTurnInit(), queryMock);
|
||||
expect(internal.pendingInterruptAbort).toBe(false);
|
||||
expect(internal.autonomousTurn?.id).toBe("autonomous-turn-1");
|
||||
|
||||
// This turn's own failure is reported, not swallowed as the interrupted turn's leftover.
|
||||
await internal.routeSdkMessageFromPump(
|
||||
{ ...abortedResult(), errors: ["API Error: 500 upstream failure"] },
|
||||
queryMock,
|
||||
);
|
||||
expect(events.filter((event) => event.type === "turn_failed")).toHaveLength(1);
|
||||
expect(internal.autonomousTurn).toBeNull();
|
||||
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test("tracks run lifecycle transitions for success, error, and interrupt", async () => {
|
||||
const session = await createSession();
|
||||
let streamCase: "success" | "error" | "interrupt" = "success";
|
||||
|
||||
@@ -587,4 +587,75 @@ describe("ClaudeAgentSession sub-agent sidechain updates", () => {
|
||||
expect(latest.detail.log).toContain("[Read] file-6.md");
|
||||
expect(latest.detail.log).toContain("[Read] file-205.md");
|
||||
});
|
||||
|
||||
test("keeps a long main-thread tool call out of the subagents track", async () => {
|
||||
// Claude Code sends a heartbeat every 30 s while a tool runs, with the tool's own id as
|
||||
// parent_tool_use_id. Frames captured from Claude Code 2.1.291 for a 40 s MCP call.
|
||||
queryFactory.mockImplementation(() =>
|
||||
buildQueryMock([
|
||||
{
|
||||
type: "system",
|
||||
subtype: "init",
|
||||
session_id: "heartbeat-session",
|
||||
permissionMode: "bypassPermissions",
|
||||
model: "opus",
|
||||
},
|
||||
{
|
||||
type: "assistant",
|
||||
parent_tool_use_id: null,
|
||||
message: {
|
||||
id: "msg-heartbeat-1",
|
||||
role: "assistant",
|
||||
content: [
|
||||
{ type: "tool_use", id: "toolu_slow", name: "mcp__slow__slow_check", input: {} },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "tool_progress",
|
||||
tool_use_id: "toolu_slow-heartbeat-0",
|
||||
tool_name: "mcp__slow__slow_check",
|
||||
parent_tool_use_id: "toolu_slow",
|
||||
elapsed_time_seconds: 30,
|
||||
heartbeat: true,
|
||||
},
|
||||
{
|
||||
type: "user",
|
||||
parent_tool_use_id: null,
|
||||
message: {
|
||||
role: "user",
|
||||
content: [
|
||||
{
|
||||
type: "tool_result",
|
||||
tool_use_id: "toolu_slow",
|
||||
content: [{ type: "text", text: "SLOW_CHECK_OK" }],
|
||||
is_error: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "result",
|
||||
subtype: "success",
|
||||
usage: { input_tokens: 1, cache_read_input_tokens: 0, output_tokens: 1 },
|
||||
total_cost_usd: 0,
|
||||
},
|
||||
]),
|
||||
);
|
||||
const session = await new ClaudeAgentClient({
|
||||
logger,
|
||||
queryFactory,
|
||||
resolveBinary: async () => "/test/claude/bin",
|
||||
}).createSession({ provider: "claude", cwd: process.cwd() });
|
||||
|
||||
const events = await collectUntilTerminal(streamSession(session, "run the slow check"));
|
||||
await session.close();
|
||||
|
||||
expect(events.filter((event) => event.type === "provider_subagent")).toEqual([]);
|
||||
const toolCallNames = events.flatMap((event) =>
|
||||
event.type === "timeline" && event.item.type === "tool_call" ? [event.item.name] : [],
|
||||
);
|
||||
expect(toolCallNames).toContain("mcp__slow__slow_check");
|
||||
expect(toolCallNames).not.toContain("Task");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -78,7 +78,7 @@ describe("subagent lifecycle across an interrupt", () => {
|
||||
queryFactory.mockReset();
|
||||
});
|
||||
|
||||
async function startInterruptibleTurn() {
|
||||
async function startInterruptibleTurn(taskStarted: Record<string, unknown> = {}) {
|
||||
const channel = buildOpenQueryMock();
|
||||
queryFactory.mockImplementation(() => channel.query);
|
||||
const session = await new ClaudeAgentClient({
|
||||
@@ -107,6 +107,7 @@ describe("subagent lifecycle across an interrupt", () => {
|
||||
task_type: "local_agent",
|
||||
subagent_type: "general-purpose",
|
||||
description: "Reply with banana",
|
||||
...taskStarted,
|
||||
});
|
||||
await vi.waitFor(() => expect(subagentEvents.length).toBeGreaterThan(0));
|
||||
|
||||
@@ -169,6 +170,31 @@ describe("subagent lifecycle across an interrupt", () => {
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test("a child spawned in the background is not canceled with the turn that spawned it", async () => {
|
||||
// Claude announces a background spawn on task_started itself and sends no task_updated patch.
|
||||
const { channel, session, subagentEvents } = await startInterruptibleTurn({
|
||||
is_backgrounded: true,
|
||||
});
|
||||
|
||||
await session.interrupt();
|
||||
channel.push({
|
||||
type: "system",
|
||||
subtype: "task_notification",
|
||||
task_id: TASK_ID,
|
||||
tool_use_id: SUBAGENT_ID,
|
||||
status: "completed",
|
||||
});
|
||||
|
||||
await vi.waitFor(() =>
|
||||
expect(subagentEvents).toContainEqual(
|
||||
expect.objectContaining({ id: SUBAGENT_ID, status: "completed" }),
|
||||
),
|
||||
);
|
||||
expect(statuses(subagentEvents, SUBAGENT_ID)).toEqual(["running", "completed"]);
|
||||
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test("a foreground child is canceled with the turn that spawned it", async () => {
|
||||
const { session, subagentEvents } = await startInterruptibleTurn();
|
||||
|
||||
|
||||
@@ -496,7 +496,7 @@ describe("ClaudeAgentClient.fetchCatalog", () => {
|
||||
const client = new ClaudeAgentClient({
|
||||
logger,
|
||||
resolveBinary: async () => "/test/claude/bin",
|
||||
resolveVersion: async () => "2.1.284",
|
||||
resolveVersion: async () => "2.1.293",
|
||||
runtimeSettings: { env: { CLAUDE_CONFIG_DIR: emptyConfigDir } },
|
||||
});
|
||||
const { models } = await client.fetchCatalog({
|
||||
@@ -515,6 +515,15 @@ describe("ClaudeAgentClient.fetchCatalog", () => {
|
||||
expect(getThinkingIds("claude-opus-4-8")).toContain("ultracode");
|
||||
expect(getThinkingIds("claude-sonnet-5")).toContain("xhigh");
|
||||
expect(getThinkingIds("claude-sonnet-5")).toContain("ultracode");
|
||||
expect(getThinkingIds("claude-haiku-5-5")).toEqual([
|
||||
"off",
|
||||
"low",
|
||||
"medium",
|
||||
"high",
|
||||
"xhigh",
|
||||
"max",
|
||||
"ultracode",
|
||||
]);
|
||||
expect(getThinkingIds("claude-sonnet-5-5")).toContain("xhigh");
|
||||
expect(getThinkingIds("claude-sonnet-5-5")).not.toContain("off");
|
||||
expect(getThinkingIds("claude-opus-4-7[1m]")).toContain("ultracode");
|
||||
@@ -1223,6 +1232,7 @@ describe("ClaudeAgentSession features", () => {
|
||||
|
||||
test.each([
|
||||
["supported model", "claude-opus-4-8", { type: "disabled" }, undefined],
|
||||
["Haiku 5.5", "claude-haiku-5-5", { type: "disabled" }, undefined],
|
||||
["unsupported model", "claude-fable-5", { type: "adaptive", display: "summarized" }, "high"],
|
||||
["custom model", "openrouter/anthropic/claude-opus-4-8", undefined, undefined],
|
||||
["provider default", null, undefined, undefined],
|
||||
@@ -3160,10 +3170,15 @@ describe("ClaudeAgentSession context window usage", () => {
|
||||
});
|
||||
|
||||
test("a compaction abandoned in an autonomous turn does not suppress the next marker", async () => {
|
||||
// Trailing output after the foreground result opens an autonomous turn, which starts
|
||||
// compacting and is then ended by the next foreground turn, never reaching a boundary.
|
||||
// Claude starts a turn of its own after the foreground result, which starts compacting and is
|
||||
// then ended by the next foreground turn, never reaching a boundary.
|
||||
const session = await createSessionForTurns([
|
||||
[createSuccessResult(), createMessageStartEvent(), createCompactingStatus()],
|
||||
[
|
||||
createSuccessResult(),
|
||||
createInitMessage(),
|
||||
createMessageStartEvent(),
|
||||
createCompactingStatus(),
|
||||
],
|
||||
[createCompactingStatus(), createSuccessResult()],
|
||||
]);
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ import {
|
||||
type ClaudeRewindSdk,
|
||||
} from "./rewind.js";
|
||||
import { normalizeProviderReplayTimestamp } from "../../provider-history-timestamps.js";
|
||||
import { claudeConfigDir, claudeProjectDirSync } from "./project-dir.js";
|
||||
import { claudeConfigDir, claudeProjectDirSync, claudeTranscriptPathSync } from "./project-dir.js";
|
||||
import { THINKING_APPLIES_NEXT_TURN_NOTICE } from "../../provider-notices.js";
|
||||
import {
|
||||
isProviderImageMarkdown,
|
||||
@@ -452,6 +452,15 @@ function errorToMessageString(error: unknown): string {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Claude opens every main-session turn with system/init and closes it with exactly one result:
|
||||
* a prompt, a wake-up after background work, a slash command, an API error. Background subagents
|
||||
* never emit either on the main stream.
|
||||
*/
|
||||
function isClaudeTurnInit(message: SDKMessage): boolean {
|
||||
return message.type === "system" && message.subtype === "init";
|
||||
}
|
||||
|
||||
function firstStringField(
|
||||
input: Record<string, unknown>,
|
||||
primaryKey: string,
|
||||
@@ -1907,6 +1916,11 @@ function readClaudeParentToolUseId(message: SDKMessage): string | null {
|
||||
if (!("parent_tool_use_id" in message)) {
|
||||
return null;
|
||||
}
|
||||
// Claude Code's liveness tick for a tool still running after 30 s names that tool as its
|
||||
// parent, so a long main-thread call would otherwise read as a subagent.
|
||||
if (message.type === "tool_progress" && message.heartbeat === true) {
|
||||
return null;
|
||||
}
|
||||
const parentToolUseId = (message as { parent_tool_use_id?: unknown }).parent_tool_use_id;
|
||||
return typeof parentToolUseId === "string" && parentToolUseId.length > 0 ? parentToolUseId : null;
|
||||
}
|
||||
@@ -2070,11 +2084,12 @@ class ClaudeAgentSession implements AgentSession {
|
||||
private activeForegroundQuery: Query | null = null;
|
||||
private activeForegroundInput: AsyncMessageInput<SDKUserMessage> | null = null;
|
||||
/**
|
||||
* Steers pushed into the live SDK input that Claude may not have read yet. Interrupting the turn
|
||||
* has to discard them, or the SDK dequeues one and resumes the turn we just stopped. SDK user
|
||||
* UUIDs are provider-private; never let them escape the adapter boundary.
|
||||
* Messages pushed into the live SDK input (steers, and a foreground turn's own prompt) whose
|
||||
* command_lifecycle has not reached "started". Interrupting has to withdraw them, or the SDK
|
||||
* dequeues one and resumes the turn we just stopped. SDK user UUIDs are provider-private; never
|
||||
* let them escape the adapter boundary.
|
||||
*/
|
||||
private readonly queuedSteerUuids = new Set<string>();
|
||||
private readonly unstartedMessageUuids = new Set<string>();
|
||||
/** Human steers whose text has not reached Claude yet and therefore supersede blocking cards. */
|
||||
private readonly permissionClearingSteerUuids = new Set<string>();
|
||||
private claudeSessionId: string | null;
|
||||
@@ -2126,6 +2141,12 @@ class ClaudeAgentSession implements AgentSession {
|
||||
private queryPumpPromise: Promise<void> | null = null;
|
||||
private queryRestartNeeded = false;
|
||||
private pendingInterruptAbort = false;
|
||||
/**
|
||||
* Whether Claude's main session is inside one of its own turns: set by system/init and by a
|
||||
* pushed message's command_lifecycle "started" (/compact works for seconds before its init),
|
||||
* cleared by the turn's result or an idle session state. See observeMainTurnBracket.
|
||||
*/
|
||||
private mainTurnInFlight = false;
|
||||
private foregroundHasVisibleActivity = false;
|
||||
private activeTurnHasAssistantText = false;
|
||||
private readonly contextUsage: ClaudeContextUsageState;
|
||||
@@ -2272,6 +2293,7 @@ class ClaudeAgentSession implements AgentSession {
|
||||
this.contextUsage.beginTurn();
|
||||
this.transitionTurnState("foreground", "foreground turn started");
|
||||
this.clearRecentStderr();
|
||||
if (sdkUserMessageId) this.unstartedMessageUuids.add(sdkUserMessageId);
|
||||
|
||||
let cancelIssued = false;
|
||||
const requestCancel = () => {
|
||||
@@ -2282,13 +2304,18 @@ class ClaudeAgentSession implements AgentSession {
|
||||
if (this.cancelCurrentTurn === requestCancel) {
|
||||
this.cancelCurrentTurn = null;
|
||||
}
|
||||
// Whether Claude has this message in hand. A late idle from the previous turn can clear
|
||||
// mainTurnInFlight after Claude started it, so the message's own lifecycle counts too.
|
||||
const claudeStartedTurn =
|
||||
this.mainTurnInFlight ||
|
||||
(sdkUserMessageId !== null && !this.unstartedMessageUuids.has(sdkUserMessageId));
|
||||
this.rejectAllPendingPermissions(new Error("Permission request canceled"));
|
||||
this.finishForegroundTurn({
|
||||
type: "turn_canceled",
|
||||
provider: "claude",
|
||||
reason: "Interrupted",
|
||||
});
|
||||
void this.interruptActiveTurn().catch((error) => {
|
||||
void this.interruptActiveTurn(claudeStartedTurn).catch((error) => {
|
||||
this.logger.warn({ err: error }, "Failed to interrupt during cancel");
|
||||
});
|
||||
};
|
||||
@@ -2298,6 +2325,11 @@ class ClaudeAgentSession implements AgentSession {
|
||||
|
||||
try {
|
||||
await this.ensureQuery();
|
||||
if (cancelIssued) {
|
||||
// Stopped while Claude was still starting up: withdrawn by never sending it.
|
||||
if (sdkUserMessageId) this.unstartedMessageUuids.delete(sdkUserMessageId);
|
||||
return { turnId };
|
||||
}
|
||||
if (!this.input) {
|
||||
throw new Error("Claude session input stream not initialized");
|
||||
}
|
||||
@@ -2311,6 +2343,7 @@ class ClaudeAgentSession implements AgentSession {
|
||||
}
|
||||
}, 0);
|
||||
} catch (error) {
|
||||
if (sdkUserMessageId) this.unstartedMessageUuids.delete(sdkUserMessageId);
|
||||
this.finishForegroundTurn(
|
||||
this.buildTurnFailedEvent(error instanceof Error ? error.message : "Claude stream failed"),
|
||||
);
|
||||
@@ -2359,7 +2392,7 @@ class ClaudeAgentSession implements AgentSession {
|
||||
clearPendingPermissions: boolean,
|
||||
): void {
|
||||
const uuid = message.uuid;
|
||||
if (uuid) this.queuedSteerUuids.add(uuid);
|
||||
if (uuid) this.unstartedMessageUuids.add(uuid);
|
||||
if (uuid && clearPendingPermissions) {
|
||||
this.permissionClearingSteerUuids.add(uuid);
|
||||
}
|
||||
@@ -2370,7 +2403,7 @@ class ClaudeAgentSession implements AgentSession {
|
||||
}
|
||||
} catch (error) {
|
||||
if (uuid) {
|
||||
this.queuedSteerUuids.delete(uuid);
|
||||
this.unstartedMessageUuids.delete(uuid);
|
||||
this.permissionClearingSteerUuids.delete(uuid);
|
||||
}
|
||||
throw error;
|
||||
@@ -3182,6 +3215,8 @@ class ClaudeAgentSession implements AgentSession {
|
||||
const options = await this.buildOptions(launchMode);
|
||||
this.logger.debug({ options: summarizeClaudeOptionsForLog(options) }, "claude query");
|
||||
this.input = input;
|
||||
// A fresh Claude process has no turn of its own in flight.
|
||||
this.mainTurnInFlight = false;
|
||||
this.query = claudeQuery(
|
||||
{ prompt: input.iterable, options },
|
||||
{
|
||||
@@ -3301,7 +3336,12 @@ class ClaudeAgentSession implements AgentSession {
|
||||
return createProviderEnv({
|
||||
baseEnv: process.env,
|
||||
runtimeSettings: this.runtimeSettings,
|
||||
overlays: [this.launchEnv],
|
||||
overlays: [
|
||||
this.launchEnv,
|
||||
// Makes the CLI announce session_state_changed, whose "idle" is the safety net that closes
|
||||
// an autonomous turn (see consumeSessionStateChange).
|
||||
{ CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS: "1" },
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3368,6 +3408,10 @@ class ClaudeAgentSession implements AgentSession {
|
||||
...settingsOptions,
|
||||
// Provider subagent panes render the child's nested transcript.
|
||||
forwardSubagentText: true,
|
||||
// Stop and replace abort only the main turn, like Esc in Claude Code, and background
|
||||
// subagents keep running. Without this declaration an interrupt kills every one of them.
|
||||
// Claude stops a helper itself with its TaskStop tool.
|
||||
perTaskStopAffordance: true,
|
||||
hooks: this.buildSubagentEffortHooks(),
|
||||
...(this.persistSession === undefined ? {} : { persistSession: this.persistSession }),
|
||||
env: sdkEnv,
|
||||
@@ -3898,35 +3942,67 @@ class ClaudeAgentSession implements AgentSession {
|
||||
return false;
|
||||
}
|
||||
|
||||
private isAssistantishMessage(message: SDKMessage): boolean {
|
||||
return (
|
||||
message.type === "assistant" ||
|
||||
message.type === "stream_event" ||
|
||||
message.type === "tool_progress" ||
|
||||
(message.type === "system" && message.subtype === "task_notification")
|
||||
);
|
||||
/**
|
||||
* Claude's account of whether anything in the session is working, which is not the same as the
|
||||
* main session working: Claude Code 2.1.280 stays "running" for as long as any background
|
||||
* subagent is alive. So "running" never opens a turn.
|
||||
*
|
||||
* "idle" means nothing at all is running, so it closes an autonomous turn whatever opened it.
|
||||
* It never closes a foreground turn: an idle can trail the previous turn and land just after a
|
||||
* new send, and it must not end that send.
|
||||
*
|
||||
* Returns true when the frame was a state change, which is bookkeeping and never reaches the
|
||||
* timeline.
|
||||
*/
|
||||
private consumeSessionStateChange(message: SDKMessage): boolean {
|
||||
if (message.type !== "system" || message.subtype !== "session_state_changed") {
|
||||
return false;
|
||||
}
|
||||
if (message.state === "idle") {
|
||||
this.mainTurnInFlight = false;
|
||||
this.completeAutonomousTurn();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Tracks mainTurnInFlight from Claude's own turn brackets (isClaudeTurnInit). */
|
||||
private observeMainTurnBracket(message: SDKMessage): void {
|
||||
if (message.type === "result") {
|
||||
this.mainTurnInFlight = false;
|
||||
return;
|
||||
}
|
||||
if (isClaudeTurnInit(message)) {
|
||||
this.mainTurnInFlight = true;
|
||||
// A new turn has begun, so the interrupted one is over. An interrupt that landed after its
|
||||
// turn had already ended gets no result, and the leftover flag would swallow this turn's.
|
||||
this.pendingInterruptAbort = false;
|
||||
return;
|
||||
}
|
||||
if (readClaudeCommandLifecycle(message)?.state === "started") {
|
||||
this.mainTurnInFlight = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Claude keeps talking about the request it was told to kill — the notification for the tool it
|
||||
* just stopped, trailing assistant output. That is not new work, so it must not open a turn: the
|
||||
* only message that would close that turn is the result shouldSuppressStaleResult drops, leaving
|
||||
* the agent stuck reporting "running" forever.
|
||||
* Only the main session's own turn start opens an autonomous turn. Everything a background
|
||||
* subagent emits (its task frames, its own background jobs' notifications, rate limit events)
|
||||
* arrives outside one, and no result would ever close a turn it opened.
|
||||
*/
|
||||
private shouldStartAutonomousTurn(message: SDKMessage): boolean {
|
||||
if (this.activeForegroundTurnId || this.pendingInterruptAbort) {
|
||||
return false;
|
||||
}
|
||||
return this.isAssistantishMessage(message);
|
||||
private opensAutonomousTurn(message: SDKMessage): boolean {
|
||||
return isClaudeTurnInit(message) && !this.activeForegroundTurnId;
|
||||
}
|
||||
|
||||
private async routeSdkMessageFromPump(message: SDKMessage): Promise<void> {
|
||||
if (this.consumeSessionStateChange(message)) {
|
||||
return;
|
||||
}
|
||||
this.observeMainTurnBracket(message);
|
||||
if (this.shouldSuppressStaleResult(message)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isForeground = Boolean(this.activeForegroundTurnId);
|
||||
if (this.shouldStartAutonomousTurn(message)) {
|
||||
if (this.opensAutonomousTurn(message)) {
|
||||
this.startAutonomousTurn();
|
||||
}
|
||||
if (!isForeground && !this.autonomousTurn && message.type === "result") {
|
||||
@@ -4068,7 +4144,13 @@ class ClaudeAgentSession implements AgentSession {
|
||||
return true;
|
||||
}
|
||||
|
||||
private async interruptActiveTurn(): Promise<void> {
|
||||
/**
|
||||
* Interrupts Claude only when a turn of its main session is running. With nothing running there
|
||||
* is nothing to stop but our own queued messages, so those are withdrawn instead: an interrupt
|
||||
* would reach only background helpers (and kill them on a CLI that ignores
|
||||
* perTaskStopAffordance), and no result would follow to consume pendingInterruptAbort.
|
||||
*/
|
||||
private async interruptActiveTurn(claudeStartedTurn = this.mainTurnInFlight): Promise<void> {
|
||||
const queryToInterrupt = this.query;
|
||||
if (!queryToInterrupt || typeof queryToInterrupt.interrupt !== "function") {
|
||||
this.logger.trace(
|
||||
@@ -4082,8 +4164,16 @@ class ClaudeAgentSession implements AgentSession {
|
||||
);
|
||||
return;
|
||||
}
|
||||
this.pendingInterruptAbort = true;
|
||||
await this.discardQueuedSteers(queryToInterrupt);
|
||||
if (claudeStartedTurn) {
|
||||
this.pendingInterruptAbort = true;
|
||||
await this.withdrawUnstartedMessages(queryToInterrupt);
|
||||
} else {
|
||||
// Claude can dequeue a message for its next turn before announcing it started; withdrawing
|
||||
// it is then a no-op, and only an interrupt stops it. Withdraw once: a prompt sent while
|
||||
// this withdrawal was in flight belongs to the next turn.
|
||||
if (await this.withdrawUnstartedMessages(queryToInterrupt)) return;
|
||||
this.pendingInterruptAbort = true;
|
||||
}
|
||||
try {
|
||||
await this.awaitWithTimeout(
|
||||
queryToInterrupt.interrupt(),
|
||||
@@ -4095,14 +4185,15 @@ class ClaudeAgentSession implements AgentSession {
|
||||
}
|
||||
|
||||
/**
|
||||
* Interrupt means interrupt: a steer Claude never read dies with the turn instead of resuming it.
|
||||
* A steer already dequeued cannot be recalled, and does not need to be — the interrupt kills it.
|
||||
* Interrupt means interrupt: a message Claude never started dies with the turn instead of
|
||||
* resuming it. One already dequeued cannot be recalled, and does not need to be, since the
|
||||
* interrupt kills it. Returns whether Claude confirmed every message withdrawn.
|
||||
*/
|
||||
private async discardQueuedSteers(query: Query): Promise<void> {
|
||||
const uuids = [...this.queuedSteerUuids];
|
||||
this.queuedSteerUuids.clear();
|
||||
private async withdrawUnstartedMessages(query: Query): Promise<boolean> {
|
||||
const uuids = [...this.unstartedMessageUuids];
|
||||
this.unstartedMessageUuids.clear();
|
||||
this.permissionClearingSteerUuids.clear();
|
||||
if (uuids.length === 0) return;
|
||||
if (uuids.length === 0) return true;
|
||||
// The SDK runtime supports this, but its public Query type has not caught up. Keep the
|
||||
// compatibility escape hatch inside the Claude adapter.
|
||||
const cancelAsyncMessage = (
|
||||
@@ -4110,14 +4201,17 @@ class ClaudeAgentSession implements AgentSession {
|
||||
cancelAsyncMessage?: (uuid: string) => Promise<boolean>;
|
||||
}
|
||||
).cancelAsyncMessage;
|
||||
if (!cancelAsyncMessage) return;
|
||||
if (!cancelAsyncMessage) return false;
|
||||
let withdrewAll = true;
|
||||
for (const uuid of uuids) {
|
||||
try {
|
||||
await cancelAsyncMessage.call(query, uuid);
|
||||
if (!(await cancelAsyncMessage.call(query, uuid))) withdrewAll = false;
|
||||
} catch (error) {
|
||||
this.logger.warn({ err: error }, "Failed to discard a queued Claude steer");
|
||||
withdrewAll = false;
|
||||
this.logger.warn({ err: error }, "Failed to withdraw a queued Claude message");
|
||||
}
|
||||
}
|
||||
return withdrewAll;
|
||||
}
|
||||
|
||||
private translateMessageToEvents(
|
||||
@@ -4166,7 +4260,7 @@ class ClaudeAgentSession implements AgentSession {
|
||||
}
|
||||
}
|
||||
|
||||
this.forgetReadSteer(message);
|
||||
this.forgetStartedMessage(message);
|
||||
|
||||
switch (message.type) {
|
||||
case "system":
|
||||
@@ -4200,11 +4294,14 @@ class ClaudeAgentSession implements AgentSession {
|
||||
return events;
|
||||
}
|
||||
|
||||
/** Once Claude has read a steer there is nothing left to discard on interrupt. */
|
||||
private forgetReadSteer(message: unknown): void {
|
||||
/**
|
||||
* Once Claude has started a message, or cancelled it, there is nothing left to withdraw on
|
||||
* interrupt.
|
||||
*/
|
||||
private forgetStartedMessage(message: unknown): void {
|
||||
const lifecycle = readClaudeCommandLifecycle(message);
|
||||
if (!lifecycle || lifecycle.state === "queued") return;
|
||||
this.queuedSteerUuids.delete(lifecycle.commandUuid);
|
||||
this.unstartedMessageUuids.delete(lifecycle.commandUuid);
|
||||
this.permissionClearingSteerUuids.delete(lifecycle.commandUuid);
|
||||
}
|
||||
|
||||
@@ -5124,26 +5221,11 @@ class ClaudeAgentSession implements AgentSession {
|
||||
private resolveHistoryPath(sessionId: string): string | null {
|
||||
const cwd = this.config.cwd;
|
||||
if (!cwd) return null;
|
||||
const configDir = claudeConfigDir(this.harnessEnvironment);
|
||||
const candidates = [cwd];
|
||||
try {
|
||||
const realCwd = fs.realpathSync(cwd);
|
||||
if (realCwd !== cwd) {
|
||||
candidates.push(realCwd);
|
||||
}
|
||||
} catch {
|
||||
// Fall back to the configured cwd when the path has already disappeared.
|
||||
}
|
||||
for (const candidate of candidates) {
|
||||
const historyPath = path.join(
|
||||
claudeProjectDirSync(candidate, { configDir }),
|
||||
`${sessionId}.jsonl`,
|
||||
);
|
||||
if (fs.existsSync(historyPath)) {
|
||||
return historyPath;
|
||||
}
|
||||
}
|
||||
return path.join(claudeProjectDirSync(cwd, { configDir }), `${sessionId}.jsonl`);
|
||||
return claudeTranscriptPathSync({
|
||||
cwd,
|
||||
sessionId,
|
||||
configDir: claudeConfigDir(this.harnessEnvironment),
|
||||
});
|
||||
}
|
||||
|
||||
private convertHistoryEntry(entry: ClaudeHistoryEntry): AgentTimelineItem[] {
|
||||
@@ -6519,7 +6601,8 @@ function extractClaudeUserText(messageRaw: unknown): string | null {
|
||||
|
||||
interface ClaudeCommandLifecycle {
|
||||
commandUuid: string;
|
||||
state: "queued" | "started" | "completed";
|
||||
/** "cancelled" is terminal too: API errors, interrupts and "now" pre-emption end a message. */
|
||||
state: "queued" | "started" | "completed" | "cancelled";
|
||||
}
|
||||
|
||||
/** Runtime-only Claude frames are validated here because the SDK's public union omits them. */
|
||||
@@ -6528,7 +6611,7 @@ function readClaudeCommandLifecycle(message: unknown): ClaudeCommandLifecycle |
|
||||
if (record?.type !== "command_lifecycle") return null;
|
||||
if (
|
||||
typeof record.command_uuid !== "string" ||
|
||||
!["queued", "started", "completed"].includes(String(record.state))
|
||||
!["queued", "started", "completed", "cancelled"].includes(String(record.state))
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -170,10 +170,20 @@ export const CLAUDE_MODEL_MANIFEST = [
|
||||
effortLevels: CLAUDE_EFFORT_LEVELS.standard,
|
||||
supportsThinkingDisabled: true,
|
||||
},
|
||||
{
|
||||
id: "claude-haiku-5-5",
|
||||
label: "Haiku 5.5",
|
||||
description: "Haiku 5.5 · Fastest for quick answers",
|
||||
minimumClaudeCodeVersion: "2.1.293",
|
||||
defaultThinkingOptionId: "medium",
|
||||
contextWindowMaxTokens: 1_000_000,
|
||||
effortLevels: CLAUDE_EFFORT_LEVELS.xhigh,
|
||||
supportsThinkingDisabled: true,
|
||||
},
|
||||
{
|
||||
id: "claude-haiku-4-5",
|
||||
label: "Haiku 4.5",
|
||||
description: "Haiku 4.5 · Fastest for quick answers",
|
||||
description: "Haiku 4.5 · Previous release",
|
||||
contextWindowMaxTokens: 200_000,
|
||||
},
|
||||
] as const satisfies readonly ClaudeModelManifestEntry[];
|
||||
|
||||
@@ -39,7 +39,7 @@ async function createClaudeConfigDirWithRawSettings(settings: string): Promise<s
|
||||
return configDir;
|
||||
}
|
||||
|
||||
function createCatalogClient(claudeCodeVersion = "2.1.284"): ClaudeAgentClient {
|
||||
function createCatalogClient(claudeCodeVersion = "2.1.293"): ClaudeAgentClient {
|
||||
return new ClaudeAgentClient({
|
||||
logger: createTestLogger(),
|
||||
resolveVersion: async () => claudeCodeVersion,
|
||||
@@ -66,6 +66,7 @@ describe("getClaudeModels", () => {
|
||||
"claude-opus-4-6",
|
||||
"claude-sonnet-4-6[1m]",
|
||||
"claude-sonnet-4-6",
|
||||
"claude-haiku-5-5",
|
||||
"claude-haiku-4-5",
|
||||
]);
|
||||
});
|
||||
@@ -100,6 +101,7 @@ describe("getClaudeModels", () => {
|
||||
["claude-opus-4-6", 200_000],
|
||||
["claude-sonnet-4-6[1m]", 1_000_000],
|
||||
["claude-sonnet-4-6", 200_000],
|
||||
["claude-haiku-5-5", 1_000_000],
|
||||
["claude-haiku-4-5", 200_000],
|
||||
]),
|
||||
);
|
||||
@@ -123,6 +125,12 @@ describe("getClaudeModels", () => {
|
||||
expect(getClaudeModels("2.1.284").map((model) => model.id)).toContain("claude-sonnet-5-5");
|
||||
});
|
||||
|
||||
it("gates Haiku 5.5 on Claude Code 2.1.293 without changing the default", () => {
|
||||
expect(getClaudeModels("2.1.292").map((model) => model.id)).not.toContain("claude-haiku-5-5");
|
||||
expect(getClaudeModels("2.1.293").map((model) => model.id)).toContain("claude-haiku-5-5");
|
||||
expect(getClaudeModels("2.1.293").find((model) => model.isDefault)?.id).toBe("claude-opus-5-5");
|
||||
});
|
||||
|
||||
it("derives thinking options from model effort capabilities", () => {
|
||||
const models = new Map(getClaudeModels().map((model) => [model.id, model]));
|
||||
|
||||
@@ -192,6 +200,8 @@ describe("getClaudeModels", () => {
|
||||
["claude-sonnet-5-20260101", true, "high"],
|
||||
["claude-fable-5", false, "high"],
|
||||
["claude-fable-5-1", false, "high"],
|
||||
["claude-haiku-5-5", true, "medium"],
|
||||
["claude-haiku-5-5-20261007", true, "medium"],
|
||||
["claude-haiku-4-5", false, undefined],
|
||||
["openrouter/anthropic/claude-opus-4-8", false, undefined],
|
||||
[null, false, undefined],
|
||||
@@ -653,6 +663,51 @@ describe("Claude Sonnet 5.5 catalog", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Claude Haiku 5.5 catalog", () => {
|
||||
it("offers one Haiku 5.5 entry with a 1M context window", () => {
|
||||
const haiku55Models = getClaudeModels()
|
||||
.filter((model) => model.id.startsWith("claude-haiku-5-5"))
|
||||
.map(({ id, label, contextWindowMaxTokens }) => ({ id, label, contextWindowMaxTokens }));
|
||||
|
||||
expect(haiku55Models).toEqual([
|
||||
{ id: "claude-haiku-5-5", label: "Haiku 5.5", contextWindowMaxTokens: 1_000_000 },
|
||||
]);
|
||||
});
|
||||
|
||||
it("offers Off and every effort level with medium as the default", () => {
|
||||
const haiku55 = getClaudeModels().find((model) => model.id === "claude-haiku-5-5");
|
||||
|
||||
expect(haiku55?.thinkingOptions?.map((option) => option.id)).toEqual([
|
||||
CLAUDE_DISABLED_THINKING_OPTION_ID,
|
||||
"low",
|
||||
"medium",
|
||||
"high",
|
||||
"xhigh",
|
||||
"max",
|
||||
CLAUDE_ULTRACODE_THINKING_OPTION_ID,
|
||||
]);
|
||||
expect(haiku55?.defaultThinkingOptionId).toBe("medium");
|
||||
expect(
|
||||
haiku55?.thinkingOptions?.filter((option) => option.isDefault).map((option) => option.id),
|
||||
).toEqual(["medium"]);
|
||||
});
|
||||
|
||||
it("normalizes provider-prefixed runtime IDs", () => {
|
||||
expect(normalizeClaudeRuntimeModelId("anthropic/claude-haiku-5-5")).toBe("claude-haiku-5-5");
|
||||
expect(normalizeClaudeRuntimeModelId("us.anthropic.claude-haiku-5-5-v1:0")).toBe(
|
||||
"claude-haiku-5-5",
|
||||
);
|
||||
expect(claudeManifestModelSupportsFastMode("claude-haiku-5-5")).toBe(false);
|
||||
});
|
||||
|
||||
it("resolves suffixed and dated Haiku 5.5 IDs to the single catalog entry", () => {
|
||||
expect(findClaudeModel("claude-haiku-5-5[1m]")?.id).toBe("claude-haiku-5-5");
|
||||
expect(findClaudeModel("claude-haiku-5-5-20261007")?.id).toBe("claude-haiku-5-5");
|
||||
expect(findClaudeModel("claude-haiku-5-5-20261007[1m]")?.id).toBe("claude-haiku-5-5");
|
||||
expect(findClaudeModel("claude-haiku-5-5[1m]")?.contextWindowMaxTokens).toBe(1_000_000);
|
||||
});
|
||||
});
|
||||
|
||||
describe("claudeManifestModelSupportsFastMode", () => {
|
||||
it("keeps fast mode strict to first-party manifest model IDs", () => {
|
||||
expect(normalizeClaudeManifestModelId("openrouter/anthropic/claude-opus-4-8")).toBeNull();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { realpathSync } from "node:fs";
|
||||
import { existsSync, readdirSync, realpathSync } from "node:fs";
|
||||
import { realpath } from "node:fs/promises";
|
||||
import { homedir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
@@ -30,6 +30,46 @@ export function claudeProjectDirSync(cwd: string, options?: ClaudeProjectDirOpti
|
||||
return join(projectsRoot, encode(canonical));
|
||||
}
|
||||
|
||||
// Claude Code resumes a session by id from any working directory and keeps appending to the
|
||||
// transcript in the project folder where the session started. That folder differs from the
|
||||
// one `cwd` encodes to when the project moved, the daemon migrated, or Claude Code sees the
|
||||
// cwd under another name (a Windows binary under WSL). Returns the expected path when no
|
||||
// transcript exists anywhere.
|
||||
export function claudeTranscriptPathSync(input: {
|
||||
cwd: string;
|
||||
sessionId: string;
|
||||
configDir?: string;
|
||||
}): string {
|
||||
const options = { configDir: input.configDir };
|
||||
const fileName = `${input.sessionId}.jsonl`;
|
||||
const expected = join(claudeProjectDirSync(input.cwd, options), fileName);
|
||||
if (existsSync(expected)) {
|
||||
return expected;
|
||||
}
|
||||
const projectsRoot = join(resolveConfigDir(options), "projects");
|
||||
let projectDirs: string[];
|
||||
try {
|
||||
projectDirs = readdirSync(projectsRoot);
|
||||
} catch (error) {
|
||||
if (isMissingDirectoryError(error)) {
|
||||
return expected;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
for (const projectDir of projectDirs) {
|
||||
const candidate = join(projectsRoot, projectDir, fileName);
|
||||
if (existsSync(candidate)) {
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
return expected;
|
||||
}
|
||||
|
||||
function isMissingDirectoryError(error: unknown): boolean {
|
||||
const code = (error as NodeJS.ErrnoException | null)?.code;
|
||||
return code === "ENOENT" || code === "ENOTDIR";
|
||||
}
|
||||
|
||||
async function canonicalize(input: string): Promise<string> {
|
||||
try {
|
||||
return normalizeProjectPath(await realpath(input));
|
||||
|
||||
@@ -511,6 +511,33 @@ describe("ClaudeTaskProtocolSource", () => {
|
||||
expect(source.cancelRunningForegroundTasks()).toEqual([]);
|
||||
});
|
||||
|
||||
it("does not cancel a subagent announced as backgrounded at spawn", () => {
|
||||
// Claude sets is_backgrounded on task_started for a child spawned in the background, and
|
||||
// sends no task_updated patch for it.
|
||||
const source = new ClaudeTaskProtocolSource();
|
||||
source.observe(taskStarted({ is_backgrounded: true }));
|
||||
|
||||
expect(source.cancelRunningForegroundTasks()).toEqual([]);
|
||||
});
|
||||
|
||||
it("does not cancel a resumed subagent, which Claude always runs in the background", () => {
|
||||
const source = new ClaudeTaskProtocolSource();
|
||||
source.observe(taskStarted({ tool_use_id: "toolu_original", is_backgrounded: false }));
|
||||
source.observe(taskUpdated("completed"));
|
||||
source.observe(taskStarted({ tool_use_id: "toolu_resumed", is_backgrounded: true }));
|
||||
|
||||
expect(source.cancelRunningForegroundTasks()).toEqual([]);
|
||||
});
|
||||
|
||||
it("still cancels a subagent announced in the foreground", () => {
|
||||
const source = new ClaudeTaskProtocolSource();
|
||||
source.observe(taskStarted({ is_backgrounded: false }));
|
||||
|
||||
expect(source.cancelRunningForegroundTasks()).toEqual([
|
||||
{ kind: "status", id: "toolu_01DgLoPMW9", status: "canceled" },
|
||||
]);
|
||||
});
|
||||
|
||||
it("still routes a backgrounded subagent that settles after the interrupt", () => {
|
||||
// The headline case: interrupt, continue, and the child that was told to outlive the turn
|
||||
// reports completion later. Wiping the routing table on cancel drops this on the floor and
|
||||
|
||||
@@ -16,7 +16,8 @@ import {
|
||||
*
|
||||
* Verified on the wire (Claude Code 2.1.220, Paseo's own query options):
|
||||
*
|
||||
* task_started task_id, tool_use_id, description, subagent_type, task_type
|
||||
* task_started task_id, tool_use_id, description, subagent_type, task_type,
|
||||
* is_backgrounded
|
||||
* task_updated task_id, patch.status, patch.is_backgrounded
|
||||
* task_notification task_id, tool_use_id, status
|
||||
*
|
||||
@@ -39,6 +40,11 @@ interface TaskStartedMessage {
|
||||
task_type?: string;
|
||||
prompt?: string;
|
||||
skip_transcript?: boolean;
|
||||
/**
|
||||
* Set at spawn: true for a task registered in the background. A resumed subagent is always
|
||||
* registered in the background.
|
||||
*/
|
||||
is_backgrounded?: boolean;
|
||||
}
|
||||
|
||||
/** Task-tool subagents. Backgrounded shell commands announce as `local_bash`. */
|
||||
@@ -71,8 +77,8 @@ interface TaskUpdatedMessage {
|
||||
task_id: string;
|
||||
/**
|
||||
* `is_backgrounded` is declared on `SDKTaskUpdatedMessage["patch"]`: it flips when a foreground
|
||||
* task is backgrounded, which is the only signal that separates a child that dies with its turn
|
||||
* from one that was explicitly told to outlive it.
|
||||
* task is moved to the background after `task_started`. Together with `task_started`'s own
|
||||
* flag it separates a child that dies with its turn from one told to outlive it.
|
||||
*/
|
||||
patch?: { status?: string; is_backgrounded?: boolean };
|
||||
}
|
||||
@@ -171,8 +177,8 @@ export class ClaudeTaskProtocolSource {
|
||||
/** Workflow invocations already own a real Workflow card in the parent timeline. */
|
||||
private readonly idsWithExistingParentToolCard = new Set<string>();
|
||||
/**
|
||||
* Declared subagents that were moved to the background. They outlive the turn that spawned
|
||||
* them, so a turn ending is not evidence that they stopped.
|
||||
* Declared subagents running in the background, whether spawned there or moved there later.
|
||||
* They outlive the turn that spawned them, so a turn ending is not evidence that they stopped.
|
||||
*/
|
||||
private readonly backgroundedIds = new Set<string>();
|
||||
/** Last status emitted per subagent, so a redundant announcement is not re-broadcast. */
|
||||
@@ -331,6 +337,7 @@ export class ClaudeTaskProtocolSource {
|
||||
|
||||
this.sawTaskStarted = true;
|
||||
const existingId = this.subagentIdByTaskId.get(message.task_id);
|
||||
this.recordBackgrounded(existingId ?? id, message.is_backgrounded);
|
||||
if (existingId) {
|
||||
return this.observeExistingTaskStart(message, id, existingId);
|
||||
}
|
||||
@@ -414,14 +421,15 @@ export class ClaudeTaskProtocolSource {
|
||||
|
||||
private observeTaskUpdated(message: TaskUpdatedMessage): SubagentObservation[] {
|
||||
const id = this.subagentIdByTaskId.get(message.task_id);
|
||||
const backgrounded = message.patch?.is_backgrounded;
|
||||
if (id && typeof backgrounded === "boolean") {
|
||||
if (backgrounded) this.backgroundedIds.add(id);
|
||||
else this.backgroundedIds.delete(id);
|
||||
}
|
||||
if (id) this.recordBackgrounded(id, message.patch?.is_backgrounded);
|
||||
return this.observeStatus(message.task_id, message.patch?.status);
|
||||
}
|
||||
|
||||
private recordBackgrounded(id: string, backgrounded: boolean | undefined): void {
|
||||
if (backgrounded === true) this.backgroundedIds.add(id);
|
||||
else if (backgrounded === false) this.backgroundedIds.delete(id);
|
||||
}
|
||||
|
||||
private observeTaskNotification(message: TaskNotificationMessage): SubagentObservation[] {
|
||||
const observations = this.observeWorkflowResult(message);
|
||||
observations.push(...this.observeUsage(message.task_id, message.usage));
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
||||
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { claudeProjectDirSync } from "../agent/providers/claude/project-dir.js";
|
||||
import { DaemonClient } from "../test-utils/daemon-client.js";
|
||||
import { createTestPaseoDaemon, type TestPaseoDaemon } from "../test-utils/paseo-daemon.js";
|
||||
|
||||
// Claude Code resumes a session by id from any working directory and keeps writing to the
|
||||
// transcript under the project folder it started in. The agent's cwd can name a different
|
||||
// folder: a project that moved, a daemon migrated between machines or containers, or Claude
|
||||
// Code running under WSL interop and seeing the cwd as a Windows path.
|
||||
// The test daemon fakes the built-in providers; a provider that extends `claude` runs the real one.
|
||||
const PROVIDER_ID = "claude-real";
|
||||
const SESSION_ID = "6f0c5d8e-4c3a-4f7b-9a51-2d8e1b7c9f10";
|
||||
|
||||
function timelineText(entries: ReadonlyArray<{ item: { type: string; text?: string } }>): string {
|
||||
return entries
|
||||
.filter(
|
||||
(
|
||||
entry,
|
||||
): entry is {
|
||||
item: { type: "user_message" | "assistant_message"; text: string };
|
||||
} => entry.item.type === "user_message" || entry.item.type === "assistant_message",
|
||||
)
|
||||
.map((entry) => entry.item.text)
|
||||
.join("\n");
|
||||
}
|
||||
|
||||
describe("daemon E2E - Claude history stored under another project folder", () => {
|
||||
let tempRoot: string;
|
||||
let paseoHomeRoot: string;
|
||||
let configDir: string;
|
||||
let transcriptCwd: string;
|
||||
let agentCwd: string;
|
||||
let daemon: TestPaseoDaemon | undefined;
|
||||
let client: DaemonClient | undefined;
|
||||
|
||||
beforeEach(() => {
|
||||
tempRoot = mkdtempSync(path.join(tmpdir(), "claude-history-other-project-"));
|
||||
paseoHomeRoot = path.join(tempRoot, "paseo-home");
|
||||
configDir = path.join(tempRoot, "claude-config");
|
||||
transcriptCwd = path.join(tempRoot, "where-claude-started");
|
||||
agentCwd = path.join(tempRoot, "agent-cwd");
|
||||
mkdirSync(paseoHomeRoot, { recursive: true });
|
||||
mkdirSync(agentCwd, { recursive: true });
|
||||
|
||||
const projectDir = claudeProjectDirSync(transcriptCwd, { configDir });
|
||||
mkdirSync(projectDir, { recursive: true });
|
||||
writeFileSync(
|
||||
path.join(projectDir, `${SESSION_ID}.jsonl`),
|
||||
[
|
||||
{
|
||||
type: "user",
|
||||
uuid: "user-uuid-1",
|
||||
sessionId: SESSION_ID,
|
||||
cwd: transcriptCwd,
|
||||
message: { role: "user", content: "hello from the original folder" },
|
||||
},
|
||||
{
|
||||
type: "assistant",
|
||||
sessionId: SESSION_ID,
|
||||
cwd: transcriptCwd,
|
||||
message: {
|
||||
role: "assistant",
|
||||
content: "reply from the original folder",
|
||||
},
|
||||
},
|
||||
]
|
||||
.map((entry) => `${JSON.stringify(entry)}\n`)
|
||||
.join(""),
|
||||
"utf8",
|
||||
);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await client?.close().catch(() => undefined);
|
||||
await daemon?.close().catch(() => undefined);
|
||||
client = undefined;
|
||||
daemon = undefined;
|
||||
rmSync(tempRoot, { recursive: true, force: true });
|
||||
}, 60_000);
|
||||
|
||||
async function startDaemon(): Promise<DaemonClient> {
|
||||
daemon = await createTestPaseoDaemon({
|
||||
paseoHomeRoot,
|
||||
cleanup: false,
|
||||
providerOverrides: {
|
||||
[PROVIDER_ID]: {
|
||||
extends: "claude",
|
||||
label: "Claude",
|
||||
env: { CLAUDE_CONFIG_DIR: configDir },
|
||||
},
|
||||
},
|
||||
});
|
||||
client = new DaemonClient({ url: `ws://127.0.0.1:${daemon.port}/ws` });
|
||||
await client.connect();
|
||||
await client.fetchAgents({ subscribe: {} });
|
||||
return client;
|
||||
}
|
||||
|
||||
async function stopDaemon(): Promise<void> {
|
||||
await client?.close();
|
||||
await daemon?.close();
|
||||
client = undefined;
|
||||
daemon = undefined;
|
||||
}
|
||||
|
||||
test("an agent's timeline survives a daemon restart", async () => {
|
||||
const firstClient = await startDaemon();
|
||||
const agent = await firstClient.importAgent({
|
||||
provider: PROVIDER_ID,
|
||||
sessionId: SESSION_ID,
|
||||
cwd: agentCwd,
|
||||
});
|
||||
await stopDaemon();
|
||||
|
||||
const restartedClient = await startDaemon();
|
||||
const timeline = await restartedClient.fetchAgentTimeline(agent.id, {
|
||||
direction: "tail",
|
||||
limit: 0,
|
||||
projection: "canonical",
|
||||
});
|
||||
|
||||
const text = timelineText(timeline.entries);
|
||||
expect(text).toContain("hello from the original folder");
|
||||
expect(text).toContain("reply from the original folder");
|
||||
}, 60_000);
|
||||
});
|
||||
@@ -0,0 +1,37 @@
|
||||
// Local ACP peer for the bundled Hoplite adapter; no Hoplite service or credentials.
|
||||
const fs = require("node:fs");
|
||||
const readline = require("node:readline");
|
||||
fs.appendFileSync(process.env.HOPLITE_TEST_RECORD, "launch\n");
|
||||
const configOptions = [
|
||||
{
|
||||
id: "model",
|
||||
category: "model",
|
||||
type: "select",
|
||||
name: "Model",
|
||||
currentValue: "fixture-model",
|
||||
options: [{ value: "fixture-model", name: "Fixture model" }],
|
||||
},
|
||||
];
|
||||
const send = (message) =>
|
||||
process.stdout.write(JSON.stringify({ jsonrpc: "2.0", ...message }) + "\n");
|
||||
readline.createInterface({ input: process.stdin }).on("line", (line) => {
|
||||
const request = JSON.parse(line);
|
||||
if (request.id === undefined) return;
|
||||
let result = {};
|
||||
if (request.method === "initialize")
|
||||
result = { protocolVersion: 1, agentCapabilities: {}, authMethods: [] };
|
||||
if (request.method === "session/new")
|
||||
result = {
|
||||
sessionId: "hoplite-fixture",
|
||||
configOptions,
|
||||
};
|
||||
if (request.method === "session/set_config_option") result = { configOptions };
|
||||
if (request.method === "session/prompt") {
|
||||
send({
|
||||
method: "_hoplite/run_phase",
|
||||
params: { runId: "fixture-run", phase: "provisioning", label: "Preparing fixture workspace" },
|
||||
});
|
||||
result = { stopReason: "end_turn" };
|
||||
}
|
||||
send({ id: request.id, result });
|
||||
});
|
||||
@@ -1,7 +1,8 @@
|
||||
import { describe, test, expect } from "vitest";
|
||||
import { mkdtemp, rm } from "node:fs/promises";
|
||||
import { mkdtemp, rm, readFile, writeFile } from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { loadConfig } from "../config.js";
|
||||
import { findExecutable } from "../../executable-resolution/executable-resolution.js";
|
||||
import { BuiltinPluginLoader } from "../plugins/builtin/index.js";
|
||||
import { createTestPaseoDaemon } from "../test-utils/paseo-daemon.js";
|
||||
@@ -165,3 +166,125 @@ test("Antigravity creates an agent and answers a prompt with real agy", async ({
|
||||
await rm(cwd, { recursive: true, force: true });
|
||||
}
|
||||
}, 120000);
|
||||
|
||||
test("bundled Hoplite requires a config entry and removal survives restart", async () => {
|
||||
const root = await mkdtemp(path.join(os.tmpdir(), "paseo-hoplite-optin-"));
|
||||
const record = path.join(root, "launches.txt");
|
||||
await writeFile(record, "");
|
||||
const options = {
|
||||
paseoHomeRoot: root,
|
||||
cleanup: false,
|
||||
mcpEnabled: false,
|
||||
builtinPlugins: new BuiltinPluginLoader(undefined, [
|
||||
"hoplite-provider",
|
||||
"antigravity-provider",
|
||||
]),
|
||||
};
|
||||
let daemon = await createTestPaseoDaemon(options);
|
||||
const connect = async () => {
|
||||
const client = new DaemonClient({
|
||||
url: `ws://127.0.0.1:${daemon.port}/ws`,
|
||||
appVersion: "0.11.2",
|
||||
});
|
||||
await client.connect();
|
||||
await client.fetchAgents({ subscribe: {} });
|
||||
return client;
|
||||
};
|
||||
let client = await connect();
|
||||
try {
|
||||
const before = await client.getProvidersSnapshot();
|
||||
expect(before.entries.some((entry) => entry.provider === "hoplite")).toBe(false);
|
||||
expect(before.entries.some((entry) => entry.provider === "antigravity")).toBe(true);
|
||||
expect(await readFile(record, "utf8")).toBe("");
|
||||
|
||||
await client.patchDaemonConfig({
|
||||
providers: {
|
||||
hoplite: {
|
||||
enabled: true,
|
||||
command: [process.execPath, path.resolve(import.meta.dirname, "hoplite-fixture.cjs")],
|
||||
env: { HOPLITE_TEST_RECORD: record },
|
||||
},
|
||||
},
|
||||
});
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
(await client.getProvidersSnapshot()).entries.find(
|
||||
(entry) => entry.provider === "hoplite",
|
||||
)?.status,
|
||||
)
|
||||
.toBe("ready");
|
||||
expect((await client.listProviderModels("hoplite")).models.map((model) => model.id)).toEqual([
|
||||
"fixture-model",
|
||||
]);
|
||||
const agent = await client.createAgent({
|
||||
provider: "hoplite",
|
||||
cwd: root,
|
||||
model: "fixture-model",
|
||||
});
|
||||
await client.sendMessage(agent.id, "Exercise the contributor transformer");
|
||||
await client.waitForFinish(agent.id, 10000);
|
||||
const timeline = await client.fetchAgentTimeline(agent.id, { limit: 100 });
|
||||
expect(timeline.entries.map((entry) => entry.item)).toContainEqual(
|
||||
expect.objectContaining({
|
||||
type: "tool_call",
|
||||
name: "Hoplite workspace",
|
||||
status: "completed",
|
||||
}),
|
||||
);
|
||||
await client.archiveAgent(agent.id);
|
||||
expect(await readFile(record, "utf8")).toContain("launch");
|
||||
|
||||
await client.patchDaemonConfig({ providers: { hoplite: { enabled: false } } });
|
||||
expect(
|
||||
(await client.getProvidersSnapshot()).entries.find((entry) => entry.provider === "hoplite")
|
||||
?.enabled,
|
||||
).toBe(false);
|
||||
await client.close();
|
||||
await daemon.close();
|
||||
daemon = await createTestPaseoDaemon({
|
||||
...options,
|
||||
staticDir: daemon.staticDir,
|
||||
providerOverrides: loadConfig(daemon.paseoHome, { env: {} }).providerOverrides,
|
||||
});
|
||||
client = await connect();
|
||||
expect(
|
||||
(await client.getProvidersSnapshot()).entries.find((entry) => entry.provider === "hoplite")
|
||||
?.enabled,
|
||||
).toBe(false);
|
||||
await client.patchDaemonConfig({ removeProviders: ["hoplite"] });
|
||||
expect(
|
||||
(await client.getProvidersSnapshot()).entries.some((entry) => entry.provider === "hoplite"),
|
||||
).toBe(false);
|
||||
expect((await client.getDaemonConfig()).config.providers?.hoplite).toBeUndefined();
|
||||
const persisted = JSON.parse(
|
||||
await readFile(path.join(daemon.paseoHome, "config.json"), "utf8"),
|
||||
);
|
||||
expect(persisted.agents?.providers?.hoplite).toBeUndefined();
|
||||
const launchesAfterRemoval = await readFile(record, "utf8");
|
||||
await client.close();
|
||||
await daemon.close();
|
||||
daemon = await createTestPaseoDaemon({
|
||||
...options,
|
||||
staticDir: daemon.staticDir,
|
||||
providerOverrides: loadConfig(daemon.paseoHome, { env: {} }).providerOverrides,
|
||||
});
|
||||
client = await connect();
|
||||
const restarted = await client.getProvidersSnapshot();
|
||||
expect(restarted.entries.some((entry) => entry.provider === "hoplite")).toBe(false);
|
||||
expect(restarted.entries.map((entry) => entry.provider)).toEqual(
|
||||
before.entries.map((entry) => entry.provider),
|
||||
);
|
||||
expect(await readFile(record, "utf8")).toBe(launchesAfterRemoval);
|
||||
await client.patchDaemonConfig({ providers: { hoplite: { enabled: false } } });
|
||||
expect(
|
||||
(await client.getProvidersSnapshot()).entries.find((entry) => entry.provider === "hoplite")
|
||||
?.enabled,
|
||||
).toBe(false);
|
||||
} finally {
|
||||
await client.close();
|
||||
await daemon.close();
|
||||
await rm(root, { recursive: true, force: true });
|
||||
await rm(daemon.staticDir, { recursive: true, force: true });
|
||||
}
|
||||
}, 60000);
|
||||
|
||||
@@ -304,6 +304,166 @@ async function waitForRunningClaudeSleep(
|
||||
);
|
||||
}
|
||||
|
||||
// Explicit point-in-time polls of agent status, on top of (not instead of) the pushed
|
||||
// agent_update events the collector already records. A phantom "running" flip that starts and
|
||||
// ends between two polls would still be caught by the pushed-event scan the callers pair this
|
||||
// with; polling here additionally proves the daemon answers fetchAgent with "idle" throughout,
|
||||
// not just that it eventually pushes one.
|
||||
async function sampleAgentStatuses(
|
||||
client: DaemonClient,
|
||||
agentId: string,
|
||||
samples: number,
|
||||
intervalMs: number,
|
||||
): Promise<string[]> {
|
||||
const statuses: string[] = [];
|
||||
for (let i = 0; i < samples; i += 1) {
|
||||
const snapshot = await client.fetchAgent({ agentId });
|
||||
statuses.push(snapshot?.agent.status ?? "missing");
|
||||
if (i < samples - 1) {
|
||||
await sleep(intervalMs);
|
||||
}
|
||||
}
|
||||
return statuses;
|
||||
}
|
||||
|
||||
// NOTE: agent_stream events on the wire (AgentStreamEventPayloadSchema in
|
||||
// packages/protocol/src/messages.ts) do not include a "provider_subagent" variant. A backgrounded
|
||||
// subagent's descriptor updates are forwarded exclusively as separate "agent.provider_subagents.update"
|
||||
// messages (see forwardProviderSubagentUpdate in session.ts), and that push channel's delivery is
|
||||
// gated by capabilities this test's plain DaemonClient does not declare. list_provider_subagents is a
|
||||
// plain request/response RPC unaffected by that gating, so status history below polls it directly
|
||||
// instead of trying to reconstruct status transitions from the stream.
|
||||
type ProviderSubagentDescriptor = Awaited<
|
||||
ReturnType<DaemonClient["listProviderSubagents"]>
|
||||
>["subagents"][number];
|
||||
|
||||
interface ProviderSubagentPoll {
|
||||
subagent: ProviderSubagentDescriptor;
|
||||
// Every status observed while polling, in order, so a transient cancel cannot hide behind a
|
||||
// later "completed" read even though the store's status field is not expected to un-cancel.
|
||||
history: string[];
|
||||
}
|
||||
|
||||
// Polls agent.provider_subagents.list until the backgrounded helper is registered at all.
|
||||
// "Main's turn is running" (waitForAgentUpsert) fires on generic turn-start bookkeeping, which
|
||||
// can be true before Claude has actually issued the Agent tool call; canceling that early
|
||||
// cancels a turn with no helper launched yet, which is not what "Stop spares a helper" means to
|
||||
// test. This confirms the helper actually exists before the caller acts on it.
|
||||
async function waitForProviderSubagentToExist(
|
||||
client: DaemonClient,
|
||||
agentId: string,
|
||||
timeoutMs = 60_000,
|
||||
): Promise<ProviderSubagentDescriptor> {
|
||||
const deadline = Date.now() + timeoutMs;
|
||||
while (Date.now() < deadline) {
|
||||
const { subagents } = await client.listProviderSubagents(agentId);
|
||||
if (subagents[0]) {
|
||||
return subagents[0];
|
||||
}
|
||||
await sleep(300);
|
||||
}
|
||||
throw new Error(
|
||||
`Timed out waiting for a background helper to be registered for agent ${agentId}`,
|
||||
);
|
||||
}
|
||||
|
||||
// Claude starts the wake-up turn a moment after the helper's completion lands (0.1 to 5 s in
|
||||
// recorded traces), so poll for it instead of checking the instant the helper reads completed.
|
||||
// The daemon announces an autonomous turn to subscribers as a pushed "running" agent_update,
|
||||
// not as an agent_stream turn_started (that stream reaches the client that started a run).
|
||||
async function waitForWakeTurn(
|
||||
collector: ReturnType<typeof createMessageCollector>,
|
||||
agentId: string,
|
||||
fromIndex: number,
|
||||
timeoutMs = 30_000,
|
||||
): Promise<boolean> {
|
||||
const deadline = Date.now() + timeoutMs;
|
||||
while (Date.now() < deadline) {
|
||||
const window = collector.messages.slice(fromIndex);
|
||||
const woke =
|
||||
getAgentStatuses(window, agentId).includes("running") ||
|
||||
window.some(
|
||||
(message) =>
|
||||
message.type === "agent_stream" &&
|
||||
message.payload.agentId === agentId &&
|
||||
message.payload.event.type === "turn_started",
|
||||
);
|
||||
if (woke) return true;
|
||||
await sleep(500);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// The wake-up turn runs briefly after it opens, so the final state is read once it settles.
|
||||
async function waitForAgentStatus(
|
||||
client: DaemonClient,
|
||||
agentId: string,
|
||||
status: string,
|
||||
timeoutMs = 60_000,
|
||||
): Promise<string | undefined> {
|
||||
const deadline = Date.now() + timeoutMs;
|
||||
let last: string | undefined;
|
||||
while (Date.now() < deadline) {
|
||||
last = (await client.fetchAgent({ agentId }))?.agent.status;
|
||||
if (last === status) return last;
|
||||
await sleep(500);
|
||||
}
|
||||
return last;
|
||||
}
|
||||
|
||||
// Polls agent.provider_subagents.list until the single backgrounded helper leaves "running".
|
||||
// Scenarios in this file always launch exactly one background helper, so subagents[0] is it.
|
||||
async function waitForProviderSubagentTerminal(
|
||||
client: DaemonClient,
|
||||
agentId: string,
|
||||
timeoutMs = 90_000,
|
||||
): Promise<ProviderSubagentPoll> {
|
||||
const deadline = Date.now() + timeoutMs;
|
||||
const history: string[] = [];
|
||||
let lastSeen: ProviderSubagentDescriptor[] = [];
|
||||
while (Date.now() < deadline) {
|
||||
const { subagents } = await client.listProviderSubagents(agentId);
|
||||
lastSeen = subagents;
|
||||
const subagent = subagents[0];
|
||||
if (subagent) {
|
||||
history.push(subagent.status);
|
||||
if (subagent.status !== "running") {
|
||||
return { subagent, history };
|
||||
}
|
||||
}
|
||||
await sleep(1_000);
|
||||
}
|
||||
throw new Error(
|
||||
`Timed out waiting for the background helper to leave "running". history=${JSON.stringify(history)} lastSeen=${JSON.stringify(lastSeen)}`,
|
||||
);
|
||||
}
|
||||
|
||||
// Pulls the main agent's own assistant text via fetchAgentTimeline rather than the push
|
||||
// collector. Assistant text delivery is paced (docs/agent-stream-performance.md), so checking
|
||||
// the collector immediately after waitForFinish resolves can still miss the final text; the
|
||||
// timeline fetch is authoritative and matches what the pre-existing tests in this file do.
|
||||
async function fetchAssistantTexts(
|
||||
client: DaemonClient,
|
||||
agentId: string,
|
||||
limit = 100,
|
||||
): Promise<string[]> {
|
||||
const timeline = await client.fetchAgentTimeline(agentId, { limit });
|
||||
return timeline.entries
|
||||
.filter((entry) => entry.item.type === "assistant_message")
|
||||
.map((entry) => (entry.item as Extract<AgentTimelineItem, { type: "assistant_message" }>).text);
|
||||
}
|
||||
|
||||
async function fetchSubagentAssistantTexts(
|
||||
client: DaemonClient,
|
||||
agentId: string,
|
||||
subagentId: string,
|
||||
): Promise<string[]> {
|
||||
const timeline = await client.fetchProviderSubagentTimeline(agentId, subagentId, { limit: 50 });
|
||||
return timeline.rows
|
||||
.filter((row) => row.item.type === "assistant_message")
|
||||
.map((row) => (row.item as Extract<AgentTimelineItem, { type: "assistant_message" }>).text);
|
||||
}
|
||||
|
||||
describe("daemon E2E (real claude) - send message during tool call", () => {
|
||||
let canRun = false;
|
||||
interface SteeringResources {
|
||||
@@ -504,6 +664,141 @@ describe("daemon E2E (real claude) - send message during tool call", () => {
|
||||
}
|
||||
}, 210_000);
|
||||
|
||||
test("a background subagent keeps running after a message is sent while it works", async () => {
|
||||
// The scenario the rest of this file explicitly rules out: every other test here tells Claude
|
||||
// "Do not use a background task", so steering during a backgrounded subagent was never
|
||||
// covered. A subagent streams on the parent's channel, so a parent that mistakes the child's
|
||||
// frames for its own work reports "running" after it has already finished, and the message
|
||||
// sent into that window is refused, or delivered by cancelling the turn and taking the
|
||||
// subagent with it. Both outcomes are user-visible, and both are what this asserts against.
|
||||
const logger = pino({ level: "silent" });
|
||||
const resources: SteeringResources = {
|
||||
cwd: tmpCwd(),
|
||||
daemon: null,
|
||||
client: null,
|
||||
collector: null,
|
||||
};
|
||||
try {
|
||||
resources.daemon = await createTestPaseoDaemon({
|
||||
agentClients: { claude: new ClaudeAgentClient({ logger }) },
|
||||
logger,
|
||||
});
|
||||
resources.client = new DaemonClient({ url: `ws://127.0.0.1:${resources.daemon.port}/ws` });
|
||||
const { client, cwd } = resources;
|
||||
if (!client) throw new Error("Claude background-subagent test client was not created");
|
||||
await within("connect background-subagent test client", 15_000, client.connect());
|
||||
await within(
|
||||
"subscribe background-subagent test client",
|
||||
15_000,
|
||||
client.fetchAgents({ subscribe: {} }),
|
||||
);
|
||||
const agent = await within(
|
||||
"create background-subagent test agent",
|
||||
30_000,
|
||||
client.createAgent({
|
||||
cwd: cwd ?? process.cwd(),
|
||||
title: "claude-background-survives-send",
|
||||
...getRealProviderConfig("claude"),
|
||||
}),
|
||||
);
|
||||
resources.collector = createMessageCollector(client);
|
||||
await within(
|
||||
"launch one background subagent and end the turn",
|
||||
30_000,
|
||||
client.sendAgentMessage(
|
||||
agent.id,
|
||||
[
|
||||
"Use the Agent tool exactly once with run_in_background: true.",
|
||||
"subagent_type: general-purpose.",
|
||||
`description: "bg survivor".`,
|
||||
`prompt: "Use the Bash tool with run_in_background: true to run exactly: sleep 40.`,
|
||||
`Wait for its completion notification, then reply exactly: CHILD_DONE."`,
|
||||
"Immediately after launching it, reply with the single word LAUNCHED and end your turn.",
|
||||
"Do not wait for it. Do not call any other tools.",
|
||||
].join(" "),
|
||||
{ messageId: generateClientMessageId() },
|
||||
),
|
||||
);
|
||||
|
||||
// The main session has ended its turn. It must read as idle even though the subagent it
|
||||
// launched is still streaming on the shared channel.
|
||||
const afterLaunch = await within(
|
||||
"wait for the main session to go idle after launching the subagent",
|
||||
120_000,
|
||||
client.waitForFinish(agent.id, 110_000),
|
||||
);
|
||||
expect(
|
||||
afterLaunch.status,
|
||||
"a main session that finished its turn must not report busy because a subagent is running",
|
||||
).not.toBe("running");
|
||||
|
||||
// And a message sent in that window must be accepted rather than refused.
|
||||
const followUpId = generateClientMessageId();
|
||||
await within(
|
||||
"send a message to the idle main session while the subagent runs",
|
||||
30_000,
|
||||
client.sendAgentMessage(agent.id, "Are you there? Reply exactly: MAIN_ALIVE.", {
|
||||
messageId: followUpId,
|
||||
}),
|
||||
);
|
||||
await within(
|
||||
"wait for the main session to answer",
|
||||
120_000,
|
||||
client.waitForFinish(agent.id, 110_000),
|
||||
);
|
||||
|
||||
const timeline = await within(
|
||||
"fetch background-subagent timeline",
|
||||
15_000,
|
||||
client.fetchAgentTimeline(agent.id, { limit: 200 }),
|
||||
);
|
||||
const assistantText = timeline.entries
|
||||
.filter((entry) => entry.item.type === "assistant_message")
|
||||
.map(
|
||||
(entry) => (entry.item as Extract<AgentTimelineItem, { type: "assistant_message" }>).text,
|
||||
)
|
||||
.join("\\n");
|
||||
expect(
|
||||
assistantText,
|
||||
"the main session must be reachable while its background subagent still runs",
|
||||
).toContain("MAIN_ALIVE");
|
||||
|
||||
// The subagent must have survived the send rather than being cancelled with the turn. Its
|
||||
// status is read from agent.provider_subagents.list (see the note above
|
||||
// waitForProviderSubagentToExist): agent_stream carries no provider_subagent events.
|
||||
const { subagents } = await within(
|
||||
"list provider subagents after the send",
|
||||
15_000,
|
||||
client.listProviderSubagents(agent.id),
|
||||
);
|
||||
expect(subagents.length, "the background subagent must be tracked").toBeGreaterThan(0);
|
||||
expect(
|
||||
subagents.map((subagent) => subagent.status),
|
||||
"a backgrounded subagent must not be canceled by a message sent to the main session",
|
||||
).not.toContain("canceled");
|
||||
const { subagent, history } = await within(
|
||||
"wait for the background subagent to finish",
|
||||
90_000,
|
||||
waitForProviderSubagentTerminal(client, agent.id, 80_000),
|
||||
);
|
||||
expect(subagent.status, "the helper must complete, not be canceled or fail").toBe(
|
||||
"completed",
|
||||
);
|
||||
expect(history, "no status poll may read canceled").not.toContain("canceled");
|
||||
} finally {
|
||||
const cleanup = await Promise.allSettled([
|
||||
Promise.resolve(resources.collector?.unsubscribe()),
|
||||
resources.client?.close() ?? Promise.resolve(),
|
||||
resources.daemon?.close() ?? Promise.resolve(),
|
||||
]);
|
||||
if (resources.cwd) rmSync(resources.cwd, { recursive: true, force: true });
|
||||
const failures = cleanup.flatMap((result) =>
|
||||
result.status === "rejected" ? [result.reason] : [],
|
||||
);
|
||||
expect(failures, "Claude background-subagent E2E cleanup failures").toEqual([]);
|
||||
}
|
||||
}, 300_000);
|
||||
|
||||
test("Stop cancels a queued Claude steer before it can resume the interrupted turn", async () => {
|
||||
const logger = pino({ level: "silent" });
|
||||
const cwd = tmpCwd();
|
||||
@@ -678,4 +973,430 @@ describe("daemon E2E (real claude) - send message during tool call", () => {
|
||||
rmSync(cwd, { recursive: true, force: true });
|
||||
}
|
||||
}, 300_000);
|
||||
|
||||
test("a helper's own nested background job does not phantom-run the parent or kill the helper", async () => {
|
||||
// The exact reported bug: main backgrounds a helper, the helper itself starts its OWN
|
||||
// background job (a grandchild from main's perspective) and then keeps working in the
|
||||
// foreground. The grandchild's completion is bookkeeping that belongs to the helper, not to
|
||||
// main, and must not make main phantom-report "running" or get treated as busy.
|
||||
const logger = pino({ level: "silent" });
|
||||
const resources: SteeringResources = {
|
||||
cwd: tmpCwd(),
|
||||
daemon: null,
|
||||
client: null,
|
||||
collector: null,
|
||||
};
|
||||
try {
|
||||
resources.daemon = await createTestPaseoDaemon({
|
||||
agentClients: { claude: new ClaudeAgentClient({ logger }) },
|
||||
logger,
|
||||
});
|
||||
resources.client = new DaemonClient({ url: `ws://127.0.0.1:${resources.daemon.port}/ws` });
|
||||
const { client, cwd } = resources;
|
||||
if (!client) throw new Error("nested background-job test client was not created");
|
||||
await within("connect nested background-job test client", 15_000, client.connect());
|
||||
await within(
|
||||
"subscribe nested background-job test client",
|
||||
15_000,
|
||||
client.fetchAgents({ subscribe: {} }),
|
||||
);
|
||||
const agent = await within(
|
||||
"create nested background-job test agent",
|
||||
30_000,
|
||||
client.createAgent({
|
||||
cwd: cwd ?? process.cwd(),
|
||||
title: "claude-nested-background-job",
|
||||
...getRealProviderConfig("claude"),
|
||||
}),
|
||||
);
|
||||
resources.collector = createMessageCollector(client);
|
||||
|
||||
await within(
|
||||
"launch a helper with its own nested background job and end the turn",
|
||||
30_000,
|
||||
client.sendAgentMessage(
|
||||
agent.id,
|
||||
[
|
||||
"Use the Agent tool exactly once with run_in_background: true.",
|
||||
"subagent_type: general-purpose.",
|
||||
`description: "nested bg survivor".`,
|
||||
`prompt: "Use the Bash tool with run_in_background: true to run exactly:`,
|
||||
`python3 -c 'import time; time.sleep(5)'.`,
|
||||
`Immediately after starting it, without waiting for it, use the Bash tool again`,
|
||||
`in the foreground to run exactly: python3 -c 'import time; time.sleep(50)'.`,
|
||||
`After that foreground command finishes, reply exactly: CHILD_DONE."`,
|
||||
"Immediately after launching it, reply with the single word LAUNCHED and end your turn.",
|
||||
"Do not wait for it. Do not call any other tools.",
|
||||
].join(" "),
|
||||
{ messageId: generateClientMessageId() },
|
||||
),
|
||||
);
|
||||
|
||||
const afterLaunch = await within(
|
||||
"wait for the main session to go idle after launching the nested-background helper",
|
||||
120_000,
|
||||
client.waitForFinish(agent.id, 110_000),
|
||||
);
|
||||
expect(afterLaunch.status, "the main session must be idle once it replied LAUNCHED").toBe(
|
||||
"idle",
|
||||
);
|
||||
|
||||
// The helper's own nested background job (5s) finishes while the helper is still busy
|
||||
// in its unrelated foreground sleep (50s). Sample for 30s, well past the nested job's
|
||||
// completion even when the helper is slow to start it,
|
||||
// both by polling and by scanning every pushed agent_update in the window, so a brief
|
||||
// phantom flip cannot slip between polls.
|
||||
const sampleWindowStart = resources.collector.messages.length;
|
||||
const polledStatuses = await sampleAgentStatuses(client, agent.id, 11, 3_000);
|
||||
const pushedStatuses = getAgentStatuses(
|
||||
resources.collector.messages.slice(sampleWindowStart),
|
||||
agent.id,
|
||||
);
|
||||
const observedRunning = [...polledStatuses, ...pushedStatuses].filter(
|
||||
(status) => status === "running",
|
||||
);
|
||||
expect(
|
||||
observedRunning,
|
||||
`the parent must stay idle across the nested job's completion; polled=${JSON.stringify(polledStatuses)} pushed=${JSON.stringify(pushedStatuses)}`,
|
||||
).toEqual([]);
|
||||
|
||||
// A message sent in that window must still be answered normally.
|
||||
await within(
|
||||
"send PONG request while the nested job settles",
|
||||
30_000,
|
||||
client.sendMessage(agent.id, "Reply with exactly PONG.", {
|
||||
messageId: generateClientMessageId(),
|
||||
}),
|
||||
);
|
||||
await within("wait for the PONG reply", 60_000, client.waitForFinish(agent.id, 50_000));
|
||||
// Pulled via fetchAgentTimeline, not the push collector: assistant text delivery is paced
|
||||
// (docs/agent-stream-performance.md) and can trail waitForFinish's own completion signal,
|
||||
// so the collector can still be missing the final text the instant waitForFinish resolves.
|
||||
const pongTexts = await within(
|
||||
"fetch timeline for the PONG reply",
|
||||
15_000,
|
||||
fetchAssistantTexts(client, agent.id, 20),
|
||||
);
|
||||
expect(
|
||||
pongTexts.join("\n"),
|
||||
"the agent must answer PONG while the helper is still running",
|
||||
).toContain("PONG");
|
||||
|
||||
const messagesBeforeWake = resources.collector.messages.length;
|
||||
|
||||
// The helper itself must survive: never recorded canceled, and it eventually reports
|
||||
// CHILD_DONE from its own foreground sleep finishing.
|
||||
const { subagent, history } = await within(
|
||||
"wait for the nested-background helper to finish",
|
||||
90_000,
|
||||
waitForProviderSubagentTerminal(client, agent.id, 80_000),
|
||||
);
|
||||
expect(subagent.status, "the helper must complete, not be canceled or fail").toBe(
|
||||
"completed",
|
||||
);
|
||||
expect(
|
||||
history,
|
||||
`no provider subagent status poll may ever read canceled; history=${JSON.stringify(history)}`,
|
||||
).not.toContain("canceled");
|
||||
const subagentTexts = await fetchSubagentAssistantTexts(client, agent.id, subagent.id);
|
||||
expect(
|
||||
subagentTexts.join("\n"),
|
||||
"the helper's own transcript must contain its final CHILD_DONE reply",
|
||||
).toContain("CHILD_DONE");
|
||||
|
||||
// The helper's completion should wake the main session with a fresh turn (the
|
||||
// session-state-driven autonomous turn), separate from the PONG exchange above.
|
||||
const wokeMainAgent = await waitForWakeTurn(
|
||||
resources.collector,
|
||||
agent.id,
|
||||
messagesBeforeWake,
|
||||
);
|
||||
if (!wokeMainAgent) {
|
||||
const wakeWindowMessages = resources.collector.messages.slice(messagesBeforeWake);
|
||||
const wakeWindowEventTypes = wakeWindowMessages
|
||||
.filter(
|
||||
(message) => message.type === "agent_stream" && message.payload.agentId === agent.id,
|
||||
)
|
||||
.map((message) =>
|
||||
message.type === "agent_stream" ? message.payload.event.type : "unknown",
|
||||
);
|
||||
const timeline = await client
|
||||
.fetchAgentTimeline(agent.id, { limit: 100 })
|
||||
.catch(() => null);
|
||||
throw new Error(
|
||||
`the helper's completion must wake the main session with a new turn. ` +
|
||||
`wakeWindowEventTypes=${JSON.stringify(wakeWindowEventTypes)} ` +
|
||||
`recentTimeline=${JSON.stringify(timeline ? summarizeTimelineItems(timeline) : null)}`,
|
||||
);
|
||||
}
|
||||
|
||||
expect(await waitForAgentStatus(client, agent.id, "idle"), "the agent must end idle").toBe(
|
||||
"idle",
|
||||
);
|
||||
} finally {
|
||||
const cleanup = await Promise.allSettled([
|
||||
Promise.resolve(resources.collector?.unsubscribe()),
|
||||
resources.client?.close() ?? Promise.resolve(),
|
||||
resources.daemon?.close() ?? Promise.resolve(),
|
||||
]);
|
||||
if (resources.cwd) rmSync(resources.cwd, { recursive: true, force: true });
|
||||
const failures = cleanup.flatMap((result) =>
|
||||
result.status === "rejected" ? [result.reason] : [],
|
||||
);
|
||||
expect(failures, "nested background-job E2E cleanup failures").toEqual([]);
|
||||
}
|
||||
}, 300_000);
|
||||
|
||||
test("the app's default steer survives a backgrounded helper while the main session works", async () => {
|
||||
// appSettings.sendBehavior defaults to "steer" (packages/app/src/hooks/use-settings/storage.ts),
|
||||
// so this is what the app actually sends when a user replies while an agent looks busy.
|
||||
const logger = pino({ level: "silent" });
|
||||
const resources: SteeringResources = {
|
||||
cwd: tmpCwd(),
|
||||
daemon: null,
|
||||
client: null,
|
||||
collector: null,
|
||||
};
|
||||
try {
|
||||
resources.daemon = await createTestPaseoDaemon({
|
||||
agentClients: { claude: new ClaudeAgentClient({ logger }) },
|
||||
logger,
|
||||
});
|
||||
resources.client = new DaemonClient({ url: `ws://127.0.0.1:${resources.daemon.port}/ws` });
|
||||
const { client, cwd } = resources;
|
||||
if (!client) throw new Error("default-steer background-helper test client was not created");
|
||||
await within("connect default-steer test client", 15_000, client.connect());
|
||||
await within(
|
||||
"subscribe default-steer test client",
|
||||
15_000,
|
||||
client.fetchAgents({ subscribe: {} }),
|
||||
);
|
||||
const agent = await within(
|
||||
"create default-steer test agent",
|
||||
30_000,
|
||||
client.createAgent({
|
||||
cwd: cwd ?? process.cwd(),
|
||||
title: "claude-default-steer-background-helper",
|
||||
...getRealProviderConfig("claude"),
|
||||
}),
|
||||
);
|
||||
resources.collector = createMessageCollector(client);
|
||||
|
||||
await within(
|
||||
"launch the background helper and start the main session's own foreground sleep",
|
||||
30_000,
|
||||
client.sendAgentMessage(
|
||||
agent.id,
|
||||
[
|
||||
"Use the Agent tool exactly once with run_in_background: true.",
|
||||
"subagent_type: general-purpose.",
|
||||
`description: "bg survivor b".`,
|
||||
`prompt: "Use the Bash tool in the foreground to run exactly:`,
|
||||
`python3 -c 'import time; time.sleep(42)'. After it finishes, reply exactly: CHILD_DONE."`,
|
||||
"Do not wait for that background helper to finish before continuing.",
|
||||
"After launching it, use the Bash tool one more time yourself, WITHOUT run_in_background,",
|
||||
"to run exactly: python3 -c 'import time; time.sleep(16)'.",
|
||||
// Matching the proven pattern from the first test in this file: tell Claude to wait
|
||||
// for a later message rather than relying on the sleep call itself to block, since a
|
||||
// Bash call can resolve through Claude Code's own async task_notification path once a
|
||||
// background subagent is already active instead of blocking the turn.
|
||||
"Do not reply or finish your turn until a later user message arrives, no matter how",
|
||||
"quickly that Bash command finishes. When that later message arrives, address it and",
|
||||
"end your turn. Do not call any other tools.",
|
||||
].join(" "),
|
||||
{ messageId: generateClientMessageId() },
|
||||
),
|
||||
);
|
||||
|
||||
// Confirm the daemon considers main's own turn active before steering it. This does not
|
||||
// wait for a specific "sleep 16" shell call to show as running: Claude Code 2.1.280 can
|
||||
// report a slower Bash call through its own async task_notification tool instead of a
|
||||
// classic blocking call once a background subagent is already active, so pinning to a
|
||||
// literal running shell tool_call is not reliable here. Busy at the daemon level is what
|
||||
// "while main is busy with its own sleep" actually needs.
|
||||
await within(
|
||||
"confirm main's own turn is active before steering",
|
||||
30_000,
|
||||
client.waitForAgentUpsert(agent.id, (snapshot) => snapshot.status === "running", 25_000),
|
||||
);
|
||||
// The running status precedes the Agent tool call, so a steer sent on it alone can reach
|
||||
// Claude before the helper exists and prove nothing about a helper surviving it.
|
||||
await within(
|
||||
"confirm the background helper is registered before steering",
|
||||
60_000,
|
||||
waitForProviderSubagentToExist(client, agent.id, 55_000),
|
||||
);
|
||||
|
||||
await within(
|
||||
"send the app's default steer while main is busy with its own sleep",
|
||||
30_000,
|
||||
client.sendMessage(agent.id, "Reply with exactly PONG.", {
|
||||
messageId: generateClientMessageId(),
|
||||
activeTurnBehavior: "steer",
|
||||
}),
|
||||
);
|
||||
|
||||
const finish = await within(
|
||||
"wait for the main session to finish after the steer",
|
||||
120_000,
|
||||
client.waitForFinish(agent.id, 110_000),
|
||||
);
|
||||
expect(finish.status, "the main session must end idle after the steer").toBe("idle");
|
||||
// Pulled via fetchAgentTimeline, not the push collector: see fetchAssistantTexts.
|
||||
const postSteerTexts = await within(
|
||||
"fetch timeline for the post-steer PONG reply",
|
||||
15_000,
|
||||
fetchAssistantTexts(client, agent.id, 20),
|
||||
);
|
||||
expect(postSteerTexts.join("\n"), "PONG must be answered after the steer").toContain("PONG");
|
||||
|
||||
const { subagent, history } = await within(
|
||||
"wait for the background helper to finish",
|
||||
90_000,
|
||||
waitForProviderSubagentTerminal(client, agent.id, 80_000),
|
||||
);
|
||||
expect(subagent.status, "the helper must complete, not be canceled or fail").toBe(
|
||||
"completed",
|
||||
);
|
||||
expect(
|
||||
history,
|
||||
`no provider subagent status poll may ever read canceled; history=${JSON.stringify(history)}`,
|
||||
).not.toContain("canceled");
|
||||
const subagentTexts = await fetchSubagentAssistantTexts(client, agent.id, subagent.id);
|
||||
expect(
|
||||
subagentTexts.join("\n"),
|
||||
"the helper's own transcript must contain its final CHILD_DONE reply",
|
||||
).toContain("CHILD_DONE");
|
||||
} finally {
|
||||
const cleanup = await Promise.allSettled([
|
||||
Promise.resolve(resources.collector?.unsubscribe()),
|
||||
resources.client?.close() ?? Promise.resolve(),
|
||||
resources.daemon?.close() ?? Promise.resolve(),
|
||||
]);
|
||||
if (resources.cwd) rmSync(resources.cwd, { recursive: true, force: true });
|
||||
const failures = cleanup.flatMap((result) =>
|
||||
result.status === "rejected" ? [result.reason] : [],
|
||||
);
|
||||
expect(failures, "default-steer background-helper E2E cleanup failures").toEqual([]);
|
||||
}
|
||||
}, 300_000);
|
||||
|
||||
test("Stop cancels the main session's own turn but spares its background helper", async () => {
|
||||
const logger = pino({ level: "silent" });
|
||||
const resources: SteeringResources = {
|
||||
cwd: tmpCwd(),
|
||||
daemon: null,
|
||||
client: null,
|
||||
collector: null,
|
||||
};
|
||||
try {
|
||||
resources.daemon = await createTestPaseoDaemon({
|
||||
agentClients: { claude: new ClaudeAgentClient({ logger }) },
|
||||
logger,
|
||||
});
|
||||
resources.client = new DaemonClient({ url: `ws://127.0.0.1:${resources.daemon.port}/ws` });
|
||||
const { client, cwd } = resources;
|
||||
if (!client) throw new Error("Stop-spares-helper test client was not created");
|
||||
await within("connect Stop-spares-helper test client", 15_000, client.connect());
|
||||
await within(
|
||||
"subscribe Stop-spares-helper test client",
|
||||
15_000,
|
||||
client.fetchAgents({ subscribe: {} }),
|
||||
);
|
||||
const agent = await within(
|
||||
"create Stop-spares-helper test agent",
|
||||
30_000,
|
||||
client.createAgent({
|
||||
cwd: cwd ?? process.cwd(),
|
||||
title: "claude-stop-spares-helper",
|
||||
...getRealProviderConfig("claude"),
|
||||
}),
|
||||
);
|
||||
resources.collector = createMessageCollector(client);
|
||||
|
||||
await within(
|
||||
"launch the background helper and start the main session's own foreground sleep",
|
||||
30_000,
|
||||
client.sendAgentMessage(
|
||||
agent.id,
|
||||
[
|
||||
"Use the Agent tool exactly once with run_in_background: true.",
|
||||
"subagent_type: general-purpose.",
|
||||
`description: "bg survivor c".`,
|
||||
`prompt: "Use the Bash tool in the foreground to run exactly:`,
|
||||
`python3 -c 'import time; time.sleep(43)'. After it finishes, reply exactly: CHILD_DONE."`,
|
||||
"Do not wait for that background helper to finish before continuing.",
|
||||
"After launching it, use the Bash tool one more time yourself, WITHOUT run_in_background,",
|
||||
"to run exactly: python3 -c 'import time; time.sleep(23)'.",
|
||||
"Do not call any other tools.",
|
||||
].join(" "),
|
||||
{ messageId: generateClientMessageId() },
|
||||
),
|
||||
);
|
||||
|
||||
// Confirm the helper has actually been launched (registered) before Stop, not just that
|
||||
// main's turn shows "running": that status can flip true on generic turn-start bookkeeping
|
||||
// before Claude has issued the Agent tool call, and canceling that early cancels a turn
|
||||
// with no helper to spare yet.
|
||||
await within(
|
||||
"confirm the background helper is registered before Stop",
|
||||
60_000,
|
||||
waitForProviderSubagentToExist(client, agent.id, 55_000),
|
||||
);
|
||||
|
||||
const messagesBeforeStop = resources.collector.messages.length;
|
||||
await within("Stop the main session's own turn", 30_000, client.cancelAgent(agent.id));
|
||||
const afterStop = await within(
|
||||
"wait for the agent to go idle after Stop",
|
||||
60_000,
|
||||
client.waitForFinish(agent.id, 50_000),
|
||||
);
|
||||
expect(afterStop.status, "Stop must leave the agent idle").toBe("idle");
|
||||
|
||||
// The helper must survive Stop: it keeps running and later reports CHILD_DONE, which
|
||||
// wakes the main session with a fresh autonomous turn.
|
||||
const { subagent, history } = await within(
|
||||
"wait for the background helper to finish after Stop",
|
||||
90_000,
|
||||
waitForProviderSubagentTerminal(client, agent.id, 80_000),
|
||||
);
|
||||
expect(subagent.status, "Stop must not cancel or fail the background helper").toBe(
|
||||
"completed",
|
||||
);
|
||||
expect(
|
||||
history,
|
||||
`no provider subagent status poll may ever read canceled; history=${JSON.stringify(history)}`,
|
||||
).not.toContain("canceled");
|
||||
const subagentTexts = await fetchSubagentAssistantTexts(client, agent.id, subagent.id);
|
||||
expect(
|
||||
subagentTexts.join("\n"),
|
||||
"the helper's own transcript must contain its final CHILD_DONE reply",
|
||||
).toContain("CHILD_DONE");
|
||||
|
||||
const wokeMainAgent = await waitForWakeTurn(
|
||||
resources.collector,
|
||||
agent.id,
|
||||
messagesBeforeStop,
|
||||
);
|
||||
expect(
|
||||
wokeMainAgent,
|
||||
"the helper's completion after Stop must wake the main session with a new turn",
|
||||
).toBe(true);
|
||||
|
||||
expect(await waitForAgentStatus(client, agent.id, "idle"), "the agent must end idle").toBe(
|
||||
"idle",
|
||||
);
|
||||
} finally {
|
||||
const cleanup = await Promise.allSettled([
|
||||
Promise.resolve(resources.collector?.unsubscribe()),
|
||||
resources.client?.close() ?? Promise.resolve(),
|
||||
resources.daemon?.close() ?? Promise.resolve(),
|
||||
]);
|
||||
if (resources.cwd) rmSync(resources.cwd, { recursive: true, force: true });
|
||||
const failures = cleanup.flatMap((result) =>
|
||||
result.status === "rejected" ? [result.reason] : [],
|
||||
);
|
||||
expect(failures, "Stop-spares-helper E2E cleanup failures").toEqual([]);
|
||||
}
|
||||
}, 300_000);
|
||||
});
|
||||
|
||||
@@ -9,6 +9,7 @@ export const builtinPlugins = [
|
||||
"copilot-usage-source",
|
||||
"cursor-usage-source",
|
||||
"grok-usage-source",
|
||||
"hoplite-provider",
|
||||
"kimi-usage-source",
|
||||
"minimax-usage-source",
|
||||
"muse-provider",
|
||||
|
||||
@@ -629,6 +629,7 @@ export class PluginService {
|
||||
label: provider.label,
|
||||
description: provider.description,
|
||||
command: provider.command,
|
||||
requiresConfiguration: provider.requiresConfiguration,
|
||||
status: provider.hasStatus
|
||||
? (request) => {
|
||||
if (!this.runtime.getProviderStatus)
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
import { z } from "zod";
|
||||
|
||||
export interface PluginProviderMetadata {
|
||||
requiresConfiguration?: boolean;
|
||||
hasCatalogCacheKey?: boolean;
|
||||
hasStatus?: boolean;
|
||||
command?: readonly [string, ...string[]];
|
||||
@@ -112,6 +113,7 @@ const providerMetadataSchema = z
|
||||
label: z.string().min(1),
|
||||
description: z.string().optional(),
|
||||
iconPath: z.string().optional(),
|
||||
requiresConfiguration: z.boolean().optional(),
|
||||
hasCatalogCacheKey: z.boolean().optional(),
|
||||
hasStatus: z.boolean().optional(),
|
||||
command: z.tuple([z.string().min(1)], z.string()).optional(),
|
||||
|
||||
@@ -158,6 +158,7 @@ export function createPluginWorker(options: {
|
||||
label: provider.label,
|
||||
description: provider.description,
|
||||
iconPath: provider.icon,
|
||||
requiresConfiguration: provider.requiresConfiguration,
|
||||
hasCatalogCacheKey: provider.getCatalogCacheKey !== undefined,
|
||||
hasStatus: provider.status !== undefined,
|
||||
command: provider.command,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user