zidane/ core
The agent, tools, hooks, sessions and the fetch-based providers, with no Node built-in in the import graph, for browsers, Workers and edge functions.
import { … } from 'zidane/core'src/core-entry.ts
Use zidane/core where there is no Node: a page, a Worker, or Deno with only --allow-env (Supabase and Netlify Edge Functions). Its createAgent() makes the same agent as zidane/agent, without the host's capabilities:
- An agent without
executionruns increateNoneContext(): no files and no commands. - Images are sent as they are, without being shrunk.
mcpServersneeds anmcpConnector.skills,behavior.viewsandbehavior.codemoderefuse to start, and name the Node entry that has them.anthropic()takes its key fromapiKey,accessorANTHROPIC_API_KEY, never reads the credentials file and never refreshes a token.openrouter()has no image generation and no stored settings.
On Node, zidane and zidane/agent create the agent with every capability.
import { anthropic, createAgent, createMemoryStore, createSession } from 'zidane/core'
const session = await createSession({ store: createMemoryStore() })
const agent = createAgent({
// A site proxy that adds the key: the page holds none.
provider: anthropic({ baseURL: '/api/anthropic', allowBrowser: true, betas: false }),
session,
})
await agent.run({ prompt: 'Say hello.' })Functions#
anthropicFunction#
The Anthropic provider without the credentials file: its key comes from
apiKey, access or ANTHROPIC_API_KEY, never refreshed, and account
or credentialsPath throw. zidane/providers/anthropic has the rest.
function anthropic(params?: AnthropicParams): ProviderParameters
| Name | Type | Description |
|---|---|---|
| params? | AnthropicParams | API key, default model, base URL, headers and beta flags. |
Returns
ProviderThe provider.
createAgentFunction#
Creates an agent with no host capabilities (see the module comment).
function createAgent(options: AgentOptions): AgentParameters
| Name | Type | Description |
|---|---|---|
| options | AgentOptions | Agent options. Only |
createMemoryStoreFunction#
Creates an in-memory SessionStore. Nothing is persisted.
function createMemoryStore(): SessionStoreReturns
Example
import { createMemoryStore, createSession } from 'zidane/session'
const session = await createSession({ store: createMemoryStore() })createNoneContextFunction#
A context that spawns a handle and nothing else (see the module comment).
function createNoneContext(): ExecutionContextReturns
createRemoteStoreFunction#
Creates a SessionStore that talks to a REST session API over HTTP. See the module comment for the endpoints it calls.
function createRemoteStore(options: RemoteStoreOptions): SessionStoreParameters
| Name | Type | Description |
|---|---|---|
| options | RemoteStoreOptions | API base URL, headers and timeout. |
Returns
Example
import { createRemoteStore, createSession } from 'zidane/session'
const store = createRemoteStore({ url: 'https://api.example.com', headers: { authorization: 'Bearer token' } })
const session = await createSession({ store })createSessionFunction#
Create a new session. Async so stores that generate IDs server-side (e.g. a database) can be supported.
function createSession(options?: CreateSessionOptions): Promise<Session>Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| options? | CreateSessionOptions | {} | Session identity, metadata and store. See |
Returns
Promise<Session>Example
import { createMemoryStore, createSession } from 'zidane/session'
const session = await createSession({ agentId: 'reviewer', store: createMemoryStore() })
console.log(session.id, session.turns.length)fnv1a32Function#
FNV-1a, 32 bits, over the UTF-16 code units of value: a tiny,
dependency-free, deterministic, non-cryptographic hash for change detection,
cache keys and seeds. The full code unit goes into the mix (not its low
byte), so non-ASCII changes are seen. Every rendering (base36, hex, a seed)
is built on this one.
function fnv1a32(value: string, seed?: number): numberParameters
| Name | Type | Default | Description |
|---|---|---|---|
| value | string | String to hash. | |
| seed? | number | FNV1A32_OFFSET | A running hash to continue (another |
Returns
numberThe hash, an unsigned 32-bit integer.
hasAsyncContextFunction#
Whether a scope follows awaits on this runtime.
function hasAsyncContext(): booleanReturns
booleanloadSessionFunction#
Load an existing session from a store.
function loadSession(
store: SessionStore,
sessionId: string,
options?: LoadSessionOptions,
): Promise<Session | null>Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| store | SessionStore | Store to load from. | |
| sessionId | string | Id of the session to load. | |
| options? | LoadSessionOptions | {} | Load options. See |
Returns
Promise<Session | null>The session, or null when the store has no session with that id.
openrouterFunction#
The OpenRouter provider without image generation (pi-ai's catalog) or the
host's stored settings: its key comes from apiKey or OPENROUTER_API_KEY.
zidane/providers/openrouter has the rest.
function openrouter(params?: OpenRouterParams): ProviderParameters
| Name | Type | Description |
|---|---|---|
| params? | OpenRouterParams | API key, base URL, headers, default model and capabilities. |
Returns
ProviderThe provider.
Interfaces#
AgentRunOptionsInterface#
Options for one Agent.run call.
interface AgentRunOptionsProperties
| Name | Type | Default | Description |
|---|---|---|---|
| behavior? | AgentBehavior | Behavior overrides for this run (overrides agent defaults) | |
| by? | Actor | Who the run works for: the person whose message started it. Lands on
every | |
| clock? | AgentClock | Override the time + UUID source for this run only. Per-run wins over
agent-level ( | |
| contextSections? | { rulesBlock?: string; rulesFiles?: { path: string; source: string }[] } | Optional metadata describing which named sections the host baked into
| |
| depth? | number | Zero-based subagent depth. 0 = top-level | |
| hooks? | RunHookMap | Per-run hook registrations. Each hook is attached before the run starts and detached in a finally block so handlers never leak across runs. Accepts either a single handler or an array (all handlers register). | |
| leaseRenewMs? | number | How often a top-level checkpoint run ( | |
| metadata? | Readonly<Record<string, JsonValue>> | Host data about this run's prompt (an extension | |
| model? | string | (string | ModelTargetSpec)[] | Model selection for this run.
The run starts on the first resolved target and advances down the list
when a stream fails terminally (see the | |
| modelOptions? | Record<string, boolean> | Enabled model-specific options for this run, keyed by option id (e.g.
| |
| parentCallId? | string | Tool-call id of the Lands on every | |
| parentRunId? | string | Parent run id. Populated automatically by the | |
| pauseSignal? | AbortSignal | Pause signal: when triggered, the run stops at the next turn boundary
(after the model call in flight and its tool results are saved), never
mid-turn, and returns with | |
| prompt? | string | PromptPart[] | User prompt. Optional when resuming a session with existing turns. Accepts either a plain string (single text part) or an array of | |
| promptOrigin? | TextOrigin | Where the prompt came from (a channel, a schedule, a worker), set on the
prompt's own text blocks in the seeded turn (not on drained notifications
or | |
| promptSkillGroups? | SkillGroupUse[] | The skill groups the prompt named, saved on the seeded prompt turn
( | |
| promptTurnId? | string | Id of the prompt turn this run seeds, minted by the caller beforehand
( | |
| requestId? | string | The client request this run answers. | |
| resumeRunId? | string | Resume a prior run's conversation: seed this run's turns from the
session turns tagged with this | |
| runAgent? | SessionRunAgent | The host's agent profile this run runs as, persisted onto the resulting
| |
| runLabel? | string | Host-assigned display label persisted onto the resulting | |
| runModel? | string | The model id the run was announced on, persisted onto the resulting
| |
| signal? | AbortSignal | Abort signal — when triggered, the run aborts the same way | |
| system? | string | System prompt for this run. Falls back to | |
| systemFreeze? | SystemFreezeOptions | Keep the conversation's system prompt byte-stable across runs and agent rebuilds, so provider prompt caches and replayed thinking stay valid. The run composes its fresh prompt as usual (base, skills catalog, searchable-tools catalog, MCP instructions), then:
Both callbacks also get the sections the SDK appended
( | |
| systemNotes? | readonly (SystemNote & { text: string })[] | Notes for the model, appended to this run's prompt turn after the prompt
as text blocks marked with | |
| thinking? | 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'adaptive' | 'off' | Thinking effort for this run. See |
| tools? | Record<string, ToolDef> | Tool overrides for this run. Pass {} for no tools. Omit to use agent tools. | |
| tracingContext? | Readonly<Record<string, string>> | Opaque trace-context carrier propagated from the parent agent's
tracer (typically a W3C Set automatically by the |
AgentStatsInterface#
Token, cost and timing totals returned by Agent.run.
interface AgentStatsProperties
| Name | Type | Description |
|---|---|---|
| children? | ChildRunStats[] | Stats from child agents spawned during this run, in completion order. Recursive. |
| cost? | number | Cumulative cost in USD — parent loop plus every recursively-spawned
sub-agent. Sums per-turn |
| elapsed | number | Wall-clock duration of the top-level |
| output? | Record<string, unknown> | Structured output from schema enforcement (only present when behavior.schema is set) |
| paused? | boolean | The run stopped at a turn boundary on |
| suspended? | boolean |
|
| timeTillFirstTokenMs? | number | Milliseconds from the start of Absent when the run produced no observable signals (e.g. aborted before any stream event). |
| totalCacheCreation | number | Cumulative cache-creation tokens across the parent agent loop and every
recursively-spawned sub-agent. Same rationale as
|
| totalCacheRead | number | Cumulative cache-read tokens across the parent agent loop and every
recursively-spawned sub-agent. Surfaced at the top level (rather than
only per- |
| totalIn | number | Cumulative input tokens across the parent agent loop and every recursively-spawned sub-agent. Use this for billing / token-ledger consumption. |
| totalOut | number | Cumulative output tokens. Same semantics as |
| turns | number | Number of parent agent-loop turns. Children's turn counts live under
Tree-wide turn count: |
| turnUsage? | TurnUsage[] | Per-turn usage breakdown for the parent loop only. Children's per-turn
usages live under |
| waitedMs? | number | Wall time the run spent waiting on the outside world, in ms (tools
flagged |
CreateSessionOptionsInterface#
Options for createSession.
interface CreateSessionOptionsProperties
| Name | Type | Description |
|---|---|---|
| _data? | SessionData | @internal: restore from existing data (bypasses id/agentId/metadata
options). The session ALIASES this object for its lifetime — every
mutation (appendTurns, run records, updatedAt) writes through to it,
and the load-time pairing heal may replace its |
| agentId? | string | Agent ID label |
| id? | string | Session ID. If omitted and store provides generateSessionId, that is used. |
| metadata? | Record<string, unknown> | Initial metadata |
| onPairingDrop? | (drop: PairingDrop) => void | Observability hook for the load-time pairing heal: fired once per block
or turn |
| projectRoot? | string | Project tag — see |
| store? | SessionStore | Storage backend (optional, enables save/load) |
LoadSessionOptionsInterface#
Options for loadSession.
interface LoadSessionOptionsProperties
| Name | Type | Description |
|---|---|---|
| clock? | Pick<AgentClock, 'now'> | Time source for the stale |
| onPairingDrop? | (drop: PairingDrop) => void | Forwarded to |
| persistHeal? | boolean | Write a load-time pairing heal back to the store (default true). Pass
No load closes interrupted tool calls: the process holding the run may
still be running the tool. A run does that once it owns the session,
through |
RemoteStoreOptionsInterface#
Options for createRemoteStore.
interface RemoteStoreOptionsProperties
| Name | Type | Description |
|---|---|---|
| headers? | Record<string, string> | Optional headers (e.g. for authentication) |
| timeoutMs? | number | Per-request timeout in ms. Default 30s — bounds a hung backend. |
| url | string | Base URL of the session API |
SessionInterface#
A live session: the turn history and run records of one conversation, with an optional store that persists them.
interface SessionProperties
| Name | Type | Description |
|---|---|---|
| abortRun | (runId: string, stats?: { cost?: number; tokensIn: number; tokensOut: number; turns: number; turnUsage?: TurnUsage[] }) => void | Mark a run as aborted. Optional |
| addArtifact | (input: SessionArtifactInput, origin?: { by?: Actor; runId?: string; turnId?: string }) => Promise<SessionArtifact | undefined> | Record an artifact this session produced. Fills |
| agentId?readonly | string | Agent ID (optional label) |
| appendTurns | (turns: SessionTurn[], options?: AppendTurnsOptions) => Promise<HistoryWrite | undefined> | Appends turns to in-memory history and persists them via |
| completeRun | (runId: string, stats: { cost?: number; tokensIn: number; tokensOut: number; turns: number; turnUsage?: TurnUsage[] }) => void | Mark a run as completed |
| createdAtreadonly | number | Creation time as epoch milliseconds. |
| errorRun | (runId: string, error: string, stats?: { cost?: number; tokensIn: number; tokensOut: number; turns: number; turnUsage?: TurnUsage[] }, detail?: RunErrorDetail) => void | Mark a run as errored. Optional |
| generateTurnId | () => string | Promise<string> | Generate a session-managed turn ID using store.generateTurnId if available, else crypto.randomUUID() |
| healInterruptedToolCalls | () => Promise<boolean> | Close every tool call whose result was never persisted (the process died
mid-tool) with a synthetic error result saying the tool may have
partially run. Call it only once this process OWNS the session's next
run (after the run claim, or where a single owner is guaranteed): while
another process still runs the tool, its real result would land after
the synthetic one and be dropped as an orphan. Persists through |
| idreadonly | string | Session ID |
| isEmptyreadonly | boolean | True when this session has no turns yet. Use this as a first-prompt signal when setting up a run — e.g. writing initial
configuration only on fresh sessions. Equivalent to |
| listArtifacts | (filter?: Pick<ArtifactFilter, 'kind' | 'since' | 'limit'>) => Promise<SessionArtifact[]> | This session's artifacts, newest first. Empty when unsupported. |
| metadatareadonly | Record<string, unknown> | Arbitrary metadata |
| onMeta | (listener: SessionMetaListener) => () => void | Call |
| onSaved | (listener: SessionSavedListener) => () => void | Call |
| projectRoot?readonly | string | Project this session was created under — see |
| runsreadonly | SessionRun[] | All runs in this session |
| save | () => Promise<void> | Persist the session to the store. When the store implements On a journaled store ( |
| saveMetaKeys? | (keys: readonly string[]) => Promise<void> | Persist only these metadata keys (and the header and runs |
| savePending? | () => Promise<void> | Write the metadata changed since the last save, if any (a |
| setAgentId | (agentId: string) => void | Re-label the session's agent profile (in memory; persisted by the
next |
| setMeta | (key: string, value: unknown, options?: { touch?: boolean }) => void | Set metadata key. |
| setRuns | (runs: SessionRun[]) => void | Replace all runs in-memory (does not persist — use save() for that).
Mirrors |
| setTurns | (turns: SessionTurn[]) => void | Replace all turns in-memory (does not persist — use save() for that) |
| startRun | (runId: string, prompt?: string, extras?: { agent?: SessionRunAgent; depth?: number; label?: string; model?: string; parentCallId?: string; parentRunId?: string; resumedFromRunId?: string }) => void | Start tracking a new run. |
| statusreadonly | 'error' | 'running' | 'completed' | 'idle' | Top-level session status |
| store?readonly | SessionStore | The backing store, when one was provided. Exposed so hosts can call
its optional |
| toJSON | () => SessionData | Serialize to SessionData |
| toMessages | (options?: ToWireMessagesOptions) => Promise<SessionMessage[]> | Project the session's persisted turns into wire-ready messages safe to hand to any provider. The canonical answer to "I need to send these turns to Anthropic /
OpenAI from outside Pass Pure + idempotent. Resolves content refs only in the returned messages
and does NOT mutate |
| turnsreadonly | SessionTurn[] | Raw persisted turn history — kept pristine for fidelity (the model's reasoning chain stays intact across reloads). DO NOT pass this directly to a provider request. Mid-pair
persistence (interrupted runs, partial-result writes, compaction
boundaries) leaves orphan For provider requests built outside |
| updatedAtreadonly | number | Last update time as epoch milliseconds. |
| updateRun | (run: SessionRun) => Promise<void> | Persist an updated run record via store.updateRun (if store present) |
| updateStatus | (status: 'error' | 'running' | 'completed' | 'idle') => Promise<void> | Update the session status in memory AND via store.updateStatus (if store present) |
SessionMessageInterface#
One message of a session conversation, as sent to the provider.
interface SessionMessageProperties
| Name | Type | Description |
|---|---|---|
| content | SessionContentBlock[] | Content blocks of the message, in order. |
| role | 'user' | 'assistant' | Author of the message. |
SessionStoreInterface#
Storage backend for sessions. Implement it to persist sessions somewhere else, or use a bundled store: memory, SQLite, remote or file map.
interface SessionStoreProperties
| Name | Type | Description |
|---|---|---|
| appendTurns | (sessionId: string, turns: SessionTurn[], options?: AppendTurnsOptions) => Promise<HistoryWrite> | Append new turns to a session (incremental, avoids full re-save).
Resolves to the append's position, computed inside the write (an append of no turns keeps the position). |
| blobs?readonly | BlobStore | Optional: media bytes by content hash ( |
| claimRun? | (sessionId: string, options: { owner?: RunOwner; staleAt: number }) => Promise<{ claimed: boolean; previous?: 'error' | 'running' | 'completed' | 'idle' }> | Optional: claim the session for a run in ONE atomic step — set |
| close? | () => void | Optional: release backend resources (e.g. close the SQLite handle). Hosts should call this on teardown when present; stores backed by memory or remote HTTP have nothing to release and may omit it. |
| delete | (sessionId: string) => Promise<void> | Delete a session. |
| deleteArtifact? | (sessionId: string, artifactId: string) => Promise<void> | Optional: remove one artifact. Unknown ids are a no-op. |
| findTurns? | (sessionId: string, query: FindTurnsQuery) => Promise<SessionTurn[]> | Optional: the turns of one role and/or one run, or the last |
| generateSessionId? | () => string | Promise<string> | Optional: generate a session ID server-side (e.g. a database-issued UUID). |
| generateTurnId? | () => string | Promise<string> | Optional: generate a turn ID server-side for session-managed user turns. Provider-loop assistant and tool-result turns use AgentClock.randomUUID() instead, so durable-execution adapters can keep those IDs replay-stable. |
| getHeader? | (sessionId: string) => Promise<SessionHeaderData | null> | Optional: one session's header fields alone (no turn, no run, no count).
The cheapest read of a session: hot paths that need its metadata, cwd or
status read this. Callers fall back to |
| getMeta? | (sessionId: string) => Promise<SessionMetaRow | null> | Optional: one session's header row WITHOUT materializing turns.
Hot-path reads (the cross-process run guard checks |
| getRuns? | (sessionId: string) => Promise<SessionRun[]> | Optional: one session's run records alone. Callers fall back to |
| getTurnById? | (sessionId: string, turnId: string) => Promise<SessionTurn | null> | Optional: the first turn (in order) with id |
| getTurns | (sessionId: string, from?: number, limit?: number) => Promise<SessionTurn[]> | Return a slice of turns for a session. |
| historyPosition? | (sessionId: string) => Promise<HistoryPosition | null> | Optional. The session's history position alone, or |
| journaled?readonly | true | Set when the store's writes are entries of a journal (a kernel session
store on a journaled host: Restate). A re-run that skips the tool's body
does not make a write made inside a tool step again, so a
|
| list | (filter?: { agentId?: string; limit?: number; projectRoot?: string | null }) => Promise<string[]> | List session IDs, optionally filtered. |
| listArtifacts? | (filter?: ArtifactFilter) => Promise<SessionArtifact[]> | Optional: list artifacts, newest |
| listMeta? | (filter?: { agentId?: string; limit?: number; projectRoot?: string | null }) => Promise<SessionMetaRow[]> | Optional: list session summaries without materializing full sessions. The generic fallback (
Same filter contract and ordering (most recently updated first) as
|
| load | (sessionId: string) => Promise<SessionData | null> | Load a session by ID. Returns null if not found. |
| mutateHistory? | (sessionId: string, mutate: (history: SessionHistory) => SessionHistory | null) => Promise<'no-session' | HistoryWrite | 'unchanged'> | Optional: rewrite a session's history as ONE atomic read-modify-write,
so turns appended between the read and the write can't be erased (a
Resolves to the history write (a rewrite, or an append when |
| mutateTurns?deprecated | (sessionId: string, mutate: (turns: SessionTurn[]) => SessionTurn[] | null) => Promise<'no-session' | HistoryWrite | 'unchanged'> | Optional: the turns-only form of Deprecated. Implement |
| patchMeta? | (sessionId: string, patch: Record<string, unknown>) => Promise<void> | Optional: merge |
| save | (session: SessionData) => Promise<HistoryWrite | null> | Save a session (create or update, full document). Bulk overwrite:
turns and runs on disk are replaced by the caller's snapshot, so a
stale snapshot silently discards anything another writer appended.
Neither Resolves to the history write it made, classified against the stored
turns inside the same write: |
| saveMeta? | (session: SessionData, options?: SaveMetaOptions) => Promise<void> | Optional: persist header fields only (agentId, projectRoot, status, metadata, timestamps) plus an UPSERT of the runs present in the snapshot — never deletes turns or runs. This is what metadata writes (title, model, todos, extension state) need. Scope of the guarantee: TURNS appended by a concurrent process survive.
The header itself is still last-writer-wins —
|
| searchTurns? | (lowerTerms: readonly string[], sessionIds: readonly string[]) => Promise<ContentIndexHits | null> | Optional: the turns of |
| turnsAfter | (sessionId: string, afterPos: number, historyId: string, options?: TurnsAfterOptions) => Promise<TurnsAfter | 'gap' | null> | The turns appended after history position |
| updateRun | (sessionId: string, run: SessionRun) => Promise<void> | Persist a run record (called at run start with Upsert semantics required. The agent's run lifecycle calls
Implementations MUST insert when the id doesn't exist and update
when it does. The bundled |
| updateStatus | (sessionId: string, status: 'error' | 'running' | 'completed' | 'idle', options?: { owner?: RunOwner; preserveUpdatedAt?: boolean }) => Promise<void> | Update the top-level status of a session.
|
| upsertArtifact? | (artifact: SessionArtifact) => Promise<SessionArtifact | null> | Optional: record an artifact (see Every artifact method is optional: stores that don't implement them
(file-map, remote, third-party) keep working — |
SessionTurnInterface#
One persisted turn of a session: a user prompt, an assistant response, or a system or command entry.
interface SessionTurnProperties
| Name | Type | Description |
|---|---|---|
| aborted? | true | On a |
| content | SessionContentBlock[] | Content blocks of the turn, in order. |
| createdAt | number | Unix timestamp (Date.now()) when the turn was created |
| display? | string | Display-only replacement for transcript rendering — the full |
| id | string | Unique turn id. Provider-loop turns are minted from AgentClock.randomUUID(). |
| injected? | InjectedTurnReason | Set on a |
| role | 'system' | 'user' | 'assistant' | 'command' | Conversational role, plus |
| runId? | string | Run that produced this turn (e.g. 'run_1') |
| skillGroups? | SkillGroupUse[] | On a |
| systemSnapshot? | SystemPromptSnapshot | On a |
| usage? | TurnUsage | Token usage — only present on assistant turns |
Types#
SessionContentBlockType#
Content block of a session message: text, media, a tool call, a tool result, or thinking.
text, tool_call and thinking blocks can carry a signature: opaque
state the producing API wants back with that block (a Gemini thought
signature, an Anthropic thinking HMAC, OpenAI encrypted reasoning), tagged
with its SignatureProducer. Only that provider's wire builder reads
it; the others map blocks field by field and never send it.
type SessionContentBlock =
| { origin?: TextOrigin; signature?: string; signatureProducer?: GeminiSignatureScope; systemNote?: SystemNote; text: string; type: 'text' }
| { data: string; mediaType: string; name?: string; ref?: never; type: 'image' }
| { data?: never; edge?: number; mediaType: string; name?: string; ref: string; size?: number; type: 'image' }
| { data: string; mediaType: string; name?: string; type: 'audio' }
| { data: string; mediaType: string; name?: string; type: 'video' }
| { data: string; encoding: 'base64' | 'text'; mediaType: string; name?: string; ref?: never; type: 'document' }
| { data?: never; encoding: 'base64' | 'text'; mediaType: string; name?: string; ref: string; size?: number; type: 'document' }
| { id: string; input: Record<string, unknown>; name: string; signature?: string; signatureProducer?: GeminiSignatureScope; type: 'tool_call' }
| { callId: string; calls?: NestedToolCallRecord[]; details?: ToolResultDetails; durationMs?: number; isError?: boolean; metadata?: ToolResultMetadata; outcome?: ToolOutcome; output: string | ToolResultContent[]; settledOrder?: number; type: 'tool_result' }
| { signature?: string; signatureProducer?: SignatureProducer; text: string; type: 'thinking' }
| { data: string; type: 'redacted_thinking' }
| { details: unknown[]; model?: string; producer: 'openrouter'; type: 'provider_reasoning' }
| { model?: string; producer: 'vllm'; reasoningText: string; type: 'provider_reasoning' }
| { id: string; input: Record<string, unknown>; name: string; producer: 'anthropic'; type: 'server_tool_use' }
| { content: unknown; producer: 'anthropic'; toolName: string; toolUseId: string; type: 'server_tool_result' }
| { compactedAt: number; model: string; replacesTurnIds: readonly string[]; summary: string; type: 'compact-summary'; usage: TurnUsage }ThinkingLevelType#
One of the THINKING_LEVELS strings: how much the model reasons before it answers.
type ThinkingLevel = typeof THINKING_LEVELS[number]Re-exports#
These names are documented on the entry point that owns them.
- Agent
- AgentHookMap
- AgentHooks
- AgentOptions
- CacheBreakInfo
- CacheBreakLoggerOptions
- CacheDimensionDiff
- CacheDimensionName
- CacheDimensionSnapshot
- CacheDriftInfo
- CachePromptSections
- CacheSystemSection
- createRunSummaryCollector
- diffCacheDimensions
- hashMessages
- installCacheBreakLogger
- McpConnector
- McpToolMeta
- McpToolWrap
- RunSummary
- RunSummaryBlock
- RunSummaryBudget
- RunSummaryByModel
- RunSummaryCollector
- RunSummaryCollectorOptions
- RunSummaryError
- RunSummaryRepeatGuard
- RunSummaryTokens
- RunSummaryValidation
- snapshotCacheDimensions