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:
@@ -0,0 +1,25 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
buildAgentDeepLink,
|
||||
buildAgentDeepLinkRoute,
|
||||
parseAgentDeepLink,
|
||||
} from "./agent-deep-link.js";
|
||||
|
||||
describe("agent deep links", () => {
|
||||
it("round-trips an existing agent target", () => {
|
||||
const target = { serverId: "server/main", agentId: "agent 123" };
|
||||
|
||||
const link = buildAgentDeepLink(target);
|
||||
|
||||
expect(link).toBe("paseo://h/server%2Fmain/agent/agent%20123");
|
||||
expect(buildAgentDeepLinkRoute(target)).toBe("/h/server%2Fmain/agent/agent%20123");
|
||||
expect(parseAgentDeepLink(link)).toEqual(target);
|
||||
});
|
||||
|
||||
it("rejects links outside the exact agent route", () => {
|
||||
expect(parseAgentDeepLink("https://h/server/agent/agent-1")).toBeNull();
|
||||
expect(parseAgentDeepLink("paseo://app/h/server/agent/agent-1")).toBeNull();
|
||||
expect(parseAgentDeepLink("paseo://h/server/agent/agent-1?message=hello")).toBeNull();
|
||||
expect(parseAgentDeepLink("paseo://h/server/agent/agent-1/extra")).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user