Skip to content

sandbox-wire

SandboxWire = z.output<typeof sandboxWireSchema>>

Typed, decoded host wire value.

const sandboxWireSchema: ZodDiscriminatedUnion<[ZodObject<{ ok: ZodLiteral<true>>; value: ZodJSONSchema; }, $strict>>, ZodObject<{ ok: ZodLiteral<false>>; error: ZodDiscriminatedUnion<[ZodObject<{ kind: ZodLiteral<"invalid_source">>; line: ZodNumber; column: ZodNumber; excerpt: ZodString; }, $strict>>, ZodObject<{ kind: ZodLiteral<"guest_threw">>; name: ZodString; message: ZodString; transportMessage: ZodOptional<ZodString>>; }, $strict>>, ZodObject<{ kind: ZodLiteral<"deadline_exceeded">>; limitMs: ZodNumber; elapsedMs: ZodNumber; }, $strict>>], "kind">>; }, $strict>>], "ok">>

The host-to-host result contract; raw diagnostic fields never go to guest code.

sandboxWireFailure(error): SandboxFailure

Convert one validated wire failure into the shared error channel.

{ kind: "invalid_source"; line: number; column: number; excerpt: string; } | { kind: "guest_threw"; name: string; message: string; transportMessage?: string; } | { kind: "deadline_exceeded"; limitMs: number; elapsedMs: number; } | { kind: "result_not_json"; valueKind: string; rawCause: JSONType; } | { kind: "sandbox_crashed"; rawCause: JSONType; } | { kind: "bad_response"; reason: string; rawCause: JSONType; } | { kind: "dispatch_lost"; elapsedMs: number; transport: string; errno?: string; rawCause: JSONType; } | { kind: "cancelled"; by: "caller" | "operator"; } | { kind: "result_too_large"; size: number; } | { kind: "capability_failed"; namespace: string; operation: string; cause: { kind: "Files" | "Forage" | "InvalidInput" | "Unavailable" | "OperationFailed"; message: string; }; rawCause: JSONType; } | { kind: "unknown"; rawCause: JSONType; }

SandboxFailure


sandboxFailureWire(failure): JSONType

Host-only encoding; the guest receives only the admitted diagnostic text.

SandboxFailure

JSONType