mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-26 18:25:31 +00:00
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
713b6dbbfe | ||
|
|
32c3805aad | ||
|
|
d46038ee4b | ||
|
|
be6b5eb169 | ||
|
|
c0903be174 | ||
|
|
5238bfb641 | ||
|
|
90c8446fb8 | ||
|
|
717e75d032 | ||
|
|
62cdc2f2cf | ||
|
|
eaef730f1e | ||
|
|
f0bf09efee | ||
|
|
ad068bd21d | ||
|
|
25666d9172 | ||
|
|
6c237aabf1 | ||
|
|
22baf9e344 |
@@ -342,6 +342,8 @@ jobs:
|
||||
run: |
|
||||
npm run test:unit --workspace=@getpaseo/server -- \
|
||||
src/server/file-observer \
|
||||
src/server/workspace-reconciliation-observation.test.ts \
|
||||
src/utils/checkout-git-identity.test.ts \
|
||||
src/server/workspace-git-service.observation.test.ts \
|
||||
src/server/workspace-git-service.observation.integration.test.ts \
|
||||
--bail=1
|
||||
|
||||
@@ -38,9 +38,9 @@ on:
|
||||
- "true"
|
||||
- "false"
|
||||
rollout_hours:
|
||||
description: "Linear rollout duration in hours. Use 0 for instant rollout."
|
||||
description: "Rollout duration in hours: a 5% canary hold, then a ramp to 100%. Use 0 to admit everyone at once."
|
||||
required: false
|
||||
default: "36"
|
||||
default: "18"
|
||||
type: string
|
||||
|
||||
concurrency:
|
||||
@@ -51,7 +51,7 @@ env:
|
||||
SOURCE_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }}
|
||||
CHECKOUT_REF: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.checkout_ref || github.ref_name) || github.ref_name }}
|
||||
SHOULD_PUBLISH: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.publish != 'false' }}
|
||||
ROLLOUT_HOURS: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.rollout_hours || '36' }}
|
||||
ROLLOUT_HOURS: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.rollout_hours || '18' }}
|
||||
DESKTOP_PACKAGE_PATH: "packages/desktop"
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -1,5 +1,71 @@
|
||||
# Changelog
|
||||
|
||||
## 0.17.5 - 2026-11-26
|
||||
|
||||
- **Archive workspaces together:** Cmd/Ctrl+click a workspace in the sidebar to select multiple workspaces and archive them in one step. ([#10798](https://github.com/getpaseo/paseo/pull/10798), [#10821](https://github.com/getpaseo/paseo/pull/10821))
|
||||
- **Copy quoted drafts:** Copy a quote from a reply with one tap, without the `>` markers. ([#10608](https://github.com/getpaseo/paseo/pull/10608) by [@pedrovieira](https://github.com/pedrovieira), [@dinhphieu](https://github.com/dinhphieu))
|
||||
- **Redesigned agent profiles page:** Agent profiles have their own dedicated settings page, and the model picker saves a new profile in one tap. ([#10789](https://github.com/getpaseo/paseo/pull/10789), [#10824](https://github.com/getpaseo/paseo/pull/10824))
|
||||
- **Redesigned Add project:** Add project opens on folder search, with Clone and New folder one tab away. ([#10767](https://github.com/getpaseo/paseo/pull/10767))
|
||||
- **Choose how Desktop updates:** Desktop can download updates automatically, only notify you, or never check. ([#10785](https://github.com/getpaseo/paseo/pull/10785))
|
||||
- **First-class Tailscale support:** Turn on Tailscale for a host from its settings or from setup, without editing its configuration. ([#10801](https://github.com/getpaseo/paseo/pull/10801))
|
||||
|
||||
### Added
|
||||
|
||||
- Added host icons, connection types, and latency to the host picker ([#10702](https://github.com/getpaseo/paseo/pull/10702) by [@artile](https://github.com/artile))
|
||||
- Added agent profiles to model picker search and the Command Center ([#10774](https://github.com/getpaseo/paseo/pull/10774))
|
||||
- Added Archive on finish to `paseo schedule create`, `paseo schedule update`, and the schedule MCP tools ([#8479](https://github.com/getpaseo/paseo/pull/8479) by [@ArnoldHueteG](https://github.com/ArnoldHueteG))
|
||||
- Added newer Factory Droid models by updating its catalog entry to Droid 1.20.0 ([#10779](https://github.com/getpaseo/paseo/pull/10779) by [@dsingal0](https://github.com/dsingal0))
|
||||
|
||||
### Changed
|
||||
|
||||
- Changed automatic stable Desktop updates to check at most every 6 hours and to wait 24 hours after each update ([#10882](https://github.com/getpaseo/paseo/pull/10882), [#10901](https://github.com/getpaseo/paseo/pull/10901))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed agents hiding the subagents they create from tabs and the subagent track ([#10887](https://github.com/getpaseo/paseo/pull/10887))
|
||||
- Fixed parent agents getting a Claude subagent's interim reply instead of its final reply when the subagent waits on background work ([#10864](https://github.com/getpaseo/paseo/pull/10864))
|
||||
- Fixed agents that watch a pull request staying in Running after their turn ends ([#10740](https://github.com/getpaseo/paseo/pull/10740) by [@drgould](https://github.com/drgould))
|
||||
- Fixed the Changes pane offering no Push or Pull when the remote is not named `origin` ([#10679](https://github.com/getpaseo/paseo/pull/10679))
|
||||
- Fixed a pane switching to the wrong tab after you split or move its active tab out ([#10716](https://github.com/getpaseo/paseo/pull/10716))
|
||||
- Fixed New workspace leaving focus on the project button after you choose a project ([#10632](https://github.com/getpaseo/paseo/pull/10632))
|
||||
- Fixed archived chats staying in memory until the window reloads ([#10866](https://github.com/getpaseo/paseo/pull/10866))
|
||||
- Fixed hover cards and other overlays slowing down in long app sessions ([#10778](https://github.com/getpaseo/paseo/pull/10778) by [@maci0](https://github.com/maci0))
|
||||
- Fixed Desktop freezing when you open a chat whose last turn has hundreds of tool calls ([#8661](https://github.com/getpaseo/paseo/pull/8661) by [@luoph](https://github.com/luoph))
|
||||
- Fixed direct connections dropping on slow links while a large timeline loads ([#10651](https://github.com/getpaseo/paseo/pull/10651) by [@apple-ouyang](https://github.com/apple-ouyang))
|
||||
- Fixed large Git workspaces stalling the daemon while their file watchers scan ([#10788](https://github.com/getpaseo/paseo/pull/10788), [#10602](https://github.com/getpaseo/paseo/pull/10602))
|
||||
- Fixed a Git change in one repository rescanning every checkout ([#10863](https://github.com/getpaseo/paseo/pull/10863) by [@viiqswim](https://github.com/viiqswim))
|
||||
- Fixed iOS chats staying blank when a pending question is taller than the screen ([#10759](https://github.com/getpaseo/paseo/pull/10759))
|
||||
- Fixed Android long-press text selection in chat leaving the magnifier stuck on screen ([#10844](https://github.com/getpaseo/paseo/pull/10844))
|
||||
- Fixed mobile sheet footers dropping behind the system bar when the keyboard closes ([#10827](https://github.com/getpaseo/paseo/pull/10827))
|
||||
- Fixed the sidebar toggle covering plugin screen titles on macOS ([#10773](https://github.com/getpaseo/paseo/pull/10773))
|
||||
- Fixed Windows file links with a slash before the drive letter failing to open ([#7711](https://github.com/getpaseo/paseo/pull/7711))
|
||||
- Fixed Import Session giving up on slow providers and hiding provider errors ([#10516](https://github.com/getpaseo/paseo/pull/10516) by [@chirag127](https://github.com/chirag127), [@derek-geekdive](https://github.com/derek-geekdive))
|
||||
- Fixed OMP 19.1 `ask` questions not showing a question card ([#10862](https://github.com/getpaseo/paseo/pull/10862) by [@gtoxlili](https://github.com/gtoxlili))
|
||||
- Fixed OpenCode 2 agents with their own MCP servers failing when a shared OpenCode server is running. Requires OpenCode 2.0.29 or later ([#10752](https://github.com/getpaseo/paseo/pull/10752))
|
||||
- Fixed deleted OpenCode subagents staying in the subagent track ([#8332](https://github.com/getpaseo/paseo/pull/8332))
|
||||
- Fixed stopped Claude background subagents showing as running after you reopen the parent ([#9013](https://github.com/getpaseo/paseo/pull/9013))
|
||||
- Fixed plugin and Paseo instructions replacing a Codex agent's own `developer_instructions` ([#10792](https://github.com/getpaseo/paseo/pull/10792))
|
||||
- Fixed the OpenCode Go usage card missing when the Go key is in OpenCode's `auth.json` ([#10678](https://github.com/getpaseo/paseo/pull/10678))
|
||||
- Fixed GitHub, GitLab, and Gitea commands on Windows breaking multiline arguments and expanding `%VAR%` text ([#10685](https://github.com/getpaseo/paseo/pull/10685))
|
||||
- Fixed `paseo hub login` printing a link without the code ([#10751](https://github.com/getpaseo/paseo/pull/10751))
|
||||
- Fixed Hub trigger runs failing on Antigravity and other plugin providers without tool policy support ([#10889](https://github.com/getpaseo/paseo/pull/10889))
|
||||
- Fixed Hub sessions being refused when they read a daemon's provider controls ([#10794](https://github.com/getpaseo/paseo/pull/10794))
|
||||
- Fixed Hermes and other plugin ACP providers leaving processes running after a model list refresh times out ([#10867](https://github.com/getpaseo/paseo/pull/10867))
|
||||
- Fixed a plugin's agent tools returning `Tool not found` after the plugin reloads during a turn ([#10106](https://github.com/getpaseo/paseo/pull/10106) by [@tomgrin10](https://github.com/tomgrin10))
|
||||
- Fixed replies changed by a timeline plugin losing Copy, Fork, and turn duration ([#10795](https://github.com/getpaseo/paseo/pull/10795) by [@Brandon168](https://github.com/Brandon168))
|
||||
- Fixed idle plugin sessions waking the daemon every 10 seconds ([#9363](https://github.com/getpaseo/paseo/pull/9363) by [@Brandon168](https://github.com/Brandon168))
|
||||
|
||||
### Security
|
||||
|
||||
- Changed Claude Code 2.1.326 or later to receive MCP server tokens over stdin instead of in process arguments that other local users can read ([#10698](https://github.com/getpaseo/paseo/pull/10698) by [@mdbraber](https://github.com/mdbraber))
|
||||
- Fixed repository teardown commands running on archive for pull request worktrees whose setup you have not approved ([#10694](https://github.com/getpaseo/paseo/pull/10694))
|
||||
|
||||
### Plugins
|
||||
|
||||
- Added launch wraps so plugins can run agents, terminals, and worktree commands inside a sandbox ([#10786](https://github.com/getpaseo/paseo/pull/10786) by [@clkao](https://github.com/clkao), [@bendavid](https://github.com/bendavid))
|
||||
- Added the parent workspace to plugin workspace snapshots ([#10781](https://github.com/getpaseo/paseo/pull/10781) by [@spatenotte](https://github.com/spatenotte))
|
||||
- Updated the bundled `paseo-plugin` skill to the current plugin API ([#10793](https://github.com/getpaseo/paseo/pull/10793))
|
||||
|
||||
## 0.17.4 - 2026-11-23
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -1,5 +1,71 @@
|
||||
# Changelog
|
||||
|
||||
## 0.17.5 - 2026-11-26
|
||||
|
||||
- **批量归档工作区**:在侧边栏按住 Cmd/Ctrl 点击工作区即可多选,一步归档。([#10798](https://github.com/getpaseo/paseo/pull/10798), [#10821](https://github.com/getpaseo/paseo/pull/10821))
|
||||
- **复制引用草稿**:一键复制回复中的引用内容,不带 `>` 标记。([#10608](https://github.com/getpaseo/paseo/pull/10608),贡献者:[@pedrovieira](https://github.com/pedrovieira), [@dinhphieu](https://github.com/dinhphieu))
|
||||
- **重新设计的智能体配置文件页面**:智能体配置文件现在有专属的设置页面,模型选择器一键即可保存新的配置文件。([#10789](https://github.com/getpaseo/paseo/pull/10789), [#10824](https://github.com/getpaseo/paseo/pull/10824))
|
||||
- **重新设计的添加 project**:“添加 project”直接打开文件夹搜索,克隆和新建文件夹只需切换一个标签页。([#10767](https://github.com/getpaseo/paseo/pull/10767))
|
||||
- **选择桌面端的更新方式**:桌面端可以自动下载更新、仅通知你,或完全不检查。([#10785](https://github.com/getpaseo/paseo/pull/10785))
|
||||
- **全面支持 Tailscale**:在主机设置或初始设置中为主机开启 Tailscale,无需编辑配置。([#10801](https://github.com/getpaseo/paseo/pull/10801))
|
||||
|
||||
### 新增
|
||||
|
||||
- 在主机选择器中新增主机图标、连接类型和延迟 ([#10702](https://github.com/getpaseo/paseo/pull/10702),贡献者:[@artile](https://github.com/artile))
|
||||
- 在模型选择器搜索和命令中心中新增智能体配置文件 ([#10774](https://github.com/getpaseo/paseo/pull/10774))
|
||||
- 为 `paseo schedule create`、`paseo schedule update` 和定时任务 MCP 工具新增“完成后归档”选项 ([#8479](https://github.com/getpaseo/paseo/pull/8479),贡献者:[@ArnoldHueteG](https://github.com/ArnoldHueteG))
|
||||
- 将 Factory Droid 的目录条目更新到 Droid 1.20.0,新增其较新的模型 ([#10779](https://github.com/getpaseo/paseo/pull/10779),贡献者:[@dsingal0](https://github.com/dsingal0))
|
||||
|
||||
### 变更
|
||||
|
||||
- 桌面端稳定版的自动更新改为最多每 6 小时检查一次,每次更新后等待 24 小时 ([#10882](https://github.com/getpaseo/paseo/pull/10882), [#10901](https://github.com/getpaseo/paseo/pull/10901))
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复 Agent 将自己创建的子 Agent 从标签页和子 Agent 列表中隐藏的问题 ([#10887](https://github.com/getpaseo/paseo/pull/10887))
|
||||
- 修复 Claude 子 Agent 等待后台任务时,父 Agent 收到的是中间回复而不是最终回复的问题 ([#10864](https://github.com/getpaseo/paseo/pull/10864))
|
||||
- 修复监视 PR 的 Agent 在轮次结束后仍显示为运行中的问题 ([#10740](https://github.com/getpaseo/paseo/pull/10740),贡献者:[@drgould](https://github.com/drgould))
|
||||
- 修复远程名称不是 `origin` 时“变更”面板不显示推送或拉取的问题 ([#10679](https://github.com/getpaseo/paseo/pull/10679))
|
||||
- 修复拆分窗格或移出当前标签后,原窗格切换到错误标签的问题 ([#10716](https://github.com/getpaseo/paseo/pull/10716))
|
||||
- 修复在“新建工作区”中选择 project 后,焦点停留在 project 按钮上的问题 ([#10632](https://github.com/getpaseo/paseo/pull/10632))
|
||||
- 修复已归档的对话在窗口重新加载前一直占用内存的问题 ([#10866](https://github.com/getpaseo/paseo/pull/10866))
|
||||
- 修复应用长时间运行后悬停卡片等浮层变慢的问题 ([#10778](https://github.com/getpaseo/paseo/pull/10778),贡献者:[@maci0](https://github.com/maci0))
|
||||
- 修复打开最后一轮包含数百次工具调用的对话时桌面端卡顿的问题 ([#8661](https://github.com/getpaseo/paseo/pull/8661),贡献者:[@luoph](https://github.com/luoph))
|
||||
- 修复在慢速网络上加载大型时间线时直接连接断开的问题 ([#10651](https://github.com/getpaseo/paseo/pull/10651),贡献者:[@apple-ouyang](https://github.com/apple-ouyang))
|
||||
- 修复大型 Git 工作区在文件监视器扫描时阻塞 daemon 的问题 ([#10788](https://github.com/getpaseo/paseo/pull/10788), [#10602](https://github.com/getpaseo/paseo/pull/10602))
|
||||
- 修复一个仓库中的 Git 变更导致所有检出重新扫描的问题 ([#10863](https://github.com/getpaseo/paseo/pull/10863),贡献者:[@viiqswim](https://github.com/viiqswim))
|
||||
- 修复待回答问题高于屏幕时 iOS 对话一直空白的问题 ([#10759](https://github.com/getpaseo/paseo/pull/10759))
|
||||
- 修复 Android 上在对话中长按选择文本后放大镜卡在屏幕上的问题 ([#10844](https://github.com/getpaseo/paseo/pull/10844))
|
||||
- 修复移动端弹窗底部栏在键盘收起时落到系统栏后面的问题 ([#10827](https://github.com/getpaseo/paseo/pull/10827))
|
||||
- 修复 macOS 上侧边栏切换按钮遮挡插件页面标题的问题 ([#10773](https://github.com/getpaseo/paseo/pull/10773))
|
||||
- 修复 Windows 上盘符前带斜杠的文件链接无法打开的问题 ([#7711](https://github.com/getpaseo/paseo/pull/7711))
|
||||
- 修复导入会话在 Provider 响应慢时提前放弃并隐藏 Provider 错误的问题 ([#10516](https://github.com/getpaseo/paseo/pull/10516),贡献者:[@chirag127](https://github.com/chirag127), [@derek-geekdive](https://github.com/derek-geekdive))
|
||||
- 修复 OMP 19.1 的 `ask` 问题不显示问题卡片的问题 ([#10862](https://github.com/getpaseo/paseo/pull/10862),贡献者:[@gtoxlili](https://github.com/gtoxlili))
|
||||
- 修复共享 OpenCode 服务器运行时,带有自己 MCP 服务器的 OpenCode 2 Agent 启动失败的问题。需要 OpenCode 2.0.29 或更高版本 ([#10752](https://github.com/getpaseo/paseo/pull/10752))
|
||||
- 修复已删除的 OpenCode 子 Agent 一直留在子 Agent 列表中的问题 ([#8332](https://github.com/getpaseo/paseo/pull/8332))
|
||||
- 修复重新打开父 Agent 后,已停止的 Claude 后台子 Agent 显示为运行中的问题 ([#9013](https://github.com/getpaseo/paseo/pull/9013))
|
||||
- 修复插件和 Paseo 的指令替换 Codex Agent 自身 `developer_instructions` 的问题 ([#10792](https://github.com/getpaseo/paseo/pull/10792))
|
||||
- 修复 Go 密钥保存在 OpenCode 的 `auth.json` 中时 OpenCode Go 用量卡片消失的问题 ([#10678](https://github.com/getpaseo/paseo/pull/10678))
|
||||
- 修复 Windows 上 GitHub、GitLab 和 Gitea 命令破坏多行参数并展开 `%VAR%` 文本的问题 ([#10685](https://github.com/getpaseo/paseo/pull/10685))
|
||||
- 修复 `paseo hub login` 输出的链接不包含验证码的问题 ([#10751](https://github.com/getpaseo/paseo/pull/10751))
|
||||
- 修复 Hub 触发器在 Antigravity 等不支持工具策略的插件 Provider 上运行失败的问题 ([#10889](https://github.com/getpaseo/paseo/pull/10889))
|
||||
- 修复 Hub 会话读取 daemon 的 Provider 控件时被拒绝的问题 ([#10794](https://github.com/getpaseo/paseo/pull/10794))
|
||||
- 修复模型列表刷新超时后,Hermes 等插件 ACP Provider 留下进程继续运行的问题 ([#10867](https://github.com/getpaseo/paseo/pull/10867))
|
||||
- 修复插件在轮次进行中重新加载后,其 Agent 工具返回 `Tool not found` 的问题 ([#10106](https://github.com/getpaseo/paseo/pull/10106),贡献者:[@tomgrin10](https://github.com/tomgrin10))
|
||||
- 修复被时间线插件改写的回复缺少复制、分叉和轮次耗时的问题 ([#10795](https://github.com/getpaseo/paseo/pull/10795),贡献者:[@Brandon168](https://github.com/Brandon168))
|
||||
- 修复空闲的插件会话每 10 秒唤醒一次 daemon 的问题 ([#9363](https://github.com/getpaseo/paseo/pull/9363),贡献者:[@Brandon168](https://github.com/Brandon168))
|
||||
|
||||
### 安全
|
||||
|
||||
- Claude Code 2.1.326 或更高版本现在通过 stdin 接收 MCP 服务器令牌,不再放在其他本地用户可读取的进程参数中 ([#10698](https://github.com/getpaseo/paseo/pull/10698),贡献者:[@mdbraber](https://github.com/mdbraber))
|
||||
- 修复归档未批准设置的 PR worktree 时仍运行仓库 teardown 命令的问题 ([#10694](https://github.com/getpaseo/paseo/pull/10694))
|
||||
|
||||
### 插件
|
||||
|
||||
- 新增启动包装,插件可以在沙箱中运行 Agent、终端和 worktree 命令 ([#10786](https://github.com/getpaseo/paseo/pull/10786),贡献者:[@clkao](https://github.com/clkao), [@bendavid](https://github.com/bendavid))
|
||||
- 在插件的工作区快照中新增父工作区 ([#10781](https://github.com/getpaseo/paseo/pull/10781),贡献者:[@spatenotte](https://github.com/spatenotte))
|
||||
- 将内置的 `paseo-plugin` 技能更新到当前的插件 API ([#10793](https://github.com/getpaseo/paseo/pull/10793))
|
||||
|
||||
## 0.17.4 - 2026-11-23
|
||||
|
||||
### 修复
|
||||
|
||||
@@ -55,7 +55,6 @@ At the start of non-trivial work, list `docs/` and skim anything relevant to the
|
||||
| [docs/permissions.md](docs/permissions.md) | Semantic daemon permissions, principals, credentials, pairing invitations, and Hub authority |
|
||||
| [docs/terminal-performance.md](docs/terminal-performance.md) | Terminal latency pipeline, coalescing/backpressure invariants, benchmark + perf spec usage |
|
||||
| [docs/terminal-rendering.md](docs/terminal-rendering.md) | Native terminal view: xterm owns the grid, cluster placement, emoji widths, mixed-direction limits, render regression |
|
||||
| [docs/timeline-sync.md](docs/timeline-sync.md) | Owned agent history, rewind retirements, live stream vs authoritative fetch, paged catch-up, client replica |
|
||||
| [docs/agent-stream-performance.md](docs/agent-stream-performance.md) | Assistant text pipeline — coalescing window, paced reveal, why arrival lumps are smoothed at render |
|
||||
| [docs/agent-stream-disclosure.md](docs/agent-stream-disclosure.md) | Expand/collapse in the chat timeline — hold contract, native anchor sequence, frame spacing, render-window cost |
|
||||
| [docs/markdown-renderer.md](docs/markdown-renderer.md) | Shared Markdown engine, the vendored library fork, native selection, links, images and library constraints |
|
||||
|
||||
+16
-7
@@ -39,8 +39,8 @@ An unarchived agent may be `closed` without being deleted or archived. Closing r
|
||||
processes and subscriptions while retaining its Paseo identity, persistence handle, timeline,
|
||||
workspace, labels, title, usage, attention, timestamps, and parent relationship. Opening or prompting
|
||||
the agent runs through `ensureAgentLoaded()`, which resumes the durable provider session under the
|
||||
same Paseo agent ID. Resume does not read provider history when the agent already has a timeline;
|
||||
see [owned history](timeline-sync.md#owned-history).
|
||||
same Paseo agent ID. Provider history is not appended again when the canonical timeline is already
|
||||
primed.
|
||||
|
||||
Reload releases the old runtime before resuming its durable session: an idle provider process can
|
||||
still own an exclusive writer. A close failure retains that runtime for cleanup and blocks the
|
||||
@@ -183,7 +183,7 @@ caller, child, and host into one watch.
|
||||
|
||||
Bootstrap restores these watches after repairing stale running records to `closed` and before opening
|
||||
ingress. Reading a closed child's result does not load its provider. A finish notification reports that
|
||||
the child's run has settled; the parent decides whether its task is complete. A child chosen for restart
|
||||
the child has settled (see below); the parent decides whether its task is complete. A child chosen for restart
|
||||
recovery is observed only after its resume was sent, so the parent never hears that it was closed
|
||||
in between. Archived or deleted parents suppress delivery;
|
||||
parent-owned creation watches also stop
|
||||
@@ -196,6 +196,18 @@ outstanding intent. A crash after successful dispatch but before removal commits
|
||||
notification. Clean shutdown can also flush an already queued callback while retaining its intent,
|
||||
so that callback can repeat after restart. This is an at-least-once wakeup, without turn attribution or exactly-once delivery.
|
||||
|
||||
A turn end is not always a settled child. When the child ends its turn with work that will start its
|
||||
next turn by itself, the caller gets one `message` notice ("ended its turn but is still working") and
|
||||
the subscription keeps following the child. That work is a running turn, queued messages, a pending
|
||||
provider wake-up (`AgentSession.hasPendingWakeup`: Claude background tasks, task notifications, and
|
||||
one-shot wake-ups), or the child's own outstanding finish subscriptions as a caller. Heartbeats,
|
||||
recurring crons, change-request watches, and other daemon background items never count: they are
|
||||
external triggers, not work the caller is waiting for. While following, turn ends and work changes stay
|
||||
silent until nothing is pending, which sends `finished` and removes the subscription. `followingSince`
|
||||
is stored before the notice is sent, so restarts resume following without repeating it, and following
|
||||
ends after 24 hours with an "is still working" notice. Remote children and providers without the probe
|
||||
report their first turn end as `finished`.
|
||||
|
||||
Permission requests are notification checkpoints, not the end of that subscription. The caller is notified again after a permission response when the child finishes, errors, or requests another permission.
|
||||
The permission notification includes the normalized request plus the child and request IDs, so the caller can inspect it and respond without fetching agent status.
|
||||
A watched child that closes before its finish event also notifies the caller so delegated work cannot disappear silently during archive or workspace teardown.
|
||||
@@ -256,8 +268,7 @@ lifecycle is separate from public workspace visibility and is not a public creat
|
||||
Archive is a **soft delete**: the agent record stays on disk with `archivedAt` set, the runtime is closed, and the agent disappears from active lists. Archive is **global** — it lives on the server and propagates to every connected client.
|
||||
|
||||
Archive sets `archivedAt`, invokes the provider's native archive hook, and cascades to managed
|
||||
children. The timeline and the provider children stay, so an archived chat reads them without its
|
||||
provider; deleting the agent removes them.
|
||||
children.
|
||||
|
||||
`create_agent_request` can opt an agent into `autoArchive`. In that mode the daemon archives the agent after the first terminal turn event (`turn_completed`, `turn_failed`, or `turn_canceled`). When the agent owns an isolated workspace, auto-archive archives that workspace too; the managed worktree is removed when its final workspace reference is gone.
|
||||
|
||||
@@ -353,8 +364,6 @@ Workspace status is an aggregate activity signal computed **per `workspaceId`**.
|
||||
|
||||
Running provider-native subagents contribute `running` to the workspace owned by their parent agent. Their completed, failed, and canceled states stay in the parent's subagents track.
|
||||
|
||||
Only the parent's current runtime makes a provider child running. A child's stored status is the last report about it, and that report can come from provider history or from a runtime an earlier daemon ran, so a stored `running` child does not make the workspace running or keep the parent's runtime alive. It counts again once the live session reports it running. Closing a runtime cancels the children that runtime reported running; children it never reported keep their stored status.
|
||||
|
||||
A finished or failed workspace can be marked unread after it has been reviewed. The daemon restores
|
||||
attention on its newest eligible workspace-root agent, `error` for an agent whose lifecycle is
|
||||
`error` and `finished` otherwise, without sending a new notification. Opening a workspace restores
|
||||
|
||||
@@ -94,7 +94,6 @@ workspace for a directory clears it. The store lives in memory and resets on dae
|
||||
| `server/directory-sync/` | Daemon-global latest-state sequences for projects, workspaces, and agents |
|
||||
| `server/workspace-labels/` | Host-local label catalog, assignment mutations, and explicit subscriptions |
|
||||
| `server/agent/agent-manager.ts` | Agent lifecycle state machine, timeline tracking, subscriber management |
|
||||
| `server/agent/timeline/` | Owned agent history, provider children, rewind retirements, behind a backend |
|
||||
| `server/agent/agent-storage.ts` | File-backed JSON persistence at `$PASEO_HOME/agents/` |
|
||||
| `server/agent/tools/` | Transport-neutral catalog for workspaces, agents, permissions, and automation |
|
||||
| `server/agent/mcp-server.ts` | Thin MCP adapter that registers the Paseo tool catalog with the MCP SDK |
|
||||
|
||||
@@ -181,14 +181,6 @@ Terminal activity contributes to the workspace status bucket **per `workspaceId`
|
||||
|
||||
---
|
||||
|
||||
## Runtime-only Agent Timelines
|
||||
|
||||
Agent timelines are not written to `$PASEO_HOME`. `AgentTimeline` owns each agent's history behind
|
||||
a backend, and the only backend is in memory, so a daemon restart loses it and the next resume
|
||||
imports provider history. See [owned history](timeline-sync.md#owned-history).
|
||||
|
||||
---
|
||||
|
||||
## 2. Daemon Configuration
|
||||
|
||||
**Path:** `$PASEO_HOME/config.json`
|
||||
|
||||
@@ -10,6 +10,7 @@ Authoritative terminology. UI label wins. Don't invent synonyms; use what's here
|
||||
- **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).
|
||||
- **Device** — A computer or phone running a Paseo client. Open **Devices** in a host’s settings to connect another device.
|
||||
- **Host badge** — The item on a sidebar workspace row's meta row naming which host that workspace lives on. Three things gate it, and they compose as a lattice rather than competing: the sidebar must span more than one host (automatic), **Show → Host** in the sidebar's display preferences must be on (global, all hosts at once), and then that host's own display mode decides _how_ it draws — **Name** / **Icon only** / **Hidden**. Name, color, and display mode are per-host, per-device, and live client-side on `HostProfile.appearance`; nothing about it reaches the daemon. Never add a fourth way to hide it. UI: the "Appearance" group on a host's settings page, and the "Show" submenu in the sidebar's display preferences. Code: `selectHostBadges` (`packages/app/src/hosts/appearance.ts`) takes the first two as its `enabled` input; `WorkspaceMetaRow` (`packages/app/src/components/sidebar/workspace-meta-row/index.tsx`) draws it. Don't confuse with **Status pill**, which reports state rather than identity.
|
||||
- **Project host entry** — One row in a project for a single (project, daemon) pair, aggregating that daemon's workspaces in the project. Internal. Code: `ProjectHostEntry` (`packages/app/src/utils/projects.ts:11`). Don't introduce "Checkout" as a synonym.
|
||||
- **Placement** — One workspace's stable foreign-key relationship to its project plus its git checkout snapshot. Internal. An explicit creation `projectId` is authoritative when active.
|
||||
|
||||
+4
-1
@@ -225,7 +225,10 @@ aborts the shared refresh signal at the deadline, and when it stops. Shutdown wa
|
||||
probes to settle before it shuts down provider clients, so a probe cannot start provider work,
|
||||
such as an OpenCode server, after its client has cleaned up. Providers name active catalog operations and
|
||||
finish subprocess, server, or session cleanup before rejecting. Timeout errors list the operations
|
||||
that were still active when the deadline expired.
|
||||
that were still active when the deadline expired. A plugin provider's connection is shared with its
|
||||
running sessions, so the bridge cannot close it at the deadline; it sends `request.cancel` for the
|
||||
abandoned request instead, and the provider stops that request's work
|
||||
([provider guide](../public-docs/plugins/providers.md#stop-a-request-paseo-cancels)).
|
||||
|
||||
Catalogue results stay cached by identity until a refresh or a change to that provider's configuration.
|
||||
Providers change their model lists on the server without a CLI update, so the daemon refreshes
|
||||
|
||||
+93
-31
@@ -48,7 +48,7 @@ the shipped source.
|
||||
The user decides when the changes on `main` warrant a release and how much risk it takes:
|
||||
|
||||
1. **Direct stable release** for a low-risk batch of polish and bug fixes. Stable desktop updates
|
||||
already ramp over 36 hours (see [Staged rollout](#staged-rollout-stable-channel)), and store
|
||||
start with a 5% canary and ramp over 18 hours (see [Staged rollout](#staged-rollout-stable-channel)), and store
|
||||
review often takes about a day, with no guaranteed timing.
|
||||
2. **Beta flow**, the default for changes that need testing. Release candidates on the `beta`
|
||||
channel. Each beta folds into the series' single changelog entry, publishes npm only on the
|
||||
@@ -324,11 +324,33 @@ Use the beta path when you need to:
|
||||
|
||||
## Staged rollout (stable channel)
|
||||
|
||||
Stable desktop releases go out via a linear time-based rollout for automatic update checks: 0% admitted when the updater manifests appear, 100% admitted 36 hours later, linear ramp in between. Manual checks bypass the rollout so a user can install immediately when they click **Check**. Beta releases bypass the rollout entirely — beta users always receive updates immediately.
|
||||
A stable desktop release reaches automatic updates in stages, so a bad release reaches few installs before you stop it. Each install decides locally from two fields in the release manifests, `releaseDate` and `rolloutHours`. No server tracks installs.
|
||||
|
||||
The rollout is driven by a `rolloutHours` field stamped into the GitHub Release manifests (`latest-mac.yml`, `latest-linux.yml`, `latest.yml`) by the `finalize-rollout` job in `desktop-release.yml`.
|
||||
| Stage | Rule |
|
||||
| -------------- | -------------------------------------------------------------------------------------------------------- |
|
||||
| Canary | For the first 8 hours, 5% of installs are admitted. |
|
||||
| Ramp | From 8 hours to `rolloutHours` (18 by default), admission rises in a straight line from 5% to 100%. |
|
||||
| Check interval | An install asks GitHub for the latest release at most once every 6 hours. |
|
||||
| Cooldown | After an install updates, it skips paced releases for 24 hours. |
|
||||
| Staged update | An install that holds a downloaded update keeps it and does not download the paced release that follows. |
|
||||
|
||||
Desktop release builds now publish in two phases:
|
||||
A paced release is a stable release with `rolloutHours` above 0. When `rolloutHours` is under 16, the canary hold is half of `rolloutHours`.
|
||||
|
||||
Every release places each install at a new position in the rollout, so the canary group changes with each release. With one or two releases per day, an install updates at most once every 24 hours and skips the releases in between.
|
||||
|
||||
These paths skip the stages:
|
||||
|
||||
- A manual check (**Check**) always asks GitHub and always offers the latest release.
|
||||
- A release with `rolloutHours: 0` is an emergency release. Every install takes it at its next check, during a cooldown too, and it replaces a staged update.
|
||||
- The beta channel has no stages. A beta install takes each release at its next check.
|
||||
|
||||
The **Notify** update mode follows the same stages and prompts instead of downloading. **Off** makes no automatic requests.
|
||||
|
||||
`packages/desktop/src/features/app-update-rollout.ts` owns the curve. `app-update-pacing.ts` owns the check interval and the cooldown, and `app-update-service.ts` owns the staged update.
|
||||
|
||||
### How a release is published
|
||||
|
||||
The `finalize-rollout` job in `desktop-release.yml` stamps `releaseDate` and `rolloutHours` into the GitHub Release manifests (`latest-mac.yml`, `latest-linux.yml`, `latest.yml`). Desktop release builds publish in two phases:
|
||||
|
||||
- The GitHub Release stays a draft while platform build jobs upload the installers/packages (`.dmg`, `.zip`, `.exe`, `.AppImage`, etc.).
|
||||
- The final job merges and stamps every channel manifest, uploads them with the final `releaseDate` and `rolloutHours`, then publishes the GitHub Release.
|
||||
@@ -338,20 +360,20 @@ Drafts do not appear in GitHub's releases feed. Updater clients continue to see
|
||||
### Default behavior
|
||||
|
||||
Follow the [standard stable release procedure](#standard-release-stable). The tag push starts
|
||||
the desktop release workflow, which sets a 36-hour rollout when it publishes the release.
|
||||
the desktop release workflow, which sets an 18-hour rollout when it publishes the release.
|
||||
|
||||
The `rollout_hours` input on `desktop-release.yml` is **only read on `workflow_dispatch`** — tag-push runs always default to 36. To get any other rollout duration on a fresh release, use the post-publish flip below.
|
||||
The `rollout_hours` input on `desktop-release.yml` is read only on `workflow_dispatch`. Tag-push runs always use 18. To get any other rollout duration on a fresh release, use the post-publish flip below.
|
||||
|
||||
### Instant-admit release (rollout_hours=0)
|
||||
### Emergency release (rollout_hours=0)
|
||||
|
||||
Follow the [standard stable release procedure](#standard-release-stable). Wait for Desktop
|
||||
Release to publish, then update the manifests to admit everyone immediately.
|
||||
Release to publish, then update the manifests to admit everyone at once.
|
||||
|
||||
```bash
|
||||
# 1. Wait for Desktop Release to publish the GitHub Release.
|
||||
gh run watch <desktop-release-run-id> --exit-status
|
||||
|
||||
# 2. Flip the published manifests to instant admit.
|
||||
# 2. Flip the published manifests to an emergency release.
|
||||
gh workflow run desktop-rollout.yml \
|
||||
-f tag=v0.1.64 \
|
||||
-f rollout_hours=0
|
||||
@@ -359,23 +381,13 @@ gh workflow run desktop-rollout.yml \
|
||||
|
||||
Dispatch only after `finalize-rollout` has published the release. Until then the release is a draft, and a draft has no tag: `desktop-rollout.yml` looks the release up by tag and fails with `release not found`. The concurrency group `desktop-rollout-<tag>` that the two workflows share orders them only once both are queued; it does not hold an early dispatch until the draft is published.
|
||||
|
||||
The first public manifests carry `rolloutHours=36` for the minutes between publish and the flip. The renderer polls every 30 minutes, so active stable users pick up the new manifest on their next check.
|
||||
The first public manifests carry `rolloutHours=18` for the minutes between publish and the flip. An install sees the flip at its next check, which is up to 6 hours after its previous one. In automatic mode it then downloads the release and installs it when the app quits.
|
||||
|
||||
### Adjusting an already-published release
|
||||
|
||||
To change the rollout duration on a release that's already shipped — e.g. flip a hotfix to instant admit, or slow a release down — use the dedicated `desktop-rollout.yml` workflow. It edits the manifests in place on the GitHub release without rebuilding anything. It only rewrites `rolloutHours`; `releaseDate` is preserved, so the rollout clock keeps ticking from the original publish time.
|
||||
To change the rollout duration on a release that already shipped, use the `desktop-rollout.yml` workflow. It edits the manifests in place on the GitHub release without rebuilding anything. It rewrites only `rolloutHours`. `releaseDate` is preserved, so the rollout clock keeps running from the original publish time.
|
||||
|
||||
**Hotfix (instant admit) on an already-shipped release:**
|
||||
|
||||
```bash
|
||||
gh workflow run desktop-rollout.yml \
|
||||
-f tag=v0.1.42 \
|
||||
-f rollout_hours=0
|
||||
```
|
||||
|
||||
`rollout_hours=0` admits 100% of stable users on their next update check (within ~30 min for active clients).
|
||||
|
||||
**Slow a rollout down** (e.g. extend total duration to 72h since the original release):
|
||||
To slow a rollout down, for example to 72 hours since the original release:
|
||||
|
||||
```bash
|
||||
gh workflow run desktop-rollout.yml \
|
||||
@@ -383,13 +395,59 @@ gh workflow run desktop-rollout.yml \
|
||||
-f rollout_hours=72
|
||||
```
|
||||
|
||||
`rollout_hours` is **total duration since the original release date**, not "extend by N more hours from now." If `v0.1.42` was published 2h ago and you set `rollout_hours=72`, the ramp finishes 70h from now.
|
||||
`rollout_hours` is the total duration since the original release date. If `v0.1.42` was published 2 hours ago and you set `rollout_hours=72`, the ramp finishes 70 hours from now.
|
||||
|
||||
A longer rollout does not stop a release. The canary group still updates. To stop a release, [halt it](#halt-a-release).
|
||||
|
||||
The dispatch is idempotent and shares the `desktop-rollout-<tag>` concurrency group with `desktop-release.yml`'s `finalize-rollout` job, so it serializes safely against an in-flight tag-push pipeline targeting the same release.
|
||||
|
||||
### Halt a release
|
||||
|
||||
Stable installs and the download page follow the release that GitHub marks as latest. To stop a release, mark the last good release as latest:
|
||||
|
||||
```bash
|
||||
# v0.1.41 is the last good release.
|
||||
gh release edit v0.1.41 --latest
|
||||
|
||||
# Prints v0.1.41 when the halt is in effect.
|
||||
gh api repos/getpaseo/paseo/releases/latest --jq .tag_name
|
||||
```
|
||||
|
||||
The halt applies to every stable install from its next check, including installs older than the staged rollout:
|
||||
|
||||
- An install that has not downloaded the halted release no longer sees it.
|
||||
- An install that downloaded it asks GitHub again before it installs at quit, and drops the download.
|
||||
- An install that already runs the halted release stays on it, because the app never downgrades. [Ship a fix](#fix-a-bad-release).
|
||||
|
||||
A halt does not reach the beta channel. Beta installs read the release list by date and still take the halted release.
|
||||
|
||||
To resume a halted release, run `gh release edit v0.1.42 --latest` with its tag.
|
||||
|
||||
### Fix a bad release
|
||||
|
||||
1. [Halt](#halt-a-release) the bad release.
|
||||
2. Ship the fix as the next patch with the [standard stable release procedure](#standard-release-stable).
|
||||
3. After Desktop Release publishes the fix, make sure that GitHub marks it as latest:
|
||||
|
||||
```bash
|
||||
gh api repos/getpaseo/paseo/releases/latest --jq .tag_name
|
||||
```
|
||||
|
||||
If the command prints another tag, run `gh release edit <fix-tag> --latest`.
|
||||
|
||||
4. Flip the fix to an [emergency release](#emergency-release-rollout_hours0):
|
||||
|
||||
```bash
|
||||
gh workflow run desktop-rollout.yml \
|
||||
-f tag=<fix-tag> \
|
||||
-f rollout_hours=0
|
||||
```
|
||||
|
||||
Do not leave the fix as a paced release. The installs that took the bad release are in their 24-hour cooldown and skip a paced release. An install that holds the bad release as a staged update, and did not check during the halt, keeps it when a paced release follows. An emergency release reaches both.
|
||||
|
||||
### Custom ramp on a manually-dispatched build
|
||||
|
||||
`desktop-release.yml` accepts `rollout_hours` only on `workflow_dispatch`, which is the path used to **rebuild an existing tag** (retry a failed release, force a rebuild on a different ref). When you go that route, you can stamp a non-default ramp directly:
|
||||
`desktop-release.yml` accepts `rollout_hours` only on `workflow_dispatch`, which is the path used to rebuild an existing tag (retry a failed release, force a rebuild on a different ref). On that path, you can stamp a different ramp directly:
|
||||
|
||||
```bash
|
||||
gh workflow run desktop-release.yml \
|
||||
@@ -397,14 +455,18 @@ gh workflow run desktop-release.yml \
|
||||
-f rollout_hours=6
|
||||
```
|
||||
|
||||
For a fresh release with a custom ramp, follow the [instant-admit procedure](#instant-admit-release-rollout_hours0)
|
||||
For a fresh release with a custom ramp, follow the [emergency release procedure](#emergency-release-rollout_hours0)
|
||||
and set `rollout_hours` to your chosen duration.
|
||||
|
||||
### Releasing during an active rollout
|
||||
|
||||
If you ship N+1 while N is still ramping, N+1 starts a fresh rollout from its own publish timestamp. N's rollout effectively ends — the newer manifest supersedes it. Rollout-aware clients revalidate the manifest for up to five seconds before installing a downloaded update on quit. If N+1 has replaced N but the client is not admitted to N+1 yet, it skips the downloaded N and waits rather than installing two updates in succession. If revalidation times out, the app exits without installing the cached update.
|
||||
If you ship N+1 while N is still ramping, N+1 starts a new rollout from its own publish time, and the rollout of N ends because installs no longer see its manifests.
|
||||
|
||||
If N+1 is a hotfix for a bug in N, dispatch `desktop-rollout.yml -f tag=v0.1.<N+1> -f rollout_hours=0` after N+1 publishes so the users who already got N reach the fix fast.
|
||||
An install that holds N as a staged update keeps N when N+1 is a paced release, and installs N when the app quits. It then waits out its cooldown before it takes a later paced release. The hold covers only paced patch releases that the install saw one after the other. If the install missed a release, it evaluates the newest release instead: it replaces N when it is admitted, and drops N when it is not.
|
||||
|
||||
A minor or major release always ends the hold. The version numbers do not show whether a fix shipped between `0.17.4` and `0.18.0`, so the install treats `0.18.0` as if it missed a release.
|
||||
|
||||
Before an install at quit, the app asks GitHub for the latest release for up to five seconds. If that check does not finish in time, the app exits without installing the staged update.
|
||||
|
||||
### macOS system floor
|
||||
|
||||
@@ -417,10 +479,10 @@ macOS 13 maps to Darwin 22. The two values use different version domains; do not
|
||||
|
||||
### Limitations
|
||||
|
||||
- **No pause / kill switch.** To stop new admissions, ship a superseding release. Clients revalidate on quit and will not install the superseded download, but a client that already completed installation cannot be recalled; ship a hotfix `+1` patch.
|
||||
- **No rollback.** `allowDowngrade = false`. Bad release = ship a hotfix.
|
||||
- **Bootstrap caveat.** Clients running a build older than the rollout feature ignore `rolloutHours` and admit immediately. Rollout protection only applies to clients running the rollout-aware version or later.
|
||||
- **Up to ~30 min automatic admission latency.** Renderer polls every 30 minutes, so a stable user may take up to that long to be evaluated against the rollout window. Clicking **Check** is manual and bypasses rollout admission.
|
||||
- A release cannot be recalled from an install that runs it. `allowDowngrade` is `false`. [Halt](#halt-a-release) the release to protect the other installs, then [ship a fix](#fix-a-bad-release).
|
||||
- An emergency release reaches a running install at its next check, up to 6 hours after its previous one. A manual check sees it at once.
|
||||
- Installs older than the canary and cooldown build have neither. They ramp in a straight line over `rolloutHours` and check every 30 minutes. Installs older than the staged rollout ignore `rolloutHours` and update at once.
|
||||
- The app window starts every automatic check. A release whose window does not load cannot update itself, and its users must download a new build from the website. Smoke the packaged app before you publish.
|
||||
|
||||
## Mobile builds (EAS)
|
||||
|
||||
|
||||
+28
-67
@@ -5,9 +5,15 @@ Agent chat delivery has two paths:
|
||||
1. **Live stream** — `agent_stream` WebSocket messages for immediacy. These may be delta-shaped lifecycle updates.
|
||||
2. **Authoritative history** — `fetch_agent_timeline_request` for correctness. This always returns full projected timeline items, never lifecycle deltas.
|
||||
|
||||
Pagination bounds each read, not total resident history. Streaming overhead must remain
|
||||
proportional to the retained transcript. Cumulative text snapshots must be released after their
|
||||
deltas have been consumed.
|
||||
The daemon retains projected items in memory. Each source event advances the stream sequence,
|
||||
then replaces the previous tool state or merges into the current text item. Intermediate payloads
|
||||
are never retained for history or catch-up. Provider history is the durable transcript authority
|
||||
and rebuilds the projection when an agent resumes.
|
||||
|
||||
Pagination bounds each read, not total resident history. Active and idle agents retain their
|
||||
projected transcript; archive releases it and later history reads rebuild it from the provider.
|
||||
Streaming overhead must remain proportional to the retained transcript. Cumulative text snapshots
|
||||
must be released after their deltas have been consumed.
|
||||
|
||||
The invariants are:
|
||||
|
||||
@@ -26,45 +32,6 @@ bounded item is used for runtime timeline rows and live stream events. Provider
|
||||
applies the same rule so reopening an agent cannot restore an oversized payload. Fetches apply it
|
||||
again to assistant and reasoning rows the projection merges from many chunks.
|
||||
|
||||
## Owned history
|
||||
|
||||
The daemon owns each agent's history in `AgentTimeline`
|
||||
(`packages/server/src/server/agent/timeline/`): one ordered history per agent, with each provider
|
||||
child's descriptor and history in a child scope of the same agent. Each source event advances the
|
||||
stream sequence, then replaces the previous tool state or merges into the current text item.
|
||||
Intermediate payloads are never retained for history or catch-up.
|
||||
|
||||
History is append-only: rewind, import, reload and archive never delete or rewrite a row. Only
|
||||
deleting the agent, or a provider removing one of its own children, deletes history.
|
||||
|
||||
- **Rewind** retires a range of rows. They leave the conversation and stay stored, in the same
|
||||
epoch. See [Rewind retires rows](#rewind-retires-rows).
|
||||
- **Provider history** is imported only into an agent that has no history. After that, resume
|
||||
does not read it. Reload agent and Unarchive require the provider history to start with the
|
||||
same prompt IDs and text in order. They then append whole new turns, starting at the next
|
||||
prompt. Existing replies, including partial replies, stay as recorded. If the prompts differ,
|
||||
for example because the provider stored expanded attachment text, the chat stays unchanged and
|
||||
Paseo reports a mismatch. A provider child Paseo already holds, listed or retired, is never imported again.
|
||||
- **Archive and reload** keep the history and the provider children. An archived chat reads them
|
||||
without its provider. Deleting the agent deletes its history and every child's, retired ones
|
||||
included.
|
||||
|
||||
`epoch` is the stored history's identity, minted once when the history is created.
|
||||
|
||||
`AgentTimeline` serializes every operation of one agent, child scopes included, and keeps its
|
||||
state in an `AgentTimelineBackend`: the sequence, the rows and retirements, prompt identities, the
|
||||
open rewind, and the children. The backend contract suite is `agent-timeline.test.ts`, run over
|
||||
`TIMELINE_CONTRACT_BACKENDS` in `timeline/testing.ts`. The only backend keeps everything in
|
||||
memory, so a daemon restart loses the owned history: the next resume imports provider history into
|
||||
a new epoch, and clients take the destructive reset below. Rewinds retired before the restart come
|
||||
back if the provider history still holds them. Retained history costs memory for every loaded,
|
||||
closed or archived agent until the daemon exits or the agent is deleted.
|
||||
|
||||
An open rewind is stored with the history. Resuming an agent whose history holds one settles it
|
||||
before the agent takes prompts: a recorded provider cut is committed, and an unknown outcome is
|
||||
judged from the resumed provider history. When that history proves nothing, the rewind stays open
|
||||
and the agent refuses prompts with the unknown-outcome error.
|
||||
|
||||
## Presence is not delivery
|
||||
|
||||
Client heartbeat reports presence:
|
||||
@@ -201,7 +168,7 @@ or retry backoff. This cannot keep a mobile socket alive after the operating sys
|
||||
bookkeeping without replacing timeline arrays, preserving an upward-scrolled viewport.
|
||||
- When the page overlaps or is adjacent to the local end cursor, only projected items newer than
|
||||
that cursor are applied. Already-covered rows are not replayed.
|
||||
- A true middle gap or epoch change atomically replaces stale canonical history with the
|
||||
- A true middle gap, epoch change, or rewind atomically replaces stale canonical history with the
|
||||
latest tail. The replacement reconciles positioned live rows beyond its coverage and unresolved
|
||||
local submissions; it never retains two discontiguous canonical ranges.
|
||||
|
||||
@@ -214,24 +181,6 @@ history replay. The pending approval UI can hide that tool from presentation, bu
|
||||
must retain its position. Creating a new history card on rejection places it after the prompt that
|
||||
rejected it; changing steer-event ordering would also put new assistant output before that prompt.
|
||||
|
||||
## Rewind retires rows
|
||||
|
||||
A conversation rewind commits a retirement `{ seq, retireFromSeq }`: active rows anchored in
|
||||
`[retireFromSeq, seq)` leave the conversation, and `seq` is the retirement's own position in the
|
||||
sequence. The provider children spawned by retired tool calls, and their descendants, are retired
|
||||
in the same commit. They leave the listing, keep their history, and drop late provider events.
|
||||
|
||||
Clients learn of a retirement live through `agent.timeline.rewind`, and on pages through
|
||||
`retirements`, which lists the retirements whose `seq` lies inside the page's span. The client
|
||||
drops the rows it holds in that range; rows without a timeline position are unechoed local sends
|
||||
and stay. Retired ranges and the retirement's `seq` count as covered, so forward cursors advance
|
||||
through them. Tail, before and prompt-jump pages are served from active rows, so one served before
|
||||
a retirement the client already applied is stale and is refetched (`viewed-timeline-sync.ts`).
|
||||
|
||||
Clients without `timeline_rewind_operations` cannot drop retired rows. For them the session derives
|
||||
a wire epoch that changes with each retirement, so they take the destructive replacement they
|
||||
always took on rewind. The shim is tagged `COMPAT(timelineRewindOperations)`.
|
||||
|
||||
## Provider child history
|
||||
|
||||
Child transcripts use the same projected-page reconciliation as the main conversation. The client
|
||||
@@ -253,10 +202,23 @@ owner wraps cached preparation, network catch-up, accepted timeline application,
|
||||
behind one interface. React supplies transport and projection operations without selecting a cache
|
||||
path or issuing a separate persistence notification.
|
||||
|
||||
Active-agent list reconciliation does not own transcript lifetime. An archived agent's fresh
|
||||
history response can arrive before the active-list response that omits it. Clearing history there
|
||||
would discard accepted rows while the viewed owner still considers them synchronized. Entity
|
||||
deletion clears the transcript; list membership changes do not.
|
||||
The viewed-timeline owner also owns how long a transcript stays in memory. An active agent's
|
||||
transcript stays resident while its chat is hidden, so switching back to it needs no fetch. An
|
||||
archived agent's transcript stays resident only while its chat is shown, for example when it is
|
||||
opened from History. When an agent is archived, or the active list drops it because its workspace
|
||||
was archived, the owner releases the transcript unless the chat is shown. It also releases the
|
||||
transcript when the chat stops being shown. A released chat leaves the opened chats. When it is
|
||||
shown again, it reads the replica cache and catches up again. A history page, live event, or cache
|
||||
read that arrives after the release is dropped.
|
||||
|
||||
The active-list reconciliation does not release transcripts itself. An archived agent's fresh
|
||||
history response can arrive before the active-list response that omits it, while the chat is
|
||||
open in History. Clearing history there would discard rows the user is reading.
|
||||
|
||||
An agent counts as archived when the active list omits it, when its row has an archive timestamp,
|
||||
or when the workspace list omits its workspace. The workspace check matters because a workspace
|
||||
archive can complete while one of its agents keeps a row with no archive timestamp. Until a list
|
||||
first hydrates, it marks no agent as archived. Deleting the agent clears the transcript.
|
||||
|
||||
Removing the host from the registry is the destructive boundary: it stops the runtime and clears the
|
||||
session and host-scoped setup state together.
|
||||
@@ -396,7 +358,7 @@ the draft-create handoff is the one boundary that also permits the legacy canoni
|
||||
arrived first. Generic reducers and consumers do not reimplement message identity matching.
|
||||
|
||||
Ordinary bootstrap, same-epoch reset, and catch-up replacement preserve unmatched locally submitted
|
||||
rows because a provider may never echo them. A known epoch change replaces history and
|
||||
rows because a provider may never echo them. A known epoch change or rewind replaces history and
|
||||
drops acknowledged local rows omitted by the new canonical epoch; every transaction not yet
|
||||
acknowledged by the provider, and no other local row, crosses that destructive boundary. A cold
|
||||
reset without an existing epoch is destructive because the client has no continuity anchor.
|
||||
@@ -412,7 +374,6 @@ canonical assistant prefix, it stays in the head lane. No row may be returned in
|
||||
|
||||
## Relevant code
|
||||
|
||||
- Server owned history: `packages/server/src/server/agent/timeline/`
|
||||
- Server live stream forwarding: `packages/server/src/server/session.ts`
|
||||
- App sync planning: `packages/app/src/timeline/timeline-sync-plan.ts`
|
||||
- App viewed-agent synchronization: `packages/app/src/timeline/viewed-timeline-sync.ts`
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
- Archive workspaces together: Cmd/Ctrl+click a workspace in the sidebar to select multiple workspaces and archive them in one step.
|
||||
- Copy quoted drafts: Copy a quote from a reply with one tap, without the > markers.
|
||||
- Redesigned agent profiles page: Agent profiles have their own dedicated settings page, and the model picker saves a new profile in one tap.
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,5 @@
|
||||
- Archive workspaces together: Cmd/Ctrl+click a workspace in the sidebar to select multiple workspaces and archive them in one step.
|
||||
- Copy quoted drafts: Copy a quote from a reply with one tap, without the > markers.
|
||||
- Redesigned agent profiles page: Agent profiles have their own dedicated settings page, and the model picker saves a new profile in one tap.
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,5 @@
|
||||
- Archive workspaces together: Cmd/Ctrl+click a workspace in the sidebar to select multiple workspaces and archive them in one step.
|
||||
- Copy quoted drafts: Copy a quote from a reply with one tap, without the > markers.
|
||||
- Redesigned agent profiles page: Agent profiles have their own dedicated settings page, and the model picker saves a new profile in one tap.
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -0,0 +1,5 @@
|
||||
- Archive workspaces together: Cmd/Ctrl+click a workspace in the sidebar to select multiple workspaces and archive them in one step.
|
||||
- Copy quoted drafts: Copy a quote from a reply with one tap, without the > markers.
|
||||
- Redesigned agent profiles page: Agent profiles have their own dedicated settings page, and the model picker saves a new profile in one tap.
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
+1
-1
@@ -1 +1 @@
|
||||
sha256-TAVzJzziWDAapQkG4TLkLzOlodkdFNKSl3y/Tm9HB28=
|
||||
sha256-6XXAVBTH6rIdg5eQ9cUeUwV22ikVqTtdWo7i9DYO+/M=
|
||||
|
||||
Generated
+30
-29
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "paseo",
|
||||
"version": "0.17.4",
|
||||
"version": "0.17.5",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "paseo",
|
||||
"version": "0.17.4",
|
||||
"version": "0.17.5",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"workspaces": [
|
||||
@@ -37541,7 +37541,7 @@
|
||||
},
|
||||
"packages/app": {
|
||||
"name": "@getpaseo/app",
|
||||
"version": "0.17.4",
|
||||
"version": "0.17.5",
|
||||
"dependencies": {
|
||||
"@codemirror/commands": "6.10.4",
|
||||
"@codemirror/language": "6.12.4",
|
||||
@@ -39694,13 +39694,13 @@
|
||||
},
|
||||
"packages/cli": {
|
||||
"name": "@getpaseo/cli",
|
||||
"version": "0.17.4",
|
||||
"version": "0.17.5",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^1.0.0",
|
||||
"@getpaseo/client": "0.17.4",
|
||||
"@getpaseo/protocol": "0.17.4",
|
||||
"@getpaseo/server": "0.17.4",
|
||||
"@getpaseo/client": "0.17.5",
|
||||
"@getpaseo/protocol": "0.17.5",
|
||||
"@getpaseo/server": "0.17.5",
|
||||
"chalk": "^5.3.0",
|
||||
"commander": "^12.0.0",
|
||||
"mime-types": "^2.1.35",
|
||||
@@ -39947,11 +39947,11 @@
|
||||
},
|
||||
"packages/client": {
|
||||
"name": "@getpaseo/client",
|
||||
"version": "0.17.4",
|
||||
"version": "0.17.5",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@getpaseo/protocol": "0.17.4",
|
||||
"@getpaseo/relay": "0.17.4",
|
||||
"@getpaseo/protocol": "0.17.5",
|
||||
"@getpaseo/relay": "0.17.5",
|
||||
"ws": "^8.20.0",
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
@@ -39963,7 +39963,7 @@
|
||||
},
|
||||
"packages/desktop": {
|
||||
"name": "@getpaseo/desktop",
|
||||
"version": "0.17.4",
|
||||
"version": "0.17.5",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@getpaseo/cli": "*",
|
||||
@@ -40206,7 +40206,7 @@
|
||||
},
|
||||
"packages/expo-two-way-audio": {
|
||||
"name": "@getpaseo/expo-two-way-audio",
|
||||
"version": "0.17.4",
|
||||
"version": "0.17.5",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.14",
|
||||
@@ -40252,7 +40252,7 @@
|
||||
},
|
||||
"packages/highlight": {
|
||||
"name": "@getpaseo/highlight",
|
||||
"version": "0.17.4",
|
||||
"version": "0.17.5",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@codemirror/language": "6.12.4",
|
||||
@@ -40282,7 +40282,7 @@
|
||||
},
|
||||
"packages/plugin": {
|
||||
"name": "@getpaseo/plugin",
|
||||
"version": "0.17.4",
|
||||
"version": "0.17.5",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "^1.4.0",
|
||||
@@ -40290,8 +40290,8 @@
|
||||
"use-sync-external-store": "^1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@getpaseo/client": "0.17.4",
|
||||
"@getpaseo/protocol": "0.17.4",
|
||||
"@getpaseo/client": "0.17.5",
|
||||
"@getpaseo/protocol": "0.17.5",
|
||||
"@types/node": "^20.9.0",
|
||||
"@types/react": "~19.2.0",
|
||||
"react": "19.2.3",
|
||||
@@ -40301,8 +40301,8 @@
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@getpaseo/client": "0.17.4",
|
||||
"@getpaseo/protocol": "0.17.4",
|
||||
"@getpaseo/client": "0.17.5",
|
||||
"@getpaseo/protocol": "0.17.5",
|
||||
"react": ">=19.1.0 <20",
|
||||
"react-native": ">=0.81.5",
|
||||
"zod": "^4.4.3"
|
||||
@@ -40324,7 +40324,7 @@
|
||||
},
|
||||
"packages/protocol": {
|
||||
"name": "@getpaseo/protocol",
|
||||
"version": "0.17.4",
|
||||
"version": "0.17.5",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"semver": "^7.8.5",
|
||||
@@ -40351,7 +40351,7 @@
|
||||
}
|
||||
},
|
||||
"packages/react-native-enriched-markdown": {
|
||||
"version": "0.17.4",
|
||||
"version": "0.17.5",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
@@ -40367,7 +40367,7 @@
|
||||
},
|
||||
"packages/relay": {
|
||||
"name": "@getpaseo/relay",
|
||||
"version": "0.17.4",
|
||||
"version": "0.17.5",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@noble/ciphers": "^2.4.0",
|
||||
@@ -40589,17 +40589,17 @@
|
||||
},
|
||||
"packages/server": {
|
||||
"name": "@getpaseo/server",
|
||||
"version": "0.17.4",
|
||||
"version": "0.17.5",
|
||||
"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.17.4",
|
||||
"@getpaseo/highlight": "0.17.4",
|
||||
"@getpaseo/plugin": "0.17.4",
|
||||
"@getpaseo/protocol": "0.17.4",
|
||||
"@getpaseo/relay": "0.17.4",
|
||||
"@getpaseo/client": "0.17.5",
|
||||
"@getpaseo/highlight": "0.17.5",
|
||||
"@getpaseo/plugin": "0.17.5",
|
||||
"@getpaseo/protocol": "0.17.5",
|
||||
"@getpaseo/relay": "0.17.5",
|
||||
"@isaacs/ttlcache": "^2.1.4",
|
||||
"@modelcontextprotocol/node": "2.1.2",
|
||||
"@modelcontextprotocol/sdk": "1.29.0",
|
||||
@@ -40625,6 +40625,7 @@
|
||||
"p-limit": "^7.3.0",
|
||||
"p-memoize": "^8.0.0",
|
||||
"p-throttle": "^8.1.0",
|
||||
"parse5": "^7.3.0",
|
||||
"pino": "^10.2.0",
|
||||
"pino-pretty": "^13.1.3",
|
||||
"qrcode": "^1.5.4",
|
||||
@@ -41549,7 +41550,7 @@
|
||||
},
|
||||
"packages/website": {
|
||||
"name": "@getpaseo/website",
|
||||
"version": "0.17.4",
|
||||
"version": "0.17.5",
|
||||
"dependencies": {
|
||||
"@cloudflare/vite-plugin": "^1.29.1",
|
||||
"@cloudflare/workers-types": "^4.20260317.1",
|
||||
@@ -43160,7 +43161,7 @@
|
||||
},
|
||||
"plugins": {
|
||||
"name": "@getpaseo/builtin-plugins",
|
||||
"version": "0.17.4",
|
||||
"version": "0.17.5",
|
||||
"dependencies": {
|
||||
"@getpaseo/plugin": "*",
|
||||
"zod": "^4.4.3"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "paseo",
|
||||
"version": "0.17.4",
|
||||
"version": "0.17.5",
|
||||
"private": true,
|
||||
"description": "Paseo: voice-controlled development environment for local AI coding agents",
|
||||
"keywords": [
|
||||
|
||||
@@ -13,13 +13,6 @@ import {
|
||||
import { expectNearBottom, scrollChatAwayFromBottom } from "../support/helpers/agent-bottom-anchor";
|
||||
import { holdRewindCompletion } from "../support/helpers/agent-timeline-gate";
|
||||
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
|
||||
import { userScrollsTimelineToHistoryStart } from "../support/helpers/timeline-pagination";
|
||||
import {
|
||||
closeWorkspaceAgentTab,
|
||||
fetchAgentArchivedAt,
|
||||
primeAdditionalPage,
|
||||
resetSeededPageState,
|
||||
} from "../support/helpers/archive-tab";
|
||||
|
||||
async function completeSubmittedTurn(
|
||||
page: Page,
|
||||
@@ -55,102 +48,26 @@ async function expectTurnCompletesNormally(
|
||||
await expectAgentIdle(page);
|
||||
}
|
||||
|
||||
async function openAgentOnAnotherClient(
|
||||
page: Page,
|
||||
agent: Awaited<ReturnType<typeof seedMockAgentWorkspace>>,
|
||||
): Promise<void> {
|
||||
await primeAdditionalPage(page);
|
||||
await resetSeededPageState(page);
|
||||
await openAgentRoute(page, agent);
|
||||
await expectComposerVisible(page);
|
||||
}
|
||||
|
||||
/** The prompts the chat shows, in order, each exactly once. */
|
||||
async function expectPrompts(page: Page, prompts: string[]): Promise<void> {
|
||||
const messages = page.getByTestId("user-message");
|
||||
await expect(messages).toHaveCount(prompts.length);
|
||||
await expect(messages).toContainText(prompts);
|
||||
}
|
||||
|
||||
async function reloadAgentFromTabMenu(page: Page, agentId: string): Promise<void> {
|
||||
const tabId = `workspace-tab-agent_${agentId}`;
|
||||
await page.getByTestId(tabId).filter({ visible: true }).first().click({ button: "right" });
|
||||
await page.getByTestId(`workspace-tab-context-agent_${agentId}-reload-agent`).click();
|
||||
}
|
||||
|
||||
async function archiveAgentByClosingTab(
|
||||
page: Page,
|
||||
agent: Awaited<ReturnType<typeof seedMockAgentWorkspace>>,
|
||||
): Promise<void> {
|
||||
await closeWorkspaceAgentTab(page, agent.agentId);
|
||||
await expect.poll(() => fetchAgentArchivedAt(agent.client, agent.agentId)).not.toBeNull();
|
||||
}
|
||||
|
||||
async function unarchiveAgent(page: Page): Promise<void> {
|
||||
await page.getByRole("button", { name: "Unarchive", exact: true }).click();
|
||||
await expect(page.getByText("This agent is archived", { exact: true })).toHaveCount(0, {
|
||||
timeout: 30_000,
|
||||
});
|
||||
}
|
||||
|
||||
async function expectToast(page: Page, message: string): Promise<void> {
|
||||
await expect(page.getByTestId("app-toast-message")).toHaveText(message, { timeout: 30_000 });
|
||||
}
|
||||
|
||||
// The mock provider's resumed session holds no history, so it never matches what Paseo shows.
|
||||
const UNSYNCED_RELOAD =
|
||||
"Reloaded agent, but the provider's history doesn't match this chat, so it wasn't synced";
|
||||
|
||||
/** The prompts of the whole conversation, after scrolling up through its older pages. */
|
||||
async function expectConversationPrompts(page: Page, prompts: string[]): Promise<void> {
|
||||
const messages = page.getByTestId("user-message");
|
||||
await expect
|
||||
.poll(async () => {
|
||||
await userScrollsTimelineToHistoryStart(page);
|
||||
return await messages.count();
|
||||
})
|
||||
.toBe(prompts.length);
|
||||
await expect(messages).toContainText(prompts);
|
||||
}
|
||||
|
||||
// A row React remounts loses this attribute; one that stays mounted keeps it.
|
||||
async function markMounted(row: Locator): Promise<void> {
|
||||
await row.evaluate((element) => element.setAttribute("data-e2e-mounted", "before-rewind"));
|
||||
}
|
||||
|
||||
async function expectStillMounted(row: Locator): Promise<void> {
|
||||
await expect(row).toHaveAttribute("data-e2e-mounted", "before-rewind");
|
||||
}
|
||||
|
||||
test.describe("Agent message rewind", () => {
|
||||
test("rewinds a prompt in place on every open client and keeps a human draft", async ({
|
||||
test("rewinds a submitted prompt without replaying history and preserves a human draft", async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(150_000);
|
||||
test.setTimeout(90_000);
|
||||
const retainedPrompt = "Keep this completed turn after rewind.";
|
||||
const rewoundPrompt = "Remove this completed turn after rewind.";
|
||||
const nextPrompt = "Continue after the rewind.";
|
||||
const preservedDraft = "Keep this human draft after rewind.";
|
||||
const agent = await seedMockAgentWorkspace({
|
||||
repoPrefix: "message-rewind-roundtrip-",
|
||||
title: "Message rewind roundtrip",
|
||||
model: "ten-second-stream",
|
||||
});
|
||||
const otherClient = await page.context().newPage();
|
||||
|
||||
try {
|
||||
const rewindCompletion = await holdRewindCompletion(page, agent.agentId);
|
||||
await openAgentRoute(page, agent);
|
||||
await expectComposerVisible(page);
|
||||
const retainedMessage = await completeSubmittedTurn(page, agent, retainedPrompt);
|
||||
await completeSubmittedTurn(page, agent, retainedPrompt);
|
||||
const userMessage = await completeSubmittedTurn(page, agent, rewoundPrompt);
|
||||
|
||||
await test.step("a second client opens the same chat", async () => {
|
||||
await openAgentOnAnotherClient(otherClient, agent);
|
||||
await expectPrompts(otherClient, [retainedPrompt, rewoundPrompt]);
|
||||
});
|
||||
|
||||
await markMounted(retainedMessage);
|
||||
await scrollChatAwayFromBottom(page, {
|
||||
deltaY: -900,
|
||||
minDistanceFromBottom: 300,
|
||||
@@ -159,92 +76,19 @@ test.describe("Agent message rewind", () => {
|
||||
await blurComposerInput(page);
|
||||
rewindCompletion.clearTimelineStreamCount();
|
||||
|
||||
await test.step("the rewind stays pending until the daemon answers", async () => {
|
||||
const rewind = rewindConversation(page, userMessage, rewoundPrompt);
|
||||
await rewindCompletion.waitForDelayedResponse();
|
||||
await expect(page.getByTestId("rewind-menu-conversation")).toBeDisabled();
|
||||
expect(rewindCompletion.timelineStreamCount()).toBe(0);
|
||||
rewindCompletion.release();
|
||||
await rewind;
|
||||
});
|
||||
const rewind = rewindConversation(page, userMessage, rewoundPrompt);
|
||||
await rewindCompletion.waitForDelayedResponse();
|
||||
await expect(page.getByTestId("rewind-menu-conversation")).toBeDisabled();
|
||||
expect(rewindCompletion.timelineStreamCount()).toBe(0);
|
||||
rewindCompletion.release();
|
||||
await rewind;
|
||||
|
||||
await test.step("the rewound turn leaves without reloading the chat", async () => {
|
||||
await expectPrompts(page, [retainedPrompt]);
|
||||
await expectStillMounted(retainedMessage);
|
||||
expect(rewindCompletion.timelineFetchCount()).toBe(0);
|
||||
await expectComposerDraft(page, preservedDraft);
|
||||
await expectComposerNotFocused(page);
|
||||
await expectNearBottom(page);
|
||||
await expectPrompts(otherClient, [retainedPrompt]);
|
||||
});
|
||||
|
||||
await test.step("the next prompt appears once on both clients", async () => {
|
||||
await completeSubmittedTurn(otherClient, agent, nextPrompt);
|
||||
await expectPrompts(otherClient, [retainedPrompt, nextPrompt]);
|
||||
await expectPrompts(page, [retainedPrompt, nextPrompt]);
|
||||
});
|
||||
|
||||
await test.step("a reconnecting client loads the rewound conversation", async () => {
|
||||
await otherClient.reload();
|
||||
await expectPrompts(otherClient, [retainedPrompt, nextPrompt]);
|
||||
});
|
||||
} finally {
|
||||
await otherClient.close();
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("keeps the rewound conversation through Reload agent, archive and unarchive", async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(150_000);
|
||||
const keptPrompt = "Keep this turn through reload and archive.";
|
||||
const rewoundPrompt = "Rewind this turn before reloading.";
|
||||
const nextPrompt = "Continue after the rewind, then reload.";
|
||||
const agent = await seedMockAgentWorkspace({
|
||||
repoPrefix: "message-rewind-reload-archive-",
|
||||
title: "Message rewind reload archive",
|
||||
model: "ten-second-stream",
|
||||
});
|
||||
|
||||
try {
|
||||
await openAgentRoute(page, agent);
|
||||
await expectComposerVisible(page);
|
||||
await completeSubmittedTurn(page, agent, keptPrompt);
|
||||
const rewound = await completeSubmittedTurn(page, agent, rewoundPrompt);
|
||||
await rewindConversation(page, rewound, rewoundPrompt);
|
||||
await expectPrompts(page, [keptPrompt]);
|
||||
await completeSubmittedTurn(page, agent, nextPrompt);
|
||||
await expectPrompts(page, [keptPrompt, nextPrompt]);
|
||||
|
||||
await test.step("Reload agent keeps the chat and says the provider's history was not synced", async () => {
|
||||
await reloadAgentFromTabMenu(page, agent.agentId);
|
||||
await expectToast(page, UNSYNCED_RELOAD);
|
||||
await expectPrompts(page, [keptPrompt, nextPrompt]);
|
||||
await expectComposerVisible(page);
|
||||
});
|
||||
|
||||
await test.step("the archived chat shows the rewound conversation", async () => {
|
||||
await archiveAgentByClosingTab(page, agent);
|
||||
await openAgentRoute(page, agent);
|
||||
await expect(page.getByText("This agent is archived", { exact: true })).toBeVisible({
|
||||
timeout: 30_000,
|
||||
});
|
||||
await expectConversationPrompts(page, [keptPrompt, nextPrompt]);
|
||||
});
|
||||
|
||||
await test.step("unarchiving keeps the rewound conversation", async () => {
|
||||
await unarchiveAgent(page);
|
||||
await expectToast(page, UNSYNCED_RELOAD);
|
||||
await expectComposerVisible(page);
|
||||
await expectConversationPrompts(page, [keptPrompt, nextPrompt]);
|
||||
});
|
||||
|
||||
await test.step("a reconnecting client loads the same conversation", async () => {
|
||||
await page.reload();
|
||||
await expectComposerVisible(page);
|
||||
await expectConversationPrompts(page, [keptPrompt, nextPrompt]);
|
||||
});
|
||||
await expect(page.getByTestId("user-message").filter({ hasText: rewoundPrompt })).toHaveCount(
|
||||
0,
|
||||
);
|
||||
await expectComposerDraft(page, preservedDraft);
|
||||
await expectComposerNotFocused(page);
|
||||
await expectNearBottom(page);
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
closeRelayPairing,
|
||||
emptyHome,
|
||||
loadingScreen,
|
||||
openTailscaleDocsFromSetup,
|
||||
expectTailscaleSwitchDisabled,
|
||||
paseoToolsSwitch,
|
||||
pickTheme,
|
||||
projectSuggestion,
|
||||
@@ -403,12 +403,10 @@ test("setup choices carry over to Settings and the phone step pairs over relay",
|
||||
await continueSetup(page);
|
||||
});
|
||||
|
||||
await test.step("Phone offers Tailscale docs and pairs over relay in its own modal", async () => {
|
||||
await test.step("Phone shows a disabled Tailscale switch and pairs over relay", async () => {
|
||||
await expectSetupStep(page, "Take your agents with you");
|
||||
await page.screenshot({ path: testInfo.outputPath("5-phone.png") });
|
||||
expect(await openTailscaleDocsFromSetup(page)).toBe(
|
||||
"https://paseo.sh/docs/connectivity#tailscale",
|
||||
);
|
||||
await expectTailscaleSwitchDisabled(page);
|
||||
const pairing = await openRelayPairingFromSetup(page);
|
||||
await expect(pairing.getByText("Enable relay?", { exact: true })).toBeVisible();
|
||||
await enableRelayAndExpectOffer(page);
|
||||
|
||||
@@ -1,7 +1,24 @@
|
||||
import { gotoAppShell, openSettings } from "../support/helpers/app";
|
||||
import {
|
||||
addDirectHostFromSettings,
|
||||
openSettingsHostSection,
|
||||
selectSettingsHost,
|
||||
} from "../support/helpers/settings";
|
||||
import { test } from "../support/fixtures";
|
||||
import { startTailscaleTestDaemon } from "../support/helpers/tailscale-daemon";
|
||||
import { startIsolatedHostDaemon } from "../support/helpers/isolated-host-daemon";
|
||||
import {
|
||||
expectPairingOffer,
|
||||
cancelTailscaleTurnOff,
|
||||
confirmTailscaleTurnOff,
|
||||
connectThroughTailscale,
|
||||
disableTailscale,
|
||||
enableTailscale,
|
||||
expectTailscaleAddress,
|
||||
expectTailscaleRowLoadsOn,
|
||||
openSetupMobileStep,
|
||||
slowConnectionToHost,
|
||||
expectTailscaleUpdateRequired,
|
||||
expectCompletePairingQr,
|
||||
expectRelayConsent,
|
||||
openPairDeviceModal,
|
||||
@@ -37,3 +54,59 @@ test("keeps the pairing QR code inside its compact tile", async ({ page }, testI
|
||||
await daemon.close();
|
||||
}
|
||||
});
|
||||
|
||||
test("asks for a host update when Tailscale controls are unavailable", async ({ page }) => {
|
||||
const daemon = await startIsolatedHostDaemon("pair-device-browser-old-host", {
|
||||
publishedVersion: "0.13.0-beta.2",
|
||||
});
|
||||
try {
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await addDirectHostFromSettings(page, { host: "127.0.0.1", port: daemon.port });
|
||||
await selectSettingsHost(page, daemon.serverId);
|
||||
await openSettingsHostSection(page, daemon.serverId, "devices");
|
||||
await expectTailscaleUpdateRequired(page);
|
||||
} finally {
|
||||
await daemon.close();
|
||||
}
|
||||
});
|
||||
|
||||
test("turns Tailscale on and off from Devices, asking first over Tailscale", async ({
|
||||
page,
|
||||
baseURL,
|
||||
}, testInfo) => {
|
||||
test.skip(process.platform !== "linux", "Uses a second IPv4 loopback address");
|
||||
// The journey opens Devices or the setup six times, two of them over a slowed connection.
|
||||
test.setTimeout(120_000);
|
||||
if (!baseURL) throw new Error("Expected the app base URL");
|
||||
const daemon = await startTailscaleTestDaemon(baseURL);
|
||||
try {
|
||||
await preparePairingHost(page, daemon);
|
||||
await enableTailscale(page);
|
||||
await expectTailscaleAddress(page, daemon.tailscaleAddress);
|
||||
await page.screenshot({ path: testInfo.outputPath("devices.png") });
|
||||
|
||||
await test.step("While its status loads, the row never shows Tailscale off", async () => {
|
||||
const address = daemon.tailscaleAddress;
|
||||
await expectTailscaleRowLoadsOn(page, address, () => preparePairingHost(page, daemon));
|
||||
await expectTailscaleRowLoadsOn(page, address, () => openSetupMobileStep(page, daemon));
|
||||
const restoreSpeed = await slowConnectionToHost(page, daemon.port, 300);
|
||||
await expectTailscaleRowLoadsOn(page, address, () => openSetupMobileStep(page, daemon));
|
||||
await expectTailscaleRowLoadsOn(page, address, () => preparePairingHost(page, daemon));
|
||||
restoreSpeed();
|
||||
});
|
||||
|
||||
await disableTailscale(page, daemon.tailscaleAddress);
|
||||
|
||||
await test.step("Over Tailscale, turning it off asks first and Cancel changes nothing", async () => {
|
||||
await enableTailscale(page);
|
||||
await connectThroughTailscale(page, daemon);
|
||||
await cancelTailscaleTurnOff(page, daemon.tailscaleAddress);
|
||||
});
|
||||
await test.step("Confirming turns it off and cuts this connection", async () => {
|
||||
await confirmTailscaleTurnOff(page, daemon.tailscaleAddress);
|
||||
});
|
||||
} finally {
|
||||
await daemon.close();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -235,7 +235,7 @@ test.describe("Rewind sheet", () => {
|
||||
await expect(page.getByTestId("rewind-menu-content")).toHaveCount(0);
|
||||
await expect(userMessage(page, secondPrompt)).toHaveCount(0);
|
||||
await expect(page.getByText("Cycle 1", { exact: true })).toHaveCount(0);
|
||||
await expectUserMessageCount(page, 0);
|
||||
await expectUserMessageCount(page, 1);
|
||||
await expectComposerDraft(page, firstPrompt);
|
||||
await expectComposerFocused(page);
|
||||
|
||||
@@ -243,7 +243,7 @@ test.describe("Rewind sheet", () => {
|
||||
await expectUserMessageVisible(page, replacementPrompt);
|
||||
await expect(userMessage(page, secondPrompt)).toHaveCount(0);
|
||||
await expect(page.getByText("Cycle 1", { exact: true })).toHaveCount(0);
|
||||
await expectUserMessageCount(page, 1);
|
||||
await expectUserMessageCount(page, 2);
|
||||
|
||||
await fillComposerDraft(page, "");
|
||||
await composerLocator(page).evaluate((element) => element.blur());
|
||||
@@ -254,19 +254,7 @@ test.describe("Rewind sheet", () => {
|
||||
await expect(page.getByTestId("rewind-menu-content")).toHaveCount(0);
|
||||
await expectComposerDraft(page, "");
|
||||
await expectComposerNotFocused(page);
|
||||
await expectUserMessageCount(page, 1);
|
||||
|
||||
const preservedDraft = "Keep this human draft after rewind.";
|
||||
await fillComposerDraft(page, preservedDraft);
|
||||
await composerLocator(page).evaluate((element) => element.blur());
|
||||
await userMessage(page, replacementPrompt).hover();
|
||||
await page.getByTestId("rewind-menu-trigger").last().click();
|
||||
await expect(page.getByTestId("rewind-menu-content")).toBeVisible();
|
||||
await selectRewindOption(page, "Rewind files");
|
||||
await expect(page.getByTestId("rewind-menu-content")).toHaveCount(0);
|
||||
await expectComposerDraft(page, preservedDraft);
|
||||
await expectComposerNotFocused(page);
|
||||
await expectUserMessageCount(page, 1);
|
||||
await expectUserMessageCount(page, 2);
|
||||
|
||||
await fillComposerDraft(page, "");
|
||||
await composerLocator(page).evaluate((element) => element.blur());
|
||||
@@ -277,7 +265,7 @@ test.describe("Rewind sheet", () => {
|
||||
await expect(page.getByTestId("rewind-menu-content")).toHaveCount(0);
|
||||
await expectComposerDraft(page, replacementPrompt);
|
||||
await expectComposerFocused(page);
|
||||
await expectUserMessageCount(page, 0);
|
||||
await expectUserMessageCount(page, 1);
|
||||
} finally {
|
||||
await session.cleanup();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Start on Settings > Host > Pair device with relay enabled in the Android app.
|
||||
// Start on Settings > Host > Devices with relay enabled in the Android app.
|
||||
// node packages/app/e2e/mobile/pair-device/android.mjs <agent-device-session>
|
||||
import assert from "node:assert/strict";
|
||||
import { execFileSync } from "node:child_process";
|
||||
@@ -13,11 +13,7 @@ function ad(...args) {
|
||||
});
|
||||
}
|
||||
|
||||
ad(
|
||||
"press",
|
||||
'label="Pair a device, Scan a QR code or copy a link to connect your phone to this host"',
|
||||
"--settle",
|
||||
);
|
||||
ad("press", 'label="Relay"', "--settle");
|
||||
ad("wait", "text", "Pairing QR code", "10000");
|
||||
const { data } = JSON.parse(ad("snapshot", "-i", "--json"));
|
||||
const sheet = data.nodes.find((node) => node.label === "Bottom Sheet");
|
||||
|
||||
@@ -31,8 +31,6 @@ export interface RewindCompletionGate {
|
||||
clearTimelineStreamCount(): void;
|
||||
release(): void;
|
||||
timelineStreamCount(): number;
|
||||
/** Timeline reads this page sent since the last clear. */
|
||||
timelineFetchCount(): number;
|
||||
waitForDelayedResponse(): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -188,20 +186,12 @@ export async function holdDaemonHydration(page: Page): Promise<DaemonHydrationGa
|
||||
};
|
||||
}
|
||||
|
||||
// The rewind response and the timeline change it causes; the change removes the rewound row too.
|
||||
const REWIND_COMPLETION_MESSAGES = new Set([
|
||||
"agent.rewind.response",
|
||||
"agent.timeline.rewind",
|
||||
"agent.timeline.replacement",
|
||||
]);
|
||||
|
||||
export async function holdRewindCompletion(
|
||||
page: Page,
|
||||
agentId: string,
|
||||
): Promise<RewindCompletionGate> {
|
||||
let released = false;
|
||||
let timelineStreamCount = 0;
|
||||
let timelineFetchCount = 0;
|
||||
const delayedForwards: Array<() => void> = [];
|
||||
let resolveDelayedResponse: (() => void) | null = null;
|
||||
const delayedResponse = new Promise<void>((resolve) => {
|
||||
@@ -210,16 +200,7 @@ export async function holdRewindCompletion(
|
||||
|
||||
await page.routeWebSocket(daemonWsRoutePattern(), (ws) => {
|
||||
const server = ws.connectToServer();
|
||||
ws.onMessage((message) => {
|
||||
const sessionMessage = getSessionMessage(message);
|
||||
if (
|
||||
sessionMessage?.type === "fetch_agent_timeline_request" &&
|
||||
sessionMessage.agentId === agentId
|
||||
) {
|
||||
timelineFetchCount += 1;
|
||||
}
|
||||
server.send(message);
|
||||
});
|
||||
ws.onMessage((message) => server.send(message));
|
||||
server.onMessage((message) => {
|
||||
const sessionMessage = getSessionMessage(message);
|
||||
const payload = sessionMessage ? getPayload(sessionMessage) : null;
|
||||
@@ -235,11 +216,11 @@ export async function holdRewindCompletion(
|
||||
}
|
||||
if (
|
||||
!released &&
|
||||
sessionMessage &&
|
||||
REWIND_COMPLETION_MESSAGES.has(String(sessionMessage.type)) &&
|
||||
(sessionMessage?.type === "agent.rewind.response" ||
|
||||
sessionMessage?.type === "agent.timeline.replacement") &&
|
||||
payload?.agentId === agentId
|
||||
) {
|
||||
// The rewind also signals completion and removes the rewound row/menu.
|
||||
// The replacement also signals completion and removes the rewound row/menu.
|
||||
// Hold it with the response so the pending-state assertion observes a pending rewind.
|
||||
delayedForwards.push(() => ws.send(message));
|
||||
if (sessionMessage.type === "agent.rewind.response") resolveDelayedResponse?.();
|
||||
@@ -252,7 +233,6 @@ export async function holdRewindCompletion(
|
||||
return {
|
||||
clearTimelineStreamCount() {
|
||||
timelineStreamCount = 0;
|
||||
timelineFetchCount = 0;
|
||||
},
|
||||
release() {
|
||||
released = true;
|
||||
@@ -261,7 +241,6 @@ export async function holdRewindCompletion(
|
||||
}
|
||||
},
|
||||
timelineStreamCount: () => timelineStreamCount,
|
||||
timelineFetchCount: () => timelineFetchCount,
|
||||
waitForDelayedResponse: () => delayedResponse,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { promisify } from "node:util";
|
||||
import { once } from "node:events";
|
||||
import {
|
||||
spawn,
|
||||
execFile,
|
||||
@@ -11,6 +12,7 @@ import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import net from "node:net";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { WebSocket } from "ws";
|
||||
import { withDisabledE2ESpeechEnv } from "./speech-env";
|
||||
import { killProcessTree, spawnTsx } from "./spawn-node";
|
||||
|
||||
@@ -64,12 +66,14 @@ export async function getAvailableHostDaemonPort(): Promise<number> {
|
||||
* 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.
|
||||
* EADDRINUSE. Only the daemon's own status reports its server id. Published
|
||||
* daemons can serve status before they accept WebSocket upgrades.
|
||||
*/
|
||||
async function waitForServer(
|
||||
port: number,
|
||||
child: ChildProcess,
|
||||
identity: { serverId: string; paseoHome: string },
|
||||
published: boolean,
|
||||
): Promise<void> {
|
||||
const deadline = Date.now() + 90_000;
|
||||
let lastError: unknown = null;
|
||||
@@ -82,7 +86,10 @@ async function waitForServer(
|
||||
}
|
||||
try {
|
||||
const serverId = await readServerId(port, identity.paseoHome);
|
||||
if (serverId === identity.serverId) return;
|
||||
if (serverId === identity.serverId) {
|
||||
if (published) await checkWebSocketUpgrade(port);
|
||||
return;
|
||||
}
|
||||
lastError = new Error(`Port ${port} is served by ${serverId}, not ${identity.serverId}`);
|
||||
} catch (error) {
|
||||
lastError = error;
|
||||
@@ -97,6 +104,12 @@ async function waitForServer(
|
||||
);
|
||||
}
|
||||
|
||||
async function checkWebSocketUpgrade(port: number): Promise<void> {
|
||||
const socket = new WebSocket(`ws://127.0.0.1:${port}/ws`, { handshakeTimeout: 1_000 });
|
||||
await once(socket, "open");
|
||||
socket.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -246,7 +259,7 @@ export async function startIsolatedHostDaemon(
|
||||
});
|
||||
|
||||
try {
|
||||
await waitForServer(port, spawned, { serverId, paseoHome });
|
||||
await waitForServer(port, spawned, { serverId, paseoHome }, Boolean(publishedPackageRoot));
|
||||
return spawned;
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
|
||||
@@ -161,7 +161,7 @@ export async function finishSetup(page: Page): Promise<void> {
|
||||
/** Opens the Phone step's Relay row: the pair device modal, over setup. */
|
||||
export async function openRelayPairingFromSetup(page: Page): Promise<Locator> {
|
||||
await setupModal(page).getByRole("button", { name: "Relay", exact: true }).click();
|
||||
const pairing = page.getByTestId("onboarding-pair-device-card");
|
||||
const pairing = page.getByTestId("devices-relay-pairing");
|
||||
await expect(pairing).toBeVisible();
|
||||
return pairing;
|
||||
}
|
||||
@@ -171,20 +171,9 @@ export async function closeRelayPairing(pairing: Locator): Promise<void> {
|
||||
await expect(pairing).toHaveCount(0);
|
||||
}
|
||||
|
||||
/** Clicks the Phone step's Tailscale row and returns the docs page it opened. */
|
||||
export async function openTailscaleDocsFromSetup(page: Page): Promise<string> {
|
||||
await page
|
||||
.context()
|
||||
.route("https://paseo.sh/**", (route) =>
|
||||
route.fulfill({ contentType: "text/html", body: "<title>Paseo docs</title>" }),
|
||||
);
|
||||
const popup = page.waitForEvent("popup");
|
||||
await setupModal(page).getByRole("link", { name: "Tailscale, Docs", exact: true }).click();
|
||||
const docs = await popup;
|
||||
await docs.waitForLoadState("domcontentloaded");
|
||||
const url = docs.url();
|
||||
await docs.close();
|
||||
return url;
|
||||
export async function expectTailscaleSwitchDisabled(page: Page): Promise<void> {
|
||||
const setup = setupModal(page);
|
||||
await expect(setup.getByRole("switch", { name: "Tailscale", exact: true })).toBeDisabled();
|
||||
}
|
||||
|
||||
export interface SetupHost {
|
||||
|
||||
@@ -9,6 +9,8 @@ import {
|
||||
selectSettingsHost,
|
||||
} from "./settings";
|
||||
import { expectAppRoute } from "./route-assertions";
|
||||
import { wsRoutePatternForPort } from "./daemon-port";
|
||||
import { goToSetupStep, showSetupAgainFromSettings } from "./onboarding";
|
||||
import { buildSettingsHostSectionRoute } from "@/utils/host-routes";
|
||||
|
||||
interface PairingHostInput {
|
||||
@@ -60,9 +62,33 @@ export async function prepareLocalPairingHost(
|
||||
await preparePairingHost(page, daemon, additionalHosts);
|
||||
}
|
||||
|
||||
type PairingHost =
|
||||
| Pick<IsolatedHostDaemon, "serverId" | "port">
|
||||
| Pick<OutdatedDaemon, "serverId" | "endpoint">;
|
||||
|
||||
export async function preparePairingHost(
|
||||
page: Page,
|
||||
daemon: IsolatedHostDaemon | OutdatedDaemon,
|
||||
daemon: PairingHost,
|
||||
additionalHosts: PairingHostInput[] = [],
|
||||
): Promise<void> {
|
||||
await openAppOnPairingHost(page, daemon, additionalHosts);
|
||||
await openSettings(page);
|
||||
await openSettingsHost(page, daemon.serverId);
|
||||
await expect(page.getByTestId("devices-relay")).toHaveCount(0);
|
||||
await openSettingsHostSection(page, daemon.serverId, "devices");
|
||||
await expect(page.getByTestId("devices-relay")).toBeVisible();
|
||||
}
|
||||
|
||||
/** Loads the app afresh with `daemon` as its first host, then opens the setup's Mobile step. */
|
||||
export async function openSetupMobileStep(page: Page, daemon: PairingHost): Promise<void> {
|
||||
await openAppOnPairingHost(page, daemon);
|
||||
await showSetupAgainFromSettings(page);
|
||||
await goToSetupStep(page, "Mobile");
|
||||
}
|
||||
|
||||
async function openAppOnPairingHost(
|
||||
page: Page,
|
||||
daemon: PairingHost,
|
||||
additionalHosts: PairingHostInput[] = [],
|
||||
): Promise<void> {
|
||||
await seedSavedSettingsHosts(page, [
|
||||
@@ -74,20 +100,271 @@ export async function preparePairingHost(
|
||||
...additionalHosts,
|
||||
]);
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await openSettingsHost(page, daemon.serverId);
|
||||
await expect(page.getByTestId("host-page-pair-device-row")).toHaveCount(0);
|
||||
await openSettingsHostSection(page, daemon.serverId, "pair-device");
|
||||
await expect(page.getByTestId("host-page-pair-device-row")).toBeVisible();
|
||||
}
|
||||
|
||||
export async function enableTailscale(page: Page): Promise<void> {
|
||||
const toggle = page.getByRole("switch", { name: "Tailscale", exact: true });
|
||||
await expect(toggle).toBeEnabled();
|
||||
await expect(toggle).not.toBeChecked();
|
||||
await toggle.click();
|
||||
await expect(toggle).toBeChecked();
|
||||
}
|
||||
|
||||
export async function expectTailscaleAddress(page: Page, address: string): Promise<void> {
|
||||
const row = tailscaleAddressRow(page, address);
|
||||
await expect(row).toBeVisible();
|
||||
await expect(
|
||||
row.getByText("On a phone with Tailscale, add a host at this address"),
|
||||
).toBeVisible();
|
||||
await expect(row.getByRole("button", { name: "Copy", exact: true })).toBeVisible();
|
||||
const response = await fetch(`http://${address}/api/health`);
|
||||
expect(response.ok).toBe(true);
|
||||
}
|
||||
|
||||
/** The switch shows off as soon as it is tapped; the host stops listening when its answer lands. */
|
||||
async function expectHostUnreachableAt(address: string): Promise<void> {
|
||||
await expect
|
||||
.poll(() =>
|
||||
fetch(`http://${address}/api/health`).then(
|
||||
() => "reachable",
|
||||
() => "unreachable",
|
||||
),
|
||||
)
|
||||
.toBe("unreachable");
|
||||
}
|
||||
|
||||
function tailscaleAddressRow(page: Page, address: string) {
|
||||
return page.getByTestId("devices-tailscale-address").filter({ hasText: address });
|
||||
}
|
||||
|
||||
export async function disableTailscale(page: Page, address: string): Promise<void> {
|
||||
const toggle = page.getByRole("switch", { name: "Tailscale", exact: true });
|
||||
await expect(toggle).toBeEnabled();
|
||||
await toggle.click();
|
||||
await expect(toggle).not.toBeChecked();
|
||||
await expect(tailscaleAddressRow(page, address)).toHaveCount(0);
|
||||
await expectHostUnreachableAt(address);
|
||||
}
|
||||
|
||||
/** Reopens the host over its Tailscale address, as a phone on the tailnet would reach it. */
|
||||
export async function connectThroughTailscale(
|
||||
page: Page,
|
||||
daemon: { serverId: string; tailscaleAddress: string },
|
||||
): Promise<void> {
|
||||
await preparePairingHost(page, { serverId: daemon.serverId, endpoint: daemon.tailscaleAddress });
|
||||
await expectTailscaleAddress(page, daemon.tailscaleAddress);
|
||||
}
|
||||
|
||||
const TURN_OFF_QUESTION =
|
||||
"Turn off Tailscale?\n\nThis device is connected through Tailscale and will lose its connection to the host.";
|
||||
|
||||
/**
|
||||
* Taps the switch off over the Tailscale connection and cancels the question. Every state the row
|
||||
* commits from the tap to after Cancel must still show Tailscale on with its address: nothing
|
||||
* changes until the user confirms.
|
||||
*/
|
||||
export async function cancelTailscaleTurnOff(page: Page, address: string): Promise<void> {
|
||||
const row = await recordTailscaleRow(page);
|
||||
const question = answerNextDialog(page, "dismiss");
|
||||
await page.getByRole("switch", { name: "Tailscale", exact: true }).click();
|
||||
expect(await question).toBe(TURN_OFF_QUESTION);
|
||||
await page.waitForTimeout(500);
|
||||
expect(new Set((await row()).map((state) => `${state.value} ${state.address}`))).toEqual(
|
||||
new Set(["on true"]),
|
||||
);
|
||||
await expect(page.getByRole("switch", { name: "Tailscale", exact: true })).toBeChecked();
|
||||
await expect(tailscaleAddressRow(page, address)).toBeVisible();
|
||||
expect((await fetch(`http://${address}/api/health`)).ok).toBe(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirms turning Tailscale off over the Tailscale connection, which cuts this app off the host.
|
||||
* Without the host the row shows no value at all, on or off.
|
||||
*/
|
||||
export async function confirmTailscaleTurnOff(page: Page, address: string): Promise<void> {
|
||||
const question = answerNextDialog(page, "accept");
|
||||
await page.getByRole("switch", { name: "Tailscale", exact: true }).click();
|
||||
expect(await question).toBe(TURN_OFF_QUESTION);
|
||||
await expect(page.getByText("Host is not connected", { exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("switch", { name: "Tailscale", exact: true })).toHaveCount(0);
|
||||
await expectHostUnreachableAt(address);
|
||||
}
|
||||
|
||||
function answerNextDialog(page: Page, answer: "accept" | "dismiss"): Promise<string> {
|
||||
return new Promise((resolve) => {
|
||||
page.once("dialog", async (dialog) => {
|
||||
resolve(dialog.message());
|
||||
await (answer === "accept" ? dialog.accept() : dialog.dismiss());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
interface TailscaleRowState {
|
||||
/** `none` while the row shows no value yet. */
|
||||
value: "on" | "off" | "none";
|
||||
address: boolean;
|
||||
hint: string;
|
||||
labelTop: number;
|
||||
hintTop: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Records every state the Tailscale row commits, painted or not: from now on in this page, and
|
||||
* from the first paint of every page load after it. Recording again starts a new record.
|
||||
*/
|
||||
async function recordTailscaleRow(page: Page): Promise<() => Promise<TailscaleRowState[]>> {
|
||||
const record = () => {
|
||||
const host = window as unknown as {
|
||||
tailscaleRow?: { states: unknown[]; last: string; sample(): void };
|
||||
};
|
||||
if (host.tailscaleRow) {
|
||||
host.tailscaleRow.states = [];
|
||||
host.tailscaleRow.last = "";
|
||||
host.tailscaleRow.sample();
|
||||
return;
|
||||
}
|
||||
const isVisibleText = (element: Element, text?: string) =>
|
||||
element.childElementCount === 0 &&
|
||||
(text === undefined
|
||||
? (element.textContent ?? "").trim() !== ""
|
||||
: element.textContent === text) &&
|
||||
element.getBoundingClientRect().height > 0;
|
||||
const readValue = (toggle: Element | null) => {
|
||||
if (!toggle) return "none";
|
||||
return toggle.getAttribute("aria-checked") === "true" ? "on" : "off";
|
||||
};
|
||||
const read = () => {
|
||||
const label = [...document.querySelectorAll("div, span")].find((element) =>
|
||||
isVisibleText(element, "Tailscale"),
|
||||
);
|
||||
if (!label) return null;
|
||||
let row: Element = label;
|
||||
while (row.parentElement && !(row as HTMLElement).innerText.includes("\n")) {
|
||||
row = row.parentElement;
|
||||
}
|
||||
const hint = [...row.querySelectorAll("div, span")].find(
|
||||
(element) => element !== label && isVisibleText(element),
|
||||
);
|
||||
const toggle = document.querySelector('[role="switch"][aria-label="Tailscale"]');
|
||||
return {
|
||||
value: readValue(toggle),
|
||||
address: document.querySelector('[data-testid="devices-tailscale-address"]') !== null,
|
||||
hint: hint?.textContent ?? "",
|
||||
labelTop: Math.round(label.getBoundingClientRect().top),
|
||||
hintTop: Math.round(hint?.getBoundingClientRect().top ?? -1),
|
||||
};
|
||||
};
|
||||
const recorder = {
|
||||
states: [] as unknown[],
|
||||
last: "",
|
||||
sample() {
|
||||
const state = read();
|
||||
const key = JSON.stringify(state);
|
||||
if (state && key !== recorder.last) recorder.states.push(state);
|
||||
recorder.last = key;
|
||||
},
|
||||
};
|
||||
host.tailscaleRow = recorder;
|
||||
new MutationObserver(() => recorder.sample()).observe(document, {
|
||||
subtree: true,
|
||||
childList: true,
|
||||
characterData: true,
|
||||
attributes: true,
|
||||
});
|
||||
};
|
||||
await page.addInitScript(record);
|
||||
await page.evaluate(record);
|
||||
return () =>
|
||||
page.evaluate(
|
||||
() =>
|
||||
(window as unknown as { tailscaleRow: { states: TailscaleRowState[] } }).tailscaleRow
|
||||
.states,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs `open`, which first shows the Tailscale row of a host with Tailscale on, and checks the row
|
||||
* from its first state to its last: it starts with no value, never shows Tailscale off, and its
|
||||
* label and hint keep their text and place until it settles on, with the address below.
|
||||
*/
|
||||
export async function expectTailscaleRowLoadsOn(
|
||||
page: Page,
|
||||
address: string,
|
||||
open: () => Promise<void>,
|
||||
): Promise<void> {
|
||||
const row = await recordTailscaleRow(page);
|
||||
await open();
|
||||
await expect(page.getByRole("switch", { name: "Tailscale", exact: true })).toBeChecked();
|
||||
await expect(tailscaleAddressRow(page, address)).toBeVisible();
|
||||
const states = await row();
|
||||
expect(states[0]?.value).toBe("none");
|
||||
expect(states.filter((state) => state.value === "off")).toEqual([]);
|
||||
expect(
|
||||
new Set(states.map(({ hint, labelTop, hintTop }) => `${hint} ${labelTop} ${hintTop}`)).size,
|
||||
).toBe(1);
|
||||
expect(states.at(-1)).toMatchObject({ value: "on", address: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds every message between the app and the host on `port` for `ms` in each direction, as on a
|
||||
* slow network. The returned function brings the connection back to full speed.
|
||||
*/
|
||||
export async function slowConnectionToHost(
|
||||
page: Page,
|
||||
port: number,
|
||||
ms: number,
|
||||
): Promise<() => void> {
|
||||
let delay = ms;
|
||||
await page.routeWebSocket(wsRoutePatternForPort(String(port)), (app) => {
|
||||
const host = app.connectToServer();
|
||||
app.onMessage(
|
||||
deliverInOrderAfter(
|
||||
() => delay,
|
||||
(message) => host.send(message),
|
||||
),
|
||||
);
|
||||
host.onMessage(
|
||||
deliverInOrderAfter(
|
||||
() => delay,
|
||||
(message) => app.send(message),
|
||||
),
|
||||
);
|
||||
});
|
||||
return () => {
|
||||
delay = 0;
|
||||
};
|
||||
}
|
||||
|
||||
function deliverInOrderAfter(
|
||||
delay: () => number,
|
||||
deliver: (message: string | Buffer) => void,
|
||||
): (message: string | Buffer) => void {
|
||||
const queue: { at: number; message: string | Buffer }[] = [];
|
||||
let timer: ReturnType<typeof setTimeout> | null = null;
|
||||
const flush = () => {
|
||||
timer = null;
|
||||
while (queue[0] && queue[0].at <= Date.now()) deliver(queue.shift()!.message);
|
||||
if (queue[0]) timer = setTimeout(flush, queue[0].at - Date.now());
|
||||
};
|
||||
return (message) => {
|
||||
queue.push({ at: Math.max(Date.now() + delay(), queue.at(-1)?.at ?? 0), message });
|
||||
if (!timer) flush();
|
||||
};
|
||||
}
|
||||
|
||||
export async function expectTailscaleUpdateRequired(page: Page): Promise<void> {
|
||||
await expect(page.getByRole("switch", { name: "Tailscale", exact: true })).toBeDisabled();
|
||||
await expect(page.getByText("Update this host to use Tailscale", { exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("link", { name: "How to update", exact: true })).toBeVisible();
|
||||
}
|
||||
|
||||
export async function openPairDeviceModal(page: Page): Promise<void> {
|
||||
await page.getByRole("button", { name: /Pair a device/ }).click();
|
||||
await expect(page.getByTestId("host-page-pair-device-card")).toBeVisible();
|
||||
await page.getByRole("button", { name: "Relay", exact: true }).click();
|
||||
await expect(page.getByTestId("devices-relay-pairing")).toBeVisible();
|
||||
}
|
||||
|
||||
export async function expectRelayConsent(page: Page): Promise<void> {
|
||||
const modal = page.getByTestId("host-page-pair-device-card");
|
||||
const modal = page.getByTestId("devices-relay-pairing");
|
||||
await expect(modal.getByText("Enable relay?", { exact: true })).toBeVisible();
|
||||
await expect(modal.getByText(/end-to-end encrypted/)).toBeVisible();
|
||||
await expect(modal.getByRole("link", { name: "Read how Paseo relay works" })).toBeVisible();
|
||||
@@ -99,7 +376,7 @@ export async function expectRelayConsent(page: Page): Promise<void> {
|
||||
|
||||
export async function declineRelay(page: Page): Promise<void> {
|
||||
await page.getByRole("button", { name: "Not now", exact: true }).click();
|
||||
await expect(page.getByTestId("host-page-pair-device-card")).toHaveCount(0);
|
||||
await expect(page.getByTestId("devices-relay-pairing")).toHaveCount(0);
|
||||
}
|
||||
|
||||
export async function enableRelayAndExpectOffer(page: Page): Promise<void> {
|
||||
@@ -124,10 +401,10 @@ export async function expectPairingOffer(page: Page): Promise<void> {
|
||||
|
||||
export async function closePairDeviceModal(page: Page): Promise<void> {
|
||||
await page
|
||||
.getByTestId("host-page-pair-device-card")
|
||||
.getByTestId("devices-relay-pairing")
|
||||
.getByRole("button", { name: "Close", exact: true })
|
||||
.click();
|
||||
await expect(page.getByTestId("host-page-pair-device-card")).toHaveCount(0);
|
||||
await expect(page.getByTestId("devices-relay-pairing")).toHaveCount(0);
|
||||
}
|
||||
|
||||
export async function reloadAndOpenPairDevice(page: Page): Promise<void> {
|
||||
@@ -145,7 +422,7 @@ export async function enableRelayAndExpectFailure(
|
||||
expectedError = "Relay is controlled by a daemon launch override",
|
||||
): Promise<void> {
|
||||
await page.getByRole("button", { name: "Enable relay", exact: true }).click();
|
||||
const modal = page.getByTestId("host-page-pair-device-card");
|
||||
const modal = page.getByTestId("devices-relay-pairing");
|
||||
await expect(modal.getByRole("alert")).toContainText(expectedError);
|
||||
await expect(modal.getByRole("button", { name: "Retry", exact: true })).toBeEnabled();
|
||||
await expect(modal.getByRole("textbox", { name: "Pairing link" })).toHaveCount(0);
|
||||
@@ -155,7 +432,7 @@ export async function retryRelayAndExpectFailure(
|
||||
page: Page,
|
||||
expectedError = "Relay is controlled by a daemon launch override",
|
||||
): Promise<void> {
|
||||
const modal = page.getByTestId("host-page-pair-device-card");
|
||||
const modal = page.getByTestId("devices-relay-pairing");
|
||||
await modal.getByRole("button", { name: "Retry", exact: true }).click();
|
||||
await expect(modal.getByRole("alert")).toContainText(expectedError);
|
||||
await expect(modal.getByRole("button", { name: "Retry", exact: true })).toBeEnabled();
|
||||
@@ -173,7 +450,7 @@ export async function openPairDeviceFromHome(page: Page): Promise<void> {
|
||||
}
|
||||
|
||||
export async function expectRelayUpdateRequired(page: Page): Promise<void> {
|
||||
const modal = page.getByTestId("host-page-pair-device-card");
|
||||
const modal = page.getByTestId("devices-relay-pairing");
|
||||
await expect(
|
||||
modal.getByText("Update the host to enable relay from Paseo Desktop."),
|
||||
).toBeVisible();
|
||||
@@ -195,15 +472,15 @@ export function observePairingOfferRequests(page: Page, daemon: OutdatedDaemon):
|
||||
}
|
||||
|
||||
export async function expectPairingDisconnected(page: Page): Promise<void> {
|
||||
const modal = page.getByTestId("host-page-pair-device-card");
|
||||
const modal = page.getByTestId("devices-relay-pairing");
|
||||
await expect(modal.getByRole("alert")).toContainText("Host is not connected");
|
||||
await expect(modal.getByRole("button", { name: "Retry", exact: true })).toBeVisible();
|
||||
}
|
||||
|
||||
export async function switchPairDeviceToHost(page: Page, serverId: string): Promise<void> {
|
||||
await selectSettingsHost(page, serverId);
|
||||
await expectAppRoute(page, buildSettingsHostSectionRoute(serverId, "pair-device"));
|
||||
await expect(page.getByTestId("host-page-pair-device-row")).toBeVisible();
|
||||
await expectAppRoute(page, buildSettingsHostSectionRoute(serverId, "devices"));
|
||||
await expect(page.getByTestId("devices-relay")).toBeVisible();
|
||||
}
|
||||
|
||||
export async function openRelaySecurityDocs(page: Page): Promise<void> {
|
||||
|
||||
@@ -66,7 +66,7 @@ export type SettingsSection = keyof typeof SECTION_LABELS;
|
||||
type HostSection =
|
||||
| "projects"
|
||||
| "connections"
|
||||
| "pair-device"
|
||||
| "devices"
|
||||
| "agents"
|
||||
| "metadata"
|
||||
| "voice"
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { once } from "node:events";
|
||||
import path from "node:path";
|
||||
import { z } from "zod";
|
||||
import { killProcessTree, spawnTsx } from "./spawn-node";
|
||||
|
||||
const readySchema = z.object({ port: z.number(), serverId: z.string() });
|
||||
|
||||
export async function startTailscaleTestDaemon(origin: string) {
|
||||
const entrypoint = path.resolve(
|
||||
__dirname,
|
||||
"../../../../server/src/server/test-utils/tailscale-daemon.ts",
|
||||
);
|
||||
const child = spawnTsx(entrypoint, [origin], {
|
||||
stdio: ["ignore", "inherit", "inherit", "ipc"],
|
||||
});
|
||||
const signal = AbortSignal.timeout(30_000);
|
||||
try {
|
||||
const ready = await Promise.race([
|
||||
once(child, "message", { signal }).then(([message]) => readySchema.parse(message)),
|
||||
once(child, "exit", { signal }).then(([code]) => {
|
||||
throw new Error(`Tailscale test daemon exited before startup with code ${code}`);
|
||||
}),
|
||||
]);
|
||||
return {
|
||||
...ready,
|
||||
tailscaleAddress: `127.0.0.2:${ready.port}`,
|
||||
close: () => killProcessTree(child),
|
||||
};
|
||||
} catch (error) {
|
||||
await killProcessTree(child);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/app",
|
||||
"version": "0.17.4",
|
||||
"version": "0.17.5",
|
||||
"private": true,
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
|
||||
@@ -56,7 +56,6 @@ export function ChatFind({
|
||||
agentId,
|
||||
serverId,
|
||||
epoch,
|
||||
rewindSeq,
|
||||
items,
|
||||
viewportRef,
|
||||
revealLoadedMessage,
|
||||
@@ -96,8 +95,8 @@ export function ChatFind({
|
||||
);
|
||||
const state = useSyncExternalStore(model.subscribe, model.getSnapshot, model.getSnapshot);
|
||||
useEffect(() => {
|
||||
model.updateHistory(epoch, items, rewindSeq);
|
||||
}, [model, epoch, items, rewindSeq]);
|
||||
model.updateHistory(epoch, items);
|
||||
}, [model, epoch, items]);
|
||||
useEffect(() => () => model.close(), [model]);
|
||||
useEffect(() => {
|
||||
if (!active) model.close();
|
||||
|
||||
@@ -18,7 +18,7 @@ function message(seq: number, text = "target"): StreamItem {
|
||||
kind: "assistant_message",
|
||||
text,
|
||||
timestamp: new Date(0),
|
||||
timelineCursor: { epoch: "epoch", seq, anchorSeq: seq },
|
||||
timelineCursor: { epoch: "epoch", seq },
|
||||
};
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ it("loads an older location and searches a response merged across suppressed tas
|
||||
source.map((item, index) => ({
|
||||
event: { type: "timeline" as const, provider: "claude" as const, item },
|
||||
timestamp: new Date(0),
|
||||
timelineCursor: { epoch: "epoch", seq: index + 1, anchorSeq: index + 1 },
|
||||
timelineCursor: { epoch: "epoch", seq: index + 1 },
|
||||
})),
|
||||
{ source: "canonical" },
|
||||
);
|
||||
@@ -55,7 +55,7 @@ it("loads an older location and searches a response merged across suppressed tas
|
||||
},
|
||||
async load(_epoch, seq) {
|
||||
loaded.push(seq);
|
||||
model.updateHistory("epoch", history, null);
|
||||
model.updateHistory("epoch", history);
|
||||
},
|
||||
async reveal(_id, _query, occurrence) {
|
||||
revealed.push(occurrence);
|
||||
@@ -64,7 +64,7 @@ it("loads an older location and searches a response merged across suppressed tas
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [], null);
|
||||
model.updateHistory("epoch", []);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
@@ -99,7 +99,7 @@ it("skips a source-only candidate and highlights a displayed match", async () =>
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [message(1), message(2)], null);
|
||||
model.updateHistory("epoch", [message(1), message(2)]);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().selectedItemId).toBe("row-2");
|
||||
@@ -129,7 +129,7 @@ it("ignores replies after closing and does not navigate", async () => {
|
||||
},
|
||||
clear() {},
|
||||
});
|
||||
model.updateHistory("epoch", [message(1)], null);
|
||||
model.updateHistory("epoch", [message(1)]);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => calls).toEqual(["search"]);
|
||||
@@ -155,7 +155,7 @@ it("retains a failed search for retry and distinguishes failure from zero matche
|
||||
};
|
||||
const model = new ChatFindModel(operations);
|
||||
try {
|
||||
model.updateHistory("epoch", [], null);
|
||||
model.updateHistory("epoch", []);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("error");
|
||||
@@ -185,7 +185,7 @@ it("reports a failed timeline load as a connection failure", async () => {
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [], null);
|
||||
model.updateHistory("epoch", []);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("error");
|
||||
@@ -207,160 +207,24 @@ it("reports a search result that outlived its epoch as a changed history", async
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [message(1)], null);
|
||||
model.updateHistory("epoch", [message(1)]);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
model.updateHistory("epoch-2", [message(1)], null);
|
||||
model.updateHistory("epoch-2", [message(1)]);
|
||||
expect(model.getSnapshot()).toMatchObject({ phase: "error", failure: "historyChanged" });
|
||||
} finally {
|
||||
model.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("reports results that a rewind took messages from as a changed history", async () => {
|
||||
const model = new ChatFindModel({
|
||||
async search() {
|
||||
return response([{ seq: 2, role: "assistant" }]);
|
||||
},
|
||||
async load() {},
|
||||
async reveal() {
|
||||
return { count: 1, occurrence: 0 };
|
||||
},
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [message(1), message(2)], null);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
expect(model.getSnapshot()).toMatchObject({ selectedItemId: "row-2", count: 1 });
|
||||
// Another client rewinds the turn holding the match; the epoch stays.
|
||||
model.updateHistory("epoch", [message(1)], 3);
|
||||
expect(model.getSnapshot()).toMatchObject({
|
||||
phase: "error",
|
||||
failure: "historyChanged",
|
||||
selectedItemId: null,
|
||||
});
|
||||
} finally {
|
||||
model.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("stops a search still receiving pages when a rewind lands between them", async () => {
|
||||
let pages = 0;
|
||||
let releaseSecondPage!: () => void;
|
||||
const secondPage = new Promise<void>((resolve) => {
|
||||
releaseSecondPage = resolve;
|
||||
});
|
||||
const model = new ChatFindModel({
|
||||
async search(_query, cursor) {
|
||||
pages += 1;
|
||||
if (cursor === undefined)
|
||||
return { ...response([{ seq: 2, role: "assistant" }]), nextCursor: 2 };
|
||||
await secondPage;
|
||||
return response([{ seq: 1, role: "assistant" }]);
|
||||
},
|
||||
async load() {},
|
||||
async reveal() {
|
||||
return { count: 1, occurrence: 0 };
|
||||
},
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [message(1), message(2)], null);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => pages).toBe(2);
|
||||
model.updateHistory("epoch", [message(1)], 3);
|
||||
releaseSecondPage();
|
||||
await expect.poll(() => model.getSnapshot().failure).toBe("historyChanged");
|
||||
expect(model.getSnapshot()).toMatchObject({ phase: "error", selectedItemId: null });
|
||||
} finally {
|
||||
model.close();
|
||||
}
|
||||
});
|
||||
|
||||
it.each([
|
||||
["Next", "next"],
|
||||
["Previous", "previous"],
|
||||
] as const)("reports a rewind after %s as a changed history", async (_label, step) => {
|
||||
const model = new ChatFindModel({
|
||||
async search() {
|
||||
return response([
|
||||
{ seq: 1, role: "assistant" },
|
||||
{ seq: 2, role: "assistant" },
|
||||
]);
|
||||
},
|
||||
async load() {},
|
||||
async reveal() {
|
||||
return { count: 1, occurrence: 0 };
|
||||
},
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [message(1), message(2)], null);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
model[step]();
|
||||
await expect.poll(() => model.getSnapshot().selectedItemId).toBe("row-2");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
model.updateHistory("epoch", [message(1)], 3);
|
||||
expect(model.getSnapshot()).toMatchObject({
|
||||
phase: "error",
|
||||
failure: "historyChanged",
|
||||
selectedItemId: null,
|
||||
});
|
||||
} finally {
|
||||
model.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("stops a pending Next when a rewind lands before it reveals", async () => {
|
||||
let reveals = 0;
|
||||
let revealSecond!: () => void;
|
||||
const secondReveal = new Promise<void>((resolve) => {
|
||||
revealSecond = resolve;
|
||||
});
|
||||
const model = new ChatFindModel({
|
||||
async search() {
|
||||
return response([
|
||||
{ seq: 1, role: "assistant" },
|
||||
{ seq: 2, role: "assistant" },
|
||||
]);
|
||||
},
|
||||
async load() {},
|
||||
async reveal() {
|
||||
reveals += 1;
|
||||
if (reveals > 1) await secondReveal;
|
||||
return { count: 1, occurrence: 0 };
|
||||
},
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [message(1), message(2)], null);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
model.next();
|
||||
await expect.poll(() => reveals).toBe(2);
|
||||
model.updateHistory("epoch", [message(1)], 3);
|
||||
revealSecond();
|
||||
await expect.poll(() => model.getSnapshot().failure).toBe("historyChanged");
|
||||
expect(model.getSnapshot()).toMatchObject({ phase: "error", selectedItemId: null });
|
||||
} finally {
|
||||
model.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("can load a search location before the initial chat history has arrived", async () => {
|
||||
const model = new ChatFindModel({
|
||||
async search() {
|
||||
return response([{ seq: 1, role: "assistant" }]);
|
||||
},
|
||||
async load() {
|
||||
model.updateHistory("epoch", [message(1)], null);
|
||||
model.updateHistory("epoch", [message(1)]);
|
||||
},
|
||||
async reveal() {
|
||||
return { count: 1, occurrence: 0 };
|
||||
@@ -368,7 +232,7 @@ it("can load a search location before the initial chat history has arrived", asy
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory(null, [], null);
|
||||
model.updateHistory(null, []);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
@@ -396,7 +260,7 @@ it("reports the position across the whole chat and corrects it with rendered cou
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [message(1), message(2)], null);
|
||||
model.updateHistory("epoch", [message(1), message(2)]);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
@@ -433,7 +297,7 @@ it("counts one match per message from a host that reports no counts", async () =
|
||||
clear() {},
|
||||
});
|
||||
try {
|
||||
model.updateHistory("epoch", [message(1), message(2)], null);
|
||||
model.updateHistory("epoch", [message(1), message(2)]);
|
||||
model.open();
|
||||
model.setQuery("target");
|
||||
await expect.poll(() => model.getSnapshot().phase).toBe("ready");
|
||||
|
||||
@@ -76,10 +76,6 @@ export class ChatFindModel {
|
||||
private items: StreamItem[] = [];
|
||||
private epoch: string | null = null;
|
||||
private resultEpoch: string | null = null;
|
||||
/** The latest rewind applied to the history. A rewind keeps the epoch and retires messages. */
|
||||
private rewindSeq: number | null = null;
|
||||
/** The latest rewind when the current result set's search started; undefined until a search starts. */
|
||||
private searchedRewindSeq: number | null | undefined = undefined;
|
||||
private locations: Location[] = [];
|
||||
private resolved = new Map<Location, Target>();
|
||||
private current = -1;
|
||||
@@ -117,7 +113,6 @@ export class ChatFindModel {
|
||||
this.cancel();
|
||||
this.locations = [];
|
||||
this.resultEpoch = null;
|
||||
this.searchedRewindSeq = undefined;
|
||||
this.resolved.clear();
|
||||
this.current = -1;
|
||||
this.inMessage = { occurrence: 0, count: 0 };
|
||||
@@ -149,7 +144,6 @@ export class ChatFindModel {
|
||||
});
|
||||
}
|
||||
private async search(signal: AbortSignal) {
|
||||
this.searchedRewindSeq = this.rewindSeq;
|
||||
try {
|
||||
let cursor: number | undefined;
|
||||
do {
|
||||
@@ -174,14 +168,15 @@ export class ChatFindModel {
|
||||
this.fail(error, signal);
|
||||
}
|
||||
}
|
||||
/** `rewindSeq` is the sequence number of the latest rewind applied to this history. */
|
||||
updateHistory(epoch: string | null, items: StreamItem[], rewindSeq: number | null) {
|
||||
const replaced = this.resultEpoch !== null && epoch !== null && epoch !== this.resultEpoch;
|
||||
const rewound = this.searchedRewindSeq !== undefined && rewindSeq !== this.searchedRewindSeq;
|
||||
if ((replaced || rewound) && this.state.open) {
|
||||
updateHistory(epoch: string | null, items: StreamItem[]) {
|
||||
if (
|
||||
this.resultEpoch !== null &&
|
||||
epoch !== null &&
|
||||
epoch !== this.resultEpoch &&
|
||||
this.state.open
|
||||
) {
|
||||
this.fail(new ChatFindFailureError("historyChanged"), this.abort.signal);
|
||||
}
|
||||
this.rewindSeq = rewindSeq;
|
||||
this.epoch = epoch;
|
||||
this.items = items;
|
||||
this.historyListeners.forEach((listener) => listener());
|
||||
|
||||
@@ -9,8 +9,6 @@ export interface ChatFindProps {
|
||||
agentId: string;
|
||||
serverId: string;
|
||||
epoch: string | null;
|
||||
/** The sequence number of the latest rewind applied to this history, if any. */
|
||||
rewindSeq: number | null;
|
||||
items: StreamItem[];
|
||||
viewportRef: RefObject<StreamViewportHandle | null>;
|
||||
revealLoadedMessage(messageId: string): boolean;
|
||||
|
||||
@@ -139,7 +139,7 @@ describe("useChatOutline", () => {
|
||||
kind: "user_message",
|
||||
text: "live prompt",
|
||||
timestamp: new Date(seq),
|
||||
timelineCursor: { epoch: "epoch-1", seq, anchorSeq: seq },
|
||||
timelineCursor: { epoch: "epoch-1", seq },
|
||||
});
|
||||
rerender({ tail: [loadedPrompt(2)] });
|
||||
await waitFor(() => expect(runtime.listAgentTimelinePrompts).toHaveBeenCalledTimes(2));
|
||||
@@ -198,7 +198,7 @@ describe("useChatOutline", () => {
|
||||
kind: "assistant_message",
|
||||
text: "chunk",
|
||||
timestamp: new Date(),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2, anchorSeq: 2 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2 },
|
||||
},
|
||||
],
|
||||
timelineEpoch: "epoch-1",
|
||||
@@ -219,7 +219,7 @@ describe("useChatOutline", () => {
|
||||
kind: "user_message",
|
||||
text: "Replaced conversation",
|
||||
timestamp: new Date(2),
|
||||
timelineCursor: { epoch: "epoch-2", seq: 1, anchorSeq: 1 },
|
||||
timelineCursor: { epoch: "epoch-2", seq: 1 },
|
||||
},
|
||||
],
|
||||
timelineEpoch: "epoch-2",
|
||||
@@ -275,7 +275,7 @@ describe("useChatOutline", () => {
|
||||
kind: "user_message" as const,
|
||||
text: "prompt",
|
||||
timestamp: new Date(1),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 1, anchorSeq: 1 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 1 },
|
||||
},
|
||||
];
|
||||
const { result, rerender } = renderHook(
|
||||
@@ -326,7 +326,7 @@ describe("useChatOutline", () => {
|
||||
kind: "user_message" as const,
|
||||
text: "prompt",
|
||||
timestamp: new Date(1),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 1, anchorSeq: 1 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 1 },
|
||||
};
|
||||
const { result, rerender } = renderHook(
|
||||
({ tail, mountedHistoryMessageIds }) =>
|
||||
@@ -381,7 +381,7 @@ describe("useChatOutline", () => {
|
||||
kind: "user_message" as const,
|
||||
text: "prompt",
|
||||
timestamp: new Date(2),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2, anchorSeq: 2 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2 },
|
||||
};
|
||||
const revealLoadedMessage = vi.fn();
|
||||
revealLoadedMessage.mockReturnValue(false);
|
||||
|
||||
@@ -320,7 +320,7 @@ describe("stream presentation through installed plugins", () => {
|
||||
const source = harness.source();
|
||||
const live = source.head[0];
|
||||
if (live?.kind !== "assistant_message") throw new Error("Expected a live assistant message");
|
||||
const canonical = { ...live, timelineCursor: { epoch: "epoch-1", seq: 42, anchorSeq: 42 } };
|
||||
const canonical = { ...live, timelineCursor: { epoch: "epoch-1", seq: 42 } };
|
||||
const present = createStreamPresentation();
|
||||
present({ ...presentationOptions, tail: [], head: [live], transform: undefined });
|
||||
const repointed = rows(
|
||||
@@ -330,7 +330,7 @@ describe("stream presentation through installed plugins", () => {
|
||||
{
|
||||
id: streamed[0]!.id,
|
||||
text: "Streamed answer",
|
||||
timelineCursor: { epoch: "epoch-1", seq: 42, anchorSeq: 42 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 42 },
|
||||
},
|
||||
]);
|
||||
});
|
||||
@@ -517,7 +517,7 @@ describe("timeline presentation", () => {
|
||||
messageId: "provider-message",
|
||||
clientMessageId: "client-message",
|
||||
turnId: "turn-1",
|
||||
timelineCursor: { epoch: "epoch", seq: 12, anchorSeq: 12 },
|
||||
timelineCursor: { epoch: "epoch", seq: 12 },
|
||||
});
|
||||
const presentMessage = () =>
|
||||
present({
|
||||
|
||||
@@ -33,7 +33,7 @@ describe("resolveAssistantTurnForkBoundary", () => {
|
||||
it("forks a failed assistant turn from its Paseo timeline cursor without a provider message id", () => {
|
||||
const failedTurn = {
|
||||
...assistantMessage("assistant-error", 2),
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42, anchorSeq: 42 },
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42 },
|
||||
};
|
||||
|
||||
expect(
|
||||
@@ -50,7 +50,7 @@ describe("resolveAssistantTurnForkBoundary", () => {
|
||||
it("includes the provider message id with a supported timeline cursor", () => {
|
||||
const selected = {
|
||||
...assistantMessage("assistant-1", 2, "msg-assistant-1"),
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42, anchorSeq: 42 },
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42 },
|
||||
};
|
||||
|
||||
expect(
|
||||
@@ -68,7 +68,7 @@ describe("resolveAssistantTurnForkBoundary", () => {
|
||||
it("falls back to the provider message id when timeline cursors are unsupported", () => {
|
||||
const selected = {
|
||||
...assistantMessage("assistant-1", 2, "msg-assistant-1"),
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42, anchorSeq: 42 },
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42 },
|
||||
};
|
||||
|
||||
expect(
|
||||
@@ -116,7 +116,7 @@ describe("resolveAssistantTurnForkBoundary", () => {
|
||||
it("resolves a fork boundary from the reply a plugin card replaced", () => {
|
||||
const reply = {
|
||||
...assistantMessage("assistant-1", 2, "msg-assistant-1"),
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42, anchorSeq: 42 },
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42 },
|
||||
};
|
||||
const card: StreamItem = {
|
||||
kind: "plugin",
|
||||
@@ -154,7 +154,7 @@ describe("resolveAssistantTurnForkBoundary", () => {
|
||||
const appended: StreamItem = {
|
||||
kind: "plugin",
|
||||
id: "plugin/card-1",
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42, anchorSeq: 42 },
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42 },
|
||||
timestamp: timestamp(2),
|
||||
pluginId: "plugin",
|
||||
pluginItemId: "card-1",
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
import { getAssistantReply, type StreamItem } from "@/types/stream";
|
||||
|
||||
/** The daemon's timeline cursor; the row's anchor stays in the client. */
|
||||
interface TimelineBoundaryCursor {
|
||||
epoch: string;
|
||||
seq: number;
|
||||
}
|
||||
import { getAssistantReply, type StreamItem, type TimelinePosition } from "@/types/stream";
|
||||
|
||||
export type AssistantTurnForkBoundary =
|
||||
| { boundaryCursor: TimelineBoundaryCursor; boundaryMessageId?: string }
|
||||
| { boundaryCursor: TimelinePosition; boundaryMessageId?: string }
|
||||
| { boundaryCursor?: undefined; boundaryMessageId: string };
|
||||
|
||||
export function resolveAssistantTurnForkBoundary(input: {
|
||||
@@ -21,7 +15,7 @@ export function resolveAssistantTurnForkBoundary(input: {
|
||||
}
|
||||
if (input.supportsTimelineCursor && reply.timelineCursor) {
|
||||
return {
|
||||
boundaryCursor: { epoch: reply.timelineCursor.epoch, seq: reply.timelineCursor.seq },
|
||||
boundaryCursor: reply.timelineCursor,
|
||||
...(reply.messageId ? { boundaryMessageId: reply.messageId } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ describe("collapseTurns", () => {
|
||||
it("stands at its host's timeline position, taking a new row when that position lands", () => {
|
||||
const live = collapse([user("u1"), shell("c1"), reply("r1")]);
|
||||
expect(live.summaryRowsByHostId.get("u1")).not.toHaveProperty("timelineCursor");
|
||||
const cursor = { epoch: "epoch-1", seq: 7, anchorSeq: 7 };
|
||||
const cursor = { epoch: "epoch-1", seq: 7 };
|
||||
const placed = [{ ...user("u1"), timelineCursor: cursor }, shell("c1"), reply("r1")];
|
||||
const canonical = collapse(placed, { previousSummaryRowsByHostId: live.summaryRowsByHostId });
|
||||
expect(canonical.summaryRowsByHostId.get("u1")).not.toBe(live.summaryRowsByHostId.get("u1"));
|
||||
|
||||
@@ -159,10 +159,10 @@ const projectedReply: StreamItem = {
|
||||
id: "reply",
|
||||
messageId: "provider-reply-1",
|
||||
text: 'Done.\n\n```ui\nCard("Summary", [])\n```',
|
||||
timelineCursor: { epoch: "e1", seq: 5, anchorSeq: 5 },
|
||||
timelineCursor: { epoch: "e1", seq: 5 },
|
||||
timestamp: FRIDAY_NIGHT,
|
||||
},
|
||||
timelineCursor: { epoch: "e1", seq: 5, anchorSeq: 5 },
|
||||
timelineCursor: { epoch: "e1", seq: 5 },
|
||||
timestamp: FRIDAY_NIGHT,
|
||||
pluginId: "genui",
|
||||
pluginItemId: "reply/1",
|
||||
|
||||
@@ -408,10 +408,6 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
|
||||
const timelineEpoch = useSessionStore(
|
||||
(state) => state.sessions[resolvedServerId]?.agentTimelineCursor.get(agentId)?.epoch ?? null,
|
||||
);
|
||||
const timelineRewindSeq = useSessionStore((state) => {
|
||||
const rewind = state.sessions[resolvedServerId]?.agentTimelineLatestRewind.get(agentId);
|
||||
return rewind && rewind.epoch === timelineEpoch ? rewind.seq : null;
|
||||
});
|
||||
const isTimelineDetached = useSessionStore(
|
||||
(state) => state.sessions[resolvedServerId]?.agentTimelineHasNewer.get(agentId) === true,
|
||||
);
|
||||
@@ -1170,7 +1166,6 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
|
||||
agentId={agentId}
|
||||
serverId={resolvedServerId}
|
||||
epoch={timelineEpoch}
|
||||
rewindSeq={timelineRewindSeq}
|
||||
items={findItems}
|
||||
viewportRef={viewportRef}
|
||||
revealLoadedMessage={revealLoadedMessage}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { useLocalSearchParams } from "expo-router";
|
||||
import { Redirect, useLocalSearchParams } from "expo-router";
|
||||
import { useMemo } from "react";
|
||||
import { HostRouteBootstrapBoundary } from "@/components/host-route-bootstrap-boundary";
|
||||
import SettingsScreen from "@/screens/settings-screen";
|
||||
import { normalizeHostSectionSlug } from "@/utils/host-routes";
|
||||
import { buildSettingsHostSectionRoute, normalizeHostSectionSlug } from "@/utils/host-routes";
|
||||
|
||||
export default function SettingsHostSectionRoute() {
|
||||
const params = useLocalSearchParams<{ serverId?: string; hostSection?: string }>();
|
||||
@@ -11,6 +11,10 @@ export default function SettingsHostSectionRoute() {
|
||||
const section = normalizeHostSectionSlug(rawSection) ?? "connections";
|
||||
const view = useMemo(() => ({ kind: "host" as const, serverId, section }), [serverId, section]);
|
||||
|
||||
if (rawSection === "pair-device" && serverId) {
|
||||
return <Redirect href={buildSettingsHostSectionRoute(serverId, "devices")} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<HostRouteBootstrapBoundary>
|
||||
<SettingsScreen view={view} />
|
||||
|
||||
@@ -7,7 +7,6 @@ import { FOOTER_HEIGHT } from "@/constants/layout";
|
||||
import { useHostRuntimeClient, useHostRuntimeIsConnected } from "@/runtime/host-runtime";
|
||||
import { KeyboardTranslateView } from "@/keyboard/shift";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useToast } from "@/contexts/toast-context";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
import { toErrorMessage } from "@/utils/error-messages";
|
||||
|
||||
@@ -20,7 +19,6 @@ export function ArchivedAgentCallout({ serverId, agentId }: ArchivedAgentCallout
|
||||
const { t } = useTranslation();
|
||||
const client = useHostRuntimeClient(serverId);
|
||||
const isConnected = useHostRuntimeIsConnected(serverId);
|
||||
const toast = useToast();
|
||||
const [isUnarchiving, setIsUnarchiving] = useState(false);
|
||||
const [unarchiveError, setUnarchiveError] = useState<string | null>(null);
|
||||
|
||||
@@ -29,15 +27,12 @@ export function ArchivedAgentCallout({ serverId, agentId }: ArchivedAgentCallout
|
||||
setIsUnarchiving(true);
|
||||
setUnarchiveError(null);
|
||||
try {
|
||||
const refreshed = await client.refreshAgent(agentId);
|
||||
if (refreshed.historyDiverged) {
|
||||
toast.show(t("workspace.tabs.toasts.reloadedAgentHistoryDiverged"), { variant: "warning" });
|
||||
}
|
||||
await client.refreshAgent(agentId);
|
||||
} catch (error) {
|
||||
setUnarchiveError(toErrorMessage(error));
|
||||
setIsUnarchiving(false);
|
||||
}
|
||||
}, [client, isConnected, isUnarchiving, agentId, toast, t]);
|
||||
}, [client, isConnected, isUnarchiving, agentId]);
|
||||
|
||||
return (
|
||||
<KeyboardTranslateView style={styles.container}>
|
||||
|
||||
@@ -9,7 +9,6 @@ import { useRewindComposerRestore } from "./composer-restore";
|
||||
import { useSessionStore } from "@/stores/session-store";
|
||||
import { shouldRestoreComposerForRewindMode } from "./rewind-mode";
|
||||
import { getHostRuntimeStore } from "@/runtime/host-runtime";
|
||||
import { hostSupportsFeature } from "@/runtime/host-features";
|
||||
|
||||
interface UseRewindAgentMutationInput {
|
||||
serverId?: string;
|
||||
@@ -43,16 +42,7 @@ export function useRewindAgentMutation(input: UseRewindAgentMutationInput): {
|
||||
throw new Error(t("common.errors.daemonClientUnavailable"));
|
||||
}
|
||||
await input.client.rewindAgent(input.agentId, input.messageId, mode);
|
||||
// COMPAT(timelineRewindOperations): added in v0.14.1, remove after 2027-05-10. A daemon with
|
||||
// the feature delivers the rewind on the live timeline; an older one replaced the timeline
|
||||
// and this client has to read it again.
|
||||
const appliesLive =
|
||||
input.serverId !== undefined &&
|
||||
hostSupportsFeature(
|
||||
useSessionStore.getState().sessions[input.serverId]?.serverInfo,
|
||||
"timelineRewindOperations",
|
||||
);
|
||||
if (mode !== "files" && !appliesLive) {
|
||||
if (mode !== "files") {
|
||||
const cursor = input.serverId
|
||||
? useSessionStore
|
||||
.getState()
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { Children, isValidElement, useCallback, useMemo, useState, type ReactNode } from "react";
|
||||
import { useCallback, useMemo, useState, type ReactNode } from "react";
|
||||
import { View } from "react-native";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import { isWeb } from "@/constants/platform";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
import { NestedSettingsRows } from "./row-density";
|
||||
import { SettingsRowChildren } from "./row-children";
|
||||
import { SettingsRowHeader } from "./row-header";
|
||||
|
||||
interface SettingsCollapsibleRowProps {
|
||||
@@ -48,27 +46,7 @@ export function SettingsCollapsibleRow({
|
||||
webAccessibilityProps={webExpandedProps}
|
||||
testID={testID ? `${testID}-toggle` : undefined}
|
||||
/>
|
||||
{expanded ? (
|
||||
<View style={styles.children}>
|
||||
<NestedSettingsRows>
|
||||
{Children.toArray(children).map((child, index) => (
|
||||
<View
|
||||
key={isValidElement(child) ? child.key : index}
|
||||
style={settingsStyles.rowBorder}
|
||||
>
|
||||
{child}
|
||||
</View>
|
||||
))}
|
||||
</NestedSettingsRows>
|
||||
</View>
|
||||
) : null}
|
||||
{expanded ? <SettingsRowChildren>{children}</SettingsRowChildren> : null}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
// The revealed rows keep the card's rails; the tint is what groups them under their header.
|
||||
children: {
|
||||
backgroundColor: theme.colors.surface0,
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -25,7 +25,10 @@ import { DropdownTrigger } from "@/components/ui/dropdown-trigger";
|
||||
import { useIsCompactFormFactor } from "@/constants/layout";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
import { ControlSizeProvider } from "@/components/ui/control-size";
|
||||
import { ExternalLink, type ExternalLinkProps } from "@/components/ui/external-link";
|
||||
import { useSettingsRowLayout } from "./row-density";
|
||||
import { SettingsRowTitle } from "./row-label";
|
||||
export { SettingsRowChildren } from "./row-children";
|
||||
export { SettingsGroup } from "./headings/settings-group";
|
||||
export { SettingsSection } from "./headings/settings-section";
|
||||
export { SettingsCollapsibleRow } from "./collapsible-row";
|
||||
@@ -36,11 +39,16 @@ export { SettingsBackLink, SettingsDetailHeader } from "./detail-header";
|
||||
export { SettingsInfoTip } from "./headings/settings-info-tip";
|
||||
export { MenuSettingsRows } from "./row-density";
|
||||
|
||||
/** What app screens can add to a plugin-facing row: an accessory beside the label, such as an info tip. */
|
||||
/**
|
||||
* What app screens can add to a plugin-facing row: an accessory beside the label, such as an info
|
||||
* tip, an icon before the label, and a link to a page outside the app under the hint.
|
||||
*/
|
||||
interface AppRowExtras {
|
||||
labelAccessory?: ReactNode;
|
||||
/** An icon before the label, such as the thing the row is about. */
|
||||
leading?: ReactNode;
|
||||
/** A page outside the app that helps with this row, drawn under the hint as "Label ↗". */
|
||||
link?: Pick<ExternalLinkProps, "href" | "label" | "accessibilityLabel">;
|
||||
}
|
||||
|
||||
interface AppSettingsRowProps extends Omit<SettingsRowProps, "hint">, AppRowExtras {
|
||||
@@ -67,6 +75,7 @@ export function SettingsRow({
|
||||
leading,
|
||||
labelAccessory,
|
||||
hint,
|
||||
link,
|
||||
error,
|
||||
children,
|
||||
testID,
|
||||
@@ -74,20 +83,17 @@ export function SettingsRow({
|
||||
const compact = useIsCompactFormFactor();
|
||||
const layout = useSettingsRowLayout();
|
||||
const rowStyle = useMemo(() => [layout.row, compact && styles.compactRow], [compact, layout]);
|
||||
const accessoryTitleStyle = useMemo(() => [layout.title, styles.accessoryLabel], [layout]);
|
||||
return (
|
||||
<View style={rowStyle} testID={testID}>
|
||||
{leading ? <View style={styles.leading}>{leading}</View> : null}
|
||||
<View style={styles.label}>
|
||||
{labelAccessory ? (
|
||||
<View style={styles.labelRow}>
|
||||
<Text style={accessoryTitleStyle}>{label}</Text>
|
||||
{labelAccessory}
|
||||
</View>
|
||||
) : (
|
||||
<Text style={layout.title}>{label}</Text>
|
||||
)}
|
||||
<SettingsRowTitle label={label} accessory={labelAccessory} />
|
||||
{typeof hint === "string" ? <Text style={layout.hint}>{hint}</Text> : hint}
|
||||
{link ? (
|
||||
<View style={styles.link}>
|
||||
<ExternalLink {...link} />
|
||||
</View>
|
||||
) : null}
|
||||
{error ? (
|
||||
<Text accessibilityRole="alert" style={settingsStyles.rowError}>
|
||||
{error}
|
||||
@@ -103,7 +109,15 @@ export function SettingsRow({
|
||||
);
|
||||
}
|
||||
|
||||
export function SettingsSwitch({ value, onValueChange, disabled, ...row }: SettingsSwitchProps) {
|
||||
/** A switch row. App screens may pass `null` while the value is not known yet; see `Switch`. */
|
||||
export function SettingsSwitch({
|
||||
value,
|
||||
onValueChange,
|
||||
disabled,
|
||||
...row
|
||||
}: Omit<SettingsSwitchProps, "onValueChange" | "value"> &
|
||||
Partial<Pick<SettingsSwitchProps, "onValueChange">> &
|
||||
AppRowExtras & { value: boolean | null }) {
|
||||
return (
|
||||
<SettingsRow {...row}>
|
||||
<Switch
|
||||
@@ -204,7 +218,12 @@ export function SettingsInput({
|
||||
);
|
||||
}
|
||||
|
||||
export function SettingsAction({ actionLabel, onPress, disabled, ...row }: SettingsActionProps) {
|
||||
export function SettingsAction({
|
||||
actionLabel,
|
||||
onPress,
|
||||
disabled,
|
||||
...row
|
||||
}: SettingsActionProps & AppRowExtras) {
|
||||
return (
|
||||
<SettingsRow {...row}>
|
||||
<Button variant="outline" onPress={onPress} disabled={disabled}>
|
||||
@@ -221,13 +240,7 @@ const styles = StyleSheet.create((theme) => ({
|
||||
// The same leading slot as `SettingsRowHeader`, so icons and labels share rails across row kinds.
|
||||
leading: { marginRight: theme.spacing[3], alignItems: "center", justifyContent: "center" },
|
||||
label: { flexGrow: 1, flexShrink: 1, flexBasis: 160, marginRight: theme.spacing[3] },
|
||||
labelRow: {
|
||||
flexDirection: "row",
|
||||
flexWrap: "wrap",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[2],
|
||||
},
|
||||
accessoryLabel: { flexShrink: 1, minWidth: 0 },
|
||||
link: { alignItems: "flex-start", marginTop: theme.spacing[1] },
|
||||
control: { flexShrink: 1, maxWidth: "100%" },
|
||||
input: { minWidth: 180 },
|
||||
}));
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import { Children, isValidElement, type ReactNode } from "react";
|
||||
import { View } from "react-native";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
import { NestedSettingsRows } from "./row-density";
|
||||
|
||||
/**
|
||||
* Rows that belong to the row above them, such as the rows an expanded row reveals or the details
|
||||
* a switch turns on. They sit in the same card on a tinted band, laid out as nested rows.
|
||||
*/
|
||||
export function SettingsRowChildren({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<View style={styles.band}>
|
||||
<NestedSettingsRows>
|
||||
{Children.toArray(children).map((child, index) => (
|
||||
<View key={isValidElement(child) ? child.key : index} style={settingsStyles.rowBorder}>
|
||||
{child}
|
||||
</View>
|
||||
))}
|
||||
</NestedSettingsRows>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
// The rows keep the card's rails; the tint is what groups them under the row above.
|
||||
band: {
|
||||
backgroundColor: theme.colors.surface0,
|
||||
},
|
||||
}));
|
||||
@@ -11,6 +11,7 @@ import { SkeletonPulse, useSkeletonPulse } from "@/components/ui/skeleton";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
import { ICON_SIZE, type Theme } from "@/styles/theme";
|
||||
import { useSettingsRowLayout, type SettingsRowLayout } from "./row-density";
|
||||
import { SettingsRowTitle } from "./row-label";
|
||||
|
||||
const ThemedChevron = withUnistyles(ChevronRight);
|
||||
const ThemedLoadingSpinner = withUnistyles(LoadingSpinner);
|
||||
@@ -118,9 +119,8 @@ export function SettingsRowHeader({
|
||||
</View>
|
||||
) : null}
|
||||
<View style={[contentStyle, styles.passThrough]}>
|
||||
<View style={labelAccessory ? styles.labelRow : undefined} {...HIDDEN_FROM_ASSISTIVE_TECH}>
|
||||
<Text style={layout.title}>{label}</Text>
|
||||
{labelAccessory}
|
||||
<View {...HIDDEN_FROM_ASSISTIVE_TECH}>
|
||||
<SettingsRowTitle label={label} accessory={labelAccessory} />
|
||||
</View>
|
||||
{hintStatus ? (
|
||||
<RowHintLine hint={hint} status={hintStatus} hintStyle={layout.hint} />
|
||||
@@ -293,7 +293,6 @@ const styles = StyleSheet.create((theme) => ({
|
||||
borderRadius: theme.borderRadius.sm,
|
||||
backgroundColor: theme.colors.surface2,
|
||||
},
|
||||
labelRow: { flexDirection: "row", alignItems: "center", gap: theme.spacing[2] },
|
||||
summary: {
|
||||
flexShrink: 1,
|
||||
color: theme.colors.foregroundMuted,
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { useMemo, type ReactNode } from "react";
|
||||
import { Text, View } from "react-native";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import { useSettingsRowLayout } from "./row-density";
|
||||
|
||||
/**
|
||||
* A row's label line: the label, and beside it an accessory such as a badge or an info tip. Rows
|
||||
* with inline controls and rows that lead somewhere both draw it, so their labels and hints keep
|
||||
* the same distances whether or not a row carries an accessory.
|
||||
*/
|
||||
export function SettingsRowTitle({ label, accessory }: { label: string; accessory?: ReactNode }) {
|
||||
const layout = useSettingsRowLayout();
|
||||
const titleStyle = useMemo(() => [layout.title, styles.title], [layout]);
|
||||
if (!accessory) return <Text style={layout.title}>{label}</Text>;
|
||||
return (
|
||||
<View style={styles.line}>
|
||||
<Text style={titleStyle}>{label}</Text>
|
||||
<View style={styles.accessory}>{accessory}</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
line: {
|
||||
flexDirection: "row",
|
||||
flexWrap: "wrap",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[2],
|
||||
},
|
||||
title: { flexShrink: 1, minWidth: 0 },
|
||||
// An accessory is taller than the label's line. It hangs into the row's padding instead, so the
|
||||
// label and hint keep the distances of a row without one.
|
||||
accessory: { marginVertical: -theme.spacing[1] },
|
||||
}));
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useCallback, useMemo } from "react";
|
||||
import {
|
||||
Pressable,
|
||||
View,
|
||||
type GestureResponderEvent,
|
||||
type StyleProp,
|
||||
type ViewStyle,
|
||||
@@ -19,7 +20,11 @@ import { useIsCompactFormFactor } from "@/constants/layout";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
|
||||
interface SwitchProps {
|
||||
value: boolean;
|
||||
/**
|
||||
* `null` while the value is not known yet, such as while it loads from a host. The switch's space
|
||||
* stays reserved and empty, so the switch takes it when the value arrives and nothing moves.
|
||||
*/
|
||||
value: boolean | null;
|
||||
onValueChange?: (value: boolean) => void;
|
||||
disabled?: boolean;
|
||||
accessibilityLabel?: string;
|
||||
@@ -109,7 +114,7 @@ export function Switch({
|
||||
const handlePress = useCallback(
|
||||
(event: GestureResponderEvent) => {
|
||||
event.stopPropagation();
|
||||
if (disabled) return;
|
||||
if (disabled || value === null) return;
|
||||
onValueChange?.(!value);
|
||||
},
|
||||
[disabled, onValueChange, value],
|
||||
@@ -119,7 +124,10 @@ export function Switch({
|
||||
const isCompact = useIsCompactFormFactor();
|
||||
const geometry = useMemo(() => switchGeometryForLayout(size, isCompact), [size, isCompact]);
|
||||
|
||||
const accessibilityState = useMemo(() => ({ checked: value, disabled }), [value, disabled]);
|
||||
const accessibilityState = useMemo(
|
||||
() => ({ checked: value === true, disabled }),
|
||||
[value, disabled],
|
||||
);
|
||||
const pressableStyle = useMemo(
|
||||
() => [
|
||||
styles.switchControl,
|
||||
@@ -134,6 +142,12 @@ export function Switch({
|
||||
],
|
||||
[disabled, geometry.hitHeight, geometry.trackHeight, style],
|
||||
);
|
||||
const unknownStyle = useMemo(
|
||||
() => [{ width: geometry.trackWidth, minHeight: geometry.trackHeight }, style],
|
||||
[geometry.trackWidth, geometry.trackHeight, style],
|
||||
);
|
||||
|
||||
if (value === null) return <View style={unknownStyle} testID={testID} />;
|
||||
|
||||
return (
|
||||
<Pressable
|
||||
|
||||
@@ -385,16 +385,6 @@ function SessionProviderInternal({ children, serverId, client }: SessionProvider
|
||||
console.warn("[Session] timeline replacement refresh failed", { serverId, error });
|
||||
});
|
||||
};
|
||||
const onRewind = (message: SessionOutboundMessage) => {
|
||||
if (message.type !== "agent.timeline.rewind") return;
|
||||
const { agentId, epoch, seq, retireFromSeq } = message.payload;
|
||||
sync.applyStreamEvent(agentId, {
|
||||
event: { type: "rewind", retireFromSeq },
|
||||
seq,
|
||||
epoch,
|
||||
timestamp: new Date(),
|
||||
});
|
||||
};
|
||||
const sync = getHostRuntimeStore().createViewedTimelineOwner(serverId, {
|
||||
canCheckFreshness: () =>
|
||||
client.getLastServerInfoMessage()?.features?.timelineFreshnessCheck === true,
|
||||
@@ -405,7 +395,6 @@ function SessionProviderInternal({ children, serverId, client }: SessionProvider
|
||||
update: (message) => {
|
||||
if (message.type === "agent_stream") onStream(message);
|
||||
else if (message.type === "agent.timeline.replacement") onReplacement(message);
|
||||
else if (message.type === "agent.timeline.rewind") onRewind(message);
|
||||
},
|
||||
});
|
||||
return observation;
|
||||
|
||||
@@ -11,8 +11,13 @@ import { i18n } from "@/i18n/i18next";
|
||||
|
||||
const DESKTOP_SETTINGS_QUERY_KEY = ["desktop-settings"] as const;
|
||||
|
||||
export type DesktopUpdateMode = "automatic" | "notify" | "off";
|
||||
|
||||
export interface DesktopSettings {
|
||||
releaseChannel: ReleaseChannel;
|
||||
updates: {
|
||||
mode: DesktopUpdateMode;
|
||||
};
|
||||
notifications: {
|
||||
playSound: boolean;
|
||||
};
|
||||
@@ -24,12 +29,16 @@ export interface DesktopSettings {
|
||||
|
||||
export interface DesktopSettingsPatch {
|
||||
releaseChannel?: ReleaseChannel;
|
||||
updates?: Partial<DesktopSettings["updates"]>;
|
||||
notifications?: Partial<DesktopSettings["notifications"]>;
|
||||
daemon?: Partial<DesktopSettings["daemon"]>;
|
||||
}
|
||||
|
||||
export const DEFAULT_DESKTOP_SETTINGS: DesktopSettings = {
|
||||
releaseChannel: "stable",
|
||||
updates: {
|
||||
mode: "automatic",
|
||||
},
|
||||
notifications: {
|
||||
playSound: true,
|
||||
},
|
||||
@@ -149,13 +158,24 @@ export async function migrateLegacyDesktopSettings(input: {
|
||||
await invokeDesktopCommand("migrate_legacy_desktop_settings", input);
|
||||
}
|
||||
|
||||
function parseUpdateMode(value: unknown): DesktopUpdateMode {
|
||||
if (value === "automatic" || value === "notify" || value === "off") {
|
||||
return value;
|
||||
}
|
||||
return DEFAULT_DESKTOP_SETTINGS.updates.mode;
|
||||
}
|
||||
|
||||
function parseDesktopSettings(raw: unknown): DesktopSettings {
|
||||
const record = isRecord(raw) ? raw : {};
|
||||
const updates = isRecord(record.updates) ? record.updates : {};
|
||||
const notifications = isRecord(record.notifications) ? record.notifications : {};
|
||||
const daemon = isRecord(record.daemon) ? record.daemon : {};
|
||||
|
||||
return {
|
||||
releaseChannel: record.releaseChannel === "beta" ? "beta" : "stable",
|
||||
updates: {
|
||||
mode: parseUpdateMode(updates.mode),
|
||||
},
|
||||
notifications: {
|
||||
playSound:
|
||||
typeof notifications.playSound === "boolean"
|
||||
@@ -181,6 +201,10 @@ function mergeDesktopSettings(
|
||||
): DesktopSettings {
|
||||
return {
|
||||
releaseChannel: updates.releaseChannel ?? current.releaseChannel,
|
||||
updates: {
|
||||
...current.updates,
|
||||
...updates.updates,
|
||||
},
|
||||
notifications: {
|
||||
...current.notifications,
|
||||
...updates.notifications,
|
||||
@@ -195,6 +219,7 @@ function mergeDesktopSettings(
|
||||
function normalizePatch(updates: DesktopSettingsPatch): Record<string, unknown> {
|
||||
return {
|
||||
...(updates.releaseChannel ? { releaseChannel: updates.releaseChannel } : {}),
|
||||
...(updates.updates ? { updates: updates.updates } : {}),
|
||||
...(updates.notifications ? { notifications: updates.notifications } : {}),
|
||||
...(updates.daemon ? { daemon: updates.daemon } : {}),
|
||||
};
|
||||
|
||||
@@ -128,6 +128,43 @@ describe("desktop app updater — check", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("reports 'available' when an update is available to download without auto-downloading", async () => {
|
||||
const { updater, port } = createUpdater({ now: () => 42 });
|
||||
port.nextCheckResult(
|
||||
buildFakeCheckResult({
|
||||
hasUpdate: true,
|
||||
readyToInstall: false,
|
||||
downloading: false,
|
||||
latestVersion: "1.2.3",
|
||||
}),
|
||||
);
|
||||
|
||||
await updater.checkForUpdates({ releaseChannel: "stable" });
|
||||
|
||||
expect(updater.getSnapshot()).toMatchObject({
|
||||
status: "available",
|
||||
availableUpdate: { latestVersion: "1.2.3", readyToInstall: false, downloading: false },
|
||||
lastCheckedAt: 42,
|
||||
});
|
||||
});
|
||||
|
||||
it("tracks download progress updates and clears them once install completes", async () => {
|
||||
const { updater, port } = createUpdater();
|
||||
port.nextInstallResult(buildFakeInstallResult({ installed: true }));
|
||||
|
||||
updater.setDownloadProgress({
|
||||
version: "1.2.3",
|
||||
percent: 42.4,
|
||||
transferred: 42,
|
||||
total: 100,
|
||||
bytesPerSecond: 10,
|
||||
});
|
||||
expect(updater.getSnapshot().downloadProgress?.percent).toBe(42.4);
|
||||
|
||||
await updater.installUpdate({ releaseChannel: "stable" });
|
||||
expect(updater.getSnapshot().downloadProgress).toBeNull();
|
||||
});
|
||||
|
||||
it("reports 'up-to-date' when the check resolves with no update", async () => {
|
||||
const { updater, port } = createUpdater();
|
||||
port.nextCheckResult(buildFakeCheckResult({ hasUpdate: false, readyToInstall: false }));
|
||||
@@ -340,6 +377,55 @@ describe("desktop app updater — install", () => {
|
||||
expect(updater.getSnapshot().status).toBe("up-to-date");
|
||||
});
|
||||
|
||||
it("moves to 'error' instead of 'up-to-date' when the install returns an errorMessage", async () => {
|
||||
const { updater, port } = createUpdater();
|
||||
port.nextInstallResult(
|
||||
buildFakeInstallResult({
|
||||
installed: false,
|
||||
message: "Update failed: ECONNRESET",
|
||||
errorMessage: "ECONNRESET",
|
||||
}),
|
||||
);
|
||||
|
||||
await updater.installUpdate({ releaseChannel: "stable" });
|
||||
|
||||
expect(updater.getSnapshot()).toMatchObject({
|
||||
status: "error",
|
||||
errorMessage: "ECONNRESET",
|
||||
downloadProgress: null,
|
||||
isInstalling: false,
|
||||
});
|
||||
});
|
||||
|
||||
it("ignores duplicate install requests and silent checks while an install is in progress", async () => {
|
||||
const { updater, port } = createUpdater();
|
||||
let resolveInstall!: (result: ReturnType<typeof buildFakeInstallResult>) => void;
|
||||
port.installDesktopAppUpdate = async (input) => {
|
||||
port.recordedInstalls.push(input);
|
||||
return new Promise((resolve) => {
|
||||
resolveInstall = resolve;
|
||||
});
|
||||
};
|
||||
|
||||
const firstInstall = updater.installUpdate({ releaseChannel: "stable" });
|
||||
const secondInstall = await updater.installUpdate({ releaseChannel: "stable" });
|
||||
const silentCheck = await updater.checkForUpdates({
|
||||
releaseChannel: "stable",
|
||||
intent: "automatic",
|
||||
silent: true,
|
||||
});
|
||||
|
||||
expect(secondInstall).toBeNull();
|
||||
expect(silentCheck).toBeNull();
|
||||
expect(port.recordedInstalls).toHaveLength(1);
|
||||
expect(port.recordedChecks).toHaveLength(0);
|
||||
expect(updater.getSnapshot().status).toBe("installing");
|
||||
|
||||
resolveInstall(buildFakeInstallResult({ installed: true }));
|
||||
await firstInstall;
|
||||
expect(updater.getSnapshot().status).toBe("installed");
|
||||
});
|
||||
|
||||
it("reports the install error and moves to 'error' when the install throws", async () => {
|
||||
const { updater, port, reportedInstallErrors } = createUpdater();
|
||||
const error = new Error("install failed");
|
||||
@@ -462,6 +548,47 @@ describe("formatStatusText", () => {
|
||||
).toBe("Restart now");
|
||||
});
|
||||
|
||||
it("formats download-available and live download progress status text", () => {
|
||||
expect(
|
||||
formatStatusText({
|
||||
status: "available",
|
||||
availableUpdate: buildFakeCheckResult({
|
||||
hasUpdate: true,
|
||||
readyToInstall: false,
|
||||
downloading: false,
|
||||
latestVersion: "1.2.3",
|
||||
}),
|
||||
installMessage: null,
|
||||
lastCheckedAt: 42,
|
||||
formatVersion,
|
||||
formatLastCheckedAt,
|
||||
}),
|
||||
).toBe("Update available: v1.2.3. Last checked at time-42.");
|
||||
|
||||
expect(
|
||||
formatStatusText({
|
||||
status: "installing",
|
||||
availableUpdate: buildFakeCheckResult({
|
||||
hasUpdate: true,
|
||||
readyToInstall: false,
|
||||
downloading: false,
|
||||
latestVersion: "1.2.3",
|
||||
}),
|
||||
downloadProgress: {
|
||||
version: "1.2.3",
|
||||
percent: 64.6,
|
||||
transferred: 65,
|
||||
total: 100,
|
||||
bytesPerSecond: 10,
|
||||
},
|
||||
installMessage: null,
|
||||
lastCheckedAt: null,
|
||||
formatVersion,
|
||||
formatLastCheckedAt,
|
||||
}),
|
||||
).toBe("Downloading v1.2.3... 65%");
|
||||
});
|
||||
|
||||
it("uses the active app language for local status wrappers", async () => {
|
||||
await i18n.changeLanguage("zh-CN");
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type {
|
||||
DesktopAppUpdateCheckResult,
|
||||
DesktopAppUpdateCheckIntent,
|
||||
DesktopAppUpdateDownloadProgress,
|
||||
DesktopAppUpdateInstallResult,
|
||||
DesktopReleaseChannel,
|
||||
} from "@/desktop/updates/desktop-updates";
|
||||
@@ -21,6 +22,7 @@ export const PENDING_RECHECK_MS = 10_000;
|
||||
export interface DesktopAppUpdaterSnapshot {
|
||||
status: DesktopAppUpdateStatus;
|
||||
availableUpdate: DesktopAppUpdateCheckResult | null;
|
||||
downloadProgress: DesktopAppUpdateDownloadProgress | null;
|
||||
errorMessage: string | null;
|
||||
installMessage: string | null;
|
||||
lastCheckedAt: number | null;
|
||||
@@ -53,6 +55,7 @@ export interface DesktopAppUpdaterDeps {
|
||||
export interface DesktopAppUpdater {
|
||||
getSnapshot(): DesktopAppUpdaterSnapshot;
|
||||
subscribe(listener: () => void): () => void;
|
||||
setDownloadProgress(progress: DesktopAppUpdateDownloadProgress | null): void;
|
||||
checkForUpdates(options?: {
|
||||
releaseChannel: DesktopReleaseChannel;
|
||||
intent?: DesktopAppUpdateCheckIntent;
|
||||
@@ -66,6 +69,7 @@ export interface DesktopAppUpdater {
|
||||
interface InternalState {
|
||||
status: DesktopAppUpdateStatus;
|
||||
availableUpdate: DesktopAppUpdateCheckResult | null;
|
||||
downloadProgress: DesktopAppUpdateDownloadProgress | null;
|
||||
errorMessage: string | null;
|
||||
installMessage: string | null;
|
||||
lastCheckedAt: number | null;
|
||||
@@ -76,6 +80,7 @@ interface InternalState {
|
||||
const INITIAL_STATE: InternalState = {
|
||||
status: "idle",
|
||||
availableUpdate: null,
|
||||
downloadProgress: null,
|
||||
errorMessage: null,
|
||||
installMessage: null,
|
||||
lastCheckedAt: null,
|
||||
@@ -87,6 +92,7 @@ function buildSnapshot(state: InternalState): DesktopAppUpdaterSnapshot {
|
||||
return {
|
||||
status: state.status,
|
||||
availableUpdate: state.availableUpdate,
|
||||
downloadProgress: state.downloadProgress,
|
||||
errorMessage: state.errorMessage,
|
||||
installMessage: state.installMessage,
|
||||
lastCheckedAt: state.lastCheckedAt,
|
||||
@@ -102,9 +108,113 @@ function getErrorMessage(error: unknown): string {
|
||||
return String(error);
|
||||
}
|
||||
|
||||
function formatInstallingStatusText(input: {
|
||||
availableUpdate: DesktopAppUpdateCheckResult | null;
|
||||
downloadProgress: DesktopAppUpdateDownloadProgress | null;
|
||||
formatVersion: (version: string | null | undefined) => string;
|
||||
}): string {
|
||||
const { availableUpdate, downloadProgress, formatVersion } = input;
|
||||
if (downloadProgress == null) {
|
||||
return i18n.t("desktop.updates.status.installing");
|
||||
}
|
||||
const percent = Math.round(downloadProgress.percent);
|
||||
const version = downloadProgress.version ?? availableUpdate?.latestVersion;
|
||||
if (version) {
|
||||
return i18n.t("desktop.updates.status.downloadingVersionProgress", {
|
||||
version: formatVersion(version),
|
||||
percent,
|
||||
});
|
||||
}
|
||||
return i18n.t("desktop.updates.status.downloadingProgress", { percent });
|
||||
}
|
||||
|
||||
function formatPendingStatusText(input: {
|
||||
availableUpdate: DesktopAppUpdateCheckResult | null;
|
||||
downloadProgress: DesktopAppUpdateDownloadProgress | null;
|
||||
lastCheckedAt: number | null;
|
||||
formatVersion: (version: string | null | undefined) => string;
|
||||
formatLastCheckedAt: (timestamp: number) => string;
|
||||
}): string {
|
||||
const { availableUpdate, downloadProgress, lastCheckedAt, formatVersion, formatLastCheckedAt } =
|
||||
input;
|
||||
const time = lastCheckedAt != null ? formatLastCheckedAt(lastCheckedAt) : undefined;
|
||||
if (availableUpdate?.latestVersion) {
|
||||
const version = formatVersion(availableUpdate.latestVersion);
|
||||
if (downloadProgress != null) {
|
||||
return i18n.t(
|
||||
time !== undefined
|
||||
? "desktop.updates.status.pendingWithVersionProgressAndLastChecked"
|
||||
: "desktop.updates.status.pendingWithVersionProgress",
|
||||
{ version, percent: Math.round(downloadProgress.percent), time },
|
||||
);
|
||||
}
|
||||
return i18n.t(
|
||||
time !== undefined
|
||||
? "desktop.updates.status.pendingWithVersionAndLastChecked"
|
||||
: "desktop.updates.status.pendingWithVersion",
|
||||
{ version, time },
|
||||
);
|
||||
}
|
||||
if (time !== undefined) {
|
||||
return i18n.t("desktop.updates.status.pendingWithLastChecked", { time });
|
||||
}
|
||||
return i18n.t("desktop.updates.status.pending");
|
||||
}
|
||||
|
||||
function formatAvailableStatusText(input: {
|
||||
availableUpdate: DesktopAppUpdateCheckResult | null;
|
||||
lastCheckedAt: number | null;
|
||||
formatVersion: (version: string | null | undefined) => string;
|
||||
formatLastCheckedAt: (timestamp: number) => string;
|
||||
}): string {
|
||||
const { availableUpdate, lastCheckedAt, formatVersion, formatLastCheckedAt } = input;
|
||||
const time = lastCheckedAt != null ? formatLastCheckedAt(lastCheckedAt) : undefined;
|
||||
const isDownloadRequired =
|
||||
availableUpdate?.hasUpdate === true && availableUpdate.readyToInstall === false;
|
||||
if (availableUpdate?.latestVersion) {
|
||||
const version = formatVersion(availableUpdate.latestVersion);
|
||||
if (isDownloadRequired) {
|
||||
return i18n.t(
|
||||
time !== undefined
|
||||
? "desktop.updates.status.downloadAvailableWithVersionAndLastChecked"
|
||||
: "desktop.updates.status.downloadAvailableWithVersion",
|
||||
{ version, time },
|
||||
);
|
||||
}
|
||||
return i18n.t(
|
||||
time !== undefined
|
||||
? "desktop.updates.status.availableWithVersionAndLastChecked"
|
||||
: "desktop.updates.status.availableWithVersion",
|
||||
{ version, time },
|
||||
);
|
||||
}
|
||||
if (isDownloadRequired) {
|
||||
return time !== undefined
|
||||
? i18n.t("desktop.updates.status.downloadAvailableWithLastChecked", { time })
|
||||
: i18n.t("desktop.updates.status.downloadAvailable");
|
||||
}
|
||||
return time !== undefined
|
||||
? i18n.t("desktop.updates.status.availableWithLastChecked", { time })
|
||||
: i18n.t("desktop.updates.status.available");
|
||||
}
|
||||
|
||||
function resolveCheckOutcome(result: DesktopAppUpdateCheckResult): {
|
||||
status: DesktopAppUpdateStatus;
|
||||
availableUpdate: DesktopAppUpdateCheckResult | null;
|
||||
} {
|
||||
if (result.readyToInstall || (result.hasUpdate && !result.downloading)) {
|
||||
return { status: "available", availableUpdate: result };
|
||||
}
|
||||
if (result.hasUpdate) {
|
||||
return { status: "pending", availableUpdate: result };
|
||||
}
|
||||
return { status: "up-to-date", availableUpdate: null };
|
||||
}
|
||||
|
||||
export function formatStatusText(input: {
|
||||
status: DesktopAppUpdateStatus;
|
||||
availableUpdate: DesktopAppUpdateCheckResult | null;
|
||||
downloadProgress?: DesktopAppUpdateDownloadProgress | null;
|
||||
installMessage: string | null;
|
||||
lastCheckedAt: number | null;
|
||||
formatVersion: (version: string | null | undefined) => string;
|
||||
@@ -113,79 +223,45 @@ export function formatStatusText(input: {
|
||||
const {
|
||||
status,
|
||||
availableUpdate,
|
||||
downloadProgress = null,
|
||||
installMessage,
|
||||
lastCheckedAt,
|
||||
formatVersion,
|
||||
formatLastCheckedAt,
|
||||
} = input;
|
||||
|
||||
if (status === "checking") {
|
||||
return i18n.t("desktop.updates.status.checking");
|
||||
}
|
||||
|
||||
if (status === "checking") return i18n.t("desktop.updates.status.checking");
|
||||
if (status === "installing") {
|
||||
return i18n.t("desktop.updates.status.installing");
|
||||
return formatInstallingStatusText({ availableUpdate, downloadProgress, formatVersion });
|
||||
}
|
||||
|
||||
if (status === "up-to-date") {
|
||||
if (lastCheckedAt != null) {
|
||||
return i18n.t("desktop.updates.status.upToDateWithLastChecked", {
|
||||
time: formatLastCheckedAt(lastCheckedAt),
|
||||
});
|
||||
}
|
||||
return i18n.t("desktop.updates.status.upToDate");
|
||||
return lastCheckedAt != null
|
||||
? i18n.t("desktop.updates.status.upToDateWithLastChecked", {
|
||||
time: formatLastCheckedAt(lastCheckedAt),
|
||||
})
|
||||
: i18n.t("desktop.updates.status.upToDate");
|
||||
}
|
||||
|
||||
if (status === "pending") {
|
||||
if (availableUpdate?.latestVersion) {
|
||||
return i18n.t(
|
||||
lastCheckedAt != null
|
||||
? "desktop.updates.status.pendingWithVersionAndLastChecked"
|
||||
: "desktop.updates.status.pendingWithVersion",
|
||||
{
|
||||
version: formatVersion(availableUpdate.latestVersion),
|
||||
time: lastCheckedAt != null ? formatLastCheckedAt(lastCheckedAt) : undefined,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
if (lastCheckedAt != null) {
|
||||
return i18n.t("desktop.updates.status.pendingWithLastChecked", {
|
||||
time: formatLastCheckedAt(lastCheckedAt),
|
||||
});
|
||||
}
|
||||
return i18n.t("desktop.updates.status.pending");
|
||||
return formatPendingStatusText({
|
||||
availableUpdate,
|
||||
downloadProgress,
|
||||
lastCheckedAt,
|
||||
formatVersion,
|
||||
formatLastCheckedAt,
|
||||
});
|
||||
}
|
||||
|
||||
if (status === "available") {
|
||||
if (availableUpdate?.latestVersion) {
|
||||
return i18n.t(
|
||||
lastCheckedAt != null
|
||||
? "desktop.updates.status.availableWithVersionAndLastChecked"
|
||||
: "desktop.updates.status.availableWithVersion",
|
||||
{
|
||||
version: formatVersion(availableUpdate.latestVersion),
|
||||
time: lastCheckedAt != null ? formatLastCheckedAt(lastCheckedAt) : undefined,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
if (lastCheckedAt != null) {
|
||||
return i18n.t("desktop.updates.status.availableWithLastChecked", {
|
||||
time: formatLastCheckedAt(lastCheckedAt),
|
||||
});
|
||||
}
|
||||
return i18n.t("desktop.updates.status.available");
|
||||
return formatAvailableStatusText({
|
||||
availableUpdate,
|
||||
lastCheckedAt,
|
||||
formatVersion,
|
||||
formatLastCheckedAt,
|
||||
});
|
||||
}
|
||||
|
||||
if (status === "installed") {
|
||||
return installMessage ?? i18n.t("desktop.updates.status.installed");
|
||||
}
|
||||
|
||||
if (status === "error") {
|
||||
return i18n.t("desktop.updates.status.failed");
|
||||
}
|
||||
|
||||
if (status === "error") return i18n.t("desktop.updates.status.failed");
|
||||
return i18n.t("desktop.updates.status.idle");
|
||||
}
|
||||
|
||||
@@ -202,6 +278,16 @@ export function createDesktopAppUpdater(deps: DesktopAppUpdaterDeps): DesktopApp
|
||||
}
|
||||
}
|
||||
|
||||
function setDownloadProgress(progress: DesktopAppUpdateDownloadProgress | null): void {
|
||||
if (progress === null && state.downloadProgress === null) {
|
||||
return;
|
||||
}
|
||||
commit({
|
||||
...state,
|
||||
downloadProgress: progress,
|
||||
});
|
||||
}
|
||||
|
||||
async function checkForUpdates(options?: {
|
||||
releaseChannel: DesktopReleaseChannel;
|
||||
intent?: DesktopAppUpdateCheckIntent;
|
||||
@@ -211,7 +297,7 @@ export function createDesktopAppUpdater(deps: DesktopAppUpdaterDeps): DesktopApp
|
||||
return null;
|
||||
}
|
||||
const { releaseChannel, intent = "manual", silent = false } = options;
|
||||
if (silent && state.status === "checking") {
|
||||
if (silent && (state.status === "checking" || state.isInstalling)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -241,6 +327,7 @@ export function createDesktopAppUpdater(deps: DesktopAppUpdaterDeps): DesktopApp
|
||||
...state,
|
||||
status: "error",
|
||||
availableUpdate: null,
|
||||
downloadProgress: null,
|
||||
errorMessage: result.errorMessage,
|
||||
installMessage: null,
|
||||
lastCheckedAt: nextLastCheckedAt,
|
||||
@@ -248,24 +335,13 @@ export function createDesktopAppUpdater(deps: DesktopAppUpdaterDeps): DesktopApp
|
||||
return result;
|
||||
}
|
||||
|
||||
let nextStatus: DesktopAppUpdateStatus;
|
||||
let nextAvailable: DesktopAppUpdateCheckResult | null;
|
||||
|
||||
if (result.readyToInstall) {
|
||||
nextStatus = "available";
|
||||
nextAvailable = result;
|
||||
} else if (result.hasUpdate) {
|
||||
nextStatus = "pending";
|
||||
nextAvailable = result;
|
||||
} else {
|
||||
nextStatus = "up-to-date";
|
||||
nextAvailable = null;
|
||||
}
|
||||
const outcome = resolveCheckOutcome(result);
|
||||
|
||||
commit({
|
||||
...state,
|
||||
status: nextStatus,
|
||||
availableUpdate: nextAvailable,
|
||||
status: outcome.status,
|
||||
availableUpdate: outcome.availableUpdate,
|
||||
downloadProgress: outcome.status === "pending" ? state.downloadProgress : null,
|
||||
errorMessage: null,
|
||||
installMessage: null,
|
||||
lastCheckedAt: nextLastCheckedAt,
|
||||
@@ -284,6 +360,7 @@ export function createDesktopAppUpdater(deps: DesktopAppUpdaterDeps): DesktopApp
|
||||
commit({
|
||||
...state,
|
||||
status: "error",
|
||||
downloadProgress: null,
|
||||
errorMessage: message,
|
||||
lastCheckedAt: intent === "manual" ? deps.now() : state.lastCheckedAt,
|
||||
});
|
||||
@@ -295,6 +372,10 @@ export function createDesktopAppUpdater(deps: DesktopAppUpdaterDeps): DesktopApp
|
||||
async function installUpdate(options: {
|
||||
releaseChannel: DesktopReleaseChannel;
|
||||
}): Promise<DesktopAppUpdateInstallResult | null> {
|
||||
if (state.isInstalling) {
|
||||
return null;
|
||||
}
|
||||
|
||||
commit({
|
||||
...state,
|
||||
status: "installing",
|
||||
@@ -307,10 +388,23 @@ export function createDesktopAppUpdater(deps: DesktopAppUpdaterDeps): DesktopApp
|
||||
releaseChannel: options.releaseChannel,
|
||||
});
|
||||
const nextLastCheckedAt = deps.now();
|
||||
if (!result.installed && result.errorMessage) {
|
||||
commit({
|
||||
...state,
|
||||
status: "error",
|
||||
downloadProgress: null,
|
||||
errorMessage: result.errorMessage,
|
||||
installMessage: null,
|
||||
lastCheckedAt: nextLastCheckedAt,
|
||||
isInstalling: false,
|
||||
});
|
||||
return result;
|
||||
}
|
||||
commit({
|
||||
...state,
|
||||
status: result.installed ? "installed" : "up-to-date",
|
||||
availableUpdate: null,
|
||||
downloadProgress: null,
|
||||
installMessage: result.message,
|
||||
lastCheckedAt: nextLastCheckedAt,
|
||||
isInstalling: false,
|
||||
@@ -326,6 +420,7 @@ export function createDesktopAppUpdater(deps: DesktopAppUpdaterDeps): DesktopApp
|
||||
commit({
|
||||
...state,
|
||||
status: "error",
|
||||
downloadProgress: null,
|
||||
errorMessage: message,
|
||||
isInstalling: false,
|
||||
});
|
||||
@@ -341,6 +436,7 @@ export function createDesktopAppUpdater(deps: DesktopAppUpdaterDeps): DesktopApp
|
||||
listeners.delete(listener);
|
||||
};
|
||||
},
|
||||
setDownloadProgress,
|
||||
checkForUpdates,
|
||||
installUpdate,
|
||||
};
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
import { isElectronRuntime } from "@/desktop/host";
|
||||
import { listenToDesktopEvent, type DesktopEventUnlisten } from "@/desktop/electron/events";
|
||||
import { invokeDesktopCommand } from "@/desktop/electron/invoke";
|
||||
import { isWeb } from "@/constants/platform";
|
||||
import { i18n } from "@/i18n/i18next";
|
||||
|
||||
export interface DesktopAppUpdateDownloadProgress {
|
||||
version: string | null;
|
||||
percent: number;
|
||||
transferred: number;
|
||||
total: number;
|
||||
bytesPerSecond: number;
|
||||
}
|
||||
|
||||
export interface DesktopAppUpdateCheckResult {
|
||||
hasUpdate: boolean;
|
||||
readyToInstall: boolean;
|
||||
downloading: boolean;
|
||||
currentVersion: string | null;
|
||||
latestVersion: string | null;
|
||||
body: string | null;
|
||||
@@ -17,6 +27,7 @@ export interface DesktopAppUpdateInstallResult {
|
||||
installed: boolean;
|
||||
version: string | null;
|
||||
message: string;
|
||||
errorMessage?: string | null;
|
||||
}
|
||||
|
||||
export interface DesktopRuntimeInfo {
|
||||
@@ -115,9 +126,13 @@ export async function checkDesktopAppUpdate({
|
||||
throw new Error("Unexpected response while checking desktop updates.");
|
||||
}
|
||||
|
||||
const hasUpdate = result.hasUpdate === true;
|
||||
const readyToInstall = result.readyToInstall === true;
|
||||
return {
|
||||
hasUpdate: result.hasUpdate === true,
|
||||
readyToInstall: result.readyToInstall === true,
|
||||
hasUpdate,
|
||||
readyToInstall,
|
||||
downloading:
|
||||
typeof result.downloading === "boolean" ? result.downloading : hasUpdate && !readyToInstall,
|
||||
currentVersion: toStringOrNull(result.currentVersion),
|
||||
latestVersion: toStringOrNull(result.latestVersion),
|
||||
body: toStringOrNull(result.body),
|
||||
@@ -126,6 +141,36 @@ export async function checkDesktopAppUpdate({
|
||||
};
|
||||
}
|
||||
|
||||
export function parseDesktopAppUpdateDownloadProgress(
|
||||
raw: unknown,
|
||||
): DesktopAppUpdateDownloadProgress | null {
|
||||
if (!isRecord(raw)) {
|
||||
return null;
|
||||
}
|
||||
const percent = toNumberOr(Number.NaN, raw.percent);
|
||||
if (!Number.isFinite(percent)) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
version: toStringOrNull(raw.version),
|
||||
percent: Math.max(0, Math.min(100, percent)),
|
||||
transferred: toNumberOr(0, raw.transferred),
|
||||
total: toNumberOr(0, raw.total),
|
||||
bytesPerSecond: toNumberOr(0, raw.bytesPerSecond),
|
||||
};
|
||||
}
|
||||
|
||||
export async function subscribeDesktopAppUpdateDownloadProgress(
|
||||
handler: (progress: DesktopAppUpdateDownloadProgress | null) => void,
|
||||
): Promise<DesktopEventUnlisten> {
|
||||
if (!shouldShowDesktopUpdateSection()) {
|
||||
return () => {};
|
||||
}
|
||||
return listenToDesktopEvent<unknown>("app-update-download-progress", (payload) => {
|
||||
handler(payload === null ? null : parseDesktopAppUpdateDownloadProgress(payload));
|
||||
});
|
||||
}
|
||||
|
||||
export async function installDesktopAppUpdate({
|
||||
releaseChannel,
|
||||
}: {
|
||||
@@ -136,10 +181,12 @@ export async function installDesktopAppUpdate({
|
||||
throw new Error("Unexpected response while installing desktop update.");
|
||||
}
|
||||
|
||||
const errorMessage = toStringOrNull(result.errorMessage);
|
||||
return {
|
||||
installed: result.installed === true,
|
||||
version: toStringOrNull(result.version),
|
||||
message: toStringOrNull(result.message) ?? i18n.t("desktop.updates.status.installed"),
|
||||
...(errorMessage ? { errorMessage } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,50 @@ describe("resolveUpdateCalloutDescriptor", () => {
|
||||
expect(descriptor?.dismissalKey).toBe("desktop-update:installing:1.2.3");
|
||||
});
|
||||
|
||||
it("labels the callout as Download when the update has not been downloaded yet", () => {
|
||||
const descriptor = resolveUpdateCalloutDescriptor(
|
||||
input({ availableUpdate: { latestVersion: "1.2.3", readyToInstall: false } }),
|
||||
);
|
||||
|
||||
expect(descriptor?.title).toBe("Update available");
|
||||
expect(descriptor?.body).toEqual({
|
||||
kind: "available",
|
||||
versionLabel: "v1.2.3",
|
||||
readyToInstall: false,
|
||||
});
|
||||
expect(descriptor?.actions).toEqual([
|
||||
{ role: "changelog", label: "What's new" },
|
||||
{ role: "install", label: "Download", variant: "primary", disabled: false },
|
||||
]);
|
||||
});
|
||||
|
||||
it("shows download progress while downloading an update", () => {
|
||||
const descriptor = resolveUpdateCalloutDescriptor(
|
||||
input({
|
||||
status: "installing",
|
||||
isInstalling: true,
|
||||
downloadProgress: {
|
||||
version: "1.2.3",
|
||||
percent: 42.2,
|
||||
transferred: 42,
|
||||
total: 100,
|
||||
bytesPerSecond: 10,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect(descriptor?.title).toBe("Downloading update");
|
||||
expect(descriptor?.body).toEqual({
|
||||
kind: "downloading",
|
||||
versionLabel: "v1.2.3",
|
||||
percent: 42,
|
||||
});
|
||||
expect(descriptor?.actions).toEqual([
|
||||
{ role: "changelog", label: "What's new" },
|
||||
{ role: "install", label: "Downloading...", variant: "primary", disabled: true },
|
||||
]);
|
||||
});
|
||||
|
||||
it("shows a retry action and surfaces the error message on error", () => {
|
||||
const descriptor = resolveUpdateCalloutDescriptor(
|
||||
input({ status: "error", errorMessage: "Download failed", availableUpdate: null }),
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import type { DesktopAppUpdateStatus } from "@/desktop/updates/use-desktop-app-updater";
|
||||
import type { DesktopAppUpdateDownloadProgress } from "@/desktop/updates/desktop-updates";
|
||||
import { i18n } from "@/i18n/i18next";
|
||||
|
||||
export type UpdateCalloutBody =
|
||||
| { kind: "available"; versionLabel: string | null }
|
||||
| { kind: "available"; versionLabel: string | null; readyToInstall?: boolean }
|
||||
| { kind: "downloading"; versionLabel: string | null; percent: number }
|
||||
| { kind: "installing" }
|
||||
| { kind: "error"; message: string };
|
||||
|
||||
@@ -31,7 +33,8 @@ export interface ResolveUpdateCalloutInput {
|
||||
isDesktopApp: boolean;
|
||||
status: DesktopAppUpdateStatus;
|
||||
isInstalling: boolean;
|
||||
availableUpdate: { latestVersion?: string | null } | null;
|
||||
availableUpdate: { latestVersion?: string | null; readyToInstall?: boolean } | null;
|
||||
downloadProgress?: DesktopAppUpdateDownloadProgress | null;
|
||||
errorMessage: string | null;
|
||||
}
|
||||
|
||||
@@ -40,6 +43,59 @@ function formatVersionLabel(latestVersion: string | null | undefined): string |
|
||||
return `v${latestVersion.replace(/^v/i, "")}`;
|
||||
}
|
||||
|
||||
function resolveCalloutPresentation(input: {
|
||||
isError: boolean;
|
||||
isInstalling: boolean;
|
||||
readyToInstall: boolean;
|
||||
latestVersion: string | null;
|
||||
downloadProgress: DesktopAppUpdateDownloadProgress | null | undefined;
|
||||
errorMessage: string | null;
|
||||
}): { title: string; body: UpdateCalloutBody } {
|
||||
if (input.isInstalling && input.downloadProgress != null) {
|
||||
return {
|
||||
title: i18n.t("desktop.updates.callout.downloadingTitle"),
|
||||
body: {
|
||||
kind: "downloading",
|
||||
versionLabel: formatVersionLabel(input.latestVersion),
|
||||
percent: Math.round(input.downloadProgress.percent),
|
||||
},
|
||||
};
|
||||
}
|
||||
if (input.isInstalling) {
|
||||
return {
|
||||
title: i18n.t("desktop.updates.callout.installingTitle"),
|
||||
body: { kind: "installing" },
|
||||
};
|
||||
}
|
||||
if (input.isError) {
|
||||
return {
|
||||
title: i18n.t("desktop.updates.callout.failedTitle"),
|
||||
body: {
|
||||
kind: "error",
|
||||
message: input.errorMessage ?? i18n.t("desktop.updates.callout.genericError"),
|
||||
},
|
||||
};
|
||||
}
|
||||
const versionLabel = formatVersionLabel(input.latestVersion);
|
||||
return {
|
||||
title: i18n.t("desktop.updates.callout.availableTitle"),
|
||||
body: input.readyToInstall
|
||||
? { kind: "available", versionLabel }
|
||||
: { kind: "available", versionLabel, readyToInstall: false },
|
||||
};
|
||||
}
|
||||
|
||||
function resolveInstallActionLabel(input: {
|
||||
isDownloading: boolean;
|
||||
isInstalling: boolean;
|
||||
readyToInstall: boolean;
|
||||
}): string {
|
||||
if (input.isDownloading) return i18n.t("desktop.updates.callout.downloadingAction");
|
||||
if (input.isInstalling) return i18n.t("desktop.updates.callout.installingAction");
|
||||
if (input.readyToInstall) return i18n.t("desktop.updates.callout.installAndRestart");
|
||||
return i18n.t("desktop.updates.callout.downloadAndRestart");
|
||||
}
|
||||
|
||||
export function resolveUpdateCalloutDescriptor(
|
||||
input: ResolveUpdateCalloutInput,
|
||||
): UpdateCalloutDescriptor | null {
|
||||
@@ -50,26 +106,22 @@ export function resolveUpdateCalloutDescriptor(
|
||||
|
||||
const isError = input.status === "error";
|
||||
const isInstalling = input.isInstalling;
|
||||
const isDownloading = isInstalling && input.downloadProgress != null;
|
||||
const isAvailable = !isInstalling && !isError;
|
||||
const readyToInstall = input.availableUpdate?.readyToInstall !== false;
|
||||
|
||||
const latestVersion = input.availableUpdate?.latestVersion ?? null;
|
||||
const latestVersion =
|
||||
input.availableUpdate?.latestVersion ?? input.downloadProgress?.version ?? null;
|
||||
const dismissalKey = `desktop-update:${input.status}:${latestVersion ?? "unknown"}`;
|
||||
|
||||
let title: string;
|
||||
let body: UpdateCalloutBody;
|
||||
if (isInstalling) {
|
||||
title = i18n.t("desktop.updates.callout.installingTitle");
|
||||
body = { kind: "installing" };
|
||||
} else if (isError) {
|
||||
title = i18n.t("desktop.updates.callout.failedTitle");
|
||||
body = {
|
||||
kind: "error",
|
||||
message: input.errorMessage ?? i18n.t("desktop.updates.callout.genericError"),
|
||||
};
|
||||
} else {
|
||||
title = i18n.t("desktop.updates.callout.availableTitle");
|
||||
body = { kind: "available", versionLabel: formatVersionLabel(latestVersion) };
|
||||
}
|
||||
const { title, body } = resolveCalloutPresentation({
|
||||
isError,
|
||||
isInstalling,
|
||||
readyToInstall,
|
||||
latestVersion,
|
||||
downloadProgress: input.downloadProgress,
|
||||
errorMessage: input.errorMessage,
|
||||
});
|
||||
|
||||
const actions: UpdateCalloutActionDescriptor[] = [
|
||||
{ role: "changelog", label: i18n.t("desktop.updates.callout.whatsNew") },
|
||||
@@ -79,9 +131,7 @@ export function resolveUpdateCalloutDescriptor(
|
||||
} else {
|
||||
actions.push({
|
||||
role: "install",
|
||||
label: isInstalling
|
||||
? i18n.t("desktop.updates.callout.installingAction")
|
||||
: i18n.t("desktop.updates.callout.installAndRestart"),
|
||||
label: resolveInstallActionLabel({ isDownloading, isInstalling, readyToInstall }),
|
||||
variant: "primary",
|
||||
disabled: isInstalling,
|
||||
});
|
||||
|
||||
@@ -34,9 +34,12 @@ type InstallOutcome =
|
||||
function buildCheckResult(
|
||||
overrides: Partial<DesktopAppUpdateCheckResult> = {},
|
||||
): DesktopAppUpdateCheckResult {
|
||||
const hasUpdate = overrides.hasUpdate ?? false;
|
||||
const readyToInstall = overrides.readyToInstall ?? false;
|
||||
return {
|
||||
hasUpdate: false,
|
||||
readyToInstall: false,
|
||||
hasUpdate,
|
||||
readyToInstall,
|
||||
downloading: overrides.downloading ?? (hasUpdate && !readyToInstall),
|
||||
currentVersion: null,
|
||||
latestVersion: null,
|
||||
body: null,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Gift } from "lucide-react-native";
|
||||
import { type ReactNode, useEffect, useRef } from "react";
|
||||
import { type ReactNode, useEffect, useMemo, useRef } from "react";
|
||||
import { View } from "react-native";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useUnistyles } from "react-native-unistyles";
|
||||
import { StyleSheet, useUnistyles } from "react-native-unistyles";
|
||||
import {
|
||||
type SidebarCalloutAction,
|
||||
SidebarCalloutDescriptionText,
|
||||
@@ -19,9 +20,24 @@ import { openChangelog } from "@/changelog";
|
||||
const CHECK_INTERVAL_MS = 30 * 60 * 1000;
|
||||
|
||||
function renderBody(body: UpdateCalloutBody, t: ReturnType<typeof useTranslation>["t"]): ReactNode {
|
||||
if (body.kind === "downloading") {
|
||||
return (
|
||||
<UpdateDownloadingDescription
|
||||
versionLabel={body.versionLabel ?? undefined}
|
||||
percent={body.percent}
|
||||
t={t}
|
||||
/>
|
||||
);
|
||||
}
|
||||
if (body.kind === "installing") return t("desktop.updates.callout.installingDescription");
|
||||
if (body.kind === "error") return body.message;
|
||||
return <UpdateAvailableDescription versionLabel={body.versionLabel ?? undefined} t={t} />;
|
||||
return (
|
||||
<UpdateAvailableDescription
|
||||
versionLabel={body.versionLabel ?? undefined}
|
||||
readyToInstall={body.readyToInstall !== false}
|
||||
t={t}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function materializeActions(
|
||||
@@ -42,8 +58,11 @@ export function UpdateCalloutSource() {
|
||||
const { theme } = useUnistyles();
|
||||
const {
|
||||
isDesktopApp,
|
||||
updateMode,
|
||||
isLoadingSettings,
|
||||
status,
|
||||
availableUpdate,
|
||||
downloadProgress,
|
||||
errorMessage,
|
||||
checkForUpdates,
|
||||
installUpdate,
|
||||
@@ -58,7 +77,7 @@ export function UpdateCalloutSource() {
|
||||
void checkForUpdates();
|
||||
});
|
||||
useEffect(() => {
|
||||
if (!isDesktopApp) return;
|
||||
if (!isDesktopApp || isLoadingSettings || updateMode === "off") return;
|
||||
|
||||
void checkForUpdates({ intent: "automatic", silent: true });
|
||||
|
||||
@@ -71,7 +90,7 @@ export function UpdateCalloutSource() {
|
||||
clearInterval(intervalRef.current);
|
||||
}
|
||||
};
|
||||
}, [isDesktopApp, checkForUpdates]);
|
||||
}, [isDesktopApp, isLoadingSettings, updateMode, checkForUpdates]);
|
||||
|
||||
useEffect(() => {
|
||||
const descriptor = resolveUpdateCalloutDescriptor({
|
||||
@@ -79,6 +98,7 @@ export function UpdateCalloutSource() {
|
||||
status,
|
||||
isInstalling,
|
||||
availableUpdate,
|
||||
downloadProgress,
|
||||
errorMessage,
|
||||
});
|
||||
if (!descriptor) return;
|
||||
@@ -103,6 +123,7 @@ export function UpdateCalloutSource() {
|
||||
}, [
|
||||
availableUpdate,
|
||||
callouts,
|
||||
downloadProgress,
|
||||
errorMessage,
|
||||
install,
|
||||
isDesktopApp,
|
||||
@@ -117,23 +138,94 @@ export function UpdateCalloutSource() {
|
||||
return null;
|
||||
}
|
||||
|
||||
function formatAvailableSummary(
|
||||
t: ReturnType<typeof useTranslation>["t"],
|
||||
versionLabel: string | undefined,
|
||||
readyToInstall: boolean,
|
||||
): string {
|
||||
if (readyToInstall) {
|
||||
return versionLabel
|
||||
? t("desktop.updates.callout.versionReady", { version: versionLabel })
|
||||
: t("desktop.updates.callout.newVersionReady");
|
||||
}
|
||||
return versionLabel
|
||||
? t("desktop.updates.callout.versionAvailable", { version: versionLabel })
|
||||
: t("desktop.updates.callout.newVersionAvailable");
|
||||
}
|
||||
|
||||
function UpdateAvailableDescription({
|
||||
versionLabel,
|
||||
readyToInstall,
|
||||
t,
|
||||
}: {
|
||||
versionLabel?: string;
|
||||
readyToInstall: boolean;
|
||||
t: ReturnType<typeof useTranslation>["t"];
|
||||
}) {
|
||||
const summary = formatAvailableSummary(t, versionLabel, readyToInstall);
|
||||
|
||||
return (
|
||||
<>
|
||||
<SidebarCalloutDescriptionText>
|
||||
{versionLabel
|
||||
? t("desktop.updates.callout.versionReady", { version: versionLabel })
|
||||
: t("desktop.updates.callout.newVersionReady")}
|
||||
</SidebarCalloutDescriptionText>
|
||||
<SidebarCalloutDescriptionText>{summary}</SidebarCalloutDescriptionText>
|
||||
<SidebarCalloutDescriptionText>
|
||||
{t("desktop.updates.callout.restartWarning")}
|
||||
</SidebarCalloutDescriptionText>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function UpdateDownloadingDescription({
|
||||
versionLabel,
|
||||
percent,
|
||||
t,
|
||||
}: {
|
||||
versionLabel?: string;
|
||||
percent: number;
|
||||
t: ReturnType<typeof useTranslation>["t"];
|
||||
}) {
|
||||
const clampedPercent = Math.max(0, Math.min(100, percent));
|
||||
const accessibilityValue = useMemo(
|
||||
() => ({ min: 0, max: 100, now: clampedPercent }),
|
||||
[clampedPercent],
|
||||
);
|
||||
const progressFillStyle = useMemo(
|
||||
() => [styles.progressFill, { width: `${clampedPercent}%` as const }],
|
||||
[clampedPercent],
|
||||
);
|
||||
return (
|
||||
<View style={styles.progressContainer}>
|
||||
<SidebarCalloutDescriptionText>
|
||||
{versionLabel
|
||||
? t("desktop.updates.callout.downloadingVersionDescription", {
|
||||
version: versionLabel,
|
||||
percent: clampedPercent,
|
||||
})
|
||||
: t("desktop.updates.callout.downloadingDescription", { percent: clampedPercent })}
|
||||
</SidebarCalloutDescriptionText>
|
||||
<View
|
||||
style={styles.progressTrack}
|
||||
accessibilityRole="progressbar"
|
||||
accessibilityValue={accessibilityValue}
|
||||
>
|
||||
<View style={progressFillStyle} />
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
progressContainer: {
|
||||
gap: theme.spacing[2],
|
||||
},
|
||||
progressTrack: {
|
||||
height: 4,
|
||||
borderRadius: theme.borderRadius.full,
|
||||
backgroundColor: theme.colors.surface3,
|
||||
overflow: "hidden",
|
||||
},
|
||||
progressFill: {
|
||||
height: "100%",
|
||||
borderRadius: theme.borderRadius.full,
|
||||
backgroundColor: theme.colors.accent,
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -1,30 +1,94 @@
|
||||
import { useCallback, useEffect, useMemo, useSyncExternalStore } from "react";
|
||||
import { useCallback, useEffect, useSyncExternalStore } from "react";
|
||||
import {
|
||||
checkDesktopAppUpdate,
|
||||
formatVersionWithPrefix,
|
||||
installDesktopAppUpdate,
|
||||
shouldShowDesktopUpdateSection,
|
||||
subscribeDesktopAppUpdateDownloadProgress,
|
||||
type DesktopAppUpdateCheckResult,
|
||||
type DesktopAppUpdateCheckIntent,
|
||||
type DesktopAppUpdateDownloadProgress,
|
||||
type DesktopAppUpdateInstallResult,
|
||||
} from "@/desktop/updates/desktop-updates";
|
||||
import { useDesktopSettings } from "@/desktop/settings/desktop-settings";
|
||||
import { useDesktopSettings, type DesktopUpdateMode } from "@/desktop/settings/desktop-settings";
|
||||
import { useDesktopIpcErrorReporter } from "@/desktop/hooks/desktop-ipc-error";
|
||||
import {
|
||||
PENDING_RECHECK_MS,
|
||||
createDesktopAppUpdater,
|
||||
formatStatusText,
|
||||
type DesktopAppUpdater,
|
||||
type DesktopAppUpdaterErrorReport,
|
||||
type DesktopAppUpdateStatus,
|
||||
} from "@/desktop/updates/desktop-app-updater";
|
||||
import { formatMessageTimestamp } from "@/utils/time";
|
||||
|
||||
export type { DesktopAppUpdateStatus };
|
||||
|
||||
let activeInstallErrorReporter: ((report: DesktopAppUpdaterErrorReport) => void) | null = null;
|
||||
let sharedDesktopAppUpdater: DesktopAppUpdater | null = null;
|
||||
let progressSubscriptionCount = 0;
|
||||
let progressUnsubscribe: (() => void) | null = null;
|
||||
|
||||
function getSharedDesktopAppUpdater(): DesktopAppUpdater {
|
||||
if (!sharedDesktopAppUpdater) {
|
||||
sharedDesktopAppUpdater = createDesktopAppUpdater({
|
||||
port: {
|
||||
checkDesktopAppUpdate,
|
||||
installDesktopAppUpdate,
|
||||
},
|
||||
now: () => Date.now(),
|
||||
reportInstallError: (report) => {
|
||||
activeInstallErrorReporter?.(report);
|
||||
},
|
||||
});
|
||||
}
|
||||
return sharedDesktopAppUpdater;
|
||||
}
|
||||
|
||||
function retainDownloadProgressSubscription(updater: DesktopAppUpdater): () => void {
|
||||
progressSubscriptionCount += 1;
|
||||
if (progressSubscriptionCount === 1) {
|
||||
let active = true;
|
||||
const teardown = () => {
|
||||
active = false;
|
||||
};
|
||||
progressUnsubscribe = teardown;
|
||||
void subscribeDesktopAppUpdateDownloadProgress((progress) => {
|
||||
if (active) {
|
||||
updater.setDownloadProgress(progress);
|
||||
}
|
||||
})
|
||||
.then((cleanup) => {
|
||||
if (active) {
|
||||
progressUnsubscribe = () => {
|
||||
active = false;
|
||||
cleanup();
|
||||
};
|
||||
} else {
|
||||
cleanup();
|
||||
}
|
||||
return undefined;
|
||||
})
|
||||
.catch(() => undefined);
|
||||
}
|
||||
|
||||
return () => {
|
||||
progressSubscriptionCount = Math.max(0, progressSubscriptionCount - 1);
|
||||
if (progressSubscriptionCount === 0) {
|
||||
progressUnsubscribe?.();
|
||||
progressUnsubscribe = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export interface UseDesktopAppUpdaterReturn {
|
||||
isDesktopApp: boolean;
|
||||
updateMode: DesktopUpdateMode;
|
||||
isLoadingSettings: boolean;
|
||||
status: DesktopAppUpdateStatus;
|
||||
statusText: string;
|
||||
availableUpdate: DesktopAppUpdateCheckResult | null;
|
||||
downloadProgress: DesktopAppUpdateDownloadProgress | null;
|
||||
errorMessage: string | null;
|
||||
lastCheckedAt: number | null;
|
||||
isChecking: boolean;
|
||||
@@ -38,22 +102,15 @@ export interface UseDesktopAppUpdaterReturn {
|
||||
|
||||
export function useDesktopAppUpdater(): UseDesktopAppUpdaterReturn {
|
||||
const isDesktopApp = shouldShowDesktopUpdateSection();
|
||||
const { settings: desktopSettings } = useDesktopSettings();
|
||||
const { settings: desktopSettings, isLoading: isLoadingSettings } = useDesktopSettings();
|
||||
const releaseChannel = desktopSettings.releaseChannel;
|
||||
const updateMode = desktopSettings.updates.mode;
|
||||
const reportError = useDesktopIpcErrorReporter();
|
||||
const updater = getSharedDesktopAppUpdater();
|
||||
|
||||
const updater = useMemo(
|
||||
() =>
|
||||
createDesktopAppUpdater({
|
||||
port: {
|
||||
checkDesktopAppUpdate,
|
||||
installDesktopAppUpdate,
|
||||
},
|
||||
now: () => Date.now(),
|
||||
reportInstallError: reportError,
|
||||
}),
|
||||
[reportError],
|
||||
);
|
||||
useEffect(() => {
|
||||
activeInstallErrorReporter = reportError;
|
||||
}, [reportError]);
|
||||
|
||||
const snapshot = useSyncExternalStore(
|
||||
updater.subscribe,
|
||||
@@ -84,13 +141,20 @@ export function useDesktopAppUpdater(): UseDesktopAppUpdaterReturn {
|
||||
|
||||
useEffect(() => {
|
||||
if (!isDesktopApp) {
|
||||
return undefined;
|
||||
}
|
||||
return retainDownloadProgressSubscription(updater);
|
||||
}, [isDesktopApp, updater]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isDesktopApp || isLoadingSettings || updateMode === "off") {
|
||||
return;
|
||||
}
|
||||
void checkForUpdates({ intent: "automatic", silent: true });
|
||||
}, [checkForUpdates, isDesktopApp]);
|
||||
}, [checkForUpdates, isDesktopApp, isLoadingSettings, updateMode]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isDesktopApp || snapshot.status !== "pending") {
|
||||
if (!isDesktopApp || snapshot.status !== "pending" || updateMode === "off") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -101,20 +165,24 @@ export function useDesktopAppUpdater(): UseDesktopAppUpdaterReturn {
|
||||
return () => {
|
||||
clearInterval(intervalId);
|
||||
};
|
||||
}, [checkForUpdates, isDesktopApp, snapshot.status]);
|
||||
}, [checkForUpdates, isDesktopApp, snapshot.status, updateMode]);
|
||||
|
||||
return {
|
||||
isDesktopApp,
|
||||
updateMode,
|
||||
isLoadingSettings,
|
||||
status: snapshot.status,
|
||||
statusText: formatStatusText({
|
||||
status: snapshot.status,
|
||||
availableUpdate: snapshot.availableUpdate,
|
||||
downloadProgress: snapshot.downloadProgress,
|
||||
installMessage: snapshot.installMessage,
|
||||
lastCheckedAt: snapshot.lastCheckedAt,
|
||||
formatVersion: formatVersionWithPrefix,
|
||||
formatLastCheckedAt: (timestamp) => formatMessageTimestamp(new Date(timestamp)),
|
||||
}),
|
||||
availableUpdate: snapshot.availableUpdate,
|
||||
downloadProgress: snapshot.downloadProgress,
|
||||
errorMessage: snapshot.errorMessage,
|
||||
lastCheckedAt: snapshot.lastCheckedAt,
|
||||
isChecking: snapshot.isChecking,
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
export { PairDeviceModal } from "./pair-device-modal";
|
||||
export { WaysToConnect } from "./ways-to-connect";
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { AdaptiveModalSheet, type SheetHeader } from "@/components/adaptive-modal-sheet";
|
||||
import { PairDeviceSection } from "@/desktop/components/pair-device-section";
|
||||
import { PairDeviceSection } from "@/devices/pair-device-section";
|
||||
|
||||
export interface PairDeviceModalProps {
|
||||
serverId: string;
|
||||
+1
-1
@@ -23,7 +23,7 @@ import {
|
||||
|
||||
const RELAY_DOCS_URL = "https://paseo.sh/docs/security";
|
||||
export const CONNECTIVITY_DOCS_URL = "https://paseo.sh/docs/connectivity";
|
||||
export const TAILSCALE_DOCS_URL = `${CONNECTIVITY_DOCS_URL}#tailscale`;
|
||||
const TAILSCALE_DOCS_URL = `${CONNECTIVITY_DOCS_URL}#tailscale`;
|
||||
const FLEX_ONE_STYLE = { flex: 1 } as const;
|
||||
const ThemedLoadingSpinner = withUnistyles(LoadingSpinner);
|
||||
const ThemedShieldCheck = withUnistyles(ShieldCheck);
|
||||
@@ -0,0 +1,36 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { TailscaleStatus } from "@getpaseo/protocol/messages";
|
||||
import { i18n } from "@/i18n/i18next";
|
||||
import { describeTailscale } from "./tailscale-hint";
|
||||
|
||||
// Statuses as the host reports them; see `createDaemonListeners` in the server's listeners.ts.
|
||||
const off: TailscaleStatus = { ip: "100.101.102.103", address: null, state: "off" };
|
||||
|
||||
describe("the Tailscale row's hint", () => {
|
||||
it("says why Tailscale stays off when the host listens on a socket", () => {
|
||||
const socketHint = "Off, because this host listens on a local socket";
|
||||
expect(describeTailscale({ ...off, lockedBy: "main", mainIsSocket: true }, i18n.t)).toBe(
|
||||
socketHint,
|
||||
);
|
||||
expect(describeTailscale({ ...off, lockedBy: "launch", mainIsSocket: true }, i18n.t)).toBe(
|
||||
socketHint,
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps the hint of every other state", () => {
|
||||
const hint = (status: TailscaleStatus) => describeTailscale(status, i18n.t);
|
||||
expect(hint(off)).toBe("Direct over your tailnet, enter an address");
|
||||
expect(hint({ ip: null, address: null, state: "unavailable", lockedBy: "launch" })).toBe(
|
||||
"Tailscale is not running on this host",
|
||||
);
|
||||
expect(hint({ ...off, state: "waiting", address: "100.101.102.103:6767" })).toBe(
|
||||
"Waiting for Tailscale to start on this host",
|
||||
);
|
||||
expect(hint({ ...off, state: "on", address: "100.101.102.103:6767", lockedBy: "main" })).toBe(
|
||||
"Always on, because this host already accepts Tailscale connections",
|
||||
);
|
||||
expect(hint({ ...off, lockedBy: "launch" })).toBe(
|
||||
"Controlled by the command that starts this host",
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
import type { TailscaleStatus } from "@getpaseo/protocol/messages";
|
||||
import type { TFunction } from "i18next";
|
||||
|
||||
/** The line under the Tailscale label for each state the host reports, most specific first. */
|
||||
export function describeTailscale(status: TailscaleStatus, t: TFunction): string {
|
||||
if (status.state === "unavailable") return t("devices.tailscale.unavailable");
|
||||
if (status.state === "waiting") return t("devices.tailscale.waiting");
|
||||
// A socket is why Tailscale cannot be on, even when the launch command also fixes the address.
|
||||
if (status.mainIsSocket) return t("devices.tailscale.socket");
|
||||
if (status.lockedBy === "launch") return t("devices.tailscale.launch");
|
||||
if (status.lockedBy === "main") return t("devices.tailscale.alwaysOn");
|
||||
return t("devices.tailscale.hint");
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
import { useCallback, useMemo } from "react";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { SettingsAction, SettingsRowChildren, SettingsSwitch } from "@/components/settings";
|
||||
import { useToast } from "@/contexts/toast-context";
|
||||
import { useFetchQuery } from "@/data/query";
|
||||
import { useHostRuntimeClient, useHostRuntimeSnapshot } from "@/runtime/host-runtime";
|
||||
import { useSessionStore } from "@/stores/session-store";
|
||||
import { confirmDialog } from "@/utils/confirm-dialog";
|
||||
import { copyToClipboard } from "@/utils/copy-to-clipboard";
|
||||
import { describeTailscale } from "./tailscale-hint";
|
||||
|
||||
const UPDATES_DOCS_URL = "https://paseo.sh/docs/updates";
|
||||
const TAILSCALE_DOWNLOAD_URL = "https://tailscale.com/download";
|
||||
// A product name, the same in every language.
|
||||
const LABEL = "Tailscale";
|
||||
|
||||
type HostClient = NonNullable<ReturnType<typeof useHostRuntimeClient>>;
|
||||
|
||||
/**
|
||||
* Turns Tailscale on or off for a host and shows the address a phone on the tailnet adds. Renders
|
||||
* as a row inside a `SettingsCard`; when Tailscale is on, the address is a nested row under it.
|
||||
*/
|
||||
export function TailscaleRow({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const client = useHostRuntimeClient(serverId);
|
||||
const connection = useHostRuntimeSnapshot(serverId)?.connectionStatus;
|
||||
const serverInfo = useSessionStore((state) => state.sessions[serverId]?.serverInfo);
|
||||
const updateLink = useMemo(
|
||||
() => ({ href: UPDATES_DOCS_URL, label: t("devices.tailscale.updateDocs") }),
|
||||
[t],
|
||||
);
|
||||
// COMPAT(tailscale): added in v0.16.0, remove after 2027-05-25 once daemon floor >= v0.16.0.
|
||||
if (serverInfo && serverInfo.features?.tailscale !== true) {
|
||||
return (
|
||||
<SettingsSwitch
|
||||
label={LABEL}
|
||||
hint={t("devices.tailscale.update")}
|
||||
link={updateLink}
|
||||
value={false}
|
||||
disabled
|
||||
/>
|
||||
);
|
||||
}
|
||||
if (client && connection === "online" && serverInfo) {
|
||||
return <TailscaleControl serverId={serverId} client={client} />;
|
||||
}
|
||||
// Without the host the row shows no value: the switch's space stays empty. A host the app has
|
||||
// reached before keeps its server info, so while the app retries it still reads as disconnected.
|
||||
const lost = connection === "offline" || connection === "error" || Boolean(serverInfo);
|
||||
return (
|
||||
<SettingsSwitch
|
||||
label={LABEL}
|
||||
hint={t(lost ? "workspace.terminal.hostDisconnected" : "devices.tailscale.hint")}
|
||||
value={null}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function TailscaleControl({ serverId, client }: { serverId: string; client: HostClient }) {
|
||||
const { t } = useTranslation();
|
||||
const tailscale = useTailscale(serverId, client);
|
||||
const { status } = tailscale;
|
||||
const installLink = useMemo(
|
||||
() => ({ href: TAILSCALE_DOWNLOAD_URL, label: t("devices.tailscale.install") }),
|
||||
[t],
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<SettingsSwitch
|
||||
label={LABEL}
|
||||
hint={status ? describeTailscale(status, t) : t("devices.tailscale.hint")}
|
||||
link={status?.state === "unavailable" ? installLink : undefined}
|
||||
error={tailscale.error}
|
||||
value={tailscale.value}
|
||||
disabled={!status || status.state === "unavailable" || Boolean(status.lockedBy)}
|
||||
onValueChange={tailscale.setEnabled}
|
||||
/>
|
||||
{tailscale.address ? <TailscaleAddress address={tailscale.address} /> : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function TailscaleAddress({ address }: { address: string }) {
|
||||
const { t } = useTranslation();
|
||||
const toast = useToast();
|
||||
const copy = useCallback(() => {
|
||||
void copyToClipboard(address)
|
||||
.then(() => toast.copied())
|
||||
.catch(() => toast.error(t("common.errors.error")));
|
||||
}, [address, t, toast]);
|
||||
return (
|
||||
<SettingsRowChildren>
|
||||
<SettingsAction
|
||||
label={address}
|
||||
hint={t("devices.tailscale.address")}
|
||||
actionLabel={t("common.actions.copy")}
|
||||
onPress={copy}
|
||||
testID="devices-tailscale-address"
|
||||
/>
|
||||
</SettingsRowChildren>
|
||||
);
|
||||
}
|
||||
|
||||
interface TailscaleChange {
|
||||
enabled: boolean;
|
||||
confirmed: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The host's Tailscale state and the one way to change it. While a change is in flight the switch
|
||||
* already shows where it is going, so a tap answers at once; the host's answer then settles it.
|
||||
* Turning Tailscale off over the connection it would cut asks first, and nothing changes on screen
|
||||
* until the user confirms.
|
||||
*/
|
||||
function useTailscale(serverId: string, client: HostClient) {
|
||||
const { t } = useTranslation();
|
||||
const queryClient = useQueryClient();
|
||||
const queryKey = useMemo(() => ["tailscale-status", serverId], [serverId]);
|
||||
|
||||
const query = useFetchQuery({
|
||||
queryKey,
|
||||
queryFn: async () => {
|
||||
const { tailscale } = await client.getDaemonStatus({ includeProviders: false });
|
||||
if (!tailscale) throw new Error("Host did not report Tailscale status");
|
||||
return tailscale;
|
||||
},
|
||||
// Tailscale can come up after the host does; polling moves "waiting" to "on" on its own.
|
||||
refetchInterval: 2_000,
|
||||
staleTimeMs: 0,
|
||||
dataShape: "value",
|
||||
});
|
||||
|
||||
const change = useMutation({
|
||||
mutationFn: async ({ enabled, confirmed }: TailscaleChange) => {
|
||||
await queryClient.cancelQueries({ queryKey });
|
||||
return client.setTailscaleEnabled(enabled, confirmed);
|
||||
},
|
||||
onSuccess: (result) => queryClient.setQueryData(queryKey, result.tailscale),
|
||||
});
|
||||
|
||||
const status = query.data;
|
||||
const pending = change.isPending ? change.variables.enabled : undefined;
|
||||
const on = status?.state === "on" || status?.state === "waiting";
|
||||
// Not known until the host first answers.
|
||||
const value = pending ?? (status ? on : null);
|
||||
|
||||
const { mutate } = change;
|
||||
const confirmTurnOff = useCallback(
|
||||
() =>
|
||||
confirmDialog({
|
||||
title: t("devices.tailscale.confirmTitle"),
|
||||
message: t("devices.tailscale.confirmMessage"),
|
||||
confirmLabel: t("devices.tailscale.confirmAction"),
|
||||
cancelLabel: t("common.actions.cancel"),
|
||||
destructive: true,
|
||||
}),
|
||||
[t],
|
||||
);
|
||||
const turnOffConfirmed = useCallback(async () => {
|
||||
if (await confirmTurnOff()) mutate({ enabled: false, confirmed: true });
|
||||
}, [confirmTurnOff, mutate]);
|
||||
const disconnects = status?.disconnectsCurrentConnection === true;
|
||||
const setEnabled = useCallback(
|
||||
(enabled: boolean) => {
|
||||
if (!enabled && disconnects) {
|
||||
void turnOffConfirmed();
|
||||
return;
|
||||
}
|
||||
mutate(
|
||||
{ enabled, confirmed: false },
|
||||
{
|
||||
// The status was stale: the host would cut this connection after all. Its answer has
|
||||
// already put the row back to on, so the question is asked over what is true.
|
||||
onSuccess: (result) => {
|
||||
if (result.confirmationRequired) void turnOffConfirmed();
|
||||
},
|
||||
},
|
||||
);
|
||||
},
|
||||
[disconnects, mutate, turnOffConfirmed],
|
||||
);
|
||||
|
||||
let error: string | undefined;
|
||||
if (change.isError) {
|
||||
error = t(
|
||||
change.variables.enabled ? "devices.tailscale.turnOnError" : "devices.tailscale.turnOffError",
|
||||
);
|
||||
} else if (query.isError && !status) {
|
||||
error = t("devices.tailscale.statusError");
|
||||
}
|
||||
|
||||
return {
|
||||
status,
|
||||
value,
|
||||
error,
|
||||
// A tap is ignored until the host answers the one before it.
|
||||
setEnabled: change.isPending ? undefined : setEnabled,
|
||||
address: status?.state === "on" && value ? status.address : null,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { SettingsCard, SettingsDetailRow, SettingsSection } from "@/components/settings";
|
||||
import { StatusBadge } from "@/components/ui/status-badge";
|
||||
import { PairDeviceModal } from "./pair-device-modal";
|
||||
import { CONNECTIVITY_DOCS_URL } from "./pair-device-section";
|
||||
import { TailscaleRow } from "./tailscale-row";
|
||||
|
||||
/**
|
||||
* The ways another device can connect to a host: Relay, which pairs through a QR code in a sheet,
|
||||
* and Tailscale, a switch and an address. Settings and the setup's phone step show this same block.
|
||||
*/
|
||||
export function WaysToConnect({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const [pairing, setPairing] = useState(false);
|
||||
const openPairing = useCallback(() => setPairing(true), []);
|
||||
const closePairing = useCallback(() => setPairing(false), []);
|
||||
const recommended = useMemo(
|
||||
() => <StatusBadge size="xs" variant="success" label={t("devices.recommended")} />,
|
||||
[t],
|
||||
);
|
||||
const docsLink = useMemo(
|
||||
() => ({
|
||||
href: CONNECTIVITY_DOCS_URL,
|
||||
label: t("devices.docs"),
|
||||
accessibilityLabel: t("devices.docsAccessibility"),
|
||||
}),
|
||||
[t],
|
||||
);
|
||||
|
||||
return (
|
||||
<SettingsSection title={t("devices.waysToConnect")} link={docsLink}>
|
||||
<SettingsCard>
|
||||
<SettingsDetailRow
|
||||
label={t("devices.relay.title")}
|
||||
labelAccessory={recommended}
|
||||
hint={t("devices.relay.hint")}
|
||||
onPress={openPairing}
|
||||
testID="devices-relay"
|
||||
/>
|
||||
<TailscaleRow serverId={serverId} />
|
||||
</SettingsCard>
|
||||
<PairDeviceModal
|
||||
serverId={serverId}
|
||||
visible={pairing}
|
||||
onClose={closePairing}
|
||||
testID="devices-relay-pairing"
|
||||
/>
|
||||
</SettingsSection>
|
||||
);
|
||||
}
|
||||
@@ -166,7 +166,7 @@ describe("ensureAgentIsInitialized", () => {
|
||||
kind: "assistant_message",
|
||||
id: "canonical-item",
|
||||
text: "Canonical before restart",
|
||||
timelineCursor: { epoch: "epoch-1", seq: 12, anchorSeq: 12 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 12 },
|
||||
timestamp: new Date("2026-07-27T10:00:00.000Z"),
|
||||
},
|
||||
],
|
||||
|
||||
@@ -32,6 +32,9 @@ export interface FakeDesktopBridge extends DesktopSettingsBridge {
|
||||
|
||||
const DEFAULT_DESKTOP: DesktopSettings = {
|
||||
releaseChannel: "stable",
|
||||
updates: {
|
||||
mode: "automatic",
|
||||
},
|
||||
notifications: {
|
||||
playSound: true,
|
||||
},
|
||||
|
||||
@@ -656,6 +656,7 @@ describe("loadSettingsFromStorage", () => {
|
||||
isElectron: true,
|
||||
settings: {
|
||||
releaseChannel: "beta",
|
||||
updates: { mode: "automatic" },
|
||||
notifications: { playSound: true },
|
||||
daemon: { manageBuiltInDaemon: false, keepRunningAfterQuit: true },
|
||||
},
|
||||
|
||||
@@ -741,8 +741,6 @@ export const ar: TranslationResources = {
|
||||
resumeCommandUnavailable: "أمر الاستئناف غير متوفر",
|
||||
reloadingAgent: "وكيل إعادة التحميل...",
|
||||
reloadedAgent: "وكيل إعادة تحميل",
|
||||
reloadedAgentHistoryDiverged:
|
||||
"تمت إعادة تحميل الوكيل، لكن سجل المزوّد لا يطابق هذه المحادثة، لذا لم تتم مزامنته",
|
||||
failedToReloadAgent: "فشل في إعادة تحميل الوكيل",
|
||||
failedToCloseAgent: "فشل في إغلاق الوكيل",
|
||||
},
|
||||
@@ -1552,6 +1550,8 @@ export const ar: TranslationResources = {
|
||||
status: {
|
||||
checking: "جارٍ التحقق من وجود تحديثات للتطبيق...",
|
||||
installing: "جارٍ تثبيت تحديث التطبيق...",
|
||||
downloadingVersionProgress: "جارٍ تنزيل {{version}}... {{percent}}%",
|
||||
downloadingProgress: "جارٍ تنزيل تحديث التطبيق... {{percent}}%",
|
||||
upToDate: "التطبيق محدث.",
|
||||
upToDateWithLastChecked: "Up to date. Last checked at {{time}}.",
|
||||
pending: "سنخبرك عندما يصبح التحديث جاهزًا.",
|
||||
@@ -1559,6 +1559,14 @@ export const ar: TranslationResources = {
|
||||
pendingWithVersion: "تم العثور على تحديث: {{version}}. جارٍ التنزيل...",
|
||||
pendingWithVersionAndLastChecked:
|
||||
"تم العثور على تحديث: {{version}}. جارٍ التنزيل... آخر فحص في {{time}}.",
|
||||
pendingWithVersionProgress: "تم العثور على تحديث: {{version}}. جارٍ التنزيل... {{percent}}%",
|
||||
pendingWithVersionProgressAndLastChecked:
|
||||
"تم العثور على تحديث: {{version}}. جارٍ التنزيل... {{percent}}% آخر فحص في {{time}}.",
|
||||
downloadAvailableWithVersion: "التحديث متاح: {{version}}",
|
||||
downloadAvailableWithVersionAndLastChecked:
|
||||
"التحديث متاح: {{version}}. آخر فحص في {{time}}.",
|
||||
downloadAvailable: "يتوفر تحديث للتطبيق.",
|
||||
downloadAvailableWithLastChecked: "يتوفر تحديث للتطبيق. آخر فحص في {{time}}.",
|
||||
availableWithVersion: "التحديث جاهز:{{version}}",
|
||||
availableWithVersionAndLastChecked: "التحديث جاهز:{{version}}. آخر فحص في {{time}}.",
|
||||
available: "تحديث التطبيق جاهز للتثبيت.",
|
||||
@@ -1569,14 +1577,21 @@ export const ar: TranslationResources = {
|
||||
},
|
||||
installError: "غير قادر على تثبيت تحديث تطبيق سطح المكتب.",
|
||||
callout: {
|
||||
downloadingTitle: "جارٍ تنزيل التحديث",
|
||||
installingTitle: "تثبيت التحديث",
|
||||
failedTitle: "فشل التحديث",
|
||||
availableTitle: "التحديث متاح",
|
||||
genericError: "حدث خطأ ما.",
|
||||
whatsNew: "ما هو الجديد",
|
||||
downloadingAction: "جارٍ التنزيل...",
|
||||
installingAction: "جارٍ التثبيت...",
|
||||
downloadAndRestart: "تنزيل",
|
||||
installAndRestart: "التثبيت وإعادة التشغيل",
|
||||
downloadingVersionDescription: "جارٍ تنزيل {{version}}... {{percent}}%",
|
||||
downloadingDescription: "جارٍ تنزيل التحديث... {{percent}}%",
|
||||
installingDescription: "التثبيت وإعادة التشغيل...",
|
||||
versionAvailable: "{{version}} متاح للتنزيل.",
|
||||
newVersionAvailable: "يتوفر إصدار جديد للتنزيل.",
|
||||
versionReady: "{{version}}جاهز للتثبيت.",
|
||||
newVersionReady: "إصدار جديد جاهز للتثبيت.",
|
||||
restartWarning: "ستؤدي ترقية التطبيق إلى إيقاف تشغيل الوكلاء وإغلاق الجلسات الطرفية.",
|
||||
@@ -1793,12 +1808,6 @@ export const ar: TranslationResources = {
|
||||
"يتيح لك تطبيق الجوال الأصلي كامل الميزات التحكم في أي كمبيوتر يعمل عليه Paseo من هاتفك",
|
||||
appStore: "App Store",
|
||||
googlePlay: "Google Play",
|
||||
connectTitle: "اختر طريقة الاتصال",
|
||||
connectDocs: "الوثائق",
|
||||
openConnectDocs: "افتح وثائق الاتصال",
|
||||
recommended: "موصى به",
|
||||
relay: { title: "التتابع", hint: "مشفّر من طرف إلى طرف، امسح رمز QR" },
|
||||
tailscale: { title: "Tailscale", hint: "يتطلب بعض الإعداد" },
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1877,6 +1886,32 @@ export const ar: TranslationResources = {
|
||||
hostDisconnected: "Host غير متصل",
|
||||
},
|
||||
},
|
||||
devices: {
|
||||
title: "الأجهزة",
|
||||
waysToConnect: "طرق الاتصال",
|
||||
docs: "الوثائق",
|
||||
docsAccessibility: "افتح وثائق الاتصال",
|
||||
recommended: "موصى به",
|
||||
relay: { title: "التتابع", hint: "مشفّر من طرف إلى طرف، امسح رمز QR" },
|
||||
tailscale: {
|
||||
hint: "اتصال مباشر عبر شبكة tailnet الخاصة بك، أدخل عنوانًا",
|
||||
unavailable: "Tailscale لا يعمل على هذا المضيف",
|
||||
install: "احصل على Tailscale",
|
||||
waiting: "في انتظار بدء Tailscale على هذا المضيف",
|
||||
alwaysOn: "مفعّل دائمًا، لأن هذا المضيف يقبل اتصالات Tailscale بالفعل",
|
||||
socket: "متوقف، لأن هذا المضيف يستمع على مقبس محلي",
|
||||
launch: "يتحكم فيه الأمر الذي يشغّل هذا المضيف",
|
||||
update: "حدّث هذا المضيف لاستخدام Tailscale",
|
||||
updateDocs: "طريقة التحديث",
|
||||
address: "على هاتف متصل بـ Tailscale، أضف مضيفًا بهذا العنوان",
|
||||
statusError: "تعذّر التحقق من Tailscale",
|
||||
turnOnError: "تعذّر تشغيل Tailscale",
|
||||
turnOffError: "تعذّر إيقاف Tailscale",
|
||||
confirmTitle: "إيقاف Tailscale؟",
|
||||
confirmMessage: "هذا الجهاز متصل عبر Tailscale وسيفقد اتصاله بالمضيف.",
|
||||
confirmAction: "إيقاف",
|
||||
},
|
||||
},
|
||||
pairing: {
|
||||
hostPassword: {
|
||||
title: "كلمة المرور لـ {{host}}",
|
||||
@@ -2658,9 +2693,28 @@ export const ar: TranslationResources = {
|
||||
stable: "Stable",
|
||||
beta: "Beta",
|
||||
},
|
||||
autoUpdate: {
|
||||
label: "التحديثات التلقائية",
|
||||
options: {
|
||||
automatic: "تلقائي",
|
||||
notify: "إشعار",
|
||||
off: "إيقاف",
|
||||
},
|
||||
descriptions: {
|
||||
automatic: "التحقق من التحديثات وتنزيلها في الخلفية",
|
||||
notify: "التحقق من التحديثات وتنزيلها فقط عند اختيارك",
|
||||
off: "عدم التحقق تلقائيًا. يتم التحقق فقط عند النقر على فحص",
|
||||
},
|
||||
},
|
||||
updates: {
|
||||
label: "تحديثات التطبيق",
|
||||
readyToInstall: "جاهز للتثبيت:{{version}}",
|
||||
downloadTitle: "تنزيل تحديث سطح المكتب",
|
||||
downloadMessage: "سيؤدي هذا إلى تنزيل تحديث Paseo وتثبيته على هذا الكمبيوتر",
|
||||
downloadConfirm: "تنزيل وتثبيت",
|
||||
download: "تنزيل",
|
||||
downloadTo: "تنزيل {{version}}",
|
||||
downloading: "جارٍ التنزيل...",
|
||||
installTitle: "تثبيت تحديث سطح المكتب",
|
||||
installMessage: "يؤدي هذا إلى تحديث Paseo على هذا الكمبيوتر",
|
||||
installConfirm: "تثبيت التحديث",
|
||||
@@ -2931,9 +2985,7 @@ export const ar: TranslationResources = {
|
||||
timeout: "نفذ الوقت",
|
||||
},
|
||||
pairDevices: {
|
||||
title: "إقران الأجهزة",
|
||||
rowTitle: "إقران جهاز",
|
||||
rowHint: "امسح رمز QR ضوئيًا أو انسخ رابطًا لتوصيل هاتفك بهذا المضيف",
|
||||
},
|
||||
skills: {
|
||||
...en.settings.host.skills,
|
||||
|
||||
@@ -740,8 +740,6 @@ export const en = {
|
||||
resumeCommandUnavailable: "Resume command not available",
|
||||
reloadingAgent: "Reloading agent...",
|
||||
reloadedAgent: "Reloaded agent",
|
||||
reloadedAgentHistoryDiverged:
|
||||
"Reloaded agent, but the provider's history doesn't match this chat, so it wasn't synced",
|
||||
failedToReloadAgent: "Failed to reload agent",
|
||||
failedToCloseAgent: "Failed to close agent",
|
||||
},
|
||||
@@ -1579,6 +1577,8 @@ export const en = {
|
||||
status: {
|
||||
checking: "Checking for app updates...",
|
||||
installing: "Installing app update...",
|
||||
downloadingVersionProgress: "Downloading {{version}}... {{percent}}%",
|
||||
downloadingProgress: "Downloading app update... {{percent}}%",
|
||||
upToDate: "App is up to date.",
|
||||
upToDateWithLastChecked: "Up to date. Last checked at {{time}}.",
|
||||
pending: "We'll let you know when the update is ready.",
|
||||
@@ -1587,6 +1587,14 @@ export const en = {
|
||||
pendingWithVersion: "Update found: {{version}}. Downloading...",
|
||||
pendingWithVersionAndLastChecked:
|
||||
"Update found: {{version}}. Downloading... Last checked at {{time}}.",
|
||||
pendingWithVersionProgress: "Update found: {{version}}. Downloading... {{percent}}%",
|
||||
pendingWithVersionProgressAndLastChecked:
|
||||
"Update found: {{version}}. Downloading... {{percent}}% Last checked at {{time}}.",
|
||||
downloadAvailableWithVersion: "Update available: {{version}}",
|
||||
downloadAvailableWithVersionAndLastChecked:
|
||||
"Update available: {{version}}. Last checked at {{time}}.",
|
||||
downloadAvailable: "An app update is available.",
|
||||
downloadAvailableWithLastChecked: "An app update is available. Last checked at {{time}}.",
|
||||
availableWithVersion: "Update ready: {{version}}",
|
||||
availableWithVersionAndLastChecked: "Update ready: {{version}}. Last checked at {{time}}.",
|
||||
available: "An app update is ready to install.",
|
||||
@@ -1597,14 +1605,21 @@ export const en = {
|
||||
},
|
||||
installError: "Unable to install the desktop app update.",
|
||||
callout: {
|
||||
downloadingTitle: "Downloading update",
|
||||
installingTitle: "Installing update",
|
||||
failedTitle: "Update failed",
|
||||
availableTitle: "Update available",
|
||||
genericError: "Something went wrong.",
|
||||
whatsNew: "What's new",
|
||||
downloadingAction: "Downloading...",
|
||||
installingAction: "Installing...",
|
||||
downloadAndRestart: "Download",
|
||||
installAndRestart: "Install & restart",
|
||||
downloadingVersionDescription: "Downloading {{version}}... {{percent}}%",
|
||||
downloadingDescription: "Downloading update... {{percent}}%",
|
||||
installingDescription: "Installing and restarting...",
|
||||
versionAvailable: "{{version}} is available to download.",
|
||||
newVersionAvailable: "A new version is available to download.",
|
||||
versionReady: "{{version}} is ready to install.",
|
||||
newVersionReady: "A new version is ready to install.",
|
||||
restartWarning: "Upgrading the app will stop running agents and close terminal sessions.",
|
||||
@@ -1822,12 +1837,6 @@ export const en = {
|
||||
"The fully featured native mobile app allows you to control any Paseo computer from your phone",
|
||||
appStore: "App Store",
|
||||
googlePlay: "Google Play",
|
||||
connectTitle: "Choose how to connect",
|
||||
connectDocs: "Docs",
|
||||
openConnectDocs: "Open connectivity documentation",
|
||||
recommended: "Recommended",
|
||||
relay: { title: "Relay", hint: "End-to-end encrypted, scan a QR code" },
|
||||
tailscale: { title: "Tailscale", hint: "Requires some setup" },
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1906,6 +1915,33 @@ export const en = {
|
||||
hostDisconnected: "Host is not connected",
|
||||
},
|
||||
},
|
||||
devices: {
|
||||
title: "Devices",
|
||||
waysToConnect: "Ways to connect",
|
||||
docs: "Docs",
|
||||
docsAccessibility: "Open connectivity documentation",
|
||||
recommended: "Recommended",
|
||||
relay: { title: "Relay", hint: "End-to-end encrypted, scan a QR code" },
|
||||
tailscale: {
|
||||
hint: "Direct over your tailnet, enter an address",
|
||||
unavailable: "Tailscale is not running on this host",
|
||||
install: "Get Tailscale",
|
||||
waiting: "Waiting for Tailscale to start on this host",
|
||||
alwaysOn: "Always on, because this host already accepts Tailscale connections",
|
||||
socket: "Off, because this host listens on a local socket",
|
||||
launch: "Controlled by the command that starts this host",
|
||||
update: "Update this host to use Tailscale",
|
||||
updateDocs: "How to update",
|
||||
address: "On a phone with Tailscale, add a host at this address",
|
||||
statusError: "Could not check Tailscale",
|
||||
turnOnError: "Could not turn on Tailscale",
|
||||
turnOffError: "Could not turn off Tailscale",
|
||||
confirmTitle: "Turn off Tailscale?",
|
||||
confirmMessage:
|
||||
"This device is connected through Tailscale and will lose its connection to the host.",
|
||||
confirmAction: "Turn off",
|
||||
},
|
||||
},
|
||||
pairing: {
|
||||
hostPassword: {
|
||||
title: "Password for {{host}}",
|
||||
@@ -2754,9 +2790,28 @@ export const en = {
|
||||
stable: "Stable",
|
||||
beta: "Beta",
|
||||
},
|
||||
autoUpdate: {
|
||||
label: "Automatic updates",
|
||||
options: {
|
||||
automatic: "Auto",
|
||||
notify: "Notify",
|
||||
off: "Off",
|
||||
},
|
||||
descriptions: {
|
||||
automatic: "Check and download updates in the background",
|
||||
notify: "Check for updates, but only download when you choose",
|
||||
off: "Never check automatically. Only check when you click Check",
|
||||
},
|
||||
},
|
||||
updates: {
|
||||
label: "App updates",
|
||||
readyToInstall: "Ready to install: {{version}}",
|
||||
downloadTitle: "Download desktop update",
|
||||
downloadMessage: "This downloads and installs the Paseo update on this computer",
|
||||
downloadConfirm: "Download & install",
|
||||
download: "Download",
|
||||
downloadTo: "Download {{version}}",
|
||||
downloading: "Downloading...",
|
||||
installTitle: "Install desktop update",
|
||||
installMessage: "This updates Paseo on this computer",
|
||||
installConfirm: "Install update",
|
||||
@@ -3026,9 +3081,7 @@ export const en = {
|
||||
timeout: "Timeout",
|
||||
},
|
||||
pairDevices: {
|
||||
title: "Pair devices",
|
||||
rowTitle: "Pair a device",
|
||||
rowHint: "Scan a QR code or copy a link to connect your phone to this host",
|
||||
},
|
||||
skills: {
|
||||
sectionTitle: "Orchestration skills",
|
||||
|
||||
@@ -748,8 +748,6 @@ export const es: TranslationResources = {
|
||||
resumeCommandUnavailable: "Comando de reanudación no disponible",
|
||||
reloadingAgent: "Agente de recarga...",
|
||||
reloadedAgent: "Agente recargado",
|
||||
reloadedAgentHistoryDiverged:
|
||||
"Agente recargado, pero el historial del proveedor no coincide con este chat, así que no se sincronizó",
|
||||
failedToReloadAgent: "No se pudo recargar el agente",
|
||||
failedToCloseAgent: "No se pudo cerrar el agente",
|
||||
},
|
||||
@@ -1589,6 +1587,8 @@ export const es: TranslationResources = {
|
||||
status: {
|
||||
checking: "Buscando actualizaciones de la aplicación...",
|
||||
installing: "Instalando actualización de la aplicación...",
|
||||
downloadingVersionProgress: "Descargando {{version}}... {{percent}}%",
|
||||
downloadingProgress: "Descargando actualización de la aplicación... {{percent}}%",
|
||||
upToDate: "La aplicación está actualizada.",
|
||||
upToDateWithLastChecked: "Up to date. Last checked at {{time}}.",
|
||||
pending: "Le avisaremos cuando la actualización esté lista.",
|
||||
@@ -1597,6 +1597,16 @@ export const es: TranslationResources = {
|
||||
pendingWithVersion: "Actualización encontrada: {{version}}. Descargando...",
|
||||
pendingWithVersionAndLastChecked:
|
||||
"Actualización encontrada: {{version}}. Descargando... Última comprobación a las {{time}}.",
|
||||
pendingWithVersionProgress:
|
||||
"Actualización encontrada: {{version}}. Descargando... {{percent}}%",
|
||||
pendingWithVersionProgressAndLastChecked:
|
||||
"Actualización encontrada: {{version}}. Descargando... {{percent}}% Última comprobación a las {{time}}.",
|
||||
downloadAvailableWithVersion: "Actualización disponible: {{version}}",
|
||||
downloadAvailableWithVersionAndLastChecked:
|
||||
"Actualización disponible: {{version}}. Última comprobación a las {{time}}.",
|
||||
downloadAvailable: "Hay una actualización de la aplicación disponible.",
|
||||
downloadAvailableWithLastChecked:
|
||||
"Hay una actualización de la aplicación disponible. Última comprobación a las {{time}}.",
|
||||
availableWithVersion: "Actualización lista:{{version}}",
|
||||
availableWithVersionAndLastChecked:
|
||||
"Actualización lista:{{version}}. Última comprobación a las {{time}}.",
|
||||
@@ -1609,14 +1619,21 @@ export const es: TranslationResources = {
|
||||
},
|
||||
installError: "No se puede instalar la actualización de la aplicación de escritorio.",
|
||||
callout: {
|
||||
downloadingTitle: "Descargando actualización",
|
||||
installingTitle: "Instalando actualización",
|
||||
failedTitle: "La actualización falló",
|
||||
availableTitle: "Actualización disponible",
|
||||
genericError: "Algo salió mal.",
|
||||
whatsNew: "Qué hay de nuevo",
|
||||
downloadingAction: "Descargando...",
|
||||
installingAction: "Instalando...",
|
||||
downloadAndRestart: "Descargar",
|
||||
installAndRestart: "Instalar y reiniciar",
|
||||
downloadingVersionDescription: "Descargando {{version}}... {{percent}}%",
|
||||
downloadingDescription: "Descargando actualización... {{percent}}%",
|
||||
installingDescription: "Instalando y reiniciando...",
|
||||
versionAvailable: "{{version}} está disponible para descargar.",
|
||||
newVersionAvailable: "Una nueva versión está disponible para descargar.",
|
||||
versionReady: "{{version}}está listo para instalar.",
|
||||
newVersionReady: "Una nueva versión está lista para instalar.",
|
||||
restartWarning:
|
||||
@@ -1841,12 +1858,6 @@ export const es: TranslationResources = {
|
||||
"La app móvil nativa completa te permite controlar cualquier ordenador con Paseo desde tu teléfono",
|
||||
appStore: "App Store",
|
||||
googlePlay: "Google Play",
|
||||
connectTitle: "Elige cómo conectarte",
|
||||
connectDocs: "Docs",
|
||||
openConnectDocs: "Abrir la documentación de conectividad",
|
||||
recommended: "Recomendado",
|
||||
relay: { title: "Relé", hint: "Cifrado de extremo a extremo, escanea un código QR" },
|
||||
tailscale: { title: "Tailscale", hint: "Requiere algo de configuración" },
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1925,6 +1936,33 @@ export const es: TranslationResources = {
|
||||
hostDisconnected: "Hostno está conectado",
|
||||
},
|
||||
},
|
||||
devices: {
|
||||
title: "Dispositivos",
|
||||
waysToConnect: "Formas de conectarse",
|
||||
docs: "Docs",
|
||||
docsAccessibility: "Abrir la documentación de conectividad",
|
||||
recommended: "Recomendado",
|
||||
relay: { title: "Relé", hint: "Cifrado de extremo a extremo, escanea un código QR" },
|
||||
tailscale: {
|
||||
hint: "Conexión directa por tu tailnet, introduce una dirección",
|
||||
unavailable: "Tailscale no se está ejecutando en este host",
|
||||
install: "Obtener Tailscale",
|
||||
waiting: "Esperando a que Tailscale se inicie en este host",
|
||||
alwaysOn: "Siempre activado, porque este host ya acepta conexiones de Tailscale",
|
||||
socket: "Desactivado, porque este host escucha en un socket local",
|
||||
launch: "Lo controla el comando que inicia este host",
|
||||
update: "Actualiza este host para usar Tailscale",
|
||||
updateDocs: "Cómo actualizar",
|
||||
address: "En un teléfono con Tailscale, añade un host con esta dirección",
|
||||
statusError: "No se pudo comprobar Tailscale",
|
||||
turnOnError: "No se pudo activar Tailscale",
|
||||
turnOffError: "No se pudo desactivar Tailscale",
|
||||
confirmTitle: "¿Desactivar Tailscale?",
|
||||
confirmMessage:
|
||||
"Este dispositivo está conectado mediante Tailscale y perderá la conexión con el host.",
|
||||
confirmAction: "Desactivar",
|
||||
},
|
||||
},
|
||||
pairing: {
|
||||
hostPassword: {
|
||||
title: "Contraseña de {{host}}",
|
||||
@@ -2679,9 +2717,28 @@ export const es: TranslationResources = {
|
||||
stable: "Stable",
|
||||
beta: "Beta",
|
||||
},
|
||||
autoUpdate: {
|
||||
label: "Actualizaciones automáticas",
|
||||
options: {
|
||||
automatic: "Auto",
|
||||
notify: "Notificar",
|
||||
off: "Desactivado",
|
||||
},
|
||||
descriptions: {
|
||||
automatic: "Buscar y descargar actualizaciones en segundo plano",
|
||||
notify: "Buscar actualizaciones, pero descargar solo cuando lo elijas",
|
||||
off: "No buscar automáticamente. Solo buscar al hacer clic en Comprobar",
|
||||
},
|
||||
},
|
||||
updates: {
|
||||
label: "Actualizaciones de aplicaciones",
|
||||
readyToInstall: "Listo para instalar:{{version}}",
|
||||
downloadTitle: "Descargar actualización de escritorio",
|
||||
downloadMessage: "Esto descarga e instala la actualización de Paseo en esta computadora.",
|
||||
downloadConfirm: "Descargar e instalar",
|
||||
download: "Descargar",
|
||||
downloadTo: "Descargar {{version}}",
|
||||
downloading: "Descargando...",
|
||||
installTitle: "Instalar actualización de escritorio",
|
||||
installMessage: "Esto actualizaPaseoen esta computadora.",
|
||||
installConfirm: "Instalar actualización",
|
||||
@@ -2955,9 +3012,7 @@ export const es: TranslationResources = {
|
||||
timeout: "Se acabó el tiempo",
|
||||
},
|
||||
pairDevices: {
|
||||
title: "Emparejar dispositivos",
|
||||
rowTitle: "Emparejar un dispositivo",
|
||||
rowHint: "Escanee un códigoQRo copie un enlace para conectar su teléfono a este host",
|
||||
},
|
||||
skills: {
|
||||
...en.settings.host.skills,
|
||||
|
||||
@@ -748,8 +748,6 @@ export const fr: TranslationResources = {
|
||||
resumeCommandUnavailable: "Commande de reprise indisponible",
|
||||
reloadingAgent: "Rechargement de l’agent…",
|
||||
reloadedAgent: "Agent rechargé",
|
||||
reloadedAgentHistoryDiverged:
|
||||
"Agent rechargé, mais l’historique du fournisseur ne correspond pas à cette conversation, il n’a donc pas été synchronisé",
|
||||
failedToReloadAgent: "Impossible de recharger l’agent",
|
||||
failedToCloseAgent: "Impossible de fermer l’agent",
|
||||
},
|
||||
@@ -1582,6 +1580,8 @@ export const fr: TranslationResources = {
|
||||
status: {
|
||||
checking: "Recherche de mises à jour de l’application…",
|
||||
installing: "Installation de la mise à jour de l’application…",
|
||||
downloadingVersionProgress: "Téléchargement de {{version}}… {{percent}} %",
|
||||
downloadingProgress: "Téléchargement de la mise à jour… {{percent}} %",
|
||||
upToDate: "L’application est à jour.",
|
||||
upToDateWithLastChecked: "À jour. Dernière vérification à {{time}}.",
|
||||
pending: "Nous vous préviendrons quand la mise à jour sera prête.",
|
||||
@@ -1590,6 +1590,16 @@ export const fr: TranslationResources = {
|
||||
pendingWithVersion: "Mise à jour trouvée : {{version}}. Téléchargement…",
|
||||
pendingWithVersionAndLastChecked:
|
||||
"Mise à jour trouvée : {{version}}. Téléchargement… Dernière vérification à {{time}}.",
|
||||
pendingWithVersionProgress:
|
||||
"Mise à jour trouvée : {{version}}. Téléchargement… {{percent}} %",
|
||||
pendingWithVersionProgressAndLastChecked:
|
||||
"Mise à jour trouvée : {{version}}. Téléchargement… {{percent}} % Dernière vérification à {{time}}.",
|
||||
downloadAvailableWithVersion: "Mise à jour disponible : {{version}}",
|
||||
downloadAvailableWithVersionAndLastChecked:
|
||||
"Mise à jour disponible : {{version}}. Dernière vérification à {{time}}.",
|
||||
downloadAvailable: "Une mise à jour de l’application est disponible.",
|
||||
downloadAvailableWithLastChecked:
|
||||
"Une mise à jour de l’application est disponible. Dernière vérification à {{time}}.",
|
||||
availableWithVersion: "Mise à jour prête : {{version}}",
|
||||
availableWithVersionAndLastChecked:
|
||||
"Mise à jour prête : {{version}}. Dernière vérification à {{time}}.",
|
||||
@@ -1602,14 +1612,21 @@ export const fr: TranslationResources = {
|
||||
},
|
||||
installError: "Impossible d’installer la mise à jour de l’application de bureau.",
|
||||
callout: {
|
||||
downloadingTitle: "Téléchargement de la mise à jour",
|
||||
installingTitle: "Installation de la mise à jour",
|
||||
failedTitle: "Échec de la mise à jour",
|
||||
availableTitle: "Mise à jour disponible",
|
||||
genericError: "Une erreur s’est produite.",
|
||||
whatsNew: "Nouveautés",
|
||||
downloadingAction: "Téléchargement…",
|
||||
installingAction: "Installation…",
|
||||
downloadAndRestart: "Télécharger",
|
||||
installAndRestart: "Installer et redémarrer",
|
||||
downloadingVersionDescription: "Téléchargement de {{version}}… {{percent}} %",
|
||||
downloadingDescription: "Téléchargement de la mise à jour… {{percent}} %",
|
||||
installingDescription: "Installation et redémarrage…",
|
||||
versionAvailable: "La version {{version}} est disponible au téléchargement.",
|
||||
newVersionAvailable: "Une nouvelle version est disponible au téléchargement.",
|
||||
versionReady: "La version {{version}} est prête à être installée.",
|
||||
newVersionReady: "Une nouvelle version est prête à être installée.",
|
||||
restartWarning:
|
||||
@@ -1839,12 +1856,6 @@ export const fr: TranslationResources = {
|
||||
"L'application mobile native complète vous permet de contrôler n'importe quel ordinateur Paseo depuis votre téléphone",
|
||||
appStore: "App Store",
|
||||
googlePlay: "Google Play",
|
||||
connectTitle: "Choisissez comment vous connecter",
|
||||
connectDocs: "Docs",
|
||||
openConnectDocs: "Ouvrir la documentation sur la connectivité",
|
||||
recommended: "Recommandé",
|
||||
relay: { title: "Relais", hint: "Chiffré de bout en bout, scannez un QR code" },
|
||||
tailscale: { title: "Tailscale", hint: "Demande un peu de configuration" },
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1923,6 +1934,32 @@ export const fr: TranslationResources = {
|
||||
hostDisconnected: "L’hôte n’est pas connecté",
|
||||
},
|
||||
},
|
||||
devices: {
|
||||
title: "Appareils",
|
||||
waysToConnect: "Moyens de connexion",
|
||||
docs: "Docs",
|
||||
docsAccessibility: "Ouvrir la documentation sur la connectivité",
|
||||
recommended: "Recommandé",
|
||||
relay: { title: "Relais", hint: "Chiffré de bout en bout, scannez un QR code" },
|
||||
tailscale: {
|
||||
hint: "Connexion directe via votre tailnet, saisissez une adresse",
|
||||
unavailable: "Tailscale ne fonctionne pas sur cet hôte",
|
||||
install: "Obtenir Tailscale",
|
||||
waiting: "En attente du démarrage de Tailscale sur cet hôte",
|
||||
alwaysOn: "Toujours activé, car cet hôte accepte déjà les connexions Tailscale",
|
||||
socket: "Désactivé, car cet hôte écoute sur un socket local",
|
||||
launch: "Contrôlé par la commande qui démarre cet hôte",
|
||||
update: "Mettez cet hôte à jour pour utiliser Tailscale",
|
||||
updateDocs: "Comment mettre à jour",
|
||||
address: "Sur un téléphone avec Tailscale, ajoutez un hôte à cette adresse",
|
||||
statusError: "Impossible de vérifier Tailscale",
|
||||
turnOnError: "Impossible d’activer Tailscale",
|
||||
turnOffError: "Impossible de désactiver Tailscale",
|
||||
confirmTitle: "Désactiver Tailscale ?",
|
||||
confirmMessage: "Cet appareil est connecté via Tailscale et perdra sa connexion à l’hôte.",
|
||||
confirmAction: "Désactiver",
|
||||
},
|
||||
},
|
||||
pairing: {
|
||||
hostPassword: {
|
||||
title: "Mot de passe pour {{host}}",
|
||||
@@ -2679,9 +2716,28 @@ export const fr: TranslationResources = {
|
||||
stable: "Stable",
|
||||
beta: "Bêta",
|
||||
},
|
||||
autoUpdate: {
|
||||
label: "Mises à jour automatiques",
|
||||
options: {
|
||||
automatic: "Auto",
|
||||
notify: "Notifier",
|
||||
off: "Désactivé",
|
||||
},
|
||||
descriptions: {
|
||||
automatic: "Vérifier et télécharger les mises à jour en arrière-plan",
|
||||
notify: "Vérifier les mises à jour, mais ne télécharger que lorsque vous choisissez",
|
||||
off: "Ne jamais vérifier automatiquement. Vérifier uniquement sur clic sur Vérifier",
|
||||
},
|
||||
},
|
||||
updates: {
|
||||
label: "Mises à jour de l’application",
|
||||
readyToInstall: "Prête à installer : {{version}}",
|
||||
downloadTitle: "Télécharger la mise à jour de l’app de bureau",
|
||||
downloadMessage: "La mise à jour de Paseo sera téléchargée et installée sur cet ordinateur",
|
||||
downloadConfirm: "Télécharger et installer",
|
||||
download: "Télécharger",
|
||||
downloadTo: "Télécharger {{version}}",
|
||||
downloading: "Téléchargement…",
|
||||
installTitle: "Installer la mise à jour de l’app de bureau",
|
||||
installMessage: "Paseo sera mis à jour sur cet ordinateur",
|
||||
installConfirm: "Installer la mise à jour",
|
||||
@@ -2957,9 +3013,7 @@ export const fr: TranslationResources = {
|
||||
timeout: "Délai dépassé",
|
||||
},
|
||||
pairDevices: {
|
||||
title: "Associer des appareils",
|
||||
rowTitle: "Associer un appareil",
|
||||
rowHint: "Scannez un QR code ou copiez un lien pour connecter votre téléphone à cet hôte",
|
||||
},
|
||||
skills: {
|
||||
...en.settings.host.skills,
|
||||
|
||||
@@ -748,8 +748,6 @@ export const ja: TranslationResources = {
|
||||
resumeCommandUnavailable: "再開コマンドが利用できません",
|
||||
reloadingAgent: "エージェントを再読み込み中...",
|
||||
reloadedAgent: "エージェントを再読み込みしました",
|
||||
reloadedAgentHistoryDiverged:
|
||||
"エージェントを再読み込みしましたが、プロバイダーの履歴がこのチャットと一致しないため同期しませんでした",
|
||||
failedToReloadAgent: "エージェントの再読み込みに失敗しました",
|
||||
failedToCloseAgent: "エージェントを閉じられませんでした",
|
||||
},
|
||||
@@ -1567,6 +1565,8 @@ export const ja: TranslationResources = {
|
||||
status: {
|
||||
checking: "アプリの更新を確認中...",
|
||||
installing: "アプリの更新をインストール中...",
|
||||
downloadingVersionProgress: "{{version}} をダウンロード中... {{percent}}%",
|
||||
downloadingProgress: "アプリの更新をダウンロード中... {{percent}}%",
|
||||
upToDate: "アプリは最新です。",
|
||||
upToDateWithLastChecked: "最新の状態です。最終確認: {{time}}。",
|
||||
pending: "更新の準備ができたらお知らせします。",
|
||||
@@ -1574,6 +1574,15 @@ export const ja: TranslationResources = {
|
||||
pendingWithVersion: "更新が見つかりました: {{version}}。ダウンロード中...",
|
||||
pendingWithVersionAndLastChecked:
|
||||
"更新が見つかりました: {{version}}。ダウンロード中... 最終確認: {{time}}。",
|
||||
pendingWithVersionProgress:
|
||||
"更新が見つかりました: {{version}}。ダウンロード中... {{percent}}%",
|
||||
pendingWithVersionProgressAndLastChecked:
|
||||
"更新が見つかりました: {{version}}。ダウンロード中... {{percent}}% 最終確認: {{time}}。",
|
||||
downloadAvailableWithVersion: "利用可能な更新: {{version}}",
|
||||
downloadAvailableWithVersionAndLastChecked:
|
||||
"利用可能な更新: {{version}}。最終確認: {{time}}。",
|
||||
downloadAvailable: "アプリの更新が利用可能です。",
|
||||
downloadAvailableWithLastChecked: "アプリの更新が利用可能です。最終確認: {{time}}。",
|
||||
availableWithVersion: "更新の準備ができました: {{version}}",
|
||||
availableWithVersionAndLastChecked:
|
||||
"更新の準備ができました: {{version}}。最終確認: {{time}}。",
|
||||
@@ -1585,14 +1594,21 @@ export const ja: TranslationResources = {
|
||||
},
|
||||
installError: "デスクトップアプリの更新をインストールできません。",
|
||||
callout: {
|
||||
downloadingTitle: "更新をダウンロード中",
|
||||
installingTitle: "更新をインストール中",
|
||||
failedTitle: "更新に失敗しました",
|
||||
availableTitle: "更新が利用可能",
|
||||
genericError: "問題が発生しました。",
|
||||
whatsNew: "新機能",
|
||||
downloadingAction: "ダウンロード中...",
|
||||
installingAction: "インストール中...",
|
||||
downloadAndRestart: "ダウンロード",
|
||||
installAndRestart: "インストールして再起動",
|
||||
downloadingVersionDescription: "{{version}} をダウンロード中... {{percent}}%",
|
||||
downloadingDescription: "更新をダウンロード中... {{percent}}%",
|
||||
installingDescription: "インストールして再起動中...",
|
||||
versionAvailable: "{{version}} をダウンロードできます。",
|
||||
newVersionAvailable: "新しいバージョンをダウンロードできます。",
|
||||
versionReady: "{{version}}のインストール準備ができました。",
|
||||
newVersionReady: "新しいバージョンのインストール準備ができました。",
|
||||
restartWarning:
|
||||
@@ -1813,12 +1829,6 @@ export const ja: TranslationResources = {
|
||||
"フル機能のネイティブモバイルアプリで、スマートフォンからどの Paseo コンピューターでも操作できます",
|
||||
appStore: "App Store",
|
||||
googlePlay: "Google Play",
|
||||
connectTitle: "接続方法を選択",
|
||||
connectDocs: "ドキュメント",
|
||||
openConnectDocs: "接続のドキュメントを開く",
|
||||
recommended: "おすすめ",
|
||||
relay: { title: "リレー", hint: "エンドツーエンド暗号化、QR コードをスキャン" },
|
||||
tailscale: { title: "Tailscale", hint: "少し設定が必要です" },
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1897,6 +1907,32 @@ export const ja: TranslationResources = {
|
||||
hostDisconnected: "ホストが接続されていません",
|
||||
},
|
||||
},
|
||||
devices: {
|
||||
title: "デバイス",
|
||||
waysToConnect: "接続方法",
|
||||
docs: "ドキュメント",
|
||||
docsAccessibility: "接続のドキュメントを開く",
|
||||
recommended: "おすすめ",
|
||||
relay: { title: "リレー", hint: "エンドツーエンド暗号化、QR コードをスキャン" },
|
||||
tailscale: {
|
||||
hint: "tailnet 経由で直接接続、アドレスを入力",
|
||||
unavailable: "このホストで Tailscale が動作していません",
|
||||
install: "Tailscale を入手",
|
||||
waiting: "このホストで Tailscale が起動するのを待っています",
|
||||
alwaysOn: "常にオン。このホストはすでに Tailscale からの接続を受け付けています",
|
||||
socket: "オフ。このホストはローカルソケットで待ち受けています",
|
||||
launch: "このホストを起動するコマンドで制御されています",
|
||||
update: "Tailscale を使うにはこのホストを更新してください",
|
||||
updateDocs: "更新方法",
|
||||
address: "Tailscale を使うスマートフォンで、このアドレスのホストを追加してください",
|
||||
statusError: "Tailscale を確認できませんでした",
|
||||
turnOnError: "Tailscale をオンにできませんでした",
|
||||
turnOffError: "Tailscale をオフにできませんでした",
|
||||
confirmTitle: "Tailscale をオフにしますか?",
|
||||
confirmMessage: "このデバイスは Tailscale 経由で接続しているため、ホストとの接続が切れます。",
|
||||
confirmAction: "オフにする",
|
||||
},
|
||||
},
|
||||
pairing: {
|
||||
hostPassword: {
|
||||
title: "{{host}} のパスワード",
|
||||
@@ -2646,9 +2682,28 @@ export const ja: TranslationResources = {
|
||||
stable: "安定版",
|
||||
beta: "ベータ",
|
||||
},
|
||||
autoUpdate: {
|
||||
label: "自動更新",
|
||||
options: {
|
||||
automatic: "自動",
|
||||
notify: "通知のみ",
|
||||
off: "オフ",
|
||||
},
|
||||
descriptions: {
|
||||
automatic: "バックグラウンドで更新を確認してダウンロードします",
|
||||
notify: "更新を確認しますが、選択したときだけダウンロードします",
|
||||
off: "自動で更新を確認しません。「確認」をクリックしたときだけ確認します",
|
||||
},
|
||||
},
|
||||
updates: {
|
||||
label: "アプリの更新",
|
||||
readyToInstall: "インストール準備完了: {{version}}",
|
||||
downloadTitle: "デスクトップの更新をダウンロード",
|
||||
downloadMessage: "このコンピューターにPaseoの更新をダウンロードしてインストールします",
|
||||
downloadConfirm: "ダウンロードしてインストール",
|
||||
download: "ダウンロード",
|
||||
downloadTo: "{{version}}をダウンロード",
|
||||
downloading: "ダウンロード中...",
|
||||
installTitle: "デスクトップの更新をインストール",
|
||||
installMessage: "このコンピューターのPaseoを更新します",
|
||||
installConfirm: "更新をインストール",
|
||||
@@ -2923,9 +2978,7 @@ export const ja: TranslationResources = {
|
||||
timeout: "タイムアウト",
|
||||
},
|
||||
pairDevices: {
|
||||
title: "デバイスをペアリング",
|
||||
rowTitle: "デバイスをペアリング",
|
||||
rowHint: "QRコードをスキャンするかリンクをコピーしてスマートフォンをこのホストに接続",
|
||||
},
|
||||
skills: {
|
||||
...en.settings.host.skills,
|
||||
|
||||
@@ -743,8 +743,6 @@ export const ko: TranslationResources = {
|
||||
resumeCommandUnavailable: "재개 명령을 사용할 수 없습니다",
|
||||
reloadingAgent: "에이전트 다시 로드 중...",
|
||||
reloadedAgent: "에이전트를 다시 로드했습니다",
|
||||
reloadedAgentHistoryDiverged:
|
||||
"에이전트를 다시 로드했지만 제공자 기록이 이 채팅과 일치하지 않아 동기화하지 않았습니다",
|
||||
failedToReloadAgent: "에이전트를 다시 로드하지 못했습니다",
|
||||
failedToCloseAgent: "에이전트를 닫지 못했습니다",
|
||||
},
|
||||
@@ -1558,6 +1556,8 @@ export const ko: TranslationResources = {
|
||||
status: {
|
||||
checking: "앱 업데이트 확인 중...",
|
||||
installing: "앱 업데이트 설치 중...",
|
||||
downloadingVersionProgress: "{{version}} 다운로드 중... {{percent}}%",
|
||||
downloadingProgress: "앱 업데이트 다운로드 중... {{percent}}%",
|
||||
upToDate: "앱이 최신 상태입니다.",
|
||||
upToDateWithLastChecked: "최신 상태입니다. 마지막 확인: {{time}}.",
|
||||
pending: "업데이트가 준비되면 알려드리겠습니다.",
|
||||
@@ -1566,6 +1566,15 @@ export const ko: TranslationResources = {
|
||||
pendingWithVersion: "업데이트 발견: {{version}}. 다운로드 중...",
|
||||
pendingWithVersionAndLastChecked:
|
||||
"업데이트 발견: {{version}}. 다운로드 중... {{time}}에서 마지막으로 확인했습니다.",
|
||||
pendingWithVersionProgress: "업데이트 발견: {{version}}. 다운로드 중... {{percent}}%",
|
||||
pendingWithVersionProgressAndLastChecked:
|
||||
"업데이트 발견: {{version}}. 다운로드 중... {{percent}}% {{time}}에서 마지막으로 확인했습니다.",
|
||||
downloadAvailableWithVersion: "사용 가능한 업데이트: {{version}}",
|
||||
downloadAvailableWithVersionAndLastChecked:
|
||||
"사용 가능한 업데이트: {{version}}. {{time}}에서 마지막으로 확인했습니다.",
|
||||
downloadAvailable: "사용 가능한 앱 업데이트가 있습니다.",
|
||||
downloadAvailableWithLastChecked:
|
||||
"사용 가능한 앱 업데이트가 있습니다. {{time}}에서 마지막으로 확인했습니다.",
|
||||
availableWithVersion: "업데이트 준비됨: {{version}}",
|
||||
availableWithVersionAndLastChecked:
|
||||
"업데이트 준비됨: {{version}}. {{time}}에서 마지막으로 확인했습니다.",
|
||||
@@ -1578,14 +1587,21 @@ export const ko: TranslationResources = {
|
||||
},
|
||||
installError: "데스크톱 앱 업데이트를 설치할 수 없습니다.",
|
||||
callout: {
|
||||
downloadingTitle: "업데이트 다운로드 중",
|
||||
installingTitle: "업데이트 설치 중",
|
||||
failedTitle: "업데이트 실패",
|
||||
availableTitle: "업데이트 사용 가능",
|
||||
genericError: "문제가 발생했습니다.",
|
||||
whatsNew: "새로운 기능",
|
||||
downloadingAction: "다운로드 중...",
|
||||
installingAction: "설치 중...",
|
||||
downloadAndRestart: "다운로드",
|
||||
installAndRestart: "설치 후 재시작",
|
||||
downloadingVersionDescription: "{{version}} 다운로드 중... {{percent}}%",
|
||||
downloadingDescription: "업데이트 다운로드 중... {{percent}}%",
|
||||
installingDescription: "설치 후 재시작 중...",
|
||||
versionAvailable: "{{version}} 버전을 다운로드할 수 있습니다.",
|
||||
newVersionAvailable: "새 버전을 다운로드할 수 있습니다.",
|
||||
versionReady: "{{version}} 설치가 준비되었습니다.",
|
||||
newVersionReady: "새 버전 설치가 준비되었습니다.",
|
||||
restartWarning: "앱을 업그레이드하면 실행 중인 에이전트가 중지되고 터미널 세션이 닫힙니다.",
|
||||
@@ -1804,12 +1820,6 @@ export const ko: TranslationResources = {
|
||||
"모든 기능을 갖춘 네이티브 모바일 앱으로 휴대폰에서 어떤 Paseo 컴퓨터든 제어할 수 있습니다",
|
||||
appStore: "App Store",
|
||||
googlePlay: "Google Play",
|
||||
connectTitle: "연결 방법 선택",
|
||||
connectDocs: "문서",
|
||||
openConnectDocs: "연결 문서 열기",
|
||||
recommended: "권장",
|
||||
relay: { title: "릴레이", hint: "엔드투엔드 암호화, QR 코드를 스캔하세요" },
|
||||
tailscale: { title: "Tailscale", hint: "약간의 설정이 필요합니다" },
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1888,6 +1898,32 @@ export const ko: TranslationResources = {
|
||||
hostDisconnected: "호스트가 연결되어 있지 않습니다",
|
||||
},
|
||||
},
|
||||
devices: {
|
||||
title: "기기",
|
||||
waysToConnect: "연결 방법",
|
||||
docs: "문서",
|
||||
docsAccessibility: "연결 문서 열기",
|
||||
recommended: "권장",
|
||||
relay: { title: "릴레이", hint: "엔드투엔드 암호화, QR 코드를 스캔하세요" },
|
||||
tailscale: {
|
||||
hint: "tailnet으로 직접 연결, 주소 입력",
|
||||
unavailable: "이 호스트에서 Tailscale이 실행 중이 아닙니다",
|
||||
install: "Tailscale 받기",
|
||||
waiting: "이 호스트에서 Tailscale이 시작되기를 기다리는 중",
|
||||
alwaysOn: "항상 켜짐. 이 호스트가 이미 Tailscale 연결을 받고 있습니다",
|
||||
socket: "꺼짐. 이 호스트가 로컬 소켓에서 수신 대기 중입니다",
|
||||
launch: "이 호스트를 시작하는 명령이 제어합니다",
|
||||
update: "Tailscale을 사용하려면 이 호스트를 업데이트하세요",
|
||||
updateDocs: "업데이트 방법",
|
||||
address: "Tailscale을 사용하는 휴대전화에서 이 주소로 호스트를 추가하세요",
|
||||
statusError: "Tailscale을 확인하지 못했습니다",
|
||||
turnOnError: "Tailscale을 켜지 못했습니다",
|
||||
turnOffError: "Tailscale을 끄지 못했습니다",
|
||||
confirmTitle: "Tailscale을 끌까요?",
|
||||
confirmMessage: "이 기기는 Tailscale로 연결되어 있어 호스트와의 연결이 끊깁니다.",
|
||||
confirmAction: "끄기",
|
||||
},
|
||||
},
|
||||
pairing: {
|
||||
hostPassword: {
|
||||
title: "{{host}}의 비밀번호",
|
||||
@@ -2636,9 +2672,28 @@ export const ko: TranslationResources = {
|
||||
stable: "안정",
|
||||
beta: "베타",
|
||||
},
|
||||
autoUpdate: {
|
||||
label: "자동 업데이트",
|
||||
options: {
|
||||
automatic: "자동",
|
||||
notify: "알림만",
|
||||
off: "끄기",
|
||||
},
|
||||
descriptions: {
|
||||
automatic: "백그라운드에서 업데이트를 확인하고 다운로드합니다",
|
||||
notify: "업데이트를 확인하지만 선택할 때만 다운로드합니다",
|
||||
off: "자동으로 확인하지 않습니다. 확인 버튼을 누를 때만 확인합니다",
|
||||
},
|
||||
},
|
||||
updates: {
|
||||
label: "앱 업데이트",
|
||||
readyToInstall: "설치 준비됨: {{version}}",
|
||||
downloadTitle: "데스크톱 업데이트 다운로드",
|
||||
downloadMessage: "이 컴퓨터에 Paseo 업데이트를 다운로드하고 설치합니다",
|
||||
downloadConfirm: "다운로드 및 설치",
|
||||
download: "다운로드",
|
||||
downloadTo: "{{version}} 다운로드",
|
||||
downloading: "다운로드 중...",
|
||||
installTitle: "데스크톱 업데이트 설치",
|
||||
installMessage: "이 컴퓨터의 Paseo를 업데이트합니다",
|
||||
installConfirm: "업데이트 설치",
|
||||
@@ -2909,9 +2964,7 @@ export const ko: TranslationResources = {
|
||||
timeout: "시간 초과",
|
||||
},
|
||||
pairDevices: {
|
||||
title: "기기 페어링",
|
||||
rowTitle: "기기 페어링",
|
||||
rowHint: "QR 코드를 스캔하거나 링크를 복사하여 휴대폰을 이 호스트에 연결하세요",
|
||||
},
|
||||
skills: {
|
||||
...en.settings.host.skills,
|
||||
|
||||
@@ -746,8 +746,6 @@ export const ptBR: TranslationResources = {
|
||||
resumeCommandUnavailable: "Comando de retomada indisponível",
|
||||
reloadingAgent: "Recarregando agente...",
|
||||
reloadedAgent: "Agente recarregado",
|
||||
reloadedAgentHistoryDiverged:
|
||||
"Agente recarregado, mas o histórico do provedor não corresponde a este chat, então não foi sincronizado",
|
||||
failedToReloadAgent: "Falha ao recarregar agente",
|
||||
failedToCloseAgent: "Falha ao fechar agente",
|
||||
},
|
||||
@@ -1579,6 +1577,8 @@ export const ptBR: TranslationResources = {
|
||||
status: {
|
||||
checking: "Verificando atualizações do app...",
|
||||
installing: "Instalando atualização do app...",
|
||||
downloadingVersionProgress: "Baixando {{version}}... {{percent}}%",
|
||||
downloadingProgress: "Baixando atualização do app... {{percent}}%",
|
||||
upToDate: "O app está atualizado.",
|
||||
upToDateWithLastChecked: "Atualizado. Última verificação às {{time}}.",
|
||||
pending: "Avisaremos quando a atualização estiver pronta.",
|
||||
@@ -1587,6 +1587,15 @@ export const ptBR: TranslationResources = {
|
||||
pendingWithVersion: "Atualização encontrada: {{version}}. Baixando...",
|
||||
pendingWithVersionAndLastChecked:
|
||||
"Atualização encontrada: {{version}}. Baixando... Última verificação às {{time}}.",
|
||||
pendingWithVersionProgress: "Atualização encontrada: {{version}}. Baixando... {{percent}}%",
|
||||
pendingWithVersionProgressAndLastChecked:
|
||||
"Atualização encontrada: {{version}}. Baixando... {{percent}}% Última verificação às {{time}}.",
|
||||
downloadAvailableWithVersion: "Atualização disponível: {{version}}",
|
||||
downloadAvailableWithVersionAndLastChecked:
|
||||
"Atualização disponível: {{version}}. Última verificação às {{time}}.",
|
||||
downloadAvailable: "Há uma atualização do app disponível.",
|
||||
downloadAvailableWithLastChecked:
|
||||
"Há uma atualização do app disponível. Última verificação às {{time}}.",
|
||||
availableWithVersion: "Atualização pronta: {{version}}",
|
||||
availableWithVersionAndLastChecked:
|
||||
"Atualização pronta: {{version}}. Última verificação às {{time}}.",
|
||||
@@ -1599,14 +1608,21 @@ export const ptBR: TranslationResources = {
|
||||
},
|
||||
installError: "Não foi possível instalar a atualização do app desktop.",
|
||||
callout: {
|
||||
downloadingTitle: "Baixando atualização",
|
||||
installingTitle: "Instalando atualização",
|
||||
failedTitle: "Falha na atualização",
|
||||
availableTitle: "Atualização disponível",
|
||||
genericError: "Algo deu errado.",
|
||||
whatsNew: "Novidades",
|
||||
downloadingAction: "Baixando...",
|
||||
installingAction: "Instalando...",
|
||||
downloadAndRestart: "Baixar",
|
||||
installAndRestart: "Instalar e reiniciar",
|
||||
downloadingVersionDescription: "Baixando {{version}}... {{percent}}%",
|
||||
downloadingDescription: "Baixando atualização... {{percent}}%",
|
||||
installingDescription: "Instalando e reiniciando...",
|
||||
versionAvailable: "{{version}} está disponível para download.",
|
||||
newVersionAvailable: "Uma nova versão está disponível para download.",
|
||||
versionReady: "{{version}} está pronta para instalar.",
|
||||
newVersionReady: "Uma nova versão está pronta para instalar.",
|
||||
restartWarning:
|
||||
@@ -1826,12 +1842,6 @@ export const ptBR: TranslationResources = {
|
||||
"O app móvel nativo completo permite controlar qualquer computador com Paseo pelo seu celular",
|
||||
appStore: "App Store",
|
||||
googlePlay: "Google Play",
|
||||
connectTitle: "Escolha como se conectar",
|
||||
connectDocs: "Docs",
|
||||
openConnectDocs: "Abrir documentação de conectividade",
|
||||
recommended: "Recomendado",
|
||||
relay: { title: "Relay", hint: "Criptografia de ponta a ponta, escaneie um código QR" },
|
||||
tailscale: { title: "Tailscale", hint: "Requer alguma configuração" },
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1910,6 +1920,33 @@ export const ptBR: TranslationResources = {
|
||||
hostDisconnected: "Host não está conectado",
|
||||
},
|
||||
},
|
||||
devices: {
|
||||
title: "Dispositivos",
|
||||
waysToConnect: "Formas de conexão",
|
||||
docs: "Docs",
|
||||
docsAccessibility: "Abrir documentação de conectividade",
|
||||
recommended: "Recomendado",
|
||||
relay: { title: "Relay", hint: "Criptografia de ponta a ponta, escaneie um código QR" },
|
||||
tailscale: {
|
||||
hint: "Conexão direta pela sua tailnet, digite um endereço",
|
||||
unavailable: "O Tailscale não está em execução neste host",
|
||||
install: "Baixar o Tailscale",
|
||||
waiting: "Aguardando o Tailscale iniciar neste host",
|
||||
alwaysOn: "Sempre ativado, porque este host já aceita conexões do Tailscale",
|
||||
socket: "Desativado, porque este host escuta em um socket local",
|
||||
launch: "Controlado pelo comando que inicia este host",
|
||||
update: "Atualize este host para usar o Tailscale",
|
||||
updateDocs: "Como atualizar",
|
||||
address: "Em um celular com Tailscale, adicione um host com este endereço",
|
||||
statusError: "Não foi possível verificar o Tailscale",
|
||||
turnOnError: "Não foi possível ativar o Tailscale",
|
||||
turnOffError: "Não foi possível desativar o Tailscale",
|
||||
confirmTitle: "Desativar o Tailscale?",
|
||||
confirmMessage:
|
||||
"Este dispositivo está conectado pelo Tailscale e perderá a conexão com o host.",
|
||||
confirmAction: "Desativar",
|
||||
},
|
||||
},
|
||||
pairing: {
|
||||
hostPassword: {
|
||||
title: "Senha de {{host}}",
|
||||
@@ -2661,9 +2698,28 @@ export const ptBR: TranslationResources = {
|
||||
stable: "Stable",
|
||||
beta: "Beta",
|
||||
},
|
||||
autoUpdate: {
|
||||
label: "Atualizações automáticas",
|
||||
options: {
|
||||
automatic: "Auto",
|
||||
notify: "Notificar",
|
||||
off: "Desativado",
|
||||
},
|
||||
descriptions: {
|
||||
automatic: "Verificar e baixar atualizações em segundo plano",
|
||||
notify: "Verificar atualizações, mas baixar apenas quando você escolher",
|
||||
off: "Nunca verificar automaticamente. Verificar apenas ao clicar em Verificar",
|
||||
},
|
||||
},
|
||||
updates: {
|
||||
label: "Atualizações do app",
|
||||
readyToInstall: "Pronta para instalar: {{version}}",
|
||||
downloadTitle: "Baixar atualização desktop",
|
||||
downloadMessage: "Isso baixa e instala a atualização do Paseo neste computador",
|
||||
downloadConfirm: "Baixar e instalar",
|
||||
download: "Baixar",
|
||||
downloadTo: "Baixar {{version}}",
|
||||
downloading: "Baixando...",
|
||||
installTitle: "Instalar atualização desktop",
|
||||
installMessage: "Isso atualiza o Paseo neste computador",
|
||||
installConfirm: "Instalar atualização",
|
||||
@@ -2936,9 +2992,7 @@ export const ptBR: TranslationResources = {
|
||||
timeout: "Timeout",
|
||||
},
|
||||
pairDevices: {
|
||||
title: "Parear dispositivos",
|
||||
rowTitle: "Parear um dispositivo",
|
||||
rowHint: "Escaneie um QR code ou copie um link para conectar seu celular a este host",
|
||||
},
|
||||
skills: {
|
||||
...en.settings.host.skills,
|
||||
|
||||
@@ -749,8 +749,6 @@ export const ru: TranslationResources = {
|
||||
resumeCommandUnavailable: "Команда возобновления недоступна",
|
||||
reloadingAgent: "Перезагрузка агента...",
|
||||
reloadedAgent: "Агент перезагружен",
|
||||
reloadedAgentHistoryDiverged:
|
||||
"Агент перезагружен, но история провайдера не совпадает с этим чатом, поэтому она не синхронизирована",
|
||||
failedToReloadAgent: "Не удалось перезагрузить агента",
|
||||
failedToCloseAgent: "Не удалось закрыть агента",
|
||||
},
|
||||
@@ -1573,6 +1571,8 @@ export const ru: TranslationResources = {
|
||||
status: {
|
||||
checking: "Проверка обновлений приложения...",
|
||||
installing: "Установка обновления приложения...",
|
||||
downloadingVersionProgress: "Загрузка {{version}}... {{percent}}%",
|
||||
downloadingProgress: "Загрузка обновления приложения... {{percent}}%",
|
||||
upToDate: "Установлена последняя версия приложения.",
|
||||
upToDateWithLastChecked:
|
||||
"Установлена последняя версия приложения. Последняя проверка: {{time}}.",
|
||||
@@ -1582,6 +1582,15 @@ export const ru: TranslationResources = {
|
||||
pendingWithVersion: "Найдено обновление: {{version}}. Загрузка...",
|
||||
pendingWithVersionAndLastChecked:
|
||||
"Найдено обновление: {{version}}. Загрузка... Последняя проверка в {{time}}.",
|
||||
pendingWithVersionProgress: "Найдено обновление: {{version}}. Загрузка... {{percent}}%",
|
||||
pendingWithVersionProgressAndLastChecked:
|
||||
"Найдено обновление: {{version}}. Загрузка... {{percent}}% Последняя проверка в {{time}}.",
|
||||
downloadAvailableWithVersion: "Доступно обновление: {{version}}",
|
||||
downloadAvailableWithVersionAndLastChecked:
|
||||
"Доступно обновление: {{version}}. Последняя проверка: {{time}}.",
|
||||
downloadAvailable: "Доступно обновление приложения.",
|
||||
downloadAvailableWithLastChecked:
|
||||
"Доступно обновление приложения. Последняя проверка: {{time}}.",
|
||||
availableWithVersion: "Обновление готово: {{version}}",
|
||||
availableWithVersionAndLastChecked:
|
||||
"Обновление готово: {{version}}. Последняя проверка: {{time}}.",
|
||||
@@ -1594,14 +1603,21 @@ export const ru: TranslationResources = {
|
||||
},
|
||||
installError: "Не удалось установить обновление настольного приложения.",
|
||||
callout: {
|
||||
downloadingTitle: "Загрузка обновления",
|
||||
installingTitle: "Установка обновления",
|
||||
failedTitle: "Обновление не выполнено",
|
||||
availableTitle: "Доступно обновление",
|
||||
genericError: "Что-то пошло не так.",
|
||||
whatsNew: "Что нового",
|
||||
downloadingAction: "Загрузка...",
|
||||
installingAction: "Установка...",
|
||||
downloadAndRestart: "Скачать",
|
||||
installAndRestart: "Установить и перезапустить",
|
||||
downloadingVersionDescription: "Загрузка {{version}}... {{percent}}%",
|
||||
downloadingDescription: "Загрузка обновления... {{percent}}%",
|
||||
installingDescription: "Установка и перезапуск...",
|
||||
versionAvailable: "Версия {{version}} доступна для загрузки.",
|
||||
newVersionAvailable: "Новая версия доступна для загрузки.",
|
||||
versionReady: "Версия {{version}} готова к установке.",
|
||||
newVersionReady: "Новая версия готова к установке.",
|
||||
restartWarning:
|
||||
@@ -1826,12 +1842,6 @@ export const ru: TranslationResources = {
|
||||
"Полнофункциональное нативное мобильное приложение позволяет управлять любым компьютером с Paseo с телефона",
|
||||
appStore: "App Store",
|
||||
googlePlay: "Google Play",
|
||||
connectTitle: "Выберите способ подключения",
|
||||
connectDocs: "Документация",
|
||||
openConnectDocs: "Открыть документацию по подключению",
|
||||
recommended: "Рекомендуется",
|
||||
relay: { title: "Ретранслятор", hint: "Сквозное шифрование, отсканируйте QR-код" },
|
||||
tailscale: { title: "Tailscale", hint: "Требует небольшой настройки" },
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1910,6 +1920,32 @@ export const ru: TranslationResources = {
|
||||
hostDisconnected: "Хост не подключён",
|
||||
},
|
||||
},
|
||||
devices: {
|
||||
title: "Устройства",
|
||||
waysToConnect: "Способы подключения",
|
||||
docs: "Документация",
|
||||
docsAccessibility: "Открыть документацию по подключению",
|
||||
recommended: "Рекомендуется",
|
||||
relay: { title: "Ретранслятор", hint: "Сквозное шифрование, отсканируйте QR-код" },
|
||||
tailscale: {
|
||||
hint: "Прямое подключение через ваш tailnet, по адресу",
|
||||
unavailable: "Tailscale не запущен на этом хосте",
|
||||
install: "Скачать Tailscale",
|
||||
waiting: "Ожидаем запуска Tailscale на этом хосте",
|
||||
alwaysOn: "Всегда включено, так как хост уже принимает подключения Tailscale",
|
||||
socket: "Выключено, так как хост слушает локальный сокет",
|
||||
launch: "Управляется командой, которая запускает этот хост",
|
||||
update: "Обновите этот хост, чтобы использовать Tailscale",
|
||||
updateDocs: "Как обновить",
|
||||
address: "На телефоне с Tailscale добавьте хост с этим адресом",
|
||||
statusError: "Не удалось проверить Tailscale",
|
||||
turnOnError: "Не удалось включить Tailscale",
|
||||
turnOffError: "Не удалось выключить Tailscale",
|
||||
confirmTitle: "Выключить Tailscale?",
|
||||
confirmMessage: "Это устройство подключено через Tailscale и потеряет соединение с хостом.",
|
||||
confirmAction: "Выключить",
|
||||
},
|
||||
},
|
||||
pairing: {
|
||||
hostPassword: {
|
||||
title: "Пароль для {{host}}",
|
||||
@@ -2668,9 +2704,28 @@ export const ru: TranslationResources = {
|
||||
stable: "Стабильный",
|
||||
beta: "Бета",
|
||||
},
|
||||
autoUpdate: {
|
||||
label: "Автообновления",
|
||||
options: {
|
||||
automatic: "Авто",
|
||||
notify: "Уведомлять",
|
||||
off: "Выкл.",
|
||||
},
|
||||
descriptions: {
|
||||
automatic: "Проверять и загружать обновления в фоновом режиме",
|
||||
notify: "Проверять обновления, но загружать только по вашему выбору",
|
||||
off: "Не проверять автоматически. Проверять только по нажатию кнопки Проверить",
|
||||
},
|
||||
},
|
||||
updates: {
|
||||
label: "Обновления приложения",
|
||||
readyToInstall: "Версия {{version}} готова к установке",
|
||||
downloadTitle: "Загрузить обновление настольного приложения",
|
||||
downloadMessage: "Это загрузит и установит обновление Paseo на этом компьютере.",
|
||||
downloadConfirm: "Загрузить и установить",
|
||||
download: "Загрузить",
|
||||
downloadTo: "Загрузить {{version}}",
|
||||
downloading: "Загрузка...",
|
||||
installTitle: "Установить обновление настольного приложения",
|
||||
installMessage: "Это обновит Paseo на этом компьютере.",
|
||||
installConfirm: "Установить обновление",
|
||||
@@ -2944,10 +2999,7 @@ export const ru: TranslationResources = {
|
||||
timeout: "Время ожидания истекло",
|
||||
},
|
||||
pairDevices: {
|
||||
title: "Подключение устройств",
|
||||
rowTitle: "Подключить устройство",
|
||||
rowHint:
|
||||
"Отсканируйте QR-код или скопируйте ссылку, чтобы подключить телефон к этому хосту.",
|
||||
},
|
||||
skills: {
|
||||
sectionTitle: "Навыки оркестрации",
|
||||
|
||||
@@ -741,8 +741,6 @@ export const zhCN: TranslationResources = {
|
||||
resumeCommandUnavailable: "恢复命令不可用",
|
||||
reloadingAgent: "正在重新加载 Agent...",
|
||||
reloadedAgent: "已重新加载 Agent",
|
||||
reloadedAgentHistoryDiverged:
|
||||
"已重新加载 Agent,但提供方的历史记录与此对话不一致,因此未同步",
|
||||
failedToReloadAgent: "重新加载 Agent 失败",
|
||||
failedToCloseAgent: "关闭 Agent 失败",
|
||||
},
|
||||
@@ -1539,6 +1537,8 @@ export const zhCN: TranslationResources = {
|
||||
status: {
|
||||
checking: "正在检查 app 更新...",
|
||||
installing: "正在安装 app 更新...",
|
||||
downloadingVersionProgress: "正在下载 {{version}}... {{percent}}%",
|
||||
downloadingProgress: "正在下载 app 更新... {{percent}}%",
|
||||
upToDate: "App 已是最新版本。",
|
||||
upToDateWithLastChecked: "已是最新版本。上次检查时间:{{time}}。",
|
||||
pending: "更新准备好后会通知你。",
|
||||
@@ -1546,6 +1546,14 @@ export const zhCN: TranslationResources = {
|
||||
pendingWithVersion: "发现更新:{{version}}。正在下载...",
|
||||
pendingWithVersionAndLastChecked:
|
||||
"发现更新:{{version}}。正在下载... 上次检查时间:{{time}}。",
|
||||
pendingWithVersionProgress: "发现更新:{{version}}。正在下载... {{percent}}%",
|
||||
pendingWithVersionProgressAndLastChecked:
|
||||
"发现更新:{{version}}。正在下载... {{percent}}% 上次检查时间:{{time}}。",
|
||||
downloadAvailableWithVersion: "有可用更新:{{version}}",
|
||||
downloadAvailableWithVersionAndLastChecked:
|
||||
"有可用更新:{{version}}。上次检查时间:{{time}}。",
|
||||
downloadAvailable: "有 app 更新可用。",
|
||||
downloadAvailableWithLastChecked: "有 app 更新可用。上次检查时间:{{time}}。",
|
||||
availableWithVersion: "更新已就绪:{{version}}",
|
||||
availableWithVersionAndLastChecked: "更新已就绪:{{version}}。上次检查时间:{{time}}。",
|
||||
available: "有 app 更新可安装。",
|
||||
@@ -1556,14 +1564,21 @@ export const zhCN: TranslationResources = {
|
||||
},
|
||||
installError: "无法安装 desktop app 更新。",
|
||||
callout: {
|
||||
downloadingTitle: "正在下载更新",
|
||||
installingTitle: "正在安装更新",
|
||||
failedTitle: "更新失败",
|
||||
availableTitle: "有可用更新",
|
||||
genericError: "出了点问题。",
|
||||
whatsNew: "更新内容",
|
||||
downloadingAction: "正在下载...",
|
||||
installingAction: "正在安装...",
|
||||
downloadAndRestart: "下载",
|
||||
installAndRestart: "安装并重启",
|
||||
downloadingVersionDescription: "正在下载 {{version}}... {{percent}}%",
|
||||
downloadingDescription: "正在下载更新... {{percent}}%",
|
||||
installingDescription: "正在安装并重启...",
|
||||
versionAvailable: "{{version}} 可供下载。",
|
||||
newVersionAvailable: "有新版本可供下载。",
|
||||
versionReady: "{{version}} 已准备好安装。",
|
||||
newVersionReady: "新版本已准备好安装。",
|
||||
restartWarning: "升级 app 会停止正在运行的 agents,并关闭 terminal 会话。",
|
||||
@@ -1775,12 +1790,6 @@ export const zhCN: TranslationResources = {
|
||||
description: "功能完整的原生移动应用让你可以在手机上控制任意一台 Paseo 电脑",
|
||||
appStore: "App Store",
|
||||
googlePlay: "Google Play",
|
||||
connectTitle: "选择连接方式",
|
||||
connectDocs: "文档",
|
||||
openConnectDocs: "打开连接文档",
|
||||
recommended: "推荐",
|
||||
relay: { title: "中继", hint: "端到端加密,扫描二维码" },
|
||||
tailscale: { title: "Tailscale", hint: "需要一些设置" },
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1859,6 +1868,32 @@ export const zhCN: TranslationResources = {
|
||||
hostDisconnected: "Host 未连接",
|
||||
},
|
||||
},
|
||||
devices: {
|
||||
title: "设备",
|
||||
waysToConnect: "连接方式",
|
||||
docs: "文档",
|
||||
docsAccessibility: "打开连接文档",
|
||||
recommended: "推荐",
|
||||
relay: { title: "中继", hint: "端到端加密,扫描二维码" },
|
||||
tailscale: {
|
||||
hint: "通过你的 tailnet 直连,输入地址即可",
|
||||
unavailable: "此主机未运行 Tailscale",
|
||||
install: "获取 Tailscale",
|
||||
waiting: "正在等待此主机上的 Tailscale 启动",
|
||||
alwaysOn: "始终开启,因为此主机已接受 Tailscale 连接",
|
||||
socket: "已关闭,因为此主机监听的是本地套接字",
|
||||
launch: "由启动此主机的命令控制",
|
||||
update: "更新此主机以使用 Tailscale",
|
||||
updateDocs: "如何更新",
|
||||
address: "在已连接 Tailscale 的手机上,用此地址添加主机",
|
||||
statusError: "无法检查 Tailscale",
|
||||
turnOnError: "无法开启 Tailscale",
|
||||
turnOffError: "无法关闭 Tailscale",
|
||||
confirmTitle: "关闭 Tailscale?",
|
||||
confirmMessage: "此设备通过 Tailscale 连接,关闭后将与主机断开连接。",
|
||||
confirmAction: "关闭",
|
||||
},
|
||||
},
|
||||
pairing: {
|
||||
hostPassword: {
|
||||
title: "{{host}} 的密码",
|
||||
@@ -2595,9 +2630,28 @@ export const zhCN: TranslationResources = {
|
||||
stable: "Stable",
|
||||
beta: "Beta",
|
||||
},
|
||||
autoUpdate: {
|
||||
label: "自动更新",
|
||||
options: {
|
||||
automatic: "自动",
|
||||
notify: "仅通知",
|
||||
off: "关闭",
|
||||
},
|
||||
descriptions: {
|
||||
automatic: "在后台检查并下载更新",
|
||||
notify: "检查更新,但仅在你选择时才下载",
|
||||
off: "从不自动检查,仅在点击检查时检查更新",
|
||||
},
|
||||
},
|
||||
updates: {
|
||||
label: "应用更新",
|
||||
readyToInstall: "可安装:{{version}}",
|
||||
downloadTitle: "下载桌面版更新",
|
||||
downloadMessage: "这会在此电脑上下载并安装 Paseo 更新",
|
||||
downloadConfirm: "下载并安装",
|
||||
download: "下载",
|
||||
downloadTo: "下载 {{version}}",
|
||||
downloading: "正在下载...",
|
||||
installTitle: "安装桌面版更新",
|
||||
installMessage: "这会更新此电脑上的 Paseo",
|
||||
installConfirm: "安装更新",
|
||||
@@ -2865,9 +2919,7 @@ export const zhCN: TranslationResources = {
|
||||
timeout: "超时",
|
||||
},
|
||||
pairDevices: {
|
||||
title: "配对设备",
|
||||
rowTitle: "配对设备",
|
||||
rowHint: "扫描二维码或复制链接,将手机连接到这个 Host",
|
||||
},
|
||||
skills: {
|
||||
...en.settings.host.skills,
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { useCallback } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { View } from "react-native";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import { AppleIcon } from "@/components/icons/apple-icon";
|
||||
import { GooglePlayIcon } from "@/components/icons/google-play-icon";
|
||||
import { SettingsCard, SettingsDetailRow, SettingsSection } from "@/components/settings";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { StatusBadge } from "@/components/ui/status-badge";
|
||||
import { PairDeviceModal } from "@/desktop/components/pair-device-modal";
|
||||
import {
|
||||
CONNECTIVITY_DOCS_URL,
|
||||
TAILSCALE_DOCS_URL,
|
||||
} from "@/desktop/components/pair-device-section";
|
||||
import { WaysToConnect } from "@/devices";
|
||||
import { ICON_SIZE } from "@/styles/theme";
|
||||
import { openExternalUrl } from "@/utils/open-external-url";
|
||||
|
||||
@@ -26,33 +20,11 @@ function openUrl(url: string) {
|
||||
void openExternalUrl(url).catch(console.error);
|
||||
}
|
||||
|
||||
/** Get the app, then connect it: the relay pairs in a modal, Tailscale is a docs page away. */
|
||||
/** Get the app, then connect it the same ways the host's Devices settings offer. */
|
||||
export function PhoneStep({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const [isPairing, setIsPairing] = useState(false);
|
||||
const openAppStore = useCallback(() => openUrl(APP_STORE_URL), []);
|
||||
const openPlayStore = useCallback(() => openUrl(PLAY_STORE_URL), []);
|
||||
const openTailscaleDocs = useCallback(() => openUrl(TAILSCALE_DOCS_URL), []);
|
||||
const openPairing = useCallback(() => setIsPairing(true), []);
|
||||
const closePairing = useCallback(() => setIsPairing(false), []);
|
||||
const recommendedBadge = useMemo(
|
||||
() => (
|
||||
<StatusBadge
|
||||
size="xs"
|
||||
variant="success"
|
||||
label={t("onboarding.setup.steps.phone.recommended")}
|
||||
/>
|
||||
),
|
||||
[t],
|
||||
);
|
||||
const docsLink = useMemo(
|
||||
() => ({
|
||||
href: CONNECTIVITY_DOCS_URL,
|
||||
label: t("onboarding.setup.steps.phone.connectDocs"),
|
||||
accessibilityLabel: t("onboarding.setup.steps.phone.openConnectDocs"),
|
||||
}),
|
||||
[t],
|
||||
);
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
@@ -64,31 +36,7 @@ export function PhoneStep({ serverId }: { serverId: string }) {
|
||||
{t("onboarding.setup.steps.phone.googlePlay")}
|
||||
</Button>
|
||||
</View>
|
||||
<SettingsSection title={t("onboarding.setup.steps.phone.connectTitle")} link={docsLink}>
|
||||
<SettingsCard>
|
||||
<SettingsDetailRow
|
||||
label={t("onboarding.setup.steps.phone.relay.title")}
|
||||
labelAccessory={recommendedBadge}
|
||||
hint={t("onboarding.setup.steps.phone.relay.hint")}
|
||||
onPress={openPairing}
|
||||
testID="onboarding-phone-relay"
|
||||
/>
|
||||
<SettingsDetailRow
|
||||
label={t("onboarding.setup.steps.phone.tailscale.title")}
|
||||
hint={t("onboarding.setup.steps.phone.tailscale.hint")}
|
||||
summary={t("onboarding.setup.steps.phone.connectDocs")}
|
||||
onPress={openTailscaleDocs}
|
||||
external
|
||||
testID="onboarding-phone-tailscale"
|
||||
/>
|
||||
</SettingsCard>
|
||||
</SettingsSection>
|
||||
<PairDeviceModal
|
||||
serverId={serverId}
|
||||
visible={isPairing}
|
||||
onClose={closePairing}
|
||||
testID="onboarding-pair-device-card"
|
||||
/>
|
||||
<WaysToConnect serverId={serverId} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ describe("plugin timeline projection", () => {
|
||||
kind: "assistant_message",
|
||||
id: "assistant-1",
|
||||
messageId: "provider-msg-1",
|
||||
timelineCursor: { epoch: "e1", seq: 7, anchorSeq: 7 },
|
||||
timelineCursor: { epoch: "e1", seq: 7 },
|
||||
turnId: "turn-1",
|
||||
text: 'Summary\n\n```ui\nCard("Hi", [])\n```',
|
||||
timestamp: new Date("2026-01-01T00:00:02.000Z"),
|
||||
@@ -226,13 +226,13 @@ describe("plugin timeline projection", () => {
|
||||
{
|
||||
kind: "plugin",
|
||||
id: "genui/assistant-1/text",
|
||||
timelineCursor: { epoch: "e1", seq: 7, anchorSeq: 7 },
|
||||
timelineCursor: { epoch: "e1", seq: 7 },
|
||||
turnId: "turn-1",
|
||||
},
|
||||
{
|
||||
kind: "plugin",
|
||||
id: "genui/assistant-1/card",
|
||||
timelineCursor: { epoch: "e1", seq: 7, anchorSeq: 7 },
|
||||
timelineCursor: { epoch: "e1", seq: 7 },
|
||||
turnId: "turn-1",
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -91,7 +91,7 @@ describe("AgentDirectoryReplica", () => {
|
||||
id: "reply",
|
||||
text: "server history",
|
||||
timestamp: new Date(),
|
||||
timelineCursor: { epoch: "e", seq: 1, anchorSeq: 1 },
|
||||
timelineCursor: { epoch: "e", seq: 1 },
|
||||
},
|
||||
],
|
||||
head: [],
|
||||
|
||||
@@ -201,15 +201,9 @@ export class AgentStoreProjection {
|
||||
useDraftStore.getState().clearDraftInput({
|
||||
draftKey: buildDraftStoreKey({ serverId: this.serverId, agentId }),
|
||||
});
|
||||
// Only entity deletion destroys the transcript. A filtered active-list
|
||||
// response can arrive after a fresh history response for an archived agent.
|
||||
const store = useSessionStore.getState();
|
||||
const removeKey = withoutAgent(agentId);
|
||||
store.setAgentTimelineCursor(this.serverId, removeKey);
|
||||
store.setAgentTimelineUnsettledTurn(this.serverId, agentId, null);
|
||||
store.setAgentAuthoritativeHistoryApplied(this.serverId, agentId, false);
|
||||
store.setAgentStreamTail(this.serverId, removeKey);
|
||||
store.clearAgentStreamHead(this.serverId, agentId);
|
||||
// Leaving the active list does not release the transcript: an archived chat open in
|
||||
// History stays readable. The viewed timeline owner releases it once nobody shows it.
|
||||
useSessionStore.getState().releaseAgentTimeline(this.serverId, agentId);
|
||||
}
|
||||
|
||||
archive(agentId: string, archivedAt: string): Agent | null {
|
||||
|
||||
@@ -255,7 +255,6 @@ const PROBE_INACTIVE_WHILE_ONLINE_MAX_MS = 30 * 60_000;
|
||||
const ACTIVE_RTT_WINDOW_MS = 60_000;
|
||||
const ADAPTIVE_SWITCH_THRESHOLD_MS = 40;
|
||||
const ADAPTIVE_SWITCH_MIN_IMPROVEMENT_RATIO = 0.35;
|
||||
const MAX_STALE_TIMELINE_PAGE_ATTEMPTS = 3;
|
||||
const ADAPTIVE_SWITCH_CONSECUTIVE_PROBES = 3;
|
||||
const CONFIGURED_OVERRIDE_BOOTSTRAP_RETRY_MS = 1_000;
|
||||
|
||||
@@ -3129,19 +3128,12 @@ export class HostRuntimeStore {
|
||||
const directory = this.directorySyncByServer.get(serverId);
|
||||
if (!directory) throw new Error(`Unknown host runtime for serverId ${serverId}`);
|
||||
const owner = useSessionStore.getState().sessions[serverId]?.viewedTimelineSync;
|
||||
// A page served before a rewind this client applied is asked for again. Seqs only grow within
|
||||
// an epoch, so the next page includes the rewind unless another one landed meanwhile.
|
||||
for (let attempt = 1; ; attempt += 1) {
|
||||
const page = await directory.fetchTimeline(agentId, request);
|
||||
if (!owner || useSessionStore.getState().sessions[serverId]?.viewedTimelineSync !== owner) {
|
||||
return page;
|
||||
}
|
||||
const page = await directory.fetchTimeline(agentId, request);
|
||||
if (owner && useSessionStore.getState().sessions[serverId]?.viewedTimelineSync === owner) {
|
||||
owner.flushStreamAgent(agentId);
|
||||
if (owner.applyTimelineResponse(page) === "applied") return page;
|
||||
if (attempt === MAX_STALE_TIMELINE_PAGE_ATTEMPTS) {
|
||||
throw new Error(`Timeline page for ${agentId} stayed behind a rewind`);
|
||||
}
|
||||
owner.applyTimelineResponse(page);
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
createViewedTimelineOwner(
|
||||
|
||||
@@ -189,7 +189,7 @@ function timelineItem(text = "Cached"): StreamItem {
|
||||
id: "message-1",
|
||||
text,
|
||||
timestamp: new Date("2026-07-18T08:02:00.000Z"),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 12, anchorSeq: 12 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 12 },
|
||||
};
|
||||
}
|
||||
|
||||
@@ -840,7 +840,7 @@ describe("ReplicaCache", () => {
|
||||
version: 1,
|
||||
data: { passed: 4, failed: 0 },
|
||||
timestamp: new Date("2026-07-18T08:02:00.000Z"),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 12, anchorSeq: 12 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 12 },
|
||||
};
|
||||
writer.commitTimeline(SERVER_ID, "agent-1", {
|
||||
agentId: "agent-1",
|
||||
@@ -885,32 +885,6 @@ describe("ReplicaCache", () => {
|
||||
expect(await createCache(storage).readTimeline(SERVER_ID, "agent-1")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("keeps where each cached row started, and refetches a timeline cached without it", async () => {
|
||||
const storage = new MemoryStorage();
|
||||
const writer = createCache(storage);
|
||||
const updatedAfterItStarted: StreamItem = {
|
||||
...timelineItem(),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 12, anchorSeq: 9 },
|
||||
};
|
||||
writer.commitTimeline(SERVER_ID, "agent-1", { ...timeline(), items: [updatedAfterItStarted] });
|
||||
await writer.flush();
|
||||
expect((await createCache(storage).readTimeline(SERVER_ID, "agent-1"))?.items).toEqual([
|
||||
updatedAfterItStarted,
|
||||
]);
|
||||
|
||||
const row = requireTimelineRow(storage);
|
||||
const payload = JSON.parse(row.payload) as {
|
||||
items: Array<{ timelineCursor?: Record<string, unknown> }>;
|
||||
};
|
||||
delete payload.items[0]?.timelineCursor?.anchorSeq;
|
||||
storage.rows.set(`${row.serverId}:${row.kind}:${row.id}`, {
|
||||
...row,
|
||||
payload: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
expect(await createCache(storage).readTimeline(SERVER_ID, "agent-1")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("refetches old cached Markdown fragments instead of offering them as whole messages", async () => {
|
||||
const storage = new MemoryStorage();
|
||||
const writer = createCache(storage);
|
||||
@@ -1381,7 +1355,7 @@ it("retains semantic agent messages across disk-cache reconstruction", async ()
|
||||
kind: "tool_call",
|
||||
id: "delivery",
|
||||
timestamp: new Date(1),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 12, anchorSeq: 12 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 12 },
|
||||
payload: {
|
||||
source: "agent",
|
||||
data: {
|
||||
|
||||
@@ -22,7 +22,6 @@ import {
|
||||
isUnreconciledLocalUserMessage,
|
||||
type AgentToolCallData,
|
||||
type StreamItem,
|
||||
type TimelinePosition,
|
||||
} from "@/types/stream";
|
||||
import type { UnsettledTurn } from "@/timeline/turn-liveness";
|
||||
import { normalizeAgentSnapshot } from "@/utils/agent-snapshots";
|
||||
@@ -83,15 +82,7 @@ const IsoDateSchema = z.iso.datetime();
|
||||
const TimelinePositionSchema = z.strictObject({
|
||||
epoch: z.string(),
|
||||
seq: z.number().int().nonnegative(),
|
||||
// COMPAT(timelineRewindOperations): absent on caches written before rows were anchored, added in
|
||||
// v0.14.1, remove after 2027-05-10. Such a cache is not restored; the chat loads its tail instead.
|
||||
anchorSeq: z.number().int().nonnegative().optional(),
|
||||
});
|
||||
type StoredTimelinePosition = z.infer<typeof TimelinePositionSchema>;
|
||||
|
||||
function isAnchored(position: StoredTimelinePosition | undefined): boolean {
|
||||
return position === undefined || position.anchorSeq !== undefined;
|
||||
}
|
||||
const PluginTimelineDataSchema: z.ZodType<PluginTimelineData> = z.lazy(() =>
|
||||
z.union([
|
||||
z.null(),
|
||||
@@ -432,10 +423,6 @@ function deserializeTimeline(stored: StoredTimeline | null): CachedTimeline | nu
|
||||
if (!stored) {
|
||||
return null;
|
||||
}
|
||||
// A rewind retires rows by anchor, so an unanchored row could not be retired.
|
||||
if (!stored.items.every((item) => isAnchored(item.timelineCursor))) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
agentId: stored.agentId,
|
||||
items: stored.items.map(deserializeTimelineItem),
|
||||
@@ -552,20 +539,11 @@ function serializeTimelineItem(item: StreamItem): StoredTimelineItem | null {
|
||||
}
|
||||
}
|
||||
|
||||
function anchoredPosition(position: StoredTimelinePosition | undefined): {
|
||||
timelineCursor?: TimelinePosition;
|
||||
} {
|
||||
if (!position || position.anchorSeq === undefined) return {};
|
||||
return {
|
||||
timelineCursor: { epoch: position.epoch, seq: position.seq, anchorSeq: position.anchorSeq },
|
||||
};
|
||||
}
|
||||
|
||||
function deserializeTimelineItem(item: StoredTimelineItem): StreamItem {
|
||||
if (item.kind === "plugin") {
|
||||
return {
|
||||
id: item.id,
|
||||
...anchoredPosition(item.timelineCursor),
|
||||
...(item.timelineCursor ? { timelineCursor: item.timelineCursor } : {}),
|
||||
...(item.turnId ? { turnId: item.turnId } : {}),
|
||||
timestamp: new Date(item.timestamp),
|
||||
kind: item.kind,
|
||||
@@ -584,7 +562,7 @@ function deserializeBuiltinTimelineItem(
|
||||
): StreamItem {
|
||||
const base = {
|
||||
id: item.id,
|
||||
...anchoredPosition(item.timelineCursor),
|
||||
...(item.timelineCursor ? { timelineCursor: item.timelineCursor } : {}),
|
||||
...(item.turnId ? { turnId: item.turnId } : {}),
|
||||
timestamp: new Date(item.timestamp),
|
||||
};
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
HEADER_TOP_PADDING_MOBILE,
|
||||
} from "@/constants/layout";
|
||||
import { useLocalDaemonServerId } from "@/hooks/use-is-local-daemon";
|
||||
import { PairDeviceModal } from "@/desktop/components/pair-device-modal";
|
||||
import { PairDeviceModal } from "@/devices";
|
||||
import { buildSettingsHostSectionRoute } from "@/utils/host-routes";
|
||||
import { WINDOW_CONTENT_DATASET } from "@/components/desktop/titlebar-drag-region";
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ import { DesktopNotificationsSection } from "@/desktop/components/desktop-notifi
|
||||
import { BrowserDataSection } from "@/desktop/browser/settings/browser-data-section";
|
||||
import { IntegrationsSection } from "@/desktop/components/integrations-section";
|
||||
import { isElectronRuntime } from "@/desktop/host";
|
||||
import { useDesktopSettings, type DesktopUpdateMode } from "@/desktop/settings/desktop-settings";
|
||||
import { useDesktopAppUpdater } from "@/desktop/updates/use-desktop-app-updater";
|
||||
import { formatVersionWithPrefix } from "@/desktop/updates/desktop-updates";
|
||||
import { resolveAppVersion } from "@/utils/app-version";
|
||||
@@ -102,7 +103,7 @@ import {
|
||||
} from "@/i18n/locales";
|
||||
import {
|
||||
HostConnectionsPage,
|
||||
HostPairDevicePage,
|
||||
HostDevicesPage,
|
||||
HostAgentsPage,
|
||||
HostAgentProfilesPage,
|
||||
HostSettingsPage,
|
||||
@@ -250,7 +251,7 @@ const HOST_SECTION_ITEMS: HostSectionItem[] = [
|
||||
{ id: "host", labelKey: "settings.hostSections.host", icon: Server },
|
||||
{ id: "projects", labelKey: "settings.hostSections.projects", icon: FolderGit2 },
|
||||
{ id: "connections", labelKey: "settings.hostSections.connections", icon: Network },
|
||||
{ id: "pair-device", labelKey: "openProject.tiles.pairDevice.title", icon: Smartphone },
|
||||
{ id: "devices", labelKey: "devices.title", icon: Smartphone },
|
||||
{ id: "agents", labelKey: "settings.hostSections.agents", icon: Bot },
|
||||
{ id: "agent-profiles", labelKey: "settings.hostSections.agentProfiles", icon: Layers },
|
||||
{ id: "metadata", labelKey: "settings.hostSections.metadata", icon: Sparkles },
|
||||
@@ -271,8 +272,8 @@ function renderHostSettingsContent(
|
||||
return <ProjectsScreen serverId={view.serverId} />;
|
||||
case "connections":
|
||||
return <HostConnectionsPage serverId={view.serverId} />;
|
||||
case "pair-device":
|
||||
return <HostPairDevicePage serverId={view.serverId} />;
|
||||
case "devices":
|
||||
return <HostDevicesPage serverId={view.serverId} />;
|
||||
case "agents":
|
||||
return <HostAgentsPage serverId={view.serverId} />;
|
||||
case "agent-profiles":
|
||||
@@ -616,25 +617,92 @@ function HostVersionRow({
|
||||
|
||||
function getUpdateButtonLabel(
|
||||
t: TFunction,
|
||||
isInstalling: boolean,
|
||||
latestVersion: string | null | undefined,
|
||||
input: {
|
||||
isInstalling: boolean;
|
||||
isDownloading: boolean;
|
||||
isActionable: boolean;
|
||||
readyToInstall: boolean;
|
||||
latestVersion: string | null | undefined;
|
||||
},
|
||||
): string {
|
||||
if (isInstalling) return t("settings.about.updates.installing");
|
||||
if (latestVersion) {
|
||||
if (input.isInstalling) {
|
||||
return input.isDownloading
|
||||
? t("settings.about.updates.downloading")
|
||||
: t("settings.about.updates.installing");
|
||||
}
|
||||
if (input.isActionable && !input.readyToInstall) {
|
||||
if (input.latestVersion) {
|
||||
return t("settings.about.updates.downloadTo", {
|
||||
version: formatVersionWithPrefix(input.latestVersion),
|
||||
});
|
||||
}
|
||||
return t("settings.about.updates.download");
|
||||
}
|
||||
if (input.latestVersion) {
|
||||
return t("settings.about.updates.updateTo", {
|
||||
version: formatVersionWithPrefix(latestVersion),
|
||||
version: formatVersionWithPrefix(input.latestVersion),
|
||||
});
|
||||
}
|
||||
return t("settings.about.updates.update");
|
||||
}
|
||||
|
||||
function getUpdateModeDescription(t: TFunction, mode: DesktopUpdateMode): string {
|
||||
if (mode === "off") return t("settings.about.autoUpdate.descriptions.off");
|
||||
if (mode === "notify") return t("settings.about.autoUpdate.descriptions.notify");
|
||||
return t("settings.about.autoUpdate.descriptions.automatic");
|
||||
}
|
||||
|
||||
function getUpdateConfirmDialogCopy(t: TFunction, isUpdateReady: boolean) {
|
||||
if (isUpdateReady) {
|
||||
return {
|
||||
title: t("settings.about.updates.installTitle"),
|
||||
message: t("settings.about.updates.installMessage"),
|
||||
confirmLabel: t("settings.about.updates.installConfirm"),
|
||||
cancelLabel: t("common.actions.cancel"),
|
||||
};
|
||||
}
|
||||
return {
|
||||
title: t("settings.about.updates.downloadTitle"),
|
||||
message: t("settings.about.updates.downloadMessage"),
|
||||
confirmLabel: t("settings.about.updates.downloadConfirm"),
|
||||
cancelLabel: t("common.actions.cancel"),
|
||||
};
|
||||
}
|
||||
|
||||
function DesktopUpdateProgressBar({ percent }: { percent: number }) {
|
||||
const accessibilityValue = useMemo(() => ({ min: 0, max: 100, now: percent }), [percent]);
|
||||
const fillStyle = useMemo(
|
||||
() => [styles.aboutUpdateProgressFill, { width: `${percent}%` as const }],
|
||||
[percent],
|
||||
);
|
||||
|
||||
return (
|
||||
<View
|
||||
style={styles.aboutUpdateProgressTrack}
|
||||
accessibilityRole="progressbar"
|
||||
accessibilityValue={accessibilityValue}
|
||||
testID="settings-about-update-progress"
|
||||
>
|
||||
<View style={fillStyle} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
function DesktopAppUpdateRow() {
|
||||
const { t } = useTranslation();
|
||||
const { settings, updateSettings } = useSettings();
|
||||
const {
|
||||
settings: desktopSettings,
|
||||
isLoading: isLoadingDesktopSettings,
|
||||
updateSettings: updateDesktopSettings,
|
||||
} = useDesktopSettings();
|
||||
const updateMode = desktopSettings.updates.mode;
|
||||
const {
|
||||
isDesktopApp,
|
||||
status,
|
||||
statusText,
|
||||
availableUpdate,
|
||||
downloadProgress,
|
||||
errorMessage,
|
||||
isChecking,
|
||||
isInstalling,
|
||||
@@ -644,12 +712,12 @@ function DesktopAppUpdateRow() {
|
||||
|
||||
useFocusEffect(
|
||||
useCallback(() => {
|
||||
if (!isDesktopApp) {
|
||||
if (!isDesktopApp || isLoadingDesktopSettings || updateMode === "off") {
|
||||
return undefined;
|
||||
}
|
||||
void checkForUpdates({ intent: "automatic", silent: true });
|
||||
return undefined;
|
||||
}, [checkForUpdates, isDesktopApp]),
|
||||
}, [checkForUpdates, isDesktopApp, isLoadingDesktopSettings, updateMode]),
|
||||
);
|
||||
|
||||
const handleCheckForUpdates = useCallback(() => {
|
||||
@@ -673,17 +741,36 @@ function DesktopAppUpdateRow() {
|
||||
[t],
|
||||
);
|
||||
|
||||
const handleUpdateModeChange = useCallback(
|
||||
(mode: DesktopUpdateMode) => {
|
||||
void updateDesktopSettings({ updates: { mode } });
|
||||
},
|
||||
[updateDesktopSettings],
|
||||
);
|
||||
const updateModeOptions = useMemo(
|
||||
() => [
|
||||
{ value: "automatic" as const, label: t("settings.about.autoUpdate.options.automatic") },
|
||||
{ value: "notify" as const, label: t("settings.about.autoUpdate.options.notify") },
|
||||
{ value: "off" as const, label: t("settings.about.autoUpdate.options.off") },
|
||||
],
|
||||
[t],
|
||||
);
|
||||
|
||||
const isUpdateReady = availableUpdate?.readyToInstall === true;
|
||||
const isUpdateActionable = status === "available" && availableUpdate?.hasUpdate === true;
|
||||
const readyUpdateVersion = isUpdateReady ? availableUpdate?.latestVersion : null;
|
||||
const actionableVersion = isUpdateActionable ? availableUpdate?.latestVersion : null;
|
||||
const downloadPercent =
|
||||
(isInstalling || status === "pending") && downloadProgress
|
||||
? Math.max(0, Math.min(100, Math.round(downloadProgress.percent)))
|
||||
: null;
|
||||
|
||||
const handleInstallUpdate = useCallback(() => {
|
||||
if (!isDesktopApp) {
|
||||
return;
|
||||
}
|
||||
|
||||
void confirmDialog({
|
||||
title: t("settings.about.updates.installTitle"),
|
||||
message: t("settings.about.updates.installMessage"),
|
||||
confirmLabel: t("settings.about.updates.installConfirm"),
|
||||
cancelLabel: t("common.actions.cancel"),
|
||||
})
|
||||
void confirmDialog(getUpdateConfirmDialogCopy(t, isUpdateReady))
|
||||
.then((confirmed) => {
|
||||
if (!confirmed) {
|
||||
return;
|
||||
@@ -698,10 +785,7 @@ function DesktopAppUpdateRow() {
|
||||
t("settings.about.updates.alertMessage"),
|
||||
);
|
||||
});
|
||||
}, [installUpdate, isDesktopApp, t]);
|
||||
|
||||
const isUpdateReady = availableUpdate?.readyToInstall === true;
|
||||
const readyUpdateVersion = isUpdateReady ? availableUpdate?.latestVersion : null;
|
||||
}, [installUpdate, isDesktopApp, isUpdateReady, t]);
|
||||
|
||||
if (!isDesktopApp) {
|
||||
return null;
|
||||
@@ -722,6 +806,18 @@ function DesktopAppUpdateRow() {
|
||||
options={releaseChannelOptions}
|
||||
/>
|
||||
</View>
|
||||
<View style={[settingsStyles.row, settingsStyles.rowBorder]}>
|
||||
<View style={settingsStyles.rowContent}>
|
||||
<Text style={settingsStyles.rowTitle}>{t("settings.about.autoUpdate.label")}</Text>
|
||||
<Text style={settingsStyles.rowHint}>{getUpdateModeDescription(t, updateMode)}</Text>
|
||||
</View>
|
||||
<SegmentedControl
|
||||
value={updateMode}
|
||||
onValueChange={handleUpdateModeChange}
|
||||
options={updateModeOptions}
|
||||
testID="settings-about-update-mode"
|
||||
/>
|
||||
</View>
|
||||
<View style={[settingsStyles.row, settingsStyles.rowBorder]}>
|
||||
<View style={settingsStyles.rowContent}>
|
||||
<Text style={settingsStyles.rowTitle}>{t("settings.about.updates.label")}</Text>
|
||||
@@ -733,6 +829,7 @@ function DesktopAppUpdateRow() {
|
||||
})}
|
||||
</Text>
|
||||
) : null}
|
||||
{downloadPercent !== null ? <DesktopUpdateProgressBar percent={downloadPercent} /> : null}
|
||||
{errorMessage ? <Text style={styles.aboutErrorText}>{errorMessage}</Text> : null}
|
||||
</View>
|
||||
<View style={styles.aboutUpdateActions}>
|
||||
@@ -746,9 +843,15 @@ function DesktopAppUpdateRow() {
|
||||
<Button
|
||||
variant="default"
|
||||
onPress={handleInstallUpdate}
|
||||
disabled={isChecking || isInstalling || !isUpdateReady}
|
||||
disabled={isChecking || isInstalling || !isUpdateActionable}
|
||||
>
|
||||
{getUpdateButtonLabel(t, isInstalling, readyUpdateVersion)}
|
||||
{getUpdateButtonLabel(t, {
|
||||
isInstalling,
|
||||
isDownloading: isInstalling && downloadProgress != null,
|
||||
isActionable: isUpdateActionable,
|
||||
readyToInstall: isUpdateReady,
|
||||
latestVersion: actionableVersion,
|
||||
})}
|
||||
</Button>
|
||||
</View>
|
||||
</View>
|
||||
@@ -1640,6 +1743,19 @@ const styles = StyleSheet.create((theme) => ({
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[2],
|
||||
},
|
||||
aboutUpdateProgressTrack: {
|
||||
marginTop: theme.spacing[2],
|
||||
height: 4,
|
||||
maxWidth: 260,
|
||||
borderRadius: theme.borderRadius.full,
|
||||
backgroundColor: theme.colors.surface3,
|
||||
overflow: "hidden",
|
||||
},
|
||||
aboutUpdateProgressFill: {
|
||||
height: "100%",
|
||||
borderRadius: theme.borderRadius.full,
|
||||
backgroundColor: theme.colors.accent,
|
||||
},
|
||||
placeholder: {
|
||||
flex: 1,
|
||||
alignItems: "center",
|
||||
|
||||
@@ -2,7 +2,6 @@ import {
|
||||
ArrowDown,
|
||||
ArrowUp,
|
||||
ArrowUpToLine,
|
||||
ChevronRight,
|
||||
Globe,
|
||||
Monitor,
|
||||
Pencil,
|
||||
@@ -14,7 +13,7 @@ import {
|
||||
import type { TFunction } from "i18next";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Alert, Pressable, Text, View } from "react-native";
|
||||
import { Alert, Text, View } from "react-native";
|
||||
import { StyleSheet, useUnistyles, withUnistyles } from "react-native-unistyles";
|
||||
import type { TerminalProfile } from "@getpaseo/protocol/messages";
|
||||
import {
|
||||
@@ -38,7 +37,7 @@ import { startDesktopDaemon, stopDesktopDaemon } from "@/desktop/daemon/desktop-
|
||||
import { LocalDaemonSection } from "@/desktop/components/desktop-updates-section";
|
||||
import { useDaemonStatus } from "@/desktop/hooks/use-daemon-status";
|
||||
import { useDesktopSettings } from "@/desktop/settings/desktop-settings";
|
||||
import { PairDeviceModal } from "@/desktop/components/pair-device-modal";
|
||||
import { WaysToConnect } from "@/devices";
|
||||
import { useDaemonConfig } from "@/hooks/use-daemon-config";
|
||||
import { useIsLocalDaemon } from "@/hooks/use-is-local-daemon";
|
||||
import {
|
||||
@@ -265,19 +264,14 @@ export function HostConnectionsPage({ serverId }: { serverId: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
export function HostPairDevicePage({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
export function HostDevicesPage({ serverId }: { serverId: string }) {
|
||||
const host = useHostProfile(serverId);
|
||||
|
||||
if (!host) {
|
||||
return <HostNotFound />;
|
||||
}
|
||||
|
||||
return (
|
||||
<SettingsSection title={t("settings.host.pairDevices.title")}>
|
||||
<PairDeviceRow serverId={serverId} />
|
||||
</SettingsSection>
|
||||
);
|
||||
return <WaysToConnect serverId={serverId} />;
|
||||
}
|
||||
|
||||
export function HostAgentsPage({ serverId }: { serverId: string }) {
|
||||
@@ -1130,39 +1124,6 @@ function AppendSystemPromptCard({ serverId }: { serverId: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
function PairDeviceRow({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const { theme } = useUnistyles();
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
|
||||
const handleOpen = useCallback(() => setIsModalOpen(true), []);
|
||||
const handleClose = useCallback(() => setIsModalOpen(false), []);
|
||||
|
||||
return (
|
||||
<View style={settingsStyles.card}>
|
||||
<Pressable
|
||||
style={settingsStyles.row}
|
||||
onPress={handleOpen}
|
||||
accessibilityRole="button"
|
||||
testID="host-page-pair-device-row"
|
||||
>
|
||||
<View style={settingsStyles.rowContent}>
|
||||
<Text style={settingsStyles.rowTitle}>{t("settings.host.pairDevices.rowTitle")}</Text>
|
||||
<Text style={settingsStyles.rowHint}>{t("settings.host.pairDevices.rowHint")}</Text>
|
||||
</View>
|
||||
<ChevronRight size={theme.iconSize.sm} color={theme.colors.foregroundMuted} />
|
||||
</Pressable>
|
||||
|
||||
<PairDeviceModal
|
||||
serverId={serverId}
|
||||
visible={isModalOpen}
|
||||
onClose={handleClose}
|
||||
testID="host-page-pair-device-card"
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
function RemoveHostSection({
|
||||
host,
|
||||
isLocalDaemon,
|
||||
|
||||
@@ -2188,10 +2188,11 @@ function WorkspaceScreenContent({
|
||||
|
||||
toast.show(t("workspace.tabs.toasts.reloadingAgent"), { durationMs: null });
|
||||
try {
|
||||
const refreshed = await client.refreshAgent(agentId);
|
||||
// Send the existing cursor: Reload agent keeps the history, so the server
|
||||
// returns only the rows it added. When the history was imported again
|
||||
// under a new epoch, the cursor reads as stale and the server resets.
|
||||
await client.refreshAgent(agentId);
|
||||
// Send the existing cursor so the server detects the new epoch and
|
||||
// returns reset:true. Without a cursor, the server returns reset:false
|
||||
// and the client takes the incremental path, where new-epoch rows are
|
||||
// dropped against the stale cursor.
|
||||
const sessionState = useSessionStore.getState().sessions[normalizedServerId];
|
||||
const currentCursor = sessionState?.agentTimelineCursor.get(agentId);
|
||||
await getHostRuntimeStore().fetchAgentTimeline(normalizedServerId, agentId, {
|
||||
@@ -2200,13 +2201,7 @@ function WorkspaceScreenContent({
|
||||
? { cursor: { epoch: currentCursor.epoch, seq: currentCursor.endSeq } }
|
||||
: {}),
|
||||
});
|
||||
if (refreshed.historyDiverged) {
|
||||
toast.show(t("workspace.tabs.toasts.reloadedAgentHistoryDiverged"), {
|
||||
variant: "warning",
|
||||
});
|
||||
} else {
|
||||
toast.show(t("workspace.tabs.toasts.reloadedAgent"), { variant: "success" });
|
||||
}
|
||||
toast.show(t("workspace.tabs.toasts.reloadedAgent"), { variant: "success" });
|
||||
} catch (error) {
|
||||
toast.error(
|
||||
error instanceof Error ? error.message : t("workspace.tabs.toasts.failedToReloadAgent"),
|
||||
|
||||
@@ -324,12 +324,6 @@ export interface AgentTimelineCursorState {
|
||||
}>;
|
||||
}
|
||||
|
||||
/** The latest conversation rewind applied to an agent's history, by its sequence number. */
|
||||
export interface AgentTimelineRewind {
|
||||
epoch: string;
|
||||
seq: number;
|
||||
}
|
||||
|
||||
export type AgentTimelineState =
|
||||
| { status: "cold" }
|
||||
| { status: "painted"; items: StreamItem[] }
|
||||
@@ -504,7 +498,6 @@ export interface SessionState {
|
||||
agentTimelineUnsettledTurn: Map<string, UnsettledTurn>;
|
||||
agentTimelineHasOlder: Map<string, boolean>;
|
||||
agentTimelineHasNewer: Map<string, boolean>;
|
||||
agentTimelineLatestRewind: Map<string, AgentTimelineRewind>;
|
||||
agentTimelineOlderFetchInFlight: Map<string, boolean>;
|
||||
historySyncGeneration: number;
|
||||
agentHistorySyncGeneration: Map<string, number>;
|
||||
@@ -610,6 +603,8 @@ interface SessionStoreActions {
|
||||
message: UserMessageItem,
|
||||
) => boolean;
|
||||
clearAgentStreamHead: (serverId: string, agentId: string) => void;
|
||||
/** Drops every piece of one chat's resident transcript: rows, cursors, paging and sync marks. */
|
||||
releaseAgentTimeline: (serverId: string, agentId: string) => void;
|
||||
setAgentTimelineCursor: (
|
||||
serverId: string,
|
||||
state:
|
||||
@@ -624,12 +619,6 @@ interface SessionStoreActions {
|
||||
serverId: string,
|
||||
state: Map<string, boolean> | ((prev: Map<string, boolean>) => Map<string, boolean>),
|
||||
) => void;
|
||||
/** Records a rewind applied to the agent's history; an older one of the same history is ignored. */
|
||||
recordAgentTimelineRewind: (
|
||||
serverId: string,
|
||||
agentId: string,
|
||||
rewind: AgentTimelineRewind,
|
||||
) => void;
|
||||
setAgentTimelineOlderFetchInFlight: (
|
||||
serverId: string,
|
||||
state: Map<string, boolean> | ((prev: Map<string, boolean>) => Map<string, boolean>),
|
||||
@@ -766,7 +755,6 @@ function createInitialSessionState(
|
||||
agentTimelineUnsettledTurn: new Map(),
|
||||
agentTimelineHasOlder: new Map(),
|
||||
agentTimelineHasNewer: new Map(),
|
||||
agentTimelineLatestRewind: new Map(),
|
||||
agentTimelineOlderFetchInFlight: new Map(),
|
||||
historySyncGeneration: 0,
|
||||
agentHistorySyncGeneration: new Map(),
|
||||
@@ -1356,6 +1344,35 @@ export const useSessionStore = create<SessionStore>()(
|
||||
});
|
||||
},
|
||||
|
||||
releaseAgentTimeline: (serverId, agentId) => {
|
||||
set((prev) => {
|
||||
const session = prev.sessions[serverId];
|
||||
if (!session) return prev;
|
||||
const timelineKeys = [
|
||||
"agentStreamTail",
|
||||
"agentStreamHead",
|
||||
"agentTasks",
|
||||
"agentTimelineCursor",
|
||||
"agentTimelineUnsettledTurn",
|
||||
"agentTimelineHasOlder",
|
||||
"agentTimelineHasNewer",
|
||||
"agentTimelineOlderFetchInFlight",
|
||||
"agentHistorySyncGeneration",
|
||||
"agentAuthoritativeHistoryApplied",
|
||||
] as const satisfies readonly (keyof SessionState)[];
|
||||
let next: SessionState | null = null;
|
||||
for (const key of timelineKeys) {
|
||||
const current: Map<string, unknown> = session[key];
|
||||
if (!current.has(agentId)) continue;
|
||||
const without = new Map(current);
|
||||
without.delete(agentId);
|
||||
next = { ...(next ?? session), [key]: without };
|
||||
}
|
||||
if (!next) return prev;
|
||||
return { ...prev, sessions: { ...prev.sessions, [serverId]: next } };
|
||||
});
|
||||
},
|
||||
|
||||
setAgentTimelineCursor: (serverId, state) => {
|
||||
set((prev) => {
|
||||
const session = prev.sessions[serverId];
|
||||
@@ -1415,24 +1432,6 @@ export const useSessionStore = create<SessionStore>()(
|
||||
});
|
||||
},
|
||||
|
||||
recordAgentTimelineRewind: (serverId, agentId, rewind) => {
|
||||
set((prev) => {
|
||||
const session = prev.sessions[serverId];
|
||||
if (!session) return prev;
|
||||
const current = session.agentTimelineLatestRewind.get(agentId);
|
||||
if (current && current.epoch === rewind.epoch && current.seq >= rewind.seq) return prev;
|
||||
const next = new Map(session.agentTimelineLatestRewind);
|
||||
next.set(agentId, rewind);
|
||||
return {
|
||||
...prev,
|
||||
sessions: {
|
||||
...prev.sessions,
|
||||
[serverId]: { ...session, agentTimelineLatestRewind: next },
|
||||
},
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
setAgentTimelineOlderFetchInFlight: (serverId, state) => {
|
||||
set((prev) => {
|
||||
const session = prev.sessions[serverId];
|
||||
|
||||
@@ -165,6 +165,7 @@ it("feeds restored layout to timeline sync as a release signal, not a subscripti
|
||||
const sync = createViewedTimelineSync({
|
||||
replaceDemandedAgentIds: () => undefined,
|
||||
prepare: async () => undefined,
|
||||
isArchived: () => false,
|
||||
canCheckFreshness: () => false,
|
||||
applyCurrentTimeline: () => undefined,
|
||||
observe: (agentIds) => {
|
||||
|
||||
@@ -7,9 +7,17 @@ import {
|
||||
} from "@/runtime/replica-cache/row-store-sqlite";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import type { AgentTimelineItem } from "@getpaseo/protocol/agent-types";
|
||||
import type { AgentStreamEventPayload } from "@getpaseo/protocol/messages";
|
||||
import type {
|
||||
AgentSnapshotPayload,
|
||||
AgentStreamEventPayload,
|
||||
WorkspaceDescriptorPayload,
|
||||
} from "@getpaseo/protocol/messages";
|
||||
import type { FetchAgentsEntry } from "@getpaseo/client/internal/daemon-client";
|
||||
import { AgentDirectoryReplica } from "@/runtime/directory-sync/agent-replica";
|
||||
import { WorkspaceDirectoryReplica } from "@/runtime/directory-sync/workspace-replica";
|
||||
import type { CachedTimeline } from "@/runtime/replica-cache";
|
||||
import {
|
||||
normalizeWorkspaceDescriptor,
|
||||
selectAgentTimelineState,
|
||||
selectAgentTimelineTurnPresentation,
|
||||
selectAgentTurnPresentation,
|
||||
@@ -39,7 +47,7 @@ function item(id: string, text: string, seq: number): StreamItem {
|
||||
id,
|
||||
text,
|
||||
timestamp: new Date("2026-08-26T10:00:00.000Z"),
|
||||
timelineCursor: { epoch: "epoch-1", seq, anchorSeq: seq },
|
||||
timelineCursor: { epoch: "epoch-1", seq },
|
||||
};
|
||||
}
|
||||
|
||||
@@ -579,235 +587,6 @@ describe("viewed timeline persistence", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("conversation rewind through the owner", () => {
|
||||
const page = {
|
||||
requestId: "page-1",
|
||||
agentId: AGENT_ID,
|
||||
agent: null,
|
||||
direction: "tail",
|
||||
projection: "projected",
|
||||
reset: false,
|
||||
epoch: "epoch-1",
|
||||
error: null,
|
||||
hasNewer: false,
|
||||
hasOlder: false,
|
||||
staleCursor: false,
|
||||
gap: false,
|
||||
} as const;
|
||||
|
||||
function entry(seq: number, type: "user_message" | "assistant_message", text: string) {
|
||||
return {
|
||||
seqStart: seq,
|
||||
seqEnd: seq,
|
||||
sourceSeqRanges: [{ startSeq: seq, endSeq: seq }],
|
||||
collapsed: [],
|
||||
provider: "codex",
|
||||
item: { type, text },
|
||||
timestamp: `2026-08-26T10:00:0${seq}.000Z`,
|
||||
};
|
||||
}
|
||||
|
||||
function texts(items: readonly StreamItem[]): string[] {
|
||||
return items.flatMap((row) =>
|
||||
row.kind === "user_message" || row.kind === "assistant_message" ? [row.text] : [],
|
||||
);
|
||||
}
|
||||
|
||||
function viewed(): string[] {
|
||||
const session = useSessionStore.getState().sessions[SERVER_ID];
|
||||
const timeline = selectAgentTimelineState(session, AGENT_ID);
|
||||
const tail = timeline.status === "cold" ? [] : timeline.items;
|
||||
return texts([...tail, ...(session?.agentStreamHead.get(AGENT_ID) ?? [])]);
|
||||
}
|
||||
|
||||
function latestRewind() {
|
||||
return useSessionStore.getState().sessions[SERVER_ID]?.agentTimelineLatestRewind.get(AGENT_ID);
|
||||
}
|
||||
|
||||
it("retires B from the viewed and persisted timeline without refetching", () => {
|
||||
useSessionStore.getState().initializeSession(SERVER_ID, null);
|
||||
const commits: CachedTimeline[] = [];
|
||||
const owner = createOwner({
|
||||
readTimeline: async () => undefined,
|
||||
commitTimeline: (_serverId, _agentId, timeline) => commits.push(timeline),
|
||||
});
|
||||
owner.applyTimelineResponse({
|
||||
...page,
|
||||
window: { minSeq: 1, maxSeq: 4, nextSeq: 5 },
|
||||
startCursor: { epoch: "epoch-1", seq: 1 },
|
||||
endCursor: { epoch: "epoch-1", seq: 4 },
|
||||
entries: [
|
||||
entry(1, "user_message", "A"),
|
||||
entry(2, "assistant_message", "reply A"),
|
||||
entry(3, "user_message", "B"),
|
||||
entry(4, "assistant_message", "reply B"),
|
||||
],
|
||||
});
|
||||
|
||||
owner.applyStreamEvent(AGENT_ID, {
|
||||
event: { type: "rewind", retireFromSeq: 3 },
|
||||
seq: 5,
|
||||
epoch: "epoch-1",
|
||||
timestamp: new Date("2026-08-26T10:00:05.000Z"),
|
||||
});
|
||||
owner.applyStreamEvent(AGENT_ID, {
|
||||
event: {
|
||||
type: "timeline",
|
||||
provider: "codex",
|
||||
item: { type: "user_message", text: "C", messageId: "c" },
|
||||
} as AgentStreamEventPayload,
|
||||
seq: 6,
|
||||
epoch: "epoch-1",
|
||||
timestamp: new Date("2026-08-26T10:00:06.000Z"),
|
||||
});
|
||||
owner.flushStreamAgent(AGENT_ID);
|
||||
|
||||
expect(viewed()).toEqual(["A", "reply A", "C"]);
|
||||
expect(texts(commits.at(-1)?.items ?? [])).toEqual(["A", "reply A", "C"]);
|
||||
expect(commits.at(-1)?.range).toMatchObject({ epoch: "epoch-1", endSeq: 6 });
|
||||
expect(latestRewind()).toEqual({ epoch: "epoch-1", seq: 5 });
|
||||
owner.dispose();
|
||||
});
|
||||
|
||||
it("brings a second client that loads after the rewind to the same conversation", () => {
|
||||
useSessionStore.getState().initializeSession(SERVER_ID, null);
|
||||
const owner = createOwner({ readTimeline: async () => undefined, commitTimeline: () => {} });
|
||||
|
||||
owner.applyTimelineResponse({
|
||||
...page,
|
||||
window: { minSeq: 1, maxSeq: 6, nextSeq: 7 },
|
||||
startCursor: { epoch: "epoch-1", seq: 1 },
|
||||
endCursor: { epoch: "epoch-1", seq: 6 },
|
||||
entries: [
|
||||
entry(1, "user_message", "A"),
|
||||
entry(2, "assistant_message", "reply A"),
|
||||
entry(6, "user_message", "C"),
|
||||
],
|
||||
retirements: [{ seq: 5, retireFromSeq: 3 }],
|
||||
});
|
||||
|
||||
expect(viewed()).toEqual(["A", "reply A", "C"]);
|
||||
expect(latestRewind()).toEqual({ epoch: "epoch-1", seq: 5 });
|
||||
owner.dispose();
|
||||
});
|
||||
|
||||
function liveRewindOfB(owner: ViewedTimelineOwner, retirement: { seq: number }): void {
|
||||
owner.applyStreamEvent(AGENT_ID, {
|
||||
event: { type: "rewind", retireFromSeq: 3 },
|
||||
seq: retirement.seq,
|
||||
epoch: "epoch-1",
|
||||
timestamp: new Date("2026-08-26T10:00:06.000Z"),
|
||||
});
|
||||
owner.applyStreamEvent(AGENT_ID, {
|
||||
event: {
|
||||
type: "timeline",
|
||||
provider: "codex",
|
||||
item: { type: "user_message", text: "C", messageId: "c" },
|
||||
} as AgentStreamEventPayload,
|
||||
seq: retirement.seq + 1,
|
||||
epoch: "epoch-1",
|
||||
timestamp: new Date("2026-08-26T10:00:07.000Z"),
|
||||
});
|
||||
owner.flushStreamAgent(AGENT_ID);
|
||||
}
|
||||
|
||||
/** A, reply A, B, reply B as a page served before B was rewound. */
|
||||
const pageServedBeforeTheRewind: Parameters<ViewedTimelineOwner["applyTimelineResponse"]>[0] = {
|
||||
...page,
|
||||
direction: "before",
|
||||
hasOlder: false,
|
||||
window: { minSeq: 1, maxSeq: 5, nextSeq: 6 },
|
||||
startCursor: { epoch: "epoch-1", seq: 1 },
|
||||
endCursor: { epoch: "epoch-1", seq: 4 },
|
||||
entries: [
|
||||
entry(1, "user_message", "A"),
|
||||
entry(2, "assistant_message", "reply A"),
|
||||
entry(3, "user_message", "B"),
|
||||
entry(4, "assistant_message", "reply B"),
|
||||
],
|
||||
};
|
||||
|
||||
function loadTheEndOfB(owner: ViewedTimelineOwner): void {
|
||||
owner.applyTimelineResponse({
|
||||
...page,
|
||||
hasOlder: true,
|
||||
window: { minSeq: 1, maxSeq: 5, nextSeq: 6 },
|
||||
startCursor: { epoch: "epoch-1", seq: 5 },
|
||||
endCursor: { epoch: "epoch-1", seq: 5 },
|
||||
entries: [entry(5, "assistant_message", "more of B")],
|
||||
});
|
||||
}
|
||||
|
||||
it("refuses an older page served before the rewind and takes the one served after it", () => {
|
||||
useSessionStore.getState().initializeSession(SERVER_ID, null);
|
||||
const owner = createOwner({ readTimeline: async () => undefined, commitTimeline: () => {} });
|
||||
loadTheEndOfB(owner);
|
||||
liveRewindOfB(owner, { seq: 6 });
|
||||
expect(viewed()).toEqual(["C"]);
|
||||
|
||||
const outcome = owner.applyTimelineResponse(pageServedBeforeTheRewind);
|
||||
expect(viewed()).toEqual(["C"]);
|
||||
expect(outcome).toBe("stale");
|
||||
|
||||
owner.applyTimelineResponse({
|
||||
...pageServedBeforeTheRewind,
|
||||
window: { minSeq: 1, maxSeq: 7, nextSeq: 8 },
|
||||
// Retired rows count as covered, so the page reaches the loaded start.
|
||||
endCursor: { epoch: "epoch-1", seq: 4 },
|
||||
entries: [entry(1, "user_message", "A"), entry(2, "assistant_message", "reply A")],
|
||||
});
|
||||
expect(viewed()).toEqual(["A", "reply A", "C"]);
|
||||
owner.dispose();
|
||||
});
|
||||
|
||||
it("refuses a prompt jump window served before the rewind", () => {
|
||||
useSessionStore.getState().initializeSession(SERVER_ID, null);
|
||||
const owner = createOwner({ readTimeline: async () => undefined, commitTimeline: () => {} });
|
||||
loadTheEndOfB(owner);
|
||||
liveRewindOfB(owner, { seq: 6 });
|
||||
|
||||
const outcome = owner.applyTimelineResponse({
|
||||
...pageServedBeforeTheRewind,
|
||||
mergeWindow: true,
|
||||
});
|
||||
expect(viewed()).toEqual(["C"]);
|
||||
expect(outcome).toBe("stale");
|
||||
owner.dispose();
|
||||
});
|
||||
|
||||
it("refuses a first page served before a rewind that reached the chat while it loaded", () => {
|
||||
useSessionStore.getState().initializeSession(SERVER_ID, null);
|
||||
const owner = createOwner({ readTimeline: async () => undefined, commitTimeline: () => {} });
|
||||
liveRewindOfB(owner, { seq: 5 });
|
||||
|
||||
const outcome = owner.applyTimelineResponse({
|
||||
...pageServedBeforeTheRewind,
|
||||
direction: "tail",
|
||||
window: { minSeq: 1, maxSeq: 4, nextSeq: 5 },
|
||||
});
|
||||
expect(viewed()).toEqual(["C"]);
|
||||
expect(outcome).toBe("stale");
|
||||
|
||||
owner.applyTimelineResponse({
|
||||
...page,
|
||||
window: { minSeq: 1, maxSeq: 6, nextSeq: 7 },
|
||||
startCursor: { epoch: "epoch-1", seq: 1 },
|
||||
endCursor: { epoch: "epoch-1", seq: 6 },
|
||||
entries: [
|
||||
entry(1, "user_message", "A"),
|
||||
entry(2, "assistant_message", "reply A"),
|
||||
{
|
||||
...entry(6, "user_message", "C"),
|
||||
item: { type: "user_message", text: "C", messageId: "c" },
|
||||
},
|
||||
],
|
||||
retirements: [{ seq: 5, retireFromSeq: 3 }],
|
||||
});
|
||||
expect(viewed()).toEqual(["A", "reply A", "C"]);
|
||||
owner.dispose();
|
||||
});
|
||||
});
|
||||
|
||||
describe("turn boundaries", () => {
|
||||
it("commits a turn's final reply before the turn stops running", () => {
|
||||
useSessionStore.getState().initializeSession(SERVER_ID, null);
|
||||
@@ -2031,3 +1810,365 @@ describe("SQLite baseline restoration", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("archived timeline lifetime", () => {
|
||||
const ACTIVE = "active-agent";
|
||||
const OTHER = "other-agent";
|
||||
const ARCHIVED = "archived-agent";
|
||||
/** An agent whose row never got its archive timestamp, in a workspace that was archived. */
|
||||
const IN_ARCHIVED_WORKSPACE = "agent-in-archived-workspace";
|
||||
const WORKSPACE = "workspace";
|
||||
const ARCHIVED_WORKSPACE = "archived-workspace";
|
||||
const openOwners: ViewedTimelineOwner[] = [];
|
||||
afterEach(() => {
|
||||
for (const owner of openOwners.splice(0)) owner.dispose();
|
||||
});
|
||||
|
||||
function agentPayload(
|
||||
id: string,
|
||||
archivedAt?: string,
|
||||
workspaceId: string = WORKSPACE,
|
||||
): AgentSnapshotPayload {
|
||||
return {
|
||||
id,
|
||||
workspaceId,
|
||||
provider: "codex",
|
||||
cwd: "/repo",
|
||||
model: null,
|
||||
createdAt: "2026-07-17T00:00:00.000Z",
|
||||
updatedAt: "2026-07-17T00:01:00.000Z",
|
||||
lastUserMessageAt: null,
|
||||
status: "idle",
|
||||
capabilities: {
|
||||
supportsStreaming: true,
|
||||
supportsSessionPersistence: true,
|
||||
supportsDynamicModes: true,
|
||||
supportsMcpServers: true,
|
||||
supportsReasoningStream: true,
|
||||
supportsToolInvocations: true,
|
||||
},
|
||||
currentModeId: null,
|
||||
availableModes: [],
|
||||
pendingPermissions: [],
|
||||
persistence: null,
|
||||
title: id,
|
||||
labels: {},
|
||||
...(archivedAt ? { archivedAt } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
function directoryEntry(id: string): FetchAgentsEntry {
|
||||
return {
|
||||
agent: agentPayload(id),
|
||||
project: {
|
||||
projectKey: "/repo",
|
||||
projectName: "repo",
|
||||
checkout: {
|
||||
cwd: "/repo",
|
||||
isGit: false,
|
||||
currentBranch: null,
|
||||
remoteUrl: null,
|
||||
worktreeRoot: null,
|
||||
isPaseoOwnedWorktree: false,
|
||||
mainRepoRoot: null,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function historyPage(agentId: string): TimelineResponsePayload {
|
||||
return {
|
||||
requestId: `tail-${agentId}`,
|
||||
agentId,
|
||||
agent: null,
|
||||
direction: "tail",
|
||||
projection: "projected",
|
||||
reset: false,
|
||||
epoch: "epoch-1",
|
||||
window: { minSeq: 1, maxSeq: 1, nextSeq: 2 },
|
||||
startCursor: { epoch: "epoch-1", seq: 1 },
|
||||
endCursor: { epoch: "epoch-1", seq: 1 },
|
||||
entries: [
|
||||
{
|
||||
provider: "codex",
|
||||
item: { type: "assistant_message", text: `history of ${agentId}` },
|
||||
timestamp: "2026-08-26T10:00:00.000Z",
|
||||
seqStart: 1,
|
||||
seqEnd: 1,
|
||||
sourceSeqRanges: [{ startSeq: 1, endSeq: 1 }],
|
||||
collapsed: [],
|
||||
},
|
||||
],
|
||||
error: null,
|
||||
hasNewer: false,
|
||||
hasOlder: false,
|
||||
staleCursor: false,
|
||||
gap: false,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A host with an active directory and a viewed-timeline owner. Fetches reach the store the
|
||||
* way the host runtime delivers them: the agent row first, then the page, whether or not
|
||||
* the catch-up that asked for it is still current.
|
||||
*/
|
||||
function openHost(
|
||||
activeAgentIds: string[],
|
||||
storage: TimelineReplicaStorage = {
|
||||
readTimeline: async () => undefined,
|
||||
commitTimeline: () => undefined,
|
||||
},
|
||||
) {
|
||||
useSessionStore.getState().initializeSession(SERVER_ID, null);
|
||||
const directory = new AgentDirectoryReplica(
|
||||
SERVER_ID,
|
||||
() => undefined,
|
||||
() => undefined,
|
||||
);
|
||||
const workspaces = new WorkspaceDirectoryReplica(SERVER_ID);
|
||||
workspaces.commitSnapshot(
|
||||
{
|
||||
workspaces: new Map([[WORKSPACE, normalizeWorkspaceDescriptor(workspaceDescriptor())]]),
|
||||
projects: new Map(),
|
||||
},
|
||||
[],
|
||||
);
|
||||
directory.commitSnapshot(activeAgentIds.map(directoryEntry), []);
|
||||
const fetches: string[] = [];
|
||||
const held = new Map<string, () => void>();
|
||||
const holding = new Set<string>();
|
||||
const replica = createTimelineReplica({
|
||||
serverId: SERVER_ID,
|
||||
storage,
|
||||
prepareAgent: async () => undefined,
|
||||
});
|
||||
const owner: ViewedTimelineOwner = createViewedTimelineOwner({
|
||||
serverId: SERVER_ID,
|
||||
replica,
|
||||
replaceDemandedAgentIds: () => undefined,
|
||||
drainQueuedAgentMessage: () => undefined,
|
||||
applyTurnLiveness: () => undefined,
|
||||
ports: {
|
||||
canCheckFreshness: () => false,
|
||||
observe: () => ({ ready: Promise.resolve(), release: async () => undefined }),
|
||||
readCursor: () => undefined,
|
||||
fetchPage: async (agentId) => {
|
||||
fetches.push(agentId);
|
||||
if (holding.has(agentId)) {
|
||||
await new Promise<void>((resolve) => held.set(agentId, resolve));
|
||||
}
|
||||
if (agentId === ARCHIVED) {
|
||||
directory.submitTimelineAgent(
|
||||
directory.captureTimeline(agentId),
|
||||
agentPayload(agentId, "2026-09-11T00:00:00.000Z"),
|
||||
);
|
||||
}
|
||||
if (agentId === IN_ARCHIVED_WORKSPACE) {
|
||||
directory.submitTimelineAgent(
|
||||
directory.captureTimeline(agentId),
|
||||
agentPayload(agentId, undefined, ARCHIVED_WORKSPACE),
|
||||
);
|
||||
}
|
||||
owner.applyTimelineResponse(historyPage(agentId));
|
||||
return { hasNewer: false, endCursor: null };
|
||||
},
|
||||
fetchLatestTail: async () => ({ hasNewer: false, endCursor: null }),
|
||||
reportError: () => undefined,
|
||||
},
|
||||
});
|
||||
owner.setConnected(true);
|
||||
openOwners.push(owner);
|
||||
return {
|
||||
directory,
|
||||
workspaces,
|
||||
owner,
|
||||
fetches,
|
||||
view(agentIds: string[]) {
|
||||
owner.replaceVisibleAgentIds("workspace", agentIds);
|
||||
},
|
||||
hold(agentId: string) {
|
||||
holding.add(agentId);
|
||||
},
|
||||
async deliverHeld(agentId: string) {
|
||||
await expect.poll(() => held.has(agentId)).toBe(true);
|
||||
held.get(agentId)?.();
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function workspaceDescriptor(): WorkspaceDescriptorPayload {
|
||||
return {
|
||||
id: WORKSPACE,
|
||||
projectId: "project",
|
||||
projectDisplayName: "project",
|
||||
projectRootPath: "/repo",
|
||||
workspaceDirectory: "/repo",
|
||||
projectKind: "git",
|
||||
workspaceKind: "worktree",
|
||||
name: WORKSPACE,
|
||||
title: WORKSPACE,
|
||||
status: "done",
|
||||
activityAt: null,
|
||||
statusEnteredAt: null,
|
||||
archivingAt: null,
|
||||
diffStat: null,
|
||||
scripts: [],
|
||||
};
|
||||
}
|
||||
|
||||
function timelineStatus(agentId: string): string {
|
||||
return selectAgentTimelineState(useSessionStore.getState().sessions[SERVER_ID], agentId).status;
|
||||
}
|
||||
|
||||
function residentAgentIds(): string[] {
|
||||
const session = useSessionStore.getState().sessions[SERVER_ID];
|
||||
if (!session) return [];
|
||||
return [
|
||||
...new Set([
|
||||
...session.agentStreamTail.keys(),
|
||||
...session.agentStreamHead.keys(),
|
||||
...session.agentTimelineCursor.keys(),
|
||||
...session.agentAuthoritativeHistoryApplied.keys(),
|
||||
...session.agentTimelineHasOlder.keys(),
|
||||
...session.agentTimelineHasNewer.keys(),
|
||||
...session.agentHistorySyncGeneration.keys(),
|
||||
]),
|
||||
].sort();
|
||||
}
|
||||
|
||||
it("keeps hidden active chats cached and switches back without a fetch", async () => {
|
||||
const host = openHost([ACTIVE, OTHER]);
|
||||
host.view([ACTIVE]);
|
||||
await expect.poll(() => timelineStatus(ACTIVE)).toBe("synced");
|
||||
host.view([OTHER]);
|
||||
await expect.poll(() => timelineStatus(OTHER)).toBe("synced");
|
||||
host.view([ACTIVE]);
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
|
||||
expect(timelineStatus(ACTIVE)).toBe("synced");
|
||||
expect(timelineStatus(OTHER)).toBe("synced");
|
||||
expect(host.fetches).toEqual([ACTIVE, OTHER]);
|
||||
});
|
||||
|
||||
it("releases a hidden chat's timeline when its agent is archived", async () => {
|
||||
const host = openHost([ACTIVE, OTHER]);
|
||||
host.view([ACTIVE]);
|
||||
await expect.poll(() => timelineStatus(ACTIVE)).toBe("synced");
|
||||
host.view([OTHER]);
|
||||
await expect.poll(() => timelineStatus(OTHER)).toBe("synced");
|
||||
|
||||
host.directory.applyDelta({ kind: "remove", agentId: ACTIVE });
|
||||
|
||||
expect(timelineStatus(ACTIVE)).toBe("cold");
|
||||
expect(residentAgentIds()).toEqual([OTHER]);
|
||||
});
|
||||
|
||||
it("releases an archived chat's timeline once its tab is no longer shown", async () => {
|
||||
const host = openHost([ACTIVE]);
|
||||
host.view([ACTIVE]);
|
||||
await expect.poll(() => timelineStatus(ACTIVE)).toBe("synced");
|
||||
|
||||
host.directory.archive(ACTIVE, "2026-09-11T00:00:00.000Z");
|
||||
expect(timelineStatus(ACTIVE)).toBe("synced");
|
||||
host.view([]);
|
||||
|
||||
expect(timelineStatus(ACTIVE)).toBe("cold");
|
||||
expect(residentAgentIds()).toEqual([]);
|
||||
});
|
||||
|
||||
it("releases every timeline of a workspace when the active list drops its agents", async () => {
|
||||
const host = openHost([ACTIVE, OTHER]);
|
||||
host.view([ACTIVE]);
|
||||
await expect.poll(() => timelineStatus(ACTIVE)).toBe("synced");
|
||||
host.view([OTHER]);
|
||||
await expect.poll(() => timelineStatus(OTHER)).toBe("synced");
|
||||
host.view([]);
|
||||
|
||||
host.directory.commitSnapshot([], []);
|
||||
|
||||
expect(residentAgentIds()).toEqual([]);
|
||||
});
|
||||
|
||||
it("releases hidden timelines of a removed workspace whose agent rows still look active", async () => {
|
||||
const host = openHost([ACTIVE, OTHER]);
|
||||
host.view([ACTIVE]);
|
||||
await expect.poll(() => timelineStatus(ACTIVE)).toBe("synced");
|
||||
host.view([OTHER]);
|
||||
await expect.poll(() => timelineStatus(OTHER)).toBe("synced");
|
||||
|
||||
host.workspaces.removeWorkspaceSnapshot(WORKSPACE);
|
||||
|
||||
expect(timelineStatus(OTHER)).toBe("synced");
|
||||
expect(residentAgentIds()).toEqual([OTHER]);
|
||||
host.view([]);
|
||||
expect(residentAgentIds()).toEqual([]);
|
||||
});
|
||||
|
||||
it("releases a History chat whose unarchived row belongs to an archived workspace", async () => {
|
||||
const host = openHost([ACTIVE]);
|
||||
host.view([IN_ARCHIVED_WORKSPACE]);
|
||||
await expect.poll(() => timelineStatus(IN_ARCHIVED_WORKSPACE)).toBe("synced");
|
||||
|
||||
host.view([]);
|
||||
|
||||
expect(timelineStatus(IN_ARCHIVED_WORKSPACE)).toBe("cold");
|
||||
expect(residentAgentIds()).toEqual([]);
|
||||
});
|
||||
|
||||
it("keeps an archived chat open from History through active-list syncs and releases it on leave", async () => {
|
||||
const host = openHost([ACTIVE]);
|
||||
host.view([ARCHIVED]);
|
||||
await expect.poll(() => timelineStatus(ARCHIVED)).toBe("synced");
|
||||
|
||||
host.directory.commitSnapshot([directoryEntry(ACTIVE)], []);
|
||||
host.directory.applyDelta({ kind: "remove", agentId: ARCHIVED });
|
||||
expect(timelineStatus(ARCHIVED)).toBe("synced");
|
||||
|
||||
host.view([]);
|
||||
expect(timelineStatus(ARCHIVED)).toBe("cold");
|
||||
expect(residentAgentIds()).toEqual([]);
|
||||
|
||||
host.view([ARCHIVED]);
|
||||
await expect.poll(() => timelineStatus(ARCHIVED)).toBe("synced");
|
||||
expect(host.fetches).toEqual([ARCHIVED, ARCHIVED]);
|
||||
});
|
||||
|
||||
it("ignores a History read that answers after the archived chat was left", async () => {
|
||||
const host = openHost([ACTIVE]);
|
||||
host.hold(ARCHIVED);
|
||||
host.view([ARCHIVED]);
|
||||
await expect.poll(() => host.fetches).toEqual([ARCHIVED]);
|
||||
|
||||
host.view([]);
|
||||
await host.deliverHeld(ARCHIVED);
|
||||
|
||||
expect(timelineStatus(ARCHIVED)).toBe("cold");
|
||||
expect(residentAgentIds()).toEqual([]);
|
||||
});
|
||||
|
||||
it("does not paint a cached archived chat back after it was left", async () => {
|
||||
let finishRead!: () => void;
|
||||
const readStarted = new Promise<void>((resolve) => {
|
||||
finishRead = resolve;
|
||||
});
|
||||
let reading = false;
|
||||
const host = openHost([ACTIVE], {
|
||||
readTimeline: async (_serverId, agentId) => {
|
||||
reading = true;
|
||||
await readStarted;
|
||||
return { ...cachedTimeline(), agentId };
|
||||
},
|
||||
commitTimeline: () => undefined,
|
||||
});
|
||||
host.view([ARCHIVED]);
|
||||
await expect.poll(() => reading).toBe(true);
|
||||
|
||||
host.view([]);
|
||||
finishRead();
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
|
||||
expect(timelineStatus(ARCHIVED)).toBe("cold");
|
||||
expect(residentAgentIds()).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -398,7 +398,7 @@ describe("processTimelineResponse", () => {
|
||||
messageId: "provider-message",
|
||||
text: "local prompt",
|
||||
timestamp: new Date(1000),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 1, anchorSeq: 1 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 1 },
|
||||
turnId: "turn-1",
|
||||
});
|
||||
const hello = createUserMessage({
|
||||
@@ -406,7 +406,7 @@ describe("processTimelineResponse", () => {
|
||||
clientMessageId: "hello-client",
|
||||
text: "hello",
|
||||
timestamp: new Date(1500),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2, anchorSeq: 2 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2 },
|
||||
turnId: "turn-1",
|
||||
});
|
||||
const currentTail = [canonical, makeAssistantItem("existing tail", "existing-tail"), hello];
|
||||
@@ -456,7 +456,7 @@ describe("processTimelineResponse", () => {
|
||||
id: "stale-history",
|
||||
text: "stale history",
|
||||
timestamp: new Date(1040),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 40, anchorSeq: 40 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 40 },
|
||||
},
|
||||
],
|
||||
currentCursor: { epoch: "epoch-1", startSeq: 1, endSeq: 40 },
|
||||
@@ -484,11 +484,11 @@ describe("processTimelineResponse", () => {
|
||||
const unresolved = makeSubmittedUserMessage("unresolved prompt", "client-unresolved");
|
||||
const coveredLive: StreamItem = {
|
||||
...makeAssistantItem("covered live", "covered-live"),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 235, anchorSeq: 235 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 235 },
|
||||
};
|
||||
const newerLive: StreamItem = {
|
||||
...makeAssistantItem("newer live", "newer-live"),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 245, anchorSeq: 245 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 245 },
|
||||
};
|
||||
|
||||
const result = processTimelineResponse({
|
||||
@@ -573,7 +573,7 @@ describe("processTimelineResponse", () => {
|
||||
expect.objectContaining({
|
||||
kind: "assistant_message",
|
||||
text: "[System Error] failed",
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42, anchorSeq: 40 },
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42 },
|
||||
}),
|
||||
]);
|
||||
});
|
||||
@@ -745,7 +745,7 @@ describe("processTimelineResponse", () => {
|
||||
}).item,
|
||||
} as AgentStreamEventPayload,
|
||||
timestamp: new Date(2000),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2, anchorSeq: 2 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2 },
|
||||
},
|
||||
],
|
||||
{ source: "canonical" },
|
||||
@@ -775,7 +775,7 @@ describe("processTimelineResponse", () => {
|
||||
|
||||
expect(getAgentToolCalls([...result.tail, ...result.head])).toEqual([
|
||||
expect.objectContaining({
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2, anchorSeq: 1 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2 },
|
||||
payload: expect.objectContaining({
|
||||
data: expect.objectContaining({ callId, status: "completed" }),
|
||||
}),
|
||||
@@ -796,7 +796,7 @@ describe("processTimelineResponse", () => {
|
||||
},
|
||||
} as AgentStreamEventPayload,
|
||||
timestamp: new Date(2000),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2, anchorSeq: 2 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2 },
|
||||
},
|
||||
],
|
||||
{ source: "canonical" },
|
||||
@@ -831,7 +831,7 @@ describe("processTimelineResponse", () => {
|
||||
|
||||
expect([...result.tail, ...result.head].filter((item) => item.kind === "todo_list")).toEqual([
|
||||
expect.objectContaining({
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2, anchorSeq: 1 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2 },
|
||||
items: [{ text: "Verify hydration", completed: true }],
|
||||
}),
|
||||
]);
|
||||
@@ -847,7 +847,7 @@ describe("processTimelineResponse", () => {
|
||||
item: { type: "compaction", status: "completed", trigger: "auto", preTokens: 1200 },
|
||||
} as AgentStreamEventPayload,
|
||||
timestamp: new Date(2000),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2, anchorSeq: 2 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2 },
|
||||
},
|
||||
],
|
||||
{ source: "canonical" },
|
||||
@@ -879,7 +879,7 @@ describe("processTimelineResponse", () => {
|
||||
|
||||
expect([...result.tail, ...result.head].filter((item) => item.kind === "compaction")).toEqual([
|
||||
expect.objectContaining({
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2, anchorSeq: 1 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 2 },
|
||||
status: "completed",
|
||||
trigger: "auto",
|
||||
preTokens: 1200,
|
||||
@@ -918,7 +918,7 @@ describe("processTimelineResponse", () => {
|
||||
messageId: "assistant-live",
|
||||
text: " continuation",
|
||||
timestamp: new Date(2001),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 101, anchorSeq: 101 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 101 },
|
||||
},
|
||||
],
|
||||
isInitializing: true,
|
||||
@@ -946,7 +946,7 @@ describe("processTimelineResponse", () => {
|
||||
);
|
||||
expect(assistants).toHaveLength(1);
|
||||
expect(assistants[0]?.text).toBe("canonical prefix continuation");
|
||||
expect(assistants[0]?.timelineCursor).toEqual({ epoch: "epoch-1", seq: 101, anchorSeq: 100 });
|
||||
expect(assistants[0]?.timelineCursor).toEqual({ epoch: "epoch-1", seq: 101 });
|
||||
});
|
||||
|
||||
it("keeps assistant segments separate when a live tool sits between them", () => {
|
||||
@@ -963,12 +963,12 @@ describe("processTimelineResponse", () => {
|
||||
}).item,
|
||||
} as AgentStreamEventPayload,
|
||||
timestamp: new Date(2101),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 101, anchorSeq: 101 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 101 },
|
||||
},
|
||||
{
|
||||
event: makeAssistantTimelineEvent("after tool", messageId),
|
||||
timestamp: new Date(2102),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 102, anchorSeq: 102 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 102 },
|
||||
},
|
||||
],
|
||||
{ source: "canonical" },
|
||||
@@ -1019,7 +1019,7 @@ describe("processTimelineResponse", () => {
|
||||
id: "assistant-live",
|
||||
text: "canonical prefix continuation",
|
||||
timestamp: new Date(2001),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 101, anchorSeq: 101 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 101 },
|
||||
},
|
||||
],
|
||||
isInitializing: true,
|
||||
@@ -1038,7 +1038,7 @@ describe("processTimelineResponse", () => {
|
||||
);
|
||||
expect(assistants).toHaveLength(1);
|
||||
expect(assistants[0]?.text).toBe("canonical prefix continuation");
|
||||
expect(assistants[0]?.timelineCursor).toEqual({ epoch: "epoch-1", seq: 101, anchorSeq: 100 });
|
||||
expect(assistants[0]?.timelineCursor).toEqual({ epoch: "epoch-1", seq: 101 });
|
||||
});
|
||||
|
||||
it("keeps a canonical live user row newer than the bootstrap page", () => {
|
||||
@@ -1060,7 +1060,7 @@ describe("processTimelineResponse", () => {
|
||||
});
|
||||
expect(live.head[0]).toMatchObject({
|
||||
kind: "user_message",
|
||||
timelineCursor: { epoch: "epoch-1", seq: 101, anchorSeq: 101 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 101 },
|
||||
});
|
||||
|
||||
const result = processTimelineResponse({
|
||||
@@ -1123,7 +1123,7 @@ describe("processTimelineResponse", () => {
|
||||
kind: "user_message",
|
||||
clientMessageId: "client-message-1",
|
||||
messageId: "provider-message-1",
|
||||
timelineCursor: { epoch: "epoch-1", seq: 51, anchorSeq: 51 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 51 },
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2808,7 +2808,7 @@ describe("processTimelineResponse", () => {
|
||||
id: "newest",
|
||||
text: "newest",
|
||||
timestamp: new Date(1000),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 100, anchorSeq: 100 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 100 },
|
||||
},
|
||||
makeSubmittedUserMessage("pending submission", "pending-submission"),
|
||||
],
|
||||
@@ -2886,14 +2886,14 @@ describe("processTimelineResponse", () => {
|
||||
id: "oldest",
|
||||
text: "oldest",
|
||||
timestamp: new Date(1000),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 1, anchorSeq: 1 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 1 },
|
||||
},
|
||||
{
|
||||
kind: "user_message",
|
||||
id: "newest",
|
||||
text: "newest",
|
||||
timestamp: new Date(100_000),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 100, anchorSeq: 100 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 100 },
|
||||
},
|
||||
];
|
||||
|
||||
@@ -2935,7 +2935,7 @@ describe("processTimelineResponse", () => {
|
||||
id: "newest",
|
||||
text: "newest",
|
||||
timestamp: new Date(100_000),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 100, anchorSeq: 100 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 100 },
|
||||
},
|
||||
...(lane === "tail" ? [pending] : []),
|
||||
],
|
||||
@@ -2976,13 +2976,9 @@ describe("processTimelineResponse", () => {
|
||||
{
|
||||
text: "local pending prompt",
|
||||
messageId: "canonical-message",
|
||||
timelineCursor: { epoch: "epoch-1", seq: 1, anchorSeq: 1 },
|
||||
},
|
||||
{
|
||||
text: "newest",
|
||||
messageId: undefined,
|
||||
timelineCursor: { epoch: "epoch-1", seq: 100, anchorSeq: 100 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 1 },
|
||||
},
|
||||
{ text: "newest", messageId: undefined, timelineCursor: { epoch: "epoch-1", seq: 100 } },
|
||||
],
|
||||
head: [],
|
||||
acknowledgedClientMessageIds: [clientMessageId],
|
||||
@@ -2996,7 +2992,7 @@ describe("processTimelineResponse", () => {
|
||||
{
|
||||
event: makeToolCallTimelineEvent("call-1"),
|
||||
timestamp: new Date(500),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 500, anchorSeq: 500 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 500 },
|
||||
},
|
||||
],
|
||||
{ source: "canonical" },
|
||||
@@ -3042,7 +3038,7 @@ describe("processTimelineResponse", () => {
|
||||
{
|
||||
callId: "call-1",
|
||||
status: "completed",
|
||||
timelineCursor: { epoch: "epoch-1", seq: 500, anchorSeq: 1 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 500 },
|
||||
},
|
||||
]);
|
||||
});
|
||||
@@ -3054,7 +3050,7 @@ describe("processTimelineResponse", () => {
|
||||
...makeAssistantItem("projected response", "loaded-assistant"),
|
||||
messageId: "assistant-message",
|
||||
timestamp,
|
||||
timelineCursor: { epoch: "epoch-1", seq: 500, anchorSeq: 500 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 500 },
|
||||
},
|
||||
];
|
||||
const result = processTimelineResponse({
|
||||
@@ -3104,7 +3100,7 @@ describe("processTimelineResponse", () => {
|
||||
id: "loaded-assistant",
|
||||
text: "projected response",
|
||||
messageId: "assistant-message",
|
||||
timelineCursor: { epoch: "epoch-1", seq: 500, anchorSeq: 1 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 500 },
|
||||
},
|
||||
]);
|
||||
});
|
||||
@@ -3116,7 +3112,7 @@ describe("processTimelineResponse", () => {
|
||||
id: "current-200",
|
||||
text: "current-200",
|
||||
timestamp: new Date(3200),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 200, anchorSeq: 200 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 200 },
|
||||
},
|
||||
];
|
||||
const existingCursor: TimelineCursor = {
|
||||
@@ -3223,7 +3219,7 @@ describe("processTimelineResponse", () => {
|
||||
const currentTail = [
|
||||
{
|
||||
...makeAssistantItem("newer chunk", "assistant-newer"),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 3, anchorSeq: 3 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 3 },
|
||||
},
|
||||
];
|
||||
const existingCursor: TimelineCursor = {
|
||||
@@ -3250,7 +3246,7 @@ describe("processTimelineResponse", () => {
|
||||
expect(result.tail[0]).toEqual(
|
||||
expect.objectContaining({
|
||||
id: "assistant-newer",
|
||||
timelineCursor: { epoch: "epoch-1", seq: 3, anchorSeq: 3 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 3 },
|
||||
}),
|
||||
);
|
||||
expect(result.cursor).toEqual({
|
||||
@@ -3690,7 +3686,7 @@ describe("processAgentStreamEvent", () => {
|
||||
expect.objectContaining({
|
||||
kind: "assistant_message",
|
||||
text: "[System Error] failed",
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42, anchorSeq: 42 },
|
||||
timelineCursor: { epoch: "timeline-1", seq: 42 },
|
||||
}),
|
||||
]);
|
||||
});
|
||||
@@ -3937,7 +3933,7 @@ describe("processAgentStreamEvent", () => {
|
||||
expect(getUserTexts(result.head)).toEqual(["live before bootstrap"]);
|
||||
expect(result.head[0]).toMatchObject({
|
||||
kind: "user_message",
|
||||
timelineCursor: { epoch: "epoch-1", seq: 51, anchorSeq: 51 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 51 },
|
||||
});
|
||||
expect(result.cursorChanged).toBe(false);
|
||||
expect(result.cursor).toBeNull();
|
||||
@@ -3972,7 +3968,7 @@ describe("processAgentStreamEvent", () => {
|
||||
clientMessageId: "client-message-1",
|
||||
messageId: "provider-message-1",
|
||||
text: "submitted before bootstrap",
|
||||
timelineCursor: { epoch: "epoch-1", seq: 51, anchorSeq: 51 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 51 },
|
||||
}),
|
||||
]);
|
||||
});
|
||||
@@ -4563,279 +4559,6 @@ describe("createAgentStreamReducerQueue", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Conversation rewind: A, B, rewind B, C
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
describe("conversation rewind", () => {
|
||||
const rewindB = { seq: 5, retireFromSeq: 3 };
|
||||
|
||||
function loadAB(): { tail: StreamItem[]; head: StreamItem[]; cursor: TimelineCursor } {
|
||||
const result = processTimelineResponse({
|
||||
...baseTimelineInput,
|
||||
isInitializing: true,
|
||||
hasActiveInitDeferred: true,
|
||||
payload: {
|
||||
...baseTimelineInput.payload,
|
||||
direction: "tail",
|
||||
window: { minSeq: 1, maxSeq: 4, nextSeq: 5 },
|
||||
startCursor: { seq: 1 },
|
||||
endCursor: { seq: 4 },
|
||||
entries: [
|
||||
makeTimelineEntry(1, "A", "user_message"),
|
||||
makeTimelineEntry(2, "reply A"),
|
||||
makeTimelineEntry(3, "B", "user_message"),
|
||||
makeTimelineEntry(4, "reply B"),
|
||||
],
|
||||
},
|
||||
});
|
||||
if (!result.cursor) throw new Error("expected a loaded range");
|
||||
return { tail: result.tail, head: result.head, cursor: result.cursor };
|
||||
}
|
||||
|
||||
function live(
|
||||
state: { tail: StreamItem[]; head: StreamItem[]; cursor: TimelineCursor },
|
||||
events: AgentStreamReducerEvent[],
|
||||
) {
|
||||
const result = processAgentStreamEvents({
|
||||
events,
|
||||
currentTail: state.tail,
|
||||
currentHead: state.head,
|
||||
currentCursor: state.cursor,
|
||||
hasAuthoritativeBaseline: true,
|
||||
});
|
||||
return {
|
||||
tail: result.tail,
|
||||
head: result.head,
|
||||
cursor: result.cursor ?? state.cursor,
|
||||
sideEffects: result.sideEffects,
|
||||
};
|
||||
}
|
||||
|
||||
function rewindEvent(retirement: { seq: number; retireFromSeq: number }) {
|
||||
return {
|
||||
event: { type: "rewind" as const, retireFromSeq: retirement.retireFromSeq },
|
||||
seq: retirement.seq,
|
||||
epoch: "epoch-1",
|
||||
timestamp: new Date(1000 + retirement.seq),
|
||||
};
|
||||
}
|
||||
|
||||
const promptC = [
|
||||
makeStreamReducerEvent(makeTimelineEvent("C", "user_message"), 6),
|
||||
makeStreamReducerEvent(makeTimelineEvent("reply C"), 7),
|
||||
];
|
||||
|
||||
function conversation(state: { tail: StreamItem[]; head: StreamItem[] }) {
|
||||
return [...state.tail, ...state.head].map((item) =>
|
||||
item.kind === "user_message" || item.kind === "assistant_message" ? item.text : item.kind,
|
||||
);
|
||||
}
|
||||
|
||||
it("retires B in place, keeps A mounted, and shows C once", () => {
|
||||
const loaded = loadAB();
|
||||
const [promptA, replyA] = loaded.tail;
|
||||
|
||||
const rewound = live(loaded, [rewindEvent(rewindB), ...promptC]);
|
||||
|
||||
expect(conversation(rewound)).toEqual(["A", "reply A", "C", "reply C"]);
|
||||
expect(rewound.tail[0]).toBe(promptA);
|
||||
expect(rewound.tail[1]).toBe(replyA);
|
||||
expect(rewound.cursor).toMatchObject({ epoch: "epoch-1", startSeq: 1, endSeq: 7 });
|
||||
expect(rewound.sideEffects).toEqual([]);
|
||||
});
|
||||
|
||||
it("ignores a duplicate rewind so C is not retired", () => {
|
||||
const rewound = live(loadAB(), [rewindEvent(rewindB), ...promptC]);
|
||||
|
||||
const replayed = live(rewound, [rewindEvent(rewindB)]);
|
||||
|
||||
expect(conversation(replayed)).toEqual(["A", "reply A", "C", "reply C"]);
|
||||
expect(replayed.cursor.endSeq).toBe(7);
|
||||
});
|
||||
|
||||
it("does not let an old page resurrect B after the rewind applied", () => {
|
||||
const rewound = live(loadAB(), [rewindEvent(rewindB), ...promptC]);
|
||||
|
||||
const stale = processTimelineResponse({
|
||||
...baseTimelineInput,
|
||||
currentTail: rewound.tail,
|
||||
currentHead: rewound.head,
|
||||
currentCursor: rewound.cursor,
|
||||
payload: {
|
||||
...baseTimelineInput.payload,
|
||||
direction: "after",
|
||||
window: { minSeq: 1, maxSeq: 4, nextSeq: 5 },
|
||||
startCursor: { seq: 3 },
|
||||
endCursor: { seq: 4 },
|
||||
entries: [makeTimelineEntry(3, "B", "user_message"), makeTimelineEntry(4, "reply B")],
|
||||
},
|
||||
});
|
||||
|
||||
expect(conversation(stale)).toEqual(["A", "reply A", "C", "reply C"]);
|
||||
expect(stale.cursorChanged).toBe(false);
|
||||
});
|
||||
|
||||
it("drops a late live delivery for the retired range", () => {
|
||||
const rewound = live(loadAB(), [rewindEvent(rewindB)]);
|
||||
|
||||
const late = live(rewound, [makeStreamReducerEvent(makeTimelineEvent("late B"), 4)]);
|
||||
|
||||
expect(conversation(late)).toEqual(["A", "reply A"]);
|
||||
});
|
||||
|
||||
it("catches up through a page that only carries the retirement", () => {
|
||||
const loaded = loadAB();
|
||||
|
||||
const caughtUp = processTimelineResponse({
|
||||
...baseTimelineInput,
|
||||
currentTail: loaded.tail,
|
||||
currentHead: loaded.head,
|
||||
currentCursor: loaded.cursor,
|
||||
payload: {
|
||||
...baseTimelineInput.payload,
|
||||
direction: "after",
|
||||
window: { minSeq: 1, maxSeq: 5, nextSeq: 6 },
|
||||
startCursor: { seq: 5 },
|
||||
endCursor: { seq: 5 },
|
||||
entries: [],
|
||||
retirements: [rewindB],
|
||||
},
|
||||
});
|
||||
if (!caughtUp.cursor) throw new Error("expected a loaded range");
|
||||
|
||||
expect(conversation(caughtUp)).toEqual(["A", "reply A"]);
|
||||
expect(caughtUp.cursor.endSeq).toBe(5);
|
||||
expect(caughtUp.sideEffects).not.toContainEqual(expect.objectContaining({ type: "catch_up" }));
|
||||
|
||||
const continued = live({ ...caughtUp, cursor: caughtUp.cursor }, promptC);
|
||||
expect(conversation(continued)).toEqual(["A", "reply A", "C", "reply C"]);
|
||||
});
|
||||
|
||||
it("converges after reconnect from a resume page that crosses the rewind", () => {
|
||||
const loaded = loadAB();
|
||||
|
||||
const resumed = processTimelineResponse({
|
||||
...baseTimelineInput,
|
||||
currentTail: loaded.tail,
|
||||
currentHead: loaded.head,
|
||||
currentCursor: loaded.cursor,
|
||||
payload: {
|
||||
...baseTimelineInput.payload,
|
||||
direction: "tail",
|
||||
window: { minSeq: 1, maxSeq: 7, nextSeq: 8 },
|
||||
startCursor: { seq: 1 },
|
||||
endCursor: { seq: 7 },
|
||||
entries: [
|
||||
makeTimelineEntry(1, "A", "user_message"),
|
||||
makeTimelineEntry(2, "reply A"),
|
||||
makeTimelineEntry(6, "C", "user_message"),
|
||||
makeTimelineEntry(7, "reply C"),
|
||||
],
|
||||
retirements: [rewindB],
|
||||
},
|
||||
});
|
||||
|
||||
expect(conversation(resumed)).toEqual(["A", "reply A", "C", "reply C"]);
|
||||
expect(resumed.tail[0]).toBe(loaded.tail[0]);
|
||||
expect(resumed.cursor).toMatchObject({ endSeq: 7 });
|
||||
});
|
||||
|
||||
it("recovers a rewind that skips past the loaded end", () => {
|
||||
const loaded = loadAB();
|
||||
|
||||
const gapped = live(loaded, [rewindEvent({ seq: 9, retireFromSeq: 3 })]);
|
||||
|
||||
expect(conversation(gapped)).toEqual(["A", "reply A", "B", "reply B"]);
|
||||
expect(gapped.sideEffects).toEqual([
|
||||
{ type: "catch_up", cursor: { epoch: "epoch-1", endSeq: 4 } },
|
||||
]);
|
||||
});
|
||||
|
||||
it("keeps an A row whose late update carries a seq inside B's range", () => {
|
||||
const loaded = loadAB();
|
||||
const [promptA, replyA, ...rest] = loaded.tail;
|
||||
const lateTool = hydrateStreamState(
|
||||
[
|
||||
{
|
||||
event: makeToolCallTimelineEvent("call-a"),
|
||||
timestamp: new Date(1002),
|
||||
timelineCursor: { epoch: "epoch-1", seq: 4, anchorSeq: 2 },
|
||||
},
|
||||
],
|
||||
{ source: "canonical" },
|
||||
);
|
||||
const state = { ...loaded, tail: [promptA, replyA, ...lateTool, ...rest] };
|
||||
|
||||
const rewound = live(state, [rewindEvent(rewindB)]);
|
||||
|
||||
expect(conversation(rewound)).toEqual(["A", "reply A", "tool_call"]);
|
||||
});
|
||||
|
||||
it("keeps a tool that started before B when B's prompt is not loaded and the tool updated after B", () => {
|
||||
const toolA = {
|
||||
...makeToolCallTimelineEntry(2, "call-a", "completed", {
|
||||
type: "read",
|
||||
filePath: "/tmp/a.ts",
|
||||
}),
|
||||
seqEnd: 6,
|
||||
sourceSeqRanges: [
|
||||
{ startSeq: 2, endSeq: 2 },
|
||||
{ startSeq: 6, endSeq: 6 },
|
||||
],
|
||||
};
|
||||
const loaded = processTimelineResponse({
|
||||
...baseTimelineInput,
|
||||
isInitializing: true,
|
||||
hasActiveInitDeferred: true,
|
||||
payload: {
|
||||
...baseTimelineInput.payload,
|
||||
direction: "tail",
|
||||
window: { minSeq: 1, maxSeq: 6, nextSeq: 7 },
|
||||
startCursor: { seq: 1 },
|
||||
endCursor: { seq: 6 },
|
||||
entries: [makeTimelineEntry(1, "A", "user_message"), toolA],
|
||||
},
|
||||
});
|
||||
if (!loaded.cursor) throw new Error("expected a loaded range");
|
||||
|
||||
const rewound = live({ tail: loaded.tail, head: loaded.head, cursor: loaded.cursor }, [
|
||||
rewindEvent({ seq: 7, retireFromSeq: 3 }),
|
||||
]);
|
||||
|
||||
expect(conversation(rewound)).toEqual(["A", "tool_call"]);
|
||||
});
|
||||
|
||||
it("keeps C from the live overlay when the first page brings the retirement C followed", () => {
|
||||
const overlay = processAgentStreamEvents({
|
||||
events: [rewindEvent(rewindB), ...promptC],
|
||||
currentTail: [],
|
||||
currentHead: [],
|
||||
currentCursor: undefined,
|
||||
hasAuthoritativeBaseline: false,
|
||||
});
|
||||
|
||||
const initialized = processTimelineResponse({
|
||||
...baseTimelineInput,
|
||||
isInitializing: true,
|
||||
hasActiveInitDeferred: true,
|
||||
currentTail: overlay.tail,
|
||||
currentHead: overlay.head,
|
||||
payload: {
|
||||
...baseTimelineInput.payload,
|
||||
direction: "tail",
|
||||
window: { minSeq: 1, maxSeq: 5, nextSeq: 6 },
|
||||
startCursor: { seq: 1 },
|
||||
endCursor: { seq: 5 },
|
||||
entries: [makeTimelineEntry(1, "A", "user_message"), makeTimelineEntry(2, "reply A")],
|
||||
retirements: [rewindB],
|
||||
},
|
||||
});
|
||||
|
||||
expect(conversation(initialized)).toEqual(["A", "reply A", "C", "reply C"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("turn metrics", () => {
|
||||
const metrics = [
|
||||
{ label: "Model", value: "opus" },
|
||||
@@ -5093,30 +4816,4 @@ describe("turn metrics", () => {
|
||||
|
||||
expect(repeated.tail).toBe(first.tail);
|
||||
});
|
||||
|
||||
it("stamps turn metrics carried on a live timeline event appended by reload", () => {
|
||||
const result = processAgentStreamEvents({
|
||||
events: [
|
||||
makeStreamReducerEvent(makeTimelineEvent("question", "user_message"), 1),
|
||||
makeStreamReducerEvent(
|
||||
{
|
||||
type: "timeline",
|
||||
provider: "claude",
|
||||
item: { type: "assistant_message", text: "Appended reply." },
|
||||
turnMetrics: metrics,
|
||||
},
|
||||
2,
|
||||
),
|
||||
],
|
||||
currentTail: [],
|
||||
currentHead: [],
|
||||
currentCursor: { epoch: "epoch-1", startSeq: 0, endSeq: 0 },
|
||||
hasAuthoritativeBaseline: true,
|
||||
});
|
||||
|
||||
expect(metricsByKind([...result.tail, ...result.head])).toEqual([
|
||||
{ kind: "user_message", turnMetrics: undefined },
|
||||
{ kind: "assistant_message", turnMetrics: metrics },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
import type { AgentMetric, AgentTimelineItem } from "@getpaseo/protocol/agent-types";
|
||||
import type { AgentStreamEventPayload } from "@getpaseo/protocol/messages";
|
||||
import { selectAgentTimelineState, useSessionStore } from "@/stores/session-store";
|
||||
import {
|
||||
advanceTimelinePosition,
|
||||
type AssistantMessageItem,
|
||||
type StreamItem,
|
||||
type TimelinePosition,
|
||||
type TodoEntry,
|
||||
} from "@/types/stream";
|
||||
import type { AssistantMessageItem, StreamItem, TodoEntry } from "@/types/stream";
|
||||
import type { TurnLivenessTransition } from "@/timeline/turn-liveness";
|
||||
import { stampTimelineTurnMetrics } from "@/timeline/turn-metrics";
|
||||
import {
|
||||
@@ -78,64 +72,6 @@ interface TimelineSeqRange {
|
||||
endSeq: number;
|
||||
}
|
||||
|
||||
/** A conversation rewind took the rows anchored in `[retireFromSeq, seq)` out of the conversation. */
|
||||
export interface TimelineRetirement {
|
||||
seq: number;
|
||||
retireFromSeq: number;
|
||||
}
|
||||
|
||||
/** The live form of a retirement; it is sequenced with the stream events around it. */
|
||||
export interface TimelineRewindEvent {
|
||||
type: "rewind";
|
||||
retireFromSeq: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops the rows a retirement took out of the conversation: those anchored in
|
||||
* `[retireFromSeq, seq)`. Anchors do not move on update, so an earlier row updated after the
|
||||
* rewound prompt stays, and a row that started after the retirement stays. Items without a
|
||||
* timeline position are local sends the daemon has not echoed and stay.
|
||||
*/
|
||||
function retireRewoundStreamItems(input: {
|
||||
tail: StreamItem[];
|
||||
head: StreamItem[];
|
||||
epoch: string;
|
||||
retirement: TimelineRetirement;
|
||||
}): { tail: StreamItem[]; head: StreamItem[] } {
|
||||
const { tail, head, epoch, retirement } = input;
|
||||
const isRetired = (item: StreamItem) => {
|
||||
const position = item.timelineCursor;
|
||||
return (
|
||||
position?.epoch === epoch &&
|
||||
position.anchorSeq >= retirement.retireFromSeq &&
|
||||
position.anchorSeq < retirement.seq
|
||||
);
|
||||
};
|
||||
const nextTail = tail.filter((item) => !isRetired(item));
|
||||
const nextHead = head.filter((item) => !isRetired(item));
|
||||
return {
|
||||
tail: nextTail.length === tail.length ? tail : nextTail,
|
||||
head: nextHead.length === head.length ? head : nextHead,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a page's retirements to what this client holds. The page's own entries are already
|
||||
* active. Applying a retirement twice changes nothing, since its range is bounded.
|
||||
*/
|
||||
function retireForPage(input: {
|
||||
payload: ProcessTimelineResponseInput["payload"];
|
||||
tail: StreamItem[];
|
||||
head: StreamItem[];
|
||||
}): { tail: StreamItem[]; head: StreamItem[] } {
|
||||
const { payload } = input;
|
||||
let held = { tail: input.tail, head: input.head };
|
||||
for (const retirement of payload.retirements ?? []) {
|
||||
held = retireRewoundStreamItems({ ...held, epoch: payload.epoch, retirement });
|
||||
}
|
||||
return held;
|
||||
}
|
||||
|
||||
function mergeTimelineCoverage(
|
||||
current: TimelineCursor,
|
||||
added: TimelineLoadedRange,
|
||||
@@ -216,7 +152,6 @@ export interface ProcessTimelineResponseInput {
|
||||
hasNewer: boolean;
|
||||
hasOlder: boolean;
|
||||
mergeWindow?: boolean;
|
||||
retirements?: TimelineRetirement[];
|
||||
};
|
||||
currentTail: StreamItem[];
|
||||
currentHead: StreamItem[];
|
||||
@@ -461,7 +396,7 @@ function mergeTimelineWindow(args: {
|
||||
toHydratedEvents: (units: TimelineUnit[]) => Array<{
|
||||
event: AgentStreamEventPayload;
|
||||
timestamp: Date;
|
||||
timelineCursor: TimelinePosition;
|
||||
timelineCursor: { epoch: string; seq: number };
|
||||
}>;
|
||||
}): TimelinePathResult {
|
||||
const { timelineUnits, payload, currentTail, currentHead, currentCursor, toHydratedEvents } =
|
||||
@@ -825,7 +760,7 @@ function replaceLiveAssistantWithProjectedText(params: {
|
||||
head: StreamItem[];
|
||||
event: AgentStreamEventPayload;
|
||||
timestamp: Date;
|
||||
timelineCursor: TimelinePosition;
|
||||
timelineCursor: { epoch: string; seq: number };
|
||||
}): StreamItem[] | null {
|
||||
const { head, event, timestamp, timelineCursor } = params;
|
||||
if (event.type !== "timeline" || event.item.type !== "assistant_message") {
|
||||
@@ -844,7 +779,7 @@ function replaceLiveAssistantWithProjectedText(params: {
|
||||
...current,
|
||||
text: event.item.text,
|
||||
timestamp,
|
||||
...advanceTimelinePosition(current.timelineCursor, timelineCursor),
|
||||
timelineCursor,
|
||||
};
|
||||
return next;
|
||||
}
|
||||
@@ -894,7 +829,7 @@ function reconcileOverlappingProjectedAssistant(params: {
|
||||
...(messageId !== undefined ? { messageId } : {}),
|
||||
text: projectedText,
|
||||
timestamp: unit.timestamp,
|
||||
timelineCursor: { epoch: params.epoch, seq: unit.seqEnd, anchorSeq: unit.seq },
|
||||
timelineCursor: { epoch: params.epoch, seq: unit.seqEnd },
|
||||
};
|
||||
const replaceMatch = (items: StreamItem[], index: number) => {
|
||||
const next = [...items];
|
||||
@@ -1011,8 +946,8 @@ function applyCanonicalForwardUnit(params: {
|
||||
unit: TimelineUnit;
|
||||
epoch: string;
|
||||
}): { tail: StreamItem[]; head: StreamItem[]; acknowledgedClientMessageIds: string[] } {
|
||||
const { event, timestamp, seq, seqEnd } = params.unit;
|
||||
const timelineCursor: TimelinePosition = { epoch: params.epoch, seq: seqEnd, anchorSeq: seq };
|
||||
const { event, timestamp, seqEnd } = params.unit;
|
||||
const timelineCursor = { epoch: params.epoch, seq: seqEnd };
|
||||
if (event.type === "timeline" && event.item.type === "user_message") {
|
||||
const applied = applyStreamEvent({
|
||||
tail: params.tail,
|
||||
@@ -1211,10 +1146,10 @@ function applyAcceptedTimelinePage(input: {
|
||||
});
|
||||
}
|
||||
const olderTail = hydrateStreamState(
|
||||
acceptedUnits.map(({ event, timestamp, seq, seqEnd }) => ({
|
||||
acceptedUnits.map(({ event, timestamp, seqEnd }) => ({
|
||||
event,
|
||||
timestamp,
|
||||
timelineCursor: { epoch: payload.epoch, seq: seqEnd, anchorSeq: seq },
|
||||
timelineCursor: { epoch: payload.epoch, seq: seqEnd },
|
||||
})),
|
||||
{
|
||||
source: "canonical",
|
||||
@@ -1246,12 +1181,7 @@ function applyTimelineIncrementalPath(args: {
|
||||
let cursorChanged = false;
|
||||
const sideEffects: TimelineReducerSideEffect[] = [];
|
||||
|
||||
// A forward page of retirements alone still advances the loaded end.
|
||||
if (
|
||||
timelineUnits.length === 0 &&
|
||||
payload.direction !== "before" &&
|
||||
(payload.retirements?.length ?? 0) === 0
|
||||
) {
|
||||
if (timelineUnits.length === 0 && payload.direction !== "before") {
|
||||
return {
|
||||
tail: currentTail,
|
||||
head: currentHead,
|
||||
@@ -1309,6 +1239,8 @@ export function processTimelineResponse(
|
||||
): ProcessTimelineResponseOutput {
|
||||
const {
|
||||
payload,
|
||||
currentTail,
|
||||
currentHead,
|
||||
currentCursor,
|
||||
isInitializing,
|
||||
hasActiveInitDeferred,
|
||||
@@ -1322,8 +1254,8 @@ export function processTimelineResponse(
|
||||
if (payload.error) {
|
||||
return {
|
||||
commit: "apply",
|
||||
tail: input.currentTail,
|
||||
head: input.currentHead,
|
||||
tail: currentTail,
|
||||
head: currentHead,
|
||||
cursor: currentCursor,
|
||||
cursorChanged: false,
|
||||
older: "unchanged",
|
||||
@@ -1335,13 +1267,6 @@ export function processTimelineResponse(
|
||||
};
|
||||
}
|
||||
|
||||
// Entries are already free of retired rows; the retirements apply to what this client holds.
|
||||
const { tail: currentTail, head: currentHead } = retireForPage({
|
||||
payload,
|
||||
tail: input.currentTail,
|
||||
head: input.currentHead,
|
||||
});
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Convert entries to timeline units
|
||||
// ------------------------------------------------------------------
|
||||
@@ -1367,12 +1292,12 @@ export function processTimelineResponse(
|
||||
): Array<{
|
||||
event: AgentStreamEventPayload;
|
||||
timestamp: Date;
|
||||
timelineCursor: TimelinePosition;
|
||||
timelineCursor: { epoch: string; seq: number };
|
||||
}> =>
|
||||
units.map(({ event, timestamp, seq, seqEnd }) => ({
|
||||
units.map(({ event, timestamp, seqEnd }) => ({
|
||||
event,
|
||||
timestamp,
|
||||
timelineCursor: { epoch: payload.epoch, seq: seqEnd, anchorSeq: seq },
|
||||
timelineCursor: { epoch: payload.epoch, seq: seqEnd },
|
||||
}));
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
@@ -1507,7 +1432,7 @@ export function processTimelineResponse(
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface ProcessAgentStreamEventInput {
|
||||
event: AgentStreamEventPayload | TimelineRewindEvent;
|
||||
event: AgentStreamEventPayload;
|
||||
seq: number | undefined;
|
||||
epoch: string | undefined;
|
||||
currentTail: StreamItem[];
|
||||
@@ -1530,7 +1455,7 @@ export interface ProcessAgentStreamEventOutput {
|
||||
}
|
||||
|
||||
export interface AgentStreamReducerEvent {
|
||||
event: AgentStreamEventPayload | TimelineRewindEvent;
|
||||
event: AgentStreamEventPayload;
|
||||
seq: number | undefined;
|
||||
epoch: string | undefined;
|
||||
timestamp: Date;
|
||||
@@ -1648,70 +1573,11 @@ function processTimelineSequencingGate(input: {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a live rewind in sequence with the stream. One that does not follow the loaded end is
|
||||
* stale (already applied, or older than a page this client took) or leaves a gap to catch up.
|
||||
*/
|
||||
function processTimelineRewind(
|
||||
input: ProcessAgentStreamEventInput & { event: TimelineRewindEvent },
|
||||
): ProcessAgentStreamEventOutput {
|
||||
const { event, seq, epoch, currentTail, currentHead, currentCursor } = input;
|
||||
const unchanged: ProcessAgentStreamEventOutput = {
|
||||
tail: currentTail,
|
||||
head: currentHead,
|
||||
changedTail: false,
|
||||
changedHead: false,
|
||||
cursor: null,
|
||||
cursorChanged: false,
|
||||
acknowledgedClientMessageIds: [],
|
||||
sideEffects: [],
|
||||
};
|
||||
if (seq === undefined || epoch === undefined) return unchanged;
|
||||
const decision =
|
||||
input.hasAuthoritativeBaseline === false
|
||||
? "overlay"
|
||||
: classifySessionTimelineSeq({
|
||||
cursor: currentCursor
|
||||
? { epoch: currentCursor.epoch, endSeq: currentCursor.endSeq }
|
||||
: null,
|
||||
epoch,
|
||||
seq,
|
||||
});
|
||||
if (decision === "gap" && currentCursor) {
|
||||
return {
|
||||
...unchanged,
|
||||
sideEffects: [
|
||||
{ type: "catch_up", cursor: { epoch: currentCursor.epoch, endSeq: currentCursor.endSeq } },
|
||||
],
|
||||
};
|
||||
}
|
||||
if (decision !== "accept" && decision !== "init" && decision !== "overlay") return unchanged;
|
||||
const retired = retireRewoundStreamItems({
|
||||
tail: currentTail,
|
||||
head: currentHead,
|
||||
epoch,
|
||||
retirement: { seq, retireFromSeq: event.retireFromSeq },
|
||||
});
|
||||
let cursor: TimelineCursor | null = null;
|
||||
if (decision === "accept" && currentCursor) cursor = { ...currentCursor, endSeq: seq };
|
||||
if (decision === "init") cursor = { epoch, startSeq: seq, endSeq: seq };
|
||||
return {
|
||||
...unchanged,
|
||||
tail: retired.tail,
|
||||
head: retired.head,
|
||||
changedTail: retired.tail !== currentTail,
|
||||
changedHead: retired.head !== currentHead,
|
||||
cursor,
|
||||
cursorChanged: cursor !== null,
|
||||
};
|
||||
}
|
||||
|
||||
export function processAgentStreamEvent(
|
||||
input: ProcessAgentStreamEventInput,
|
||||
): ProcessAgentStreamEventOutput {
|
||||
const event = input.event;
|
||||
if (event.type === "rewind") return processTimelineRewind({ ...input, event });
|
||||
const {
|
||||
event,
|
||||
seq,
|
||||
epoch,
|
||||
currentTail,
|
||||
@@ -1730,7 +1596,7 @@ export function processAgentStreamEvent(
|
||||
});
|
||||
const timelineCursor =
|
||||
event.type === "timeline" && seq !== undefined && epoch !== undefined
|
||||
? { epoch, seq, anchorSeq: seq }
|
||||
? { epoch, seq }
|
||||
: undefined;
|
||||
// ------------------------------------------------------------------
|
||||
// Apply stream event to tail/head
|
||||
@@ -2044,10 +1910,6 @@ export function createSessionAgentStreamReducerQueue(
|
||||
};
|
||||
},
|
||||
commit: (agentId, result, events) => {
|
||||
for (const { event, seq, epoch } of events) {
|
||||
if (event.type !== "rewind" || seq === undefined || epoch === undefined) continue;
|
||||
useSessionStore.getState().recordAgentTimelineRewind(serverId, agentId, { epoch, seq });
|
||||
}
|
||||
if (
|
||||
result.changedTail ||
|
||||
result.changedHead ||
|
||||
|
||||
@@ -208,6 +208,7 @@ class TimelineWorld {
|
||||
},
|
||||
onCatchUpOwed: () => undefined,
|
||||
onCatchUpSettled: () => undefined,
|
||||
isArchived: () => false,
|
||||
prepare: async (agentId) => {
|
||||
this.cacheRequests.push(agentId);
|
||||
this.cacheRequestWaiters.shift()?.(agentId);
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
useSessionStore,
|
||||
type AgentTimelineCursorState,
|
||||
type AgentTimelineState,
|
||||
type SessionState,
|
||||
} from "@/stores/session-store";
|
||||
import { useCreateFlowStore } from "@/stores/create-flow-store";
|
||||
import type { AgentSnapshotPayload, SessionOutboundMessage } from "@getpaseo/protocol/messages";
|
||||
@@ -102,6 +103,8 @@ export interface TimelineReplica {
|
||||
timelineUpdated(agentId: string): void;
|
||||
catchUpOwed(agentId: string): void;
|
||||
catchUpSettled(agentId: string): void;
|
||||
/** Forgets a released chat's cached range, so showing it again reads the cache afresh. */
|
||||
release(agentId: string): void;
|
||||
}
|
||||
|
||||
class TimelineReplicaOwner implements TimelineReplica {
|
||||
@@ -187,6 +190,10 @@ class TimelineReplicaOwner implements TimelineReplica {
|
||||
if (this.preparations.has(agentId)) this.settledDuringPreparation.add(agentId);
|
||||
useSessionStore.getState().setAgentTimelineUnsettledTurn(this.serverId, agentId, null);
|
||||
}
|
||||
|
||||
release(agentId: string): void {
|
||||
this.cachedRanges.delete(agentId);
|
||||
}
|
||||
}
|
||||
|
||||
export function createTimelineReplica(input: {
|
||||
@@ -237,13 +244,6 @@ function commitProcessedTimeline(input: {
|
||||
const agentId = payload.agentId;
|
||||
const store = useSessionStore.getState();
|
||||
if (result.commit !== "discard") {
|
||||
const latestRewindSeq = Math.max(...(payload.retirements ?? []).map(({ seq }) => seq));
|
||||
if (Number.isFinite(latestRewindSeq)) {
|
||||
store.recordAgentTimelineRewind(serverId, agentId, {
|
||||
epoch: payload.epoch,
|
||||
seq: latestRewindSeq,
|
||||
});
|
||||
}
|
||||
store.applyAgentTimelineResponseState(serverId, agentId, {
|
||||
items: result.tail,
|
||||
head: result.head,
|
||||
@@ -382,6 +382,11 @@ function buildCurrentTimelinePage(
|
||||
|
||||
export interface ViewedTimelineSyncPorts {
|
||||
prepare(agentId: string): Promise<void>;
|
||||
/**
|
||||
* Whether the agent left the active list: it, or its workspace, is archived. A hidden chat
|
||||
* of an archived agent leaves the opened chats, so showing it again reads it afresh.
|
||||
*/
|
||||
isArchived(agentId: string): boolean;
|
||||
replaceDemandedAgentIds(agentIds: string[]): void;
|
||||
/** Whether the daemon answers with each cursor's freshness in the subscribe response. */
|
||||
canCheckFreshness(): boolean;
|
||||
@@ -454,9 +459,17 @@ export interface ViewedTimelineSync extends ViewedTimelineUiBridge {
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
/** What the timeline owner needs from membership beyond the UI-facing surface. */
|
||||
export interface ViewedTimelineMembership extends ViewedTimelineSync {
|
||||
isVisible(agentId: string): boolean;
|
||||
/** Re-reads `isArchived` for the opened chats, after the active list changed. */
|
||||
archiveChanged(): void;
|
||||
}
|
||||
|
||||
export type ViewedTimelineOwnerPorts = Omit<
|
||||
ViewedTimelineSyncPorts,
|
||||
| "prepare"
|
||||
| "isArchived"
|
||||
| "replaceDemandedAgentIds"
|
||||
| "onCatchUpEnded"
|
||||
| "onCatchUpOwed"
|
||||
@@ -464,14 +477,8 @@ export type ViewedTimelineOwnerPorts = Omit<
|
||||
| "applyCurrentTimeline"
|
||||
>;
|
||||
|
||||
/**
|
||||
* `stale`: the page was served before a rewind this client already applied, so it can hold rows
|
||||
* that rewind retired. Nothing was applied; request the page again.
|
||||
*/
|
||||
export type TimelineResponseOutcome = "applied" | "stale";
|
||||
|
||||
export interface ViewedTimelineOwner extends ViewedTimelineSync {
|
||||
applyTimelineResponse(payload: TimelineResponsePayload): TimelineResponseOutcome;
|
||||
applyTimelineResponse(payload: TimelineResponsePayload): void;
|
||||
/**
|
||||
* Accepts one live stream event. Content is coalesced to the next frame; a turn boundary
|
||||
* commits the turn's queued content before its liveness changes, so the view never shows
|
||||
@@ -481,37 +488,6 @@ export interface ViewedTimelineOwner extends ViewedTimelineSync {
|
||||
flushStreamAgent(agentId: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* The latest retirement each chat has seen, live or on a page. Tail, older and prompt-jump pages
|
||||
* are served from active rows at one moment; one served before that retirement can still hold the
|
||||
* rows it retired, and has no retirement to drop them with. Forward pages are sequenced against
|
||||
* the loaded end instead, so they are never stale here.
|
||||
*/
|
||||
function createRetirementHighWater() {
|
||||
const latest = new Map<string, { epoch: string; seq: number }>();
|
||||
function note(agentId: string, retirement: { epoch: string; seq: number }): void {
|
||||
const current = latest.get(agentId);
|
||||
if (current?.epoch === retirement.epoch && current.seq >= retirement.seq) return;
|
||||
latest.set(agentId, retirement);
|
||||
}
|
||||
return {
|
||||
note,
|
||||
notePage(payload: TimelineResponsePayload): void {
|
||||
for (const retirement of payload.retirements ?? []) {
|
||||
note(payload.agentId, { epoch: payload.epoch, seq: retirement.seq });
|
||||
}
|
||||
},
|
||||
servedBefore(payload: TimelineResponsePayload): boolean {
|
||||
const known = latest.get(payload.agentId);
|
||||
return (
|
||||
payload.direction !== "after" &&
|
||||
known?.epoch === payload.epoch &&
|
||||
payload.window.maxSeq < known.seq
|
||||
);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function createViewedTimelineOwner(input: {
|
||||
serverId: string;
|
||||
replica: TimelineReplica;
|
||||
@@ -521,9 +497,14 @@ export function createViewedTimelineOwner(input: {
|
||||
ports: ViewedTimelineOwnerPorts;
|
||||
}): ViewedTimelineOwner {
|
||||
const forcedTailReplacements = new Set<string>();
|
||||
const retirements = createRetirementHighWater();
|
||||
const isArchived = (agentId: string) =>
|
||||
isAgentArchived(useSessionStore.getState().sessions[input.serverId], agentId);
|
||||
// Active chats stay resident while hidden so switching back needs no fetch. An archived
|
||||
// chat is resident only while it is shown, as when it is open from History.
|
||||
const isResident = (agentId: string) => sync.isVisible(agentId) || !isArchived(agentId);
|
||||
const sync = createViewedTimelineSync({
|
||||
...input.ports,
|
||||
isArchived,
|
||||
fetchLatestTail: async (agentId) => {
|
||||
forcedTailReplacements.add(agentId);
|
||||
try {
|
||||
@@ -532,7 +513,11 @@ export function createViewedTimelineOwner(input: {
|
||||
forcedTailReplacements.delete(agentId);
|
||||
}
|
||||
},
|
||||
prepare: (agentId) => input.replica.prepare(agentId),
|
||||
prepare: async (agentId) => {
|
||||
await input.replica.prepare(agentId);
|
||||
// A cache read that lands after its archived chat was left paints a chat nobody shows.
|
||||
releaseHiddenArchivedTimelines();
|
||||
},
|
||||
readCursor: (agentId) => input.replica.readCursor(agentId) ?? input.ports.readCursor(agentId),
|
||||
replaceDemandedAgentIds: input.replaceDemandedAgentIds,
|
||||
applyCurrentTimeline: (agentId) => {
|
||||
@@ -559,11 +544,40 @@ export function createViewedTimelineOwner(input: {
|
||||
recoverTimelineGap: (agentId, cursor) => sync.recoverGap(agentId, cursor),
|
||||
onCommitted: (agentId) => input.replica.timelineUpdated(agentId),
|
||||
});
|
||||
const releaseHiddenArchivedTimelines = () => {
|
||||
const session = useSessionStore.getState().sessions[input.serverId];
|
||||
if (!session) return;
|
||||
for (const agentId of selectResidentTimelineAgentIds(session)) {
|
||||
if (isResident(agentId)) continue;
|
||||
streamQueue.flushAgent(agentId);
|
||||
input.replica.release(agentId);
|
||||
useSessionStore.getState().releaseAgentTimeline(input.serverId, agentId);
|
||||
}
|
||||
};
|
||||
// Archiving an agent or its workspace reaches this host as the agent leaving the active list.
|
||||
let observedSession = useSessionStore.getState().sessions[input.serverId];
|
||||
const stopObservingArchive = useSessionStore.subscribe((state) => {
|
||||
const session = state.sessions[input.serverId];
|
||||
const changed =
|
||||
session?.agents !== observedSession?.agents ||
|
||||
session?.agentDetails !== observedSession?.agentDetails ||
|
||||
session?.hasHydratedAgents !== observedSession?.hasHydratedAgents ||
|
||||
session?.workspaces !== observedSession?.workspaces ||
|
||||
session?.hasHydratedWorkspaces !== observedSession?.hasHydratedWorkspaces;
|
||||
observedSession = session;
|
||||
if (!changed) return;
|
||||
sync.archiveChanged();
|
||||
releaseHiddenArchivedTimelines();
|
||||
});
|
||||
return {
|
||||
...sync,
|
||||
replaceVisibleAgentIds(sourceId, agentIds) {
|
||||
sync.replaceVisibleAgentIds(sourceId, agentIds);
|
||||
releaseHiddenArchivedTimelines();
|
||||
},
|
||||
applyTimelineResponse(receivedPayload) {
|
||||
if (retirements.servedBefore(receivedPayload)) return "stale";
|
||||
retirements.notePage(receivedPayload);
|
||||
// A read that answers after its archived chat was released must not bring it back.
|
||||
if (!isResident(receivedPayload.agentId)) return;
|
||||
const payload = consumeForcedTimelineTailReplacement(receivedPayload, forcedTailReplacements);
|
||||
const accepted = applyAuthoritativeTimelineResponse({
|
||||
serverId: input.serverId,
|
||||
@@ -573,12 +587,9 @@ export function createViewedTimelineOwner(input: {
|
||||
drainQueuedAgentMessage: input.drainQueuedAgentMessage,
|
||||
});
|
||||
if (accepted) input.replica.timelineUpdated(payload.agentId);
|
||||
return "applied";
|
||||
},
|
||||
applyStreamEvent(agentId, event) {
|
||||
if (event.event.type === "rewind" && event.epoch !== undefined && event.seq !== undefined) {
|
||||
retirements.note(agentId, { epoch: event.epoch, seq: event.seq });
|
||||
}
|
||||
if (!isResident(agentId)) return;
|
||||
streamQueue.enqueue(agentId, event);
|
||||
const turnLiveness = deriveAgentStreamTurnLiveness([event]);
|
||||
if (turnLiveness.length === 0) return;
|
||||
@@ -590,12 +601,38 @@ export function createViewedTimelineOwner(input: {
|
||||
streamQueue.flushAgent(agentId);
|
||||
},
|
||||
dispose() {
|
||||
stopObservingArchive();
|
||||
streamQueue.dispose({ flush: true });
|
||||
sync.dispose();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* An agent is archived once the hydrated active list lacks it, its row carries an archive
|
||||
* timestamp, or the hydrated workspace list lacks its workspace. Workspace archive can leave
|
||||
* an agent row without a timestamp. Until a list hydrates, it rules nothing out.
|
||||
*/
|
||||
function isAgentArchived(session: SessionState | undefined, agentId: string): boolean {
|
||||
if (!session?.hasHydratedAgents) return false;
|
||||
const agent = session.agents.get(agentId) ?? session.agentDetails.get(agentId);
|
||||
if (!agent || agent.archivedAt != null) return true;
|
||||
return (
|
||||
session.hasHydratedWorkspaces &&
|
||||
agent.workspaceId !== undefined &&
|
||||
!session.workspaces.has(agent.workspaceId)
|
||||
);
|
||||
}
|
||||
|
||||
function selectResidentTimelineAgentIds(session: SessionState): Set<string> {
|
||||
return new Set([
|
||||
...session.agentStreamTail.keys(),
|
||||
...session.agentStreamHead.keys(),
|
||||
...session.agentTimelineCursor.keys(),
|
||||
...session.agentAuthoritativeHistoryApplied.keys(),
|
||||
]);
|
||||
}
|
||||
|
||||
const MAX_HIDDEN_CATCH_UPS = 2;
|
||||
|
||||
type CatchUpStatus = "running" | "complete" | "error";
|
||||
@@ -659,7 +696,7 @@ function sameAgentIds(left: string[], right: string[]): boolean {
|
||||
return left.length === right.length && left.every((agentId, index) => agentId === right[index]);
|
||||
}
|
||||
|
||||
export function createViewedTimelineSync(ports: ViewedTimelineSyncPorts): ViewedTimelineSync {
|
||||
export function createViewedTimelineSync(ports: ViewedTimelineSyncPorts): ViewedTimelineMembership {
|
||||
const sources = new Map<string, string[]>();
|
||||
const catchUps = new Map<string, CatchUpState>();
|
||||
const catchUpGenerations = new Map<string, number>();
|
||||
@@ -839,10 +876,12 @@ export function createViewedTimelineSync(ports: ViewedTimelineSyncPorts): Viewed
|
||||
|
||||
const ensureCacheLoaded = (agentId: string): void => {
|
||||
if (loadedCache.has(agentId) || cacheLoads.has(agentId)) return;
|
||||
const load = ports
|
||||
const load: Promise<void> = ports
|
||||
.prepare(agentId)
|
||||
.catch((error) => ports.reportError(error))
|
||||
.finally(() => {
|
||||
// A released chat forgot this load; showing it again starts its own.
|
||||
if (cacheLoads.get(agentId) !== load) return;
|
||||
cacheLoads.delete(agentId);
|
||||
loadedCache.add(agentId);
|
||||
const pending = pendingCatchUps.get(agentId);
|
||||
@@ -1130,10 +1169,29 @@ export function createViewedTimelineSync(ports: ViewedTimelineSyncPorts): Viewed
|
||||
};
|
||||
|
||||
const publishVisibleMembership = () => {
|
||||
commitDesiredMembership(normalizeAgentIds([...openedAgentIds, ...visibleAgentIds()]));
|
||||
const visible = visibleAgentIds();
|
||||
const kept = openedAgentIds.filter(
|
||||
(agentId) => visible.includes(agentId) || !ports.isArchived(agentId),
|
||||
);
|
||||
if (kept.length !== openedAgentIds.length) {
|
||||
for (const agentId of openedAgentIds) {
|
||||
if (kept.includes(agentId)) continue;
|
||||
loadedCache.delete(agentId);
|
||||
cacheLoads.delete(agentId);
|
||||
}
|
||||
openedAgentIds = kept;
|
||||
}
|
||||
commitDesiredMembership(normalizeAgentIds([...openedAgentIds, ...visible]));
|
||||
};
|
||||
|
||||
return {
|
||||
isVisible(agentId) {
|
||||
for (const agentIds of sources.values()) if (agentIds.includes(agentId)) return true;
|
||||
return false;
|
||||
},
|
||||
archiveChanged() {
|
||||
publishVisibleMembership();
|
||||
},
|
||||
subscribe(listener) {
|
||||
listeners.add(listener);
|
||||
return () => listeners.delete(listener);
|
||||
|
||||
@@ -1009,7 +1009,7 @@ describe("stream reducer canonical tool calls", () => {
|
||||
});
|
||||
|
||||
it("keeps the timeline position on the whole assistant message", () => {
|
||||
const timelineCursor = { epoch: "epoch-1", seq: 42, anchorSeq: 42 };
|
||||
const timelineCursor = { epoch: "epoch-1", seq: 42 };
|
||||
const result = applyStreamEvent({
|
||||
tail: [],
|
||||
head: [],
|
||||
@@ -1890,7 +1890,7 @@ describe("turn lifecycle events", () => {
|
||||
new Date("2025-01-01T15:03:11Z"),
|
||||
{
|
||||
source: "canonical",
|
||||
timelineCursor: { epoch: "epoch-1", seq: 42, anchorSeq: 42 },
|
||||
timelineCursor: { epoch: "epoch-1", seq: 42 },
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1902,11 +1902,7 @@ describe("turn lifecycle events", () => {
|
||||
assert.strictEqual(userMessage.messageId, "provider-owned-canonical");
|
||||
assert.strictEqual(userMessage.text, "Analyze this");
|
||||
assert.strictEqual(userMessage.timestamp.getTime(), submittedTimestamp.getTime());
|
||||
assert.deepStrictEqual(userMessage.timelineCursor, {
|
||||
epoch: "epoch-1",
|
||||
seq: 42,
|
||||
anchorSeq: 42,
|
||||
});
|
||||
assert.deepStrictEqual(userMessage.timelineCursor, { epoch: "epoch-1", seq: 42 });
|
||||
assert.deepStrictEqual(userMessage.images, [image]);
|
||||
assert.deepStrictEqual(userMessage.attachments, [attachment]);
|
||||
});
|
||||
|
||||
@@ -266,7 +266,7 @@ function produceUserMessage(
|
||||
...presentation,
|
||||
clientMessageId: incoming.clientMessageId ?? existing.clientMessageId,
|
||||
messageId: incoming.messageId ?? existing.messageId,
|
||||
...advanceTimelinePosition(existing.timelineCursor, incoming.timelineCursor),
|
||||
timelineCursor: incoming.timelineCursor ?? existing.timelineCursor,
|
||||
});
|
||||
if (
|
||||
existing.id === merged.id &&
|
||||
@@ -482,7 +482,7 @@ function mergeRetainedLifecycleItem(tail: StreamItem[], retained: StreamItem): S
|
||||
const next = [...tail];
|
||||
next[tailIndex] = {
|
||||
...existing,
|
||||
...advanceTimelinePosition(existing.timelineCursor, retained.timelineCursor),
|
||||
timelineCursor: retained.timelineCursor,
|
||||
timestamp: retained.timestamp,
|
||||
items: retained.items,
|
||||
};
|
||||
@@ -499,7 +499,7 @@ function mergeRetainedLifecycleItem(tail: StreamItem[], retained: StreamItem): S
|
||||
const next = [...tail];
|
||||
next[tailIndex] = {
|
||||
...existing,
|
||||
...advanceTimelinePosition(existing.timelineCursor, retained.timelineCursor),
|
||||
timelineCursor: retained.timelineCursor,
|
||||
status: "completed",
|
||||
trigger: retained.trigger ?? existing.trigger,
|
||||
preTokens: retained.preTokens ?? existing.preTokens,
|
||||
@@ -519,10 +519,7 @@ function replaceTimelineIdentityItem(
|
||||
const existing = items[index];
|
||||
if (index < 0 || !existing || existing.kind !== "plugin") return null;
|
||||
const next = [...items];
|
||||
next[index] = {
|
||||
...retained,
|
||||
...advanceTimelinePosition(existing.timelineCursor, retained.timelineCursor),
|
||||
};
|
||||
next[index] = retained;
|
||||
return next;
|
||||
}
|
||||
|
||||
@@ -613,11 +610,7 @@ function preserveReplacementHead(
|
||||
: `${tailAssistant.text}${liveAssistant.text}`;
|
||||
const head = [
|
||||
...unreconciledHead.slice(0, liveAssistantIndex),
|
||||
{
|
||||
...liveAssistant,
|
||||
text,
|
||||
...advanceTimelinePosition(tailAssistant.timelineCursor, liveAssistant.timelineCursor),
|
||||
},
|
||||
{ ...liveAssistant, text },
|
||||
...unreconciledHead.slice(liveAssistantIndex + 1),
|
||||
];
|
||||
return {
|
||||
@@ -632,13 +625,7 @@ function preserveReplacementHead(
|
||||
|
||||
const head = [
|
||||
...unreconciledHead.slice(0, liveAssistantIndex),
|
||||
{
|
||||
...liveAssistant,
|
||||
text: tailAssistant.text,
|
||||
...(liveAssistant.timelineCursor
|
||||
? advanceTimelinePosition(tailAssistant.timelineCursor, liveAssistant.timelineCursor)
|
||||
: {}),
|
||||
},
|
||||
{ ...liveAssistant, text: tailAssistant.text },
|
||||
...unreconciledHead.slice(liveAssistantIndex + 1),
|
||||
];
|
||||
return {
|
||||
@@ -737,27 +724,7 @@ export interface AssistantMessageItem {
|
||||
|
||||
export interface TimelinePosition {
|
||||
epoch: string;
|
||||
/** The latest seq that changed this row. */
|
||||
seq: number;
|
||||
/** The seq the row started at. Updates never move it; rewinds retire rows by it. */
|
||||
anchorSeq: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* The position of a row after an update: it moves to the update's seq and stays anchored where it
|
||||
* started. Without an incoming position the row keeps the one it has.
|
||||
*/
|
||||
export function advanceTimelinePosition(
|
||||
existing: TimelinePosition | undefined,
|
||||
incoming: TimelinePosition | undefined,
|
||||
): { timelineCursor?: TimelinePosition } {
|
||||
if (!incoming) return existing ? { timelineCursor: existing } : {};
|
||||
if (!existing || existing.epoch !== incoming.epoch) return { timelineCursor: incoming };
|
||||
const anchorSeq = Math.min(existing.anchorSeq, incoming.anchorSeq);
|
||||
if (existing.seq === incoming.seq && existing.anchorSeq === anchorSeq) {
|
||||
return { timelineCursor: existing };
|
||||
}
|
||||
return { timelineCursor: { ...incoming, anchorSeq } };
|
||||
}
|
||||
|
||||
export type ThoughtStatus = "loading" | "ready";
|
||||
@@ -1016,7 +983,7 @@ function appendAssistantMessage(
|
||||
...last,
|
||||
text: `${last.text}${chunk}`,
|
||||
timestamp,
|
||||
...advanceTimelinePosition(last.timelineCursor, timelineCursor),
|
||||
...(timelineCursor ? { timelineCursor } : {}),
|
||||
};
|
||||
return [...state.slice(0, -1), updated];
|
||||
}
|
||||
@@ -1034,7 +1001,7 @@ function appendAssistantMessage(
|
||||
...secondLast,
|
||||
text: `${secondLast.text}${chunk}`,
|
||||
timestamp,
|
||||
...advanceTimelinePosition(secondLast.timelineCursor, timelineCursor),
|
||||
...(timelineCursor ? { timelineCursor } : {}),
|
||||
};
|
||||
return [...state.slice(0, -2), updated, last];
|
||||
}
|
||||
@@ -1072,7 +1039,7 @@ function appendThought(
|
||||
if (last && last.kind === "thought" && last.turnId === turnId) {
|
||||
const updated: ThoughtItem = {
|
||||
...last,
|
||||
...advanceTimelinePosition(last.timelineCursor, timelineCursor),
|
||||
...(timelineCursor ? { timelineCursor } : {}),
|
||||
text: `${last.text}${chunk}`,
|
||||
timestamp,
|
||||
status: "loading",
|
||||
@@ -1252,7 +1219,7 @@ export function mergeAgentToolCallItem(
|
||||
|
||||
return {
|
||||
...existing,
|
||||
...advanceTimelinePosition(existing.timelineCursor, timelineCursor),
|
||||
...(timelineCursor ? { timelineCursor } : {}),
|
||||
timestamp,
|
||||
payload: {
|
||||
source: "agent",
|
||||
@@ -1358,11 +1325,7 @@ function appendPluginTimelineItem(
|
||||
const existing = state[existingIndex];
|
||||
if (!existing || existing.kind !== "plugin") return state;
|
||||
const next = [...state];
|
||||
next[existingIndex] = {
|
||||
...nextItem,
|
||||
id: existing.id,
|
||||
...advanceTimelinePosition(existing.timelineCursor, timelineCursor),
|
||||
};
|
||||
next[existingIndex] = { ...nextItem, id: existing.id };
|
||||
return next;
|
||||
}
|
||||
|
||||
@@ -1393,7 +1356,7 @@ function appendTodoList(
|
||||
const next = [...state];
|
||||
next[previousIndex] = {
|
||||
...previous,
|
||||
...advanceTimelinePosition(previous.timelineCursor, timelineCursor),
|
||||
...(timelineCursor ? { timelineCursor } : {}),
|
||||
items: normalizedItems,
|
||||
timestamp,
|
||||
};
|
||||
@@ -1412,7 +1375,7 @@ function appendTodoList(
|
||||
const next = [...state];
|
||||
next[next.length - 1] = {
|
||||
...lastItem,
|
||||
...advanceTimelinePosition(lastItem.timelineCursor, timelineCursor),
|
||||
...(timelineCursor ? { timelineCursor } : {}),
|
||||
items: normalizedItems,
|
||||
activity: { type: "created", count: normalizedItems.length },
|
||||
timestamp,
|
||||
@@ -1557,7 +1520,7 @@ function reduceTimelineCompaction(
|
||||
if (loadingIdx >= 0 && existing && existing.kind === "compaction") {
|
||||
const updated: CompactionItem = {
|
||||
...existing,
|
||||
...advanceTimelinePosition(existing.timelineCursor, timelineCursor),
|
||||
...(timelineCursor ? { timelineCursor } : {}),
|
||||
status: "completed",
|
||||
trigger: item.trigger ?? existing.trigger,
|
||||
preTokens: item.preTokens ?? existing.preTokens,
|
||||
@@ -1682,10 +1645,7 @@ export function reduceStreamUpdate(
|
||||
),
|
||||
event,
|
||||
);
|
||||
const stamped = event.turnMetrics?.length
|
||||
? stampCompletedTurnMetrics(updated, event.turnMetrics, event.turnId)
|
||||
: updated;
|
||||
return event.item.type === "reasoning" ? stamped : finalizeActiveThoughts(stamped);
|
||||
return event.item.type === "reasoning" ? updated : finalizeActiveThoughts(updated);
|
||||
}
|
||||
case "turn_completed":
|
||||
return stampCompletedTurnMetrics(finalizeActiveThoughts(state), event.metrics, event.turnId);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user