Skip to content

@fungi.computer/shiitake

Sanitized failure from a parsed Shiitake boundary.

  • Error

new ShiitakeError(boundary, category, message, requestId?, cause?): ShiitakeError

Construct a sanitized boundary failure.

"contract" | "extensions" | "instructions" | "model" | "runtime" | "store" | "tools"

Boundary that rejected the operation.

"closed" | "conflict" | "incompatible" | "invalid" | "rejected" | "unavailable"

Safe category describing why it was rejected.

string

Human-readable message safe for callers to display.

string

Request identity recoverable when a send may have reached the owner.

unknown

The original thrown value, kept for server-side diagnosis only. It is never serialized: the wire encoder copies named fields only.

ShiitakeError

Error.constructor

readonly _tag: "ShiitakeError"

Stable runtime tag for typed Shiitake failures.

readonly cause: "closed" | "conflict" | "incompatible" | "invalid" | "rejected" | "unavailable"

Safe category describing why it was rejected.

Error.cause

readonly optional underlying?: unknown

Original cause retained only for server-side diagnosis.

readonly boundary: "contract" | "extensions" | "instructions" | "model" | "runtime" | "store" | "tools"

Boundary that rejected the operation.

readonly optional requestId?: string

Request identity recoverable when a send may have reached the owner.

ShiitakeErrorBoundary = Schema.Schema.Type<typeof ShiitakeErrorBoundarySchema>>

Stable boundary that rejected a Shiitake operation.


ShiitakeErrorCause = Schema.Schema.Type<typeof ShiitakeErrorCauseSchema>>

Safe failure category exposed by both Shiitake facades.


ExtensionCapabilityV0 = "state" | "settled" | "send" | "timers" | "commands" | "projection" | "run_tools" | "prompt" | "compaction_handoff"

Closed, versioned, feature-free capability vocabulary.


ShiitakeApi = Readonly<{ make: (options) => Promise<ShiitakeAgent>>; }>

Public construction namespace for the Promise-facing durable harness.


ShiitakeHost = Readonly<{ agent: ShiitakeAgent; acceptMail: (mail) => Promise<Accepted>>; }>

Promise-facing host composition with addressed mail kept off Session.


PromptDelivery = "steer" | "followUp"

Delivery policy for input accepted while a Session run is active.


SessionCommand = Schema.Schema.Type<typeof SessionCommandSchema>>

Public Session command inferred from its one runtime parser.


PromptCommand = Schema.Schema.Type<typeof PromptCommandSchema>>

Public prompt command accepted as durable Session work.


AbortCommand = Schema.Schema.Type<typeof AbortCommandSchema>>

Public fast-path command that aborts the active Session run.


CancelCommand = Schema.Schema.Type<typeof CancelCommandSchema>>

Public command that cancels exactly one accepted request.


BranchCommand = Extract<SessionCommand, Readonly<{ type: "branch"; }>>

Public command that selects one complete entry as the active lineage leaf.


ForkCommand = Extract<SessionCommand, Readonly<{ type: "fork"; }>>

Public command that creates a new Session from one complete entry lineage.


SqliteValue = WatchdogSqliteValue

Native SQLite scalar and row grammar shared with the work queue owner.


SqliteRow = WatchdogSqliteRow

Raw row grammar shared by Woodstock and Watchdog.


SqliteCursor = WatchdogSqliteCursor & Readonly<{ one: () => SqliteRow; }>

Native rows stay raw until the query’s maintained schema decodes them.


SqliteOwner = Omit<WatchdogSqliteOwner, "sql"> > & Readonly<{ sql: Readonly<{ exec: (statement, …bindings) => SqliteCursor; }>; }>

Synchronous SQL and transactions held by the surrounding runtime.


ModelAcquisition = Readonly<{ model: Model<Api>>; stream?: MuleStreamFunction; retryAfterMs?: (message) => number | undefined; release: () => Promise<void>>; }>

Acquired Pi model and optional explicit Pi stream function.


ModelSource = Readonly<{ acquire: (input) => Promise<ModelAcquisition>>; }>

Deterministic host seam for model selection and ready egress.


InstructionSnapshot = Readonly<{ revision: string; text: string; modules?: readonly ModuleRegistration[]; release?: () => void; }>

Immutable instruction snapshot captured for one run.


InstructionSource = Readonly<{ load: (input) => Promise<InstructionSnapshot>>; }>

Host seam for one bounded instruction snapshot.


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

