testing
Import
Section titled “Import”import * as api from "@fungi.computer/shiitake/testing";Exports
Section titled “Exports”| 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. |
ScriptedToolCallclass
Section titled “ScriptedToolCall”One scripted model tool call; the scripted sandbox runs exactly this call.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ScriptedToolCall(path, input): ScriptedToolCall;Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
path |
string |
<alias>.<operation> as the model would call it, e.g. bookmarks.add. |
input |
Json |
- |
Returns
Section titled “Returns”Properties
Section titled “Properties”readonly path: string;<alias>.<operation> as the model would call it, e.g. bookmarks.add.
readonly input: Json;ScriptSteptype alias
Section titled “ScriptStep”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”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”type MemoryHost = Readonly<{ agent: ShiitakeOwnerAgent; reconcile: () => Promise<void>; settle: (sessionId, maxTicks?, beforeRead?) => Promise<SessionSnapshot>; close: () => Promise<void>;}>;Explicitly driven in-process host for trusted tests and runnable examples.
fauxModelSource()function
Section titled “fauxModelSource()”function fauxModelSource(replies): ModelSource;A deterministic model source for trusted tests; no provider account or I/O.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
replies |
readonly FauxResponseStep[] |
Returns
Section titled “Returns”callTool()function
Section titled “callTool()”function callTool(path, input?): ScriptedToolCall;Script one model turn that calls an operation with this input.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
path |
string |
input |
Json |
Returns
Section titled “Returns”echoSystemPrompt()function
Section titled “echoSystemPrompt()”function echoSystemPrompt(): FauxResponseStep;Script one model turn that replies with the system prompt it received.
Returns
Section titled “Returns”FauxResponseStep
memoryHost()function
Section titled “memoryHost()”function memoryHost(options?): Promise<Readonly<{ agent: ShiitakeOwnerAgent; reconcile: () => Promise<void>; settle: (sessionId, maxTicks?, beforeRead?) => Promise<Readonly<{ sessionId: string; cursor: string | null; hasMore: boolean; oldestCursor?: string | null; messages: readonly Readonly<{ requestId?: ... | ...; meta?: ... | ...; data?: ... | ...; origin?: ... | ...; id: string; sequence: number; commandId: ... | ...; value: ModelMessage; }>[]; terminals: readonly Readonly<{ commandId: string; outcome: ... | ... | ... | ...; sequence: number; diagnostic: ... | ...; meta?: ... | ...; }>[]; compactions?: readonly Readonly<{ id: ...; sequence: ...; at: ...; tokensBefore: ...; tokensAfter: ...; trigger: ...; }>[]; compactionNotices?: readonly Readonly<{ id: ...; sequence: ...; at: ...; trigger: ...; result: ...; diagnostic: ...; }>[]; 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: ... | ...; }>; }>>; 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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
MemoryHostOptions |
Returns
Section titled “Returns”Promise<Readonly<{ agent:
ShiitakeOwnerAgent; reconcile: () =>
Promise<void>; settle: (sessionId, maxTicks?, beforeRead?) =>
Promise<Readonly<{ sessionId: string; cursor: string | null;
hasMore: boolean; oldestCursor?: string | null; messages: readonly
Readonly<{ requestId?: … | …; meta?: … | …; data?: … |
…; origin?: … | …; id: string; sequence: number; commandId:
… | …; value: ModelMessage; }>[];
terminals: readonly Readonly<{ commandId: string; outcome: … |
… | … | …; sequence: number; diagnostic: … | …; meta?: …
| …; }>[]; compactions?: readonly Readonly<{ id: …; sequence:
…; at: …; tokensBefore: …; tokensAfter: …; trigger: …; }>[];
compactionNotices?: readonly Readonly<{ id: …; sequence: …; at:
…; trigger: …; result: …; diagnostic: …; }>[];
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:
… | …; }>; }>>; close: () => Promise<void>; }>>