Skip to content
API reference

client

Import
import * as api from "@fungi.computer/shiitake/client";
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”
Signature
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”
Signature
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”
Signature
type VisitorPendingPrompt = Pick<
SessionPendingPrompt,
"commandId" | "requestId" | "text" | "delivery" | "images"
>;

Public pending facts exclude the host’s private metadata and admission origin.


Signature
type Accepted = Readonly<{
status: "accepted";
commandId: string;
sessionId?: string;
}>;

Semantic acknowledgement returned after one durable acceptance commit.


Signature
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”
Signature
type DelegationReceipt = Accepted | Held;

A delegation send can be accepted by the Agent or held by its relay.


Signature
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”
Signature
type UnknownRequest = Readonly<{
status: "unknown";
}>;

No command has been admitted under this request key in the addressed Session.


CancelResulttype alias

Section titled “CancelResult”
Signature
type CancelResult = Accepted | TooLate | UnknownRequest;

Outcome of one cancel command or request-based recall.


WithdrawResulttype alias

Section titled “WithdrawResult”
Signature
type WithdrawResult = Accepted | UnknownRequest;

Atomic admission resolution: accepted work is kept; an unknown key is fenced forever.


ForkedSessiontype alias

Section titled “ForkedSession”
Signature
type ForkedSession = Readonly<{
sessionId: string;
}>;

Result returned after a fork commits a new cold-readable Session.


SessionCommandHandlertype alias

Section titled “SessionCommandHandler”
Signature
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.

Signature
(input): Promise<Readonly<{
status: "accepted";
commandId: string;
sessionId?: string;
}>>;

Accept a prompt or a compaction request as queued Session work.

Parameter Type
input | { delivery: "followUp" | "steer"; requestId: string; type: "prompt"; text: string; images?: readonly object[]; } | { type: "compact"; requestId: string; instructions?: string; }

Promise<Readonly<{ status: "accepted"; commandId: string; sessionId?: string; }>>

Signature
(input): Promise<CancelResult>;

Cancel one accepted command, or report that it is too late.

Parameter Type
input { commandId: string; onlyIfPending?: boolean; type: "cancel"; }
input.commandId string
input.onlyIfPending? boolean
input.type "cancel"

Promise<CancelResult>

Signature
(input): Promise<undefined>;

Abort the active run, select a lineage leaf, record an operator line, or set the title.

Parameter Type
input | { type: "abort"; } | { type: "branch"; entryId: string; } | { type: "operator"; requestId: string; author: "operator" | "party"; text: string; } | { type: "title"; title: string | null; }

Promise<undefined>

Signature
(input): Promise<Readonly<{
sessionId: string;
}>>;

Fork one complete entry lineage into a new Session.

Parameter Type
input { type: "fork"; entryId: string; }
input.type "fork"
input.entryId string

Promise<Readonly<{ sessionId: string; }>>

Signature
(input): Promise<
| CancelResult
| Readonly<{
sessionId: string;
}>
| undefined>;

Execute an already-decoded command union.

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; }

Promise< | CancelResult | Readonly<{ sessionId: string; }> | undefined>


SendOptionstype alias

Section titled “SendOptions”
Signature
type SendOptions = Readonly<{
images?: PromptCommand["images"];
delivery?: PromptDelivery;
requestId?: string;
}>;

Optional controls for the Promise-friendly text sender.


ModelMessagetype alias

Section titled “ModelMessage”
Signature
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”
Signature
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”
Signature
type ShiitakeEventSourceConstructor = (
url,
) => Pick<EventTarget, "addEventListener"> &
Pick<EventSource, "close"> &
object;

Minimal constructor seam for runtimes without a global EventSource.

Parameter Type
url string

Pick<EventTarget, "addEventListener"> & Pick<EventSource, "close"> & object


SessionTerminaltype alias

Section titled “SessionTerminal”
Signature
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”
Signature
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”
Signature
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”
Signature
type SessionExtensionSlots = Readonly<Record<string, ExtensionSlotV0>>;

Encoded extension slots keyed by extension identity; absent means unavailable.


SessionExtensionControlstype alias

Section titled “SessionExtensionControls”
Signature
type SessionExtensionControls = Readonly<{
call: (command, input) => Promise<Json>;
}>;

