Compare commits

...
Author SHA1 Message Date
Mohamed Boudra b4af508e2a chore(release): cut 0.10.3 2026-10-02 14:10:43 +02:00
Mohamed Boudra d75fa81e93 docs(changelog): add 0.10.3 release notes 2026-10-02 13:45:36 +02:00
Mohamed Boudra 21cfd75222 Keep native dialogs and sheets usable when stacked (#5772)
* fix(app): stack adaptive sheets across native presentations

Root-owned dialogs could not present over a sibling native dialog on iOS. Use the existing app-wide sheet stack for both native presentation forms, and release the underlying keyboard when a new sheet opens.

* test(app): verify pairing sheet autofocus

* docs(app): clarify stacked sheet journey prerequisites

(cherry picked from commit 318a84a570)
2026-10-02 13:43:39 +02:00
Mohamed Boudra 3834773414 Add confirmation for new hosts (#5753)
* Add confirmation for new hosts

Opening a pairing link (an `#offer=` URL, a scanned QR code, or a pasted
link) now asks the user to confirm before the host is added or connected.
The prompt shows the host id, its key fingerprint, and the relay. Cancel
leaves no new host and no connection.

The host runtime owns the check: `upsertConnectionFromOfferUrl` and
`probeAndUpsertConnectionFromOfferUrl` ask a registered confirmer before
doing anything. `HostTrustPromptModal`, mounted at the app root, registers
the confirmer and renders the prompt with the shared confirm sheet. Without
a registered confirmer, pairing links are declined.

Adds a test that an offer link with the confirmation declined adds no host
and attempts no connection.

* Only ask for new hosts or changed connections

A pairing link now connects without the confirmation when it matches a
saved host exactly (same server id, key and relay). It still asks for a new
host, and for a saved host whose key or relay differs from what is saved,
with the "This link changes how you connect to this host" text.

After the user approves a link that then needs a password, the password
retry no longer asks again. The approval is an `OfferApproval` owned by one
pairing flow (one QR scan, or one open pair-link or add-host modal) and
only covers the exact offer that was approved.

Adds tests for a matching saved host, a changed key or relay, and the
password retry.

* Move host confirmation into the host runtime

The host runtime now owns the pending host confirmation and the decision to
ask. The sheet reads the pending confirmation and sends the answer; nothing
registers into a module variable.

A pairing flow is a LinkPairing the runtime hands out, so the password retry
for a confirmed link doesn't ask again without views creating or resetting
approval objects. Cancel is a result instead of an error. Pairing waits for
saved hosts to load before deciding whether to ask.

* Stop QR scanning after an attempt ends

The scan screen now keeps its workflow in a small model. When the user
cancels the host confirmation, closes the password prompt, or the attempt
fails, scanning stops until they tap Scan QR code again. Before, the code
still in front of the camera started a new attempt on the next frame.

A host confirmation answer is now tied to the request it answers, so a tap
on one sheet never answers a newer one. Relay hosts can no longer be added
through HostMutations without the confirmation, the add-host modal drops
the reset its per-open mount made redundant, and the fingerprint comment
says what the shortened form shows.

(cherry picked from commit 364e6456e0)
2026-10-02 13:39:09 +02:00
Mohamed Boudra 919c737c19 chore(release): cut 0.10.2 2026-09-30 01:13:57 +02:00
Mohamed Boudra c5b4b7bae3 docs(changelog): add 0.10.2 release notes 2026-09-30 01:09:50 +02:00
paseo-bot[bot] 81fc6134a9 fix(opencode): fill the context meter during v2 turns (#5710)
OpenCode v2 sessions never reported context used or the model's context
limit, so the composer meter was an empty ring during a turn and vanished
when it ended. Each finished step now reports its context against the
selected model's limit.

Closes #5701

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Matt Cowger <matt@cowger.us>
(cherry picked from commit d3c902e9fa)
2026-09-30 00:33:59 +02:00
paseo-bot[bot] 9744da6e4f fix(opencode): show v2 patch edits as edit diffs (#5696)
OpenCode 2 reports GPT models' apply_patch tool calls under the name
patch. The OpenCode tool-call parser only recognized apply_patch, so
these calls fell through to an unknown tool card with the raw patch
text. Map patch payloads the same way as apply_patch.

Closes #5643

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
(cherry picked from commit 5764863f63)
2026-09-30 00:33:59 +02:00
paseo-bot[bot] 86df0587ba fix(opencode): show the question text and typed answer in v2 question cards (#5679)
OpenCode v2 sends each question as a form field whose title is the short
header, whose description is the question, and whose custom flag allows a
typed answer. The mapper used the field key as the header and the title as
the question, and dropped custom, so the card showed only the header and
had no answer field.

Closes #5667

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
(cherry picked from commit 2838922ade)
2026-09-30 00:33:59 +02:00
Mohamed Boudra e26eb483e2 fix(opencode): keep long v2 turns alive until execution completes (#5674)
The long-lived session wait hit Node’s headers timeout while OpenCode kept working. Reconcile execution events against active state and the durable log so transport observation failures do not fail healthy turns, including across event gaps and reconnects.

(cherry picked from commit be2fb1cab9)
2026-09-30 00:33:59 +02:00
paseo-bot[bot] ee89f4917f fix(opencode): keep v2 edit text in completed edit details (#5609)
OpenCode v2's edit tool takes `path` instead of `filePath`, so the
OpenCode edit schema missed it and the shared fallback dropped the
camelCase oldString/newString. Completed edits reached the timeline as
{type: "edit", filePath} with nothing to diff.

Closes #5607

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
(cherry picked from commit d91171954b)
2026-09-30 00:33:59 +02:00
Mohamed Boudra c5236c00d8 chore(release): cut 0.10.1 2026-09-29 00:06:23 +02:00
Mohamed Boudra d1443064db docs(changelog): add 0.10.1 release notes 2026-09-29 00:03:24 +02:00
Mohamed Boudra 9f387873b0 fix(opencode): clear unsupported thinking when changing models (#5587)
Resolve retained variants against the destination model before applying a model change. Publish the effective thinking choice and refresh the provider resume handle immediately so a reload cannot restore the old selection.

(cherry picked from commit 940dbfd242)
2026-09-28 23:37:09 +02:00
Qi 12cd5345d2 feat(claude): add Sonnet 5.5 with its model capabilities (#5583)
Claude Code 2.1.284 introduces Sonnet 5.5 with a native 1M context
window, medium default effort, and adaptive thinking that cannot be
turned off, so it takes the same shape as Opus 5.5 in the manifest.

Sonnet 5.5 rejects `thinking: {"type": "disabled"}` with a 400, so its
entry omits supportsThinkingDisabled and its thinking options have no
off. It also takes the Sonnet family tagline, which moves Sonnet 5 to
Previous release.

The catalog gates the entry on Claude Code 2.1.284, the version that
recognizes the model, so older installs keep their current catalog.
The existing major-minor runtime matching already resolves dashed
gateway IDs such as us.anthropic.claude-sonnet-5-5-20260928-v1:0 to
the new entry without collapsing them onto Sonnet 5.

(cherry picked from commit 4340607093)
2026-09-28 23:36:50 +02:00
paseo-bot[bot] 2c6d4e5283 fix(app): keep line breaks in streamed replies when a chunk ends in indentation (#5577)
While a reply streams, presentation reparses only the growing last Markdown
block: the cached block text plus the new chunk. splitMarkdownBlocks drops a
trailing whitespace-only line, and only trailing "\n"s were added back, so a
reply that paused on "]\n   " cached the block as "]". The next chunk " B -->"
then continued the previous line, joining two lines of a code block. Codex
streams a line break and the next line's indent as separate deltas, so its
Mermaid diagrams hit this and failed to render. History reparses the whole
text, which is why a reload showed the reply correctly.

Keep every trailing blank line the split drops on the last block.

Closes #5456

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
(cherry picked from commit f4ba16a0b3)
2026-09-28 23:36:50 +02:00
paseo-bot[bot] 006bae2897 Archive a custom Codex provider's session when its agent is archived (#5572)
A provider that extends Codex runs through the registry's client wrapper,
which forwarded session listing and import but not native archive or
unarchive. Archiving such an agent left its Codex thread unarchived, so
the session stayed in Import session and could be imported again. The
wrapper now forwards both, the same as stock Codex.

Closes #5454

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
(cherry picked from commit 9d010211a2)
2026-09-28 23:36:50 +02:00
Mohamed Boudra 437aef1a7b Show Windows file links relative to their workspace (#1987)
* fix(app): show Windows file links relative to workspace

Tooltip formatting only handled matching POSIX separators, so Windows paths could remain absolute. Reuse the workspace file-path resolver for normalized relative paths.

* fix(app): preserve workspace-root link tooltips

Workspace file resolution deliberately rejects the root as an openable file, so tooltip formatting preserves its display-only dot form separately.

* fix(app): share workspace path rules for file link tooltips

(cherry picked from commit cf4509631b)
2026-09-28 23:36:50 +02:00
paseo-bot[bot] b44e7b0b90 Open a subagent in the split pane it was opened from (#5451)
* fix(app): open a subagent in the pane it was opened from

Opening a subagent from an agent's composer placed the new tab in the
focused pane. Clicking the subagent row does not focus its pane, so in a
split view the subagent landed in whichever pane last had focus.

Place an implicit main-location open that has a parent tab in that tab's
pane.

Refs #5433

* test(app): cover subagent split-pane placement in browser

* test(app): use browser repro for subagent pane placement

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
(cherry picked from commit 7bb7d4ed08)
2026-09-28 23:36:50 +02:00
paseo-bot[bot] 09f87df1b2 Report a background send_agent_prompt's started turn as running (#5386)
* Report a background send_agent_prompt's started turn as running

The background branch read the target's status right after dispatch,
before the provider acknowledged the turn, so an idle target read as
idle. Wait for the run to start first, as create_agent and the app's
send path already do.

* Check the caller still gets the finish notification after a background send

* Acknowledge the held turn start explicitly in the send_agent_prompt test

* Cover immediate completion after background turn start

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
(cherry picked from commit 8de52a3c99)
2026-09-28 23:36:50 +02:00
paseo-bot[bot] b013e0d428 fix(codex): read custom prompts from the provider's own CODEX_HOME (#5450)
A provider that extends codex and sets CODEX_HOME in its env runs Codex
against that home, but the daemon listed, expanded, and fell back to
skills from its own CODEX_HOME or ~/.codex. The / menu offered another
home's prompts and never the provider's own, and invoking one of the
provider's prompts sent the raw slash text to Codex.

Resolve the Codex home from the same environment the app-server is
launched with, and give it to the session.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
(cherry picked from commit dffde6ae8b)
2026-09-28 23:36:50 +02:00
paseo-bot[bot] c938e1cf44 Show the Cursor icon for terminal profiles that run cursor-agent (#5379)
* Show the Cursor icon for terminal profiles that run cursor-agent

The Cursor CLI binary is cursor-agent, so a profile created in settings
with that command matched no known icon and fell back to the generic
terminal icon. Map cursor-agent to the cursor icon while keeping
command matching exact.

Closes #4702

* Verify Cursor terminal profile icons in real browser

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
(cherry picked from commit a43c8d888f)
2026-09-28 23:36:50 +02:00
paseo-bot[bot] 0c18144967 Keep a custom Codex provider and Paseo tools after rewinding
Rewound Codex forks receive the same provider and runtime MCP config as thread start and resume. Covers paginated and legacy rewind paths.\n\nCloses #4542\nCloses #3205\n\nCo-authored-by: zbaibg <zbai29@wisc.edu>

(cherry picked from commit 827178df90)
2026-09-28 23:36:50 +02:00
Mohamed Boudra c481ecf3e1 chore(release): cut 0.10.0 2026-09-28 14:27:01 +02:00
Mohamed Boudra dfc9add774 docs: collapse 0.10.0 changelog for stable 2026-09-28 14:05:14 +02:00
Grisha SzepandMohamed Boudra da48803a43 fix(opencode): restore complete session environments on connection (#5526)
* fix(opencode): restore complete session environments on connection

* fix(opencode): use the shared provider environment policy

---------

Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
2026-09-28 12:55:21 +01:00
Mohamed Boudra 7f5d32cdd5 website: add Paseo vs Orca alternative page (#5537) 2026-09-28 12:05:17 +01:00
Mohamed Boudra dec2d861ec Add a Philosophy section to the homepage (#5538)
* feat(website): add Philosophy section to homepage

* feat(website): reshape Philosophy section to the homepage's FeatureSection pattern
2026-09-28 12:04:15 +01:00
paseo-ai[bot] 30178c4f58 fix: update lockfile signatures and Nix hash [skip ci] 2026-09-27 12:01:37 +00:00
Mohamed Boudra 52d345db7f chore(release): cut 0.10.0-beta.1 2026-09-27 13:51:11 +02:00
Mohamed Boudra a50a476009 docs: add 0.10.0-beta.1 changelog 2026-09-27 13:48:06 +02:00
Mohamed Boudra 6ca001c3e4 chore: normalize package-lock ordering for release 2026-09-27 13:48:04 +02:00
Mohamed Boudra 78a0f093eb fix(opencode): recover v2 chats after helper exit (#5488)
* fix(opencode): reconnect v2 sessions after helper exits

A helper exit aborted the session lifetime, so every later prompt failed even though OpenCode can serve the same native session from another helper. Keep the session open, fail the active turn, and acquire and configure the current helper on the next OpenCode operation.

* fix(opencode): forget exited v2 helper generation

A dead shared helper could remain selected as the current generation. Clear that selection at exit so the first lazy reconnect acquires a live helper.
2026-09-27 13:25:49 +02:00
Mohamed Boudra d7b7016cc9 feat(settings): polish navigation and controls (#5459)
* feat(settings): polish navigation and controls

* test(settings): update navigation assertions
2026-09-26 20:26:04 +02:00
134 changed files with 5118 additions and 1393 deletions
+77
View File
@@ -1,5 +1,82 @@
# Changelog
## 0.10.3 - 2026-10-02
### Added
- Added a confirmation before a pairing link connects to a new host or to a saved host whose key or relay changed ([#5753](https://github.com/getpaseo/paseo/pull/5753))
## 0.10.2 - 2026-09-30
### Fixed
- Fixed OpenCode v2 turns longer than five minutes failing with `UND_ERR_HEADERS_TIMEOUT` ([#5674](https://github.com/getpaseo/paseo/pull/5674))
- Fixed the context meter staying empty during OpenCode v2 turns and disappearing after them ([#5710](https://github.com/getpaseo/paseo/pull/5710) by [@mcowger](https://github.com/mcowger))
- Fixed OpenCode v2 question cards showing only the header and offering no typed answer ([#5679](https://github.com/getpaseo/paseo/pull/5679))
- Fixed OpenCode v2 patch edits from GPT models showing as a raw Patch card instead of an edit diff ([#5696](https://github.com/getpaseo/paseo/pull/5696))
- Fixed completed OpenCode v2 edits showing no diff ([#5609](https://github.com/getpaseo/paseo/pull/5609))
## 0.10.1 - 2026-09-29
### Added
- Added Claude Sonnet 5.5 for Claude Code 2.1.284 and newer ([#5583](https://github.com/getpaseo/paseo/pull/5583) by [@yangqi](https://github.com/yangqi))
### Fixed
- Fixed OpenCode chats failing with "Variant unavailable" after switching to a model without the selected thinking level ([#5587](https://github.com/getpaseo/paseo/pull/5587))
- Fixed rewinding a Codex chat dropping its custom provider and Paseo tools ([#5345](https://github.com/getpaseo/paseo/pull/5345) by [@zbaibg](https://github.com/zbaibg))
- Fixed streamed replies joining lines of code blocks and Mermaid diagrams until the chat reloads ([#5577](https://github.com/getpaseo/paseo/pull/5577))
- Fixed a subagent opened from a split pane opening in a different pane ([#5451](https://github.com/getpaseo/paseo/pull/5451))
- Fixed archiving a custom Codex provider's agent leaving its session in Import session ([#5572](https://github.com/getpaseo/paseo/pull/5572))
- Fixed the `/` menu of a custom Codex provider with its own `CODEX_HOME` listing the daemon's prompts instead of its own ([#5450](https://github.com/getpaseo/paseo/pull/5450))
- Fixed a background `send_agent_prompt` returning `idle` for a prompt the agent accepted ([#5386](https://github.com/getpaseo/paseo/pull/5386))
- Fixed Windows file-link tooltips showing the full path for files inside the workspace ([#1987](https://github.com/getpaseo/paseo/pull/1987))
- Fixed terminal profiles that run `cursor-agent` showing the generic terminal icon ([#5379](https://github.com/getpaseo/paseo/pull/5379))
## 0.10.0 - 2026-09-28
### Added
- Added OpenCode v2 support, selected automatically from the installed `opencode` version ([#5198](https://github.com/getpaseo/paseo/pull/5198), [#5526](https://github.com/getpaseo/paseo/pull/5526) by [@karrots](https://github.com/karrots), [@dsingal0](https://github.com/dsingal0), [@gszep](https://github.com/gszep))
- Added task lists from rpiv-todo, pi-goal-x, and Pi's example todo extension to Pi chats ([#5309](https://github.com/getpaseo/paseo/pull/5309))
- Added subagent runs from pi-subagents, Tintinweb pi-subagents, and Gotgenes pi-subagents to the Subagents track ([#5309](https://github.com/getpaseo/paseo/pull/5309))
- Added rpiv-ask-user-question dialogs to Pi chats as one question form ([#5309](https://github.com/getpaseo/paseo/pull/5309))
- Added password checks to relay connections, rejecting an incorrect daemon password; a follow-up release will require the password ([#5393](https://github.com/getpaseo/paseo/pull/5393))
- Added a password field to Add host, pairing links, and QR pairing for password-protected daemons ([#5393](https://github.com/getpaseo/paseo/pull/5393))
- Added `relay://` connection strings to `paseo daemon pair` ([#5393](https://github.com/getpaseo/paseo/pull/5393))
- Added OMP Ask option descriptions to question cards on OMP 17.4.2 and newer ([#3628](https://github.com/getpaseo/paseo/pull/3628) by [@joeshull](https://github.com/joeshull))
### Changed
- Changed the CLI and desktop app to connect to a password-protected daemon on the same machine without asking for the password ([#5393](https://github.com/getpaseo/paseo/pull/5393))
- Changed a host rejected for its password to show "Password required" or "Incorrect password" on the host and Connections pages ([#5393](https://github.com/getpaseo/paseo/pull/5393))
- Reorganized Settings into General, Sidebar, Chat, Terminal, Browser, and Open location pages ([#5459](https://github.com/getpaseo/paseo/pull/5459))
### Fixed
- Fixed direct connections failing when the daemon password contains spaces or characters such as `@` or `/` ([#5393](https://github.com/getpaseo/paseo/pull/5393))
- Fixed existing OpenCode agents failing with `ECONNREFUSED` after the OpenCode server restarts ([#5338](https://github.com/getpaseo/paseo/pull/5338))
- Fixed messages OpenCode adds on its own appearing in the chat as if the user typed them ([#5434](https://github.com/getpaseo/paseo/pull/5434))
- Fixed the daemon stopping when `daemon.log` cannot be written, such as on a full disk ([#5445](https://github.com/getpaseo/paseo/pull/5445))
- Fixed the daemon crashing when opening an archived ACP agent whose worktree was removed ([#5439](https://github.com/getpaseo/paseo/pull/5439) by [@qinkangdeid](https://github.com/qinkangdeid))
- Fixed existing workspaces missing from the sidebar after the app starts, including after later restarts ([#5394](https://github.com/getpaseo/paseo/pull/5394))
- Fixed agents on a custom Claude provider with its own `CLAUDE_CONFIG_DIR` opening with an empty chat after a daemon restart ([#5437](https://github.com/getpaseo/paseo/pull/5437))
- Fixed a custom Codex provider's sessions missing from Import session ([#5446](https://github.com/getpaseo/paseo/pull/5446))
- Fixed Update daemon and Restart in host settings failing when a provider's version check takes over 1.5s ([#5372](https://github.com/getpaseo/paseo/pull/5372))
- Fixed `paseo --host <other daemon> run` failing with "Caller agent not found" from inside an agent session ([#5392](https://github.com/getpaseo/paseo/pull/5392))
- Fixed a Pi chat rewind going back further than the picked message after an earlier rewind ([#5383](https://github.com/getpaseo/paseo/pull/5383))
- Fixed a Pi chat rewind being undone when the daemon restarts ([#5432](https://github.com/getpaseo/paseo/pull/5432))
- Fixed Pi agents started without a model ignoring Pi's configured default model ([#5343](https://github.com/getpaseo/paseo/pull/5343))
- Fixed project skills in a new agent's `/` menu staying stale after the checkout switches branches ([#5415](https://github.com/getpaseo/paseo/pull/5415))
- Fixed slash commands missing from a new agent's `/` menu on custom ACP providers ([#5411](https://github.com/getpaseo/paseo/pull/5411))
- Fixed a parent agent receiving a child's finish notification twice after prompting the running child ([#5407](https://github.com/getpaseo/paseo/pull/5407))
- Fixed a blocking `send_agent_prompt` that outlasts its 30s wait never notifying the caller when the child finishes ([#5347](https://github.com/getpaseo/paseo/pull/5347))
- Fixed OSC 8 terminal links showing a navigation prompt and opening a blank Paseo window ([#5388](https://github.com/getpaseo/paseo/pull/5388) by [@liujin0506](https://github.com/liujin0506))
- Fixed the Theme menu not scrolling when plugin themes overflow the window ([#5374](https://github.com/getpaseo/paseo/pull/5374))
- Fixed a message from today's weekday last week showing only the weekday instead of its date ([#5341](https://github.com/getpaseo/paseo/pull/5341))
- Fixed `paseo daemon set-password` exiting silently when stdin is not a terminal ([#5358](https://github.com/getpaseo/paseo/pull/5358))
## 0.9.2 - 2026-09-24
### Added
+1 -1
View File
@@ -19,7 +19,7 @@ Authoritative terminology. UI label wins. Don't invent synonyms; use what's here
- **MR** — GitLab merge request. UI label for GitLab change requests only; do not use MR for GitHub/Gitea/Forgejo.
- **Worktree** — Paseo-managed git worktree (`~/.paseo/worktrees/{name}`); also a `workspaceKind` value. User-facing creation treats it as the `worktree` workspace isolation choice. Code and `paseo.json` retain worktree terminology for git lifecycle implementation. Forbidden: "Checkout" as a product synonym.
- **Repository / Remote** — Internal Git observations. They may produce mutable kind, branch, and project-grouping metadata but never the host-local project ID, root, display name, or workspace membership. No UI label.
- **Sidebar items** — The top-level rows at the head of the app sidebar: New workspace, History, Search, Schedules, and every plugin sidebar contribution. Order and visibility are one per-device preference (`AppSettings.sidebarNavItems`); all of them may be off. UI: the "Sidebar" section on the Appearance settings page. Code: `packages/app/src/sidebar-nav/model.ts` resolves the list, and both the sidebar (`components/sidebar/sidebar-nav-rows.tsx`) and the settings section (`screens/settings/appearance/sidebar-nav-section.tsx`) read it through `useSidebarNavItems`. Never hardcode one of these rows or add a second place that decides which ones show. Don't confuse with **Explorer sidebar**.
- **Sidebar items** — The top-level rows at the head of the app sidebar: New workspace, History, Search, Schedules, and every plugin sidebar contribution. Order and visibility are one per-device preference (`AppSettings.sidebarNavItems`); all of them may be off. UI: the Sidebar settings page. Code: `packages/app/src/sidebar-nav/model.ts` resolves the list, and both the sidebar (`components/sidebar/sidebar-nav-rows.tsx`) and the settings section (`screens/settings/sidebar/sidebar-nav-section.tsx`) read it through `useSidebarNavItems`. Never hardcode one of these rows or add a second place that decides which ones show. Don't confuse with **Explorer sidebar**.
- **Explorer sidebar** — The dedicated navigation dock containing the Files and Changes trees. UI: "Explorer sidebar". Code: `packages/app/src/workspace-tabs/explorer-sidebar.ts`; persisted pane identifiers retain the `explorer` spelling. See [explorer-sidebar.md](explorer-sidebar.md).
- **Side pane** — An ordinary right-side workspace pane used for content opened beside the user's work. It closes and participates in workspace splits like every other main-host pane. See [explorer-sidebar.md](explorer-sidebar.md#side-pane). Forbidden: "Side panel".
- **Directory-backed surface** — A right-sidebar surface whose content is determined by the workspace's `cwd`, so two workspaces on the same directory see identical content: git diff/status, forge change-request info, file preview/explorer contents. Keyed by `(serverId, cwd)`, never `workspaceId`. See [architecture.md](architecture.md#right-sidebar-boundary-directory-backed-vs-workspace-owned).
+2
View File
@@ -99,6 +99,8 @@ Pi RPC extension UI dialog requests (`select`, `input`, `editor`, `confirm`) are
OpenCode adapters target v1.14.46 and v2.0.10. V2 rejects binaries older than the tested 2.0.10 SDK at runtime selection. Runtime selection uses the configured command and environment. A recognized version is cached until provider configuration reload; a failed, timed-out, or unrecognized probe retains the v1 path and retries detection on the next operation. Load v2 code and materialize its plugin only after positive v2 selection; v1 sessions remain undecorated. Keep upstream SDK types inside the version-specific adapter. OpenCode owns storage migration; a missing native session must fail resume rather than create a replacement. V2 has no native archive/unarchive operation: archiving affects Paseo only. V1 retains native archiving.
Use OpenCode v2 execution events to trigger turn completion, with active-state and durable-log reconciliation after admission, reconnect, and while a turn remains active. Do not use `session.wait`: a healthy turn exceeding Node's HTTP headers deadline produces a transport error while OpenCode keeps working. The live event feed has no replay, and shutdown interruption preserves the previous idle outcome, so the session snapshot alone cannot recover missed execution events. Quiet streams are healthy: v2 heartbeats are SSE comments, not application events.
V2.0.4 also removed the activation endpoint that gated a cold location, and a cold location registers its config-derived commands, skills, and providers asynchronously. Wait until `plugin.list` returns a populated inventory before reading the catalog or commands; an empty inventory means the location is still warming. Fail when the readiness deadline expires, including when an inventory request stalls.
Paseo installs its OpenCode tool bridge through `OPENCODE_CONFIG_CONTENT`. V1 accepts a plugin file; v2 silently skips configured files and requires a package directory with a server entry point. Both versions use the daemon's private loopback bridge for caller-scoped tools. Bridge context lives only in daemon memory and is removed when the Paseo session closes. The content-addressed plugin artifacts contain no session data or secrets. V2 also needs this plugin when native Paseo tools are disabled: its prompt API has no structured-output format, so the plugin supplies a schema-validated final-answer tool.
@@ -0,0 +1,7 @@
Added
- Added OpenCode v2 support, selected automatically from the installed opencode version
- Added task lists from rpiv-todo, pi-goal-x, and Pi's example todo extension to Pi chats
- Added subagent runs from pi-subagents, Tintinweb pi-subagents, and Gotgenes pi-subagents to the Subagents track
- Added rpiv-ask-user-question dialogs to Pi chats as one question form
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,7 @@
Added
- Added OpenCode v2 support, selected automatically from the installed opencode version
- Added task lists from rpiv-todo, pi-goal-x, and Pi's example todo extension to Pi chats
- Added subagent runs from pi-subagents, Tintinweb pi-subagents, and Gotgenes pi-subagents to the Subagents track
- Added rpiv-ask-user-question dialogs to Pi chats as one question form
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,7 @@
Added
- Added OpenCode v2 support, selected automatically from the installed opencode version
- Added task lists from rpiv-todo, pi-goal-x, and Pi's example todo extension to Pi chats
- Added subagent runs from pi-subagents, Tintinweb pi-subagents, and Gotgenes pi-subagents to the Subagents track
- Added rpiv-ask-user-question dialogs to Pi chats as one question form
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,7 @@
Added
- Added OpenCode v2 support, selected automatically from the installed opencode version
- Added task lists from rpiv-todo, pi-goal-x, and Pi's example todo extension to Pi chats
- Added subagent runs from pi-subagents, Tintinweb pi-subagents, and Gotgenes pi-subagents to the Subagents track
- Added rpiv-ask-user-question dialogs to Pi chats as one question form
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,10 @@
Added
- Added Claude Sonnet 5.5 for Claude Code 2.1.284 and newer
Fixed
- Fixed OpenCode chats failing with "Variant unavailable" after switching to a model without the selected thinking level
- Fixed rewinding a Codex chat dropping its custom provider and Paseo tools
- Fixed streamed replies joining lines of code blocks and Mermaid diagrams until the chat reloads
- Fixed a subagent opened from a split pane opening in a different pane
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,10 @@
Added
- Added Claude Sonnet 5.5 for Claude Code 2.1.284 and newer
Fixed
- Fixed OpenCode chats failing with "Variant unavailable" after switching to a model without the selected thinking level
- Fixed rewinding a Codex chat dropping its custom provider and Paseo tools
- Fixed streamed replies joining lines of code blocks and Mermaid diagrams until the chat reloads
- Fixed a subagent opened from a split pane opening in a different pane
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,10 @@
Added
- Added Claude Sonnet 5.5 for Claude Code 2.1.284 and newer
Fixed
- Fixed OpenCode chats failing with "Variant unavailable" after switching to a model without the selected thinking level
- Fixed rewinding a Codex chat dropping its custom provider and Paseo tools
- Fixed streamed replies joining lines of code blocks and Mermaid diagrams until the chat reloads
- Fixed a subagent opened from a split pane opening in a different pane
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,10 @@
Added
- Added Claude Sonnet 5.5 for Claude Code 2.1.284 and newer
Fixed
- Fixed OpenCode chats failing with "Variant unavailable" after switching to a model without the selected thinking level
- Fixed rewinding a Codex chat dropping its custom provider and Paseo tools
- Fixed streamed replies joining lines of code blocks and Mermaid diagrams until the chat reloads
- Fixed a subagent opened from a split pane opening in a different pane
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,8 @@
Fixed
- Fixed OpenCode v2 turns longer than five minutes failing with UNDERRHEADERS_TIMEOUT
- Fixed the context meter staying empty during OpenCode v2 turns and disappearing after them
- Fixed OpenCode v2 question cards showing only the header and offering no typed answer
- Fixed OpenCode v2 patch edits from GPT models showing as a raw Patch card instead of an edit diff
- Fixed completed OpenCode v2 edits showing no diff
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,8 @@
Fixed
- Fixed OpenCode v2 turns longer than five minutes failing with UNDERRHEADERS_TIMEOUT
- Fixed the context meter staying empty during OpenCode v2 turns and disappearing after them
- Fixed OpenCode v2 question cards showing only the header and offering no typed answer
- Fixed OpenCode v2 patch edits from GPT models showing as a raw Patch card instead of an edit diff
- Fixed completed OpenCode v2 edits showing no diff
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,8 @@
Fixed
- Fixed OpenCode v2 turns longer than five minutes failing with UNDERRHEADERS_TIMEOUT
- Fixed the context meter staying empty during OpenCode v2 turns and disappearing after them
- Fixed OpenCode v2 question cards showing only the header and offering no typed answer
- Fixed OpenCode v2 patch edits from GPT models showing as a raw Patch card instead of an edit diff
- Fixed completed OpenCode v2 edits showing no diff
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,8 @@
Fixed
- Fixed OpenCode v2 turns longer than five minutes failing with UNDERRHEADERS_TIMEOUT
- Fixed the context meter staying empty during OpenCode v2 turns and disappearing after them
- Fixed OpenCode v2 question cards showing only the header and offering no typed answer
- Fixed OpenCode v2 patch edits from GPT models showing as a raw Patch card instead of an edit diff
- Fixed completed OpenCode v2 edits showing no diff
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,4 @@
Added
- Added a confirmation before a pairing link connects to a new host or to a saved host whose key or relay changed
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,4 @@
Added
- Added a confirmation before a pairing link connects to a new host or to a saved host whose key or relay changed
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,4 @@
Added
- Added a confirmation before a pairing link connects to a new host or to a saved host whose key or relay changed
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,4 @@
Added
- Added a confirmation before a pairing link connects to a new host or to a saved host whose key or relay changed
Full notes: https://paseo.sh/changelog
+1 -1
View File
@@ -1 +1 @@
sha256-EU28KEISx1lV1wKSiB3npPER1g+hTMD64JuDWxDjHPE=
sha256-wHz2O/y9bAQsZVQGUMnSYbg40h5W5ogv0hg2Lq+/UrM=
+51 -51
View File
@@ -1,12 +1,12 @@
{
"name": "paseo",
"version": "0.9.2",
"version": "0.10.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "paseo",
"version": "0.9.2",
"version": "0.10.3",
"hasInstallScript": true,
"license": "Apache-2.0",
"workspaces": [
@@ -42,13 +42,6 @@
"ws": "^8.20.0"
}
},
"node_modules/7zip-bin": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/7zip-bin/-/7zip-bin-5.2.0.tgz",
"integrity": "sha512-ukTPVhqG4jNzMro2qA9HSCSSVJN3aN7tlb+hfqYCt3ER0yWroeA2VR38MNrOHLQ/cVj+DaIMad0kFCtWWowh/A==",
"dev": true,
"license": "MIT"
},
"node_modules/@0no-co/graphql.web": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@0no-co/graphql.web/-/graphql.web-1.2.0.tgz",
@@ -14390,6 +14383,13 @@
"dev": true,
"license": "BSD-2-Clause"
},
"node_modules/7zip-bin": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/7zip-bin/-/7zip-bin-5.2.0.tgz",
"integrity": "sha512-ukTPVhqG4jNzMro2qA9HSCSSVJN3aN7tlb+hfqYCt3ER0yWroeA2VR38MNrOHLQ/cVj+DaIMad0kFCtWWowh/A==",
"dev": true,
"license": "MIT"
},
"node_modules/abab": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz",
@@ -33341,6 +33341,23 @@
"node": ">=4"
}
},
"node_modules/string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dev": true,
"license": "MIT",
"dependencies": {
"safe-buffer": "~5.1.0"
}
},
"node_modules/string_decoder/node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true,
"license": "MIT"
},
"node_modules/string-length": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/string-length/-/string-length-5.0.1.tgz",
@@ -33515,23 +33532,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dev": true,
"license": "MIT",
"dependencies": {
"safe-buffer": "~5.1.0"
}
},
"node_modules/string_decoder/node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true,
"license": "MIT"
},
"node_modules/stringify-entities": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz",
@@ -36410,7 +36410,7 @@
},
"packages/app": {
"name": "@getpaseo/app",
"version": "0.9.2",
"version": "0.10.3",
"dependencies": {
"@codemirror/commands": "6.10.4",
"@codemirror/language": "6.12.4",
@@ -37476,12 +37476,12 @@
},
"packages/cli": {
"name": "@getpaseo/cli",
"version": "0.9.2",
"version": "0.10.3",
"dependencies": {
"@clack/prompts": "^1.0.0",
"@getpaseo/client": "0.9.2",
"@getpaseo/protocol": "0.9.2",
"@getpaseo/server": "0.9.2",
"@getpaseo/client": "0.10.3",
"@getpaseo/protocol": "0.10.3",
"@getpaseo/server": "0.10.3",
"chalk": "^5.3.0",
"commander": "^12.0.0",
"mime-types": "^2.1.35",
@@ -37728,10 +37728,10 @@
},
"packages/client": {
"name": "@getpaseo/client",
"version": "0.9.2",
"version": "0.10.3",
"dependencies": {
"@getpaseo/protocol": "0.9.2",
"@getpaseo/relay": "0.9.2",
"@getpaseo/protocol": "0.10.3",
"@getpaseo/relay": "0.10.3",
"zod": "^4.4.3"
},
"devDependencies": {
@@ -37742,7 +37742,7 @@
},
"packages/desktop": {
"name": "@getpaseo/desktop",
"version": "0.9.2",
"version": "0.10.3",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/cli": "*",
@@ -37986,7 +37986,7 @@
},
"packages/expo-two-way-audio": {
"name": "@getpaseo/expo-two-way-audio",
"version": "0.9.2",
"version": "0.10.3",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.5.14",
@@ -38882,7 +38882,7 @@
},
"packages/highlight": {
"name": "@getpaseo/highlight",
"version": "0.9.2",
"version": "0.10.3",
"dependencies": {
"@codemirror/language": "6.12.4",
"@codemirror/legacy-modes": "^6.5.3",
@@ -38911,14 +38911,14 @@
},
"packages/plugin": {
"name": "@getpaseo/plugin",
"version": "0.9.2",
"version": "0.10.3",
"dependencies": {
"@agentclientprotocol/sdk": "^1.4.0",
"use-sync-external-store": "^1.6.0"
},
"devDependencies": {
"@getpaseo/client": "0.9.2",
"@getpaseo/protocol": "0.9.2",
"@getpaseo/client": "0.10.3",
"@getpaseo/protocol": "0.10.3",
"@types/node": "^20.9.0",
"@types/react": "~19.2.0",
"react": "19.1.0",
@@ -38928,8 +38928,8 @@
"zod": "^4.4.3"
},
"peerDependencies": {
"@getpaseo/client": "0.9.2",
"@getpaseo/protocol": "0.9.2",
"@getpaseo/client": "0.10.3",
"@getpaseo/protocol": "0.10.3",
"react": "~19.1.0",
"react-native": ">=0.81.5",
"zod": "^4.4.3"
@@ -38951,7 +38951,7 @@
},
"packages/protocol": {
"name": "@getpaseo/protocol",
"version": "0.9.2",
"version": "0.10.3",
"dependencies": {
"semver": "^7.8.5",
"zod": "^4.4.3"
@@ -38978,7 +38978,7 @@
},
"packages/relay": {
"name": "@getpaseo/relay",
"version": "0.9.2",
"version": "0.10.3",
"dependencies": {
"base64-js": "^1.5.1",
"tweetnacl": "^1.0.3",
@@ -39196,16 +39196,16 @@
},
"packages/server": {
"name": "@getpaseo/server",
"version": "0.9.2",
"version": "0.10.3",
"dependencies": {
"@agentclientprotocol/sdk": "^0.17.1",
"@anthropic-ai/claude-agent-sdk": "0.3.246",
"@anthropic-ai/sdk": "^0.104.2",
"@getpaseo/client": "0.9.2",
"@getpaseo/highlight": "0.9.2",
"@getpaseo/plugin": "0.9.2",
"@getpaseo/protocol": "0.9.2",
"@getpaseo/relay": "0.9.2",
"@getpaseo/client": "0.10.3",
"@getpaseo/highlight": "0.10.3",
"@getpaseo/plugin": "0.10.3",
"@getpaseo/protocol": "0.10.3",
"@getpaseo/relay": "0.10.3",
"@isaacs/ttlcache": "^2.1.4",
"@modelcontextprotocol/sdk": "1.29.0",
"@opencode-ai/sdk": "1.14.46",
@@ -40110,7 +40110,7 @@
},
"packages/website": {
"name": "@getpaseo/website",
"version": "0.9.2",
"version": "0.10.3",
"dependencies": {
"@cloudflare/vite-plugin": "^1.29.1",
"@cloudflare/workers-types": "^4.20260317.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "paseo",
"version": "0.9.2",
"version": "0.10.3",
"private": true,
"description": "Paseo: voice-controlled development environment for local AI coding agents",
"keywords": [
@@ -7,7 +7,11 @@ import {
expectFileTabOpen,
} from "../support/helpers/file-explorer";
import { installDaemonWebSocketGate } from "../support/helpers/daemon-websocket-gate";
import { gotoAppShell } from "../support/helpers/app";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
import { seedWorkspace } from "../support/helpers/seed-client";
import { getServerId } from "../support/helpers/server-id";
import { waitForSidebarHydration } from "../support/helpers/workspace-ui";
const APP_SETTINGS_KEY = "@paseo:app-settings";
@@ -92,6 +96,40 @@ async function seedAgentWithFileLink(input: LinkedFile) {
}
test.describe("CodeMirror workspace file editing", () => {
test("shows an absolute POSIX assistant file link relative to the workspace on hover", async ({
page,
}) => {
const workspace = await seedWorkspace({ repoPrefix: "file-link-tooltip-" });
const filePath = path.join(workspace.repoPath, "src", "target.ts");
try {
const agent = await workspace.client.createAgent({
provider: "mock",
cwd: workspace.repoPath,
workspaceId: workspace.workspaceId,
title: "Absolute file link tooltip",
modeId: "load-test",
model: "e2e-fast-stream",
initialPrompt: "Show the file link",
featureValues: { mockAssistantResponse: `[Open target](${filePath}:42-45)` },
});
await gotoAppShell(page);
await waitForSidebarHydration(page);
const workspaceRow = page.getByTestId(
`sidebar-workspace-row-${getServerId()}:${workspace.workspaceId}`,
);
await expect(workspaceRow).toBeVisible({ timeout: 30_000 });
await workspaceRow.click();
await page.getByTestId(`workspace-tab-agent_${agent.id}`).filter({ visible: true }).click();
const fileLink = page.getByRole("link", { name: "Open target" }).first();
await expect(fileLink).toBeVisible({ timeout: 15_000 });
await fileLink.hover();
await expect(page.getByText("src/target.ts:42-45", { exact: true })).toBeVisible();
} finally {
await workspace.cleanup();
}
});
test("renders a lockfile-sized read-only source with a bounded CodeMirror DOM", async ({
page,
}) => {
@@ -0,0 +1,51 @@
import { test, expect } from "../support/fixtures";
import { openSettings } from "../support/helpers/app";
import { expectAppRoute } from "../support/helpers/route-assertions";
import {
buildPairingLink,
cancelHostConfirmation,
connectToConfirmedHost,
expectHostConfirmationFor,
expectHostInHostPicker,
hostConfirmation,
openPairingLink,
saveLinkedHostBeforeLoad,
type LinkedHost,
} from "../support/helpers/host-confirmation";
// An unreachable relay: the link saves the host without connecting first.
const linkedHost: LinkedHost = {
serverId: "srv_link_confirmation",
relayEndpoint: "127.0.0.1:59998",
daemonPublicKeyB64: "bGlua0NvbmZpcm1hdGlvbktleQ",
};
test("a pairing link for a new host asks before saving it", async ({ page }) => {
const link = buildPairingLink(linkedHost);
await test.step("Cancel saves nothing and stays on the page", async () => {
await openPairingLink(page, link);
await expectHostConfirmationFor(page, linkedHost);
await cancelHostConfirmation(page);
await expectAppRoute(page, "/settings/general");
await expectHostInHostPicker(page, linkedHost.serverId, "not listed");
});
await test.step("Connect saves the host and opens a project", async () => {
await openPairingLink(page, link);
await expectHostConfirmationFor(page, linkedHost);
await connectToConfirmedHost(page);
await expectAppRoute(page, "/open-project");
await openSettings(page);
await expectHostInHostPicker(page, linkedHost.serverId, "listed");
});
});
test("a pairing link for a saved host connects without asking", async ({ page }) => {
await saveLinkedHostBeforeLoad(page, linkedHost);
await openPairingLink(page, buildPairingLink(linkedHost));
await expectAppRoute(page, "/open-project", { timeout: 30_000 });
await expect(hostConfirmation(page)).toHaveCount(0);
});
@@ -250,6 +250,52 @@ test.describe("Tab creation", () => {
await expect(page).toHaveURL(/\/settings\/hosts\/[^/]+\/terminals$/);
});
test("Cursor CLI profile uses the Cursor icon in New tab and host settings", async ({ page }) => {
const guessed: TerminalProfile = {
id: "e2e-cursor-guessed",
name: "Cursor guessed",
command: "cursor-agent",
args: ["{{{prompt}}}"],
};
const explicit: TerminalProfile = {
...guessed,
id: "e2e-cursor-explicit",
name: "Cursor explicit",
icon: "cursor",
};
const profileSeed = await seedTerminalProfiles([guessed, explicit]);
try {
await gotoWorkspace(page, workspace.workspaceId);
await page.getByTestId("workspace-new-tab-button").filter({ visible: true }).click();
const menu = page.getByTestId("workspace-new-tab-menu").filter({ visible: true });
const menuIconPath = (name: string) =>
menu
.getByRole("menuitem", { name })
.evaluate((element) => element.querySelector("svg path")?.getAttribute("d") ?? null);
const guessedMenuPath = await menuIconPath(guessed.name);
const explicitMenuPath = await menuIconPath(explicit.name);
await menu.getByTestId("workspace-new-tab-menu-edit-terminal-profiles").click();
await expect(page).toHaveURL(/\/settings\/hosts\/[^/]+\/terminals$/);
const settingsIconPath = (id: string) =>
page
.getByTestId(`terminal-profile-row-${id}`)
.evaluate((element) => element.querySelector("svg path")?.getAttribute("d") ?? null);
const guessedSettingsPath = await settingsIconPath(guessed.id);
const explicitSettingsPath = await settingsIconPath(explicit.id);
expect(explicitMenuPath).not.toBeNull();
expect(explicitSettingsPath).not.toBeNull();
expect.soft(guessedMenuPath, "New tab Cursor profile icon").toBe(explicitMenuPath);
expect.soft(guessedSettingsPath, "Settings Cursor profile icon").toBe(explicitSettingsPath);
} finally {
await profileSeed.restore();
}
});
test("tab bar shows action buttons per pane", async ({ page }) => {
await gotoWorkspace(page, workspace.workspaceId);
await assertSingleNewTabButton(page);
@@ -0,0 +1,78 @@
import { mkdtempSync } from "node:fs";
import { tmpdir } from "node:os";
import path from "node:path";
import { test, expect, type Page } from "../support/fixtures";
import { launchAgent, cleanupRewindFlow, type AgentHandle } from "../support/helpers/rewind-flow";
import { submitMessage } from "../support/helpers/composer";
const binary = process.env.OPENCODE_TEST_BINARY ?? "opencode";
test.use({
e2eDaemonConfig: {
version: 1,
agents: { providers: { opencode: { enabled: true, command: [binary] } } },
},
});
async function selectMedium(page: Page) {
await page
.getByRole("button", { name: /^Select thinking option/ })
.filter({ visible: true })
.click();
await page.getByText("Medium", { exact: true }).filter({ visible: true }).click();
await expect(
page
.getByRole("button", { name: "Select thinking option (Medium)", exact: true })
.filter({ visible: true }),
).toBeVisible();
}
async function selectLongcat(page: Page) {
await page
.getByRole("button", { name: /^Select model \(/ })
.filter({ visible: true })
.click();
await page
.getByText("LongCat 2.5 Preview Free", { exact: true })
.filter({ visible: true })
.click();
}
async function askForReply(handle: AgentHandle) {
await submitMessage(handle.page, "Reply exactly OK. Do not use tools.");
return handle.client.waitForFinish(handle.agentId, 120_000);
}
test("switching an existing OpenCode session clears unsupported thinking", async ({
page,
}, testInfo) => {
test.setTimeout(240_000);
const cwd = mkdtempSync(path.join(tmpdir(), "paseo-variant-ui-"));
let handle: AgentHandle | undefined;
try {
handle = await launchAgent({
page,
cwd,
provider: "opencode",
mode: "full-access",
providerConfig: { model: "opencode/space-bunny-free" },
});
await selectMedium(page);
expect((await askForReply(handle)).status).toBe("idle");
await selectLongcat(page);
await expect(
page.getByRole("button", { name: /^Select thinking option/ }).filter({ visible: true }),
).toHaveCount(0);
const finish = await askForReply(handle);
const screenshot = testInfo.outputPath("model-switch.png");
await page.screenshot({ path: screenshot });
await testInfo.attach("After switching to Longcat", {
path: screenshot,
contentType: "image/png",
});
expect(finish.status).toBe("idle");
expect(finish.final?.lastError).toBeFalsy();
await expect(
page.getByTestId("assistant-message").filter({ visible: true }).last(),
).toContainText("OK");
} finally {
await cleanupRewindFlow({ handle, cwd });
}
});
@@ -0,0 +1,149 @@
import { writeFile } from "node:fs/promises";
import path from "node:path";
import { expect, test, type Page } from "../support/fixtures";
import { runWorkspaceActionFromCommandCenter } from "../support/helpers/command-center-workspace-actions";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
import { seedWorkspace } from "../support/helpers/seed-client";
import { openSubagentsTrack, seedParentWithSubagent } from "../support/helpers/subagents";
const SETTINGS_KEY = "@paseo:app-settings";
async function openParentInRightPane(page: Page, parentId: string, workspaceId: string) {
await page.setViewportSize({ width: 1400, height: 900 });
await openAgentRoute(page, { workspaceId, agentId: parentId });
await expect(page.getByTestId(`workspace-tab-agent_${parentId}`)).toBeVisible();
await page.getByTestId("workspace-pane-main").getByTestId("workspace-new-tab-button").click();
await page.getByTestId("workspace-new-tab-menu-agent").click();
await page.getByTestId(`workspace-tab-agent_${parentId}`).click();
await runWorkspaceActionFromCommandCenter(page, "Split pane right");
await page
.getByTestId("workspace-pane-main")
.getByTestId(`workspace-tab-agent_${parentId}`)
.click();
await page.keyboard.press("Meta+Alt+Shift+ArrowRight");
const left = page.getByTestId("workspace-pane-main");
const right = page
.locator('[data-testid^="workspace-pane-"]')
.filter({ has: page.getByTestId(`workspace-tab-agent_${parentId}`) });
await expect(left).toBeVisible();
await expect(right).toBeVisible();
await expect(right).not.toHaveAttribute("data-testid", "workspace-pane-main");
await left.locator('[data-testid^="workspace-tab-draft_"]').click();
return { left, right };
}
test.beforeEach(async ({ page }) => {
await page.addInitScript(() => {
Object.defineProperty(navigator, "platform", { get: () => "MacIntel" });
});
});
test("a subagent opened from a right-pane parent stays with its parent when left has focus", async ({
page,
}) => {
const workspace = await seedWorkspace({ repoPrefix: "subagent-origin-pane-" });
try {
const pair = await seedParentWithSubagent(workspace, {
parentTitle: "Right parent",
childTitle: "Child agent",
});
const { left, right } = await openParentInRightPane(page, pair.parent.id, pair.workspaceId);
await openSubagentsTrack(page);
await page.getByTestId(`subagents-track-row-${pair.child.id}`).click();
await expect(right.getByTestId(`workspace-tab-agent_${pair.child.id}`)).toBeVisible();
await expect(left.getByTestId(`workspace-tab-agent_${pair.child.id}`)).toHaveCount(0);
} finally {
await workspace.cleanup();
}
});
test("the side preference opens a right-pane parent's subagent in the side pane", async ({
page,
}) => {
await page.addInitScript((key) => {
localStorage.setItem(key, JSON.stringify({ openInSidePane: { subagents: true } }));
}, SETTINGS_KEY);
const workspace = await seedWorkspace({ repoPrefix: "subagent-side-preference-" });
try {
const pair = await seedParentWithSubagent(workspace, {
parentTitle: "Right parent",
childTitle: "Child agent",
});
const { left, right } = await openParentInRightPane(page, pair.parent.id, pair.workspaceId);
await openSubagentsTrack(page);
await page.getByTestId(`subagents-track-row-${pair.child.id}`).click();
const childPane = page
.locator('[data-testid^="workspace-pane-"]')
.filter({ has: page.getByTestId(`workspace-tab-agent_${pair.child.id}`) });
await expect(childPane).toBeVisible();
expect(await childPane.getAttribute("data-testid")).not.toBe(
await right.getAttribute("data-testid"),
);
await expect(childPane).not.toHaveAttribute("data-testid", "workspace-pane-main");
await expect(left.getByTestId(`workspace-tab-agent_${pair.child.id}`)).toHaveCount(0);
} finally {
await workspace.cleanup();
}
});
test("opening an already-tabbed subagent reveals its left tab without a duplicate", async ({
page,
}) => {
const workspace = await seedWorkspace({ repoPrefix: "subagent-existing-tab-" });
try {
const pair = await seedParentWithSubagent(workspace, {
parentTitle: "Right parent",
childTitle: "Child agent",
});
const { left, right } = await openParentInRightPane(page, pair.parent.id, pair.workspaceId);
await openSubagentsTrack(page);
await page.getByTestId(`subagents-track-row-${pair.child.id}`).click();
await expect(right.getByTestId(`workspace-tab-agent_${pair.child.id}`)).toBeVisible();
await page.keyboard.press("Meta+Alt+Shift+ArrowLeft");
await expect(left.getByTestId(`workspace-tab-agent_${pair.child.id}`)).toBeVisible();
await right.getByTestId(`workspace-tab-agent_${pair.parent.id}`).click();
await openSubagentsTrack(page);
await page.getByTestId(`subagents-track-row-${pair.child.id}`).click();
await expect(left.getByTestId(`workspace-tab-agent_${pair.child.id}`)).toBeVisible();
await expect(right.getByTestId(`workspace-tab-agent_${pair.child.id}`)).toHaveCount(0);
await expect(page.getByTestId(`workspace-tab-agent_${pair.child.id}`)).toHaveCount(1);
} finally {
await workspace.cleanup();
}
});
test("a preferred chat file link still opens beside its right-pane agent", async ({ page }) => {
const target = "linked.ts:3";
const workspace = await seedMockAgentWorkspace({
repoPrefix: "chat-file-origin-pane-",
title: "File link parent",
initialPrompt: [
"Generate a title and a git branch name for a coding agent from the user prompt and attachments.",
"Return JSON only with fields 'title' and 'branch'.",
"",
"<user-prompt>",
`Open \`${target}\` now`,
"</user-prompt>",
].join("\n"),
});
try {
await writeFile(path.join(workspace.cwd, "linked.ts"), "one\ntwo\nthree\n", "utf8");
const { left, right } = await openParentInRightPane(
page,
workspace.agentId,
workspace.workspaceId,
);
const fileLink = right.getByText(target, { exact: true });
await expect(fileLink).toBeVisible({ timeout: 15_000 });
await fileLink.click();
await expect(right.getByTestId("workspace-tab-file_linked.ts")).toBeVisible();
await expect(left.getByTestId("workspace-tab-file_linked.ts")).toHaveCount(0);
} finally {
await workspace.cleanup();
}
});
@@ -90,3 +90,52 @@ a failed provider tap leaves its modal open, so dismiss it before the next run.
journeys remain outside the default mobile suite, alongside the compact sheet journeys above.
Keep generated screenshots, recordings, and run logs outside the repository.
## Stacked adaptive sheets
`stacked-pairing.ad` opens the welcome screen's pairing sheet and then the root-mounted host
confirmation. It first types without tapping the input to verify autofocus, then cancels the
confirmation, closes and reopens the underlying sheet, confirms again,
and completes the password retry. `stacked-settings.ad` checks the same return and retry through
Settings → add host → Direct connection → Advanced. Run both on phones and tablets so both the
bottom sheet and centered dialog are exercised.
These integration journeys require the host-confirmation flow in the test app. Include both the
sheet fix and that flow in the QA checkout when verifying them; the production sheet component
has no dependency on the host-confirmation feature.
Use a fresh English app with notification permission granted and first-use keyboard prompts
already dismissed. Load this checkout from an isolated Metro. Start an isolated password-protected
daemon and a local Wrangler relay with `--var 'PASEO_RELAY_UPSTREAM:'`; the checked-in upstream
setting otherwise forwards traffic to the hosted relay, which drops password rejection replies.
Set `PAIRING_LINK` to the daemon's `relay://` URI with an intentionally incorrect `password` query
parameter, and `PASSWORD` to its correct password. This exercises password retry even while the
daemon accepts relay connections with no credential.
```sh
agent-device replay packages/app/e2e/mobile/modal-sheet/stacked-pairing.ad \
--state-dir "$SHEET_QA_DEVICE_STATE" --session stacked-ipad --platform ios \
--udid "$SHEET_QA_IOS_UDID" \
--env PAIRING_LINK="$SHEET_QA_LINK" --env PASSWORD="$SHEET_QA_PASSWORD" \
--env OUT="$SHEET_QA_OUTPUT"
```
For Settings, first open Settings with Add host visible. With a saved host, open Switch host
first. Use a second loopback spelling
(`localhost` instead of `127.0.0.1`) for the same local relay so the saved host asks for confirmation
of its changed connection. Pass that link to `stacked-settings.ad` with the same arguments.
For an app with no saved hosts, use the original link; Add host is visible directly in Settings.
Android uses the same journeys: copy each script outside the repository, change its context's
`platform=ios` to `platform=android`, and pass `--serial` instead of `--udid`. Reverse both Metro
(including the port advertised by its manifest) and the local relay ports. Keep driver state,
artifacts, and sessions separate from other runs. These host-dependent journeys remain outside the
default mobile suite, alongside the existing modal-sheet scripts.
On iPhone, bulk replacement or bulk keyboard entry of the advanced URI field triggers a
repeated-update error with both the parent and stacked-sheet implementations. Entering the complete
URI one character at a time passed with both implementations; faster typing remains unverified.
On iPad, replacing the field a second time appends text. For this Settings journey, use the
native clipboard Paste menu, then continue the assertions manually. Dismiss the password keyboard
with Done to submit when the Connect button is below the keyboard. The welcome pairing regression
runs end to end without these adjustments.
@@ -0,0 +1,50 @@
# Fresh English app at Welcome, local relay host with PASSWORD, see README.md.
# Run on phones and tablets: the confirmation lives at the root, outside the pairing sheet.
context platform=ios timeout=180000 retries=0
env APP_ID=sh.paseo.debug
open "${APP_ID}"
wait "id=\"welcome-paste-pairing-link\"" 20000
screenshot "${OUT}/01-welcome.png"
press "id=\"welcome-paste-pairing-link\""
wait stable
# Type without tapping the input: opening the sheet must retain its autofocus.
wait "id=\"pair-link-input\"" 10000
type "relay://"
wait "id=\"pair-link-input\" value=\"relay://\"" 5000
screenshot "${OUT}/20-pairing-autofocus-without-tap.png"
fill "id=\"pair-link-input\"" "${PAIRING_LINK}"
wait stable
screenshot "${OUT}/02-pairing-input.png"
press "id=\"pair-link-submit\""
wait stable
wait "id=\"host-confirmation-connect\"" 10000
screenshot "${OUT}/03-confirmation-on-top.png"
press "id=\"host-confirmation-cancel\""
wait stable
wait "id=\"pair-link-submit\" enabled=true" 10000
screenshot "${OUT}/04-cancel-returns-to-pairing.png"
# Close and reopen the underlying sheet, then edit it and submit again.
press "id=\"pair-link-cancel\""
wait stable
wait "id=\"welcome-paste-pairing-link\"" 10000
screenshot "${OUT}/05-underlying-sheet-closes.png"
press "id=\"welcome-paste-pairing-link\""
wait stable
wait "id=\"pair-link-input\"" 10000
fill "id=\"pair-link-input\"" "${PAIRING_LINK}"
wait stable
press "id=\"pair-link-submit\""
wait stable
wait "id=\"host-confirmation-connect\"" 10000
screenshot "${OUT}/06-confirmation-reopens.png"
press "id=\"host-confirmation-connect\""
wait stable
wait "id=\"pair-link-password-input\"" 20000
screenshot "${OUT}/07-password-after-connect.png"
fill "id=\"pair-link-password-input\"" "${PASSWORD}"
wait stable
press "id=\"pair-link-submit\""
wait stable
wait text "Open a folder on your machine" 30000
screenshot "${OUT}/08-connected.png"
@@ -0,0 +1,46 @@
# Settings with Add host visible: no saved hosts, or the host picker already open.
context platform=ios timeout=180000 retries=0
env APP_ID=sh.paseo.debug
open "${APP_ID}"
wait "id=\"settings-add-host\"" 20000
screenshot "${OUT}/09-settings.png"
press "id=\"settings-add-host\""
wait stable
wait "id=\"add-host-method-direct\"" 10000
screenshot "${OUT}/10-add-host-methods.png"
press "id=\"add-host-method-direct\""
wait stable
press "id=\"direct-host-advanced-toggle\""
wait stable
fill "id=\"direct-host-uri-input\"" "${PAIRING_LINK}"
wait stable
screenshot "${OUT}/11-add-host-relay-input.png"
press "id=\"direct-host-submit\""
wait stable
wait "id=\"host-confirmation-connect\"" 10000
screenshot "${OUT}/12-add-host-confirmation-on-top.png"
press "id=\"host-confirmation-cancel\""
wait stable
wait "id=\"direct-host-submit\" enabled=true" 10000
screenshot "${OUT}/13-cancel-returns-to-add-host.png"
# Editing the underlying sheet proves it still accepts input after closing the top sheet.
fill "id=\"direct-host-uri-input\"" "${PAIRING_LINK}"
wait stable
press "id=\"direct-host-submit\""
wait stable
wait "id=\"host-confirmation-connect\"" 10000
screenshot "${OUT}/14-add-host-confirmation-reopens.png"
press "id=\"host-confirmation-connect\""
wait stable
wait "id=\"direct-password-input\"" 20000
screenshot "${OUT}/15-add-host-password.png"
fill "id=\"direct-password-input\"" "${PASSWORD}"
wait stable
press "id=\"direct-host-submit\""
wait stable
open "${APP_ID}" "paseo://settings"
wait "label=\"Connections\"" 10000
press "label=\"Connections\""
wait stable
wait "id=\"host-page-connections-card\"" 30000
screenshot "${OUT}/16-settings-connected.png"
@@ -83,7 +83,7 @@ export async function splitCurrentPanelRight(page: Page): Promise<void> {
export async function disableChatOutlineFromAppearance(page: Page): Promise<void> {
const timelineUrl = page.url();
await openSettings(page);
await openSettingsSection(page, "appearance");
await openSettingsSection(page, "chat");
await page.getByRole("switch", { name: "Chat outline" }).click();
await page.goto(timelineUrl);
}
@@ -0,0 +1,95 @@
import { expect, type Locator, type Page } from "@playwright/test";
const EXTRA_HOSTS_KEY = "@paseo:e2e-extra-hosts";
export interface LinkedHost {
serverId: string;
relayEndpoint: string;
daemonPublicKeyB64: string;
}
/**
* A pairing link that opens on the settings page. `/` redirects to
* `/open-project` on its own, so starting in settings leaves the pairing link
* as the only thing that can move the app to `/open-project`.
*/
export function buildPairingLink(host: LinkedHost): string {
const offer = {
v: 2,
serverId: host.serverId,
daemonPublicKeyB64: host.daemonPublicKeyB64,
relay: { endpoint: host.relayEndpoint, useTls: false },
};
const encoded = Buffer.from(JSON.stringify(offer), "utf8").toString("base64url");
return `/settings/general#offer=${encoded}`;
}
/** Loads the app from a pairing link, the way opening the link in a browser does. */
export async function openPairingLink(page: Page, link: string): Promise<void> {
// Leave the link's page first so the link always loads the app from scratch.
await page.goto("/");
await page.goto(link);
}
/** Saves a relay host before the app loads, as if it had been paired in an earlier session. */
export async function saveLinkedHostBeforeLoad(page: Page, host: LinkedHost): Promise<void> {
await page.goto("/");
const nowIso = new Date().toISOString();
const connectionId = `relay:${host.relayEndpoint}`;
const savedHost = {
serverId: host.serverId,
label: host.serverId,
connections: [
{
id: connectionId,
type: "relay",
relayEndpoint: host.relayEndpoint,
useTls: false,
daemonPublicKeyB64: host.daemonPublicKeyB64,
},
],
preferredConnectionId: connectionId,
createdAt: nowIso,
updatedAt: nowIso,
};
await page.evaluate(({ key, hosts }) => localStorage.setItem(key, JSON.stringify(hosts)), {
key: EXTRA_HOSTS_KEY,
hosts: [savedHost],
});
}
export function hostConfirmation(page: Page): Locator {
return page.getByTestId("host-confirmation");
}
export async function expectHostConfirmationFor(page: Page, host: LinkedHost): Promise<void> {
const sheet = hostConfirmation(page);
await expect(sheet.getByText("Connect to this host?", { exact: true })).toBeVisible({
timeout: 30_000,
});
await expect(sheet.getByTestId("host-confirmation-server-id")).toHaveText(host.serverId);
await expect(sheet.getByTestId("host-confirmation-relay")).toHaveText(host.relayEndpoint);
}
export async function cancelHostConfirmation(page: Page): Promise<void> {
await hostConfirmation(page).getByRole("button", { name: "Cancel", exact: true }).click();
await expect(hostConfirmation(page)).toHaveCount(0);
}
export async function connectToConfirmedHost(page: Page): Promise<void> {
await hostConfirmation(page).getByRole("button", { name: "Connect", exact: true }).click();
await expect(hostConfirmation(page)).toHaveCount(0);
}
/** Checks the host picker on the settings page the app is already showing. */
export async function expectHostInHostPicker(
page: Page,
serverId: string,
expected: "listed" | "not listed",
): Promise<void> {
await page.getByTestId("settings-host-picker").click();
await expect(page.getByTestId(`settings-host-picker-item-${serverId}`)).toHaveCount(
expected === "listed" ? 1 : 0,
);
await page.keyboard.press("Escape");
}
@@ -47,7 +47,7 @@ async function openPluginScreen(page: Page) {
await expect(page.getByRole("switch", { name: "Show metadata" })).toBeVisible();
}
export async function groupByWorkspace(page: Page) {
await page.getByRole("button", { name: "Group agents by", exact: true }).click();
await page.getByRole("button", { name: /^Group agents by:/ }).click();
await page.getByRole("menuitem", { name: "Workspace", exact: true }).click();
await expect(page.getByText("Grouped by workspace", { exact: true })).toBeVisible();
}
@@ -20,8 +20,12 @@ interface SavedSettingsHostInput {
const SECTION_LABELS = {
general: "General",
chat: "Chat",
appearance: "Appearance",
sidebar: "Sidebar",
editor: "Editor",
terminal: "Terminal",
browser: "Browser",
shortcuts: "Shortcuts",
integrations: "Integrations",
permissions: "Permissions",
@@ -57,7 +57,7 @@ export async function seedSidebarNavPreferences(
export async function openSidebarNavSettings(page: Page): Promise<void> {
await openSettings(page);
await openSettingsSection(page, "appearance");
await openSettingsSection(page, "sidebar");
await expect(page.getByTestId("sidebar-nav-section")).toBeVisible({ timeout: 30_000 });
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/app",
"version": "0.9.2",
"version": "0.10.3",
"private": true,
"main": "index.ts",
"scripts": {
@@ -210,6 +210,17 @@ describe("stream presentation through installed plugins", () => {
expect(result.head).toMatchObject([{ text: "```ts\nconst a = 1;\n\nconst b = 2;" }]);
});
// Codex streams a line break and the next line's indent as their own chunks.
it("keeps a line break when a chunk ends in the next line's indent", () => {
const harness = streamHarness();
harness.send(assistant("```mermaid\nflowchart TD\n A[Start] --> B[Review]\n"));
harness.send(assistant(" "));
const result = harness.send(assistant(" B --> C[Finish]\n```"));
expect(result.head).toMatchObject([
{ text: "```mermaid\nflowchart TD\n A[Start] --> B[Review]\n B --> C[Finish]\n```" },
]);
});
// One rendering path: a fetched message is the same block group as a streamed one,
// which is what lets find, scroll-to-message and history reveal address it by id.
// A link reference definition stays with the paragraph that uses it, so the split
@@ -112,8 +112,10 @@ export function createStreamPresentation() {
const index = prefix.length + offset;
let blockText = text;
if (offset === textBlocks.length - 1) {
const trailingNewlines = /\n+$/.exec(item.text)?.[0] ?? "";
blockText += trailingNewlines;
// The split drops trailing blank lines, including a line break followed only
// by the next line's indent. Keep them so the next append continues that line.
const trailingBlankLines = /\n\s*$/.exec(item.text)?.[0] ?? "";
blockText += trailingBlankLines;
}
const existing = previous?.[index];
const id = `${item.id}:block:${index}`;
+2
View File
@@ -45,6 +45,7 @@ import { WorkspaceSetupDialog } from "@/components/workspace-setup-dialog";
import { WorkspaceShortcutTargetsSubscriber } from "@/components/workspace-shortcut-targets-subscriber";
import { FloatingPanelPortalHost } from "@/components/ui/floating-panel-portal";
import { HostChooserModal, useHostChooser } from "@/hosts/host-chooser";
import { HostConfirmationSheet } from "@/hosts/host-confirmation-sheet";
import {
getIsElectronRuntime,
HEADER_INNER_HEIGHT,
@@ -606,6 +607,7 @@ function AppContainer({ children, chromeEnabled: chromeEnabledOverride }: AppCon
<CommandCenter />
<AddProjectFlowHost />
<HostChooserModal />
<HostConfirmationSheet />
<ProviderSettingsHost />
<WorkspaceSetupDialog />
<KeyboardShortcutsDialog />
+43 -42
View File
@@ -1,4 +1,4 @@
import { useCallback, useEffect, useMemo, useState } from "react";
import { useCallback, useEffect, useMemo, useState, useSyncExternalStore } from "react";
import { useTranslation } from "react-i18next";
import { Pressable, Text, View } from "react-native";
import { useLocalSearchParams, useRouter, type Href } from "expo-router";
@@ -7,10 +7,12 @@ import { StyleSheet, useUnistyles } from "react-native-unistyles";
import { CameraView, useCameraPermissions } from "expo-camera";
import type { BarcodeScanningResult, BarcodeSettings } from "expo-camera";
import { getHostRuntimeStore } from "@/runtime/host-runtime";
import { openPairScan } from "@/hosts/pair-scan-model";
import { buildHostRootRoute, buildSettingsHostRoute } from "@/utils/host-routes";
import { isWeb } from "@/constants/platform";
import { BackHeader } from "@/components/headers/back-header";
import { PairLinkModal } from "@/components/pair-link-modal";
import { Button } from "@/components/ui/button";
const styles = StyleSheet.create((theme) => ({
container: {
@@ -73,6 +75,9 @@ const styles = StyleSheet.create((theme) => ({
borderBottomWidth: 4,
borderBottomRightRadius: 12,
},
scanAgainButton: {
marginTop: theme.spacing[6],
},
helperText: {
marginTop: theme.spacing[6],
color: theme.colors.foregroundMuted,
@@ -108,16 +113,6 @@ const styles = StyleSheet.create((theme) => ({
},
}));
function extractOfferUrlFromScan(result: BarcodeScanningResult): string | null {
const raw = typeof result.data === "string" ? result.data.trim() : "";
if (!raw) return null;
if (raw.includes("#offer=") || raw.includes("#connect=") || raw.startsWith("relay://"))
return raw;
return null;
}
export default function PairScanScreen() {
const { theme } = useUnistyles();
const { t } = useTranslation();
@@ -129,9 +124,6 @@ export default function PairScanScreen() {
const source = typeof params.source === "string" ? params.source : "settings";
const [permission, requestPermission] = useCameraPermissions();
const [isPairing, setIsPairing] = useState(false);
const [scanError, setScanError] = useState<string | null>(null);
const [passwordOfferUrl, setPasswordOfferUrl] = useState<string | null>(null);
const navigateToPairedHost = useCallback(
(serverId: string) => {
@@ -144,6 +136,19 @@ export default function PairScanScreen() {
[router, source],
);
const [scan] = useState(() =>
openPairScan({
importConnectionLink: (link) =>
getHostRuntimeStore().importConnectionLink(
link,
source === "onboarding" ? "hostRoot" : "hostSettings",
),
onConnected: navigateToPairedHost,
}),
);
const scanState = useSyncExternalStore(scan.subscribe, scan.getState, scan.getState);
useEffect(() => () => scan.close(), [scan]);
const closeToSource = useCallback(() => {
try {
router.back();
@@ -159,30 +164,12 @@ export default function PairScanScreen() {
}, [permission, requestPermission]);
const handleScan = useCallback(
(result: BarcodeScanningResult) => {
if (isPairing) return;
const offerUrl = extractOfferUrlFromScan(result);
if (!offerUrl) return;
const store = getHostRuntimeStore();
if (passwordOfferUrl) return;
setIsPairing(true);
setScanError(null);
void store
.importConnectionLink(offerUrl, source === "onboarding" ? "hostRoot" : "hostSettings")
.then((outcome) => {
if (outcome.status === "connected") navigateToPairedHost(outcome.serverId);
else setPasswordOfferUrl(offerUrl);
return outcome;
})
.catch((error) => setScanError(error instanceof Error ? error.message : String(error)))
.finally(() => setIsPairing(false));
},
[isPairing, navigateToPairedHost, passwordOfferUrl, source],
(result: BarcodeScanningResult) =>
scan.scan(typeof result.data === "string" ? result.data : ""),
[scan],
);
const handleRouterBack = useCallback(() => router.back(), [router]);
const closePasswordModal = useCallback(() => setPasswordOfferUrl(null), []);
const savePasswordPairing = useCallback(
({ serverId }: { serverId: string }) => navigateToPairedHost(serverId),
[navigateToPairedHost],
@@ -240,24 +227,38 @@ export default function PairScanScreen() {
barcodeScannerSettings={BARCODE_SCANNER_SETTINGS}
onBarcodeScanned={handleScan}
/>
<View style={styles.overlay} pointerEvents="none">
<View style={styles.overlay} pointerEvents="box-none">
<View style={styles.scanFrame}>
<View style={[styles.corner, styles.cornerTL]} />
<View style={[styles.corner, styles.cornerTR]} />
<View style={[styles.corner, styles.cornerBL]} />
<View style={[styles.corner, styles.cornerBR]} />
</View>
{isPairing ? <Text style={helperTextStyle}>{t("pairing.scan.pairing")}</Text> : null}
{scanError ? <Text style={helperTextStyle}>{scanError}</Text> : null}
{scanState.status === "pairing" ? (
<Text style={helperTextStyle}>{t("pairing.scan.pairing")}</Text>
) : null}
{scanState.status === "stopped" && scanState.error ? (
<Text style={helperTextStyle}>{scanState.error}</Text>
) : null}
{scanState.status === "stopped" ? (
<Button
style={styles.scanAgainButton}
onPress={scan.scanAgain}
testID="pair-scan-again"
>
{t("pairing.connectionMethods.scanQr.title")}
</Button>
) : null}
</View>
</View>
)}
</View>
<PairLinkModal
visible={passwordOfferUrl !== null}
initialUrl={passwordOfferUrl ?? undefined}
initialPasswordRequired
onClose={closePasswordModal}
visible={scanState.status === "passwordRequired"}
passwordRequired={
scanState.status === "passwordRequired" ? scanState.passwordRequired : undefined
}
onClose={scan.closePassword}
onSaved={savePasswordPairing}
/>
</View>
+2 -33
View File
@@ -10,6 +10,7 @@ import { CODE_SURFACE_DATASET } from "@/styles/code-surface";
import { markdownCopyDataSet } from "@/assistant-selection-copy/markup";
import { useAssistantFileLinkResolverContext } from "./provider";
import type { AssistantFileLinkSource } from "./resolver";
import { formatFileLinkTooltipPath } from "./tooltip-path";
import { useFileLink } from "./use-file-link";
interface AssistantMarkdownLinkProps {
@@ -34,7 +35,7 @@ export function AssistantMarkdownLink({
const { configRef } = useAssistantFileLinkResolverContext();
const workspaceRoot = configRef.current.workspaceRoot;
const tooltipPath = useMemo(
() => (target ? formatInlinePathTargetForTooltip(target, workspaceRoot) : null),
() => (target ? formatFileLinkTooltipPath({ target, workspaceRoot }) : null),
[target, workspaceRoot],
);
const linkPress = useMemo<AssistantLinkPress>(
@@ -127,38 +128,6 @@ export function AssistantMarkdownCodeLink({
);
}
function formatInlinePathTargetForTooltip(
target: { path: string; lineStart?: number; lineEnd?: number },
workspaceRoot: string | undefined,
): string {
let result = relativizePathToWorkspace(target.path, workspaceRoot);
if (target.lineStart) {
result += `:${target.lineStart}`;
if (target.lineEnd && target.lineEnd !== target.lineStart) {
result += `-${target.lineEnd}`;
}
}
return result;
}
function relativizePathToWorkspace(filePath: string, workspaceRoot: string | undefined): string {
if (!workspaceRoot) {
return filePath;
}
const root = workspaceRoot.replace(/\/+$/, "");
if (!root) {
return filePath;
}
if (filePath === root) {
return ".";
}
const prefix = `${root}/`;
if (filePath.startsWith(prefix)) {
return filePath.slice(prefix.length);
}
return filePath;
}
interface AssistantInlineCodePathLinkProps {
content: string;
inheritedStyles: TextStyle;
@@ -0,0 +1,59 @@
import { describe, expect, it } from "vitest";
import { formatFileLinkTooltipPath } from "./tooltip-path";
describe("formatFileLinkTooltipPath", () => {
it("shows a Windows file path relative to its workspace regardless of separators", () => {
expect(
formatFileLinkTooltipPath({
target: {
path: "C:/Users/me/repo/src/app.ts",
lineStart: 12,
lineEnd: 20,
},
workspaceRoot: "C:\\Users\\me\\repo",
}),
).toBe("src/app.ts:12-20");
expect(
formatFileLinkTooltipPath({
target: { path: "C:/src/app.ts", lineStart: 12 },
workspaceRoot: "C:\\",
}),
).toBe("src/app.ts:12");
});
it("shows the workspace root as a dot", () => {
expect(
formatFileLinkTooltipPath({
target: { path: "/Users/me/repo" },
workspaceRoot: "/Users/me/repo",
}),
).toBe(".");
expect(
formatFileLinkTooltipPath({
target: { path: "C:/Users/Me/Repo/", lineStart: 4 },
workspaceRoot: "c:\\users\\me\\repo",
}),
).toBe(".:4");
});
it("keeps an absolute path outside the workspace", () => {
expect(
formatFileLinkTooltipPath({
target: { path: "/Users/me/notes.md" },
workspaceRoot: "/Users/me/repo",
}),
).toBe("/Users/me/notes.md");
expect(
formatFileLinkTooltipPath({
target: { path: "C:/Users/me/notes.md", lineStart: 8 },
workspaceRoot: "C:\\Users\\me\\repo",
}),
).toBe("C:/Users/me/notes.md:8");
});
it("keeps the target path when the workspace root is unavailable", () => {
expect(formatFileLinkTooltipPath({ target: { path: "src/app.ts", lineStart: 12 } })).toBe(
"src/app.ts:12",
);
});
});
@@ -0,0 +1,30 @@
import {
isWorkspaceRootPath,
resolveWorkspaceFilePaths,
type WorkspaceFileLocation,
} from "@/workspace/file-open";
interface FormatFileLinkTooltipPathInput {
target: WorkspaceFileLocation;
workspaceRoot?: string;
}
export function formatFileLinkTooltipPath({
target,
workspaceRoot,
}: FormatFileLinkTooltipPathInput): string {
const resolvedPaths = workspaceRoot
? resolveWorkspaceFilePaths({ path: target.path, workspaceRoot })
: null;
const isWorkspaceRoot = workspaceRoot
? isWorkspaceRootPath({ path: target.path, workspaceRoot })
: false;
let result = isWorkspaceRoot ? "." : (resolvedPaths?.relativePath ?? target.path);
if (target.lineStart) {
result += `:${target.lineStart}`;
if (target.lineEnd && target.lineEnd !== target.lineStart) {
result += `-${target.lineEnd}`;
}
}
return result;
}
@@ -1,8 +1,8 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useCallback, useEffect, useMemo, useState } from "react";
import type { ReactNode } from "react";
import { createPortal } from "react-dom";
import { useTranslation } from "react-i18next";
import { Modal, Platform, Pressable, Text, View } from "react-native";
import { Keyboard, Pressable, Text, View } from "react-native";
import type { DimensionValue, StyleProp, ViewStyle } from "react-native";
import { StyleSheet, useUnistyles } from "react-native-unistyles";
import { useIsCompactFormFactor } from "@/constants/layout";
@@ -19,7 +19,6 @@ import {
type BottomSheetBackgroundProps,
} from "@gorhom/bottom-sheet";
import Animated, { useAnimatedStyle } from "react-native-reanimated";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { ArrowLeft, Search, X } from "lucide-react-native";
import {
IsolatedBottomSheetModal,
@@ -75,11 +74,15 @@ export interface SheetHeader {
const SCROLL_CONTENT_GROW = { flexGrow: 1 };
const ABSOLUTE_FILL_STYLE = { ...StyleSheet.absoluteFillObject };
const NATIVE_DIALOG_SNAP_POINTS = ["100%"];
const styles = StyleSheet.create((theme) => ({
nativeModalRoot: {
nativeDialogSurface: {
flex: 1,
},
nativeDialogBackground: {
backgroundColor: "transparent",
},
desktopOverlay: {
...StyleSheet.absoluteFillObject,
backgroundColor: "rgba(0,0,0,0.55)",
@@ -471,7 +474,7 @@ export interface AdaptiveModalSheetProps {
contentStyle?: StyleProp<ViewStyle>;
/** Size compact sheet content to the live snap height instead of its largest snap point. */
sizeContentToCurrentSnapPoint?: boolean;
/** Re-establishes caller-owned contexts inside the compact bottom-sheet portal. */
/** Re-establishes caller-owned contexts inside the native or compact sheet portal. */
contextBridge?: ContextBridge | null;
}
@@ -526,26 +529,26 @@ export function AdaptiveModalSheet({
() => ({ backgroundColor: theme.colors.palette.zinc[600] }),
[theme.colors.palette.zinc],
);
useEffect(() => {
if (!isWeb && visible) {
// A newly opened sheet owns input. A keyboard belonging to the sheet below
// would cover controls in the new sheet, which has no focused input yet.
Keyboard.dismiss();
}
}, [visible]);
const { sheetRef, handleSheetChange, handleSheetDismiss } = useIsolatedBottomSheetVisibility({
visible,
isEnabled: isMobile,
isEnabled: isMobile || !isWeb,
onClose,
});
const [shouldRenderWeb, setShouldRenderWeb] = useState(visible);
const [isWebClosing, setIsWebClosing] = useState(false);
const modalLayer = useGlobalWebOverlayLayer("modal", isWeb && !isMobile && shouldRenderWeb);
const nativeModalDismissNotifiedRef = useRef(!visible);
const handleDismiss = useCallback(() => {
handleSheetDismiss();
onDismiss?.();
}, [handleSheetDismiss, onDismiss]);
const notifyNativeModalDismiss = useCallback(() => {
if (nativeModalDismissNotifiedRef.current) {
return;
}
nativeModalDismissNotifiedRef.current = true;
onDismiss?.();
}, [onDismiss]);
const renderBackdrop = useCallback(
(props: React.ComponentProps<typeof BottomSheetBackdrop>) => (
@@ -592,12 +595,6 @@ export function AdaptiveModalSheet({
onKeyDown: handleWebOverlayKeyDown,
});
useEffect(() => {
if (visible) {
nativeModalDismissNotifiedRef.current = false;
}
}, [visible]);
useEffect(() => {
if (!isWeb || isMobile) return;
if (visible) {
@@ -615,12 +612,6 @@ export function AdaptiveModalSheet({
return () => window.clearTimeout(timeout);
}, [visible, isMobile, onDismiss, shouldRenderWeb]);
useEffect(() => {
if (isWeb || isMobile || visible || Platform.OS !== "android") return;
const timeout = setTimeout(notifyNativeModalDismiss, 0);
return () => clearTimeout(timeout);
}, [visible, isMobile, notifyNativeModalDismiss]);
if (isMobile) {
const sheetContent = (
<>
@@ -725,18 +716,28 @@ export function AdaptiveModalSheet({
}
return (
<Modal
transparent
animationType="fade"
visible={visible}
onRequestClose={onClose}
onDismiss={notifyNativeModalDismiss}
hardwareAccelerated
// Both native presentations share Gorhom's app-wide stack. Independent RN Modals
// present from their React ancestor's controller, so a root-owned sibling dialog
// cannot present while that controller already has a dialog open on iOS.
<IsolatedBottomSheetModal
ref={sheetRef}
contextBridge={contextBridge}
snapPoints={NATIVE_DIALOG_SNAP_POINTS}
index={0}
enableDynamicSizing={false}
onChange={handleSheetChange}
onDismiss={handleDismiss}
handleComponent={null}
backgroundStyle={styles.nativeDialogBackground}
enablePanDownToClose={false}
enableHandlePanningGesture={false}
enableContentPanningGesture={false}
keyboardBehavior="extend"
keyboardBlurBehavior="restore"
accessible={false}
presentation={presentation}
>
{/* Android Modal opens a separate window outside the app's gesture root. */}
<GestureHandlerRootView style={styles.nativeModalRoot}>
{desktopContent}
</GestureHandlerRootView>
</Modal>
<View style={styles.nativeDialogSurface}>{desktopContent}</View>
</IsolatedBottomSheetModal>
);
}
+21 -25
View File
@@ -294,11 +294,23 @@ export interface AddHostModalProps {
}
export function AddHostModal({ visible, onClose, onCancel, onSaved }: AddHostModalProps) {
return (
<AddHostModalContent
key={String(visible)}
visible={visible}
onClose={onClose}
onCancel={onCancel}
onSaved={onSaved}
/>
);
}
function AddHostModalContent({ visible, onClose, onCancel, onSaved }: AddHostModalProps) {
const { theme } = useUnistyles();
const { t } = useTranslation();
const daemons = useHosts();
const { probeAndUpsertDirectConnection, probeAndUpsertConnectionFromOfferUrl } =
useHostMutations();
const { probeAndUpsertDirectConnection, beginLinkPairing } = useHostMutations();
const [linkPairing] = useState(() => beginLinkPairing());
const isMobile = useIsCompactFormFactor();
const [isSaving, setIsSaving] = useState(false);
@@ -313,18 +325,6 @@ export function AddHostModal({ visible, onClose, onCancel, onSaved }: AddHostMod
const [inputResetKey, bumpInputResetKey] = useReducer((key: number) => key + 1, 0);
const advancedTarget = useRef(new PairingTargetTracker("", true));
const clearInput = useCallback(() => {
setHost("");
setPort("6767");
setUseTls(false);
setPassword("");
setIsPasswordVisible(false);
setIsAdvancedOpen(false);
setAdvancedUri("");
advancedTarget.current = new PairingTargetTracker("", true);
bumpInputResetKey();
}, []);
const connectIcon = useMemo(
() => <Link2 size={16} color={theme.colors.accentForeground} />,
[theme.colors.accentForeground],
@@ -358,29 +358,25 @@ export function AddHostModal({ visible, onClose, onCancel, onSaved }: AddHostMod
);
const header = useMemo<SheetHeader>(() => ({ title: t("pairing.direct.title") }), [t]);
// Each open mounts a fresh form (see AddHostModal), so closing needs no reset.
const handleClose = useCallback(() => {
if (isSaving) return;
clearInput();
setErrorMessage("");
onClose();
}, [isSaving, clearInput, onClose]);
}, [isSaving, onClose]);
const handleCancel = useCallback(() => {
if (isSaving) return;
clearInput();
setErrorMessage("");
(onCancel ?? onClose)();
}, [isSaving, clearInput, onCancel, onClose]);
}, [isSaving, onCancel, onClose]);
const handleSaveRelay = useCallback(
async (relayUri: string) => {
try {
setIsSaving(true);
setErrorMessage("");
const { profile, serverId, hostname } = await probeAndUpsertConnectionFromOfferUrl(
relayUri,
password || undefined,
);
const result = await linkPairing.submit(relayUri, password || undefined);
if (result.status === "cancelled") return;
const { profile, serverId, hostname } = result;
const isNewHost = !daemons.some((daemon) => daemon.serverId === serverId);
onSaved?.({ profile, serverId, hostname, isNewHost });
handleClose();
@@ -396,9 +392,9 @@ export function AddHostModal({ visible, onClose, onCancel, onSaved }: AddHostMod
daemons,
directConnectionLabels.invalidConnection,
handleClose,
linkPairing,
onSaved,
password,
probeAndUpsertConnectionFromOfferUrl,
],
);
+15 -26
View File
@@ -5,7 +5,7 @@ import { StyleSheet, useUnistyles } from "react-native-unistyles";
import { useIsCompactFormFactor } from "@/constants/layout";
import { Link } from "lucide-react-native";
import type { HostProfile } from "@/types/host-connection";
import { useHosts, useHostMutations } from "@/runtime/host-runtime";
import { useHosts, useHostMutations, type PasswordRequiredPairing } from "@/runtime/host-runtime";
import { parseRelayConnectionUri } from "@/utils/daemon-endpoints";
import { parseConnectionOfferFromUrl } from "@getpaseo/protocol/connection-offer";
import { AdaptiveModalSheet, AdaptiveTextInput, type SheetHeader } from "./adaptive-modal-sheet";
@@ -62,8 +62,8 @@ const styles = StyleSheet.create((theme) => ({
export interface PairLinkModalProps {
visible: boolean;
initialUrl?: string;
initialPasswordRequired?: boolean;
/** Continues a confirmed pairing whose host asked for a password. */
passwordRequired?: PasswordRequiredPairing;
onClose: () => void;
onCancel?: () => void;
onSaved?: (result: {
@@ -76,18 +76,16 @@ export interface PairLinkModalProps {
export function PairLinkModal({
visible,
initialUrl,
initialPasswordRequired = false,
passwordRequired,
onClose,
onCancel,
onSaved,
}: PairLinkModalProps) {
return (
<PairLinkModalContent
key={`${visible}:${initialUrl ?? ""}:${initialPasswordRequired}`}
key={`${visible}:${passwordRequired?.link ?? ""}`}
visible={visible}
initialUrl={initialUrl}
initialPasswordRequired={initialPasswordRequired}
passwordRequired={passwordRequired}
onClose={onClose}
onCancel={onCancel}
onSaved={onSaved}
@@ -97,8 +95,7 @@ export function PairLinkModal({
function PairLinkModalContent({
visible,
initialUrl,
initialPasswordRequired = false,
passwordRequired,
onClose,
onCancel,
onSaved,
@@ -106,7 +103,9 @@ function PairLinkModalContent({
const { theme } = useUnistyles();
const { t } = useTranslation();
const daemons = useHosts();
const { probeAndUpsertConnectionFromOfferUrl } = useHostMutations();
const { beginLinkPairing } = useHostMutations();
const [pairing] = useState(() => passwordRequired?.pairing ?? beginLinkPairing());
const initialUrl = passwordRequired?.link;
const isMobile = useIsCompactFormFactor();
const offerUrlRef = useRef(initialUrl ?? "");
@@ -115,7 +114,7 @@ function PairLinkModalContent({
const [isSaving, setIsSaving] = useState(false);
const [errorMessage, setErrorMessage] = useState("");
const [password, setPassword] = useState("");
const [needsPassword, setNeedsPassword] = useState(initialPasswordRequired);
const [needsPassword, setNeedsPassword] = useState(passwordRequired !== undefined);
const [passwordResetKey, resetPasswordInput] = useReducer((key: number) => key + 1, 0);
const clearInput = useCallback(() => {
@@ -162,10 +161,9 @@ function PairLinkModalContent({
try {
setIsSaving(true);
setErrorMessage("");
const { profile, serverId, hostname } = await probeAndUpsertConnectionFromOfferUrl(
raw,
password || undefined,
);
const result = await pairing.submit(raw, password || undefined);
if (result.status === "cancelled") return;
const { profile, serverId, hostname } = result;
const isNewHost = !daemons.some((daemon) => daemon.serverId === serverId);
onSaved?.({ profile, serverId, hostname, isNewHost });
handleClose();
@@ -184,16 +182,7 @@ function PairLinkModalContent({
setIsSaving(false);
}
},
[
daemons,
handleClose,
isMobile,
isSaving,
onSaved,
password,
t,
probeAndUpsertConnectionFromOfferUrl,
],
[daemons, handleClose, isMobile, isSaving, onSaved, password, t, pairing],
);
const handleChangeOfferUrl = useCallback((next: string) => {
@@ -117,17 +117,16 @@ export function SettingsSelect<Value extends string>({
disabled,
...row
}: SettingsSelectProps<Value>) {
const selectedLabel = options.find((option) => option.value === value)?.label ?? value;
return (
<SettingsRow {...row}>
<DropdownMenu>
<DropdownTrigger
disabled={disabled}
accessibilityRole="button"
accessibilityLabel={row.label}
accessibilityLabel={`${row.label}: ${selectedLabel}`}
>
<Text style={styles.value}>
{options.find((option) => option.value === value)?.label ?? value}
</Text>
{selectedLabel}
</DropdownTrigger>
<DropdownMenuContent side="bottom" align="end" width={220}>
{options.map((option) => (
@@ -203,6 +202,5 @@ const styles = StyleSheet.create((theme) => ({
},
accessoryLabel: { flexShrink: 1, minWidth: 0 },
control: { flexShrink: 1, maxWidth: "100%" },
value: { color: theme.colors.foreground, fontSize: theme.fontSize.base },
input: { minWidth: 180 },
}));
@@ -24,7 +24,7 @@ interface SidebarHeaderRowProps {
/**
* "header" (default): a sidebar-height row with its own bottom separator —
* the lone header at the top of a sidebar (settings "Back to workspace").
* "compact": a workspace-row-height row with no separator, for entries that
* "compact": a row with no separator, for entries that
* sit in a header group whose wrapper owns the single divider.
*/
variant?: SidebarHeaderRowVariant;
@@ -52,10 +52,9 @@ export function SidebarHeaderRow({
const buttonStyle = useCallback(
({ hovered }: PressableStateCallbackType & { hovered?: boolean }) => [
styles.button,
variant === "compact" && styles.buttonCompact,
(Boolean(hovered) || isActive) && styles.buttonHovered,
],
[isActive, variant],
[isActive],
);
const renderChildren = useCallback(
@@ -64,7 +63,7 @@ export function SidebarHeaderRow({
return (
<>
<ThemedIcon
size={ICON_SIZE.sm}
size={variant === "compact" ? ICON_SIZE.sm : ICON_SIZE.md}
uniProps={isHighlighted ? foregroundColorMapping : foregroundMutedColorMapping}
/>
<SidebarHeaderRowLabel label={label} isHighlighted={isHighlighted} />
@@ -74,7 +73,7 @@ export function SidebarHeaderRow({
</>
);
},
[ThemedIcon, isActive, label, shortcutKeys],
[ThemedIcon, isActive, label, shortcutKeys, variant],
);
return (
@@ -129,21 +128,14 @@ const styles = StyleSheet.create((theme) => ({
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[2],
// Match the sidebar workspace-row shape (height, padding, radius) so the
// compact header entries sit tight against the workspace list below.
minHeight: 36,
paddingVertical: theme.spacing[2],
paddingHorizontal: theme.spacing[3],
borderRadius: theme.borderRadius.lg,
},
// Compact header entries (New workspace / History) sit tighter than the
// workspace-row shape the base button mirrors.
buttonCompact: {
minHeight: 32,
paddingVertical: theme.spacing[1.5],
// Same row geometry as the settings sidebar items. Shorter than the header
// strip so the hover highlight clears the strip's bottom separator.
minHeight: 28,
paddingVertical: theme.spacing[1],
// Match the project rows' inner padding so the icons align on one vertical
// edge with the workspace list below (base button uses a wider spacing[3]).
// edge with the list below.
paddingHorizontal: theme.spacing[2],
borderRadius: theme.borderRadius.lg,
},
buttonHovered: {
backgroundColor: theme.colors.surfaceSidebarHover,
@@ -228,22 +228,22 @@ export function createControlGeometry(theme: Theme) {
buttonXs: {
minHeight: buttonControlHeight.xs,
paddingHorizontal: theme.spacing[3],
borderRadius: theme.borderRadius.md,
borderRadius: theme.borderRadius.xl,
},
buttonSm: {
minHeight: buttonControlHeight.sm,
paddingHorizontal: theme.spacing[3],
borderRadius: theme.borderRadius.md,
borderRadius: theme.borderRadius.xl,
},
buttonMd: {
minHeight: buttonControlHeight.md,
paddingHorizontal: theme.spacing[4],
borderRadius: theme.borderRadius.lg,
borderRadius: theme.borderRadius["2xl"],
},
buttonLg: {
minHeight: buttonControlHeight.lg,
paddingHorizontal: theme.spacing[6],
borderRadius: theme.borderRadius.xl,
borderRadius: theme.borderRadius["2xl"],
},
buttonText: {
fontSize: theme.fontSize.base,
@@ -306,17 +306,17 @@ export function createControlGeometry(theme: Theme) {
segmentedSegmentXs: {
minHeight: CONTROL_HEIGHTS.tight - SEGMENTED_TIGHT_INSET * 2,
paddingHorizontal: theme.spacing[2],
borderRadius: theme.borderRadius.md,
borderRadius: theme.borderRadius.xl,
},
segmentedSegmentSm: {
minHeight: CONTROL_HEIGHTS.compact - SEGMENTED_COMPACT_INSET * 2,
paddingHorizontal: theme.spacing[2],
borderRadius: theme.borderRadius.md,
borderRadius: theme.borderRadius.xl,
},
segmentedSegmentMd: {
minHeight: CONTROL_HEIGHTS.field - SEGMENTED_FIELD_INSET * 2,
paddingHorizontal: theme.spacing[3],
borderRadius: theme.borderRadius.lg,
borderRadius: theme.borderRadius["2xl"],
},
segmentedLabelXs: {
fontSize: theme.fontSize.sm,
@@ -1,48 +1,104 @@
import type { ReactElement, ReactNode } from "react";
import { View } from "react-native";
import { useCallback, useMemo, type ReactElement, type ReactNode } from "react";
import { Text, View, type ViewStyle } from "react-native";
import { StyleSheet, withUnistyles } from "react-native-unistyles";
import { ChevronDown } from "lucide-react-native";
import { ICON_SIZE, type Theme } from "@/styles/theme";
import {
buttonIconSize,
createControlGeometry,
type ButtonControlSize,
} from "@/components/ui/control-geometry";
import type { Theme } from "@/styles/theme";
import { DropdownMenuTrigger, type DropdownMenuTriggerProps } from "@/components/ui/dropdown-menu";
const ThemedChevronDown = withUnistyles(ChevronDown);
interface DropdownTriggerProps extends Omit<DropdownMenuTriggerProps, "children"> {
children?: ReactNode;
chevron?: ReactNode | null;
}
const chevronColorMapping = (theme: Theme) => ({
color: theme.colors.foregroundMuted,
});
interface DropdownTriggerProps extends Omit<DropdownMenuTriggerProps, "children" | "style"> {
/** The selected option's label. */
children: string;
/** Icon or swatch before the label. */
leading?: ReactNode;
size?: ButtonControlSize;
}
/**
* A select-style menu trigger: the selected value plus a chevron, drawn with the
* outline Button's chrome and size scale so a dropdown and a button in the same
* row share one geometry. Callers pick a size; they don't style it.
*/
export function DropdownTrigger({
children,
chevron,
leading,
size = "sm",
disabled,
...props
}: DropdownTriggerProps): ReactElement {
let sizeStyle: ViewStyle;
if (size === "xs") {
sizeStyle = styles.xs;
} else if (size === "md") {
sizeStyle = styles.md;
} else if (size === "lg") {
sizeStyle = styles.lg;
} else {
sizeStyle = styles.sm;
}
const triggerStyle = useCallback(
({ pressed }: { pressed: boolean }) => [
styles.base,
sizeStyle,
pressed ? styles.pressed : null,
disabled ? styles.disabled : null,
],
[disabled, sizeStyle],
);
const labelStyle = useMemo(() => [styles.label, size === "xs" && styles.labelXs], [size]);
return (
<DropdownMenuTrigger {...props}>
<View style={styles.row}>
<DropdownMenuTrigger {...props} disabled={disabled} style={triggerStyle}>
{leading}
<Text style={labelStyle} numberOfLines={1}>
{children}
{chevron !== null &&
(chevron ?? (
<View style={styles.chevronContainer}>
<ThemedChevronDown size={ICON_SIZE.sm} uniProps={chevronColorMapping} />
</View>
))}
</Text>
<View style={styles.chevron}>
<ThemedChevronDown size={buttonIconSize[size]} uniProps={chevronColorMapping} />
</View>
</DropdownMenuTrigger>
);
}
const styles = StyleSheet.create((theme) => ({
row: {
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[1],
},
chevronContainer: {
transform: [{ translateY: 1 }],
},
}));
const styles = StyleSheet.create((theme) => {
const geometry = createControlGeometry(theme);
return {
base: {
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[2],
borderWidth: 1,
borderColor: theme.colors.borderAccent,
backgroundColor: "transparent",
},
xs: geometry.buttonXs,
sm: geometry.buttonSm,
md: geometry.buttonMd,
lg: geometry.buttonLg,
pressed: {
opacity: 0.85,
},
disabled: {
opacity: theme.opacity[50],
},
label: {
flexShrink: 1,
color: theme.colors.foreground,
...geometry.buttonText,
},
labelXs: geometry.buttonTextXs,
chevron: {
transform: [{ translateY: 1 }],
},
};
});
@@ -32,15 +32,32 @@ afterEach(() => {
}
});
function parseColor(value: string): { rgb: string; alpha: number } {
const channels = value.match(/[\d.]+/g)?.map(Number) ?? [];
return { rgb: channels.slice(0, 3).join(","), alpha: channels[3] ?? 1 };
}
describe("StatusBadge", () => {
it.each(["success", "warning", "error", "muted"] as const)(
"uses the semantic badge shell for the %s variant",
it("uses the neutral badge shell for the muted variant", () => {
const style = getComputedStyle(mountBadge("muted"));
expect(style.backgroundColor).toBe("rgb(228, 228, 231)");
expect(style.borderColor).toBe("rgb(228, 228, 231)");
});
it.each(["success", "warning", "error"] as const)(
"fills the %s variant with a translucent tint of its own status color",
(variant) => {
const badge = mountBadge(variant);
const style = getComputedStyle(badge);
const text = badge.lastElementChild;
if (!(text instanceof HTMLElement)) {
throw new Error("StatusBadge did not render its label");
}
const fill = parseColor(getComputedStyle(badge).backgroundColor);
expect(style.backgroundColor).toBe("rgb(228, 228, 231)");
expect(style.borderColor).toBe("rgb(228, 228, 231)");
expect(fill.rgb).toBe(parseColor(getComputedStyle(text).color).rgb);
expect(fill.alpha).toBeGreaterThan(0);
expect(fill.alpha).toBeLessThan(0.5);
},
);
@@ -11,6 +11,15 @@ interface StatusBadgeProps {
}
export function StatusBadge({ label, variant = "muted", leading }: StatusBadgeProps) {
const pillStyle = useMemo(
() => [
styles.pill,
variant === "success" && styles.pillSuccess,
variant === "warning" && styles.pillWarning,
variant === "error" && styles.pillError,
],
[variant],
);
const textStyle = useMemo(
() => [
styles.pillText,
@@ -22,7 +31,7 @@ export function StatusBadge({ label, variant = "muted", leading }: StatusBadgePr
);
return (
<View style={styles.pill}>
<View style={pillStyle}>
{leading}
<Text style={textStyle}>{label}</Text>
</View>
@@ -41,6 +50,18 @@ const styles = StyleSheet.create((theme) => ({
paddingHorizontal: theme.spacing[2],
paddingVertical: 3,
},
pillSuccess: {
backgroundColor: theme.colors.statusSuccessTint,
borderColor: "transparent",
},
pillWarning: {
backgroundColor: theme.colors.statusWarningTint,
borderColor: "transparent",
},
pillError: {
backgroundColor: theme.colors.statusDangerTint,
borderColor: "transparent",
},
pillText: {
fontSize: theme.fontSize.sm,
fontWeight: theme.fontWeight.normal,
@@ -65,7 +65,7 @@ export function BrowserDataSection() {
</Text>
</View>
<Button
variant="destructive"
variant="outline"
size="sm"
loading={isClearing}
disabled={isClearing}
@@ -0,0 +1,109 @@
import { useCallback, useMemo } from "react";
import { Text, View } from "react-native";
import { StyleSheet } from "react-native-unistyles";
import { useTranslation } from "react-i18next";
import { AdaptiveModalSheet, type SheetHeader } from "@/components/adaptive-modal-sheet";
import { Button } from "@/components/ui/button";
import { settingsStyles } from "@/styles/settings";
import { useHostConfirmation } from "@/runtime/host-runtime";
/** Shows the host confirmation the host runtime is waiting on. Mount once at the app root. */
export function HostConfirmationSheet() {
const { t } = useTranslation();
const { pending, answer } = useHostConfirmation();
const cancel = useCallback(() => answer(false), [answer]);
const connect = useCallback(() => answer(true), [answer]);
const header = useMemo<SheetHeader>(() => ({ title: t("pairing.hostConfirmation.title") }), [t]);
if (!pending) return null;
return (
<AdaptiveModalSheet header={header} visible onClose={cancel} testID="host-confirmation">
<Text style={styles.confirmText}>
{pending.kind === "changedConnection"
? t("pairing.hostConfirmation.descriptionChanged")
: t("pairing.hostConfirmation.description")}
</Text>
<View style={settingsStyles.card}>
<DetailRow
label={t("pairing.hostConfirmation.hostLabel")}
value={pending.serverId}
testID="host-confirmation-server-id"
/>
<DetailRow
label={t("pairing.hostConfirmation.fingerprintLabel")}
value={pending.keyFingerprint}
testID="host-confirmation-fingerprint"
showBorder
/>
<DetailRow
label={t("pairing.hostConfirmation.relayLabel")}
value={pending.relayEndpoint}
testID="host-confirmation-relay"
showBorder
/>
</View>
<View style={styles.confirmActions}>
<Button
variant="secondary"
size="sm"
style={FLEX_1_STYLE}
onPress={cancel}
testID="host-confirmation-cancel"
>
{t("common.actions.cancel")}
</Button>
<Button
variant="default"
size="sm"
style={FLEX_1_STYLE}
onPress={connect}
testID="host-confirmation-connect"
>
{t("pairing.hostConfirmation.connect")}
</Button>
</View>
</AdaptiveModalSheet>
);
}
function DetailRow({
label,
value,
showBorder = false,
testID,
}: {
label: string;
value: string;
showBorder?: boolean;
testID?: string;
}) {
return (
<View style={[settingsStyles.row, showBorder && settingsStyles.rowBorder]}>
<View style={settingsStyles.rowContent}>
<Text style={settingsStyles.rowTitle}>{label}</Text>
<Text style={settingsStyles.rowHint} selectable testID={testID}>
{value}
</Text>
</View>
</View>
);
}
// Same shape as the remove-host and remove-connection confirm sheets in
// screens/settings/host-page.tsx.
const styles = StyleSheet.create((theme) => ({
confirmText: {
color: theme.colors.foregroundMuted,
fontSize: theme.fontSize.base,
},
confirmActions: {
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[2],
marginTop: theme.spacing[4],
},
}));
const FLEX_1_STYLE = { flex: 1 };
@@ -0,0 +1,116 @@
import { describe, expect, it, vi } from "vitest";
import type { ConnectionLinkImport, LinkPairing } from "@/runtime/host-runtime";
import { openPairScan, type PairScanModel } from "./pair-scan-model";
const LINK = "https://app.paseo.sh/#offer=abc";
const PAIRING: LinkPairing = { submit: async () => ({ status: "cancelled" }) };
/** The host runtime's side of a scan: each import resolves with the next queued outcome. */
function createScanner(outcomes: Array<ConnectionLinkImport | Error>) {
const imports: string[] = [];
const connected: string[] = [];
const scan = openPairScan({
importConnectionLink: async (link) => {
imports.push(link);
const outcome = outcomes.shift();
if (!outcome) throw new Error("No outcome queued for this import");
if (outcome instanceof Error) throw outcome;
return outcome;
},
onConnected: (serverId) => connected.push(serverId),
});
return { scan, imports, connected };
}
async function settled(scan: PairScanModel): Promise<void> {
await vi.waitFor(() => expect(scan.getState().status).not.toBe("pairing"));
}
describe("openPairScan", () => {
it("stops scanning after Cancel until the user scans again", async () => {
const { scan, imports } = createScanner([{ status: "cancelled" }, { status: "cancelled" }]);
scan.scan(LINK);
await settled(scan);
// The code is still in front of the camera.
scan.scan(LINK);
scan.scan(LINK);
await Promise.resolve();
expect(imports).toEqual([LINK]);
expect(scan.getState()).toEqual({ status: "stopped", error: null });
scan.scanAgain();
scan.scan(LINK);
await settled(scan);
expect(imports).toEqual([LINK, LINK]);
});
it("starts one attempt per code while pairing, and ignores codes that are not pairing links", async () => {
const { scan, imports, connected } = createScanner([
{ status: "connected", serverId: "srv_scan" },
]);
scan.scan("https://example.com/not-a-pairing-link");
expect(scan.getState()).toEqual({ status: "scanning" });
scan.scan(LINK);
scan.scan(LINK);
await settled(scan);
expect(imports).toEqual([LINK]);
expect(connected).toEqual(["srv_scan"]);
scan.scan(LINK);
expect(imports).toEqual([LINK]);
});
it("ends the attempt when the password prompt closes", async () => {
const { scan, imports } = createScanner([
{ status: "password_required", link: LINK, pairing: PAIRING },
]);
scan.scan(LINK);
await settled(scan);
expect(scan.getState()).toEqual({
status: "passwordRequired",
passwordRequired: { link: LINK, pairing: PAIRING },
});
scan.scan(LINK);
scan.closePassword();
scan.scan(LINK);
expect(scan.getState()).toEqual({ status: "stopped", error: null });
expect(imports).toEqual([LINK]);
});
it("stops with the error when an attempt fails", async () => {
const { scan, imports } = createScanner([new Error("Server disconnected")]);
scan.scan(LINK);
await settled(scan);
scan.scan(LINK);
expect(scan.getState()).toEqual({ status: "stopped", error: "Server disconnected" });
expect(imports).toEqual([LINK]);
});
it("does not navigate for an attempt that finishes after the screen closed", async () => {
let finish: (outcome: ConnectionLinkImport) => void = () => {};
const connected: string[] = [];
const scan = openPairScan({
importConnectionLink: () =>
new Promise((resolve) => {
finish = resolve;
}),
onConnected: (serverId) => connected.push(serverId),
});
scan.scan(LINK);
scan.close();
finish({ status: "connected", serverId: "srv_scan" });
await Promise.resolve();
expect(connected).toEqual([]);
});
});
+103
View File
@@ -0,0 +1,103 @@
import type { ConnectionLinkImport, PasswordRequiredPairing } from "@/runtime/host-runtime";
/**
* One visit to the QR scan screen. The camera reports every frame that shows
* a code, so an attempt that ends (Cancel on the host confirmation, a closed
* password prompt, or an error) stops scanning until the user taps scan again.
* Without that, the code still in front of the camera starts a new attempt on
* the next frame.
*/
export type PairScanState =
| { status: "scanning" }
| { status: "pairing" }
| { status: "passwordRequired"; passwordRequired: PasswordRequiredPairing }
| { status: "stopped"; error: string | null }
| { status: "connected" };
export interface PairScanModel {
getState: () => PairScanState;
subscribe: (listener: () => void) => () => void;
/** Data from a QR code the camera saw. Only a scanning session starts an attempt. */
scan: (data: string) => void;
/** The user asked to scan again after an attempt ended. */
scanAgain: () => void;
/** The user closed the password prompt, which ends the attempt. */
closePassword: () => void;
close: () => void;
}
export interface PairScanDependencies {
importConnectionLink: (link: string) => Promise<ConnectionLinkImport>;
onConnected: (serverId: string) => void;
}
export function openPairScan(deps: PairScanDependencies): PairScanModel {
let state: PairScanState = { status: "scanning" };
let closed = false;
const listeners = new Set<() => void>();
function publish(next: PairScanState): void {
if (closed) return;
state = next;
for (const listener of listeners) {
listener();
}
}
async function pair(link: string): Promise<void> {
publish({ status: "pairing" });
try {
const outcome = await deps.importConnectionLink(link);
if (closed) return;
if (outcome.status === "connected") {
publish({ status: "connected" });
deps.onConnected(outcome.serverId);
return;
}
if (outcome.status === "password_required") {
const { link: passwordLink, pairing } = outcome;
publish({ status: "passwordRequired", passwordRequired: { link: passwordLink, pairing } });
return;
}
publish({ status: "stopped", error: null });
} catch (error) {
publish({ status: "stopped", error: error instanceof Error ? error.message : String(error) });
}
}
return {
getState: () => state,
subscribe(listener) {
listeners.add(listener);
return () => {
listeners.delete(listener);
};
},
scan(data) {
if (state.status !== "scanning") return;
const link = pairingLinkFromScan(data);
if (!link) return;
void pair(link);
},
scanAgain() {
if (state.status !== "stopped") return;
publish({ status: "scanning" });
},
closePassword() {
if (state.status !== "passwordRequired") return;
publish({ status: "stopped", error: null });
},
close() {
closed = true;
listeners.clear();
},
};
}
function pairingLinkFromScan(data: string): string | null {
const raw = data.trim();
if (raw.includes("#offer=") || raw.includes("#connect=") || raw.startsWith("relay://")) {
return raw;
}
return null;
}
+16 -4
View File
@@ -1617,6 +1617,17 @@ export const ar: TranslationResources = {
title: "كلمة المرور لـ {{host}}",
label: "كلمة مرور المضيف",
},
hostConfirmation: {
title: "الاتصال بهذا المضيف؟",
description:
"سيتمكن هذا المضيف من تشغيل تعليمات برمجية في هذا التطبيق والوصول إلى مضيفيك الآخرين المتصلين. اتصل فقط إذا كنت تعرفه.",
descriptionChanged:
"يغيّر هذا الرابط طريقة اتصالك بهذا المضيف. سيتمكن المضيف من تشغيل تعليمات برمجية في هذا التطبيق والوصول إلى مضيفيك الآخرين المتصلين. اتصل فقط إذا كنت تعرفه.",
hostLabel: "المضيف",
fingerprintLabel: "بصمة المفتاح",
relayLabel: "المُرحّل",
connect: "اتصال",
},
connectionMethods: {
title: "إضافة اتصال",
direct: {
@@ -1953,8 +1964,11 @@ export const ar: TranslationResources = {
groupInfo: "حول{{title}}",
sections: {
general: "عام",
chat: "الدردشة",
appearance: "مظهر",
layout: en.settings.sections.layout,
sidebar: "الشريط الجانبي",
terminal: "الطرفية",
browser: "المتصفح",
editor: "المحرر",
shortcuts: "الاختصارات",
integrations: "التكامل",
@@ -2013,6 +2027,7 @@ export const ar: TranslationResources = {
},
general: {
title: "عام",
sending: "الإرسال",
browserData: {
title: "بيانات المتصفح",
siteData: "ملفات تعريف الارتباط وبيانات المواقع",
@@ -2040,8 +2055,6 @@ export const ar: TranslationResources = {
},
},
serviceUrls: {
label: "عناوين URL للخدمة",
description: "مكان فتح عناوين URL من تشغيل البرامج النصية",
options: {
ask: "بسأل",
inApp: "في Paseo",
@@ -2060,7 +2073,6 @@ export const ar: TranslationResources = {
toolCallDetail: {
label: "عرض استدعاءات الأدوات",
description: "كيفية ظهور استدعاءات الأدوات في المخطط الزمني",
accessibilityLabel: "حدد عرض استدعاءات الأدوات ({{value}})",
options: {
overview: "ملخص",
detailed: "التفاصيل الكاملة",
+25 -10
View File
@@ -1642,6 +1642,17 @@ export const en = {
title: "Password for {{host}}",
label: "Host password",
},
hostConfirmation: {
title: "Connect to this host?",
description:
"This host will be able to run code in this app and reach your other connected hosts. Only connect if you recognize it.",
descriptionChanged:
"This link changes how you connect to this host. The host will be able to run code in this app and reach your other connected hosts. Only connect if you recognize it.",
hostLabel: "Host",
fingerprintLabel: "Key fingerprint",
relayLabel: "Relay",
connect: "Connect",
},
connectionMethods: {
title: "Add connection",
direct: {
@@ -1978,9 +1989,12 @@ export const en = {
groupInfo: "About {{title}}",
sections: {
general: "General",
chat: "Chat",
appearance: "Appearance",
layout: "Layout",
sidebar: "Sidebar",
editor: "Editor",
terminal: "Terminal",
browser: "Browser",
shortcuts: "Shortcuts",
integrations: "Integrations",
notifications: "Notifications",
@@ -1998,29 +2012,32 @@ export const en = {
},
sources: {
explorerFiles: {
label: "Selecting a file in Explorer",
label: "Clicking a file in the Explorer sidebar",
description: "Open files selected in the Explorer sidebar beside your work",
},
diffs: {
label: "Opening a diff",
label: "Clicking a change in the Explorer sidebar or a chat",
description: "Open diffs from Explorer and agent conversations beside your work",
},
chatFiles: {
label: "Opening a file from an agent chat",
label: "Clicking a file in an agent chat",
description: "Open file links and tool-call files beside the conversation",
},
diffFiles: {
label: "Opening a file from Changes",
label: "Clicking a file in a diff",
description: "Open source files selected from a diff beside it",
},
subagents: {
label: "Opening a subagent",
label: "Clicking a subagent in an agent chat",
description: "Open subagents beside their parent agent",
},
pullRequests: {
label: "Opening a pull request from Changes",
label: "Clicking a pull request in the Explorer sidebar",
description: "Open pull request details beside Changes",
},
serviceUrls: {
label: "Clicking a script's service URL",
},
},
},
},
@@ -2134,6 +2151,7 @@ export const en = {
},
general: {
title: "General",
sending: "Sending",
browserData: {
title: "Browser data",
siteData: "Cookies and site data",
@@ -2160,8 +2178,6 @@ export const en = {
},
},
serviceUrls: {
label: "Service URLs",
description: "Where to open URLs from running scripts",
options: {
ask: "Ask",
inApp: "In Paseo",
@@ -2180,7 +2196,6 @@ export const en = {
toolCallDetail: {
label: "Tool call display",
description: "How tool calls appear in the timeline",
accessibilityLabel: "Select tool call display ({{value}})",
options: {
overview: "Summary",
detailed: "Full detail",
+16 -4
View File
@@ -1663,6 +1663,17 @@ export const es: TranslationResources = {
title: "Contraseña de {{host}}",
label: "Contraseña del host",
},
hostConfirmation: {
title: "¿Conectar con este host?",
description:
"Este host podrá ejecutar código en esta app y acceder a tus otros hosts conectados. Conéctate solo si lo reconoces.",
descriptionChanged:
"Este enlace cambia cómo te conectas a este host. El host podrá ejecutar código en esta app y acceder a tus otros hosts conectados. Conéctate solo si lo reconoces.",
hostLabel: "Host",
fingerprintLabel: "Huella de la clave",
relayLabel: "Relay",
connect: "Conectar",
},
connectionMethods: {
title: "Agregar conexión",
direct: {
@@ -2001,8 +2012,11 @@ export const es: TranslationResources = {
groupInfo: "Acerca de{{title}}",
sections: {
general: "General",
chat: "Chat",
appearance: "Apariencia",
layout: en.settings.sections.layout,
sidebar: "Barra lateral",
terminal: "Terminal",
browser: "Navegador",
editor: "Editor",
shortcuts: "Atajos",
integrations: "Integraciones",
@@ -2061,6 +2075,7 @@ export const es: TranslationResources = {
},
general: {
title: "General",
sending: "Envío",
browserData: {
title: "Datos del navegador",
siteData: "Cookies y datos de sitios",
@@ -2091,8 +2106,6 @@ export const es: TranslationResources = {
},
},
serviceUrls: {
label: "URL de servicio",
description: "Dónde abrir URL desde scripts en ejecución",
options: {
ask: "Preguntar",
inApp: "EnPaseo",
@@ -2112,7 +2125,6 @@ export const es: TranslationResources = {
toolCallDetail: {
label: "Visualización de llamadas a herramientas",
description: "Cómo aparecen las llamadas a herramientas en la cronología",
accessibilityLabel: "Seleccionar visualización de llamadas a herramientas ({{value}})",
options: {
overview: "Resumen",
detailed: "Detalle completo",
+16 -4
View File
@@ -1667,6 +1667,17 @@ export const fr: TranslationResources = {
title: "Mot de passe pour {{host}}",
label: "Mot de passe de l’hôte",
},
hostConfirmation: {
title: "Se connecter à cet hôte ?",
description:
"Cet hôte pourra exécuter du code dans cette application et accéder à vos autres hôtes connectés. Connectez-vous uniquement si vous le reconnaissez.",
descriptionChanged:
"Ce lien modifie la façon dont vous vous connectez à cet hôte. L'hôte pourra exécuter du code dans cette application et accéder à vos autres hôtes connectés. Connectez-vous uniquement si vous le reconnaissez.",
hostLabel: "Hôte",
fingerprintLabel: "Empreinte de la clé",
relayLabel: "Relais",
connect: "Se connecter",
},
connectionMethods: {
title: "Ajouter une connexion",
direct: {
@@ -2006,8 +2017,11 @@ export const fr: TranslationResources = {
groupInfo: "À propos de{{title}}",
sections: {
general: "Général",
chat: "Discussion",
appearance: "Apparence",
layout: en.settings.sections.layout,
sidebar: "Barre latérale",
terminal: "Terminal",
browser: "Navigateur",
editor: "Éditeur",
shortcuts: "Raccourcis",
integrations: "Intégrations",
@@ -2066,6 +2080,7 @@ export const fr: TranslationResources = {
},
general: {
title: "Général",
sending: "Envoi",
browserData: {
title: "Données du navigateur",
siteData: "Cookies et données des sites",
@@ -2095,8 +2110,6 @@ export const fr: TranslationResources = {
},
},
serviceUrls: {
label: "URL de services",
description: "Où ouvrir les URL à partir de scripts en cours d'exécution",
options: {
ask: "Demander",
inApp: "DansPaseo",
@@ -2115,7 +2128,6 @@ export const fr: TranslationResources = {
toolCallDetail: {
label: "Affichage des appels d’outils",
description: "Comment les appels d’outils apparaissent dans la chronologie",
accessibilityLabel: "Sélectionner l’affichage des appels d’outils ({{value}})",
options: {
overview: "Résumé",
detailed: "Détails complets",
+16 -4
View File
@@ -1634,6 +1634,17 @@ export const ja: TranslationResources = {
title: "{{host}} のパスワード",
label: "ホストのパスワード",
},
hostConfirmation: {
title: "このホストに接続しますか?",
description:
"このホストはこのアプリ内でコードを実行し、接続中の他のホストにアクセスできるようになります。心当たりがある場合のみ接続してください。",
descriptionChanged:
"このリンクはこのホストへの接続方法を変更します。ホストはこのアプリ内でコードを実行し、接続中の他のホストにアクセスできるようになります。心当たりがある場合のみ接続してください。",
hostLabel: "ホスト",
fingerprintLabel: "鍵のフィンガープリント",
relayLabel: "リレー",
connect: "接続",
},
connectionMethods: {
title: "接続を追加",
direct: {
@@ -1973,8 +1984,11 @@ export const ja: TranslationResources = {
groupInfo: "{{title}}について",
sections: {
general: "一般",
chat: "チャット",
appearance: "外観",
layout: en.settings.sections.layout,
sidebar: "サイドバー",
terminal: "ターミナル",
browser: "ブラウザ",
editor: "エディター",
shortcuts: "ショートカット",
integrations: "連携",
@@ -2033,6 +2047,7 @@ export const ja: TranslationResources = {
},
general: {
title: "一般",
sending: "送信",
browserData: {
title: "ブラウザーデータ",
siteData: "Cookie とサイトデータ",
@@ -2059,8 +2074,6 @@ export const ja: TranslationResources = {
},
},
serviceUrls: {
label: "サービスURL",
description: "実行中のスクリプトからURLを開く場所",
options: {
ask: "確認する",
inApp: "Paseoで",
@@ -2079,7 +2092,6 @@ export const ja: TranslationResources = {
toolCallDetail: {
label: "ツール呼び出しの表示",
description: "タイムラインでのツール呼び出しの表示方法",
accessibilityLabel: "ツール呼び出しの表示を選択({{value}})",
options: {
overview: "要約",
detailed: "すべての詳細",
+16 -4
View File
@@ -1627,6 +1627,17 @@ export const ko: TranslationResources = {
title: "{{host}}의 비밀번호",
label: "호스트 비밀번호",
},
hostConfirmation: {
title: "이 호스트에 연결할까요?",
description:
"이 호스트는 이 앱에서 코드를 실행하고 연결된 다른 호스트에 접근할 수 있게 됩니다. 알고 있는 호스트인 경우에만 연결하세요.",
descriptionChanged:
"이 링크는 이 호스트에 연결하는 방식을 변경합니다. 호스트는 이 앱에서 코드를 실행하고 연결된 다른 호스트에 접근할 수 있게 됩니다. 알고 있는 호스트인 경우에만 연결하세요.",
hostLabel: "호스트",
fingerprintLabel: "키 지문",
relayLabel: "릴레이",
connect: "연결",
},
connectionMethods: {
title: "연결 추가",
direct: {
@@ -1963,8 +1974,11 @@ export const ko: TranslationResources = {
groupInfo: "{{title}} 정보",
sections: {
general: "일반",
chat: "채팅",
appearance: "모양",
layout: en.settings.sections.layout,
sidebar: "사이드바",
terminal: "터미널",
browser: "브라우저",
editor: "편집기",
shortcuts: "단축키",
integrations: "통합",
@@ -2023,6 +2037,7 @@ export const ko: TranslationResources = {
},
general: {
title: "일반",
sending: "전송",
browserData: {
title: "브라우저 데이터",
siteData: "쿠키 및 사이트 데이터",
@@ -2051,8 +2066,6 @@ export const ko: TranslationResources = {
},
},
serviceUrls: {
label: "서비스 URL",
description: "실행 중인 스크립트의 URL을 열 위치",
options: {
ask: "물어보기",
inApp: "Paseo에서",
@@ -2071,7 +2084,6 @@ export const ko: TranslationResources = {
toolCallDetail: {
label: "도구 호출 표시",
description: "타임라인에 도구 호출이 표시되는 방식",
accessibilityLabel: "도구 호출 표시 선택({{value}})",
options: {
overview: "요약",
detailed: "전체 세부정보",
+16 -4
View File
@@ -1648,6 +1648,17 @@ export const ptBR: TranslationResources = {
title: "Senha de {{host}}",
label: "Senha do host",
},
hostConfirmation: {
title: "Conectar a este host?",
description:
"Este host poderá executar código neste app e acessar seus outros hosts conectados. Conecte apenas se você o reconhecer.",
descriptionChanged:
"Este link muda como você se conecta a este host. O host poderá executar código neste app e acessar seus outros hosts conectados. Conecte apenas se você o reconhecer.",
hostLabel: "Host",
fingerprintLabel: "Impressão da chave",
relayLabel: "Relay",
connect: "Conectar",
},
connectionMethods: {
title: "Adicionar conexão",
direct: {
@@ -1986,8 +1997,11 @@ export const ptBR: TranslationResources = {
groupInfo: "Sobre {{title}}",
sections: {
general: "Geral",
chat: "Chat",
appearance: "Aparência",
layout: en.settings.sections.layout,
sidebar: "Barra lateral",
terminal: "Terminal",
browser: "Navegador",
editor: "Editor",
shortcuts: "Atalhos",
integrations: "Integrações",
@@ -2046,6 +2060,7 @@ export const ptBR: TranslationResources = {
},
general: {
title: "Geral",
sending: "Envio",
browserData: {
title: "Dados do navegador",
siteData: "Cookies e dados de sites",
@@ -2074,8 +2089,6 @@ export const ptBR: TranslationResources = {
},
},
serviceUrls: {
label: "URLs de serviço",
description: "Onde abrir URLs de scripts em execução",
options: {
ask: "Perguntar",
inApp: "No Paseo",
@@ -2095,7 +2108,6 @@ export const ptBR: TranslationResources = {
toolCallDetail: {
label: "Exibição de chamadas de ferramentas",
description: "Como as chamadas de ferramentas aparecem na linha do tempo",
accessibilityLabel: "Selecionar exibição de chamadas de ferramentas ({{value}})",
options: {
overview: "Resumo",
detailed: "Detalhes completos",
+16 -4
View File
@@ -1646,6 +1646,17 @@ export const ru: TranslationResources = {
title: "Пароль для {{host}}",
label: "Пароль хоста",
},
hostConfirmation: {
title: "Подключиться к этому хосту?",
description:
"Этот хост сможет выполнять код в приложении и обращаться к другим вашим подключённым хостам. Подключайтесь, только если узнаёте его.",
descriptionChanged:
"Эта ссылка меняет способ подключения к этому хосту. Хост сможет выполнять код в приложении и обращаться к другим вашим подключённым хостам. Подключайтесь, только если узнаёте его.",
hostLabel: "Хост",
fingerprintLabel: "Отпечаток ключа",
relayLabel: "Реле",
connect: "Подключить",
},
connectionMethods: {
title: "Добавить подключение",
direct: {
@@ -1986,8 +1997,11 @@ export const ru: TranslationResources = {
groupInfo: "О разделе «{{title}}»",
sections: {
general: "Основные",
chat: "Чат",
appearance: "Оформление",
layout: en.settings.sections.layout,
sidebar: "Боковая панель",
terminal: "Терминал",
browser: "Браузер",
editor: "Редактор",
shortcuts: "Сочетания клавиш",
integrations: "Интеграции",
@@ -2046,6 +2060,7 @@ export const ru: TranslationResources = {
},
general: {
title: "Основные",
sending: "Отправка",
browserData: {
title: "Данные браузера",
siteData: "Файлы cookie и данные сайтов",
@@ -2075,8 +2090,6 @@ export const ru: TranslationResources = {
},
},
serviceUrls: {
label: "URL-адреса сервисов",
description: "Где открывать URL-адреса запущенных скриптов",
options: {
ask: "Спрашивать",
inApp: "В Paseo",
@@ -2096,7 +2109,6 @@ export const ru: TranslationResources = {
toolCallDetail: {
label: "Отображение вызовов инструментов",
description: "Как вызовы инструментов отображаются на временной шкале",
accessibilityLabel: "Выбрать отображение вызовов инструментов ({{value}})",
options: {
overview: "Сводка",
detailed: "Все подробности",
+15 -4
View File
@@ -1600,6 +1600,16 @@ export const zhCN: TranslationResources = {
title: "{{host}} 的密码",
label: "主机密码",
},
hostConfirmation: {
title: "连接到此主机?",
description: "此主机将能在此应用中运行代码,并访问你其他已连接的主机。仅在你认识它时才连接。",
descriptionChanged:
"此链接会改变你连接此主机的方式。该主机将能在此应用中运行代码,并访问你其他已连接的主机。仅在你认识它时才连接。",
hostLabel: "主机",
fingerprintLabel: "密钥指纹",
relayLabel: "中继",
connect: "连接",
},
connectionMethods: {
title: "添加连接",
direct: {
@@ -1932,8 +1942,11 @@ export const zhCN: TranslationResources = {
groupInfo: "关于 {{title}}",
sections: {
general: "通用",
chat: "聊天",
appearance: "外观",
layout: en.settings.sections.layout,
sidebar: "侧边栏",
terminal: "终端",
browser: "浏览器",
editor: "编辑器",
shortcuts: "快捷键",
integrations: "集成",
@@ -1991,6 +2004,7 @@ export const zhCN: TranslationResources = {
},
general: {
title: "通用",
sending: "发送",
browserData: {
title: "浏览器数据",
siteData: "Cookie 和网站数据",
@@ -2016,8 +2030,6 @@ export const zhCN: TranslationResources = {
},
},
serviceUrls: {
label: "服务 URL",
description: "运行脚本中的 URL 打开位置",
options: {
ask: "询问",
inApp: "在 Paseo 中",
@@ -2036,7 +2048,6 @@ export const zhCN: TranslationResources = {
toolCallDetail: {
label: "工具调用显示",
description: "工具调用在时间线中的显示方式",
accessibilityLabel: "选择工具调用显示方式({{value}})",
options: {
overview: "摘要",
detailed: "完整详情",
@@ -0,0 +1,97 @@
import type { ConnectionOffer } from "@getpaseo/protocol/connection-offer";
import {
hostHasConnection,
relayConnectionFromOffer,
type HostProfile,
} from "@/types/host-connection";
/**
* The question shown before a pairing link adds a host that is not saved, or
* changes the key, relay, or TLS setting of a saved one.
*/
export interface HostConfirmationRequest {
/** Identifies this question, so an answer shown for it never answers a newer one. */
id: number;
serverId: string;
/** Grouped daemon public key the user can compare with the one their daemon shows. */
keyFingerprint: string;
relayEndpoint: string;
kind: "newHost" | "changedConnection";
}
interface PendingConfirmation {
request: HostConfirmationRequest;
resolve: (approved: boolean) => void;
}
/**
* Owns the one host confirmation the app is waiting on. The host runtime asks
* through `confirmLink`; the view reads `getPending` and replies with `answer`.
* A question waits until it is answered, whether or not a view is showing it.
*/
export class HostConfirmations {
private pending: PendingConfirmation | null = null;
private nextRequestId = 1;
private listeners = new Set<() => void>();
getPending(): HostConfirmationRequest | null {
return this.pending?.request ?? null;
}
subscribe(listener: () => void): () => void {
this.listeners.add(listener);
return () => {
this.listeners.delete(listener);
};
}
/** Answers the request with `requestId`; an answer for any other request is ignored. */
answer(requestId: number, approved: boolean): void {
const current = this.pending;
if (!current || current.request.id !== requestId) return;
this.pending = null;
this.emit();
current.resolve(approved);
}
/** Resolves true without asking when the link matches a saved host exactly. */
confirmLink(offer: ConnectionOffer, savedHosts: HostProfile[]): Promise<boolean> {
const connection = relayConnectionFromOffer(offer);
const savedHost = savedHosts.find((host) => host.serverId === offer.serverId);
if (savedHost && hostHasConnection(savedHost, connection)) return Promise.resolve(true);
return this.ask({
id: this.nextRequestId++,
serverId: offer.serverId,
keyFingerprint: formatDaemonKeyFingerprint(connection.daemonPublicKeyB64),
relayEndpoint: connection.relayEndpoint,
kind: savedHost ? "changedConnection" : "newHost",
});
}
private ask(request: HostConfirmationRequest): Promise<boolean> {
// One question at a time: a newer one cancels the unanswered one.
this.pending?.resolve(false);
return new Promise<boolean>((resolve) => {
this.pending = { request, resolve };
this.emit();
});
}
private emit(): void {
for (const listener of this.listeners) {
listener();
}
}
}
/**
* Shows the key material itself (not a re-hash) in groups of four. Keys longer
* than 16 characters show only their first and last 8, so two keys that share
* both ends show the same value.
*/
function formatDaemonKeyFingerprint(daemonPublicKeyB64: string): string {
const normalized = daemonPublicKeyB64.replace(/[^A-Za-z0-9]/g, "");
const group = (value: string): string => value.replace(/(.{4})/g, "$1 ").trim();
if (normalized.length <= 16) return group(normalized);
return `${group(normalized.slice(0, 8))} … ${group(normalized.slice(-8))}`;
}
+321 -110
View File
@@ -31,6 +31,7 @@ import type { ReplicaRow, ReplicaRowStore } from "./replica-cache/row-store";
import { subscriptionFixture } from "./subscription-fixture";
import { readDesktopManagedLocalCredential } from "@/desktop/daemon/local-credential";
import type { HostConfirmationRequest } from "./host-confirmation";
it("requests the managed connection credential through desktop main without a web hint", async () => {
const requests: string[] = [];
@@ -496,6 +497,63 @@ function makeConnectedProbeClient(latencyMs: number): FakeDaemonClient {
return client;
}
/**
* Answers every host confirmation the store asks, the way the sheet does, and
* records each request.
*/
function answerHostConfirmations(
store: HostRuntimeStore,
answer: boolean | ((request: HostConfirmationRequest, index: number) => boolean),
): HostConfirmationRequest[] {
const requests: HostConfirmationRequest[] = [];
store.subscribeHostConfirmation(() => {
const pending = store.getPendingHostConfirmation();
if (!pending) return;
requests.push(pending);
store.answerHostConfirmation(
pending.id,
typeof answer === "function" ? answer(pending, requests.length - 1) : answer,
);
});
return requests;
}
function requirePendingConfirmation(store: HostRuntimeStore): HostConfirmationRequest {
const pending = store.getPendingHostConfirmation();
if (!pending) throw new Error("Expected a pending host confirmation");
return pending;
}
function createPairingStore(
input: {
hostname?: string;
password?: string;
connectAttempts?: string[];
serverIdForHost?: (host: HostProfile) => string;
storage?: HostRuntimeStorage;
} = {},
): HostRuntimeStore {
return new HostRuntimeStore({
storage: input.storage ?? createMemoryHostRuntimeStorage(),
deps: {
createClient: () => new FakeDaemonClient() as unknown as DaemonClient,
connectToDaemon: async ({ host, connection }) => {
input.connectAttempts?.push(connection.id);
if (input.password && host.password !== input.password) {
throw new DaemonAuthenticationError("password_required");
}
return {
client: makeConnectedProbeClient(5) as unknown as DaemonClient,
serverId: input.serverIdForHost?.(host) ?? host.serverId,
hostname: input.hostname ?? "paired",
};
},
getClientId: async () => "cid_pairing",
readInitialConnectionHint: () => null,
},
});
}
function createMemoryHostRuntimeStorage(entries: Record<string, string> = {}): HostRuntimeStorage {
const values = new Map(Object.entries(entries));
return {
@@ -3505,19 +3563,10 @@ describe("HostRuntimeStore", () => {
});
it("uses the advertised hostname when adding a relay host from a pairing offer", async () => {
const store = new HostRuntimeStore({
deps: {
createClient: () => new FakeDaemonClient() as unknown as DaemonClient,
connectToDaemon: async ({ host }) => ({
client: makeConnectedProbeClient(5) as unknown as DaemonClient,
serverId: host.serverId,
hostname: host.label ?? null,
}),
getClientId: async () => "cid_test_runtime",
},
});
const store = createPairingStore({ hostname: "mbp" });
answerHostConfirmations(store, true);
await store.upsertConnectionFromOffer(makeOffer(), "mbp");
await store.beginLinkPairing().submit(encodeOfferUrl(makeOffer()));
const pairedHost = store.getHosts().find((host) => host.serverId === "srv_offer");
expect(pairedHost?.label).toBe("mbp");
@@ -3526,27 +3575,14 @@ describe("HostRuntimeStore", () => {
});
it("stores relay TLS from a pairing offer", async () => {
const store = new HostRuntimeStore({
deps: {
createClient: () => new FakeDaemonClient() as unknown as DaemonClient,
connectToDaemon: async ({ host }) => ({
client: makeConnectedProbeClient(5) as unknown as DaemonClient,
serverId: host.serverId,
hostname: host.label ?? null,
}),
getClientId: async () => "cid_test_runtime",
},
});
const store = createPairingStore();
answerHostConfirmations(store, true);
await store.upsertConnectionFromOffer(
makeOffer({
relay: {
endpoint: "relay.example.com:443",
useTls: true,
},
}),
"tls relay",
);
await store
.beginLinkPairing()
.submit(
encodeOfferUrl(makeOffer({ relay: { endpoint: "relay.example.com:443", useTls: true } })),
);
const pairedHost = store.getHosts().find((host) => host.serverId === "srv_offer");
expect(pairedHost?.connections).toEqual([
@@ -3563,17 +3599,8 @@ describe("HostRuntimeStore", () => {
});
it("uses TLS for old pairing URLs that omit relay TLS on port 443", async () => {
const store = new HostRuntimeStore({
deps: {
createClient: () => new FakeDaemonClient() as unknown as DaemonClient,
connectToDaemon: async ({ host }) => ({
client: makeConnectedProbeClient(5) as unknown as DaemonClient,
serverId: host.serverId,
hostname: host.label ?? null,
}),
getClientId: async () => "cid_test_runtime",
},
});
const store = createPairingStore();
answerHostConfirmations(store, true);
const oldPairingUrl = encodeOfferUrl({
v: 2,
serverId: "srv_offer",
@@ -3581,7 +3608,7 @@ describe("HostRuntimeStore", () => {
relay: { endpoint: "relay.paseo.sh:443" },
});
await store.upsertConnectionFromOfferUrl(oldPairingUrl, "old relay");
await store.importConnectionLink(oldPairingUrl, "openProject");
const pairedHost = store.getHosts().find((host) => host.serverId === "srv_offer");
expect(pairedHost?.connections).toEqual([
@@ -3598,54 +3625,266 @@ describe("HostRuntimeStore", () => {
});
it("probes a pairing link immediately and saves only after admission", async () => {
const store = new HostRuntimeStore({
deps: {
createClient: () => new FakeDaemonClient() as unknown as DaemonClient,
connectToDaemon: async ({ host }) => {
if (host.password !== "correct-password")
throw new DaemonAuthenticationError("password_required");
return {
client: makeConnectedProbeClient(5) as unknown as DaemonClient,
serverId: host.serverId,
hostname: "paired host",
};
},
getClientId: async () => "cid_pairing",
},
});
const store = createPairingStore({ password: "correct-password" });
answerHostConfirmations(store, true);
const offerUrl = encodeOfferUrl(makeOffer());
await expect(store.probeAndUpsertConnectionFromOfferUrl(offerUrl)).rejects.toThrow(
"Password required",
);
const pairing = store.beginLinkPairing();
await expect(pairing.submit(offerUrl)).rejects.toThrow("Password required");
expect(store.getHosts()).toHaveLength(0);
const result = await store.probeAndUpsertConnectionFromOfferUrl(offerUrl, "correct-password");
expect(result.serverId).toBe("srv_offer");
const result = await pairing.submit(offerUrl, "correct-password");
expect(result).toMatchObject({ status: "connected", serverId: "srv_offer" });
expect(store.getHosts()[0]?.password).toBe("correct-password");
store.syncHosts([]);
});
it("preserves the existing host label when re-pairing an existing relay host", async () => {
const store = new HostRuntimeStore({
deps: {
createClient: () => new FakeDaemonClient() as unknown as DaemonClient,
connectToDaemon: async ({ host }) => ({
client: makeConnectedProbeClient(5) as unknown as DaemonClient,
serverId: host.serverId,
hostname: host.label ?? null,
}),
getClientId: async () => "cid_test_runtime",
it("asks before a pairing link adds a new host, and Cancel saves and connects nothing", async () => {
const connectAttempts: string[] = [];
const store = createPairingStore({ connectAttempts });
const requests = answerHostConfirmations(store, false);
const offerUrl = encodeOfferUrl(makeOffer());
const relayLink = "relay://relay.example:443/srv_relay?key=AAAA&ssl=true";
// `#offer=` in the app URL, then a QR scan, then the pair-link and add-host modals.
await expect(store.importConnectionLink(offerUrl, "openProject")).resolves.toEqual({
status: "cancelled",
});
await expect(store.importConnectionLink(offerUrl, "hostRoot")).resolves.toEqual({
status: "cancelled",
});
await expect(store.beginLinkPairing().submit(offerUrl)).resolves.toEqual({
status: "cancelled",
});
await expect(store.beginLinkPairing().submit(relayLink)).resolves.toEqual({
status: "cancelled",
});
expect(requests).toEqual([
...Array.from({ length: 3 }, () => ({
id: expect.any(Number),
serverId: "srv_offer",
keyFingerprint: "pkte stof fer",
relayEndpoint: "relay.paseo.sh:443",
kind: "newHost",
})),
{
id: expect.any(Number),
serverId: "srv_relay",
keyFingerprint: "AAAA",
relayEndpoint: "relay.example:443",
kind: "newHost",
},
storage: createMemoryHostRuntimeStorage(),
});
]);
expect(store.getHosts()).toEqual([]);
expect(connectAttempts).toEqual([]);
store.syncHosts([]);
});
await store.upsertRelayConnection({
it("connects a saved host from a matching pairing link without asking", async () => {
const store = createPairingStore();
const requests = answerHostConfirmations(store, true);
const offerUrl = encodeOfferUrl(makeOffer());
await store.beginLinkPairing().submit(offerUrl);
expect(requests).toHaveLength(1);
await expect(store.importConnectionLink(offerUrl, "openProject")).resolves.toEqual({
status: "connected",
serverId: "srv_offer",
relayEndpoint: "relay.paseo.sh:443",
daemonPublicKeyB64: "pk_test_offer",
label: "Custom name",
});
await expect(store.importConnectionLink(offerUrl, "hostRoot")).resolves.toEqual({
status: "connected",
serverId: "srv_offer",
});
await expect(store.beginLinkPairing().submit(offerUrl)).resolves.toMatchObject({
status: "connected",
});
await store.upsertConnectionFromOffer(makeOffer(), "mbp");
expect(requests).toHaveLength(1);
expect(store.getHosts()).toHaveLength(1);
store.syncHosts([]);
});
it("asks when a pairing link changes a saved host's key, relay, or TLS setting", async () => {
const store = createPairingStore();
const requests = answerHostConfirmations(store, (_request, index) => index === 0);
await store.beginLinkPairing().submit(encodeOfferUrl(makeOffer()));
const savedHosts = store.getHosts();
const changedLinks = [
makeOffer({ daemonPublicKeyB64: "pk_other_key" }),
makeOffer({ relay: { endpoint: "relay.example:443", useTls: false } }),
makeOffer({ relay: { endpoint: "relay.paseo.sh:443", useTls: true } }),
].map(encodeOfferUrl);
for (const link of changedLinks) {
await expect(store.importConnectionLink(link, "openProject")).resolves.toEqual({
status: "cancelled",
});
await expect(store.beginLinkPairing().submit(link)).resolves.toEqual({
status: "cancelled",
});
}
expect(requests.map((request) => request.kind)).toEqual([
"newHost",
...Array.from({ length: 6 }, () => "changedConnection"),
]);
expect(store.getHosts()).toEqual(savedHosts);
store.syncHosts([]);
});
it("asks once per pairing flow and link when the host asks for a password", async () => {
const store = createPairingStore({ password: "correct-password" });
const requests = answerHostConfirmations(store, (_request, index) => index < 2);
const offerUrl = encodeOfferUrl(makeOffer());
const pairing = store.beginLinkPairing();
await expect(pairing.submit(offerUrl)).rejects.toThrow("Password required");
await expect(pairing.submit(offerUrl, "wrong-password")).rejects.toThrow();
expect(requests).toHaveLength(1);
// A new pairing flow for the same link asks again.
await expect(store.beginLinkPairing().submit(offerUrl, "wrong-password")).rejects.toThrow();
expect(requests).toHaveLength(2);
await expect(pairing.submit(offerUrl, "correct-password")).resolves.toMatchObject({
status: "connected",
});
expect(requests).toHaveLength(2);
expect(store.getHosts()[0]).toMatchObject({
serverId: "srv_offer",
password: "correct-password",
});
// A different link in the same flow asks again.
const otherKeyUrl = encodeOfferUrl(makeOffer({ daemonPublicKeyB64: "pk_other_key" }));
await expect(pairing.submit(otherKeyUrl, "correct-password")).resolves.toEqual({
status: "cancelled",
});
expect(requests).toHaveLength(3);
store.syncHosts([]);
});
it("continues a scanned link's password retry without asking again", async () => {
const store = createPairingStore({ password: "correct-password" });
const requests = answerHostConfirmations(store, true);
const link = "relay://relay.example:443/srv_pair?key=AAAA&ssl=true";
const outcome = await store.importConnectionLink(link, "hostRoot");
expect(outcome).toMatchObject({ status: "password_required", link });
expect(store.getHosts()).toHaveLength(0);
if (outcome.status !== "password_required") throw new Error("expected password_required");
await outcome.pairing.submit(outcome.link, "correct-password");
expect(requests).toHaveLength(1);
expect(store.getHosts()[0]).toMatchObject({
serverId: "srv_pair",
password: "correct-password",
});
store.syncHosts([]);
});
it("keeps a host confirmation pending until it is answered, and a newer one cancels it", async () => {
const store = createPairingStore();
const first = store.importConnectionLink(encodeOfferUrl(makeOffer()), "openProject");
await vi.waitFor(() =>
expect(store.getPendingHostConfirmation()).toMatchObject({ serverId: "srv_offer" }),
);
const second = store.importConnectionLink(
encodeOfferUrl(makeOffer({ serverId: "srv_second" })),
"openProject",
);
await expect(first).resolves.toEqual({ status: "cancelled" });
await vi.waitFor(() =>
expect(store.getPendingHostConfirmation()).toMatchObject({ serverId: "srv_second" }),
);
store.answerHostConfirmation(requirePendingConfirmation(store).id, true);
await expect(second).resolves.toEqual({ status: "connected", serverId: "srv_second" });
expect(store.getPendingHostConfirmation()).toBeNull();
expect(store.getHosts().map((host) => host.serverId)).toEqual(["srv_second"]);
store.syncHosts([]);
});
it("ignores an answer for a host confirmation that a newer one replaced", async () => {
const store = createPairingStore();
const first = store.importConnectionLink(encodeOfferUrl(makeOffer()), "openProject");
await vi.waitFor(() =>
expect(store.getPendingHostConfirmation()).toMatchObject({ serverId: "srv_offer" }),
);
const firstRequest = requirePendingConfirmation(store);
const second = store.importConnectionLink(
encodeOfferUrl(makeOffer({ serverId: "srv_second" })),
"openProject",
);
await expect(first).resolves.toEqual({ status: "cancelled" });
// Connect tapped on the first sheet as the second link arrives.
store.answerHostConfirmation(firstRequest.id, true);
const secondRequest = requirePendingConfirmation(store);
expect(secondRequest.serverId).toBe("srv_second");
store.answerHostConfirmation(secondRequest.id, false);
await expect(second).resolves.toEqual({ status: "cancelled" });
expect(store.getHosts()).toEqual([]);
});
it("waits for saved hosts to load before deciding whether a pairing link asks", async () => {
const savedHost = makeHost({
serverId: "srv_offer",
connections: [
{
id: "relay:relay.paseo.sh:443",
type: "relay",
relayEndpoint: "relay.paseo.sh:443",
useTls: false,
daemonPublicKeyB64: "pk_test_offer",
},
],
});
const store = createPairingStore({
storage: createMemoryHostRuntimeStorage({
"@paseo:daemon-registry": JSON.stringify([savedHost]),
"@paseo:e2e": "1",
}),
});
const requests = answerHostConfirmations(store, true);
await expect(
store.importConnectionLink(encodeOfferUrl(makeOffer()), "openProject"),
).resolves.toEqual({ status: "connected", serverId: "srv_offer" });
expect(requests).toEqual([]);
expect(store.getHosts().map((host) => host.serverId)).toEqual(["srv_offer"]);
store.syncHosts([]);
});
it("adds hosts by address and the default localhost without asking", async () => {
const store = createPairingStore({
serverIdForHost: (host) =>
host.connections[0]?.type === "directTcp" ? `srv_${host.connections[0].endpoint}` : "",
});
const requests = answerHostConfirmations(store, false);
await store.boot();
await store.probeAndUpsertDirectConnection({ endpoint: "10.0.0.5:6767" });
expect(requests).toEqual([]);
expect(store.getHosts().map((host) => host.serverId)).toEqual([
"srv_localhost:6767",
"srv_10.0.0.5:6767",
]);
store.syncHosts([]);
});
it("preserves the existing host label when re-pairing an existing relay host", async () => {
const store = createPairingStore({ hostname: "mbp" });
answerHostConfirmations(store, true);
await store.beginLinkPairing().submit(encodeOfferUrl(makeOffer()));
await store.renameHost("srv_offer", "Custom name");
await store.beginLinkPairing().submit(encodeOfferUrl(makeOffer()));
const pairedHost = store.getHosts().find((host) => host.serverId === "srv_offer");
expect(pairedHost?.label).toBe("Custom name");
@@ -3921,35 +4160,6 @@ describe("HostRuntimeStore initial connection hint bootstrap", () => {
expect(probeAttempts).toBe(attemptsBeforeRetry);
store.syncHosts([]);
});
it("imports a pairing link after a password retry in the add flow", async () => {
const store = new HostRuntimeStore({
storage: createMemoryHostRuntimeStorage(),
deps: {
createClient: () => new FakeDaemonClient() as unknown as DaemonClient,
connectToDaemon: async ({ host }) => {
if (host.password !== "correct-password")
throw new DaemonAuthenticationError("password_required");
return {
client: makeConnectedProbeClient(5) as unknown as DaemonClient,
serverId: host.serverId,
hostname: "paired",
};
},
getClientId: async () => "cid_link_import",
},
});
const link = "relay://relay.example:443/srv_pair?key=AAAA&ssl=true";
await expect(store.importConnectionLink(link, "hostRoot")).resolves.toEqual({
status: "password_required",
});
expect(store.getHosts()).toHaveLength(0);
await store.probeAndUpsertConnectionFromOfferUrl(link, "correct-password");
expect(store.getHosts()[0]).toMatchObject({
serverId: "srv_pair",
password: "correct-password",
});
store.syncHosts([]);
});
it("imports a deep link without waiting for admission, then leaves a rejected saved host red", async () => {
const store = new HostRuntimeStore({
storage: createMemoryHostRuntimeStorage(),
@@ -3961,6 +4171,7 @@ describe("HostRuntimeStore initial connection hint bootstrap", () => {
getClientId: async () => "cid_deep_link",
},
});
answerHostConfirmations(store, true);
const link = "relay://relay.example:443/srv_deep?key=AAAA&ssl=true";
await expect(store.importConnectionLink(link, "openProject")).resolves.toEqual({
status: "connected",
+138 -76
View File
@@ -14,6 +14,7 @@ import {
normalizeStoredHostProfile,
upsertHostConnectionInProfiles,
registryHasConnection,
relayConnectionFromOffer,
StoredHostRegistrySchema,
type HostConnection,
type HostProfile,
@@ -29,6 +30,7 @@ import {
} from "@/utils/daemon-endpoints";
import { resolveAppVersion } from "@/utils/app-version";
import { ConnectionOfferSchema, type ConnectionOffer } from "@getpaseo/protocol/connection-offer";
import { HostConfirmations, type HostConfirmationRequest } from "./host-confirmation";
import { shouldUseDesktopDaemon } from "@/desktop/daemon/desktop-daemon";
import { isWeb } from "@/constants/platform";
import { connectToDaemon, getConnectionAuthFailureReason } from "@/utils/test-daemon-connection";
@@ -88,6 +90,27 @@ export type HostRuntimeConnectionStatus = "idle" | "connecting" | "online" | "of
export type PairingNavigationTarget = "openProject" | "hostRoot" | "hostSettings";
export type HostRegistryStatus = "loading" | "ready";
/** One pairing flow started with `HostRuntimeStore.beginLinkPairing`. */
export interface LinkPairing {
/** Probes the linked host and saves it. Connection and password errors throw. */
submit(link: string, password?: string): Promise<LinkPairingResult>;
}
export type LinkPairingResult =
| { status: "connected"; profile: HostProfile; serverId: string; hostname: string | null }
| { status: "cancelled" };
/** A pairing link the user confirmed whose host then asked for a password. */
export interface PasswordRequiredPairing {
link: string;
pairing: LinkPairing;
}
export type ConnectionLinkImport =
| { status: "connected"; serverId: string }
| ({ status: "password_required" } & PasswordRequiredPairing)
| { status: "cancelled" };
export type ActiveConnection =
| { type: "directTcp"; endpoint: string; display: string }
| { type: "directSocket"; endpoint: string; display: "socket" }
@@ -1407,6 +1430,13 @@ function readConfiguredLocalDaemonOverride(): string | null {
return value && value.length > 0 ? value : null;
}
function isSameLinkedConnection(left: ConnectionOffer, right: ConnectionOffer): boolean {
return (
left.serverId === right.serverId &&
equal(relayConnectionFromOffer(left), relayConnectionFromOffer(right))
);
}
function parseOfferConnectionUrl(input: string): { offer: ConnectionOffer; password?: string } {
if (input.trim().startsWith("relay://") || input.includes("#connect=")) {
return parseRelayConnectionUri(input);
@@ -1468,6 +1498,8 @@ export class HostRuntimeStore {
private timelineReplicaByServer = new Map<string, TimelineReplica>();
private configuredOverrideBootstrapInFlight: Promise<void> | null = null;
private bootPromise: Promise<void> | null = null;
private registryLoad: Promise<void> | null = null;
private readonly hostConfirmations = new HostConfirmations();
private storage: HostRuntimeStorage;
private replicaCache: ReplicaCache;
private readonly revokePushNotifications: typeof revokePushNotifications;
@@ -1518,8 +1550,7 @@ export class HostRuntimeStore {
private async runBoot(): Promise<void> {
const override = readConfiguredLocalDaemonOverride();
await this.loadFromStorage();
this.markHostRegistryLoaded();
await this.loadRegistry();
let isE2E: string | null = null;
try {
@@ -1552,6 +1583,13 @@ export class HostRuntimeStore {
}
}
private loadRegistry(): Promise<void> {
if (!this.registryLoad) {
this.registryLoad = this.loadFromStorage().then(() => this.markHostRegistryLoaded());
}
return this.registryLoad;
}
private async loadFromStorage(): Promise<void> {
let shouldPersistHosts = false;
let profiles: HostProfile[] = [];
@@ -1878,7 +1916,7 @@ export class HostRuntimeStore {
});
}
async upsertRelayConnection(input: {
private async upsertRelayConnection(input: {
serverId: string;
relayEndpoint: string;
useTls?: boolean;
@@ -1911,51 +1949,91 @@ export class HostRuntimeStore {
return profile;
}
async upsertConnectionFromOffer(
// A pairing link (a URL, a QR code, or a pasted link) asks the user to
// confirm when it adds a new host or changes a saved host's key, relay, or
// TLS setting. The answer needs the saved hosts, so it waits for them to load.
private async confirmLink(offer: ConnectionOffer): Promise<boolean> {
await this.loadRegistry();
return this.hostConfirmations.confirmLink(offer, this.hosts);
}
getPendingHostConfirmation(): HostConfirmationRequest | null {
return this.hostConfirmations.getPending();
}
subscribeHostConfirmation(listener: () => void): () => void {
return this.hostConfirmations.subscribe(listener);
}
answerHostConfirmation(requestId: number, approved: boolean): void {
this.hostConfirmations.answer(requestId, approved);
}
/**
* Starts one pairing flow, such as one open pairing modal. Once the user
* confirms a link, submitting the same link again in this flow (the
* password retry) does not ask again. A new flow asks again.
*/
beginLinkPairing(): LinkPairing {
let approvedOffer: ConnectionOffer | null = null;
return {
submit: async (link, password) => {
const { offer, password: linkPassword } = parseOfferConnectionUrl(link);
if (!approvedOffer || !isSameLinkedConnection(approvedOffer, offer)) {
if (!(await this.confirmLink(offer))) return { status: "cancelled" };
approvedOffer = offer;
}
const result = await this.probeAndUpsertOffer(offer, password ?? linkPassword);
return { status: "connected", ...result };
},
};
}
async importConnectionLink(
url: string,
target: PairingNavigationTarget,
): Promise<ConnectionLinkImport> {
if (target === "openProject") {
const { offer, password } = parseOfferConnectionUrl(url);
if (!(await this.confirmLink(offer))) return { status: "cancelled" };
const profile = await this.upsertConnectionFromOffer(offer, undefined, password);
return { status: "connected", serverId: profile.serverId };
}
const pairing = this.beginLinkPairing();
try {
const result = await pairing.submit(url);
if (result.status === "cancelled") return result;
return { status: "connected", serverId: result.serverId };
} catch (error) {
if (!getConnectionAuthFailureReason(error)) throw error;
return { status: "password_required", link: url, pairing };
}
}
private async upsertConnectionFromOffer(
offer: ConnectionOffer,
label?: string,
password?: string,
): Promise<HostProfile> {
// COMPAT(oldRelayOfferTls): added in v0.1.73, remove after 2026-11-10.
const useTls = offer.relay.useTls ?? shouldUseTlsForDefaultHostedRelay(offer.relay.endpoint);
const connection = relayConnectionFromOffer(offer);
return this.upsertRelayConnection({
serverId: offer.serverId,
relayEndpoint: offer.relay.endpoint,
useTls,
daemonPublicKeyB64: offer.daemonPublicKeyB64,
relayEndpoint: connection.relayEndpoint,
useTls: connection.useTls,
daemonPublicKeyB64: connection.daemonPublicKeyB64,
label,
password,
});
}
async upsertConnectionFromOfferUrl(
offerUrlOrFragment: string,
label?: string,
password?: string,
): Promise<HostProfile> {
const parsed = parseOfferConnectionUrl(offerUrlOrFragment);
return this.upsertConnectionFromOffer(parsed.offer, label, password ?? parsed.password);
}
async probeAndUpsertConnectionFromOfferUrl(
offerUrlOrFragment: string,
password?: string,
private async probeAndUpsertOffer(
offer: ConnectionOffer,
password: string | undefined,
): Promise<{ profile: HostProfile; serverId: string; hostname: string | null }> {
const parsed = parseOfferConnectionUrl(offerUrlOrFragment);
const offer = parsed.offer;
const credential = password ?? parsed.password;
const useTls = offer.relay.useTls ?? shouldUseTlsForDefaultHostedRelay(offer.relay.endpoint);
const relayEndpoint = normalizeHostPort(offer.relay.endpoint);
const connection: HostConnection = {
id: useTls ? `relay:wss:${relayEndpoint}` : `relay:${relayEndpoint}`,
type: "relay",
relayEndpoint,
useTls,
daemonPublicKeyB64: offer.daemonPublicKeyB64,
};
const connection = relayConnectionFromOffer(offer);
const probeHost: HostProfile = {
serverId: offer.serverId,
...(credential ? { password: credential } : {}),
...(password ? { password } : {}),
label: offer.serverId,
appearance: defaultHostAppearance(),
lifecycle: {},
@@ -1966,27 +2044,10 @@ export class HostRuntimeStore {
};
const { client, hostname } = await this.deps.connectToDaemon({ host: probeHost, connection });
await client.close().catch(() => undefined);
const profile = await this.upsertConnectionFromOffer(offer, hostname ?? undefined, credential);
const profile = await this.upsertConnectionFromOffer(offer, hostname ?? undefined, password);
return { profile, serverId: offer.serverId, hostname };
}
async importConnectionLink(
url: string,
target: PairingNavigationTarget,
): Promise<{ status: "connected"; serverId: string } | { status: "password_required" }> {
if (target === "openProject") {
const profile = await this.upsertConnectionFromOfferUrl(url);
return { status: "connected", serverId: profile.serverId };
}
try {
const { serverId } = await this.probeAndUpsertConnectionFromOfferUrl(url);
return { status: "connected", serverId };
} catch (error) {
if (!getConnectionAuthFailureReason(error)) throw error;
return { status: "password_required" };
}
}
async upsertConnectionFromListen(input: {
listenAddress: string;
serverId: string;
@@ -2726,6 +2787,29 @@ export function useHostRegistryLoaded(): boolean {
);
}
export function useHostConfirmation(): {
pending: HostConfirmationRequest | null;
answer: (approved: boolean) => void;
} {
const store = getHostRuntimeStore();
const pending = useSyncExternalStore(
(onStoreChange) => store.subscribeHostConfirmation(onStoreChange),
() => store.getPendingHostConfirmation(),
() => store.getPendingHostConfirmation(),
);
// The answer is bound to the request this render shows, so a tap never
// answers a request that replaced it.
return useMemo(
() => ({
pending,
answer: (approved: boolean) => {
if (pending) store.answerHostConfirmation(pending.id, approved);
},
}),
[pending, store],
);
}
export interface HostMutations {
upsertDirectConnection: (input: {
serverId: string;
@@ -2746,24 +2830,7 @@ export interface HostMutations {
daemonPort?: number;
label?: string;
}) => Promise<{ profile: HostProfile; serverId: string; hostname: string | null }>;
upsertRelayConnection: (input: {
serverId: string;
relayEndpoint: string;
useTls?: boolean;
daemonPublicKeyB64: string;
label?: string;
password?: string;
}) => Promise<HostProfile>;
upsertConnectionFromOffer: (offer: ConnectionOffer, label?: string) => Promise<HostProfile>;
upsertConnectionFromOfferUrl: (
offerUrlOrFragment: string,
label?: string,
password?: string,
) => Promise<HostProfile>;
probeAndUpsertConnectionFromOfferUrl: (
offerUrlOrFragment: string,
password?: string,
) => Promise<{ profile: HostProfile; serverId: string; hostname: string | null }>;
beginLinkPairing: () => LinkPairing;
renameHost: (serverId: string, label: string) => Promise<void>;
setHostColor: (serverId: string, color: HostColor) => Promise<void>;
setHostBadgeDisplay: (serverId: string, badgeDisplay: HostBadgeDisplay) => Promise<void>;
@@ -2778,12 +2845,7 @@ export function useHostMutations(): HostMutations {
upsertDirectConnection: (input) => store.upsertDirectConnection(input),
probeAndUpsertDirectConnection: (input) => store.probeAndUpsertDirectConnection(input),
probeAndUpsertRemoteSshConnection: (input) => store.probeAndUpsertRemoteSshConnection(input),
upsertRelayConnection: (input) => store.upsertRelayConnection(input),
upsertConnectionFromOffer: (offer, label) => store.upsertConnectionFromOffer(offer, label),
upsertConnectionFromOfferUrl: (url, label, password) =>
store.upsertConnectionFromOfferUrl(url, label, password),
probeAndUpsertConnectionFromOfferUrl: (url, password) =>
store.probeAndUpsertConnectionFromOfferUrl(url, password),
beginLinkPairing: () => store.beginLinkPairing(),
renameHost: (serverId, label) => store.renameHost(serverId, label),
setHostColor: (serverId, color) => store.setHostColor(serverId, color),
setHostBadgeDisplay: (serverId, badgeDisplay) =>
+174 -372
View File
@@ -8,7 +8,6 @@ import {
View,
type PressableStateCallbackType,
} from "react-native";
import { EditingTextInput as TextInput } from "@/components/ui/text-input";
import { useRouter } from "expo-router";
import { useFocusEffect } from "@react-navigation/native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
@@ -38,27 +37,27 @@ import {
Smartphone,
Sparkles,
Blocks,
PanelsTopLeft,
Globe,
PanelLeft,
MessageSquare,
ChevronRight,
} from "lucide-react-native";
import { DropdownTrigger } from "@/components/ui/dropdown-trigger";
import { ComboboxTrigger } from "@/components/ui/combobox-trigger";
import { SidebarHeaderRow } from "@/components/sidebar/sidebar-header-row";
import { SidebarSeparator } from "@/components/sidebar/sidebar-separator";
import { HostPicker as SharedHostPicker } from "@/components/hosts/host-picker";
import { HostStatusDot } from "@/components/host-status-dot";
import { ScreenTitle } from "@/components/headers/screen-title";
import { HeaderIconBadge } from "@/components/headers/header-icon-badge";
import { SettingsSection } from "@/components/settings/headings/settings-section";
import { AppearanceSection } from "@/screens/settings/appearance/appearance-section";
import { LayoutSection } from "@/screens/settings/layout/layout-section";
import { OpenLocationSection } from "@/screens/settings/open-location/open-location-section";
import { TerminalSection } from "@/screens/settings/terminal/terminal-section";
import { ChatSection } from "@/screens/settings/chat/chat-section";
import { SidebarNavSection } from "@/screens/settings/sidebar/sidebar-nav-section";
import { SendingSection } from "@/screens/settings/general/sending-section";
import {
useAppSettings,
useSettings,
parseTerminalScrollbackLines,
type AppSettings,
type SendBehavior,
type ServiceUrlBehavior,
type Settings as EffectiveSettings,
} from "@/hooks/use-settings";
import { useHostRuntimeIsConnected, useHosts } from "@/runtime/host-runtime";
@@ -114,7 +113,6 @@ import {
HostWorkspacesPage,
HostTerminalsPage,
} from "@/screens/settings/host-page";
import { resolvePluginIcon } from "@/plugins/icons";
import { PluginSettingsContent } from "@/plugins/settings";
import { useInstalledPlugins } from "@/plugins/registry";
import { HostPluginsPage } from "@/screens/settings/plugins-page";
@@ -144,48 +142,88 @@ import { isNative, isWeb } from "@/constants/platform";
interface SidebarSectionItem {
id: SettingsSectionSlug;
labelKey: string;
icon: ComponentType<{ size: number; color: string }>;
icon: ComponentType<{ size: number; color: string; strokeWidth?: number }>;
desktopOnly?: boolean;
webOnly?: boolean;
/** The page body, for pages that need nothing from the settings screen. */
Content?: ComponentType;
}
const SIDEBAR_SECTION_ITEMS: SidebarSectionItem[] = [
{ id: "general", labelKey: "settings.sections.general", icon: Settings },
{ id: "appearance", labelKey: "settings.sections.appearance", icon: Palette },
{
id: "layout",
labelKey: "settings.sections.layout",
icon: PanelsTopLeft,
id: "appearance",
labelKey: "settings.sections.appearance",
icon: Palette,
Content: AppearanceSection,
},
{
id: "sidebar",
labelKey: "settings.sections.sidebar",
icon: PanelLeft,
Content: SidebarNavSection,
},
{ id: "chat", labelKey: "settings.sections.chat", icon: MessageSquare, Content: ChatSection },
{
id: "terminal",
labelKey: "settings.sections.terminal",
icon: SquareTerminal,
Content: TerminalSection,
},
{
id: "browser",
labelKey: "settings.sections.browser",
icon: Globe,
desktopOnly: true,
Content: BrowserDataSection,
},
{
id: "editor",
labelKey: "settings.sections.editor",
icon: Code2,
webOnly: true,
Content: EditorSection,
},
{
id: "shortcuts",
labelKey: "settings.sections.shortcuts",
icon: Keyboard,
desktopOnly: true,
Content: KeyboardShortcutsSection,
},
{ id: "editor", labelKey: "settings.sections.editor", icon: Code2, webOnly: true },
{ id: "shortcuts", labelKey: "settings.sections.shortcuts", icon: Keyboard, desktopOnly: true },
{
id: "integrations",
labelKey: "settings.sections.integrations",
icon: Puzzle,
desktopOnly: true,
Content: IntegrationsSection,
},
{
id: "notifications",
labelKey: "settings.sections.notifications",
icon: Bell,
desktopOnly: true,
Content: DesktopNotificationsSection,
},
{
id: "permissions",
labelKey: "settings.sections.permissions",
icon: Shield,
desktopOnly: true,
Content: DesktopPermissionsSection,
},
{ id: "diagnostics", labelKey: "settings.sections.diagnostics", icon: Stethoscope },
{ id: "about", labelKey: "settings.sections.about", icon: Info },
];
function isSectionAvailable(item: SidebarSectionItem, isDesktopApp: boolean): boolean {
return (!item.desktopOnly || isDesktopApp) && (!item.webOnly || isWeb);
}
interface HostSectionItem {
id: HostSectionSlug;
labelKey: string;
icon: ComponentType<{ size: number; color: string }>;
icon: ComponentType<{ size: number; color: string; strokeWidth?: number }>;
}
const HOST_SECTION_ITEMS: HostSectionItem[] = [
@@ -236,10 +274,6 @@ function renderHostSettingsContent(
// Trigger + sidebar style helpers
// ---------------------------------------------------------------------------
function themeTriggerStyle({ pressed }: PressableStateCallbackType) {
return [styles.themeTrigger, pressed && { opacity: 0.85 }];
}
function sidebarItemStyle({ hovered }: PressableStateCallbackType & { hovered?: boolean }) {
return [sidebarStyles.item, Boolean(hovered) && sidebarStyles.itemHovered];
}
@@ -252,82 +286,18 @@ function selectedSidebarItemStyle({ hovered }: PressableStateCallbackType & { ho
];
}
function getSendBehaviorOptions(t: TFunction) {
return [
{ value: "interrupt" as const, label: t("settings.general.defaultSend.options.interrupt") },
{ value: "steer" as const, label: t("settings.general.defaultSend.options.steer") },
{ value: "queue" as const, label: t("settings.general.defaultSend.options.queue") },
];
}
function getServiceUrlBehaviorLabel(t: TFunction, value: ServiceUrlBehavior): string {
const labels: Record<ServiceUrlBehavior, string> = {
ask: t("settings.general.serviceUrls.options.ask"),
"in-app": t("settings.general.serviceUrls.options.inApp"),
external: t("settings.general.serviceUrls.options.external"),
};
return labels[value];
}
function getActiveLocale(language: string | undefined): SupportedLocale {
const parsed = parseAppLanguage(language);
return parsed && parsed !== "system" ? parsed : "en";
}
const SERVICE_URL_BEHAVIOR_VALUES: ServiceUrlBehavior[] = ["ask", "in-app", "external"];
// ---------------------------------------------------------------------------
// Section components
// ---------------------------------------------------------------------------
interface GeneralSectionProps {
settings: AppSettings;
isDesktopApp: boolean;
handleSendBehaviorChange: (behavior: SendBehavior) => void;
handleServiceUrlBehaviorChange: (behavior: ServiceUrlBehavior) => void;
handleLanguageChange: (language: AppLanguage) => void;
handleTerminalScrollbackLinesChange: (lines: number) => void;
}
interface ServiceUrlBehaviorMenuItemProps {
value: ServiceUrlBehavior;
label: string;
selected: boolean;
onChange: (value: ServiceUrlBehavior) => void;
}
interface SendBehaviorMenuItemProps {
value: SendBehavior;
label: string;
selected: boolean;
onChange: (value: SendBehavior) => void;
}
function SendBehaviorMenuItem({ value, label, selected, onChange }: SendBehaviorMenuItemProps) {
const handleSelect = useCallback(() => {
onChange(value);
}, [onChange, value]);
return (
<DropdownMenuItem selected={selected} onSelect={handleSelect}>
{label}
</DropdownMenuItem>
);
}
function ServiceUrlBehaviorMenuItem({
value,
label,
selected,
onChange,
}: ServiceUrlBehaviorMenuItemProps) {
const handleSelect = useCallback(() => {
onChange(value);
}, [onChange, value]);
return (
<DropdownMenuItem selected={selected} onSelect={handleSelect}>
{label}
</DropdownMenuItem>
);
}
interface LanguageMenuItemProps {
@@ -354,21 +324,9 @@ function LanguageMenuItem({ value, activeLocale, selected, onChange }: LanguageM
);
}
function GeneralSection({
settings,
isDesktopApp,
handleSendBehaviorChange,
handleServiceUrlBehaviorChange,
handleLanguageChange,
handleTerminalScrollbackLinesChange,
}: GeneralSectionProps) {
function GeneralSection({ settings, handleLanguageChange }: GeneralSectionProps) {
const { t, i18n } = useTranslation();
const activeLocale = getActiveLocale(i18n.language);
const sendBehaviorOptions = useMemo(() => getSendBehaviorOptions(t), [t]);
const selectedSendBehaviorLabel =
sendBehaviorOptions.find((option) => option.value === settings.sendBehavior)?.label ??
settings.sendBehavior;
const sendBehaviorDescriptionKey = `settings.general.defaultSend.descriptions.${settings.sendBehavior}`;
const selectedLanguageOption = LANGUAGE_OPTIONS.find(
(option) => option.value === settings.language,
);
@@ -379,72 +337,17 @@ function GeneralSection({
t(selectedLanguageOption.labelKey),
)
: settings.language;
const [terminalScrollbackValue, setTerminalScrollbackValue] = useState(
String(settings.terminalScrollbackLines),
);
const handleTerminalScrollbackChangeText = useCallback((value: string) => {
setTerminalScrollbackValue(value.replace(/[^\d]/g, ""));
}, []);
const commitTerminalScrollback = useCallback(() => {
const parsed = parseTerminalScrollbackLines(terminalScrollbackValue);
const nextValue = parsed ?? settings.terminalScrollbackLines;
setTerminalScrollbackValue(String(nextValue));
if (nextValue !== settings.terminalScrollbackLines) {
handleTerminalScrollbackLinesChange(nextValue);
}
}, [
handleTerminalScrollbackLinesChange,
settings.terminalScrollbackLines,
terminalScrollbackValue,
]);
useEffect(() => {
setTerminalScrollbackValue(String(settings.terminalScrollbackLines));
}, [settings.terminalScrollbackLines]);
return (
<SettingsSection title={t("settings.general.title")}>
<View style={settingsStyles.card}>
<View style={settingsStyles.row}>
<View style={settingsStyles.rowContent}>
<Text style={settingsStyles.rowTitle}>{t("settings.general.defaultSend.label")}</Text>
<Text style={settingsStyles.rowHint}>{t(sendBehaviorDescriptionKey)}</Text>
</View>
<DropdownMenu>
<DropdownTrigger
accessibilityRole="button"
accessibilityLabel={`${t("settings.general.defaultSend.label")}: ${selectedSendBehaviorLabel}`}
style={themeTriggerStyle}
>
<Text style={styles.themeTriggerText}>{selectedSendBehaviorLabel}</Text>
</DropdownTrigger>
<DropdownMenuContent side="bottom" align="end" width={200}>
{sendBehaviorOptions.map((option) => (
<SendBehaviorMenuItem
key={option.value}
value={option.value}
label={option.label}
selected={settings.sendBehavior === option.value}
onChange={handleSendBehaviorChange}
/>
))}
</DropdownMenuContent>
</DropdownMenu>
</View>
<View style={[settingsStyles.row, settingsStyles.rowBorder]}>
<View style={settingsStyles.rowContent}>
<Text style={settingsStyles.rowTitle}>{t("settings.general.language.label")}</Text>
<Text style={settingsStyles.rowHint}>{t("settings.general.language.description")}</Text>
</View>
<DropdownMenu>
<DropdownTrigger
accessibilityRole="button"
accessibilityLabel={selectedLanguageLabel}
style={themeTriggerStyle}
>
<Text style={styles.themeTriggerText}>{selectedLanguageLabel}</Text>
<DropdownTrigger accessibilityRole="button" accessibilityLabel={selectedLanguageLabel}>
{selectedLanguageLabel}
</DropdownTrigger>
<DropdownMenuContent side="bottom" align="end" width={300}>
{LANGUAGE_OPTIONS.map((option) => (
@@ -459,55 +362,6 @@ function GeneralSection({
</DropdownMenuContent>
</DropdownMenu>
</View>
{isDesktopApp ? (
<View style={[settingsStyles.row, settingsStyles.rowBorder]}>
<View style={settingsStyles.rowContent}>
<Text style={settingsStyles.rowTitle}>{t("settings.general.serviceUrls.label")}</Text>
<Text style={settingsStyles.rowHint}>
{t("settings.general.serviceUrls.description")}
</Text>
</View>
<DropdownMenu>
<DropdownTrigger style={themeTriggerStyle}>
<Text style={styles.themeTriggerText}>
{getServiceUrlBehaviorLabel(t, settings.serviceUrlBehavior)}
</Text>
</DropdownTrigger>
<DropdownMenuContent side="bottom" align="end" width={200}>
{SERVICE_URL_BEHAVIOR_VALUES.map((value) => (
<ServiceUrlBehaviorMenuItem
key={value}
value={value}
label={getServiceUrlBehaviorLabel(t, value)}
selected={settings.serviceUrlBehavior === value}
onChange={handleServiceUrlBehaviorChange}
/>
))}
</DropdownMenuContent>
</DropdownMenu>
</View>
) : null}
<View style={[settingsStyles.row, settingsStyles.rowBorder]}>
<View style={settingsStyles.rowContent}>
<Text style={settingsStyles.rowTitle}>
{t("settings.general.terminalScrollback.label")}
</Text>
<Text style={settingsStyles.rowHint}>
{t("settings.general.terminalScrollback.description")}
</Text>
</View>
<TextInput
initialValue={terminalScrollbackValue}
onChangeText={handleTerminalScrollbackChangeText}
onBlur={commitTerminalScrollback}
onSubmitEditing={commitTerminalScrollback}
keyboardType="number-pad"
inputMode="numeric"
selectTextOnFocus
style={styles.terminalScrollbackInput}
accessibilityLabel={t("settings.general.terminalScrollback.accessibilityLabel")}
/>
</View>
</View>
</SettingsSection>
);
@@ -889,11 +743,14 @@ function useSortedHosts(hosts: HostProfile[], localServerId: string | null): Hos
interface SidebarSectionButtonProps {
itemId: SettingsSectionSlug;
label: string;
icon: ComponentType<{ size: number; color: string }>;
icon: ComponentType<{ size: number; color: string; strokeWidth?: number }>;
isSelected: boolean;
onSelect: (section: SettingsSectionSlug) => void;
}
// Lighter than lucide's default 2px stroke so the nav reads quieter than the content.
const SIDEBAR_ICON_STROKE_WIDTH = 1.5;
function SidebarSectionButton({
itemId,
label,
@@ -920,6 +777,7 @@ function SidebarSectionButton({
<IconComponent
size={theme.iconSize.md}
color={isSelected ? theme.colors.foreground : theme.colors.foregroundMuted}
strokeWidth={SIDEBAR_ICON_STROKE_WIDTH}
/>
<Text style={labelStyle} numberOfLines={1}>
{label}
@@ -931,7 +789,7 @@ function SidebarSectionButton({
interface SidebarHostSectionButtonProps {
itemId: HostSectionSlug;
label: string;
icon: ComponentType<{ size: number; color: string }>;
icon: ComponentType<{ size: number; color: string; strokeWidth?: number }>;
isSelected: boolean;
onSelect: (section: HostSectionSlug) => void;
}
@@ -963,6 +821,7 @@ function SidebarHostSectionButton({
<IconComponent
size={theme.iconSize.md}
color={isSelected ? theme.colors.foreground : theme.colors.foregroundMuted}
strokeWidth={SIDEBAR_ICON_STROKE_WIDTH}
/>
<Text style={labelStyle} numberOfLines={1}>
{label}
@@ -1082,9 +941,7 @@ function SettingsSidebar({
const hasHosts = sortedHosts.length > 0;
const enableBuiltInDaemonOption = useEnableBuiltInDaemonOption();
const isDesktopApp = isElectronRuntime();
const items = SIDEBAR_SECTION_ITEMS.filter(
(item) => (!item.desktopOnly || isDesktopApp) && (!item.webOnly || isWeb),
);
const items = SIDEBAR_SECTION_ITEMS.filter((item) => isSectionAvailable(item, isDesktopApp));
const insets = useSafeAreaInsets();
const isDesktop = layout === "desktop";
const outerContainerStyle = useMemo(
@@ -1116,7 +973,6 @@ function SettingsSidebar({
/>
))}
</View>
<SidebarSeparator />
{hasHosts ? (
<View style={sidebarStyles.list}>
<Text style={sidebarStyles.groupLabel}>{t("settings.groups.host")}</Text>
@@ -1147,7 +1003,11 @@ function SettingsSidebar({
testID="settings-add-host"
style={sidebarItemStyle}
>
<Plus size={theme.iconSize.md} color={theme.colors.foregroundMuted} />
<Plus
size={theme.iconSize.md}
color={theme.colors.foregroundMuted}
strokeWidth={SIDEBAR_ICON_STROKE_WIDTH}
/>
<Text style={sidebarStyles.label} numberOfLines={1}>
{t("settings.addHost")}
</Text>
@@ -1160,7 +1020,11 @@ function SettingsSidebar({
testID="settings-enable-built-in-daemon"
style={sidebarItemStyle}
>
<Server size={theme.iconSize.md} color={theme.colors.foregroundMuted} />
<Server
size={theme.iconSize.md}
color={theme.colors.foregroundMuted}
strokeWidth={SIDEBAR_ICON_STROKE_WIDTH}
/>
<Text style={sidebarStyles.label} numberOfLines={1}>
{t("settings.enableBuiltInDaemon")}
</Text>
@@ -1216,7 +1080,6 @@ export interface SettingsScreenProps {
export default function SettingsScreen({ view, openAddHostIntent = null }: SettingsScreenProps) {
const router = useRouter();
const { theme } = useUnistyles();
const { t } = useTranslation();
const voiceAudioEngine = useVoiceAudioEngineOptional();
const { settings, isLoading: settingsLoading, updateSettings } = useAppSettings();
@@ -1265,20 +1128,6 @@ export default function SettingsScreen({ view, openAddHostIntent = null }: Setti
});
}, [view, selectedSettingsHostServerId, localServerId, hosts, sortedHosts]);
const handleSendBehaviorChange = useCallback(
(behavior: SendBehavior) => {
void updateSettings({ sendBehavior: behavior });
},
[updateSettings],
);
const handleServiceUrlBehaviorChange = useCallback(
(behavior: ServiceUrlBehavior) => {
void updateSettings({ serviceUrlBehavior: behavior });
},
[updateSettings],
);
const handleLanguageChange = useCallback(
(language: AppLanguage) => {
void updateSettings({ language });
@@ -1286,13 +1135,6 @@ export default function SettingsScreen({ view, openAddHostIntent = null }: Setti
[updateSettings],
);
const handleTerminalScrollbackLinesChange = useCallback(
(terminalScrollbackLines: number) => {
void updateSettings({ terminalScrollbackLines });
},
[updateSettings],
);
const handleUseLegacyTerminalRendererChange = useCallback(
(useLegacyTerminalRenderer: boolean) => {
void updateSettings({ useLegacyTerminalRenderer });
@@ -1465,112 +1307,89 @@ export default function SettingsScreen({ view, openAddHostIntent = null }: Setti
const installedPlugins = useInstalledPlugins();
const detailHeader = ((): {
title: string;
Icon: ComponentType<{ size: number; color: string }>;
titleAccessory?: ReactNode;
} | null => {
if (view.kind === "plugin") {
const screen = installedPlugins
.find((plugin) => plugin.serverId === view.serverId && plugin.id === view.pluginId)
?.settingsScreens.find((candidate) => candidate.id === view.screenId);
return {
title: `${view.pluginId} · ${screen?.title ?? t("settings.title")}`,
Icon: screen ? resolvePluginIcon(screen.icon) : Blocks,
};
return { title: `${view.pluginId} · ${screen?.title ?? t("settings.title")}` };
}
if (view.kind === "host") {
const item = HOST_SECTION_ITEMS.find((s) => s.id === view.section);
if (!item) return null;
return { title: t(item.labelKey), Icon: item.icon };
return { title: t(item.labelKey) };
}
if (view.kind === "section") {
const item = SIDEBAR_SECTION_ITEMS.find((s) => s.id === view.section);
if (!item) return null;
return { title: t(item.labelKey), Icon: item.icon };
return { title: t(item.labelKey) };
}
if (view.kind === "project") {
return { title: t("settings.projects"), Icon: FolderGit2 };
return { title: t("settings.projects") };
}
return null;
})();
let content: ReactNode;
if (view.kind === "section" && view.section === "layout") {
content = isDesktopApp ? <LayoutSection /> : null;
} else {
content = (() => {
if (view.kind === "plugin")
return (
<PluginSettingsContent
serverId={view.serverId}
pluginId={view.pluginId}
screenId={view.screenId}
/>
);
if (view.kind === "host") {
return renderHostSettingsContent(view, handleHostRemoved);
const content: ReactNode = (() => {
if (view.kind === "plugin")
return (
<PluginSettingsContent
serverId={view.serverId}
pluginId={view.pluginId}
screenId={view.screenId}
/>
);
if (view.kind === "host") {
return renderHostSettingsContent(view, handleHostRemoved);
}
if (view.kind === "project") {
return (
<ProjectSettingsScreen
serverId={view.serverId}
projectId={view.projectId}
onBackToProjects={handleBackFromDetail}
showBackToProjects={!isCompactLayout}
/>
);
}
if (view.kind === "section") {
const item = SIDEBAR_SECTION_ITEMS.find((candidate) => candidate.id === view.section);
if (!item || !isSectionAvailable(item, isDesktopApp)) return null;
switch (view.section) {
case "general":
return (
<>
<GeneralSection settings={settings} handleLanguageChange={handleLanguageChange} />
<SendingSection />
{isDesktopApp ? <OpenLocationSection /> : null}
</>
);
case "diagnostics":
return (
<DiagnosticsSection
useLegacyTerminalRenderer={settings.useLegacyTerminalRenderer}
onUseLegacyTerminalRendererChange={handleUseLegacyTerminalRendererChange}
voiceAudioEngine={voiceAudioEngine}
isPlaybackTestRunning={isPlaybackTestRunning}
playbackTestResult={playbackTestResult}
handlePlaybackTest={handlePlaybackTest}
/>
);
case "about":
return (
<AboutSection
appVersion={appVersion}
appVersionText={appVersionText}
isDesktopApp={isDesktopApp}
/>
);
default:
return item.Content ? <item.Content /> : null;
}
if (view.kind === "project") {
return (
<ProjectSettingsScreen
serverId={view.serverId}
projectId={view.projectId}
onBackToProjects={handleBackFromDetail}
showBackToProjects={!isCompactLayout}
/>
);
}
if (view.kind === "section") {
switch (view.section) {
case "general":
return (
<>
<GeneralSection
settings={settings}
isDesktopApp={isDesktopApp}
handleSendBehaviorChange={handleSendBehaviorChange}
handleServiceUrlBehaviorChange={handleServiceUrlBehaviorChange}
handleLanguageChange={handleLanguageChange}
handleTerminalScrollbackLinesChange={handleTerminalScrollbackLinesChange}
/>
{isDesktopApp ? <BrowserDataSection /> : null}
</>
);
case "appearance":
return <AppearanceSection />;
case "editor":
return isWeb ? <EditorSection /> : null;
case "shortcuts":
return isDesktopApp ? <KeyboardShortcutsSection /> : null;
case "integrations":
return isDesktopApp ? <IntegrationsSection /> : null;
case "notifications":
return isDesktopApp ? <DesktopNotificationsSection /> : null;
case "permissions":
return isDesktopApp ? <DesktopPermissionsSection /> : null;
case "diagnostics":
return (
<DiagnosticsSection
useLegacyTerminalRenderer={settings.useLegacyTerminalRenderer}
onUseLegacyTerminalRendererChange={handleUseLegacyTerminalRendererChange}
voiceAudioEngine={voiceAudioEngine}
isPlaybackTestRunning={isPlaybackTestRunning}
playbackTestResult={playbackTestResult}
handlePlaybackTest={handlePlaybackTest}
/>
);
case "about":
return (
<AboutSection
appVersion={appVersion}
appVersionText={appVersionText}
isDesktopApp={isDesktopApp}
/>
);
}
}
return null;
})();
}
}
return null;
})();
if (settingsLoading) {
return (
@@ -1580,14 +1399,13 @@ export default function SettingsScreen({ view, openAddHostIntent = null }: Setti
);
}
const desktopDetailHeaderLeft = detailHeader ? (
<>
<HeaderIconBadge>
<detailHeader.Icon size={theme.iconSize.md} color={theme.colors.foregroundMuted} />
</HeaderIconBadge>
<ScreenTitle testID="settings-detail-header-title">{detailHeader.title}</ScreenTitle>
const desktopPageTitle = detailHeader ? (
<View style={styles.pageTitleRow}>
<Text style={styles.pageTitle} testID="settings-detail-header-title">
{detailHeader.title}
</Text>
{detailHeader.titleAccessory}
</>
</View>
) : null;
const addHostModals = (
@@ -1679,13 +1497,14 @@ export default function SettingsScreen({ view, openAddHostIntent = null }: Setti
</WindowChromeRegion>
<WindowChromeRegion corners="top-right">
<View style={desktopStyles.contentPane} testID="settings-detail-pane">
<ScreenHeader
borderless={!detailHeader}
left={desktopDetailHeaderLeft}
leftStyle={desktopStyles.detailLeft}
/>
{/* Keeps the titlebar drag region and window controls; the page
title lives in the content, like a document heading. */}
<ScreenHeader borderless />
<ScrollView style={styles.scrollView} contentContainerStyle={insetBottomStyle}>
<View style={styles.content}>{content}</View>
<View style={styles.content}>
{desktopPageTitle}
{content}
</View>
</ScrollView>
</View>
</WindowChromeRegion>
@@ -1724,6 +1543,19 @@ const styles = StyleSheet.create((theme) => ({
maxWidth: 720,
alignSelf: "center",
},
pageTitleRow: {
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[2],
// Line up with the section titles, which sit inset from their cards.
marginLeft: theme.spacing[1],
marginBottom: theme.spacing[6],
},
pageTitle: {
fontSize: theme.fontSize["4xl"],
fontWeight: theme.fontWeight.medium,
color: theme.colors.foreground,
},
aboutValue: {
color: theme.colors.foregroundMuted,
fontSize: theme.fontSize.base,
@@ -1744,33 +1576,6 @@ const styles = StyleSheet.create((theme) => ({
alignItems: "center",
gap: theme.spacing[2],
},
themeTrigger: {
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[1],
paddingVertical: theme.spacing[1],
paddingHorizontal: theme.spacing[2],
borderRadius: theme.borderRadius.md,
borderWidth: 1,
borderColor: theme.colors.border,
},
themeTriggerText: {
color: theme.colors.foreground,
fontSize: theme.fontSize.base,
},
terminalScrollbackInput: {
width: 112,
minHeight: 36,
paddingVertical: theme.spacing[2],
paddingHorizontal: theme.spacing[3],
borderRadius: theme.borderRadius.md,
borderWidth: 1,
borderColor: theme.colors.border,
backgroundColor: theme.colors.surface2,
color: theme.colors.foreground,
fontSize: theme.fontSize.base,
textAlign: "right",
},
placeholder: {
flex: 1,
alignItems: "center",
@@ -1783,7 +1588,7 @@ const styles = StyleSheet.create((theme) => ({
},
}));
const desktopStyles = StyleSheet.create((theme) => ({
const desktopStyles = StyleSheet.create({
row: {
flex: 1,
flexDirection: "row",
@@ -1791,10 +1596,7 @@ const desktopStyles = StyleSheet.create((theme) => ({
contentPane: {
flex: 1,
},
detailLeft: {
gap: theme.spacing[2],
},
}));
});
const sidebarStyles = StyleSheet.create((theme) => ({
desktopContainer: {
@@ -1816,12 +1618,12 @@ const sidebarStyles = StyleSheet.create((theme) => ({
list: {
paddingVertical: theme.spacing[2],
paddingHorizontal: theme.spacing[2],
gap: theme.spacing[1],
gap: theme.spacing[0.5],
},
groupLabel: {
fontSize: theme.fontSize.base,
fontWeight: theme.fontWeight.medium,
color: theme.colors.foregroundMuted,
fontWeight: theme.fontWeight.normal,
color: theme.colors.foregroundExtraMuted,
paddingHorizontal: theme.spacing[2],
paddingVertical: theme.spacing[1],
},
@@ -1829,8 +1631,8 @@ const sidebarStyles = StyleSheet.create((theme) => ({
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[2],
minHeight: 36,
paddingVertical: theme.spacing[2],
minHeight: 28,
paddingVertical: theme.spacing[1],
paddingHorizontal: theme.spacing[2],
borderRadius: theme.borderRadius.lg,
},
@@ -1850,8 +1652,8 @@ const sidebarStyles = StyleSheet.create((theme) => ({
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[2],
minHeight: 36,
paddingVertical: theme.spacing[2],
minHeight: 28,
paddingVertical: theme.spacing[1],
paddingHorizontal: theme.spacing[2],
borderRadius: theme.borderRadius.lg,
},
@@ -1,9 +1,9 @@
import { Fragment, useCallback, useEffect, useMemo, useState } from "react";
import type { TFunction } from "i18next";
import { useTranslation } from "react-i18next";
import { Text, View, type PressableStateCallbackType } from "react-native";
import { Text, View } from "react-native";
import { StyleSheet, withUnistyles } from "react-native-unistyles";
import { ChevronDown, Monitor, Moon, Sun } from "lucide-react-native";
import { Monitor, Moon, Sun } from "lucide-react-native";
import {
SYNTAX_THEME_OPTIONS,
type SyntaxThemeId,
@@ -14,9 +14,8 @@ import {
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { SettingsCard, SettingsSwitch } from "@/components/settings";
import { DropdownTrigger } from "@/components/ui/dropdown-trigger";
import { SettingsSection } from "@/components/settings/headings/settings-section";
import { useContributedThemes } from "@/appearance/provider";
import { EditingTextInput as TextInput } from "@/components/ui/text-input";
@@ -46,7 +45,6 @@ import { isNative } from "@/constants/platform";
import type { PluginThemeOption } from "@/plugins/themes";
import { settingsStyles } from "@/styles/settings";
import { AppearancePreview } from "./appearance-preview";
import { SidebarNavSection } from "./sidebar-nav-section";
// ---------------------------------------------------------------------------
// Theme-reactive leaf icons (withUnistyles + uniProps color mapping — no
@@ -57,7 +55,6 @@ import { SidebarNavSection } from "./sidebar-nav-section";
const ThemedSun = withUnistyles(Sun);
const ThemedMoon = withUnistyles(Moon);
const ThemedMonitor = withUnistyles(Monitor);
const ThemedChevronDown = withUnistyles(ChevronDown);
const mutedColorMapping = (theme: Theme) => ({ color: theme.colors.foregroundMuted });
@@ -83,10 +80,6 @@ function sizeDraftToOverride(value: string): number | undefined {
return Number.isFinite(parsed) ? parsed : undefined;
}
function dropdownTriggerStyle({ pressed }: PressableStateCallbackType) {
return [styles.trigger, pressed ? styles.triggerPressed : null];
}
// ---------------------------------------------------------------------------
// Theme picker
// ---------------------------------------------------------------------------
@@ -175,26 +168,29 @@ function ThemeRow({
const selectedLabel = selectedPluginTheme
? selectedPluginTheme.name
: getThemeLabel(t, builtInValue);
const leading = useMemo(
() =>
selectedPluginTheme ? (
<ThemeSwatch color={selectedPluginTheme.swatch} />
) : (
<ThemeLeading themeValue={builtInValue} />
),
[builtInValue, selectedPluginTheme],
);
return (
<View style={settingsStyles.row}>
<View style={settingsStyles.rowContent}>
<Text style={settingsStyles.rowTitle}>{t("settings.appearance.theme.title")}</Text>
</View>
<DropdownMenu>
<DropdownMenuTrigger
style={dropdownTriggerStyle}
<DropdownTrigger
accessibilityLabel={t("settings.appearance.theme.accessibilityLabel", {
value: selectedLabel,
})}
leading={leading}
>
{selectedPluginTheme ? (
<ThemeSwatch color={selectedPluginTheme.swatch} />
) : (
<ThemeLeading themeValue={builtInValue} />
)}
<Text style={styles.triggerText}>{selectedLabel}</Text>
<ThemedChevronDown size={ICON_SIZE.sm} uniProps={mutedColorMapping} />
</DropdownMenuTrigger>
{selectedLabel}
</DropdownTrigger>
<DropdownMenuContent side="bottom" align="end" width={200} scrollable>
{THEME_OPTIONS.map((option, index) => {
const previousOption = THEME_OPTIONS[index - 1];
@@ -226,109 +222,6 @@ function ThemeRow({
);
}
interface AutoExpandReasoningRowProps {
value: boolean;
onChange: (value: boolean) => void;
}
function AutoExpandReasoningRow({ value, onChange }: AutoExpandReasoningRowProps) {
const { t } = useTranslation();
return (
<SettingsSwitch
label={t("settings.general.autoExpandReasoning.label")}
hint={t("settings.general.autoExpandReasoning.description")}
value={value}
onValueChange={onChange}
/>
);
}
interface ChatOutlineRowProps {
value: boolean;
onChange: (value: boolean) => void;
}
function ChatOutlineRow({ value, onChange }: ChatOutlineRowProps) {
const { t } = useTranslation();
return (
<SettingsSwitch
label={t("settings.appearance.chatOutline.title")}
hint={t("settings.appearance.chatOutline.description")}
value={value}
onValueChange={onChange}
/>
);
}
const TOOL_CALL_DETAIL_LEVELS: readonly AppSettings["toolCallDetailLevel"][] = [
"detailed",
"overview",
];
function getToolCallDetailLevelLabel(
t: TFunction,
value: AppSettings["toolCallDetailLevel"],
): string {
return t(`settings.general.toolCallDetail.options.${value}`);
}
interface ToolCallDetailMenuItemProps {
value: AppSettings["toolCallDetailLevel"];
selected: boolean;
onChange: (value: AppSettings["toolCallDetailLevel"]) => void;
}
function ToolCallDetailMenuItem({ value, selected, onChange }: ToolCallDetailMenuItemProps) {
const { t } = useTranslation();
const handleSelect = useCallback(() => onChange(value), [onChange, value]);
return (
<DropdownMenuItem selected={selected} onSelect={handleSelect}>
{getToolCallDetailLevelLabel(t, value)}
</DropdownMenuItem>
);
}
interface ToolCallDetailRowProps {
value: AppSettings["toolCallDetailLevel"];
onChange: (value: AppSettings["toolCallDetailLevel"]) => void;
}
function ToolCallDetailRow({ value, onChange }: ToolCallDetailRowProps) {
const { t } = useTranslation();
const selectedLabel = getToolCallDetailLevelLabel(t, value);
return (
<View style={settingsStyles.row}>
<View style={settingsStyles.rowContent}>
<Text style={settingsStyles.rowTitle}>{t("settings.general.toolCallDetail.label")}</Text>
<Text style={settingsStyles.rowHint}>
{t("settings.general.toolCallDetail.description")}
</Text>
</View>
<DropdownMenu>
<DropdownMenuTrigger
style={dropdownTriggerStyle}
accessibilityLabel={t("settings.general.toolCallDetail.accessibilityLabel", {
value: selectedLabel,
})}
>
<Text style={styles.triggerText}>{selectedLabel}</Text>
<ThemedChevronDown size={ICON_SIZE.sm} uniProps={mutedColorMapping} />
</DropdownMenuTrigger>
<DropdownMenuContent side="bottom" align="end" width={200}>
{TOOL_CALL_DETAIL_LEVELS.map((option) => (
<ToolCallDetailMenuItem
key={option}
value={option}
selected={value === option}
onChange={onChange}
/>
))}
</DropdownMenuContent>
</DropdownMenu>
</View>
);
}
// ---------------------------------------------------------------------------
// Fonts: family text fields + numeric size fields (commit on blur/submit)
// ---------------------------------------------------------------------------
@@ -478,15 +371,13 @@ function SyntaxRow({ value, onChange }: SyntaxRowProps) {
</Text>
</View>
<DropdownMenu>
<DropdownMenuTrigger
style={dropdownTriggerStyle}
<DropdownTrigger
accessibilityLabel={t("settings.appearance.syntax.highlightThemeAccessibility", {
value: selectedLabel,
})}
>
<Text style={styles.triggerText}>{selectedLabel}</Text>
<ThemedChevronDown size={ICON_SIZE.sm} uniProps={mutedColorMapping} />
</DropdownMenuTrigger>
{selectedLabel}
</DropdownTrigger>
<DropdownMenuContent side="bottom" align="end" width={200}>
{SYNTAX_THEME_OPTIONS.map((option) => (
<SyntaxMenuItem
@@ -556,27 +447,6 @@ export function AppearanceSection() {
[updateSettings],
);
const handleAutoExpandReasoningChange = useCallback(
(autoExpandReasoning: boolean) => {
void updateSettings({ autoExpandReasoning });
},
[updateSettings],
);
const handleToolCallDetailLevelChange = useCallback(
(toolCallDetailLevel: AppSettings["toolCallDetailLevel"]) => {
void updateSettings({ toolCallDetailLevel });
},
[updateSettings],
);
const handleChatOutlineChange = useCallback(
(chatOutlineEnabled: boolean) => {
void updateSettings({ chatOutlineEnabled });
},
[updateSettings],
);
const commitUiFontFamily = useCallback(
(value: string) => {
const sanitized = sanitizeFontFamily(value);
@@ -680,25 +550,6 @@ export function AppearanceSection() {
/>
</View>
</SettingsSection>
<SettingsSection title={t("settings.appearance.detailLevel.title")}>
<SettingsCard>
<AutoExpandReasoningRow
value={settings.autoExpandReasoning}
onChange={handleAutoExpandReasoningChange}
/>
<ToolCallDetailRow
value={settings.toolCallDetailLevel}
onChange={handleToolCallDetailLevelChange}
/>
{!isNative ? (
<ChatOutlineRow
value={settings.chatOutlineEnabled}
onChange={handleChatOutlineChange}
/>
) : null}
</SettingsCard>
</SettingsSection>
<SidebarNavSection />
<SettingsSection title={t("settings.appearance.fonts.title")}>
<View style={settingsStyles.card}>
{showInterfaceFontFamilyRow ? (
@@ -777,23 +628,6 @@ const styles = StyleSheet.create((theme) => ({
borderTopWidth: theme.borderWidth[1],
borderTopColor: theme.colors.border,
},
trigger: {
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[1],
paddingVertical: theme.spacing[1],
paddingHorizontal: theme.spacing[2],
borderRadius: theme.borderRadius.md,
borderWidth: theme.borderWidth[1],
borderColor: theme.colors.border,
},
triggerPressed: {
opacity: 0.85,
},
triggerText: {
color: theme.colors.foreground,
fontSize: theme.fontSize.base,
},
swatch: {
width: ICON_SIZE.md,
height: ICON_SIZE.md,
@@ -0,0 +1,74 @@
import { useCallback, useMemo } from "react";
import { View } from "react-native";
import { useTranslation } from "react-i18next";
import {
SettingsCard,
SettingsSection,
SettingsSelect,
SettingsSwitch,
} from "@/components/settings";
import { isNative } from "@/constants/platform";
import { useAppSettings, type AppSettings } from "@/hooks/use-settings";
const TOOL_CALL_DETAIL_LEVELS: readonly AppSettings["toolCallDetailLevel"][] = [
"detailed",
"overview",
];
export function ChatSection() {
const { t } = useTranslation();
const { settings, updateSettings } = useAppSettings();
const toolCallDetailOptions = useMemo(
() =>
TOOL_CALL_DETAIL_LEVELS.map((value) => ({
value,
label: t(`settings.general.toolCallDetail.options.${value}`),
})),
[t],
);
const changeToolCallDetailLevel = useCallback(
(toolCallDetailLevel: AppSettings["toolCallDetailLevel"]) =>
void updateSettings({ toolCallDetailLevel }),
[updateSettings],
);
const changeAutoExpandReasoning = useCallback(
(autoExpandReasoning: boolean) => void updateSettings({ autoExpandReasoning }),
[updateSettings],
);
const changeChatOutline = useCallback(
(chatOutlineEnabled: boolean) => void updateSettings({ chatOutlineEnabled }),
[updateSettings],
);
return (
<View>
<SettingsSection title={t("settings.appearance.detailLevel.title")}>
<SettingsCard>
<SettingsSwitch
label={t("settings.general.autoExpandReasoning.label")}
hint={t("settings.general.autoExpandReasoning.description")}
value={settings.autoExpandReasoning}
onValueChange={changeAutoExpandReasoning}
/>
<SettingsSelect
label={t("settings.general.toolCallDetail.label")}
hint={t("settings.general.toolCallDetail.description")}
value={settings.toolCallDetailLevel}
options={toolCallDetailOptions}
onValueChange={changeToolCallDetailLevel}
/>
{isNative ? null : (
<SettingsSwitch
label={t("settings.appearance.chatOutline.title")}
hint={t("settings.appearance.chatOutline.description")}
value={settings.chatOutlineEnabled}
onValueChange={changeChatOutline}
/>
)}
</SettingsCard>
</SettingsSection>
</View>
);
}
@@ -0,0 +1,36 @@
import { useCallback, useMemo } from "react";
import { useTranslation } from "react-i18next";
import { SettingsCard, SettingsSection, SettingsSelect } from "@/components/settings";
import { useAppSettings, type SendBehavior } from "@/hooks/use-settings";
const SEND_BEHAVIORS: readonly SendBehavior[] = ["interrupt", "steer", "queue"];
export function SendingSection() {
const { t } = useTranslation();
const { settings, updateSettings } = useAppSettings();
const options = useMemo(
() =>
SEND_BEHAVIORS.map((value) => ({
value,
label: t(`settings.general.defaultSend.options.${value}`),
})),
[t],
);
const change = useCallback(
(sendBehavior: SendBehavior) => void updateSettings({ sendBehavior }),
[updateSettings],
);
return (
<SettingsSection title={t("settings.general.sending")}>
<SettingsCard>
<SettingsSelect
label={t("settings.general.defaultSend.label")}
hint={t(`settings.general.defaultSend.descriptions.${settings.sendBehavior}`)}
value={settings.sendBehavior}
options={options}
onValueChange={change}
/>
</SettingsCard>
</SettingsSection>
);
}
@@ -1,15 +1,11 @@
import { useCallback, useMemo, useState } from "react";
import type { TFunction } from "i18next";
import { useTranslation } from "react-i18next";
import { Pressable, Text, View, type PressableStateCallbackType } from "react-native";
import { Pressable, Text, View } from "react-native";
import { StyleSheet, withUnistyles } from "react-native-unistyles";
import { ChevronDown, Pencil } from "lucide-react-native";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { Pencil } from "lucide-react-native";
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem } from "@/components/ui/dropdown-menu";
import { DropdownTrigger } from "@/components/ui/dropdown-trigger";
import { AdaptiveRenameModal } from "@/components/rename-modal";
import { WorkspaceMetaRow } from "@/components/sidebar/workspace-meta-row";
import { useToast } from "@/contexts/toast-context";
@@ -28,15 +24,10 @@ import { settingsStyles } from "@/styles/settings";
import { ICON_SIZE, type Theme } from "@/styles/theme";
import type { HostProfile } from "@/types/host-connection";
const ThemedChevronDown = withUnistyles(ChevronDown);
const ThemedPencil = withUnistyles(Pencil);
const mutedColorMapping = (theme: Theme) => ({ color: theme.colors.foregroundMuted });
function dropdownTriggerStyle({ pressed }: PressableStateCallbackType) {
return pressed ? [styles.trigger, styles.triggerPressed] : styles.trigger;
}
function HostRenameButton({ host }: { host: HostProfile }) {
const { t } = useTranslation();
const { renameHost } = useHostMutations();
@@ -119,23 +110,22 @@ function ColorMenuItem({
function ColorRow({ color, onChange }: { color: HostColor; onChange: (color: HostColor) => void }) {
const { t } = useTranslation();
const selectedLabel = colorLabel(t, color);
const leading = useMemo(() => <ColorSwatch color={color} />, [color]);
return (
<View style={[settingsStyles.row, settingsStyles.rowBorder]}>
<View style={settingsStyles.rowContent}>
<Text style={settingsStyles.rowTitle}>{t("settings.host.appearance.color.label")}</Text>
</View>
<DropdownMenu>
<DropdownMenuTrigger
style={dropdownTriggerStyle}
<DropdownTrigger
accessibilityRole="button"
accessibilityLabel={t("settings.host.appearance.color.accessibilityLabel", {
value: selectedLabel,
})}
leading={leading}
>
<ColorSwatch color={color} />
<Text style={styles.triggerText}>{selectedLabel}</Text>
<ThemedChevronDown size={ICON_SIZE.sm} uniProps={mutedColorMapping} />
</DropdownMenuTrigger>
{selectedLabel}
</DropdownTrigger>
<DropdownMenuContent side="bottom" align="end" width={200}>
{HOST_COLORS.map((option) => (
<ColorMenuItem
@@ -166,17 +156,15 @@ function BadgeDisplayRow({
<Text style={settingsStyles.rowTitle}>{t("settings.host.appearance.badge.label")}</Text>
</View>
<DropdownMenu>
<DropdownMenuTrigger
<DropdownTrigger
testID="host-appearance-badge-display"
style={dropdownTriggerStyle}
accessibilityRole="button"
accessibilityLabel={t("settings.host.appearance.badge.accessibilityLabel", {
value: selectedLabel,
})}
>
<Text style={styles.triggerText}>{selectedLabel}</Text>
<ThemedChevronDown size={ICON_SIZE.sm} uniProps={mutedColorMapping} />
</DropdownMenuTrigger>
{selectedLabel}
</DropdownTrigger>
<DropdownMenuContent side="bottom" align="end" width={200}>
{HOST_BADGE_DISPLAYS.map((option) => (
<BadgeDisplayMenuItem
@@ -312,23 +300,6 @@ export function HostAppearanceSection({ host }: { host: HostProfile }) {
}
const styles = StyleSheet.create((theme) => ({
trigger: {
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[1],
paddingVertical: theme.spacing[1],
paddingHorizontal: theme.spacing[2],
borderRadius: theme.borderRadius.md,
borderWidth: theme.borderWidth[1],
borderColor: theme.colors.border,
},
triggerPressed: {
opacity: 0.85,
},
triggerText: {
color: theme.colors.foreground,
fontSize: theme.fontSize.base,
},
swatch: {
width: ICON_SIZE.md,
height: ICON_SIZE.md,
@@ -375,12 +375,6 @@ export function HostSettingsPage({
return (
<View>
<View style={styles.daemonHeader}>
<Text style={styles.daemonHeaderLabel} numberOfLines={1}>
{host.label}
</Text>
</View>
<HostStatusBadges serverId={serverId} />
<HostConnectionError serverId={serverId} />
@@ -1714,18 +1708,6 @@ const styles = StyleSheet.create((theme) => ({
marginHorizontal: theme.spacing[4],
marginBottom: theme.spacing[4],
},
daemonHeader: {
flexDirection: "row",
alignItems: "center",
gap: theme.spacing[1],
marginBottom: theme.spacing[4],
},
daemonHeaderLabel: {
flexShrink: 1,
fontSize: theme.fontSize.base,
fontWeight: theme.fontWeight.medium,
color: theme.colors.foreground,
},
identityBadges: {
flexDirection: "row",
alignItems: "center",
@@ -5,6 +5,7 @@ import {
useAppSettings,
type OpenInSidePanePreferences,
type PullRequestOpenLocation,
type ServiceUrlBehavior,
} from "@/hooks/use-settings";
const SOURCES = [
@@ -15,18 +16,26 @@ const SOURCES = [
"subagents",
] as const satisfies readonly (keyof OpenInSidePanePreferences)[];
type LayoutPreferenceSource = keyof OpenInSidePanePreferences | "pullRequests";
const SERVICE_URL_BEHAVIORS: readonly ServiceUrlBehavior[] = ["ask", "in-app", "external"];
function LayoutPreferenceRow({
const SERVICE_URL_LABEL_KEYS: Record<ServiceUrlBehavior, string> = {
ask: "settings.general.serviceUrls.options.ask",
"in-app": "settings.general.serviceUrls.options.inApp",
external: "settings.general.serviceUrls.options.external",
};
type OpenLocationSource = keyof OpenInSidePanePreferences | "pullRequests";
function OpenLocationRow({
source,
destination,
allowExplorer,
onDestinationChange,
}: {
source: LayoutPreferenceSource;
source: OpenLocationSource;
destination: PullRequestOpenLocation;
allowExplorer?: boolean;
onDestinationChange(source: LayoutPreferenceSource, destination: PullRequestOpenLocation): void;
onDestinationChange(source: OpenLocationSource, destination: PullRequestOpenLocation): void;
}) {
const { t } = useTranslation();
const options = useMemo(() => {
@@ -52,11 +61,34 @@ function LayoutPreferenceRow({
);
}
export function LayoutSection() {
function ServiceUrlRow() {
const { t } = useTranslation();
const { settings, updateSettings } = useAppSettings();
const options = useMemo(
() =>
SERVICE_URL_BEHAVIORS.map((value) => ({ value, label: t(SERVICE_URL_LABEL_KEYS[value]) })),
[t],
);
const change = useCallback(
(serviceUrlBehavior: ServiceUrlBehavior) => void updateSettings({ serviceUrlBehavior }),
[updateSettings],
);
return (
<SettingsSelect
label={t("settings.layout.openInSidePane.sources.serviceUrls.label")}
value={settings.serviceUrlBehavior}
options={options}
onValueChange={change}
/>
);
}
/** Where things open: files, diffs, subagents, pull requests, and script URLs. Desktop only. */
export function OpenLocationSection() {
const { t } = useTranslation();
const { settings, updateSettings } = useAppSettings();
const handleDestinationChange = useCallback(
(source: LayoutPreferenceSource, destination: PullRequestOpenLocation) => {
(source: OpenLocationSource, destination: PullRequestOpenLocation) => {
if (source === "pullRequests") {
void updateSettings({ pullRequestOpenLocation: destination });
return;
@@ -71,19 +103,20 @@ export function LayoutSection() {
<SettingsSection title={t("settings.layout.openInSidePane.title")}>
<SettingsCard>
{SOURCES.map((source) => (
<LayoutPreferenceRow
<OpenLocationRow
key={source}
source={source}
destination={settings.openInSidePane[source] ? "side" : "main"}
onDestinationChange={handleDestinationChange}
/>
))}
<LayoutPreferenceRow
<OpenLocationRow
source="pullRequests"
destination={settings.pullRequestOpenLocation}
allowExplorer
onDestinationChange={handleDestinationChange}
/>
<ServiceUrlRow />
</SettingsCard>
</SettingsSection>
);
@@ -0,0 +1,67 @@
import { useCallback, useEffect, useState } from "react";
import { Text, View } from "react-native";
import { StyleSheet } from "react-native-unistyles";
import { useTranslation } from "react-i18next";
import { SettingsSection } from "@/components/settings";
import { FormTextInput } from "@/components/ui/form-field";
import { parseTerminalScrollbackLines, useAppSettings } from "@/hooks/use-settings";
import { settingsStyles } from "@/styles/settings";
export function TerminalSection() {
const { t } = useTranslation();
const { settings, updateSettings } = useAppSettings();
const [scrollbackValue, setScrollbackValue] = useState(String(settings.terminalScrollbackLines));
const handleChangeText = useCallback((value: string) => {
setScrollbackValue(value.replace(/[^\d]/g, ""));
}, []);
const commitScrollback = useCallback(() => {
const nextValue =
parseTerminalScrollbackLines(scrollbackValue) ?? settings.terminalScrollbackLines;
setScrollbackValue(String(nextValue));
if (nextValue !== settings.terminalScrollbackLines) {
void updateSettings({ terminalScrollbackLines: nextValue });
}
}, [scrollbackValue, settings.terminalScrollbackLines, updateSettings]);
useEffect(() => {
setScrollbackValue(String(settings.terminalScrollbackLines));
}, [settings.terminalScrollbackLines]);
return (
<SettingsSection title={t("settings.sections.terminal")}>
<View style={settingsStyles.card}>
<View style={settingsStyles.row}>
<View style={settingsStyles.rowContent}>
<Text style={settingsStyles.rowTitle}>
{t("settings.general.terminalScrollback.label")}
</Text>
<Text style={settingsStyles.rowHint}>
{t("settings.general.terminalScrollback.description")}
</Text>
</View>
<FormTextInput
size="sm"
initialValue={scrollbackValue}
onChangeText={handleChangeText}
onBlur={commitScrollback}
onSubmitEditing={commitScrollback}
keyboardType="number-pad"
inputMode="numeric"
selectTextOnFocus
style={styles.scrollbackInput}
accessibilityLabel={t("settings.general.terminalScrollback.accessibilityLabel")}
/>
</View>
</View>
</SettingsSection>
);
}
const styles = StyleSheet.create({
scrollbackInput: {
width: 112,
textAlign: "right",
},
});
+16
View File
@@ -159,6 +159,20 @@ const darkStatusColors = {
statusMerged: "#a890d5",
};
// Status tints — the fill of a status badge. The status color itself at low opacity, so a
// badge takes its state's hue from the same source as its text and never drifts from it.
// Dark surfaces swallow more of the tint, so the dark band runs a little stronger.
function statusTints(colors: typeof lightStatusColors, alphaHex: string) {
return {
statusSuccessTint: `${colors.statusSuccess}${alphaHex}`,
statusDangerTint: `${colors.statusDanger}${alphaHex}`,
statusWarningTint: `${colors.statusWarning}${alphaHex}`,
};
}
const lightStatusTints = statusTints(lightStatusColors, "1f"); // 12%
const darkStatusTints = statusTints(darkStatusColors, "29"); // 16%
// Status *dot* colors — the small filled discs on a sidebar row, and the glyphs that stand in
// for them. Same four hues and the same generation rule as the status colors above, but its
// own band, because a dot is doing a different job than a check icon or a host badge.
@@ -289,6 +303,7 @@ export function buildLightSemanticColors(tint: LightThemeConfig) {
...lightDiffColors,
...lightStatusColors,
...lightStatusTints,
...lightStatusDotColors,
terminal: {
@@ -420,6 +435,7 @@ export function buildDarkSemanticColors(tint: DarkThemeConfig) {
...darkDiffColors,
...darkStatusColors,
...darkStatusTints,
...darkStatusDotColors,
terminal: {
+15
View File
@@ -1,6 +1,8 @@
import type { ConnectionOffer } from "@getpaseo/protocol/connection-offer";
import {
normalizeHostPort,
normalizeLoopbackToLocalhost,
shouldUseTlsForDefaultHostedRelay,
} from "@getpaseo/protocol/daemon-endpoints";
import {
DirectTcpHostConnectionSchema,
@@ -354,6 +356,19 @@ export function connectionFromListen(listen: string): HostConnection | null {
}
}
export function relayConnectionFromOffer(offer: ConnectionOffer): RelayHostConnection {
// COMPAT(oldRelayOfferTls): added in v0.1.73, remove after 2026-11-10.
const useTls = offer.relay.useTls ?? shouldUseTlsForDefaultHostedRelay(offer.relay.endpoint);
const relayEndpoint = normalizeHostPort(offer.relay.endpoint);
return {
id: useTls ? `relay:wss:${relayEndpoint}` : `relay:${relayEndpoint}`,
type: "relay",
relayEndpoint,
useTls,
daemonPublicKeyB64: offer.daemonPublicKeyB64.trim(),
};
}
export function createRemoteSshHostConnection(input: {
host: string;
sshPort?: number;
+4 -1
View File
@@ -492,7 +492,10 @@ export function resolveKnownHostRoute(input: {
export const SETTINGS_SECTION_SLUGS = [
"general",
"appearance",
"layout",
"sidebar",
"chat",
"terminal",
"browser",
"editor",
"shortcuts",
"integrations",
@@ -4,6 +4,7 @@ import {
collectAllPanes,
DEFAULT_PANE_ID,
findPaneById,
findPaneContainingTab,
useWorkspaceLayoutStore,
type WorkspaceTabPlacement,
} from "@/stores/workspace-layout-store";
@@ -109,6 +110,10 @@ export function openWorkspaceTargetAtLocation(
if (shouldOpenBeside && !targetAlreadyExists) {
const paneId = store.ensureSidePane(input.workspaceKey);
placement = paneId ? { mode: "prefer", paneId } : undefined;
} else if (!shouldOpenBeside && layout && input.parentTabId) {
// A target opened from a tab belongs in that tab's pane, whichever pane has focus.
const parentPane = findPaneContainingTab(layout.root, input.parentTabId);
placement = parentPane ? { mode: "prefer", paneId: parentPane.id } : undefined;
}
return store.openTab({
workspaceKey: input.workspaceKey,
@@ -136,6 +136,24 @@ describe("resolveWorkspaceFilePaths", () => {
});
});
it("resolves files under a drive-root workspace without doubling the separator", () => {
expect(resolveWorkspaceFilePaths({ path: "C:/src/app.ts", workspaceRoot: "C:\\" })).toEqual({
absolutePath: "C:/src/app.ts",
relativePath: "src/app.ts",
});
expect(resolveWorkspaceFilePaths({ path: "src/app.ts", workspaceRoot: "C:\\" })).toEqual({
absolutePath: "C:/src/app.ts",
relativePath: "src/app.ts",
});
});
it("resolves files under the POSIX root workspace", () => {
expect(resolveWorkspaceFilePaths({ path: "/src/app.ts", workspaceRoot: "/" })).toEqual({
absolutePath: "/src/app.ts",
relativePath: "src/app.ts",
});
});
it("returns null for home-relative paths that cannot be anchored", () => {
expect(
resolveWorkspaceFilePaths({ path: "~/notes.md", workspaceRoot: "/Users/me/repo" }),
+13 -2
View File
@@ -129,6 +129,17 @@ function startsWithPath(value: string, prefix: string): boolean {
: value.startsWith(prefix);
}
function pathWithinRoot(root: string, relativePath: string): string {
return root.endsWith("/") ? `${root}${relativePath}` : `${root}/${relativePath}`;
}
/** Whether an absolute path names the workspace directory itself. */
export function isWorkspaceRootPath(input: { path: string; workspaceRoot: string }): boolean {
const path = normalizeAbsolutePath(input.path.trim().replace(/\\/g, "/"));
const root = normalizeAbsolutePath(input.workspaceRoot.trim().replace(/\\/g, "/"));
return path !== null && root !== null && pathsEqual(path, root);
}
export interface ResolvedWorkspaceFilePaths {
/** Absolute path on the host, suitable for opening in an editor / file manager. */
absolutePath: string;
@@ -159,7 +170,7 @@ export function resolveWorkspaceFilePaths(input: {
if (pathsEqual(normalizedFile, workspaceRoot)) {
return null;
}
const prefix = `${workspaceRoot}/`;
const prefix = pathWithinRoot(workspaceRoot, "");
const relativePath = startsWithPath(normalizedFile, prefix)
? normalizedFile.slice(prefix.length)
: null;
@@ -174,5 +185,5 @@ export function resolveWorkspaceFilePaths(input: {
if (!relativePath) {
return null;
}
return { absolutePath: `${workspaceRoot}/${relativePath}`, relativePath };
return { absolutePath: pathWithinRoot(workspaceRoot, relativePath), relativePath };
}
@@ -7,6 +7,10 @@ const testTheme = {
statusDanger: "#b91c1c",
statusWarning: "#d97706",
statusMerged: "#7c3aed",
// Same rule as the real theme: the status color at 12%.
statusSuccessTint: "#15803d1f",
statusDangerTint: "#b91c1c1f",
statusWarningTint: "#d977061f",
// The light band's values, so a test can name the colour it expects.
statusDotSuccess: "#299f51",
statusDotDanger: "#f12e2f",
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/cli",
"version": "0.9.2",
"version": "0.10.3",
"description": "Paseo CLI - control your AI coding agents from the command line",
"bin": {
"paseo": "bin/paseo"
@@ -28,9 +28,9 @@
},
"dependencies": {
"@clack/prompts": "^1.0.0",
"@getpaseo/client": "0.9.2",
"@getpaseo/protocol": "0.9.2",
"@getpaseo/server": "0.9.2",
"@getpaseo/client": "0.10.3",
"@getpaseo/protocol": "0.10.3",
"@getpaseo/server": "0.10.3",
"chalk": "^5.3.0",
"commander": "^12.0.0",
"mime-types": "^2.1.35",
+7 -2
View File
@@ -82,10 +82,15 @@ const EXPECTED_CLAUDE_MODELS = [
model: "Opus 4.8",
descriptionFragment: "Previous release",
},
{
id: "claude-sonnet-5-5",
model: "Sonnet 5.5",
descriptionFragment: "Best for everyday tasks",
},
{
id: "claude-sonnet-5",
model: "Sonnet 5",
descriptionFragment: "Best for everyday tasks",
descriptionFragment: "Previous release",
},
{
id: "claude-opus-4-7[1m]",
@@ -430,7 +435,7 @@ try {
"--quiet should print the same ordered model IDs returned by --json",
);
assert(
claudeModelsFromJson.some((m) => m.id === "claude-sonnet-5"),
claudeModelsFromJson.some((m) => m.id === "claude-sonnet-5-5"),
"captured --json output should include the current Claude everyday model id",
);
console.log("✓ provider models --quiet outputs model IDs only\n");
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/client",
"version": "0.9.2",
"version": "0.10.3",
"description": "Paseo client SDK package",
"files": [
"dist",
@@ -39,8 +39,8 @@
"test": "vitest run"
},
"dependencies": {
"@getpaseo/protocol": "0.9.2",
"@getpaseo/relay": "0.9.2",
"@getpaseo/protocol": "0.10.3",
"@getpaseo/relay": "0.10.3",
"zod": "^4.4.3"
},
"devDependencies": {
@@ -9,7 +9,10 @@ const MAX_TRANSIENT_DETACHED_PANES = 2;
const SETTINGS_DESTINATIONS = [
"General",
"Appearance",
"Layout",
"Sidebar",
"Chat",
"Terminal",
"Browser",
"Editor",
"Shortcuts",
"Integrations",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/desktop",
"version": "0.9.2",
"version": "0.10.3",
"private": true,
"description": "Paseo desktop app (Electron wrapper)",
"homepage": "https://paseo.sh",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/expo-two-way-audio",
"version": "0.9.2",
"version": "0.10.3",
"description": "Native module for two way audio streaming",
"keywords": [
"ExpoTwoWayAudio",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/highlight",
"version": "0.9.2",
"version": "0.10.3",
"files": [
"dist",
"!dist/**/*.map",
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/plugin",
"version": "0.9.2",
"version": "0.10.3",
"description": "Paseo plugin SDK package",
"files": [
"dist",
@@ -65,8 +65,8 @@
"use-sync-external-store": "^1.6.0"
},
"devDependencies": {
"@getpaseo/client": "0.9.2",
"@getpaseo/protocol": "0.9.2",
"@getpaseo/client": "0.10.3",
"@getpaseo/protocol": "0.10.3",
"@types/node": "^20.9.0",
"@types/react": "~19.2.0",
"react": "19.1.0",
@@ -76,8 +76,8 @@
"zod": "^4.4.3"
},
"peerDependencies": {
"@getpaseo/client": "0.9.2",
"@getpaseo/protocol": "0.9.2",
"@getpaseo/client": "0.10.3",
"@getpaseo/protocol": "0.10.3",
"react": "~19.1.0",
"react-native": ">=0.81.5",
"zod": "^4.4.3"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/protocol",
"version": "0.9.2",
"version": "0.10.3",
"description": "Paseo shared protocol schemas and wire types",
"files": [
"dist",
@@ -196,11 +196,13 @@ describe("guessTerminalProfileIcon", () => {
["/usr/local/bin/gemini", "gemini"],
["agy", "agy"],
["/usr/local/bin/agy", "agy"],
["cursor-agent", "cursor"],
["/usr/local/bin/cursor-agent", "cursor"],
])("guesses %s -> %s", (command, expected) => {
expect(guessTerminalProfileIcon(command)).toBe(expected);
});
it.each([["zsh"], ["bash"], ["fish"], [""], ["/usr/bin/foo"], ["cursor-agent"]])(
it.each([["zsh"], ["bash"], ["fish"], [""], ["/usr/bin/foo"], ["cursor-tool"]])(
"returns undefined for unknown command %s",
(command) => {
expect(guessTerminalProfileIcon(command)).toBeUndefined();
@@ -219,6 +221,26 @@ describe("getTerminalProfileIcon", () => {
expect(getTerminalProfileIcon(profile)).toBe("claude");
});
it("shows the Cursor icon for a profile created in settings with the Cursor CLI", () => {
const profile = {
id: "profile_1",
name: "Cursor",
command: "cursor-agent",
args: [PROMPT_SENTINEL],
};
expect(getTerminalProfileIcon(profile)).toBe("cursor");
});
it("keeps an explicit icon over the Cursor CLI guess", () => {
const profile = {
id: "profile_1",
name: "Cursor",
command: "cursor-agent",
icon: "claude",
};
expect(getTerminalProfileIcon(profile)).toBe("claude");
});
it("returns undefined when no icon is set and command is unknown", () => {
const profile = { id: "1", name: "Foo", command: "zsh" };
expect(getTerminalProfileIcon(profile)).toBeUndefined();
+8 -1
View File
@@ -105,7 +105,14 @@ export function resolveTerminalProfileLaunch(
return { name: profile.name, ...substitutePrompt(profile, prompt) };
}
const WELL_KNOWN_COMMAND_ICONS = new Map(KNOWN_PROVIDER_ICON_NAMES.map((name) => [name, name]));
// CLIs whose binary is not named after their icon. Matching stays exact, so a
// command only gets an icon when its whole base name is listed.
const COMMAND_ICON_ALIASES: ReadonlyArray<[string, string]> = [["cursor-agent", "cursor"]];
const WELL_KNOWN_COMMAND_ICONS = new Map([
...KNOWN_PROVIDER_ICON_NAMES.map((name): [string, string] => [name, name]),
...COMMAND_ICON_ALIASES,
]);
function getCommandBaseName(command: string): string {
const lastSlash = command.lastIndexOf("/");
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/relay",
"version": "0.9.2",
"version": "0.10.3",
"description": "Paseo relay for bridging daemon and client connections",
"files": [
"dist",
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/server",
"version": "0.9.2",
"version": "0.10.3",
"description": "Paseo backend server",
"files": [
"dist/server",
@@ -107,11 +107,11 @@
"@agentclientprotocol/sdk": "^0.17.1",
"@anthropic-ai/claude-agent-sdk": "0.3.246",
"@anthropic-ai/sdk": "^0.104.2",
"@getpaseo/client": "0.9.2",
"@getpaseo/highlight": "0.9.2",
"@getpaseo/plugin": "0.9.2",
"@getpaseo/protocol": "0.9.2",
"@getpaseo/relay": "0.9.2",
"@getpaseo/client": "0.10.3",
"@getpaseo/highlight": "0.10.3",
"@getpaseo/plugin": "0.10.3",
"@getpaseo/protocol": "0.10.3",
"@getpaseo/relay": "0.10.3",
"@isaacs/ttlcache": "^2.1.4",
"@modelcontextprotocol/sdk": "1.29.0",
"@opencode-ai/sdk": "1.14.46",
@@ -4851,6 +4851,53 @@ test("persists live mode, model, and thinking changes without an external snapsh
expect(persisted?.runtimeInfo?.model).toBe("gpt-5.4");
});
test("model changes persist the resolved thinking and fresh provider handle before another turn", async () => {
const workdir = mkdtempSync(join(tmpdir(), "agent-manager-model-selection-"));
class ModelSession extends TestAgentSession {
selection = { model: "source", thinkingOptionId: "medium" as string | undefined };
async setModel(model: string | null) {
this.selection = { model: model ?? "default", thinkingOptionId: undefined };
this.pushEvent({
type: "thinking_option_changed",
provider: "codex",
thinkingOptionId: null,
});
}
describePersistence() {
return { provider: "codex" as const, sessionId: this.id, metadata: { ...this.selection } };
}
}
class ModelClient extends TestAgentClient {
async createSession(config: AgentSessionConfig) {
return new ModelSession(config);
}
}
const storage = new AgentStorage(join(workdir, "agents"), logger);
const manager = new AgentManager({
clients: { codex: new ModelClient() },
registry: storage,
logger,
});
try {
const agent = await manager.createAgent(
{ provider: "codex", cwd: workdir, model: "source", thinkingOptionId: "medium" },
undefined,
{ workspaceId: undefined },
);
await manager.setAgentModel(agent.id, "target");
await manager.flush();
const stored = await storage.get(agent.id);
expect(stored?.config?.model).toBe("target");
expect(stored?.config?.thinkingOptionId).toBeUndefined();
expect(stored?.persistence?.metadata?.model).toBe("target");
expect(stored?.persistence?.metadata?.thinkingOptionId).toBeUndefined();
} finally {
for (const agent of manager.listAgents()) await manager.closeAgent(agent.id);
await manager.flush();
rmSync(workdir, { recursive: true, force: true });
}
});
test("later explicit config mutations win over events emitted by earlier mutations", async () => {
const workdir = mkdtempSync(join(tmpdir(), "agent-manager-config-mutation-order-"));
class ConfigMutationSession extends TestAgentSession {
@@ -1943,6 +1943,7 @@ export class AgentManager {
if (agent.runtimeInfo) {
agent.runtimeInfo = { ...agent.runtimeInfo, model: normalizedModelId };
}
this.refreshSessionPersistence(agent);
this.touchUpdatedAt(agent);
this.emitState(agent);
}
@@ -3704,18 +3704,29 @@ class HeldTurnAgentSession implements AgentSession {
readonly prompts: string[] = [];
private readonly subscribers = new Set<(event: AgentStreamEvent) => void>();
private activeTurnId: string | null = null;
private turnStartGate: Promise<void> | null = null;
constructor(
readonly provider: AgentProvider,
private readonly holdTurns: boolean,
) {}
/** Hold the next turn's acknowledgment, as a provider awaiting its turn-start request does. */
holdTurnStart(): () => void {
let release!: () => void;
this.turnStartGate = new Promise((resolve) => {
release = resolve;
});
return release;
}
async run(): Promise<AgentRunResult> {
return { sessionId: this.id, finalText: "", timeline: [] };
}
async startTurn(prompt: AgentPromptInput): Promise<{ turnId: string }> {
this.prompts.push(typeof prompt === "string" ? prompt : JSON.stringify(prompt));
await this.turnStartGate;
const turnId = randomUUID();
this.activeTurnId = turnId;
setTimeout(() => {
@@ -4085,6 +4096,127 @@ describe("send_agent_prompt MCP tool", () => {
await removeAgentStateDir(agentManager, storage, workdir);
}
});
it("reports a background prompt's accepted turn as running", async () => {
const workdir = await mkdtemp(join(tmpdir(), "mcp-background-send-status-"));
const storage = new AgentStorage(join(workdir, "agents"), logger);
const parentClient = new HeldTurnAgentClient("claude", false);
const childClient = new HeldTurnAgentClient("codex", true);
const agentManager = new AgentManager({
clients: { claude: parentClient, codex: childClient },
registry: storage,
logger,
});
try {
const parent = await agentManager.createAgent(
{ provider: "claude", cwd: existingCwd },
undefined,
{ workspaceId: "wks_parent" },
);
const child = await agentManager.createAgent(
{ provider: "codex", cwd: existingCwd },
undefined,
{ workspaceId: "wks_parent" },
);
const server = await createAgentMcpServer({
agentManager,
agentStorage: storage,
callerAgentId: parent.id,
providerSnapshotManager: createOpenCodeManager().manager,
logger,
});
const tool = registeredTool(server, "send_agent_prompt");
const childSession = childClient.sessions[0]!;
const acknowledgeTurnStart = childSession.holdTurnStart();
const pending = invokeToolWithParsedInput(tool, {
agentId: child.id,
prompt: "Follow up",
});
await vi.waitFor(() => expect(childSession.prompts).toEqual(["Follow up"]));
acknowledgeTurnStart();
const response = await pending;
expect(response.structuredContent).toMatchObject({ success: true, status: "running" });
expect(agentManager.getAgent(child.id)?.lifecycle).toBe("running");
childSession.finishTurn();
await vi.waitFor(() => {
const parentPrompts = parentClient.sessions[0]!.prompts;
expect(parentPrompts).toHaveLength(1);
expect(parentPrompts[0]).toContain(child.id);
expect(parentPrompts[0]).toContain("finished");
});
} finally {
await removeAgentStateDir(agentManager, storage, workdir);
}
});
it("accepts a background turn completed as the manager publishes its start", async () => {
const workdir = await mkdtemp(join(tmpdir(), "mcp-fast-background-send-"));
const storage = new AgentStorage(join(workdir, "agents"), logger);
const parentClient = new HeldTurnAgentClient("claude", false);
const childClient = new HeldTurnAgentClient("codex", true);
const agentManager = new AgentManager({
clients: { claude: parentClient, codex: childClient },
registry: storage,
logger,
});
try {
const parent = await agentManager.createAgent(
{ provider: "claude", cwd: existingCwd },
undefined,
{ workspaceId: "wks_parent" },
);
const child = await agentManager.createAgent(
{ provider: "codex", cwd: existingCwd },
undefined,
{ workspaceId: "wks_parent" },
);
const server = await createAgentMcpServer({
agentManager,
agentStorage: storage,
callerAgentId: parent.id,
providerSnapshotManager: createOpenCodeManager().manager,
logger,
});
let finished = false;
const unsubscribe = agentManager.subscribe(
(event) => {
if (
!finished &&
event.type === "agent_state" &&
event.agent.id === child.id &&
event.agent.lifecycle === "running"
) {
finished = true;
childClient.sessions[0]!.finishTurn();
}
},
{ agentId: child.id, replayState: false },
);
const response = await invokeToolWithParsedInput(
registeredTool(server, "send_agent_prompt"),
{
agentId: child.id,
prompt: "Fast reply",
},
);
unsubscribe();
expect(response.structuredContent).toMatchObject({ success: true, status: "idle" });
await vi.waitFor(() => {
const parentPrompts = parentClient.sessions[0]!.prompts;
expect(parentPrompts).toHaveLength(1);
expect(parentPrompts[0]).toContain(child.id);
expect(parentPrompts[0]).toContain("finished");
});
} finally {
await removeAgentStateDir(agentManager, storage, workdir);
}
});
});
describe("update_agent MCP tool", () => {

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