agentbox-sdk 0.1.312 → 0.1.314

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.
@@ -2,8 +2,8 @@ import {
2
2
  Agent,
3
3
  agentboxRoot,
4
4
  getAgentLayout
5
- } from "../chunk-3M5SPIRD.js";
6
- import "../chunk-A52XCBGW.js";
5
+ } from "../chunk-MXGKFFXY.js";
6
+ import "../chunk-2DH5OVG4.js";
7
7
  import {
8
8
  AGENT_RESERVED_PORTS,
9
9
  collectAllAgentReservedPorts
@@ -558,6 +558,13 @@ var ClaudeCodeLogAssembler = class {
558
558
  // tool_use blocks, and the UI's dedup-by-messageId would wipe the running
559
559
  // command from the trace.
560
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 = [];
561
568
  process(event) {
562
569
  if (!isRecord(event)) return [];
563
570
  const type = typeof event.type === "string" ? event.type : "";
@@ -599,7 +606,9 @@ var ClaudeCodeLogAssembler = class {
599
606
  const message = isRecord(event.message) ? event.message : null;
600
607
  const id = message && typeof message.id === "string" ? message.id : null;
601
608
  if (!id || !message) {
602
- return [clone(event)];
609
+ const passthrough2 = clone(event);
610
+ this.passThroughSnapshots.push(passthrough2);
611
+ return [clone(passthrough2)];
603
612
  }
604
613
  this.setParentToolUseId(id, event);
605
614
  const final = extractClaudeAssistantContent(message);
@@ -612,7 +621,9 @@ var ClaudeCodeLogAssembler = class {
612
621
  this.currentMessageId = null;
613
622
  return [snapshot];
614
623
  }
615
- return [clone(event)];
624
+ const passthrough = clone(event);
625
+ this.passThroughSnapshots.push(passthrough);
626
+ return [clone(passthrough)];
616
627
  }
617
628
  seed(snapshots) {
618
629
  this.currentMessageId = null;
@@ -621,9 +632,13 @@ var ClaudeCodeLogAssembler = class {
621
632
  this.parentToolUseIdByMessageId.clear();
622
633
  this.byMessageId.clear();
623
634
  this.extraBlocksByMessageId.clear();
635
+ this.passThroughSnapshots.length = 0;
624
636
  for (const snapshot of snapshots) {
625
637
  if (!isRecord(snapshot)) continue;
626
- if (snapshot.type !== "message.updated") continue;
638
+ if (snapshot.type !== "message.updated") {
639
+ this.passThroughSnapshots.push(clone(snapshot));
640
+ continue;
641
+ }
627
642
  const messageId = typeof snapshot.messageId === "string" ? snapshot.messageId : null;
628
643
  if (!messageId) continue;
629
644
  this.byMessageId.set(messageId, clone(snapshot));
@@ -696,7 +711,10 @@ var ClaudeCodeLogAssembler = class {
696
711
  return clone(next);
697
712
  }
698
713
  getSnapshots() {
699
- return Array.from(this.byMessageId.values()).map(clone);
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;
700
718
  }
701
719
  };
702
720
  function extractClaudeAssistantContent(message) {
@@ -2,7 +2,7 @@ import {
2
2
  createNormalizedEvent,
3
3
  normalizeRawAgentEvent,
4
4
  toAISDKStream
5
- } from "./chunk-A52XCBGW.js";
5
+ } from "./chunk-2DH5OVG4.js";
6
6
  import {
7
7
  AgentBoxError,
8
8
  AsyncQueue,
@@ -4141,6 +4141,7 @@ var OpenCodeAgentAdapter = class {
4141
4141
  let streamedTextFromSse = "";
4142
4142
  const assistantTextByMessageId = /* @__PURE__ */ new Map();
4143
4143
  const announcedAssistantCompletions = /* @__PURE__ */ new Set();
4144
+ const partTypeById = /* @__PURE__ */ new Map();
4144
4145
  let dispatchError;
4145
4146
  let firstSseEventLogged = false;
4146
4147
  let sendToSession;
@@ -4391,16 +4392,28 @@ var OpenCodeAgentAdapter = class {
4391
4392
  resolveSessionTerminal();
4392
4393
  }
4393
4394
  }
4395
+ if (payloadRecord?.type === "message.part.updated") {
4396
+ const properties = payloadRecord.properties;
4397
+ const part = properties?.part;
4398
+ if (part && typeof part.id === "string" && typeof part.type === "string") {
4399
+ partTypeById.set(part.id, part.type);
4400
+ }
4401
+ }
4394
4402
  if (payloadRecord?.type === "message.part.delta") {
4395
4403
  const properties = payloadRecord.properties;
4396
4404
  const eventSessionId = typeof properties?.sessionID === "string" ? properties.sessionID : void 0;
4397
4405
  const eventMessageId = typeof properties?.messageID === "string" ? properties.messageID : void 0;
4406
+ const eventPartId = typeof properties?.partID === "string" ? properties.partID : void 0;
4398
4407
  const isForeignSession = eventSessionId !== void 0 && eventSessionId !== sessionId || eventSessionId === void 0 && eventMessageId !== void 0 && foreignMessageIds.has(eventMessageId);
4399
4408
  if (isForeignSession) {
4400
4409
  continue;
4401
4410
  }
4402
4411
  const delta = typeof properties?.delta === "string" ? properties.delta : "";
4403
- if (delta && properties?.field === "text") {
4412
+ const field = typeof properties?.field === "string" ? properties.field : void 0;
4413
+ const partType = eventPartId ? partTypeById.get(eventPartId) : void 0;
4414
+ const isTextDelta = field === "text" && partType !== "reasoning";
4415
+ const isReasoningDelta = field === "text" && partType === "reasoning" || field === "reasoning_content" || field === "reasoning_details";
4416
+ if (delta && isTextDelta) {
4404
4417
  streamedTextFromSse += delta;
4405
4418
  if (eventMessageId) {
4406
4419
  assistantTextByMessageId.set(
@@ -4419,7 +4432,7 @@ var OpenCodeAgentAdapter = class {
4419
4432
  { delta }
4420
4433
  )
4421
4434
  );
4422
- } else if (delta && (properties?.field === "reasoning" || properties?.field === "thinking")) {
4435
+ } else if (delta && isReasoningDelta) {
4423
4436
  sink.emitEvent(
4424
4437
  createNormalizedEvent(
4425
4438
  "reasoning.delta",
@@ -4,7 +4,7 @@ import {
4
4
  normalizeRawAgentEvent,
5
5
  toAISDKEvent,
6
6
  toAISDKStream
7
- } from "../chunk-A52XCBGW.js";
7
+ } from "../chunk-2DH5OVG4.js";
8
8
  import "../chunk-GOFJNFAD.js";
9
9
  export {
10
10
  ProviderLogAssembler,
package/dist/index.js CHANGED
@@ -2,14 +2,14 @@ import {
2
2
  Agent,
3
3
  agentboxRoot,
4
4
  getAgentLayout
5
- } from "./chunk-3M5SPIRD.js";
5
+ } from "./chunk-MXGKFFXY.js";
6
6
  import {
7
7
  ProviderLogAssembler,
8
8
  createNormalizedEvent,
9
9
  normalizeRawAgentEvent,
10
10
  toAISDKEvent,
11
11
  toAISDKStream
12
- } from "./chunk-A52XCBGW.js";
12
+ } from "./chunk-2DH5OVG4.js";
13
13
  import {
14
14
  Sandbox,
15
15
  SandboxAdapter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentbox-sdk",
3
- "version": "0.1.312",
3
+ "version": "0.1.314",
4
4
  "description": "Swappable coding agents and sandbox providers for Bun and TypeScript.",
5
5
  "license": "MIT",
6
6
  "repository": {