agentbox-sdk 0.1.514 → 0.1.516

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.
@@ -646,6 +646,7 @@ function isClaudeNoiseEvent(event) {
646
646
  }
647
647
  var ClaudeCodeLogAssembler = class {
648
648
  currentMessageId = null;
649
+ modelByMessageId = /* @__PURE__ */ new Map();
649
650
  textByMessageId = /* @__PURE__ */ new Map();
650
651
  thinkingByMessageId = /* @__PURE__ */ new Map();
651
652
  parentToolUseIdByMessageId = /* @__PURE__ */ new Map();
@@ -682,6 +683,9 @@ var ClaudeCodeLogAssembler = class {
682
683
  const id = message && typeof message.id === "string" ? message.id : null;
683
684
  if (!id) return [];
684
685
  this.currentMessageId = id;
686
+ if (typeof message?.model === "string") {
687
+ this.modelByMessageId.set(id, message.model);
688
+ }
685
689
  this.setParentToolUseId(id, event);
686
690
  if (!this.textByMessageId.has(id)) this.textByMessageId.set(id, "");
687
691
  if (!this.thinkingByMessageId.has(id))
@@ -713,6 +717,9 @@ var ClaudeCodeLogAssembler = class {
713
717
  if (!id || !message) {
714
718
  return [this.pushPassThrough(event)];
715
719
  }
720
+ if (typeof message.model === "string") {
721
+ this.modelByMessageId.set(id, message.model);
722
+ }
716
723
  this.setParentToolUseId(id, event);
717
724
  const final = extractClaudeAssistantContent(message);
718
725
  const streamedText = this.textByMessageId.get(id) ?? "";
@@ -740,6 +747,7 @@ var ClaudeCodeLogAssembler = class {
740
747
  }
741
748
  seed(snapshots) {
742
749
  this.currentMessageId = null;
750
+ this.modelByMessageId.clear();
743
751
  this.textByMessageId.clear();
744
752
  this.thinkingByMessageId.clear();
745
753
  this.parentToolUseIdByMessageId.clear();
@@ -769,6 +777,9 @@ var ClaudeCodeLogAssembler = class {
769
777
  const parentToolUseId = typeof snapshot.parent_tool_use_id === "string" ? snapshot.parent_tool_use_id : null;
770
778
  this.parentToolUseIdByMessageId.set(messageId, parentToolUseId);
771
779
  const message = isRecord(snapshot.message) ? snapshot.message : null;
780
+ if (typeof message?.model === "string") {
781
+ this.modelByMessageId.set(messageId, message.model);
782
+ }
772
783
  const content = message && Array.isArray(message.content) ? message.content : [];
773
784
  let text = "";
774
785
  let thinking = "";
@@ -828,6 +839,7 @@ var ClaudeCodeLogAssembler = class {
828
839
  message: {
829
840
  id: messageId,
830
841
  role: "assistant",
842
+ ...this.modelByMessageId.has(messageId) ? { model: this.modelByMessageId.get(messageId) } : {},
831
843
  content
832
844
  }
833
845
  };
@@ -1,4 +1,4 @@
1
- export { A as AISDKEvent, C as BackgroundTask, D as BackgroundTasksEvent, W as MessageCompletedEvent, X as MessageInjectedEvent, Y as MessageStartedEvent, Z as NativePlanEvent, _ as NormalizedAgentEvent, $ as NormalizedAgentEventBase, a0 as NormalizedAgentEventType, a7 as PermissionRequestedEvent, a8 as PermissionResolvedEvent, a9 as RawAgentEvent, aa as ReasoningDeltaEvent, ac as RunCancelledEvent, ad as RunCompletedEvent, ae as RunErrorEvent, af as RunStartedEvent, ah as TextDeltaEvent, aj as ToolCallCompletedEvent, ak as ToolCallDeltaEvent, al as ToolCallStartedEvent, ao as createNormalizedEvent, ap as normalizeRawAgentEvent, aq as toAISDKEvent, ar as toAISDKStream } from '../types-NhKw_6mW.js';
1
+ export { A as AISDKEvent, C as BackgroundTask, D as BackgroundTasksEvent, W as MessageCompletedEvent, X as MessageInjectedEvent, Y as MessageStartedEvent, Z as NativePlanEvent, _ as NormalizedAgentEvent, $ as NormalizedAgentEventBase, a0 as NormalizedAgentEventType, a7 as PermissionRequestedEvent, a8 as PermissionResolvedEvent, a9 as RawAgentEvent, aa as ReasoningDeltaEvent, ac as RunCancelledEvent, ad as RunCompletedEvent, ae as RunErrorEvent, af as RunStartedEvent, ah as TextDeltaEvent, aj as ToolCallCompletedEvent, ak as ToolCallDeltaEvent, al as ToolCallStartedEvent, ao as createNormalizedEvent, ap as normalizeRawAgentEvent, aq as toAISDKEvent, ar as toAISDKStream } from '../types-BKvKgRMY.js';
2
2
  import { AgentProvider } from '../enums.js';
3
3
  import '../Sandbox-DcKAU-E3.js';
4
4
  import 'e2b';
@@ -4,7 +4,7 @@ import {
4
4
  normalizeRawAgentEvent,
5
5
  toAISDKEvent,
6
6
  toAISDKStream
7
- } from "../chunk-775FIGGL.js";
7
+ } from "../chunk-V4M4LPPT.js";
8
8
  import "../chunk-GOFJNFAD.js";
9
9
  export {
10
10
  ProviderLogAssembler,
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AISDKEvent, a as AgentApprovalMode, b as AgentAttachRequest, c as AgentCommandConfig, d as AgentCostData, e as AgentExecutionRequest, f as AgentLocalMcpConfig, g as AgentMcpConfig, h as AgentOptions, i as AgentOptionsBase, j as AgentOptionsMap, k as AgentPermissionDecision, l as AgentPermissionKind, m as AgentPermissionResponse, n as AgentProviderAdapter, o as AgentProviderName, p as AgentReasoningEffort, q as AgentRemoteMcpConfig, r as AgentResult, s as AgentRun, t as AgentRunConfig, u as AgentRunSink, v as AgentSetupRequest, w as AgentSkillConfig, x as AgentSubAgentConfig, y as AgentUserAnswer, z as AgentUserQuestion, B as AttachedRun, C as BackgroundTask, D as BackgroundTasksEvent, E as ClaudeCodeAgentOptions, F as ClaudeCodeHookConfig, G as ClaudeCodeHookEvent, H as ClaudeCodeHookHandler, I as ClaudeCodeHookMatcherGroup, J as ClaudeCodeHooksConfig, K as ClaudeCodeProviderOptions, L as CodexAgentOptions, M as CodexCommandHook, N as CodexHookEvent, O as CodexHookMatcherGroup, P as CodexHooksConfig, Q as CodexModelProviderConfig, R as CodexProviderOptions, S as DataContent, T as EmbeddedSkillConfig, U as FilePart, V as ImagePart, W as MessageCompletedEvent, X as MessageInjectedEvent, Y as MessageStartedEvent, Z as NativePlanEvent, _ as NormalizedAgentEvent, $ as NormalizedAgentEventBase, a0 as NormalizedAgentEventType, a1 as OpenCodeAgentOptions, a2 as OpenCodePluginConfig, a3 as OpenCodePluginEvent, a4 as OpenCodePluginHookConfig, a5 as OpenCodeProviderOptions, a6 as OpenRouterPlugin, a7 as PermissionRequestedEvent, a8 as PermissionResolvedEvent, a9 as RawAgentEvent, aa as ReasoningDeltaEvent, ab as RepoSkillConfig, ac as RunCancelledEvent, ad as RunCompletedEvent, ae as RunErrorEvent, af as RunStartedEvent, ag as SetupLayout, ah as TextDeltaEvent, ai as TextPart, aj as ToolCallCompletedEvent, ak as ToolCallDeltaEvent, al as ToolCallStartedEvent, am as UserContent, an as UserContentPart, ao as createNormalizedEvent, ap as normalizeRawAgentEvent, aq as toAISDKEvent, ar as toAISDKStream } from './types-NhKw_6mW.js';
1
+ export { A as AISDKEvent, a as AgentApprovalMode, b as AgentAttachRequest, c as AgentCommandConfig, d as AgentCostData, e as AgentExecutionRequest, f as AgentLocalMcpConfig, g as AgentMcpConfig, h as AgentOptions, i as AgentOptionsBase, j as AgentOptionsMap, k as AgentPermissionDecision, l as AgentPermissionKind, m as AgentPermissionResponse, n as AgentProviderAdapter, o as AgentProviderName, p as AgentReasoningEffort, q as AgentRemoteMcpConfig, r as AgentResult, s as AgentRun, t as AgentRunConfig, u as AgentRunSink, v as AgentSetupRequest, w as AgentSkillConfig, x as AgentSubAgentConfig, y as AgentUserAnswer, z as AgentUserQuestion, B as AttachedRun, C as BackgroundTask, D as BackgroundTasksEvent, E as ClaudeCodeAgentOptions, F as ClaudeCodeHookConfig, G as ClaudeCodeHookEvent, H as ClaudeCodeHookHandler, I as ClaudeCodeHookMatcherGroup, J as ClaudeCodeHooksConfig, K as ClaudeCodeProviderOptions, L as CodexAgentOptions, M as CodexCommandHook, N as CodexHookEvent, O as CodexHookMatcherGroup, P as CodexHooksConfig, Q as CodexModelProviderConfig, R as CodexProviderOptions, S as DataContent, T as EmbeddedSkillConfig, U as FilePart, V as ImagePart, W as MessageCompletedEvent, X as MessageInjectedEvent, Y as MessageStartedEvent, Z as NativePlanEvent, _ as NormalizedAgentEvent, $ as NormalizedAgentEventBase, a0 as NormalizedAgentEventType, a1 as OpenCodeAgentOptions, a2 as OpenCodePluginConfig, a3 as OpenCodePluginEvent, a4 as OpenCodePluginHookConfig, a5 as OpenCodeProviderOptions, a6 as OpenRouterPlugin, a7 as PermissionRequestedEvent, a8 as PermissionResolvedEvent, a9 as RawAgentEvent, aa as ReasoningDeltaEvent, ab as RepoSkillConfig, ac as RunCancelledEvent, ad as RunCompletedEvent, ae as RunErrorEvent, af as RunStartedEvent, ag as SetupLayout, ah as TextDeltaEvent, ai as TextPart, aj as ToolCallCompletedEvent, ak as ToolCallDeltaEvent, al as ToolCallStartedEvent, am as UserContent, an as UserContentPart, ao as createNormalizedEvent, ap as normalizeRawAgentEvent, aq as toAISDKEvent, ar as toAISDKStream } from './types-BKvKgRMY.js';
2
2
  export { AGENT_RESERVED_PORTS, Agent, HarnessCapabilities, HarnessCommand, agentboxRoot, collectAllAgentReservedPorts, getAgentLayout, harnessCapabilities, resolveHarnessCommand } from './agents/index.js';
3
3
  export { A as AsyncCommandHandle, C as CommandEvent, a as CommandOptions, b as CommandResult, D as DaytonaProviderOptions, c as DaytonaSandboxOptions, E as E2bProviderOptions, d as E2bSandboxOptions, G as GitCloneOptions, L as LocalDockerProviderOptions, e as LocalDockerSandboxOptions, M as ModalProviderOptions, f as ModalSandboxOptions, S as Sandbox, g as SandboxDescriptor, h as SandboxListOptions, i as SandboxOptions, j as SandboxOptionsBase, k as SandboxOptionsMap, l as SandboxProviderName, m as SandboxRaw, n as SandboxRawMap, o as SandboxResourceSpec, T as TarballEntry, V as VercelGitSource, p as VercelProviderOptions, q as VercelSandboxOptions } from './Sandbox-DcKAU-E3.js';
4
4
  export { SandboxAdapter, buildGitCloneCommand } from './sandboxes/index.js';
package/dist/index.js CHANGED
@@ -4,14 +4,14 @@ import {
4
4
  getAgentLayout,
5
5
  harnessCapabilities,
6
6
  resolveHarnessCommand
7
- } from "./chunk-D33LRRN7.js";
7
+ } from "./chunk-SERVEWIE.js";
8
8
  import {
9
9
  ProviderLogAssembler,
10
10
  createNormalizedEvent,
11
11
  normalizeRawAgentEvent,
12
12
  toAISDKEvent,
13
13
  toAISDKStream
14
- } from "./chunk-775FIGGL.js";
14
+ } from "./chunk-V4M4LPPT.js";
15
15
  import {
16
16
  Sandbox,
17
17
  SandboxAdapter,
@@ -110,6 +110,11 @@ interface BackgroundTasksEvent extends NormalizedAgentEventBase {
110
110
  tasks: BackgroundTask[];
111
111
  /** True once the harness ended its turn and the run stays open only for these tasks. */
112
112
  waiting: boolean;
113
+ /**
114
+ * Set on a run's last event when it ended with `tasks` still running in a
115
+ * parked harness: the work goes on, and a later run picks it up.
116
+ */
117
+ parked?: boolean;
113
118
  }
114
119
  interface RunCompletedEvent extends NormalizedAgentEventBase {
115
120
  type: "run.completed";
@@ -385,6 +390,13 @@ interface AgentRunConfig {
385
390
  model?: string;
386
391
  systemPrompt?: string;
387
392
  resumeSessionId?: string;
393
+ /**
394
+ * claude-code sandbox runs: attach to the harness parked for
395
+ * {@link resumeSessionId} without sending {@link input}, and stream the
396
+ * turn it started on its own. Completes with empty text when nothing is
397
+ * parked or no such turn exists. See `provider.parkBackgroundWork`.
398
+ */
399
+ resumeParked?: boolean;
388
400
  /**
389
401
  * Source session/thread to fork from. The new run begins in a *new*
390
402
  * session whose history is the prefix of the source up to and including
@@ -577,6 +589,20 @@ interface OpenCodeProviderOptions {
577
589
  plugins?: OpenCodePluginConfig[];
578
590
  }
579
591
  interface ClaudeCodeProviderOptions {
592
+ /**
593
+ * Sandbox runs only. End a run at its answer even when background work is
594
+ * still live, and keep the CLI alive in the sandbox for it (a "parked"
595
+ * run) instead of holding the run open. A run whose turn ends with nothing
596
+ * live is unaffected. The next run resuming that session takes the CLI
597
+ * over. When the CLI starts a turn on its own with nobody attached (a task
598
+ * finished, a schedule fired) the daemon POSTs `{ runId, sessionId }` to
599
+ * `wakeUrl` with `Authorization: Bearer <wakeToken>`; stream that turn with
600
+ * `resumeParked`. The park lasts what is left of `backgroundTaskTimeoutMs`.
601
+ */
602
+ parkBackgroundWork?: {
603
+ wakeUrl: string;
604
+ wakeToken: string;
605
+ };
580
606
  /** Request fast mode explicitly; false overrides inherited fast settings. */
581
607
  fastMode?: boolean;
582
608
  binary?: string;
@@ -682,6 +708,14 @@ interface AgentResult {
682
708
  rawEvents: RawAgentEvent[];
683
709
  events: NormalizedAgentEvent[];
684
710
  costData?: AgentCostData | null;
711
+ /**
712
+ * A {@link AgentRunConfig.resumeParked} run found nothing parked for its
713
+ * session — the park's budget ran out, the sandbox was replaced, or the CLI
714
+ * was torn down. The run streamed no turn of its own, so there is nothing
715
+ * to show for it. Never inferred from empty output: a real tool-only turn
716
+ * (a commit, an edit, a push) produces that too.
717
+ */
718
+ nothingParked?: boolean;
685
719
  }
686
720
  interface AgentRun extends AsyncIterable<NormalizedAgentEvent> {
687
721
  id: string;
@@ -694,11 +728,21 @@ interface AgentRun extends AsyncIterable<NormalizedAgentEvent> {
694
728
  respondToPermission(response: AgentPermissionResponse): Promise<void>;
695
729
  sendMessage(content: UserContent): Promise<void>;
696
730
  abort(): Promise<void>;
731
+ /**
732
+ * Stop holding the run open for background work. A run that is only
733
+ * waiting (`background.tasks` with `waiting: true`) stops what is left and
734
+ * completes with the answer it already has; unlike {@link abort} it is not
735
+ * cancelled. Asked while a turn is active, it applies at that turn's end.
736
+ * A no-op for a run that never waits.
737
+ */
738
+ finishBackgroundWait(): Promise<void>;
697
739
  readonly finished: Promise<AgentResult>;
698
740
  }
699
741
  interface AgentRunSink {
700
742
  setRaw(raw: unknown): void;
701
743
  setAbort(abort: () => Promise<void>): void;
744
+ /** Providers that hold runs open for background work register how to stop. */
745
+ setFinishBackgroundWait?(finish: () => void): void;
702
746
  setSessionId(sessionId: string): void;
703
747
  emitRaw(event: RawAgentEvent): void;
704
748
  emitEvent(event: NormalizedAgentEvent): void;
@@ -709,6 +753,8 @@ interface AgentRunSink {
709
753
  complete(result?: {
710
754
  text?: string;
711
755
  costData?: AgentCostData | null;
756
+ /** See {@link AgentResult.nothingParked}. */
757
+ nothingParked?: boolean;
712
758
  }): void;
713
759
  cancel(result?: {
714
760
  text?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentbox-sdk",
3
- "version": "0.1.514",
3
+ "version": "0.1.516",
4
4
  "description": "Swappable coding agents and sandbox providers for Bun and TypeScript.",
5
5
  "license": "MIT",
6
6
  "repository": {