Skip to content

effect

@fungi.computer/mycelium


@fungi.computer/mycelium / effect

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

Effect-native host seam for sandbox execution.

Interrupting execute must not complete until the backing work has actually settled. Mycelium bounds that wait by the acknowledgement grace and reports abort_unacknowledged when it expires, keeping the work’s source revision alive until it exits. A host with Promise-shaped work adapts it with fromPromiseSandbox; Effect.tryPromise alone completes interruption without awaiting the Promise and so breaks that settlement law.


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

Inputs used to construct the canonical Effect runtime.


Lease = Readonly<{ revision: string; catalog: ForageCatalog; executeTool: MuleTool; release: () => Effect.Effect<void, MyceliumError>>; }>

One immutable Effect-facing capability revision.


Runtime = Readonly<{ acquire: () => Effect.Effect<Lease, MyceliumError, Scope.Scope>>; close: () => Effect.Effect<void, MyceliumError>>; }>

Warm Effect lifecycle for acquiring scope-owned run leases.

fromPromiseSandbox(sandbox): Sandbox

Adapt a Promise-shaped sandbox to the Effect seam. This is Mycelium’s one Promise sandbox conversion: interruption waits for the host Promise to settle, while cancellation reaches the host through the abort signal.

Sandbox

Sandbox


make(options): Effect<Readonly<{ acquire: () => Effect<Readonly<{ revision: string; catalog: ForageCatalog; executeTool: MuleTool; release: () => Effect<void, MyceliumError>>; }>, MyceliumError, Scope>>; close: () => Effect<void, MyceliumError>>; }>, MyceliumError, Scope>>

Construct the canonical scoped Effect runtime.

MyceliumOptions

Effect<Readonly<{ acquire: () => Effect<Readonly<{ revision: string; catalog: ForageCatalog; executeTool: MuleTool; release: () => Effect<void, MyceliumError>; }>, MyceliumError, Scope>; close: () => Effect<void, MyceliumError>; }>, MyceliumError, Scope>

Re-exports CapabilitySession


Re-exports CapabilitySource


Re-exports ModuleRegistration


Re-exports SandboxBinding


Re-exports SandboxRequest


Re-exports ExecutionOptions