Skip to content
API reference

sandbox

Import
import * as api from "@fungi.computer/mycelium/sandbox";
Kind Export Description
type alias MyceliumJsonValue JSON value allowed to cross the sandbox and capability boundary.
type alias SandboxValue Untrusted value supplied by or returned from a host sandbox boundary.
type alias SandboxBinding One invocation binding visible to the host-provided sandbox.
type alias SandboxRequest Request crossing the root Promise-shaped sandbox seam.
type alias Sandbox Promise-shaped sandbox interface implemented by a host or stranger.

MyceliumJsonValuetype alias

Section titled “MyceliumJsonValue”
Signature
type MyceliumJsonValue = output<ZodJSONSchema>;

JSON value allowed to cross the sandbox and capability boundary.


SandboxValuetype alias

Section titled “SandboxValue”
Signature
type SandboxValue = input<ZodUnknown>;

Untrusted value supplied by or returned from a host sandbox boundary.


SandboxBindingtype alias

Section titled “SandboxBinding”
Signature
type SandboxBinding = (input) => Promise<MyceliumJsonValue>;

One invocation binding visible to the host-provided sandbox.

Parameter Type
input SandboxValue

Promise<MyceliumJsonValue>


SandboxRequesttype alias

Section titled “SandboxRequest”
Signature
type SandboxRequest = Readonly<{
executionId: string;
code: string;
timeoutMs: number;
bindings: Readonly<Record<string, Readonly<Record<string, SandboxBinding>>>>;
namespacePaths?: Readonly<Record<string, readonly string[]>>;
modules?: Readonly<Record<string, string>>;
sessionId?: string | null;
}>;

Request crossing the root Promise-shaped sandbox seam.


Signature
type Sandbox = Readonly<{
adapter?: string;
buildSha?: string;
execute: (request, signal) => Promise<SandboxValue>;
}>;

Promise-shaped sandbox interface implemented by a host or stranger.