Skip to content
API reference

sandbox-boundary

Import
import * as api from "@fungi.computer/mycelium/sandbox-boundary";
Kind Export Description
type alias SandboxBindingInput JSON argument or the SDK’s explicit absence of an argument.
type alias SandboxOperationBindings Host operation callbacks after decoding JSON or an absent RPC argument.
function isSandboxFailure() Admit only errors constructed by the sandbox owner, using the maintained decoder.
function sandboxFailure() Foreign throws stay private until an owner admits a diagnostic.
function sandboxValueKind() Label a rejected JSON value without caller-owned reflection.
function sandboxBindingInput() Decode the RPC argument before any capability callback observes it.
function sandboxOperatorValue() Full operator representation, including nested errors, aggregates and cycles.
function sandboxGuestFailure() Decode the engine’s guest-owned diagnostic once; renderers receive typed fields.
function sandboxTransportMessage() Error.message is the SDK’s wire carrier; only this safe, bounded envelope crosses it.
function recoverSandboxFailure() Recovery uses the decoded identity, never a match against diagnostic text.
function sandboxExecutorFailure() Decode Codemode’s documented error carrier before adapters choose a failure.
function sandboxTransportErrno() Decode a transport-owned errno without reflecting on a foreign throw in adapters.
function sandboxSourceError() Admit Acorn’s documented offset from a syntax exception at this boundary.
function sandboxCapabilityFailure() Capability owners supply an admission schema; decoding and foreign fallback stay here.
function sandboxBindingBoundary() One boundary owns RPC decoding, safe transport and invocation-scoped recovery.

SandboxBindingInputtype alias

Section titled “SandboxBindingInput”
Signature
type SandboxBindingInput = MyceliumJsonValue | undefined;

JSON argument or the SDK’s explicit absence of an argument.


SandboxOperationBindingstype alias

Section titled “SandboxOperationBindings”
Signature
type SandboxOperationBindings = Readonly<
Record<
string,
Readonly<Record<string, (input) => Promise<MyceliumJsonValue>>>
>
>;

Host operation callbacks after decoding JSON or an absent RPC argument.

isSandboxFailure()function

Section titled “isSandboxFailure()”
Signature
function isSandboxFailure(cause): cause is SandboxFailure;

Admit only errors constructed by the sandbox owner, using the maintained decoder.

Parameter Type
cause unknown

cause is SandboxFailure


sandboxFailure()function

Section titled “sandboxFailure()”
Signature
function sandboxFailure(cause): SandboxFailure;

Foreign throws stay private until an owner admits a diagnostic.

Parameter Type
cause unknown

SandboxFailure


sandboxValueKind()function

Section titled “sandboxValueKind()”
Signature
function sandboxValueKind(value): string;

Label a rejected JSON value without caller-owned reflection.

Parameter Type
value unknown

string


sandboxBindingInput()function

Section titled “sandboxBindingInput()”
Signature
function sandboxBindingInput(value): SandboxBindingInput;

Decode the RPC argument before any capability callback observes it.

Parameter Type
value unknown

SandboxBindingInput


sandboxOperatorValue()function

Section titled “sandboxOperatorValue()”
Signature
function sandboxOperatorValue(cause): JSONType;

Full operator representation, including nested errors, aggregates and cycles.

Parameter Type
cause unknown

JSONType


sandboxGuestFailure()function

Section titled “sandboxGuestFailure()”
Signature
function sandboxGuestFailure(cause, bindings?): GuestThrew;

Decode the engine’s guest-owned diagnostic once; renderers receive typed fields.

Parameter Type
cause unknown
bindings Readonly<Record<string, Readonly<Record<string, SandboxBinding>>>>

GuestThrew


sandboxTransportMessage()function

Section titled “sandboxTransportMessage()”
Signature
function sandboxTransportMessage(failure, ref): string;

Error.message is the SDK’s wire carrier; only this safe, bounded envelope crosses it.

Parameter Type
failure SandboxFailure
ref string

string


recoverSandboxFailure()function

Section titled “recoverSandboxFailure()”
Signature
function recoverSandboxFailure(failure, failures): SandboxFailure;

Recovery uses the decoded identity, never a match against diagnostic text.

Parameter Type
failure SandboxFailure
failures ReadonlyMap<string, SandboxFailure>

SandboxFailure


sandboxExecutorFailure()function

Section titled “sandboxExecutorFailure()”
Signature
function sandboxExecutorFailure(cause, limitMs, elapsedMs): SandboxFailure;

Decode Codemode’s documented error carrier before adapters choose a failure.

Parameter Type
cause unknown
limitMs number
elapsedMs number

SandboxFailure


sandboxTransportErrno()function

Section titled “sandboxTransportErrno()”
Signature
function sandboxTransportErrno(cause): string | undefined;

Decode a transport-owned errno without reflecting on a foreign throw in adapters.

Parameter Type
cause unknown

string | undefined


sandboxSourceError()function

Section titled “sandboxSourceError()”
Signature
function sandboxSourceError(cause):
| Readonly<{
pos: number;
}>
| undefined;

Admit Acorn’s documented offset from a syntax exception at this boundary.

Parameter Type
cause unknown

| Readonly<{ pos: number; }> | undefined


sandboxCapabilityFailure()function

Section titled “sandboxCapabilityFailure()”
Signature
function sandboxCapabilityFailure(
cause,
namespace,
operation,
admitted?,
): SandboxFailure;

Capability owners supply an admission schema; decoding and foreign fallback stay here.

Parameter Type
cause unknown
namespace string
operation string
admitted ZodType<Readonly<{ kind: "Files" | "Forage" | "InvalidInput" | "Unavailable" | "OperationFailed"; message: string; }>>

SandboxFailure


sandboxBindingBoundary()function

Section titled “sandboxBindingBoundary()”
Signature
function sandboxBindingBoundary(bindings): Readonly<{
bindings: SandboxRequest["bindings"];
capture: (failure) => string;
recover: (failure) => SandboxFailure;
returnedFailure: (value) => SandboxFailure | undefined;
}>;

One boundary owns RPC decoding, safe transport and invocation-scoped recovery.

Parameter Type
bindings SandboxOperationBindings

Readonly<{ bindings: SandboxRequest["bindings"]; capture: (failure) => string; recover: (failure) => SandboxFailure; returnedFailure: (value) => SandboxFailure | undefined; }>