Skip to content

index

@fungi.computer/mycelium


@fungi.computer/mycelium / index

A capability declaration could not form one coherent installed surface.

  • Error

new MyceliumDefinitionError(message): MyceliumDefinitionError

string

MyceliumDefinitionError

Error.constructor

readonly code: "invalid_definition" = invalidDefinitionCode

Stable machine-readable failure code.


An operation attempted to use a closed Mycelium runtime.

  • Error

new MyceliumClosedError(message?): MyceliumClosedError

string = "Mycelium runtime is closed"

MyceliumClosedError

Error.constructor

readonly code: "runtime_closed" = runtimeClosedCode

Stable machine-readable failure code.


A sandbox execution request was rejected by Mycelium admission before host dispatch or by the host sandbox during dispatch.

  • Error

new MyceliumSandboxError(message): MyceliumSandboxError

string

MyceliumSandboxError

Error.constructor

readonly code: "sandbox_rejected" = sandboxRejectedCode

Stable machine-readable failure code.


An execution exceeded its owned budget or did not acknowledge cancellation.

  • Error

new MyceliumExecutionError(phase): MyceliumExecutionError

MyceliumExecutionPhase

MyceliumExecutionError

Error.constructor

readonly code: "execution_failure" = executionFailureCode

Stable machine-readable failure code.

readonly phase: MyceliumExecutionPhase


A capability source failed at its bounded host boundary.

  • Error

new MyceliumSourceError(sourceId, phase): MyceliumSourceError

string | undefined

Stable identity of the source, absent for whole-candidate failures.

MyceliumSourcePhase

Lifecycle phase that could not settle.

MyceliumSourceError

Error.constructor

readonly code: "source_failure" = sourceFailureCode

Stable machine-readable failure code.

readonly sourceId: string | undefined

Stable identity of the source, absent for whole-candidate failures.

readonly phase: MyceliumSourcePhase

Lifecycle phase that could not settle.

CapabilitySession = Readonly<{ sessionId: string; }>

Session on whose behalf one runtime acquires its capability projections.


CapabilitySourceContext = Readonly<{ session?: CapabilitySession; signal: AbortSignal; invalidate: () => void; }>

Context supplied while acquiring one current capability projection.


CapabilitySourceSnapshot = Readonly<{ version: string; modules: readonly ModuleRegistration[]; }>

Bounded current projection returned by one capability source.


CapabilitySourceAcquisition = Readonly<{ snapshot: CapabilitySourceSnapshot; release: () => Promise<void>>; }>

Acquired source projection and the cleanup that owns its live adapter.


CapabilitySource = Readonly<{ id: string; acquire: (context) => Promise<CapabilitySourceAcquisition>>; }>

Promise-shaped host boundary for one versioned capability projection.


MyceliumSourcePhase = "acquire" | "release" | "stale"

Lifecycle phase in which a capability source failed.


MyceliumExecutionPhase = "cancelled" | "deadline_exceeded" | "abort_unacknowledged"

Bounded execution phase reported by Mycelium’s cancellation owner.


MyceliumError = MyceliumClosedError | MyceliumDefinitionError | MyceliumExecutionError | MyceliumSandboxError | MyceliumSourceError

Closed failure vocabulary for the first Mycelium runtime slice.


ExecutionOptions = Readonly<{ timeoutMs?: number; abortGraceMs?: number; }>

Host-selectable execution limits; neither budget can be disabled.


InvocationContext = Readonly<{ executionId: string; signal: AbortSignal; }>

The only context an operation callback may observe.


MyceliumJsonValue = output<ZodJSONSchema>>

JSON value allowed to cross the sandbox and capability boundary.


SandboxValue = input<ZodUnknown>>

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


SandboxBinding = (input) => Promise<MyceliumJsonValue>>

One invocation binding visible to the host-provided sandbox.

SandboxValue

Promise<MyceliumJsonValue>


SandboxRequest = Readonly<{ executionId: string; code: string; timeoutMs: number; bindings: Readonly<Record<string, Readonly<Record<string, SandboxBinding>>>>>>>>; }>

Request crossing the root Promise-shaped sandbox seam.


Sandbox = Readonly<{ execute: (request, signal) => Promise<SandboxValue>>; }>

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


MyceliumOptions = Readonly<{ modules?: readonly ModuleRegistration[]; sources?: readonly CapabilitySource[]; session?: CapabilitySession; execution?: ExecutionOptions; sandbox: Sandbox; }>

Inputs used to construct the Promise-facing runtime.


AcquireOptions = Readonly<{ signal?: AbortSignal; }>

Cancellation options for one Promise-facing lease acquisition.


Lease = Readonly<{ revision: string; catalog: ForageCatalog; executeTool: MuleTool; release: () => Promise<void>>; }>

One immutable Promise-facing capability revision.


Runtime = Readonly<{ acquire: (options?) => Promise<Lease>>; close: () => Promise<void>>; }>

Warm Promise-facing lifecycle for acquiring immutable run leases.


OperationDefinition<I, O> > = Readonly<{ description?: string; input: ZodType<I>>; output?: ZodType<O>>; execute: (input, context) => Promise<O>>; }>

Zod-first declaration for one operation behind the execute door.

I extends MyceliumJsonValue

O extends MyceliumJsonValue


ModuleDefinition = Readonly<{ id: string; name?: string; description?: string; operations: Readonly<Record<string, OperationRegistration>>>>; }>

Declaration for one stable module and its related operations.


MyceliumApi = Readonly<{ module: (definition) => ModuleRegistration; operation: <I, O>>(definition) => OperationRegistration<I, O>>; make: (options) => Promise<Runtime>>; }>

Public convenience namespace contract.


OperationRegistration<I, O> > = Readonly<{ [operationBrand]: true; [operationTypes]?: Readonly<{ input: I; output: O; }>; }>

Opaque handle for one Zod-authored operation.

I = unknown

O = unknown


ModuleRegistration = Readonly<{ [moduleBrand]: true; }>

Opaque handle for one namespaced capability module.

const Mycelium: MyceliumApi

Zod-first authoring and Promise-facing runtime construction.