Generic Session-scope extension commands.


AgentExtensionControlstype alias

Section titled “AgentExtensionControls”
Signature
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”
Signature
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”
Signature
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”
Signature
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”
Signature
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”
Signature
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”
Signature
type SessionCompactionTrigger = "manual" | "threshold" | "overflow";

What started a compaction: the user, the context threshold, or an overflow.


SessionCompactionNoticetype alias

Section titled “SessionCompactionNotice”
Signature
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”
Signature
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”
Signature
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”
Signature
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”
Signature
type SubscribeOptions = Readonly<{
includeSandboxFailures?: boolean;
after?: string;
}>;

Strict-after replay request.


ReadOptionstype alias

Section titled “ReadOptions”
Signature
type ReadOptions = Readonly<{
includeSandboxFailures?: boolean;
limit?: number;
before?: string;
}>;

Bounded baseline request.


WatchOptionstype alias

Section titled “WatchOptions”
Signature
type WatchOptions = ReadOptions;

Race-safe observation request.


SessionWatchtype alias

Section titled “SessionWatch”
Signature
type SessionWatch = Readonly<{
snapshot: SessionSnapshot;
changes: AsyncIterable<SessionFrame>;
close: () => Promise<void>;
}>;

Race-safe baseline plus live changes resource.


ShiitakeSessiontype alias

Section titled “ShiitakeSession”
Signature
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”
Signature
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”
Signature
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”
Signature
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”
Signature
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”
Signature
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”
Signature
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 Parameter
P

ScopedCommandsV0type alias

Section titled “ScopedCommandsV0”
Signature
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 Parameter
C extends CommandsV0
S extends "session" | "agent"

BoundCallV0type alias

Section titled “BoundCallV0”
Signature
type BoundCallV0<C, S> = <K>(name, input) => Promise<C[K]["output"]["Type"]>;

Typed call surface of one contract’s commands in one scope.

Type Parameter
C extends CommandsV0
S extends "session" | "agent"
Type Parameter
K extends ScopedCommandsV0<C, S>
Parameter Type
name K
input C[K]["input"]["Type"]

Promise<C[K]["output"]["Type"]>


BoundSessionExtensionV0type alias

Section titled “BoundSessionExtensionV0”
Signature
type BoundSessionExtensionV0<C, P> = Readonly<{
view: (observation) => ExtensionViewV0<P>;
call: BoundCallV0<C, "session">;
}>;

One Session bound to one extension contract.

Type Parameter
C extends CommandsV0
P

BoundAgentExtensionV0type alias

Section titled “BoundAgentExtensionV0”
Signature
type BoundAgentExtensionV0<C> = Readonly<{
call: BoundCallV0<C, "agent">;
}>;

One Agent bound to one extension contract.

Type Parameter
C extends CommandsV0

ShiitakeClientOptionstype alias

Section titled “ShiitakeClientOptions”
Signature
type ShiitakeClientOptions = Readonly<{
baseUrl: string;
fetch?: typeof globalThis.fetch;
eventSource?: ShiitakeEventSourceConstructor;
}>;

Network location of one remotely hosted Shiitake agent.


SessionAttentiontype alias

Section titled “SessionAttention”
Signature
type SessionAttention = typeof SessionAttentionSchema.Type;

One open attention item in a Session observation.

AcceptedSchemaconstant

Section titled “AcceptedSchema”
Signature
const AcceptedSchema: Schema.Codec<Accepted>;

Decode a durable command acceptance value at an RPC boundary.


HeldSchemaconstant

Section titled “HeldSchema”
Signature
const HeldSchema: Schema.Codec<Held>;

Parse the relay’s custody acknowledgment without implying Agent acceptance.


DelegationReceiptSchemaconstant

Section titled “DelegationReceiptSchema”
Signature
const DelegationReceiptSchema: Schema.Codec<DelegationReceipt>;

A delegated send is accepted by its owner or held in durable mail custody.

participantSnapshot()function

Section titled “participantSnapshot()”
Signature
function participantSnapshot(snapshot, owner): SessionSnapshot;

Filter participant delivery only; the holder’s stored Session is unchanged.

Parameter Type
snapshot SessionSnapshot
owner ParticipantPolicy

