Skip to content
API reference

sandbox-guest

Import
import * as api from "@fungi.computer/mycelium/sandbox-guest";
Kind Export Description
constant sandboxGuestResultSchema Closed guest envelope: guest exceptions cannot masquerade as host failures.
constant sandboxNamespaceSegmentSchema Parsed guest namespace segments; callbacks never cross this wire.
constant sandboxTransportAliasSchema A transport alias is interpolated as a strict JavaScript binding identifier.
constant sandboxNamespacePathsSchema Transport aliases mapped to their logical namespace paths.
constant sandboxBindingNamesSchema Serializable flat transport table; operation keys may have any namespace depth.
function submittedSourceLocation() Locate syntax in the submitted code, accounting for Codemode’s normalization.
function sandboxBindingNames() Serializable operation names; callbacks stay in the host’s existing binding table.
function sandboxProviderOperationName() Injective provider identifier: Codemode sanitizes dotted function names.
function sandboxGuestProgram() Capture name and text inside the guest, before Codemode erases Error.name.

sandboxGuestResultSchemaconstant

Section titled “sandboxGuestResultSchema”
Signature
const sandboxGuestResultSchema: ZodLazy<
ZodDiscriminatedUnion<
[
ZodObject<
{
ok: ZodLiteral<true>;
value: ZodUnknown;
},
$strict
>,
ZodObject<
{
ok: ZodLiteral<false>;
error: ZodObject<
{
kind: ZodLiteral<"guest_threw">;
name: ZodString;
message: ZodString;
transportMessage: ZodOptional<ZodString>;
},
$strict
>;
},
$strict
>,
],
"ok"
>
>;

Closed guest envelope: guest exceptions cannot masquerade as host failures.


sandboxNamespaceSegmentSchemaconstant

Section titled “sandboxNamespaceSegmentSchema”
Signature
const sandboxNamespaceSegmentSchema: ZodLazy<ZodString>;

Parsed guest namespace segments; callbacks never cross this wire.


sandboxTransportAliasSchemaconstant

Section titled “sandboxTransportAliasSchema”
Signature
const sandboxTransportAliasSchema: ZodLazy<ZodString>;

A transport alias is interpolated as a strict JavaScript binding identifier.


sandboxNamespacePathsSchemaconstant

Section titled “sandboxNamespacePathsSchema”
Signature
const sandboxNamespacePathsSchema: ZodLazy<
ZodRecord<ZodLazy<ZodString>, ZodArray<ZodLazy<ZodString>>>
>;

Transport aliases mapped to their logical namespace paths.


sandboxBindingNamesSchemaconstant

Section titled “sandboxBindingNamesSchema”
Signature
const sandboxBindingNamesSchema: ZodLazy<
ZodRecord<ZodLazy<ZodString>, ZodArray<ZodString>>
>;

Serializable flat transport table; operation keys may have any namespace depth.

submittedSourceLocation()function

Section titled “submittedSourceLocation()”
Signature
function submittedSourceLocation(
normalized,
submitted,
): Readonly<{
line: number;
column: number;
excerpt: string;
}> | null;

Locate syntax in the submitted code, accounting for Codemode’s normalization.

Parameter Type
normalized string
submitted string

| Readonly<{ line: number; column: number; excerpt: string; }> | null


sandboxBindingNames()function

Section titled “sandboxBindingNames()”
Signature
function sandboxBindingNames<A>(
bindings,
): Readonly<Record<string, readonly string[]>>;

Serializable operation names; callbacks stay in the host’s existing binding table.

Type Parameter
A
Parameter Type
bindings Readonly<Record<string, Readonly<Record<string, A>>>>

Readonly<Record<string, readonly string[]>>


sandboxProviderOperationName()function

Section titled “sandboxProviderOperationName()”
Signature
function sandboxProviderOperationName(operation): string;

Injective provider identifier: Codemode sanitizes dotted function names.

Parameter Type
operation string

string


sandboxGuestProgram()function

Section titled “sandboxGuestProgram()”
Signature
function sandboxGuestProgram(
normalized,
bindings?,
namespacePaths?,
transportName?,
): string;

Capture name and text inside the guest, before Codemode erases Error.name.

Parameter Type
normalized string
bindings Readonly<Record<string, readonly string[]>>
namespacePaths Readonly<Record<string, readonly string[]>>
transportName? (operation) => string

string