mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-19 23:05:21 +00:00
Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c09a3d81e7 | ||
|
|
8c91adeba8 | ||
|
|
0a8b7a6a1e | ||
|
|
18192dc48b | ||
|
|
162745d8e6 | ||
|
|
937a610006 | ||
|
|
2269c8a010 | ||
|
|
e0847ac82f | ||
|
|
9ba2950132 | ||
|
|
fbb7a2c094 | ||
|
|
4437186c49 | ||
|
|
4bba288c10 | ||
|
|
c48d1c1700 | ||
|
|
db3cfadc6c | ||
|
|
c54bc39e79 | ||
|
|
228e6f75ea |
+1
-22
@@ -1,26 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## 0.16.2 - 2026-11-18
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed Collapse turns hiding a finished reply when Claude answers a later background task notification ([#10092](https://github.com/getpaseo/paseo/pull/10092))
|
||||
- Fixed detached worktree commits getting lost when archiving a workspace ([#10009](https://github.com/getpaseo/paseo/pull/10009) by [@ragokan](https://github.com/ragokan))
|
||||
- Fixed Desktop updates leaving an older daemon running when an earlier Desktop session started it ([#10067](https://github.com/getpaseo/paseo/pull/10067))
|
||||
- Fixed daemons losing their Hub connection after execution permissions changed ([#10113](https://github.com/getpaseo/paseo/pull/10113))
|
||||
- Fixed saved hosts disappearing when one stored entry could not be read ([#9847](https://github.com/getpaseo/paseo/pull/9847) by [@ragokan](https://github.com/ragokan))
|
||||
- Fixed worktree creation timing out while scanning large ignored folders that `.worktreeinclude` does not name ([#10020](https://github.com/getpaseo/paseo/pull/10020) by [@mgranderath](https://github.com/mgranderath))
|
||||
- Fixed Steer cancelling a Claude compaction in progress ([#10028](https://github.com/getpaseo/paseo/pull/10028) by [@NightMachinery](https://github.com/NightMachinery))
|
||||
- Fixed agents getting stuck after a second Stop when the provider reused the cancelled turn ID ([#9774](https://github.com/getpaseo/paseo/pull/9774) by [@DAnaeto](https://github.com/DAnaeto))
|
||||
- Fixed Desktop staying blank after its renderer exited unexpectedly ([#10035](https://github.com/getpaseo/paseo/pull/10035))
|
||||
- Fixed failed file downloads taking over the app window on web and Desktop ([#9937](https://github.com/getpaseo/paseo/pull/9937) by [@panta82](https://github.com/panta82))
|
||||
- Fixed Import Session losing its scroll position when you select Load more ([#9974](https://github.com/getpaseo/paseo/pull/9974))
|
||||
- Fixed terminals failing to open when the home filesystem refuses Unix sockets, such as on AFS ([#9214](https://github.com/getpaseo/paseo/pull/9214) by [@bendavid](https://github.com/bendavid))
|
||||
- Fixed timed-out Git watchers repeatedly rescanning large repositories ([#9828](https://github.com/getpaseo/paseo/pull/9828) by [@Spshulem](https://github.com/Spshulem))
|
||||
- Fixed `paseo workspace create --path .` using the local daemon's directory instead of the caller's ([#10010](https://github.com/getpaseo/paseo/pull/10010))
|
||||
- Fixed MCP agent status and list responses omitting background work for idle agents ([#10022](https://github.com/getpaseo/paseo/pull/10022) by [@ortschun](https://github.com/ortschun))
|
||||
- Fixed the thinking selector showing an old level after OMP changes it ([#9841](https://github.com/getpaseo/paseo/pull/9841) by [@dsingal0](https://github.com/dsingal0))
|
||||
|
||||
## 0.16.1 - 2026-11-17
|
||||
|
||||
### Fixed
|
||||
@@ -44,7 +23,6 @@
|
||||
- **Plugin sidebar views:** Plugins can replace the sidebar with their own workspace and agent layout across connected hosts. Choose a view per device in Settings → Sidebar. ([#8906](https://github.com/getpaseo/paseo/pull/8906))
|
||||
- **Plugin composer controls:** Plugins can add composer controls, edit drafts and attachments, and change agent settings. They can also add New workspace items and save metadata on agents and workspaces. ([#8744](https://github.com/getpaseo/paseo/pull/8744), [#9209](https://github.com/getpaseo/paseo/pull/9209), [#9207](https://github.com/getpaseo/paseo/pull/9207), [#9734](https://github.com/getpaseo/paseo/pull/9734) by [@michaelmwu](https://github.com/michaelmwu))
|
||||
- **Arrange Usage cards:** Drag provider cards into your preferred order and turn off cards you do not want in the sidebar summary. Choose the host from Usage settings. ([#9660](https://github.com/getpaseo/paseo/pull/9660), [#9740](https://github.com/getpaseo/paseo/pull/9740), [#9748](https://github.com/getpaseo/paseo/pull/9748), [#9780](https://github.com/getpaseo/paseo/pull/9780))
|
||||
- **fx provider:** Run [fx](https://paseo.sh/docs/supported-providers/fx), the coding agent from Vercel Labs, in Paseo. Add it from the provider catalog in Settings → Hosts → Providers. ([#9160](https://github.com/getpaseo/paseo/pull/9160))
|
||||
- **Quieter app reopening:** Returning to an unchanged chat no longer flashes “Updating messages.” Paseo keeps healthy connections open and recovers dropped connections when you return. After reconnecting, an up-to-date chat no longer shows an extra update toast. ([#9242](https://github.com/getpaseo/paseo/pull/9242), [#8651](https://github.com/getpaseo/paseo/pull/8651), [#9086](https://github.com/getpaseo/paseo/pull/9086), [#8855](https://github.com/getpaseo/paseo/pull/8855), [#9116](https://github.com/getpaseo/paseo/pull/9116), [#9558](https://github.com/getpaseo/paseo/pull/9558) by [@adamcstephens](https://github.com/adamcstephens))
|
||||
- **Rebuilt mobile chat:** Expanding turn summaries, todo cards and tool groups keeps your reading position on iOS and Android. Sending during a scroll moves to the new prompt. ([#8717](https://github.com/getpaseo/paseo/pull/8717), [#9085](https://github.com/getpaseo/paseo/pull/9085), [#9806](https://github.com/getpaseo/paseo/pull/9806), [#9693](https://github.com/getpaseo/paseo/pull/9693))
|
||||
- **Faster diff loading:** Changes shows the file tree before file contents finish loading. Large diffs load in batches and take priority over background worktree scans. ([#8907](https://github.com/getpaseo/paseo/pull/8907), [#9241](https://github.com/getpaseo/paseo/pull/9241), [#9243](https://github.com/getpaseo/paseo/pull/9243), [#9584](https://github.com/getpaseo/paseo/pull/9584))
|
||||
@@ -58,6 +36,7 @@
|
||||
- Added a Change base picker for worktree diffs, commits and Git actions ([#8642](https://github.com/getpaseo/paseo/pull/8642), [#8934](https://github.com/getpaseo/paseo/pull/8934) by [@Myasuka](https://github.com/Myasuka))
|
||||
- Added issue and pull request links that resolve SSH aliases and fork parent repositories ([#8636](https://github.com/getpaseo/paseo/pull/8636), [#9576](https://github.com/getpaseo/paseo/pull/9576))
|
||||
- Added an iPhone Duo layout with the sidebar and workspace on opposite sides of the fold ([#8741](https://github.com/getpaseo/paseo/pull/8741), [#8901](https://github.com/getpaseo/paseo/pull/8901) by [@zeyugao](https://github.com/zeyugao))
|
||||
- Added fx as a provider you can add from the provider catalog in Settings → Hosts → Providers ([#9160](https://github.com/getpaseo/paseo/pull/9160))
|
||||
- Added background agents that stay out of tabs, notifications and default agent lists ([#8683](https://github.com/getpaseo/paseo/pull/8683))
|
||||
- Added syntax highlighting for Terraform and HCL files (`.tf`, `.tfvars`, `.hcl`) ([#9106](https://github.com/getpaseo/paseo/pull/9106))
|
||||
- Added `PASEO_WORKSPACE_ID` to each agent's environment so an agent can identify, rename or archive its own workspace ([#8939](https://github.com/getpaseo/paseo/pull/8939) by [@DTTerastar](https://github.com/DTTerastar))
|
||||
|
||||
+1
-22
@@ -1,26 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## 0.16.2 - 2026-11-18
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复启用“折叠轮次”时,Claude 回复后续后台任务通知导致上一条已完成的回复被折叠的问题 ([#10092](https://github.com/getpaseo/paseo/pull/10092))
|
||||
- 修复归档工作区时丢失分离 HEAD 的 worktree 提交的问题 ([#10009](https://github.com/getpaseo/paseo/pull/10009),贡献者:[@ragokan](https://github.com/ragokan))
|
||||
- 修复 Desktop 更新后,由上一次 Desktop 会话启动的旧版 daemon 仍在运行的问题 ([#10067](https://github.com/getpaseo/paseo/pull/10067))
|
||||
- 修复更改执行权限后 daemon 与 Hub 断开连接的问题 ([#10113](https://github.com/getpaseo/paseo/pull/10113))
|
||||
- 修复一条已保存的主机记录无法读取时,其他主机也消失的问题 ([#9847](https://github.com/getpaseo/paseo/pull/9847),贡献者:[@ragokan](https://github.com/ragokan))
|
||||
- 修复创建 worktree 时,扫描 `.worktreeinclude` 未指定的大型忽略目录导致超时的问题 ([#10020](https://github.com/getpaseo/paseo/pull/10020),贡献者:[@mgranderath](https://github.com/mgranderath))
|
||||
- 修复发送引导消息时取消 Claude 正在进行的上下文压缩的问题 ([#10028](https://github.com/getpaseo/paseo/pull/10028),贡献者:[@NightMachinery](https://github.com/NightMachinery))
|
||||
- 修复 Provider 重用已取消的轮次 ID 时,再次停止导致 Agent 卡住的问题 ([#9774](https://github.com/getpaseo/paseo/pull/9774),贡献者:[@DAnaeto](https://github.com/DAnaeto))
|
||||
- 修复 Desktop 渲染进程意外退出后窗口一直空白的问题 ([#10035](https://github.com/getpaseo/paseo/pull/10035))
|
||||
- 修复 Web 和 Desktop 上文件下载失败时,错误页面占据应用窗口的问题 ([#9937](https://github.com/getpaseo/paseo/pull/9937),贡献者:[@panta82](https://github.com/panta82))
|
||||
- 修复在“导入会话”中选择“加载更多”时丢失滚动位置的问题 ([#9974](https://github.com/getpaseo/paseo/pull/9974))
|
||||
- 修复主目录所在的文件系统拒绝 Unix 套接字时无法打开终端的问题,例如 AFS ([#9214](https://github.com/getpaseo/paseo/pull/9214),贡献者:[@bendavid](https://github.com/bendavid))
|
||||
- 修复 Git 监视器设置超时后反复扫描大型仓库的问题 ([#9828](https://github.com/getpaseo/paseo/pull/9828),贡献者:[@Spshulem](https://github.com/Spshulem))
|
||||
- 修复 `paseo workspace create --path .` 使用本地 daemon 的目录而非命令所在目录的问题 ([#10010](https://github.com/getpaseo/paseo/pull/10010))
|
||||
- 修复针对空闲 Agent 查询 MCP 状态或列表时漏报后台任务的问题 ([#10022](https://github.com/getpaseo/paseo/pull/10022),贡献者:[@ortschun](https://github.com/ortschun))
|
||||
- 修复 OMP 更改思考级别后,选择器仍显示旧级别的问题 ([#9841](https://github.com/getpaseo/paseo/pull/9841),贡献者:[@dsingal0](https://github.com/dsingal0))
|
||||
|
||||
## 0.16.1 - 2026-11-17
|
||||
|
||||
### 修复
|
||||
@@ -44,7 +23,6 @@
|
||||
- **插件侧边栏视图**:插件可以用自己的布局替换侧边栏,展示已连接主机上的工作区和 Agent。在“设置 → 侧边栏”中为每台设备选择视图。 ([#8906](https://github.com/getpaseo/paseo/pull/8906))
|
||||
- **插件 Composer 控件**:插件可以添加 Composer 控件、编辑草稿和附件,以及更改 Agent 设置。插件还可以添加“新建工作区”条目,并在 Agent 和工作区上保存元数据。 ([#8744](https://github.com/getpaseo/paseo/pull/8744), [#9209](https://github.com/getpaseo/paseo/pull/9209), [#9207](https://github.com/getpaseo/paseo/pull/9207), [#9734](https://github.com/getpaseo/paseo/pull/9734),贡献者:[@michaelmwu](https://github.com/michaelmwu))
|
||||
- **排列用量卡片**:拖动 Provider 卡片来调整顺序,并关闭不想在侧边栏摘要中显示的卡片。在用量设置中选择主机。 ([#9660](https://github.com/getpaseo/paseo/pull/9660), [#9740](https://github.com/getpaseo/paseo/pull/9740), [#9748](https://github.com/getpaseo/paseo/pull/9748), [#9780](https://github.com/getpaseo/paseo/pull/9780))
|
||||
- **fx Provider**:在 Paseo 中运行 Vercel Labs 的编程 Agent [fx](https://paseo.sh/zh-CN/docs/supported-providers/fx)。在“设置 → Hosts → 提供方”的 Provider 目录中添加。 ([#9160](https://github.com/getpaseo/paseo/pull/9160))
|
||||
- **返回应用时更少提示**:返回没有变化的聊天时,不再闪现“正在更新消息”。Paseo 会保留可用的连接,并在你返回时恢复断开的连接。重连后,已是最新状态的聊天也不再显示额外的更新提示。 ([#9242](https://github.com/getpaseo/paseo/pull/9242), [#8651](https://github.com/getpaseo/paseo/pull/8651), [#9086](https://github.com/getpaseo/paseo/pull/9086), [#8855](https://github.com/getpaseo/paseo/pull/8855), [#9116](https://github.com/getpaseo/paseo/pull/9116), [#9558](https://github.com/getpaseo/paseo/pull/9558),贡献者:[@adamcstephens](https://github.com/adamcstephens))
|
||||
- **重建移动端聊天**:在 iOS 和 Android 上展开轮次摘要、待办卡片和工具组时,阅读位置保持不变。滚动期间发送消息会移到新提示词处。 ([#8717](https://github.com/getpaseo/paseo/pull/8717), [#9085](https://github.com/getpaseo/paseo/pull/9085), [#9806](https://github.com/getpaseo/paseo/pull/9806), [#9693](https://github.com/getpaseo/paseo/pull/9693))
|
||||
- **更快的 diff 加载**:“更改”在文件内容加载完成前先显示文件树。大型 diff 分批加载,且优先于后台 worktree 扫描。 ([#8907](https://github.com/getpaseo/paseo/pull/8907), [#9241](https://github.com/getpaseo/paseo/pull/9241), [#9243](https://github.com/getpaseo/paseo/pull/9243), [#9584](https://github.com/getpaseo/paseo/pull/9584))
|
||||
@@ -58,6 +36,7 @@
|
||||
- 为 worktree 的 diff、提交和 Git 操作新增基准分支选择器(Change base) ([#8642](https://github.com/getpaseo/paseo/pull/8642), [#8934](https://github.com/getpaseo/paseo/pull/8934),贡献者:[@Myasuka](https://github.com/Myasuka))
|
||||
- 新增可解析 SSH 别名和 fork 上游仓库的 Issue 和 PR 链接 ([#8636](https://github.com/getpaseo/paseo/pull/8636), [#9576](https://github.com/getpaseo/paseo/pull/9576))
|
||||
- 新增 iPhone Duo 布局,侧边栏和工作区分列折痕两侧 ([#8741](https://github.com/getpaseo/paseo/pull/8741), [#8901](https://github.com/getpaseo/paseo/pull/8901),贡献者:[@zeyugao](https://github.com/zeyugao))
|
||||
- 新增 fx Provider,可在“设置 → Hosts → 提供方”的 Provider 目录中添加 ([#9160](https://github.com/getpaseo/paseo/pull/9160))
|
||||
- 新增后台 Agent,不占用标签页、不发送通知,也不出现在默认 Agent 列表中 ([#8683](https://github.com/getpaseo/paseo/pull/8683))
|
||||
- 新增 Terraform 和 HCL 文件(`.tf`、`.tfvars`、`.hcl`)的语法高亮 ([#9106](https://github.com/getpaseo/paseo/pull/9106))
|
||||
- 在每个 Agent 的环境中新增 `PASEO_WORKSPACE_ID`,Agent 可据此识别、重命名或归档自己的工作区 ([#8939](https://github.com/getpaseo/paseo/pull/8939),贡献者:[@DTTerastar](https://github.com/DTTerastar))
|
||||
|
||||
@@ -91,12 +91,8 @@ You need at least one agent CLI installed and configured with your credentials:
|
||||
- [GitHub Copilot](https://github.com/features/copilot/cli/)
|
||||
- [OpenCode](https://github.com/anomalyco/opencode)
|
||||
- [Pi](https://pi.dev)
|
||||
- [Antigravity](https://paseo.sh/docs/supported-providers/antigravity)
|
||||
- [Muse Code](https://paseo.sh/docs/supported-providers/muse-code)
|
||||
- [fx](https://paseo.sh/docs/supported-providers/fx)
|
||||
- [Hoplite](https://paseo.sh/docs/supported-providers/hoplite)
|
||||
|
||||
Paseo also runs Cursor, Gemini CLI, and many other agents. See [Supported providers](https://paseo.sh/docs/supported-providers) for the full list and setup steps.
|
||||
- [Antigravity](https://paseo.sh/docs/supported-providers#antigravity)
|
||||
- [Muse Code](https://paseo.sh/docs/muse-code)
|
||||
|
||||
### Desktop app (recommended)
|
||||
|
||||
|
||||
@@ -150,13 +150,12 @@ Users can also detach an existing subagent from the subagents track. Detach is d
|
||||
|
||||
`notifyOnFinish` defaults to `true` for agent-scoped creation and prompt follow-ups because most delegated work needs to report back to the creating agent. Set it to `false` for explicit reporting or no completion callback.
|
||||
|
||||
Agent-originated messages and automatic notifications share a recipient-daemon delivery module. A queued receipt acknowledges admission before provider dispatch. Idle recipients retain the two-second quiet window. While a recipient has a running or starting turn (including compaction), messages stay queued across quiet windows and are delivered together after that turn settles, including failure or cancellation. A ready batch is released when the daemon observes the recipient settle; the two-second timer also retries it. Agent callers using `steer`, including the default, wait for the turn to end; only explicit `interrupt` replaces a running turn. An explicit interrupt or a command the provider accepts out of band runs before earlier queued messages. Those messages stay queued and are delivered after the running or replacement turn ends. Human prompts dispatch directly with their existing behavior. Conflicting session-mode choices retain separate ordered dispatches.
|
||||
Agent-originated messages and automatic notifications share a recipient-daemon delivery module. A queued receipt acknowledges admission before provider dispatch, allowing a child to report and finish in the same two-second quiet window. Human prompts dispatch directly. Conflicting explicit interruption or session-mode choices retain separate ordered dispatches.
|
||||
|
||||
The pending message window is in memory. Clean shutdown flushes it before closing agents; an abrupt
|
||||
crash can lose queued prompts. A durable send receipt remains pending until actual dispatch
|
||||
acknowledgment, so a lost window never becomes a completed receipt. Completion waits cover queued
|
||||
admission within their original timeout and cancellation scope, and return permission checkpoints
|
||||
while messages are waiting.
|
||||
admission within their original timeout and cancellation scope.
|
||||
|
||||
Finish notification intent has a separate daemon-owned lifetime. The finish-subscriptions module
|
||||
persists caller, child, host, and ownership policy through an injectable store; its JSON adapter uses
|
||||
|
||||
@@ -163,16 +163,8 @@ override a scroll away because they can arrive after the action that requested t
|
||||
|
||||
### Draw distance
|
||||
|
||||
The native timeline starts with one window-height of draw distance, up to 2000 px. This keeps
|
||||
nearby rows ready for a fling during placement. Once the chat is placed, history is visible, and
|
||||
the sidebar has settled, the timeline schedules expansion to 2000 px through two frame callbacks.
|
||||
The callbacks leave time for the reveal to paint. Verify the actual reveal on the device.
|
||||
A drag cancels a pending expansion and uses the existing buffer as the window moves. Expansion
|
||||
resumes when the gesture settles, including momentum. In an Android emulator capture, expanding
|
||||
the full buffer during the first fling changed the measured content height and returned the chat
|
||||
to the end mid-fling.
|
||||
A fling over rows that were never measured blanks the viewport
|
||||
until LegendList renders and measures them. Twelve flings over a chat with a
|
||||
`drawDistance` is 2000 px on each side of the viewport. A fling over rows that were never measured
|
||||
blanks the viewport until LegendList renders and measures them. Twelve flings over a chat with a
|
||||
15,000 px turn expanded, Android emulator, dev build:
|
||||
|
||||
| List | Blank viewport | Janky frames | p50 / p90 / p99 |
|
||||
@@ -187,8 +179,9 @@ With every turn collapsed, flinging from a cold open into history did not blank
|
||||
|
||||
### LegendList patch
|
||||
|
||||
`patches/@legendapp+list+3.7.1.patch` lists its changes by purpose.
|
||||
[legend-list #593](https://github.com/LegendApp/legend-list/issues/593) reports the first twelve.
|
||||
`patches/@legendapp+list+3.7.1.patch` carries twelve changes for the timeline. Its header lists
|
||||
them by purpose, and
|
||||
[legend-list #593](https://github.com/LegendApp/legend-list/issues/593) reports each upstream.
|
||||
Drop a hunk when the installed LegendList ships its fix.
|
||||
|
||||
### Scroll view corrections
|
||||
|
||||
@@ -121,14 +121,6 @@ from `packages/app/android`:
|
||||
|
||||
These check terminal arrow ownership, held-key repeats and modifiers, and ordinary text-field editing.
|
||||
|
||||
Run the display density regression tests the same way:
|
||||
|
||||
```bash
|
||||
./gradlew :paseo-display-metrics:connectedDebugAndroidTest --no-daemon --max-workers=2 -Dorg.gradle.parallel=false
|
||||
```
|
||||
|
||||
These check that React Native sizes text at the window's density when the window is on another display, such as Samsung DeX.
|
||||
|
||||
### Diagnostic logs without ADB
|
||||
|
||||
In a dogfood build, open Android's Files app → Downloads → **Paseo diagnostics** and share all
|
||||
|
||||
@@ -506,5 +506,5 @@ Agent and terminal environments are unchanged. System proxy settings and SOCKS-o
|
||||
## Deployment models
|
||||
|
||||
1. **Local daemon** (default): `paseo daemon start` on `127.0.0.1:6767`
|
||||
2. **Managed desktop**: Electron uses the server package’s local-instance lifecycle capability for sanitized launch, published readiness, and captured-PID stop. Only Desktop's own launch writes `desktopManaged: true` to `paseo.pid`. The CLI launch path removes the flag. While Desktop manages the built-in daemon, an app update or a version mismatch replaces any `desktopManaged` daemon, including one that an earlier Desktop session left running. Bundled CLIs before v0.9.0 exported the flag, so a daemon that one of them started also carries it and is replaced. Quit, Settings, and host removal stop only a daemon that the current session launched, matched by `{pid, startedAt}`. A daemon that the user started through the CLI is attach-only. Explicit attached Stop requires a confirmation naming the captured home/PID. Ordinary Restart uses the worker RPC on every app platform.
|
||||
2. **Managed desktop**: Electron uses the server package’s local-instance lifecycle capability for sanitized launch, published readiness, and captured-PID stop. Only a matching `{pid, startedAt}` from a spawn in the current Desktop session authorizes automatic stop or binary replacement. Preexisting instances, including legacy `desktopManaged` records, are attach-only. Keep-running survivors attach in the next session. Explicit attached Stop requires a confirmation naming the captured home/PID. Ordinary Restart uses the worker RPC on every app platform.
|
||||
3. **Remote + relay**: Daemon behind firewall, relay bridges with E2E encryption
|
||||
|
||||
@@ -117,10 +117,7 @@ There is no renderer prep/restore handshake or lifetime background-throttling ov
|
||||
Screenshot capture temporarily enables frame production inside the shared serialized queue,
|
||||
restores the previous throttling policy on success or failure, and retains a 5-second capture budget.
|
||||
The browser tool takes one viewport frame through Electron's frame subscription and releases the
|
||||
subscription on completion or cancellation. Guest pages have a transparent base background, so a page
|
||||
that has painted nothing yet (a dev server hiding `body` until its JS boots) produces frames where
|
||||
every pixel is transparent. Both screenshot paths skip those frames and return `screenshot_no_frame`
|
||||
when the capture budget expires without a painted one. A resized resident guest can produce fresh pixels
|
||||
subscription on completion or cancellation. A resized resident guest can produce fresh pixels
|
||||
while `capturePage()` leaves its surface-copy request pending; waiting for animation frames or
|
||||
retrying the copy does not repair that state. Full-page screenshots retain the CDP path with layout
|
||||
metrics and screenshot clip.
|
||||
|
||||
@@ -590,16 +590,6 @@ bookkeeping may scan opaque row sizes during a deferred write, never during host
|
||||
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
|
||||
|
||||
**AsyncStorage key:** `@paseo:daemon-registry`, an array of host profiles.
|
||||
|
||||
Every app build on a device shares this key, including an older build after a downgrade and a newer
|
||||
one that saves a connection kind this build doesn't know. The key holds every saved host and its
|
||||
password, so never remove it. Read each host and connection on its own, skip the ones this build
|
||||
can't read, and write them back on every save. A value that isn't a JSON array is copied to
|
||||
`@paseo:daemon-registry:unreadable` before the next save overwrites it.
|
||||
|
||||
### Draft Store
|
||||
|
||||
**AsyncStorage key:** `paseo-drafts` (version 2)
|
||||
|
||||
@@ -6,7 +6,7 @@ Do not replace the Linux implementation with `fs.watch({ recursive: true })`. No
|
||||
|
||||
Closing an observation must remain safe after its root is renamed or removed. Workspace archive removes owned worktrees while releasing observation references, so teardown cannot assume the watched path still exists.
|
||||
|
||||
`unsubscribe()` is an awaited barrier. Once it resolves, no scan, reconciliation, queued event, native handle, or callback may remain. `updateIgnore()` is the equivalent barrier for excluded paths: events queued below a newly excluded root cannot be delivered after it resolves. Treat path disappearance while scanning, attaching, or receiving a watcher error as rename/archive churn. Surface permission and resource errors so WorkspaceGit can enter bounded polling. `subscribe()` accepts an abort signal; aborting it before it resolves stops the startup scan and rejects. WorkspaceGit aborts every subscription that misses its setup deadline, because an abandoned scan otherwise keeps walking the tree. A timed-out directory retries on the recovery ladder (30 seconds doubling to five minutes), and each consecutive timeout keeps doubling the delay up to one hour. Under sustained CPU load the next scan misses the deadline too, and each attempt repeats the full scan. An accepted subscription resets the timeout streak. Degraded polling keeps its own cadence throughout.
|
||||
`unsubscribe()` is an awaited barrier. Once it resolves, no scan, reconciliation, queued event, native handle, or callback may remain. `updateIgnore()` is the equivalent barrier for excluded paths: events queued below a newly excluded root cannot be delivered after it resolves. Treat path disappearance while scanning, attaching, or receiving a watcher error as rename/archive churn. Surface permission and resource errors so WorkspaceGit can enter bounded polling.
|
||||
|
||||
Linux topology repair is trailing-debounced and scoped to the renamed path. A file rename needs one classification stat; a new or moved directory scans only its subtree. Full-tree scans are reserved for startup and ignore-set replacement. A subscription reports changes after `subscribe()` resolves, not the files that already existed. macOS FSEvents can still replay writes made moments before the stream started. Consumers read their initial state after `subscribe()` resolves; WorkspaceGit re-reads its checkout once observation setup completes, because its first refresh runs in parallel with setup. The Linux startup scan therefore emits nothing; only a scoped reconciliation of new topology reports files found before their directory's watcher was installed. Startup creates made every cold diff compute and discard a first revision. Benchmark startup cost with pre-populated trees.
|
||||
|
||||
|
||||
@@ -20,14 +20,6 @@ input focused while its scrollable list lives in a Portal. There is no shared
|
||||
"floating panel" primitive yet — when a fifth use case shows up we can revisit;
|
||||
until then prefer copying the closest file and trimming.
|
||||
|
||||
## Picker trigger tooltips
|
||||
|
||||
Keep the picker surface outside `TooltipTrigger`. React focus events bubble
|
||||
through portals, so putting the surface inside the trigger makes focus in its
|
||||
search field look like focus on the button when a shortcut opens the picker.
|
||||
For new `ComboboxTrigger` buttons, pass the hint through the `tooltip` prop. An
|
||||
explicit `TooltipTrigger` wrapper is also safe when it wraps only the button.
|
||||
|
||||
## Popover width contract
|
||||
|
||||
Combobox desktop popovers are never narrower than their trigger, and they grow
|
||||
|
||||
@@ -99,10 +99,8 @@ Register the adapter in `defaultForgeRegistry` with:
|
||||
|
||||
Current change-request lookup matches the branch and repository for both open and
|
||||
terminal requests. Prefer an open request, then a terminal request at the local
|
||||
HEAD, then the most recently updated terminal request. When the forge identifies
|
||||
the checkout's branch as the origin repository's default branch, only open
|
||||
requests are eligible. A reused feature branch can show its previous request
|
||||
until a new one opens. Auto-archive separately requires an
|
||||
HEAD, then the most recently updated terminal request. A reused branch can show
|
||||
its previous request until a new one opens. Auto-archive separately requires an
|
||||
observed open-to-merged transition and a fresh exact match between checkout HEAD
|
||||
and the PR head, along with the existing workspace safety checks.
|
||||
|
||||
|
||||
+2
-3
@@ -6,7 +6,7 @@ Authoritative terminology. UI label wins. Don't invent synonyms; use what's here
|
||||
- **Workspace** — One concrete `cwd` on one daemon, with git state; belongs to exactly one project. Its `id` is opaque workspace identity; its `cwd` is the filesystem directory. UI: "Workspace". Code: `WorkspaceDescriptorPayload` (`packages/protocol/src/messages.ts:2178`). Don't confuse with: Branch (one branch can back many workspaces via worktrees). Forbidden: "Folder", "Directory" as UI label.
|
||||
- **Archive workspace** — Removes one workspace from active use and archives everything it owns. UI, CLI, and MCP always say "Archive workspace", regardless of backing. The daemon leaves ordinary directories intact and removes a Paseo-owned worktree only when no active workspace still references it.
|
||||
- **Workspace kind** — `"directory" | "local_checkout" | "worktree"`. The git-derived, persisted property of a workspace, used across its lifetime (archive safety, sidebar, grouping). Derived from the cwd's git reality by `deriveWorkspaceKind` in `workspace-registry-model.ts`, not stored from a user choice. Don't confuse with **Isolation** (the create-time intent).
|
||||
- **Isolation** — Create-time choice for a new workspace, with three options: work in the project's own directory (**Project directory**), cut a dedicated git worktree (**New worktree**), or work in a git worktree already on disk (**Existing worktree**). A transient setup input; Project directory and New worktree are also remembered as a create-form preference. It is not a workspace property. UI: "Isolation" control on the New Workspace screen. Code: `isolation` (`"local" | "worktree"`), `useWorkspaceIsolation` (`packages/app/src/screens/new-workspace-screen.tsx`); persisted as `FormPreferences.isolation` (`packages/app/src/create-agent-preferences/preferences.ts`). Existing worktree is not a third value: it is `local` with the worktree's path as the source directory (`existingWorktreePath` in `packages/app/src/screens/new-workspace/setup-model.ts`), so plugins, preferences, and the wire see `local`. Distinct from **Workspace kind**, which is the git-derived property the intent produces (Project directory → `local_checkout` or `directory` by git-ness; New worktree and Existing worktree → `worktree`). On the wire it is the create request's `source.kind` (`directory | worktree`, `packages/protocol/src/messages.ts`). Forbidden: "Local" as the UI label.
|
||||
- **Isolation** — Create-time choice for a new workspace: reuse the existing checkout (**Local**) or cut a dedicated git worktree (**New worktree**). A transient setup input, also remembered as a create-form preference; it is not a workspace property. UI: "Isolation" control on the New Workspace screen. Code: `isolation` (`"local" | "worktree"`), `useWorkspaceIsolation` (`packages/app/src/screens/new-workspace-screen.tsx`); persisted as `FormPreferences.isolation` (`packages/app/src/create-agent-preferences/preferences.ts`). Distinct from **Workspace kind**, which is the git-derived property the intent produces (Local → `local_checkout` or `directory` by git-ness; New worktree → `worktree`). On the wire it is the create request's `source.kind` (`directory | worktree`, `packages/protocol/src/messages.ts:1693`).
|
||||
- **Agent** — See **Agent session**. UI still says "Agent" / "New Agent" in places, but moving toward **Agent session** as the canonical term. Code: `AgentSnapshotPayload` (`packages/protocol/src/messages.ts:608`). Forbidden: "Task", "Job", "Run".
|
||||
- **Daemon** — Local Paseo server process; identified by `serverId`. UI: "Daemon" (system contexts only). Code: `serverId` in `ServerInfoStatusPayloadSchema` (`packages/protocol/src/messages.ts:1936`), `DaemonClient` (`packages/client/src/daemon-client.ts`).
|
||||
- **Host** — Client-side connection profile pointing at a daemon; bundles one or more `HostConnection`s. UI: "Host" / "Add host" / "Switch host". Code: `HostProfile` (`packages/app/src/types/host-connection.ts:37`). Forbidden: "Connection" (means `HostConnection`, not host).
|
||||
@@ -17,8 +17,7 @@ Authoritative terminology. UI label wins. Don't invent synonyms; use what's here
|
||||
- **Forge** — Git hosting service behind Paseo's change-request features: GitHub, GitLab, Gitea, Forgejo, or a future registered adapter. Code: `ForgeService`, `forge-registry`, `forge-resolver`. Use `forge` for internal abstraction and registry IDs; use concrete forge names only when a behavior or RPC is forge-specific.
|
||||
- **Change request** — Forge-neutral term for a proposed branch-to-branch code change. UI normally renders the forge noun instead: GitHub/Gitea/Forgejo "PR", GitLab "MR". Code: `forge_change_request` attachments, `checkoutSource: { kind: "change_request" }`, and PR/MR status payloads.
|
||||
- **MR** — GitLab merge request. UI label for GitLab change requests only; do not use MR for GitHub/Gitea/Forgejo.
|
||||
- **Worktree** — A git worktree: any working directory that `git worktree list` reports for the repository, whoever created it. Paseo creates its own under `$PASEO_HOME/worktrees/` and owns their setup and removal; worktrees made with `git worktree add` are listed by the Existing worktree picker but never removed by Paseo. Also a `workspaceKind` value. Code: `checkout.worktrees.list` RPC (`listGitWorktrees` in `packages/server/src/utils/worktree.ts`), gated on `server_info.features.checkoutWorktreeList`. Code and `paseo.json` retain worktree terminology for git lifecycle implementation. Don't confuse with: **Workspace** (Paseo's place for a task; several workspaces can work in one worktree, and a worktree with no workspace is still a worktree). Forbidden: "Checkout" as a product synonym.
|
||||
- **Branch off / Check out** — What a New worktree does with the branch or pull request picked in the ref picker. **Branch off** starts a new branch from it; **Check out** works on that branch itself. Branches default to Branch off and pull requests to Check out; the user can switch either. Branching off a pull request starts the new branch at the pull request's head with no upstream. Git keeps a branch in one worktree at a time, so checking out a branch another worktree holds sends the user to that worktree instead of creating a copy. Code: `RefAction` (`packages/app/src/screens/new-workspace-picker-item.ts`), the worktree source's `action` (`"branch-off" | "checkout"`), gated on `server_info.features.worktreeRefActions`.
|
||||
- **Worktree** — Paseo-managed git worktree (`~/.paseo/worktrees/{name}`); also a `workspaceKind` value. User-facing creation treats it as the `worktree` workspace isolation choice. Code and `paseo.json` retain worktree terminology for git lifecycle implementation. Forbidden: "Checkout" as a product synonym.
|
||||
- **Repository / Remote** — Internal Git observations. They may produce mutable kind, branch, and project-grouping metadata but never the host-local project ID, root, display name, or workspace membership. No UI label.
|
||||
- **Sidebar items** — The configurable entries of the app sidebar, in two sections. Header: the rows at the head of the sidebar — New workspace, History, Search, Schedules, and plugin header items. Footer: the full-width rows between Add project and the footer icon row — Usage and plugin footer items. Add project and the icon row (Hosts, Help and support, Settings) are fixed and are not sidebar items. A plugin item may render several rows, such as one per bot; it is still one item that moves and hides as a block. Each section's order and visibility is one per-device preference (`AppSettings.sidebarNavItems`, `AppSettings.sidebarFooterItems`); every item may be off. UI: the Header and Footer cards on the Sidebar settings page. Code: `packages/app/src/sidebar-nav/model.ts` resolves a section, and the sidebar (`components/sidebar/sidebar-nav-rows.tsx`, the footer in `components/left-sidebar.tsx`) and the settings page (`screens/settings/sidebar/sidebar-nav-section.tsx`) read it through `useSidebarNavItems(section)`. Never hardcode one of these entries or add a second place that decides which ones show. Don't confuse with **Explorer sidebar**.
|
||||
- **Explorer sidebar** — The dedicated navigation dock containing the Files and Changes trees. UI: "Explorer sidebar". Code: `packages/app/src/workspace-tabs/explorer-sidebar.ts`; persisted pane identifiers retain the `explorer` spelling. See [explorer-sidebar.md](explorer-sidebar.md).
|
||||
|
||||
@@ -24,7 +24,7 @@ Math and video are disabled. Task lists and admonitions are enabled; task checkb
|
||||
|
||||
Mermaid fences use the existing isolated diagram runtime and fullscreen viewer. Web dispatches them through the library’s code-block override. Native has no block-renderer hook, so the renderer extracts only Mermaid fences and places the existing WebView host between library-rendered segments. This is the only block exception; see [native selection limitations](native-text-selection.md) for diagram grouping and leading inline images. Streaming keeps the last valid diagram visible while the next revision renders.
|
||||
|
||||
Native code blocks use the library's copy control and compiled grammars. Web code blocks use `HighlightedCodeBlock` through the library's `renderers.codeBlock` override. Selection copy has to tell links Paseo recognized in the text (paths, forge references, code spans) from links in the Markdown, so the web link renderer marks the recognized ones. Plain-text paste carries them as the text the reply showed, and rich paste keeps them as links only when they point to an `http` or `https` URL. Authored links and parser autolinks such as a bare `www.example.com` copy as links. The patch also keeps the library's block spacing around the web code block override, preserves web list numbering and link titles, marks pending parses with `aria-busy` so Find waits for rendered text, and carries link syntax through native and web tap events. Web inline code inside a link inherits only the link colour; its code font, size and background stay intact. Keep link variants colour-only: native pills replace text runs and prevent paths from wrapping; Android pills also use the surrounding block’s font size. The package patch is tracked by [upstream PR #997](https://github.com/software-mansion/enriched-markdown/pull/997); remove the patch when the pinned release includes it.
|
||||
Native code blocks use the library's copy control and compiled grammars. Web code blocks use `HighlightedCodeBlock` through the library's `renderers.codeBlock` override. The patch also keeps the library's block spacing around the web code block override, preserves web list numbering and link titles, marks pending parses with `aria-busy` so Find waits for rendered text, and carries link syntax through native and web tap events. Web inline code inside a link inherits only the link colour; its code font, size and background stay intact. Keep link variants colour-only: native pills replace text runs and prevent paths from wrapping; Android pills also use the surrounding block’s font size. The package patch is tracked by [upstream PR #997](https://github.com/software-mansion/enriched-markdown/pull/997); remove the patch when the pinned release includes it.
|
||||
|
||||
The package patch also keeps overflowing native horizontal blocks in control of their drags: Android claims parent interception at touch-down and releases it for vertical drags so the chat list can scroll; iOS keeps its scroll recognizer active for outward drags at the leading edge. This prevents compact sidebar pans from taking block scrolling without changing sidebar swipes on prose or non-overflowing blocks. Native changes require a client rebuild.
|
||||
|
||||
|
||||
@@ -49,21 +49,6 @@ restarting the process. It writes snapshots and native failure state under
|
||||
production package. This needs a native rebuild when the Unistyles patch changes; a Metro
|
||||
reload cannot update it.
|
||||
|
||||
To check the first Android composer tap after pinch-to-zoom, install the rebuilt
|
||||
APK and connect it to a chat whose latest assistant message contains a visible
|
||||
Markdown image. For example, put `picture.png` in the agent workspace and have
|
||||
the assistant reply with ``. Set `CHAT_URL` to the
|
||||
chat's Paseo deep link and run from the repository root:
|
||||
|
||||
```bash
|
||||
agent-device test packages/app/e2e/mobile/composer-keyboard/lightbox-pinch.android.ad \
|
||||
--platform android --serial emulator-5554 -e APP_ID=sh.paseo -e "CHAT_URL=$CHAT_URL"
|
||||
```
|
||||
|
||||
Use `APP_ID=sh.paseo.debug` for a development build. If the image has different
|
||||
alt text, pass it with `-e IMAGE_LABEL="..."`. The test pinches the image, closes
|
||||
it, types in the composer, and checks that a single Attach tap opens Upload file.
|
||||
|
||||
For Android keyboard continuity, run the current checkout in the app, open an idle terminal
|
||||
with an empty prompt, hide its keyboard, and run:
|
||||
|
||||
|
||||
+3
-4
@@ -129,7 +129,7 @@ availability and a diagnostic after the daemon resolves the executable. Configur
|
||||
environment, or enablement overrides under `agents.providers.muse`. Omit `extends` to keep
|
||||
the bundled integration; an entry with `extends` shadows it with a custom provider. See
|
||||
[provider contributions](#contribute-a-provider) for the contract and
|
||||
[Muse Code](../public-docs/supported-providers/muse-code.md) for setup, per-agent options, and version limitations.
|
||||
[Muse Code](../public-docs/muse-code.md) for setup, per-agent options, and version limitations.
|
||||
|
||||
## Install from a registry
|
||||
|
||||
@@ -788,15 +788,14 @@ is the [New workspace items reference](../public-docs/plugins/reference.md#new-w
|
||||
|
||||
The screen's choices that a plugin may change live in one plain store,
|
||||
`createNewWorkspaceSetup` (`packages/app/src/screens/new-workspace/setup-model.ts`): the base
|
||||
picker selection, the manual isolation, the chosen existing worktree, the Branch off or Check out
|
||||
action per ref list, the branch name and the workspace metadata. The pickers and
|
||||
picker selection, the manual isolation, the branch name and the workspace metadata. The pickers and
|
||||
the plugin commands write to it, so a command sees what an earlier command left. Project and host
|
||||
stay in the screen's hooks (`useNewWorkspaceHostSelector` reconciles them against each other), and
|
||||
they are read-only to plugins; a command that switched them would unmount the item that called it.
|
||||
|
||||
The store is built in the render that creates the screen, with what the screen derives from its
|
||||
hooks (the lock, the project, whether the project can make worktrees, whether the host supports
|
||||
metadata and ref actions, the project's git worktrees), so a command is valid from a child's first effect, which runs before the screen's own
|
||||
metadata), so a command is valid from a child's first effect, which runs before the screen's own
|
||||
effects. `syncInputs` refreshes those inputs in a layout effect on every commit, and commands read
|
||||
them when they run, never from the render that built them. The pickers and the commands pick
|
||||
through the same `chooseBase` and `chooseIsolation`, so a plugin command has the effects of a
|
||||
|
||||
+4
-4
@@ -19,8 +19,8 @@ provider icon map. You do not need a core manifest entry or provider factory.
|
||||
|
||||
| Provider | Transport | Setup and limitations |
|
||||
| ----------- | ------------------------------------------ | ---------------------------------------------------------------- |
|
||||
| Antigravity | ACP over the installed `agy acp` CLI | [Antigravity](../public-docs/supported-providers/antigravity.md) |
|
||||
| Muse Code | MSP over one `muse serve` host per session | [Muse Code](../public-docs/supported-providers/muse-code.md) |
|
||||
| Antigravity | Installed `agy` CLI | [Antigravity](../public-docs/supported-providers.md#antigravity) |
|
||||
| Muse Code | MSP over one `muse serve` host per session | [Muse Code](../public-docs/muse-code.md) |
|
||||
|
||||
## Provider-native session options
|
||||
|
||||
@@ -50,8 +50,8 @@ or without a control.
|
||||
reject. A key the running session cannot apply (one the provider reads only when it opens) is
|
||||
rejected too, so a stored option always describes what runs. Claude reads most options when it
|
||||
starts its query, and replacing a started query would end its background work, so after the
|
||||
first prompt only Fast and Ultracode can change. Codex fixes its approval policy and sandbox
|
||||
when the thread starts, so it applies only `service_tier` and `plan_mode` live. A session with no
|
||||
first prompt only Fast can change. Codex fixes its approval policy and sandbox when the thread
|
||||
starts, so it applies only `service_tier` and `plan_mode` live. A session with no
|
||||
`applyOptions` rejects every patch; the daemon enforces this. The provider returns the options
|
||||
it ended up with when they differ from the request. The daemon stores the patch and that
|
||||
result in one step after the call resolves. Throwing rejects the whole patch and none of it is
|
||||
|
||||
@@ -29,7 +29,6 @@ The worker writes `$PASEO_HOME/terminal-worker/<pid>.json` (owner-only) with its
|
||||
- Workers never query their own birth time or command line. Readers accept legacy identity fields but ignore them. Daemons through 0.15.1 report new records unreadable and cannot adopt them.
|
||||
- Windows terminal programs have no recorded birth time and terminal lifecycle operations never launch PowerShell. Linux and macOS retain program birth-time checks through `ps` with `LC_ALL=C`; Linux also walks sessions to find surviving jobs.
|
||||
- Unix socket paths have a byte budget (103 on macOS, 107 on Linux). Long dev homes use an owner-only fallback under `$TMPDIR/paseo-<uid>/` or `/tmp/paseo-<uid>/`. An existing directory must be a real `0700` directory owned by you; a shared root is never chmodded.
|
||||
- A home on a filesystem that refuses Unix sockets (AFS, some network mounts) passes those checks and then fails the bind with `EPERM`, `EACCES`, `EOPNOTSUPP` or `ENOTSUP`. The worker moves on to the next directory on those codes only; any other listen error fails the start. The record carries the path the worker bound, so nothing else recomputes it.
|
||||
- A kill cleanup that cannot confirm every process gone writes `closing-<recordId>.json` beside the worker record. The worker rewrites its own record whenever a terminal starts or exits, so the kill intent has to live in a file it never writes. A closing record is never adopted; the next stop or start retries it.
|
||||
- An unreadable record of either kind makes `daemon status` and a kill restart fail with its path: a kill cleanup that met it could not check what it names, and leaves nothing else behind. A read that fails with `EPERM`, `EBUSY` or `EACCES` is retried for 250ms first: on Windows, opening a record while the worker renames its new copy over it fails that way for a moment.
|
||||
|
||||
|
||||
+3
-11
@@ -49,17 +49,9 @@ Large unbounded timeline responses can exceed relay frame limits, so catch-up us
|
||||
|
||||
Page limits are projected-item targets. A tool call lifecycle is one projected item even if it spans many source sequence numbers, and assistant/reasoning chunks are merged before counting. The response carries `seqStart`, `seqEnd`, `sourceSeqRanges`, and `collapsed` so clients can advance sequence cursors without rendering delta rows.
|
||||
|
||||
When live delivery detects a sequence gap, the app fetches `direction: "after"` its end cursor. If
|
||||
the daemon responds with `hasNewer: true`, the app immediately fetches the next page from
|
||||
`endCursor`. Gap recovery is complete only when `hasNewer: false`.
|
||||
|
||||
A chat that was empty when it last caught up has no end cursor to compare a live row against. Such a
|
||||
row starts coverage only if it is the epoch's first row, seq 1. A later row means the chat missed the
|
||||
rows before it, such as a prompt sent while the app was offline, so the app drops it and recovers
|
||||
after seq 0. Coverage started at that later row would make the resume page look already applied, and
|
||||
the chat and its replica cache would keep only the end of the reply. A recovery that waits behind a
|
||||
running catch-up starts after whatever that catch-up applied, because the app applies a forward page
|
||||
row by row and an older cursor repeats rows.
|
||||
When live delivery detects a sequence gap, the app fetches `direction: "after"`. If the daemon
|
||||
responds with `hasNewer: true`, the app immediately fetches the next page from `endCursor`. Gap
|
||||
recovery is complete only when `hasNewer: false`.
|
||||
|
||||
Initialization timeouts guard lack of catch-up progress, not the full multi-page sync. A successful page that queues the next `after` page refreshes the watchdog.
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
Fixed
|
||||
- Fixed Collapse turns hiding a finished reply when Claude answers a later background task notification
|
||||
- Fixed detached worktree commits getting lost when archiving a workspace
|
||||
- Fixed Desktop updates leaving an older daemon running when an earlier Desktop session started it
|
||||
- Fixed daemons losing their Hub connection after execution permissions changed
|
||||
- Fixed saved hosts disappearing when one stored entry could not be read
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -1,8 +0,0 @@
|
||||
Fixed
|
||||
- Fixed Collapse turns hiding a finished reply when Claude answers a later background task notification
|
||||
- Fixed detached worktree commits getting lost when archiving a workspace
|
||||
- Fixed Desktop updates leaving an older daemon running when an earlier Desktop session started it
|
||||
- Fixed daemons losing their Hub connection after execution permissions changed
|
||||
- Fixed saved hosts disappearing when one stored entry could not be read
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -1,8 +0,0 @@
|
||||
Fixed
|
||||
- Fixed Collapse turns hiding a finished reply when Claude answers a later background task notification
|
||||
- Fixed detached worktree commits getting lost when archiving a workspace
|
||||
- Fixed Desktop updates leaving an older daemon running when an earlier Desktop session started it
|
||||
- Fixed daemons losing their Hub connection after execution permissions changed
|
||||
- Fixed saved hosts disappearing when one stored entry could not be read
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -1,8 +0,0 @@
|
||||
Fixed
|
||||
- Fixed Collapse turns hiding a finished reply when Claude answers a later background task notification
|
||||
- Fixed detached worktree commits getting lost when archiving a workspace
|
||||
- Fixed Desktop updates leaving an older daemon running when an earlier Desktop session started it
|
||||
- Fixed daemons losing their Hub connection after execution permissions changed
|
||||
- Fixed saved hosts disappearing when one stored entry could not be read
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
+1
-1
@@ -1 +1 @@
|
||||
sha256-yLTaVMgu3tc/dgngJ7RP0htJcWE0ZtQ4mouypevyv0s=
|
||||
sha256-hN+Klz3jXugHs5MsVzIQIwIa/HGbpdJ04qolKvbsOuk=
|
||||
|
||||
Generated
+28
-28
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "paseo",
|
||||
"version": "0.16.2",
|
||||
"version": "0.16.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "paseo",
|
||||
"version": "0.16.2",
|
||||
"version": "0.16.1",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"workspaces": [
|
||||
@@ -37468,7 +37468,7 @@
|
||||
},
|
||||
"packages/app": {
|
||||
"name": "@getpaseo/app",
|
||||
"version": "0.16.2",
|
||||
"version": "0.16.1",
|
||||
"dependencies": {
|
||||
"@codemirror/commands": "6.10.4",
|
||||
"@codemirror/language": "6.12.4",
|
||||
@@ -39637,13 +39637,13 @@
|
||||
},
|
||||
"packages/cli": {
|
||||
"name": "@getpaseo/cli",
|
||||
"version": "0.16.2",
|
||||
"version": "0.16.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^1.0.0",
|
||||
"@getpaseo/client": "0.16.2",
|
||||
"@getpaseo/protocol": "0.16.2",
|
||||
"@getpaseo/server": "0.16.2",
|
||||
"@getpaseo/client": "0.16.1",
|
||||
"@getpaseo/protocol": "0.16.1",
|
||||
"@getpaseo/server": "0.16.1",
|
||||
"chalk": "^5.3.0",
|
||||
"commander": "^12.0.0",
|
||||
"mime-types": "^2.1.35",
|
||||
@@ -39890,11 +39890,11 @@
|
||||
},
|
||||
"packages/client": {
|
||||
"name": "@getpaseo/client",
|
||||
"version": "0.16.2",
|
||||
"version": "0.16.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@getpaseo/protocol": "0.16.2",
|
||||
"@getpaseo/relay": "0.16.2",
|
||||
"@getpaseo/protocol": "0.16.1",
|
||||
"@getpaseo/relay": "0.16.1",
|
||||
"ws": "^8.20.0",
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
@@ -39906,7 +39906,7 @@
|
||||
},
|
||||
"packages/desktop": {
|
||||
"name": "@getpaseo/desktop",
|
||||
"version": "0.16.2",
|
||||
"version": "0.16.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@getpaseo/cli": "*",
|
||||
@@ -40149,7 +40149,7 @@
|
||||
},
|
||||
"packages/expo-two-way-audio": {
|
||||
"name": "@getpaseo/expo-two-way-audio",
|
||||
"version": "0.16.2",
|
||||
"version": "0.16.1",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.14",
|
||||
@@ -40195,7 +40195,7 @@
|
||||
},
|
||||
"packages/highlight": {
|
||||
"name": "@getpaseo/highlight",
|
||||
"version": "0.16.2",
|
||||
"version": "0.16.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@codemirror/language": "6.12.4",
|
||||
@@ -40225,7 +40225,7 @@
|
||||
},
|
||||
"packages/plugin": {
|
||||
"name": "@getpaseo/plugin",
|
||||
"version": "0.16.2",
|
||||
"version": "0.16.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "^1.4.0",
|
||||
@@ -40233,8 +40233,8 @@
|
||||
"use-sync-external-store": "^1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@getpaseo/client": "0.16.2",
|
||||
"@getpaseo/protocol": "0.16.2",
|
||||
"@getpaseo/client": "0.16.1",
|
||||
"@getpaseo/protocol": "0.16.1",
|
||||
"@types/node": "^20.9.0",
|
||||
"@types/react": "~19.2.0",
|
||||
"react": "19.2.3",
|
||||
@@ -40244,8 +40244,8 @@
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@getpaseo/client": "0.16.2",
|
||||
"@getpaseo/protocol": "0.16.2",
|
||||
"@getpaseo/client": "0.16.1",
|
||||
"@getpaseo/protocol": "0.16.1",
|
||||
"react": ">=19.1.0 <20",
|
||||
"react-native": ">=0.81.5",
|
||||
"zod": "^4.4.3"
|
||||
@@ -40267,7 +40267,7 @@
|
||||
},
|
||||
"packages/protocol": {
|
||||
"name": "@getpaseo/protocol",
|
||||
"version": "0.16.2",
|
||||
"version": "0.16.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"semver": "^7.8.5",
|
||||
@@ -40295,7 +40295,7 @@
|
||||
},
|
||||
"packages/relay": {
|
||||
"name": "@getpaseo/relay",
|
||||
"version": "0.16.2",
|
||||
"version": "0.16.1",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@noble/ciphers": "^2.4.0",
|
||||
@@ -40517,17 +40517,17 @@
|
||||
},
|
||||
"packages/server": {
|
||||
"name": "@getpaseo/server",
|
||||
"version": "0.16.2",
|
||||
"version": "0.16.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.16.2",
|
||||
"@getpaseo/highlight": "0.16.2",
|
||||
"@getpaseo/plugin": "0.16.2",
|
||||
"@getpaseo/protocol": "0.16.2",
|
||||
"@getpaseo/relay": "0.16.2",
|
||||
"@getpaseo/client": "0.16.1",
|
||||
"@getpaseo/highlight": "0.16.1",
|
||||
"@getpaseo/plugin": "0.16.1",
|
||||
"@getpaseo/protocol": "0.16.1",
|
||||
"@getpaseo/relay": "0.16.1",
|
||||
"@isaacs/ttlcache": "^2.1.4",
|
||||
"@modelcontextprotocol/sdk": "1.29.0",
|
||||
"@opencode-ai/sdk": "1.14.46",
|
||||
@@ -41474,7 +41474,7 @@
|
||||
},
|
||||
"packages/website": {
|
||||
"name": "@getpaseo/website",
|
||||
"version": "0.16.2",
|
||||
"version": "0.16.1",
|
||||
"dependencies": {
|
||||
"@cloudflare/vite-plugin": "^1.29.1",
|
||||
"@cloudflare/workers-types": "^4.20260317.1",
|
||||
@@ -43084,7 +43084,7 @@
|
||||
},
|
||||
"plugins": {
|
||||
"name": "@getpaseo/builtin-plugins",
|
||||
"version": "0.16.2",
|
||||
"version": "0.16.1",
|
||||
"dependencies": {
|
||||
"@getpaseo/plugin": "*",
|
||||
"zod": "^4.4.3"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "paseo",
|
||||
"version": "0.16.2",
|
||||
"version": "0.16.1",
|
||||
"private": true,
|
||||
"description": "Paseo: voice-controlled development environment for local AI coding agents",
|
||||
"keywords": [
|
||||
|
||||
@@ -7,7 +7,6 @@ const withAndroidProfileable = require("./plugins/with-android-profileable");
|
||||
const withFdroidAutolinking = require("./plugins/with-fdroid-autolinking");
|
||||
const withPasteInput = require("./plugins/with-paste-input");
|
||||
const withAndroidScroll = require("./modules/paseo-scroll/app.plugin");
|
||||
const withAndroidDisplayMetrics = require("./modules/paseo-display-metrics/app.plugin");
|
||||
const { getNativeReleaseVersion } = require("./native-release-version");
|
||||
const appVariant = process.env.APP_VARIANT ?? "production";
|
||||
const isFdroidBuild = process.env.PASEO_FDROID_BUILD === "1";
|
||||
@@ -147,7 +146,6 @@ export default {
|
||||
"expo-router",
|
||||
withPasteInput,
|
||||
withAndroidScroll,
|
||||
withAndroidDisplayMetrics,
|
||||
[withAndroidAsyncStorageSize, 64],
|
||||
...buildProfile.cameraPlugins,
|
||||
withAndroidOptionalCamera,
|
||||
|
||||
@@ -2,11 +2,9 @@ import type { Locator } from "@playwright/test";
|
||||
import { expect, test, type Page } from "../support/fixtures";
|
||||
import { expectAgentIdle, expectAgentReadyToInterrupt } from "../support/helpers/agent-stream";
|
||||
import {
|
||||
blurComposerInput,
|
||||
cancelAgent,
|
||||
fillComposerDraft,
|
||||
expectComposerDraft,
|
||||
expectComposerNotFocused,
|
||||
expectComposerVisible,
|
||||
submitMessage,
|
||||
} from "../support/helpers/composer";
|
||||
@@ -73,7 +71,6 @@ test.describe("Agent message rewind", () => {
|
||||
minDistanceFromBottom: 300,
|
||||
});
|
||||
await fillComposerDraft(page, preservedDraft);
|
||||
await blurComposerInput(page);
|
||||
rewindCompletion.clearTimelineStreamCount();
|
||||
|
||||
const rewind = rewindConversation(page, userMessage, rewoundPrompt);
|
||||
@@ -87,7 +84,6 @@ test.describe("Agent message rewind", () => {
|
||||
0,
|
||||
);
|
||||
await expectComposerDraft(page, preservedDraft);
|
||||
await expectComposerNotFocused(page);
|
||||
await expectNearBottom(page);
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
|
||||
@@ -527,17 +527,7 @@ async function expectHiddenStreamingSubmissionOrderAfterWorkspaceEviction(
|
||||
expect(gate.getClientRequestCount("agent.timeline.set_subscription.request")).toBe(
|
||||
subscriptionRequests,
|
||||
);
|
||||
const requestsBeforeRelease = rememberTimelineRequestCounts(gate, target.agentId);
|
||||
gate.releaseHeldAgentStreamEvent("turn_started");
|
||||
// The chat never saw the hidden prompt's live row, so the reply's first row is a gap.
|
||||
// The chat recovers the missing rows once, while its workspace is still evicted.
|
||||
await expect
|
||||
.poll(() => gate.getTimelineRequestCount("after", target.agentId))
|
||||
.toBe(requestsBeforeRelease.after + 1);
|
||||
await gate.waitForServerMessage(
|
||||
"fetch_agent_timeline_response",
|
||||
gate.getClientRequestCount("fetch_agent_timeline_request"),
|
||||
);
|
||||
const requestsBeforeReturn = rememberTimelineRequestCounts(gate, target.agentId);
|
||||
await waitForWorkspaceInSidebar(page, {
|
||||
serverId: getServerId(),
|
||||
|
||||
@@ -14,8 +14,6 @@ import {
|
||||
answerFreshnessCheck,
|
||||
commitTimelineTurnsWhileDisconnected,
|
||||
disconnectViewedTimeline,
|
||||
expectEmptyChatSynced,
|
||||
expectPromptAndWholeReply,
|
||||
expectResumeAnsweredWithoutFetch,
|
||||
expectResumeOverflowFallsBackToOneTail,
|
||||
hideTabAndReturn,
|
||||
@@ -24,11 +22,7 @@ import {
|
||||
restoreUnchangedViewedTimeline,
|
||||
restoreViewedTimelineHoldingCatchUp,
|
||||
restoreViewedTimelineWithHeldResponse,
|
||||
restoreViewedTimelineWithLiveRowsFirst,
|
||||
reopenWithFreshnessCheckUnanswered,
|
||||
seedStreamingReplyAgent,
|
||||
sendPromptWhileDisconnected,
|
||||
stopStreamingReply,
|
||||
waitForResumeAnswer,
|
||||
reopenAppWatchingForUpdatingToast,
|
||||
watchForUpdatingToast,
|
||||
@@ -153,27 +147,4 @@ test.describe("Agent timeline resume", () => {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("an empty chat that reconnects mid-reply keeps the prompt and the whole reply", async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(120_000);
|
||||
const gate = await installDaemonWebSocketGate(page);
|
||||
const agent = await seedStreamingReplyAgent();
|
||||
try {
|
||||
await openAgentTimeline(page, agent);
|
||||
await expectEmptyChatSynced(page, gate);
|
||||
await disconnectViewedTimeline(page, gate);
|
||||
await sendPromptWhileDisconnected(agent);
|
||||
await restoreViewedTimelineWithLiveRowsFirst(gate);
|
||||
const reply = await stopStreamingReply(agent);
|
||||
await expectPromptAndWholeReply(page, agent, reply);
|
||||
|
||||
await page.reload();
|
||||
await expectPromptAndWholeReply(page, agent, reply);
|
||||
} finally {
|
||||
gate.restore();
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -72,12 +72,14 @@ const ASSISTANT_MARKDOWN = [
|
||||
"| Current \\| active | ~~obsolete~~ | ready |",
|
||||
].join("\n");
|
||||
|
||||
// text/plain carries the selection as displayed, so an inline code span the renderer
|
||||
// linked copies without its destination.
|
||||
const EXPECTED_WHOLE_SELECTION_TEXT = ASSISTANT_MARKDOWN.replace(
|
||||
const EXPECTED_WHOLE_SELECTION_MARKDOWN = ASSISTANT_MARKDOWN.replace(
|
||||
"www.example.com stays",
|
||||
"[www.example.com](http://www.example.com) stays",
|
||||
)
|
||||
.replace(
|
||||
"`https://example.com/generated` stays",
|
||||
"[`https://example.com/generated`](https://example.com/generated) stays",
|
||||
)
|
||||
.replace(`${CROSS_STRUCTURE_MARKDOWN}\n\n`, "")
|
||||
.replace(
|
||||
"<https://autolink.example.com>",
|
||||
@@ -420,7 +422,7 @@ test("copying an assistant selection preserves Markdown structure and links", as
|
||||
await copySelection(page);
|
||||
|
||||
const clipboard = await readRichClipboard(page);
|
||||
expect(clipboard.plainText).toBe(EXPECTED_WHOLE_SELECTION_TEXT);
|
||||
expect(clipboard.plainText).toBe(EXPECTED_WHOLE_SELECTION_MARKDOWN);
|
||||
expect(clipboard.html).not.toContain("<ul>");
|
||||
expect(clipboard.html).not.toContain("<li>");
|
||||
expect(clipboard.html).toContain("<div>- ");
|
||||
@@ -686,77 +688,6 @@ test("copying an assistant selection preserves Markdown structure and links", as
|
||||
}
|
||||
});
|
||||
|
||||
test("pasting an assistant selection preserves literal underscores and authored links", async ({
|
||||
context,
|
||||
page,
|
||||
}) => {
|
||||
const agent = await seedMockAgentWorkspace({
|
||||
repoPrefix: "assistant-selection-paste-",
|
||||
title: "Assistant selection paste",
|
||||
initialPrompt: "Render the paste fixture.",
|
||||
featureValues: {
|
||||
mockAssistantResponse:
|
||||
"Keep \\_literal\\_ and `https://example.com/generated` beside [the docs](https://example.com/docs).",
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
await allowRichClipboard(context);
|
||||
await agent.client.waitForAgentUpsert(
|
||||
agent.agentId,
|
||||
(snapshot) => snapshot.status === "idle",
|
||||
30_000,
|
||||
);
|
||||
await openAgentRoute(page, agent);
|
||||
|
||||
const message = assistantMessageBlocks(page);
|
||||
await expect(message.locator('a[href="https://example.com/generated"]')).toHaveText(
|
||||
"https://example.com/generated",
|
||||
);
|
||||
await selectAssistantTextRange(page, "Keep _literal_", "the docs.");
|
||||
await copySelection(page);
|
||||
|
||||
await page.evaluate(() => {
|
||||
const fields = document.createElement("div");
|
||||
fields.style.cssText =
|
||||
"position: fixed; bottom: 0; left: 0; z-index: 10000; background: white";
|
||||
const plainText = document.createElement("textarea");
|
||||
plainText.setAttribute("aria-label", "Plain text paste");
|
||||
const richText = document.createElement("div");
|
||||
richText.contentEditable = "true";
|
||||
richText.setAttribute("role", "textbox");
|
||||
richText.setAttribute("aria-label", "Rich text paste");
|
||||
fields.append(plainText, richText);
|
||||
document.body.append(fields);
|
||||
});
|
||||
|
||||
const plainText = page.getByRole("textbox", { name: "Plain text paste" });
|
||||
await plainText.focus();
|
||||
await page.keyboard.press("ControlOrMeta+v");
|
||||
await expect(plainText).toHaveValue(
|
||||
"Keep _literal_ and `https://example.com/generated` beside [the docs](https://example.com/docs).",
|
||||
);
|
||||
|
||||
const richText = page.getByRole("textbox", { name: "Rich text paste" });
|
||||
await richText.focus();
|
||||
await page.keyboard.press("ControlOrMeta+v");
|
||||
await expect(richText).toHaveText(
|
||||
"Keep _literal_ and https://example.com/generated beside the docs.",
|
||||
);
|
||||
await expect(richText.locator("code")).toHaveText("https://example.com/generated");
|
||||
await expect(richText.getByRole("link")).toHaveCount(2);
|
||||
await expect(
|
||||
richText.getByRole("link", { name: "https://example.com/generated" }),
|
||||
).toHaveAttribute("href", "https://example.com/generated");
|
||||
await expect(richText.getByRole("link", { name: "the docs" })).toHaveAttribute(
|
||||
"href",
|
||||
"https://example.com/docs",
|
||||
);
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("copying a selection across an assistant image keeps its Markdown source and alt text", async ({
|
||||
context,
|
||||
page,
|
||||
|
||||
@@ -26,7 +26,7 @@ test.use({
|
||||
},
|
||||
});
|
||||
|
||||
// The Speed icon highlights any explicit tier other than Normal.
|
||||
// Rendered light-theme colors: palette yellow 400 for Fast and Ultrafast, muted foreground for Normal.
|
||||
const ACTIVE_SPEED_COLOR = "rgb(251, 191, 36)";
|
||||
const NORMAL_SPEED_COLOR = "rgb(113, 113, 122)";
|
||||
|
||||
@@ -63,7 +63,7 @@ async function expectSpeedIconColor(page: Page, color: string): Promise<void> {
|
||||
}
|
||||
|
||||
async function expectSpeedChoices(page: Page, choices: string[]): Promise<void> {
|
||||
for (const choice of ["Normal", "Flex", "Fast", "Ultrafast"]) {
|
||||
for (const choice of ["Normal", "Fast", "Ultrafast"]) {
|
||||
const option = page.getByText(choice, { exact: true }).last();
|
||||
if (choices.includes(choice)) {
|
||||
await expect(option).toBeVisible();
|
||||
@@ -115,24 +115,21 @@ for (const viewport of [
|
||||
await expectSpeedIconColor(page, ACTIVE_SPEED_COLOR);
|
||||
await page.screenshot({ path: testInfo.outputPath(`${viewport.name}-fast-selected.png`) });
|
||||
await openSpeedSelector(page);
|
||||
await expectSpeedChoices(page, ["Normal", "Flex", "Fast", "Ultrafast"]);
|
||||
await expectSpeedChoices(page, ["Normal", "Fast", "Ultrafast"]);
|
||||
await page.screenshot({ path: testInfo.outputPath(`${viewport.name}-speed-options.png`) });
|
||||
await selectSpeed(page, "Ultrafast");
|
||||
await expectSpeedIconColor(page, ACTIVE_SPEED_COLOR);
|
||||
await openSpeedSelector(page);
|
||||
await expectSpeedChoices(page, ["Normal", "Flex", "Fast", "Ultrafast"]);
|
||||
await expectSpeedChoices(page, ["Normal", "Fast", "Ultrafast"]);
|
||||
await page.screenshot({
|
||||
path: testInfo.outputPath(`${viewport.name}-ultrafast-selected.png`),
|
||||
});
|
||||
await selectSpeed(page, "Flex");
|
||||
await expectSpeedIconColor(page, ACTIVE_SPEED_COLOR);
|
||||
await openSpeedSelector(page);
|
||||
await selectSpeed(page, "Normal");
|
||||
await expectSpeedIconColor(page, NORMAL_SPEED_COLOR);
|
||||
if (viewport.name === "desktop") {
|
||||
await switchAgentModel(agent.id, "gpt-6-sol");
|
||||
await openSpeedSelector(page);
|
||||
await expectSpeedChoices(page, ["Normal", "Flex", "Fast"]);
|
||||
await expectSpeedChoices(page, ["Normal", "Fast"]);
|
||||
await page.screenshot({ path: testInfo.outputPath("desktop-fast-only.png") });
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
import { expect, test } from "../support/fixtures";
|
||||
import type { FormPreferences } from "@/create-agent-preferences/preferences";
|
||||
import {
|
||||
closeCommandCenter,
|
||||
openCommandCenter,
|
||||
openCommandCenterWithShortcut,
|
||||
} from "../support/helpers/command-center";
|
||||
import {
|
||||
enterComposerFullscreen,
|
||||
exitComposerFullscreen,
|
||||
expectComposerVisible,
|
||||
fillComposerDraft,
|
||||
resizeComposerViewport,
|
||||
} from "../support/helpers/composer";
|
||||
import { closeCommandCenter, openCommandCenter } from "../support/helpers/command-center";
|
||||
import {
|
||||
applyCommandCenterAgentControls,
|
||||
chooseCommandCenterAgentControl,
|
||||
@@ -25,18 +14,8 @@ import {
|
||||
} from "../support/helpers/command-center-agent-controls";
|
||||
import { clickNewChat, gotoWorkspace } from "../support/helpers/launcher";
|
||||
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
|
||||
import {
|
||||
assertNewWorkspaceSidebarAndHeader,
|
||||
connectNewWorkspaceDaemonClient,
|
||||
openGlobalNewWorkspaceComposer,
|
||||
selectNewWorkspaceProject,
|
||||
selectWorkspaceIsolation,
|
||||
submitNewWorkspacePrompt,
|
||||
} from "../support/helpers/new-workspace";
|
||||
import { getServerId } from "../support/helpers/server-id";
|
||||
import { expectAppRoute } from "../support/helpers/route-assertions";
|
||||
import { seedWorkspace } from "../support/helpers/seed-client";
|
||||
import { closeMobileAgentSidebar, openMobileAgentSidebar } from "../support/helpers/sidebar";
|
||||
import { buildSchedulesRoute } from "@/utils/host-routes";
|
||||
|
||||
const CREATE_AGENT_PREFERENCES_KEY = "@paseo:create-agent-preferences";
|
||||
@@ -51,7 +30,7 @@ async function seedMockDraftPreferences(page: import("@playwright/test").Page):
|
||||
providerPreferences: {
|
||||
mock: {
|
||||
model: "five-minute-stream",
|
||||
mode: "approval-test",
|
||||
mode: "load-test",
|
||||
},
|
||||
},
|
||||
} satisfies FormPreferences),
|
||||
@@ -242,94 +221,6 @@ test.describe("Command Center agent controls", () => {
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("applies New workspace model and mode choices before the first message", async ({
|
||||
page,
|
||||
}) => {
|
||||
const workspace = await seedWorkspace({ repoPrefix: "command-center-new-workspace-controls-" });
|
||||
await seedMockDraftPreferences(page);
|
||||
const client = await connectNewWorkspaceDaemonClient();
|
||||
|
||||
try {
|
||||
const backgroundAgent = await workspace.client.createAgent({
|
||||
provider: "mock",
|
||||
cwd: workspace.repoPath,
|
||||
workspaceId: workspace.workspaceId,
|
||||
title: "Background agent",
|
||||
model: "five-minute-stream",
|
||||
modeId: "approval-test",
|
||||
});
|
||||
await openAgentRoute(page, {
|
||||
workspaceId: workspace.workspaceId,
|
||||
agentId: backgroundAgent.id,
|
||||
});
|
||||
await openGlobalNewWorkspaceComposer(page);
|
||||
await selectNewWorkspaceProject(page, workspace);
|
||||
await selectWorkspaceIsolation(page, "local");
|
||||
|
||||
await applyCommandCenterAgentControls(page, DRAFT_AGENT_CONTROL_CHOICES);
|
||||
await closeCommandCenter(page);
|
||||
await submitNewWorkspacePrompt(page, "Create with Command Center choices");
|
||||
const created = await assertNewWorkspaceSidebarAndHeader(page, {
|
||||
serverId: getServerId(),
|
||||
client,
|
||||
previousWorkspaceId: workspace.workspaceId,
|
||||
projectDisplayName: workspace.projectDisplayName,
|
||||
});
|
||||
|
||||
await expectWorkspaceAgentConfiguration(
|
||||
{ client: workspace.client, workspaceId: created.workspaceId },
|
||||
{ provider: "mock", model: "ten-second-stream", modeId: "load-test" },
|
||||
);
|
||||
await expectWorkspaceAgentConfiguration(workspace, {
|
||||
id: backgroundAgent.id,
|
||||
provider: "mock",
|
||||
model: "five-minute-stream",
|
||||
modeId: "approval-test",
|
||||
});
|
||||
} finally {
|
||||
await client.close().catch(() => undefined);
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("keeps draft settings searchable from the compact sidebar and fullscreen editor", async ({
|
||||
page,
|
||||
}) => {
|
||||
const workspace = await seedWorkspace({ repoPrefix: "command-center-fullscreen-draft-" });
|
||||
await seedMockDraftPreferences(page);
|
||||
|
||||
try {
|
||||
await openDraftComposer(page, workspace.workspaceId);
|
||||
await resizeComposerViewport(page, "portrait");
|
||||
await applyCompactComposerSettings(page);
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("applies compact sidebar and fullscreen settings to the running agent", async ({ page }) => {
|
||||
const workspace = await seedMockAgentWorkspace({
|
||||
repoPrefix: "command-center-fullscreen-agent-",
|
||||
title: "Compact Command Center settings",
|
||||
model: "five-minute-stream",
|
||||
modeId: "approval-test",
|
||||
});
|
||||
|
||||
try {
|
||||
await resizeComposerViewport(page, "portrait");
|
||||
await openAgentRoute(page, workspace);
|
||||
await applyCompactComposerSettings(page);
|
||||
await expectWorkspaceAgentConfiguration(workspace, {
|
||||
id: workspace.agentId,
|
||||
provider: "mock",
|
||||
model: "ten-second-stream",
|
||||
modeId: "load-test",
|
||||
});
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const DRAFT_AGENT_CONTROL_CHOICES = [
|
||||
@@ -342,22 +233,3 @@ async function openDraftComposer(page: import("@playwright/test").Page, workspac
|
||||
await clickNewChat(page);
|
||||
await waitForDraftComposer(page);
|
||||
}
|
||||
|
||||
async function applyCompactComposerSettings(page: import("@playwright/test").Page): Promise<void> {
|
||||
const [model, mode] = DRAFT_AGENT_CONTROL_CHOICES;
|
||||
await expectComposerVisible(page);
|
||||
await openMobileAgentSidebar(page);
|
||||
await openCommandCenter(page);
|
||||
await chooseCommandCenterAgentControl({ page, ...mode });
|
||||
await closeMobileAgentSidebar(page);
|
||||
|
||||
await fillComposerDraft(page, "First line\nSecond line\nThird line");
|
||||
await enterComposerFullscreen(page);
|
||||
await openCommandCenterWithShortcut(page);
|
||||
await chooseCommandCenterAgentControl({ page, ...model });
|
||||
await exitComposerFullscreen(page);
|
||||
|
||||
await openCommandCenterWithShortcut(page);
|
||||
await expectCommandCenterAgentControlSelected({ page, ...model });
|
||||
await expectCommandCenterAgentControlSelected({ page, ...mode });
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { test, expect, type Page } from "../support/fixtures";
|
||||
import { test, expect } from "../support/fixtures";
|
||||
import { openWorkspaceWithAgents } from "../support/helpers/archive-tab";
|
||||
import {
|
||||
composerLocator,
|
||||
@@ -311,88 +311,3 @@ test.describe("Composer trailing disc on a new chat", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const SHORTCUT_MOD = process.platform === "darwin" ? "Meta" : "Control";
|
||||
|
||||
async function toggleModelPickerFromComposer(page: Page) {
|
||||
await composerLocator(page).focus();
|
||||
await page.keyboard.press(`${SHORTCUT_MOD}+Slash`);
|
||||
}
|
||||
|
||||
async function expectModelPickerClosesFromSearch(page: Page) {
|
||||
const search = page.getByPlaceholder(/Search (all )?models/);
|
||||
await expect(search).toBeVisible();
|
||||
await search.focus();
|
||||
await page.keyboard.press(`${SHORTCUT_MOD}+Slash`);
|
||||
await expect(search).toBeHidden();
|
||||
}
|
||||
|
||||
async function cycleComposerEffort(page: Page) {
|
||||
await composerLocator(page).focus();
|
||||
await page.keyboard.press(`${SHORTCUT_MOD}+Shift+Slash`);
|
||||
}
|
||||
|
||||
function modelControl(page: Page) {
|
||||
return page.getByRole("button", { name: "Select model (Ten second stream)", exact: true });
|
||||
}
|
||||
|
||||
function thinkingControl(page: Page, effort: string) {
|
||||
return page.getByRole("button", { name: `Select thinking option (${effort})`, exact: true });
|
||||
}
|
||||
|
||||
async function expectShortcutHint(
|
||||
page: Page,
|
||||
control: ReturnType<typeof modelControl>,
|
||||
label: string,
|
||||
) {
|
||||
await control.hover();
|
||||
const tooltip = page.getByRole("tooltip").filter({ hasText: label });
|
||||
await expect(tooltip).toContainText("/");
|
||||
}
|
||||
|
||||
test.describe("Composer model and effort shortcuts", () => {
|
||||
test("opens and closes the model picker and wraps effort in toolbar order", async ({ page }) => {
|
||||
const agent = await seedMockAgentWorkspace({
|
||||
repoPrefix: "composer-shortcuts-",
|
||||
title: "Composer shortcuts",
|
||||
model: "ten-second-stream",
|
||||
thinkingOptionId: "high",
|
||||
});
|
||||
try {
|
||||
await openAgentRoute(page, agent);
|
||||
await expectComposerVisible(page);
|
||||
await expect(thinkingControl(page, "High")).toBeVisible();
|
||||
|
||||
await test.step("Focus model search without opening its tooltip", async () => {
|
||||
await toggleModelPickerFromComposer(page);
|
||||
await expect(page.getByPlaceholder(/Search (all )?models/)).toBeFocused();
|
||||
await expect(page.getByRole("tooltip").filter({ hasText: "Change model" })).toBeHidden();
|
||||
await expectModelPickerClosesFromSearch(page);
|
||||
});
|
||||
|
||||
await test.step("Show both shortcuts in the toolbar tooltips", async () => {
|
||||
await expectShortcutHint(page, modelControl(page), "Change model");
|
||||
await expectShortcutHint(page, thinkingControl(page, "High"), "Thinking mode");
|
||||
});
|
||||
|
||||
await test.step("Wrap from High to Low and advance to Medium", async () => {
|
||||
await cycleComposerEffort(page);
|
||||
await expect(thinkingControl(page, "Low")).toBeVisible();
|
||||
await cycleComposerEffort(page);
|
||||
await expect(thinkingControl(page, "Medium")).toBeVisible();
|
||||
});
|
||||
|
||||
await test.step("Toggle the folded picker and cycle effort in a compact window", async () => {
|
||||
await page.setViewportSize({ width: 480, height: 844 });
|
||||
const effortLabel = page.getByTestId("combined-model-selector-thinking-label");
|
||||
await expect(effortLabel).toHaveText("Medium");
|
||||
await toggleModelPickerFromComposer(page);
|
||||
await expectModelPickerClosesFromSearch(page);
|
||||
await cycleComposerEffort(page);
|
||||
await expect(effortLabel).toHaveText("High");
|
||||
});
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -513,37 +513,3 @@ test("compact file sheets cover Explorer and return to its retained file list",
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
async function toggleCommentInMainEditor(page: Parameters<typeof ensureExplorerSidebar>[0]) {
|
||||
const editor = page.getByLabel("Source editor for comment.cs").getByRole("textbox");
|
||||
await expect(editor).toBeVisible();
|
||||
await editor.press(process.platform === "darwin" ? "Meta+Slash" : "Control+Slash");
|
||||
await expect(editor).toHaveText("// public class Example {}");
|
||||
}
|
||||
|
||||
test("keeps the comment shortcut in the editor beside an Explorer agent", async ({ page }) => {
|
||||
const workspace = await seedMockAgentWorkspace({
|
||||
repoPrefix: "explorer-comment-shortcut-",
|
||||
title: "Chat beside the editor",
|
||||
model: "ten-second-stream",
|
||||
});
|
||||
try {
|
||||
await writeFile(`${workspace.cwd}/comment.cs`, "public class Example {}");
|
||||
await openAgentRoute(page, workspace);
|
||||
await expect(
|
||||
page.getByRole("button", { name: "Select model (Ten second stream)" }),
|
||||
).toBeVisible();
|
||||
await ensureExplorerSidebar(page);
|
||||
await dragTabIntoExplorer(page, `agent_${workspace.agentId}`);
|
||||
await expect(
|
||||
explorerSidebar(page).getByRole("button", { name: "Select model (Ten second stream)" }),
|
||||
).toBeVisible();
|
||||
await openFilesPanel(page);
|
||||
await openFileFromExplorer(page, "comment.cs");
|
||||
await explorerSidebar(page).getByTestId(`workspace-tab-agent_${workspace.agentId}`).click();
|
||||
await toggleCommentInMainEditor(page);
|
||||
await expect(page.getByPlaceholder(/Search (all )?models/)).toBeHidden();
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -777,9 +777,7 @@ test.describe("CodeMirror workspace file editing", () => {
|
||||
await replaceEditorText(page, "# Saved from source\n");
|
||||
await expect(page.getByTestId("workspace-tab-modified-file_notes.md")).toBeVisible();
|
||||
await selectFileView(page, "Preview");
|
||||
await expect(
|
||||
visibleFilePane.getByRole("heading", { name: "Saved from source", exact: true }),
|
||||
).toBeVisible();
|
||||
await expect(visibleFilePane.getByText("Saved from source", { exact: true })).toBeVisible();
|
||||
await expect(toolbar.getByLabel("Line 1, column 1")).toHaveCount(0);
|
||||
await expect.poll(() => readFile(markdownPath, "utf8")).toBe("# Saved from source\n");
|
||||
await expect(page.getByTestId("workspace-tab-modified-file_notes.md")).not.toBeVisible();
|
||||
@@ -866,52 +864,11 @@ test.describe("CodeMirror workspace file editing", () => {
|
||||
|
||||
await selectFileView(page, "Source");
|
||||
await expect(page.getByTestId("file-source-editor")).toBeVisible();
|
||||
await expect(preview.host).toBeHidden();
|
||||
await expect(preview.host).toHaveCount(0);
|
||||
await selectFileView(page, "Preview");
|
||||
await expect(preview.host).toBeVisible();
|
||||
});
|
||||
|
||||
test("shows the changed HTML page after the file changes on disk while Source shows", async ({
|
||||
page,
|
||||
withWorkspace,
|
||||
}) => {
|
||||
const workspace = await withWorkspace({ prefix: "file-editing-html-hidden-change-" });
|
||||
const htmlPath = path.join(workspace.repoPath, "plan.html");
|
||||
await writeFile(htmlPath, "<!doctype html><html><body><h1>First plan</h1></body></html>");
|
||||
await workspace.navigateTo();
|
||||
await openWorkspaceFile(page, "plan.html");
|
||||
const preview = htmlPreview(page);
|
||||
await expect(preview.document.getByRole("heading", { name: "First plan" })).toBeVisible();
|
||||
|
||||
await selectFileView(page, "Source");
|
||||
await writeFile(htmlPath, "<!doctype html><html><body><h1>Changed on disk</h1></body></html>");
|
||||
await expect(editor(page)).toContainText("Changed on disk");
|
||||
await selectFileView(page, "Preview");
|
||||
|
||||
await expect(preview.document.getByRole("heading", { name: "Changed on disk" })).toBeVisible();
|
||||
});
|
||||
|
||||
test("shows the HTML page edited in Source when Preview shows again", async ({
|
||||
page,
|
||||
withWorkspace,
|
||||
}) => {
|
||||
const workspace = await withWorkspace({ prefix: "file-editing-html-hidden-edit-" });
|
||||
await writeFile(
|
||||
path.join(workspace.repoPath, "plan.html"),
|
||||
"<!doctype html><html><body><h1>First plan</h1></body></html>",
|
||||
);
|
||||
await workspace.navigateTo();
|
||||
await openWorkspaceFile(page, "plan.html");
|
||||
const preview = htmlPreview(page);
|
||||
await expect(preview.document.getByRole("heading", { name: "First plan" })).toBeVisible();
|
||||
|
||||
await selectFileView(page, "Source");
|
||||
await replaceEditorText(page, "<!doctype html><html><body><h1>Edited plan</h1></body></html>");
|
||||
await selectFileView(page, "Preview");
|
||||
|
||||
await expect(preview.document.getByRole("heading", { name: "Edited plan" })).toBeVisible();
|
||||
});
|
||||
|
||||
test("keeps HTML fragment links in the preview and scrolls to the target", async ({
|
||||
page,
|
||||
withWorkspace,
|
||||
|
||||
@@ -466,12 +466,12 @@ test("downloads a file over direct TCP with its original filename and bytes", as
|
||||
await gotoWorkspace(page, workspace.workspaceId);
|
||||
await openFileExplorer(page);
|
||||
|
||||
const daemonRequest = page.waitForRequest("**/api/files/download?*");
|
||||
const downloaded = await downloadFileFromExplorer(page, fileName);
|
||||
const requestUrl = new URL((await daemonRequest).url());
|
||||
expect(requestUrl.port).toBe(getE2EDaemonPort());
|
||||
expect(requestUrl.searchParams.get("token")).toBeTruthy();
|
||||
expect(new URL(downloaded.url()).protocol).toBe("blob:");
|
||||
const url = new URL(downloaded.url());
|
||||
expect(url.protocol).toBe("http:");
|
||||
expect(url.port).toBe(getE2EDaemonPort());
|
||||
expect(url.pathname).toBe("/api/files/download");
|
||||
expect(url.searchParams.get("token")).toBeTruthy();
|
||||
expect(downloaded.suggestedFilename()).toBe(fileName);
|
||||
const savedFile = testInfo.outputPath(fileName);
|
||||
await downloaded.saveAs(savedFile);
|
||||
@@ -479,45 +479,6 @@ test("downloads a file over direct TCP with its original filename and bytes", as
|
||||
expect(await readFile(savedFile)).toEqual(source);
|
||||
});
|
||||
|
||||
test("keeps the app open and shows the error when the host rejects a download", async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
const fileName = "removed-during-download.bin";
|
||||
const filePath = path.join(workspace.workspaceDirectory, fileName);
|
||||
const source = Buffer.from([0, 1, 2, 255]);
|
||||
await writeFile(filePath, source);
|
||||
await gotoWorkspace(page, workspace.workspaceId);
|
||||
await openFileExplorer(page);
|
||||
const workspaceUrl = page.url();
|
||||
|
||||
// The file disappears after the token is issued, so the real daemon answers 404.
|
||||
await page.route(
|
||||
"**/api/files/download?*",
|
||||
async (route) => {
|
||||
await rm(filePath);
|
||||
await route.continue();
|
||||
},
|
||||
{ times: 1 },
|
||||
);
|
||||
await page
|
||||
.getByTestId("file-explorer-tree-scroll")
|
||||
.getByText(fileName, { exact: true })
|
||||
.click({ button: "right" });
|
||||
await page.getByRole("menuitem", { name: "Download", exact: true }).click();
|
||||
|
||||
await expect(
|
||||
page.getByText("Failed to download file (HTTP 404).", { exact: true }),
|
||||
).toBeVisible();
|
||||
expect(page.url()).toBe(workspaceUrl);
|
||||
|
||||
await writeFile(filePath, source);
|
||||
const downloaded = await downloadFileFromExplorer(page, fileName);
|
||||
const savedFile = testInfo.outputPath(fileName);
|
||||
await downloaded.saveAs(savedFile);
|
||||
expect(await readFile(savedFile)).toEqual(source);
|
||||
expect(page.url()).toBe(workspaceUrl);
|
||||
});
|
||||
|
||||
test("downloads an unsupported binary from its preview with original filename and bytes", async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
import { writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { expect, test, type Page } from "../support/fixtures";
|
||||
import { openFileExplorer, openFileFromExplorer } from "../support/helpers/file-explorer";
|
||||
|
||||
// Switching a file tab between Preview and Source returns to where each view was left.
|
||||
|
||||
const sections = Array.from({ length: 200 }, (_, index) => index);
|
||||
const LONG_MARKDOWN = sections.map((i) => `## Section ${i}\n\nParagraph ${i}.\n`).join("\n");
|
||||
const LONG_HTML = `<!doctype html><html><body>${sections
|
||||
.map((i) => `<h2>Section ${i}</h2><p>Paragraph ${i}</p>`)
|
||||
.join("")}</body></html>`;
|
||||
|
||||
type FileView = "markdown preview" | "html preview" | "source";
|
||||
|
||||
function htmlPreviewFrame(page: Page) {
|
||||
const frame = page.frames().find((candidate) => candidate.url().startsWith("data:text/html"));
|
||||
if (!frame) throw new Error("The HTML preview frame is not loaded.");
|
||||
return frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the view's visible scroller to `offset` when given, and returns its offset. The
|
||||
* scroller is Markdown's scroll view, CodeMirror's scroller, or the HTML page itself.
|
||||
*/
|
||||
async function viewScroll(page: Page, view: FileView, offset?: number): Promise<number> {
|
||||
if (view === "html preview") {
|
||||
return htmlPreviewFrame(page).evaluate((target) => {
|
||||
if (target !== undefined) window.scrollTo(0, target);
|
||||
return window.scrollY;
|
||||
}, offset);
|
||||
}
|
||||
return page.evaluate(
|
||||
(input) => {
|
||||
const visible = (element: HTMLElement) => element.offsetParent !== null;
|
||||
let scroller: HTMLElement | null;
|
||||
if (input.view === "source") {
|
||||
scroller =
|
||||
[...document.querySelectorAll<HTMLElement>(".cm-scroller")].find(visible) ?? null;
|
||||
} else {
|
||||
scroller =
|
||||
[
|
||||
...document.querySelectorAll<HTMLElement>('[data-testid="markdown-preview-frame"]'),
|
||||
].find(visible) ?? null;
|
||||
while (scroller && !(scroller.scrollHeight > scroller.clientHeight + 10)) {
|
||||
scroller = scroller.parentElement;
|
||||
}
|
||||
}
|
||||
if (!scroller) throw new Error(`No visible scroller for the ${input.view}.`);
|
||||
if (input.offset !== undefined) scroller.scrollTop = input.offset;
|
||||
return scroller.scrollTop;
|
||||
},
|
||||
{ view, offset },
|
||||
);
|
||||
}
|
||||
|
||||
async function openLongFile(
|
||||
page: Page,
|
||||
withWorkspace: (options?: { prefix?: string }) => Promise<{
|
||||
repoPath: string;
|
||||
navigateTo(): Promise<void>;
|
||||
}>,
|
||||
name: string,
|
||||
content: string,
|
||||
): Promise<void> {
|
||||
const workspace = await withWorkspace({ prefix: "file-view-scroll-" });
|
||||
await writeFile(path.join(workspace.repoPath, name), content);
|
||||
await workspace.navigateTo();
|
||||
await openFileExplorer(page);
|
||||
await openFileFromExplorer(page, name);
|
||||
await expect(page.getByTestId("file-mode-preview")).toBeVisible({ timeout: 30_000 });
|
||||
}
|
||||
|
||||
async function showView(page: Page, view: "preview" | "source"): Promise<void> {
|
||||
await page.getByTestId(`file-mode-${view}`).click();
|
||||
}
|
||||
|
||||
/** Scrolls the view past the first screen and returns where it settled. */
|
||||
async function scrollDown(page: Page, view: FileView): Promise<number> {
|
||||
await expect(async () => {
|
||||
expect(await viewScroll(page, view, 1200)).toBeGreaterThan(1000);
|
||||
}).toPass({ timeout: 15_000 });
|
||||
// CodeMirror can adjust the offset once after a scroll; read it after that settles.
|
||||
await page.waitForTimeout(300);
|
||||
return viewScroll(page, view);
|
||||
}
|
||||
|
||||
async function expectOffsetKept(page: Page, view: FileView, offset: number): Promise<void> {
|
||||
await expect.poll(() => viewScroll(page, view), { timeout: 5_000 }).toBe(offset);
|
||||
}
|
||||
|
||||
test("Markdown preview keeps its scroll offset after showing Source", async ({
|
||||
page,
|
||||
withWorkspace,
|
||||
}) => {
|
||||
await openLongFile(page, withWorkspace, "long.md", LONG_MARKDOWN);
|
||||
const offset = await scrollDown(page, "markdown preview");
|
||||
|
||||
await showView(page, "source");
|
||||
await expect(page.getByTestId("file-source-editor")).toBeVisible();
|
||||
await showView(page, "preview");
|
||||
|
||||
await expectOffsetKept(page, "markdown preview", offset);
|
||||
});
|
||||
|
||||
test("HTML preview keeps its scroll offset after showing Source", async ({
|
||||
page,
|
||||
withWorkspace,
|
||||
}) => {
|
||||
await openLongFile(page, withWorkspace, "long.html", LONG_HTML);
|
||||
const offset = await scrollDown(page, "html preview");
|
||||
|
||||
await showView(page, "source");
|
||||
await expect(page.getByTestId("file-source-editor")).toBeVisible();
|
||||
await showView(page, "preview");
|
||||
|
||||
await expectOffsetKept(page, "html preview", offset);
|
||||
});
|
||||
|
||||
test("Source keeps its scroll offset after showing Preview", async ({ page, withWorkspace }) => {
|
||||
await openLongFile(page, withWorkspace, "long.md", LONG_MARKDOWN);
|
||||
await showView(page, "source");
|
||||
const offset = await scrollDown(page, "source");
|
||||
|
||||
await showView(page, "preview");
|
||||
await expect(page.getByTestId("markdown-preview-frame")).toBeVisible();
|
||||
await showView(page, "source");
|
||||
|
||||
await expectOffsetKept(page, "source", offset);
|
||||
});
|
||||
@@ -16,13 +16,6 @@ import {
|
||||
expectComposerFullscreenControls,
|
||||
} from "../support/helpers/composer";
|
||||
import { waitForSidebarHydration } from "../support/helpers/workspace-ui";
|
||||
import {
|
||||
seedTerminalProfiles,
|
||||
selectLaunchOption,
|
||||
terminalPromptInput,
|
||||
} from "../support/helpers/new-workspace-launch";
|
||||
|
||||
test.use({ channel: "chromium", launchOptions: { args: ["--use-fake-device-for-media-stream"] } });
|
||||
|
||||
type WebSocketMessage = string | Buffer;
|
||||
|
||||
@@ -261,82 +254,3 @@ test("dictation shortcut leaves retained fullscreen and exposes recording contro
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
async function controlMicrophonePermission(page: Page) {
|
||||
const cdp = await page.context().newCDPSession(page);
|
||||
const { targetInfo } = await cdp.send("Target.getTargetInfo");
|
||||
const origin = new URL(page.url()).origin;
|
||||
return async (setting: "denied" | "granted") => {
|
||||
await cdp.send("Browser.setPermission", {
|
||||
permission: { name: "microphone" },
|
||||
setting,
|
||||
origin,
|
||||
browserContextId: targetInfo.browserContextId,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function startDictationByMic(page: Page) {
|
||||
return page.getByRole("button", { name: "Start dictation", exact: true }).click();
|
||||
}
|
||||
|
||||
function expectDictationPermissionError(page: Page) {
|
||||
return expect(page.getByTestId("message-input-root").getByRole("alert")).toHaveText(
|
||||
"Allow microphone access and try again.",
|
||||
);
|
||||
}
|
||||
|
||||
test("keeps the draft and retries from the mic after access is restored", async ({ page }) => {
|
||||
const agent = await seedMockAgentWorkspace({
|
||||
repoPrefix: "dictation-permission-",
|
||||
title: "Dictation permission",
|
||||
});
|
||||
const draft = "Keep my draft";
|
||||
await installDictationFailureHarness(page);
|
||||
try {
|
||||
await openAgentRoute(page, agent);
|
||||
await expectComposerVisible(page);
|
||||
await fillComposerDraft(page, draft);
|
||||
|
||||
const setMicrophonePermission = await controlMicrophonePermission(page);
|
||||
await setMicrophonePermission("denied");
|
||||
await startDictationByMic(page);
|
||||
await expectDictationPermissionError(page);
|
||||
await expect(composerLocator(page)).toHaveValue(draft);
|
||||
|
||||
await setMicrophonePermission("granted");
|
||||
await startDictationByMic(page);
|
||||
await expect(page.getByRole("button", { name: "Cancel dictation", exact: true })).toBeVisible();
|
||||
await expect(page.getByText("Allow microphone access and try again.")).toHaveCount(0);
|
||||
await page.getByRole("button", { name: "Cancel dictation", exact: true }).click();
|
||||
await expect(composerLocator(page)).toHaveValue(draft);
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("shows dictation failure when the terminal prompt starts it by shortcut", async ({ page }) => {
|
||||
const workspace = await seedWorkspace({ repoPrefix: "terminal-dictation-permission-" });
|
||||
const profile = {
|
||||
id: "echo-prompt",
|
||||
name: "Echo prompt",
|
||||
command: "echo",
|
||||
args: ["{{{prompt}}}"],
|
||||
};
|
||||
const profiles = await seedTerminalProfiles([profile]);
|
||||
await installDictationFailureHarness(page);
|
||||
try {
|
||||
await gotoAppShell(page);
|
||||
await waitForSidebarHydration(page);
|
||||
await openNewWorkspaceComposer(page, workspace);
|
||||
await selectLaunchOption(page, profile.id);
|
||||
|
||||
const setMicrophonePermission = await controlMicrophonePermission(page);
|
||||
await setMicrophonePermission("denied");
|
||||
await terminalPromptInput(page).press("Control+d");
|
||||
await expectDictationPermissionError(page);
|
||||
} finally {
|
||||
await profiles.restore();
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { execSync } from "node:child_process";
|
||||
import { existsSync } from "node:fs";
|
||||
import { realpath } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { buildHostWorkspaceRoute } from "@/utils/host-routes";
|
||||
import { expect, test } from "../support/fixtures";
|
||||
@@ -892,53 +890,6 @@ test.describe("New workspace flow", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("existing worktree starts the first agent in the chosen worktree", async ({ page }) => {
|
||||
const tempRepo = await createTempGitRepo("existing-worktree-");
|
||||
// Made with git, not Paseo: the list holds every git worktree of the repository.
|
||||
const worktreePath = path.join(tempRepo.path, "manual-worktree");
|
||||
execSync(`git worktree add -b e2e/manual ${JSON.stringify(worktreePath)}`, {
|
||||
cwd: tempRepo.path,
|
||||
stdio: "ignore",
|
||||
});
|
||||
|
||||
try {
|
||||
const openedProject = await openProjectViaDaemon(client, tempRepo.path);
|
||||
localWorkspaceIds.add(openedProject.workspaceId);
|
||||
localProjectIds.add(openedProject.projectId);
|
||||
|
||||
await gotoAppShell(page);
|
||||
await waitForSidebarHydration(page);
|
||||
await openNewWorkspaceComposer(page, {
|
||||
projectKey: openedProject.projectKey,
|
||||
projectDisplayName: openedProject.projectDisplayName,
|
||||
});
|
||||
await selectWorkspaceIsolation(page, "existing");
|
||||
await expect(page.getByTestId("new-workspace-worktree-picker-trigger")).toContainText(
|
||||
"e2e/manual",
|
||||
);
|
||||
await submitNewWorkspacePrompt(page);
|
||||
|
||||
const createdWorkspace = await assertNewWorkspaceSidebarAndHeader(page, {
|
||||
serverId: getServerId(),
|
||||
client,
|
||||
previousWorkspaceId: openedProject.workspaceId,
|
||||
projectDisplayName: openedProject.projectDisplayName,
|
||||
});
|
||||
localWorkspaceIds.add(createdWorkspace.workspaceId);
|
||||
expect(await realpath(createdWorkspace.workspaceDirectory)).toBe(
|
||||
await realpath(worktreePath),
|
||||
);
|
||||
|
||||
const agentTabs = page
|
||||
.getByTestId(`workspace-deck-entry-${getServerId()}:${createdWorkspace.workspaceId}`)
|
||||
.filter({ visible: true })
|
||||
.locator('[data-testid^="workspace-tab-agent_"]');
|
||||
await expect(agentTabs).toHaveCount(1, { timeout: 30_000 });
|
||||
} finally {
|
||||
await tempRepo.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("branch picker opens via keyboard and selects the filtered option on Enter", async ({
|
||||
page,
|
||||
}) => {
|
||||
|
||||
@@ -2,16 +2,10 @@ import { copyPluginExample } from "../support/helpers/plugin-fixture";
|
||||
import { expect, test as base, type Page } from "../support/fixtures";
|
||||
import { gotoAppShell } from "../support/helpers/app";
|
||||
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
|
||||
import { waitForSettledPosition } from "../support/helpers/sheet-layout";
|
||||
|
||||
async function openExample(page: Page, example: string) {
|
||||
await page.getByRole("button", { name: `Open ${example}`, exact: true }).click();
|
||||
const title = page.getByText(`Modal example: ${example}`, { exact: true });
|
||||
// A compact sheet holds below the viewport and then slides up, so a pointer placed before it
|
||||
// stops lands on whatever slides under it. The settle check starts once the slide has begun;
|
||||
// two equal reads during the hold would otherwise count as settled.
|
||||
await expect(title).toBeInViewport();
|
||||
await waitForSettledPosition(title);
|
||||
await expect(page.getByText(`Modal example: ${example}`, { exact: true })).toBeVisible();
|
||||
}
|
||||
|
||||
async function closeExample(page: Page) {
|
||||
|
||||
@@ -208,35 +208,6 @@ test.describe("Plugin sidebar items", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("a short desktop sidebar keeps workspaces usable while navigation scrolls", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 1280, height: 480 });
|
||||
await gotoAppShell(page);
|
||||
await expect(botRow(page, "status")).toBeAttached();
|
||||
const workspace = visibleTestId(page, `sidebar-workspace-row-${getServerId()}:${workspaceId}`);
|
||||
await expect(workspace).toBeInViewport({ ratio: 1 });
|
||||
await expect(botRow(page, "status")).not.toBeInViewport();
|
||||
|
||||
await test.step("navigation stays within half the sidebar", async () => {
|
||||
const nav = await boxOf(visibleTestId(page, "sidebar-nav-scroll"));
|
||||
expect(nav.height).toBeLessThanOrEqual(480 / 2 + 1);
|
||||
});
|
||||
|
||||
await test.step("scrolling navigation reaches its last row without moving workspaces", async () => {
|
||||
const before = await boxOf(workspace);
|
||||
await visibleTestId(page, "sidebar-global-new-workspace").hover();
|
||||
await page.mouse.wheel(0, 800);
|
||||
await expect(botRow(page, "status")).toBeInViewport({ ratio: 1 });
|
||||
await expect(workspace).toBeInViewport({ ratio: 1 });
|
||||
expect((await boxOf(workspace)).y).toBe(before.y);
|
||||
await qaScreenshot(page, "desktop-short-sidebar-nav-scrolled");
|
||||
await botRow(page, "status").click();
|
||||
await expect(page.getByText("Bot status details", { exact: true })).toBeVisible();
|
||||
await page.getByRole("button", { name: "Close bot status", exact: true }).click();
|
||||
});
|
||||
});
|
||||
|
||||
test("a restored plugin screen waits for its catalog before rendering", async ({ page }) => {
|
||||
await page.setViewportSize(WIDE);
|
||||
await gotoWorkspace(page, workspaceId);
|
||||
@@ -362,16 +333,6 @@ test.describe("Plugin sidebar items", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("a plugin screen reads workspaces through the state hooks", async ({ page }) => {
|
||||
await page.setViewportSize(WIDE);
|
||||
await gotoWorkspace(page, workspaceId);
|
||||
await expect(headerRow(page, SHOWCASE_PLUGIN_ID, "deploys")).toBeVisible({ timeout: 30_000 });
|
||||
await runCommand(page, "Open plugin workspaces");
|
||||
await expect(screenTitle(page)).toHaveText("Workspaces");
|
||||
await expect(page.getByText(`Workspace ${workspaceId}`, { exact: true })).toBeVisible();
|
||||
await expect(page.getByText("Plugin failed", { exact: false })).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("a header row's shortcut hint presses the row", async ({ page }) => {
|
||||
await page.setViewportSize(WIDE);
|
||||
await gotoWorkspace(page, workspaceId);
|
||||
|
||||
@@ -1,29 +1,16 @@
|
||||
import type { Locator } from "@playwright/test";
|
||||
import { expect, test, type Page } from "../support/fixtures";
|
||||
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
|
||||
import {
|
||||
closeCommandCenter,
|
||||
openCommandCenter,
|
||||
selectCommandCenterTab,
|
||||
} from "../support/helpers/command-center";
|
||||
import { installDaemonWebSocketGate } from "../support/helpers/daemon-websocket-gate";
|
||||
import { scrollChatAwayFromBottom } from "../support/helpers/agent-bottom-anchor";
|
||||
import {
|
||||
attachComposerTestImage,
|
||||
composerLocator,
|
||||
expectComposerDraft,
|
||||
expectComposerFocused,
|
||||
expectComposerNotFocused,
|
||||
expectComposerVisible,
|
||||
fillComposerDraft,
|
||||
submitMessage,
|
||||
submitMessageWithButton,
|
||||
} from "../support/helpers/composer";
|
||||
import { readReplicaCache, writeReplicaCache } from "../support/helpers/replica-cache-storage";
|
||||
import {
|
||||
disconnectViewedTimeline,
|
||||
releaseHeldCatchUp,
|
||||
restoreViewedTimelineHoldingCatchUp,
|
||||
} from "../support/helpers/timeline-resume";
|
||||
|
||||
// UI plumbing contract against the dev mock provider. Real-provider behavior is tested in `daemon-e2e/*-rewind.real.e2e.test.ts`.
|
||||
|
||||
@@ -46,17 +33,6 @@ async function selectRewindOption(page: Page, name: string): Promise<void> {
|
||||
await option.click();
|
||||
}
|
||||
|
||||
async function searchRewindActions(page: Page): Promise<Locator> {
|
||||
const palette = await openCommandCenter(page);
|
||||
await selectCommandCenterTab(palette, "Actions");
|
||||
await palette.getByRole("textbox").fill("rewind last turn");
|
||||
return palette;
|
||||
}
|
||||
|
||||
function rewindAction(palette: Locator, name: string): Locator {
|
||||
return palette.getByRole("button", { name: `${name} This action cannot be undone`, exact: true });
|
||||
}
|
||||
|
||||
async function rewriteCachedMessageAsLegacyRow(
|
||||
page: Page,
|
||||
input: { prompt: string; agentId: string; workspaceId: string },
|
||||
@@ -223,6 +199,10 @@ test.describe("Rewind sheet", () => {
|
||||
await expectUserMessageCount(page, 2);
|
||||
await session.client.waitForFinish(session.agentId);
|
||||
|
||||
await scrollChatAwayFromBottom(page, {
|
||||
deltaY: -900,
|
||||
minDistanceFromBottom: 300,
|
||||
});
|
||||
await userMessage(page, firstPrompt).hover();
|
||||
await page.getByTestId("rewind-menu-trigger").first().click();
|
||||
const rewindSheet = page.getByTestId("rewind-menu-content");
|
||||
@@ -237,7 +217,6 @@ test.describe("Rewind sheet", () => {
|
||||
await expect(page.getByText("Cycle 1", { exact: true })).toHaveCount(0);
|
||||
await expectUserMessageCount(page, 1);
|
||||
await expectComposerDraft(page, firstPrompt);
|
||||
await expectComposerFocused(page);
|
||||
|
||||
await submitMessage(page, replacementPrompt);
|
||||
await expectUserMessageVisible(page, replacementPrompt);
|
||||
@@ -253,7 +232,17 @@ test.describe("Rewind sheet", () => {
|
||||
await selectRewindOption(page, "Rewind files");
|
||||
await expect(page.getByTestId("rewind-menu-content")).toHaveCount(0);
|
||||
await expectComposerDraft(page, "");
|
||||
await expectComposerNotFocused(page);
|
||||
await expectUserMessageCount(page, 2);
|
||||
|
||||
const preservedDraft = "Keep this human draft after rewind.";
|
||||
await fillComposerDraft(page, preservedDraft);
|
||||
await composerLocator(page).evaluate((element) => element.blur());
|
||||
await userMessage(page, replacementPrompt).hover();
|
||||
await page.getByTestId("rewind-menu-trigger").last().click();
|
||||
await expect(page.getByTestId("rewind-menu-content")).toBeVisible();
|
||||
await selectRewindOption(page, "Rewind files");
|
||||
await expect(page.getByTestId("rewind-menu-content")).toHaveCount(0);
|
||||
await expectComposerDraft(page, preservedDraft);
|
||||
await expectUserMessageCount(page, 2);
|
||||
|
||||
await fillComposerDraft(page, "");
|
||||
@@ -264,109 +253,12 @@ test.describe("Rewind sheet", () => {
|
||||
await selectRewindOption(page, "Rewind conversation and files");
|
||||
await expect(page.getByTestId("rewind-menu-content")).toHaveCount(0);
|
||||
await expectComposerDraft(page, replacementPrompt);
|
||||
await expectComposerFocused(page);
|
||||
await expectUserMessageCount(page, 1);
|
||||
} finally {
|
||||
await session.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("rewinds the latest turn from the Command Center", async ({ page }) => {
|
||||
const firstPrompt = "Keep this earlier turn.";
|
||||
const latestPrompt = "Edit this latest turn.";
|
||||
const session = await seedMockAgentWorkspace({
|
||||
repoPrefix: "rewind-command-center-e2e-",
|
||||
title: "Command Center rewind",
|
||||
initialPrompt: firstPrompt,
|
||||
});
|
||||
|
||||
try {
|
||||
await openAgentRoute(page, session);
|
||||
await expectComposerVisible(page);
|
||||
await submitMessage(page, latestPrompt);
|
||||
await expectUserMessageVisible(page, latestPrompt);
|
||||
await session.client.waitForFinish(session.agentId);
|
||||
|
||||
const palette = await searchRewindActions(page);
|
||||
await expect(rewindAction(palette, "Rewind files")).toBeVisible();
|
||||
await expect(rewindAction(palette, "Rewind conversation and files")).toBeVisible();
|
||||
await rewindAction(palette, "Rewind conversation").click();
|
||||
|
||||
await expectUserMessageVisible(page, firstPrompt);
|
||||
await expect(userMessage(page, latestPrompt)).toHaveCount(0);
|
||||
await expectComposerDraft(page, latestPrompt);
|
||||
await expectComposerFocused(page);
|
||||
} finally {
|
||||
await session.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("waits for the latest prompt before offering Command Center rewind after reconnect", async ({
|
||||
page,
|
||||
}) => {
|
||||
const cachedPrompt = "Keep the prompt that was visible before reconnect.";
|
||||
const latestPrompt = "Rewind the prompt sent while the app was disconnected.";
|
||||
const gate = await installDaemonWebSocketGate(page);
|
||||
const session = await seedMockAgentWorkspace({
|
||||
repoPrefix: "rewind-reconnect-e2e-",
|
||||
title: "Rewind after reconnect",
|
||||
initialPrompt: cachedPrompt,
|
||||
});
|
||||
|
||||
try {
|
||||
await openAgentRoute(page, session);
|
||||
await expectUserMessageVisible(page, cachedPrompt);
|
||||
const initialPalette = await searchRewindActions(page);
|
||||
await expect(rewindAction(initialPalette, "Rewind conversation")).toBeVisible();
|
||||
await closeCommandCenter(page);
|
||||
|
||||
await disconnectViewedTimeline(page, gate);
|
||||
await session.client.sendAgentMessage(session.agentId, latestPrompt);
|
||||
await session.client.waitForFinish(session.agentId);
|
||||
await restoreViewedTimelineHoldingCatchUp(page, gate);
|
||||
|
||||
const palette = await searchRewindActions(page);
|
||||
await expect(palette.getByText("No matches", { exact: true })).toBeVisible();
|
||||
await releaseHeldCatchUp(page, gate);
|
||||
await rewindAction(palette, "Rewind conversation").click();
|
||||
|
||||
await expectUserMessageVisible(page, cachedPrompt);
|
||||
await expectComposerDraft(page, latestPrompt);
|
||||
} finally {
|
||||
gate.restore();
|
||||
await session.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("hides rewind when the latest prompt only contains an attachment", async ({ page }) => {
|
||||
const session = await seedMockAgentWorkspace({
|
||||
repoPrefix: "rewind-image-only-e2e-",
|
||||
title: "Rewind image-only prompt",
|
||||
initialPrompt: "Earlier text prompt.",
|
||||
});
|
||||
|
||||
try {
|
||||
await openAgentRoute(page, session);
|
||||
await expectComposerVisible(page);
|
||||
const palette = await searchRewindActions(page);
|
||||
await expect(rewindAction(palette, "Rewind conversation")).toBeVisible();
|
||||
await closeCommandCenter(page);
|
||||
|
||||
await attachComposerTestImage(page);
|
||||
await submitMessageWithButton(page, "");
|
||||
const imagePrompt = page.getByTestId("user-message").filter({
|
||||
has: page.getByRole("button", { name: "Open image attachment" }),
|
||||
});
|
||||
await expect(imagePrompt).toHaveAttribute("aria-busy", "false");
|
||||
await session.client.waitForFinish(session.agentId);
|
||||
|
||||
const reopened = await searchRewindActions(page);
|
||||
await expect(reopened.getByText("No matches", { exact: true })).toBeVisible();
|
||||
} finally {
|
||||
await session.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("surfaces rewind failures without crashing the page", async ({ page }) => {
|
||||
const firstPrompt = "emit 1 coalesced agent stream updates for failed rewind turn.";
|
||||
const rewindError = "No file checkpoint found for message rewind-failure-e2e.";
|
||||
@@ -385,10 +277,6 @@ test.describe("Rewind sheet", () => {
|
||||
|
||||
await expectUserMessageVisible(page, firstPrompt);
|
||||
|
||||
const palette = await searchRewindActions(page);
|
||||
await rewindAction(palette, "Rewind conversation").click();
|
||||
await expect(page.getByTestId("app-toast-message")).toHaveText(rewindError);
|
||||
|
||||
await userMessage(page, firstPrompt).hover();
|
||||
await page.getByTestId("rewind-menu-trigger").first().click();
|
||||
const rewindSheet = page.getByTestId("rewind-menu-content");
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
import { expect, type Page } from "@playwright/test";
|
||||
import { test } from "../support/fixtures";
|
||||
import { gotoAppShell, openSettings } from "../support/helpers/app";
|
||||
import { renameHostFromSettings } from "../support/helpers/hosts";
|
||||
import { getServerId } from "../support/helpers/server-id";
|
||||
import { openHostSection, selectSettingsHost } from "../support/helpers/settings";
|
||||
|
||||
const REGISTRY_KEY = "@paseo:daemon-registry";
|
||||
const SEED_NONCE_KEY = "@paseo:e2e-seed-nonce";
|
||||
const DISABLE_DEFAULT_SEED_ONCE_KEY = "@paseo:e2e-disable-default-seed-once";
|
||||
|
||||
// What a build with a connection kind this one doesn't know leaves in the registry: an extra
|
||||
// connection on a host this build can reach, and a host reached only through it.
|
||||
const UNKNOWN_CONNECTION = { id: "future:garage", type: "futureKind", address: "garage" };
|
||||
const UNKNOWN_HOST = {
|
||||
serverId: "srv_e2e_unknown_connection_host",
|
||||
label: "Unknown connection host",
|
||||
connections: [{ id: "future:roof", type: "futureKind", address: "roof" }],
|
||||
preferredConnectionId: "future:roof",
|
||||
};
|
||||
const OFFLINE_HOST = {
|
||||
serverId: "srv_e2e_saved_offline_host",
|
||||
label: "Saved offline host",
|
||||
password: "e2e-fake-password",
|
||||
connections: [{ id: "direct:127.0.0.1:59999", type: "directTcp", endpoint: "127.0.0.1:59999" }],
|
||||
preferredConnectionId: "direct:127.0.0.1:59999",
|
||||
};
|
||||
|
||||
interface StoredHost {
|
||||
serverId: string;
|
||||
label?: string;
|
||||
password?: string;
|
||||
connections: unknown[];
|
||||
}
|
||||
|
||||
async function addUnreadableEntriesAndReload(page: Page): Promise<void> {
|
||||
await page.evaluate(
|
||||
({ keys, primaryServerId, unknownConnection, offlineHost, unknownHost }) => {
|
||||
const nonce = localStorage.getItem(keys.nonce);
|
||||
if (!nonce) {
|
||||
throw new Error("Expected the e2e seed nonce before overriding the host registry.");
|
||||
}
|
||||
const registry: StoredHost[] = JSON.parse(localStorage.getItem(keys.registry) ?? "[]");
|
||||
registry
|
||||
.find((host) => host.serverId === primaryServerId)
|
||||
?.connections.push(unknownConnection);
|
||||
registry.push(offlineHost, unknownHost);
|
||||
localStorage.setItem(keys.registry, JSON.stringify(registry));
|
||||
localStorage.setItem(keys.disableSeedOnce, nonce);
|
||||
},
|
||||
{
|
||||
keys: {
|
||||
registry: REGISTRY_KEY,
|
||||
nonce: SEED_NONCE_KEY,
|
||||
disableSeedOnce: DISABLE_DEFAULT_SEED_ONCE_KEY,
|
||||
},
|
||||
primaryServerId: getServerId(),
|
||||
unknownConnection: UNKNOWN_CONNECTION,
|
||||
offlineHost: OFFLINE_HOST,
|
||||
unknownHost: UNKNOWN_HOST,
|
||||
},
|
||||
);
|
||||
await page.reload();
|
||||
}
|
||||
|
||||
async function readStoredRegistry(page: Page): Promise<StoredHost[] | null> {
|
||||
return page.evaluate((key) => JSON.parse(localStorage.getItem(key) ?? "null"), REGISTRY_KEY);
|
||||
}
|
||||
|
||||
async function readStoredHost(page: Page, serverId: string): Promise<StoredHost | undefined> {
|
||||
return (await readStoredRegistry(page))?.find((host) => host.serverId === serverId);
|
||||
}
|
||||
|
||||
test("saved hosts survive a registry entry this build can't read, and saving keeps it", async ({
|
||||
page,
|
||||
}) => {
|
||||
await gotoAppShell(page);
|
||||
await addUnreadableEntriesAndReload(page);
|
||||
|
||||
await test.step("both readable hosts are listed", async () => {
|
||||
await page.getByTestId("sidebar-hosts-trigger").click();
|
||||
await expect(page.getByTestId(`sidebar-host-row-${getServerId()}`)).toBeVisible();
|
||||
await expect(page.getByTestId(`sidebar-host-row-${OFFLINE_HOST.serverId}`)).toBeVisible();
|
||||
await expect(page.getByTestId(`sidebar-host-row-${UNKNOWN_HOST.serverId}`)).toHaveCount(0);
|
||||
await page.keyboard.press("Escape");
|
||||
});
|
||||
|
||||
await test.step("renaming a host keeps its password and the entries it can't read", async () => {
|
||||
await openSettings(page);
|
||||
await selectSettingsHost(page, OFFLINE_HOST.serverId);
|
||||
await openHostSection(page, OFFLINE_HOST.serverId, "host");
|
||||
await renameHostFromSettings(page, "Renamed offline host");
|
||||
|
||||
await expect
|
||||
.poll(() => readStoredHost(page, OFFLINE_HOST.serverId))
|
||||
.toMatchObject({ label: "Renamed offline host", password: OFFLINE_HOST.password });
|
||||
const stored = await readStoredRegistry(page);
|
||||
expect(stored?.map((host) => host.serverId)).toEqual([
|
||||
getServerId(),
|
||||
OFFLINE_HOST.serverId,
|
||||
UNKNOWN_HOST.serverId,
|
||||
]);
|
||||
expect(stored?.[0]?.connections).toContainEqual(UNKNOWN_CONNECTION);
|
||||
expect(stored?.[2]).toEqual(UNKNOWN_HOST);
|
||||
});
|
||||
});
|
||||
@@ -362,7 +362,7 @@ test.describe("Schedules project target", () => {
|
||||
).toHaveCount(0);
|
||||
await page.getByTestId("schedule-isolation-trigger").click();
|
||||
await page.getByTestId("schedule-isolation-worktree").click();
|
||||
await expect(page.getByTestId("schedule-isolation-trigger")).toContainText("New worktree");
|
||||
await expect(page.getByTestId("schedule-isolation-trigger")).toContainText("Worktree");
|
||||
await page.getByTestId("schedule-archive-on-finish-switch").click();
|
||||
await page.getByLabel("Schedule name").fill(scheduleName);
|
||||
await page.getByLabel("Prompt").fill("Run with custom workspace cleanup.");
|
||||
@@ -383,7 +383,7 @@ test.describe("Schedules project target", () => {
|
||||
const formSheet = page.getByTestId("schedule-form-sheet");
|
||||
await expect(formSheet).toBeVisible({ timeout: 10_000 });
|
||||
await expectStableHeight(formSheet);
|
||||
await expect(page.getByTestId("schedule-isolation-trigger")).toContainText("New worktree");
|
||||
await expect(page.getByTestId("schedule-isolation-trigger")).toContainText("Worktree");
|
||||
await expect(page.getByTestId("schedule-archive-on-finish-switch")).toHaveAttribute(
|
||||
"aria-checked",
|
||||
"false",
|
||||
|
||||
@@ -110,7 +110,6 @@ test.describe("Sidebar items in Appearance settings", () => {
|
||||
|
||||
await test.step("the sidebar starts in the default order", async () => {
|
||||
await expectSidebarOrder(page, ["new-workspace", "history", "search", "schedules"]);
|
||||
await expect(page.locator('[data-testid="sidebar-nav-separator"]:visible')).toHaveCount(1);
|
||||
});
|
||||
|
||||
await test.step("the Sidebar section lists every item in the same order", async () => {
|
||||
@@ -196,9 +195,6 @@ test.describe("Sidebar items in Appearance settings", () => {
|
||||
await expectSidebarItemHidden(page, "history");
|
||||
await expectSidebarItemHidden(page, "search");
|
||||
await expectSidebarItemHidden(page, "schedules");
|
||||
// Nothing is left above the Workspaces section: no drag strip, no empty divider.
|
||||
await expect(page.locator('[data-testid="sidebar-nav-drag-strip"]:visible')).toHaveCount(0);
|
||||
await expect(page.locator('[data-testid="sidebar-nav-separator"]:visible')).toHaveCount(0);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -503,35 +503,6 @@ test.describe("terminal history with a finger", () => {
|
||||
await expectMouseWheelScrollsHistory(page);
|
||||
});
|
||||
|
||||
test("finger scrolling leaves the keyboard closed and a tap focuses input", async ({ page }) => {
|
||||
await openPhoneTerminalHistory(page);
|
||||
await input(page).evaluate((element) => element.blur());
|
||||
await expect(input(page)).not.toBeFocused();
|
||||
|
||||
await expectSingleFingerScroll(page, 24);
|
||||
await expect(input(page)).not.toBeFocused();
|
||||
await expectSingleFingerScroll(page, 1);
|
||||
await expect(input(page)).not.toBeFocused();
|
||||
|
||||
await tapTerminalScreen(page);
|
||||
await expect(input(page)).toBeFocused();
|
||||
// Android's Back button hides the IME without blurring this input.
|
||||
await expectSingleFingerScroll(page, 24);
|
||||
await expect(input(page)).not.toBeFocused();
|
||||
await terminalScreen(page).click();
|
||||
await expect(input(page)).toBeFocused();
|
||||
});
|
||||
|
||||
test("finger scrolling keeps an open keyboard open", async ({ page }) => {
|
||||
await openPhoneTerminalHistory(page);
|
||||
await tapTerminalScreen(page);
|
||||
await expect(input(page)).toBeFocused();
|
||||
|
||||
await showSoftwareKeyboard(page);
|
||||
await expectSingleFingerScroll(page, 24);
|
||||
await expect(input(page)).toBeFocused();
|
||||
});
|
||||
|
||||
for (const mode of ["alternate", "mouse"] as const) {
|
||||
test(`preserves finger navigation in ${mode} input mode`, async ({ page }) => {
|
||||
await openPhoneInputCapture(page, mode);
|
||||
@@ -560,32 +531,6 @@ async function openPhoneTerminalHistory(page: Page) {
|
||||
});
|
||||
await openPhoneTerminal(page);
|
||||
await expect.poll(() => getTerminalBufferText(page)).toContain("HISTORY_150");
|
||||
await expect
|
||||
.poll(() => page.evaluate(() => window.__paseoTerminal!.buffer.active.baseY))
|
||||
.toBeGreaterThan(0);
|
||||
await page.evaluate(() => window.__paseoTerminal!.scrollToBottom());
|
||||
await expect.poll(() => viewport(page)).toBeGreaterThan(0);
|
||||
}
|
||||
|
||||
function terminalScreen(page: Page) {
|
||||
return page.getByTestId("terminal-surface").filter({ visible: true }).locator(".xterm-screen");
|
||||
}
|
||||
|
||||
async function tapTerminalScreen(page: Page) {
|
||||
const box = await terminalScreen(page).boundingBox();
|
||||
expect(box).not.toBeNull();
|
||||
await page.touchscreen.tap(box!.x + box!.width / 2, box!.y + box!.height / 3);
|
||||
}
|
||||
|
||||
// Playwright cannot show a software keyboard. A phone browser keeps the layout
|
||||
// viewport and shortens the visual viewport by the keyboard height.
|
||||
async function showSoftwareKeyboard(page: Page) {
|
||||
await page.evaluate(() => {
|
||||
Object.defineProperty(window.visualViewport!, "height", {
|
||||
configurable: true,
|
||||
get: () => window.innerHeight - 300,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function openPhoneInputCapture(page: Page, mode: "alternate" | "mouse") {
|
||||
@@ -625,20 +570,6 @@ async function openPhoneTerminal(page: Page) {
|
||||
await page.getByTestId(`sidebar-workspace-row-${getServerId()}:${harness.workspaceId}`).click();
|
||||
await expect(page.getByRole("textbox", { name: "Terminal input" })).toBeVisible();
|
||||
await expect(page.getByTestId("terminal-surface").filter({ visible: true })).toBeVisible();
|
||||
// The terminal stays mounted while the sidebar's closing backdrop still intercepts input.
|
||||
await expect
|
||||
.poll(() =>
|
||||
page
|
||||
.getByTestId("terminal-surface")
|
||||
.filter({ visible: true })
|
||||
.evaluate((root) => {
|
||||
const box = root.querySelector(".xterm-screen")!.getBoundingClientRect();
|
||||
return root.contains(
|
||||
document.elementFromPoint(box.x + box.width / 2, box.y + box.height / 3),
|
||||
);
|
||||
}),
|
||||
)
|
||||
.toBe(true);
|
||||
}
|
||||
|
||||
async function expectMouseWheelScrollsHistory(page: Page) {
|
||||
|
||||
@@ -705,7 +705,7 @@ test("a scheduled heartbeat opens a separate turn without reopening the previous
|
||||
});
|
||||
const schedules = agent.client as unknown as Pick<
|
||||
DaemonClient,
|
||||
"scheduleCreate" | "scheduleRunOnce" | "scheduleDelete" | "scheduleList"
|
||||
"scheduleCreate" | "scheduleRunOnce" | "scheduleDelete"
|
||||
>;
|
||||
let scheduleId: string | undefined;
|
||||
try {
|
||||
@@ -728,15 +728,7 @@ test("a scheduled heartbeat opens a separate turn without reopening the previous
|
||||
});
|
||||
expect(created.error).toBeNull();
|
||||
scheduleId = created.schedule!.id;
|
||||
const running = page.getByTestId("workspace-status-indicator-running");
|
||||
const tasks = page.getByRole("button", { name: "1 background task", exact: true });
|
||||
await expect(tasks).toBeVisible();
|
||||
await expect(running).toHaveCount(0);
|
||||
|
||||
const [fired] = await Promise.all([
|
||||
schedules.scheduleRunOnce({ id: scheduleId }),
|
||||
expect(running.first()).toBeVisible(),
|
||||
]);
|
||||
const fired = await schedules.scheduleRunOnce({ id: scheduleId });
|
||||
expect(fired.error).toBeNull();
|
||||
await expect(
|
||||
page.getByTestId("tool-call-badge").filter({ hasText: /^Heartbeat/ }),
|
||||
@@ -751,17 +743,7 @@ test("a scheduled heartbeat opens a separate turn without reopening the previous
|
||||
await expect(summaries).toHaveCount(2);
|
||||
await expect.poll(() => rowsBetweenLatestSummaryAndReply(page)).toBe(0);
|
||||
await expect(page.getByRole("button", { name: /^Worked for/ })).toHaveCount(2);
|
||||
await expect(running).toHaveCount(0);
|
||||
await expect(page.getByRole("button", { name: "Stop agent", exact: true })).toHaveCount(0);
|
||||
await tasks.click();
|
||||
const panel = page.getByTestId("background-work-panel");
|
||||
await expect(panel).toContainText("Heartbeat");
|
||||
await panel.getByRole("button", { name: "Stop Check the completed work" }).click();
|
||||
await expect(tasks).toHaveCount(0);
|
||||
await expect(running).toHaveCount(0);
|
||||
const remaining = await schedules.scheduleList();
|
||||
expect(remaining.error).toBeNull();
|
||||
expect(remaining.schedules.map((schedule) => schedule.id)).not.toContain(scheduleId);
|
||||
await page.screenshot({ path: "/tmp/heartbeat-turn-footer.png" });
|
||||
} finally {
|
||||
if (scheduleId) await schedules.scheduleDelete({ id: scheduleId });
|
||||
await agent.cleanup();
|
||||
|
||||
@@ -23,8 +23,6 @@ import {
|
||||
outlastUndoWindow,
|
||||
pressArchiveShortcut,
|
||||
pressUndoShortcut,
|
||||
readSidebarListLayout,
|
||||
recordLastRowBottomPerFrame,
|
||||
resizeSidebarToMinimum,
|
||||
rowArchiveButton,
|
||||
rowKebab,
|
||||
@@ -123,7 +121,7 @@ test.describe("Workspace archive undo", () => {
|
||||
expect(shortcutBox.x - (labelBox.x + labelBox.width)).toBeLessThanOrEqual(8.5);
|
||||
});
|
||||
|
||||
test("a long list scrolls its last row clear of the toast, and settles back smoothly after it", async ({
|
||||
test("a long list ends just below its last row, and the toast over it moves no row", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.clock.install({ time: Date.now() });
|
||||
@@ -138,35 +136,18 @@ test.describe("Workspace archive undo", () => {
|
||||
const worktree = await seedWorktree(page, "archive-toast-long-list");
|
||||
|
||||
const resting = await scrollSidebarListToEnd(page);
|
||||
const restingEndGap = resting.listBottom - resting.rowBottoms.at(-1)!;
|
||||
expect(restingEndGap).toBeLessThan(resting.rowHeight);
|
||||
expect(resting.listBottom - resting.rowBottoms.at(-1)!).toBeLessThan(resting.rowHeight);
|
||||
|
||||
await archiveFromRowButton(page, worktree.workspaceId);
|
||||
await page.mouse.move(0, 0);
|
||||
const withToast = await scrollSidebarListToEnd(page);
|
||||
const toastBox = await archivedToast(page).boundingBox();
|
||||
if (!toastBox) throw new Error("Toast is not laid out");
|
||||
// The list keeps its usual end gap, measured from the toast's top instead of its own bottom.
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const layout = await scrollSidebarListToEnd(page);
|
||||
return Math.round(toastBox.y - layout.rowBottoms.at(-1)!);
|
||||
})
|
||||
.toBe(Math.round(restingEndGap));
|
||||
expect(toastBox.y + toastBox.height).toBeLessThanOrEqual(withToast.listBottom);
|
||||
|
||||
const frames = recordLastRowBottomPerFrame(page, 40);
|
||||
await outlastUndoWindow(page);
|
||||
const bottoms = await frames;
|
||||
await expect(archivedToast(page)).toHaveCount(0);
|
||||
|
||||
// Without scrolling again, the list ends just below its last row once more.
|
||||
const settled = await readSidebarListLayout(page);
|
||||
expect(settled.listBottom - settled.rowBottoms.at(-1)!).toBeCloseTo(restingEndGap, 0);
|
||||
// The rows travel down by the toast's height over several frames, never in one jump.
|
||||
const travel = bottoms.at(-1)! - bottoms[0]!;
|
||||
expect(travel).toBeGreaterThan(toastBox.height);
|
||||
const steps = bottoms.slice(1).map((bottom, index) => bottom - bottoms[index]!);
|
||||
expect(Math.min(...steps)).toBeGreaterThanOrEqual(0);
|
||||
expect(Math.max(...steps)).toBeLessThan(travel / 2);
|
||||
expect(await scrollSidebarListToEnd(page)).toEqual(withToast);
|
||||
} finally {
|
||||
for (const projectId of fillerProjectIds) {
|
||||
await client.removeProject(projectId).catch(() => undefined);
|
||||
|
||||
@@ -3,7 +3,6 @@ import { gotoAppShell } from "../support/helpers/app";
|
||||
import { getServerId } from "../support/helpers/server-id";
|
||||
import { seedWorkspace } from "../support/helpers/seed-client";
|
||||
import { waitForSidebarHydration } from "../support/helpers/workspace-ui";
|
||||
import { openWorkspaceSidebarKebab } from "../support/helpers/sidebar";
|
||||
import { daemonWsRoutePattern } from "../support/helpers/daemon-port";
|
||||
|
||||
interface SessionEnvelope {
|
||||
@@ -74,36 +73,35 @@ function labelRow(page: import("@playwright/test").Page, name: string) {
|
||||
return page.getByTestId(`workspace-label-picker-row-${name}`);
|
||||
}
|
||||
|
||||
async function box(locator: import("@playwright/test").Locator) {
|
||||
const measured = await locator.boundingBox();
|
||||
if (!measured) throw new Error("expected a visible element to measure");
|
||||
return measured;
|
||||
}
|
||||
|
||||
async function size(locator: import("@playwright/test").Locator) {
|
||||
const { width, height } = await settled(locator);
|
||||
await settled(locator);
|
||||
const { width, height } = await box(locator);
|
||||
return { width, height };
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits until an element is on screen and stops moving, and returns where it settled.
|
||||
* Waits until an element stops moving.
|
||||
*
|
||||
* The flyout scales in and the sidebar behind it re-lays out as the filter changes, so a rail
|
||||
* measured mid-animation is not a rail — and a measurement built from two `boundingBox()` calls
|
||||
* would take its two halves from two different frames. A row that has not been laid out yet has
|
||||
* no box at all; that is not settled either, so the poll keeps waiting instead of failing.
|
||||
* would take its two halves from two different frames.
|
||||
*/
|
||||
async function settled(locator: import("@playwright/test").Locator) {
|
||||
const last: { box: Awaited<ReturnType<typeof locator.boundingBox>>; key: string | null } = {
|
||||
box: null,
|
||||
key: null,
|
||||
};
|
||||
let previous = "";
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const current = await locator.boundingBox();
|
||||
const key = current ? JSON.stringify(current) : null;
|
||||
const stable = key !== null && key === last.key;
|
||||
last.box = current;
|
||||
last.key = key;
|
||||
const current = JSON.stringify(await box(locator));
|
||||
const stable = current === previous;
|
||||
previous = current;
|
||||
return stable;
|
||||
})
|
||||
.toBe(true);
|
||||
if (!last.box) throw new Error("a settled element has a box");
|
||||
return last.box;
|
||||
}
|
||||
|
||||
async function expectAssigned(
|
||||
@@ -115,7 +113,11 @@ async function expectAssigned(
|
||||
}
|
||||
|
||||
async function openWorkspaceLabels(page: import("@playwright/test").Page, workspaceId: string) {
|
||||
const serverId = await openWorkspaceSidebarKebab(page, workspaceId);
|
||||
const serverId = getServerId();
|
||||
const row = page.getByTestId(`sidebar-workspace-row-${serverId}:${workspaceId}`).first();
|
||||
await expect(row).toBeVisible({ timeout: 30_000 });
|
||||
await row.hover();
|
||||
await page.getByTestId(`sidebar-workspace-kebab-${serverId}:${workspaceId}`).first().click();
|
||||
await page.getByTestId(`sidebar-workspace-menu-labels-${serverId}:${workspaceId}`).click();
|
||||
await expect(page.getByTestId("workspace-label-picker-create")).toBeVisible();
|
||||
}
|
||||
|
||||
@@ -361,10 +361,6 @@ test.describe("Worktree restore", () => {
|
||||
cwd: backingWorktree.workspaceDirectory,
|
||||
stdio: "pipe",
|
||||
});
|
||||
const originalHead = execFileSync("git", ["rev-parse", "HEAD"], {
|
||||
cwd: backingWorktree.workspaceDirectory,
|
||||
encoding: "utf8",
|
||||
}).trim();
|
||||
const created = await worktreeClient.createWorkspace({
|
||||
source: { kind: "directory", path: backingWorktree.workspaceDirectory },
|
||||
title: "Sample workspace",
|
||||
@@ -393,7 +389,10 @@ test.describe("Worktree restore", () => {
|
||||
await page.getByTestId(`agent-row-${getServerId()}-${agent.id}`).click();
|
||||
await expect(page.getByText("Workspace archived", { exact: true })).toBeVisible();
|
||||
await expect(
|
||||
page.getByText("Restore Sample workspace to return to its agents.", { exact: true }),
|
||||
page.getByText(
|
||||
"Restore Sample workspace to return to its agents. A new branch will start from the saved base or the repository default.",
|
||||
{ exact: true },
|
||||
),
|
||||
).toBeVisible();
|
||||
await captureBranchlessRestoreStep(page, "01-restore-workspace.png");
|
||||
|
||||
@@ -410,13 +409,17 @@ test.describe("Worktree restore", () => {
|
||||
cwd: backingWorktree.workspaceDirectory,
|
||||
encoding: "utf8",
|
||||
}).trim();
|
||||
expect(restoredHead).toBe(originalHead);
|
||||
const defaultHead = execFileSync("git", ["rev-parse", "main"], {
|
||||
cwd: tempRepo.path,
|
||||
encoding: "utf8",
|
||||
}).trim();
|
||||
expect(restoredHead).toBe(defaultHead);
|
||||
expect(
|
||||
execFileSync("git", ["branch", "--show-current"], {
|
||||
cwd: backingWorktree.workspaceDirectory,
|
||||
encoding: "utf8",
|
||||
}).trim(),
|
||||
).toBe("");
|
||||
).toMatch(/^restored\//);
|
||||
});
|
||||
|
||||
test("restore failure stays visible and permits a successful retry", async ({ page }) => {
|
||||
|
||||
@@ -24,7 +24,7 @@ function send(message) {
|
||||
function respond(method, params) {
|
||||
switch (method) {
|
||||
case "initialize":
|
||||
return { userAgent: "codex/0.159.0" };
|
||||
return {};
|
||||
case "model/list":
|
||||
return { data: models };
|
||||
case "config/read":
|
||||
|
||||
@@ -583,7 +583,7 @@ run_host_scroll() {
|
||||
prepare_composer closed
|
||||
if [[ "${host}" == new-workspace ]]; then
|
||||
ad press 'id="workspace-create-isolation-trigger"' --settle
|
||||
ad press 'text="Project directory"' --settle
|
||||
ad press 'text="Local"' --settle
|
||||
fi
|
||||
# Submit through each real host; draft/workspace creation then mounts its chat.
|
||||
# A selectable mock model keeps this test independent of provider credentials.
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# CHAT_URL opens a connected chat containing a visible Markdown image with alt text IMAGE_LABEL.
|
||||
context platform=android timeout=120000 retries=0
|
||||
env APP_ID=sh.paseo.debug
|
||||
env IMAGE_LABEL="Test image"
|
||||
|
||||
open "${APP_ID}" "${CHAT_URL}"
|
||||
wait "label=\"${IMAGE_LABEL}\"" 30000
|
||||
press "label=\"${IMAGE_LABEL}\""
|
||||
wait "label=\"Close image\"" 5000
|
||||
gesture pinch 1.7
|
||||
press "label=\"Close image\""
|
||||
press "editable=true"
|
||||
type "pinch regression"
|
||||
press "role=\"button\" label=\"Add attachment\""
|
||||
wait "label=\"Upload file\"" 3000
|
||||
@@ -56,20 +56,11 @@ function inFlightTurn(page: Page) {
|
||||
return page.getByTestId("turn-working-indicator");
|
||||
}
|
||||
|
||||
/**
|
||||
* Presses a fork trigger until its menu shows.
|
||||
*
|
||||
* The in-flight turn's trigger sits below text that is still streaming in. While the chat is
|
||||
* shorter than the viewport, each new line moves the trigger down. A line that arrives between
|
||||
* the press and the release moves the trigger away from the pointer, so the press opens nothing,
|
||||
* and the next press lands on the trigger where it is now.
|
||||
*/
|
||||
async function openForkMenu(page: Page, trigger: ReturnType<Page["getByRole"]>): Promise<void> {
|
||||
const forkInNewTab = page.getByRole("menuitem", { name: "Fork in a new tab" });
|
||||
await expect(async () => {
|
||||
await trigger.click({ timeout: 5_000 });
|
||||
await expect(forkInNewTab).toBeVisible({ timeout: 5_000 });
|
||||
}).toPass({ timeout: 30_000 });
|
||||
await trigger.click();
|
||||
await expect(page.getByRole("menuitem", { name: "Fork in a new tab" })).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
}
|
||||
|
||||
export async function openMostRecentAssistantForkMenu(page: Page): Promise<void> {
|
||||
|
||||
@@ -23,11 +23,6 @@ export async function openCommandCenter(page: Page): Promise<Locator> {
|
||||
return panel;
|
||||
}
|
||||
|
||||
export async function openCommandCenterWithShortcut(page: Page): Promise<void> {
|
||||
await page.keyboard.press("ControlOrMeta+k");
|
||||
await expect(page.getByTestId("command-center-panel")).toBeVisible();
|
||||
}
|
||||
|
||||
export async function closeCommandCenter(page: Page): Promise<void> {
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(page.getByTestId("command-center-panel")).not.toBeVisible();
|
||||
|
||||
@@ -170,11 +170,6 @@ export interface ModelTriggerLabelState {
|
||||
modelShown: boolean;
|
||||
modelText: string;
|
||||
modelTruncated: boolean;
|
||||
/**
|
||||
* The model label shows what its box fits right now: the full text when it fits, otherwise a
|
||||
* truncation that fits. False while the control has yet to catch up with a reflow.
|
||||
*/
|
||||
modelFitsBox: boolean;
|
||||
}
|
||||
|
||||
declare global {
|
||||
@@ -199,18 +194,12 @@ function readModelTriggerLabelStateInPage(): ModelTriggerLabelState {
|
||||
};
|
||||
const modelShown = model !== undefined && shown(model);
|
||||
const modelText = model?.textContent ?? "";
|
||||
const overflows = (node: Element) => node.scrollWidth > node.clientWidth;
|
||||
const modelOverflows = model !== undefined && overflows(model);
|
||||
// The label's box is sized by an invisible copy of the full text, its first child, so the box
|
||||
// follows a reflow at once while the shown text waits for the control's next layout event.
|
||||
const fullTextSizer = model?.parentElement?.parentElement?.firstElementChild;
|
||||
const fullTextFits = fullTextSizer ? !overflows(fullTextSizer) : true;
|
||||
return {
|
||||
modelShown,
|
||||
modelText,
|
||||
thinkingShown: modelShown && thinking !== undefined,
|
||||
modelTruncated: modelText.endsWith("…") || modelOverflows,
|
||||
modelFitsBox: !modelOverflows && modelText.endsWith("…") !== fullTextFits,
|
||||
modelTruncated:
|
||||
model !== undefined && (modelText.endsWith("…") || model.scrollWidth > model.clientWidth),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -228,26 +217,13 @@ export async function recordModelTriggerFramesFromLoad(page: Page): Promise<void
|
||||
})()`);
|
||||
}
|
||||
|
||||
/**
|
||||
* The model control's labels once it has caught up with its width: two reads 100ms apart agree
|
||||
* and the model label shows what its box fits. A resize reflows the page at once, but the control
|
||||
* chooses its labels again only when its layout events arrive, and on a slow runner that takes
|
||||
* longer than 100ms. Until then the label can be clipped by the browser beside the thinking
|
||||
* label, or truncated in a box that has since widened.
|
||||
*/
|
||||
/** The model control's labels once two reads 100ms apart agree. */
|
||||
export async function readSettledModelTriggerLabels(page: Page): Promise<ModelTriggerLabelState> {
|
||||
const deadline = Date.now() + 10_000;
|
||||
let previous = await page.evaluate(readModelTriggerLabelStateInPage);
|
||||
for (;;) {
|
||||
await page.waitForTimeout(100);
|
||||
const next = await page.evaluate(readModelTriggerLabelStateInPage);
|
||||
const agrees = JSON.stringify(next) === JSON.stringify(previous);
|
||||
if (agrees && next.modelFitsBox) return next;
|
||||
if (Date.now() > deadline) {
|
||||
throw new Error(
|
||||
`the model control never settled on a label that fits its box: ${JSON.stringify(next)}`,
|
||||
);
|
||||
}
|
||||
if (JSON.stringify(next) === JSON.stringify(previous)) return next;
|
||||
previous = next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,15 +97,18 @@ export class ImportSessionFlow {
|
||||
await target.scrollIntoViewIfNeeded();
|
||||
await expect(target).toBeInViewport();
|
||||
}
|
||||
/**
|
||||
* Scrolls the virtualized list, the only one that leaves rows unmounted. A row handle is no way
|
||||
* in: the list unmounts rows as it scrolls, and a detached row has no scroller above it.
|
||||
*/
|
||||
private async scrollList(forward: boolean) {
|
||||
await this.page.getByTestId("import-session-list").evaluate((list, advance) => {
|
||||
list.scrollTop = advance ? list.scrollTop + list.clientHeight * 0.8 : 0;
|
||||
list.dispatchEvent(new Event("scroll"));
|
||||
}, forward);
|
||||
await this.page
|
||||
.locator('[data-testid^="import-session-session-"]')
|
||||
.first()
|
||||
.evaluate((row, advance) => {
|
||||
let element = row.parentElement;
|
||||
while (element && !["auto", "scroll"].includes(getComputedStyle(element).overflowY))
|
||||
element = element.parentElement;
|
||||
if (!element) throw new Error("Import list has no scroll owner");
|
||||
element.scrollTop = advance ? element.scrollTop + element.clientHeight * 0.8 : 0;
|
||||
element.dispatchEvent(new Event("scroll"));
|
||||
}, forward);
|
||||
}
|
||||
async search(query: string) {
|
||||
await this.page.getByTestId("import-session-search").fill(query);
|
||||
@@ -117,18 +120,11 @@ export class ImportSessionFlow {
|
||||
await this.page.getByTestId("import-session-search").fill("");
|
||||
await expect(this.page.getByTestId("import-session-load-more")).toBeVisible();
|
||||
}
|
||||
/** Load more keeps the reader down the list instead of sending them back to the top. */
|
||||
async loadMore() {
|
||||
const loadMore = this.page.getByTestId("import-session-load-more");
|
||||
const topRow = this.page.getByTestId((await this.rowIds())[0]!);
|
||||
await expect(topRow).toBeInViewport();
|
||||
await loadMore.click();
|
||||
// The next page is the last and short, so the button leaves once it lands.
|
||||
await expect(loadMore).toHaveCount(0);
|
||||
await expect(this.page.getByText("Loading sessions...", { exact: true })).toHaveCount(0);
|
||||
await expect(topRow).not.toBeInViewport();
|
||||
await this.page.getByTestId("import-session-load-more").click();
|
||||
await this.revealSession("fixture-root-20");
|
||||
await expect(this.page.getByText("Root session 20", { exact: true })).toBeInViewport();
|
||||
await expect(this.page.getByTestId("import-session-load-more")).toHaveCount(0);
|
||||
}
|
||||
async retryProvider(provider: string, label: string) {
|
||||
await this.expectProviderError(label);
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
type ChildProcess,
|
||||
type SpawnOptions,
|
||||
} from "node:child_process";
|
||||
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
||||
import net from "node:net";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
@@ -59,17 +59,7 @@ export async function getAvailableHostDaemonPort(): Promise<number> {
|
||||
return port;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves once this daemon answers on its port. An open TCP port is not
|
||||
* enough: the port is released before the daemon binds it, and whatever takes
|
||||
* it in between also accepts connections while the daemon exits with
|
||||
* EADDRINUSE. Only the daemon's own status reports its server id.
|
||||
*/
|
||||
async function waitForServer(
|
||||
port: number,
|
||||
child: ChildProcess,
|
||||
identity: { serverId: string; paseoHome: string },
|
||||
): Promise<void> {
|
||||
async function waitForServer(port: number, child: ChildProcess): Promise<void> {
|
||||
const deadline = Date.now() + 90_000;
|
||||
let lastError: unknown = null;
|
||||
|
||||
@@ -80,13 +70,22 @@ async function waitForServer(
|
||||
);
|
||||
}
|
||||
try {
|
||||
const serverId = await readServerId(port, identity.paseoHome);
|
||||
if (serverId === identity.serverId) return;
|
||||
lastError = new Error(`Port ${port} is served by ${serverId}, not ${identity.serverId}`);
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const socket = net.connect(port, "127.0.0.1", () => {
|
||||
socket.end();
|
||||
resolve();
|
||||
});
|
||||
socket.setTimeout(1_000, () => {
|
||||
socket.destroy();
|
||||
reject(new Error(`Connection timed out to isolated daemon port ${port}`));
|
||||
});
|
||||
socket.on("error", reject);
|
||||
});
|
||||
return;
|
||||
} catch (error) {
|
||||
lastError = error;
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
@@ -96,25 +95,6 @@ async function waitForServer(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the server id from the daemon's status route. The route needs a bearer
|
||||
* on a password-protected daemon; the daemon accepts the local credential it
|
||||
* writes into its home before listening, as the CLI does for local status.
|
||||
*/
|
||||
async function readServerId(port: number, paseoHome: string): Promise<string> {
|
||||
const localCredential = await readFile(path.join(paseoHome, "local-credential"), "utf8").then(
|
||||
(token) => token.trim(),
|
||||
() => null,
|
||||
);
|
||||
const response = await fetch(`http://127.0.0.1:${port}/api/status`, {
|
||||
headers: localCredential ? { authorization: `Bearer ${localCredential}` } : {},
|
||||
signal: AbortSignal.timeout(1_000),
|
||||
});
|
||||
if (!response.ok) throw new Error(`Status request to port ${port} returned ${response.status}`);
|
||||
const status = (await response.json()) as { serverId?: unknown };
|
||||
return String(status.serverId);
|
||||
}
|
||||
|
||||
function withMutableRelay(
|
||||
config: NonNullable<IsolatedHostDaemonOptions["config"]>,
|
||||
relay: NonNullable<IsolatedHostDaemonOptions["mutableRelay"]>,
|
||||
@@ -141,7 +121,7 @@ export async function startIsolatedHostDaemon(
|
||||
serverId: string,
|
||||
options: IsolatedHostDaemonOptions = {},
|
||||
): Promise<IsolatedHostDaemon> {
|
||||
let port = await getAvailableHostDaemonPort();
|
||||
const port = await getAvailableHostDaemonPort();
|
||||
|
||||
const metroPort = process.env.E2E_METRO_PORT;
|
||||
if (!metroPort) throw new Error("E2E_METRO_PORT is required to start an isolated host daemon");
|
||||
@@ -241,7 +221,7 @@ export async function startIsolatedHostDaemon(
|
||||
});
|
||||
|
||||
try {
|
||||
await waitForServer(port, spawned, { serverId, paseoHome });
|
||||
await waitForServer(port, spawned);
|
||||
return spawned;
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
@@ -251,25 +231,8 @@ export async function startIsolatedHostDaemon(
|
||||
}
|
||||
};
|
||||
|
||||
// The reserved port is released before the daemon binds it, so another
|
||||
// process can take it in between. Only the first start picks a new port:
|
||||
// restart() keeps the endpoint the app already knows.
|
||||
const startOnFreePort = async (): Promise<void> => {
|
||||
for (let attempt = 1; ; attempt += 1) {
|
||||
try {
|
||||
await spawnDaemon();
|
||||
return;
|
||||
} catch (error) {
|
||||
const lostPort = error instanceof Error && error.message.includes("EADDRINUSE");
|
||||
if (!lostPort || attempt === 3) throw error;
|
||||
await stopDaemon();
|
||||
port = await getAvailableHostDaemonPort();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
await startOnFreePort();
|
||||
await spawnDaemon();
|
||||
} catch (error) {
|
||||
await stopDaemon();
|
||||
if (!options.preserveHome) {
|
||||
|
||||
@@ -334,19 +334,16 @@ export async function selectNewWorkspaceProject(
|
||||
await expectNewWorkspaceProjectSelected(page, input.projectDisplayName);
|
||||
}
|
||||
|
||||
type IsolationChoice = "local" | "worktree" | "existing";
|
||||
|
||||
// The isolation trigger renders the active isolation's label ("Project directory" / "New
|
||||
// worktree" / "Existing worktree"), so asserting its text proves what the screen remembers.
|
||||
const ISOLATION_TRIGGER_LABEL: Record<IsolationChoice, string> = {
|
||||
local: "Project directory",
|
||||
// The isolation trigger renders the active isolation's label ("Local" / "New
|
||||
// worktree"), so asserting its text proves what the screen currently remembers.
|
||||
const ISOLATION_TRIGGER_LABEL: Record<"local" | "worktree", string> = {
|
||||
local: "Local",
|
||||
worktree: "New worktree",
|
||||
existing: "Existing worktree",
|
||||
};
|
||||
|
||||
export async function expectWorkspaceIsolationSelected(
|
||||
page: Page,
|
||||
isolation: IsolationChoice,
|
||||
isolation: "local" | "worktree",
|
||||
): Promise<void> {
|
||||
const trigger = page.getByRole("button", { name: "Workspace isolation" });
|
||||
await expect(trigger).toBeVisible({ timeout: 30_000 });
|
||||
@@ -355,7 +352,7 @@ export async function expectWorkspaceIsolationSelected(
|
||||
|
||||
export async function selectWorkspaceIsolation(
|
||||
page: Page,
|
||||
isolation: IsolationChoice,
|
||||
isolation: "local" | "worktree",
|
||||
): Promise<void> {
|
||||
const trigger = page.getByTestId("workspace-create-isolation-trigger");
|
||||
await expect(trigger).toBeVisible({ timeout: 30_000 });
|
||||
@@ -388,16 +385,8 @@ export async function selectBranchInPicker(page: Page, name: string): Promise<vo
|
||||
await branchRow.click();
|
||||
}
|
||||
|
||||
// The ref picker lists branches and pull requests separately.
|
||||
async function showRefList(page: Page, list: "branches" | "pull-requests"): Promise<void> {
|
||||
const tab = page.getByTestId(`new-workspace-ref-picker-tab-${list}`);
|
||||
await expect(tab).toBeVisible({ timeout: 30_000 });
|
||||
await tab.click();
|
||||
}
|
||||
|
||||
export async function searchAndSelectBranchInPicker(page: Page, name: string): Promise<void> {
|
||||
await showRefList(page, "branches");
|
||||
const searchInput = page.getByPlaceholder("Search branches");
|
||||
const searchInput = page.getByPlaceholder("Search branches and PRs");
|
||||
await expect(searchInput).toBeVisible({ timeout: 30_000 });
|
||||
await searchInput.fill(name);
|
||||
await selectBranchInPicker(page, name);
|
||||
@@ -421,7 +410,6 @@ export async function captureStartingRefPicker(page: Page, screenshotPath: strin
|
||||
}
|
||||
|
||||
export async function selectGitHubPrInPicker(page: Page, number: number): Promise<void> {
|
||||
await showRefList(page, "pull-requests");
|
||||
const prRow = page.getByTestId(`new-workspace-ref-picker-pr-${number}`);
|
||||
await expect(prRow).toBeVisible({ timeout: 30_000 });
|
||||
await prRow.click();
|
||||
@@ -444,7 +432,7 @@ export async function openBranchPicker(page: Page): Promise<void> {
|
||||
}
|
||||
|
||||
export async function selectPickerOptionByKeyboard(page: Page, label: string): Promise<void> {
|
||||
const searchInput = page.getByPlaceholder("Search branches");
|
||||
const searchInput = page.getByPlaceholder("Search branches and PRs");
|
||||
await expect(searchInput).toBeVisible({ timeout: 30_000 });
|
||||
await page.keyboard.type(label);
|
||||
await expect(page.getByTestId(`new-workspace-ref-picker-branch-${label}`)).toBeVisible({
|
||||
|
||||
@@ -198,14 +198,6 @@ async function expectDetails(page: Page) {
|
||||
await expect(page.getByText("All systems operational", { exact: true })).toBeInViewport();
|
||||
}
|
||||
|
||||
// The details render before the daemon answers their event subscription, and reopened
|
||||
// details show the cached summary at once, so wait for the subscription id to arrive.
|
||||
async function readContentObservation(page: Page): Promise<string> {
|
||||
const observation = page.getByLabel("Content observation", { exact: true });
|
||||
await expect(observation).not.toHaveText("");
|
||||
return (await observation.textContent())!;
|
||||
}
|
||||
|
||||
function workspaceMenuRow(page: Page, title: string): Locator {
|
||||
return compactWorkspaceMenu(page).getByRole("menuitem", { name: title, exact: true });
|
||||
}
|
||||
@@ -362,12 +354,14 @@ export async function withButtonShowcase(
|
||||
test.step("closing and crashing content release its owner while sibling buttons and app remain live", async () => {
|
||||
await press(page, "Header status");
|
||||
await expectDetails(page);
|
||||
const first = await readContentObservation(page);
|
||||
const observation = page.getByLabel("Content observation", { exact: true });
|
||||
await expect(observation).not.toHaveText("");
|
||||
const first = (await observation.textContent())!;
|
||||
await press(page, "Close deployment details");
|
||||
await expect.poll(() => released.has(first)).toBe(true);
|
||||
await press(page, "Composer status");
|
||||
await expectDetails(page);
|
||||
const second = await readContentObservation(page);
|
||||
const second = (await observation.textContent())!;
|
||||
expect(second).not.toBe(first);
|
||||
await workspace.client.renameProject(workspace.projectId, "Observer control");
|
||||
await expect(page.getByText("Observed updates: 1", { exact: true })).toBeVisible();
|
||||
@@ -379,7 +373,7 @@ export async function withButtonShowcase(
|
||||
await page.keyboard.press("Escape");
|
||||
await press(page, "Header status");
|
||||
await expectDetails(page);
|
||||
const recovered = await readContentObservation(page);
|
||||
const recovered = (await observation.textContent())!;
|
||||
expect([first, second]).not.toContain(recovered);
|
||||
await showcase.setTitle("Healthy app after button failure");
|
||||
await expect(page.getByTestId("workspace-header-title")).toHaveText(
|
||||
@@ -693,7 +687,9 @@ export async function withButtonShowcase(
|
||||
page,
|
||||
page.getByRole("button", { name: "Close deployment details", exact: true }),
|
||||
);
|
||||
const owner = await readContentObservation(page);
|
||||
const observation = page.getByLabel("Content observation", { exact: true });
|
||||
await expect(observation).not.toHaveText("");
|
||||
const owner = (await observation.textContent())!;
|
||||
await showcase.disable();
|
||||
await expect.poll(() => released.has(owner)).toBe(true);
|
||||
await expect(
|
||||
|
||||
@@ -2,7 +2,6 @@ import { buildSettingsHostSectionRoute } from "@/utils/host-routes";
|
||||
import { expect, type Page } from "../fixtures";
|
||||
import { getServerId } from "./server-id";
|
||||
import { expectAppRoute } from "./route-assertions";
|
||||
import { escapeRegex } from "./regex";
|
||||
|
||||
/**
|
||||
* Settings → Host → Plugins: the Installed and Browse tabs, the page menu, the install sheet and a
|
||||
@@ -29,17 +28,8 @@ function pluginSwitch(page: Page, name: string, action: "Disable" | "Enable") {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* A toast that times out stays in the page while it fades, so the next toast can share the screen
|
||||
* with it, even when both have the same text. The pattern matches case, so "Installed x" does not
|
||||
* match "Uninstalled x".
|
||||
*/
|
||||
export async function expectToast(page: Page, message: string): Promise<void> {
|
||||
const toast = page
|
||||
.getByTestId("app-toast-message")
|
||||
.filter({ hasText: new RegExp(escapeRegex(message)) })
|
||||
.first();
|
||||
await expect(toast).toBeVisible();
|
||||
await expect(page.getByTestId("app-toast-message")).toContainText(message);
|
||||
}
|
||||
|
||||
// Tabs and search
|
||||
|
||||
@@ -15,18 +15,8 @@ export const COMPACT = { width: 390, height: 844 };
|
||||
/** A plugin written against the current API: a screen, header and footer items, a command. */
|
||||
const SHOWCASE_SOURCE = `import React from "react";
|
||||
import { Pressable, Text, View } from "react-native";
|
||||
import { useWorkspaces } from "@getpaseo/plugin/client";
|
||||
import { SidebarRow } from "@getpaseo/plugin/client/ui";
|
||||
|
||||
function WorkspacesScreen({ theme }) {
|
||||
const workspaces = useWorkspaces();
|
||||
return (
|
||||
<View style={{ flex: 1, padding: 24, gap: 8 }}>
|
||||
{workspaces.map((ref) => <Text key={ref.id} style={{ color: theme.colors.foreground }}>{"Workspace " + ref.id}</Text>)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
function DeploysScreen({ theme }) {
|
||||
return <View style={{ flex: 1, padding: 24 }}><Text style={{ color: theme.colors.foreground }}>Deploys screen body</Text></View>;
|
||||
}
|
||||
@@ -73,13 +63,11 @@ function Broken() {
|
||||
|
||||
export default function contribute(client) {
|
||||
client.addScreen({ id: "deploys", title: "Deploys", Component: DeploysScreen });
|
||||
client.addScreen({ id: "workspaces", title: "Workspaces", Component: WorkspacesScreen });
|
||||
client.addSidebarHeaderItem({ id: "deploys", title: "Deploys", Component: DeploysItem });
|
||||
client.addSidebarHeaderItem({ id: "broken", title: "Broken header", Component: Broken });
|
||||
client.addSidebarFooterItem({ id: "sync", title: "Sync", Component: SyncItem });
|
||||
client.addSidebarFooterItem({ id: "broken", title: "Broken footer", Component: Broken });
|
||||
client.addCommandCenterItem({ id: "open-deploys", title: "Open deploys", icon: "Rocket", context: "global", onSelect: (ctx) => ctx.openScreen({ screenId: "deploys" }) });
|
||||
client.addCommandCenterItem({ id: "open-workspaces", title: "Open plugin workspaces", icon: "List", context: "global", onSelect: (ctx) => ctx.openScreen({ screenId: "workspaces" }) });
|
||||
return () => {};
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -190,25 +190,14 @@ export async function selectWorkspaceInSidebar(page: Page, workspaceId: string):
|
||||
await row.click();
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a workspace row's kebab menu the way a pointer does: enter the row, then press the kebab
|
||||
* it reveals.
|
||||
*
|
||||
* The kebab only mounts while the row holds hover, and hover only arrives on pointerenter. A row
|
||||
* that re-renders or shifts under a parked pointer drops that hover with no new pointerenter to
|
||||
* restore it, so each attempt leaves the row and enters it again instead of waiting on a kebab
|
||||
* that a still pointer cannot bring back.
|
||||
*/
|
||||
export async function openWorkspaceSidebarKebab(page: Page, workspaceId: string) {
|
||||
async function openWorkspaceSidebarKebab(page: Page, workspaceId: string) {
|
||||
const serverId = getServerId();
|
||||
const row = page.getByTestId(`sidebar-workspace-row-${serverId}:${workspaceId}`);
|
||||
const kebab = page.getByTestId(`sidebar-workspace-kebab-${serverId}:${workspaceId}`);
|
||||
await expect(row).toBeVisible({ timeout: 30_000 });
|
||||
await expect(async () => {
|
||||
await page.mouse.move(0, 0);
|
||||
await row.hover();
|
||||
await expect(kebab).toBeVisible({ timeout: 2_000 });
|
||||
}).toPass({ timeout: 15_000 });
|
||||
await row.hover();
|
||||
|
||||
const kebab = page.getByTestId(`sidebar-workspace-kebab-${serverId}:${workspaceId}`);
|
||||
await expect(kebab).toBeVisible({ timeout: 10_000 });
|
||||
await kebab.click();
|
||||
|
||||
return serverId;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { expect, type Page } from "@playwright/test";
|
||||
import type { installDaemonWebSocketGate } from "./daemon-websocket-gate";
|
||||
import { seedMockAgentWorkspace, type MockAgentWorkspace } from "./mock-agent";
|
||||
import { readReplicaCache } from "./replica-cache-storage";
|
||||
import type { LongTimelineAgent } from "./timeline-pagination";
|
||||
import {
|
||||
@@ -242,100 +241,3 @@ export async function restoreUnchangedViewedTimeline(
|
||||
gate.restore();
|
||||
await expectReconnectingToastGone(page);
|
||||
}
|
||||
|
||||
export interface StreamingReplyAgent extends MockAgentWorkspace {
|
||||
prompt: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A mock agent with no history whose reply streams one word every 100 ms. At 2,000 words the
|
||||
* reply outlasts the test's timeout, so it is still streaming however long the app takes to
|
||||
* reconnect. The test ends the turn with {@link stopStreamingReply}.
|
||||
*/
|
||||
export async function seedStreamingReplyAgent(): Promise<StreamingReplyAgent> {
|
||||
const reply = Array.from({ length: 2_000 }, (_unused, index) => `word${index}`).join(" ");
|
||||
const agent = await seedMockAgentWorkspace({
|
||||
repoPrefix: "reply-reconnect-",
|
||||
title: "Reply through reconnect",
|
||||
featureValues: {
|
||||
mockStreamingAssistantResponse: reply,
|
||||
mockStreamingAssistantIntervalMs: 100,
|
||||
},
|
||||
});
|
||||
return {
|
||||
...agent,
|
||||
prompt: "stream through a reconnect",
|
||||
cleanup: async () => {
|
||||
await agent.client.cancelAgent(agent.agentId).catch(() => undefined);
|
||||
await agent.cleanup();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
interface TimelineReader {
|
||||
fetchAgentTimeline(
|
||||
agentId: string,
|
||||
request: { direction: "tail"; limit: number },
|
||||
): Promise<{ entries: Array<{ item: { type: string; text?: string } }> }>;
|
||||
}
|
||||
|
||||
async function readDaemonReply(agent: StreamingReplyAgent): Promise<string> {
|
||||
const timeline = await (agent.client as unknown as TimelineReader).fetchAgentTimeline(
|
||||
agent.agentId,
|
||||
{ direction: "tail", limit: 0 },
|
||||
);
|
||||
return timeline.entries
|
||||
.map(({ item }) => (item.type === "assistant_message" ? (item.text ?? "") : ""))
|
||||
.join("");
|
||||
}
|
||||
|
||||
/** Waits for the empty chat's first catch-up, so the chat is synced with no range. */
|
||||
export async function expectEmptyChatSynced(page: Page, gate: DaemonWebSocketGate): Promise<void> {
|
||||
await gate.waitForServerMessage(TIMELINE_RESPONSE);
|
||||
await expect(page.getByTestId("agent-chat-scroll").filter({ visible: true })).toHaveCount(1, {
|
||||
timeout: 30_000,
|
||||
});
|
||||
}
|
||||
|
||||
/** Another client sends the prompt, and the reply starts, while the chat is away. */
|
||||
export async function sendPromptWhileDisconnected(agent: StreamingReplyAgent): Promise<void> {
|
||||
await agent.client.sendAgentMessage(agent.agentId, agent.prompt);
|
||||
await expect.poll(() => readDaemonReply(agent), { timeout: 30_000 }).toContain("word10");
|
||||
}
|
||||
|
||||
/** Reconnects with live reply chunks reaching the chat before the catch-up page that holds them. */
|
||||
export async function restoreViewedTimelineWithLiveRowsFirst(
|
||||
gate: DaemonWebSocketGate,
|
||||
): Promise<void> {
|
||||
gate.holdNextClientRequest(TIMELINE_REQUEST);
|
||||
const chunksBeforeReconnect = gate.getAgentStreamItemCount("assistant_message");
|
||||
gate.restore();
|
||||
await gate.waitForHeldClientRequest();
|
||||
await gate.waitForAgentStreamItem("assistant_message", chunksBeforeReconnect + 5);
|
||||
gate.releaseHeldClientRequest();
|
||||
}
|
||||
|
||||
/** Stops the turn and returns the reply as the daemon recorded it. */
|
||||
export async function stopStreamingReply(agent: StreamingReplyAgent): Promise<string> {
|
||||
await agent.client.cancelAgent(agent.agentId);
|
||||
await agent.client.waitForFinish(agent.agentId, 30_000);
|
||||
const reply = (await readDaemonReply(agent)).trim();
|
||||
expect(reply).toMatch(/^word0 word1 word2 .* word10 /);
|
||||
return reply;
|
||||
}
|
||||
|
||||
export async function expectPromptAndWholeReply(
|
||||
page: Page,
|
||||
agent: StreamingReplyAgent,
|
||||
reply: string,
|
||||
): Promise<void> {
|
||||
const chat = page.getByTestId("agent-chat-scroll").filter({ visible: true }).first();
|
||||
await expect(chat.getByText(agent.prompt, { exact: true })).toBeVisible({ timeout: 30_000 });
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
(await chat.getByTestId("assistant-message").allInnerTexts()).map((text) => text.trim()),
|
||||
{ timeout: 30_000 },
|
||||
)
|
||||
.toEqual([reply]);
|
||||
}
|
||||
|
||||
@@ -175,19 +175,13 @@ export interface SidebarListLayout {
|
||||
rowHeight: number;
|
||||
}
|
||||
|
||||
const SIDEBAR_LIST = "sidebar-project-workspace-list-scroll";
|
||||
|
||||
/** Scrolls the sidebar's workspace list to its end and reads where its rows sit. */
|
||||
export async function scrollSidebarListToEnd(page: Page): Promise<SidebarListLayout> {
|
||||
await page.getByTestId(SIDEBAR_LIST).evaluate((element) => {
|
||||
const list = page.getByTestId("sidebar-project-workspace-list-scroll");
|
||||
await list.evaluate((element) => {
|
||||
element.scrollTop = element.scrollHeight;
|
||||
});
|
||||
return readSidebarListLayout(page);
|
||||
}
|
||||
|
||||
/** Reads where the sidebar list's rows sit, without scrolling it. */
|
||||
export async function readSidebarListLayout(page: Page): Promise<SidebarListLayout> {
|
||||
return page.getByTestId(SIDEBAR_LIST).evaluate((element) => {
|
||||
return list.evaluate((element) => {
|
||||
const visible = element.getBoundingClientRect();
|
||||
const rows = Array.from(
|
||||
element.querySelectorAll<HTMLElement>(
|
||||
@@ -203,26 +197,3 @@ export async function readSidebarListLayout(page: Page): Promise<SidebarListLayo
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts recording the bottom edge of the sidebar list's last row once per painted frame.
|
||||
* Resolves with one value per frame after `frameCount` frames.
|
||||
*/
|
||||
export function recordLastRowBottomPerFrame(page: Page, frameCount: number): Promise<number[]> {
|
||||
return page.getByTestId(SIDEBAR_LIST).evaluate(
|
||||
(element, count) =>
|
||||
new Promise<number[]>((resolve) => {
|
||||
const bottoms: number[] = [];
|
||||
const sample = () => {
|
||||
const rows = element.querySelectorAll<HTMLElement>(
|
||||
'[data-testid^="sidebar-workspace-row-"],[data-testid^="sidebar-project-row-"]',
|
||||
);
|
||||
bottoms.push(Math.max(...Array.from(rows, (row) => row.getBoundingClientRect().bottom)));
|
||||
if (bottoms.length >= count) resolve(bottoms);
|
||||
else requestAnimationFrame(sample);
|
||||
};
|
||||
requestAnimationFrame(sample);
|
||||
}),
|
||||
frameCount,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
/android/.cxx/
|
||||
/android/build/
|
||||
@@ -1,23 +0,0 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
group = 'sh.paseo.displaymetrics'
|
||||
version = '0.1.0'
|
||||
|
||||
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
||||
apply from: expoModulesCorePlugin
|
||||
applyKotlinExpoModulesCorePlugin()
|
||||
useCoreDependencies()
|
||||
useDefaultAndroidSdkVersions()
|
||||
|
||||
android {
|
||||
namespace "sh.paseo.displaymetrics"
|
||||
defaultConfig {
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.facebook.react:react-android"
|
||||
androidTestImplementation 'androidx.test:runner:1.6.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
|
||||
}
|
||||
-86
@@ -1,86 +0,0 @@
|
||||
package sh.paseo.displaymetrics
|
||||
|
||||
import android.util.DisplayMetrics
|
||||
import android.util.TypedValue
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.facebook.react.uimanager.DisplayMetricsHolder
|
||||
import com.facebook.react.uimanager.PixelUtil
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertSame
|
||||
import org.junit.Assert.assertThrows
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class PaseoDisplayMetricsTest {
|
||||
private lateinit var display: DisplayMetrics
|
||||
|
||||
@Before
|
||||
fun readDisplayLikeReactNative() {
|
||||
DisplayMetricsHolder.initDisplayMetrics(InstrumentationRegistry.getInstrumentation().targetContext)
|
||||
display = DisplayMetricsHolder.getScreenDisplayMetrics()
|
||||
}
|
||||
|
||||
@After
|
||||
fun forgetDisplay() {
|
||||
DisplayMetricsHolder.setScreenDisplayMetrics(null)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun reservesRoomForTextAtTheWindowDensity() {
|
||||
// A DeX window at two thirds of the phone's density (240 dpi on a 360 dpi phone). React Native
|
||||
// reads the font scale from the window but the density from the phone's display.
|
||||
val window = windowAt(display.densityDpi * 2 / 3)
|
||||
DisplayMetricsHolder.setScreenDisplayMetrics(
|
||||
DisplayMetrics().apply {
|
||||
setTo(display)
|
||||
scaledDensity = window.scaledDensity
|
||||
},
|
||||
)
|
||||
assertTrue(reservedTextPx(window) < drawnTextPx())
|
||||
|
||||
PaseoDisplayMetrics.syncWithWindow(window)
|
||||
|
||||
assertEquals(drawnTextPx(), reservedTextPx(window), 0.01f)
|
||||
assertEquals(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 16f, window), drawnTextPx(), 0.01f)
|
||||
val synced = DisplayMetricsHolder.getScreenDisplayMetrics()
|
||||
assertEquals(window.densityDpi, synced.densityDpi)
|
||||
assertEquals(display.widthPixels, synced.widthPixels)
|
||||
assertEquals(display.heightPixels, synced.heightPixels)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun leavesTheBuiltInDisplayAlone() {
|
||||
PaseoDisplayMetrics.syncWithWindow(windowAt(display.densityDpi))
|
||||
|
||||
assertSame(display, DisplayMetricsHolder.getScreenDisplayMetrics())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun waitsForReactNativeToReadTheDisplay() {
|
||||
DisplayMetricsHolder.setScreenDisplayMetrics(null)
|
||||
|
||||
PaseoDisplayMetrics.syncWithWindow(windowAt(display.densityDpi / 2))
|
||||
|
||||
assertThrows(IllegalStateException::class.java) { DisplayMetricsHolder.getScreenDisplayMetrics() }
|
||||
}
|
||||
|
||||
private fun windowAt(densityDpi: Int): DisplayMetrics =
|
||||
DisplayMetrics().apply {
|
||||
setTo(display)
|
||||
this.densityDpi = densityDpi
|
||||
density = densityDpi.toFloat() / DisplayMetrics.DENSITY_DEFAULT
|
||||
scaledDensity = density * display.scaledDensity / display.density
|
||||
}
|
||||
|
||||
/** A 16sp font as React Native draws it, in pixels. */
|
||||
private fun drawnTextPx(): Float = PixelUtil.toPixelFromSP(16f)
|
||||
|
||||
/** The box React Native lays out for that font, once the window renders it in pixels. */
|
||||
private fun reservedTextPx(window: DisplayMetrics): Float =
|
||||
PixelUtil.toDIPFromPixel(drawnTextPx()) * window.density
|
||||
}
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
package sh.paseo.displaymetrics
|
||||
|
||||
import android.app.Activity
|
||||
import android.util.DisplayMetrics
|
||||
import com.facebook.react.uimanager.DisplayMetricsHolder
|
||||
|
||||
/**
|
||||
* React Native 0.86 converts between px and dp, and so sizes text, with the density of the
|
||||
* device's built-in display, because `DisplayMetricsHolder` reads `Display.getRealMetrics()`.
|
||||
* Fabric lays out at the window's density. On a display with another density, such as a Samsung
|
||||
* DeX monitor, text boxes come out too small and clip their text.
|
||||
*
|
||||
* Backports react/react-native#59087 (`useWindowDensityForDisplayMetricsAndroid`): keep the
|
||||
* window's density and take only the size from the display. Remove once the app runs React Native
|
||||
* 0.89 or later with that flag on.
|
||||
*/
|
||||
object PaseoDisplayMetrics {
|
||||
/** Call right after React Native reads the display, which it does again on each configuration change. */
|
||||
@JvmStatic
|
||||
fun syncWithWindow(activity: Activity) {
|
||||
syncWithWindow(activity.resources.displayMetrics)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun syncWithWindow(window: DisplayMetrics) {
|
||||
val screen =
|
||||
try {
|
||||
DisplayMetricsHolder.getScreenDisplayMetrics()
|
||||
} catch (_: IllegalStateException) {
|
||||
// React Native hasn't read the display yet, so there is nothing to correct.
|
||||
return
|
||||
}
|
||||
if (screen.densityDpi == window.densityDpi) return
|
||||
|
||||
DisplayMetricsHolder.setScreenDisplayMetrics(
|
||||
DisplayMetrics().apply {
|
||||
setTo(screen)
|
||||
density = window.density
|
||||
densityDpi = window.densityDpi
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
const { withMainActivity } = require("expo/config-plugins");
|
||||
|
||||
const ACTIVITY_CLASS = "class MainActivity : ReactActivity() {";
|
||||
const SYNC = "sh.paseo.displaymetrics.PaseoDisplayMetrics.syncWithWindow(this)";
|
||||
// React Native re-reads the built-in display's density when it creates the root view and on every
|
||||
// configuration change, so the window's density has to be restored right after each `super` call.
|
||||
const OVERRIDES = `
|
||||
override fun onContentChanged() {
|
||||
super.onContentChanged()
|
||||
${SYNC}
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: android.content.res.Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
${SYNC}
|
||||
}
|
||||
`;
|
||||
|
||||
function configureDisplayMetricsActivity(contents) {
|
||||
if (contents.includes(SYNC)) return contents;
|
||||
if (
|
||||
!contents.includes(ACTIVITY_CLASS) ||
|
||||
/override fun on(ContentChanged|ConfigurationChanged)\(/.test(contents)
|
||||
) {
|
||||
throw new Error("Could not keep React Native text at the window's density in MainActivity");
|
||||
}
|
||||
return contents.replace(ACTIVITY_CLASS, `${ACTIVITY_CLASS}${OVERRIDES}`);
|
||||
}
|
||||
|
||||
module.exports = (config) =>
|
||||
withMainActivity(config, (mod) => {
|
||||
mod.modResults.contents = configureDisplayMetricsActivity(mod.modResults.contents);
|
||||
return mod;
|
||||
});
|
||||
module.exports.configureDisplayMetricsActivity = configureDisplayMetricsActivity;
|
||||
@@ -1,29 +0,0 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const { configureDisplayMetricsActivity } = require("./app.plugin");
|
||||
|
||||
const SYNC = "sh.paseo.displaymetrics.PaseoDisplayMetrics.syncWithWindow(this)";
|
||||
|
||||
describe("Android display metrics", () => {
|
||||
it("restores the window's density after React Native reads the display", () => {
|
||||
const source = "class MainActivity : ReactActivity() {\n}";
|
||||
const result = configureDisplayMetricsActivity(source);
|
||||
expect(result).toContain(`super.onContentChanged()\n ${SYNC}`);
|
||||
expect(result).toContain(`super.onConfigurationChanged(newConfig)\n ${SYNC}`);
|
||||
expect(configureDisplayMetricsActivity(result)).toBe(result);
|
||||
});
|
||||
|
||||
it("fails prebuild when the template no longer has a place for the overrides", () => {
|
||||
expect(() => configureDisplayMetricsActivity("changed template")).toThrow(
|
||||
"Could not keep React Native text at the window's density",
|
||||
);
|
||||
});
|
||||
|
||||
it("fails prebuild rather than replace another plugin's configuration handler", () => {
|
||||
const source =
|
||||
"class MainActivity : ReactActivity() {\n override fun onConfigurationChanged(newConfig: Configuration) {}\n}";
|
||||
expect(() => configureDisplayMetricsActivity(source)).toThrow(
|
||||
"Could not keep React Native text at the window's density",
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"platforms": ["android"],
|
||||
"android": {
|
||||
"modules": []
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "paseo-display-metrics",
|
||||
"version": "0.1.0",
|
||||
"private": true
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
group = 'sh.paseo.pressfeedback'
|
||||
version = '0.1.0'
|
||||
|
||||
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
||||
apply from: expoModulesCorePlugin
|
||||
applyKotlinExpoModulesCorePlugin()
|
||||
useCoreDependencies()
|
||||
useExpoPublishing()
|
||||
useDefaultAndroidSdkVersions()
|
||||
|
||||
android {
|
||||
namespace "sh.paseo.pressfeedback"
|
||||
defaultConfig {
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" />
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
package sh.paseo.pressfeedback
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.Paint
|
||||
import expo.modules.kotlin.AppContext
|
||||
import expo.modules.kotlin.modules.Module
|
||||
import expo.modules.kotlin.modules.ModuleDefinition
|
||||
import expo.modules.kotlin.types.ColorCompat
|
||||
import expo.modules.kotlin.views.ExpoView
|
||||
|
||||
class PaseoPressFeedbackModule : Module() {
|
||||
override fun definition() = ModuleDefinition {
|
||||
Name("PaseoPressFeedback")
|
||||
View(PaseoPressFeedbackView::class) {
|
||||
Prop("tint") { view: PaseoPressFeedbackView, color: Color -> view.paint.color = ColorCompat.toArgb(color) }
|
||||
Prop("radius") { view: PaseoPressFeedbackView, radius: Double -> view.radius = radius.toFloat() * view.resources.displayMetrics.density }
|
||||
Prop("resetKey") { view: PaseoPressFeedbackView, key: String -> view.reset(key) }
|
||||
AsyncFunction("acknowledge") { view: PaseoPressFeedbackView -> view.acknowledge() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class PaseoPressFeedbackView(context: Context, appContext: AppContext) : ExpoView(context, appContext) {
|
||||
val paint = Paint(Paint.ANTI_ALIAS_FLAG)
|
||||
var radius = 0f
|
||||
private var acknowledged = false
|
||||
private var resetKey = ""
|
||||
init { setWillNotDraw(false); importantForAccessibility = IMPORTANT_FOR_ACCESSIBILITY_NO }
|
||||
fun acknowledge() { acknowledged = true; invalidate() }
|
||||
fun reset(key: String) {
|
||||
if (key != resetKey) { resetKey = key; acknowledged = false; invalidate() }
|
||||
}
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
if (acknowledged) canvas.drawRoundRect(0f, 0f, width.toFloat(), height.toFloat(), radius, radius, paint)
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"platforms": ["android", "ios"],
|
||||
"android": { "modules": ["sh.paseo.pressfeedback.PaseoPressFeedbackModule"] },
|
||||
"ios": { "modules": ["PaseoPressFeedbackModule"] }
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export { useWorkspaceRowPress } from "./src/ui";
|
||||
@@ -1,22 +0,0 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'PaseoPressFeedback'
|
||||
s.version = '0.1.0'
|
||||
s.summary = 'Native accepted press feedback for Paseo'
|
||||
s.description = 'Paints accepted press feedback independently of React commits'
|
||||
s.license = 'Apache-2.0'
|
||||
s.author = 'Paseo'
|
||||
s.homepage = 'https://paseo.sh'
|
||||
s.platforms = { :ios => '15.1' }
|
||||
s.swift_version = '5.4'
|
||||
s.source = { :path => '.' }
|
||||
s.static_framework = true
|
||||
|
||||
s.dependency 'ExpoModulesCore'
|
||||
|
||||
s.pod_target_xcconfig = {
|
||||
'DEFINES_MODULE' => 'YES',
|
||||
'SWIFT_COMPILATION_MODE' => 'wholemodule'
|
||||
}
|
||||
|
||||
s.source_files = "**/*.{h,m,swift}"
|
||||
end
|
||||
@@ -1,33 +0,0 @@
|
||||
import ExpoModulesCore
|
||||
import UIKit
|
||||
|
||||
public class PaseoPressFeedbackModule: Module {
|
||||
public func definition() -> ModuleDefinition {
|
||||
Name("PaseoPressFeedback")
|
||||
View(PaseoPressFeedbackView.self) {
|
||||
Prop("tint") { (view: PaseoPressFeedbackView, color: UIColor) in view.tint = color }
|
||||
Prop("radius") { (view: PaseoPressFeedbackView, radius: Double) in view.radius = radius }
|
||||
Prop("resetKey") { (view: PaseoPressFeedbackView, key: String) in view.reset(key) }
|
||||
AsyncFunction("acknowledge") { (view: PaseoPressFeedbackView) in view.acknowledge() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final class PaseoPressFeedbackView: ExpoView {
|
||||
var tint = UIColor.clear
|
||||
var radius: Double = 0
|
||||
private var acknowledged = false
|
||||
private var resetKey = ""
|
||||
required init(appContext: AppContext? = nil) {
|
||||
super.init(appContext: appContext)
|
||||
isOpaque = false
|
||||
isUserInteractionEnabled = false
|
||||
}
|
||||
func acknowledge() { acknowledged = true; setNeedsDisplay() }
|
||||
func reset(_ key: String) {
|
||||
if key != resetKey { resetKey = key; acknowledged = false; setNeedsDisplay() }
|
||||
}
|
||||
override func draw(_ rect: CGRect) {
|
||||
if acknowledged { tint.setFill(); UIBezierPath(roundedRect: bounds, cornerRadius: radius).fill() }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "paseo-press-feedback",
|
||||
"version": "0.1.0",
|
||||
"private": true
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
import { expect, it } from "vitest";
|
||||
import { acceptWorkspaceRowPress, type WorkspaceRowPress } from "./accept";
|
||||
|
||||
function rowPress(overrides: Partial<WorkspaceRowPress> = {}) {
|
||||
const visible: string[] = [];
|
||||
const press: WorkspaceRowPress = {
|
||||
cancelled: false,
|
||||
native: true,
|
||||
selected: false,
|
||||
sidebar: "overlay",
|
||||
target: "agent-list",
|
||||
acknowledge: () => visible.push("row"),
|
||||
navigate: () => visible.push("workspace"),
|
||||
...overrides,
|
||||
};
|
||||
return { press, visible };
|
||||
}
|
||||
|
||||
it("acknowledges an accepted row before navigation starts", () => {
|
||||
const { press, visible } = rowPress();
|
||||
expect(acceptWorkspaceRowPress(press)).toBe(true);
|
||||
expect(visible).toEqual(["row", "workspace"]);
|
||||
});
|
||||
|
||||
it("does not acknowledge or navigate after scrolling or a long press claims the touch", () => {
|
||||
const { press, visible } = rowPress({ cancelled: true });
|
||||
expect(acceptWorkspaceRowPress(press)).toBe(false);
|
||||
expect(visible).toEqual([]);
|
||||
});
|
||||
|
||||
it("accepts only the first row while its selection closes the sidebar", () => {
|
||||
const { press, visible } = rowPress();
|
||||
press.navigate = () => {
|
||||
press.target = "agent";
|
||||
visible.push("workspace B");
|
||||
};
|
||||
expect(acceptWorkspaceRowPress(press)).toBe(true);
|
||||
expect(acceptWorkspaceRowPress(press)).toBe(false);
|
||||
expect(visible).toEqual(["row", "workspace B"]);
|
||||
});
|
||||
|
||||
it.each([
|
||||
{
|
||||
name: "open phone or tablet overlay",
|
||||
sidebar: "overlay",
|
||||
target: "agent-list",
|
||||
native: true,
|
||||
accepted: true,
|
||||
},
|
||||
{ name: "closing overlay", sidebar: "overlay", target: "agent", native: true, accepted: false },
|
||||
{
|
||||
name: "explorer covering an overlay",
|
||||
sidebar: "overlay",
|
||||
target: "file-explorer",
|
||||
native: true,
|
||||
accepted: false,
|
||||
},
|
||||
{ name: "docked sidebar", sidebar: "dock", target: "agent", native: true, accepted: true },
|
||||
{
|
||||
name: "docked sidebar beside explorer",
|
||||
sidebar: "dock",
|
||||
target: "file-explorer",
|
||||
native: true,
|
||||
accepted: true,
|
||||
},
|
||||
{ name: "hidden sidebar", sidebar: "hidden", target: "agent", native: true, accepted: false },
|
||||
{
|
||||
name: "suspended open overlay",
|
||||
sidebar: "suspended",
|
||||
target: "agent-list",
|
||||
native: true,
|
||||
accepted: true,
|
||||
},
|
||||
{
|
||||
name: "suspended closed overlay",
|
||||
sidebar: "suspended",
|
||||
target: "agent",
|
||||
native: true,
|
||||
accepted: false,
|
||||
},
|
||||
{
|
||||
name: "web sidebar independent of native panel target",
|
||||
sidebar: "overlay",
|
||||
target: "agent",
|
||||
native: false,
|
||||
accepted: true,
|
||||
},
|
||||
] as const)("uses the panel state for $name", ({ accepted, name: _, ...state }) => {
|
||||
const { press, visible } = rowPress(state);
|
||||
expect(acceptWorkspaceRowPress(press)).toBe(accepted);
|
||||
expect(visible).toEqual(accepted ? ["row", "workspace"] : []);
|
||||
});
|
||||
|
||||
it("does not leave an acknowledgement over an already selected docked row", () => {
|
||||
const { press, visible } = rowPress({ selected: true, sidebar: "dock", target: "agent" });
|
||||
expect(acceptWorkspaceRowPress(press)).toBe(true);
|
||||
expect(visible).toEqual(["workspace"]);
|
||||
});
|
||||
|
||||
it("still acknowledges a selected overlay row before the sidebar leaves", () => {
|
||||
const { press, visible } = rowPress({ selected: true });
|
||||
expect(acceptWorkspaceRowPress(press)).toBe(true);
|
||||
expect(visible).toEqual(["row", "workspace"]);
|
||||
});
|
||||
@@ -1,20 +0,0 @@
|
||||
import type { LeftSidebarPresentation, MobilePanelView } from "@/stores/panel-store";
|
||||
|
||||
export interface WorkspaceRowPress {
|
||||
cancelled: boolean;
|
||||
native: boolean;
|
||||
selected: boolean;
|
||||
sidebar: LeftSidebarPresentation;
|
||||
target: MobilePanelView;
|
||||
acknowledge(): void;
|
||||
navigate(): void;
|
||||
}
|
||||
|
||||
export function acceptWorkspaceRowPress(press: WorkspaceRowPress): boolean {
|
||||
if (press.cancelled) return false;
|
||||
if (press.native && press.sidebar !== "dock" && press.target !== "agent-list") return false;
|
||||
// A selected docked row neither changes selection nor leaves the screen to clear the fill.
|
||||
if (!press.selected || press.sidebar !== "dock") press.acknowledge();
|
||||
press.navigate();
|
||||
return true;
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
import { requireNativeView } from "expo";
|
||||
import { type Ref } from "react";
|
||||
import { usePanelStore } from "@/stores/panel-store";
|
||||
import { withUnistyles } from "react-native-unistyles";
|
||||
import { View, StyleSheet, type ViewProps } from "react-native";
|
||||
|
||||
export interface RowFeedbackHandle {
|
||||
acknowledge(): Promise<void>;
|
||||
}
|
||||
interface FeedbackProps extends ViewProps {
|
||||
ref?: Ref<RowFeedbackHandle>;
|
||||
resetKey: string;
|
||||
tint?: string;
|
||||
radius?: number;
|
||||
}
|
||||
const NativeFeedback = withUnistyles(requireNativeView<FeedbackProps>("PaseoPressFeedback"));
|
||||
const mapTheme = (theme: import("@/styles/theme").Theme) => ({
|
||||
tint: theme.colors.interactionHighlight,
|
||||
radius: theme.borderRadius.lg,
|
||||
});
|
||||
export function RowFeedback({
|
||||
ref,
|
||||
selected,
|
||||
}: {
|
||||
ref?: Ref<RowFeedbackHandle>;
|
||||
selected: boolean;
|
||||
}) {
|
||||
const revision = usePanelStore((state) => state.mobilePanel.revision);
|
||||
// Selection takes over the fill; a new panel transition clears it before reopening.
|
||||
const resetKey = `${selected}:${revision}`;
|
||||
return (
|
||||
<View pointerEvents="none" style={styles.overlay}>
|
||||
<NativeFeedback
|
||||
ref={ref}
|
||||
resetKey={resetKey}
|
||||
pointerEvents="none"
|
||||
style={styles.fill}
|
||||
uniProps={mapTheme}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
overlay: { position: "absolute", top: 0, right: 0, bottom: 0, left: 0 },
|
||||
fill: { flex: 1 },
|
||||
});
|
||||
@@ -1,7 +0,0 @@
|
||||
import type { Ref } from "react";
|
||||
export interface RowFeedbackHandle {
|
||||
acknowledge(): Promise<void>;
|
||||
}
|
||||
export function RowFeedback(_props: { ref?: Ref<RowFeedbackHandle>; selected: boolean }) {
|
||||
return null;
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
import { useCallback, useRef, type RefObject } from "react";
|
||||
import { isNative } from "@/constants/platform";
|
||||
import { usePanelStore } from "@/stores/panel-store";
|
||||
import { acceptWorkspaceRowPress } from "../accept";
|
||||
import { RowFeedback, type RowFeedbackHandle } from "./feedback";
|
||||
|
||||
export function useWorkspaceRowPress({
|
||||
didLongPressRef,
|
||||
onPress,
|
||||
selected,
|
||||
}: {
|
||||
didLongPressRef?: RefObject<boolean>;
|
||||
onPress(): void;
|
||||
selected: boolean;
|
||||
}) {
|
||||
const feedback = useRef<RowFeedbackHandle>(null);
|
||||
const handlePress = useCallback(() => {
|
||||
const cancelled = didLongPressRef?.current ?? false;
|
||||
if (didLongPressRef) didLongPressRef.current = false;
|
||||
const panel = usePanelStore.getState();
|
||||
acceptWorkspaceRowPress({
|
||||
cancelled,
|
||||
native: isNative,
|
||||
selected,
|
||||
sidebar: panel.layout.leftSidebar,
|
||||
target: panel.mobilePanel.target,
|
||||
// Paint on the native UI thread before navigation occupies JS; never wait for paint.
|
||||
acknowledge: () => {
|
||||
void feedback.current?.acknowledge();
|
||||
},
|
||||
navigate: onPress,
|
||||
});
|
||||
}, [didLongPressRef, onPress, selected]);
|
||||
return {
|
||||
onPress: handlePress,
|
||||
feedback: <RowFeedback ref={feedback} selected={selected} />,
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/app",
|
||||
"version": "0.16.2",
|
||||
"version": "0.16.1",
|
||||
"private": true,
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
|
||||
@@ -30,25 +30,6 @@ function answer(
|
||||
}
|
||||
|
||||
describe("draft options model", () => {
|
||||
it("retains an Ultracode option only after the current host advertises it", () => {
|
||||
const model = openDraftOptions({ provider: "claude" });
|
||||
const legacy = { provider: "claude", cwd: "/repo", thinkingOptionId: "ultracode" };
|
||||
model.applyResolved(answer("claude", "old-host", {}, []));
|
||||
expect(model.retainResolvedOption("ultracode", "old-host")).toBeUndefined();
|
||||
expect(draftControlsRequest(model.getState(), legacy)).toEqual(legacy);
|
||||
|
||||
model.applyResolved(
|
||||
answer("claude", "new-host", { ultracode: true }, [
|
||||
{ type: "toggle", key: "ultracode", label: "Ultracode" },
|
||||
]),
|
||||
);
|
||||
expect(model.retainResolvedOption("ultracode", "old-host")).toBeUndefined();
|
||||
expect(model.retainResolvedOption("ultracode", "new-host")).toEqual({ ultracode: true });
|
||||
expect(
|
||||
draftControlsRequest(model.getState(), { ...legacy, thinkingOptionId: "high" }),
|
||||
).toMatchObject({ thinkingOptionId: "high", providerOptions: { ultracode: true } });
|
||||
});
|
||||
|
||||
it("draws a legacy Fast profile as the Fast tier the daemon resolved", () => {
|
||||
const model = openDraftOptions({ provider: "codex", seed: { service_tier: "fast" } });
|
||||
model.applyResolved(answer("codex", "k1", { service_tier: "priority" }));
|
||||
|
||||
@@ -47,7 +47,6 @@ export interface DraftOptionsModel {
|
||||
applyProfile: (profile: { provider: string; options: ProviderOptions }) => void;
|
||||
setRemembered: (remembered: ProviderOptions) => void;
|
||||
setOption: (key: string, value: unknown) => void;
|
||||
retainResolvedOption: (key: string, requestKey: string) => ProviderOptions | undefined;
|
||||
applyResolved: (resolved: ResolvedDraftOptions) => void;
|
||||
}
|
||||
|
||||
@@ -113,17 +112,6 @@ export function openDraftOptions(input: {
|
||||
: { ...current, edits: { ...current.edits, [key]: value } },
|
||||
);
|
||||
},
|
||||
retainResolvedOption: (key, requestKey) => {
|
||||
const resolved = state.resolved;
|
||||
if (resolved?.requestKey !== requestKey || key in state.edits) return undefined;
|
||||
const value = resolved.options[key];
|
||||
if (value === undefined || !resolved.controls.some((control) => control.key === key)) {
|
||||
return undefined;
|
||||
}
|
||||
const patch = { [key]: value };
|
||||
publish((current) => ({ ...current, edits: { ...current.edits, ...patch } }));
|
||||
return patch;
|
||||
},
|
||||
applyResolved: (resolved) =>
|
||||
publish((current) => ({
|
||||
...current,
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
import { expect, it } from "vitest";
|
||||
import { createInitialDrawDistanceExpansion } from "./initial-draw-distance";
|
||||
|
||||
function mountInitialBuffer() {
|
||||
let nextId = 0;
|
||||
const pending = new Map<number, () => void>();
|
||||
const expansions: string[] = [];
|
||||
const buffer = createInitialDrawDistanceExpansion(
|
||||
{
|
||||
requestFrame(callback) {
|
||||
const id = ++nextId;
|
||||
pending.set(id, callback);
|
||||
return id;
|
||||
},
|
||||
cancelFrame(id) {
|
||||
pending.delete(id);
|
||||
},
|
||||
},
|
||||
() => expansions.push("full draw distance"),
|
||||
);
|
||||
function advanceFrame() {
|
||||
const callbacks = [...pending.values()];
|
||||
pending.clear();
|
||||
for (const callback of callbacks) callback();
|
||||
}
|
||||
return { buffer, expansions, advanceFrame };
|
||||
}
|
||||
|
||||
it("requests the full draw distance after two frame callbacks once the reveal is eligible", () => {
|
||||
const { buffer, expansions, advanceFrame } = mountInitialBuffer();
|
||||
buffer.schedule();
|
||||
advanceFrame();
|
||||
expect(expansions).toEqual([]);
|
||||
advanceFrame();
|
||||
expect(expansions).toEqual(["full draw distance"]);
|
||||
});
|
||||
|
||||
it.each([0, 1])(
|
||||
"leaves initial draw distance in place during a gesture after %i frames",
|
||||
(elapsed) => {
|
||||
const { buffer, expansions, advanceFrame } = mountInitialBuffer();
|
||||
buffer.schedule();
|
||||
if (elapsed === 1) advanceFrame();
|
||||
|
||||
buffer.pauseForScroll();
|
||||
advanceFrame();
|
||||
advanceFrame();
|
||||
expect(expansions).toEqual([]);
|
||||
|
||||
buffer.resumeAfterScroll();
|
||||
advanceFrame();
|
||||
expect(expansions).toEqual([]);
|
||||
advanceFrame();
|
||||
expect(expansions).toEqual(["full draw distance"]);
|
||||
},
|
||||
);
|
||||
|
||||
it("cancels a covered reveal and schedules again when it is eligible", () => {
|
||||
const { buffer, expansions, advanceFrame } = mountInitialBuffer();
|
||||
const cancel = buffer.schedule();
|
||||
advanceFrame();
|
||||
cancel();
|
||||
advanceFrame();
|
||||
expect(expansions).toEqual([]);
|
||||
|
||||
buffer.schedule();
|
||||
advanceFrame();
|
||||
advanceFrame();
|
||||
expect(expansions).toEqual(["full draw distance"]);
|
||||
});
|
||||
|
||||
it("keeps a covered list at its initial draw distance when a gesture ends", () => {
|
||||
const { buffer, expansions, advanceFrame } = mountInitialBuffer();
|
||||
buffer.pauseForScroll();
|
||||
const cover = buffer.schedule();
|
||||
advanceFrame();
|
||||
advanceFrame();
|
||||
expect(expansions).toEqual([]);
|
||||
|
||||
cover();
|
||||
buffer.resumeAfterScroll();
|
||||
advanceFrame();
|
||||
advanceFrame();
|
||||
expect(expansions).toEqual([]);
|
||||
});
|
||||
@@ -1,50 +0,0 @@
|
||||
interface InitialDrawDistanceFrames {
|
||||
requestFrame(callback: () => void): number;
|
||||
cancelFrame(id: number): void;
|
||||
}
|
||||
|
||||
export function createInitialDrawDistanceExpansion(
|
||||
frames: InitialDrawDistanceFrames,
|
||||
expand: () => void,
|
||||
) {
|
||||
let frame: number | null = null;
|
||||
let eligible = false;
|
||||
let scrolling = false;
|
||||
let expanded = false;
|
||||
|
||||
function cancel() {
|
||||
if (frame === null) return;
|
||||
frames.cancelFrame(frame);
|
||||
frame = null;
|
||||
}
|
||||
|
||||
function scheduleIfIdle() {
|
||||
if (!eligible || scrolling || expanded || frame !== null) return;
|
||||
frame = frames.requestFrame(() => {
|
||||
frame = frames.requestFrame(() => {
|
||||
frame = null;
|
||||
expanded = true;
|
||||
expand();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
schedule() {
|
||||
eligible = true;
|
||||
scheduleIfIdle();
|
||||
return () => {
|
||||
eligible = false;
|
||||
cancel();
|
||||
};
|
||||
},
|
||||
pauseForScroll() {
|
||||
scrolling = true;
|
||||
cancel();
|
||||
},
|
||||
resumeAfterScroll() {
|
||||
scrolling = false;
|
||||
scheduleIfIdle();
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -40,7 +40,6 @@ function wait(ms: number): Promise<void> {
|
||||
}
|
||||
|
||||
const LIST_STYLE = { flex: 1 };
|
||||
const ESTIMATED_LIST_SIZE = { width: 300, height: VIEWPORT_HEIGHT };
|
||||
const rowStyles = new Map<number, { height: number }>();
|
||||
|
||||
function rowStyle(height: number) {
|
||||
@@ -90,10 +89,6 @@ function keyExtractor(item: Row) {
|
||||
return item.id;
|
||||
}
|
||||
|
||||
function estimateRowSize(item: Row) {
|
||||
return item.height;
|
||||
}
|
||||
|
||||
function mountList(heldRowId: string) {
|
||||
const listRef = React.createRef<LegendListRef>();
|
||||
const maintainVisibleContentPosition = holdOnly(heldRowId);
|
||||
@@ -269,49 +264,3 @@ it("keeps measured row sizes while the list is not laid out", async () => {
|
||||
|
||||
expect(rows.map((row) => list.rowSize(row.id))).toEqual([40, 40, 40]);
|
||||
});
|
||||
|
||||
it("expands the draw distance of a placed end-anchored list without moving its bottom row", async () => {
|
||||
const rows: Row[] = Array.from({ length: 99 }, (_, index) => ({
|
||||
id: `row-${index}`,
|
||||
height: index % 2 === 0 ? 20 : 60,
|
||||
}));
|
||||
const lastRow = { id: "last-row", height: 180 };
|
||||
rows.push(lastRow);
|
||||
const listRef = React.createRef<LegendListRef>();
|
||||
|
||||
function render(drawDistance: number) {
|
||||
act(() => {
|
||||
root.render(
|
||||
<LegendList
|
||||
ref={listRef}
|
||||
data={rows}
|
||||
renderItem={renderRow}
|
||||
keyExtractor={keyExtractor}
|
||||
estimatedListSize={ESTIMATED_LIST_SIZE}
|
||||
recycleItems={false}
|
||||
getEstimatedItemSize={estimateRowSize}
|
||||
drawDistance={drawDistance}
|
||||
alignItemsAtEnd
|
||||
initialScrollAtEnd
|
||||
style={LIST_STYLE}
|
||||
/>,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
render(50);
|
||||
await wait(300);
|
||||
const initial = listRef.current?.getState();
|
||||
const lastRowTop = initial?.positionByKey(lastRow.id);
|
||||
expect(initial?.sizes.get(lastRow.id)).toBe(lastRow.height);
|
||||
expect(initial?.sizes.size).toBeLessThan(8);
|
||||
expect(initial?.scroll).toBe(Number(lastRowTop) + lastRow.height - VIEWPORT_HEIGHT);
|
||||
|
||||
render(1000);
|
||||
await wait(150);
|
||||
|
||||
const expanded = listRef.current?.getState();
|
||||
expect(expanded?.sizes.size).toBeGreaterThan(20);
|
||||
expect(expanded?.scroll).toBe(initial?.scroll);
|
||||
expect(expanded?.positionByKey(lastRow.id)).toBe(lastRowTop);
|
||||
});
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
useState,
|
||||
} from "react";
|
||||
import {
|
||||
Dimensions,
|
||||
View,
|
||||
type LayoutChangeEvent,
|
||||
type NativeScrollEvent,
|
||||
@@ -32,7 +31,6 @@ import { useTranslation } from "react-i18next";
|
||||
import type { StreamItem } from "@/types/stream";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
import { useStableEvent } from "@/hooks/use-stable-event";
|
||||
import { useIsMobilePanelActive } from "@/mobile-panels/provider";
|
||||
import { shouldAnimateNativeScrollToBottom } from "./native-scroll-animation";
|
||||
import { useRevisedHistoryRows } from "./history-row-revision";
|
||||
import { useBottomAnchorController } from "./bottom-anchor-controller";
|
||||
@@ -45,7 +43,6 @@ import {
|
||||
} from "./native-disclosure-hold";
|
||||
import { EndPinnedScrollView } from "./native-end-pin";
|
||||
import { createNewRowEstimates } from "./new-row-estimates";
|
||||
import { createInitialDrawDistanceExpansion } from "./initial-draw-distance";
|
||||
import type {
|
||||
DisclosureTriggerEdge,
|
||||
StreamRenderInput,
|
||||
@@ -135,14 +132,6 @@ function keyExtractor(item: { id: string }): string {
|
||||
return item.id;
|
||||
}
|
||||
|
||||
function InitialDrawDistanceExpansion({ schedule }: { schedule: () => () => void }) {
|
||||
const isSidebarActive = useIsMobilePanelActive("agent-list");
|
||||
useLayoutEffect(() => {
|
||||
if (!isSidebarActive) return schedule();
|
||||
}, [schedule, isSidebarActive]);
|
||||
return null;
|
||||
}
|
||||
|
||||
function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrategy }) {
|
||||
const {
|
||||
agentId,
|
||||
@@ -168,16 +157,6 @@ function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrat
|
||||
strategy,
|
||||
} = props;
|
||||
const isActive = useRetainedPanelActive();
|
||||
// Keep a screenful in reserve for a fling that starts before the full buffer mounts.
|
||||
const [drawDistance, setDrawDistance] = useState(() =>
|
||||
Math.min(Dimensions.get("window").height, NATIVE_STREAM_DRAW_DISTANCE),
|
||||
);
|
||||
const [drawDistanceExpansion] = useState(() =>
|
||||
createInitialDrawDistanceExpansion(
|
||||
{ requestFrame: requestAnimationFrame, cancelFrame: cancelAnimationFrame },
|
||||
() => setDrawDistance(NATIVE_STREAM_DRAW_DISTANCE),
|
||||
),
|
||||
);
|
||||
const { t } = useTranslation();
|
||||
const { renderHistoryMountedRow, renderLiveHeadRow, renderLiveAuxiliary } = renderers;
|
||||
const listRef = useRef<LegendListRef>(null);
|
||||
@@ -590,9 +569,6 @@ function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrat
|
||||
cancelDisclosureHold();
|
||||
bottomAnchorController.beginUserScroll();
|
||||
historyStartPagination.rearm();
|
||||
// The reserve follows the gesture. Expanding the buffer here shifted the measured
|
||||
// content and returned the viewport to the end during an Android fling.
|
||||
drawDistanceExpansion.pauseForScroll();
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
@@ -615,7 +591,6 @@ function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrat
|
||||
bottomAnchorController.endUserScroll({
|
||||
isAtEnd: isReleasedAtEndRef.current || isAtEnd(),
|
||||
});
|
||||
drawDistanceExpansion.resumeAfterScroll();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -635,7 +610,6 @@ function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrat
|
||||
bottomAnchorController.endUserScroll({
|
||||
isAtEnd: isReleasedAtEndRef.current || isScrollEventAtEnd(event),
|
||||
});
|
||||
drawDistanceExpansion.resumeAfterScroll();
|
||||
},
|
||||
);
|
||||
|
||||
@@ -758,11 +732,6 @@ function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrat
|
||||
);
|
||||
}, [historyStartPaginationState, hasOlderHistory, retryHistoryStart, t]);
|
||||
|
||||
const canExpandDrawDistance =
|
||||
drawDistance < NATIVE_STREAM_DRAW_DISTANCE &&
|
||||
isActive &&
|
||||
isListPlaced &&
|
||||
historyStartPaginationState.visible;
|
||||
return (
|
||||
<View style={viewportStyle}>
|
||||
<LegendList<StreamItem>
|
||||
@@ -795,14 +764,11 @@ function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrat
|
||||
recycleItems={false}
|
||||
alignItemsAtEnd
|
||||
initialScrollAtEnd
|
||||
drawDistance={drawDistance}
|
||||
drawDistance={NATIVE_STREAM_DRAW_DISTANCE}
|
||||
getEstimatedItemSize={getEstimatedItemSize}
|
||||
scrollEnabled={scrollEnabled}
|
||||
showsVerticalScrollIndicator
|
||||
/>
|
||||
{canExpandDrawDistance ? (
|
||||
<InitialDrawDistanceExpansion schedule={drawDistanceExpansion.schedule} />
|
||||
) : null}
|
||||
{!historyStartPaginationState.visible ? (
|
||||
<View pointerEvents="none" testID="agent-initial-fill" style={initialFillStyle}>
|
||||
<ThemedLoadingSpinner size="large" uniProps={foregroundMutedColorMapping} />
|
||||
|
||||
@@ -851,94 +851,6 @@ it("copies a selection inside semantic inline code without Markdown escaping", (
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps intraword underscores in prose unescaped", () => {
|
||||
const message = mountFixture();
|
||||
message.innerHTML = "<p>Set max_retries and snake_case before the call.</p>";
|
||||
const paragraph = fixtureElement(message, "p");
|
||||
expect(createAssistantSelectionClipboardContent(selectNodeContents(paragraph))?.plainText).toBe(
|
||||
"Set max_retries and snake_case before the call.",
|
||||
);
|
||||
});
|
||||
|
||||
it("copies literal paired underscores raw in text/plain and escaped in text/html", () => {
|
||||
const message = mountFixture();
|
||||
message.innerHTML = "<p>literal _word_ stays literal</p>";
|
||||
const paragraph = fixtureElement(message, "p");
|
||||
const content = createAssistantSelectionClipboardContent(selectNodeContents(paragraph));
|
||||
expect(content?.plainText).toBe("literal _word_ stays literal");
|
||||
expect(content?.html).toContain("literal _word_ stays literal");
|
||||
});
|
||||
|
||||
it("copies a path the renderer recognized as text, and an authored link as a link", () => {
|
||||
const message = mountFixture();
|
||||
message.innerHTML =
|
||||
'<p>See <a href="src/index.ts" data-paseo-markdown-recognized-link="true">src/index.ts</a> and <a href="https://example.test/doc">the doc</a>.</p>';
|
||||
const content = createAssistantSelectionClipboardContent(selectNodeContents(message));
|
||||
expect(content?.plainText).toBe("See src/index.ts and [the doc](https://example.test/doc).");
|
||||
expect(content?.html).not.toContain('href="src/index.ts"');
|
||||
});
|
||||
|
||||
it("copies a recognized inline-code path without its link", () => {
|
||||
const message = mountFixture();
|
||||
message.innerHTML =
|
||||
'<p>Edited <a href="src/app.tsx" data-paseo-markdown-recognized-link="true"><code>src/app.tsx</code></a> today.</p>';
|
||||
const content = createAssistantSelectionClipboardContent(selectNodeContents(message));
|
||||
expect(content?.plainText).toBe("Edited `src/app.tsx` today.");
|
||||
expect(content?.html).not.toContain('href="src/app.tsx"');
|
||||
});
|
||||
|
||||
it("copies a recognized web link as its text in text/plain and as a link in text/html", () => {
|
||||
const message = mountFixture();
|
||||
message.innerHTML =
|
||||
'<p>Fixed in <a href="https://github.com/o/r/issues/12" data-paseo-markdown-recognized-link="true">#12</a> today.</p>';
|
||||
const content = createAssistantSelectionClipboardContent(selectNodeContents(message));
|
||||
expect(content?.plainText).toBe("Fixed in #12 today.");
|
||||
expect(content?.html).toContain('<a href="https://github.com/o/r/issues/12">#12</a>');
|
||||
});
|
||||
|
||||
it("copies a recognized Windows drive path as text in both clipboard flavors", () => {
|
||||
const message = mountFixture();
|
||||
message.innerHTML =
|
||||
'<p>Open <a href="C:%5Crepo%5Csrc%5Cx.ts" data-paseo-markdown-recognized-link="true">C:\\repo\\src\\x.ts</a> now.</p>';
|
||||
const content = createAssistantSelectionClipboardContent(selectNodeContents(message));
|
||||
expect(content?.plainText).toBe("Open C:\\repo\\src\\x.ts now.");
|
||||
expect(content?.html).not.toContain("<a ");
|
||||
});
|
||||
|
||||
it("keeps literal angle brackets around a URL in text/html", () => {
|
||||
const message = mountFixture();
|
||||
message.innerHTML = "<p>Open <http://localhost:3000> before the call.</p>";
|
||||
const content = createAssistantSelectionClipboardContent(selectNodeContents(message));
|
||||
expect(content?.plainText).toBe("Open <http://localhost:3000> before the call.");
|
||||
expect(content?.html).toContain("<p>Open <http://localhost:3000> before the call.</p>");
|
||||
});
|
||||
|
||||
it("keeps a heading marker split across inline elements literal in text/html", () => {
|
||||
const message = mountFixture();
|
||||
message.innerHTML = "<p>Use <strong>C#</strong> for the service layer.</p>";
|
||||
const paragraph = fixtureElement(message, "p");
|
||||
const range = document.createRange();
|
||||
range.setStart(textNode(fixtureElement(message, "strong")), 1);
|
||||
range.setEnd(paragraph.lastChild!, paragraph.lastChild!.textContent!.length);
|
||||
const selection = window.getSelection()!;
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
const content = createAssistantSelectionClipboardContent(selection);
|
||||
expect(content?.plainText).toBe("# for the service layer.");
|
||||
expect(content?.html).toContain("<p># for the service layer.</p>");
|
||||
});
|
||||
|
||||
it("keeps table cell pipes escaped in text/plain table syntax and literal in text/html", () => {
|
||||
const message = mountFixture();
|
||||
message.innerHTML =
|
||||
"<table><thead><tr><th>Header | label</th></tr></thead><tbody><tr><td>Value | detail</td></tr></tbody></table>";
|
||||
const content = createAssistantSelectionClipboardContent(selectNodeContents(message));
|
||||
expect(content?.plainText).toContain("Header \\| label");
|
||||
expect(content?.plainText).toContain("Value \\| detail");
|
||||
expect(content?.html).toContain("<th>Header | label</th>");
|
||||
expect(content?.html).toContain("<td>Value | detail</td>");
|
||||
});
|
||||
|
||||
it("copies a workspace image path instead of its temporary display URL", () => {
|
||||
const message = mountFixture();
|
||||
const sources = JSON.stringify({ "blob:preview": "assets/chart.png" });
|
||||
|
||||
@@ -2,7 +2,7 @@ import TurndownService from "turndown";
|
||||
import { gfm } from "turndown-plugin-gfm";
|
||||
import {
|
||||
createCodeClipboardContent,
|
||||
createSelectionClipboardContent,
|
||||
createMarkdownClipboardContent,
|
||||
type MarkdownClipboardContent,
|
||||
} from "@/utils/rich-clipboard";
|
||||
import {
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
MARKDOWN_COPY_LIST_START_ATTRIBUTE,
|
||||
MARKDOWN_COPY_SRC_ATTRIBUTE,
|
||||
MARKDOWN_COPY_TAG_ATTRIBUTE,
|
||||
MARKDOWN_COPY_RECOGNIZED_LINK_ATTRIBUTE,
|
||||
MARKDOWN_COPY_UNWRAP_ATTRIBUTE,
|
||||
TRAILING_CODE_LINE_BREAKS,
|
||||
} from "./markup";
|
||||
@@ -57,68 +56,40 @@ function copySemanticAttributes(original: Element, copy: Element): void {
|
||||
}
|
||||
}
|
||||
|
||||
function createTurndown(flavor: "markdown" | "plain"): TurndownService {
|
||||
const turndown = new TurndownService({
|
||||
bulletListMarker: "-",
|
||||
codeBlockStyle: "fenced",
|
||||
emDelimiter: "_",
|
||||
strongDelimiter: "**",
|
||||
});
|
||||
turndown.use(gfm);
|
||||
// text/plain still carries tables as GFM syntax, so a cell's pipe stays escaped there.
|
||||
turndown.addRule("escapedGfmTableCell", {
|
||||
filter: ["th", "td"],
|
||||
replacement: (content, node) => {
|
||||
const index = node.parentNode ? Array.from(node.parentNode.childNodes).indexOf(node) : 0;
|
||||
const prefix = index === 0 ? "| " : " ";
|
||||
return `${prefix}${content.replace(/\|/g, "\\|")} |`;
|
||||
},
|
||||
});
|
||||
// A link Paseo recognized pastes as the text the reply showed. Rich paste keeps it as a
|
||||
// link when it points to a web page, such as a forge reference.
|
||||
turndown.addRule("recognizedLink", {
|
||||
filter: (node) =>
|
||||
node.nodeName === "A" &&
|
||||
node.hasAttribute(MARKDOWN_COPY_RECOGNIZED_LINK_ATTRIBUTE) &&
|
||||
(flavor === "plain" || !isWebUrl(node.getAttribute("href") ?? "")),
|
||||
replacement: (content) => content,
|
||||
});
|
||||
if (flavor === "markdown") {
|
||||
// Turndown leaves `<` unescaped, so displayed text such as `<http://localhost>`
|
||||
// would render back into text/html as an autolink.
|
||||
const escapeMarkdown = turndown.escape.bind(turndown);
|
||||
turndown.escape = (text) => escapeMarkdown(text).replace(/</g, "\\<");
|
||||
} else {
|
||||
turndown.escape = (text) => text;
|
||||
}
|
||||
turndown.addRule("gfmStrikethrough", {
|
||||
filter: ["del", "s"],
|
||||
replacement: (content) => `~~${content}~~`,
|
||||
});
|
||||
turndown.addRule("compactListItem", {
|
||||
filter: "li",
|
||||
replacement: (content, node, options) => {
|
||||
const item = content
|
||||
.replace(/^\n+/, "")
|
||||
.replace(/\n+$/, "\n")
|
||||
// Every non-empty line, so indented code lines stay inside the item.
|
||||
.replace(/\n(?=[^\n])/g, "\n ");
|
||||
const parent = node.parentElement;
|
||||
if (parent?.nodeName !== "OL") {
|
||||
return `${options.bulletListMarker} ${item}\n`;
|
||||
}
|
||||
return `${node.getAttribute("value")}. ${item}\n`;
|
||||
},
|
||||
});
|
||||
return turndown;
|
||||
}
|
||||
|
||||
function isWebUrl(href: string): boolean {
|
||||
return /^https?:\/\//i.test(href);
|
||||
}
|
||||
|
||||
const markdownTurndown = createTurndown("markdown");
|
||||
const plainTurndown = createTurndown("plain");
|
||||
const turndown = new TurndownService({
|
||||
bulletListMarker: "-",
|
||||
codeBlockStyle: "fenced",
|
||||
emDelimiter: "_",
|
||||
strongDelimiter: "**",
|
||||
});
|
||||
turndown.use(gfm);
|
||||
turndown.addRule("escapedGfmTableCell", {
|
||||
filter: ["th", "td"],
|
||||
replacement: (content, node) => {
|
||||
const index = node.parentNode ? Array.from(node.parentNode.childNodes).indexOf(node) : 0;
|
||||
const prefix = index === 0 ? "| " : " ";
|
||||
return `${prefix}${content.replace(/\|/g, "\\|")} |`;
|
||||
},
|
||||
});
|
||||
turndown.addRule("gfmStrikethrough", {
|
||||
filter: ["del", "s"],
|
||||
replacement: (content) => `~~${content}~~`,
|
||||
});
|
||||
turndown.addRule("compactListItem", {
|
||||
filter: "li",
|
||||
replacement: (content, node, options) => {
|
||||
const item = content
|
||||
.replace(/^\n+/, "")
|
||||
.replace(/\n+$/, "\n")
|
||||
// Every non-empty line, so indented code lines stay inside the item.
|
||||
.replace(/\n(?=[^\n])/g, "\n ");
|
||||
const parent = node.parentElement;
|
||||
if (parent?.nodeName !== "OL") {
|
||||
return `${options.bulletListMarker} ${item}\n`;
|
||||
}
|
||||
return `${node.getAttribute("value")}. ${item}\n`;
|
||||
},
|
||||
});
|
||||
|
||||
export function createAssistantSelectionClipboardContent(
|
||||
selection: Selection | null,
|
||||
@@ -146,15 +117,11 @@ export function createAssistantSelectionClipboardContent(
|
||||
}
|
||||
restoreMarkdownElements(container);
|
||||
|
||||
const markdown = markdownTurndown.turndown(container).trim();
|
||||
const markdown = turndown.turndown(container.innerHTML).trim();
|
||||
if (!markdown) {
|
||||
return null;
|
||||
}
|
||||
// text/plain carries unescaped Markdown: a plain target shows backslashes literally.
|
||||
// text/html is rendered from escaped Markdown, so literal Markdown characters stay
|
||||
// literal in a rich target.
|
||||
const plainText = plainTurndown.turndown(container).trim();
|
||||
const content = createSelectionClipboardContent(markdown, plainText);
|
||||
const content = createMarkdownClipboardContent(markdown);
|
||||
return { ...content, html: flattenClipboardListMarkup(content.html) };
|
||||
}
|
||||
|
||||
@@ -684,15 +651,13 @@ function restoreMarkdownElements(container: HTMLElement): void {
|
||||
for (const element of presentational.toReversed()) {
|
||||
element.replaceWith(...element.childNodes);
|
||||
}
|
||||
// Turndown escapes line-start Markdown per text node, so text split by an unwrapped
|
||||
// element, such as `#` and ` for`, has to be one node to keep `# for` literal.
|
||||
container.normalize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign item numbers before passing the DOM to Turndown. A partly selected item
|
||||
* still takes its original list position when copied as a paragraph, so the following
|
||||
* items keep their numbers.
|
||||
* Each item carries its number before Turndown re-parses the HTML. Until then every
|
||||
* child of the list is one item, including a partly selected item demoted to a `p`.
|
||||
* The parser splits a `p` that holds a code block into several siblings, so counting
|
||||
* siblings afterwards numbers the next item too high.
|
||||
*/
|
||||
function numberOrderedListItems(list: Element, start: number): void {
|
||||
Array.from(list.children).forEach((child, index) => {
|
||||
|
||||
@@ -2,8 +2,6 @@ export const MARKDOWN_COPY_TAG_ATTRIBUTE = "data-paseo-markdown-tag";
|
||||
export const MARKDOWN_COPY_IGNORE_ATTRIBUTE = "data-paseo-markdown-ignore";
|
||||
export const MARKDOWN_COPY_LIST_MARKER_ATTRIBUTE = "data-paseo-markdown-list-marker";
|
||||
export const MARKDOWN_COPY_UNWRAP_ATTRIBUTE = "data-paseo-markdown-unwrap";
|
||||
/** A link Paseo recognized in the reply text, as opposed to one the Markdown wrote. */
|
||||
export const MARKDOWN_COPY_RECOGNIZED_LINK_ATTRIBUTE = "data-paseo-markdown-recognized-link";
|
||||
export const MARKDOWN_COPY_LIST_START_ATTRIBUTE = "data-paseo-markdown-list-start";
|
||||
export const MARKDOWN_COPY_LANGUAGE_ATTRIBUTE = "data-paseo-markdown-language";
|
||||
export const MARKDOWN_COPY_ALIGN_ATTRIBUTE = "data-paseo-markdown-align";
|
||||
|
||||
@@ -3,6 +3,7 @@ export interface AudioEngineCallbacks {
|
||||
onVolumeLevel(level: number): void;
|
||||
onInterruption?(): void;
|
||||
onCaptureAvailabilityChange?(available: boolean): void;
|
||||
onError?(error: Error): void;
|
||||
}
|
||||
|
||||
export interface AudioPlaybackSource {
|
||||
@@ -30,21 +31,3 @@ export interface AudioEngineOptions {
|
||||
traceLabel?: string;
|
||||
captureMode?: "conversation" | "dictation";
|
||||
}
|
||||
|
||||
export type AudioCaptureStartFailure =
|
||||
| "permissionDenied"
|
||||
| "insecureContext"
|
||||
| "unsupported"
|
||||
| "noMicrophone"
|
||||
| "startFailed";
|
||||
|
||||
export class AudioCaptureStartError extends Error {
|
||||
constructor(
|
||||
readonly reason: AudioCaptureStartFailure,
|
||||
message: string,
|
||||
options?: ErrorOptions,
|
||||
) {
|
||||
super(message, options);
|
||||
this.name = "AudioCaptureStartError";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,60 +1,239 @@
|
||||
import type { AudioEngine, AudioEngineCallbacks, AudioEngineOptions } from "./audio-engine-types";
|
||||
import type {
|
||||
AudioEngine,
|
||||
AudioEngineCallbacks,
|
||||
AudioEngineOptions,
|
||||
AudioPlaybackSource,
|
||||
} from "./audio-engine-types";
|
||||
|
||||
import { createAudioPlayer, setAudioModeAsync } from "expo-audio";
|
||||
import { File, Paths } from "expo-file-system";
|
||||
import { createPlaybackQueue } from "./playback";
|
||||
import { playFile } from "./file-playback";
|
||||
import { createNativeAudioEngine, type NativeAudioEngineDeps } from "./native-audio-engine";
|
||||
|
||||
// AVPlayer needs a file extension to recognize local encoded audio on iOS.
|
||||
const FILE_EXTENSIONS: Record<string, string> = {
|
||||
"audio/wav": "wav",
|
||||
"audio/x-wav": "wav",
|
||||
"audio/wave": "wav",
|
||||
"audio/mpeg": "mp3",
|
||||
"audio/mp3": "mp3",
|
||||
"audio/mp4": "m4a",
|
||||
"audio/aac": "aac",
|
||||
"audio/ogg": "ogg",
|
||||
"audio/flac": "flac",
|
||||
};
|
||||
|
||||
let nextFileId = 0;
|
||||
|
||||
async function playEncodedAudio(
|
||||
bytes: Uint8Array,
|
||||
mimeType: string,
|
||||
signal: AbortSignal,
|
||||
context: { isCaptureActive(): boolean },
|
||||
): Promise<number> {
|
||||
// Capture owns its audio session while active. File playback alone must not
|
||||
// initialize the microphone or the native two-way engine.
|
||||
if (!context.isCaptureActive()) {
|
||||
await setAudioModeAsync({
|
||||
playsInSilentMode: true,
|
||||
allowsRecording: false,
|
||||
interruptionMode: "duckOthers",
|
||||
interruptionModeAndroid: "duckOthers",
|
||||
});
|
||||
}
|
||||
if (signal.aborted) throw new Error("Playback stopped");
|
||||
const extension = FILE_EXTENSIONS[mimeType.split(";")[0].trim()] ?? "audio";
|
||||
const file = new File(Paths.cache, `paseo-audio-${Date.now()}-${nextFileId++}.${extension}`);
|
||||
try {
|
||||
file.write(bytes);
|
||||
const player = createAudioPlayer(file.uri, {
|
||||
updateInterval: 100,
|
||||
keepAudioSessionActive: context.isCaptureActive(),
|
||||
});
|
||||
return await playFile(player, signal);
|
||||
} finally {
|
||||
if (file.exists) file.delete();
|
||||
}
|
||||
}
|
||||
import { playPcm16 } from "./pcm";
|
||||
|
||||
export function createAudioEngine(
|
||||
callbacks: AudioEngineCallbacks,
|
||||
options?: AudioEngineOptions,
|
||||
): AudioEngine {
|
||||
const native: NativeAudioEngineDeps["native"] = require("@getpaseo/expo-two-way-audio");
|
||||
return createNativeAudioEngine({ native, playEncodedAudio }, callbacks, options);
|
||||
const native = require("@getpaseo/expo-two-way-audio");
|
||||
|
||||
const refs: {
|
||||
initialized: boolean;
|
||||
captureActive: boolean;
|
||||
muted: boolean;
|
||||
destroyed: boolean;
|
||||
} = {
|
||||
initialized: false,
|
||||
captureActive: false,
|
||||
muted: false,
|
||||
destroyed: false,
|
||||
};
|
||||
|
||||
const microphoneSubscription = native.addExpoTwoWayAudioEventListener(
|
||||
"onMicrophoneData",
|
||||
(event: { data: Uint8Array }) => {
|
||||
if (!refs.captureActive || refs.muted) {
|
||||
return;
|
||||
}
|
||||
const pcm = event.data;
|
||||
callbacks.onCaptureData(pcm);
|
||||
},
|
||||
);
|
||||
const volumeSubscription = native.addExpoTwoWayAudioEventListener(
|
||||
"onInputVolumeLevelData",
|
||||
(event: { data: number }) => {
|
||||
if (!refs.captureActive) {
|
||||
return;
|
||||
}
|
||||
const level = refs.muted ? 0 : event.data;
|
||||
callbacks.onVolumeLevel(level);
|
||||
},
|
||||
);
|
||||
const interruptionSubscription = native.addExpoTwoWayAudioEventListener(
|
||||
"onAudioInterruption",
|
||||
(event: { data: string }) => {
|
||||
if (event.data === "capture_paused" || event.data === "capture_resumed") {
|
||||
if (refs.captureActive) {
|
||||
callbacks.onCaptureAvailabilityChange?.(event.data === "capture_resumed");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (event.data !== "blocked") {
|
||||
return;
|
||||
}
|
||||
const wasCaptureActive = refs.captureActive;
|
||||
refs.captureActive = false;
|
||||
refs.muted = false;
|
||||
callbacks.onVolumeLevel(0);
|
||||
if (wasCaptureActive) {
|
||||
callbacks.onInterruption?.();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
async function ensureInitialized(): Promise<void> {
|
||||
if (refs.initialized) {
|
||||
return;
|
||||
}
|
||||
const success = await native.initialize();
|
||||
if (!success) {
|
||||
throw new Error("expo-two-way-audio: native initialize() returned false");
|
||||
}
|
||||
refs.initialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Release the OS audio session as soon as we are neither capturing nor playing.
|
||||
* Holding it keeps the user's background music paused — on iOS the non-mixing
|
||||
* `.playAndRecord` category survives backgrounding and is re-asserted on every
|
||||
* foreground, so an unreleased session means their music never comes back.
|
||||
*/
|
||||
function releaseSessionIfIdle(): void {
|
||||
if (!refs.initialized || refs.destroyed) {
|
||||
return;
|
||||
}
|
||||
if (refs.captureActive || playback.isPlaying()) {
|
||||
return;
|
||||
}
|
||||
// The wrapper no-ops on binaries whose native module predates this function.
|
||||
native.releaseAudioSession();
|
||||
}
|
||||
|
||||
async function ensureMicrophonePermission(): Promise<void> {
|
||||
let permission = await native.getMicrophonePermissionsAsync().catch(() => null);
|
||||
if (!permission?.granted) {
|
||||
permission = await native.requestMicrophonePermissionsAsync().catch(() => null);
|
||||
}
|
||||
if (!permission?.granted) {
|
||||
throw new Error(
|
||||
"Microphone permission is required to capture audio. Please enable microphone access in system settings.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let nextFileId = 0;
|
||||
async function playAudio(audio: AudioPlaybackSource, signal: AbortSignal): Promise<number> {
|
||||
const bytes = new Uint8Array(await audio.arrayBuffer());
|
||||
if (signal.aborted) throw new Error("Playback stopped");
|
||||
if (audio.type.startsWith("audio/pcm")) {
|
||||
await ensureInitialized();
|
||||
return playPcm16(bytes, audio.type, signal, native);
|
||||
}
|
||||
// Capture owns its audio session while active. File playback alone must not
|
||||
// initialize the microphone or the native two-way engine.
|
||||
if (!refs.captureActive) {
|
||||
await setAudioModeAsync({
|
||||
playsInSilentMode: true,
|
||||
allowsRecording: false,
|
||||
interruptionMode: "duckOthers",
|
||||
interruptionModeAndroid: "duckOthers",
|
||||
});
|
||||
}
|
||||
if (signal.aborted) throw new Error("Playback stopped");
|
||||
// AVPlayer needs a file extension to recognize local encoded audio on iOS.
|
||||
const extension =
|
||||
{
|
||||
"audio/wav": "wav",
|
||||
"audio/x-wav": "wav",
|
||||
"audio/wave": "wav",
|
||||
"audio/mpeg": "mp3",
|
||||
"audio/mp3": "mp3",
|
||||
"audio/mp4": "m4a",
|
||||
"audio/aac": "aac",
|
||||
"audio/ogg": "ogg",
|
||||
"audio/flac": "flac",
|
||||
}[audio.type.split(";")[0].trim()] ?? "audio";
|
||||
const file = new File(Paths.cache, `paseo-audio-${Date.now()}-${nextFileId++}.${extension}`);
|
||||
try {
|
||||
file.write(bytes);
|
||||
const player = createAudioPlayer(file.uri, {
|
||||
updateInterval: 100,
|
||||
keepAudioSessionActive: refs.captureActive,
|
||||
});
|
||||
return await playFile(player, signal);
|
||||
} finally {
|
||||
if (file.exists) file.delete();
|
||||
}
|
||||
}
|
||||
const playback = createPlaybackQueue(playAudio, releaseSessionIfIdle);
|
||||
|
||||
return {
|
||||
async initialize() {
|
||||
await ensureInitialized();
|
||||
},
|
||||
|
||||
async destroy() {
|
||||
if (refs.destroyed) {
|
||||
return;
|
||||
}
|
||||
refs.destroyed = true;
|
||||
playback.destroy();
|
||||
if (refs.captureActive) {
|
||||
native.toggleRecording(false);
|
||||
refs.captureActive = false;
|
||||
}
|
||||
refs.muted = false;
|
||||
callbacks.onVolumeLevel(0);
|
||||
if (refs.initialized) {
|
||||
native.tearDown();
|
||||
refs.initialized = false;
|
||||
}
|
||||
microphoneSubscription.remove();
|
||||
volumeSubscription.remove();
|
||||
interruptionSubscription.remove();
|
||||
},
|
||||
|
||||
async startCapture() {
|
||||
if (refs.captureActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await ensureMicrophonePermission();
|
||||
await ensureInitialized();
|
||||
const isRecording =
|
||||
options?.captureMode === "dictation"
|
||||
? native.startDictation()
|
||||
: native.toggleRecording(true);
|
||||
if (!isRecording) {
|
||||
throw new Error(
|
||||
"Microphone capture could not start because Android audio focus is unavailable.",
|
||||
);
|
||||
}
|
||||
refs.captureActive = true;
|
||||
} catch (error) {
|
||||
const wrapped = error instanceof Error ? error : new Error(String(error));
|
||||
callbacks.onError?.(wrapped);
|
||||
throw wrapped;
|
||||
}
|
||||
},
|
||||
|
||||
async stopCapture() {
|
||||
if (refs.captureActive) {
|
||||
native.toggleRecording(false);
|
||||
}
|
||||
refs.captureActive = false;
|
||||
refs.muted = false;
|
||||
callbacks.onVolumeLevel(0);
|
||||
callbacks.onCaptureAvailabilityChange?.(true);
|
||||
releaseSessionIfIdle();
|
||||
},
|
||||
|
||||
toggleMute() {
|
||||
refs.muted = !refs.muted;
|
||||
if (refs.muted) {
|
||||
callbacks.onVolumeLevel(0);
|
||||
}
|
||||
return refs.muted;
|
||||
},
|
||||
|
||||
isMuted() {
|
||||
return refs.muted;
|
||||
},
|
||||
|
||||
play: playback.play,
|
||||
stop: playback.stop,
|
||||
clearQueue: playback.clearQueue,
|
||||
isPlaying: playback.isPlaying,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -292,7 +292,9 @@ export function createAudioEngine(
|
||||
refs.gain = gain;
|
||||
} catch (error) {
|
||||
await stopCapture();
|
||||
throw error;
|
||||
const wrapped = error instanceof Error ? error : new Error(String(error));
|
||||
callbacks.onError?.(wrapped);
|
||||
throw wrapped;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user