Skip to content
API reference

sandbox-wire

Import
import * as api from "@fungi.computer/mycelium/sandbox-wire";
Kind Export Description
type alias SandboxWire Typed, decoded host wire value.
constant sandboxWireSchema The host-to-host result contract; raw diagnostic fields never go to guest code.
function sandboxWireFailure() Convert one validated wire failure into the shared error channel.
function sandboxFailureWire() Host-only encoding; the guest receives only the admitted diagnostic text.

SandboxWiretype alias

Section titled “SandboxWire”
Signature
type SandboxWire = z.output<typeof sandboxWireSchema>;

Typed, decoded host wire value.

sandboxWireSchemaconstant

Section titled “sandboxWireSchema”
Signature
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()function

Section titled “sandboxWireFailure()”
Signature
function sandboxWireFailure(error): SandboxFailure;

Convert one validated wire failure into the shared error channel.

Parameter Type
error | { 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: "sandbox_busy"; code: "sandbox-busy"; capacity: number; waitedMs: 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()function

Section titled “sandboxFailureWire()”
Signature
function sandboxFailureWire(failure): JSONType;

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

Parameter Type
failure SandboxFailure

JSONType