agentbox-sdk 0.1.311 → 0.1.313
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/agents/index.js
CHANGED
|
@@ -549,6 +549,7 @@ var ClaudeCodeLogAssembler = class {
|
|
|
549
549
|
currentMessageId = null;
|
|
550
550
|
textByMessageId = /* @__PURE__ */ new Map();
|
|
551
551
|
thinkingByMessageId = /* @__PURE__ */ new Map();
|
|
552
|
+
parentToolUseIdByMessageId = /* @__PURE__ */ new Map();
|
|
552
553
|
byMessageId = /* @__PURE__ */ new Map();
|
|
553
554
|
// Per-message tool_use / image / other non-text-non-thinking content blocks.
|
|
554
555
|
// Tracked persistently so any `upsertMessage` call (including those from a
|
|
@@ -557,6 +558,13 @@ var ClaudeCodeLogAssembler = class {
|
|
|
557
558
|
// tool_use blocks, and the UI's dedup-by-messageId would wipe the running
|
|
558
559
|
// command from the trace.
|
|
559
560
|
extraBlocksByMessageId = /* @__PURE__ */ new Map();
|
|
561
|
+
// Non-message events emitted by `process()` (e.g. `type: "user"` tool_result
|
|
562
|
+
// blocks, `type: "result"`, `type: "system"`). These carry data downstream
|
|
563
|
+
// consumers need to render the full trace — most importantly the Bash /
|
|
564
|
+
// tool_use output captured by `tool_result` user messages. Tracked in
|
|
565
|
+
// insertion order so `getSnapshots()` returns the full trace, not just the
|
|
566
|
+
// deduped assistant messages.
|
|
567
|
+
passThroughSnapshots = [];
|
|
560
568
|
process(event) {
|
|
561
569
|
if (!isRecord(event)) return [];
|
|
562
570
|
const type = typeof event.type === "string" ? event.type : "";
|
|
@@ -569,6 +577,7 @@ var ClaudeCodeLogAssembler = class {
|
|
|
569
577
|
const id = message && typeof message.id === "string" ? message.id : null;
|
|
570
578
|
if (!id) return [];
|
|
571
579
|
this.currentMessageId = id;
|
|
580
|
+
this.setParentToolUseId(id, event);
|
|
572
581
|
if (!this.textByMessageId.has(id)) this.textByMessageId.set(id, "");
|
|
573
582
|
if (!this.thinkingByMessageId.has(id))
|
|
574
583
|
this.thinkingByMessageId.set(id, "");
|
|
@@ -597,8 +606,11 @@ var ClaudeCodeLogAssembler = class {
|
|
|
597
606
|
const message = isRecord(event.message) ? event.message : null;
|
|
598
607
|
const id = message && typeof message.id === "string" ? message.id : null;
|
|
599
608
|
if (!id || !message) {
|
|
600
|
-
|
|
609
|
+
const passthrough2 = clone(event);
|
|
610
|
+
this.passThroughSnapshots.push(passthrough2);
|
|
611
|
+
return [clone(passthrough2)];
|
|
601
612
|
}
|
|
613
|
+
this.setParentToolUseId(id, event);
|
|
602
614
|
const final = extractClaudeAssistantContent(message);
|
|
603
615
|
this.textByMessageId.set(id, final.text);
|
|
604
616
|
if (final.thinking) {
|
|
@@ -609,20 +621,29 @@ var ClaudeCodeLogAssembler = class {
|
|
|
609
621
|
this.currentMessageId = null;
|
|
610
622
|
return [snapshot];
|
|
611
623
|
}
|
|
612
|
-
|
|
624
|
+
const passthrough = clone(event);
|
|
625
|
+
this.passThroughSnapshots.push(passthrough);
|
|
626
|
+
return [clone(passthrough)];
|
|
613
627
|
}
|
|
614
628
|
seed(snapshots) {
|
|
615
629
|
this.currentMessageId = null;
|
|
616
630
|
this.textByMessageId.clear();
|
|
617
631
|
this.thinkingByMessageId.clear();
|
|
632
|
+
this.parentToolUseIdByMessageId.clear();
|
|
618
633
|
this.byMessageId.clear();
|
|
619
634
|
this.extraBlocksByMessageId.clear();
|
|
635
|
+
this.passThroughSnapshots.length = 0;
|
|
620
636
|
for (const snapshot of snapshots) {
|
|
621
637
|
if (!isRecord(snapshot)) continue;
|
|
622
|
-
if (snapshot.type !== "message.updated")
|
|
638
|
+
if (snapshot.type !== "message.updated") {
|
|
639
|
+
this.passThroughSnapshots.push(clone(snapshot));
|
|
640
|
+
continue;
|
|
641
|
+
}
|
|
623
642
|
const messageId = typeof snapshot.messageId === "string" ? snapshot.messageId : null;
|
|
624
643
|
if (!messageId) continue;
|
|
625
644
|
this.byMessageId.set(messageId, clone(snapshot));
|
|
645
|
+
const parentToolUseId = typeof snapshot.parent_tool_use_id === "string" ? snapshot.parent_tool_use_id : null;
|
|
646
|
+
this.parentToolUseIdByMessageId.set(messageId, parentToolUseId);
|
|
626
647
|
const message = isRecord(snapshot.message) ? snapshot.message : null;
|
|
627
648
|
const content = message && Array.isArray(message.content) ? message.content : [];
|
|
628
649
|
let text = "";
|
|
@@ -657,6 +678,15 @@ var ClaudeCodeLogAssembler = class {
|
|
|
657
678
|
map.set(key, clone(block));
|
|
658
679
|
}
|
|
659
680
|
}
|
|
681
|
+
setParentToolUseId(messageId, event) {
|
|
682
|
+
if (event.parent_tool_use_id === null) {
|
|
683
|
+
this.parentToolUseIdByMessageId.set(messageId, null);
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
if (typeof event.parent_tool_use_id === "string") {
|
|
687
|
+
this.parentToolUseIdByMessageId.set(messageId, event.parent_tool_use_id);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
660
690
|
upsertMessage(messageId) {
|
|
661
691
|
const text = this.textByMessageId.get(messageId) ?? "";
|
|
662
692
|
const thinking = this.thinkingByMessageId.get(messageId) ?? "";
|
|
@@ -670,6 +700,7 @@ var ClaudeCodeLogAssembler = class {
|
|
|
670
700
|
const next = {
|
|
671
701
|
type: "message.updated",
|
|
672
702
|
messageId,
|
|
703
|
+
parent_tool_use_id: this.parentToolUseIdByMessageId.get(messageId) ?? null,
|
|
673
704
|
message: {
|
|
674
705
|
id: messageId,
|
|
675
706
|
role: "assistant",
|
|
@@ -680,7 +711,10 @@ var ClaudeCodeLogAssembler = class {
|
|
|
680
711
|
return clone(next);
|
|
681
712
|
}
|
|
682
713
|
getSnapshots() {
|
|
683
|
-
|
|
714
|
+
const out = [];
|
|
715
|
+
for (const snapshot of this.byMessageId.values()) out.push(clone(snapshot));
|
|
716
|
+
for (const snapshot of this.passThroughSnapshots) out.push(clone(snapshot));
|
|
717
|
+
return out;
|
|
684
718
|
}
|
|
685
719
|
};
|
|
686
720
|
function extractClaudeAssistantContent(message) {
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
createNormalizedEvent,
|
|
3
3
|
normalizeRawAgentEvent,
|
|
4
4
|
toAISDKStream
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-2DH5OVG4.js";
|
|
6
6
|
import {
|
|
7
7
|
AgentBoxError,
|
|
8
8
|
AsyncQueue,
|
|
@@ -1670,6 +1670,7 @@ function buildClaudeQueryOptions(params) {
|
|
|
1670
1670
|
settings: params.settingsPath,
|
|
1671
1671
|
extraArgs,
|
|
1672
1672
|
includePartialMessages: true,
|
|
1673
|
+
forwardSubagentText: true,
|
|
1673
1674
|
includeHookEvents,
|
|
1674
1675
|
thinking: { type: "adaptive", display: "summarized" },
|
|
1675
1676
|
...provider?.additionalDirectories?.length ? { additionalDirectories: provider.additionalDirectories } : {},
|
package/dist/events/index.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
Agent,
|
|
3
3
|
agentboxRoot,
|
|
4
4
|
getAgentLayout
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZJKJ7XFX.js";
|
|
6
6
|
import {
|
|
7
7
|
ProviderLogAssembler,
|
|
8
8
|
createNormalizedEvent,
|
|
9
9
|
normalizeRawAgentEvent,
|
|
10
10
|
toAISDKEvent,
|
|
11
11
|
toAISDKStream
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-2DH5OVG4.js";
|
|
13
13
|
import {
|
|
14
14
|
Sandbox,
|
|
15
15
|
SandboxAdapter,
|