import { HarnessV1SandboxProvider, HarnessV1NetworkSandboxSession } from '@ai-sdk/harness'; import { Experimental_SandboxSession } from '@ai-sdk/provider-utils'; import { Sandbox } from 'just-bash'; /** * Parameters forwarded to `just-bash`'s `Sandbox.create` when creating a * sandbox from scratch. Aliased directly from the underlying SDK so the full * surface is available without us re-declaring it. */ type JustBashSandboxCreateParams = NonNullable[0]>; /** * Settings for {@link createJustBashSandbox}. Two mutually-exclusive shapes: * * - `{ sandbox }` — wrap an already-created `just-bash` `Sandbox`. The caller * owns its lifecycle. * - {@link JustBashSandboxCreateParams} fields — provider calls * `Sandbox.create(settings)` on every `createSession()`. * * just-bash has no port exposure and no snapshot mechanism, so image * management is a per-call no-op: if an adapter declares a bootstrap recipe * the provider runs it once on the freshly-created sandbox before returning. */ type JustBashSandboxSettings = { sandbox: Sandbox; } | (JustBashSandboxCreateParams & { sandbox?: never; }); declare function createJustBashSandbox(settings?: JustBashSandboxSettings): HarnessV1SandboxProvider; /** * `HarnessV1SandboxProvider` implementation backed by `just-bash`. Useful for * non-bridge harness flows and for handing a local `Experimental_SandboxSession` * to AI SDK tools — use `provider.createSession()` then * `sandboxSession.restricted()` to get the latter. * * Note: just-bash cannot expose ports, so bridge-backed harness adapters * (claude-code, codex) will reject this provider at start. */ declare class JustBashSandboxProvider implements HarnessV1SandboxProvider { private readonly settings; readonly specificationVersion: "harness-sandbox-v1"; readonly providerId = "just-bash-sandbox"; constructor(settings: JustBashSandboxSettings); createSession: (options?: { sessionId?: string; abortSignal?: AbortSignal; identity?: string; onFirstCreate?: (session: Experimental_SandboxSession, opts: { abortSignal?: AbortSignal; }) => Promise; }) => Promise; } export { JustBashSandboxProvider, type JustBashSandboxSettings, createJustBashSandbox };