@agentclientprotocol/claude-agent-acp 0.110.1-preview.4 → 0.110.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/air-extension.d.ts +2 -0
- package/dist/air-extension.d.ts.map +1 -1
- package/dist/air-extension.js +2 -0
- package/dist/elicitation.d.ts.map +1 -1
- package/dist/elicitation.js +6 -1
- package/dist/native-subagents.d.ts +11 -5
- package/dist/native-subagents.d.ts.map +1 -1
- package/dist/native-subagents.js +53 -11
- package/dist/steering-priority.d.ts +3 -0
- package/dist/steering-priority.d.ts.map +1 -0
- package/dist/steering-priority.js +4 -0
- package/dist/subagent-replay.d.ts +14 -12
- package/dist/subagent-replay.d.ts.map +1 -1
- package/dist/subagent-replay.js +29 -13
- package/dist/v1/acp-agent.d.ts.map +1 -1
- package/dist/v1/acp-agent.js +25 -4
- package/dist/v1/steering.d.ts +1 -8
- package/dist/v1/steering.d.ts.map +1 -1
- package/dist/v1/steering.js +0 -7
- package/dist/v2/agent.d.ts.map +1 -1
- package/dist/v2/agent.js +16 -11
- package/dist/v2/background.d.ts +3 -10
- package/dist/v2/background.d.ts.map +1 -1
- package/dist/v2/clear-context.d.ts +3 -4
- package/dist/v2/clear-context.d.ts.map +1 -1
- package/dist/v2/clear-context.js +8 -9
- package/dist/v2/elicitation.d.ts +1 -1
- package/dist/v2/elicitation.d.ts.map +1 -1
- package/dist/v2/elicitation.js +18 -15
- package/dist/v2/restarts.d.ts +3 -3
- package/dist/v2/restarts.d.ts.map +1 -1
- package/dist/v2/restarts.js +12 -12
- package/dist/v2/session.d.ts +16 -11
- package/dist/v2/session.d.ts.map +1 -1
- package/dist/v2/session.js +138 -42
- package/dist/v2/stream.d.ts +2 -0
- package/dist/v2/stream.d.ts.map +1 -1
- package/dist/v2/stream.js +11 -0
- package/dist/v2/subagent-replay.d.ts +1 -5
- package/dist/v2/subagent-replay.d.ts.map +1 -1
- package/dist/v2/subagent-replay.js +5 -10
- package/dist/v2/tasks.d.ts +20 -4
- package/dist/v2/tasks.d.ts.map +1 -1
- package/dist/v2/tasks.js +52 -8
- package/package.json +1 -1
package/dist/v2/tasks.js
CHANGED
|
@@ -56,7 +56,7 @@ import * as path from "node:path";
|
|
|
56
56
|
import { RequestError } from "@agentclientprotocol/sdk/unstable";
|
|
57
57
|
import { backgroundBashTaskFromToolResult, taskProgressFields } from "../async-tasks.js";
|
|
58
58
|
import { BackgroundOutputTail, foregroundCommandToolCall, isCommandTool, TaskOutputPoll, } from "../background-output.js";
|
|
59
|
-
import { childModelOption, endsMessageWait, endWaitsForMessages, HANDBACK_TOOL, handbackMessage, isNativeSubagentControlTool, launchReply, linkedSessionMessages, mergeSubagentIdentity, responseModelEntry, resumedNativeSubagentId, rfdLabels, sendMessageResume, subagentIdentity, targetAgentId, unexposedControlFallback, withSessionReference, } from "../native-subagents.js";
|
|
59
|
+
import { childModelOption, endsMessageWait, endWaitsForMessages, HANDBACK_TOOL, handbackMessage, handbackReportText, isNativeSubagentControlTool, launchReply, linkedSessionMessages, mergeSubagentIdentity, responseModelEntry, resumedNativeSubagentId, rfdLabels, sendMessageResume, subagentIdentity, targetAgentId, unexposedControlFallback, withSessionReference, } from "../native-subagents.js";
|
|
60
60
|
import { subagentLineage } from "../subagent-history.js";
|
|
61
61
|
import { streamedTerminals, withRunningTerminal, withRunningToolCall, withStreamedTerminal, } from "../tool-calls/background.js";
|
|
62
62
|
import { ClientCapabilities } from "../tool-calls/client-capabilities.js";
|
|
@@ -254,6 +254,7 @@ export class SessionTasks {
|
|
|
254
254
|
// Before the result's own updates: a SendMessage call whose message
|
|
255
255
|
// reached its child is that message.
|
|
256
256
|
this.sendMessageResumed(message, results, toolUses);
|
|
257
|
+
this.handbackResult(output, message, results);
|
|
257
258
|
const command = backgroundBashTaskFromToolResult(content, message.tool_use_result, toolUses, (toolUseId) => [...this.started].find(([, task]) => task.toolUseId === toolUseId && task.taskType === "local_bash")?.[0]);
|
|
258
259
|
// A fast command can end before its result: then its terminal exits with it.
|
|
259
260
|
const runningTerminal = command && this.started.has(command.taskId) ? command.toolCallId : undefined;
|
|
@@ -334,10 +335,35 @@ export class SessionTasks {
|
|
|
334
335
|
configuration: (sessionId) => this.hasChild(sessionId) ? this.configs.published(sessionId) : undefined,
|
|
335
336
|
});
|
|
336
337
|
}
|
|
337
|
-
/** Whether a subagent
|
|
338
|
-
|
|
338
|
+
/** Whether a subagent still runs, including in the background. */
|
|
339
|
+
hasLiveAgents() {
|
|
339
340
|
return this.agents.size > 0;
|
|
340
341
|
}
|
|
342
|
+
/** Whether a child awaits permission or an elicitation response. */
|
|
343
|
+
hasOpenRequests() {
|
|
344
|
+
return this.agentRequests.size > 0;
|
|
345
|
+
}
|
|
346
|
+
/** Whether a child, terminal, tool task, or child request remains. */
|
|
347
|
+
hasLiveWork() {
|
|
348
|
+
return (this.hasLiveAgents() ||
|
|
349
|
+
this.terminals.size > 0 ||
|
|
350
|
+
this.toolCalls.size > 0 ||
|
|
351
|
+
this.hasOpenRequests());
|
|
352
|
+
}
|
|
353
|
+
/** Whether a root tool can progress independently of the waiting requests and delegated work. */
|
|
354
|
+
foregroundToolsCanProgress(waiting) {
|
|
355
|
+
const excluded = this.backgroundCalls(this.host.sessionId);
|
|
356
|
+
for (const [toolCallId, child] of this.childByToolUse) {
|
|
357
|
+
if (child.parentSessionId === this.host.sessionId)
|
|
358
|
+
excluded.add(toolCallId);
|
|
359
|
+
}
|
|
360
|
+
for (const agentId of this.agents.keys()) {
|
|
361
|
+
const toolCallId = this.started.get(agentId)?.toolUseId;
|
|
362
|
+
if (toolCallId)
|
|
363
|
+
excluded.add(toolCallId);
|
|
364
|
+
}
|
|
365
|
+
return this.rootOutput.hasProgressingTool(waiting, excluded);
|
|
366
|
+
}
|
|
341
367
|
/**
|
|
342
368
|
* Whether `sessionId` is a child session that this root announced in its
|
|
343
369
|
* current conversation. A child that only a replay announced, or one from
|
|
@@ -748,6 +774,7 @@ export class SessionTasks {
|
|
|
748
774
|
items: lists.get(this.host.sessionId) ?? [],
|
|
749
775
|
state: this.host.rootState(),
|
|
750
776
|
}));
|
|
777
|
+
this.host.foregroundRequestsChanged();
|
|
751
778
|
}
|
|
752
779
|
// --- Task events ----------------------------------------------------------------
|
|
753
780
|
taskStarted(message) {
|
|
@@ -1425,13 +1452,30 @@ export class SessionTasks {
|
|
|
1425
1452
|
if (update.status !== "completed" || !handback.message) {
|
|
1426
1453
|
return [unexposedControlFallback(handback.initial, notification, child.sessionId)];
|
|
1427
1454
|
}
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1455
|
+
this.publishHandback(child, handback.delegationId ?? update.toolCallId, handback.message, update.toolCallId);
|
|
1456
|
+
return [];
|
|
1457
|
+
}
|
|
1458
|
+
/** A launch result carries the report when Claude Code sends no child stream. */
|
|
1459
|
+
handbackResult(output, message, results) {
|
|
1460
|
+
if (results.length !== 1 || results[0].is_error)
|
|
1461
|
+
return;
|
|
1462
|
+
const text = handbackReportText(message.tool_use_result);
|
|
1463
|
+
if (text === undefined)
|
|
1464
|
+
return;
|
|
1465
|
+
const launchId = results[0].tool_use_id;
|
|
1466
|
+
const child = this.childByToolUse.get(launchId);
|
|
1467
|
+
if (!child || child.handedBack.has(launchId))
|
|
1468
|
+
return;
|
|
1469
|
+
if (!child.announced)
|
|
1470
|
+
this.announce(child, output.sessionId);
|
|
1471
|
+
this.publishHandback(child, launchId, text, `${launchId}:handback`);
|
|
1472
|
+
}
|
|
1473
|
+
publishHandback(child, delegationId, text, messageId) {
|
|
1474
|
+
child.handedBack.add(delegationId);
|
|
1475
|
+
const [outgoing, incoming] = linkedSessionMessages(messageId, child.sessionId, child.parentSessionId, text);
|
|
1476
|
+
// Sent in order: each output routes its updates after the preceding ones.
|
|
1432
1477
|
child.output.emitV1([outgoing]);
|
|
1433
1478
|
this.outputOf(child.parentSessionId)?.emitV1([incoming]);
|
|
1434
|
-
return [];
|
|
1435
1479
|
}
|
|
1436
1480
|
/**
|
|
1437
1481
|
* A SendMessage result that reports the agent it resumed (`resumedAgentId`):
|
package/package.json
CHANGED