Mycelium construction inputs captured by the Shiitake-owned run scope.


RuntimePendingWork = Readonly<{ pending: boolean; nextWakeAt: number | null; }>

Promise host for scheduling the opaque durable reconciler.


RuntimeHost = Readonly<{ bind: (input) => Promise<Readonly<{ commit: <A>>(mutation) => Promise<A>>; requestWake: () => Promise<void>>; close: () => Promise<void>>; }>>; }>

Promise host for scheduling the opaque durable reconciler.


ShiitakeOptions = Readonly<{ store: SqliteOwner; runtime: RuntimeHost; model: ModelSource; instructions: InstructionSource; tools?: ToolSource; files?: FilesSurface; gateTool?: (input) => OperationGate; extensions: ExtensionRosterV0; }>

Validated immutable construction bag for the durable harness.


ModelPreference = Schema.Schema.Type<typeof ModelPreferenceSchema>>

Null at the Session boundary means inherit the Agent default.


DocumentForkPolicyV0 = "inherit-at-fork-point" | "current" | "fresh"

Which source value a new Session starts with.


DocumentSpecV0<A, I> > = Readonly<{ schema: Schema.Codec<A, I>>; initial: A; fork: DocumentForkPolicyV0; maxBytes: number; }>

A typed JSON document, bounded by its encoded UTF-8 size.

A

I = A


DocumentsV0 = Readonly<Record<string, Readonly<{ schema: Schema.Codec<unknown>>; initial: unknown; fork: DocumentForkPolicyV0; maxBytes: number; }>>>

Existential declarations; each initial value is decoded by its own schema.


DocumentHandleV0<A> > = Readonly<{ read: (sessionId) => A; update: (sessionId, change) => void; }>

Both operations require the declaring extension’s active core transaction.

A


DocumentHandlesV0<D> > = { readonly [K in keyof D]: DocumentHandleV0<D[K]["schema"]["Type"]> }

Handles preserve the decoded type of each declared document.

D extends DocumentsV0

const Shiitake: ShiitakeApi

Construct the Promise facade over the canonical Effect program.


const sqliteRowSchema: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.instanceOf<ArrayBuffer, unknown>>, Schema.String, Schema.Number, Schema.Null]>>

A native row is a scalar record; each query owner decodes its own projection.

parseForkedSession(value): ForkedSession

Parse one serialized fork result using Shiitake’s public client grammar.

string

ForkedSession


parseSessionSnapshot(value): SessionSnapshot

Parse one serialized snapshot using Shiitake’s public client grammar.

string

SessionSnapshot


parseSessionFrame(value): SessionFrame

Parse one serialized frame using Shiitake’s public client grammar.

string

SessionFrame


makeHost(options, mailRoom): Promise<Readonly<{ agent: ShiitakeAgent; acceptMail: (mail) => Promise<Readonly<{ status: "accepted"; commandId: string; }>>; }>>

Construct the host-only Promise facade over the canonical Effect program.

ShiitakeOptions

BirdDogEffect

Promise<Readonly<{ agent: ShiitakeAgent; acceptMail: (mail) => Promise<Readonly<{ status: "accepted"; commandId: string; }>>; }>>

Re-exports AgentExtensionControls


Re-exports CancelResult


Re-exports Accepted


Re-exports ForkedSession


Re-exports SendOptions


Re-exports ReadOptions


Re-exports SessionCommandHandler


Re-exports SessionExtensionControls


Re-exports SessionExtensionSlots


Re-exports SessionFrame


Re-exports SessionMessage


Re-exports SessionProgress


Re-exports SessionSnapshot


Re-exports SessionInboxState


Re-exports SessionSummary


Re-exports SessionSummaryPage


Re-exports SessionSummaryRow


Re-exports SessionActivity


Re-exports SessionTerminal


Re-exports ShiitakeEventSourceConstructor


Re-exports SessionWatch


Re-exports ShiitakeAgent


Re-exports ShiitakeSession


Re-exports SubscribeOptions


Re-exports TooLate


Re-exports WatchOptions


Re-exports BorrowedCompactionViewV0


Re-exports CompactionHandoffErrorV0


Re-exports CompactionHandoffResultV0


Re-exports CompactionHandoffV0


Re-exports ExtensionGrantV0


Re-exports ExtensionRosterV0


Re-exports ExtensionSlotV0


Re-exports ExtensionStatusV0


Re-exports RosteredExtensionV0