Compare commits

...
Author SHA1 Message Date
Mohamed Boudra 89773d2ec3 fix(app): surface and retry client plugin bypass persistence errors 2026-12-02 11:35:41 +01:00
Mohamed Boudra 8fcd4e151d chore(app): simplify General setup row copy 2026-12-02 11:25:43 +01:00
Mohamed Boudra 3e17a0e125 feat(app): add General settings toggle to bypass client plugin approval 2026-12-02 11:17:03 +01:00
Mohamed Boudra a5fe858831 test(desktop): wait deterministically for seeded plugin approval at startup 2026-12-02 10:19:37 +01:00
Mohamed Boudra 64db9df945 fix(app): address plugin approval review findings and desktop E2E startup 2026-12-02 10:13:43 +01:00
Mohamed Boudra 51601d45cf test(app): approve client plugins via UI in browser E2E specs 2026-12-02 09:49:09 +01:00
Mohamed Boudra d7d6523333 feat(app): require one-time approval before running client plugins
Add a per-host, per-plugin client execution consent model and sequential confirmation sheet before evaluating plugin client bundles.

- Enforce fail-closed execution approval inside PluginRegistry before runPluginClientBundle runs and hydrate stored decisions before catalog reconciliation.
- Queue multiple unreviewed client plugins sequentially in one persistent AdaptiveModalSheet with monotonic request IDs and steady layout geometry.
- Persist approved and declined decisions per (host, plugin) across reloads and reconnects, clear host trust on host removal or relay identity key replacement, and clear plugin decisions on uninstall.
- Surface blocked plugins in Settings -> Plugins and plugin surfaces so users can allow or block client execution on this device.
2026-12-02 09:49:09 +01:00
Mohamed Boudra f4a6d7841c refactor(markdown): decompose renderer capabilities and tighten local image path checks (#11699)
Split MarkdownRenderer's external flag into destinations, forgeShorthand, and softBreaks, and consolidate local image path parsing in @getpaseo/protocol/path-utils to validate local drive, POSIX, and in-workspace UNC paths while rejecting out-of-workspace UNC paths, malformed file URIs, and Win32 device namespace paths.
2026-12-02 14:56:55 +07:00
paseo-ai[bot] 4db5d454cd fix: update lockfile signatures and Nix hash [skip ci] 2026-12-02 07:47:52 +00:00
b34d4f5c3f fix(daemon): clamp oversized images before they enter agent history (#5119)
* fix(daemon): clamp oversized images before they enter agent history

An image over 2000px does not just fail the turn that carries it. Anthropic
rejects the whole conversation from then on, every retry replays the poisoned
history, and there is no in-app way to repair the session — the user has to
hand-edit the agent's JSONL. A 4864x2524 Retina screenshot is enough.

Clamp pixels and bytes in the daemon, on the three paths that assemble a
prompt's image blocks. That also covers callers no client-side fix can reach:
`paseo agent send`, plugins, schedules, and direct WebSocket clients. pi only
resizes what its own tools read; images arriving over RPC pass through, which
is why the pi provider is affected too.

The strategy and decoder are pi's: Photon (Rust compiled to WASM, 2MB, no
native binaries). After scaling to fit, PNG is tried before any JPEG quality,
and a further scale step is taken only when no encoding makes the byte
budget. What reaches this path is mostly UI and code screenshots, which PNG
keeps sharp and small and JPEG smears; photos fall through to JPEG on their
own. EXIF orientation is applied first so a downscaled phone photo is not
delivered sideways.

WASM is deliberate: the daemon ships to five platforms with
`npmRebuild: false`, and a codec resolved per-platform is a codec that
silently resolves to nothing wherever CI did not build it.

GIF and SVG pass through untouched, and every failure path returns the
original attachment. A bounded image beats an unbounded one; both beat a
dropped one.

Refs #4635. Revives the location #820 chose, with a codec that ships.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(daemon): bound image work before decoding, refuse what cannot be clamped

Read the declared size out of the container header — PNG, JPEG, WebP, GIF,
BMP — before the decoder is handed anything. A decompression bomb states
gigapixels in a few kilobytes, so measuring an attachment by decoding it was
the wrong way round. Past 50MP declared, 64MB encoded, or 100 images in one
prompt, the attachment is refused before anything is allocated for it, and an
attachment already inside the provider's limits is no longer decoded at all.

Stop swallowing failures. A decoder that fails to load, or a codec that fails
on an oversized attachment, used to forward the original — silently reaching
the state #4635 is about. Both now raise a typed error that fails one send and
leaves the session usable. An attachment whose container cannot be read is
still forwarded when it is within budget: an unknown format is not a defect.

Take a single object parameter in both public functions, per the server guide,
and yield between attachments so one prompt cannot hold the event loop for its
whole batch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(daemon): apply the image ceilings to GIF and SVG too

A format that must not be re-encoded is still a format with limits. Both
returned before any size check, so an oversized or over-budget one reached
history untouched and every later turn replayed it — the state this guard
exists to prevent, through the one door left open. They are now measured
against the same ceilings, and one that is past them fails the send: there is
no clamped version to send instead, because flattening an animation or
rasterising a vector is a different image, not a smaller one.

Declare the TIFF readers as functions and take a single object parameter in
`applyExifOrientation` and the clamp helper, per the server guide.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* chore(deps): reduce the lockfile change to the photon entry

The previous lockfile was regenerated with a newer npm, which deduplicated the
nested vitest trees under cli, desktop and relay and dropped rollup's peer
flags. None of that belongs to this change. Restore main's lockfile and add
only @silvia-odwyer/photon-node and its server dependency edge.

* fix(daemon): tighten the image clamp's ordering and per-step cost

- Preprocess images before buildSessionConfig in agent creation. That step
  can create a worktree or workspace, and a refused attachment must not
  leave one behind.
- Decide "never re-encode" from the bytes as well as the MIME type. A GIF
  labelled image/png, or an animated WebP, was decoded and flattened to its
  first frame; both now get the passthrough rules.
- Take each scale step from the previous step's output instead of the full
  source, and stop encoding the bottom JPEG quality twice per step. A 50MP
  source was resampled again on every step.
- Fail send_agent_message_request with a warning when an attachment is
  refused, instead of routing client input through handleAgentRunError.

* fix(app,server): verify picked image headers and clamp uploaded images in resolveAgentPrompt

- Fix mobile pickedAssetSupportedFormat so explicit unsupported mimeType/fileName never falls back to a .jpeg URI (fixes Android RawImageExporter copying AVIF/HEIC into .jpeg) and sniff the first 12 header bytes on native.
- Wire daemon image clamping into resolveAgentPrompt so uploaded role='image' attachments and inline images share one daemon clamping boundary, and correct mismatched raster MIME labels from magic bytes.
- Validate uploaded image attachments before provisioning workspaces or worktrees.

* Address review feedback on uploaded image clamping and creation pre-resolution

* Tighten image preprocessing helpers and fix EXIF parser edge cases

* Restore named option interfaces on public image preprocessing exports

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
2026-12-02 14:38:07 +07:00
lukeandRoundRedDot 7bfdbbad2c fix(omp): show the question and chosen option for HTML-form asks (#11697)
Since 18.18.3 OMP's ask tool takes one HTML form ({ html }) instead of a
questions array, and OMP 19 reports the result as details.answers
({ name, question, answer }) beside the text "User answers: { name: value }".
mapOmpAskDetail only read the older questions/results shape, so a
finished ask recorded the label "Question" and the raw "User answers"
JSON: the question and the option text the user chose were lost from
the timeline and from history.

Read details.answers into the same "question\nanswer" text the older
shape produced. When a result carries only the values, read them against
the parsed form so each value shows as its option's text. While the ask
waits, or after it is interrupted, the row is named by the form's first
question.

Co-authored-by: RoundRedDot <roundreddot@gmail.com>
2026-12-02 14:30:26 +07:00
Vivek KalyanandMohamed Boudra 98c98d1017 fix(usage): let Claude Enterprise monthly spend pin to the sidebar (#11514)
* fix(usage): summarize Claude Enterprise extra usage and clean plan badge

* fix(usage): distinguish Monthly spend label, quiet balance-only warning, and split conditional test

---------

Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
2026-12-02 14:28:22 +07:00
Mohamed BoudraandVivek Kalyan e9ea31ef3b feat(usage): show Codex individual spend limit amounts as Spend credits (#11702)
Show Codex spend_control.individual_limit amounts as a Spend credits UsageBalance using existing primitives.

Co-authored-by: Vivek Kalyan <hello@vivekkalyan.com>
2026-12-02 14:27:29 +07:00
paseo-bot[bot] 5a6e6d1918 test(server): verify Claude permission decisions on the event feed (#11698)
The permission tests pass their file checks but fail when they look for an event on an unrequested agent stream. Observe the permission resolution feed so each test verifies the decision the daemon publishes.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-02 07:13:13 +00:00
Matt CowgerandMohamed Boudra acd119743b fix(plugins): add requirements.app to split daemon and app minimums (#11494)
* fix(plugins): add requirements.app to split daemon and app minimums

* fix(plugins): name the app in requirements.app failures and cover app-only reinstall

When requirements.app is the failing range, the message now reads
"requires Paseo app <range>. Your app is <version>." A registry test locks
that a requirements.app-only edit unloads the installed plugin.

* test(plugins): split requirements.app cases so no test branches on runtime

---------

Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
2026-12-02 13:50:22 +07:00
paseo-bot[bot]andClaude Opus 5.5 a7bc7ac759 Wait for the reloaded app to report presence in the notification settings test (#11694)
After a reload, the test started the finished agent before the app had
connected and sent its first heartbeat. The daemon then had no present
client and sent no in-app notification, so the test saw zero
notifications.

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-12-02 06:43:19 +00:00
paseo-bot[bot] 9b82a65f3d fix(cli): show the active model in agent inspection and listings (#11693)
The provider reports a concrete model ID in runtime info. Preserve that ID when it matches the legacy default sentinel used in saved configurations.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-02 06:42:52 +00:00
Mohamed Boudra d131b54230 Fix Markdown collapse and layout shifts on plugin store navigation (#11691)
* fix(app): eliminate Markdown collapse and layout shifts on plugin store navigation

Opening a plugin in Settings -> Plugins previously painted several unstable frames before settling:

- On cold web sessions, the MD4C WASM parser only initialized after the first MarkdownRenderer mounted. Replacing OverviewSkeleton before the parser was ready collapsed the overview SettingsCard from 94px to a 34px empty box for 1-3 frames before expanding to the README.
- PluginPage tracked container width with a raw onLayout handler instead of useContainerWidthBelow, so narrow desktop windows (< 700px content width) painted a squeezed two-column first frame and hidden background stack screens recorded width 0 and flashed a stacked layout on Back navigation.
- Clicking a plugin row or card waited until navigation mounted to fetch the detail document, while showing a 94px stub skeleton, a fabricated Updates · 1 count, a mid-card Platforms insertion, and a premature Related plugins section that jumped down when the README arrived.

Expose preloadMarkdownParser and isMarkdownParserReady from react-native-enriched-markdown so the gallery warms WASM on mount and PluginPage holds one SettingsCard skeleton until both README data and the parser are ready. Prefetch plugin details on hover and press-in, compute the initial stacked threshold synchronously from window width while ignoring hidden zero-width measurements, size the overview skeleton to document proportions, defer the Updates count and Related plugins until detail resolves, and place Platforms after Updated.

* refactor(app): use named options and DSL helpers in plugin gallery navigation

* test(e2e): wait for registry detail response before clicking prefetched plugin
2026-12-02 13:39:43 +07:00
Matchy c75b718b2d fix(usage): prefer live Claude profile plan over credential snapshot (#11685)
Claude Code writes subscriptionType and rateLimitTier into
.credentials.json at sign-in and does not refresh them after a plan
change. Meanwhile GET /api/oauth/profile already returns live
organization.organization_type and organization.rate_limit_tier on the
account verification call.

Parse those fields from the profile response, resolve planLabel from the
live profile when present, and fall back atomically to the credential
snapshot only when the profile omits them so live and stale fields are
never mixed. Restrict rateLimitTier suffixes to multiplier tokens like
5x or 20x so default_claude_ai formats as "Pro" instead of "Pro ai".

Fixes #11668
2026-12-02 06:12:44 +00:00
Mohamed Boudra 3e2179cbc9 fix(copilot-usage-source): scope gh hosts.yml token lookup to github.com (#11689) 2026-12-02 13:02:44 +07:00
Mohamed Boudra 20755f5097 fix(server): restrict loopback alias origin check to canonical hosts (#11686) 2026-12-02 12:42:18 +07:00
Chirag Singhal 1fe9905fa3 fix: preserve rebound terminal routes on stale disposal (#10433) 2026-12-02 05:12:45 +00:00
Mohamed Boudra 211416b8eb feat(opencode): support conversation-only rewind on OpenCode v2 (#11675)
* feat(opencode): support Rewind conversation on OpenCode v2

OpenCode v2 stages a revert with files: false, which drops messages from the
target onward without restoring workspace files. Share one revert helper
between revertBoth (files: true) and the new revertConversation (files: false).

* refactor(opencode): pass single object parameter to OpenCodeV2Session.revert
2026-12-02 12:06:06 +07:00
Mohamed Boudra ab5e1d6fcb fix(app): wait for host connection before loading Files and related queries (#11679)
* fix(app): wait for host connection before loading Files and related queries

PR #11328 moved listWorkspaceExplorerDirectory out of useFileExplorerActions, removing the incidental client dependency that previously re-triggered FileExplorerPane initialization once the host finished connecting. Because FileExplorerPane had no connection gate, mounting while connecting wrote Host is not connected and stayed stuck after the host came online.

Gate FileExplorerPane and FileFilterResults on useHostRuntimeClient and useHostRuntimeConnectionStatus so they wait in a loading state while connecting and load automatically once online, and add useHostRuntimeIsConnected gates to the reconnect-vulnerable retry:false queries and observers (useAgentSkills, WorktreeSetupCalloutSource, add-project searches, useFileHandle/FilePane, ProviderSubagentPanel).

* refactor(app): let OwnedSubscription remain the sole reconnect owner in useFileHandle

subscribeFile already uses an OwnedSubscription that waits for connection and delivers fresh snapshots after reconnect. Keeping setObserving(observing) avoids duplicating reconnect ownership across two layers while still using useHostRuntimeClient.
2026-12-02 12:05:47 +07:00
paseo-bot[bot]andChirag Singhal 5029998013 fix: preserve workspace list connection diagnostics (#11676)
Co-authored-by: Chirag Singhal <76880977+chirag127@users.noreply.github.com>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-02 04:42:39 +00:00
Mohamed Boudra 2719695236 Brand plugin sponsor buttons and document funding waterfall (#11674)
* feat(plugins): brand sponsor buttons and document funding waterfall

Add shared funding platform normalization in @getpaseo/protocol and
render platform-branded Sponsor buttons with custom SVG marks across
the paseo.sh plugin sidebar and in-app plugin gallery (light and dark
themes). Document the four-tier funding collection waterfall in English
and Simplified Chinese publishing guides.

* fix(plugins): guard alias lookup, keep URL hash/port in dedup, assert theme colors
2026-12-02 11:23:51 +07:00
paseo-bot[bot] dc66f296da fix(app): confirm before discarding New Agent drafts (#11660)
Closing a New Agent tab dropped its only layout reference while leaving the draft active. Reuse the unsaved-changes prompt and finalize the draft after confirmation. Clear old active drafts once the saved layout identifies which ones still have tabs.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-02 03:43:15 +00:00
f7ceb13bd7 Create fork pull requests against the repository selected by gh (#11436)
* Create fork pull requests against the repository selected by gh

* Keep the origin fallback when GitHub CLI has no default remote

* Honor only an explicit GitHub CLI PR destination

* Resolve the current origin owner for fork pull requests

---------

Co-authored-by: Shane Su <26364206+suniceman@users.noreply.github.com>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-02 03:42:44 +00:00
paseo-bot[bot] fdec437e07 test(e2e): wait for the daemon to finish removing Hoplite (#11667)
Settings hides a provider's row as soon as Remove is confirmed, before
the daemon answers the config patch. The catalog test read the daemon
config once right after the row left, so it raced the in-flight patch
and saw hoplite still enabled. Poll the config and the providers
snapshot until the removal lands.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-02 03:40:13 +00:00
SuhailandMohamed Boudra 67b5da3544 fix(antigravity): omit relayed subagent tool calls from parent timeline (#11535)
* fix(antigravity): omit relayed subagent tool calls from parent timeline

* fix(acp): keep excluded tool calls out of message boundaries and turn state

Excluded tool calls (`AcpOptions.includeToolCall` returning false) are now
stored as `included: false` instead of dropped, so a later
`session/request_permission` that sends only the tool call ID still shows
the earlier input on its approval card. They no longer clear
`lastAssistantMessage`, so `turnEnd` still sees a silent executor error
that a relayed subagent call follows (#10885). They add no timeline row,
are not terminalized at turn end, and never keep the turn open. The
include decision is made once per call, on its first update.

Documents `includeToolCall` in the SDK and the provider guide, and adds
regression tests for the runtime and for Antigravity's relayed
`<uuid>:call_<id>` calls in Full access and Default modes.

Fixes #11541

---------

Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
2026-12-02 10:26:25 +07:00
paseo-bot[bot]andChirag Singhal 197e84c337 fix: expose unconfirmed terminal cleanup in daemon status (#11658)
Co-authored-by: Chirag Singhal <76880977+chirag127@users.noreply.github.com>
2026-12-02 02:42:59 +00:00
Vivek Kalyan 4d9bc25a1d fix(usage): omit null Codex credit balances instead of coercing to zero (#11515) 2026-12-02 02:42:39 +00:00
paseo-bot[bot]andBrandon Elliott 910e65d8b2 fix(server): install registry plugins when npm omits lockfile URLs (#11656)
Managed plugin installs require a lockfile entry with a registry URL. Ask npm to emit that URL for the staged install so a user setting cannot remove it.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Brandon Elliott <923787+Brandon168@users.noreply.github.com>
2026-12-02 01:42:36 +00:00
Mohamed Boudra 12e7f1fab1 Hide the keyboard by dragging the chat down on iOS or tapping empty space (#11625)
On iOS the chat list uses interactive keyboard dismissal: a drag that
reaches the keyboard pulls it down with the finger, and the composer
rides on its edge. The release-velocity flick still dismisses on both
platforms.

The chat list now keeps taps for the control under the finger. A link,
tool call, or copy button acts on the first tap instead of only closing
the keyboard. A tap on text or empty space still closes it.

On a new agent's empty draft, the panel wrappers no longer hide the dock
background from taps, so tapping empty space closes the keyboard there.

Closes #8775
2026-12-02 08:26:06 +07:00
paseo-bot[bot] bbdc3e326d fix(app): keep Import Session errors visible during Retry (#11654)
A retry clears the query error when the first request left no response. Cache the listing outcome so the provider row keeps its error until the new request settles.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-02 01:12:36 +00:00
SunicemanandShane Su bac45474de Include the tracked fork owner when polling a newly pushed workspace branch (#11441)
Co-authored-by: Shane Su <26364206+suniceman@users.noreply.github.com>
2026-12-02 00:42:47 +00:00
paseo-bot[bot]andClaude Opus 5.5 e928961472 Unmount a bottom sheet dismissed before its open animation starts (#11632)
* fix(app): dismiss a hidden bottom sheet that lands open after an interrupted open

The visibility tracker ignored an open detent when it had already moved to
closed. An open interrupted early reports -1, so an owner that hid the
sheet in that window left it closed in the tracker but open on screen.

* fix(app): unmount a bottom sheet dismissed before its open animation starts

Gorhom's BottomSheetModal sent a dismiss that arrived while the modal was
still INITIAL to BottomSheet.forceClose. The sheet still sat at its closed
position, so forceClose set isForcedClosing and animateToPosition returned
early: nothing cleared the flag, the mount animation was then skipped, and
the modal stayed mounted in DISMISSING with no onChange or onDismiss. Treat
INITIAL like CLOSED and unmount at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(app): apply the INITIAL dismiss fix to Gorhom's src copy for native bundles

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

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-12-02 00:00:59 +00:00
ralstonandpaseo-bot[bot] 83b80351f7 fix(server): stop probing provider snapshot targets whose workspace directory is gone (#11646)
* fix(server): stop probing provider snapshot targets whose workspace directory is gone

Background refreshes warmed every snapshot target ever seen, including archived workspaces whose worktrees were deleted. Each probe of a missing cwd ran into the provider's ready timeout while holding a slot in the per-provider discovery limiter, so a new agent's provider check queued behind them for minutes. Refreshes now drop targets whose directory no longer exists and warm only the rest.

Fixes #11643

* fix(server): keep targets with waiting reads and bound directory checks when pruning

A refresh no longer forgets a missing workspace target while a read is waiting on its probe, so the read gets its own result instead of a fresh loading target. Each directory check is capped at 1s and shared per cwd, so a stalled network or FUSE mount keeps its target without holding up every other workspace's refresh or stacking blocked stats.

* Inject the workspace directory check in snapshot tests

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-01 23:42:41 +00:00
paseo-bot[bot] 6eba86db2f Keep local plugin reloads fast from large package directories (#11653)
* fix(plugins): keep local plugin reloads independent of daemon cwd

esbuild inherited the daemon working directory and repeatedly read large ancestor directories during import resolution. Use the plugin root for the build and its metafile paths.

* Retry temporary worktree cleanup in the auto-archive test

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-01 23:12:43 +00:00
Junsandpaseo-bot[bot] f83c3bab70 Preserve Codex activity timestamps on reopen (#10760)
* Preserve Codex activity timestamps on reopen

* refactor(server): align reopen timestamp fix with server conventions

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-01 21:42:41 +00:00
Galaxy Roamingandpaseo-bot[bot] 535f3d36d0 fix(server): make concurrent archiveAgent calls idempotent (#10590)
* fix(server): make concurrent archiveAgent calls idempotent

* Share the outcome of overlapping agent archives

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-01 21:13:02 +00:00
paseo-bot[bot] 32fe3074a0 Retry Pi agent creation after an extension conflict is resolved (#11642)
* fix(server): retry failed provider catalogues when creating agents

A failed Pi extension probe could block agent creation after the user fixed the project. Let an explicit workspace lookup retry the failed discovery without starting extra probes on passive reads.

* Limit provider catalogue retries to named lookups

* Name the provider retry option

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-01 20:42:44 +00:00
SunicemanandShane Su 5b1ccba548 Probe the full Codex command for version-gated features (#11221)
Co-authored-by: Shane Su <26364206+suniceman@users.noreply.github.com>
2026-12-01 20:12:42 +00:00
paseo-bot[bot] 6cffd3994d fix(app): keep image selections through Android Activity recreation (#7734)
Keep in-flight Expo activity-result callbacks in the live AppContext until the picker returns, then release the detached registration. Run the lifecycle regression tests with the Android module suite.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-01 18:42:48 +00:00
paseo-bot[bot] 4101519112 test(server): verify stale sockets expire after reconnect (#11622)
Session pongs go to the requesting socket, so the replacement cannot fill the original socket’s send queue with pings. Exercise lease expiry and verify that the replacement keeps working.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-01 17:13:15 +00:00
paseo-bot[bot]andLouis Deconinck da58a57998 Recover Stop for unresponsive Pi and OMP agents (#11618)
* fix(server): recover Stop for unresponsive Pi and OMP agents

Keep turn ownership until the provider acknowledges Stop or its process exits. Resume the saved session when the user sends the next prompt.

Co-authored-by: Louis Deconinck <LouisDeconinck@users.noreply.github.com>

* Fix Pi and OMP Stop follow-up behavior

Keep idle recovery distinct from user Stop and reload Pi before applying settings to a stopped session. Force-stop a timed-out provider tree while its tool processes are still discoverable. Wait for both processes to exit in the newer-worker Windows CI test.

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Louis Deconinck <LouisDeconinck@users.noreply.github.com>
2026-12-01 17:12:44 +00:00
paseo-bot[bot]andMarcel W. Wysocki f76fd024fb Resolve full agent UUIDs without scanning history (#11617)
* Resolve full agent IDs without paging through archived agents

* test(server): guard direct lookup of stored agent UUIDs

Exercise a single-agent fetch when the archived agent has no project record. Count full scans while using the real daemon storage.

Co-authored-by: Marcel W. Wysocki <maci.stgn@gmail.com>

---------

Co-authored-by: Marcel W. Wysocki <maci.stgn@gmail.com>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-01 16:42:50 +00:00
2f7e22e621 Release inactive workspace composers during repeated switches (#11613)
* fix(app): release inactive workspace decks and bound retention

* Keep workspace expiry on the live clock

Preserve the existing retention limits and cover expiry while switching workspaces in the compiled app.

Co-authored-by: Sergey S. Volkov <16340911+js2me@users.noreply.github.com>

---------

Co-authored-by: Сергей Волков <ser.volkov@vk.team>
Co-authored-by: Sergey Volkov <js2me@outlook.com>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Sergey S. Volkov <16340911+js2me@users.noreply.github.com>
2026-12-01 16:12:47 +00:00
paseo-bot[bot] 9592f88fdf Make OMP idle-deadline tests independent of runner speed (#11612)
The provider idle deadline compares Date.now() with the last provider
event. Two tests measured that silence with real delays, so a slow
Windows runner stretched a 50 ms delay past the 80 ms deadline and the
turn failed before the test retried. Freeze Date in those tests and
advance it explicitly.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-01 15:48:26 +00:00
paseo-bot[bot] 0d244c192a Keep finished Claude subagents completed after reopening (#11602)
* fix(claude): keep completed subagents after reopening

A stop inferred during restart could overwrite the saved completion for the same SendMessage resume. Preserve the completion when the transcript proves that the latest successful resume finished.

* Test the timeline toast with a delayed reply

* Name the replay and timeline test arguments

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-01 14:42:42 +00:00
paseo-bot[bot]andDaniel JB Clark 6354565748 fix(desktop): prevent renderer test imports from racing (#11605)
Playwright workers share the transform cache. Load compiled workspace packages directly so fixture imports cannot read partial cache entries.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Daniel JB Clark <131936+djbclark@users.noreply.github.com>
2026-12-01 14:12:47 +00:00
Mohamed Boudra e06218e9f4 Stop status rings jumping when the sidebar slides in on Android (#11591)
* fix(app): count the indicator clock with a timing the driver cannot end early

The native clock was a decay that never slows. React Native's driver ends
a decay when its value moves less than 0.1 between two frames, and two
frames that carry the same millisecond are enough. #11586 started the
decay again from the JS thread, but every end still showed as a pause and
a jump until the JS thread got to it.

The clock is now a linear timing, which the driver reads off the time
since it started and has no such check. It counts in ten-minute spans.
The end of a span is the one event that reaches the JS thread, which
starts the next span at the current time.

* fix(app): hold running indicators in place while their panel is hidden

A ring, loader or shimmer in a panel that was not showing drew its resting
frame. On a phone the sidebar slides into view before its panel counts as
showing, so every ring sat at the resting position during the slide and
jumped to the running position when the slide settled.

A hidden indicator now stays bound to its clock and stops running it. The
clock and the loader's ticker hold the time they have run and count on from
it, so an indicator continues from where it stopped.
2026-12-01 20:25:41 +07:00
SunicemanandShane Su fec7454c31 Accept advertised question IDs for Codex async answers (#11225)
Co-authored-by: Shane Su <26364206+suniceman@users.noreply.github.com>
2026-12-01 13:12:51 +00:00
Mohamed Boudra 5adfd4961c Stop Claude usage polling from hitting the rate limit, and wait it out across token refreshes (#11597)
* Stop Claude usage calls at turn end and honor 429 waits across token refreshes

A Claude turn's result no longer asks the usage registry to refetch: an
agent observation now only merges the usage it carries. The Claude usage
source waits at least five minutes after a 429 (escalating to an hour),
keys that wait by the login's locator instead of its token, and applies it
to the profile endpoint too. Error reports can carry retryAt, which the
registry and the app's poll honor.

* Cover retryAt wire compatibility for older clients

* Show the time left until a rate-limited usage report retries, counting down on the card

The Claude source now reports only the reason and retryAt. The app adds the time left from
retryAt, ticks it each minute, and polls when it passes.

* Print when a rate-limited usage report retries in paseo usage, and read the time when a countdown starts

The CLI appends "Retrying at <retryAt>." to the error. A relative-time label that starts ticking
after its card mounted now reads the current time instead of the mount time.
2026-12-01 19:55:11 +07:00
paseo-bot[bot] d1ee5dee63 Keep split panes from re-rendering on unrelated workspace updates (#11600)
useWorkspaceTerminals built createTerminal on the useMutation result,
which TanStack returns as a new object on every render. Each render of
the workspace screen therefore gave every pane a new compact header
renderer and re-rendered all panes. The Explorer resize performance
test failed when an unrelated render landed inside its drag.

Depend on the stable mutate and the pending flag instead.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-01 12:44:47 +00:00
paseo-bot[bot]andDesmond Leong 1adabf70c8 fix(claude): settle stopped subagents after a daemon restart (#11594)
Claude can send a stop before it announces tasks in the new session. Match the terminal notice to the restored child so the open chat updates its original row.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Desmond Leong <desmond@returning.ai>
2026-12-01 12:12:45 +00:00
87427c2aa1 Release the microphone when voice mode stops without a daemon connection (#11587)
If the daemon is unreachable when voice mode stops, setVoiceMode(false)
rejects and stopVoice never stopped microphone capture or released the
screen wake lock. The runtime then reported voice as disabled while the
microphone stayed open.

Release capture and the wake lock in a finally block. The rejection still
propagates to the caller.

Closes #7558

Co-authored-by: luke <luopeihuan@gmail.com>
Co-authored-by: RoundRedDot <roundreddot@gmail.com>
2026-12-01 18:10:26 +07:00
Mohamed Boudra cfa4536358 Show Antigravity usage again, refreshed only when you ask (#11585)
* Show Antigravity usage again, refreshed only when you ask

Google's December 2026 terms allow running the unmodified agy harness,
including `agy -p`, through supported interfaces. Each `agy -p "/usage"`
still refreshes the quota on Google's backend, so Paseo must not run it
in the background.

Add `refresh: "manual"` to usage source registrations. The daemon never
fetches a manual source on lists, polls, or agent observations. A
targeted or host-wide forceRefresh fetches it once and caches the result
until the next forceRefresh. Before the first refresh, the report entry
has status `not_fetched`, and the card asks the user to refresh. A failed
manual refresh is not retried.

Restore the Antigravity usage source as a manual source. API key sign-in
reports a no-quota message instead of an error.

Update the Antigravity docs for the new terms and the plugin reference
for the new field.

Refs #10952

* Keep a manual usage result when agents join or leave the account

A manual result was keyed by the account's login set. Each Antigravity
agent adds a login, so a second agent or a closed agent reset the card to
"Not checked yet". Key a manual result by its report id instead.
2026-12-01 18:08:31 +07:00
Mohamed Boudra 7f75b0e166 Keep status rings turning when the native driver ends their clock (#11586)
Every status ring and tool-call shimmer on native rides one decay animation. React Native's driver ends a decay when its value moves less than 0.1 between two frames, and on Android two frames that carry the same millisecond are enough. The clock kept its handle, so every indicator froze until all of them left the screen and one came back.

The clock now listens for the driver ending the decay and starts it again at the current time.
2026-12-01 18:00:04 +07:00
Mohamed Boudra b0ca089d54 Skip redundant finished notification after a child agent reports via send_agent_prompt (#11583)
* fix(server): skip redundant finished notice after a child reports to its caller

When a watched child calls send_agent_prompt to report back to its caller, its final wrap-up response usually takes longer than the 2s message-delivery quiet window, so the caller wakes up on the report and then receives a second redundant 'Agent ... finished' notification once the child's turn ends.

Track per-watch report state on the daemon instead of relying on debounce timing or extra agent parameters: admitting an agent-message from a watched child to its caller marks active (non-pending) watches for that pair as reported, while subsequent non-reporting tool calls or a new turn_started clear the mark. Clean turn completions with the mark set end silently (or keep following silently if pending work remains); errors, permission requests, cancellations, and closes are never suppressed.

* docs(agent-lifecycle): note text-only output after explicit report keeps mark

* fix(server): ignore turn 1 turn_started after report and update cross-host batch e2e test

On remote children, turn 1's own turn_started frame can arrive over the observation stream after a fast send_agent_message already marked the watch as reported. Track turn completion so only a turn_started after a completed turn resets per-turn report state.

Update hosts.e2e.test.ts so turn 1 verifies suppression of the redundant finished notice after REMOTE_REPORT, and a follow-up unreported turn exercises automatic remote completion delivery.
2026-12-01 17:44:03 +07:00
Mohamed Boudra 91e7713721 refactor(client,desktop,app): share HostTransportSpec and protocol URIs for browser proxy (#11577)
Follows up on #11561 so adding a new transport (such as hub://) requires no parallel union or dial branch in the desktop browser proxy.

- Move HostTransportSpec, localListenOfHostTarget, and serializeSshTransportUri into @getpaseo/protocol so app, client, and desktop share one URI and local-listen contract.
- Move routed (via) dialing into @getpaseo/client/node createHostTransportFactory (lazy-loading the full client entry so @getpaseo/client/node/lean stays lean) and export DaemonTransport and HostTransportSpec publicly.
- Collapse BrowserProxyTarget / DesktopBrowserProxyTarget onto HostTransportSpec, remove per-transport branches from openTunnelWireConnection, and deduplicate browser routing input assembly between the hook and bridge.
- Rename linkCeiling to admittedCeiling in server handleTunnelHello to match both routed channels and Hub sockets.
2026-12-01 17:43:46 +07:00
SunicemanandShane Su e20ea2aaf2 fix(acp): preserve plain-text setting errors (#11431)
Co-authored-by: Shane Su <shane.su@maiscrm.com>
2026-12-01 10:42:48 +00:00
Mohamed Boudraandluoph 806214d285 Keep long Markdown replies cheap to stream on web and mobile (#11582)
Streaming one long reply made each reveal frame more expensive as the reply grew. The renderer now splits a streaming message into sealed head parts and a tail on every platform, and finds the boundary by parsing only the source after it.

Refs #7584

Co-authored-by: luoph <1686898+luoph@users.noreply.github.com>
2026-12-01 17:36:12 +07:00
KiritoXDone e5edb6efd5 fix(server): keep the full last reply across notifications (#11578) 2026-12-01 10:12:40 +00:00
Mohamed Boudra 0a0544fa4f fix(app): keep chat loading minimal and stop post-load Updating messages flash (#11575)
* fix(app): simplify chat loading state and eliminate post-load updating toast

Loading a workspace or chat previously shifted the spinner vertically as status text swapped in and out, jumped again when underfilled history handed off to the stream viewport overlay, and flashed an "Updating messages" toast right after content painted.

- Render LoadingState as a centered minimal spinner with accessibilityLabel only (no visible text).
- Hoist the agent-initial-fill overlay onto ChatAgentReadyContent so initial history fill shares the same full-pane geometry as agent-loading and reveals the chat and composer together.
- Emit a follow-up catch_up after a bootstrap tail replace only when live head rows actually extend past endCursor.seq, avoiding a redundant after fetch that kept visibility catch-up pending after the chat rendered.
- Keep the FRESHNESS_CHECK_QUIET_MS quiet window across initial subscribe and tail catch-up for opened cursorless chats (such as display-only caches with range: null).

* refactor(app): remove dead viewport initial-fill fallback and unused hostName prop

* fix(app): keep initial history fill overlay non-interactive

The previous viewport-level agent-initial-fill overlay used pointerEvents: none so pointer interactions were never blocked while underfilled history fetched older pages. Hoisting it onto ChatHistoryLoadingOverlay omitted pointerEvents: none, which intercepted scroll.hover() until the held page timed out.
2026-12-01 17:09:59 +07:00
Mohamed Boudra 914143e8b0 Show connected clients and hosts with scopes in Devices settings (#11209)
* feat(devices): show connected clients and hosts with scopes in host settings

Expose live daemon sessions and inbound/outbound peer daemon links in
Settings → Host → Devices, and move Ways to connect (Relay + Tailscale)
into a Pair a device header button sheet so the Devices view stays focused
on active connections.

Protocol changes stay backward compatible with older daemons and clients:
- Optional hello.clientInfo carries device name, platform, kind, and peer
  daemon identity without widening the existing clientType enum.
- daemon.clients.list.request/.response/.changed (gated on
  server_info.features.connectedClients and access.manage) streams live
  connected clients and inbound daemon links with their routed sessions.
- HostSummary gains optional version, permissions, and connectedAt fields
  populated from the remote daemon's server_info while online.

* fix(devices): trim unused client wire fields, stabilize pair modal, and add browser E2E

* fix(devices): reset pair modal step on dismiss and close sheet before host switch

* fix(page-layout): attach titleTestID to title parts instead of outer header with actions

* refactor(devices): flatten daemon session summary primitive and align with auth plan

* fix(devices): keep idle and reconnecting host-link sessions visible via hello.hostLink
2026-12-01 16:59:16 +07:00
411 changed files with 19812 additions and 2829 deletions
+17 -11
View File
@@ -236,17 +236,23 @@ wake-ups), or the child's own outstanding finish subscriptions as a caller. Hear
crons, change-request watches, and other daemon background items never count: they are external
triggers, not work the caller is waiting for.
Every turn end reports `finished` at once. When work is still pending, the notice names it and the
subscription follows the child: each later turn end reports `finished` again, and the child settling
with nothing pending sends a final `finished` and removes the subscription, even when the work
drains without another turn. Reporting at once keeps a long-lived task, such as a dev server, from
leaving the caller without the child's reply. Following is what lets the caller hear the reply a
background task wakes up later ([#6346](https://github.com/getpaseo/paseo/issues/6346)). A work change
that leaves work pending sends nothing. Errors, permission requests, and closes report as they
happen. `followingSince` is stored when following starts, so a restart keeps following instead of
waiting for another turn end. After 24 hours of following, the caller gets a final `finished` with
the child's last reply and the subscription ends. Remote children and providers without the probe
report their first turn end as a settled `finished`.
Every turn end reports `finished` at once, unless the child already sent an agent message to its
caller during that turn and started no further tool work afterwards. In that case the child's
message already delivered its reply, so the redundant `finished` notice is skipped: a settled watch
ends silently, and a watch with pending work keeps following silently until a later turn starts or
the work drains. Starting another non-reporting tool call or a new turn clears that mark (plain text output after the
message does not), and errors, permission requests, cancellations, and closes are never suppressed. When work is still
pending on an unreported turn end, the notice names it and the subscription follows the child: each
later turn end reports `finished` again, and the child settling with nothing pending sends a final
`finished` and removes the subscription, even when the work drains without another turn. Reporting
at once keeps a long-lived task, such as a dev server, from leaving the caller without the child's
reply. Following is what lets the caller hear the reply a background task wakes up later
([#6346](https://github.com/getpaseo/paseo/issues/6346)). A work change that leaves work pending
sends nothing. Errors, permission requests, and closes report as they happen. `followingSince` is
stored when following starts, so a restart keeps following instead of waiting for another turn end.
After 24 hours of following, the caller gets a final `finished` with the child's last reply and the
subscription ends. Remote children and providers without the probe report their first turn end as a
settled `finished`.
Permission requests are notification checkpoints, not the end of that subscription. The caller is notified again after a permission response when the child finishes, errors, or requests another permission.
The permission notification includes the normalized request plus the child and request IDs, so the caller can inspect it and respond without fetching agent status.
+12 -4
View File
@@ -29,7 +29,7 @@ So arrival sets a _target_ and the reveal rate is derived from the backlog inste
- **The coalescer is leading + trailing.** The first delta after an idle window flushes synchronously; only the rest of the burst waits for the trailing timer. Reverting to trailing-only adds a full window to the first character of every turn. Same shape and the same reason as `TerminalOutputCoalescer`.
- **The leading flush adds a canonical row, and that is fine.** A burst's first chunk lands as its own timeline row. `mergeAssistantChunks` / `mergeReasoningChunks` in `timeline-projection.ts` join contiguous same-turn rows, and clients read the projected timeline, so history is unaffected. Tests that assert on raw rows have to account for the extra row; tests that assert on what a client sees do not.
- **The store holds the full text; only the rendered slice is paced.** Copy, selection, the chat outline, and scroll geometry all read the same string the user can see. Pacing the store instead would leave the bottom anchor chasing a content height that is ahead of the reveal.
- **One source assistant message is one display row.** Presentation projects plugin output and caches unchanged history. The shared [Markdown renderer](markdown-renderer.md) owns rendering on every platform. Chat paces the visible source and applies a 32,000-character render cap on web; native keeps the complete message. The native renderer keeps closed blocks in a stable head and sends the paced suffix to a separate tail view during streaming; completion reunites them for selection. This stays inside the renderer, without promoting blocks into timeline history.
- **One source assistant message is one display row.** Presentation projects plugin output and caches unchanged history. The shared [Markdown renderer](markdown-renderer.md) owns rendering on every platform. Chat paces the visible source and applies a 32,000-character render cap on web; native keeps the complete message. While streaming, the renderer keeps closed blocks in head parts and sends the paced suffix to a separate tail; completion reunites them for selection. This stays inside the renderer, without promoting blocks into timeline history.
- **Message identity survives completion.** Assistant row ids are source message ids. Plugin rows can replace a source, so find, scroll-to-message and history reveal still use `getStreamItemMessageId`. Width-specific measurements describe whole rendered messages.
- **First sight of a text is revealed whole.** Only growth is paced. This is what makes history hydration, timeline replay, a virtualized row remounting on scroll, and an already-finished message all render complete on first paint without a special case for each.
- **Leaving `phase: "streaming"` snaps the reveal.** A completed turn must never be left holding characters. `layoutStream` sets the phase, so anything outside the live head with an active turn is already complete.
@@ -49,11 +49,19 @@ So arrival sets a _target_ and the reveal rate is derived from the backlog inste
while text arrives, and release obsolete window caches as the reader reveals more history;
window caches must stay bounded while their source timeline remains loaded.
## Native parsing cost
## Markdown parsing cost
The native library reparses and measures its entire `markdown` prop on each update. During streaming, the renderer splits source at an mdast block boundary and memoizes the head, so per-frame updates parse only the tail. Boundary discovery runs when a source line completes, rather than on every reveal frame. The unfinished line and final parsed block stay in the tail, preserving list continuation, setext headings, tables and open fences. Reference-dependent source and HTML retain a larger tail because later source can change their meaning. A single long block therefore still carries its full parsing cost.
Both engines reparse their entire `markdown` prop on each update: md4c in C++ on native, md4c in WASM plus a JSON tree on web. Source adaptation adds a full mdast parse for some text, such as any `&`, at about 1 µs per character. Rendering a growing reply whole on each reveal frame therefore makes the reply quadratic to stream.
Completion restores one native text view per Mermaid-delimited segment, so selection crosses prose paragraphs again. The head retains its trailing block margin while split. JS reveal remains the pacing source; native opacity animation stays disabled.
While streaming, `createStreamingMarkdownSplitter` in `components/markdown/streaming.ts` splits the message into head parts and a tail, on every platform. The tail is the last block and the unfinished line, so list continuation, setext headings, tables and open fences render as they will when complete. Rules that keep the cost per frame flat as the reply grows:
- **Discovery is incremental.** The boundary moves only when a line completes, and each time the splitter parses only the source after the boundary. Blocks before it are closed and need no document context.
- **Head parts are sealed at 2,000 characters.** Each completed block re-renders the head part it lands in. Only the last part grows, so that work stays bounded. A single head would re-render all closed blocks each time a block completes.
- **The first part keeps its React key from the first frame to the completed message.** Completion re-renders it in place instead of remounting it, and the parts share one image occurrence key, so an image keeps its acquisition when its block moves into the head.
Two kinds of source fall back to a growing render, because later source can change how earlier source reads. A link definition can turn an earlier `[label]` into a link, so a message with one renders as one document until it completes. HTML needs its enclosing source, so HTML and every block after it stay in the tail. A single long block also carries its full cost.
Completion renders one view per Mermaid-delimited segment, so native selection crosses prose paragraphs again; while streaming it crosses only within a part. JS reveal remains the pacing source; native opacity animation stays disabled.
## Measuring
+7 -3
View File
@@ -2,11 +2,11 @@
Use `MarkdownRenderer` for chat replies, file previews, plans, pull requests and changelog content. It uses `react-native-enriched-markdown` on iOS, Android and web. Keep source adaptation and renderer configuration in `components/markdown`; consumers supply Markdown and, when needed, its file location.
Native selection belongs to the library's text view. Keep an assistant message in one row so selection can cross paragraphs, headings and lists. Code blocks and tables use the library's native views and their selection behavior. Web uses browser selection over semantic HTML. Once its WASM parser is initialized, the library parses synchronously for the first commit of each mounted row; an empty interim row would corrupt virtualized measurements and move the reader. Chat owns paced reveal, the web render cap, message identity and list measurement. Native renders completed messages together. While streaming, it keeps closed blocks in one head view and updates a separate tail, then reunites the text on completion. See [native parsing cost](agent-stream-performance.md#native-parsing-cost) for the boundary and pacing constraints.
Native selection belongs to the library's text view. Keep an assistant message in one row so selection can cross paragraphs, headings and lists. Code blocks and tables use the library's native views and their selection behavior. Web uses browser selection over semantic HTML. Once its WASM parser is initialized, the library parses synchronously for the first commit of each mounted row; an empty interim row would corrupt virtualized measurements and move the reader. Call `preloadMarkdownParser()` ahead of navigation or gate a loading skeleton on `useMarkdownParserReady()` (`packages/app/src/components/markdown/parser-ready.ts`) so cold web mounts do not paint an empty interim container. Chat owns paced reveal, the web render cap, message identity and list measurement. A completed message renders as one document. While streaming, the renderer keeps closed blocks in head parts and updates a separate tail, then reunites the text on completion. See [Markdown parsing cost](agent-stream-performance.md#markdown-parsing-cost) for the boundary and pacing constraints.
## Block spacing
Every block is separated by one gap, `density.blockGap`: 12 on compact layouts, 16 wider. Inside the library's text, every element style ends with that gap and the library drops it after the last block. Views stacked outside the library (Mermaid segments, streaming head and tail) use the same gap through `MarkdownBlockStack`. Do not give a block type its own margins; change the gap.
Every block is separated by one gap, `density.blockGap`: 12 on compact layouts, 16 wider. Inside the library's text, every element style ends with that gap and the library drops it after the last block. Views stacked outside the library (Mermaid segments, streaming head parts and tail) use the same gap through `MarkdownBlockStack`. Do not give a block type its own margins; change the gap.
## Links and images
@@ -14,7 +14,11 @@ Workspace file links use the shared file-link resolver. The workspace supplies i
Right-click on web and long press on native open one link menu per rendered part (`components/markdown/link-menu`), not one per link: a menu root cannot sit inside a paragraph without producing invalid markup on web. The native long-press event carries only the URL, with no position and no syntax context. The menu takes the position from the touch that started the press, and treats a URL that is no `](destination)` in the source as recognized text.
Pass `external` for author-controlled Markdown from outside the host, such as a plugin README. It follows the registry's overview contract in `packages/protocol/src/plugin-overview.ts`, which the website also uses: only absolute https links and images work, and any other destination renders as its label or alt text. The parser still autolinks bare `http://`, `www.` and email text, so a link press checks the URL again and opens only https. None of the workspace recognition above applies, so `Node.js` is prose, not a file. The lines of a paragraph join, as they do on the README's forge.
Compose the renderer's capabilities per surface instead of bundling them under one flag:
- `destinations="https"` restricts links and images to absolute `https://` destinations following the registry's overview contract in `packages/protocol/src/plugin-overview.ts` (which the website also uses). Any other destination renders as its label or alt text, no host files are read via `client.readFile`, and workspace path recognition is off so `Node.js` stays prose. The parser still autolinks bare `http://`, `www.` and email text, so a link press checks the URL again and opens only `https://`.
- `forgeShorthand` (default `true`) controls whether `#12` / `owner/repo#12` references resolve against the workspace's `ForgeShorthandProvider`. Pull request comments keep `destinations="https"` with `forgeShorthand` enabled; plugin READMEs and the changelog disable `forgeShorthand` so they never link to whichever workspace happens to be open.
- `softBreaks` (`"break"` default, `"join"` for READMEs and changelogs) controls whether single newlines inside a paragraph become hard breaks or join into one line as they do on a forge.
Resolve workspace image paths over the existing session RPC, then give the library a cached native file URL or web blob URL. HTTP(S) images pass through unchanged. This preserves relay, SSH and local socket connections, which do not expose a daemon HTTP endpoint. Each mounted renderer owns its image acquisition identity, so a later reply reads a rewritten path again while the earlier mounted reply retains its snapshot. Image taps open the attachment lightbox. File previews resolve relative images against the Markdown file's directory. An image alone on its line becomes its own paragraph before the library sees it, so it renders as a block on every platform; the library only treats sole-child paragraph images as blocks, and with hard soft breaks every newline is a break node, which left own-line images inline on iOS and web. Images that share a line with text stay inline at line height and keep their aspect ratio. A linked image counts as an image, so review-bot badges such as `[![Retrigger](badge.svg)](url) Confidence` stay inline on web; the library's web renderer only checked direct paragraph children, so it rendered them as full-width block images (fixed in the fork).
+4 -3
View File
@@ -146,9 +146,10 @@ definition, no longer eligible to begin.
- Panels whose gesture wrapper already owns visibility use `RetainedPanelActivity` to provide the
same active signal without adding another layout root. Persistent animations, timers, polling, and
shared clocks must subscribe to that signal and stop when their final visible consumer leaves.
- Synchronized step animations use one wall-clock-aligned source. Register a local shared value only
while its retained panel is active so hidden animated styles remain mounted without receiving clock
updates. Do not give every instance its own loop or leave hidden styles subscribed to the source.
- Synchronized step animations use one source. Do not give every instance its own loop. A hidden
instance stops running the source and keeps its place, because the active signal changes after the
panel has slid into view; see
[running-indicators.md](running-indicators.md#hidden-panels).
- Retention order and render order are separate concerns. LRU metadata may change on every switch;
keyed retained roots must keep a stable sibling order. Moving large retained roots triggered Fabric
Differ failures (`addViewAt` / `removeViewAt` view reuse) on Android.
+53 -13
View File
@@ -14,14 +14,37 @@ value.
`components/indicator-motion` owns the two pieces every indicator shares:
- `useIndicatorMotion()` decides whether an indicator may move: not under reduced motion, not in a
retained panel that is not showing, not while the app is in the background. An indicator that may
not move draws its resting frame and runs nothing. Ask this hook; do not read reduced motion or
visibility yourself.
- `useIndicatorMotion()` says what an indicator does now. Ask this hook; do not read reduced motion
or visibility yourself.
- `moving`: it runs.
- `held`: nobody can see it, in a retained panel that is not showing or in an app in the
background. It runs nothing and keeps its place.
- `resting`: the system asks for reduced motion. It draws its resting frame and runs nothing.
- The driver: `loop.web.ts` on web, `clock.ts` on native.
Animate only `transform` and `opacity`. Anything else is painted on the main thread every frame.
## Hidden panels
A phone's sidebar slides into view before its panel counts as showing: the panel's active signal
changes when the slide settles, never during it (see [mobile-panels.md](mobile-panels.md)). An
indicator that changes what it draws on that signal changes it in front of the user. A held ring
that drew its resting position jumped to the running position at the end of every slide.
So on native a held indicator stays bound to its clock and stops running it:
- The clock and the loader's ticker count the time they have run, and hold it while nothing runs
them. They are never set back to zero or to the wall clock.
- While another panel runs the clock, a held view follows it. Measured on an Android emulator with
six held rings behind a running chat, the app drew the same frames a second as with the rings
unbound, and CPU on each thread differed by less than it does between two runs.
- While nothing runs the clock, a held view costs nothing: behind an idle chat the app draws no
frames.
- One commit can stop the last moving indicator and start another, as when the sidebar replaces the
chat. The clock stops after the commit, so it counts through that without a restart.
Web does not do this: a held indicator on web cancels its loop and draws its resting frame.
## Frames
Keeping the animation off the React thread does not make it free. Every time an indicator moves,
@@ -88,11 +111,27 @@ For a transition that is fine. For an indicator that runs for an hour it was 22
the UI thread of an Android emulator.
React Native's own `Animated` with `useNativeDriver: true` updates the view from the native driver
and commits nothing. `clock.ts` builds a clock out of it: a decay that never slows, at one unit per
millisecond, is the time since it started. Decay is the one native-driven animation that computes
its value from the frame timestamp instead of replaying a 60 fps recording, so it is exact at any
refresh rate and needs no loop restart. `Animated.modulo` and `interpolate` turn the clock into a
rotation or a translation, all inside the native driver.
and commits nothing. `clock.ts` builds a clock out of it: a linear timing at one unit per
millisecond is the time since the clock started. `Animated.modulo` and `interpolate` turn the clock
into a rotation or a translation, all inside the native driver.
The timing counts in spans of ten minutes. The end of a span is the one event that reaches the JS
thread, which starts the next span where that one ended, so a cycle keeps its place from one span to
the next.
The native driver owns the clock's value. The JS thread starts and stops the counting and never
sets the value, so a stopped clock keeps the value its views show. When the clock stops, the driver
reports the value it stopped at, and the next start counts on from it.
Do not drive the clock with a decay. A decay that never slows counts time without spans, but the
driver ends a decay when its value moves less than 0.1 between two frames, whatever the
deceleration. Two frames that carry the same millisecond are enough, and then every indicator on
the clock freezes. Starting the decay again from the JS thread shows as a pause and a jump each
time.
Android replays a timing as 60 positions a second at any refresh rate, and iOS interpolates between
them. Every cycle on the clock is stepped at 30 positions a second, so this does not show. A cycle
without steps would move 60 times a second on a 120 Hz Android display.
`cycle(periodMs, { steps })` holds the position at each step. The driver still ticks every frame,
but a view whose transform did not change is not invalidated, so nothing is drawn between steps.
@@ -100,14 +139,15 @@ but a view whose transform did not change is not invalidated, so nothing is draw
The native clock starts on the frame where the driver picks it up, so two clocks started at
different times turn their steps over on different frames. That is why the shimmer rides
`sharedIndicatorClock`, the rings' clock, with `phase: "own"`: its pass starts at the clock's
current step. The JS thread works out that step from the time it started the clock. The driver
current step. The JS thread works out that step from the time it started the clock and the value
the clock started from. The driver
starts the clock a frame or two later, so a pass can start one step early or late. The band starts
one band width outside the label, so this does not show.
The loader changes six times per cycle, so it does not ride the frame clock. `step-ticker.ts` wakes
the JS thread once per step, aligned to wall-clock step boundaries, and publishes the step into a
native `Animated.Value`. A wake-up that arrives late publishes the step that is current by then, so
the loader never drifts and every loader shows the same step.
the JS thread once per step and publishes the step into a native `Animated.Value`. A wake-up that
arrives late publishes the step that is current by then, so the loader never drifts. Every loader
reads the one value, so they all show the same step.
Do not apply Unistyles dynamic styles to these `Animated.View`s; see
[unistyles.md](unistyles.md#reanimated-animatedview--dynamic-styles-crashes).
+4 -3
View File
@@ -172,9 +172,10 @@ is offline and until a reconnected chat's check answers, so an unchanged chat ne
toast. Returning from background on a socket that stayed connected shows nothing until the check
answers: the chat stayed subscribed, so a slow answer is no reason to doubt it, and a socket that
died without closing fails the foreground liveness probe and becomes a reconnect. Updating messages
appears for a chat that is behind, until the fetch completes, and for an opened chat whose check is
still unanswered `FRESHNESS_CHECK_QUIET_MS` after it was sent. That delay measures the daemon, so it
starts at the request: on a cold start the cache read alone can take longer. Socket connectivity
appears for a chat that is behind, until the fetch completes, and for an opened chat whose check or
cursorless initial tail catch-up (such as a display-only cache) is still unanswered
`FRESHNESS_CHECK_QUIET_MS` after the subscribe request was sent. That delay measures the daemon, so
it starts at the request: on a cold start the cache read alone can take longer. Socket connectivity
alone cannot certify that the displayed conversation is current. The timeline owner publishes freshness; the view renders it without a toast timer or a
separate resume workflow.
+1 -1
View File
@@ -1 +1 @@
sha256-04BfmBEaEZy3ohSi3Z8S3/a3xBsLKhls+8mcjJ0Y2/A=
sha256-x6E6SY98/8pUNLomlPzSNedZ+ZKJPzsQeS9L455i+n0=
+7
View File
@@ -12136,6 +12136,12 @@
"dev": true,
"license": "BSD-3-Clause"
},
"node_modules/@silvia-odwyer/photon-node": {
"version": "0.3.4",
"resolved": "https://registry.npmjs.org/@silvia-odwyer/photon-node/-/photon-node-0.3.4.tgz",
"integrity": "sha512-bnly4BKB3KDTFxrUIcgCLbaeVVS8lrAkri1pEzskpmxu9MdfGQTy8b8EgcD83ywD3RPMsIulY8xJH5Awa+t9fA==",
"license": "Apache-2.0"
},
"node_modules/@sinclair/typebox": {
"version": "0.27.10",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.10.tgz",
@@ -40615,6 +40621,7 @@
"@modelcontextprotocol/server": "2.4.0",
"@opencode-ai/sdk": "1.14.46",
"@opencode/client": "2.0.10",
"@silvia-odwyer/photon-node": "^0.3.4",
"@xterm/addon-serialize": "0.14.0",
"@xterm/addon-unicode-graphemes": "0.5.0-beta.330",
"@xterm/headless": "6.1.0-beta.334",
@@ -125,10 +125,17 @@ for (const theme of ["light", "dark"] as const) {
await expect(
page.getByRole("button", { name: "Hoplite provider details", exact: true }),
).toHaveCount(0);
expect((await client.getDaemonConfig()).config.providers?.hoplite).toBeUndefined();
expect(
(await client.getProvidersSnapshot()).entries.some((entry) => entry.provider === "hoplite"),
).toBe(false);
// The row leaves the list once Remove is confirmed, before the daemon answers.
await expect
.poll(async () => (await client.getDaemonConfig()).config.providers?.hoplite)
.toBeUndefined();
await expect
.poll(async () =>
(await client.getProvidersSnapshot()).entries.some(
(entry) => entry.provider === "hoplite",
),
)
.toBe(false);
await writeFile(
testInfo.outputPath(`hoplite-removed-${theme}.json`),
JSON.stringify(await client.getProvidersSnapshot(), null, 2),
@@ -14,6 +14,7 @@ import {
answerFreshnessCheck,
commitTimelineTurnsWhileDisconnected,
disconnectViewedTimeline,
expectCleanLoadingSurfaces,
expectEmptyChatSynced,
expectPromptAndWholeReply,
expectResumeAnsweredWithoutFetch,
@@ -26,11 +27,14 @@ import {
restoreViewedTimelineWithHeldResponse,
restoreViewedTimelineWithLiveRowsFirst,
reopenWithFreshnessCheckUnanswered,
reopenWithTimelineTailUnanswered,
seedStreamingReplyAgent,
sendPromptWhileDisconnected,
stopStreamingReply,
waitForDisplayOnlyTimelineCache,
waitForResumeAnswer,
reopenAppWatchingForUpdatingToast,
watchColdAndReloadLoadingSurfaces,
watchForUpdatingToast,
} from "../support/helpers/timeline-resume";
@@ -176,4 +180,36 @@ test.describe("Agent timeline resume", () => {
await agent.cleanup();
}
});
test("cold opens and display-only cache reloads keep loading steady and reserve Updating messages for slow replies", async ({
page,
}) => {
test.setTimeout(120_000);
const gate = await installDaemonWebSocketGate(page);
const agent = await seedLongMockAgentTimeline({ turns: 30 });
try {
await watchColdAndReloadLoadingSurfaces(page);
await test.step("cold open fetches one tail without showing a premature toast", async () => {
const requests = rememberTimelineRequestCounts(gate, agent.agentId);
await openAgentTimeline(page, agent);
await expectTimelinePromptVisible(page, agent.newestPrompt);
await expectCleanLoadingSurfaces(page, gate, requests);
});
await test.step("display-only cached reload shows Updating messages until the overdue tail arrives", async () => {
await scrollTimelineUntilOlderHistoryIsReachable(page, agent.firstOlderPagePrompt);
await waitForDisplayOnlyTimelineCache(page, agent);
const requests = rememberTimelineRequestCounts(gate, agent.agentId);
await reopenWithTimelineTailUnanswered({ page, gate, agentId: agent.agentId });
await expectTimelinePromptVisible(page, agent.newestPrompt);
gate.releaseHeldTimelineResponses();
await expectCleanLoadingSurfaces(page, gate, requests);
});
} finally {
gate.restore();
await agent.cleanup();
}
});
});
@@ -20,7 +20,9 @@ import {
} from "../support/helpers/composer";
import { openCommandCenter, closeCommandCenter } from "../support/helpers/command-center";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import {
PROMPT_PLUGIN_ID,
expectPromptsDrawnByPlugin,
withPromptTimelinePlugin,
} from "../support/helpers/plugin-timeline";
@@ -279,6 +281,7 @@ test("finds text in a prompt a timeline plugin draws", async ({ page }, testInfo
await agent.client.waitForFinish(agent.agentId, 15_000);
await withPromptTimelinePlugin(async () => {
await openAgentRoute(page, agent);
await approveClientPluginsInUi(page, [PROMPT_PLUGIN_ID]);
await expectPromptsDrawnByPlugin(page);
await openChatFind(page);
await query(page).fill("scope-needle");
@@ -25,7 +25,9 @@ import {
expectReadingStreamedMarkdown,
} from "../support/helpers/chat-outline";
import { createCreationScenario } from "../support/helpers/creation";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import {
PROMPT_PLUGIN_ID,
attachPromptTimelineEvidence,
expectPromptsDrawnByPlugin,
expectVirtualizedPluginPromptVisible,
@@ -118,6 +120,7 @@ test.describe("desktop chat outline", () => {
await withPromptTimelinePlugin(async () => {
await page.setViewportSize(WIDE_VIEWPORT);
await openAgentTimeline(page, agent);
await approveClientPluginsInUi(page, [PROMPT_PLUGIN_ID]);
await expectChatOutlinePrompts(page, 80);
await expectPromptsDrawnByPlugin(page);
await expectTimelinePromptNotMounted(page, agent.prompts[39]);
@@ -148,6 +151,7 @@ test.describe("desktop chat outline", () => {
const history = await holdOlderHistoryPages(page, agent);
await page.setViewportSize(WIDE_VIEWPORT);
await openAgentTimeline(page, agent);
await approveClientPluginsInUi(page, [PROMPT_PLUGIN_ID]);
await expectChatOutlinePrompts(page, 80);
await scrollThroughOlderHistoryPages(page, 2, history);
await scrollTimelineToNewestLoadedEdge(page);
@@ -1,4 +1,5 @@
import { expect, test, type Page } from "../support/fixtures";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { withDirectoryPlugin } from "../support/helpers/plugin-timeline";
import {
attachImageFromMenu,
@@ -158,6 +159,7 @@ test.describe("Client slash commands", () => {
}`,
run: async () => {
await withOpenReadyMockAgent(page, { title: "Attached slash command" }, async () => {
await approveClientPluginsInUi(page, ["attachment-slash-e2e"]);
const input = composerLocator(page);
await input.fill("/pict");
await expect(
@@ -172,7 +172,7 @@ test("retrying failed agent initialization keeps the plugin metadata set on New
startup,
composerMetadata,
}) => {
await creation.openWorkspaceForm("local");
await creation.openWorkspaceForm("local", { approvePlugins: ["composer-metadata"] });
await composerMetadata.set({ "composer-metadata.tag": "kept" });
await creation.submitPrompt("Start the tagged task.", "Create");
await creation.expectAgentStillStarting();
@@ -1,6 +1,9 @@
import { seedMockAgentWorkspace, openAgentRoute } from "../support/helpers/mock-agent";
import { writeFile } from "node:fs/promises";
import path from "node:path";
import { installDaemonWebSocketGate } from "../support/helpers/daemon-websocket-gate";
import { openFileFromExplorer } from "../support/helpers/file-explorer";
import { waitForWorkspaceInReplicaCache } from "../support/helpers/replica-cache-storage";
import { openSettingsSection, clickSettingsBackToWorkspace } from "../support/helpers/settings";
import { expect, test } from "../support/fixtures";
import {
@@ -547,3 +550,64 @@ test("keeps the comment shortcut in the editor beside an Explorer agent", async
await workspace.cleanup();
}
});
async function restoreHostConnection(gate: Awaited<ReturnType<typeof installDaemonWebSocketGate>>) {
gate.holdNextServerMessage("status");
gate.restore();
await gate.waitForHeldServerMessage("status");
gate.releaseHeldServerMessage("status");
}
test("loads Files and file filter automatically once the host connects after launch or disconnect", async ({
page,
withWorkspace,
}) => {
const gate = await installDaemonWebSocketGate(page);
const workspace = await withWorkspace();
await writeFile(path.join(workspace.repoPath, "startup-repro.txt"), "hello\n", "utf8");
await test.step("open Files on the workspace before reloading", async () => {
await workspace.navigateTo();
const explorer = await ensureExplorerSidebar(page);
await openFilesPanel(page);
await expect(
explorer
.getByTestId("file-explorer-tree-scroll")
.getByText("startup-repro.txt", { exact: true }),
).toBeVisible();
await waitForWorkspaceInReplicaCache(page, workspace.workspaceId);
});
await test.step("reload while the host is unreachable and recover automatically on connect", async () => {
await gate.drop();
await page.reload();
await gate.waitForBlockedConnection();
const explorer = explorerSidebar(page);
await expect(explorer).toBeVisible();
await restoreHostConnection(gate);
await expect(
explorer
.getByTestId("file-explorer-tree-scroll")
.getByText("startup-repro.txt", { exact: true }),
).toBeVisible();
await expect(explorer.getByText("Host is not connected", { exact: true })).toHaveCount(0);
});
await test.step("filter Files while disconnected and recover automatically on reconnect", async () => {
const explorer = explorerSidebar(page);
await gate.drop();
await gate.waitForBlockedConnection();
await explorer.getByPlaceholder("Search files").fill("startup-repro");
await restoreHostConnection(gate);
await expect(
explorer.getByTestId("file-filter-results").getByText("startup-repro.txt", { exact: true }),
).toBeVisible();
await expect(explorer.getByText("Host is not connected", { exact: true })).toHaveCount(0);
});
});
@@ -199,6 +199,39 @@ test("shows listing failure details beside healthy sessions and retries the fail
}
});
test("keeps a request timeout visible while retrying the provider", async ({ page }) => {
const gate = await installDaemonWebSocketGate(page);
const flow = new ImportSessionFlow(page);
await flow.openWorkspace(scenario.project.workspaceId, { width: 1280, height: 844 });
await page.clock.install();
await test.step("the first listings time out before any response reaches the sheet", async () => {
gate.setServerMessageSuppressed("fetch_recent_provider_sessions_response", true);
await flow.openFromWorkspaceHeader();
await expect
.poll(() => gate.getClientRequestCount("fetch_recent_provider_sessions_request"))
.toBeGreaterThanOrEqual(2);
await page.clock.fastForward(101_000);
await flow.expectProviderError("Claude");
await flow.expectProviderRequestTimeout();
gate.setServerMessageSuppressed("fetch_recent_provider_sessions_response", false);
});
await test.step("Retry keeps the timeout visible until Claude replies", async () => {
gate.holdNextClientRequest("fetch_recent_provider_sessions_request");
await flow.startProviderRetry("claude");
await gate.waitForHeldClientRequest();
await flow.expectProviderRetryPending("claude");
await flow.expectProviderError("Claude");
await flow.expectProviderRequestTimeout();
gate.releaseHeldClientRequest();
await flow.expectProviderRecovered("Claude");
await flow.expectRows({ first: [scenario.importSessionId] });
await flow.expectProviderError("Broken ACP");
});
});
test("Import Session keeps listings tied to their host during a switch and a pending import", async ({
page,
}) => {
@@ -0,0 +1,83 @@
import { expect, test, type Page } from "../support/fixtures";
import { expectComposerDraft, fillComposerDraft } from "../support/helpers/composer";
import { gotoWorkspace } from "../support/helpers/launcher";
import { runWorkspaceActionFromCommandCenter } from "../support/helpers/command-center-workspace-actions";
import { waitForDraftComposer } from "../support/helpers/command-center-agent-controls";
import { seedWorkspace } from "../support/helpers/seed-client";
const openText = "Keep this open New Agent draft";
const orphanText = "Unreachable draft from an earlier version";
const existingAgentText = "Keep this archived conversation draft";
async function openDraftTab(page: Page): Promise<void> {
await runWorkspaceActionFromCommandCenter(page, "New agent");
await waitForDraftComposer(page);
}
async function persistedDraftTexts(page: Page): Promise<string[]> {
return page.evaluate(() => {
const drafts = JSON.parse(localStorage.getItem("paseo-drafts") ?? "{}").state?.drafts ?? {};
return Object.values(drafts).map(
(record) => (record as { input: { text: string } }).input.text,
);
});
}
async function seedOrphanBeforeUpgrade(page: Page): Promise<void> {
await page.evaluate(
({ orphan, archived }) => {
const makeDraft = (text: string) => ({
input: { text, attachments: [] },
lifecycle: "active",
updatedAt: Date.now(),
version: 1,
});
const envelope = JSON.parse(localStorage.getItem("paseo-drafts") ?? "{}");
envelope.state.drafts["draft:old-server:previously-closed-tab"] = makeDraft(orphan);
envelope.state.drafts["agent:old-server:archived-agent"] = makeDraft(archived);
localStorage.setItem("paseo-drafts", JSON.stringify(envelope));
localStorage.removeItem("paseo:orphaned-workspace-drafts-swept");
const nonce = localStorage.getItem("@paseo:e2e-seed-nonce");
if (nonce) localStorage.setItem("@paseo:e2e-disable-default-seed-once", nonce);
},
{ orphan: orphanText, archived: existingAgentText },
);
}
async function closeDraftWithShortcut(page: Page, answer: "cancel" | "discard"): Promise<void> {
const prompt = page.waitForEvent("dialog");
const shortcut = page.keyboard.press("Alt+Shift+w");
const dialog = await prompt;
expect(dialog.message()).toContain("Unsaved changes");
if (answer === "cancel") await dialog.dismiss();
else await dialog.accept();
await shortcut;
}
test("keeps open New Agent drafts through upgrade and confirms before discarding them", async ({
page,
}) => {
const workspace = await seedWorkspace({ repoPrefix: "discard-new-agent-draft-" });
try {
await gotoWorkspace(page, workspace.workspaceId);
await openDraftTab(page);
await fillComposerDraft(page, openText);
await expect.poll(() => persistedDraftTexts(page)).toContain(openText);
await seedOrphanBeforeUpgrade(page);
await page.reload();
await expectComposerDraft(page, openText);
await expect.poll(() => persistedDraftTexts(page)).not.toContain(orphanText);
await expect.poll(() => persistedDraftTexts(page)).toContain(existingAgentText);
await closeDraftWithShortcut(page, "cancel");
await expectComposerDraft(page, openText);
await closeDraftWithShortcut(page, "discard");
await expect.poll(() => persistedDraftTexts(page)).not.toContain(openText);
await openDraftTab(page);
await expectComposerDraft(page, "");
} finally {
await workspace.cleanup();
}
});
@@ -11,9 +11,11 @@ import {
installBrowserNotificationRecorder,
openNotificationSettings,
readRecordedBrowserNotifications,
reloadAndWaitForDevicePresence,
setNotificationSwitch,
setPluginNotificationSwitch,
} from "../support/helpers/notification-settings";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { copyPluginExample } from "../support/helpers/plugin-fixture";
import { seedWorkspace, type SeedDaemonClient } from "../support/helpers/seed-client";
@@ -107,7 +109,7 @@ test.describe("Settings → Notifications and OS notification filtering", () =>
await test.step("enabling Agent finished persists across page reload and allows finished notifications", async () => {
await setNotificationSwitch(page, "Agent finished", true);
await page.reload();
await reloadAndWaitForDevicePresence(page);
await expectNotificationSwitchState(page, "Agent finished", {
checked: true,
disabled: false,
@@ -137,7 +139,7 @@ test.describe("Settings → Notifications and OS notification filtering", () =>
).toBeVisible();
await expectNotificationSubControlsDisabled(page, true);
await page.reload();
await reloadAndWaitForDevicePresence(page);
await expectNotificationSwitchState(page, "Enable notifications", {
checked: false,
disabled: false,
@@ -172,6 +174,7 @@ test.describe("Settings → Notifications and OS notification filtering", () =>
await seeded.client.patchDaemonConfig({ pluginsEnabled: true });
await seeded.client.installDirectoryPlugin(pluginExample.directory);
installedPlugin = true;
await approveClientPluginsInUi(page, ["notifications-example"]);
const pluginToggle = page.getByRole("switch", { name: "Build alerts", exact: true });
await expect(pluginToggle).toBeVisible();
@@ -1,3 +1,5 @@
import { createHostClient } from "@getpaseo/client/node";
import { expect } from "@playwright/test";
import { gotoAppShell, openSettings } from "../support/helpers/app";
import {
addDirectHostFromSettings,
@@ -24,11 +26,51 @@ import {
slowConnectionToHost,
expectTailscaleUpdateRequired,
expectCompletePairingQr,
expectConnectedClientRow,
expectRelayConsent,
expandConnectedClientRow,
openDevicesPage,
openPairDeviceModal,
preparePairingHost,
returnFromRelayToWaysToConnect,
} from "../support/helpers/pair-device";
test("lists connected clients with scopes and navigates Pair a device → Relay → Back", async ({
page,
}) => {
const daemon = await startIsolatedHostDaemon("pair-device-connected-clients", {
mutableRelay: { enabled: true },
});
const viewer = createHostClient(`127.0.0.1:${daemon.port}`, {
clientId: "cid_e2e_phone_viewer",
clientType: "mobile",
appVersion: "0.18.1",
clientInfo: { name: "Test Phone", platform: "ios" },
sessionPermissions: ["daemon.read", "workspace.read"],
reconnect: { enabled: false },
});
try {
await openDevicesPage(page, daemon);
await expectConnectedClientRow(page, "This device", "Full access");
await expandConnectedClientRow(page, "This device");
await expect(
page
.getByTestId("devices-connected-clients-card")
.getByText("access.manage", { exact: true }),
).toBeVisible();
await viewer.connect();
await expectConnectedClientRow(page, "Test Phone", "Read-only");
await openPairDeviceModal(page);
await expectPairingOffer(page);
await returnFromRelayToWaysToConnect(page);
} finally {
await viewer.close();
await daemon.close();
}
});
test("opens relay consent in browser web", async ({ page }) => {
const daemon = await startIsolatedHostDaemon("pair-device-browser-relay-off", {
mutableRelay: { enabled: false },
@@ -81,7 +123,7 @@ test("turns Tailscale on and off from Devices, asking first over Tailscale", asy
}, testInfo) => {
test.skip(process.platform !== "linux", "Uses a second IPv4 loopback address");
// The journey opens Devices or the setup six times, two of them over a slowed connection.
test.setTimeout(120_000);
test.setTimeout(180_000);
if (!baseURL) throw new Error("Expected the app base URL");
const daemon = await startTailscaleTestDaemon(baseURL);
try {
@@ -2,6 +2,10 @@ import path from "node:path";
import { expect } from "../support/fixtures";
import {
test,
expectInstantPrefetchedRelatedOpen,
expectStableDesktopBackToListing,
expectStableUncachedListingOpen,
expectStackedFirstFrameOnNarrowDesktop,
expectStillBrowsing,
installFromPage,
installListingFromRow,
@@ -80,3 +84,89 @@ test("shows scorecard progressive disclosure, updates, custom links, and related
await page.screenshot({ path: path.join(captureDir, "live-app-mobile-scorecard.png") });
}
});
test("renders branded sponsor buttons for single and stacked platforms in light and dark themes", async ({
page,
directoryHost,
}) => {
const captureDir = process.env.PASEO_CAPTURE_DIR;
await page.setViewportSize({ width: 1280, height: 1000 });
await page.emulateMedia({ colorScheme: "dark" });
await openDirectory(page, directoryHost);
await openListingPage(page);
const singleGithub = page.getByTestId("funding-button-github");
await expect(singleGithub).toBeVisible();
await expect(singleGithub).toContainText("Sponsor on GitHub");
await expect(singleGithub).toHaveCSS("background-color", "rgba(219, 97, 162, 0.1)");
await expect(singleGithub).toHaveCSS("border-top-color", "rgba(219, 97, 162, 0.32)");
await expect(singleGithub.locator("svg")).toHaveAttribute("fill", "#ea7bb3");
if (captureDir) {
await page.waitForTimeout(300);
await page.screenshot({ path: path.join(captureDir, "app-gallery-single-dark.png") });
}
await page.emulateMedia({ colorScheme: "light" });
await expect(singleGithub).toBeVisible();
await expect(singleGithub).toHaveCSS("background-color", "rgba(191, 57, 137, 0.08)");
await expect(singleGithub).toHaveCSS("border-top-color", "rgba(191, 57, 137, 0.3)");
await expect(singleGithub.locator("svg")).toHaveAttribute("fill", "#bf3989");
if (captureDir) {
await page.waitForTimeout(300);
await page.screenshot({ path: path.join(captureDir, "app-gallery-single-light.png") });
}
await page.getByTestId("plugin-related-acme/pr-radar").click();
const platforms = [
["github", "Sponsor on GitHub"],
["kofi", "Support on Ko-fi"],
["buymeacoffee", "Buy Me a Coffee"],
["opencollective", "Sponsor on Open Collective"],
["patreon", "Support on Patreon"],
["polar", "Sponsor on Polar"],
["liberapay", "Donate on Liberapay"],
["paypal", "Donate via PayPal"],
["custom", "Sponsor"],
] as const;
for (const [platform, label] of platforms) {
const btn = page.getByTestId(`funding-button-${platform}`).filter({ visible: true });
await expect(btn).toBeVisible();
await expect(btn).toContainText(label);
}
const stackedKofi = page.getByTestId("funding-button-kofi").filter({ visible: true });
await expect(stackedKofi).toHaveCSS("background-color", "rgba(217, 67, 64, 0.08)");
await expect(stackedKofi.locator("svg")).toHaveAttribute("fill", "#d94340");
if (captureDir) {
await page.waitForTimeout(300);
await page.screenshot({ path: path.join(captureDir, "app-gallery-stacked-light.png") });
}
await page.emulateMedia({ colorScheme: "dark" });
for (const [platform] of platforms) {
await expect(
page.getByTestId(`funding-button-${platform}`).filter({ visible: true }),
).toBeVisible();
}
await expect(stackedKofi).toHaveCSS("background-color", "rgba(255, 94, 91, 0.1)");
await expect(stackedKofi.locator("svg")).toHaveAttribute("fill", "#ff7a78");
if (captureDir) {
await page.waitForTimeout(300);
await page.screenshot({ path: path.join(captureDir, "app-gallery-stacked-dark.png") });
}
});
test("opens plugin pages without empty markdown collapse, stacked back flash, or layout shift", async ({
page,
directoryHost,
}) => {
await page.setViewportSize({ width: 1280, height: 960 });
directoryHost.setDetailDelayMs(250);
await openDirectory(page, directoryHost);
await expectStableUncachedListingOpen(page);
await expectInstantPrefetchedRelatedOpen(page, directoryHost);
await expectStableDesktopBackToListing(page);
await expectStackedFirstFrameOnNarrowDesktop(page);
});
@@ -0,0 +1,279 @@
import path from "node:path";
import { expect, test } from "../support/fixtures";
import { gotoAppShell, openSettings } from "../support/helpers/app";
import { openHostSection } from "../support/helpers/settings";
import { getServerId } from "../support/helpers/server-id";
import { waitForSettledPosition } from "../support/helpers/sheet-layout";
import { openPluginPage, openPluginPageActions } from "../support/helpers/plugin-gallery";
import {
allowPluginExecution,
cancelPluginExecutionBypassConfirm,
confirmPluginExecutionBypass,
declinePluginExecution,
ensureArtifactsDir,
expectExecutedPluginMarkers,
expectExecutedPluginMarkersContain,
expectPluginApprovalPrompt,
expectPluginExecutionBypass,
getExecutedPluginMarkers,
openPluginExecutionBypassConfirm,
pluginApprovalSheet,
pluginExecutionBypassConfirmModal,
pluginExecutionBypassSwitch,
reloadKeepingPersistedState,
setPluginExecutionBypass,
withInstalledClientPlugins,
type ClientProbePluginSpec,
} from "../support/helpers/plugin-execution-approval";
const REPO_ROOT = path.resolve(__dirname, "../../../..");
const ALPHA: ClientProbePluginSpec = {
id: "alpha-probe",
name: "Alpha Probe",
sidebarTitle: "Alpha Probe",
markerKey: "alpha-probe",
};
const BETA: ClientProbePluginSpec = {
id: "beta-probe",
name: "Beta Probe",
sidebarTitle: "Beta Probe",
markerKey: "beta-probe",
};
const GAMMA: ClientProbePluginSpec = {
id: "gamma-probe",
name: "Gamma Probe",
sidebarTitle: "Gamma Probe",
markerKey: "gamma-probe",
};
test("prompts sequentially before evaluating stacked client plugins, holds layout steady, persists decisions, and lets settings allow or block them", async ({
page,
}) => {
test.setTimeout(120_000);
await page.setViewportSize({ width: 1440, height: 900 });
const artifacts = await ensureArtifactsDir(REPO_ROOT);
await withInstalledClientPlugins([ALPHA, BETA, GAMMA], async () => {
await gotoAppShell(page);
await test.step("no client plugin executes before user approval", async () => {
await expectPluginApprovalPrompt(page, { pluginId: ALPHA.id, progress: "1 of 3" });
expect(await getExecutedPluginMarkers(page)).toEqual([]);
await expect(page.getByText(ALPHA.sidebarTitle, { exact: true })).toHaveCount(0);
await expect(page.getByText(BETA.sidebarTitle, { exact: true })).toHaveCount(0);
await expect(page.getByText(GAMMA.sidebarTitle, { exact: true })).toHaveCount(0);
await page.screenshot({ path: path.join(artifacts, "02-after-prompt-1-of-3.png") });
});
await test.step("approving the first advances in place with steady button geometry", async () => {
const sheet = pluginApprovalSheet(page);
const allowButton = sheet.getByRole("button", { name: "Allow", exact: true });
const declineButton = sheet.getByRole("button", { name: "Don't allow", exact: true });
const beforeAllow = await allowButton.boundingBox();
const beforeDecline = await declineButton.boundingBox();
expect(beforeAllow).not.toBeNull();
expect(beforeDecline).not.toBeNull();
await allowPluginExecution(page);
await expectPluginApprovalPrompt(page, { pluginId: BETA.id, progress: "2 of 3" });
await expectExecutedPluginMarkers(page, [ALPHA.markerKey]);
await expect(page.getByText(ALPHA.sidebarTitle, { exact: true })).toBeVisible();
await expect(page.getByText(BETA.sidebarTitle, { exact: true })).toHaveCount(0);
const afterAllow = await allowButton.boundingBox();
const afterDecline = await declineButton.boundingBox();
expect(afterAllow).toEqual(beforeAllow);
expect(afterDecline).toEqual(beforeDecline);
await page.screenshot({ path: path.join(artifacts, "03-after-prompt-2-of-3.png") });
});
await test.step("declining the second and approving the third settles cleanly", async () => {
await declinePluginExecution(page);
await expectPluginApprovalPrompt(page, { pluginId: GAMMA.id, progress: "3 of 3" });
expect(await getExecutedPluginMarkers(page)).toEqual([ALPHA.markerKey]);
await allowPluginExecution(page);
await expect(pluginApprovalSheet(page)).toHaveCount(0);
await expectExecutedPluginMarkers(page, [ALPHA.markerKey, GAMMA.markerKey]);
await expect(page.getByText(ALPHA.sidebarTitle, { exact: true })).toBeVisible();
await expect(page.getByText(GAMMA.sidebarTitle, { exact: true })).toBeVisible();
await expect(page.getByText(BETA.sidebarTitle, { exact: true })).toHaveCount(0);
await page.screenshot({
path: path.join(artifacts, "04-after-settled-approved-and-declined.png"),
});
});
await test.step("reloading keeps approved plugins active and declined blocked without re-prompting", async () => {
await reloadKeepingPersistedState(page);
await expect(page.getByText(ALPHA.sidebarTitle, { exact: true })).toBeVisible({
timeout: 30_000,
});
await expect(page.getByText(GAMMA.sidebarTitle, { exact: true })).toBeVisible();
await expect(pluginApprovalSheet(page)).toHaveCount(0);
expect(await getExecutedPluginMarkers(page)).toEqual([ALPHA.markerKey, GAMMA.markerKey]);
await expect(page.getByText(BETA.sidebarTitle, { exact: true })).toHaveCount(0);
});
await test.step("settings surfaces the declined plugin and lets the user allow or block it", async () => {
await openSettings(page);
await openHostSection(page, getServerId(), "plugins");
await expect(page.getByTestId(`plugin-row-${BETA.id}`)).toContainText("blocked");
await openPluginPage(page, BETA.name, BETA.id);
await expect(page.getByTestId("plugin-client-blocked-alert")).toBeVisible();
await page.screenshot({ path: path.join(artifacts, "05-after-settings-blocked-plugin.png") });
await page.getByTestId("plugin-client-execution-allow").click();
await expect(page.getByTestId("plugin-client-blocked-alert")).toHaveCount(0);
await expectExecutedPluginMarkersContain(page, BETA.markerKey);
await openPluginPageActions(page, BETA.name);
await page.getByRole("menuitem", { name: "Block on this device", exact: true }).click();
await expect(page.getByTestId("plugin-client-blocked-alert")).toBeVisible();
});
});
});
test("presents the queued approval bottom sheet cleanly on compact viewports and closes cleanly on dismiss", async ({
page,
}) => {
test.setTimeout(120_000);
await page.setViewportSize({ width: 390, height: 844 });
const artifacts = await ensureArtifactsDir(REPO_ROOT);
await withInstalledClientPlugins([ALPHA, BETA], async () => {
await gotoAppShell(page);
await test.step("shows the first prompt in a compact bottom sheet", async () => {
await expectPluginApprovalPrompt(page, { pluginId: ALPHA.id, progress: "1 of 2" });
await waitForSettledPosition(pluginApprovalSheet(page));
expect(await getExecutedPluginMarkers(page)).toEqual([]);
await page.screenshot({ path: path.join(artifacts, "06-after-compact-sheet-1-of-2.png") });
});
await test.step("approves the first and dismisses the remaining queue cleanly", async () => {
await allowPluginExecution(page);
await expectPluginApprovalPrompt(page, { pluginId: BETA.id, progress: "2 of 2" });
await expectExecutedPluginMarkers(page, [ALPHA.markerKey]);
await page.getByRole("button", { name: "Close", exact: true }).click();
await expect(pluginApprovalSheet(page)).toHaveCount(0);
expect(await getExecutedPluginMarkers(page)).toEqual([ALPHA.markerKey]);
});
});
});
test("lets Settings -> General toggle bypass client plugin approval, persists across reload, and restores prompting when turned off", async ({
page,
}) => {
test.setTimeout(120_000);
await page.setViewportSize({ width: 1440, height: 900 });
const artifacts = await ensureArtifactsDir(REPO_ROOT);
await withInstalledClientPlugins([ALPHA, BETA], async ({ install }) => {
await gotoAppShell(page);
await test.step("approve one plugin and decline the other before opening Settings -> General", async () => {
await expectPluginApprovalPrompt(page, { pluginId: ALPHA.id, progress: "1 of 2" });
await allowPluginExecution(page);
await expectPluginApprovalPrompt(page, { pluginId: BETA.id, progress: "2 of 2" });
await declinePluginExecution(page);
await expect(pluginApprovalSheet(page)).toHaveCount(0);
await expectExecutedPluginMarkers(page, [ALPHA.markerKey]);
});
await test.step("General settings shows the minimal bypass toggle off by default", async () => {
await openSettings(page);
const row = page.getByTestId("settings-plugin-execution-bypass-row");
await expect(row).toBeVisible();
await expect(row).toContainText("Run plugins without asking");
await expect(row).not.toContainText("Unsafe");
await expect(row).toContainText(
"Any connected host can run plugin code inside Paseo and reach your other hosts",
);
await expectPluginExecutionBypass(page, false);
await page.screenshot({
path: path.join(artifacts, "settings-general-plugin-bypass-off-desktop.png"),
});
});
await test.step("turning bypass on requires confirmation and canceling keeps it off", async () => {
await openPluginExecutionBypassConfirm(page);
const modal = pluginExecutionBypassConfirmModal(page);
await expect(modal).toContainText("Run plugins without asking?");
await expect(modal).toContainText(
"Any connected host can run plugin code inside Paseo and reach your other connected hosts.",
);
await expectPluginExecutionBypass(page, false);
await expect(modal.getByRole("dialog")).toHaveCSS("opacity", "1");
await page.screenshot({
path: path.join(artifacts, "settings-general-plugin-bypass-confirm-desktop.png"),
});
await cancelPluginExecutionBypassConfirm(page);
expect(await getExecutedPluginMarkers(page)).toEqual([ALPHA.markerKey]);
});
await test.step("confirming turns bypass on and runs declined and newly installed plugins without prompting", async () => {
await openPluginExecutionBypassConfirm(page);
await confirmPluginExecutionBypass(page);
await expectExecutedPluginMarkersContain(page, BETA.markerKey);
await expect(pluginApprovalSheet(page)).toHaveCount(0);
await install(GAMMA);
await expectExecutedPluginMarkersContain(page, GAMMA.markerKey);
await expect(pluginApprovalSheet(page)).toHaveCount(0);
// Let the 180ms switch track animation settle before capturing the ON screenshot.
await page.waitForTimeout(300);
await page.screenshot({
path: path.join(artifacts, "settings-general-plugin-bypass-on-desktop.png"),
});
});
await test.step("reloading preserves bypass on and runs all plugins without prompting", async () => {
await reloadKeepingPersistedState(page);
await expectPluginExecutionBypass(page, true);
await expectExecutedPluginMarkersContain(page, ALPHA.markerKey);
await expectExecutedPluginMarkersContain(page, BETA.markerKey);
await expectExecutedPluginMarkersContain(page, GAMMA.markerKey);
await expect(pluginApprovalSheet(page)).toHaveCount(0);
});
await test.step("turning bypass off needs no confirmation, restores prompting for unreviewed plugins, and persists across reload", async () => {
await setPluginExecutionBypass(page, false);
await expectPluginApprovalPrompt(page, { pluginId: GAMMA.id });
await declinePluginExecution(page);
await expect(pluginApprovalSheet(page)).toHaveCount(0);
await reloadKeepingPersistedState(page);
await expectPluginExecutionBypass(page, false);
await expect(pluginApprovalSheet(page)).toHaveCount(0);
await expectExecutedPluginMarkers(page, [ALPHA.markerKey]);
});
await test.step("compact mobile viewport renders the General toggle and confirm sheet cleanly", async () => {
await page.setViewportSize({ width: 390, height: 844 });
const row = page.getByTestId("settings-plugin-execution-bypass-row");
const toggle = pluginExecutionBypassSwitch(page);
await expect(row).toBeVisible();
await expect(toggle).toBeVisible();
const rowBox = await row.boundingBox();
const toggleBox = await toggle.boundingBox();
expect(rowBox).not.toBeNull();
expect(toggleBox).not.toBeNull();
expect(toggleBox!.x + toggleBox!.width).toBeLessThanOrEqual(390);
await page.screenshot({
path: path.join(artifacts, "settings-general-plugin-bypass-compact.png"),
});
await openPluginExecutionBypassConfirm(page);
await waitForSettledPosition(pluginExecutionBypassConfirmModal(page));
await page.screenshot({
path: path.join(artifacts, "settings-general-plugin-bypass-confirm-compact.png"),
});
await cancelPluginExecutionBypassConfirm(page);
});
});
});
@@ -3,6 +3,7 @@ import { readFile, writeFile } from "node:fs/promises";
import path from "node:path";
import type { Frame, TestInfo } from "@playwright/test";
import { expect, test, type Page } from "../support/fixtures";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { copyPluginExample } from "../support/helpers/plugin-fixture";
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
import { seedWorkspace } from "../support/helpers/seed-client";
@@ -172,6 +173,7 @@ test("directory examples mount the PDF frame and write Markdown through the file
await page.setViewportSize(WIDE);
const gate = await installDaemonWebSocketGate(page);
await gotoWorkspace(page, workspace.workspaceId);
await approveClientPluginsInUi(page, ["pdf-panel", "markdown-panel"]);
await openFileExplorer(page);
await openFile(page, "report.pdf");
await expect(page.getByTitle("Document preview", { exact: true })).toHaveAttribute(
@@ -6,6 +6,7 @@ import { expectFileTabOpen, openFileExplorer } from "../support/helpers/file-exp
import {
BUILTIN_MARKDOWN_OPTION,
MARKDOWN_PANEL_ID,
MARKDOWN_PANEL_PLUGIN_ID,
PLUGIN_MARKDOWN_OPTION,
expectBuiltinMarkdown,
expectPluginMarkdown,
@@ -14,6 +15,7 @@ import {
openMarkdown,
storedFilePanelAssociations,
} from "../support/helpers/markdown-file-panel-plugin";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
async function choosePanel(page: Page, option: string, options: { remember: boolean }) {
await page.getByRole("radio", { name: option, exact: true }).click();
@@ -110,6 +112,7 @@ test("asks once which panel opens Markdown and remembers it when told to", async
try {
await page.setViewportSize({ width: 1280, height: 900 });
await gotoWorkspace(page, workspace.workspaceId);
await approveClientPluginsInUi(page, [MARKDOWN_PANEL_PLUGIN_ID]);
await openFileExplorer(page);
// First open: the built-in renders under the picker.
@@ -6,6 +6,7 @@ import { gotoWorkspace } from "../support/helpers/launcher";
import {
BUILTIN_MARKDOWN_OPTION,
MARKDOWN_PANEL_ID,
MARKDOWN_PANEL_PLUGIN_ID,
PLUGIN_MARKDOWN_OPTION,
expectPluginMarkdown,
filePanelPicker,
@@ -13,6 +14,7 @@ import {
openMarkdown,
storedFilePanelAssociations,
} from "../support/helpers/markdown-file-panel-plugin";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { seedWorkspace } from "../support/helpers/seed-client";
import { openSettingsSection } from "../support/helpers/settings";
@@ -59,6 +61,7 @@ test("Settings > Files chooses which panel opens .md and asks again on request",
try {
await page.setViewportSize({ width: 1280, height: 900 });
await gotoWorkspace(page, workspace.workspaceId);
await approveClientPluginsInUi(page, [MARKDOWN_PANEL_PLUGIN_ID]);
await openFilesSettings(page);
// Nothing remembered: the row asks every time and has nothing to forget.
@@ -3,6 +3,7 @@ import { tmpdir } from "node:os";
import path from "node:path";
import { expect, test, type Page } from "../support/fixtures";
import { installDaemonWebSocketGate } from "../support/helpers/daemon-websocket-gate";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { pluginRequirements } from "../support/helpers/plugin-fixture";
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
import { seedWorkspace } from "../support/helpers/seed-client";
@@ -131,6 +132,7 @@ test("directory plugins render PDF bytes and write Markdown through the file han
await page.setViewportSize({ width: 1280, height: 900 });
const gate = await installDaemonWebSocketGate(page);
await gotoWorkspace(page, workspace.workspaceId);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await openFileExplorer(page);
await openWorkspaceFile(page, "report.pdf");
await expect(page.getByText("PDF plugin: report.pdf", { exact: true })).toBeVisible();
@@ -9,6 +9,7 @@ import {
expectRemovedPlugin,
} from "../support/helpers/plugin-reconnect";
import { verifyPluginTranslations } from "../support/helpers/plugin-translations";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { pluginRequirements } from "../support/helpers/plugin-fixture";
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
@@ -98,6 +99,7 @@ export default function contribute(plugin) {
async function openHostUiPlugin(page: Page): Promise<void> {
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await page.getByRole("button", { name: "Host UI", exact: true }).click();
}
@@ -6,6 +6,7 @@ import { expect, test, type Page } from "../support/fixtures";
import { openCommandCenter } from "../support/helpers/command-center";
import { gotoAppShell } from "../support/helpers/app";
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { pluginRequirements } from "../support/helpers/plugin-fixture";
import { seedWorkspace } from "../support/helpers/seed-client";
import { getServerId } from "../support/helpers/server-id";
@@ -87,6 +88,7 @@ test.describe("plugin icons", () => {
await client.installDirectoryPlugin(directory);
await page.setViewportSize({ width: 1280, height: 800 });
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
const target = { serverId: getServerId(), workspaceId: workspace.workspaceId };
await waitForWorkspaceInSidebar(page, target);
await switchWorkspaceViaSidebar({ page, ...target });
@@ -1,5 +1,6 @@
import { existsSync } from "node:fs";
import overviewCorpus from "../../../protocol/tests/fixtures/plugin-overview.json";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { pluginRequirements } from "../support/helpers/plugin-fixture";
import { execFileSync } from "node:child_process";
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
@@ -500,6 +501,7 @@ async function installLocalPluginWithStatusExamples(
const catalog = observePluginCatalog(page);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["failed-preview-plugin"]);
await openPluginSettings(page);
await catalog.waitForInitialFetch();
await expectPluginFailed(page, "failed-preview-plugin");
@@ -514,6 +516,7 @@ async function installLocalPluginWithStatusExamples(
await openSourceInstall(page);
await expectPluginSourceDocsOpen(page);
await submitSourceInstall(page, directory);
await approveClientPluginsInUi(page, ["e2e-plugin"]);
await expectSourceInstalled(page, "e2e-plugin");
await expectPluginOn(page, "e2e-plugin");
await expectPluginHealthy(page, "e2e-plugin");
@@ -605,6 +608,7 @@ async function toggleRemoveAndReinstallLocalPlugin(page: Page, directory: string
await expectPluginRemoved(page, "e2e-plugin");
await installFromSource(page, directory, "e2e-plugin");
await approveClientPluginsInUi(page, ["e2e-plugin"]);
await expectPluginOn(page, "e2e-plugin");
await gotoAppShell(page);
await openContribution(page, "Plugin v3", "Plugin v3 cleanup 7");
@@ -659,6 +663,10 @@ async function retryGitInstallAndInspectRows(
await capturePluginInstallForm(page, testInfo, "compact-error");
await submitSourceInstall(page, pathToFileURL(repository).href);
await approveClientPluginsInUi(page, [
"compact-plugin-with-a-realistically-long-name",
"git-e2e-plugin",
]);
await expectSourceInstalled(page, "git-e2e-plugin");
await expectPluginsOn(page);
await expectPluginOn(page, "git-e2e-plugin");
@@ -724,6 +732,7 @@ async function prepareLegacyPluginHost(
pluginGitManagement: true,
});
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["legacy-source-plugin"]);
await openPluginSettings(page);
return directory;
@@ -906,6 +915,7 @@ test("keeps Reload pending past a minute while the plugin queue is busy", async
// Plugins on is a precondition here, not the subject: set it through the daemon.
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installPluginSource({ source: pluginDirectory });
await approveClientPluginsInUi(page, ["e2e-plugin"]);
// Installed before Plugins opens, so it opens on the Installed tab.
await openPluginSettings(page);
await expectPluginOn(page, "e2e-plugin");
@@ -928,6 +938,7 @@ test("keeps Reload pending past a minute while the plugin queue is busy", async
await capturePluginSurface(page, testInfo, "plugin-reload-past-deadline.png");
await queue.release();
await approveClientPluginsInUi(page, ["gated-build-plugin"]);
// The daemon's answer only arrives once the plugin really started again.
await reload.waitForResponse();
expect(reload.requestCount()).toBe(1);
@@ -1,3 +1,4 @@
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { copyPluginExample } from "../support/helpers/plugin-fixture";
import { expect, test as base, type Page } from "../support/fixtures";
import { gotoAppShell } from "../support/helpers/app";
@@ -119,6 +120,7 @@ const test = base.extend<{ modalExample: Page }>({
async function openWideExamples(page: Page) {
await page.setViewportSize({ width: 1100, height: 800 });
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["modal-ui-example"]);
await page.getByRole("button", { name: "Modal examples", exact: true }).click();
}
@@ -1,7 +1,8 @@
import { expect, test, type Page } from "../support/fixtures";
import { composerLocator, submitMessageWithButton } from "../support/helpers/composer";
import { seedMockAgentWorkspace, openAgentRoute } from "../support/helpers/mock-agent";
import { withPopoverTimelinePlugin } from "../support/helpers/plugin-timeline";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { POPOVER_PLUGIN_ID, withPopoverTimelinePlugin } from "../support/helpers/plugin-timeline";
async function openPreviewWhileTyping(page: Page): Promise<void> {
await composerLocator(page).focus();
@@ -25,6 +26,7 @@ test("Escape dismisses a plugin preview before interrupting the agent", async ({
try {
await withPopoverTimelinePlugin(async () => {
await openAgentRoute(page, agent);
await approveClientPluginsInUi(page, [POPOVER_PLUGIN_ID]);
await submitMessageWithButton(page, "Show the plugin preview.");
await agent.client.waitForFinish(agent.agentId, 30_000);
await expect(page.getByRole("button", { name: "Hover plugin preview" })).toBeVisible();
@@ -12,7 +12,7 @@ test("shows which runtime is incompatible and recovers after the requirement is
}) => {
await openRequirementHost(page, requirementHost);
await expectAppMismatch(page);
await correctRequirementAndReload(page, requirementHost.directory);
await correctRequirementAndReload(page, requirementHost.directory, { approvePrompt: true });
await rejectDaemonMismatch(page, requirementHost.directory);
await correctRequirementAndReload(page, requirementHost.directory);
});
@@ -9,6 +9,7 @@ import {
LEGACY_PLUGIN_ID,
SHOWCASE_PLUGIN_ID,
WIDE,
approveSidebarPluginsInUi,
closeScreen,
expectRowActive,
footerItem,
@@ -182,6 +183,7 @@ test.describe("Plugin sidebar items", () => {
}) => {
await page.setViewportSize({ width: 390, height: 600 });
await gotoAppShell(page);
await approveSidebarPluginsInUi(page);
await page.getByRole("button", { name: "Open menu", exact: true }).first().click();
await expect(botRow(page, "status")).toBeAttached();
const workspace = visibleTestId(page, `sidebar-workspace-row-${getServerId()}:${workspaceId}`);
@@ -213,6 +215,7 @@ test.describe("Plugin sidebar items", () => {
}) => {
await page.setViewportSize({ width: 1280, height: 480 });
await gotoAppShell(page);
await approveSidebarPluginsInUi(page);
await expect(botRow(page, "status")).toBeAttached();
const workspace = visibleTestId(page, `sidebar-workspace-row-${getServerId()}:${workspaceId}`);
await expect(workspace).toBeInViewport({ ratio: 1 });
@@ -240,6 +243,7 @@ test.describe("Plugin sidebar items", () => {
test("a restored plugin screen waits for its catalog before rendering", async ({ page }) => {
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
const row = headerRow(page, SHOWCASE_PLUGIN_ID, "deploys");
await expect(row).toBeVisible({ timeout: 30_000 });
await row.click();
@@ -278,6 +282,7 @@ test.describe("Plugin sidebar items", () => {
await seedSidebarFooterPreferences(page, [{ key: "usage", visible: true }]);
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
const row = headerRow(page, SHOWCASE_PLUGIN_ID, "deploys");
const sync = footerItem(page, SHOWCASE_PLUGIN_ID, "sync");
await expect(row).toBeVisible({ timeout: 30_000 });
@@ -365,6 +370,7 @@ test.describe("Plugin sidebar items", () => {
test("a plugin screen reads workspaces through the state hooks", async ({ page }) => {
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
await expect(headerRow(page, SHOWCASE_PLUGIN_ID, "deploys")).toBeVisible({ timeout: 30_000 });
await runCommand(page, "Open plugin workspaces");
await expect(screenTitle(page)).toHaveText("Workspaces");
@@ -375,6 +381,7 @@ test.describe("Plugin sidebar items", () => {
test("a plugin screen keeps the sidebar toggle before its title", async ({ page }) => {
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
await expect(headerRow(page, SHOWCASE_PLUGIN_ID, "deploys")).toBeVisible({ timeout: 30_000 });
await runCommand(page, "Open plugin workspaces");
await expect(screenTitle(page)).toHaveText("Workspaces");
@@ -394,6 +401,7 @@ test.describe("Plugin sidebar items", () => {
test("a header row's shortcut hint presses the row", async ({ page }) => {
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
const newWorkspace = visibleTestId(page, "sidebar-global-new-workspace");
await expect(newWorkspace).toBeVisible({ timeout: 30_000 });
await newWorkspace.hover();
@@ -419,6 +427,7 @@ test.describe("Plugin sidebar items", () => {
);
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
const entry = headerRow(page, LEGACY_PLUGIN_ID, "entry");
await expect(entry).toBeVisible({ timeout: 30_000 });
let entryIcon = "";
@@ -503,6 +512,7 @@ test.describe("Plugin sidebar items", () => {
test.setTimeout(180_000);
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
const bot1 = botRow(page, "bot-1");
const bot2 = botRow(page, "bot-2");
const status = botRow(page, "status");
@@ -587,6 +597,7 @@ test.describe("Plugin sidebar items", () => {
test.setTimeout(120_000);
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
await expect(botRow(page, "bot-1")).toBeVisible({ timeout: 30_000 });
const alerts = footerItem(page, BOTS_PLUGIN_ID, "alerts");
await expect(alerts).toHaveCount(0);
@@ -606,6 +617,7 @@ test.describe("Plugin sidebar items", () => {
const alerts = footerItem(page, BOTS_PLUGIN_ID, "alerts");
await page.setViewportSize(WIDE);
await gotoWorkspace(page, workspaceId);
await approveSidebarPluginsInUi(page);
await expect(botRow(page, "bot-1")).toBeVisible({ timeout: 30_000 });
await runCommand(page, "Add bot alerts");
@@ -4,6 +4,7 @@ import { expect, test, type Page } from "../support/fixtures";
import { gotoAppShell } from "../support/helpers/app";
import { openCommandCenter } from "../support/helpers/command-center";
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { copyPluginExample } from "../support/helpers/plugin-fixture";
import { seedWorkspace, type SeededWorkspace } from "../support/helpers/seed-client";
import { getServerId } from "../support/helpers/server-id";
@@ -34,6 +35,7 @@ async function withExample(
await client.installDirectoryPlugin(copy.directory);
await page.setViewportSize({ width: 1280, height: 800 });
await gotoAppShell(page);
await approveClientPluginsInUi(page, [example.id]);
const target = { serverId: getServerId(), workspaceId: workspace.workspaceId };
await waitForWorkspaceInSidebar(page, target);
await switchWorkspaceViaSidebar({ page, ...target });
@@ -1,3 +1,4 @@
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { pluginRequirements } from "../support/helpers/plugin-fixture";
import { mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
@@ -63,8 +64,11 @@ const MOCHA_MUTED_FOREGROUND = "rgb(166, 173, 200)";
const LATTE_MUTED_FOREGROUND = "rgb(108, 111, 133)";
const LATTE_RING = "rgb(156, 160, 176)";
async function selectTheme(page: Page, name: string) {
async function selectTheme(page: Page, name: string, approvePluginId?: string) {
await page.goto("/settings");
if (approvePluginId) {
await approveClientPluginsInUi(page, [approvePluginId]);
}
await openSettingsSection(page, "appearance");
const theme = page.getByRole("radio", { name, exact: true });
await expect(theme).toBeVisible({ timeout: 30_000 });
@@ -108,7 +112,7 @@ test("keeps plugin workspace timestamps readable on state surfaces and honors ov
try {
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installDirectoryPlugin(directory);
await selectTheme(page, "Solarized Dark");
await selectTheme(page, "Solarized Dark", PLUGIN_ID);
await openAgentRoute(page, selected);
const selectedRow = page.getByTestId(
`sidebar-workspace-row-${getServerId()}:${selected.workspaceId}`,
@@ -160,6 +164,7 @@ test("applies a contributed theme and falls back when its plugin is gone", async
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installDirectoryPlugin(directory);
await page.goto("/settings");
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await expect(page.getByTestId("settings-sidebar")).toBeVisible();
await openSettingsSection(page, "appearance");
@@ -263,6 +268,7 @@ test("reaches the last theme when a plugin contributes more themes than fit", as
await client.installDirectoryPlugin(directory);
await page.setViewportSize({ width: 1280, height: 720 });
await page.goto("/settings");
await approveClientPluginsInUi(page, [MANY_THEMES_PLUGIN_ID]);
await expect(page.getByTestId("settings-sidebar")).toBeVisible();
await openSettingsSection(page, "appearance");
@@ -8,6 +8,7 @@ import { submitMessageWithButton } from "../support/helpers/composer";
import { openFileExplorer, openFileFromExplorer } from "../support/helpers/file-explorer";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { copyPluginExample } from "../support/helpers/plugin-fixture";
import { runCommand } from "../support/helpers/plugin-sidebar-items";
import {
@@ -214,6 +215,7 @@ test("the workspace layout example arranges a wide workspace", async ({ page })
await withLayoutExample(undefined, async ({ agentId, workspaceId }) => {
await page.setViewportSize(WIDE);
await openAgentRoute(page, { workspaceId, agentId });
await approveClientPluginsInUi(page, ["workspace-layout"]);
await test.step("/aside opens the child agent's chat in the Explorer", async () => {
await sendToMainChat(page, "/aside hey");
@@ -264,6 +266,7 @@ test("the workspace layout example opens over a phone's chat", async ({ page })
await withLayoutExample(promptMentioning(FILE_LINK), async ({ agentId, workspaceId }) => {
await page.setViewportSize(COMPACT);
await openAgentRoute(page, { workspaceId, agentId });
await approveClientPluginsInUi(page, ["workspace-layout"]);
await test.step("/aside opens the Explorer over the chat", async () => {
await submitMessageWithButton(page, "/aside hey");
@@ -302,6 +305,7 @@ test("a file a plugin opens in another workspace waits there on a phone", async
await page.setViewportSize(COMPACT);
// Visiting the first workspace leaves its screen mounted behind the second.
await openAgentRoute(page, first);
await approveClientPluginsInUi(page, ["workspace-layout"]);
await expect(composerIn(page.locator("body"))).toBeEditable({ timeout: 30_000 });
await switchToWorkspace(page, second.workspaceId);
@@ -1,3 +1,4 @@
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { pluginRequirements } from "../support/helpers/plugin-fixture";
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
@@ -297,6 +298,7 @@ test.describe("plugin workspace panels and Command Center", () => {
await primaryClient.installDirectoryPlugin(directory);
await page.setViewportSize(WIDE_VIEWPORT);
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await addConnectedHostAndReload(page, {
serverId: secondaryDaemon.serverId,
label: "Secondary plugin host",
@@ -5,6 +5,7 @@ import type { Page } from "@playwright/test";
import { expect, test } from "../support/fixtures";
import { gotoAppShell } from "../support/helpers/app";
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { pluginRequirements } from "../support/helpers/plugin-fixture";
import { seedWorkspace } from "../support/helpers/seed-client";
import {
@@ -95,6 +96,7 @@ test("a plugin badge shows on workspace rows, hides quietly, and follows its Sho
await page.setViewportSize({ width: 1280, height: 900 });
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await test.step("the badge draws on the row; a null item and a throwing item draw nothing", async () => {
await expect(badge(page, "review")).toBeVisible();
@@ -15,6 +15,7 @@ import {
openSettingsHost,
openSettingsHostSection,
} from "../support/helpers/settings";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { copyPluginExample } from "../support/helpers/plugin-fixture";
const CUSTOM_PROVIDER = {
@@ -202,6 +203,7 @@ test.describe("provider removal", () => {
await client.installDirectoryPlugin(plugin.directory);
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_PROVIDER.pluginId]);
await openSettings(page);
await openSettingsHost(page, getServerId());
await openSettingsHostSection(page, getServerId(), "providers");
@@ -19,6 +19,7 @@ import {
} from "../support/helpers/composer";
import { connectDaemonClient } from "../support/helpers/daemon-client-loader";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { copyPluginExample } from "../support/helpers/plugin-fixture";
import { userScrollsTimelineToHistoryStart } from "../support/helpers/timeline-pagination";
@@ -266,6 +267,7 @@ test.describe.serial("Provider switching in chat", () => {
try {
await openAgentRoute(page, workspace);
await approveClientPluginsInUi(page, [DIRECT_PROVIDER.pluginId]);
await expectComposerVisible(page);
await expectComposerMode(page, "Load test");
@@ -461,6 +463,7 @@ test.describe.serial("Provider switching in chat", () => {
try {
await openAgentRoute(page, workspace);
await approveClientPluginsInUi(page, [DIRECT_PROVIDER.pluginId]);
await expectComposerVisible(page);
await submitMessage(page, runningPrompt);
@@ -513,6 +516,7 @@ test.describe.serial("Provider switching in chat", () => {
try {
await openAgentRoute(page, workspace);
await approveClientPluginsInUi(page, [DIRECT_PROVIDER.pluginId]);
await expectComposerVisible(page);
await submitMessage(page, "Run a one-minute mock turn first.");
await expectAgentReadyToInterrupt(page);
@@ -567,6 +571,7 @@ test.describe.serial("Provider switching in chat", () => {
try {
await openAgentRoute(page, workspace);
await approveClientPluginsInUi(page, [DIRECT_PROVIDER.pluginId]);
await expectComposerVisible(page);
await submitMessageWithButton(page, preSwitchPrompt);
@@ -13,7 +13,7 @@ import {
test("a refresh clears a failed update from the provider's page and its row", async ({
providerUpdateFailure: { page, otherClient },
}) => {
await openProviderInstallation(page);
await openProviderInstallation(page, { approvePlugin: true });
await test.step("Refresh on the page clears the failure", async () => {
await runFailingUpdate(page);
@@ -9,7 +9,11 @@ import {
expectCompactSidebarOpen,
} from "../support/helpers/usage-sidebar-item";
import { gotoAppShell } from "../support/helpers/app";
import { SHOWCASE_PLUGIN_ID, installSidebarPlugins } from "../support/helpers/plugin-sidebar-items";
import {
SHOWCASE_PLUGIN_ID,
approveSidebarPluginsInUi,
installSidebarPlugins,
} from "../support/helpers/plugin-sidebar-items";
import {
expectFooterIconRow,
expectFooterSeparator,
@@ -227,6 +231,7 @@ test.describe("Sidebar footer rows in Appearance settings", () => {
{ key: "import", visible: false },
]);
await gotoAppShell(page);
await approveSidebarPluginsInUi(page);
await test.step("the Footer card lists only the footer rows", async () => {
await openSidebarNavSettings(page);
@@ -11,6 +11,7 @@ import { getActiveTabTestId } from "../support/helpers/launcher";
import type { Page, Locator } from "@playwright/test";
import { test, expect } from "../support/fixtures";
import { expectComposerVisible } from "../support/helpers/composer";
import { approveClientPluginsInUi } from "../support/helpers/plugin-execution-approval";
import { withDirectoryPlugin } from "../support/helpers/plugin-timeline";
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
import { getE2EDaemonPort } from "../support/helpers/daemon-port";
@@ -188,6 +189,7 @@ export default function contribute(client) {
run: async () => {
await page.setViewportSize({ width: 1280, height: 1000 });
await openAgentRoute(page, agent);
await approveClientPluginsInUi(page, ["reply-fold-e2e"]);
await expectComposerVisible(page);
for (const width of [1280, 390]) {
await page.setViewportSize({ width, height: 1000 });
@@ -34,7 +34,9 @@ function report(input: {
sourceLabel: input.sourceLabel,
icon: ICON,
report:
input.report.status === "error" || input.report.status === "unavailable"
input.report.status === "error" ||
input.report.status === "unavailable" ||
input.report.status === "not_fetched"
? input.report
: {
status: "available",
@@ -138,6 +140,45 @@ test.describe("usage settings", () => {
await expect(card.getByText("64% used")).toBeVisible();
});
test("a manual report asks for Refresh and changes only on the user's Refresh", async ({
page,
}) => {
test.setTimeout(120_000);
const serverId = getServerId();
const manual = (entry: UsageReportEntry): UsageReportEntry => ({ ...entry, refresh: "manual" });
const usage = await installUsageReportsFixture(page, {
lists: [
(request) => [
manual(
report({
sourceId: "quota",
sourceLabel: "Quota",
report: request.forceRefresh
? { status: "available", windows: [{ id: "w", label: "Weekly", usedPct: 12 }] }
: { status: "not_fetched" },
}),
),
],
],
});
await gotoAppShell(page);
await openSettings(page);
await openSettingsHostSection(page, serverId, "usage");
const card = page.getByTestId("usage-report-quota:account");
await expect(
card.getByText("Not checked yet. Quota usage updates only when you refresh it."),
).toBeVisible({ timeout: 10_000 });
await expect(card.getByText("Error", { exact: true })).toHaveCount(0);
expect(forcedRefreshCount(usage)).toBe(0);
await card.getByTestId("usage-refresh").click();
await expect(card.getByText("12% used")).toBeVisible();
expect(usage.listRequests().filter((request) => request.forceRefresh)).toEqual([
{ forceRefresh: true, reportIds: ["quota:account"] },
]);
});
test("asks to update a host without usage support and never calls it", async ({ page }) => {
test.setTimeout(120_000);
const serverId = getServerId();
@@ -3,12 +3,17 @@ import type { Locator, Page } from "@playwright/test";
import { expect, test } from "../support/fixtures";
import { createIdleAgent } from "../support/helpers/archive-tab";
import { expectComposerVisible } from "../support/helpers/composer";
import { clickNewTerminal, terminalSurfaceLocator } from "../support/helpers/launcher";
import {
clickNewChat,
clickNewTerminal,
terminalSurfaceLocator,
} from "../support/helpers/launcher";
import { renameModalInput } from "../support/helpers/rename";
import { seedWorkspace } from "../support/helpers/seed-client";
import { getServerId } from "../support/helpers/server-id";
import { clickSettingsBackToWorkspace, openCompactSettings } from "../support/helpers/settings";
import { openSettings } from "../support/helpers/app";
import { gotoAppShell, openSettings } from "../support/helpers/app";
import { selectWorkspaceInSidebar } from "../support/helpers/sidebar";
import { runWorkspaceActionFromCommandCenter } from "../support/helpers/command-center-workspace-actions";
import {
clickFirstTerminalTab,
@@ -35,8 +40,12 @@ async function expectSameRenderedNode(
);
}
function isRenderedNodeConnected(node: Awaited<ReturnType<typeof captureRenderedNode>>) {
return node.evaluate((candidate) => candidate.isConnected);
}
async function expectNodeConnected(node: Awaited<ReturnType<typeof captureRenderedNode>>) {
expect(await node.evaluate((candidate) => candidate.isConnected)).toBe(true);
expect(await isRenderedNodeConnected(node)).toBe(true);
}
async function getSettingsShortcut(page: Page) {
@@ -50,6 +59,34 @@ async function waitForWorkspaceRoute(page: Page, route: string) {
}
test.describe("Workspace pane mounting", () => {
test("inactive composers expire while switching between other workspaces", async ({
page,
withWorkspace,
}) => {
const first = await withWorkspace({ prefix: "deck-expiry-first-" });
const second = await withWorkspace({ prefix: "deck-expiry-second-" });
const third = await withWorkspace({ prefix: "deck-expiry-third-" });
const oneMinute = 60_000;
await page.clock.install();
await gotoAppShell(page);
await selectWorkspaceInSidebar(page, first.workspaceId);
await clickNewChat(page);
const composer = await captureRenderedNode(
page.getByTestId("message-input-root").filter({ visible: true }),
);
await selectWorkspaceInSidebar(page, second.workspaceId);
await expect(page).toHaveURL(buildHostWorkspaceRoute(getServerId(), second.workspaceId));
await page.clock.fastForward(9 * oneMinute);
await expectNodeConnected(composer);
await selectWorkspaceInSidebar(page, third.workspaceId);
await expect(page).toHaveURL(buildHostWorkspaceRoute(getServerId(), third.workspaceId));
await page.clock.fastForward(2 * oneMinute);
await expect.poll(() => isRenderedNodeConnected(composer)).toBe(false);
});
test("workspace navigation keeps the existing agent composer mounted", async ({ page }) => {
test.setTimeout(90_000);
// Keep both split panes wide enough for the tab-rail interactions below.
@@ -13,6 +13,8 @@ function ad(...args) {
});
}
ad("press", 'label="Pair a device"', "--settle");
ad("wait", "text", "Relay", "10000");
ad("press", 'label="Relay"', "--settle");
ad("wait", "text", "Pairing QR code", "10000");
const { data } = JSON.parse(ad("snapshot", "-i", "--json"));
@@ -6,6 +6,7 @@ import appPackage from "../../../package.json";
import { expect, test as base, type Page } from "../fixtures";
import { gotoAppShell } from "./app";
import { addConnectedHostAndReload } from "./hosts";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { pluginRequirements } from "./plugin-fixture";
const pluginId = "builtin-settings";
@@ -69,6 +70,7 @@ export async function openBuiltinPluginSettings(
label: "Built-in settings host",
destination: `/settings/hosts/${host.serverId}/plugins/${pluginId}/${screenId}`,
});
await approveClientPluginsInUi(page, [pluginId]);
}
export async function expectBuiltinPluginSettings(page: Page) {
+8 -1
View File
@@ -2,6 +2,7 @@ import type { WorkspaceCreateRequest } from "@getpaseo/protocol/messages";
import { expect, type Page } from "@playwright/test";
import { daemonWsRoutePattern } from "./daemon-port";
import { gotoAppShell } from "./app";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { gotoWorkspace } from "./launcher";
import { fillComposerDraft } from "./composer";
import { createAgentTabFromMenu } from "./workspace-tabs";
@@ -146,8 +147,14 @@ export async function createCreationScenario(page: Page) {
const evictionWorkspaceIds = new Set<string>();
return {
cleanup: project.cleanup,
async openWorkspaceForm(isolation: "local" | "worktree") {
async openWorkspaceForm(
isolation: "local" | "worktree",
options?: { approvePlugins?: readonly string[] },
) {
await gotoAppShell(page);
if (options?.approvePlugins?.length) {
await approveClientPluginsInUi(page, options.approvePlugins);
}
await waitForSidebarHydration(page);
await openNewWorkspaceComposer(page, project);
await selectWorkspaceIsolation(page, isolation);
@@ -5,6 +5,7 @@ import { expect, type Page, type TestInfo } from "@playwright/test";
import { gotoWorkspace } from "./launcher";
import { buildAgentRoute } from "./mock-agent";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { pluginRequirements } from "./plugin-fixture";
import { seedWorkspace } from "./seed-client";
import { ensureExplorerSidebar } from "./workspace-tabs";
@@ -63,6 +64,7 @@ export async function withExplorerPanelPlugins(
await client.installDirectoryPlugin(second);
await page.setViewportSize({ width: 1280, height: 900 });
await gotoWorkspace(page, workspace.workspaceId);
await approveClientPluginsInUi(page, ["explorer-review", "explorer-other"]);
await run(workspace);
} finally {
@@ -132,11 +132,31 @@ export class ImportSessionFlow {
}
async retryProvider(provider: string, label: string) {
await this.expectProviderError(label);
await this.page.getByTestId(`import-session-retry-${provider}`).click();
await this.startProviderRetry(provider);
await expect(this.page.getByTestId(`import-session-retry-${provider}`)).toBeEnabled();
await this.expectProviderError(label);
await expect(this.page.getByRole("progressbar")).toHaveCount(0);
}
async startProviderRetry(provider: string) {
await this.page.getByTestId(`import-session-retry-${provider}`).click();
}
async expectProviderRetryPending(provider: string) {
await expect(this.page.getByTestId(`import-session-retry-${provider}`)).toBeDisabled();
}
async expectProviderRequestTimeout() {
await expect(
this.page
.getByText("No response to fetch_recent_provider_sessions_request after 100000ms", {
exact: true,
})
.first(),
).toBeVisible();
}
async expectProviderRecovered(label: string) {
await expect(
this.page.getByText(`Could not load ${label} sessions`, { exact: true }),
).toHaveCount(0);
}
async startImport(id: string) {
await this.revealSession(id);
await this.page.getByTestId(rowTestId(id)).click();
@@ -1,4 +1,4 @@
import { expect, type Page } from "@playwright/test";
import { expect, type Page, type WebSocket } from "@playwright/test";
import { openSettingsSection } from "./settings";
export interface RecordedBrowserNotification {
@@ -75,6 +75,32 @@ export async function installBrowserNotificationRecorder(page: Page): Promise<vo
});
}
/**
* Reloads the app and waits until it has told the daemon this device is present.
*
* The daemon shows an attention notification only on a client that has sent a
* heartbeat. Settings render from local storage before the reloaded app connects,
* so an agent that finishes right after the reload finds no present client and
* no notification is shown.
*/
export async function reloadAndWaitForDevicePresence(page: Page): Promise<void> {
let presenceReported = false;
const watchHeartbeats = (socket: WebSocket) => {
socket.on("framesent", (frame) => {
if (typeof frame.payload === "string" && frame.payload.includes('"client_heartbeat"')) {
presenceReported = true;
}
});
};
page.on("websocket", watchHeartbeats);
try {
await page.reload();
await expect.poll(() => presenceReported).toBe(true);
} finally {
page.off("websocket", watchHeartbeats);
}
}
export async function readRecordedBrowserNotifications(
page: Page,
): Promise<RecordedBrowserNotification[]> {
@@ -134,7 +134,7 @@ export async function addProjectFromSetup(page: Page, projectPath: string): Prom
export async function showSetupAgainFromSettings(page: Page): Promise<void> {
await page.locator('[data-testid="sidebar-settings"]:visible').first().click();
await page.getByRole("button", { name: "Show setup again", exact: true }).click();
await page.getByRole("button", { name: "Show", exact: true }).click();
}
export async function goToSetupStep(page: Page, label: string): Promise<void> {
@@ -66,6 +66,56 @@ type PairingHost =
| Pick<IsolatedHostDaemon, "serverId" | "port">
| Pick<OutdatedDaemon, "serverId" | "endpoint">;
export async function openDevicesPage(page: Page, daemon: PairingHost): Promise<void> {
await openAppOnPairingHost(page, daemon);
await openSettings(page);
await openSettingsHost(page, daemon.serverId);
await openSettingsHostSection(page, daemon.serverId, "devices");
await expect(page.getByTestId("devices-connected-clients-card")).toBeVisible();
}
export async function expectConnectedClientRow(
page: Page,
title: string,
scopeLabel: string,
): Promise<void> {
const card = page.getByTestId("devices-connected-clients-card");
const row = card.getByRole("button", { name: title, exact: true });
await expect(row).toBeVisible();
await expect(card.getByText(scopeLabel, { exact: true }).first()).toBeVisible();
}
export async function expandConnectedClientRow(page: Page, title: string): Promise<void> {
const card = page.getByTestId("devices-connected-clients-card");
await card.getByRole("button", { name: title, exact: true }).click();
await expect(card.getByText("Permissions", { exact: true })).toBeVisible();
}
export async function returnFromRelayToWaysToConnect(page: Page): Promise<void> {
await page
.getByTestId("devices-relay-pairing")
.getByRole("button", { name: "Back", exact: true })
.click();
await expect(page.getByTestId("devices-relay")).toBeVisible();
await expect(page.getByRole("switch", { name: "Tailscale", exact: true })).toBeVisible();
}
export async function openPairDeviceWaysSheet(page: Page): Promise<void> {
await expect(page.getByTestId("devices-pair-button")).toBeVisible();
await page.getByTestId("devices-pair-button").click();
await expect(page.getByTestId("devices-relay")).toBeVisible();
}
async function ensurePairDeviceWaysSheetOpen(page: Page): Promise<void> {
const relayRow = page.getByTestId("devices-relay");
const pairButton = page.getByTestId("devices-pair-button");
await relayRow.or(pairButton).first().waitFor({ state: "visible" });
if (!(await relayRow.isVisible())) {
await pairButton.click();
await expect(relayRow).toBeVisible();
}
}
export async function preparePairingHost(
page: Page,
daemon: PairingHost,
@@ -74,9 +124,9 @@ export async function preparePairingHost(
await openAppOnPairingHost(page, daemon, additionalHosts);
await openSettings(page);
await openSettingsHost(page, daemon.serverId);
await expect(page.getByTestId("devices-relay")).toHaveCount(0);
await expect(page.getByTestId("devices-pair-button")).toHaveCount(0);
await openSettingsHostSection(page, daemon.serverId, "devices");
await expect(page.getByTestId("devices-relay")).toBeVisible();
await openPairDeviceWaysSheet(page);
}
/** Loads the app afresh with `daemon` as its first host, then opens the setup's Mobile step. */
@@ -185,10 +235,12 @@ export async function cancelTailscaleTurnOff(page: Page, address: string): Promi
*/
export async function confirmTailscaleTurnOff(page: Page, address: string): Promise<void> {
const question = answerNextDialog(page, "accept");
await page.getByRole("switch", { name: "Tailscale", exact: true }).click();
const sheet = page.getByTestId("devices-pair-sheet");
const scope = (await sheet.isVisible()) ? sheet : page;
await scope.getByRole("switch", { name: "Tailscale", exact: true }).click();
expect(await question).toBe(TURN_OFF_QUESTION);
await expect(page.getByText("Host is not connected", { exact: true })).toBeVisible();
await expect(page.getByRole("switch", { name: "Tailscale", exact: true })).toHaveCount(0);
await expect(scope.getByText("Host is not connected", { exact: true })).toBeVisible();
await expect(scope.getByRole("switch", { name: "Tailscale", exact: true })).toHaveCount(0);
await expectHostUnreachableAt(address);
}
@@ -372,9 +424,12 @@ function deliverInOrderAfter(delay: () => number, deliver: (message: string | Bu
}
export async function expectTailscaleUpdateRequired(page: Page): Promise<void> {
await expect(page.getByRole("switch", { name: "Tailscale", exact: true })).toBeDisabled();
await expect(page.getByText("Update this host to use Tailscale", { exact: true })).toBeVisible();
await expect(page.getByRole("link", { name: "How to update", exact: true })).toBeVisible();
await ensurePairDeviceWaysSheetOpen(page);
const sheet = page.getByTestId("devices-pair-sheet");
const scope = (await sheet.isVisible()) ? sheet : page;
await expect(scope.getByRole("switch", { name: "Tailscale", exact: true })).toBeDisabled();
await expect(scope.getByText("Update this host to use Tailscale", { exact: true })).toBeVisible();
await expect(scope.getByRole("link", { name: "How to update", exact: true })).toBeVisible();
}
export async function expectTailscaleUnavailable(page: Page): Promise<void> {
@@ -460,6 +515,7 @@ export function observeDaemonStatusPolling(page: Page, port: number) {
}
export async function openPairDeviceModal(page: Page): Promise<void> {
await ensurePairDeviceWaysSheetOpen(page);
await page.getByRole("button", { name: "Relay", exact: true }).click();
await expect(page.getByTestId("devices-relay-pairing")).toBeVisible();
}
@@ -579,9 +635,14 @@ export async function expectPairingDisconnected(page: Page): Promise<void> {
}
export async function switchPairDeviceToHost(page: Page, serverId: string): Promise<void> {
const sheet = page.getByTestId("devices-pair-sheet");
if (await sheet.isVisible()) {
await sheet.getByRole("button", { name: "Close", exact: true }).click();
await expect(sheet).toHaveCount(0);
}
await selectSettingsHost(page, serverId);
await expectAppRoute(page, buildSettingsHostSectionRoute(serverId, "devices"));
await expect(page.getByTestId("devices-relay")).toBeVisible();
await openPairDeviceWaysSheet(page);
}
export async function openRelaySecurityDocs(page: Page): Promise<void> {
@@ -1,5 +1,6 @@
import type { Locator, TestInfo } from "@playwright/test";
import { test, expect, type Page } from "@playwright/test";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample } from "./plugin-fixture";
import { gotoAppShell } from "./app";
import { buildAgentRoute } from "./mock-agent";
@@ -73,6 +74,7 @@ export async function withButtonAuthorExample(
await client.installDirectoryPlugin(example.directory);
await page.setViewportSize(WIDE);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["button-examples"]);
await page.goto(buildAgentRoute(workspace.workspaceId, agent.id));
await run({
@@ -17,6 +17,7 @@ import {
} from "./compact-workspace-scripts";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { seedWorkspace } from "./seed-client";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { pluginRequirements } from "./plugin-fixture";
const PLUGIN_ID = "button-showcase";
@@ -354,6 +355,7 @@ export async function withButtonShowcase(
try {
await page.setViewportSize(WIDE);
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await page.goto(buildAgentRoute(workspace.workspaceId, agent.id));
await expect(page.getByRole("button", { name: "Run review", exact: true })).toBeVisible();
@@ -5,6 +5,7 @@ import { expect, test, type Page } from "@playwright/test";
import { gotoAppShell } from "./app";
import { openAgentRoute } from "./mock-agent";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample, pluginRequirements } from "./plugin-fixture";
import { seedWorkspace } from "./seed-client";
@@ -39,6 +40,7 @@ export async function withComposerControlsExample(
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installDirectoryPlugin(example.directory);
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await openAgentRoute(page, { workspaceId: workspace.workspaceId, agentId: agent.id });
await run({
narrowTheWindow: () =>
@@ -217,6 +219,7 @@ async function withToolbarPlugin(
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installDirectoryPlugin(directory);
await gotoAppShell(page);
await approveClientPluginsInUi(page, [ONE_TOGGLE_PLUGIN_ID]);
await openAgentRoute(page, { workspaceId: workspace.workspaceId, agentId: agent.id });
await expect(toolbar(page)).toBeVisible({ timeout: 30_000 });
await run({
@@ -13,6 +13,7 @@ import { gotoWorkspace } from "./launcher";
import { openCommandCenter } from "./command-center";
import { openAgentRoute, seedMockAgentWorkspace } from "./mock-agent";
import { connectNewWorkspaceDaemonClient, openGlobalNewWorkspaceComposer } from "./new-workspace";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample, pluginRequirements } from "./plugin-fixture";
import { seedWorkspace } from "./seed-client";
import {
@@ -86,6 +87,7 @@ export async function withComposerToolsExample(
await client.installDirectoryPlugin(example.directory);
await page.setViewportSize(WIDE);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["composer-controls-example"]);
await openAgentRoute(page, { workspaceId: workspace.workspaceId, agentId: agent.id });
await run({
openComposerToolsInExplorer: () =>
@@ -213,6 +215,7 @@ export async function withPluginWritingToAnotherWorkspace(
await client.installDirectoryPlugin(directory);
await page.setViewportSize(WIDE);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["composer-ref"]);
await run({
openTargetAgent: () =>
test.step("open the agent the plugin will write to", async () => {
@@ -356,6 +359,7 @@ export default function contribute(client) {
await client.installDirectoryPlugin(directory);
await page.setViewportSize(WIDE);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["composer-focus"]);
await run({
openOtherAgent: () =>
test.step("open another agent, so the target's tab is not showing", async () => {
@@ -479,6 +483,7 @@ export default function contribute(client) {
await client.installDirectoryPlugin(directory);
await page.setViewportSize(WIDE);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["held-composer"]);
await run({
openNewWorkspace: () =>
test.step("open the New workspace composer", async () => {
@@ -596,6 +601,7 @@ export async function withPluginFocusingASubagent(
try {
await page.setViewportSize(COMPACT);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["focus-agent"]);
await run({
keepParentInExplorerOnCompactScreen: () =>
test.step("move the parent into the Explorer, then narrow the window", async () => {
@@ -740,6 +746,7 @@ export async function withPluginFocusingAnAgentWithContextUsage(
try {
await page.setViewportSize(COMPACT);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["focus-agent"]);
await run({
openContextUsageOnPhone: () =>
test.step("open the agent's context usage on a phone", async () => {
@@ -8,6 +8,7 @@ import { expect, test as base, type Page } from "../fixtures";
import appPackage from "../../../package.json";
import { gotoAppShell, openSettings } from "./app";
import { addConnectedHostAndReload } from "./hosts";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { pluginRequirements } from "./plugin-fixture";
import {
expectToast,
@@ -31,7 +32,14 @@ export const LISTING = {
overview: "Directory example keeps a checklist beside your agents.",
};
export const test = base.extend<{ directoryHost: { serverId: string; port: number } }>({
export const test = base.extend<{
directoryHost: {
serverId: string;
port: number;
setDetailDelayMs: (ms: number) => void;
waitForDetailServed: (listingId: string) => Promise<void>;
};
}>({
directoryHost: async ({ e2eWorker }, provide) => {
void e2eWorker;
const root = await mkdtemp(path.join(tmpdir(), "paseo-plugin-directory-"));
@@ -42,7 +50,12 @@ export const test = base.extend<{ directoryHost: { serverId: string; port: numbe
pluginRegistryUrl: registry.url,
});
try {
await provide({ serverId: host.serverId, port: host.port });
await provide({
serverId: host.serverId,
port: host.port,
setDetailDelayMs: registry.setDetailDelayMs,
waitForDetailServed: registry.waitForDetailServed,
});
} finally {
await host.dispose();
}
@@ -161,26 +174,50 @@ function createRelatedFixtures(date: string) {
650,
],
] as const;
return specs.map(([id, name, description, installs]) => ({
id,
name,
description,
license: "MIT",
categories: ["tools"],
author: { github: "acme", name: "Acme" },
repository: { url: `https://github.com/${id}` },
artifact: { kind: "git", remote: `https://github.com/${id}.git`, commit: "a".repeat(40) },
scorecardSummary: {
health: { grade: "good" },
review: { status: "passed", score: 4, noteCount: 0 },
},
media: [],
submittedAt: date,
reviewedAt: date,
updatedAt: date,
publishedAt: date,
installs,
}));
return specs.map(([id, name, description, installs]) => {
const entry: Record<string, unknown> = {
id,
name,
description,
license: "MIT",
categories: ["tools"],
author:
id === "acme/pr-radar"
? {
github: "acme",
name: "Acme",
bio: "Building developer workflow plugins for Paseo.",
website: "https://acme.dev",
}
: { github: "acme", name: "Acme" },
repository: { url: `https://github.com/${id}` },
artifact: { kind: "git", remote: `https://github.com/${id}.git`, commit: "a".repeat(40) },
scorecardSummary: {
health: { grade: "good" },
review: { status: "passed", score: 4, noteCount: 0 },
},
media: [],
submittedAt: date,
reviewedAt: date,
updatedAt: date,
publishedAt: date,
installs,
};
if (id === "acme/pr-radar") {
entry.funding = [
{ platform: "github", url: "https://github.com/sponsors/acme" },
{ platform: "kofi", url: "https://ko-fi.com/acme" },
{ platform: "buymeacoffee", url: "https://buymeacoffee.com/acme" },
{ platform: "opencollective", url: "https://opencollective.com/acme" },
{ platform: "patreon", url: "https://patreon.com/acme" },
{ platform: "polar", url: "https://polar.sh/acme" },
{ platform: "liberapay", url: "https://liberapay.com/acme" },
{ platform: "paypal", url: "https://paypal.me/acme" },
{ url: "https://ifdian.net/a/acme" },
];
}
return entry;
});
}
async function startRegistry(listing: Record<string, unknown>) {
@@ -285,20 +322,52 @@ async function startRegistry(listing: Record<string, unknown>) {
readme: `# ${item.name}\n\n${item.description}`,
};
}
let detailDelayMs = 0;
const servedDetails = new Set<string>();
const detailWaiters = new Map<string, Array<() => void>>();
const markDetailServed = (requestUrl: string | undefined) => {
const match = requestUrl ? /^\/plugins\/(.+)\.json$/.exec(requestUrl) : null;
if (!match) return;
const id = match[1]!;
servedDetails.add(id);
const waiters = detailWaiters.get(id);
if (waiters) {
detailWaiters.delete(id);
for (const resolve of waiters) resolve();
}
};
const server = createServer((request, response) => {
const document = request.url ? documents[request.url] : undefined;
if (!document) {
response.writeHead(404).end();
return;
}
response.setHeader("Content-Type", "application/json");
response.end(JSON.stringify(document));
const respond = () => {
response.setHeader("Content-Type", "application/json");
response.end(JSON.stringify(document), () => markDetailServed(request.url));
};
if (detailDelayMs > 0 && request.url?.startsWith("/plugins/")) {
setTimeout(respond, detailDelayMs);
} else {
respond();
}
});
await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));
const address = server.address();
if (!address || typeof address === "string") throw new Error("Missing registry address");
return {
url: `http://127.0.0.1:${address.port}`,
setDetailDelayMs: (ms: number) => {
detailDelayMs = ms;
},
waitForDetailServed: (listingId: string) => {
if (servedDetails.has(listingId)) return Promise.resolve();
return new Promise<void>((resolve) => {
const list = detailWaiters.get(listingId) ?? [];
list.push(resolve);
detailWaiters.set(listingId, list);
});
},
close: () => new Promise<void>((resolve) => server.close(() => resolve())),
};
}
@@ -328,6 +397,7 @@ export async function installListingFromRow(page: Page) {
const sheet = page.getByTestId("plugin-install-sheet");
await expect(sheet).toContainText("Acme");
await sheet.getByTestId("plugin-install-confirm").click();
await approveClientPluginsInUi(page, ["directory-example"]);
await expect(listingRow(page).getByTestId(`plugin-uninstall-${LISTING.id}`)).toBeVisible({
timeout: 60_000,
});
@@ -362,6 +432,7 @@ export async function uninstallFromPage(page: Page) {
export async function installFromPage(page: Page) {
await page.getByTestId(`plugin-install-${LISTING.id}`).filter({ visible: true }).click();
await page.getByTestId("plugin-install-confirm").click();
await approveClientPluginsInUi(page, ["directory-example"]);
await expect(
page.getByRole("button", { name: `Actions for ${LISTING.name}`, exact: true }),
).toBeVisible({ timeout: 60_000 });
@@ -372,3 +443,237 @@ export async function openFromInstalledTab(page: Page) {
await selectInstalledTab(page);
await openPluginPage(page, LISTING.name, "directory-example");
}
interface PluginFrameSample {
url: string;
stacked: boolean;
hasSkeleton: boolean;
updatesLabel: string | null;
overviewHeight: number | null;
overviewTextLen: number;
licenseY: number | null;
relatedY: number | null;
}
async function sampleFramesDuring(
page: Page,
{
action,
waitUntilSettled,
}: { action: () => Promise<void>; waitUntilSettled: () => Promise<void> },
): Promise<PluginFrameSample[]> {
await page.evaluate(() => {
const samples: PluginFrameSample[] = [];
const host = window as unknown as {
__pluginFrameSamples?: PluginFrameSample[];
__stopPluginFrameSampling?: () => void;
};
host.__pluginFrameSamples = samples;
let running = true;
host.__stopPluginFrameSampling = () => {
running = false;
};
const isVisible = (el: Element): boolean => {
const rect = el.getBoundingClientRect();
return rect.width > 0 && rect.height > 0;
};
const queryVisible = (selector: string): Element | null => {
const nodes = Array.from(document.querySelectorAll(selector));
for (let i = nodes.length - 1; i >= 0; i -= 1) {
if (isVisible(nodes[i]!)) return nodes[i]!;
}
return null;
};
const findVisibleText = (text: string): Element | null => {
const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
let node: Node | null;
let match: Element | null = null;
while ((node = walker.nextNode())) {
if (
node.textContent?.trim() === text &&
node.parentElement &&
isVisible(node.parentElement)
) {
match = node.parentElement;
}
}
return match;
};
const findOverviewCard = (tabsEl: Element | null, stacked: boolean): Element | null => {
if (!tabsEl) return null;
const container = stacked
? (tabsEl.closest('[style*="overflow"]')?.parentElement ??
tabsEl.parentElement?.parentElement?.parentElement)
: tabsEl.parentElement?.parentElement;
if (!container) return null;
const visibleChildren = Array.from(container.children).filter(isVisible);
return visibleChildren[visibleChildren.length - 1] ?? null;
};
const roundRect = (el: Element | null) => el?.getBoundingClientRect() ?? null;
const record = () => {
const tabsEl = queryVisible('[data-testid="plugin-page-tabs"]');
const stacked = Boolean(queryVisible('[data-testid="plugin-page-tab-details"]'));
const updatesTabEl = queryVisible('[data-testid="plugin-page-tab-updates"]');
const skeletonEl = queryVisible('[data-testid="plugin-overview-skeleton"]');
const licenseRect = roundRect(findVisibleText("License"));
const relatedRect = roundRect(findVisibleText("Related plugins"));
const overviewCard = findOverviewCard(tabsEl, stacked);
const overviewRect = roundRect(overviewCard);
samples.push({
url: location.pathname,
stacked,
hasSkeleton: Boolean(skeletonEl),
updatesLabel: updatesTabEl?.textContent?.trim() ?? null,
overviewHeight: overviewRect ? Math.round(overviewRect.height) : null,
overviewTextLen: overviewCard?.textContent?.trim().length ?? 0,
licenseY: licenseRect ? Math.round(licenseRect.y) : null,
relatedY: relatedRect ? Math.round(relatedRect.y) : null,
});
if (running) requestAnimationFrame(record);
};
requestAnimationFrame(record);
});
await action();
await waitUntilSettled();
await page.evaluate(
() =>
new Promise<void>((resolve) =>
requestAnimationFrame(() => requestAnimationFrame(() => resolve())),
),
);
return page.evaluate(() => {
const host = window as unknown as {
__pluginFrameSamples?: PluginFrameSample[];
__stopPluginFrameSampling?: () => void;
};
host.__stopPluginFrameSampling?.();
return host.__pluginFrameSamples ?? [];
});
}
function assertOverviewNeverCollapsed(
frames: PluginFrameSample[],
{ minHeight }: { minHeight: number },
) {
const withOverview = frames.filter((frame) => frame.overviewHeight !== null);
expect(withOverview.length).toBeGreaterThan(0);
for (const frame of withOverview) {
expect(frame.hasSkeleton || frame.overviewTextLen > 0).toBe(true);
expect(frame.overviewHeight).toBeGreaterThanOrEqual(minHeight);
}
}
/** Opens the example listing without hovering first and verifies zero collapse or layout shift. */
export async function expectStableUncachedListingOpen(page: Page) {
const frames = await sampleFramesDuring(page, {
action: async () => {
await listingRow(page).getByText(LISTING.name, { exact: true }).click();
},
waitUntilSettled: async () => {
await expect(page.getByText(LISTING.overview, { exact: true })).toBeVisible();
},
});
const onPage = frames.filter((frame) => frame.url.endsWith(`/${LISTING.id}`));
expect(onPage.length).toBeGreaterThan(0);
for (const frame of onPage) {
expect(frame.stacked).toBe(false);
expect(frame.updatesLabel).not.toBe("Updates · 1");
}
assertOverviewNeverCollapsed(onPage, { minHeight: 200 });
const licensePositions = new Set(
onPage.map((frame) => frame.licenseY).filter((y): y is number => y !== null),
);
expect(licensePositions.size).toBe(1);
const relatedPositions = new Set(
onPage.map((frame) => frame.relatedY).filter((y): y is number => y !== null),
);
expect(relatedPositions.size).toBe(1);
}
/** Hovers a related plugin to prefetch it, clicks it, and asserts Markdown lands on frame 1. */
export async function expectInstantPrefetchedRelatedOpen(
page: Page,
{ waitForDetailServed }: { waitForDetailServed: (listingId: string) => Promise<void> },
) {
const relatedCard = page.getByTestId("plugin-related-acme/pr-radar").filter({ visible: true });
await relatedCard.hover();
await waitForDetailServed("acme/pr-radar");
// Allow the local daemon WebSocket response to reach the browser query cache.
await page.waitForTimeout(200);
const frames = await sampleFramesDuring(page, {
action: async () => {
await relatedCard.click();
},
waitUntilSettled: async () => {
await expect(pluginPageName(page)).toHaveText("PR Radar");
await expect(
page
.getByText("Monitors pull requests and CI checks across connected hosts.")
.filter({ visible: true })
.nth(1),
).toBeVisible();
},
});
const onPage = frames.filter((frame) => frame.url.endsWith("/acme/pr-radar"));
expect(onPage.length).toBeGreaterThan(0);
for (const frame of onPage) {
expect(frame.hasSkeleton).toBe(false);
expect(frame.overviewTextLen).toBeGreaterThan(0);
}
}
/** Goes back to the previous plugin page and asserts it stays two-column on every frame. */
export async function expectStableDesktopBackToListing(page: Page) {
const frames = await sampleFramesDuring(page, {
action: async () => {
await page.goBack();
},
waitUntilSettled: async () => {
await expect(pluginPageName(page)).toHaveText(LISTING.name);
},
});
const onPage = frames.filter((frame) => frame.url.endsWith(`/${LISTING.id}`));
expect(onPage.length).toBeGreaterThan(0);
for (const frame of onPage) {
expect(frame.stacked).toBe(false);
}
}
/** Opens a listing in a narrow desktop split (< 700px detail width) and asserts stacked frame 1. */
export async function expectStackedFirstFrameOnNarrowDesktop(page: Page) {
await page
.getByRole("button", { name: "Back to plugins", exact: true })
.filter({ visible: true })
.click();
await expect(listingRow(page)).toBeVisible();
await page.setViewportSize({ width: 920, height: 960 });
const frames = await sampleFramesDuring(page, {
action: async () => {
await page
.getByTestId("plugin-listing-acme/commit-diff")
.filter({ visible: true })
.getByText("Commit Diff", { exact: true })
.click();
},
waitUntilSettled: async () => {
await expect(pluginPageName(page)).toHaveText("Commit Diff");
await expect(
page
.getByText("Compact commit history and inline file tree diff viewer.")
.filter({ visible: true })
.nth(1),
).toBeVisible();
},
});
const onPage = frames.filter((frame) => frame.url.endsWith("/acme/commit-diff"));
expect(onPage.length).toBeGreaterThan(0);
for (const frame of onPage) {
expect(frame.stacked).toBe(true);
}
assertOverviewNeverCollapsed(onPage, { minHeight: 80 });
}
@@ -0,0 +1,284 @@
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { expect, type Locator, type Page } from "@playwright/test";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { pluginRequirements } from "./plugin-fixture";
export interface ClientProbePluginSpec {
id: string;
name: string;
sidebarTitle: string;
markerKey: string;
}
export async function createClientProbePlugin(spec: ClientProbePluginSpec): Promise<{
directory: string;
cleanup: () => Promise<void>;
}> {
const directory = await mkdtemp(path.join(tmpdir(), `paseo-plugin-approval-${spec.id}-`));
await writeFile(
path.join(directory, "paseo-plugin.json"),
JSON.stringify({
id: spec.id,
name: spec.name,
requirements: pluginRequirements,
}),
);
await writeFile(
path.join(directory, "index.server.ts"),
`export default function contribute() { return () => {}; }\n`,
);
await writeFile(
path.join(directory, "index.client.tsx"),
`import React from "react";
import { Text, View } from "react-native";
import { SidebarRow } from "@getpaseo/plugin/client/ui";
const executed = (globalThis.__paseoPluginExecutions = globalThis.__paseoPluginExecutions || []);
executed.push(${JSON.stringify(spec.markerKey)});
function ProbeScreen({ theme }) {
return (
<View style={{ flex: 1, padding: 24 }}>
<Text style={{ color: theme.colors.foreground }}>${spec.name} screen</Text>
</View>
);
}
function ProbeItem({ currentScreen, openScreen }) {
return (
<SidebarRow
icon="Puzzle"
active={currentScreen?.screenId === "main"}
onPress={() => openScreen({ screenId: "main" })}
/>
);
}
export default function contribute(client) {
client.addScreen({ id: "main", title: ${JSON.stringify(spec.sidebarTitle)}, Component: ProbeScreen });
client.addSidebarHeaderItem({
id: "main",
title: ${JSON.stringify(spec.sidebarTitle)},
Component: ProbeItem,
});
return () => {};
}
`,
);
return {
directory,
cleanup: () => rm(directory, { recursive: true, force: true }),
};
}
export interface InstalledClientPluginsContext {
install: (spec: ClientProbePluginSpec) => Promise<void>;
}
export async function withInstalledClientPlugins<T>(
specs: readonly ClientProbePluginSpec[],
run: (ctx: InstalledClientPluginsContext) => Promise<T>,
): Promise<T> {
const client = await connectNewWorkspaceDaemonClient({ ownProjects: false });
const previous = await client.getDaemonConfig();
const created: Array<{ id: string; cleanup: () => Promise<void> }> = [];
const install = async (spec: ClientProbePluginSpec) => {
const fixture = await createClientProbePlugin(spec);
created.push({ id: spec.id, cleanup: fixture.cleanup });
await client.installDirectoryPlugin(fixture.directory);
};
try {
await client.patchDaemonConfig({ pluginsEnabled: true });
for (const spec of specs) {
await install(spec);
}
return await run({ install });
} finally {
for (const item of created.toReversed()) {
await client.removePlugin(item.id).catch(() => undefined);
}
await client
.patchDaemonConfig({ pluginsEnabled: previous.config.pluginsEnabled ?? false })
.catch(() => undefined);
await client.close().catch(() => undefined);
for (const item of created) {
await item.cleanup().catch(() => undefined);
}
}
}
export function pluginExecutionBypassSwitch(page: Page): Locator {
return page.getByRole("switch", { name: "Run plugins without asking", exact: true });
}
export function pluginExecutionBypassConfirmModal(page: Page): Locator {
return page.getByTestId("plugin-execution-bypass-confirm-modal");
}
export async function expectPluginExecutionBypass(page: Page, enabled: boolean): Promise<void> {
const toggle = pluginExecutionBypassSwitch(page);
await expect(toggle).toBeVisible({ timeout: 30_000 });
await expect(toggle).toHaveAttribute("aria-checked", String(enabled));
}
export async function openPluginExecutionBypassConfirm(page: Page): Promise<void> {
const toggle = pluginExecutionBypassSwitch(page);
await expect(toggle).toHaveAttribute("aria-checked", "false");
await toggle.click();
await expect(pluginExecutionBypassConfirmModal(page)).toBeVisible();
}
export async function cancelPluginExecutionBypassConfirm(page: Page): Promise<void> {
const modal = pluginExecutionBypassConfirmModal(page);
await expect(modal).toBeVisible();
await page.getByRole("button", { name: "Cancel", exact: true }).click();
await expect(modal).toHaveCount(0);
await expectPluginExecutionBypass(page, false);
}
export async function confirmPluginExecutionBypass(page: Page): Promise<void> {
const modal = pluginExecutionBypassConfirmModal(page);
await expect(modal).toBeVisible();
await page.getByRole("button", { name: "Turn on", exact: true }).click();
await expect(modal).toHaveCount(0);
await expectPluginExecutionBypass(page, true);
}
export async function setPluginExecutionBypass(page: Page, enabled: boolean): Promise<void> {
if (enabled) {
await openPluginExecutionBypassConfirm(page);
await confirmPluginExecutionBypass(page);
return;
}
const toggle = pluginExecutionBypassSwitch(page);
await expect(toggle).toHaveAttribute("aria-checked", "true");
await toggle.click();
await expect(pluginExecutionBypassConfirmModal(page)).toHaveCount(0);
await expectPluginExecutionBypass(page, false);
}
export function pluginApprovalSheet(page: Page): Locator {
return page.getByTestId("plugin-execution-approval");
}
export async function expectPluginApprovalPrompt(
page: Page,
expected: { pluginId: string; progress?: string },
): Promise<void> {
await expect(pluginApprovalSheet(page)).toBeVisible({ timeout: 30_000 });
await expect(page.getByTestId("plugin-execution-approval-plugin")).toContainText(
expected.pluginId,
);
if (expected.progress) {
await expect(page.getByTestId("plugin-execution-approval-progress")).toHaveText(
expected.progress,
);
}
}
export async function allowPluginExecution(page: Page): Promise<void> {
await page.getByRole("button", { name: "Allow", exact: true }).click();
}
export async function declinePluginExecution(page: Page): Promise<void> {
await page.getByRole("button", { name: "Don't allow", exact: true }).click();
}
async function readPromptIdentity(
page: Page,
): Promise<{ pluginText: string; hostText: string; key: string } | null> {
const pluginLocator = page.getByTestId("plugin-execution-approval-plugin");
const hostLocator = page.getByTestId("plugin-execution-approval-host");
if (!(await pluginLocator.isVisible().catch(() => false))) return null;
if (!(await hostLocator.isVisible().catch(() => false))) return null;
const pluginText = (await pluginLocator.textContent().catch(() => ""))?.trim() ?? "";
const hostText = (await hostLocator.textContent().catch(() => ""))?.trim() ?? "";
if (!pluginText || !hostText) return null;
return { pluginText, hostText, key: `${pluginText}\0${hostText}` };
}
async function waitForNextApprovalTarget(
page: Page,
previousKey: string | null,
): Promise<{ pluginText: string; hostText: string; key: string }> {
let matched: { pluginText: string; hostText: string; key: string } | null = null;
await expect
.poll(
async () => {
const current = await readPromptIdentity(page);
if (!current || current.key === previousKey) return false;
matched = current;
return true;
},
{ timeout: 30_000, message: "Expected next plugin execution approval prompt" },
)
.toBe(true);
if (!matched) {
throw new Error("Expected next plugin execution approval prompt");
}
return matched;
}
/**
* Approves every expected client plugin through the real confirmation sheet UI.
* Handles stacked plugins and multi-host arrivals in any order, then waits for the sheet to close.
*/
export async function approveClientPluginsInUi(
page: Page,
pluginIds: readonly string[],
): Promise<void> {
const remaining = [...pluginIds];
let previousKey: string | null = null;
while (remaining.length > 0) {
await expect(pluginApprovalSheet(page)).toBeVisible({ timeout: 30_000 });
const target = await waitForNextApprovalTarget(page, previousKey);
const matchedIndex = remaining.findIndex((id) => target.pluginText.includes(id));
if (matchedIndex === -1) {
throw new Error(
`Unexpected plugin execution prompt "${target.pluginText}" on "${target.hostText}"; expected one of: ${remaining.join(", ")}`,
);
}
remaining.splice(matchedIndex, 1);
previousKey = target.key;
await allowPluginExecution(page);
}
await expect(pluginApprovalSheet(page)).toHaveCount(0);
}
export async function getExecutedPluginMarkers(page: Page): Promise<string[]> {
return page.evaluate(() => {
const raw = (globalThis as { __paseoPluginExecutions?: unknown }).__paseoPluginExecutions;
return Array.isArray(raw) ? raw.filter((item): item is string => typeof item === "string") : [];
});
}
export async function expectExecutedPluginMarkers(
page: Page,
expected: readonly string[],
): Promise<void> {
await expect.poll(() => getExecutedPluginMarkers(page)).toEqual(expected);
}
export async function expectExecutedPluginMarkersContain(
page: Page,
marker: string,
): Promise<void> {
await expect.poll(() => getExecutedPluginMarkers(page)).toContain(marker);
}
export async function reloadKeepingPersistedState(page: Page): Promise<void> {
await page.evaluate(() => {
const nonce = localStorage.getItem("@paseo:e2e-seed-nonce");
if (!nonce) throw new Error("Expected e2e seed nonce before reload");
localStorage.setItem("@paseo:e2e-disable-default-seed-once", nonce);
});
await page.reload();
}
export async function ensureArtifactsDir(repoRoot: string): Promise<string> {
const dir = path.join(repoRoot, ".artifacts");
await mkdir(dir, { recursive: true });
return dir;
}
@@ -6,6 +6,7 @@ import { gotoAppShell } from "./app";
import { addConnectedHostAndReload } from "./hosts";
import { startIsolatedHostDaemon } from "./isolated-host-daemon";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { pluginRequirements } from "./plugin-fixture";
const id = "host-clients";
@@ -98,6 +99,7 @@ export async function installHostClientsScenario(page: Page) {
await primary.patchDaemonConfig({ pluginsEnabled: true });
await primary.installDirectoryPlugin(directory);
await gotoAppShell(page);
await approveClientPluginsInUi(page, [id]);
await openHostClients(page);
await addConnectedHostAndReload(page, {
serverId: secondary.serverId,
@@ -12,6 +12,7 @@ import {
openProjectViaDaemon,
submitNewWorkspacePrompt,
} from "./new-workspace";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample } from "./plugin-fixture";
import { getServerId } from "./server-id";
import { createTempGitRepo } from "./workspace";
@@ -147,6 +148,7 @@ export async function withNewWorkspaceIssuesExample(
const other = otherRepo ? await openProjectViaDaemon(client, otherRepo.path) : null;
let target = project;
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await waitForSidebarHydration(page);
await openNewWorkspaceComposer(page, project);
// The sidebar rows used to reach the screen exist only at desktop width.
@@ -6,6 +6,7 @@ import { gotoAppShell, openSettings } from "./app";
import { openModelPicker } from "./agent-profiles";
import { openAgentRoute } from "./mock-agent";
import { connectNewWorkspaceDaemonClient, openGlobalNewWorkspaceComposer } from "./new-workspace";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample } from "./plugin-fixture";
import { seedWorkspace, type SeededWorkspace } from "./seed-client";
import { getServerId } from "./server-id";
@@ -76,6 +77,7 @@ export const test = base.extend<{ providerIcons: ProviderIconJourney }>({
try {
await page.setViewportSize(WIDE);
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["provider-direct-example"]);
const iconPaths = await readIconPaths(page, plugin.directory);
await provide({ page, testInfo, iconPaths, workspace });
} finally {
@@ -7,6 +7,7 @@ import { expect, type Page } from "../fixtures";
import { gotoAppShell } from "./app";
import { installDaemonWebSocketGate } from "./daemon-websocket-gate";
import { connectDaemonClient } from "./daemon-client-loader";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample, pluginRequirements } from "./plugin-fixture";
const PLUGIN_ID = "retained-plugin-e2e";
@@ -76,6 +77,7 @@ async function createProbe(page: Page) {
async open() {
await page.setViewportSize({ width: 1100, height: 800 });
await gotoAppShell(page);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await page.getByRole("button", { name: "Reconnect probe", exact: true }).click();
await expect(page.getByText("Stored title: Agent monitor", { exact: true })).toBeVisible();
},
@@ -8,6 +8,7 @@ import { connectDaemonClient } from "./daemon-client-loader";
import { addConnectedHostAndReload } from "./hosts";
import { gotoAppShell, openSettings } from "./app";
import { openHostSection, selectSettingsHost } from "./settings";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { pluginRequirements } from "./plugin-fixture";
import {
backToPlugins,
@@ -108,9 +109,16 @@ export async function expectAppMismatch(page: Page) {
).toBeVisible();
}
export async function correctRequirementAndReload(page: Page, directory: string) {
export async function correctRequirementAndReload(
page: Page,
directory: string,
options?: { approvePrompt?: boolean },
) {
await writeRequirements(directory, pluginRequirements.paseo);
await reloadRequirementsPlugin(page);
if (options?.approvePrompt) {
await approveClientPluginsInUi(page, [PLUGIN_ID]);
}
await backToPlugins(page, PLUGIN_ID);
await expectPluginHealthy(page, PLUGIN_ID);
await expect(page.getByText(/Your app is/)).toHaveCount(0);
@@ -1,6 +1,7 @@
import { mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample, pluginRequirements } from "./plugin-fixture";
import { expect, test as base, type Page } from "../fixtures";
import { gotoAppShell, openSettings } from "./app";
@@ -99,11 +100,13 @@ export const test = base.extend<{ settingsPlugin: SettingsClient }>({
export async function openDisplaySettings(page: Page) {
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["settings-example", TABBED_PLUGIN_ID]);
await openSettings(page);
await openSettingsExamplePage(page);
}
export async function openCompactDisplaySettings(page: Page) {
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["settings-example", TABBED_PLUGIN_ID]);
await openCompactSettings(page, new URL(page.url()).pathname);
await openSettingsExamplePage(page);
}
@@ -120,6 +123,7 @@ async function expectSettingsExampleScreen(page: Page) {
}
export async function openPluginsPage(page: Page) {
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["settings-example", TABBED_PLUGIN_ID]);
await openSettings(page);
await openHostSection(page, getServerId(), "plugins");
}
@@ -183,6 +187,7 @@ export async function expectSettingsTab(page: Page, title: "General" | "Advanced
}
export async function openTabbedSettingsLink(page: Page, title: "General" | "Advanced") {
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["settings-example", TABBED_PLUGIN_ID]);
await page.goto(`${pluginPageRoute(TABBED_PLUGIN_ID)}/${title.toLowerCase()}`);
await expectSettingsTab(page, title);
}
@@ -4,11 +4,16 @@ import path from "node:path";
import { expect, type Locator, type Page } from "@playwright/test";
import { openCommandCenter } from "./command-center";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { pluginRequirements } from "./plugin-fixture";
export const SHOWCASE_PLUGIN_ID = "sidebar-showcase";
export const LEGACY_PLUGIN_ID = "legacy-sidebar";
export const BOTS_PLUGIN_ID = "sidebar-bots";
export async function approveSidebarPluginsInUi(page: Page): Promise<void> {
await approveClientPluginsInUi(page, [SHOWCASE_PLUGIN_ID, LEGACY_PLUGIN_ID, BOTS_PLUGIN_ID]);
}
export const WIDE = { width: 1440, height: 900 };
export const COMPACT = { width: 390, height: 844 };
@@ -2,6 +2,7 @@ import { mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { expect, type Page, type TestInfo } from "@playwright/test";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample, pluginRequirements } from "./plugin-fixture";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { openAgentRoute, seedMockAgentWorkspace, type MockAgentWorkspace } from "./mock-agent";
@@ -110,7 +111,8 @@ export default function contribute(client) {
return () => {};
}`;
const PROMPT_PLUGIN_ID = "timeline-prompt-e2e";
export const PROMPT_PLUGIN_ID = "timeline-prompt-e2e";
export const POPOVER_PLUGIN_ID = "timeline-popover-e2e";
function promptClientSource(prompts?: readonly string[]): string {
return `import React from "react";
@@ -201,6 +203,7 @@ export async function withTimelinePlugin(
run: async () => {
try {
await openAgentRoute(page, agent);
await approveClientPluginsInUi(page, [PLUGIN_ID]);
await expect(
page.getByRole("textbox", { name: "Message agent..." }).first(),
).toBeVisible();
@@ -356,6 +359,7 @@ export async function viewInlineThinkingExample(page: Page, info: TestInfo): Pro
await client.patchDaemonConfig({ pluginsEnabled: true });
await client.installDirectoryPlugin(example.directory);
await openAgentRoute(page, agent);
await approveClientPluginsInUi(page, ["inline-thinking"]);
await expect(page.getByRole("textbox", { name: "Message agent..." }).first()).toBeVisible();
await requestPluginTimeline(agent);
const thought = page.getByText(/^Need to find the scroll container/);
@@ -423,6 +427,7 @@ export default function contribute(client) {
}`,
run: async () => {
await openAgentRoute(page, agent);
await approveClientPluginsInUi(page, ["timeline-local-ids"]);
await expect(page.getByRole("textbox", { name: "Message agent..." }).first()).toBeVisible();
await run();
},
@@ -6,6 +6,7 @@ import type { TestInfo, BrowserContext } from "@playwright/test";
import { expect, type Page } from "../fixtures";
import { gotoAppShell, openSettings } from "./app";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample } from "./plugin-fixture";
async function chooseChinese(page: Page) {
@@ -40,6 +41,7 @@ export async function verifyPluginTranslations(page: Page, info: TestInfo) {
await client.installDirectoryPlugin(example.directory);
await page.setViewportSize({ width: 1440, height: 1000 });
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["translation-notes"]);
await page.getByRole("button", { name: "Workspace notes", exact: true }).click();
await expect(page.getByText("App language: en", { exact: true })).toBeVisible();
await page
@@ -125,6 +127,7 @@ export async function verifyPluginToolTranslations(page: Page, info: TestInfo) {
await client.installDirectoryPlugin(example.directory);
await page.setViewportSize({ width: 1440, height: 1000 });
await gotoAppShell(page);
await approveClientPluginsInUi(page, ["translation-notes"]);
await page.goto(buildAgentRoute(workspace.workspaceId, agent.id));
const commandCenter = await openCommandCenter(page);
await commandCenter.getByTestId("command-center-input").fill("Show notes tools");
@@ -4,6 +4,7 @@ import type { DaemonClient as InternalDaemonClient } from "@getpaseo/client/inte
import { expect, test as base, type Page } from "../fixtures";
import { gotoAppShell, openSettings } from "./app";
import { connectDaemonClient } from "./daemon-client-loader";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample, pluginRequirements } from "./plugin-fixture";
import { getServerId } from "./server-id";
import { leaveProviderDetail, openSettingsHostSection } from "./settings";
@@ -84,8 +85,14 @@ export const test = base.extend<{ providerUpdateFailure: ProviderUpdateFailure }
},
});
export async function openProviderInstallation(page: Page): Promise<void> {
export async function openProviderInstallation(
page: Page,
options?: { approvePlugin?: boolean },
): Promise<void> {
await gotoAppShell(page);
if (options?.approvePlugin) {
await approveClientPluginsInUi(page, [PLUGIN_ID]);
}
await openSettings(page);
await openSettingsHostSection(page, getServerId(), "providers");
await page
@@ -1,6 +1,7 @@
import { readFile, writeFile } from "node:fs/promises";
import path from "node:path";
import { expect, type Page } from "@playwright/test";
import { approveClientPluginsInUi } from "./plugin-execution-approval";
import { copyPluginExample } from "./plugin-fixture";
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
import { seedWorkspace } from "./seed-client";
@@ -33,6 +34,7 @@ export async function withSidebarViews(
await client.installDirectoryPlugin(example.directory);
await page.setViewportSize({ width: 1280, height: 900 });
await gotoWorkspace(page, workspace.workspaceId);
await approveClientPluginsInUi(page, ["sidebar-views"]);
await run(sidebarViews(page, workspace.workspaceId, client));
} finally {
await client.removePlugin("sidebar-views");
@@ -175,6 +175,22 @@ export async function reopenWithFreshnessCheckUnanswered(
await expect(page.getByRole("alert").filter({ hasText: "Updating messages" })).toBeVisible();
}
/** Reopens display-only history with the tail held until the app shows the outstanding update. */
export async function reopenWithTimelineTailUnanswered({
page,
gate,
agentId,
}: {
page: Page;
gate: DaemonWebSocketGate;
agentId: string;
}): Promise<void> {
gate.holdTimelineResponses(agentId);
await page.reload();
await gate.waitForHeldTimelineResponse();
await expect(page.getByRole("alert").filter({ hasText: "Updating messages" })).toBeVisible();
}
export async function answerFreshnessCheck(page: Page, gate: DaemonWebSocketGate): Promise<void> {
gate.releaseHeldClientRequest();
await expect(page.getByRole("alert").filter({ hasText: "Updating messages" })).toHaveCount(0);
@@ -324,6 +340,121 @@ export async function stopStreamingReply(agent: StreamingReplyAgent): Promise<st
return reply;
}
interface LoadingSurfaceRecord {
loaderText: string[];
spinnerYsByTestId: Record<string, number[]>;
}
declare global {
interface Window {
__loadingSurfaceRecord?: LoadingSurfaceRecord;
}
}
function recordLoadingSurfaces(): void {
const record: LoadingSurfaceRecord = {
loaderText: [],
spinnerYsByTestId: {},
};
window.__loadingSurfaceRecord = record;
const isVisible = (el: Element | null): el is HTMLElement => {
if (!(el instanceof HTMLElement)) return false;
const style = window.getComputedStyle(el);
if (style.display === "none" || style.visibility === "hidden" || style.opacity === "0") {
return false;
}
const rect = el.getBoundingClientRect();
return rect.width > 0 && rect.height > 0;
};
const sample = () => {
if (!document.body) return;
for (const testId of [
"workspace-loading",
"agent-loading",
"agent-history-overlay",
"agent-initial-fill",
]) {
const el = document.querySelector(`[data-testid="${testId}"]`);
if (!isVisible(el)) continue;
const text = (el.textContent ?? "").trim();
if (text.length > 0 && !record.loaderText.includes(text)) {
record.loaderText.push(text);
}
const spinner = el.querySelector('[role="progressbar"]');
if (spinner) {
const y = Math.round(spinner.getBoundingClientRect().y);
const list = record.spinnerYsByTestId[testId] ?? [];
if (!list.includes(y)) list.push(y);
record.spinnerYsByTestId[testId] = list;
}
}
};
const start = () => {
const observer = new MutationObserver(sample);
observer.observe(document.documentElement ?? document, {
childList: true,
subtree: true,
attributes: true,
characterData: true,
});
sample();
};
if (document.documentElement) start();
else document.addEventListener("DOMContentLoaded", start, { once: true });
}
/** Records loading text, spinner Y positions, and any Updating messages toast from first paint. */
export async function watchColdAndReloadLoadingSurfaces(page: Page): Promise<void> {
await page.addInitScript(recordLoadingSurfaces);
await page.addInitScript(recordUpdatingToastTiming);
}
/** Checks loading geometry and verifies the toast waits for a slow daemon reply. */
export async function expectCleanLoadingSurfaces(
page: Page,
gate: DaemonWebSocketGate,
before: TimelineRequestCounts,
): Promise<void> {
await gate.waitForServerMessage(TIMELINE_RESPONSE, before.fetches + 1);
await expect(page.getByRole("alert").filter({ hasText: "Updating messages" })).toHaveCount(0);
await expectToastWaitedForTheDaemon(page);
const record = await page.evaluate(() => window.__loadingSurfaceRecord as LoadingSurfaceRecord);
expect(record.loaderText, "loading states must not render visible text").toEqual([]);
for (const [testId, ys] of Object.entries(record.spinnerYsByTestId)) {
expect(
ys.length,
`${testId} spinner shifted vertically (${ys.join(", ")})`,
).toBeLessThanOrEqual(1);
}
expect(
gate.getTimelineRequestCount("after", before.agentId) - before.after,
"initial tail load must not trigger a redundant after catch-up",
).toBe(0);
}
/** Waits until the persisted replica cache drops coverage to a display-only snapshot. */
export async function waitForDisplayOnlyTimelineCache(
page: Page,
agent: LongTimelineAgent,
): Promise<void> {
await expect
.poll(
async () => {
const cache = await readReplicaCache(page);
const timeline = cache?.hosts
?.flatMap((host) => host.timelines)
.find((entry) => entry.agentId === agent.agentId);
return timeline?.items ? { items: timeline.items.length, range: timeline.range } : null;
},
{ timeout: 15_000 },
)
.toMatchObject({ range: null });
}
export async function expectPromptAndWholeReply(
page: Page,
agent: StreamingReplyAgent,
+3
View File
@@ -14,5 +14,8 @@ import { renderRootComponent } from "expo-router/build/renderRootComponent";
import { startWatchdog } from "./src/watchdog";
import { RootApp } from "./src/root-app";
import { sweepOrphanedWorkspaceDrafts } from "./src/workspace-tabs/sweep-orphaned-drafts";
startWatchdog();
void sweepOrphanedWorkspaceDrafts();
renderRootComponent(RootApp);
+1 -1
View File
@@ -41,7 +41,7 @@
"dev:ios": "npm --prefix ../.. run build:client && cross-env APP_VARIANT=development expo run:ios",
"build:apk": "npm --prefix ../.. run build:apk",
"build:apk:arm64": "npm --prefix ../.. run build:apk:arm64",
"test:android": "expo prebuild --platform android --no-install && cd android && ./gradlew :paseo-native-trace:testReleaseUnitTest :paseo-hardware-keyboard:testReleaseUnitTest :react-native-enriched-markdown:testReleaseUnitTest --tests '*InlineCodeFormattingTest' --tests '*ListRenderingTest' --tests '*TaskListInteractionTest' --tests '*ListBlockquoteMeasurementTest' --tests '*BlockquoteCopyTest' --tests '*CodeBlockCopyButtonConstructionTest' --tests '*LongPressSelectionInterceptTest' --no-daemon --max-workers=2 -Dorg.gradle.parallel=false"
"test:android": "expo prebuild --platform android --no-install && cd android && ./gradlew :paseo-native-trace:testReleaseUnitTest :paseo-hardware-keyboard:testReleaseUnitTest :expo-modules-core:testReleaseUnitTest --tests expo.modules.kotlin.activityresult.AppContextActivityResultRegistryRecreationTest :react-native-enriched-markdown:testReleaseUnitTest --tests '*InlineCodeFormattingTest' --tests '*ListRenderingTest' --tests '*TaskListInteractionTest' --tests '*ListBlockquoteMeasurementTest' --tests '*BlockquoteCopyTest' --tests '*CodeBlockCopyButtonConstructionTest' --tests '*LongPressSelectionInterceptTest' --no-daemon --max-workers=2 -Dorg.gradle.parallel=false"
},
"dependencies": {
"@codemirror/commands": "6.10.4",
@@ -1,7 +1,7 @@
import { useMemo } from "react";
import { useFetchQuery } from "@/data/query";
import { useDebouncedValue } from "@/hooks/use-debounced-value";
import { useHostRuntimeClient } from "@/runtime/host-runtime";
import { useHostRuntimeClient, useHostRuntimeIsConnected } from "@/runtime/host-runtime";
import type { GithubRepositoryChoice } from "./model";
import { resolveSearch, type SearchResult } from "./search-result";
@@ -19,8 +19,9 @@ export function useDirectorySearch(input: {
}): SearchResult<string> {
const { hostId } = input;
const client = useHostRuntimeClient(hostId ?? "");
const isConnected = useHostRuntimeIsConnected(hostId ?? "");
const debouncedQuery = useDebouncedValue(input.query, SEARCH_DEBOUNCE_MS);
const enabled = Boolean(client && input.enabled);
const enabled = Boolean(client && isConnected && input.enabled);
const search = useFetchQuery({
queryKey: ["add-project-flow-directories", hostId, debouncedQuery],
queryFn: async () => {
@@ -64,8 +65,9 @@ export function useGithubRepositorySearch(input: {
}): SearchResult<GithubRepositoryChoice> {
const { hostId } = input;
const client = useHostRuntimeClient(hostId ?? "");
const isConnected = useHostRuntimeIsConnected(hostId ?? "");
const debouncedQuery = useDebouncedValue(input.query, SEARCH_DEBOUNCE_MS);
const enabled = Boolean(client && input.enabled);
const enabled = Boolean(client && isConnected && input.enabled);
const search = useFetchQuery({
queryKey: ["add-project-flow-github", hostId, debouncedQuery],
queryFn: async () => {
@@ -69,4 +69,27 @@ describe("host agent skills", () => {
expect(result.current.supported).toBe(false);
expect(client.getAgentSkillsStatus).not.toHaveBeenCalled();
});
it("waits until the host is connected before fetching and fetches once online", async () => {
runtime.connected = false;
const client = {
getAgentSkillsStatus: vi.fn(async () => ({
state: "not-installed",
ops: [],
available: ["paseo"],
installed: [],
selection: { mode: "all" },
})),
};
runtime.clients.set("reconnecting-host", client);
const { result, rerender } = renderHook(() => useAgentSkills("reconnecting-host"), { wrapper });
expect(client.getAgentSkillsStatus).not.toHaveBeenCalled();
runtime.connected = true;
rerender();
await waitFor(() => expect(result.current.status?.available).toEqual(["paseo"]));
expect(client.getAgentSkillsStatus).toHaveBeenCalledOnce();
});
});
@@ -36,7 +36,7 @@ export function useAgentSkills(serverId: string) {
if (!client) throw new Error(t("settings.host.skills.unavailable"));
return client.getAgentSkillsStatus();
},
enabled: supported && client !== null,
enabled: supported && client !== null && connected,
retry: false,
dataShape: "value",
staleTimeMs: 0,
@@ -2,8 +2,9 @@
* Pure state machine for the chat history's flick-to-dismiss gesture.
*
* Native keyboardDismissMode cannot express this interaction: "on-drag"
* dismisses on the first pixel, while "interactive" is iOS-only. We therefore classify the list's existing scroll gesture at
* release instead of introducing a competing pan recognizer.
* dismisses on the first pixel, and iOS "interactive" only follows a finger
* that reaches the keyboard. We therefore classify the list's existing scroll
* gesture at release instead of introducing a competing pan recognizer.
*/
const DISMISS_VELOCITY_POINTS_PER_MS = 1.5;
@@ -0,0 +1,8 @@
import type { ScrollViewProps } from "react-native";
/**
* iOS lets the keyboard follow a drag that reaches it, as in Messages. The
* keyboard controller reports each frame of that drag, so the composer stays on
* the keyboard edge.
*/
export const NATIVE_KEYBOARD_DISMISS_MODE: ScrollViewProps["keyboardDismissMode"] = "interactive";
@@ -0,0 +1,7 @@
import type { ScrollViewProps } from "react-native";
/**
* Android has no interactive keyboard dismissal. The flick classifier in
* `model.ts` is the only drag that closes the keyboard there.
*/
export const NATIVE_KEYBOARD_DISMISS_MODE: ScrollViewProps["keyboardDismissMode"] = "none";
@@ -13,13 +13,15 @@ import {
recordScroll,
releaseDrag,
} from "./model";
import { NATIVE_KEYBOARD_DISMISS_MODE } from "./native-dismiss-mode";
type ScrollEvent = NativeSyntheticEvent<NativeScrollEvent>;
/**
* Owns the chat history's flick-to-dismiss behavior. The native stream only
* forwards the LegendList scroll lifecycle; removing this hook and those three
* calls removes the feature completely.
* Owns how the chat history closes the keyboard: a flick toward older messages,
* a drag into the keyboard on iOS, and a tap on content that no control claims.
* The native stream spreads the two keyboard props and forwards the LegendList
* scroll lifecycle; removing this hook and those calls removes the feature.
*/
export function useScrollKeyboardDismiss() {
const { shift } = useKeyboardShift();
@@ -53,5 +55,13 @@ export function useScrollKeyboardDismiss() {
Keyboard.dismiss();
});
return { onScroll, onScrollBeginDrag, onScrollEndDrag };
return {
keyboardDismissMode: NATIVE_KEYBOARD_DISMISS_MODE,
// "handled" lets links, tool calls, and copy buttons act on the first tap
// while the keyboard is open. A tap that no child claims still closes it.
keyboardShouldPersistTaps: "handled" as const,
onScroll,
onScrollBeginDrag,
onScrollEndDrag,
};
}
@@ -26,7 +26,6 @@ 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";
@@ -123,15 +122,6 @@ function distanceFromEnd(input: {
return Math.max(0, input.contentHeight - input.viewportHeight - input.offsetY);
}
const viewportStyle: ViewStyle = { flex: 1 };
const initialFillStyle: ViewStyle = {
position: "absolute",
top: 0,
right: 0,
bottom: 0,
left: 0,
alignItems: "center",
justifyContent: "center",
};
function keyExtractor(item: { id: string }): string {
return item.id;
@@ -159,6 +149,7 @@ function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrat
isAuthoritativeHistoryReady,
isInitialHistoryLoading,
revealInitialHistory,
onInitialHistoryVisibilityChange,
onNearBottomChange,
onNearHistoryStart,
isLoadingOlderHistory,
@@ -265,6 +256,12 @@ function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrat
() => historyStartPagination.state.status === "settling",
);
const finishInitialFill = useStableEvent(() => historyStartPagination.reveal());
const reportInitialHistoryVisibility = useStableEvent((visible: boolean) => {
onInitialHistoryVisibilityChange?.(visible);
});
useLayoutEffect(() => {
reportInitialHistoryVisibility(historyStartPaginationState.visible);
}, [historyStartPaginationState.visible, reportInitialHistoryVisibility]);
const retryHistoryStart = useStableEvent(() => historyStartPagination.rearm());
const scheduleHistoryStartSettle = useStableEvent(() => {
let scheduler = historyStartSettleSchedulerRef.current;
@@ -795,6 +792,8 @@ function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrat
onMomentumScrollBegin={handleMomentumScrollBegin}
onMomentumScrollEnd={handleMomentumScrollEnd}
scrollEventThrottle={16}
keyboardDismissMode={scrollKeyboardDismiss.keyboardDismissMode}
keyboardShouldPersistTaps={scrollKeyboardDismiss.keyboardShouldPersistTaps}
onContentSizeChange={handleContentSizeChange}
onItemSizeChanged={handleItemSizeChanged}
onReady={handleListPlaced}
@@ -811,11 +810,6 @@ function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrat
{canExpandDrawDistance ? (
<InitialDrawDistanceExpansion schedule={drawDistanceExpansion.schedule} />
) : null}
{!historyStartPaginationState.visible ? (
<View pointerEvents="none" style={initialFillStyle}>
<LoadingState testID="agent-initial-fill" title={t("agentPanel.states.loadingHistory")} />
</View>
) : null}
</View>
);
}
+7 -14
View File
@@ -19,7 +19,6 @@ import { flushSync } from "react-dom";
import { withUnistyles } from "react-native-unistyles";
import { useRetainedPanelActive } from "@/components/retained-panel";
import { LoadingSpinner } from "@/components/ui/loading-spinner";
import { LoadingState } from "@/components/ui/loading-state";
import { useStableEvent } from "@/hooks/use-stable-event";
import { useTranslation } from "react-i18next";
import { getStreamItemMessageId, type StreamItem } from "@/types/stream";
@@ -77,14 +76,6 @@ const historyStartSlotStyle: CSSProperties = {
};
const streamRowsHostStyle: CSSProperties = { position: "relative", width: "100%" };
const initialFillStyle: CSSProperties = {
position: "absolute",
inset: 0,
display: "flex",
alignItems: "center",
justifyContent: "center",
pointerEvents: "none",
};
// Rows and the live auxiliary (turn footer, pending permissions) center their content with
// `alignSelf`, which only applies inside a flex container.
@@ -439,6 +430,7 @@ function WebStreamViewport(props: StreamRenderInput & { isMobileBreakpoint: bool
isAuthoritativeHistoryReady,
isInitialHistoryLoading,
revealInitialHistory,
onInitialHistoryVisibilityChange,
onNearBottomChange,
onReadingPositionChange,
onNearHistoryStart,
@@ -707,6 +699,12 @@ function WebStreamViewport(props: StreamRenderInput & { isMobileBreakpoint: bool
() => historyStartPagination.state.status === "settling",
);
const finishInitialFill = useStableEvent(() => historyStartPagination.reveal());
const reportInitialHistoryVisibility = useStableEvent((visible: boolean) => {
onInitialHistoryVisibilityChange?.(visible);
});
useLayoutEffect(() => {
reportInitialHistoryVisibility(historyStartPaginationState.visible);
}, [historyStartPaginationState.visible, reportInitialHistoryVisibility]);
const rearmHistoryStartFromUserIntent = useStableEvent(() => historyStartPagination.rearm());
const scheduleHistoryStartPrependSettle = useStableEvent(() => {
let scheduler = historyStartSettleSchedulerRef.current;
@@ -1750,11 +1748,6 @@ function WebStreamViewport(props: StreamRenderInput & { isMobileBreakpoint: bool
{shouldRenderEmpty ? listEmptyComponent : null}
</div>
</div>
{!historyStartPaginationState.visible ? (
<div style={initialFillStyle}>
<LoadingState testID="agent-initial-fill" title={t("agentPanel.states.loadingHistory")} />
</div>
) : null}
{scrollEnabled && !isMobileBreakpoint ? (
<DomOverlayScrollbar
scrollContainerRef={scrollContainerRef}
@@ -94,6 +94,8 @@ export interface StreamRenderInput {
isAuthoritativeHistoryReady: boolean;
isInitialHistoryLoading?: boolean;
revealInitialHistory?: boolean;
/** When supplied, the host pane owns the full-pane initial-fill loading overlay. */
onInitialHistoryVisibilityChange?: (visible: boolean) => void;
onNearBottomChange: (value: boolean) => void;
// The history row under the top of the viewport, for surfaces that mark where the reader
// is in the transcript. Only the web viewport measures it today.
+7
View File
@@ -258,6 +258,8 @@ export interface AgentStreamViewProps {
isAuthoritativeHistoryReady?: boolean;
isInitialHistoryLoading?: boolean;
revealInitialHistory?: boolean;
/** When supplied, the host pane owns the full-pane initial-fill loading overlay. */
onInitialHistoryVisibilityChange?: (visible: boolean) => void;
/** Tail space required by a transparent overlay rendered at the bottom edge. */
bottomOverlayTailClearance?: number;
/** Bottom offset required for controls floating above that overlay. */
@@ -357,6 +359,7 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
isAuthoritativeHistoryReady = true,
isInitialHistoryLoading,
revealInitialHistory,
onInitialHistoryVisibilityChange,
bottomOverlayTailClearance = 0,
bottomOverlayControlClearance,
toast,
@@ -1231,6 +1234,7 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
isAuthoritativeHistoryReady,
isInitialHistoryLoading,
revealInitialHistory,
onInitialHistoryVisibilityChange,
onNearBottomChange: nearBottom.set,
onReadingPositionChange: handleReadingPositionChange,
onNearHistoryStart: loadOlder,
@@ -1384,6 +1388,9 @@ function agentStreamViewPropsEqual(
if (left.revealInitialHistory !== right.revealInitialHistory) {
reasons.push("revealInitialHistory");
}
if (left.onInitialHistoryVisibilityChange !== right.onInitialHistoryVisibilityChange) {
reasons.push("onInitialHistoryVisibilityChange");
}
if (left.bottomOverlayTailClearance !== right.bottomOverlayTailClearance) {
reasons.push("bottomOverlayTailClearance");
}
+2
View File
@@ -65,6 +65,7 @@ import { WorkspaceShortcutTargetsSubscriber } from "@/components/workspace-short
import { FloatingPanelPortalHost } from "@/components/ui/floating-panel-portal";
import { HostChooserModal, useHostChooser } from "@/hosts/host-chooser";
import { HostConfirmationSheet } from "@/hosts/host-confirmation-sheet";
import { PluginExecutionApprovalSheet } from "@/plugins/execution-approval/sheet";
import { HEADER_INNER_HEIGHT, useIsCompactFormFactor } from "@/constants/layout";
import {
canDesktopAppSidebarShare,
@@ -568,6 +569,7 @@ function AppContainer({ children, chromeEnabled: chromeEnabledOverride }: AppCon
<AddProjectFlowHost />
<HostChooserModal />
<HostConfirmationSheet />
<PluginExecutionApprovalSheet />
<ProviderSettingsHost />
<WorkspaceSetupDialog />
<KeyboardShortcutsDialog />
@@ -147,6 +147,9 @@ function HostWorkspaceRouteContent() {
}
function WorkspaceDeck() {
// The compiler caches render-time Date.now() without this directive.
"use no memo";
const activeSelection = useActiveWorkspaceSelection();
const [retainedSelections, setRetainedSelections] = useState<RetainedWorkspaceSelection[]>(() =>
activeSelection ? [{ selection: activeSelection, inactiveSince: null }] : [],
@@ -0,0 +1,137 @@
import React, { act } from "react";
import { createRoot, type Root } from "react-dom/client";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import type { DaemonClient, FileReadResult } from "@getpaseo/client/internal/daemon-client";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { AssistantFileLinkResolverProvider } from "@/assistant-file-links";
import { ForgeShorthandProvider } from "@/git/forge-shorthand";
import { ChangelogBody } from "./changelog-sheet";
import type { ChangelogState } from "./changelog-source";
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
beforeEach(() => vi.stubGlobal("React", React));
let root: Root | null = null;
let container: HTMLDivElement | null = null;
afterEach(() => {
act(() => root?.unmount());
container?.remove();
root = null;
container = null;
});
function noop() {}
const CHANGELOG_FIXTURE_STATE: ChangelogState = {
status: "ready",
releases: [
{
version: "0.19.0",
date: "2026-12-01",
highlights:
"Highlights see #123, [Release](https://paseo.sh/changelog), [Local](/etc/passwd), ![HighlightLocal](/tmp/secret.png)",
sections: [
{
title: "Fixed",
body: "Section ![SectionLocal](./secret.png) ![SectionUnc](\\\\\\\\host\\\\share\\\\x.png) see #456",
},
],
},
{
version: "0.18.0",
date: "2026-11-20",
highlights: "",
sections: [
{
title: "Added",
body: "Only sections ![DirectSectionLocal](/etc/passwd) [Docs](https://paseo.sh/docs) see #789",
},
],
},
],
};
function createFakeFileReader() {
const reads: { cwd: string; path: string }[] = [];
const client = {
async readFile(cwd: string, path: string): Promise<FileReadResult> {
reads.push({ cwd, path });
return {
kind: "image",
path,
mime: "image/png",
size: 4,
modifiedAt: "2026-12-01T00:00:00.000Z",
bytes: new Uint8Array([1, 2, 3, 4]),
};
},
} as unknown as DaemonClient;
return { reads, client };
}
async function settleLayout() {
for (let frame = 0; frame < 2; frame++) {
await act(() => new Promise<void>((resolve) => requestAnimationFrame(() => resolve())));
}
}
describe("changelog Markdown safety", () => {
it("never calls client.readFile and does not link workspace forge shorthand in highlights or sections", async () => {
const { reads, client: fakeClient } = createFakeFileReader();
const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });
container = document.createElement("div");
document.body.appendChild(container);
root = createRoot(container);
act(() =>
root?.render(
<QueryClientProvider client={queryClient}>
<AssistantFileLinkResolverProvider
serverId="server-1"
workspaceRoot="/repo"
client={fakeClient}
>
<ForgeShorthandProvider
forge="github"
remoteUrl="https://github.com/acme/widgets.git"
forgeWeb={null}
>
<ChangelogBody
state={CHANGELOG_FIXTURE_STATE}
shownReleases={2}
onShowMore={noop}
onRetry={noop}
/>
</ForgeShorthandProvider>
</AssistantFileLinkResolverProvider>
</QueryClientProvider>,
),
);
await expect.poll(() => container?.textContent).toContain("HighlightLocal");
await expect.poll(() => container?.textContent).toContain("DirectSectionLocal");
await settleLayout();
expect(reads).toEqual([]);
const links = Array.from(container.querySelectorAll("a")).map((a) => ({
text: a.textContent,
href: a.getAttribute("href"),
}));
expect(links).toContainEqual(
expect.objectContaining({ text: "Release", href: "https://paseo.sh/changelog" }),
);
expect(links).toContainEqual(
expect.objectContaining({ text: "Docs", href: "https://paseo.sh/docs" }),
);
expect(links.some((l) => l.text === "#123" || l.text === "#789" || l.text === "Local")).toBe(
false,
);
const imgs = Array.from(container.querySelectorAll("img"));
expect(imgs.map((img) => img.getAttribute("alt"))).not.toContain("HighlightLocal");
expect(imgs.map((img) => img.getAttribute("alt"))).not.toContain("DirectSectionLocal");
});
});
@@ -86,7 +86,7 @@ interface ChangelogBodyProps {
onRetry: () => void;
}
function ChangelogBody({ state, shownReleases, onShowMore, onRetry }: ChangelogBodyProps) {
export function ChangelogBody({ state, shownReleases, onShowMore, onRetry }: ChangelogBodyProps) {
const { t } = useTranslation();
const appVersion = useMemo(() => resolveAppVersion()?.replace(/^v/i, "") ?? null, []);
@@ -168,7 +168,15 @@ const ReleaseView = memo(function ReleaseView({ release, isCurrent }: ReleaseVie
<View style={styles.headingSpacer} />
{date ? <Text style={styles.date}>{date}</Text> : null}
</View>
{hasHighlights ? <MarkdownRenderer text={release.highlights} compact /> : null}
{hasHighlights ? (
<MarkdownRenderer
text={release.highlights}
compact
destinations="https"
forgeShorthand={false}
softBreaks="join"
/>
) : null}
{hasHighlights && release.sections.length > 0 ? (
<Button
variant="ghost"
@@ -188,7 +196,15 @@ function ReleaseSections({ sections }: { sections: readonly ChangelogSection[] }
return keyChangelogSections(sections).map(({ key, section }) => (
<View key={key} style={styles.section}>
{section.title ? <Text style={styles.sectionTitle}>{section.title}</Text> : null}
{section.body ? <MarkdownRenderer text={section.body} compact /> : null}
{section.body ? (
<MarkdownRenderer
text={section.body}
compact
destinations="https"
forgeShorthand={false}
softBreaks="join"
/>
) : null}
</View>
));
}
@@ -66,6 +66,7 @@ import type {
ExplorerEntry,
} from "@/stores/session-store";
import { useSessionStore } from "@/stores/session-store";
import { useHostRuntimeClient, useHostRuntimeConnectionStatus } from "@/runtime/host-runtime";
import { FileActionsContextMenuContent } from "@/components/file-actions-menu";
import { ContextMenu, ContextMenuTrigger, useContextMenu } from "@/components/ui/context-menu";
import { useFileExplorerActions } from "@/hooks/use-file-explorer-actions";
@@ -570,13 +571,33 @@ export function FileExplorerPane({
const treeListRef = useRef<FlatList<ExplorerListRow>>(null);
const scrollbar = useOverlayFlatListScrollbar(treeListRef, { enabled: !isCompact });
const client = useHostRuntimeClient(serverId);
const connectionStatus = useHostRuntimeConnectionStatus(serverId);
const canFetch = Boolean(client && connectionStatus === "online");
const isHostConnecting = connectionStatus === "connecting" || connectionStatus === "idle";
const isHostUnavailable = connectionStatus === "offline" || connectionStatus === "error";
const hasInitializedRef = useRef(false);
const wasCanFetchRef = useRef(canFetch);
useEffect(() => {
hasInitializedRef.current = false;
wasCanFetchRef.current = false;
}, [workspaceStateKey]);
useEffect(() => {
const reconnected = !wasCanFetchRef.current && canFetch;
wasCanFetchRef.current = canFetch;
if (!canFetch) {
return;
}
if (
reconnected &&
workspaceStateKey &&
useSessionStore.getState().sessions[serverId]?.fileExplorer.get(workspaceStateKey)?.lastError
) {
hasInitializedRef.current = false;
}
void initializeExplorer({
hasWorkspaceScope,
hasInitializedRef,
@@ -587,9 +608,12 @@ export function FileExplorerPane({
setExpandedPathsForWorkspace,
});
}, [
canFetch,
client,
expandedPaths,
hasWorkspaceScope,
requestDirectoryListing,
serverId,
setExpandedPathsForWorkspace,
showHiddenFiles,
workspaceStateKey,
@@ -1007,12 +1031,16 @@ export function FileExplorerPane({
onLayout: scrollbar.onLayout,
});
const displayedError =
error ??
(!directories.has(".") && isHostUnavailable ? t("workspace.terminal.hostDisconnected") : null);
const showInitialLoading = resolveShowInitialLoading({
directories,
isExplorerLoading,
pendingRequest,
isHostConnecting,
});
const showBackFromError = Boolean(error && selectedEntryPath);
const showBackFromError = Boolean(displayedError && selectedEntryPath);
const errorRecoveryPath = useMemo(() => getErrorRecoveryPath(explorerState), [explorerState]);
const rowActions = useMemo<EntryRowActions>(
@@ -1184,7 +1212,7 @@ export function FileExplorerPane({
style={styles.container}
>
<FileExplorerPaneContent
error={error}
error={displayedError}
isCompact={isCompact}
serverId={serverId}
workspaceRoot={normalizedWorkspaceRoot}
@@ -1551,14 +1579,19 @@ function resolveShowInitialLoading({
directories,
isExplorerLoading,
pendingRequest,
isHostConnecting,
}: {
directories: Map<string, unknown>;
isExplorerLoading: boolean;
pendingRequest: AgentFileExplorerState["pendingRequest"] | null;
isHostConnecting: boolean;
}): boolean {
if (directories.has(".")) {
return false;
}
if (isHostConnecting) {
return true;
}
return Boolean(
isExplorerLoading && pendingRequest?.mode === "list" && pendingRequest?.path === ".",
);
@@ -17,6 +17,7 @@ import {
resolveProvidersToFetch,
requiresImportSessionsHostUpgrade,
type SessionsQueryResult,
type SessionsListing,
sumFilteredAlreadyImportedCount,
} from "@/components/import-session-sheet-view-model";
@@ -37,15 +38,13 @@ function entry(
}
function settled(
data: SessionsQueryResult["data"],
flags?: Partial<Omit<SessionsQueryResult, "data">>,
response: SessionsListing["response"],
requestError: string | null = null,
): SessionsQueryResult {
return {
data,
isError: false,
data: response || requestError !== null ? { response, requestError } : undefined,
isLoading: false,
isPending: false,
...flags,
};
}
@@ -181,7 +180,7 @@ describe("collectProviderErrorRows", () => {
it("returns a row for each provider whose request failed", () => {
const rows = collectProviderErrorRows(
["claude", "codex"],
[settled(undefined, { isError: true }), settled({ entries: [] })],
[settled(undefined, ""), settled({ entries: [] })],
new Map([["claude", "Claude Code"]]),
);
expect(rows).toEqual([
@@ -206,22 +205,15 @@ describe("collectProviderErrorRows", () => {
});
it("uses provider id when the label map has no entry", () => {
const rows = collectProviderErrorRows(
["codex"],
[settled(undefined, { isError: true })],
new Map(),
);
const rows = collectProviderErrorRows(["codex"], [settled(undefined, "")], new Map());
expect(rows).toEqual([{ provider: "codex", label: "codex", message: null, retrying: false }]);
});
it("shows the current request failure instead of an older provider error", () => {
const query = {
...settled(
{ entries: [], providerErrors: [{ provider: "codex", message: "old provider failure" }] },
{ isError: true },
),
error: new Error(" Connection closed. Reconnect the host and retry. "),
};
const query = settled(
{ entries: [], providerErrors: [{ provider: "codex", message: "old provider failure" }] },
" Connection closed. Reconnect the host and retry. ",
);
expect(collectProviderErrorRows(["codex"], [query], new Map())).toEqual([
{
provider: "codex",
@@ -278,7 +270,7 @@ describe("hasMoreSessions", () => {
it("keeps reporting more while the next page replaces placeholder rows", () => {
expect(
hasMoreSessions([settled({ entries: [entry()] }, { isPlaceholderData: true })], 45),
hasMoreSessions([{ ...settled({ entries: [entry()] }), isPlaceholderData: true }], 45),
).toBe(true);
});
});
@@ -30,16 +30,19 @@ export function requiresImportSessionsHostUpgrade(input: {
return !input.supportsSnapshot || (Boolean(input.workspaceId) && !input.supportsWorkspaceTarget);
}
interface SessionsResponse {
entries: FetchRecentProviderSessionEntry[];
filteredAlreadyImportedCount?: number;
providerErrors?: Array<{ provider: string; message: string }>;
}
export interface SessionsListing {
response: SessionsResponse | undefined;
requestError: string | null;
}
export interface SessionsQueryResult {
data:
| {
entries: FetchRecentProviderSessionEntry[];
filteredAlreadyImportedCount?: number;
providerErrors?: Array<{ provider: string; message: string }>;
}
| undefined;
isError: boolean;
error?: Error | null;
data: SessionsListing | undefined;
isFetching?: boolean;
isLoading: boolean;
isPending: boolean;
@@ -78,8 +81,8 @@ export function aggregateSessionEntries(
const seen = new Set<string>();
const collected: FetchRecentProviderSessionEntry[] = [];
for (const query of queries) {
if (!query.data) continue;
for (const entry of query.data.entries) {
if (!query.data?.response) continue;
for (const entry of query.data.response.entries) {
const key = `${entry.providerId}:${entry.providerHandleId}`;
if (seen.has(key)) continue;
seen.add(key);
@@ -97,7 +100,7 @@ export function sumFilteredAlreadyImportedCount(
): number {
let total = 0;
for (const query of queries) {
total += query.data?.filteredAlreadyImportedCount ?? 0;
total += query.data?.response?.filteredAlreadyImportedCount ?? 0;
}
return total;
}
@@ -114,7 +117,7 @@ export function hasMoreSessions(
): boolean {
if (nextPageLimit(limit) === limit) return false;
return queries.some((entryQuery) => {
const count = entryQuery.data?.entries.length ?? 0;
const count = entryQuery.data?.response?.entries.length ?? 0;
return entryQuery.isPlaceholderData ? count > 0 : count >= limit;
});
}
@@ -142,11 +145,12 @@ export function collectProviderErrorRows(
const query = queries[index];
const provider = providersToFetch[index];
if (!query || provider === undefined) continue;
const failed = query.isError || (query.data?.providerErrors?.length ?? 0) > 0;
if (!failed) continue;
const failure = query.data?.providerErrors?.find((error) => error.provider === provider);
const failureMessage = query.isError ? query.error?.message : failure?.message;
const message = failureMessage?.trim() || null;
const failure = query.data?.response?.providerErrors?.find(
(error) => error.provider === provider,
);
const failureMessage = query.data?.requestError ?? failure?.message;
if (failureMessage === undefined) continue;
const message = failureMessage.trim() || null;
rows.push({
provider,
label: providerLabelById.get(provider) ?? provider,
@@ -455,24 +455,43 @@ describe("ImportSessionSheet", () => {
expect(screen.queryByText("No recent sessions to import.")).toBeNull();
});
it("shows a fetch error state when recent provider sessions cannot be loaded", async () => {
const fetchRecentProviderSessions = vi.fn(async () => {
throw new Error("recent sessions unavailable");
});
const importAgent = vi.fn();
renderSheet(
{ fetchRecentProviderSessions, importAgent } as Pick<
DaemonClient,
"fetchRecentProviderSessions" | "importAgent"
>,
{
snapshot: { supportsSnapshot: true, entries: [createSnapshotEntry("claude")] },
it("keeps a request error visible while Retry is pending and clears it after success", async () => {
const retry =
Promise.withResolvers<Awaited<ReturnType<DaemonClient["fetchRecentProviderSessions"]>>>();
let firstRequest = true;
const client = createRecentSessionsClient(
async () => {
if (firstRequest) {
firstRequest = false;
throw new Error("recent sessions unavailable");
}
return retry.promise;
},
async () => {
throw new Error("Unexpected import");
},
);
await screen.findByText("Could not load Claude Code sessions");
screen.getByTestId("import-session-retry-claude");
renderSheet(client, {
snapshot: { supportsSnapshot: true, entries: [createSnapshotEntry("claude")] },
});
await screen.findByText("recent sessions unavailable");
fireEvent.click(screen.getByTestId("import-session-retry-claude"));
try {
await waitFor(() => {
expect(screen.getByText("recent sessions unavailable")).toBeTruthy();
expect(screen.getByRole("button", { name: "Retry" }).getAttribute("aria-disabled")).toBe(
"true",
);
});
} finally {
retry.resolve({ requestId: "retry", entries: [] });
}
await screen.findByText("No recent sessions to import.");
expect(screen.queryByText("recent sessions unavailable")).toBeNull();
});
it("loads recent provider sessions for the workspace and renders descriptor-owned labels", async () => {
@@ -1,6 +1,12 @@
import React, { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Pressable, type PressableStateCallbackType, Text, View } from "react-native";
import { useMutation, useQueries, useQueryClient, type QueryClient } from "@tanstack/react-query";
import {
queryOptions,
useMutation,
useQueries,
useQueryClient,
type QueryClient,
} from "@tanstack/react-query";
import { useTranslation } from "react-i18next";
import type {
DaemonClient,
@@ -42,6 +48,7 @@ import {
PER_PROVIDER_LIMIT,
previousPageLimit,
type ProviderErrorRow,
type SessionsListing,
resolveImportTarget,
resolveProvidersToFetch,
requiresImportSessionsHostUpgrade,
@@ -73,10 +80,6 @@ interface ImportSessionSheetProps {
onImported?: (agent: ImportedAgent) => void;
}
type RecentSessionsResponse = Awaited<
ReturnType<RecentProviderSessionsClient["fetchRecentProviderSessions"]>
>;
type SessionsQueryKey = ReadonlyArray<string | number | null>;
function buildSessionsQueryRoot(serverId: string | null, cwd: string | null) {
@@ -98,18 +101,6 @@ function buildSessionsQueryKey(input: {
];
}
interface SessionsQueryConfig {
queryKey: SessionsQueryKey;
enabled: boolean;
// A provider that cannot answer stays broken until the user asks again. React
// Query's default retry would keep the header spinner turning and pile up
// in-flight daemon requests behind a dead provider (#2512).
retry: false;
refetchOnMount: true;
placeholderData: () => RecentSessionsResponse | undefined;
queryFn: () => Promise<RecentSessionsResponse>;
}
function buildSessionsQueriesConfig(args: {
queryClient: QueryClient;
providersToFetch: AgentProvider[] | null;
@@ -120,39 +111,63 @@ function buildSessionsQueriesConfig(args: {
query: string;
limit: number;
hostDisconnectedMessage?: string;
}): SessionsQueryConfig[] {
}) {
const { queryClient, providersToFetch, visible, client, serverId, cwd, query, limit } = args;
const { hostDisconnectedMessage } = args;
if (providersToFetch === null) return [];
const enabled = visible && Boolean(client);
const previousLimit = previousPageLimit(limit);
return providersToFetch.map((provider) => ({
queryKey: buildSessionsQueryKey({ serverId, cwd, query, limit, provider }),
enabled,
retry: false as const,
// An import can invalidate an inactive host. Refresh its listing when observed again.
refetchOnMount: true as const,
// While Load more fetches the next page, keep showing the page it grew from. React Query's
// keepPreviousData cannot do this here: useQueries gives a changed key a new observer, which
// has no previous data, so the rows would vanish and the list would remount at the top.
placeholderData: () =>
previousLimit === null
? undefined
: queryClient.getQueryData<RecentSessionsResponse>(
buildSessionsQueryKey({ serverId, cwd, query, limit: previousLimit, provider }),
),
queryFn: async () => {
if (!client) {
throw new Error(hostDisconnectedMessage ?? i18n.t("workspace.terminal.hostDisconnected"));
}
return await client.fetchRecentProviderSessions({
...(cwd ? { cwd } : {}),
providers: [provider],
limit,
...(query ? { query } : {}),
});
},
}));
const defaultStaleTime = queryClient.getDefaultOptions().queries?.staleTime;
return providersToFetch.map((provider) => {
const queryKey = buildSessionsQueryKey({ serverId, cwd, query, limit, provider });
return queryOptions({
queryKey,
enabled,
// Let the user retry a failed listing without an automatic retry loop.
retry: false,
// An import can invalidate an inactive host. Refresh its listing when observed again.
refetchOnMount: true,
// While Load more fetches the next page, keep showing the page it grew from. React Query's
// keepPreviousData cannot do this here: useQueries gives a changed key a new observer, which
// has no previous data, so the rows would vanish and the list would remount at the top.
placeholderData: () => {
if (previousLimit === null) return undefined;
const previous = queryClient.getQueryData<SessionsListing>(
buildSessionsQueryKey({ serverId, cwd, query, limit: previousLimit, provider }),
);
return previous?.response ? { response: previous.response, requestError: null } : undefined;
},
// Refetch failed listings when the sheet reopens.
staleTime: (listingQuery) => {
if (listingQuery.state.data?.requestError != null) return 0;
if (typeof defaultStaleTime !== "function") return defaultStaleTime ?? 0;
const cachedQuery = queryClient.getQueryCache().get(listingQuery.queryHash);
return cachedQuery ? defaultStaleTime(cachedQuery) : 0;
},
queryFn: async (): Promise<SessionsListing> => {
try {
if (!client) {
throw new Error(
hostDisconnectedMessage ?? i18n.t("workspace.terminal.hostDisconnected"),
);
}
const response = await client.fetchRecentProviderSessions({
...(cwd ? { cwd } : {}),
providers: [provider],
limit,
...(query ? { query } : {}),
});
return { response, requestError: null };
} catch (error) {
// Cache the last outcome so a new fetch cannot clear the error row.
return {
response: queryClient.getQueryData<SessionsListing>(queryKey)?.response,
requestError: error instanceof Error ? error.message : String(error),
};
}
},
});
});
}
interface SheetStatusMessagesProps {
@@ -808,7 +823,8 @@ export function ImportSessionSheet({
(isQueryingProviders &&
queries.some((providerQuery) => providerQuery.isLoading || providerQuery.isPending));
const allQueriesErrored =
isQueryingProviders && queries.every((providerQuery) => providerQuery.isError);
isQueryingProviders &&
queries.every((providerQuery) => providerQuery.data?.requestError != null);
const allQueriesSettled =
isQueryingProviders &&
queries.every((providerQuery) => !providerQuery.isLoading && !providerQuery.isPending);
@@ -1,6 +1,6 @@
import { Animated } from "react-native";
import { describe, expect, test } from "vitest";
import { createIndicatorClock } from "./clock";
import { type ClockDriver, createIndicatorClock } from "./clock";
const PERIOD_MS = 900;
const STEPS = 27;
@@ -35,6 +35,44 @@ function frames(hz: number, count: number): number[] {
return Array.from({ length: count }, (_, frame) => (frame * 1000) / hz);
}
// A driver that advances nothing by itself, so the test decides when each span ends and when the
// native driver says where a stopped clock is.
function heldDriver() {
const spansFromMs: number[] = [];
const reports: ((heldMs: number) => void)[] = [];
let onEnd: ((result: { finished: boolean }) => void) | null = null;
function end(finished: boolean) {
const ended = onEnd;
onEnd = null;
ended?.({ finished });
}
return {
drive(_elapsedMs: Animated.Value, fromMs: number): ClockDriver {
spansFromMs.push(fromMs);
return {
start(ended) {
onEnd = ended;
},
stop(onHeld) {
reports.push(onHeld);
end(false);
},
};
},
/** What the native driver reports when it has counted a whole span. */
finish: () => end(true),
/** The native driver's answer to the oldest stop it has not answered. */
reportHeld: (heldMs: number) => reports.shift()?.(heldMs),
running: () => onEnd !== null,
spansFromMs,
};
}
// The clock stops after the commit that took its last indicator away.
async function commit(): Promise<void> {
await Promise.resolve();
}
describe("indicator clock", () => {
test("a cycle without steps advances with every frame", () => {
expect(positionsAt([0, 16, 450, 899, 900, 916])).toEqual([0, 16, 450, 899, 0, 16]);
@@ -87,7 +125,7 @@ describe("indicator clock", () => {
const shimmerPeriodMs = shimmerSteps * STEP_MS;
let nowMs = 0;
const elapsedMs = new Animated.Value(0);
const clock = createIndicatorClock(elapsedMs, () => nowMs);
const clock = createIndicatorClock(elapsedMs, () => nowMs, heldDriver().drive);
const stop = clock.run();
// The shared clock has been running for a while when the shimmer appears.
@@ -120,4 +158,113 @@ describe("indicator clock", () => {
expect(read(shimmer)).toBe(0);
});
test("a span that ends under a running indicator is followed by one from where it ended", async () => {
let nowMs = 0;
const driver = heldDriver();
const clock = createIndicatorClock(new Animated.Value(0), () => nowMs, driver.drive);
const stop = clock.run();
// The JS thread hears about the end a few milliseconds after it.
nowMs = 600_012;
driver.finish();
expect(driver.running()).toBe(true);
expect(driver.spansFromMs).toEqual([0, 600_000]);
stop();
await commit();
expect(driver.running()).toBe(false);
});
test("a stopped clock holds its time and counts on from it", async () => {
let nowMs = 0;
const driver = heldDriver();
const clock = createIndicatorClock(new Animated.Value(0), () => nowMs, driver.drive);
const stop = clock.run();
nowMs = 5000;
stop();
await commit();
expect(driver.running()).toBe(false);
// The native driver started counting a frame after the JS thread asked.
driver.reportHeld(4983);
nowMs = 90_000;
clock.run();
expect(driver.spansFromMs).toEqual([0, 4983]);
});
test("a clock restarted before the driver reports counts on from its own reading", async () => {
let nowMs = 0;
const driver = heldDriver();
const clock = createIndicatorClock(new Animated.Value(0), () => nowMs, driver.drive);
const stopFirst = clock.run();
nowMs = 5000;
stopFirst();
await commit();
const stopSecond = clock.run();
nowMs = 7000;
stopSecond();
await commit();
// The answer to the first stop arrives after the second.
driver.reportHeld(4983);
clock.run();
expect(driver.spansFromMs).toEqual([0, 5000, 7000]);
});
test("the clock keeps counting when one indicator takes over from another in a commit", async () => {
const driver = heldDriver();
const clock = createIndicatorClock(new Animated.Value(0), () => 0, driver.drive);
const stopChat = clock.run();
stopChat();
const stopSidebar = clock.run();
await commit();
expect(driver.running()).toBe(true);
expect(driver.spansFromMs).toEqual([0]);
stopSidebar();
await commit();
expect(driver.running()).toBe(false);
});
test("a cycle with its own phase on a stopped clock starts where the clock will count on", async () => {
let nowMs = 0;
const elapsedMs = new Animated.Value(0);
const driver = heldDriver();
const clock = createIndicatorClock(elapsedMs, () => nowMs, driver.drive);
const stop = clock.run();
nowMs = 5000;
stop();
await commit();
driver.reportHeld(4983);
const shimmer = clock.cycle(41 * STEP_MS, { steps: 41, phase: "own" });
elapsedMs.setValue(4983);
expect(read(shimmer)).toBeLessThan(STEP_MS);
});
test("a cycle with its own phase starts at its first step in a later span too", () => {
let nowMs = 0;
const elapsedMs = new Animated.Value(0);
const driver = heldDriver();
const clock = createIndicatorClock(elapsedMs, () => nowMs, driver.drive);
const stop = clock.run();
nowMs = 600_012;
driver.finish();
// The second span started at 600 000 on the clock, 12 ms late on the JS thread.
nowMs = 640_012;
const shimmer = clock.cycle(41 * STEP_MS, { steps: 41, phase: "own" });
elapsedMs.setValue(640_000);
stop();
expect(read(shimmer)).toBeLessThan(STEP_MS);
});
});
@@ -1,11 +1,17 @@
import { useEffect } from "react";
import { Animated } from "react-native";
import { Animated, Easing } from "react-native";
// A decay that never slows is a clock: with a velocity of one unit per millisecond the value is the
// time since it started. Decay is the one native-driven animation that computes its value from the
// frame's timestamp instead of replaying a 60 fps recording, so the motion is exact at any refresh
// rate and never ends or loops.
const CLOCK_CONFIG = { velocity: 1, deceleration: 1 - 1e-12, useNativeDriver: true };
// The clock counts time in spans this long: a linear timing of one unit per millisecond, which the
// native driver reads off the frame's timestamp. Only the end of a span comes back to the JS
// thread, which starts the next one where that one ended.
//
// A decay that never slows would count without spans, but the driver ends a decay whose value did
// not move between two frames, and two frames that carry the same millisecond are enough. A timing
// has no such check.
//
// The timing is sent to the driver as one value for every 60th of a second, so a longer span costs
// more each time the clock starts.
const SPAN_MS = 10 * 60 * 1000;
// The clock starts on a frame and advances a whole frame at a time, so at 60, 90 and 120 Hz a step
// that is a whole number of frames long would turn over exactly on a frame, and rounding would
@@ -14,7 +20,8 @@ const CLOCK_CONFIG = { velocity: 1, deceleration: 1 - 1e-12, useNativeDriver: tr
const STEP_LEAD = 1 / 8;
/**
* Milliseconds, counted on the UI thread by React Native's native animation driver.
* Milliseconds for which the clock has run, counted on the UI thread by React Native's native
* animation driver.
*
* Views bound to it are updated by the native driver directly. Nothing reaches the JS thread, React
* does not render, and no shadow tree is committed — which is what a Reanimated shared value costs
@@ -37,28 +44,76 @@ export interface CycleOptions {
export interface IndicatorClock {
/** Where a cycle of `periodMs` currently is, as milliseconds into the cycle. */
cycle(periodMs: number, options?: CycleOptions): Animated.AnimatedInterpolation<number>;
/** Runs the clock until the returned function is called. It restarts from zero when idle. */
/**
* Runs the clock until the returned function is called. A clock nobody runs holds its time, and
* counts on from it when it runs again, so a view bound to it stays where it stopped.
*/
run(): () => void;
}
/** What advances the clock's value through one span, or until it is stopped. */
export interface ClockDriver {
start(onEnd: (result: { finished: boolean }) => void): void;
/** Stops counting, then reports the time the clock stopped at. */
stop(onHeld: (heldMs: number) => void): void;
}
function countSpan(elapsedMs: Animated.Value, fromMs: number): ClockDriver {
const span = Animated.timing(elapsedMs, {
toValue: fromMs + SPAN_MS,
duration: SPAN_MS,
easing: Easing.linear,
useNativeDriver: true,
});
return {
start: (onEnd) => span.start(onEnd),
stop: (onHeld) => elapsedMs.stopAnimation(onHeld),
};
}
/**
* `now` is the JS thread's view of the time the clock reads. The native driver starts the clock a
* frame or two after `run()` is called, so a cycle with its own phase can start a step into its
* pass, or a step before it; the run-in before the first position hides either.
* The native driver owns the clock's time: the JS thread never sets it, only starts and stops the
* counting. `now` lets the JS thread follow along. The native driver starts counting a frame or two
* after it is asked, so a cycle with its own phase can start a step into its pass, or a step
* before it; the run-in before the first position hides either.
*/
export function createIndicatorClock(
elapsedMs = new Animated.Value(0, { useNativeDriver: true }),
now: () => number = () => performance.now(),
drive: (elapsedMs: Animated.Value, fromMs: number) => ClockDriver = countSpan,
): IndicatorClock {
let runners = 0;
let ticking: Animated.CompositeAnimation | null = null;
let startedAtMs = 0;
let ticking: ClockDriver | null = null;
// While the clock counts: when, on the JS thread, it read zero.
let zeroAtMs = 0;
// While it does not: the time it holds.
let heldMs = 0;
let lastStopped: ClockDriver | null = null;
function currentStepStartMs(stepMs: number): number {
if (!ticking) {
return 0;
}
return Math.floor((now() - startedAtMs) / stepMs) * stepMs;
const elapsed = ticking ? now() - zeroAtMs : heldMs;
return Math.floor(elapsed / stepMs) * stepMs;
}
function count(fromMs: number) {
zeroAtMs = now() - fromMs;
const driver = drive(elapsedMs, fromMs);
ticking = driver;
driver.start(({ finished }) => {
if (finished && ticking === driver) count(fromMs + SPAN_MS);
});
}
function hold() {
if (runners > 0 || !ticking) return;
const stopped = ticking;
ticking = null;
lastStopped = stopped;
// The JS thread's reading stands until the native driver reports its own.
heldMs = now() - zeroAtMs;
stopped.stop((reportedMs) => {
if (!ticking && lastStopped === stopped) heldMs = reportedMs;
});
}
return {
@@ -76,17 +131,13 @@ export function createIndicatorClock(
run() {
runners += 1;
if (!ticking) {
elapsedMs.setValue(0);
startedAtMs = now();
ticking = Animated.decay(elapsedMs, CLOCK_CONFIG);
ticking.start();
count(heldMs);
}
return () => {
runners -= 1;
if (runners === 0) {
ticking?.stop();
ticking = null;
}
// One commit can take the last indicator away and bring another, as when a panel replaces
// another. Stopping after the commit keeps the clock counting through that.
if (runners === 0) queueMicrotask(hold);
};
},
};
@@ -35,15 +35,21 @@ function useReducedMotion(): boolean {
}
/**
* Whether a running indicator may move right now. It holds still when the system asks for reduced
* motion, and while nobody can see it: in a retained panel that is not showing, or in an app that
* is in the background.
* What a running indicator does right now.
*
* An indicator that is not moving draws its resting frame and runs nothing.
* - `moving`: it runs.
* - `held`: nobody can see it, in a retained panel that is not showing or in an app that is in the
* background. It runs nothing and keeps its place, so it continues from there when it is seen
* again. A panel slides into view before it counts as showing, and an indicator that dropped to
* its resting frame would jump when the slide ends.
* - `resting`: the system asks for reduced motion. It draws its resting frame and runs nothing.
*/
export function useIndicatorMotion(): boolean {
export type IndicatorMotion = "moving" | "held" | "resting";
export function useIndicatorMotion(): IndicatorMotion {
const panelActive = useRetainedPanelActive();
const appVisible = useAppVisible();
const reducedMotion = useReducedMotion();
return panelActive && appVisible && !reducedMotion;
if (reducedMotion) return "resting";
return panelActive && appVisible ? "moving" : "held";
}
@@ -50,7 +50,7 @@ const styles = StyleSheet.create({
* Native label shimmer: a gradient band slides behind a mask cut in the shape of the label. The
* native animation driver moves the band; see `indicator-motion/clock.ts`. The band rides the
* shared clock, so its steps turn over on the same frames as the status rings', and starts its own
* pass so the highlight enters from the left when it starts moving.
* pass so the highlight enters from the left when it appears.
*/
export const LabelShimmer = memo(function LabelShimmer({
label,
@@ -61,21 +61,23 @@ export const LabelShimmer = memo(function LabelShimmer({
}: LabelShimmerProps) {
const { rowSize } = measurements;
const measured = rowSize.width > 0 && rowSize.height > 0;
const moving = useIndicatorMotion() && measured;
const motion = useIndicatorMotion();
// A held band stays on the clock, so it keeps its place and its pass.
const sweeping = motion !== "resting" && measured;
const [gradientId] = useState(
() => `shimmer-gradient-${Math.random().toString(36).substring(2, 9)}`,
);
useRunningClock(sharedIndicatorClock, moving);
useRunningClock(sharedIndicatorClock, motion === "moving" && measured);
const { durationMs, steps } = getShimmerCycle(label, secondaryLabel);
const { peakWidth, fromX, toX } = getRowSweep(rowSize.width);
const { width, height } = rowSize;
const trackStyle = useMemo(() => [styles.track, { width, height }], [height, width]);
// Built again each time the band starts moving, so each start begins a new pass.
// Built again each time the band appears, so each appearance begins a new pass.
const bandStyle = useMemo(
() =>
moving
sweeping
? [
styles.band,
{ width: peakWidth, height },
@@ -90,7 +92,7 @@ export const LabelShimmer = memo(function LabelShimmer({
},
]
: null,
[durationMs, fromX, height, moving, peakWidth, steps, toX],
[durationMs, fromX, height, sweeping, peakWidth, steps, toX],
);
const maskElement = useMemo(
() => (
@@ -110,7 +112,7 @@ export const LabelShimmer = memo(function LabelShimmer({
[height, label, labelStyle, secondaryLabel, secondaryLabelStyle, width],
);
if (!moving) {
if (!sweeping) {
return null;
}
@@ -65,7 +65,7 @@ export const LabelShimmer = memo(function LabelShimmer({
measurements,
}: LabelShimmerProps) {
const { labelSpan, secondarySpan } = measurements;
const moving = useIndicatorMotion();
const moving = useIndicatorMotion() === "moving";
const { durationMs, steps } = getShimmerCycle(label, secondaryLabel);
const sweep = getTextSweep({ labelSpan, secondarySpan: secondaryLabel ? secondarySpan : null });
@@ -167,6 +167,79 @@ describe("resolveMarkdownPreviewImageSource", () => {
}),
).toBe("C:/Users/test/repo/images/hero.png");
});
it("keeps extended-length local Windows drive paths and local drive file URIs", () => {
expect(
resolveMarkdownPreviewImageSource({
source: "\\\\?\\C:\\foo\\bar.png",
markdownPath: "docs/guide.md",
workspaceRoot: "C:\\repo",
}),
).toBe("C:/foo/bar.png");
expect(
resolveMarkdownPreviewImageSource({
source: "file:///C:/foo/bar.png",
markdownPath: "docs/guide.md",
workspaceRoot: "C:\\repo",
}),
).toBe("C:/foo/bar.png");
});
it.each([
"\\\\host\\share\\x.png",
"//host/share/x.png",
"\\\\?\\UNC\\host\\share\\x.png",
"file://host/share/x.png",
"\\\\.\\pipe\\foo",
"\\\\?\\Volume{01234567-89ab-cdef-0123-456789abcdef}",
])("rejects UNC, remote file URI, and Windows device source %s", (source) => {
expect(
resolveMarkdownPreviewImageSource({
source,
markdownPath: "docs/guide.md",
workspaceRoot: "C:\\repo",
}),
).toBeNull();
});
it("allows UNC and relative images inside a UNC workspace while rejecting paths outside it", () => {
const uncRoot = "\\\\wsl.localhost\\Ubuntu\\home\\me\\proj";
expect(
resolveMarkdownPreviewImageSource({
source: "\\\\wsl.localhost\\Ubuntu\\home\\me\\proj\\shot.png",
markdownPath: "docs/guide.md",
workspaceRoot: uncRoot,
}),
).toBe("\\\\wsl.localhost\\Ubuntu\\home\\me\\proj\\shot.png");
expect(
resolveMarkdownPreviewImageSource({
source: "file://wsl.localhost/Ubuntu/home/me/proj/shot.png?v=1#top",
markdownPath: "docs/guide.md",
workspaceRoot: uncRoot,
}),
).toBe("\\\\wsl.localhost\\Ubuntu\\home\\me\\proj\\shot.png");
expect(
resolveMarkdownPreviewImageSource({
source: "./images/hero.png",
markdownPath: "docs/guide.md",
workspaceRoot: uncRoot,
}),
).toBe("//wsl.localhost/Ubuntu/home/me/proj/docs/images/hero.png");
expect(
resolveMarkdownPreviewImageSource({
source: "../../../../outside.png",
markdownPath: "docs/guide.md",
workspaceRoot: uncRoot,
}),
).toBeNull();
expect(
resolveMarkdownPreviewImageSource({
source: "\\\\other\\share\\leak.png",
markdownPath: "docs/guide.md",
workspaceRoot: uncRoot,
}),
).toBeNull();
});
});
describe("local assistant Markdown images", () => {
@@ -1,4 +1,9 @@
import { localFileSourceToPath } from "@/attachments/utils";
import {
isUncPathWithinRoot,
parseUncPath,
stripLocalImageQueryAndFragment,
} from "@getpaseo/protocol/path-utils";
import { normalizeLocalImagePath } from "@/utils/assistant-image-source";
import { isAbsolutePath } from "@/utils/path";
function trimTrailingSeparators(value: string): string {
@@ -126,9 +131,10 @@ export function resolveMarkdownPreviewImageSource(input: {
return source;
}
const pathSource = source.replace(/[?#].*$/, "");
const path = localFileSourceToPath(
pathSource.startsWith("file://") ? pathSource : decodeRelativeSource(pathSource),
const pathSource = stripLocalImageQueryAndFragment(source);
const path = normalizeLocalImagePath(
/^file:/i.test(pathSource) ? pathSource : decodeRelativeSource(pathSource),
{ workspaceRoot: input.workspaceRoot },
);
if (!path) {
return null;
@@ -146,5 +152,13 @@ export function resolveMarkdownPreviewImageSource(input: {
return path;
}
return joinAbsolute(directory, path);
const joined = joinAbsolute(directory, path);
if (!joined) {
return null;
}
const joinedUnc = parseUncPath(joined);
if (joinedUnc && !isUncPathWithinRoot(joinedUnc, input.workspaceRoot)) {
return null;
}
return joined;
}
@@ -62,17 +62,24 @@ afterEach(() => {
__setAttachmentStoreForTests(null);
});
function renderMarkdownSource(text: string, initialProps: MarkdownImageContext) {
function renderMarkdownSource(
text: string,
initialProps: MarkdownImageContext,
options?: Parameters<typeof useMarkdownSource>[2],
) {
// No retries: a failed read settles at once. For a host's Markdown this is the state once the
// retries have run out on a host that is slow to connect.
const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });
const wrapper = ({ children }: { children: ReactNode }) => (
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
);
const rendered = renderHook((props: MarkdownImageContext) => useMarkdownSource(text, props), {
wrapper,
initialProps,
});
const rendered = renderHook(
(props: MarkdownImageContext) => useMarkdownSource(text, props, options),
{
wrapper,
initialProps,
},
);
return { ...rendered, queryClient };
}
@@ -104,3 +111,32 @@ it("shows the alt text of a file image in Markdown that belongs to no host", asy
expect(result.current.markdown.replace(PENDING_MARKDOWN_IMAGE, "pending")).toBe("Chart"),
);
});
it("never calls client.readFile when destinations are restricted to https", async () => {
const files = createHostFiles();
const { result, queryClient } = renderMarkdownSource(
"![Local](/etc/passwd) ![Relative](chart.png) ![Unc](\\\\\\\\host\\\\share\\\\x.png) ![RemoteFile](file://host/share/x.png)",
{ serverId: "srv_test", workspaceRoot: "/repo", client: files },
{ destinations: "https" },
);
await waitFor(() => {
expect(queryClient.isFetching()).toBe(0);
expect(result.current.markdown).toBe("Local Relative Unc RemoteFile");
});
expect(files.reads).toEqual([]);
});
it("never calls client.readFile for UNC, remote file URI, or Windows device paths in host Markdown", async () => {
const files = createHostFiles();
const { result, queryClient } = renderMarkdownSource(
"![Unc](\\\\\\\\host\\\\share\\\\x.png) ![SlashUnc](//host/share/x.png) ![Remote](file://host/share/x.png) ![Pipe](\\\\\\\\.\\\\pipe\\\\foo)",
{ serverId: "srv_test", workspaceRoot: "C:/repo", client: files },
);
await waitFor(() => {
expect(queryClient.isFetching()).toBe(0);
expect(result.current.markdown).toBe("Unc SlashUnc Remote Pipe");
});
expect(files.reads).toEqual([]);
});

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