





















@@ -13,13 +13,19 @@ vi.mock("./app-last-active-session.ts", () => ({
1313}));
14141515let handleSendChat: typeof import("./app-chat.ts").handleSendChat;
16+let steerQueuedChatMessage: typeof import("./app-chat.ts").steerQueuedChatMessage;
1617let handleAbortChat: typeof import("./app-chat.ts").handleAbortChat;
1718let refreshChatAvatar: typeof import("./app-chat.ts").refreshChatAvatar;
1819let clearPendingQueueItemsForRun: typeof import("./app-chat.ts").clearPendingQueueItemsForRun;
19202021async function loadChatHelpers(): Promise<void> {
21-({ handleSendChat, handleAbortChat, refreshChatAvatar, clearPendingQueueItemsForRun } =
22-await import("./app-chat.ts"));
22+({
23+ handleSendChat,
24+ steerQueuedChatMessage,
25+ handleAbortChat,
26+ refreshChatAvatar,
27+ clearPendingQueueItemsForRun,
28+} = await import("./app-chat.ts"));
2329}
24302531function requestUrl(input: string | URL | Request): string {
@@ -514,6 +520,42 @@ describe("handleSendChat", () => {
514520expect(host.chatQueue).toEqual([
515521expect.objectContaining({
516522text: "/steer tighten the plan",
523+kind: "steered",
524+pendingRunId: "run-1",
525+}),
526+]);
527+});
528+529+it("steers a queued message into the active run without replacing run tracking", async () => {
530+const request = vi.fn(async (method: string) => {
531+if (method === "chat.send") {
532+return { status: "started", runId: "steer-run" };
533+}
534+throw new Error(`Unexpected request: ${method}`);
535+});
536+const host = makeHost({
537+client: { request } as unknown as ChatHost["client"],
538+chatRunId: "run-1",
539+chatStream: "Working...",
540+chatQueue: [{ id: "queued-1", text: "tighten the plan", createdAt: 1 }],
541+sessionKey: "agent:main:main",
542+});
543+544+await steerQueuedChatMessage(host, "queued-1");
545+546+expect(request).toHaveBeenCalledWith("chat.send", {
547+sessionKey: "agent:main:main",
548+message: "tighten the plan",
549+deliver: false,
550+idempotencyKey: expect.any(String),
551+attachments: undefined,
552+});
553+expect(host.chatRunId).toBe("run-1");
554+expect(host.chatStream).toBe("Working...");
555+expect(host.chatQueue).toEqual([
556+expect.objectContaining({
557+text: "tighten the plan",
558+kind: "steered",
517559pendingRunId: "run-1",
518560}),
519561]);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。