agentbox-sdk 0.1.308 → 0.1.309

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.
@@ -258,6 +258,14 @@ declare class Sandbox<P extends SandboxProviderName = SandboxProviderName> {
258
258
  * cached internally).
259
259
  */
260
260
  findOrProvision(): Promise<this>;
261
+ /**
262
+ * Attach to an existing sandbox by id, skipping the
263
+ * `findMatchingSandbox` lookup. Useful when the caller just created the
264
+ * sandbox (e.g. via a provider-native fork API) and knows its id.
265
+ * Repeated calls are cheap. Currently only the Daytona adapter
266
+ * implements this; other providers throw.
267
+ */
268
+ attachById(id: string): Promise<this>;
261
269
  openPort(port: number): Promise<this>;
262
270
  setSecret(name: string, value: string): this;
263
271
  setSecrets(values: Record<string, string>): this;
@@ -1,6 +1,6 @@
1
- import { o as AgentProviderName, h as AgentOptions, t as AgentRunConfig, s as AgentRun, r as AgentResult, a2 as RawAgentEvent, b as AgentAttachRequest, y as AttachedRun } from '../types-CZdyLzA4.js';
2
- export { a as AgentApprovalMode, c as AgentCommandConfig, d as AgentCostData, e as AgentExecutionRequest, f as AgentLocalMcpConfig, g as AgentMcpConfig, i as AgentOptionsBase, j as AgentOptionsMap, k as AgentPermissionDecision, l as AgentPermissionKind, m as AgentPermissionResponse, n as AgentProviderAdapter, p as AgentReasoningEffort, q as AgentRemoteMcpConfig, u as AgentRunSink, v as AgentSetupRequest, w as AgentSkillConfig, x as AgentSubAgentConfig, C as ClaudeCodeAgentOptions, z as ClaudeCodeHookConfig, B as ClaudeCodeHookEvent, D as ClaudeCodeHookHandler, E as ClaudeCodeHookMatcherGroup, F as ClaudeCodeHooksConfig, G as ClaudeCodeProviderOptions, H as CodexAgentOptions, I as CodexCommandHook, J as CodexHookEvent, K as CodexHookMatcherGroup, L as CodexHooksConfig, M as CodexProviderOptions, N as DataContent, O as EmbeddedSkillConfig, P as FilePart, Q as ImagePart, X as OpenCodeAgentOptions, Y as OpenCodePluginConfig, Z as OpenCodePluginEvent, _ as OpenCodePluginHookConfig, $ as OpenCodeProviderOptions, a4 as RepoSkillConfig, aa as TextPart, ae as UserContent, af as UserContentPart } from '../types-CZdyLzA4.js';
3
- import { S as Sandbox } from '../Sandbox-K6VNqKeo.js';
1
+ import { o as AgentProviderName, h as AgentOptions, t as AgentRunConfig, s as AgentRun, r as AgentResult, a2 as RawAgentEvent, b as AgentAttachRequest, y as AttachedRun, a9 as SetupLayout } from '../types-DmkbgYmn.js';
2
+ export { a as AgentApprovalMode, c as AgentCommandConfig, d as AgentCostData, e as AgentExecutionRequest, f as AgentLocalMcpConfig, g as AgentMcpConfig, i as AgentOptionsBase, j as AgentOptionsMap, k as AgentPermissionDecision, l as AgentPermissionKind, m as AgentPermissionResponse, n as AgentProviderAdapter, p as AgentReasoningEffort, q as AgentRemoteMcpConfig, u as AgentRunSink, v as AgentSetupRequest, w as AgentSkillConfig, x as AgentSubAgentConfig, C as ClaudeCodeAgentOptions, z as ClaudeCodeHookConfig, B as ClaudeCodeHookEvent, D as ClaudeCodeHookHandler, E as ClaudeCodeHookMatcherGroup, F as ClaudeCodeHooksConfig, G as ClaudeCodeProviderOptions, H as CodexAgentOptions, I as CodexCommandHook, J as CodexHookEvent, K as CodexHookMatcherGroup, L as CodexHooksConfig, M as CodexProviderOptions, N as DataContent, O as EmbeddedSkillConfig, P as FilePart, Q as ImagePart, X as OpenCodeAgentOptions, Y as OpenCodePluginConfig, Z as OpenCodePluginEvent, _ as OpenCodePluginHookConfig, $ as OpenCodeProviderOptions, a4 as RepoSkillConfig, ab as TextPart, af as UserContent, ag as UserContentPart } from '../types-DmkbgYmn.js';
3
+ import { S as Sandbox } from '../Sandbox-DcKAU-E3.js';
4
4
  export { AgentProvider } from '../enums.js';
