client
Import
Section titled “Import”import * as api from "@fungi.computer/shiitake/client";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| type alias | ParticipantPolicy | The host decides which Agent work may be delivered to this participant. |
| type alias | VisitorView | What a visitor may see of their own conversation Session. |
| type alias | VisitorPendingPrompt | Public pending facts exclude the host’s private metadata and admission origin. |
| type alias | Accepted | Semantic acknowledgement returned after one durable acceptance commit. |
| type alias | Held | Durable relay custody, not acceptance of a command by the recipient. |
| type alias | DelegationReceipt | A delegation send can be accepted by the Agent or held by its relay. |
| type alias | TooLate | Cancelling found nothing left to cancel: the command is unknown to this Session,
has already started (for an onlyIfPending cancel) or has already settled. It
is an ordinary outcome, never an error. |
| type alias | UnknownRequest | No command has been admitted under this request key in the addressed Session. |
| type alias | CancelResult | Outcome of one cancel command or request-based recall. |
| type alias | WithdrawResult | Atomic admission resolution: accepted work is kept; an unknown key is fenced forever. |
| type alias | ForkedSession | Result returned after a fork commits a new cold-readable Session. |
| type alias | SessionCommandHandler | Execute one retained type-discriminated Session command. |
| type alias | SendOptions | Optional controls for the Promise-friendly text sender. |
| type alias | ModelMessage | Model-facing Pi content. Application tool display payloads belong to the
surrounding entry’s data, never to a message sent back to a provider. |
| type alias | SessionMessage | One completed model message and its separate application payload. |
| type alias | ShiitakeEventSourceConstructor | Minimal constructor seam for runtimes without a global EventSource. |
| type alias | SessionTerminal | Durable outcome for one accepted work item on the selected Session lineage. |
| type alias | AgentRunningWork | Work occupying the executor partition that this queued command requires, without message or provider data. |
| type alias | SessionActivity | Raw facts about what a Session is doing now. Shiitake publishes facts only; a
client decides what they mean (see Parakeet’s sessionViewState). |
| type alias | SessionExtensionSlots | Encoded extension slots keyed by extension identity; absent means unavailable. |
| type alias | SessionExtensionControls | Generic Session-scope extension commands. |
| type alias | AgentExtensionControls | Generic Agent-scope extension controls. |
| type alias | SessionToolOutput | Process-local running tool tail; never a durable Session fact. |
| type alias | SessionProgress | Process-local assistant progress; never a durable Session fact. |
| type alias | SessionPendingPrompt | Accepted prompt waiting to enter the conversation, not a scheduling command. |
| type alias | SessionPendingPrompts | Bounded current admission view, in acceptance order rather than execution order. |
| type alias | SessionCompactionMarker | Minimal full-history compaction boundary marker. sequence is the Woodstock
order of the row this marker precedes (ties sort the marker first); at is when
the compaction ran. The agent’s model context is unaffected by this marker; it
exists only for the client timeline. |
| type alias | SessionCompactionTrigger | What started a compaction: the user, the context threshold, or an overflow. |
| type alias | SessionCompactionNotice | A compaction that changed nothing: a manual request with nothing to summarize yet, a compaction that failed, or a finished background summary dropped unplaced: stale because the context had moved past its head, or insufficient because placing it would have left the context over the limit. Automatic failures are never silent; each one is a notice at its own place in the timeline. |
| type alias | SessionContext | The Session’s context use as compaction measures it, against the window of the model a run would select now; the window is null when that model reports none. |
| type alias | SessionSnapshot | Bounded Session baseline at one opaque owner cursor. |
| type alias | SessionFrame | One bounded replay or live frame. |
| type alias | SubscribeOptions | Strict-after replay request. |
| type alias | ReadOptions | Bounded baseline request. |
| type alias | WatchOptions | Race-safe observation request. |
| type alias | SessionWatch | Race-safe baseline plus live changes resource. |
| type alias | ShiitakeSession | Addressable Session interface. Addressing itself performs no I/O. |
| type alias | SessionInboxState | Owner-decided inbox state, from Watchdog’s queue head and latest outcome.
running covers queued, thinking, streaming, retrying and cancelling; errored
covers failed, interrupted and outcome_unknown; done covers completed,
cancelled and never run. Any open extension attention produces needs_you,
taking priority over live and settled work. |
| type alias | SessionSummary | Read-only saved conversation projection; opening does not update recency. |
| type alias | SessionSummaryRow | One listed conversation, or a saved Session its owner could not read. |
| type alias | SessionSummaryPage | One owner-bounded page: needs_you, then running, then settled rows, each
newest activity first. next is an opaque owner cursor. |
| type alias | ShiitakeAgent | Constructed durable harness. |
| type alias | ExtensionViewV0 | What one client sees of an extension in a Session observation. |
| type alias | ScopedCommandsV0 | Command names of one scope, typed by the shared contract. |
| type alias | BoundCallV0 | Typed call surface of one contract’s commands in one scope. |
| type alias | BoundSessionExtensionV0 | One Session bound to one extension contract. |
| type alias | BoundAgentExtensionV0 | One Agent bound to one extension contract. |
| type alias | ShiitakeClientOptions | Network location of one remotely hosted Shiitake agent. |
| type alias | SessionAttention | One open attention item in a Session observation. |
| constant | AcceptedSchema | Decode a durable command acceptance value at an RPC boundary. |
| constant | HeldSchema | Parse the relay’s custody acknowledgment without implying Agent acceptance. |
| constant | DelegationReceiptSchema | A delegated send is accepted by its owner or held in durable mail custody. |
| function | participantSnapshot() | Filter participant delivery only; the holder’s stored Session is unchanged. |
| function | visitorPendingPrompt() | Project one owner-selected prompt without exposing host identity or correlation metadata. |
| function | visitorSnapshot() | Visitor-scoped Session facts use the visitor’s public address, never the internal Session ID. |
| function | visitorView() | Project only this visitor’s host-attributed prompts, their replies, and explicit operator replies. |
| function | parseDelegationReceipt() | Decode one delegated send’s acceptance or durable-custody result. |
| function | parseWithdrawResult() | Decode the owner’s atomic request resolution. |
| function | parseAccepted() | Parse one serialized command acceptance using Shiitake’s public grammar. |
| function | parseCancelResult() | Parse one serialized cancel outcome: accepted, or too late. |
| function | parseLatestPendingPrompt() | Decode the host-authorized newest pending lookup, including an empty result. |
| function | parseShiitakeError() | Parse one serialized canonical Shiitake failure. |
| function | parseSessionSummaryPage() | Decode the existing bounded saved-conversation projection. |
| function | bindSessionExtension() | Bind one Session to one extension contract; the contract’s schemas decode. |
| function | bindAgentExtension() | Bind one Agent to one extension contract’s Agent-scope commands. |
| function | createShiitakeClient() | Connect to a remotely hosted Shiitake agent. |
ParticipantPolicytype alias
Section titled “ParticipantPolicy”type ParticipantPolicy = Readonly<{ turnIsCurrent: (sessionId, commandId) => boolean; deliverAgentReply: (sessionId, commandId, reply) => boolean;}>;The host decides which Agent work may be delivered to this participant.
VisitorViewtype alias
Section titled “VisitorView”type VisitorView = Readonly<{ status: "idle" | "working"; lines: readonly Readonly<{ id: string; from: "visitor" | "agent" | "operator"; text: string; }>[]; progress: string | null;}>;What a visitor may see of their own conversation Session.
VisitorPendingPrompttype alias
Section titled “VisitorPendingPrompt”type VisitorPendingPrompt = Pick< SessionPendingPrompt, "commandId" | "requestId" | "text" | "delivery" | "images">;Public pending facts exclude the host’s private metadata and admission origin.
Acceptedtype alias
Section titled “Accepted”type Accepted = Readonly<{ status: "accepted"; commandId: string; sessionId?: string;}>;Semantic acknowledgement returned after one durable acceptance commit.
Heldtype alias
Section titled “Held”type Held = Readonly<{ status: "held"; reason: "recipient_offline"; message: "waiting: recipient offline";}>;Durable relay custody, not acceptance of a command by the recipient.
DelegationReceipttype alias
Section titled “DelegationReceipt”type DelegationReceipt = Accepted | Held;A delegation send can be accepted by the Agent or held by its relay.
TooLatetype alias
Section titled “TooLate”type TooLate = Readonly<{ status: "too_late"; commandId: string;}>;Cancelling found nothing left to cancel: the command is unknown to this Session,
has already started (for an onlyIfPending cancel) or has already settled. It
is an ordinary outcome, never an error.
UnknownRequesttype alias
Section titled “UnknownRequest”type UnknownRequest = Readonly<{ status: "unknown";}>;No command has been admitted under this request key in the addressed Session.
CancelResulttype alias
Section titled “CancelResult”type CancelResult = Accepted | TooLate | UnknownRequest;Outcome of one cancel command or request-based recall.
WithdrawResulttype alias
Section titled “WithdrawResult”type WithdrawResult = Accepted | UnknownRequest;Atomic admission resolution: accepted work is kept; an unknown key is fenced forever.
ForkedSessiontype alias
Section titled “ForkedSession”type ForkedSession = Readonly<{ sessionId: string;}>;Result returned after a fork commits a new cold-readable Session.
SessionCommandHandlertype alias
Section titled “SessionCommandHandler”type SessionCommandHandler = { (input): Promise< Readonly<{ status: "accepted"; commandId: string; sessionId?: string; }> >; (input): Promise<CancelResult>; (input): Promise<undefined>; (input): Promise< Readonly<{ sessionId: string; }> >; (input): Promise< | CancelResult | Readonly<{ sessionId: string; }> | undefined >;};Execute one retained type-discriminated Session command.
Call Signature
Section titled “Call Signature”(input): Promise<Readonly<{ status: "accepted"; commandId: string; sessionId?: string;}>>;Accept a prompt or a compaction request as queued Session work.
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”Promise<Readonly<{ status: "accepted"; commandId: string;
sessionId?: string; }>>
Call Signature
Section titled “Call Signature”(input): Promise<CancelResult>;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”Promise<CancelResult>
Call Signature
Section titled “Call Signature”(input): Promise<undefined>;Abort the active run, select a lineage leaf, record an operator line, or set the title.
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”Promise<undefined>
Call Signature
Section titled “Call Signature”(input): Promise<Readonly<{ sessionId: string;}>>;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”Promise<Readonly<{ sessionId: string; }>>
Call Signature
Section titled “Call Signature”(input): Promise< | CancelResult | Readonly<{ sessionId: string;}>| undefined>;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”Promise< | CancelResult | Readonly<{ sessionId:
string; }> | undefined>
SendOptionstype alias
Section titled “SendOptions”type SendOptions = Readonly<{ images?: PromptCommand["images"]; delivery?: PromptDelivery; requestId?: string;}>;Optional controls for the Promise-friendly text sender.
ModelMessagetype alias
Section titled “ModelMessage”type ModelMessage = | Exclude< Message, { role: "toolResult"; } > | Omit< Extract< Message, { role: "toolResult"; } >, "details" >;Model-facing Pi content. Application tool display payloads belong to the
surrounding entry’s data, never to a message sent back to a provider.
SessionMessagetype alias
Section titled “SessionMessage”type SessionMessage = Readonly<{ requestId?: string; meta?: Json; data?: Json; origin?: Readonly<{ extensionId: string; correlation: string | null; }>; id: string; sequence: number; commandId: string | null; value: ModelMessage;}>;One completed model message and its separate application payload.
ShiitakeEventSourceConstructortype alias
Section titled “ShiitakeEventSourceConstructor”type ShiitakeEventSourceConstructor = ( url,) => Pick<EventTarget, "addEventListener"> & Pick<EventSource, "close"> & object;Minimal constructor seam for runtimes without a global EventSource.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
url |
string |
Returns
Section titled “Returns”Pick<EventTarget, "addEventListener"> & Pick<EventSource,
"close"> & object
SessionTerminaltype alias
Section titled “SessionTerminal”type SessionTerminal = Readonly<{ commandId: string; outcome: "completed" | "cancelled" | "failed" | "interrupted"; sequence: number; diagnostic: string | null; meta?: Json;}>;Durable outcome for one accepted work item on the selected Session lineage.
AgentRunningWorktype alias
Section titled “AgentRunningWork”type AgentRunningWork = | Readonly<{ kind: "session"; sessionId: string; commandId: string; }> | Readonly<{ kind: "host"; lane: string; jobId: string; }>;Work occupying the executor partition that this queued command requires, without message or provider data.
SessionActivitytype alias
Section titled “SessionActivity”type SessionActivity = Readonly<{ queue: | Readonly<{ state: "idle"; }> | Readonly<{ state: "queued"; commandId: string; runningWork: AgentRunningWork | null; }> | Readonly<{ state: "running"; commandId: string; }>; cancellationRequested: boolean; retry: Readonly<{ attempt: number; maxAttempts: number; delayMs: number; errorMessage: string; scheduledAt: number; }> | null; activeTool: string | null; lastModelChoiceSequence: number | null; compaction: Readonly<{ trigger: SessionCompactionTrigger; }> | null;}>;Raw facts about what a Session is doing now. Shiitake publishes facts only; a
client decides what they mean (see Parakeet’s sessionViewState).
SessionExtensionSlotstype alias
Section titled “SessionExtensionSlots”type SessionExtensionSlots = Readonly<Record<string, ExtensionSlotV0>>;Encoded extension slots keyed by extension identity; absent means unavailable.
SessionExtensionControlstype alias
Section titled “SessionExtensionControls”type SessionExtensionControls = Readonly<{ call: (command, input) => Promise<Json>;}>;Generic Session-scope extension commands.
AgentExtensionControlstype alias
Section titled “AgentExtensionControls”type AgentExtensionControls = Readonly<{ list: () => Promise<readonly ExtensionStatusV0[]>; resume: (extensionId) => Promise<ExtensionStatusV0>; call: (extensionId, command, input) => Promise<Json>;}>;Generic Agent-scope extension controls.
SessionToolOutputtype alias
Section titled “SessionToolOutput”type SessionToolOutput = Readonly<{ toolCallId: string; revision: number; tail: string; droppedBytes: number; totalBytes: number;}>;Process-local running tool tail; never a durable Session fact.
SessionProgresstype alias
Section titled “SessionProgress”type SessionProgress = Readonly<{ messageId: string; revision: number; text: string; thinking: string; textTruncated: boolean; thinkingTruncated: boolean;}>;Process-local assistant progress; never a durable Session fact.
SessionPendingPrompttype alias
Section titled “SessionPendingPrompt”type SessionPendingPrompt = Readonly<{ requestId: string; meta?: SessionMessage["meta"]; origin?: SessionMessage["origin"]; commandId: string; text: string; images?: PromptCommand["images"]; delivery: PromptDelivery;}>;Accepted prompt waiting to enter the conversation, not a scheduling command.
SessionPendingPromptstype alias
Section titled “SessionPendingPrompts”type SessionPendingPrompts = Readonly<{ total: number; prompts: readonly SessionPendingPrompt[]; hasMore: boolean;}>;Bounded current admission view, in acceptance order rather than execution order.
SessionCompactionMarkertype alias
Section titled “SessionCompactionMarker”type SessionCompactionMarker = Readonly<{ id: string; sequence: number; at: number; tokensBefore: number; tokensAfter: number | null; trigger: SessionCompactionTrigger | null;}>;Minimal full-history compaction boundary marker. sequence is the Woodstock
order of the row this marker precedes (ties sort the marker first); at is when
the compaction ran. The agent’s model context is unaffected by this marker; it
exists only for the client timeline.
SessionCompactionTriggertype alias
Section titled “SessionCompactionTrigger”type SessionCompactionTrigger = "manual" | "threshold" | "overflow";What started a compaction: the user, the context threshold, or an overflow.
SessionCompactionNoticetype alias
Section titled “SessionCompactionNotice”type SessionCompactionNotice = Readonly<{ id: string; sequence: number; at: number; trigger: SessionCompactionTrigger; result: "nothing_to_compact" | "failed" | "stale" | "insufficient"; diagnostic: string | null;}>;A compaction that changed nothing: a manual request with nothing to summarize yet, a compaction that failed, or a finished background summary dropped unplaced: stale because the context had moved past its head, or insufficient because placing it would have left the context over the limit. Automatic failures are never silent; each one is a notice at its own place in the timeline.
SessionContexttype alias
Section titled “SessionContext”type SessionContext = Readonly<{ tokens: number; window: number | null;}>;The Session’s context use as compaction measures it, against the window of the model a run would select now; the window is null when that model reports none.
SessionSnapshottype alias
Section titled “SessionSnapshot”type SessionSnapshot = Readonly<{ sessionId: string; cursor: string | null; hasMore: boolean; oldestCursor?: string | null; messages: readonly SessionMessage[]; terminals: readonly SessionTerminal[]; compactions?: readonly SessionCompactionMarker[]; compactionNotices?: readonly SessionCompactionNotice[]; sandboxFailures?: readonly SandboxFailureEvent[]; pending: SessionPendingPrompts; activity: SessionActivity; progress: SessionProgress | null; toolOutput: readonly SessionToolOutput[]; extensions: SessionExtensionSlots; attention: readonly SessionAttention[]; context?: SessionContext;}>;Bounded Session baseline at one opaque owner cursor.
SessionFrametype alias
Section titled “SessionFrame”type SessionFrame = | Readonly<{ kind: "activity"; activity: SessionActivity; }> | Readonly<{ kind: "tool_output"; toolOutput: readonly SessionToolOutput[]; activity: SessionActivity; }> | Readonly<{ kind: "update"; delivery: "replay" | "live"; cursor: string | null; pending: SessionPendingPrompts; messages: readonly SessionMessage[]; terminals: readonly SessionTerminal[]; compactions?: readonly SessionCompactionMarker[]; compactionNotices?: readonly SessionCompactionNotice[]; sandboxFailures?: readonly SandboxFailureEvent[]; activity: SessionActivity; extensions: SessionExtensionSlots; attention: readonly SessionAttention[]; context?: SessionContext; }> | Readonly<{ kind: "progress"; progress: SessionProgress; activity: SessionActivity; }> | Readonly<{ kind: "reset"; reason: "history_unavailable"; cursor: string | null; baseline: SessionSnapshot; }>;One bounded replay or live frame.
SubscribeOptionstype alias
Section titled “SubscribeOptions”type SubscribeOptions = Readonly<{ includeSandboxFailures?: boolean; after?: string;}>;Strict-after replay request.
ReadOptionstype alias
Section titled “ReadOptions”type ReadOptions = Readonly<{ includeSandboxFailures?: boolean; limit?: number; before?: string;}>;Bounded baseline request.
WatchOptionstype alias
Section titled “WatchOptions”type WatchOptions = ReadOptions;Race-safe observation request.
SessionWatchtype alias
Section titled “SessionWatch”type SessionWatch = Readonly<{ snapshot: SessionSnapshot; changes: AsyncIterable<SessionFrame>; close: () => Promise<void>;}>;Race-safe baseline plus live changes resource.
ShiitakeSessiontype alias
Section titled “ShiitakeSession”type ShiitakeSession = Readonly<{ address: string; command: SessionCommandHandler; withdraw: (requestId) => Promise<WithdrawResult>; abort: () => Promise<void>; send: (text, options?) => Promise<Accepted>; cancel: (input) => Promise<CancelResult>; latestPending: () => Promise<SessionPendingPrompt | null>; extension: (extensionId) => SessionExtensionControls; modelPreference: Readonly<{ read: () => Promise<ModelPreference | null>; set: (preference) => Promise<void>; }>; read: (input?) => Promise<SessionSnapshot>; readSettlement: ( commandId, options?, ) => Promise<CommandSettlement | undefined>; subscribe: (input) => AsyncIterable<SessionFrame>; watch: (input?) => Promise<SessionWatch>;}>;Addressable Session interface. Addressing itself performs no I/O.
SessionInboxStatetype alias
Section titled “SessionInboxState”type SessionInboxState = "needs_you" | "running" | "errored" | "done";Owner-decided inbox state, from Watchdog’s queue head and latest outcome.
running covers queued, thinking, streaming, retrying and cancelling; errored
covers failed, interrupted and outcome_unknown; done covers completed,
cancelled and never run. Any open extension attention produces needs_you,
taking priority over live and settled work.
SessionSummarytype alias
Section titled “SessionSummary”type SessionSummary = Readonly<{ createdAt: number; lastActivityAt: number; settledAt?: number; title: string; state: SessionInboxState;}>;Read-only saved conversation projection; opening does not update recency.
SessionSummaryRowtype alias
Section titled “SessionSummaryRow”type SessionSummaryRow = | (SessionSummary & Readonly<{ sessionId: string; }>) | Readonly<{ sessionId: string; state: "unavailable"; }>;One listed conversation, or a saved Session its owner could not read.
SessionSummaryPagetype alias
Section titled “SessionSummaryPage”type SessionSummaryPage = Readonly<{ sessions: readonly SessionSummaryRow[]; next: string | undefined;}>;One owner-bounded page: needs_you, then running, then settled rows, each
newest activity first. next is an opaque owner cursor.
ShiitakeAgenttype alias
Section titled “ShiitakeAgent”type ShiitakeAgent = Readonly<{ createSession: (requestId) => Promise<string>; deleteSession: (sessionId) => Promise<boolean>; listSessions: (after?) => Promise<SessionSummaryPage>; extensions: AgentExtensionControls; session: (sessionId) => ShiitakeSession; close: () => Promise<void>;}>;Constructed durable harness.
ExtensionViewV0type alias
Section titled “ExtensionViewV0”type ExtensionViewV0<P> = | Readonly<{ status: "unavailable"; }> | Readonly<{ status: "stopped"; reason: string; }> | Readonly<{ status: "running"; value: P | null; }>;What one client sees of an extension in a Session observation.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
P |
ScopedCommandsV0type alias
Section titled “ScopedCommandsV0”type ScopedCommandsV0<C, S> = { [K in keyof C & string]: C[K]["scope"] extends S ? K : never;}[keyof C & string];Command names of one scope, typed by the shared contract.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
C extends CommandsV0 |
S extends "session" | "agent" |
BoundCallV0type alias
Section titled “BoundCallV0”type BoundCallV0<C, S> = <K>(name, input) => Promise<C[K]["output"]["Type"]>;Typed call surface of one contract’s commands in one scope.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
C extends CommandsV0 |
S extends "session" | "agent" |
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
K extends ScopedCommandsV0<C, S> |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name |
K |
input |
C[K]["input"]["Type"] |
Returns
Section titled “Returns”Promise<C[K]["output"]["Type"]>
BoundSessionExtensionV0type alias
Section titled “BoundSessionExtensionV0”type BoundSessionExtensionV0<C, P> = Readonly<{ view: (observation) => ExtensionViewV0<P>; call: BoundCallV0<C, "session">;}>;One Session bound to one extension contract.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
C extends CommandsV0 |
P |
BoundAgentExtensionV0type alias
Section titled “BoundAgentExtensionV0”type BoundAgentExtensionV0<C> = Readonly<{ call: BoundCallV0<C, "agent">;}>;One Agent bound to one extension contract.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
C extends CommandsV0 |
ShiitakeClientOptionstype alias
Section titled “ShiitakeClientOptions”type ShiitakeClientOptions = Readonly<{ baseUrl: string; fetch?: typeof globalThis.fetch; eventSource?: ShiitakeEventSourceConstructor;}>;Network location of one remotely hosted Shiitake agent.
SessionAttentiontype alias
Section titled “SessionAttention”type SessionAttention = typeof SessionAttentionSchema.Type;One open attention item in a Session observation.
AcceptedSchemaconstant
Section titled “AcceptedSchema”const AcceptedSchema: Schema.Codec<Accepted>;Decode a durable command acceptance value at an RPC boundary.
HeldSchemaconstant
Section titled “HeldSchema”const HeldSchema: Schema.Codec<Held>;Parse the relay’s custody acknowledgment without implying Agent acceptance.
DelegationReceiptSchemaconstant
Section titled “DelegationReceiptSchema”const DelegationReceiptSchema: Schema.Codec<DelegationReceipt>;A delegated send is accepted by its owner or held in durable mail custody.
participantSnapshot()function
Section titled “participantSnapshot()”function participantSnapshot(snapshot, owner): SessionSnapshot;Filter participant delivery only; the holder’s stored Session is unchanged.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
snapshot |
SessionSnapshot |
owner |
ParticipantPolicy |
Returns
Section titled “Returns”visitorPendingPrompt()function
Section titled “visitorPendingPrompt()”function visitorPendingPrompt(prompt, visitorId): VisitorPendingPrompt;Project one owner-selected prompt without exposing host identity or correlation metadata.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
prompt |
SessionPendingPrompt |
visitorId |
string |
Returns
Section titled “Returns”visitorSnapshot()function
Section titled “visitorSnapshot()”function visitorSnapshot(snapshot, visitorId): SessionSnapshot;Visitor-scoped Session facts use the visitor’s public address, never the internal Session ID.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
snapshot |
SessionSnapshot |
visitorId |
string |
Returns
Section titled “Returns”visitorView()function
Section titled “visitorView()”function visitorView(snapshot, visitorId): VisitorView;Project only this visitor’s host-attributed prompts, their replies, and explicit operator replies.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
snapshot |
| Readonly<{ sessionId: string; cursor: string | null; hasMore: boolean; oldestCursor?: string | null; messages: readonly Readonly<{ requestId?: string; meta?: Json; data?: Json; origin?: Readonly<{ extensionId: string; correlation: string | null; }>; id: string; sequence: number; commandId: string | null; value: ModelMessage; }>[]; terminals: readonly Readonly<{ commandId: string; outcome: "completed" | "failed" | "cancelled" | "interrupted"; sequence: number; diagnostic: string | null; meta?: Json; }>[]; compactions?: readonly Readonly<{ id: string; sequence: number; at: number; tokensBefore: number; tokensAfter: number | null; trigger: SessionCompactionTrigger | null; }>[]; compactionNotices?: readonly Readonly<{ id: string; sequence: number; at: number; trigger: SessionCompactionTrigger; result: "failed" | "nothing_to_compact" | "stale" | "insufficient"; diagnostic: string | null; }>[]; sandboxFailures?: readonly object[]; pending: SessionPendingPrompts; activity: SessionActivity; progress: | Readonly<{ messageId: string; revision: number; text: string; thinking: string; textTruncated: boolean; thinkingTruncated: boolean; }> | null; toolOutput: readonly Readonly<{ toolCallId: string; revision: number; tail: string; droppedBytes: number; totalBytes: number; }>[]; extensions: SessionExtensionSlots; attention: readonly object[]; context?: Readonly<{ tokens: number; window: number | null; }>; }> | null |
visitorId |
string |
Returns
Section titled “Returns”parseDelegationReceipt()function
Section titled “parseDelegationReceipt()”function parseDelegationReceipt(value): DelegationReceipt;Decode one delegated send’s acceptance or durable-custody result.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
string |
Returns
Section titled “Returns”parseWithdrawResult()function
Section titled “parseWithdrawResult()”function parseWithdrawResult(value): WithdrawResult;Decode the owner’s atomic request resolution.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
string |
Returns
Section titled “Returns”parseAccepted()function
Section titled “parseAccepted()”function parseAccepted(value): Accepted;Parse one serialized command acceptance using Shiitake’s public grammar.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
string |
Returns
Section titled “Returns”parseCancelResult()function
Section titled “parseCancelResult()”function parseCancelResult(value): CancelResult;Parse one serialized cancel outcome: accepted, or too late.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
string |
Returns
Section titled “Returns”parseLatestPendingPrompt()function
Section titled “parseLatestPendingPrompt()”function parseLatestPendingPrompt(value): Readonly<{ requestId: string; meta?: Json; origin?: Readonly<{ extensionId: string; correlation: string | null; }>; commandId: string; text: string; images?: readonly object[]; delivery: PromptDelivery;}> | null;Decode the host-authorized newest pending lookup, including an empty result.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
string |
Returns
Section titled “Returns”| Readonly<{ requestId: string; meta?: Json;
origin?: Readonly<{ extensionId: string; correlation: string |
null; }>; commandId: string; text: string; images?: readonly
object[]; delivery: PromptDelivery; }> |
null
parseShiitakeError()function
Section titled “parseShiitakeError()”function parseShiitakeError(value): ShiitakeError;Parse one serialized canonical Shiitake failure.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
string |
Returns
Section titled “Returns”parseSessionSummaryPage()function
Section titled “parseSessionSummaryPage()”function parseSessionSummaryPage(value): SessionSummaryPage;Decode the existing bounded saved-conversation projection.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
string |
Returns
Section titled “Returns”bindSessionExtension()function
Section titled “bindSessionExtension()”function bindSessionExtension<C, P, PI>( session, contract,): BoundSessionExtensionV0<C, P>;Bind one Session to one extension contract; the contract’s schemas decode.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
C extends Readonly<Record<string, Readonly<{ scope: "session" | "agent"; input: Codec<unknown>; output: Codec<unknown>; }>>> |
P |
PI |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
session |
Pick<ShiitakeSession, "extension"> |
contract |
ExtensionContractV0<C, P, PI> |
Returns
Section titled “Returns”BoundSessionExtensionV0<C, P>
bindAgentExtension()function
Section titled “bindAgentExtension()”function bindAgentExtension<C, P, PI>( agent, contract,): BoundAgentExtensionV0<C>;Bind one Agent to one extension contract’s Agent-scope commands.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
C extends Readonly<Record<string, Readonly<{ scope: "session" | "agent"; input: Codec<unknown>; output: Codec<unknown>; }>>> |
P |
PI |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
agent |
Pick<ShiitakeAgent, "extensions"> |
contract |
ExtensionContractV0<C, P, PI> |
Returns
Section titled “Returns”createShiitakeClient()function
Section titled “createShiitakeClient()”function createShiitakeClient(options): ShiitakeAgent;Connect to a remotely hosted Shiitake agent.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
ShiitakeClientOptions |
Returns
Section titled “Returns”References
Section titled “References”CommandSettlement
Section titled “CommandSettlement”Re-exports CommandSettlement
parseForkedSession
Section titled “parseForkedSession”Re-exports parseForkedSession
parseSessionFrame
Section titled “parseSessionFrame”Re-exports parseSessionFrame
parseSessionSnapshot
Section titled “parseSessionSnapshot”Re-exports parseSessionSnapshot
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
ForkCommand
Section titled “ForkCommand”Re-exports ForkCommand
OperatorCommand
Section titled “OperatorCommand”Re-exports OperatorCommand
PromptCommand
Section titled “PromptCommand”Re-exports PromptCommand
PromptDelivery
Section titled “PromptDelivery”Re-exports PromptDelivery
SessionCommand
Section titled “SessionCommand”Re-exports SessionCommand
TitleCommand
Section titled “TitleCommand”Re-exports TitleCommand
ModelPreference
Section titled “ModelPreference”Re-exports ModelPreference