Open existing agents from links and the CLI (#2324)

* feat(desktop): open existing agents from links

Register a stable agent deep link and route it through the existing Desktop window. Add a matching CLI command that resolves the local server and activates the requested agent without creating or messaging it.

* fix(desktop): recover agent link delivery
This commit is contained in:
Mohamed Boudra
2026-07-22 18:31:12 +02:00
committed by GitHub
parent 9952615c33
commit 76a5edb020
18 changed files with 504 additions and 42 deletions
@@ -0,0 +1,33 @@
import { describe, expect, it } from "vitest";
import { AgentNavigationInbox, parseAgentDeepLinkFromArgv } from "./agent-navigation.js";
describe("desktop agent navigation", () => {
it("finds an agent deep link among Electron launch arguments", () => {
expect(
parseAgentDeepLinkFromArgv([
"/Applications/Paseo.app/Contents/MacOS/Paseo",
"--no-sandbox",
"paseo://h/server-1/agent/agent-2",
]),
).toEqual({ serverId: "server-1", agentId: "agent-2" });
});
it("holds navigation until the existing renderer is ready", () => {
const inbox = new AgentNavigationInbox();
const target = { serverId: "server-1", agentId: "agent-2" };
expect(inbox.deliverOrQueue(7, target)).toBeNull();
expect(inbox.windowReady(7)).toEqual(target);
expect(inbox.deliverOrQueue(7, target)).toEqual(target);
});
it("returns only the newest navigation queued during startup", () => {
const inbox = new AgentNavigationInbox();
inbox.deliverOrQueue(7, { serverId: "server-1", agentId: "agent-1" });
inbox.deliverOrQueue(7, { serverId: "server-1", agentId: "agent-2" });
expect(inbox.windowReady(7)).toEqual({ serverId: "server-1", agentId: "agent-2" });
expect(inbox.windowReady(7)).toBeNull();
});
});