Switch to double quotes and reformat codebase with Biome
This commit is contained in:
@@ -11,8 +11,7 @@ describe("buildAgentAttentionNotificationPayload", () => {
|
||||
reason: "finished",
|
||||
serverId: "srv-1",
|
||||
agentId: "agent-1",
|
||||
assistantMessage:
|
||||
"**Done**. Updated `README.md` and [link](https://example.com).",
|
||||
assistantMessage: "**Done**. Updated `README.md` and [link](https://example.com).",
|
||||
});
|
||||
|
||||
expect(payload).toEqual({
|
||||
@@ -81,7 +80,7 @@ describe("findLatestAssistantMessageFromTimeline", () => {
|
||||
{ type: "reasoning", text: "thinking..." },
|
||||
{ type: "assistant_message", text: "Done " },
|
||||
{ type: "assistant_message", text: "now" },
|
||||
])
|
||||
]),
|
||||
).toBe("Done now");
|
||||
});
|
||||
});
|
||||
@@ -89,14 +88,8 @@ describe("findLatestAssistantMessageFromTimeline", () => {
|
||||
describe("findLatestPermissionRequest", () => {
|
||||
it("returns the most recently inserted request", () => {
|
||||
const pending = new Map([
|
||||
[
|
||||
"first",
|
||||
{ id: "first", provider: "claude", name: "a", kind: "tool" } as const,
|
||||
],
|
||||
[
|
||||
"second",
|
||||
{ id: "second", provider: "claude", name: "b", kind: "tool" } as const,
|
||||
],
|
||||
["first", { id: "first", provider: "claude", name: "a", kind: "tool" } as const],
|
||||
["second", { id: "second", provider: "claude", name: "b", kind: "tool" } as const],
|
||||
]);
|
||||
|
||||
expect(findLatestPermissionRequest(pending)?.id).toBe("second");
|
||||
|
||||
@@ -37,8 +37,7 @@ export type AssistantTimelineItem =
|
||||
| { type: "assistant_message"; text: string }
|
||||
| { type: string; text?: string };
|
||||
|
||||
const normalizeNotificationText = (text: string): string =>
|
||||
text.replace(/\s+/g, " ").trim();
|
||||
const normalizeNotificationText = (text: string): string => text.replace(/\s+/g, " ").trim();
|
||||
|
||||
const truncateNotificationText = (text: string, limit: number): string => {
|
||||
if (text.length <= limit) {
|
||||
@@ -79,9 +78,7 @@ const stripMarkdownToText = (markdown: string): string => {
|
||||
return text;
|
||||
};
|
||||
|
||||
const buildNotificationPreview = (
|
||||
text: string | null | undefined
|
||||
): string | null => {
|
||||
const buildNotificationPreview = (text: string | null | undefined): string | null => {
|
||||
if (!text) {
|
||||
return null;
|
||||
}
|
||||
@@ -103,7 +100,7 @@ const safeStringify = (value: unknown): string | null => {
|
||||
};
|
||||
|
||||
const buildPermissionDetails = (
|
||||
request: NotificationPermissionRequest | null | undefined
|
||||
request: NotificationPermissionRequest | null | undefined,
|
||||
): string | null => {
|
||||
if (!request) {
|
||||
return null;
|
||||
@@ -137,7 +134,7 @@ const buildPermissionDetails = (
|
||||
};
|
||||
|
||||
export function findLatestAssistantMessageFromTimeline(
|
||||
timeline: readonly AssistantTimelineItem[]
|
||||
timeline: readonly AssistantTimelineItem[],
|
||||
): string | null {
|
||||
// Providers may stream assistant content in consecutive chunks.
|
||||
const chunks: string[] = [];
|
||||
@@ -160,7 +157,7 @@ export function findLatestAssistantMessageFromTimeline(
|
||||
}
|
||||
|
||||
export function findLatestPermissionRequest(
|
||||
pendingPermissions: ReadonlyMap<string, NotificationPermissionRequest>
|
||||
pendingPermissions: ReadonlyMap<string, NotificationPermissionRequest>,
|
||||
): NotificationPermissionRequest | null {
|
||||
let latest: NotificationPermissionRequest | null = null;
|
||||
for (const request of pendingPermissions.values()) {
|
||||
@@ -170,7 +167,7 @@ export function findLatestPermissionRequest(
|
||||
}
|
||||
|
||||
export function buildAgentAttentionNotificationPayload(
|
||||
input: BuildAgentAttentionNotificationPayloadInput
|
||||
input: BuildAgentAttentionNotificationPayloadInput,
|
||||
): AgentAttentionNotificationPayload {
|
||||
const title =
|
||||
input.reason === "permission"
|
||||
|
||||
@@ -6,5 +6,4 @@ export const AGENT_LIFECYCLE_STATUSES = [
|
||||
"closed",
|
||||
] as const;
|
||||
|
||||
export type AgentLifecycleStatus =
|
||||
(typeof AGENT_LIFECYCLE_STATUSES)[number];
|
||||
export type AgentLifecycleStatus = (typeof AGENT_LIFECYCLE_STATUSES)[number];
|
||||
|
||||
@@ -13,7 +13,7 @@ describe("relay websocket URL versioning", () => {
|
||||
endpoint: "relay.paseo.sh:443",
|
||||
serverId: "srv_test",
|
||||
role: "client",
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
expect(url.searchParams.get("v")).toBe(CURRENT_RELAY_PROTOCOL_VERSION);
|
||||
@@ -27,7 +27,7 @@ describe("relay websocket URL versioning", () => {
|
||||
serverId: "srv_test",
|
||||
role: "server",
|
||||
connectionId: "conn_abc123",
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
expect(url.searchParams.get("connectionId")).toBe("conn_abc123");
|
||||
@@ -40,7 +40,7 @@ describe("relay websocket URL versioning", () => {
|
||||
serverId: "srv_test",
|
||||
role: "server",
|
||||
version: "1",
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
expect(url.searchParams.get("v")).toBe("1");
|
||||
@@ -52,8 +52,6 @@ describe("relay websocket URL versioning", () => {
|
||||
});
|
||||
|
||||
test("rejects unsupported relay versions", () => {
|
||||
expect(() => normalizeRelayProtocolVersion("3")).toThrow(
|
||||
'Relay version must be "1" or "2"'
|
||||
);
|
||||
expect(() => normalizeRelayProtocolVersion("3")).toThrow('Relay version must be "1" or "2"');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ export const CURRENT_RELAY_PROTOCOL_VERSION: RelayProtocolVersion = "2";
|
||||
|
||||
export function normalizeRelayProtocolVersion(
|
||||
value: unknown,
|
||||
fallback: RelayProtocolVersion = CURRENT_RELAY_PROTOCOL_VERSION
|
||||
fallback: RelayProtocolVersion = CURRENT_RELAY_PROTOCOL_VERSION,
|
||||
): RelayProtocolVersion {
|
||||
if (value == null) {
|
||||
return fallback;
|
||||
@@ -93,9 +93,7 @@ function shouldUseSecureWebSocket(port: number): boolean {
|
||||
return port === 443;
|
||||
}
|
||||
|
||||
export function buildDaemonWebSocketUrl(
|
||||
endpoint: string
|
||||
): string {
|
||||
export function buildDaemonWebSocketUrl(endpoint: string): string {
|
||||
const { host, port, isIpv6 } = parseHostPort(endpoint);
|
||||
const protocol = shouldUseSecureWebSocket(port) ? "wss" : "ws";
|
||||
const hostPart = isIpv6 ? `[${host}]` : host;
|
||||
@@ -151,10 +149,7 @@ export function extractHostPortFromWebSocketUrl(wsUrl: string): string {
|
||||
export function isRelayClientWebSocketUrl(url: string): boolean {
|
||||
try {
|
||||
const parsed = new URL(url);
|
||||
return (
|
||||
parsed.searchParams.get("role") === "client" &&
|
||||
parsed.searchParams.has("serverId")
|
||||
);
|
||||
return parsed.searchParams.get("role") === "client" && parsed.searchParams.has("serverId");
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
AgentStreamMessageSchema,
|
||||
@@ -6,121 +6,121 @@ import {
|
||||
SessionInboundMessageSchema,
|
||||
SessionOutboundMessageSchema,
|
||||
WSOutboundMessageSchema,
|
||||
} from './messages.js'
|
||||
} from "./messages.js";
|
||||
|
||||
describe('shared messages stream parsing', () => {
|
||||
it('parses representative fetch_agent_timeline_response payload', () => {
|
||||
describe("shared messages stream parsing", () => {
|
||||
it("parses representative fetch_agent_timeline_response payload", () => {
|
||||
const parsed = FetchAgentTimelineResponseMessageSchema.parse({
|
||||
type: 'fetch_agent_timeline_response',
|
||||
type: "fetch_agent_timeline_response",
|
||||
payload: {
|
||||
requestId: 'req-1',
|
||||
agentId: 'agent_live',
|
||||
requestId: "req-1",
|
||||
agentId: "agent_live",
|
||||
agent: null,
|
||||
direction: 'tail',
|
||||
projection: 'projected',
|
||||
epoch: 'epoch-1',
|
||||
direction: "tail",
|
||||
projection: "projected",
|
||||
epoch: "epoch-1",
|
||||
reset: false,
|
||||
staleCursor: false,
|
||||
gap: false,
|
||||
window: { minSeq: 1, maxSeq: 2, nextSeq: 3 },
|
||||
startCursor: { epoch: 'epoch-1', seq: 1 },
|
||||
endCursor: { epoch: 'epoch-1', seq: 2 },
|
||||
startCursor: { epoch: "epoch-1", seq: 1 },
|
||||
endCursor: { epoch: "epoch-1", seq: 2 },
|
||||
hasOlder: false,
|
||||
hasNewer: false,
|
||||
entries: [
|
||||
{
|
||||
provider: 'codex',
|
||||
item: { type: 'assistant_message', text: 'hello' },
|
||||
timestamp: '2026-02-08T20:10:00.000Z',
|
||||
provider: "codex",
|
||||
item: { type: "assistant_message", text: "hello" },
|
||||
timestamp: "2026-02-08T20:10:00.000Z",
|
||||
seqStart: 1,
|
||||
seqEnd: 2,
|
||||
sourceSeqRanges: [{ startSeq: 1, endSeq: 2 }],
|
||||
collapsed: ['assistant_merge'],
|
||||
collapsed: ["assistant_merge"],
|
||||
},
|
||||
],
|
||||
error: null,
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
expect(parsed.payload.entries).toHaveLength(1)
|
||||
expect(parsed.payload.entries[0]?.item.type).toBe('assistant_message')
|
||||
})
|
||||
expect(parsed.payload.entries).toHaveLength(1);
|
||||
expect(parsed.payload.entries[0]?.item.type).toBe("assistant_message");
|
||||
});
|
||||
|
||||
it('parses explicit shutdown and restart lifecycle request payloads as distinct message types', () => {
|
||||
it("parses explicit shutdown and restart lifecycle request payloads as distinct message types", () => {
|
||||
const shutdownParsed = SessionInboundMessageSchema.safeParse({
|
||||
type: 'shutdown_server_request',
|
||||
requestId: 'req-shutdown-1',
|
||||
})
|
||||
expect(shutdownParsed.success).toBe(true)
|
||||
type: "shutdown_server_request",
|
||||
requestId: "req-shutdown-1",
|
||||
});
|
||||
expect(shutdownParsed.success).toBe(true);
|
||||
|
||||
const restartParsed = SessionInboundMessageSchema.safeParse({
|
||||
type: 'restart_server_request',
|
||||
requestId: 'req-restart-1',
|
||||
reason: 'settings_changed',
|
||||
})
|
||||
expect(restartParsed.success).toBe(true)
|
||||
type: "restart_server_request",
|
||||
requestId: "req-restart-1",
|
||||
reason: "settings_changed",
|
||||
});
|
||||
expect(restartParsed.success).toBe(true);
|
||||
|
||||
expect(shutdownParsed.success && shutdownParsed.data.type).toBe('shutdown_server_request')
|
||||
expect(restartParsed.success && restartParsed.data.type).toBe('restart_server_request')
|
||||
})
|
||||
expect(shutdownParsed.success && shutdownParsed.data.type).toBe("shutdown_server_request");
|
||||
expect(restartParsed.success && restartParsed.data.type).toBe("restart_server_request");
|
||||
});
|
||||
|
||||
it('parses representative agent_stream tool_call event', () => {
|
||||
it("parses representative agent_stream tool_call event", () => {
|
||||
const parsed = AgentStreamMessageSchema.parse({
|
||||
type: 'agent_stream',
|
||||
type: "agent_stream",
|
||||
payload: {
|
||||
agentId: 'agent_live',
|
||||
timestamp: '2026-02-08T20:10:00.000Z',
|
||||
agentId: "agent_live",
|
||||
timestamp: "2026-02-08T20:10:00.000Z",
|
||||
event: {
|
||||
type: 'timeline',
|
||||
provider: 'claude',
|
||||
type: "timeline",
|
||||
provider: "claude",
|
||||
item: {
|
||||
type: 'tool_call',
|
||||
callId: 'call_live',
|
||||
name: 'shell',
|
||||
status: 'running',
|
||||
type: "tool_call",
|
||||
callId: "call_live",
|
||||
name: "shell",
|
||||
status: "running",
|
||||
detail: {
|
||||
type: 'shell',
|
||||
command: 'ls',
|
||||
type: "shell",
|
||||
command: "ls",
|
||||
},
|
||||
error: null,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
expect(parsed.payload.event.type).toBe('timeline')
|
||||
if (parsed.payload.event.type === 'timeline') {
|
||||
expect(parsed.payload.event.item.type).toBe('tool_call')
|
||||
if (parsed.payload.event.item.type === 'tool_call') {
|
||||
expect(parsed.payload.event.item.status).toBe('running')
|
||||
expect(parsed.payload.event.type).toBe("timeline");
|
||||
if (parsed.payload.event.type === "timeline") {
|
||||
expect(parsed.payload.event.item.type).toBe("tool_call");
|
||||
if (parsed.payload.event.item.type === "tool_call") {
|
||||
expect(parsed.payload.event.item.status).toBe("running");
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
it('parses representative sub_agent tool_call event', () => {
|
||||
it("parses representative sub_agent tool_call event", () => {
|
||||
const parsed = AgentStreamMessageSchema.parse({
|
||||
type: 'agent_stream',
|
||||
type: "agent_stream",
|
||||
payload: {
|
||||
agentId: 'agent_live',
|
||||
timestamp: '2026-02-08T20:10:00.000Z',
|
||||
agentId: "agent_live",
|
||||
timestamp: "2026-02-08T20:10:00.000Z",
|
||||
event: {
|
||||
type: 'timeline',
|
||||
provider: 'claude',
|
||||
type: "timeline",
|
||||
provider: "claude",
|
||||
item: {
|
||||
type: 'tool_call',
|
||||
callId: 'call_sub_agent_live',
|
||||
name: 'Task',
|
||||
status: 'running',
|
||||
type: "tool_call",
|
||||
callId: "call_sub_agent_live",
|
||||
name: "Task",
|
||||
status: "running",
|
||||
detail: {
|
||||
type: 'sub_agent',
|
||||
subAgentType: 'Explore',
|
||||
description: 'Inspect repository structure',
|
||||
log: '[Read] README.md',
|
||||
type: "sub_agent",
|
||||
subAgentType: "Explore",
|
||||
description: "Inspect repository structure",
|
||||
log: "[Read] README.md",
|
||||
actions: [
|
||||
{
|
||||
index: 1,
|
||||
toolName: 'Read',
|
||||
summary: 'README.md',
|
||||
toolName: "Read",
|
||||
summary: "README.md",
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -128,115 +128,115 @@ describe('shared messages stream parsing', () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
expect(parsed.payload.event.type).toBe('timeline')
|
||||
if (parsed.payload.event.type === 'timeline') {
|
||||
expect(parsed.payload.event.item.type).toBe('tool_call')
|
||||
if (parsed.payload.event.item.type === 'tool_call') {
|
||||
expect(parsed.payload.event.item.detail.type).toBe('sub_agent')
|
||||
expect(parsed.payload.event.type).toBe("timeline");
|
||||
if (parsed.payload.event.type === "timeline") {
|
||||
expect(parsed.payload.event.item.type).toBe("tool_call");
|
||||
if (parsed.payload.event.item.type === "tool_call") {
|
||||
expect(parsed.payload.event.item.detail.type).toBe("sub_agent");
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
it('rejects removed initialize_agent_request inbound payload', () => {
|
||||
it("rejects removed initialize_agent_request inbound payload", () => {
|
||||
const parsed = SessionInboundMessageSchema.safeParse({
|
||||
type: 'initialize_agent_request',
|
||||
agentId: 'agent-legacy',
|
||||
requestId: 'req-legacy-1',
|
||||
})
|
||||
expect(parsed.success).toBe(false)
|
||||
})
|
||||
type: "initialize_agent_request",
|
||||
agentId: "agent-legacy",
|
||||
requestId: "req-legacy-1",
|
||||
});
|
||||
expect(parsed.success).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects removed initialize_agent_request outbound payload', () => {
|
||||
it("rejects removed initialize_agent_request outbound payload", () => {
|
||||
const parsed = SessionOutboundMessageSchema.safeParse({
|
||||
type: 'initialize_agent_request',
|
||||
type: "initialize_agent_request",
|
||||
payload: {
|
||||
requestId: 'req-legacy-1',
|
||||
agentId: 'agent-legacy',
|
||||
agentStatus: 'running',
|
||||
requestId: "req-legacy-1",
|
||||
agentId: "agent-legacy",
|
||||
agentStatus: "running",
|
||||
timelineSize: 12,
|
||||
},
|
||||
})
|
||||
expect(parsed.success).toBe(false)
|
||||
})
|
||||
});
|
||||
expect(parsed.success).toBe(false);
|
||||
});
|
||||
|
||||
it('parses directory suggestions request and response payloads', () => {
|
||||
it("parses directory suggestions request and response payloads", () => {
|
||||
const requestParsed = SessionInboundMessageSchema.safeParse({
|
||||
type: 'directory_suggestions_request',
|
||||
query: 'proj',
|
||||
cwd: '/tmp/project',
|
||||
type: "directory_suggestions_request",
|
||||
query: "proj",
|
||||
cwd: "/tmp/project",
|
||||
includeFiles: true,
|
||||
includeDirectories: true,
|
||||
limit: 20,
|
||||
requestId: 'req-dir-1',
|
||||
})
|
||||
expect(requestParsed.success).toBe(true)
|
||||
requestId: "req-dir-1",
|
||||
});
|
||||
expect(requestParsed.success).toBe(true);
|
||||
|
||||
const responseParsed = SessionOutboundMessageSchema.safeParse({
|
||||
type: 'directory_suggestions_response',
|
||||
type: "directory_suggestions_response",
|
||||
payload: {
|
||||
directories: ['/Users/test/projects/paseo'],
|
||||
entries: [{ path: '/Users/test/projects/paseo', kind: 'directory' }],
|
||||
directories: ["/Users/test/projects/paseo"],
|
||||
entries: [{ path: "/Users/test/projects/paseo", kind: "directory" }],
|
||||
error: null,
|
||||
requestId: 'req-dir-1',
|
||||
requestId: "req-dir-1",
|
||||
},
|
||||
})
|
||||
expect(responseParsed.success).toBe(true)
|
||||
})
|
||||
});
|
||||
expect(responseParsed.success).toBe(true);
|
||||
});
|
||||
|
||||
it('rejects websocket envelope for removed agent_stream_snapshot message type', () => {
|
||||
it("rejects websocket envelope for removed agent_stream_snapshot message type", () => {
|
||||
const fixture = {
|
||||
type: 'agent_stream_snapshot',
|
||||
type: "agent_stream_snapshot",
|
||||
payload: {
|
||||
agentId: 'agent-legacy',
|
||||
agentId: "agent-legacy",
|
||||
events: [],
|
||||
},
|
||||
}
|
||||
};
|
||||
const wrapped = WSOutboundMessageSchema.safeParse({
|
||||
type: 'session',
|
||||
type: "session",
|
||||
message: fixture,
|
||||
})
|
||||
expect(wrapped.success).toBe(false)
|
||||
})
|
||||
});
|
||||
expect(wrapped.success).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects removed legacy git diff request messages', () => {
|
||||
it("rejects removed legacy git diff request messages", () => {
|
||||
const gitDiffParsed = SessionInboundMessageSchema.safeParse({
|
||||
type: 'git_diff_request',
|
||||
agentId: 'agent-1',
|
||||
requestId: 'req-1',
|
||||
})
|
||||
expect(gitDiffParsed.success).toBe(false)
|
||||
type: "git_diff_request",
|
||||
agentId: "agent-1",
|
||||
requestId: "req-1",
|
||||
});
|
||||
expect(gitDiffParsed.success).toBe(false);
|
||||
|
||||
const highlightedParsed = SessionInboundMessageSchema.safeParse({
|
||||
type: 'highlighted_diff_request',
|
||||
agentId: 'agent-1',
|
||||
requestId: 'req-2',
|
||||
})
|
||||
expect(highlightedParsed.success).toBe(false)
|
||||
})
|
||||
type: "highlighted_diff_request",
|
||||
agentId: "agent-1",
|
||||
requestId: "req-2",
|
||||
});
|
||||
expect(highlightedParsed.success).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects removed legacy git diff response messages', () => {
|
||||
it("rejects removed legacy git diff response messages", () => {
|
||||
const gitDiffParsed = SessionOutboundMessageSchema.safeParse({
|
||||
type: 'git_diff_response',
|
||||
type: "git_diff_response",
|
||||
payload: {
|
||||
agentId: 'agent-1',
|
||||
diff: '',
|
||||
agentId: "agent-1",
|
||||
diff: "",
|
||||
error: null,
|
||||
requestId: 'req-1',
|
||||
requestId: "req-1",
|
||||
},
|
||||
})
|
||||
expect(gitDiffParsed.success).toBe(false)
|
||||
});
|
||||
expect(gitDiffParsed.success).toBe(false);
|
||||
|
||||
const highlightedParsed = SessionOutboundMessageSchema.safeParse({
|
||||
type: 'highlighted_diff_response',
|
||||
type: "highlighted_diff_response",
|
||||
payload: {
|
||||
agentId: 'agent-1',
|
||||
agentId: "agent-1",
|
||||
files: [],
|
||||
error: null,
|
||||
requestId: 'req-2',
|
||||
requestId: "req-2",
|
||||
},
|
||||
})
|
||||
expect(highlightedParsed.success).toBe(false)
|
||||
})
|
||||
})
|
||||
});
|
||||
expect(highlightedParsed.success).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,56 +1,53 @@
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import {
|
||||
SessionInboundMessageSchema,
|
||||
SessionOutboundMessageSchema,
|
||||
} from './messages.js'
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { SessionInboundMessageSchema, SessionOutboundMessageSchema } from "./messages.js";
|
||||
|
||||
describe('workspace message schemas', () => {
|
||||
test('parses fetch_workspaces_request', () => {
|
||||
describe("workspace message schemas", () => {
|
||||
test("parses fetch_workspaces_request", () => {
|
||||
const parsed = SessionInboundMessageSchema.parse({
|
||||
type: 'fetch_workspaces_request',
|
||||
requestId: 'req-1',
|
||||
type: "fetch_workspaces_request",
|
||||
requestId: "req-1",
|
||||
filter: {
|
||||
query: 'repo',
|
||||
projectId: 'remote:github.com/acme/repo',
|
||||
idPrefix: '/Users/me',
|
||||
query: "repo",
|
||||
projectId: "remote:github.com/acme/repo",
|
||||
idPrefix: "/Users/me",
|
||||
},
|
||||
sort: [{ key: 'activity_at', direction: 'desc' }],
|
||||
sort: [{ key: "activity_at", direction: "desc" }],
|
||||
page: { limit: 50 },
|
||||
subscribe: {},
|
||||
})
|
||||
});
|
||||
|
||||
expect(parsed.type).toBe('fetch_workspaces_request')
|
||||
})
|
||||
expect(parsed.type).toBe("fetch_workspaces_request");
|
||||
});
|
||||
|
||||
test('parses open_project_request', () => {
|
||||
test("parses open_project_request", () => {
|
||||
const parsed = SessionInboundMessageSchema.parse({
|
||||
type: 'open_project_request',
|
||||
cwd: '/tmp/repo',
|
||||
requestId: 'req-open',
|
||||
})
|
||||
type: "open_project_request",
|
||||
cwd: "/tmp/repo",
|
||||
requestId: "req-open",
|
||||
});
|
||||
|
||||
expect(parsed.type).toBe('open_project_request')
|
||||
})
|
||||
expect(parsed.type).toBe("open_project_request");
|
||||
});
|
||||
|
||||
test('rejects invalid workspace update payload', () => {
|
||||
test("rejects invalid workspace update payload", () => {
|
||||
const result = SessionOutboundMessageSchema.safeParse({
|
||||
type: 'workspace_update',
|
||||
type: "workspace_update",
|
||||
payload: {
|
||||
kind: 'upsert',
|
||||
kind: "upsert",
|
||||
workspace: {
|
||||
id: '/repo',
|
||||
projectId: '/repo',
|
||||
projectDisplayName: 'repo',
|
||||
projectRootPath: '/repo',
|
||||
projectKind: 'non_git',
|
||||
workspaceKind: 'directory',
|
||||
name: '',
|
||||
status: 'not-a-bucket',
|
||||
id: "/repo",
|
||||
projectId: "/repo",
|
||||
projectDisplayName: "repo",
|
||||
projectRootPath: "/repo",
|
||||
projectKind: "non_git",
|
||||
workspaceKind: "directory",
|
||||
name: "",
|
||||
status: "not-a-bucket",
|
||||
activityAt: null,
|
||||
},
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
})
|
||||
expect(result.success).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -119,9 +119,7 @@ function buildUnknownDetailOverride(input: ToolCallDisplayInput): DetailDisplay
|
||||
if (input.detail.type === "unknown" && lowerName === "task") {
|
||||
return {
|
||||
displayName: "Task",
|
||||
summary: isRecord(input.metadata)
|
||||
? readString(input.metadata.subAgentActivity)
|
||||
: undefined,
|
||||
summary: isRecord(input.metadata) ? readString(input.metadata.subAgentActivity) : undefined,
|
||||
};
|
||||
}
|
||||
if (input.detail.type === "unknown" && lowerName === "thinking") {
|
||||
|
||||
Reference in New Issue
Block a user