Compare commits

..
Author SHA1 Message Date
Mohamed Boudra cbedec1ed6 fix(app): keep a panel's render error inside that panel
A render exception in any workspace panel, in the explorer or a split
pane, had no boundary between it and the root error boundary, so it
replaced the whole app with the root error screen. A workspace saved
with that panel selected took the app down again on every open.

The plugin surface boundary already contained errors for plugin
surfaces. Its error-catching core is now a shared RenderErrorBoundary,
and the panel host wraps every mounted panel in it. A failed panel
shows the error with a Retry button; the other panels, the chat, the
sidebar and workspace switching keep working. Plugin surfaces keep
their own "Plugin failed" state because their boundary sits inside the
panel and catches first.
2026-11-29 17:53:33 +01:00
235 changed files with 1331 additions and 8680 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ jobs:
filters: .github/ci-paths.yml
- name: Validate CI contracts
run: node --test scripts/ci-workflow.test.mjs scripts/daemon-launch-contract.test.mjs scripts/changelog-utils.test.mjs scripts/release-version-utils.test.mjs scripts/publish-release-packages.test.mjs scripts/push-current-release-tag.test.mjs scripts/reconcile-release.test.mjs scripts/sync-fdroid-changelogs.test.mjs scripts/sync-release-notes-from-changelog.test.mjs scripts/upload-release-assets.test.mjs scripts/precompress-assets.test.mjs
run: node --test scripts/ci-workflow.test.mjs scripts/daemon-launch-contract.test.mjs scripts/changelog-utils.test.mjs scripts/release-version-utils.test.mjs scripts/publish-release-packages.test.mjs scripts/push-current-release-tag.test.mjs scripts/reconcile-release.test.mjs scripts/sync-fdroid-changelogs.test.mjs scripts/sync-release-notes-from-changelog.test.mjs scripts/upload-release-assets.test.mjs
quality:
name: quality
-93
View File
@@ -1,98 +1,5 @@
# Changelog
## 0.18.2 - 2026-11-30
- **Redesigned model picker:** Pick models from a two-pane desktop view with cross-provider search, an in-place phone drawer with a thinking slider, and per-provider model lists in settings. ([#11186](https://github.com/getpaseo/paseo/pull/11186), [#11280](https://github.com/getpaseo/paseo/pull/11280), [#11295](https://github.com/getpaseo/paseo/pull/11295), [#11371](https://github.com/getpaseo/paseo/pull/11371), [#11313](https://github.com/getpaseo/paseo/pull/11313))
- **File actions and filter:** Filter the Files tree by name, and reveal, open in your default app, download, or copy paths from chat file links, file tabs, and sidebar trees. ([#11073](https://github.com/getpaseo/paseo/pull/11073), [#11299](https://github.com/getpaseo/paseo/pull/11299), [#11320](https://github.com/getpaseo/paseo/pull/11320) by [@YASICJUNWOO](https://github.com/YASICJUNWOO), [@apple-ouyang](https://github.com/apple-ouyang), [@iqshen](https://github.com/iqshen), [@Ctrl-Creeper](https://github.com/Ctrl-Creeper), [@softyoda](https://github.com/softyoda))
- **New butterfly app icons:** Desktop and mobile now share the updated butterfly icon, with proper macOS Dock sizing and system lighting. ([#11091](https://github.com/getpaseo/paseo/pull/11091))
- **Live usage updates:** Claude and Codex usage summaries now update as turns finish instead of waiting for the five-minute poll. ([#11170](https://github.com/getpaseo/paseo/pull/11170) by [@Zayooo00](https://github.com/Zayooo00))
- **Faster CLI startup:** Paseo CLI commands now start 7 to 22 times faster by loading only the requested command. ([#11155](https://github.com/getpaseo/paseo/pull/11155), [#11193](https://github.com/getpaseo/paseo/pull/11193), [#11363](https://github.com/getpaseo/paseo/pull/11363))
- **Native ACP question cards:** Plugin ACP providers such as Antigravity now pause on interactive form questions with Paseo's question card instead of printing numbered lists. ([#11135](https://github.com/getpaseo/paseo/pull/11135) by [@djbclark](https://github.com/djbclark), [@krazyjakee](https://github.com/krazyjakee))
- **OMP background jobs:** OMP agents now list running background tasks above the composer and let you stop them without interrupting the agent. ([#11270](https://github.com/getpaseo/paseo/pull/11270) by [@mcowger](https://github.com/mcowger))
- **Plugin HTTP tunnels:** Plugins can now expose local HTTP services at public HTTPS URLs through tunnel providers, with built-in `cloudflared` and Tailscale Funnel support. ([#11036](https://github.com/getpaseo/paseo/pull/11036))
### Added
- Added `--all` to `paseo schedule ls` to list schedules targeting existing agents, and noted hidden schedules in table output ([#11243](https://github.com/getpaseo/paseo/pull/11243) by [@suniceman](https://github.com/suniceman))
- Added `activeTurnBehavior: "queue"` support for non-agent senders so plugins and UI actions can queue prompts behind a running turn ([#11169](https://github.com/getpaseo/paseo/pull/11169))
### Improved
- Reduced app memory use by dropping duplicate in-memory copies of cached transcripts ([#11322](https://github.com/getpaseo/paseo/pull/11322))
- Held the native launch splash until the restored workspace is on screen so mobile cold starts no longer flash empty frames or spinners ([#11348](https://github.com/getpaseo/paseo/pull/11348))
- Added a neutral focus border to the message composer ([#11097](https://github.com/getpaseo/paseo/pull/11097), [#11272](https://github.com/getpaseo/paseo/pull/11272) by [@Zayooo00](https://github.com/Zayooo00))
- Changed protocol parsing to ignore unknown newer fields and skip unrecognized list items instead of dropping whole messages ([#11284](https://github.com/getpaseo/paseo/pull/11284))
- Improved workspace lookup speed on hosts with many workspaces by filtering before loading workspace configs ([#11266](https://github.com/getpaseo/paseo/pull/11266))
### Changed
- Changed unattended Hub agent runs and their subagents to automatically deny unexpected permission prompts instead of blocking until timeout ([#11179](https://github.com/getpaseo/paseo/pull/11179))
- Changed delegated agent turn-end notices with pending work to appear as compact tool rows instead of peer message bubbles ([#11175](https://github.com/getpaseo/paseo/pull/11175))
### Fixed
- Fixed iOS composer buttons ignoring taps while the software keyboard is open and the model picker opening behind the keyboard on unfolded wide screens ([#11276](https://github.com/getpaseo/paseo/pull/11276))
- Fixed tapping Fullscreen or Exit fullscreen in the mobile composer closing the keyboard and flashing misaligned frames ([#11326](https://github.com/getpaseo/paseo/pull/11326))
- Fixed phone photos and large Android image batches failing to send by uploading images as chunked files and downscaling HEIC photos ([#11137](https://github.com/getpaseo/paseo/pull/11137), [#9328](https://github.com/getpaseo/paseo/pull/9328), [#11281](https://github.com/getpaseo/paseo/pull/11281) by [@Brandon168](https://github.com/Brandon168))
- Fixed Android's system Bold text setting clipping trailing characters and labels across the app ([#11162](https://github.com/getpaseo/paseo/pull/11162) by [@JustinJoshi](https://github.com/JustinJoshi))
- Fixed the discovered Models list in Android provider settings failing to scroll ([#11350](https://github.com/getpaseo/paseo/pull/11350) by [@ilteoood](https://github.com/ilteoood))
- Fixed mobile sending push notifications for the active chat by counting native touches and typing as presence ([#8070](https://github.com/getpaseo/paseo/pull/8070) by [@truelecter](https://github.com/truelecter))
- Fixed SVG files opening as blank image previews on iOS and Android ([#9094](https://github.com/getpaseo/paseo/pull/9094))
- Fixed reconnects on hosts with many workspaces causing mobile freezes and 60-second request timeouts ([#11145](https://github.com/getpaseo/paseo/pull/11145) by [@TheUnlimited64](https://github.com/TheUnlimited64))
- Fixed desktop browser tabs controlled by an agent stealing keyboard focus from chat composers ([#11158](https://github.com/getpaseo/paseo/pull/11158) by [@puchkoff](https://github.com/puchkoff))
- Fixed the web and desktop image lightbox staying stuck on screen after switching to another session ([#11358](https://github.com/getpaseo/paseo/pull/11358) by [@matchy233](https://github.com/matchy233))
- Fixed long desktop and web chats crashing with React error #185 during scroll re-measurement ([#11138](https://github.com/getpaseo/paseo/pull/11138) by [@kogekiplay](https://github.com/kogekiplay))
- Fixed scrolling older history crashing desktop when a timeline plugin reuses output IDs across messages ([#8498](https://github.com/getpaseo/paseo/pull/8498) by [@kevinle128](https://github.com/kevinle128), [@ykurilov](https://github.com/ykurilov))
- Fixed opening Changes with wrapped long lines freezing the desktop app ([#11113](https://github.com/getpaseo/paseo/pull/11113))
- Fixed streaming code blocks growing and shrinking by a line while their closing fence arrives ([#7006](https://github.com/getpaseo/paseo/pull/7006) by [@luoph](https://github.com/luoph), [@RRD-dev](https://github.com/RRD-dev))
- Fixed sending a steering message while an agent streams splitting the reply in half ([#5267](https://github.com/getpaseo/paseo/pull/5267))
- Fixed the Schedules screen staying on a spinner when another saved host is offline or still connecting ([#11361](https://github.com/getpaseo/paseo/pull/11361) by [@agenore](https://github.com/agenore))
- Fixed starting a new session on another host submitting an unavailable remembered model instead of selecting an available one ([#9052](https://github.com/getpaseo/paseo/pull/9052) by [@mcowger](https://github.com/mcowger))
- Fixed the composer showing the wrong thinking level when an agent's level is absent from its model's option list ([#10937](https://github.com/getpaseo/paseo/pull/10937) by [@ortschun](https://github.com/ortschun))
- Fixed unexpanded Windows environment-variable paths like `%TEMP%\file.md` rendering as broken links in chat ([#11228](https://github.com/getpaseo/paseo/pull/11228) by [@suniceman](https://github.com/suniceman))
- Fixed Open in Antigravity on macOS launching the `agy` CLI instead of Antigravity IDE ([#10893](https://github.com/getpaseo/paseo/pull/10893) by [@wangfh5](https://github.com/wangfh5))
- Fixed opening a built-in plugin's settings page showing a "not installed or listed" error ([#11308](https://github.com/getpaseo/paseo/pull/11308))
- Fixed local host images inside plugin Markdown surfaces failing to render inline ([#11171](https://github.com/getpaseo/paseo/pull/11171))
- Fixed agent metadata disappearing from plugin views after an app reload ([#11265](https://github.com/getpaseo/paseo/pull/11265))
- Fixed Android terminal input doubling characters, dropping Backspace, breaking Korean/Pinyin/Gboard suggestions, and mishandling hardware Enter ([#11146](https://github.com/getpaseo/paseo/pull/11146), [#11318](https://github.com/getpaseo/paseo/pull/11318) by [@apple-ouyang](https://github.com/apple-ouyang), [@lennartschoch](https://github.com/lennartschoch), [@jasonmarkperez](https://github.com/jasonmarkperez))
- Fixed Light-mode terminals reporting dark colors to terminal apps and added live light/dark theme change notifications ([#11163](https://github.com/getpaseo/paseo/pull/11163), [#11312](https://github.com/getpaseo/paseo/pull/11312) by [@gstamp](https://github.com/gstamp))
- Fixed web and desktop terminals using the interface font instead of the configured Code font on the DOM renderer ([#11099](https://github.com/getpaseo/paseo/pull/11099) by [@sh0nuff](https://github.com/sh0nuff))
- Fixed Windows terminals exiting immediately on busy machines when ConPTY startup takes more than five seconds ([#11238](https://github.com/getpaseo/paseo/pull/11238))
- Fixed closing terminals or stopping the daemon on Windows leaving terminal programs running ([#11147](https://github.com/getpaseo/paseo/pull/11147))
- Fixed Cursor usage showing HTTP 401 or missing cards across macOS Keychain, encrypted desktop stores, and Windows ([#11148](https://github.com/getpaseo/paseo/pull/11148) by [@jasonhnd](https://github.com/jasonhnd), [@KronixDev](https://github.com/KronixDev), [@kiawin](https://github.com/kiawin), [@ChicorSun](https://github.com/ChicorSun), [@kbitz](https://github.com/kbitz))
- Fixed OpenCode v2 agents hiding plan usage windows in the chat meter and Codex usage reading stale OpenCode v1 logins ([#11153](https://github.com/getpaseo/paseo/pull/11153) by [@Wu-Jiayang](https://github.com/Wu-Jiayang))
- Fixed Usage missing custom Claude and Codex providers configured with separate credential directories ([#11149](https://github.com/getpaseo/paseo/pull/11149) by [@QichangZheng](https://github.com/QichangZheng))
- Fixed Claude and Codex wrapper commands or environment tokens showing a mismatched local account in Usage ([#11154](https://github.com/getpaseo/paseo/pull/11154))
- Fixed Claude progress updates hiding inside collapsed Thinking rows and multi-block messages repeating their final block ([#11160](https://github.com/getpaseo/paseo/pull/11160) by [@ThePharmer](https://github.com/ThePharmer))
- Fixed orphaned Claude CLI child processes leaking on concurrent resume or early cancel, and bounded headless metadata generation ([#11143](https://github.com/getpaseo/paseo/pull/11143) by [@desmond-rai](https://github.com/desmond-rai), [@nickmaglowsch](https://github.com/nickmaglowsch))
- Fixed idle Claude agents being marked as failed when their process exits cleanly with code 0 ([#11273](https://github.com/getpaseo/paseo/pull/11273) by [@lucamzanon](https://github.com/lucamzanon))
- Fixed Claude Advisor tool calls staying unsettled when rebuilding chat history ([#11202](https://github.com/getpaseo/paseo/pull/11202) by [@LucasValeQueiroz](https://github.com/LucasValeQueiroz), [@SirisZheng](https://github.com/SirisZheng))
- Fixed updated plugin system prompt instructions not reaching resumed Claude sessions ([#10917](https://github.com/getpaseo/paseo/pull/10917) by [@Tomblarom](https://github.com/Tomblarom))
- Fixed Codex alias `-c mcp_servers.*` overrides disappearing when Paseo injects MCP servers ([#11142](https://github.com/getpaseo/paseo/pull/11142))
- Fixed OpenCode v2 models having no Default thinking option to return to base model behavior ([#11184](https://github.com/getpaseo/paseo/pull/11184) by [@3ae3ae](https://github.com/3ae3ae))
- Fixed Pi and OMP live streaming splitting thinking and answer blocks out of order ([#11159](https://github.com/getpaseo/paseo/pull/11159))
- Fixed Pi chat history opening empty when transcripts contain unlinked title or model-change metadata ([#11379](https://github.com/getpaseo/paseo/pull/11379))
- Fixed sending a Pi extension slash command mid-turn aborting the active response ([#11341](https://github.com/getpaseo/paseo/pull/11341) by [@tridao](https://github.com/tridao))
- Fixed a rejected Pi history or rewind extension prompt crashing the daemon worker ([#11329](https://github.com/getpaseo/paseo/pull/11329) by [@thomasvan](https://github.com/thomasvan))
- Fixed completed Pi Tintinweb background subagents staying marked as Running ([#11168](https://github.com/getpaseo/paseo/pull/11168) by [@amcfague](https://github.com/amcfague))
- Fixed background OMP catalog refreshes triggering cancelled startup model requests ([#11129](https://github.com/getpaseo/paseo/pull/11129) by [@mcowger](https://github.com/mcowger))
- Fixed OMP turns timing out after ten minutes while actively streaming or waiting on a question card ([#11079](https://github.com/getpaseo/paseo/pull/11079) by [@LiebeLee](https://github.com/LiebeLee))
- Fixed Antigravity deferred turns ending early after an interim reply when the final background tool completes ([#10924](https://github.com/getpaseo/paseo/pull/10924) by [@Juns-g](https://github.com/Juns-g))
- Fixed stopping an unresponsive ACP agent leaving later prompts stuck behind an active foreground turn ([#11152](https://github.com/getpaseo/paseo/pull/11152))
- Fixed resumed Muse sessions dropping daemon and plugin system instructions ([#10915](https://github.com/getpaseo/paseo/pull/10915) by [@Tomblarom](https://github.com/Tomblarom))
- Fixed Unix-socket, named-pipe, non-loopback, and HTTP-proxy daemons dropping injected Paseo MCP tools and terminal activity reporting ([#11144](https://github.com/getpaseo/paseo/pull/11144))
- Fixed repeated daemon restarts duplicating provider image attachments in temporary directories ([#7895](https://github.com/getpaseo/paseo/pull/7895) by [@cleiter](https://github.com/cleiter))
- Fixed concurrent reloads of the same agent failing with "Unknown agent" ([#8369](https://github.com/getpaseo/paseo/pull/8369) by [@tieo](https://github.com/tieo))
- Fixed `paseo agent logs --tail` timing out on very large chat histories ([#10723](https://github.com/getpaseo/paseo/pull/10723) by [@minamorl](https://github.com/minamorl))
- Fixed `paseo agent logs` hanging instead of exiting after a daemon request timeout ([#11360](https://github.com/getpaseo/paseo/pull/11360))
- Fixed `paseo permit ls` missing pending permissions from background agents and agents past the first 200 ([#10655](https://github.com/getpaseo/paseo/pull/10655) by [@NightMachinery](https://github.com/NightMachinery))
- Fixed `paseo --host host:port` giving generic credential advice on HTTP 400 instead of suggesting `wss://` for TLS endpoints ([#11383](https://github.com/getpaseo/paseo/pull/11383))
### Plugins
- Added `update_workspace` and workspace `metadata` support to Paseo MCP and `PluginWorkspaceSnapshot` ([#11166](https://github.com/getpaseo/paseo/pull/11166))
- Fixed server plugin compilation failing when a dependency's type declarations import Node ambient types ([#8618](https://github.com/getpaseo/paseo/pull/8618) by [@nkwib](https://github.com/nkwib))
## 0.18.1 - 2026-11-27
- **Host metadata instructions:** Set host-wide instructions once to guide language, tone, and formatting for generated workspace titles, branch names, commit messages, and pull requests. ([#11064](https://github.com/getpaseo/paseo/pull/11064))
-93
View File
@@ -1,98 +1,5 @@
# Changelog
## 0.18.2 - 2026-11-30
- **重新设计的模型选择器**:桌面端采用支持跨 Provider 搜索的双栏视图,手机端合并为带思考强度滑块的单层抽屉,并支持在设置中按 Provider 筛选常用模型。([#11186](https://github.com/getpaseo/paseo/pull/11186), [#11280](https://github.com/getpaseo/paseo/pull/11280), [#11295](https://github.com/getpaseo/paseo/pull/11295), [#11371](https://github.com/getpaseo/paseo/pull/11371), [#11313](https://github.com/getpaseo/paseo/pull/11313))
- **文件操作与筛选**:支持按名称筛选文件树,并直接从对话文件链接、文件标签页和侧边栏文件树中定位文件、使用默认应用打开、下载或复制路径。([#11073](https://github.com/getpaseo/paseo/pull/11073), [#11299](https://github.com/getpaseo/paseo/pull/11299), [#11320](https://github.com/getpaseo/paseo/pull/11320),贡献者:[@YASICJUNWOO](https://github.com/YASICJUNWOO), [@apple-ouyang](https://github.com/apple-ouyang), [@iqshen](https://github.com/iqshen), [@Ctrl-Creeper](https://github.com/Ctrl-Creeper), [@softyoda](https://github.com/softyoda))
- **全新蝴蝶应用图标**:桌面端和移动端现已统一使用新版蝴蝶图标,并在 macOS 程序坞中具备正确的图标尺寸与系统光影。([#11091](https://github.com/getpaseo/paseo/pull/11091))
- **实时用量更新**:Claude 和 Codex 的用量摘要现在会在轮次结束时实时更新,不再需要等待五分钟轮询。([#11170](https://github.com/getpaseo/paseo/pull/11170),贡献者:[@Zayooo00](https://github.com/Zayooo00))
- **更快的 CLI 启动速度**:Paseo CLI 仅按需加载所执行的命令,启动速度提升 7 至 22 倍。([#11155](https://github.com/getpaseo/paseo/pull/11155), [#11193](https://github.com/getpaseo/paseo/pull/11193), [#11363](https://github.com/getpaseo/paseo/pull/11363))
- **原生 ACP 提问卡片**:Antigravity 等插件 ACP Provider 遇到交互式表单提问时,现在会暂停并显示 Paseo 原生提问卡片,而不再输出编号列表。([#11135](https://github.com/getpaseo/paseo/pull/11135),贡献者:[@djbclark](https://github.com/djbclark), [@krazyjakee](https://github.com/krazyjakee))
- **OMP 后台任务**:OMP Agent 现在会在 Composer 上方列出正在运行的后台任务,并支持直接停止而不中断 Agent。([#11270](https://github.com/getpaseo/paseo/pull/11270),贡献者:[@mcowger](https://github.com/mcowger))
- **插件 HTTP 隧道**:插件现在可以通过隧道 Provider 将本地 HTTP 服务暴露为公网 HTTPS 地址,内置支持 `cloudflared` 和 Tailscale Funnel。([#11036](https://github.com/getpaseo/paseo/pull/11036))
### 新增
- 为 `paseo schedule ls` 新增 `--all` 选项以列出指向现有 Agent 的定时任务,并在表格输出中提示已隐藏的定时任务 ([#11243](https://github.com/getpaseo/paseo/pull/11243),贡献者:[@suniceman](https://github.com/suniceman))
- 为非 Agent 发送方新增 `activeTurnBehavior: "queue"` 支持,使插件和界面操作可将提示词排队到当前运行轮次之后 ([#11169](https://github.com/getpaseo/paseo/pull/11169))
### 改进
- 移除了内存中重复保留的已缓存对话记录副本,降低了应用内存占用 ([#11322](https://github.com/getpaseo/paseo/pull/11322))
- 延长原生启动画面直到恢复的工作区渲染到屏幕上,避免移动端冷启动时闪烁空白帧或加载指示器 ([#11348](https://github.com/getpaseo/paseo/pull/11348))
- 为消息 Composer 新增中性色调的聚焦边框 ([#11097](https://github.com/getpaseo/paseo/pull/11097), [#11272](https://github.com/getpaseo/paseo/pull/11272),贡献者:[@Zayooo00](https://github.com/Zayooo00))
- 改进协议解析,忽略未知的新字段并跳过无法识别的列表项,不再丢弃整条消息 ([#11284](https://github.com/getpaseo/paseo/pull/11284))
- 在加载工作区配置前先进行过滤,提升包含大量工作区主机上的工作区查询速度 ([#11266](https://github.com/getpaseo/paseo/pull/11266))
### 变更
- 无人值守的 Hub Agent 及其子 Agent 遇到意外权限请求时,改为自动拒绝而不再阻塞直至超时 ([#11179](https://github.com/getpaseo/paseo/pull/11179))
- 仍有待处理任务的委托 Agent 轮次结束通知,改为显示为紧凑的工具调用行,而不再显示为对等消息气泡 ([#11175](https://github.com/getpaseo/paseo/pull/11175))
### 修复
- 修复 iOS 软键盘弹出时 Composer 按钮忽略点击,以及在展开的宽屏设备上模型选择器被键盘遮挡的问题 ([#11276](https://github.com/getpaseo/paseo/pull/11276))
- 修复在移动端 Composer 中点击全屏或退出全屏时收起键盘并闪烁错位帧的问题 ([#11326](https://github.com/getpaseo/paseo/pull/11326))
- 修复手机照片和大量 Android 图片批次发送失败的问题,改为以分块文件上传图片并将 HEIC 照片降采样为 JPEG ([#11137](https://github.com/getpaseo/paseo/pull/11137), [#9328](https://github.com/getpaseo/paseo/pull/9328), [#11281](https://github.com/getpaseo/paseo/pull/11281),贡献者:[@Brandon168](https://github.com/Brandon168))
- 修复 Android 系统开启粗体文字设置后应用内末尾字符和标签被截断的问题 ([#11162](https://github.com/getpaseo/paseo/pull/11162),贡献者:[@JustinJoshi](https://github.com/JustinJoshi))
- 修复 Android 的 Provider 设置中已发现的模型列表无法滚动的问题 ([#11350](https://github.com/getpaseo/paseo/pull/11350),贡献者:[@ilteoood](https://github.com/ilteoood))
- 修复移动端仍为当前正在查看的对话发送推送通知的问题,将原生触摸与输入计入在线活跃状态 ([#8070](https://github.com/getpaseo/paseo/pull/8070),贡献者:[@truelecter](https://github.com/truelecter))
- 修复 iOS 和 Android 上打开 SVG 文件预览显示空白的问题 ([#9094](https://github.com/getpaseo/paseo/pull/9094))
- 修复在包含大量工作区的主机上重连时导致移动端卡顿和 60 秒请求超时的问题 ([#11145](https://github.com/getpaseo/paseo/pull/11145),贡献者:[@TheUnlimited64](https://github.com/TheUnlimited64))
- 修复由 Agent 控制的桌面端浏览器标签页抢占对话 Composer 键盘焦点的问题 ([#11158](https://github.com/getpaseo/paseo/pull/11158),贡献者:[@puchkoff](https://github.com/puchkoff))
- 修复在网页端和桌面端切换到其他会话后图片灯箱仍卡在屏幕上的问题 ([#11358](https://github.com/getpaseo/paseo/pull/11358),贡献者:[@matchy233](https://github.com/matchy233))
- 修复桌面端和网页端长对话在滚动重新测量时触发 React 错误 #185 崩溃的问题 ([#11138](https://github.com/getpaseo/paseo/pull/11138),贡献者:[@kogekiplay](https://github.com/kogekiplay))
- 修复时间线插件跨消息复用输出 ID 时,滚动较早历史记录导致桌面端崩溃的问题 ([#8498](https://github.com/getpaseo/paseo/pull/8498),贡献者:[@kevinle128](https://github.com/kevinle128), [@ykurilov](https://github.com/ykurilov))
- 修复在变更视图中开启长行换行时桌面端卡死的问题 ([#11113](https://github.com/getpaseo/paseo/pull/11113))
- 修复流式输出代码块在闭合围栏尚未完整到达时高度增加一行又缩回的问题 ([#7006](https://github.com/getpaseo/paseo/pull/7006),贡献者:[@luoph](https://github.com/luoph), [@RRD-dev](https://github.com/RRD-dev))
- 修复在 Agent 流式回复过程中发送引导消息将回复截成两半的问题 ([#5267](https://github.com/getpaseo/paseo/pull/5267))
- 修复另一个已保存主机离线或仍在连接时,定时任务页面一直停留在加载状态的问题 ([#11361](https://github.com/getpaseo/paseo/pull/11361),贡献者:[@agenore](https://github.com/agenore))
- 修复在另一台主机上启动新会话时提交上次记住但该主机不可用的模型,而未自动选择可用模型的问题 ([#9052](https://github.com/getpaseo/paseo/pull/9052),贡献者:[@mcowger](https://github.com/mcowger))
- 修复 Agent 的思考强度不在其模型选项列表中时,Composer 显示错误思考强度的问题 ([#10937](https://github.com/getpaseo/paseo/pull/10937),贡献者:[@ortschun](https://github.com/ortschun))
- 修复对话中未展开的 Windows 环境变量路径(如 `%TEMP%\file.md`)被渲染为失效链接的问题 ([#11228](https://github.com/getpaseo/paseo/pull/11228),贡献者:[@suniceman](https://github.com/suniceman))
- 修复 macOS 上“在 Antigravity 中打开”启动 `agy` CLI 而不是 Antigravity IDE 的问题 ([#10893](https://github.com/getpaseo/paseo/pull/10893),贡献者:[@wangfh5](https://github.com/wangfh5))
- 修复打开内置插件设置页面时显示“未安装或未列出”错误的问题 ([#11308](https://github.com/getpaseo/paseo/pull/11308))
- 修复插件 Markdown 界面中的本地主机图片无法内联渲染的问题 ([#11171](https://github.com/getpaseo/paseo/pull/11171))
- 修复重新加载应用后插件视图中 Agent 元数据消失的问题 ([#11265](https://github.com/getpaseo/paseo/pull/11265))
- 修复 Android 终端输入重复字符、丢失退格键、破坏韩语/拼音/Gboard 候选词以及误处理实体回车键的问题 ([#11146](https://github.com/getpaseo/paseo/pull/11146), [#11318](https://github.com/getpaseo/paseo/pull/11318),贡献者:[@apple-ouyang](https://github.com/apple-ouyang), [@lennartschoch](https://github.com/lennartschoch), [@jasonmarkperez](https://github.com/jasonmarkperez))
- 修复浅色模式终端向终端程序报告深色配色的问题,并新增实时浅色/深色主题切换通知 ([#11163](https://github.com/getpaseo/paseo/pull/11163), [#11312](https://github.com/getpaseo/paseo/pull/11312),贡献者:[@gstamp](https://github.com/gstamp))
- 修复网页端和桌面端终端在 DOM 渲染器下使用界面字体而不是已配置代码字体的问题 ([#11099](https://github.com/getpaseo/paseo/pull/11099),贡献者:[@sh0nuff](https://github.com/sh0nuff))
- 修复在负载较高的 Windows 机器上 ConPTY 启动超过五秒时终端立即退出的问题 ([#11238](https://github.com/getpaseo/paseo/pull/11238))
- 修复在 Windows 上关闭终端或停止 daemon 时终端内程序仍在后台运行的问题 ([#11147](https://github.com/getpaseo/paseo/pull/11147))
- 修复 Cursor 使用情况在 macOS 钥匙串、加密桌面存储和 Windows 上返回 HTTP 401 或缺失卡片的问题 ([#11148](https://github.com/getpaseo/paseo/pull/11148),贡献者:[@jasonhnd](https://github.com/jasonhnd), [@KronixDev](https://github.com/KronixDev), [@kiawin](https://github.com/kiawin), [@ChicorSun](https://github.com/ChicorSun), [@kbitz](https://github.com/kbitz))
- 修复 OpenCode v2 Agent 在对话用量指示器中不显示套餐用量窗口,以及 Codex 使用情况读取过期 OpenCode v1 登录态的问题 ([#11153](https://github.com/getpaseo/paseo/pull/11153),贡献者:[@Wu-Jiayang](https://github.com/Wu-Jiayang))
- 修复使用情况遗漏配置了独立凭据目录的自定义 Claude 和 Codex Provider 的问题 ([#11149](https://github.com/getpaseo/paseo/pull/11149),贡献者:[@QichangZheng](https://github.com/QichangZheng))
- 修复使用包装命令或环境变量令牌的 Claude 和 Codex 在使用情况中显示不匹配的本地账号的问题 ([#11154](https://github.com/getpaseo/paseo/pull/11154))
- 修复 Claude 进度更新被隐藏在折叠的思考行内,以及多块消息重复显示最后一块的问题 ([#11160](https://github.com/getpaseo/paseo/pull/11160),贡献者:[@ThePharmer](https://github.com/ThePharmer))
- 修复并发恢复或提前取消时泄漏孤立 Claude CLI 子进程的问题,并限制无头元数据生成的并发 ([#11143](https://github.com/getpaseo/paseo/pull/11143),贡献者:[@desmond-rai](https://github.com/desmond-rai), [@nickmaglowsch](https://github.com/nickmaglowsch))
- 修复空闲 Claude Agent 进程以退出码 0 正常退出时被标记为失败的问题 ([#11273](https://github.com/getpaseo/paseo/pull/11273),贡献者:[@lucamzanon](https://github.com/lucamzanon))
- 修复重建对话历史时 Claude Advisor 工具调用一直停留在未完成状态的问题 ([#11202](https://github.com/getpaseo/paseo/pull/11202),贡献者:[@LucasValeQueiroz](https://github.com/LucasValeQueiroz), [@SirisZheng](https://github.com/SirisZheng))
- 修复更新后的插件系统提示词指令未能送达已恢复的 Claude 会话的问题 ([#10917](https://github.com/getpaseo/paseo/pull/10917),贡献者:[@Tomblarom](https://github.com/Tomblarom))
- 修复 Paseo 注入 MCP 服务器时 Codex 别名的 `-c mcp_servers.*` 覆盖配置丢失的问题 ([#11142](https://github.com/getpaseo/paseo/pull/11142))
- 修复 OpenCode v2 模型缺少 Default 思考选项、无法恢复模型默认行为的问题 ([#11184](https://github.com/getpaseo/paseo/pull/11184),贡献者:[@3ae3ae](https://github.com/3ae3ae))
- 修复 Pi 和 OMP 实时流式输出时思考块和回复块顺序错乱分割的问题 ([#11159](https://github.com/getpaseo/paseo/pull/11159))
- 修复包含未关联标题或模型变更元数据的 Pi 对话历史打开为空的问题 ([#11379](https://github.com/getpaseo/paseo/pull/11379))
- 修复在轮次进行中发送 Pi 扩展斜杠命令会中止当前回复的问题 ([#11341](https://github.com/getpaseo/paseo/pull/11341),贡献者:[@tridao](https://github.com/tridao))
- 修复被拒绝的 Pi 历史读取或回退扩展提示导致 daemon 工作进程崩溃的问题 ([#11329](https://github.com/getpaseo/paseo/pull/11329),贡献者:[@thomasvan](https://github.com/thomasvan))
- 修复已完成的 Pi Tintinweb 后台子 Agent 仍一直显示为运行中的问题 ([#11168](https://github.com/getpaseo/paseo/pull/11168),贡献者:[@amcfague](https://github.com/amcfague))
- 修复后台 OMP 目录刷新触发被取消的启动模型请求的问题 ([#11129](https://github.com/getpaseo/paseo/pull/11129),贡献者:[@mcowger](https://github.com/mcowger))
- 修复 OMP 轮次在持续流式输出或等待提问卡片超过十分钟后超时失败的问题 ([#11079](https://github.com/getpaseo/paseo/pull/11079),贡献者:[@LiebeLee](https://github.com/LiebeLee))
- 修复 Antigravity 延迟轮次在发出中间回复后,最后一个后台工具完成时提前结束轮次的问题 ([#10924](https://github.com/getpaseo/paseo/pull/10924),贡献者:[@Juns-g](https://github.com/Juns-g))
- 修复停止无响应的 ACP Agent 后,后续提示词一直卡在活跃前台轮次之后的问题 ([#11152](https://github.com/getpaseo/paseo/pull/11152))
- 修复恢复的 Muse 会话丢失 daemon 和插件系统指令的问题 ([#10915](https://github.com/getpaseo/paseo/pull/10915),贡献者:[@Tomblarom](https://github.com/Tomblarom))
- 修复监听 Unix 套接字、命名管道、非回环地址或处于 HTTP 代理后的 daemon 丢失内置 Paseo MCP 工具注入和终端活动上报的问题 ([#11144](https://github.com/getpaseo/paseo/pull/11144))
- 修复重复重启 daemon 在临时目录中不断复制 Provider 图片附件的问题 ([#7895](https://github.com/getpaseo/paseo/pull/7895),贡献者:[@cleiter](https://github.com/cleiter))
- 修复并发重载同一个 Agent 时返回“Unknown agent”错误的问题 ([#8369](https://github.com/getpaseo/paseo/pull/8369),贡献者:[@tieo](https://github.com/tieo))
- 修复 `paseo agent logs --tail` 在超长对话历史上超时的问题 ([#10723](https://github.com/getpaseo/paseo/pull/10723),贡献者:[@minamorl](https://github.com/minamorl))
- 修复 `paseo agent logs` 在 daemon 请求超时后挂起不退出的问题 ([#11360](https://github.com/getpaseo/paseo/pull/11360))
- 修复 `paseo permit ls` 遗漏后台 Agent 以及前 200 个之后 Agent 的待处理权限的问题 ([#10655](https://github.com/getpaseo/paseo/pull/10655),贡献者:[@NightMachinery](https://github.com/NightMachinery))
- 修复 `paseo --host host:port` 遇到 HTTP 400 时只提示检查凭据而未建议对 TLS 端点使用 `wss://` 的问题 ([#11383](https://github.com/getpaseo/paseo/pull/11383))
### 插件
- 为 Paseo MCP 和 `PluginWorkspaceSnapshot` 新增 `update_workspace` 和工作区 `metadata` 支持 ([#11166](https://github.com/getpaseo/paseo/pull/11166))
- 修复依赖的类型声明导入 Node 环境类型时服务端插件编译失败的问题 ([#8618](https://github.com/getpaseo/paseo/pull/8618),贡献者:[@nkwib](https://github.com/nkwib))
## 0.18.1 - 2026-11-27
- **主机元数据指令**:设置一次主机级指令,即可统一控制自动生成的工作区标题、分支名、提交信息和 PR 的语言、语气与格式。([#11064](https://github.com/getpaseo/paseo/pull/11064))
+1 -1
View File
@@ -136,7 +136,7 @@ Cards inside a section sit closer than sections. Rows inside a card touch — on
Rows have generous vertical padding: roughly 16px of content plus 16px of vertical padding for settings rows, 8–12px for sidebar list items where many rows must fit. Every row is at least as tall as one holding a switch, so text rows, switch rows and rows that open something (`<SettingsDetailRow>`, a collapsible row's header) line up. A row holding a button or a select is taller. Compressing rows below the established density to fit more on the screen is wrong. Too many rows means more cards or more sections, not smaller rows.
Rows revealed under a `<SettingsCollapsibleRow>` are nested rows, one step smaller than card rows: 8px of vertical padding, `fontSize.sm` text, `sm` controls, and one fixed height so rows with and without a trailing button line up. The collapsible row sets this for everything under it (`packages/app/src/components/settings/row-density.tsx`). Never pass a density to a row, and never pad or resize a nested row by hand. Settings rows that share a menu surface with menu rows, such as Usage's options, go inside `<MenuSettingsRows>`, which puts their labels on the menu rows' label rail (`menuRowContentInset`). Settings rows that share a sheet with list rows, such as Agent settings with its radio choices and section headers, go inside `<ListSettingsRows>`, which makes every row one touch target tall so Model, switch and radio rows line up.
Rows revealed under a `<SettingsCollapsibleRow>` are nested rows, one step smaller than card rows: 8px of vertical padding, `fontSize.sm` text, `sm` controls, and one fixed height so rows with and without a trailing button line up. The collapsible row sets this for everything under it (`packages/app/src/components/settings/row-density.tsx`). Never pass a density to a row, and never pad or resize a nested row by hand. Settings rows that share a menu surface with menu rows, such as Usage's options, go inside `<MenuSettingsRows>`, which puts their labels on the menu rows' label rail (`menuRowContentInset`).
The whitespace is the design.
-2
View File
@@ -523,8 +523,6 @@ Measured bundle size for a standard Expo web export:
- gzip: 2.55 MiB
- brotli: 1.93 MiB
`npm run build:desktop` runs the same `scripts/precompress-assets.mjs` over `packages/app/dist` before electron-builder copies it to `app-dist`, so the desktop-served UI also gets `.br`/`.gz` siblings.
The desktop-managed daemon disables the bundled web UI by default (`PASEO_WEB_UI_ENABLED=false`) because the desktop app already ships the renderer as `app-dist`. Shipping the same assets again inside `@getpaseo/server` would duplicate the ~10.8 MiB install. Desktop packaging also excludes `node_modules/@getpaseo/server/dist/server/web-ui/**` from the packaged app.
## Built workspace packages
+15 -36
View File
@@ -194,23 +194,9 @@ signal because the stock iOS Reanimated value changes at move start, while
writing a replacement Reanimated value every frame interrupts UIKit's hide
animation. Keep this platform choice inside the keyboard module's private platform-specific translate files.
On iOS the native driver and Fabric both write the view's transform, and
nothing orders a driver update with a mount. The translate view therefore
commits where it rests as a React prop. Fabric paints a driven view's committed
transform when it creates or resizes the view, in the same mount as the layout,
and the driver follows a frame later. Change `enabled` on the translate view
that the change resizes. Without a resize the old lift stays on screen until the
driver catches up, and a mode sent to the driver from the commit can paint over
the old layout: either way one frame draws the new layout at the old lift.
`ComposerDock` keeps the surface at full height and moves it with two
`KeyboardTranslateView`s on the same translation: one holds the content, one
holds the composer slot. Only the slot changes mode for fullscreen, and
fullscreen resizes it on every screen. Do not put the mode on one view around
both: that view resizes on New workspace, which drops its header, and not in a
chat, so the two screens land the toggle differently. The panel root clips the
surface at the header edge, so rows slide under the header on open and out from
under it on close. Do not swap the
`ComposerDock` always keeps the surface at full height and wraps it in
`KeyboardTranslateView`. The panel root clips it at the header edge, so rows
slide under the header on open and out from under it on close. Do not swap the
dock to keyboard padding at rest. Changing its height creates either a blank
band or a paused transition when the stream list updates its viewport.
@@ -245,7 +231,7 @@ instead of expanding on close and shrinking again on open.
Fullscreen is a layout mode of the dock, not a second editor. `ComposerDock
fullscreen` fills the stationary viewport with the composer slot over the
still-mounted content, paints its own surface under the safe areas, and turns
the slot's translation off. The content behind it keeps riding the keyboard. The composer's single tree keeps the editing
the surface translation off. The composer's single tree keeps the editing
surface at the same position in both modes, so the mounted editor, its native
buffer, selection, and focus survive the toggle and Send's clear always reaches
the live input. A viewport crossing the compact breakpoint still remounts it:
@@ -292,8 +278,8 @@ for header clearance, but reserves the composer's own capped height before
shrinking the setup scroll view. The form must not take editing space from the
composer.
Move the stream and composer through `ComposerDock`, which gives both the same
translation. Do not translate either from outside the dock.
Move the stream and composer together through `ComposerDock`. Do not translate
them independently.
`KeyboardShiftProvider` owns the normalized shift used for settled insets and
portal geometry, plus the `isMoving` worklet value. It reconciles native
@@ -316,9 +302,9 @@ translation scope is React context and does not cross it (Gotcha 7). It returns:
Do not measure an anchor with `measureInWindow` and correct it by the keyboard
shift. On iOS the translate view uses the native driver, which moves the view
without updating the shadow tree. The translate view commits the lift the
keyboard is at or moving to, so `measureInWindow` includes the lift at rest and
runs ahead of the view while the keyboard moves. Any correction double-lifts the
without updating the shadow tree. The translate view commits the resting lift to
the shadow tree once the keyboard settles, so `measureInWindow` includes the lift
at rest and misses it while the keyboard moves. Any correction double-lifts the
popover or leaves it behind the keyboard. `measureAtRest` measures through
Fabric's transform-free `measureLayout` instead. Re-measure when `isMoving`
settles; the composer's resting position changes as the draft grows.
@@ -330,8 +316,8 @@ the anchor's rect against the layer and commits the placement with `flushSync`,
which runs after layout and before paint. On native a Reanimated frame callback
reads only the anchor's height on the UI thread and holds its bottom edge at
the rest measurement. A height carries no transform. On iOS the absolute
position does not follow the keyboard while it moves: the lift runs on the
native driver, and the shadow tree holds only where the keyboard is going. The
position does not include one while the keyboard moves: the lift runs on the
native driver and reaches the shadow tree only at rest. The
fixed-bottom model is wrong for the centered New workspace composer on tablets,
which grows around its middle, and for width or x changes. The popover is off
there by half the growth, or by the old width, until the next rest measurement.
@@ -447,17 +433,10 @@ wide layouts keep local geometry. That export is
what `patches/@gorhom+bottom-sheet+*.patch` adds.
A sheet whose owner may veto the close (unsaved work) passes `enableDismissOnClose={false}`. Every
close path then parks the sheet at index -1 with its content mounted; the owner runs its guard and
either snaps back to 0 or drops its state, which unmounts the sheet and takes it off the stack.
Calling `dismiss()` on such a sheet bypasses the guard and unmounts it, so its backdrop and Back
press call `close()`.
Run that guard from the wrapper's `onClosed`. Gorhom only calls `onChange` when a close ends at a
different index than the one it already recorded, and an interrupted mount animation leaves that
record at -1, so the close that follows is invisible: the sheet parks with its backdrop still over
the app, and every tap in the covered area is lost. `onClosed` watches the close animation settle at
the closed detent and reports it either way. Keeping `onChange` as well is harmless as long as the
guard is idempotent.
close path then parks the sheet at index -1 with its content mounted; the owner hears
`onChange(-1)`, runs its guard, and either snaps back to 0 or drops its state, which unmounts the
sheet and takes it off the stack. Calling `dismiss()` on such a sheet bypasses the guard and
unmounts it, so its backdrop and Back press call `close()`.
The wrapper must give Gorhom an object ref. Gorhom accepts a callback ref at the React boundary
but stores it in the modal queue and later reads `.current`; provider dismissal, replacement,
-3
View File
@@ -47,9 +47,6 @@ The component renders state and dispatches intent. That is all it does.
4. **Resolution is explicit model state, per host** (`idle | pending |
complete`), keyed off the opened snapshot's serverId. Waiting for data is a
state you can render, not an effect race.
Create-agent model preferences are shared across hosts, so resolve remembered
models against the selected host's ready catalog before applying them. Keep
explicit initial values and user selections intact.
5. **Displays are owned state.** The selected option's label is captured at
selection/seed time (`setProject(value, display)`), never re-derived from a
live options list — list churn must not flicker or blank a selection.
+1 -1
View File
@@ -4,7 +4,7 @@ Paseo Hub is an explicit opt-in connection from one Paseo daemon to one Hub. Run
not register it with a Hub. The relationship begins only when a user runs
`paseo hub connect [url]` from the daemon machine with an explicit API key or matching stored CLI login.
The human CLI login and daemon relationship are separate identities. `paseo hub login [url]` stores a durable organization-scoped CLI credential keyed by normalized Hub origin under `PASEO_HOME`. Interactive login optionally connects the local daemon, then points to the Hub UI for trigger configuration; it does not scaffold or deploy configuration. `paseo hub init` remains the explicit triggers-as-code scaffold: it writes one self-contained organization trigger under `.paseo/triggers/`, validates it through the trigger API, and optionally installs it. `paseo hub deploy` validates and installs every trigger in that directory; passing `--project` keeps deploying the legacy project bundle instead. `paseo hub export [directory]` writes the active organization's current triggers in the same layout, using the active login unless another Hub or API key is selected. `paseo hub run` dispatches a `manual.run` trigger through `POST /api/v1/manual-runs`, which takes inputs and prompt as one string; the CLI rejects what Hub would silently read as prompt text (`packages/cli/src/commands/hub/run/`). Origin resolution uses explicit command input, `PASEO_HUB_URL`, active login, then `https://hub.paseo.sh`. Connect uses exact-origin authority to request a one-time enrollment token, then passes only that token to the daemon. The daemon generates and persists its own relationship credential.
The human CLI login and daemon relationship are separate identities. `paseo hub login [url]` stores a durable organization-scoped CLI credential keyed by normalized Hub origin under `PASEO_HOME`. Interactive login optionally connects the local daemon, then points to the Hub UI for trigger configuration; it does not scaffold or deploy configuration. `paseo hub init` remains the explicit triggers-as-code scaffold: it writes one self-contained organization trigger under `.paseo/triggers/`, validates it through the trigger API, and optionally installs it. `paseo hub deploy` validates and installs every trigger in that directory; passing `--project` keeps deploying the legacy project bundle instead. `paseo hub export [directory]` writes the active organization's current triggers in the same layout, using the active login unless another Hub or API key is selected. Origin resolution uses explicit command input, `PASEO_HUB_URL`, active login, then `https://hub.paseo.sh`. Connect uses exact-origin authority to request a one-time enrollment token, then passes only that token to the daemon. The daemon generates and persists its own relationship credential.
## Connection and authority
+1 -9
View File
@@ -130,15 +130,7 @@ under an eight-line draft, selection with the keyboard shown and hidden, and
file mentions. Set `_SCENARIO=controls` to tap the attach button and the model
selector with a 3pt drag while the keyboard is open, then check that a wide
layout's model popover clears both the trigger and the keyboard. Run it on an
iPhone and on the iPhone Duo unfolded. Set `_SCENARIO=fullscreen` to toggle an
eight-line draft in and out of fullscreen with the keyboard open, on a workspace
draft tab and on New workspace. Every toggle must keep the keyboard, fullscreen
must cover the screen behind the keyboard with Send above it, and exit must
return the composer to its resting place. It then records the screen through
eight toggles and fails if any frame draws Send anywhere but its inline or its
fullscreen place; snapshots are a second apart and cannot see one wrong frame.
The recording needs `ffmpeg` on the PATH and reads the booted simulator unless
`_UDID` is set. These scenarios only need `_SERVER_ID` and `_WORKSPACE_ID`;
iPhone and on the iPhone Duo unfolded. These scenarios only need `_SERVER_ID` and `_WORKSPACE_ID`;
`_UDID` selects an exact simulator and `_ARTIFACTS_DIR` overrides the output path.
The Android sidebar scroll-retention flow requires a connected host with enough
-10
View File
@@ -724,13 +724,3 @@ Tests use `isProviderAvailable(provider)` to skip when the binary or credentials
- Gate the operations **the daemon issues** (prompt, slash command, summarize) on both the terminal and cancel settlement. Permission and question responses are not runner operations and must stay outside the gate, or an auto-approve deadlocks the stop. Runs the _provider_ starts on its own — plugin or autonomous wakes — are observed, not gated: the daemon does not choose when they begin, and holding their events back does not protect them from a cancel already in flight, it only hides a run that may already be dead.
- Fail closed: if the cancel never succeeded you never proved the run stopped, so refuse new runs until the next Stop issues a fresh cancel. `AgentManager` already turns a rejected `interrupt()` into a refused cancel.
- Suppress the canceled run's residue only until its authoritative terminal. Anything the provider publishes after that terminal is a new run by construction and must take the normal live path — buffering it and replaying it later is how autonomous/plugin wakes get lost.
**OMP background work comes from an injected extension.** OMP's RPC has no job inventory or cancel command, and adding them upstream is not an option. `OmpCliRuntime` launches every OMP process with `--extension` pointing at a module it generates (`packages/server/src/server/agent/providers/omp/background-work-extension.ts`) and deletes the file when that runtime closes. The extension polls `ctx.getAsyncJobSnapshot()` and sends changes through `ctx.ui.setStatus("paseo:background-work", …)`, which the adapter consumes and never shows. Stop sends `/jobs kill <id>` as an RPC prompt; OMP runs that builtin before the model sees the prompt, mid-turn or idle. What you get depends on the OMP release:
| OMP | Background jobs |
| ----------------- | ------------------------------------- |
| older than 17.2.0 | not listed (no `getAsyncJobSnapshot`) |
| 17.2.0 to 18.8.7 | listed, no Stop |
| 18.8.8 and newer | listed, with Stop |
The adapter reads the command list at launch and publishes `canStop: false` when `/jobs` has no `kill` subcommand. A run waiting on jobs ends with a non-terminal `agent_end` marked `awaitingAsyncWork`. From 18.8.8 until 18.21.0, OMP sends nothing after `/jobs kill` cancels the last of that work, so after a Stop the adapter reads `get_state` and completes the turn itself when nothing is left. Listing and Stop depend on OMP's extension API and the `/jobs` builtin, not on a wire contract, so recheck them when the minimum OMP version moves. `task` jobs are left out because OMP subagents already show as subagents. Pi's `createPiPaseoExtensionFile` injects its extension the same way.
@@ -1,4 +0,0 @@
- Redesigned model picker: Pick models from a two-pane desktop view with cross-provider search, an in-place phone drawer with a thinking slider, and per-provider model lists in settings.
- File actions and filter: Filter the Files tree by name, and reveal, open in your default app, download, or copy paths from chat file links, file tabs, and sidebar trees.
Full notes: https://paseo.sh/changelog
@@ -1,4 +0,0 @@
- Redesigned model picker: Pick models from a two-pane desktop view with cross-provider search, an in-place phone drawer with a thinking slider, and per-provider model lists in settings.
- File actions and filter: Filter the Files tree by name, and reveal, open in your default app, download, or copy paths from chat file links, file tabs, and sidebar trees.
Full notes: https://paseo.sh/changelog
@@ -1,4 +0,0 @@
- Redesigned model picker: Pick models from a two-pane desktop view with cross-provider search, an in-place phone drawer with a thinking slider, and per-provider model lists in settings.
- File actions and filter: Filter the Files tree by name, and reveal, open in your default app, download, or copy paths from chat file links, file tabs, and sidebar trees.
Full notes: https://paseo.sh/changelog
@@ -1,4 +0,0 @@
- Redesigned model picker: Pick models from a two-pane desktop view with cross-provider search, an in-place phone drawer with a thinking slider, and per-provider model lists in settings.
- File actions and filter: Filter the Files tree by name, and reveal, open in your default app, download, or copy paths from chat file links, file tabs, and sidebar trees.
Full notes: https://paseo.sh/changelog
+1 -1
View File
@@ -1 +1 @@
sha256-vrmauZ6dprc1M88FePLIvVT6FhgnmS9HjHGzPcCypyk=
sha256-34bUBmRmjekbUSp93597GLTmSWKt23TCHaK3ViXG+iU=
+29 -29
View File
@@ -1,12 +1,12 @@
{
"name": "paseo",
"version": "0.18.2",
"version": "0.18.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "paseo",
"version": "0.18.2",
"version": "0.18.1",
"hasInstallScript": true,
"license": "Apache-2.0",
"workspaces": [
@@ -37543,7 +37543,7 @@
},
"packages/app": {
"name": "@getpaseo/app",
"version": "0.18.2",
"version": "0.18.1",
"dependencies": {
"@codemirror/commands": "6.10.4",
"@codemirror/language": "6.12.4",
@@ -39696,13 +39696,13 @@
},
"packages/cli": {
"name": "@getpaseo/cli",
"version": "0.18.2",
"version": "0.18.1",
"license": "Apache-2.0",
"dependencies": {
"@clack/prompts": "^1.0.0",
"@getpaseo/client": "0.18.2",
"@getpaseo/protocol": "0.18.2",
"@getpaseo/server": "0.18.2",
"@getpaseo/client": "0.18.1",
"@getpaseo/protocol": "0.18.1",
"@getpaseo/server": "0.18.1",
"chalk": "^5.3.0",
"commander": "^12.0.0",
"mime-types": "^2.1.35",
@@ -39949,11 +39949,11 @@
},
"packages/client": {
"name": "@getpaseo/client",
"version": "0.18.2",
"version": "0.18.1",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/protocol": "0.18.2",
"@getpaseo/relay": "0.18.2",
"@getpaseo/protocol": "0.18.1",
"@getpaseo/relay": "0.18.1",
"ws": "^8.20.0",
"zod": "^4.4.3"
},
@@ -39965,7 +39965,7 @@
},
"packages/desktop": {
"name": "@getpaseo/desktop",
"version": "0.18.2",
"version": "0.18.1",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/cli": "*",
@@ -40208,7 +40208,7 @@
},
"packages/expo-two-way-audio": {
"name": "@getpaseo/expo-two-way-audio",
"version": "0.18.2",
"version": "0.18.1",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.5.14",
@@ -40254,7 +40254,7 @@
},
"packages/highlight": {
"name": "@getpaseo/highlight",
"version": "0.18.2",
"version": "0.18.1",
"license": "Apache-2.0",
"dependencies": {
"@codemirror/language": "6.12.4",
@@ -40284,7 +40284,7 @@
},
"packages/plugin": {
"name": "@getpaseo/plugin",
"version": "0.18.2",
"version": "0.18.1",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "^1.4.0",
@@ -40292,8 +40292,8 @@
"use-sync-external-store": "^1.6.0"
},
"devDependencies": {
"@getpaseo/client": "0.18.2",
"@getpaseo/protocol": "0.18.2",
"@getpaseo/client": "0.18.1",
"@getpaseo/protocol": "0.18.1",
"@types/node": "^20.9.0",
"@types/react": "~19.2.0",
"react": "19.2.3",
@@ -40303,8 +40303,8 @@
"zod": "^4.4.3"
},
"peerDependencies": {
"@getpaseo/client": "0.18.2",
"@getpaseo/protocol": "0.18.2",
"@getpaseo/client": "0.18.1",
"@getpaseo/protocol": "0.18.1",
"react": ">=19.1.0 <20",
"react-native": ">=0.81.5",
"zod": "^4.4.3"
@@ -40326,7 +40326,7 @@
},
"packages/protocol": {
"name": "@getpaseo/protocol",
"version": "0.18.2",
"version": "0.18.1",
"license": "Apache-2.0",
"dependencies": {
"semver": "^7.8.5",
@@ -40353,7 +40353,7 @@
}
},
"packages/react-native-enriched-markdown": {
"version": "0.18.2",
"version": "0.18.1",
"hasInstallScript": true,
"license": "MIT",
"peerDependencies": {
@@ -40369,7 +40369,7 @@
},
"packages/relay": {
"name": "@getpaseo/relay",
"version": "0.18.2",
"version": "0.18.1",
"license": "Apache-2.0",
"dependencies": {
"@noble/ciphers": "^2.4.0",
@@ -40591,17 +40591,17 @@
},
"packages/server": {
"name": "@getpaseo/server",
"version": "0.18.2",
"version": "0.18.1",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "^0.17.1",
"@anthropic-ai/claude-agent-sdk": "0.3.326",
"@anthropic-ai/sdk": "^0.104.2",
"@getpaseo/client": "0.18.2",
"@getpaseo/highlight": "0.18.2",
"@getpaseo/plugin": "0.18.2",
"@getpaseo/protocol": "0.18.2",
"@getpaseo/relay": "0.18.2",
"@getpaseo/client": "0.18.1",
"@getpaseo/highlight": "0.18.1",
"@getpaseo/plugin": "0.18.1",
"@getpaseo/protocol": "0.18.1",
"@getpaseo/relay": "0.18.1",
"@isaacs/ttlcache": "^2.1.4",
"@modelcontextprotocol/node": "2.1.2",
"@modelcontextprotocol/sdk": "1.29.0",
@@ -41552,7 +41552,7 @@
},
"packages/website": {
"name": "@getpaseo/website",
"version": "0.18.2",
"version": "0.18.1",
"dependencies": {
"@cloudflare/vite-plugin": "^1.29.1",
"@cloudflare/workers-types": "^4.20260317.1",
@@ -43178,7 +43178,7 @@
},
"plugins": {
"name": "@getpaseo/builtin-plugins",
"version": "0.18.2",
"version": "0.18.1",
"dependencies": {
"@getpaseo/plugin": "*",
"zod": "^4.4.3"
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "paseo",
"version": "0.18.2",
"version": "0.18.1",
"private": true,
"description": "Paseo: voice-controlled development environment for local AI coding agents",
"keywords": [
@@ -99,7 +99,7 @@
"web": "npm run web --workspace=@getpaseo/app",
"dev:desktop": "cross-env PASEO_LISTEN=127.0.0.1:6768 npm run dev --workspace=@getpaseo/desktop",
"dev:win:desktop": "npm run dev:win --workspace=@getpaseo/desktop",
"build:desktop": "npm run build:app-deps:clean && cd packages/app && cross-env PASEO_WEB_PLATFORM=electron npx expo export --platform web && cd ../.. && node scripts/precompress-assets.mjs packages/app/dist && npm run build --workspace=@getpaseo/desktop --",
"build:desktop": "npm run build:app-deps:clean && cd packages/app && cross-env PASEO_WEB_PLATFORM=electron npx expo export --platform web && cd ../.. && npm run build --workspace=@getpaseo/desktop --",
"db:query": "npm run db:query --workspace=@getpaseo/server --",
"cli": "./scripts/dev-home.sh npx tsx packages/cli/src/index.js",
"version": "npm run version:sync-internal && npm run fdroid:changelogs && npm run release:prepare && git add -A",
-2
View File
@@ -5,7 +5,6 @@ const withAndroidAsyncStorageSize = require("./plugins/with-android-async-storag
const withAndroidIgnoreBoldText = require("./plugins/with-android-ignore-bold-text");
const withAndroidOptionalCamera = require("./plugins/with-android-optional-camera");
const withAndroidProfileable = require("./plugins/with-android-profileable");
const withAndroidSplashWindowBackground = require("./plugins/with-android-splash-window-background");
const withFdroidAutolinking = require("./plugins/with-fdroid-autolinking");
const withPasteInput = require("./plugins/with-paste-input");
const withAndroidScroll = require("./modules/paseo-scroll/app.plugin");
@@ -166,7 +165,6 @@ export default {
},
},
],
withAndroidSplashWindowBackground,
...buildProfile.notificationPlugins,
"expo-audio",
[
-29
View File
@@ -26,29 +26,6 @@ async function resolveAndroidManifest() {
return exp._internal.modResults.android.manifest.manifest;
}
interface StyleItem {
$: { name: string };
_: string;
}
interface StyleGroup {
$: { name: string };
item?: StyleItem[];
}
async function resolveAndroidAppThemeItems(): Promise<Record<string, string>> {
const { exp } = await getPrebuildConfigAsync(__dirname, { platforms: ["android"] });
await compileModsAsync(exp, {
projectRoot: __dirname,
introspect: true,
platforms: ["android"],
assertMissingModProviders: false,
});
const styles: StyleGroup[] = exp._internal.modResults.android.styles.resources.style;
const appTheme = styles.find((style) => style.$.name === "AppTheme");
return Object.fromEntries((appTheme?.item ?? []).map((item) => [item.$.name, item._]));
}
describe("Android app config", () => {
afterEach(() => {
if (originalFdroidFlag === undefined) {
@@ -81,12 +58,6 @@ describe("Android app config", () => {
},
30_000,
);
// Without it, a dark device paints AppCompat's #303030 between the splash and the first screen.
it("paints the app window in the splash colour", async () => {
const appTheme = await resolveAndroidAppThemeItems();
expect(appTheme["android:windowBackground"]).toBe("@color/splashscreen_background");
}, 30_000);
});
it("follows system rotation on Android", async () => {
@@ -128,45 +128,6 @@ test.describe("Agent profiles in the model picker", () => {
}
});
test("the compact drawer keeps a running agent's Profiles collapsed and its rows one height", async ({
page,
}, testInfo) => {
const seed = await seedAgentProfiles([PROFILE]);
const workspace = await seedMockAgentWorkspace({
repoPrefix: "agent-profiles-compact-running-",
title: "Agent profiles compact running",
model: "ten-second-stream",
modeId: "load-test",
});
try {
await page.setViewportSize({ width: 390, height: 800 });
await openAgentRoute(page, workspace);
await expectComposerVisible(page);
await page.getByTestId("combined-model-selector").filter({ visible: true }).first().click();
await expect(page.getByTestId("agent-controls-profiles")).toBeVisible();
await expect(page.getByTestId("agent-controls-profiles-list")).toHaveCount(0);
// Settings rows (Model, switches) sit in the same list as the Profiles header and mode rows.
const sheet = page.getByTestId("agent-controls-settings-list");
const rows = [
sheet.getByTestId("agent-controls-profiles"),
sheet.getByTestId("agent-controls-model"),
sheet.locator('[data-testid^="mode-option-"]').first(),
];
const heights = [];
for (const row of rows) {
await expect(row).toBeVisible();
heights.push(Math.round((await row.boundingBox())!.height));
}
await page.screenshot({ path: testInfo.outputPath("compact-agent-settings.png") });
expect(new Set(heights).size, `row heights ${heights.join(", ")}`).toBe(1);
} finally {
await workspace.cleanup();
await seed.restore();
}
});
test("a model row and its create-profile action are separate buttons", async ({ page }) => {
const seed = await seedAgentProfiles([]);
const workspace = await seedMockAgentWorkspace({
@@ -1,6 +1,6 @@
import { readFile, writeFile } from "node:fs/promises";
import path from "node:path";
import { expect, test, type Page } from "../support/fixtures";
import { expect, test } from "../support/fixtures";
import { expectComposerVisible } from "../support/helpers/composer";
import { installDaemonWebSocketGate } from "../support/helpers/daemon-websocket-gate";
import { installLocalDesktopHost } from "../support/helpers/local-desktop-host";
@@ -282,63 +282,3 @@ test("compact opens files and subagents in a sheet, leaving the tabs for agents"
await workspace.cleanup();
}
});
async function openFileAndDismissDuringAnimation(page: Page) {
const fileLink = page.getByText(FILE_LINK, { exact: true });
await expect(fileLink).toBeVisible({ timeout: 15_000 });
// Check and press in the same browser frame so automation cannot outlast the opening animation.
await fileLink.evaluate((link) => {
if (!(link instanceof HTMLElement)) throw new Error("Expected an HTML file link");
return new Promise<void>((resolve, reject) => {
const timeout = window.setTimeout(() => {
cancelAnimationFrame(frame);
reject(new Error("The file sheet did not pass through the opening position"));
}, 5_000);
const dismissDuringOpening = () => {
const header = document.querySelector('[data-testid="sheet-tab-header"]');
const top = header?.getBoundingClientRect().top ?? window.innerHeight;
const pressTarget = document.elementFromPoint(10, 10);
if (
top > window.innerHeight / 2 &&
top < window.innerHeight &&
pressTarget instanceof HTMLElement &&
pressTarget.getAttribute("aria-label") === "Bottom sheet backdrop"
) {
window.clearTimeout(timeout);
pressTarget.click();
resolve();
return;
}
frame = requestAnimationFrame(dismissDuringOpening);
};
let frame = requestAnimationFrame(dismissDuringOpening);
link.click();
});
});
}
test("a sheet dismissed while it is still opening closes its tab", async ({ page }) => {
await page.setViewportSize({ width: 390, height: 844 });
const workspace = await seedMockAgentWorkspace({
repoPrefix: "compact-sheet-opening-dismiss-",
title: "Sheet parent",
initialPrompt: promptMentioning(FILE_LINK),
});
try {
await writeFile(path.join(workspace.cwd, "linked.ts"), "one\ntwo\nthree\n", "utf8");
await openAgentRoute(page, { workspaceId: workspace.workspaceId, agentId: workspace.agentId });
await openFileAndDismissDuringAnimation(page);
await expectNoSheetOpen(page);
await expectOpenTabCount(page, 1);
await page
.getByRole("button", { name: /Switch tabs/ })
.filter({ visible: true })
.click();
await expect(page.getByText("Workspace tabs", { exact: true })).toBeVisible();
} finally {
await workspace.cleanup();
}
});
@@ -317,16 +317,13 @@ test.describe("Cross-provider model search", () => {
await expectComposerFocused(page);
});
await test.step("the compact drawer opens a new agent's Profiles above Model on Home and keeps provider headers stable on collapse", async () => {
await test.step("the compact drawer surfaces collapsed Profiles above Model on Home and keeps provider headers stable on collapse", async () => {
await page.setViewportSize({ width: 390, height: 800 });
await page.getByTestId("combined-model-selector").filter({ visible: true }).first().click();
const profilesToggle = page.getByTestId("agent-controls-profiles");
const profilesList = page.getByTestId("agent-controls-profiles-list");
const modelRowButton = page.getByTestId("agent-controls-model");
await expect(profilesToggle).toBeVisible();
await expect(profilesList).toBeVisible();
await profilesToggle.click();
await expect(profilesList).toHaveCount(0);
await expect(page.getByTestId("agent-controls-profiles-list")).toHaveCount(0);
await waitForSettledPosition(profilesToggle);
const profilesBox = await profilesToggle.boundingBox();
const modelBox = await modelRowButton.boundingBox();
@@ -364,7 +361,6 @@ test.describe("Cross-provider model search", () => {
// Return Home, expand Profiles in place, and apply the profile.
await page.getByTestId("sheet-header-back").click();
await expect(profilesList).toHaveCount(0);
await profilesToggle.click();
const sheetProfileRow = page.getByTestId("model-profile-row-agent_profile_e2e_arrows");
await expect(sheetProfileRow).toBeVisible();
@@ -1,4 +1,3 @@
import { createServer, type Socket } from "node:net";
import { expect, test, type Page } from "../support/fixtures";
import { gotoAppShell } from "../support/helpers/app";
import { addScheduleHostAndReload, createScheduleHost } from "../support/helpers/schedule-host";
@@ -142,68 +141,6 @@ async function findScheduleIdByName(workspace: SeededWorkspace, name: string): P
return schedule.id;
}
async function createConnectingHost() {
const sockets = new Set<Socket>();
// Accept TCP without completing the WebSocket handshake, like a stalled host.
const server = createServer((socket) => {
sockets.add(socket);
socket.on("close", () => sockets.delete(socket));
});
await new Promise<void>((resolve, reject) => {
server.once("error", reject);
server.listen(0, "127.0.0.1", resolve);
});
const address = server.address();
if (!address || typeof address === "string") throw new Error("Expected a TCP address");
return {
port: address.port,
close: async () => {
for (const socket of sockets) socket.destroy();
await new Promise<void>((resolve, reject) => {
server.close((error) => {
if (error) {
reject(error);
return;
}
resolve();
});
});
},
};
}
async function openSchedulesWithConnectingHost(
page: Page,
cleanupTasks: Array<() => Promise<void>>,
): Promise<void> {
const workspace = await seedWorkspace({ repoPrefix: "schedule-partial-hosts-", git: false });
cleanupTasks.push(() => workspace.cleanup());
const stalledHost = await createConnectingHost();
cleanupTasks.push(() => stalledHost.close());
await gotoAppShell(page);
await waitForSidebarHydration(page);
await page.goto(buildSchedulesRoute());
await addScheduleHostAndReload({
page,
serverId: "stalled-schedule-host",
label: "Connecting host",
port: stalledHost.port,
});
}
async function expectPartialEmptySchedules(page: Page): Promise<void> {
await expect(page.getByText("No active schedules", { exact: true })).toBeVisible();
await expect(page.getByText("Connecting host: Still connecting", { exact: true })).toBeVisible();
await expect(page.getByRole("button", { name: "New schedule", exact: true })).toBeVisible();
}
async function expectScheduleCreationAvailable(page: Page): Promise<void> {
await openNewScheduleSheet(page);
await page.getByRole("button", { name: "Cancel", exact: true }).click();
await expect(page.getByTestId("schedule-form-sheet")).toHaveCount(0);
}
test.describe("Schedules project target", () => {
const cleanupTasks: Array<() => Promise<void>> = [];
@@ -214,12 +151,6 @@ test.describe("Schedules project target", () => {
cleanupTasks.length = 0;
});
test("shows empty schedules while another host is still connecting", async ({ page }) => {
await openSchedulesWithConnectingHost(page, cleanupTasks);
await expectPartialEmptySchedules(page);
await expectScheduleCreationAvailable(page);
});
test("dismisses the new schedule sheet without reopening", async ({ page }) => {
const workspace = await seedWorkspace({ repoPrefix: "schedule-sheet-dismiss-", git: false });
cleanupTasks.push(() => workspace.cleanup());
@@ -46,7 +46,7 @@ import { installDaemonWebSocketGate } from "../support/helpers/daemon-websocket-
import { addConnectedHostAndReload, addOfflineHostAndReload } from "../support/helpers/hosts";
import { startIsolatedHostDaemon } from "../support/helpers/isolated-host-daemon";
const LOADING_WORKSPACE_TEST_ID = "workspace-loading";
const LOADING_WORKSPACE_TEXT_PATTERN = /Loading workspace/i;
async function expectNoLoadingWorkspacePane(
page: Page,
input: { label: string; durationMs?: number },
@@ -63,7 +63,7 @@ async function expectNoLoadingWorkspacePane(
.catch((error) => `[body unavailable: ${error instanceof Error ? error.message : error}]`);
samples.push(`${Date.now() - startedAt}ms ${url}\n${text.slice(0, 1000)}`);
if ((await page.getByTestId(LOADING_WORKSPACE_TEST_ID).count()) > 0) {
if (LOADING_WORKSPACE_TEXT_PATTERN.test(text)) {
throw new Error(
`${input.label}: loading workspace pane appeared during reconnect window.\n\n${samples.join(
"\n\n---\n\n",
@@ -76,7 +76,7 @@ async function expectNoLoadingWorkspacePane(
}
async function expectNoLoadingPane(page: Page): Promise<void> {
await expect(page.getByTestId(LOADING_WORKSPACE_TEST_ID)).toHaveCount(0);
await expect(page.getByText(LOADING_WORKSPACE_TEXT_PATTERN)).toHaveCount(0);
}
async function getVisibleDraftTabCount(page: Page): Promise<number> {
@@ -1,7 +1,7 @@
// Composer autocomplete placement on iOS with the software keyboard: chat, workspace
// draft tab, and New workspace. Run where agent-device reaches the simulator, with the
// development app connected to the fixture host. See docs/mobile-testing.md.
import { execFileSync, spawn } from "node:child_process";
import { execFileSync } from "node:child_process";
import fs from "node:fs";
import path from "node:path";
import process from "node:process";
@@ -391,222 +391,6 @@ async function runControlTaps() {
);
}
// Fullscreen is a layout mode of the same mounted editor: the toggle keeps its focus and
// the keyboard, and each mode lands at its resting place. A focus loss used to close
// the keyboard on every toggle, and a stale keyboard lift left the fullscreen composer
// 310pt above the screen with only Send visible. Sample for a while after each
// toggle, because the stale lift could land late.
const fullscreenDraft = Array.from(
{ length: 8 },
(_, line) => `Line ${line + 1} of the fullscreen draft`,
).join("\n");
async function assertFullscreenToggleHolds(name, place) {
const deadline = Date.now() + 2_500;
let samples = 0;
while (Date.now() < deadline || samples < 3) {
const snap = snapshot(`${name}-${samples}`);
samples += 1;
// A dismissed keyboard stays in the tree for a while, parked below the screen.
const screen = snap.data.nodes.find((node) => node.type === "Application").rect;
if (!keyboardShown(snap) || keyboardTop(snap) >= screen.y + screen.height)
throw new Error(`${name}: the toggle closed the keyboard`);
const problem = place(snap, keyboardTop(snap));
if (problem) throw new Error(`${name}: ${problem}`);
}
process.stdout.write(`PASS ${name}: keyboard open and placement held over ${samples} samples\n`);
}
// New workspace submits with Create where a chat has Send.
const sendButton = (snap) =>
snap.data.nodes.find(
(node) =>
node.type === "Button" &&
node.rect &&
(node.label === "Send message" || node.identifier === "workspace-create-submit"),
)?.rect;
const enteredFullscreen = (snap, keyboard) => {
const frame = nodeById(snap, "composer-fullscreen")?.rect;
const send = sendButton(snap);
if (!frame || !send) return "fullscreen composer or Send is missing";
// The frame fills the screen below the safe area, behind the keyboard.
if (frame.y < 0 || frame.y + frame.height < keyboard)
return `fullscreen composer spans ${Math.round(frame.y)}-${Math.round(frame.y + frame.height)}, not the screen behind the keyboard at ${Math.round(keyboard)}`;
if (send.y + send.height > keyboard + 1)
return `Send ends at ${Math.round(send.y + send.height)}, below the keyboard at ${Math.round(keyboard)}`;
return null;
};
// Leaving fullscreen returns the composer to where it rested on the keyboard before.
const exitedFullscreen = (resting) => (snap) => {
if (nodeById(snap, "composer-fullscreen")) return "still fullscreen";
const composer = nodeById(snap, "message-input-root")?.rect;
if (!composer) return "composer is missing";
const bottom = composer.y + composer.height;
if (Math.abs(bottom - resting) > 1)
return `composer ends at ${Math.round(bottom)}, not at its resting ${Math.round(resting)}`;
return null;
};
// Snapshots sample about once a second, so they cannot see one wrong frame. Record the
// screen through a run of toggles instead: Send has one place inline and one in
// fullscreen, and every recorded frame must draw it at one of the two. A keyboard lift
// that landed a frame after its layout drew Send 310pt higher for that frame. Needs
// ffmpeg on the PATH.
async function assertSendHoldsEveryFrame(name, { screen, keyboard, sends, toggle }) {
const video = path.join(artifactsDir, `${name.replaceAll(" ", "-")}.mp4`);
const recorder = spawn(
"xcrun",
["simctl", "io", udid ?? "booted", "recordVideo", "--codec", "h264", "--force", video],
{ stdio: ["ignore", "ignore", "pipe"] },
);
const finished = new Promise((resolve) => recorder.once("exit", resolve));
await new Promise((resolve, reject) => {
recorder.stderr.on("data", (chunk) => {
if (String(chunk).includes("Recording started")) resolve();
});
finished.then(() => reject(new Error(`${name}: the screen recording did not start`)));
});
// The first frame is the settled inline composer.
await sleep(500);
await toggle();
await sleep(1_000);
recorder.kill("SIGINT");
await finished;
// Decode the column of the screen that holds Send in both modes, one pixel per point.
const left = Math.floor(Math.min(...sends.map((send) => send.x)));
const right = Math.ceil(Math.max(...sends.map((send) => send.x + send.width)));
const width = right - left;
const height = Math.round(screen.height);
const column = `crop=iw*${width / screen.width}:ih:iw*${left / screen.width}:0,scale=${width}:${height}`;
const pixels = execFileSync(
"ffmpeg",
["-loglevel", "fatal", "-i", video, "-fps_mode", "passthrough", "-vf", column].concat([
"-f",
"rawvideo",
"-pix_fmt",
"rgb24",
"-",
]),
{ maxBuffer: 1024 ** 3 },
);
const frameSize = width * height * 3;
const frameCount = Math.floor(pixels.length / frameSize);
if (frameCount < 2) throw new Error(`${name}: the recording holds ${frameCount} frames`);
// Send's colour is the commonest one in the middle of its inline rect.
const [inline] = sends;
const counts = new Map();
for (let y = inline.y + inline.height / 4; y < inline.y + (inline.height * 3) / 4; y += 1) {
for (let x = inline.x + inline.width / 4; x < inline.x + (inline.width * 3) / 4; x += 1) {
const at = (Math.round(y) * width + Math.round(x - left)) * 3;
const colour = (pixels[at] >> 3) * 1024 + (pixels[at + 1] >> 3) * 32 + (pixels[at + 2] >> 3);
counts.set(colour, (counts.get(colour) ?? 0) + 1);
}
}
const [accent] = [...counts].sort((a, b) => b[1] - a[1])[0];
const isAccent = (at) =>
Math.abs((pixels[at] >> 3) - Math.floor(accent / 1024)) <= 2 &&
Math.abs((pixels[at + 1] >> 3) - (Math.floor(accent / 32) % 32)) <= 2 &&
Math.abs((pixels[at + 2] >> 3) - (accent % 32)) <= 2;
// The vertical centre of the rows Send's colour fills, above the keyboard.
const sendCentre = (frame) => {
const rows = [];
for (let y = 0; y < Math.floor(keyboard); y += 1) {
let filled = 0;
for (let x = 0; x < width; x += 1) {
if (isAccent(frame * frameSize + (y * width + x) * 3)) filled += 1;
}
if (filled >= inline.width * 0.4) rows.push(y);
}
return rows.length > 0 ? (rows[0] + rows.at(-1) + 1) / 2 : null;
};
const places = [];
for (let frame = 0; frame < frameCount; frame += 1) {
const centre = sendCentre(frame);
const known = places.some(
(place) =>
place === centre || (place !== null && centre !== null && Math.abs(place - centre) <= 2),
);
if (known) continue;
if (places.length === 2) {
const drawn = centre === null ? "did not draw Send" : `drew Send at ${Math.round(centre)}`;
throw new Error(
`${name}: frame ${frame + 1} of ${frameCount} ${drawn}; it rests at ${places.map((place) => (place === null ? "nowhere" : Math.round(place))).join(" and ")}. See ${video}`,
);
}
places.push(centre);
}
if (places.length !== 2 || places.includes(null))
throw new Error(`${name}: expected Send at two places, saw ${places.join(" and ")}`);
process.stdout.write(
`PASS ${name}: Send drawn only at ${places.map(Math.round).join(" and ")} over ${frameCount} frames\n`,
);
}
async function runFullscreenToggles(host) {
// The enter glyph sits in the input's own padding, so selectors report it covered.
const buttonCentre = (name, snap, label) => {
const button = snap.data.nodes.find(
(node) => node.type === "Button" && node.label === label && node.rect,
)?.rect;
if (!button) throw new Error(`${name}: missing ${label}`);
return [
String(Math.round(button.x + button.width / 2)),
String(Math.round(button.y + button.height / 2)),
];
};
const pressButton = (name, label) => ad("press", ...buttonCentre(name, snapshot(name), label));
// A run that failed in fullscreen leaves the composer there.
if (nodeById(snapshot(`${host}-fullscreen-start`), "composer-fullscreen"))
pressButton(`${host} fullscreen start`, "Exit fullscreen");
await clearInput(`${host}-fullscreen`);
ad("type", fullscreenDraft);
const typed = nodeById(
await settledWithKeyboard(`${host}-fullscreen-typed`, "message-input-root"),
"message-input-root",
).rect;
const resting = typed.y + typed.height;
for (let round = 1; round <= 4; round += 1) {
pressButton(`${host} fullscreen enter ${round} button`, "Fullscreen");
await assertFullscreenToggleHolds(`${host} fullscreen enter ${round}`, enteredFullscreen);
pressButton(`${host} fullscreen exit ${round} button`, "Exit fullscreen");
await assertFullscreenToggleHolds(
`${host} fullscreen exit ${round}`,
exitedFullscreen(resting),
);
}
const inline = snapshot(`${host}-fullscreen-frames-inline`);
const enter = buttonCentre(`${host} fullscreen frames`, inline, "Fullscreen");
ad("press", ...enter);
const entered = await waitFor(`${host}-fullscreen-frames-entered`, (snap) =>
Boolean(nodeById(snap, "composer-fullscreen") && sendButton(snap)),
);
const exit = buttonCentre(`${host} fullscreen frames`, entered, "Exit fullscreen");
ad("press", ...exit);
await waitFor(
`${host}-fullscreen-frames-exited`,
(snap) => !nodeById(snap, "composer-fullscreen"),
);
await assertSendHoldsEveryFrame(`${host} fullscreen frames`, {
screen: inline.data.nodes.find((node) => node.type === "Application").rect,
keyboard: keyboardTop(inline),
sends: [sendButton(inline), sendButton(entered)],
toggle: async () => {
for (let round = 1; round <= 8; round += 1) {
ad("press", ...enter);
await sleep(600);
ad("press", ...exit);
await sleep(600);
}
},
});
await clearInput(`${host}-fullscreen-done`);
}
if (scenario !== "all") {
ad(
"open",
@@ -619,13 +403,7 @@ if (scenario !== "all") {
if (scenario === "growth") await runLiveGrowth();
else if (scenario === "previews") await runBoundedPreview();
else if (scenario === "controls") await runControlTaps();
else if (scenario === "fullscreen") {
await runFullscreenToggles("draft");
// New workspace hides its header in fullscreen, which resizes the dock on each toggle.
ad("open", `paseo://new?serverId=${serverId}`, "--platform", "ios", ...deviceArgs);
await waitFor("new-workspace", (snap) => Boolean(nodeById(snap, "message-input-root")), 60_000);
await runFullscreenToggles("new-workspace");
} else throw new Error(`Unknown scenario: ${scenario}`);
else throw new Error(`Unknown scenario: ${scenario}`);
process.stdout.write(`Composer ${scenario} regression passed. Artifacts: ${artifactsDir}\n`);
process.exit(0);
}
@@ -1,61 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
# Open Pi settings from the Android model picker. Scroll the sheet body until
# most of the Models list is visible. Use a host with several Pi models and
# the default shown-models selection.
session="${1:?Pass the agent-device session with the Pi provider sheet open}"
artifacts="${2:-.artifacts/provider-model-scroll}"
mkdir -p "$artifacts"
ad() {
agent-device "$@" --session "$session"
}
visible_rows() {
jq -ce '
.data.nodes as $nodes
| ($nodes[] | select(.identifier == "provider-discovered-models")) as $list
| [$nodes[]
| select((.identifier // "") | startswith("provider-shown-model-"))
| select(.rect.height > 0 and .rect.y < ($list.rect.y + $list.rect.height))
| select(.rect.y + .rect.height > $list.rect.y)
| .label]
| select(length > 1)
' "$1"
}
ad snapshot --json > "$artifacts/before.json"
read -r x y dy < <(jq -er '
.data.nodes[]
| select(.identifier == "provider-discovered-models" and .rect.height >= 350)
| .rect
| [(.x + .width / 2 | floor), (.y + .height * 0.7 | floor), (-.height * 0.5 | floor)]
| @tsv
' "$artifacts/before.json") || {
printf 'Scroll the sheet body until the Models list is visible.\n' >&2
exit 1
}
before=$(visible_rows "$artifacts/before.json")
ad gesture pan "$x" "$y" 0 "$dy" 580
ad snapshot --json > "$artifacts/after.json"
after=$(visible_rows "$artifacts/after.json")
printf 'Before %s\nAfter %s\n' "$before" "$after"
first=$(jq -r '.[0]' <<<"$before")
if jq -e --arg first "$first" 'index($first) != null' <<<"$after" >/dev/null; then
printf 'The first model stayed visible after the upward drag.\n' >&2
exit 1
fi
model=$(jq -r '.[1]' <<<"$after")
ad press "role=checkbox label=\"$model\"" --settle
ad snapshot --json > "$artifacts/checked.json"
jq -e --arg model "$model" '
any(.data.nodes[]; .kind == "checkbox" and .label == $model and .checked == true)
' "$artifacts/checked.json" >/dev/null
ad press 'id="provider-shown-models-reset"' --settle
ad snapshot --json > "$artifacts/reset.json"
jq -e --arg model "$model" '
any(.data.nodes[]; .kind == "checkbox" and .label == $model and .checked == false)
' "$artifacts/reset.json" >/dev/null
@@ -173,11 +173,8 @@ export async function expectHostConnectingOrOffline(
page: Page,
options?: { timeout?: number },
): Promise<void> {
// A host that is still connecting shows the workspace loading state; one that failed says so.
await expect(
page
.getByTestId("workspace-loading")
.or(page.getByText(/localhost is offline|Cannot reach localhost/i)),
page.getByText(/^Connecting$|localhost is offline|Cannot reach localhost/i),
).toBeVisible({ timeout: options?.timeout ?? 30_000 });
}
-2
View File
@@ -1,8 +1,6 @@
// Install runtime polyfills before any other module evaluates. Keep this the first import.
// oxlint-disable-next-line import/no-unassigned-import -- Polyfills install on import.
import "./src/polyfills/install-early";
import { keepNativeSplash } from "./src/native-splash";
keepNativeSplash();
// Configure Unistyles before Expo Router pulls in any components using StyleSheet.
import "./src/styles/unistyles";
@@ -63,8 +63,6 @@ using namespace facebook::react;
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
// The iOS status-bar tap region can overlap app header buttons (#11027).
self.scrollView.scrollsToTop = NO;
#if defined(__IPHONE_26_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_26_0
if (@available(iOS 26.0, *)) {
UIScrollView *scrollView = self.scrollView;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/app",
"version": "0.18.2",
"version": "0.18.1",
"private": true,
"main": "index.ts",
"scripts": {
@@ -1,22 +0,0 @@
const { AndroidConfig, withAndroidStyles } = require("expo/config-plugins");
// The activity window shows under the splash while it fades out and until React
// paints. Expo's AppTheme sets no window background, so Android paints the
// AppCompat default (#303030 in dark mode, #fafafa in light mode) there.
// expo-splash-screen already defines `splashscreen_background` for day and night,
// so pointing the window at it keeps one colour from launch to the first screen.
const WINDOW_BACKGROUND = "@color/splashscreen_background";
function withAndroidSplashWindowBackground(config) {
return withAndroidStyles(config, (modConfig) => {
modConfig.modResults = AndroidConfig.Styles.assignStylesValue(modConfig.modResults, {
add: true,
parent: AndroidConfig.Styles.getAppThemeGroup(),
name: "android:windowBackground",
value: WINDOW_BACKGROUND,
});
return modConfig;
});
}
module.exports = withAndroidSplashWindowBackground;
@@ -43,8 +43,6 @@ export interface AgentProfilePickerRow {
export interface AgentProfilePicker {
rows: AgentProfilePickerRow[];
applyProfile: (profileId: string) => void;
/** What a picked profile configures: a running agent, or the draft of a new one. */
target: AgentProfileApplyTarget["kind"];
}
export interface UseAgentProfilePickerInput {
@@ -168,7 +166,7 @@ export function useAgentProfilePicker(
);
return useMemo(
() => (isSupported && profiles !== null ? { rows, applyProfile, target: target.kind } : null),
[applyProfile, isSupported, profiles, rows, target.kind],
() => (isSupported && profiles !== null ? { rows, applyProfile } : null),
[applyProfile, isSupported, profiles, rows],
);
}
@@ -26,10 +26,8 @@ import {
} from "@legendapp/list/react-native";
import { withUnistyles } from "react-native-unistyles";
import { LoadingSpinner } from "@/components/ui/loading-spinner";
import { LoadingState } from "@/components/ui/loading-state";
import { Button } from "@/components/ui/button";
import { useRetainedPanelActive } from "@/components/retained-panel";
import { useNativeSplashHold } from "@/native-splash";
import { useTranslation } from "react-i18next";
import type { StreamItem } from "@/types/stream";
import type { Theme } from "@/styles/theme";
@@ -763,9 +761,6 @@ function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrat
);
}, [historyStartPaginationState, hasOlderHistory, retryHistoryStart, t]);
// The launch splash stays up until the visible conversation has placed its rows. A hidden first
// fill means the cache had no history, so it waits on the host and shows its own loading state.
useNativeSplashHold(isActive && !isListPlaced);
const canExpandDrawDistance =
drawDistance < NATIVE_STREAM_DRAW_DISTANCE &&
isActive &&
@@ -812,8 +807,8 @@ function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrat
<InitialDrawDistanceExpansion schedule={drawDistanceExpansion.schedule} />
) : null}
{!historyStartPaginationState.visible ? (
<View pointerEvents="none" style={initialFillStyle}>
<LoadingState testID="agent-initial-fill" title={t("agentPanel.states.loadingHistory")} />
<View pointerEvents="none" testID="agent-initial-fill" style={initialFillStyle}>
<ThemedLoadingSpinner size="large" uniProps={foregroundMutedColorMapping} />
</View>
) : null}
</View>
@@ -7,7 +7,7 @@ import { act } from "react";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { RetainedPanelActivity } from "@/components/retained-panel";
import { hydrateStreamState, reduceStreamUpdate, type StreamItem } from "@/types/stream";
import { reduceStreamUpdate, type StreamItem } from "@/types/stream";
import type { StreamRenderInput, StreamSegmentRenderers, StreamViewportHandle } from "./strategy";
import { createWebStreamStrategy } from "./strategy-web";
@@ -1660,86 +1660,4 @@ describe("createWebStreamStrategy", () => {
expect(container.querySelector('[data-testid="agent-chat-scroll"]')).toBe(scrollContainer);
expect(scrollTo).toHaveBeenCalledWith({ top: 2200, behavior: "auto" });
});
it("renders batched user messages sharing a provider messageId without duplicate React keys", () => {
const sharedProviderMessageId = "9ffc3d6e-f0ff-4005-8675-e76e9c5eb5a8";
const historyMounted = hydrateStreamState(
[
{
event: {
type: "timeline",
provider: "claude",
item: {
type: "user_message",
text: "first queued prompt",
messageId: sharedProviderMessageId,
clientMessageId: "client-queued-1",
},
},
timestamp: new Date("2026-11-29T13:00:00.000Z"),
timelineCursor: { epoch: "epoch-1", seq: 1 },
},
{
event: {
type: "timeline",
provider: "claude",
item: {
type: "user_message",
text: "second direct prompt",
messageId: sharedProviderMessageId,
clientMessageId: "client-direct-2",
},
},
timestamp: new Date("2026-11-29T13:00:01.000Z"),
timelineCursor: { epoch: "epoch-1", seq: 2 },
},
],
{ source: "canonical" },
);
const consoleError = vi.spyOn(console, "error").mockImplementation(() => {});
const renderers = createRenderers(() => {});
const strategy = createWebStreamStrategy({ isMobileBreakpoint: false });
container = document.createElement("div");
document.body.appendChild(container);
root = createRoot(container);
const rendered = strategy.render({
agentId: "agent",
segments: { historyVirtualized: [], historyMounted, liveHead: [] },
boundary: {
hasVirtualizedHistory: false,
hasMountedHistory: true,
hasLiveHead: false,
},
renderers,
listEmptyComponent: null,
viewportRef: React.createRef<StreamViewportHandle>(),
routeBottomAnchorRequest: null,
isAuthoritativeHistoryReady: true,
onNearBottomChange: () => {},
onNearHistoryStart: async () => true,
isLoadingOlderHistory: false,
hasOlderHistory: false,
olderHistoryProgressKey: null,
scrollEnabled: true,
listStyle: null,
baseListContentContainerStyle: null,
forwardListContentContainerStyle: null,
contentMaxWidth: DEFAULT_CONTENT_MAX_WIDTH,
});
act(() => {
root?.render(rendered);
});
const isSameKeyMessage = (arg: unknown) => typeof arg === "string" && arg.includes("same key");
const duplicateKeyErrors = consoleError.mock.calls.filter((args) =>
args.some(isSameKeyMessage),
);
expect(duplicateKeyErrors).toEqual([]);
expect(
Array.from(container.querySelectorAll("[data-history-row-id]")).map((node) =>
node.getAttribute("data-history-row-id"),
),
).toEqual(["client-queued-1", "client-direct-2"]);
});
});
@@ -19,7 +19,6 @@ import { flushSync } from "react-dom";
import { withUnistyles } from "react-native-unistyles";
import { useRetainedPanelActive } from "@/components/retained-panel";
import { LoadingSpinner } from "@/components/ui/loading-spinner";
import { LoadingState } from "@/components/ui/loading-state";
import { useStableEvent } from "@/hooks/use-stable-event";
import { useTranslation } from "react-i18next";
import { getStreamItemMessageId, type StreamItem } from "@/types/stream";
@@ -1720,8 +1719,8 @@ function WebStreamViewport(props: StreamRenderInput & { isMobileBreakpoint: bool
</div>
</div>
{!historyStartPaginationState.visible ? (
<div style={initialFillStyle}>
<LoadingState testID="agent-initial-fill" title={t("agentPanel.states.loadingHistory")} />
<div data-testid="agent-initial-fill" style={initialFillStyle}>
<ThemedLoadingSpinner size="large" uniProps={foregroundMutedColorMapping} />
</div>
) : null}
{scrollEnabled && !isMobileBreakpoint ? (
+26 -18
View File
@@ -1,5 +1,4 @@
import { useHardwareKeyboardPresent } from "@/keyboard";
import { LaunchScreen, useNativeSplashLaunchCommit } from "@/native-splash";
import {
WindowLayoutProvider,
WindowLayoutActionsHost,
@@ -83,6 +82,7 @@ import { VoiceProvider } from "@/contexts/voice-context";
import {
resolveStartupBlocker,
resolveStartupNavigationReady,
shouldRunStartupGiveUpTimer,
startHostRuntimeBootstrap,
bindHostRuntimeAppState,
type StartupBlocker,
@@ -156,7 +156,7 @@ polyfillCrypto();
export interface HostRuntimeBootstrapState {
splashError: string | null;
retry: () => void;
isWaitingForHost: boolean;
hasGivenUpWaitingForHost: boolean;
isWaitingForSetup: boolean;
storeReady: boolean;
startupBlocker: StartupBlocker;
@@ -165,7 +165,7 @@ export interface HostRuntimeBootstrapState {
const HostRuntimeBootstrapContext = createContext<HostRuntimeBootstrapState>({
splashError: null,
retry: () => {},
isWaitingForHost: true,
hasGivenUpWaitingForHost: false,
isWaitingForSetup: false,
storeReady: false,
startupBlocker: { kind: "none" },
@@ -262,6 +262,7 @@ function useDaemonStartIsRunning(): boolean {
);
}
const STARTUP_GIVE_UP_TIMEOUT_MS = 5_000;
// How long the splash waits on top of host startup to learn whether setup opens. A slow host
// lands on the home instead, and setup opens over it once it is decided.
const STARTUP_SETUP_WAIT_TIMEOUT_MS = 3_000;
@@ -283,29 +284,20 @@ function HostRuntimeBootstrapProvider({ children }: { children: ReactNode }) {
return bindHostRuntimeAppState(store, AppState);
}, []);
const [isWaitingForHost, setIsWaitingForHost] = useState(true);
useEffect(() => {
let isMounted = true;
const store = getHostRuntimeStore();
const daemonStartService = getDaemonStartService({ store });
void startHostRuntimeBootstrap({
startHostRuntimeBootstrap({
store,
daemonStartService,
shouldStartDaemon: shouldStartBuiltInDaemon,
}).then(() => {
if (isMounted) {
setIsWaitingForHost(false);
}
return;
});
return () => {
isMounted = false;
};
}, []);
const anyOnlineHostServerId = useEarliestOnlineHostServerId();
const daemonStartError = useDaemonStartLastError();
const daemonStartIsRunning = useDaemonStartIsRunning();
const [hasGivenUpWaitingForHost, setHasGivenUpWaitingForHost] = useState(false);
const isDesktopRuntime = shouldUseDesktopDaemon();
const startupBlocker = useMemo(
() =>
@@ -317,6 +309,24 @@ function HostRuntimeBootstrapProvider({ children }: { children: ReactNode }) {
}),
[anyOnlineHostServerId, daemonStartError, daemonStartIsRunning, isDesktopRuntime],
);
const shouldRunGiveUpTimer = shouldRunStartupGiveUpTimer({
startupBlocker,
anyOnlineHostServerId,
hasGivenUpWaitingForHost,
});
useEffect(() => {
if (!shouldRunGiveUpTimer) {
return;
}
const handle = setTimeout(() => {
setHasGivenUpWaitingForHost(true);
}, STARTUP_GIVE_UP_TIMEOUT_MS);
return () => {
clearTimeout(handle);
};
}, [shouldRunGiveUpTimer]);
const isSetupDecisionPending = useIsSetupDecisionPending();
const [hasGivenUpWaitingForSetup, setHasGivenUpWaitingForSetup] = useState(false);
const isWaitingForSetup = isSetupDecisionPending && !hasGivenUpWaitingForSetup;
@@ -347,12 +357,12 @@ function HostRuntimeBootstrapProvider({ children }: { children: ReactNode }) {
() => ({
splashError,
retry,
isWaitingForHost,
hasGivenUpWaitingForHost,
isWaitingForSetup,
storeReady,
startupBlocker,
}),
[splashError, retry, isWaitingForHost, isWaitingForSetup, storeReady, startupBlocker],
[splashError, retry, hasGivenUpWaitingForHost, isWaitingForSetup, storeReady, startupBlocker],
);
return (
@@ -905,7 +915,6 @@ const ROOT_STACK_SCREEN_OWNED_APPEARANCE = ["settings/[section]"] as const;
function RootStack() {
const storeReady = useStoreReady();
useNativeSplashLaunchCommit();
return (
<ThemedStack
screenOptions={ROOT_STACK_SCREEN_OPTIONS}
@@ -1034,7 +1043,6 @@ function RootAppTree() {
</AddHostProvider>
</LucideProvider>
</View>
<LaunchScreen />
</GestureHandlerRootView>
);
}
+10 -14
View File
@@ -24,20 +24,16 @@ export default function HostIndexRoute() {
return <StartupSplashScreen />;
}
// The loading screen stays up until the target route paints; a redirect alone renders nothing.
return (
<>
<StartupSplashScreen />
<Redirect
href={resolveHostIndexRoute({
serverId,
workspaceSelection,
workspaceSelectionStatus: resolveWorkspaceSelectionStatus({
hasHydratedWorkspaces,
workspaceExists: workspaceSelectionExists,
}),
})}
/>
</>
<Redirect
href={resolveHostIndexRoute({
serverId,
workspaceSelection,
workspaceSelectionStatus: resolveWorkspaceSelectionStatus({
hasHydratedWorkspaces,
workspaceExists: workspaceSelectionExists,
}),
})}
/>
);
}
+1 -1
View File
@@ -44,7 +44,7 @@ export default function Index() {
workspaceExists: workspaceSelectionExists,
}),
isWorkspaceSelectionLoaded,
isWaitingForHost: bootstrapState.isWaitingForHost,
hasGivenUpWaitingForHost: bootstrapState.hasGivenUpWaitingForHost,
isWaitingForSetup: bootstrapState.isWaitingForSetup,
});
@@ -308,24 +308,6 @@ describe("parseAssistantFileLink", () => {
});
});
it.each(["C:/repo", "\\\\host\\share\\repo"])(
"leaves Windows variable paths in inline code unlinked in %s",
(workspaceRoot) => {
expect(classifyAssistantFileLink("%TEMP%\\debug.md", { workspaceRoot })).toBeNull();
expect(classifyAssistantFileLink("%LOCALAPPDATA%/debug.md:3", { workspaceRoot })).toBeNull();
expect(classifyAssistantFileLink("C:\\Temp\\debug.md", { workspaceRoot })?.kind).toBe(
"directFile",
);
},
);
it("allows a literal percent-delimited directory in an authored file link", () => {
expect(
parseAssistantFileLink("%TEMP%/notes.md", { workspaceRoot: "C:/repo", explicitLink: true })
?.path,
).toBe("C:/repo/%TEMP%/notes.md");
});
it("parses absolute Windows hrefs inside the active workspace", () => {
expect(
parseAssistantFileLink("C:/repo/src/app.tsx#L12-L20", {
@@ -393,14 +393,6 @@ function parseWorkspaceRelativeFileLink(
value: string,
options: AssistantHrefParseOptions,
): InlinePathTarget | null {
// cmd.exe variables are shell expressions. The file opener only resolves literal paths.
if (
!options.explicitLink &&
/^(?:[A-Za-z]:[\\/]|[\\/]{2})/.test(options.workspaceRoot ?? "") &&
/^%[^%\\/]+%[\\/]/.test(value)
) {
return null;
}
const parsed = parseLocalPathParts(value, options);
if (!parsed || isAbsolutePath(parsed.path)) {
return null;
+2 -3
View File
@@ -4,7 +4,6 @@ import type {
CommandCenterRegistration,
CommandCenterRegistrationOwner,
} from "./contributions";
import { compareText } from "@/utils/collation";
export interface CommandCenterRegistry {
getSnapshot(): CommandCenterContributionSnapshot;
@@ -29,10 +28,10 @@ function compareContributions(
right: CommandCenterContribution,
): number {
if (left.groupRank !== right.groupRank) return left.groupRank - right.groupRank;
const groupDelta = compareText(left.group, right.group);
const groupDelta = left.group.localeCompare(right.group);
if (groupDelta !== 0) return groupDelta;
if (left.rank !== right.rank) return left.rank - right.rank;
return compareText(left.id, right.id);
return left.id.localeCompare(right.id);
}
function sameContributions(
@@ -205,7 +205,6 @@ export function useWorkspaceCommandCenterActions(): void {
const { overrides } = useKeyboardShortcutOverrides();
const { gitActions, isGit, archiveWorkspace } = useGitActions({
serverId: serverId ?? "",
workspaceId,
cwd: cwd ?? "",
icons: GIT_ACTION_ICONS,
});
@@ -1,13 +1,10 @@
import React, { act, useCallback, useState } from "react";
import React, { act } from "react";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { persistAttachmentFromBlob } from "@/attachments/service";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { i18n } from "@/i18n/i18next";
import { WindowLayoutProvider } from "@/window-layout";
import { RetainedPanelActivity } from "@/components/retained-panel";
import { RetainedChatContent as NativeChatContent } from "@/panels/retained-chat-content.native";
import { RetainedChatContent as WebChatContent } from "@/panels/retained-chat-content.web";
import { AttachmentLightbox, type ImageLightboxSource } from "./attachment-lightbox";
interface FrameSample {
@@ -150,48 +147,3 @@ describe("AttachmentLightbox opening in the browser", () => {
await expectOpeningPaintsOnlyTheFittedImage({ type: "uri", uri });
});
});
let openImage: (() => void) | null = null;
function ThreadWithImage({ uri }: { uri: string }) {
const [source, setSource] = useState<ImageLightboxSource | null>(null);
openImage = () => setSource({ type: "uri", uri });
const close = useCallback(() => setSource(null), []);
return <AttachmentLightbox source={source} onClose={close} />;
}
function isLightboxShown(): boolean {
return document.querySelector('[data-testid="attachment-lightbox-backdrop"]') !== null;
}
describe("AttachmentLightbox when its chat leaves the screen", () => {
for (const [platform, ChatContent] of [
["web", WebChatContent],
["native", NativeChatContent],
] as const) {
it(`closes on ${platform} when another session takes over, and stays closed on return`, async () => {
const uri = URL.createObjectURL(await createPng(400, 300));
const showThread = (active: boolean) =>
root.render(
<SafeAreaProvider>
<WindowLayoutProvider>
<RetainedPanelActivity active={active}>
<ChatContent>
<ThreadWithImage uri={uri} />
</ChatContent>
</RetainedPanelActivity>
</WindowLayoutProvider>
</SafeAreaProvider>,
);
await act(async () => showThread(true));
await act(async () => openImage?.());
expect(isLightboxShown()).toBe(true);
await act(async () => showThread(false));
expect(isLightboxShown()).toBe(false);
await act(async () => showThread(true));
expect(isLightboxShown()).toBe(false);
});
}
});
@@ -13,7 +13,6 @@ import {
useAttachmentPreviewUrl,
} from "@/attachments/use-attachment-preview-url";
import { isNative } from "@/constants/platform";
import { useRetainedPanelActive } from "@/components/retained-panel";
import { SPACING } from "@/styles/theme";
import { WindowChromeRootRegion } from "@/utils/desktop-window";
import { ZoomableImage } from "@/components/zoomable-viewport/image";
@@ -43,21 +42,12 @@ export function AttachmentLightbox({ source, onClose }: AttachmentLightboxProps)
const contentSize = source?.type === "uri" ? source.contentSize : undefined;
const [errored, setErrored] = useState(false);
const failed = errored || image.status === "failed";
const panelActive = useRetainedPanelActive();
const open = source !== null && panelActive;
const modalLayer = useGlobalOverlayLayer("modal", open);
const modalLayer = useGlobalOverlayLayer("modal", source !== null);
useEffect(() => {
setErrored(false);
}, [metadata?.id, url]);
// The image belongs to the panel that opened it and closes for good when that panel leaves the
// screen. On web the Modal portals out of the hidden panel, and the hidden chat is frozen on the
// next commit, so the lightbox must also unmount in this inactive commit (see MenuSurface).
useEffect(() => {
if (source !== null && !panelActive) onClose();
}, [onClose, panelActive, source]);
const handleOverlayKeyDown = useCallback(
(event: KeyboardInputEvent) => {
if (event.key !== "Escape") return false;
@@ -70,7 +60,7 @@ export function AttachmentLightbox({ source, onClose }: AttachmentLightboxProps)
);
const setOverlayScope = useOverlayRegistration({
keys: ["Escape"],
active: open,
active: source !== null,
layer: modalLayer,
onKeyDown: handleOverlayKeyDown,
});
@@ -89,7 +79,7 @@ export function AttachmentLightbox({ source, onClose }: AttachmentLightboxProps)
const handleImageError = useCallback(() => setErrored(true), []);
if (!open) {
if (!source) {
return null;
}
@@ -84,9 +84,6 @@ export function DraggableListHandle({ testID, style, children }: DraggableListHa
}
const SCROLL_ENABLED_FLEX_STYLE = { flex: 1 };
// Viewports of rows a nestable list keeps rendered around the container's viewport: two above,
// two below. FlatList's default of 21 would still render a long sidebar in full.
const NESTED_WINDOW_SIZE = 5;
// A drop remounts every row between the drag's start and end slots (see the draggable-flatlist
// patch), so state held inside a rendered row resets when a drop moves it. Keep state that must
@@ -209,12 +206,9 @@ export function DraggableList<T>({
showsVerticalScrollIndicator={showsVerticalScrollIndicator}
scrollEnabled={scrollEnabled}
// A list that doesn't scroll shows every row, so it renders them all in its first commit.
// FlatList's default first render is 10 rows; a list remounted by a drop would paint 10
// rows, then grow on a later commit. A nestable list is the exception: its
// NestableScrollContainer is a VirtualizedList, so it renders only the rows near that
// container's viewport, and a hidden sidebar does not render rows nobody can see.
initialNumToRender={scrollEnabled || nestable ? undefined : data.length}
windowSize={nestable ? NESTED_WINDOW_SIZE : undefined}
// FlatList's default first render is 10 rows; a nested list remounted by a drop would paint
// 10 rows, then grow on a later commit.
initialNumToRender={scrollEnabled ? undefined : data.length}
extraData={extraData}
simultaneousHandlers={simultaneousHandlers}
dragGestureHostPresented={gestureHostPresented}
@@ -688,32 +688,6 @@ it("keeps workspace-relative hover titles on explicit absolute file links", () =
);
});
it.each([
[
"an angle-bracket destination",
"[Open](</repo/src/file.ts>)",
'[Open](</repo/src/file.ts> "src/file.ts")',
],
["an escaped slash", "[Open](\\/repo/src/file.ts)", '[Open](\\/repo/src/file.ts "src/file.ts")'],
[
"an escaped separator",
"[Open](/repo\\/src/file.ts)",
'[Open](/repo\\/src/file.ts "src/file.ts")',
],
[
"a character reference",
"[Open](&#x2F;repo/src/file.ts)",
'[Open](&#x2F;repo/src/file.ts "src/file.ts")',
],
])("keeps the workspace hover title on a link written with %s", (_form, source, rendered) => {
expect(prepareMarkdownSource(source, "/repo").render()).toBe(rendered);
});
it("leaves links outside the workspace as written", () => {
const source = "[Docs](https://example.com/repo/x) and [Other](/repository/x) near /repo/x";
expect(prepareMarkdownSource(source, "/repo").render()).toBe(source);
});
it.each(['""', "''", "()"])("preserves an authored empty link title: %s", (title) => {
const source = `[Open](/repo/file.ts ${title})`;
expect(prepareMarkdownSource(source, "/repo").render()).toBe(source);
@@ -150,13 +150,6 @@ function workspaceHoverTitle(link: Link, markup: string, workspaceRoot?: string)
return link.url.slice(workspaceRoot.length + 1);
}
// Only a link into the workspace gets an edit, its hover title. A link's URL differs from its
// source text only by backslash escapes and character references, and `&` already takes the parse.
function mayLinkIntoWorkspace(source: string, workspaceRoot?: string): boolean {
if (!workspaceRoot || !source.includes("](")) return false;
return source.includes(`${workspaceRoot}/`) || source.includes("\\");
}
/** Preserve source spelling; adapt workspace images, spoiler delimiters, and entity text. */
export function prepareMarkdownSource(
source: string,
@@ -198,7 +191,7 @@ export function prepareMarkdownSource(
!/^[\t >]*[^\t >\r\n][^\r\n]*(?:\r\n|\r|\n)[^\r\n]+(?:\r\n|\r|\n)(?=[\t >:|-]*\|)[\t >|]*:?-[-\t :|]*$/m.test(
source,
) &&
!mayLinkIntoWorkspace(source, workspaceRoot) &&
!(workspaceRoot && source.includes("](")) &&
!(external && /\]|<[a-z]+:/i.test(source))
) {
return { images, ...metadata, render: () => source };
@@ -4,8 +4,8 @@ import { FlatList, Text, View } from "react-native";
import { StyleSheet, withUnistyles } from "react-native-unistyles";
import { AlertTriangle, ChevronDown, Layers } from "lucide-react-native";
import type { AgentProfilePickerRow } from "@/agent-profiles";
import { IndependentScrollBoundary } from "@/components/ui/independent-scroll-boundary";
import {
IndependentScrollBoundary,
MODEL_PICKER_ROW_HEIGHT,
ModelBrowserLoadingState,
ModelBrowserNoProviders,
+29 -5
View File
@@ -12,6 +12,7 @@ import {
import { useTranslation } from "react-i18next";
import {
FlatList,
Platform,
Pressable,
ScrollView,
Text,
@@ -26,10 +27,6 @@ import {
type StyleProp,
type ViewStyle,
} from "react-native";
import {
IndependentScrollBoundary,
useIndependentScrollGesture,
} from "@/components/ui/independent-scroll-boundary";
import { Gesture, GestureDetector } from "react-native-gesture-handler";
import { StyleSheet, withUnistyles } from "react-native-unistyles";
import {
@@ -212,6 +209,10 @@ function AgentProfilesEditAction({ onPress }: { onPress: () => void }) {
);
}
const IndependentScrollGestureContext = createContext<ReturnType<typeof Gesture.Native> | null>(
null,
);
interface ModelBrowserNavContextValue {
activeKey: string | null;
onActivateKey: (key: string) => void;
@@ -615,7 +616,7 @@ function ModelBrowserPressable({
onLayout,
testID,
}: ModelBrowserPressableProps) {
const independentScrollGesture = useIndependentScrollGesture();
const independentScrollGesture = useContext(IndependentScrollGestureContext);
const [pressed, setPressed] = useState(false);
// Android's scroll handler must keep the pointer stream until release so a
// fling survives leaving the short viewport. A simultaneous Tap keeps rows
@@ -1380,6 +1381,29 @@ function GroupedProviderRows({
);
}
export function IndependentScrollBoundary({ children }: { children: React.ReactElement }) {
// Prevent the parent sheet from cancelling Android's native scroll when the
// finger crosses this viewport; receiving ACTION_UP is what preserves fling.
const nativeScrollGesture = useMemo(
() =>
Gesture.Native()
.shouldActivateOnStart(true)
.shouldCancelWhenOutside(false)
.disallowInterruption(true),
[],
);
if (Platform.OS !== "android") {
return children;
}
return (
<IndependentScrollGestureContext.Provider value={nativeScrollGesture}>
<GestureDetector gesture={nativeScrollGesture}>{children}</GestureDetector>
</IndependentScrollGestureContext.Provider>
);
}
function resolveModelListRevealTarget({
shouldRevealActive,
hasActiveHeaderItem,
@@ -0,0 +1,52 @@
import { Component, type ErrorInfo, type ReactNode } from "react";
interface RenderErrorBoundaryProps {
children: ReactNode;
/** A caught error is cleared when any of these values change, so new content renders. */
resetKeys: readonly unknown[];
/** The error state shown in place of the children. `retry` renders the children again. */
renderError(error: string, retry: () => void): ReactNode;
onError(error: unknown, componentStack: string | null | undefined): void;
}
interface RenderErrorBoundaryState {
error: string | null;
}
/**
* Keeps a render error inside one surface. Without it the error reaches the root boundary,
* which replaces the whole app.
*/
export class RenderErrorBoundary extends Component<
RenderErrorBoundaryProps,
RenderErrorBoundaryState
> {
state: RenderErrorBoundaryState = { error: null };
static getDerivedStateFromError(error: unknown): RenderErrorBoundaryState {
return { error: error instanceof Error ? error.message : String(error) };
}
componentDidCatch(error: unknown, info: ErrorInfo): void {
this.props.onError(error, info.componentStack);
}
componentDidUpdate(previous: RenderErrorBoundaryProps): void {
if (this.state.error !== null && resetKeysChanged(previous.resetKeys, this.props.resetKeys)) {
this.retry();
}
}
retry = (): void => {
this.setState({ error: null });
};
render() {
if (this.state.error !== null) return this.props.renderError(this.state.error, this.retry);
return this.props.children;
}
}
function resetKeysChanged(previous: readonly unknown[], next: readonly unknown[]): boolean {
return previous.length !== next.length || previous.some((key, index) => key !== next[index]);
}
@@ -37,7 +37,7 @@ export type { SettingsRowHintStatus } from "./row-header";
export { SettingsAddRow } from "./add-row";
export { SettingsBackLink, SettingsDetailHeader } from "./detail-header";
export { SettingsInfoTip } from "./headings/settings-info-tip";
export { ListSettingsRows, MenuSettingsRows } from "./row-density";
export { MenuSettingsRows } from "./row-density";
/**
* What app screens can add to a plugin-facing row: an accessory beside the label, such as an info
@@ -1,12 +1,7 @@
import { createContext, useContext, useMemo, type ReactNode } from "react";
import type { StyleProp, TextStyle, ViewStyle } from "react-native";
import { StyleSheet } from "react-native-unistyles";
import {
CONTROL_HEIGHTS,
mapLayout,
TOUCH_TARGET,
type ControlSize,
} from "@/components/ui/control-geometry";
import { CONTROL_HEIGHTS, mapLayout, type ControlSize } from "@/components/ui/control-geometry";
import { menuRowContentInset } from "@/components/ui/menu";
import { settingsStyles } from "@/styles/settings";
@@ -17,9 +12,7 @@ import { settingsStyles } from "@/styles/settings";
// - nested: rows revealed under a collapsible row belong to it, so they sit one step smaller than
// the rows of the card: tighter padding, smaller text, smaller controls.
// - menu: rows that share a menu surface with menu rows put their labels on the menu's label rail.
// - list: rows that share a sheet with list rows, such as radio choices and section headers, take
// the list row's height so every row in the sheet lines up.
type RowPlacement = "card" | "nested" | "menu" | "list";
type RowPlacement = "card" | "nested" | "menu";
const RowPlacementContext = createContext<RowPlacement>("card");
@@ -32,11 +25,6 @@ export function MenuSettingsRows({ children }: { children: ReactNode }) {
return <RowPlacementContext.Provider value="menu">{children}</RowPlacementContext.Provider>;
}
/** Settings rows rendered in a sheet of list rows, such as Agent settings. */
export function ListSettingsRows({ children }: { children: ReactNode }) {
return <RowPlacementContext.Provider value="list">{children}</RowPlacementContext.Provider>;
}
export interface SettingsRowLayout {
row: StyleProp<ViewStyle>;
title: StyleProp<TextStyle>;
@@ -61,13 +49,6 @@ function layoutFor(placement: RowPlacement): SettingsRowLayout {
hint: settingsStyles.rowHint,
controlSize: "md",
};
case "list":
return {
row: [settingsStyles.row, styles.listRow],
title: settingsStyles.rowTitle,
hint: settingsStyles.rowHint,
controlSize: "md",
};
case "card":
return {
row: settingsStyles.row,
@@ -91,11 +72,6 @@ const styles = StyleSheet.create((theme) => ({
paddingVertical: theme.spacing[2],
minHeight: mapLayout(CONTROL_HEIGHTS.sm, (height) => height + theme.spacing[2] * 2),
},
// A list row is a touch target tall on every input; a switch still fits inside its padding.
listRow: {
paddingVertical: theme.spacing[2],
minHeight: TOUCH_TARGET,
},
nestedText: {
fontSize: theme.fontSize.sm,
},
@@ -2311,7 +2311,7 @@ function ProjectModeList({
() =>
parentGestureRef
? ({
// NestableScrollContainer forwards props to an RNGH FlatList. Keep
// NestableScrollContainer forwards props to RNGH ScrollView. Keep
// vertical scroll and sidebar close pan simultaneous: vertical
// intent scrolls immediately, clear horizontal intent can still
// activate close from inside the list.
@@ -1,44 +0,0 @@
import { createContext, useContext, useMemo, type ReactElement } from "react";
import { Platform } from "react-native";
import { Gesture, GestureDetector } from "react-native-gesture-handler";
const IndependentScrollGestureContext = createContext<ReturnType<typeof Gesture.Native> | null>(
null,
);
/** The native scroll gesture of the enclosing boundary, for gestures that must not cancel it. */
export function useIndependentScrollGesture(): ReturnType<typeof Gesture.Native> | null {
return useContext(IndependentScrollGestureContext);
}
/**
* Keeps a parent pan from interrupting an Android scroll and lets the list receive ACTION_UP
* for the fling. With activation on start, child taps must join the native scroll gesture.
* When activation waits for the scroll view to intercept a drag, ordinary pressables receive taps.
*/
export function IndependentScrollBoundary({
children,
activateOnStart = true,
}: {
children: ReactElement;
activateOnStart?: boolean;
}) {
const nativeScrollGesture = useMemo(
() =>
Gesture.Native()
.shouldActivateOnStart(activateOnStart)
.shouldCancelWhenOutside(false)
.disallowInterruption(true),
[activateOnStart],
);
if (Platform.OS !== "android") {
return children;
}
return (
<IndependentScrollGestureContext.Provider value={nativeScrollGesture}>
<GestureDetector gesture={nativeScrollGesture}>{children}</GestureDetector>
</IndependentScrollGestureContext.Provider>
);
}
@@ -2,7 +2,6 @@ import {
BottomSheetModal as GorhomBottomSheetModal,
type BottomSheetModalProps,
type BottomSheetBackdropProps,
useBottomSheetInternal,
} from "@gorhom/bottom-sheet";
import React from "react";
import {
@@ -26,7 +25,6 @@ import {
type AttachSheetContentDrag,
type SheetContentDragGesture,
} from "@/components/ui/bottom-sheet-scope";
import { runOnJS, useAnimatedReaction, useSharedValue } from "react-native-reanimated";
import { SheetBackdrop } from "./sheet-backdrop";
type GorhomBottomSheetModalMethods = ElementRef<typeof GorhomBottomSheetModal>;
@@ -58,7 +56,7 @@ type IsolatedBottomSheetModalProps = Omit<
/**
* Whether closing (drag, backdrop, Back) also dismisses, which unmounts the content. Default
* true: the owner hears `onDismiss` and drops its state. Pass `false` for a sheet whose close the
* owner may veto: it parks at index -1 with its content mounted, the owner hears `onClosed`,
* owner may veto: it parks at index -1 with its content mounted, the owner hears `onChange(-1)`,
* and either snaps it back or unmounts it, which dismisses it from the stack.
*/
enableDismissOnClose?: boolean;
@@ -76,15 +74,6 @@ type IsolatedBottomSheetModalProps = Omit<
* inside the sheet and it throws on device only.
*/
contextBridge: ContextBridge | null;
/**
* Runs when a close animation settles at the closed detent, whoever started it.
*
* Gorhom reports that through `onChange(-1)`, but skips `onChange` when its index bookkeeping
* already reads -1. An interrupted mount animation leaves it there, so the next close ends where
* it began and the owner never hears about it. Watch this signal, not `onChange`, when a close
* the owner may veto still has to reach the owner.
*/
onClosed?: () => void;
};
export type IsolatedBottomSheetModalRef = GorhomBottomSheetModalMethods;
@@ -116,7 +105,6 @@ export const IsolatedBottomSheetModal = forwardRef<
contextBridge,
backdropOpacity,
enableDismissOnClose = true,
onClosed,
waitFor,
simultaneousHandlers,
...bottomSheetProps
@@ -163,7 +151,6 @@ export const IsolatedBottomSheetModal = forwardRef<
simultaneousHandlers={contentDragHandlers.simultaneousHandlers}
>
<BottomSheetScope attachContentDrag={attachContentDrag}>
{onClosed ? <SheetCloseSignal onClosed={onClosed} /> : null}
{contextBridge ? contextBridge(children) : children}
</BottomSheetScope>
</GorhomBottomSheetModal>
@@ -172,43 +159,6 @@ export const IsolatedBottomSheetModal = forwardRef<
return modal;
});
/**
* Reports a close animation that settles at the closed detent — the signal Gorhom only routes
* through `onChange(-1)`, which it drops when the sheet's current index already reads -1.
*
* `animatedAnimationState.nextIndex` is -1 for the whole close animation and undefined once it
* completes. The settled position then tells a real close from a spring back and an interruption.
*/
function SheetCloseSignal({ onClosed }: { onClosed: () => void }) {
const { animatedAnimationState, animatedDetentsState, animatedPosition } =
useBottomSheetInternal();
const closing = useSharedValue(false);
useAnimatedReaction(
() => {
const { nextIndex } = animatedAnimationState.get();
if (nextIndex === -1) return -1;
return nextIndex === undefined ? 0 : 1;
},
(phase, previousPhase) => {
if (phase === -1) {
closing.value = true;
return;
}
if (phase === 1) {
closing.value = false;
return;
}
if (previousPhase !== -1 || !closing.value) return;
closing.value = false;
const closedPosition = animatedDetentsState.get().closedDetentPosition;
if (closedPosition === undefined) return;
if (Math.abs(animatedPosition.value - closedPosition) < 1) runOnJS(onClosed)();
},
[animatedAnimationState, animatedDetentsState, animatedPosition, onClosed],
);
return null;
}
export function useIsolatedBottomSheetVisibility({
visible,
isEnabled,
@@ -1,36 +0,0 @@
import React, { act } from "react";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, expect, it, vi } from "vitest";
import { page } from "vitest/browser";
import { i18n } from "@/i18n/i18next";
import { LoadingSpinner } from "./loading-spinner";
let root: Root;
let host: HTMLDivElement;
beforeEach(async () => {
await i18n.changeLanguage("en");
vi.stubGlobal("React", React);
vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
host = document.createElement("div");
document.body.appendChild(host);
root = createRoot(host);
});
afterEach(() => {
act(() => root.unmount());
host.remove();
vi.unstubAllGlobals();
});
it("announces itself as loading when the caller gives no label", async () => {
act(() => root.render(<LoadingSpinner color="#888888" />));
await expect.element(page.getByRole("progressbar", { name: "Loading..." })).toBeVisible();
});
it("announces what is loading when the caller names it", async () => {
act(() => root.render(<LoadingSpinner color="#888888" accessibilityLabel="Loading commits" />));
await expect.element(page.getByRole("progressbar", { name: "Loading commits" })).toBeVisible();
});
@@ -1,29 +1,12 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { ActivityIndicator, type ActivityIndicatorProps } from "react-native";
interface LoadingSpinnerProps {
color: string;
size?: ActivityIndicatorProps["size"];
style?: ActivityIndicatorProps["style"];
/** What is loading. Screen readers announce "Loading" when this is absent. */
accessibilityLabel?: string;
}
export function LoadingSpinner({
color,
size = "small",
style,
accessibilityLabel,
}: LoadingSpinnerProps) {
const { t } = useTranslation();
return (
<ActivityIndicator
size={size}
color={color}
style={style}
accessibilityRole="progressbar"
accessibilityLabel={accessibilityLabel ?? t("common.loading")}
/>
);
export function LoadingSpinner({ color, size = "small", style }: LoadingSpinnerProps) {
return <ActivityIndicator size={size} color={color} style={style} />;
}
@@ -1,66 +0,0 @@
import { Text, View } from "react-native";
import { StyleSheet, withUnistyles } from "react-native-unistyles";
import { LoadingSpinner } from "@/components/ui/loading-spinner";
import type { Theme } from "@/styles/theme";
const ThemedLoadingSpinner = withUnistyles(LoadingSpinner);
const foregroundMutedColorMapping = (theme: Theme) => ({
color: theme.colors.foregroundMuted,
});
/**
* A screen or pane waiting for its content. Every wait shows the same spinner in the same place,
* so a wait that changes what it is waiting for changes only the words under it.
*/
export function LoadingState({
title,
description,
testID,
}: {
/** What the wait is for. Leave it out while the wait is too short to read. */
title?: string;
description?: string;
testID?: string;
}) {
return (
<View style={styles.container} testID={testID}>
<ThemedLoadingSpinner
size="small"
uniProps={foregroundMutedColorMapping}
accessibilityLabel={title}
/>
{title ? (
<View style={styles.textStack}>
<Text style={styles.title}>{title}</Text>
{description ? <Text style={styles.description}>{description}</Text> : null}
</View>
) : null}
</View>
);
}
const styles = StyleSheet.create((theme) => ({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
gap: theme.spacing[3],
paddingHorizontal: theme.spacing[6],
},
textStack: {
alignItems: "center",
gap: theme.spacing[2],
maxWidth: 520,
},
title: {
color: theme.colors.foreground,
fontSize: theme.fontSize.base,
fontWeight: theme.fontWeight.normal,
textAlign: "center",
},
description: {
color: theme.colors.foregroundMuted,
fontSize: theme.fontSize.base,
textAlign: "center",
},
}));
@@ -88,11 +88,7 @@ export function AgentSettingsDrawer({
}: AgentSettingsDrawerProps) {
const { t } = useTranslation();
const [page, setPage] = useState<AgentSheetPage>(AGENT_SHEET_HOME);
// Profiles open on Home for a new agent, where a profile is the quickest way to configure it.
// `null` until the user toggles the card in this opening.
const [profilesToggled, setProfilesToggled] = useState<boolean | null>(null);
const profilesExpanded =
profilesToggled ?? (profiles?.target === "draft" && profiles.rows.length > 0);
const [profilesExpanded, setProfilesExpanded] = useState(false);
// Select pages search with this; the Model page keeps its own.
const [pageQuery, setPageQuery] = useState("");
const [pageSearchKey, setPageSearchKey] = useState(0);
@@ -107,8 +103,8 @@ export function AgentSettingsDrawer({
});
const toggleProfiles = useCallback(() => {
setProfilesToggled(!profilesExpanded);
}, [profilesExpanded]);
setProfilesExpanded((expanded) => !expanded);
}, []);
const goTo = useCallback((next: AgentSheetPage) => {
Keyboard.dismiss();
@@ -129,7 +125,7 @@ export function AgentSettingsDrawer({
const close = useCallback(() => {
Keyboard.dismiss();
setPage(AGENT_SHEET_HOME);
setProfilesToggled(null);
setProfilesExpanded(false);
setPageQuery("");
modelPage.reset();
onClose();
@@ -8,7 +8,6 @@ import type { AgentMode } from "@getpaseo/protocol/agent-types";
import { getAgentModeOptionIcon } from "@/agent-controls/icons";
import { formatAgentModeLabel } from "@/agent-controls/labels";
import {
ListSettingsRows,
SettingsCard,
SettingsDetailRow,
SettingsSection,
@@ -20,7 +19,6 @@ import { PressHighlight } from "@/components/ui/press-highlight";
import { ScrollView as SheetScrollView } from "@/components/ui/scroll-view";
import { SegmentedControl, type SegmentedControlOption } from "@/components/ui/segmented-control";
import { SteppedSlider, type SteppedSliderOption } from "@/components/ui/stepped-slider";
import { TOUCH_TARGET } from "@/components/ui/control-geometry";
import { isNative } from "@/constants/platform";
import { ICON_SIZE } from "@/styles/theme";
import {
@@ -87,19 +85,17 @@ export function AgentSheetHome({
>
{/* Themed insets sit on a View: the sheet scroller drops a themed contentContainerStyle on web. */}
<View style={styles.content}>
<ListSettingsRows>
<View style={styles.block}>{topCard}</View>
{blocks.map((block) => (
<HomeBlock
key={blockKey(block)}
block={block}
modeControl={modeControl}
disabled={disabled}
onOpenSelect={onOpenSelect}
/>
))}
{footer}
</ListSettingsRows>
<View style={styles.block}>{topCard}</View>
{blocks.map((block) => (
<HomeBlock
key={blockKey(block)}
block={block}
modeControl={modeControl}
disabled={disabled}
onOpenSelect={onOpenSelect}
/>
))}
{footer}
</View>
</SheetScrollView>
);
@@ -667,7 +663,7 @@ const styles = StyleSheet.create((theme) => ({
fontSize: theme.fontSize.base,
},
radioRow: {
minHeight: TOUCH_TARGET,
minHeight: 44,
flexDirection: "row",
alignItems: "center",
paddingHorizontal: theme.spacing[4],
+59 -110
View File
@@ -7,7 +7,7 @@ import { useIsCompactFormFactor } from "@/constants/layout";
import { HEADER_INNER_HEIGHT } from "@/constants/layout";
import { resolveContentMaxWidth, useAppSettings } from "@/hooks/use-settings";
import { KeyboardTranslateView } from "@/keyboard/shift";
import { createContext, useCallback, useContext, useMemo, useState, type ReactNode } from "react";
import { createContext, useCallback, useContext, useState, type ReactNode } from "react";
import { View, type LayoutChangeEvent, type ViewProps, StyleSheet } from "react-native";
import { StyleSheet as ThemedStyleSheet } from "react-native-unistyles";
import Animated, {
@@ -20,7 +20,7 @@ import { useKeyboardShift } from "@/keyboard/shift";
import {
resolveCenteredClearance,
resolveComposerBottomPlacement,
resolveInlineComposerCapacity,
resolveComposerSlotCapacity,
updateComposerCapacity,
type ComposerCapacity,
} from "./internal/capacity";
@@ -32,21 +32,15 @@ interface ComposerViewportProps extends ViewProps {
bottomInset?: number;
keyboardGap?: number;
centered?: boolean;
fullscreen?: boolean;
}
/**
* Measure the stationary space below the header, outside keyboard translation. The
* capacity bounds the inline composer, so it keeps the inline measurement while
* fullscreen hides the screen's chrome; exit then lays out at the inline cap at once.
*/
/** Measure the stationary space below the header, outside keyboard translation. */
function ComposerViewport({
children,
onLayout,
bottomInset = 0,
keyboardGap = 0,
centered = false,
fullscreen = false,
...props
}: ComposerViewportProps) {
const measuredHeight = useSharedValue(0);
@@ -69,10 +63,10 @@ function ComposerViewport({
);
const measureViewport = useCallback(
(event: LayoutChangeEvent) => {
if (!fullscreen) measuredHeight.value = event.nativeEvent.layout.height;
measuredHeight.value = event.nativeEvent.layout.height;
onLayout?.(event);
},
[fullscreen, measuredHeight, onLayout],
[measuredHeight, onLayout],
);
return (
@@ -83,17 +77,18 @@ function ComposerViewport({
}
/** Bound the complete composer (including its controls), not just the text input. */
function ComposerViewportContent({ style, ...props }: ViewProps) {
function ComposerViewportContent({
style,
fullscreen = false,
...props
}: ViewProps & { fullscreen?: boolean }) {
const compact = useIsCompactFormFactor();
const sizing = useContext(ViewportSizing);
if (!sizing) throw new Error("ComposerViewportContent requires ComposerViewport");
const constraint = useAnimatedStyle(() => ({
// Only viewport changes and keyboard start/end events trigger layout. Motion
// stays in KeyboardTranslateView and never changes this constraint per frame.
// Fullscreen styles override it with a static minHeight instead of feeding the mode
// in here: Reanimated applies a dependency change frames after the React commit,
// so the fullscreen slot would paint clamped to the inline cap first.
maxHeight: resolveInlineComposerCapacity(sizing.value?.capacity, compact),
maxHeight: resolveComposerSlotCapacity(sizing.value, { compact, fullscreen }),
}));
return (
@@ -101,29 +96,17 @@ function ComposerViewportContent({ style, ...props }: ViewProps) {
);
}
/**
* The keyboard only needs to move a centered form once it reaches the form's resting bottom.
* Fullscreen keeps the inline measurements: it does not translate, and re-measuring the
* fullscreen frame would rebuild the translation from stale keyboard values on enter and
* correct the form a frame late on exit.
*/
function useCenteredClearance(safeAreaBottom: number, fullscreen: boolean) {
/** The keyboard only needs to move a centered form once it reaches the form's resting bottom. */
function useCenteredClearance(safeAreaBottom: number) {
const [viewportHeight, setViewportHeight] = useState(0);
const [formBottom, setFormBottom] = useState(0);
const measureViewport = useCallback(
(event: LayoutChangeEvent) => {
if (!fullscreen) setViewportHeight(event.nativeEvent.layout.height);
},
[fullscreen],
);
const measureForm = useCallback(
(event: LayoutChangeEvent) => {
if (fullscreen) return;
const { y, height } = event.nativeEvent.layout;
setFormBottom(y + height);
},
[fullscreen],
);
const measureViewport = useCallback((event: LayoutChangeEvent) => {
setViewportHeight(event.nativeEvent.layout.height);
}, []);
const measureForm = useCallback((event: LayoutChangeEvent) => {
const { y, height } = event.nativeEvent.layout;
setFormBottom(y + height);
}, []);
return {
value: resolveCenteredClearance({ viewportHeight, safeAreaBottom, formBottom }),
measureViewport,
@@ -131,26 +114,6 @@ function useCenteredClearance(safeAreaBottom: number, fullscreen: boolean) {
};
}
/**
* Fullscreen covers the conversation without resizing it. A resized list corrects its
* scroll position from JS a few frames after the layout, so leaving fullscreen would
* paint the conversation at a stale offset first.
*/
function useInlineSlotReservation(fullscreen: boolean) {
const [height, setHeight] = useState(0);
const measureSlot = useCallback(
(event: LayoutChangeEvent) => {
if (!fullscreen) setHeight(event.nativeEvent.layout.height);
},
[fullscreen],
);
const spacerStyle = useMemo(() => ({ height }), [height]);
return {
measureSlot,
spacer: fullscreen ? <View style={spacerStyle} /> : null,
};
}
interface ComposerDockProps {
children: [ReactNode, ReactNode, ReactNode?];
centered?: boolean;
@@ -170,14 +133,13 @@ export function ComposerDock({
}: ComposerDockProps) {
const insets = useSafeAreaInsets();
const contentMaxWidth = resolveContentMaxWidth(useAppSettings().settings);
const centeredClearance = useCenteredClearance(insets.bottom, fullscreen);
const centeredClearance = useCenteredClearance(insets.bottom);
const placement = resolveComposerBottomPlacement({
safeAreaBottom: insets.bottom,
contentSpacing: SPACING[4],
});
// Preserve the existing centered form's visual balance on tablets.
const bottomInset = centered ? HEADER_INNER_HEIGHT + 24 : 0;
const conversationReservation = useInlineSlotReservation(fullscreen);
const bottomInset = centered && !fullscreen ? HEADER_INNER_HEIGHT + 24 : 0;
const fullscreenSurface = [
themedStyles.fullscreenComposer,
{
@@ -199,7 +161,6 @@ export function ComposerDock({
}
bottomInset={bottomInset}
centered
fullscreen={fullscreen}
onLayout={centeredClearance.measureViewport}
>
<KeyboardTranslateView
@@ -211,7 +172,8 @@ export function ComposerDock({
onLayout={centeredClearance.measureForm}
>
<ComposerViewportContent
style={fullscreen ? dockStyles.fullscreenSurface : dockStyles.composer}
style={fullscreen ? dockStyles.surface : dockStyles.composer}
fullscreen={fullscreen}
>
<ScrollView
style={fullscreen ? dockStyles.hiddenSetup : dockStyles.setup}
@@ -220,7 +182,8 @@ export function ComposerDock({
{content}
</ScrollView>
<ComposerViewportContent
style={fullscreen ? dockStyles.fullscreenSurface : dockStyles.centeredComposer}
style={fullscreen ? dockStyles.surface : dockStyles.centeredComposer}
fullscreen={fullscreen}
>
<View style={fullscreen ? fullscreenSurface : dockStyles.centeredComposerSurface}>
{composer}
@@ -232,53 +195,41 @@ export function ComposerDock({
</ComposerViewport>
);
}
// The conversation and the composer ride the keyboard as two views. Only the composer
// changes mode, and its view is the one fullscreen resizes on every screen, which is
// what lands the mode with the layout (see KeyboardTranslateView).
return (
<ComposerViewport
style={dockStyles.viewport}
keyboardGap={placement.keyboardGap}
fullscreen={fullscreen}
>
<View style={dockStyles.surface}>
<KeyboardTranslateView style={dockStyles.surface} keyboardGap={placement.keyboardGap}>
<View
testID="composer-dock-content"
collapsable={false}
style={dockStyles.content}
pointerEvents="box-none"
>
{/* A responder ancestor intercepts native scroll drags on Android Fabric.
Only unclaimed background touches may reach this sibling. */}
<ComposerDockBackground style={StyleSheet.absoluteFill} />
<View style={dockStyles.content} pointerEvents="box-none">
{content}
</View>
</View>
</KeyboardTranslateView>
{conversationReservation.spacer}
<KeyboardTranslateView
style={fullscreen ? StyleSheet.absoluteFill : dockStyles.composer}
enabled={!fullscreen}
keyboardGap={placement.keyboardGap}
<ComposerViewport style={dockStyles.viewport} keyboardGap={placement.keyboardGap}>
<KeyboardTranslateView
style={dockStyles.surface}
enabled={!fullscreen}
keyboardGap={placement.keyboardGap}
>
<View
testID="composer-dock-content"
collapsable={false}
style={dockStyles.content}
pointerEvents="box-none"
>
<ComposerViewportContent
style={fullscreen ? dockStyles.fullscreenSurface : dockStyles.composer}
onLayout={conversationReservation.measureSlot}
{/* A responder ancestor intercepts native scroll drags on Android Fabric.
Only unclaimed background touches may reach this sibling. */}
<ComposerDockBackground style={StyleSheet.absoluteFill} />
<View style={dockStyles.content} pointerEvents="box-none">
{content}
</View>
</View>
<ComposerViewportContent
style={fullscreen ? dockStyles.fullscreenSlot : dockStyles.composer}
fullscreen={fullscreen}
>
<View
style={
fullscreen
? fullscreenSurface
: [dockStyles.composer, { paddingBottom: placement.restingPadding }]
}
>
<View
style={
fullscreen
? fullscreenSurface
: [dockStyles.composer, { paddingBottom: placement.restingPadding }]
}
>
{composer}
</View>
</ComposerViewportContent>
</KeyboardTranslateView>
</View>
{composer}
</View>
</ComposerViewportContent>
</KeyboardTranslateView>
{overlay}
</ComposerViewport>
);
@@ -291,9 +242,7 @@ const dockStyles = StyleSheet.create({
surface: { flex: 1 },
content: { flex: 1, justifyContent: "flex-end" },
composer: { width: "100%", flexShrink: 1 },
// Yoga applies minHeight after maxHeight, so this fills the viewport over the
// inline cap that ComposerViewportContent keeps animating.
fullscreenSurface: { flex: 1, minHeight: "100%" },
fullscreenSlot: { position: "absolute", top: 0, left: 0, right: 0, bottom: 0 },
centeredViewport: { flex: 1, alignItems: "center", justifyContent: "center" },
centered: { flexShrink: 1, width: "100%" },
// Reserve the composer's own capped height before the setup scroll view shrinks.
@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
import {
resolveCenteredClearance,
resolveComposerBottomPlacement,
resolveComposerSlotCapacity,
resolveInlineComposerCapacity,
resolveComposerCapacity,
updateComposerCapacity,
@@ -67,6 +68,21 @@ describe("composer viewport", () => {
expect(resolveInlineComposerCapacity(open.capacity, false)).toBe(245);
expect(resolveInlineComposerCapacity(undefined, true)).toBeUndefined();
});
it("lets a fullscreen composer fill the viewport while inline keeps its cap", () => {
const open = updateComposerCapacity(undefined, {
height: 582,
bottomInset: 24,
safeAreaBottom: 0,
keyboardGap: 0,
centered: false,
keyboardShift: 308,
});
expect(resolveComposerSlotCapacity(open, { compact: true, fullscreen: true })).toBe(582);
expect(resolveComposerSlotCapacity(open, { compact: true, fullscreen: false })).toBe(147);
expect(resolveComposerSlotCapacity(undefined, { compact: true, fullscreen: true })).toBe(
undefined,
);
});
it("preserves the editing capacity when the keyboard closes", () => {
const viewport = {
height: 582,
@@ -12,6 +12,8 @@ interface ComposerGeometry {
export interface ComposerCapacity {
keyboardReserve: number;
capacity: number;
/** The stationary viewport; a fullscreen composer fills it and lays out the keyboard itself. */
viewportHeight: number;
}
export function resolveComposerCapacity(input: ComposerGeometry): number {
@@ -76,6 +78,7 @@ export function updateComposerCapacity(
return {
keyboardReserve,
capacity: resolveComposerCapacity({ ...input, keyboardShift: keyboardReserve }),
viewportHeight: input.height,
};
}
@@ -88,3 +91,19 @@ export function resolveInlineComposerCapacity(
if (capacity === undefined) return undefined;
return compact ? capacity * 0.6 : capacity;
}
export interface ComposerSlotLayout {
compact: boolean;
fullscreen: boolean;
}
/** The bound on the composer slot: inline capacity, or the whole viewport in fullscreen. */
export function resolveComposerSlotCapacity(
sizing: ComposerCapacity | undefined,
layout: ComposerSlotLayout,
): number | undefined {
"worklet";
if (sizing === undefined) return undefined;
if (layout.fullscreen) return sizing.viewportHeight;
return resolveInlineComposerCapacity(sizing.capacity, layout.compact);
}
@@ -1,5 +1,5 @@
import type { ReactNode } from "react";
import { StyleSheet, View, type ViewProps } from "react-native";
import { StyleSheet, type ViewProps } from "react-native";
import Animated, { useAnimatedStyle } from "react-native-reanimated";
import { KeyboardTranslateView, useKeyboardShift } from "@/keyboard/shift";
@@ -16,21 +16,15 @@ export function ComposerFullscreenBody({
fullscreen: boolean;
children: ReactNode;
}) {
// The reservation mounts with the mode instead of reading it in a worklet: Reanimated
// applies a dependency change frames after the React commit, so the inline body would
// first paint squeezed by the fullscreen reservation.
return (
<View style={fullscreen ? styles.fullscreen : styles.inline}>
{children}
{fullscreen ? <KeyboardReservation /> : null}
</View>
);
}
function KeyboardReservation() {
const { layoutShift } = useKeyboardShift();
const reservation = useAnimatedStyle(() => ({ height: layoutShift.value }));
return <Animated.View style={reservation} />;
const reservation = useAnimatedStyle(() => ({
marginBottom: fullscreen ? layoutShift.value : 0,
}));
return (
<Animated.View style={[fullscreen ? styles.fullscreen : styles.inline, reservation]}>
{children}
</Animated.View>
);
}
/** The Send row of a fullscreen composer rides the keyboard like the inline dock surface. */
@@ -27,6 +27,5 @@ it("keeps dock overlays outside keyboard translation in every native layout", ()
ts.forEachChild(node, visit);
}
visit(source);
// The centered form's view, and the chat dock's content and composer views.
expect(surfaces).toBe(3);
expect(surfaces).toBe(2);
});
@@ -2386,11 +2386,6 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
: [styles.container, Platform.OS === "ios" && isCompact && styles.inputWrapperCompact]
}
testID="message-input-root"
// The editor's native parent is its nearest stacking-context ancestor. Inline
// iOS styles here (shadow) and on the input wrapper (clipping) form one and the
// fullscreen styles do not, so without these the toggle re-parents the editor
// and UIKit drops its focus and keyboard.
collapsable={false}
onLayout={handleComposerLayout}
>
<MessageInputAutoFocus
@@ -105,8 +105,6 @@ export function ComposerInputPresentation({
<ComposerFullscreenBody fullscreen={fullscreen}>
<View
ref={inputWrapperRef}
// Keeps the editor's native parent across the toggle; see message-input-root.
collapsable={false}
style={fullscreen ? styles.fullscreenInputWrapper : inputWrapperStyle}
pointerEvents={inputPointerEvents}
>
@@ -6,13 +6,9 @@ import { createProviderSnapshotCache, type ProviderSnapshotCache } from "./provi
const SNAPSHOT_KEY_PREFIX = "@paseo/provider-snapshot/v2:";
const SNAPSHOT_INDEX_KEY = "@paseo/provider-snapshot-index/v2";
const STORED_INDEX_KEY = "@paseo/provider-snapshot-index/v3";
function createStorage(maxSnapshotBytes = Number.POSITIVE_INFINITY) {
const values = new Map<string, string>();
const stats = { getAllKeysCalls: 0, snapshotsRead: [] as string[] };
function recordRead(key: string) {
if (key.startsWith(SNAPSHOT_KEY_PREFIX)) stats.snapshotsRead.push(key);
}
const stats = { getAllKeysCalls: 0 };
type Operation = "setItem" | "removeItem" | "multiRemove";
let failure: { operation: Operation; timing: "before" | "after"; key?: string } | null = null;
@@ -35,7 +31,6 @@ function createStorage(maxSnapshotBytes = Number.POSITIVE_INFINITY) {
failure = { operation, timing, key };
},
async getItem(key: string) {
recordRead(key);
return values.get(key) ?? null;
},
async setItem(key: string, value: string) {
@@ -66,7 +61,6 @@ function createStorage(maxSnapshotBytes = Number.POSITIVE_INFINITY) {
return [...values.keys()];
},
async multiGet(keys: readonly string[]) {
keys.forEach(recordRead);
return keys.map((key) => [key, values.get(key) ?? null] as const);
},
async multiRemove(keys: readonly string[]) {
@@ -391,62 +385,6 @@ describe("provider snapshot cache", () => {
expect(storage.stats.getAllKeysCalls).toBe(1);
});
it("reads only the requested snapshot after a restart and still enforces the budget", async () => {
const storage = createStorage();
const cache = createProviderSnapshotCache(storage);
for (const [day, label] of ["one", "two", "three"].entries()) {
await writeSnapshot(cache, {
cwd: `/${label}`,
label,
generatedAt: `2026-08-0${day + 1}T00:00:00.000Z`,
});
}
const maxBytes = snapshotBytes(storage.values);
storage.stats.snapshotsRead.length = 0;
const restarted = createProviderSnapshotCache(storage, { maxBytes });
await expect(restarted.read("server-1", "/two")).resolves.toMatchObject({ hash: "two" });
expect(storage.stats.snapshotsRead).toEqual([
`${SNAPSHOT_KEY_PREFIX}["server-1","cwd","/two"]`,
`${SNAPSHOT_KEY_PREFIX}["server-1","hash","two"]`,
]);
await writeSnapshot(restarted, {
cwd: "/four",
label: "four",
generatedAt: "2026-08-04T00:00:00.000Z",
});
await expect(restarted.read("server-1", "/one")).resolves.toBeNull();
await expect(restarted.read("server-1", "/four")).resolves.not.toBeNull();
expect(snapshotBytes(storage.values)).toBeLessThanOrEqual(maxBytes);
expectConsistentSnapshots(storage.values);
});
it("counts snapshots that another cache instance stored after a restart", async () => {
const storage = createStorage();
const first = createProviderSnapshotCache(storage);
const second = createProviderSnapshotCache(storage);
await second.read("server-1", "/none");
await writeSnapshot(first, {
cwd: "/first",
label: "first",
generatedAt: "2026-08-01T00:00:00.000Z",
});
await writeSnapshot(second, {
cwd: "/second",
label: "second",
generatedAt: "2026-08-02T00:00:00.000Z",
});
const maxBytes = snapshotBytes(storage.values) - 1;
const restarted = createProviderSnapshotCache(storage, { maxBytes });
await expect(restarted.read("server-1", "/second")).resolves.toMatchObject({ hash: "second" });
await expect(restarted.read("server-1", "/first")).resolves.toBeNull();
expect(snapshotBytes(storage.values)).toBeLessThanOrEqual(maxBytes);
expectConsistentSnapshots(storage.values);
});
it("replaces an indexed snapshot without counting both versions", async () => {
const storage = createStorage();
const maxBytes = 1_000;
@@ -621,13 +559,6 @@ describe("provider snapshot cache", () => {
entries: [{ key: `${SNAPSHOT_KEY_PREFIX}phantom`, bytes: 999_999, writtenAt: "bad" }],
}),
);
storage.values.set(
STORED_INDEX_KEY,
JSON.stringify({
version: 3,
entries: [{ key: `${SNAPSHOT_KEY_PREFIX}phantom`, bytes: 999_999, writtenAt: "bad" }],
}),
);
const restarted = createProviderSnapshotCache(storage, { maxBytes });
await writeSnapshot(restarted, {
@@ -15,8 +15,7 @@ type SnapshotPayload = GetProvidersSnapshotResponseMessage["payload"];
const CACHE_VERSION = 2;
const CACHE_KEY_PREFIX = "@paseo/provider-snapshot/v2";
const CACHE_INDEX_VERSION = 3;
const CACHE_INDEX_KEY = "@paseo/provider-snapshot-index/v3";
const CACHE_INDEX_KEY = "@paseo/provider-snapshot-index/v2";
const DEFAULT_MAX_CACHE_BYTES = 4 * 1024 * 1024;
interface ProviderSnapshotStorage {
@@ -44,22 +43,8 @@ interface ProviderSnapshotIndexEntry {
key: string;
bytes: number;
writtenAt: string;
// A directory association names the body it depends on.
body?: string;
}
const ProviderSnapshotIndexSchema = z.object({
version: z.literal(CACHE_INDEX_VERSION),
entries: z.array(
z.object({
key: z.string(),
bytes: z.number(),
writtenAt: z.string(),
body: z.string().optional(),
}),
),
});
const StoredProviderSnapshotSchema: z.ZodType<StoredProviderSnapshot> = z.strictObject({
version: z.literal(CACHE_VERSION),
hash: z.string(),
@@ -124,26 +109,14 @@ function decodeCacheKey(key: string) {
return CacheKeySchema.parse(JSON.parse(key.slice(CACHE_KEY_PREFIX.length + 1)));
}
// Timestamps and keys are machine strings: code-unit order is the intended order, and it spares
// a collator call per comparison.
function oldestFirst(left: ProviderSnapshotIndexEntry, right: ProviderSnapshotIndexEntry): number {
if (left.writtenAt !== right.writtenAt) return left.writtenAt < right.writtenAt ? -1 : 1;
const writtenAtOrder = left.writtenAt.localeCompare(right.writtenAt);
if (writtenAtOrder !== 0) return writtenAtOrder;
// References must be evicted before equally recent bodies, regardless of key encoding.
const leftIsReference = left.body !== undefined;
if (leftIsReference !== (right.body !== undefined)) return leftIsReference ? -1 : 1;
if (left.key === right.key) return 0;
return left.key < right.key ? -1 : 1;
}
function parseStoredIndex(value: string | null): ProviderSnapshotIndexEntry[] {
if (value === null) return [];
try {
const result = ProviderSnapshotIndexSchema.safeParse(JSON.parse(value));
return result.success ? result.data.entries : [];
} catch (error) {
if (!(error instanceof SyntaxError)) throw error;
return [];
}
const leftKind = decodeCacheKey(left.key)[1];
const rightKind = decodeCacheKey(right.key)[1];
if (leftKind !== rightKind) return leftKind === "cwd" ? -1 : 1;
return left.key.localeCompare(right.key);
}
function parseStoredProviderSnapshot(key: string, value: string): StoredProviderSnapshot | null {
@@ -162,23 +135,9 @@ export function createProviderSnapshotCache(
): ProviderSnapshotCache {
const maxBytes = options.maxBytes ?? DEFAULT_MAX_CACHE_BYTES;
let index: ProviderSnapshotIndexEntry[] | null = null;
// The index value last read from or written to storage.
let storedIndex: string | null = null;
let operationQueue = Promise.resolve();
const bodies = new Map<string, CachedProviderSnapshot>();
// The stored index spares a restart from reading every snapshot to learn its size and age.
// Storage keys stay the authority on what exists: an indexed key that is gone is dropped, and
// a stored key the index does not list is read and measured here.
async function commitIndex(entries: ProviderSnapshotIndexEntry[]): Promise<void> {
const serialized = JSON.stringify({ version: CACHE_INDEX_VERSION, entries });
if (serialized !== storedIndex) {
await storage.setItem(CACHE_INDEX_KEY, serialized);
storedIndex = serialized;
}
index = entries;
}
async function reconcileCache(): Promise<void> {
const allKeys = await storage.getAllKeys();
// COMPAT(providerSnapshotCache): added in v0.7.2, remove legacy cleanup after 2027-03-06.
@@ -186,17 +145,14 @@ export function createProviderSnapshotCache(
(key) =>
key.startsWith("@paseo/provider-snapshot/v1:") ||
key === "@paseo/provider-snapshot-index/v1" ||
key === "@paseo/provider-snapshot-index/v2",
key === CACHE_INDEX_KEY,
);
if (legacyKeys.length) await storage.multiRemove(legacyKeys);
const keys = allKeys.filter((key) => key.startsWith(`${CACHE_KEY_PREFIX}:`));
storedIndex = allKeys.includes(CACHE_INDEX_KEY) ? await storage.getItem(CACHE_INDEX_KEY) : null;
const storedKeys = new Set(keys);
const entries = parseStoredIndex(storedIndex).filter((entry) => storedKeys.has(entry.key));
const indexedKeys = new Set(entries.map((entry) => entry.key));
const unindexedKeys = keys.filter((key) => !indexedKeys.has(key));
const values = unindexedKeys.length > 0 ? await storage.multiGet(unindexedKeys) : [];
const values = await storage.multiGet(keys);
const keysToRemove: string[] = [];
const entries: ProviderSnapshotIndexEntry[] = [];
const references: Array<{ key: string; body: string; writtenAt: string }> = [];
for (const [key, value] of values) {
if (value === null) continue;
try {
@@ -206,12 +162,13 @@ export function createProviderSnapshotCache(
continue;
}
const [serverId, kind] = decodeCacheKey(key);
entries.push({
key,
bytes: storedBytes(key, value),
writtenAt: stored.generatedAt,
...(kind === "cwd" ? { body: bodyKey(serverId, stored.hash) } : {}),
});
entries.push({ key, bytes: storedBytes(key, value), writtenAt: stored.generatedAt });
if (kind === "cwd")
references.push({
key,
body: bodyKey(serverId, stored.hash),
writtenAt: stored.generatedAt,
});
} catch (error) {
if (
!(error instanceof SyntaxError) &&
@@ -224,8 +181,7 @@ export function createProviderSnapshotCache(
}
// Reconstruct the dependency ordering before applying a possibly smaller budget.
for (const reference of entries) {
if (reference.body === undefined) continue;
for (const reference of references) {
const body = entries.find((entry) => entry.key === reference.body);
if (!body) keysToRemove.push(reference.key);
else if (body.writtenAt < reference.writtenAt) body.writtenAt = reference.writtenAt;
@@ -244,7 +200,7 @@ export function createProviderSnapshotCache(
for (const removedKey of keysToRemove) bodies.delete(removedKey);
await storage.multiRemove(keysToRemove);
}
await commitIndex(retainedEntries);
index = retainedEntries;
}
async function ensureCacheIndex(): Promise<ProviderSnapshotIndexEntry[]> {
@@ -279,7 +235,7 @@ export function createProviderSnapshotCache(
value,
};
}
const incoming = { ...prepare(key, input), body: requiredBody?.key };
const incoming = prepare(key, input);
// The index is committed last: membership proves a body was stored. Reusing it
// needs only its byte count, not another parse, expansion, or storage write.
const body = requiredBody
@@ -309,27 +265,29 @@ export function createProviderSnapshotCache(
const keysToRemove = [...replacedKeys].filter(
(replaced) => !admitted.some((entry) => entry.key === replaced),
);
if (projectedBytes > maxBytes) {
for (const candidate of [...retainedEntries].sort(oldestFirst)) {
if (projectedBytes <= maxBytes) break;
projectedBytes -= candidate.bytes;
keysToRemove.push(candidate.key);
}
for (const candidate of [...retainedEntries].sort(oldestFirst)) {
if (projectedBytes <= maxBytes) break;
projectedBytes -= candidate.bytes;
keysToRemove.push(candidate.key);
}
const removedKeys = new Set(keysToRemove);
if (keysToRemove.length > 0) {
for (const removedKey of keysToRemove) bodies.delete(removedKey);
await storage.multiRemove(keysToRemove);
}
// Body, then reference, then index. A failed write can leave a reusable
// Body, then reference, then in-memory index. A failed write can leave a reusable
// orphan body; reconciliation never retains a reference without its body.
for (const entry of admitted) {
if (entry.value !== undefined) await storage.setItem(entry.key, entry.value);
}
await commitIndex([
index = [
...retainedEntries.filter((entry) => !removedKeys.has(entry.key)),
...admitted.map(({ value: _value, ...entry }) => entry),
]);
...admitted.map(({ key: recordKey, bytes, writtenAt }) => ({
key: recordKey,
bytes,
writtenAt,
})),
];
}
async function readRecord(key: string): Promise<StoredProviderSnapshot | null> {
@@ -344,7 +302,7 @@ export function createProviderSnapshotCache(
if (!(error instanceof SyntaxError) && !(error instanceof RangeError)) throw error;
bodies.delete(key);
await storage.removeItem(key);
await commitIndex(currentIndex.filter((entry) => entry.key !== key));
index = currentIndex.filter((entry) => entry.key !== key);
return null;
}
}
@@ -65,7 +65,7 @@ const nativeRequire = createRequire(require.resolve("react-native/package.json")
const { AbortController: NativeAbortController }: { AbortController: typeof AbortController } =
nativeRequire("abort-controller/dist/abort-controller");
function createStorage(onWrite: (key: string) => void = () => {}) {
function createStorage(onWrite: () => void = () => {}) {
const values = new Map<string, string>();
return {
async getItem(key: string) {
@@ -73,7 +73,7 @@ function createStorage(onWrite: (key: string) => void = () => {}) {
},
async setItem(key: string, value: string) {
values.set(key, value);
onWrite(key);
onWrite();
},
async removeItem(key: string) {
values.delete(key);
@@ -164,9 +164,7 @@ describe.each([
async ({ abortOnWrite, hasBody, hasReference }) => {
const controller = new Controller();
let writes = 0;
const storage = createStorage((key) => {
// The boundaries are the stored snapshots, not the cache's own index of them.
if (!key.startsWith("@paseo/provider-snapshot/")) return;
const storage = createStorage(() => {
writes += 1;
if (writes === abortOnWrite) controller.abort();
});
@@ -1,80 +0,0 @@
import { afterEach, describe, expect, it } from "vitest";
import { useSessionStore, type WorkspaceDescriptor } from "@/stores/session-store";
import { selectGitActionsWorkspace } from "./actions-workspace";
const SERVER_ID = "git-actions-server";
function createWorkspace(id: string, workspaceDirectory: string): WorkspaceDescriptor {
return {
id,
projectId: "project-1",
projectDisplayName: "Project 1",
projectRootPath: workspaceDirectory,
workspaceDirectory,
projectKind: "git",
workspaceKind: "worktree",
name: id,
status: "done",
archivingAt: null,
statusEnteredAt: null,
diffStat: null,
scripts: [],
createdAt: null,
lastUserMessageAt: null,
};
}
function seed(workspaces: WorkspaceDescriptor[]): void {
const store = useSessionStore.getState();
store.initializeSession(SERVER_ID, null);
store.mergeWorkspaces(SERVER_ID, workspaces);
}
afterEach(() => {
useSessionStore.getState().clearSession(SERVER_ID);
});
describe("selectGitActionsWorkspace", () => {
it("resolves the workspace the git actions belong to, not another one in the same directory", () => {
seed([createWorkspace("ws-a", "/repo"), createWorkspace("ws-b", "/repo")]);
const workspace = selectGitActionsWorkspace(useSessionStore.getState(), {
serverId: SERVER_ID,
workspaceId: "ws-b",
workspaceDirectory: "/repo",
});
expect(workspace?.id).toBe("ws-b");
});
// Each retained workspace subscribes through this selector. Returning the same descriptor when
// another workspace on the host changes keeps hidden workspaces from re-rendering their git
// actions on every workspace switch.
it("keeps the descriptor reference when another workspace on the host changes", () => {
seed([createWorkspace("ws-a", "/repo-a"), createWorkspace("ws-b", "/repo-b")]);
const input = { serverId: SERVER_ID, workspaceId: "ws-a", workspaceDirectory: "/repo-a" };
const before = selectGitActionsWorkspace(useSessionStore.getState(), input);
useSessionStore
.getState()
.mergeWorkspaces(SERVER_ID, [{ ...createWorkspace("ws-b", "/repo-b"), status: "running" }]);
expect(useSessionStore.getState().sessions[SERVER_ID]?.workspaces.get("ws-b")?.status).toBe(
"running",
);
expect(before?.id).toBe("ws-a");
expect(selectGitActionsWorkspace(useSessionStore.getState(), input)).toBe(before);
});
it("falls back to the workspace in the checkout directory when the caller names no workspace", () => {
seed([createWorkspace("ws-a", "/repo-a"), createWorkspace("ws-b", "/repo-b")]);
const workspace = selectGitActionsWorkspace(useSessionStore.getState(), {
serverId: SERVER_ID,
workspaceId: null,
workspaceDirectory: "/repo-b",
});
expect(workspace?.id).toBe("ws-b");
});
});
-38
View File
@@ -1,38 +0,0 @@
import type { SessionsSnapshot } from "@/stores/session-store-hooks/selectors";
import type { WorkspaceDescriptor } from "@/stores/session-store";
import { resolveWorkspaceMapKeyByIdentity } from "@/utils/workspace-identity";
export interface GitActionsWorkspaceInput {
serverId: string;
/** The workspace that renders the git actions, or null when the caller has none. */
workspaceId: string | null | undefined;
/** The checkout directory, used to find the workspace when the caller names none. */
workspaceDirectory: string | null | undefined;
}
/**
* The workspace descriptor the git actions archive. Returns the stored descriptor itself, so a
* subscriber re-renders only when this workspace changes, not when another workspace on the host
* does.
*/
export function selectGitActionsWorkspace(
state: SessionsSnapshot,
input: GitActionsWorkspaceInput,
): WorkspaceDescriptor | null {
const workspaces = state.sessions[input.serverId]?.workspaces;
const workspaceKey = input.workspaceId
? resolveWorkspaceMapKeyByIdentity({ workspaces, workspaceId: input.workspaceId })
: null;
if (workspaceKey) {
return workspaces?.get(workspaceKey) ?? null;
}
if (!input.workspaceDirectory) {
return null;
}
for (const candidate of workspaces?.values() ?? []) {
if (candidate.workspaceDirectory === input.workspaceDirectory) {
return candidate;
}
}
return null;
}
-1
View File
@@ -1767,7 +1767,6 @@ export function ChangesSurface({
);
const { gitActions, branchLabel } = useGitActions({
serverId,
workspaceId,
cwd,
icons: GIT_ACTION_ICONS,
});
+46 -20
View File
@@ -28,11 +28,14 @@ import type { CheckoutPrMergeMethod } from "@getpaseo/protocol/messages";
import { openExternalUrl } from "@/utils/open-external-url";
import { useToast } from "@/contexts/toast-context";
import { useSessionStore, type WorkspaceDescriptor } from "@/stores/session-store";
import {
useActiveWorkspaceSelection,
type ActiveWorkspaceSelection,
} from "@/stores/navigation-active-workspace-store";
import { redirectIfArchivingActiveWorkspace } from "@/utils/sidebar-workspace-archive-redirect";
import { getFocusedWorkspaceSelection } from "@/navigation/workspace-route-navigation";
import { selectGitActionsWorkspace } from "@/git/actions-workspace";
import { type WorktreeArchiveWarningLabels } from "@/git/worktree-archive-warning";
import { useWorkspaceArchive } from "@/workspace/use-workspace-archive";
import { resolveWorkspaceMapKeyByIdentity } from "@/utils/workspace-identity";
import { readValidatedString } from "@/storage/validated-storage";
export type { GitActionId, GitAction, GitActions } from "@/git/policy";
@@ -197,8 +200,6 @@ function deriveGitActionsState(args: DeriveGitActionsStateArgs): DerivedGitActio
interface UseGitActionsInput {
serverId: string;
/** The workspace these actions belong to; a retained, hidden workspace passes its own. */
workspaceId: string | null | undefined;
cwd: string;
icons: {
commit: ReactElement;
@@ -221,13 +222,38 @@ interface UseGitActionsResult {
interface UseWorkspaceScreenArchiveControllerInput {
serverId: string;
workspaceId: string | null | undefined;
activeWorkspaceSelection: ActiveWorkspaceSelection | null;
workspaceDirectory: string | null | undefined;
branchLabel: string;
gitStatus: CheckoutStatusPayload | null;
t: (key: string, options?: Record<string, unknown>) => string;
}
function resolveArchiveWorkspaceDescriptor(input: {
workspaces: Map<string, WorkspaceDescriptor> | undefined;
activeWorkspaceSelection: ActiveWorkspaceSelection | null;
workspaceDirectory: string | null | undefined;
}): WorkspaceDescriptor | null {
const activeWorkspaceKey = input.activeWorkspaceSelection
? resolveWorkspaceMapKeyByIdentity({
workspaces: input.workspaces,
workspaceId: input.activeWorkspaceSelection.workspaceId,
})
: null;
if (activeWorkspaceKey) {
return input.workspaces?.get(activeWorkspaceKey) ?? null;
}
if (!input.workspaceDirectory) {
return null;
}
for (const candidate of input.workspaces?.values() ?? []) {
if (candidate.workspaceDirectory === input.workspaceDirectory) {
return candidate;
}
}
return null;
}
function resolveWorkspaceArchiveRisk(
workspace: WorkspaceDescriptor | null,
gitStatus: CheckoutStatusPayload | null,
@@ -258,16 +284,23 @@ function availableArchive(
function useWorkspaceScreenArchiveController({
serverId,
workspaceId,
activeWorkspaceSelection,
workspaceDirectory,
branchLabel,
gitStatus,
t,
}: UseWorkspaceScreenArchiveControllerInput) {
const workspaceDescriptor = useSessionStore((state) =>
selectGitActionsWorkspace(state, { serverId, workspaceId, workspaceDirectory }),
);
const sessionWorkspaces = useSessionStore((state) => state.sessions[serverId]?.workspaces);
const [isHidingWorkspace, setIsHidingWorkspace] = useState(false);
const workspaceDescriptor = useMemo(
() =>
resolveArchiveWorkspaceDescriptor({
workspaces: sessionWorkspaces,
activeWorkspaceSelection,
workspaceDirectory,
}),
[activeWorkspaceSelection, sessionWorkspaces, workspaceDirectory],
);
const archiveRisk = resolveWorkspaceArchiveRisk(workspaceDescriptor, gitStatus);
const controller = useWorkspaceArchive({
@@ -280,10 +313,7 @@ function useWorkspaceScreenArchiveController({
warningLabels: getWorktreeArchiveWarningLabels(t),
onSetHiding: setIsHidingWorkspace,
onArchiveStarted: (archived) => {
redirectIfArchivingActiveWorkspace({
...archived,
activeWorkspaceSelection: getFocusedWorkspaceSelection(),
});
redirectIfArchivingActiveWorkspace({ ...archived, activeWorkspaceSelection });
},
});
@@ -294,14 +324,10 @@ function useWorkspaceScreenArchiveController({
};
}
export function useGitActions({
serverId,
workspaceId,
cwd,
icons,
}: UseGitActionsInput): UseGitActionsResult {
export function useGitActions({ serverId, cwd, icons }: UseGitActionsInput): UseGitActionsResult {
const { t } = useTranslation();
const toast = useToast();
const activeWorkspaceSelection = useActiveWorkspaceSelection();
const [postShipArchiveSuggested, setPostShipArchiveSuggested] = useState(false);
const [shipDefault, setShipDefault] = useState<"merge" | "pr">("pr");
@@ -620,7 +646,7 @@ export function useGitActions({
const archiveController = useWorkspaceScreenArchiveController({
serverId,
workspaceId,
activeWorkspaceSelection,
workspaceDirectory: status?.cwd,
branchLabel,
gitStatus,
+1 -3
View File
@@ -4,14 +4,12 @@ import { useGitActions } from "@/git/use-actions";
interface WorkspaceActionsProps {
serverId: string;
workspaceId: string;
cwd: string;
}
export function WorkspaceActions({ serverId, workspaceId, cwd }: WorkspaceActionsProps) {
export function WorkspaceActions({ serverId, cwd }: WorkspaceActionsProps) {
const { gitActions } = useGitActions({
serverId,
workspaceId,
cwd,
icons: GIT_ACTION_ICONS,
});
@@ -123,7 +123,7 @@ function buildProviderModelsByProvider(
for (const entry of snapshotEntries ?? []) {
map.set(
entry.provider,
entry.status === "ready" ? filterSelectableModels(entry.models ?? []) : null,
entry.status === "ready" ? filterSelectableModels(entry.models ?? null) : null,
);
}
return map;
@@ -273,11 +273,8 @@ export function useAgentFormState(options: UseAgentFormStateOptions): UseAgentFo
const modelSelectorProviders = snapshotModelSelectorProviders;
const availableModels = snapshotSelectedProviderModels;
const modeOptions = snapshotSelectedProviderModes;
const selectedProviderHasError =
snapshotSelectedEntry?.status === "error" || snapshotSelectedEntry?.status === "unavailable";
const isModelSelectionLoading =
isConnected &&
!selectedProviderHasError &&
(resolution.status === "pending" || snapshotIsLoading || selectedProviderIsLoading);
const isAllModelsLoading = isModelSelectionLoading;
@@ -43,7 +43,7 @@ describe("schedule mutation cache updates", () => {
const current: FetchAggregatedSchedulesResult = {
status: "loaded",
data: [schedule()],
hostWarnings: [],
hostErrors: [],
};
const result = updateAggregatedSchedulesData(current, pauseSchedules);
@@ -51,7 +51,7 @@ describe("schedule mutation cache updates", () => {
expect(result).toEqual({
status: "loaded",
data: [schedule({ status: "paused" })],
hostWarnings: [],
hostErrors: [],
});
});
@@ -69,7 +69,7 @@ describe("schedule mutation cache updates", () => {
const loaded: FetchAggregatedSchedulesResult = {
status: "loaded",
data: [schedule()],
hostWarnings: [],
hostErrors: [],
};
queryClient.setQueryData(connectingKey, connecting);
queryClient.setQueryData(loadedKey, loaded);
@@ -85,7 +85,7 @@ describe("schedule mutation cache updates", () => {
expect(queryClient.getQueryData(loadedKey)).toEqual({
status: "loaded",
data: [schedule({ status: "paused" })],
hostWarnings: [],
hostErrors: [],
});
});
});
+4 -4
View File
@@ -10,14 +10,14 @@ import {
schedulesQueryBaseKey,
type AggregateLoadState,
type AggregatedSchedule,
type ScheduleHostWarning,
type ScheduleHostError,
type ScheduleHostInput,
} from "@/schedules/aggregated-schedules";
export type {
AggregateLoadState,
AggregatedSchedule,
ScheduleHostWarning,
ScheduleHostError,
} from "@/schedules/aggregated-schedules";
export function schedulesQueryKey(serverIds: readonly string[]) {
@@ -26,7 +26,7 @@ export function schedulesQueryKey(serverIds: readonly string[]) {
export interface UseSchedulesResult {
loadState: AggregateLoadState<AggregatedSchedule>;
hostWarnings: ScheduleHostWarning[];
hostErrors: ScheduleHostError[];
isError: boolean;
error: Error | null;
refetch: () => void;
@@ -65,7 +65,7 @@ export function useSchedules(): UseSchedulesResult {
return {
loadState,
hostWarnings: query.data?.status === "loaded" ? query.data.hostWarnings : [],
hostErrors: query.data?.status === "loaded" ? query.data.hostErrors : [],
isError: query.isError,
error: query.error,
refetch: () => {
+3 -2
View File
@@ -278,8 +278,6 @@ export const ar: TranslationResources = {
failedToLoad: "فشل تحميل الوكيل",
reconnecting: "جارٍ إعادة الاتصال",
updating: "جارٍ تحديث الرسائل",
loadingAgent: "جارٍ تحميل الوكيل",
loadingHistory: "جارٍ تحميل سجل الوكيل",
timelineSyncFailed: "تعذر تحديث سجل الوكيل.",
timelineSyncRetrying: "جارٍ إعادة المحاولة…",
archivingTitle: "وكيل الارشيف...",
@@ -2185,6 +2183,9 @@ export const ar: TranslationResources = {
archiveFinishedRetry: "إعادة المحاولة ({{failed}}/{{total}})",
},
panels: {
renderError: {
title: "تعذّر عرض هذه اللوحة",
},
draft: {
newAgent: "وكيل جديد",
creatingAgent: "وكيل الخلق",
+3 -2
View File
@@ -276,8 +276,6 @@ export const en = {
failedToLoad: "Failed to load agent",
reconnecting: "Reconnecting",
updating: "Updating messages",
loadingAgent: "Loading agent",
loadingHistory: "Loading agent history",
timelineSyncFailed: "Couldn't refresh agent history.",
timelineSyncRetrying: "Retrying…",
archivingTitle: "Archiving agent...",
@@ -2215,6 +2213,9 @@ export const en = {
archiveFinishedRetry: "Retry ({{failed}}/{{total}})",
},
panels: {
renderError: {
title: "Unable to show this panel",
},
draft: {
newAgent: "New Agent",
creatingAgent: "Creating agent",
+3 -2
View File
@@ -280,8 +280,6 @@ export const es: TranslationResources = {
failedToLoad: "No se pudo cargar el agente",
reconnecting: "Reconectando",
updating: "Actualizando mensajes",
loadingAgent: "Cargando agente",
loadingHistory: "Cargando historial del agente",
timelineSyncFailed: "No se pudo actualizar el historial del agente.",
timelineSyncRetrying: "Reintentando…",
archivingTitle: "Agente de archivo...",
@@ -2241,6 +2239,9 @@ export const es: TranslationResources = {
archiveFinishedRetry: "Reintentar ({{failed}}/{{total}})",
},
panels: {
renderError: {
title: "No se puede mostrar este panel",
},
draft: {
newAgent: "Nuevo agente",
creatingAgent: "Agente creador",
+3 -2
View File
@@ -281,8 +281,6 @@ export const fr: TranslationResources = {
failedToLoad: "Impossible de charger l’agent",
reconnecting: "Reconnexion…",
updating: "Mise à jour des messages…",
loadingAgent: "Chargement de l’agent",
loadingHistory: "Chargement de l’historique de l’agent",
timelineSyncFailed: "Impossible d’actualiser l’historique de l’agent.",
timelineSyncRetrying: "Nouvelle tentative…",
archivingTitle: "Archivage de l’agent…",
@@ -2238,6 +2236,9 @@ export const fr: TranslationResources = {
archiveFinishedRetry: "Réessayer ({{failed}}/{{total}})",
},
panels: {
renderError: {
title: "Impossible d'afficher ce panneau",
},
draft: {
newAgent: "Nouvel agent",
creatingAgent: "Création de l’agent",
+3 -2
View File
@@ -280,8 +280,6 @@ export const ja: TranslationResources = {
failedToLoad: "エージェントの読み込みに失敗しました",
reconnecting: "再接続中",
updating: "メッセージを更新中",
loadingAgent: "エージェントを読み込み中",
loadingHistory: "エージェントの履歴を読み込み中",
timelineSyncFailed: "エージェントの履歴を更新できませんでした。",
timelineSyncRetrying: "再試行しています…",
archivingTitle: "エージェントをアーカイブ中...",
@@ -2208,6 +2206,9 @@ export const ja: TranslationResources = {
archiveFinishedRetry: "再試行 ({{failed}}/{{total}})",
},
panels: {
renderError: {
title: "このパネルを表示できません",
},
draft: {
newAgent: "新しいエージェント",
creatingAgent: "エージェントを作成中",
+3 -2
View File
@@ -278,8 +278,6 @@ export const ko: TranslationResources = {
failedToLoad: "에이전트를 불러오지 못했습니다",
reconnecting: "다시 연결하는 중",
updating: "메시지 업데이트 중",
loadingAgent: "에이전트 불러오는 중",
loadingHistory: "에이전트 기록 불러오는 중",
timelineSyncFailed: "에이전트 기록을 새로고침할 수 없습니다.",
timelineSyncRetrying: "재시도 중…",
archivingTitle: "에이전트 보관 중...",
@@ -2197,6 +2195,9 @@ export const ko: TranslationResources = {
archiveFinishedRetry: "다시 시도 ({{failed}}/{{total}})",
},
panels: {
renderError: {
title: "이 패널을 표시할 수 없습니다",
},
draft: {
newAgent: "새 에이전트",
creatingAgent: "에이전트 생성 중",
+3 -2
View File
@@ -279,8 +279,6 @@ export const ptBR: TranslationResources = {
failedToLoad: "Falha ao carregar agente",
reconnecting: "Reconectando",
updating: "Atualizando mensagens",
loadingAgent: "Carregando agente",
loadingHistory: "Carregando histórico do agente",
timelineSyncFailed: "Não foi possível atualizar o histórico do agente.",
timelineSyncRetrying: "Tentando novamente…",
archivingTitle: "Arquivando agente...",
@@ -2225,6 +2223,9 @@ export const ptBR: TranslationResources = {
archiveFinishedRetry: "Tentar novamente ({{failed}}/{{total}})",
},
panels: {
renderError: {
title: "Não foi possível exibir este painel",
},
draft: {
newAgent: "Novo Agente",
creatingAgent: "Criando agente",
+3 -2
View File
@@ -280,8 +280,6 @@ export const ru: TranslationResources = {
failedToLoad: "Не удалось загрузить агента",
reconnecting: "Повторное подключение",
updating: "Обновление сообщений",
loadingAgent: "Загрузка агента",
loadingHistory: "Загрузка истории агента",
timelineSyncFailed: "Не удалось обновить историю агента.",
timelineSyncRetrying: "Повторная попытка…",
archivingTitle: "Агент перемещается в архив...",
@@ -2225,6 +2223,9 @@ export const ru: TranslationResources = {
archiveFinishedRetry: "Повторить ({{failed}}/{{total}})",
},
panels: {
renderError: {
title: "Не удалось показать эту панель",
},
draft: {
newAgent: "Новый агент",
creatingAgent: "Создание агента",
+3 -2
View File
@@ -278,8 +278,6 @@ export const zhCN: TranslationResources = {
failedToLoad: "加载 Agent 失败",
reconnecting: "正在重新连接",
updating: "正在更新消息",
loadingAgent: "正在加载代理",
loadingHistory: "正在加载代理历史记录",
timelineSyncFailed: "无法刷新代理历史记录。",
timelineSyncRetrying: "正在重试…",
archivingTitle: "正在归档 Agent...",
@@ -2162,6 +2160,9 @@ export const zhCN: TranslationResources = {
archiveFinishedRetry: "重试 ({{failed}}/{{total}})",
},
panels: {
renderError: {
title: "无法显示此面板",
},
draft: {
newAgent: "新建 Agent",
creatingAgent: "正在创建 Agent",
@@ -13,12 +13,6 @@ export interface KeyboardShiftContextValue {
export const KeyboardShiftContext = createContext<KeyboardShiftContextValue | null>(null);
/**
* The shift the keyboard is at, or is moving to. React state, where the shared values
* above are not: it changes when a keyboard motion starts and ends, never per frame.
*/
export const KeyboardTargetShiftContext = createContext(0);
/** How the nearest KeyboardTranslateView moves its descendants with the keyboard. */
export interface KeyboardTranslation {
enabled: boolean;
@@ -11,8 +11,8 @@ export function measureInWindow(element: View): Promise<WindowRect> {
/**
* The element's window rect with `frame`'s own transform left out. Whether
* `measureInWindow` includes a transform depends on the driver: Reanimated commits
* it to the shadow tree every frame, the iOS translate view commits only where the
* keyboard rests. Fabric's `measureLayout` and a view's `measure` origin ignore
* it to the shadow tree every frame, the iOS translate view commits it only once the
* keyboard settles. Fabric's `measureLayout` and a view's `measure` origin ignore
* transforms. The frame's parent must not move with the keyboard; the composer dock
* is the only anchor host, and its parent is the stationary dock viewport.
*/
@@ -1,4 +1,4 @@
import { createElement, useEffect, useMemo, useState, type ReactNode } from "react";
import { createElement, useEffect, useMemo, type ReactNode } from "react";
import { Platform } from "react-native";
import type { ViewStyle } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
@@ -12,14 +12,13 @@ import {
useSharedValue,
type SharedValue,
} from "react-native-reanimated";
import { scheduleOnRN } from "react-native-worklets";
import {
DEFAULT_IOS_KEYBOARD_INSET_MIN_HEIGHT,
resolveKeyboardShift,
reserveKeyboardLayoutShift,
shouldReconcileHiddenKeyboardEnd,
} from "./policy";
import { KeyboardShiftContext, KeyboardTargetShiftContext, useKeyboardShift } from "./context";
import { KeyboardShiftContext, useKeyboardShift } from "./context";
type KeyboardShiftMode = "translate" | "padding";
@@ -30,7 +29,6 @@ export function KeyboardShiftProvider({ children }: { children: ReactNode }) {
const isIos = Platform.OS === "ios";
const isMoving = useSharedValue(false);
const layoutShift = useSharedValue(0);
const [targetShift, setTargetShift] = useState(0);
useEffect(() => {
bottomInset.value = insets.bottom;
}, [bottomInset, insets.bottom]);
@@ -63,7 +61,6 @@ export function KeyboardShiftProvider({ children }: { children: ReactNode }) {
phase: "start",
});
isMoving.value = true;
scheduleOnRN(setTargetShift, target);
},
onEnd: (event) => {
"worklet";
@@ -84,7 +81,6 @@ export function KeyboardShiftProvider({ children }: { children: ReactNode }) {
keyboardProgress.value = 0;
}
isMoving.value = false;
scheduleOnRN(setTargetShift, target);
},
},
[bottomInset, isIos, isMoving, keyboardHeight, keyboardProgress, layoutShift],
@@ -100,11 +96,7 @@ export function KeyboardShiftProvider({ children }: { children: ReactNode }) {
[bottomInset, isMoving, layoutShift, shift],
);
return createElement(
KeyboardShiftContext.Provider,
{ value },
createElement(KeyboardTargetShiftContext.Provider, { value: targetShift }, children),
);
return createElement(KeyboardShiftContext.Provider, { value }, children);
}
export function useKeyboardShiftStyle(input: { mode: KeyboardShiftMode; enabled?: boolean }): {
@@ -1,8 +1,10 @@
import { useContext, useEffect, useMemo, useRef, type ReactNode, type Ref } from "react";
import { Animated, useAnimatedValue, View, type ViewProps } from "react-native";
import { useCallback, useMemo, useEffect, useRef, type ReactNode } from "react";
import { Animated, useAnimatedValue, type View, type ViewProps } from "react-native";
import { useKeyboardAnimation } from "react-native-keyboard-controller";
import { useAnimatedReaction } from "react-native-reanimated";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { KeyboardTargetShiftContext, KeyboardTranslationContext } from "./context";
import { scheduleOnRN } from "react-native-worklets";
import { KeyboardTranslationContext, useKeyboardShift } from "./context";
import { useKeyboardTranslationScope } from "./measure";
import { resolveKeyboardLift } from "./policy";
@@ -18,27 +20,6 @@ interface KeyboardTranslateViewProps extends ViewProps {
keyboardGap?: number;
}
/**
* The view the native driver moves. Animated renders a driven transform from its JS-side
* value, and the keyboard's values never reach JS, so React would commit an unlifted view.
* This commits where the view rests instead, which is what Fabric paints when it creates
* or resizes the view, and what Pressability measures. The driver paints the frames in
* between.
*/
function RestingFrame({
restingTranslateY,
style,
...props
}: ViewProps & { restingTranslateY: number; ref?: Ref<View> }) {
const resting = useMemo(
() => ({ transform: [{ translateY: restingTranslateY }] }),
[restingTranslateY],
);
return <View {...props} style={[style, resting]} />;
}
const DrivenFrame = Animated.createAnimatedComponent(RestingFrame);
export function KeyboardTranslateView({
children,
enabled = true,
@@ -66,34 +47,28 @@ export function KeyboardTranslateView({
});
return Animated.add(lift, gap);
}, [bottomClearance, height, insets.bottom, keyboardGap, progress]);
// Fullscreen resizes this view while disabling translation. iOS Fabric can
// reapply its previous transform during that layout commit. Keep the graph
// attached and apply the mode on the native animation frame; a static zero or
// setValue during the React commit gets overwritten by the resize. A rebuilt
// graph (a new bottomClearance after rotation) starts from JS-side keyboard
// values, so run it on the native frame too or it stays stale until the
// keyboard next moves.
const enabledValue = useAnimatedValue(enabled ? 1 : 0);
useEffect(() => {
const animation = Animated.timing(enabledValue, {
toValue: enabled ? 1 : 0,
duration: 0,
useNativeDriver: true,
});
animation.start();
return () => animation.stop();
}, [enabled, enabledValue, translateY]);
const keyboardStyle = useMemo(
() => ({ transform: [{ translateY: Animated.multiply(translateY, enabledValue) }] }),
[enabledValue, translateY],
);
// A change of mode or clearance lands with the layout that carries it: the commit holds
// the new resting lift, and Fabric paints a driven view's committed transform when the
// commit resizes the view. A caller that changes `enabled` must do it on the view the
// change resizes; without a resize the old lift stays until the driver catches up below.
const targetShift = useContext(KeyboardTargetShiftContext);
const restingLift = resolveKeyboardLift({
shift: targetShift,
enabled,
bottomClearance,
keyboardGap,
});
// The driver catches up one frame later, when the commit has mounted. Its operations
// are not ordered with a mount: sent from the commit, they could paint the new mode
// over the old layout. After the mount they repaint what Fabric already painted. A
// rebuilt graph (a new bottomClearance after rotation) needs the same push, or it
// keeps the old lift until the keyboard next moves.
useEffect(() => {
const frame = requestAnimationFrame(() => enabledValue.setValue(enabled ? 1 : 0));
return () => cancelAnimationFrame(frame);
}, [enabled, enabledValue, translateY]);
const frameRef = useRef<View>(null);
const translation = useMemo(
() => ({ enabled, bottomClearance, keyboardGap }),
@@ -101,16 +76,30 @@ export function KeyboardTranslateView({
);
const scope = useKeyboardTranslationScope(frameRef, translation);
// The native driver moves the view without telling the shadow tree, and Pressability
// measures its press region there. With a stale region, a touch that drifts a few
// points leaves it and the press is dropped. Commit the lift once the keyboard settles.
const { layoutShift, isMoving } = useKeyboardShift();
const commitRestingLift = useCallback(
(shift: number) => {
const lift = resolveKeyboardLift({ shift, ...translation });
frameRef.current?.setNativeProps({ transform: [{ translateY: -lift }] });
},
[translation],
);
useAnimatedReaction(
() => (isMoving.value ? null : layoutShift.value),
(restingShift) => {
if (restingShift !== null) scheduleOnRN(commitRestingLift, restingShift);
},
[commitRestingLift],
);
return (
<DrivenFrame
ref={frameRef}
style={[style, keyboardStyle]}
restingTranslateY={-restingLift}
{...props}
>
<Animated.View ref={frameRef} style={[style, keyboardStyle]} {...props}>
<KeyboardTranslationContext.Provider value={scope}>
{children}
</KeyboardTranslationContext.Provider>
</DrivenFrame>
</Animated.View>
);
}
-51
View File
@@ -1,51 +0,0 @@
import { useEffect, useLayoutEffect } from "react";
import { createNativeSplashController, type NativeSplashController } from "./internal/controller";
import { launchSurface } from "./internal/launch-surface";
export { LaunchScreen } from "./internal/launch-surface";
// Guards against a screen that never releases its hold. A slow device places the first
// conversation 2-4 s after the JS entry, so a shorter cap cuts in before it paints.
const CAP_MS = 5_000;
let controller: NativeSplashController | null = null;
let releaseLaunch: (() => void) | null = null;
/**
* Call once at the JS entry. The launch surface (the native splash, or on Android the
* `LaunchScreen` that replaces it) then covers the app until the root navigator has committed its
* first screen and no screen holds it, and leaves from here alone.
*/
export function keepNativeSplash(): void {
if (controller) return;
launchSurface.keep();
controller = createNativeSplashController(
{
hide: () => launchSurface.leave(),
afterNextFrame: (callback) => {
requestAnimationFrame(() => callback());
},
startTimer: (callback, ms) => {
setTimeout(callback, ms);
},
},
{ capMs: CAP_MS },
);
releaseLaunch = controller.hold();
}
/** The root navigator's first commit ends the launch hold. Screens committed with it hold first. */
export function useNativeSplashLaunchCommit(): void {
useEffect(() => {
releaseLaunch?.();
releaseLaunch = null;
}, []);
}
/** Keeps the launch surface up while `active`, for a screen that has nothing to show yet. */
export function useNativeSplashHold(active: boolean): void {
useLayoutEffect(() => {
if (!active) return;
return controller?.hold();
}, [active]);
}
@@ -1,86 +0,0 @@
import { describe, expect, it } from "vitest";
import { createNativeSplashController } from "./controller";
function createFakeSplash() {
const frames: Array<() => void> = [];
const timers: Array<{ callback: () => void; ms: number }> = [];
const splash = { hides: 0 };
const controller = createNativeSplashController(
{
hide: () => {
splash.hides += 1;
},
afterNextFrame: (callback) => {
frames.push(callback);
},
startTimer: (callback, ms) => {
timers.push({ callback, ms });
},
},
{ capMs: 3_000 },
);
const runFrame = () => {
for (const callback of frames.splice(0)) callback();
};
const runCap = () => {
for (const timer of timers.splice(0)) timer.callback();
};
return { controller, splash, runFrame, runCap, timers };
}
describe("native splash", () => {
it("stays up while a screen holds it and hides a frame after the last release", () => {
const { controller, splash, runFrame } = createFakeSplash();
const releaseLaunch = controller.hold();
const releaseScreen = controller.hold();
releaseLaunch();
runFrame();
expect(splash.hides).toBe(0);
releaseScreen();
expect(splash.hides).toBe(0);
runFrame();
expect(splash.hides).toBe(1);
});
it("stays up when the next screen takes the hold before the frame passes", () => {
const { controller, splash, runFrame } = createFakeSplash();
const releaseSplashRoute = controller.hold();
releaseSplashRoute();
const releaseWorkspace = controller.hold();
runFrame();
expect(splash.hides).toBe(0);
releaseWorkspace();
runFrame();
expect(splash.hides).toBe(1);
});
it("hides when the cap runs out even while a screen still holds it", () => {
const { controller, splash, runCap, runFrame, timers } = createFakeSplash();
const release = controller.hold();
expect(timers.map((timer) => timer.ms)).toEqual([3_000]);
runCap();
expect(splash.hides).toBe(1);
release();
runFrame();
expect(controller.hold()).toBeTypeOf("function");
runFrame();
expect(splash.hides).toBe(1);
});
it("counts a repeated release once", () => {
const { controller, splash, runFrame } = createFakeSplash();
const first = controller.hold();
controller.hold();
first();
first();
runFrame();
expect(splash.hides).toBe(0);
});
});
@@ -1,53 +0,0 @@
export interface NativeSplashPort {
hide(): void;
/** Runs the callback after the next frame, once the committed screen has been drawn. */
afterNextFrame(callback: () => void): void;
startTimer(callback: () => void, ms: number): void;
}
export interface NativeSplashController {
/** Keeps the splash up until the returned release runs. Holds after the hide do nothing. */
hold(): () => void;
}
/**
* The splash hides once, after a frame passes with nothing holding it, or when the cap runs out.
* The frame wait lets a screen that replaces a holding screen in the same commit take over.
*/
export function createNativeSplashController(
port: NativeSplashPort,
options: { capMs: number },
): NativeSplashController {
let holds = 0;
let hidden = false;
let checkScheduled = false;
const hide = () => {
if (hidden) return;
hidden = true;
port.hide();
};
const hideIfReleased = () => {
checkScheduled = false;
if (holds === 0) hide();
};
port.startTimer(hide, options.capMs);
return {
hold() {
if (hidden) return () => undefined;
holds += 1;
let released = false;
return () => {
if (released) return;
released = true;
holds -= 1;
if (holds > 0 || hidden || checkScheduled) return;
checkScheduled = true;
port.afterNextFrame(hideIfReleased);
};
},
};
}
@@ -1,104 +0,0 @@
import { useEffect, useState, useSyncExternalStore } from "react";
import { useColorScheme, View } from "react-native";
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
import { scheduleOnRN } from "react-native-worklets";
import { StyleSheet } from "react-native-unistyles";
import * as SplashScreen from "expo-splash-screen";
import { PaseoLogo } from "@/components/icons/paseo-logo";
// Android hands its splash to the app in a way the app cannot time: the system can show one app
// frame before its copy of the splash draws, and a frame the app draws first can be empty. So the
// native splash leaves as soon as React commits this screen, which looks the same as the splash,
// and this screen covers the app until launch is done.
// The splash colours from the expo-splash-screen entry in app.config.js. Android picks them from
// the system dark mode, not from the app theme.
const SPLASH_BACKGROUND = { dark: "#000000", light: "#ffffff" } as const;
// Android draws a splash icon without a background inside a 192dp circle.
const ICON_CIRCLE_SIZE = 192;
// The splash icon's glyph is 135dp wide, which the logo's glyph reaches at this SVG size.
const LOGO_SIZE = 182;
const EXIT_MS = 200;
let launchDone = false;
const listeners = new Set<() => void>();
function subscribe(listener: () => void): () => void {
listeners.add(listener);
return () => listeners.delete(listener);
}
function isLaunchDone(): boolean {
return launchDone;
}
/** Android: this screen covers the app until launch is done, then fades out. */
export const launchSurface = {
keep(): void {
void SplashScreen.preventAutoHideAsync().catch(() => undefined);
// The system's copy of the splash fades over this screen, which looks the same.
SplashScreen.setOptions({ duration: 150, fade: true });
},
leave(): void {
if (launchDone) return;
launchDone = true;
for (const listener of listeners) listener();
},
};
export function LaunchScreen() {
const leaving = useSyncExternalStore(subscribe, isLaunchDone);
const [gone, setGone] = useState(false);
const scheme = useColorScheme() === "light" ? "light" : "dark";
const opacity = useSharedValue(1);
const fadeStyle = useAnimatedStyle(() => ({ opacity: opacity.value }));
useEffect(() => {
SplashScreen.hide();
}, []);
useEffect(() => {
if (!leaving) return;
opacity.value = withTiming(0, { duration: EXIT_MS }, (finished) => {
if (finished) scheduleOnRN(setGone, true);
});
}, [leaving, opacity]);
if (gone) return null;
return (
<Animated.View
pointerEvents={leaving ? "none" : "auto"}
style={[styles.screen, { backgroundColor: SPLASH_BACKGROUND[scheme] }, fadeStyle]}
>
<View style={styles.iconCircle}>
<View style={styles.logo}>
<PaseoLogo size={LOGO_SIZE} color="#ffffff" />
</View>
</View>
</Animated.View>
);
}
const styles = StyleSheet.create({
screen: {
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
alignItems: "center",
justifyContent: "center",
},
iconCircle: {
width: ICON_CIRCLE_SIZE,
height: ICON_CIRCLE_SIZE,
borderRadius: ICON_CIRCLE_SIZE / 2,
backgroundColor: "#000000",
alignItems: "center",
justifyContent: "center",
},
logo: {
// Optical: the glyph sits right of the SVG's centre. The splash centres the glyph.
transform: [{ translateX: -4 }],
},
});
@@ -1,20 +0,0 @@
import * as SplashScreen from "expo-splash-screen";
// iOS fades the native splash straight into the first screen.
const FADE_MS = 150;
/** iOS and web: the native splash itself covers the app until launch is done. */
export const launchSurface = {
keep(): void {
// Taking control stops expo-router from hiding the splash when navigation is ready.
void SplashScreen.preventAutoHideAsync().catch(() => undefined);
SplashScreen.setOptions({ duration: FADE_MS, fade: true });
},
leave(): void {
SplashScreen.hide();
},
};
export function LaunchScreen(): null {
return null;
}
@@ -4,6 +4,7 @@ import {
resolveStartupNavigationReady,
resolveHostIndexRoute,
resolveStartupRoute,
shouldRunStartupGiveUpTimer,
startHostRuntimeBootstrap,
bindHostRuntimeAppState,
} from "./host-runtime-bootstrap";
@@ -89,41 +90,6 @@ describe("startHostRuntimeBootstrap", () => {
"decision:true",
]);
});
it("settles once the registry boot and the managed-daemon start have both finished", async () => {
let resolveBoot!: () => void;
let resolveDaemonStart!: (result: DaemonStartResult) => void;
let settled = false;
const bootstrap = startHostRuntimeBootstrap({
store: {
boot: () =>
new Promise<void>((resolve) => {
resolveBoot = resolve;
}),
},
daemonStartService: {
startIfEnabled: () =>
new Promise<DaemonStartResult>((resolve) => {
resolveDaemonStart = resolve;
}),
},
shouldStartDaemon: false,
});
void bootstrap.then(() => {
settled = true;
return;
});
resolveBoot();
await Promise.resolve();
await Promise.resolve();
expect(settled).toBe(false);
resolveDaemonStart({ ok: false, error: "daemon failed to start" });
await bootstrap;
expect(settled).toBe(true);
});
});
describe("startup blocking policy", () => {
@@ -134,11 +100,18 @@ describe("startup blocking policy", () => {
daemonStartError: null,
};
it("does not block navigation when no startup blocker is active", () => {
it("runs the give-up timer when no startup blocker is active", () => {
const blocker = resolveStartupBlocker(noBlockerInput);
expect(blocker).toEqual({ kind: "none" });
expect(resolveStartupNavigationReady({ startupBlocker: blocker })).toBe(true);
expect(
shouldRunStartupGiveUpTimer({
startupBlocker: blocker,
anyOnlineHostServerId: null,
hasGivenUpWaitingForHost: false,
}),
).toBe(true);
});
it("blocks navigation while desktop is starting the managed daemon", () => {
@@ -150,6 +123,13 @@ describe("startup blocking policy", () => {
expect(blocker).toEqual({ kind: "managed-daemon-starting" });
expect(resolveStartupNavigationReady({ startupBlocker: blocker })).toBe(false);
expect(
shouldRunStartupGiveUpTimer({
startupBlocker: blocker,
anyOnlineHostServerId: null,
hasGivenUpWaitingForHost: false,
}),
).toBe(false);
});
it("unblocks navigation when any host is online", () => {
@@ -176,6 +156,13 @@ describe("startup blocking policy", () => {
message: "daemon failed to start",
});
expect(resolveStartupNavigationReady({ startupBlocker: blocker })).toBe(true);
expect(
shouldRunStartupGiveUpTimer({
startupBlocker: blocker,
anyOnlineHostServerId: null,
hasGivenUpWaitingForHost: false,
}),
).toBe(false);
});
});
@@ -189,7 +176,7 @@ describe("resolveStartupRoute", () => {
workspaceSelection: null,
workspaceSelectionStatus: "unknown" as const,
isWorkspaceSelectionLoaded: true,
isWaitingForHost: true,
hasGivenUpWaitingForHost: false,
isWaitingForSetup: false,
};
const baseHostInput = {
@@ -233,7 +220,7 @@ describe("resolveStartupRoute", () => {
...baseIndexInput,
hostRegistryStatus: "loading",
workspaceSelection: { serverId: "server-1", workspaceId: "workspace-a" },
isWaitingForHost: false,
hasGivenUpWaitingForHost: true,
}),
).toEqual({ kind: "splash" });
});
@@ -278,7 +265,7 @@ describe("resolveStartupRoute", () => {
...baseIndexInput,
workspaceSelection: { serverId: "server-saved", workspaceId: "workspace-a" },
hosts: [{ serverId: "server-next" }],
isWaitingForHost: false,
hasGivenUpWaitingForHost: true,
}),
).toEqual({ kind: "redirect", href: "/h/server-next" });
});
@@ -319,25 +306,16 @@ describe("resolveStartupRoute", () => {
resolveStartupRoute({
...baseIndexInput,
hosts: [{ serverId: "server-saved" }],
isWaitingForHost: false,
hasGivenUpWaitingForHost: true,
}),
).toEqual({ kind: "redirect", href: "/h/server-saved" });
});
it("holds the splash while a startup host source can still add a host", () => {
it("shows welcome after root startup gives up and no host exists", () => {
expect(
resolveStartupRoute({
...baseIndexInput,
isWaitingForHost: true,
}),
).toEqual({ kind: "splash" });
});
it("shows welcome as soon as no host exists and none can still arrive", () => {
expect(
resolveStartupRoute({
...baseIndexInput,
isWaitingForHost: false,
hasGivenUpWaitingForHost: true,
}),
).toEqual({ kind: "redirect", href: "/welcome" });
});
@@ -26,15 +26,9 @@ export interface StartHostRuntimeBootstrapInput {
shouldStartDaemon: DaemonStartCondition;
}
/**
* Starts every source that can add a host at launch: the registry boot with its connection probes,
* and the managed daemon. Settles once none of them can still add one.
*/
export async function startHostRuntimeBootstrap(
input: StartHostRuntimeBootstrapInput,
): Promise<void> {
export function startHostRuntimeBootstrap(input: StartHostRuntimeBootstrapInput): void {
const registryReady = input.store.boot();
const daemonStart = input.daemonStartService.startIfEnabled({
void input.daemonStartService.startIfEnabled({
shouldStart: async () => {
await registryReady;
return typeof input.shouldStartDaemon === "boolean"
@@ -42,7 +36,6 @@ export async function startHostRuntimeBootstrap(
: input.shouldStartDaemon();
},
});
await Promise.allSettled([registryReady, daemonStart]);
}
const WELCOME_ROUTE: Href = "/welcome";
@@ -83,6 +76,20 @@ export function resolveStartupNavigationReady(input: { startupBlocker: StartupBl
return input.startupBlocker.kind !== "managed-daemon-starting";
}
export function shouldRunStartupGiveUpTimer(input: {
startupBlocker: StartupBlocker;
anyOnlineHostServerId: string | null;
hasGivenUpWaitingForHost: boolean;
}): boolean {
if (input.anyOnlineHostServerId) {
return false;
}
if (input.hasGivenUpWaitingForHost) {
return false;
}
return input.startupBlocker.kind === "none";
}
export type StartupRegistryStatus = "loading" | "ready";
export interface IndexStartupRouteTarget {
@@ -109,8 +116,7 @@ export interface ResolveIndexStartupRouteInput extends ResolveStartupRouteBaseIn
workspaceSelection: ActiveWorkspaceSelection | null;
workspaceSelectionStatus: WorkspaceSelectionStatus;
isWorkspaceSelectionLoaded: boolean;
/** A startup host source can still add a host; see `startHostRuntimeBootstrap`. */
isWaitingForHost: boolean;
hasGivenUpWaitingForHost: boolean;
/** Setup may still open over the empty home; see `useIsSetupDecisionPending`. */
isWaitingForSetup: boolean;
}
@@ -209,11 +215,11 @@ function resolveReadyIndexStartupRoute(input: ResolveIndexStartupRouteInput): St
return { kind: "redirect", href: buildHostRootRoute(savedHostServerId) };
}
if (input.isWaitingForHost) {
return { kind: "splash" };
if (input.hasGivenUpWaitingForHost) {
return { kind: "redirect", href: WELCOME_ROUTE };
}
return { kind: "redirect", href: WELCOME_ROUTE };
return { kind: "splash" };
}
function resolveReadyHostStartupRoute(input: ResolveHostStartupRouteInput): StartupRouteDecision {
+19 -54
View File
@@ -1,8 +1,6 @@
import { getHostRuntimeStore } from "@/runtime/host-runtime";
import { useNativeSplashHold } from "@/native-splash";
import { Button } from "@/components/ui/button";
import { LoadingSpinner } from "@/components/ui/loading-spinner";
import { LoadingState } from "@/components/ui/loading-state";
import type { DaemonClient } from "@getpaseo/client/internal/daemon-client";
import type { TFunction } from "i18next";
import { SquarePen } from "lucide-react-native";
@@ -99,7 +97,6 @@ import { ParentAgentCallout, useParentAgentId } from "@/subagents/parent";
import { useCreateFlowStore } from "@/stores/create-flow-store";
import { buildDraftStoreKey, generateDraftId } from "@/stores/draft-keys";
import {
selectAgentLoadingWait,
selectAgentTimelineState,
selectAgentTimelineTurnPresentation,
type Agent,
@@ -245,7 +242,6 @@ function AgentLoadErrorView({ message, onRetry }: { message: string; onRetry: ()
/** A draft has no agent to wait for; an agent shows its loading and error states until ready. */
function renderConversationNonReadyView(args: {
serverId: string;
draft: DraftConversation | null;
agentId: string | undefined;
cwd: string | null;
@@ -257,25 +253,23 @@ function renderConversationNonReadyView(args: {
if (args.draft) {
return null;
}
invariant(args.agentId, "agent id is defined when the conversation is not a draft");
const nonReadyView = renderChatAgentNonReadyView({ ...args, agentId: args.agentId });
const nonReadyView = renderChatAgentNonReadyView(args);
if (nonReadyView) {
return nonReadyView;
}
invariant(args.agentId, "agent id is defined when agent content is ready");
invariant(args.effectiveAgent, "effectiveAgent is defined when the non-ready view is absent");
invariant(args.cwd, "agent cwd is defined when agent content is ready");
return null;
}
function renderChatAgentNonReadyView(args: {
serverId: string;
agentId: string;
viewState: AgentScreenViewState;
effectiveAgent: AgentScreenAgent | null;
t: TFunction;
onRetryLoad: () => void;
}): React.ReactElement | null {
const { serverId, agentId, viewState, effectiveAgent, t, onRetryLoad } = args;
const { viewState, effectiveAgent, t, onRetryLoad } = args;
if (viewState.tag === "not_found") {
return (
<View style={styles.container} testID="agent-not-found">
@@ -289,7 +283,13 @@ function renderChatAgentNonReadyView(args: {
return <AgentLoadErrorView message={viewState.message} onRetry={onRetryLoad} />;
}
if (viewState.tag === "boot" || !effectiveAgent) {
return <AgentLoadingView serverId={serverId} agentId={agentId} />;
return (
<View style={styles.container} testID="agent-loading">
<View style={styles.errorContainer}>
<ThemedLoadingSpinner size="large" uniProps={foregroundMutedColorMapping} />
</View>
</View>
);
}
return null;
}
@@ -647,7 +647,13 @@ function AgentPanelBody({
: null;
if (target.kind === "agent" && !agent) {
return <AgentLoadingView serverId={serverId} agentId={target.agentId} />;
return (
<View style={styles.container} testID="agent-loading">
<View style={styles.errorContainer}>
<ThemedLoadingSpinner size="large" uniProps={foregroundMutedColorMapping} />
</View>
</View>
);
}
return (
@@ -663,46 +669,6 @@ function AgentPanelBody({
);
}
/**
* The pane's loading state, for its agent or the agent's history. A visible pane keeps the launch
* splash up while the cache can still answer; after that it says what the host has yet to send.
*/
function AgentLoadingState({
serverId,
agentId,
testID,
}: {
serverId: string;
agentId: string;
testID: string;
}) {
const { t } = useTranslation();
const isPaneVisible = useRetainedPanelActive();
const wait = useSessionStore(
useShallow((state) => selectAgentLoadingWait(state.sessions[serverId], agentId)),
);
useNativeSplashHold(isPaneVisible && wait.source === "cache");
if (wait.source === "cache") return <LoadingState testID={testID} />;
return (
<LoadingState
testID={testID}
title={
wait.waitingFor === "agent"
? t("agentPanel.states.loadingAgent")
: t("agentPanel.states.loadingHistory")
}
/>
);
}
function AgentLoadingView(props: { serverId: string; agentId: string }) {
return (
<View style={styles.container}>
<AgentLoadingState {...props} testID="agent-loading" />
</View>
);
}
function ChatAgentContent({
serverId,
workspaceId,
@@ -1037,7 +1003,6 @@ function ChatAgentContent({
[tabId, target, workspaceId],
);
const nonReadyView = renderConversationNonReadyView({
serverId,
draft,
agentId,
cwd: agentState.cwd,
@@ -1312,8 +1277,8 @@ const ChatAgentReadyContent = memo(function ChatAgentReadyContent({
const dockOverlay = (
<>
{showHistorySyncOverlay ? (
<View style={styles.historySyncOverlay}>
<AgentLoadingState serverId={serverId} agentId={agentId} testID="agent-history-overlay" />
<View style={styles.historySyncOverlay} testID="agent-history-overlay">
<ThemedLoadingSpinner size="large" uniProps={foregroundMutedColorMapping} />
</View>
) : null}
@@ -1,6 +1,7 @@
import React, { Component, type ErrorInfo, type ReactNode } from "react";
import type { ReactNode } from "react";
import { Text } from "react-native";
import { StyleSheet } from "react-native-unistyles";
import { RenderErrorBoundary } from "@/components/render-error-boundary";
interface SurfaceErrorBoundaryProps {
children: ReactNode;
@@ -10,42 +11,30 @@ interface SurfaceErrorBoundaryProps {
renderError?(error: string): ReactNode;
}
interface SurfaceErrorBoundaryState {
error: string | null;
export function SurfaceErrorBoundary({
children,
installation,
resetKey,
Surface,
renderError,
}: SurfaceErrorBoundaryProps) {
return (
<RenderErrorBoundary
resetKeys={[installation, resetKey, Surface]}
onError={warnSurfaceRenderFailed}
renderError={renderError ?? renderPluginFailed}
>
{children}
</RenderErrorBoundary>
);
}
export class SurfaceErrorBoundary extends Component<
SurfaceErrorBoundaryProps,
SurfaceErrorBoundaryState
> {
state: SurfaceErrorBoundaryState = { error: null };
function renderPluginFailed(error: string) {
return <Text style={styles.errorText}>Plugin failed: {error}</Text>;
}
static getDerivedStateFromError(error: unknown): SurfaceErrorBoundaryState {
return { error: error instanceof Error ? error.message : String(error) };
}
componentDidCatch(error: Error, info: ErrorInfo): void {
console.warn("[Plugins] Surface render failed", error, info.componentStack);
}
componentDidUpdate(previous: SurfaceErrorBoundaryProps): void {
if (
this.state.error &&
(previous.installation !== this.props.installation ||
previous.resetKey !== this.props.resetKey ||
previous.Surface !== this.props.Surface)
) {
this.setState({ error: null });
}
}
render() {
if (this.state.error) {
if (this.props.renderError) return this.props.renderError(this.state.error);
return <Text style={styles.errorText}>Plugin failed: {this.state.error}</Text>;
}
return this.props.children;
}
function warnSurfaceRenderFailed(error: unknown, componentStack: string | null | undefined): void {
console.warn("[Plugins] Surface render failed", error, componentStack);
}
const styles = StyleSheet.create((theme) => ({

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