Remove chat rooms and agent loops before storage migration (#3053)
* refactor(storage): remove chat rooms and agent loops This is the prerequisite cleanup for the storage backend migration. Legacy wire schemas remain temporarily so mixed-version peers can still parse old messages, while daemon callers now use query-shaped AgentStorage methods that can map directly to SQL later. * test(cli): remove retired chat and loop coverage
This commit is contained in:
@@ -1294,56 +1294,6 @@ test("honors explicit shutdownServer timeout below the session RPC default", asy
|
||||
await expect(responsePromise).rejects.toThrow("Timeout waiting for message (1500ms)");
|
||||
});
|
||||
|
||||
test("honors explicit readChatMessages timeout below the session RPC default", async () => {
|
||||
useHeartbeatClock();
|
||||
const logger = createMockLogger();
|
||||
const mock = createMockTransport();
|
||||
|
||||
const client = new DaemonClient({
|
||||
url: "ws://test",
|
||||
clientId: "clsk_unit_test",
|
||||
logger,
|
||||
reconnect: { enabled: false },
|
||||
transportFactory: () => mock.transport,
|
||||
});
|
||||
clients.push(client);
|
||||
|
||||
const connectPromise = client.connect();
|
||||
mock.triggerOpen();
|
||||
await connectPromise;
|
||||
|
||||
const responsePromise = client.readChatMessages({
|
||||
requestId: "req-chat-read-1",
|
||||
room: "room-1",
|
||||
limit: 1,
|
||||
timeout: 2_500,
|
||||
});
|
||||
let settled = false;
|
||||
void responsePromise.then(
|
||||
() => {
|
||||
settled = true;
|
||||
return undefined;
|
||||
},
|
||||
() => {
|
||||
settled = true;
|
||||
return undefined;
|
||||
},
|
||||
);
|
||||
|
||||
expect(parseSentFrame(mock.sent[0])).toEqual({
|
||||
type: "chat/read",
|
||||
requestId: "req-chat-read-1",
|
||||
room: "room-1",
|
||||
limit: 1,
|
||||
});
|
||||
|
||||
await vi.advanceTimersByTimeAsync(2_499);
|
||||
expect(settled).toBe(false);
|
||||
|
||||
await vi.advanceTimersByTimeAsync(1);
|
||||
await expect(responsePromise).rejects.toThrow("Timeout waiting for message (2500ms)");
|
||||
});
|
||||
|
||||
test("honors explicit getDaemonStatus timeout below the session RPC default", async () => {
|
||||
useHeartbeatClock();
|
||||
const logger = createMockLogger();
|
||||
|
||||
@@ -492,30 +492,6 @@ type SubscribeTerminalPayload = SubscribeTerminalResponse["payload"];
|
||||
type CloseItemsPayload = CloseItemsResponse["payload"];
|
||||
type KillTerminalPayload = KillTerminalResponse["payload"];
|
||||
type CaptureTerminalPayload = CaptureTerminalResponse["payload"];
|
||||
type ChatCreatePayload = Extract<
|
||||
SessionOutboundMessage,
|
||||
{ type: "chat/create/response" }
|
||||
>["payload"];
|
||||
type ChatListPayload = Extract<SessionOutboundMessage, { type: "chat/list/response" }>["payload"];
|
||||
type ChatInspectPayload = Extract<
|
||||
SessionOutboundMessage,
|
||||
{ type: "chat/inspect/response" }
|
||||
>["payload"];
|
||||
type ChatDeletePayload = Extract<
|
||||
SessionOutboundMessage,
|
||||
{ type: "chat/delete/response" }
|
||||
>["payload"];
|
||||
type ChatPostPayload = Extract<SessionOutboundMessage, { type: "chat/post/response" }>["payload"];
|
||||
type ChatReadPayload = Extract<SessionOutboundMessage, { type: "chat/read/response" }>["payload"];
|
||||
type ChatWaitPayload = Extract<SessionOutboundMessage, { type: "chat/wait/response" }>["payload"];
|
||||
type LoopRunPayload = Extract<SessionOutboundMessage, { type: "loop/run/response" }>["payload"];
|
||||
type LoopListPayload = Extract<SessionOutboundMessage, { type: "loop/list/response" }>["payload"];
|
||||
type LoopInspectPayload = Extract<
|
||||
SessionOutboundMessage,
|
||||
{ type: "loop/inspect/response" }
|
||||
>["payload"];
|
||||
type LoopLogsPayload = Extract<SessionOutboundMessage, { type: "loop/logs/response" }>["payload"];
|
||||
type LoopStopPayload = Extract<SessionOutboundMessage, { type: "loop/stop/response" }>["payload"];
|
||||
type ScheduleCreatePayload = Extract<
|
||||
SessionOutboundMessage,
|
||||
{ type: "schedule/create/response" }
|
||||
@@ -697,70 +673,6 @@ export type ProjectListPayload = Extract<
|
||||
SessionOutboundMessage,
|
||||
{ type: "project.list.response" }
|
||||
>["payload"];
|
||||
export interface CreateChatRoomOptions {
|
||||
name: string;
|
||||
purpose?: string | null;
|
||||
requestId?: string;
|
||||
}
|
||||
export interface InspectChatRoomOptions {
|
||||
room: string;
|
||||
requestId?: string;
|
||||
}
|
||||
export interface DeleteChatRoomOptions {
|
||||
room: string;
|
||||
requestId?: string;
|
||||
}
|
||||
export interface PostChatMessageOptions {
|
||||
room: string;
|
||||
body: string;
|
||||
authorAgentId?: string;
|
||||
replyToMessageId?: string | null;
|
||||
requestId?: string;
|
||||
}
|
||||
export interface ReadChatMessagesOptions {
|
||||
room: string;
|
||||
limit?: number;
|
||||
since?: string;
|
||||
authorAgentId?: string;
|
||||
requestId?: string;
|
||||
timeout?: number;
|
||||
}
|
||||
export interface WaitForChatMessagesOptions {
|
||||
room: string;
|
||||
afterMessageId?: string | null;
|
||||
timeoutMs?: number;
|
||||
requestId?: string;
|
||||
}
|
||||
export interface RunLoopOptions {
|
||||
prompt: string;
|
||||
cwd: string;
|
||||
provider?: string;
|
||||
model?: string;
|
||||
modeId?: string;
|
||||
verifierProvider?: string;
|
||||
verifierModel?: string;
|
||||
verifierModeId?: string;
|
||||
verifyPrompt?: string | null;
|
||||
verifyChecks?: string[];
|
||||
name?: string | null;
|
||||
sleepMs?: number;
|
||||
maxIterations?: number;
|
||||
maxTimeMs?: number;
|
||||
requestId?: string;
|
||||
}
|
||||
export interface InspectLoopOptions {
|
||||
id: string;
|
||||
requestId?: string;
|
||||
}
|
||||
export interface LoopLogsOptions {
|
||||
id: string;
|
||||
afterSeq?: number;
|
||||
requestId?: string;
|
||||
}
|
||||
export interface StopLoopOptions {
|
||||
id: string;
|
||||
requestId?: string;
|
||||
}
|
||||
export interface CreateScheduleOptions {
|
||||
prompt: string;
|
||||
name?: string | null;
|
||||
@@ -5116,93 +5028,6 @@ export class DaemonClient {
|
||||
});
|
||||
}
|
||||
|
||||
async createChatRoom(options: CreateChatRoomOptions): Promise<ChatCreatePayload> {
|
||||
return this.sendCorrelatedSessionRequest({
|
||||
requestId: options.requestId,
|
||||
message: {
|
||||
type: "chat/create",
|
||||
name: options.name,
|
||||
...(options.purpose ? { purpose: options.purpose } : {}),
|
||||
},
|
||||
responseType: "chat/create/response",
|
||||
});
|
||||
}
|
||||
|
||||
async listChatRooms(requestId?: string): Promise<ChatListPayload> {
|
||||
return this.sendCorrelatedSessionRequest({
|
||||
requestId,
|
||||
message: {
|
||||
type: "chat/list",
|
||||
},
|
||||
responseType: "chat/list/response",
|
||||
});
|
||||
}
|
||||
|
||||
async inspectChatRoom(options: InspectChatRoomOptions): Promise<ChatInspectPayload> {
|
||||
return this.sendCorrelatedSessionRequest({
|
||||
requestId: options.requestId,
|
||||
message: {
|
||||
type: "chat/inspect",
|
||||
room: options.room,
|
||||
},
|
||||
responseType: "chat/inspect/response",
|
||||
});
|
||||
}
|
||||
|
||||
async deleteChatRoom(options: DeleteChatRoomOptions): Promise<ChatDeletePayload> {
|
||||
return this.sendCorrelatedSessionRequest({
|
||||
requestId: options.requestId,
|
||||
message: {
|
||||
type: "chat/delete",
|
||||
room: options.room,
|
||||
},
|
||||
responseType: "chat/delete/response",
|
||||
});
|
||||
}
|
||||
|
||||
async postChatMessage(options: PostChatMessageOptions): Promise<ChatPostPayload> {
|
||||
return this.sendCorrelatedSessionRequest({
|
||||
requestId: options.requestId,
|
||||
message: {
|
||||
type: "chat/post",
|
||||
room: options.room,
|
||||
body: options.body,
|
||||
...(options.authorAgentId ? { authorAgentId: options.authorAgentId } : {}),
|
||||
...(options.replyToMessageId ? { replyToMessageId: options.replyToMessageId } : {}),
|
||||
},
|
||||
responseType: "chat/post/response",
|
||||
});
|
||||
}
|
||||
|
||||
async readChatMessages(options: ReadChatMessagesOptions): Promise<ChatReadPayload> {
|
||||
return this.sendCorrelatedSessionRequest({
|
||||
requestId: options.requestId,
|
||||
message: {
|
||||
type: "chat/read",
|
||||
room: options.room,
|
||||
...(typeof options.limit === "number" ? { limit: options.limit } : {}),
|
||||
...(options.since ? { since: options.since } : {}),
|
||||
...(options.authorAgentId ? { authorAgentId: options.authorAgentId } : {}),
|
||||
},
|
||||
responseType: "chat/read/response",
|
||||
timeout: options.timeout,
|
||||
});
|
||||
}
|
||||
|
||||
async waitForChatMessages(options: WaitForChatMessagesOptions): Promise<ChatWaitPayload> {
|
||||
return this.sendCorrelatedSessionRequest({
|
||||
requestId: options.requestId,
|
||||
message: {
|
||||
type: "chat/wait",
|
||||
room: options.room,
|
||||
...(options.afterMessageId ? { afterMessageId: options.afterMessageId } : {}),
|
||||
...(typeof options.timeoutMs === "number" ? { timeoutMs: options.timeoutMs } : {}),
|
||||
},
|
||||
responseType: "chat/wait/response",
|
||||
timeout: (options.timeoutMs ?? 0) + 10000,
|
||||
});
|
||||
}
|
||||
|
||||
async scheduleCreate(options: CreateScheduleOptions): Promise<ScheduleCreatePayload> {
|
||||
return this.sendCorrelatedSessionRequest({
|
||||
requestId: options.requestId,
|
||||
@@ -5313,81 +5138,6 @@ export class DaemonClient {
|
||||
});
|
||||
}
|
||||
|
||||
async loopRun(options: RunLoopOptions): Promise<LoopRunPayload> {
|
||||
return this.sendCorrelatedSessionRequest({
|
||||
requestId: options.requestId,
|
||||
message: {
|
||||
type: "loop/run",
|
||||
prompt: options.prompt,
|
||||
cwd: options.cwd,
|
||||
...(options.provider ? { provider: options.provider } : {}),
|
||||
...(options.model ? { model: options.model } : {}),
|
||||
...(options.modeId ? { modeId: options.modeId } : {}),
|
||||
...(options.verifierProvider ? { verifierProvider: options.verifierProvider } : {}),
|
||||
...(options.verifierModel ? { verifierModel: options.verifierModel } : {}),
|
||||
...(options.verifierModeId ? { verifierModeId: options.verifierModeId } : {}),
|
||||
...(options.verifyPrompt ? { verifyPrompt: options.verifyPrompt } : {}),
|
||||
...(options.verifyChecks && options.verifyChecks.length > 0
|
||||
? { verifyChecks: options.verifyChecks }
|
||||
: {}),
|
||||
...(options.name ? { name: options.name } : {}),
|
||||
...(typeof options.sleepMs === "number" ? { sleepMs: options.sleepMs } : {}),
|
||||
...(typeof options.maxIterations === "number"
|
||||
? { maxIterations: options.maxIterations }
|
||||
: {}),
|
||||
...(typeof options.maxTimeMs === "number" ? { maxTimeMs: options.maxTimeMs } : {}),
|
||||
},
|
||||
responseType: "loop/run/response",
|
||||
});
|
||||
}
|
||||
|
||||
async loopList(requestId?: string): Promise<LoopListPayload> {
|
||||
return this.sendCorrelatedSessionRequest({
|
||||
requestId,
|
||||
message: {
|
||||
type: "loop/list",
|
||||
},
|
||||
responseType: "loop/list/response",
|
||||
});
|
||||
}
|
||||
|
||||
async loopInspect(options: string | InspectLoopOptions): Promise<LoopInspectPayload> {
|
||||
const normalized = typeof options === "string" ? { id: options } : options;
|
||||
return this.sendCorrelatedSessionRequest({
|
||||
requestId: normalized.requestId,
|
||||
message: {
|
||||
type: "loop/inspect",
|
||||
id: normalized.id,
|
||||
},
|
||||
responseType: "loop/inspect/response",
|
||||
});
|
||||
}
|
||||
|
||||
async loopLogs(options: string | LoopLogsOptions, afterSeq?: number): Promise<LoopLogsPayload> {
|
||||
const normalized = typeof options === "string" ? { id: options, afterSeq } : options;
|
||||
return this.sendCorrelatedSessionRequest({
|
||||
requestId: normalized.requestId,
|
||||
message: {
|
||||
type: "loop/logs",
|
||||
id: normalized.id,
|
||||
...(typeof normalized.afterSeq === "number" ? { afterSeq: normalized.afterSeq } : {}),
|
||||
},
|
||||
responseType: "loop/logs/response",
|
||||
});
|
||||
}
|
||||
|
||||
async loopStop(options: string | StopLoopOptions): Promise<LoopStopPayload> {
|
||||
const normalized = typeof options === "string" ? { id: options } : options;
|
||||
return this.sendCorrelatedSessionRequest({
|
||||
requestId: normalized.requestId,
|
||||
message: {
|
||||
type: "loop/stop",
|
||||
id: normalized.id,
|
||||
},
|
||||
responseType: "loop/stop/response",
|
||||
});
|
||||
}
|
||||
|
||||
onTerminalStreamEvent(handler: (event: TerminalStreamEvent) => void): () => void {
|
||||
return this.terminalStreams.onEvent(handler);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user