agentbox-sdk 0.1.322 → 0.1.323

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.
@@ -1,5 +1,5 @@
1
- import { o as AgentProviderName, h as AgentOptions, t as AgentRunConfig, s as AgentRun, r as AgentResult, a3 as RawAgentEvent, b as AgentAttachRequest, y as AttachedRun, aa as SetupLayout } from '../types-DG4J_zMT.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, a0 as OpenRouterPlugin, a5 as RepoSkillConfig, ac as TextPart, ag as UserContent, ah as UserContentPart } from '../types-DG4J_zMT.js';
1
+ import { o as AgentProviderName, h as AgentOptions, t as AgentRunConfig, s as AgentRun, r as AgentResult, a3 as RawAgentEvent, b as AgentAttachRequest, y as AttachedRun, aa as SetupLayout } from '../types-t01PuLUJ.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, a0 as OpenRouterPlugin, a5 as RepoSkillConfig, ac as TextPart, ag as UserContent, ah as UserContentPart } from '../types-t01PuLUJ.js';
3
3
  import { S as Sandbox } from '../Sandbox-DcKAU-E3.js';
4
4
  export { AgentProvider } from '../enums.js';
5
5
  import 'e2b';
@@ -42,6 +42,23 @@ declare class Agent<P extends AgentProviderName = AgentProviderName> {
42
42
  * work.
43
43
  */
44
44
  setup(): Promise<void>;
45
+ /**
46
+ * Stop the long-lived provider CLI server booted by {@link Agent.setup}
47
+ * (claude-code relay daemon, codex app-server, opencode `serve`).
48
+ *
49
+ * agentbox NEVER kills a running server on its own — not on run
50
+ * completion, not on `abort()`, and not when {@link Agent.setup} detects
51
+ * a changed config/credential set. This method is the single, explicit,
52
+ * developer-driven teardown. Call it to free a server's resources, or to
53
+ * apply a changed config: after `killServer()` the next {@link setup}
54
+ * cold-starts a fresh server with the new configuration.
55
+ *
56
+ * Best-effort and idempotent: a no-op when no server is running, or when
57
+ * the provider has no shared server for the current mode (host-mode
58
+ * claude-code runs the SDK in-process; local codex spawns a fresh
59
+ * app-server per run, torn down with the run).
60
+ */
61
+ killServer(): Promise<void>;
45
62
  stream(runConfig: AgentRunConfig): AgentRun;
46
63
  run(runConfig: AgentRunConfig): Promise<AgentResult>;
47
64
  rawEvents(runConfig: AgentRunConfig): AsyncIterable<RawAgentEvent>;
@@ -2,7 +2,7 @@ import {
2
2
  Agent,
3
3
  agentboxRoot,
4
4
  getAgentLayout
5
- } from "../chunk-ZK5PDWOI.js";
5
+ } from "../chunk-XONT46YC.js";
6
6
  import "../chunk-775FIGGL.js";
