mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-30 12:16:12 +00:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
186df6fb53 | ||
|
|
d71f79570c | ||
|
|
9e7e43c9ad | ||
|
|
7e9f159b8a |
@@ -60,7 +60,6 @@ sdk:
|
||||
- "packages/client/**"
|
||||
- "packages/highlight/**"
|
||||
- "packages/protocol/**"
|
||||
- "packages/workflows/**"
|
||||
|
||||
browser:
|
||||
- "packages/server/src/server/agent/provider-snapshot-manager.ts"
|
||||
|
||||
@@ -128,14 +128,6 @@ jobs:
|
||||
if: ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' || needs.changes.outputs.sdk != 'false') }}
|
||||
run: npm run test --workspace=@getpaseo/highlight
|
||||
|
||||
- name: Build workflows package
|
||||
if: ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' || needs.changes.outputs.sdk != 'false') }}
|
||||
run: npm run build:workflows
|
||||
|
||||
- name: Run workflows tests
|
||||
if: ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' || needs.changes.outputs.sdk != 'false') }}
|
||||
run: npm run test --workspace=@getpaseo/workflows
|
||||
|
||||
- name: Typecheck client examples
|
||||
if: ${{ !cancelled() && steps.install.outcome == 'success' && (needs.changes.outputs.full != 'false' || needs.changes.outputs.sdk != 'false') }}
|
||||
run: npm run typecheck:examples --workspace=@getpaseo/client
|
||||
|
||||
@@ -1,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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -329,7 +329,7 @@ messages or transfers.
|
||||
### Compatibility rules
|
||||
|
||||
- WebSocket schemas are append-only. Add fields, do not remove fields, and never make optional fields required.
|
||||
- New wire enum values must be gated at serialization with `session.supports(CLIENT_CAPS.someCapability)`. An older reader skips an unknown value inside a list; gate it anyway when the old client must see something.
|
||||
- New wire enum values must be gated at serialization with `session.supports(CLIENT_CAPS.someCapability)`.
|
||||
- Capabilities belong to the physical source socket. `session.supports(...)` reads the requesting or observing source at the domain projection boundary; one socket must not borrow a sibling's capabilities.
|
||||
|
||||
Example: adding a new enum value
|
||||
@@ -337,7 +337,7 @@ Example: adding a new enum value
|
||||
```ts
|
||||
// 1. Add CLIENT_CAPS.newThing = "new_thing"
|
||||
// 2. Let new clients advertise it in WS hello
|
||||
// 3. Add the value to the shared schema; no catch-all branch
|
||||
// 3. Keep the shared producer schema strict
|
||||
// 4. Gate the new emitted value: session.supports(CLIENT_CAPS.newThing) ? "new_value" : "old_value"
|
||||
```
|
||||
|
||||
|
||||
+8
-10
@@ -209,7 +209,8 @@ snapshot so a mixed edit can apply its live subset and still name the paths that
|
||||
listen: "127.0.0.1:6767",
|
||||
hostnames: true | string[], // legacy alias `allowedHosts` is migrated on load
|
||||
trustedProxies: true | string[], // defaults to ["loopback"]; Express proxy names/CIDRs
|
||||
mcp: { enabled: boolean, injectIntoAgents: boolean },
|
||||
tools: { enabled: boolean, groups: { orchestration, schedules, changeRequests, browser: boolean } },
|
||||
mcp: { enabled: boolean, injectIntoAgents: boolean }, // legacy, read only when `tools` is absent
|
||||
git: { maxProcessesPerSecond: number, maxProcessConcurrency: number },
|
||||
appendSystemPrompt: string, // appended to supported provider system/developer prompts
|
||||
terminalProfiles: TerminalProfile[], // named shell commands; omitted means DEFAULT_TERMINAL_PROFILES
|
||||
@@ -311,12 +312,14 @@ Each entry may include a Paseo-tool policy:
|
||||
Absent `paseoTools`, or absent fields within it, means Paseo tools are enabled and all tools are
|
||||
allowed. `enabled: false` disables the provider's Paseo catalog; `disabledTools` lists exact tool
|
||||
IDs to omit. The policy covers the core and browser catalog, not the voice-only `speak` tool.
|
||||
Browser tools also require `daemon.browserTools.enabled` and a connected browser host.
|
||||
Browser tools also require `daemon.tools.groups.browser` and a connected browser host.
|
||||
This policy controls the catalog presented to an agent. It is not an authorization boundary for
|
||||
agents that can access the host through a shell.
|
||||
|
||||
`daemon.mcp.injectIntoAgents` is the global override. When it is `false`, no provider receives
|
||||
Paseo tools; otherwise the provider policy applies. Provider and global policy are resolved when a
|
||||
`daemon.tools` is the global override. When `enabled` is `false`, no provider receives Paseo or
|
||||
plugin tools; otherwise each group in `daemon.tools.groups` and then the provider policy applies.
|
||||
When `daemon.tools` is absent, the daemon reads the legacy `daemon.mcp.injectIntoAgents` and
|
||||
`daemon.browserTools.enabled` fields. Provider and global policy are resolved when a
|
||||
session is created, resumed, imported, or reloaded, so configuration changes affect the next
|
||||
session rather than an already-running one.
|
||||
|
||||
@@ -601,12 +604,7 @@ The cache is capped at 32 MiB and evicts whole hosts in least-recently-written o
|
||||
eviction, only a baseline replacement stores that host's directory again. Mutations queued around
|
||||
the eviction are dropped when they are written, so a checkpoint never outlives its rows. Budget
|
||||
bookkeeping may scan opaque row sizes during a deferred write, never during host registry startup or
|
||||
before a requested cache row can paint. The cache holds only each row's key and UTF-8 payload size,
|
||||
never the payload: a timeline row can be megabytes, and the renderer would hold a second copy of
|
||||
every cached transcript until restart. Each store reports sizes without loading payloads. SQLite
|
||||
measures the stored text, and IndexedDB records the size on the row and reads an index over it.
|
||||
Opening an IndexedDB database written before that index existed drops its rows, because they would
|
||||
be readable but never counted against the budget. The row store is not encrypted. A cached timeline can contain
|
||||
before a requested cache row can paint. The row store is not encrypted. A cached timeline can contain
|
||||
source code, prompts, and tool output; encrypted-at-rest storage is a separate security decision.
|
||||
|
||||
### Saved hosts
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ Cards inside a section sit closer than sections. Rows inside a card touch — on
|
||||
|
||||
Rows have generous vertical padding: roughly 16px of content plus 16px of vertical padding for settings rows, 8–12px for sidebar list items where many rows must fit. Every row is at least as tall as one holding a switch, so text rows, switch rows and rows that open something (`<SettingsDetailRow>`, a collapsible row's header) line up. A row holding a button or a select is taller. Compressing rows below the established density to fit more on the screen is wrong. Too many rows means more cards or more sections, not smaller rows.
|
||||
|
||||
Rows revealed under a `<SettingsCollapsibleRow>` are nested rows, one step smaller than card rows: 8px of vertical padding, `fontSize.sm` text, `sm` controls, and one fixed height so rows with and without a trailing button line up. The collapsible row sets this for everything under it (`packages/app/src/components/settings/row-density.tsx`). Never pass a density to a row, and never pad or resize a nested row by hand. Settings rows that share a menu surface with menu rows, such as Usage's options, go inside `<MenuSettingsRows>`, which puts their labels on the menu rows' label rail (`menuRowContentInset`). 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.
|
||||
|
||||
|
||||
+11
-41
@@ -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
|
||||
@@ -315,10 +301,9 @@ translation scope is React context and does not cross it (Gotcha 7). It returns:
|
||||
height with it; never animate height per frame.
|
||||
|
||||
Do not measure an anchor with `measureInWindow` and correct it by the keyboard
|
||||
shift. On iOS the translate view uses the native driver, 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
|
||||
shift. On iOS the translate view uses the native driver, and `measureInWindow`
|
||||
includes its transform only when the view happened to re-render since the
|
||||
keyboard moved. Both results were observed, so any correction double-lifts the
|
||||
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 +315,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 reliably include one: the keyboard lift runs on the native
|
||||
driver and reaches the shadow tree only when the view re-renders. 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.
|
||||
@@ -339,21 +324,6 @@ Keep the portal's `KeyboardTranslateView` host-sized with
|
||||
`pointerEvents="box-none"` and position the popover inside it, so the popover
|
||||
moves without leaving its parent's bounds (Gotcha 1).
|
||||
|
||||
The resting commit also keeps touches working. Pressability measures a
|
||||
`Pressable`'s press region in the shadow tree. If the region stays at the
|
||||
unlifted position, a tap that drifts a few points leaves it and the press is
|
||||
dropped. This hit every control in the dock: Send, attach, and the model selector.
|
||||
|
||||
`Combobox` positions its native popover with floating-ui against the window, and
|
||||
the software keyboard covers part of the window. It adds the settled keyboard
|
||||
height (`useSettledKeyboardHeight`) to its bottom collision padding. The height
|
||||
changes on `keyboardDidShow` and `keyboardDidHide`, at the end of the move. The new
|
||||
padding re-measures the anchor on the next frame, when the resting lift is in the
|
||||
shadow tree, so the popover follows an anchor that rides the keyboard.
|
||||
Opening the model picker moves focus to its search input, and the keyboard hides
|
||||
and shows again on the way. A height that changes at `keyboardWillShow` instead
|
||||
measures the trigger before it lifts and leaves the popover over the keyboard.
|
||||
|
||||
The provider also reconciles iOS from the controller's native `onEnd` event.
|
||||
The controller's stock iOS shared values update at move start and during an
|
||||
interactive move, but not at the terminal event, so JS contention can otherwise
|
||||
|
||||
@@ -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
-12
@@ -127,18 +127,7 @@ With a Codex draft selected, set `_SCENARIO=growth` on a 402pt-wide iPhone to
|
||||
check live wrapping, shrinking, the 12pt anchor gap, and command insertion. Set
|
||||
`_SCENARIO=previews` on an SE-sized iPhone to check long and short descriptions
|
||||
under an eight-line draft, selection with the keyboard shown and hidden, and
|
||||
file mentions. 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`;
|
||||
file mentions. 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
|
||||
|
||||
@@ -639,12 +639,6 @@ effective configuration and execution environment, or
|
||||
`undefined` for target-specific caching. Ignore `force` when choosing identity. Existing providers
|
||||
need no change. See [catalogue ownership](providers.md#provider-snapshot-refresh-contract).
|
||||
|
||||
Both sides of the provider protocol ignore fields they do not know. A list element of an unknown
|
||||
kind, such as a prompt content block, a command kind, or a timeline item, is dropped and the rest of
|
||||
the input or event is kept. The daemon drops an event of a kind it does not know and keeps the
|
||||
connection open. Paseo supplies the SDK at runtime, so both sides read with the daemon's parser. An
|
||||
input the provider must act on still needs a connection capability, as `session.launch_wrap` does.
|
||||
|
||||
`send()` resolves after acceptance. Publish operation completion, prompt disposition, turn state,
|
||||
configuration, permissions, persistence, and complete timeline snapshots through `onEvent()`.
|
||||
Route messages, structured commands, steering, and command side effects through `session.prompt`.
|
||||
|
||||
@@ -17,9 +17,6 @@ A schema change must not break parsing in either direction. An old app still par
|
||||
- A field you stop sending stays accepted. You stop writing it, you don't stop reading it.
|
||||
- Wire schemas are pure structural declarations. No `.transform()`, `.catch()`, or `.preprocess()` on WebSocket message schemas — normalization happens in an explicit pass after validation. The reason is in [protocol-validation.md](protocol-validation.md): inbound validators are generated, and the generator only compiles pure schemas.
|
||||
- Plain `z.union()` is forbidden when every branch shares a literal tag. Use `z.discriminatedUnion()`.
|
||||
- Wire objects ignore keys they do not know. Never put `.strict()` or `z.strictObject` on a schema that reads another process's data. `packages/protocol/tests/validation/evolvability.test.ts` audits every app↔daemon schema. Strict objects belong to local files that should reject typos, such as the `config.json` copies in `packages/server/src/server/persisted-config.ts`. The browser automation request is the one wire exception: it rejects legacy tab targeting so a request cannot run against the wrong tab.
|
||||
- An unknown variant inside a list costs one element. Readers parse through `safeParseSkippingUnknownVariants` (`packages/protocol/src/validation/unknown-variants.ts`): an unrecognized tag or enum value inside an array drops that element and keeps the message. Outside an array the read fails with `unknownVariant: true` and the reader drops that one message. Schemas stay closed, so consumer `switch`es stay exhaustive. Pruning reaches a list only through objects, arrays, and discriminated unions; a list under a plain `z.union()` branch or a record value is not pruned.
|
||||
- Skipping is not support. When an old reader must see something for the feature to make sense, gate the new value at serialization ([architecture](architecture.md#compatibility-rules)).
|
||||
- `.default()` belongs on primitive leaves only, never on item schemas inside large arrays or big inbound containers.
|
||||
|
||||
Two questions to ask before you commit a schema change:
|
||||
|
||||
@@ -6,7 +6,7 @@ The reason is mobile performance. A captured 353 KB provider snapshot cost about
|
||||
|
||||
## Runtime Path
|
||||
|
||||
`packages/protocol/src/validation/ws-outbound.ts` is the shipped boundary. It validates the envelope with a generated validator that checks only each session message's `type` tag, then runs the generated validator for that one message type and returns the validated data. Issue paths from the message validator, including nested union branches, are prefixed with `message`, so callers see the same issues as when one validator covered the whole envelope. It does not normalize or repair the generated result. When the only failures are unknown variants inside lists, the boundary removes those elements and validates once more ([protocol-compatibility](protocol-compatibility.md#the-protocol-contract-always-compatible)). The reader classifies failures from the issue list, so it behaves the same over the generated validator and Zod, and a valid message pays nothing extra.
|
||||
`packages/protocol/src/validation/ws-outbound.ts` is the shipped boundary. It validates the envelope with a generated validator that checks only each session message's `type` tag, then runs the generated validator for that one message type and returns the validated data. Issue paths from the message validator, including nested union branches, are prefixed with `message`, so callers see the same issues as when one validator covered the whole envelope. It does not normalize, repair, or re-validate the generated result.
|
||||
|
||||
Keep one generated function per message type. zod-aot inlines every nested schema into the function it compiles, so compiling `WSOutboundMessageSchema` as a whole produced one 11 MB function. On V8 (daemon clients, plugin hosts, the CLI, and Electron), the Maglev tier compiled that function once it was hot, allocating about 800 MB and stalling for seconds, and compiled it again after each deoptimization. Hermes has no JIT, so mobile never showed it. `packages/protocol/tests/validation/ws-outbound.test.ts` fails if a generated function grows past 1 MB.
|
||||
|
||||
|
||||
@@ -724,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
|
||||
@@ -73,17 +73,6 @@
|
||||
"entry": ["src/index.ts", "src/**/*.test.ts"],
|
||||
"project": ["src/**/*.ts"]
|
||||
},
|
||||
"packages/workflows": {
|
||||
"entry": [
|
||||
"src/index.ts",
|
||||
"src/ir.ts",
|
||||
"src/dsl.ts",
|
||||
"src/yaml.ts",
|
||||
"src/testing.ts",
|
||||
"test/**/*.test.ts"
|
||||
],
|
||||
"project": ["src/**/*.ts", "test/**/*.ts"]
|
||||
},
|
||||
"packages/expo-two-way-audio": {
|
||||
"entry": ["src/index.ts"],
|
||||
"project": ["src/**/*.ts"]
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
sha256-34bUBmRmjekbUSp93597GLTmSWKt23TCHaK3ViXG+iU=
|
||||
sha256-aal9eR571blWuL7CZt1LR+KfA4QPJ0ivVl/GSTWy93o=
|
||||
|
||||
Generated
+32
-49
@@ -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": [
|
||||
@@ -16,7 +16,6 @@
|
||||
"packages/highlight",
|
||||
"packages/plugin",
|
||||
"packages/protocol",
|
||||
"packages/workflows",
|
||||
"packages/client",
|
||||
"packages/server",
|
||||
"packages/app",
|
||||
@@ -6710,10 +6709,6 @@
|
||||
"resolved": "packages/website",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@getpaseo/workflows": {
|
||||
"resolved": "packages/workflows",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@gorhom/bottom-sheet": {
|
||||
"version": "5.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@gorhom/bottom-sheet/-/bottom-sheet-5.2.14.tgz",
|
||||
@@ -14929,6 +14924,7 @@
|
||||
"version": "8.11.0",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz",
|
||||
"integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
@@ -31402,6 +31398,7 @@
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
@@ -36231,6 +36228,7 @@
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"punycode": "^2.1.0"
|
||||
@@ -37543,7 +37541,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 +39694,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 +39947,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 +39963,7 @@
|
||||
},
|
||||
"packages/desktop": {
|
||||
"name": "@getpaseo/desktop",
|
||||
"version": "0.18.2",
|
||||
"version": "0.18.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@getpaseo/cli": "*",
|
||||
@@ -40208,7 +40206,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 +40252,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 +40282,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 +40290,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 +40301,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 +40324,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 +40351,7 @@
|
||||
}
|
||||
},
|
||||
"packages/react-native-enriched-markdown": {
|
||||
"version": "0.18.2",
|
||||
"version": "0.18.1",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
@@ -40369,7 +40367,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 +40589,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 +41550,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",
|
||||
@@ -43161,24 +43159,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"packages/workflows": {
|
||||
"name": "@getpaseo/workflows",
|
||||
"version": "0.1.0",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"ajv": "^8.11.0",
|
||||
"js-yaml": "^4.1.1",
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.9.0",
|
||||
"typescript": "^5.9.3",
|
||||
"vitest": "^4.1.6"
|
||||
}
|
||||
},
|
||||
"plugins": {
|
||||
"name": "@getpaseo/builtin-plugins",
|
||||
"version": "0.18.2",
|
||||
"version": "0.18.1",
|
||||
"dependencies": {
|
||||
"@getpaseo/plugin": "*",
|
||||
"zod": "^4.4.3"
|
||||
|
||||
+1
-4
@@ -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": [
|
||||
@@ -27,7 +27,6 @@
|
||||
"packages/highlight",
|
||||
"packages/plugin",
|
||||
"packages/protocol",
|
||||
"packages/workflows",
|
||||
"packages/client",
|
||||
"packages/server",
|
||||
"packages/app",
|
||||
@@ -61,8 +60,6 @@
|
||||
"build:relay:clean": "npm run build:clean --workspace=@getpaseo/relay",
|
||||
"build:protocol": "npm run build --workspace=@getpaseo/protocol",
|
||||
"build:protocol:clean": "npm run build:clean --workspace=@getpaseo/protocol",
|
||||
"build:workflows": "npm run build --workspace=@getpaseo/workflows",
|
||||
"build:workflows:clean": "npm run build:clean --workspace=@getpaseo/workflows",
|
||||
"build:client": "npm run build --workspace=@getpaseo/client",
|
||||
"build:client:clean": "npm run build:protocol:clean && npm run build:clean --workspace=@getpaseo/client",
|
||||
"build:server-deps": "npm run build:client && concurrently --kill-others-on-fail --names highlight,plugin,relay --prefix-colors yellow,green,blue \"npm run build:highlight\" \"npm run build:plugin\" \"npm run build:relay\"",
|
||||
|
||||
@@ -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",
|
||||
[
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -85,10 +85,13 @@ test.describe("Agent profiles in the model picker", () => {
|
||||
await expectComposerMode(page, "Load test");
|
||||
});
|
||||
|
||||
await test.step("the single-provider picker lists Profiles above the agent's models without a rail", async () => {
|
||||
await test.step("the picker opens on the agent's provider with Profiles beside it", async () => {
|
||||
await openModelPicker(page);
|
||||
await expect(page.getByTestId("model-search-input").first()).toBeFocused();
|
||||
await expect(page.getByTestId("model-picker-rail")).toHaveCount(0);
|
||||
await expect(page.getByTestId("model-provider-mock")).toHaveAttribute(
|
||||
"data-active",
|
||||
"true",
|
||||
);
|
||||
await expectModelRowSelected(page, { provider: "mock", modelId: "ten-second-stream" });
|
||||
await expectPickerProfile(page, {
|
||||
name: PROFILE.name,
|
||||
@@ -128,45 +131,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,13 +0,0 @@
|
||||
import {
|
||||
expectBuiltinPluginSettings,
|
||||
openBuiltinPluginSettings,
|
||||
test,
|
||||
} from "../support/helpers/builtin-plugin-settings";
|
||||
|
||||
test("a built-in plugin's settings link opens its screen", async ({
|
||||
page,
|
||||
builtinSettingsHost,
|
||||
}) => {
|
||||
await openBuiltinPluginSettings(page, builtinSettingsHost);
|
||||
await expectBuiltinPluginSettings(page);
|
||||
});
|
||||
@@ -233,63 +233,6 @@ test("opening an agent focuses the composer when a mouse drives the UI", async (
|
||||
}
|
||||
});
|
||||
|
||||
/** The composer frame's border colour once its border-color transition has finished. */
|
||||
async function readSettledFrameBorder(page: Page): Promise<string> {
|
||||
return composerLocator(page).evaluate(async (input) => {
|
||||
let frame = input.parentElement;
|
||||
while (frame && parseFloat(getComputedStyle(frame).borderTopWidth) < 1) {
|
||||
frame = frame.parentElement;
|
||||
}
|
||||
if (!frame) throw new Error("Composer frame has no border");
|
||||
while (frame.getAnimations().length > 0) {
|
||||
await new Promise((resolve) => requestAnimationFrame(resolve));
|
||||
}
|
||||
return getComputedStyle(frame).borderTopColor;
|
||||
});
|
||||
}
|
||||
|
||||
// `borderAccent` at rest, `surface4` while focused: greys in both themes, never the accent.
|
||||
const FRAME_BORDERS = {
|
||||
dark: { rest: "rgb(47, 53, 52)", focus: "rgb(89, 91, 91)" },
|
||||
light: { rest: "rgb(236, 236, 241)", focus: "rgb(212, 212, 216)" },
|
||||
} as const;
|
||||
|
||||
for (const colorScheme of ["dark", "light"] as const) {
|
||||
test(`the composer frame takes a neutral border on focus in the ${colorScheme} theme`, async ({
|
||||
page,
|
||||
}) => {
|
||||
const agent = await seedMockAgentWorkspace({
|
||||
repoPrefix: "composer-frame-focus-",
|
||||
title: "Composer frame focus",
|
||||
});
|
||||
const borders = FRAME_BORDERS[colorScheme];
|
||||
|
||||
try {
|
||||
await page.emulateMedia({ colorScheme });
|
||||
await openAgentRoute(page, agent);
|
||||
const composer = composerLocator(page);
|
||||
await expectComposerVisible(page);
|
||||
await page.mouse.move(0, 0);
|
||||
await blurComposerInput(page);
|
||||
expect(await readSettledFrameBorder(page)).toBe(borders.rest);
|
||||
|
||||
await composer.click();
|
||||
await page.mouse.move(0, 0);
|
||||
await expectComposerFocused(page);
|
||||
expect(await readSettledFrameBorder(page)).toBe(borders.focus);
|
||||
|
||||
await blurComposerInput(page);
|
||||
expect(await readSettledFrameBorder(page)).toBe(borders.rest);
|
||||
|
||||
// Hover alone leaves the frame at rest, so the border only ever means focus.
|
||||
await composer.hover();
|
||||
expect(await readSettledFrameBorder(page)).toBe(borders.rest);
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function waitForAnimationFrames(page: Page, count: number): Promise<void> {
|
||||
await page.evaluate(async (frames) => {
|
||||
for (let frame = 0; frame < frames; frame += 1) {
|
||||
|
||||
@@ -753,10 +753,6 @@ test.describe("CodeMirror workspace file editing", () => {
|
||||
const imagePath = path.join(workspace.repoPath, "pixel.png");
|
||||
await writeFile(markdownPath, "# First heading\n", "utf8");
|
||||
await writeFile(imagePath, RED_PIXEL);
|
||||
await writeFile(
|
||||
path.join(workspace.repoPath, "shape.svg"),
|
||||
await readFile(path.resolve(__dirname, "../mobile/fixtures/native-preview.svg")),
|
||||
);
|
||||
await workspace.navigateTo();
|
||||
await openWorkspaceFile(page, "notes.md");
|
||||
|
||||
@@ -804,11 +800,6 @@ test.describe("CodeMirror workspace file editing", () => {
|
||||
const initialSource = await image.getAttribute("src");
|
||||
await writeFile(imagePath, BLUE_PIXEL);
|
||||
await expect.poll(() => image.getAttribute("src")).not.toBe(initialSource);
|
||||
|
||||
await openWorkspaceFile(page, "shape.svg");
|
||||
await expect(imageCanvas).toBeVisible();
|
||||
await expect(image).toBeVisible();
|
||||
await expect(image).toHaveJSProperty("naturalWidth", 240);
|
||||
});
|
||||
|
||||
test("renders local relative images inside Markdown preview", async ({ page, withWorkspace }) => {
|
||||
|
||||
@@ -28,9 +28,7 @@ import {
|
||||
} from "../support/helpers/composer";
|
||||
import { openGlobalNewWorkspaceComposer } from "../support/helpers/new-workspace";
|
||||
import { clickNewChat, clickNewTerminal, gotoWorkspace } from "../support/helpers/launcher";
|
||||
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
|
||||
import { seedWorkspace } from "../support/helpers/seed-client";
|
||||
import { waitForSettledPosition } from "../support/helpers/sheet-layout";
|
||||
|
||||
const MOCK_PROVIDER_LABEL = "Mock Load Test";
|
||||
|
||||
@@ -317,55 +315,15 @@ 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 puts Profiles in the Model accordion and lets all groups 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 waitForSettledPosition(profilesToggle);
|
||||
const profilesBox = await profilesToggle.boundingBox();
|
||||
const modelBox = await modelRowButton.boundingBox();
|
||||
expect(profilesBox && modelBox && profilesBox.y < modelBox.y).toBe(true);
|
||||
|
||||
// Open Model: Profiles is extracted onto Home, and provider headers keep exact geometry when collapsed.
|
||||
await modelRowButton.click();
|
||||
await expect(page.getByTestId("agent-controls-profiles")).toHaveCount(0);
|
||||
await page.getByTestId("agent-controls-model").click();
|
||||
await expect(page.getByTestId("compact-model-list")).toBeVisible();
|
||||
await expect(page.getByTestId("model-picker-rail-profiles")).toHaveCount(0);
|
||||
const expandedHeader = page.locator('[data-testid^="model-provider-section-"]').first();
|
||||
const expandedBox = await expandedHeader.boundingBox();
|
||||
const expandedProviderId = (await expandedHeader.getAttribute("data-testid"))?.replace(
|
||||
"model-provider-section-",
|
||||
"",
|
||||
);
|
||||
await expandedHeader.click();
|
||||
await page.locator('[data-testid^="model-provider-section-"]').first().click();
|
||||
await expect(page.getByTestId("compact-model-list")).toHaveCount(0);
|
||||
const collapsedHeader = page.getByTestId(`model-provider-${expandedProviderId}`);
|
||||
const collapsedBox = await collapsedHeader.boundingBox();
|
||||
expect(expandedBox && collapsedBox).toBeTruthy();
|
||||
expect(Math.abs(expandedBox!.y - collapsedBox!.y)).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(expandedBox!.height - collapsedBox!.height)).toBeLessThanOrEqual(1);
|
||||
|
||||
// Search dock matches the collapsed provider card's outer rails, height, and text rail.
|
||||
const searchContainer = page.getByTestId("model-search-all-input-container");
|
||||
const searchInput = page.getByTestId("model-search-all-input");
|
||||
const searchBox = await searchContainer.boundingBox();
|
||||
const searchInputBox = await searchInput.boundingBox();
|
||||
const collapsedCardBox = await readCollapsedCardGeometry(collapsedHeader);
|
||||
expect(searchBox && searchInputBox && collapsedCardBox).toBeTruthy();
|
||||
expect(Math.abs(searchBox!.x - collapsedCardBox!.cardX)).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(searchBox!.width - collapsedCardBox!.cardWidth)).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(searchBox!.height - collapsedCardBox!.cardHeight)).toBeLessThanOrEqual(1);
|
||||
expect(Math.abs(searchInputBox!.x - collapsedCardBox!.labelX)).toBeLessThanOrEqual(2);
|
||||
|
||||
// Return Home, expand Profiles in place, and apply the profile.
|
||||
await page.getByTestId("sheet-header-back").click();
|
||||
await expect(profilesList).toHaveCount(0);
|
||||
await profilesToggle.click();
|
||||
await page.getByTestId("model-picker-rail-profiles").click();
|
||||
const sheetProfileRow = page.getByTestId("model-profile-row-agent_profile_e2e_arrows");
|
||||
await expect(sheetProfileRow).toBeVisible();
|
||||
await sheetProfileRow.click();
|
||||
@@ -415,193 +373,8 @@ test.describe("Cross-provider model search", () => {
|
||||
await provider.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test("reopening a deep selected model lands at its scroll offset on the first paint on desktop and mobile", async ({
|
||||
page,
|
||||
}) => {
|
||||
const provider = await seedModelProvider(LARGE_CATALOG);
|
||||
const workspace = await seedWorkspace({ repoPrefix: "model-picker-initial-scroll-" });
|
||||
|
||||
try {
|
||||
await gotoWorkspace(page, workspace.workspaceId);
|
||||
await clickNewChat(page);
|
||||
await expectComposerVisible(page);
|
||||
|
||||
// Select a model deep in the 200-item catalog.
|
||||
await openModelPicker(page);
|
||||
await searchAllModels(page, "bulk model 80");
|
||||
await page
|
||||
.getByTestId("combobox-desktop-container")
|
||||
.getByTestId(`model-row-${LARGE_CATALOG.id}-bulk-80`)
|
||||
.click();
|
||||
await expect(page.getByTestId("combobox-desktop-container")).toHaveCount(0);
|
||||
|
||||
await test.step("desktop opens directly at the selected row without flashing scrollTop 0", async () => {
|
||||
await startScrollSampling(page, "model-picker-model-list");
|
||||
await page.getByTestId("combined-model-selector").filter({ visible: true }).first().click();
|
||||
const samples = await readScrollSamples(page, "model-picker-model-list");
|
||||
expect(samples[0]).toBeGreaterThan(0);
|
||||
await expect(
|
||||
page
|
||||
.getByTestId("combobox-desktop-container")
|
||||
.getByTestId(`model-row-${LARGE_CATALOG.id}-bulk-80`),
|
||||
).toBeInViewport();
|
||||
await closeModelPicker(page);
|
||||
});
|
||||
|
||||
await test.step("mobile opens directly at the selected row without flashing scrollTop 0", async () => {
|
||||
await page.setViewportSize({ width: 390, height: 800 });
|
||||
await page.getByTestId("combined-model-selector").filter({ visible: true }).first().click();
|
||||
await expect(page.getByTestId("agent-controls-model")).toBeVisible();
|
||||
await startScrollSampling(page, "compact-model-list");
|
||||
await page.getByTestId("agent-controls-model").click();
|
||||
const samples = await readScrollSamples(page, "compact-model-list");
|
||||
expect(samples[0]).toBeGreaterThan(0);
|
||||
const listBox = await page.getByTestId("compact-model-list").boundingBox();
|
||||
const rowBox = await page
|
||||
.getByTestId(`model-row-${LARGE_CATALOG.id}-bulk-80`)
|
||||
.boundingBox();
|
||||
expect(listBox && rowBox).toBeTruthy();
|
||||
expect(rowBox!.y).toBeGreaterThanOrEqual(listBox!.y - 1);
|
||||
expect(rowBox!.y + rowBox!.height).toBeLessThanOrEqual(listBox!.y + listBox!.height + 1);
|
||||
});
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
await provider.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test("compact single-provider picker keeps its header fixed and scrolls to the last model row", async ({
|
||||
page,
|
||||
}) => {
|
||||
const extraModels = Array.from({ length: 24 }, (_, index) => ({
|
||||
id: `extra-scroll-${String(index).padStart(2, "0")}`,
|
||||
label: `Extra scroll model ${String(index).padStart(2, "0")}`,
|
||||
description: `Extra row ${index}`,
|
||||
}));
|
||||
const client = await connectDaemonClient<DaemonClient>({
|
||||
clientIdPrefix: "single-provider-scroll",
|
||||
});
|
||||
const workspace = await seedMockAgentWorkspace({
|
||||
repoPrefix: "single-provider-scroll-",
|
||||
title: "Single provider scroll",
|
||||
model: "ten-second-stream",
|
||||
modeId: "load-test",
|
||||
});
|
||||
|
||||
try {
|
||||
await client.patchDaemonConfig({
|
||||
providers: {
|
||||
mock: {
|
||||
additionalModels: extraModels,
|
||||
},
|
||||
},
|
||||
});
|
||||
await page.setViewportSize({ width: 390, height: 800 });
|
||||
await openAgentRoute(page, workspace);
|
||||
await expectComposerVisible(page);
|
||||
await page.getByTestId("combined-model-selector").filter({ visible: true }).first().click();
|
||||
await expect(page.getByTestId("agent-controls-model")).toBeVisible();
|
||||
await page.getByTestId("agent-controls-model").click();
|
||||
|
||||
const list = page.getByTestId("compact-model-list");
|
||||
await expect(list).toBeVisible();
|
||||
const header = page.getByTestId("model-provider-section-mock");
|
||||
await expect(header).toBeVisible();
|
||||
const headerBox = await header.boundingBox();
|
||||
expect(headerBox).toBeTruthy();
|
||||
expect(headerBox!.height).toBeGreaterThanOrEqual(16);
|
||||
|
||||
// Scroll to the bottom of the lone provider's list and confirm the final row is fully in view.
|
||||
await list.evaluate((node) => {
|
||||
node.scrollTop = node.scrollHeight;
|
||||
});
|
||||
const lastRow = page.getByTestId("model-row-mock-extra-scroll-23");
|
||||
await expect(lastRow).toBeVisible();
|
||||
const listBox = await list.boundingBox();
|
||||
const lastRowBox = await lastRow.boundingBox();
|
||||
expect(listBox && lastRowBox).toBeTruthy();
|
||||
expect(lastRowBox!.y + lastRowBox!.height).toBeLessThanOrEqual(
|
||||
listBox!.y + listBox!.height + 1,
|
||||
);
|
||||
await lastRow.click();
|
||||
await expect(page.getByTestId("agent-controls-model")).toContainText("Extra scroll model 23");
|
||||
} finally {
|
||||
await client
|
||||
.patchDaemonConfig({
|
||||
providers: {
|
||||
mock: {
|
||||
additionalModels: [],
|
||||
},
|
||||
},
|
||||
})
|
||||
.catch(() => undefined);
|
||||
await client.close().catch(() => undefined);
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
async function readCollapsedCardGeometry(collapsedHeader: ReturnType<Page["getByTestId"]>) {
|
||||
return collapsedHeader.evaluate((node) => {
|
||||
// Walk up from the press overlay to the SettingsCard container (2px taller for borders).
|
||||
const header = node.parentElement;
|
||||
const card = header?.parentElement?.parentElement;
|
||||
const rect = card?.getBoundingClientRect();
|
||||
const label = header?.querySelector('[dir="auto"]');
|
||||
const labelRect = label?.getBoundingClientRect();
|
||||
return rect && labelRect
|
||||
? {
|
||||
cardX: rect.x,
|
||||
cardWidth: rect.width,
|
||||
cardHeight: rect.height,
|
||||
labelX: labelRect.x,
|
||||
}
|
||||
: null;
|
||||
});
|
||||
}
|
||||
|
||||
async function startScrollSampling(page: Page, listTestId: string): Promise<void> {
|
||||
await page.evaluate((testId) => {
|
||||
const samples: number[] = [];
|
||||
const win = window as unknown as {
|
||||
__scrollSamples?: number[];
|
||||
__scrollObserver?: MutationObserver;
|
||||
};
|
||||
win.__scrollObserver?.disconnect();
|
||||
win.__scrollSamples = samples;
|
||||
const capture = (el: Element) => {
|
||||
samples.push(el.scrollTop);
|
||||
let remaining = 4;
|
||||
const tick = () => {
|
||||
const current = document.querySelector(`[data-testid="${testId}"]`);
|
||||
if (current) samples.push(current.scrollTop);
|
||||
remaining -= 1;
|
||||
if (remaining > 0) requestAnimationFrame(tick);
|
||||
};
|
||||
requestAnimationFrame(tick);
|
||||
};
|
||||
const observer = new MutationObserver(() => {
|
||||
const el = document.querySelector(`[data-testid="${testId}"]`);
|
||||
if (!el) return;
|
||||
observer.disconnect();
|
||||
capture(el);
|
||||
});
|
||||
win.__scrollObserver = observer;
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
}, listTestId);
|
||||
}
|
||||
|
||||
async function readScrollSamples(page: Page, listTestId: string): Promise<number[]> {
|
||||
await expect(page.getByTestId(listTestId)).toBeVisible({ timeout: 10_000 });
|
||||
const readSamples = () =>
|
||||
page.evaluate(
|
||||
() => (window as unknown as { __scrollSamples?: number[] }).__scrollSamples ?? [],
|
||||
);
|
||||
await expect.poll(async () => (await readSamples()).length).toBeGreaterThanOrEqual(2);
|
||||
return readSamples();
|
||||
}
|
||||
|
||||
async function setRuntimeCatalog(client: DaemonClient, count: number, cwd: string) {
|
||||
await client.patchDaemonConfig({
|
||||
providers: {
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
finishSetup,
|
||||
goToSetupStep,
|
||||
hostGivesAgentsPaseoTools,
|
||||
hostToolGroups,
|
||||
openAppAsNewUser,
|
||||
openRelayPairingFromSetup,
|
||||
closeRelayPairing,
|
||||
@@ -24,6 +25,7 @@ import {
|
||||
recordFirstLaunch,
|
||||
setupModal,
|
||||
setupPrimaryButton,
|
||||
setHostTools,
|
||||
setupSheet,
|
||||
showSetupAgainFromSettings,
|
||||
skipSetup,
|
||||
@@ -426,6 +428,30 @@ test("setup choices carry over to Settings and the phone step pairs over relay",
|
||||
}
|
||||
});
|
||||
|
||||
test("setup offers only Enable tools and keeps the host's tool groups", async ({ page }) => {
|
||||
const host = await startSetupHost("tool-groups");
|
||||
|
||||
try {
|
||||
await setHostTools(host, { groups: { schedules: false, browser: true } });
|
||||
await openAppAsNewUser(page, host);
|
||||
await expectSetupStep(page, "Welcome to Paseo");
|
||||
await goToSetupStep(page, "Orchestration");
|
||||
await expectSetupStep(page, "Let agents use Paseo");
|
||||
await expect(paseoToolsSwitch(setupModal(page))).toBeChecked();
|
||||
// Setup offers only the main switch; tool groups live in Settings.
|
||||
await expect(
|
||||
setupModal(page).getByRole("switch", { name: "Browser", exact: true }),
|
||||
).toHaveCount(0);
|
||||
await continueSetup(page);
|
||||
await expectSetupStep(page, "Take your agents with you");
|
||||
|
||||
await expect.poll(() => hostGivesAgentsPaseoTools(host), { timeout: 30_000 }).toBe(true);
|
||||
expect(await hostToolGroups(host)).toMatchObject({ schedules: false, browser: true });
|
||||
} finally {
|
||||
await host.close();
|
||||
}
|
||||
});
|
||||
|
||||
test("with no skills picked, skills read as off and Continue moves on", async ({ page }) => {
|
||||
const host = await startSetupHost("no-skills");
|
||||
|
||||
@@ -463,6 +489,7 @@ test("in the compact layout, Finish on Orchestration applies its switches", asyn
|
||||
const primary = (label: string) => page.getByRole("button", { name: label, exact: true });
|
||||
|
||||
try {
|
||||
await setHostTools(host, { enabled: false });
|
||||
await openAppAsNewUser(page, host);
|
||||
await step("Welcome to Paseo");
|
||||
await primary("Continue").click();
|
||||
@@ -471,7 +498,7 @@ test("in the compact layout, Finish on Orchestration applies its switches", asyn
|
||||
await step("Add your projects");
|
||||
await primary("Continue").click();
|
||||
|
||||
// The setup host starts with Paseo tools off; the switch starts on.
|
||||
// The host has tools off; the setup switch still starts on.
|
||||
expect(await hostGivesAgentsPaseoTools(host)).toBe(false);
|
||||
await step("Let agents use Paseo");
|
||||
await expect(paseoToolsSwitch(page)).toBeChecked();
|
||||
|
||||
@@ -15,9 +15,6 @@ import {
|
||||
expectBothConsecutiveTools,
|
||||
trackPluginChatRecovery,
|
||||
reconnectPluginChat,
|
||||
withRepeatedOutputTimeline,
|
||||
readOldestPluginReplacement,
|
||||
expectOldestPluginReplacementReadable,
|
||||
} from "../support/helpers/plugin-timeline";
|
||||
|
||||
for (const width of [1100, 390]) {
|
||||
@@ -85,15 +82,3 @@ test("plugin-transformed assistant reply keeps copy, fork, and turn duration in
|
||||
expect(await forkAttachment.waitForText()).toContain(ASSISTANT_TEXT);
|
||||
});
|
||||
});
|
||||
|
||||
test("keeps older plugin replacements readable when source messages reuse local output IDs", async ({
|
||||
page,
|
||||
}, info) => {
|
||||
await withRepeatedOutputTimeline(page, info, async () => {
|
||||
await readOldestPluginReplacement(page);
|
||||
await expectOldestPluginReplacementReadable(page);
|
||||
await page.reload({ waitUntil: "domcontentloaded" });
|
||||
await readOldestPluginReplacement(page);
|
||||
await expectOldestPluginReplacementReadable(page);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -118,14 +118,10 @@ test("projects and pinned chats reorder while ordinary workspaces stay newest fi
|
||||
await firstProject.client.setWorkspacePinned(firstProject.workspaceId, true);
|
||||
await secondProject.client.setWorkspacePinned(secondProject.workspaceId, true);
|
||||
const secondProjectWorkspaceTestId = `sidebar-workspace-row-${getServerId()}:${secondProject.workspaceId}`;
|
||||
// Both rows also exist in their project groups, so match them only once each pin has
|
||||
// moved its row into the Pinned section.
|
||||
await quickDragFirstRowAfterSecond(
|
||||
page
|
||||
.getByTestId("sidebar-pinned-section")
|
||||
.locator(
|
||||
`[data-testid="${firstWorkspaceTestId}"], [data-testid="${secondProjectWorkspaceTestId}"]`,
|
||||
),
|
||||
page.locator(
|
||||
`[data-testid="${firstWorkspaceTestId}"], [data-testid="${secondProjectWorkspaceTestId}"]`,
|
||||
),
|
||||
pressWorkspaceRow,
|
||||
);
|
||||
} finally {
|
||||
|
||||
@@ -392,8 +392,6 @@ test.describe("Terminal protocol queries", () => {
|
||||
await terminalSurface(page).click();
|
||||
await terminalSurface(page).pressSequentially("Q", { delay: 0 });
|
||||
await expectTerminalOutput(lightTerminalId, "WATCH2031_DONE");
|
||||
// One report per switch: a second responder would deliver each switch twice.
|
||||
expect(watch2031Events(await terminalOutput(lightTerminalId))).toEqual(["1", "2"]);
|
||||
|
||||
await selectAppThemeInApp(page, "Dark");
|
||||
await runPaletteChecks(lightTerminalId, TERMINAL_PALETTE_SCENARIOS.dark, {
|
||||
@@ -430,10 +428,6 @@ test.describe("Terminal protocol queries", () => {
|
||||
return capture.lines.join("").replace(/\s/g, "");
|
||||
}
|
||||
|
||||
function watch2031Events(output: string): string[] {
|
||||
return [...output.matchAll(/WATCH2031_EVENT:([12])/g)].map(([, scheme]) => scheme);
|
||||
}
|
||||
|
||||
async function expectTerminalOutput(terminalId: string, text: string): Promise<void> {
|
||||
await expect.poll(() => terminalOutput(terminalId), { timeout: 10_000 }).toContain(text);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ import { installDaemonWebSocketGate } from "../support/helpers/daemon-websocket-
|
||||
import { addConnectedHostAndReload, addOfflineHostAndReload } from "../support/helpers/hosts";
|
||||
import { startIsolatedHostDaemon } from "../support/helpers/isolated-host-daemon";
|
||||
|
||||
const LOADING_WORKSPACE_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,34 +0,0 @@
|
||||
import { BuiltinPluginLoader } from "../../../../server/src/server/plugins/builtin/index.js";
|
||||
import { createTestPaseoDaemon } from "../../../../server/src/server/test-utils/paseo-daemon.js";
|
||||
import { DaemonClient } from "../../../../server/src/server/test-utils/daemon-client.js";
|
||||
import assert from "node:assert/strict";
|
||||
import pino from "pino";
|
||||
|
||||
const [, , root, origin, paseoHomeRoot, daemonVersion] = process.argv;
|
||||
|
||||
const daemon = await createTestPaseoDaemon({
|
||||
corsAllowedOrigins: [origin!],
|
||||
paseoHomeRoot,
|
||||
daemonVersion,
|
||||
logger: pino({ level: "error" }),
|
||||
builtinPlugins: new BuiltinPluginLoader(root, ["builtin-settings"]),
|
||||
});
|
||||
const client = new DaemonClient({
|
||||
appVersion: daemonVersion,
|
||||
url: `ws://127.0.0.1:${daemon.port}/ws`,
|
||||
});
|
||||
|
||||
try {
|
||||
await client.connect();
|
||||
const plugin = (await client.getPluginCatalog()).find(({ id }) => id === "builtin-settings");
|
||||
assert.ok(plugin?.clientBundle, JSON.stringify(await client.getPluginLogs("builtin-settings")));
|
||||
assert.deepEqual(await client.listPlugins(), []);
|
||||
process.send!({ serverId: client.getLastServerInfoMessage()!.serverId, port: daemon.port });
|
||||
await new Promise<void>((resolve) => {
|
||||
process.once("disconnect", resolve);
|
||||
process.once("SIGTERM", resolve);
|
||||
});
|
||||
} finally {
|
||||
await client.close();
|
||||
await daemon.close();
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
# Native SVG preview regression
|
||||
|
||||
Copy `../fixtures/native-preview.svg`, `../fixtures/native-preview-viewbox.svg`, and
|
||||
`../../../assets/images/icon.png` into a workspace on a test daemon. In the Android
|
||||
or iOS app, connect to that daemon, open the workspace's Files tab, and tap
|
||||
`native-preview.svg`. The SVG should show a yellow circle on a green rectangle.
|
||||
|
||||
With that preview open, run:
|
||||
|
||||
```sh
|
||||
agent-device test packages/app/e2e/mobile/agent-device/native-svg-preview.android.ad \
|
||||
--metro-port <port> --artifacts-dir .artifacts/svg-preview
|
||||
```
|
||||
|
||||
Run it again with `native-preview-viewbox.svg` open to cover SVG dimensions
|
||||
inferred from `viewBox`, then with the PNG open to check raster images. Close and
|
||||
reopen the SVG and rerun to cover cached file previews. Use English app language
|
||||
for the zoom button selectors. The scripts are discovered by `npm run test:e2e:mobile`; the iOS counterpart is
|
||||
`native-svg-preview.ios.ad`. They reopen the installed app with its current
|
||||
preview and leave the daemon connection unchanged.
|
||||
|
||||
Before the fix the SVG remains blank and the canvas wait fails. The PNG passes.
|
||||
The replay checks successful native dimension decoding and zoom/reset controls;
|
||||
visually verify the circle and rectangle as well.
|
||||
@@ -1,11 +0,0 @@
|
||||
context platform=android timeout=60000 retries=0
|
||||
env APP_ID=sh.paseo.debug
|
||||
|
||||
open "${APP_ID}"
|
||||
wait "id=\"image-file-preview-canvas\"" 10000
|
||||
wait "role=button label=\"Zoom in\"" 10000
|
||||
press "role=button label=\"Zoom in\""
|
||||
wait "role=button label=\"Reset view\" enabled=true" 10000
|
||||
press "role=button label=\"Reset view\""
|
||||
wait "role=button label=\"Reset view\" enabled=false" 10000
|
||||
close
|
||||
@@ -1,11 +0,0 @@
|
||||
context platform=ios timeout=60000 retries=0
|
||||
env APP_ID=sh.paseo.debug
|
||||
|
||||
open "${APP_ID}"
|
||||
wait "id=\"image-file-preview-canvas\"" 10000
|
||||
wait "role=button label=\"Zoom in\"" 10000
|
||||
press "role=button label=\"Zoom in\""
|
||||
wait "role=button label=\"Reset view\" enabled=true" 10000
|
||||
press "role=button label=\"Reset view\""
|
||||
wait "role=button label=\"Reset view\" enabled=false" 10000
|
||||
close
|
||||
@@ -1,7 +1,7 @@
|
||||
// Composer autocomplete placement on iOS with the software keyboard: chat, workspace
|
||||
// draft tab, and New workspace. Run where agent-device reaches the simulator, with the
|
||||
// development app connected to the fixture host. See docs/mobile-testing.md.
|
||||
import { execFileSync, 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";
|
||||
@@ -317,296 +317,6 @@ async function runBoundedPreview() {
|
||||
await runCase("preview", "files", fileCase);
|
||||
}
|
||||
|
||||
// A finger drifts a few points during a tap, so tap the composer's controls with a
|
||||
// short drag while the keyboard is open. The model picker must open, and on a wide
|
||||
// layout its popover must end above the keyboard.
|
||||
function dragTap(rect) {
|
||||
ad(
|
||||
"gesture",
|
||||
"pan",
|
||||
String(Math.round(rect.x + rect.width / 2)),
|
||||
String(Math.round(rect.y + rect.height / 2)),
|
||||
"0",
|
||||
"3",
|
||||
"120",
|
||||
);
|
||||
}
|
||||
|
||||
// Waits until the keyboard is shown and the node with `id` stops moving.
|
||||
async function settledWithKeyboard(name, id) {
|
||||
let previousTop;
|
||||
return waitFor(name, (snap) => {
|
||||
const node = nodeById(snap, id);
|
||||
if (!node || !keyboardShown(snap)) return false;
|
||||
const stable = node.rect.y === previousTop;
|
||||
previousTop = node.rect.y;
|
||||
return stable;
|
||||
});
|
||||
}
|
||||
|
||||
const keyboardTop = (snap) =>
|
||||
snap.data.nodes.find((node) => node.type === "Keyboard" && node.rect).rect.y;
|
||||
|
||||
async function runControlTaps() {
|
||||
await clearInput("controls");
|
||||
const attach = nodeById(
|
||||
await settledWithKeyboard("controls-attach-before", "message-input-root"),
|
||||
"message-input-attach-button",
|
||||
);
|
||||
dragTap(attach.rect);
|
||||
// Wide layouts show the attachment menu as a popover and phones as a sheet; both list the items.
|
||||
await waitFor("controls-attach-menu", (snap) =>
|
||||
Boolean(nodeById(snap, "message-input-attachment-menu-item-file")),
|
||||
);
|
||||
process.stdout.write("PASS drag tap on attach opened the attachment menu\n");
|
||||
// The open menu hides the composer from accessibility. Its backdrop covers the top-left corner.
|
||||
ad("press", "20", "120");
|
||||
await waitFor("controls-attach-closed", (snap) => Boolean(nodeById(snap, "message-input-root")));
|
||||
await clearInput("controls-model");
|
||||
|
||||
const trigger = nodeById(
|
||||
await settledWithKeyboard("controls-model-before", "message-input-root"),
|
||||
"combined-model-selector",
|
||||
);
|
||||
dragTap(trigger.rect);
|
||||
const sheetOpen = (snap) =>
|
||||
snap.data.nodes.some((node) => node.type === "Button" && node.label === "Close");
|
||||
const opened = await waitFor(
|
||||
"controls-model-picker",
|
||||
(snap) => Boolean(nodeById(snap, "combobox-desktop-container")) || sheetOpen(snap),
|
||||
);
|
||||
process.stdout.write("PASS drag tap on the model selector opened the picker\n");
|
||||
if (!nodeById(opened, "combobox-desktop-container")) return;
|
||||
const settled = await settledWithKeyboard("controls-model-popover", "combobox-desktop-container");
|
||||
const frame = nodeById(settled, "combobox-desktop-container").rect;
|
||||
const bottom = frame.y + frame.height;
|
||||
const covered = frame.y < trigger.rect.y + trigger.rect.height && bottom > trigger.rect.y;
|
||||
if (covered || bottom > keyboardTop(settled) + 1) {
|
||||
throw new Error(
|
||||
`Model popover spans ${Math.round(frame.y)}-${Math.round(bottom)}; it must clear the trigger at ${Math.round(trigger.rect.y)} and the keyboard at ${Math.round(keyboardTop(settled))}`,
|
||||
);
|
||||
}
|
||||
process.stdout.write(
|
||||
`PASS model popover ${Math.round(frame.y)}-${Math.round(bottom)} clears the trigger and the keyboard\n`,
|
||||
);
|
||||
}
|
||||
|
||||
// Fullscreen is a layout mode of the same mounted editor: the toggle keeps its focus and
|
||||
// the keyboard, and each mode lands at its resting place. A focus loss used to close
|
||||
// the keyboard on every toggle, and a stale keyboard lift left the fullscreen composer
|
||||
// 310pt above the screen with only Send visible. Sample for a while after each
|
||||
// toggle, because the stale lift could land late.
|
||||
const fullscreenDraft = Array.from(
|
||||
{ length: 8 },
|
||||
(_, line) => `Line ${line + 1} of the fullscreen draft`,
|
||||
).join("\n");
|
||||
|
||||
async function assertFullscreenToggleHolds(name, place) {
|
||||
const deadline = Date.now() + 2_500;
|
||||
let samples = 0;
|
||||
while (Date.now() < deadline || samples < 3) {
|
||||
const snap = snapshot(`${name}-${samples}`);
|
||||
samples += 1;
|
||||
// A dismissed keyboard stays in the tree for a while, parked below the screen.
|
||||
const screen = snap.data.nodes.find((node) => node.type === "Application").rect;
|
||||
if (!keyboardShown(snap) || keyboardTop(snap) >= screen.y + screen.height)
|
||||
throw new Error(`${name}: the toggle closed the keyboard`);
|
||||
const problem = place(snap, keyboardTop(snap));
|
||||
if (problem) throw new Error(`${name}: ${problem}`);
|
||||
}
|
||||
process.stdout.write(`PASS ${name}: keyboard open and placement held over ${samples} samples\n`);
|
||||
}
|
||||
|
||||
// New workspace submits with Create where a chat has Send.
|
||||
const sendButton = (snap) =>
|
||||
snap.data.nodes.find(
|
||||
(node) =>
|
||||
node.type === "Button" &&
|
||||
node.rect &&
|
||||
(node.label === "Send message" || node.identifier === "workspace-create-submit"),
|
||||
)?.rect;
|
||||
|
||||
const enteredFullscreen = (snap, keyboard) => {
|
||||
const frame = nodeById(snap, "composer-fullscreen")?.rect;
|
||||
const send = sendButton(snap);
|
||||
if (!frame || !send) return "fullscreen composer or Send is missing";
|
||||
// The frame fills the screen below the safe area, behind the keyboard.
|
||||
if (frame.y < 0 || frame.y + frame.height < keyboard)
|
||||
return `fullscreen composer spans ${Math.round(frame.y)}-${Math.round(frame.y + frame.height)}, not the screen behind the keyboard at ${Math.round(keyboard)}`;
|
||||
if (send.y + send.height > keyboard + 1)
|
||||
return `Send ends at ${Math.round(send.y + send.height)}, below the keyboard at ${Math.round(keyboard)}`;
|
||||
return null;
|
||||
};
|
||||
|
||||
// Leaving fullscreen returns the composer to where it rested on the keyboard before.
|
||||
const exitedFullscreen = (resting) => (snap) => {
|
||||
if (nodeById(snap, "composer-fullscreen")) return "still fullscreen";
|
||||
const composer = nodeById(snap, "message-input-root")?.rect;
|
||||
if (!composer) return "composer is missing";
|
||||
const bottom = composer.y + composer.height;
|
||||
if (Math.abs(bottom - resting) > 1)
|
||||
return `composer ends at ${Math.round(bottom)}, not at its resting ${Math.round(resting)}`;
|
||||
return null;
|
||||
};
|
||||
|
||||
// Snapshots sample about once a second, so they cannot see one wrong frame. Record the
|
||||
// screen through a run of toggles instead: Send has one place inline and one in
|
||||
// fullscreen, and every recorded frame must draw it at one of the two. A keyboard lift
|
||||
// that landed a frame after its layout drew Send 310pt higher for that frame. Needs
|
||||
// ffmpeg on the PATH.
|
||||
async function assertSendHoldsEveryFrame(name, { screen, keyboard, sends, toggle }) {
|
||||
const video = path.join(artifactsDir, `${name.replaceAll(" ", "-")}.mp4`);
|
||||
const recorder = spawn(
|
||||
"xcrun",
|
||||
["simctl", "io", udid ?? "booted", "recordVideo", "--codec", "h264", "--force", video],
|
||||
{ stdio: ["ignore", "ignore", "pipe"] },
|
||||
);
|
||||
const finished = new Promise((resolve) => recorder.once("exit", resolve));
|
||||
await new Promise((resolve, reject) => {
|
||||
recorder.stderr.on("data", (chunk) => {
|
||||
if (String(chunk).includes("Recording started")) resolve();
|
||||
});
|
||||
finished.then(() => reject(new Error(`${name}: the screen recording did not start`)));
|
||||
});
|
||||
// The first frame is the settled inline composer.
|
||||
await sleep(500);
|
||||
await toggle();
|
||||
await sleep(1_000);
|
||||
recorder.kill("SIGINT");
|
||||
await finished;
|
||||
|
||||
// Decode the column of the screen that holds Send in both modes, one pixel per point.
|
||||
const left = Math.floor(Math.min(...sends.map((send) => send.x)));
|
||||
const right = Math.ceil(Math.max(...sends.map((send) => send.x + send.width)));
|
||||
const width = right - left;
|
||||
const height = Math.round(screen.height);
|
||||
const column = `crop=iw*${width / screen.width}:ih:iw*${left / screen.width}:0,scale=${width}:${height}`;
|
||||
const pixels = execFileSync(
|
||||
"ffmpeg",
|
||||
["-loglevel", "fatal", "-i", video, "-fps_mode", "passthrough", "-vf", column].concat([
|
||||
"-f",
|
||||
"rawvideo",
|
||||
"-pix_fmt",
|
||||
"rgb24",
|
||||
"-",
|
||||
]),
|
||||
{ maxBuffer: 1024 ** 3 },
|
||||
);
|
||||
const frameSize = width * height * 3;
|
||||
const frameCount = Math.floor(pixels.length / frameSize);
|
||||
if (frameCount < 2) throw new Error(`${name}: the recording holds ${frameCount} frames`);
|
||||
|
||||
// Send's colour is the commonest one in the middle of its inline rect.
|
||||
const [inline] = sends;
|
||||
const counts = new Map();
|
||||
for (let y = inline.y + inline.height / 4; y < inline.y + (inline.height * 3) / 4; y += 1) {
|
||||
for (let x = inline.x + inline.width / 4; x < inline.x + (inline.width * 3) / 4; x += 1) {
|
||||
const at = (Math.round(y) * width + Math.round(x - left)) * 3;
|
||||
const colour = (pixels[at] >> 3) * 1024 + (pixels[at + 1] >> 3) * 32 + (pixels[at + 2] >> 3);
|
||||
counts.set(colour, (counts.get(colour) ?? 0) + 1);
|
||||
}
|
||||
}
|
||||
const [accent] = [...counts].sort((a, b) => b[1] - a[1])[0];
|
||||
const isAccent = (at) =>
|
||||
Math.abs((pixels[at] >> 3) - Math.floor(accent / 1024)) <= 2 &&
|
||||
Math.abs((pixels[at + 1] >> 3) - (Math.floor(accent / 32) % 32)) <= 2 &&
|
||||
Math.abs((pixels[at + 2] >> 3) - (accent % 32)) <= 2;
|
||||
// The vertical centre of the rows Send's colour fills, above the keyboard.
|
||||
const sendCentre = (frame) => {
|
||||
const rows = [];
|
||||
for (let y = 0; y < Math.floor(keyboard); y += 1) {
|
||||
let filled = 0;
|
||||
for (let x = 0; x < width; x += 1) {
|
||||
if (isAccent(frame * frameSize + (y * width + x) * 3)) filled += 1;
|
||||
}
|
||||
if (filled >= inline.width * 0.4) rows.push(y);
|
||||
}
|
||||
return rows.length > 0 ? (rows[0] + rows.at(-1) + 1) / 2 : null;
|
||||
};
|
||||
const places = [];
|
||||
for (let frame = 0; frame < frameCount; frame += 1) {
|
||||
const centre = sendCentre(frame);
|
||||
const known = places.some(
|
||||
(place) =>
|
||||
place === centre || (place !== null && centre !== null && Math.abs(place - centre) <= 2),
|
||||
);
|
||||
if (known) continue;
|
||||
if (places.length === 2) {
|
||||
const drawn = centre === null ? "did not draw Send" : `drew Send at ${Math.round(centre)}`;
|
||||
throw new Error(
|
||||
`${name}: frame ${frame + 1} of ${frameCount} ${drawn}; it rests at ${places.map((place) => (place === null ? "nowhere" : Math.round(place))).join(" and ")}. See ${video}`,
|
||||
);
|
||||
}
|
||||
places.push(centre);
|
||||
}
|
||||
if (places.length !== 2 || places.includes(null))
|
||||
throw new Error(`${name}: expected Send at two places, saw ${places.join(" and ")}`);
|
||||
process.stdout.write(
|
||||
`PASS ${name}: Send drawn only at ${places.map(Math.round).join(" and ")} over ${frameCount} frames\n`,
|
||||
);
|
||||
}
|
||||
|
||||
async function runFullscreenToggles(host) {
|
||||
// The enter glyph sits in the input's own padding, so selectors report it covered.
|
||||
const buttonCentre = (name, snap, label) => {
|
||||
const button = snap.data.nodes.find(
|
||||
(node) => node.type === "Button" && node.label === label && node.rect,
|
||||
)?.rect;
|
||||
if (!button) throw new Error(`${name}: missing ${label}`);
|
||||
return [
|
||||
String(Math.round(button.x + button.width / 2)),
|
||||
String(Math.round(button.y + button.height / 2)),
|
||||
];
|
||||
};
|
||||
const pressButton = (name, label) => ad("press", ...buttonCentre(name, snapshot(name), label));
|
||||
// A run that failed in fullscreen leaves the composer there.
|
||||
if (nodeById(snapshot(`${host}-fullscreen-start`), "composer-fullscreen"))
|
||||
pressButton(`${host} fullscreen start`, "Exit fullscreen");
|
||||
await clearInput(`${host}-fullscreen`);
|
||||
ad("type", fullscreenDraft);
|
||||
const typed = nodeById(
|
||||
await settledWithKeyboard(`${host}-fullscreen-typed`, "message-input-root"),
|
||||
"message-input-root",
|
||||
).rect;
|
||||
const resting = typed.y + typed.height;
|
||||
for (let round = 1; round <= 4; round += 1) {
|
||||
pressButton(`${host} fullscreen enter ${round} button`, "Fullscreen");
|
||||
await assertFullscreenToggleHolds(`${host} fullscreen enter ${round}`, enteredFullscreen);
|
||||
pressButton(`${host} fullscreen exit ${round} button`, "Exit fullscreen");
|
||||
await assertFullscreenToggleHolds(
|
||||
`${host} fullscreen exit ${round}`,
|
||||
exitedFullscreen(resting),
|
||||
);
|
||||
}
|
||||
|
||||
const inline = snapshot(`${host}-fullscreen-frames-inline`);
|
||||
const enter = buttonCentre(`${host} fullscreen frames`, inline, "Fullscreen");
|
||||
ad("press", ...enter);
|
||||
const entered = await waitFor(`${host}-fullscreen-frames-entered`, (snap) =>
|
||||
Boolean(nodeById(snap, "composer-fullscreen") && sendButton(snap)),
|
||||
);
|
||||
const exit = buttonCentre(`${host} fullscreen frames`, entered, "Exit fullscreen");
|
||||
ad("press", ...exit);
|
||||
await waitFor(
|
||||
`${host}-fullscreen-frames-exited`,
|
||||
(snap) => !nodeById(snap, "composer-fullscreen"),
|
||||
);
|
||||
await assertSendHoldsEveryFrame(`${host} fullscreen frames`, {
|
||||
screen: inline.data.nodes.find((node) => node.type === "Application").rect,
|
||||
keyboard: keyboardTop(inline),
|
||||
sends: [sendButton(inline), sendButton(entered)],
|
||||
toggle: async () => {
|
||||
for (let round = 1; round <= 8; round += 1) {
|
||||
ad("press", ...enter);
|
||||
await sleep(600);
|
||||
ad("press", ...exit);
|
||||
await sleep(600);
|
||||
}
|
||||
},
|
||||
});
|
||||
await clearInput(`${host}-fullscreen-done`);
|
||||
}
|
||||
|
||||
if (scenario !== "all") {
|
||||
ad(
|
||||
"open",
|
||||
@@ -618,14 +328,7 @@ if (scenario !== "all") {
|
||||
await waitFor("draft", (snap) => Boolean(nodeById(snap, "message-input-root")), 60_000);
|
||||
if (scenario === "growth") await runLiveGrowth();
|
||||
else if (scenario === "previews") await runBoundedPreview();
|
||||
else 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,60 +0,0 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { setTimeout } from "node:timers/promises";
|
||||
|
||||
// Opening a file from the filtered Files tree must close the software keyboard.
|
||||
//
|
||||
// Before running, on a phone-sized device with a software keyboard enabled, open
|
||||
// Explorer -> Files in a workspace where the first match for the query is a file.
|
||||
// The app must already run the checkout being verified against a real daemon.
|
||||
const serial = process.env.ANDROID_SERIAL ?? "emulator-5554";
|
||||
const query = process.env.PASEO_FILES_FILTER_QUERY ?? "README";
|
||||
|
||||
function adb(...args) {
|
||||
return execFileSync("adb", ["-s", serial, ...args], { encoding: "utf8", timeout: 60_000 });
|
||||
}
|
||||
function findNode(id) {
|
||||
adb("shell", "uiautomator", "dump", "/sdcard/files-filter-keyboard.xml");
|
||||
const tree = adb("exec-out", "cat", "/sdcard/files-filter-keyboard.xml");
|
||||
const node = tree.match(new RegExp(`<node [^>]*resource-id="${id}"[^>]*>`))?.[0];
|
||||
const bounds = node?.match(/bounds="\[(\d+),(\d+)\]\[(\d+),(\d+)\]"/);
|
||||
if (!bounds) return null;
|
||||
const [left, top, right, bottom] = bounds.slice(1).map(Number);
|
||||
return { x: Math.round((left + right) / 2), y: Math.round((top + bottom) / 2) };
|
||||
}
|
||||
async function waitForNode(id) {
|
||||
const deadline = Date.now() + 30_000;
|
||||
while (Date.now() < deadline) {
|
||||
const node = findNode(id);
|
||||
if (node) return node;
|
||||
await setTimeout(250);
|
||||
}
|
||||
throw new Error(`Timed out waiting for ${id}`);
|
||||
}
|
||||
function tap({ x, y }) {
|
||||
adb("shell", "input", "tap", String(x), String(y));
|
||||
}
|
||||
async function waitForKeyboard(shown) {
|
||||
let stable = 0;
|
||||
const deadline = Date.now() + 10_000;
|
||||
while (Date.now() < deadline) {
|
||||
const state = adb("shell", "dumpsys", "input_method");
|
||||
stable = /^ {2}mInputShown=true$/m.test(state) === shown ? stable + 1 : 0;
|
||||
if (stable === 3) return;
|
||||
await setTimeout(200);
|
||||
}
|
||||
assert.fail(`Keyboard did not settle at shown=${shown}`);
|
||||
}
|
||||
|
||||
const clear = findNode("files-filter-clear");
|
||||
if (clear) tap(clear);
|
||||
tap(await waitForNode("files-filter-input"));
|
||||
await waitForKeyboard(true);
|
||||
adb("shell", "input", "text", query);
|
||||
const match = await waitForNode("file-filter-row-0");
|
||||
await waitForKeyboard(true); // Typing and new results leave the keyboard up.
|
||||
|
||||
tap(match);
|
||||
await waitForNode("sheet-tab-body");
|
||||
await waitForKeyboard(false);
|
||||
console.log("PASS: opening a filtered file closes the keyboard");
|
||||
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 160"><rect width="240" height="160" fill="#08a040"/><circle cx="120" cy="80" r="50" fill="#ffcc00"/></svg>
|
||||
|
Before Width: | Height: | Size: 164 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="240" height="160" viewBox="0 0 240 160"><rect width="240" height="160" fill="#08a040"/><circle cx="120" cy="80" r="50" fill="#ffcc00"/></svg>
|
||||
|
Before Width: | Height: | Size: 188 B |
@@ -18,9 +18,6 @@ press "id=\"combined-model-selector\""
|
||||
wait "id=\"model-provider-${PROVIDER_ID}\"" 10000
|
||||
press "id=\"model-provider-${PROVIDER_ID}\""
|
||||
wait "id=\"model-row-${PROVIDER_ID}-${MODEL_ID}\"" 3000
|
||||
# Back takes the header's step to the provider list first, then dismisses the modal.
|
||||
back
|
||||
wait "id=\"model-provider-${PROVIDER_ID}\"" 3000
|
||||
back
|
||||
wait "id=\"combined-model-selector\" label=\"Select model (${MODEL_LABEL})\"" 3000
|
||||
close
|
||||
|
||||
@@ -10,13 +10,13 @@ wait "id=\"agent-controls-model\"" 10000
|
||||
gesture pan 540 790 0 960 500
|
||||
wait "id=\"combined-model-selector\"" 3000
|
||||
|
||||
# Android Back steps from Model back to Agent settings, then closes the sheet.
|
||||
# Reopen, dismiss the nested model browser, then dismiss its restored parent.
|
||||
press "id=\"combined-model-selector\""
|
||||
wait "id=\"agent-controls-model\"" 10000
|
||||
press "id=\"agent-controls-model\""
|
||||
wait "id=\"model-search-all-input\"" 10000
|
||||
back
|
||||
wait stable 300 5000
|
||||
gesture pan 540 790 0 960 500
|
||||
wait "id=\"agent-controls-model\"" 3000
|
||||
back
|
||||
gesture pan 540 790 0 960 500
|
||||
wait "id=\"combined-model-selector\"" 3000
|
||||
close
|
||||
|
||||
@@ -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
|
||||
@@ -603,12 +603,9 @@ export function profilePickerRow(page: Page, name: string): Locator {
|
||||
.filter({ hasText: name });
|
||||
}
|
||||
|
||||
/** Multi-provider desktop keeps profiles behind the rail; single-pane lists them inline. */
|
||||
/** Desktop keeps profiles behind the rail's Profiles entry, beside the providers. */
|
||||
export async function openPickerProfiles(page: Page): Promise<void> {
|
||||
const rail = pickerViewport(page).getByTestId("model-picker-rail-profiles");
|
||||
if (await rail.isVisible().catch(() => false)) {
|
||||
await rail.click();
|
||||
}
|
||||
await pickerViewport(page).getByTestId("model-picker-rail-profiles").click();
|
||||
}
|
||||
|
||||
export async function expectPickerProfile(
|
||||
@@ -627,8 +624,7 @@ export async function expectProfilesEditLink(page: Page): Promise<void> {
|
||||
exact: true,
|
||||
});
|
||||
await expect(edit).toBeVisible();
|
||||
await expect(edit).toHaveText("");
|
||||
await expect(edit.locator("svg")).toBeVisible();
|
||||
await expect(edit).toHaveText("Edit");
|
||||
}
|
||||
|
||||
/** With no profiles, the Profiles entry offers to create one instead of listing any. */
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
import { mkdir, writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { once } from "node:events";
|
||||
import { spawnTsx, killProcessTree } from "./spawn-node";
|
||||
import appPackage from "../../../package.json";
|
||||
import { expect, test as base, type Page } from "../fixtures";
|
||||
import { gotoAppShell } from "./app";
|
||||
import { addConnectedHostAndReload } from "./hosts";
|
||||
import { pluginRequirements } from "./plugin-fixture";
|
||||
|
||||
const pluginId = "builtin-settings";
|
||||
const screenId = "general";
|
||||
const settingsText = "Built-in settings body";
|
||||
|
||||
export const test = base.extend<{ builtinSettingsHost: { serverId: string; port: number } }>({
|
||||
builtinSettingsHost: async ({ baseURL }, provide, testInfo) => {
|
||||
const root = testInfo.outputPath("builtin-plugins");
|
||||
const directory = path.join(root, pluginId);
|
||||
await mkdir(directory, { recursive: true });
|
||||
await writeFile(
|
||||
path.join(directory, "paseo-plugin.json"),
|
||||
JSON.stringify({ id: pluginId, requirements: pluginRequirements }),
|
||||
);
|
||||
await writeFile(
|
||||
path.join(directory, "index.client.tsx"),
|
||||
`import React from "react";
|
||||
import { Text } from "react-native";
|
||||
|
||||
export default function contribute(client) {
|
||||
client.addSettingsScreen({
|
||||
id: "${screenId}",
|
||||
title: "General",
|
||||
icon: "SlidersHorizontal",
|
||||
Component: () => <Text>${settingsText}</Text>,
|
||||
});
|
||||
return () => {};
|
||||
}`,
|
||||
);
|
||||
await writeFile(
|
||||
path.join(directory, "index.server.ts"),
|
||||
"export default function contribute() { return () => {}; }",
|
||||
);
|
||||
const daemon = spawnTsx(
|
||||
path.resolve(__dirname, "../../fixtures/builtin-settings/daemon.mts"),
|
||||
[root, new URL(baseURL!).origin, testInfo.outputPath("daemon"), appPackage.version],
|
||||
{ stdio: ["ignore", "inherit", "inherit", "ipc"] },
|
||||
);
|
||||
try {
|
||||
const [host] = await Promise.race([
|
||||
once(daemon, "message") as Promise<[{ serverId: string; port: number }]>,
|
||||
once(daemon, "exit").then(([code]) => {
|
||||
throw new Error(`Built-in settings daemon exited with code ${code}`);
|
||||
}),
|
||||
]);
|
||||
await provide(host);
|
||||
} finally {
|
||||
await killProcessTree(daemon);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
export async function openBuiltinPluginSettings(
|
||||
page: Page,
|
||||
host: { serverId: string; port: number },
|
||||
) {
|
||||
await gotoAppShell(page);
|
||||
await addConnectedHostAndReload(page, {
|
||||
...host,
|
||||
label: "Built-in settings host",
|
||||
destination: `/settings/hosts/${host.serverId}/plugins/${pluginId}/${screenId}`,
|
||||
});
|
||||
}
|
||||
|
||||
export async function expectBuiltinPluginSettings(page: Page) {
|
||||
await expect(page.getByText(settingsText, { exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("switch", { name: /: Disable$/ })).toHaveCount(0);
|
||||
}
|
||||
@@ -76,24 +76,15 @@ export async function addOfflineHostsAndReload(
|
||||
|
||||
export async function addConnectedHostAndReload(
|
||||
page: Page,
|
||||
input: {
|
||||
serverId: string;
|
||||
label: string;
|
||||
port: number;
|
||||
primaryLabel?: string;
|
||||
destination?: string;
|
||||
},
|
||||
input: { serverId: string; label: string; port: number; primaryLabel?: string },
|
||||
): Promise<void> {
|
||||
await addConnectedHostsAndReload(page, [input], {
|
||||
primaryLabel: input.primaryLabel,
|
||||
destination: input.destination,
|
||||
});
|
||||
await addConnectedHostsAndReload(page, [input], { primaryLabel: input.primaryLabel });
|
||||
}
|
||||
|
||||
export async function addConnectedHostsAndReload(
|
||||
page: Page,
|
||||
inputs: Array<{ serverId: string; label: string; port: number }>,
|
||||
options?: { primaryLabel?: string; destination?: string },
|
||||
options?: { primaryLabel?: string },
|
||||
): Promise<void> {
|
||||
const connectedHosts = inputs.map((input) =>
|
||||
buildSeededHost({
|
||||
@@ -132,8 +123,7 @@ export async function addConnectedHostsAndReload(
|
||||
},
|
||||
);
|
||||
|
||||
if (options?.destination) await page.goto(options.destination);
|
||||
else await page.reload();
|
||||
await page.reload();
|
||||
}
|
||||
|
||||
export async function waitForConnectedHost(
|
||||
|
||||
@@ -4,6 +4,10 @@ import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { expect, type Locator, type Page } from "@playwright/test";
|
||||
import type { DaemonClient as InternalDaemonClient } from "@getpaseo/client/internal/daemon-client";
|
||||
import type {
|
||||
MutableDaemonToolGroups,
|
||||
MutableDaemonToolsConfigPatch,
|
||||
} from "@getpaseo/protocol/messages";
|
||||
import { addProjectFlow, addProjectFlowInput, expectAddProjectTab } from "./add-project-flow";
|
||||
import { connectDaemonClient } from "./daemon-client-loader";
|
||||
import { buildCreateAgentPreferences, buildSeededHost } from "./daemon-registry";
|
||||
@@ -138,7 +142,7 @@ export async function goToSetupStep(page: Page, label: string): Promise<void> {
|
||||
}
|
||||
|
||||
export function paseoToolsSwitch(scope: Page | Locator): Locator {
|
||||
return scope.getByRole("switch", { name: "Inject Paseo tools", exact: true });
|
||||
return scope.getByRole("switch", { name: "Enable tools", exact: true });
|
||||
}
|
||||
|
||||
/** Whether the host gives its agents Paseo tools, read from the host itself. */
|
||||
@@ -147,7 +151,37 @@ export async function hostGivesAgentsPaseoTools(host: { port: number }): Promise
|
||||
Pick<InternalDaemonClient, "connect" | "close" | "getDaemonConfig">
|
||||
>({ clientIdPrefix: "app-e2e-onboarding", port: host.port });
|
||||
try {
|
||||
return (await client.getDaemonConfig()).config.mcp.injectIntoAgents !== false;
|
||||
const config = (await client.getDaemonConfig()).config;
|
||||
return config.tools?.enabled ?? config.mcp.injectIntoAgents !== false;
|
||||
} finally {
|
||||
await client.close();
|
||||
}
|
||||
}
|
||||
|
||||
/** The host's saved tool groups, read from the host itself. */
|
||||
export async function hostToolGroups(host: {
|
||||
port: number;
|
||||
}): Promise<MutableDaemonToolGroups | undefined> {
|
||||
const client = await connectDaemonClient<
|
||||
Pick<InternalDaemonClient, "connect" | "close" | "getDaemonConfig">
|
||||
>({ clientIdPrefix: "app-e2e-onboarding", port: host.port });
|
||||
try {
|
||||
return (await client.getDaemonConfig()).config.tools?.groups;
|
||||
} finally {
|
||||
await client.close();
|
||||
}
|
||||
}
|
||||
|
||||
/** Saves tool settings on the host, the way Settings does. */
|
||||
export async function setHostTools(
|
||||
host: { port: number },
|
||||
tools: MutableDaemonToolsConfigPatch,
|
||||
): Promise<void> {
|
||||
const client = await connectDaemonClient<
|
||||
Pick<InternalDaemonClient, "connect" | "close" | "patchDaemonConfig">
|
||||
>({ clientIdPrefix: "app-e2e-onboarding", port: host.port });
|
||||
try {
|
||||
await client.patchDaemonConfig({ tools });
|
||||
} finally {
|
||||
await client.close();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import { connectNewWorkspaceDaemonClient } from "./new-workspace";
|
||||
import { openAgentRoute, seedMockAgentWorkspace, type MockAgentWorkspace } from "./mock-agent";
|
||||
import { installDaemonWebSocketGate } from "./daemon-websocket-gate";
|
||||
import { expectReconnectingToastVisible } from "./workspace-ui";
|
||||
import { userScrollsTimelineToHistoryStart } from "./timeline-pagination";
|
||||
|
||||
const PLUGIN_ID = "timeline-transform-e2e";
|
||||
|
||||
@@ -374,81 +373,3 @@ export async function viewInlineThinkingExample(page: Page, info: TestInfo): Pro
|
||||
await example.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
/** Reuse plugin-local IDs across distinct source messages in a real virtualized chat. */
|
||||
export async function withRepeatedOutputTimeline(
|
||||
page: Page,
|
||||
info: TestInfo,
|
||||
run: () => Promise<void>,
|
||||
): Promise<void> {
|
||||
info.setTimeout(120_000);
|
||||
const agent = await seedMockAgentWorkspace({
|
||||
repoPrefix: "timeline-local-ids-",
|
||||
title: "Repeated plugin output IDs",
|
||||
});
|
||||
try {
|
||||
for (const label of ["First", "Second", "Third"]) {
|
||||
await agent.client.sendAgentMessage(
|
||||
agent.agentId,
|
||||
`${label}: emit 1 coalesced agent stream updates`,
|
||||
);
|
||||
await agent.client.waitForFinish(agent.agentId, 15_000);
|
||||
}
|
||||
await withDirectoryPlugin({
|
||||
pluginId: "timeline-local-ids",
|
||||
source: `import React from "react";
|
||||
import { Text, View } from "react-native";
|
||||
import { z } from "zod";
|
||||
function Row({ item }) {
|
||||
return <View style={{ height: item.data.tall ? 120 : 24 }}>
|
||||
<Text>{item.data.label}</Text>
|
||||
</View>;
|
||||
}
|
||||
export default function contribute(client) {
|
||||
client.addTimelineTransformer({
|
||||
id: "local-ids", query: { itemType: "user_message" },
|
||||
transform({ item }) {
|
||||
const label = item.text.split(":")[0];
|
||||
return { items: Array.from({ length: 60 }, (_, index) => ({
|
||||
type: "plugin", id: "part-" + index, kind: "reply", version: 1,
|
||||
data: { label: label + " replacement " + index, tall: label === "Second" },
|
||||
})) };
|
||||
},
|
||||
});
|
||||
client.addTimelineRenderer({
|
||||
kind: "reply", version: 1,
|
||||
schema: z.object({ label: z.string(), tall: z.boolean() }), Component: Row,
|
||||
});
|
||||
return () => {};
|
||||
}`,
|
||||
run: async () => {
|
||||
await openAgentRoute(page, agent);
|
||||
await expect(page.getByRole("textbox", { name: "Message agent..." }).first()).toBeVisible();
|
||||
await run();
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
export async function readOldestPluginReplacement(page: Page): Promise<void> {
|
||||
await expect(page.getByText("Third replacement 59", { exact: true }).first()).toBeAttached();
|
||||
await expect
|
||||
.poll(async () => {
|
||||
await userScrollsTimelineToHistoryStart(page);
|
||||
return page.getByText("First replacement 0", { exact: true }).isVisible();
|
||||
})
|
||||
.toBe(true);
|
||||
}
|
||||
|
||||
export async function expectOldestPluginReplacementReadable(page: Page): Promise<void> {
|
||||
await expect(
|
||||
page
|
||||
.getByTestId("agent-chat-scroll")
|
||||
.locator("[data-index]")
|
||||
.getByText("First replacement 0", { exact: true }),
|
||||
).toBeVisible();
|
||||
await expect(page.getByRole("textbox", { name: "Message agent..." }).first()).toBeVisible();
|
||||
await expect(page.getByText("Paseo ran into a problem.", { exact: true })).toHaveCount(0);
|
||||
}
|
||||
|
||||
@@ -61,24 +61,18 @@ async function readRows(input: {
|
||||
storeName: string;
|
||||
}): Promise<ReplicaRowRecord[]> {
|
||||
const database = await new Promise<IDBDatabase>((resolve, reject) => {
|
||||
// The app owns the database version; open whatever version it created.
|
||||
const request = indexedDB.open(input.databaseName);
|
||||
const request = indexedDB.open(input.databaseName, 1);
|
||||
request.addEventListener("success", () => resolve(request.result));
|
||||
request.addEventListener("error", () => reject(request.error));
|
||||
});
|
||||
return new Promise((resolve, reject) => {
|
||||
const request = database
|
||||
.transaction(input.storeName, "readonly")
|
||||
.objectStore(input.storeName)
|
||||
.getAll();
|
||||
request.addEventListener("success", () => resolve(request.result));
|
||||
request.addEventListener("error", () => reject(request.error));
|
||||
});
|
||||
try {
|
||||
return await new Promise((resolve, reject) => {
|
||||
const request = database
|
||||
.transaction(input.storeName, "readonly")
|
||||
.objectStore(input.storeName)
|
||||
.getAll();
|
||||
request.addEventListener("success", () => resolve(request.result));
|
||||
request.addEventListener("error", () => reject(request.error));
|
||||
});
|
||||
} finally {
|
||||
// An open connection would block the app from upgrading the database.
|
||||
database.close();
|
||||
}
|
||||
}
|
||||
|
||||
function assembleCache(rows: ReplicaRowRecord[]): ReplicaCacheRecord {
|
||||
@@ -191,27 +185,19 @@ export async function writeReplicaCache(page: Page, value: ReplicaCacheRecord):
|
||||
await page.evaluate(
|
||||
async ({ databaseName, storeName, nextRows }) => {
|
||||
const database = await new Promise<IDBDatabase>((resolve, reject) => {
|
||||
const request = indexedDB.open(databaseName);
|
||||
const request = indexedDB.open(databaseName, 1);
|
||||
request.addEventListener("success", () => resolve(request.result));
|
||||
request.addEventListener("error", () => reject(request.error));
|
||||
});
|
||||
try {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const transaction = database.transaction(storeName, "readwrite");
|
||||
const store = transaction.objectStore(storeName);
|
||||
store.clear();
|
||||
// The app budgets the cache on each row's recorded UTF-8 payload size.
|
||||
const encoder = new TextEncoder();
|
||||
for (const row of nextRows) {
|
||||
store.put({ ...row, payloadBytes: encoder.encode(row.payload).length });
|
||||
}
|
||||
transaction.addEventListener("complete", () => resolve());
|
||||
transaction.addEventListener("error", () => reject(transaction.error));
|
||||
transaction.addEventListener("abort", () => reject(transaction.error));
|
||||
});
|
||||
} finally {
|
||||
database.close();
|
||||
}
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const transaction = database.transaction(storeName, "readwrite");
|
||||
const store = transaction.objectStore(storeName);
|
||||
store.clear();
|
||||
for (const row of nextRows) store.put(row);
|
||||
transaction.addEventListener("complete", () => resolve());
|
||||
transaction.addEventListener("error", () => reject(transaction.error));
|
||||
transaction.addEventListener("abort", () => reject(transaction.error));
|
||||
});
|
||||
},
|
||||
{ databaseName: DATABASE_NAME, storeName: STORE_NAME, nextRows: rows },
|
||||
);
|
||||
|
||||
@@ -480,7 +480,7 @@ export async function expectHostConnectionsCard(page: Page, port: string): Promi
|
||||
export async function expectHostInjectMcpCard(page: Page): Promise<void> {
|
||||
const card = page.getByTestId("host-page-inject-mcp-card");
|
||||
await expect(card).toBeVisible();
|
||||
await expect(card.getByRole("switch", { name: "Inject Paseo tools" })).toBeVisible();
|
||||
await expect(card.getByRole("switch", { name: "Enable tools" })).toBeVisible();
|
||||
}
|
||||
|
||||
function idleAgentReleaseSwitch(page: Page) {
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
+13
-93
@@ -1,13 +1,11 @@
|
||||
package sh.paseo.terminal
|
||||
|
||||
import android.os.Build
|
||||
import android.text.InputType
|
||||
import android.view.KeyCharacterMap
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SdkSuppress
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
@@ -79,15 +77,6 @@ class TerminalInputConnectionTest {
|
||||
}
|
||||
}
|
||||
|
||||
/** Gboard commits each letter in its own batch edit when the editor disables suggestions. */
|
||||
private fun TerminalInputConnection.typeLikeGboard(text: String) {
|
||||
for (ch in text) {
|
||||
beginBatchEdit()
|
||||
commitText(ch.toString(), 1)
|
||||
endBatchEdit()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun editorInfoDisablesSuggestionsFullscreenAndPersonalizedLearning() {
|
||||
instrumentation.runOnMainSync {
|
||||
@@ -111,8 +100,13 @@ class TerminalInputConnectionTest {
|
||||
@Test
|
||||
fun batchedCommitTextAndSetComposingTextDoNotDoubleCharacters() {
|
||||
withInputHarness { _, ic, _, terminal ->
|
||||
ic.typeLikeGboard("abcd")
|
||||
for (ch in listOf("a", "b", "c", "d")) {
|
||||
ic.beginBatchEdit()
|
||||
ic.commitText(ch, 1)
|
||||
ic.endBatchEdit()
|
||||
}
|
||||
assertEquals("abcd", terminal.rawStream)
|
||||
assertEquals("", ic.editable.toString())
|
||||
|
||||
// Coalesced setComposingText + finishComposingText inside one batch emits once.
|
||||
ic.beginBatchEdit()
|
||||
@@ -120,96 +114,28 @@ class TerminalInputConnectionTest {
|
||||
ic.finishComposingText()
|
||||
ic.endBatchEdit()
|
||||
assertEquals("abcdef", terminal.rawStream)
|
||||
assertEquals("", ic.editable.toString())
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun editorKeepsTheTypedLineUntilTerminalKeyBoundary() {
|
||||
withInputHarness { _, ic, _, terminal ->
|
||||
// IMEs address edits by offsets into the text they committed, so the editor must keep it.
|
||||
ic.typeLikeGboard("ab")
|
||||
assertEquals("ab", ic.getTextBeforeCursor(10, 0).toString())
|
||||
|
||||
// Enter leaves the shell line, so the editor starts the next line empty.
|
||||
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER))
|
||||
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_ENTER))
|
||||
assertEquals("", ic.getTextBeforeCursor(10, 0).toString())
|
||||
|
||||
ic.typeLikeGboard("helo")
|
||||
ic.beginBatchEdit()
|
||||
ic.setComposingRegion(0, 4)
|
||||
ic.commitText("hello ", 1)
|
||||
ic.endBatchEdit()
|
||||
assertEquals("ab\rhello ", terminal.applyToLine())
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun gboardArrowKeyStartsTheEditorOnAnEmptyLine() {
|
||||
withInputHarness { _, ic, _, terminal ->
|
||||
ic.typeLikeGboard("echo helo")
|
||||
// Gboard's editing panel sends arrows as key events. The shell cursor moves, so the
|
||||
// editor's copy of the line no longer matches where the next edit lands.
|
||||
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPAD_LEFT))
|
||||
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DPAD_LEFT))
|
||||
assertEquals("", ic.getTextBeforeCursor(10, 0).toString())
|
||||
assertEquals(listOf("ArrowLeft"), terminal.keys.map { it.key })
|
||||
assertEquals("echo helo", terminal.rawStream)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun suggestionPickedThroughComposingRegionReplacesCommittedWord() {
|
||||
withInputHarness { _, ic, _, terminal ->
|
||||
// Gboard before Android 14 selects the committed word, then commits the suggestion.
|
||||
ic.typeLikeGboard("helo")
|
||||
ic.beginBatchEdit()
|
||||
ic.setComposingRegion(3, 4)
|
||||
ic.commitText("lo ", 1)
|
||||
ic.endBatchEdit()
|
||||
assertEquals("hello ", terminal.applyToLine())
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
|
||||
fun gboardReplaceTextRewritesCommittedText() {
|
||||
// Gboard on Android 14+ picks suggestions and applies double-space period with replaceText,
|
||||
// addressing text it committed earlier. Offsets and texts below are the calls Gboard made live.
|
||||
fun assertReplacement(typed: String, start: Int, end: Int, replacement: String, line: String) {
|
||||
withInputHarness { _, ic, _, terminal ->
|
||||
ic.typeLikeGboard(typed)
|
||||
ic.beginBatchEdit()
|
||||
ic.replaceText(start, end, replacement, 1, null)
|
||||
ic.endBatchEdit()
|
||||
assertEquals("$typed -> $replacement", line, terminal.applyToLine())
|
||||
}
|
||||
}
|
||||
|
||||
assertReplacement("helo", 3, 4, "lo ", line = "hello ")
|
||||
assertReplacement("helo", 3, 4, "p ", line = "help ")
|
||||
assertReplacement("echo hello", 5, 10, "jello ", line = "echo jello ")
|
||||
assertReplacement("ab ", 2, 3, ". ", line = "ab. ")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun backspaceWorksAcrossAllThreeImePaths() {
|
||||
withInputHarness { _, ic, _, terminal ->
|
||||
ic.commitText("abcd", 1)
|
||||
assertEquals("abcd", terminal.applyToLine())
|
||||
|
||||
// Path 1: deleteSurroundingText
|
||||
// Path 1: deleteSurroundingText (empty editable after commit)
|
||||
ic.deleteSurroundingText(0, 0)
|
||||
assertEquals("abcd", terminal.applyToLine())
|
||||
ic.deleteSurroundingText(1, 0)
|
||||
assertEquals("abc", terminal.applyToLine())
|
||||
|
||||
// Path 2: deleteSurroundingTextInCodePoints
|
||||
// Path 2: deleteSurroundingTextInCodePoints (empty editable)
|
||||
ic.deleteSurroundingTextInCodePoints(1, 0)
|
||||
assertEquals("ab", terminal.applyToLine())
|
||||
|
||||
// Path 2b: deleteSurroundingTextInCodePoints removes a surrogate-pair emoji as one code point
|
||||
ic.commitText("😀", 1)
|
||||
// Path 2b: deleteSurroundingTextInCodePoints on surrogate-pair emoji in composing buffer
|
||||
ic.setComposingText("😀", 1)
|
||||
assertEquals("ab😀", terminal.applyToLine())
|
||||
ic.deleteSurroundingTextInCodePoints(1, 0)
|
||||
assertEquals("ab", terminal.applyToLine())
|
||||
@@ -219,16 +145,10 @@ class TerminalInputConnectionTest {
|
||||
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL))
|
||||
assertEquals("a", terminal.applyToLine())
|
||||
|
||||
// Multi-char deleteSurroundingText
|
||||
// Multi-char deleteSurroundingText on empty buffer
|
||||
ic.commitText("xyz", 1)
|
||||
ic.deleteSurroundingText(2, 0)
|
||||
assertEquals("ax", terminal.applyToLine())
|
||||
|
||||
// After Enter the editor is empty, so Backspace still reaches text the shell already holds
|
||||
ic.sendKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER))
|
||||
ic.deleteSurroundingText(1, 0)
|
||||
ic.deleteSurroundingTextInCodePoints(1, 0)
|
||||
assertEquals("\r\u007f\u007f", terminal.rawStream.takeLast(3))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,7 +242,7 @@ class TerminalInputConnectionTest {
|
||||
ic.commitText("the", 1)
|
||||
assertEquals("hellothe", terminal.applyToLine())
|
||||
|
||||
// Repeated clipboard paste of identical text appends both copies
|
||||
// Repeated clipboard paste of identical text works because editable clears after commit
|
||||
ic.commitText("echo ok", 1)
|
||||
ic.commitText("echo ok", 1)
|
||||
assertEquals("hellotheecho okecho ok", terminal.applyToLine())
|
||||
|
||||
+48
-33
@@ -22,16 +22,9 @@ internal data class TerminalKeyPayload(
|
||||
/**
|
||||
* Single authoritative IME + key stream for the Android native terminal.
|
||||
*
|
||||
* The private [SpannableStringBuilder] holds the text the IME has typed on the current shell line,
|
||||
* committed and composing alike. IMEs keep their own copy of that text and edit it by offset:
|
||||
* Gboard picks a suggestion or applies double-space period by replacing text it committed
|
||||
* earlier. Once each batch edit settles, the editable is diffed against what the terminal already
|
||||
* holds and only the difference is sent, as rubouts plus the new suffix.
|
||||
*
|
||||
* A terminal key (Enter, Tab, Escape, arrows, control and hardware characters) changes the shell
|
||||
* line outside the IME, so it empties the editable and restarts the IME on the empty line.
|
||||
* Keys sent to the terminal without passing through this connection do not empty it: the
|
||||
* accessory bar, and the hardware arrows that `PaseoHardwareKeyboardModule` claims at window level.
|
||||
* Keeps a private [SpannableStringBuilder] so Android IMEs can compose Hangul, Pinyin, and Latin
|
||||
* candidates normally, diffs the editable against what was last sent to the PTY once each batch
|
||||
* edit settles, and clears the editable as soon as no composing span remains.
|
||||
*/
|
||||
internal class TerminalInputConnection(
|
||||
private val targetView: View,
|
||||
@@ -203,7 +196,6 @@ internal class TerminalInputConnection(
|
||||
KeyEvent.KEYCODE_DPAD_LEFT,
|
||||
KeyEvent.KEYCODE_DPAD_RIGHT -> {
|
||||
deadAccent = 0
|
||||
flushAndClear()
|
||||
val name = when (keyCode) {
|
||||
KeyEvent.KEYCODE_DPAD_UP -> "ArrowUp"
|
||||
KeyEvent.KEYCODE_DPAD_DOWN -> "ArrowDown"
|
||||
@@ -350,38 +342,57 @@ internal class TerminalInputConnection(
|
||||
if (diff.isNotEmpty()) {
|
||||
out.append(normalizeLineEndings(diff))
|
||||
}
|
||||
lastSentText = currentText
|
||||
|
||||
var compStart = getComposingSpanStart(sharedEditable)
|
||||
var compEnd = getComposingSpanEnd(sharedEditable)
|
||||
if (compStart >= 0 && compEnd <= compStart) {
|
||||
// An empty composing span would make hardware arrows look like IME navigation.
|
||||
removeComposingSpans(sharedEditable)
|
||||
compStart = -1
|
||||
compEnd = -1
|
||||
val compStart = getComposingSpanStart(sharedEditable)
|
||||
val compEnd = getComposingSpanEnd(sharedEditable)
|
||||
val isComposing = compStart >= 0 && compEnd > compStart
|
||||
|
||||
if (!isComposing) {
|
||||
val hadText = sharedEditable.isNotEmpty()
|
||||
if (hadText || compStart >= 0) {
|
||||
clearEditableSilently()
|
||||
}
|
||||
lastSentText = ""
|
||||
if (hadText) {
|
||||
// The IME just advanced its cursor for the committed text; report the reset to 0, 0.
|
||||
forceUpdateSelection(0, 0, -1, -1)
|
||||
} else {
|
||||
notifySelectionIfChanged(0, 0, -1, -1)
|
||||
}
|
||||
} else {
|
||||
lastSentText = currentText
|
||||
val selStart = maxOf(0, Selection.getSelectionStart(sharedEditable))
|
||||
val selEnd = maxOf(0, Selection.getSelectionEnd(sharedEditable))
|
||||
notifySelectionIfChanged(selStart, selEnd, compStart, compEnd)
|
||||
}
|
||||
notifySelectionIfChanged(
|
||||
maxOf(0, Selection.getSelectionStart(sharedEditable)),
|
||||
maxOf(0, Selection.getSelectionEnd(sharedEditable)),
|
||||
compStart,
|
||||
compEnd,
|
||||
)
|
||||
|
||||
if (out.isNotEmpty()) {
|
||||
onInput(out.toString())
|
||||
}
|
||||
}
|
||||
|
||||
/** Sends pending IME text, then starts the IME on an empty line before a terminal key. */
|
||||
private fun flushAndClear() {
|
||||
batchEditDepth = 0
|
||||
flush()
|
||||
if (sharedEditable.isEmpty()) return
|
||||
resetState()
|
||||
// The IME still holds the old line; updateSelection alone does not make Gboard reload it.
|
||||
val imm = targetView.context.getSystemService(InputMethodManager::class.java) ?: return
|
||||
if (imm.isActive(targetView)) {
|
||||
imm.restartInput(targetView)
|
||||
val hadText = sharedEditable.isNotEmpty()
|
||||
val out = StringBuilder()
|
||||
if (pendingBackspaces > 0) {
|
||||
repeat(pendingBackspaces) { out.append('\u007f') }
|
||||
pendingBackspaces = 0
|
||||
}
|
||||
val currentText = sharedEditable.toString()
|
||||
val diff = computeDiff(lastSentText, currentText)
|
||||
if (diff.isNotEmpty()) {
|
||||
out.append(normalizeLineEndings(diff))
|
||||
}
|
||||
if (hadText || getComposingSpanStart(sharedEditable) >= 0) {
|
||||
clearEditableSilently()
|
||||
}
|
||||
lastSentText = ""
|
||||
if (hadText || lastSelStart != 0 || lastSelEnd != 0 || lastCompStart != -1 || lastCompEnd != -1) {
|
||||
forceUpdateSelection(0, 0, -1, -1)
|
||||
}
|
||||
if (out.isNotEmpty()) {
|
||||
onInput(out.toString())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -400,6 +411,10 @@ internal class TerminalInputConnection(
|
||||
) {
|
||||
return
|
||||
}
|
||||
forceUpdateSelection(selStart, selEnd, compStart, compEnd)
|
||||
}
|
||||
|
||||
private fun forceUpdateSelection(selStart: Int, selEnd: Int, compStart: Int, compEnd: Int) {
|
||||
lastSelStart = selStart
|
||||
lastSelEnd = selEnd
|
||||
lastCompStart = compStart
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/app",
|
||||
"version": "0.18.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],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -603,15 +603,14 @@ describe("layoutStream", () => {
|
||||
splitIntoCards,
|
||||
);
|
||||
|
||||
const footerCardIds = tail
|
||||
.filter((item) => item.kind === "plugin" && item.itemKind === "genui-card")
|
||||
.map((item) => item.id);
|
||||
expect(footerCardIds).toHaveLength(2);
|
||||
const layout = layoutFor({
|
||||
platform,
|
||||
tail,
|
||||
timingIds: ["genui/a1/card", "genui/a2/card"],
|
||||
});
|
||||
|
||||
const layout = layoutFor({ platform, tail, timingIds: footerCardIds });
|
||||
|
||||
expect(footerOwners(layout)).toEqual(footerCardIds);
|
||||
expect(findLayoutItem(layout, footerCardIds[0]).completedFooter?.turnMetrics).toBe(
|
||||
expect(footerOwners(layout)).toEqual(["genui/a1/card", "genui/a2/card"]);
|
||||
expect(findLayoutItem(layout, "genui/a1/card").completedFooter?.turnMetrics).toBe(
|
||||
first.turnMetrics,
|
||||
);
|
||||
expect(layout.auxiliaryTurnFooter?.turnMetrics).toBe(metrics);
|
||||
|
||||
@@ -203,9 +203,7 @@ describe("stream presentation through installed plugins", () => {
|
||||
const source = rows(harness.source());
|
||||
|
||||
expect(source).toMatchObject([{ kind: "user_message", id: "prompt-1" }]);
|
||||
expect(rendered).toMatchObject([
|
||||
{ kind: "plugin", source: { id: "prompt-1" }, pluginItemId: "prompt-1/0" },
|
||||
]);
|
||||
expect(rendered).toMatchObject([{ kind: "plugin", id: "probe-plugin/prompt-1/0" }]);
|
||||
// The chat outline jumps to the source id; the row it lands on is the plugin's.
|
||||
expect(rendered.map(getStreamItemMessageId)).toEqual(["prompt-1"]);
|
||||
});
|
||||
@@ -613,7 +611,7 @@ it("folds work before a plugin-rendered reply and leaves the reply visible", ()
|
||||
expect(result.tail.map((item) => item.id)).toEqual([
|
||||
"prompt",
|
||||
"turn-summary:prompt",
|
||||
JSON.stringify(["probe-plugin", "reply", "reply/0"]),
|
||||
"probe-plugin/reply/0",
|
||||
]);
|
||||
expect(pluginData(result.tail)).toEqual([{ text: "$$x^2$$", phase: "complete" }]);
|
||||
});
|
||||
@@ -642,7 +640,7 @@ it("keeps streaming replies native, then folds work without losing manual expans
|
||||
expect(present(completed).tail.map((item) => item.id)).toEqual([
|
||||
"prompt",
|
||||
"turn-summary:prompt",
|
||||
JSON.stringify(["probe-plugin", "reply", "reply/0"]),
|
||||
"probe-plugin/reply/0",
|
||||
]);
|
||||
const expandedTurnHostIds = new Set(["prompt"]);
|
||||
const opened = present({ ...completed, expandedTurnHostIds });
|
||||
@@ -650,16 +648,14 @@ it("keeps streaming replies native, then folds work without losing manual expans
|
||||
"prompt",
|
||||
"turn-summary:prompt",
|
||||
"tool-one",
|
||||
JSON.stringify(["probe-plugin", "reply", "reply/0"]),
|
||||
"probe-plugin/reply/0",
|
||||
]);
|
||||
expect(opened.turns.nestedItemIds.has(JSON.stringify(["probe-plugin", "reply", "reply/0"]))).toBe(
|
||||
false,
|
||||
);
|
||||
expect(opened.turns.nestedItemIds.has("probe-plugin/reply/0")).toBe(false);
|
||||
expect(present({ ...completed, expandedTurnHostIds }).tail).toEqual(opened.tail);
|
||||
expect(present(completed).tail.map((item) => item.id)).toEqual([
|
||||
"prompt",
|
||||
"turn-summary:prompt",
|
||||
JSON.stringify(["probe-plugin", "reply", "reply/0"]),
|
||||
"probe-plugin/reply/0",
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -683,7 +679,7 @@ it.each(["full", "collapseToolCalls"] as const)(
|
||||
expect(result.tail.map((item) => item.id)).toEqual([
|
||||
"prompt",
|
||||
"tool-one",
|
||||
JSON.stringify(["probe-plugin", "reply", "reply/0"]),
|
||||
"probe-plugin/reply/0",
|
||||
]);
|
||||
expect(result.turns.summaryRowsByHostId.size).toBe(0);
|
||||
},
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 ? (
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
}),
|
||||
})}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
encodeAttachmentsForSend,
|
||||
garbageCollectAttachments,
|
||||
persistAttachmentFromBytes,
|
||||
prepareImageAttachmentsForSend,
|
||||
uploadImageAttachments,
|
||||
} from "./service";
|
||||
|
||||
@@ -221,71 +220,4 @@ describe("attachment service", () => {
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("uses file.upload.request when daemon advertises uploadedImageAttachments and falls back to inline base64 images on legacy daemons", async () => {
|
||||
const store = createRecordingStore();
|
||||
__setAttachmentStoreForTests(store);
|
||||
const attachment = createAttachment({
|
||||
id: "img-compat",
|
||||
fileName: "photo.jpg",
|
||||
mimeType: "image/jpeg",
|
||||
});
|
||||
|
||||
const uploadCalls: string[] = [];
|
||||
const modernClient = {
|
||||
getLastServerInfoMessage: () => ({ features: { uploadedImageAttachments: true } }),
|
||||
uploadFile: async (input: { fileName: string; mimeType: string; bytes: Uint8Array }) => {
|
||||
uploadCalls.push(input.fileName);
|
||||
return {
|
||||
requestId: "req-modern",
|
||||
file: {
|
||||
type: "uploaded_file" as const,
|
||||
id: "upload_photo",
|
||||
fileName: input.fileName,
|
||||
mimeType: input.mimeType,
|
||||
size: input.bytes.byteLength,
|
||||
path: "/home/user/.paseo/uploads/upload_photo/photo.jpg",
|
||||
},
|
||||
error: null,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
const modernResult = await prepareImageAttachmentsForSend({
|
||||
client: modernClient,
|
||||
images: [attachment],
|
||||
});
|
||||
expect(uploadCalls).toEqual(["photo.jpg"]);
|
||||
expect(modernResult).toEqual({
|
||||
attachments: [
|
||||
{
|
||||
type: "uploaded_file",
|
||||
id: "upload_photo",
|
||||
fileName: "photo.jpg",
|
||||
mimeType: "image/jpeg",
|
||||
size: new TextEncoder().encode("img-compat:bytes").byteLength,
|
||||
path: "/home/user/.paseo/uploads/upload_photo/photo.jpg",
|
||||
role: "image",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const legacyUploadCalls: string[] = [];
|
||||
const legacyClient = {
|
||||
getLastServerInfoMessage: () => ({ features: {} }),
|
||||
uploadFile: async (input: { fileName: string }) => {
|
||||
legacyUploadCalls.push(input.fileName);
|
||||
throw new Error("uploadFile must not be called for legacy daemon image sends");
|
||||
},
|
||||
};
|
||||
|
||||
const legacyResult = await prepareImageAttachmentsForSend({
|
||||
client: legacyClient,
|
||||
images: [attachment],
|
||||
});
|
||||
expect(legacyUploadCalls).toEqual([]);
|
||||
expect(legacyResult).toEqual({
|
||||
images: [{ data: "img-compat:base64", mimeType: "image/jpeg" }],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -152,15 +152,6 @@ export interface ImageUploadClient {
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface ImageSendClient extends ImageUploadClient {
|
||||
getLastServerInfoMessage: () => { features?: { uploadedImageAttachments?: boolean } } | null;
|
||||
}
|
||||
|
||||
export interface PreparedImagePayload {
|
||||
images?: Array<{ data: string; mimeType: string }>;
|
||||
attachments?: UploadedFileAttachment[];
|
||||
}
|
||||
|
||||
export async function readAttachmentBytes(attachment: AttachmentMetadata): Promise<Uint8Array> {
|
||||
const store = await getAttachmentStore();
|
||||
return await store.readBytes({ attachment });
|
||||
@@ -169,8 +160,9 @@ export async function readAttachmentBytes(attachment: AttachmentMetadata): Promi
|
||||
/**
|
||||
* Uploads persisted image attachments sequentially via `file.upload.request` so multi-photo
|
||||
* batches drain cleanly between files instead of queueing concurrently on mobile sockets.
|
||||
* Each uploaded image is marked with `role: "image"` inside `uploaded_file` so capable daemons
|
||||
* resolve it into a native vision block + timeline thumbnail.
|
||||
* Each uploaded image is marked with `role: "image"` inside `uploaded_file` so current daemons
|
||||
* resolve it into a native vision block + timeline thumbnail, while older daemons (v0.1.91-v0.18.1)
|
||||
* strip the unknown `role` field and still deliver the uploaded file path instead of dropping it.
|
||||
*/
|
||||
export async function uploadImageAttachments(input: {
|
||||
client: ImageUploadClient;
|
||||
@@ -204,34 +196,6 @@ export async function uploadImageAttachments(input: {
|
||||
return uploaded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares image attachments for agent prompt/create RPCs.
|
||||
*
|
||||
* Hosts advertising `server_info.features.uploadedImageAttachments` receive sequential
|
||||
* `file.upload.request` uploads tagged with `role: "image"`. Older hosts strip `role: "image"`
|
||||
* and degrade the upload to plain file-path text, so they keep receiving inline base64 `images`.
|
||||
*/
|
||||
export async function prepareImageAttachmentsForSend(input: {
|
||||
client: ImageSendClient;
|
||||
images: readonly AttachmentMetadata[] | undefined;
|
||||
}): Promise<PreparedImagePayload> {
|
||||
if (!input.images || input.images.length === 0) {
|
||||
return {};
|
||||
}
|
||||
|
||||
// COMPAT(uploadedImageAttachments): added in v0.18.2, remove gate after 2027-06-01.
|
||||
if (input.client.getLastServerInfoMessage()?.features?.uploadedImageAttachments === true) {
|
||||
const attachments = await uploadImageAttachments({
|
||||
client: input.client,
|
||||
images: input.images,
|
||||
});
|
||||
return attachments ? { attachments } : {};
|
||||
}
|
||||
|
||||
const images = await encodeAttachmentsForSend(input.images);
|
||||
return images ? { images } : {};
|
||||
}
|
||||
|
||||
export async function resolveAttachmentPreviewUrl(attachment: AttachmentMetadata): Promise<string> {
|
||||
const store = await getAttachmentStore();
|
||||
return await store.resolvePreviewUrl({ attachment });
|
||||
|
||||
@@ -60,10 +60,6 @@ export interface SheetHeaderSearch {
|
||||
testID?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* One step back inside the sheet, such as from a page to the one before it. Android Back takes
|
||||
* this step too, and closes the sheet only when the header has no back.
|
||||
*/
|
||||
export interface SheetHeaderBack {
|
||||
onPress: () => void;
|
||||
label?: string;
|
||||
@@ -742,17 +738,10 @@ export function AdaptiveModalSheet({
|
||||
}
|
||||
}, [visible]);
|
||||
|
||||
const headerBack = header?.back?.onPress;
|
||||
const handleBack = useCallback(() => {
|
||||
if (!headerBack) return false;
|
||||
headerBack();
|
||||
return true;
|
||||
}, [headerBack]);
|
||||
const { sheetRef, handleSheetChange, handleSheetDismiss } = useIsolatedBottomSheetVisibility({
|
||||
visible,
|
||||
isEnabled: isSheet,
|
||||
onClose,
|
||||
onBack: handleBack,
|
||||
});
|
||||
const [shouldRenderWeb, setShouldRenderWeb] = useState(visible);
|
||||
const [isWebClosing, setIsWebClosing] = useState(false);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
import { ModelProviderGlyph, useSelectedModelLabels } from "@/components/model-browser";
|
||||
import { DesktopModelPicker, type ModelPickerActions } from "@/components/model-browser-panes";
|
||||
import {
|
||||
getSheetSearchFooterStyle,
|
||||
MobileModelPageView,
|
||||
SheetSearchDock,
|
||||
useMobileModelPage,
|
||||
@@ -314,7 +313,6 @@ function CompactCombinedModelSelector({
|
||||
snapPoints={SHEET_SNAP_POINTS}
|
||||
scrollable={false}
|
||||
footer={footer}
|
||||
footerContainerStyle={getSheetSearchFooterStyle()}
|
||||
keyboard={keyboard}
|
||||
contentStyle={styles.sheetBody}
|
||||
testID="model-selector-sheet"
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -12,7 +12,6 @@ import { useQuery } from "@tanstack/react-query";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
FlatList,
|
||||
Keyboard,
|
||||
type LayoutChangeEvent,
|
||||
ListRenderItemInfo,
|
||||
Pressable,
|
||||
@@ -630,8 +629,6 @@ export function FileExplorerPane({
|
||||
if (!hasWorkspaceScope) {
|
||||
return;
|
||||
}
|
||||
// The preview opens over this pane, so the filter must give up the keyboard.
|
||||
Keyboard.dismiss();
|
||||
onOpenFile?.(entry.path);
|
||||
},
|
||||
[hasWorkspaceScope, onOpenFile],
|
||||
|
||||
@@ -134,15 +134,17 @@ describe("mobile model page", () => {
|
||||
providerId: section.providerId,
|
||||
status: section.status,
|
||||
expanded: section.expanded,
|
||||
shown: section.shown,
|
||||
total: section.total,
|
||||
}
|
||||
: section,
|
||||
),
|
||||
).toEqual([
|
||||
{ providerId: "claude", status: "ready", expanded: true },
|
||||
{ providerId: "codex", status: "ready", expanded: false },
|
||||
{ providerId: "opencode", status: "loading", expanded: false },
|
||||
{ providerId: "pi", status: "ready", expanded: false },
|
||||
{ providerId: "copilot", status: "error", expanded: false },
|
||||
{ providerId: "claude", status: "ready", expanded: true, shown: 4, total: 19 },
|
||||
{ providerId: "codex", status: "ready", expanded: false, shown: 2, total: 2 },
|
||||
{ providerId: "opencode", status: "loading", expanded: false, shown: 0, total: 0 },
|
||||
{ providerId: "pi", status: "ready", expanded: false, shown: 2, total: 4 },
|
||||
{ providerId: "copilot", status: "error", expanded: false, shown: 0, total: 0 },
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -152,26 +154,12 @@ describe("mobile model page", () => {
|
||||
expect(projection.sections[0]).toEqual({
|
||||
kind: "profiles",
|
||||
key: MODEL_PICKER_PROFILES_RAIL_KEY,
|
||||
count: 2,
|
||||
expanded: false,
|
||||
});
|
||||
expect(projection.sections.find((section) => section.expanded)?.key).toBe("claude");
|
||||
});
|
||||
|
||||
it("omits the Profiles accordion when extracted to Home, while still searching profiles", () => {
|
||||
const extractedInput: MobileModelPageInput = {
|
||||
...inputWithProfiles,
|
||||
showProfilesSection: false,
|
||||
};
|
||||
const browsed = browse(project([], extractedInput));
|
||||
expect(browsed.sections.map((section) => section.key)).not.toContain(
|
||||
MODEL_PICKER_PROFILES_RAIL_KEY,
|
||||
);
|
||||
const searched = project([{ kind: "query", query: "reviewer" }], extractedInput);
|
||||
expect(searched.kind).toBe("search");
|
||||
if (searched.kind !== "search") return;
|
||||
expect(searched.profiles.map((item) => item.key)).toEqual(["profile:reviewer"]);
|
||||
});
|
||||
|
||||
it("expands Profiles to list saved profiles, or Create profile when there are none", () => {
|
||||
const expanded = browse(
|
||||
project([{ kind: "toggleSection", key: MODEL_PICKER_PROFILES_RAIL_KEY }], inputWithProfiles),
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
import {
|
||||
createModelPickerState,
|
||||
MODEL_PICKER_PROFILES_RAIL_KEY,
|
||||
orderProvidersForPicker,
|
||||
projectModelPicker,
|
||||
type ModelPickerInput,
|
||||
type ModelPickerListItem,
|
||||
type ModelPickerPane,
|
||||
type ModelPickerState,
|
||||
} from "@/components/model-browser-panes-view";
|
||||
import {
|
||||
MODEL_BROWSER_CREATE_PROFILE_KEY,
|
||||
modelBrowserProfileKey,
|
||||
type NavigableProfileRow,
|
||||
} from "@/components/model-browser-view";
|
||||
import type { NavigableProfileRow } from "@/components/model-browser-view";
|
||||
import { partitionProviderModels } from "@/provider-selection/model-curation";
|
||||
import type { ProviderSelectorProvider } from "@/provider-selection/provider-selection";
|
||||
|
||||
/**
|
||||
* The compact model picker: optional Profiles section and one section per provider, stacked as an
|
||||
* accordion. At most one section is open at a time, and tapping the open section collapses it so
|
||||
* every group can sit closed. A query replaces the accordion with ranked results across profiles
|
||||
* and every provider, folded models included.
|
||||
* The compact model picker: Profiles (when the surface offers them) and one section per provider,
|
||||
* stacked as an accordion. At most one section is open at a time, and tapping the open section
|
||||
* collapses it so every group can sit closed. A query replaces the accordion with ranked results
|
||||
* across profiles and every provider, folded models included.
|
||||
*
|
||||
* It delegates model folding, ordering, and search to the desktop picker's projection so both form
|
||||
* factors behave identically.
|
||||
* It delegates to the desktop picker's projection so both form factors order, fold, rank and
|
||||
* search the same way.
|
||||
*/
|
||||
|
||||
export interface MobileModelPageInput<TProfile extends NavigableProfileRow = NavigableProfileRow> {
|
||||
@@ -29,8 +26,6 @@ export interface MobileModelPageInput<TProfile extends NavigableProfileRow = Nav
|
||||
/** `null` when the surface offers no profiles. */
|
||||
profiles: readonly TProfile[] | null;
|
||||
canCreateProfile: boolean;
|
||||
/** False when Profiles is rendered outside this page (for example on Agent settings Home). */
|
||||
showProfilesSection?: boolean;
|
||||
selectedProvider: string;
|
||||
selectedModel: string;
|
||||
}
|
||||
@@ -51,6 +46,7 @@ export type MobileModelPageAction =
|
||||
export interface MobileProfilesSection {
|
||||
kind: "profiles";
|
||||
key: typeof MODEL_PICKER_PROFILES_RAIL_KEY;
|
||||
count: number;
|
||||
expanded: boolean;
|
||||
}
|
||||
|
||||
@@ -60,6 +56,11 @@ export interface MobileProviderSection {
|
||||
providerId: string;
|
||||
label: string;
|
||||
status: "ready" | "loading" | "error";
|
||||
/** Models listed before the fold. */
|
||||
shown: number;
|
||||
total: number;
|
||||
/** Some models sit behind a fold, so `shown` and `total` differ in meaning. */
|
||||
folds: boolean;
|
||||
expanded: boolean;
|
||||
}
|
||||
|
||||
@@ -74,11 +75,11 @@ export type MobileModelPageProjection<TProfile extends NavigableProfileRow = Nav
|
||||
| {
|
||||
kind: "browse";
|
||||
sections: MobileModelSection[];
|
||||
/** False for a lone provider without a Profiles section: its models fill the page. */
|
||||
/** False for a lone provider without profiles: its models are the page, with no header above them. */
|
||||
showSectionHeaders: boolean;
|
||||
/** What the open section lists, or `null` when every section is collapsed. */
|
||||
body: MobileModelBody<TProfile> | null;
|
||||
/** The selected model's row in the open list, which opens already in view. */
|
||||
/** The selected model's row in the open list, which the list scrolls into view. */
|
||||
selectedIndex: number | null;
|
||||
}
|
||||
| {
|
||||
@@ -96,7 +97,7 @@ export function createMobileModelPageState<TProfile extends NavigableProfileRow>
|
||||
): MobileModelPageState {
|
||||
return {
|
||||
query: "",
|
||||
expandedKey: resolveInitialExpandedKey(input),
|
||||
expandedKey: createModelPickerState(toPickerInput(input)).railKey,
|
||||
foldOverrides: {},
|
||||
};
|
||||
}
|
||||
@@ -121,47 +122,42 @@ export function reduceMobileModelPage(
|
||||
}
|
||||
}
|
||||
|
||||
export function buildMobileProfileListItems<TProfile extends NavigableProfileRow>(
|
||||
profiles: readonly TProfile[],
|
||||
canCreateProfile: boolean,
|
||||
): ModelPickerListItem<TProfile>[] {
|
||||
if (profiles.length === 0) {
|
||||
return canCreateProfile
|
||||
? [{ kind: "createProfile", key: MODEL_BROWSER_CREATE_PROFILE_KEY }]
|
||||
: [];
|
||||
}
|
||||
return profiles.map((profile) => ({
|
||||
kind: "profile",
|
||||
key: modelBrowserProfileKey(profile.id),
|
||||
profile,
|
||||
}));
|
||||
}
|
||||
|
||||
export function projectMobileModelPage<TProfile extends NavigableProfileRow>(
|
||||
input: MobileModelPageInput<TProfile>,
|
||||
state: MobileModelPageState,
|
||||
): MobileModelPageProjection<TProfile> {
|
||||
if (input.providers.length === 0) return { kind: "noProviders" };
|
||||
if (state.query.trim().length > 0) {
|
||||
const picker = projectModelPicker<TProfile>(toPickerInput(input), toPickerState(state));
|
||||
if (picker.pane.kind === "noMatches") return { kind: "noMatches", query: picker.pane.query };
|
||||
if (picker.pane.kind === "search") {
|
||||
return {
|
||||
kind: "search",
|
||||
profiles: picker.pane.profiles,
|
||||
models: picker.pane.models,
|
||||
items: picker.pane.items,
|
||||
};
|
||||
const picker = projectModelPicker<TProfile>(toPickerInput(input), toPickerState(state));
|
||||
const { pane } = picker;
|
||||
if (pane.kind === "noMatches") return { kind: "noMatches", query: pane.query };
|
||||
if (pane.kind === "search") {
|
||||
return { kind: "search", profiles: pane.profiles, models: pane.models, items: pane.items };
|
||||
}
|
||||
const sections: MobileModelSection[] = [];
|
||||
if (picker.layout === "twoPane") {
|
||||
for (const item of picker.rail) {
|
||||
if (item.kind === "profiles") {
|
||||
sections.push({
|
||||
kind: "profiles",
|
||||
key: item.key,
|
||||
count: item.count,
|
||||
expanded: false,
|
||||
});
|
||||
} else {
|
||||
const provider = input.providers.find((entry) => entry.id === item.providerId);
|
||||
if (provider) sections.push(toProviderSection(provider, false));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const provider = input.providers.find((entry) => entry.id === picker.railKey);
|
||||
if (provider) sections.push(toProviderSection(provider, true));
|
||||
}
|
||||
|
||||
const sections = buildSections(input);
|
||||
const showSectionHeaders = sections.length > 1;
|
||||
const expandedKey = resolveExpandedKey(sections, state.expandedKey, showSectionHeaders);
|
||||
const expandedKey = showSectionHeaders && state.expandedKey === null ? null : picker.railKey;
|
||||
for (const section of sections) {
|
||||
section.expanded = section.key === expandedKey;
|
||||
}
|
||||
const body = expandedKey === null ? null : buildSectionBody(input, state, expandedKey);
|
||||
const body = expandedKey === null ? null : pane;
|
||||
return {
|
||||
kind: "browse",
|
||||
sections,
|
||||
@@ -171,81 +167,6 @@ export function projectMobileModelPage<TProfile extends NavigableProfileRow>(
|
||||
};
|
||||
}
|
||||
|
||||
function resolveInitialExpandedKey<TProfile extends NavigableProfileRow>(
|
||||
input: MobileModelPageInput<TProfile>,
|
||||
): string {
|
||||
const selected = input.providers.find((provider) => provider.id === input.selectedProvider);
|
||||
if (selected) return selected.id;
|
||||
if (input.showProfilesSection !== false && (input.profiles?.length ?? 0) > 0) {
|
||||
return MODEL_PICKER_PROFILES_RAIL_KEY;
|
||||
}
|
||||
const ready = input.providers.find((provider) => provider.modelSelection.kind === "models");
|
||||
return (ready ?? input.providers[0])?.id ?? MODEL_PICKER_PROFILES_RAIL_KEY;
|
||||
}
|
||||
|
||||
function buildSections<TProfile extends NavigableProfileRow>(
|
||||
input: MobileModelPageInput<TProfile>,
|
||||
): MobileModelSection[] {
|
||||
const ordered: MobileModelSection[] = orderProvidersForPicker(input.providers).ordered.map(
|
||||
(provider) => toProviderSection(provider),
|
||||
);
|
||||
if (input.showProfilesSection !== false && input.profiles !== null) {
|
||||
ordered.unshift({
|
||||
kind: "profiles",
|
||||
key: MODEL_PICKER_PROFILES_RAIL_KEY,
|
||||
expanded: false,
|
||||
});
|
||||
}
|
||||
return ordered;
|
||||
}
|
||||
|
||||
function resolveExpandedKey(
|
||||
sections: readonly MobileModelSection[],
|
||||
requestedKey: string | null,
|
||||
showSectionHeaders: boolean,
|
||||
): string | null {
|
||||
if (showSectionHeaders && requestedKey === null) return null;
|
||||
if (requestedKey !== null && sections.some((section) => section.key === requestedKey)) {
|
||||
return requestedKey;
|
||||
}
|
||||
return sections[0]?.key ?? null;
|
||||
}
|
||||
|
||||
function buildSectionBody<TProfile extends NavigableProfileRow>(
|
||||
input: MobileModelPageInput<TProfile>,
|
||||
state: MobileModelPageState,
|
||||
expandedKey: string,
|
||||
): MobileModelBody<TProfile> | null {
|
||||
if (expandedKey === MODEL_PICKER_PROFILES_RAIL_KEY) {
|
||||
return {
|
||||
kind: "profiles",
|
||||
items: buildMobileProfileListItems(input.profiles ?? [], input.canCreateProfile),
|
||||
};
|
||||
}
|
||||
const provider = input.providers.find((entry) => entry.id === expandedKey);
|
||||
if (!provider) return null;
|
||||
// Pass only the expanded provider with profiles omitted so the shared picker projects that
|
||||
// provider's own models, fold, loading, or error state cleanly.
|
||||
const picker = projectModelPicker<TProfile>(
|
||||
{
|
||||
providers: [provider],
|
||||
profiles: null,
|
||||
canCreateProfile: false,
|
||||
selectedProvider: input.selectedProvider,
|
||||
selectedModel: input.selectedModel,
|
||||
},
|
||||
{
|
||||
query: "",
|
||||
railKey: provider.id,
|
||||
focus: "list",
|
||||
activeKey: null,
|
||||
foldOverrides: state.foldOverrides,
|
||||
},
|
||||
);
|
||||
if (picker.pane.kind === "search" || picker.pane.kind === "noMatches") return null;
|
||||
return picker.pane;
|
||||
}
|
||||
|
||||
function findSelectedIndex<TProfile extends NavigableProfileRow>(
|
||||
body: MobileModelBody<TProfile>,
|
||||
input: MobileModelPageInput<TProfile>,
|
||||
@@ -279,17 +200,33 @@ function toPickerState(state: MobileModelPageState): ModelPickerState {
|
||||
};
|
||||
}
|
||||
|
||||
function toProviderSection(provider: ProviderSelectorProvider): MobileProviderSection {
|
||||
const selection = provider.modelSelection;
|
||||
let status: MobileProviderSection["status"] = "ready";
|
||||
if (selection.kind === "loading") status = "loading";
|
||||
else if (selection.kind === "error") status = "error";
|
||||
return {
|
||||
kind: "provider",
|
||||
function toProviderSection(
|
||||
provider: ProviderSelectorProvider,
|
||||
expanded: boolean,
|
||||
): MobileProviderSection {
|
||||
const base = {
|
||||
kind: "provider" as const,
|
||||
key: provider.id,
|
||||
providerId: provider.id,
|
||||
label: provider.label,
|
||||
status,
|
||||
expanded: false,
|
||||
expanded,
|
||||
};
|
||||
const selection = provider.modelSelection;
|
||||
if (selection.kind !== "models") {
|
||||
return {
|
||||
...base,
|
||||
status: selection.kind === "loading" ? "loading" : "error",
|
||||
shown: 0,
|
||||
total: 0,
|
||||
folds: false,
|
||||
};
|
||||
}
|
||||
const partition = partitionProviderModels(selection.rows, provider.shownModels, "");
|
||||
return {
|
||||
...base,
|
||||
status: "ready",
|
||||
shown: partition.primary.length,
|
||||
total: selection.rows.length,
|
||||
folds: partition.foldKind !== null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { useCallback, useMemo, useRef, useState, type ReactElement, type ReactNode } from "react";
|
||||
import { useCallback, useMemo, useRef, useState, type ReactNode } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FlatList, Text, View } from "react-native";
|
||||
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||
import { AlertTriangle, ChevronDown, Layers } from "lucide-react-native";
|
||||
import { AlertTriangle, ChevronDown, ChevronUp, Layers, Pencil } from "lucide-react-native";
|
||||
import type { AgentProfilePickerRow } from "@/agent-profiles";
|
||||
import { IndependentScrollBoundary } from "@/components/ui/independent-scroll-boundary";
|
||||
import {
|
||||
MODEL_PICKER_ROW_HEIGHT,
|
||||
IndependentScrollBoundary,
|
||||
ModelBrowserLoadingState,
|
||||
ModelBrowserNoProviders,
|
||||
ModelBrowserRow,
|
||||
ModelBrowserSectionHeading,
|
||||
ModelProviderGlyph,
|
||||
ModelSearchNoMatches,
|
||||
@@ -16,14 +16,12 @@ import {
|
||||
} from "@/components/model-browser";
|
||||
import {
|
||||
CustomizeProviderButton,
|
||||
EditProfilesButton,
|
||||
ModelPickerItemRow,
|
||||
type ModelPickerActions,
|
||||
} from "@/components/model-browser-panes";
|
||||
import type { ModelPickerListItem } from "@/components/model-browser-panes-view";
|
||||
import { groupProfilesByProviderModel } from "@/components/model-browser-view";
|
||||
import {
|
||||
buildMobileProfileListItems,
|
||||
createMobileModelPageState,
|
||||
projectMobileModelPage,
|
||||
reduceMobileModelPage,
|
||||
@@ -32,39 +30,41 @@ import {
|
||||
type MobileModelPageInput,
|
||||
type MobileModelPageProjection,
|
||||
type MobileModelSection,
|
||||
type MobileProfilesSection,
|
||||
type MobileProviderSection,
|
||||
} from "@/components/mobile-model-page-view";
|
||||
import { SettingsCard } from "@/components/settings";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { LoadingSpinner } from "@/components/ui/loading-spinner";
|
||||
import { PressHighlight } from "@/components/ui/press-highlight";
|
||||
import {
|
||||
FlatList as SheetFlatList,
|
||||
ScrollView as SheetScrollView,
|
||||
} from "@/components/ui/scroll-view";
|
||||
import { useInitialFlatListScroll } from "@/components/ui/scroll-reveal";
|
||||
import { SearchField } from "@/components/ui/search-field";
|
||||
import { isNative, isWeb } from "@/constants/platform";
|
||||
import { useRevealActiveFlatListRow } from "@/components/ui/scroll-reveal";
|
||||
import { isNative } from "@/constants/platform";
|
||||
import type { ProviderSelectorProvider } from "@/provider-selection/provider-selection";
|
||||
import { ICON_SIZE, type Theme } from "@/styles/theme";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
import { inlineUnistylesStyle } from "@/styles/unistyles-inline-style";
|
||||
|
||||
/**
|
||||
* The open accordion section lists its rows in a box capped at about five rows that scrolls on its
|
||||
* own. Opening another section, unfolding older models, or loading never moves the sections below
|
||||
* it, so they stay where the thumb left them.
|
||||
* The open accordion section lists its rows in a box of one fixed height, about five rows, that
|
||||
* scrolls on its own. Opening another section, unfolding older models or loading never moves the
|
||||
* sections below it, so they stay where the thumb left them.
|
||||
*/
|
||||
export const MOBILE_EXPANDED_PROVIDER_HEIGHT = 220;
|
||||
|
||||
/** Theme-free: the sheet scrollers drop a themed contentContainerStyle on web (docs/unistyles.md). */
|
||||
const LIST_CONTENT = { paddingBottom: 4 };
|
||||
const SHEET_LIST_CARD_LIST = { flexGrow: 0, flexShrink: 1, minHeight: 0 };
|
||||
const SECTION_HEADER_HEIGHT = 44;
|
||||
const EXPANDED_A11Y_STATE = { expanded: true };
|
||||
|
||||
const ThemedAlertTriangle = withUnistyles(AlertTriangle);
|
||||
const ThemedChevronDown = withUnistyles(ChevronDown);
|
||||
const ThemedChevronUp = withUnistyles(ChevronUp);
|
||||
const ThemedLayers = withUnistyles(Layers);
|
||||
const ThemedLoadingSpinner = withUnistyles(LoadingSpinner);
|
||||
const foregroundMapping = (theme: Theme) => ({ color: theme.colors.foreground });
|
||||
const foregroundMutedMapping = (theme: Theme) => ({ color: theme.colors.foregroundMuted });
|
||||
// React Native Web blurs the focused input on every scroll in "on-drag" mode.
|
||||
const KEYBOARD_DISMISS_MODE = isNative ? "on-drag" : "none";
|
||||
@@ -86,7 +86,6 @@ export function useMobileModelPage(input: {
|
||||
providers: readonly ProviderSelectorProvider[];
|
||||
profiles?: readonly AgentProfilePickerRow[] | null;
|
||||
canCreateProfile?: boolean;
|
||||
showProfilesSection?: boolean;
|
||||
selectedProvider: string;
|
||||
selectedModel: string;
|
||||
}): MobileModelPage {
|
||||
@@ -94,20 +93,12 @@ export function useMobileModelPage(input: {
|
||||
providers,
|
||||
profiles = null,
|
||||
canCreateProfile = false,
|
||||
showProfilesSection = true,
|
||||
selectedProvider,
|
||||
selectedModel,
|
||||
} = input;
|
||||
const pageInput = useMemo<MobileModelPageInput<AgentProfilePickerRow>>(
|
||||
() => ({
|
||||
providers,
|
||||
profiles,
|
||||
canCreateProfile,
|
||||
showProfilesSection,
|
||||
selectedProvider,
|
||||
selectedModel,
|
||||
}),
|
||||
[canCreateProfile, profiles, providers, selectedModel, selectedProvider, showProfilesSection],
|
||||
() => ({ providers, profiles, canCreateProfile, selectedProvider, selectedModel }),
|
||||
[canCreateProfile, profiles, providers, selectedModel, selectedProvider],
|
||||
);
|
||||
const inputRef = useRef(pageInput);
|
||||
inputRef.current = pageInput;
|
||||
@@ -159,7 +150,6 @@ export function SheetSearchDock({
|
||||
placeholder={placeholder}
|
||||
clearAccessibilityLabel={t("providerCatalog.clearSearch")}
|
||||
fullWidth
|
||||
variant="card"
|
||||
testID={testID}
|
||||
clearTestID={testID ? `${testID}-clear` : undefined}
|
||||
/>
|
||||
@@ -265,21 +255,6 @@ export function MobileModelPageView({
|
||||
),
|
||||
[renderItem],
|
||||
);
|
||||
const singleProviderSection =
|
||||
projection.kind === "browse" && !projection.showSectionHeaders
|
||||
? projection.sections[0]
|
||||
: undefined;
|
||||
const singleProviderHeader = useMemo(
|
||||
() =>
|
||||
singleProviderSection?.kind === "provider" ? (
|
||||
<ProviderSectionHeader
|
||||
section={singleProviderSection}
|
||||
serverId={serverId}
|
||||
collapsible={false}
|
||||
/>
|
||||
) : undefined,
|
||||
[serverId, singleProviderSection],
|
||||
);
|
||||
|
||||
if (projection.kind === "noProviders") {
|
||||
return (
|
||||
@@ -313,8 +288,12 @@ export function MobileModelPageView({
|
||||
);
|
||||
}
|
||||
if (!projection.showSectionHeaders) {
|
||||
const section = projection.sections[0];
|
||||
return (
|
||||
<SheetListCard header={singleProviderHeader} testID="mobile-model-page">
|
||||
<View style={styles.page} testID="mobile-model-page">
|
||||
{section?.kind === "provider" ? (
|
||||
<ExpandedProviderHeader section={section} serverId={serverId} />
|
||||
) : null}
|
||||
{projection.body ? (
|
||||
<SectionBody
|
||||
body={projection.body}
|
||||
@@ -325,7 +304,7 @@ export function MobileModelPageView({
|
||||
isRetryingProvider={actions.isRetryingProvider}
|
||||
/>
|
||||
) : null}
|
||||
</SheetListCard>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
return (
|
||||
@@ -342,8 +321,8 @@ export function MobileModelPageView({
|
||||
<AccordionSectionCard
|
||||
key={section.key}
|
||||
section={section}
|
||||
body={section.expanded ? projection.body : null}
|
||||
selectedIndex={section.expanded ? projection.selectedIndex : null}
|
||||
body={projection.body}
|
||||
selectedIndex={projection.selectedIndex}
|
||||
serverId={serverId}
|
||||
actions={actions}
|
||||
renderItem={renderItem}
|
||||
@@ -355,92 +334,6 @@ export function MobileModelPageView({
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The collapsible Profiles card extracted onto Agent settings Home, using the same header and
|
||||
* scrollable list as the Model accordion.
|
||||
*/
|
||||
export function CollapsibleProfilesCard({
|
||||
profiles,
|
||||
expanded,
|
||||
onToggle,
|
||||
serverId,
|
||||
onApplyProfile,
|
||||
onEditProfiles,
|
||||
}: {
|
||||
profiles: readonly AgentProfilePickerRow[];
|
||||
expanded: boolean;
|
||||
onToggle: () => void;
|
||||
serverId: string | null;
|
||||
onApplyProfile?: (profileId: string) => void;
|
||||
onEditProfiles?: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const items = useMemo(
|
||||
() => buildMobileProfileListItems(profiles, Boolean(onEditProfiles)),
|
||||
[onEditProfiles, profiles],
|
||||
);
|
||||
const actions = useMemo<ModelPickerActions>(
|
||||
() => ({
|
||||
onSelect: noop,
|
||||
onApplyProfile,
|
||||
onEditProfiles,
|
||||
isRetryingProvider: false,
|
||||
}),
|
||||
[onApplyProfile, onEditProfiles],
|
||||
);
|
||||
const emptyLookup = useMemo(() => new Map<string, AgentProfilePickerRow[]>(), []);
|
||||
const renderItem = useCallback(
|
||||
({ item }: { item: ModelPickerListItem<AgentProfilePickerRow> }) => (
|
||||
<ModelPickerItemRow
|
||||
item={item}
|
||||
active={false}
|
||||
selected={false}
|
||||
inSearch={false}
|
||||
serverId={serverId}
|
||||
profiledLookup={emptyLookup}
|
||||
onToggleFold={noop}
|
||||
onActivate={noop}
|
||||
actions={actions}
|
||||
/>
|
||||
),
|
||||
[actions, emptyLookup, serverId],
|
||||
);
|
||||
const leading = useMemo(
|
||||
() => <ThemedLayers size={ICON_SIZE.sm} uniProps={foregroundMutedMapping} />,
|
||||
[],
|
||||
);
|
||||
const trailingAction = useMemo(
|
||||
() => (expanded && onEditProfiles ? <EditProfilesButton onPress={onEditProfiles} /> : null),
|
||||
[expanded, onEditProfiles],
|
||||
);
|
||||
const viewportHeight = computeBoundedListHeight(items.length);
|
||||
|
||||
return (
|
||||
<SettingsCard testID="agent-controls-profiles-card">
|
||||
<CollapsibleSectionHeader
|
||||
leading={leading}
|
||||
title={t("modelSelector.profiles")}
|
||||
expanded={expanded}
|
||||
trailing={trailingAction}
|
||||
onToggle={onToggle}
|
||||
testID="agent-controls-profiles"
|
||||
/>
|
||||
{expanded && items.length > 0 ? (
|
||||
<IndependentScrollBoundary>
|
||||
<SectionItemList
|
||||
items={items}
|
||||
selectedIndex={null}
|
||||
renderItem={renderItem}
|
||||
fill={false}
|
||||
viewportHeight={viewportHeight}
|
||||
testID="agent-controls-profiles-list"
|
||||
/>
|
||||
</IndependentScrollBoundary>
|
||||
) : null}
|
||||
</SettingsCard>
|
||||
);
|
||||
}
|
||||
|
||||
function AccordionSectionCard({
|
||||
section,
|
||||
body,
|
||||
@@ -458,27 +351,29 @@ function AccordionSectionCard({
|
||||
renderItem: ModelItemRenderer;
|
||||
onToggle: (action: MobileModelPageAction) => void;
|
||||
}) {
|
||||
const handleToggle = useCallback(
|
||||
() => onToggle({ kind: "toggleSection", key: section.key }),
|
||||
[onToggle, section.key],
|
||||
);
|
||||
if (!section.expanded) {
|
||||
return (
|
||||
<SettingsCard>
|
||||
{section.kind === "profiles" ? (
|
||||
<CollapsedProfilesRow section={section} onToggle={onToggle} />
|
||||
) : (
|
||||
<CollapsedProviderRow section={section} serverId={serverId} onToggle={onToggle} />
|
||||
)}
|
||||
</SettingsCard>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<SettingsCard>
|
||||
{section.kind === "profiles" ? (
|
||||
<ProfilesSectionHeader
|
||||
expanded={section.expanded}
|
||||
<ExpandedProfilesHeader
|
||||
section={section}
|
||||
onEditProfiles={actions.onEditProfiles}
|
||||
onToggle={handleToggle}
|
||||
onToggle={onToggle}
|
||||
/>
|
||||
) : (
|
||||
<ProviderSectionHeader
|
||||
section={section}
|
||||
serverId={serverId}
|
||||
collapsible
|
||||
onToggle={handleToggle}
|
||||
/>
|
||||
<ExpandedProviderHeader section={section} serverId={serverId} onToggle={onToggle} />
|
||||
)}
|
||||
{section.expanded && body ? (
|
||||
{body ? (
|
||||
<SectionBody
|
||||
body={body}
|
||||
selectedIndex={selectedIndex}
|
||||
@@ -494,25 +389,12 @@ function AccordionSectionCard({
|
||||
|
||||
/**
|
||||
* An inset card holding one sheet list, on the same rail as the browse sections' cards. It grows
|
||||
* with the list, then the list scrolls inside it while its optional header stays fixed.
|
||||
* with the list, then the list scrolls inside it.
|
||||
*/
|
||||
function SheetListCard({
|
||||
header,
|
||||
children,
|
||||
testID,
|
||||
}: {
|
||||
header?: ReactNode;
|
||||
children: ReactNode;
|
||||
testID?: string;
|
||||
}) {
|
||||
function SheetListCard({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<View style={styles.listCardPage} testID={testID}>
|
||||
<View style={[settingsStyles.card, styles.listCard]}>
|
||||
{header ? <View style={styles.listCardHeader}>{header}</View> : null}
|
||||
<View style={[header ? settingsStyles.rowBorder : undefined, styles.listCardBody]}>
|
||||
{children}
|
||||
</View>
|
||||
</View>
|
||||
<View style={styles.listCardPage}>
|
||||
<SettingsCard shrink>{children}</SettingsCard>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -527,166 +409,269 @@ function getSearchEntryKey(entry: SearchEntry): string {
|
||||
return entry.key;
|
||||
}
|
||||
|
||||
function computeBoundedListHeight(itemCount: number): number {
|
||||
return Math.min(
|
||||
Math.max(itemCount, 1) * MODEL_PICKER_ROW_HEIGHT + LIST_CONTENT.paddingBottom,
|
||||
MOBILE_EXPANDED_PROVIDER_HEIGHT,
|
||||
);
|
||||
function useSectionSummary(section: MobileProviderSection): string {
|
||||
const { t } = useTranslation();
|
||||
if (section.folds) {
|
||||
return t("modelSelector.shownOfTotal", { shown: section.shown, total: section.total });
|
||||
}
|
||||
return String(section.total);
|
||||
}
|
||||
|
||||
/**
|
||||
* One header component shared across collapsed and expanded states so toggling never shifts the
|
||||
* icon, label, or chevron.
|
||||
*/
|
||||
function CollapsibleSectionHeader({
|
||||
function ExpandedSectionHeader({
|
||||
leading,
|
||||
title,
|
||||
expanded,
|
||||
summary,
|
||||
trailing,
|
||||
onToggle,
|
||||
onCollapse,
|
||||
testID,
|
||||
}: {
|
||||
leading: ReactNode;
|
||||
title: string;
|
||||
expanded: boolean;
|
||||
summary: string | null;
|
||||
trailing?: ReactNode;
|
||||
onToggle?: () => void;
|
||||
onCollapse?: () => void;
|
||||
testID: string;
|
||||
}) {
|
||||
const accessibilityState = useMemo(() => ({ expanded }), [expanded]);
|
||||
const webExpandedProps = useMemo(
|
||||
() => (isWeb ? ({ "aria-expanded": expanded } as const) : null),
|
||||
[expanded],
|
||||
const titleContent = (
|
||||
<>
|
||||
<View style={styles.glyph}>{leading}</View>
|
||||
<Text style={styles.expandedTitle} numberOfLines={1}>
|
||||
{title}
|
||||
{summary !== null ? <Text style={styles.summary}>{` · ${summary}`}</Text> : null}
|
||||
</Text>
|
||||
</>
|
||||
);
|
||||
if (!onCollapse) {
|
||||
return (
|
||||
<View style={styles.expandedHeader} testID={testID}>
|
||||
<View style={styles.expandedTrigger}>{titleContent}</View>
|
||||
{trailing}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<View style={styles.sectionHeader}>
|
||||
{onToggle ? (
|
||||
<View style={styles.expandedHeader}>
|
||||
<PressHighlight
|
||||
onPress={onCollapse}
|
||||
accessibilityRole="button"
|
||||
accessibilityState={EXPANDED_A11Y_STATE}
|
||||
style={styles.expandedTrigger}
|
||||
testID={testID}
|
||||
>
|
||||
{titleContent}
|
||||
</PressHighlight>
|
||||
<View style={styles.expandedTrailing}>
|
||||
{trailing}
|
||||
<PressHighlight
|
||||
{...webExpandedProps}
|
||||
onPress={onToggle}
|
||||
onPress={onCollapse}
|
||||
hitSlop={8}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={title}
|
||||
accessibilityState={accessibilityState}
|
||||
style={styles.sectionHeaderPress}
|
||||
highlightStyle={styles.sectionHeaderPressed}
|
||||
testID={testID}
|
||||
/>
|
||||
) : null}
|
||||
<View style={[styles.glyph, styles.passThrough]}>{leading}</View>
|
||||
<View style={[styles.sectionTitleWrap, styles.passThrough]}>
|
||||
<Text style={styles.sectionTitle} numberOfLines={1} testID={onToggle ? undefined : testID}>
|
||||
{title}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={[styles.sectionTrailing, styles.boxNone]}>
|
||||
{trailing}
|
||||
{onToggle ? (
|
||||
<View
|
||||
style={[styles.chevronSlot, expanded && styles.chevronExpanded, styles.passThrough]}
|
||||
>
|
||||
<ThemedChevronDown size={ICON_SIZE.sm} uniProps={foregroundMutedMapping} />
|
||||
</View>
|
||||
) : null}
|
||||
accessibilityState={EXPANDED_A11Y_STATE}
|
||||
style={styles.collapseChevron}
|
||||
>
|
||||
<ThemedChevronUp size={ICON_SIZE.sm} uniProps={foregroundMutedMapping} />
|
||||
</PressHighlight>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
function ProfilesSectionHeader({
|
||||
expanded,
|
||||
function ExpandedProfilesHeader({
|
||||
section,
|
||||
onEditProfiles,
|
||||
onToggle,
|
||||
}: {
|
||||
expanded: boolean;
|
||||
section: MobileProfilesSection;
|
||||
onEditProfiles?: () => void;
|
||||
onToggle: () => void;
|
||||
onToggle: (action: MobileModelPageAction) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const handleCollapse = useCallback(
|
||||
() => onToggle({ kind: "toggleSection", key: section.key }),
|
||||
[onToggle, section.key],
|
||||
);
|
||||
const leading = useMemo(
|
||||
() => <ThemedLayers size={ICON_SIZE.sm} uniProps={foregroundMutedMapping} />,
|
||||
() => <ThemedLayers size={ICON_SIZE.sm} uniProps={foregroundMapping} />,
|
||||
[],
|
||||
);
|
||||
const trailing = useMemo(
|
||||
() => (expanded && onEditProfiles ? <EditProfilesButton onPress={onEditProfiles} /> : null),
|
||||
[expanded, onEditProfiles],
|
||||
() =>
|
||||
onEditProfiles ? (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
leftIcon={Pencil}
|
||||
onPress={onEditProfiles}
|
||||
accessibilityLabel={t("modelSelector.editProfilesLabel")}
|
||||
testID="model-profiles-edit"
|
||||
/>
|
||||
) : null,
|
||||
[onEditProfiles, t],
|
||||
);
|
||||
return (
|
||||
<CollapsibleSectionHeader
|
||||
<ExpandedSectionHeader
|
||||
leading={leading}
|
||||
title={t("modelSelector.profiles")}
|
||||
expanded={expanded}
|
||||
summary={String(section.count)}
|
||||
trailing={trailing}
|
||||
onToggle={onToggle}
|
||||
testID={expanded ? "model-profiles-section" : "model-picker-rail-profiles"}
|
||||
onCollapse={handleCollapse}
|
||||
testID="model-profiles-section"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function ProviderSectionHeader({
|
||||
function CollapsedProfilesRow({
|
||||
section,
|
||||
onToggle,
|
||||
}: {
|
||||
section: MobileProfilesSection;
|
||||
onToggle: (action: MobileModelPageAction) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const handlePress = useCallback(
|
||||
() => onToggle({ kind: "toggleSection", key: section.key }),
|
||||
[onToggle, section.key],
|
||||
);
|
||||
const leadingSlot = useMemo(
|
||||
() => <ThemedLayers size={ICON_SIZE.sm} uniProps={foregroundMutedMapping} />,
|
||||
[],
|
||||
);
|
||||
const trailingSlot = useMemo(
|
||||
() => (
|
||||
<View style={styles.collapsedTrailing}>
|
||||
<Text style={styles.summary}>{section.count}</Text>
|
||||
<ThemedChevronDown size={ICON_SIZE.sm} uniProps={foregroundMutedMapping} />
|
||||
</View>
|
||||
),
|
||||
[section.count],
|
||||
);
|
||||
return (
|
||||
<ModelBrowserRow
|
||||
label={t("modelSelector.profiles")}
|
||||
leadingSlot={leadingSlot}
|
||||
trailingSlot={trailingSlot}
|
||||
spacing="provider"
|
||||
onPress={handlePress}
|
||||
testID="model-picker-rail-profiles"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function ExpandedProviderHeader({
|
||||
section,
|
||||
serverId,
|
||||
collapsible,
|
||||
onToggle,
|
||||
}: {
|
||||
section: MobileProviderSection;
|
||||
serverId: string | null;
|
||||
collapsible: boolean;
|
||||
onToggle?: () => void;
|
||||
onToggle?: (action: MobileModelPageAction) => void;
|
||||
}) {
|
||||
const summary = useSectionSummary(section);
|
||||
const handleCollapse = useCallback(
|
||||
() => onToggle?.({ kind: "toggleSection", key: section.key }),
|
||||
[onToggle, section.key],
|
||||
);
|
||||
const leading = useMemo(
|
||||
() => (
|
||||
<ModelProviderGlyph provider={section.providerId} serverId={serverId} size={ICON_SIZE.sm} />
|
||||
<ModelProviderGlyph
|
||||
provider={section.providerId}
|
||||
serverId={serverId}
|
||||
size={ICON_SIZE.sm}
|
||||
tone="foreground"
|
||||
/>
|
||||
),
|
||||
[section.providerId, serverId],
|
||||
);
|
||||
const trailing = useMemo(() => {
|
||||
if (section.expanded) {
|
||||
return serverId ? (
|
||||
const trailing = useMemo(
|
||||
() =>
|
||||
serverId ? (
|
||||
<CustomizeProviderButton
|
||||
serverId={serverId}
|
||||
providerId={section.providerId}
|
||||
providerLabel={section.label}
|
||||
/>
|
||||
) : null;
|
||||
}
|
||||
if (section.status === "loading") {
|
||||
return (
|
||||
<View style={[styles.spinner, styles.passThrough]}>
|
||||
<ThemedLoadingSpinner size="small" uniProps={foregroundMutedMapping} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
if (section.status === "error") {
|
||||
return (
|
||||
<View style={styles.passThrough}>
|
||||
<ThemedAlertTriangle size={ICON_SIZE.sm} uniProps={foregroundMutedMapping} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}, [section.expanded, section.label, section.providerId, section.status, serverId]);
|
||||
|
||||
) : null,
|
||||
[section.label, section.providerId, serverId],
|
||||
);
|
||||
return (
|
||||
<CollapsibleSectionHeader
|
||||
<ExpandedSectionHeader
|
||||
leading={leading}
|
||||
title={section.label}
|
||||
expanded={section.expanded}
|
||||
summary={section.status === "ready" ? summary : null}
|
||||
trailing={trailing}
|
||||
onToggle={collapsible ? onToggle : undefined}
|
||||
testID={
|
||||
section.expanded
|
||||
? `model-provider-section-${section.providerId}`
|
||||
: `model-provider-${section.providerId}`
|
||||
}
|
||||
onCollapse={onToggle ? handleCollapse : undefined}
|
||||
testID={`model-provider-section-${section.providerId}`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function CollapsedProviderRow({
|
||||
section,
|
||||
serverId,
|
||||
onToggle,
|
||||
}: {
|
||||
section: MobileProviderSection;
|
||||
serverId: string | null;
|
||||
onToggle: (action: MobileModelPageAction) => void;
|
||||
}) {
|
||||
const summary = useSectionSummary(section);
|
||||
const handlePress = useCallback(
|
||||
() => onToggle({ kind: "toggleSection", key: section.key }),
|
||||
[onToggle, section.key],
|
||||
);
|
||||
const leadingSlot = useMemo(
|
||||
() => (
|
||||
<ModelProviderGlyph provider={section.providerId} serverId={serverId} size={ICON_SIZE.sm} />
|
||||
),
|
||||
[section.providerId, serverId],
|
||||
);
|
||||
const trailingSlot = useMemo(
|
||||
() => (
|
||||
<View style={styles.collapsedTrailing}>
|
||||
<CollapsedStatus section={section} summary={summary} />
|
||||
<ThemedChevronDown size={ICON_SIZE.sm} uniProps={foregroundMutedMapping} />
|
||||
</View>
|
||||
),
|
||||
[section, summary],
|
||||
);
|
||||
return (
|
||||
<ModelBrowserRow
|
||||
label={section.label}
|
||||
leadingSlot={leadingSlot}
|
||||
trailingSlot={trailingSlot}
|
||||
spacing="provider"
|
||||
onPress={handlePress}
|
||||
testID={`model-provider-${section.providerId}`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function CollapsedStatus({
|
||||
section,
|
||||
summary,
|
||||
}: {
|
||||
section: MobileProviderSection;
|
||||
summary: string;
|
||||
}) {
|
||||
if (section.status === "loading") {
|
||||
return (
|
||||
<View style={styles.spinner}>
|
||||
<ThemedLoadingSpinner size="small" uniProps={foregroundMutedMapping} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
if (section.status === "error") {
|
||||
return <ThemedAlertTriangle size={ICON_SIZE.sm} uniProps={foregroundMutedMapping} />;
|
||||
}
|
||||
return <Text style={styles.summary}>{summary}</Text>;
|
||||
}
|
||||
|
||||
type ModelItemRenderer = ({
|
||||
item,
|
||||
}: {
|
||||
item: ModelPickerListItem<AgentProfilePickerRow>;
|
||||
}) => ReactElement;
|
||||
}) => React.ReactElement;
|
||||
|
||||
function SectionBody({
|
||||
body,
|
||||
@@ -704,7 +689,7 @@ function SectionBody({
|
||||
onRetryProvider: ModelPickerActions["onRetryProvider"];
|
||||
isRetryingProvider: boolean;
|
||||
}) {
|
||||
const frameStyle = fill ? styles.fillState : styles.fixedViewport;
|
||||
const frameStyle = fill ? styles.page : styles.fixedViewport;
|
||||
if (body.kind === "providerLoading") {
|
||||
return (
|
||||
<View style={[frameStyle, styles.centered]}>
|
||||
@@ -725,91 +710,58 @@ function SectionBody({
|
||||
);
|
||||
}
|
||||
const listKey = body.kind === "profiles" ? "profiles" : body.providerId;
|
||||
const viewportHeight =
|
||||
body.kind === "profiles"
|
||||
? computeBoundedListHeight(body.items.length)
|
||||
: MOBILE_EXPANDED_PROVIDER_HEIGHT;
|
||||
const list = (
|
||||
<SectionItemList
|
||||
// Each section is a new list, which opens directly at its top or at the selected model.
|
||||
// Each section is a new list, which opens at its top or at the selected model.
|
||||
key={listKey}
|
||||
items={body.items}
|
||||
selectedIndex={selectedIndex}
|
||||
renderItem={renderItem}
|
||||
fill={fill}
|
||||
viewportHeight={viewportHeight}
|
||||
/>
|
||||
);
|
||||
// The lone provider's list is the page's only scroller; a fixed box scrolls inside the page's.
|
||||
return fill ? list : <IndependentScrollBoundary>{list}</IndependentScrollBoundary>;
|
||||
}
|
||||
|
||||
function getModelItemLayout(
|
||||
_data: ArrayLike<ModelPickerListItem<AgentProfilePickerRow>> | null | undefined,
|
||||
index: number,
|
||||
) {
|
||||
return {
|
||||
length: MODEL_PICKER_ROW_HEIGHT,
|
||||
offset: index * MODEL_PICKER_ROW_HEIGHT,
|
||||
index,
|
||||
};
|
||||
}
|
||||
|
||||
function modelItemOffset(index: number): number {
|
||||
return index * MODEL_PICKER_ROW_HEIGHT;
|
||||
}
|
||||
|
||||
/** Opens with the selected model already in view via `getItemLayout` + `initialScrollIndex`. */
|
||||
/** Opens with the selected model in view, such as an older model behind the opened fold. */
|
||||
function SectionItemList({
|
||||
items,
|
||||
selectedIndex,
|
||||
renderItem,
|
||||
fill,
|
||||
viewportHeight,
|
||||
testID = "compact-model-list",
|
||||
}: {
|
||||
items: ModelPickerListItem<AgentProfilePickerRow>[];
|
||||
selectedIndex: number | null;
|
||||
renderItem: ModelItemRenderer;
|
||||
fill: boolean;
|
||||
viewportHeight: number;
|
||||
testID?: string;
|
||||
}) {
|
||||
const listRef = useRef<FlatList<ModelPickerListItem<AgentProfilePickerRow>>>(null);
|
||||
const { initialScrollIndex, contentOffset } = useInitialFlatListScroll({
|
||||
// Waits for the first visible rows, so a selection already in view never scrolls the list.
|
||||
const reveal = useRevealActiveFlatListRow({
|
||||
listRef,
|
||||
selectedIndex,
|
||||
itemCount: items.length,
|
||||
visibleCount: Math.max(1, Math.floor(viewportHeight / MODEL_PICKER_ROW_HEIGHT)),
|
||||
offsetForIndex: modelItemOffset,
|
||||
activeIndex: selectedIndex,
|
||||
waitForViewable: true,
|
||||
});
|
||||
|
||||
const boxStyle = useMemo(() => {
|
||||
if (fill) return SHEET_LIST_CARD_LIST;
|
||||
if (viewportHeight === MOBILE_EXPANDED_PROVIDER_HEIGHT) return styles.fixedViewport;
|
||||
return [styles.boundedViewport, inlineUnistylesStyle({ height: viewportHeight })];
|
||||
}, [fill, viewportHeight]);
|
||||
|
||||
// A lone provider's list is the sheet's own scroller, so it must integrate with the bottom sheet
|
||||
// gesture handler (SheetFlatList); an accordion list scrolls independently inside SheetScrollView.
|
||||
const ListComponent = fill ? SheetFlatList : FlatList;
|
||||
|
||||
return (
|
||||
<ListComponent
|
||||
<FlatList
|
||||
ref={listRef}
|
||||
data={items}
|
||||
renderItem={renderItem}
|
||||
keyExtractor={getItemKey}
|
||||
getItemLayout={getModelItemLayout}
|
||||
initialScrollIndex={initialScrollIndex}
|
||||
contentOffset={contentOffset}
|
||||
style={boxStyle}
|
||||
style={fill ? styles.page : styles.fixedViewport}
|
||||
contentContainerStyle={LIST_CONTENT}
|
||||
keyboardShouldPersistTaps="handled"
|
||||
keyboardDismissMode={KEYBOARD_DISMISS_MODE}
|
||||
showsVerticalScrollIndicator
|
||||
nestedScrollEnabled={!fill}
|
||||
testID={testID}
|
||||
nestedScrollEnabled
|
||||
onScrollToIndexFailed={reveal.onScrollToIndexFailed}
|
||||
onViewableItemsChanged={reveal.onViewableItemsChanged}
|
||||
viewabilityConfig={reveal.viewabilityConfig}
|
||||
onContentSizeChange={reveal.onContentSizeChange}
|
||||
onLayout={reveal.onLayout}
|
||||
testID="compact-model-list"
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -826,77 +778,62 @@ const styles = StyleSheet.create((theme) => ({
|
||||
paddingTop: theme.spacing[2],
|
||||
paddingBottom: theme.spacing[2],
|
||||
},
|
||||
listCard: {
|
||||
flexShrink: 1,
|
||||
minHeight: 0,
|
||||
},
|
||||
listCardHeader: {
|
||||
flexShrink: 0,
|
||||
},
|
||||
listCardBody: {
|
||||
flexShrink: 1,
|
||||
minHeight: 0,
|
||||
},
|
||||
fillState: {
|
||||
minHeight: MOBILE_EXPANDED_PROVIDER_HEIGHT,
|
||||
},
|
||||
sections: {
|
||||
paddingHorizontal: theme.spacing[4],
|
||||
paddingTop: theme.spacing[2],
|
||||
paddingBottom: theme.spacing[4],
|
||||
gap: theme.spacing[2],
|
||||
},
|
||||
sectionHeader: {
|
||||
height: SECTION_HEADER_HEIGHT,
|
||||
position: "relative",
|
||||
expandedHeader: {
|
||||
minHeight: 44,
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
// The model rows' leading rail (ModelBrowserRow), so the section glyph sits above theirs.
|
||||
paddingLeft: isNative ? theme.spacing[6] : theme.spacing[3],
|
||||
paddingRight: isNative ? theme.spacing[6] : theme.spacing[3],
|
||||
},
|
||||
expandedTrigger: {
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
minHeight: 44,
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[2],
|
||||
// Matches ModelBrowserRow's leading/trailing rail so icons and chevrons line up cleanly.
|
||||
paddingHorizontal: { xs: theme.spacing[4], md: theme.spacing[3] },
|
||||
},
|
||||
sectionHeaderPress: {
|
||||
...StyleSheet.absoluteFill,
|
||||
expandedTrailing: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[1],
|
||||
},
|
||||
sectionHeaderPressed: {
|
||||
backgroundColor: theme.colors.surface2,
|
||||
},
|
||||
passThrough: {
|
||||
pointerEvents: "none",
|
||||
},
|
||||
boxNone: {
|
||||
pointerEvents: "box-none",
|
||||
collapseChevron: {
|
||||
minWidth: 24,
|
||||
minHeight: 44,
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
},
|
||||
glyph: {
|
||||
width: 16,
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
},
|
||||
sectionTitleWrap: {
|
||||
expandedTitle: {
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
},
|
||||
sectionTitle: {
|
||||
fontSize: theme.fontSize.base,
|
||||
fontWeight: theme.fontWeight.normal,
|
||||
fontWeight: theme.fontWeight.medium,
|
||||
color: theme.colors.foreground,
|
||||
},
|
||||
sectionTrailing: {
|
||||
summary: {
|
||||
fontSize: theme.fontSize.sm,
|
||||
fontWeight: theme.fontWeight.normal,
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontVariant: ["tabular-nums"],
|
||||
},
|
||||
collapsedTrailing: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[2],
|
||||
},
|
||||
// Optical: matches SettingsRowHeader's chevron overhang so the glyph sits on the trailing rail.
|
||||
chevronSlot: {
|
||||
width: ICON_SIZE.sm,
|
||||
height: ICON_SIZE.sm,
|
||||
marginRight: -theme.spacing[1],
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
},
|
||||
chevronExpanded: {
|
||||
transform: [{ rotate: "180deg" }],
|
||||
},
|
||||
spinner: {
|
||||
transform: [{ scale: 0.7 }],
|
||||
},
|
||||
@@ -904,9 +841,6 @@ const styles = StyleSheet.create((theme) => ({
|
||||
height: MOBILE_EXPANDED_PROVIDER_HEIGHT,
|
||||
flexGrow: 0,
|
||||
},
|
||||
boundedViewport: {
|
||||
flexGrow: 0,
|
||||
},
|
||||
centered: {
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
@@ -915,14 +849,4 @@ const styles = StyleSheet.create((theme) => ({
|
||||
flex: 1,
|
||||
flexDirection: "row",
|
||||
},
|
||||
searchFooter: {
|
||||
// Matches the card inset (`styles.sections` / `styles.listCardPage`) so the search box shares
|
||||
// its outer left and right rails with the provider cards above it.
|
||||
paddingHorizontal: theme.spacing[4],
|
||||
},
|
||||
}));
|
||||
|
||||
/** Read at render time rather than module scope (docs/unistyles.md). */
|
||||
export function getSheetSearchFooterStyle() {
|
||||
return styles.searchFooter;
|
||||
}
|
||||
|
||||
@@ -152,84 +152,20 @@ describe("model picker layout", () => {
|
||||
expect(resolveModelPickerLayout(input({ profiles: null }))).toBe("twoPane");
|
||||
});
|
||||
|
||||
it("uses a single pane for one provider even when the surface offers profiles", () => {
|
||||
expect(resolveModelPickerLayout(input({ providers: [claude] }))).toBe("singlePane");
|
||||
expect(resolveModelPickerLayout(input({ providers: [claude], profiles: [] }))).toBe(
|
||||
"singlePane",
|
||||
);
|
||||
it("uses two panes for one provider with profiles", () => {
|
||||
expect(resolveModelPickerLayout(input({ providers: [claude] }))).toBe("twoPane");
|
||||
});
|
||||
|
||||
it("keeps two panes for one provider on a surface that offers profiles but has none", () => {
|
||||
expect(resolveModelPickerLayout(input({ providers: [claude], profiles: [] }))).toBe("twoPane");
|
||||
});
|
||||
|
||||
it("drops the rail for one provider on a surface without profiles", () => {
|
||||
expect(resolveModelPickerLayout(input({ providers: [claude], profiles: null }))).toBe(
|
||||
"singlePane",
|
||||
);
|
||||
});
|
||||
|
||||
it("lists matching profiles above models in a single-pane provider view", () => {
|
||||
const { projection } = open(input({ providers: [claude], profiles: [profiles[1]] }));
|
||||
expect(projection.layout).toBe("singlePane");
|
||||
expect(projection.rail).toEqual([]);
|
||||
expect(projection.pane).toMatchObject({
|
||||
kind: "provider",
|
||||
providerId: "claude",
|
||||
label: "Claude",
|
||||
});
|
||||
if (projection.pane.kind !== "provider") return;
|
||||
expect(keys(projection.pane.profiles)).toEqual(["profile:quick"]);
|
||||
expect(keys(projection.pane.models)).toEqual([
|
||||
"model:claude:opus-5.5",
|
||||
"model:claude:fable-5.2",
|
||||
"model:claude:sonnet-5.5",
|
||||
"model:claude:haiku-5.5",
|
||||
"fold:claude",
|
||||
]);
|
||||
expect(projection.activeKey).toBe("model:claude:opus-5.5");
|
||||
});
|
||||
|
||||
it("keeps profiles usable in single-pane mode while the lone provider is loading or errored", () => {
|
||||
const loading = open(
|
||||
input({
|
||||
providers: [opencode],
|
||||
profiles: [profiles[0]],
|
||||
selectedProvider: "opencode",
|
||||
selectedModel: "",
|
||||
}),
|
||||
).projection;
|
||||
expect(loading.layout).toBe("singlePane");
|
||||
expect(loading.pane).toMatchObject({ kind: "providerLoading", providerId: "opencode" });
|
||||
expect(keys(loading.pane.items)).toEqual(["profile:deep-review"]);
|
||||
expect(loading.activeKey).toBe("profile:deep-review");
|
||||
|
||||
const errored = open(
|
||||
input({
|
||||
providers: [copilot],
|
||||
profiles: [profiles[0]],
|
||||
selectedProvider: "copilot",
|
||||
selectedModel: "",
|
||||
}),
|
||||
).projection;
|
||||
expect(errored.layout).toBe("singlePane");
|
||||
expect(errored.pane).toMatchObject({ kind: "providerError", providerId: "copilot" });
|
||||
expect(keys(errored.pane.items)).toEqual(["profile:deep-review"]);
|
||||
expect(errored.activeKey).toBe("profile:deep-review");
|
||||
});
|
||||
|
||||
it("includes Create profile at the end of a single-pane list when there are no profiles", () => {
|
||||
const { projection } = open(
|
||||
input({
|
||||
providers: [codex],
|
||||
profiles: [],
|
||||
selectedProvider: "codex",
|
||||
selectedModel: "gpt-5.4",
|
||||
}),
|
||||
);
|
||||
expect(projection.layout).toBe("singlePane");
|
||||
if (projection.pane.kind !== "provider") return;
|
||||
expect(projection.pane.profiles).toEqual([]);
|
||||
expect(keys(projection.pane.models)).toEqual([
|
||||
"model:codex:gpt-5.4",
|
||||
"model:codex:gpt-5.4-mini",
|
||||
"create-profile",
|
||||
]);
|
||||
});
|
||||
|
||||
it("keeps a fixed two-pane height whatever the content", () => {
|
||||
const tall = resolveModelPickerHeight(input());
|
||||
expect(resolveModelPickerHeight(input({ providers: [codex, pi] }))).toBe(tall);
|
||||
@@ -262,6 +198,12 @@ describe("model picker rail", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("counts profiles and the models each provider shows first", () => {
|
||||
const { projection } = open(input());
|
||||
const counts = Object.fromEntries(projection.rail.map((item) => [item.key, item.count]));
|
||||
expect(counts).toMatchObject({ profiles: 2, claude: 4, codex: 2, pi: 2 });
|
||||
});
|
||||
|
||||
it("omits the Profiles row when the surface shows no profiles", () => {
|
||||
const { projection } = open(input({ profiles: null }));
|
||||
expect(projection.rail.map((item) => item.key)).not.toContain(MODEL_PICKER_PROFILES_RAIL_KEY);
|
||||
@@ -302,6 +244,9 @@ describe("model picker provider pane", () => {
|
||||
kind: "provider",
|
||||
providerId: "claude",
|
||||
label: "Claude",
|
||||
shown: 4,
|
||||
total: 19,
|
||||
foldKind: "older",
|
||||
});
|
||||
expect(modelIds(projection)).toEqual(claudeCurrent);
|
||||
expect(projection.pane.items.at(-1)).toMatchObject({
|
||||
@@ -341,6 +286,7 @@ describe("model picker provider pane", () => {
|
||||
const state = reduceModelPicker(open(pickerInput).state, { kind: "selectRail", railKey: "pi" });
|
||||
const projection = projectModelPicker(pickerInput, state);
|
||||
expect(modelIds(projection)).toEqual(["anthropic/opus", "openai/gpt-5"]);
|
||||
expect(projection.pane).toMatchObject({ shown: 2, total: 4, foldKind: "all" });
|
||||
expect(projection.pane.items.at(-1)).toMatchObject({ kind: "fold", foldKind: "all", count: 2 });
|
||||
});
|
||||
|
||||
@@ -351,7 +297,7 @@ describe("model picker provider pane", () => {
|
||||
railKey: "codex",
|
||||
});
|
||||
const projection = projectModelPicker(pickerInput, state);
|
||||
expect(projection.pane).toMatchObject({ kind: "provider", providerId: "codex" });
|
||||
expect(projection.pane).toMatchObject({ kind: "provider", foldKind: null });
|
||||
expect(keys(projection.pane.items)).toEqual([
|
||||
"model:codex:gpt-5.4",
|
||||
"model:codex:gpt-5.4-mini",
|
||||
|
||||
@@ -65,13 +65,14 @@ export type ModelPickerAction =
|
||||
| { kind: "toggleFold"; providerId: string; expanded: boolean };
|
||||
|
||||
export type ModelPickerRailItem =
|
||||
| { kind: "profiles"; key: typeof MODEL_PICKER_PROFILES_RAIL_KEY }
|
||||
| { kind: "profiles"; key: typeof MODEL_PICKER_PROFILES_RAIL_KEY; count: number }
|
||||
| {
|
||||
kind: "provider";
|
||||
key: string;
|
||||
providerId: string;
|
||||
label: string;
|
||||
status: "ready" | "loading" | "error";
|
||||
count: number;
|
||||
/** The first errored provider after ready ones; the rail draws a divider above it. */
|
||||
startsErrorGroup: boolean;
|
||||
};
|
||||
@@ -100,29 +101,13 @@ export type ModelPickerPane<TProfile extends NavigableProfileRow = NavigableProf
|
||||
kind: "provider";
|
||||
providerId: string;
|
||||
label: string;
|
||||
/** Single-pane only: profiles listed above this provider's models. */
|
||||
profiles: ModelPickerListItem<TProfile>[];
|
||||
/** Provider models, optional fold row, and trailing create-profile row in single-pane mode. */
|
||||
models: ModelPickerListItem<TProfile>[];
|
||||
items: ModelPickerListItem<TProfile>[];
|
||||
}
|
||||
| {
|
||||
kind: "providerLoading";
|
||||
providerId: string;
|
||||
label: string;
|
||||
/** Single-pane only: profiles kept usable while the provider catalog loads. */
|
||||
profiles: ModelPickerListItem<TProfile>[];
|
||||
items: ModelPickerListItem<TProfile>[];
|
||||
}
|
||||
| {
|
||||
kind: "providerError";
|
||||
providerId: string;
|
||||
label: string;
|
||||
message: string;
|
||||
/** Single-pane only: profiles kept usable when the provider catalog fails. */
|
||||
profiles: ModelPickerListItem<TProfile>[];
|
||||
shown: number;
|
||||
total: number;
|
||||
foldKind: ModelFoldKind;
|
||||
items: ModelPickerListItem<TProfile>[];
|
||||
}
|
||||
| { kind: "providerLoading"; providerId: string; label: string; items: [] }
|
||||
| { kind: "providerError"; providerId: string; label: string; message: string; items: [] }
|
||||
| { kind: "profiles"; items: ModelPickerListItem<TProfile>[] }
|
||||
| {
|
||||
kind: "search";
|
||||
@@ -153,31 +138,22 @@ export function modelPickerFoldKey(providerId: string): string {
|
||||
return `fold:${providerId}`;
|
||||
}
|
||||
|
||||
/** Two panes only when there are several providers to switch between; a single provider keeps a
|
||||
* compact single-pane list (with any matching profiles in a section above its models). */
|
||||
/** Two panes whenever there is a rail to choose from: several providers, or a surface that offers
|
||||
* profiles (even none yet, so the rail keeps the create-profile entry). */
|
||||
export function resolveModelPickerLayout(input: ModelPickerInput): ModelPickerLayout {
|
||||
return input.providers.length > 1 ? "twoPane" : "singlePane";
|
||||
return input.providers.length > 1 || input.profiles !== null ? "twoPane" : "singlePane";
|
||||
}
|
||||
|
||||
/**
|
||||
* The popover keeps one height for its whole life, so switching providers, opening a fold, or
|
||||
* searching never moves it. A single pane sizes to all its rows, profiles and folded ones included.
|
||||
* searching never moves it. A single pane sizes to all its rows, folded ones included.
|
||||
*/
|
||||
export function resolveModelPickerHeight(input: ModelPickerInput): number {
|
||||
if (resolveModelPickerLayout(input) === "twoPane") return TWO_PANE_HEIGHT;
|
||||
const provider = input.providers[0];
|
||||
const providerRows = provider ? countAllRows(provider) : 0;
|
||||
let profileRows = 0;
|
||||
if (input.profiles !== null) {
|
||||
if (input.profiles.length > 0) {
|
||||
// Profiles rows plus the Profiles and provider section headings.
|
||||
profileRows = input.profiles.length + 2;
|
||||
} else if (input.canCreateProfile) {
|
||||
profileRows = 1;
|
||||
}
|
||||
}
|
||||
const rowCount = provider ? countAllRows(provider) : 0;
|
||||
return clamp(
|
||||
SINGLE_PANE_CHROME_HEIGHT + (providerRows + profileRows) * LIST_ROW_HEIGHT,
|
||||
SINGLE_PANE_CHROME_HEIGHT + rowCount * LIST_ROW_HEIGHT,
|
||||
SINGLE_PANE_MIN_HEIGHT,
|
||||
TWO_PANE_HEIGHT,
|
||||
);
|
||||
@@ -222,7 +198,7 @@ export function projectModelPicker<TProfile extends NavigableProfileRow>(
|
||||
const normalizedQuery = normalizeQuery(state.query);
|
||||
const pane = normalizedQuery
|
||||
? buildSearchPane(input, normalizedQuery, state.query.trim())
|
||||
: buildBrowsePane(input, state, layout, railKey);
|
||||
: buildBrowsePane(input, state, railKey);
|
||||
const focus: ModelPickerFocus =
|
||||
layout === "twoPane" && !normalizedQuery && state.focus === "rail" ? "rail" : "list";
|
||||
return {
|
||||
@@ -381,31 +357,23 @@ function resolveRailKey(
|
||||
return rail[0]?.key ?? MODEL_PICKER_PROFILES_RAIL_KEY;
|
||||
}
|
||||
|
||||
/** Orders providers with working (ready/loading) ones first and errored ones last. */
|
||||
export function orderProvidersForPicker(providers: readonly ProviderSelectorProvider[]): {
|
||||
ordered: ProviderSelectorProvider[];
|
||||
firstErroredId: string | null;
|
||||
} {
|
||||
const working = providers.filter((provider) => provider.modelSelection.kind !== "error");
|
||||
const errored = providers.filter((provider) => provider.modelSelection.kind === "error");
|
||||
return {
|
||||
ordered: [...working, ...errored],
|
||||
firstErroredId: working.length > 0 ? (errored[0]?.id ?? null) : null,
|
||||
};
|
||||
}
|
||||
|
||||
function buildRail(input: ModelPickerInput): ModelPickerRailItem[] {
|
||||
const { ordered, firstErroredId } = orderProvidersForPicker(input.providers);
|
||||
const providerItems = ordered.map((provider) =>
|
||||
buildProviderRailItem(provider, provider.id === firstErroredId),
|
||||
);
|
||||
if (input.profiles === null) return providerItems;
|
||||
return [{ kind: "profiles", key: MODEL_PICKER_PROFILES_RAIL_KEY }, ...providerItems];
|
||||
const providerItems = input.providers.map((provider) => buildProviderRailItem(input, provider));
|
||||
const working = providerItems.filter((item) => item.status !== "error");
|
||||
const errored = providerItems.filter((item) => item.status === "error");
|
||||
const firstErrored = errored[0];
|
||||
if (firstErrored && working.length > 0) firstErrored.startsErrorGroup = true;
|
||||
const ordered = [...working, ...errored];
|
||||
if (input.profiles === null) return ordered;
|
||||
return [
|
||||
{ kind: "profiles", key: MODEL_PICKER_PROFILES_RAIL_KEY, count: input.profiles.length },
|
||||
...ordered,
|
||||
];
|
||||
}
|
||||
|
||||
function buildProviderRailItem(
|
||||
input: ModelPickerInput,
|
||||
provider: ProviderSelectorProvider,
|
||||
startsErrorGroup: boolean,
|
||||
): Extract<ModelPickerRailItem, { kind: "provider" }> {
|
||||
const selection = provider.modelSelection;
|
||||
const base = {
|
||||
@@ -413,17 +381,16 @@ function buildProviderRailItem(
|
||||
key: provider.id,
|
||||
providerId: provider.id,
|
||||
label: provider.label,
|
||||
startsErrorGroup,
|
||||
startsErrorGroup: false,
|
||||
};
|
||||
if (selection.kind === "loading") return { ...base, status: "loading" };
|
||||
if (selection.kind === "error") return { ...base, status: "error" };
|
||||
return { ...base, status: "ready" };
|
||||
if (selection.kind === "loading") return { ...base, status: "loading", count: 0 };
|
||||
if (selection.kind === "error") return { ...base, status: "error", count: 0 };
|
||||
return { ...base, status: "ready", count: partitionFor(input, provider).primary.length };
|
||||
}
|
||||
|
||||
function buildBrowsePane<TProfile extends NavigableProfileRow>(
|
||||
input: ModelPickerInput<TProfile>,
|
||||
state: ModelPickerState,
|
||||
layout: ModelPickerLayout,
|
||||
railKey: string,
|
||||
): ModelPickerPane<TProfile> {
|
||||
if (railKey === MODEL_PICKER_PROFILES_RAIL_KEY) {
|
||||
@@ -431,19 +398,9 @@ function buildBrowsePane<TProfile extends NavigableProfileRow>(
|
||||
}
|
||||
const provider = input.providers.find((entry) => entry.id === railKey);
|
||||
if (!provider) return { kind: "profiles", items: buildProfileItems(input) };
|
||||
const singlePaneProfiles: ModelPickerListItem<TProfile>[] =
|
||||
layout === "singlePane" && input.profiles !== null && input.profiles.length > 0
|
||||
? input.profiles.map((profile) => toProfileItem(profile))
|
||||
: [];
|
||||
const selection = provider.modelSelection;
|
||||
if (selection.kind === "loading") {
|
||||
return {
|
||||
kind: "providerLoading",
|
||||
providerId: provider.id,
|
||||
label: provider.label,
|
||||
profiles: singlePaneProfiles,
|
||||
items: singlePaneProfiles,
|
||||
};
|
||||
return { kind: "providerLoading", providerId: provider.id, label: provider.label, items: [] };
|
||||
}
|
||||
if (selection.kind === "error") {
|
||||
return {
|
||||
@@ -451,45 +408,18 @@ function buildBrowsePane<TProfile extends NavigableProfileRow>(
|
||||
providerId: provider.id,
|
||||
label: provider.label,
|
||||
message: selection.message,
|
||||
profiles: singlePaneProfiles,
|
||||
items: singlePaneProfiles,
|
||||
items: [],
|
||||
};
|
||||
}
|
||||
const partition = partitionFor(input, provider);
|
||||
const providerModels = buildProviderItems<TProfile>(provider.id, partition, state);
|
||||
if (layout === "singlePane" && input.profiles !== null) {
|
||||
if (singlePaneProfiles.length > 0) {
|
||||
return {
|
||||
kind: "provider",
|
||||
providerId: provider.id,
|
||||
label: provider.label,
|
||||
profiles: singlePaneProfiles,
|
||||
models: providerModels,
|
||||
items: [...singlePaneProfiles, ...providerModels],
|
||||
};
|
||||
}
|
||||
if (input.canCreateProfile) {
|
||||
const modelsWithCreate: ModelPickerListItem<TProfile>[] = [
|
||||
...providerModels,
|
||||
{ kind: "createProfile", key: MODEL_BROWSER_CREATE_PROFILE_KEY },
|
||||
];
|
||||
return {
|
||||
kind: "provider",
|
||||
providerId: provider.id,
|
||||
label: provider.label,
|
||||
profiles: [],
|
||||
models: modelsWithCreate,
|
||||
items: modelsWithCreate,
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
kind: "provider",
|
||||
providerId: provider.id,
|
||||
label: provider.label,
|
||||
profiles: [],
|
||||
models: providerModels,
|
||||
items: providerModels,
|
||||
shown: partition.primary.length,
|
||||
total: selection.rows.length,
|
||||
foldKind: partition.foldKind,
|
||||
items: buildProviderItems(provider.id, partition, state),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
useReducer,
|
||||
useRef,
|
||||
useState,
|
||||
type ReactElement,
|
||||
type ReactNode,
|
||||
type RefObject,
|
||||
} from "react";
|
||||
@@ -34,8 +33,6 @@ import {
|
||||
type SheetKeyboard,
|
||||
} from "@/components/adaptive-modal-sheet";
|
||||
import {
|
||||
MODEL_PICKER_HEADING_HEIGHT,
|
||||
MODEL_PICKER_ROW_HEIGHT,
|
||||
ModelBrowserLoadingState,
|
||||
ModelBrowserRow,
|
||||
ModelBrowserSectionHeading,
|
||||
@@ -63,11 +60,7 @@ import { groupProfilesByProviderModel } from "@/components/model-browser-view";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Combobox, type ComboboxDesktopPlacement } from "@/components/ui/combobox";
|
||||
import { LoadingSpinner } from "@/components/ui/loading-spinner";
|
||||
import {
|
||||
useInitialFlatListScroll,
|
||||
useRevealActiveFlatListRow,
|
||||
useRevealActiveItem,
|
||||
} from "@/components/ui/scroll-reveal";
|
||||
import { useRevealActiveFlatListRow, useRevealActiveItem } from "@/components/ui/scroll-reveal";
|
||||
import type { EditingTextInputHandle } from "@/components/ui/text-input";
|
||||
import type { KeyboardInputEvent } from "@/keyboard";
|
||||
import { useCurrentOverlayLayer } from "@/lib/overlay-root";
|
||||
@@ -172,7 +165,6 @@ export function DesktopModelPicker({
|
||||
>
|
||||
<ModelPickerBody
|
||||
input={input}
|
||||
pickerHeight={height}
|
||||
serverId={serverId}
|
||||
keyboardHandlerRef={keyboardHandlerRef}
|
||||
{...actions}
|
||||
@@ -184,13 +176,11 @@ export function DesktopModelPicker({
|
||||
/** Mounted only while the popover is open, so every open starts from the current selection. */
|
||||
function ModelPickerBody({
|
||||
input,
|
||||
pickerHeight,
|
||||
serverId,
|
||||
keyboardHandlerRef,
|
||||
...actions
|
||||
}: ModelPickerActions & {
|
||||
input: ModelPickerInput<AgentProfilePickerRow>;
|
||||
pickerHeight: number;
|
||||
serverId: string | null;
|
||||
keyboardHandlerRef: RefObject<KeyboardHandler | null>;
|
||||
}) {
|
||||
@@ -318,7 +308,6 @@ function ModelPickerBody({
|
||||
body = (
|
||||
<ListPane
|
||||
projection={projection}
|
||||
pickerHeight={pickerHeight}
|
||||
query={state.query}
|
||||
serverId={serverId}
|
||||
input={input}
|
||||
@@ -333,7 +322,6 @@ function ModelPickerBody({
|
||||
<Rail projection={projection} serverId={serverId} onSelectRail={handleSelectRail} />
|
||||
<ListPane
|
||||
projection={projection}
|
||||
pickerHeight={pickerHeight}
|
||||
query={state.query}
|
||||
serverId={serverId}
|
||||
input={input}
|
||||
@@ -456,9 +444,6 @@ function RailRow({
|
||||
);
|
||||
}
|
||||
|
||||
const INLINE_HEADER_HEIGHT = 56;
|
||||
const PANE_HEADER_HEIGHT = 36;
|
||||
|
||||
function RailRowStatus({ item }: { item: ModelPickerRailItem }) {
|
||||
if (item.kind === "provider" && item.status === "loading") {
|
||||
return (
|
||||
@@ -470,30 +455,14 @@ function RailRowStatus({ item }: { item: ModelPickerRailItem }) {
|
||||
if (item.kind === "provider" && item.status === "error") {
|
||||
return <ThemedAlertTriangle size={ICON_SIZE.xs} uniProps={foregroundMutedMapping} />;
|
||||
}
|
||||
return null;
|
||||
return <Text style={styles.count}>{item.count}</Text>;
|
||||
}
|
||||
|
||||
type ListEntry =
|
||||
| {
|
||||
kind: "heading";
|
||||
key: string;
|
||||
title: string;
|
||||
action?:
|
||||
| { kind: "editProfiles" }
|
||||
| { kind: "customizeProvider"; providerId: string; providerLabel: string };
|
||||
}
|
||||
| { kind: "heading"; key: string; title: string }
|
||||
| { kind: "item"; key: string; item: ModelPickerListItem<AgentProfilePickerRow> };
|
||||
|
||||
function paneHasInlineProfiles(pane: ModelPickerPane<AgentProfilePickerRow>): boolean {
|
||||
return (
|
||||
(pane.kind === "provider" ||
|
||||
pane.kind === "providerLoading" ||
|
||||
pane.kind === "providerError") &&
|
||||
pane.profiles.length > 0
|
||||
);
|
||||
}
|
||||
|
||||
/** Search results and single-pane profiles+models carry section headings; every other pane is flat. */
|
||||
/** Search results carry section headings between their groups; every other pane is a flat list. */
|
||||
function useListEntries(pane: ModelPickerPane<AgentProfilePickerRow>): ListEntry[] {
|
||||
const { t } = useTranslation();
|
||||
return useMemo(() => {
|
||||
@@ -502,35 +471,6 @@ function useListEntries(pane: ModelPickerPane<AgentProfilePickerRow>): ListEntry
|
||||
key: item.key,
|
||||
item,
|
||||
});
|
||||
if (paneHasInlineProfiles(pane)) {
|
||||
if (
|
||||
pane.kind !== "provider" &&
|
||||
pane.kind !== "providerLoading" &&
|
||||
pane.kind !== "providerError"
|
||||
) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
{
|
||||
kind: "heading",
|
||||
key: "heading:profiles",
|
||||
title: t("modelSelector.profiles"),
|
||||
action: { kind: "editProfiles" },
|
||||
},
|
||||
...pane.profiles.map(toEntry),
|
||||
{
|
||||
kind: "heading",
|
||||
key: `heading:provider:${pane.providerId}`,
|
||||
title: pane.label,
|
||||
action: {
|
||||
kind: "customizeProvider",
|
||||
providerId: pane.providerId,
|
||||
providerLabel: pane.label,
|
||||
},
|
||||
},
|
||||
...(pane.kind === "provider" ? pane.models.map(toEntry) : []),
|
||||
];
|
||||
}
|
||||
if (pane.kind !== "search") return pane.items.map(toEntry);
|
||||
const entries: ListEntry[] = [];
|
||||
if (pane.profiles.length > 0) {
|
||||
@@ -549,22 +489,6 @@ function useListEntries(pane: ModelPickerPane<AgentProfilePickerRow>): ListEntry
|
||||
}, [pane, t]);
|
||||
}
|
||||
|
||||
function computeEntryLayout(entries: readonly ListEntry[]): {
|
||||
lengths: number[];
|
||||
offsets: number[];
|
||||
} {
|
||||
const lengths: number[] = [];
|
||||
const offsets: number[] = [];
|
||||
let offset = 0;
|
||||
for (const entry of entries) {
|
||||
const length = entry.kind === "heading" ? MODEL_PICKER_HEADING_HEIGHT : MODEL_PICKER_ROW_HEIGHT;
|
||||
lengths.push(length);
|
||||
offsets.push(offset);
|
||||
offset += length;
|
||||
}
|
||||
return { lengths, offsets };
|
||||
}
|
||||
|
||||
/** The first row reveals as the list top, so a section heading above it stays in view. */
|
||||
function resolveRevealTarget(entries: readonly ListEntry[], activeKey: string | null) {
|
||||
if (!activeKey) return null;
|
||||
@@ -577,15 +501,8 @@ function getListEntryKey(entry: ListEntry): string {
|
||||
return entry.key;
|
||||
}
|
||||
|
||||
function paneShowsHeader(pane: ModelPickerPane<AgentProfilePickerRow>): boolean {
|
||||
if (pane.kind === "search" || pane.kind === "noMatches") return false;
|
||||
if (paneHasInlineProfiles(pane)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function ListPane({
|
||||
projection,
|
||||
pickerHeight,
|
||||
query,
|
||||
input,
|
||||
serverId,
|
||||
@@ -594,7 +511,6 @@ function ListPane({
|
||||
actions,
|
||||
}: {
|
||||
projection: ModelPickerProjection<AgentProfilePickerRow>;
|
||||
pickerHeight: number;
|
||||
/** Each query is a new result list, which opens at its top. */
|
||||
query: string;
|
||||
input: ModelPickerInput<AgentProfilePickerRow>;
|
||||
@@ -605,41 +521,23 @@ function ListPane({
|
||||
}) {
|
||||
const { pane, activeKey } = projection;
|
||||
const entries = useListEntries(pane);
|
||||
const listRef = useRef<FlatList<ListEntry>>(null);
|
||||
const reveal = useRevealActiveFlatListRow({
|
||||
listRef,
|
||||
itemCount: entries.length,
|
||||
activeIndex: resolveRevealTarget(entries, activeKey),
|
||||
listKey: `${pane.kind}:${projection.railKey}:${query}`,
|
||||
});
|
||||
const profiledLookup = useMemo(
|
||||
() => groupProfilesByProviderModel(input.profiles ?? []),
|
||||
[input.profiles],
|
||||
);
|
||||
const inSearch = pane.kind === "search";
|
||||
const { selectedProvider, selectedModel } = input;
|
||||
const hasPaneHeader = paneShowsHeader(pane);
|
||||
const visibleCount = Math.max(
|
||||
1,
|
||||
Math.floor(
|
||||
(pickerHeight - INLINE_HEADER_HEIGHT - (hasPaneHeader ? PANE_HEADER_HEIGHT : 0)) /
|
||||
MODEL_PICKER_ROW_HEIGHT,
|
||||
),
|
||||
);
|
||||
// Keyed per browse pane so switching providers in the rail opens at the new provider's initial
|
||||
// scroll position instead of flashing the previous provider's scroll offset for a frame.
|
||||
const paneListKey = inSearch ? "search" : `${pane.kind}:${projection.railKey}`;
|
||||
|
||||
const renderEntry = useCallback(
|
||||
({ item: entry }: { item: ListEntry }) => {
|
||||
if (entry.kind === "heading") {
|
||||
let headingAction: ReactNode = null;
|
||||
if (entry.action?.kind === "editProfiles" && actions.onEditProfiles) {
|
||||
headingAction = <EditProfilesButton onPress={actions.onEditProfiles} />;
|
||||
} else if (entry.action?.kind === "customizeProvider" && serverId) {
|
||||
headingAction = (
|
||||
<CustomizeProviderButton
|
||||
serverId={serverId}
|
||||
providerId={entry.action.providerId}
|
||||
providerLabel={entry.action.providerLabel}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return <ModelBrowserSectionHeading title={entry.title} action={headingAction} />;
|
||||
}
|
||||
if (entry.kind === "heading") return <ModelBrowserSectionHeading title={entry.title} />;
|
||||
const { item } = entry;
|
||||
return (
|
||||
<ModelPickerItemRow
|
||||
@@ -672,102 +570,33 @@ function ListPane({
|
||||
],
|
||||
);
|
||||
|
||||
const inlineStateFooter = useMemo(
|
||||
() => (entries.length > 0 ? <PaneState pane={pane} actions={actions} /> : null),
|
||||
[actions, entries.length, pane],
|
||||
);
|
||||
|
||||
return (
|
||||
<View style={styles.listPane} testID="model-picker-list">
|
||||
<ListPaneHeader pane={pane} serverId={serverId} onEditProfiles={actions.onEditProfiles} />
|
||||
<PaneState pane={pane} actions={actions} />
|
||||
{entries.length > 0 ? (
|
||||
<PaneFlatList
|
||||
key={paneListKey}
|
||||
entries={entries}
|
||||
activeKey={activeKey}
|
||||
listKey={inSearch ? query : paneListKey}
|
||||
visibleCount={visibleCount}
|
||||
renderEntry={renderEntry}
|
||||
listFooter={inlineStateFooter}
|
||||
<FlatList
|
||||
ref={listRef}
|
||||
data={entries}
|
||||
extraData={activeKey}
|
||||
renderItem={renderEntry}
|
||||
keyExtractor={getListEntryKey}
|
||||
onScrollToIndexFailed={reveal.onScrollToIndexFailed}
|
||||
onViewableItemsChanged={reveal.onViewableItemsChanged}
|
||||
viewabilityConfig={reveal.viewabilityConfig}
|
||||
onContentSizeChange={reveal.onContentSizeChange}
|
||||
onLayout={reveal.onLayout}
|
||||
style={styles.scroll}
|
||||
contentContainerStyle={styles.listContent}
|
||||
keyboardShouldPersistTaps="handled"
|
||||
showsVerticalScrollIndicator={false}
|
||||
testID="model-picker-model-list"
|
||||
/>
|
||||
) : (
|
||||
<PaneState pane={pane} actions={actions} />
|
||||
)}
|
||||
) : null}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
function PaneFlatList({
|
||||
entries,
|
||||
activeKey,
|
||||
listKey,
|
||||
visibleCount,
|
||||
renderEntry,
|
||||
listFooter,
|
||||
}: {
|
||||
entries: ListEntry[];
|
||||
activeKey: string | null;
|
||||
listKey: string;
|
||||
visibleCount: number;
|
||||
renderEntry: ({ item }: { item: ListEntry }) => React.ReactElement;
|
||||
listFooter?: ReactElement | null;
|
||||
}) {
|
||||
const listRef = useRef<FlatList<ListEntry>>(null);
|
||||
const entryLayout = useMemo(() => computeEntryLayout(entries), [entries]);
|
||||
const getItemLayout = useCallback(
|
||||
(_data: ArrayLike<ListEntry> | null | undefined, index: number) => ({
|
||||
length: entryLayout.lengths[index] ?? MODEL_PICKER_ROW_HEIGHT,
|
||||
offset: entryLayout.offsets[index] ?? index * MODEL_PICKER_ROW_HEIGHT,
|
||||
index,
|
||||
}),
|
||||
[entryLayout],
|
||||
);
|
||||
const offsetForIndex = useCallback(
|
||||
(index: number) => entryLayout.offsets[index] ?? index * MODEL_PICKER_ROW_HEIGHT,
|
||||
[entryLayout],
|
||||
);
|
||||
const revealTarget = resolveRevealTarget(entries, activeKey);
|
||||
const { initialScrollIndex, contentOffset, initialVisibleRange } = useInitialFlatListScroll({
|
||||
listRef,
|
||||
selectedIndex: typeof revealTarget === "number" ? revealTarget : null,
|
||||
itemCount: entries.length,
|
||||
visibleCount,
|
||||
offsetForIndex,
|
||||
});
|
||||
|
||||
const reveal = useRevealActiveFlatListRow({
|
||||
listRef,
|
||||
itemCount: entries.length,
|
||||
activeIndex: revealTarget,
|
||||
initialVisibleRange,
|
||||
listKey,
|
||||
});
|
||||
|
||||
return (
|
||||
<FlatList
|
||||
ref={listRef}
|
||||
data={entries}
|
||||
extraData={activeKey}
|
||||
renderItem={renderEntry}
|
||||
keyExtractor={getListEntryKey}
|
||||
getItemLayout={getItemLayout}
|
||||
initialScrollIndex={initialScrollIndex}
|
||||
contentOffset={contentOffset}
|
||||
ListFooterComponent={listFooter}
|
||||
onScrollToIndexFailed={reveal.onScrollToIndexFailed}
|
||||
onViewableItemsChanged={reveal.onViewableItemsChanged}
|
||||
viewabilityConfig={reveal.viewabilityConfig}
|
||||
onContentSizeChange={reveal.onContentSizeChange}
|
||||
onLayout={reveal.onLayout}
|
||||
style={styles.scroll}
|
||||
contentContainerStyle={styles.listContent}
|
||||
keyboardShouldPersistTaps="handled"
|
||||
showsVerticalScrollIndicator={false}
|
||||
testID="model-picker-model-list"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function ListPaneHeader({
|
||||
pane,
|
||||
serverId,
|
||||
@@ -778,22 +607,36 @@ function ListPaneHeader({
|
||||
onEditProfiles?: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
if (!paneShowsHeader(pane)) return null;
|
||||
if (pane.kind === "search" || pane.kind === "noMatches") return null;
|
||||
if (pane.kind === "profiles") {
|
||||
return (
|
||||
<View style={styles.paneHeader}>
|
||||
<Text style={styles.paneTitle} numberOfLines={1}>
|
||||
{t("modelSelector.profiles")}
|
||||
</Text>
|
||||
{onEditProfiles ? <EditProfilesButton onPress={onEditProfiles} /> : null}
|
||||
{onEditProfiles ? (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onPress={onEditProfiles}
|
||||
accessibilityLabel={t("modelSelector.editProfilesLabel")}
|
||||
testID="model-profiles-edit"
|
||||
>
|
||||
{t("modelSelector.editProfiles")}
|
||||
</Button>
|
||||
) : null}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
if (pane.kind === "search" || pane.kind === "noMatches") return null;
|
||||
const summary =
|
||||
pane.kind === "provider" && pane.foldKind !== null
|
||||
? t("modelSelector.shownOfTotal", { shown: pane.shown, total: pane.total })
|
||||
: null;
|
||||
return (
|
||||
<View style={styles.paneHeader}>
|
||||
<Text style={styles.paneTitle} numberOfLines={1}>
|
||||
{pane.label}
|
||||
{summary ? <Text style={styles.paneSummary}>{` · ${summary}`}</Text> : null}
|
||||
</Text>
|
||||
{serverId ? (
|
||||
<CustomizeProviderButton
|
||||
@@ -806,20 +649,6 @@ function ListPaneHeader({
|
||||
);
|
||||
}
|
||||
|
||||
export function EditProfilesButton({ onPress }: { onPress: () => void }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
leftIcon={Pencil}
|
||||
onPress={onPress}
|
||||
accessibilityLabel={t("modelSelector.editProfilesLabel")}
|
||||
testID="model-profiles-edit"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export function CustomizeProviderButton({
|
||||
serverId,
|
||||
providerId,
|
||||
@@ -1032,6 +861,11 @@ const styles = StyleSheet.create((theme) => ({
|
||||
railSpinner: {
|
||||
transform: [{ scale: 0.7 }],
|
||||
},
|
||||
count: {
|
||||
fontSize: theme.fontSize.sm,
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontVariant: ["tabular-nums"],
|
||||
},
|
||||
listPane: {
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
@@ -1044,7 +878,7 @@ const styles = StyleSheet.create((theme) => ({
|
||||
paddingBottom: theme.spacing[2],
|
||||
},
|
||||
paneHeader: {
|
||||
height: PANE_HEADER_HEIGHT,
|
||||
height: 36,
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[2],
|
||||
@@ -1058,4 +892,8 @@ const styles = StyleSheet.create((theme) => ({
|
||||
fontWeight: theme.fontWeight.medium,
|
||||
color: theme.colors.foreground,
|
||||
},
|
||||
paneSummary: {
|
||||
fontWeight: theme.fontWeight.normal,
|
||||
color: theme.colors.foregroundMuted,
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -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 {
|
||||
@@ -104,10 +101,6 @@ const DESKTOP_PROVIDER_VIEW_MAX_HEIGHT = 400;
|
||||
const DESKTOP_PROVIDER_VIEW_BASE_HEIGHT = 80;
|
||||
const DESKTOP_MODEL_ROW_HEIGHT = 40;
|
||||
|
||||
/** Fixed picker row heights so virtualized lists can mount directly at the selected row via `getItemLayout`. */
|
||||
export const MODEL_PICKER_ROW_HEIGHT = isWeb ? 36 : 44;
|
||||
export const MODEL_PICKER_HEADING_HEIGHT = 32;
|
||||
|
||||
const ThemedAlertTriangle = withUnistyles(AlertTriangle);
|
||||
const ThemedCheck = withUnistyles(Check);
|
||||
const ThemedChevronRight = withUnistyles(ChevronRight);
|
||||
@@ -212,6 +205,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 +612,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 +1377,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,
|
||||
@@ -2016,28 +2036,29 @@ const styles = StyleSheet.create((theme) => ({
|
||||
backgroundColor: theme.colors.border,
|
||||
},
|
||||
sectionHeading: {
|
||||
height: MODEL_PICKER_HEADING_HEIGHT,
|
||||
position: "relative",
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[2],
|
||||
paddingHorizontal: { xs: theme.spacing[4], md: theme.spacing[3] },
|
||||
paddingHorizontal: isWeb ? theme.spacing[3] : theme.spacing[6],
|
||||
paddingTop: theme.spacing[2],
|
||||
paddingBottom: theme.spacing[1],
|
||||
},
|
||||
sectionHeadingAction: {
|
||||
flexShrink: 0,
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
position: "absolute",
|
||||
top: theme.spacing[1],
|
||||
right: isWeb ? theme.spacing[3] : theme.spacing[6],
|
||||
},
|
||||
sectionHeadingText: {
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
fontSize: theme.fontSize.sm,
|
||||
fontWeight: theme.fontWeight.normal,
|
||||
color: theme.colors.foregroundMuted,
|
||||
},
|
||||
browserRow: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
height: MODEL_PICKER_ROW_HEIGHT,
|
||||
paddingVertical: theme.spacing[2],
|
||||
minHeight: 36,
|
||||
},
|
||||
modelRowHoverBoundary: {
|
||||
position: "relative",
|
||||
@@ -2046,10 +2067,10 @@ const styles = StyleSheet.create((theme) => ({
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
right: { xs: theme.spacing[4], md: theme.spacing[3] },
|
||||
right: isWeb ? theme.spacing[3] : theme.spacing[6],
|
||||
justifyContent: "center",
|
||||
},
|
||||
browserModelRow: {},
|
||||
browserModelRow: isWeb ? {} : { marginBottom: theme.spacing[1] },
|
||||
browserRowHovered: {
|
||||
backgroundColor: theme.colors.surface1,
|
||||
},
|
||||
@@ -2067,7 +2088,7 @@ const styles = StyleSheet.create((theme) => ({
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[2],
|
||||
paddingHorizontal: { xs: theme.spacing[4], md: theme.spacing[3] },
|
||||
paddingHorizontal: isWeb ? theme.spacing[3] : theme.spacing[6],
|
||||
},
|
||||
browserRowLeading: {
|
||||
width: 16,
|
||||
|
||||
@@ -2,12 +2,19 @@ import { useCallback, useMemo, useState, type ReactNode } from "react";
|
||||
import { View } from "react-native";
|
||||
import { isWeb } from "@/constants/platform";
|
||||
import { SettingsRowChildren } from "./row-children";
|
||||
import { SettingsRowHeader } from "./row-header";
|
||||
import { SettingsRowHeader, type SettingsRowHintStatus } from "./row-header";
|
||||
|
||||
interface SettingsCollapsibleRowProps {
|
||||
label: string;
|
||||
/** A line under the label explaining the group. */
|
||||
hint?: string;
|
||||
hintStatus?: SettingsRowHintStatus;
|
||||
/** A short status shown before the chevron, so the row says something while collapsed. */
|
||||
summary?: string;
|
||||
/** A control acting on the row's subject in place, such as a switch, before the chevron. */
|
||||
control?: ReactNode;
|
||||
/** Names the expand/collapse button for assistive tech when the label alone is not enough. */
|
||||
accessibilityLabel?: string;
|
||||
defaultExpanded?: boolean;
|
||||
testID?: string;
|
||||
/** The rows revealed underneath, separated like the rows of a `SettingsCard` and laid out as nested rows. */
|
||||
@@ -21,7 +28,11 @@ interface SettingsCollapsibleRowProps {
|
||||
*/
|
||||
export function SettingsCollapsibleRow({
|
||||
label,
|
||||
hint,
|
||||
hintStatus,
|
||||
summary,
|
||||
control,
|
||||
accessibilityLabel,
|
||||
defaultExpanded = false,
|
||||
testID,
|
||||
children,
|
||||
@@ -39,7 +50,11 @@ export function SettingsCollapsibleRow({
|
||||
<View testID={testID}>
|
||||
<SettingsRowHeader
|
||||
label={label}
|
||||
hint={hint}
|
||||
hintStatus={hintStatus}
|
||||
summary={summary}
|
||||
control={control}
|
||||
accessibilityLabel={accessibilityLabel}
|
||||
onPress={toggle}
|
||||
expanded={expanded}
|
||||
accessibilityState={accessibilityState}
|
||||
|
||||
@@ -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
|
||||
@@ -56,13 +56,25 @@ interface AppSettingsRowProps extends Omit<SettingsRowProps, "hint">, AppRowExtr
|
||||
hint?: ReactNode;
|
||||
}
|
||||
|
||||
export function SettingsCard({ children, testID }: { children: ReactNode; testID?: string }) {
|
||||
/** Lets a card and its rows shrink below their content, so a list inside can scroll. */
|
||||
const SHRINK = { flexShrink: 1, minHeight: 0 } as const;
|
||||
|
||||
export function SettingsCard({
|
||||
children,
|
||||
testID,
|
||||
shrink = false,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
testID?: string;
|
||||
/** The card shrinks to fit a parent with a bounded height, and a list inside it scrolls. */
|
||||
shrink?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<View style={settingsStyles.card} testID={testID}>
|
||||
<View style={[settingsStyles.card, shrink && SHRINK]} testID={testID}>
|
||||
{Children.toArray(children).map((child, index) => (
|
||||
<View
|
||||
key={isValidElement(child) ? child.key : index}
|
||||
style={index ? settingsStyles.rowBorder : undefined}
|
||||
style={[index ? settingsStyles.rowBorder : undefined, shrink && SHRINK]}
|
||||
>
|
||||
{child}
|
||||
</View>
|
||||
|
||||
@@ -151,8 +151,5 @@ describe("settings row density", () => {
|
||||
const summary = textNode("short-summary", "Local").getBoundingClientRect();
|
||||
// The summary's margin, the chevron and the row's padding: about 40px.
|
||||
expect(row.right - summary.right).toBeLessThan(48);
|
||||
expect(titleFontSize("short-summary", "Local")).toBe(
|
||||
titleFontSize("short-summary", "Speech to text"),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
|
||||
@@ -141,7 +141,6 @@ export function SettingsRowHeader({
|
||||
hovered={hovered}
|
||||
summary={summary}
|
||||
summaryLeading={summaryLeading}
|
||||
titleStyle={layout.title}
|
||||
/>
|
||||
{external || disabled ? null : (
|
||||
<View style={chevronStyle} {...HIDDEN_FROM_ASSISTIVE_TECH}>
|
||||
@@ -168,17 +167,14 @@ function RowTrailing({
|
||||
hovered,
|
||||
summary,
|
||||
summaryLeading,
|
||||
titleStyle,
|
||||
}: {
|
||||
hinted: boolean;
|
||||
external: boolean;
|
||||
hovered: boolean;
|
||||
summary: string | undefined;
|
||||
summaryLeading: ReactNode;
|
||||
titleStyle: SettingsRowLayout["title"];
|
||||
}) {
|
||||
const style = hinted ? styles.hintedTrailing : styles.labelTrailing;
|
||||
const summaryStyle = useMemo(() => [titleStyle, styles.summary], [titleStyle]);
|
||||
return (
|
||||
<View style={[style, styles.passThrough]} {...HIDDEN_FROM_ASSISTIVE_TECH}>
|
||||
{/* Drawn the same as a section header's docs link, so the two read as one thing. */}
|
||||
@@ -187,7 +183,7 @@ function RowTrailing({
|
||||
<View style={styles.summaryLeading}>{summaryLeading}</View>
|
||||
) : null}
|
||||
{!external && summary ? (
|
||||
<Text style={summaryStyle} numberOfLines={1}>
|
||||
<Text style={styles.summary} numberOfLines={1}>
|
||||
{summary}
|
||||
</Text>
|
||||
) : null}
|
||||
@@ -319,6 +315,7 @@ const styles = StyleSheet.create((theme) => ({
|
||||
summary: {
|
||||
flexShrink: 1,
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontSize: theme.fontSize.sm,
|
||||
marginRight: theme.spacing[2],
|
||||
},
|
||||
hovered: {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -89,7 +89,9 @@ const styles = StyleSheet.create((theme: Theme) => ({
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
width: INDENT_GUIDE_WIDTH,
|
||||
backgroundColor: theme.colors.treeGuide,
|
||||
// Translucent ink, not `border`: a solid line that colour disappears into a hovered row's fill.
|
||||
backgroundColor: theme.colors.foregroundExtraMuted,
|
||||
opacity: theme.opacity[50],
|
||||
},
|
||||
chevron: {
|
||||
width: WORKSPACE_TREE_ICON_SIZE,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useOverlayRegistration, type KeyboardInputEvent } from "@/keyboard";
|
||||
import { useSettledKeyboardHeight } from "@/keyboard/shift";
|
||||
import { Modal } from "@/components/ui/modal";
|
||||
import {
|
||||
useCallback,
|
||||
@@ -944,34 +943,19 @@ function maybePinDesktopOptionsToBottom(
|
||||
|
||||
interface FloatingMiddlewareInput {
|
||||
collisionPadding: number;
|
||||
keyboardHeight: number;
|
||||
isDesktopAboveSearch: boolean;
|
||||
setAvailableSize: FloatingSizeSetters["setAvailableSize"];
|
||||
setReferenceWidth: FloatingSizeSetters["setReferenceWidth"];
|
||||
}
|
||||
|
||||
function buildFloatingMiddleware(input: FloatingMiddlewareInput) {
|
||||
const {
|
||||
collisionPadding,
|
||||
keyboardHeight,
|
||||
isDesktopAboveSearch,
|
||||
setAvailableSize,
|
||||
setReferenceWidth,
|
||||
} = input;
|
||||
// The native popover's boundary is the window, which the software keyboard covers. The keyboard
|
||||
// height changes once the keyboard settles, so this also re-measures an anchor that rides it.
|
||||
const padding = {
|
||||
top: collisionPadding,
|
||||
left: collisionPadding,
|
||||
right: collisionPadding,
|
||||
bottom: collisionPadding + keyboardHeight,
|
||||
};
|
||||
const { collisionPadding, isDesktopAboveSearch, setAvailableSize, setReferenceWidth } = input;
|
||||
return [
|
||||
floatingOffset(isWeb ? 5 : 4),
|
||||
...(isWeb ? [] : [flip({ padding })]),
|
||||
...(isDesktopAboveSearch ? [] : [shift({ padding })]),
|
||||
...(isWeb ? [] : [flip({ padding: collisionPadding })]),
|
||||
...(isDesktopAboveSearch ? [] : [shift({ padding: collisionPadding })]),
|
||||
floatingSize({
|
||||
padding,
|
||||
padding: collisionPadding,
|
||||
apply({ availableWidth, availableHeight, rects }) {
|
||||
updateAvailableSize(setAvailableSize, availableWidth, availableHeight);
|
||||
updateReferenceWidth(setReferenceWidth, rects.reference.width);
|
||||
@@ -1512,18 +1496,16 @@ export function Combobox({
|
||||
useResetSearchOnOpen(isOpen, setSearchQueryWithCallback, bumpSearchResetKey);
|
||||
|
||||
const collisionPadding = useMemo(computeCollisionPadding, []);
|
||||
const keyboardHeight = useSettledKeyboardHeight();
|
||||
|
||||
const middleware = useMemo(
|
||||
() =>
|
||||
buildFloatingMiddleware({
|
||||
collisionPadding,
|
||||
keyboardHeight,
|
||||
isDesktopAboveSearch,
|
||||
setAvailableSize,
|
||||
setReferenceWidth,
|
||||
}),
|
||||
[collisionPadding, isDesktopAboveSearch, keyboardHeight],
|
||||
[collisionPadding, isDesktopAboveSearch],
|
||||
);
|
||||
|
||||
const { refs, floatingStyles, update } = useFloating({
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -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",
|
||||
},
|
||||
}));
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getScrollOffsetToRevealItem, resolveInitialScrollIndex } from "./scroll-reveal";
|
||||
import { getScrollOffsetToRevealItem } from "./scroll-reveal";
|
||||
|
||||
describe("getScrollOffsetToRevealItem", () => {
|
||||
it("keeps the offset when the item is already inside the viewport", () => {
|
||||
@@ -46,38 +46,3 @@ describe("getScrollOffsetToRevealItem", () => {
|
||||
).toBe(120);
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveInitialScrollIndex", () => {
|
||||
it("stays at the top when the selected item is already in the first viewport", () => {
|
||||
expect(resolveInitialScrollIndex({ selectedIndex: 0, itemCount: 20, visibleCount: 5 })).toBe(
|
||||
undefined,
|
||||
);
|
||||
expect(resolveInitialScrollIndex({ selectedIndex: 4, itemCount: 20, visibleCount: 5 })).toBe(
|
||||
undefined,
|
||||
);
|
||||
});
|
||||
|
||||
it("centers a deeper selected item inside the visible viewport", () => {
|
||||
expect(resolveInitialScrollIndex({ selectedIndex: 9, itemCount: 236, visibleCount: 5 })).toBe(
|
||||
7,
|
||||
);
|
||||
});
|
||||
|
||||
it("clamps near the end so the bottom viewport stays full", () => {
|
||||
expect(resolveInitialScrollIndex({ selectedIndex: 235, itemCount: 236, visibleCount: 5 })).toBe(
|
||||
231,
|
||||
);
|
||||
expect(resolveInitialScrollIndex({ selectedIndex: 19, itemCount: 20, visibleCount: 7 })).toBe(
|
||||
13,
|
||||
);
|
||||
});
|
||||
|
||||
it("returns undefined for empty or out-of-range selections", () => {
|
||||
expect(resolveInitialScrollIndex({ selectedIndex: null, itemCount: 20, visibleCount: 5 })).toBe(
|
||||
undefined,
|
||||
);
|
||||
expect(resolveInitialScrollIndex({ selectedIndex: 5, itemCount: 3, visibleCount: 5 })).toBe(
|
||||
undefined,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useCallback, useLayoutEffect, useRef, type RefObject } from "react";
|
||||
import { useCallback, useEffect, useLayoutEffect, useRef, type RefObject } from "react";
|
||||
import type {
|
||||
FlatList,
|
||||
LayoutChangeEvent,
|
||||
@@ -8,7 +8,6 @@ import type {
|
||||
View,
|
||||
ViewToken,
|
||||
} from "react-native";
|
||||
import { isNative, isWeb } from "@/constants/platform";
|
||||
|
||||
export function getScrollOffsetToRevealItem(args: {
|
||||
currentOffset: number;
|
||||
@@ -126,88 +125,6 @@ interface VisibleRange {
|
||||
last: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the `FlatList` `initialScrollIndex` that opens with `selectedIndex` in view without
|
||||
* flashing index 0 first. Returns `undefined` when the row is already inside the first page so
|
||||
* the list starts cleanly at the top.
|
||||
*/
|
||||
export function resolveInitialScrollIndex(args: {
|
||||
selectedIndex: number | null;
|
||||
itemCount: number;
|
||||
visibleCount: number;
|
||||
}): number | undefined {
|
||||
const { selectedIndex, itemCount, visibleCount } = args;
|
||||
if (
|
||||
selectedIndex === null ||
|
||||
selectedIndex < 0 ||
|
||||
selectedIndex >= itemCount ||
|
||||
visibleCount <= 0
|
||||
) {
|
||||
return undefined;
|
||||
}
|
||||
if (selectedIndex < visibleCount) {
|
||||
return undefined;
|
||||
}
|
||||
const maxStart = Math.max(0, itemCount - visibleCount);
|
||||
const centered = selectedIndex - Math.floor(visibleCount / 2);
|
||||
const index = Math.min(Math.max(0, centered), maxStart);
|
||||
return index > 0 ? index : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a virtualized `FlatList` directly at `selectedIndex` without flashing index 0 first.
|
||||
* Captures the mount offset once, supplies `initialScrollIndex` (and iOS `contentOffset`), and
|
||||
* sets the web scroll position synchronously before first paint.
|
||||
*/
|
||||
export function useInitialFlatListScroll<T>(options: {
|
||||
listRef: RefObject<FlatList<T> | null>;
|
||||
selectedIndex: number | null;
|
||||
itemCount: number;
|
||||
visibleCount: number;
|
||||
offsetForIndex: (index: number) => number;
|
||||
}): {
|
||||
initialScrollIndex: number | undefined;
|
||||
contentOffset: { x: number; y: number } | undefined;
|
||||
initialVisibleRange: VisibleRange;
|
||||
} {
|
||||
const { listRef, selectedIndex, itemCount, visibleCount, offsetForIndex } = options;
|
||||
const initialMount = useRef<{
|
||||
initialScrollIndex: number | undefined;
|
||||
offset: number;
|
||||
contentOffset: { x: number; y: number } | undefined;
|
||||
initialVisibleRange: VisibleRange;
|
||||
} | null>(null);
|
||||
if (initialMount.current === null) {
|
||||
const initialScrollIndex = resolveInitialScrollIndex({
|
||||
selectedIndex,
|
||||
itemCount,
|
||||
visibleCount,
|
||||
});
|
||||
const start = initialScrollIndex ?? 0;
|
||||
const offset = initialScrollIndex !== undefined ? offsetForIndex(initialScrollIndex) : 0;
|
||||
initialMount.current = {
|
||||
initialScrollIndex,
|
||||
offset,
|
||||
// Both iOS and Android ScrollViews apply contentOffset during native layout before first paint.
|
||||
contentOffset: isNative && offset > 0 ? { x: 0, y: offset } : undefined,
|
||||
initialVisibleRange: { first: start, last: start + Math.max(visibleCount, 1) - 1 },
|
||||
};
|
||||
}
|
||||
const initialOffset = initialMount.current.offset;
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (isWeb && initialOffset > 0) {
|
||||
listRef.current?.scrollToOffset({ offset: initialOffset, animated: false });
|
||||
}
|
||||
}, [initialOffset, listRef]);
|
||||
|
||||
return {
|
||||
initialScrollIndex: initialMount.current.initialScrollIndex,
|
||||
contentOffset: initialMount.current.contentOffset,
|
||||
initialVisibleRange: initialMount.current.initialVisibleRange,
|
||||
};
|
||||
}
|
||||
|
||||
function nextVisibleRangeAfterReveal(
|
||||
visible: VisibleRange | null,
|
||||
row: number,
|
||||
@@ -230,7 +147,6 @@ export function useRevealActiveFlatListRow<T>({
|
||||
activeIndex,
|
||||
hasHeader = false,
|
||||
waitForViewable = false,
|
||||
initialVisibleRange = null,
|
||||
listKey,
|
||||
}: {
|
||||
listRef: RefObject<FlatList<T> | null>;
|
||||
@@ -238,12 +154,9 @@ export function useRevealActiveFlatListRow<T>({
|
||||
activeIndex: number | "top" | null;
|
||||
hasHeader?: boolean;
|
||||
waitForViewable?: boolean;
|
||||
/** Seeded visible window when the list mounted at an `initialScrollIndex`. */
|
||||
initialVisibleRange?: VisibleRange | null;
|
||||
listKey?: unknown;
|
||||
}): RevealActiveFlatListHandlers<T> {
|
||||
const fullyVisibleRows = useRef<VisibleRange | null>(initialVisibleRange);
|
||||
const prevListKey = useRef(listKey);
|
||||
const fullyVisibleRows = useRef<VisibleRange | null>(null);
|
||||
const pendingReveal = useRef<number | null>(null);
|
||||
const isPendingRowMeasured = useRef(true);
|
||||
const itemCountRef = useRef(itemCount);
|
||||
@@ -309,11 +222,7 @@ export function useRevealActiveFlatListRow<T>({
|
||||
[revealPendingRow],
|
||||
);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (prevListKey.current !== listKey) {
|
||||
prevListKey.current = listKey;
|
||||
fullyVisibleRows.current = null;
|
||||
}
|
||||
useEffect(() => {
|
||||
if (activeIndex === "top") {
|
||||
pendingReveal.current = null;
|
||||
listRef.current?.scrollToOffset({ offset: 0, animated: false });
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
} from "react-native";
|
||||
import { Search, X } from "lucide-react-native";
|
||||
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||
import { ICON_SIZE, type Theme } from "@/styles/theme";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
import {
|
||||
EditingTextInput as TextInput,
|
||||
type EditingTextInputHandle,
|
||||
@@ -35,11 +35,6 @@ export interface SearchFieldProps {
|
||||
fullWidth?: boolean;
|
||||
/** `sm` heads a list in tight chrome such as a sidebar pane. */
|
||||
size?: "sm" | "md";
|
||||
/**
|
||||
* `card` matches a compact `SettingsCard` row's height, corner radius, horizontal inset, and
|
||||
* leading glyph rail so a docked sheet search aligns with the cards above it.
|
||||
*/
|
||||
variant?: "default" | "card";
|
||||
/** Escape empties the field. Off where Escape already closes the surface around it. */
|
||||
clearOnEscape?: boolean;
|
||||
testID?: string;
|
||||
@@ -61,7 +56,6 @@ export function SearchField({
|
||||
clearAccessibilityLabel,
|
||||
fullWidth = false,
|
||||
size = "md",
|
||||
variant = "default",
|
||||
clearOnEscape = false,
|
||||
testID,
|
||||
clearTestID,
|
||||
@@ -85,21 +79,17 @@ export function SearchField({
|
||||
if (value === "" && inputRef.current?.getText()) inputRef.current.replaceText("");
|
||||
}, [value]);
|
||||
const small = size === "sm";
|
||||
const card = variant === "card";
|
||||
const leadingIcon = <ThemedSearch size={ICON_SIZE.sm} uniProps={mutedColorMapping} />;
|
||||
|
||||
return (
|
||||
<View
|
||||
testID={testID ? `${testID}-container` : undefined}
|
||||
style={[
|
||||
styles.field,
|
||||
small && styles.fieldSmall,
|
||||
card && styles.fieldCard,
|
||||
fullWidth && styles.fieldFullWidth,
|
||||
isFocused && styles.fieldFocused,
|
||||
]}
|
||||
>
|
||||
{card ? <View style={styles.leadingSlot}>{leadingIcon}</View> : leadingIcon}
|
||||
<ThemedSearch size={14} uniProps={mutedColorMapping} />
|
||||
<ThemedTextInput
|
||||
testID={testID}
|
||||
ref={inputRef}
|
||||
@@ -122,9 +112,8 @@ export function SearchField({
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={clearAccessibilityLabel}
|
||||
hitSlop={8}
|
||||
style={card ? styles.clearSlot : undefined}
|
||||
>
|
||||
<ThemedX size={ICON_SIZE.sm} uniProps={mutedColorMapping} />
|
||||
<ThemedX size={14} uniProps={mutedColorMapping} />
|
||||
</Pressable>
|
||||
) : null}
|
||||
</View>
|
||||
@@ -153,25 +142,6 @@ const styles = StyleSheet.create((theme) => ({
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: theme.spacing[1.5],
|
||||
},
|
||||
fieldCard: {
|
||||
// Matches a collapsed SettingsCard row: 44pt inner row height + 1px top/bottom border = 46pt.
|
||||
height: 46,
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: { xs: theme.spacing[4], md: theme.spacing[3] },
|
||||
borderRadius: theme.borderRadius.lg,
|
||||
},
|
||||
leadingSlot: {
|
||||
width: 16,
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
},
|
||||
clearSlot: {
|
||||
width: ICON_SIZE.sm,
|
||||
height: ICON_SIZE.sm,
|
||||
marginRight: -theme.spacing[1],
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
},
|
||||
fieldFullWidth: {
|
||||
maxWidth: "100%",
|
||||
},
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
import { useWorkspaceSetupStore } from "@/stores/workspace-setup-store";
|
||||
import { normalizeAgentSnapshot } from "@/utils/agent-snapshots";
|
||||
import { applyLegacyDaemonWorkspaceOwnership } from "@/workspace/legacy-daemon-workspaces";
|
||||
import { prepareImageAttachmentsForSend } from "@/attachments/service";
|
||||
import { uploadImageAttachments } from "@/attachments/service";
|
||||
import { toErrorMessage } from "@/utils/error-messages";
|
||||
import {
|
||||
resolveComposerAttachmentSubmitFormat,
|
||||
@@ -122,7 +122,6 @@ function failureMessageForCreationMethod(
|
||||
function buildCreateAgentOptions({
|
||||
composerState,
|
||||
text,
|
||||
images,
|
||||
attachments,
|
||||
workspaceDirectory,
|
||||
workspaceId,
|
||||
@@ -135,7 +134,6 @@ function buildCreateAgentOptions({
|
||||
selectedSystemPrompt: string;
|
||||
};
|
||||
text: string;
|
||||
images?: CreateAgentRequestOptions["images"];
|
||||
attachments: NonNullable<CreateAgentRequestOptions["attachments"]>;
|
||||
workspaceDirectory: string;
|
||||
workspaceId: string;
|
||||
@@ -154,7 +152,6 @@ function buildCreateAgentOptions({
|
||||
? { systemPrompt: composerState.selectedSystemPrompt }
|
||||
: {}),
|
||||
...(text.trim() ? { initialPrompt: text.trim() } : {}),
|
||||
...(images && images.length > 0 ? { images } : {}),
|
||||
...(attachments.length > 0 ? { attachments } : {}),
|
||||
};
|
||||
}
|
||||
@@ -330,20 +327,19 @@ export function WorkspaceSetupDialog() {
|
||||
supportsForgeAttachments: supportsForgeSearch,
|
||||
}),
|
||||
});
|
||||
const imagePayload =
|
||||
const uploadedImageAttachments =
|
||||
wirePayload.images.length > 0
|
||||
? await prepareImageAttachmentsForSend({
|
||||
? await uploadImageAttachments({
|
||||
client: withConnectedClient(),
|
||||
images: wirePayload.images,
|
||||
})
|
||||
: {};
|
||||
: undefined;
|
||||
if (!pendingWorkspaceSetup) throw new Error(t("workspaceSetup.errors.pendingRequired"));
|
||||
let createdAgent: AgentSnapshotPayload | undefined;
|
||||
const { workspaceId: _workspaceId, ...agentInput } = buildCreateAgentOptions({
|
||||
composerState,
|
||||
text,
|
||||
images: imagePayload.images,
|
||||
attachments: [...wirePayload.attachments, ...(imagePayload.attachments ?? [])],
|
||||
attachments: [...wirePayload.attachments, ...(uploadedImageAttachments ?? [])],
|
||||
workspaceDirectory: cwd,
|
||||
workspaceId: "",
|
||||
provider: composerState.selectedProvider,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user