Skip to content
API reference

testing

Import
import * as api from "@fungi.computer/shiitake/testing";
Kind Export Description
class ScriptedToolCall One scripted model tool call; the scripted sandbox runs exactly this call.
type alias ScriptStep One model turn in a test script: a reply, a tool call, or a faux step.
type alias MemoryHostOptions Optional canonical Agent inputs and a borrowed owner; defaults are in-memory.
type alias MemoryHost Explicitly driven in-process host for trusted tests and runnable examples.
function fauxModelSource() A deterministic model source for trusted tests; no provider account or I/O.
function callTool() Script one model turn that calls an operation with this input.
function echoSystemPrompt() Script one model turn that replies with the system prompt it received.
function memoryHost() Compose the real Shiitake runtime over an optional borrowed SQLite owner. Call reconcile/settle explicitly after acceptance. Defaults use a faux model and rejecting sandbox; custom callbacks are NOT isolation and retain host privileges. No submitted JavaScript is evaluated by this helper.

One scripted model tool call; the scripted sandbox runs exactly this call.

Signature
new ScriptedToolCall(path, input): ScriptedToolCall;
Parameter Type Description
path string <alias>.<operation> as the model would call it, e.g. bookmarks.add.
input Json -

ScriptedToolCall

Signature
readonly path: string;

<alias>.<operation> as the model would call it, e.g. bookmarks.add.

Signature
readonly input: Json;

ScriptSteptype alias

Section titled “ScriptStep”
Signature
type ScriptStep = string | ScriptedToolCall | FauxResponseStep;

One model turn in a test script: a reply, a tool call, or a faux step.


MemoryHostOptionstype alias

Section titled “MemoryHostOptions”
Signature
type MemoryHostOptions = Partial<
Omit<ShiitakeOptions, "store" | "runtime" | "extensions">
> &
Readonly<{
owner?: SqliteOwner;
extensions?: ExtensionRosterV0 | readonly RosteredExtensionV0[];
script?: readonly ScriptStep[];
}>;

Optional canonical Agent inputs and a borrowed owner; defaults are in-memory.


MemoryHosttype alias

Section titled “MemoryHost”
Signature
type MemoryHost = Readonly<{
agent: ShiitakeAgent;
reconcile: () => Promise<void>;
settle: (sessionId, maxTicks?) => Promise<SessionSnapshot>;
close: () => Promise<void>;
}>;

Explicitly driven in-process host for trusted tests and runnable examples.

fauxModelSource()function

Section titled “fauxModelSource()”
Signature
function fauxModelSource(replies): ModelSource;

A deterministic model source for trusted tests; no provider account or I/O.

Parameter Type
replies readonly FauxResponseStep[]

ModelSource


Signature
function callTool(path, input?): ScriptedToolCall;

Script one model turn that calls an operation with this input.

Parameter Type
path string
input Json

ScriptedToolCall


echoSystemPrompt()function

Section titled “echoSystemPrompt()”
Signature
function echoSystemPrompt(): FauxResponseStep;

Script one model turn that replies with the system prompt it received.

FauxResponseStep


memoryHost()function

Section titled “memoryHost()”
Signature
function memoryHost(options?): Promise<Readonly<{
agent: ShiitakeAgent;
reconcile: () => Promise<void>;
settle: (sessionId, maxTicks?) => Promise<Readonly<{
sessionId: string;
cursor: string | null;
hasMore: boolean;
oldestCursor?: string | null;
messages: readonly Readonly<{
author?: ... | ...;
origin?: ... | ...;
id: string;
sequence: number;
commandId: ... | ...;
value: Message;
}>[];
terminals: readonly Readonly<{
commandId: string;
outcome: ... | ... | ... | ...;
sequence: number;
diagnostic: ... | ...;
}>[];
compactions?: readonly Readonly<{
id: ...;
sequence: ...;
at: ...;
}>[];
sandboxFailures?: readonly object[];
pending: SessionPendingPrompts;
activity: SessionActivity;
progress: | Readonly<{
messageId: string;
revision: number;
text: string;
thinking: string;
textTruncated: boolean;
thinkingTruncated: boolean;
}>
| null;
extensions: SessionExtensionSlots;
attention: readonly object[];
}>>;
close: () => Promise<void>;
}>>;

Compose the real Shiitake runtime over an optional borrowed SQLite owner. Call reconcile/settle explicitly after acceptance. Defaults use a faux model and rejecting sandbox; custom callbacks are NOT isolation and retain host privileges. No submitted JavaScript is evaluated by this helper.

Parameter Type
options MemoryHostOptions

Promise<Readonly<{ agent: ShiitakeAgent; reconcile: () => Promise<void>; settle: (sessionId, maxTicks?) => Promise<Readonly<{ sessionId: string; cursor: string | null; hasMore: boolean; oldestCursor?: string | null; messages: readonly Readonly<{ author?: … | …; origin?: … | …; id: string; sequence: number; commandId: … | …; value: Message; }>[]; terminals: readonly Readonly<{ commandId: string; outcome: … | … | … | …; sequence: number; diagnostic: … | …; }>[]; compactions?: readonly Readonly<{ id: …; sequence: …; at: …; }>[]; sandboxFailures?: readonly object[]; pending: SessionPendingPrompts; activity: SessionActivity; progress: | Readonly<{ messageId: string; revision: number; text: string; thinking: string; textTruncated: boolean; thinkingTruncated: boolean; }> | null; extensions: SessionExtensionSlots; attention: readonly object[]; }>>; close: () => Promise<void>; }>>