Skip to content
API reference

effect

Import
import * as api from "@fungi.computer/mycelium/effect";
Kind Export Description
type alias Sandbox Effect-native host seam for sandbox execution.
type alias MyceliumOptions Inputs used to construct the canonical Effect runtime.
type alias Lease One immutable Effect-facing capability revision.
type alias Runtime Warm Effect lifecycle for acquiring scope-owned run leases.
function fromTypedSandbox() 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.
function make() Construct the canonical scoped Effect runtime.
Signature
type Sandbox = Readonly<{
execute: (request, signal) => Effect.Effect<SandboxValue, SandboxFailure>;
adapter?: string;
buildSha?: string;
}>;

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 fromTypedSandbox; Effect.tryPromise alone completes interruption without awaiting the Promise and so breaks that settlement law.


MyceliumOptionstype alias

Section titled “MyceliumOptions”
Signature
type MyceliumOptions = Readonly<{
modules?: readonly ModuleRegistration[];
sources?: readonly CapabilitySource[];
session?: CapabilitySession;
execution?: ExecutionOptions;
sandbox: Sandbox;
onSandboxFailure?: (event) => Effect.Effect<void>;
tools?: readonly LabelledTool[];
access?: AccessOptions;
}>;

Inputs used to construct the canonical Effect runtime.


Signature
type Lease = Readonly<{
revision: string;
catalog: ForageCatalog;
executeTool: MuleTool;
tools: readonly MuleTool[];
release: () => Effect.Effect<void, MyceliumError>;
}>;

One immutable Effect-facing capability revision.


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

Warm Effect lifecycle for acquiring scope-owned run leases.

fromTypedSandbox()function

Section titled “fromTypedSandbox()”
Signature
function fromTypedSandbox(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.

Parameter Type
sandbox Sandbox

Sandbox


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

Construct the canonical scoped Effect runtime.

Parameter Type
options MyceliumOptions

Effect<Readonly<{ acquire: () => Effect<Readonly<{ revision: string; catalog: ForageCatalog; executeTool: MuleTool; tools: readonly 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


Re-exports Access


Re-exports AccessContext


Re-exports AccessLabel


Re-exports AccessOptions


Re-exports AccessRefusal


Re-exports AccessRefusalReason


Re-exports ConfirmRequest


Re-exports Grant


Re-exports Grants


Re-exports LabelledTool


Re-exports ToolPolicy