5
5
  import 'e2b';
6
6
  import '@vercel/sandbox';
@@ -67,6 +67,28 @@ declare class Agent<P extends AgentProviderName = AgentProviderName> {
67
67
  static attach<P extends AgentProviderName>(request: AgentAttachRequest<P>): Promise<AttachedRun>;
68
68
  }
69
69
 
70
+ /**
71
+ * The on-disk root for every artifact agentbox writes for a given
72
+ * provider. Deterministic — same inputs, same path — so `setup()` and
73
+ * `execute()` agree on file locations without any data channel between
74
+ * them.
75
+ *
76
+ * - **Sandbox**: `/tmp/agentbox/<provider>` inside the sandbox.
77
+ * - **Local host**: `<os.tmpdir()>/agentbox-<provider>` on the host.
78
+ */
79
+ declare function agentboxRoot(provider: AgentProviderName, hasSandbox?: boolean): string;
80
+ /**
81
+ * Resolve the on-disk layout (config dirs per provider) for the given
82
+ * agentbox root. Public so external consumers (e.g. agentbox-driven
83
+ * orchestrators) can locate where each CLI writes its files without
84
+ * having to hardcode the layout shape.
85
+ *
86
+ * Pair with {@link agentboxRoot} to get the root for `(provider,
87
+ * hasSandbox)` first, then call this to expand it into the per-provider
88
+ * dirs (`claudeDir`, `codexDir`, `opencodeDir`, …).
89
+ */
90
+ declare function getAgentLayout(rootDir: string): SetupLayout;
91
+
70
92
  /**
71
93
  * Ports each agent harness needs exposed on its sandbox in order to reach
72
94
  * its app-server (or equivalent local server). These are used to:
@@ -85,4 +107,4 @@ declare class Agent<P extends AgentProviderName = AgentProviderName> {
85
107
  declare const AGENT_RESERVED_PORTS: Record<AgentProviderName, readonly number[]>;
86
108
  declare function collectAllAgentReservedPorts(): number[];
87
109
 
88
- export { AGENT_RESERVED_PORTS, Agent, AgentAttachRequest, AgentOptions, AgentProviderName, AgentResult, AgentRun, AgentRunConfig, AttachedRun, collectAllAgentReservedPorts };
110
+ export { AGENT_RESERVED_PORTS, Agent, AgentAttachRequest, AgentOptions, AgentProviderName, AgentResult, AgentRun, AgentRunConfig, AttachedRun, SetupLayout, agentboxRoot, collectAllAgentReservedPorts, getAgentLayout };
@@ -1,6 +1,8 @@
1
1
  import {
2
- Agent
3
- } from "../chunk-T3RBNOSE.js";
2
+ Agent,
3
+ agentboxRoot,
4
+ getAgentLayout
5
+ } from "../chunk-VBMMNUB7.js";
4
6
  import "../chunk-ZDSHOGJ4.js";
5
7
  import {
6
8
  AGENT_RESERVED_PORTS,
@@ -14,5 +16,7 @@ export {
14
16
  AGENT_RESERVED_PORTS,
15
17
  Agent,
16
18
  AgentProvider,
17
- collectAllAgentReservedPorts
19
+ agentboxRoot,
20
+ collectAllAgentReservedPorts,
21
+ getAgentLayout
18
22
  };
@@ -144,6 +144,44 @@ var SandboxAdapter = class {
144
144
  }
145
145
  await this.provisioning;
146
146
  }
147
+ /**
148
+ * Attach to an already-existing sandbox by id. Skips the
149
+ * `findMatchingSandbox` lookup that `findOrProvision` does — useful when
150
+ * the caller just created the sandbox (e.g. via a fork API) and knows
151
+ * its id directly. Idempotent: a second call is a no-op once attached.
152
+ *
153
+ * Default implementation throws — providers opt in by overriding
154
+ * `attachExisting`. Currently implemented by the Daytona adapter.
155
+ */
156
+ async attachById(id) {
157
+ if (this.provisioned) {
158
+ return;
159
+ }
160
+ if (!this.provisioning) {
161
+ this.provisioning = time(
162
+ debugSandbox,
163
+ `attachById [${this.provider}] ${id}`,
164
+ async () => {
165
+ await this.attachExisting(id);
166
+ this.provisioned = true;
167
+ }
168
+ ).finally(() => {
169
+ this.provisioning = void 0;
170
+ });
171
+ }
172
+ await this.provisioning;
173
+ }
174
+ /**
175
+ * Provider hook for `attachById`. Adopt the sandbox with the given id
176
+ * (e.g. fetch via the provider client, mark `isWarmFlag`, start if
177
+ * paused). Throw if the provider doesn't support direct attach.
178
+ */
179
+ async attachExisting(id) {
180
+ void id;
181
+ throw new Error(
182
+ `attachById is not supported by the ${this.provider} provider.`
183
+ );
184
+ }
147
185
  /**
148
186
  * Throw a consistent error when a method that needs a provisioned
149
187
  * sandbox is called before `findOrProvision()`. Provider adapters call
@@ -238,6 +276,19 @@ var DaytonaSandboxAdapter = class extends SandboxAdapter {
238
276
  get id() {
239
277
  return this.sandbox?.id;
240
278
  }
279
+ async attachExisting(id) {
280
+ const existing = await this.client.get(id);
281
+ if (!existing) {
282
+ throw new Error(`Daytona sandbox ${id} not found`);
283
+ }
284
+ this.sandbox = existing;
285
+ const state = existing.state ?? "unknown";
286
+ const isWarm = state === "started";
287
+ if (!isWarm) {
288
+ await existing.start();
289
+ }
290
+ this.isWarmFlag = isWarm;
291
+ }
241
292
  async provision() {
242
293
  const existing = await this.findMatchingSandbox();
243
294
  if (existing) {
@@ -284,9 +335,9 @@ var DaytonaSandboxAdapter = class extends SandboxAdapter {
284
335
  this.requireProvisioned();
285
336
  const sandbox = this.requireSandbox();
286
337
  const result = await sandbox.process.executeCommand(
287
- toShellCommand(command),
338
+ this.buildSessionCommand(command, options),
288
339
  options?.cwd ?? this.workingDir,
289
- this.getMergedEnv(options?.env),
340
+ void 0,
290
341
  options?.timeoutMs ? Math.ceil(options.timeoutMs / 1e3) : void 0
291
342
  );
292
343
  const output = result.result ?? "";
@@ -2120,6 +2171,17 @@ var Sandbox = class {
2120
2171
  );
2121
2172
  return this;
2122
2173
  }
2174
+ /**
2175
+ * Attach to an existing sandbox by id, skipping the
2176
+ * `findMatchingSandbox` lookup. Useful when the caller just created the
2177
+ * sandbox (e.g. via a provider-native fork API) and knows its id.
2178
+ * Repeated calls are cheap. Currently only the Daytona adapter
2179
+ * implements this; other providers throw.
2180
+ */
2181
+ async attachById(id) {
2182
+ await this.adapter.attachById(id);
2183
+ return this;
2184
+ }
2123
2185
  async openPort(port) {
2124
2186
  await time(
2125
2187
  debugSandbox,
@@ -893,10 +893,10 @@ function shortLabel(command) {
893
893
  const oneLine = command.replace(/\s+/g, " ").trim();
894
894
  return oneLine.length > 60 ? `${oneLine.slice(0, 60)}\u2026` : oneLine;
895
895
  }
896
- function agentboxRoot(provider, hasSandbox) {
896
+ function agentboxRoot(provider, hasSandbox = true) {
897
897
  return hasSandbox ? `/tmp/agentbox/${provider}` : path4.join(os.tmpdir(), `agentbox-${provider}`);
898
898
  }
899
- function buildLayout(rootDir) {
899
+ function getAgentLayout(rootDir) {
900
900
  const xdgConfigHome = path4.join(rootDir, ".config");
901
901
  return {
902
902
  rootDir,
@@ -1108,7 +1108,7 @@ ${output}` : "";
1108
1108
  async function createSetupTarget(provider, setupId, options) {
1109
1109
  return time(debugRuntime, `createSetupTarget ${provider}`, async () => {
1110
1110
  void setupId;
1111
- const layout = buildLayout(
1111
+ const layout = getAgentLayout(
1112
1112
  agentboxRoot(provider, Boolean(options.sandbox))
1113
1113
  );
1114
1114
  if (options.sandbox) {
@@ -3864,12 +3864,17 @@ function buildOpenCodeConfig(options, interactiveApproval) {
3864
3864
  ])
3865
3865
  );
3866
3866
  const googleBaseUrl = options.env?.GOOGLE_BASE_URL;
3867
+ const openRouterBaseUrl = options.env?.OPENROUTER_BASE_URL;
3867
3868
  return {
3868
3869
  $schema: "https://opencode.ai/config.json",
3869
3870
  ...mcpConfig ? { mcp: mcpConfig } : {},
3870
3871
  ...commandsConfig ? { command: commandsConfig } : {},
3871
3872
  provider: {
3872
- openrouter: { options: { baseURL: "https://openrouter.ai/api/v1" } },
3873
+ openrouter: {
3874
+ options: {
3875
+ baseURL: openRouterBaseUrl || "https://openrouter.ai/api/v1"
3876
+ }
3877
+ },
3873
3878
  ...googleBaseUrl ? { google: { options: { baseURL: googleBaseUrl } } } : {}
3874
3879
  },
3875
3880
  agent: {
@@ -5156,5 +5161,7 @@ var Agent = class {
5156
5161
  };
5157
5162
 
5158
5163
  export {
5164
+ agentboxRoot,
5165
+ getAgentLayout,
5159
5166
  Agent
5160
5167
  };
@@ -1,6 +1,6 @@
1
- export { A as AISDKEvent, R as MessageCompletedEvent, S as MessageInjectedEvent, T as MessageStartedEvent, U as NormalizedAgentEvent, V as NormalizedAgentEventBase, W as NormalizedAgentEventType, a0 as PermissionRequestedEvent, a1 as PermissionResolvedEvent, a2 as RawAgentEvent, a3 as ReasoningDeltaEvent, a5 as RunCancelledEvent, a6 as RunCompletedEvent, a7 as RunErrorEvent, a8 as RunStartedEvent, a9 as TextDeltaEvent, ab as ToolCallCompletedEvent, ac as ToolCallDeltaEvent, ad as ToolCallStartedEvent, ag as createNormalizedEvent, ah as normalizeRawAgentEvent, ai as toAISDKEvent, aj as toAISDKStream } from '../types-CZdyLzA4.js';
1
+ export { A as AISDKEvent, R as MessageCompletedEvent, S as MessageInjectedEvent, T as MessageStartedEvent, U as NormalizedAgentEvent, V as NormalizedAgentEventBase, W as NormalizedAgentEventType, a0 as PermissionRequestedEvent, a1 as PermissionResolvedEvent, a2 as RawAgentEvent, a3 as ReasoningDeltaEvent, a5 as RunCancelledEvent, a6 as RunCompletedEvent, a7 as RunErrorEvent, a8 as RunStartedEvent, aa as TextDeltaEvent, ac as ToolCallCompletedEvent, ad as ToolCallDeltaEvent, ae as ToolCallStartedEvent, ah as createNormalizedEvent, ai as normalizeRawAgentEvent, aj as toAISDKEvent, ak as toAISDKStream } from '../types-DmkbgYmn.js';
2
2
  import { AgentProvider } from '../enums.js';
3
- import '../Sandbox-K6VNqKeo.js';
3
+ import '../Sandbox-DcKAU-E3.js';
4
4
  import 'e2b';
5
5
  import '@vercel/sandbox';
6
6
  import '@daytonaio/sdk';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
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 AttachedRun, C as ClaudeCodeAgentOptions, z as ClaudeCodeHookConfig, B as ClaudeCodeHookEvent, D as ClaudeCodeHookHandler, E as ClaudeCodeHookMatcherGroup, F as ClaudeCodeHooksConfig, G as ClaudeCodeProviderOptions, H as CodexAgentOptions, I as CodexCommandHook, J as CodexHookEvent, K as CodexHookMatcherGroup, L as CodexHooksConfig, M as CodexProviderOptions, N as DataContent, O as EmbeddedSkillConfig, P as FilePart, Q as ImagePart, R as MessageCompletedEvent, S as MessageInjectedEvent, T as MessageStartedEvent, U as NormalizedAgentEvent, V as NormalizedAgentEventBase, W as NormalizedAgentEventType, X as OpenCodeAgentOptions, Y as OpenCodePluginConfig, Z as OpenCodePluginEvent, _ as OpenCodePluginHookConfig, $ as OpenCodeProviderOptions, a0 as PermissionRequestedEvent, a1 as PermissionResolvedEvent, a2 as RawAgentEvent, a3 as ReasoningDeltaEvent, a4 as RepoSkillConfig, a5 as RunCancelledEvent, a6 as RunCompletedEvent, a7 as RunErrorEvent, a8 as RunStartedEvent, a9 as TextDeltaEvent, aa as TextPart, ab as ToolCallCompletedEvent, ac as ToolCallDeltaEvent, ad as ToolCallStartedEvent, ae as UserContent, af as UserContentPart, ag as createNormalizedEvent, ah as normalizeRawAgentEvent, ai as toAISDKEvent, aj as toAISDKStream } from './types-CZdyLzA4.js';
2
- export { AGENT_RESERVED_PORTS, Agent, collectAllAgentReservedPorts } from './agents/index.js';
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-K6VNqKeo.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 AttachedRun, C as ClaudeCodeAgentOptions, z as ClaudeCodeHookConfig, B as ClaudeCodeHookEvent, D as ClaudeCodeHookHandler, E as ClaudeCodeHookMatcherGroup, F as ClaudeCodeHooksConfig, G as ClaudeCodeProviderOptions, H as CodexAgentOptions, I as CodexCommandHook, J as CodexHookEvent, K as CodexHookMatcherGroup, L as CodexHooksConfig, M as CodexProviderOptions, N as DataContent, O as EmbeddedSkillConfig, P as FilePart, Q as ImagePart, R as MessageCompletedEvent, S as MessageInjectedEvent, T as MessageStartedEvent, U as NormalizedAgentEvent, V as NormalizedAgentEventBase, W as NormalizedAgentEventType, X as OpenCodeAgentOptions, Y as OpenCodePluginConfig, Z as OpenCodePluginEvent, _ as OpenCodePluginHookConfig, $ as OpenCodeProviderOptions, a0 as PermissionRequestedEvent, a1 as PermissionResolvedEvent, a2 as RawAgentEvent, a3 as ReasoningDeltaEvent, a4 as RepoSkillConfig, a5 as RunCancelledEvent, a6 as RunCompletedEvent, a7 as RunErrorEvent, a8 as RunStartedEvent, a9 as SetupLayout, aa as TextDeltaEvent, ab as TextPart, ac as ToolCallCompletedEvent, ad as ToolCallDeltaEvent, ae as ToolCallStartedEvent, af as UserContent, ag as UserContentPart, ah as createNormalizedEvent, ai as normalizeRawAgentEvent, aj as toAISDKEvent, ak as toAISDKStream } from './types-DmkbgYmn.js';
2
+ export { AGENT_RESERVED_PORTS, Agent, agentboxRoot, collectAllAgentReservedPorts, getAgentLayout } from './agents/index.js';
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';
5
5
  export { ProviderLogAssembler } from './events/index.js';
6
6
  export { AgentProvider, SandboxProvider } from './enums.js';
package/dist/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import {
2
- Agent
3
- } from "./chunk-T3RBNOSE.js";
2
+ Agent,
3
+ agentboxRoot,
4
+ getAgentLayout
5
+ } from "./chunk-VBMMNUB7.js";
4
6
  import {
5
7
  ProviderLogAssembler,
6
8
  createNormalizedEvent,
@@ -12,7 +14,7 @@ import {
12
14
  Sandbox,
13
15
  SandboxAdapter,
14
16
  buildGitCloneCommand
15
- } from "./chunk-QNNAAVJV.js";
17
+ } from "./chunk-HYHLKO3L.js";
16
18
  import {
17
19
  AGENT_RESERVED_PORTS,
18
20
  collectAllAgentReservedPorts
@@ -30,9 +32,11 @@ export {
30
32
  Sandbox,
31
33
  SandboxAdapter,
32
34
  SandboxProvider,
35
+ agentboxRoot,
33
36
  buildGitCloneCommand,
34
37
  collectAllAgentReservedPorts,
35
38
  createNormalizedEvent,
39
+ getAgentLayout,
36
40
  normalizeRawAgentEvent,
37
41
  toAISDKEvent,
38
42
  toAISDKStream
@@ -1,5 +1,5 @@
1
- import { l as SandboxProviderName, i as SandboxOptions, a as CommandOptions, b as CommandResult, A as AsyncCommandHandle, h as SandboxListOptions, g as SandboxDescriptor, T as TarballEntry, G as GitCloneOptions } from '../Sandbox-K6VNqKeo.js';
2
- export { C as CommandEvent, D as DaytonaProviderOptions, c as DaytonaSandboxOptions, E as E2bProviderOptions, d as E2bSandboxOptions, L as LocalDockerProviderOptions, e as LocalDockerSandboxOptions, M as ModalProviderOptions, f as ModalSandboxOptions, S as Sandbox, j as SandboxOptionsBase, k as SandboxOptionsMap, m as SandboxRaw, n as SandboxRawMap, o as SandboxResourceSpec, V as VercelGitSource, p as VercelProviderOptions, q as VercelSandboxOptions } from '../Sandbox-K6VNqKeo.js';
1
+ import { l as SandboxProviderName, i as SandboxOptions, a as CommandOptions, b as CommandResult, A as AsyncCommandHandle, h as SandboxListOptions, g as SandboxDescriptor, T as TarballEntry, G as GitCloneOptions } from '../Sandbox-DcKAU-E3.js';
2
+ export { C as CommandEvent, D as DaytonaProviderOptions, c as DaytonaSandboxOptions, E as E2bProviderOptions, d as E2bSandboxOptions, L as LocalDockerProviderOptions, e as LocalDockerSandboxOptions, M as ModalProviderOptions, f as ModalSandboxOptions, S as Sandbox, j as SandboxOptionsBase, k as SandboxOptionsMap, m as SandboxRaw, n as SandboxRawMap, o as SandboxResourceSpec, V as VercelGitSource, p as VercelProviderOptions, q as VercelSandboxOptions } from '../Sandbox-DcKAU-E3.js';
3
3
  export { SandboxProvider } from '../enums.js';
4
4
  import 'e2b';
5
5
  import '@vercel/sandbox';
@@ -60,6 +60,22 @@ declare abstract class SandboxAdapter<TProvider extends SandboxProviderName = Sa
60
60
  * (potentially slow) sandbox attach / create happens.
61
61
  */
62
62
  findOrProvision(): Promise<void>;
63
+ /**
64
+ * Attach to an already-existing sandbox by id. Skips the
65
+ * `findMatchingSandbox` lookup that `findOrProvision` does — useful when
66
+ * the caller just created the sandbox (e.g. via a fork API) and knows
67
+ * its id directly. Idempotent: a second call is a no-op once attached.
68
+ *
69
+ * Default implementation throws — providers opt in by overriding
70
+ * `attachExisting`. Currently implemented by the Daytona adapter.
71
+ */
72
+ attachById(id: string): Promise<void>;
73
+ /**
74
+ * Provider hook for `attachById`. Adopt the sandbox with the given id
75
+ * (e.g. fetch via the provider client, mark `isWarmFlag`, start if
76
+ * paused). Throw if the provider doesn't support direct attach.
77
+ */
78
+ protected attachExisting(id: string): Promise<void>;
63
79
  /**
64
80
  * Throw a consistent error when a method that needs a provisioned
65
81
  * sandbox is called before `findOrProvision()`. Provider adapters call
@@ -2,7 +2,7 @@ import {
2
2
  Sandbox,
3
3
  SandboxAdapter,
4
4
  buildGitCloneCommand
5
- } from "../chunk-QNNAAVJV.js";
5
+ } from "../chunk-HYHLKO3L.js";
6
6
  import "../chunk-AVXJMCBC.js";
7
7
  import "../chunk-NSJM57Z4.js";
8
8
  import {
@@ -1,5 +1,5 @@
1
1
  import { AgentProvider } from './enums.js';
2
- import { S as Sandbox } from './Sandbox-K6VNqKeo.js';
2
+ import { S as Sandbox } from './Sandbox-DcKAU-E3.js';
3
3
 
4
4
  interface RawAgentEvent<TPayload = unknown> {
5
5
  provider: string;
@@ -284,6 +284,15 @@ interface AgentCommandConfig {
284
284
  model?: string;
285
285
  subtask?: boolean;
286
286
  }
287
+ interface SetupLayout {
288
+ rootDir: string;
289
+ homeDir: string;
290
+ xdgConfigHome: string;
291
+ agentsDir: string;
292
+ claudeDir: string;
293
+ opencodeDir: string;
294
+ codexDir: string;
295
+ }
287
296
 
288
297
  type AgentProviderName = AgentProvider;
289
298
  type DataContent = string | URL | Uint8Array | ArrayBuffer | Buffer;
@@ -581,4 +590,4 @@ interface AgentProviderAdapter<P extends AgentProviderName = AgentProviderName>
581
590
  attachSendMessage(request: AgentAttachRequest<P>, content: UserContent): Promise<void>;
582
591
  }
583
592
 
584
- export { type OpenCodeProviderOptions as $, type AISDKEvent as A, type ClaudeCodeHookEvent as B, type ClaudeCodeAgentOptions as C, type ClaudeCodeHookHandler as D, type ClaudeCodeHookMatcherGroup as E, type ClaudeCodeHooksConfig as F, type ClaudeCodeProviderOptions as G, type CodexAgentOptions as H, type CodexCommandHook as I, type CodexHookEvent as J, type CodexHookMatcherGroup as K, type CodexHooksConfig as L, type CodexProviderOptions as M, type DataContent as N, type EmbeddedSkillConfig as O, type FilePart as P, type ImagePart as Q, type MessageCompletedEvent as R, type MessageInjectedEvent as S, type MessageStartedEvent as T, type NormalizedAgentEvent as U, type NormalizedAgentEventBase as V, type NormalizedAgentEventType as W, type OpenCodeAgentOptions as X, type OpenCodePluginConfig as Y, type OpenCodePluginEvent as Z, type OpenCodePluginHookConfig as _, type AgentApprovalMode as a, type PermissionRequestedEvent as a0, type PermissionResolvedEvent as a1, type RawAgentEvent as a2, type ReasoningDeltaEvent as a3, type RepoSkillConfig as a4, type RunCancelledEvent as a5, type RunCompletedEvent as a6, type RunErrorEvent as a7, type RunStartedEvent as a8, type TextDeltaEvent as a9, type TextPart as aa, type ToolCallCompletedEvent as ab, type ToolCallDeltaEvent as ac, type ToolCallStartedEvent as ad, type UserContent as ae, type UserContentPart as af, createNormalizedEvent as ag, normalizeRawAgentEvent as ah, toAISDKEvent as ai, toAISDKStream as aj, type AgentAttachRequest as b, type AgentCommandConfig as c, type AgentCostData as d, type AgentExecutionRequest as e, type AgentLocalMcpConfig as f, type AgentMcpConfig as g, type AgentOptions as h, type AgentOptionsBase as i, type AgentOptionsMap as j, type AgentPermissionDecision as k, type AgentPermissionKind as l, type AgentPermissionResponse as m, type AgentProviderAdapter as n, type AgentProviderName as o, type AgentReasoningEffort as p, type AgentRemoteMcpConfig as q, type AgentResult as r, type AgentRun as s, type AgentRunConfig as t, type AgentRunSink as u, type AgentSetupRequest as v, type AgentSkillConfig as w, type AgentSubAgentConfig as x, type AttachedRun as y, type ClaudeCodeHookConfig as z };
593
+ export { type OpenCodeProviderOptions as $, type AISDKEvent as A, type ClaudeCodeHookEvent as B, type ClaudeCodeAgentOptions as C, type ClaudeCodeHookHandler as D, type ClaudeCodeHookMatcherGroup as E, type ClaudeCodeHooksConfig as F, type ClaudeCodeProviderOptions as G, type CodexAgentOptions as H, type CodexCommandHook as I, type CodexHookEvent as J, type CodexHookMatcherGroup as K, type CodexHooksConfig as L, type CodexProviderOptions as M, type DataContent as N, type EmbeddedSkillConfig as O, type FilePart as P, type ImagePart as Q, type MessageCompletedEvent as R, type MessageInjectedEvent as S, type MessageStartedEvent as T, type NormalizedAgentEvent as U, type NormalizedAgentEventBase as V, type NormalizedAgentEventType as W, type OpenCodeAgentOptions as X, type OpenCodePluginConfig as Y, type OpenCodePluginEvent as Z, type OpenCodePluginHookConfig as _, type AgentApprovalMode as a, type PermissionRequestedEvent as a0, type PermissionResolvedEvent as a1, type RawAgentEvent as a2, type ReasoningDeltaEvent as a3, type RepoSkillConfig as a4, type RunCancelledEvent as a5, type RunCompletedEvent as a6, type RunErrorEvent as a7, type RunStartedEvent as a8, type SetupLayout as a9, type TextDeltaEvent as aa, type TextPart as ab, type ToolCallCompletedEvent as ac, type ToolCallDeltaEvent as ad, type ToolCallStartedEvent as ae, type UserContent as af, type UserContentPart as ag, createNormalizedEvent as ah, normalizeRawAgentEvent as ai, toAISDKEvent as aj, toAISDKStream as ak, type AgentAttachRequest as b, type AgentCommandConfig as c, type AgentCostData as d, type AgentExecutionRequest as e, type AgentLocalMcpConfig as f, type AgentMcpConfig as g, type AgentOptions as h, type AgentOptionsBase as i, type AgentOptionsMap as j, type AgentPermissionDecision as k, type AgentPermissionKind as l, type AgentPermissionResponse as m, type AgentProviderAdapter as n, type AgentProviderName as o, type AgentReasoningEffort as p, type AgentRemoteMcpConfig as q, type AgentResult as r, type AgentRun as s, type AgentRunConfig as t, type AgentRunSink as u, type AgentSetupRequest as v, type AgentSkillConfig as w, type AgentSubAgentConfig as x, type AttachedRun as y, type ClaudeCodeHookConfig as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentbox-sdk",
3
- "version": "0.1.308",
3
+ "version": "0.1.309",
4
4
  "description": "Swappable coding agents and sandbox providers for Bun and TypeScript.",
5
5
  "license": "MIT",
6
6
  "repository": {