client
@fungi.computer/shiitake / client
client
Section titled “client”Type Aliases
Section titled “Type Aliases”Accepted
Section titled “Accepted”Accepted =
Readonly<{status:"accepted";commandId:string; }>
Semantic acknowledgement returned after one durable acceptance commit.
ForkedSession
Section titled “ForkedSession”ForkedSession =
Readonly<{sessionId:string; }>
Result returned after a fork commits a new cold-readable Session.
SessionCommandHandler
Section titled “SessionCommandHandler”SessionCommandHandler = {(
input):Promise<Readonly<{status:"accepted";commandId:string; }>>; (input):Promise<undefined>>; (input):Promise<Readonly<{sessionId:string; }>>; (input):Promise<Readonly<{status:"accepted";commandId:string; }> |Readonly<{sessionId:string; }> |undefined>>; }
Execute one retained type-discriminated Session command.
Call Signature
Section titled “Call Signature”(
input):Promise<Readonly<{status:"accepted";commandId:string; }>>
Accept a prompt or cancellation of one existing command.
Parameters
Section titled “Parameters”{ delivery: "followUp" | "steer"; requestId: string; type:
"prompt"; text: string; } | { commandId: string; onlyIfPending?:
boolean; type: "cancel"; }
Returns
Section titled “Returns”Promise<Readonly<{ status: "accepted"; commandId: string; }>>
Call Signature
Section titled “Call Signature”(
input):Promise<undefined>>
Abort the active run or select a complete Session lineage leaf.
Parameters
Section titled “Parameters”{ type: "abort"; } | { type: "branch"; entryId: string; }
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”"fork" = ...
entryId
Section titled “entryId”string = boundedId
Returns
Section titled “Returns”Promise<Readonly<{ sessionId: string; }>>
Call Signature
Section titled “Call Signature”(
input):Promise<Readonly<{status:"accepted";commandId:string; }> |Readonly<{sessionId:string; }> |undefined>>
Execute an already-decoded command union.
Parameters
Section titled “Parameters”{ delivery: "followUp" | "steer"; requestId: string; type:
"prompt"; text: string; } | { type: "abort"; } | { commandId:
string; onlyIfPending?: boolean; type: "cancel"; } | { type:
"branch"; entryId: string; } | { type: "fork"; entryId: string;
}
Returns
Section titled “Returns”Promise<Readonly<{ status: "accepted"; commandId: string; }> |
Readonly<{ sessionId: string; }> | undefined>
SendOptions
Section titled “SendOptions”SendOptions =
Readonly<{delivery?:PromptDelivery;requestId?:string; }>
Optional controls for the Promise-friendly text sender.
SessionMessage
Section titled “SessionMessage”SessionMessage =
Readonly<{id:string;sequence:number;commandId:string|null;value:Message; }>
One exact completed Pi message on the selected Session lineage.
ShiitakeEventSourceConstructor
Section titled “ShiitakeEventSourceConstructor”ShiitakeEventSourceConstructor = (
url) =>Pick<EventTarget,"addEventListener"> > &Pick<EventSource,"close"> > &object
Minimal constructor seam for runtimes without a global EventSource.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Pick<EventTarget, "addEventListener"> & Pick<EventSource,
"close"> & object
SessionTerminal
Section titled “SessionTerminal”SessionTerminal =
Readonly<{commandId:string;outcome:"completed"|"cancelled"|"failed"|"interrupted"; }>
Durable outcome for one accepted work item on the selected Session lineage.
SessionStatus
Section titled “SessionStatus”SessionStatus =
"cancelling"|"idle"|"queued"|"retrying"|"streaming"|"thinking"
Compact current Session activity derived by Shiitake.
SessionExtensionSlots
Section titled “SessionExtensionSlots”SessionExtensionSlots =
Readonly<Record<string,ExtensionSlotV1>>>>
Encoded extension slots keyed by extension identity; absent means unavailable.
SessionExtensionControls
Section titled “SessionExtensionControls”SessionExtensionControls =
Readonly<{call: (command,input) =>Promise<Json>>; }>
Generic Session-scope extension commands.
AgentExtensionControls
Section titled “AgentExtensionControls”AgentExtensionControls =
Readonly<{list: () =>Promise<readonlyExtensionStatusV1[]>;resume: (extensionId) =>Promise<ExtensionStatusV1>>;call: (extensionId,command,input) =>Promise<Json>>; }>
Generic Agent-scope extension controls.
SessionProgress
Section titled “SessionProgress”SessionProgress =
Readonly<{messageId:string;revision:number;text:string;thinking:string;textTruncated:boolean;thinkingTruncated:boolean; }>
Process-local assistant progress; never a durable Session fact.
SessionPendingPrompt
Section titled “SessionPendingPrompt”SessionPendingPrompt =
Readonly<{commandId:string;text:string;delivery:PromptDelivery; }>
Accepted prompt waiting to enter the conversation, not a scheduling command.
SessionPendingPrompts
Section titled “SessionPendingPrompts”SessionPendingPrompts =
Readonly<{prompts: readonlySessionPendingPrompt[];hasMore:boolean; }>
Bounded current admission view, in acceptance order rather than execution order.
SessionSnapshot
Section titled “SessionSnapshot”SessionSnapshot =
Readonly<{sessionId:string;cursor:string|null;hasMore:boolean;messages: readonlySessionMessage[];terminals: readonlySessionTerminal[];pending:SessionPendingPrompts;status:SessionStatus;progress:SessionProgress|null;extensions:SessionExtensionSlots; }>
Bounded Session baseline at one opaque owner cursor.
SessionFrame
Section titled “SessionFrame”SessionFrame =
Readonly<{kind:"update";delivery:"replay"|"live";cursor:string|null;pending:SessionPendingPrompts;messages: readonlySessionMessage[];terminals: readonlySessionTerminal[];status:SessionStatus;extensions:SessionExtensionSlots; }> |Readonly<{kind:"progress";progress:SessionProgress;status:SessionStatus; }> |Readonly<{kind:"reset";reason:"history_unavailable";cursor:string|null;baseline:SessionSnapshot; }>
One bounded replay or live frame.
SubscribeOptions
Section titled “SubscribeOptions”SubscribeOptions =
Readonly<{after?:string; }>
Strict-after replay request.
ReadOptions
Section titled “ReadOptions”ReadOptions =
Readonly<{limit?:number; }>
Bounded baseline request.
WatchOptions
Section titled “WatchOptions”WatchOptions =
ReadOptions
Race-safe observation request.
SessionWatch
Section titled “SessionWatch”SessionWatch =
Readonly<{snapshot:SessionSnapshot;changes:AsyncIterable<SessionFrame>>;close: () =>Promise<void>>; }>
Race-safe baseline plus live changes resource.
ShiitakeSession
Section titled “ShiitakeSession”ShiitakeSession =
Readonly<{address:string;command:SessionCommandHandler;abort: () =>Promise<void>>;send: (text,options?) =>Promise<Accepted>>;cancel: (input) =>Promise<Accepted>>;extension: (extensionId) =>SessionExtensionControls;modelPreference:Readonly<{read: () =>Promise<ModelPreference|null>>;set: (preference) =>Promise<void>>; }>;read: (input?) =>Promise<SessionSnapshot>>;subscribe: (input) =>AsyncIterable<SessionFrame>>;watch: (input?) =>Promise<SessionWatch>>; }>
Addressable Session interface. Addressing itself performs no I/O.
SessionSummary
Section titled “SessionSummary”SessionSummary =
Readonly<{createdAt:number;updatedAt:number;title:string;status:SessionStatus; }>
Read-only saved conversation projection; opening does not update recency.
SessionSummaryRow
Section titled “SessionSummaryRow”SessionSummaryRow =
SessionSummary&Readonly<{kind:"session";sessionId:string; }> |Readonly<{kind:"unavailable";sessionId:string; }>
One listed conversation, or a saved Session its owner could not read.
SessionSummaryPage
Section titled “SessionSummaryPage”SessionSummaryPage =
Readonly<{sessions: readonlySessionSummaryRow[];next:string|undefined; }>
One owner-bounded page, in stable Session identity order.
ShiitakeAgent
Section titled “ShiitakeAgent”ShiitakeAgent =
Readonly<{createSession: (requestId) =>Promise<string>>;listSessions: (after?) =>Promise<SessionSummaryPage>>;extensions:AgentExtensionControls;session: (sessionId) =>ShiitakeSession;close: () =>Promise<void>>; }>
Constructed durable harness.
ExtensionViewV1
Section titled “ExtensionViewV1”ExtensionViewV1<
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”P
ScopedCommandsV1
Section titled “ScopedCommandsV1”ScopedCommandsV1<
C,S> > ={ [K in keyof C & string]: C[K]["scope"] extends S ? K : never }[keyofC&string]
Command names of one scope, typed by the shared contract.
Type Parameters
Section titled “Type Parameters”C extends CommandsV1
S extends "session" | "agent"
BoundCallV1
Section titled “BoundCallV1”BoundCallV1<
C,S> > = <K>>(name,input) =>Promise<Schema.Schema.Type<C[K]["output"]>>
Typed call surface of one contract’s commands in one scope.
Type Parameters
Section titled “Type Parameters”C extends CommandsV1
S extends "session" | "agent"
Type Parameters
Section titled “Type Parameters”K extends ScopedCommandsV1<C, S>
Parameters
Section titled “Parameters”K
Schema.Schema.Type<C[K]["input"]>
Returns
Section titled “Returns”Promise<Schema.Schema.Type<C[K]["output"]>>
BoundSessionExtensionV1
Section titled “BoundSessionExtensionV1”BoundSessionExtensionV1<
C,P> > =Readonly<{view: (observation) =>ExtensionViewV1<P>>;call:BoundCallV1<C,"session">>; }>
One Session bound to one extension contract.
Type Parameters
Section titled “Type Parameters”C extends CommandsV1
P
BoundAgentExtensionV1
Section titled “BoundAgentExtensionV1”BoundAgentExtensionV1<
C> > =Readonly<{call:BoundCallV1<C,"agent">>; }>
One Agent bound to one extension contract.
Type Parameters
Section titled “Type Parameters”C extends CommandsV1
ShiitakeClientOptions
Section titled “ShiitakeClientOptions”ShiitakeClientOptions =
Readonly<{baseUrl:string;fetch?: typeofglobalThis.fetch;eventSource?:ShiitakeEventSourceConstructor; }>
Network location of one remotely hosted Shiitake agent.
Functions
Section titled “Functions”parseAccepted()
Section titled “parseAccepted()”parseAccepted(
value):Accepted
Parse one serialized command acceptance using Shiitake’s public grammar.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”parseShiitakeError()
Section titled “parseShiitakeError()”parseShiitakeError(
value):ShiitakeError
Parse one serialized canonical Shiitake failure.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”parseSessionSummaryPage()
Section titled “parseSessionSummaryPage()”parseSessionSummaryPage(
value):SessionSummaryPage
Decode the existing bounded saved-conversation projection.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”bindSessionExtension()
Section titled “bindSessionExtension()”bindSessionExtension<
C,P,PI>>(session,contract):BoundSessionExtensionV1<C,P>>
Bind one Session to one extension contract; the contract’s schemas decode.
Type Parameters
Section titled “Type Parameters”C extends Readonly<Record<string, Readonly<{ scope:
"session" | "agent"; input: AnyNoContext; output: AnyNoContext;
}>>>
P
PI
Parameters
Section titled “Parameters”session
Section titled “session”Pick<ShiitakeSession, "extension">
contract
Section titled “contract”ExtensionContractV1<C, P, PI>
Returns
Section titled “Returns”BoundSessionExtensionV1<C, P>
bindAgentExtension()
Section titled “bindAgentExtension()”bindAgentExtension<
C,P,PI>>(agent,contract):BoundAgentExtensionV1<C>>
Bind one Agent to one extension contract’s Agent-scope commands.
Type Parameters
Section titled “Type Parameters”C extends Readonly<Record<string, Readonly<{ scope:
"session" | "agent"; input: AnyNoContext; output: AnyNoContext;
}>>>
P
PI
Parameters
Section titled “Parameters”Pick<ShiitakeAgent, "extensions">
contract
Section titled “contract”ExtensionContractV1<C, P, PI>
Returns
Section titled “Returns”createShiitakeClient()
Section titled “createShiitakeClient()”createShiitakeClient(
options):ShiitakeAgent
Connect to a remotely hosted Shiitake agent.
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”References
Section titled “References”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
CancelCommand
Section titled “CancelCommand”Re-exports CancelCommand
ForkCommand
Section titled “ForkCommand”Re-exports ForkCommand
PromptCommand
Section titled “PromptCommand”Re-exports PromptCommand
PromptDelivery
Section titled “PromptDelivery”Re-exports PromptDelivery
SessionCommand
Section titled “SessionCommand”Re-exports SessionCommand
ModelPreference
Section titled “ModelPreference”Re-exports ModelPreference