Files
paseo/packages/app/src/hooks/use-all-agents-list.test.ts
T
Mohamed Boudra 060f3d457c refactor: remove terminal agent concept entirely
Remove the "agent can be a terminal" branching from the entire codebase.
An agent is now always a session-backed chat agent. Standalone terminal
infrastructure (terminal component, ANSI handling, terminal-stream-protocol)
is preserved.

Server: delete ManagedTerminalAgent, AgentKind, TerminalExitDetails,
launchTerminalAgent, registerTerminalAgent, handleTerminalAgentExited,
supportsTerminalMode capability, buildTerminalCreate/ResumeCommand from
all providers, terminal agent persistence/projections.

App: delete terminal-agent-panel.tsx, terminal-agent-reopen-store.ts,
terminal/terminalExit fields on agent state, "Terminal Agents" launcher
section, terminal-agent workspace setup flow, terminal badge in agent list.

CLI: remove terminal column from ls, terminal-agent error from send.

60 files changed, -3592 lines
2026-04-02 10:55:54 +07:00

80 lines
2.7 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { __private__ } from "./use-all-agents-list";
import type { Agent } from "@/stores/session-store";
function makeAgent(input?: Partial<Agent>): Agent {
const timestamp = new Date("2026-03-08T10:00:00.000Z");
return {
serverId: "server-1",
id: input?.id ?? "agent-1",
provider: input?.provider ?? "codex",
status: input?.status ?? "idle",
createdAt: input?.createdAt ?? timestamp,
updatedAt: input?.updatedAt ?? timestamp,
lastUserMessageAt: input?.lastUserMessageAt ?? null,
lastActivityAt: input?.lastActivityAt ?? timestamp,
capabilities: input?.capabilities ?? {
supportsStreaming: true,
supportsSessionPersistence: true,
supportsDynamicModes: true,
supportsMcpServers: true,
supportsReasoningStream: true,
supportsToolInvocations: true,
},
currentModeId: input?.currentModeId ?? null,
availableModes: input?.availableModes ?? [],
pendingPermissions: input?.pendingPermissions ?? [],
persistence: input?.persistence ?? null,
runtimeInfo: input?.runtimeInfo,
lastUsage: input?.lastUsage,
lastError: input?.lastError ?? null,
title: input?.title ?? "Agent",
cwd: input?.cwd ?? "/tmp/project",
model: input?.model ?? null,
thinkingOptionId: input?.thinkingOptionId,
requiresAttention: input?.requiresAttention ?? false,
attentionReason: input?.attentionReason ?? null,
attentionTimestamp: input?.attentionTimestamp ?? null,
archivedAt: input?.archivedAt ?? null,
labels: input?.labels ?? {},
projectPlacement: input?.projectPlacement ?? null,
};
}
describe("useAllAgentsList", () => {
it("excludes archived agents by default", () => {
const visibleAgent = makeAgent({ id: "visible" });
const archivedAgent = makeAgent({
id: "archived",
archivedAt: new Date("2026-03-08T11:00:00.000Z"),
});
const result = __private__.buildAllAgentsList({
agents: [visibleAgent, archivedAgent],
serverId: "server-1",
serverLabel: "Local",
includeArchived: false,
});
expect(result.map((agent) => agent.id)).toEqual(["visible"]);
});
it("includes archived agents when requested", () => {
const visibleAgent = makeAgent({ id: "visible" });
const archivedAgent = makeAgent({
id: "archived",
archivedAt: new Date("2026-03-08T11:00:00.000Z"),
});
const result = __private__.buildAllAgentsList({
agents: [visibleAgent, archivedAgent],
serverId: "server-1",
serverLabel: "Local",
includeArchived: true,
});
expect(result.map((agent) => agent.id)).toEqual(["visible", "archived"]);
expect(result[1]?.archivedAt).toEqual(archivedAgent.archivedAt);
});
});