/** * Modal Sandbox capabilities — spin up GPU/CPU compute on Modal Labs via the * BlockRun gateway's x402-paid passthrough at /v1/modal/sandbox/{create, exec, * status, terminate}. See https://modal.com/docs/guide/sandboxes for the * underlying primitives. * * Pricing (per-call, USDC): * create: $0.01 (CPU) / $0.05 (T4) / $0.08 (L4) / $0.10 (A10G) / $0.20 (A100) / $0.40 (H100) * exec: $0.001 * status: $0.001 * terminate: $0.001 * * Gateway constraints (probed 2026-05-02): * - image is fixed at python:3.11 — no custom containers yet. * - command is execve-style (string[]), not a shell string. We accept a * plain string from the LLM and auto-wrap to ["sh","-c", string]. * - No stdin / env / workdir / streaming on exec — keep commands self- * contained and idempotent. * - No upload/download endpoints — files in/out via exec heredoc / curl. * * Lifecycle: * ModalCreate → returns sandbox_id, charged at GPU tier * ModalExec → sync, returns { stdout, stderr, exit_code } * ModalStatus → check running/terminated * ModalTerminate → release; called automatically at session end via * the SessionSandboxTracker registry. */ import type { CapabilityHandler } from '../agent/types.js'; export interface SandboxRecord { id: string; gpu: string; createdAt: number; timeoutSeconds?: number; } declare class SessionSandboxTracker { private sandboxes; add(rec: SandboxRecord): void; remove(id: string): void; list(): SandboxRecord[]; /** Snapshot then clear — used by the session cleanup hook. */ drainIds(): string[]; } export declare const sessionSandboxTracker: SessionSandboxTracker; export declare const modalCreateCapability: CapabilityHandler; export declare const modalExecCapability: CapabilityHandler; export declare const modalStatusCapability: CapabilityHandler; export declare const modalTerminateCapability: CapabilityHandler; /** * Terminate every sandbox the current session has created. Called from * vscode-session.ts at session end (and the SessionToolGuard cleanup path) * so a missed agent ModalTerminate doesn't leave Modal billing the user * up to the per-sandbox timeout. Best-effort: failures are logged but * don't block session shutdown. */ export declare function terminateAllSessionSandboxes(opts?: { abortSignal?: AbortSignal; }): Promise<{ attempted: number; succeeded: number; failed: Array<{ id: string; error: string; }>; }>; export declare const modalCapabilities: CapabilityHandler[]; export {};