Compare commits

...
Author SHA1 Message Date
paseo-bot[bot]andhellozhangran 40518b3734 Keep browser-adjacent workspace rows clickable
Apply browser avoidance to cards that open above or below their trigger. A browser pane that fills the workspace otherwise pushes the sidebar card over the row that opened it.

Co-authored-by: hellozhangran <hellozhangran@gmail.com>
2026-12-06 23:11:06 +00:00
hellozhangran 38754ef1e3 Cap hover card width to the space beside browser panes
Narrowing the display area moves a hover card back to its trigger's
side of a browser pane, but cannot make it fit a chat pane narrower
than the card. Between two browser panes, a ~280px chat pane left the
300px Context window card hidden on one side. The card's max width now
follows the narrowed area (via fitSurfaceWidth), so it wraps inside the
pane and is placed again on the next layout.
2026-12-06 22:47:04 +00:00
hellozhangran 27fef4e3ed Keep hover cards out of a presented desktop browser pane
On desktop, the in-app browser is a body-level surface on the browser
plane, painted above app content. Hover cards render into the content
plane and are placed against the whole window, so the Context window
card opened from the composer beside a browser pane slid under it and
was cut off at the pane's edge.

Hover card placement now narrows its display area to the trigger's side
of every presented browser surface, so the card shifts back into the
chat pane. Layering is unchanged.

