mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-30 12:16:12 +00:00
Compare commits
97
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91fd0a7685 | ||
|
|
45be9ebe6c | ||
|
|
e771e671f9 | ||
|
|
1f07c32cf9 | ||
|
|
071ea27448 | ||
|
|
33e0a862d8 | ||
|
|
c3ea1a90c0 | ||
|
|
6c05edbc5d | ||
|
|
5bb8e4f77b | ||
|
|
63d3fc3df3 | ||
|
|
89826f0961 | ||
|
|
3986e8b808 | ||
|
|
9fd8921697 | ||
|
|
269fa33491 | ||
|
|
ebcea47942 | ||
|
|
fb9a1644f0 | ||
|
|
93278b217b | ||
|
|
5f453a2f74 | ||
|
|
01aced8cd2 | ||
|
|
9d994aca9b | ||
|
|
839d45103b | ||
|
|
96fee23fbd | ||
|
|
e31f379d54 | ||
|
|
f37991f8d4 | ||
|
|
dbc3983314 | ||
|
|
b5f56a70f6 | ||
|
|
5ef84c6bc0 | ||
|
|
1e8bf499af | ||
|
|
8849fd06c9 | ||
|
|
1cd2460a51 | ||
|
|
75abc739e6 | ||
|
|
728e09f0bb | ||
|
|
cf68bd76d4 | ||
|
|
7f2ece0556 | ||
|
|
f81d433afc | ||
|
|
a931ac1cd7 | ||
|
|
cdfc788946 | ||
|
|
8be985cb27 | ||
|
|
977049557a | ||
|
|
5d678b3848 | ||
|
|
26550ff73f | ||
|
|
eadd7c21bb | ||
|
|
a03fc5be64 | ||
|
|
c95a4a63fe | ||
|
|
a9c98a187d | ||
|
|
07709a9651 | ||
|
|
a099673413 | ||
|
|
3abb0cb18e | ||
|
|
c77a53ffdc | ||
|
|
614b4d3860 | ||
|
|
80f0b11386 | ||
|
|
95a90f5259 | ||
|
|
d059fcfd10 | ||
|
|
cfd4efe289 | ||
|
|
830697ba62 | ||
|
|
41aceb042b | ||
|
|
74f629bee1 | ||
|
|
097a0f3a7d | ||
|
|
47b4205098 | ||
|
|
d8e9a39953 | ||
|
|
d63f0204e5 | ||
|
|
9c9c839bd0 | ||
|
|
0e8e3987a0 | ||
|
|
0b1b2dd286 | ||
|
|
2c0bc525d3 | ||
|
|
27e35a198d | ||
|
|
8b7cb47ef2 | ||
|
|
693fa22377 | ||
|
|
22a318b1de | ||
|
|
4f8fed2e2b | ||
|
|
97628dfd13 | ||
|
|
25441b1845 | ||
|
|
e1bb1f8ff1 | ||
|
|
20354c13b9 | ||
|
|
f3e59c1c86 | ||
|
|
ce5b60a9e6 | ||
|
|
59a5724460 | ||
|
|
e713f5acf7 | ||
|
|
a271074716 | ||
|
|
c026b27639 | ||
|
|
526aa3133e | ||
|
|
b08a0bc6ce | ||
|
|
d7404733f6 | ||
|
|
0d215ecf29 | ||
|
|
df45627da5 | ||
|
|
5343d72939 | ||
|
|
990721e134 | ||
|
|
b1677e58d8 | ||
|
|
08298dcc10 | ||
|
|
cafb42560c | ||
|
|
6655aa77b3 | ||
|
|
291d54fa71 | ||
|
|
ddb15230b3 | ||
|
|
9dc533fcd2 | ||
|
|
0ee4a57981 | ||
|
|
aa957c9ca9 | ||
|
|
a96a4d61f1 |
@@ -60,6 +60,7 @@ sdk:
|
||||
- "packages/client/**"
|
||||
- "packages/highlight/**"
|
||||
- "packages/protocol/**"
|
||||
- "packages/workflows/**"
|
||||
|
||||
browser:
|
||||
- "packages/server/src/server/agent/provider-snapshot-manager.ts"
|
||||
|
||||
@@ -59,7 +59,7 @@ jobs:
|
||||
filters: .github/ci-paths.yml
|
||||
|
||||
- name: Validate CI contracts
|
||||
run: node --test scripts/ci-workflow.test.mjs scripts/daemon-launch-contract.test.mjs scripts/changelog-utils.test.mjs scripts/release-version-utils.test.mjs scripts/publish-release-packages.test.mjs scripts/push-current-release-tag.test.mjs scripts/reconcile-release.test.mjs scripts/sync-fdroid-changelogs.test.mjs scripts/sync-release-notes-from-changelog.test.mjs scripts/upload-release-assets.test.mjs
|
||||
run: node --test scripts/ci-workflow.test.mjs scripts/daemon-launch-contract.test.mjs scripts/changelog-utils.test.mjs scripts/release-version-utils.test.mjs scripts/publish-release-packages.test.mjs scripts/push-current-release-tag.test.mjs scripts/reconcile-release.test.mjs scripts/sync-fdroid-changelogs.test.mjs scripts/sync-release-notes-from-changelog.test.mjs scripts/upload-release-assets.test.mjs scripts/precompress-assets.test.mjs
|
||||
|
||||
quality:
|
||||
name: quality
|
||||
@@ -128,6 +128,14 @@ jobs:
|
||||
if: ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' || needs.changes.outputs.sdk != 'false') }}
|
||||
run: npm run test --workspace=@getpaseo/highlight
|
||||
|
||||
- name: Build workflows package
|
||||
if: ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' || needs.changes.outputs.sdk != 'false') }}
|
||||
run: npm run build:workflows
|
||||
|
||||
- name: Run workflows tests
|
||||
if: ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' || needs.changes.outputs.sdk != 'false') }}
|
||||
run: npm run test --workspace=@getpaseo/workflows
|
||||
|
||||
- name: Typecheck client examples
|
||||
if: ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' || needs.changes.outputs.sdk != 'false') }}
|
||||
run: npm run typecheck:examples --workspace=@getpaseo/client
|
||||
|
||||
@@ -1,5 +1,98 @@
|
||||
# Changelog
|
||||
|
||||
## 0.18.2 - 2026-11-30
|
||||
|
||||
- **Redesigned model picker:** Pick models from a two-pane desktop view with cross-provider search, an in-place phone drawer with a thinking slider, and per-provider model lists in settings. ([#11186](https://github.com/getpaseo/paseo/pull/11186), [#11280](https://github.com/getpaseo/paseo/pull/11280), [#11295](https://github.com/getpaseo/paseo/pull/11295), [#11371](https://github.com/getpaseo/paseo/pull/11371), [#11313](https://github.com/getpaseo/paseo/pull/11313))
|
||||
- **File actions and filter:** Filter the Files tree by name, and reveal, open in your default app, download, or copy paths from chat file links, file tabs, and sidebar trees. ([#11073](https://github.com/getpaseo/paseo/pull/11073), [#11299](https://github.com/getpaseo/paseo/pull/11299), [#11320](https://github.com/getpaseo/paseo/pull/11320) by [@YASICJUNWOO](https://github.com/YASICJUNWOO), [@apple-ouyang](https://github.com/apple-ouyang), [@iqshen](https://github.com/iqshen), [@Ctrl-Creeper](https://github.com/Ctrl-Creeper), [@softyoda](https://github.com/softyoda))
|
||||
- **New butterfly app icons:** Desktop and mobile now share the updated butterfly icon, with proper macOS Dock sizing and system lighting. ([#11091](https://github.com/getpaseo/paseo/pull/11091))
|
||||
- **Live usage updates:** Claude and Codex usage summaries now update as turns finish instead of waiting for the five-minute poll. ([#11170](https://github.com/getpaseo/paseo/pull/11170) by [@Zayooo00](https://github.com/Zayooo00))
|
||||
- **Faster CLI startup:** Paseo CLI commands now start 7 to 22 times faster by loading only the requested command. ([#11155](https://github.com/getpaseo/paseo/pull/11155), [#11193](https://github.com/getpaseo/paseo/pull/11193), [#11363](https://github.com/getpaseo/paseo/pull/11363))
|
||||
- **Native ACP question cards:** Plugin ACP providers such as Antigravity now pause on interactive form questions with Paseo's question card instead of printing numbered lists. ([#11135](https://github.com/getpaseo/paseo/pull/11135) by [@djbclark](https://github.com/djbclark), [@krazyjakee](https://github.com/krazyjakee))
|
||||
- **OMP background jobs:** OMP agents now list running background tasks above the composer and let you stop them without interrupting the agent. ([#11270](https://github.com/getpaseo/paseo/pull/11270) by [@mcowger](https://github.com/mcowger))
|
||||
- **Plugin HTTP tunnels:** Plugins can now expose local HTTP services at public HTTPS URLs through tunnel providers, with built-in `cloudflared` and Tailscale Funnel support. ([#11036](https://github.com/getpaseo/paseo/pull/11036))
|
||||
|
||||
### Added
|
||||
|
||||
- Added `--all` to `paseo schedule ls` to list schedules targeting existing agents, and noted hidden schedules in table output ([#11243](https://github.com/getpaseo/paseo/pull/11243) by [@suniceman](https://github.com/suniceman))
|
||||
- Added `activeTurnBehavior: "queue"` support for non-agent senders so plugins and UI actions can queue prompts behind a running turn ([#11169](https://github.com/getpaseo/paseo/pull/11169))
|
||||
|
||||
### Improved
|
||||
|
||||
- Reduced app memory use by dropping duplicate in-memory copies of cached transcripts ([#11322](https://github.com/getpaseo/paseo/pull/11322))
|
||||
- Held the native launch splash until the restored workspace is on screen so mobile cold starts no longer flash empty frames or spinners ([#11348](https://github.com/getpaseo/paseo/pull/11348))
|
||||
- Added a neutral focus border to the message composer ([#11097](https://github.com/getpaseo/paseo/pull/11097), [#11272](https://github.com/getpaseo/paseo/pull/11272) by [@Zayooo00](https://github.com/Zayooo00))
|
||||
- Changed protocol parsing to ignore unknown newer fields and skip unrecognized list items instead of dropping whole messages ([#11284](https://github.com/getpaseo/paseo/pull/11284))
|
||||
- Improved workspace lookup speed on hosts with many workspaces by filtering before loading workspace configs ([#11266](https://github.com/getpaseo/paseo/pull/11266))
|
||||
|
||||
### Changed
|
||||
|
||||
- Changed unattended Hub agent runs and their subagents to automatically deny unexpected permission prompts instead of blocking until timeout ([#11179](https://github.com/getpaseo/paseo/pull/11179))
|
||||
- Changed delegated agent turn-end notices with pending work to appear as compact tool rows instead of peer message bubbles ([#11175](https://github.com/getpaseo/paseo/pull/11175))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed iOS composer buttons ignoring taps while the software keyboard is open and the model picker opening behind the keyboard on unfolded wide screens ([#11276](https://github.com/getpaseo/paseo/pull/11276))
|
||||
- Fixed tapping Fullscreen or Exit fullscreen in the mobile composer closing the keyboard and flashing misaligned frames ([#11326](https://github.com/getpaseo/paseo/pull/11326))
|
||||
- Fixed phone photos and large Android image batches failing to send by uploading images as chunked files and downscaling HEIC photos ([#11137](https://github.com/getpaseo/paseo/pull/11137), [#9328](https://github.com/getpaseo/paseo/pull/9328), [#11281](https://github.com/getpaseo/paseo/pull/11281) by [@Brandon168](https://github.com/Brandon168))
|
||||
- Fixed Android's system Bold text setting clipping trailing characters and labels across the app ([#11162](https://github.com/getpaseo/paseo/pull/11162) by [@JustinJoshi](https://github.com/JustinJoshi))
|
||||
- Fixed the discovered Models list in Android provider settings failing to scroll ([#11350](https://github.com/getpaseo/paseo/pull/11350) by [@ilteoood](https://github.com/ilteoood))
|
||||
- Fixed mobile sending push notifications for the active chat by counting native touches and typing as presence ([#8070](https://github.com/getpaseo/paseo/pull/8070) by [@truelecter](https://github.com/truelecter))
|
||||
- Fixed SVG files opening as blank image previews on iOS and Android ([#9094](https://github.com/getpaseo/paseo/pull/9094))
|
||||
- Fixed reconnects on hosts with many workspaces causing mobile freezes and 60-second request timeouts ([#11145](https://github.com/getpaseo/paseo/pull/11145) by [@TheUnlimited64](https://github.com/TheUnlimited64))
|
||||
- Fixed desktop browser tabs controlled by an agent stealing keyboard focus from chat composers ([#11158](https://github.com/getpaseo/paseo/pull/11158) by [@puchkoff](https://github.com/puchkoff))
|
||||
- Fixed the web and desktop image lightbox staying stuck on screen after switching to another session ([#11358](https://github.com/getpaseo/paseo/pull/11358) by [@matchy233](https://github.com/matchy233))
|
||||
- Fixed long desktop and web chats crashing with React error #185 during scroll re-measurement ([#11138](https://github.com/getpaseo/paseo/pull/11138) by [@kogekiplay](https://github.com/kogekiplay))
|
||||
- Fixed scrolling older history crashing desktop when a timeline plugin reuses output IDs across messages ([#8498](https://github.com/getpaseo/paseo/pull/8498) by [@kevinle128](https://github.com/kevinle128), [@ykurilov](https://github.com/ykurilov))
|
||||
- Fixed opening Changes with wrapped long lines freezing the desktop app ([#11113](https://github.com/getpaseo/paseo/pull/11113))
|
||||
- Fixed streaming code blocks growing and shrinking by a line while their closing fence arrives ([#7006](https://github.com/getpaseo/paseo/pull/7006) by [@luoph](https://github.com/luoph), [@RRD-dev](https://github.com/RRD-dev))
|
||||
- Fixed sending a steering message while an agent streams splitting the reply in half ([#5267](https://github.com/getpaseo/paseo/pull/5267))
|
||||
- Fixed the Schedules screen staying on a spinner when another saved host is offline or still connecting ([#11361](https://github.com/getpaseo/paseo/pull/11361) by [@agenore](https://github.com/agenore))
|
||||
- Fixed starting a new session on another host submitting an unavailable remembered model instead of selecting an available one ([#9052](https://github.com/getpaseo/paseo/pull/9052) by [@mcowger](https://github.com/mcowger))
|
||||
- Fixed the composer showing the wrong thinking level when an agent's level is absent from its model's option list ([#10937](https://github.com/getpaseo/paseo/pull/10937) by [@ortschun](https://github.com/ortschun))
|
||||
- Fixed unexpanded Windows environment-variable paths like `%TEMP%\file.md` rendering as broken links in chat ([#11228](https://github.com/getpaseo/paseo/pull/11228) by [@suniceman](https://github.com/suniceman))
|
||||
- Fixed Open in Antigravity on macOS launching the `agy` CLI instead of Antigravity IDE ([#10893](https://github.com/getpaseo/paseo/pull/10893) by [@wangfh5](https://github.com/wangfh5))
|
||||
- Fixed opening a built-in plugin's settings page showing a "not installed or listed" error ([#11308](https://github.com/getpaseo/paseo/pull/11308))
|
||||
- Fixed local host images inside plugin Markdown surfaces failing to render inline ([#11171](https://github.com/getpaseo/paseo/pull/11171))
|
||||
- Fixed agent metadata disappearing from plugin views after an app reload ([#11265](https://github.com/getpaseo/paseo/pull/11265))
|
||||
- Fixed Android terminal input doubling characters, dropping Backspace, breaking Korean/Pinyin/Gboard suggestions, and mishandling hardware Enter ([#11146](https://github.com/getpaseo/paseo/pull/11146), [#11318](https://github.com/getpaseo/paseo/pull/11318) by [@apple-ouyang](https://github.com/apple-ouyang), [@lennartschoch](https://github.com/lennartschoch), [@jasonmarkperez](https://github.com/jasonmarkperez))
|
||||
- Fixed Light-mode terminals reporting dark colors to terminal apps and added live light/dark theme change notifications ([#11163](https://github.com/getpaseo/paseo/pull/11163), [#11312](https://github.com/getpaseo/paseo/pull/11312) by [@gstamp](https://github.com/gstamp))
|
||||
- Fixed web and desktop terminals using the interface font instead of the configured Code font on the DOM renderer ([#11099](https://github.com/getpaseo/paseo/pull/11099) by [@sh0nuff](https://github.com/sh0nuff))
|
||||
- Fixed Windows terminals exiting immediately on busy machines when ConPTY startup takes more than five seconds ([#11238](https://github.com/getpaseo/paseo/pull/11238))
|
||||
- Fixed closing terminals or stopping the daemon on Windows leaving terminal programs running ([#11147](https://github.com/getpaseo/paseo/pull/11147))
|
||||
- Fixed Cursor usage showing HTTP 401 or missing cards across macOS Keychain, encrypted desktop stores, and Windows ([#11148](https://github.com/getpaseo/paseo/pull/11148) by [@jasonhnd](https://github.com/jasonhnd), [@KronixDev](https://github.com/KronixDev), [@kiawin](https://github.com/kiawin), [@ChicorSun](https://github.com/ChicorSun), [@kbitz](https://github.com/kbitz))
|
||||
- Fixed OpenCode v2 agents hiding plan usage windows in the chat meter and Codex usage reading stale OpenCode v1 logins ([#11153](https://github.com/getpaseo/paseo/pull/11153) by [@Wu-Jiayang](https://github.com/Wu-Jiayang))
|
||||
- Fixed Usage missing custom Claude and Codex providers configured with separate credential directories ([#11149](https://github.com/getpaseo/paseo/pull/11149) by [@QichangZheng](https://github.com/QichangZheng))
|
||||
- Fixed Claude and Codex wrapper commands or environment tokens showing a mismatched local account in Usage ([#11154](https://github.com/getpaseo/paseo/pull/11154))
|
||||
- Fixed Claude progress updates hiding inside collapsed Thinking rows and multi-block messages repeating their final block ([#11160](https://github.com/getpaseo/paseo/pull/11160) by [@ThePharmer](https://github.com/ThePharmer))
|
||||
- Fixed orphaned Claude CLI child processes leaking on concurrent resume or early cancel, and bounded headless metadata generation ([#11143](https://github.com/getpaseo/paseo/pull/11143) by [@desmond-rai](https://github.com/desmond-rai), [@nickmaglowsch](https://github.com/nickmaglowsch))
|
||||
- Fixed idle Claude agents being marked as failed when their process exits cleanly with code 0 ([#11273](https://github.com/getpaseo/paseo/pull/11273) by [@lucamzanon](https://github.com/lucamzanon))
|
||||
- Fixed Claude Advisor tool calls staying unsettled when rebuilding chat history ([#11202](https://github.com/getpaseo/paseo/pull/11202) by [@LucasValeQueiroz](https://github.com/LucasValeQueiroz), [@SirisZheng](https://github.com/SirisZheng))
|
||||
- Fixed updated plugin system prompt instructions not reaching resumed Claude sessions ([#10917](https://github.com/getpaseo/paseo/pull/10917) by [@Tomblarom](https://github.com/Tomblarom))
|
||||
- Fixed Codex alias `-c mcp_servers.*` overrides disappearing when Paseo injects MCP servers ([#11142](https://github.com/getpaseo/paseo/pull/11142))
|
||||
- Fixed OpenCode v2 models having no Default thinking option to return to base model behavior ([#11184](https://github.com/getpaseo/paseo/pull/11184) by [@3ae3ae](https://github.com/3ae3ae))
|
||||
- Fixed Pi and OMP live streaming splitting thinking and answer blocks out of order ([#11159](https://github.com/getpaseo/paseo/pull/11159))
|
||||
- Fixed Pi chat history opening empty when transcripts contain unlinked title or model-change metadata ([#11379](https://github.com/getpaseo/paseo/pull/11379))
|
||||
- Fixed sending a Pi extension slash command mid-turn aborting the active response ([#11341](https://github.com/getpaseo/paseo/pull/11341) by [@tridao](https://github.com/tridao))
|
||||
- Fixed a rejected Pi history or rewind extension prompt crashing the daemon worker ([#11329](https://github.com/getpaseo/paseo/pull/11329) by [@thomasvan](https://github.com/thomasvan))
|
||||
- Fixed completed Pi Tintinweb background subagents staying marked as Running ([#11168](https://github.com/getpaseo/paseo/pull/11168) by [@amcfague](https://github.com/amcfague))
|
||||
- Fixed background OMP catalog refreshes triggering cancelled startup model requests ([#11129](https://github.com/getpaseo/paseo/pull/11129) by [@mcowger](https://github.com/mcowger))
|
||||
- Fixed OMP turns timing out after ten minutes while actively streaming or waiting on a question card ([#11079](https://github.com/getpaseo/paseo/pull/11079) by [@LiebeLee](https://github.com/LiebeLee))
|
||||
- Fixed Antigravity deferred turns ending early after an interim reply when the final background tool completes ([#10924](https://github.com/getpaseo/paseo/pull/10924) by [@Juns-g](https://github.com/Juns-g))
|
||||
- Fixed stopping an unresponsive ACP agent leaving later prompts stuck behind an active foreground turn ([#11152](https://github.com/getpaseo/paseo/pull/11152))
|
||||
- Fixed resumed Muse sessions dropping daemon and plugin system instructions ([#10915](https://github.com/getpaseo/paseo/pull/10915) by [@Tomblarom](https://github.com/Tomblarom))
|
||||
- Fixed Unix-socket, named-pipe, non-loopback, and HTTP-proxy daemons dropping injected Paseo MCP tools and terminal activity reporting ([#11144](https://github.com/getpaseo/paseo/pull/11144))
|
||||
- Fixed repeated daemon restarts duplicating provider image attachments in temporary directories ([#7895](https://github.com/getpaseo/paseo/pull/7895) by [@cleiter](https://github.com/cleiter))
|
||||
- Fixed concurrent reloads of the same agent failing with "Unknown agent" ([#8369](https://github.com/getpaseo/paseo/pull/8369) by [@tieo](https://github.com/tieo))
|
||||
- Fixed `paseo agent logs --tail` timing out on very large chat histories ([#10723](https://github.com/getpaseo/paseo/pull/10723) by [@minamorl](https://github.com/minamorl))
|
||||
- Fixed `paseo agent logs` hanging instead of exiting after a daemon request timeout ([#11360](https://github.com/getpaseo/paseo/pull/11360))
|
||||
- Fixed `paseo permit ls` missing pending permissions from background agents and agents past the first 200 ([#10655](https://github.com/getpaseo/paseo/pull/10655) by [@NightMachinery](https://github.com/NightMachinery))
|
||||
- Fixed `paseo --host host:port` giving generic credential advice on HTTP 400 instead of suggesting `wss://` for TLS endpoints ([#11383](https://github.com/getpaseo/paseo/pull/11383))
|
||||
|
||||
### Plugins
|
||||
|
||||
- Added `update_workspace` and workspace `metadata` support to Paseo MCP and `PluginWorkspaceSnapshot` ([#11166](https://github.com/getpaseo/paseo/pull/11166))
|
||||
- Fixed server plugin compilation failing when a dependency's type declarations import Node ambient types ([#8618](https://github.com/getpaseo/paseo/pull/8618) by [@nkwib](https://github.com/nkwib))
|
||||
|
||||
## 0.18.1 - 2026-11-27
|
||||
|
||||
- **Host metadata instructions:** Set host-wide instructions once to guide language, tone, and formatting for generated workspace titles, branch names, commit messages, and pull requests. ([#11064](https://github.com/getpaseo/paseo/pull/11064))
|
||||
|
||||
@@ -1,5 +1,98 @@
|
||||
# Changelog
|
||||
|
||||
## 0.18.2 - 2026-11-30
|
||||
|
||||
- **重新设计的模型选择器**:桌面端采用支持跨 Provider 搜索的双栏视图,手机端合并为带思考强度滑块的单层抽屉,并支持在设置中按 Provider 筛选常用模型。([#11186](https://github.com/getpaseo/paseo/pull/11186), [#11280](https://github.com/getpaseo/paseo/pull/11280), [#11295](https://github.com/getpaseo/paseo/pull/11295), [#11371](https://github.com/getpaseo/paseo/pull/11371), [#11313](https://github.com/getpaseo/paseo/pull/11313))
|
||||
- **文件操作与筛选**:支持按名称筛选文件树,并直接从对话文件链接、文件标签页和侧边栏文件树中定位文件、使用默认应用打开、下载或复制路径。([#11073](https://github.com/getpaseo/paseo/pull/11073), [#11299](https://github.com/getpaseo/paseo/pull/11299), [#11320](https://github.com/getpaseo/paseo/pull/11320),贡献者:[@YASICJUNWOO](https://github.com/YASICJUNWOO), [@apple-ouyang](https://github.com/apple-ouyang), [@iqshen](https://github.com/iqshen), [@Ctrl-Creeper](https://github.com/Ctrl-Creeper), [@softyoda](https://github.com/softyoda))
|
||||
- **全新蝴蝶应用图标**:桌面端和移动端现已统一使用新版蝴蝶图标,并在 macOS 程序坞中具备正确的图标尺寸与系统光影。([#11091](https://github.com/getpaseo/paseo/pull/11091))
|
||||
- **实时用量更新**:Claude 和 Codex 的用量摘要现在会在轮次结束时实时更新,不再需要等待五分钟轮询。([#11170](https://github.com/getpaseo/paseo/pull/11170),贡献者:[@Zayooo00](https://github.com/Zayooo00))
|
||||
- **更快的 CLI 启动速度**:Paseo CLI 仅按需加载所执行的命令,启动速度提升 7 至 22 倍。([#11155](https://github.com/getpaseo/paseo/pull/11155), [#11193](https://github.com/getpaseo/paseo/pull/11193), [#11363](https://github.com/getpaseo/paseo/pull/11363))
|
||||
- **原生 ACP 提问卡片**:Antigravity 等插件 ACP Provider 遇到交互式表单提问时,现在会暂停并显示 Paseo 原生提问卡片,而不再输出编号列表。([#11135](https://github.com/getpaseo/paseo/pull/11135),贡献者:[@djbclark](https://github.com/djbclark), [@krazyjakee](https://github.com/krazyjakee))
|
||||
- **OMP 后台任务**:OMP Agent 现在会在 Composer 上方列出正在运行的后台任务,并支持直接停止而不中断 Agent。([#11270](https://github.com/getpaseo/paseo/pull/11270),贡献者:[@mcowger](https://github.com/mcowger))
|
||||
- **插件 HTTP 隧道**:插件现在可以通过隧道 Provider 将本地 HTTP 服务暴露为公网 HTTPS 地址,内置支持 `cloudflared` 和 Tailscale Funnel。([#11036](https://github.com/getpaseo/paseo/pull/11036))
|
||||
|
||||
### 新增
|
||||
|
||||
- 为 `paseo schedule ls` 新增 `--all` 选项以列出指向现有 Agent 的定时任务,并在表格输出中提示已隐藏的定时任务 ([#11243](https://github.com/getpaseo/paseo/pull/11243),贡献者:[@suniceman](https://github.com/suniceman))
|
||||
- 为非 Agent 发送方新增 `activeTurnBehavior: "queue"` 支持,使插件和界面操作可将提示词排队到当前运行轮次之后 ([#11169](https://github.com/getpaseo/paseo/pull/11169))
|
||||
|
||||
### 改进
|
||||
|
||||
- 移除了内存中重复保留的已缓存对话记录副本,降低了应用内存占用 ([#11322](https://github.com/getpaseo/paseo/pull/11322))
|
||||
- 延长原生启动画面直到恢复的工作区渲染到屏幕上,避免移动端冷启动时闪烁空白帧或加载指示器 ([#11348](https://github.com/getpaseo/paseo/pull/11348))
|
||||
- 为消息 Composer 新增中性色调的聚焦边框 ([#11097](https://github.com/getpaseo/paseo/pull/11097), [#11272](https://github.com/getpaseo/paseo/pull/11272),贡献者:[@Zayooo00](https://github.com/Zayooo00))
|
||||
- 改进协议解析,忽略未知的新字段并跳过无法识别的列表项,不再丢弃整条消息 ([#11284](https://github.com/getpaseo/paseo/pull/11284))
|
||||
- 在加载工作区配置前先进行过滤,提升包含大量工作区主机上的工作区查询速度 ([#11266](https://github.com/getpaseo/paseo/pull/11266))
|
||||
|
||||
### 变更
|
||||
|
||||
- 无人值守的 Hub Agent 及其子 Agent 遇到意外权限请求时,改为自动拒绝而不再阻塞直至超时 ([#11179](https://github.com/getpaseo/paseo/pull/11179))
|
||||
- 仍有待处理任务的委托 Agent 轮次结束通知,改为显示为紧凑的工具调用行,而不再显示为对等消息气泡 ([#11175](https://github.com/getpaseo/paseo/pull/11175))
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复 iOS 软键盘弹出时 Composer 按钮忽略点击,以及在展开的宽屏设备上模型选择器被键盘遮挡的问题 ([#11276](https://github.com/getpaseo/paseo/pull/11276))
|
||||
- 修复在移动端 Composer 中点击全屏或退出全屏时收起键盘并闪烁错位帧的问题 ([#11326](https://github.com/getpaseo/paseo/pull/11326))
|
||||
- 修复手机照片和大量 Android 图片批次发送失败的问题,改为以分块文件上传图片并将 HEIC 照片降采样为 JPEG ([#11137](https://github.com/getpaseo/paseo/pull/11137), [#9328](https://github.com/getpaseo/paseo/pull/9328), [#11281](https://github.com/getpaseo/paseo/pull/11281),贡献者:[@Brandon168](https://github.com/Brandon168))
|
||||
- 修复 Android 系统开启粗体文字设置后应用内末尾字符和标签被截断的问题 ([#11162](https://github.com/getpaseo/paseo/pull/11162),贡献者:[@JustinJoshi](https://github.com/JustinJoshi))
|
||||
- 修复 Android 的 Provider 设置中已发现的模型列表无法滚动的问题 ([#11350](https://github.com/getpaseo/paseo/pull/11350),贡献者:[@ilteoood](https://github.com/ilteoood))
|
||||
- 修复移动端仍为当前正在查看的对话发送推送通知的问题,将原生触摸与输入计入在线活跃状态 ([#8070](https://github.com/getpaseo/paseo/pull/8070),贡献者:[@truelecter](https://github.com/truelecter))
|
||||
- 修复 iOS 和 Android 上打开 SVG 文件预览显示空白的问题 ([#9094](https://github.com/getpaseo/paseo/pull/9094))
|
||||
- 修复在包含大量工作区的主机上重连时导致移动端卡顿和 60 秒请求超时的问题 ([#11145](https://github.com/getpaseo/paseo/pull/11145),贡献者:[@TheUnlimited64](https://github.com/TheUnlimited64))
|
||||
- 修复由 Agent 控制的桌面端浏览器标签页抢占对话 Composer 键盘焦点的问题 ([#11158](https://github.com/getpaseo/paseo/pull/11158),贡献者:[@puchkoff](https://github.com/puchkoff))
|
||||
- 修复在网页端和桌面端切换到其他会话后图片灯箱仍卡在屏幕上的问题 ([#11358](https://github.com/getpaseo/paseo/pull/11358),贡献者:[@matchy233](https://github.com/matchy233))
|
||||
- 修复桌面端和网页端长对话在滚动重新测量时触发 React 错误 #185 崩溃的问题 ([#11138](https://github.com/getpaseo/paseo/pull/11138),贡献者:[@kogekiplay](https://github.com/kogekiplay))
|
||||
- 修复时间线插件跨消息复用输出 ID 时,滚动较早历史记录导致桌面端崩溃的问题 ([#8498](https://github.com/getpaseo/paseo/pull/8498),贡献者:[@kevinle128](https://github.com/kevinle128), [@ykurilov](https://github.com/ykurilov))
|
||||
- 修复在变更视图中开启长行换行时桌面端卡死的问题 ([#11113](https://github.com/getpaseo/paseo/pull/11113))
|
||||
- 修复流式输出代码块在闭合围栏尚未完整到达时高度增加一行又缩回的问题 ([#7006](https://github.com/getpaseo/paseo/pull/7006),贡献者:[@luoph](https://github.com/luoph), [@RRD-dev](https://github.com/RRD-dev))
|
||||
- 修复在 Agent 流式回复过程中发送引导消息将回复截成两半的问题 ([#5267](https://github.com/getpaseo/paseo/pull/5267))
|
||||
- 修复另一个已保存主机离线或仍在连接时,定时任务页面一直停留在加载状态的问题 ([#11361](https://github.com/getpaseo/paseo/pull/11361),贡献者:[@agenore](https://github.com/agenore))
|
||||
- 修复在另一台主机上启动新会话时提交上次记住但该主机不可用的模型,而未自动选择可用模型的问题 ([#9052](https://github.com/getpaseo/paseo/pull/9052),贡献者:[@mcowger](https://github.com/mcowger))
|
||||
- 修复 Agent 的思考强度不在其模型选项列表中时,Composer 显示错误思考强度的问题 ([#10937](https://github.com/getpaseo/paseo/pull/10937),贡献者:[@ortschun](https://github.com/ortschun))
|
||||
- 修复对话中未展开的 Windows 环境变量路径(如 `%TEMP%\file.md`)被渲染为失效链接的问题 ([#11228](https://github.com/getpaseo/paseo/pull/11228),贡献者:[@suniceman](https://github.com/suniceman))
|
||||
- 修复 macOS 上“在 Antigravity 中打开”启动 `agy` CLI 而不是 Antigravity IDE 的问题 ([#10893](https://github.com/getpaseo/paseo/pull/10893),贡献者:[@wangfh5](https://github.com/wangfh5))
|
||||
- 修复打开内置插件设置页面时显示“未安装或未列出”错误的问题 ([#11308](https://github.com/getpaseo/paseo/pull/11308))
|
||||
- 修复插件 Markdown 界面中的本地主机图片无法内联渲染的问题 ([#11171](https://github.com/getpaseo/paseo/pull/11171))
|
||||
- 修复重新加载应用后插件视图中 Agent 元数据消失的问题 ([#11265](https://github.com/getpaseo/paseo/pull/11265))
|
||||
- 修复 Android 终端输入重复字符、丢失退格键、破坏韩语/拼音/Gboard 候选词以及误处理实体回车键的问题 ([#11146](https://github.com/getpaseo/paseo/pull/11146), [#11318](https://github.com/getpaseo/paseo/pull/11318),贡献者:[@apple-ouyang](https://github.com/apple-ouyang), [@lennartschoch](https://github.com/lennartschoch), [@jasonmarkperez](https://github.com/jasonmarkperez))
|
||||
- 修复浅色模式终端向终端程序报告深色配色的问题,并新增实时浅色/深色主题切换通知 ([#11163](https://github.com/getpaseo/paseo/pull/11163), [#11312](https://github.com/getpaseo/paseo/pull/11312),贡献者:[@gstamp](https://github.com/gstamp))
|
||||
- 修复网页端和桌面端终端在 DOM 渲染器下使用界面字体而不是已配置代码字体的问题 ([#11099](https://github.com/getpaseo/paseo/pull/11099),贡献者:[@sh0nuff](https://github.com/sh0nuff))
|
||||
- 修复在负载较高的 Windows 机器上 ConPTY 启动超过五秒时终端立即退出的问题 ([#11238](https://github.com/getpaseo/paseo/pull/11238))
|
||||
- 修复在 Windows 上关闭终端或停止 daemon 时终端内程序仍在后台运行的问题 ([#11147](https://github.com/getpaseo/paseo/pull/11147))
|
||||
- 修复 Cursor 使用情况在 macOS 钥匙串、加密桌面存储和 Windows 上返回 HTTP 401 或缺失卡片的问题 ([#11148](https://github.com/getpaseo/paseo/pull/11148),贡献者:[@jasonhnd](https://github.com/jasonhnd), [@KronixDev](https://github.com/KronixDev), [@kiawin](https://github.com/kiawin), [@ChicorSun](https://github.com/ChicorSun), [@kbitz](https://github.com/kbitz))
|
||||
- 修复 OpenCode v2 Agent 在对话用量指示器中不显示套餐用量窗口,以及 Codex 使用情况读取过期 OpenCode v1 登录态的问题 ([#11153](https://github.com/getpaseo/paseo/pull/11153),贡献者:[@Wu-Jiayang](https://github.com/Wu-Jiayang))
|
||||
- 修复使用情况遗漏配置了独立凭据目录的自定义 Claude 和 Codex Provider 的问题 ([#11149](https://github.com/getpaseo/paseo/pull/11149),贡献者:[@QichangZheng](https://github.com/QichangZheng))
|
||||
- 修复使用包装命令或环境变量令牌的 Claude 和 Codex 在使用情况中显示不匹配的本地账号的问题 ([#11154](https://github.com/getpaseo/paseo/pull/11154))
|
||||
- 修复 Claude 进度更新被隐藏在折叠的思考行内,以及多块消息重复显示最后一块的问题 ([#11160](https://github.com/getpaseo/paseo/pull/11160),贡献者:[@ThePharmer](https://github.com/ThePharmer))
|
||||
- 修复并发恢复或提前取消时泄漏孤立 Claude CLI 子进程的问题,并限制无头元数据生成的并发 ([#11143](https://github.com/getpaseo/paseo/pull/11143),贡献者:[@desmond-rai](https://github.com/desmond-rai), [@nickmaglowsch](https://github.com/nickmaglowsch))
|
||||
- 修复空闲 Claude Agent 进程以退出码 0 正常退出时被标记为失败的问题 ([#11273](https://github.com/getpaseo/paseo/pull/11273),贡献者:[@lucamzanon](https://github.com/lucamzanon))
|
||||
- 修复重建对话历史时 Claude Advisor 工具调用一直停留在未完成状态的问题 ([#11202](https://github.com/getpaseo/paseo/pull/11202),贡献者:[@LucasValeQueiroz](https://github.com/LucasValeQueiroz), [@SirisZheng](https://github.com/SirisZheng))
|
||||
- 修复更新后的插件系统提示词指令未能送达已恢复的 Claude 会话的问题 ([#10917](https://github.com/getpaseo/paseo/pull/10917),贡献者:[@Tomblarom](https://github.com/Tomblarom))
|
||||
- 修复 Paseo 注入 MCP 服务器时 Codex 别名的 `-c mcp_servers.*` 覆盖配置丢失的问题 ([#11142](https://github.com/getpaseo/paseo/pull/11142))
|
||||
- 修复 OpenCode v2 模型缺少 Default 思考选项、无法恢复模型默认行为的问题 ([#11184](https://github.com/getpaseo/paseo/pull/11184),贡献者:[@3ae3ae](https://github.com/3ae3ae))
|
||||
- 修复 Pi 和 OMP 实时流式输出时思考块和回复块顺序错乱分割的问题 ([#11159](https://github.com/getpaseo/paseo/pull/11159))
|
||||
- 修复包含未关联标题或模型变更元数据的 Pi 对话历史打开为空的问题 ([#11379](https://github.com/getpaseo/paseo/pull/11379))
|
||||
- 修复在轮次进行中发送 Pi 扩展斜杠命令会中止当前回复的问题 ([#11341](https://github.com/getpaseo/paseo/pull/11341),贡献者:[@tridao](https://github.com/tridao))
|
||||
- 修复被拒绝的 Pi 历史读取或回退扩展提示导致 daemon 工作进程崩溃的问题 ([#11329](https://github.com/getpaseo/paseo/pull/11329),贡献者:[@thomasvan](https://github.com/thomasvan))
|
||||
- 修复已完成的 Pi Tintinweb 后台子 Agent 仍一直显示为运行中的问题 ([#11168](https://github.com/getpaseo/paseo/pull/11168),贡献者:[@amcfague](https://github.com/amcfague))
|
||||
- 修复后台 OMP 目录刷新触发被取消的启动模型请求的问题 ([#11129](https://github.com/getpaseo/paseo/pull/11129),贡献者:[@mcowger](https://github.com/mcowger))
|
||||
- 修复 OMP 轮次在持续流式输出或等待提问卡片超过十分钟后超时失败的问题 ([#11079](https://github.com/getpaseo/paseo/pull/11079),贡献者:[@LiebeLee](https://github.com/LiebeLee))
|
||||
- 修复 Antigravity 延迟轮次在发出中间回复后,最后一个后台工具完成时提前结束轮次的问题 ([#10924](https://github.com/getpaseo/paseo/pull/10924),贡献者:[@Juns-g](https://github.com/Juns-g))
|
||||
- 修复停止无响应的 ACP Agent 后,后续提示词一直卡在活跃前台轮次之后的问题 ([#11152](https://github.com/getpaseo/paseo/pull/11152))
|
||||
- 修复恢复的 Muse 会话丢失 daemon 和插件系统指令的问题 ([#10915](https://github.com/getpaseo/paseo/pull/10915),贡献者:[@Tomblarom](https://github.com/Tomblarom))
|
||||
- 修复监听 Unix 套接字、命名管道、非回环地址或处于 HTTP 代理后的 daemon 丢失内置 Paseo MCP 工具注入和终端活动上报的问题 ([#11144](https://github.com/getpaseo/paseo/pull/11144))
|
||||
- 修复重复重启 daemon 在临时目录中不断复制 Provider 图片附件的问题 ([#7895](https://github.com/getpaseo/paseo/pull/7895),贡献者:[@cleiter](https://github.com/cleiter))
|
||||
- 修复并发重载同一个 Agent 时返回“Unknown agent”错误的问题 ([#8369](https://github.com/getpaseo/paseo/pull/8369),贡献者:[@tieo](https://github.com/tieo))
|
||||
- 修复 `paseo agent logs --tail` 在超长对话历史上超时的问题 ([#10723](https://github.com/getpaseo/paseo/pull/10723),贡献者:[@minamorl](https://github.com/minamorl))
|
||||
- 修复 `paseo agent logs` 在 daemon 请求超时后挂起不退出的问题 ([#11360](https://github.com/getpaseo/paseo/pull/11360))
|
||||
- 修复 `paseo permit ls` 遗漏后台 Agent 以及前 200 个之后 Agent 的待处理权限的问题 ([#10655](https://github.com/getpaseo/paseo/pull/10655),贡献者:[@NightMachinery](https://github.com/NightMachinery))
|
||||
- 修复 `paseo --host host:port` 遇到 HTTP 400 时只提示检查凭据而未建议对 TLS 端点使用 `wss://` 的问题 ([#11383](https://github.com/getpaseo/paseo/pull/11383))
|
||||
|
||||
### 插件
|
||||
|
||||
- 为 Paseo MCP 和 `PluginWorkspaceSnapshot` 新增 `update_workspace` 和工作区 `metadata` 支持 ([#11166](https://github.com/getpaseo/paseo/pull/11166))
|
||||
- 修复依赖的类型声明导入 Node 环境类型时服务端插件编译失败的问题 ([#8618](https://github.com/getpaseo/paseo/pull/8618),贡献者:[@nkwib](https://github.com/nkwib))
|
||||
|
||||
## 0.18.1 - 2026-11-27
|
||||
|
||||
- **主机元数据指令**:设置一次主机级指令,即可统一控制自动生成的工作区标题、分支名、提交信息和 PR 的语言、语气与格式。([#11064](https://github.com/getpaseo/paseo/pull/11064))
|
||||
|
||||
@@ -55,6 +55,7 @@ At the start of non-trivial work, list `docs/` and skim anything relevant to the
|
||||
| [docs/permissions.md](docs/permissions.md) | Semantic daemon permissions, principals, credentials, pairing invitations, and Hub authority |
|
||||
| [docs/terminal-performance.md](docs/terminal-performance.md) | Terminal latency pipeline, coalescing/backpressure invariants, benchmark + perf spec usage |
|
||||
| [docs/terminal-rendering.md](docs/terminal-rendering.md) | Native terminal view: xterm owns the grid, cluster placement, emoji widths, mixed-direction limits, render regression |
|
||||
| [docs/timeline-sync.md](docs/timeline-sync.md) | Owned agent history, rewind retirements, live stream vs authoritative fetch, paged catch-up, client replica |
|
||||
| [docs/agent-stream-performance.md](docs/agent-stream-performance.md) | Assistant text pipeline — coalescing window, paced reveal, why arrival lumps are smoothed at render |
|
||||
| [docs/agent-stream-disclosure.md](docs/agent-stream-disclosure.md) | Expand/collapse in the chat timeline — hold contract, native anchor sequence, frame spacing, render-window cost |
|
||||
| [docs/markdown-renderer.md](docs/markdown-renderer.md) | Shared Markdown engine, the vendored library fork, native selection, links, images and library constraints |
|
||||
|
||||
+83
-16
@@ -39,8 +39,8 @@ An unarchived agent may be `closed` without being deleted or archived. Closing r
|
||||
processes and subscriptions while retaining its Paseo identity, persistence handle, timeline,
|
||||
workspace, labels, title, usage, attention, timestamps, and parent relationship. Opening or prompting
|
||||
the agent runs through `ensureAgentLoaded()`, which resumes the durable provider session under the
|
||||
same Paseo agent ID. Provider history is not appended again when the canonical timeline is already
|
||||
primed.
|
||||
same Paseo agent ID. Resume does not read provider history when the agent already has a timeline;
|
||||
see [owned history](timeline-sync.md#owned-history).
|
||||
|
||||
Reload releases the old runtime before resuming its durable session: an idle provider process can
|
||||
still own an exclusive writer. A close failure retains that runtime for cleanup and blocks the
|
||||
@@ -152,7 +152,7 @@ Users can also detach an existing subagent from the subagents track. Detach is d
|
||||
|
||||
`notifyOnFinish` defaults to `true` for agent-scoped creation and prompt follow-ups because most delegated work needs to report back to the creating agent. Set it to `false` for explicit reporting or no completion callback.
|
||||
|
||||
Agent-originated messages and automatic notifications share a recipient-daemon delivery module. A queued receipt acknowledges admission before provider dispatch. The module keeps one ordered queue per recipient, and the recipient reads its prompts in the order the daemon admitted them. Nothing overtakes an older queued message. A prompt takes its place when the daemon admits it, even while the provider is still starting an earlier turn, and a message stays in the queue until the turn that carries it starts. The turn has started when the agent manager acknowledges the run start; a turn that fails after that point is not delivered again.
|
||||
Agent-originated messages and automatic notifications share a recipient-daemon delivery module. The daemon saves a queued message, then acknowledges it with a receipt, before provider dispatch. The module keeps one ordered queue per recipient, and the recipient reads its prompts in the order the daemon admitted them. Nothing overtakes an older queued message. A prompt takes its place when the daemon admits it, even while the provider is still starting an earlier turn, and a message stays in the queue until the turn that carries it starts. The turn has started when the agent manager acknowledges the run start; a turn that fails after that point is not delivered again.
|
||||
|
||||
Any sender picks `queue`, `steer`, or `interrupt` with `activeTurnBehavior`. Agent senders default to `queue`; non-agent senders (app, CLI, plugins, Hub, top-level MCP) default to `interrupt`. Each kind of prompt is released this way:
|
||||
|
||||
@@ -170,33 +170,64 @@ A command the provider accepts out of band is the one exception to admission ord
|
||||
|
||||
One provider prompt has one session mode. A batch released by a steer, an interrupt, or a person's prompt uses the latest explicit choice in it, the person's own first. Queued messages with conflicting choices keep separate ordered dispatches.
|
||||
|
||||
The pending message window is in memory. Clean shutdown flushes it, held messages included, before
|
||||
closing agents; an abrupt crash can lose queued prompts. A durable send receipt remains pending until actual dispatch
|
||||
acknowledgment, so a lost window never becomes a completed receipt. Completion waits cover queued
|
||||
admission within their original timeout and cancellation scope, and return at permission
|
||||
checkpoints and when a Stop holds the queue.
|
||||
A provider switch can wait in the queue too (`agent.provider.switch.request` with
|
||||
`activeTurnBehavior: "queue"`). The message carries the target provider and settings, shares a prompt
|
||||
with nothing, and divides the queue: what is ahead of it goes to the current provider, and it and
|
||||
what follows go to the target. A direct prompt therefore takes along only the queued rows ahead of
|
||||
the switch. Promoting the switch cuts the running turn once the target is known to be usable. A chat
|
||||
already on the target takes the message and its settings as a plain prompt. A switch that fails keeps
|
||||
the message and holds the queue; the reason is in the daemon log.
|
||||
|
||||
The queue is saved in `$PASEO_HOME/agent-queues/` ([data model](data-model.md#directory-layout)),
|
||||
and a message is saved before its receipt is sent. Inline images are first saved as uploads, so the
|
||||
queue file holds references. An empty message is refused, and a recipient holds at most 100
|
||||
messages.
|
||||
|
||||
A message is marked `dispatching` before the provider can receive it and removed when the provider
|
||||
admits it. A dispatch that is not admitted returns the message to its place. A refused turn start
|
||||
also holds the queue: retrying by itself would be refused again and would add the prompt to the
|
||||
history each time. A message that cannot be sent is removed so that it does not block the ones
|
||||
behind it.
|
||||
|
||||
Shutdown does not send the queue. It waits only for dispatches already in flight, and everything
|
||||
else stays saved, held messages included. Closing an idle runtime keeps the queue. Archiving or
|
||||
deleting the agent clears it.
|
||||
|
||||
Bootstrap restores queues before restart recovery resumes agents, and before finish subscriptions,
|
||||
change-request watches, and ingress start. A held queue stays held. Other queues are sent, after the
|
||||
resume prompt for an agent that restart recovery resumes. A crash can leave a message marked
|
||||
`dispatching`, so the daemon looks for it in the recipient's history: a message found there is
|
||||
removed, and one not found, or whose history cannot be read, is sent again.
|
||||
|
||||
A client that retries a queued message with the same `messageId` is acknowledged again at once. The
|
||||
completed send receipt is written after dispatch, and a different request under that `messageId`
|
||||
conflicts. Completion waits cover queued admission within their original timeout and cancellation
|
||||
scope, and return at permission checkpoints and when the queue is held.
|
||||
|
||||
Finish notification intent has a separate daemon-owned lifetime. The finish-subscriptions module
|
||||
persists caller, child, host, and ownership policy through an injectable store; its JSON adapter uses
|
||||
`$PASEO_HOME/finish-subscriptions.json`. Registration must commit before creation or queued-prompt
|
||||
acknowledgment promises a notification. A pending replacement retains its predecessor until dispatch
|
||||
accepts; rejected dispatch removes only the candidate. Recovery coalesces registrations for the same
|
||||
caller, child, and host into one watch.
|
||||
accepts; rejected dispatch removes only the candidate. The record keeps the prompt's `messageId`, so
|
||||
withdrawing that message removes the subscription, also after a restart. Recovery coalesces
|
||||
registrations for the same caller, child, and host into one watch.
|
||||
|
||||
Bootstrap restores these watches after repairing stale running records to `closed` and before opening
|
||||
ingress. Reading a closed child's result does not load its provider. A finish notification reports that
|
||||
the child has settled (see below); the parent decides whether its task is complete. A child chosen for restart
|
||||
recovery is observed only after its resume was sent, so the parent never hears that it was closed
|
||||
in between. Archived or deleted parents suppress delivery;
|
||||
in between. A subscription whose prompt is still queued stays pending until that prompt is
|
||||
dispatched, so a held follow-up reports nothing. Archived or deleted parents suppress delivery;
|
||||
parent-owned creation watches also stop
|
||||
reporting after detachment.
|
||||
|
||||
Intent remains stored until the parent's notification dispatch is acknowledged. Dispatch failure
|
||||
retries the captured notification; it does not change the child's reported outcome. Remote host loss
|
||||
follows the [connected-host observation policy](connected-hosts.md#delegating-agents). Shutdown stops observation before flushing message delivery, retaining
|
||||
outstanding intent. A crash after successful dispatch but before removal commits can repeat the
|
||||
notification. Clean shutdown can also flush an already queued callback while retaining its intent,
|
||||
so that callback can repeat after restart. This is an at-least-once wakeup, without turn attribution or exactly-once delivery.
|
||||
follows the [connected-host observation policy](connected-hosts.md#delegating-agents). Shutdown stops
|
||||
observation and retains outstanding intent. A final or permission notice has an id derived from its
|
||||
subscription, so observing the same outcome again while the notice is queued adds nothing. A crash
|
||||
after successful dispatch but before removal commits can repeat the notification. This is an
|
||||
at-least-once wakeup, without turn attribution or exactly-once delivery.
|
||||
|
||||
A turn end is not always a settled child. A child can end its turn with work that will start its next
|
||||
turn by itself: a running turn, queued messages, a pending provider wake-up
|
||||
@@ -277,7 +308,8 @@ lifecycle is separate from public workspace visibility and is not a public creat
|
||||
Archive is a **soft delete**: the agent record stays on disk with `archivedAt` set, the runtime is closed, and the agent disappears from active lists. Archive is **global** — it lives on the server and propagates to every connected client.
|
||||
|
||||
Archive sets `archivedAt`, invokes the provider's native archive hook, and cascades to managed
|
||||
children.
|
||||
children. The timeline and the provider children stay, so an archived chat reads them without its
|
||||
provider; deleting the agent removes them.
|
||||
|
||||
`create_agent_request` can opt an agent into `autoArchive`. In that mode the daemon archives the agent after the first terminal turn event (`turn_completed`, `turn_failed`, or `turn_canceled`). When the agent owns an isolated workspace, auto-archive archives that workspace too; the managed worktree is removed when its final workspace reference is gone.
|
||||
|
||||
@@ -373,6 +405,8 @@ Workspace status is an aggregate activity signal computed **per `workspaceId`**.
|
||||
|
||||
Running provider-native subagents contribute `running` to the workspace owned by their parent agent. Their completed, failed, and canceled states stay in the parent's subagents track.
|
||||
|
||||
Only the parent's current runtime makes a provider child running. A child's stored status is the last report about it, and that report can come from provider history or from a runtime an earlier daemon ran, so a stored `running` child does not make the workspace running or keep the parent's runtime alive. It counts again once the live session reports it running. Closing a runtime cancels the children that runtime reported running; children it never reported keep their stored status.
|
||||
|
||||
A finished or failed workspace can be marked unread after it has been reviewed. The daemon restores
|
||||
attention on its newest eligible workspace-root agent, `error` for an agent whose lifecycle is
|
||||
`error` and `finished` otherwise, without sending a new notification. Opening a workspace restores
|
||||
@@ -394,6 +428,39 @@ that leaves the lifecycle at `error`, and replaces unread `finished` attention;
|
||||
agent would show the green dot or none. Subagents track marks are the exception: they follow the
|
||||
child's lifecycle, because the track is where a failed child stays visible.
|
||||
|
||||
## The queue track
|
||||
|
||||
The queue track is the list above the composer of the messages the host holds for the open agent
|
||||
(`packages/app/src/composer/queue/`). One list covers every sender, in the order the host sends
|
||||
them: your queued prompts, agent messages, finish notifications, and change-request updates.
|
||||
|
||||
The host owns the [queue](#relationships) and the app keeps no copy of it. `packages/app/src/agent-queue/`
|
||||
reads the list on mount and after each reconnect, and replaces it on each `agent.queue.update`. A
|
||||
queued message therefore survives a reload, is sent with every client closed, and shows on every
|
||||
client that views the agent. Files upload to the host before the message is queued, so any device
|
||||
can open a row's attachments.
|
||||
|
||||
Rows take these commands:
|
||||
|
||||
- **Send now** promotes the row with your send behavior setting: `steer`, otherwise `interrupt`.
|
||||
- **Edit** is offered on your own messages only. It withdraws the row, then replaces the composer
|
||||
draft with its text and attachments, and stages the row's provider switch again. If the host
|
||||
already started sending the row, the draft stays as it is.
|
||||
- **Cancel** withdraws the row.
|
||||
|
||||
A message you send directly (`steer` or `interrupt`) takes the queued rows with it, ahead of your
|
||||
text.
|
||||
|
||||
A message sent mid-turn with a staged provider switch is queued whatever the send behavior, and its
|
||||
row names the target.
|
||||
|
||||
A row the host is `dispatching` takes no command. A held queue shows a paused notice. The notice
|
||||
does not name Stop, because a refused turn start holds the queue too.
|
||||
|
||||
A host without `server_info.features.agentMessageQueue` has no queue track. The composer offers no
|
||||
Queue action there, and a `queue` send behavior sends as `steer`, so it does not cut the running
|
||||
turn.
|
||||
|
||||
## The subagents track
|
||||
|
||||
The track is a pill at the foot of an agent's pane (`packages/app/src/subagents/track.tsx`): a count you can read at a glance, and a panel behind it — a popover on wide screens, a sheet on compact ones — holding the rows. It floats over the transcript rather than sitting in a band above the composer, so the timeline scrolls underneath it; `packages/app/src/panels/agent-tracks.tsx` owns that placement, and the pill frame is shared with the task list in `packages/app/src/composer/tracks.tsx`.
|
||||
|
||||
@@ -94,6 +94,7 @@ workspace for a directory clears it. The store lives in memory and resets on dae
|
||||
| `server/directory-sync/` | Daemon-global latest-state sequences for projects, workspaces, and agents |
|
||||
| `server/workspace-labels/` | Host-local label catalog, assignment mutations, and explicit subscriptions |
|
||||
| `server/agent/agent-manager.ts` | Agent lifecycle state machine, timeline tracking, subscriber management |
|
||||
| `server/agent/timeline/` | Owned agent history, provider children, rewind retirements, behind a backend |
|
||||
| `server/agent/agent-storage.ts` | File-backed JSON persistence at `$PASEO_HOME/agents/` |
|
||||
| `server/agent/tools/` | Transport-neutral catalog for workspaces, agents, permissions, and automation |
|
||||
| `server/agent/mcp-server.ts` | Thin MCP adapter that registers the Paseo tool catalog with the MCP SDK |
|
||||
@@ -329,7 +330,7 @@ messages or transfers.
|
||||
### Compatibility rules
|
||||
|
||||
- WebSocket schemas are append-only. Add fields, do not remove fields, and never make optional fields required.
|
||||
- New wire enum values must be gated at serialization with `session.supports(CLIENT_CAPS.someCapability)`.
|
||||
- New wire enum values must be gated at serialization with `session.supports(CLIENT_CAPS.someCapability)`. An older reader skips an unknown value inside a list; gate it anyway when the old client must see something.
|
||||
- Capabilities belong to the physical source socket. `session.supports(...)` reads the requesting or observing source at the domain projection boundary; one socket must not borrow a sibling's capabilities.
|
||||
|
||||
Example: adding a new enum value
|
||||
@@ -337,7 +338,7 @@ Example: adding a new enum value
|
||||
```ts
|
||||
// 1. Add CLIENT_CAPS.newThing = "new_thing"
|
||||
// 2. Let new clients advertise it in WS hello
|
||||
// 3. Keep the shared producer schema strict
|
||||
// 3. Add the value to the shared schema; no catch-all branch
|
||||
// 4. Gate the new emitted value: session.supports(CLIENT_CAPS.newThing) ? "new_value" : "old_value"
|
||||
```
|
||||
|
||||
@@ -402,7 +403,7 @@ initializing → idle ⇄ running
|
||||
client-side dedup; the default fetch page is 200 items.
|
||||
- Timeline row `timestamp` values are canonical daemon-owned timestamps. Providers may supply original replay timestamps, but clients must not guess timestamp trust or hide time UI based on local clock heuristics.
|
||||
- Events stream to connected clients in real time; correctness is backed by authoritative timeline fetches and paged-to-completion catch-up.
|
||||
- Agent state persists to `$PASEO_HOME/agents/{cwd-with-dashes}/{agent-id}.json`. Timeline rows are runtime memory; provider history is the durable transcript authority and resumed agents rebuild from it. That storage path is derived from `cwd`, not from workspace id.
|
||||
- Agent state persists to `$PASEO_HOME/agents/{cwd-with-dashes}/{agent-id}.json`. That storage path is derived from `cwd`, not from workspace id. Timeline rows persist in the daemon database, `$PASEO_HOME/paseo.db`. They are the transcript authority after the first import of provider history. See [owned history](timeline-sync.md#owned-history).
|
||||
|
||||
## Right-sidebar boundary: directory-backed vs workspace-owned
|
||||
|
||||
@@ -478,6 +479,7 @@ Providers that can accept native tool definitions should set `supportsNativePase
|
||||
```
|
||||
$PASEO_HOME/
|
||||
├── agents/{cwd-with-dashes}/{agent-id}.json # Agent record
|
||||
├── paseo.db # Daemon database (SQLite): agent timelines
|
||||
├── projects/projects.json # Project registry
|
||||
├── projects/workspaces.json # Workspace registry
|
||||
├── projects/icons/ # Custom project icon images
|
||||
|
||||
+50
-2
@@ -34,7 +34,7 @@ Workspace archive runs lifecycle teardown from the exact `cwd` but removes only
|
||||
`worktreeRoot` after its last active reference disappears. Worktree recovery recreates that backing
|
||||
checkout from `mainRepoRoot`, then restores the relative path from `worktreeRoot` to `cwd`.
|
||||
|
||||
Paseo uses **file-based JSON persistence** instead of a traditional database. All data is validated at runtime with Zod schemas. Most stores write atomically (write to temp file, then rename); a few still use plain `writeFile` — see each section. There is no schema-versioning/migration framework — schemas rely on optional fields with defaults for forward compatibility, with a small amount of inline normalization in `persisted-config.ts` for legacy provider/speech entries.
|
||||
Paseo persists most stores as JSON files, and agent timelines in the [daemon database](#daemon-database). JSON data is validated at runtime with Zod schemas. Most JSON stores write atomically (write to temp file, then rename); a few still use plain `writeFile` — see each section. JSON stores have no schema-versioning/migration framework — schemas rely on optional fields with defaults for forward compatibility, with a small amount of inline normalization in `persisted-config.ts` for legacy provider/speech entries.
|
||||
|
||||
All server-side stores live under `$PASEO_HOME` (defaults to `~/.paseo`).
|
||||
|
||||
@@ -53,12 +53,16 @@ $PASEO_HOME/
|
||||
├── daemon-keypair.json # E2EE keypair for relay (mode 0600)
|
||||
├── paseo.pid # Daemon PID lock file
|
||||
├── local-credential # Per-run local client credential (mode 0600)
|
||||
├── paseo.db # Daemon database (SQLite, with -wal and -shm files)
|
||||
├── daemon.log # Default log file (path configurable)
|
||||
├── agents/
|
||||
│ └── {sanitized-cwd}/
|
||||
│ └── {agentId}.json # One file per agent
|
||||
├── schedules/
|
||||
│ └── {scheduleId}.json # One file per schedule
|
||||
├── agent-queues/
|
||||
│ ├── {agentId}.json # Undelivered messages for one agent; removed when empty
|
||||
│ └── {agentId}.json.corrupt.{ms} # Unreadable queue file, set aside at startup
|
||||
├── projects/
|
||||
│ ├── projects.json # Project registry
|
||||
│ ├── workspaces.json # Workspace registry
|
||||
@@ -181,6 +185,45 @@ Terminal activity contributes to the workspace status bucket **per `workspaceId`
|
||||
|
||||
---
|
||||
|
||||
## Daemon database
|
||||
|
||||
`$PASEO_HOME/paseo.db` is one SQLite file that the daemon opens at startup with `node:sqlite`
|
||||
(`packages/server/src/server/database/`). Agent timelines are its only store today. Each store is a
|
||||
`SchemaModule`: its own table-name prefix and an append-only list of migrations.
|
||||
|
||||
- **Migrations.** Startup runs every module's pending migrations in one transaction, so a failed
|
||||
migration leaves the file as it was. `schema_versions` records each module's version and
|
||||
`min_reader_version`. Mark a migration `breaking` when an older daemon cannot read the result,
|
||||
for example a dropped or renamed column. An older daemon then refuses to start with
|
||||
`DatabaseSchemaTooNewError`. Additive migrations leave older daemons working, and they ignore
|
||||
modules they do not know. This matters because the app and the daemon update separately, and a
|
||||
user can run an older daemon on the same `$PASEO_HOME`.
|
||||
- **Failure.** A file that SQLite cannot open stops the daemon with `DatabaseOpenError`, which
|
||||
names the path. The daemon does not delete or recreate the file.
|
||||
- **Access.** The file holds every prompt and reply, so the daemon sets it and its `-wal` and `-shm`
|
||||
files to mode `0600` on every open. SQLite gives the WAL files it creates the mode of the database
|
||||
file.
|
||||
- **Durability.** The database uses WAL with `synchronous = NORMAL`. A power loss can drop the
|
||||
last commits but does not corrupt the file.
|
||||
- **Checkpoints.** A checkpoint syncs the file to disk and takes up to 100 ms. SQLite's
|
||||
auto-checkpoint runs it on the committing thread, which stalled the event loop during streaming.
|
||||
The daemon turns it off and checkpoints from a worker thread with its own connection. If the
|
||||
worker exits, the daemon turns auto-checkpoint back on.
|
||||
- **Transactions.** `write` and `read` callbacks are synchronous, so a transaction never spans an
|
||||
`await` and transactions never interleave.
|
||||
- **Node.** `node:sqlite` needs Node 22.16 or later. Node 22 prints an experimental warning once,
|
||||
when the daemon opens the database.
|
||||
|
||||
### Agent timelines
|
||||
|
||||
`AgentTimeline` owns each agent's history, and its SQLite backend stores the projected rows, the
|
||||
source ranges, retirements, the open rewind, and provider children in `timeline_*` tables. The text
|
||||
of a streamed assistant or reasoning message is stored as one chunk per source event, beside its
|
||||
row, so a chunk never rewrites the message. An earlier file store rewrote the whole transcript on
|
||||
every update. See [owned history](timeline-sync.md#owned-history).
|
||||
|
||||
---
|
||||
|
||||
## 2. Daemon Configuration
|
||||
|
||||
**Path:** `$PASEO_HOME/config.json`
|
||||
@@ -601,7 +644,12 @@ The cache is capped at 32 MiB and evicts whole hosts in least-recently-written o
|
||||
eviction, only a baseline replacement stores that host's directory again. Mutations queued around
|
||||
the eviction are dropped when they are written, so a checkpoint never outlives its rows. Budget
|
||||
bookkeeping may scan opaque row sizes during a deferred write, never during host registry startup or
|
||||
before a requested cache row can paint. The row store is not encrypted. A cached timeline can contain
|
||||
before a requested cache row can paint. The cache holds only each row's key and UTF-8 payload size,
|
||||
never the payload: a timeline row can be megabytes, and the renderer would hold a second copy of
|
||||
every cached transcript until restart. Each store reports sizes without loading payloads. SQLite
|
||||
measures the stored text, and IndexedDB records the size on the row and reads an index over it.
|
||||
Opening an IndexedDB database written before that index existed drops its rows, because they would
|
||||
be readable but never counted against the budget. The row store is not encrypted. A cached timeline can contain
|
||||
source code, prompts, and tool output; encrypted-at-rest storage is a separate security decision.
|
||||
|
||||
### Saved hosts
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ Cards inside a section sit closer than sections. Rows inside a card touch — on
|
||||
|
||||
Rows have generous vertical padding: roughly 16px of content plus 16px of vertical padding for settings rows, 8–12px for sidebar list items where many rows must fit. Every row is at least as tall as one holding a switch, so text rows, switch rows and rows that open something (`<SettingsDetailRow>`, a collapsible row's header) line up. A row holding a button or a select is taller. Compressing rows below the established density to fit more on the screen is wrong. Too many rows means more cards or more sections, not smaller rows.
|
||||
|
||||
Rows revealed under a `<SettingsCollapsibleRow>` are nested rows, one step smaller than card rows: 8px of vertical padding, `fontSize.sm` text, `sm` controls, and one fixed height so rows with and without a trailing button line up. The collapsible row sets this for everything under it (`packages/app/src/components/settings/row-density.tsx`). Never pass a density to a row, and never pad or resize a nested row by hand. Settings rows that share a menu surface with menu rows, such as Usage's options, go inside `<MenuSettingsRows>`, which puts their labels on the menu rows' label rail (`menuRowContentInset`).
|
||||
Rows revealed under a `<SettingsCollapsibleRow>` are nested rows, one step smaller than card rows: 8px of vertical padding, `fontSize.sm` text, `sm` controls, and one fixed height so rows with and without a trailing button line up. The collapsible row sets this for everything under it (`packages/app/src/components/settings/row-density.tsx`). Never pass a density to a row, and never pad or resize a nested row by hand. Settings rows that share a menu surface with menu rows, such as Usage's options, go inside `<MenuSettingsRows>`, which puts their labels on the menu rows' label rail (`menuRowContentInset`). Settings rows that share a sheet with list rows, such as Agent settings with its radio choices and section headers, go inside `<ListSettingsRows>`, which makes every row one touch target tall so Model, switch and radio rows line up.
|
||||
|
||||
The whitespace is the design.
|
||||
|
||||
|
||||
@@ -523,6 +523,8 @@ Measured bundle size for a standard Expo web export:
|
||||
- gzip: 2.55 MiB
|
||||
- brotli: 1.93 MiB
|
||||
|
||||
`npm run build:desktop` runs the same `scripts/precompress-assets.mjs` over `packages/app/dist` before electron-builder copies it to `app-dist`, so the desktop-served UI also gets `.br`/`.gz` siblings.
|
||||
|
||||
The desktop-managed daemon disables the bundled web UI by default (`PASEO_WEB_UI_ENABLED=false`) because the desktop app already ships the renderer as `app-dist`. Shipping the same assets again inside `@getpaseo/server` would duplicate the ~10.8 MiB install. Desktop packaging also excludes `node_modules/@getpaseo/server/dist/server/web-ui/**` from the packaged app.
|
||||
|
||||
## Built workspace packages
|
||||
|
||||
@@ -36,6 +36,10 @@ ordinary `WorkspaceTab` (`SheetTab` in the store) and is an `IsolatedBottomSheet
|
||||
other sheet in the app, so it sits on the one app-wide stack: a sheet opened from any sheet lands on
|
||||
top of it, and closing the top sheet (drag, Close, backdrop, or Android Back) uncovers the one below.
|
||||
|
||||
Because that stack is app-wide and hidden workspace screens stay mounted, a sheet is not presented
|
||||
until its workspace has been on screen. A target opened in a workspace before the user gets there
|
||||
waits in the store and appears on arrival.
|
||||
|
||||
A subagent chosen from the subagents list is the exception. It opens as a page of the list's own
|
||||
sheet and replaces the list in place: Back returns to the list, Close ends both, and Open parent
|
||||
closes the list, landing on the pane the list was opened from. The store's `selectSheetTab` describes
|
||||
|
||||
+52
-15
@@ -194,9 +194,23 @@ signal because the stock iOS Reanimated value changes at move start, while
|
||||
writing a replacement Reanimated value every frame interrupts UIKit's hide
|
||||
animation. Keep this platform choice inside the keyboard module's private platform-specific translate files.
|
||||
|
||||
`ComposerDock` always keeps the surface at full height and wraps it in
|
||||
`KeyboardTranslateView`. The panel root clips it at the header edge, so rows
|
||||
slide under the header on open and out from under it on close. Do not swap the
|
||||
On iOS the native driver and Fabric both write the view's transform, and
|
||||
nothing orders a driver update with a mount. The translate view therefore
|
||||
commits where it rests as a React prop. Fabric paints a driven view's committed
|
||||
transform when it creates or resizes the view, in the same mount as the layout,
|
||||
and the driver follows a frame later. Change `enabled` on the translate view
|
||||
that the change resizes. Without a resize the old lift stays on screen until the
|
||||
driver catches up, and a mode sent to the driver from the commit can paint over
|
||||
the old layout: either way one frame draws the new layout at the old lift.
|
||||
|
||||
`ComposerDock` keeps the surface at full height and moves it with two
|
||||
`KeyboardTranslateView`s on the same translation: one holds the content, one
|
||||
holds the composer slot. Only the slot changes mode for fullscreen, and
|
||||
fullscreen resizes it on every screen. Do not put the mode on one view around
|
||||
both: that view resizes on New workspace, which drops its header, and not in a
|
||||
chat, so the two screens land the toggle differently. The panel root clips the
|
||||
surface at the header edge, so rows slide under the header on open and out from
|
||||
under it on close. Do not swap the
|
||||
dock to keyboard padding at rest. Changing its height creates either a blank
|
||||
band or a paused transition when the stream list updates its viewport.
|
||||
|
||||
@@ -231,7 +245,7 @@ instead of expanding on close and shrinking again on open.
|
||||
Fullscreen is a layout mode of the dock, not a second editor. `ComposerDock
|
||||
fullscreen` fills the stationary viewport with the composer slot over the
|
||||
still-mounted content, paints its own surface under the safe areas, and turns
|
||||
the surface translation off. The composer's single tree keeps the editing
|
||||
the slot's translation off. The content behind it keeps riding the keyboard. The composer's single tree keeps the editing
|
||||
surface at the same position in both modes, so the mounted editor, its native
|
||||
buffer, selection, and focus survive the toggle and Send's clear always reaches
|
||||
the live input. A viewport crossing the compact breakpoint still remounts it:
|
||||
@@ -278,8 +292,8 @@ for header clearance, but reserves the composer's own capped height before
|
||||
shrinking the setup scroll view. The form must not take editing space from the
|
||||
composer.
|
||||
|
||||
Move the stream and composer together through `ComposerDock`. Do not translate
|
||||
them independently.
|
||||
Move the stream and composer through `ComposerDock`, which gives both the same
|
||||
translation. Do not translate either from outside the dock.
|
||||
|
||||
`KeyboardShiftProvider` owns the normalized shift used for settled insets and
|
||||
portal geometry, plus the `isMoving` worklet value. It reconciles native
|
||||
@@ -301,9 +315,10 @@ translation scope is React context and does not cross it (Gotcha 7). It returns:
|
||||
height with it; never animate height per frame.
|
||||
|
||||
Do not measure an anchor with `measureInWindow` and correct it by the keyboard
|
||||
shift. On iOS the translate view uses the native driver, and `measureInWindow`
|
||||
includes its transform only when the view happened to re-render since the
|
||||
keyboard moved. Both results were observed, so any correction double-lifts the
|
||||
shift. On iOS the translate view uses the native driver, which moves the view
|
||||
without updating the shadow tree. The translate view commits the lift the
|
||||
keyboard is at or moving to, so `measureInWindow` includes the lift at rest and
|
||||
runs ahead of the view while the keyboard moves. Any correction double-lifts the
|
||||
popover or leaves it behind the keyboard. `measureAtRest` measures through
|
||||
Fabric's transform-free `measureLayout` instead. Re-measure when `isMoving`
|
||||
settles; the composer's resting position changes as the draft grows.
|
||||
@@ -315,8 +330,8 @@ the anchor's rect against the layer and commits the placement with `flushSync`,
|
||||
which runs after layout and before paint. On native a Reanimated frame callback
|
||||
reads only the anchor's height on the UI thread and holds its bottom edge at
|
||||
the rest measurement. A height carries no transform. On iOS the absolute
|
||||
position does not reliably include one: the keyboard lift runs on the native
|
||||
driver and reaches the shadow tree only when the view re-renders. The
|
||||
position does not follow the keyboard while it moves: the lift runs on the
|
||||
native driver, and the shadow tree holds only where the keyboard is going. The
|
||||
fixed-bottom model is wrong for the centered New workspace composer on tablets,
|
||||
which grows around its middle, and for width or x changes. The popover is off
|
||||
there by half the growth, or by the old width, until the next rest measurement.
|
||||
@@ -324,6 +339,21 @@ Keep the portal's `KeyboardTranslateView` host-sized with
|
||||
`pointerEvents="box-none"` and position the popover inside it, so the popover
|
||||
moves without leaving its parent's bounds (Gotcha 1).
|
||||
|
||||
The resting commit also keeps touches working. Pressability measures a
|
||||
`Pressable`'s press region in the shadow tree. If the region stays at the
|
||||
unlifted position, a tap that drifts a few points leaves it and the press is
|
||||
dropped. This hit every control in the dock: Send, attach, and the model selector.
|
||||
|
||||
`Combobox` positions its native popover with floating-ui against the window, and
|
||||
the software keyboard covers part of the window. It adds the settled keyboard
|
||||
height (`useSettledKeyboardHeight`) to its bottom collision padding. The height
|
||||
changes on `keyboardDidShow` and `keyboardDidHide`, at the end of the move. The new
|
||||
padding re-measures the anchor on the next frame, when the resting lift is in the
|
||||
shadow tree, so the popover follows an anchor that rides the keyboard.
|
||||
Opening the model picker moves focus to its search input, and the keyboard hides
|
||||
and shows again on the way. A height that changes at `keyboardWillShow` instead
|
||||
measures the trigger before it lifts and leaves the popover over the keyboard.
|
||||
|
||||
The provider also reconciles iOS from the controller's native `onEnd` event.
|
||||
The controller's stock iOS shared values update at move start and during an
|
||||
interactive move, but not at the terminal event, so JS contention can otherwise
|
||||
@@ -417,10 +447,17 @@ wide layouts keep local geometry. That export is
|
||||
what `patches/@gorhom+bottom-sheet+*.patch` adds.
|
||||
|
||||
A sheet whose owner may veto the close (unsaved work) passes `enableDismissOnClose={false}`. Every
|
||||
close path then parks the sheet at index -1 with its content mounted; the owner hears
|
||||
`onChange(-1)`, runs its guard, and either snaps back to 0 or drops its state, which unmounts the
|
||||
sheet and takes it off the stack. Calling `dismiss()` on such a sheet bypasses the guard and
|
||||
unmounts it, so its backdrop and Back press call `close()`.
|
||||
close path then parks the sheet at index -1 with its content mounted; the owner runs its guard and
|
||||
either snaps back to 0 or drops its state, which unmounts the sheet and takes it off the stack.
|
||||
Calling `dismiss()` on such a sheet bypasses the guard and unmounts it, so its backdrop and Back
|
||||
press call `close()`.
|
||||
|
||||
Run that guard from the wrapper's `onClosed`. Gorhom only calls `onChange` when a close ends at a
|
||||
different index than the one it already recorded, and an interrupted mount animation leaves that
|
||||
record at -1, so the close that follows is invisible: the sheet parks with its backdrop still over
|
||||
the app, and every tap in the covered area is lost. `onClosed` watches the close animation settle at
|
||||
the closed detent and reports it either way. Keeping `onChange` as well is harmless as long as the
|
||||
guard is idempotent.
|
||||
|
||||
The wrapper must give Gorhom an object ref. Gorhom accepts a callback ref at the React boundary
|
||||
but stores it in the modal queue and later reads `.current`; provider dismissal, replacement,
|
||||
|
||||
@@ -47,6 +47,9 @@ The component renders state and dispatches intent. That is all it does.
|
||||
4. **Resolution is explicit model state, per host** (`idle | pending |
|
||||
complete`), keyed off the opened snapshot's serverId. Waiting for data is a
|
||||
state you can render, not an effect race.
|
||||
Create-agent model preferences are shared across hosts, so resolve remembered
|
||||
models against the selected host's ready catalog before applying them. Keep
|
||||
explicit initial values and user selections intact.
|
||||
5. **Displays are owned state.** The selected option's label is captured at
|
||||
selection/seed time (`setProject(value, display)`), never re-derived from a
|
||||
live options list — list churn must not flicker or blank a selection.
|
||||
|
||||
+2
-2
@@ -57,8 +57,8 @@ Authoritative terminology. UI label wins. Don't invent synonyms; use what's here
|
||||
- **Composer toolbar** — The bottom control row inside the composer input. Contains agent controls, attachment button, voice controls, and stop/send controls. Code: `leftContent`, `beforeVoiceContent`, and `rightContent` slots in `MessageInput` (`packages/app/src/composer/input/input.tsx`). Forbidden: "Status bar".
|
||||
- **Agent controls** — Provider, model, mode, thinking, and provider-feature controls for an agent or draft agent. Code: `AgentControls` / `DraftAgentControls` (`packages/app/src/composer/agent-controls/index.tsx`). Forbidden: "Agent status bar".
|
||||
- **Composer footer** — Optional area rendered below the composer input but still inside the keyboard-shifted composer layout. Code: `Composer.footer` (`packages/app/src/composer/index.tsx`).
|
||||
- **Composer track** — A contextual lane at the foot of a pane, by the composer input. Specific tracks use the `<thing> track` form: **Queue track**, **Subagents track**, **Tasks track**. The subagents and tasks tracks are pills floating over the transcript, each opening a panel with its rows; the queue track is a lane inside the composer itself. Code: queue track inside `Composer` (`packages/app/src/composer/index.tsx`), pill and panel frame in `packages/app/src/composer/tracks.tsx`, `SubagentsTrack` (`packages/app/src/subagents/track.tsx`), `AgentTaskList` (`packages/app/src/composer/task-list/index.tsx`).
|
||||
- **Steer** — A follow-up admitted into an agent's already-running turn instead of interrupting it. Interrupting the turn discards steers the provider has not read yet; there is no take-back short of that, and no provider offers one. The stop button and Escape both interrupt. A steer the provider never read keeps its transcript row, matching Codex. Sending while the agent waits on a permission denies that request first, so the message reaches the same turn instead of stalling behind it. UI: "Send and steer". Code: `steerActiveTurn` (`packages/server/src/server/agent/agent-sdk-types.ts`). Don't confuse with **Queue track**, which holds messages client-side until the turn ends and never enters the running turn. An agent sender's `activeTurnBehavior: "steer"` (CLI `--behavior steer`) means the same as a person's steer. Agent senders default to `queue` instead: the daemon holds the message until the running turn ends, as the queue track does for a person. Forbidden: "Delivery", "Queued prompt".
|
||||
- **Composer track** — A contextual lane at the foot of a pane, by the composer input. Specific tracks use the `<thing> track` form: **Queue track**, **Subagents track**, **Tasks track**. The subagents and tasks tracks are pills floating over the transcript, each opening a panel with its rows; the [queue track](agent-lifecycle.md#the-queue-track) is a lane inside the composer itself. Code: `ComposerQueueTrack` (`packages/app/src/composer/queue/track.tsx`), pill and panel frame in `packages/app/src/composer/tracks.tsx`, `SubagentsTrack` (`packages/app/src/subagents/track.tsx`), `AgentTaskList` (`packages/app/src/composer/task-list/index.tsx`).
|
||||
- **Steer** — A follow-up admitted into an agent's already-running turn instead of interrupting it. Interrupting the turn discards steers the provider has not read yet; there is no take-back short of that, and no provider offers one. The stop button and Escape both interrupt. A steer the provider never read keeps its transcript row, matching Codex. Sending while the agent waits on a permission denies that request first, so the message reaches the same turn instead of stalling behind it. UI: "Send and steer". Code: `steerActiveTurn` (`packages/server/src/server/agent/agent-sdk-types.ts`). Don't confuse with **Queue track**, which lists the messages the host holds until the turn ends. A queued message does not enter the running turn. An agent sender's `activeTurnBehavior: "steer"` (CLI `--behavior steer`) means the same as a person's steer. Agent senders default to `queue` instead: the daemon holds the message until the running turn ends, as it does for a person's queued message. Forbidden: "Delivery", "Queued prompt".
|
||||
- **Subagent** — User-facing term for an agent session related to a parent agent session. Use **subagents** in UI copy and docs. Internal daemon/provider plumbing may say "child agent" or `child_session`, especially for provider-managed imports; do not surface "child agent" as a product term.
|
||||
- **Attachment tray** — The selected-attachments row inside the composer input, above the text input. Code: `renderAttachmentTray` (`packages/app/src/composer/index.tsx`). Forbidden: "Attachment bar".
|
||||
- **Fork** — Starting a NEW agent session seeded with a copy of another session's curated chat history. The history rides along as a `chat_history` composer attachment on a draft; the fork does **not** resume or branch the provider-side session, and the source session keeps running untouched. Two targets, one surface, one RPC (`agent.fork_context`, gated on the `agentForkContext` host feature). UI: the fork menu lives in the assistant turn footer and offers "Fork in a new tab" / "Fork in a new workspace". On a **completed** turn it sits beside the copy button and pins a boundary to that turn, so the fork stops where the turn ended. On the **in-flight** turn it sits beside the progress loader and elapsed timer, and omits the boundary entirely — `selectForkContextRows` projects the whole timeline when no boundary is given, so the fork captures everything **up to now**, including the response still streaming. That omission is what makes mid-run forking work; pinning a boundary there would silently drop the live response. Forbidden on provider-subagent (read-only) panes. Code: `useForkAgent` (`packages/app/src/hooks/use-fork-agent.ts`), `selectForkContextRows` (`packages/server/src/server/agent/activity-curator.ts`). Don't confuse with: git fork (unrelated; Paseo has no such concept), **Worktree** (filesystem isolation, not history copying).
|
||||
|
||||
+12
-1
@@ -127,7 +127,18 @@ With a Codex draft selected, set `_SCENARIO=growth` on a 402pt-wide iPhone to
|
||||
check live wrapping, shrinking, the 12pt anchor gap, and command insertion. Set
|
||||
`_SCENARIO=previews` on an SE-sized iPhone to check long and short descriptions
|
||||
under an eight-line draft, selection with the keyboard shown and hidden, and
|
||||
file mentions. These scenarios only need `_SERVER_ID` and `_WORKSPACE_ID`;
|
||||
file mentions. Set `_SCENARIO=controls` to tap the attach button and the model
|
||||
selector with a 3pt drag while the keyboard is open, then check that a wide
|
||||
layout's model popover clears both the trigger and the keyboard. Run it on an
|
||||
iPhone and on the iPhone Duo unfolded. Set `_SCENARIO=fullscreen` to toggle an
|
||||
eight-line draft in and out of fullscreen with the keyboard open, on a workspace
|
||||
draft tab and on New workspace. Every toggle must keep the keyboard, fullscreen
|
||||
must cover the screen behind the keyboard with Send above it, and exit must
|
||||
return the composer to its resting place. It then records the screen through
|
||||
eight toggles and fails if any frame draws Send anywhere but its inline or its
|
||||
fullscreen place; snapshots are a second apart and cannot see one wrong frame.
|
||||
The recording needs `ffmpeg` on the PATH and reads the booted simulator unless
|
||||
`_UDID` is set. These scenarios only need `_SERVER_ID` and `_WORKSPACE_ID`;
|
||||
`_UDID` selects an exact simulator and `_ARTIFACTS_DIR` overrides the output path.
|
||||
|
||||
The Android sidebar scroll-retention flow requires a connected host with enough
|
||||
|
||||
+12
-2
@@ -267,6 +267,10 @@ Plugin UI runs on desktop and mobile across multiple themes: color every `Text`
|
||||
`theme.colors.foreground` or `theme.colors.foregroundMuted`, and size layout from `layout.compact`.
|
||||
See `public-docs/plugins/reference.md`.
|
||||
|
||||
A plugin reads and arranges panes and tabs through `PluginWorkspaceLayout`. Its host,
|
||||
`packages/app/src/plugins/workspace-layout/`, is a facade over the layout store and `workspace-tabs`,
|
||||
so add behavior to those owners and keep layout mechanics out of the SDK types.
|
||||
|
||||
### SDK import boundaries
|
||||
|
||||
Classify every SDK export before adding it. All client entry points and implementations live under
|
||||
@@ -639,6 +643,12 @@ effective configuration and execution environment, or
|
||||
`undefined` for target-specific caching. Ignore `force` when choosing identity. Existing providers
|
||||
need no change. See [catalogue ownership](providers.md#provider-snapshot-refresh-contract).
|
||||
|
||||
Both sides of the provider protocol ignore fields they do not know. A list element of an unknown
|
||||
kind, such as a prompt content block, a command kind, or a timeline item, is dropped and the rest of
|
||||
the input or event is kept. The daemon drops an event of a kind it does not know and keeps the
|
||||
connection open. Paseo supplies the SDK at runtime, so both sides read with the daemon's parser. An
|
||||
input the provider must act on still needs a connection capability, as `session.launch_wrap` does.
|
||||
|
||||
`send()` resolves after acceptance. Publish operation completion, prompt disposition, turn state,
|
||||
configuration, permissions, persistence, and complete timeline snapshots through `onEvent()`.
|
||||
Route messages, structured commands, steering, and command side effects through `session.prompt`.
|
||||
@@ -1012,8 +1022,8 @@ payload that cannot be rendered intact. The daemon advertises this RPC through
|
||||
|
||||
`addSlashCommand` registers an agent- or workspace-context command in the composer. The
|
||||
callback runs in the app, receives the trimmed text after the command name as `args`, and receives
|
||||
the same `paseo`, `rpc`, `openScreen`, workspace, agent, and `openPanel` capabilities as the matching
|
||||
Command Center callback.
|
||||
the same `paseo`, `rpc`, `openScreen`, workspace, agent, and `workspaceLayout` capabilities as the
|
||||
matching Command Center callback.
|
||||
|
||||
```ts
|
||||
client.addSlashCommand({
|
||||
|
||||
@@ -17,6 +17,9 @@ A schema change must not break parsing in either direction. An old app still par
|
||||
- A field you stop sending stays accepted. You stop writing it, you don't stop reading it.
|
||||
- Wire schemas are pure structural declarations. No `.transform()`, `.catch()`, or `.preprocess()` on WebSocket message schemas — normalization happens in an explicit pass after validation. The reason is in [protocol-validation.md](protocol-validation.md): inbound validators are generated, and the generator only compiles pure schemas.
|
||||
- Plain `z.union()` is forbidden when every branch shares a literal tag. Use `z.discriminatedUnion()`.
|
||||
- Wire objects ignore keys they do not know. Never put `.strict()` or `z.strictObject` on a schema that reads another process's data. `packages/protocol/tests/validation/evolvability.test.ts` audits every app↔daemon schema. Strict objects belong to local files that should reject typos, such as the `config.json` copies in `packages/server/src/server/persisted-config.ts`. The browser automation request is the one wire exception: it rejects legacy tab targeting so a request cannot run against the wrong tab.
|
||||
- An unknown variant inside a list costs one element. Readers parse through `safeParseSkippingUnknownVariants` (`packages/protocol/src/validation/unknown-variants.ts`): an unrecognized tag or enum value inside an array drops that element and keeps the message. Outside an array the read fails with `unknownVariant: true` and the reader drops that one message. Schemas stay closed, so consumer `switch`es stay exhaustive. Pruning reaches a list only through objects, arrays, and discriminated unions; a list under a plain `z.union()` branch or a record value is not pruned.
|
||||
- Skipping is not support. When an old reader must see something for the feature to make sense, gate the new value at serialization ([architecture](architecture.md#compatibility-rules)).
|
||||
- `.default()` belongs on primitive leaves only, never on item schemas inside large arrays or big inbound containers.
|
||||
|
||||
Two questions to ask before you commit a schema change:
|
||||
|
||||
@@ -6,7 +6,7 @@ The reason is mobile performance. A captured 353 KB provider snapshot cost about
|
||||
|
||||
## Runtime Path
|
||||
|
||||
`packages/protocol/src/validation/ws-outbound.ts` is the shipped boundary. It validates the envelope with a generated validator that checks only each session message's `type` tag, then runs the generated validator for that one message type and returns the validated data. Issue paths from the message validator, including nested union branches, are prefixed with `message`, so callers see the same issues as when one validator covered the whole envelope. It does not normalize, repair, or re-validate the generated result.
|
||||
`packages/protocol/src/validation/ws-outbound.ts` is the shipped boundary. It validates the envelope with a generated validator that checks only each session message's `type` tag, then runs the generated validator for that one message type and returns the validated data. Issue paths from the message validator, including nested union branches, are prefixed with `message`, so callers see the same issues as when one validator covered the whole envelope. It does not normalize or repair the generated result. When the only failures are unknown variants inside lists, the boundary removes those elements and validates once more ([protocol-compatibility](protocol-compatibility.md#the-protocol-contract-always-compatible)). The reader classifies failures from the issue list, so it behaves the same over the generated validator and Zod, and a valid message pays nothing extra.
|
||||
|
||||
Keep one generated function per message type. zod-aot inlines every nested schema into the function it compiles, so compiling `WSOutboundMessageSchema` as a whole produced one 11 MB function. On V8 (daemon clients, plugin hosts, the CLI, and Electron), the Maglev tier compiled that function once it was hot, allocating about 800 MB and stalling for seconds, and compiled it again after each deoptimization. Hermes has no JIT, so mobile never showed it. `packages/protocol/tests/validation/ws-outbound.test.ts` fails if a generated function grows past 1 MB.
|
||||
|
||||
|
||||
@@ -724,3 +724,13 @@ Tests use `isProviderAvailable(provider)` to skip when the binary or credentials
|
||||
- Gate the operations **the daemon issues** (prompt, slash command, summarize) on both the terminal and cancel settlement. Permission and question responses are not runner operations and must stay outside the gate, or an auto-approve deadlocks the stop. Runs the _provider_ starts on its own — plugin or autonomous wakes — are observed, not gated: the daemon does not choose when they begin, and holding their events back does not protect them from a cancel already in flight, it only hides a run that may already be dead.
|
||||
- Fail closed: if the cancel never succeeded you never proved the run stopped, so refuse new runs until the next Stop issues a fresh cancel. `AgentManager` already turns a rejected `interrupt()` into a refused cancel.
|
||||
- Suppress the canceled run's residue only until its authoritative terminal. Anything the provider publishes after that terminal is a new run by construction and must take the normal live path — buffering it and replaying it later is how autonomous/plugin wakes get lost.
|
||||
|
||||
**OMP background work comes from an injected extension.** OMP's RPC has no job inventory or cancel command, and adding them upstream is not an option. `OmpCliRuntime` launches every OMP process with `--extension` pointing at a module it generates (`packages/server/src/server/agent/providers/omp/background-work-extension.ts`) and deletes the file when that runtime closes. The extension polls `ctx.getAsyncJobSnapshot()` and sends changes through `ctx.ui.setStatus("paseo:background-work", …)`, which the adapter consumes and never shows. Stop sends `/jobs kill <id>` as an RPC prompt; OMP runs that builtin before the model sees the prompt, mid-turn or idle. What you get depends on the OMP release:
|
||||
|
||||
| OMP | Background jobs |
|
||||
| ----------------- | ------------------------------------- |
|
||||
| older than 17.2.0 | not listed (no `getAsyncJobSnapshot`) |
|
||||
| 17.2.0 to 18.8.7 | listed, no Stop |
|
||||
| 18.8.8 and newer | listed, with Stop |
|
||||
|
||||
The adapter reads the command list at launch and publishes `canStop: false` when `/jobs` has no `kill` subcommand. A run waiting on jobs ends with a non-terminal `agent_end` marked `awaitingAsyncWork`. From 18.8.8 until 18.21.0, OMP sends nothing after `/jobs kill` cancels the last of that work, so after a Stop the adapter reads `get_state` and completes the turn itself when nothing is left. Listing and Stop depend on OMP's extension API and the `/jobs` builtin, not on a wire contract, so recheck them when the minimum OMP version moves. `task` jobs are left out because OMP subagents already show as subagents. Pi's `createPiPaseoExtensionFile` injects its extension the same way.
|
||||
|
||||
+68
-11
@@ -5,15 +5,9 @@ Agent chat delivery has two paths:
|
||||
1. **Live stream** — `agent_stream` WebSocket messages for immediacy. These may be delta-shaped lifecycle updates.
|
||||
2. **Authoritative history** — `fetch_agent_timeline_request` for correctness. This always returns full projected timeline items, never lifecycle deltas.
|
||||
|
||||
The daemon retains projected items in memory. Each source event advances the stream sequence,
|
||||
then replaces the previous tool state or merges into the current text item. Intermediate payloads
|
||||
are never retained for history or catch-up. Provider history is the durable transcript authority
|
||||
and rebuilds the projection when an agent resumes.
|
||||
|
||||
Pagination bounds each read, not total resident history. Active and idle agents retain their
|
||||
projected transcript; archive releases it and later history reads rebuild it from the provider.
|
||||
Streaming overhead must remain proportional to the retained transcript. Cumulative text snapshots
|
||||
must be released after their deltas have been consumed.
|
||||
Pagination bounds each read, not total resident history. Streaming overhead must remain
|
||||
proportional to the retained transcript. Cumulative text snapshots must be released after their
|
||||
deltas have been consumed.
|
||||
|
||||
The invariants are:
|
||||
|
||||
@@ -32,6 +26,50 @@ bounded item is used for runtime timeline rows and live stream events. Provider
|
||||
applies the same rule so reopening an agent cannot restore an oversized payload. Fetches apply it
|
||||
again to assistant and reasoning rows the projection merges from many chunks.
|
||||
|
||||
## Owned history
|
||||
|
||||
The daemon owns each agent's history in `AgentTimeline`
|
||||
(`packages/server/src/server/agent/timeline/`): one ordered history per agent, with each provider
|
||||
child's descriptor and history in a child scope of the same agent. Each source event advances the
|
||||
stream sequence, then replaces the previous tool state or merges into the current text item.
|
||||
Intermediate payloads are never retained for history or catch-up.
|
||||
|
||||
History is append-only: rewind, import, reload and archive never delete or rewrite a row. Only
|
||||
deleting the agent, or a provider removing one of its own children, deletes history.
|
||||
|
||||
- **Rewind** retires a range of rows. They leave the conversation and stay stored, in the same
|
||||
epoch. See [Rewind retires rows](#rewind-retires-rows).
|
||||
- **Provider history** is imported only into an agent that has no history. After that, resume
|
||||
does not read it. Reload agent and Unarchive require the provider history to start with the
|
||||
same prompt IDs and text in order. They then append whole new turns, starting at the next
|
||||
prompt. Existing replies, including partial replies, stay as recorded. If the prompts differ,
|
||||
for example because the provider stored expanded attachment text, the chat stays unchanged and
|
||||
Paseo reports a mismatch. A provider child Paseo already holds, listed or retired, is never imported again.
|
||||
- **Archive and reload** keep the history and the provider children. An archived chat reads them
|
||||
without its provider. Opening a stored agent that has no provider session to resume starts its
|
||||
first session on the same history.
|
||||
- **Delete** removes the agent's history and every child's, retired ones included, before the
|
||||
agent record. If the history cannot be removed, the request fails and the agent stays listed. The
|
||||
user can keep using it and delete it again.
|
||||
|
||||
`epoch` is the stored history's identity, minted once when the history is created.
|
||||
|
||||
`AgentTimeline` serializes every operation of one agent, child scopes included, and keeps its
|
||||
state in an `AgentTimelineBackend`: the sequence, the rows and retirements, prompt identities, the
|
||||
open rewind, and the children. The backend contract suite is `agent-timeline.test.ts`, run over
|
||||
`TIMELINE_CONTRACT_BACKENDS` in `timeline/testing.ts`. The daemon uses the SQLite backend in the
|
||||
[daemon database](data-model.md#daemon-database). History, retirements, the open rewind, and
|
||||
provider children survive a daemon restart in the same epoch, so clients keep their cursors. A
|
||||
closed or archived agent holds no history in memory. Each fetch reads the page from the database
|
||||
and starts no provider. An internal agent, such as the one that writes a commit message, keeps its
|
||||
history in a memory backend instead, so it leaves nothing on disk. The memory backend also serves
|
||||
tests.
|
||||
|
||||
An open rewind is stored with the history. Resuming an agent whose history holds one settles it
|
||||
before the agent takes prompts: a recorded provider cut is committed, and an unknown outcome is
|
||||
judged from the resumed provider history. When that history proves nothing, the rewind stays open
|
||||
and the agent refuses prompts with the unknown-outcome error.
|
||||
|
||||
## Presence is not delivery
|
||||
|
||||
Client heartbeat reports presence:
|
||||
@@ -173,7 +211,7 @@ or retry backoff. This cannot keep a mobile socket alive after the operating sys
|
||||
bookkeeping without replacing timeline arrays, preserving an upward-scrolled viewport.
|
||||
- When the page overlaps or is adjacent to the local end cursor, only projected items newer than
|
||||
that cursor are applied. Already-covered rows are not replayed.
|
||||
- A true middle gap, epoch change, or rewind atomically replaces stale canonical history with the
|
||||
- A true middle gap or epoch change atomically replaces stale canonical history with the
|
||||
latest tail. The replacement reconciles positioned live rows beyond its coverage and unresolved
|
||||
local submissions; it never retains two discontiguous canonical ranges.
|
||||
|
||||
@@ -186,6 +224,24 @@ history replay. The pending approval UI can hide that tool from presentation, bu
|
||||
must retain its position. Creating a new history card on rejection places it after the prompt that
|
||||
rejected it; changing steer-event ordering would also put new assistant output before that prompt.
|
||||
|
||||
## Rewind retires rows
|
||||
|
||||
A conversation rewind commits a retirement `{ seq, retireFromSeq }`: active rows anchored in
|
||||
`[retireFromSeq, seq)` leave the conversation, and `seq` is the retirement's own position in the
|
||||
sequence. The provider children spawned by retired tool calls, and their descendants, are retired
|
||||
in the same commit. They leave the listing, keep their history, and drop late provider events.
|
||||
|
||||
Clients learn of a retirement live through `agent.timeline.rewind`, and on pages through
|
||||
`retirements`, which lists the retirements whose `seq` lies inside the page's span. The client
|
||||
drops the rows it holds in that range; rows without a timeline position are unechoed local sends
|
||||
and stay. Retired ranges and the retirement's `seq` count as covered, so forward cursors advance
|
||||
through them. Tail, before and prompt-jump pages are served from active rows, so one served before
|
||||
a retirement the client already applied is stale and is refetched (`viewed-timeline-sync.ts`).
|
||||
|
||||
Clients without `timeline_rewind_operations` cannot drop retired rows. For them the session derives
|
||||
a wire epoch that changes with each retirement, so they take the destructive replacement they
|
||||
always took on rewind. The shim is tagged `COMPAT(timelineRewindOperations)`.
|
||||
|
||||
## Provider child history
|
||||
|
||||
Child transcripts use the same projected-page reconciliation as the main conversation. The client
|
||||
@@ -379,7 +435,7 @@ the draft-create handoff is the one boundary that also permits the legacy canoni
|
||||
arrived first. Generic reducers and consumers do not reimplement message identity matching.
|
||||
|
||||
Ordinary bootstrap, same-epoch reset, and catch-up replacement preserve unmatched locally submitted
|
||||
rows because a provider may never echo them. A known epoch change or rewind replaces history and
|
||||
rows because a provider may never echo them. A known epoch change replaces history and
|
||||
drops acknowledged local rows omitted by the new canonical epoch; every transaction not yet
|
||||
acknowledged by the provider, and no other local row, crosses that destructive boundary. A cold
|
||||
reset without an existing epoch is destructive because the client has no continuity anchor.
|
||||
@@ -395,6 +451,7 @@ canonical assistant prefix, it stays in the head lane. No row may be returned in
|
||||
|
||||
## Relevant code
|
||||
|
||||
- Server owned history: `packages/server/src/server/agent/timeline/`
|
||||
- Server live stream forwarding: `packages/server/src/server/session.ts`
|
||||
- App sync planning: `packages/app/src/timeline/timeline-sync-plan.ts`
|
||||
- App viewed-agent synchronization: `packages/app/src/timeline/viewed-timeline-sync.ts`
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
- Redesigned model picker: Pick models from a two-pane desktop view with cross-provider search, an in-place phone drawer with a thinking slider, and per-provider model lists in settings.
|
||||
- File actions and filter: Filter the Files tree by name, and reveal, open in your default app, download, or copy paths from chat file links, file tabs, and sidebar trees.
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,4 @@
|
||||
- Redesigned model picker: Pick models from a two-pane desktop view with cross-provider search, an in-place phone drawer with a thinking slider, and per-provider model lists in settings.
|
||||
- File actions and filter: Filter the Files tree by name, and reveal, open in your default app, download, or copy paths from chat file links, file tabs, and sidebar trees.
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,4 @@
|
||||
- Redesigned model picker: Pick models from a two-pane desktop view with cross-provider search, an in-place phone drawer with a thinking slider, and per-provider model lists in settings.
|
||||
- File actions and filter: Filter the Files tree by name, and reveal, open in your default app, download, or copy paths from chat file links, file tabs, and sidebar trees.
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,4 @@
|
||||
- Redesigned model picker: Pick models from a two-pane desktop view with cross-provider search, an in-place phone drawer with a thinking slider, and per-provider model lists in settings.
|
||||
- File actions and filter: Filter the Files tree by name, and reveal, open in your default app, download, or copy paths from chat file links, file tabs, and sidebar trees.
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -73,6 +73,17 @@
|
||||
"entry": ["src/index.ts", "src/**/*.test.ts"],
|
||||
"project": ["src/**/*.ts"]
|
||||
},
|
||||
"packages/workflows": {
|
||||
"entry": [
|
||||
"src/index.ts",
|
||||
"src/ir.ts",
|
||||
"src/dsl.ts",
|
||||
"src/yaml.ts",
|
||||
"src/testing.ts",
|
||||
"test/**/*.test.ts"
|
||||
],
|
||||
"project": ["src/**/*.ts", "test/**/*.ts"]
|
||||
},
|
||||
"packages/expo-two-way-audio": {
|
||||
"entry": ["src/index.ts"],
|
||||
"project": ["src/**/*.ts"]
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
sha256-aal9eR571blWuL7CZt1LR+KfA4QPJ0ivVl/GSTWy93o=
|
||||
sha256-ZVIrRfb7oyTwx7kz6F51hs/ctT45qUdZM4v0QRLW9zA=
|
||||
|
||||
Generated
+69
-33
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "paseo",
|
||||
"version": "0.18.1",
|
||||
"version": "0.18.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "paseo",
|
||||
"version": "0.18.1",
|
||||
"version": "0.18.2",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"workspaces": [
|
||||
@@ -16,6 +16,7 @@
|
||||
"packages/highlight",
|
||||
"packages/plugin",
|
||||
"packages/protocol",
|
||||
"packages/workflows",
|
||||
"packages/client",
|
||||
"packages/server",
|
||||
"packages/app",
|
||||
@@ -45,6 +46,9 @@
|
||||
"react-dom": "19.2.3",
|
||||
"typescript": "^5.9.3",
|
||||
"ws": "^8.20.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.16.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@0no-co/graphql.web": {
|
||||
@@ -6709,6 +6713,10 @@
|
||||
"resolved": "packages/website",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@getpaseo/workflows": {
|
||||
"resolved": "packages/workflows",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@gorhom/bottom-sheet": {
|
||||
"version": "5.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@gorhom/bottom-sheet/-/bottom-sheet-5.2.14.tgz",
|
||||
@@ -14924,7 +14932,6 @@
|
||||
"version": "8.11.0",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz",
|
||||
"integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
@@ -31398,7 +31405,6 @@
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
@@ -36228,7 +36234,6 @@
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"punycode": "^2.1.0"
|
||||
@@ -37541,7 +37546,7 @@
|
||||
},
|
||||
"packages/app": {
|
||||
"name": "@getpaseo/app",
|
||||
"version": "0.18.1",
|
||||
"version": "0.18.2",
|
||||
"dependencies": {
|
||||
"@codemirror/commands": "6.10.4",
|
||||
"@codemirror/language": "6.12.4",
|
||||
@@ -39694,13 +39699,13 @@
|
||||
},
|
||||
"packages/cli": {
|
||||
"name": "@getpaseo/cli",
|
||||
"version": "0.18.1",
|
||||
"version": "0.18.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^1.0.0",
|
||||
"@getpaseo/client": "0.18.1",
|
||||
"@getpaseo/protocol": "0.18.1",
|
||||
"@getpaseo/server": "0.18.1",
|
||||
"@getpaseo/client": "0.18.2",
|
||||
"@getpaseo/protocol": "0.18.2",
|
||||
"@getpaseo/server": "0.18.2",
|
||||
"chalk": "^5.3.0",
|
||||
"commander": "^12.0.0",
|
||||
"mime-types": "^2.1.35",
|
||||
@@ -39719,6 +39724,9 @@
|
||||
"typescript": "^5.2.2",
|
||||
"vitest": "^4.1.6",
|
||||
"zx": "^8.8.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.16.0"
|
||||
}
|
||||
},
|
||||
"packages/cli/node_modules/@vitest/expect": {
|
||||
@@ -39947,11 +39955,11 @@
|
||||
},
|
||||
"packages/client": {
|
||||
"name": "@getpaseo/client",
|
||||
"version": "0.18.1",
|
||||
"version": "0.18.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@getpaseo/protocol": "0.18.1",
|
||||
"@getpaseo/relay": "0.18.1",
|
||||
"@getpaseo/protocol": "0.18.2",
|
||||
"@getpaseo/relay": "0.18.2",
|
||||
"ws": "^8.20.0",
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
@@ -39963,7 +39971,7 @@
|
||||
},
|
||||
"packages/desktop": {
|
||||
"name": "@getpaseo/desktop",
|
||||
"version": "0.18.1",
|
||||
"version": "0.18.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@getpaseo/cli": "*",
|
||||
@@ -40206,7 +40214,7 @@
|
||||
},
|
||||
"packages/expo-two-way-audio": {
|
||||
"name": "@getpaseo/expo-two-way-audio",
|
||||
"version": "0.18.1",
|
||||
"version": "0.18.2",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.14",
|
||||
@@ -40252,7 +40260,7 @@
|
||||
},
|
||||
"packages/highlight": {
|
||||
"name": "@getpaseo/highlight",
|
||||
"version": "0.18.1",
|
||||
"version": "0.18.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@codemirror/language": "6.12.4",
|
||||
@@ -40282,7 +40290,7 @@
|
||||
},
|
||||
"packages/plugin": {
|
||||
"name": "@getpaseo/plugin",
|
||||
"version": "0.18.1",
|
||||
"version": "0.18.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "^1.4.0",
|
||||
@@ -40290,8 +40298,8 @@
|
||||
"use-sync-external-store": "^1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@getpaseo/client": "0.18.1",
|
||||
"@getpaseo/protocol": "0.18.1",
|
||||
"@getpaseo/client": "0.18.2",
|
||||
"@getpaseo/protocol": "0.18.2",
|
||||
"@types/node": "^20.9.0",
|
||||
"@types/react": "~19.2.0",
|
||||
"react": "19.2.3",
|
||||
@@ -40301,8 +40309,8 @@
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@getpaseo/client": "0.18.1",
|
||||
"@getpaseo/protocol": "0.18.1",
|
||||
"@getpaseo/client": "0.18.2",
|
||||
"@getpaseo/protocol": "0.18.2",
|
||||
"react": ">=19.1.0 <20",
|
||||
"react-native": ">=0.81.5",
|
||||
"zod": "^4.4.3"
|
||||
@@ -40324,7 +40332,7 @@
|
||||
},
|
||||
"packages/protocol": {
|
||||
"name": "@getpaseo/protocol",
|
||||
"version": "0.18.1",
|
||||
"version": "0.18.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"semver": "^7.8.5",
|
||||
@@ -40351,7 +40359,7 @@
|
||||
}
|
||||
},
|
||||
"packages/react-native-enriched-markdown": {
|
||||
"version": "0.18.1",
|
||||
"version": "0.18.2",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
@@ -40367,7 +40375,7 @@
|
||||
},
|
||||
"packages/relay": {
|
||||
"name": "@getpaseo/relay",
|
||||
"version": "0.18.1",
|
||||
"version": "0.18.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@noble/ciphers": "^2.4.0",
|
||||
@@ -40589,17 +40597,17 @@
|
||||
},
|
||||
"packages/server": {
|
||||
"name": "@getpaseo/server",
|
||||
"version": "0.18.1",
|
||||
"version": "0.18.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "^0.17.1",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.3.326",
|
||||
"@anthropic-ai/sdk": "^0.104.2",
|
||||
"@getpaseo/client": "0.18.1",
|
||||
"@getpaseo/highlight": "0.18.1",
|
||||
"@getpaseo/plugin": "0.18.1",
|
||||
"@getpaseo/protocol": "0.18.1",
|
||||
"@getpaseo/relay": "0.18.1",
|
||||
"@getpaseo/client": "0.18.2",
|
||||
"@getpaseo/highlight": "0.18.2",
|
||||
"@getpaseo/plugin": "0.18.2",
|
||||
"@getpaseo/protocol": "0.18.2",
|
||||
"@getpaseo/relay": "0.18.2",
|
||||
"@isaacs/ttlcache": "^2.1.4",
|
||||
"@modelcontextprotocol/node": "2.1.2",
|
||||
"@modelcontextprotocol/sdk": "1.29.0",
|
||||
@@ -40647,7 +40655,7 @@
|
||||
"@playwright/test": "^1.56.1",
|
||||
"@types/express": "^4.17.20",
|
||||
"@types/markdown-it": "^14.2.0",
|
||||
"@types/node": "^20.9.0",
|
||||
"@types/node": "^22.16.0",
|
||||
"@types/qrcode": "^1.5.6",
|
||||
"@types/uuid": "^9.0.7",
|
||||
"@types/ws": "^8.5.8",
|
||||
@@ -40655,6 +40663,9 @@
|
||||
"cross-env": "^10.1.0",
|
||||
"tsx": "^4.6.0",
|
||||
"vitest": "^4.1.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.16.0"
|
||||
}
|
||||
},
|
||||
"packages/server/node_modules/@esbuild/aix-ppc64": {
|
||||
@@ -41102,6 +41113,16 @@
|
||||
"@types/mdurl": "^2"
|
||||
}
|
||||
},
|
||||
"packages/server/node_modules/@types/node": {
|
||||
"version": "22.20.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.5.tgz",
|
||||
"integrity": "sha512-U2+DNr+wSjpsTS/wZGYHq7GcwfuSmKiKvoPvK22zwTlRhU91yOniN4qRR5KhIjvif7ysw/dz/hKmfDH0Ris4aA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~6.21.0"
|
||||
}
|
||||
},
|
||||
"packages/server/node_modules/@vitest/expect": {
|
||||
"version": "4.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.6.tgz",
|
||||
@@ -41550,7 +41571,7 @@
|
||||
},
|
||||
"packages/website": {
|
||||
"name": "@getpaseo/website",
|
||||
"version": "0.18.1",
|
||||
"version": "0.18.2",
|
||||
"dependencies": {
|
||||
"@cloudflare/vite-plugin": "^1.29.1",
|
||||
"@cloudflare/workers-types": "^4.20260317.1",
|
||||
@@ -43159,9 +43180,24 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"packages/workflows": {
|
||||
"name": "@getpaseo/workflows",
|
||||
"version": "0.1.0",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"ajv": "^8.11.0",
|
||||
"js-yaml": "^4.1.1",
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.9.0",
|
||||
"typescript": "^5.9.3",
|
||||
"vitest": "^4.1.6"
|
||||
}
|
||||
},
|
||||
"plugins": {
|
||||
"name": "@getpaseo/builtin-plugins",
|
||||
"version": "0.18.1",
|
||||
"version": "0.18.2",
|
||||
"dependencies": {
|
||||
"@getpaseo/plugin": "*",
|
||||
"zod": "^4.4.3"
|
||||
|
||||
+8
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "paseo",
|
||||
"version": "0.18.1",
|
||||
"version": "0.18.2",
|
||||
"private": true,
|
||||
"description": "Paseo: voice-controlled development environment for local AI coding agents",
|
||||
"keywords": [
|
||||
@@ -27,6 +27,7 @@
|
||||
"packages/highlight",
|
||||
"packages/plugin",
|
||||
"packages/protocol",
|
||||
"packages/workflows",
|
||||
"packages/client",
|
||||
"packages/server",
|
||||
"packages/app",
|
||||
@@ -60,6 +61,8 @@
|
||||
"build:relay:clean": "npm run build:clean --workspace=@getpaseo/relay",
|
||||
"build:protocol": "npm run build --workspace=@getpaseo/protocol",
|
||||
"build:protocol:clean": "npm run build:clean --workspace=@getpaseo/protocol",
|
||||
"build:workflows": "npm run build --workspace=@getpaseo/workflows",
|
||||
"build:workflows:clean": "npm run build:clean --workspace=@getpaseo/workflows",
|
||||
"build:client": "npm run build --workspace=@getpaseo/client",
|
||||
"build:client:clean": "npm run build:protocol:clean && npm run build:clean --workspace=@getpaseo/client",
|
||||
"build:server-deps": "npm run build:client && concurrently --kill-others-on-fail --names highlight,plugin,relay --prefix-colors yellow,green,blue \"npm run build:highlight\" \"npm run build:plugin\" \"npm run build:relay\"",
|
||||
@@ -96,7 +99,7 @@
|
||||
"web": "npm run web --workspace=@getpaseo/app",
|
||||
"dev:desktop": "cross-env PASEO_LISTEN=127.0.0.1:6768 npm run dev --workspace=@getpaseo/desktop",
|
||||
"dev:win:desktop": "npm run dev:win --workspace=@getpaseo/desktop",
|
||||
"build:desktop": "npm run build:app-deps:clean && cd packages/app && cross-env PASEO_WEB_PLATFORM=electron npx expo export --platform web && cd ../.. && npm run build --workspace=@getpaseo/desktop --",
|
||||
"build:desktop": "npm run build:app-deps:clean && cd packages/app && cross-env PASEO_WEB_PLATFORM=electron npx expo export --platform web && cd ../.. && node scripts/precompress-assets.mjs packages/app/dist && npm run build --workspace=@getpaseo/desktop --",
|
||||
"db:query": "npm run db:query --workspace=@getpaseo/server --",
|
||||
"cli": "./scripts/dev-home.sh npx tsx packages/cli/src/index.js",
|
||||
"version": "npm run version:sync-internal && npm run fdroid:changelogs && npm run release:prepare && git add -A",
|
||||
@@ -169,5 +172,8 @@
|
||||
"tiny-async-pool": {
|
||||
"semver@^5": "5.7.2"
|
||||
}
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.16.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ const withAndroidAsyncStorageSize = require("./plugins/with-android-async-storag
|
||||
const withAndroidIgnoreBoldText = require("./plugins/with-android-ignore-bold-text");
|
||||
const withAndroidOptionalCamera = require("./plugins/with-android-optional-camera");
|
||||
const withAndroidProfileable = require("./plugins/with-android-profileable");
|
||||
const withAndroidSplashWindowBackground = require("./plugins/with-android-splash-window-background");
|
||||
const withFdroidAutolinking = require("./plugins/with-fdroid-autolinking");
|
||||
const withPasteInput = require("./plugins/with-paste-input");
|
||||
const withAndroidScroll = require("./modules/paseo-scroll/app.plugin");
|
||||
@@ -165,6 +166,7 @@ export default {
|
||||
},
|
||||
},
|
||||
],
|
||||
withAndroidSplashWindowBackground,
|
||||
...buildProfile.notificationPlugins,
|
||||
"expo-audio",
|
||||
[
|
||||
|
||||
@@ -26,6 +26,29 @@ async function resolveAndroidManifest() {
|
||||
return exp._internal.modResults.android.manifest.manifest;
|
||||
}
|
||||
|
||||
interface StyleItem {
|
||||
$: { name: string };
|
||||
_: string;
|
||||
}
|
||||
|
||||
interface StyleGroup {
|
||||
$: { name: string };
|
||||
item?: StyleItem[];
|
||||
}
|
||||
|
||||
async function resolveAndroidAppThemeItems(): Promise<Record<string, string>> {
|
||||
const { exp } = await getPrebuildConfigAsync(__dirname, { platforms: ["android"] });
|
||||
await compileModsAsync(exp, {
|
||||
projectRoot: __dirname,
|
||||
introspect: true,
|
||||
platforms: ["android"],
|
||||
assertMissingModProviders: false,
|
||||
});
|
||||
const styles: StyleGroup[] = exp._internal.modResults.android.styles.resources.style;
|
||||
const appTheme = styles.find((style) => style.$.name === "AppTheme");
|
||||
return Object.fromEntries((appTheme?.item ?? []).map((item) => [item.$.name, item._]));
|
||||
}
|
||||
|
||||
describe("Android app config", () => {
|
||||
afterEach(() => {
|
||||
if (originalFdroidFlag === undefined) {
|
||||
@@ -58,6 +81,12 @@ describe("Android app config", () => {
|
||||
},
|
||||
30_000,
|
||||
);
|
||||
|
||||
// Without it, a dark device paints AppCompat's #303030 between the splash and the first screen.
|
||||
it("paints the app window in the splash colour", async () => {
|
||||
const appTheme = await resolveAndroidAppThemeItems();
|
||||
expect(appTheme["android:windowBackground"]).toBe("@color/splashscreen_background");
|
||||
}, 30_000);
|
||||
});
|
||||
|
||||
it("follows system rotation on Android", async () => {
|
||||
|
||||
@@ -13,6 +13,13 @@ import {
|
||||
import { expectNearBottom, scrollChatAwayFromBottom } from "../support/helpers/agent-bottom-anchor";
|
||||
import { holdRewindCompletion } from "../support/helpers/agent-timeline-gate";
|
||||
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
|
||||
import { userScrollsTimelineToHistoryStart } from "../support/helpers/timeline-pagination";
|
||||
import {
|
||||
closeWorkspaceAgentTab,
|
||||
fetchAgentArchivedAt,
|
||||
primeAdditionalPage,
|
||||
resetSeededPageState,
|
||||
} from "../support/helpers/archive-tab";
|
||||
|
||||
async function completeSubmittedTurn(
|
||||
page: Page,
|
||||
@@ -48,26 +55,98 @@ async function expectTurnCompletesNormally(
|
||||
await expectAgentIdle(page);
|
||||
}
|
||||
|
||||
async function openAgentOnAnotherClient(
|
||||
page: Page,
|
||||
agent: Awaited<ReturnType<typeof seedMockAgentWorkspace>>,
|
||||
): Promise<void> {
|
||||
await primeAdditionalPage(page);
|
||||
await resetSeededPageState(page);
|
||||
await openAgentRoute(page, agent);
|
||||
await expectComposerVisible(page);
|
||||
}
|
||||
|
||||
/** The prompts the chat shows, in order, each exactly once. */
|
||||
async function expectPrompts(page: Page, prompts: string[]): Promise<void> {
|
||||
const messages = page.getByTestId("user-message");
|
||||
await expect(messages).toHaveCount(prompts.length);
|
||||
await expect(messages).toContainText(prompts);
|
||||
}
|
||||
|
||||
async function reloadAgentFromTabMenu(page: Page, agentId: string): Promise<void> {
|
||||
const tabId = `workspace-tab-agent_${agentId}`;
|
||||
await page.getByTestId(tabId).filter({ visible: true }).first().click({ button: "right" });
|
||||
await page.getByTestId(`workspace-tab-context-agent_${agentId}-reload-agent`).click();
|
||||
}
|
||||
|
||||
async function archiveAgentByClosingTab(
|
||||
page: Page,
|
||||
agent: Awaited<ReturnType<typeof seedMockAgentWorkspace>>,
|
||||
): Promise<void> {
|
||||
await closeWorkspaceAgentTab(page, agent.agentId);
|
||||
await expect.poll(() => fetchAgentArchivedAt(agent.client, agent.agentId)).not.toBeNull();
|
||||
}
|
||||
|
||||
async function unarchiveAgent(page: Page): Promise<void> {
|
||||
await page.getByRole("button", { name: "Unarchive", exact: true }).click();
|
||||
await expect(page.getByText("This agent is archived", { exact: true })).toHaveCount(0, {
|
||||
timeout: 30_000,
|
||||
});
|
||||
}
|
||||
|
||||
async function expectToast(page: Page, message: string): Promise<void> {
|
||||
await expect(page.getByTestId("app-toast-message")).toHaveText(message, { timeout: 30_000 });
|
||||
}
|
||||
|
||||
/** The prompts of the whole conversation, after scrolling up through its older pages. */
|
||||
async function expectConversationPrompts(page: Page, prompts: string[]): Promise<void> {
|
||||
const messages = page.getByTestId("user-message");
|
||||
await expect
|
||||
.poll(async () => {
|
||||
await userScrollsTimelineToHistoryStart(page);
|
||||
return await messages.count();
|
||||
})
|
||||
.toBe(prompts.length);
|
||||
await expect(messages).toContainText(prompts);
|
||||
}
|
||||
|
||||
// A row React remounts loses this attribute; one that stays mounted keeps it.
|
||||
async function markMounted(row: Locator): Promise<void> {
|
||||
await row.evaluate((element) => element.setAttribute("data-e2e-mounted", "before-rewind"));
|
||||
}
|
||||
|
||||
async function expectStillMounted(row: Locator): Promise<void> {
|
||||
await expect(row).toHaveAttribute("data-e2e-mounted", "before-rewind");
|
||||
}
|
||||
|
||||
test.describe("Agent message rewind", () => {
|
||||
test("rewinds a submitted prompt without replaying history and preserves a human draft", async ({
|
||||
test("rewinds a prompt in place on every open client and keeps a human draft", async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(90_000);
|
||||
test.setTimeout(150_000);
|
||||
const retainedPrompt = "Keep this completed turn after rewind.";
|
||||
const rewoundPrompt = "Remove this completed turn after rewind.";
|
||||
const nextPrompt = "Continue after the rewind.";
|
||||
const preservedDraft = "Keep this human draft after rewind.";
|
||||
const agent = await seedMockAgentWorkspace({
|
||||
repoPrefix: "message-rewind-roundtrip-",
|
||||
title: "Message rewind roundtrip",
|
||||
model: "ten-second-stream",
|
||||
});
|
||||
const otherClient = await page.context().newPage();
|
||||
|
||||
try {
|
||||
const rewindCompletion = await holdRewindCompletion(page, agent.agentId);
|
||||
await openAgentRoute(page, agent);
|
||||
await expectComposerVisible(page);
|
||||
await completeSubmittedTurn(page, agent, retainedPrompt);
|
||||
const retainedMessage = await completeSubmittedTurn(page, agent, retainedPrompt);
|
||||
const userMessage = await completeSubmittedTurn(page, agent, rewoundPrompt);
|
||||
|
||||
await test.step("a second client opens the same chat", async () => {
|
||||
await openAgentOnAnotherClient(otherClient, agent);
|
||||
await expectPrompts(otherClient, [retainedPrompt, rewoundPrompt]);
|
||||
});
|
||||
|
||||
await markMounted(retainedMessage);
|
||||
await scrollChatAwayFromBottom(page, {
|
||||
deltaY: -900,
|
||||
minDistanceFromBottom: 300,
|
||||
@@ -76,19 +155,91 @@ test.describe("Agent message rewind", () => {
|
||||
await blurComposerInput(page);
|
||||
rewindCompletion.clearTimelineStreamCount();
|
||||
|
||||
const rewind = rewindConversation(page, userMessage, rewoundPrompt);
|
||||
await rewindCompletion.waitForDelayedResponse();
|
||||
await expect(page.getByTestId("rewind-menu-conversation")).toBeDisabled();
|
||||
expect(rewindCompletion.timelineStreamCount()).toBe(0);
|
||||
rewindCompletion.release();
|
||||
await rewind;
|
||||
await test.step("the rewind stays pending until the daemon answers", async () => {
|
||||
const rewind = rewindConversation(page, userMessage, rewoundPrompt);
|
||||
await rewindCompletion.waitForDelayedResponse();
|
||||
await expect(page.getByTestId("rewind-menu-conversation")).toBeDisabled();
|
||||
expect(rewindCompletion.timelineStreamCount()).toBe(0);
|
||||
rewindCompletion.release();
|
||||
await rewind;
|
||||
});
|
||||
|
||||
await expect(page.getByTestId("user-message").filter({ hasText: rewoundPrompt })).toHaveCount(
|
||||
0,
|
||||
);
|
||||
await expectComposerDraft(page, preservedDraft);
|
||||
await expectComposerNotFocused(page);
|
||||
await expectNearBottom(page);
|
||||
await test.step("the rewound turn leaves without reloading the chat", async () => {
|
||||
await expectPrompts(page, [retainedPrompt]);
|
||||
await expectStillMounted(retainedMessage);
|
||||
expect(rewindCompletion.timelineFetchCount()).toBe(0);
|
||||
await expectComposerDraft(page, preservedDraft);
|
||||
await expectComposerNotFocused(page);
|
||||
await expectNearBottom(page);
|
||||
await expectPrompts(otherClient, [retainedPrompt]);
|
||||
});
|
||||
|
||||
await test.step("the next prompt appears once on both clients", async () => {
|
||||
await completeSubmittedTurn(otherClient, agent, nextPrompt);
|
||||
await expectPrompts(otherClient, [retainedPrompt, nextPrompt]);
|
||||
await expectPrompts(page, [retainedPrompt, nextPrompt]);
|
||||
});
|
||||
|
||||
await test.step("a reconnecting client loads the rewound conversation", async () => {
|
||||
await otherClient.reload();
|
||||
await expectPrompts(otherClient, [retainedPrompt, nextPrompt]);
|
||||
});
|
||||
} finally {
|
||||
await otherClient.close();
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("keeps the rewound conversation through Reload agent, archive and unarchive", async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(150_000);
|
||||
const keptPrompt = "Keep this turn through reload and archive.";
|
||||
const rewoundPrompt = "Rewind this turn before reloading.";
|
||||
const nextPrompt = "Continue after the rewind, then reload.";
|
||||
const agent = await seedMockAgentWorkspace({
|
||||
repoPrefix: "message-rewind-reload-archive-",
|
||||
title: "Message rewind reload archive",
|
||||
model: "ten-second-stream",
|
||||
});
|
||||
|
||||
try {
|
||||
await openAgentRoute(page, agent);
|
||||
await expectComposerVisible(page);
|
||||
await completeSubmittedTurn(page, agent, keptPrompt);
|
||||
const rewound = await completeSubmittedTurn(page, agent, rewoundPrompt);
|
||||
await rewindConversation(page, rewound, rewoundPrompt);
|
||||
await expectPrompts(page, [keptPrompt]);
|
||||
await completeSubmittedTurn(page, agent, nextPrompt);
|
||||
await expectPrompts(page, [keptPrompt, nextPrompt]);
|
||||
|
||||
await test.step("Reload agent keeps the rewound conversation", async () => {
|
||||
await reloadAgentFromTabMenu(page, agent.agentId);
|
||||
await expectToast(page, "Reloaded agent");
|
||||
await expectPrompts(page, [keptPrompt, nextPrompt]);
|
||||
await expectComposerVisible(page);
|
||||
});
|
||||
|
||||
await test.step("the archived chat shows the rewound conversation", async () => {
|
||||
await archiveAgentByClosingTab(page, agent);
|
||||
await openAgentRoute(page, agent);
|
||||
await expect(page.getByText("This agent is archived", { exact: true })).toBeVisible({
|
||||
timeout: 30_000,
|
||||
});
|
||||
await expectConversationPrompts(page, [keptPrompt, nextPrompt]);
|
||||
});
|
||||
|
||||
await test.step("unarchiving keeps the rewound conversation", async () => {
|
||||
await unarchiveAgent(page);
|
||||
await expectComposerVisible(page);
|
||||
await expectConversationPrompts(page, [keptPrompt, nextPrompt]);
|
||||
});
|
||||
|
||||
await test.step("a reconnecting client loads the same conversation", async () => {
|
||||
await page.reload();
|
||||
await expectComposerVisible(page);
|
||||
await expectConversationPrompts(page, [keptPrompt, nextPrompt]);
|
||||
});
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
expectComposerVisible,
|
||||
cancelAgent,
|
||||
composerLocator,
|
||||
configureComposerInterruptSend,
|
||||
expectQueuedMessageButton,
|
||||
fillComposerDraft,
|
||||
holdSendButton,
|
||||
@@ -404,15 +405,6 @@ async function queueMessage(page: Page, prompt: string): Promise<void> {
|
||||
await sendDraftToQueue(page);
|
||||
}
|
||||
|
||||
async function expectQueuedSendFailuresRestored(page: Page, prompts: string[]): Promise<void> {
|
||||
await expect(page.getByRole("button", { name: "Send queued message now" })).toHaveCount(
|
||||
prompts.length,
|
||||
);
|
||||
for (const prompt of prompts) {
|
||||
await expect(page.getByTestId("user-message").filter({ hasText: prompt })).toHaveCount(0);
|
||||
}
|
||||
}
|
||||
|
||||
async function expectFailedSubmissionRestored(page: Page, prompt: string): Promise<void> {
|
||||
await expectComposerDraft(page, prompt);
|
||||
await expectComposerEditable(page);
|
||||
@@ -431,14 +423,14 @@ async function expectInterruptedTurnOrderAfterReconnect(
|
||||
});
|
||||
const prompt = "Keep this prompt before its response.";
|
||||
try {
|
||||
await configureComposerInterruptSend(page);
|
||||
await openAgentRoute(page, { workspaceId: agent.workspaceId, agentId: agent.agentId });
|
||||
await expectComposerVisible(page);
|
||||
await agent.client.sendAgentMessage(agent.agentId, "Start the turn that will be interrupted.");
|
||||
await expect(page.getByRole("button", { name: /stop|cancel/i }).first()).toBeVisible();
|
||||
await expect(page.getByText("Cycle 1", { exact: true })).toBeVisible();
|
||||
await queueMessage(page, prompt);
|
||||
gate.setAgentStreamSuppressed(true);
|
||||
await page.getByRole("button", { name: "Send queued message now" }).click();
|
||||
await submitMessage(page, prompt);
|
||||
const promptRow = page.getByTestId("user-message").filter({ hasText: prompt });
|
||||
await expect(promptRow).toBeVisible();
|
||||
await gate.waitForServerMessage("send_agent_message_response");
|
||||
@@ -659,14 +651,14 @@ async function expectLegacyAssistantStartsAfterInterruptedPrompt(
|
||||
});
|
||||
const prompt = "Start the replacement answer after this prompt.";
|
||||
try {
|
||||
await configureComposerInterruptSend(page);
|
||||
await openAgentRoute(page, { workspaceId: agent.workspaceId, agentId: agent.agentId });
|
||||
await expectComposerVisible(page);
|
||||
await agent.client.sendAgentMessage(agent.agentId, "Start the interrupted answer.");
|
||||
await expect(page.getByText("Cycle 1", { exact: true })).toBeVisible();
|
||||
await queueMessage(page, prompt);
|
||||
gate.setAssistantMessageIdsStripped(true);
|
||||
gate.setAgentStreamEventSuppressed("turn_canceled", true);
|
||||
await page.getByRole("button", { name: "Send queued message now" }).click();
|
||||
await submitMessage(page, prompt);
|
||||
const promptRow = page.getByTestId("user-message").filter({ hasText: prompt });
|
||||
const replacementAnswer = page.getByText("(end of synthetic stream)", { exact: true }).last();
|
||||
await expect(promptRow).toBeVisible();
|
||||
@@ -1098,6 +1090,7 @@ test.describe("Agent message submission", () => {
|
||||
gate.holdNextServerMessage("cancel_agent_response");
|
||||
await page.getByRole("button", { name: "Stop agent", exact: true }).click();
|
||||
await gate.waitForHeldServerMessage();
|
||||
await page.getByRole("button", { name: "Send queued message now" }).click();
|
||||
|
||||
await expect(page.getByTestId("user-message").filter({ hasText: secondPrompt })).toHaveCount(
|
||||
1,
|
||||
@@ -1343,6 +1336,8 @@ test.describe("Agent message submission", () => {
|
||||
await test.step("holding Send queues the draft", async () => {
|
||||
await fillComposerDraft(page, queuedPrompt);
|
||||
await holdSendButton(page, "Send and steer");
|
||||
expect((await gate.waitForRequest()).activeTurnBehavior).toBe("queue");
|
||||
gate.accept();
|
||||
await expectQueuedMessageButton(page);
|
||||
await expectComposerDraft(page, "");
|
||||
await expectAgentReadyToInterrupt(page);
|
||||
@@ -1351,19 +1346,22 @@ test.describe("Agent message submission", () => {
|
||||
).toHaveCount(0);
|
||||
});
|
||||
|
||||
await test.step("tapping Send still steers", async () => {
|
||||
await test.step("tapping Send still steers and takes the queued row along", async () => {
|
||||
const steeredPrompt = "Steer this turn with a tap.";
|
||||
await fillComposerDraft(page, steeredPrompt);
|
||||
await page.getByRole("button", { name: "Send and steer", exact: true }).click();
|
||||
|
||||
const request = await gate.waitForRequest();
|
||||
const request = await gate.waitForRequest(2);
|
||||
expect(request.text).toBe(steeredPrompt);
|
||||
expect(request.activeTurnBehavior).toBe("steer");
|
||||
gate.accept();
|
||||
gate.accept(1);
|
||||
await expect(
|
||||
page.getByTestId("user-message").filter({ hasText: steeredPrompt }),
|
||||
).toHaveCount(1);
|
||||
await expectQueuedMessageButton(page);
|
||||
await expect(page.getByRole("button", { name: "Send queued message now" })).toHaveCount(0);
|
||||
await expect(
|
||||
page.getByTestId("user-message").filter({ hasText: queuedPrompt }),
|
||||
).toHaveCount(1);
|
||||
});
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
@@ -1380,26 +1378,21 @@ test.describe("Agent message submission", () => {
|
||||
await replaySteeredSleepTurnInBrowser(page, testInfo, "codex");
|
||||
});
|
||||
|
||||
test("restores overlapping queued sends when their connection fails", async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
test("restores the draft when queueing loses the connection", async ({ page }, testInfo) => {
|
||||
test.setTimeout(120_000);
|
||||
const gate = await gateNextAgentMessage(page);
|
||||
const agent = await startRunningMockAgent(page, {
|
||||
prefix: `overlapping-queued-send-${testInfo.workerIndex}-`,
|
||||
prefix: `queue-connection-lost-${testInfo.workerIndex}-`,
|
||||
model: "one-minute-stream",
|
||||
prompt: "Keep the agent running while messages queue.",
|
||||
prompt: "Keep the agent running while a message queues.",
|
||||
});
|
||||
const prompts = ["Restore the first queued send.", "Restore the second queued send."];
|
||||
const prompt = "Keep this draft if queueing fails.";
|
||||
try {
|
||||
await queueMessage(page, prompts[0]);
|
||||
await queueMessage(page, prompts[1]);
|
||||
await page.getByRole("button", { name: "Send queued message now" }).first().click();
|
||||
await gate.waitForRequest(1);
|
||||
await page.getByRole("button", { name: "Send queued message now" }).first().click();
|
||||
await gate.waitForRequest(2);
|
||||
await fillComposerDraft(page, prompt);
|
||||
await sendDraftToQueue(page);
|
||||
await gate.waitForRequest();
|
||||
await gate.disconnect();
|
||||
await expectQueuedSendFailuresRestored(page, prompts);
|
||||
await expectFailedSubmissionRestored(page, prompt);
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
|
||||
@@ -44,6 +44,26 @@ const PROFILE = {
|
||||
|
||||
const PROFILE_SUMMARY = "Mock Load Test · One minute stream · Approval test";
|
||||
|
||||
// Isolate this suite to the sole mock provider so it tests single-provider picker
|
||||
// behavior deterministically regardless of which CLIs are installed on the host.
|
||||
test.use({
|
||||
e2eDaemonConfig: {
|
||||
version: 1,
|
||||
agents: {
|
||||
providers: {
|
||||
claude: { enabled: false },
|
||||
codex: { enabled: false },
|
||||
copilot: { enabled: false },
|
||||
opencode: { enabled: false },
|
||||
pi: { enabled: false },
|
||||
omp: { enabled: false },
|
||||
antigravity: { enabled: false },
|
||||
hoplite: { enabled: false },
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
test.describe("Agent profiles in the model picker", () => {
|
||||
test("an empty host still exposes agent profile settings from the picker", async ({ page }) => {
|
||||
const seed = await seedAgentProfiles([]);
|
||||
@@ -68,8 +88,8 @@ test.describe("Agent profiles in the model picker", () => {
|
||||
page,
|
||||
}) => {
|
||||
const seed = await seedAgentProfiles([PROFILE]);
|
||||
// A live agent is one provider's process, so the profile has to name that
|
||||
// same provider or the picker will not offer it at all.
|
||||
// With only the mock provider enabled on this host, the picker opens
|
||||
// directly into its models and shows its pinned profile.
|
||||
const workspace = await seedMockAgentWorkspace({
|
||||
repoPrefix: "agent-profiles-picker-",
|
||||
title: "Agent profiles picker",
|
||||
@@ -85,13 +105,10 @@ test.describe("Agent profiles in the model picker", () => {
|
||||
await expectComposerMode(page, "Load test");
|
||||
});
|
||||
|
||||
await test.step("the picker opens on the agent's provider with Profiles beside it", async () => {
|
||||
await test.step("the single-provider picker lists Profiles above the agent's models without a rail", async () => {
|
||||
await openModelPicker(page);
|
||||
await expect(page.getByTestId("model-search-input").first()).toBeFocused();
|
||||
await expect(page.getByTestId("model-provider-mock")).toHaveAttribute(
|
||||
"data-active",
|
||||
"true",
|
||||
);
|
||||
await expect(page.getByTestId("model-picker-rail")).toHaveCount(0);
|
||||
await expectModelRowSelected(page, { provider: "mock", modelId: "ten-second-stream" });
|
||||
await expectPickerProfile(page, {
|
||||
name: PROFILE.name,
|
||||
@@ -131,6 +148,45 @@ test.describe("Agent profiles in the model picker", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("the compact drawer keeps a running agent's Profiles collapsed and its rows one height", async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
const seed = await seedAgentProfiles([PROFILE]);
|
||||
const workspace = await seedMockAgentWorkspace({
|
||||
repoPrefix: "agent-profiles-compact-running-",
|
||||
title: "Agent profiles compact running",
|
||||
model: "ten-second-stream",
|
||||
modeId: "load-test",
|
||||
});
|
||||
|
||||
try {
|
||||
await page.setViewportSize({ width: 390, height: 800 });
|
||||
await openAgentRoute(page, workspace);
|
||||
await expectComposerVisible(page);
|
||||
await page.getByTestId("combined-model-selector").filter({ visible: true }).first().click();
|
||||
await expect(page.getByTestId("agent-controls-profiles")).toBeVisible();
|
||||
await expect(page.getByTestId("agent-controls-profiles-list")).toHaveCount(0);
|
||||
|
||||
// Settings rows (Model, switches) sit in the same list as the Profiles header and mode rows.
|
||||
const sheet = page.getByTestId("agent-controls-settings-list");
|
||||
const rows = [
|
||||
sheet.getByTestId("agent-controls-profiles"),
|
||||
sheet.getByTestId("agent-controls-model"),
|
||||
sheet.locator('[data-testid^="mode-option-"]').first(),
|
||||
];
|
||||
const heights = [];
|
||||
for (const row of rows) {
|
||||
await expect(row).toBeVisible();
|
||||
heights.push(Math.round((await row.boundingBox())!.height));
|
||||
}
|
||||
await page.screenshot({ path: testInfo.outputPath("compact-agent-settings.png") });
|
||||
expect(new Set(heights).size, `row heights ${heights.join(", ")}`).toBe(1);
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
await seed.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test("a model row and its create-profile action are separate buttons", async ({ page }) => {
|
||||
const seed = await seedAgentProfiles([]);
|
||||
const workspace = await seedMockAgentWorkspace({
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import {
|
||||
expectBuiltinPluginSettings,
|
||||
openBuiltinPluginSettings,
|
||||
test,
|
||||
} from "../support/helpers/builtin-plugin-settings";
|
||||
|
||||
test("a built-in plugin's settings link opens its screen", async ({
|
||||
page,
|
||||
builtinSettingsHost,
|
||||
}) => {
|
||||
await openBuiltinPluginSettings(page, builtinSettingsHost);
|
||||
await expectBuiltinPluginSettings(page);
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { expect, test } from "../support/fixtures";
|
||||
import { expect, test, type Page } from "../support/fixtures";
|
||||
import { expectComposerVisible } from "../support/helpers/composer";
|
||||
import { installDaemonWebSocketGate } from "../support/helpers/daemon-websocket-gate";
|
||||
import { installLocalDesktopHost } from "../support/helpers/local-desktop-host";
|
||||
@@ -282,3 +282,63 @@ test("compact opens files and subagents in a sheet, leaving the tabs for agents"
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
async function openFileAndDismissDuringAnimation(page: Page) {
|
||||
const fileLink = page.getByText(FILE_LINK, { exact: true });
|
||||
await expect(fileLink).toBeVisible({ timeout: 15_000 });
|
||||
|
||||
// Check and press in the same browser frame so automation cannot outlast the opening animation.
|
||||
await fileLink.evaluate((link) => {
|
||||
if (!(link instanceof HTMLElement)) throw new Error("Expected an HTML file link");
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const timeout = window.setTimeout(() => {
|
||||
cancelAnimationFrame(frame);
|
||||
reject(new Error("The file sheet did not pass through the opening position"));
|
||||
}, 5_000);
|
||||
const dismissDuringOpening = () => {
|
||||
const header = document.querySelector('[data-testid="sheet-tab-header"]');
|
||||
const top = header?.getBoundingClientRect().top ?? window.innerHeight;
|
||||
const pressTarget = document.elementFromPoint(10, 10);
|
||||
if (
|
||||
top > window.innerHeight / 2 &&
|
||||
top < window.innerHeight &&
|
||||
pressTarget instanceof HTMLElement &&
|
||||
pressTarget.getAttribute("aria-label") === "Bottom sheet backdrop"
|
||||
) {
|
||||
window.clearTimeout(timeout);
|
||||
pressTarget.click();
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
frame = requestAnimationFrame(dismissDuringOpening);
|
||||
};
|
||||
let frame = requestAnimationFrame(dismissDuringOpening);
|
||||
link.click();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
test("a sheet dismissed while it is still opening closes its tab", async ({ page }) => {
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
const workspace = await seedMockAgentWorkspace({
|
||||
repoPrefix: "compact-sheet-opening-dismiss-",
|
||||
title: "Sheet parent",
|
||||
initialPrompt: promptMentioning(FILE_LINK),
|
||||
});
|
||||
try {
|
||||
await writeFile(path.join(workspace.cwd, "linked.ts"), "one\ntwo\nthree\n", "utf8");
|
||||
await openAgentRoute(page, { workspaceId: workspace.workspaceId, agentId: workspace.agentId });
|
||||
|
||||
await openFileAndDismissDuringAnimation(page);
|
||||
|
||||
await expectNoSheetOpen(page);
|
||||
await expectOpenTabCount(page, 1);
|
||||
await page
|
||||
.getByRole("button", { name: /Switch tabs/ })
|
||||
.filter({ visible: true })
|
||||
.click();
|
||||
await expect(page.getByText("Workspace tabs", { exact: true })).toBeVisible();
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -233,6 +233,63 @@ test("opening an agent focuses the composer when a mouse drives the UI", async (
|
||||
}
|
||||
});
|
||||
|
||||
/** The composer frame's border colour once its border-color transition has finished. */
|
||||
async function readSettledFrameBorder(page: Page): Promise<string> {
|
||||
return composerLocator(page).evaluate(async (input) => {
|
||||
let frame = input.parentElement;
|
||||
while (frame && parseFloat(getComputedStyle(frame).borderTopWidth) < 1) {
|
||||
frame = frame.parentElement;
|
||||
}
|
||||
if (!frame) throw new Error("Composer frame has no border");
|
||||
while (frame.getAnimations().length > 0) {
|
||||
await new Promise((resolve) => requestAnimationFrame(resolve));
|
||||
}
|
||||
return getComputedStyle(frame).borderTopColor;
|
||||
});
|
||||
}
|
||||
|
||||
// `borderAccent` at rest, `surface4` while focused: greys in both themes, never the accent.
|
||||
const FRAME_BORDERS = {
|
||||
dark: { rest: "rgb(47, 53, 52)", focus: "rgb(89, 91, 91)" },
|
||||
light: { rest: "rgb(236, 236, 241)", focus: "rgb(212, 212, 216)" },
|
||||
} as const;
|
||||
|
||||
for (const colorScheme of ["dark", "light"] as const) {
|
||||
test(`the composer frame takes a neutral border on focus in the ${colorScheme} theme`, async ({
|
||||
page,
|
||||
}) => {
|
||||
const agent = await seedMockAgentWorkspace({
|
||||
repoPrefix: "composer-frame-focus-",
|
||||
title: "Composer frame focus",
|
||||
});
|
||||
const borders = FRAME_BORDERS[colorScheme];
|
||||
|
||||
try {
|
||||
await page.emulateMedia({ colorScheme });
|
||||
await openAgentRoute(page, agent);
|
||||
const composer = composerLocator(page);
|
||||
await expectComposerVisible(page);
|
||||
await page.mouse.move(0, 0);
|
||||
await blurComposerInput(page);
|
||||
expect(await readSettledFrameBorder(page)).toBe(borders.rest);
|
||||
|
||||
await composer.click();
|
||||
await page.mouse.move(0, 0);
|
||||
await expectComposerFocused(page);
|
||||
expect(await readSettledFrameBorder(page)).toBe(borders.focus);
|
||||
|
||||
await blurComposerInput(page);
|
||||
expect(await readSettledFrameBorder(page)).toBe(borders.rest);
|
||||
|
||||
// Hover alone leaves the frame at rest, so the border only ever means focus.
|
||||
await composer.hover();
|
||||
expect(await readSettledFrameBorder(page)).toBe(borders.rest);
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function waitForAnimationFrames(page: Page, count: number): Promise<void> {
|
||||
await page.evaluate(async (frames) => {
|
||||
for (let frame = 0; frame < frames; frame += 1) {
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
import { expect, test } from "../support/fixtures";
|
||||
import { expectAgentIdle } from "../support/helpers/agent-stream";
|
||||
import {
|
||||
attachComposerTestImage,
|
||||
cancelAgent,
|
||||
composerLocator,
|
||||
expectAttachmentPill,
|
||||
expectComposerDraft,
|
||||
expectComposerVisible,
|
||||
fillComposerDraft,
|
||||
sendDraftToQueue,
|
||||
} from "../support/helpers/composer";
|
||||
import {
|
||||
cancelQueuedMessage,
|
||||
editQueuedMessage,
|
||||
expectDeliveredImage,
|
||||
expectComposerOnScreen,
|
||||
expectDeliveredOnce,
|
||||
expectSenderIconUnsquashed,
|
||||
openSecondClient,
|
||||
queuedRow,
|
||||
queuedRows,
|
||||
queueMessage,
|
||||
queuePausedNotice,
|
||||
queueThroughHost,
|
||||
reopenAgent,
|
||||
scrollQueueFrom,
|
||||
seedAgentWithOpenTurn,
|
||||
sendQueuedMessageNow,
|
||||
} from "../support/helpers/composer-queue";
|
||||
import { openAgentRoute } from "../support/helpers/mock-agent";
|
||||
|
||||
test.describe("Composer queue", () => {
|
||||
test("a queued image prompt can be edited, survives a reload, and is delivered once", async ({
|
||||
page,
|
||||
}) => {
|
||||
const prompt = "Describe this screenshot.";
|
||||
const revised = "Describe this screenshot in one line.";
|
||||
const agent = await seedAgentWithOpenTurn({ repoPrefix: "queue-edit-", title: "Queue edit" });
|
||||
try {
|
||||
await openAgentRoute(page, agent);
|
||||
await expectComposerVisible(page);
|
||||
|
||||
await test.step("queue a prompt with an image", async () => {
|
||||
await attachComposerTestImage(page);
|
||||
await expectAttachmentPill(page, "composer-image-attachment-pill");
|
||||
await queueMessage(page, prompt);
|
||||
await expect(queuedRow(page, prompt)).toContainText("1 attachment");
|
||||
});
|
||||
|
||||
await test.step("Edit takes the text and image back into the composer", async () => {
|
||||
await editQueuedMessage(page, prompt);
|
||||
await expect(queuedRows(page)).toHaveCount(0);
|
||||
await expectComposerDraft(page, prompt);
|
||||
await expectAttachmentPill(page, "composer-image-attachment-pill");
|
||||
await expect(composerLocator(page)).toBeFocused();
|
||||
});
|
||||
|
||||
await test.step("queue the revised prompt with the same image", async () => {
|
||||
await queueMessage(page, revised);
|
||||
await expect(queuedRow(page, revised)).toContainText("1 attachment");
|
||||
});
|
||||
|
||||
await test.step("the row is still there after a reload", async () => {
|
||||
await page.reload();
|
||||
await expect(queuedRow(page, revised)).toBeVisible({ timeout: 30_000 });
|
||||
await expect(queuedRows(page)).toHaveCount(1);
|
||||
});
|
||||
|
||||
await test.step("the prompt is delivered once when the turn ends", async () => {
|
||||
await agent.finishTurn();
|
||||
await expectDeliveredOnce(page, revised);
|
||||
await expectDeliveredImage(page, revised);
|
||||
await expect(queuedRows(page)).toHaveCount(0);
|
||||
});
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("Stop pauses the queue until the user sends a row", async ({ page }) => {
|
||||
const prompt = "Run after I say so.";
|
||||
const agent = await seedAgentWithOpenTurn({ repoPrefix: "queue-held-", title: "Queue held" });
|
||||
try {
|
||||
await openAgentRoute(page, agent);
|
||||
await expectComposerVisible(page);
|
||||
await queueMessage(page, prompt);
|
||||
await expect(queuePausedNotice(page)).toHaveCount(0);
|
||||
|
||||
await cancelAgent(page);
|
||||
|
||||
await expectAgentIdle(page);
|
||||
await expect(queuePausedNotice(page)).toBeVisible();
|
||||
await expect(queuedRow(page, prompt)).toBeVisible();
|
||||
|
||||
await sendQueuedMessageNow(page, prompt);
|
||||
|
||||
await expectDeliveredOnce(page, prompt);
|
||||
await expect(queuePausedNotice(page)).toHaveCount(0);
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("the host delivers a queued prompt with every client closed", async ({ page }) => {
|
||||
const prompt = "Continue while I am away.";
|
||||
const agent = await seedAgentWithOpenTurn({
|
||||
repoPrefix: "queue-closed-",
|
||||
title: "Queue closed",
|
||||
});
|
||||
try {
|
||||
await openAgentRoute(page, agent);
|
||||
await expectComposerVisible(page);
|
||||
await queueMessage(page, prompt);
|
||||
|
||||
await page.close();
|
||||
await agent.finishTurn();
|
||||
await agent.client.waitForFinish(agent.agentId, 30_000);
|
||||
const reopened = await reopenAgent(page, agent);
|
||||
|
||||
await expectDeliveredOnce(reopened, prompt);
|
||||
await expect(queuedRows(reopened)).toHaveCount(0);
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("two clients share one queue", async ({ browser, page }) => {
|
||||
const unwanted = "Do not run this one.";
|
||||
const urgent = "Run this one now.";
|
||||
const agent = await seedAgentWithOpenTurn({ repoPrefix: "queue-sync-", title: "Queue sync" });
|
||||
try {
|
||||
await openAgentRoute(page, agent);
|
||||
await expectComposerVisible(page);
|
||||
const second = await openSecondClient(browser, page, agent);
|
||||
try {
|
||||
await expectComposerVisible(second.page);
|
||||
|
||||
await test.step("a row queued on one client appears on the other", async () => {
|
||||
await queueMessage(page, unwanted);
|
||||
await expect(queuedRow(second.page, unwanted)).toBeVisible();
|
||||
await fillComposerDraft(second.page, urgent);
|
||||
await sendDraftToQueue(second.page);
|
||||
await expect(queuedRows(page)).toContainText([unwanted, urgent]);
|
||||
});
|
||||
|
||||
await test.step("Cancel on one client removes the row on the other", async () => {
|
||||
await cancelQueuedMessage(second.page, unwanted);
|
||||
await expect(queuedRow(page, unwanted)).toHaveCount(0);
|
||||
});
|
||||
|
||||
await test.step("Send now on one client updates the other", async () => {
|
||||
await sendQueuedMessageNow(page, urgent);
|
||||
await expectDeliveredOnce(second.page, urgent);
|
||||
await expect(
|
||||
second.page.getByTestId("user-message").filter({ hasText: unwanted }),
|
||||
).toHaveCount(0);
|
||||
});
|
||||
} finally {
|
||||
await second.close();
|
||||
}
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("a long queue scrolls without pushing the composer off screen", async ({ page }) => {
|
||||
const texts = Array.from({ length: 20 }, (_, index) => `Queued update ${index + 1}.`);
|
||||
const first = "Queued update 1.";
|
||||
const last = "Queued update 20.";
|
||||
const agent = await seedAgentWithOpenTurn({ repoPrefix: "queue-long-", title: "Queue long" });
|
||||
try {
|
||||
await openAgentRoute(page, agent);
|
||||
await expectComposerVisible(page);
|
||||
await queueThroughHost(agent, texts);
|
||||
await expect(queuedRows(page)).toHaveCount(20);
|
||||
|
||||
for (const viewport of [
|
||||
{ width: 1280, height: 800 },
|
||||
{ width: 390, height: 844 },
|
||||
// A phone with its keyboard open.
|
||||
{ width: 390, height: 500 },
|
||||
]) {
|
||||
await test.step(`${viewport.width}x${viewport.height}`, async () => {
|
||||
await page.setViewportSize(viewport);
|
||||
await expect(queuedRow(page, first)).toBeVisible();
|
||||
await expectComposerOnScreen(page);
|
||||
|
||||
await scrollQueueFrom(page, first, 5000);
|
||||
// Scrolled to the end, a fractional frame height can clip a sub-pixel of the row.
|
||||
await expect(queuedRow(page, last)).toBeInViewport({ ratio: 0.99 });
|
||||
await expectComposerOnScreen(page);
|
||||
|
||||
await scrollQueueFrom(page, last, -5000);
|
||||
await expect(queuedRow(page, first)).toBeInViewport({ ratio: 1 });
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("a message queued by another agent can be cancelled but not edited", async ({ page }) => {
|
||||
const message = "The release notes are ready for review.";
|
||||
const agent = await seedAgentWithOpenTurn({
|
||||
repoPrefix: "queue-sender-",
|
||||
title: "Queue recipient",
|
||||
});
|
||||
try {
|
||||
const sender = await agent.client.createAgent({
|
||||
provider: "mock",
|
||||
cwd: agent.cwd,
|
||||
workspaceId: agent.workspaceId,
|
||||
title: "Release coordination and changelog verification helper for the mobile team",
|
||||
model: "e2e-fast-stream",
|
||||
});
|
||||
await openAgentRoute(page, agent);
|
||||
await expectComposerVisible(page);
|
||||
|
||||
await agent.client.sendAgentMessage(agent.agentId, message, {
|
||||
sourceAgentId: sender.id,
|
||||
activeTurnBehavior: "queue",
|
||||
});
|
||||
|
||||
const row = queuedRow(page, message);
|
||||
await expect(row).toContainText("Sent by Release coordination");
|
||||
await expect(row.getByRole("button", { name: "Send queued message now" })).toBeEnabled();
|
||||
await expect(row.getByRole("button", { name: "Cancel queued message" })).toBeEnabled();
|
||||
await expect(row.getByRole("button", { name: "Edit queued message" })).toHaveCount(0);
|
||||
|
||||
await test.step("a long sender name truncates without squashing its icon", async () => {
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await expect(row).toBeInViewport();
|
||||
await expectSenderIconUnsquashed(row);
|
||||
});
|
||||
|
||||
await cancelQueuedMessage(page, message);
|
||||
|
||||
await expect(queuedRows(page)).toHaveCount(0);
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("editing a queued image prompt on a short phone viewport keeps remaining queued rows visible", async ({
|
||||
page,
|
||||
}) => {
|
||||
const withImage = "Describe this screenshot.";
|
||||
const remaining = Array.from({ length: 4 }, (_, index) => `Remaining update ${index + 1}.`);
|
||||
const agent = await seedAgentWithOpenTurn({
|
||||
repoPrefix: "queue-compact-edit-",
|
||||
title: "Queue compact edit",
|
||||
});
|
||||
try {
|
||||
await openAgentRoute(page, agent);
|
||||
await expectComposerVisible(page);
|
||||
|
||||
await attachComposerTestImage(page);
|
||||
await expectAttachmentPill(page, "composer-image-attachment-pill");
|
||||
await queueMessage(page, withImage);
|
||||
await queueThroughHost(agent, remaining);
|
||||
await expect(queuedRows(page)).toHaveCount(5);
|
||||
|
||||
await page.setViewportSize({ width: 390, height: 500 });
|
||||
await editQueuedMessage(page, withImage);
|
||||
await expectComposerDraft(page, withImage);
|
||||
await expectAttachmentPill(page, "composer-image-attachment-pill");
|
||||
await expect(composerLocator(page)).toBeInViewport({ ratio: 1 });
|
||||
await expect(
|
||||
page.getByRole("button", { name: "Send and steer", exact: true }),
|
||||
).toBeInViewport({
|
||||
ratio: 1,
|
||||
});
|
||||
|
||||
// The queue scroll viewport must keep a readable slice (>= 90px) above the restored image pill,
|
||||
// not collapse to a sliver inside a 0.6*viewport slot clamp.
|
||||
const scrollFrameHeight = await page
|
||||
.getByRole("list", { name: "Queued messages" })
|
||||
.evaluate((list) => {
|
||||
const scrollView = list.parentElement?.parentElement;
|
||||
return scrollView ? scrollView.getBoundingClientRect().height : 0;
|
||||
});
|
||||
expect(scrollFrameHeight).toBeGreaterThanOrEqual(90);
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -753,6 +753,10 @@ test.describe("CodeMirror workspace file editing", () => {
|
||||
const imagePath = path.join(workspace.repoPath, "pixel.png");
|
||||
await writeFile(markdownPath, "# First heading\n", "utf8");
|
||||
await writeFile(imagePath, RED_PIXEL);
|
||||
await writeFile(
|
||||
path.join(workspace.repoPath, "shape.svg"),
|
||||
await readFile(path.resolve(__dirname, "../mobile/fixtures/native-preview.svg")),
|
||||
);
|
||||
await workspace.navigateTo();
|
||||
await openWorkspaceFile(page, "notes.md");
|
||||
|
||||
@@ -800,6 +804,11 @@ test.describe("CodeMirror workspace file editing", () => {
|
||||
const initialSource = await image.getAttribute("src");
|
||||
await writeFile(imagePath, BLUE_PIXEL);
|
||||
await expect.poll(() => image.getAttribute("src")).not.toBe(initialSource);
|
||||
|
||||
await openWorkspaceFile(page, "shape.svg");
|
||||
await expect(imageCanvas).toBeVisible();
|
||||
await expect(image).toBeVisible();
|
||||
await expect(image).toHaveJSProperty("naturalWidth", 240);
|
||||
});
|
||||
|
||||
test("renders local relative images inside Markdown preview", async ({ page, withWorkspace }) => {
|
||||
|
||||
@@ -28,7 +28,9 @@ import {
|
||||
} from "../support/helpers/composer";
|
||||
import { openGlobalNewWorkspaceComposer } from "../support/helpers/new-workspace";
|
||||
import { clickNewChat, clickNewTerminal, gotoWorkspace } from "../support/helpers/launcher";
|
||||
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
|
||||
import { seedWorkspace } from "../support/helpers/seed-client";
|
||||
import { waitForSettledPosition } from "../support/helpers/sheet-layout";
|
||||
|
||||
const MOCK_PROVIDER_LABEL = "Mock Load Test";
|
||||
|
||||
@@ -315,15 +317,55 @@ test.describe("Cross-provider model search", () => {
|
||||
await expectComposerFocused(page);
|
||||
});
|
||||
|
||||
await test.step("the compact drawer puts Profiles in the Model accordion and lets all groups collapse", async () => {
|
||||
await test.step("the compact drawer opens a new agent's Profiles above Model on Home and keeps provider headers stable on collapse", async () => {
|
||||
await page.setViewportSize({ width: 390, height: 800 });
|
||||
await page.getByTestId("combined-model-selector").filter({ visible: true }).first().click();
|
||||
await expect(page.getByTestId("agent-controls-profiles")).toHaveCount(0);
|
||||
await page.getByTestId("agent-controls-model").click();
|
||||
const profilesToggle = page.getByTestId("agent-controls-profiles");
|
||||
const profilesList = page.getByTestId("agent-controls-profiles-list");
|
||||
const modelRowButton = page.getByTestId("agent-controls-model");
|
||||
await expect(profilesToggle).toBeVisible();
|
||||
await expect(profilesList).toBeVisible();
|
||||
await profilesToggle.click();
|
||||
await expect(profilesList).toHaveCount(0);
|
||||
await waitForSettledPosition(profilesToggle);
|
||||
const profilesBox = await profilesToggle.boundingBox();
|
||||
const modelBox = await modelRowButton.boundingBox();
|
||||
expect(profilesBox && modelBox && profilesBox.y < modelBox.y).toBe(true);
|
||||
|
||||
// Open Model: Profiles is extracted onto Home, and provider headers keep exact geometry when collapsed.
|
||||
await modelRowButton.click();
|
||||
await expect(page.getByTestId("compact-model-list")).toBeVisible();
|
||||
await page.locator('[data-testid^="model-provider-section-"]').first().click();
|
||||
await expect(page.getByTestId("model-picker-rail-profiles")).toHaveCount(0);
|
||||
const expandedHeader = page.locator('[data-testid^="model-provider-section-"]').first();
|
||||
const expandedBox = await expandedHeader.boundingBox();
|
||||
const expandedProviderId = (await expandedHeader.getAttribute("data-testid"))?.replace(
|
||||
"model-provider-section-",
|
||||
"",
|
||||
);
|
||||
await expandedHeader.click();
|
||||
await expect(page.getByTestId("compact-model-list")).toHaveCount(0);
|
||||
await page.getByTestId("model-picker-rail-profiles").click();
|
||||
const collapsedHeader = page.getByTestId(`model-provider-${expandedProviderId}`);
|
||||
const collapsedBox = await collapsedHeader.boundingBox();
|
||||
expect(expandedBox && collapsedBox).toBeTruthy();
|
||||
expect(Math.abs(expandedBox!.y - collapsedBox!.y)).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(expandedBox!.height - collapsedBox!.height)).toBeLessThanOrEqual(1);
|
||||
|
||||
// Search dock matches the collapsed provider card's outer rails, height, and text rail.
|
||||
const searchContainer = page.getByTestId("model-search-all-input-container");
|
||||
const searchInput = page.getByTestId("model-search-all-input");
|
||||
const searchBox = await searchContainer.boundingBox();
|
||||
const searchInputBox = await searchInput.boundingBox();
|
||||
const collapsedCardBox = await readCollapsedCardGeometry(collapsedHeader);
|
||||
expect(searchBox && searchInputBox && collapsedCardBox).toBeTruthy();
|
||||
expect(Math.abs(searchBox!.x - collapsedCardBox!.cardX)).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(searchBox!.width - collapsedCardBox!.cardWidth)).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(searchBox!.height - collapsedCardBox!.cardHeight)).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(searchInputBox!.x - collapsedCardBox!.labelX)).toBeLessThanOrEqual(2);
|
||||
|
||||
// Return Home, expand Profiles in place, and apply the profile.
|
||||
await page.getByTestId("sheet-header-back").click();
|
||||
await expect(profilesList).toHaveCount(0);
|
||||
await profilesToggle.click();
|
||||
const sheetProfileRow = page.getByTestId("model-profile-row-agent_profile_e2e_arrows");
|
||||
await expect(sheetProfileRow).toBeVisible();
|
||||
await sheetProfileRow.click();
|
||||
@@ -373,8 +415,193 @@ test.describe("Cross-provider model search", () => {
|
||||
await provider.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test("reopening a deep selected model lands at its scroll offset on the first paint on desktop and mobile", async ({
|
||||
page,
|
||||
}) => {
|
||||
const provider = await seedModelProvider(LARGE_CATALOG);
|
||||
const workspace = await seedWorkspace({ repoPrefix: "model-picker-initial-scroll-" });
|
||||
|
||||
try {
|
||||
await gotoWorkspace(page, workspace.workspaceId);
|
||||
await clickNewChat(page);
|
||||
await expectComposerVisible(page);
|
||||
|
||||
// Select a model deep in the 200-item catalog.
|
||||
await openModelPicker(page);
|
||||
await searchAllModels(page, "bulk model 80");
|
||||
await page
|
||||
.getByTestId("combobox-desktop-container")
|
||||
.getByTestId(`model-row-${LARGE_CATALOG.id}-bulk-80`)
|
||||
.click();
|
||||
await expect(page.getByTestId("combobox-desktop-container")).toHaveCount(0);
|
||||
|
||||
await test.step("desktop opens directly at the selected row without flashing scrollTop 0", async () => {
|
||||
await startScrollSampling(page, "model-picker-model-list");
|
||||
await page.getByTestId("combined-model-selector").filter({ visible: true }).first().click();
|
||||
const samples = await readScrollSamples(page, "model-picker-model-list");
|
||||
expect(samples[0]).toBeGreaterThan(0);
|
||||
await expect(
|
||||
page
|
||||
.getByTestId("combobox-desktop-container")
|
||||
.getByTestId(`model-row-${LARGE_CATALOG.id}-bulk-80`),
|
||||
).toBeInViewport();
|
||||
await closeModelPicker(page);
|
||||
});
|
||||
|
||||
await test.step("mobile opens directly at the selected row without flashing scrollTop 0", async () => {
|
||||
await page.setViewportSize({ width: 390, height: 800 });
|
||||
await page.getByTestId("combined-model-selector").filter({ visible: true }).first().click();
|
||||
await expect(page.getByTestId("agent-controls-model")).toBeVisible();
|
||||
await startScrollSampling(page, "compact-model-list");
|
||||
await page.getByTestId("agent-controls-model").click();
|
||||
const samples = await readScrollSamples(page, "compact-model-list");
|
||||
expect(samples[0]).toBeGreaterThan(0);
|
||||
const listBox = await page.getByTestId("compact-model-list").boundingBox();
|
||||
const rowBox = await page
|
||||
.getByTestId(`model-row-${LARGE_CATALOG.id}-bulk-80`)
|
||||
.boundingBox();
|
||||
expect(listBox && rowBox).toBeTruthy();
|
||||
expect(rowBox!.y).toBeGreaterThanOrEqual(listBox!.y - 1);
|
||||
expect(rowBox!.y + rowBox!.height).toBeLessThanOrEqual(listBox!.y + listBox!.height + 1);
|
||||
});
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
await provider.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test("compact single-provider picker keeps its header fixed and scrolls to the last model row", async ({
|
||||
page,
|
||||
}) => {
|
||||
const extraModels = Array.from({ length: 24 }, (_, index) => ({
|
||||
id: `extra-scroll-${String(index).padStart(2, "0")}`,
|
||||
label: `Extra scroll model ${String(index).padStart(2, "0")}`,
|
||||
description: `Extra row ${index}`,
|
||||
}));
|
||||
const client = await connectDaemonClient<DaemonClient>({
|
||||
clientIdPrefix: "single-provider-scroll",
|
||||
});
|
||||
const workspace = await seedMockAgentWorkspace({
|
||||
repoPrefix: "single-provider-scroll-",
|
||||
title: "Single provider scroll",
|
||||
model: "ten-second-stream",
|
||||
modeId: "load-test",
|
||||
});
|
||||
|
||||
try {
|
||||
await client.patchDaemonConfig({
|
||||
providers: {
|
||||
mock: {
|
||||
additionalModels: extraModels,
|
||||
},
|
||||
},
|
||||
});
|
||||
await page.setViewportSize({ width: 390, height: 800 });
|
||||
await openAgentRoute(page, workspace);
|
||||
await expectComposerVisible(page);
|
||||
await page.getByTestId("combined-model-selector").filter({ visible: true }).first().click();
|
||||
await expect(page.getByTestId("agent-controls-model")).toBeVisible();
|
||||
await page.getByTestId("agent-controls-model").click();
|
||||
|
||||
const list = page.getByTestId("compact-model-list");
|
||||
await expect(list).toBeVisible();
|
||||
const header = page.getByTestId("model-provider-section-mock");
|
||||
await expect(header).toBeVisible();
|
||||
const headerBox = await header.boundingBox();
|
||||
expect(headerBox).toBeTruthy();
|
||||
expect(headerBox!.height).toBeGreaterThanOrEqual(16);
|
||||
|
||||
// Scroll to the bottom of the lone provider's list and confirm the final row is fully in view.
|
||||
await list.evaluate((node) => {
|
||||
node.scrollTop = node.scrollHeight;
|
||||
});
|
||||
const lastRow = page.getByTestId("model-row-mock-extra-scroll-23");
|
||||
await expect(lastRow).toBeVisible();
|
||||
const listBox = await list.boundingBox();
|
||||
const lastRowBox = await lastRow.boundingBox();
|
||||
expect(listBox && lastRowBox).toBeTruthy();
|
||||
expect(lastRowBox!.y + lastRowBox!.height).toBeLessThanOrEqual(
|
||||
listBox!.y + listBox!.height + 1,
|
||||
);
|
||||
await lastRow.click();
|
||||
await expect(page.getByTestId("agent-controls-model")).toContainText("Extra scroll model 23");
|
||||
} finally {
|
||||
await client
|
||||
.patchDaemonConfig({
|
||||
providers: {
|
||||
mock: {
|
||||
additionalModels: [],
|
||||
},
|
||||
},
|
||||
})
|
||||
.catch(() => undefined);
|
||||
await client.close().catch(() => undefined);
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
async function readCollapsedCardGeometry(collapsedHeader: ReturnType<Page["getByTestId"]>) {
|
||||
return collapsedHeader.evaluate((node) => {
|
||||
// Walk up from the press overlay to the SettingsCard container (2px taller for borders).
|
||||
const header = node.parentElement;
|
||||
const card = header?.parentElement?.parentElement;
|
||||
const rect = card?.getBoundingClientRect();
|
||||
const label = header?.querySelector('[dir="auto"]');
|
||||
const labelRect = label?.getBoundingClientRect();
|
||||
return rect && labelRect
|
||||
? {
|
||||
cardX: rect.x,
|
||||
cardWidth: rect.width,
|
||||
cardHeight: rect.height,
|
||||
labelX: labelRect.x,
|
||||
}
|
||||
: null;
|
||||
});
|
||||
}
|
||||
|
||||
async function startScrollSampling(page: Page, listTestId: string): Promise<void> {
|
||||
await page.evaluate((testId) => {
|
||||
const samples: number[] = [];
|
||||
const win = window as unknown as {
|
||||
__scrollSamples?: number[];
|
||||
__scrollObserver?: MutationObserver;
|
||||
};
|
||||
win.__scrollObserver?.disconnect();
|
||||
win.__scrollSamples = samples;
|
||||
const capture = (el: Element) => {
|
||||
samples.push(el.scrollTop);
|
||||
let remaining = 4;
|
||||
const tick = () => {
|
||||
const current = document.querySelector(`[data-testid="${testId}"]`);
|
||||
if (current) samples.push(current.scrollTop);
|
||||
remaining -= 1;
|
||||
if (remaining > 0) requestAnimationFrame(tick);
|
||||
};
|
||||
requestAnimationFrame(tick);
|
||||
};
|
||||
const observer = new MutationObserver(() => {
|
||||
const el = document.querySelector(`[data-testid="${testId}"]`);
|
||||
if (!el) return;
|
||||
observer.disconnect();
|
||||
capture(el);
|
||||
});
|
||||
win.__scrollObserver = observer;
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
}, listTestId);
|
||||
}
|
||||
|
||||
async function readScrollSamples(page: Page, listTestId: string): Promise<number[]> {
|
||||
await expect(page.getByTestId(listTestId)).toBeVisible({ timeout: 10_000 });
|
||||
const readSamples = () =>
|
||||
page.evaluate(
|
||||
() => (window as unknown as { __scrollSamples?: number[] }).__scrollSamples ?? [],
|
||||
);
|
||||
await expect.poll(async () => (await readSamples()).length).toBeGreaterThanOrEqual(2);
|
||||
return readSamples();
|
||||
}
|
||||
|
||||
async function setRuntimeCatalog(client: DaemonClient, count: number, cwd: string) {
|
||||
await client.patchDaemonConfig({
|
||||
providers: {
|
||||
|
||||
@@ -15,6 +15,9 @@ import {
|
||||
expectBothConsecutiveTools,
|
||||
trackPluginChatRecovery,
|
||||
reconnectPluginChat,
|
||||
withRepeatedOutputTimeline,
|
||||
readOldestPluginReplacement,
|
||||
expectOldestPluginReplacementReadable,
|
||||
} from "../support/helpers/plugin-timeline";
|
||||
|
||||
for (const width of [1100, 390]) {
|
||||
@@ -82,3 +85,15 @@ test("plugin-transformed assistant reply keeps copy, fork, and turn duration in
|
||||
expect(await forkAttachment.waitForText()).toContain(ASSISTANT_TEXT);
|
||||
});
|
||||
});
|
||||
|
||||
test("keeps older plugin replacements readable when source messages reuse local output IDs", async ({
|
||||
page,
|
||||
}, info) => {
|
||||
await withRepeatedOutputTimeline(page, info, async () => {
|
||||
await readOldestPluginReplacement(page);
|
||||
await expectOldestPluginReplacementReadable(page);
|
||||
await page.reload({ waitUntil: "domcontentloaded" });
|
||||
await readOldestPluginReplacement(page);
|
||||
await expectOldestPluginReplacementReadable(page);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,324 @@
|
||||
import { writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import type { Locator } from "@playwright/test";
|
||||
import { expect, test, type Page } from "../support/fixtures";
|
||||
import { openCommandCenter } from "../support/helpers/command-center";
|
||||
import { runWorkspaceActionFromCommandCenter } from "../support/helpers/command-center-workspace-actions";
|
||||
import { submitMessageWithButton } from "../support/helpers/composer";
|
||||
import { openFileExplorer, openFileFromExplorer } from "../support/helpers/file-explorer";
|
||||
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
|
||||
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
|
||||
import { copyPluginExample } from "../support/helpers/plugin-fixture";
|
||||
import { runCommand } from "../support/helpers/plugin-sidebar-items";
|
||||
import {
|
||||
closeSheet,
|
||||
expectNoSheetOpen,
|
||||
expectOneSheetOpen,
|
||||
promptMentioning,
|
||||
sheet,
|
||||
} from "../support/helpers/sheet";
|
||||
import {
|
||||
closeMobileExplorer,
|
||||
expectMobileExplorerHidden,
|
||||
expectMobileExplorerVisible,
|
||||
openMobileAgentSidebar,
|
||||
selectWorkspaceInSidebar,
|
||||
} from "../support/helpers/sidebar";
|
||||
import { getServerId } from "../support/helpers/server-id";
|
||||
|
||||
const WIDE = { width: 1600, height: 900 };
|
||||
const COMPACT = { width: 390, height: 844 };
|
||||
const AGENT_TITLE = "Layout agent";
|
||||
const FILE_LINK = "README.md:1";
|
||||
const NO_FILE = "Focus a file to see its outline";
|
||||
|
||||
const REPO_FILES = [
|
||||
{ path: "README.md", content: "# Guide\n\n## Install\n" },
|
||||
{ path: "notes.md", content: "# Notes\n\n## Open questions\n" },
|
||||
{ path: "src/app.ts", content: "// TODO: handle errors\nexport const ready = true;\n" },
|
||||
];
|
||||
|
||||
const REVIEW_TAB = "workspace-tab-plugin_agent_16_workspace-layout_6_review_";
|
||||
const FINDINGS_TAB = "workspace-tab-plugin_workspace_16_workspace-layout_8_findings";
|
||||
const OUTLINE_TAB = "workspace-tab-plugin_workspace_16_workspace-layout_7_outline";
|
||||
|
||||
async function withLayoutExample(
|
||||
initialPrompt: string | undefined,
|
||||
run: (agent: { agentId: string; workspaceId: string }) => Promise<void>,
|
||||
): Promise<void> {
|
||||
const example = await copyPluginExample("workspace-layout");
|
||||
const workspace = await seedMockAgentWorkspace({
|
||||
repoPrefix: "plugin-workspace-layout-",
|
||||
title: AGENT_TITLE,
|
||||
repo: { files: REPO_FILES },
|
||||
initialPrompt,
|
||||
});
|
||||
try {
|
||||
await withPluginInstalled(example.directory, () => run(workspace));
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
await example.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
async function withPluginInstalled(directory: string, run: () => Promise<void>): Promise<void> {
|
||||
const client = await connectNewWorkspaceDaemonClient({ ownProjects: false });
|
||||
const previous = await client.getDaemonConfig();
|
||||
try {
|
||||
await client.patchDaemonConfig({ pluginsEnabled: true });
|
||||
await client.installDirectoryPlugin(directory);
|
||||
await run();
|
||||
} finally {
|
||||
await client.removePlugin("workspace-layout").catch(() => undefined);
|
||||
await client.patchDaemonConfig({ pluginsEnabled: previous.config.pluginsEnabled ?? false });
|
||||
await client.close();
|
||||
}
|
||||
}
|
||||
|
||||
/** `/open-elsewhere <id>` opens a file in that workspace, then one where the command ran. */
|
||||
const OPEN_ELSEWHERE_ENTRY = `import type { PluginClientContext } from "@getpaseo/plugin/client";
|
||||
|
||||
export default function contribute(client: PluginClientContext) {
|
||||
client.addSlashCommand({
|
||||
name: "open-elsewhere",
|
||||
description: "Open a file there, then one here",
|
||||
argumentHint: "<workspaceId>",
|
||||
context: "agent",
|
||||
onSubmit({ args, workspaceLayout }) {
|
||||
const there = client.workspaceLayout(args.trim());
|
||||
there.open({ panelId: "paseo/file", params: { path: "README.md" } });
|
||||
workspaceLayout.open({ panelId: "paseo/file", params: { path: "notes.md" } });
|
||||
},
|
||||
});
|
||||
return () => {};
|
||||
}
|
||||
`;
|
||||
|
||||
async function withTwoWorkspaces(
|
||||
run: (workspaces: {
|
||||
first: { agentId: string; workspaceId: string };
|
||||
second: { agentId: string; workspaceId: string };
|
||||
}) => Promise<void>,
|
||||
): Promise<void> {
|
||||
const example = await copyPluginExample("workspace-layout");
|
||||
await writeFile(path.join(example.directory, "index.client.tsx"), OPEN_ELSEWHERE_ENTRY);
|
||||
const seed = (title: string) =>
|
||||
seedMockAgentWorkspace({
|
||||
repoPrefix: "plugin-workspace-layout-",
|
||||
title,
|
||||
repo: { files: REPO_FILES },
|
||||
});
|
||||
const first = await seed("First agent");
|
||||
const second = await seed("Second agent");
|
||||
try {
|
||||
await withPluginInstalled(example.directory, () => run({ first, second }));
|
||||
} finally {
|
||||
await second.cleanup();
|
||||
await first.cleanup();
|
||||
await example.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
/** Picks a workspace in a phone's agent list. */
|
||||
async function switchToWorkspace(page: Page, workspaceId: string): Promise<void> {
|
||||
await openMobileAgentSidebar(page);
|
||||
await selectWorkspaceInSidebar(page, workspaceId);
|
||||
await expect(
|
||||
page.getByTestId(`workspace-deck-entry-${getServerId()}:${workspaceId}`),
|
||||
).toBeVisible();
|
||||
await expect(composerIn(page.locator("body"))).toBeEditable({ timeout: 30_000 });
|
||||
}
|
||||
|
||||
function mainPanes(page: Page): Locator {
|
||||
return page.locator('[data-testid^="workspace-pane-"]').filter({ visible: true });
|
||||
}
|
||||
|
||||
function explorer(page: Page): Locator {
|
||||
return page.getByTestId("workspace-explorer-sidebar");
|
||||
}
|
||||
|
||||
function agentTabs(scope: Locator): Locator {
|
||||
return scope.locator('[data-testid^="workspace-tab-agent_"]');
|
||||
}
|
||||
|
||||
function composerIn(scope: Locator): Locator {
|
||||
return scope.getByRole("textbox", { name: "Message agent..." }).filter({ visible: true });
|
||||
}
|
||||
|
||||
async function sendToMainChat(page: Page, text: string): Promise<void> {
|
||||
const composer = composerIn(mainPanes(page).first());
|
||||
await expect(composer).toBeEditable({ timeout: 30_000 });
|
||||
await composer.fill(text);
|
||||
await composer.press("Enter");
|
||||
}
|
||||
|
||||
async function expectAsideChat(page: Page, input: { message: string; tabs: number }) {
|
||||
const chats = agentTabs(explorer(page));
|
||||
await expect(chats).toHaveCount(input.tabs, { timeout: 30_000 });
|
||||
await expect(chats.last()).toHaveAttribute("aria-selected", "true");
|
||||
await expect(
|
||||
explorer(page).getByTestId("user-message").getByText(input.message, { exact: true }),
|
||||
).toBeVisible();
|
||||
await expect(composerIn(explorer(page))).toBeEditable();
|
||||
}
|
||||
|
||||
/** Every visible tab chip, pane by pane, to compare the arrangement before and after. */
|
||||
async function tabsByPane(page: Page): Promise<string[][]> {
|
||||
const scopes = [...(await mainPanes(page).all()), explorer(page)];
|
||||
return Promise.all(
|
||||
scopes.map((scope) =>
|
||||
scope
|
||||
.getByTestId("workspace-tabs-row")
|
||||
.locator('[data-testid^="workspace-tab-"]:not([data-testid^="workspace-tab-tooltip"])')
|
||||
.evaluateAll((chips) => chips.map((chip) => chip.getAttribute("data-testid") ?? "")),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
async function expectReviewLayout(page: Page, agentId: string): Promise<void> {
|
||||
await expect(mainPanes(page)).toHaveCount(2);
|
||||
const left = mainPanes(page).first();
|
||||
const right = mainPanes(page).last();
|
||||
await expect(left.getByTestId(`workspace-tab-agent_${agentId}`)).toBeVisible();
|
||||
|
||||
const review = right.getByTestId(`${REVIEW_TAB}${agentId.length}_${agentId}`);
|
||||
await expect(review).toHaveAttribute("aria-selected", "true");
|
||||
await expect(right.getByText(`Reviewing ${AGENT_TITLE}`, { exact: true })).toBeVisible();
|
||||
await expect(right.getByTestId("workspace-tab-working_diff")).toHaveAttribute(
|
||||
"aria-selected",
|
||||
"false",
|
||||
);
|
||||
await expect(explorer(page).getByTestId(FINDINGS_TAB)).toBeVisible();
|
||||
|
||||
const [leftBox, rightBox] = [await left.boundingBox(), await right.boundingBox()];
|
||||
if (!leftBox || !rightBox) throw new Error("Review layout panes have no bounds");
|
||||
expect(rightBox.x).toBeGreaterThan(leftBox.x);
|
||||
expect(rightBox.width / (leftBox.width + rightBox.width)).toBeCloseTo(0.4, 1);
|
||||
}
|
||||
|
||||
async function openFileInFocusedPane(page: Page, name: string): Promise<void> {
|
||||
await openFileExplorer(page);
|
||||
await openFileFromExplorer(page, name);
|
||||
await expect(mainPanes(page).getByTestId(`workspace-tab-file_${name}`)).toBeVisible();
|
||||
}
|
||||
|
||||
async function expectOutline(page: Page, lines: string[]): Promise<void> {
|
||||
const outline = page.getByTestId("workspace-layout-outline");
|
||||
for (const line of lines) {
|
||||
await expect(outline.getByText(line, { exact: true })).toHaveCount(1);
|
||||
}
|
||||
}
|
||||
|
||||
test("the workspace layout example arranges a wide workspace", async ({ page }) => {
|
||||
test.setTimeout(180_000);
|
||||
await withLayoutExample(undefined, async ({ agentId, workspaceId }) => {
|
||||
await page.setViewportSize(WIDE);
|
||||
await openAgentRoute(page, { workspaceId, agentId });
|
||||
|
||||
await test.step("/aside opens the child agent's chat in the Explorer", async () => {
|
||||
await sendToMainChat(page, "/aside hey");
|
||||
await expectAsideChat(page, { message: "hey", tabs: 1 });
|
||||
await expect(agentTabs(mainPanes(page))).toHaveCount(1);
|
||||
});
|
||||
|
||||
await test.step("a second /aside adds a second tab", async () => {
|
||||
await sendToMainChat(page, "/aside again");
|
||||
await expectAsideChat(page, { message: "again", tabs: 2 });
|
||||
await expect(agentTabs(mainPanes(page))).toHaveCount(1);
|
||||
});
|
||||
|
||||
await test.step("Review layout splits the workspace, and running it again changes nothing", async () => {
|
||||
await runCommand(page, "Review layout");
|
||||
await expectReviewLayout(page, agentId);
|
||||
const arranged = await tabsByPane(page);
|
||||
|
||||
await mainPanes(page).first().getByTestId(`workspace-tab-agent_${agentId}`).click();
|
||||
await runCommand(page, "Review layout");
|
||||
await expectReviewLayout(page, agentId);
|
||||
expect(await tabsByPane(page)).toEqual(arranged);
|
||||
});
|
||||
|
||||
await test.step("the outline follows the focused file across split panes", async () => {
|
||||
await mainPanes(page).first().getByTestId(`workspace-tab-agent_${agentId}`).click();
|
||||
await runCommand(page, "Show outline");
|
||||
await expectOutline(page, [NO_FILE]);
|
||||
|
||||
await openFileInFocusedPane(page, "README.md");
|
||||
await explorer(page).getByTestId(OUTLINE_TAB).click();
|
||||
await expectOutline(page, ["README.md", "Guide", "Install"]);
|
||||
|
||||
await runWorkspaceActionFromCommandCenter(page, "Split pane right");
|
||||
await expect(mainPanes(page)).toHaveCount(3);
|
||||
await openFileInFocusedPane(page, "notes.md");
|
||||
await explorer(page).getByTestId(OUTLINE_TAB).click();
|
||||
await expectOutline(page, ["notes.md", "Notes", "Open questions"]);
|
||||
|
||||
await mainPanes(page).getByTestId("workspace-tab-file_README.md").click();
|
||||
await expectOutline(page, ["README.md", "Guide", "Install"]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test("the workspace layout example opens over a phone's chat", async ({ page }) => {
|
||||
test.setTimeout(180_000);
|
||||
await withLayoutExample(promptMentioning(FILE_LINK), async ({ agentId, workspaceId }) => {
|
||||
await page.setViewportSize(COMPACT);
|
||||
await openAgentRoute(page, { workspaceId, agentId });
|
||||
|
||||
await test.step("/aside opens the Explorer over the chat", async () => {
|
||||
await submitMessageWithButton(page, "/aside hey");
|
||||
await expectMobileExplorerVisible(page);
|
||||
await expectAsideChat(page, { message: "hey", tabs: 1 });
|
||||
await closeMobileExplorer(page);
|
||||
await expectMobileExplorerHidden(page);
|
||||
await expect(
|
||||
page.getByRole("button", { name: "Switch tabs (1 open)" }).filter({ visible: true }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
await test.step("a file sheet updates the outline, and closing it restores it", async () => {
|
||||
await openMobileAgentSidebar(page);
|
||||
const commandCenter = await openCommandCenter(page);
|
||||
await commandCenter.getByTestId("command-center-input").fill("Show outline");
|
||||
await commandCenter.getByRole("button", { name: "Show outline", exact: true }).click();
|
||||
await expectMobileExplorerVisible(page);
|
||||
await expectOutline(page, [NO_FILE]);
|
||||
await closeMobileExplorer(page);
|
||||
await expectMobileExplorerHidden(page);
|
||||
|
||||
await page.getByText(FILE_LINK, { exact: true }).first().click();
|
||||
await expect(sheet(page, "README.md")).toBeVisible();
|
||||
// The sheet covers the Explorer, so the outline can only be read, not seen.
|
||||
await expectOutline(page, ["README.md", "Guide", "Install"]);
|
||||
await closeSheet(page, "README.md");
|
||||
await expectOutline(page, [NO_FILE]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test("a file a plugin opens in another workspace waits there on a phone", async ({ page }) => {
|
||||
test.setTimeout(180_000);
|
||||
await withTwoWorkspaces(async ({ first, second }) => {
|
||||
await page.setViewportSize(COMPACT);
|
||||
// Visiting the first workspace leaves its screen mounted behind the second.
|
||||
await openAgentRoute(page, first);
|
||||
await expect(composerIn(page.locator("body"))).toBeEditable({ timeout: 30_000 });
|
||||
await switchToWorkspace(page, second.workspaceId);
|
||||
|
||||
await test.step("only the sheet of the workspace on screen is shown", async () => {
|
||||
await submitMessageWithButton(page, `/open-elsewhere ${first.workspaceId}`);
|
||||
await expect(sheet(page, "notes.md")).toBeVisible();
|
||||
await expectOneSheetOpen(page);
|
||||
await closeSheet(page, "notes.md");
|
||||
await expectNoSheetOpen(page);
|
||||
});
|
||||
|
||||
await test.step("the other sheet is there when the user goes to its workspace", async () => {
|
||||
await switchToWorkspace(page, first.workspaceId);
|
||||
await expect(sheet(page, "README.md")).toBeVisible();
|
||||
await expectOneSheetOpen(page);
|
||||
await closeSheet(page, "README.md");
|
||||
await expectNoSheetOpen(page);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,605 @@
|
||||
import { mkdir } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import type { Locator } from "@playwright/test";
|
||||
import { expect, test, type Page } from "../support/fixtures";
|
||||
import { expectAgentIdle, expectAgentReadyToInterrupt } from "../support/helpers/agent-stream";
|
||||
import {
|
||||
drillIntoProvider,
|
||||
expectComposerMode,
|
||||
expectComposerModel,
|
||||
openModelPicker,
|
||||
selectModelRow,
|
||||
} from "../support/helpers/agent-profiles";
|
||||
import { expectWorkspaceAgentConfiguration } from "../support/helpers/command-center-agent-controls";
|
||||
import {
|
||||
expectComposerVisible,
|
||||
expectQueuedMessageButton,
|
||||
submitMessage,
|
||||
submitMessageWithButton,
|
||||
} from "../support/helpers/composer";
|
||||
import { connectDaemonClient } from "../support/helpers/daemon-client-loader";
|
||||
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
|
||||
import { copyPluginExample } from "../support/helpers/plugin-fixture";
|
||||
import { userScrollsTimelineToHistoryStart } from "../support/helpers/timeline-pagination";
|
||||
|
||||
const DIRECT_PROVIDER = {
|
||||
id: "direct-example",
|
||||
label: "Direct provider example",
|
||||
pluginId: "provider-direct-example",
|
||||
modelId: "example-1",
|
||||
modelLabel: "Example 1",
|
||||
modeLabel: "Build",
|
||||
} as const;
|
||||
|
||||
// Disable external CLIs so the E2E host deterministically exposes only Mock +
|
||||
// the installed Direct provider plugin on both developer machines and CI.
|
||||
test.use({
|
||||
e2eDaemonConfig: {
|
||||
version: 1,
|
||||
agents: {
|
||||
providers: {
|
||||
claude: { enabled: false },
|
||||
codex: { enabled: false },
|
||||
copilot: { enabled: false },
|
||||
opencode: { enabled: false },
|
||||
pi: { enabled: false },
|
||||
omp: { enabled: false },
|
||||
antigravity: { enabled: false },
|
||||
hoplite: { enabled: false },
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
interface PluginInstallDaemonClient {
|
||||
connect(): Promise<void>;
|
||||
close(): Promise<void>;
|
||||
getDaemonConfig(): Promise<{ config: { pluginsEnabled?: boolean } }>;
|
||||
patchDaemonConfig(config: { pluginsEnabled?: boolean }): Promise<unknown>;
|
||||
installDirectoryPlugin(directory: string): Promise<unknown>;
|
||||
removePlugin(pluginId: string): Promise<void>;
|
||||
getProvidersSnapshot(): Promise<{
|
||||
entries: Array<{ provider: string; available?: boolean }>;
|
||||
}>;
|
||||
}
|
||||
|
||||
async function hasDirectProvider(client: PluginInstallDaemonClient): Promise<boolean> {
|
||||
const snapshot = await client.getProvidersSnapshot();
|
||||
return snapshot.entries.some((entry) => entry.provider === DIRECT_PROVIDER.id);
|
||||
}
|
||||
|
||||
async function expectSwitchMarkerCountAfterScroll(page: Page, expected: number): Promise<void> {
|
||||
await expect
|
||||
.poll(
|
||||
async () => {
|
||||
await userScrollsTimelineToHistoryStart(page);
|
||||
return await page.getByTestId("provider-switch-marker").count();
|
||||
},
|
||||
{ timeout: 30_000 },
|
||||
)
|
||||
.toBe(expected);
|
||||
}
|
||||
|
||||
async function captureQaScreenshot(page: Page, fileName: string): Promise<void> {
|
||||
const dir = process.env.PASEO_QA_SCREENSHOT_DIR?.trim();
|
||||
if (!dir) return;
|
||||
await mkdir(dir, { recursive: true });
|
||||
await page.screenshot({ path: path.join(dir, fileName), fullPage: false });
|
||||
}
|
||||
|
||||
async function expectNoHorizontalOverflow(page: Page): Promise<void> {
|
||||
const overflow = await page.evaluate(() => {
|
||||
const doc = document.documentElement;
|
||||
return Math.ceil(doc.scrollWidth - doc.clientWidth);
|
||||
});
|
||||
expect(overflow).toBeLessThanOrEqual(1);
|
||||
}
|
||||
|
||||
async function startSwitchOrderGuard(page: Page): Promise<void> {
|
||||
await page.evaluate(() => {
|
||||
const violations: string[] = [];
|
||||
let stopped = false;
|
||||
const step = () => {
|
||||
const msgs = Array.from(document.querySelectorAll('[data-testid="user-message"]'));
|
||||
const markers = Array.from(
|
||||
document.querySelectorAll('[data-testid="provider-switch-marker"]'),
|
||||
);
|
||||
const banner = document.querySelector('[data-testid="staged-provider-switch-banner"]');
|
||||
if (msgs.length >= 2) {
|
||||
const secondMsg = msgs[msgs.length - 1];
|
||||
const lastMarker = markers[markers.length - 1];
|
||||
if (!lastMarker) {
|
||||
violations.push("user-message painted without switch marker");
|
||||
} else {
|
||||
const msgRect = secondMsg.getBoundingClientRect();
|
||||
const markerRect = lastMarker.getBoundingClientRect();
|
||||
if (markerRect.top > msgRect.top) {
|
||||
violations.push(
|
||||
`switch marker painted below user-message (${Math.round(markerRect.top)} > ${Math.round(msgRect.top)})`,
|
||||
);
|
||||
}
|
||||
}
|
||||
if (banner && banner.getBoundingClientRect().height > 0) {
|
||||
violations.push("staged-provider-switch-banner stayed visible after submit");
|
||||
}
|
||||
}
|
||||
if (!stopped) requestAnimationFrame(step);
|
||||
};
|
||||
requestAnimationFrame(step);
|
||||
(window as unknown as { __stopSwitchOrderGuard?: () => string[] }).__stopSwitchOrderGuard =
|
||||
() => {
|
||||
stopped = true;
|
||||
return violations;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
async function stopSwitchOrderGuard(page: Page): Promise<string[]> {
|
||||
return await page.evaluate(
|
||||
() =>
|
||||
(
|
||||
window as unknown as { __stopSwitchOrderGuard?: () => string[] }
|
||||
).__stopSwitchOrderGuard?.() ?? [],
|
||||
);
|
||||
}
|
||||
|
||||
async function completeMockTurn(
|
||||
page: Page,
|
||||
agent: Awaited<ReturnType<typeof seedMockAgentWorkspace>>,
|
||||
prompt: string,
|
||||
): Promise<Locator> {
|
||||
await submitMessage(page, prompt);
|
||||
const userMessage = page.getByTestId("user-message").filter({ hasText: prompt });
|
||||
await expect(userMessage).toBeVisible({ timeout: 30_000 });
|
||||
const finish = await agent.client.waitForFinish(agent.agentId, 30_000);
|
||||
expect(finish.status).toBe("idle");
|
||||
await expectAgentIdle(page);
|
||||
await expect(userMessage).toHaveAttribute("aria-busy", "false");
|
||||
return userMessage;
|
||||
}
|
||||
|
||||
async function completeDirectTurn(
|
||||
page: Page,
|
||||
agent: Awaited<ReturnType<typeof seedMockAgentWorkspace>>,
|
||||
prompt: string,
|
||||
options?: { useSendButton?: boolean },
|
||||
): Promise<Locator> {
|
||||
if (options?.useSendButton) {
|
||||
await submitMessageWithButton(page, prompt);
|
||||
} else {
|
||||
await submitMessage(page, prompt);
|
||||
}
|
||||
const userMessage = page.getByTestId("user-message").filter({ hasText: prompt });
|
||||
await expect(userMessage).toBeVisible({ timeout: 30_000 });
|
||||
const finish = await agent.client.waitForFinish(agent.agentId, 30_000);
|
||||
expect(finish.status).toBe("idle");
|
||||
await expectAgentIdle(page);
|
||||
await expect(userMessage).toHaveAttribute("aria-busy", "false");
|
||||
return userMessage;
|
||||
}
|
||||
|
||||
async function stageProviderDesktop(
|
||||
page: Page,
|
||||
providerId: string,
|
||||
modelId: string,
|
||||
): Promise<void> {
|
||||
await openModelPicker(page);
|
||||
const picker = page.getByTestId("combobox-desktop-container");
|
||||
const backButton = picker.getByTestId("sheet-header-back");
|
||||
if (await backButton.isVisible()) {
|
||||
await backButton.click();
|
||||
}
|
||||
await drillIntoProvider(page, providerId);
|
||||
await selectModelRow(page, { provider: providerId, modelId });
|
||||
await expect(page.getByTestId("staged-provider-switch-banner")).toBeVisible({ timeout: 30_000 });
|
||||
}
|
||||
|
||||
async function stageDirectProviderDesktop(page: Page): Promise<void> {
|
||||
await stageProviderDesktop(page, DIRECT_PROVIDER.id, DIRECT_PROVIDER.modelId);
|
||||
}
|
||||
|
||||
async function stageDirectProviderCompact(page: Page): Promise<void> {
|
||||
await page.getByTestId("combined-model-selector").filter({ visible: true }).first().click();
|
||||
await expect(page.getByTestId("agent-controls-model")).toBeVisible({ timeout: 30_000 });
|
||||
await page.getByTestId("agent-controls-model").click();
|
||||
const modelPage = page.getByTestId("mobile-model-page");
|
||||
await expect(modelPage).toBeVisible({ timeout: 30_000 });
|
||||
const collapsedProvider = modelPage.getByTestId(`model-provider-${DIRECT_PROVIDER.id}`);
|
||||
if (await collapsedProvider.isVisible()) {
|
||||
await collapsedProvider.click();
|
||||
}
|
||||
await modelPage.getByTestId(`model-row-${DIRECT_PROVIDER.id}-${DIRECT_PROVIDER.modelId}`).click();
|
||||
await expect(page.getByTestId("agent-controls-settings-list")).toBeVisible({ timeout: 30_000 });
|
||||
// Dismiss the agent-controls sheet so the composer and banner are ready to submit.
|
||||
await page.getByRole("button", { name: "Close", exact: true }).last().click();
|
||||
await expect(page.getByTestId("agent-controls-model")).toHaveCount(0, { timeout: 30_000 });
|
||||
await expect(page.getByTestId("staged-provider-switch-banner")).toBeVisible({ timeout: 30_000 });
|
||||
}
|
||||
|
||||
async function rewindConversation(page: Page, userMessage: Locator, prompt: string): Promise<void> {
|
||||
await userMessage.getByText(prompt, { exact: true }).hover();
|
||||
await userMessage.getByRole("button", { name: "Rewind to this message", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "Rewind conversation", exact: true }).click();
|
||||
}
|
||||
|
||||
test.describe.serial("Provider switching in chat", () => {
|
||||
let pluginClient: PluginInstallDaemonClient;
|
||||
let pluginFixture: Awaited<ReturnType<typeof copyPluginExample>>;
|
||||
let previousPluginsEnabled: boolean | undefined;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
pluginClient = await connectDaemonClient<PluginInstallDaemonClient>({
|
||||
clientIdPrefix: "provider-switching-e2e",
|
||||
});
|
||||
pluginFixture = await copyPluginExample("provider-direct");
|
||||
previousPluginsEnabled = (await pluginClient.getDaemonConfig()).config.pluginsEnabled;
|
||||
await pluginClient.patchDaemonConfig({ pluginsEnabled: true });
|
||||
await pluginClient.installDirectoryPlugin(pluginFixture.directory);
|
||||
await expect.poll(() => hasDirectProvider(pluginClient), { timeout: 30_000 }).toBe(true);
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await pluginClient?.removePlugin(DIRECT_PROVIDER.pluginId).catch(() => undefined);
|
||||
await pluginClient
|
||||
?.patchDaemonConfig({ pluginsEnabled: previousPluginsEnabled })
|
||||
.catch(() => undefined);
|
||||
await pluginClient?.close().catch(() => undefined);
|
||||
await pluginFixture?.cleanup().catch(() => undefined);
|
||||
});
|
||||
|
||||
test("stages, cancels, switches providers, inspects marker, scopes rewind, and survives reload", async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(150_000);
|
||||
await page.setViewportSize({ width: 1280, height: 800 });
|
||||
|
||||
const preSwitchPrompt = "First prompt on Mock before switching.";
|
||||
const postSwitchPrompt = "Follow up on Direct provider after switching.";
|
||||
const postRewindPrompt = "Continue on Direct provider after rewinding.";
|
||||
|
||||
const workspace = await seedMockAgentWorkspace({
|
||||
repoPrefix: "provider-switch-desktop-",
|
||||
title: "Provider switch desktop",
|
||||
model: "e2e-fast-stream",
|
||||
modeId: "load-test",
|
||||
});
|
||||
|
||||
try {
|
||||
await openAgentRoute(page, workspace);
|
||||
await expectComposerVisible(page);
|
||||
await expectComposerMode(page, "Load test");
|
||||
|
||||
const initialUrl = page.url();
|
||||
await completeMockTurn(page, workspace, preSwitchPrompt);
|
||||
|
||||
await test.step("staging updates only draft state and Cancel restores the live provider", async () => {
|
||||
await stageDirectProviderDesktop(page);
|
||||
await expectComposerModel(page, DIRECT_PROVIDER.modelLabel);
|
||||
await expectComposerMode(page, DIRECT_PROVIDER.modeLabel);
|
||||
await expect(page.getByTestId("staged-provider-switch-banner")).toContainText(
|
||||
DIRECT_PROVIDER.label,
|
||||
);
|
||||
await expectWorkspaceAgentConfiguration(workspace, {
|
||||
id: workspace.agentId,
|
||||
provider: "mock",
|
||||
model: "e2e-fast-stream",
|
||||
modeId: "load-test",
|
||||
});
|
||||
// Editing a staged provider option must keep all staged option controls visible.
|
||||
const conciseToggle = page.getByRole("button", { name: /Concise responses/i }).first();
|
||||
const voiceSelect = page.getByRole("button", { name: /Voice/i }).first();
|
||||
await expect(conciseToggle).toBeVisible();
|
||||
await expect(voiceSelect).toBeVisible();
|
||||
await conciseToggle.click();
|
||||
await expect(conciseToggle).toBeVisible();
|
||||
await expect(voiceSelect).toBeVisible();
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await captureQaScreenshot(page, "desktop-staged-switch.png");
|
||||
|
||||
await page.getByTestId("cancel-staged-provider-switch").click();
|
||||
await expect(page.getByTestId("staged-provider-switch-banner")).toHaveCount(0);
|
||||
await expectComposerMode(page, "Load test");
|
||||
|
||||
// Returning to the live provider by choosing a different model clears the staged switch
|
||||
// and applies the newly chosen model directly to the live provider.
|
||||
await stageDirectProviderDesktop(page);
|
||||
await openModelPicker(page);
|
||||
const picker = page.getByTestId("combobox-desktop-container");
|
||||
const backButton = picker.getByTestId("sheet-header-back");
|
||||
if (await backButton.isVisible()) {
|
||||
await backButton.click();
|
||||
}
|
||||
await drillIntoProvider(page, "mock");
|
||||
await selectModelRow(page, { provider: "mock", modelId: "one-minute-stream" });
|
||||
await expect(page.getByTestId("staged-provider-switch-banner")).toHaveCount(0);
|
||||
await expectComposerModel(page, "One minute stream");
|
||||
await expectWorkspaceAgentConfiguration(workspace, {
|
||||
id: workspace.agentId,
|
||||
provider: "mock",
|
||||
model: "one-minute-stream",
|
||||
modeId: "load-test",
|
||||
});
|
||||
});
|
||||
|
||||
await test.step("submitting commits the switch in place with clean user display text and inspectable marker", async () => {
|
||||
await stageDirectProviderDesktop(page);
|
||||
await startSwitchOrderGuard(page);
|
||||
const switchedMessage = await completeDirectTurn(page, workspace, postSwitchPrompt);
|
||||
expect(await stopSwitchOrderGuard(page)).toEqual([]);
|
||||
|
||||
expect(page.url()).toBe(initialUrl);
|
||||
await expect(page.getByTestId("staged-provider-switch-banner")).toHaveCount(0);
|
||||
await expectWorkspaceAgentConfiguration(workspace, {
|
||||
id: workspace.agentId,
|
||||
provider: DIRECT_PROVIDER.id,
|
||||
model: DIRECT_PROVIDER.modelId,
|
||||
modeId: "build",
|
||||
});
|
||||
|
||||
// Clean display text: handoff summary must never leak into the visible user bubble.
|
||||
await expect(switchedMessage).toContainText(postSwitchPrompt);
|
||||
await expect(switchedMessage).not.toContainText("<chat-history-summary>");
|
||||
|
||||
// Direct provider echoes its prompt, proving bounded pre-switch context was attached.
|
||||
const directReply = page
|
||||
.getByTestId("assistant-message")
|
||||
.filter({ hasText: "Echo:" })
|
||||
.last();
|
||||
await expect(directReply).toContainText(preSwitchPrompt);
|
||||
await expect(directReply).toContainText(postSwitchPrompt);
|
||||
|
||||
// Switch marker is visible and expands to show context handoff details.
|
||||
const marker = page.getByTestId("provider-switch-marker");
|
||||
await expect(marker).toBeVisible({ timeout: 30_000 });
|
||||
await marker.scrollIntoViewIfNeeded();
|
||||
await marker.getByTestId("provider-switch-marker-toggle").click();
|
||||
const details = marker.getByTestId("provider-switch-marker-details");
|
||||
await expect(details).toBeVisible();
|
||||
await expect(details).toContainText("Mock");
|
||||
await expect(details).toContainText(DIRECT_PROVIDER.label);
|
||||
await marker.scrollIntoViewIfNeeded();
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await captureQaScreenshot(page, "desktop-switched-expanded.png");
|
||||
await marker.getByTestId("provider-switch-marker-toggle").click();
|
||||
await expect(details).toHaveCount(0);
|
||||
});
|
||||
|
||||
await test.step("switching back to Mock enforces segment-scoped rewind and preserves pre-switch turns", async () => {
|
||||
const backToMockPrompt = "Switch back to Mock for segment-scoped rewind.";
|
||||
await stageProviderDesktop(page, "mock", "ten-second-stream");
|
||||
await expect(page.getByTestId("staged-provider-switch-banner")).toContainText("Mock");
|
||||
|
||||
const backToMockMessage = await completeMockTurn(page, workspace, backToMockPrompt);
|
||||
await expect(backToMockMessage).not.toContainText("<chat-history-summary>");
|
||||
await expect(page.getByTestId("provider-switch-marker")).toHaveCount(2, {
|
||||
timeout: 30_000,
|
||||
});
|
||||
await expectWorkspaceAgentConfiguration(workspace, {
|
||||
id: workspace.agentId,
|
||||
provider: "mock",
|
||||
model: "ten-second-stream",
|
||||
modeId: "load-test",
|
||||
});
|
||||
|
||||
// Pre-switch prompts from earlier segments must not expose rewind even though Mock supports it.
|
||||
const preSwitchMessage = page
|
||||
.getByTestId("user-message")
|
||||
.filter({ hasText: preSwitchPrompt });
|
||||
await preSwitchMessage.scrollIntoViewIfNeeded();
|
||||
await preSwitchMessage.getByText(preSwitchPrompt, { exact: true }).hover();
|
||||
await expect(
|
||||
preSwitchMessage.getByRole("button", { name: "Rewind to this message", exact: true }),
|
||||
).toHaveCount(0);
|
||||
|
||||
const directMessage = page
|
||||
.getByTestId("user-message")
|
||||
.filter({ hasText: postSwitchPrompt });
|
||||
await directMessage.scrollIntoViewIfNeeded();
|
||||
await directMessage.getByText(postSwitchPrompt, { exact: true }).hover();
|
||||
await expect(
|
||||
directMessage.getByRole("button", { name: "Rewind to this message", exact: true }),
|
||||
).toHaveCount(0);
|
||||
|
||||
// Post-switch prompt on Mock CAN rewind without retiring earlier segments or markers.
|
||||
await backToMockMessage.scrollIntoViewIfNeeded();
|
||||
await rewindConversation(page, backToMockMessage, backToMockPrompt);
|
||||
await expect(
|
||||
page.getByTestId("user-message").filter({ hasText: backToMockPrompt }),
|
||||
).toHaveCount(0, { timeout: 30_000 });
|
||||
await expect(
|
||||
page.getByTestId("user-message").filter({ hasText: preSwitchPrompt }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByTestId("user-message").filter({ hasText: postSwitchPrompt }),
|
||||
).toBeVisible();
|
||||
await expect(page.getByTestId("provider-switch-marker")).toHaveCount(2);
|
||||
|
||||
// Continuing in the now-empty active segment completes cleanly.
|
||||
const retriedMessage = await completeMockTurn(page, workspace, postRewindPrompt);
|
||||
await expect(retriedMessage).not.toContainText("<chat-history-summary>");
|
||||
});
|
||||
|
||||
await test.step("reload preserves the switched provider, markers, and rewind boundary", async () => {
|
||||
await page.reload();
|
||||
await expectComposerVisible(page);
|
||||
await expectComposerModel(page, "Ten second stream");
|
||||
await expectSwitchMarkerCountAfterScroll(page, 2);
|
||||
const reloadedDirect = page
|
||||
.getByTestId("user-message")
|
||||
.filter({ hasText: postSwitchPrompt });
|
||||
await expect(reloadedDirect).toBeVisible();
|
||||
await expect(
|
||||
page.getByTestId("user-message").filter({ hasText: postRewindPrompt }),
|
||||
).toBeVisible();
|
||||
|
||||
await reloadedDirect.scrollIntoViewIfNeeded();
|
||||
await reloadedDirect.getByText(postSwitchPrompt, { exact: true }).hover();
|
||||
await expect(
|
||||
reloadedDirect.getByRole("button", { name: "Rewind to this message", exact: true }),
|
||||
).toHaveCount(0);
|
||||
});
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("stages a switch mid-turn, queues the prompt, and switches cleanly between turns", async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(150_000);
|
||||
await page.setViewportSize({ width: 1280, height: 800 });
|
||||
|
||||
const runningPrompt = "Run a ten-second mock turn first.";
|
||||
const queuedPrompt = "Queued handoff prompt for Direct provider.";
|
||||
|
||||
const workspace = await seedMockAgentWorkspace({
|
||||
repoPrefix: "provider-switch-midturn-",
|
||||
title: "Provider switch midturn",
|
||||
model: "ten-second-stream",
|
||||
modeId: "load-test",
|
||||
});
|
||||
|
||||
try {
|
||||
await openAgentRoute(page, workspace);
|
||||
await expectComposerVisible(page);
|
||||
|
||||
await submitMessage(page, runningPrompt);
|
||||
await expectAgentReadyToInterrupt(page);
|
||||
|
||||
// Stage Direct provider while Mock is actively streaming.
|
||||
await stageDirectProviderDesktop(page);
|
||||
await expectWorkspaceAgentConfiguration(workspace, {
|
||||
id: workspace.agentId,
|
||||
provider: "mock",
|
||||
model: "ten-second-stream",
|
||||
modeId: "load-test",
|
||||
});
|
||||
|
||||
// Submitting queues the prompt instead of racing the live turn.
|
||||
await submitMessage(page, queuedPrompt);
|
||||
await expectQueuedMessageButton(page);
|
||||
|
||||
// Once the mock turn completes, the queue drains and commits the switch.
|
||||
await expect(page.getByTestId("provider-switch-marker")).toBeVisible({ timeout: 45_000 });
|
||||
await expect(page.getByTestId("staged-provider-switch-banner")).toHaveCount(0, {
|
||||
timeout: 30_000,
|
||||
});
|
||||
await expect(
|
||||
page.getByTestId("assistant-message").filter({ hasText: queuedPrompt }).last(),
|
||||
).toBeVisible({ timeout: 30_000 });
|
||||
await expectAgentIdle(page);
|
||||
await expectWorkspaceAgentConfiguration(workspace, {
|
||||
id: workspace.agentId,
|
||||
provider: DIRECT_PROVIDER.id,
|
||||
model: DIRECT_PROVIDER.modelId,
|
||||
modeId: "build",
|
||||
});
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("edits a queued switch and sends it now, cutting the running turn", async ({ page }) => {
|
||||
test.setTimeout(150_000);
|
||||
await page.setViewportSize({ width: 1280, height: 800 });
|
||||
|
||||
const queuedPrompt = "Take over now on the Direct provider.";
|
||||
const workspace = await seedMockAgentWorkspace({
|
||||
repoPrefix: "provider-switch-queued-edit-",
|
||||
title: "Provider switch queued edit",
|
||||
model: "one-minute-stream",
|
||||
modeId: "load-test",
|
||||
});
|
||||
|
||||
try {
|
||||
await openAgentRoute(page, workspace);
|
||||
await expectComposerVisible(page);
|
||||
await submitMessage(page, "Run a one-minute mock turn first.");
|
||||
await expectAgentReadyToInterrupt(page);
|
||||
await stageDirectProviderDesktop(page);
|
||||
|
||||
const banner = page.getByTestId("staged-provider-switch-banner");
|
||||
const queuedRow = page.getByRole("listitem").filter({ hasText: queuedPrompt });
|
||||
await submitMessage(page, queuedPrompt);
|
||||
await expect(queuedRow).toContainText(`Switches to ${DIRECT_PROVIDER.label}`);
|
||||
await expect(banner).toHaveCount(0);
|
||||
await captureQaScreenshot(page, "queued-provider-switch.png");
|
||||
|
||||
await queuedRow.getByRole("button", { name: "Edit queued message" }).click();
|
||||
await expect(queuedRow).toHaveCount(0);
|
||||
await expect(banner).toBeVisible();
|
||||
|
||||
await submitMessage(page, queuedPrompt);
|
||||
await expect(queuedRow).toContainText(`Switches to ${DIRECT_PROVIDER.label}`);
|
||||
await queuedRow.getByRole("button", { name: "Send queued message now" }).click();
|
||||
|
||||
await expect(page.getByTestId("provider-switch-marker")).toBeVisible({ timeout: 30_000 });
|
||||
await expect(
|
||||
page.getByTestId("assistant-message").filter({ hasText: queuedPrompt }).last(),
|
||||
).toBeVisible({ timeout: 30_000 });
|
||||
await expectAgentIdle(page);
|
||||
await expectWorkspaceAgentConfiguration(workspace, {
|
||||
id: workspace.agentId,
|
||||
provider: DIRECT_PROVIDER.id,
|
||||
model: DIRECT_PROVIDER.modelId,
|
||||
modeId: "build",
|
||||
});
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("switches providers cleanly on a compact viewport with zero horizontal overflow", async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(150_000);
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
|
||||
const preSwitchPrompt = "Compact turn on Mock.";
|
||||
const postSwitchPrompt = "Compact handoff on Direct.";
|
||||
|
||||
const workspace = await seedMockAgentWorkspace({
|
||||
repoPrefix: "provider-switch-compact-",
|
||||
title: "Provider switch compact",
|
||||
model: "e2e-fast-stream",
|
||||
modeId: "load-test",
|
||||
});
|
||||
|
||||
try {
|
||||
await openAgentRoute(page, workspace);
|
||||
await expectComposerVisible(page);
|
||||
|
||||
await submitMessageWithButton(page, preSwitchPrompt);
|
||||
await expect(
|
||||
page.getByTestId("user-message").filter({ hasText: preSwitchPrompt }),
|
||||
).toBeVisible({ timeout: 30_000 });
|
||||
const firstFinish = await workspace.client.waitForFinish(workspace.agentId, 30_000);
|
||||
expect(firstFinish.status).toBe("idle");
|
||||
await expectAgentIdle(page);
|
||||
|
||||
await stageDirectProviderCompact(page);
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await captureQaScreenshot(page, "compact-staged-switch.png");
|
||||
|
||||
const switchedMessage = await completeDirectTurn(page, workspace, postSwitchPrompt, {
|
||||
useSendButton: true,
|
||||
});
|
||||
await expect(switchedMessage).not.toContainText("<chat-history-summary>");
|
||||
|
||||
const marker = page.getByTestId("provider-switch-marker");
|
||||
await expect(marker).toBeVisible({ timeout: 30_000 });
|
||||
await marker.scrollIntoViewIfNeeded();
|
||||
const toggle = marker.getByTestId("provider-switch-marker-toggle");
|
||||
const toggleBox = await toggle.boundingBox();
|
||||
expect(toggleBox).not.toBeNull();
|
||||
expect((toggleBox?.x ?? 0) + (toggleBox?.width ?? 0)).toBeLessThanOrEqual(390);
|
||||
await toggle.click();
|
||||
await expect(marker.getByTestId("provider-switch-marker-details")).toBeVisible();
|
||||
await marker.scrollIntoViewIfNeeded();
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await captureQaScreenshot(page, "compact-switched-expanded.png");
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -235,7 +235,7 @@ test.describe("Rewind sheet", () => {
|
||||
await expect(page.getByTestId("rewind-menu-content")).toHaveCount(0);
|
||||
await expect(userMessage(page, secondPrompt)).toHaveCount(0);
|
||||
await expect(page.getByText("Cycle 1", { exact: true })).toHaveCount(0);
|
||||
await expectUserMessageCount(page, 1);
|
||||
await expectUserMessageCount(page, 0);
|
||||
await expectComposerDraft(page, firstPrompt);
|
||||
await expectComposerFocused(page);
|
||||
|
||||
@@ -243,7 +243,7 @@ test.describe("Rewind sheet", () => {
|
||||
await expectUserMessageVisible(page, replacementPrompt);
|
||||
await expect(userMessage(page, secondPrompt)).toHaveCount(0);
|
||||
await expect(page.getByText("Cycle 1", { exact: true })).toHaveCount(0);
|
||||
await expectUserMessageCount(page, 2);
|
||||
await expectUserMessageCount(page, 1);
|
||||
|
||||
await fillComposerDraft(page, "");
|
||||
await composerLocator(page).evaluate((element) => element.blur());
|
||||
@@ -254,7 +254,19 @@ test.describe("Rewind sheet", () => {
|
||||
await expect(page.getByTestId("rewind-menu-content")).toHaveCount(0);
|
||||
await expectComposerDraft(page, "");
|
||||
await expectComposerNotFocused(page);
|
||||
await expectUserMessageCount(page, 2);
|
||||
await expectUserMessageCount(page, 1);
|
||||
|
||||
const preservedDraft = "Keep this human draft after rewind.";
|
||||
await fillComposerDraft(page, preservedDraft);
|
||||
await composerLocator(page).evaluate((element) => element.blur());
|
||||
await userMessage(page, replacementPrompt).hover();
|
||||
await page.getByTestId("rewind-menu-trigger").last().click();
|
||||
await expect(page.getByTestId("rewind-menu-content")).toBeVisible();
|
||||
await selectRewindOption(page, "Rewind files");
|
||||
await expect(page.getByTestId("rewind-menu-content")).toHaveCount(0);
|
||||
await expectComposerDraft(page, preservedDraft);
|
||||
await expectComposerNotFocused(page);
|
||||
await expectUserMessageCount(page, 1);
|
||||
|
||||
await fillComposerDraft(page, "");
|
||||
await composerLocator(page).evaluate((element) => element.blur());
|
||||
@@ -265,7 +277,7 @@ test.describe("Rewind sheet", () => {
|
||||
await expect(page.getByTestId("rewind-menu-content")).toHaveCount(0);
|
||||
await expectComposerDraft(page, replacementPrompt);
|
||||
await expectComposerFocused(page);
|
||||
await expectUserMessageCount(page, 1);
|
||||
await expectUserMessageCount(page, 0);
|
||||
} finally {
|
||||
await session.cleanup();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { createServer, type Socket } from "node:net";
|
||||
import { expect, test, type Page } from "../support/fixtures";
|
||||
import { gotoAppShell } from "../support/helpers/app";
|
||||
import { addScheduleHostAndReload, createScheduleHost } from "../support/helpers/schedule-host";
|
||||
@@ -141,6 +142,68 @@ async function findScheduleIdByName(workspace: SeededWorkspace, name: string): P
|
||||
return schedule.id;
|
||||
}
|
||||
|
||||
async function createConnectingHost() {
|
||||
const sockets = new Set<Socket>();
|
||||
// Accept TCP without completing the WebSocket handshake, like a stalled host.
|
||||
const server = createServer((socket) => {
|
||||
sockets.add(socket);
|
||||
socket.on("close", () => sockets.delete(socket));
|
||||
});
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
server.once("error", reject);
|
||||
server.listen(0, "127.0.0.1", resolve);
|
||||
});
|
||||
const address = server.address();
|
||||
if (!address || typeof address === "string") throw new Error("Expected a TCP address");
|
||||
return {
|
||||
port: address.port,
|
||||
close: async () => {
|
||||
for (const socket of sockets) socket.destroy();
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
server.close((error) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async function openSchedulesWithConnectingHost(
|
||||
page: Page,
|
||||
cleanupTasks: Array<() => Promise<void>>,
|
||||
): Promise<void> {
|
||||
const workspace = await seedWorkspace({ repoPrefix: "schedule-partial-hosts-", git: false });
|
||||
cleanupTasks.push(() => workspace.cleanup());
|
||||
const stalledHost = await createConnectingHost();
|
||||
cleanupTasks.push(() => stalledHost.close());
|
||||
|
||||
await gotoAppShell(page);
|
||||
await waitForSidebarHydration(page);
|
||||
await page.goto(buildSchedulesRoute());
|
||||
await addScheduleHostAndReload({
|
||||
page,
|
||||
serverId: "stalled-schedule-host",
|
||||
label: "Connecting host",
|
||||
port: stalledHost.port,
|
||||
});
|
||||
}
|
||||
|
||||
async function expectPartialEmptySchedules(page: Page): Promise<void> {
|
||||
await expect(page.getByText("No active schedules", { exact: true })).toBeVisible();
|
||||
await expect(page.getByText("Connecting host: Still connecting", { exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("button", { name: "New schedule", exact: true })).toBeVisible();
|
||||
}
|
||||
|
||||
async function expectScheduleCreationAvailable(page: Page): Promise<void> {
|
||||
await openNewScheduleSheet(page);
|
||||
await page.getByRole("button", { name: "Cancel", exact: true }).click();
|
||||
await expect(page.getByTestId("schedule-form-sheet")).toHaveCount(0);
|
||||
}
|
||||
|
||||
test.describe("Schedules project target", () => {
|
||||
const cleanupTasks: Array<() => Promise<void>> = [];
|
||||
|
||||
@@ -151,6 +214,12 @@ test.describe("Schedules project target", () => {
|
||||
cleanupTasks.length = 0;
|
||||
});
|
||||
|
||||
test("shows empty schedules while another host is still connecting", async ({ page }) => {
|
||||
await openSchedulesWithConnectingHost(page, cleanupTasks);
|
||||
await expectPartialEmptySchedules(page);
|
||||
await expectScheduleCreationAvailable(page);
|
||||
});
|
||||
|
||||
test("dismisses the new schedule sheet without reopening", async ({ page }) => {
|
||||
const workspace = await seedWorkspace({ repoPrefix: "schedule-sheet-dismiss-", git: false });
|
||||
cleanupTasks.push(() => workspace.cleanup());
|
||||
|
||||
@@ -35,7 +35,13 @@ import {
|
||||
expectSettingsHeader,
|
||||
openAddHostFlow,
|
||||
selectHostConnectionType,
|
||||
toggleHostAdvanced,
|
||||
selectDirectConnectionMode,
|
||||
expectDirectConnectionMode,
|
||||
expectDirectFormModeDisabled,
|
||||
connectDirectHost,
|
||||
connectDirectHostExpectingPassword,
|
||||
pasteIntoDirectHost,
|
||||
fillDirectHostPromptPassword,
|
||||
openCompactSettings,
|
||||
expectCompactSettingsList,
|
||||
expectSettingsSidebarVisible,
|
||||
@@ -50,11 +56,11 @@ import {
|
||||
fillDirectHostUri,
|
||||
expectDirectHostFormValues,
|
||||
expectDirectHostSslEnabled,
|
||||
expectDirectHostSslDisabled,
|
||||
fillDirectHostAddress,
|
||||
toggleDirectHostSsl,
|
||||
expectDirectHostUriValue,
|
||||
expectDirectHostUriHidden,
|
||||
expectDirectFormFullyVisible,
|
||||
expectDiagnosticsContent,
|
||||
expectAboutContent,
|
||||
expectGeneralContent,
|
||||
@@ -71,6 +77,7 @@ import {
|
||||
bindCommandCenterToEnter,
|
||||
} from "../support/helpers/settings";
|
||||
import { getServerId } from "../support/helpers/server-id";
|
||||
import { startIsolatedHostDaemon } from "../support/helpers/isolated-host-daemon";
|
||||
import { expectAppRoute } from "../support/helpers/route-assertions";
|
||||
import { clickNewChat, gotoWorkspace } from "../support/helpers/launcher";
|
||||
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
|
||||
@@ -327,44 +334,105 @@ test.describe("Settings sidebar navigation", () => {
|
||||
await verifyLegacyHostSettingsRedirect(page);
|
||||
});
|
||||
|
||||
test("direct connection advanced URI round-trips SSL and password into the form", async ({
|
||||
page,
|
||||
}) => {
|
||||
test("direct connection converts between Form and URI modes", async ({ page }) => {
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await openAddHostFlow(page);
|
||||
await expectAddHostMethodOptions(page);
|
||||
await selectHostConnectionType(page, "direct");
|
||||
await expectDirectConnectionMode(page, "Form");
|
||||
|
||||
await fillDirectHostAddress(page, "example.paseo.test", "7443");
|
||||
await expectDirectHostSslDisabled(page);
|
||||
await toggleDirectHostSsl(page);
|
||||
await expectDirectHostSslEnabled(page);
|
||||
await toggleHostAdvanced(page);
|
||||
await expectDirectHostUriValue(page, "tcp://example.paseo.test:7443?ssl=true");
|
||||
await toggleHostAdvanced(page);
|
||||
await toggleDirectHostSsl(page);
|
||||
await expectDirectHostSslDisabled(page);
|
||||
|
||||
await toggleHostAdvanced(page);
|
||||
await fillDirectHostUri(page, "tcp://example.paseo.test:7443?ssl=true&password=shared-secret");
|
||||
await toggleHostAdvanced(page);
|
||||
|
||||
await expectDirectHostFormValues(page, {
|
||||
host: "example.paseo.test",
|
||||
port: "7443",
|
||||
password: "shared-secret",
|
||||
await test.step("Form fields become a URI", async () => {
|
||||
await fillDirectHostAddress(page, "example.paseo.test", "7443");
|
||||
await toggleDirectHostSsl(page);
|
||||
await selectDirectConnectionMode(page, "URI");
|
||||
await expectDirectHostUriValue(page, "tcp://example.paseo.test:7443?ssl=true");
|
||||
});
|
||||
await expectDirectHostSslEnabled(page);
|
||||
await expectDirectHostUriHidden(page);
|
||||
|
||||
await toggleHostAdvanced(page);
|
||||
await expectDirectHostUriValue(
|
||||
page,
|
||||
"tcp://example.paseo.test:7443?ssl=true&password=shared-secret",
|
||||
);
|
||||
await toggleHostAdvanced(page);
|
||||
await expectDirectHostUriHidden(page);
|
||||
await test.step("a URI becomes Form fields", async () => {
|
||||
await fillDirectHostUri(
|
||||
page,
|
||||
"tcp://example.paseo.test:7443?ssl=true&password=shared-secret",
|
||||
);
|
||||
await selectDirectConnectionMode(page, "Form");
|
||||
await expectDirectHostFormValues(page, {
|
||||
host: "example.paseo.test",
|
||||
port: "7443",
|
||||
password: "shared-secret",
|
||||
});
|
||||
await expectDirectHostSslEnabled(page);
|
||||
await expectDirectHostUriHidden(page);
|
||||
});
|
||||
|
||||
await test.step("a pairing link pasted into Host stays a URI", async () => {
|
||||
const link = "relay://relay.paseo.test:443/srv_e2e_pairing?key=daemon-key&ssl=true";
|
||||
await pasteIntoDirectHost(page, link);
|
||||
await expectDirectConnectionMode(page, "URI");
|
||||
await expectDirectHostUriValue(page, link);
|
||||
await expectDirectFormModeDisabled(page);
|
||||
});
|
||||
});
|
||||
|
||||
test("direct connection connects to a URI with Host blank", async ({ page }) => {
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await openAddHostFlow(page);
|
||||
await selectHostConnectionType(page, "direct");
|
||||
|
||||
await selectDirectConnectionMode(page, "URI");
|
||||
await fillDirectHostUri(page, `tcp://127.0.0.1:${getE2EDaemonPort()}`);
|
||||
|
||||
await connectDirectHost(page);
|
||||
});
|
||||
|
||||
test("direct connection connects to an edited URI instead of the form", async ({ page }) => {
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await openAddHostFlow(page);
|
||||
await selectHostConnectionType(page, "direct");
|
||||
|
||||
await fillDirectHostAddress(page, "127.0.0.1", "9");
|
||||
await selectDirectConnectionMode(page, "URI");
|
||||
await expectDirectHostUriValue(page, "tcp://127.0.0.1:9");
|
||||
await fillDirectHostUri(page, `tcp://127.0.0.1:${getE2EDaemonPort()}`);
|
||||
|
||||
await connectDirectHost(page);
|
||||
});
|
||||
|
||||
test("direct connection sends the password in a URI and asks again when it is wrong", async ({
|
||||
page,
|
||||
}) => {
|
||||
const password = "e2e uri password";
|
||||
const daemon = await startIsolatedHostDaemon("srv_e2e_uri_password_host", {
|
||||
environment: { ...process.env, PASEO_PASSWORD: password },
|
||||
});
|
||||
try {
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
|
||||
await test.step("a URI with the password connects with one tap", async () => {
|
||||
await openAddHostFlow(page);
|
||||
await selectHostConnectionType(page, "direct");
|
||||
await selectDirectConnectionMode(page, "URI");
|
||||
await fillDirectHostUri(
|
||||
page,
|
||||
`tcp://127.0.0.1:${daemon.port}?password=${encodeURIComponent(password)}`,
|
||||
);
|
||||
await connectDirectHost(page);
|
||||
});
|
||||
|
||||
await test.step("a wrong password asks for the host's password inline", async () => {
|
||||
await openAddHostFlow(page);
|
||||
await selectHostConnectionType(page, "direct");
|
||||
await selectDirectConnectionMode(page, "URI");
|
||||
await fillDirectHostUri(page, `tcp://127.0.0.1:${daemon.port}?password=wrong`);
|
||||
await connectDirectHostExpectingPassword(page, `127.0.0.1:${daemon.port}`);
|
||||
await fillDirectHostPromptPassword(page, password);
|
||||
await connectDirectHost(page);
|
||||
});
|
||||
} finally {
|
||||
await daemon.close();
|
||||
}
|
||||
});
|
||||
|
||||
test("Escape lets settings dropdowns and modals close before leaving settings", async ({
|
||||
@@ -697,3 +765,16 @@ test("docked navigation keeps its density and Settings preserves reading width",
|
||||
await expectSettingsSidebarHidden(page);
|
||||
await expectAppearanceContent(page);
|
||||
});
|
||||
|
||||
test.describe("Settings — small phone", () => {
|
||||
test.use({ viewport: { width: 360, height: 640 } });
|
||||
|
||||
test("direct connection shows the whole form above Cancel and Connect", async ({ page }) => {
|
||||
await gotoAppShell(page);
|
||||
await openCompactSidebar(page);
|
||||
await openSettingsFromCompactSidebar(page);
|
||||
await openAddHostFlow(page);
|
||||
await selectHostConnectionType(page, "direct");
|
||||
await expectDirectFormFullyVisible(page);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -118,10 +118,14 @@ test("projects and pinned chats reorder while ordinary workspaces stay newest fi
|
||||
await firstProject.client.setWorkspacePinned(firstProject.workspaceId, true);
|
||||
await secondProject.client.setWorkspacePinned(secondProject.workspaceId, true);
|
||||
const secondProjectWorkspaceTestId = `sidebar-workspace-row-${getServerId()}:${secondProject.workspaceId}`;
|
||||
// Both rows also exist in their project groups, so match them only once each pin has
|
||||
// moved its row into the Pinned section.
|
||||
await quickDragFirstRowAfterSecond(
|
||||
page.locator(
|
||||
`[data-testid="${firstWorkspaceTestId}"], [data-testid="${secondProjectWorkspaceTestId}"]`,
|
||||
),
|
||||
page
|
||||
.getByTestId("sidebar-pinned-section")
|
||||
.locator(
|
||||
`[data-testid="${firstWorkspaceTestId}"], [data-testid="${secondProjectWorkspaceTestId}"]`,
|
||||
),
|
||||
pressWorkspaceRow,
|
||||
);
|
||||
} finally {
|
||||
|
||||
@@ -392,6 +392,8 @@ test.describe("Terminal protocol queries", () => {
|
||||
await terminalSurface(page).click();
|
||||
await terminalSurface(page).pressSequentially("Q", { delay: 0 });
|
||||
await expectTerminalOutput(lightTerminalId, "WATCH2031_DONE");
|
||||
// One report per switch: a second responder would deliver each switch twice.
|
||||
expect(watch2031Events(await terminalOutput(lightTerminalId))).toEqual(["1", "2"]);
|
||||
|
||||
await selectAppThemeInApp(page, "Dark");
|
||||
await runPaletteChecks(lightTerminalId, TERMINAL_PALETTE_SCENARIOS.dark, {
|
||||
@@ -428,6 +430,10 @@ test.describe("Terminal protocol queries", () => {
|
||||
return capture.lines.join("").replace(/\s/g, "");
|
||||
}
|
||||
|
||||
function watch2031Events(output: string): string[] {
|
||||
return [...output.matchAll(/WATCH2031_EVENT:([12])/g)].map(([, scheme]) => scheme);
|
||||
}
|
||||
|
||||
async function expectTerminalOutput(terminalId: string, text: string): Promise<void> {
|
||||
await expect.poll(() => terminalOutput(terminalId), { timeout: 10_000 }).toContain(text);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ import { installDaemonWebSocketGate } from "../support/helpers/daemon-websocket-
|
||||
import { addConnectedHostAndReload, addOfflineHostAndReload } from "../support/helpers/hosts";
|
||||
import { startIsolatedHostDaemon } from "../support/helpers/isolated-host-daemon";
|
||||
|
||||
const LOADING_WORKSPACE_TEXT_PATTERN = /Loading workspace/i;
|
||||
const LOADING_WORKSPACE_TEST_ID = "workspace-loading";
|
||||
async function expectNoLoadingWorkspacePane(
|
||||
page: Page,
|
||||
input: { label: string; durationMs?: number },
|
||||
@@ -63,7 +63,7 @@ async function expectNoLoadingWorkspacePane(
|
||||
.catch((error) => `[body unavailable: ${error instanceof Error ? error.message : error}]`);
|
||||
samples.push(`${Date.now() - startedAt}ms ${url}\n${text.slice(0, 1000)}`);
|
||||
|
||||
if (LOADING_WORKSPACE_TEXT_PATTERN.test(text)) {
|
||||
if ((await page.getByTestId(LOADING_WORKSPACE_TEST_ID).count()) > 0) {
|
||||
throw new Error(
|
||||
`${input.label}: loading workspace pane appeared during reconnect window.\n\n${samples.join(
|
||||
"\n\n---\n\n",
|
||||
@@ -76,7 +76,7 @@ async function expectNoLoadingWorkspacePane(
|
||||
}
|
||||
|
||||
async function expectNoLoadingPane(page: Page): Promise<void> {
|
||||
await expect(page.getByText(LOADING_WORKSPACE_TEXT_PATTERN)).toHaveCount(0);
|
||||
await expect(page.getByTestId(LOADING_WORKSPACE_TEST_ID)).toHaveCount(0);
|
||||
}
|
||||
|
||||
async function getVisibleDraftTabCount(page: Page): Promise<number> {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { BuiltinPluginLoader } from "../../../../server/src/server/plugins/builtin/index.js";
|
||||
import { createTestPaseoDaemon } from "../../../../server/src/server/test-utils/paseo-daemon.js";
|
||||
import { DaemonClient } from "../../../../server/src/server/test-utils/daemon-client.js";
|
||||
import assert from "node:assert/strict";
|
||||
import pino from "pino";
|
||||
|
||||
const [, , root, origin, paseoHomeRoot, daemonVersion] = process.argv;
|
||||
|
||||
const daemon = await createTestPaseoDaemon({
|
||||
corsAllowedOrigins: [origin!],
|
||||
paseoHomeRoot,
|
||||
daemonVersion,
|
||||
logger: pino({ level: "error" }),
|
||||
builtinPlugins: new BuiltinPluginLoader(root, ["builtin-settings"]),
|
||||
});
|
||||
const client = new DaemonClient({
|
||||
appVersion: daemonVersion,
|
||||
url: `ws://127.0.0.1:${daemon.port}/ws`,
|
||||
});
|
||||
|
||||
try {
|
||||
await client.connect();
|
||||
const plugin = (await client.getPluginCatalog()).find(({ id }) => id === "builtin-settings");
|
||||
assert.ok(plugin?.clientBundle, JSON.stringify(await client.getPluginLogs("builtin-settings")));
|
||||
assert.deepEqual(await client.listPlugins(), []);
|
||||
process.send!({ serverId: client.getLastServerInfoMessage()!.serverId, port: daemon.port });
|
||||
await new Promise<void>((resolve) => {
|
||||
process.once("disconnect", resolve);
|
||||
process.once("SIGTERM", resolve);
|
||||
});
|
||||
} finally {
|
||||
await client.close();
|
||||
await daemon.close();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
# Native SVG preview regression
|
||||
|
||||
Copy `../fixtures/native-preview.svg`, `../fixtures/native-preview-viewbox.svg`, and
|
||||
`../../../assets/images/icon.png` into a workspace on a test daemon. In the Android
|
||||
or iOS app, connect to that daemon, open the workspace's Files tab, and tap
|
||||
`native-preview.svg`. The SVG should show a yellow circle on a green rectangle.
|
||||
|
||||
With that preview open, run:
|
||||
|
||||
```sh
|
||||
agent-device test packages/app/e2e/mobile/agent-device/native-svg-preview.android.ad \
|
||||
--metro-port <port> --artifacts-dir .artifacts/svg-preview
|
||||
```
|
||||
|
||||
Run it again with `native-preview-viewbox.svg` open to cover SVG dimensions
|
||||
inferred from `viewBox`, then with the PNG open to check raster images. Close and
|
||||
reopen the SVG and rerun to cover cached file previews. Use English app language
|
||||
for the zoom button selectors. The scripts are discovered by `npm run test:e2e:mobile`; the iOS counterpart is
|
||||
`native-svg-preview.ios.ad`. They reopen the installed app with its current
|
||||
preview and leave the daemon connection unchanged.
|
||||
|
||||
Before the fix the SVG remains blank and the canvas wait fails. The PNG passes.
|
||||
The replay checks successful native dimension decoding and zoom/reset controls;
|
||||
visually verify the circle and rectangle as well.
|
||||
@@ -0,0 +1,11 @@
|
||||
context platform=android timeout=60000 retries=0
|
||||
env APP_ID=sh.paseo.debug
|
||||
|
||||
open "${APP_ID}"
|
||||
wait "id=\"image-file-preview-canvas\"" 10000
|
||||
wait "role=button label=\"Zoom in\"" 10000
|
||||
press "role=button label=\"Zoom in\""
|
||||
wait "role=button label=\"Reset view\" enabled=true" 10000
|
||||
press "role=button label=\"Reset view\""
|
||||
wait "role=button label=\"Reset view\" enabled=false" 10000
|
||||
close
|
||||
@@ -0,0 +1,11 @@
|
||||
context platform=ios timeout=60000 retries=0
|
||||
env APP_ID=sh.paseo.debug
|
||||
|
||||
open "${APP_ID}"
|
||||
wait "id=\"image-file-preview-canvas\"" 10000
|
||||
wait "role=button label=\"Zoom in\"" 10000
|
||||
press "role=button label=\"Zoom in\""
|
||||
wait "role=button label=\"Reset view\" enabled=true" 10000
|
||||
press "role=button label=\"Reset view\""
|
||||
wait "role=button label=\"Reset view\" enabled=false" 10000
|
||||
close
|
||||
@@ -1,7 +1,7 @@
|
||||
// Composer autocomplete placement on iOS with the software keyboard: chat, workspace
|
||||
// draft tab, and New workspace. Run where agent-device reaches the simulator, with the
|
||||
// development app connected to the fixture host. See docs/mobile-testing.md.
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { execFileSync, spawn } from "node:child_process";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import process from "node:process";
|
||||
@@ -317,6 +317,296 @@ async function runBoundedPreview() {
|
||||
await runCase("preview", "files", fileCase);
|
||||
}
|
||||
|
||||
// A finger drifts a few points during a tap, so tap the composer's controls with a
|
||||
// short drag while the keyboard is open. The model picker must open, and on a wide
|
||||
// layout its popover must end above the keyboard.
|
||||
function dragTap(rect) {
|
||||
ad(
|
||||
"gesture",
|
||||
"pan",
|
||||
String(Math.round(rect.x + rect.width / 2)),
|
||||
String(Math.round(rect.y + rect.height / 2)),
|
||||
"0",
|
||||
"3",
|
||||
"120",
|
||||
);
|
||||
}
|
||||
|
||||
// Waits until the keyboard is shown and the node with `id` stops moving.
|
||||
async function settledWithKeyboard(name, id) {
|
||||
let previousTop;
|
||||
return waitFor(name, (snap) => {
|
||||
const node = nodeById(snap, id);
|
||||
if (!node || !keyboardShown(snap)) return false;
|
||||
const stable = node.rect.y === previousTop;
|
||||
previousTop = node.rect.y;
|
||||
return stable;
|
||||
});
|
||||
}
|
||||
|
||||
const keyboardTop = (snap) =>
|
||||
snap.data.nodes.find((node) => node.type === "Keyboard" && node.rect).rect.y;
|
||||
|
||||
async function runControlTaps() {
|
||||
await clearInput("controls");
|
||||
const attach = nodeById(
|
||||
await settledWithKeyboard("controls-attach-before", "message-input-root"),
|
||||
"message-input-attach-button",
|
||||
);
|
||||
dragTap(attach.rect);
|
||||
// Wide layouts show the attachment menu as a popover and phones as a sheet; both list the items.
|
||||
await waitFor("controls-attach-menu", (snap) =>
|
||||
Boolean(nodeById(snap, "message-input-attachment-menu-item-file")),
|
||||
);
|
||||
process.stdout.write("PASS drag tap on attach opened the attachment menu\n");
|
||||
// The open menu hides the composer from accessibility. Its backdrop covers the top-left corner.
|
||||
ad("press", "20", "120");
|
||||
await waitFor("controls-attach-closed", (snap) => Boolean(nodeById(snap, "message-input-root")));
|
||||
await clearInput("controls-model");
|
||||
|
||||
const trigger = nodeById(
|
||||
await settledWithKeyboard("controls-model-before", "message-input-root"),
|
||||
"combined-model-selector",
|
||||
);
|
||||
dragTap(trigger.rect);
|
||||
const sheetOpen = (snap) =>
|
||||
snap.data.nodes.some((node) => node.type === "Button" && node.label === "Close");
|
||||
const opened = await waitFor(
|
||||
"controls-model-picker",
|
||||
(snap) => Boolean(nodeById(snap, "combobox-desktop-container")) || sheetOpen(snap),
|
||||
);
|
||||
process.stdout.write("PASS drag tap on the model selector opened the picker\n");
|
||||
if (!nodeById(opened, "combobox-desktop-container")) return;
|
||||
const settled = await settledWithKeyboard("controls-model-popover", "combobox-desktop-container");
|
||||
const frame = nodeById(settled, "combobox-desktop-container").rect;
|
||||
const bottom = frame.y + frame.height;
|
||||
const covered = frame.y < trigger.rect.y + trigger.rect.height && bottom > trigger.rect.y;
|
||||
if (covered || bottom > keyboardTop(settled) + 1) {
|
||||
throw new Error(
|
||||
`Model popover spans ${Math.round(frame.y)}-${Math.round(bottom)}; it must clear the trigger at ${Math.round(trigger.rect.y)} and the keyboard at ${Math.round(keyboardTop(settled))}`,
|
||||
);
|
||||
}
|
||||
process.stdout.write(
|
||||
`PASS model popover ${Math.round(frame.y)}-${Math.round(bottom)} clears the trigger and the keyboard\n`,
|
||||
);
|
||||
}
|
||||
|
||||
// Fullscreen is a layout mode of the same mounted editor: the toggle keeps its focus and
|
||||
// the keyboard, and each mode lands at its resting place. A focus loss used to close
|
||||
// the keyboard on every toggle, and a stale keyboard lift left the fullscreen composer
|
||||
// 310pt above the screen with only Send visible. Sample for a while after each
|
||||
// toggle, because the stale lift could land late.
|
||||
const fullscreenDraft = Array.from(
|
||||
{ length: 8 },
|
||||
(_, line) => `Line ${line + 1} of the fullscreen draft`,
|
||||
).join("\n");
|
||||
|
||||
async function assertFullscreenToggleHolds(name, place) {
|
||||
const deadline = Date.now() + 2_500;
|
||||
let samples = 0;
|
||||
while (Date.now() < deadline || samples < 3) {
|
||||
const snap = snapshot(`${name}-${samples}`);
|
||||
samples += 1;
|
||||
// A dismissed keyboard stays in the tree for a while, parked below the screen.
|
||||
const screen = snap.data.nodes.find((node) => node.type === "Application").rect;
|
||||
if (!keyboardShown(snap) || keyboardTop(snap) >= screen.y + screen.height)
|
||||
throw new Error(`${name}: the toggle closed the keyboard`);
|
||||
const problem = place(snap, keyboardTop(snap));
|
||||
if (problem) throw new Error(`${name}: ${problem}`);
|
||||
}
|
||||
process.stdout.write(`PASS ${name}: keyboard open and placement held over ${samples} samples\n`);
|
||||
}
|
||||
|
||||
// New workspace submits with Create where a chat has Send.
|
||||
const sendButton = (snap) =>
|
||||
snap.data.nodes.find(
|
||||
(node) =>
|
||||
node.type === "Button" &&
|
||||
node.rect &&
|
||||
(node.label === "Send message" || node.identifier === "workspace-create-submit"),
|
||||
)?.rect;
|
||||
|
||||
const enteredFullscreen = (snap, keyboard) => {
|
||||
const frame = nodeById(snap, "composer-fullscreen")?.rect;
|
||||
const send = sendButton(snap);
|
||||
if (!frame || !send) return "fullscreen composer or Send is missing";
|
||||
// The frame fills the screen below the safe area, behind the keyboard.
|
||||
if (frame.y < 0 || frame.y + frame.height < keyboard)
|
||||
return `fullscreen composer spans ${Math.round(frame.y)}-${Math.round(frame.y + frame.height)}, not the screen behind the keyboard at ${Math.round(keyboard)}`;
|
||||
if (send.y + send.height > keyboard + 1)
|
||||
return `Send ends at ${Math.round(send.y + send.height)}, below the keyboard at ${Math.round(keyboard)}`;
|
||||
return null;
|
||||
};
|
||||
|
||||
// Leaving fullscreen returns the composer to where it rested on the keyboard before.
|
||||
const exitedFullscreen = (resting) => (snap) => {
|
||||
if (nodeById(snap, "composer-fullscreen")) return "still fullscreen";
|
||||
const composer = nodeById(snap, "message-input-root")?.rect;
|
||||
if (!composer) return "composer is missing";
|
||||
const bottom = composer.y + composer.height;
|
||||
if (Math.abs(bottom - resting) > 1)
|
||||
return `composer ends at ${Math.round(bottom)}, not at its resting ${Math.round(resting)}`;
|
||||
return null;
|
||||
};
|
||||
|
||||
// Snapshots sample about once a second, so they cannot see one wrong frame. Record the
|
||||
// screen through a run of toggles instead: Send has one place inline and one in
|
||||
// fullscreen, and every recorded frame must draw it at one of the two. A keyboard lift
|
||||
// that landed a frame after its layout drew Send 310pt higher for that frame. Needs
|
||||
// ffmpeg on the PATH.
|
||||
async function assertSendHoldsEveryFrame(name, { screen, keyboard, sends, toggle }) {
|
||||
const video = path.join(artifactsDir, `${name.replaceAll(" ", "-")}.mp4`);
|
||||
const recorder = spawn(
|
||||
"xcrun",
|
||||
["simctl", "io", udid ?? "booted", "recordVideo", "--codec", "h264", "--force", video],
|
||||
{ stdio: ["ignore", "ignore", "pipe"] },
|
||||
);
|
||||
const finished = new Promise((resolve) => recorder.once("exit", resolve));
|
||||
await new Promise((resolve, reject) => {
|
||||
recorder.stderr.on("data", (chunk) => {
|
||||
if (String(chunk).includes("Recording started")) resolve();
|
||||
});
|
||||
finished.then(() => reject(new Error(`${name}: the screen recording did not start`)));
|
||||
});
|
||||
// The first frame is the settled inline composer.
|
||||
await sleep(500);
|
||||
await toggle();
|
||||
await sleep(1_000);
|
||||
recorder.kill("SIGINT");
|
||||
await finished;
|
||||
|
||||
// Decode the column of the screen that holds Send in both modes, one pixel per point.
|
||||
const left = Math.floor(Math.min(...sends.map((send) => send.x)));
|
||||
const right = Math.ceil(Math.max(...sends.map((send) => send.x + send.width)));
|
||||
const width = right - left;
|
||||
const height = Math.round(screen.height);
|
||||
const column = `crop=iw*${width / screen.width}:ih:iw*${left / screen.width}:0,scale=${width}:${height}`;
|
||||
const pixels = execFileSync(
|
||||
"ffmpeg",
|
||||
["-loglevel", "fatal", "-i", video, "-fps_mode", "passthrough", "-vf", column].concat([
|
||||
"-f",
|
||||
"rawvideo",
|
||||
"-pix_fmt",
|
||||
"rgb24",
|
||||
"-",
|
||||
]),
|
||||
{ maxBuffer: 1024 ** 3 },
|
||||
);
|
||||
const frameSize = width * height * 3;
|
||||
const frameCount = Math.floor(pixels.length / frameSize);
|
||||
if (frameCount < 2) throw new Error(`${name}: the recording holds ${frameCount} frames`);
|
||||
|
||||
// Send's colour is the commonest one in the middle of its inline rect.
|
||||
const [inline] = sends;
|
||||
const counts = new Map();
|
||||
for (let y = inline.y + inline.height / 4; y < inline.y + (inline.height * 3) / 4; y += 1) {
|
||||
for (let x = inline.x + inline.width / 4; x < inline.x + (inline.width * 3) / 4; x += 1) {
|
||||
const at = (Math.round(y) * width + Math.round(x - left)) * 3;
|
||||
const colour = (pixels[at] >> 3) * 1024 + (pixels[at + 1] >> 3) * 32 + (pixels[at + 2] >> 3);
|
||||
counts.set(colour, (counts.get(colour) ?? 0) + 1);
|
||||
}
|
||||
}
|
||||
const [accent] = [...counts].sort((a, b) => b[1] - a[1])[0];
|
||||
const isAccent = (at) =>
|
||||
Math.abs((pixels[at] >> 3) - Math.floor(accent / 1024)) <= 2 &&
|
||||
Math.abs((pixels[at + 1] >> 3) - (Math.floor(accent / 32) % 32)) <= 2 &&
|
||||
Math.abs((pixels[at + 2] >> 3) - (accent % 32)) <= 2;
|
||||
// The vertical centre of the rows Send's colour fills, above the keyboard.
|
||||
const sendCentre = (frame) => {
|
||||
const rows = [];
|
||||
for (let y = 0; y < Math.floor(keyboard); y += 1) {
|
||||
let filled = 0;
|
||||
for (let x = 0; x < width; x += 1) {
|
||||
if (isAccent(frame * frameSize + (y * width + x) * 3)) filled += 1;
|
||||
}
|
||||
if (filled >= inline.width * 0.4) rows.push(y);
|
||||
}
|
||||
return rows.length > 0 ? (rows[0] + rows.at(-1) + 1) / 2 : null;
|
||||
};
|
||||
const places = [];
|
||||
for (let frame = 0; frame < frameCount; frame += 1) {
|
||||
const centre = sendCentre(frame);
|
||||
const known = places.some(
|
||||
(place) =>
|
||||
place === centre || (place !== null && centre !== null && Math.abs(place - centre) <= 2),
|
||||
);
|
||||
if (known) continue;
|
||||
if (places.length === 2) {
|
||||
const drawn = centre === null ? "did not draw Send" : `drew Send at ${Math.round(centre)}`;
|
||||
throw new Error(
|
||||
`${name}: frame ${frame + 1} of ${frameCount} ${drawn}; it rests at ${places.map((place) => (place === null ? "nowhere" : Math.round(place))).join(" and ")}. See ${video}`,
|
||||
);
|
||||
}
|
||||
places.push(centre);
|
||||
}
|
||||
if (places.length !== 2 || places.includes(null))
|
||||
throw new Error(`${name}: expected Send at two places, saw ${places.join(" and ")}`);
|
||||
process.stdout.write(
|
||||
`PASS ${name}: Send drawn only at ${places.map(Math.round).join(" and ")} over ${frameCount} frames\n`,
|
||||
);
|
||||
}
|
||||
|
||||
async function runFullscreenToggles(host) {
|
||||
// The enter glyph sits in the input's own padding, so selectors report it covered.
|
||||
const buttonCentre = (name, snap, label) => {
|
||||
const button = snap.data.nodes.find(
|
||||
(node) => node.type === "Button" && node.label === label && node.rect,
|
||||
)?.rect;
|
||||
if (!button) throw new Error(`${name}: missing ${label}`);
|
||||
return [
|
||||
String(Math.round(button.x + button.width / 2)),
|
||||
String(Math.round(button.y + button.height / 2)),
|
||||
];
|
||||
};
|
||||
const pressButton = (name, label) => ad("press", ...buttonCentre(name, snapshot(name), label));
|
||||
// A run that failed in fullscreen leaves the composer there.
|
||||
if (nodeById(snapshot(`${host}-fullscreen-start`), "composer-fullscreen"))
|
||||
pressButton(`${host} fullscreen start`, "Exit fullscreen");
|
||||
await clearInput(`${host}-fullscreen`);
|
||||
ad("type", fullscreenDraft);
|
||||
const typed = nodeById(
|
||||
await settledWithKeyboard(`${host}-fullscreen-typed`, "message-input-root"),
|
||||
"message-input-root",
|
||||
).rect;
|
||||
const resting = typed.y + typed.height;
|
||||
for (let round = 1; round <= 4; round += 1) {
|
||||
pressButton(`${host} fullscreen enter ${round} button`, "Fullscreen");
|
||||
await assertFullscreenToggleHolds(`${host} fullscreen enter ${round}`, enteredFullscreen);
|
||||
pressButton(`${host} fullscreen exit ${round} button`, "Exit fullscreen");
|
||||
await assertFullscreenToggleHolds(
|
||||
`${host} fullscreen exit ${round}`,
|
||||
exitedFullscreen(resting),
|
||||
);
|
||||
}
|
||||
|
||||
const inline = snapshot(`${host}-fullscreen-frames-inline`);
|
||||
const enter = buttonCentre(`${host} fullscreen frames`, inline, "Fullscreen");
|
||||
ad("press", ...enter);
|
||||
const entered = await waitFor(`${host}-fullscreen-frames-entered`, (snap) =>
|
||||
Boolean(nodeById(snap, "composer-fullscreen") && sendButton(snap)),
|
||||
);
|
||||
const exit = buttonCentre(`${host} fullscreen frames`, entered, "Exit fullscreen");
|
||||
ad("press", ...exit);
|
||||
await waitFor(
|
||||
`${host}-fullscreen-frames-exited`,
|
||||
(snap) => !nodeById(snap, "composer-fullscreen"),
|
||||
);
|
||||
await assertSendHoldsEveryFrame(`${host} fullscreen frames`, {
|
||||
screen: inline.data.nodes.find((node) => node.type === "Application").rect,
|
||||
keyboard: keyboardTop(inline),
|
||||
sends: [sendButton(inline), sendButton(entered)],
|
||||
toggle: async () => {
|
||||
for (let round = 1; round <= 8; round += 1) {
|
||||
ad("press", ...enter);
|
||||
await sleep(600);
|
||||
ad("press", ...exit);
|
||||
await sleep(600);
|
||||
}
|
||||
},
|
||||
});
|
||||
await clearInput(`${host}-fullscreen-done`);
|
||||
}
|
||||
|
||||
if (scenario !== "all") {
|
||||
ad(
|
||||
"open",
|
||||
@@ -328,7 +618,14 @@ if (scenario !== "all") {
|
||||
await waitFor("draft", (snap) => Boolean(nodeById(snap, "message-input-root")), 60_000);
|
||||
if (scenario === "growth") await runLiveGrowth();
|
||||
else if (scenario === "previews") await runBoundedPreview();
|
||||
else throw new Error(`Unknown scenario: ${scenario}`);
|
||||
else if (scenario === "controls") await runControlTaps();
|
||||
else if (scenario === "fullscreen") {
|
||||
await runFullscreenToggles("draft");
|
||||
// New workspace hides its header in fullscreen, which resizes the dock on each toggle.
|
||||
ad("open", `paseo://new?serverId=${serverId}`, "--platform", "ios", ...deviceArgs);
|
||||
await waitFor("new-workspace", (snap) => Boolean(nodeById(snap, "message-input-root")), 60_000);
|
||||
await runFullscreenToggles("new-workspace");
|
||||
} else throw new Error(`Unknown scenario: ${scenario}`);
|
||||
process.stdout.write(`Composer ${scenario} regression passed. Artifacts: ${artifactsDir}\n`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { setTimeout } from "node:timers/promises";
|
||||
|
||||
// Opening a file from the filtered Files tree must close the software keyboard.
|
||||
//
|
||||
// Before running, on a phone-sized device with a software keyboard enabled, open
|
||||
// Explorer -> Files in a workspace where the first match for the query is a file.
|
||||
// The app must already run the checkout being verified against a real daemon.
|
||||
const serial = process.env.ANDROID_SERIAL ?? "emulator-5554";
|
||||
const query = process.env.PASEO_FILES_FILTER_QUERY ?? "README";
|
||||
|
||||
function adb(...args) {
|
||||
return execFileSync("adb", ["-s", serial, ...args], { encoding: "utf8", timeout: 60_000 });
|
||||
}
|
||||
function findNode(id) {
|
||||
adb("shell", "uiautomator", "dump", "/sdcard/files-filter-keyboard.xml");
|
||||
const tree = adb("exec-out", "cat", "/sdcard/files-filter-keyboard.xml");
|
||||
const node = tree.match(new RegExp(`<node [^>]*resource-id="${id}"[^>]*>`))?.[0];
|
||||
const bounds = node?.match(/bounds="\[(\d+),(\d+)\]\[(\d+),(\d+)\]"/);
|
||||
if (!bounds) return null;
|
||||
const [left, top, right, bottom] = bounds.slice(1).map(Number);
|
||||
return { x: Math.round((left + right) / 2), y: Math.round((top + bottom) / 2) };
|
||||
}
|
||||
async function waitForNode(id) {
|
||||
const deadline = Date.now() + 30_000;
|
||||
while (Date.now() < deadline) {
|
||||
const node = findNode(id);
|
||||
if (node) return node;
|
||||
await setTimeout(250);
|
||||
}
|
||||
throw new Error(`Timed out waiting for ${id}`);
|
||||
}
|
||||
function tap({ x, y }) {
|
||||
adb("shell", "input", "tap", String(x), String(y));
|
||||
}
|
||||
async function waitForKeyboard(shown) {
|
||||
let stable = 0;
|
||||
const deadline = Date.now() + 10_000;
|
||||
while (Date.now() < deadline) {
|
||||
const state = adb("shell", "dumpsys", "input_method");
|
||||
stable = /^ {2}mInputShown=true$/m.test(state) === shown ? stable + 1 : 0;
|
||||
if (stable === 3) return;
|
||||
await setTimeout(200);
|
||||
}
|
||||
assert.fail(`Keyboard did not settle at shown=${shown}`);
|
||||
}
|
||||
|
||||
const clear = findNode("files-filter-clear");
|
||||
if (clear) tap(clear);
|
||||
tap(await waitForNode("files-filter-input"));
|
||||
await waitForKeyboard(true);
|
||||
adb("shell", "input", "text", query);
|
||||
const match = await waitForNode("file-filter-row-0");
|
||||
await waitForKeyboard(true); // Typing and new results leave the keyboard up.
|
||||
|
||||
tap(match);
|
||||
await waitForNode("sheet-tab-body");
|
||||
await waitForKeyboard(false);
|
||||
console.log("PASS: opening a filtered file closes the keyboard");
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 160"><rect width="240" height="160" fill="#08a040"/><circle cx="120" cy="80" r="50" fill="#ffcc00"/></svg>
|
||||
|
After Width: | Height: | Size: 164 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="240" height="160" viewBox="0 0 240 160"><rect width="240" height="160" fill="#08a040"/><circle cx="120" cy="80" r="50" fill="#ffcc00"/></svg>
|
||||
|
After Width: | Height: | Size: 188 B |
@@ -111,7 +111,7 @@ Keep generated screenshots, recordings, and run logs outside the repository.
|
||||
confirmation. It first types without tapping the input to verify autofocus, then cancels the
|
||||
confirmation, closes and reopens the underlying sheet, confirms again,
|
||||
and completes the password retry. `stacked-settings.ad` checks the same return and retry through
|
||||
Settings → add host → Direct connection → Advanced. Run both on phones and tablets so both the
|
||||
Settings → add host → Direct connection → URI. Run both on phones and tablets so both the
|
||||
bottom sheet and centered dialog are exercised.
|
||||
|
||||
These integration journeys require the host-confirmation flow in the test app. Include both the
|
||||
@@ -146,7 +146,7 @@ Android uses the same journeys: copy each script outside the repository, change
|
||||
artifacts, and sessions separate from other runs. These host-dependent journeys remain outside the
|
||||
default mobile suite, alongside the existing modal-sheet scripts.
|
||||
|
||||
On iPhone, bulk replacement or bulk keyboard entry of the advanced URI field triggers a
|
||||
On iPhone, bulk replacement or bulk keyboard entry of the Connection URI field triggers a
|
||||
repeated-update error with both the parent and stacked-sheet implementations. Entering the complete
|
||||
URI one character at a time passed with both implementations; faster typing remains unverified.
|
||||
On iPad, replacing the field a second time appends text. For this Settings journey, use the
|
||||
|
||||
@@ -18,6 +18,9 @@ press "id=\"combined-model-selector\""
|
||||
wait "id=\"model-provider-${PROVIDER_ID}\"" 10000
|
||||
press "id=\"model-provider-${PROVIDER_ID}\""
|
||||
wait "id=\"model-row-${PROVIDER_ID}-${MODEL_ID}\"" 3000
|
||||
# Back takes the header's step to the provider list first, then dismisses the modal.
|
||||
back
|
||||
wait "id=\"model-provider-${PROVIDER_ID}\"" 3000
|
||||
back
|
||||
wait "id=\"combined-model-selector\" label=\"Select model (${MODEL_LABEL})\"" 3000
|
||||
close
|
||||
|
||||
@@ -10,13 +10,13 @@ wait "id=\"agent-controls-model\"" 10000
|
||||
gesture pan 540 790 0 960 500
|
||||
wait "id=\"combined-model-selector\"" 3000
|
||||
|
||||
# Reopen, dismiss the nested model browser, then dismiss its restored parent.
|
||||
# Android Back steps from Model back to Agent settings, then closes the sheet.
|
||||
press "id=\"combined-model-selector\""
|
||||
wait "id=\"agent-controls-model\"" 10000
|
||||
press "id=\"agent-controls-model\""
|
||||
wait stable 300 5000
|
||||
gesture pan 540 790 0 960 500
|
||||
wait "id=\"model-search-all-input\"" 10000
|
||||
back
|
||||
wait "id=\"agent-controls-model\"" 3000
|
||||
gesture pan 540 790 0 960 500
|
||||
back
|
||||
wait "id=\"combined-model-selector\"" 3000
|
||||
close
|
||||
|
||||
@@ -10,7 +10,7 @@ wait "id=\"add-host-method-direct\"" 10000
|
||||
screenshot "${OUT}/10-add-host-methods.png"
|
||||
press "id=\"add-host-method-direct\""
|
||||
wait stable
|
||||
press "id=\"direct-host-advanced-toggle\""
|
||||
press "id=\"direct-mode-uri\""
|
||||
wait stable
|
||||
fill "id=\"direct-host-uri-input\"" "${PAIRING_LINK}"
|
||||
wait stable
|
||||
@@ -32,9 +32,9 @@ wait "id=\"host-confirmation-connect\"" 10000
|
||||
screenshot "${OUT}/14-add-host-confirmation-reopens.png"
|
||||
press "id=\"host-confirmation-connect\""
|
||||
wait stable
|
||||
wait "id=\"direct-password-input\"" 20000
|
||||
wait "id=\"direct-uri-password-input\"" 20000
|
||||
screenshot "${OUT}/15-add-host-password.png"
|
||||
fill "id=\"direct-password-input\"" "${PASSWORD}"
|
||||
fill "id=\"direct-uri-password-input\"" "${PASSWORD}"
|
||||
wait stable
|
||||
press "id=\"direct-host-submit\""
|
||||
wait stable
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Open Pi settings from the Android model picker. Scroll the sheet body until
|
||||
# most of the Models list is visible. Use a host with several Pi models and
|
||||
# the default shown-models selection.
|
||||
session="${1:?Pass the agent-device session with the Pi provider sheet open}"
|
||||
artifacts="${2:-.artifacts/provider-model-scroll}"
|
||||
mkdir -p "$artifacts"
|
||||
|
||||
ad() {
|
||||
agent-device "$@" --session "$session"
|
||||
}
|
||||
|
||||
visible_rows() {
|
||||
jq -ce '
|
||||
.data.nodes as $nodes
|
||||
| ($nodes[] | select(.identifier == "provider-discovered-models")) as $list
|
||||
| [$nodes[]
|
||||
| select((.identifier // "") | startswith("provider-shown-model-"))
|
||||
| select(.rect.height > 0 and .rect.y < ($list.rect.y + $list.rect.height))
|
||||
| select(.rect.y + .rect.height > $list.rect.y)
|
||||
| .label]
|
||||
| select(length > 1)
|
||||
' "$1"
|
||||
}
|
||||
|
||||
ad snapshot --json > "$artifacts/before.json"
|
||||
read -r x y dy < <(jq -er '
|
||||
.data.nodes[]
|
||||
| select(.identifier == "provider-discovered-models" and .rect.height >= 350)
|
||||
| .rect
|
||||
| [(.x + .width / 2 | floor), (.y + .height * 0.7 | floor), (-.height * 0.5 | floor)]
|
||||
| @tsv
|
||||
' "$artifacts/before.json") || {
|
||||
printf 'Scroll the sheet body until the Models list is visible.\n' >&2
|
||||
exit 1
|
||||
}
|
||||
before=$(visible_rows "$artifacts/before.json")
|
||||
ad gesture pan "$x" "$y" 0 "$dy" 580
|
||||
ad snapshot --json > "$artifacts/after.json"
|
||||
after=$(visible_rows "$artifacts/after.json")
|
||||
|
||||
printf 'Before %s\nAfter %s\n' "$before" "$after"
|
||||
first=$(jq -r '.[0]' <<<"$before")
|
||||
if jq -e --arg first "$first" 'index($first) != null' <<<"$after" >/dev/null; then
|
||||
printf 'The first model stayed visible after the upward drag.\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
model=$(jq -r '.[1]' <<<"$after")
|
||||
ad press "role=checkbox label=\"$model\"" --settle
|
||||
ad snapshot --json > "$artifacts/checked.json"
|
||||
jq -e --arg model "$model" '
|
||||
any(.data.nodes[]; .kind == "checkbox" and .label == $model and .checked == true)
|
||||
' "$artifacts/checked.json" >/dev/null
|
||||
ad press 'id="provider-shown-models-reset"' --settle
|
||||
ad snapshot --json > "$artifacts/reset.json"
|
||||
jq -e --arg model "$model" '
|
||||
any(.data.nodes[]; .kind == "checkbox" and .label == $model and .checked == false)
|
||||
' "$artifacts/reset.json" >/dev/null
|
||||
@@ -603,9 +603,12 @@ export function profilePickerRow(page: Page, name: string): Locator {
|
||||
.filter({ hasText: name });
|
||||
}
|
||||
|
||||
/** Desktop keeps profiles behind the rail's Profiles entry, beside the providers. */
|
||||
/** Multi-provider desktop keeps profiles behind the rail; single-pane lists them inline. */
|
||||
export async function openPickerProfiles(page: Page): Promise<void> {
|
||||
await pickerViewport(page).getByTestId("model-picker-rail-profiles").click();
|
||||
const rail = pickerViewport(page).getByTestId("model-picker-rail-profiles");
|
||||
if (await rail.isVisible().catch(() => false)) {
|
||||
await rail.click();
|
||||
}
|
||||
}
|
||||
|
||||
export async function expectPickerProfile(
|
||||
@@ -624,7 +627,8 @@ export async function expectProfilesEditLink(page: Page): Promise<void> {
|
||||
exact: true,
|
||||
});
|
||||
await expect(edit).toBeVisible();
|
||||
await expect(edit).toHaveText("Edit");
|
||||
await expect(edit).toHaveText("");
|
||||
await expect(edit.locator("svg")).toBeVisible();
|
||||
}
|
||||
|
||||
/** With no profiles, the Profiles entry offers to create one instead of listing any. */
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { expect, type Page } from "@playwright/test";
|
||||
import { readScrollMetrics, waitForContentGrowth, expectNearBottom } from "./agent-bottom-anchor";
|
||||
import { agentStopButton } from "./composer";
|
||||
|
||||
export async function awaitAssistantMessage(page: Page, hasText?: string | RegExp): Promise<void> {
|
||||
const messages = page.getByTestId("assistant-message");
|
||||
@@ -14,7 +15,7 @@ export async function awaitToolCall(page: Page, toolName: string | RegExp): Prom
|
||||
}
|
||||
|
||||
export async function expectAgentIdle(page: Page, timeout = 30_000): Promise<void> {
|
||||
await expect(page.getByRole("button", { name: /stop|cancel/i })).toHaveCount(0, { timeout });
|
||||
await expect(agentStopButton(page)).toHaveCount(0, { timeout });
|
||||
}
|
||||
|
||||
// The working indicator is an animated spinner View — no semantic ARIA role, testId is correct.
|
||||
|
||||
@@ -31,6 +31,8 @@ export interface RewindCompletionGate {
|
||||
clearTimelineStreamCount(): void;
|
||||
release(): void;
|
||||
timelineStreamCount(): number;
|
||||
/** Timeline reads this page sent since the last clear. */
|
||||
timelineFetchCount(): number;
|
||||
waitForDelayedResponse(): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -186,12 +188,20 @@ export async function holdDaemonHydration(page: Page): Promise<DaemonHydrationGa
|
||||
};
|
||||
}
|
||||
|
||||
// The rewind response and the timeline change it causes; the change removes the rewound row too.
|
||||
const REWIND_COMPLETION_MESSAGES = new Set([
|
||||
"agent.rewind.response",
|
||||
"agent.timeline.rewind",
|
||||
"agent.timeline.replacement",
|
||||
]);
|
||||
|
||||
export async function holdRewindCompletion(
|
||||
page: Page,
|
||||
agentId: string,
|
||||
): Promise<RewindCompletionGate> {
|
||||
let released = false;
|
||||
let timelineStreamCount = 0;
|
||||
let timelineFetchCount = 0;
|
||||
const delayedForwards: Array<() => void> = [];
|
||||
let resolveDelayedResponse: (() => void) | null = null;
|
||||
const delayedResponse = new Promise<void>((resolve) => {
|
||||
@@ -200,7 +210,16 @@ export async function holdRewindCompletion(
|
||||
|
||||
await page.routeWebSocket(daemonWsRoutePattern(), (ws) => {
|
||||
const server = ws.connectToServer();
|
||||
ws.onMessage((message) => server.send(message));
|
||||
ws.onMessage((message) => {
|
||||
const sessionMessage = getSessionMessage(message);
|
||||
if (
|
||||
sessionMessage?.type === "fetch_agent_timeline_request" &&
|
||||
sessionMessage.agentId === agentId
|
||||
) {
|
||||
timelineFetchCount += 1;
|
||||
}
|
||||
server.send(message);
|
||||
});
|
||||
server.onMessage((message) => {
|
||||
const sessionMessage = getSessionMessage(message);
|
||||
const payload = sessionMessage ? getPayload(sessionMessage) : null;
|
||||
@@ -216,11 +235,11 @@ export async function holdRewindCompletion(
|
||||
}
|
||||
if (
|
||||
!released &&
|
||||
(sessionMessage?.type === "agent.rewind.response" ||
|
||||
sessionMessage?.type === "agent.timeline.replacement") &&
|
||||
sessionMessage &&
|
||||
REWIND_COMPLETION_MESSAGES.has(String(sessionMessage.type)) &&
|
||||
payload?.agentId === agentId
|
||||
) {
|
||||
// The replacement also signals completion and removes the rewound row/menu.
|
||||
// The rewind also signals completion and removes the rewound row/menu.
|
||||
// Hold it with the response so the pending-state assertion observes a pending rewind.
|
||||
delayedForwards.push(() => ws.send(message));
|
||||
if (sessionMessage.type === "agent.rewind.response") resolveDelayedResponse?.();
|
||||
@@ -233,6 +252,7 @@ export async function holdRewindCompletion(
|
||||
return {
|
||||
clearTimelineStreamCount() {
|
||||
timelineStreamCount = 0;
|
||||
timelineFetchCount = 0;
|
||||
},
|
||||
release() {
|
||||
released = true;
|
||||
@@ -241,6 +261,7 @@ export async function holdRewindCompletion(
|
||||
}
|
||||
},
|
||||
timelineStreamCount: () => timelineStreamCount,
|
||||
timelineFetchCount: () => timelineFetchCount,
|
||||
waitForDelayedResponse: () => delayedResponse,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
import { mkdir, writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { once } from "node:events";
|
||||
import { spawnTsx, killProcessTree } from "./spawn-node";
|
||||
import appPackage from "../../../package.json";
|
||||
import { expect, test as base, type Page } from "../fixtures";
|
||||
import { gotoAppShell } from "./app";
|
||||
import { addConnectedHostAndReload } from "./hosts";
|
||||
import { pluginRequirements } from "./plugin-fixture";
|
||||
|
||||
const pluginId = "builtin-settings";
|
||||
const screenId = "general";
|
||||
const settingsText = "Built-in settings body";
|
||||
|
||||
export const test = base.extend<{ builtinSettingsHost: { serverId: string; port: number } }>({
|
||||
builtinSettingsHost: async ({ baseURL }, provide, testInfo) => {
|
||||
const root = testInfo.outputPath("builtin-plugins");
|
||||
const directory = path.join(root, pluginId);
|
||||
await mkdir(directory, { recursive: true });
|
||||
await writeFile(
|
||||
path.join(directory, "paseo-plugin.json"),
|
||||
JSON.stringify({ id: pluginId, requirements: pluginRequirements }),
|
||||
);
|
||||
await writeFile(
|
||||
path.join(directory, "index.client.tsx"),
|
||||
`import React from "react";
|
||||
import { Text } from "react-native";
|
||||
|
||||
export default function contribute(client) {
|
||||
client.addSettingsScreen({
|
||||
id: "${screenId}",
|
||||
title: "General",
|
||||
icon: "SlidersHorizontal",
|
||||
Component: () => <Text>${settingsText}</Text>,
|
||||
});
|
||||
return () => {};
|
||||
}`,
|
||||
);
|
||||
await writeFile(
|
||||
path.join(directory, "index.server.ts"),
|
||||
"export default function contribute() { return () => {}; }",
|
||||
);
|
||||
const daemon = spawnTsx(
|
||||
path.resolve(__dirname, "../../fixtures/builtin-settings/daemon.mts"),
|
||||
[root, new URL(baseURL!).origin, testInfo.outputPath("daemon"), appPackage.version],
|
||||
{ stdio: ["ignore", "inherit", "inherit", "ipc"] },
|
||||
);
|
||||
try {
|
||||
const [host] = await Promise.race([
|
||||
once(daemon, "message") as Promise<[{ serverId: string; port: number }]>,
|
||||
once(daemon, "exit").then(([code]) => {
|
||||
throw new Error(`Built-in settings daemon exited with code ${code}`);
|
||||
}),
|
||||
]);
|
||||
await provide(host);
|
||||
} finally {
|
||||
await killProcessTree(daemon);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
export async function openBuiltinPluginSettings(
|
||||
page: Page,
|
||||
host: { serverId: string; port: number },
|
||||
) {
|
||||
await gotoAppShell(page);
|
||||
await addConnectedHostAndReload(page, {
|
||||
...host,
|
||||
label: "Built-in settings host",
|
||||
destination: `/settings/hosts/${host.serverId}/plugins/${pluginId}/${screenId}`,
|
||||
});
|
||||
}
|
||||
|
||||
export async function expectBuiltinPluginSettings(page: Page) {
|
||||
await expect(page.getByText(settingsText, { exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("switch", { name: /: Disable$/ })).toHaveCount(0);
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
import { expect, type Browser, type Locator, type Page } from "@playwright/test";
|
||||
import { hideDeveloperToasts } from "../developer-ui.mjs";
|
||||
import {
|
||||
agentStopButton,
|
||||
composerLocator,
|
||||
expectComposerDraft,
|
||||
fillComposerDraft,
|
||||
sendDraftToQueue,
|
||||
} from "./composer";
|
||||
import { openAgentRoute, seedMockAgentWorkspace, type MockAgentWorkspace } from "./mock-agent";
|
||||
|
||||
export interface AgentWithOpenTurn extends MockAgentWorkspace {
|
||||
/** Ends the open turn from outside the app, so it also works with every page closed. */
|
||||
finishTurn(): Promise<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A mock agent whose first turn stays open on a plan approval. The turn ends when the test
|
||||
* answers it, so nothing here depends on how long a stream runs.
|
||||
*/
|
||||
export async function seedAgentWithOpenTurn(input: {
|
||||
repoPrefix: string;
|
||||
title: string;
|
||||
}): Promise<AgentWithOpenTurn> {
|
||||
const agent = await seedMockAgentWorkspace({
|
||||
...input,
|
||||
initialPrompt: "Emit synthetic plan approval.",
|
||||
});
|
||||
await agent.client.waitForFinish(agent.agentId, 30_000);
|
||||
return {
|
||||
...agent,
|
||||
async finishTurn() {
|
||||
const fetched = await agent.client.fetchAgent({ agentId: agent.agentId });
|
||||
const request = fetched?.agent.pendingPermissions[0];
|
||||
if (!request) throw new Error("The agent has no open turn to finish");
|
||||
await agent.client.respondToPermission(agent.agentId, request.id, { behavior: "allow" });
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function queuedRows(page: Page): Locator {
|
||||
return page.getByRole("list", { name: "Queued messages" }).getByRole("listitem");
|
||||
}
|
||||
|
||||
export function queuedRow(page: Page, text: string): Locator {
|
||||
return queuedRows(page).filter({ hasText: text });
|
||||
}
|
||||
|
||||
export async function queueMessage(page: Page, text: string): Promise<void> {
|
||||
await fillComposerDraft(page, text);
|
||||
await sendDraftToQueue(page);
|
||||
await expect(queuedRow(page, text)).toBeVisible();
|
||||
await expectComposerDraft(page, "");
|
||||
}
|
||||
|
||||
export async function editQueuedMessage(page: Page, text: string): Promise<void> {
|
||||
await queuedRow(page, text)
|
||||
.getByRole("button", { name: "Edit queued message", exact: true })
|
||||
.click();
|
||||
}
|
||||
|
||||
export async function cancelQueuedMessage(page: Page, text: string): Promise<void> {
|
||||
await queuedRow(page, text)
|
||||
.getByRole("button", { name: "Cancel queued message", exact: true })
|
||||
.click();
|
||||
}
|
||||
|
||||
export async function sendQueuedMessageNow(page: Page, text: string): Promise<void> {
|
||||
await queuedRow(page, text)
|
||||
.getByRole("button", { name: "Send queued message now", exact: true })
|
||||
.click();
|
||||
}
|
||||
|
||||
export function queuePausedNotice(page: Page): Locator {
|
||||
return page.getByText("Queue paused until you send a message", { exact: true });
|
||||
}
|
||||
|
||||
/** Queues through the host, for tests that need more rows than are worth typing. */
|
||||
export async function queueThroughHost(agent: AgentWithOpenTurn, texts: string[]): Promise<void> {
|
||||
for (const text of texts) {
|
||||
await agent.client.sendAgentMessage(agent.agentId, text, { activeTurnBehavior: "queue" });
|
||||
}
|
||||
}
|
||||
|
||||
/** The composer input and Stop are both fully on screen. */
|
||||
export async function expectComposerOnScreen(page: Page): Promise<void> {
|
||||
await expect(composerLocator(page)).toBeInViewport({ ratio: 1 });
|
||||
await expect(agentStopButton(page)).toBeInViewport({ ratio: 1 });
|
||||
}
|
||||
|
||||
/** Turns the mouse wheel over one row, as a user does to move through the queue. */
|
||||
export async function scrollQueueFrom(page: Page, text: string, deltaY: number): Promise<void> {
|
||||
await queuedRow(page, text).hover();
|
||||
await page.mouse.wheel(0, deltaY);
|
||||
}
|
||||
|
||||
/** The icon leading a row's "Sent by" line is drawn at its full width. */
|
||||
export async function expectSenderIconUnsquashed(row: Locator): Promise<void> {
|
||||
const icon = await row.locator("svg").first().boundingBox();
|
||||
if (!icon) throw new Error("The row has no visible sender icon");
|
||||
expect(icon.width).toBeGreaterThanOrEqual(icon.height);
|
||||
}
|
||||
|
||||
/** The queued prompt reached the transcript exactly once and left the queue. */
|
||||
export async function expectDeliveredOnce(page: Page, text: string): Promise<void> {
|
||||
await expect(page.getByTestId("user-message").filter({ hasText: text })).toHaveCount(1, {
|
||||
timeout: 30_000,
|
||||
});
|
||||
await expect(queuedRow(page, text)).toHaveCount(0);
|
||||
}
|
||||
|
||||
export async function expectDeliveredImage(page: Page, text: string): Promise<void> {
|
||||
await expect(
|
||||
page
|
||||
.getByTestId("user-message")
|
||||
.filter({ hasText: text })
|
||||
.getByRole("button", { name: "Open image attachment" }),
|
||||
).toHaveCount(1);
|
||||
}
|
||||
|
||||
/** A page opened after the first one was closed, with the same stored app data. */
|
||||
export async function reopenAgent(page: Page, agent: AgentWithOpenTurn): Promise<Page> {
|
||||
const reopened = await page.context().newPage();
|
||||
await hideDeveloperToasts(reopened);
|
||||
await openAgentRoute(reopened, agent);
|
||||
return reopened;
|
||||
}
|
||||
|
||||
/** A second client of the same host: its own browser context and its own client id. */
|
||||
export async function openSecondClient(
|
||||
browser: Browser,
|
||||
page: Page,
|
||||
agent: AgentWithOpenTurn,
|
||||
): Promise<{ page: Page; close(): Promise<void> }> {
|
||||
const context = await browser.newContext({ storageState: await page.context().storageState() });
|
||||
const second = await context.newPage();
|
||||
await second.addInitScript(() => localStorage.removeItem("@paseo:client-id-v1"));
|
||||
await hideDeveloperToasts(second);
|
||||
await openAgentRoute(second, agent);
|
||||
return { page: second, close: () => context.close() };
|
||||
}
|
||||
@@ -103,8 +103,13 @@ export async function expectQueuedMessageButton(page: Page): Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
/** The composer's Stop button. Queued rows also have a Cancel button, so match the whole name. */
|
||||
export function agentStopButton(page: Page) {
|
||||
return page.getByRole("button", { name: /^(stop|canceling) agent$/i });
|
||||
}
|
||||
|
||||
export async function cancelAgent(page: Page): Promise<void> {
|
||||
const stopButton = page.getByRole("button", { name: /stop|cancel/i }).first();
|
||||
const stopButton = agentStopButton(page).first();
|
||||
await expect(stopButton).toBeVisible({ timeout: 10_000 });
|
||||
await stopButton.click();
|
||||
}
|
||||
@@ -300,9 +305,7 @@ export async function startRunningMockAgent(
|
||||
await page.goto(agentUrl);
|
||||
await expectComposerVisible(page);
|
||||
await client.sendAgentMessage(agent.id, opts.prompt);
|
||||
await expect(page.getByRole("button", { name: /stop|cancel/i }).first()).toBeVisible({
|
||||
timeout: 30_000,
|
||||
});
|
||||
await expect(agentStopButton(page).first()).toBeVisible({ timeout: 30_000 });
|
||||
return {
|
||||
client,
|
||||
repo,
|
||||
@@ -467,6 +470,12 @@ export async function configureComposerQueueSend(page: Page): Promise<void> {
|
||||
);
|
||||
}
|
||||
|
||||
export async function configureComposerInterruptSend(page: Page): Promise<void> {
|
||||
await page.addInitScript(() =>
|
||||
localStorage.setItem("@paseo:app-settings", JSON.stringify({ sendBehavior: "interrupt" })),
|
||||
);
|
||||
}
|
||||
|
||||
/** Drive the real tab chooser's commands even when fullscreen covers its pointer surface.
|
||||
* This exercises retained activity changes, not a claim that covered chrome is clickable.
|
||||
*/
|
||||
|
||||
@@ -76,15 +76,24 @@ export async function addOfflineHostsAndReload(
|
||||
|
||||
export async function addConnectedHostAndReload(
|
||||
page: Page,
|
||||
input: { serverId: string; label: string; port: number; primaryLabel?: string },
|
||||
input: {
|
||||
serverId: string;
|
||||
label: string;
|
||||
port: number;
|
||||
primaryLabel?: string;
|
||||
destination?: string;
|
||||
},
|
||||
): Promise<void> {
|
||||
await addConnectedHostsAndReload(page, [input], { primaryLabel: input.primaryLabel });
|
||||
await addConnectedHostsAndReload(page, [input], {
|
||||
primaryLabel: input.primaryLabel,
|
||||
destination: input.destination,
|
||||
});
|
||||
}
|
||||
|
||||
export async function addConnectedHostsAndReload(
|
||||
page: Page,
|
||||
inputs: Array<{ serverId: string; label: string; port: number }>,
|
||||
options?: { primaryLabel?: string },
|
||||
options?: { primaryLabel?: string; destination?: string },
|
||||
): Promise<void> {
|
||||
const connectedHosts = inputs.map((input) =>
|
||||
buildSeededHost({
|
||||
@@ -123,7 +132,8 @@ export async function addConnectedHostsAndReload(
|
||||
},
|
||||
);
|
||||
|
||||
await page.reload();
|
||||
if (options?.destination) await page.goto(options.destination);
|
||||
else await page.reload();
|
||||
}
|
||||
|
||||
export async function waitForConnectedHost(
|
||||
|
||||
@@ -7,6 +7,7 @@ import { connectNewWorkspaceDaemonClient } from "./new-workspace";
|
||||
import { openAgentRoute, seedMockAgentWorkspace, type MockAgentWorkspace } from "./mock-agent";
|
||||
import { installDaemonWebSocketGate } from "./daemon-websocket-gate";
|
||||
import { expectReconnectingToastVisible } from "./workspace-ui";
|
||||
import { userScrollsTimelineToHistoryStart } from "./timeline-pagination";
|
||||
|
||||
const PLUGIN_ID = "timeline-transform-e2e";
|
||||
|
||||
@@ -373,3 +374,81 @@ export async function viewInlineThinkingExample(page: Page, info: TestInfo): Pro
|
||||
await example.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
/** Reuse plugin-local IDs across distinct source messages in a real virtualized chat. */
|
||||
export async function withRepeatedOutputTimeline(
|
||||
page: Page,
|
||||
info: TestInfo,
|
||||
run: () => Promise<void>,
|
||||
): Promise<void> {
|
||||
info.setTimeout(120_000);
|
||||
const agent = await seedMockAgentWorkspace({
|
||||
repoPrefix: "timeline-local-ids-",
|
||||
title: "Repeated plugin output IDs",
|
||||
});
|
||||
try {
|
||||
for (const label of ["First", "Second", "Third"]) {
|
||||
await agent.client.sendAgentMessage(
|
||||
agent.agentId,
|
||||
`${label}: emit 1 coalesced agent stream updates`,
|
||||
);
|
||||
await agent.client.waitForFinish(agent.agentId, 15_000);
|
||||
}
|
||||
await withDirectoryPlugin({
|
||||
pluginId: "timeline-local-ids",
|
||||
source: `import React from "react";
|
||||
import { Text, View } from "react-native";
|
||||
import { z } from "zod";
|
||||
function Row({ item }) {
|
||||
return <View style={{ height: item.data.tall ? 120 : 24 }}>
|
||||
<Text>{item.data.label}</Text>
|
||||
</View>;
|
||||
}
|
||||
export default function contribute(client) {
|
||||
client.addTimelineTransformer({
|
||||
id: "local-ids", query: { itemType: "user_message" },
|
||||
transform({ item }) {
|
||||
const label = item.text.split(":")[0];
|
||||
return { items: Array.from({ length: 60 }, (_, index) => ({
|
||||
type: "plugin", id: "part-" + index, kind: "reply", version: 1,
|
||||
data: { label: label + " replacement " + index, tall: label === "Second" },
|
||||
})) };
|
||||
},
|
||||
});
|
||||
client.addTimelineRenderer({
|
||||
kind: "reply", version: 1,
|
||||
schema: z.object({ label: z.string(), tall: z.boolean() }), Component: Row,
|
||||
});
|
||||
return () => {};
|
||||
}`,
|
||||
run: async () => {
|
||||
await openAgentRoute(page, agent);
|
||||
await expect(page.getByRole("textbox", { name: "Message agent..." }).first()).toBeVisible();
|
||||
await run();
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
export async function readOldestPluginReplacement(page: Page): Promise<void> {
|
||||
await expect(page.getByText("Third replacement 59", { exact: true }).first()).toBeAttached();
|
||||
await expect
|
||||
.poll(async () => {
|
||||
await userScrollsTimelineToHistoryStart(page);
|
||||
return page.getByText("First replacement 0", { exact: true }).isVisible();
|
||||
})
|
||||
.toBe(true);
|
||||
}
|
||||
|
||||
export async function expectOldestPluginReplacementReadable(page: Page): Promise<void> {
|
||||
await expect(
|
||||
page
|
||||
.getByTestId("agent-chat-scroll")
|
||||
.locator("[data-index]")
|
||||
.getByText("First replacement 0", { exact: true }),
|
||||
).toBeVisible();
|
||||
await expect(page.getByRole("textbox", { name: "Message agent..." }).first()).toBeVisible();
|
||||
await expect(page.getByText("Paseo ran into a problem.", { exact: true })).toHaveCount(0);
|
||||
}
|
||||
|
||||
@@ -61,18 +61,24 @@ async function readRows(input: {
|
||||
storeName: string;
|
||||
}): Promise<ReplicaRowRecord[]> {
|
||||
const database = await new Promise<IDBDatabase>((resolve, reject) => {
|
||||
const request = indexedDB.open(input.databaseName, 1);
|
||||
request.addEventListener("success", () => resolve(request.result));
|
||||
request.addEventListener("error", () => reject(request.error));
|
||||
});
|
||||
return new Promise((resolve, reject) => {
|
||||
const request = database
|
||||
.transaction(input.storeName, "readonly")
|
||||
.objectStore(input.storeName)
|
||||
.getAll();
|
||||
// The app owns the database version; open whatever version it created.
|
||||
const request = indexedDB.open(input.databaseName);
|
||||
request.addEventListener("success", () => resolve(request.result));
|
||||
request.addEventListener("error", () => reject(request.error));
|
||||
});
|
||||
try {
|
||||
return await new Promise((resolve, reject) => {
|
||||
const request = database
|
||||
.transaction(input.storeName, "readonly")
|
||||
.objectStore(input.storeName)
|
||||
.getAll();
|
||||
request.addEventListener("success", () => resolve(request.result));
|
||||
request.addEventListener("error", () => reject(request.error));
|
||||
});
|
||||
} finally {
|
||||
// An open connection would block the app from upgrading the database.
|
||||
database.close();
|
||||
}
|
||||
}
|
||||
|
||||
function assembleCache(rows: ReplicaRowRecord[]): ReplicaCacheRecord {
|
||||
@@ -185,19 +191,27 @@ export async function writeReplicaCache(page: Page, value: ReplicaCacheRecord):
|
||||
await page.evaluate(
|
||||
async ({ databaseName, storeName, nextRows }) => {
|
||||
const database = await new Promise<IDBDatabase>((resolve, reject) => {
|
||||
const request = indexedDB.open(databaseName, 1);
|
||||
const request = indexedDB.open(databaseName);
|
||||
request.addEventListener("success", () => resolve(request.result));
|
||||
request.addEventListener("error", () => reject(request.error));
|
||||
});
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const transaction = database.transaction(storeName, "readwrite");
|
||||
const store = transaction.objectStore(storeName);
|
||||
store.clear();
|
||||
for (const row of nextRows) store.put(row);
|
||||
transaction.addEventListener("complete", () => resolve());
|
||||
transaction.addEventListener("error", () => reject(transaction.error));
|
||||
transaction.addEventListener("abort", () => reject(transaction.error));
|
||||
});
|
||||
try {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const transaction = database.transaction(storeName, "readwrite");
|
||||
const store = transaction.objectStore(storeName);
|
||||
store.clear();
|
||||
// The app budgets the cache on each row's recorded UTF-8 payload size.
|
||||
const encoder = new TextEncoder();
|
||||
for (const row of nextRows) {
|
||||
store.put({ ...row, payloadBytes: encoder.encode(row.payload).length });
|
||||
}
|
||||
transaction.addEventListener("complete", () => resolve());
|
||||
transaction.addEventListener("error", () => reject(transaction.error));
|
||||
transaction.addEventListener("abort", () => reject(transaction.error));
|
||||
});
|
||||
} finally {
|
||||
database.close();
|
||||
}
|
||||
},
|
||||
{ databaseName: DATABASE_NAME, storeName: STORE_NAME, nextRows: rows },
|
||||
);
|
||||
|
||||
@@ -168,6 +168,11 @@ export interface SeedDaemonClient {
|
||||
timeout?: number,
|
||||
): Promise<{ status: string }>;
|
||||
cancelAgent(agentId: string): Promise<void>;
|
||||
respondToPermission(
|
||||
agentId: string,
|
||||
requestId: string,
|
||||
response: { behavior: "allow" },
|
||||
): Promise<void>;
|
||||
sendAgentMessage(
|
||||
agentId: string,
|
||||
text: string,
|
||||
@@ -182,9 +187,9 @@ export interface SeedDaemonClient {
|
||||
): Promise<{ status: string; final?: { lastError?: string | null } | null }>;
|
||||
archiveAgent(agentId: string): Promise<{ archivedAt: string }>;
|
||||
refreshAgent(agentId: string): Promise<unknown>;
|
||||
fetchAgent(options: {
|
||||
agentId: string;
|
||||
}): Promise<{ agent: { id: string; archivedAt?: string | null } } | null>;
|
||||
fetchAgent(options: { agentId: string }): Promise<{
|
||||
agent: { id: string; archivedAt?: string | null; pendingPermissions: Array<{ id: string }> };
|
||||
} | null>;
|
||||
getLastServerInfoMessage(): {
|
||||
features?: {
|
||||
projectAdd?: boolean;
|
||||
|
||||
@@ -258,8 +258,37 @@ export async function expectAddHostFieldDrawnAsInput(page: Page, testId: string)
|
||||
await expect(field).not.toHaveCSS("background-color", "rgba(0, 0, 0, 0)");
|
||||
}
|
||||
|
||||
export async function toggleHostAdvanced(page: Page): Promise<void> {
|
||||
await page.getByTestId("direct-host-advanced-toggle").click();
|
||||
function directConnectionModeSegment(page: Page, mode: "Form" | "URI") {
|
||||
return page.getByTestId("direct-mode").getByRole("button", { name: mode, exact: true });
|
||||
}
|
||||
|
||||
export async function selectDirectConnectionMode(page: Page, mode: "Form" | "URI"): Promise<void> {
|
||||
await directConnectionModeSegment(page, mode).click();
|
||||
await expectDirectConnectionMode(page, mode);
|
||||
}
|
||||
|
||||
export async function expectDirectConnectionMode(page: Page, mode: "Form" | "URI"): Promise<void> {
|
||||
await expect(directConnectionModeSegment(page, mode)).toHaveAttribute("aria-selected", "true");
|
||||
}
|
||||
|
||||
export async function expectDirectFormModeDisabled(page: Page): Promise<void> {
|
||||
await expect(directConnectionModeSegment(page, "Form")).toBeDisabled();
|
||||
}
|
||||
|
||||
export async function connectDirectHost(page: Page): Promise<void> {
|
||||
await page.getByTestId("direct-host-submit").click();
|
||||
await expect(page.getByTestId("add-host-modal")).toHaveCount(0, { timeout: 30_000 });
|
||||
}
|
||||
|
||||
export async function connectDirectHostExpectingPassword(page: Page, host: string): Promise<void> {
|
||||
await page.getByTestId("direct-host-submit").click();
|
||||
await expect(page.getByText(`Password for ${host}`, { exact: true })).toBeVisible({
|
||||
timeout: 30_000,
|
||||
});
|
||||
}
|
||||
|
||||
export async function fillDirectHostPromptPassword(page: Page, password: string): Promise<void> {
|
||||
await page.getByRole("textbox", { name: "Host password", exact: true }).fill(password);
|
||||
}
|
||||
|
||||
export async function openCompactSettings(page: Page, expectedStartRoute: string): Promise<void> {
|
||||
@@ -422,6 +451,10 @@ export async function fillDirectHostAddress(page: Page, host: string, port: stri
|
||||
await page.getByRole("textbox", { name: "Port", exact: true }).fill(port);
|
||||
}
|
||||
|
||||
export async function pasteIntoDirectHost(page: Page, text: string): Promise<void> {
|
||||
await page.getByRole("textbox", { name: "Host", exact: true }).fill(text);
|
||||
}
|
||||
|
||||
export async function toggleDirectHostSsl(page: Page): Promise<void> {
|
||||
await page.getByRole("checkbox", { name: "Use SSL", exact: true }).click();
|
||||
}
|
||||
@@ -439,6 +472,12 @@ export async function expectDirectHostUriHidden(page: Page): Promise<void> {
|
||||
await expect(page.getByTestId("direct-host-uri-input")).toHaveCount(0);
|
||||
}
|
||||
|
||||
/** The whole form shows above Cancel and Connect, with nothing cut off by the footer. */
|
||||
export async function expectDirectFormFullyVisible(page: Page): Promise<void> {
|
||||
await expect(page.getByTestId("direct-password-input")).toBeInViewport({ ratio: 1 });
|
||||
await expect(page.getByTestId("direct-password-visibility-toggle")).toBeInViewport({ ratio: 1 });
|
||||
}
|
||||
|
||||
export async function expectDiagnosticsContent(page: Page): Promise<void> {
|
||||
await expect(page.getByRole("button", { name: "Run" })).toBeVisible();
|
||||
await expect(page.getByRole("button", { name: "Play test" })).toBeVisible();
|
||||
|
||||
@@ -173,8 +173,11 @@ export async function expectHostConnectingOrOffline(
|
||||
page: Page,
|
||||
options?: { timeout?: number },
|
||||
): Promise<void> {
|
||||
// A host that is still connecting shows the workspace loading state; one that failed says so.
|
||||
await expect(
|
||||
page.getByText(/^Connecting$|localhost is offline|Cannot reach localhost/i),
|
||||
page
|
||||
.getByTestId("workspace-loading")
|
||||
.or(page.getByText(/localhost is offline|Cannot reach localhost/i)),
|
||||
).toBeVisible({ timeout: options?.timeout ?? 30_000 });
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Install runtime polyfills before any other module evaluates. Keep this the first import.
|
||||
// oxlint-disable-next-line import/no-unassigned-import -- Polyfills install on import.
|
||||
import "./src/polyfills/install-early";
|
||||
import { keepNativeSplash } from "./src/native-splash";
|
||||
keepNativeSplash();
|
||||
|
||||
// Configure Unistyles before Expo Router pulls in any components using StyleSheet.
|
||||
import "./src/styles/unistyles";
|
||||
|
||||
@@ -63,6 +63,8 @@ using namespace facebook::react;
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
// The iOS status-bar tap region can overlap app header buttons (#11027).
|
||||
self.scrollView.scrollsToTop = NO;
|
||||
#if defined(__IPHONE_26_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_26_0
|
||||
if (@available(iOS 26.0, *)) {
|
||||
UIScrollView *scrollView = self.scrollView;
|
||||
|
||||
+93
-13
@@ -1,11 +1,13 @@
|
||||
package sh.paseo.terminal
|
||||
|
||||
import android.os.Build
|
||||
import android.text.InputType
|
||||
import android.view.KeyCharacterMap
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SdkSuppress
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
@@ -77,6 +79,15 @@ class TerminalInputConnectionTest {
|
||||
}
|
||||
}
|
||||
|
||||
/** Gboard commits each letter in its own batch edit when the editor disables suggestions. */
|
||||
private fun TerminalInputConnection.typeLikeGboard(text: String) {
|
||||
for (ch in text) {
|
||||
beginBatchEdit()
|
||||
commitText(ch.toString(), 1)
|
||||
endBatchEdit()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun editorInfoDisablesSuggestionsFullscreenAndPersonalizedLearning() {
|
||||
instrumentation.runOnMainSync {
|
||||
@@ -100,13 +111,8 @@ class TerminalInputConnectionTest {
|
||||
@Test
|
||||
fun batchedCommitTextAndSetComposingTextDoNotDoubleCharacters() {
|
||||
withInputHarness { _, ic, _, terminal ->
|
||||
for (ch in listOf("a", "b", "c", "d")) {
|
||||
ic.beginBatchEdit()
|
||||
ic.commitText(ch, 1)
|
||||
ic.endBatchEdit()
|
||||
}
|
||||
ic.typeLikeGboard("abcd")
|
||||
assertEquals("abcd", terminal.rawStream)
|
||||
assertEquals("", ic.editable.toString())
|
||||
|
||||
// Coalesced setComposingText + finishComposingText inside one batch emits once.
|
||||
ic.beginBatchEdit()
|
||||
@@ -114,28 +120,96 @@ class TerminalInputConnectionTest {
|
||||
ic.finishComposingText()
|
||||
ic.endBatchEdit()
|
||||
assertEquals("abcdef", terminal.rawStream)
|
||||
assertEquals("", ic.editable.toString())
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun editorKeepsTheTypedLineUntilTerminalKeyBoundary() {
|
||||
withInputHarness { _, ic, _, terminal ->
|
||||
// IMEs address edits by offsets into the text they committed, so the editor must keep it.
|
||||
ic.typeLikeGboard("ab")
|
||||
assertEquals("ab", ic.getTextBeforeCursor(10, 0).toString())
|
||||
|
||||
// Enter leaves the shell line, so the editor starts the next line empty.
|
||||
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER))
|
||||
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_ENTER))
|
||||
assertEquals("", ic.getTextBeforeCursor(10, 0).toString())
|
||||
|
||||
ic.typeLikeGboard("helo")
|
||||
ic.beginBatchEdit()
|
||||
ic.setComposingRegion(0, 4)
|
||||
ic.commitText("hello ", 1)
|
||||
ic.endBatchEdit()
|
||||
assertEquals("ab\rhello ", terminal.applyToLine())
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun gboardArrowKeyStartsTheEditorOnAnEmptyLine() {
|
||||
withInputHarness { _, ic, _, terminal ->
|
||||
ic.typeLikeGboard("echo helo")
|
||||
// Gboard's editing panel sends arrows as key events. The shell cursor moves, so the
|
||||
// editor's copy of the line no longer matches where the next edit lands.
|
||||
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPAD_LEFT))
|
||||
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DPAD_LEFT))
|
||||
assertEquals("", ic.getTextBeforeCursor(10, 0).toString())
|
||||
assertEquals(listOf("ArrowLeft"), terminal.keys.map { it.key })
|
||||
assertEquals("echo helo", terminal.rawStream)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun suggestionPickedThroughComposingRegionReplacesCommittedWord() {
|
||||
withInputHarness { _, ic, _, terminal ->
|
||||
// Gboard before Android 14 selects the committed word, then commits the suggestion.
|
||||
ic.typeLikeGboard("helo")
|
||||
ic.beginBatchEdit()
|
||||
ic.setComposingRegion(3, 4)
|
||||
ic.commitText("lo ", 1)
|
||||
ic.endBatchEdit()
|
||||
assertEquals("hello ", terminal.applyToLine())
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
|
||||
fun gboardReplaceTextRewritesCommittedText() {
|
||||
// Gboard on Android 14+ picks suggestions and applies double-space period with replaceText,
|
||||
// addressing text it committed earlier. Offsets and texts below are the calls Gboard made live.
|
||||
fun assertReplacement(typed: String, start: Int, end: Int, replacement: String, line: String) {
|
||||
withInputHarness { _, ic, _, terminal ->
|
||||
ic.typeLikeGboard(typed)
|
||||
ic.beginBatchEdit()
|
||||
ic.replaceText(start, end, replacement, 1, null)
|
||||
ic.endBatchEdit()
|
||||
assertEquals("$typed -> $replacement", line, terminal.applyToLine())
|
||||
}
|
||||
}
|
||||
|
||||
assertReplacement("helo", 3, 4, "lo ", line = "hello ")
|
||||
assertReplacement("helo", 3, 4, "p ", line = "help ")
|
||||
assertReplacement("echo hello", 5, 10, "jello ", line = "echo jello ")
|
||||
assertReplacement("ab ", 2, 3, ". ", line = "ab. ")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun backspaceWorksAcrossAllThreeImePaths() {
|
||||
withInputHarness { _, ic, _, terminal ->
|
||||
ic.commitText("abcd", 1)
|
||||
assertEquals("abcd", terminal.applyToLine())
|
||||
|
||||
// Path 1: deleteSurroundingText (empty editable after commit)
|
||||
// Path 1: deleteSurroundingText
|
||||
ic.deleteSurroundingText(0, 0)
|
||||
assertEquals("abcd", terminal.applyToLine())
|
||||
ic.deleteSurroundingText(1, 0)
|
||||
assertEquals("abc", terminal.applyToLine())
|
||||
|
||||
// Path 2: deleteSurroundingTextInCodePoints (empty editable)
|
||||
// Path 2: deleteSurroundingTextInCodePoints
|
||||
ic.deleteSurroundingTextInCodePoints(1, 0)
|
||||
assertEquals("ab", terminal.applyToLine())
|
||||
|
||||
// Path 2b: deleteSurroundingTextInCodePoints on surrogate-pair emoji in composing buffer
|
||||
ic.setComposingText("😀", 1)
|
||||
// Path 2b: deleteSurroundingTextInCodePoints removes a surrogate-pair emoji as one code point
|
||||
ic.commitText("😀", 1)
|
||||
assertEquals("ab😀", terminal.applyToLine())
|
||||
ic.deleteSurroundingTextInCodePoints(1, 0)
|
||||
assertEquals("ab", terminal.applyToLine())
|
||||
@@ -145,10 +219,16 @@ class TerminalInputConnectionTest {
|
||||
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL))
|
||||
assertEquals("a", terminal.applyToLine())
|
||||
|
||||
// Multi-char deleteSurroundingText on empty buffer
|
||||
// Multi-char deleteSurroundingText
|
||||
ic.commitText("xyz", 1)
|
||||
ic.deleteSurroundingText(2, 0)
|
||||
assertEquals("ax", terminal.applyToLine())
|
||||
|
||||
// After Enter the editor is empty, so Backspace still reaches text the shell already holds
|
||||
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER))
|
||||
ic.deleteSurroundingText(1, 0)
|
||||
ic.deleteSurroundingTextInCodePoints(1, 0)
|
||||
assertEquals("\r\u007f\u007f", terminal.rawStream.takeLast(3))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +322,7 @@ class TerminalInputConnectionTest {
|
||||
ic.commitText("the", 1)
|
||||
assertEquals("hellothe", terminal.applyToLine())
|
||||
|
||||
// Repeated clipboard paste of identical text works because editable clears after commit
|
||||
// Repeated clipboard paste of identical text appends both copies
|
||||
ic.commitText("echo ok", 1)
|
||||
ic.commitText("echo ok", 1)
|
||||
assertEquals("hellotheecho okecho ok", terminal.applyToLine())
|
||||
|
||||
+33
-48
@@ -22,9 +22,16 @@ internal data class TerminalKeyPayload(
|
||||
/**
|
||||
* Single authoritative IME + key stream for the Android native terminal.
|
||||
*
|
||||
* Keeps a private [SpannableStringBuilder] so Android IMEs can compose Hangul, Pinyin, and Latin
|
||||
* candidates normally, diffs the editable against what was last sent to the PTY once each batch
|
||||
* edit settles, and clears the editable as soon as no composing span remains.
|
||||
* The private [SpannableStringBuilder] holds the text the IME has typed on the current shell line,
|
||||
* committed and composing alike. IMEs keep their own copy of that text and edit it by offset:
|
||||
* Gboard picks a suggestion or applies double-space period by replacing text it committed
|
||||
* earlier. Once each batch edit settles, the editable is diffed against what the terminal already
|
||||
* holds and only the difference is sent, as rubouts plus the new suffix.
|
||||
*
|
||||
* A terminal key (Enter, Tab, Escape, arrows, control and hardware characters) changes the shell
|
||||
* line outside the IME, so it empties the editable and restarts the IME on the empty line.
|
||||
* Keys sent to the terminal without passing through this connection do not empty it: the
|
||||
* accessory bar, and the hardware arrows that `PaseoHardwareKeyboardModule` claims at window level.
|
||||
*/
|
||||
internal class TerminalInputConnection(
|
||||
private val targetView: View,
|
||||
@@ -196,6 +203,7 @@ internal class TerminalInputConnection(
|
||||
KeyEvent.KEYCODE_DPAD_LEFT,
|
||||
KeyEvent.KEYCODE_DPAD_RIGHT -> {
|
||||
deadAccent = 0
|
||||
flushAndClear()
|
||||
val name = when (keyCode) {
|
||||
KeyEvent.KEYCODE_DPAD_UP -> "ArrowUp"
|
||||
KeyEvent.KEYCODE_DPAD_DOWN -> "ArrowDown"
|
||||
@@ -342,57 +350,38 @@ internal class TerminalInputConnection(
|
||||
if (diff.isNotEmpty()) {
|
||||
out.append(normalizeLineEndings(diff))
|
||||
}
|
||||
lastSentText = currentText
|
||||
|
||||
val compStart = getComposingSpanStart(sharedEditable)
|
||||
val compEnd = getComposingSpanEnd(sharedEditable)
|
||||
val isComposing = compStart >= 0 && compEnd > compStart
|
||||
|
||||
if (!isComposing) {
|
||||
val hadText = sharedEditable.isNotEmpty()
|
||||
if (hadText || compStart >= 0) {
|
||||
clearEditableSilently()
|
||||
}
|
||||
lastSentText = ""
|
||||
if (hadText) {
|
||||
// The IME just advanced its cursor for the committed text; report the reset to 0, 0.
|
||||
forceUpdateSelection(0, 0, -1, -1)
|
||||
} else {
|
||||
notifySelectionIfChanged(0, 0, -1, -1)
|
||||
}
|
||||
} else {
|
||||
lastSentText = currentText
|
||||
val selStart = maxOf(0, Selection.getSelectionStart(sharedEditable))
|
||||
val selEnd = maxOf(0, Selection.getSelectionEnd(sharedEditable))
|
||||
notifySelectionIfChanged(selStart, selEnd, compStart, compEnd)
|
||||
var compStart = getComposingSpanStart(sharedEditable)
|
||||
var compEnd = getComposingSpanEnd(sharedEditable)
|
||||
if (compStart >= 0 && compEnd <= compStart) {
|
||||
// An empty composing span would make hardware arrows look like IME navigation.
|
||||
removeComposingSpans(sharedEditable)
|
||||
compStart = -1
|
||||
compEnd = -1
|
||||
}
|
||||
notifySelectionIfChanged(
|
||||
maxOf(0, Selection.getSelectionStart(sharedEditable)),
|
||||
maxOf(0, Selection.getSelectionEnd(sharedEditable)),
|
||||
compStart,
|
||||
compEnd,
|
||||
)
|
||||
|
||||
if (out.isNotEmpty()) {
|
||||
onInput(out.toString())
|
||||
}
|
||||
}
|
||||
|
||||
/** Sends pending IME text, then starts the IME on an empty line before a terminal key. */
|
||||
private fun flushAndClear() {
|
||||
batchEditDepth = 0
|
||||
val hadText = sharedEditable.isNotEmpty()
|
||||
val out = StringBuilder()
|
||||
if (pendingBackspaces > 0) {
|
||||
repeat(pendingBackspaces) { out.append('\u007f') }
|
||||
pendingBackspaces = 0
|
||||
}
|
||||
val currentText = sharedEditable.toString()
|
||||
val diff = computeDiff(lastSentText, currentText)
|
||||
if (diff.isNotEmpty()) {
|
||||
out.append(normalizeLineEndings(diff))
|
||||
}
|
||||
if (hadText || getComposingSpanStart(sharedEditable) >= 0) {
|
||||
clearEditableSilently()
|
||||
}
|
||||
lastSentText = ""
|
||||
if (hadText || lastSelStart != 0 || lastSelEnd != 0 || lastCompStart != -1 || lastCompEnd != -1) {
|
||||
forceUpdateSelection(0, 0, -1, -1)
|
||||
}
|
||||
if (out.isNotEmpty()) {
|
||||
onInput(out.toString())
|
||||
flush()
|
||||
if (sharedEditable.isEmpty()) return
|
||||
resetState()
|
||||
// The IME still holds the old line; updateSelection alone does not make Gboard reload it.
|
||||
val imm = targetView.context.getSystemService(InputMethodManager::class.java) ?: return
|
||||
if (imm.isActive(targetView)) {
|
||||
imm.restartInput(targetView)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,10 +400,6 @@ internal class TerminalInputConnection(
|
||||
) {
|
||||
return
|
||||
}
|
||||
forceUpdateSelection(selStart, selEnd, compStart, compEnd)
|
||||
}
|
||||
|
||||
private fun forceUpdateSelection(selStart: Int, selEnd: Int, compStart: Int, compEnd: Int) {
|
||||
lastSelStart = selStart
|
||||
lastSelEnd = selEnd
|
||||
lastCompStart = compStart
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/app",
|
||||
"version": "0.18.1",
|
||||
"version": "0.18.2",
|
||||
"private": true,
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
const { AndroidConfig, withAndroidStyles } = require("expo/config-plugins");
|
||||
|
||||
// The activity window shows under the splash while it fades out and until React
|
||||
// paints. Expo's AppTheme sets no window background, so Android paints the
|
||||
// AppCompat default (#303030 in dark mode, #fafafa in light mode) there.
|
||||
// expo-splash-screen already defines `splashscreen_background` for day and night,
|
||||
// so pointing the window at it keeps one colour from launch to the first screen.
|
||||
const WINDOW_BACKGROUND = "@color/splashscreen_background";
|
||||
|
||||
function withAndroidSplashWindowBackground(config) {
|
||||
return withAndroidStyles(config, (modConfig) => {
|
||||
modConfig.modResults = AndroidConfig.Styles.assignStylesValue(modConfig.modResults, {
|
||||
add: true,
|
||||
parent: AndroidConfig.Styles.getAppThemeGroup(),
|
||||
name: "android:windowBackground",
|
||||
value: WINDOW_BACKGROUND,
|
||||
});
|
||||
return modConfig;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = withAndroidSplashWindowBackground;
|
||||
@@ -3,9 +3,12 @@ import { useTranslation } from "react-i18next";
|
||||
import { i18n } from "@/i18n/i18next";
|
||||
import { useProviderIcon } from "@/components/provider-icons";
|
||||
import type { PanelDescriptor } from "@/panels/panel-registry";
|
||||
import { resolveAgentLabel } from "@/panels/tab-labels";
|
||||
import { useSessionStore, selectAgentTurnPresentation, type Agent } from "@/stores/session-store";
|
||||
import { deriveSidebarStateBucket } from "@/utils/sidebar-agent-state";
|
||||
|
||||
export { resolveAgentLabel };
|
||||
|
||||
function formatProviderLabel(provider: Agent["provider"]): string {
|
||||
if (!provider) {
|
||||
return "Agent";
|
||||
@@ -17,20 +20,6 @@ function formatProviderLabel(provider: Agent["provider"]): string {
|
||||
.join(" ");
|
||||
}
|
||||
|
||||
export function resolveAgentLabel(title: string | null | undefined): string | null {
|
||||
if (typeof title !== "string") {
|
||||
return null;
|
||||
}
|
||||
const normalized = title.trim();
|
||||
if (!normalized) {
|
||||
return null;
|
||||
}
|
||||
if (normalized.toLowerCase() === "new agent") {
|
||||
return null;
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
export function useAgentDescriptor(
|
||||
target: { kind: "agent"; agentId: string },
|
||||
context: { serverId: string },
|
||||
|
||||
@@ -23,7 +23,15 @@ export interface DraftAgentProfileControls {
|
||||
}
|
||||
|
||||
export type AgentProfileApplyTarget =
|
||||
| { kind: "agent"; agentId: string; availableModeIds: readonly string[] | null }
|
||||
| {
|
||||
kind: "agent";
|
||||
agentId: string;
|
||||
availableModeIds: readonly string[] | null;
|
||||
currentProvider?: string | null;
|
||||
isSwitchInFlight?: () => boolean;
|
||||
onApplySameProvider?: () => void;
|
||||
onStageProviderSwitch?: (profile: MaterializedAgentProfile) => void;
|
||||
}
|
||||
| { kind: "draft"; controls: DraftAgentProfileControls };
|
||||
|
||||
/** Everything the model picker renders for one profile. It never sees the profile itself. */
|
||||
@@ -43,6 +51,8 @@ export interface AgentProfilePickerRow {
|
||||
export interface AgentProfilePicker {
|
||||
rows: AgentProfilePickerRow[];
|
||||
applyProfile: (profileId: string) => void;
|
||||
/** What a picked profile configures: a running agent, or the draft of a new one. */
|
||||
target: AgentProfileApplyTarget["kind"];
|
||||
}
|
||||
|
||||
export interface UseAgentProfilePickerInput {
|
||||
@@ -146,6 +156,16 @@ export function useAgentProfilePicker(
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
target.onStageProviderSwitch &&
|
||||
(target.isSwitchInFlight?.() ||
|
||||
(target.currentProvider && resolved.provider !== target.currentProvider))
|
||||
) {
|
||||
target.onStageProviderSwitch(resolved);
|
||||
return;
|
||||
}
|
||||
|
||||
target.onApplySameProvider?.();
|
||||
const reconciled = reconcileMaterializedProfileMode(resolved, target.availableModeIds);
|
||||
if (!reconciled) {
|
||||
return;
|
||||
@@ -155,7 +175,11 @@ export function useAgentProfilePicker(
|
||||
return;
|
||||
}
|
||||
void client
|
||||
.applyAgentConfig(target.agentId, toAgentConfigApply(reconciled))
|
||||
.applyAgentConfig(
|
||||
target.agentId,
|
||||
toAgentConfigApply(reconciled),
|
||||
target.currentProvider ? { expectedProvider: target.currentProvider } : undefined,
|
||||
)
|
||||
.then((notice) => showProviderNoticeToast(toast, notice))
|
||||
.catch((error) => {
|
||||
console.warn("[useAgentProfilePicker] applyAgentConfig failed", error);
|
||||
@@ -166,7 +190,7 @@ export function useAgentProfilePicker(
|
||||
);
|
||||
|
||||
return useMemo(
|
||||
() => (isSupported && profiles !== null ? { rows, applyProfile } : null),
|
||||
[applyProfile, isSupported, profiles, rows],
|
||||
() => (isSupported && profiles !== null ? { rows, applyProfile, target: target.kind } : null),
|
||||
[applyProfile, isSupported, profiles, rows, target.kind],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
import { expect, test } from "vitest";
|
||||
import type { PaseoAgentQueueItem } from "@getpaseo/client";
|
||||
import type { SessionOutboundMessage } from "@getpaseo/protocol/messages";
|
||||
import { createHostAgentQueueModel } from "./host";
|
||||
|
||||
interface Observer {
|
||||
snapshot(): void;
|
||||
update(message: SessionOutboundMessage): void;
|
||||
error(error: unknown): void;
|
||||
}
|
||||
|
||||
function item(id: string): PaseoAgentQueueItem {
|
||||
return {
|
||||
id,
|
||||
seq: 1,
|
||||
enqueuedAt: "2026-11-30T00:00:00.000Z",
|
||||
text: `message ${id}`,
|
||||
sender: { kind: "user" },
|
||||
held: false,
|
||||
state: "queued",
|
||||
};
|
||||
}
|
||||
|
||||
/** A host runtime plus the daemon client it hands out. */
|
||||
function fakeHost(options: { supportsQueue: boolean }) {
|
||||
let connected = false;
|
||||
let notify = () => {};
|
||||
const observers: Observer[] = [];
|
||||
const calls: unknown[][] = [];
|
||||
let releases = 0;
|
||||
let queue = [item("a")];
|
||||
const client = {
|
||||
getLastServerInfoMessage: () =>
|
||||
connected ? { features: { agentMessageQueue: options.supportsQueue } } : null,
|
||||
listAgentQueue: async (agentId: string) => {
|
||||
calls.push(["list", agentId]);
|
||||
return { held: false, items: queue };
|
||||
},
|
||||
withdrawAgentQueueItem: async (agentId: string, messageId: string) => {
|
||||
calls.push(["withdraw", agentId, messageId]);
|
||||
return { withdrawn: true as const, item: item(messageId) };
|
||||
},
|
||||
promoteAgentQueueItem: async (agentId: string, messageId: string, behavior: string) => {
|
||||
calls.push(["promote", agentId, messageId, behavior]);
|
||||
return { promoted: true as const };
|
||||
},
|
||||
observeAgentQueue: () => ({
|
||||
subscribe: (observer: Observer) => {
|
||||
observers.push(observer);
|
||||
},
|
||||
release: async () => {
|
||||
releases++;
|
||||
},
|
||||
}),
|
||||
};
|
||||
return {
|
||||
host: {
|
||||
getClient: () => client,
|
||||
subscribe: (listener: () => void) => {
|
||||
notify = listener;
|
||||
return () => {};
|
||||
},
|
||||
},
|
||||
observers,
|
||||
calls,
|
||||
releases: () => releases,
|
||||
setQueue: (next: PaseoAgentQueueItem[]) => {
|
||||
queue = next;
|
||||
},
|
||||
connect: () => {
|
||||
connected = true;
|
||||
notify();
|
||||
},
|
||||
disconnect: () => {
|
||||
connected = false;
|
||||
notify();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async function settle(): Promise<void> {
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
}
|
||||
|
||||
function queueUpdate(agentId: string, items: PaseoAgentQueueItem[]): SessionOutboundMessage {
|
||||
return { type: "agent.queue.update", payload: { agentId, held: false, items } };
|
||||
}
|
||||
|
||||
test("lists on connect, follows its own agent's updates, and lists again on reconnect", async () => {
|
||||
const runtime = fakeHost({ supportsQueue: true });
|
||||
const model = createHostAgentQueueModel("host", "agent", runtime.host);
|
||||
const unsubscribe = model.subscribe(() => {});
|
||||
expect(runtime.observers).toHaveLength(0);
|
||||
|
||||
runtime.connect();
|
||||
runtime.observers[0].snapshot();
|
||||
await settle();
|
||||
expect(model.getSnapshot()).toMatchObject({ status: "ready", items: [item("a")] });
|
||||
|
||||
runtime.observers[0].update(queueUpdate("other-agent", []));
|
||||
expect(model.getSnapshot().items).toEqual([item("a")]);
|
||||
runtime.observers[0].update(queueUpdate("agent", [item("a"), item("b")]));
|
||||
expect(model.getSnapshot().items).toEqual([item("a"), item("b")]);
|
||||
|
||||
runtime.disconnect();
|
||||
expect(model.getSnapshot()).toMatchObject({ status: "stale", items: [item("a"), item("b")] });
|
||||
expect(runtime.releases()).toBe(1);
|
||||
|
||||
runtime.setQueue([]);
|
||||
runtime.connect();
|
||||
runtime.observers[1].snapshot();
|
||||
await settle();
|
||||
expect(model.getSnapshot()).toMatchObject({ status: "ready", items: [] });
|
||||
runtime.observers[0].update(queueUpdate("agent", [item("late")]));
|
||||
expect(model.getSnapshot().items).toEqual([]);
|
||||
unsubscribe();
|
||||
});
|
||||
|
||||
test("sends withdraw and promote for the observed agent", async () => {
|
||||
const runtime = fakeHost({ supportsQueue: true });
|
||||
const model = createHostAgentQueueModel("host", "agent", runtime.host);
|
||||
const unsubscribe = model.subscribe(() => {});
|
||||
runtime.connect();
|
||||
runtime.observers[0].update(queueUpdate("agent", [item("a"), item("b")]));
|
||||
|
||||
await model.promote("b", "interrupt");
|
||||
await model.withdraw("a");
|
||||
|
||||
expect(runtime.calls).toEqual([
|
||||
["promote", "agent", "b", "interrupt"],
|
||||
["withdraw", "agent", "a"],
|
||||
]);
|
||||
unsubscribe();
|
||||
});
|
||||
|
||||
test("rejects a command while the host is disconnected", async () => {
|
||||
const runtime = fakeHost({ supportsQueue: true });
|
||||
const model = createHostAgentQueueModel("host", "agent", runtime.host);
|
||||
const unsubscribe = model.subscribe(() => {});
|
||||
runtime.connect();
|
||||
runtime.observers[0].update(queueUpdate("agent", [item("a")]));
|
||||
runtime.disconnect();
|
||||
|
||||
await expect(model.withdraw("a")).rejects.toThrow("Host disconnected");
|
||||
expect(runtime.calls).toEqual([]);
|
||||
unsubscribe();
|
||||
});
|
||||
|
||||
test("has no queue and asks nothing of a host without the feature", async () => {
|
||||
const runtime = fakeHost({ supportsQueue: false });
|
||||
const model = createHostAgentQueueModel("host", "agent", runtime.host);
|
||||
const unsubscribe = model.subscribe(() => {});
|
||||
|
||||
runtime.connect();
|
||||
await settle();
|
||||
|
||||
expect(model.getSnapshot()).toMatchObject({ status: "ready", items: [] });
|
||||
expect(runtime.observers).toHaveLength(0);
|
||||
expect(runtime.calls).toEqual([]);
|
||||
unsubscribe();
|
||||
});
|
||||
@@ -0,0 +1,118 @@
|
||||
import type {
|
||||
PaseoAgentQueuePromoteResult,
|
||||
PaseoAgentQueueState,
|
||||
PaseoAgentQueueWithdrawResult,
|
||||
} from "@getpaseo/client";
|
||||
import type { ActiveTurnBehavior, SessionOutboundMessage } from "@getpaseo/protocol/messages";
|
||||
import { getHostRuntimeStore } from "@/runtime/host-runtime";
|
||||
import { createAgentQueueModel, type AgentQueueModel } from "./model";
|
||||
|
||||
interface AgentQueueClient {
|
||||
getLastServerInfoMessage(): { features?: { agentMessageQueue?: boolean } | null } | null;
|
||||
listAgentQueue(agentId: string): Promise<PaseoAgentQueueState>;
|
||||
withdrawAgentQueueItem(
|
||||
agentId: string,
|
||||
messageId: string,
|
||||
): Promise<PaseoAgentQueueWithdrawResult>;
|
||||
promoteAgentQueueItem(
|
||||
agentId: string,
|
||||
messageId: string,
|
||||
activeTurnBehavior: ActiveTurnBehavior,
|
||||
): Promise<PaseoAgentQueuePromoteResult>;
|
||||
observeAgentQueue(): {
|
||||
subscribe(observer: {
|
||||
snapshot(): void;
|
||||
update(message: SessionOutboundMessage): void;
|
||||
error(error: unknown): void;
|
||||
}): unknown;
|
||||
release(): Promise<void>;
|
||||
};
|
||||
}
|
||||
|
||||
interface AgentQueueHost {
|
||||
getClient(): AgentQueueClient | null;
|
||||
subscribe(listener: () => void): () => void;
|
||||
}
|
||||
|
||||
function hostFor(serverId: string): AgentQueueHost {
|
||||
const host = getHostRuntimeStore();
|
||||
return {
|
||||
getClient: () => host.getSnapshot(serverId)?.client ?? null,
|
||||
subscribe: (listener) => host.subscribe(serverId, listener),
|
||||
};
|
||||
}
|
||||
|
||||
export function createHostAgentQueueModel(
|
||||
serverId: string,
|
||||
agentId: string,
|
||||
host: AgentQueueHost = hostFor(serverId),
|
||||
): AgentQueueModel {
|
||||
let client: AgentQueueClient | null = null;
|
||||
const connected = () => {
|
||||
if (!client) throw new Error("Host disconnected");
|
||||
return client;
|
||||
};
|
||||
return createAgentQueueModel({
|
||||
list: async () => connected().listAgentQueue(agentId),
|
||||
withdraw: async (messageId) => connected().withdrawAgentQueueItem(agentId, messageId),
|
||||
promote: async (messageId, activeTurnBehavior) =>
|
||||
connected().promoteAgentQueueItem(agentId, messageId, activeTurnBehavior),
|
||||
observe: ({ snapshot, update, disconnected, failed }) => {
|
||||
let release: (() => void) | undefined;
|
||||
let currentObservation: ReturnType<AgentQueueClient["observeAgentQueue"]> | undefined;
|
||||
const sync = () => {
|
||||
const candidate = host.getClient();
|
||||
// The runtime keeps the client across reconnects, but clears server info until handshake.
|
||||
const next = candidate?.getLastServerInfoMessage() ? candidate : null;
|
||||
if (next === client) return;
|
||||
const previousRelease = release;
|
||||
client = next;
|
||||
release = undefined;
|
||||
disconnected();
|
||||
previousRelease?.();
|
||||
if (!client) return;
|
||||
// COMPAT(agentMessageQueue): added in v0.18.2, remove gate after 2027-06-01.
|
||||
if (client.getLastServerInfoMessage()?.features?.agentMessageQueue !== true) {
|
||||
update({ held: false, items: [] });
|
||||
return;
|
||||
}
|
||||
const observedClient = client;
|
||||
const observation = client.observeAgentQueue();
|
||||
currentObservation = observation;
|
||||
const isCurrent = () => client === observedClient && currentObservation === observation;
|
||||
observation.subscribe({
|
||||
snapshot: () => {
|
||||
if (isCurrent()) snapshot();
|
||||
},
|
||||
update: (message) => {
|
||||
if (
|
||||
isCurrent() &&
|
||||
message.type === "agent.queue.update" &&
|
||||
message.payload.agentId === agentId
|
||||
) {
|
||||
update({ held: message.payload.held, items: message.payload.items });
|
||||
}
|
||||
},
|
||||
error: () => {
|
||||
if (isCurrent()) failed();
|
||||
},
|
||||
});
|
||||
release = () => {
|
||||
if (currentObservation === observation) currentObservation = undefined;
|
||||
void observation
|
||||
.release()
|
||||
.catch((error: unknown) =>
|
||||
console.error("Agent queue subscription cleanup failed", error),
|
||||
);
|
||||
};
|
||||
};
|
||||
const unsubscribe = host.subscribe(sync);
|
||||
sync();
|
||||
return () => {
|
||||
unsubscribe();
|
||||
client = null;
|
||||
release?.();
|
||||
};
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { useMemo, useSyncExternalStore } from "react";
|
||||
import { createHostAgentQueueModel } from "./host";
|
||||
import type { AgentQueueModel, AgentQueueSnapshot } from "./model";
|
||||
|
||||
export type { AgentQueueModel, AgentQueueSnapshot } from "./model";
|
||||
|
||||
/** Observes one agent's queue for as long as the caller is mounted. */
|
||||
export function useAgentQueue(
|
||||
serverId: string,
|
||||
agentId: string,
|
||||
): { model: AgentQueueModel; queue: AgentQueueSnapshot } {
|
||||
const model = useMemo(() => createHostAgentQueueModel(serverId, agentId), [serverId, agentId]);
|
||||
const queue = useSyncExternalStore(model.subscribe, model.getSnapshot, model.getSnapshot);
|
||||
return { model, queue };
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
import { expect, test } from "vitest";
|
||||
import type {
|
||||
PaseoAgentQueueItem,
|
||||
PaseoAgentQueueState,
|
||||
PaseoAgentQueueWithdrawResult,
|
||||
} from "@getpaseo/client";
|
||||
import { createAgentQueueModel, type AgentQueuePort } from "./model";
|
||||
|
||||
function item(id: string, patch: Partial<PaseoAgentQueueItem> = {}): PaseoAgentQueueItem {
|
||||
return {
|
||||
id,
|
||||
seq: 1,
|
||||
enqueuedAt: "2026-11-30T00:00:00.000Z",
|
||||
text: `message ${id}`,
|
||||
sender: { kind: "user" },
|
||||
held: false,
|
||||
state: "queued",
|
||||
...patch,
|
||||
};
|
||||
}
|
||||
|
||||
interface Deferred<T> {
|
||||
promise: Promise<T>;
|
||||
resolve(value: T): void;
|
||||
reject(error: Error): void;
|
||||
}
|
||||
|
||||
function deferred<T>(): Deferred<T> {
|
||||
let resolve!: (value: T) => void;
|
||||
let reject!: (error: Error) => void;
|
||||
const promise = new Promise<T>((done, fail) => {
|
||||
resolve = done;
|
||||
reject = fail;
|
||||
});
|
||||
return { promise, resolve, reject };
|
||||
}
|
||||
|
||||
/** A host queue the test drives: it records commands and answers them when told to. */
|
||||
function fakeQueueHost() {
|
||||
const lists: Deferred<PaseoAgentQueueState>[] = [];
|
||||
const withdrawals: Array<{ messageId: string } & Deferred<PaseoAgentQueueWithdrawResult>> = [];
|
||||
const promotions: Array<{ messageId: string; behavior: string }> = [];
|
||||
let callbacks: Parameters<AgentQueuePort["observe"]>[0] | null = null;
|
||||
const port: AgentQueuePort = {
|
||||
list: () => {
|
||||
const read = deferred<PaseoAgentQueueState>();
|
||||
lists.push(read);
|
||||
return read.promise;
|
||||
},
|
||||
withdraw: (messageId) => {
|
||||
const request = deferred<PaseoAgentQueueWithdrawResult>();
|
||||
withdrawals.push({ messageId, ...request });
|
||||
return request.promise;
|
||||
},
|
||||
promote: async (messageId, behavior) => {
|
||||
promotions.push({ messageId, behavior });
|
||||
return { promoted: true };
|
||||
},
|
||||
observe: (next) => {
|
||||
callbacks = next;
|
||||
return () => {
|
||||
callbacks = null;
|
||||
};
|
||||
},
|
||||
};
|
||||
return {
|
||||
port,
|
||||
lists,
|
||||
withdrawals,
|
||||
promotions,
|
||||
isObserved: () => callbacks !== null,
|
||||
connect: () => callbacks?.snapshot(),
|
||||
disconnect: () => callbacks?.disconnected(),
|
||||
fail: () => callbacks?.failed(),
|
||||
publish: (queue: PaseoAgentQueueState) => callbacks?.update(queue),
|
||||
};
|
||||
}
|
||||
|
||||
async function settle(): Promise<void> {
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
}
|
||||
|
||||
test("hydrates the queue the host holds when observation starts", async () => {
|
||||
const host = fakeQueueHost();
|
||||
const model = createAgentQueueModel(host.port);
|
||||
const unsubscribe = model.subscribe(() => {});
|
||||
expect(model.getSnapshot()).toMatchObject({ status: "loading", held: false, items: [] });
|
||||
|
||||
host.connect();
|
||||
host.lists[0].resolve({ held: true, items: [item("a", { held: true })] });
|
||||
await settle();
|
||||
|
||||
expect(model.getSnapshot()).toMatchObject({
|
||||
status: "ready",
|
||||
held: true,
|
||||
items: [item("a", { held: true })],
|
||||
});
|
||||
unsubscribe();
|
||||
expect(host.isObserved()).toBe(false);
|
||||
});
|
||||
|
||||
test("replaces the whole queue with each live update, ahead of a slower list", async () => {
|
||||
const host = fakeQueueHost();
|
||||
const model = createAgentQueueModel(host.port);
|
||||
const unsubscribe = model.subscribe(() => {});
|
||||
host.connect();
|
||||
|
||||
host.publish({ held: false, items: [item("a"), item("b", { seq: 2 })] });
|
||||
host.lists[0].resolve({ held: false, items: [] });
|
||||
await settle();
|
||||
|
||||
expect(model.getSnapshot().items.map((entry) => entry.id)).toEqual(["a", "b"]);
|
||||
host.publish({ held: false, items: [item("b", { seq: 2 })] });
|
||||
expect(model.getSnapshot().items.map((entry) => entry.id)).toEqual(["b"]);
|
||||
unsubscribe();
|
||||
});
|
||||
|
||||
test("keeps the last rows while disconnected and reads the queue again on reconnect", async () => {
|
||||
const host = fakeQueueHost();
|
||||
const model = createAgentQueueModel(host.port);
|
||||
const unsubscribe = model.subscribe(() => {});
|
||||
host.connect();
|
||||
host.lists[0].resolve({ held: false, items: [item("a")] });
|
||||
await settle();
|
||||
|
||||
host.disconnect();
|
||||
expect(model.getSnapshot()).toMatchObject({ status: "stale", items: [item("a")] });
|
||||
host.connect();
|
||||
host.lists[1].resolve({ held: false, items: [] });
|
||||
await settle();
|
||||
|
||||
expect(model.getSnapshot()).toMatchObject({ status: "ready", items: [] });
|
||||
unsubscribe();
|
||||
});
|
||||
|
||||
test("offers a retry when the queue cannot be read", async () => {
|
||||
const host = fakeQueueHost();
|
||||
const model = createAgentQueueModel(host.port);
|
||||
const unsubscribe = model.subscribe(() => {});
|
||||
host.connect();
|
||||
host.lists[0].reject(new Error("timeout"));
|
||||
await settle();
|
||||
expect(model.getSnapshot().status).toBe("error");
|
||||
|
||||
model.retry();
|
||||
host.lists[1].resolve({ held: false, items: [item("a")] });
|
||||
await settle();
|
||||
|
||||
expect(model.getSnapshot()).toMatchObject({ status: "ready", items: [item("a")] });
|
||||
unsubscribe();
|
||||
});
|
||||
|
||||
test("marks a row busy while it is withdrawn and returns the withdrawn message", async () => {
|
||||
const host = fakeQueueHost();
|
||||
const model = createAgentQueueModel(host.port);
|
||||
const unsubscribe = model.subscribe(() => {});
|
||||
host.publish({ held: false, items: [item("a"), item("b", { seq: 2 })] });
|
||||
|
||||
const first = model.withdraw("a");
|
||||
const second = model.withdraw("a");
|
||||
expect(model.getSnapshot().busy).toEqual(new Set(["a"]));
|
||||
host.withdrawals[0].resolve({ withdrawn: true, item: item("a") });
|
||||
|
||||
expect(await first).toEqual({ withdrawn: true, item: item("a") });
|
||||
expect(await second).toBeNull();
|
||||
expect(host.withdrawals).toHaveLength(1);
|
||||
expect(model.getSnapshot().busy).toEqual(new Set());
|
||||
expect(model.getSnapshot().items.map((entry) => entry.id)).toEqual(["b"]);
|
||||
unsubscribe();
|
||||
});
|
||||
|
||||
test("keeps the row when the host already started sending it", async () => {
|
||||
const host = fakeQueueHost();
|
||||
const model = createAgentQueueModel(host.port);
|
||||
const unsubscribe = model.subscribe(() => {});
|
||||
host.publish({ held: false, items: [item("a")] });
|
||||
|
||||
const result = model.withdraw("a");
|
||||
host.withdrawals[0].resolve({ withdrawn: false, reason: "already_dispatching" });
|
||||
|
||||
expect(await result).toEqual({ withdrawn: false, reason: "already_dispatching" });
|
||||
expect(model.getSnapshot().items.map((entry) => entry.id)).toEqual(["a"]);
|
||||
expect(model.getSnapshot().busy).toEqual(new Set());
|
||||
unsubscribe();
|
||||
});
|
||||
|
||||
test("releases the row and reports the error when a command fails", async () => {
|
||||
const host = fakeQueueHost();
|
||||
const model = createAgentQueueModel(host.port);
|
||||
const unsubscribe = model.subscribe(() => {});
|
||||
host.publish({ held: false, items: [item("a")] });
|
||||
|
||||
const result = model.withdraw("a");
|
||||
host.withdrawals[0].reject(new Error("Host disconnected"));
|
||||
|
||||
await expect(result).rejects.toThrow("Host disconnected");
|
||||
expect(model.getSnapshot().busy).toEqual(new Set());
|
||||
unsubscribe();
|
||||
});
|
||||
|
||||
test("promotes a row with the chosen send behavior", async () => {
|
||||
const host = fakeQueueHost();
|
||||
const model = createAgentQueueModel(host.port);
|
||||
const unsubscribe = model.subscribe(() => {});
|
||||
host.publish({ held: true, items: [item("a", { held: true })] });
|
||||
|
||||
expect(await model.promote("a", "steer")).toEqual({ promoted: true });
|
||||
expect(host.promotions).toEqual([{ messageId: "a", behavior: "steer" }]);
|
||||
unsubscribe();
|
||||
});
|
||||
@@ -0,0 +1,145 @@
|
||||
import type {
|
||||
PaseoAgentQueueItem,
|
||||
PaseoAgentQueuePromoteResult,
|
||||
PaseoAgentQueueState,
|
||||
PaseoAgentQueueWithdrawResult,
|
||||
} from "@getpaseo/client";
|
||||
import type { ActiveTurnBehavior } from "@getpaseo/protocol/messages";
|
||||
|
||||
export interface AgentQueuePort {
|
||||
list(): Promise<PaseoAgentQueueState>;
|
||||
withdraw(messageId: string): Promise<PaseoAgentQueueWithdrawResult>;
|
||||
promote(
|
||||
messageId: string,
|
||||
activeTurnBehavior: ActiveTurnBehavior,
|
||||
): Promise<PaseoAgentQueuePromoteResult>;
|
||||
observe(callbacks: {
|
||||
snapshot(): void;
|
||||
disconnected(): void;
|
||||
failed(): void;
|
||||
update(queue: PaseoAgentQueueState): void;
|
||||
}): () => void;
|
||||
}
|
||||
|
||||
export interface AgentQueueSnapshot {
|
||||
status: "loading" | "stale" | "ready" | "error";
|
||||
/** The host waits for Send now or the next prompt before it sends these. */
|
||||
held: boolean;
|
||||
/** Admission order. The first row is sent next. */
|
||||
items: PaseoAgentQueueItem[];
|
||||
/** Rows with a command in flight. */
|
||||
busy: ReadonlySet<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* One agent's queue as the host holds it. The host is the only writer: every update replaces
|
||||
* the rows, and a command changes nothing here until the host answers it.
|
||||
*/
|
||||
export function createAgentQueueModel(port: AgentQueuePort) {
|
||||
let state: AgentQueueSnapshot = {
|
||||
status: "loading",
|
||||
held: false,
|
||||
items: [],
|
||||
busy: new Set(),
|
||||
};
|
||||
let hasRead = false;
|
||||
let sequence = 0;
|
||||
let stop: (() => void) | undefined;
|
||||
let observationFailed = false;
|
||||
const listeners = new Set<() => void>();
|
||||
|
||||
const publish = (patch: Partial<AgentQueueSnapshot>) => {
|
||||
state = { ...state, ...patch };
|
||||
for (const listener of listeners) listener();
|
||||
};
|
||||
const replace = (queue: PaseoAgentQueueState) => {
|
||||
hasRead = true;
|
||||
publish({ status: "ready", held: queue.held, items: queue.items });
|
||||
};
|
||||
const pending = () => (hasRead ? "stale" : "loading");
|
||||
const refresh = async () => {
|
||||
const request = ++sequence;
|
||||
publish({ status: pending() });
|
||||
try {
|
||||
const queue = await port.list();
|
||||
if (request === sequence) replace(queue);
|
||||
} catch {
|
||||
if (request === sequence) publish({ status: "error" });
|
||||
}
|
||||
};
|
||||
const start = () => {
|
||||
observationFailed = false;
|
||||
stop = port.observe({
|
||||
snapshot: () => {
|
||||
void refresh();
|
||||
},
|
||||
disconnected: () => {
|
||||
sequence++;
|
||||
publish({ status: pending() });
|
||||
},
|
||||
failed: () => {
|
||||
observationFailed = true;
|
||||
sequence++;
|
||||
publish({ status: "error" });
|
||||
},
|
||||
update: (queue) => {
|
||||
sequence++;
|
||||
replace(queue);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/** Runs one command per row at a time. Returns null when the row cannot take one. */
|
||||
const command = async <T>(messageId: string, run: () => Promise<T>): Promise<T | null> => {
|
||||
const row = state.items.find((entry) => entry.id === messageId);
|
||||
if (!row || row.state === "dispatching" || state.busy.has(messageId)) return null;
|
||||
publish({ busy: new Set(state.busy).add(messageId) });
|
||||
try {
|
||||
return await run();
|
||||
} finally {
|
||||
const busy = new Set(state.busy);
|
||||
busy.delete(messageId);
|
||||
publish({ busy });
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
getSnapshot: () => state,
|
||||
withdraw: (messageId: string) =>
|
||||
command(messageId, async () => {
|
||||
const result = await port.withdraw(messageId);
|
||||
// The host confirmed the removal. Drop the row now so it is not pressable again
|
||||
// between this answer and the next update.
|
||||
if (result.withdrawn) {
|
||||
publish({ items: state.items.filter((entry) => entry.id !== messageId) });
|
||||
}
|
||||
return result;
|
||||
}),
|
||||
promote: (messageId: string, activeTurnBehavior: ActiveTurnBehavior) =>
|
||||
command(messageId, () => port.promote(messageId, activeTurnBehavior)),
|
||||
retry: () => {
|
||||
if (observationFailed) {
|
||||
stop?.();
|
||||
stop = undefined;
|
||||
publish({ status: pending() });
|
||||
start();
|
||||
} else {
|
||||
void refresh();
|
||||
}
|
||||
},
|
||||
subscribe(listener: () => void) {
|
||||
listeners.add(listener);
|
||||
if (!stop) start();
|
||||
return () => {
|
||||
listeners.delete(listener);
|
||||
if (!listeners.size) {
|
||||
sequence++;
|
||||
stop?.();
|
||||
stop = undefined;
|
||||
}
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export type AgentQueueModel = ReturnType<typeof createAgentQueueModel>;
|
||||
@@ -56,6 +56,7 @@ export function ChatFind({
|
||||
agentId,
|
||||
serverId,
|
||||
epoch,
|
||||
rewindSeq,
|
||||
items,
|
||||
viewportRef,
|
||||
revealLoadedMessage,
|
||||
@@ -95,8 +96,8 @@ export function ChatFind({
|
||||
);
|
||||
const state = useSyncExternalStore(model.subscribe, model.getSnapshot, model.getSnapshot);
|
||||
useEffect(() => {
|
||||
model.updateHistory(epoch, items);
|
||||
}, [model, epoch, items]);
|
||||
model.updateHistory(epoch, items, rewindSeq);
|
||||
}, [model, epoch, items, rewindSeq]);
|
||||
useEffect(() => () => model.close(), [model]);
|
||||
useEffect(() => {
|
||||
if (!active) model.close();
|
||||
|
||||
@@ -18,7 +18,7 @@ function message(seq: number, text = "target"): StreamItem {
|
||||
kind: "assistant_message",
|
||||
text,
|
||||
timestamp: new Date(0),
|
||||
timelineCursor: { epoch: "epoch", seq },
|
||||
timelineCursor: { epoch: "epoch", seq, anchorSeq: seq },
|
||||
};
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ it("loads an older location and searches a response merged across suppressed tas
|
||||
source.map((item, index) => ({
|
||||
event: { type: "timeline" as const, provider: "claude" as const, item },
|
||||
timestamp: new Date(0),
|
||||
timelineCursor: { epoch: "epoch", seq: index + 1 },
|
||||
timelineCursor: { epoch: "epoch", seq: index + 1, anchorSeq: index + 1 },
|
||||
})),
|
||||
{ source: "canonical" },
|
||||
);
|
||||
@@ -55,7 +55,7 @@ it("loads an older location and searches a response merged across suppressed tas
|
||||
},
|
||||
async load(_epoch, seq) {
|
||||
loaded.push(seq);
|
||||
model.updateHistory("epoch", history);
|
||||
model.updateHistory("epoch", history, null);
|
||||
},
|
||||
async reveal(_id, _query, occurrence) {
|
||||
revealed.push(occurrence);
|
||||
@@ -64,7 +64,7 @@ it("loads an older location and searches a response merged across suppressed tas
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", []);
|
||||
model.updateHistory("epoch", [], null);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
@@ -99,7 +99,7 @@ it("skips a source-only candidate and highlights a displayed match", async () =>
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [message(1), message(2)]);
|
||||
model.updateHistory("epoch", [message(1), message(2)], null);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().selectedItemId).toBe("row-2");
|
||||
@@ -129,7 +129,7 @@ it("ignores replies after closing and does not navigate", async () => {
|
||||
},
|
||||
clear() {},
|
||||
});
|
||||
model.updateHistory("epoch", [message(1)]);
|
||||
model.updateHistory("epoch", [message(1)], null);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => calls).toEqual(["search"]);
|
||||
@@ -155,7 +155,7 @@ it("retains a failed search for retry and distinguishes failure from zero matche
|
||||
};
|
||||
const model = new ChatFindModel(operations);
|
||||
try {
|
||||
model.updateHistory("epoch", []);
|
||||
model.updateHistory("epoch", [], null);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("error");
|
||||
@@ -185,7 +185,7 @@ it("reports a failed timeline load as a connection failure", async () => {
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", []);
|
||||
model.updateHistory("epoch", [], null);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("error");
|
||||
@@ -207,24 +207,160 @@ it("reports a search result that outlived its epoch as a changed history", async
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [message(1)]);
|
||||
model.updateHistory("epoch", [message(1)], null);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
model.updateHistory("epoch-2", [message(1)]);
|
||||
model.updateHistory("epoch-2", [message(1)], null);
|
||||
expect(model.getSnapshot()).toMatchObject({ phase: "error", failure: "historyChanged" });
|
||||
} finally {
|
||||
model.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("reports results that a rewind took messages from as a changed history", async () => {
|
||||
const model = new ChatFindModel({
|
||||
async search() {
|
||||
return response([{ seq: 2, role: "assistant" }]);
|
||||
},
|
||||
async load() {},
|
||||
async reveal() {
|
||||
return { count: 1, occurrence: 0 };
|
||||
},
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [message(1), message(2)], null);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
expect(model.getSnapshot()).toMatchObject({ selectedItemId: "row-2", count: 1 });
|
||||
// Another client rewinds the turn holding the match; the epoch stays.
|
||||
model.updateHistory("epoch", [message(1)], 3);
|
||||
expect(model.getSnapshot()).toMatchObject({
|
||||
phase: "error",
|
||||
failure: "historyChanged",
|
||||
selectedItemId: null,
|
||||
});
|
||||
} finally {
|
||||
model.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("stops a search still receiving pages when a rewind lands between them", async () => {
|
||||
let pages = 0;
|
||||
let releaseSecondPage!: () => void;
|
||||
const secondPage = new Promise<void>((resolve) => {
|
||||
releaseSecondPage = resolve;
|
||||
});
|
||||
const model = new ChatFindModel({
|
||||
async search(_query, cursor) {
|
||||
pages += 1;
|
||||
if (cursor === undefined)
|
||||
return { ...response([{ seq: 2, role: "assistant" }]), nextCursor: 2 };
|
||||
await secondPage;
|
||||
return response([{ seq: 1, role: "assistant" }]);
|
||||
},
|
||||
async load() {},
|
||||
async reveal() {
|
||||
return { count: 1, occurrence: 0 };
|
||||
},
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [message(1), message(2)], null);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => pages).toBe(2);
|
||||
model.updateHistory("epoch", [message(1)], 3);
|
||||
releaseSecondPage();
|
||||
await expect.poll(() => model.getSnapshot().failure).toBe("historyChanged");
|
||||
expect(model.getSnapshot()).toMatchObject({ phase: "error", selectedItemId: null });
|
||||
} finally {
|
||||
model.close();
|
||||
}
|
||||
});
|
||||
|
||||
it.each([
|
||||
["Next", "next"],
|
||||
["Previous", "previous"],
|
||||
] as const)("reports a rewind after %s as a changed history", async (_label, step) => {
|
||||
const model = new ChatFindModel({
|
||||
async search() {
|
||||
return response([
|
||||
{ seq: 1, role: "assistant" },
|
||||
{ seq: 2, role: "assistant" },
|
||||
]);
|
||||
},
|
||||
async load() {},
|
||||
async reveal() {
|
||||
return { count: 1, occurrence: 0 };
|
||||
},
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [message(1), message(2)], null);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
model[step]();
|
||||
await expect.poll(() => model.getSnapshot().selectedItemId).toBe("row-2");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
model.updateHistory("epoch", [message(1)], 3);
|
||||
expect(model.getSnapshot()).toMatchObject({
|
||||
phase: "error",
|
||||
failure: "historyChanged",
|
||||
selectedItemId: null,
|
||||
});
|
||||
} finally {
|
||||
model.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("stops a pending Next when a rewind lands before it reveals", async () => {
|
||||
let reveals = 0;
|
||||
let revealSecond!: () => void;
|
||||
const secondReveal = new Promise<void>((resolve) => {
|
||||
revealSecond = resolve;
|
||||
});
|
||||
const model = new ChatFindModel({
|
||||
async search() {
|
||||
return response([
|
||||
{ seq: 1, role: "assistant" },
|
||||
{ seq: 2, role: "assistant" },
|
||||
]);
|
||||
},
|
||||
async load() {},
|
||||
async reveal() {
|
||||
reveals += 1;
|
||||
if (reveals > 1) await secondReveal;
|
||||
return { count: 1, occurrence: 0 };
|
||||
},
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [message(1), message(2)], null);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
model.next();
|
||||
await expect.poll(() => reveals).toBe(2);
|
||||
model.updateHistory("epoch", [message(1)], 3);
|
||||
revealSecond();
|
||||
await expect.poll(() => model.getSnapshot().failure).toBe("historyChanged");
|
||||
expect(model.getSnapshot()).toMatchObject({ phase: "error", selectedItemId: null });
|
||||
} finally {
|
||||
model.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("can load a search location before the initial chat history has arrived", async () => {
|
||||
const model = new ChatFindModel({
|
||||
async search() {
|
||||
return response([{ seq: 1, role: "assistant" }]);
|
||||
},
|
||||
async load() {
|
||||
model.updateHistory("epoch", [message(1)]);
|
||||
model.updateHistory("epoch", [message(1)], null);
|
||||
},
|
||||
async reveal() {
|
||||
return { count: 1, occurrence: 0 };
|
||||
@@ -232,7 +368,7 @@ it("can load a search location before the initial chat history has arrived", asy
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory(null, []);
|
||||
model.updateHistory(null, [], null);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
@@ -260,7 +396,7 @@ it("reports the position across the whole chat and corrects it with rendered cou
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [message(1), message(2)]);
|
||||
model.updateHistory("epoch", [message(1), message(2)], null);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
@@ -297,7 +433,7 @@ it("counts one match per message from a host that reports no counts", async () =
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [message(1), message(2)]);
|
||||
model.updateHistory("epoch", [message(1), message(2)], null);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
|
||||
@@ -76,6 +76,10 @@ export class ChatFindModel {
|
||||
private items: StreamItem[] = [];
|
||||
private epoch: string | null = null;
|
||||
private resultEpoch: string | null = null;
|
||||
/** The latest rewind applied to the history. A rewind keeps the epoch and retires messages. */
|
||||
private rewindSeq: number | null = null;
|
||||
/** The latest rewind when the current result set's search started; undefined until a search starts. */
|
||||
private searchedRewindSeq: number | null | undefined = undefined;
|
||||
private locations: Location[] = [];
|
||||
private resolved = new Map<Location, Target>();
|
||||
private current = -1;
|
||||
@@ -113,6 +117,7 @@ export class ChatFindModel {
|
||||
this.cancel();
|
||||
this.locations = [];
|
||||
this.resultEpoch = null;
|
||||
this.searchedRewindSeq = undefined;
|
||||
this.resolved.clear();
|
||||
this.current = -1;
|
||||
this.inMessage = { occurrence: 0, count: 0 };
|
||||
@@ -144,6 +149,7 @@ export class ChatFindModel {
|
||||
});
|
||||
}
|
||||
private async search(signal: AbortSignal) {
|
||||
this.searchedRewindSeq = this.rewindSeq;
|
||||
try {
|
||||
let cursor: number | undefined;
|
||||
do {
|
||||
@@ -168,15 +174,14 @@ export class ChatFindModel {
|
||||
this.fail(error, signal);
|
||||
}
|
||||
}
|
||||
updateHistory(epoch: string | null, items: StreamItem[]) {
|
||||
if (
|
||||
this.resultEpoch !== null &&
|
||||
epoch !== null &&
|
||||
epoch !== this.resultEpoch &&
|
||||
this.state.open
|
||||
) {
|
||||
/** `rewindSeq` is the sequence number of the latest rewind applied to this history. */
|
||||
updateHistory(epoch: string | null, items: StreamItem[], rewindSeq: number | null) {
|
||||
const replaced = this.resultEpoch !== null && epoch !== null && epoch !== this.resultEpoch;
|
||||
const rewound = this.searchedRewindSeq !== undefined && rewindSeq !== this.searchedRewindSeq;
|
||||
if ((replaced || rewound) && this.state.open) {
|
||||
this.fail(new ChatFindFailureError("historyChanged"), this.abort.signal);
|
||||
}
|
||||
this.rewindSeq = rewindSeq;
|
||||
this.epoch = epoch;
|
||||
this.items = items;
|
||||
this.historyListeners.forEach((listener) => listener());
|
||||
|
||||
@@ -9,6 +9,8 @@ export interface ChatFindProps {
|
||||
agentId: string;
|
||||
serverId: string;
|
||||
epoch: string | null;
|
||||
/** The sequence number of the latest rewind applied to this history, if any. */
|
||||
rewindSeq: number | null;
|
||||
items: StreamItem[];
|
||||
viewportRef: RefObject<StreamViewportHandle | null>;
|
||||
revealLoadedMessage(messageId: string): boolean;
|
||||
|
||||
@@ -139,7 +139,7 @@ describe("useChatOutline", () => {
|
||||
kind: "user_message",
|
||||
text: "live prompt",
|
||||
timestamp: new Date(seq),
|
||||
timelineCursor: { epoch: "epoch-1", seq },
|
||||
timelineCursor: { epoch: "epoch-1", seq, anchorSeq: seq },
|
||||
});
|
||||
rerender({ tail: [loadedPrompt(2)] });
|
||||
await waitFor(() => expect(runtime.listAgentTimelinePrompts).toHaveBeenCalledTimes(2));
|
||||
@@ -198,7 +198,7 @@ describe("useChatOutline", () => {
|
||||
kind: "assistant_message",
|
||||
text: "chunk",
|
||||
timestamp: new Date(),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2, anchorSeq: 2 },
|
||||
},
|
||||
],
|
||||
timelineEpoch: "epoch-1",
|
||||
@@ -219,7 +219,7 @@ describe("useChatOutline", () => {
|
||||
kind: "user_message",
|
||||
text: "Replaced conversation",
|
||||
timestamp: new Date(2),
|
||||
timelineCursor: { epoch: "epoch-2", seq: 1 },
|
||||
timelineCursor: { epoch: "epoch-2", seq: 1, anchorSeq: 1 },
|
||||
},
|
||||
],
|
||||
timelineEpoch: "epoch-2",
|
||||
@@ -275,7 +275,7 @@ describe("useChatOutline", () => {
|
||||
kind: "user_message" as const,
|
||||
text: "prompt",
|
||||
timestamp: new Date(1),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 1 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 1, anchorSeq: 1 },
|
||||
},
|
||||
];
|
||||
const { result, rerender } = renderHook(
|
||||
@@ -326,7 +326,7 @@ describe("useChatOutline", () => {
|
||||
kind: "user_message" as const,
|
||||
text: "prompt",
|
||||
timestamp: new Date(1),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 1 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 1, anchorSeq: 1 },
|
||||
};
|
||||
const { result, rerender } = renderHook(
|
||||
({ tail, mountedHistoryMessageIds }) =>
|
||||
@@ -381,7 +381,7 @@ describe("useChatOutline", () => {
|
||||
kind: "user_message" as const,
|
||||
text: "prompt",
|
||||
timestamp: new Date(2),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2, anchorSeq: 2 },
|
||||
};
|
||||
const revealLoadedMessage = vi.fn();
|
||||
revealLoadedMessage.mockReturnValue(false);
|
||||
|
||||
@@ -603,14 +603,15 @@ describe("layoutStream", () => {
|
||||
splitIntoCards,
|
||||
);
|
||||
|
||||
const layout = layoutFor({
|
||||
platform,
|
||||
tail,
|
||||
timingIds: ["genui/a1/card", "genui/a2/card"],
|
||||
});
|
||||
const footerCardIds = tail
|
||||
.filter((item) => item.kind === "plugin" && item.itemKind === "genui-card")
|
||||
.map((item) => item.id);
|
||||
expect(footerCardIds).toHaveLength(2);
|
||||
|
||||
expect(footerOwners(layout)).toEqual(["genui/a1/card", "genui/a2/card"]);
|
||||
expect(findLayoutItem(layout, "genui/a1/card").completedFooter?.turnMetrics).toBe(
|
||||
const layout = layoutFor({ platform, tail, timingIds: footerCardIds });
|
||||
|
||||
expect(footerOwners(layout)).toEqual(footerCardIds);
|
||||
expect(findLayoutItem(layout, footerCardIds[0]).completedFooter?.turnMetrics).toBe(
|
||||
first.turnMetrics,
|
||||
);
|
||||
expect(layout.auxiliaryTurnFooter?.turnMetrics).toBe(metrics);
|
||||
|
||||
@@ -58,7 +58,11 @@ function installProbe(
|
||||
return function() {};
|
||||
} };
|
||||
})`;
|
||||
const evaluated = runPluginClientBundle("probe-plugin", clientBundle, runtime);
|
||||
const evaluated = runPluginClientBundle(
|
||||
{ serverId: "test-host", pluginId: "probe-plugin" },
|
||||
clientBundle,
|
||||
runtime,
|
||||
);
|
||||
return {
|
||||
...evaluated,
|
||||
serverId: "host-1",
|
||||
@@ -203,7 +207,9 @@ describe("stream presentation through installed plugins", () => {
|
||||
const source = rows(harness.source());
|
||||
|
||||
expect(source).toMatchObject([{ kind: "user_message", id: "prompt-1" }]);
|
||||
expect(rendered).toMatchObject([{ kind: "plugin", id: "probe-plugin/prompt-1/0" }]);
|
||||
expect(rendered).toMatchObject([
|
||||
{ kind: "plugin", source: { id: "prompt-1" }, pluginItemId: "prompt-1/0" },
|
||||
]);
|
||||
// The chat outline jumps to the source id; the row it lands on is the plugin's.
|
||||
expect(rendered.map(getStreamItemMessageId)).toEqual(["prompt-1"]);
|
||||
});
|
||||
@@ -320,7 +326,7 @@ describe("stream presentation through installed plugins", () => {
|
||||
const source = harness.source();
|
||||
const live = source.head[0];
|
||||
if (live?.kind !== "assistant_message") throw new Error("Expected a live assistant message");
|
||||
const canonical = { ...live, timelineCursor: { epoch: "epoch-1", seq: 42 } };
|
||||
const canonical = { ...live, timelineCursor: { epoch: "epoch-1", seq: 42, anchorSeq: 42 } };
|
||||
const present = createStreamPresentation();
|
||||
present({ ...presentationOptions, tail: [], head: [live], transform: undefined });
|
||||
const repointed = rows(
|
||||
@@ -330,7 +336,7 @@ describe("stream presentation through installed plugins", () => {
|
||||
{
|
||||
id: streamed[0]!.id,
|
||||
text: "Streamed answer",
|
||||
timelineCursor: { epoch: "epoch-1", seq: 42 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 42, anchorSeq: 42 },
|
||||
},
|
||||
]);
|
||||
});
|
||||
@@ -517,7 +523,7 @@ describe("timeline presentation", () => {
|
||||
messageId: "provider-message",
|
||||
clientMessageId: "client-message",
|
||||
turnId: "turn-1",
|
||||
timelineCursor: { epoch: "epoch", seq: 12 },
|
||||
timelineCursor: { epoch: "epoch", seq: 12, anchorSeq: 12 },
|
||||
});
|
||||
const presentMessage = () =>
|
||||
present({
|
||||
@@ -611,7 +617,7 @@ it("folds work before a plugin-rendered reply and leaves the reply visible", ()
|
||||
expect(result.tail.map((item) => item.id)).toEqual([
|
||||
"prompt",
|
||||
"turn-summary:prompt",
|
||||
"probe-plugin/reply/0",
|
||||
JSON.stringify(["probe-plugin", "reply", "reply/0"]),
|
||||
]);
|
||||
expect(pluginData(result.tail)).toEqual([{ text: "$$x^2$$", phase: "complete" }]);
|
||||
});
|
||||
@@ -640,7 +646,7 @@ it("keeps streaming replies native, then folds work without losing manual expans
|
||||
expect(present(completed).tail.map((item) => item.id)).toEqual([
|
||||
"prompt",
|
||||
"turn-summary:prompt",
|
||||
"probe-plugin/reply/0",
|
||||
JSON.stringify(["probe-plugin", "reply", "reply/0"]),
|
||||
]);
|
||||
const expandedTurnHostIds = new Set(["prompt"]);
|
||||
const opened = present({ ...completed, expandedTurnHostIds });
|
||||
@@ -648,14 +654,16 @@ it("keeps streaming replies native, then folds work without losing manual expans
|
||||
"prompt",
|
||||
"turn-summary:prompt",
|
||||
"tool-one",
|
||||
"probe-plugin/reply/0",
|
||||
JSON.stringify(["probe-plugin", "reply", "reply/0"]),
|
||||
]);
|
||||
expect(opened.turns.nestedItemIds.has("probe-plugin/reply/0")).toBe(false);
|
||||
expect(opened.turns.nestedItemIds.has(JSON.stringify(["probe-plugin", "reply", "reply/0"]))).toBe(
|
||||
false,
|
||||
);
|
||||
expect(present({ ...completed, expandedTurnHostIds }).tail).toEqual(opened.tail);
|
||||
expect(present(completed).tail.map((item) => item.id)).toEqual([
|
||||
"prompt",
|
||||
"turn-summary:prompt",
|
||||
"probe-plugin/reply/0",
|
||||
JSON.stringify(["probe-plugin", "reply", "reply/0"]),
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -679,7 +687,7 @@ it.each(["full", "collapseToolCalls"] as const)(
|
||||
expect(result.tail.map((item) => item.id)).toEqual([
|
||||
"prompt",
|
||||
"tool-one",
|
||||
"probe-plugin/reply/0",
|
||||
JSON.stringify(["probe-plugin", "reply", "reply/0"]),
|
||||
]);
|
||||
expect(result.turns.summaryRowsByHostId.size).toBe(0);
|
||||
},
|
||||
|
||||
@@ -26,8 +26,10 @@ import {
|
||||
} from "@legendapp/list/react-native";
|
||||
import { withUnistyles } from "react-native-unistyles";
|
||||
import { LoadingSpinner } from "@/components/ui/loading-spinner";
|
||||
import { LoadingState } from "@/components/ui/loading-state";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useRetainedPanelActive } from "@/components/retained-panel";
|
||||
import { useNativeSplashHold } from "@/native-splash";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import type { StreamItem } from "@/types/stream";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
@@ -761,6 +763,9 @@ function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrat
|
||||
);
|
||||
}, [historyStartPaginationState, hasOlderHistory, retryHistoryStart, t]);
|
||||
|
||||
// The launch splash stays up until the visible conversation has placed its rows. A hidden first
|
||||
// fill means the cache had no history, so it waits on the host and shows its own loading state.
|
||||
useNativeSplashHold(isActive && !isListPlaced);
|
||||
const canExpandDrawDistance =
|
||||
drawDistance < NATIVE_STREAM_DRAW_DISTANCE &&
|
||||
isActive &&
|
||||
@@ -807,8 +812,8 @@ function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrat
|
||||
<InitialDrawDistanceExpansion schedule={drawDistanceExpansion.schedule} />
|
||||
) : null}
|
||||
{!historyStartPaginationState.visible ? (
|
||||
<View pointerEvents="none" testID="agent-initial-fill" style={initialFillStyle}>
|
||||
<ThemedLoadingSpinner size="large" uniProps={foregroundMutedColorMapping} />
|
||||
<View pointerEvents="none" style={initialFillStyle}>
|
||||
<LoadingState testID="agent-initial-fill" title={t("agentPanel.states.loadingHistory")} />
|
||||
</View>
|
||||
) : null}
|
||||
</View>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { act } from "react";
|
||||
import { createRoot, type Root } from "react-dom/client";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { RetainedPanelActivity } from "@/components/retained-panel";
|
||||
import { reduceStreamUpdate, type StreamItem } from "@/types/stream";
|
||||
import { hydrateStreamState, reduceStreamUpdate, type StreamItem } from "@/types/stream";
|
||||
import type { StreamRenderInput, StreamSegmentRenderers, StreamViewportHandle } from "./strategy";
|
||||
import { createWebStreamStrategy } from "./strategy-web";
|
||||
|
||||
@@ -1660,4 +1660,86 @@ describe("createWebStreamStrategy", () => {
|
||||
expect(container.querySelector('[data-testid="agent-chat-scroll"]')).toBe(scrollContainer);
|
||||
expect(scrollTo).toHaveBeenCalledWith({ top: 2200, behavior: "auto" });
|
||||
});
|
||||
|
||||
it("renders batched user messages sharing a provider messageId without duplicate React keys", () => {
|
||||
const sharedProviderMessageId = "9ffc3d6e-f0ff-4005-8675-e76e9c5eb5a8";
|
||||
const historyMounted = hydrateStreamState(
|
||||
[
|
||||
{
|
||||
event: {
|
||||
type: "timeline",
|
||||
provider: "claude",
|
||||
item: {
|
||||
type: "user_message",
|
||||
text: "first queued prompt",
|
||||
messageId: sharedProviderMessageId,
|
||||
clientMessageId: "client-queued-1",
|
||||
},
|
||||
},
|
||||
timestamp: new Date("2026-11-29T13:00:00.000Z"),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 1, anchorSeq: 1 },
|
||||
},
|
||||
{
|
||||
event: {
|
||||
type: "timeline",
|
||||
provider: "claude",
|
||||
item: {
|
||||
type: "user_message",
|
||||
text: "second direct prompt",
|
||||
messageId: sharedProviderMessageId,
|
||||
clientMessageId: "client-direct-2",
|
||||
},
|
||||
},
|
||||
timestamp: new Date("2026-11-29T13:00:01.000Z"),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2, anchorSeq: 2 },
|
||||
},
|
||||
],
|
||||
{ source: "canonical" },
|
||||
);
|
||||
const consoleError = vi.spyOn(console, "error").mockImplementation(() => {});
|
||||
const renderers = createRenderers(() => {});
|
||||
const strategy = createWebStreamStrategy({ isMobileBreakpoint: false });
|
||||
container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
root = createRoot(container);
|
||||
|
||||
const rendered = strategy.render({
|
||||
agentId: "agent",
|
||||
segments: { historyVirtualized: [], historyMounted, liveHead: [] },
|
||||
boundary: {
|
||||
hasVirtualizedHistory: false,
|
||||
hasMountedHistory: true,
|
||||
hasLiveHead: false,
|
||||
},
|
||||
renderers,
|
||||
listEmptyComponent: null,
|
||||
viewportRef: React.createRef<StreamViewportHandle>(),
|
||||
routeBottomAnchorRequest: null,
|
||||
isAuthoritativeHistoryReady: true,
|
||||
onNearBottomChange: () => {},
|
||||
onNearHistoryStart: async () => true,
|
||||
isLoadingOlderHistory: false,
|
||||
hasOlderHistory: false,
|
||||
olderHistoryProgressKey: null,
|
||||
scrollEnabled: true,
|
||||
listStyle: null,
|
||||
baseListContentContainerStyle: null,
|
||||
forwardListContentContainerStyle: null,
|
||||
contentMaxWidth: DEFAULT_CONTENT_MAX_WIDTH,
|
||||
});
|
||||
act(() => {
|
||||
root?.render(rendered);
|
||||
});
|
||||
|
||||
const isSameKeyMessage = (arg: unknown) => typeof arg === "string" && arg.includes("same key");
|
||||
const duplicateKeyErrors = consoleError.mock.calls.filter((args) =>
|
||||
args.some(isSameKeyMessage),
|
||||
);
|
||||
expect(duplicateKeyErrors).toEqual([]);
|
||||
expect(
|
||||
Array.from(container.querySelectorAll("[data-history-row-id]")).map((node) =>
|
||||
node.getAttribute("data-history-row-id"),
|
||||
),
|
||||
).toEqual(["client-queued-1", "client-direct-2"]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,6 +19,7 @@ import { flushSync } from "react-dom";
|
||||
import { withUnistyles } from "react-native-unistyles";
|
||||
import { useRetainedPanelActive } from "@/components/retained-panel";
|
||||
import { LoadingSpinner } from "@/components/ui/loading-spinner";
|
||||
import { LoadingState } from "@/components/ui/loading-state";
|
||||
import { useStableEvent } from "@/hooks/use-stable-event";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { getStreamItemMessageId, type StreamItem } from "@/types/stream";
|
||||
@@ -1719,8 +1720,8 @@ function WebStreamViewport(props: StreamRenderInput & { isMobileBreakpoint: bool
|
||||
</div>
|
||||
</div>
|
||||
{!historyStartPaginationState.visible ? (
|
||||
<div data-testid="agent-initial-fill" style={initialFillStyle}>
|
||||
<ThemedLoadingSpinner size="large" uniProps={foregroundMutedColorMapping} />
|
||||
<div style={initialFillStyle}>
|
||||
<LoadingState testID="agent-initial-fill" title={t("agentPanel.states.loadingHistory")} />
|
||||
</div>
|
||||
) : null}
|
||||
{scrollEnabled && !isMobileBreakpoint ? (
|
||||
|
||||
@@ -33,7 +33,7 @@ describe("resolveAssistantTurnForkBoundary", () => {
|
||||
it("forks a failed assistant turn from its Paseo timeline cursor without a provider message id", () => {
|
||||
const failedTurn = {
|
||||
...assistantMessage("assistant-error", 2),
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42 },
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42, anchorSeq: 42 },
|
||||
};
|
||||
|
||||
expect(
|
||||
@@ -50,7 +50,7 @@ describe("resolveAssistantTurnForkBoundary", () => {
|
||||
it("includes the provider message id with a supported timeline cursor", () => {
|
||||
const selected = {
|
||||
...assistantMessage("assistant-1", 2, "msg-assistant-1"),
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42 },
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42, anchorSeq: 42 },
|
||||
};
|
||||
|
||||
expect(
|
||||
@@ -68,7 +68,7 @@ describe("resolveAssistantTurnForkBoundary", () => {
|
||||
it("falls back to the provider message id when timeline cursors are unsupported", () => {
|
||||
const selected = {
|
||||
...assistantMessage("assistant-1", 2, "msg-assistant-1"),
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42 },
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42, anchorSeq: 42 },
|
||||
};
|
||||
|
||||
expect(
|
||||
@@ -116,7 +116,7 @@ describe("resolveAssistantTurnForkBoundary", () => {
|
||||
it("resolves a fork boundary from the reply a plugin card replaced", () => {
|
||||
const reply = {
|
||||
...assistantMessage("assistant-1", 2, "msg-assistant-1"),
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42 },
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42, anchorSeq: 42 },
|
||||
};
|
||||
const card: StreamItem = {
|
||||
kind: "plugin",
|
||||
@@ -154,7 +154,7 @@ describe("resolveAssistantTurnForkBoundary", () => {
|
||||
const appended: StreamItem = {
|
||||
kind: "plugin",
|
||||
id: "plugin/card-1",
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42 },
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42, anchorSeq: 42 },
|
||||
timestamp: timestamp(2),
|
||||
pluginId: "plugin",
|
||||
pluginItemId: "card-1",
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
import { getAssistantReply, type StreamItem, type TimelinePosition } from "@/types/stream";
|
||||
import { getAssistantReply, type StreamItem } from "@/types/stream";
|
||||
|
||||
/** The daemon's timeline cursor; the row's anchor stays in the client. */
|
||||
interface TimelineBoundaryCursor {
|
||||
epoch: string;
|
||||
seq: number;
|
||||
}
|
||||
|
||||
export type AssistantTurnForkBoundary =
|
||||
| { boundaryCursor: TimelinePosition; boundaryMessageId?: string }
|
||||
| { boundaryCursor: TimelineBoundaryCursor; boundaryMessageId?: string }
|
||||
| { boundaryCursor?: undefined; boundaryMessageId: string };
|
||||
|
||||
export function resolveAssistantTurnForkBoundary(input: {
|
||||
@@ -15,7 +21,7 @@ export function resolveAssistantTurnForkBoundary(input: {
|
||||
}
|
||||
if (input.supportsTimelineCursor && reply.timelineCursor) {
|
||||
return {
|
||||
boundaryCursor: reply.timelineCursor,
|
||||
boundaryCursor: { epoch: reply.timelineCursor.epoch, seq: reply.timelineCursor.seq },
|
||||
...(reply.messageId ? { boundaryMessageId: reply.messageId } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ describe("collapseTurns", () => {
|
||||
it("stands at its host's timeline position, taking a new row when that position lands", () => {
|
||||
const live = collapse([user("u1"), shell("c1"), reply("r1")]);
|
||||
expect(live.summaryRowsByHostId.get("u1")).not.toHaveProperty("timelineCursor");
|
||||
const cursor = { epoch: "epoch-1", seq: 7 };
|
||||
const cursor = { epoch: "epoch-1", seq: 7, anchorSeq: 7 };
|
||||
const placed = [{ ...user("u1"), timelineCursor: cursor }, shell("c1"), reply("r1")];
|
||||
const canonical = collapse(placed, { previousSummaryRowsByHostId: live.summaryRowsByHostId });
|
||||
expect(canonical.summaryRowsByHostId.get("u1")).not.toBe(live.summaryRowsByHostId.get("u1"));
|
||||
|
||||
@@ -101,7 +101,7 @@ function summaryRow(
|
||||
}
|
||||
|
||||
function staysVisibleWhenCollapsed(item: StreamItem): boolean {
|
||||
return isTurnTrigger(item) || item.kind === "compaction";
|
||||
return isTurnTrigger(item) || item.kind === "compaction" || item.kind === "provider_switch";
|
||||
}
|
||||
|
||||
function findLastReplyIndex(tail: StreamItem[], start: number, end: number): number {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user