






















@@ -786,14 +786,7 @@ describe("runCliAgent spawn path", () => {
786786runId: "run-live-1",
787787prompt: "first",
788788backend: {
789-args: [
790-"-p",
791-"--output-format",
792-"stream-json",
793-"--strict-mcp-config",
794-"--mcp-config",
795-"/tmp/mcp-one.json",
796-],
789+args: ["-p", "--strict-mcp-config", "--mcp-config", "/tmp/mcp-one.json"],
797790liveSession: "claude-stdio",
798791},
799792mcpConfigHash: "same-mcp-config",
@@ -806,14 +799,7 @@ describe("runCliAgent spawn path", () => {
806799runId: "run-live-2",
807800prompt: "second",
808801backend: {
809-args: [
810-"-p",
811-"--output-format",
812-"stream-json",
813-"--strict-mcp-config",
814-"--mcp-config",
815-"/tmp/mcp-two.json",
816-],
802+args: ["-p", "--strict-mcp-config", "--mcp-config", "/tmp/mcp-two.json"],
817803liveSession: "claude-stdio",
818804},
819805mcpConfigHash: "same-mcp-config",
@@ -829,6 +815,7 @@ describe("runCliAgent spawn path", () => {
829815expect(supervisorSpawnMock).toHaveBeenCalledOnce();
830816expect(spawnInput.stdinMode).toBe("pipe-open");
831817expect(spawnInput.argv).toContain("--input-format");
818+expect(spawnInput.argv).toContain("--output-format");
832819expect(spawnInput.argv).toContain("stream-json");
833820expect(spawnInput.argv).toContain("--replay-user-messages");
834821expect(spawnInput.argv).not.toContain("--session-id");
@@ -1214,6 +1201,36 @@ describe("runCliAgent spawn path", () => {
12141201expect(args).not.toContain("current prompt");
12151202});
121612031204+it("adds Claude stream-json output format when building live session argv", () => {
1205+const backend: PreparedCliRunContext["preparedBackend"]["backend"] = {
1206+command: "claude",
1207+args: ["-p"],
1208+output: "jsonl",
1209+input: "stdin",
1210+sessionArg: "--session-id",
1211+systemPromptArg: "--append-system-prompt",
1212+systemPromptFileArg: "--append-system-prompt-file",
1213+};
1214+1215+const args = buildClaudeLiveArgs({
1216+args: ["-p"],
1217+ backend,
1218+systemPrompt: "current prompt",
1219+useResume: false,
1220+});
1221+1222+expect(args).toEqual(
1223+expect.arrayContaining([
1224+"--input-format",
1225+"stream-json",
1226+"--output-format",
1227+"stream-json",
1228+"--permission-prompt-tool",
1229+"stdio",
1230+]),
1231+);
1232+});
1233+12171234it("restarts Claude live sessions for env changes and fresh retries", async () => {
12181235const cancels: Array<ReturnType<typeof vi.fn>> = [];
12191236const turnResults = ["first-ok", "resume-ok", "env-ok", "fresh-ok"];
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。