Compare commits

..
Author SHA1 Message Date
Mohamed Boudra 89773d2ec3 fix(app): surface and retry client plugin bypass persistence errors 2026-12-02 11:35:41 +01:00
Mohamed Boudra 8fcd4e151d chore(app): simplify General setup row copy 2026-12-02 11:25:43 +01:00
Mohamed Boudra 3e17a0e125 feat(app): add General settings toggle to bypass client plugin approval 2026-12-02 11:17:03 +01:00
Mohamed Boudra a5fe858831 test(desktop): wait deterministically for seeded plugin approval at startup 2026-12-02 10:19:37 +01:00
Mohamed Boudra 64db9df945 fix(app): address plugin approval review findings and desktop E2E startup 2026-12-02 10:13:43 +01:00
Mohamed Boudra 51601d45cf test(app): approve client plugins via UI in browser E2E specs 2026-12-02 09:49:09 +01:00
Mohamed Boudra d7d6523333 feat(app): require one-time approval before running client plugins
Add a per-host, per-plugin client execution consent model and sequential confirmation sheet before evaluating plugin client bundles.

- Enforce fail-closed execution approval inside PluginRegistry before runPluginClientBundle runs and hydrate stored decisions before catalog reconciliation.
- Queue multiple unreviewed client plugins sequentially in one persistent AdaptiveModalSheet with monotonic request IDs and steady layout geometry.
- Persist approved and declined decisions per (host, plugin) across reloads and reconnects, clear host trust on host removal or relay identity key replacement, and clear plugin decisions on uninstall.
- Surface blocked plugins in Settings -> Plugins and plugin surfaces so users can allow or block client execution on this device.
2026-12-02 09:49:09 +01:00
211 changed files with 4337 additions and 7225 deletions
-144
View File
@@ -1,149 +1,5 @@
# Changelog
## 0.19.0-beta.1 - 2026-12-02
- **Switch providers mid-chat:** Switch a chat to another provider and keep the conversation, with chat history now stored on the host. ([#11410](https://github.com/getpaseo/paseo/pull/11410))
- **Queue survives restarts:** Queued messages now live on the host, so they survive app reloads, device switches and daemon restarts. ([#11424](https://github.com/getpaseo/paseo/pull/11424), [#11566](https://github.com/getpaseo/paseo/pull/11566), [#11740](https://github.com/getpaseo/paseo/pull/11740))
- **One switch for agent tools:** Agent tools now sit behind one Enable tools setting with orchestration, schedules, PR watching and browser groups, and are on by default. ([#11189](https://github.com/getpaseo/paseo/pull/11189))
- **Connected devices list:** Settings → Devices now shows which clients and hosts are connected and what each one can access. ([#11209](https://github.com/getpaseo/paseo/pull/11209))
- **Plugin scorecards:** Plugin pages in the app and on paseo.sh show a scorecard, update history, related plugins and sponsor links. ([#11563](https://github.com/getpaseo/paseo/pull/11563), [#11674](https://github.com/getpaseo/paseo/pull/11674), [#11691](https://github.com/getpaseo/paseo/pull/11691))
- **Share services through tunnels:** Share a running workspace service at a public URL from the Scripts menu, and dev servers keep their live-reload connections. Services now open at `localhost:<port>`, and `*.localhost` service URLs are removed. ([#11490](https://github.com/getpaseo/paseo/pull/11490))
- **Lower CPU while agents run:** Running agents use far less CPU, GPU and battery, with lighter status rings, loaders and tool-call animations. ([#11456](https://github.com/getpaseo/paseo/pull/11456), [#11474](https://github.com/getpaseo/paseo/pull/11474), [#11564](https://github.com/getpaseo/paseo/pull/11564), [#11586](https://github.com/getpaseo/paseo/pull/11586), [#11591](https://github.com/getpaseo/paseo/pull/11591) by [@djbclark](https://github.com/djbclark), [@luoph](https://github.com/luoph), [@mariotaku](https://github.com/mariotaku))
- **Steadier streaming replies:** Streaming replies show their final formatting as they arrive, and long replies no longer get slower to render as they grow. ([#11572](https://github.com/getpaseo/paseo/pull/11572), [#11582](https://github.com/getpaseo/paseo/pull/11582) by [@luoph](https://github.com/luoph))
- **Faster mobile launch:** The mobile app shows your last workspace sooner after a cold launch, about 0.7 seconds on Android. ([#11390](https://github.com/getpaseo/paseo/pull/11390) by [@luoph](https://github.com/luoph), [@maci0](https://github.com/maci0))
- **Desktop browser profiles:** Desktop browser tabs can use separate colored profiles, so you can stay signed in to two accounts on one site. ([#10357](https://github.com/getpaseo/paseo/pull/10357) by [@clkao](https://github.com/clkao))
- **Swipe away the iOS keyboard:** Drag the chat down to hide the iOS keyboard, and chat controls now work on the first tap while it is open. ([#11625](https://github.com/getpaseo/paseo/pull/11625))
### Breaking
- Paseo CLI and daemon now require Node.js 22.16.0 or later ([#11410](https://github.com/getpaseo/paseo/pull/11410))
### Added
- Added Antigravity quota to Usage, refreshed only when you select Refresh ([#11585](https://github.com/getpaseo/paseo/pull/11585))
- Added conversation-only rewind for OpenCode v2 agents ([#11675](https://github.com/getpaseo/paseo/pull/11675))
- Added desktop browser tabs for workspaces on hosts connected through another host ([#11561](https://github.com/getpaseo/paseo/pull/11561))
- Added `paseo hub run` to start Hub manual triggers from the terminal ([#11408](https://github.com/getpaseo/paseo/pull/11408))
- Added Claude Enterprise monthly spend to the Usage card and sidebar summary ([#11514](https://github.com/getpaseo/paseo/pull/11514) by [@vivekkalyan](https://github.com/vivekkalyan))
- Added Spend credits amounts for Codex individual spend limits ([#11702](https://github.com/getpaseo/paseo/pull/11702) by [@vivekkalyan](https://github.com/vivekkalyan))
### Improved
- Opened chats faster by skipping Markdown preparation for replies without workspace links ([#11327](https://github.com/getpaseo/paseo/pull/11327))
- Reduced work on each workspace switch by updating Git actions only for the visible workspace ([#11332](https://github.com/getpaseo/paseo/pull/11332))
- Stopped the sidebar re-rendering on agent updates that change only token usage ([#11565](https://github.com/getpaseo/paseo/pull/11565) by [@jl97mcad](https://github.com/jl97mcad))
- Released hidden workspace composers after ten minutes during repeated workspace switches ([#11613](https://github.com/getpaseo/paseo/pull/11613) by [@js2me](https://github.com/js2me))
- Kept typing responsive in long multiline drafts ([#11418](https://github.com/getpaseo/paseo/pull/11418))
- Served the desktop app's web UI with Brotli and gzip compression instead of an uncompressed 25 MB bundle ([#10635](https://github.com/getpaseo/paseo/pull/10635) by [@djbclark](https://github.com/djbclark))
- Changed chat loading to one steady spinner that reveals the chat and composer together, without an Updating messages flash ([#11575](https://github.com/getpaseo/paseo/pull/11575))
- Kept the Restoring screen up until a restored workspace is ready ([#11486](https://github.com/getpaseo/paseo/pull/11486))
- Showed a spinner on a worktree row while archive checks for uncommitted changes ([#11519](https://github.com/getpaseo/paseo/pull/11519), [#11574](https://github.com/getpaseo/paseo/pull/11574) by [@cxroop](https://github.com/cxroop))
- Showed each host's icon with a status dot on host selectors ([#11568](https://github.com/getpaseo/paseo/pull/11568))
- Sent the prompt with hardware-keyboard Return on iPhone, as on iPad ([#11537](https://github.com/getpaseo/paseo/pull/11537))
- Replaced the Direct connection Advanced field with a Form and URI switch, so a pasted `tcp://` URI connects in one tap ([#11402](https://github.com/getpaseo/paseo/pull/11402) by [@thecardcheat](https://github.com/thecardcheat))
### Changed
- Changed archiving to keep a worktree that has uncommitted changes unless you confirm removal ([#11430](https://github.com/getpaseo/paseo/pull/11430))
- Changed closing a New Agent tab with an unsent draft to ask before discarding it ([#11660](https://github.com/getpaseo/paseo/pull/11660))
- Changed Cmd/Ctrl+click on a sidebar workspace to open it instead of entering select mode ([#11472](https://github.com/getpaseo/paseo/pull/11472))
- Changed agents that already reported to their caller with `send_agent_prompt` to skip the extra finished notice ([#11583](https://github.com/getpaseo/paseo/pull/11583))
### Fixed
- Fixed an attached image over 2000 px breaking every later turn in its chat ([#5119](https://github.com/getpaseo/paseo/pull/5119) by [@RUIIIOVO](https://github.com/RUIIIOVO))
- Fixed voice mode agents never speaking back when Paseo tools were off ([#11161](https://github.com/getpaseo/paseo/pull/11161))
- Fixed turning off voice mode without a daemon connection leaving the microphone on ([#11587](https://github.com/getpaseo/paseo/pull/11587) by [@luoph](https://github.com/luoph), [@RRD-dev](https://github.com/RRD-dev))
- Fixed the app taking up to a minute to reconnect after returning from the background ([#10348](https://github.com/getpaseo/paseo/pull/10348) by [@dongsun1](https://github.com/dongsun1))
- Fixed one failed WebSocket handshake doubling the reconnect delay ([#11428](https://github.com/getpaseo/paseo/pull/11428) by [@suniceman](https://github.com/suniceman))
- Fixed chats staying on Reconnecting after the app switched to a faster connection ([#11029](https://github.com/getpaseo/paseo/pull/11029) by [@tmhaha](https://github.com/tmhaha))
- Fixed Updating messages staying visible after reopening a cached chat ([#11464](https://github.com/getpaseo/paseo/pull/11464) by [@oyzh888](https://github.com/oyzh888))
- Fixed terminal output stopping after a reconnect reused its subscription ([#10433](https://github.com/getpaseo/paseo/pull/10433) by [@chirag127](https://github.com/chirag127))
- Fixed Files showing Host is not connected when the app launched before the host connected ([#11679](https://github.com/getpaseo/paseo/pull/11679))
- Fixed Created and Last prompt sorting disappearing while a host is offline ([#11728](https://github.com/getpaseo/paseo/pull/11728))
- Fixed iOS header taps scrolling the chat, Explorer or workspace list to the top ([#11262](https://github.com/getpaseo/paseo/pull/11262) by [@yzim](https://github.com/yzim))
- Fixed a file sheet dismissed while opening leaving an invisible backdrop that blocked taps ([#11317](https://github.com/getpaseo/paseo/pull/11317) by [@LiebeLee](https://github.com/LiebeLee))
- Fixed bottom sheets staying open when dismissed before their open animation started ([#11632](https://github.com/getpaseo/paseo/pull/11632))
- Fixed Android attaching nothing when the app was recreated during image selection ([#7734](https://github.com/getpaseo/paseo/pull/7734))
- Fixed pasting a file into the web composer inserting its path instead of attaching it ([#11718](https://github.com/getpaseo/paseo/pull/11718))
- Fixed Content font size not applying to existing user messages in web chat ([#11469](https://github.com/getpaseo/paseo/pull/11469) by [@bearyjd](https://github.com/bearyjd))
- Fixed `<br>` in a Markdown table cell splitting the table row ([#9587](https://github.com/getpaseo/paseo/pull/9587) by [@apple-ouyang](https://github.com/apple-ouyang))
- Fixed hidden chat rows shifting the reading position on web ([#11538](https://github.com/getpaseo/paseo/pull/11538) by [@kogekiplay](https://github.com/kogekiplay))
- Fixed a plugin slash command with an attachment being sent to the agent as a message ([#11483](https://github.com/getpaseo/paseo/pull/11483) by [@suniceman](https://github.com/suniceman))
- Fixed Archive finished subagents skipping closed subagents ([#10865](https://github.com/getpaseo/paseo/pull/10865) by [@sbhas2k](https://github.com/sbhas2k))
- Fixed Import Session missing the newest ACP sessions ([#10675](https://github.com/getpaseo/paseo/pull/10675))
- Fixed Import Session hiding the provider error while Retry runs ([#11654](https://github.com/getpaseo/paseo/pull/11654))
- Fixed setup dropping project suggestions from providers that answer after 60 seconds ([#11438](https://github.com/getpaseo/paseo/pull/11438) by [@suniceman](https://github.com/suniceman))
- Fixed Open in file manager showing for workspaces on remote hosts ([#11463](https://github.com/getpaseo/paseo/pull/11463) by [@sleroq](https://github.com/sleroq))
- Fixed Reveal in Finder for workspaces rooted at `/` ([#11206](https://github.com/getpaseo/paseo/pull/11206) by [@suniceman](https://github.com/suniceman))
- Fixed large HTML files previewing as a blank pane on desktop ([#11504](https://github.com/getpaseo/paseo/pull/11504))
- Fixed the Paseo RPM failing to install alongside other Electron RPMs ([#11354](https://github.com/getpaseo/paseo/pull/11354))
- Fixed Restart and close terminals leaving terminal programs running on Windows ([#11398](https://github.com/getpaseo/paseo/pull/11398))
- Fixed agent creation hanging behind provider checks for deleted worktrees ([#11646](https://github.com/getpaseo/paseo/pull/11646) by [@ralston](https://github.com/ralston))
- Fixed finished Claude subagents showing as running or canceled after reopening a chat or restarting the daemon ([#10848](https://github.com/getpaseo/paseo/pull/10848), [#11594](https://github.com/getpaseo/paseo/pull/11594), [#11602](https://github.com/getpaseo/paseo/pull/11602) by [@monarchmaisuriya](https://github.com/monarchmaisuriya), [@desmond-rai](https://github.com/desmond-rai))
- Fixed Claude agents started by Paseo missing Claude Code's chat titles ([#11057](https://github.com/getpaseo/paseo/pull/11057) by [@Zayooo00](https://github.com/Zayooo00))
- Fixed turns Claude starts on its own staying hidden in reopened chats until Reload ([#11405](https://github.com/getpaseo/paseo/pull/11405))
- Fixed Claude Code system notices being dropped from the chat ([#11419](https://github.com/getpaseo/paseo/pull/11419) by [@minamorl](https://github.com/minamorl))
- Fixed Claude Code's Goal set reply missing from imported chats ([#11733](https://github.com/getpaseo/paseo/pull/11733))
- Fixed listing commands in an archived Claude chat starting Claude Code ([#11521](https://github.com/getpaseo/paseo/pull/11521) by [@RawSalmon69](https://github.com/RawSalmon69))
- Fixed Stop failing on unresponsive Pi and OMP agents ([#11618](https://github.com/getpaseo/paseo/pull/11618) by [@LouisDeconinck](https://github.com/LouisDeconinck))
- Fixed Pi turns never finishing when an extension handles the prompt ([#10572](https://github.com/getpaseo/paseo/pull/10572) by [@jsilhan](https://github.com/jsilhan))
- Fixed Pi prompts timing out during extension preflight and then running anyway ([#11525](https://github.com/getpaseo/paseo/pull/11525) by [@Stelath](https://github.com/Stelath))
- Fixed Pi showing the prompt twice when an extension sends context before the reply ([#11533](https://github.com/getpaseo/paseo/pull/11533) by [@Stelath](https://github.com/Stelath))
- Fixed Pi chats skipping project skills and settings in trusted workspaces ([#11527](https://github.com/getpaseo/paseo/pull/11527) by [@patrick-motard](https://github.com/patrick-motard))
- Fixed new Pi agents failing with an old extension error after the conflict was fixed ([#11642](https://github.com/getpaseo/paseo/pull/11642))
- Fixed the OMP Fast toggle missing before the first prompt ([#11553](https://github.com/getpaseo/paseo/pull/11553))
- Fixed finished OMP form questions losing the question and chosen answer ([#11697](https://github.com/getpaseo/paseo/pull/11697), [#11706](https://github.com/getpaseo/paseo/pull/11706) by [@luoph](https://github.com/luoph), [@RRD-dev](https://github.com/RRD-dev))
- Fixed Codex sends reporting failure after 60 seconds while Codex was still starting ([#11547](https://github.com/getpaseo/paseo/pull/11547) by [@nonononull](https://github.com/nonononull))
- Fixed Codex features staying hidden behind a wrapper command such as `env codex` ([#11221](https://github.com/getpaseo/paseo/pull/11221) by [@suniceman](https://github.com/suniceman))
- Fixed answers to Codex async questions being rejected ([#11225](https://github.com/getpaseo/paseo/pull/11225) by [@suniceman](https://github.com/suniceman))
- Fixed reopening a Codex chat resetting its last-activity time ([#10760](https://github.com/getpaseo/paseo/pull/10760) by [@Juns-g](https://github.com/Juns-g))
- Fixed Antigravity subagent tool calls splitting streamed replies mid-word ([#11535](https://github.com/getpaseo/paseo/pull/11535) by [@Suhail](https://github.com/Suhail))
- Fixed Antigravity turns ending as completed after an internal executor error ([#10885](https://github.com/getpaseo/paseo/pull/10885) by [@vecyang1](https://github.com/vecyang1), [@luoph](https://github.com/luoph))
- Fixed ACP chats failing to reopen when the provider rejects the saved thinking level ([#10333](https://github.com/getpaseo/paseo/pull/10333))
- Fixed the ACP thinking picker keeping the old level after a mode change ([#11478](https://github.com/getpaseo/paseo/pull/11478) by [@suniceman](https://github.com/suniceman))
- Fixed ACP setting errors leaving out the provider's explanation ([#11431](https://github.com/getpaseo/paseo/pull/11431) by [@suniceman](https://github.com/suniceman))
- Fixed Muse usage losing token totals after a context update ([#11389](https://github.com/getpaseo/paseo/pull/11389) by [@suniceman](https://github.com/suniceman))
- Fixed the Claude Usage card staying rate limited for hours ([#11597](https://github.com/getpaseo/paseo/pull/11597))
- Fixed Claude Usage showing the old plan after a subscription change ([#11685](https://github.com/getpaseo/paseo/pull/11685) by [@matchy233](https://github.com/matchy233))
- Fixed Codex Usage showing 0 credits for accounts without a credit balance ([#11515](https://github.com/getpaseo/paseo/pull/11515) by [@vivekkalyan](https://github.com/vivekkalyan))
- Fixed Copilot Usage failing when the premium request quota is exceeded ([#11006](https://github.com/getpaseo/paseo/pull/11006) by [@nathanmcnulty](https://github.com/nathanmcnulty))
- Fixed Copilot Usage reading the token of another host or account from GitHub CLI ([#11689](https://github.com/getpaseo/paseo/pull/11689))
- Fixed Create PR from a fork opening the pull request on the fork instead of its parent ([#11436](https://github.com/getpaseo/paseo/pull/11436) by [@suniceman](https://github.com/suniceman))
- Fixed a fork pull request disappearing from its worktree workspace after the first push ([#11441](https://github.com/getpaseo/paseo/pull/11441) by [@suniceman](https://github.com/suniceman))
- Fixed Create PR returning the API URL instead of the pull request page ([#11439](https://github.com/getpaseo/paseo/pull/11439) by [@suniceman](https://github.com/suniceman))
- Fixed GitHub check details failing to load annotations ([#11476](https://github.com/getpaseo/paseo/pull/11476) by [@suniceman](https://github.com/suniceman))
- Fixed GitHub check details dropping annotations when a job log is unavailable ([#11509](https://github.com/getpaseo/paseo/pull/11509))
- Fixed Gitea and Forgejo draft pull requests showing as open and conflicting ([#11545](https://github.com/getpaseo/paseo/pull/11545) by [@goodideal](https://github.com/goodideal))
- Fixed workspaces with an IPv6 Git remote not detecting their Gitea or Forgejo forge ([#11692](https://github.com/getpaseo/paseo/pull/11692) by [@jamescordrey-ops](https://github.com/jamescordrey-ops))
- Fixed workspace refreshes stalling when a `gh` or `glab` command ignores its timeout ([#11252](https://github.com/getpaseo/paseo/pull/11252), [#11411](https://github.com/getpaseo/paseo/pull/11411))
- Fixed scheduled runs in a Paseo worktree creating a duplicate project ([#10378](https://github.com/getpaseo/paseo/pull/10378) by [@kotusenka](https://github.com/kotusenka))
- Fixed archiving an agent failing with Unknown agent while another archive or close runs ([#10590](https://github.com/getpaseo/paseo/pull/10590) by [@apple-ouyang](https://github.com/apple-ouyang))
- Fixed an agent's last reply being cut off when a notification arrived mid-reply ([#11578](https://github.com/getpaseo/paseo/pull/11578) by [@KiritoXDone](https://github.com/KiritoXDone))
- Fixed a queued message running in the mode of a prompt sent after it ([#11722](https://github.com/getpaseo/paseo/pull/11722))
- Fixed `paseo ls --json` dropping timestamps and background work ([#11423](https://github.com/getpaseo/paseo/pull/11423) by [@KiritoXDone](https://github.com/KiritoXDone))
- Fixed `paseo inspect` and `paseo ls` hiding the model for Cursor Auto ([#11693](https://github.com/getpaseo/paseo/pull/11693))
- Fixed `paseo workspace ls` reporting a wrong password as a stopped daemon ([#11676](https://github.com/getpaseo/paseo/pull/11676) by [@chirag127](https://github.com/chirag127))
- Fixed `paseo daemon status` leaving out unconfirmed terminal cleanup ([#11658](https://github.com/getpaseo/paseo/pull/11658) by [@chirag127](https://github.com/chirag127))
- Fixed CLI archive, detach and reload scanning all agent history for a full agent ID ([#11617](https://github.com/getpaseo/paseo/pull/11617) by [@maci0](https://github.com/maci0))
### Security
- Blocked client file access to the daemon's own state in the Paseo home directory, and warned when a saved host's daemon key changes ([#11452](https://github.com/getpaseo/paseo/pull/11452))
- Restricted loopback origin matching to `localhost`, `127.0.0.1` and `::1` for daemon WebSocket and HTTP requests ([#11686](https://github.com/getpaseo/paseo/pull/11686))
- Stopped images in pull request comments and reviews from loading files from the host ([#11699](https://github.com/getpaseo/paseo/pull/11699))
- Stopped `.worktreeinclude` from copying local files into worktrees from fork pull requests ([#11709](https://github.com/getpaseo/paseo/pull/11709))
- Rejected schedule IDs that point outside the schedules directory ([#11727](https://github.com/getpaseo/paseo/pull/11727))
### Plugins
- Added a workspace layout API so plugins can open, move and close panes and tabs ([#11328](https://github.com/getpaseo/paseo/pull/11328))
- Added `requirements.app` to set a separate minimum app version from the daemon's ([#11494](https://github.com/getpaseo/paseo/pull/11494) by [@mcowger](https://github.com/mcowger))
- Fixed a plugin error in a press handler or timer closing the iOS and Android app ([#11412](https://github.com/getpaseo/paseo/pull/11412))
- Fixed plugin operations deleting plugin entries added to `config.json` by hand ([#11501](https://github.com/getpaseo/paseo/pull/11501) by [@matchy233](https://github.com/matchy233))
- Fixed registry plugin installs failing with Missing npm artifact when npm leaves registry URLs out of lockfiles ([#11656](https://github.com/getpaseo/paseo/pull/11656) by [@Brandon168](https://github.com/Brandon168))
- Fixed local plugin reloads taking 12 to 21 seconds when the daemon runs under a large directory ([#11653](https://github.com/getpaseo/paseo/pull/11653))
## 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))
-144
View File
@@ -1,149 +1,5 @@
# Changelog
## 0.19.0-beta.1 - 2026-12-02
- **对话中切换 Provider**:可将对话切换到其他 Provider 并保留对话内容,对话记录现在存储在主机上。([#11410](https://github.com/getpaseo/paseo/pull/11410))
- **排队消息重启不丢失**:排队消息现在保存在主机上,应用重新加载、切换设备或 daemon 重启后都不会丢失。([#11424](https://github.com/getpaseo/paseo/pull/11424), [#11566](https://github.com/getpaseo/paseo/pull/11566), [#11740](https://github.com/getpaseo/paseo/pull/11740))
- **一键开关 Agent 工具**:Agent 工具现在由一个 **启用工具** 设置统一控制,包含编排、定时任务、PR 监控和浏览器分组,并默认开启。([#11189](https://github.com/getpaseo/paseo/pull/11189))
- **已连接设备列表**:**设置 → 设备** 现在会显示哪些客户端和主机已连接,以及各自可以访问的内容。([#11209](https://github.com/getpaseo/paseo/pull/11209))
- **插件评分卡**:应用和 paseo.sh 上的插件页面现在会显示评分卡、更新历史、相关插件和赞助链接。([#11563](https://github.com/getpaseo/paseo/pull/11563), [#11674](https://github.com/getpaseo/paseo/pull/11674), [#11691](https://github.com/getpaseo/paseo/pull/11691))
- **通过隧道共享服务**:可从 Scripts 菜单将正在运行的工作区服务共享到公网地址,开发服务器也会保留实时重载连接。服务现在通过 `localhost:<port>` 打开,`*.localhost` 服务地址已移除。([#11490](https://github.com/getpaseo/paseo/pull/11490))
- **Agent 运行时更省资源**:运行中的 Agent 占用的 CPU、GPU 和电量大幅减少,状态环、加载指示器和工具调用动画也更轻量。([#11456](https://github.com/getpaseo/paseo/pull/11456), [#11474](https://github.com/getpaseo/paseo/pull/11474), [#11564](https://github.com/getpaseo/paseo/pull/11564), [#11586](https://github.com/getpaseo/paseo/pull/11586), [#11591](https://github.com/getpaseo/paseo/pull/11591),贡献者:[@djbclark](https://github.com/djbclark), [@luoph](https://github.com/luoph), [@mariotaku](https://github.com/mariotaku))
- **更稳定的流式回复**:流式回复在到达时即显示最终格式,长回复的渲染也不再随长度增长而变慢。([#11572](https://github.com/getpaseo/paseo/pull/11572), [#11582](https://github.com/getpaseo/paseo/pull/11582),贡献者:[@luoph](https://github.com/luoph))
- **更快的移动端启动**:移动端冷启动后会更快显示上次的工作区,在 Android 上约快 0.7 秒。([#11390](https://github.com/getpaseo/paseo/pull/11390),贡献者:[@luoph](https://github.com/luoph), [@maci0](https://github.com/maci0))
- **桌面端浏览器配置文件**:桌面端浏览器标签页可以使用不同颜色的独立配置文件,便于在同一网站上同时登录两个账号。([#10357](https://github.com/getpaseo/paseo/pull/10357),贡献者:[@clkao](https://github.com/clkao))
- **下滑收起 iOS 键盘**:向下拖动对话即可收起 iOS 键盘,键盘打开时对话控件首次点击即可生效。([#11625](https://github.com/getpaseo/paseo/pull/11625))
### 破坏性变更
- Paseo CLI 和 daemon 现在需要 Node.js 22.16.0 或更高版本 ([#11410](https://github.com/getpaseo/paseo/pull/11410))
### 新增
- 在用量中新增 Antigravity 配额,仅在选择 **刷新** 时更新 ([#11585](https://github.com/getpaseo/paseo/pull/11585))
- 为 OpenCode v2 Agent 新增仅回退对话的功能 ([#11675](https://github.com/getpaseo/paseo/pull/11675))
- 为通过其他主机连接的主机上的工作区新增桌面端浏览器标签页 ([#11561](https://github.com/getpaseo/paseo/pull/11561))
- 新增 `paseo hub run`,可从终端启动 Hub 手动触发器 ([#11408](https://github.com/getpaseo/paseo/pull/11408))
- 在用量卡片和侧边栏摘要中新增 Claude Enterprise 月度支出 ([#11514](https://github.com/getpaseo/paseo/pull/11514),贡献者:[@vivekkalyan](https://github.com/vivekkalyan))
- 为 Codex 个人支出限额新增 Spend credits 金额显示 ([#11702](https://github.com/getpaseo/paseo/pull/11702),贡献者:[@vivekkalyan](https://github.com/vivekkalyan))
### 改进
- 对不含工作区链接的回复跳过 Markdown 预处理,加快对话打开速度 ([#11327](https://github.com/getpaseo/paseo/pull/11327))
- 仅为可见工作区更新 Git 操作,减少每次切换工作区的开销 ([#11332](https://github.com/getpaseo/paseo/pull/11332))
- 仅改变 token 用量的 Agent 更新不再触发侧边栏重新渲染 ([#11565](https://github.com/getpaseo/paseo/pull/11565),贡献者:[@jl97mcad](https://github.com/jl97mcad))
- 反复切换工作区时,隐藏的工作区 Composer 会在十分钟后释放 ([#11613](https://github.com/getpaseo/paseo/pull/11613),贡献者:[@js2me](https://github.com/js2me))
- 在较长的多行草稿中保持输入流畅 ([#11418](https://github.com/getpaseo/paseo/pull/11418))
- 桌面应用的网页界面改用 Brotli 和 gzip 压缩传输,不再发送未压缩的 25 MB 包 ([#10635](https://github.com/getpaseo/paseo/pull/10635),贡献者:[@djbclark](https://github.com/djbclark))
- 对话加载改为显示一个稳定的加载指示器,并同时显示对话和 Composer,不再闪现 **正在更新消息** ([#11575](https://github.com/getpaseo/paseo/pull/11575))
- 恢复工作区时保持 Restoring 界面,直到工作区就绪 ([#11486](https://github.com/getpaseo/paseo/pull/11486))
- 归档检查未提交的更改时,在 worktree 行上显示加载指示器 ([#11519](https://github.com/getpaseo/paseo/pull/11519), [#11574](https://github.com/getpaseo/paseo/pull/11574),贡献者:[@cxroop](https://github.com/cxroop))
- 在主机选择器上显示各主机的图标和状态圆点 ([#11568](https://github.com/getpaseo/paseo/pull/11568))
- iPhone 上按硬件键盘的 Return 键即可发送提示词,与 iPad 一致 ([#11537](https://github.com/getpaseo/paseo/pull/11537))
- 将 **直接连接** 的 Advanced 字段替换为 **表单** 与 URI 切换,粘贴 `tcp://` URI 后一次点击即可连接 ([#11402](https://github.com/getpaseo/paseo/pull/11402),贡献者:[@thecardcheat](https://github.com/thecardcheat))
### 变更
- 归档时如果 worktree 有未提交的更改,除非确认删除,否则保留该 worktree ([#11430](https://github.com/getpaseo/paseo/pull/11430))
- 关闭带有未发送草稿的 **新建 Agent** 标签页时,会先询问是否丢弃草稿 ([#11660](https://github.com/getpaseo/paseo/pull/11660))
- 在侧边栏中 Cmd/Ctrl+点击工作区改为打开该工作区,而不再进入选择模式 ([#11472](https://github.com/getpaseo/paseo/pull/11472))
- 已通过 `send_agent_prompt` 向调用方汇报的 Agent 不再额外发送完成通知 ([#11583](https://github.com/getpaseo/paseo/pull/11583))
### 修复
- 修复附加超过 2000 px 的图片后,该对话之后的每一轮都失败的问题 ([#5119](https://github.com/getpaseo/paseo/pull/5119),贡献者:[@RUIIIOVO](https://github.com/RUIIIOVO))
- 修复关闭 Paseo 工具时语音模式 Agent 始终不回话的问题 ([#11161](https://github.com/getpaseo/paseo/pull/11161))
- 修复在没有 daemon 连接时关闭语音模式后麦克风仍保持开启的问题 ([#11587](https://github.com/getpaseo/paseo/pull/11587),贡献者:[@luoph](https://github.com/luoph), [@RRD-dev](https://github.com/RRD-dev))
- 修复应用从后台返回后需要长达一分钟才能重新连接的问题 ([#10348](https://github.com/getpaseo/paseo/pull/10348),贡献者:[@dongsun1](https://github.com/dongsun1))
- 修复一次 WebSocket 握手失败就使重连延迟翻倍的问题 ([#11428](https://github.com/getpaseo/paseo/pull/11428),贡献者:[@suniceman](https://github.com/suniceman))
- 修复应用切换到更快的连接后,对话仍停留在 **正在重新连接** 的问题 ([#11029](https://github.com/getpaseo/paseo/pull/11029),贡献者:[@tmhaha](https://github.com/tmhaha))
- 修复重新打开已缓存的对话后 **正在更新消息** 一直显示的问题 ([#11464](https://github.com/getpaseo/paseo/pull/11464),贡献者:[@oyzh888](https://github.com/oyzh888))
- 修复重连复用订阅后终端输出停止的问题 ([#10433](https://github.com/getpaseo/paseo/pull/10433),贡献者:[@chirag127](https://github.com/chirag127))
- 修复应用在主机连接前启动时 **文件** 显示 **Host 未连接** 的问题 ([#11679](https://github.com/getpaseo/paseo/pull/11679))
- 修复主机离线时 **创建时间** 和 **最近提示词** 排序选项消失的问题 ([#11728](https://github.com/getpaseo/paseo/pull/11728))
- 修复在 iOS 上点击标题栏会将对话、Explorer 或工作区列表滚动到顶部的问题 ([#11262](https://github.com/getpaseo/paseo/pull/11262),贡献者:[@yzim](https://github.com/yzim))
- 修复文件面板在打开过程中被关闭后,留下阻挡点击的不可见遮罩的问题 ([#11317](https://github.com/getpaseo/paseo/pull/11317),贡献者:[@LiebeLee](https://github.com/LiebeLee))
- 修复底部面板在打开动画开始前被关闭后仍保持打开的问题 ([#11632](https://github.com/getpaseo/paseo/pull/11632))
- 修复 Android 在选择图片期间重建应用后未附加任何内容的问题 ([#7734](https://github.com/getpaseo/paseo/pull/7734))
- 修复在网页版 Composer 中粘贴文件时插入文件路径而不是添加附件的问题 ([#11718](https://github.com/getpaseo/paseo/pull/11718))
- 修复 **内容字体大小** 未应用到网页端对话中已有用户消息的问题 ([#11469](https://github.com/getpaseo/paseo/pull/11469),贡献者:[@bearyjd](https://github.com/bearyjd))
- 修复 Markdown 表格单元格中的 `<br>` 拆分表格行的问题 ([#9587](https://github.com/getpaseo/paseo/pull/9587),贡献者:[@apple-ouyang](https://github.com/apple-ouyang))
- 修复网页端隐藏的对话行导致阅读位置偏移的问题 ([#11538](https://github.com/getpaseo/paseo/pull/11538),贡献者:[@kogekiplay](https://github.com/kogekiplay))
- 修复带附件的插件斜杠命令被当作消息发送给 Agent 的问题 ([#11483](https://github.com/getpaseo/paseo/pull/11483),贡献者:[@suniceman](https://github.com/suniceman))
- 修复 **归档已完成的 subagent** 跳过已关闭子 Agent 的问题 ([#10865](https://github.com/getpaseo/paseo/pull/10865),贡献者:[@sbhas2k](https://github.com/sbhas2k))
- 修复 **导入会话** 遗漏最新 ACP 会话的问题 ([#10675](https://github.com/getpaseo/paseo/pull/10675))
- 修复 **导入会话** 在 **重试** 期间隐藏 Provider 错误的问题 ([#11654](https://github.com/getpaseo/paseo/pull/11654))
- 修复设置时丢弃 60 秒后才响应的 Provider 所给出的项目建议的问题 ([#11438](https://github.com/getpaseo/paseo/pull/11438),贡献者:[@suniceman](https://github.com/suniceman))
- 修复远程主机上的工作区显示 Open in file manager 的问题 ([#11463](https://github.com/getpaseo/paseo/pull/11463),贡献者:[@sleroq](https://github.com/sleroq))
- 修复根目录为 `/` 的工作区无法使用 Reveal in Finder 的问题 ([#11206](https://github.com/getpaseo/paseo/pull/11206),贡献者:[@suniceman](https://github.com/suniceman))
- 修复桌面端预览大型 HTML 文件时显示空白面板的问题 ([#11504](https://github.com/getpaseo/paseo/pull/11504))
- 修复 Paseo RPM 无法与其他 Electron RPM 同时安装的问题 ([#11354](https://github.com/getpaseo/paseo/pull/11354))
- 修复 Windows 上 Restart and close 终端后终端程序仍在运行的问题 ([#11398](https://github.com/getpaseo/paseo/pull/11398))
- 修复已删除 worktree 的 Provider 检查导致 Agent 创建卡住的问题 ([#11646](https://github.com/getpaseo/paseo/pull/11646),贡献者:[@ralston](https://github.com/ralston))
- 修复重新打开对话或重启 daemon 后,已完成的 Claude 子 Agent 显示为运行中或已取消的问题 ([#10848](https://github.com/getpaseo/paseo/pull/10848), [#11594](https://github.com/getpaseo/paseo/pull/11594), [#11602](https://github.com/getpaseo/paseo/pull/11602),贡献者:[@monarchmaisuriya](https://github.com/monarchmaisuriya), [@desmond-rai](https://github.com/desmond-rai))
- 修复由 Paseo 启动的 Claude Agent 缺少 Claude Code 对话标题的问题 ([#11057](https://github.com/getpaseo/paseo/pull/11057),贡献者:[@Zayooo00](https://github.com/Zayooo00))
- 修复 Claude 自行开始的轮次在重新打开的对话中被隐藏、直到 **重新加载** 才显示的问题 ([#11405](https://github.com/getpaseo/paseo/pull/11405))
- 修复 Claude Code 系统通知从对话中丢失的问题 ([#11419](https://github.com/getpaseo/paseo/pull/11419),贡献者:[@minamorl](https://github.com/minamorl))
- 修复导入的 Claude Code 对话中缺少 Goal set 回复的问题 ([#11733](https://github.com/getpaseo/paseo/pull/11733))
- 修复在已归档的 Claude 对话中列出命令时启动 Claude Code 的问题 ([#11521](https://github.com/getpaseo/paseo/pull/11521),贡献者:[@RawSalmon69](https://github.com/RawSalmon69))
- 修复 **停止** 对无响应的 Pi 和 OMP Agent 无效的问题 ([#11618](https://github.com/getpaseo/paseo/pull/11618),贡献者:[@LouisDeconinck](https://github.com/LouisDeconinck))
- 修复扩展处理提示词时 Pi 轮次永远无法结束的问题 ([#10572](https://github.com/getpaseo/paseo/pull/10572),贡献者:[@jsilhan](https://github.com/jsilhan))
- 修复 Pi 提示词在扩展预检期间超时后仍继续执行的问题 ([#11525](https://github.com/getpaseo/paseo/pull/11525),贡献者:[@Stelath](https://github.com/Stelath))
- 修复扩展在回复前发送上下文时 Pi 重复显示提示词的问题 ([#11533](https://github.com/getpaseo/paseo/pull/11533),贡献者:[@Stelath](https://github.com/Stelath))
- 修复在受信任的工作区中 Pi 对话跳过项目技能和设置的问题 ([#11527](https://github.com/getpaseo/paseo/pull/11527),贡献者:[@patrick-motard](https://github.com/patrick-motard))
- 修复冲突解决后新建 Pi Agent 仍报旧扩展错误的问题 ([#11642](https://github.com/getpaseo/paseo/pull/11642))
- 修复首次发送提示词前缺少 OMP **快速** 开关的问题 ([#11553](https://github.com/getpaseo/paseo/pull/11553))
- 修复已完成的 OMP 表单提问不再显示提问内容和所选答案的问题 ([#11697](https://github.com/getpaseo/paseo/pull/11697), [#11706](https://github.com/getpaseo/paseo/pull/11706),贡献者:[@luoph](https://github.com/luoph), [@RRD-dev](https://github.com/RRD-dev))
- 修复 Codex 仍在启动时发送消息于 60 秒后报告失败的问题 ([#11547](https://github.com/getpaseo/paseo/pull/11547),贡献者:[@nonononull](https://github.com/nonononull))
- 修复通过 `env codex` 等包装命令启动时 Codex 功能被隐藏的问题 ([#11221](https://github.com/getpaseo/paseo/pull/11221),贡献者:[@suniceman](https://github.com/suniceman))
- 修复 Codex 异步提问的回答被拒绝的问题 ([#11225](https://github.com/getpaseo/paseo/pull/11225),贡献者:[@suniceman](https://github.com/suniceman))
- 修复重新打开 Codex 对话时重置其最近活动时间的问题 ([#10760](https://github.com/getpaseo/paseo/pull/10760),贡献者:[@Juns-g](https://github.com/Juns-g))
- 修复 Antigravity 子 Agent 工具调用将流式回复从单词中间截断的问题 ([#11535](https://github.com/getpaseo/paseo/pull/11535),贡献者:[@Suhail](https://github.com/Suhail))
- 修复 Antigravity 轮次在内部执行器出错后仍以完成状态结束的问题 ([#10885](https://github.com/getpaseo/paseo/pull/10885),贡献者:[@vecyang1](https://github.com/vecyang1), [@luoph](https://github.com/luoph))
- 修复 Provider 拒绝已保存的思考强度时 ACP 对话无法重新打开的问题 ([#10333](https://github.com/getpaseo/paseo/pull/10333))
- 修复切换模式后 ACP 思考强度选择器仍保留旧级别的问题 ([#11478](https://github.com/getpaseo/paseo/pull/11478),贡献者:[@suniceman](https://github.com/suniceman))
- 修复 ACP 设置错误中缺少 Provider 说明的问题 ([#11431](https://github.com/getpaseo/paseo/pull/11431),贡献者:[@suniceman](https://github.com/suniceman))
- 修复上下文更新后 Muse 用量丢失 token 总数的问题 ([#11389](https://github.com/getpaseo/paseo/pull/11389),贡献者:[@suniceman](https://github.com/suniceman))
- 修复 Claude 用量卡片持续数小时显示受速率限制的问题 ([#11597](https://github.com/getpaseo/paseo/pull/11597))
- 修复订阅变更后 Claude 用量仍显示旧套餐的问题 ([#11685](https://github.com/getpaseo/paseo/pull/11685),贡献者:[@matchy233](https://github.com/matchy233))
- 修复没有额度余额的账号 Codex 用量显示 0 额度的问题 ([#11515](https://github.com/getpaseo/paseo/pull/11515),贡献者:[@vivekkalyan](https://github.com/vivekkalyan))
- 修复超出高级请求配额时 Copilot 用量获取失败的问题 ([#11006](https://github.com/getpaseo/paseo/pull/11006),贡献者:[@nathanmcnulty](https://github.com/nathanmcnulty))
- 修复 Copilot 用量从 GitHub CLI 读取其他 GitHub 主机或账号 token 的问题 ([#11689](https://github.com/getpaseo/paseo/pull/11689))
- 修复从 fork 执行 **创建 PR** 时将 PR 创建在 fork 而非其上游仓库的问题 ([#11436](https://github.com/getpaseo/paseo/pull/11436),贡献者:[@suniceman](https://github.com/suniceman))
- 修复 fork PR 在首次推送后从其 worktree 工作区中消失的问题 ([#11441](https://github.com/getpaseo/paseo/pull/11441),贡献者:[@suniceman](https://github.com/suniceman))
- 修复 **创建 PR** 返回 API 地址而非 PR 页面的问题 ([#11439](https://github.com/getpaseo/paseo/pull/11439),贡献者:[@suniceman](https://github.com/suniceman))
- 修复 GitHub 检查详情无法加载注释的问题 ([#11476](https://github.com/getpaseo/paseo/pull/11476),贡献者:[@suniceman](https://github.com/suniceman))
- 修复作业日志不可用时 GitHub 检查详情丢失注释的问题 ([#11509](https://github.com/getpaseo/paseo/pull/11509))
- 修复 Gitea 和 Forgejo 的草稿 PR 显示为已打开且存在冲突的问题 ([#11545](https://github.com/getpaseo/paseo/pull/11545),贡献者:[@goodideal](https://github.com/goodideal))
- 修复 Git 远程地址为 IPv6 的工作区无法识别其 Gitea 或 Forgejo forge 的问题 ([#11692](https://github.com/getpaseo/paseo/pull/11692),贡献者:[@jamescordrey-ops](https://github.com/jamescordrey-ops))
- 修复 `gh` 或 `glab` 命令忽略超时导致工作区刷新卡住的问题 ([#11252](https://github.com/getpaseo/paseo/pull/11252), [#11411](https://github.com/getpaseo/paseo/pull/11411))
- 修复在 Paseo worktree 中运行定时任务时创建重复项目的问题 ([#10378](https://github.com/getpaseo/paseo/pull/10378),贡献者:[@kotusenka](https://github.com/kotusenka))
- 修复在其他归档或关闭操作进行时归档 Agent 报 Unknown agent 错误的问题 ([#10590](https://github.com/getpaseo/paseo/pull/10590),贡献者:[@apple-ouyang](https://github.com/apple-ouyang))
- 修复 Agent 回复过程中收到通知导致最后一条回复被截断的问题 ([#11578](https://github.com/getpaseo/paseo/pull/11578),贡献者:[@KiritoXDone](https://github.com/KiritoXDone))
- 修复排队消息以之后发送的提示词的模式运行的问题 ([#11722](https://github.com/getpaseo/paseo/pull/11722))
- 修复 `paseo ls --json` 丢失时间戳和后台任务的问题 ([#11423](https://github.com/getpaseo/paseo/pull/11423),贡献者:[@KiritoXDone](https://github.com/KiritoXDone))
- 修复 `paseo inspect` 和 `paseo ls` 隐藏 Cursor Auto 模型的问题 ([#11693](https://github.com/getpaseo/paseo/pull/11693))
- 修复 `paseo workspace ls` 将密码错误报告为 daemon 已停止的问题 ([#11676](https://github.com/getpaseo/paseo/pull/11676),贡献者:[@chirag127](https://github.com/chirag127))
- 修复 `paseo daemon status` 遗漏未确认的终端清理的问题 ([#11658](https://github.com/getpaseo/paseo/pull/11658),贡献者:[@chirag127](https://github.com/chirag127))
- 修复 CLI 归档、分离和重新加载时为匹配完整 Agent ID 而扫描全部 Agent 历史记录的问题 ([#11617](https://github.com/getpaseo/paseo/pull/11617),贡献者:[@maci0](https://github.com/maci0))
### 安全
- 阻止客户端访问 Paseo 主目录中 daemon 自身的状态文件,并在已保存主机的 daemon 密钥变化时发出警告 ([#11452](https://github.com/getpaseo/paseo/pull/11452))
- 将 daemon WebSocket 和 HTTP 请求的回环来源匹配限制为 `localhost`、`127.0.0.1` 和 `::1` ([#11686](https://github.com/getpaseo/paseo/pull/11686))
- 禁止 PR 评论和审查中的图片读取主机上的文件 ([#11699](https://github.com/getpaseo/paseo/pull/11699))
- 禁止 `.worktreeinclude` 将本地文件复制到来自 fork PR 的 worktree 中 ([#11709](https://github.com/getpaseo/paseo/pull/11709))
- 拒绝指向定时任务目录之外的定时任务 ID ([#11727](https://github.com/getpaseo/paseo/pull/11727))
### 插件
- 新增工作区布局 API,插件可以打开、移动和关闭面板与标签页 ([#11328](https://github.com/getpaseo/paseo/pull/11328))
- 新增 `requirements.app`,可单独设置与 daemon 不同的最低应用版本 ([#11494](https://github.com/getpaseo/paseo/pull/11494),贡献者:[@mcowger](https://github.com/mcowger))
- 修复插件在按下处理函数或定时器中出错导致 iOS 和 Android 应用关闭的问题 ([#11412](https://github.com/getpaseo/paseo/pull/11412))
- 修复插件操作删除手动添加到 `config.json` 中插件条目的问题 ([#11501](https://github.com/getpaseo/paseo/pull/11501),贡献者:[@matchy233](https://github.com/matchy233))
- 修复 npm 在锁文件中省略 registry 地址时,注册表插件安装报 Missing npm artifact 错误的问题 ([#11656](https://github.com/getpaseo/paseo/pull/11656),贡献者:[@Brandon168](https://github.com/Brandon168))
- 修复 daemon 运行在大型目录下时,本地插件重新加载耗时 12 至 21 秒的问题 ([#11653](https://github.com/getpaseo/paseo/pull/11653))
## 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))
+2 -2
View File
@@ -178,9 +178,9 @@ the switch. Promoting the switch cuts the running turn once the target is known
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/paseo.db` ([data model](data-model.md#agent-message-queues)),
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 holds references. An empty message is refused, and a recipient holds at most 100
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
+1 -8
View File
@@ -219,14 +219,7 @@ file after the daemon confirms persistence.
> **Window-state v1 limitation:** only the _first_ window of a session restores and persists saved geometry (size/position/maximized). Windows opened via ⌘⇧N / second-instance / "Open in new window" open at the default size, OS-cascaded, and do not persist — this avoids every window stacking on the same restored bounds and fighting over the single window-state store. Lifting this needs per-window state keys.
>
> **In-app browser profiles.** A browser tab's Electron partition is the pair (route, profile). The route is local, or a host's browser proxy. The profile is **Default** or a named profile. Electron sets the proxy per session (`session.setProxy`), not per `<webview>`, so the route is part of the partition name. Partition names are the identity, and `packages/desktop/src/features/browser-partition.ts` owns them:
>
> | Route | Default | Named profile |
> | ----- | ------------------------------------ | --------------------------------------------------- |
> | Local | `persist:paseo-browser` | `persist:paseo-profile-<slug>` |
> | Host | `persist:paseo-browser-host-<16hex>` | `persist:paseo-browser-host-<16hex>-profile-<slug>` |
>
> `persist:paseo-browser` keeps cookies from before profiles, and the host Default name predates profiles; do not rename either. A host runs one loopback SOCKS5 server and one tunnel. Every profile session on that host points `setProxy` at the same port, so a new profile never opens a second tunnel. Main binds a host profile's session when the renderer calls `ensureHostProxy` with its slug, and verifies it with `resolveProxy`. The status snapshot lists bound sessions in `profilePartitions`, and the tab mounts only after its profile appears there. A tab can switch profile and route at any time: the `<webview>` is replaced under the new partition and reloads the current URL. Display names and colors live in the main-owned catalog `<userData>/browser-profiles.json`, so editing a name or color keeps sign-ins intact and updates open tabs live. At `will-attach-webview`, main admits local partitions and only those host partitions whose session it bound. The tab's chosen profile slug lives in its `workspace-browser-store` record. After every `did-attach`, the renderer registers its browser id, workspace id, partition, and current guest `WebContents` id. Main accepts it only when that guest belongs to the calling renderer and its session matches the partition, and for a host partition, only when the session is bound to the proxy. Registration is repeated on purpose, because reparenting a retained `<webview>` can replace its guest without replacing the DOM element. Settings > Chat & panes manages profiles on every route: clearing a profile clears its storage and cache on the local route and on each host, then reloads its open tabs. Removing a named profile closes its open tabs, removes it from the catalog, clears its sessions, and deletes each of its `Partitions/` directories. Startup deletes the directories of profiles that are no longer in the catalog. Default cannot be removed.
> **In-app browser profiles.** Each local browser tab runs in a persistent Electron partition and can switch profiles at any time; switching replaces the `<webview>` under the new partition and reloads the current URL in that profile's session. Partition names are the identity: `persist:paseo-browser` is **Default** and preserves cookies from before profiles; `persist:paseo-profile-<slug>` is a named profile. Display names and colors live in the main-owned catalog `<userData>/browser-profiles.json`, so editing a profile's name or color keeps sign-ins intact and updates open tabs live. Main admits only `persist:paseo-browser`, `persist:paseo-profile-<slug>`, and active host-proxy partitions (`persist:paseo-browser-host-<16hex>`) at `will-attach-webview`. The tab's chosen profile slug lives in its `workspace-browser-store` record. After every `did-attach`, the renderer registers its browser id, workspace id, partition, and current guest `WebContents` id, and main accepts it only when that guest belongs to the calling renderer and its session matches the partition. Registration is intentionally repeated because reparenting a retained `<webview>` can replace its guest without replacing the DOM element. Settings > Chat & panes manages profiles: clearing a profile clears its storage/cache and reloads its open tabs; removing a named profile closes its open tabs, removes it from the catalog, clears its session, and deletes its `Partitions/paseo-profile-<slug>` directory from disk. Default cannot be removed.
>
> **In-app browser window opens.** Ordinary link opens, including Shift-clicked links, become Paseo workspace tabs and inherit the opener tab's browser profile. Script-created opens with popup features or a named window target and POST-backed opens remain secured Electron child windows in the opener’s browser profile, preserving `window.opener`, `postMessage`, named-window reuse, request bodies, and `window.close()` for OAuth, payment, and similar popup protocols. Unsupported URL schemes are denied before either path.
>
+5 -9
View File
@@ -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 persists most stores as JSON files, and agent timelines and agent message queues 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.
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`).
@@ -60,6 +60,9 @@ $PASEO_HOME/
│ └── {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
@@ -185,7 +188,7 @@ 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 and agent message queues live here. Each store is a
(`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
@@ -219,13 +222,6 @@ of a streamed assistant or reasoning message is stored as one chunk per source e
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).
### Agent message queues
`AgentMessageQueueStore` stores undelivered per-recipient messages in `agent_message_queue_items`
and monotonic per-recipient sequence counters in `agent_message_queue_recipients`. Message text and
structured payloads are stored as JSON strings so NUL bytes and lone surrogates round-trip through
`node:sqlite`. See [agent-lifecycle.md](agent-lifecycle.md).
---
## 2. Daemon Configuration
+3 -7
View File
@@ -257,13 +257,9 @@ Do not put any other code modules in the plugin root.
Shared files import contract helpers and types from `@getpaseo/plugin`. Server handler files import
`PluginHandlerContext` from `@getpaseo/plugin/server`. Client files import Paseo UI from
`@getpaseo/plugin/client/ui`. The module provides host-rendered `Icon` and `ProviderIcon`
components. `Icon` draws a Lucide name from the client's installed icon set, or any `PluginIcon`
through its `icon` prop; an unknown name or unsafe SVG renders nothing so it cannot break the
plugin surface. `ProviderIcon` resolves a built-in, catalog, or host-scoped plugin provider icon,
defaulting to the installation's host when `hostId` is omitted; unknown providers render the
standard provider fallback. `PluginCatalogSync` hydrates the host's provider snapshot before
installing client contributions so `ProviderIcon` resolves plugin SVGs on initial render.
`@getpaseo/plugin/client/ui`. Its `Icon` draws a Lucide name from the client's installed
icon set, or any `PluginIcon` through its `icon` prop; an unknown name or unsafe SVG renders nothing
so it cannot break the plugin surface.
Its controlled modal keeps presentation metadata on `<Modal title="…" icon={…}>` and body UI in
`<Modal.Content>`. Body layout, sheet-aware scrolling, and clipboard actions follow the
[host UI contract](../public-docs/plugins/reference.md#host-ui).
+1 -1
View File
@@ -1 +1 @@
sha256-oBd6CQ8+BhzMHhrpRIwzojuFPUwqXpgc3ZAPqKPs5QQ=
sha256-x6E6SY98/8pUNLomlPzSNedZ+ZKJPzsQeS9L455i+n0=
+29 -29
View File
@@ -1,12 +1,12 @@
{
"name": "paseo",
"version": "0.19.0-beta.1",
"version": "0.18.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "paseo",
"version": "0.19.0-beta.1",
"version": "0.18.2",
"hasInstallScript": true,
"license": "Apache-2.0",
"workspaces": [
@@ -37552,7 +37552,7 @@
},
"packages/app": {
"name": "@getpaseo/app",
"version": "0.19.0-beta.1",
"version": "0.18.2",
"dependencies": {
"@codemirror/commands": "6.10.4",
"@codemirror/language": "6.12.4",
@@ -39705,13 +39705,13 @@
},
"packages/cli": {
"name": "@getpaseo/cli",
"version": "0.19.0-beta.1",
"version": "0.18.2",
"license": "Apache-2.0",
"dependencies": {
"@clack/prompts": "^1.0.0",
"@getpaseo/client": "0.19.0-beta.1",
"@getpaseo/protocol": "0.19.0-beta.1",
"@getpaseo/server": "0.19.0-beta.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",
@@ -39961,11 +39961,11 @@
},
"packages/client": {
"name": "@getpaseo/client",
"version": "0.19.0-beta.1",
"version": "0.18.2",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/protocol": "0.19.0-beta.1",
"@getpaseo/relay": "0.19.0-beta.1",
"@getpaseo/protocol": "0.18.2",
"@getpaseo/relay": "0.18.2",
"ws": "^8.20.0",
"zod": "^4.4.3"
},
@@ -39977,7 +39977,7 @@
},
"packages/desktop": {
"name": "@getpaseo/desktop",
"version": "0.19.0-beta.1",
"version": "0.18.2",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/cli": "*",
@@ -40221,7 +40221,7 @@
},
"packages/expo-two-way-audio": {
"name": "@getpaseo/expo-two-way-audio",
"version": "0.19.0-beta.1",
"version": "0.18.2",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.5.14",
@@ -40267,7 +40267,7 @@
},
"packages/highlight": {
"name": "@getpaseo/highlight",
"version": "0.19.0-beta.1",
"version": "0.18.2",
"license": "Apache-2.0",
"dependencies": {
"@codemirror/language": "6.12.4",
@@ -40297,7 +40297,7 @@
},
"packages/plugin": {
"name": "@getpaseo/plugin",
"version": "0.19.0-beta.1",
"version": "0.18.2",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "^1.4.0",
@@ -40305,8 +40305,8 @@
"use-sync-external-store": "^1.6.0"
},
"devDependencies": {
"@getpaseo/client": "0.19.0-beta.1",
"@getpaseo/protocol": "0.19.0-beta.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",
@@ -40316,8 +40316,8 @@
"zod": "^4.4.3"
},
"peerDependencies": {
"@getpaseo/client": "0.19.0-beta.1",
"@getpaseo/protocol": "0.19.0-beta.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"
@@ -40339,7 +40339,7 @@
},
"packages/protocol": {
"name": "@getpaseo/protocol",
"version": "0.19.0-beta.1",
"version": "0.18.2",
"license": "Apache-2.0",
"dependencies": {
"semver": "^7.8.5",
@@ -40366,7 +40366,7 @@
}
},
"packages/react-native-enriched-markdown": {
"version": "0.19.0-beta.1",
"version": "0.18.2",
"hasInstallScript": true,
"license": "MIT",
"peerDependencies": {
@@ -40382,7 +40382,7 @@
},
"packages/relay": {
"name": "@getpaseo/relay",
"version": "0.19.0-beta.1",
"version": "0.18.2",
"license": "Apache-2.0",
"dependencies": {
"@noble/ciphers": "^2.4.0",
@@ -40604,17 +40604,17 @@
},
"packages/server": {
"name": "@getpaseo/server",
"version": "0.19.0-beta.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.19.0-beta.1",
"@getpaseo/highlight": "0.19.0-beta.1",
"@getpaseo/plugin": "0.19.0-beta.1",
"@getpaseo/protocol": "0.19.0-beta.1",
"@getpaseo/relay": "0.19.0-beta.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",
@@ -41579,7 +41579,7 @@
},
"packages/website": {
"name": "@getpaseo/website",
"version": "0.19.0-beta.1",
"version": "0.18.2",
"dependencies": {
"@cloudflare/vite-plugin": "^1.29.1",
"@cloudflare/workers-types": "^4.20260317.1",
@@ -43205,7 +43205,7 @@
},
"plugins": {
"name": "@getpaseo/builtin-plugins",
"version": "0.19.0-beta.1",
"version": "0.18.2",
"dependencies": {
"@getpaseo/plugin": "*",
"zod": "^4.4.3"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "paseo",
"version": "0.19.0-beta.1",
"version": "0.18.2",
"private": true,
"description": "Paseo: voice-controlled development environment for local AI coding agents",
"keywords": [
@@ -20,7 +20,9 @@ import {
} from "../support/helpers/composer";
import { openCommandCenter, closeCommandCenter } from "../support/helpers/command-center";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import {
PROMPT_PLUGIN_ID,
expectPromptsDrawnByPlugin,
withPromptTimelinePlugin,
} from "../support/helpers/plugin-timeline";
@@ -279,6 +281,7 @@ test("finds text in a prompt a timeline plugin draws", async ({ page }, testInfo
await agent.client.waitForFinish(agent.agentId, 15_000);
await withPromptTimelinePlugin(async () => {
await openAgentRoute(page, agent);
await approveClientPluginsInUi(page, [PROMPT_PLUGIN_ID]);
await expectPromptsDrawnByPlugin(page);
await openChatFind(page);
await query(page).fill("scope-needle");
@@ -25,7 +25,9 @@ import {
expectReadingStreamedMarkdown,
} from "../support/helpers/chat-outline";
import { createCreationScenario } from "../support/helpers/creation";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import {
PROMPT_PLUGIN_ID,
attachPromptTimelineEvidence,
expectPromptsDrawnByPlugin,
expectVirtualizedPluginPromptVisible,
@@ -118,6 +120,7 @@ test.describe("desktop chat outline", () => {
await withPromptTimelinePlugin(async () => {
await page.setViewportSize(WIDE_VIEWPORT);
await openAgentTimeline(page, agent);
await approveClientPluginsInUi(page, [PROMPT_PLUGIN_ID]);
await expectChatOutlinePrompts(page, 80);
await expectPromptsDrawnByPlugin(page);
await expectTimelinePromptNotMounted(page, agent.prompts[39]);
@@ -148,6 +151,7 @@ test.describe("desktop chat outline", () => {
const history = await holdOlderHistoryPages(page, agent);
await page.setViewportSize(WIDE_VIEWPORT);
await openAgentTimeline(page, agent);
await approveClientPluginsInUi(page, [PROMPT_PLUGIN_ID]);
await expectChatOutlinePrompts(page, 80);
await scrollThroughOlderHistoryPages(page, 2, history);
await scrollTimelineToNewestLoadedEdge(page);
@@ -1,4 +1,5 @@
import { expect, test, type Page } from "../support/fixtures";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { withDirectoryPlugin } from "../support/helpers/plugin-timeline";
import {
attachImageFromMenu,
@@ -158,6 +159,7 @@ test.describe("Client slash commands", () => {
}`,
run: async () => {
await withOpenReadyMockAgent(page, { title: "Attached slash command" }, async () => {
await approveClientPluginsInUi(page, ["attachment-slash-e2e"]);
const input = composerLocator(page);
await input.fill("/pict");
await expect(
@@ -21,7 +21,6 @@ import {
expectAttachButtonDisabled,
fillComposerDraft,
dropFileOnComposer,
pasteFilesIntoComposer,
sendDraftToQueue,
expectQueuedMessageButton,
startRunningMockAgent,
@@ -153,7 +152,7 @@ test.describe("Composer attachments", () => {
// needed before this can be exercised end-to-end.
});
test("attaches files from the menu, clipboard, and drag and drop", async ({
test("attaches, previews, and removes an image before dropping a file", async ({
page,
withWorkspace,
}) => {
@@ -186,19 +185,6 @@ test.describe("Composer attachments", () => {
await expectComposerFocused(page);
});
await test.step("paste a Markdown file into the composer", async () => {
const file = {
name: "notes.md",
mimeType: "text/markdown",
buffer: Buffer.from("# Clipboard notes"),
};
const handled = await pasteFilesIntoComposer(page, [file]);
await expect(page.getByText(file.name, { exact: true })).toBeVisible();
await expect(page.getByRole("button", { name: file.name, exact: true })).toBeVisible();
expect(handled).toBe(true);
await expectComposerDraft(page, "");
});
await test.step("dropping an image focuses the composer", async () => {
await blurComposerInput(page);
await expectComposerNotFocused(page);
@@ -206,15 +192,6 @@ test.describe("Composer attachments", () => {
await expectAttachmentPill(page, "composer-image-attachment-pill");
await expectComposerFocused(page);
});
await test.step("paste a file and an image together", async () => {
await removeAttachmentPill(page, "composer-image-attachment-pill", "Remove image attachment");
await expect(page.getByTestId("composer-image-attachment-pill")).toHaveCount(0);
const file = { ...TEST_JSON, name: "clipboard.json" };
await pasteFilesIntoComposer(page, [file, TEST_IMAGE]);
await expect(page.getByRole("button", { name: file.name, exact: true })).toBeVisible();
await expectAttachmentPill(page, "composer-image-attachment-pill");
});
});
test("dropped JSON file renders as a file attachment in New Workspace", async ({ page }) => {
@@ -172,7 +172,7 @@ test("retrying failed agent initialization keeps the plugin metadata set on New
startup,
composerMetadata,
}) => {
await creation.openWorkspaceForm("local");
await creation.openWorkspaceForm("local", { approvePlugins: ["composer-metadata"] });
await composerMetadata.set({ "composer-metadata.tag": "kept" });
await creation.submitPrompt("Start the tagged task.", "Create");
await creation.expectAgentStillStarting();
@@ -15,6 +15,7 @@ import {
setNotificationSwitch,
setPluginNotificationSwitch,
} from "../support/helpers/notification-settings";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { copyPluginExample } from "../support/helpers/plugin-fixture";
import { seedWorkspace, type SeedDaemonClient } from "../support/helpers/seed-client";
@@ -173,6 +174,7 @@ test.describe("Settings → Notifications and OS notification filtering", () =>
await seeded.client.patchDaemonConfig({ pluginsEnabled: true });
await seeded.client.installDirectoryPlugin(pluginExample.directory);
installedPlugin = true;
await approveClientPluginsInUi(page, ["notifications-example"]);
const pluginToggle = page.getByRole("switch", { name: "Build alerts", exact: true });
await expect(pluginToggle).toBeVisible();
@@ -0,0 +1,279 @@
import path from "node:path";
import { expect, test } from "../support/fixtures";
import { gotoAppShell, openSettings } from "../support/helpers/app";
import { openHostSection } from "../support/helpers/settings";
import { getServerId } from "../support/helpers/server-id";
import { waitForSettledPosition } from "../support/helpers/sheet-layout";
import { openPluginPage, openPluginPageActions } from "../support/helpers/plugin-gallery";
import {
allowPluginExecution,
cancelPluginExecutionBypassConfirm,
confirmPluginExecutionBypass,
declinePluginExecution,
ensureArtifactsDir,
expectExecutedPluginMarkers,
expectExecutedPluginMarkersContain,
expectPluginApprovalPrompt,
expectPluginExecutionBypass,
getExecutedPluginMarkers,
openPluginExecutionBypassConfirm,
pluginApprovalSheet,
pluginExecutionBypassConfirmModal,
pluginExecutionBypassSwitch,
reloadKeepingPersistedState,
setPluginExecutionBypass,
withInstalledClientPlugins,
type ClientProbePluginSpec,
} from "../support/helpers/plugin-execution-approval";
const REPO_ROOT = path.resolve(__dirname, "../../../..");
const ALPHA: ClientProbePluginSpec = {
id: "alpha-probe",
name: "Alpha Probe",
sidebarTitle: "Alpha Probe",
markerKey: "alpha-probe",
};
const BETA: ClientProbePluginSpec = {
id: "beta-probe",
name: "Beta Probe",
sidebarTitle: "Beta Probe",
markerKey: "beta-probe",
};
const GAMMA: ClientProbePluginSpec = {
id: "gamma-probe",
name: "Gamma Probe",
sidebarTitle: "Gamma Probe",
markerKey: "gamma-probe",
};
test("prompts sequentially before evaluating stacked client plugins, holds layout steady, persists decisions, and lets settings allow or block them", async ({
page,
}) => {
test.setTimeout(120_000);
await page.setViewportSize({ width: 1440, height: 900 });
const artifacts = await ensureArtifactsDir(REPO_ROOT);
await withInstalledClientPlugins([ALPHA, BETA, GAMMA], async () => {
await gotoAppShell(page);
await test.step("no client plugin executes before user approval", async () => {
await expectPluginApprovalPrompt(page, { pluginId: ALPHA.id, progress: "1 of 3" });
expect(await getExecutedPluginMarkers(page)).toEqual([]);
await expect(page.getByText(ALPHA.sidebarTitle, { exact: true })).toHaveCount(0);
await expect(page.getByText(BETA.sidebarTitle, { exact: true })).toHaveCount(0);
await expect(page.getByText(GAMMA.sidebarTitle, { exact: true })).toHaveCount(0);
await page.screenshot({ path: path.join(artifacts, "02-after-prompt-1-of-3.png") });
});
await test.step("approving the first advances in place with steady button geometry", async () => {
const sheet = pluginApprovalSheet(page);
const allowButton = sheet.getByRole("button", { name: "Allow", exact: true });
const declineButton = sheet.getByRole("button", { name: "Don't allow", exact: true });
const beforeAllow = await allowButton.boundingBox();
const beforeDecline = await declineButton.boundingBox();
expect(beforeAllow).not.toBeNull();
expect(beforeDecline).not.toBeNull();
await allowPluginExecution(page);
await expectPluginApprovalPrompt(page, { pluginId: BETA.id, progress: "2 of 3" });
await expectExecutedPluginMarkers(page, [ALPHA.markerKey]);
await expect(page.getByText(ALPHA.sidebarTitle, { exact: true })).toBeVisible();
await expect(page.getByText(BETA.sidebarTitle, { exact: true })).toHaveCount(0);
const afterAllow = await allowButton.boundingBox();
const afterDecline = await declineButton.boundingBox();
expect(afterAllow).toEqual(beforeAllow);
expect(afterDecline).toEqual(beforeDecline);
await page.screenshot({ path: path.join(artifacts, "03-after-prompt-2-of-3.png") });
});
await test.step("declining the second and approving the third settles cleanly", async () => {
await declinePluginExecution(page);
await expectPluginApprovalPrompt(page, { pluginId: GAMMA.id, progress: "3 of 3" });
expect(await getExecutedPluginMarkers(page)).toEqual([ALPHA.markerKey]);
await allowPluginExecution(page);
await expect(pluginApprovalSheet(page)).toHaveCount(0);
await expectExecutedPluginMarkers(page, [ALPHA.markerKey, GAMMA.markerKey]);
await expect(page.getByText(ALPHA.sidebarTitle, { exact: true })).toBeVisible();
await expect(page.getByText(GAMMA.sidebarTitle, { exact: true })).toBeVisible();
await expect(page.getByText(BETA.sidebarTitle, { exact: true })).toHaveCount(0);
await page.screenshot({
path: path.join(artifacts, "04-after-settled-approved-and-declined.png"),
});
});
await test.step("reloading keeps approved plugins active and declined blocked without re-prompting", async () => {
await reloadKeepingPersistedState(page);
await expect(page.getByText(ALPHA.sidebarTitle, { exact: true })).toBeVisible({
timeout: 30_000,
});
await expect(page.getByText(GAMMA.sidebarTitle, { exact: true })).toBeVisible();
await expect(pluginApprovalSheet(page)).toHaveCount(0);
expect(await getExecutedPluginMarkers(page)).toEqual([ALPHA.markerKey, GAMMA.markerKey]);
await expect(page.getByText(BETA.sidebarTitle, { exact: true })).toHaveCount(0);
});
await test.step("settings surfaces the declined plugin and lets the user allow or block it", async () => {
await openSettings(page);
await openHostSection(page, getServerId(), "plugins");
await expect(page.getByTestId(`plugin-row-${BETA.id}`)).toContainText("blocked");
await openPluginPage(page, BETA.name, BETA.id);
await expect(page.getByTestId("plugin-client-blocked-alert")).toBeVisible();
await page.screenshot({ path: path.join(artifacts, "05-after-settings-blocked-plugin.png") });
await page.getByTestId("plugin-client-execution-allow").click();
await expect(page.getByTestId("plugin-client-blocked-alert")).toHaveCount(0);
await expectExecutedPluginMarkersContain(page, BETA.markerKey);
await openPluginPageActions(page, BETA.name);
await page.getByRole("menuitem", { name: "Block on this device", exact: true }).click();
await expect(page.getByTestId("plugin-client-blocked-alert")).toBeVisible();
});
});
});
test("presents the queued approval bottom sheet cleanly on compact viewports and closes cleanly on dismiss", async ({
page,
}) => {
test.setTimeout(120_000);
await page.setViewportSize({ width: 390, height: 844 });
const artifacts = await ensureArtifactsDir(REPO_ROOT);
await withInstalledClientPlugins([ALPHA, BETA], async () => {
await gotoAppShell(page);
await test.step("shows the first prompt in a compact bottom sheet", async () => {
await expectPluginApprovalPrompt(page, { pluginId: ALPHA.id, progress: "1 of 2" });
await waitForSettledPosition(pluginApprovalSheet(page));
expect(await getExecutedPluginMarkers(page)).toEqual([]);
await page.screenshot({ path: path.join(artifacts, "06-after-compact-sheet-1-of-2.png") });
});
await test.step("approves the first and dismisses the remaining queue cleanly", async () => {
await allowPluginExecution(page);
await expectPluginApprovalPrompt(page, { pluginId: BETA.id, progress: "2 of 2" });
await expectExecutedPluginMarkers(page, [ALPHA.markerKey]);
await page.getByRole("button", { name: "Close", exact: true }).click();
await expect(pluginApprovalSheet(page)).toHaveCount(0);
expect(await getExecutedPluginMarkers(page)).toEqual([ALPHA.markerKey]);
});
});
});
test("lets Settings -> General toggle bypass client plugin approval, persists across reload, and restores prompting when turned off", async ({
page,
}) => {
test.setTimeout(120_000);
await page.setViewportSize({ width: 1440, height: 900 });
const artifacts = await ensureArtifactsDir(REPO_ROOT);
await withInstalledClientPlugins([ALPHA, BETA], async ({ install }) => {
await gotoAppShell(page);
await test.step("approve one plugin and decline the other before opening Settings -> General", async () => {
await expectPluginApprovalPrompt(page, { pluginId: ALPHA.id, progress: "1 of 2" });
await allowPluginExecution(page);
await expectPluginApprovalPrompt(page, { pluginId: BETA.id, progress: "2 of 2" });
await declinePluginExecution(page);
await expect(pluginApprovalSheet(page)).toHaveCount(0);
await expectExecutedPluginMarkers(page, [ALPHA.markerKey]);
});
await test.step("General settings shows the minimal bypass toggle off by default", async () => {
await openSettings(page);
const row = page.getByTestId("settings-plugin-execution-bypass-row");
await expect(row).toBeVisible();
await expect(row).toContainText("Run plugins without asking");
await expect(row).not.toContainText("Unsafe");
await expect(row).toContainText(
"Any connected host can run plugin code inside Paseo and reach your other hosts",
);
await expectPluginExecutionBypass(page, false);
await page.screenshot({
path: path.join(artifacts, "settings-general-plugin-bypass-off-desktop.png"),
});
});
await test.step("turning bypass on requires confirmation and canceling keeps it off", async () => {
await openPluginExecutionBypassConfirm(page);
const modal = pluginExecutionBypassConfirmModal(page);
await expect(modal).toContainText("Run plugins without asking?");
await expect(modal).toContainText(
"Any connected host can run plugin code inside Paseo and reach your other connected hosts.",
);
await expectPluginExecutionBypass(page, false);
await expect(modal.getByRole("dialog")).toHaveCSS("opacity", "1");
await page.screenshot({
path: path.join(artifacts, "settings-general-plugin-bypass-confirm-desktop.png"),
});
await cancelPluginExecutionBypassConfirm(page);
expect(await getExecutedPluginMarkers(page)).toEqual([ALPHA.markerKey]);
});
await test.step("confirming turns bypass on and runs declined and newly installed plugins without prompting", async () => {
await openPluginExecutionBypassConfirm(page);
await confirmPluginExecutionBypass(page);
await expectExecutedPluginMarkersContain(page, BETA.markerKey);
await expect(pluginApprovalSheet(page)).toHaveCount(0);
await install(GAMMA);
await expectExecutedPluginMarkersContain(page, GAMMA.markerKey);
await expect(pluginApprovalSheet(page)).toHaveCount(0);
// Let the 180ms switch track animation settle before capturing the ON screenshot.
await page.waitForTimeout(300);
await page.screenshot({
path: path.join(artifacts, "settings-general-plugin-bypass-on-desktop.png"),
});
});
await test.step("reloading preserves bypass on and runs all plugins without prompting", async () => {
await reloadKeepingPersistedState(page);
await expectPluginExecutionBypass(page, true);
await expectExecutedPluginMarkersContain(page, ALPHA.markerKey);
await expectExecutedPluginMarkersContain(page, BETA.markerKey);
await expectExecutedPluginMarkersContain(page, GAMMA.markerKey);
await expect(pluginApprovalSheet(page)).toHaveCount(0);
});
await test.step("turning bypass off needs no confirmation, restores prompting for unreviewed plugins, and persists across reload", async () => {
await setPluginExecutionBypass(page, false);
await expectPluginApprovalPrompt(page, { pluginId: GAMMA.id });
await declinePluginExecution(page);
await expect(pluginApprovalSheet(page)).toHaveCount(0);
await reloadKeepingPersistedState(page);
await expectPluginExecutionBypass(page, false);
await expect(pluginApprovalSheet(page)).toHaveCount(0);
await expectExecutedPluginMarkers(page, [ALPHA.markerKey]);
});
await test.step("compact mobile viewport renders the General toggle and confirm sheet cleanly", async () => {
await page.setViewportSize({ width: 390, height: 844 });
const row = page.getByTestId("settings-plugin-execution-bypass-row");
const toggle = pluginExecutionBypassSwitch(page);
await expect(row).toBeVisible();
await expect(toggle).toBeVisible();
const rowBox = await row.boundingBox();
const toggleBox = await toggle.boundingBox();
expect(rowBox).not.toBeNull();
expect(toggleBox).not.toBeNull();
expect(toggleBox!.x + toggleBox!.width).toBeLessThanOrEqual(390);
await page.screenshot({
path: path.join(artifacts, "settings-general-plugin-bypass-compact.png"),
});
await openPluginExecutionBypassConfirm(page);
await waitForSettledPosition(pluginExecutionBypassConfirmModal(page));
await page.screenshot({
path: path.join(artifacts, "settings-general-plugin-bypass-confirm-compact.png"),
});
await cancelPluginExecutionBypassConfirm(page);
});
});
});
@@ -3,6 +3,7 @@ import { readFile, writeFile } from "node:fs/promises";
import path from "node:path";
import type { Frame, TestInfo } from "@playwright/test";
import { expect, test, type Page } from "../support/fixtures";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { copyPluginExample } from "../support/helpers/plugin-fixture";
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
import { seedWorkspace } from "../support/helpers/seed-client";
@@ -172,6 +173,7 @@ test("directory examples mount the PDF frame and write Markdown through the file
await page.setViewportSize(WIDE);
const gate = await installDaemonWebSocketGate(page);
await gotoWorkspace(page, workspace.workspaceId);
await approveClientPluginsInUi(page, ["pdf-panel", "markdown-panel"]);
await openFileExplorer(page);
await openFile(page, "report.pdf");
await expect(page.getByTitle("Document preview", { exact: true })).toHaveAttribute(
@@ -6,6 +6,7 @@ import { expectFileTabOpen, openFileExplorer } from "../support/helpers/file-exp
import {
BUILTIN_MARKDOWN_OPTION,
MARKDOWN_PANEL_ID,
MARKDOWN_PANEL_PLUGIN_ID,
PLUGIN_MARKDOWN_OPTION,
expectBuiltinMarkdown,
expectPluginMarkdown,
@@ -14,6 +15,7 @@ import {
openMarkdown,
storedFilePanelAssociations,
} from "../support/helpers/markdown-file-panel-plugin";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
async function choosePanel(page: Page, option: string, options: { remember: boolean }) {
await page.getByRole("radio", { name: option, exact: true }).click();
@@ -110,6 +112,7 @@ test("asks once which panel opens Markdown and remembers it when told to", async
try {
await page.setViewportSize({ width: 1280, height: 900 });
await gotoWorkspace(page, workspace.workspaceId);
await approveClientPluginsInUi(page, [MARKDOWN_PANEL_PLUGIN_ID]);
await openFileExplorer(page);
// First open: the built-in renders under the picker.
@@ -6,6 +6,7 @@ import { gotoWorkspace } from "../support/helpers/launcher";
import {
BUILTIN_MARKDOWN_OPTION,
MARKDOWN_PANEL_ID,
MARKDOWN_PANEL_PLUGIN_ID,
PLUGIN_MARKDOWN_OPTION,
expectPluginMarkdown,
filePanelPicker,
@@ -13,6 +14,7 @@ import {
openMarkdown,
storedFilePanelAssociations,
} from "../support/helpers/markdown-file-panel-plugin";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { seedWorkspace } from "../support/helpers/seed-client";
import { openSettingsSection } from "../support/helpers/settings";
@@ -59,6 +61,7 @@ test("Settings > Files chooses which panel opens .md and asks again on request",
try {
await page.setViewportSize({ width: 1280, height: 900 });
await gotoWorkspace(page, workspace.workspaceId);
await approveClientPluginsInUi(page, [MARKDOWN_PANEL_PLUGIN_ID]);
await openFilesSettings(page);
// Nothing remembered: the row asks every time and has nothing to forget.
@@ -3,6 +3,7 @@ import { tmpdir } from "node:os";
import path from "node:path";
import { expect, test, type Page } from "../support/fixtures";
import { installDaemonWebSocketGate } from "../support/helpers/daemon-websocket-gate";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { pluginRequirements } from "../support/helpers/plugin-fixture";
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
import { seedWorkspace } from "../support/helpers/seed-client";
@@ -131,6 +132,7 @@ test("directory plugins render PDF bytes and write Markdown through the file han
await page.setViewportSize({ width: 1280, height: 900 });
const gate = await installDaemonWebSocketGate(page);
await gotoWorkspace(page, workspace.workspaceId);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await openFileExplorer(page);
await openWorkspaceFile(page, "report.pdf");
await expect(page.getByText("PDF plugin: report.pdf", { exact: true })).toBeVisible();
@@ -9,8 +9,8 @@ import {
expectRemovedPlugin,
} from "../support/helpers/plugin-reconnect";
import { verifyPluginTranslations } from "../support/helpers/plugin-translations";
import { copyPluginExample, pluginRequirements } from "../support/helpers/plugin-fixture";
import { expectProviderIcon, readIconPaths } from "../support/helpers/plugin-provider-icons";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { pluginRequirements } from "../support/helpers/plugin-fixture";
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
@@ -27,7 +27,7 @@ const TINY_PNG = Buffer.from(
);
const PLUGIN_SOURCE = `import { usePaseo } from "@getpaseo/plugin/client";
import { Icon, Modal, ProviderIcon, useToast, Markdown } from "@getpaseo/plugin/client/ui";
import { Icon, Modal, useToast, Markdown } from "@getpaseo/plugin/client/ui";
import { useQueryClient } from "@tanstack/react-query";
import React, { useState } from "react";
import { Pressable, Text, View } from "react-native";
@@ -54,7 +54,7 @@ function ModalBody({ onSaved }) {
</View>;
}
function Surface({ host, theme, playAudio }) {
function Surface({ playAudio }) {
const [audioStatus, setAudioStatus] = useState("Audio ready");
async function play(base64) {
setAudioStatus("Playing audio");
@@ -63,18 +63,6 @@ function Surface({ host, theme, playAudio }) {
}
const [open, setOpen] = useState(false);
return <View>
<View testID="plugin-provider-icon-builtin">
<ProviderIcon provider="codex" size={18} color={theme.colors.foreground} />
</View>
<View testID="plugin-provider-icon-plugin">
<ProviderIcon provider="direct-example" hostId={host.id} size={18} color={theme.colors.foreground} />
</View>
<View testID="plugin-provider-icon-fallback">
<ProviderIcon provider="unknown-provider-e2e" size={18} color={theme.colors.foreground} />
</View>
<View testID="plugin-provider-icon-bot-ref">
<Icon name="Bot" size={18} color={theme.colors.foreground} />
</View>
<Text>{audioStatus}</Text>
<Markdown>{"![Before](" + SCREENSHOT_PATH + ")\\n\\n![After](" + SCREENSHOT_FILE_URL + ")"}</Markdown>
<Pressable accessibilityRole="button" onPress={() => play(AUDIO_BASE64)}><Text>Play plugin audio</Text></Pressable>
@@ -99,7 +87,7 @@ function Surface({ host, theme, playAudio }) {
}
export default function contribute(plugin) {
plugin.addSurface("main", (props) => <Surface {...props} playAudio={plugin.playAudio} />);
plugin.addSurface("main", () => <Surface playAudio={plugin.playAudio} />);
plugin.addSidebarItem({
id: "main",
title: "Host UI",
@@ -111,6 +99,7 @@ export default function contribute(plugin) {
async function openHostUiPlugin(page: Page): Promise<void> {
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await page.getByRole("button", { name: "Host UI", exact: true }).click();
}
@@ -179,9 +168,8 @@ async function savePluginIssue(page: Page): Promise<void> {
await expect(page.getByText("Plugin modal contexts ready", { exact: true })).not.toBeVisible();
}
test("plugin host UI renders provider icons and preserves modal contexts", async ({ page }) => {
test("plugin modal adapts its presentation and preserves host contexts", async ({ page }) => {
const directory = await mkdtemp(path.join(tmpdir(), "paseo-plugin-host-ui-e2e-"));
const providerPlugin = await copyPluginExample("provider-direct");
const client = await connectNewWorkspaceDaemonClient({ ownProjects: false });
const previousConfig = await client.getDaemonConfig();
await writeFile(
@@ -201,29 +189,10 @@ test("plugin host UI renders provider icons and preserves modal contexts", async
try {
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installDirectoryPlugin(providerPlugin.directory);
await client.installDirectoryPlugin(directory);
await useNonCompactLayout(page);
await openHostUiPlugin(page);
await test.step("ProviderIcon renders built-in, daemon plugin SVG, and fallback icons", async () => {
const providerIconPaths = await readIconPaths(page, providerPlugin.directory);
await expectProviderIcon(page.getByTestId("plugin-provider-icon-plugin"), providerIconPaths);
const builtinSvg = page.getByTestId("plugin-provider-icon-builtin").locator("svg");
const fallbackSvg = page.getByTestId("plugin-provider-icon-fallback").locator("svg");
const botRefSvg = page.getByTestId("plugin-provider-icon-bot-ref").locator("svg");
await expect(builtinSvg).toBeVisible();
await expect(fallbackSvg).toBeVisible();
await expect(botRefSvg).toBeVisible();
const fallbackMarkup = await fallbackSvg.innerHTML();
const botRefMarkup = await botRefSvg.innerHTML();
const builtinMarkup = await builtinSvg.innerHTML();
expect(fallbackMarkup).toBe(botRefMarkup);
expect(builtinMarkup).not.toBe(botRefMarkup);
});
await test.step("plugin screen Markdown renders local absolute and file:// PNG images inline", async () => {
await expectLoadedMarkdownImage(page, "Before");
await expectLoadedMarkdownImage(page, "After");
@@ -250,13 +219,11 @@ test("plugin host UI renders provider icons and preserves modal contexts", async
});
} finally {
await client.removePlugin(PLUGIN_ID).catch(() => undefined);
await client.removePlugin("provider-direct-example").catch(() => undefined);
await client
.patchDaemonConfig({ pluginsEnabled: previousConfig.config.pluginsEnabled ?? false })
.catch(() => undefined);
await client.close().catch(() => undefined);
await rm(directory, { recursive: true, force: true });
await providerPlugin.cleanup();
}
});
@@ -6,6 +6,7 @@ import { expect, test, type Page } from "../support/fixtures";
import { openCommandCenter } from "../support/helpers/command-center";
import { gotoAppShell } from "../support/helpers/app";
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { pluginRequirements } from "../support/helpers/plugin-fixture";
import { seedWorkspace } from "../support/helpers/seed-client";
import { getServerId } from "../support/helpers/server-id";
@@ -87,6 +88,7 @@ test.describe("plugin icons", () => {
await client.installDirectoryPlugin(directory);
await page.setViewportSize({ width: 1280, height: 800 });
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
const target = { serverId: getServerId(), workspaceId: workspace.workspaceId };
await waitForWorkspaceInSidebar(page, target);
await switchWorkspaceViaSidebar({ page, ...target });
@@ -1,5 +1,6 @@
import { existsSync } from "node:fs";
import overviewCorpus from "../../../protocol/tests/fixtures/plugin-overview.json";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { pluginRequirements } from "../support/helpers/plugin-fixture";
import { execFileSync } from "node:child_process";
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
@@ -500,6 +501,7 @@ async function installLocalPluginWithStatusExamples(
const catalog = observePluginCatalog(page);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["failed-preview-plugin"]);
await openPluginSettings(page);
await catalog.waitForInitialFetch();
await expectPluginFailed(page, "failed-preview-plugin");
@@ -514,6 +516,7 @@ async function installLocalPluginWithStatusExamples(
await openSourceInstall(page);
await expectPluginSourceDocsOpen(page);
await submitSourceInstall(page, directory);
await approveClientPluginsInUi(page, ["e2e-plugin"]);
await expectSourceInstalled(page, "e2e-plugin");
await expectPluginOn(page, "e2e-plugin");
await expectPluginHealthy(page, "e2e-plugin");
@@ -605,6 +608,7 @@ async function toggleRemoveAndReinstallLocalPlugin(page: Page, directory: string
await expectPluginRemoved(page, "e2e-plugin");
await installFromSource(page, directory, "e2e-plugin");
await approveClientPluginsInUi(page, ["e2e-plugin"]);
await expectPluginOn(page, "e2e-plugin");
await gotoAppShell(page);
await openContribution(page, "Plugin v3", "Plugin v3 cleanup 7");
@@ -659,6 +663,10 @@ async function retryGitInstallAndInspectRows(
await capturePluginInstallForm(page, testInfo, "compact-error");
await submitSourceInstall(page, pathToFileURL(repository).href);
await approveClientPluginsInUi(page, [
"compact-plugin-with-a-realistically-long-name",
"git-e2e-plugin",
]);
await expectSourceInstalled(page, "git-e2e-plugin");
await expectPluginsOn(page);
await expectPluginOn(page, "git-e2e-plugin");
@@ -724,6 +732,7 @@ async function prepareLegacyPluginHost(
pluginGitManagement: true,
});
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["legacy-source-plugin"]);
await openPluginSettings(page);
return directory;
@@ -906,6 +915,7 @@ test("keeps Reload pending past a minute while the plugin queue is busy", async
// Plugins on is a precondition here, not the subject: set it through the daemon.
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installPluginSource({ source: pluginDirectory });
await approveClientPluginsInUi(page, ["e2e-plugin"]);
// Installed before Plugins opens, so it opens on the Installed tab.
await openPluginSettings(page);
await expectPluginOn(page, "e2e-plugin");
@@ -928,6 +938,7 @@ test("keeps Reload pending past a minute while the plugin queue is busy", async
await capturePluginSurface(page, testInfo, "plugin-reload-past-deadline.png");
await queue.release();
await approveClientPluginsInUi(page, ["gated-build-plugin"]);
// The daemon's answer only arrives once the plugin really started again.
await reload.waitForResponse();
expect(reload.requestCount()).toBe(1);
@@ -1,3 +1,4 @@
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { copyPluginExample } from "../support/helpers/plugin-fixture";
import { expect, test as base, type Page } from "../support/fixtures";
import { gotoAppShell } from "../support/helpers/app";
@@ -119,6 +120,7 @@ const test = base.extend<{ modalExample: Page }>({
async function openWideExamples(page: Page) {
await page.setViewportSize({ width: 1100, height: 800 });
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["modal-ui-example"]);
await page.getByRole("button", { name: "Modal examples", exact: true }).click();
}
@@ -1,7 +1,8 @@
import { expect, test, type Page } from "../support/fixtures";
import { composerLocator, submitMessageWithButton } from "../support/helpers/composer";
import { seedMockAgentWorkspace, openAgentRoute } from "../support/helpers/mock-agent";
import { withPopoverTimelinePlugin } from "../support/helpers/plugin-timeline";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { POPOVER_PLUGIN_ID, withPopoverTimelinePlugin } from "../support/helpers/plugin-timeline";
async function openPreviewWhileTyping(page: Page): Promise<void> {
await composerLocator(page).focus();
@@ -25,6 +26,7 @@ test("Escape dismisses a plugin preview before interrupting the agent", async ({
try {
await withPopoverTimelinePlugin(async () => {
await openAgentRoute(page, agent);
await approveClientPluginsInUi(page, [POPOVER_PLUGIN_ID]);
await submitMessageWithButton(page, "Show the plugin preview.");
await agent.client.waitForFinish(agent.agentId, 30_000);
await expect(page.getByRole("button", { name: "Hover plugin preview" })).toBeVisible();
@@ -12,7 +12,7 @@ test("shows which runtime is incompatible and recovers after the requirement is
}) => {
await openRequirementHost(page, requirementHost);
await expectAppMismatch(page);
await correctRequirementAndReload(page, requirementHost.directory);
await correctRequirementAndReload(page, requirementHost.directory, { approvePrompt: true });
await rejectDaemonMismatch(page, requirementHost.directory);
await correctRequirementAndReload(page, requirementHost.directory);
});
@@ -9,6 +9,7 @@ import {
LEGACY_PLUGIN_ID,
SHOWCASE_PLUGIN_ID,
WIDE,
approveSidebarPluginsInUi,
closeScreen,
expectRowActive,
footerItem,
@@ -182,6 +183,7 @@ test.describe("Plugin sidebar items", () => {
}) => {
await page.setViewportSize({ width: 390, height: 600 });
await gotoAppShell(page);
await approveSidebarPluginsInUi(page);
await page.getByRole("button", { name: "Open menu", exact: true }).first().click();
await expect(botRow(page, "status")).toBeAttached();
const workspace = visibleTestId(page, `sidebar-workspace-row-${getServerId()}:${workspaceId}`);
@@ -213,6 +215,7 @@ test.describe("Plugin sidebar items", () => {
}) => {
await page.setViewportSize({ width: 1280, height: 480 });
await gotoAppShell(page);
await approveSidebarPluginsInUi(page);
await expect(botRow(page, "status")).toBeAttached();
const workspace = visibleTestId(page, `sidebar-workspace-row-${getServerId()}:${workspaceId}`);
await expect(workspace).toBeInViewport({ ratio: 1 });
@@ -240,6 +243,7 @@ test.describe("Plugin sidebar items", () => {
test("a restored plugin screen waits for its catalog before rendering", async ({ page }) => {
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
const row = headerRow(page, SHOWCASE_PLUGIN_ID, "deploys");
await expect(row).toBeVisible({ timeout: 30_000 });
await row.click();
@@ -278,6 +282,7 @@ test.describe("Plugin sidebar items", () => {
await seedSidebarFooterPreferences(page, [{ key: "usage", visible: true }]);
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
const row = headerRow(page, SHOWCASE_PLUGIN_ID, "deploys");
const sync = footerItem(page, SHOWCASE_PLUGIN_ID, "sync");
await expect(row).toBeVisible({ timeout: 30_000 });
@@ -365,6 +370,7 @@ test.describe("Plugin sidebar items", () => {
test("a plugin screen reads workspaces through the state hooks", async ({ page }) => {
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
await expect(headerRow(page, SHOWCASE_PLUGIN_ID, "deploys")).toBeVisible({ timeout: 30_000 });
await runCommand(page, "Open plugin workspaces");
await expect(screenTitle(page)).toHaveText("Workspaces");
@@ -375,6 +381,7 @@ test.describe("Plugin sidebar items", () => {
test("a plugin screen keeps the sidebar toggle before its title", async ({ page }) => {
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
await expect(headerRow(page, SHOWCASE_PLUGIN_ID, "deploys")).toBeVisible({ timeout: 30_000 });
await runCommand(page, "Open plugin workspaces");
await expect(screenTitle(page)).toHaveText("Workspaces");
@@ -394,6 +401,7 @@ test.describe("Plugin sidebar items", () => {
test("a header row's shortcut hint presses the row", async ({ page }) => {
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
const newWorkspace = visibleTestId(page, "sidebar-global-new-workspace");
await expect(newWorkspace).toBeVisible({ timeout: 30_000 });
await newWorkspace.hover();
@@ -419,6 +427,7 @@ test.describe("Plugin sidebar items", () => {
);
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
const entry = headerRow(page, LEGACY_PLUGIN_ID, "entry");
await expect(entry).toBeVisible({ timeout: 30_000 });
let entryIcon = "";
@@ -503,6 +512,7 @@ test.describe("Plugin sidebar items", () => {
test.setTimeout(180_000);
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
const bot1 = botRow(page, "bot-1");
const bot2 = botRow(page, "bot-2");
const status = botRow(page, "status");
@@ -587,6 +597,7 @@ test.describe("Plugin sidebar items", () => {
test.setTimeout(120_000);
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
await expect(botRow(page, "bot-1")).toBeVisible({ timeout: 30_000 });
const alerts = footerItem(page, BOTS_PLUGIN_ID, "alerts");
await expect(alerts).toHaveCount(0);
@@ -606,6 +617,7 @@ test.describe("Plugin sidebar items", () => {
const alerts = footerItem(page, BOTS_PLUGIN_ID, "alerts");
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
await expect(botRow(page, "bot-1")).toBeVisible({ timeout: 30_000 });
await runCommand(page, "Add bot alerts");
@@ -4,6 +4,7 @@ import { expect, test, type Page } from "../support/fixtures";
import { gotoAppShell } from "../support/helpers/app";
import { openCommandCenter } from "../support/helpers/command-center";
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { copyPluginExample } from "../support/helpers/plugin-fixture";
import { seedWorkspace, type SeededWorkspace } from "../support/helpers/seed-client";
import { getServerId } from "../support/helpers/server-id";
@@ -34,6 +35,7 @@ async function withExample(
await client.installDirectoryPlugin(copy.directory);
await page.setViewportSize({ width: 1280, height: 800 });
await gotoAppShell(page);
await approveClientPluginsInUi(page, [example.id]);
const target = { serverId: getServerId(), workspaceId: workspace.workspaceId };
await waitForWorkspaceInSidebar(page, target);
await switchWorkspaceViaSidebar({ page, ...target });
@@ -1,3 +1,4 @@
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { pluginRequirements } from "../support/helpers/plugin-fixture";
import { mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
@@ -63,8 +64,11 @@ const MOCHA_MUTED_FOREGROUND = "rgb(166, 173, 200)";
const LATTE_MUTED_FOREGROUND = "rgb(108, 111, 133)";
const LATTE_RING = "rgb(156, 160, 176)";
async function selectTheme(page: Page, name: string) {
async function selectTheme(page: Page, name: string, approvePluginId?: string) {
await page.goto("/settings");
if (approvePluginId) {
await approveClientPluginsInUi(page, [approvePluginId]);
}
await openSettingsSection(page, "appearance");
const theme = page.getByRole("radio", { name, exact: true });
await expect(theme).toBeVisible({ timeout: 30_000 });
@@ -108,7 +112,7 @@ test("keeps plugin workspace timestamps readable on state surfaces and honors ov
try {
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installDirectoryPlugin(directory);
await selectTheme(page, "Solarized Dark");
await selectTheme(page, "Solarized Dark", PLUGIN_ID);
await openAgentRoute(page, selected);
const selectedRow = page.getByTestId(
`sidebar-workspace-row-${getServerId()}:${selected.workspaceId}`,
@@ -160,6 +164,7 @@ test("applies a contributed theme and falls back when its plugin is gone", async
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installDirectoryPlugin(directory);
await page.goto("/settings");
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await expect(page.getByTestId("settings-sidebar")).toBeVisible();
await openSettingsSection(page, "appearance");
@@ -263,6 +268,7 @@ test("reaches the last theme when a plugin contributes more themes than fit", as
await client.installDirectoryPlugin(directory);
await page.setViewportSize({ width: 1280, height: 720 });
await page.goto("/settings");
await approveClientPluginsInUi(page, [MANY_THEMES_PLUGIN_ID]);
await expect(page.getByTestId("settings-sidebar")).toBeVisible();
await openSettingsSection(page, "appearance");
@@ -8,6 +8,7 @@ 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 { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { copyPluginExample } from "../support/helpers/plugin-fixture";
import { runCommand } from "../support/helpers/plugin-sidebar-items";
import {
@@ -214,6 +215,7 @@ test("the workspace layout example arranges a wide workspace", async ({ page })
await withLayoutExample(undefined, async ({ agentId, workspaceId }) => {
await page.setViewportSize(WIDE);
await openAgentRoute(page, { workspaceId, agentId });
await approveClientPluginsInUi(page, ["workspace-layout"]);
await test.step("/aside opens the child agent's chat in the Explorer", async () => {
await sendToMainChat(page, "/aside hey");
@@ -264,6 +266,7 @@ test("the workspace layout example opens over a phone's chat", async ({ page })
await withLayoutExample(promptMentioning(FILE_LINK), async ({ agentId, workspaceId }) => {
await page.setViewportSize(COMPACT);
await openAgentRoute(page, { workspaceId, agentId });
await approveClientPluginsInUi(page, ["workspace-layout"]);
await test.step("/aside opens the Explorer over the chat", async () => {
await submitMessageWithButton(page, "/aside hey");
@@ -302,6 +305,7 @@ test("a file a plugin opens in another workspace waits there on a phone", async
await page.setViewportSize(COMPACT);
// Visiting the first workspace leaves its screen mounted behind the second.
await openAgentRoute(page, first);
await approveClientPluginsInUi(page, ["workspace-layout"]);
await expect(composerIn(page.locator("body"))).toBeEditable({ timeout: 30_000 });
await switchToWorkspace(page, second.workspaceId);
@@ -1,3 +1,4 @@
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { pluginRequirements } from "../support/helpers/plugin-fixture";
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
@@ -297,6 +298,7 @@ test.describe("plugin workspace panels and Command Center", () => {
await primaryClient.installDirectoryPlugin(directory);
await page.setViewportSize(WIDE_VIEWPORT);
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await addConnectedHostAndReload(page, {
serverId: secondaryDaemon.serverId,
label: "Secondary plugin host",
@@ -5,6 +5,7 @@ import type { Page } from "@playwright/test";
import { expect, test } from "../support/fixtures";
import { gotoAppShell } from "../support/helpers/app";
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { pluginRequirements } from "../support/helpers/plugin-fixture";
import { seedWorkspace } from "../support/helpers/seed-client";
import {
@@ -95,6 +96,7 @@ test("a plugin badge shows on workspace rows, hides quietly, and follows its Sho
await page.setViewportSize({ width: 1280, height: 900 });
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await test.step("the badge draws on the row; a null item and a throwing item draw nothing", async () => {
await expect(badge(page, "review")).toBeVisible();
@@ -15,6 +15,7 @@ import {
openSettingsHost,
openSettingsHostSection,
} from "../support/helpers/settings";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { copyPluginExample } from "../support/helpers/plugin-fixture";
const CUSTOM_PROVIDER = {
@@ -202,6 +203,7 @@ test.describe("provider removal", () => {
await client.installDirectoryPlugin(plugin.directory);
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_PROVIDER.pluginId]);
await openSettings(page);
await openSettingsHost(page, getServerId());
await openSettingsHostSection(page, getServerId(), "providers");
@@ -19,6 +19,7 @@ import {
} from "../support/helpers/composer";
import { connectDaemonClient } from "../support/helpers/daemon-client-loader";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { copyPluginExample } from "../support/helpers/plugin-fixture";
import { userScrollsTimelineToHistoryStart } from "../support/helpers/timeline-pagination";
@@ -266,6 +267,7 @@ test.describe.serial("Provider switching in chat", () => {
try {
await openAgentRoute(page, workspace);
await approveClientPluginsInUi(page, [DIRECT_PROVIDER.pluginId]);
await expectComposerVisible(page);
await expectComposerMode(page, "Load test");
@@ -461,6 +463,7 @@ test.describe.serial("Provider switching in chat", () => {
try {
await openAgentRoute(page, workspace);
await approveClientPluginsInUi(page, [DIRECT_PROVIDER.pluginId]);
await expectComposerVisible(page);
await submitMessage(page, runningPrompt);
@@ -513,6 +516,7 @@ test.describe.serial("Provider switching in chat", () => {
try {
await openAgentRoute(page, workspace);
await approveClientPluginsInUi(page, [DIRECT_PROVIDER.pluginId]);
await expectComposerVisible(page);
await submitMessage(page, "Run a one-minute mock turn first.");
await expectAgentReadyToInterrupt(page);
@@ -567,6 +571,7 @@ test.describe.serial("Provider switching in chat", () => {
try {
await openAgentRoute(page, workspace);
await approveClientPluginsInUi(page, [DIRECT_PROVIDER.pluginId]);
await expectComposerVisible(page);
await submitMessageWithButton(page, preSwitchPrompt);
@@ -13,7 +13,7 @@ import {
test("a refresh clears a failed update from the provider's page and its row", async ({
providerUpdateFailure: { page, otherClient },
}) => {
await openProviderInstallation(page);
await openProviderInstallation(page, { approvePlugin: true });
await test.step("Refresh on the page clears the failure", async () => {
await runFailingUpdate(page);
@@ -9,7 +9,11 @@ import {
expectCompactSidebarOpen,
} from "../support/helpers/usage-sidebar-item";
import { gotoAppShell } from "../support/helpers/app";
import { SHOWCASE_PLUGIN_ID, installSidebarPlugins } from "../support/helpers/plugin-sidebar-items";
import {
SHOWCASE_PLUGIN_ID,
approveSidebarPluginsInUi,
installSidebarPlugins,
} from "../support/helpers/plugin-sidebar-items";
import {
expectFooterIconRow,
expectFooterSeparator,
@@ -227,6 +231,7 @@ test.describe("Sidebar footer rows in Appearance settings", () => {
{ key: "import", visible: false },
]);
await gotoAppShell(page);
await approveSidebarPluginsInUi(page);
await test.step("the Footer card lists only the footer rows", async () => {
await openSidebarNavSettings(page);
@@ -2,8 +2,6 @@ import path from "node:path";
import type { Page, TestInfo } from "@playwright/test";
import { test, expect } from "../support/fixtures";
import { gotoAppShell } from "../support/helpers/app";
import { addConnectedHostsAndReload } from "../support/helpers/hosts";
import { startIsolatedHostDaemon } from "../support/helpers/isolated-host-daemon";
import {
closeMobileAgentSidebar,
expectMobileAgentSidebarHidden,
@@ -143,7 +141,6 @@ async function withPaseoOwnedWorktree(
async function readCachedRowIds(
page: Page,
rowKind: "workspace" | "checkpoint",
hostServerId = getServerId(),
): Promise<string[]> {
return page.evaluate(
async ({ serverId, kind }) => {
@@ -172,7 +169,7 @@ async function readCachedRowIds(
database.close();
}
},
{ serverId: hostServerId, kind: rowKind },
{ serverId: getServerId(), kind: rowKind },
);
}
@@ -320,60 +317,7 @@ async function expectRecoveredWorkspacesAfterReload(
});
}
async function expectTimeSortingAvailable(page: Page): Promise<void> {
await page.getByLabel("Display preferences", { exact: true }).click();
await page.getByRole("menuitem", { name: /^Sort/ }).click();
await expect(page.getByRole("menuitem", { name: "Created", exact: true })).toBeVisible();
await expect(page.getByRole("menuitem", { name: "Last prompt", exact: true })).toBeVisible();
await page.getByRole("menuitem", { name: "Created", exact: true }).click();
await page.getByLabel("Display preferences", { exact: true }).click();
await expect(page.getByRole("menuitem", { name: /^Sort/ })).toContainText("Created");
await page.keyboard.press("Escape");
}
async function cacheSecondaryHostWorkspace(page: Page, serverId: string, workspaceId: string) {
await expect(page.getByTestId(`sidebar-workspace-row-${serverId}:${workspaceId}`)).toBeVisible();
await expect.poll(() => readCachedRowIds(page, "workspace", serverId)).toContain(workspaceId);
}
test.describe("Sidebar workspace list", () => {
test("keeps time sorting when a host's cached workspaces load offline", async ({ page }) => {
test.setTimeout(120_000);
const laptop = await startIsolatedHostDaemon("sidebar-sort-laptop");
try {
const other = await startIsolatedHostDaemon("sidebar-sort-other");
try {
const workspace = await seedWorkspace({
repoPrefix: "sidebar-sort-laptop-",
port: laptop.port,
});
try {
await gotoAppShell(page);
const hosts = [
{ ...laptop, label: "Laptop" },
{ ...other, label: "Other host" },
];
await test.step("cache the laptop workspace while its host is online", async () => {
await addConnectedHostsAndReload(page, hosts);
await cacheSecondaryHostWorkspace(page, laptop.serverId, workspace.workspaceId);
await expectTimeSortingAvailable(page);
});
await test.step("reopen the sidebar with the laptop offline", async () => {
await laptop.close();
await addConnectedHostsAndReload(page, hosts);
await cacheSecondaryHostWorkspace(page, laptop.serverId, workspace.workspaceId);
await expectTimeSortingAvailable(page);
});
} finally {
await workspace.cleanup();
}
} finally {
await other.close();
}
} finally {
await laptop.close();
}
});
test("recovers missing workspaces from a damaged legacy cache after reload", async ({
page,
}, testInfo) => {
@@ -11,6 +11,7 @@ import { getActiveTabTestId } from "../support/helpers/launcher";
import type { Page, Locator } from "@playwright/test";
import { test, expect } from "../support/fixtures";
import { expectComposerVisible } from "../support/helpers/composer";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { withDirectoryPlugin } from "../support/helpers/plugin-timeline";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
import { getE2EDaemonPort } from "../support/helpers/daemon-port";
@@ -188,6 +189,7 @@ export default function contribute(client) {
run: async () => {
await page.setViewportSize({ width: 1280, height: 1000 });
await openAgentRoute(page, agent);
await approveClientPluginsInUi(page, ["reply-fold-e2e"]);
await expectComposerVisible(page);
for (const width of [1280, 390]) {
await page.setViewportSize({ width, height: 1000 });
@@ -6,6 +6,7 @@ import appPackage from "../../../package.json";
import { expect, test as base, type Page } from "../fixtures";
import { gotoAppShell } from "./app";
import { addConnectedHostAndReload } from "./hosts";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { pluginRequirements } from "./plugin-fixture";
const pluginId = "builtin-settings";
@@ -69,6 +70,7 @@ export async function openBuiltinPluginSettings(
label: "Built-in settings host",
destination: `/settings/hosts/${host.serverId}/plugins/${pluginId}/${screenId}`,
});
await approveClientPluginsInUi(page, [pluginId]);
}
export async function expectBuiltinPluginSettings(page: Page) {
+14 -40
View File
@@ -178,50 +178,24 @@ export async function attachFileFromMenu(
await (await chooserPromise).setFiles(file);
}
interface TransferFile {
name: string;
mimeType: string;
buffer: Buffer;
}
function createFileTransfer(page: Page, files: TransferFile[]) {
return page.evaluateHandle(
(entries) => {
export async function dropFileOnComposer(
page: Page,
file: { name: string; mimeType: string; buffer: Buffer },
): Promise<void> {
const dataTransfer = await page.evaluateHandle(
({ name, mimeType, base64 }) => {
const bytes = Uint8Array.from(atob(base64), (char) => char.charCodeAt(0));
const droppedFile = new File([bytes], name, { type: mimeType });
const transfer = new DataTransfer();
for (const { name, mimeType, base64 } of entries) {
const bytes = Uint8Array.from(atob(base64), (char) => char.charCodeAt(0));
transfer.items.add(new File([bytes], name, { type: mimeType }));
}
transfer.items.add(droppedFile);
return transfer;
},
files.map(({ name, mimeType, buffer }) => ({
name,
mimeType,
base64: buffer.toString("base64"),
})),
{
name: file.name,
mimeType: file.mimeType,
base64: file.buffer.toString("base64"),
},
);
}
export async function pasteFilesIntoComposer(page: Page, files: TransferFile[]): Promise<boolean> {
const clipboardData = await createFileTransfer(page, files);
try {
const input = composerInput(page);
await input.focus();
return await input.evaluate((element, transfer) => {
const event = new ClipboardEvent("paste", {
clipboardData: transfer,
bubbles: true,
cancelable: true,
});
return !element.dispatchEvent(event);
}, clipboardData);
} finally {
await clipboardData.dispose();
}
}
export async function dropFileOnComposer(page: Page, file: TransferFile): Promise<void> {
const dataTransfer = await createFileTransfer(page, [file]);
const composerRoot = page.getByTestId("message-input-root").filter({ visible: true }).first();
await expect(composerRoot).toBeVisible({ timeout: 10_000 });
+8 -1
View File
@@ -2,6 +2,7 @@ import type { WorkspaceCreateRequest } from "@getpaseo/protocol/messages";
import { expect, type Page } from "@playwright/test";
import { daemonWsRoutePattern } from "./daemon-port";
import { gotoAppShell } from "./app";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { gotoWorkspace } from "./launcher";
import { fillComposerDraft } from "./composer";
import { createAgentTabFromMenu } from "./workspace-tabs";
@@ -146,8 +147,14 @@ export async function createCreationScenario(page: Page) {
const evictionWorkspaceIds = new Set<string>();
return {
cleanup: project.cleanup,
async openWorkspaceForm(isolation: "local" | "worktree") {
async openWorkspaceForm(
isolation: "local" | "worktree",
options?: { approvePlugins?: readonly string[] },
) {
await gotoAppShell(page);
if (options?.approvePlugins?.length) {
await approveClientPluginsInUi(page, options.approvePlugins);
}
await waitForSidebarHydration(page);
await openNewWorkspaceComposer(page, project);
await selectWorkspaceIsolation(page, isolation);
@@ -5,6 +5,7 @@ import { expect, type Page, type TestInfo } from "@playwright/test";
import { gotoWorkspace } from "./launcher";
import { buildAgentRoute } from "./mock-agent";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { pluginRequirements } from "./plugin-fixture";
import { seedWorkspace } from "./seed-client";
import { ensureExplorerSidebar } from "./workspace-tabs";
@@ -63,6 +64,7 @@ export async function withExplorerPanelPlugins(
await client.installDirectoryPlugin(second);
await page.setViewportSize({ width: 1280, height: 900 });
await gotoWorkspace(page, workspace.workspaceId);
await approveClientPluginsInUi(page, ["explorer-review", "explorer-other"]);
await run(workspace);
} finally {
@@ -134,7 +134,7 @@ export async function addProjectFromSetup(page: Page, projectPath: string): Prom
export async function showSetupAgainFromSettings(page: Page): Promise<void> {
await page.locator('[data-testid="sidebar-settings"]:visible').first().click();
await page.getByRole("button", { name: "Show setup again", exact: true }).click();
await page.getByRole("button", { name: "Show", exact: true }).click();
}
export async function goToSetupStep(page: Page, label: string): Promise<void> {
@@ -1,5 +1,6 @@
import type { Locator, TestInfo } from "@playwright/test";
import { test, expect, type Page } from "@playwright/test";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample } from "./plugin-fixture";
import { gotoAppShell } from "./app";
import { buildAgentRoute } from "./mock-agent";
@@ -73,6 +74,7 @@ export async function withButtonAuthorExample(
await client.installDirectoryPlugin(example.directory);
await page.setViewportSize(WIDE);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["button-examples"]);
await page.goto(buildAgentRoute(workspace.workspaceId, agent.id));
await run({
@@ -17,6 +17,7 @@ import {
} from "./compact-workspace-scripts";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { seedWorkspace } from "./seed-client";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { pluginRequirements } from "./plugin-fixture";
const PLUGIN_ID = "button-showcase";
@@ -354,6 +355,7 @@ export async function withButtonShowcase(
try {
await page.setViewportSize(WIDE);
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await page.goto(buildAgentRoute(workspace.workspaceId, agent.id));
await expect(page.getByRole("button", { name: "Run review", exact: true })).toBeVisible();
@@ -5,6 +5,7 @@ import { expect, test, type Page } from "@playwright/test";
import { gotoAppShell } from "./app";
import { openAgentRoute } from "./mock-agent";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample, pluginRequirements } from "./plugin-fixture";
import { seedWorkspace } from "./seed-client";
@@ -39,6 +40,7 @@ export async function withComposerControlsExample(
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installDirectoryPlugin(example.directory);
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await openAgentRoute(page, { workspaceId: workspace.workspaceId, agentId: agent.id });
await run({
narrowTheWindow: () =>
@@ -217,6 +219,7 @@ async function withToolbarPlugin(
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installDirectoryPlugin(directory);
await gotoAppShell(page);
await approveClientPluginsInUi(page, [ONE_TOGGLE_PLUGIN_ID]);
await openAgentRoute(page, { workspaceId: workspace.workspaceId, agentId: agent.id });
await expect(toolbar(page)).toBeVisible({ timeout: 30_000 });
await run({
@@ -13,6 +13,7 @@ import { gotoWorkspace } from "./launcher";
import { openCommandCenter } from "./command-center";
import { openAgentRoute, seedMockAgentWorkspace } from "./mock-agent";
import { connectNewWorkspaceDaemonClient, openGlobalNewWorkspaceComposer } from "./new-workspace";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample, pluginRequirements } from "./plugin-fixture";
import { seedWorkspace } from "./seed-client";
import {
@@ -86,6 +87,7 @@ export async function withComposerToolsExample(
await client.installDirectoryPlugin(example.directory);
await page.setViewportSize(WIDE);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["composer-controls-example"]);
await openAgentRoute(page, { workspaceId: workspace.workspaceId, agentId: agent.id });
await run({
openComposerToolsInExplorer: () =>
@@ -213,6 +215,7 @@ export async function withPluginWritingToAnotherWorkspace(
await client.installDirectoryPlugin(directory);
await page.setViewportSize(WIDE);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["composer-ref"]);
await run({
openTargetAgent: () =>
test.step("open the agent the plugin will write to", async () => {
@@ -356,6 +359,7 @@ export default function contribute(client) {
await client.installDirectoryPlugin(directory);
await page.setViewportSize(WIDE);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["composer-focus"]);
await run({
openOtherAgent: () =>
test.step("open another agent, so the target's tab is not showing", async () => {
@@ -479,6 +483,7 @@ export default function contribute(client) {
await client.installDirectoryPlugin(directory);
await page.setViewportSize(WIDE);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["held-composer"]);
await run({
openNewWorkspace: () =>
test.step("open the New workspace composer", async () => {
@@ -596,6 +601,7 @@ export async function withPluginFocusingASubagent(
try {
await page.setViewportSize(COMPACT);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["focus-agent"]);
await run({
keepParentInExplorerOnCompactScreen: () =>
test.step("move the parent into the Explorer, then narrow the window", async () => {
@@ -740,6 +746,7 @@ export async function withPluginFocusingAnAgentWithContextUsage(
try {
await page.setViewportSize(COMPACT);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["focus-agent"]);
await run({
openContextUsageOnPhone: () =>
test.step("open the agent's context usage on a phone", async () => {
@@ -8,6 +8,7 @@ import { expect, test as base, type Page } from "../fixtures";
import appPackage from "../../../package.json";
import { gotoAppShell, openSettings } from "./app";
import { addConnectedHostAndReload } from "./hosts";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { pluginRequirements } from "./plugin-fixture";
import {
expectToast,
@@ -396,6 +397,7 @@ export async function installListingFromRow(page: Page) {
const sheet = page.getByTestId("plugin-install-sheet");
await expect(sheet).toContainText("Acme");
await sheet.getByTestId("plugin-install-confirm").click();
await approveClientPluginsInUi(page, ["directory-example"]);
await expect(listingRow(page).getByTestId(`plugin-uninstall-${LISTING.id}`)).toBeVisible({
timeout: 60_000,
});
@@ -430,6 +432,7 @@ export async function uninstallFromPage(page: Page) {
export async function installFromPage(page: Page) {
await page.getByTestId(`plugin-install-${LISTING.id}`).filter({ visible: true }).click();
await page.getByTestId("plugin-install-confirm").click();
await approveClientPluginsInUi(page, ["directory-example"]);
await expect(
page.getByRole("button", { name: `Actions for ${LISTING.name}`, exact: true }),
).toBeVisible({ timeout: 60_000 });
@@ -0,0 +1,284 @@
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { expect, type Locator, type Page } from "@playwright/test";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { pluginRequirements } from "./plugin-fixture";
export interface ClientProbePluginSpec {
id: string;
name: string;
sidebarTitle: string;
markerKey: string;
}
export async function createClientProbePlugin(spec: ClientProbePluginSpec): Promise<{
directory: string;
cleanup: () => Promise<void>;
}> {
const directory = await mkdtemp(path.join(tmpdir(), `paseo-plugin-approval-${spec.id}-`));
await writeFile(
path.join(directory, "paseo-plugin.json"),
JSON.stringify({
id: spec.id,
name: spec.name,
requirements: pluginRequirements,
}),
);
await writeFile(
path.join(directory, "index.server.ts"),
`export default function contribute() { return () => {}; }\n`,
);
await writeFile(
path.join(directory, "index.client.tsx"),
`import React from "react";
import { Text, View } from "react-native";
import { SidebarRow } from "@getpaseo/plugin/client/ui";
const executed = (globalThis.__paseoPluginExecutions = globalThis.__paseoPluginExecutions || []);
executed.push(${JSON.stringify(spec.markerKey)});
function ProbeScreen({ theme }) {
return (
<View style={{ flex: 1, padding: 24 }}>
<Text style={{ color: theme.colors.foreground }}>${spec.name} screen</Text>
</View>
);
}
function ProbeItem({ currentScreen, openScreen }) {
return (
<SidebarRow
icon="Puzzle"
active={currentScreen?.screenId === "main"}
onPress={() => openScreen({ screenId: "main" })}
/>
);
}
export default function contribute(client) {
client.addScreen({ id: "main", title: ${JSON.stringify(spec.sidebarTitle)}, Component: ProbeScreen });
client.addSidebarHeaderItem({
id: "main",
title: ${JSON.stringify(spec.sidebarTitle)},
Component: ProbeItem,
});
return () => {};
}
`,
);
return {
directory,
cleanup: () => rm(directory, { recursive: true, force: true }),
};
}
export interface InstalledClientPluginsContext {
install: (spec: ClientProbePluginSpec) => Promise<void>;
}
export async function withInstalledClientPlugins<T>(
specs: readonly ClientProbePluginSpec[],
run: (ctx: InstalledClientPluginsContext) => Promise<T>,
): Promise<T> {
const client = await connectNewWorkspaceDaemonClient({ ownProjects: false });
const previous = await client.getDaemonConfig();
const created: Array<{ id: string; cleanup: () => Promise<void> }> = [];
const install = async (spec: ClientProbePluginSpec) => {
const fixture = await createClientProbePlugin(spec);
created.push({ id: spec.id, cleanup: fixture.cleanup });
await client.installDirectoryPlugin(fixture.directory);
};
try {
await client.patchDaemonConfig({ pluginsEnabled: true });
for (const spec of specs) {
await install(spec);
}
return await run({ install });
} finally {
for (const item of created.toReversed()) {
await client.removePlugin(item.id).catch(() => undefined);
}
await client
.patchDaemonConfig({ pluginsEnabled: previous.config.pluginsEnabled ?? false })
.catch(() => undefined);
await client.close().catch(() => undefined);
for (const item of created) {
await item.cleanup().catch(() => undefined);
}
}
}
export function pluginExecutionBypassSwitch(page: Page): Locator {
return page.getByRole("switch", { name: "Run plugins without asking", exact: true });
}
export function pluginExecutionBypassConfirmModal(page: Page): Locator {
return page.getByTestId("plugin-execution-bypass-confirm-modal");
}
export async function expectPluginExecutionBypass(page: Page, enabled: boolean): Promise<void> {
const toggle = pluginExecutionBypassSwitch(page);
await expect(toggle).toBeVisible({ timeout: 30_000 });
await expect(toggle).toHaveAttribute("aria-checked", String(enabled));
}
export async function openPluginExecutionBypassConfirm(page: Page): Promise<void> {
const toggle = pluginExecutionBypassSwitch(page);
await expect(toggle).toHaveAttribute("aria-checked", "false");
await toggle.click();
await expect(pluginExecutionBypassConfirmModal(page)).toBeVisible();
}
export async function cancelPluginExecutionBypassConfirm(page: Page): Promise<void> {
const modal = pluginExecutionBypassConfirmModal(page);
await expect(modal).toBeVisible();
await page.getByRole("button", { name: "Cancel", exact: true }).click();
await expect(modal).toHaveCount(0);
await expectPluginExecutionBypass(page, false);
}
export async function confirmPluginExecutionBypass(page: Page): Promise<void> {
const modal = pluginExecutionBypassConfirmModal(page);
await expect(modal).toBeVisible();
await page.getByRole("button", { name: "Turn on", exact: true }).click();
await expect(modal).toHaveCount(0);
await expectPluginExecutionBypass(page, true);
}
export async function setPluginExecutionBypass(page: Page, enabled: boolean): Promise<void> {
if (enabled) {
await openPluginExecutionBypassConfirm(page);
await confirmPluginExecutionBypass(page);
return;
}
const toggle = pluginExecutionBypassSwitch(page);
await expect(toggle).toHaveAttribute("aria-checked", "true");
await toggle.click();
await expect(pluginExecutionBypassConfirmModal(page)).toHaveCount(0);
await expectPluginExecutionBypass(page, false);
}
export function pluginApprovalSheet(page: Page): Locator {
return page.getByTestId("plugin-execution-approval");
}
export async function expectPluginApprovalPrompt(
page: Page,
expected: { pluginId: string; progress?: string },
): Promise<void> {
await expect(pluginApprovalSheet(page)).toBeVisible({ timeout: 30_000 });
await expect(page.getByTestId("plugin-execution-approval-plugin")).toContainText(
expected.pluginId,
);
if (expected.progress) {
await expect(page.getByTestId("plugin-execution-approval-progress")).toHaveText(
expected.progress,
);
}
}
export async function allowPluginExecution(page: Page): Promise<void> {
await page.getByRole("button", { name: "Allow", exact: true }).click();
}
export async function declinePluginExecution(page: Page): Promise<void> {
await page.getByRole("button", { name: "Don't allow", exact: true }).click();
}
async function readPromptIdentity(
page: Page,
): Promise<{ pluginText: string; hostText: string; key: string } | null> {
const pluginLocator = page.getByTestId("plugin-execution-approval-plugin");
const hostLocator = page.getByTestId("plugin-execution-approval-host");
if (!(await pluginLocator.isVisible().catch(() => false))) return null;
if (!(await hostLocator.isVisible().catch(() => false))) return null;
const pluginText = (await pluginLocator.textContent().catch(() => ""))?.trim() ?? "";
const hostText = (await hostLocator.textContent().catch(() => ""))?.trim() ?? "";
if (!pluginText || !hostText) return null;
return { pluginText, hostText, key: `${pluginText}\0${hostText}` };
}
async function waitForNextApprovalTarget(
page: Page,
previousKey: string | null,
): Promise<{ pluginText: string; hostText: string; key: string }> {
let matched: { pluginText: string; hostText: string; key: string } | null = null;
await expect
.poll(
async () => {
const current = await readPromptIdentity(page);
if (!current || current.key === previousKey) return false;
matched = current;
return true;
},
{ timeout: 30_000, message: "Expected next plugin execution approval prompt" },
)
.toBe(true);
if (!matched) {
throw new Error("Expected next plugin execution approval prompt");
}
return matched;
}
/**
* Approves every expected client plugin through the real confirmation sheet UI.
* Handles stacked plugins and multi-host arrivals in any order, then waits for the sheet to close.
*/
export async function approveClientPluginsInUi(
page: Page,
pluginIds: readonly string[],
): Promise<void> {
const remaining = [...pluginIds];
let previousKey: string | null = null;
while (remaining.length > 0) {
await expect(pluginApprovalSheet(page)).toBeVisible({ timeout: 30_000 });
const target = await waitForNextApprovalTarget(page, previousKey);
const matchedIndex = remaining.findIndex((id) => target.pluginText.includes(id));
if (matchedIndex === -1) {
throw new Error(
`Unexpected plugin execution prompt "${target.pluginText}" on "${target.hostText}"; expected one of: ${remaining.join(", ")}`,
);
}
remaining.splice(matchedIndex, 1);
previousKey = target.key;
await allowPluginExecution(page);
}
await expect(pluginApprovalSheet(page)).toHaveCount(0);
}
export async function getExecutedPluginMarkers(page: Page): Promise<string[]> {
return page.evaluate(() => {
const raw = (globalThis as { __paseoPluginExecutions?: unknown }).__paseoPluginExecutions;
return Array.isArray(raw) ? raw.filter((item): item is string => typeof item === "string") : [];
});
}
export async function expectExecutedPluginMarkers(
page: Page,
expected: readonly string[],
): Promise<void> {
await expect.poll(() => getExecutedPluginMarkers(page)).toEqual(expected);
}
export async function expectExecutedPluginMarkersContain(
page: Page,
marker: string,
): Promise<void> {
await expect.poll(() => getExecutedPluginMarkers(page)).toContain(marker);
}
export async function reloadKeepingPersistedState(page: Page): Promise<void> {
await page.evaluate(() => {
const nonce = localStorage.getItem("@paseo:e2e-seed-nonce");
if (!nonce) throw new Error("Expected e2e seed nonce before reload");
localStorage.setItem("@paseo:e2e-disable-default-seed-once", nonce);
});
await page.reload();
}
export async function ensureArtifactsDir(repoRoot: string): Promise<string> {
const dir = path.join(repoRoot, ".artifacts");
await mkdir(dir, { recursive: true });
return dir;
}
@@ -6,6 +6,7 @@ import { gotoAppShell } from "./app";
import { addConnectedHostAndReload } from "./hosts";
import { startIsolatedHostDaemon } from "./isolated-host-daemon";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { pluginRequirements } from "./plugin-fixture";
const id = "host-clients";
@@ -98,6 +99,7 @@ export async function installHostClientsScenario(page: Page) {
await primary.patchDaemonConfig({ pluginsEnabled: true });
await primary.installDirectoryPlugin(directory);
await gotoAppShell(page);
await approveClientPluginsInUi(page, [id]);
await openHostClients(page);
await addConnectedHostAndReload(page, {
serverId: secondary.serverId,
@@ -12,6 +12,7 @@ import {
openProjectViaDaemon,
submitNewWorkspacePrompt,
} from "./new-workspace";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample } from "./plugin-fixture";
import { getServerId } from "./server-id";
import { createTempGitRepo } from "./workspace";
@@ -147,6 +148,7 @@ export async function withNewWorkspaceIssuesExample(
const other = otherRepo ? await openProjectViaDaemon(client, otherRepo.path) : null;
let target = project;
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await waitForSidebarHydration(page);
await openNewWorkspaceComposer(page, project);
// The sidebar rows used to reach the screen exist only at desktop width.
@@ -6,6 +6,7 @@ import { gotoAppShell, openSettings } from "./app";
import { openModelPicker } from "./agent-profiles";
import { openAgentRoute } from "./mock-agent";
import { connectNewWorkspaceDaemonClient, openGlobalNewWorkspaceComposer } from "./new-workspace";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample } from "./plugin-fixture";
import { seedWorkspace, type SeededWorkspace } from "./seed-client";
import { getServerId } from "./server-id";
@@ -15,7 +16,7 @@ const MODEL_LABEL = "Select model (Example 1)";
const WIDE = { width: 1400, height: 950 };
const COMPACT = { width: 390, height: 844 };
export async function readIconPaths(page: Page, pluginDirectory: string): Promise<string[]> {
async function readIconPaths(page: Page, pluginDirectory: string): Promise<string[]> {
const svg = await readFile(path.join(pluginDirectory, "icon.svg"), "utf8");
return page.evaluate(
(source) =>
@@ -33,7 +34,7 @@ function readIconDrawings(icons: SVGElement[]): string[][] {
);
}
export async function expectProviderIcon(surface: Locator, paths: string[]): Promise<void> {
async function expectProviderIcon(surface: Locator, paths: string[]): Promise<void> {
await expect(surface).toBeVisible();
// Provider icons are decorative SVGs without accessible names. Compare the
// plugin asset's drawing, allowing surface-specific size and theme colours.
@@ -76,6 +77,7 @@ export const test = base.extend<{ providerIcons: ProviderIconJourney }>({
try {
await page.setViewportSize(WIDE);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["provider-direct-example"]);
const iconPaths = await readIconPaths(page, plugin.directory);
await provide({ page, testInfo, iconPaths, workspace });
} finally {
@@ -7,6 +7,7 @@ import { expect, type Page } from "../fixtures";
import { gotoAppShell } from "./app";
import { installDaemonWebSocketGate } from "./daemon-websocket-gate";
import { connectDaemonClient } from "./daemon-client-loader";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample, pluginRequirements } from "./plugin-fixture";
const PLUGIN_ID = "retained-plugin-e2e";
@@ -76,6 +77,7 @@ async function createProbe(page: Page) {
async open() {
await page.setViewportSize({ width: 1100, height: 800 });
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await page.getByRole("button", { name: "Reconnect probe", exact: true }).click();
await expect(page.getByText("Stored title: Agent monitor", { exact: true })).toBeVisible();
},
@@ -8,6 +8,7 @@ import { connectDaemonClient } from "./daemon-client-loader";
import { addConnectedHostAndReload } from "./hosts";
import { gotoAppShell, openSettings } from "./app";
import { openHostSection, selectSettingsHost } from "./settings";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { pluginRequirements } from "./plugin-fixture";
import {
backToPlugins,
@@ -108,9 +109,16 @@ export async function expectAppMismatch(page: Page) {
).toBeVisible();
}
export async function correctRequirementAndReload(page: Page, directory: string) {
export async function correctRequirementAndReload(
page: Page,
directory: string,
options?: { approvePrompt?: boolean },
) {
await writeRequirements(directory, pluginRequirements.paseo);
await reloadRequirementsPlugin(page);
if (options?.approvePrompt) {
await approveClientPluginsInUi(page, [PLUGIN_ID]);
}
await backToPlugins(page, PLUGIN_ID);
await expectPluginHealthy(page, PLUGIN_ID);
await expect(page.getByText(/Your app is/)).toHaveCount(0);
@@ -1,6 +1,7 @@
import { mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample, pluginRequirements } from "./plugin-fixture";
import { expect, test as base, type Page } from "../fixtures";
import { gotoAppShell, openSettings } from "./app";
@@ -99,11 +100,13 @@ export const test = base.extend<{ settingsPlugin: SettingsClient }>({
export async function openDisplaySettings(page: Page) {
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["settings-example", TABBED_PLUGIN_ID]);
await openSettings(page);
await openSettingsExamplePage(page);
}
export async function openCompactDisplaySettings(page: Page) {
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["settings-example", TABBED_PLUGIN_ID]);
await openCompactSettings(page, new URL(page.url()).pathname);
await openSettingsExamplePage(page);
}
@@ -120,6 +123,7 @@ async function expectSettingsExampleScreen(page: Page) {
}
export async function openPluginsPage(page: Page) {
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["settings-example", TABBED_PLUGIN_ID]);
await openSettings(page);
await openHostSection(page, getServerId(), "plugins");
}
@@ -183,6 +187,7 @@ export async function expectSettingsTab(page: Page, title: "General" | "Advanced
}
export async function openTabbedSettingsLink(page: Page, title: "General" | "Advanced") {
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["settings-example", TABBED_PLUGIN_ID]);
await page.goto(`${pluginPageRoute(TABBED_PLUGIN_ID)}/${title.toLowerCase()}`);
await expectSettingsTab(page, title);
}
@@ -4,11 +4,16 @@ import path from "node:path";
import { expect, type Locator, type Page } from "@playwright/test";
import { openCommandCenter } from "./command-center";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { pluginRequirements } from "./plugin-fixture";
export const SHOWCASE_PLUGIN_ID = "sidebar-showcase";
export const LEGACY_PLUGIN_ID = "legacy-sidebar";
export const BOTS_PLUGIN_ID = "sidebar-bots";
export async function approveSidebarPluginsInUi(page: Page): Promise<void> {
await approveClientPluginsInUi(page, [SHOWCASE_PLUGIN_ID, LEGACY_PLUGIN_ID, BOTS_PLUGIN_ID]);
}
export const WIDE = { width: 1440, height: 900 };
export const COMPACT = { width: 390, height: 844 };
@@ -2,6 +2,7 @@ import { mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { expect, type Page, type TestInfo } from "@playwright/test";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample, pluginRequirements } from "./plugin-fixture";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { openAgentRoute, seedMockAgentWorkspace, type MockAgentWorkspace } from "./mock-agent";
@@ -110,7 +111,8 @@ export default function contribute(client) {
return () => {};
}`;
const PROMPT_PLUGIN_ID = "timeline-prompt-e2e";
export const PROMPT_PLUGIN_ID = "timeline-prompt-e2e";
export const POPOVER_PLUGIN_ID = "timeline-popover-e2e";
function promptClientSource(prompts?: readonly string[]): string {
return `import React from "react";
@@ -201,6 +203,7 @@ export async function withTimelinePlugin(
run: async () => {
try {
await openAgentRoute(page, agent);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await expect(
page.getByRole("textbox", { name: "Message agent..." }).first(),
).toBeVisible();
@@ -356,6 +359,7 @@ export async function viewInlineThinkingExample(page: Page, info: TestInfo): Pro
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installDirectoryPlugin(example.directory);
await openAgentRoute(page, agent);
await approveClientPluginsInUi(page, ["inline-thinking"]);
await expect(page.getByRole("textbox", { name: "Message agent..." }).first()).toBeVisible();
await requestPluginTimeline(agent);
const thought = page.getByText(/^Need to find the scroll container/);
@@ -423,6 +427,7 @@ export default function contribute(client) {
}`,
run: async () => {
await openAgentRoute(page, agent);
await approveClientPluginsInUi(page, ["timeline-local-ids"]);
await expect(page.getByRole("textbox", { name: "Message agent..." }).first()).toBeVisible();
await run();
},
@@ -6,6 +6,7 @@ import type { TestInfo, BrowserContext } from "@playwright/test";
import { expect, type Page } from "../fixtures";
import { gotoAppShell, openSettings } from "./app";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample } from "./plugin-fixture";
async function chooseChinese(page: Page) {
@@ -40,6 +41,7 @@ export async function verifyPluginTranslations(page: Page, info: TestInfo) {
await client.installDirectoryPlugin(example.directory);
await page.setViewportSize({ width: 1440, height: 1000 });
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["translation-notes"]);
await page.getByRole("button", { name: "Workspace notes", exact: true }).click();
await expect(page.getByText("App language: en", { exact: true })).toBeVisible();
await page
@@ -125,6 +127,7 @@ export async function verifyPluginToolTranslations(page: Page, info: TestInfo) {
await client.installDirectoryPlugin(example.directory);
await page.setViewportSize({ width: 1440, height: 1000 });
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["translation-notes"]);
await page.goto(buildAgentRoute(workspace.workspaceId, agent.id));
const commandCenter = await openCommandCenter(page);
await commandCenter.getByTestId("command-center-input").fill("Show notes tools");
@@ -4,6 +4,7 @@ import type { DaemonClient as InternalDaemonClient } from "@getpaseo/client/inte
import { expect, test as base, type Page } from "../fixtures";
import { gotoAppShell, openSettings } from "./app";
import { connectDaemonClient } from "./daemon-client-loader";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample, pluginRequirements } from "./plugin-fixture";
import { getServerId } from "./server-id";
import { leaveProviderDetail, openSettingsHostSection } from "./settings";
@@ -84,8 +85,14 @@ export const test = base.extend<{ providerUpdateFailure: ProviderUpdateFailure }
},
});
export async function openProviderInstallation(page: Page): Promise<void> {
export async function openProviderInstallation(
page: Page,
options?: { approvePlugin?: boolean },
): Promise<void> {
await gotoAppShell(page);
if (options?.approvePlugin) {
await approveClientPluginsInUi(page, [PLUGIN_ID]);
}
await openSettings(page);
await openSettingsHostSection(page, getServerId(), "providers");
await page
@@ -1,6 +1,7 @@
import { readFile, writeFile } from "node:fs/promises";
import path from "node:path";
import { expect, type Page } from "@playwright/test";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample } from "./plugin-fixture";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { seedWorkspace } from "./seed-client";
@@ -33,6 +34,7 @@ export async function withSidebarViews(
await client.installDirectoryPlugin(example.directory);
await page.setViewportSize({ width: 1280, height: 900 });
await gotoWorkspace(page, workspace.workspaceId);
await approveClientPluginsInUi(page, ["sidebar-views"]);
await run(sidebarViews(page, workspace.workspaceId, client));
} finally {
await client.removePlugin("sidebar-views");
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/app",
"version": "0.19.0-beta.1",
"version": "0.18.2",
"private": true,
"main": "index.ts",
"scripts": {
@@ -242,28 +242,6 @@ const longEditDetail = {
newString: "new line\n".repeat(80),
};
describe("tool detail empty state", () => {
it("insets the empty-state text from the disclosure edge", () => {
act(() =>
root.render(
<QueryClientProvider client={queryClient}>
<ToolCallDetailsContent maxHeight={200} />
</QueryClientProvider>,
),
);
const text = view().getByText("No additional details available");
const style = getComputedStyle(text);
expect(style.paddingTop).toBe("12px");
expect(style.paddingRight).toBe("12px");
expect(style.paddingBottom).toBe("12px");
expect(style.paddingLeft).toBe("12px");
const textBox = text.getBoundingClientRect();
const containerBox = container.getBoundingClientRect();
expect(textBox.left).toBeGreaterThanOrEqual(containerBox.left);
expect(textBox.right).toBeLessThanOrEqual(containerBox.right);
});
});
describe("capped tool scrolling", () => {
it.each([longShellDetail, longEditDetail])(
"gives a capped $type detail one vertical scroll owner",
+2
View File
@@ -65,6 +65,7 @@ import { WorkspaceShortcutTargetsSubscriber } from "@/components/workspace-short
import { FloatingPanelPortalHost } from "@/components/ui/floating-panel-portal";
import { HostChooserModal, useHostChooser } from "@/hosts/host-chooser";
import { HostConfirmationSheet } from "@/hosts/host-confirmation-sheet";
import { PluginExecutionApprovalSheet } from "@/plugins/execution-approval/sheet";
import { HEADER_INNER_HEIGHT, useIsCompactFormFactor } from "@/constants/layout";
import {
canDesktopAppSidebarShare,
@@ -568,6 +569,7 @@ function AppContainer({ children, chromeEnabled: chromeEnabledOverride }: AppCon
<AddProjectFlowHost />
<HostChooserModal />
<HostConfirmationSheet />
<PluginExecutionApprovalSheet />
<ProviderSettingsHost />
<WorkspaceSetupDialog />
<KeyboardShortcutsDialog />
@@ -1,4 +1,4 @@
import { getFileExtension, getMimeTypeFromPath } from "@/attachments/file-types";
import { getFileExtension } from "@/attachments/file-types";
import { copyDesktopAttachmentFile } from "@/desktop/attachments/desktop-file-commands";
import { readDesktopFileBase64 } from "@/desktop/attachments/desktop-preview-url";
@@ -8,14 +8,6 @@ export interface SelectedFile {
readBytes(): Promise<Uint8Array>;
}
export function selectedFileFromWebFile(file: File): SelectedFile {
return {
fileName: file.name,
mimeType: file.type || getMimeTypeFromPath(file.name),
readBytes: async () => new Uint8Array(await file.arrayBuffer()),
};
}
function base64ToUint8Array(base64: string): Uint8Array {
const binaryString = atob(base64);
const bytes = new Uint8Array(binaryString.length);
@@ -747,7 +747,6 @@ const styles = StyleSheet.create((theme) => {
color: theme.colors.destructive,
},
emptyStateText: {
padding: insets.padding,
color: theme.colors.foregroundMuted,
fontSize: theme.fontSize.base,
fontStyle: "italic",
-59
View File
@@ -995,65 +995,6 @@ describe("attachments restored from a queued message", () => {
expect(client.calls[0]?.options.attachments).toEqual([uploadedImage]);
});
it("clears the optimistic timeline bubble when a direct send is queued behind a boundary", async () => {
const client = createFakeSendClient();
client.sendAgentMessage = async (agentId, text, options) => {
client.calls.push({ agentId, text, options });
return { deliveryStatus: "queued", messageId: options.messageId };
};
const stream = createFakeStream();
await dispatchComposerAgentMessage({
client,
agentId: "agent",
text: "follow up",
attachments: [],
submission: stream,
activeTurnBehavior: "interrupt",
});
expect(stream.tail.get("agent") ?? []).toEqual([]);
expect(stream.head.get("agent") ?? []).toEqual([]);
});
it("clears the optimistic timeline bubble and settles staged switch via queued callback when a direct provider switch is queued", async () => {
const client = createFakeSendClient();
client.switchAgentProvider = async () => ({
deliveryStatus: "queued",
agent: undefined,
});
const stream = createFakeStream();
let committed = 0;
let queued = 0;
await dispatchComposerAgentMessage({
client,
agentId: "agent",
text: "switch later",
attachments: [],
submission: stream,
currentProvider: "claude",
stagedProviderSwitch: {
provider: "codex",
model: null,
thinkingOptionId: null,
modeId: null,
providerOptions: {},
},
onProviderSwitchCommitted: () => {
committed += 1;
},
onProviderSwitchQueued: () => {
queued += 1;
},
});
expect(committed).toBe(0);
expect(queued).toBe(1);
expect(stream.tail.get("agent") ?? []).toEqual([]);
expect(stream.head.get("agent") ?? []).toEqual([]);
});
it("counts a restored forge item as selected and toggles it off", () => {
expect(isAttachmentSelectedForForgeItem([restoredIssue], issueItem)).toBe(true);
expect(isAttachmentSelectedForForgeItem([restoredIssue], prItem)).toBe(false);
+1 -20
View File
@@ -217,7 +217,6 @@ export interface DispatchComposerAgentMessageInput {
currentModel?: string | null;
stagedProviderSwitch?: StagedProviderSwitch | null;
onProviderSwitchCommitted?: (agent: AgentSnapshotPayload | undefined) => void | Promise<void>;
onProviderSwitchQueued?: () => void;
}
function buildPendingProviderSwitch(
@@ -243,15 +242,6 @@ function buildPendingProviderSwitch(
});
}
function isQueuedDeliveryResult(result: unknown): boolean {
return (
typeof result === "object" &&
result !== null &&
"deliveryStatus" in result &&
result.deliveryStatus === "queued"
);
}
export async function dispatchComposerAgentMessage(
input: DispatchComposerAgentMessageInput,
): Promise<void> {
@@ -291,25 +281,16 @@ export async function dispatchComposerAgentMessage(
...(imagePayload.images ? { images: imagePayload.images } : {}),
attachments: [...wirePayload.attachments, ...(imagePayload.attachments ?? [])],
});
if (isQueuedDeliveryResult(result)) {
input.submission.reject(input.agentId, clientMessageId);
input.onProviderSwitchQueued?.();
return;
}
input.submission.accept(input.agentId, clientMessageId);
await input.onProviderSwitchCommitted?.(result.agent);
return;
}
const result = await input.client.sendAgentMessage(input.agentId, input.text, {
await input.client.sendAgentMessage(input.agentId, input.text, {
messageId: clientMessageId,
...(input.activeTurnBehavior ? { activeTurnBehavior: input.activeTurnBehavior } : {}),
...(imagePayload.images ? { images: imagePayload.images } : {}),
attachments: [...wirePayload.attachments, ...(imagePayload.attachments ?? [])],
});
if (isQueuedDeliveryResult(result)) {
input.submission.reject(input.agentId, clientMessageId);
return;
}
input.submission.accept(input.agentId, clientMessageId);
} catch (error) {
input.submission.reject(input.agentId, clientMessageId);
@@ -3,11 +3,7 @@ import {
isRasterImageFile,
isRasterImagePath,
} from "@/attachments/file-types";
import {
readDesktopFileBytes,
selectedFileFromWebFile,
type SelectedFile,
} from "@/attachments/selected-file";
import { readDesktopFileBytes, type SelectedFile } from "@/attachments/selected-file";
import type { DroppedItem } from "@/components/file-drop/types";
interface DroppedAttachmentsRuntime {
@@ -40,7 +36,12 @@ export function droppedItemsToSelectedFiles(
if (isRasterImageFile(item.file)) {
continue;
}
files.push(selectedFileFromWebFile(item.file));
const file = item.file;
files.push({
fileName: file.name,
mimeType: file.type || getMimeTypeFromPath(file.name),
readBytes: async () => new Uint8Array(await file.arrayBuffer()),
});
continue;
}
+1 -14
View File
@@ -166,7 +166,7 @@ import type {
WorkspaceFileComposerAttachment,
WorkspaceComposerAttachment,
} from "@/attachments/types";
import { selectedFileFromWebFile, type SelectedFile } from "@/attachments/selected-file";
import type { SelectedFile } from "@/attachments/selected-file";
import { resolveComposerAttachmentSubmitFormat } from "@/composer/attachments/submit";
import { ComposerInputProvider, type ComposerInput } from "@/composer/session";
import type { ComposerFocusOptions } from "@/composer/model";
@@ -1775,11 +1775,6 @@ function ComposerContentImpl({
}
}
},
onProviderSwitchQueued: () => {
if (stagedProviderSwitch) {
settleStagedProviderSwitch(serverId, targetAgentId, stagedProviderSwitch);
}
},
activeTurnBehavior,
activeTurnId:
activeTurnBehavior === "steer"
@@ -2046,13 +2041,6 @@ function ComposerContentImpl({
[addFiles, client, t],
);
const handlePasteFiles = useCallback(
(files: File[]) => {
void uploadSelectedFiles(files.map(selectedFileFromWebFile));
},
[uploadSelectedFiles],
);
const handlePickFile = useCallback(async () => {
if (!client) {
toastErrorRef.current(t("composer.errors.daemonClientDisconnected"));
@@ -2710,7 +2698,6 @@ function ComposerContentImpl({
attachmentMenuItems={attachmentMenuItems}
onAttachButtonRef={handleAttachButtonRef}
onAddImages={addImages}
onPasteFiles={handlePasteFiles}
onPasteImages={handleNativePasteImages}
client={client}
isReadyForDictation={isDictationReady}
+2 -29
View File
@@ -21,7 +21,6 @@ import {
useRef,
useCallback,
useEffect,
useEffectEvent,
useLayoutEffect,
useImperativeHandle,
useMemo,
@@ -65,7 +64,6 @@ import {
collectImageFilesFromClipboardData,
filesToImageAttachments,
} from "@/utils/image-attachments-from-files";
import { isRasterImageFile } from "@/attachments/file-types";
import type { ComposerAttachment } from "@/attachments/types";
import type { ImageAttachment, MessagePayload, TextReplacement } from "@/composer/types";
import { focusWithRetries } from "@/utils/web-focus";
@@ -83,7 +81,7 @@ import { formatShortcut, type ShortcutKey } from "@/utils/format-shortcut";
import { getShortcutOs } from "@/utils/shortcut-platform";
import type { MessageInputKeyboardActionKind } from "@/keyboard/actions";
import { isImeComposingKeyboardEvent } from "@/utils/keyboard-ime";
import { getIsElectron, isNative, isWeb } from "@/constants/platform";
import { isNative, isWeb } from "@/constants/platform";
import { useIsCompactFormFactor } from "@/constants/layout";
import { useComposerKeyboardScope } from "@/composer/keyboard-scope";
import { RenderProfile } from "@/utils/render-profiler";
@@ -175,7 +173,6 @@ export interface MessageInputProps {
attachmentMenuItems: AttachmentMenuItem[];
onAttachButtonRef?: (node: View | null) => void;
onAddImages?: (images: ImageAttachment[]) => void;
onPasteFiles?: (files: File[]) => void;
onPasteImages?: (files: readonly NativePastedFile[]) => void;
client: DaemonClient | null;
/** Dictation start gate from host runtime (socket connected + directory ready). */
@@ -523,36 +520,22 @@ function getTextInputNativeElement(current: ComposerTextInputHandle | null): HTM
interface PasteEffectArgs {
textarea: HTMLElement | null;
isConnected: boolean;
isSubmitLoading: boolean;
disabled: boolean;
isDictating: boolean;
isRealtimeVoiceForCurrentAgent: boolean;
onAddImages: ((images: ImageAttachment[]) => void) | undefined;
onPasteFiles: ((files: File[]) => void) | undefined;
}
function usePasteEffect(args: PasteEffectArgs): void {
const {
textarea,
isConnected,
isSubmitLoading,
disabled,
isDictating,
isRealtimeVoiceForCurrentAgent,
onAddImages,
onPasteFiles,
} = args;
const pasteFiles = useEffectEvent((clipboardData: DataTransfer | null) => {
if (!isConnected || isSubmitLoading || !onPasteFiles || getIsElectron()) return false;
const files = Array.from(clipboardData?.files ?? []).filter((file) => !isRasterImageFile(file));
if (files.length === 0) return false;
onPasteFiles(files);
return true;
});
useEffect(() => {
if (!isWeb) return;
@@ -563,13 +546,8 @@ function usePasteEffect(args: PasteEffectArgs): void {
if (disabled || isDictating || isRealtimeVoiceForCurrentAgent) return;
const imageFiles = collectImageFilesFromClipboardData(event.clipboardData);
const didPasteFiles = pasteFiles(event.clipboardData);
if (didPasteFiles) event.preventDefault();
if (imageFiles.length === 0) {
if (!didPasteFiles && pasteLinkedClipboardText(textarea, event.clipboardData)) {
event.preventDefault();
}
if (pasteLinkedClipboardText(textarea, event.clipboardData)) event.preventDefault();
return;
}
if (!isConnected || !onAddImages) return;
@@ -1213,7 +1191,6 @@ interface ResolvedMessageInputProps {
attachmentMenuItems: AttachmentMenuItem[];
onAttachButtonRef: ((node: View | null) => void) | undefined;
onAddImages: ((images: ImageAttachment[]) => void) | undefined;
onPasteFiles: ((files: File[]) => void) | undefined;
onPasteImages: ((files: readonly NativePastedFile[]) => void) | undefined;
client: DaemonClient | null;
isReadyForDictation: boolean | undefined;
@@ -1262,7 +1239,6 @@ function resolveMessageInputProps(props: MessageInputProps): ResolvedMessageInpu
attachmentMenuItems: props.attachmentMenuItems,
onAttachButtonRef: props.onAttachButtonRef,
onAddImages: props.onAddImages,
onPasteFiles: props.onPasteFiles,
onPasteImages: props.onPasteImages,
client: props.client,
isReadyForDictation: props.isReadyForDictation,
@@ -1345,7 +1321,6 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
attachmentMenuItems,
onAttachButtonRef,
onAddImages,
onPasteFiles,
onPasteImages,
client,
isReadyForDictation,
@@ -1899,8 +1874,6 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
isDictating,
isRealtimeVoiceForCurrentAgent,
onAddImages,
onPasteFiles,
isSubmitLoading,
});
const handleSelectionChange = useCallback(
@@ -1,4 +1,8 @@
import { DEFAULT_BROWSER_PROFILE_SLUG, useBrowserProfileCatalog } from "../profiles";
import {
DEFAULT_BROWSER_PROFILE_SLUG,
getBrowserProfilePartition,
useBrowserProfileCatalog,
} from "../profiles";
import { ProfileSelector } from "./profile-selector.electron";
import {
useCallback,
@@ -827,12 +831,16 @@ export function BrowserPane({
const updateBrowser = useBrowserStore((state) => state.updateBrowser);
const setBrowserViewport = useBrowserStore((state) => state.setBrowserViewport);
const setBrowserRoutingMode = useBrowserStore((state) => state.setBrowserRoutingMode);
const proxyState = useHostBrowserProxy({
serverId,
routingMode: browser?.routingMode,
profileSlug,
});
const activePartition = proxyState.kind === "ready" ? proxyState.partition : null;
const proxyState = useHostBrowserProxy({ serverId, routingMode: browser?.routingMode });
const isLocalProfileMode =
proxyState.kind === "ready" && proxyState.effectiveRoutingMode === "local";
let activePartition: string | null = null;
if (proxyState.kind === "ready") {
activePartition =
proxyState.effectiveRoutingMode === "host"
? proxyState.partition
: getBrowserProfilePartition(profileSlug);
}
const browserViewport = browser?.viewport ?? RESPONSIVE_BROWSER_VIEWPORT;
const browserViewportRef = useRef(browserViewport);
browserViewportRef.current = browserViewport;
@@ -1805,13 +1813,15 @@ export function BrowserPane({
initialValue={draftUrl}
/>
</View>
<ProfileSelector
selectedSlug={profileSlug}
catalog={catalog.data ?? []}
triggerStyle={profileTriggerStyle}
onSelect={selectProfile}
refresh={refreshProfiles}
/>
{isLocalProfileMode ? (
<ProfileSelector
selectedSlug={profileSlug}
catalog={catalog.data ?? []}
triggerStyle={profileTriggerStyle}
onSelect={selectProfile}
refresh={refreshProfiles}
/>
) : null}
<View style={styles.chromeRight}>
<DeviceSizeMenu
selectedId={selectedDeviceSizeId}
@@ -1,5 +1,4 @@
import { getIsElectron } from "@/constants/platform";
import { DEFAULT_BROWSER_PROFILE_SLUG } from "@/desktop/browser/profiles";
import {
getDesktopHost,
type DesktopBrowserProxyStatusSnapshot,
@@ -36,18 +35,13 @@ function notifyStatusListeners(serverId: string): void {
}
}
function hasSameProfilePartitions(a: Record<string, string>, b: Record<string, string>): boolean {
const slugs = Object.keys(a);
return slugs.length === Object.keys(b).length && slugs.every((slug) => a[slug] === b[slug]);
}
function setCachedStatus(snapshot: DesktopBrowserProxyStatusSnapshot): void {
const existing = statusByServerId.get(snapshot.serverId);
if (
existing &&
existing.status === snapshot.status &&
existing.error === snapshot.error &&
hasSameProfilePartitions(existing.profilePartitions, snapshot.profilePartitions) &&
existing.partition === snapshot.partition &&
existing.socksPort === snapshot.socksPort
) {
return;
@@ -59,12 +53,9 @@ function setCachedStatus(snapshot: DesktopBrowserProxyStatusSnapshot): void {
function isStatusSnapshot(value: unknown): value is DesktopBrowserProxyStatusSnapshot {
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
const record = value as Record<string, unknown>;
const profilePartitions = record.profilePartitions;
return (
typeof record.serverId === "string" &&
typeof profilePartitions === "object" &&
profilePartitions !== null &&
Object.values(profilePartitions).every((partition) => typeof partition === "string") &&
typeof record.partition === "string" &&
typeof record.status === "string"
);
}
@@ -277,7 +268,6 @@ export function subscribeBrowserProxyStatus(serverId: string, listener: () => vo
export async function ensureHostBrowserProxy(input: {
serverId: string;
target: SupportedTarget;
profileSlug?: string;
forceReconnect?: boolean;
}): Promise<DesktopBrowserProxyStatusSnapshot | null> {
installBrowserProxyRendererBridge();
@@ -355,15 +345,14 @@ export async function prepareHostBrowserPartition(
message: "Browser proxy bridge is unavailable in this desktop build.",
};
}
const partition = status.profilePartitions[DEFAULT_BROWSER_PROFILE_SLUG];
if (status.status !== "ready" || !partition) {
if (status.status !== "ready") {
return {
ok: false,
reason: "proxy_error",
message: status.error ?? "Unable to connect browser proxy.",
};
}
return { ok: true, partition, isRemoteHost: true };
return { ok: true, partition: status.partition, isRemoteHost: true };
} catch (error) {
return {
ok: false,
@@ -9,7 +9,7 @@ describe("resolveBrowserProxyPaneState", () => {
resolveBrowserProxyPaneState({
routing: { kind: "remote", support: "host_connecting" },
effectiveRoutingMode: "host",
profileSlug: "default",
localPartition: "persist:paseo-browser",
hostLabel: "devbox",
proxyStatusSnapshot: null,
ensureError: null,
@@ -27,11 +27,11 @@ describe("resolveBrowserProxyPaneState", () => {
resolveBrowserProxyPaneState({
routing: { kind: "remote", support: "host_offline" },
effectiveRoutingMode: "host",
profileSlug: "default",
localPartition: "persist:paseo-browser",
hostLabel: "devbox",
proxyStatusSnapshot: {
serverId: "srv-remote",
profilePartitions: { default: "persist:paseo-browser-host-0123456789abcdef" },
partition: "persist:paseo-browser-host-0123456789abcdef",
status: "connecting",
error: null,
socksPort: null,
@@ -50,7 +50,7 @@ describe("resolveBrowserProxyPaneState", () => {
it("keeps the prepared host partition mounted across transient host disconnects and reconnects", () => {
const preparedSnapshot = {
serverId: "srv-remote",
profilePartitions: { default: "persist:paseo-browser-host-0123456789abcdef" },
partition: "persist:paseo-browser-host-0123456789abcdef",
status: "ready" as const,
error: null,
socksPort: 41234,
@@ -60,7 +60,7 @@ describe("resolveBrowserProxyPaneState", () => {
resolveBrowserProxyPaneState({
routing: { kind: "remote", support: "host_offline" },
effectiveRoutingMode: "host",
profileSlug: "default",
localPartition: "persist:paseo-browser",
hostLabel: "devbox",
proxyStatusSnapshot: preparedSnapshot,
ensureError: null,
@@ -68,7 +68,7 @@ describe("resolveBrowserProxyPaneState", () => {
}),
).toEqual({
kind: "ready",
partition: preparedSnapshot.profilePartitions.default,
partition: preparedSnapshot.partition,
isRemoteHost: true,
effectiveRoutingMode: "host",
hostLabel: "devbox",
@@ -79,7 +79,7 @@ describe("resolveBrowserProxyPaneState", () => {
resolveBrowserProxyPaneState({
routing: { kind: "remote", support: "host_connecting" },
effectiveRoutingMode: "host",
profileSlug: "default",
localPartition: "persist:paseo-browser",
hostLabel: "devbox",
proxyStatusSnapshot: preparedSnapshot,
ensureError: null,
@@ -87,7 +87,7 @@ describe("resolveBrowserProxyPaneState", () => {
}),
).toEqual({
kind: "ready",
partition: preparedSnapshot.profilePartitions.default,
partition: preparedSnapshot.partition,
isRemoteHost: true,
effectiveRoutingMode: "host",
hostLabel: "devbox",
@@ -106,11 +106,11 @@ describe("resolveBrowserProxyPaneState", () => {
resolveBrowserProxyPaneState({
routing: supportedRouting,
effectiveRoutingMode: "host",
profileSlug: "default",
localPartition: "persist:paseo-browser",
hostLabel: "devbox",
proxyStatusSnapshot: {
serverId: "srv-remote",
profilePartitions: { default: "persist:paseo-browser-host-0123456789abcdef" },
partition: "persist:paseo-browser-host-0123456789abcdef",
status: "error",
error: "Host disconnected",
socksPort: 41234,
@@ -133,11 +133,11 @@ describe("resolveBrowserProxyPaneState", () => {
resolveBrowserProxyPaneState({
routing: supportedRouting,
effectiveRoutingMode: "host",
profileSlug: "default",
localPartition: "persist:paseo-browser",
hostLabel: "devbox",
proxyStatusSnapshot: {
serverId: "srv-remote",
profilePartitions: { default: "persist:paseo-browser-host-0123456789abcdef" },
partition: "persist:paseo-browser-host-0123456789abcdef",
status: "ready",
error: null,
socksPort: 41234,
@@ -159,11 +159,11 @@ describe("resolveBrowserProxyPaneState", () => {
resolveBrowserProxyPaneState({
routing: supportedRouting,
effectiveRoutingMode: "host",
profileSlug: "default",
localPartition: "persist:paseo-browser",
hostLabel: "devbox",
proxyStatusSnapshot: {
serverId: "srv-remote",
profilePartitions: { default: "persist:paseo-browser-host-0123456789abcdef" },
partition: "persist:paseo-browser-host-0123456789abcdef",
status: "error",
error: "Unable to create ticket",
socksPort: null,
@@ -185,7 +185,7 @@ describe("resolveBrowserProxyPaneState", () => {
const routedTarget = { via: "unix:///tmp/paseo.sock", serverId: "srv-dev" };
const input = {
effectiveRoutingMode: "host" as const,
profileSlug: "default",
localPartition: "persist:paseo-browser",
hostLabel: "dev",
ensureError: null,
onRetry: noop,
@@ -212,7 +212,7 @@ describe("resolveBrowserProxyPaneState", () => {
routing,
proxyStatusSnapshot: {
serverId: "srv-dev",
profilePartitions: { default: "persist:paseo-browser-host-dev" },
partition: "persist:paseo-browser-host-dev",
status: "ready",
error: null,
socksPort: 41000,
@@ -250,7 +250,7 @@ describe("resolveBrowserProxyPaneState", () => {
routing: { kind: "remote", support: "host_connecting" },
proxyStatusSnapshot: {
serverId: "srv-dev",
profilePartitions: { default: "persist:paseo-browser-host-dev" },
partition: "persist:paseo-browser-host-dev",
status: "ready",
error: null,
socksPort: 41000,
@@ -259,102 +259,4 @@ describe("resolveBrowserProxyPaneState", () => {
).toMatchObject({ kind: "ready", proxyStatus: "reconnecting" });
});
});
describe("browser profiles", () => {
const hostDefault = "persist:paseo-browser-host-0123456789abcdef";
const hostWork = `${hostDefault}-profile-work`;
const supportedRouting = {
kind: "remote" as const,
support: "supported" as const,
target: "tcp://10.0.0.5:6767",
};
const base = {
hostLabel: "devbox",
ensureError: null,
onRetry: noop,
};
it("mounts the local partition of the tab's profile when routing locally", () => {
expect(
resolveBrowserProxyPaneState({
...base,
routing: supportedRouting,
effectiveRoutingMode: "local",
profileSlug: "work",
proxyStatusSnapshot: null,
}),
).toMatchObject({ kind: "ready", partition: "persist:paseo-profile-work" });
});
it("waits for the host to bind the profile's session instead of mounting another profile", () => {
expect(
resolveBrowserProxyPaneState({
...base,
routing: supportedRouting,
effectiveRoutingMode: "host",
profileSlug: "work",
proxyStatusSnapshot: {
serverId: "srv-remote",
profilePartitions: { default: hostDefault },
status: "ready",
error: null,
socksPort: 41234,
},
}),
).toMatchObject({ kind: "connecting", effectiveRoutingMode: "host" });
});
it("waits for a profile whose slug matches an Object property name", () => {
expect(
resolveBrowserProxyPaneState({
...base,
routing: supportedRouting,
effectiveRoutingMode: "host",
profileSlug: "constructor",
proxyStatusSnapshot: {
serverId: "srv-remote",
profilePartitions: { default: hostDefault },
status: "ready",
error: null,
socksPort: 41234,
},
}),
).toMatchObject({ kind: "connecting", effectiveRoutingMode: "host" });
});
it("mounts the host partition of the tab's profile once it is bound", () => {
const snapshot = {
serverId: "srv-remote",
profilePartitions: { default: hostDefault, work: hostWork },
status: "ready" as const,
error: null,
socksPort: 41234,
};
expect(
resolveBrowserProxyPaneState({
...base,
routing: supportedRouting,
effectiveRoutingMode: "host",
profileSlug: "work",
proxyStatusSnapshot: snapshot,
}),
).toEqual({
kind: "ready",
partition: hostWork,
isRemoteHost: true,
effectiveRoutingMode: "host",
hostLabel: "devbox",
proxyStatus: "ready",
});
expect(
resolveBrowserProxyPaneState({
...base,
routing: { kind: "remote", support: "host_offline" },
effectiveRoutingMode: "host",
profileSlug: "work",
proxyStatusSnapshot: snapshot,
}),
).toMatchObject({ kind: "ready", partition: hostWork, proxyStatus: "reconnecting" });
});
});
});
@@ -1,7 +1,6 @@
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
import { useCallback, useEffect, useMemo, useState, useSyncExternalStore } from "react";
import { getIsElectron } from "@/constants/platform";
import type { DesktopBrowserProxyStatus } from "@/desktop/host";
import { getBrowserProfilePartition } from "@/desktop/browser/profiles";
import { getDesktopHost, type DesktopBrowserProxyStatus } from "@/desktop/host";
import { resolveBrowserRoutingMode, type BrowserRoutingMode } from "@/desktop/browser/store";
import { useHosts } from "@/runtime/host-runtime";
import { normalizeHostLabel } from "@/types/host-connection";
@@ -52,35 +51,29 @@ export type BrowserProxyPaneState =
retry: () => void;
};
/** The profile's host partition, once main has bound its session to the host's SOCKS5 port. */
function readPreparedHostPartition(
function hasPreparedHostPartition(
snapshot: ReturnType<typeof getCachedBrowserProxyStatus>,
profileSlug: string,
): string | null {
if (
!snapshot ||
snapshot.socksPort === null ||
!Object.hasOwn(snapshot.profilePartitions, profileSlug)
) {
return null;
}
return snapshot.profilePartitions[profileSlug] ?? null;
): snapshot is NonNullable<ReturnType<typeof getCachedBrowserProxyStatus>> & {
partition: string;
socksPort: number;
} {
return Boolean(snapshot?.partition && snapshot.socksPort !== null);
}
function resolveRemoteUnavailablePaneState(
support: Exclude<Extract<HostBrowserRouting, { kind: "remote" }>["support"], "supported">,
hostLabel: string,
preparedPartition: string | null,
proxyStatusSnapshot: ReturnType<typeof getCachedBrowserProxyStatus>,
): BrowserProxyPaneState {
// Once Electron main has verified and bound this profile's session to the host's
// fixed SOCKS5 port, keep the webview mounted across transient host
// disconnects/reconnects so SPA state, forms, scroll, and DevTools survive.
// Requests still fail closed at the local SOCKS5 listener while the tunnel is down.
// Once Electron main has verified and bound this host's fixed SOCKS5 partition,
// keep the webview mounted across transient host disconnects/reconnects so SPA
// state, forms, scroll, and DevTools survive. Requests still fail closed at the
// local SOCKS5 listener while the tunnel is down.
const isTransientDisconnect = support === "host_connecting" || support === "host_offline";
if (isTransientDisconnect && preparedPartition) {
if (isTransientDisconnect && hasPreparedHostPartition(proxyStatusSnapshot)) {
return {
kind: "ready",
partition: preparedPartition,
partition: proxyStatusSnapshot.partition,
isRemoteHost: true,
effectiveRoutingMode: "host",
hostLabel,
@@ -116,7 +109,7 @@ function resolvePreparedHostPaneStatus(
export function resolveBrowserProxyPaneState(input: {
routing: HostBrowserRouting;
effectiveRoutingMode: BrowserRoutingMode;
profileSlug: string;
localPartition: string;
hostLabel: string;
proxyStatusSnapshot: ReturnType<typeof getCachedBrowserProxyStatus>;
ensureError: string | null;
@@ -125,7 +118,7 @@ export function resolveBrowserProxyPaneState(input: {
const {
routing,
effectiveRoutingMode,
profileSlug,
localPartition,
hostLabel,
proxyStatusSnapshot,
ensureError,
@@ -135,7 +128,7 @@ export function resolveBrowserProxyPaneState(input: {
if (routing.kind === "local" || effectiveRoutingMode === "local") {
return {
kind: "ready",
partition: getBrowserProfilePartition(profileSlug),
partition: localPartition,
isRemoteHost: routing.kind === "remote",
effectiveRoutingMode: "local",
hostLabel,
@@ -143,18 +136,17 @@ export function resolveBrowserProxyPaneState(input: {
};
}
const preparedPartition = readPreparedHostPartition(proxyStatusSnapshot, profileSlug);
if (routing.support !== "supported") {
return resolveRemoteUnavailablePaneState(routing.support, hostLabel, preparedPartition);
return resolveRemoteUnavailablePaneState(routing.support, hostLabel, proxyStatusSnapshot);
}
// Once the profile's session is bound to the fixed-port SOCKS5 proxy, keep the
// webview mounted even if a background poll (e.g. HMR) left the cached tunnel
// status in "error" or "reconnecting" while the host reconnects.
if (proxyStatusSnapshot && preparedPartition) {
// Once the fixed-port SOCKS5 session partition is verified (socksPort !== null),
// keep the webview mounted even if a background poll (e.g. HMR) left the cached
// tunnel status in "error" or "reconnecting" while the host reconnects.
if (hasPreparedHostPartition(proxyStatusSnapshot)) {
return {
kind: "ready",
partition: preparedPartition,
partition: proxyStatusSnapshot.partition,
isRemoteHost: true,
effectiveRoutingMode: "host",
hostLabel,
@@ -187,9 +179,8 @@ export function resolveBrowserProxyPaneState(input: {
export function useHostBrowserProxy(input: {
serverId: string;
routingMode?: BrowserRoutingMode;
profileSlug: string;
}): BrowserProxyPaneState {
const { serverId, routingMode, profileSlug } = input;
const { serverId, routingMode } = input;
const hosts = useHosts();
const host = useMemo(
() => hosts.find((entry) => entry.serverId === serverId) ?? null,
@@ -209,9 +200,6 @@ export function useHostBrowserProxy(input: {
);
const [retryCounter, setRetryCounter] = useState(0);
// A retry replaces the host tunnel once. Later runs (another profile on the same host)
// reuse the tunnel that other tabs on this host share.
const reconnectedRetryRef = useRef(0);
const [ensureError, setEnsureError] = useState<string | null>(null);
const effectiveRoutingMode = resolveBrowserRoutingMode(
@@ -237,13 +225,10 @@ export function useHostBrowserProxy(input: {
installBrowserProxyRendererBridge();
setEnsureError(null);
const forceReconnect = retryCounter > reconnectedRetryRef.current;
reconnectedRetryRef.current = retryCounter;
void ensureHostBrowserProxy({
serverId,
target: supportedTarget,
profileSlug,
forceReconnect,
forceReconnect: retryCounter > 0,
})
.then((snapshot) => {
if (cancelled) return undefined;
@@ -264,12 +249,13 @@ export function useHostBrowserProxy(input: {
};
// targetKey serializes supportedTarget deterministically.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [effectiveRoutingMode, profileSlug, retryCounter, serverId, targetKey]);
}, [effectiveRoutingMode, retryCounter, serverId, targetKey]);
const localPartition = getDesktopHost()?.browser?.profilePartition ?? "persist:paseo-browser";
return resolveBrowserProxyPaneState({
routing,
effectiveRoutingMode,
profileSlug,
localPartition,
hostLabel,
proxyStatusSnapshot,
ensureError,
+1 -3
View File
@@ -177,8 +177,7 @@ export type DesktopBrowserProxyStatus = "idle" | "connecting" | "ready" | "recon
export interface DesktopBrowserProxyStatusSnapshot {
serverId: string;
/** Profile slug -> partition, for every profile session bound to this host's proxy. */
profilePartitions: Record<string, string>;
partition: string;
status: DesktopBrowserProxyStatus;
error: string | null;
socksPort: number | null;
@@ -219,7 +218,6 @@ export interface DesktopBrowserBridge {
ensureHostProxy?: (input: {
serverId: string;
target: HostTransportSpec;
profileSlug?: string;
forceReconnect?: boolean;
}) => Promise<DesktopBrowserProxyStatusSnapshot>;
updateHostProxyTarget?: (input: { serverId: string; target: HostTransportSpec }) => Promise<void>;
+10 -6
View File
@@ -4,11 +4,7 @@ import { File } from "expo-file-system";
import { getDesktopHost, isElectronRuntime } from "@/desktop/host";
import { isWeb } from "@/constants/platform";
import { getMimeTypeFromPath } from "@/attachments/file-types";
import {
readDesktopFileBytes,
selectedFileFromWebFile,
type SelectedFile,
} from "@/attachments/selected-file";
import { readDesktopFileBytes, type SelectedFile } from "@/attachments/selected-file";
async function pickFilesWithDesktopDialog(): Promise<SelectedFile[] | null> {
const dialog = getDesktopHost()?.dialog;
@@ -56,7 +52,15 @@ function pickFilesWithWebInput(): Promise<SelectedFile[] | null> {
return;
}
resolve(files.map(selectedFileFromWebFile));
const result: SelectedFile[] = [];
for (const file of files) {
result.push({
fileName: file.name,
mimeType: file.type || getMimeTypeFromPath(file.name),
readBytes: async () => new Uint8Array(await file.arrayBuffer()),
});
}
resolve(result);
});
input.addEventListener("cancel", () => {
@@ -1,4 +1,4 @@
import { useHostFeatureAvailabilityMap } from "@/runtime/host-features";
import { useHostFeatureMap } from "@/runtime/host-features";
import { useCallback, useEffect, useMemo } from "react";
import { useStoreWithEqualityFn } from "zustand/traditional";
import { useCreateFlowStore } from "@/stores/create-flow-store";
@@ -142,9 +142,8 @@ export function useSidebarWorkspacesList(options?: {
const workspaceSort = useSidebarViewStore((state) => state.workspaceSort);
const groupMode = useSidebarViewStore((state) => state.groupMode);
const sortSupport = useHostFeatureAvailabilityMap(directoryServerIds, "workspaceSortTimes");
// Cached workspaces are visible before their host sends server info.
const workspaceSortSupported = ![...sortSupport.values()].includes(false);
const sortSupport = useHostFeatureMap(directoryServerIds, "workspaceSortTimes");
const workspaceSortSupported = [...sortSupport.values()].every(Boolean);
const sort =
groupMode === "project" && (workspaceSort === "manual" || workspaceSortSupported)
? workspaceSort
+12 -3
View File
@@ -2815,9 +2815,18 @@ export const ar: TranslationResources = {
title: "عام",
sending: "الإرسال",
setup: {
label: "الإعداد الأولي",
description: "أعد المرور على المظهر والمزوّدين والمشاريع وإقران الهاتف",
action: "إظهار الإعداد مجددًا",
label: "الإعداد",
description: "أعد تشغيل دليل الترحيب",
action: "عرض",
},
pluginExecutionBypass: {
label: "تشغيل الإضافات دون سؤال",
description:
"يمكن لأي مضيف متصل تشغيل تعليمات الإضافات داخل Paseo والوصول إلى المضيفين الآخرين",
confirmTitle: "تشغيل الإضافات دون سؤال؟",
confirmMessage:
"يمكن لأي مضيف متصل تشغيل تعليمات الإضافات داخل Paseo والوصول إلى المضيفين المتصلين الآخرين. فعّل هذا الخيار فقط إذا كنت تثق بكل مضيف تتصل به.",
confirmAction: "تفعيل",
},
browserData: {
title: "بيانات المتصفح",
+30 -3
View File
@@ -2772,6 +2772,24 @@ export const en = {
unavailable: "This plugin settings screen is unavailable.",
backToPlugins: "Back to plugins",
},
clientExecution: {
promptTitle: "Allow plugin in this app?",
promptDescription:
"This plugin runs unsandboxed code in Paseo and can reach your connected hosts. Only allow plugins you trust.",
pluginLabel: "Plugin",
hostLabel: "Host",
queueProgress: "{{step}} of {{total}}",
allow: "Allow",
decline: "Don't allow",
blockedBadge: "blocked",
blockedTitle: "Blocked on this device",
blockedDescription: "This plugin runs on the host, but its app code is blocked here.",
surfaceBlocked: "App code for this plugin is blocked on this device.",
allowAction: "Allow on this device",
blockAction: "Block on this device",
allowedToast: "Allowed {{name}} on this device",
blockedToast: "Blocked {{name}} on this device",
},
trustedTitle: "Plugins are trusted code",
trustedDescription:
"They run on this host and inside the app without sandboxing. Install only code you trust.",
@@ -2913,9 +2931,18 @@ export const en = {
title: "General",
sending: "Sending",
setup: {
label: "First-run setup",
description: "Walk through appearance, providers, projects and phone pairing again",
action: "Show setup again",
label: "Setup",
description: "Run the welcome guide again",
action: "Show",
},
pluginExecutionBypass: {
label: "Run plugins without asking",
description:
"Any connected host can run plugin code inside Paseo and reach your other hosts",
confirmTitle: "Run plugins without asking?",
confirmMessage:
"Any connected host can run plugin code inside Paseo and reach your other connected hosts. Only turn this on if you trust every host you connect to.",
confirmAction: "Turn on",
},
browserData: {
title: "Browser data",
+11 -3
View File
@@ -2837,10 +2837,18 @@ export const es: TranslationResources = {
title: "General",
sending: "Envío",
setup: {
label: "Configuración inicial",
label: "Configuración",
description: "Volver a abrir la guía de bienvenida",
action: "Mostrar",
},
pluginExecutionBypass: {
label: "Ejecutar plugins sin preguntar",
description:
"Vuelve a recorrer apariencia, proveedores, proyectos y emparejamiento del teléfono",
action: "Mostrar configuración de nuevo",
"Cualquier host conectado puede ejecutar código de plugins en Paseo y acceder a tus otros hosts",
confirmTitle: "¿Ejecutar plugins sin preguntar?",
confirmMessage:
"Cualquier host conectado puede ejecutar código de plugins en Paseo y acceder a tus otros hosts conectados. Actívalo solo si confías en cada host al que te conectas.",
confirmAction: "Activar",
},
browserData: {
title: "Datos del navegador",
+11 -3
View File
@@ -2838,10 +2838,18 @@ export const fr: TranslationResources = {
title: "Général",
sending: "Envoi",
setup: {
label: "Configuration initiale",
label: "Configuration",
description: "Rouvrir le guide de bienvenue",
action: "Afficher",
},
pluginExecutionBypass: {
label: "Exécuter les plugins sans demander",
description:
"Reprendre l'apparence, les fournisseurs, les projets et l'appairage du téléphone",
action: "Afficher la configuration",
"Tout hôte connecté peut exécuter du code de plugin dans Paseo et accéder à vos autres hôtes",
confirmTitle: "Exécuter les plugins sans demander ?",
confirmMessage:
"Tout hôte connecté peut exécuter du code de plugin dans Paseo et accéder à vos autres hôtes connectés. Activez cette option uniquement si vous faites confiance à chaque hôte auquel vous vous connectez.",
confirmAction: "Activer",
},
browserData: {
title: "Données du navigateur",
+11 -3
View File
@@ -2805,10 +2805,18 @@ export const ja: TranslationResources = {
title: "一般",
sending: "送信",
setup: {
label: "初回セットアップ",
label: "セットアップ",
description: "ようこそガイドをもう一度開く",
action: "表示",
},
pluginExecutionBypass: {
label: "確認せずにプラグインを実行",
description:
"外観、プロバイダー、プロジェクト、スマートフォンのペアリングをもう一度設定します",
action: "セットアップを再表示",
"接続中のどのホストも Paseo 内でプラグインコードを実行し、他のホストにアクセスできます",
confirmTitle: "確認せずにプラグインを実行しますか?",
confirmMessage:
"接続中のどのホストも Paseo 内でプラグインコードを実行し、接続中の他のホストにアクセスできます。接続するすべてのホストを信頼する場合にのみオンにしてください。",
confirmAction: "オンにする",
},
browserData: {
title: "ブラウザーデータ",
+12 -3
View File
@@ -2791,9 +2791,18 @@ export const ko: TranslationResources = {
title: "일반",
sending: "전송",
setup: {
label: "초기 설정",
description: "모양, 제공자, 프로젝트, 휴대폰 페어링을 다시 진행합니다",
action: "설정 다시 보기",
label: "설정",
description: "시작 가이드를 다시 엽니다",
action: "보기",
},
pluginExecutionBypass: {
label: "확인 없이 플러그인 실행",
description:
"연결된 모든 호스트가 Paseo 내에서 플러그인 코드를 실행하고 다른 호스트에 접근할 수 있습니다",
confirmTitle: "확인 없이 플러그인을 실행할까요?",
confirmMessage:
"연결된 모든 호스트가 Paseo 내에서 플러그인 코드를 실행하고 연결된 다른 호스트에 접근할 수 있습니다. 연결하는 모든 호스트를 신뢰하는 경우에만 켜세요.",
confirmAction: "켜기",
},
browserData: {
title: "브라우저 데이터",
@@ -24,6 +24,24 @@ export const pluginSettings = {
backToPlugins: "العودة إلى الإضافات",
},
title: "الإضافات",
clientExecution: {
promptTitle: "السماح للإضافة بالعمل في هذا التطبيق؟",
promptDescription:
"تشغّل هذه الإضافة تعليمات برمجية غير معزولة داخل Paseo ويمكنها الوصول إلى المضيفين المتصلين. اسمح فقط بالإضافات التي تثق بها.",
pluginLabel: "الإضافة",
hostLabel: "المضيف",
queueProgress: "{{step}} من {{total}}",
allow: "سماح",
decline: "عدم السماح",
blockedBadge: "محظورة",
blockedTitle: "محظورة على هذا الجهاز",
blockedDescription: "تعمل هذه الإضافة على المضيف، لكن تعليماتها في التطبيق محظورة هنا.",
surfaceBlocked: "تعليمات التطبيق لهذه الإضافة محظورة على هذا الجهاز.",
allowAction: "السماح على هذا الجهاز",
blockAction: "الحظر على هذا الجهاز",
allowedToast: "تم السماح لـ {{name}} على هذا الجهاز",
blockedToast: "تم حظر {{name}} على هذا الجهاز",
},
trustedTitle: "الإضافات تعليمات برمجية موثوقة",
trustedDescription:
"تعمل على هذا المضيف وداخل التطبيق دون عزل. ثبّت فقط التعليمات البرمجية التي تثق بها.",
@@ -82,6 +100,25 @@ export const pluginSettings = {
backToPlugins: "Volver a plugins",
},
title: "Plugins",
clientExecution: {
promptTitle: "¿Permitir este plugin en la app?",
promptDescription:
"Este plugin ejecuta código sin aislamiento en Paseo y puede acceder a tus hosts conectados. Permite solo plugins de confianza.",
pluginLabel: "Plugin",
hostLabel: "Host",
queueProgress: "{{step}} de {{total}}",
allow: "Permitir",
decline: "No permitir",
blockedBadge: "bloqueado",
blockedTitle: "Bloqueado en este dispositivo",
blockedDescription:
"Este plugin se ejecuta en el host, pero su código en la app está bloqueado aquí.",
surfaceBlocked: "El código de la app para este plugin está bloqueado en este dispositivo.",
allowAction: "Permitir en este dispositivo",
blockAction: "Bloquear en este dispositivo",
allowedToast: "{{name}} permitido en este dispositivo",
blockedToast: "{{name}} bloqueado en este dispositivo",
},
trustedTitle: "Los plugins son código de confianza",
trustedDescription:
"Se ejecutan en este host y dentro de la app sin aislamiento. Instala solo código de confianza.",
@@ -140,6 +177,25 @@ export const pluginSettings = {
backToPlugins: "Retour aux plugins",
},
title: "Plugins",
clientExecution: {
promptTitle: "Autoriser ce plugin dans l’app ?",
promptDescription:
"Ce plugin exécute du code sans isolation dans Paseo et peut atteindre vos hôtes connectés. N’autorisez que les plugins fiables.",
pluginLabel: "Plugin",
hostLabel: "Hôte",
queueProgress: "{{step}} sur {{total}}",
allow: "Autoriser",
decline: "Refuser",
blockedBadge: "bloqué",
blockedTitle: "Bloqué sur cet appareil",
blockedDescription:
"Ce plugin s’exécute sur l’hôte, mais son code dans l’app est bloqué ici.",
surfaceBlocked: "Le code applicatif de ce plugin est bloqué sur cet appareil.",
allowAction: "Autoriser sur cet appareil",
blockAction: "Bloquer sur cet appareil",
allowedToast: "{{name}} autorisé sur cet appareil",
blockedToast: "{{name}} bloqué sur cet appareil",
},
trustedTitle: "Les plugins sont du code de confiance",
trustedDescription:
"Ils s’exécutent sur cet hôte et dans l’app sans isolation. N’installez que du code fiable.",
@@ -198,6 +254,25 @@ export const pluginSettings = {
backToPlugins: "プラグインに戻る",
},
title: "プラグイン",
clientExecution: {
promptTitle: "このアプリでプラグインを許可しますか?",
promptDescription:
"このプラグインは Paseo 内で分離されずにコードを実行し、接続中のホストにアクセスできます。信頼できるプラグインのみ許可してください。",
pluginLabel: "プラグイン",
hostLabel: "ホスト",
queueProgress: "{{step}} / {{total}}",
allow: "許可",
decline: "許可しない",
blockedBadge: "ブロック中",
blockedTitle: "このデバイスでブロックされています",
blockedDescription:
"このプラグインはホストで動作していますが、アプリ側コードはここでブロックされています。",
surfaceBlocked: "このプラグインのアプリ側コードはこのデバイスでブロックされています。",
allowAction: "このデバイスで許可",
blockAction: "このデバイスでブロック",
allowedToast: "このデバイスで {{name}} を許可しました",
blockedToast: "このデバイスで {{name}} をブロックしました",
},
trustedTitle: "プラグインは信頼済みコードです",
trustedDescription:
"ホストとアプリ内で分離されずに実行されます。信頼できるコードのみインストールしてください。",
@@ -256,6 +331,25 @@ export const pluginSettings = {
backToPlugins: "플러그인으로 돌아가기",
},
title: "플러그인",
clientExecution: {
promptTitle: "이 앱에서 플러그인 실행을 허용할까요?",
promptDescription:
"이 플러그인은 Paseo 내에서 격리 없이 코드를 실행하며 연결된 호스트에 접근할 수 있습니다. 신뢰하는 플러그인만 허용하세요.",
pluginLabel: "플러그인",
hostLabel: "호스트",
queueProgress: "{{step}} / {{total}}",
allow: "허용",
decline: "허용 안 함",
blockedBadge: "차단됨",
blockedTitle: "이 기기에서 차단됨",
blockedDescription:
"이 플러그인은 호스트에서 실행 중이지만 앱 코드는 이 기기에서 차단되어 있습니다.",
surfaceBlocked: "이 플러그인의 앱 코드는 이 기기에서 차단되어 있습니다.",
allowAction: "이 기기에서 허용",
blockAction: "이 기기에서 차단",
allowedToast: "이 기기에서 {{name}} 실행을 허용했습니다",
blockedToast: "이 기기에서 {{name}} 실행을 차단했습니다",
},
trustedTitle: "플러그인은 신뢰하는 코드입니다",
trustedDescription: "호스트와 앱 안에서 격리 없이 실행됩니다. 신뢰하는 코드만 설치하세요.",
globalTitle: "플러그인 활성화",
@@ -313,6 +407,24 @@ export const pluginSettings = {
backToPlugins: "Voltar para plugins",
},
title: "Plugins",
clientExecution: {
promptTitle: "Permitir plugin neste app?",
promptDescription:
"Este plugin executa código sem isolamento no Paseo e pode acessar seus hosts conectados. Permita apenas plugins confiáveis.",
pluginLabel: "Plugin",
hostLabel: "Host",
queueProgress: "{{step}} de {{total}}",
allow: "Permitir",
decline: "Não permitir",
blockedBadge: "bloqueado",
blockedTitle: "Bloqueado neste dispositivo",
blockedDescription: "Este plugin roda no host, mas o código no app está bloqueado aqui.",
surfaceBlocked: "O código do app para este plugin está bloqueado neste dispositivo.",
allowAction: "Permitir neste dispositivo",
blockAction: "Bloquear neste dispositivo",
allowedToast: "{{name}} permitido neste dispositivo",
blockedToast: "{{name}} bloqueado neste dispositivo",
},
trustedTitle: "Plugins são código confiável",
trustedDescription:
"Eles rodam neste host e dentro do app sem isolamento. Instale apenas código confiável.",
@@ -371,6 +483,25 @@ export const pluginSettings = {
backToPlugins: "Вернуться к плагинам",
},
title: "Плагины",
clientExecution: {
promptTitle: "Разрешить плагин в этом приложении?",
promptDescription:
"Этот плагин выполняет код в Paseo без изоляции и может обращаться к подключённым хостам. Разрешайте только доверенные плагины.",
pluginLabel: "Плагин",
hostLabel: "Хост",
queueProgress: "{{step}} из {{total}}",
allow: "Разрешить",
decline: "Не разрешать",
blockedBadge: "заблокирован",
blockedTitle: "Заблокирован на этом устройстве",
blockedDescription:
"Этот плагин работает на хосте, но его код в приложении здесь заблокирован.",
surfaceBlocked: "Код этого плагина для приложения заблокирован на этом устройстве.",
allowAction: "Разрешить на этом устройстве",
blockAction: "Заблокировать на этом устройстве",
allowedToast: "{{name}} разрешён на этом устройстве",
blockedToast: "{{name}} заблокирован на этом устройстве",
},
trustedTitle: "Плагины — доверенный код",
trustedDescription:
"Они выполняются на хосте и в приложении без изоляции. Устанавливайте только доверенный код.",
@@ -429,6 +560,24 @@ export const pluginSettings = {
backToPlugins: "返回插件",
},
title: "插件",
clientExecution: {
promptTitle: "允许在此应用中运行此插件?",
promptDescription:
"此插件会在 Paseo 中以无隔离方式运行代码,并可访问你已连接的主机。仅允许你信任的插件。",
pluginLabel: "插件",
hostLabel: "主机",
queueProgress: "{{step}} / {{total}}",
allow: "允许",
decline: "不允许",
blockedBadge: "已阻止",
blockedTitle: "已在此设备上阻止",
blockedDescription: "此插件正在主机上运行,但其应用端代码已在此处被阻止。",
surfaceBlocked: "此插件的应用端代码已在此设备上被阻止。",
allowAction: "在此设备上允许",
blockAction: "在此设备上阻止",
allowedToast: "已在此设备上允许 {{name}}",
blockedToast: "已在此设备上阻止 {{name}}",
},
trustedTitle: "插件是受信任的代码",
trustedDescription: "它们会在此主机和应用内运行,且没有隔离。请仅安装你信任的代码。",
globalTitle: "启用插件",
+12 -3
View File
@@ -2822,9 +2822,18 @@ export const ptBR: TranslationResources = {
title: "Geral",
sending: "Envio",
setup: {
label: "Configuração inicial",
description: "Rever aparência, provedores, projetos e pareamento do celular",
action: "Mostrar configuração novamente",
label: "Configuração",
description: "Abrir o guia de boas-vindas novamente",
action: "Mostrar",
},
pluginExecutionBypass: {
label: "Executar plugins sem perguntar",
description:
"Qualquer host conectado pode executar código de plugin no Paseo e acessar seus outros hosts",
confirmTitle: "Executar plugins sem perguntar?",
confirmMessage:
"Qualquer host conectado pode executar código de plugin no Paseo e acessar seus outros hosts conectados. Ative esta opção apenas se você confia em todos os hosts aos quais se conecta.",
confirmAction: "Ativar",
},
browserData: {
title: "Dados do navegador",
+12 -3
View File
@@ -2825,9 +2825,18 @@ export const ru: TranslationResources = {
title: "Основные",
sending: "Отправка",
setup: {
label: "Первоначальная настройка",
description: "Снова пройти оформление, провайдеры, проекты и привязку телефона",
action: "Показать настройку снова",
label: "Настройка",
description: "Открыть приветственное руководство снова",
action: "Показать",
},
pluginExecutionBypass: {
label: "Запускать плагины без запроса",
description:
"Любой подключённый хост может выполнять код плагинов в Paseo и обращаться к другим вашим хостам",
confirmTitle: "Запускать плагины без запроса?",
confirmMessage:
"Любой подключённый хост может выполнять код плагинов в Paseo и обращаться к другим подключённым хостам. Включайте эту настройку, только если доверяете каждому хосту, к которому подключаетесь.",
confirmAction: "Включить",
},
browserData: {
title: "Данные браузера",
+11 -3
View File
@@ -2753,9 +2753,17 @@ export const zhCN: TranslationResources = {
title: "通用",
sending: "发送",
setup: {
label: "首次设置",
description: "重新设置外观、提供方、项目和手机配对",
action: "再次显示设置",
label: "设置",
description: "重新打开欢迎指南",
action: "显示",
},
pluginExecutionBypass: {
label: "无需询问直接运行插件",
description: "任何已连接的主机都可以在 Paseo 内运行插件代码,并访问您的其他主机",
confirmTitle: "无需询问直接运行插件?",
confirmMessage:
"任何已连接的主机都可以在 Paseo 内运行插件代码,并访问您连接的其他主机。仅在信任您连接的每个主机时开启此选项。",
confirmAction: "开启",
},
browserData: {
title: "浏览器数据",
@@ -3,16 +3,12 @@ import appPackage from "../../package.json";
import { afterEach, expect, it } from "vitest";
import { QueryObserver } from "@tanstack/react-query";
import { DaemonClient } from "@getpaseo/client/internal/daemon-client";
import type {
GetProvidersSnapshotResponseMessage,
SessionOutboundMessage,
} from "@getpaseo/protocol/messages";
import { compactProviderSnapshot } from "@getpaseo/protocol/provider-snapshot-codec";
import type { SessionOutboundMessage } from "@getpaseo/protocol/messages";
import { settingsRpc } from "@getpaseo/plugin";
import { providerSnapshotIcons, replaceProviderSnapshotIcons } from "@/data/provider-icons";
import { syncPluginCatalog } from "./catalog-sync-model";
import { createPluginHosts } from "./hosts";
import { openPluginNotification } from "./notification-open";
import { PluginExecutionApprovals } from "./execution-approval/store";
import { PluginRegistry } from "./registry";
import { pluginSettingsKey } from "./settings/query";
import type { InstalledPlugin } from "./types";
@@ -52,7 +48,14 @@ class SettingsStore {
/** In-memory daemon port; it delivers owned snapshots and stops updates on release. */
class CatalogClient extends DaemonClient {
catalog = catalog("one");
installedPlugins: Array<{
id: string;
path: string;
enabled: boolean;
status: "running" | "disabled" | "failed";
}> = [];
fetches = 0;
listFetches = 0;
releases = 0;
events: Parameters<DaemonClient["observeEvents"]>[0] = [];
private readonly observers = new Set<Observer>();
@@ -66,6 +69,11 @@ class CatalogClient extends DaemonClient {
return this.catalog;
}
override async listPlugins() {
this.listFetches++;
return this.installedPlugins;
}
override observeEvents(events: Parameters<DaemonClient["observeEvents"]>[0]): Observation {
this.events = events;
const snapshot = { requestId: "events", subscriptionId: "catalog" };
@@ -134,6 +142,7 @@ function harness() {
const registry = new PluginRegistry({
localeSource: { getLocale: () => "en", subscribe: () => () => {} },
version: appPackage.version,
isExecutionApproved: null,
createRuntime(installation) {
evaluations++;
return {
@@ -575,89 +584,250 @@ it("keeps catalog loading before server_info arrives so cold-launch plugin taps
expect(openedRoutes).toEqual(["/h/host/plugin/ci-alerts/surface/alert?param.buildId=77"]);
});
function providerSnapshotPayload(
provider: string,
iconSvg: string,
snapshotHash: string,
): GetProvidersSnapshotResponseMessage["payload"] {
const entries = [
{
provider,
label: provider,
iconSvg,
enabled: true,
available: true,
status: "ready" as const,
updatedAt: "2026-01-01T00:00:00.000Z",
},
];
const compactSnapshot = compactProviderSnapshot(entries);
function memoryApprovalStorage(initial?: Record<string, Record<string, "approved" | "declined">>) {
const values = new Map<string, string>();
if (initial) {
values.set("@paseo:plugin-execution-approvals", JSON.stringify(initial));
}
return {
requestId: "snapshot-req",
snapshotHash,
generatedAt: "2026-01-01T00:00:00.000Z",
entries,
compactSnapshot,
async getItem(key: string) {
return values.get(key) ?? null;
},
async setItem(key: string, value: string) {
values.set(key, value);
},
async removeItem(key: string) {
values.delete(key);
},
};
}
it("hydrates provider snapshot icons before installing plugins and refreshes them on catalog changes", async () => {
replaceProviderSnapshotIcons("host", []);
const events: string[] = [];
const firstSvg = '<svg viewBox="0 0 24 24"><path d="M2 2h20v20H2z" /></svg>';
const secondSvg = '<svg viewBox="0 0 24 24"><path d="M6 6h12v12H6z" /></svg>';
let current = { svg: firstSvg, hash: "hash-1" };
class SnapshotCatalogClient extends CatalogClient {
override async getProvidersSnapshot() {
events.push(`snapshot:${current.hash}`);
return providerSnapshotPayload("direct-example", current.svg, current.hash);
}
override async getPluginCatalog() {
events.push(
`catalog:${providerSnapshotIcons.getState().get("host")?.get("direct-example") ?? "missing"}`,
);
return super.getPluginCatalog();
}
}
const h = harness();
const client = new SnapshotCatalogClient();
h.sync({ client, supportsProviderSnapshots: true });
await expect.poll(() => h.registry.getCatalogStatus("host")).toBe("ready");
expect(events).toEqual(["snapshot:hash-1", `catalog:${firstSvg}`]);
expect(providerSnapshotIcons.getState().get("host")?.get("direct-example")).toBe(firstSvg);
current = { svg: secondSvg, hash: "hash-2" };
client.update({
type: "status",
payload: { status: "plugin_catalog_changed", pluginId: "direct-example" },
function approvalHarness(initial?: Record<string, Record<string, "approved" | "declined">>) {
const approvals = new PluginExecutionApprovals(memoryApprovalStorage(initial));
const executed: string[] = [];
let disposals = 0;
const registry = new PluginRegistry({
localeSource: { getLocale: () => "en", subscribe: () => () => {} },
version: appPackage.version,
isExecutionApproved: (serverId, pluginId) => approvals.isApproved(serverId, pluginId),
createRuntime(installation) {
executed.push(`${installation.serverId}/${installation.id}`);
return {
hosts: createPluginHosts(
{
getHosts: () => [],
getSnapshot: () => null,
subscribeAll: () => () => {},
subscribeHostList: () => () => {},
},
installation.lifetime.signal,
),
paseo: getPluginClientApi(installation).paseo,
i18n: installation.i18n,
rpc: async () => {
throw new Error("Unexpected runtime RPC");
},
openSettings: () => {
disposals += 1;
},
openScreen() {},
openSurface() {},
composers: () => [],
async playAudio() {},
workspaceLayout: () => {
throw new Error("Layouts are not used here");
},
openPanel() {},
addComposerPill: () => ({ update() {}, remove() {} }),
addHeaderButton: () => ({ update() {}, remove() {} }),
subscribe: () => {
throw new Error("Subscriptions are not used here");
},
};
},
});
const client = new CatalogClient();
cleanups.push(() => {
registry.removeHost("host");
approvals.clearHost("host");
});
return {
approvals,
registry,
client,
executed,
disposals: () => disposals,
sync(options: Partial<Parameters<typeof syncPluginCatalog>[0]> = {}) {
const stop = syncPluginCatalog({
serverId: "host",
client,
audio,
connected: true,
supported: true,
registry,
approvals,
...options,
});
cleanups.push(stop);
return stop;
},
};
}
function probeEntry(id: string, requirements = { paseo: `>=${appPackage.version}` }) {
return {
id,
requirements,
clientBundle: `(function() { return { default: function(plugin) {
return function() { plugin.openSettings("cleanup"); };
} }; })`,
};
}
it("never evaluates unapproved client bundles before explicit user approval", async () => {
const h = approvalHarness();
h.client.catalog = [probeEntry("alpha"), probeEntry("beta")];
h.sync();
await expect.poll(() => h.approvals.getQueueState().current?.pluginId).toBe("alpha");
expect(h.approvals.getQueueState().totalInBatch).toBe(2);
expect(h.executed).toEqual([]);
expect(h.registry.getSnapshot()).toEqual([]);
// Approve alpha -> alpha evaluates immediately without refetching; beta advances to front.
h.approvals.answer(h.approvals.getQueueState().current!.id, "approved");
expect(h.executed).toEqual(["host/alpha"]);
expect(h.registry.getSnapshot().map((plugin) => plugin.id)).toEqual(["alpha"]);
expect(h.client.fetches).toBe(1);
expect(h.approvals.getQueueState().current?.pluginId).toBe("beta");
// Decline beta -> beta never evaluates and queue closes.
h.approvals.answer(h.approvals.getQueueState().current!.id, "declined");
expect(h.executed).toEqual(["host/alpha"]);
expect(h.approvals.getQueueState().current).toBeNull();
});
it("disposes running client plugins immediately when approval is revoked or host trust resets", async () => {
const h = approvalHarness({ host: { alpha: "approved" } });
h.client.catalog = [probeEntry("alpha")];
h.sync();
await expect.poll(() => h.registry.getSnapshot().map((plugin) => plugin.id)).toEqual(["alpha"]);
expect(h.approvals.getQueueState().current).toBeNull();
// Revoking approval disposes alpha immediately.
h.approvals.setDecision("host", "alpha", "declined");
expect(h.registry.getSnapshot()).toEqual([]);
expect(h.disposals()).toBe(1);
// Re-allowing activates alpha again immediately.
h.approvals.setDecision("host", "alpha", "approved");
expect(h.registry.getSnapshot().map((plugin) => plugin.id)).toEqual(["alpha"]);
// Clearing host trust (e.g. host key change) disposes alpha and re-prompts.
h.approvals.clearHost("host");
expect(h.registry.getSnapshot()).toEqual([]);
expect(h.disposals()).toBe(2);
expect(h.approvals.getQueueState().current?.pluginId).toBe("alpha");
});
it("does not prompt for incompatible plugins and drops queued prompts on disconnect", async () => {
const h = approvalHarness();
h.client.catalog = [probeEntry("future-only", { paseo: ">=99.0.0" }), probeEntry("compatible")];
const stop = h.sync();
await expect.poll(() => h.approvals.getQueueState().current?.pluginId).toBe("compatible");
expect(h.approvals.getQueueState().totalInBatch).toBe(1);
expect(h.registry.getEvaluationError("host", "future-only")).toContain(">=99.0.0");
expect(h.executed).toEqual([]);
stop();
expect(h.approvals.getQueueState().current).toBeNull();
});
it("disposes retained client plugins immediately when blocked while the host is offline", async () => {
const h = approvalHarness({ host: { alpha: "approved" } });
h.client.catalog = [probeEntry("alpha")];
const stopConnected = h.sync();
await expect.poll(() => h.registry.getSnapshot().map((plugin) => plugin.id)).toEqual(["alpha"]);
stopConnected();
// Host drops offline: alpha stays retained until blocked.
const stopOffline = h.sync({ connected: false });
expect(h.registry.getSnapshot().map((plugin) => plugin.id)).toEqual(["alpha"]);
h.approvals.setDecision("host", "alpha", "declined");
expect(h.registry.getSnapshot()).toEqual([]);
expect(h.disposals()).toBe(1);
stopOffline();
});
it("clears saved decisions after external uninstall while preserving decisions for disabled plugins", async () => {
const h = approvalHarness({ host: { alpha: "approved", beta: "approved" } });
h.client.catalog = [probeEntry("alpha"), probeEntry("beta")];
h.client.installedPlugins = [
{ id: "alpha", path: "/tmp/alpha", enabled: true, status: "running" },
{ id: "beta", path: "/tmp/beta", enabled: true, status: "running" },
];
h.sync({ pluginManagementSupported: true });
await expect
.poll(() => providerSnapshotIcons.getState().get("host")?.get("direct-example"))
.toBe(secondSvg);
expect(events).toEqual([
"snapshot:hash-1",
`catalog:${firstSvg}`,
"snapshot:hash-2",
`catalog:${secondSvg}`,
.poll(() => h.registry.getSnapshot().map((plugin) => plugin.id))
.toEqual(["alpha", "beta"]);
expect(h.client.listFetches).toBe(0);
// beta is disabled (stays in installedPlugins), alpha is uninstalled via CLI/another device.
h.client.catalog = [];
h.client.installedPlugins = [
{ id: "beta", path: "/tmp/beta", enabled: false, status: "disabled" },
];
h.client.update({
type: "status",
payload: { status: "plugin_catalog_changed", pluginId: "alpha" },
});
await expect.poll(() => h.client.listFetches).toBe(1);
expect(h.approvals.getDecision("host", "alpha")).toBeNull();
expect(h.approvals.getDecision("host", "beta")).toBe("approved");
// Reinstalling alpha requires a fresh prompt; re-enabling beta runs without prompting.
h.client.catalog = [probeEntry("alpha"), probeEntry("beta")];
h.client.installedPlugins = [
{ id: "alpha", path: "/tmp/alpha", enabled: true, status: "running" },
{ id: "beta", path: "/tmp/beta", enabled: true, status: "running" },
];
h.client.update({
type: "status",
payload: { status: "plugin_catalog_changed", pluginId: "alpha" },
});
await expect.poll(() => h.approvals.getQueueState().current?.pluginId).toBe("alpha");
expect(h.registry.getSnapshot().map((plugin) => plugin.id)).toEqual(["beta"]);
});
it("activates queued and declined plugins immediately when bypass turns on, and disposes unapproved plugins when turned off", async () => {
const h = approvalHarness({ host: { approved: "approved", declined: "declined" } });
h.client.catalog = [probeEntry("approved"), probeEntry("declined"), probeEntry("pending")];
h.sync();
await expect.poll(() => h.approvals.getQueueState().current?.pluginId).toBe("pending");
expect(h.registry.getSnapshot().map((plugin) => plugin.id)).toEqual(["approved"]);
// Bypass ON: pending prompt dismisses and all compatible client plugins activate immediately.
h.approvals.setBypassEnabled(true);
expect(h.approvals.getQueueState().current).toBeNull();
expect(h.registry.getSnapshot().map((plugin) => plugin.id)).toEqual([
"approved",
"declined",
"pending",
]);
});
expect(h.client.fetches).toBe(1);
it("still installs the plugin catalog when provider icon hydration fails", async () => {
replaceProviderSnapshotIcons("host", []);
class FailingSnapshotClient extends CatalogClient {
override async getProvidersSnapshot(): Promise<GetProvidersSnapshotResponseMessage["payload"]> {
throw new Error("Snapshot unavailable");
}
}
const h = harness();
h.sync({ client: new FailingSnapshotClient(), supportsProviderSnapshots: true });
await expect.poll(() => h.registry.getCatalogStatus("host")).toBe("ready");
expect(h.installed().id).toBe("reports");
// Bypass OFF: declined and unreviewed plugins dispose immediately, unreviewed prompts again.
h.approvals.setBypassEnabled(false);
expect(h.registry.getSnapshot().map((plugin) => plugin.id)).toEqual(["approved"]);
expect(h.disposals()).toBe(2);
expect(h.approvals.getQueueState().current?.pluginId).toBe("pending");
expect(h.approvals.getQueueState().pendingCount).toBe(1);
});
+78 -34
View File
@@ -1,10 +1,11 @@
import { CancelledError } from "@tanstack/react-query";
import type { AudioEngine } from "@/audio";
import type { DaemonClient } from "@getpaseo/client/internal/daemon-client";
import { fetchProvidersSnapshot } from "@/data/providers-snapshot";
import type { PluginExecutionApprovals } from "./execution-approval/store";
import type { PluginRegistry } from "./registry";
import { pluginSettingsKey, pluginSettingsPrefix } from "./settings/query";
type CatalogPlugin = Awaited<ReturnType<DaemonClient["getPluginCatalog"]>>[number];
interface CatalogSyncInput {
serverId: string;
client: DaemonClient;
@@ -12,11 +13,17 @@ interface CatalogSyncInput {
connected: boolean;
/** `null` while `server_info` has not yet arrived for this host. */
supported: boolean | null;
supportsProviderSnapshots?: boolean;
pluginManagementSupported?: boolean;
registry: Pick<
PluginRegistry,
"installCatalog" | "getSnapshot" | "removeHost" | "setCatalogStatus"
>;
> &
Partial<Pick<PluginRegistry, "isCompatible" | "pruneDisallowed">>;
approvals?: Pick<
PluginExecutionApprovals,
"load" | "reconcileHostPlugins" | "clearHostPending" | "subscribe"
> &
Partial<Pick<PluginExecutionApprovals, "getDecidedPluginIds" | "pruneHostPlugins">>;
onCatalogChanged?: () => void;
}
@@ -26,8 +33,9 @@ export function syncPluginCatalog({
audio,
connected,
supported,
supportsProviderSnapshots = false,
pluginManagementSupported = false,
registry,
approvals,
onCatalogChanged,
}: CatalogSyncInput): () => void {
if (supported === null) {
@@ -36,54 +44,89 @@ export function syncPluginCatalog({
return () => {};
}
if (!supported || !audio) {
approvals?.clearHostPending(serverId);
registry.removeHost(serverId);
registry.setCatalogStatus(serverId, "ready");
return () => {};
}
// A dropped socket reconnects on the same client, so installations keep rendering offline.
if (!connected) return () => {};
// Keep enforcing local block decisions immediately while disconnected.
if (!connected) {
approvals?.clearHostPending(serverId);
return (
approvals?.subscribe(() => {
registry.pruneDisallowed?.(serverId);
}) ?? (() => {})
);
}
registry.setCatalogStatus(serverId, "loading");
const installationOptions = { client, audio };
let cancelled = false;
const abortController = new AbortController();
let latestCatalog: CatalogPlugin[] | null = null;
let applying = false;
let refreshQueue = Promise.resolve();
async function prepareProviderIcons() {
if (!supportsProviderSnapshots) return;
function applyCatalog(replacePluginId?: string) {
if (cancelled || !latestCatalog || applying) return;
applying = true;
try {
await fetchProvidersSnapshot({
client,
serverId,
cwd: null,
signal: abortController.signal,
});
} catch (error) {
if (!cancelled && !(error instanceof CancelledError)) {
console.warn(`[Plugins] Failed to load provider icons for ${serverId}`, error);
if (approvals) {
const promptableIds = latestCatalog
.filter(
(entry) => Boolean(entry.clientBundle) && (registry.isCompatible?.(entry) ?? true),
)
.map((entry) => entry.id);
approvals.reconcileHostPlugins(serverId, promptableIds);
}
registry.installCatalog(serverId, latestCatalog, { ...installationOptions, replacePluginId });
} finally {
applying = false;
}
}
function refresh(replacePluginId?: string) {
refreshQueue = refreshQueue.then(async () => {
refreshQueue = refreshQueue.then(() => {
if (cancelled) return undefined;
registry.setCatalogStatus(serverId, "loading");
await prepareProviderIcons();
if (cancelled) return undefined;
try {
const catalog = await client.getPluginCatalog();
if (!cancelled) {
registry.installCatalog(serverId, catalog, { ...installationOptions, replacePluginId });
return Promise.all([client.getPluginCatalog(), approvals?.load()])
.then(async ([catalog]) => {
if (cancelled) return undefined;
if (
approvals?.getDecidedPluginIds &&
approvals.pruneHostPlugins &&
pluginManagementSupported
) {
const catalogIds = new Set(catalog.map((entry) => entry.id));
const missingDecided = approvals
.getDecidedPluginIds(serverId)
.some((id) => !catalogIds.has(id));
if (missingDecided) {
const installed = await client.listPlugins().catch(() => null);
if (cancelled) return undefined;
if (installed !== null) {
approvals.pruneHostPlugins(
serverId,
installed.map((item) => item.id),
);
}
}
}
latestCatalog = catalog;
applyCatalog(replacePluginId);
registry.setCatalogStatus(serverId, "ready");
}
} catch (error) {
if (!cancelled) {
registry.setCatalogStatus(serverId, "error");
console.warn(`[Plugins] Failed to load catalog for ${serverId}`, error);
}
}
return undefined;
return undefined;
})
.catch((error) => {
if (!cancelled) {
registry.setCatalogStatus(serverId, "error");
console.warn(`[Plugins] Failed to load catalog for ${serverId}`, error);
}
return undefined;
});
});
return refreshQueue;
}
const unsubscribeApprovals = approvals?.subscribe(() => {
applyCatalog();
});
const observation = client.observeEvents([
"status.plugin_catalog_changed",
"status.plugin_settings_changed",
@@ -123,7 +166,8 @@ export function syncPluginCatalog({
});
return () => {
cancelled = true;
abortController.abort();
unsubscribeApprovals?.();
approvals?.clearHostPending(serverId);
void observation
.release()
.catch((error) => console.warn("[Plugins] Failed to release catalog", error));
+12 -4
View File
@@ -4,6 +4,7 @@ import { useQueryClient } from "@tanstack/react-query";
import type { DaemonClient } from "@getpaseo/client/internal/daemon-client";
import { useHostFeature, useHostFeatureAvailability } from "@/runtime/host-features";
import { useHostRuntimeIsConnected } from "@/runtime/host-runtime";
import { pluginExecutionApprovals } from "./execution-approval";
import { pluginListQueryKey } from "./plugin-list";
import { pluginRegistry } from "./registry";
import { syncPluginCatalog } from "./catalog-sync-model";
@@ -18,7 +19,7 @@ export function PluginCatalogSync({
const audio = useVoiceAudioEngineOptional();
const connected = useHostRuntimeIsConnected(serverId);
const supported = useHostFeatureAvailability(serverId, "plugins");
const supportsProviderSnapshots = useHostFeature(serverId, "providersSnapshot");
const pluginManagementSupported = useHostFeature(serverId, "pluginManagement");
const queryClient = useQueryClient();
useEffect(
@@ -29,15 +30,22 @@ export function PluginCatalogSync({
audio,
connected,
supported,
supportsProviderSnapshots,
pluginManagementSupported,
registry: pluginRegistry,
approvals: pluginExecutionApprovals,
onCatalogChanged: () => {
void queryClient.invalidateQueries({ queryKey: pluginListQueryKey(serverId) });
},
}),
[audio, client, connected, queryClient, serverId, supported, supportsProviderSnapshots],
[audio, client, connected, pluginManagementSupported, queryClient, serverId, supported],
);
useEffect(() => () => pluginRegistry.removeHost(serverId), [serverId]);
useEffect(
() => () => {
pluginExecutionApprovals.clearHostPending(serverId);
pluginRegistry.removeHost(serverId);
},
[serverId],
);
return null;
}
+2 -2
View File
@@ -798,10 +798,10 @@ describe("evaluatePluginClientBundle", () => {
const plugin = evaluatePluginClientBundle(
"example",
`(function(require) {
const { Icon, ProviderIcon, Modal, useToast, SettingsSection, SidebarRow, StreamedText } = require("@getpaseo/plugin/client/ui");
const { Icon, Modal, useToast, SettingsSection, SidebarRow, StreamedText } = require("@getpaseo/plugin/client/ui");
const module = { exports: {} };
module.exports.default = function(plugin) {
if (typeof Icon !== "function" || typeof ProviderIcon !== "function" || typeof Modal !== "function" || typeof Modal.Content !== "function" || typeof useToast !== "function" || typeof SettingsSection !== "function" || typeof SidebarRow !== "function" || typeof StreamedText !== "function") {
if (typeof Icon !== "function" || typeof Modal !== "function" || typeof Modal.Content !== "function" || typeof useToast !== "function" || typeof SettingsSection !== "function" || typeof SidebarRow !== "function" || typeof StreamedText !== "function") {
throw new Error("React Native plugin UI is incomplete");
}
plugin.addSurface("main", function Surface() { return null; });
@@ -0,0 +1,55 @@
import AsyncStorage from "@react-native-async-storage/async-storage";
import { useCallback, useEffect, useSyncExternalStore } from "react";
import type { PluginExecutionDecision } from "./storage";
import {
PluginExecutionApprovals,
type PluginExecutionApprovalQueueState,
type PluginExecutionApprovalRequest,
} from "./store";
export type {
PluginExecutionApprovalQueueState,
PluginExecutionApprovalRequest,
PluginExecutionDecision,
};
export { PluginExecutionApprovals };
export const pluginExecutionApprovals = new PluginExecutionApprovals(AsyncStorage);
export function usePluginExecutionApprovalQueue(): PluginExecutionApprovalQueueState {
return useSyncExternalStore(
pluginExecutionApprovals.subscribe,
pluginExecutionApprovals.getQueueState,
pluginExecutionApprovals.getQueueState,
);
}
/**
* Returns whether per-plugin client execution prompts are bypassed on this device,
* or `null` while storage hydration is still in flight.
*/
export function usePluginExecutionApprovalBypass(): boolean | null {
useEffect(() => {
void pluginExecutionApprovals.load();
}, []);
return useSyncExternalStore(
pluginExecutionApprovals.subscribe,
pluginExecutionApprovals.getBypassState,
pluginExecutionApprovals.getBypassState,
);
}
/**
* Returns the active per-plugin decision enforced on this device, or `null` when
* unreviewed or when per-plugin approval prompts are bypassed on this device.
*/
export function usePluginExecutionDecision(
serverId: string,
pluginId: string,
): PluginExecutionDecision | null {
const read = useCallback(
() => pluginExecutionApprovals.getEffectiveDecision(serverId, pluginId),
[pluginId, serverId],
);
return useSyncExternalStore(pluginExecutionApprovals.subscribe, read, read);
}
@@ -0,0 +1,180 @@
import { useCallback, useMemo, useState } from "react";
import { Text, View } from "react-native";
import { StyleSheet } from "react-native-unistyles";
import { useTranslation } from "react-i18next";
import { AdaptiveModalSheet, type SheetHeader } from "@/components/adaptive-modal-sheet";
import { Button } from "@/components/ui/button";
import { usePluginDisplayName } from "@/plugins/plugin-list";
import { useHosts } from "@/runtime/host-runtime";
import { settingsStyles } from "@/styles/settings";
import {
pluginExecutionApprovals,
usePluginExecutionApprovalQueue,
type PluginExecutionApprovalQueueState,
} from "./index";
/**
* Shows the sequential client plugin execution prompt queue. Mount once at the app root.
*
* Keeps one `<AdaptiveModalSheet>` mounted across queued items so advancing from one plugin to
* the next swaps details in place without flickering the backdrop or dismissing/re-presenting
* native bottom sheets.
*/
export function PluginExecutionApprovalSheet() {
const { t } = useTranslation();
const queue = usePluginExecutionApprovalQueue();
const hosts = useHosts();
// Retain the last visible prompt during the sheet's exit animation so closing never blanks mid-fade.
const [retained, setRetained] = useState<PluginExecutionApprovalQueueState | null>(null);
if (queue.current !== null && retained !== queue) {
setRetained(queue);
}
const displayed = queue.current !== null ? queue : retained;
const request = displayed?.current ?? null;
const visible = queue.current !== null;
const displayName = usePluginDisplayName(
request ? { serverId: request.serverId, pluginId: request.pluginId } : null,
);
const hostLabel = request
? (hosts.find((host) => host.serverId === request.serverId)?.label ?? request.serverId)
: "";
const requestId = request?.id ?? null;
const allow = useCallback(() => {
if (requestId !== null) {
pluginExecutionApprovals.answer(requestId, "approved");
}
}, [requestId]);
const decline = useCallback(() => {
if (requestId !== null) {
pluginExecutionApprovals.answer(requestId, "declined");
}
}, [requestId]);
const dismiss = useCallback(() => {
pluginExecutionApprovals.dismissQueue();
}, []);
const handleDismiss = useCallback(() => {
setRetained(null);
}, []);
const progressText =
displayed && displayed.totalInBatch > 1
? t("settings.plugins.clientExecution.queueProgress", {
step: displayed.step,
total: displayed.totalInBatch,
})
: null;
const header = useMemo<SheetHeader>(
() => ({
title: t("settings.plugins.clientExecution.promptTitle"),
actions: progressText ? (
<Text style={styles.progress} testID="plugin-execution-approval-progress">
{progressText}
</Text>
) : undefined,
}),
[progressText, t],
);
return (
<AdaptiveModalSheet
header={header}
visible={visible}
onClose={dismiss}
onDismiss={handleDismiss}
testID="plugin-execution-approval"
>
{request ? (
<>
<Text style={styles.confirmText}>
{t("settings.plugins.clientExecution.promptDescription")}
</Text>
<View style={settingsStyles.card}>
<DetailRow
label={t("settings.plugins.clientExecution.pluginLabel")}
value={formatPluginIdentity(displayName, request.pluginId)}
testID="plugin-execution-approval-plugin"
/>
<DetailRow
label={t("settings.plugins.clientExecution.hostLabel")}
value={formatHostIdentity(hostLabel, request.serverId)}
testID="plugin-execution-approval-host"
showBorder
/>
</View>
<View style={styles.confirmActions}>
<Button
variant="secondary"
style={FLEX_1_STYLE}
onPress={decline}
testID="plugin-execution-approval-decline"
>
{t("settings.plugins.clientExecution.decline")}
</Button>
<Button
variant="default"
style={FLEX_1_STYLE}
onPress={allow}
testID="plugin-execution-approval-allow"
>
{t("settings.plugins.clientExecution.allow")}
</Button>
</View>
</>
) : null}
</AdaptiveModalSheet>
);
}
function formatPluginIdentity(displayName: string | undefined, pluginId: string): string {
if (!displayName || displayName === pluginId) return pluginId;
return `${displayName} (${pluginId})`;
}
function formatHostIdentity(label: string, serverId: string): string {
return label === serverId ? serverId : `${label} (${serverId})`;
}
function DetailRow({
label,
value,
showBorder = false,
testID,
}: {
label: string;
value: string;
showBorder?: boolean;
testID?: string;
}) {
return (
<View style={[settingsStyles.row, showBorder && settingsStyles.rowBorder]}>
<View style={settingsStyles.rowContent}>
<Text style={settingsStyles.rowTitle}>{label}</Text>
<Text style={settingsStyles.rowHint} numberOfLines={1} selectable testID={testID}>
{value}
</Text>
</View>
</View>
);
}
const styles = StyleSheet.create((theme) => ({
progress: {
color: theme.colors.foregroundMuted,
fontSize: theme.fontSize.sm,
},
confirmText: {
color: theme.colors.foregroundMuted,
fontSize: theme.fontSize.base,
},
confirmActions: {
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[2],
marginTop: theme.spacing[4],
},
}));
const FLEX_1_STYLE = { flex: 1 };
@@ -0,0 +1,64 @@
import { z } from "zod";
import { readValidatedJson, type ValidatedStorage } from "@/storage/validated-storage";
export const PLUGIN_EXECUTION_APPROVALS_STORAGE_KEY = "@paseo:plugin-execution-approvals";
export const PLUGIN_EXECUTION_BYPASS_STORAGE_KEY = "@paseo:plugin-execution-approval-bypass";
export const PluginExecutionDecisionSchema = z.enum(["approved", "declined"]);
export type PluginExecutionDecision = z.infer<typeof PluginExecutionDecisionSchema>;
const StoredPluginExecutionApprovalsSchema = z.record(
z.string().min(1),
z.record(z.string().min(1), PluginExecutionDecisionSchema),
);
const StoredPluginExecutionBypassSchema = z.boolean();
export type StoredPluginExecutionApprovals = z.infer<typeof StoredPluginExecutionApprovalsSchema>;
export interface PluginExecutionApprovalStorage extends ValidatedStorage {
setItem(key: string, value: string): Promise<void>;
}
export async function loadPluginExecutionApprovals(
storage: PluginExecutionApprovalStorage,
): Promise<StoredPluginExecutionApprovals> {
const stored = await readValidatedJson(
storage,
PLUGIN_EXECUTION_APPROVALS_STORAGE_KEY,
StoredPluginExecutionApprovalsSchema,
);
return stored ?? {};
}
export async function savePluginExecutionApprovals(
storage: PluginExecutionApprovalStorage,
approvals: StoredPluginExecutionApprovals,
): Promise<void> {
if (Object.keys(approvals).length === 0) {
await storage.removeItem(PLUGIN_EXECUTION_APPROVALS_STORAGE_KEY);
return;
}
await storage.setItem(PLUGIN_EXECUTION_APPROVALS_STORAGE_KEY, JSON.stringify(approvals));
}
export async function loadPluginExecutionBypass(
storage: PluginExecutionApprovalStorage,
): Promise<boolean> {
const stored = await readValidatedJson(
storage,
PLUGIN_EXECUTION_BYPASS_STORAGE_KEY,
StoredPluginExecutionBypassSchema,
);
return stored ?? false;
}
export async function savePluginExecutionBypass(
storage: PluginExecutionApprovalStorage,
bypass: boolean,
): Promise<void> {
if (!bypass) {
await storage.removeItem(PLUGIN_EXECUTION_BYPASS_STORAGE_KEY);
return;
}
await storage.setItem(PLUGIN_EXECUTION_BYPASS_STORAGE_KEY, JSON.stringify(true));
}
@@ -0,0 +1,405 @@
import { describe, expect, it } from "vitest";
import { PluginExecutionApprovals } from "./store";
import type { PluginExecutionApprovalStorage } from "./storage";
class MemoryStorage implements PluginExecutionApprovalStorage {
readonly values = new Map<string, string>();
writes = 0;
async getItem(key: string): Promise<string | null> {
return this.values.get(key) ?? null;
}
async setItem(key: string, value: string): Promise<void> {
this.writes += 1;
this.values.set(key, value);
}
async removeItem(key: string): Promise<void> {
this.values.delete(key);
}
}
describe("PluginExecutionApprovals", () => {
it("fails closed before storage hydrates and loads persisted decisions once hydrated", async () => {
const storage = new MemoryStorage();
const first = new PluginExecutionApprovals(storage);
await first.load();
first.reconcileHostPlugins("host-a", ["alpha", "beta"]);
first.answer(first.getQueueState().current!.id, "approved");
first.answer(first.getQueueState().current!.id, "declined");
await first.flushPersistence();
const reloaded = new PluginExecutionApprovals(storage);
expect(reloaded.isHydrated()).toBe(false);
expect(reloaded.isApproved("host-a", "alpha")).toBe(false);
await reloaded.load();
expect(reloaded.isHydrated()).toBe(true);
expect(reloaded.isApproved("host-a", "alpha")).toBe(true);
expect(reloaded.getDecision("host-a", "alpha")).toBe("approved");
expect(reloaded.getDecision("host-a", "beta")).toBe("declined");
expect(reloaded.isApproved("host-b", "alpha")).toBe(false);
// Reconciling already-decided plugins does not enqueue any prompts.
reloaded.reconcileHostPlugins("host-a", ["alpha", "beta"]);
expect(reloaded.getQueueState().current).toBeNull();
});
it("queues stacked plugins sequentially, tracks batch progress, and ignores stale request IDs", async () => {
const storage = new MemoryStorage();
const approvals = new PluginExecutionApprovals(storage);
await approvals.load();
approvals.reconcileHostPlugins("host-a", ["alpha", "beta", "gamma"]);
const firstState = approvals.getQueueState();
expect(firstState.current).toMatchObject({ serverId: "host-a", pluginId: "alpha" });
expect(firstState.step).toBe(1);
expect(firstState.totalInBatch).toBe(3);
expect(firstState.pendingCount).toBe(3);
// Stable snapshot reference when nothing changed.
expect(approvals.getQueueState()).toBe(firstState);
const firstId = firstState.current!.id;
// Duplicate reconciliation does not duplicate queued items.
approvals.reconcileHostPlugins("host-a", ["alpha", "beta", "gamma"]);
expect(approvals.getQueueState().pendingCount).toBe(3);
// Answer the first item.
approvals.answer(firstId, "approved");
const secondState = approvals.getQueueState();
expect(secondState.current).toMatchObject({ serverId: "host-a", pluginId: "beta" });
expect(secondState.step).toBe(2);
expect(secondState.totalInBatch).toBe(3);
expect(approvals.isApproved("host-a", "alpha")).toBe(true);
expect(approvals.isApproved("host-a", "beta")).toBe(false);
// Re-answering the stale first request ID must NOT answer beta!
approvals.answer(firstId, "approved");
expect(approvals.getQueueState().current?.pluginId).toBe("beta");
expect(approvals.getDecision("host-a", "beta")).toBeNull();
// Decline beta, then approve gamma.
approvals.answer(secondState.current!.id, "declined");
expect(approvals.getDecision("host-a", "beta")).toBe("declined");
expect(approvals.getQueueState()).toMatchObject({
current: { serverId: "host-a", pluginId: "gamma" },
step: 3,
totalInBatch: 3,
pendingCount: 1,
});
approvals.answer(approvals.getQueueState().current!.id, "approved");
expect(approvals.getQueueState()).toEqual({
current: null,
step: 0,
totalInBatch: 0,
pendingCount: 0,
});
});
it("isolates approvals per host and supports multi-host queued prompts", async () => {
const storage = new MemoryStorage();
const approvals = new PluginExecutionApprovals(storage);
await approvals.load();
approvals.reconcileHostPlugins("host-a", ["shared-plugin"]);
approvals.reconcileHostPlugins("host-b", ["shared-plugin"]);
expect(approvals.getQueueState()).toMatchObject({
current: { serverId: "host-a", pluginId: "shared-plugin" },
step: 1,
totalInBatch: 2,
});
approvals.answer(approvals.getQueueState().current!.id, "approved");
expect(approvals.isApproved("host-a", "shared-plugin")).toBe(true);
expect(approvals.isApproved("host-b", "shared-plugin")).toBe(false);
expect(approvals.getQueueState()).toMatchObject({
current: { serverId: "host-b", pluginId: "shared-plugin" },
step: 2,
totalInBatch: 2,
});
});
it("dismisses the active queue by declining remaining prompts cleanly", async () => {
const storage = new MemoryStorage();
const approvals = new PluginExecutionApprovals(storage);
await approvals.load();
approvals.reconcileHostPlugins("host-a", ["alpha", "beta", "gamma"]);
approvals.answer(approvals.getQueueState().current!.id, "approved");
approvals.dismissQueue();
expect(approvals.getQueueState()).toEqual({
current: null,
step: 0,
totalInBatch: 0,
pendingCount: 0,
});
expect(approvals.getDecision("host-a", "alpha")).toBe("approved");
expect(approvals.getDecision("host-a", "beta")).toBe("declined");
expect(approvals.getDecision("host-a", "gamma")).toBe("declined");
});
it("prunes stale queued prompts when plugins disappear or a host disconnects", async () => {
const storage = new MemoryStorage();
const approvals = new PluginExecutionApprovals(storage);
await approvals.load();
approvals.reconcileHostPlugins("host-a", ["alpha", "beta"]);
approvals.reconcileHostPlugins("host-b", ["gamma"]);
expect(approvals.getQueueState().totalInBatch).toBe(3);
// beta removed from host-a while alpha is showing.
approvals.reconcileHostPlugins("host-a", ["alpha"]);
expect(approvals.getQueueState()).toMatchObject({
current: { serverId: "host-a", pluginId: "alpha" },
step: 1,
totalInBatch: 2,
pendingCount: 2,
});
// host-a disconnects: its pending prompts are dropped, host-b's stays.
approvals.clearHostPending("host-a");
expect(approvals.getQueueState()).toMatchObject({
current: { serverId: "host-b", pluginId: "gamma" },
step: 1,
totalInBatch: 1,
pendingCount: 1,
});
});
it("clears persisted decisions and pending prompts on host trust reset or plugin removal", async () => {
const storage = new MemoryStorage();
const approvals = new PluginExecutionApprovals(storage);
await approvals.load();
approvals.setDecision("host-a", "alpha", "approved");
approvals.setDecision("host-a", "beta", "declined");
approvals.setDecision("host-b", "alpha", "approved");
approvals.reconcileHostPlugins("host-a", ["gamma"]);
approvals.clearPlugin("host-a", "beta");
expect(approvals.getDecision("host-a", "beta")).toBeNull();
expect(approvals.getDecision("host-a", "alpha")).toBe("approved");
approvals.clearHost("host-a");
expect(approvals.getDecision("host-a", "alpha")).toBeNull();
expect(approvals.getQueueState().current).toBeNull();
expect(approvals.getDecision("host-b", "alpha")).toBe("approved");
await approvals.flushPersistence();
const reloaded = new PluginExecutionApprovals(storage);
await reloaded.load();
expect(reloaded.getDecision("host-a", "alpha")).toBeNull();
expect(reloaded.getDecision("host-b", "alpha")).toBe("approved");
});
it("fails closed and clears corrupt persisted data", async () => {
const storage = new MemoryStorage();
storage.values.set("@paseo:plugin-execution-approvals", "{not valid json");
const approvals = new PluginExecutionApprovals(storage);
await approvals.load();
expect(approvals.isHydrated()).toBe(true);
expect(approvals.isApproved("host-a", "alpha")).toBe(false);
expect(storage.values.has("@paseo:plugin-execution-approvals")).toBe(false);
});
it("preserves mutations made while storage hydration is still in flight", async () => {
const deferred = Promise.withResolvers<string | null>();
const storage: PluginExecutionApprovalStorage = {
getItem: () => deferred.promise,
setItem: async () => undefined,
removeItem: async () => undefined,
};
const approvals = new PluginExecutionApprovals(storage);
const loading = approvals.load();
approvals.setDecision("host-a", "alpha", "declined");
approvals.clearHost("host-b");
deferred.resolve(
JSON.stringify({
"host-a": { alpha: "approved", gamma: "approved" },
"host-b": { beta: "approved" },
}),
);
await loading;
expect(approvals.getDecision("host-a", "alpha")).toBe("declined");
expect(approvals.getDecision("host-a", "gamma")).toBe("approved");
expect(approvals.getDecision("host-b", "beta")).toBeNull();
});
it("prunes uninstalled plugins while keeping disabled plugins that remain listed", async () => {
const storage = new MemoryStorage();
const approvals = new PluginExecutionApprovals(storage);
await approvals.load();
approvals.setDecision("host-a", "alpha", "approved");
approvals.setDecision("host-a", "disabled-plugin", "declined");
approvals.setDecision("host-b", "alpha", "approved");
expect(approvals.getDecidedPluginIds("host-a").sort()).toEqual(["alpha", "disabled-plugin"]);
// alpha was uninstalled; disabled-plugin is still listed on the host.
approvals.pruneHostPlugins("host-a", ["disabled-plugin"]);
expect(approvals.getDecision("host-a", "alpha")).toBeNull();
expect(approvals.getDecision("host-a", "disabled-plugin")).toBe("declined");
expect(approvals.getDecision("host-b", "alpha")).toBe("approved");
await approvals.flushPersistence();
const reloaded = new PluginExecutionApprovals(storage);
await reloaded.load();
expect(reloaded.getDecision("host-a", "alpha")).toBeNull();
expect(reloaded.getDecision("host-a", "disabled-plugin")).toBe("declined");
});
it("supports bypassing approval prompts, dismisses pending prompts without declining them, and restores enforcement when turned off", async () => {
const storage = new MemoryStorage();
const approvals = new PluginExecutionApprovals(storage);
expect(approvals.getBypassState()).toBeNull();
expect(approvals.isBypassEnabled()).toBe(false);
await approvals.load();
expect(approvals.getBypassState()).toBe(false);
expect(approvals.isBypassEnabled()).toBe(false);
approvals.setDecision("host-a", "approved-plugin", "approved");
approvals.setDecision("host-a", "declined-plugin", "declined");
approvals.reconcileHostPlugins("host-a", [
"approved-plugin",
"declined-plugin",
"pending-plugin",
]);
expect(approvals.getQueueState().current?.pluginId).toBe("pending-plugin");
// Enabling bypass dismisses the pending queue cleanly without marking pending plugins declined.
approvals.setBypassEnabled(true);
expect(approvals.getBypassState()).toBe(true);
expect(approvals.isBypassEnabled()).toBe(true);
expect(approvals.getQueueState().current).toBeNull();
expect(approvals.getDecision("host-a", "pending-plugin")).toBeNull();
expect(approvals.getDecision("host-a", "declined-plugin")).toBe("declined");
expect(approvals.getEffectiveDecision("host-a", "declined-plugin")).toBeNull();
expect(approvals.getEffectiveDecision("host-a", "approved-plugin")).toBeNull();
expect(approvals.isApproved("host-a", "approved-plugin")).toBe(true);
expect(approvals.isApproved("host-a", "declined-plugin")).toBe(true);
expect(approvals.isApproved("host-a", "pending-plugin")).toBe(true);
// Reconciling new unreviewed plugins while bypass is on does not enqueue prompts.
approvals.reconcileHostPlugins("host-a", ["approved-plugin", "pending-plugin", "new-plugin"]);
expect(approvals.getQueueState().current).toBeNull();
// Bypass persists across reloads and fails closed until storage hydrates.
await approvals.flushPersistence();
const reloaded = new PluginExecutionApprovals(storage);
expect(reloaded.getBypassState()).toBeNull();
expect(reloaded.isApproved("host-a", "pending-plugin")).toBe(false);
await reloaded.load();
expect(reloaded.getBypassState()).toBe(true);
expect(reloaded.isBypassEnabled()).toBe(true);
expect(reloaded.isApproved("host-a", "pending-plugin")).toBe(true);
expect(reloaded.isApproved("host-a", "declined-plugin")).toBe(true);
// Turning bypass off restores per-host, per-plugin enforcement and preserves saved decisions.
reloaded.setBypassEnabled(false);
expect(reloaded.getBypassState()).toBe(false);
expect(reloaded.getEffectiveDecision("host-a", "approved-plugin")).toBe("approved");
expect(reloaded.getEffectiveDecision("host-a", "declined-plugin")).toBe("declined");
expect(reloaded.isApproved("host-a", "approved-plugin")).toBe(true);
expect(reloaded.isApproved("host-a", "declined-plugin")).toBe(false);
expect(reloaded.isApproved("host-a", "pending-plugin")).toBe(false);
reloaded.reconcileHostPlugins("host-a", [
"approved-plugin",
"declined-plugin",
"pending-plugin",
]);
expect(reloaded.getQueueState().current?.pluginId).toBe("pending-plugin");
await reloaded.flushPersistence();
const reloadedOff = new PluginExecutionApprovals(storage);
await reloadedOff.load();
expect(reloadedOff.isBypassEnabled()).toBe(false);
expect(reloadedOff.isApproved("host-a", "approved-plugin")).toBe(true);
expect(reloadedOff.isApproved("host-a", "pending-plugin")).toBe(false);
});
it("fails closed on corrupt bypass storage and preserves pre-hydration bypass edits", async () => {
const storage = new MemoryStorage();
storage.values.set(
"@paseo:plugin-execution-approvals",
JSON.stringify({ "host-a": { alpha: "approved" } }),
);
storage.values.set("@paseo:plugin-execution-approval-bypass", "{bad json");
const approvals = new PluginExecutionApprovals(storage);
await approvals.load();
expect(approvals.isBypassEnabled()).toBe(false);
expect(approvals.isApproved("host-a", "alpha")).toBe(true);
expect(storage.values.has("@paseo:plugin-execution-approval-bypass")).toBe(false);
// Pre-hydration toggle wins over older stored value.
const deferred = Promise.withResolvers<string | null>();
const asyncStorage: PluginExecutionApprovalStorage = {
getItem: async (key) =>
key === "@paseo:plugin-execution-approval-bypass" ? deferred.promise : null,
setItem: async () => undefined,
removeItem: async () => undefined,
};
const racing = new PluginExecutionApprovals(asyncStorage);
const loading = racing.load();
racing.setBypassEnabled(true);
expect(racing.getBypassState()).toBe(true);
expect(racing.isApproved("host-a", "beta")).toBe(true);
deferred.resolve(JSON.stringify(false));
await loading;
expect(racing.isBypassEnabled()).toBe(true);
expect(racing.isApproved("host-a", "beta")).toBe(true);
});
it("rolls back turning bypass on and surfaces errors when bypass persistence fails", async () => {
let failSet = true;
let failRemove = true;
const values = new Map<string, string>();
const flakyStorage: PluginExecutionApprovalStorage = {
getItem: async (key) => values.get(key) ?? null,
setItem: async (key, value) => {
if (failSet) throw new Error("disk full");
values.set(key, value);
},
removeItem: async (key) => {
if (failRemove) throw new Error("io error");
values.delete(key);
},
};
const approvals = new PluginExecutionApprovals(flakyStorage);
await approvals.load();
// Turning ON rolls back to fail-closed when persistence fails.
await expect(approvals.setBypassEnabled(true)).rejects.toThrow("disk full");
expect(approvals.isBypassEnabled()).toBe(false);
expect(approvals.isApproved("host-a", "alpha")).toBe(false);
// Turning ON succeeds once storage recovers.
failSet = false;
await expect(approvals.setBypassEnabled(true)).resolves.toBeUndefined();
expect(approvals.isBypassEnabled()).toBe(true);
expect(values.get("@paseo:plugin-execution-approval-bypass")).toBe("true");
// Turning OFF enforces fail-closed in memory even when removeItem fails, and surfaces the error for retry.
await expect(approvals.setBypassEnabled(false)).rejects.toThrow("io error");
expect(approvals.isBypassEnabled()).toBe(false);
expect(approvals.isApproved("host-a", "alpha")).toBe(false);
// Retrying OFF succeeds and clears persisted bypass once storage recovers.
failRemove = false;
await expect(approvals.setBypassEnabled(false)).resolves.toBeUndefined();
expect(values.has("@paseo:plugin-execution-approval-bypass")).toBe(false);
});
});
@@ -0,0 +1,437 @@
import {
loadPluginExecutionApprovals,
loadPluginExecutionBypass,
savePluginExecutionApprovals,
savePluginExecutionBypass,
type PluginExecutionApprovalStorage,
type PluginExecutionDecision,
type StoredPluginExecutionApprovals,
} from "./storage";
export interface PluginExecutionApprovalRequest {
/** Monotonic ID so an answer for an older prompt can never answer a newer one. */
id: number;
serverId: string;
pluginId: string;
}
export interface PluginExecutionApprovalQueueState {
/** The prompt currently at the front of the queue, or null when idle. */
current: PluginExecutionApprovalRequest | null;
/** Number of prompts waiting in the queue, including `current`. */
pendingCount: number;
/** 1-based position in the active review batch, or 0 when idle. */
step: number;
/** Total prompts in the active review batch, or 0 when idle. */
totalInBatch: number;
}
const IDLE_QUEUE_STATE: PluginExecutionApprovalQueueState = {
current: null,
pendingCount: 0,
step: 0,
totalInBatch: 0,
};
function pluginKey(serverId: string, pluginId: string): string {
return `${serverId}\0${pluginId}`;
}
/**
* Owns per-host client plugin execution consent and the sequential review queue.
*
* Decisions persist across reloads and reconnects keyed by `(serverId, pluginId)`.
* Unreviewed and unhydrated entries fail closed so no client bundle can execute
* before explicit user approval.
*/
export class PluginExecutionApprovals {
private readonly decisions = new Map<string, Map<string, PluginExecutionDecision>>();
private readonly queue: PluginExecutionApprovalRequest[] = [];
private readonly listeners = new Set<() => void>();
private queueState: PluginExecutionApprovalQueueState = IDLE_QUEUE_STATE;
private nextRequestId = 1;
private completedInBatch = 0;
private hydrated = false;
private bypass = false;
private loadPromise: Promise<void> | null = null;
/** Local edits recorded before storage hydration finishes win over older stored entries. */
private readonly preHydrationOverrides = new Map<string, PluginExecutionDecision | null>();
private readonly preHydrationClearedHosts = new Set<string>();
private preHydrationBypass: boolean | null = null;
private persistChain: Promise<void> = Promise.resolve();
private persistPending = false;
private bypassPersistChain: Promise<void> = Promise.resolve();
private bypassWriteGeneration = 0;
private bypassPersistDirty = false;
constructor(private readonly storage: PluginExecutionApprovalStorage) {}
subscribe = (listener: () => void): (() => void) => {
this.listeners.add(listener);
return () => {
this.listeners.delete(listener);
};
};
isHydrated(): boolean {
return this.hydrated;
}
load(): Promise<void> {
if (this.hydrated) return Promise.resolve();
this.loadPromise ??= this.hydrate();
return this.loadPromise;
}
getQueueState = (): PluginExecutionApprovalQueueState => this.queueState;
isBypassEnabled(): boolean {
return this.bypass;
}
/** Returns `null` before storage hydrates unless modified locally so switches avoid flashing. */
getBypassState = (): boolean | null =>
!this.hydrated && this.preHydrationBypass === null ? null : this.bypass;
setBypassEnabled(enabled: boolean): Promise<void> {
const previous = this.bypass;
const recordedPreHydration = !this.hydrated && this.preHydrationBypass !== enabled;
if (!this.hydrated) {
this.preHydrationBypass = enabled;
}
this.bypass = enabled;
const removedPending = enabled ? this.pruneQueue(() => true) : false;
if (
previous === enabled &&
!removedPending &&
!recordedPreHydration &&
!this.bypassPersistDirty
) {
return Promise.resolve();
}
this.publish();
const generation = ++this.bypassWriteGeneration;
const run = this.bypassPersistChain.then(async () => {
if (generation !== this.bypassWriteGeneration) return undefined;
await savePluginExecutionBypass(this.storage, enabled);
if (generation === this.bypassWriteGeneration) {
this.bypassPersistDirty = false;
}
return undefined;
});
this.bypassPersistChain = run.catch(() => undefined);
return run.catch((error) => {
console.warn("[Plugins] Failed to save client execution approval bypass", error);
if (generation === this.bypassWriteGeneration) {
if (enabled) {
// Enabling bypass failed to persist; roll back to fail-closed.
this.bypass = false;
if (!this.hydrated) {
this.preHydrationBypass = false;
}
this.bypassPersistDirty = false;
this.publish();
} else {
// Disabling bypass stays enforced in memory; mark dirty so a retry persists cleanly.
this.bypassPersistDirty = true;
}
}
throw error;
});
}
getDecision(serverId: string, pluginId: string): PluginExecutionDecision | null {
return this.decisions.get(serverId)?.get(pluginId) ?? null;
}
getEffectiveDecision(serverId: string, pluginId: string): PluginExecutionDecision | null {
return this.bypass ? null : this.getDecision(serverId, pluginId);
}
getDecidedPluginIds(serverId: string): string[] {
const hostMap = this.decisions.get(serverId);
return hostMap ? [...hostMap.keys()] : [];
}
isApproved(serverId: string, pluginId: string): boolean {
if (!this.hydrated) {
if (this.preHydrationBypass === true) {
return true;
}
if (!this.preHydrationOverrides.has(pluginKey(serverId, pluginId))) {
return false;
}
return this.getDecision(serverId, pluginId) === "approved";
}
if (this.bypass) {
return true;
}
return this.getDecision(serverId, pluginId) === "approved";
}
/**
* Aligns queued prompts for `serverId` with the host's current compatible client plugins.
* Plugins no longer present are pruned; unreviewed plugins are enqueued in arrival order.
*/
reconcileHostPlugins(serverId: string, pluginIds: readonly string[]): void {
if (!this.hydrated) return;
if (this.bypass) {
if (this.pruneQueue((item) => item.serverId === serverId)) {
this.publish();
}
return;
}
const activeIds = new Set(pluginIds);
let changed = this.pruneQueue(
(item) => item.serverId === serverId && !activeIds.has(item.pluginId),
);
for (const pluginId of pluginIds) {
if (this.getDecision(serverId, pluginId) !== null) continue;
if (this.queue.some((item) => item.serverId === serverId && item.pluginId === pluginId)) {
continue;
}
this.queue.push({ id: this.nextRequestId++, serverId, pluginId });
changed = true;
}
if (changed) {
this.publish();
}
}
/** Answers the active prompt with `requestId`; answers for any other ID are ignored. */
answer(requestId: number, decision: PluginExecutionDecision): void {
const current = this.queue[0];
if (!current || current.id !== requestId) return;
this.queue.shift();
if (this.queue.length > 0) {
this.completedInBatch += 1;
} else {
this.completedInBatch = 0;
}
this.recordDecision(current.serverId, current.pluginId, decision);
this.schedulePersist();
this.publish();
}
/**
* Declines every remaining queued prompt and empties the queue so dismissing the
* modal or bottom sheet always closes cleanly on every platform.
*/
dismissQueue(): void {
if (this.queue.length === 0) return;
const remaining = this.queue.splice(0);
this.completedInBatch = 0;
for (const item of remaining) {
this.recordDecision(item.serverId, item.pluginId, "declined");
}
this.schedulePersist();
this.publish();
}
/** Directly records a user decision (e.g. Allow or Block from Settings -> Plugins). */
setDecision(serverId: string, pluginId: string, decision: PluginExecutionDecision): void {
const previous = this.getDecision(serverId, pluginId);
const removedPending = this.pruneQueue(
(item) => item.serverId === serverId && item.pluginId === pluginId,
);
if (previous === decision && !removedPending) return;
this.recordDecision(serverId, pluginId, decision);
this.schedulePersist();
this.publish();
}
/** Clears a plugin's saved decision and any pending prompt (e.g. after explicit uninstall). */
clearPlugin(serverId: string, pluginId: string): void {
const hadDecision = this.removeDecision(serverId, pluginId);
const removedPending = this.pruneQueue(
(item) => item.serverId === serverId && item.pluginId === pluginId,
);
if (!hadDecision && !removedPending) return;
this.schedulePersist();
this.publish();
}
/**
* Clears saved decisions and pending prompts for plugins no longer present in the host's
* installed plugin list (e.g. uninstalled via CLI or another client). Disabled plugins stay
* in `installedPluginIds` and keep their decisions.
*/
pruneHostPlugins(serverId: string, installedPluginIds: readonly string[]): void {
if (!this.hydrated) return;
const installed = new Set(installedPluginIds);
let hadDecision = false;
const hostMap = this.decisions.get(serverId);
if (hostMap) {
for (const pluginId of hostMap.keys()) {
if (!installed.has(pluginId) && this.removeDecision(serverId, pluginId)) {
hadDecision = true;
}
}
}
const removedPending = this.pruneQueue(
(item) => item.serverId === serverId && !installed.has(item.pluginId),
);
if (!hadDecision && !removedPending) return;
this.schedulePersist();
this.publish();
}
/** Drops transient queued prompts for a disconnected or unmounted host without forgetting trust. */
clearHostPending(serverId: string): void {
if (!this.pruneQueue((item) => item.serverId === serverId)) return;
this.publish();
}
/** Clears all persisted decisions and pending prompts for a removed or re-keyed host. */
clearHost(serverId: string): void {
if (!this.hydrated) {
this.preHydrationClearedHosts.add(serverId);
for (const key of this.preHydrationOverrides.keys()) {
if (key.startsWith(`${serverId}\0`)) {
this.preHydrationOverrides.delete(key);
}
}
}
const hadDecisions = this.decisions.delete(serverId);
const removedPending = this.pruneQueue((item) => item.serverId === serverId);
if (!hadDecisions && !removedPending) return;
this.schedulePersist();
this.publish();
}
/** Waits for any queued storage writes to settle; useful in tests. */
flushPersistence(): Promise<void> {
return Promise.all([this.persistChain, this.bypassPersistChain]).then(() => undefined);
}
private async hydrate(): Promise<void> {
const [loaded, loadedBypass] = await Promise.all([
loadPluginExecutionApprovals(this.storage).catch((error) => {
console.warn("[Plugins] Failed to load client execution approvals", error);
return {} as StoredPluginExecutionApprovals;
}),
loadPluginExecutionBypass(this.storage).catch((error) => {
console.warn("[Plugins] Failed to load client execution approval bypass", error);
return false;
}),
]);
for (const [serverId, entries] of Object.entries(loaded)) {
if (this.preHydrationClearedHosts.has(serverId)) continue;
for (const [pluginId, decision] of Object.entries(entries)) {
if (this.preHydrationOverrides.has(pluginKey(serverId, pluginId))) continue;
this.writeDecisionToMap(serverId, pluginId, decision);
}
}
this.bypass = this.preHydrationBypass ?? loadedBypass;
const hadPreHydrationDecisionEdits =
this.preHydrationOverrides.size > 0 || this.preHydrationClearedHosts.size > 0;
this.preHydrationOverrides.clear();
this.preHydrationClearedHosts.clear();
this.preHydrationBypass = null;
if (this.bypass) {
this.pruneQueue(() => true);
}
this.hydrated = true;
if (hadPreHydrationDecisionEdits) {
this.schedulePersist();
}
this.publish();
}
private recordDecision(
serverId: string,
pluginId: string,
decision: PluginExecutionDecision,
): void {
if (!this.hydrated) {
this.preHydrationOverrides.set(pluginKey(serverId, pluginId), decision);
}
this.writeDecisionToMap(serverId, pluginId, decision);
}
private writeDecisionToMap(
serverId: string,
pluginId: string,
decision: PluginExecutionDecision,
): void {
let hostMap = this.decisions.get(serverId);
if (!hostMap) {
hostMap = new Map();
this.decisions.set(serverId, hostMap);
}
hostMap.set(pluginId, decision);
}
private removeDecision(serverId: string, pluginId: string): boolean {
if (!this.hydrated) {
this.preHydrationOverrides.set(pluginKey(serverId, pluginId), null);
}
const hostMap = this.decisions.get(serverId);
if (!hostMap || !hostMap.delete(pluginId)) return false;
if (hostMap.size === 0) {
this.decisions.delete(serverId);
}
return true;
}
private pruneQueue(predicate: (item: PluginExecutionApprovalRequest) => boolean): boolean {
let removed = false;
for (let index = this.queue.length - 1; index >= 0; index -= 1) {
if (predicate(this.queue[index]!)) {
this.queue.splice(index, 1);
removed = true;
}
}
if (this.queue.length === 0) {
this.completedInBatch = 0;
}
return removed;
}
private serializeDecisions(): StoredPluginExecutionApprovals {
const serialized: StoredPluginExecutionApprovals = {};
for (const [serverId, hostMap] of this.decisions) {
if (hostMap.size === 0) continue;
const entries: Record<string, PluginExecutionDecision> = {};
for (const [pluginId, decision] of hostMap) {
entries[pluginId] = decision;
}
serialized[serverId] = entries;
}
return serialized;
}
private schedulePersist(): void {
if (!this.hydrated || this.persistPending) return;
this.persistPending = true;
this.persistChain = this.persistChain
.then(async () => {
while (this.persistPending) {
this.persistPending = false;
await savePluginExecutionApprovals(this.storage, this.serializeDecisions());
}
return undefined;
})
.catch((error) => {
console.warn("[Plugins] Failed to save client execution approvals", error);
});
}
private publish(): void {
const current = this.queue[0] ?? null;
const pendingCount = this.queue.length;
const step = current ? this.completedInBatch + 1 : 0;
const totalInBatch = current ? this.completedInBatch + pendingCount : 0;
if (
this.queueState.current !== current ||
this.queueState.pendingCount !== pendingCount ||
this.queueState.step !== step ||
this.queueState.totalInBatch !== totalInBatch
) {
this.queueState = current ? { current, pendingCount, step, totalInBatch } : IDLE_QUEUE_STATE;
}
for (const listener of this.listeners) {
listener();
}
}
}
+3 -1
View File
@@ -4,6 +4,7 @@ import { useTranslation } from "react-i18next";
import type { PluginListItem } from "@getpaseo/protocol/messages";
import { useToast } from "@/contexts/toast-api-context";
import { useHostRuntimeClient } from "@/runtime/host-runtime";
import { pluginExecutionApprovals } from "@/plugins/execution-approval";
import { pluginDisplayName, pluginListQueryKey } from "@/plugins/plugin-list";
import { confirmDialog } from "@/utils/confirm-dialog";
import { pluginErrorText } from "./error-text";
@@ -52,7 +53,8 @@ export function usePluginActions(serverId: string) {
try {
if (action === "remove") {
await client.removePlugin(plugin.id);
// A failed update belonged to this installation, not to a later one with the same ID.
// A failed update or saved client approval belonged to this installation, not a later one.
pluginExecutionApprovals.clearPlugin(serverId, plugin.id);
dismissFailedOperation(serverId, plugin.id);
queryClient.setQueryData<PluginListItem[]>(pluginListQueryKey(serverId), (plugins) =>
plugins?.filter((candidate) => candidate.id !== plugin.id),
@@ -14,6 +14,7 @@ import { Switch } from "@/components/ui/switch";
import { useToast } from "@/contexts/toast-api-context";
import { useHostRuntimeClient } from "@/runtime/host-runtime";
import { usePluginEvaluationError } from "@/plugins/registry";
import { usePluginExecutionDecision } from "@/plugins/execution-approval";
import { pluginDisplayName } from "@/plugins/plugin-list";
import { settingsStyles } from "@/styles/settings";
import { usePluginActions } from "./actions";
@@ -143,6 +144,8 @@ function InstalledRow({
const name = pluginDisplayName(plugin);
const error = usePluginEvaluationError(serverId, plugin.id) ?? plugin.error;
const failed = error !== undefined || plugin.status === "failed";
const clientDecision = usePluginExecutionDecision(serverId, plugin.id);
const clientBlocked = !failed && plugin.enabled && clientDecision === "declined";
const open = useCallback(
() => router.push(buildPluginPageRoute(serverId, plugin.id)),
[plugin.id, serverId],
@@ -152,13 +155,21 @@ function InstalledRow({
[onPrepareOpen, plugin],
);
const toggle = useCallback((enabled: boolean) => onToggle(plugin, enabled), [onToggle, plugin]);
const badge = useMemo(
() =>
failed ? (
<StatusBadge label={t("settings.plugins.status.failed")} variant="error" size="xs" />
) : null,
[failed, t],
);
const badge = useMemo(() => {
if (failed) {
return <StatusBadge label={t("settings.plugins.status.failed")} variant="error" size="xs" />;
}
if (clientBlocked) {
return (
<StatusBadge
label={t("settings.plugins.clientExecution.blockedBadge")}
variant="warning"
size="xs"
/>
);
}
return null;
}, [clientBlocked, failed, t]);
return (
<PluginRow
name={name}
@@ -17,6 +17,8 @@ import {
PackagePlus,
Power,
RotateCw,
ShieldCheck,
ShieldOff,
Trash2,
} from "lucide-react-native";
import type { PluginListItem, PluginLogEntry } from "@getpaseo/protocol/messages";
@@ -52,6 +54,11 @@ import { useFetchQuery } from "@/data/query";
import { useDaemonConfig } from "@/hooks/use-daemon-config";
import { useHostFeature } from "@/runtime/host-features";
import { useHostRuntimeClient } from "@/runtime/host-runtime";
import {
pluginExecutionApprovals,
usePluginExecutionDecision,
type PluginExecutionDecision,
} from "@/plugins/execution-approval";
import { pluginDisplayName } from "@/plugins/plugin-list";
import type { Theme } from "@/styles/theme";
import { openExternalUrl } from "@/utils/open-external-url";
@@ -67,6 +74,8 @@ const ThemedPackagePlus = withUnistyles(PackagePlus);
const ThemedPower = withUnistyles(Power);
const ThemedArrow = withUnistyles(ArrowUpRight);
const ThemedRotate = withUnistyles(RotateCw);
const ThemedShieldCheck = withUnistyles(ShieldCheck);
const ThemedShieldOff = withUnistyles(ShieldOff);
const ThemedLogs = withUnistyles(FileText);
const ThemedTrash = withUnistyles(Trash2);
const ThemedBug = withUnistyles(Bug);
@@ -81,6 +90,8 @@ const installIcon = <ThemedPackagePlus size={14} uniProps={mutedIconColorMapping
const powerIcon = <ThemedPower size={14} uniProps={mutedIconColorMapping} />;
const linkIcon = <ThemedArrow size={14} uniProps={mutedIconColorMapping} />;
const reloadIcon = <ThemedRotate size={14} uniProps={mutedIconColorMapping} />;
const shieldAllowIcon = <ThemedShieldCheck size={14} uniProps={mutedIconColorMapping} />;
const shieldBlockIcon = <ThemedShieldOff size={14} uniProps={mutedIconColorMapping} />;
const logsIcon = <ThemedLogs size={14} uniProps={mutedIconColorMapping} />;
const removeIcon = <ThemedTrash size={14} uniProps={dangerIconMapping} />;
const bugIcon = <ThemedBug size={14} uniProps={mutedIconColorMapping} />;
@@ -268,17 +279,21 @@ function ListingMenuItems({
function InstalledMenuHeader({
plugin,
logsSupported,
clientDecision,
pendingAction,
hasListingLinks,
onReload,
onOpenLogs,
onToggleClientExecution,
}: {
plugin: PluginListItem;
logsSupported: boolean;
clientDecision: PluginExecutionDecision | null;
pendingAction?: PluginAction;
hasListingLinks: boolean;
onReload(): void;
onOpenLogs(): void;
onToggleClientExecution(): void;
}) {
const { t } = useTranslation();
return (
@@ -297,6 +312,16 @@ function InstalledMenuHeader({
{t("settings.plugins.logs.action")}
</DropdownMenuItem>
) : null}
{clientDecision !== null ? (
<DropdownMenuItem
leading={clientDecision === "approved" ? shieldBlockIcon : shieldAllowIcon}
onSelect={onToggleClientExecution}
>
{clientDecision === "approved"
? t("settings.plugins.clientExecution.blockAction")
: t("settings.plugins.clientExecution.allowAction")}
</DropdownMenuItem>
) : null}
{hasListingLinks ? <DropdownMenuSeparator /> : null}
</>
);
@@ -334,6 +359,23 @@ function listingNpmUrl(listing?: PluginListing): string | undefined {
return undefined;
}
function usePluginClientExecutionToggle(serverId: string, plugin?: PluginListItem) {
const { t } = useTranslation();
const toast = useToast();
const decision = usePluginExecutionDecision(serverId, plugin?.id ?? "");
const toggle = useCallback(() => {
if (!plugin || decision === null) return;
const nextDecision: PluginExecutionDecision = decision === "approved" ? "declined" : "approved";
pluginExecutionApprovals.setDecision(serverId, plugin.id, nextDecision);
const toastKey =
nextDecision === "approved"
? "settings.plugins.clientExecution.allowedToast"
: "settings.plugins.clientExecution.blockedToast";
toast.show(t(toastKey, { name: pluginDisplayName(plugin) }), { variant: "success" });
}, [decision, plugin, serverId, t, toast]);
return { decision, toggle };
}
/** One plugin's actions menu on its page (works for both installed plugins and directory listings). */
export function PluginActionsMenu({
serverId,
@@ -355,6 +397,8 @@ export function PluginActionsMenu({
const { t } = useTranslation();
// COMPAT(pluginLogs): added in v0.4.0, remove gate after 2027-08-16.
const logsSupported = useHostFeature(serverId, "pluginLogs");
const { decision: clientDecision, toggle: toggleClientExecution } =
usePluginClientExecutionToggle(serverId, plugin);
const [logsOpen, setLogsOpen] = useState(false);
const reload = useCallback(() => onAction?.("reload"), [onAction]);
const remove = useCallback(() => onAction?.("remove"), [onAction]);
@@ -382,10 +426,12 @@ export function PluginActionsMenu({
<InstalledMenuHeader
plugin={plugin}
logsSupported={logsSupported}
clientDecision={clientDecision}
pendingAction={pendingAction}
hasListingLinks={hasListingLinks}
onReload={reload}
onOpenLogs={openLogs}
onToggleClientExecution={toggleClientExecution}
/>
) : null}
<ListingMenuItems
@@ -32,6 +32,7 @@ import {
} from "@/constants/layout";
import { useToast } from "@/contexts/toast-api-context";
import { useContainerWidthBelow } from "@/hooks/use-container-width";
import { pluginExecutionApprovals, usePluginExecutionDecision } from "@/plugins/execution-approval";
import { pluginDisplayName } from "@/plugins/plugin-list";
import {
useInstalledPlugin,
@@ -508,6 +509,41 @@ function PluginTabPanel({
);
}
function PluginClientBlockedAlert({
serverId,
plugin,
}: {
serverId: string;
plugin: PluginListItem;
}) {
const { t } = useTranslation();
const toast = useToast();
const decision = usePluginExecutionDecision(serverId, plugin.id);
const allow = useCallback(() => {
pluginExecutionApprovals.setDecision(serverId, plugin.id, "approved");
toast.show(
t("settings.plugins.clientExecution.allowedToast", { name: pluginDisplayName(plugin) }),
{ variant: "success" },
);
}, [plugin, serverId, t, toast]);
if (!plugin.enabled || decision !== "declined") return null;
return (
<View style={styles.block}>
<Alert
size="sm"
variant="warning"
title={t("settings.plugins.clientExecution.blockedTitle")}
description={t("settings.plugins.clientExecution.blockedDescription")}
testID="plugin-client-blocked-alert"
>
<Button variant="outline" onPress={allow} testID="plugin-client-execution-allow">
{t("settings.plugins.clientExecution.allowAction")}
</Button>
</Alert>
</View>
);
}
function UnlistedPluginView({
compact,
onBack,
@@ -555,6 +591,7 @@ function UnlistedPluginView({
) : null}
</View>
{plugin ? <PluginsOffAlert serverId={serverId} /> : null}
{plugin ? <PluginClientBlockedAlert serverId={serverId} plugin={plugin} /> : null}
{model.description ? <Text style={styles.description}>{model.description}</Text> : null}
{model.error ? (
<View style={styles.block}>
@@ -690,6 +727,7 @@ function ListedPluginLayout({
/>
</View>
{plugin ? <PluginsOffAlert serverId={serverId} /> : null}
{plugin ? <PluginClientBlockedAlert serverId={serverId} plugin={plugin} /> : null}
{model.description ? <Text style={styles.description}>{model.description}</Text> : null}
{model.error ? (
<View style={styles.block}>

Some files were not shown because too many files have changed in this diff Show More