Compare commits

..
Author SHA1 Message Date
paseo-bot[bot]andOuyang Xingyuan 8cc28cd78f fix(app): keep increment and decrement lines in Edit diffs
A changed line inside a hunk can start with the same marker as a file header. Use the hunk ranges to preserve those lines in tool output.

Co-authored-by: Ouyang Xingyuan <galaxyroaming@qq.com>
2026-11-30 06:46:36 +00:00
Ouyang Xingyuan c45689d1ba fix(server): compact oversized edit diffs before timeline budget truncation 2026-11-30 06:44:47 +00:00
paseo-bot[bot] 1e8bf499af test(terminal): restore AppImage zsh coverage (#11395)
The palette check reads the terminal overrides before building the child environment. Supply an empty override object so the AppImage fixture reaches its shell assertions.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 06:43:19 +00:00
paseo-bot[bot] 8849fd06c9 fix(desktop): avoid RPM conflicts with other Electron apps (#11354)
Electron RPMs can contain the same binary at different install paths. Turn off generated build-ID links so their RPMs can install alongside Paseo.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 13:39:34 +07:00
paseo-bot[bot]andmonarchmaisuriya 1cd2460a51 Restore finished Claude subagents after reopening (#10848)
Closes #8959

Co-authored-by: monarchmaisuriya <monarchmaisuriya7600@gmail.com>
2026-11-30 13:34:30 +07:00
yz 75abc739e6 Fix header taps scrolling panes to the top on iOS (#11262) 2026-11-30 13:33:06 +07:00
Bhaskaran S 728e09f0bb fix(app): archive closed subagents from 'Archive finished subagents' (#10865)
A child whose runtime was released (status closed) was listed in the
subagent track but treated as not finished, so the button skipped it
silently. Treat closed like idle/error, keeping the background-work and
parent/archived rechecks. Adds regression tests.
2026-11-30 13:29:52 +07:00
Mohamed Boudra cf68bd76d4 fix(server): deliver voice-only speak tool regardless of MCP injection policy (#11161)
* fix(server): deliver voice-only speak tool regardless of MCP injection policy

* fix(server): track HTTP MCP capability separately and validate voice speak before reload close
2026-11-30 13:22:56 +07:00
Mohamed Boudra 7f2ece0556 chore(release): reconcile v0.18.2 (#11393) 2026-11-30 13:15:10 +07:00
Mohamed Boudra f81d433afc fix(app): keep batched user messages on distinct timeline row keys (#11324)
* fix(app): keep batched user messages on distinct timeline row ids

When multiple queued or joined human prompts share a single provider turn, projectAgentMessages emits separate user_message rows with distinct clientMessageIds and the same provider messageId. appendUserMessage and buildCanonicalUserMessage bypassed createUserMessage's clientMessageId ?? messageId precedence by passing id: messageId, producing duplicate React keys in WebStreamViewport mountedHistoryRows.

Prefer clientMessageId over messageId when building canonical user rows, and normalize previously cached or retained rows whose id inherited a shared provider messageId during reconciliation and replica-cache hydration.

* refactor(app): keep legacy user row id heal at replica cache boundary

Pre-fix rows with id === messageId only persist in the replica cache, which already normalizes them on read. Move the helper into replica-cache with a COMPAT tag and remove the unreachable merge-path heal in produceUserMessage.
2026-11-30 13:14:41 +07:00
paseo-bot[bot] a931ac1cd7 test(cli): isolate worktree tests from the launch checkout (#11392)
An explicit daemon endpoint resolves relative paths from the daemon's working directory. Start the test daemon in the fixture repository so the checks exercise that path without reading the launch checkout.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 06:13:42 +00:00
paseo-bot[bot] cdfc788946 fix(cli): isolate the usage test from host reports (#11391)
The test daemon inherited settings that let built-in sources discover reports outside its temporary home. Give the usage fixture an explicit base environment so the list and removal assertions depend only on its plugin.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 06:13:10 +00:00
paseo-bot[bot]andShane Su 8be985cb27 Keep Muse token totals and context usage in the same session snapshot (#11389)
Co-authored-by: Shane Su <26364206+suniceman@users.noreply.github.com>
2026-11-30 05:42:58 +00:00
977049557a perf(app): open the mobile app faster after a cold launch (#11390)
A cold launch on Hermes keeps the JavaScript thread busy until the restored
workspace is on screen, so work removed there is launch time removed. A
sampled profile of a release build showed four costs that bought nothing:

- The provider snapshot cache rebuilt its size-and-age index on every
  launch by reading, parsing and validating every stored snapshot, about
  390 ms with a full 4 MB cache. The index is now stored and trusted for
  keys that still exist. Storage keys stay the authority: an indexed key
  that is gone is dropped, and a stored key the index does not list is
  read and measured.
- Zod compiled a parser for each object schema with `new Function`. Hermes
  has no JIT, so the compile was pure cost, about 145 ms. Native builds turn
  it off before any schema module loads; web and desktop keep it because V8
  optimises the compiled parsers.
- `localeCompare` builds a collator on every call, which dominated the
  project and workspace name sorts. They now share one collator.
- The replica cache measured each payload with a per-character loop, over
  about 1 MB of directory rows on every refresh.

Time from tap to the workspace on an Android emulator, release build,
median of six cold launches: 2.45 s to 1.76 s with a full provider cache,
2.30 s to 1.67 s with a small one.

Co-authored-by: Marcel Wysocki <4222082+maci0@users.noreply.github.com>
Co-authored-by: luke <1686898+luoph@users.noreply.github.com>
2026-11-30 12:37:40 +07:00
Mohamed Boudra 5d678b3848 perf(app): stop hidden workspaces re-rendering git actions on every switch (#11332)
Each retained workspace in the deck mounts git actions twice (header and
Changes surface). useGitActions subscribed to the whole workspaces map of the
host and resolved its workspace from the global active route. Any workspace
switch replaces that map, so every hidden workspace re-ran the hook and
rebuilt its actions. A hidden workspace also resolved the active workspace as
the one its archive action targets.

Callers now pass their own workspaceId, and the hook selects only that
descriptor, which the session store keeps by identity when other workspaces
change. The redirect after an archive reads the focused workspace when the
archive starts.
2026-11-30 12:23:58 +07:00
Mohamed Boudra 26550ff73f perf(app): skip the Markdown parse for replies that only link outside the workspace (#11327)
Opening a chat parsed every assistant reply that contained any Markdown link into a full
mdast tree, because a link into the workspace gets a hover title. A reply whose links all
point elsewhere produces no edit, so the parse and its garbage were wasted. Parse only when
the source contains the workspace root after a link, or a backslash escape that could spell
it. Character references already take the parse path through the `&` check.
2026-11-30 12:23:30 +07:00
Matt CowgerandMohamed Boudra eadd7c21bb feat(omp): track and stop OMP background jobs (#11270)
* feat(omp): track and stop OMP background jobs

- Inject a generated OMP extension that reports async job snapshots via ctx.ui.setStatus
- Map jobs to background_work items, excluding task jobs shown as subagents
- Stop jobs with /jobs kill and hide its output; require OMP 18.8.8+ for stop
- Clear inventory on process exit, runtime replacement and close
- OmpCliRuntime owns the extension file lifecycle

* fix(omp): skip OMP launch when start is aborted during extension setup

- Recheck the abort signal after writing the extension, before spawning OMP
- Add a regression test for an already-aborted start

* test(omp): skip POSIX permission assertion on Windows

- Split the extension file test so module loading still runs on every platform

* fix(omp): settle the waiting turn after Stop and hide Stop without /jobs kill

OMP 18.8.8 to 18.20.3 send nothing after /jobs kill cancels the last work
a run is waiting on, which left the turn running. After a Stop, read
get_state and complete the turn when OMP has nothing left.

OMP older than 18.8.8 has no /jobs kill, so publish its jobs with
canStop: false.

---------

Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
2026-11-30 11:50:01 +07:00
paseo-bot[bot] a03fc5be64 Explain how to connect to TLS endpoints from the CLI (#11383)
* fix(cli): explain how to connect to TLS endpoints

A bare host and port selects plaintext WebSocket. A TLS proxy that replies with HTTP 400 leaves the user with generic connection advice, even though the same address works with wss://.

* fix(cli): include port shorthand in TLS guidance

Use the shared host parser so a port alone points to loopback in the recovery hint. Preserve the original port when switching the suggested URL to TLS.

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 04:43:02 +00:00
Mohamed Boudra c95a4a63fe Keep the keyboard open and land fullscreen composer toggles in one frame (#11326)
* fix(app): keep the keyboard and land each fullscreen toggle in one frame

Every fullscreen toggle on iOS closed the keyboard. The inline composer
root (shadow) and input wrapper (clipping) form Fabric stacking contexts
and the fullscreen styles do not, so the toggle flattened them and
re-parented the native editor, which resigns first responder. Both views
are now non-collapsable.

The rest of the jank came from layout split across commits:
- The slot cap and the body's keyboard reservation were worklets reading
  React `fullscreen`, which Reanimated applies frames after the commit. The
  fullscreen slot now fills with a static minHeight, and the reservation is a
  spacer mounted with the mode.
- Fullscreen resized the conversation list and re-measured the inline
  capacity and centered clearance, so exit corrected the list offset and the
  composer cap a few frames late. Fullscreen now covers that layout without
  changing it.
- The iOS translate view committed its mode change from a passive effect,
  and its persisted setNativeProps lift could stay stale on the resized view
  (the composer stuck 310pt above the screen) until the keyboard moved.

* fix(app): land the fullscreen composer toggle with its layout on every screen

With the keyboard open, entering fullscreen drew one frame of the fullscreen
layout at the inline keyboard lift: Send 310pt too high and the text off
screen. New workspace showed it on about half of the enters and a chat on
about one in eight.

The iOS translate view changed mode through two writers that nothing orders
with the mount. A layout-effect setNativeProps put the resting lift in the
shadow tree after React's commit, so React's own commit still carried the old
mode, and the native driver flipped the mode on its own queue. New workspace
drops its header in fullscreen, which resizes the translated surface, and
Fabric repaints a driven view's committed transform on resize: the stale one.
A chat never resized the surface, so only the driver's timing decided the
frame.

The translate view now commits where it rests as a React prop, from the
keyboard's target shift held in React state, so the commit that carries a
layout carries its lift. The driver follows a frame later, after the mount.
The dock moves the content and the composer slot with two translate views and
puts the mode on the slot, which fullscreen resizes on every screen, so a chat
and New workspace take the same path.

The fullscreen device check now records the screen through eight toggles on a
draft tab and on New workspace and fails on any frame that draws Send away
from its two resting places. Its snapshots are a second apart and passed
against the bug.

* test(app): count the chat dock's two keyboard translate views

The overlay placement test counts the translate views it checked. The chat
dock now moves its content and its composer slot with one view each.
2026-11-30 11:42:51 +07:00
paseo-bot[bot]andMatt Cowger a9c98a187d Choose an available model for new session defaults (#9052)
* fix(app): select available host model by default

* fix(app): resolve remembered models when host catalogs arrive

Keep opening model resolution pending until its selected catalog is ready, so a loading snapshot cannot freeze an unavailable preference. Preserve user edits and error presentation while awaiting recovery.

Co-authored-by: Matt Cowger <matt@cowger.us>

* fix(app): preserve pending form edits without repeated updates

Ignore equivalent pending inputs so freshly built fork defaults do not keep the view rendering. Apply fork defaults only to their provider and model, preserving mode and thinking choices made while discovery is pending.

* fix(app): preserve thinking defaults in legacy fork drafts

Resolve the legacy default model placeholder through the same canonical model lookup used for selection and identity comparisons.

---------

Co-authored-by: Matt Cowger <matt@cowger.us>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 11:37:08 +07:00
paseo-bot[bot] 07709a9651 Restore Pi chat history when transcripts contain unlinked metadata (#11379)
* fix(pi): restore history from transcripts with unlinked metadata

The transcript reader rejected title and model metadata without tree links before it could replay saved messages.

* fix(pi): preserve ancestry rooted at an older model change

Pi can omit the model change parent after reloading an ID-less title. Later messages still link to that model change.

* fix(pi): replay branches started immediately after an ID-less title

Pi can append a message as the root when it reloads an ID-less title. Keep rejecting other missing parent fields unless the row is a legacy model change.

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 04:12:50 +00:00
paseo-bot[bot]andClaude Opus 5.5 a099673413 test(cli): reserve lifecycle test ports outside the ephemeral range (#11378)
port() took a port from port 0 and released it before the daemon
listened. Port-0 ports are ephemeral, so the OS could give the same
port to another process in that gap, and the daemon failed with
EADDRINUSE. port() now picks a free port from 20000-31999, below the
ephemeral range of Linux, macOS, and Windows.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 03:27:15 +00:00
SunicemanandShane Su 3abb0cb18e Leave unexpanded Windows variable paths unlinked in chat (#11228)
Co-authored-by: Shane Su <26364206+suniceman@users.noreply.github.com>
2026-11-30 03:12:59 +00:00
Mohamed Boudra c77a53ffdc fix(app): hold the launch splash until the restored workspace is on screen (#11348)
On a cold start the app showed the native splash, a grey frame, an empty
frame, a smaller second logo, then a series of different spinners before
the conversation appeared.

The grey came from the Android activity window, which had no background
and fell back to the AppCompat default under the fading splash. The rest
came from every screen in the startup chain rendering its own loading
state the moment it mounted, while the splash had already been hidden by
expo-router on first navigation.

native-splash now owns "launch is still loading": screens hold it while
their content can still come from the local cache, and it leaves once a
frame passes with no holds (5 s cap). It does not wait for the network;
a route that waits on the host shows one shared LoadingState that says
what it is waiting for. A host that is still connecting is loading, not
unreachable.

Android cannot time the hand-off from the system splash, so it swaps to
an identical in-app LaunchScreen at first commit and fades that out.

Also: the nested sidebar list is virtualised, and first launch waits
for host bootstrap to settle instead of giving up after a fixed 5 s.
2026-11-30 09:46:20 +07:00
Mohamed Boudra 614b4d3860 Open Profiles first and even out row heights in mobile Agent settings (#11371)
* feat(app): open Profiles by default when configuring a new agent on mobile

On a phone, picking a profile is the quickest way to set up a new agent, so
the agent settings drawer now opens with the Profiles card expanded for a
draft (New Chat, New Workspace) when profiles exist. A running agent keeps it
collapsed, since there a profile overwrites settings the agent already runs
with. A toggle holds until the drawer closes.

* fix(app): give every Agent settings row on mobile the same height

Model and switch rows used the settings-card row, sized for spacious settings
pages (switch height plus 16pt padding, 58pt on touch), while the sheet's
Profiles header and mode choices are 44pt list rows. A new list placement in
the row-density context makes settings rows in a sheet of list rows one touch
target tall, and Agent settings Home opts into it.
2026-11-30 09:44:32 +07:00
paseo-bot[bot] 80f0b11386 test(desktop): keep the link opener available during browser E2E (#11366)
A login shell that resets PATH removes the test opener before Electron launches a plugin link. Run the Linux desktop test with an isolated shell so the fixture receives both expected opens.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 01:42:48 +00:00
paseo-bot[bot] 95a90f5259 fix(cli): restore arguments on the desktop executable (#11363)
The bundled CLI build stopped emitting the runCli module that Electron imports for direct CLI calls. Build that module alongside the standalone CLI and include it in the Nix desktop trace.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-30 00:42:52 +00:00
paseo-bot[bot]andMarkA d059fcfd10 Show Schedules when a saved host is still connecting (#11361)
* fix(schedules): show results while another host connects

## Problem
An online host returning no schedules leaves the page loading indefinitely when
another saved host is still connecting. The user cannot reach the empty state or
create a schedule despite a successful response.

## Solution
Return the available results, including an empty list, and include a warning for
hosts still connecting. Preserve the initial connecting state when no host can
answer and existing errors when every attempted request fails.

* test(schedules): cover stalled hosts in the browser

## Problem
The schedules spinner regression needs a user-visible check, and partial
loading must not hide errors from the only connected host.

## Solution
Exercise an isolated daemon alongside a stalled WebSocket connection in the
existing schedules suite. Verify the empty state, warning, and creation
button, capture both responsive layouts, and preserve failed-host coverage.

* fix(schedules): keep host warnings consistent with fetched results

## Problem
A host changing connection state during another request could lose its
missing-results warning or gain a warning despite returning schedules.

## Solution
Remember settling hosts when deciding which requests to send. Cover both
connection transitions and express the browser regression through concise
user-level helpers.

* test(schedules): keep scenario mechanics in runtime fixtures

## Problem
Host-specific branching inside test bodies obscures the behaviors being
asserted and conflicts with the repository's test conventions.

## Solution
Reuse the runtime fixture for failed responses and isolate connection
transitions in a focused helper while preserving unconditional assertions.

* test(schedules): assert the empty state and creation control

Check the text and action the user sees when another host is still connecting.

Co-authored-by: MarkA <agenore990@gmail.com>

* fix(schedules): identify hosts that are still connecting

Carry the reason for each partial result so the banner can distinguish a pending connection from a failed schedule request.

---------

Co-authored-by: MarkA <agenore990@gmail.com>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-29 23:42:49 +00:00
paseo-bot[bot] cfd4efe289 fix(cli): exit agent logs after a daemon timeout (#11360)
Close the daemon connection before passing coded errors to the CLI error handler. An open connection kept the process running after the CLI printed the timeout.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-29 22:42:45 +00:00
Matchy 830697ba62 Close the image lightbox when switching sessions on web (#11358)
* fix(app): close the image lightbox when its panel goes inactive

Switching sessions (for example from a notification) keeps the old chat
mounted in a RetainedPanel that becomes inactive. On web, the next commit
freezes the hidden chat with react-freeze. The lightbox renders an RN Modal
that portals to document.body, so the image stayed on top of the new
session, and its close button, backdrop and Escape all set state inside the
frozen subtree, which never committed. On native the chat is not frozen,
but the old image was still left over the new session.

Do what MenuSurface already does: read useRetainedPanelActive(), call
onClose() when the panel turns inactive, and render nothing (with the
overlay layer and Escape registration off) in that same inactive commit, so
the portal is gone before the freeze. Outside a retained panel the signal
is true, so other callers are unaffected.

Checked with a browser test that opens the lightbox, deactivates the panel
under the web and native RetainedChatContent, and tries every close path:
it failed before this change and passes after.

* test(app): pin the lightbox closing when its chat leaves the screen

Opens the image lightbox inside a retained chat, deactivates the panel the
way a session switch does, and checks the lightbox is gone and stays gone
when the chat comes back. Runs under both the web RetainedChatContent,
which freezes the hidden chat, and the native one, which keeps it live.

Both cases fail on the commit before the lightbox fix and pass after it.

Refs #11355
2026-11-29 22:12:51 +00:00
paseo-bot[bot]andClaude Opus 5.5 41aceb042b test(server): wait for the shell prompt between terminal protocol helpers (#11357)
The three protocol-query tests typed the next helper command as soon as
the previous helper printed its OK line. That helper was still running,
so the shell printed its prompt and the typed-ahead command's output on
one row ("$ OSC_COLOR_OK:12:..."). The checks need the line to start
with, or equal, the OK text, so they waited until the 5 s timeout.

Each command now waits for the prompt before it is typed. A timeout
also prints the screen, so the next failure shows what it saw.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 21:35:27 +00:00
Tri Dao 74f629bee1 fix(pi): run extension commands sent mid-turn without aborting the turn (#11341)
Slash input sent while a Pi turn runs used to replace the turn: steering refuses slash
commands, so Paseo aborted the turn and sent the command as a new prompt. Pi runs
extension commands immediately even while streaming, so the provider now claims them
through tryHandleOutOfBand (as /compact already is) and forwards them as a plain prompt.
The handler doesn't wait for Pi's ack, which arrives only when the command returns, so an
interactive command can't hold Stop. Idle input, skills, prompt templates and unknown
commands keep their existing paths.
2026-11-29 20:42:37 +00:00
paseo-bot[bot]andMatteo Pietro Dazzi 097a0f3a7d Restore Android scrolling in provider model settings (#11350)
* fix(app): scroll the provider models list on Android

The models list sits in a ScrollView nested in the provider sheet's own
scrolling body. On Android the sheet's pan gesture claims the drag and cancels
that inner scroll, so the scrollbar appears and the content stays put;
nestedScrollEnabled covers Android's nested scrolling, not gesture
cancellation.

Claim the touch stream for the nested scroller instead, with the Android-only
gesture the model browser already used for the same problem. It moves out of
model-browser.tsx into components/ui/independent-scroll-boundary.tsx, so the
provider settings can use it without importing the model browser. The gesture
activates on the first move and refuses interruption, which keeps Android's
native scroll and its ACTION_UP for the fling.

The provider update output box has the same shape in the same sheet and gets
the same wrapper.

The claim and the platform gate are covered by a test; the drag itself needs a
device.

Closes #10544

* fix(app): preserve model checkbox taps while scrolling provider settings

Wait for Android to detect a drag before the provider list claims the touch. Exercise the sheet with the native swipe and checkbox interactions.

Co-authored-by: Matteo Pietro Dazzi <matteopietro.dazzi@gmail.com>

---------

Co-authored-by: Matteo Pietro Dazzi <matteopietro.dazzi@gmail.com>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-11-29 19:12:40 +00:00
paseo-bot[bot]andClaude Opus 5.5 47b4205098 test(website): wait for the plugin section fade before checking the reduced-motion demo (#11351)
The reduced-motion plugin demo test gave scrolling plus the section's
0.5 s fade-in a 2 s budget. On slow WebKit runners each scroll call took
up to 0.9 s and the row was still at opacity 0 when the budget ran out.
Wait for the section to finish fading in, then check the row at once:
the staged demo would still be hiding it at that point.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 18:39:17 +00:00
paseo-bot[bot] d8e9a39953 test(server): receive live shell events in Codex steering tests (#11336)
The test waits for a running shell call before sending a follow-up. Subscribe to the agent timeline before the first prompt so the collector receives that event. Let the installed Codex select its supported default model.

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

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