@fungi.computer/mycelium
Classes
Section titled “Classes”MyceliumDefinitionError
Section titled “MyceliumDefinitionError”A capability declaration could not form one coherent installed surface.
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MyceliumDefinitionError(
message):MyceliumDefinitionError
Parameters
Section titled “Parameters”message
Section titled “message”string
Returns
Section titled “Returns”Overrides
Section titled “Overrides”Error.constructor
Properties
Section titled “Properties”
readonlycode:"invalid_definition"=invalidDefinitionCode
Stable machine-readable failure code.
MyceliumClosedError
Section titled “MyceliumClosedError”An operation attempted to use a closed Mycelium runtime.
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MyceliumClosedError(
message?):MyceliumClosedError
Parameters
Section titled “Parameters”message?
Section titled “message?”string = "Mycelium runtime is closed"
Returns
Section titled “Returns”Overrides
Section titled “Overrides”Error.constructor
Properties
Section titled “Properties”
readonlycode:"runtime_closed"=runtimeClosedCode
Stable machine-readable failure code.
MyceliumSourceError
Section titled “MyceliumSourceError”A capability source failed at its bounded host boundary.
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MyceliumSourceError(
sourceId,phase):MyceliumSourceError
Parameters
Section titled “Parameters”sourceId
Section titled “sourceId”string | undefined
Stable identity of the source, absent for whole-candidate failures.
Lifecycle phase that could not settle.
Returns
Section titled “Returns”Overrides
Section titled “Overrides”Error.constructor
Properties
Section titled “Properties”
readonlycode:"source_failure"=sourceFailureCode
Stable machine-readable failure code.
sourceId
Section titled “sourceId”
readonlysourceId:string|undefined
Stable identity of the source, absent for whole-candidate failures.
readonlyphase:MyceliumSourcePhase
Lifecycle phase that could not settle.
Type Aliases
Section titled “Type Aliases”CapabilitySession
Section titled “CapabilitySession”CapabilitySession =
Readonly<{sessionId:string; }>
Session on whose behalf one runtime acquires its capability projections.
CapabilitySourceContext
Section titled “CapabilitySourceContext”CapabilitySourceContext =
Readonly<{session?:CapabilitySession;signal:AbortSignal;invalidate: () =>void; }>
Context supplied while acquiring one current capability projection.
CapabilitySourceSnapshot
Section titled “CapabilitySourceSnapshot”CapabilitySourceSnapshot =
Readonly<{version:string;modules: readonlyModuleRegistration[]; }>
Bounded current projection returned by one capability source.
CapabilitySourceAcquisition
Section titled “CapabilitySourceAcquisition”CapabilitySourceAcquisition =
Readonly<{snapshot:CapabilitySourceSnapshot;release: () =>Promise<void>>; }>
Acquired source projection and the cleanup that owns its live adapter.
CapabilitySource
Section titled “CapabilitySource”CapabilitySource =
Readonly<{id:string;acquire: (context) =>Promise<CapabilitySourceAcquisition>>; }>
Promise-shaped host boundary for one versioned capability projection.
MyceliumSourcePhase
Section titled “MyceliumSourcePhase”MyceliumSourcePhase =
"acquire"|"release"|"stale"
Lifecycle phase in which a capability source failed.
MyceliumError
Section titled “MyceliumError”MyceliumError =
MyceliumClosedError|MyceliumDefinitionError|MyceliumSourceError|SandboxFailure
Closed failure vocabulary for the first Mycelium runtime slice.
ExecutionOptions
Section titled “ExecutionOptions”ExecutionOptions =
Readonly<{timeoutMs?:number;abortGraceMs?:number; }>
Host-selectable execution limits; neither budget can be disabled.
CollectedImage
Section titled “CollectedImage”CollectedImage =
Readonly<{data:string;mimeType:"image/jpeg"|"image/png"|"image/webp";path:string;bytes:number; }>
A single image collected during an execute run.
ExecutionImages
Section titled “ExecutionImages”ExecutionImages =
Readonly<{push: (image) =>string; }>
The collector as one execution’s operations see it: push only.
InvocationContext
Section titled “InvocationContext”InvocationContext =
Readonly<{executionId:string;signal:AbortSignal;images?:ExecutionImages; }>
The only context an operation callback may observe.
MyceliumJsonValue
Section titled “MyceliumJsonValue”MyceliumJsonValue =
output<ZodJSONSchema>>
JSON value allowed to cross the sandbox and capability boundary.
SandboxValue
Section titled “SandboxValue”SandboxValue =
input<ZodUnknown>>
Untrusted value supplied by or returned from a host sandbox boundary.
SandboxBinding
Section titled “SandboxBinding”SandboxBinding = (
input) =>Promise<MyceliumJsonValue>>
One invocation binding visible to the host-provided sandbox.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<MyceliumJsonValue>
SandboxRequest
Section titled “SandboxRequest”SandboxRequest =
Readonly<{executionId:string;code:string;timeoutMs:number;bindings:Readonly<Record<string,Readonly<Record<string,SandboxBinding>>>>>>>>;modules?:Readonly<Record<string,string>>>>;sessionId?:string|null; }>
Request crossing the root Promise-shaped sandbox seam.
Sandbox
Section titled “Sandbox”Sandbox =
Readonly<{adapter?:string;buildSha?:string;execute: (request,signal) =>Promise<SandboxValue>>; }>
Promise-shaped sandbox interface implemented by a host or stranger.
MyceliumOptions
Section titled “MyceliumOptions”MyceliumOptions =
Readonly<{modules?: readonlyModuleRegistration[];sources?: readonlyCapabilitySource[];session?:CapabilitySession;execution?:ExecutionOptions;sandbox:Sandbox;onSandboxFailure?: (event) =>Promise<void>>; }>
Inputs used to construct the Promise-facing runtime.
AcquireOptions
Section titled “AcquireOptions”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
Section titled “Runtime”Runtime =
Readonly<{acquire: (options?) =>Promise<Lease>>;close: () =>Promise<void>>; }>
Warm Promise-facing lifecycle for acquiring immutable run leases.
OperationDefinition
Section titled “OperationDefinition”OperationDefinition<
I,O> > =Readonly<{replay?:"safe"|"unsafe";description?:string;input:ZodType<I>>;output?:ZodType<O>>;execute: (input,context) =>Promise<O>>; }>
Zod-first declaration for one operation behind the execute door.
Type Parameters
Section titled “Type Parameters”I extends MyceliumJsonValue
O extends MyceliumJsonValue
ModuleDefinition
Section titled “ModuleDefinition”ModuleDefinition =
Readonly<{id:string;name?:string;description?:string;operations:Readonly<Record<string,OperationRegistration>>>>; }>
Declaration for one stable module and its related operations.
MyceliumApi
Section titled “MyceliumApi”MyceliumApi =
Readonly<{module: (definition) =>ModuleRegistration;operation: <I,O>>(definition) =>OperationRegistration<I,O>>;make: (options) =>Promise<Runtime>>;gate: (module,gate) =>ModuleRegistration; }>
Public convenience namespace contract.
OperationRegistration
Section titled “OperationRegistration”OperationRegistration<
I,O> > =Readonly<{[operationBrand]:true;[operationTypes]?:Readonly<{input:I;output:O; }>; }>
Opaque handle for one Zod-authored operation.
Type Parameters
Section titled “Type Parameters”I = unknown
O = unknown
ModuleRegistration
Section titled “ModuleRegistration”ModuleRegistration =
Readonly<{[moduleBrand]:true; }>
Opaque handle for one namespaced capability module.
GateDecision
Section titled “GateDecision”GateDecision =
Readonly<{kind:"allow"; }> |Readonly<{kind:"refuse";value:MyceliumJsonValue; }>
A gate’s verdict for one call: run the operation, or return value instead.
OperationGate
Section titled “OperationGate”OperationGate = (
call) =>GateDecision|Promise<GateDecision>>
Asked before every call of a gated module’s operations.
Parameters
Section titled “Parameters”Readonly<{ operation: string; context:
InvocationContext; }>
Returns
Section titled “Returns”GateDecision | Promise<GateDecision>
SandboxFailureEvent
Section titled “SandboxFailureEvent”SandboxFailureEvent = typeof
SandboxFailureEventSchema.Type
Full operator diagnostics, excluded from model conversation and default reads.
Variables
Section titled “Variables”MAX_EXECUTION_IMAGES
Section titled “MAX_EXECUTION_IMAGES”
constMAX_EXECUTION_IMAGES:8=8
Maximum number of out-of-band images retained for one execution.
Mycelium
Section titled “Mycelium”
constMycelium:MyceliumApi
Zod-first authoring and Promise-facing runtime construction.
SandboxFailureEventSchema
Section titled “SandboxFailureEventSchema”
constSandboxFailureEventSchema:Struct<{kind:Literal<"sandbox_failure">>;ref:String;executionId:String;adapter:String;buildSha:NullOr<String>>;tag:Literals<readonly ["SourceInvalid","GuestThrew","DeadlineExceeded","Cancelled","DispatchLost","SandboxCrashed","BadResponse","ResultTooLarge","ResultNotJson","CapabilityFailed","Unknown"]>;fields:$Record<String,Codec<JSONType,JSONType,never,never>>>>;healthAlert:Boolean; }>
Shared structural grammar for durable operator facts and client inspection.
References
Section titled “References”sandboxFailure
Section titled “sandboxFailure”Re-exports sandboxFailure
isSandboxFailure
Section titled “isSandboxFailure”Re-exports isSandboxFailure
sandboxOperatorValue
Section titled “sandboxOperatorValue”Re-exports sandboxOperatorValue
SourceInvalid
Section titled “SourceInvalid”Re-exports SourceInvalid
GuestThrew
Section titled “GuestThrew”Re-exports GuestThrew
DeadlineExceeded
Section titled “DeadlineExceeded”Re-exports DeadlineExceeded
Cancelled
Section titled “Cancelled”Re-exports Cancelled
DispatchLost
Section titled “DispatchLost”Re-exports DispatchLost
SandboxCrashed
Section titled “SandboxCrashed”Re-exports SandboxCrashed
BadResponse
Section titled “BadResponse”Re-exports BadResponse
ResultTooLarge
Section titled “ResultTooLarge”Re-exports ResultTooLarge
ResultNotJson
Section titled “ResultNotJson”Re-exports ResultNotJson
CapabilityFailed
Section titled “CapabilityFailed”Re-exports CapabilityFailed
Unknown
Section titled “Unknown”Re-exports Unknown
sandboxFailureMessage
Section titled “sandboxFailureMessage”Re-exports sandboxFailureMessage
SandboxFailure
Section titled “SandboxFailure”Re-exports SandboxFailure
CapabilityDiagnostic
Section titled “CapabilityDiagnostic”Re-exports CapabilityDiagnostic
CapabilityFailureFields
Section titled “CapabilityFailureFields”Re-exports CapabilityFailureFields