Files
paseo/packages/desktop/src/desktop-startup.test.ts
T
Mohamed BoudraandGitHub 76a5edb020 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
2026-07-22 18:31:12 +02:00

74 lines
2.2 KiB
TypeScript

import { describe, expect, it, vi } from "vitest";
import { runDesktopStartup } from "./desktop-startup";
describe("desktop startup", () => {
it("runs CLI passthrough before GUI login-shell env inheritance", async () => {
const calls: string[] = [];
await runDesktopStartup({
hasPendingGuiLaunchRequest: false,
runCliPassthroughIfRequested: vi.fn(async () => {
calls.push("cli");
return true;
}),
inheritLoginShellEnv: vi.fn(() => calls.push("env")),
bootstrapGui: vi.fn(async () => {
calls.push("gui");
}),
});
expect(calls).toEqual(["cli"]);
});
it("keeps login-shell env inheritance on normal GUI startup", async () => {
const calls: string[] = [];
await runDesktopStartup({
hasPendingGuiLaunchRequest: false,
runCliPassthroughIfRequested: vi.fn(async () => {
calls.push("cli");
return false;
}),
inheritLoginShellEnv: vi.fn(() => calls.push("env")),
bootstrapGui: vi.fn(async () => {
calls.push("gui");
}),
});
expect(calls).toEqual(["cli", "env", "gui"]);
});
it("starts skills auto-update after GUI startup", async () => {
const calls: string[] = [];
await runDesktopStartup({
hasPendingGuiLaunchRequest: false,
runCliPassthroughIfRequested: vi.fn(async () => {
calls.push("cli");
return false;
}),
inheritLoginShellEnv: vi.fn(() => calls.push("env")),
bootstrapGui: vi.fn(async () => {
calls.push("gui");
}),
autoUpdateInstalledSkills: vi.fn(() => calls.push("skills")),
});
expect(calls).toEqual(["cli", "env", "gui", "skills"]);
});
it("does not route open-project launches through CLI passthrough", async () => {
const runCliPassthroughIfRequested = vi.fn(async () => true);
const calls: string[] = [];
await runDesktopStartup({
hasPendingGuiLaunchRequest: true,
runCliPassthroughIfRequested,
inheritLoginShellEnv: vi.fn(() => calls.push("env")),
bootstrapGui: vi.fn(async () => {
calls.push("gui");
}),
});
expect(runCliPassthroughIfRequested).not.toHaveBeenCalled();
expect(calls).toEqual(["env", "gui"]);
});
});