Fixes #6361
2026-12-06 22:46:49 +00:00
paseo-bot[bot]andEapp1e 4559e6cb61 fix(server): print one [Compacted] marker per compaction (#12289)
A compaction emits a loading item when it starts and a completed item when
it ends. The activity curator mapped every compaction item to [Compacted]
without reading status, so `paseo logs` printed one line per status and
showed the marker while the compaction was still running, or after it was
cancelled.

The curator now prints the marker for the completed item only, matching the
app, which keeps one marker per compaction. A compaction that never finishes
leaves no marker, the same way a cancelled one does.

Co-authored-by: Eapp1e <163811520+Eapp1e@users.noreply.github.com>
2026-12-06 22:12:46 +00:00
paseo-bot[bot] 7c013e3e49 test(e2e): consolidate the split workspace header journey (#12285)
* test(e2e): consolidate the split workspace header journey

* test(e2e): drag the split before changing viewport width

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-06 21:37:58 +00:00
b7a0d95a8c Name the plugin method in slow RPC warnings and timeouts (#12284)
* Name the plugin and method on slow and timed-out plugin RPCs

Every plugin RPC is logged as `plugin.rpc.invoke.request`, and the timeout error
named the IPC message type (`<plugin>.invoke`). With many plugins loaded, the log
could not say which RPC was slow. `ws_slow_request` now carries `pluginId` and
`method` for plugin RPC invoke/subscribe requests, and the timeout error names
the method.

Refs #10070

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

* Time binary and JSON plugin calls through the same dispatcher

Verify warnings and timeout errors through a live daemon and plugin subprocess.

Co-authored-by: jamescordrey-ops <335786770+jamescordrey-ops@users.noreply.github.com>
Co-authored-by: Stephen Zhou <10416476+stv1024@users.noreply.github.com>

---------

Co-authored-by: stv1024 <10416476+stv1024@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: jamescordrey-ops <335786770+jamescordrey-ops@users.noreply.github.com>
2026-12-06 21:13:03 +00:00
SunicemanandShane Su 1c8df0160b fix(acp): accept vendor notifications during discovery (#11434)
Co-authored-by: Shane Su <shane.su@maiscrm.com>
2026-12-06 21:12:38 +00:00
Water 7d68e78633 fix(server): retry a failed terminal worker copy delete only on Windows (#10104)
* fix(server): retry a failed terminal worker copy delete only on Windows

On Linux and macOS, EACCES and EPERM mean the daemon user cannot delete
the copy (one left by a daemon that ran under sudo, say). That never
clears, so the 3 s retry added in #10039 only delayed every daemon start
and stop by the whole window per copy before failing the same way.

Keep the retry for Windows, where a just-exited worker's lock clears,
and fail at once elsewhere.

Closes #10052

* refactor(server): key the copy delete retry codes on the platform

Replace the exported shouldRetryRemove helper with a platform-keyed
TRANSIENT_REMOVE_ERRORS set, and merge its comment into the existing one.

The regression test now asserts on behavior instead of elapsed time: the
copy turns deletable again after 300 ms, so a delete that retried would
remove it, while the fix leaves it in `failed` with EACCES. Drop the
unit tests of the helper; Windows keeps its coverage from the terminal
worker lifecycle e2e in the windows-latest job.
2026-12-06 20:42:50 +00:00
paseo-bot[bot] 39fffe895f test(server): prevent port collisions in offline MCP tests (#12282)
The offline fixture releases its probe socket before daemon startup, so another listener can claim the port. Bind an ephemeral port in the daemon and use its bound address for MCP requests.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-06 20:12:50 +00:00
SunicemanandShane Su 1dd25afcb2 fix(server): attach replayed plugin children in arrival order (#11442)
Co-authored-by: Shane Su <shane.su@maiscrm.com>
2026-12-06 19:42:53 +00:00
paseo-bot[bot] 3e9058ad72 test(app): measure routed file compression on the file chunk (#12277)
A large provider snapshot or directory listing can exceed the file size cap even when Chromium receives and opens a compressed file. Measure the encoded chunk that carries the fixture bytes.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-06 19:12:44 +00:00
paseo-bot[bot] 708110f21e test(e2e): consolidate the Composer tools journey (#12278)
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-06 18:30:27 +00:00
paseo-bot[bot]andtieo 8448614bb5 Point contributors to the hover guide (#12271)
The platform rules forbade the handlers required by the hover guide.
Link to the plain View pattern and keep the current touch guidance.

Closes #10519

Co-authored-by: tieo <65707274+tieo@users.noreply.github.com>
2026-12-06 17:12:37 +00:00
paseo-bot[bot]andKhang Nguyen 4d82cff1da Keep Oh My Pi turn timing when history reloads (#12257)
* fix(omp): stamp the replayed todo snapshot with session time

* refactor(omp): pass the todo reader in the history input object

* Preserve OMP replay metadata while timestamping todos

Co-authored-by: Khang Nguyen <duykhang5687@gmail.com>

* Retry worktree base-ref fixture cleanup on Windows

---------

Co-authored-by: Khang Nguyen <duykhang5687@gmail.com>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-12-06 16:42:46 +00:00
Mohamed Boudra 0cb7d4f2c6 chore(release): reconcile 0.19.3 into main (#12264)
* chore(release): reconcile 0.19.3 into main

* chore(nix): update npm-deps.hash for 0.19.3
2026-12-06 23:30:09 +07:00
Marcel Wysocki ad738c02b5 fix(server): stop the Linux watcher reporting a deleted directory under its own name (#9289)
inotify names a watched directory's own deletion after the directory, and
fs.watch passes that name as the filename. The Linux backend resolved it
against the directory, so removing `dir/` also reported a delete for
`dir/dir`, and removing `dir/nested/` one for `dir/nested/nested`.

When `<dir>/<basename(dir)>` is missing, the backend now checks whether the
watched directory itself is gone and drops the event in that case; the
parent watcher and reconciliation already report the directory. A real
child named like its directory is still reported.
2026-12-06 15:12:42 +00:00
51 changed files with 882 additions and 245 deletions
+6
View File
@@ -1,5 +1,11 @@
# Changelog
## 0.19.3 - 2026-12-06
### Fixed
- Fixed agents repeatedly waking each other with finish notifications when both wait for each other to finish ([#11969](https://github.com/getpaseo/paseo/pull/11969))
## 0.19.2 - 2026-12-05
### Fixed
+6
View File
@@ -1,5 +1,11 @@
# Changelog
## 0.19.3 - 2026-12-06
### 修复
- 修复两个 Agent 互相等待对方完成时,完成通知反复唤醒彼此的问题 ([#11969](https://github.com/getpaseo/paseo/pull/11969))
## 0.19.2 - 2026-12-05
### 修复
+1 -1
View File
@@ -197,7 +197,7 @@ The app runs on iOS, Android, web (browser), and web (Electron desktop). Code is
```
Import as `@/desktop/browser/pane` — Electron desktop gets the `.electron.tsx` file, browser web gets `.web.tsx`, and native gets the native/base implementation.
- **NEVER use raw DOM APIs without `isWeb` guard.** DOM APIs crash native. Casting a RN ref to `HTMLElement` is a red flag — ensure the block is web-only.
- **NEVER use `onPointerEnter`/`onPointerLeave`.** They don't fire on native iOS.
- For hover tracking, use the plain `View` pattern in [the hover guide](docs/hover.md).
- **Hover needs a mouse-like pointer.** React Native's `onHoverIn`/`onHoverOut` on `Pressable` does NOT fire on native iOS/iPad — the underlying W3C pointer events are behind disabled experimental flags. For hover-to-show UI (kebab menus, action buttons), call `useRevealsWithoutHover()` unconditionally, then use `isHovered || revealsWithoutHover` so the controls are always visible on touch screens and hover-to-show elsewhere. Don't use `isNative` for this: a native build is not the only touch-first surface, since a touch-first browser such as iPad Safari is `isWeb` but cannot hover.
- **Don't use Platform.OS as a proxy for layout capabilities.** Use breakpoints for layout decisions, not platform checks.
- **Import `isWeb`/`isNative` from `@/constants/platform`.** Never write `const isWeb = Platform.OS === "web"` locally.
@@ -0,0 +1,4 @@
Fixed
- Fixed agents repeatedly waking each other with finish notifications when both wait for each other to finish
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,4 @@
Fixed
- Fixed agents repeatedly waking each other with finish notifications when both wait for each other to finish
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,4 @@
Fixed
- Fixed agents repeatedly waking each other with finish notifications when both wait for each other to finish
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,4 @@
Fixed
- Fixed agents repeatedly waking each other with finish notifications when both wait for each other to finish
Full notes: https://paseo.sh/changelog
+1 -1
View File
@@ -1 +1 @@
sha256-nWaU16CvKjT2bhQ/Q0gxZOv2NGxODBwn7lZ/EQgE+u0=
sha256-B1SjlyJcguo7njbkuQJ4hI72sAYdIsIjPYt/yDzDSEY=
+29 -29
View File
@@ -1,12 +1,12 @@
{
"name": "paseo",
"version": "0.19.2",
"version": "0.19.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "paseo",
"version": "0.19.2",
"version": "0.19.3",
"hasInstallScript": true,
"license": "Apache-2.0",
"workspaces": [
@@ -37659,7 +37659,7 @@
},
"packages/app": {
"name": "@getpaseo/app",
"version": "0.19.2",
"version": "0.19.3",
"dependencies": {
"@codemirror/commands": "6.10.4",
"@codemirror/language": "6.12.4",
@@ -39813,13 +39813,13 @@
},
"packages/cli": {
"name": "@getpaseo/cli",
"version": "0.19.2",
"version": "0.19.3",
"license": "Apache-2.0",
"dependencies": {
"@clack/prompts": "1.1.0",
"@getpaseo/client": "0.19.2",
"@getpaseo/protocol": "0.19.2",
"@getpaseo/server": "0.19.2",
"@getpaseo/client": "0.19.3",
"@getpaseo/protocol": "0.19.3",
"@getpaseo/server": "0.19.3",
"chalk": "5.6.2",
"commander": "12.1.0",
"mime-types": "2.1.35",
@@ -40069,11 +40069,11 @@
},
"packages/client": {
"name": "@getpaseo/client",
"version": "0.19.2",
"version": "0.19.3",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/protocol": "0.19.2",
"@getpaseo/relay": "0.19.2",
"@getpaseo/protocol": "0.19.3",
"@getpaseo/relay": "0.19.3",
"ws": "^8.20.0",
"zod": "^4.4.3"
},
@@ -40085,7 +40085,7 @@
},
"packages/desktop": {
"name": "@getpaseo/desktop",
"version": "0.19.2",
"version": "0.19.3",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/cli": "*",
@@ -40329,7 +40329,7 @@
},
"packages/expo-two-way-audio": {
"name": "@getpaseo/expo-two-way-audio",
"version": "0.19.2",
"version": "0.19.3",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.5.14",
@@ -40375,7 +40375,7 @@
},
"packages/highlight": {
"name": "@getpaseo/highlight",
"version": "0.19.2",
"version": "0.19.3",
"license": "Apache-2.0",
"dependencies": {
"@codemirror/language": "6.12.4",
@@ -40405,7 +40405,7 @@
},
"packages/plugin": {
"name": "@getpaseo/plugin",
"version": "0.19.2",
"version": "0.19.3",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "^1.4.0",
@@ -40413,8 +40413,8 @@
"use-sync-external-store": "^1.6.0"
},
"devDependencies": {
"@getpaseo/client": "0.19.2",
"@getpaseo/protocol": "0.19.2",
"@getpaseo/client": "0.19.3",
"@getpaseo/protocol": "0.19.3",
"@types/node": "^20.9.0",
"@types/react": "~19.2.0",
"react": "19.2.3",
@@ -40424,8 +40424,8 @@
"zod": "^4.4.3"
},
"peerDependencies": {
"@getpaseo/client": "0.19.2",
"@getpaseo/protocol": "0.19.2",
"@getpaseo/client": "0.19.3",
"@getpaseo/protocol": "0.19.3",
"react": ">=19.1.0 <20",
"react-native": ">=0.81.5",
"zod": "^4.4.3"
@@ -40447,7 +40447,7 @@
},
"packages/protocol": {
"name": "@getpaseo/protocol",
"version": "0.19.2",
"version": "0.19.3",
"license": "Apache-2.0",
"dependencies": {
"semver": "^7.8.5",
@@ -40474,7 +40474,7 @@
}
},
"packages/react-native-enriched-markdown": {
"version": "0.19.2",
"version": "0.19.3",
"hasInstallScript": true,
"license": "MIT",
"peerDependencies": {
@@ -40490,7 +40490,7 @@
},
"packages/relay": {
"name": "@getpaseo/relay",
"version": "0.19.2",
"version": "0.19.3",
"license": "Apache-2.0",
"dependencies": {
"@noble/ciphers": "^2.4.0",
@@ -40712,17 +40712,17 @@
},
"packages/server": {
"name": "@getpaseo/server",
"version": "0.19.2",
"version": "0.19.3",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "0.17.1",
"@anthropic-ai/claude-agent-sdk": "0.3.326",
"@anthropic-ai/sdk": "0.104.2",
"@getpaseo/client": "0.19.2",
"@getpaseo/highlight": "0.19.2",
"@getpaseo/plugin": "0.19.2",
"@getpaseo/protocol": "0.19.2",
"@getpaseo/relay": "0.19.2",
"@getpaseo/client": "0.19.3",
"@getpaseo/highlight": "0.19.3",
"@getpaseo/plugin": "0.19.3",
"@getpaseo/protocol": "0.19.3",
"@getpaseo/relay": "0.19.3",
"@isaacs/ttlcache": "2.1.4",
"@modelcontextprotocol/node": "2.1.2",
"@modelcontextprotocol/sdk": "1.29.0",
@@ -41687,7 +41687,7 @@
},
"packages/website": {
"name": "@getpaseo/website",
"version": "0.19.2",
"version": "0.19.3",
"dependencies": {
"@cloudflare/vite-plugin": "^1.29.1",
"@cloudflare/workers-types": "^4.20260317.1",
@@ -43313,7 +43313,7 @@
},
"plugins": {
"name": "@getpaseo/builtin-plugins",
"version": "0.19.2",
"version": "0.19.3",
"dependencies": {
"@getpaseo/plugin": "*",
"zod": "^4.4.3"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "paseo",
"version": "0.19.2",
"version": "0.19.3",
"private": true,
"description": "Paseo: voice-controlled development environment for local AI coding agents",
"keywords": [
@@ -31,6 +31,9 @@ import {
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
import { claudeAndCodexReports, expectUnpinnableRows } from "../support/helpers/usage-sidebar-item";
import { installLoginUsage } from "../support/helpers/usage-login";
import { installUsageReportsFixture } from "../support/helpers/usage-reports";
import { seedWorkspace } from "../support/helpers/seed-client";
import { getServerId } from "../support/helpers/server-id";
const test = base.extend<{ agent: MockAgentSession }>({
agent: async ({ page: _page }, provide) => {
@@ -542,3 +545,110 @@ test("Find remains available after dismissing context details", async ({ page, a
await page.keyboard.press("ControlOrMeta+f");
await expect(page.getByRole("textbox", { name: "Find in pane", exact: true })).toBeFocused();
});
/**
* Presents desktop browser surfaces the way the Electron app does: a body-level host on the
* browser plane, painted above app content, with one surface per presented browser pane.
*/
async function presentBrowserSurfaces(
page: Page,
surfaces: { left: number; right: number }[],
): Promise<void> {
await page.evaluate((bounds) => {
const host = document.createElement("div");
host.id = "paseo-browser-resident-webviews";
Object.assign(host.style, {
position: "fixed",
inset: "0",
zIndex: "0",
pointerEvents: "none",
});
bounds.forEach(({ left, right }, index) => {
const surface = document.createElement("div");
surface.setAttribute("data-paseo-browser-surface", `fixture-browser-${index}`);
surface.setAttribute("aria-hidden", "false");
Object.assign(surface.style, {
position: "fixed",
left: `${left}px`,
top: "0",
width: `${right - left}px`,
height: "100vh",
background: "rgb(128, 128, 128)",
pointerEvents: "none",
});
host.appendChild(surface);
});
document.body.appendChild(host);
}, surfaces);
}
/** Opens the agent with a usage report, so the details card takes its full usage width. */
async function openAgentWithUsage(page: Page, agent: MockAgentSession) {
const [claude] = claudeAndCodexReports();
await installUsageReportsFixture(page, { lists: [[onPersonalLogin(claude!)]] });
await page.setViewportSize(DESKTOP);
await openAgent(page, agent);
const meter = await page.getByTestId("context-window-meter").boundingBox();
if (!meter) throw new Error("The context window meter must be on screen.");
return meter;
}
async function elementBox(element: Locator) {
const box = await element.boundingBox();
if (!box) throw new Error("Expected an element on screen.");
return box;
}
test("context details stay beside a desktop browser pane instead of under it", async ({
page,
agent,
}) => {
const meter = await openAgentWithUsage(page, agent);
const browserLeft = Math.round(meter.x + meter.width + 24);
await presentBrowserSurfaces(page, [{ left: browserLeft, right: DESKTOP.width }]);
const box = await elementBox(await hoverContextWindowMeter(page));
await qaScreenshot(page, "context-window-beside-browser");
expect(box.x + box.width).toBeLessThanOrEqual(browserLeft);
});
test("context details narrow to fit a chat pane between two browser panes", async ({
page,
agent,
}) => {
const meter = await openAgentWithUsage(page, agent);
// A chat pane about 280px wide, narrower than the details card, with a browser on each side.
const gapRight = Math.round(meter.x + meter.width + 24);
const gapLeft = gapRight - 280;
await presentBrowserSurfaces(page, [
{ left: 0, right: gapLeft },
{ left: gapRight, right: DESKTOP.width },
]);
const box = await elementBox(await hoverContextWindowMeter(page));
await qaScreenshot(page, "context-window-between-browsers");
expect(box.x).toBeGreaterThanOrEqual(gapLeft);
expect(box.x + box.width).toBeLessThanOrEqual(gapRight);
});
async function switchWorkspaceBesideBrowser(page: Page, workspaceId: string): Promise<void> {
const workspaceKey = `${getServerId()}:${workspaceId}`;
const row = page.getByTestId(`sidebar-workspace-row-${workspaceKey}`);
const box = await elementBox(row);
await presentBrowserSurfaces(page, [{ left: box.x + box.width + 4, right: DESKTOP.width }]);
await row.hover();
await expect(page.getByRole("menu", { name: "Workspace scripts" })).toBeVisible();
await row.click({ timeout: 5000 });
await expect(page.getByTestId(`workspace-deck-entry-${workspaceKey}`)).toBeVisible();
}
test("a workspace row stays clickable beside a desktop browser pane", async ({ page, agent }) => {
const target = await seedWorkspace({ repoPrefix: "workspace-beside-browser-" });
try {
await page.setViewportSize(DESKTOP);
await openAgent(page, agent);
await switchWorkspaceBesideBrowser(page, target.workspaceId);
} finally {
await target.cleanup();
}
});
@@ -10,37 +10,32 @@ import {
withPluginSettingsFromComposer,
} from "../support/helpers/plugin-composers-by-reference";
test("a panel in the Explorer inserts at the cursor of the focused agent's composer", async ({
test("Composer tools inserts a checklist, shows review status, and follows agent focus", async ({
page,
}) => {
test.setTimeout(120_000);
await withComposerToolsExample(page, async (author) => {
await author.openComposerToolsInExplorer();
await author.typeInComposer("start end", 5);
await author.insertChecklistFromPanel();
await author.expectComposerText(`start${CHECKLIST} end`);
});
});
test("a Command Center item changes an agent's metadata through its composer", async ({ page }) => {
test.setTimeout(120_000);
await withComposerToolsExample(page, async (author) => {
await author.openComposerToolsInExplorer();
await author.expectPanelShowsReview(false);
await author.markForReviewFromCommandCenter();
await author.expectPanelShowsReview(true);
});
});
await test.step("insert a checklist at the cursor", async () => {
await author.typeInComposer("start end", 5);
await author.insertChecklistFromPanel();
await author.expectComposerText(`start${CHECKLIST} end`);
});
test("the panel follows which agent is focused", async ({ page }) => {
test.setTimeout(120_000);
await withComposerToolsExample(page, async (author) => {
await author.openComposerToolsInExplorer();
await author.expectPanelFocusedAgent(true);
await author.focusANewAgentTab();
await author.expectPanelFocusedAgent(false);
await author.focusTheAgentTab();
await author.expectPanelFocusedAgent(true);
await test.step("mark the focused agent for review from Command Center", async () => {
await author.expectPanelShowsReview(false);
await author.markForReviewFromCommandCenter();
await author.expectPanelShowsReview(true);
});
await test.step("switch to a draft tab and return to the agent", async () => {
await author.expectPanelFocusedAgent(true);
await author.focusANewAgentTab();
await author.expectPanelFocusedAgent(false);
await author.focusTheAgentTab();
await author.expectPanelFocusedAgent(true);
});
});
});
@@ -1,12 +1,14 @@
import { randomUUID } from "node:crypto";
import { createHash, randomUUID } from "node:crypto";
import { readFile, writeFile } from "node:fs/promises";
import path from "node:path";
import { deflateRawSync } from "node:zlib";
import { deflateRawSync, inflateRawSync } from "node:zlib";
import { expect, type Page } from "@playwright/test";
import {
decodeHostRouteFrame,
HOST_ROUTE_OPCODE,
} from "@getpaseo/protocol/binary-frames/host-route";
decodeFileTransferFrame,
FileTransferOpcode,
} from "@getpaseo/protocol/binary-frames/file-transfer";
import { decodeHostRouteFrame } from "@getpaseo/protocol/binary-frames/host-route";
import { MAX_WEBSOCKET_MESSAGE_BYTES } from "@getpaseo/protocol/websocket-message-limit";
import { test } from "../support/fixtures";
import { gotoAppShell } from "../support/helpers/app";
import { connectDaemonClient } from "../support/helpers/daemon-client-loader";
@@ -38,7 +40,7 @@ interface BrowserCompressionTraffic {
/** `frame_codecs` of each hello the browser sent to a routed host through the primary. */
routedHelloCodecs: Array<string[] | null>;
outerEncodedFrames: number[];
routedEncodedFrames: number[];
routedEncodedFileChunks: number[];
}
interface SentHello {
@@ -59,13 +61,16 @@ function parseJson<T>(text: string): T | null {
}
}
function observeBrowserCompressionTraffic(page: Page): BrowserCompressionTraffic {
function observeBrowserCompressionTraffic(
page: Page,
fileBytes: Buffer,
): BrowserCompressionTraffic {
const traffic: BrowserCompressionTraffic = {
connectedPorts: new Set(),
outerHelloCodecs: [],
routedHelloCodecs: [],
outerEncodedFrames: [],
routedEncodedFrames: [],
routedEncodedFileChunks: [],
};
page.on("websocket", (socket) => {
@@ -94,25 +99,30 @@ function observeBrowserCompressionTraffic(page: Page): BrowserCompressionTraffic
socket.on("framereceived", ({ payload }) => {
if (!(payload instanceof Buffer) || payload.byteLength < 4) return;
const inspectRouted = (buf: Uint8Array) => {
if (buf.byteLength < 4 || buf[0] !== HOST_ROUTE_OPCODE) return;
const routed = decodeHostRouteFrame(buf);
if (
routed &&
routed.payload instanceof Uint8Array &&
routed.payload.byteLength >= 4 &&
routed.payload[0] === 0x31 &&
(routed.payload[3]! & 0x04) !== 0
) {
traffic.routedEncodedFrames.push(routed.payload.byteLength);
}
};
if (payload[0] === 0x31 && (payload[3]! & 0x04) !== 0) {
traffic.outerEncodedFrames.push(payload.byteLength);
return;
}
inspectRouted(payload);
const routed = decodeHostRouteFrame(payload)?.payload;
// The fixture fits in one FileChunk and one transport frame. Match its bytes so
// responses for other reads and other binary traffic cannot satisfy this check.
if (
!routed ||
routed.byteLength <= 4 ||
routed[0] !== 0x31 ||
routed[2] !== 1 ||
routed[3] !== 0x07 // START | END | ENCODED
) {
return;
}
const chunk = decodeFileTransferFrame(
inflateRawSync(routed.subarray(4), { maxOutputLength: MAX_WEBSOCKET_MESSAGE_BYTES }),
);
if (chunk?.opcode === FileTransferOpcode.FileChunk && fileBytes.equals(chunk.payload)) {
traffic.routedEncodedFileChunks.push(routed.byteLength);
}
});
});
@@ -145,6 +155,14 @@ async function waitForHostOnline(client: HostAdminClient, registrationId: string
.toBe("online");
}
async function seedLargeDirectoryListing(repoPath: string): Promise<void> {
const names = Array.from({ length: 256 }, (_, index) => {
const hash = createHash("sha512").update(String(index)).digest("hex");
return `zz-${hash}.txt`;
});
await Promise.all(names.map((name) => writeFile(path.join(repoPath, name), "")));
}
const PROTOCOL_DIST_DIR = path.resolve(__dirname, "../../../protocol/dist");
const SERVED_PROTOCOL_FILES = new Set([
"web-frame-codec.js",
@@ -324,6 +342,8 @@ test.describe("Routed host frame compression in browser", () => {
port: secondaryDaemon.port,
});
await writeFile(path.join(secondaryWorkspace.repoPath, fileName), largeFileContent, "utf8");
// Make Explorer receive a large compressed listing before it opens the file.
await seedLargeDirectoryListing(secondaryWorkspace.repoPath);
// Register secondary on primary so the browser discovers it solely as a routed host.
const registration = await primaryClient.addHost({
@@ -333,7 +353,7 @@ test.describe("Routed host frame compression in browser", () => {
registrationId = registration.registrationId;
await waitForHostOnline(primaryClient, registrationId);
const traffic = observeBrowserCompressionTraffic(page);
const traffic = observeBrowserCompressionTraffic(page, Buffer.from(largeFileContent));
await test.step("open the routed host workspace through the primary daemon", async () => {
await gotoAppShell(page);
@@ -365,9 +385,9 @@ test.describe("Routed host frame compression in browser", () => {
expect(traffic.connectedPorts.has(primaryPort)).toBe(true);
expect(traffic.connectedPorts.has(String(secondaryDaemon!.port))).toBe(false);
// Real deflate-raw 0x31 ENCODED frames crossed the routed host channel, compressed once.
expect(traffic.routedEncodedFrames.length).toBeGreaterThan(0);
expect(Math.max(...traffic.routedEncodedFrames)).toBeLessThan(
// Check the compressed file chunk and verify the outer connection stayed uncompressed.
expect(traffic.routedEncodedFileChunks.length).toBeGreaterThan(0);
expect(Math.max(...traffic.routedEncodedFileChunks)).toBeLessThan(
largeFileContent.length * 0.35,
);
expect(traffic.outerEncodedFrames).toEqual([]);
@@ -62,11 +62,45 @@ async function dragDivider(divider: Locator, deltaX: number): Promise<void> {
}
test.describe("Workspace header with split panes", () => {
test("wide side-by-side panes share one header and keep their tab rails", async ({ page }) => {
test("side-by-side panes share a header through resizing and closing", async ({ page }) => {
const workspace = await openSplitWorkspace(page, "split-header-wide-", "Split pane right");
try {
await expectOneSharedWorkspaceHeader(page);
await expectPanesKeepTabRails(page);
await test.step("Wide panes share a header and keep their tab rails", async () => {
await expectOneSharedWorkspaceHeader(page);
await expectPanesKeepTabRails(page);
});
await test.step("A narrow pane keeps its rail beside a wide pane", async () => {
await dragDivider(splitDividers(page), -300);
const [left, right] = await panes(page).all();
const leftBox = await left.boundingBox();
const rightBox = await right.boundingBox();
expect(leftBox!.width).toBeLessThan(500);
expect(rightBox!.width).toBeGreaterThan(500);
await expectPanesKeepTabRails(page);
await expectOneSharedWorkspaceHeader(page);
});
await test.step("A narrow viewport keeps the shared header and both rails", async () => {
await dragDivider(splitDividers(page), 300);
await page.setViewportSize({ width: 760, height: 900 });
await expectPanesKeepTabRails(page);
await expectOneSharedWorkspaceHeader(page);
});
await test.step("Closing the split restores the compact single-pane header", async () => {
await page.setViewportSize({ width: 1600, height: 900 });
const [, emptyPane] = await panes(page).all();
const emptyPaneRail = emptyPane.getByTestId("workspace-tabs-row");
await emptyPaneRail.locator('[data-testid^="workspace-tab-"]').first().hover();
await emptyPaneRail.locator('[data-testid*="-close-"]').first().click();
await expect(splitDividers(page)).toHaveCount(0);
await expect(visible(page, "workspace-header-title")).toHaveCount(1);
await page.setViewportSize({ width: 760, height: 900 });
await expect(visible(page, "workspace-tabs-row")).toHaveCount(0);
await expect(visible(page, "workspace-tab-switcher-trigger")).toHaveCount(1);
await expect(visible(page, "workspace-header-title")).toHaveCount(1);
});
} finally {
await workspace.cleanup();
}
@@ -81,51 +115,4 @@ test.describe("Workspace header with split panes", () => {
await workspace.cleanup();
}
});
test("a narrow workspace shows one compact header and every pane keeps its tab rail", async ({
page,
}) => {
const workspace = await openSplitWorkspace(page, "split-header-narrow-", "Split pane right");
try {
await page.setViewportSize({ width: 760, height: 900 });
await expectPanesKeepTabRails(page);
await expectOneSharedWorkspaceHeader(page);
} finally {
await workspace.cleanup();
}
});
test("a narrow pane beside a wide one keeps its tab rail", async ({ page }) => {
const workspace = await openSplitWorkspace(page, "split-header-mixed-", "Split pane right");
try {
await dragDivider(splitDividers(page), -300);
const [left, right] = await panes(page).all();
const leftBox = await left.boundingBox();
const rightBox = await right.boundingBox();
expect(leftBox!.width).toBeLessThan(500);
expect(rightBox!.width).toBeGreaterThan(500);
await expectPanesKeepTabRails(page);
await expectOneSharedWorkspaceHeader(page);
} finally {
await workspace.cleanup();
}
});
test("closing back to one pane returns the merged compact header", async ({ page }) => {
const workspace = await openSplitWorkspace(page, "split-header-close-", "Split pane right");
try {
const [, emptyPane] = await panes(page).all();
const emptyPaneRail = emptyPane.getByTestId("workspace-tabs-row");
await emptyPaneRail.locator('[data-testid^="workspace-tab-"]').first().hover();
await emptyPaneRail.locator('[data-testid*="-close-"]').first().click();
await expect(splitDividers(page)).toHaveCount(0);
await expect(visible(page, "workspace-header-title")).toHaveCount(1);
await page.setViewportSize({ width: 760, height: 900 });
await expect(visible(page, "workspace-tabs-row")).toHaveCount(0);
await expect(visible(page, "workspace-tab-switcher-trigger")).toHaveCount(1);
await expect(visible(page, "workspace-header-title")).toHaveCount(1);
} finally {
await workspace.cleanup();
}
});
});
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/app",
"version": "0.19.2",
"version": "0.19.3",
"private": true,
"main": "index.ts",
"scripts": {
@@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import {
computePosition,
displayAreaBesideObstacles,
fitSurfaceWidth,
getTransformOrigin,
holdSurfaceEdge,
@@ -101,6 +102,66 @@ function edgesBeforeReplacement(placedHeight: number, paintedHeight: number) {
return { top: bottom - paintedHeight, bottom };
}
describe("displayAreaBesideObstacles", () => {
const WINDOW: Rect = { x: 0, y: 0, width: 2000, height: 1300 };
// A composer control near the right edge of a chat pane, with a browser pane beside it.
const NEAR_RIGHT_EDGE: Rect = { x: 760, y: 1280, width: 20, height: 20 };
const BROWSER_RIGHT: Rect = { x: 850, y: 0, width: 1150, height: 1300 };
it("ends the area where a browser pane to the right of the trigger starts", () => {
expect(
displayAreaBesideObstacles({
displayArea: WINDOW,
triggerRect: NEAR_RIGHT_EDGE,
obstacles: [BROWSER_RIGHT],
}),
).toEqual({ x: 0, y: 0, width: 850, height: 1300 });
});
it("starts the area where a browser pane to the left of the trigger ends", () => {
expect(
displayAreaBesideObstacles({
displayArea: WINDOW,
triggerRect: { x: 1200, y: 1280, width: 20, height: 20 },
obstacles: [{ x: 0, y: 0, width: 850, height: 1300 }],
}),
).toEqual({ x: 850, y: 0, width: 1150, height: 1300 });
});
it("ignores an obstacle the trigger sits inside, and keeps the area without obstacles", () => {
expect(
displayAreaBesideObstacles({
displayArea: WINDOW,
triggerRect: { x: 900, y: 10, width: 20, height: 20 },
obstacles: [BROWSER_RIGHT],
}),
).toEqual(WINDOW);
expect(
displayAreaBesideObstacles({
displayArea: WINDOW,
triggerRect: NEAR_RIGHT_EDGE,
obstacles: [],
}),
).toEqual(WINDOW);
});
it("keeps a centered card that would cross into the browser pane on the trigger's side", () => {
const placed = computePosition({
triggerRect: NEAR_RIGHT_EDGE,
contentSize: { width: 340, height: 300 },
displayArea: displayAreaBesideObstacles({
displayArea: WINDOW,
triggerRect: NEAR_RIGHT_EDGE,
obstacles: [BROWSER_RIGHT],
}),
placement: "top",
alignment: "center",
offset: 8,
});
expect(placed.x + 340).toBeLessThanOrEqual(BROWSER_RIGHT.x);
});
});
describe("surfaceFrameStyles", () => {
it("keeps a surface above its trigger off the trigger when its content grows", () => {
// Trigger top 400, offset 4: the surface ends at 396 however tall it becomes.
+27
View File
@@ -142,6 +142,33 @@ export function fitSurfaceWidth(requested: SurfaceWidth, displayWidth: number):
};
}
/**
* Narrows a display area so a surface stays on its trigger's side of each obstacle, such as a
* browser pane painted above app content. Only obstacles fully left or right of the trigger
* narrow the area; one the trigger sits inside is ignored.
*/
export function displayAreaBesideObstacles({
displayArea,
triggerRect,
obstacles,
}: {
displayArea: Rect;
triggerRect: Rect;
obstacles: readonly Rect[];
}): Rect {
let left = displayArea.x;
let right = displayArea.x + displayArea.width;
for (const obstacle of obstacles) {
const obstacleRight = obstacle.x + obstacle.width;
if (obstacle.x >= triggerRect.x + triggerRect.width) {
right = Math.min(right, obstacle.x);
} else if (obstacleRight <= triggerRect.x) {
left = Math.max(left, obstacleRight);
}
}
return { ...displayArea, x: left, width: Math.max(0, right - left) };
}
export function computePosition({
triggerRect,
contentSize,
+23 -2
View File
@@ -19,12 +19,15 @@ import { Portal } from "@gorhom/portal";
import { OverlayLayerProvider, useOverlayLayer } from "@/lib/overlay-root";
import { FloatingSurface } from "@/components/ui/floating";
import { useFloatingPanelPortalHostName } from "@/components/ui/floating-panel-portal";
import { readPresentedBrowserRects } from "@/desktop/browser/resident-webviews";
import { isWeb } from "@/constants/platform";
import { usePointerCapabilities } from "@/hooks/pointer-capabilities";
import { computeHoverBridgeRect, type RectLike } from "@/hooks/hover-safe-zone-tracker";
import { useHoverSafeZone } from "@/hooks/use-hover-safe-zone";
import {
computePosition,
displayAreaBesideObstacles,
fitSurfaceWidth,
measureElement,
type Alignment,
type Placement,
@@ -442,6 +445,7 @@ function HoverCardSurface({
const overlayRef = useRef<View>(null);
const [position, setPosition] = useState<CardPosition | null>(null);
const [bridge, setBridge] = useState<RectLike | null>(null);
const [maxWidth, setMaxWidth] = useState<number | undefined>(undefined);
const place = useCallback(() => {
const trigger = triggerRef.current;
@@ -450,10 +454,24 @@ function HoverCardSurface({
if (!trigger || !overlay || !content) return;
measureCardLayout(trigger, overlay, content, (layout) => {
const { width, height } = Dimensions.get("window");
const windowArea = { x: 0, y: 0, width, height };
// A side-opening card can cover its trigger when a browser fills the pane beside it.
const displayArea =
isWeb && (placement === "top" || placement === "bottom")
? displayAreaBesideObstacles({
displayArea: windowArea,
triggerRect: layout.trigger,
obstacles: readPresentedBrowserRects(),
})
: windowArea;
// A pane narrower than the card needs both a width cap and position clamping.
setMaxWidth(
displayArea.width < width ? fitSurfaceWidth({}, displayArea.width).maxWidth : undefined,
);
const { x, y, actualPlacement } = computePosition({
triggerRect: layout.trigger,
contentSize: layout.content,
displayArea: { x: 0, y: 0, width, height },
displayArea,
placement,
flipHorizontal: true,
alignment,
@@ -510,7 +528,10 @@ function HoverCardSurface({
: null,
[bridge],
);
const surfaceStyle = useMemo(() => [styles.surface, style], [style]);
const surfaceStyle = useMemo(
() => [styles.surface, style, maxWidth === undefined ? undefined : { maxWidth }],
[style, maxWidth],
);
return (
<View
@@ -7,6 +7,7 @@ import {
getResidentBrowserWebview,
prepareBrowserWebview,
presentBrowserWebview,
readPresentedBrowserRects,
rememberBrowserWebviewSize,
releaseResidentBrowserWebview,
removeResidentBrowserWebview,
@@ -179,6 +180,36 @@ describe("resident browser webviews", () => {
expect(webview.parentElement).toBe(permanentParent);
});
it("reports presented browser surfaces and leaves parked ones out", () => {
const presented = ensureTestBrowser({
browserId: "browser-presented-rect",
workspaceId: "workspace-presented-rect",
url: "https://example.com",
});
ensureTestBrowser({
browserId: "browser-parked-rect",
workspaceId: "workspace-parked-rect",
url: "https://example.com",
});
if (!presented) {
throw new Error("Expected resident browser webview");
}
const anchor = document.createElement("div");
Object.defineProperty(anchor, "getBoundingClientRect", {
value: () => ({ left: 850, top: 0, width: 600, height: 400 }),
});
expect(readPresentedBrowserRects()).toEqual([]);
presentBrowserWebview("browser-presented-rect", presented, anchor, anchor, {
mode: "responsive",
});
expect(readPresentedBrowserRects()).toEqual([{ x: 850, y: 0, width: 600, height: 400 }]);
releaseResidentBrowserWebview("browser-presented-rect", presented);
expect(readPresentedBrowserRects()).toEqual([]);
});
it("clips an oversized fixed viewport to its pane without resizing the webview", () => {
const webview = ensureTestBrowser({
browserId: "browser-oversized",
@@ -6,6 +6,7 @@ import {
import { useBrowserStore, type BrowserViewport } from "@/desktop/browser/store";
import { i18n } from "@/i18n/i18next";
import { WEB_SURFACE_PLANE } from "@/lib/overlay-root";
import type { Rect } from "@/components/ui/anchor";
const RESIDENT_BROWSER_HOST_ID = "paseo-browser-resident-webviews";
const BROWSER_ID_ATTRIBUTE = "data-paseo-browser-id";
@@ -325,6 +326,23 @@ export function presentBrowserWebview(
webview.style.top = `${Math.round(anchorBounds.top - surfaceTop)}px`;
}
/**
* Window rects of the browser surfaces presented in a pane right now. They sit on the browser
* plane above app content, so content overlays have to stay out of them. Parked surfaces are
* left out.
*/
export function readPresentedBrowserRects(): Rect[] {
const host = readDocument()?.getElementById(RESIDENT_BROWSER_HOST_ID);
if (!host) return [];
const rects: Rect[] = [];
for (const surface of host.querySelectorAll<HTMLElement>(`[${BROWSER_SURFACE_ATTRIBUTE}]`)) {
if (surface.getAttribute("aria-hidden") !== "false") continue;
const { left, top, width, height } = surface.getBoundingClientRect();
if (width > 0 && height > 0) rects.push({ x: left, y: top, width, height });
}
return rects;
}
export function prepareBrowserWebview(
webview: HTMLElement,
input: {
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/cli",
"version": "0.19.2",
"version": "0.19.3",
"description": "Paseo CLI - control your AI coding agents from the command line",
"license": "Apache-2.0",
"repository": {
@@ -34,9 +34,9 @@
},
"dependencies": {
"@clack/prompts": "1.1.0",
"@getpaseo/client": "0.19.2",
"@getpaseo/protocol": "0.19.2",
"@getpaseo/server": "0.19.2",
"@getpaseo/client": "0.19.3",
"@getpaseo/protocol": "0.19.3",
"@getpaseo/server": "0.19.3",
"chalk": "5.6.2",
"commander": "12.1.0",
"mime-types": "2.1.35",
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/client",
"version": "0.19.2",
"version": "0.19.3",
"description": "Paseo client SDK package",
"license": "Apache-2.0",
"repository": {
@@ -62,8 +62,8 @@
"measure:diff-materialization": "tsx scripts/measure-diff-materialization.ts"
},
"dependencies": {
"@getpaseo/protocol": "0.19.2",
"@getpaseo/relay": "0.19.2",
"@getpaseo/protocol": "0.19.3",
"@getpaseo/relay": "0.19.3",
"ws": "^8.20.0",
"zod": "^4.4.3"
},
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/desktop",
"version": "0.19.2",
"version": "0.19.3",
"private": true,
"description": "Paseo desktop app (Electron wrapper)",
"homepage": "https://paseo.sh",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/expo-two-way-audio",
"version": "0.19.2",
"version": "0.19.3",
"description": "Native module for two way audio streaming",
"keywords": [
"ExpoTwoWayAudio",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/highlight",
"version": "0.19.2",
"version": "0.19.3",
"license": "Apache-2.0",
"repository": {
"type": "git",
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/plugin",
"version": "0.19.2",
"version": "0.19.3",
"description": "Paseo plugin SDK package",
"license": "Apache-2.0",
"repository": {
@@ -88,8 +88,8 @@
"use-sync-external-store": "^1.6.0"
},
"devDependencies": {
"@getpaseo/client": "0.19.2",
"@getpaseo/protocol": "0.19.2",
"@getpaseo/client": "0.19.3",
"@getpaseo/protocol": "0.19.3",
"@types/node": "^20.9.0",
"@types/react": "~19.2.0",
"react": "19.2.3",
@@ -99,8 +99,8 @@
"zod": "^4.4.3"
},
"peerDependencies": {
"@getpaseo/client": "0.19.2",
"@getpaseo/protocol": "0.19.2",
"@getpaseo/client": "0.19.3",
"@getpaseo/protocol": "0.19.3",
"react": ">=19.1.0 <20",
"react-native": ">=0.81.5",
"zod": "^4.4.3"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/protocol",
"version": "0.19.2",
"version": "0.19.3",
"description": "Paseo shared protocol schemas and wire types",
"license": "Apache-2.0",
"repository": {
@@ -1,6 +1,6 @@
{
"name": "react-native-enriched-markdown",
"version": "0.19.2",
"version": "0.19.3",
"private": true,
"description": "Markdown-based Rich Text solution for React Native",
"main": "./lib/module/index",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/relay",
"version": "0.19.2",
"version": "0.19.3",
"description": "Paseo relay for bridging daemon and client connections",
"license": "Apache-2.0",
"repository": {
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/server",
"version": "0.19.2",
"version": "0.19.3",
"description": "Paseo backend server",
"license": "Apache-2.0",
"repository": {
@@ -100,7 +100,7 @@
"speech:transcribe:local": "tsx scripts/transcribe-local-wav.ts",
"test": "npm run test:unit && npm run test:integration",
"test:unit": "vitest run --fileParallelism --exclude \"**/*.e2e.test.ts\"",
"test:integration": "vitest run --fileParallelism --maxWorkers=3 src/server/daemon-e2e/daemon-shutdown.e2e.test.ts src/server/git-filename-diffs.e2e.test.ts src/server/daemon-e2e/checkout-diff-content.e2e.test.ts src/server/daemon-e2e/concurrent-agent-refresh.e2e.test.ts src/server/daemon-e2e/agent-archive-overlap.e2e.test.ts src/server/daemon-e2e/create-agent-mode.e2e.test.ts src/server/daemon-e2e/filesystem.e2e.test.ts src/server/daemon-e2e/file-download.e2e.test.ts src/server/daemon-e2e/frame-compression.e2e.test.ts src/server/daemon-e2e/cli-logs-follow.e2e.test.ts src/server/creation/creation.e2e.test.ts src/server/daemon-e2e/creation-status.e2e.test.ts src/server/daemon-e2e/persisted-creation-caller.e2e.test.ts src/server/daemon-e2e/terminal-workspace-sdk.e2e.test.ts src/server/daemon-e2e/terminal-worker-lifecycle.e2e.test.ts src/server/workspace-create-worktree-source.e2e.test.ts src/server/daemon-e2e/models.e2e.test.ts src/server/daemon-e2e/acp-child-exit-recovery.e2e.test.ts src/server/daemon-e2e/live-preferences.e2e.test.ts src/server/daemon-e2e/oversized-message.e2e.test.ts src/server/agent/model-catalog.e2e.test.ts src/server/plugins/managed-update.e2e.test.ts src/server/plugins/plugin-paseo-api.e2e.test.ts src/server/plugins/usage-sources.e2e.test.ts src/server/plugins/lifecycle.e2e.test.ts src/server/plugins/agent-configuration.e2e.test.ts src/server/plugins/worktree-manager.e2e.test.ts src/server/connected-hosts/hosts.e2e.test.ts src/server/owned-subscriptions.e2e.test.ts && vitest run --fileParallelism --maxWorkers=3 src/server/agent/providers/omp/history.e2e.test.ts src/server/daemon-e2e/git-operations.e2e.test.ts src/server/session.create-agent-worktree-autoarchive.e2e.test.ts src/server/agent/providers/opencode-bridge.local.e2e.test.ts src/server/daemon-e2e/relay-transport.e2e.test.ts src/server/agent/agent-mcp.e2e.test.ts src/server/plugins/agent-tools.e2e.test.ts -t \"agent MCP protocol negotiation|merges into|creates a worktree and auto-archives both|versioned runtime|oversized attachments|connected hosts|password-protected daemon refuses|replays selected OMP history|changes the launch wrap|negotiates protected endpoint security\"",
"test:integration": "vitest run --fileParallelism --maxWorkers=3 src/server/daemon-e2e/daemon-shutdown.e2e.test.ts src/server/git-filename-diffs.e2e.test.ts src/server/daemon-e2e/checkout-diff-content.e2e.test.ts src/server/daemon-e2e/concurrent-agent-refresh.e2e.test.ts src/server/daemon-e2e/agent-archive-overlap.e2e.test.ts src/server/daemon-e2e/create-agent-mode.e2e.test.ts src/server/daemon-e2e/filesystem.e2e.test.ts src/server/daemon-e2e/file-download.e2e.test.ts src/server/daemon-e2e/frame-compression.e2e.test.ts src/server/daemon-e2e/cli-logs-follow.e2e.test.ts src/server/creation/creation.e2e.test.ts src/server/daemon-e2e/creation-status.e2e.test.ts src/server/daemon-e2e/persisted-creation-caller.e2e.test.ts src/server/daemon-e2e/terminal-workspace-sdk.e2e.test.ts src/server/daemon-e2e/terminal-worker-lifecycle.e2e.test.ts src/server/workspace-create-worktree-source.e2e.test.ts src/server/daemon-e2e/models.e2e.test.ts src/server/daemon-e2e/acp-child-exit-recovery.e2e.test.ts src/server/daemon-e2e/live-preferences.e2e.test.ts src/server/daemon-e2e/oversized-message.e2e.test.ts src/server/agent/model-catalog.e2e.test.ts src/server/plugins/managed-update.e2e.test.ts src/server/plugins/plugin-paseo-api.e2e.test.ts src/server/plugins/plugin-subscriptions.e2e.test.ts src/server/plugins/usage-sources.e2e.test.ts src/server/plugins/lifecycle.e2e.test.ts src/server/plugins/agent-configuration.e2e.test.ts src/server/plugins/worktree-manager.e2e.test.ts src/server/connected-hosts/hosts.e2e.test.ts src/server/owned-subscriptions.e2e.test.ts && vitest run --fileParallelism --maxWorkers=3 src/server/agent/providers/omp/history.e2e.test.ts src/server/daemon-e2e/git-operations.e2e.test.ts src/server/session.create-agent-worktree-autoarchive.e2e.test.ts src/server/agent/providers/opencode-bridge.local.e2e.test.ts src/server/daemon-e2e/relay-transport.e2e.test.ts src/server/agent/agent-mcp.e2e.test.ts src/server/plugins/agent-tools.e2e.test.ts -t \"agent MCP protocol negotiation|merges into|creates a worktree and auto-archives both|versioned runtime|oversized attachments|connected hosts|password-protected daemon refuses|replays selected OMP history|changes the launch wrap|negotiates protected endpoint security\"",
"test:hub-cli-contract": "vitest run --maxWorkers=1 src/server/hub/hub-cli-contract.test.ts",
"test:integration:all": "npm run test:e2e",
"test:integration:real": "vitest run real.e2e.test.ts",
@@ -119,11 +119,11 @@
"@agentclientprotocol/sdk": "0.17.1",
"@anthropic-ai/claude-agent-sdk": "0.3.326",
"@anthropic-ai/sdk": "0.104.2",
"@getpaseo/client": "0.19.2",
"@getpaseo/highlight": "0.19.2",
"@getpaseo/plugin": "0.19.2",
"@getpaseo/protocol": "0.19.2",
"@getpaseo/relay": "0.19.2",
"@getpaseo/client": "0.19.3",
"@getpaseo/highlight": "0.19.3",
"@getpaseo/plugin": "0.19.3",
"@getpaseo/protocol": "0.19.3",
"@getpaseo/relay": "0.19.3",
"@isaacs/ttlcache": "2.1.4",
"@modelcontextprotocol/node": "2.1.2",
"@modelcontextprotocol/sdk": "1.29.0",
@@ -376,6 +376,36 @@ second line'`,
expect(result).toContain("[Compacted]");
});
it("prints one [Compacted] marker per compaction instead of one per status", () => {
// The log from #10046: a loading item when it starts, a completed one when it ends.
const timeline: AgentTimelineItem[] = [
{ type: "user_message", text: "/compact" },
{ type: "compaction", status: "loading" },
{ type: "user_message", text: "Reply exactly: SECOND_AFTER" },
{ type: "compaction", status: "completed", trigger: "manual" },
{ type: "assistant_message", text: "SECOND_AFTER" },
];
const result = curateAgentActivity(timeline);
expect(result.split("\n").filter((line) => line === "[Compacted]")).toHaveLength(1);
expect(result.split("\n")).toEqual([
"[User] /compact",
"[User] Reply exactly: SECOND_AFTER",
"[Compacted]",
"SECOND_AFTER",
]);
});
it("leaves out a compaction that never finished", () => {
const timeline: AgentTimelineItem[] = [
{ type: "user_message", text: "/compact" },
{ type: "compaction", status: "loading" },
];
expect(curateAgentActivity(timeline)).toBe("[User] /compact");
});
it("truncates to maxItems", () => {
const timeline: AgentTimelineItem[] = [
{ type: "user_message", text: "Message 1" },
@@ -192,7 +192,8 @@ export function curateProjectedActivityEntries(
entries.push(activityEntry(`[Error] ${item.message}`));
break;
case "compaction":
entries.push(activityEntry("[Compacted]"));
// A compaction opens a marker when it starts and closes it when it ends.
if (item.status === "completed") entries.push(activityEntry("[Compacted]"));
break;
case "provider_switch":
entries.push(
@@ -112,10 +112,9 @@ async function startOfflineDaemon(logger = pino({ level: "silent" })): Promise<O
await rm(paseoHome, { recursive: true, force: true });
await rm(staticDir, { recursive: true, force: true });
};
const port = await getAvailablePort();
const daemon = await createPaseoDaemon(
{
listen: `127.0.0.1:${port}`,
listen: "127.0.0.1:0",
paseoHome,
corsAllowedOrigins: [],
hostnames: true,
@@ -136,11 +135,15 @@ async function startOfflineDaemon(logger = pino({ level: "silent" })): Promise<O
};
try {
await daemon.start();
const target = daemon.getListenTarget();
if (target?.type !== "tcp") {
throw new Error("Offline MCP daemon did not expose a TCP listen target");
}
return { mcpUrl: `http://${target.host}:${target.port}/mcp/agents`, stop };
} catch (error) {
await stop();
throw error;
}
return { mcpUrl: `http://127.0.0.1:${port}/mcp/agents`, stop };
}
interface OfflineMcpDaemon {
@@ -1760,6 +1760,47 @@ describe("PluginAgentClientRegistry", () => {
},
);
test("publishes reopened child sessions in replay order", async () => {
const harness = createProviderHarness({
openChildren(parentSessionId, emit) {
for (const title of ["First child run", "Latest child run"]) {
emit({
type: "session.opened",
sessionId: "reused-child",
parentSessionId,
capabilities: [],
restoration: "parent",
cwd: "/workspace",
title,
});
emit({ type: "session.closed", sessionId: "reused-child" });
}
},
});
const registry = new PluginAgentClientRegistry(createTestLogger());
registry.replace([harness.registration]);
try {
const session = await registry.clients()[harness.registration.id]!.createSession({
provider: harness.registration.id,
cwd: "/workspace",
});
const titles: string[] = [];
for await (const event of session.streamHistory()) {
if (
event.type === "provider_subagent" &&
event.event.type === "upsert" &&
event.event.id === "reused-child" &&
event.event.title
) {
titles.push(event.event.title);
}
}
expect(titles.at(-1)).toBe("Latest child run");
} finally {
await registry.shutdown();
}
});
test("preserves nested provider child ownership during opening", async () => {
const harness = createProviderHarness({ openChildren: openNestedChildren });
const registry = new PluginAgentClientRegistry(createTestLogger());
@@ -1448,12 +1448,15 @@ class PluginAgentClient implements AgentClient {
let attached = true;
while (attached) {
attached = false;
for (let index = this.pendingChildren.length - 1; index >= 0; index -= 1) {
for (let index = 0; index < this.pendingChildren.length; ) {
const pending = this.pendingChildren[index];
const root = pending.opened.parentSessionId
? this.rootsBySession.get(pending.opened.parentSessionId)
: undefined;
if (!root) continue;
if (!root) {
index += 1;
continue;
}
this.pendingChildren.splice(index, 1);
root.attachChild(pending.session, pending.opened);
this.rootsBySession.set(pending.session.id, root);
@@ -1822,6 +1822,8 @@ export class ACPAgentClient implements AgentClient {
async requestPermission(): Promise<RequestPermissionResponse> {
return { outcome: { outcome: "cancelled" } };
},
// Catalog and diagnostic probes do not consume vendor extension notifications.
async extNotification() {},
async sessionUpdate(params): Promise<void> {
await onSessionUpdate?.(params);
},
@@ -3,7 +3,7 @@ import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { describe, expect, test } from "vitest";
import { describe, expect, test, vi } from "vitest";
import { createTestLogger } from "../../../test-utils/test-logger.js";
import { runProviderRefreshWithDeadline } from "../provider-refresh-deadline.js";
@@ -226,6 +226,24 @@ describe("GenericACPAgentClient diagnostics", () => {
});
});
test("accepts unhandled vendor notifications during catalog discovery", async () => {
await withFakeACPAgent("vendor-notification", async (scriptPath, mode, cwd) => {
const client = new GenericACPAgentClient({
logger: createTestLogger(),
command: [process.execPath, scriptPath, mode],
});
const errors = vi.spyOn(console, "error");
try {
await client.fetchCatalog({ scope: "workspace", cwd, force: true });
expect(errors.mock.calls.flat().map(String).join(" ")).not.toContain(
"Error handling notification",
);
} finally {
errors.mockRestore();
}
});
});
test("terminates an ACP catalog probe when session/new times out", async () => {
await withFakeACPAgent("hang-session", async (scriptPath, mode, testDir) => {
const pidPath = path.join(testDir, "agent.pid");
@@ -333,6 +351,7 @@ describe("GenericACPAgentClient diagnostics", () => {
async function withFakeACPAgent(
mode:
| "vendor-notification"
| "success"
| "hang-session"
| "history-list"
@@ -405,6 +424,9 @@ function sendError(id, code, message) {
rl.on("line", (line) => {
const message = JSON.parse(line);
if (message.method === "initialize") {
if (mode === "vendor-notification") {
process.stdout.write(JSON.stringify({ jsonrpc: "2.0", method: "_auth/status_update", params: {} }) + "\\n");
}
if (initializeTracePath) {
fs.appendFileSync(
initializeTracePath,
@@ -9,6 +9,8 @@ import { OmpAgentClient } from "./agent.js";
import { FakeOmp } from "./test-utils/fake-omp.js";
test("archived OMP history replays messages and todos without leaving a runtime", async () => {
// The todo snapshot comes last; it must carry the session's time, not the time of this
// replay, or the last turn's footer reads "Worked for <days>" ending now.
const directory = await mkdtemp(join(tmpdir(), "paseo-omp-history-purpose-"));
const sessionFile = join(directory, "session.jsonl");
const entries = [
@@ -17,12 +19,14 @@ test("archived OMP history replays messages and todos without leaving a runtime"
type: "message",
id: "user-1",
parentId: "root",
timestamp: "2026-11-07T11:30:00.000Z",
message: { role: "user", content: "make a plan" },
},
{
type: "message",
id: "todo-1",
parentId: "user-1",
timestamp: "2026-11-07T11:31:00.000Z",
message: {
role: "toolResult",
toolName: "todo",
@@ -33,6 +37,13 @@ test("archived OMP history replays messages and todos without leaving a runtime"
},
},
},
{
type: "message",
id: "answer-1",
parentId: "todo-1",
timestamp: "2026-11-07T11:32:16.000Z",
message: { role: "assistant", content: [{ type: "text", text: "Plan ready." }] },
},
];
await writeFile(sessionFile, entries.map((entry) => JSON.stringify(entry)).join("\n"));
const runtime = new FakeOmp();
@@ -60,5 +71,6 @@ test("archived OMP history replays messages and todos without leaving a runtime"
type: "todo",
items: [{ text: "Check history", status: "pending", completed: false }],
},
timestamp: "2026-11-07T11:32:16.000Z",
});
});
@@ -121,7 +121,7 @@ import {
type OmpTrackedToolCall,
} from "./tool-call-detail.js";
import { mapOmpAvailableCommandsUpdate, mapOmpRuntimeSlashCommands } from "./commands.js";
import { readOmpHistoryTodoState, streamOmpHistory } from "./history.js";
import { readOmpHistoryTodoState, streamOmpHistoryWithTodos } from "./history.js";
import { mapOmpTodoReminderEvent, mapOmpTodoState, mapOmpTodoToolResult } from "./todo-mapper.js";
import { mapOmpRuntimeEventToTimelineItem } from "./event-mapper.js";
import { mapOmpAdvisorMessageToToolCall } from "./advisor-message.js";
@@ -683,14 +683,16 @@ class OmpHistorySession implements AgentSession {
}
async *streamHistory(): AsyncGenerator<AgentStreamEvent> {
yield* streamOmpHistory({
yield* streamOmpHistoryWithTodos({
sessionFile: this.sessionFile,
provider: this.provider,
bridgedTools: this.bridgedTools,
blobDirectory: this.blobDirectory,
readTodos: async () => {
const todo = await readOmpHistoryTodoState(this.sessionFile);
return todo ? [todo] : [];
},
});
const todo = await readOmpHistoryTodoState(this.sessionFile);
if (todo) yield { type: "timeline", provider: this.provider, item: todo };
}
async getRuntimeInfo(): Promise<AgentRuntimeInfo> {
@@ -1103,7 +1105,7 @@ export class OmpAgentSession implements AgentSession {
}
async *streamHistory(): AsyncGenerator<AgentStreamEvent> {
const replay = yield* streamOmpHistory({
const replay = yield* streamOmpHistoryWithTodos({
sessionFile: this.state.sessionFile,
runtimeSession: this.runtimeSession,
provider: this.provider,
@@ -1113,6 +1115,7 @@ export class OmpAgentSession implements AgentSession {
cwd: this.config.cwd,
commandProfile: this.commandProfile,
}),
readTodos: () => mapOmpTodoState(this.state),
});
this.lastReply ??= replay.lastReply;
const stats = await this.runtimeSession.getSessionStats().catch((error: unknown) => {
@@ -1126,13 +1129,6 @@ export class OmpAgentSession implements AgentSession {
metrics: ompSessionMetrics(stats, this.lastReply),
};
}
for (const item of mapOmpTodoState(this.state)) {
yield {
type: "timeline",
provider: this.provider,
item,
};
}
}
async getRuntimeInfo(): Promise<AgentRuntimeInfo> {
@@ -77,17 +77,22 @@ function buildOmpModelId(provider: unknown, model: unknown): string | null {
/** What a replay learned that the live session reports from later. */
export interface OmpHistoryReplay {
lastReply: MeasuredStep | null;
lastTimelineTimestamp: string | null;
}
export async function* streamOmpHistory(input: {
interface OmpHistoryStreamInput {
sessionFile?: string;
runtimeSession?: OmpRuntimeSession;
provider: AgentProvider;
bridgedTools?: ReadonlyMap<string, OmpBridgedToolIdentity>;
visitedSessionFiles?: Set<string>;
blobDirectory?: string;
}): AsyncGenerator<AgentStreamEvent, OmpHistoryReplay> {
const replay: OmpHistoryReplay = { lastReply: null };
}
export async function* streamOmpHistory(
input: OmpHistoryStreamInput,
): AsyncGenerator<AgentStreamEvent, OmpHistoryReplay> {
const replay: OmpHistoryReplay = { lastReply: null, lastTimelineTimestamp: null };
if (!input.sessionFile) {
return replay;
}
@@ -148,7 +153,12 @@ export async function* streamOmpHistory(input: {
...(await mapper.mapMessages([replayEntry.message])),
];
for (const event of events) {
yield timestamp && event.type === "timeline" ? { ...event, timestamp } : event;
if (timestamp && event.type === "timeline") {
replay.lastTimelineTimestamp = timestamp;
yield { ...event, timestamp };
} else {
yield event;
}
}
}
yield* turnCompleted(turns.end());
@@ -164,6 +174,29 @@ export async function* streamOmpHistory(input: {
return replay;
}
/**
* Replays the session, then the current todo snapshot. The snapshot has no session entry of
* its own, so it takes the last replayed timestamp: unstamped, the daemon records it at
* hydration time, and the last turn's footer then reads "now" and a duration spanning every
* day since the turn really ended.
*/
export async function* streamOmpHistoryWithTodos(
input: OmpHistoryStreamInput & {
readTodos: () => Promise<readonly AgentTimelineItem[]> | readonly AgentTimelineItem[];
},
): AsyncGenerator<AgentStreamEvent, OmpHistoryReplay> {
const replay = yield* streamOmpHistory(input);
for (const item of await input.readTodos()) {
yield {
type: "timeline",
provider: input.provider,
item,
...(replay.lastTimelineTimestamp ? { timestamp: replay.lastTimelineTimestamp } : {}),
};
}
return replay;
}
async function* replaySubagentTranscript(
transcript: OmpSubagentTranscript,
provider: AgentProvider,
@@ -212,6 +212,61 @@ test("classifies a removed file as deleted", async () => {
await subscription.unsubscribe();
});
// inotify names a watched directory's own deletion after the directory, which
// reads like a child of the same name.
test.skipIf(process.platform !== "linux")(
"reports a removed directory tree at its own paths only",
async () => {
const root = await createRoot();
const removed = join(root, "removed");
const nested = join(removed, "nested");
await mkdir(nested, { recursive: true });
const observer = createObserver();
const events: FileChange[] = [];
const subscription = await observer.subscribe(root, (error, batch) => {
expect(error).toBeNull();
events.push(...batch);
});
await rm(removed, { recursive: true });
await expect
.poll(() => events.map((event) => event.path))
.toEqual(expect.arrayContaining([removed, nested]));
await expect
.poll(() => observer.getDiagnostics(), { timeout: 10_000 })
.toMatchObject({
pendingEventCount: 0,
pendingReconciliationWorkCount: 0,
reconciliationInFlightCount: 0,
});
expect(new Set(events.map((event) => `${event.type} ${event.path}`))).toEqual(
new Set([`delete ${removed}`, `delete ${nested}`]),
);
await subscription.unsubscribe();
},
);
test.skipIf(process.platform !== "linux")(
"reports a file named like its directory when it is created and removed",
async () => {
const root = await createRoot();
const directory = join(root, "same");
const target = join(directory, "same");
await mkdir(directory);
const events: FileChange[] = [];
const subscription = await subscribeToFileChanges(root, (error, batch) => {
expect(error).toBeNull();
events.push(...batch);
});
await writeFile(target, "created");
await expect.poll(() => events.find((event) => event.path === target)?.type).toBe("create");
await rm(target);
await expect.poll(() => events.findLast((event) => event.path === target)?.type).toBe("delete");
await subscription.unsubscribe();
},
);
test("observes files moved into the tree with their directory", async () => {
const root = await createRoot();
const outside = await createRoot();
@@ -1,6 +1,6 @@
import { type Dirent, type FSWatcher, watch } from "node:fs";
import { readdir, stat } from "node:fs/promises";
import { resolve } from "node:path";
import { basename, resolve } from "node:path";
import type { BackendDiagnostics, ObservationBackend, ObservationHost } from "./contracts.js";
import type { ObserverPaths } from "./paths.js";
import { isMissingPathError, toError } from "./paths.js";
@@ -31,6 +31,12 @@ const MAX_DIRECTORY_RESCANS = 3;
// observed, so files found before their directory was covered are creates.
type ReconcileMode = "baseline" | "changes";
interface Classification {
path: string;
// The watched directory whose watcher reported `path`.
directory: string;
}
interface DirectoryIdentity {
dev: bigint;
ino: bigint;
@@ -70,7 +76,7 @@ export function createLinuxBackend(
class LinuxBackend implements ObservationBackend {
private readonly watchers = new Map<string, WatchedDirectory>();
private readonly classifications = new Set<Promise<void>>();
private readonly classificationQueue: Array<{ path: string }> = [];
private readonly classificationQueue: Classification[] = [];
private readonly pendingScopes = new Set<string>();
private reconcileTail: Promise<void> = Promise.resolve();
private queueDepth = 0;
@@ -159,7 +165,7 @@ class LinuxBackend implements ObservationBackend {
const path = filename ? resolve(directory, filename.toString()) : directory;
if (!this.host.isIgnored(path)) {
if (eventType === "change") this.host.queueEvent("update", path);
else this.classify(path);
else this.classify({ path, directory });
}
if (eventType === "rename" || !filename) this.requestReconcile(path);
});
@@ -466,7 +472,7 @@ class LinuxBackend implements ObservationBackend {
return "ok";
}
private classify(path: string): void {
private classify(classification: Classification): void {
if (this.classificationQueue.length >= MAX_QUEUED_CLASSIFICATIONS) {
// This backend has no file-level inventory and no full-tree safety
// audit to fall back on (see the comment on MAX_QUEUED_CLASSIFICATIONS
@@ -480,7 +486,7 @@ class LinuxBackend implements ObservationBackend {
);
return;
}
this.classificationQueue.push({ path });
this.classificationQueue.push(classification);
this.pumpClassifications();
}
@@ -501,22 +507,15 @@ class LinuxBackend implements ObservationBackend {
) {
const next = this.classificationQueue.shift();
if (!next) return;
this.startClassification(next.path);
this.startClassification(next);
}
}
private startClassification(path: string): void {
private startClassification(pending: Classification): void {
this.host.metrics.nativeClassificationCount += 1;
let classification!: Promise<void>;
classification = stat(path)
.then(() => this.host.queueEvent("create", path))
.catch((error: unknown) => {
if (isMissingPathError(error)) {
this.host.queueEvent("delete", path);
return;
}
this.host.fail(toError(error));
})
classification = this.classifyPath(pending)
.catch((error: unknown) => this.host.fail(toError(error)))
.finally(() => {
this.classifications.delete(classification);
if (this.host.isActive()) this.pumpClassifications();
@@ -524,6 +523,32 @@ class LinuxBackend implements ObservationBackend {
this.classifications.add(classification);
}
private async classifyPath({ path, directory }: Classification): Promise<void> {
try {
await stat(path);
} catch (error) {
if (!isMissingPathError(error)) throw error;
if (!(await this.isOwnDeletion({ path, directory }))) this.host.queueEvent("delete", path);
return;
}
this.host.queueEvent("create", path);
}
// inotify names a watched directory's own deletion after the directory, so
// `<directory>/<basename(directory)>` is either a child of that name or the
// directory itself. Once the directory is gone, its parent's watcher and the
// reconciliation report it, and that delete covers a same-named child too.
private async isOwnDeletion({ path, directory }: Classification): Promise<boolean> {
if (path !== resolve(directory, basename(directory))) return false;
try {
await stat(directory);
return false;
} catch (error) {
if (isMissingPathError(error)) return true;
throw error;
}
}
private cancelQueued(): void {
if (this.timer) clearTimeout(this.timer);
this.timer = null;
@@ -1,6 +1,7 @@
import { mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import pino from "pino";
import { WebSocket } from "ws";
import {
DaemonClient,
@@ -64,6 +65,11 @@ const nestedOutput = defineRpc({
input: z.object({}),
output: z.object({ data: z.instanceof(Uint8Array) }),
});
const delayed = defineRpc({
name: "delayed",
input: z.number(),
output: z.number(),
});
const reverse = defineRpc({
name: "reverse",
input: z.instanceof(Uint8Array),
@@ -97,7 +103,14 @@ export default function contribute(server: PluginServerContext) {
server.handle(watchers, () => ({ starts, active }));
server.handle(thumbnail, ({ size }) => Buffer.alloc(size, 7));
server.handle(nestedOutput, () => ({ data: new Uint8Array(1) }));
server.handle(reverse, (bytes) => Uint8Array.from(bytes).reverse());
server.handle(delayed, async (delay) => {
await new Promise((resolve) => setTimeout(resolve, delay));
return delay;
});
server.handle(reverse, async (bytes) => {
await new Promise((resolve) => setTimeout(resolve, 750));
return Uint8Array.from(bytes).reverse();
});
return () => undefined;
}
`;
@@ -131,9 +144,9 @@ async function writePlugin(id: string, serverEntry: string): Promise<string> {
return pluginDirectory;
}
async function startHarness(): Promise<Harness> {
async function startHarness(logger?: pino.Logger): Promise<Harness> {
const pluginDirectory = await writePlugin(PLUGIN_ID, SERVER_ENTRY);
const daemon = await createTestPaseoDaemon({ mcpEnabled: false });
const daemon = await createTestPaseoDaemon({ mcpEnabled: false, logger });
const sockets: WebSocket[] = [];
const client = new DaemonClient({
url: `ws://127.0.0.1:${daemon.port}/ws`,
@@ -309,6 +322,45 @@ test("reloading the plugin closes its subscriptions with an error", async () =>
}
}, 60_000);
test("slow plugin RPC warnings name the plugin and method for JSON and binary calls", async () => {
const warnings: unknown[] = [];
const logger = pino(
{ level: "warn" },
{
write(line: string) {
const entry = JSON.parse(line);
if (entry.msg === "ws_slow_request" && entry.requestType === "plugin.rpc.invoke.request") {
warnings.push(entry);
}
},
},
);
const harness = await startHarness(logger);
try {
expect(await harness.client.invokePluginRpc(PLUGIN_ID, "delayed", 750)).toBe(750);
expect(
await harness.client.invokePluginRpc(PLUGIN_ID, "reverse", Uint8Array.of(1, 2, 3)),
).toEqual(Uint8Array.of(3, 2, 1));
expect(warnings).toEqual([
expect.objectContaining({ pluginId: PLUGIN_ID, method: "delayed" }),
expect.objectContaining({ pluginId: PLUGIN_ID, method: "reverse" }),
]);
} finally {
await harness.close();
}
}, 60_000);
test("plugin RPC timeout errors name the plugin and method", async () => {
const harness = await startHarness();
try {
await expect(harness.client.invokePluginRpc(PLUGIN_ID, "delayed", 35_000)).rejects.toThrow(
"Plugin RPC timed out: subscriptions.delayed",
);
} finally {
await harness.close();
}
}, 60_000);
test("RPC bytes ride as binary frames in both directions and nested bytes fail validation", async () => {
const harness = await startHarness();
const { client } = harness;
@@ -1133,7 +1133,11 @@ export class PluginRuntime {
);
if (message.type === "tunnel.status")
void send(child, { type: "tunnel.status.cancel", requestId }).catch(() => {});
reject(new Error(`Plugin RPC timed out: ${pluginId}.${message.type}`));
const operation =
message.type === "invoke" || message.type === "subscribe"
? message.method
: message.type;
reject(new Error(`Plugin RPC timed out: ${pluginId}.${operation}`));
}, timeoutMs);
signal?.addEventListener("abort", cancel, { once: true });
loaded.pending.set(requestId, {
+5 -19
View File
@@ -83,11 +83,10 @@ import type {
import type { TerminalSession } from "../terminal/terminal.js";
import { TerminalSessionController } from "../terminal/terminal-session-controller.js";
import type { TerminalActivity } from "@getpaseo/protocol/terminal-activity";
import type { BinaryFrame } from "@getpaseo/protocol/binary-frames/index";
import {
type BinaryFrame,
encodePluginEventFrame,
encodePluginOutputFrame,
PluginFrameOpcode,
} from "@getpaseo/protocol/binary-frames/index";
import { CursorError } from "./pagination/cursor.js";
import { SortablePager, type SortSpec } from "./pagination/sortable-pager.js";
@@ -3971,27 +3970,14 @@ export class Session {
return this.sessionId;
}
public async handleBinaryFrame(binaryFrame: BinaryFrame, source: object): Promise<void> {
public async handleBinaryFrame(
binaryFrame: Exclude<BinaryFrame, { kind: "plugin" }>,
source: object,
): Promise<void> {
if (binaryFrame.kind === "host_route") {
this.connectedHostSession?.binary(binaryFrame.frame, source);
return;
}
if (binaryFrame.kind === "plugin") {
const frame = binaryFrame.frame;
// The binary form of plugin.rpc.invoke.request; it authorizes and replies like the JSON form.
if (frame.opcode !== PluginFrameOpcode.Input) return;
await this.handleMessage(
{
type: "plugin.rpc.invoke.request",
requestId: frame.requestId,
pluginId: frame.pluginId,
method: frame.method,
input: frame.payload,
},
source,
);
return;
}
if (!this.authorization.allowsPermission("workspace.write")) {
return;
}
+45 -12
View File
@@ -20,7 +20,6 @@ import {
import { runQueuedProviderSwitch } from "./agent/provider-switch-turn.js";
import { loadAgentHistory } from "./agent/agent-loading.js";
import { createToolHosts } from "./agent/host-operations/index.js";
import { HOST_ROUTE_OPCODE } from "@getpaseo/protocol/binary-frames/index";
import { DaemonLinkEndpoint, VirtualHostSocket } from "./connected-hosts/index.js";
import { ConnectedHosts } from "./connected-hosts/index.js";
import {
@@ -82,7 +81,12 @@ import {
wrapSessionMessage,
} from "./messages.js";
import { NetworkTunnelService } from "./network-tunnel/index.js";
import { asUint8Array, decodeBinaryFrame } from "@getpaseo/protocol/binary-frames/index";
import {
asUint8Array,
decodeBinaryFrame,
HOST_ROUTE_OPCODE,
PluginFrameOpcode,
} from "@getpaseo/protocol/binary-frames/index";
import type { TerminalActivity } from "@getpaseo/protocol/terminal-activity";
import { MAX_WEBSOCKET_MESSAGE_BYTES } from "@getpaseo/protocol/websocket-message-limit";
import {
@@ -3210,16 +3214,31 @@ export class VoiceAssistantWebSocketServer {
}
return true;
}
void Promise.resolve(activeConnection.session.handleBinaryFrame(decodedFrame, ws)).catch(
(error: unknown) => {
this.handleRawMessageError({
ws,
data: buffer,
error,
log: activeConnection.connectionLogger,
});
},
);
let handling: Promise<void>;
if (decodedFrame.kind === "plugin") {
const { frame } = decodedFrame;
if (frame.opcode !== PluginFrameOpcode.Input) return true;
handling = this.dispatchSessionMessage(ws, activeConnection, {
type: "session",
message: {
type: "plugin.rpc.invoke.request",
requestId: frame.requestId,
pluginId: frame.pluginId,
method: frame.method,
input: frame.payload,
},
});
} else {
handling = activeConnection.session.handleBinaryFrame(decodedFrame, ws);
}
void Promise.resolve(handling).catch((error: unknown) => {
this.handleRawMessageError({
ws,
data: buffer,
error,
log: activeConnection.connectionLogger,
});
});
return true;
}
@@ -3504,6 +3523,7 @@ export class VoiceAssistantWebSocketServer {
activeConnection.connectionLogger.warn(
{
requestType: message.message.type,
...getPluginRpcLogFields(message.message),
durationMs: Math.round(durationMs),
inflightRequests: activeConnection.session.getRuntimeMetrics().inflightRequests,
},
@@ -4268,6 +4288,19 @@ function stringifyCloseReason(reason: unknown): string | null {
return text.length > 0 ? text : null;
}
/** Every plugin RPC shares one request type; name the plugin and method so a slow one can be found. */
function getPluginRpcLogFields(
message: Extract<WSInboundMessage, { type: "session" }>["message"],
): { pluginId: string; method: string } | null {
if (
message.type === "plugin.rpc.invoke.request" ||
message.type === "plugin.rpc.subscribe.request"
) {
return { pluginId: message.pluginId, method: message.method };
}
return null;
}
function getControlRpcLogInfo(
message: Extract<WSInboundMessage, { type: "session" }>["message"],
): { requestType: string; requestId: string; reason?: string } | null {
@@ -77,6 +77,9 @@ function recordNaming(runtime: string | null, pid = 4242): TerminalWorkerRecord
};
}
// Inside the 3 s delete retry window, and well past one delete attempt on a small copy.
const DELETABLE_AGAIN_AFTER_MS = 300;
describe("terminal worker runtime copy", () => {
it("copies the bundle, its shell integration and this platform's node-pty into the home", () => {
const home = makeDir("tw-runtime-home-");
@@ -192,6 +195,35 @@ describe("terminal worker runtime copy", () => {
expect((await pruneTerminalWorkerRuntimes(home)).removed).toEqual([]);
expect(existsSync(copy.scriptPath)).toBe(true);
});
// On Linux and macOS, EACCES on a copy means the daemon user cannot delete it (a copy left by a
// daemon that ran under sudo, say), so the delete fails at once. This copy turns deletable again
// after a moment: a delete that waited for it would remove it. chmod cannot stop root from
// deleting, and Windows has no read-only directories.
it.skipIf(isPlatform("win32") || process.getuid?.() === 0)(
"fails at once on a copy the daemon cannot delete",
async () => {
const home = makeDir("tw-runtime-home-");
const copy = prepareTerminalWorkerRuntime({
paseoHome: home,
paseoVersion: "1.0.0",
...makeSources(),
});
const directory = path.dirname(copy.scriptPath);
chmodSync(directory, 0o555);
const restore = setTimeout(() => chmodSync(directory, 0o755), DELETABLE_AGAIN_AFTER_MS);
try {
const result = await pruneTerminalWorkerRuntimes(home);
expect(result.removed).toEqual([]);
expect(result.failed.map((entry) => entry.directory)).toEqual([directory]);
expect(result.failed[0]?.error).toMatch(/EACCES/);
} finally {
clearTimeout(restore);
if (existsSync(directory)) chmodSync(directory, 0o755);
}
},
);
});
describe("terminal worker bundle", () => {
@@ -194,11 +194,14 @@ export function prepareTerminalWorkerRuntime(input: {
return entry;
}
// Windows keeps a just-exited worker's files open for a moment, so a delete that fails with one
// of these codes is retried for a short window. Each attempt is a single rm: rm's own maxRetries
// repeats at every directory level, so a file that stays locked deep in node-pty would hold
// daemon start and stop far past any window.
const TRANSIENT_REMOVE_ERRORS = new Set(["EPERM", "EBUSY", "EACCES", "ENOTEMPTY"]);
// Windows keeps a just-exited worker's files open for a moment, so there a delete that fails with
// one of these codes is retried for a short window. On Linux and macOS the same codes mean the
// daemon user cannot delete the copy, which never clears, so the delete fails at once. Each attempt
// is a single rm: rm's own maxRetries repeats at every directory level, so a file that stays locked
// deep in node-pty would hold daemon start and stop far past any window.
const TRANSIENT_REMOVE_ERRORS = new Set<string>(
process.platform === "win32" ? ["EPERM", "EBUSY", "EACCES", "ENOTEMPTY"] : [],
);
const TRANSIENT_REMOVE_WINDOW_MS = 3_000;
const TRANSIENT_REMOVE_PAUSE_MS = 100;
@@ -218,7 +221,10 @@ async function removeCopy(directory: string): Promise<void> {
export interface PruneTerminalWorkerRuntimesResult {
removed: string[];
/** Copies that could not be deleted (a worker that just exited can still hold files on Windows). */
/**
* Copies that could not be deleted: a worker that just exited can still hold files on Windows, or
* the daemon user cannot delete them.
*/
failed: Array<{ directory: string; error: string }>;
}
@@ -1,5 +1,6 @@
import { execFileSync } from "node:child_process";
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
import { mkdtempSync, mkdirSync, writeFileSync } from "node:fs";
import { rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { createServer, type Socket } from "node:net";
@@ -26,7 +27,9 @@ describe("worktree base refs", () => {
git(repo, "add", "file");
git(repo, "-c", "commit.gpgsign=false", "commit", "-m", "initial");
});
afterEach(() => rmSync(dir, { recursive: true, force: true }));
afterEach(async () => {
await rm(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
});
it("uses local refs without a remote and rejects invalid inputs", async () => {
expect(await resolveRepositoryDefaultBaseRef(repo)).toBe("refs/heads/main");
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/website",
"version": "0.19.2",
"version": "0.19.3",
"private": true,
"type": "module",
"scripts": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/builtin-plugins",
"version": "0.19.2",
"version": "0.19.3",
"private": true,
"type": "module",
"scripts": {