SessionSnapshot


visitorPendingPrompt()function

Section titled “visitorPendingPrompt()”
Signature
function visitorPendingPrompt(prompt, visitorId): VisitorPendingPrompt;

Project one owner-selected prompt without exposing host identity or correlation metadata.

Parameter Type
prompt SessionPendingPrompt
visitorId string

VisitorPendingPrompt


visitorSnapshot()function

Section titled “visitorSnapshot()”
Signature
function visitorSnapshot(snapshot, visitorId): SessionSnapshot;

Visitor-scoped Session facts use the visitor’s public address, never the internal Session ID.

Parameter Type
snapshot SessionSnapshot
visitorId string

SessionSnapshot


visitorView()function

Section titled “visitorView()”
Signature
function visitorView(snapshot, visitorId): VisitorView;

Project only this visitor’s host-attributed prompts, their replies, and explicit operator replies.

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

VisitorView


parseDelegationReceipt()function

Section titled “parseDelegationReceipt()”
Signature
function parseDelegationReceipt(value): DelegationReceipt;

Decode one delegated send’s acceptance or durable-custody result.

Parameter Type
value string

DelegationReceipt


parseWithdrawResult()function

Section titled “parseWithdrawResult()”
Signature
function parseWithdrawResult(value): WithdrawResult;

Decode the owner’s atomic request resolution.

Parameter Type
value string

WithdrawResult


parseAccepted()function

Section titled “parseAccepted()”
Signature
function parseAccepted(value): Accepted;

Parse one serialized command acceptance using Shiitake’s public grammar.

Parameter Type
value string

Accepted


parseCancelResult()function

Section titled “parseCancelResult()”
Signature
function parseCancelResult(value): CancelResult;

Parse one serialized cancel outcome: accepted, or too late.

Parameter Type
value string

CancelResult


parseLatestPendingPrompt()function

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

Parameter Type
value string

| 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()”
Signature
function parseShiitakeError(value): ShiitakeError;

Parse one serialized canonical Shiitake failure.

Parameter Type
value string

ShiitakeError


parseSessionSummaryPage()function

Section titled “parseSessionSummaryPage()”
Signature
function parseSessionSummaryPage(value): SessionSummaryPage;

Decode the existing bounded saved-conversation projection.

Parameter Type
value string

SessionSummaryPage


bindSessionExtension()function

Section titled “bindSessionExtension()”
Signature
function bindSessionExtension<C, P, PI>(
session,
contract,
): BoundSessionExtensionV0<C, P>;

Bind one Session to one extension contract; the contract’s schemas decode.

Type Parameter
C extends Readonly<Record<string, Readonly<{ scope: "session" | "agent"; input: Codec<unknown>; output: Codec<unknown>; }>>>
P
PI
Parameter Type
session Pick<ShiitakeSession, "extension">
contract ExtensionContractV0<C, P, PI>

BoundSessionExtensionV0<C, P>


bindAgentExtension()function

Section titled “bindAgentExtension()”
Signature
function bindAgentExtension<C, P, PI>(
agent,
contract,
): BoundAgentExtensionV0<C>;

Bind one Agent to one extension contract’s Agent-scope commands.

Type Parameter
C extends Readonly<Record<string, Readonly<{ scope: "session" | "agent"; input: Codec<unknown>; output: Codec<unknown>; }>>>
P
PI
Parameter Type
agent Pick<ShiitakeAgent, "extensions">
contract ExtensionContractV0<C, P, PI>

BoundAgentExtensionV0<C>


createShiitakeClient()function

Section titled “createShiitakeClient()”
Signature
function createShiitakeClient(options): ShiitakeAgent;

Connect to a remotely hosted Shiitake agent.

Parameter Type
options ShiitakeClientOptions

ShiitakeAgent

Re-exports CommandSettlement


Re-exports parseForkedSession


Re-exports parseSessionFrame


Re-exports parseSessionSnapshot


Re-exports AbortCommand


Re-exports BranchCommand


Re-exports CompactCommand


Re-exports CancelCommand


Re-exports ForkCommand


Re-exports OperatorCommand


Re-exports PromptCommand


Re-exports PromptDelivery


Re-exports SessionCommand


Re-exports TitleCommand


Re-exports ModelPreference