Compare commits

...
Author SHA1 Message Date
paseo-bot[bot]andjsilhan cf1fed7b67 fix(pi): wait for runs started by extension commands
Pi acknowledges extension input and slash commands as handled. Check runtime state before completing a handled prompt so a command that launches a model still waits for its reply.

Co-authored-by: jsilhan <jan.silhan@bighub.cz>
2026-11-23 04:45:33 +00:00
jsilhanandCopilot 7317ee1c7f fix(pi): complete turns for prompts pi reports as handled
pi reports a prompt's fate in the RPC response as data.disposition.
"handled" means an extension consumed the prompt and no run starts, so
no agent_settled follows. The connector only read agentInvoked (the Oh My
Pi field) and waited forever. Map disposition to agentInvoked.

Fixes #10548

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-22 21:40:55 +00:00
112c4b78e1 Reopen OpenCode sessions after tool definitions change (#10533)
* fix(opencode): replace stale bridge tool definitions instead of failing the bind

The shared bridge plugin keeps tool definitions in an in-memory cache
(state.mjs) that survives OpenCode's plugin reloads. When the Paseo daemon
upgrades and ships a changed tool definition (e.g. the description or input
schema changes), the next bind finds a signature mismatch and throws
"Conflicting Paseo tool definition", leaving every existing session in that
location unable to rebind. This is the upgrade path: the bridge changed, not
a second live bridge.

Treat a changed definition as a refresh, not a conflict: dispose the stale
registration and re-register the new one. Track the whole installed manifest
per location and reconcile on each bind so removed tools also disappear,
instead of letting the first per-tool difference fail the bind.

Add tests covering a definition upgrade (bind succeeds, tool reflects the
new schema) and a manifest drift (a removed tool leaves the registry).

* fix(opencode): resume sessions after bridge tool definitions change

A retired bridge can leave tool definitions cached in a shared OpenCode location. Replace a conflicting definition once the bound sessions confirm that it is unused. Preserve tools that other live sessions still use.

Co-authored-by: Peanut-HZM <34237301+Peanut-HZM@users.noreply.github.com>

* test(server): wait for the worktree manager ready marker

The marker confirms that the plugin entered the create hook. Give the hook the same deadline as the other worktree fixture handshakes, and observe the pending request if teardown closes the client.

---------

Co-authored-by: huazhongmin <peanut_hzm@163.com>
Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Peanut-HZM <34237301+Peanut-HZM@users.noreply.github.com>
2026-11-22 19:49:03 +00:00
Mohamed Boudra 8d287e5f56 chore(release): reconcile v0.17.3 (#10535) 2026-11-23 00:50:37 +07:00
28 changed files with 406 additions and 101 deletions
+8
View File
@@ -1,5 +1,13 @@
# Changelog
## 0.17.3 - 2026-11-22
### Fixed
- Fixed iPhone sheets such as Workspace tabs ignoring body swipes to expand, scroll, or collapse ([#10525](https://github.com/getpaseo/paseo/pull/10525))
- Fixed Antigravity applying the default model's thinking levels to every model, which blocked Orchestrator chats from opening ([#10524](https://github.com/getpaseo/paseo/pull/10524))
- Fixed `/` and `@` pickers disappearing until reload after returning to a workspace through window history ([#8954](https://github.com/getpaseo/paseo/pull/8954) by [@viking1201](https://github.com/viking1201))
## 0.17.2 - 2026-11-22
- **Turn and session stats:** View per-turn and session timing, token, cache, and cost metrics for Claude, OpenCode v2, Pi, Oh My Pi, and plugin providers. ([#10496](https://github.com/getpaseo/paseo/pull/10496), [#10510](https://github.com/getpaseo/paseo/pull/10510))
+8
View File
@@ -1,5 +1,13 @@
# Changelog
## 0.17.3 - 2026-11-22
### 修复
- 修复 iPhone 上“Workspace 标签”等弹窗忽略主体滑动、无法展开、滚动或收起的问题 ([#10525](https://github.com/getpaseo/paseo/pull/10525))
- 修复 Antigravity 将默认模型的思考级别套用到所有模型,导致无法打开 Orchestrator 对话的问题 ([#10524](https://github.com/getpaseo/paseo/pull/10524))
- 修复通过窗口历史记录返回工作区后,`/` 和 `@` 选择器在刷新前一直消失的问题 ([#8954](https://github.com/getpaseo/paseo/pull/8954),贡献者:[@viking1201](https://github.com/viking1201))
## 0.17.2 - 2026-11-22
- **回合和会话统计**:查看 Claude、OpenCode v2、Pi、Oh My Pi 和插件 Provider 的单轮及会话耗时、token、缓存和费用指标。([#10496](https://github.com/getpaseo/paseo/pull/10496), [#10510](https://github.com/getpaseo/paseo/pull/10510))
@@ -0,0 +1,6 @@
Fixed
- Fixed iPhone sheets such as Workspace tabs ignoring body swipes to expand, scroll, or collapse
- Fixed Antigravity applying the default model's thinking levels to every model, which blocked Orchestrator chats from opening
- Fixed / and @ pickers disappearing until reload after returning to a workspace through window history
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,6 @@
Fixed
- Fixed iPhone sheets such as Workspace tabs ignoring body swipes to expand, scroll, or collapse
- Fixed Antigravity applying the default model's thinking levels to every model, which blocked Orchestrator chats from opening
- Fixed / and @ pickers disappearing until reload after returning to a workspace through window history
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,6 @@
Fixed
- Fixed iPhone sheets such as Workspace tabs ignoring body swipes to expand, scroll, or collapse
- Fixed Antigravity applying the default model's thinking levels to every model, which blocked Orchestrator chats from opening
- Fixed / and @ pickers disappearing until reload after returning to a workspace through window history
Full notes: https://paseo.sh/changelog
@@ -0,0 +1,6 @@
Fixed
- Fixed iPhone sheets such as Workspace tabs ignoring body swipes to expand, scroll, or collapse
- Fixed Antigravity applying the default model's thinking levels to every model, which blocked Orchestrator chats from opening
- Fixed / and @ pickers disappearing until reload after returning to a workspace through window history
Full notes: https://paseo.sh/changelog
+1 -1
View File
@@ -1 +1 @@
sha256-vtzoUMnKaAdBFd/hhnk9p2WwHGgL70RXh26vkkyRIH0=
sha256-f2/UslxzI8mmz0rl9c1bQ0P2H6zbq96u5NEuao5u1fI=
+28 -28
View File
@@ -1,12 +1,12 @@
{
"name": "paseo",
"version": "0.17.2",
"version": "0.17.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "paseo",
"version": "0.17.2",
"version": "0.17.3",
"hasInstallScript": true,
"license": "Apache-2.0",
"workspaces": [
@@ -37477,7 +37477,7 @@
},
"packages/app": {
"name": "@getpaseo/app",
"version": "0.17.2",
"version": "0.17.3",
"dependencies": {
"@codemirror/commands": "6.10.4",
"@codemirror/language": "6.12.4",
@@ -39647,13 +39647,13 @@
},
"packages/cli": {
"name": "@getpaseo/cli",
"version": "0.17.2",
"version": "0.17.3",
"license": "Apache-2.0",
"dependencies": {
"@clack/prompts": "^1.0.0",
"@getpaseo/client": "0.17.2",
"@getpaseo/protocol": "0.17.2",
"@getpaseo/server": "0.17.2",
"@getpaseo/client": "0.17.3",
"@getpaseo/protocol": "0.17.3",
"@getpaseo/server": "0.17.3",
"chalk": "^5.3.0",
"commander": "^12.0.0",
"mime-types": "^2.1.35",
@@ -39900,11 +39900,11 @@
},
"packages/client": {
"name": "@getpaseo/client",
"version": "0.17.2",
"version": "0.17.3",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/protocol": "0.17.2",
"@getpaseo/relay": "0.17.2",
"@getpaseo/protocol": "0.17.3",
"@getpaseo/relay": "0.17.3",
"ws": "^8.20.0",
"zod": "^4.4.3"
},
@@ -39916,7 +39916,7 @@
},
"packages/desktop": {
"name": "@getpaseo/desktop",
"version": "0.17.2",
"version": "0.17.3",
"license": "Apache-2.0",
"dependencies": {
"@getpaseo/cli": "*",
@@ -40159,7 +40159,7 @@
},
"packages/expo-two-way-audio": {
"name": "@getpaseo/expo-two-way-audio",
"version": "0.17.2",
"version": "0.17.3",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.5.14",
@@ -40205,7 +40205,7 @@
},
"packages/highlight": {
"name": "@getpaseo/highlight",
"version": "0.17.2",
"version": "0.17.3",
"license": "Apache-2.0",
"dependencies": {
"@codemirror/language": "6.12.4",
@@ -40235,7 +40235,7 @@
},
"packages/plugin": {
"name": "@getpaseo/plugin",
"version": "0.17.2",
"version": "0.17.3",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "^1.4.0",
@@ -40243,8 +40243,8 @@
"use-sync-external-store": "^1.6.0"
},
"devDependencies": {
"@getpaseo/client": "0.17.2",
"@getpaseo/protocol": "0.17.2",
"@getpaseo/client": "0.17.3",
"@getpaseo/protocol": "0.17.3",
"@types/node": "^20.9.0",
"@types/react": "~19.2.0",
"react": "19.2.3",
@@ -40254,8 +40254,8 @@
"zod": "^4.4.3"
},
"peerDependencies": {
"@getpaseo/client": "0.17.2",
"@getpaseo/protocol": "0.17.2",
"@getpaseo/client": "0.17.3",
"@getpaseo/protocol": "0.17.3",
"react": ">=19.1.0 <20",
"react-native": ">=0.81.5",
"zod": "^4.4.3"
@@ -40277,7 +40277,7 @@
},
"packages/protocol": {
"name": "@getpaseo/protocol",
"version": "0.17.2",
"version": "0.17.3",
"license": "Apache-2.0",
"dependencies": {
"semver": "^7.8.5",
@@ -40305,7 +40305,7 @@
},
"packages/relay": {
"name": "@getpaseo/relay",
"version": "0.17.2",
"version": "0.17.3",
"license": "Apache-2.0",
"dependencies": {
"@noble/ciphers": "^2.4.0",
@@ -40527,17 +40527,17 @@
},
"packages/server": {
"name": "@getpaseo/server",
"version": "0.17.2",
"version": "0.17.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.17.2",
"@getpaseo/highlight": "0.17.2",
"@getpaseo/plugin": "0.17.2",
"@getpaseo/protocol": "0.17.2",
"@getpaseo/relay": "0.17.2",
"@getpaseo/client": "0.17.3",
"@getpaseo/highlight": "0.17.3",
"@getpaseo/plugin": "0.17.3",
"@getpaseo/protocol": "0.17.3",
"@getpaseo/relay": "0.17.3",
"@isaacs/ttlcache": "^2.1.4",
"@modelcontextprotocol/sdk": "1.29.0",
"@opencode-ai/sdk": "1.14.46",
@@ -41484,7 +41484,7 @@
},
"packages/website": {
"name": "@getpaseo/website",
"version": "0.17.2",
"version": "0.17.3",
"dependencies": {
"@cloudflare/vite-plugin": "^1.29.1",
"@cloudflare/workers-types": "^4.20260317.1",
@@ -43095,7 +43095,7 @@
},
"plugins": {
"name": "@getpaseo/builtin-plugins",
"version": "0.17.2",
"version": "0.17.3",
"dependencies": {
"@getpaseo/plugin": "*",
"zod": "^4.4.3"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "paseo",
"version": "0.17.2",
"version": "0.17.3",
"private": true,
"description": "Paseo: voice-controlled development environment for local AI coding agents",
"keywords": [
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/app",
"version": "0.17.2",
"version": "0.17.3",
"private": true,
"main": "index.ts",
"scripts": {
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/cli",
"version": "0.17.2",
"version": "0.17.3",
"description": "Paseo CLI - control your AI coding agents from the command line",
"license": "Apache-2.0",
"bin": {
@@ -29,9 +29,9 @@
},
"dependencies": {
"@clack/prompts": "^1.0.0",
"@getpaseo/client": "0.17.2",
"@getpaseo/protocol": "0.17.2",
"@getpaseo/server": "0.17.2",
"@getpaseo/client": "0.17.3",
"@getpaseo/protocol": "0.17.3",
"@getpaseo/server": "0.17.3",
"chalk": "^5.3.0",
"commander": "^12.0.0",
"mime-types": "^2.1.35",
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/client",
"version": "0.17.2",
"version": "0.17.3",
"description": "Paseo client SDK package",
"license": "Apache-2.0",
"files": [
@@ -49,8 +49,8 @@
"measure:diff-materialization": "tsx scripts/measure-diff-materialization.ts"
},
"dependencies": {
"@getpaseo/protocol": "0.17.2",
"@getpaseo/relay": "0.17.2",
"@getpaseo/protocol": "0.17.3",
"@getpaseo/relay": "0.17.3",
"ws": "^8.20.0",
"zod": "^4.4.3"
},
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/desktop",
"version": "0.17.2",
"version": "0.17.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.17.2",
"version": "0.17.3",
"description": "Native module for two way audio streaming",
"keywords": [
"ExpoTwoWayAudio",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/highlight",
"version": "0.17.2",
"version": "0.17.3",
"license": "Apache-2.0",
"files": [
"dist",
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/plugin",
"version": "0.17.2",
"version": "0.17.3",
"description": "Paseo plugin SDK package",
"license": "Apache-2.0",
"files": [
@@ -78,8 +78,8 @@
"use-sync-external-store": "^1.6.0"
},
"devDependencies": {
"@getpaseo/client": "0.17.2",
"@getpaseo/protocol": "0.17.2",
"@getpaseo/client": "0.17.3",
"@getpaseo/protocol": "0.17.3",
"@types/node": "^20.9.0",
"@types/react": "~19.2.0",
"react": "19.2.3",
@@ -89,8 +89,8 @@
"zod": "^4.4.3"
},
"peerDependencies": {
"@getpaseo/client": "0.17.2",
"@getpaseo/protocol": "0.17.2",
"@getpaseo/client": "0.17.3",
"@getpaseo/protocol": "0.17.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.17.2",
"version": "0.17.3",
"description": "Paseo shared protocol schemas and wire types",
"license": "Apache-2.0",
"files": [
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/relay",
"version": "0.17.2",
"version": "0.17.3",
"description": "Paseo relay for bridging daemon and client connections",
"license": "Apache-2.0",
"files": [
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/server",
"version": "0.17.2",
"version": "0.17.3",
"description": "Paseo backend server",
"license": "Apache-2.0",
"files": [
@@ -109,11 +109,11 @@
"@agentclientprotocol/sdk": "^0.17.1",
"@anthropic-ai/claude-agent-sdk": "0.3.326",
"@anthropic-ai/sdk": "^0.104.2",
"@getpaseo/client": "0.17.2",
"@getpaseo/highlight": "0.17.2",
"@getpaseo/plugin": "0.17.2",
"@getpaseo/protocol": "0.17.2",
"@getpaseo/relay": "0.17.2",
"@getpaseo/client": "0.17.3",
"@getpaseo/highlight": "0.17.3",
"@getpaseo/plugin": "0.17.3",
"@getpaseo/protocol": "0.17.3",
"@getpaseo/relay": "0.17.3",
"@isaacs/ttlcache": "^2.1.4",
"@modelcontextprotocol/sdk": "1.29.0",
"@opencode-ai/sdk": "1.14.46",
@@ -23,8 +23,8 @@ export async function registerSharedBridge(context) {
...(body === undefined ? {} : { body: JSON.stringify(body) }),
});
if (allowMissing && response.status === 404) return null;
const payload = await response.json().catch(() => null);
if (!response.ok) {
const payload = await response.json().catch(() => null);
const detail = formatErrorDetail(payload?.issues ?? payload?.details);
const message = payload?.error ?? `Paseo tool bridge returned HTTP ${response.status}`;
const error = new Error(detail ? `${message}: ${detail}` : message);
@@ -32,7 +32,7 @@ export async function registerSharedBridge(context) {
if (detail) error.details = detail;
throw error;
}
return payload;
return await response.json();
}
async function find(sessionID) {
const seen = new Set();
@@ -44,24 +44,56 @@ export async function registerSharedBridge(context) {
}
return null;
}
async function readBoundContext(sessionID, binding, query = "") {
try {
return await request(
binding,
`/sessions/${encodeURIComponent(sessionID)}/context${query}`,
undefined,
true,
);
} catch (error) {
// A refusal or rejected credentials means this bridge no longer serves the binding.
if (error?.status !== 401 && !isRefused(error)) throw error;
return null;
}
}
async function install(binding) {
const manifest = await request(
binding,
`/tools?sessionID=${encodeURIComponent(binding.sessionID)}`,
);
const conflicts = manifest.tools.filter((tool) => {
const registered = definitions.get(tool.name);
return registered && JSON.stringify(registered) !== JSON.stringify(tool);
});
if (conflicts.length > 0) await retireUnusedDefinitions(conflicts);
for (const definition of manifest.tools) await installDefinition(definition);
}
async function installDefinition(definition) {
const signature = JSON.stringify(definition);
const known = definitions.get(definition.name);
if (known && JSON.stringify(known) !== signature)
throw new Error(`Conflicting Paseo tool definition: ${definition.name}`);
const old = registrations.get(definition.name);
if (old) {
if (old.signature !== signature)
throw new Error(`Conflicting Paseo tool definition: ${definition.name}`);
return;
async function retireUnusedDefinitions(conflicts) {
// A tool name is registered once per location. Another session can still
// use that definition, even when the session being rebound no longer does.
const contexts = await Promise.all(
[...bindings].map(async ([sessionID, binding]) => [
sessionID,
await readBoundContext(sessionID, binding, "?tools"),
]),
);
const inUse = new Set(contexts.flatMap(([, scope]) => (scope ? scope.tools : [])));
for (const { name } of conflicts) {
if (inUse.has(name)) throw new Error(`Conflicting Paseo tool definition: ${name}`);
}
for (const [sessionID, scope] of contexts) {
if (!scope) bindings.delete(sessionID);
}
for (const { name } of conflicts) {
await registrations.get(name)?.dispose();
registrations.delete(name);
definitions.delete(name);
}
}
async function installDefinition(definition) {
if (registrations.has(definition.name)) return;
const registration = await context.tool.transform((editor) => {
editor.add({
name: `paseo_${definition.name}`,
@@ -85,14 +117,12 @@ export async function registerSharedBridge(context) {
},
});
});
registrations.set(definition.name, { signature, registration });
registrations.set(definition.name, registration);
definitions.set(definition.name, definition);
}
async function clearUnusedDefinitions() {
if (bindings.size) return;
await Promise.all(
[...registrations.values()].map(({ registration }) => registration.dispose()),
);
await Promise.all([...registrations.values()].map((registration) => registration.dispose()));
registrations.clear();
definitions.clear();
}
@@ -126,19 +156,7 @@ export async function registerSharedBridge(context) {
previous &&
(previous.baseUrl !== input.baseUrl || previous.token !== input.token)
) {
let active;
try {
active = await request(
previous,
`/sessions/${encodeURIComponent(input.sessionID)}/context`,
undefined,
true,
);
} catch (error) {
// Refusal or rejected credentials mean this endpoint no longer
// serves the previous binding. Other failures are inconclusive.
if (error?.status !== 401 && !isRefused(error)) throw error;
}
const active = await readBoundContext(input.sessionID, previous);
if (active)
return { error: "OpenCode session is already bound to another Paseo bridge" };
bindings.delete(input.sessionID);
@@ -189,9 +207,7 @@ export async function registerSharedBridge(context) {
return async () => {
await filter.dispose();
await rpc.dispose();
await Promise.all(
[...registrations.values()].map(({ registration }) => registration.dispose()),
);
await Promise.all([...registrations.values()].map((registration) => registration.dispose()));
};
}
@@ -18,6 +18,11 @@ interface TestTool {
name: string;
execute(input: { value: string }, call: { sessionID: string }): Promise<unknown>;
}
interface ToolDefinition {
name: string;
description: string;
}
interface TestContext {
sessionID: string;
tools: Record<string, unknown>;
@@ -232,6 +237,147 @@ test("a shared plugin rebinds a session after the previous bridge stops listenin
}
});
function addSession(
bridge: OpenCodeBridge,
sessionId: string,
descriptions: Record<string, string>,
) {
const tools = new Map(
Object.entries(descriptions).map(([name, description]) => [
name,
{ name, description, inputSchema: { value: z.string() } },
]),
);
return bridge.bindSession({
sessionId,
env: {},
tools: {
tools,
getTool: (name) => tools.get(name),
executeTool: async () => ({ content: [] }),
},
});
}
async function registerAtLocation(bridge: OpenCodeBridge, home: string) {
const pluginPath = fileURLToPath(await bridge.materializeV2Plugin());
const plugin = await import(pathToFileURL(path.join(pluginPath, "server.js")).href);
const tools: Record<string, ToolDefinition> = {};
const hooks: Array<(context: TestContext) => Promise<void>> = [];
let rpc: Record<string, (input: Binding) => Promise<unknown>> = {};
const dispose = await plugin.default.setup({
options: {},
location: { directory: home },
rpc: {
register: async (_definition: unknown, handlers: typeof rpc) => {
rpc = handlers;
return { dispose: async () => {} };
},
},
tool: {
transform: async (apply: (editor: { add(item: ToolDefinition): void }) => void) => {
const added: string[] = [];
apply({
add: (item) => {
added.push(item.name);
tools[item.name] = item;
},
});
return {
dispose: async () => {
for (const name of added) delete tools[name];
},
};
},
},
session: {
context: async () => [],
get: async () => ({ parentID: "" }),
hook: async (event: string, handler: (context: TestContext) => Promise<void>) => {
if (event === "context") hooks.push(handler);
return { dispose: async () => {} };
},
},
});
return {
bind: (owner: OpenCodeBridge, sessionID: string) =>
rpc.bind!({ sessionID, ...owner.sharedV2Connection() }),
visible: async (sessionID: string) => {
const context = { sessionID, tools: { ...tools }, system: [] };
for (const hook of hooks) await hook(context);
return context.tools;
},
dispose,
};
}
test.each([false, true])(
"rebinds an existing session after an owner stops and its definition changes (second retained session: %s)",
async (second) => {
const home = await mkdtemp(path.join(tmpdir(), "paseo-upgrade-repro-"));
const old = new OpenCodeBridge({ paseoHome: home, logger: createTestLogger() });
const peer = new OpenCodeBridge({ paseoHome: home, logger: createTestLogger() });
const next = new OpenCodeBridge({ paseoHome: home, logger: createTestLogger() });
let location: Awaited<ReturnType<typeof registerAtLocation>> | undefined;
try {
await old.start();
addSession(old, "first", { echo: "echo v1" });
location = await registerAtLocation(old, home);
await location.bind(old, "first");
expect(await location.visible("first")).toHaveProperty("paseo_echo.description", "echo v1");
if (second) {
addSession(old, "second", { echo: "echo v1" });
await location.bind(old, "second");
}
await peer.start();
addSession(peer, "peer", { extra: "extra" });
await location.bind(peer, "peer");
// The OpenCode location survives, while the old daemon's HTTP service stops.
await old.close();
await next.start();
addSession(next, "first", { echo: "echo v2" });
await expect(location.bind(next, "first")).resolves.toEqual({});
expect(await location.visible("first")).toHaveProperty("paseo_echo.description", "echo v2");
expect(await location.visible("peer")).toHaveProperty("paseo_extra");
} finally {
await location?.dispose();
await old.close();
await next.close();
await peer.close();
await rm(home, { recursive: true, force: true });
}
},
);
test("binding another session at the same location preserves the first session's tools", async () => {
const home = await mkdtemp(path.join(tmpdir(), "paseo-upgrade-scope-repro-"));
const bridge = new OpenCodeBridge({ paseoHome: home, logger: createTestLogger() });
let location: Awaited<ReturnType<typeof registerAtLocation>> | undefined;
try {
await bridge.start();
addSession(bridge, "first", { echo: "echo", extra: "extra" });
addSession(bridge, "second", { echo: "echo" });
location = await registerAtLocation(bridge, home);
await location.bind(bridge, "first");
expect(await location.visible("first")).toHaveProperty("paseo_extra");
await location.bind(bridge, "second");
expect(await location.visible("second")).not.toHaveProperty("paseo_extra");
expect(await location.visible("first")).toHaveProperty("paseo_extra");
addSession(bridge, "conflict", { echo: "echo different" });
await expect(location.bind(bridge, "conflict")).rejects.toThrow(
"Conflicting Paseo tool definition: echo",
);
expect(await location.visible("first")).toHaveProperty("paseo_echo.description", "echo");
} finally {
await location?.dispose();
await bridge.close();
await rm(home, { recursive: true, force: true });
}
});
test("a refused connection is the only probe failure that clears a binding", async () => {
const source = new URL("./shared-bridge-plugin.mjs", import.meta.url).href;
const { isRefused } = (await import(source)) as { isRefused: (error: unknown) => boolean };
@@ -1325,7 +1325,6 @@ export class PiRpcAgentSession implements AgentSession {
if (this.closed) throw new Error("Pi session is closed");
if (this.activeTurnId !== turnId) return { turnId };
this.activeNoTurnPromptText = payload.text;
const shouldProbeForNoTurnPrompt = this.parseSlashCommandInput(payload.text) !== null;
void (async () => {
try {
@@ -1351,7 +1350,11 @@ export class PiRpcAgentSession implements AgentSession {
await this.completeNoTurnPrompt(turnId);
return;
}
if (agentInvoked === undefined && shouldProbeForNoTurnPrompt) {
// Pi can acknowledge a prompt as handled even when the extension starts a run.
if (
agentInvoked === undefined &&
(ack.handledByExtension || this.parseSlashCommandInput(payload.text) !== null)
) {
await this.completePromptIfHandledWithoutTurn(turnId);
}
} catch (error) {
@@ -3,9 +3,11 @@ import path from "node:path";
import type { ChildProcessWithoutNullStreams } from "node:child_process";
import { EventEmitter } from "node:events";
import { PassThrough } from "node:stream";
import { setImmediate as waitForImmediate } from "node:timers/promises";
import pino from "pino";
import { describe, expect, test, vi } from "vitest";
import { describe, expect, onTestFinished, test, vi } from "vitest";
import { PiRpcAgentClient } from "./agent.js";
import { PiCliRuntime } from "./cli-runtime.js";
import type { PiRuntimeLaunch } from "./runtime.js";
@@ -417,6 +419,97 @@ describe("PiCliRuntime", () => {
expect(command.images).toBeUndefined();
});
test.each([
{ disposition: "started", agentInvoked: true },
{ disposition: "queued", agentInvoked: true },
])(
"maps a $disposition prompt disposition to agentInvoked $agentInvoked",
async ({ disposition, agentInvoked }) => {
const child = createPiChild();
replyToCommands(child, (command) => (command.type === "prompt" ? { disposition } : {}));
const session = await createRuntime(child).startSession({ cwd: "/workspace/project" });
await expect(session.prompt("summarize README.md")).resolves.toMatchObject({ agentInvoked });
},
);
test("preserves an explicit agentInvoked result in a prompt response", async () => {
const child = createPiChild();
replyToCommands(child, () => ({ disposition: "started", agentInvoked: false }));
const session = await createRuntime(child).startSession({ cwd: "/workspace/project" });
await expect(session.prompt("hello")).resolves.toEqual({
requestId: expect.any(String),
agentInvoked: false,
});
});
test("completes when an input extension handles a prompt without a model run", async () => {
const child = createPiChild();
replyToCommands(child, (command) => {
if (command.type === "prompt") {
const notification = {
type: "extension_ui_request",
id: "handled",
method: "notify",
message: "Handled by extension",
};
child.stdout.write(`${JSON.stringify(notification)}\n`);
return { disposition: "handled" };
}
return { sessionId: "pi-session-1", isStreaming: false };
});
const client = new PiRpcAgentClient({
logger: pino({ level: "silent" }),
runtime: createRuntime(child),
});
const session = await client.createSession({ provider: "pi", cwd: "/workspace/project" });
onTestFinished(() => session.close());
await expect(session.run("hello")).resolves.toMatchObject({
timeline: expect.arrayContaining([
expect.objectContaining({ type: "notification", message: "Handled by extension" }),
]),
});
});
test("waits for the reply when a handled slash command starts a model run", async () => {
const child = createPiChild();
let isStreaming = false;
replyToCommands(child, (command) => {
if (command.type === "prompt") {
isStreaming = true;
return { disposition: "handled" };
}
return { sessionId: "pi-session-1", isStreaming };
});
const client = new PiRpcAgentClient({
logger: pino({ level: "silent" }),
runtime: createRuntime(child),
});
const session = await client.createSession({ provider: "pi", cwd: "/workspace/project" });
onTestFinished(() => session.close());
const reply = session.run("/ask hello");
// Pi acknowledges the command while its model run is starting, before agent_start.
await waitForImmediate();
await waitForImmediate();
child.stdout.write(`${JSON.stringify({ type: "agent_start" })}\n`);
const message = { role: "assistant", content: [{ type: "text", text: "Hello" }] };
const update = {
type: "message_update",
message,
assistantMessageEvent: { type: "text_delta", delta: "Hello" },
};
child.stdout.write(`${JSON.stringify(update)}\n`);
child.stdout.write(
`${JSON.stringify({ type: "agent_end", messages: [message], willRetry: false })}\n`,
);
child.stdout.write(`${JSON.stringify({ type: "agent_settled" })}\n`);
await expect(reply).resolves.toMatchObject({ finalText: "Hello" });
});
test("sends the clear_queue RPC frame", async () => {
const child = createPiChild();
replyToCommands(child, () => ({}));
@@ -130,10 +130,16 @@ class PiCliRuntimeSession implements PiRuntimeSession {
});
const data = await promise;
if (typeof data === "object" && data !== null && !Array.isArray(data)) {
const { agentInvoked } = data as Record<string, unknown>;
const { agentInvoked, disposition } = data as Record<string, unknown>;
if (typeof agentInvoked === "boolean") {
return { requestId, agentInvoked };
}
if (disposition === "handled") {
return { requestId, handledByExtension: true };
}
if (disposition === "started" || disposition === "queued") {
return { requestId, agentInvoked: true };
}
}
return { requestId };
}
@@ -5,13 +5,10 @@ export interface PiImageContent {
data: string;
mimeType: string;
}
export interface PiPromptAck {
agentInvoked?: boolean;
}
export interface PiPromptAck {
requestId?: string;
agentInvoked?: boolean;
handledByExtension?: true;
}
export interface PiTextContent {
@@ -606,12 +606,16 @@ export default function contribute(server) {
const pending = client.createWorkspace({
source: { kind: "worktree", cwd: repository, branchName: "concurrent" },
});
// Cleanup closes the client if the marker never arrives.
void pending.catch(() => undefined);
await expect
.poll(() =>
stat(path.join(root, "manager-started")).then(
() => true,
() => false,
),
.poll(
() =>
stat(path.join(root, "manager-started")).then(
() => true,
() => false,
),
{ timeout: 10_000 },
)
.toBe(true);
const concurrent = path.join(root, "concurrent-manual");
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/website",
"version": "0.17.2",
"version": "0.17.3",
"private": true,
"type": "module",
"scripts": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@getpaseo/builtin-plugins",
"version": "0.17.2",
"version": "0.17.3",
"private": true,
"type": "module",
"scripts": {