@ycodium-ai/agent-claude 0.2.2926 → 0.2.2934
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/index.js +42 -25
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -21423,6 +21423,9 @@ var makeAssistantText = (emitter) => {
|
|
|
21423
21423
|
if (!options?.force && !block.streamClosed) {
|
|
21424
21424
|
return;
|
|
21425
21425
|
}
|
|
21426
|
+
if (!options?.force && !block.emittedTextDelta && block.fallbackText.length === 0) {
|
|
21427
|
+
return;
|
|
21428
|
+
}
|
|
21426
21429
|
if (!block.emittedTextDelta && block.fallbackText.length > 0) {
|
|
21427
21430
|
const deltaStamp = await makeEventStamp();
|
|
21428
21431
|
offerRuntimeEvent(context, {
|
|
@@ -23090,6 +23093,12 @@ var makeSessionCallbacks = (deps) => {
|
|
|
23090
23093
|
message: "Claude session context is unavailable."
|
|
23091
23094
|
};
|
|
23092
23095
|
}
|
|
23096
|
+
if (context.stopped) {
|
|
23097
|
+
return {
|
|
23098
|
+
behavior: "deny",
|
|
23099
|
+
message: "Claude session has stopped."
|
|
23100
|
+
};
|
|
23101
|
+
}
|
|
23093
23102
|
if (toolName === "AskUserQuestion") {
|
|
23094
23103
|
return await handleAskUserQuestion(context, toolInput, callbackOptions);
|
|
23095
23104
|
}
|
|
@@ -23169,30 +23178,32 @@ var makeSessionCallbacks = (deps) => {
|
|
|
23169
23178
|
if (callbackOptions.signal.aborted) {
|
|
23170
23179
|
onAbort();
|
|
23171
23180
|
}
|
|
23172
|
-
const { decision, reason: declineReason } = await decisionDeferred.promise;
|
|
23181
|
+
const { decision, reason: declineReason, resolvedEventSent } = await decisionDeferred.promise;
|
|
23173
23182
|
pendingApprovals.delete(requestId);
|
|
23174
|
-
|
|
23175
|
-
|
|
23176
|
-
|
|
23177
|
-
|
|
23178
|
-
|
|
23179
|
-
|
|
23180
|
-
|
|
23181
|
-
requestType,
|
|
23182
|
-
decision,
|
|
23183
|
-
...declineReason ? { reason: declineReason } : {}
|
|
23184
|
-
},
|
|
23185
|
-
providerRefs: nativeProviderRefs({
|
|
23186
|
-
providerItemId: callbackOptions.toolUseID
|
|
23187
|
-
}),
|
|
23188
|
-
raw: {
|
|
23189
|
-
source: "claude.sdk.permission",
|
|
23190
|
-
method: "canUseTool/decision",
|
|
23183
|
+
if (resolvedEventSent !== true) {
|
|
23184
|
+
const resolvedStamp = await makeEventStamp();
|
|
23185
|
+
offerRuntimeEvent(context, {
|
|
23186
|
+
type: "request.resolved",
|
|
23187
|
+
...eventHeader(context, resolvedStamp),
|
|
23188
|
+
...context.turnState ? { turnId: asCanonicalTurnId(context.turnState.turnId) } : {},
|
|
23189
|
+
requestId: asRuntimeRequestId(requestId),
|
|
23191
23190
|
payload: {
|
|
23192
|
-
|
|
23191
|
+
requestType,
|
|
23192
|
+
decision,
|
|
23193
|
+
...declineReason ? { reason: declineReason } : {}
|
|
23194
|
+
},
|
|
23195
|
+
providerRefs: nativeProviderRefs({
|
|
23196
|
+
providerItemId: callbackOptions.toolUseID
|
|
23197
|
+
}),
|
|
23198
|
+
raw: {
|
|
23199
|
+
source: "claude.sdk.permission",
|
|
23200
|
+
method: "canUseTool/decision",
|
|
23201
|
+
payload: {
|
|
23202
|
+
decision
|
|
23203
|
+
}
|
|
23193
23204
|
}
|
|
23194
|
-
}
|
|
23195
|
-
}
|
|
23205
|
+
});
|
|
23206
|
+
}
|
|
23196
23207
|
if (decision === "accept" || decision === "acceptForSession") {
|
|
23197
23208
|
return {
|
|
23198
23209
|
behavior: "allow",
|
|
@@ -23403,12 +23414,13 @@ var makeSessionLifecycle = (deps) => {
|
|
|
23403
23414
|
context.stopping = true;
|
|
23404
23415
|
const work = (async () => {
|
|
23405
23416
|
context.stopped = true;
|
|
23417
|
+
let closeFailure;
|
|
23406
23418
|
try {
|
|
23407
23419
|
context.query.close();
|
|
23408
23420
|
} catch (cause) {
|
|
23409
|
-
|
|
23421
|
+
closeFailure = new Error("Failed to close Claude runtime query.", { cause });
|
|
23410
23422
|
}
|
|
23411
|
-
for (const taskId of Array.from(context.liveTaskIds)) {
|
|
23423
|
+
for (const taskId of closeFailure ? [] : Array.from(context.liveTaskIds)) {
|
|
23412
23424
|
if (!context.liveTaskIds.delete(taskId)) {
|
|
23413
23425
|
continue;
|
|
23414
23426
|
}
|
|
@@ -23426,7 +23438,7 @@ var makeSessionLifecycle = (deps) => {
|
|
|
23426
23438
|
});
|
|
23427
23439
|
}
|
|
23428
23440
|
for (const [requestId, pending] of context.pendingApprovals) {
|
|
23429
|
-
pending.decision.resolve({ decision: "cancel" });
|
|
23441
|
+
pending.decision.resolve({ decision: "cancel", resolvedEventSent: true });
|
|
23430
23442
|
const stamp = await makeEventStamp();
|
|
23431
23443
|
offerRuntimeEvent(context, {
|
|
23432
23444
|
type: "request.resolved",
|
|
@@ -23447,6 +23459,7 @@ var makeSessionLifecycle = (deps) => {
|
|
|
23447
23459
|
if (context.turnState) {
|
|
23448
23460
|
await completeTurn(context, "interrupted", "Session stopped.");
|
|
23449
23461
|
}
|
|
23462
|
+
if (closeFailure) throw closeFailure;
|
|
23450
23463
|
context.promptQueue.terminate();
|
|
23451
23464
|
const streamFiber = context.streamFiber;
|
|
23452
23465
|
context.streamFiber = void 0;
|
|
@@ -24439,6 +24452,7 @@ var makeSystemMessageHandler = (deps) => {
|
|
|
24439
24452
|
}
|
|
24440
24453
|
offerRuntimeEvent(context, {
|
|
24441
24454
|
...base,
|
|
24455
|
+
...eventHeader(context, await makeEventStamp()),
|
|
24442
24456
|
type: "thread.state.changed",
|
|
24443
24457
|
payload: {
|
|
24444
24458
|
state: "compacting",
|
|
@@ -24963,6 +24977,9 @@ var makeTurnLifecycle = (deps) => {
|
|
|
24963
24977
|
status: status === "completed" ? "completed" : "failed",
|
|
24964
24978
|
title: tool.title,
|
|
24965
24979
|
...tool.detail ? { detail: tool.detail } : {},
|
|
24980
|
+
// 归属与这件工具的开始、更新事件一致:子 agent 的工具被打断后仍收在它名下。
|
|
24981
|
+
...tool.agentId ? { agentId: tool.agentId } : {},
|
|
24982
|
+
...tool.parentToolUseId ? { parentToolUseId: tool.parentToolUseId } : {},
|
|
24966
24983
|
data: {
|
|
24967
24984
|
toolName: tool.toolName,
|
|
24968
24985
|
input: tool.input
|
|
@@ -27663,13 +27680,13 @@ function createClaudeAdapter(recipe, host, options) {
|
|
|
27663
27680
|
const results = await Promise.allSettled(
|
|
27664
27681
|
[...sessions.values()].map((ctx) => stopSessionInternal(ctx, { emitExitEvent: false }))
|
|
27665
27682
|
);
|
|
27683
|
+
runtimeEventQueue.close();
|
|
27666
27684
|
const failures = results.flatMap(
|
|
27667
27685
|
(result) => result.status === "rejected" ? [result.reason] : []
|
|
27668
27686
|
);
|
|
27669
27687
|
if (failures.length > 0) {
|
|
27670
27688
|
throw new AggregateError(failures, "Failed to stop Claude runtime sessions.");
|
|
27671
27689
|
}
|
|
27672
|
-
runtimeEventQueue.close();
|
|
27673
27690
|
}
|
|
27674
27691
|
};
|
|
27675
27692
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-claude",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2934",
|
|
4
4
|
"description": "Claude executor: Claude Code CLI via @anthropic-ai/claude-agent-sdk.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"@types/node": "24.12.4",
|
|
25
25
|
"esbuild": "0.28.1",
|
|
26
26
|
"vite-plus": "0.2.2",
|
|
27
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
27
|
+
"@ycodium-ai/plugin-api": "0.2.2934",
|
|
28
28
|
"ycodium-executor-testing": "0.0.0",
|
|
29
|
-
"ycodium-
|
|
30
|
-
"ycodium-
|
|
29
|
+
"ycodium-jsonl-stream": "0.0.0",
|
|
30
|
+
"ycodium-composer-tokens": "0.0.0"
|
|
31
31
|
},
|
|
32
32
|
"ycodium": {
|
|
33
33
|
"plugin": "./dist/index.js",
|