API reference
sandbox-wire
Import
Section titled “Import”import * as api from "@fungi.computer/mycelium/sandbox-wire";Exports
Section titled “Exports”| 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”type SandboxWire = z.output<typeof sandboxWireSchema>;Typed, decoded host wire value.
sandboxWireSchemaconstant
Section titled “sandboxWireSchema”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()”function sandboxWireFailure(error): SandboxFailure;Convert one validated wire failure into the shared error channel.
Parameters
Section titled “Parameters”| 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; } |
Returns
Section titled “Returns”sandboxFailureWire()function
Section titled “sandboxFailureWire()”function sandboxFailureWire(failure): JSONType;Host-only encoding; the guest receives only the admitted diagnostic text.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
failure |
SandboxFailure |
Returns
Section titled “Returns”JSONType