

























@@ -74,7 +74,7 @@ describe("sessions_spawn tool", () => {
7474properties?: {
7575runtime?: { enum?: string[] };
7676resumeSessionId?: unknown;
77-streamTo?: unknown;
77+streamTo?: { description?: string };
7878};
7979};
8080@@ -94,7 +94,7 @@ describe("sessions_spawn tool", () => {
9494properties?: {
9595runtime?: { enum?: string[] };
9696resumeSessionId?: unknown;
97-streamTo?: unknown;
97+streamTo?: { description?: string };
9898};
9999};
100100@@ -103,6 +103,7 @@ describe("sessions_spawn tool", () => {
103103expect(schema.properties?.runtime?.enum).toEqual(["subagent", "acp"]);
104104expect(schema.properties?.resumeSessionId).toBeDefined();
105105expect(schema.properties?.streamTo).toBeDefined();
106+expect(schema.properties?.streamTo?.description).toContain('Requires runtime="acp"');
106107});
107108108109it("hides ACP runtime affordances when the ACP backend is unhealthy", () => {
@@ -489,7 +490,7 @@ describe("sessions_spawn tool", () => {
489490);
490491});
491492492-it("rejects resumeSessionId without runtime=acp", async () => {
493+it("ignores resumeSessionId without runtime=acp", async () => {
493494const tool = createSessionsSpawnTool({
494495agentSessionKey: "agent:main:main",
495496});
@@ -499,8 +500,20 @@ describe("sessions_spawn tool", () => {
499500resumeSessionId: "7f4a78e0-f6be-43fe-855c-c1c4fd229bc4",
500501});
501502502-expect(JSON.stringify(result)).toContain("resumeSessionId is only supported for runtime=acp");
503-expect(hoisted.spawnSubagentDirectMock).not.toHaveBeenCalled();
503+expect(result.details).toMatchObject({
504+status: "accepted",
505+childSessionKey: "agent:main:subagent:1",
506+runId: "run-subagent",
507+});
508+expect(hoisted.spawnSubagentDirectMock).toHaveBeenCalledWith(
509+expect.objectContaining({
510+task: "resume prior work",
511+}),
512+expect.any(Object),
513+);
514+expect(hoisted.spawnSubagentDirectMock.mock.calls[0]?.[0]).not.toHaveProperty(
515+"resumeSessionId",
516+);
504517expect(hoisted.spawnAcpDirectMock).not.toHaveBeenCalled();
505518});
506519@@ -529,7 +542,7 @@ describe("sessions_spawn tool", () => {
529542expect(hoisted.spawnSubagentDirectMock).not.toHaveBeenCalled();
530543});
531544532-it('rejects streamTo when runtime is not "acp"', async () => {
545+it('ignores streamTo when runtime is not "acp"', async () => {
533546const tool = createSessionsSpawnTool({
534547agentSessionKey: "agent:main:main",
535548});
@@ -541,12 +554,18 @@ describe("sessions_spawn tool", () => {
541554});
542555543556expect(result.details).toMatchObject({
544-status: "error",
557+status: "accepted",
558+childSessionKey: "agent:main:subagent:1",
559+runId: "run-subagent",
545560});
546-const details = result.details as { error?: string };
547-expect(details.error).toContain("streamTo is only supported for runtime=acp");
548561expect(hoisted.spawnAcpDirectMock).not.toHaveBeenCalled();
549-expect(hoisted.spawnSubagentDirectMock).not.toHaveBeenCalled();
562+expect(hoisted.spawnSubagentDirectMock).toHaveBeenCalledWith(
563+expect.objectContaining({
564+task: "analyze file",
565+}),
566+expect.any(Object),
567+);
568+expect(hoisted.spawnSubagentDirectMock.mock.calls[0]?.[0]).not.toHaveProperty("streamTo");
550569});
551570552571it("keeps attachment content schema unconstrained for llama.cpp grammar safety", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。