sandbox-boundary
Import
Section titled “Import”import * as api from "@fungi.computer/mycelium/sandbox-boundary";Exports
Section titled “Exports”| 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”type SandboxBindingInput = MyceliumJsonValue | undefined;JSON argument or the SDK’s explicit absence of an argument.
SandboxOperationBindingstype alias
Section titled “SandboxOperationBindings”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()”function isSandboxFailure(cause): cause is SandboxFailure;Admit only errors constructed by the sandbox owner, using the maintained decoder.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
cause |
unknown |
Returns
Section titled “Returns”cause is SandboxFailure
sandboxFailure()function
Section titled “sandboxFailure()”function sandboxFailure(cause): SandboxFailure;Foreign throws stay private until an owner admits a diagnostic.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
cause |
unknown |
Returns
Section titled “Returns”sandboxValueKind()function
Section titled “sandboxValueKind()”function sandboxValueKind(value): string;Label a rejected JSON value without caller-owned reflection.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
unknown |
Returns
Section titled “Returns”string
sandboxBindingInput()function
Section titled “sandboxBindingInput()”function sandboxBindingInput(value): SandboxBindingInput;Decode the RPC argument before any capability callback observes it.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
unknown |
Returns
Section titled “Returns”sandboxOperatorValue()function
Section titled “sandboxOperatorValue()”function sandboxOperatorValue(cause): JSONType;Full operator representation, including nested errors, aggregates and cycles.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
cause |
unknown |
Returns
Section titled “Returns”JSONType
sandboxGuestFailure()function
Section titled “sandboxGuestFailure()”function sandboxGuestFailure(cause, bindings?): GuestThrew;Decode the engine’s guest-owned diagnostic once; renderers receive typed fields.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
cause |
unknown |
bindings |
Readonly<Record<string, Readonly<Record<string, SandboxBinding>>>> |
Returns
Section titled “Returns”sandboxTransportMessage()function
Section titled “sandboxTransportMessage()”function sandboxTransportMessage(failure, ref): string;Error.message is the SDK’s wire carrier; only this safe, bounded envelope crosses it.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
failure |
SandboxFailure |
ref |
string |
Returns
Section titled “Returns”string
recoverSandboxFailure()function
Section titled “recoverSandboxFailure()”function recoverSandboxFailure(failure, failures): SandboxFailure;Recovery uses the decoded identity, never a match against diagnostic text.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
failure |
SandboxFailure |
failures |
ReadonlyMap<string, SandboxFailure> |
Returns
Section titled “Returns”sandboxExecutorFailure()function
Section titled “sandboxExecutorFailure()”function sandboxExecutorFailure(cause, limitMs, elapsedMs): SandboxFailure;Decode Codemode’s documented error carrier before adapters choose a failure.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
cause |
unknown |
limitMs |
number |
elapsedMs |
number |
Returns
Section titled “Returns”sandboxTransportErrno()function
Section titled “sandboxTransportErrno()”function sandboxTransportErrno(cause): string | undefined;Decode a transport-owned errno without reflecting on a foreign throw in adapters.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
cause |
unknown |
Returns
Section titled “Returns”string | undefined
sandboxSourceError()function
Section titled “sandboxSourceError()”function sandboxSourceError(cause): | Readonly<{ pos: number; }> | undefined;Admit Acorn’s documented offset from a syntax exception at this boundary.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
cause |
unknown |
Returns
Section titled “Returns”| Readonly<{ pos: number; }> | undefined
sandboxCapabilityFailure()function
Section titled “sandboxCapabilityFailure()”function sandboxCapabilityFailure( cause, namespace, operation, admitted?,): SandboxFailure;Capability owners supply an admission schema; decoding and foreign fallback stay here.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
cause |
unknown |
namespace |
string |
operation |
string |
admitted |
ZodType<Readonly<{ kind: "Files" | "Forage" | "InvalidInput" | "Unavailable" | "OperationFailed"; message: string; }>> |
Returns
Section titled “Returns”sandboxBindingBoundary()function
Section titled “sandboxBindingBoundary()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
bindings |
SandboxOperationBindings |
Returns
Section titled “Returns”Readonly<{ bindings:
SandboxRequest["bindings"]; capture:
(failure) => string; recover: (failure) =>
SandboxFailure; returnedFailure:
(value) => SandboxFailure |
undefined; }>