7
7
  import {
8
8
  AGENT_RESERVED_PORTS,
@@ -251,6 +251,20 @@ function resolveSandboxResources(resources) {
251
251
  }
252
252
 
253
253
  // src/sandboxes/providers/daytona.ts
254
+ var STARTABLE_STATES = /* @__PURE__ */ new Set(["stopped", "archived"]);
255
+ var TERMINAL_STATES = /* @__PURE__ */ new Set([
256
+ "error",
257
+ "build_failed",
258
+ "destroyed",
259
+ "destroying"
260
+ ]);
261
+ var ATTACH_SETTLE_TIMEOUT_MS = 12e4;
262
+ var ATTACH_POLL_INTERVAL_MS = 2e3;
263
+ function isStateChangeInProgressError(err) {
264
+ const e = err;
265
+ if (!e) return false;
266
+ return e.statusCode === 409 || e.name === "DaytonaConflictError" || /state change in progress/i.test(e.message ?? "");
267
+ }
254
268
  var DaytonaSandboxAdapter = class extends SandboxAdapter {
255
269
  client;
256
270
  sandbox;
@@ -292,20 +306,54 @@ var DaytonaSandboxAdapter = class extends SandboxAdapter {
292
306
  throw new Error(`Daytona sandbox ${id} not found`);
293
307
  }
294
308
  this.sandbox = existing;
295
- const state = existing.state ?? "unknown";
296
- const isWarm = state === "started";
297
- if (!isWarm) {
298
- await existing.start();
309
+ this.isWarmFlag = existing.state === "started";
310
+ await this.ensureStarted(existing);
311
+ }
312
+ /**
313
+ * Bring a sandbox to the `started` state, tolerating in-flight transitions.
314
+ *
315
+ * `start()` only works from a resting state (`stopped`/`archived`); calling
316
+ * it while the sandbox is creating/starting/restoring/snapshotting/etc. — or
317
+ * racing another caller that's already starting it — makes Daytona 409 with
318
+ * "Sandbox state change in progress". So we poll: start from a resting
319
+ * state, wait out a transition, fail fast on a terminal state, and treat a
320
+ * 409 as "someone else is mid-transition" and keep waiting.
321
+ */
322
+ async ensureStarted(sandbox) {
323
+ let current = sandbox;
324
+ const deadline = Date.now() + ATTACH_SETTLE_TIMEOUT_MS;
325
+ for (; ; ) {
326
+ const state = current.state ?? "unknown";
327
+ if (state === "started") return;
328
+ if (TERMINAL_STATES.has(state)) {
329
+ throw new Error(
330
+ `Daytona sandbox ${current.id} is in a terminal state: ${state}`
331
+ );
332
+ }
333
+ if (STARTABLE_STATES.has(state)) {
334
+ try {
335
+ await current.start();
336
+ return;
337
+ } catch (err) {
338
+ if (!isStateChangeInProgressError(err)) throw err;
339
+ }
340
+ }
341
+ if (Date.now() >= deadline) {
342
+ throw new Error(
343
+ `Timed out waiting for Daytona sandbox ${current.id} to start (state=${state})`
344
+ );
345
+ }
346
+ await sleep(ATTACH_POLL_INTERVAL_MS);
347
+ current = await this.client.get(current.id);
348
+ this.sandbox = current;
299
349
  }
300
- this.isWarmFlag = isWarm;
301
350
  }
302
351
  async provision() {
303
352
  const existing = await this.findMatchingSandbox();
304
353
  if (existing) {
305
354
  this.sandbox = existing;
306
- const isWarm = existing.state === "started";
307
- await existing.start();
308
- this.isWarmFlag = isWarm;
355
+ this.isWarmFlag = existing.state === "started";
356
+ await this.ensureStarted(existing);
309
357
  return;
310
358
  }
311
359
  const labels = this.getLabels();
@@ -2181,6 +2181,24 @@ var ClaudeCodeAgentAdapter = class {
2181
2181
  * match what we'd produce, we skip the artifact upload AND the daemon
2182
2182
  * boot entirely.
2183
2183
  */
2184
+ /**
2185
+ * Explicit, developer-invoked teardown of the in-sandbox claude-code
2186
+ * relay daemon (see {@link AgentProviderAdapter.killServer}). agentbox
2187
+ * never calls this on its own. Best-effort and idempotent: a no-op when
2188
+ * the daemon isn't running or no sandbox is configured. After it returns
2189
+ * the next `setup()` re-spawns the daemon (its `/__version` probe fails).
2190
+ */
2191
+ async killServer(request) {
2192
+ const sandbox = request.options.sandbox;
2193
+ if (!sandbox) return;
2194
+ await sandbox.run(
2195
+ [
2196
+ `if [ -f ${shellQuote(DAEMON_PID_PATH)} ]; then kill -TERM "$(cat ${shellQuote(DAEMON_PID_PATH)})" 2>/dev/null || true; rm -f ${shellQuote(DAEMON_PID_PATH)}; fi`,
2197
+ `fuser -k -n tcp ${DAEMON_PORT} 2>/dev/null || true`
2198
+ ].join("; "),
2199
+ { cwd: request.options.cwd, timeoutMs: 1e4 }
2200
+ ).catch(() => void 0);
2201
+ }
2184
2202
  async setup(request) {
2185
2203
  await time(debugClaude, "claude-code setup()", async () => {
2186
2204
  const options = request.options;
@@ -3573,10 +3591,34 @@ async function buildCodexInputItems(options, inputParts) {
3573
3591
  );
3574
3592
  return inputItems;
3575
3593
  }
3594
+ async function killCodexAppServer(request) {
3595
+ const { options } = request;
3596
+ const sandbox = options.sandbox;
3597
+ if (!sandbox) return;
3598
+ const sharedTarget = await createSetupTarget(
3599
+ request.provider,
3600
+ REMOTE_CODEX_APP_SERVER_ID,
3601
+ options
3602
+ );
3603
+ const pidFilePath = path9.posix.join(
3604
+ sharedTarget.layout.rootDir,
3605
+ "codex-app-server.pid"
3606
+ );
3607
+ await sandbox.run(
3608
+ [
3609
+ `if [ -f ${shellQuote(pidFilePath)} ]; then kill "$(cat ${shellQuote(pidFilePath)})" 2>/dev/null || true; rm -f ${shellQuote(pidFilePath)}; fi`,
3610
+ `fuser -k -n tcp ${REMOTE_CODEX_APP_SERVER_PORT} 2>/dev/null || true`
3611
+ ].join("; "),
3612
+ { cwd: options.cwd, timeoutMs: 1e4 }
3613
+ ).catch(() => void 0);
3614
+ }
3576
3615
  var CodexAgentAdapter = class {
3577
3616
  async setup(request) {
3578
3617
  await setupCodex(request);
3579
3618
  }
3619
+ async killServer(request) {
3620
+ await killCodexAppServer(request);
3621
+ }
3580
3622
  async execute(request, sink) {
3581
3623
  const executeStartedAt = Date.now();
3582
3624
  debugCodex("execute() start runId=%s", request.runId);
@@ -4152,6 +4194,12 @@ async function ensureSandboxOpenCodeServer(request) {
4152
4194
  debugOpencode("opencode setup() preflight hit \u2014 skipping");
4153
4195
  return;
4154
4196
  }
4197
+ if (await isSandboxOpenCodeServerHealthy(sandbox, options.cwd, port)) {
4198
+ debugOpencode(
4199
+ "opencode server already running but setup drifted \u2014 reusing it without restart; call agent.killServer() to apply the new config"
4200
+ );
4201
+ return;
4202
+ }
4155
4203
  const commonEnv = {
4156
4204
  OPENCODE_CONFIG: configPath,
4157
4205
  OPENCODE_CONFIG_DIR: target.layout.opencodeDir,
@@ -4311,7 +4359,13 @@ async function ensureLocalOpenCodeServer(request) {
4311
4359
  debugOpencode("local opencode server up-to-date \u2014 reusing");
4312
4360
  return;
4313
4361
  }
4314
- debugOpencode("local opencode server drifted/absent \u2014 (re)spawning");
4362
+ if (await isLocalOpenCodeServerHealthy()) {
4363
+ debugOpencode(
4364
+ "local opencode server already running but setup drifted \u2014 reusing it without restart; call agent.killServer() to apply the new config"
4365
+ );
4366
+ return;
4367
+ }
4368
+ debugOpencode("local opencode server absent \u2014 spawning");
4315
4369
  await applyDifferentialSetup(target, allArtifacts, installCommands);
4316
4370
  await killLocalOpenCodeServer();
4317
4371
  spawnCommand({
@@ -4344,6 +4398,45 @@ async function setupOpenCode(request) {
4344
4398
  }
4345
4399
  await ensureLocalOpenCodeServer(request);
4346
4400
  }
4401
+ async function isSandboxOpenCodeServerHealthy(sandbox, cwd, port) {
4402
+ const probe = await sandbox.run(
4403
+ `curl -fsS --max-time 2 http://127.0.0.1:${port}/global/health >/dev/null 2>&1`,
4404
+ { cwd, timeoutMs: 5e3 }
4405
+ ).catch(() => void 0);
4406
+ return probe?.exitCode === 0;
4407
+ }
4408
+ async function isLocalOpenCodeServerHealthy() {
4409
+ try {
4410
+ const res = await fetch(
4411
+ `http://127.0.0.1:${LOCAL_OPENCODE_PORT}/global/health`
4412
+ );
4413
+ return res.ok;
4414
+ } catch {
4415
+ return false;
4416
+ }
4417
+ }
4418
+ async function killOpenCodeServer(request) {
4419
+ const { options } = request;
4420
+ if (options.sandbox) {
4421
+ const target = await createSetupTarget(
4422
+ request.provider,
4423
+ SHARED_OPENCODE_TARGET_ID,
4424
+ options
4425
+ );
4426
+ const pidFilePath = path10.posix.join(
4427
+ target.layout.rootDir,
4428
+ "opencode-serve.pid"
4429
+ );
4430
+ await killSandboxOpenCodeServer(
4431
+ options.sandbox,
4432
+ pidFilePath,
4433
+ options.cwd,
4434
+ SANDBOX_OPENCODE_PORT
4435
+ );
4436
+ return;
4437
+ }
4438
+ await killLocalOpenCodeServer();
4439
+ }
4347
4440
  async function buildOpenCodeRuntime(options) {
4348
4441
  if (options.sandbox) {
4349
4442
  const sandbox = options.sandbox;
@@ -4365,6 +4458,9 @@ var OpenCodeAgentAdapter = class {
4365
4458
  async setup(request) {
4366
4459
  await setupOpenCode(request);
4367
4460
  }
4461
+ async killServer(request) {
4462
+ await killOpenCodeServer(request);
4463
+ }
4368
4464
  async execute(request, sink) {
4369
4465
  const executeStartedAt = Date.now();
4370
4466
  debugOpencode("execute() start runId=%s", request.runId);
@@ -5353,6 +5449,30 @@ var Agent = class {
5353
5449
  throw error;
5354
5450
  }
5355
5451
  }
5452
+ /**
5453
+ * Stop the long-lived provider CLI server booted by {@link Agent.setup}
5454
+ * (claude-code relay daemon, codex app-server, opencode `serve`).
5455
+ *
5456
+ * agentbox NEVER kills a running server on its own — not on run
5457
+ * completion, not on `abort()`, and not when {@link Agent.setup} detects
5458
+ * a changed config/credential set. This method is the single, explicit,
5459
+ * developer-driven teardown. Call it to free a server's resources, or to
5460
+ * apply a changed config: after `killServer()` the next {@link setup}
5461
+ * cold-starts a fresh server with the new configuration.
5462
+ *
5463
+ * Best-effort and idempotent: a no-op when no server is running, or when
5464
+ * the provider has no shared server for the current mode (host-mode
5465
+ * claude-code runs the SDK in-process; local codex spawns a fresh
5466
+ * app-server per run, torn down with the run).
5467
+ */
5468
+ async killServer() {
5469
+ debugAgent("killServer() provider=%s", this.provider);
5470
+ await this.adapter.killServer({
5471
+ provider: this.provider,
5472
+ options: this.options
5473
+ });
5474
+ this.setupPromise = void 0;
5475
+ }
5356
5476
  stream(runConfig) {
5357
5477
  if (runConfig.resumeSessionId && runConfig.forkSessionId) {
5358
5478
  throw new Error(
@@ -1,4 +1,4 @@
1
- export { A as AISDKEvent, R as MessageCompletedEvent, S as MessageInjectedEvent, T as MessageStartedEvent, U as NormalizedAgentEvent, V as NormalizedAgentEventBase, W as NormalizedAgentEventType, a1 as PermissionRequestedEvent, a2 as PermissionResolvedEvent, a3 as RawAgentEvent, a4 as ReasoningDeltaEvent, a6 as RunCancelledEvent, a7 as RunCompletedEvent, a8 as RunErrorEvent, a9 as RunStartedEvent, ab as TextDeltaEvent, ad as ToolCallCompletedEvent, ae as ToolCallDeltaEvent, af as ToolCallStartedEvent, ai as createNormalizedEvent, aj as normalizeRawAgentEvent, ak as toAISDKEvent, al as toAISDKStream } from '../types-DG4J_zMT.js';
1
+ export { A as AISDKEvent, R as MessageCompletedEvent, S as MessageInjectedEvent, T as MessageStartedEvent, U as NormalizedAgentEvent, V as NormalizedAgentEventBase, W as NormalizedAgentEventType, a1 as PermissionRequestedEvent, a2 as PermissionResolvedEvent, a3 as RawAgentEvent, a4 as ReasoningDeltaEvent, a6 as RunCancelledEvent, a7 as RunCompletedEvent, a8 as RunErrorEvent, a9 as RunStartedEvent, ab as TextDeltaEvent, ad as ToolCallCompletedEvent, ae as ToolCallDeltaEvent, af as ToolCallStartedEvent, ai as createNormalizedEvent, aj as normalizeRawAgentEvent, ak as toAISDKEvent, al as toAISDKStream } from '../types-t01PuLUJ.js';
2
2
  import { AgentProvider } from '../enums.js';
3
3
  import '../Sandbox-DcKAU-E3.js';
4
4
  import 'e2b';
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 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 OpenRouterPlugin, a1 as PermissionRequestedEvent, a2 as PermissionResolvedEvent, a3 as RawAgentEvent, a4 as ReasoningDeltaEvent, a5 as RepoSkillConfig, a6 as RunCancelledEvent, a7 as RunCompletedEvent, a8 as RunErrorEvent, a9 as RunStartedEvent, aa as SetupLayout, ab as TextDeltaEvent, ac as TextPart, ad as ToolCallCompletedEvent, ae as ToolCallDeltaEvent, af as ToolCallStartedEvent, ag as UserContent, ah as UserContentPart, ai as createNormalizedEvent, aj as normalizeRawAgentEvent, ak as toAISDKEvent, al as toAISDKStream } from './types-DG4J_zMT.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 OpenRouterPlugin, a1 as PermissionRequestedEvent, a2 as PermissionResolvedEvent, a3 as RawAgentEvent, a4 as ReasoningDeltaEvent, a5 as RepoSkillConfig, a6 as RunCancelledEvent, a7 as RunCompletedEvent, a8 as RunErrorEvent, a9 as RunStartedEvent, aa as SetupLayout, ab as TextDeltaEvent, ac as TextPart, ad as ToolCallCompletedEvent, ae as ToolCallDeltaEvent, af as ToolCallStartedEvent, ag as UserContent, ah as UserContentPart, ai as createNormalizedEvent, aj as normalizeRawAgentEvent, ak as toAISDKEvent, al as toAISDKStream } from './types-t01PuLUJ.js';
2
2
  export { AGENT_RESERVED_PORTS, Agent, agentboxRoot, collectAllAgentReservedPorts, getAgentLayout } 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
@@ -2,7 +2,7 @@ import {
2
2
  Agent,
3
3
  agentboxRoot,
4
4
  getAgentLayout
5
- } from "./chunk-ZK5PDWOI.js";
5
+ } from "./chunk-XONT46YC.js";
6
6
  import {
7
7
  ProviderLogAssembler,
8
8
  createNormalizedEvent,
@@ -14,7 +14,7 @@ import {
14
14
  Sandbox,
15
15
  SandboxAdapter,
16
16
  buildGitCloneCommand
17
- } from "./chunk-T4AS2WEF.js";
17
+ } from "./chunk-TUBBWIOM.js";
18
18
  import {
19
19
  AGENT_RESERVED_PORTS,
20
20
  collectAllAgentReservedPorts
@@ -2,7 +2,7 @@ import {
2
2
  Sandbox,
3
3
  SandboxAdapter,
4
4
  buildGitCloneCommand
5
- } from "../chunk-T4AS2WEF.js";
5
+ } from "../chunk-TUBBWIOM.js";
6
6
  import "../chunk-AVXJMCBC.js";
7
7
  import "../chunk-NSJM57Z4.js";
8
8
  import {
@@ -599,6 +599,22 @@ interface AgentProviderAdapter<P extends AgentProviderName = AgentProviderName>
599
599
  * is already listening.
600
600
  */
601
601
  setup(request: AgentSetupRequest<P>): Promise<void>;
602
+ /**
603
+ * Stop the long-lived provider CLI server that {@link setup} boots
604
+ * (claude-code relay daemon, codex app-server, opencode `serve`).
605
+ *
606
+ * agentbox NEVER calls this on its own — not on run completion, not on
607
+ * abort, and not when {@link setup} sees a changed config/credential
608
+ * set. It exists purely so a developer can explicitly tear a server
609
+ * down (to reclaim resources, or to force the changed config to apply
610
+ * on the next cold {@link setup}).
611
+ *
612
+ * Best-effort and idempotent: a no-op when nothing is running, or when
613
+ * the provider has no shared server for the current mode (host-mode
614
+ * claude-code runs the SDK in-process; local codex spawns a fresh
615
+ * app-server per run).
616
+ */
617
+ killServer(request: AgentSetupRequest<P>): Promise<void>;
602
618
  execute(request: AgentExecutionRequest<P>, sink: AgentRunSink): Promise<() => Promise<void> | void>;
603
619
  /**
604
620
  * Stateless abort. Dial the in-sandbox provider server, issue the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentbox-sdk",
3
- "version": "0.1.322",
3
+ "version": "0.1.323",
4
4
  "description": "Swappable coding agents and sandbox providers for Bun and TypeScript.",
5
5
  "license": "MIT",
6
6
  "repository": {