effect
Import
Section titled “Import”import * as api from "@fungi.computer/shiitake/effect";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| type alias | ShiitakeEffectHost | Effect-native host composition with addressed mail kept off Session. |
| type alias | ModelAcquisitionEffect | Effect-native acquired Pi model and finalizer. |
| type alias | ModelSourceEffect | Effect-native model acquisition owner. |
| type alias | InstructionSourceEffect | Effect-native instruction snapshot owner. |
| type alias | ToolSourceEffect | Effect-native Mycelium construction inputs. |
| type alias | RuntimeHostEffect | Effect-native owner for scheduling the opaque durable reconciler. |
| type alias | ShiitakeEffectOptions | Validated construction bag for owned Effect composition. |
| type alias | ShiitakeEffectWatch | Effect-native race-safe watch result. |
| type alias | ShiitakeEffectCommandHandler | Effect-native addressable Session handle. |
| type alias | ShiitakeEffectSendOptions | Delivery intent and an optional private retry key for Effect-native sending. |
| type alias | ShiitakeEffectSession | Effect-native addressable Session handle. |
| type alias | ShiitakeEffectSessionExtension | Effect-native Session-scope extension commands. |
| type alias | ShiitakeEffectAgentExtensions | Effect-native Agent-scope extension controls. |
| type alias | ShiitakeEffectAgent | Effect-native durable harness. |
| type alias | ShiitakeEffectOwner | The in-process owner of a durable harness. Only the host holds it, so only the host can write a Session’s grants or attach metadata; no HTTP or remote client can. |
| type alias | StoredSessionSummary | Persisted conversation facts; run status belongs to the Session’s owner. |
| type alias | StoredSessionSummaryRow | One persisted conversation’s stored facts, or a row that could not be read. |
| type alias | StoredSessionSummaryPage | One page of stored conversation facts, in stable Session identity order. |
| function | make() | Construct the canonical Effect-native Shiitake scaffold. |
| function | openHost() | Open the Effect-native host composition with addressed mail. |
| function | readSessionSummaries() | Enumerate saved conversations’ stored facts in bounded pages, for readers that
hold only the store. Run status is not stored; use the Agent’s listSessions
for it. An unreadable Session is its own unavailable row. |
ShiitakeEffectHosttype alias
Section titled “ShiitakeEffectHost”type ShiitakeEffectHost = Readonly<{ readSettlement: ( sessionId, commandId, ) => Effect.Effect<CommandSettlement | undefined, ShiitakeError>; agent: ShiitakeEffectOwner; acceptMail: ( mail, meta?, reply?, stageAcceptedNotice?, ) => Effect.Effect<Accepted, ShiitakeError>;}>;Effect-native host composition with addressed mail kept off Session.
ModelAcquisitionEffecttype alias
Section titled “ModelAcquisitionEffect”type ModelAcquisitionEffect = Readonly<{ model: Model<Api>; stream?: MuleStreamFunction; retryAfterMs?: (message) => number | undefined; retryable: (message) => boolean; failureReason?: (message) => string | undefined; rejection?: (message) => ProviderRejection | undefined; providerError?: (message) => string | undefined; release: Effect.Effect<void, ShiitakeError>;}>;Effect-native acquired Pi model and finalizer.
ModelSourceEffecttype alias
Section titled “ModelSourceEffect”type ModelSourceEffect = Readonly<{ acquire: (input) => Effect.Effect<ModelAcquisitionEffect, ShiitakeError>; describe?: (input) => Effect.Effect<ModelDescription, ShiitakeError>;}>;Effect-native model acquisition owner.
InstructionSourceEffecttype alias
Section titled “InstructionSourceEffect”type InstructionSourceEffect = Readonly<{ load: ( input, ) => Effect.Effect<InstructionSnapshot, ShiitakeError, Scope.Scope>;}>;Effect-native instruction snapshot owner.
ToolSourceEffecttype alias
Section titled “ToolSourceEffect”type ToolSourceEffect = Readonly<{ execution?: ExecutionOptions; modules: readonly ModuleRegistration[]; sources: readonly CapabilitySource[]; sandbox: Sandbox; access?: ToolAccess;}>;Effect-native Mycelium construction inputs.
RuntimeHostEffecttype alias
Section titled “RuntimeHostEffect”type RuntimeHostEffect = Readonly<{ bind: (input) => Effect.Effect< Readonly<{ commit: <A>(mutation) => Effect.Effect<A, ShiitakeError>; requestWake: Effect.Effect<void, ShiitakeError>; close: Effect.Effect<void, ShiitakeError>; }>, ShiitakeError >;}>;Effect-native owner for scheduling the opaque durable reconciler.
ShiitakeEffectOptionstype alias
Section titled “ShiitakeEffectOptions”type ShiitakeEffectOptions = Readonly<{ meta?: HostMetaOptions; store: SqliteOwner; storagePressure?: StoragePressureCheck; compaction?: CompactionOptions; hostJobs?: Readonly<{ lane: string; open: (runtime) => Readonly<{ execute: (job) => Effect.Effect<WatchdogExecutionDecision, WatchdogError>; }>; }>; model: ModelSourceEffect; instructions: InstructionSourceEffect; tools?: ToolSourceEffect; runtime: RuntimeHostEffect; extensions: ExtensionRosterV0; retry?: RetryPolicy; modelStreamIdleTimeoutMs?: number;}>;Validated construction bag for owned Effect composition.
ShiitakeEffectWatchtype alias
Section titled “ShiitakeEffectWatch”type ShiitakeEffectWatch = Readonly<{ snapshot: SessionSnapshot; changes: Stream.Stream<SessionFrame, ShiitakeError>; close: Effect.Effect<void, ShiitakeError>;}>;Effect-native race-safe watch result.
ShiitakeEffectCommandHandlertype alias
Section titled “ShiitakeEffectCommandHandler”type ShiitakeEffectCommandHandler = { (input): Effect< Readonly<{ status: "accepted"; commandId: string; sessionId?: string; }>, ShiitakeError >; (input): Effect<CancelResult, ShiitakeError>; (input): Effect<undefined, ShiitakeError>; (input): Effect< Readonly<{ sessionId: string; }>, ShiitakeError >; (input): Effect< | CancelResult | Readonly<{ sessionId: string; }> | undefined, ShiitakeError >;};Effect-native addressable Session handle.
Call Signature
Section titled “Call Signature”(input): Effect<Readonly<{ status: "accepted"; commandId: string; sessionId?: string;}>, ShiitakeError>;Accept one durable prompt command.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
| { delivery: "followUp" | "steer"; requestId: string; type: "prompt"; text: string; images?: readonly object[]; } | { type: "compact"; requestId: string; instructions?: string; } |
Returns
Section titled “Returns”Effect<Readonly<{ status: "accepted"; commandId: string;
sessionId?: string; }>, ShiitakeError>
Call Signature
Section titled “Call Signature”(input): Effect<CancelResult, ShiitakeError>;Cancel one accepted command, or report that it is too late.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
{ commandId: string; onlyIfPending?: boolean; type: "cancel"; } |
input.commandId |
string |
input.onlyIfPending? |
boolean |
input.type |
"cancel" |
Returns
Section titled “Returns”Effect<CancelResult,
ShiitakeError>
Call Signature
Section titled “Call Signature”(input): Effect<undefined, ShiitakeError>;Abort the active run, select a lineage leaf, or record an operator line.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
| { type: "abort"; } | { type: "branch"; entryId: string; } | { type: "operator"; requestId: string; author: "operator" | "party"; text: string; } | { type: "title"; title: string | null; } |
Returns
Section titled “Returns”Effect<undefined, ShiitakeError>
Call Signature
Section titled “Call Signature”(input): Effect<Readonly<{ sessionId: string;}>, ShiitakeError>;Fork one complete entry lineage into a new Session.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
{ type: "fork"; entryId: string; } |
input.type |
"fork" |
input.entryId |
string |
Returns
Section titled “Returns”Effect<Readonly<{ sessionId: string; }>,
ShiitakeError>
Call Signature
Section titled “Call Signature”(input): Effect< | CancelResult | Readonly<{ sessionId: string;}>| undefined, ShiitakeError>;Execute an already-decoded command union.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
| { delivery: "followUp" | "steer"; requestId: string; type: "prompt"; text: string; images?: readonly object[]; } | { type: "abort"; } | { commandId: string; onlyIfPending?: boolean; type: "cancel"; } | { type: "branch"; entryId: string; } | { type: "fork"; entryId: string; } | { type: "operator"; requestId: string; author: "operator" | "party"; text: string; } | { type: "compact"; requestId: string; instructions?: string; } | { type: "title"; title: string | null; } |
Returns
Section titled “Returns”Effect< | CancelResult | Readonly<{
sessionId: string; }> | undefined,
ShiitakeError>
ShiitakeEffectSendOptionstype alias
Section titled “ShiitakeEffectSendOptions”type ShiitakeEffectSendOptions = Readonly<{ images?: PromptCommand["images"]; delivery?: PromptDelivery; requestId?: string;}>;Delivery intent and an optional private retry key for Effect-native sending.
ShiitakeEffectSessiontype alias
Section titled “ShiitakeEffectSession”type ShiitakeEffectSession = Readonly<{ command: ShiitakeEffectCommandHandler; withdraw: (requestId) => Effect.Effect<WithdrawResult, ShiitakeError>; abort: Effect.Effect<void, ShiitakeError>; send: (text, options?) => Effect.Effect<Accepted, ShiitakeError>; cancel: (input) => Effect.Effect<CancelResult, ShiitakeError>; latestPending: Effect.Effect<SessionPendingPrompt | null, ShiitakeError>; extension: (extensionId) => ShiitakeEffectSessionExtension; modelPreference: Readonly<{ read: Effect.Effect<ModelPreference | null, ShiitakeError>; set: (preference) => Effect.Effect<void, ShiitakeError>; }>; read: (input?) => Effect.Effect<SessionSnapshot, ShiitakeError>; readSettlement: ( commandId, timeoutMs?, ) => Effect.Effect<CommandSettlement | undefined, ShiitakeError>; subscribe: (input) => Stream.Stream<SessionFrame, ShiitakeError>; watch: (input?) => Effect.Effect<ShiitakeEffectWatch, ShiitakeError>;}>;Effect-native addressable Session handle.
ShiitakeEffectSessionExtensiontype alias
Section titled “ShiitakeEffectSessionExtension”type ShiitakeEffectSessionExtension = Readonly<{ call: (command, input) => Effect.Effect<Json, ShiitakeError>;}>;Effect-native Session-scope extension commands.
ShiitakeEffectAgentExtensionstype alias
Section titled “ShiitakeEffectAgentExtensions”type ShiitakeEffectAgentExtensions = Readonly<{ list: Effect.Effect<readonly ExtensionStatusV0[], ShiitakeError>; resume: (extensionId) => Effect.Effect<ExtensionStatusV0, ShiitakeError>; call: (extensionId, command, input) => Effect.Effect<Json, ShiitakeError>;}>;Effect-native Agent-scope extension controls.
ShiitakeEffectAgenttype alias
Section titled “ShiitakeEffectAgent”type ShiitakeEffectAgent = Readonly<{ createSession: (requestId) => Effect.Effect<string, ShiitakeError>; deleteSession: (sessionId) => Effect.Effect<boolean, ShiitakeError>; listSessions: (after?) => Effect.Effect<SessionSummaryPage, ShiitakeError>; extensions: ShiitakeEffectAgentExtensions; session: (sessionId) => ShiitakeEffectSession; close: Effect.Effect<void, ShiitakeError>;}>;Effect-native durable harness.
ShiitakeEffectOwnertype alias
Section titled “ShiitakeEffectOwner”type ShiitakeEffectOwner = ShiitakeEffectAgent & Readonly<{ prepareConfiguration: (configuration) => Effect.Effect< Readonly<{ commit: Effect.Effect<void, ShiitakeError>; discard: Effect.Effect<void>; }>, ShiitakeError >; grants: Readonly<{ deliver: ( sessionId, delivery, ) => Effect.Effect<GrantsDeliveryResult, ShiitakeError>; read: (sessionId) => Effect.Effect<GrantsDelivery | null, ShiitakeError>; }>; withMeta: (meta) => ShiitakeEffectAgent; }>;The in-process owner of a durable harness. Only the host holds it, so only the host can write a Session’s grants or attach metadata; no HTTP or remote client can.
StoredSessionSummarytype alias
Section titled “StoredSessionSummary”type StoredSessionSummary = Readonly<{ createdAt: number; updatedAt: number; title: string;}>;Persisted conversation facts; run status belongs to the Session’s owner.
StoredSessionSummaryRowtype alias
Section titled “StoredSessionSummaryRow”type StoredSessionSummaryRow = | (StoredSessionSummary & Readonly<{ kind: "session"; sessionId: string; }>) | Readonly<{ kind: "unavailable"; sessionId: string; }>;One persisted conversation’s stored facts, or a row that could not be read.
StoredSessionSummaryPagetype alias
Section titled “StoredSessionSummaryPage”type StoredSessionSummaryPage = Readonly<{ sessions: readonly StoredSessionSummaryRow[]; next: string | undefined;}>;One page of stored conversation facts, in stable Session identity order.
make()function
Section titled “make()”function make(options): Effect<ShiitakeEffectOwner, ShiitakeError>;Construct the canonical Effect-native Shiitake scaffold.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
ShiitakeEffectOptions |
Returns
Section titled “Returns”Effect<ShiitakeEffectOwner,
ShiitakeError>
openHost()function
Section titled “openHost()”function openHost(options, mailRoom): Effect<Readonly<{ readSettlement: (sessionId, commandId) => Effect< | Readonly<{ acceptedSender: string | null; terminal: SessionTerminal; content: string; usage: readonly Pick<AssistantMessage, ... | ... | ...>[]; toolCalls: number; }> | undefined, ShiitakeError>; agent: ShiitakeEffectOwner; acceptMail: (mail, meta?, reply?, stageAcceptedNotice?) => Effect<Readonly<{ status: "accepted"; commandId: string; sessionId?: string; }>, ShiitakeError>;}>, ShiitakeError>;Open the Effect-native host composition with addressed mail.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
ShiitakeEffectOptions |
mailRoom |
BirdDogEffect |
Returns
Section titled “Returns”Effect<Readonly<{ readSettlement: (sessionId, commandId) =>
Effect< | Readonly<{ acceptedSender: string | null; terminal:
SessionTerminal; content: string; usage:
readonly Pick<AssistantMessage, … | … | …>[]; toolCalls:
number; }> | undefined, ShiitakeError>;
agent: ShiitakeEffectOwner; acceptMail: (mail,
meta?, reply?, stageAcceptedNotice?) => Effect<Readonly<{ status:
"accepted"; commandId: string; sessionId?: string; }>,
ShiitakeError>; }>,
ShiitakeError>
readSessionSummaries()function
Section titled “readSessionSummaries()”function readSessionSummaries( owner, after?,): Effect< Readonly<{ sessions: readonly StoredSessionSummaryRow[]; next: string | undefined; }>, ShiitakeError, never>;Enumerate saved conversations’ stored facts in bounded pages, for readers that
hold only the store. Run status is not stored; use the Agent’s listSessions
for it. An unreadable Session is its own unavailable row.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
owner |
SqliteOwner |
after? |
string |
Returns
Section titled “Returns”Effect<Readonly<{ sessions: readonly
StoredSessionSummaryRow[]; next: string |
undefined; }>, ShiitakeError, never>
References
Section titled “References”AbortCommand
Section titled “AbortCommand”Re-exports AbortCommand
BranchCommand
Section titled “BranchCommand”Re-exports BranchCommand
CompactCommand
Section titled “CompactCommand”Re-exports CompactCommand
CancelCommand
Section titled “CancelCommand”Re-exports CancelCommand
CancelResult
Section titled “CancelResult”Re-exports CancelResult
Accepted
Section titled “Accepted”Re-exports Accepted
ForkCommand
Section titled “ForkCommand”Re-exports ForkCommand
ForkedSession
Section titled “ForkedSession”Re-exports ForkedSession
PromptCommand
Section titled “PromptCommand”Re-exports PromptCommand
PromptDelivery
Section titled “PromptDelivery”Re-exports PromptDelivery
ReadOptions
Section titled “ReadOptions”Re-exports ReadOptions
SessionCommand
Section titled “SessionCommand”Re-exports SessionCommand
SessionCommandHandler
Section titled “SessionCommandHandler”Re-exports SessionCommandHandler
SessionFrame
Section titled “SessionFrame”Re-exports SessionFrame
SessionMessage
Section titled “SessionMessage”Re-exports SessionMessage
SessionProgress
Section titled “SessionProgress”Re-exports SessionProgress
SessionToolOutput
Section titled “SessionToolOutput”Re-exports SessionToolOutput
SessionSnapshot
Section titled “SessionSnapshot”Re-exports SessionSnapshot
SessionActivity
Section titled “SessionActivity”Re-exports SessionActivity
AgentRunningWork
Section titled “AgentRunningWork”Re-exports AgentRunningWork
SubscribeOptions
Section titled “SubscribeOptions”Re-exports SubscribeOptions
TooLate
Section titled “TooLate”Re-exports TooLate
WatchOptions
Section titled “WatchOptions”Re-exports WatchOptions
InstructionSnapshot
Section titled “InstructionSnapshot”Re-exports InstructionSnapshot
InstructionSource
Section titled “InstructionSource”Re-exports InstructionSource
ModelAcquisition
Section titled “ModelAcquisition”Re-exports ModelAcquisition
ModelDescription
Section titled “ModelDescription”Re-exports ModelDescription
ModelSource
Section titled “ModelSource”Re-exports ModelSource
RuntimeHost
Section titled “RuntimeHost”Re-exports RuntimeHost
RuntimePendingWork
Section titled “RuntimePendingWork”Re-exports RuntimePendingWork
SqliteCursor
Section titled “SqliteCursor”Re-exports SqliteCursor
SqliteOwner
Section titled “SqliteOwner”Re-exports SqliteOwner
SqliteValue
Section titled “SqliteValue”Re-exports SqliteValue
SqliteRow
Section titled “SqliteRow”Re-exports SqliteRow
GrantsDelivery
Section titled “GrantsDelivery”Re-exports GrantsDelivery
GrantsDeliveryResult
Section titled “GrantsDeliveryResult”Re-exports GrantsDeliveryResult
ShiitakeOptions
Section titled “ShiitakeOptions”Re-exports ShiitakeOptions
ToolAccess
Section titled “ToolAccess”Re-exports ToolAccess
HostMetaOptions
Section titled “HostMetaOptions”Re-exports HostMetaOptions
StandardHostMetaResult
Section titled “StandardHostMetaResult”Re-exports StandardHostMetaResult
StandardHostMetaSchema
Section titled “StandardHostMetaSchema”Re-exports StandardHostMetaSchema
ToolSource
Section titled “ToolSource”Re-exports ToolSource
SessionSummary
Section titled “SessionSummary”Re-exports SessionSummary
BorrowedCompactionViewV0
Section titled “BorrowedCompactionViewV0”Re-exports BorrowedCompactionViewV0
CompactionHandoffErrorV0
Section titled “CompactionHandoffErrorV0”Re-exports CompactionHandoffErrorV0
CompactionHandoffResultV0
Section titled “CompactionHandoffResultV0”Re-exports CompactionHandoffResultV0
CompactionHandoffV0
Section titled “CompactionHandoffV0”Re-exports CompactionHandoffV0
ExtensionCapabilityV0
Section titled “ExtensionCapabilityV0”Re-exports ExtensionCapabilityV0
ExtensionGrantV0
Section titled “ExtensionGrantV0”Re-exports ExtensionGrantV0
ExtensionRosterV0
Section titled “ExtensionRosterV0”Re-exports ExtensionRosterV0
ExtensionSlotV0
Section titled “ExtensionSlotV0”Re-exports ExtensionSlotV0
ExtensionStatusV0
Section titled “ExtensionStatusV0”Re-exports ExtensionStatusV0
RosteredExtensionV0
Section titled “RosteredExtensionV0”Re-exports RosteredExtensionV0
ShiitakeError
Section titled “ShiitakeError”Re-exports ShiitakeError
ModelPreference
Section titled “ModelPreference”Re-exports ModelPreference
SessionSummaryPage
Section titled “SessionSummaryPage”Re-exports SessionSummaryPage
SessionSummaryRow
Section titled “SessionSummaryRow”Re-exports SessionSummaryRow
sqliteRowSchema
Section titled “sqliteRowSchema”Re-exports sqliteRowSchema
CommandSettlement
Section titled “CommandSettlement”Re-exports CommandSettlement