Skip to main content

@flow-state-dev/core/types

Interfaces​

AcrossSessionsCollection​

One collection read across the owner's sessions.

Type Parameters​

TState​

TState extends JsonObject = JsonObject

Methods​

list()​
list(query?): Promise<AcrossSessionsPage<TState>>;

One page of the collection's entries, ordered by session, then by path. Pass the previous page's next as after for the next one; the listing ends only when next is absent. A page can be short, even empty, while next is set: entries of a session the caller isn't answered are read and dropped.

Parameters​
query?​

AcrossSessionsListQuery

Returns​

Promise<AcrossSessionsPage<TState>>

Throws​

When where.index names an index the collection doesn't declare.


AuthenticationConfig​

Per-flow authentication config. Hosts compose their own resolvePrincipal function inside defineFlow; the framework wires it into the principal resolution path for every inbound transport.

defineFlow({
kind: "billing",
authentication: {
resolvePrincipal: async (ctx) => readSession(ctx.request),
requireUser: true
}
});

requireUser: false is incompatible at build time with user-scope state, user-scope clientData, and any user-scoped resource (block-declared or flow-level) — the framework throws at registration with a clear error naming the offending field.

A resolver must return a verified orgId: organization identity is unconditional.

Properties​

defaultUserId?​
defaultUserId?: string;

Substituted when resolvePrincipal returns no userId. Useful for machine-driven transports (webhooks, schedules) that have no end user — the host names a system principal once and the framework fills it in.

requireUser?​
requireUser?: boolean;

When true (default), the framework rejects requests that don't yield a userId after defaultUserId fallback. When false, the flow opts out of user-scope identity entirely; user-scope state, clientData, and resources are forbidden at build time.

resolvePrincipal?​
resolvePrincipal?: ResolvePrincipalFn;

Called once per inbound request after the adapter constructs the principal-resolution context. Return the caller's principal, a partial { userId?, orgId? }, or null.


BindingCacheOptions​

Configuration for BindingProvider caching behavior.

Type Parameters​

TBinding​

TBinding

Properties​

maxSize?​
maxSize?: number;

Maximum number of cached bindings (LRU eviction).

onEvict?​
onEvict?: (key, binding) => void;

Called when an entry is evicted (TTL, LRU, or explicit release).

Parameters​
key​

string

binding​

TBinding

Returns​

void

provider​
provider: BindingProvider<TBinding>;

The underlying provider that creates/reconstructs bindings.

ttlMs?​
ttlMs?: number;

Time-to-live in milliseconds. Entries expire after this duration of inactivity.


BindingProvider​

BindingProvider — contract for obtaining live SDK bindings from persisted identity keys.

External agent SDKs (Claude Code SDK, Gemini, etc.) maintain runtime state that cannot be serialized into session state. BindingProvider bridges the gap: blocks persist an external session ID in session state, then use a provider to reconstruct or retrieve a live binding on subsequent requests.

Example​

const provider: BindingProvider<ClaudeSession> = {
resolve: async (key) => new ClaudeSession({ sessionId: key }),
release: async (key) => { // optional cleanup },
};

// Inside a handler block:
const session = await provider.resolve(ctx.session.state.externalSessionId);

Type Parameters​

TBinding​

TBinding

Methods​

release()?​
release?(key): Promise<void>;

Release a binding when it is no longer needed. Called on explicit cleanup, TTL eviction, or process shutdown.

Parameters​
key​

string

Returns​

Promise<void>

resolve()​
resolve(key): Promise<TBinding>;

Obtain or reconstruct a binding from a persisted key.

Must be idempotent: calling resolve() twice with the same key should return equivalent bindings (or the same cached instance).

Parameters​
key​

string

Returns​

Promise<TBinding>


BlockCacheableConfig​

Per-tool memoization config. See BlockConfig.cacheable.

Cache writes happen after the tool returns successfully. Errors are never cached. Within a request, identical concurrent calls share one in-flight execution (single-flight). Cross-request concurrent calls each execute; last writer wins for the cache entry.

Properties​

cacheIf?​
cacheIf?: (output, input) => boolean;

Predicate gating which results are cacheable. Receives the resolved output; return true to store, false to skip. Errors are never cached regardless of this predicate. Useful for tools that return a structured "no result" envelope that shouldn't poison the cache. Default: cache every successful result.

Parameters​
output​

unknown

input​

unknown

Returns​

boolean

keyFn?​
keyFn?: (input, ctx) => string;

Custom key derivation. Receives the tool's input and ctx; returns a deterministic string. Defaults to JSON.stringify(canonicalize(args)) with recursive object-key sorting. Override when args carry irrelevant fields (timestamps, request ids) that should be excluded from the key.

Parameters​
input​

unknown

ctx​

BlockContext

Returns​

string

scope?​
scope?: "request" | "session" | "run";

Cache scope, controlling how widely a cached entry is reused:

  • "run" (default): one Task Board run. Entries are dropped when the outer board exits.
  • "request": the lifetime of the current request.
  • "session": persists across requests within a session. Carries the most leakage risk — only use when arguments unambiguously identify the tenant.
ttl?​
ttl?: number;

TTL in milliseconds. Omit to use the cache's default (board-level or the framework default of 5 minutes). 0 disables caching and emits a dev-mode warning.


BlockConfig​

Type Parameters​

TInputSchema​

TInputSchema extends ZodTypeAny = ZodTypeAny

TOutputSchema​

TOutputSchema extends ZodTypeAny = ZodTypeAny

TInput​

TInput = z.infer<TInputSchema>

TOutput​

TOutput = z.infer<TOutputSchema>

Properties​

activeStatusMessage?​
activeStatusMessage?: string | ((input, ctx) => string);

Active status message for this block — declarative sugar for ctx.emit.status() at block start. A static string is emitted once when the block enters execution; a function receives (input, ctx) and its return value is emitted. Use direct ctx.emit.status() only when a block needs to update status mid-execution (e.g. per-file progress).

cacheable?​
cacheable?: true | BlockCacheableConfig;

Opt-in tool-result memoization. When set, and when this block is installed as a tool on a generator, the framework caches the tool's output keyed on (toolName, canonicalize(args), scope) and serves repeat calls from the cache. Errors are never cached. Identical concurrent calls within a request are coalesced (single-flight).

Pass true for cache-everything defaults, or an object to tune TTL, scope, key derivation, and a cacheIf predicate.

No effect when the block is used outside a generator's tool slot.

connectInput?​
connectInput?: ConnectorFn<unknown, TInput>;
container?​
container?: object;
component?​
component?: string;
label?​
label?: string | ((input) => string);
metadata?​
metadata?:
| Record<string, unknown>
| ((input) => Record<string, unknown>);
description?​
description?: string;
execute?​
execute?: (input, ctx) => TOutput | Promise<TOutput>;
Parameters​
input​

TInput

ctx​

BlockContext

Returns​

TOutput | Promise<TOutput>

flowConfigSchema?​
flowConfigSchema?: ZodTypeAny;

What this block requires of whatever flow installs it: a Zod schema the flow's create-time config bag must satisfy.

The block names no flow, so it stays portable — the requirement bubbles up through defineFlow's block walk and the FLOW refuses if it cannot meet it: at definition time when the flow declares no configSchema at all, and at the mint of each copy whose bag does not parse against this schema. It also types ctx.flow.config.

Distinct from defineFlow({ configSchema }), which declares what the bag IS and parses and freezes it. The two coexist; neither replaces the other, and they buy different things: that one is the bag, this one is block portability. The generic plumbing this slot needs on every block kind is the price of the second — see FlowDefinition.configSchema for the split.

Declared on every block kind — a sequencer's connectors and taps read ctx.flow.config like anything else.

inputSchema?​
inputSchema?: TInputSchema;
name​
name: string;
onCompleted?​
onCompleted?: (output, ctx) => void | Promise<void>;
Parameters​
output​

TOutput

ctx​

BlockContext

Returns​

void | Promise<void>

onErrored?​
onErrored?: (error, ctx) => void | Promise<void>;
Parameters​
error​

Error

ctx​

BlockContext

Returns​

void | Promise<void>

outputSchema?​
outputSchema?: TOutputSchema;
rescue?​
rescue?: RescueHandlerSpec[];

Per-block rescue handlers. When this block's execution throws a non-SuspensionError, the first handler whose when matches runs with the block's own scoped context — so it can read sequencer state — and its output replaces the throw, letting the enclosing chain / fan-out continue. Set via block.rescue([...]). Sequencers handle their own chain-level rescue in the operation loop and do not use this field.

retry?​
retry?: RetryPolicy;
stateSchema?​
stateSchema?: ZodTypeAny;
transient?​
transient?: boolean;
validateChunk?​
validateChunk?: (input, ctx) =>
| ChunkValidation
| Promise<ChunkValidation>;
Parameters​
input​

TInput

ctx​

BlockContext

Returns​

| ChunkValidation | Promise<ChunkValidation>


ChunkValidation​

Properties​

action​
action: "replace" | "allow" | "drop" | "abort";
reason?​
reason?: string;
replacement?​
replacement?: unknown;

GeneratorModelResultPayload​

One model result as onGeneratorModelResult reports it.

Properties​

countsIn?​
countsIn?: "ledger" | "trace";

Where this report counts. Absent: both on the reporting block's trace row and in the request's spend ledger, as one model call. "ledger": the ledger only. A finished step of a multi-step run, counted when the step ends so a run that later suspends or fails keeps it; or an evaluator called as a tool, which must not overwrite its caller's row. "trace": the trace row only. A multi-step run's aggregate, whose steps the ledger already counted. A capture that records the row ignores "ledger" reports and forwards every report.

identity?​
identity?: ModelIdentity;

Resolved identity of the model that produced this result.

model​
model: string;
providerMetadata?​
providerMetadata?: Record<string, Record<string, unknown>>;
usage?​
usage?: GeneratorModelUsage;

InitialSkill​

A code-authored skill, seeded into the org-scoped collection on startup.

Properties​

files?​
files?: SkillFile[];

Optional supporting files written alongside SKILL.md.

name​
name: string;

Skill name — the folder name. Same rules as Skill.name.

skillMd​
skillMd: string;

Full SKILL.md text including YAML frontmatter.


InternalServiceRoute​

What makes an internal entry a service route: the provider it routes as. See InternalEntry.service.

Properties​

provider​
readonly provider: string;

The provider key the route runs as (service:<provider>) and the event's provider.

Methods​

senderName()?​
senderName?(state): string | undefined;

The sender's name, read by the host from the dispatching session's own stored state (a worker's id). Absent, or answering nothing, the name is the sending flow's kind. Never the payload's.

Parameters​
state​

Readonly<Record<string, unknown>>

Returns​

string | undefined


MatchedSkill​

One skill matched by a skill-activation pass. Multiple may be active per turn — the up-front skill activator activates all of them in inline mode by default.

Properties​

confidence?​
confidence?: number;

Classifier confidence (0..1). Only present when source === "classifier".

input​
input: string;

Argument substituted for $ARGUMENTS in the skill body. Empty if none.

name​
name: string;

Skill name. Must exist in the skills collection at activation time.

source​
source: SkillActivationSource;

Which tier of skillActivator produced this match.


NamedSessionResourceRef​

Another session's single resource, as ctx.resources.at({ session }).<name> hands it out. The verbs of ResourceRef, each returning a Promise, since every one waits on that session's admission first; the state, a property on the run's own handle, is read with readState(). A session the caller may not reach rejects every verb with SessionNotFoundError, as an id no one holds does.

Type Parameters​

TState​

TState extends JsonObject = JsonObject

Properties​

config​
readonly config: Readonly<ResourceConfig>;
path​
readonly path: string;

The storage path in that session, as ResourceRef.path names it.

scope​
readonly scope: "session";

Methods​

getOrPatchState()​
getOrPatchState<K>(key, compute): Promise<TState[K]>;
Type Parameters​
K​

K extends string

Parameters​
key​

K

compute​

() => TState[K] | Promise<TState[K]>

Returns​

Promise<TState[K]>

See​

ResourceRef.getOrPatchState

incState()​
incState(increments): Promise<void>;
Parameters​
increments​

ResourceIncrements<TState>

Returns​

Promise<void>

See​

ResourceRef.incState

patchState()​
patchState(updates): Promise<void>;
Parameters​
updates​

Partial<TState>

Returns​

Promise<void>

pushState()​
pushState<K>(field, value): Promise<void>;
Type Parameters​
K​

K extends string

Parameters​
field​

K

value​

ResourceArrayElement<TState[K]>

Returns​

Promise<void>

See​

ResourceRef.pushState

readContent()​
readContent(): Promise<string | null>;
Returns​

Promise<string | null>

readContentRaw()​
readContentRaw(): Promise<string | null>;
Returns​

Promise<string | null>

readState()​
readState(): Promise<Readonly<TState>>;

The resource's state in that session: its declared default when it holds none.

Returns​

Promise<Readonly<TState>>

setState()​
setState(nextState): Promise<void>;
Parameters​
nextState​

TState

Returns​

Promise<void>

updateState()​
updateState(updater): Promise<void>;
Parameters​
updater​

(state) => TState | Promise<TState>

Returns​

Promise<void>

writeContent()​
writeContent(content): Promise<void>;
Parameters​
content​

string

Returns​

Promise<void>


PrincipalResolutionContext​

Context passed to ResolvePrincipalFn. request is set for HTTP-shaped transports; non-HTTP transports use envelope and rawBody.

envelope is intentionally a structural subset of the inbound envelope shape — the auth resolver runs before dispatch and so should not depend on stream emitters or signal semantics carried by the full envelope.

Properties​

envelope​
envelope: object;
action​
action: string;
flowKind​
flowKind: string;
input​
input: unknown;
metadata?​
metadata?: Record<string, unknown>;
sessionId?​
sessionId?: string;
rawBody?​
rawBody?: Uint8Array<ArrayBufferLike>;

Raw HTTP body bytes, preserved by HTTP-shaped adapters for adapters that need pre-parse access (webhook signature verification).

request?​
request?: Request;

Native HTTP request, when the transport is HTTP-shaped.

source​
source: string;

ProjectedResourceCollectionRef​

Runtime ref for a projected collection — the read subset of the collection API. defineProjectedResourceCollection resolves to this (not the mutable ResourceCollectionRef) through the resource-inference conditionals.

Exposes get / getOptional, the paged list, and the identity/config fields. There is deliberately no count() — an exact count would need forbidden enumeration of the app store (§3.3).

Type Parameters​

TState​

TState extends JsonObject = JsonObject

Properties​

config​
readonly config: Readonly<{
llmReadable?: boolean;
pattern: string;
scope: ResourceScope;
}>;

The resolved projected config (minus the backing hooks).

pattern​
readonly pattern: string;

The collection's declared pattern.

projected​
readonly projected: true;

The brand the tool/inference layers classify on.

scope​
readonly scope: ResourceScope;

Scope this collection is registered in.

Methods​

get()​
get(key): Promise<ProjectedResourceRef<TState>>;

Resolve one instance by its within-scope key. Rejects if the app has no such record.

Parameters​
key​

string

Returns​

Promise<ProjectedResourceRef<TState>>

getOptional()​
getOptional(key): Promise<ProjectedResourceRef<TState> | undefined>;

Resolve one instance, or undefined when the app has no such record.

Parameters​
key​

string

Returns​

Promise<ProjectedResourceRef<TState> | undefined>

list()​
list(query?): Promise<{
items: ProjectedResourceRef<TState>[];
nextCursor?: string;
}>;

List a page of instances by pushing the query DOWN to the app's search hook (never enumerate-in-memory). A bare string is shorthand for { search }. Returns app-ranked hits resolved to read-only refs plus the app's opaque nextCursor (absent when the result set is exhausted); pass it back as query.cursor for the next page.

Parameters​
query?​

string | ResourceQuery

Returns​

Promise<{ items: ProjectedResourceRef<TState>[]; nextCursor?: string; }>


ProjectedResourceRef​

A read-only resource instance ref resolved from a projected collection. The read subset of ResourceRef only — state (synchronous, resolved against the filled read-through cache), readContent() / readContentRaw(), and identity fields. No patchState / setState / updateState / writeContent: a projected record is a read-through view, never written through the resource surface.

Type Parameters​

TState​

TState extends JsonObject = JsonObject

Properties​

config?​
readonly config?: Readonly<{
llmReadable?: boolean;
}>;

The owning collection's read flag, as a store-backed instance ref carries its collection's config.

path​
readonly path: string;

Canonical within-scope storage path (pattern-normalized), e.g. "positions/AAPL".

scope​
readonly scope: ResourceScope;
state​
readonly state: Readonly<TState>;

The record state (validated through stateSchema). Synchronous.

uri​
readonly uri: string;

Fully qualified identifier — ${scope}/${path}.

Methods​

readContent()​
readContent(): Promise<string | null>;

Rendered content (template applied to state), or null when none.

Returns​

Promise<string | null>

readContentRaw()​
readContentRaw(): Promise<string | null>;

Un-rendered content source, or null when none.

Returns​

Promise<string | null>


RescueHandlerSpec​

Properties​

block​
block: BlockDefinition<any, any>;
when?​
when?: (new (...args) => Error)[];
Parameters​
args​

...any[]

Returns​

Error


ResolvedPrincipal​

Resolved caller principal stamped onto every dispatched envelope. The runtime treats the userId here as authoritative for state-scope routing, and the orgId as the authoritative organization boundary for everything the resulting session goes on to create, read or dispatch.

orgId is required. A caller-supplied organization never reaches this type: the value here came from a configured resolver's verified principal, or is DEFAULT_ORG_ID for an app that configures none. Body, query, header and metadata organization fields cannot override it.

requireUser: false flows may produce a principal with no userId so long as no user-scope state, clientData, or resources are declared. The host is then expected to provide a defaultUserId for the runtime path that still expects an identity (e.g., RequestRecord.userId).

Properties​

orgId​
orgId: string;
userId​
userId: string;

ResourceRef​

Type Parameters​

TState​

TState extends JsonObject = JsonObject

Properties​

config​
config: Readonly<ResourceConfig>;
contentType?​
contentType?: string;
edges?​
edges?: ResourceEdgeApi;

Typed-edge graph API — present at runtime only when the resource declared edges. Consumers that declared edges access it via ref.edges!.

extension?​
extension?: string;
path​
path: string;

Canonical within-scope storage path for this resource — what state and content are persisted under. Equal to the accessor key for normal single resources, the path-derived key (e.g. "memos/p1/foo") for collection instances, and the canonicalized key for dual-registered aliases. Not necessarily the accessor name used to look up the handle.

scope​
scope: ScopeType;
state​
state: Readonly<TState>;
uri​
uri: string;

Fully qualified identifier — ${scope}/${path}. Stable and unique across scopes within a flow. Opaque: do not feed to new URL() — it is not an RFC-3986 URI, just a debug/logging/cross-scope-addressing handle.

Methods​

getOrPatchState()​
getOrPatchState<K>(key, compute): Promise<TState[K]>;

Get-or-compute over this resource's state. Reads state[key]; if it is absent (undefined), runs compute, patches the returned value under key, and returns it. The callback runs only on a miss, so an expensive fetch/compute happens at most once per stored key for this resource's lifetime — and downstream readers get the same stored copy without re-deriving it. A value already present (including null) is a hit and is returned without invoking compute; a compute that resolves to undefined stores nothing and the next call recomputes.

No time-based freshness: this is a per-resource (e.g. per-session) data spine, not a cache. The runtime ref single-flights concurrent misses on the same key within a request — they share one compute call rather than each firing its own — so a fanned-out read of the same key issues one upstream fetch. (Distinct keys still compute in parallel; they never block each other.)

Type Parameters​
K​

K extends string

Parameters​
key​

K

compute​

() => TState[K] | Promise<TState[K]>

Returns​

Promise<TState[K]>

incState()​
incState(increments): Promise<void>;

Add to number-valued state fields — incState({ calls: 1 }) — without reading, changing and writing the state back yourself.

Atomic per write, and no faster. Each call is a single guarded mutation: a write that loses a race re-runs against the winner's stored row rather than committing a value computed from a snapshot that has since moved, so two callers incrementing one counter both land. That holds on the memory, SQLite and Postgres stores. The filesystem store guards a record's read-check-write with a per-id in-process lock, so two processes over one directory can still lose an increment. Concurrent writers still retry — the gain is expressing the intent, not throughput.

Refuses rather than corrupts. Incrementing a field that holds something other than a number fails and leaves the stored value alone. An absent or null field is that field's empty state, not a wrong kind of value: it starts from 0. A result that is not finite is also refused — two finite operands can overflow to Infinity, which z.number() accepts but the stores disagree about how to persist.

Applies wholly or not at all: if one field of a multi-field call is wrong-typed, nothing is written.

Parameters​
increments​

ResourceIncrements<TState>

Returns​

Promise<void>

patchState()​
patchState(updates): Promise<void>;
Parameters​
updates​

Partial<TState>

Returns​

Promise<void>

pushState()​
pushState<K>(field, value): Promise<void>;

Append one value to an array-valued state field — pushState("errors", "rate_limited").

Same single-guarded-write atomicity and adapter scope as ResourceRef.incState. Appending to a field that holds something other than a list refuses and leaves the stored value alone; an absent or null field starts from [].

Type Parameters​
K​

K extends string

Parameters​
field​

K

value​

ResourceArrayElement<TState[K]>

Returns​

Promise<void>

readContent()​
readContent(): Promise<string | null>;
Returns​

Promise<string | null>

readContentRaw()​
readContentRaw(): Promise<string | null>;
Returns​

Promise<string | null>

setState()​
setState(nextState): Promise<void>;
Parameters​
nextState​

TState

Returns​

Promise<void>

updateState()​
updateState(updater): Promise<void>;
Parameters​
updater​

(state) => TState | Promise<TState>

Returns​

Promise<void>

writeContent()​
writeContent(content): Promise<void>;
Parameters​
content​

string

Returns​

Promise<void>


ResponseEmitterHandle​

Methods​

emit()​
emit(event): void | Promise<void>;
Parameters​
event​

unknown

Returns​

void | Promise<void>

getItemCount()​
getItemCount(): number;

O(1) next-itemIndex cursor for this response: its starting index plus every item it has tracked, including done transient items getItems() no longer retains, so it never moves backwards or reissues an index. Used on the per-emit hot path to assign sequential itemIndex values.

Returns​

number

getItems()​
getItems(): readonly RuntimeItem[];

Snapshot of the items emitted to this response so far, in stream order. Used by sequencer ops (e.g. .waitForCondition) to evaluate predicates over already-flushed items before subscribing for future ones. Every non-transient and in-progress item is included; of the done transient items, only the most recent maxBufferSize (default 10,000) are retained.

Returns​

readonly RuntimeItem[]

subscribeToItems()​
subscribeToItems(listener, options?): () => void;

Subscribe to subsequent item lifecycle transitions on this response. kind distinguishes the underlying mutation: "added" for a freshly emitted item, "updated" for an in-place mutation, "done" for a terminal status. Returns an unsubscribe function — callers must invoke it to release the listener (typically inside a finally).

When options.filter is provided, the listener fires only for items the filter returns true for. The filter is evaluated per-event, per-listener; non-matching events skip the listener invocation entirely. Use filter to reduce wake-cost when many subscribers share an emitter and most events are uninteresting to most subscribers.

Filter exceptions are caught at the emitter boundary, logged via a response.subscribeToItems.filter_threw debug event, and the listener STILL FIRES (fail-open). A filter that throws is a caller bug; treating the throw as "skip" would silently mask the bug and surface only as a .waitForCondition timeout. Filters MUST be cheap and SHOULD NOT throw.

Parameters​
listener​

(item, kind) => void

options?​
filter?​

(item, kind) => boolean

Returns​

() => void


ResumeContext​

Properties​

action​
action: ResumeAction;
data?​
data?: unknown;
pendingBlockLogicalId?​
pendingBlockLogicalId?: string;

Logical block path (${requestId}:${path}) of the suspension being resolved. ctx.suspend() matches on it so only the resolving gate returns the resume payload (or throws on reject); every other gate reached during the same replay re-suspends normally. Set by the server at re-entry from the ReplayLog's pendingSuspension(), overwriting any supplied value; a resolution without it matches no gate.

resolution?​
resolution?: SuspensionStatus;

How this resume resolves the gate, when that is not the action's own status; the suspension_resume audit item records it. Set by the server at re-entry, overwriting any supplied value: the gate's recorded status (a stopped ask), or expired when this reject is the engine's own continuation of an approval that passed its expiresAt unanswered (the durability sweep's re-drive, or a stop of a turn behind one). Only that continuation can name an expiry, never the gate's status, which an expiry write can race. With expired, ctx.suspend() throws a SuspensionRejectedError marked expired. cancelled is read from the gate's recorded status: ctx.suspend() throws a SuspensionRejectedError marked cancelled.

resumedBy?​
resumedBy?: string;
suspensionId​
suspensionId: string;
userSuspension?​
userSuspension?: boolean;

Set by the server at re-entry, overwriting any supplied value: whether the suspension being resolved waits for a user (isUserSuspension).


RetryPolicy​

Properties​

baseDelayMs?​
baseDelayMs?: number;
maxAttempts?​
maxAttempts?: number;
maxDelayMs?​
maxDelayMs?: number;
retryableErrors?​
retryableErrors?: (new (...args) => Error)[];
Parameters​
args​

...any[]

Returns​

Error


RunSkillInput​

Input the agent passes when invoking the runSkill tool.

Properties​

input?​
input?: string;

Optional argument string. Substituted for $ARGUMENTS in the body.

name​
name: string;

Name of the skill to invoke. Must appear in the runSkill tool enum.


RunSkillOutput​

Output the runSkill tool returns to the agent.

Properties​

message?​
message?: string;

Ack message; the agent should re-read context on the next step.

mode​
mode: "inline";

Mode the skill ran in. Always "inline".

skill​
skill: string;

The skill name that was invoked.


SequencerCheckpoint​

Durable sequencer checkpoint record.

Latest-only persistence: identity is (requestId, blockInstanceId). Each step boundary overwrites the prior record with the new state and an incremented version. The Phase 2 resume runtime reads the latest checkpoint to pick up where an interrupted request left off.

No stepHistory field. The optional persistFullHistory mode is a Wave 2+ extension (out of scope here).

Properties​

blockInstanceId​
blockInstanceId: string;

Deterministic block instance id. Stable across retries/resumes.

createdAt​
createdAt: number;

Wall-clock timestamp at write time.

parentBlockInstanceId​
parentBlockInstanceId: string | null;

Parent sequencer's instance id when this is a nested sequencer; null at the root.

requestId​
requestId: string;

Request whose execution produced this checkpoint.

state​
state: unknown;

Sequencer state at this boundary; validated against the sequencer's stateSchema at write time.

stepIndex​
stepIndex: number;

0-indexed step that produced this state. -1 denotes the initial pre-execution snapshot.

suspensionId?​
suspensionId?: string;

The wait this was written at, when written as a suspension passed through the sequencer: state then holds the waiting step's writes before that wait, and a resume settles the re-run's state to it when the re-run reaches that same wait. Absent on a step-boundary checkpoint, and on one written before this field existed: a resume then leaves the waiting step's re-run writes as they are.

version​
version: number;

Monotonic write counter, incremented on each overwrite for the same (requestId, blockInstanceId).


Skill​

Resolved skill descriptor — combines parsed frontmatter, the SKILL.md body, and the name derived from the parent directory.

Properties​

allowedTools?​
allowedTools?: string[];

From frontmatter allowed-tools.

argumentHint?​
argumentHint?: string;

From frontmatter argument-hint.

body​
body: string;

SKILL.md body (without frontmatter).

compatibility?​
compatibility?: string;

From frontmatter compatibility.

contextMode?​
contextMode?: "inline";

From frontmatter context:. Default "inline".

description​
description: string;

From frontmatter.

disableModelInvocation?​
disableModelInvocation?: boolean;

From frontmatter disable-model-invocation.

keywords?​
keywords?: string[];

From frontmatter keywords. Lowercase tokens for tier-2 intent matching.

license?​
license?: string;

From frontmatter license.

metadata?​
metadata?: Record<string, string>;

From frontmatter metadata.

name​
name: string;

Skill name = parent directory name. 1–64 chars of lowercase a-z, 0-9 and single hyphens, never at the start or end (the Agent Skills rule).

whenToUse?​
whenToUse?: string;

From frontmatter when_to_use. Appended to runSkill tool description.


SkillFile​

A single supporting file within a skill folder.

Properties​

content​
content: string;

File contents.

path​
path: string;

Path relative to the skill folder root (e.g. "reference/foo.md").


SkillsCollectionMeta​

Internal seeding metadata stored at {collectionPrefix}/_meta.

Properties​

seededNames​
seededNames: string[];

Names already seeded. New initialSkills entries with names not in this list are seeded on the next hydrate; deletions persist (a name stays in this list even after the user deletes the folder).


SkillState​

Parsed state for a skills/{name}/SKILL.md resource. Derived from the file's YAML frontmatter (kebab-case) and stored on the resource as camelCase. Unknown frontmatter keys are preserved on _preservedFields for forward-compatibility and round-trip fidelity.

Properties​

_preservedFields?​
_preservedFields?: Record<string, unknown>;

Unknown kebab-case frontmatter keys preserved as camelCase for round-trip.

_seededAt?​
_seededAt?: string;

ISO timestamp set by the seeder when an initialSkills entry was first written.

allowedTools?​
allowedTools?: string[];

From allowed-tools. The tools the skill is written around. It never widens access, and it decides nothing. It registers nothing: createSkillsLibrary validates these names against the catalog and then contributes the whole catalog, or, under registerCatalogTools: false, contributes none of it. Either way this subset is not the unit. What the generator may call is its own tools: when it declares one (declaring it at all raises the fence) and otherwise whatever its capabilities contribute.

argumentHint?​
argumentHint?: string;

Optional Claude argument-hint. Surfaced in tool description; not validated at runtime.

compatibility?​
compatibility?: string;

Optional spec compatibility: environment requirements, ≤500 chars.

contextMode?​
contextMode?: "inline";

From context: frontmatter. Defaults to inline when omitted.

description​
description: string;

Required. Used in the runSkill tool description and (truncated) in <ActiveSkills> UI.

disableModelInvocation?​
disableModelInvocation?: boolean;

From disable-model-invocation. When true, skill is excluded from runSkill tool enum.

keywords?​
keywords?: string[];

Optional keywords array. Lowercase tokens that the up-front intent classifier's tier-2 keyword scan matches against the user message. Skills without any keywords skip tier-2 and become eligible only via tier-3 LLM classification.

license?​
license?: string;

Optional spec license: a license name or the name of a bundled license file.

metadata?​
metadata?: Record<string, string>;

Optional spec metadata: a string → string map for client-defined properties.

name?​
name?: string;

Optional name frontmatter (required by the Agent Skills spec). The framework derives a skill's identity from its folder; when the manifest also declares name, it must be valid and match the folder it lives in.

whenToUse?​
whenToUse?: string;

Optional Claude when_to_use. Appended to description for runSkill tool surface.


StateContainer​

In-request state cache used by the CAS retry loop.

The container holds the last-known state and version for a scope within a single request so repeated reads don't re-hit the underlying store. It no longer enforces CAS — the store's set(expectedVersion) contract does that. The container is refreshed on both successful writes and write conflicts so its view stays consistent with the store.

Type Parameters​

TState​

TState = unknown

Methods​

commit()​
commit(nextState, version): Readonly<TState>;

Replace the cached state and version. Called after a successful CAS write (with the new version) and after a conflict (with the store's current value/version so the next retry starts from the true current state).

Parameters​
nextState​

TState

version​

number

Returns​

Readonly<TState>

getVersion()​
getVersion(): number;
Returns​

number

read()​
read(): Readonly<TState>;
Returns​

Readonly<TState>


SuspendForUser()​

ctx.suspendForUser: stop the request until the user answers (see the module header).

Call Signature​

SuspendForUser(options): Promise<ApprovalAnswer>;

ctx.suspendForUser: stop the request until the user answers (see the module header).

Parameters​
options​

SuspendForUserOptions<"approval">

Returns​

Promise<ApprovalAnswer>

Call Signature​

SuspendForUser<T>(options): Promise<UserAnswer<T>>;

ctx.suspendForUser: stop the request until the user answers (see the module header).

Type Parameters​
T​

T = unknown

Parameters​
options​

SuspendForUserOptions<"review" | "input">

Returns​

Promise<UserAnswer<T>>


SuspendForUserContext​

What suspendForUserOn reads off the context. The host's deadline for a user's stop is read with requestHostOf, so this public type names no host.

Methods​

suspend()?​
suspend?(options): Promise<unknown>;
Parameters​
options​

SuspendOptions

Returns​

Promise<unknown>


SuspendForUserOptions​

What SuspendForUser takes.

Type Parameters​

K​

K extends SuspendForUserKind = SuspendForUserKind

Properties​

data?​
readonly data?: Record<string, unknown>;

Context the screen shows beside the prompt.

deadline?​
readonly deadline?: number;

How long the stop waits, in milliseconds from the call. Omit it and the host's setting for a user's stop applies; with none, it waits until answered, stopped or cancelled.

kind​
readonly kind: K;

What the stop asks for.

prompt​
readonly prompt: string;

What the user is asked, shown where they answer it. May be markdown.

render?​
readonly render?: object;

A component a screen renders the stop with.

component​
component: string;
props?​
props?: Record<string, unknown>;
resumeSchema?​
readonly resumeSchema?: ZodTypeAny | Record<string, unknown>;

The shape of the answer, checked when it is given (a Zod schema or a JSON Schema). For an approval it checks the optional data sent with a yes.

title?​
readonly title?: string;

A short heading, a few words, when the prompt is longer than one line.


SuspensionFilter​

Properties​

createdBefore?​
createdBefore?: number;

Match records whose createdAt is strictly less than this timestamp (ms).

flowKind?​
flowKind?: string;
limit?​
limit?: number;
resolvedBefore?​
resolvedBefore?: number;

Match records that have a non-null resolvedAt strictly less than this timestamp (ms). Records with no resolvedAt never match.

sessionId?​
sessionId?: string;
status?​
status?: SuspensionStatus;
userId?​
userId?: string;

SuspensionRecord​

Properties​

actionName​
actionName: string;
allow?​
allow?: ResumeAction[];

The resolution actions this suspension permits. The resume route rejects an inbound action outside this set (409), and renderers read it to decide which controls to show (e.g. a Skip button appears iff "skip" is present). When absent — including on records persisted before this field existed — the suspension is treated as binary ["approve", "reject"] for back-compat.

blockInstanceId​
blockInstanceId: string;
createdAt​
createdAt: number;
data?​
data?: Record<string, unknown>;
expiresAt?​
expiresAt?: number;
flowId?​
flowId?: string;

The flow instance that owns the suspended run — the address a resume must re-enter it through. Two copies of one kind suspend independently, so the kind alone does not say which one is waiting. Absent on a record persisted before owners were recorded; guard with == null, falling back to flowKind, which is the correct address for a singleton and the only one such a record ever had.

flowKind​
flowKind: string;
kind?​
kind?: SuspendForUserKind;

What a user's suspension asks for, when ctx.suspendForUser set it. Absent on a raw ctx.suspend and on every other suspension: read it with suspendForUserKindOf, which falls back to the reason.

message​
message: string;
reason​
reason: SuspensionReason;
render?​
render?: object;
component​
component: string;
props?​
props?: Record<string, unknown>;
requestId​
requestId: string;
resolvedAt?​
resolvedAt?: number;
resolvedBy?​
resolvedBy?: string;
resumeData?​
resumeData?: unknown;
resumeSchema?​
resumeSchema?: Record<string, unknown>;

JSON Schema describing the expected resume payload shape. Generated from the Zod schema passed to ctx.suspend({ resumeSchema }). Stored as JSON Schema (not a Zod instance) so suspension records are serializable across processes.

sessionId?​
sessionId?: string;
status​
status: SuspensionStatus;
stepIndex​
stepIndex: number;
stepInput?​
stepInput?: unknown;

The input value that was about to be passed to the step that suspended.

suspensionId​
suspensionId: string;
title?​
title?: string;

The suspension's short heading; message is then its body. Absent when the suspension gave none, including every record persisted before it existed: a reader falls back to message.

userId​
userId: string;

Type Aliases​

AcrossSessions​

type AcrossSessions<TResources> = { [K in keyof TResources as NonNullable<TResources[K]> extends ResourceCollectionRef<any, any> ? K : never]: NonNullable<TResources[K]> extends ResourceCollectionRef<infer TState, any> ? AcrossSessionsCollection<TState> : never };

The collections ctx.resources.acrossSessions() reads, by the registry's accessors.

Type Parameters​

TResources​

TResources extends Record<string, AnyResourceRef>


AcrossSessionsEntry​

type AcrossSessionsEntry<TState> = object;

One entry read across sessions: the session it belongs to, its path there, and its state.

Type Parameters​

TState​

TState extends JsonObject = JsonObject

Properties​

key​
readonly key: string;

The entry's storage path in that session, as ResourceRef.path names it.

session​
readonly session: string;

The session's id, as ctx.resources.at({ session }) takes it.

value​
readonly value: Readonly<TState>;

AcrossSessionsListQuery​

type AcrossSessionsListQuery = object;

What list reads: after a page's cursor, and filtered by the entry's key (its path, one row a session) or by a declared index's value. No other filter: a field filters only through an index the collection declares.

Properties​

after?​
after?: string;

The next of the previous page, as it was handed back.

where?​
where?:
| {
key: string;
}
| {
index: string;
value: ResourceIndexValue;
};

AcrossSessionsPage​

type AcrossSessionsPage<TState> = object;

One page of AcrossSessionsCollection.list.

Type Parameters​

TState​

TState extends JsonObject = JsonObject

Properties​

entries​
readonly entries: readonly AcrossSessionsEntry<TState>[];
next?​
readonly next?: string;

An opaque cursor, while more entries may remain. It names no entry.


ActionFieldSchema​

type ActionFieldSchema = object;

Properties​

default?​
default?: unknown;
description?​
description?: string;
enumValues?​
enumValues?: string[];
fields?​
fields?: Record<string, ActionFieldSchema>;
itemType?​
itemType?: ActionFieldType;
max?​
max?: number;
maxLength?​
maxLength?: number;
min?​
min?: number;
minLength?​
minLength?: number;
required​
required: boolean;
type​
type: ActionFieldType;

ActionFieldType​

type ActionFieldType = "string" | "number" | "boolean" | "enum" | "object" | "array" | "unknown";

ActionInputSchema​

type ActionInputSchema =
| {
fields: Record<string, ActionFieldSchema>;
type: "object";
}
| {
type: "unsupported";
};

AnchoredPath​

type AnchoredPath = object;

A file path carrying the declaring module's anchor. Pass import.meta.url as importerUrl; the server resolves a relative path against the module's directory first, falling back to the working directory when the anchor is unusable (e.g. rewritten by a bundler) or the module-relative file doesn't exist. Plain strings stay supported and resolve from the working directory only. Isomorphic-safe: both fields are plain strings.

Properties​

importerUrl​
importerUrl: string;

The declaring module's import.meta.url, anchoring a relative path.

path​
path: string;

Relative or absolute file path.


AnyResourceRef​

type AnyResourceRef =
| ResourceRef<any>
| ResourceCollectionRef<any>
| ProjectedResourceCollectionRef;

Union of handle types that can appear in a resource registry.


ApprovalAnswer​

type ApprovalAnswer =
| SuspendForUserCancelled
| {
answer?: unknown;
approved: true;
cancelled: false;
}
| {
answer?: unknown;
approved: false;
cancelled: false;
deadline: boolean;
};

How an approval came back: a yes (with any data sent with it), a no, or cancelled. A no at the stop's deadline carries deadline: true.


BlockOutputHint​

type BlockOutputHint =
| {
kind: "inline";
}
| {
kind: "ref";
sourceItemId: string;
}
| {
kind: "structure";
shape: StructureShape;
};

Hint communicated from a block's execute out to the block_trace emitter. One of:

  • unset / kind: "inline" — wrap the returned output as { kind: "inline", value: output }.
  • kind: "ref" — emit { kind: "ref", sourceItemId }; executor flattens one hop if the target is itself a ref.
  • kind: "structure" — emit { kind: "structure", shape } directly.

BlockTraceCapturePayload​

type BlockTraceCapturePayload = object;

Payload variant for one phase of BlockContext._runtimeHooks.onBlockTraceCapture. Untyped on the hook surface (consumers branch on phase) to keep the runtime call site simple. The server-side handler reads the matching subset of fields per phase. See BlockTraceCapturePhase for the per-phase contract.

Properties​

data​
data: object;
blockInstanceId?​
blockInstanceId?: string;
blockKind?​
blockKind?: BlockTraceItem["blockKind"];
blockName?​
blockName?: string;
completedAt?​
completedAt?: number;
declaredResources?​
declaredResources?: string[];

Accessor keys the block declares at build time (ownDeclaredResources), stamped at the added phase so the server can surface declared-vs-loaded resource observability. Carried on the payload the same way status/input are.

duration?​
duration?: number;
error?​
error?: object;
error.code?​
code?: string;
error.message​
message: string;
evaluator?​
evaluator?: BlockTraceItem["evaluator"];
generator?​
generator?: BlockTraceItem["generator"];
harnessSpend?​
harnessSpend?: BlockTraceItem["harnessSpend"];

output phase: the harness runs the block settled.

input?​
input?: object;
input.connected?​
connected?: unknown;
input.source​
source: BlockValueInternal;
model?​
model?: BlockTraceItem["model"];
modelUsage?​
modelUsage?: BlockTraceItem["modelUsage"];
output?​
output?: BlockValueInternal;
rescued?​
rescued?: true;

output phase: the block's output came from a .rescue() handler.

startedAt?​
startedAt?: number;
status?​
status?: BlockTraceItem["status"];
phase​
phase: BlockTraceCapturePhase;

BlockTraceCapturePhase​

type BlockTraceCapturePhase = "added" | "input" | "generator" | "evaluator" | "output";

Phase tag for BlockContext._runtimeHooks.onBlockTraceCapture. Each value drives a distinct emission pattern on the unified block_trace item:

  • added — fired at block start, before connectInput. Constructs the item with status: "in_progress" and the input source descriptor.
  • input — fired after connectInput, only when the connector actually transformed the raw value. Patches input.connected.
  • generator — fired post-config-resolution for generator blocks. Patches generator: { model, tools, prompt, user?, history? }. Last write wins on chained model calls (multi-step tool loops).
  • evaluator — fired by evaluator blocks once the question set is known, before model resolution. Patches evaluator: { model, questions }.
  • output — fired at completion. Patches output, status, completedAt, duration, error?, modelUsage?. Triggers item.done after the patch.

CASOptions​

type CASOptions = object;

Properties​

baseDelayMs?​
baseDelayMs?: number;
maxRetries?​
maxRetries?: number;

CollectionCanWrite​

type CollectionCanWrite<TState> = (check) => boolean | Promise<boolean>;

The default write flow's rule for one collection entry: true admits the write.

Type Parameters​

TState​

TState extends JsonObject = JsonObject

Parameters​

check​

CollectionWriteCheck<TState>

Returns​

boolean | Promise<boolean>


CollectionClientConfig​

type CollectionClientConfig<TState> = object;

Client visibility configuration for a collection resource. Controls what data is exposed to the client and how.

Field-projection fields (expose, exclude, data) are mutually exclusive — set at most one per collection. With none set, each item's full state is sent to the client (identity default).

Type Parameters​

TState​

TState extends JsonObject = JsonObject

Properties​

content?​
content?: CollectionClientContentConfig;

Content access permissions — governs access to rendered content bodies and CRUD operations.

data?​
data?: ResourceClientDataFn<TState>;

Escape hatch for computed / transformed per-item projections. Mutually exclusive with expose and exclude. Surfaces as clientData on items returned by the list/get-state endpoints and on snapshot prefetched entries (the latter only when state.read: true).

exclude?​
exclude?: ReadonlyArray<keyof TState & string>;

Blacklist: every state field reaches the client EXCEPT these. Mutually exclusive with expose and data.

expose?​
expose?: ReadonlyArray<keyof TState & string>;

Whitelist: only these state fields reach the client. Mutually exclusive with exclude and data.

live?​
live?: boolean;

Stream each mutated instance's projected clientData as an inline delta mid-stream, merged into the client's cached snapshot without a refetch (the resource-side analog of state_change live merge). Requires the item's clientData to be client-visible — set state.read: true (identity projection) or a projection (expose / exclude / data). Default false: mutations flag a batched snapshot refetch at request completion.

state?​
state?: CollectionStateClientConfig;

State access permissions — governs the new list/get-state endpoints and whether prefetched snapshot entries carry per-item clientData. Has no effect on the always-emitted count.


CollectionClientContentConfig​

type CollectionClientContentConfig = ResourceClientContentConfig & object;

Client-side content access permissions for a collection resource. Extends single-resource permissions with CRUD mutation flags.

Type Declaration​

create?​
create?: boolean;

Allow clients to create new collection items via POST.

delete?​
delete?: boolean;

Allow clients to delete collection items via DELETE.

update?​
update?: boolean;

Allow clients to update existing collection item content via PATCH.


CollectionStateClientConfig​

type CollectionStateClientConfig = object;

Client-side state access permissions for a collection resource. Collection-only — single resources gate state access via clientData directly.

Properties​

read?​
read?: boolean;

Allow clients to read per-item clientData via the list/get-state endpoints and inline in the snapshot's prefetched window. The collection's count is always emitted regardless of this flag — it's a cardinality affordance, not state.


CollectionWriteCheck​

type CollectionWriteCheck<TState> = object;

What ResourceCollectionConfig.canWrite decides on: the entry's storage key, its stored state (none on a create), the state the write would store (none on a delete), and who asks, from the verified sign-in.

Type Parameters​

TState​

TState extends JsonObject = JsonObject

Properties​

key​
key: string;
next​
next: Readonly<TState> | undefined;
orgId​
orgId: string;
prev​
prev: Readonly<TState> | undefined;
userId​
userId: string;

ConnectorFn​

type ConnectorFn<TFrom, TTo> = (input, ctx) => TTo | Promise<TTo>;

Type Parameters​

TFrom​

TFrom

TTo​

TTo

Parameters​

input​

TFrom

ctx​

BlockContext

Returns​

TTo | Promise<TTo>


DeclaredResourceEntry​

type DeclaredResourceEntry =
| DefinedResource
| DefinedResourceCollection<JsonObject>;

DeclaredResourceIndex​

type DeclaredResourceIndex = object;

A declared index, normalised.

Properties​

name​
name: string;

The name findBy takes.

stored​
stored: string;

The name stores keep the entries under: name and version together.

value​
value: ResourceIndexFunction;

The index function.

version​
version: number;

The declared version, 1 when the declaration is a bare function.


EmitDataOptions​

type EmitDataOptions = object;

What ctx.emit.data takes beside the record's dataType and value.

Properties​

agentName?​
agentName?: string;
itemVisibility?​
itemVisibility?: ItemVisibility;

Who the item reaches. Absent means the data default: the client, not model history. Not inherited from an enclosing generator.

key?​
key?: string;

Stable identity for the keyed-snapshot pattern. See DataItem.key.

transient?​
transient?: boolean;

Defaults to false (persisted).


EmitMessageOptions​

type EmitMessageOptions = object;

What ctx.emit.message takes beside the message's text or content.

Properties​

agentName?​
agentName?: string;
itemVisibility?​
itemVisibility?: ItemVisibility;
metadata?​
metadata?: Record<string, unknown>;

Structured data the message item carries as metadata, for a client to read instead of parsing the text. Opaque to the engine and never sent to a model; the emitting package owns its keys and exports their reader.

transient?​
transient?: boolean;

ExecutionParent​

type ExecutionParent = object;

Properties​

container?​
container?: object;
component?​
component?: string;
label?​
label?: string;
metadata?​
metadata?: Record<string, unknown>;
input?​
input?: unknown;

The input value passed to this block when it was executed — what its children read as ctx.parent.input.

instanceId​
instanceId: string;
kind​
kind: BlockKind;
name​
name: string;
parentInstanceId?​
parentInstanceId?: string;
path?​
path?: string;

Structural path locator for deterministic instance IDs. Format is a slash-delimited sequence of {op}[{index}] segments rooted at root (e.g. root/step[0]/iter[2]). Propagated to the child's _blockIdentity.blockPath so nested blocks can derive their own paths.

phase?​
phase?: "main" | "sideChain";

Execution phase for this scope. Inherited by nested scopes when not explicitly overridden.

stateSchema?​
stateSchema?: ZodTypeAny;
transient?​
transient?: boolean;

FlowActionBlock​

type FlowActionBlock<TAction> = TAction["block"];

Type Parameters​

TAction​

TAction extends ActionConfig


FlowActionInput​

type FlowActionInput<TAction> = TAction["block"]["inputSchema"]["_output"];

Type Parameters​

TAction​

TAction extends ActionConfig


FlowToolContext​

type FlowToolContext<TResources> = object;

Type Parameters​

TResources​

TResources extends Record<string, AnyResourceHandle> = Record<string, AnyResourceHandle>

Properties​

resources?​
resources?: TResources;
retry?​
retry?: RetryPolicy;

GeneratorModelStreamChunk​

type GeneratorModelStreamChunk = object;

Properties​

finishReason?​
finishReason?: string;
fullResult?​
fullResult?: GeneratorModelResult;
reasoningDelta?​
reasoningDelta?: string;
resolvedIdentity?​
resolvedIdentity?: ModelIdentity;

Resolved identity of the model producing this chunk. Stamped on every chunk once known (typically from the first AI SDK response or fallback candidate selection).

source?​
source?: GeneratorModelSource;

Source reference from a provider-native tool (e.g., web search).

textDelta?​
textDelta?: string;
toolCallDelta?​
toolCallDelta?: object;
argsDelta?​
argsDelta?: string;
toolCallId​
toolCallId: string;
toolName​
toolName: string;
toolInput?​
toolInput?: object;

Info about a tool that started executing (including provider-executed tools).

providerExecuted?​
providerExecuted?: boolean;
toolName​
toolName: string;
toolResult?​
toolResult?: object;

Completed tool result from the AI SDK's multi-step loop.

result​
result: unknown;
toolCallId​
toolCallId: string;
toolName​
toolName: string;
type​
type:
| "text_delta"
| "tool_call_delta"
| "tool_result"
| "reasoning_delta"
| "source_url"
| "tool_input_start"
| "finish";
usage?​
usage?: GeneratorModelUsage;

GeneratorStepResult​

type GeneratorStepResult = object;

Properties​

finishReason?​
finishReason?: string;
text?​
text?: string;
toolCalls?​
toolCalls?: GeneratorModelToolCall[];
toolResults?​
toolResults?: object[];
result​
result: unknown;
toolCallId​
toolCallId: string;
toolName​
toolName: string;
usage?​
usage?: GeneratorModelUsage;

HistoryTurnQuery​

type HistoryTurnQuery = object;

Which turns items.turns() lists.

Properties​

requestIds?​
requestIds?: readonly string[];

These turns, by request id, whether or not the window still holds them. Only this session's turns are read; an id that names none is left out.


HookHandler​

type HookHandler<TInput> = (input, ctx) => Promise<void> | void;

Type Parameters​

TInput​

TInput = unknown

Parameters​

input​

TInput

ctx​

BlockContext

Returns​

Promise<void> | void


InboundSource​

type InboundSource = string;

Stable provenance identifier for inbound requests. Open string — adapters may use any value. The documented known-set is http, mcp, webhook, scheduled, notification; custom transports pick their own.


InferFlowBlockContext​

type InferFlowBlockContext<TDefinition> = BlockContext<InferFlowStateMap<TDefinition>["request"], InferFlowStateMap<TDefinition>["session"], InferFlowStateMap<TDefinition>["user"], InferFlowStateMap<TDefinition>["org"]>;

Type Parameters​

TDefinition​

TDefinition extends FlowDefinition


InferFlowStateMap​

type InferFlowStateMap<TDefinition> = object;

Type Parameters​

TDefinition​

TDefinition extends FlowDefinition

Properties​

org​
org: InferScopeStateFromConfig<TDefinition["org"]>;
request​
request: InferScopeStateFromConfig<TDefinition["request"]>;
session​
session: InferScopeStateFromConfig<TDefinition["session"]>;
user​
user: InferScopeStateFromConfig<TDefinition["user"]>;

InferScopeStateFromConfig​

type InferScopeStateFromConfig<TScopeConfig> = TScopeConfig extends object ? TSchema extends ZodTypeAny ? TSchema["_output"] : Record<string, never> : Record<string, never>;

Type Parameters​

TScopeConfig​

TScopeConfig


ItemQuery​

type ItemQuery = object;

Properties​

afterRequestId?​
afterRequestId?: string;

history() only: start after this turn (a request id), leaving it and every earlier turn out. A turn the window no longer holds is older than every turn it does, so naming one leaves the history whole. Applied before limit. A history summary narrows with it: the summary stands for the turns up to its mark.

agentName?​
agentName?: string | string[];

Filter by producing agent name. Scalar or array form.

earlierDocuments?​
earlierDocuments?: "window" | "named";

history() only: how an earlier turn's documents ride. "window" (the default) re-sends the newest, up to one message's limits, and names older ones. "named" sends none: each becomes one line with its name and id, which a model with the attachments capability's readAttachment reads on request. The request's own files and every image are unaffected. The attachments capability sets it.

includeInFlight?​
includeInFlight?: boolean;

Whether a view includes the in-flight request's items: history() appends them after the prior turns, and all(), client() and selectForContext() merge them after the prior items. Defaults to true, so a retry after a mid-turn failure sees its own tool state. Pass false for prior items only, for example to hand a model the earlier conversation without the request that is running now.

includeTransient?​
includeTransient?: boolean;
itemTypes?​
itemTypes?: string[];
itemVisibility?​
itemVisibility?: ItemVisibility;

Filter by item visibility. Exact-match against resolved visibility.

limit?​
limit?: MessageLimit;
roles?​
roles?: ("user" | "assistant" | "system" | "developer" | "tool")[];

JournalEntry​

type JournalEntry = object;

Properties​

id​
id: string;
metadata?​
metadata?: Record<string, unknown>;
source?​
source?: string;
tags?​
tags?: string[];
text​
text: string;
ts​
ts: number;

JournalEntryInput​

type JournalEntryInput = Omit<JournalEntry, "id" | "ts">;

LLMMessage​

type LLMMessage = object;

Properties​

content​
content: unknown;
role​
role: "system" | "developer" | "user" | "assistant" | "tool";

Message​

type Message = object;

Properties​

content​
content:
| string
| JsonObject
| JsonObject[];
id​
id: string;
role​
role: "system" | "developer" | "user" | "assistant" | "tool";
ts?​
ts?: number;

MessageLike​

type MessageLike = object;

Properties​

content​
content:
| string
| JsonObject
| JsonObject[];
role​
role: "system" | "developer" | "user" | "assistant" | "tool";

MessageLimit​

type MessageLimit =
| number
| {
tokens: number;
}
| {
turns: number;
};

Bounds the number of items / messages / turns returned by a view.

The bare number form is interpreted per-view:

  • In items.history(), N means "the last N conversational turns" — a tool-heavy turn counts as one turn regardless of how many tool-call / tool-result protocol messages it produced.
  • In items.all() and items.client(), N means "the last N items".

{ turns: N } is the explicit form for turn-based limiting and is intended for items.history(). It is also accepted by items.all() and items.client() for type-system uniformity, but in those views it is treated as a plain item count (N items, not "items from N turns") — those views have no notion of a turn boundary. Prefer bare number or omit the limit on the non-history views to avoid this fallback.

{ tokens: N } is token-aware. In items.history() packing is turn- aligned: whole turns are accepted from the end until adding the next would exceed the budget. The most recent prior turn is always included even if it alone exceeds the budget.


MessageQuery​

type MessageQuery = object;

Properties​

limit?​
limit?: MessageLimit;

MessageViews​

type MessageViews = object;

Properties​

history​
history: (query?) => LLMMessage[];
Parameters​
query?​

MessageQuery

Returns​

LLMMessage[]

ui​
ui: (query?) => Message[];
Parameters​
query?​

MessageQuery

Returns​

Message[]


NamedSessionRegistry​

type NamedSessionRegistry<TResources> = NamedSessionResources<TResources> & object;

What ctx.resources.at({ session }) returns: another session's handles (NamedSessionResources), by property and by get, with list and a further at. get and list are typed as a ref for the reason ResourceRegistry gives.

Type Parameters​

TResources​

TResources extends Record<string, AnyResourceRef>

Type Declaration​

at​
at: ((target) => NamedSessionRegistry<TResources>) & ResourceRef<any>;
get​
get: (<TKey>(name) => NonNullable<NamedSessionResources<TResources>[TKey]>) & ResourceRef<any>;
list​
list: (() => NonNullable<NamedSessionResources<TResources>[keyof NamedSessionResources<TResources>]>[]) & ResourceRef<any>;

NamedSessionResources​

type NamedSessionResources<TResources> = string extends keyof TResources ? Record<string,
| AnyResourceRef
| NamedSessionResourceRef<any>> : SessionReachable<TResources> & { [K in keyof TResources as NonNullable<TResources[K]> extends ResourceRef<any> ? K : never]: NonNullable<TResources[K]> extends ResourceRef<infer TState> ? NamedSessionResourceRef<TState> | Extract<TResources[K], undefined> : never };

The handles ctx.resources.at hands out in another session: the collections SessionReachable keeps, and each single resource as a NamedSessionResourceRef. A single resource's handle doesn't carry its scope, so a user- or org-scoped one stays here too, and throws at runtime when named. The open registry reads any name as either.

Type Parameters​

TResources​

TResources extends Record<string, AnyResourceRef>


OrgConfig​

type OrgConfig = object;

Properties​

cas?​
cas?: CASOptions;
client?​
client?: ScopeClientConfig<JsonObject>;

See SessionConfig.client.

stateSchema?​
stateSchema?: ZodTypeAny;

PendingUserSuspension​

type PendingUserSuspension = object;

One of a user's pending suspensions as the pending read answers it: what an Inbox lists and its card draws, and the flow instance and session an answer goes through. Never the run's payload: no stepInput, resumeData or data, and nothing of how it resolves.

Properties​

allow?​
readonly allow?: readonly ResumeAction[];
createdAt​
readonly createdAt: number;
expiresAt?​
readonly expiresAt?: number;
flowId?​
readonly flowId?: string;

The request's flow instance, else the suspension's; absent on a record written before instances had ids.

flowKind​
readonly flowKind: string;

The request's flow kind.

kind​
readonly kind: SuspendForUserKind;

What it asks for (suspendForUserKindOf).

message​
readonly message: string;
render?​
readonly render?: object;
component​
component: string;
props?​
props?: Record<string, unknown>;
requestId​
readonly requestId: string;
resumeSchema?​
readonly resumeSchema?: Record<string, unknown>;
sessionId?​
readonly sessionId?: string;

The request's session; absent for a sessionless request.

shape​
readonly shape: SuspensionShape;

The card it draws (suspensionShape).

suspensionId​
readonly suspensionId: string;
title?​
readonly title?: string;

PendingUserSuspensionCursor​

type PendingUserSuspensionCursor = object;

Where a read of pending suspensions starts: strictly after this (createdAt, requestId, suspensionId). A suspension's id is unique only within its request, so the request is part of the order.

Properties​

createdAt​
readonly createdAt: number;
requestId​
readonly requestId: string;
suspensionId​
readonly suspensionId: string;

PendingUserSuspensionQuery​

type PendingUserSuspensionQuery = object;

The scope of a read of one user's pending suspensions. Every key is the server's, never a caller's. tenantId and orgId are always present, undefined included: an unbound principal matches only unbound requests, so absence can never widen the read.

Properties​

after?​
readonly after?: PendingUserSuspensionCursor;
flowKinds​
readonly flowKinds: readonly string[];

The request's flow kind is one of these. Never empty when it reaches a store.

limit​
readonly limit: number;

At most this many rows, oldest first by (createdAt, requestId, suspensionId).

now​
readonly now: number;

The engine's clock: a suspension whose expiresAt is at or before it is left out.

orgId​
readonly orgId: string | undefined;
tenantId​
readonly tenantId: string | undefined;
userId​
readonly userId: string;

RequestConfig​

type RequestConfig = object;

Properties​

cleanupCheckpointsOnTerminal?​
cleanupCheckpointsOnTerminal?: boolean;

When true, durable sequencer checkpoints are deleted on terminal completion (success / error / abort). When false (default), checkpoints are retained — useful for post-mortem inspection, audit, or letting a projected process decide retention.

Latest-only persistence keeps storage bounded regardless of this setting (one record per sequencer instance per request), so retention doesn't compound across step counts.

concurrency?​
concurrency?: ConcurrencyConfig;

Flow-level default concurrency policy for every action, applied when an action does not set its own concurrency. Governs what happens when a request arrives while another on the same key (default: session) is in flight. Default when unset: "allow". See ConcurrencyConfig.

heartbeatIntervalMs?​
heartbeatIntervalMs?: number;

Heartbeat interval in milliseconds for the active request registry. Default: 10000 (10 seconds). Set to 0 to disable.

The same tick carries cross-process abort delivery and keeps a running request's registry entry warm, so 0 disables both: a cancellation recorded elsewhere is never delivered, and a run outliving the stale threshold can be marked interrupted while it is still running.

mutationTimeoutMs?​
mutationTimeoutMs?: number;

Per-mutation budget for in-memory state writes (target, sequencer scopes — anything not bridged through a persist callback). When a mutator's queue wait + execution time exceeds this, the call rejects with ScopeMutationTimeoutError instead of hanging the request indefinitely. Default 30000 (30s). Set to Infinity to disable.

Does not apply to any scope that persists. session / user / org go through the optimistic CAS retry path, which owns its own retry semantics and surfaces contention as ConcurrentModificationError. request serializes its writes and runs that same retry path beneath the lock, and is left off this budget too: the timeout rejects the caller without cancelling the mutation, so a durable write that outran it would still reach the store afterwards — on top of a record the runtime may already have written as terminal.

onCompleted?​
onCompleted?: BlockDefinition<any, any>;
onErrored?​
onErrored?: BlockDefinition<any, any>;
onFinished?​
onFinished?: BlockDefinition<any, any>;
onStarted?​
onStarted?: BlockDefinition<any, any>;
onStepErrored?​
onStepErrored?: BlockDefinition<any, any>;
sseHeartbeatMs?​
sseHeartbeatMs?: number;

SSE wire-level heartbeat interval in milliseconds. When set, the server emits : ping\n\n comment frames on every SSE response for this flow at the configured cadence. This keeps NAT/proxy idle timeouts from closing the connection and gives clients a robust inactivity signal independent of platform-specific abort behaviors. Default: 15000 (15 seconds). Set to 0 to disable.

stateSchema?​
stateSchema?: ZodTypeAny;

RequestStatus​

type RequestStatus =
| "in_progress"
| "completed"
| "incomplete"
| "failed"
| "interrupted"
| "aborted"
| "suspended";

Lifecycle status of a request. Mirrors the value persisted in RequestStore.set. Server's RequestRecord.status re-exports this type.


RequestStatusSnapshot​

type RequestStatusSnapshot = object;

Read-only snapshot of a request's lifecycle state, returned by GET /api/flows/:flowKind/requests/:requestId/status. Callable when no SSE stream is connected — useful for the client-side dismiss path that needs to confirm a request is terminal after a stuck-request banner is shown.

Properties​

ageMs​
ageMs: number;

Convenience: Date.now() - startedAtMs at the time of the read.

completedAtMs?​
completedAtMs?: number;

Wall-clock time the request reached a terminal status, if any.

id​
id: string;

The request's identifier.

lastHeartbeatAt?​
lastHeartbeatAt?: number;

Most recent registry heartbeat, in ms since epoch. Populated while the registry holds a live run of the request: one in_progress, or one just continued or resumed that still shows the status it was carried on from until it gets its turn. Absent once the run settles and its entry is removed.

result?​
result?: object;

The request's stored action result, sent only when the read asks with include_result_output=true; the same projection the session request list sends. Absent without the flag, and on a request that ended without one (aborted, interrupted, suspended) or is still running.

Request endedresult
completed / incomplete{ output, hasOutput: true }; { hasOutput: false } when the action returned nothing
failed{ error }, plus output when the action answered before a completion hook failed the request
any of those, output not storable as JSONoutputNotRecorded: true in place of output
error?​
error?: object;

Why the request failed, as FlowError's code and message.

error.code​
code: string;
error.message​
message: string;
hasOutput​
hasOutput: boolean;

Whether the action's return value is stored.

output?​
output?: unknown;

The action's return value, stored as JSON.

outputNotRecorded?​
outputNotRecorded?: true;

The action returned a value that could not be stored as JSON. The request still finished; distinct from returning nothing.

sessionId?​
sessionId?: string;

The session the request runs in. Absent for a request sent without a session. Lets a caller holding only a request id continue or retry it, since those routes are addressed by session.

startedAtMs​
startedAtMs: number;

Wall-clock time the request started, in ms since epoch.

status​
status: RequestStatus;

Current lifecycle status.


ResolvePrincipalFn​

type ResolvePrincipalFn = (context) =>
| Promise<
| ResolvedPrincipal
| {
orgId?: string;
userId?: string;
}
| null>
| ResolvedPrincipal
| {
orgId?: string;
userId?: string;
}
| null;

Caller-supplied principal resolver. May return a fully resolved principal, a partial { userId?, orgId? } (the framework will then apply defaultUserId and enforce requireUser), or null.

Whatever shape it returns, the framework requires a verified organization before any effect: a resolver that yields no orgId, one isValidOrgId rejects (empty, whitespace-only, a lone surrogate), or the reserved DEFAULT_ORG_ID is refused at principal resolution. null is refused for the same reason — it cannot be repaired by the defaultUserId fallback, which supplies a user and never an organization. A machine transport returns { orgId } and lets defaultUserId name its system user.

Throwing a PrincipalResolutionError (from @flow-state-dev/engine) lets the resolver pick the HTTP status code surfaced to clients (e.g., 401 for invalid signature, 403 for valid signature on a forbidden resource).

Parameters​

context​

PrincipalResolutionContext

Returns​

| Promise< | ResolvedPrincipal | { orgId?: string; userId?: string; } | null> | ResolvedPrincipal | { orgId?: string; userId?: string; } | null


ResourceCanWrite​

type ResourceCanWrite<TState> = (check) => boolean | Promise<boolean>;

The default write flow's own rule for one resource: true admits the write.

Type Parameters​

TState​

TState extends JsonObject = JsonObject

Parameters​

check​

ResourceWriteCheck<TState>

Returns​

boolean | Promise<boolean>


ResourceClientConfig​

type ResourceClientConfig<TState> = object;

Client visibility configuration for a single resource. Controls what data is exposed to the client and how.

Field-projection fields (expose, exclude, data) are mutually exclusive — set at most one per resource. With none set, the full state is sent to the client (identity default).

Type Parameters​

TState​

TState extends JsonObject = JsonObject

Properties​

content?​
content?: ResourceClientContentConfig;

Content access permissions — governs access to the rendered content body.

data?​
data?: ResourceClientDataFn<TState>;

Escape hatch for computed / transformed projections. Mutually exclusive with expose and exclude.

exclude?​
exclude?: ReadonlyArray<keyof TState & string>;

Blacklist: every state field reaches the client EXCEPT these. Mutually exclusive with expose and data.

expose?​
expose?: ReadonlyArray<keyof TState & string>;

Whitelist: only these state fields reach the client. Mutually exclusive with exclude and data.

live?​
live?: boolean;

Stream this resource's projected clientData as an inline delta on every state mutation, merged into the client's cached snapshot without a refetch (the resource-side analog of state_change live merge). Requires a projection (expose / exclude / data) — a single resource with no projection keeps its state private and has nothing to stream. Default false: mutations flag a batched snapshot refetch at request completion.


ResourceClientContentConfig​

type ResourceClientContentConfig = object;

Client-side content access permissions for a single resource. Only read and prefetch are valid on single resources.

Properties​

prefetch?​
prefetch?: boolean;

When true, content is included inline in the snapshot response (for small, always-needed resources).

read?​
read?: boolean;

Allow clients to fetch the rendered content body via the content endpoint.


ResourceClientDataFn​

type ResourceClientDataFn<TState> = (state) =>
| JsonValue
| Promise<JsonValue>;

A compute function that derives client-visible data from a resource's state. Analogous to scope-level clientData, but scoped to the resource.

Note: ClientDataOf recovers the data branch's precise output type from the function's return type. Declared here as JsonValue, so an inline data: (state): MyShape => ({...}) (return annotated, or a literal body) threads MyShape, but a function pre-assigned to ResourceClientDataFn<...> before being passed in erases its return to JsonValue — ClientDataOf then widens to JsonValue with no error. Inline the projection (or annotate its return) when you want the precise client type.

Type Parameters​

TState​

TState extends JsonObject = JsonObject

Parameters​

state​

Readonly<TState>

Returns​

| JsonValue | Promise<JsonValue>


ResourceConfig​

type ResourceConfig<TState> = object;

Type Parameters​

TState​

TState extends JsonObject = JsonObject

Properties​

allowedExtensions?​
allowedExtensions?: string[];
canWrite?​
canWrite?: ResourceCanWrite<TState>;

The default write flow's rule for this resource, run after the schema and owner checks; false refuses the write. Requires runBy: "default". Required for an org resource on the default write flow: without it every member of the org could write it. Declare canWrite: () => true when that is what you want.

client?​
client?: ResourceClientConfig<TState>;

Client visibility configuration. Omit to keep the resource invisible to clients.

content?​
content?: string;
contentFile?​
contentFile?: string | AnchoredPath;

Path to a file on disk to load as the content body template. A bare string resolves from the working directory; an AnchoredPath resolves relative to the declaring module first (pass import.meta.url). Mutually exclusive with content.

contentTemplate?​
contentTemplate?:
| ResourceTemplate
| string
| AnchoredPath;

A role-tagged Markdown template for this resource's content. Accepts a pre-parsed ResourceTemplate (from parseResourceTemplate / loadResourceTemplate), or a file path that the server resolves at startup — a bare string resolves from the working directory; an AnchoredPath resolves relative to the declaring module first (pass import.meta.url). The resource's content is rendered against its state via deterministic LiquidJS. Mutually exclusive with content / contentFile / contentTemplateRef.

contentTemplateRef?​
contentTemplateRef?: string;

Path of another resource whose RAW content is a role-tagged Markdown template. Resolved at read-time: editing the template resource or this resource's state changes readContent() output on next read. Mutually exclusive with content / contentFile / contentTemplate.

default?​
default?: JsonValue;
dynamic?​
dynamic?: never;

Removed. dynamic never had an effect — collections are declared with defineResourceCollection. Typed never rather than deleted because defineResource takes its config as a naked generic parameter, so excess-property checking does not fire on the call-site literal: simply deleting the field would leave dynamic: true silently accepted and spread onto the returned definition.

Deprecated​

Remove the option; it does nothing.

edges?​
edges?: boolean | EdgeSlotConfig;

Declare a typed-edge graph on this resource. true = defaults; object = curated vocabulary / size cap. The framework injects an edges: Edge[] state field (if absent) and attaches an .edges API to the live ref.

flowIsolation?​
flowIsolation?: boolean;

Cross-flow sharing intent. Default false:

  • user / org scope: stored at (scopeId, ref) — shared across every flow the same userId / orgId touches. Exception: on an instance registered with an owner pin, a user-scoped resource is stored in a per-(org, user) cell, shared only with that user's other owner-pinned instances in the same organization.
  • session scope: sessions are intrinsically flow-bound; the field has no semantic meaning and true is rejected at build time.

Set true to opt user/org-scoped resources into per-flow isolation — stored at (scopeId, flowInstanceId, ref). The coordinate is the resolved instance id, not the kind: two registered copies of one collection definition each get their own cell. An instance registered at runtime is one instance too, so this keys per instance.

A singleton's instance id is its kind, so its keys are normally unchanged — with one exception: each key component is escaped before joining, so an id containing : or \ (in the kind, or in the userId / orgId) keys differently than it did before instance-keyed storage and needs the offline cutover in apps/docs/docs/persistence/overview.md. Such a deployment already had ambiguous keys. See scope-keys.ts for the encoding.

Registration refuses two flow kinds that declare the same shared ref with conflicting settings. It does not catch overlapping collection patterns (files/* beside files/a), or two instances of one kind whose resource overrides differ; the engine's validateScope documents both gaps.

llmReadable?​
llmReadable?: boolean;
llmWritable?​
llmWritable?: boolean;
metadata?​
metadata?: Record<string, unknown>;
prefetchMode?​
prefetchMode?: "eager" | "lazy";

When this resource's state/content is loaded relative to a request. 'eager' (default when omitted) loads it up front when the scope's resource registry is constructed. 'lazy' defers loading until first access. Lazy single resources are only valid when declared on the specific block that needs them — a per-block load trigger; declaring a lazy single at flow level throws at defineFlow build time.

reactTo?​
reactTo?: ReactiveBindings<TState>;

Bind blocks to this resource's mutations. Each present entry names a block — bare, or { block, when } with an optional gate — that the server dispatcher runs when that mutation fires. The state kinds (created / stateUpdated / deleted) get a ResourceChange payload; contentUpdated (a content-body write) gets a ResourceContentChange.

ref?​
ref?: string;

Logical reference name. Used as the storage namespace identifier (combined with scope and flowIsolation to form the storage key). Independent of the accessor name on ctx.resources.<key>.

render?​
render?: (content, state) => string | Promise<string>;
Parameters​
content​

string

state​

JsonObject

Returns​

string | Promise<string>

runBy?​
runBy?: ResourceRunBy;

The flow a client's write of this user or org resource runs through: "default" (the framework's default write flow) or { flow }. Omit it and a client can't write the resource. User or org scope only, and not with flowIsolation: true, and with a client config the client reads it through. With "default", no computed client.data.

scope​
scope: ResourceScope;

Intrinsic scope this resource lives in. Determines which storage layer (session/user/org) holds its state and content. Required for new resources; the framework treats omission as a validation error in defineResource.

secret?​
secret?: ReadonlyArray<keyof TState & string>;

State fields that never leave the server. Every read the engine serves omits them: the client snapshot, the list and get-state routes, live deltas, and the debug routes, which otherwise return full state. A client.data function sees the full state, but a secret field in what it returns is dropped. Blocks on the server read them through the handle. A field named here cannot also be named in client.expose.

sharedToLineage?​
sharedToLineage?: boolean;

Give this session-scoped resource ONE identity across the whole session lineage, so a session and every background child session it dispatches — and every child those children dispatch — read and write the same resource through the ordinary resource API.

Default false: a session-scoped resource resolves against the running session, so each child session has its own, starting empty. Set true and it resolves against the lineage root instead — the top-most session in the chain — which every session in that lineage agrees on.

Session-scope only. true at user / org scope is rejected at build time: those scopes already span every session the same principal touches, so the flag would mean nothing there.

Sharing is not serialization. Two children writing one shared resource is ordinary same-resource contention, fenced by the store's expectedVersion check like any other concurrent write. Nothing here queues, locks, or orders those writes.

Session state is never shared — this flag reaches resources only.

stateSchema​
stateSchema: ZodTypeAny;
wakeEntry?​
wakeEntry?: string;

The internal entry a write from another session starts a turn of, in the session written (ctx.resources.at({ session })). The same option, and the same rule, as a collection's wakeEntry: the turn is a wake on that session and entry, so writes that land before it runs fold into one turn, which reads what changed and settles its wake. Absent, a write from another session is heard on the change bus and starts no turn. A write from the session itself never starts one. Session-scope only.

writable?​
writable?: boolean;

ResourceRefOptions​

type ResourceRefOptions = object;

Properties​

as?​
as?: string;
optional?​
optional?: boolean;

ResourceRegistry​

type ResourceRegistry<TResources> = TResources & object;

ctx.resources. A declared registry must assign to the open default, whose AnyResourceRef string index covers every key, get and list included. So get and list are also typed as a ref: that is what lets a declared registry pass with no index signature of its own. Any index signature here would have to read as a subtype of AnyResourceRef, and an undeclared name would then compile wherever a ref is accepted. Without one, an undeclared name is a missing-property error. Optional entries can be absent by property access. get throws for an absent name and list returns only the handles that exist. at is typed the same way, for the same reason.

Type Parameters​

TResources​

TResources extends Record<string, AnyResourceRef> = Record<string, AnyResourceRef>

Type Declaration​

acrossSessions​
acrossSessions: (() => AcrossSessions<SessionReachable<TResources>>) & ResourceRef<any>;

This run's session-scoped collections read across every session the run's owner has: ctx.resources.acrossSessions().notes.list(). One store query a page, each entry with the session it belongs to. Read-only.

A session is answered only when ctx.resources.at would reach it: the same owner (user, organization and tenant) and the same admission. Any other session's entries are left out, as though it held none. A turn a webhook delivery started can't call it.

In a view, the read is heard on the owner's change topic for each collection it lists, which every write to any session's resources publishes on, so a session made after the view ran is heard too.

at​
at: ((target) => NamedSessionRegistry<TResources>) & ResourceRef<any>;

Another session's resources: this run's session-scoped collections and single resources in that session, by the calling flow's definitions: ctx.resources.at({ session }).notes. Reads, lists and writes act on that one session's resources, as its own session's would, and the session written hears each write as it hears its own. A single resource there is a NamedSessionResourceRef: its verbs are async, and its state is read with readState().

The session is reached only when it is the run's owner's, by the same admission the HTTP routes apply. Any other session (another user's, another org's or tenant's, one an own-resolver flow refuses, or one no one holds) answers every verb alike: rejected with SessionNotFoundError. A turn a webhook delivery started reaches no session but its own.

For what isn't a resource (another session's flow, its readable state, its history), use ctx.sessions.

get​
get: (<TKey>(name) => NonNullable<TResources[TKey]>) & ResourceRef<any>;
list​
list: (() => NonNullable<TResources[keyof TResources]>[]) & ResourceRef<any>;

ResourceRunBy​

type ResourceRunBy =
| "default"
| {
flow: string;
};

Which flow writes a user or org resource when a client asks to write it. "default" is the framework's default write flow: it checks the schema, the owner and ResourceConfig.canWrite, and writes at the version the client read. { flow } names a flow the app hosts, whose actions write it with their own rules. With no runBy, a client can't write the resource; server flows still write it from inside their actions.


ResourceScope​

type ResourceScope = "session" | "user" | "org";

The scope a resource is intrinsically bound to. Determines which storage layer holds its state and content (session/user/org records and content stores). Set via defineResource({ scope }).


ResourceWriteCheck​

type ResourceWriteCheck<TState> = object;

What ResourceConfig.canWrite decides on: the stored state, the state the client asks for, and who asks, from the verified sign-in.

Type Parameters​

TState​

TState extends JsonObject = JsonObject

Properties​

next​
next: Readonly<TState>;

The state the write would store, already parsed by the schema.

orgId​
orgId: string;
prev​
prev: Readonly<TState>;

The stored state the write replaces: the schema's default when nothing is stored.

userId​
userId: string;

RetentionPolicy​

type RetentionPolicy = object;

Retention policy for bounding a session's persisted item log. When limits are exceeded, entire old request records are evicted (lazy, on write).

Properties​

maxAge?​
maxAge?: number | string;

Maximum age of past turns (completed or interrupted requests). Milliseconds (number) or duration string ('24h', '7d').

maxItems?​
maxItems?: number;

Maximum number of items across the session's past turns (completed or interrupted requests). Oldest requests evicted first.


ScheduleDueEntry​

type ScheduleDueEntry = object;

One due entry a schedule index hands back: who it runs as, in which org, its key, the time it was due, and the cron and time zone it runs on (so a tick that comes late fires it for its latest due time, not the first it missed).

Properties​

cron​
cron: string;
key​
key: string;
nextFireAt​
nextFireAt: number;
orgId?​
orgId?: string;
timezone?​
timezone?: string;

IANA time zone the cron is read in. Default "UTC".

userId​
userId: string;

ScheduleDueSource​

type ScheduleDueSource = object;

What a host's tick needs of a schedule index: claim the entries due by now, advancing them.

Methods​

claimDue()​
claimDue(now, limit?): Promise<readonly ScheduleDueEntry[]>;
Parameters​
now​

number

limit?​

number

Returns​

Promise<readonly ScheduleDueEntry[]>


SchemaInput​

type SchemaInput<TSchema> = TSchema extends ZodTypeAny ? TSchema["_input"] : never;

Type Parameters​

TSchema​

TSchema


SchemaOutput​

type SchemaOutput<TSchema> = TSchema extends ZodTypeAny ? TSchema["_output"] : never;

Type Parameters​

TSchema​

TSchema


ScopeIdentity​

type ScopeIdentity = object;

Properties​

id​
id: string;
orgId?​
orgId?: string;
tenantId?​
tenantId?: string;

Optional tenant the request runs under. Extracted from a configurable HTTP header (default x-tenant-id) and exposed on request, session, user, and org scope identities so handlers and lifecycle hooks can branch on it. Undefined for single-tenant apps.

When present, it also namespaces session storage: the session record, session-scoped content/resource-state, and request history listing isolate by tenant, so two tenants sharing a session id never share data. User and org scopes stay shared across tenants by design.

type​
type: ScopeType;
userId?​
userId?: string;

ScopeResourceConfig​

type ScopeResourceConfig =
| ResourceConfig
| ResourceCollectionConfig;

Legacy scope-keyed config alias preserved for type-internal usage.


ScopeType​

type ScopeType = "request" | "session" | "user" | "org";

SelectedUserSuspension​

type SelectedUserSuspension = object;

The fields a store selects for one pending row: the suspension's own, and the request's flow and session. null reads as absent, as SQL hands it back.

Properties​

allow?​
allow?: ResumeAction[] | null;
createdAt​
createdAt: number;
expiresAt?​
expiresAt?: number | null;
flowId?​
flowId?: string | null;
flowKind​
flowKind: string;
kind?​
kind?: SuspendForUserKind | null;
message​
message: string;
reason​
reason: string;
render?​
render?:
| {
component: string;
props?: Record<string, unknown>;
}
| null;
requestId​
requestId: string;
resumeSchema?​
resumeSchema?: Record<string, unknown> | null;
sessionId?​
sessionId?: string | null;
suspensionId​
suspensionId: string;
title?​
title?: string | null;

SessionConfig​

type SessionConfig = object;

Per-scope configs (session, user, org) carry only state and client-data hooks. Resources live in the flow-level resources field — the resource's intrinsic scope decides where it persists.

Properties​

[SESSION_REQUEST_END_HOOK]?​
readonly [SESSION_REQUEST_END_HOOK]?: SessionRequestEndHook;

Framework-facing, not a flow-author field: a request-end hook the package that built this session config adds to every request of the flow (see SESSION_REQUEST_END_HOOK in ./request-end).

cas?​
cas?: CASOptions;
client?​
client?: ScopeClientConfig<JsonObject>;

Declares which slice of session state crosses to the client. State is private by default — only exposed field names appear in clientData.session.

createCheck?​
createCheck?: SessionCreateCheck;

Runs before a session of this flow is written, on every path that creates one: the create route, an action sent to a session id that does not exist yet, a webhook delivery, fsdev run and a dispatch into a child session. It receives the verified caller and the session's initial state, parsed through stateSchema, and accepts or refuses the create. A turn on an existing session never calls it.

historyWindow?​
historyWindow?: object;

Bounds the cross-turn history loaded per request to the most recent turns past turns (default 50): completed requests, and requests cut short when their server died, with only what they had finished. The window is counted before an interrupted request that a retry re-ran, or one still parked on a gate, is left out, so those take a slot and a full window can show fewer than turns turns. This caps the store read and the default generator's in-prompt history; the full session stays retrievable via the state endpoint. Per-call history({ limit }) refines within this window — it cannot widen it. Use a positive integer; 0 or negative disables cross-turn history entirely.

turns​
turns: number;
label?​
label?: SessionLabel;

What a reader calls one of this flow's sessions when it has no title: "Amy" rather than wks_9b74…. Runs on every read of a session (the listing and the single read) and goes out as the session's label. It sees only the state the session shows (its readonly and client.expose fields), so it cannot publish a private one. Keep it cheap and pure. Called once per session per read. Return undefined to name nothing; a throw leaves that session unlabelled and is warned about once per flow kind. Display only, never an address or an authority.

metadata?​
metadata?: ZodTypeAny;
retention?​
retention?: RetentionPolicy;

Retention policy that bounds session item log size.

serverOwned?​
serverOwned?: readonly string[];

Session-state fields only this flow's code writes. A create that seeds one (the create route's state, fsdev run --seed-session) is refused with a 400 naming the field, and nothing is written. Blocks write them as any other session state.

stateSchema?​
stateSchema?: ZodTypeAny;

The session state's shape. A top-level field declared .readonly() (z.object({ projectId: z.string().readonly() })) is set when the session is created and never changes: a write that would change it is refused, whoever writes it. Readonly fields are also the only state fields the session listing filters by (listSessions({ state: { ... } })). Only a plain z.object at the top is read for them.


SessionCreateCheck​

type SessionCreateCheck = (input) =>
| SessionCreateCheckResult
| Promise<SessionCreateCheckResult>;

Runs before a session of this flow is written, on every path that creates one, and only then: a turn on an existing session never calls it.

Parameters​

input​

SessionCreateCheckInput

Returns​

| SessionCreateCheckResult | Promise<SessionCreateCheckResult>


SessionCreateCheckInput​

type SessionCreateCheckInput = object;

What a create check sees. Every field is server-derived except state, which is the session's initial state: the create request's state, fsdev run --seed-session, or the state a dispatching block put on its session target, parsed through the flow's stateSchema.

Properties​

flow​
readonly flow: object;

The flow instance the session will belong to.

id​
readonly id: string;
kind​
readonly kind: string;
principal​
readonly principal: SessionCreatePrincipal;

The caller the session is created for, from the verified principal.

sessionId​
readonly sessionId: string;

The bare session id being created.

state​
readonly state: Readonly<Record<string, unknown>>;

The session's initial state, after the flow's stateSchema parsed it.

via​
readonly via: SessionCreatePath;

Which path is creating the session.

Methods​

readCollectionResource()​
readCollectionResource(ref, topic): Promise<Record<string, unknown> | undefined>;

Read the state of one item of a user- or org-scoped collection this flow declares, at the creating principal's own scope. ref is the accessor key in the flow's resources; topic is the item's key within the collection: a string for a wildcard pattern (projects/*), or the parameter values for a parameterized one ([topic]/notes). Resolves undefined when the item does not exist.

Bound to principal: there is no way to name another user's or another organization's scope through it.

Parameters​
ref​

string

topic​

string | Record<string, string>

Returns​

Promise<Record<string, unknown> | undefined>

Throws​

when ref is not a user- or org-scoped collection of this flow.


SessionCreateCheckResult​

type SessionCreateCheckResult =
| {
ok: true;
state?: Readonly<Record<string, unknown>>;
}
| {
message: string;
ok: false;
status?: 400 | 403 | 404;
};

A create check's answer.

Union Members​

Type Literal​
{
ok: true;
state?: Readonly<Record<string, unknown>>;
}

Create the session with the state it was given, plus state when the check returns one: fields it derived from what it read (a display name from the record it looked up), written over the initial state as the session is born. They are the check's to set, so it should refuse a create that seeds one itself.


Type Literal​
{
message: string;
ok: false;
status?: 400 | 403 | 404;
}

Refuse the create. Nothing is written. message reaches the caller. status is the HTTP status the create route answers with (default 400).


SessionCreatePath​

type SessionCreatePath = "create" | "action" | "webhook" | "cli" | "dispatch";

Which path is bringing a session into existence.


SessionCreatePrincipal​

type SessionCreatePrincipal = object;

The verified caller a session is being created for.

Properties​

orgId​
readonly orgId: string;
tenantId?​
readonly tenantId?: string;
userId​
readonly userId: string;

SessionItem​

type SessionItem = object;

Properties​

agentName?​
agentName?: string;
id​
id: string;
itemIndex​
itemIndex: number;
itemVisibility?​
itemVisibility?: ItemVisibility;

Transport and memory visibility of this item.

payload​
payload: unknown;
requestId​
requestId: string;
role?​
role?: MessageItem["role"];

A message item's role: user for the caller's message, assistant for one the flow emitted. The framework writes no other role on a message item. Absent on every other item type.

status​
status: ItemStatus;
transient?​
transient?: boolean;
ts?​
ts?: number;
type​
type: string;

SessionItemViews​

type SessionItemViews = object;

Properties​

all​
all: (query?) => SessionItem[];

Every session item. Respects includeTransient. No visibility filter.

Parameters​
query?​

ItemQuery

Returns​

SessionItem[]

client​
client: (query?) => SessionItem[];

Items where resolveItemVisibility(item).client === true. Excludes trace items.

Parameters​
query?​

ItemQuery

Returns​

SessionItem[]

history​
history: (query?) => Promise<LLMMessage[]>;

LLM-ready conversation history. Applies the transient filter, the type allowlist, resolveItemVisibility(item).history, role filtering, and limiting. Effectively returns only items whose resolved visibility includes them in history (conversational items with history:true + user messages).

Parameters​
query?​

ItemQuery

Returns​

Promise<LLMMessage[]>

selectForContext​
selectForContext: (query?) => SessionItem[];

Raw-query view for custom context assembly. Returns SessionItem[] unfiltered by visibility. Respects includeTransient per query, and honors the itemVisibility / agentName filters. Use this to build custom prompt context that reaches beyond the conversation-history default (e.g., a long-running sub-agent pulling its own prior outputs).

Parameters​
query?​

ItemQuery

Returns​

SessionItem[]

turns​
turns: (query?) => Promise<HistoryTurn[]>;

The session's past turns, oldest first. With no query: the turns the window holds, plus any turn of this session that has not settled yet (running or suspended, this request included), so a caller can tell which turns are still open and where this request stands among them. An interrupted turn is open too, since it can run again under its own id; one a retry re-ran is listed settled with no messages instead: it holds a place in the window, and history reads the retry. With requestIds: those turns, read from the store when the window no longer holds them.

Parameters​
query?​

HistoryTurnQuery

Returns​

Promise<HistoryTurn[]>


SessionLabel​

type SessionLabel = (session) => string | undefined;

See SessionConfig.label.

Parameters​

session​

SessionLabelInput

Returns​

string | undefined


SessionLabelInput​

type SessionLabelInput = object;

What SessionConfig.label is handed: the session as a reader sees it.

Properties​

id​
readonly id: string;

The session's id, as a caller addresses it.

state​
readonly state: Readonly<JsonObject>;

The state fields the session shows, with the schema's defaults applied.


SessionMetadata​

type SessionMetadata = object;

The readable first-class metadata fields on a session.

Properties​

description?​
description?: string;
tags?​
tags?: string[];
title?​
title?: string;

SessionMetadataInput​

type SessionMetadataInput = SessionMetadata & object;

Write input for setMetadata — includes first-class fields plus an arbitrary metadata bag for ad-hoc key-value storage.

Type Declaration​

metadata?​
metadata?: Record<string, unknown>;

SkillActivationSource​

type SkillActivationSource = "slash" | "keyword" | "classifier" | "manual-override";

Origin of a skill-activation match. Carried on MatchedSkill so downstream consumers (trace UI, telemetry) can branch on how the decision was reached.


SkillContextMode​

type SkillContextMode = "inline";

Activation mode for a skill, controlled by context: frontmatter.

  • inline (default, and now the only value): the skill body is injected into the in-flight generator on the next tool-loop step via the existing prepareStep machinery.

Both non-inline modes were removed: fork (an isolated subagent) and pattern (a session-global multi-agent dispatcher). The type is kept as a one-value union so its readers keep compiling and a future mode has a seam.


StateRef​

type StateRef<TState> = object & Pick<ScopeStateOps<TState>,
| "patchState"
| "setState"
| "incState"
| "pushState"
| "setStateRecord"
| "deleteStateRecord"
| "atomicState">;

Type Parameters​

TState​

TState extends object = Record<string, unknown>

Type Declaration​

input​
input: unknown;

The input value that was passed to this sequencer when it was executed.

instanceId​
instanceId: string;
name​
name: string;
state​
state: Readonly<TState>;

SubscriptionEvent​

type SubscriptionEvent = z.infer<typeof subscriptionEventSchema>;

SubscriptionSenderRole​

type SubscriptionSenderRole = typeof SUBSCRIPTION_SENDER_ROLES[number];

SuspendForUserCancelled​

type SuspendForUserCancelled = object;

The task was cancelled while the stop waited: nobody answered.

Properties​

cancelled​
readonly cancelled: true;

SuspensionReason​

type SuspensionReason = "user_approval" | "user_input" | "external_event" | string & object;

Why a block suspended. The well-known reasons are enumerated; the open string & {} arm lets callers carry custom reasons without losing autocomplete on the known set.


SuspensionShape​

type SuspensionShape = "approval" | "question" | "selection" | "form";

The default card a suspension dispatches to.


SuspensionSkipped​

type SuspensionSkipped = typeof SUSPENSION_SKIPPED;

The type of the SUSPENSION_SKIPPED sentinel.


SuspensionStatus​

type SuspensionStatus =
| "pending"
| "approved"
| "rejected"
| "submitted"
| "skipped"
| "timed_out"
| "expired"
| "stopped"
| "cancelled";

Lifecycle status of a suspension. pending is the sole non-terminal state.


TargetRef​

type TargetRef<TState> = StateRef<TState>;

Stable typed reference to a target block's stateful instance.

Type Parameters​

TState​

TState extends object = Record<string, unknown>


ToolCatalog​

type ToolCatalog = Record<string, GeneratorTool>;

A bag of executable tools that skills may reference by string key.

Tools are executable code and cannot round-trip through a resource collection — apps register them once and skills reference them by name via allowed-tools in frontmatter. Unknown refs are warned and skipped.


TypedEntries​

type TypedEntries<TEntry> = object;

The entries of one dispatch type, nested under the type so a per-type setting has a home beside them when one arrives. flow.internal.actions and flow.task.actions are the two an author declares here; the caller-facing public entries stay on flow.actions.

Type Parameters​

TEntry​

TEntry

Properties​

actions​
actions: Record<string, TEntry>;

UserAnswer​

type UserAnswer<T> =
| SuspendForUserCancelled
| {
answer: T;
cancelled: false;
};

How a review or an input came back: the answer, or cancelled.

Type Parameters​

T​

T = unknown


UserConfig​

type UserConfig = object;

Properties​

cas?​
cas?: CASOptions;
client?​
client?: ScopeClientConfig<JsonObject>;

See SessionConfig.client.

stateSchema?​
stateSchema?: ZodTypeAny;

ValidatedProjectedHit​

type ValidatedProjectedHit<TState> = object;

One validated, key-normalized search hit. storageKey is the pattern- canonical instance path (positions/AAPL) used to build refs/URIs; key is the bare key the app returned. Hits are in the hook's return order — the rank.

Type Parameters​

TState​

TState extends JsonObject = JsonObject

Properties​

key​
key: string;
state​
state: TState;
storageKey​
storageKey: string;

Variables​

DEFAULT_LOCAL_USER_ID​

const DEFAULT_LOCAL_USER_ID: "devuser" = "devuser";

The one local user the development tools act as when nobody names one: the DevTool's default and the default of fsdev run and fsdev chat. One value, so a stop a terminal run makes is listed for the DevTool that answers it. Like DEFAULT_ORG_ID, a development identity, not a security boundary.


FIRED_RECORDS_PATTERN​

const FIRED_RECORDS_PATTERN: "scheduled-fires/**" = "scheduled-fires/**";

Where the scheduled endpoint keeps each schedule's fired record: the latest scheduled time it fired, one row per schedule, in the user cell of the principal the schedule runs as. A flow that deletes a schedule deletes its record with it, through a collection over this pattern, at user scope. A key holds /, so any depth.


historySummaryResource​

const historySummaryResource: object & ResourceConfig & object;

The history summary's session resource at its default name: the definition every historySummary(...) without a name installs, so a screen reads the same one (useResource(historySummaryResource, { sessionId })). Its public face is the mark (throughRequestId), whether the summary is whole (complete) and how many folds it took; never the summary's words.

Type Declaration​

client​
readonly client: object;
client.expose​
readonly expose: readonly ["throughRequestId", "complete", "folds"];
default​
readonly default: object;
default.attempts​
attempts: number;
default.complete​
complete: boolean;
default.folds​
folds: number;
default.gap​
gap: boolean;
default.nextRequestId​
nextRequestId: string | null;
default.nextSettledRequestId​
nextSettledRequestId: string | null;
default.pending​
pending: string[];
default.summary​
summary: string | null;
default.throughRequestId​
throughRequestId: string | null;
default.throughStartedAtMs​
throughStartedAtMs: number | null;
ref​
readonly ref: string;
scope​
readonly scope: "session";
stateSchema​
readonly stateSchema: z.ZodObject<{
attempts: z.ZodDefault<z.ZodNumber>;
complete: z.ZodDefault<z.ZodBoolean>;
folds: z.ZodDefault<z.ZodNumber>;
gap: z.ZodDefault<z.ZodBoolean>;
nextRequestId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
nextSettledRequestId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
pending: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
summary: z.ZodDefault<z.ZodNullable<z.ZodString>>;
throughRequestId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
throughStartedAtMs: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
}, "strip", z.ZodTypeAny, {
attempts: number;
complete: boolean;
folds: number;
gap: boolean;
nextRequestId: string | null;
nextSettledRequestId: string | null;
pending: string[];
summary: string | null;
throughRequestId: string | null;
throughStartedAtMs: number | null;
}, {
attempts?: number;
complete?: boolean;
folds?: number;
gap?: boolean;
nextRequestId?: string | null;
nextSettledRequestId?: string | null;
pending?: string[];
summary?: string | null;
throughRequestId?: string | null;
throughStartedAtMs?: number | null;
}>;
writable​
readonly writable: true;
ClientType​
ClientType: Pick<{
attempts: number;
complete: boolean;
folds: number;
gap: boolean;
nextRequestId: string | null;
nextSettledRequestId: string | null;
pending: string[];
summary: string | null;
throughRequestId: string | null;
throughStartedAtMs: number | null;
}, "complete" | "folds" | "throughRequestId">;
ContextType​
ContextType: ResourceContext;
StateType​
StateType: object;
StateType.attempts​
attempts: number;
StateType.complete​
complete: boolean;
StateType.folds​
folds: number;
StateType.gap​
gap: boolean;
StateType.nextRequestId​
nextRequestId: string | null;
StateType.nextSettledRequestId​
nextSettledRequestId: string | null;
StateType.pending​
pending: string[];
StateType.summary​
summary: string | null;
StateType.throughRequestId​
throughRequestId: string | null;
StateType.throughStartedAtMs​
throughStartedAtMs: number | null;

MAX_SUBSCRIPTION_EVENT_TEXT​

const MAX_SUBSCRIPTION_EVENT_TEXT: 4000 = 4000;

The most text an event carries. A longer body is cut by the provider's normalize, never stored whole.


RESUME_ACTION_STATUS​

const RESUME_ACTION_STATUS: Record<ResumeAction, SuspensionStatus>;

The terminal status each resume action resolves a suspension to. Shared by the resume route (which writes the record status) and runAction (which stamps the suspension_resume audit item's resolution) so the two never drift.


SUBSCRIPTION_SENDER_ROLES​

const SUBSCRIPTION_SENDER_ROLES: readonly ["member", "collaborator", "bot", "outsider", "unknown"];

Who sent an event, as the provider sees them.


subscriptionEventSchema​

const subscriptionEventSchema: z.ZodObject<{
addressed: z.ZodOptional<z.ZodLiteral<true>>;
at: z.ZodNumber;
audience: z.ZodEnum<["public", "private"]>;
chain: z.ZodOptional<z.ZodString>;
closes: z.ZodOptional<z.ZodLiteral<true>>;
deliveryId: z.ZodOptional<z.ZodString>;
hop: z.ZodOptional<z.ZodNumber>;
kind: z.ZodString;
labels: z.ZodArray<z.ZodString, "many">;
object: z.ZodObject<{
id: z.ZodString;
version: z.ZodNumber;
}, "strict", z.ZodTypeAny, {
id: string;
version: number;
}, {
id: string;
version: number;
}>;
owner: z.ZodOptional<z.ZodObject<{
tenantId: z.ZodOptional<z.ZodString>;
userId: z.ZodString;
}, "strict", z.ZodTypeAny, {
tenantId?: string;
userId: string;
}, {
tenantId?: string;
userId: string;
}>>;
provider: z.ZodString;
received: z.ZodNumber;
sender: z.ZodObject<{
id: z.ZodString;
name: z.ZodString;
role: z.ZodEnum<["member", "collaborator", "bot", "outsider", "unknown"]>;
}, "strict", z.ZodTypeAny, {
id: string;
name: string;
role: "bot" | "collaborator" | "member" | "outsider" | "unknown";
}, {
id: string;
name: string;
role: "bot" | "collaborator" | "member" | "outsider" | "unknown";
}>;
text: z.ZodString;
threads: z.ZodArray<z.ZodString, "many">;
title: z.ZodString;
url: z.ZodString;
}, "strict", z.ZodTypeAny, {
addressed?: true;
at: number;
audience: "private" | "public";
chain?: string;
closes?: true;
deliveryId?: string;
hop?: number;
kind: string;
labels: string[];
object: {
id: string;
version: number;
};
owner?: {
tenantId?: string;
userId: string;
};
provider: string;
received: number;
sender: {
id: string;
name: string;
role: "bot" | "collaborator" | "member" | "outsider" | "unknown";
};
text: string;
threads: string[];
title: string;
url: string;
}, {
addressed?: true;
at: number;
audience: "private" | "public";
chain?: string;
closes?: true;
deliveryId?: string;
hop?: number;
kind: string;
labels: string[];
object: {
id: string;
version: number;
};
owner?: {
tenantId?: string;
userId: string;
};
provider: string;
received: number;
sender: {
id: string;
name: string;
role: "bot" | "collaborator" | "member" | "outsider" | "unknown";
};
text: string;
threads: string[];
title: string;
url: string;
}>;

The normalized event. Strict: a key it doesn't name is refused, so raw request parts can't ride along.


TERMINAL_SUSPENSION_STATUSES​

const TERMINAL_SUSPENSION_STATUSES: readonly SuspensionStatus[];

Suspension statuses that are past the pending phase. A suspension in any of these has been resolved (or aged out) and carries a resolvedAt, making it eligible for retention pruning. pending is the sole non-terminal status.


USER_SUSPENSION_REASONS​

const USER_SUSPENSION_REASONS: readonly string[];

Every stored reason that waits for a user: the two current names and the human_* names core 0.2.0 stored. The set isUserSuspension reads, exported so a store's SQL predicate reads the same one.

Functions​

addressEntries()​

function addressEntries(address): readonly string[];

Every entry name an address can reach: its action, or each name a per-row choice lists. What defineFlow and the run-time routability check verify, and what a board lists as where an assignee's rows can land.

Parameters​

address​

DispatchAddress

Returns​

readonly string[]


applyGetOrPatchState()​

function applyGetOrPatchState<TState, K>(
ref,
key,
compute
): Promise<TState[K]>;

Shared implementation of ResourceRef.getOrPatchState. Reads the key off the ref's live state getter; on a miss runs compute and persists the value through the ref's own patchState, so the normal change / reactive / client-projection seams fire exactly as a direct patch would. Factored out so every ResourceRef builder wires identical get-or-compute semantics instead of each re-deriving them. undefined from compute is left unstored.

Type Parameters​

TState​

TState extends JsonObject

K​

K extends string

Parameters​

ref​

Pick<ResourceRef<TState>, "state" | "patchState">

key​

K

compute​

() => TState[K] | Promise<TState[K]>

Returns​

Promise<TState[K]>


canonicalIndexValue()​

function canonicalIndexValue(value): string | undefined;

The canonical string of one index value, or undefined when it indexes nothing (null, undefined, a non-finite number). Types stay apart: 1, "1" and true give three strings. Throws on anything else.

Parameters​

value​

unknown

Returns​

string | undefined


canonicalIndexValues()​

function canonicalIndexValues(result): string[];

The canonical strings an index function's result gives: one per distinct value, in first-seen order. Empty when the row has no value for the index.

Parameters​

result​

unknown

Returns​

string[]


declaredIndexes()​

function declaredIndexes(config): DeclaredResourceIndex[];

The indexes a collection declares, normalised, in declaration order.

Parameters​

config​
indexes?​

Record<string, unknown>

Returns​

DeclaredResourceIndex[]


describeAction()​

function describeAction(address): string;

An address's action for messages: "name", or one of "a", "b" for a per-row choice.

Parameters​

address​

DispatchAddress

Returns​

string


encodeUserSegment()​

function encodeUserSegment(userId): string;

A user id as one path segment.

Opaque ids may contain / or .. Those are percent-encoded, and % is encoded too, so the mapping is injective. ownerSegment is built from it, so one user's owner segment cannot be a prefix of another's.

Parameters​

userId​

string

Returns​

string


extractBareTopic()​

function extractBareTopic(pattern, fullKey): string;

Strip the static pattern prefix from a full storage key, leaving the "bare topic" — the identifying portion a collection author addresses items by. Returns the full key unchanged when the prefix doesn't match (defensive against caller mismatches).

The inverse of resolveCollectionKey for wildcard patterns: extractBareTopic("positions/*", "positions/AAPL") → "AAPL".

Parameters​

pattern​

string

fullKey​

string

Returns​

string


extractPatternParams()​

function extractPatternParams(pattern): string[];

Extract parameter names from a pattern like [topic]/observations.

Parameters​

pattern​

string

Returns​

string[]


firedRecordCollectionKey()​

function firedRecordCollectionKey(flowKind, scheduleId): string;

A schedule's fired-record key within FIRED_RECORDS_PATTERN: the flow the schedule is dispatched on, then its dispatch id.

Parameters​

flowKind​

string

scheduleId​

string

Returns​

string


framed()​

function framed(value): string;

Length-prefix a field so field boundaries cannot migrate in a composed key: ("u_ab", "c") and ("u_a", "bc") would otherwise concatenate identically. The writer's half of the codec; readFramed is the reader's.

Parameters​

value​

string

Returns​

string


getPatternPrefix()​

function getPatternPrefix(pattern): string;

Get the static prefix of a pattern (everything before the first wildcard or param).

Parameters​

pattern​

string

Returns​

string


isCollectionConfig()​

function isCollectionConfig(value): value is ResourceCollectionConfig;

True when value is a collection config (has a string pattern).

Parameters​

value​

unknown

Returns​

value is ResourceCollectionConfig


isKnownTimeZone()​

function isKnownTimeZone(timezone): boolean;

Whether timezone is an IANA time zone this runtime knows: the check validateScheduleConfig runs, for a write path to run before it saves one.

Parameters​

timezone​

string

Returns​

boolean


isParameterizedPattern()​

function isParameterizedPattern(pattern): boolean;

Check whether a pattern uses parameterized segments.

Parameters​

pattern​

string

Returns​

boolean


isProjectedResourceCollection()​

function isProjectedResourceCollection(value): value is DefinedProjectedResourceCollection<JsonObject, ZodTypeAny, JsonValue>;

True when a value is a projected resource collection definition (carries the projected: true brand alongside __brand: "ResourceCollection"). Used by the engine to route reads through the backing hooks and by the tool layer to keep projected collections out of the CRUD / deterministic-match paths.

Parameters​

value​

unknown

Returns​

value is DefinedProjectedResourceCollection<JsonObject, ZodTypeAny, JsonValue>


isTerminalSuspensionStatus()​

function isTerminalSuspensionStatus(status): boolean;

True when status is a resolved/aged-out (non-pending) suspension status.

Parameters​

status​

SuspensionStatus

Returns​

boolean


isUserSuspension()​

function isUserSuspension(suspension): boolean;

Whether a suspension waits for a user: the one predicate every reader keys on (the claim gate, the answer route, the Inbox). True for a ctx.suspendForUser stop and for a raw ctx.suspend with user_approval or user_input. external_event and a custom reason (the open string & {} arm of SuspensionReason) are never a user's. A stop core 0.2.0 stored under its old human_* reason is a user's.

Parameters​

suspension​
reason​

string

Returns​

boolean


isWebhookServiceConfig()​

function isWebhookServiceConfig(sub): sub is WebhookServiceConfig;

Whether a provider's entry is a service route rather than a bindings map.

Parameters​

sub​

WebhookSubscriptionConfig

Returns​

sub is WebhookServiceConfig


matchesPattern()​

function matchesPattern(pattern, storageKey): boolean;

Check if a storage key matches a collection pattern.

Parameters​

pattern​

string

storageKey​

string

Returns​

boolean


matchesSuspensionFilter()​

function matchesSuspensionFilter(record, filter?): boolean;

Apply a SuspensionFilter to a single record. Shared by every adapter that filters suspensions in JS (memory, filesystem, the SQLite list path) so the flowKind/userId/sessionId/status/createdBefore/resolvedBefore semantics stay identical across stores. limit is a result-set bound, not a per-record predicate, so it is NOT applied here — callers slice after sorting.

Parameters​

record​

SuspensionRecord

filter?​

SuspensionFilter

Returns​

boolean


normalizeResourcePath()​

function normalizeResourcePath(raw): string;

Normalize a resource path:

  • Replace backslashes with forward slashes
  • Strip leading/trailing slashes
  • Collapse consecutive slashes
  • Reject path traversal (..)
  • Reject null bytes and control characters

Parameters​

raw​

string

Returns​

string


projectUserSuspension()​

function projectUserSuspension(selected): PendingUserSuspension;

Build a PendingUserSuspension field by field from what a store selected, deriving kind and shape. The one projector every store uses, so the four can't drift. It reads only the fields it names: a whole record passed in still yields only the projection, with no payload.

Parameters​

selected​

SelectedUserSuspension

Returns​

PendingUserSuspension


readFramed()​

function readFramed(input, at):
| {
next: number;
value: string;
}
| null;

Read one framed field starting at at: the value and where the next field begins, or null when the input does not have that shape.

Strict about the shape framed writes — the digits must be exactly the decimal spelling of the value's length (no leading zeros) and the value must be fully present. An empty value is accepted: framed("") is 0:, and a reader that needs non-empty fields checks that itself.

Parameters​

input​

string

at​

number

Returns​

| { next: number; value: string; } | null


readProjectedRecord()​

function readProjectedRecord<TState>(
config,
key,
ctx
): Promise<TState | undefined>;

Invoke a projected collection's read backing and validate the result through its stateSchema. Returns the parsed record, or undefined when the app has no such record (read resolved null). A record that fails stateSchema throws — never feed unvalidated app data into projection/render (§4.5).

The single source of truth for the read+validate contract, shared by the engine's resource registry (which wraps it with a per-request cache + single-flight) and the client route read helpers (which call it directly). key is the within-scope row key the app resolves against.

An org-scoped read for a session with no org binding has no trusted org coordinate (scopeId would be ""), so treat it as absent rather than let the hook query an empty/unscoped org bucket. Enforced here — the one place all three call sites (registry handle, scope client.data handle, and the item-state/content routes) funnel through — so the guard can't drift out of any single caller.

Type Parameters​

TState​

TState extends JsonObject

Parameters​

config​

Pick<ProjectedResourceCollectionConfig, "read" | "stateSchema" | "pattern">

key​

string

ctx​

ProjectedResourceContext

Returns​

Promise<TState | undefined>


resolveCollectionKey()​

function resolveCollectionKey(pattern, key): string;

Resolve a key (string or param object) into a storage path for a given pattern.

  • For wildcard patterns (files/*, files/**): key is a string appended to the prefix.
  • For parameterized patterns ([topic]/observations): key is an object like { topic: 'react' }.

Parameters​

pattern​

string

key​

string | Record<string, string>

Returns​

string


resolveTaskAction()​

function resolveTaskAction(
blockName,
address,
task,
ctx
): Promise<string>;

The entry a task dispatch goes to: the address's string as declared, or its per-row choice's answer for this task.

Parameters​

blockName​

string

address​
action​

string | TaskEntryChoice

The entry name — flow.task.actions[action] — or a choice among declared entry names, made per row (see TaskEntryChoice).

flowKind?​

string | TaskFlowTarget

The flow the entry lives on, when it is not this one. Same skip as an internal cross-flow address: defineFlow cannot see the other flow's map, so the seam resolves it. A function is looked up per task (see TaskFlowTarget) and is always cross-flow.

session​

TaskSessionPolicy<any>

state?​

| Readonly<Record<string, unknown>> | TaskStateTarget

The initial state each task's child session is created with: a fixed object, or looked up per task (see TaskStateTarget). A child that already exists keeps its own.

type​

"task"

wait?​

boolean

Whether the board's drain waits on a row it hands over. Absent follows the board's mode: a plan board waits, a delegation board doesn't. A board refuses one that contradicts its mode.

task​

TaskTargetQuery

ctx​

BlockContext

Returns​

Promise<string>

Throws​

no-entry when the choice answers a name its among does not list. Decided before anything is dispatched, like every refusal, so a board's dispatch still holds the claim.


resolveTaskSessionTarget()​

function resolveTaskSessionTarget(
blockName,
address,
envelope,
task,
ctx
): Promise<SessionTarget>;

The session a task dispatch runs in, for one row, as the seam takes it: the address's keyed child (see taskSessionKeyFor) with its initial state, or what a { by } policy answers for this row. A { key } answer is a child like any other and gets the address's state; an { id } answer is an existing session, which keeps its own, so the state is not looked up. Shared by dispatcher() and the board's dispatch, so both send the same row to the same session.

Parameters​

blockName​

string

address​
action​

string | TaskEntryChoice

The entry name — flow.task.actions[action] — or a choice among declared entry names, made per row (see TaskEntryChoice).

flowKind?​

string | TaskFlowTarget

The flow the entry lives on, when it is not this one. Same skip as an internal cross-flow address: defineFlow cannot see the other flow's map, so the seam resolves it. A function is looked up per task (see TaskFlowTarget) and is always cross-flow.

session​

TaskSessionPolicy<any>

state?​

| Readonly<Record<string, unknown>> | TaskStateTarget

The initial state each task's child session is created with: a fixed object, or looked up per task (see TaskStateTarget). A child that already exists keeps its own.

type​

"task"

wait?​

boolean

Whether the board's drain waits on a row it hands over. Absent follows the board's mode: a plan board waits, a delegation board doesn't. A board refuses one that contradicts its mode.

envelope​
assignee​

string

attempt​

number

boardId​

string

createdAt​

number

incarnationId?​

string

partition?​

string

payload?​

unknown

taskId​

string

turn?​

number

task​

TaskTargetQuery

ctx​

BlockContext

Returns​

Promise<SessionTarget>

Throws​

when a { by } policy answers anything but exactly one non-empty key or id, or the state target answers a non-object. Decided before anything is dispatched.


resource()​

function resource(uri, options?): (input, ctx) => MessageLike;

Slot helper for declaring resource dependencies in generator context slots. Returns a function compatible with GeneratorSlotReference that resolves a resource reference at execution time.

Parameters​

uri​

string

options?​

ResourceRefOptions

Returns​

(input, ctx) => MessageLike


resourceStorageKeys()​

function resourceStorageKeys(configs): Record<string, string>;

Build the accessor → storage key mapping for a resource config map.

Two accessors that point at the same DefinedResource object share a single persisted slot. The canonical key is the config's ref when set, otherwise the first accessor encountered in declaration order. Collections aren't single-slot resources — their instances use pattern-derived keys — so collection accessors map to themselves.

Stability of the canonical key​

When config.ref is set, the canonical key is ref — stable across deploys, refactors, and declaration-order changes. Set ref explicitly on defineResource() for any non-session-scoped resource you intend to dual-register: persisted user/org data only survives declaration reshuffles if the storage key is anchored to a stable value rather than an accessor name.

Without ref, the canonical key is the first accessor encountered in Object.entries(configs) order. For a single accessor this is the accessor name itself (stable). For dual-registered aliases the chosen key depends on how block-level resource declarations bubble up into flow.resources — reorganising actions, swapping sibling blocks, or moving a declaration from block-level to flow-level can shift it. For session-scoped resources this is harmless (session storage is transient); for user/org scope it can orphan data.

Parameters​

configs​

Record<string, unknown> | undefined

Returns​

Record<string, string>


searchProjectedRecords()​

function searchProjectedRecords<TState>(
config,
query,
ctx
): Promise<{
hits: ValidatedProjectedHit<TState>[];
nextCursor?: string;
}>;

Invoke a projected collection's search backing, validate every hit's state through stateSchema, and normalize each hit key to its canonical storage path. The search-side twin of readProjectedRecord — the single source of truth for the search+validate contract, shared by the engine's resource registry (list/search ref methods), the searchResources tool pushdown, and the cursor list route.

Unlike a single read, a hit that fails stateSchema is DROPPED and logged (not thrown) — one bad row must not sink a whole page (§4.3). The app's nextCursor is passed straight through for opaque pagination. The same org-binding guard as the read path — an org read with no org coordinate returns an empty page rather than querying an unscoped bucket.

Type Parameters​

TState​

TState extends JsonObject

Parameters​

config​

Pick<ProjectedResourceCollectionConfig, "search" | "stateSchema" | "pattern">

query​

ResourceQuery

ctx​

ProjectedResourceContext

Returns​

Promise<{ hits: ValidatedProjectedHit<TState>[]; nextCursor?: string; }>


serializeActionSchema()​

function serializeActionSchema(schema): ActionInputSchema;

Serialize a Zod action input schema into a JSON-serializable representation. Returns { type: "object", fields } for ZodObject schemas, or { type: "unsupported" } for non-object top-level schemas.

Parameters​

schema​

ZodTypeAny

Returns​

ActionInputSchema


suspendForUserKindOf()​

function suspendForUserKindOf(suspension): SuspendForUserKind | undefined;

The kind of a user's suspension: its own kind, or, on a record that carries none (a raw ctx.suspend), read from its reason: user_approval an approval, user_input input. undefined for a suspension that does not wait for a user.

Parameters​

suspension​
kind?​

SuspendForUserKind

reason​

string

Returns​

SuspendForUserKind | undefined


suspendForUserOn()​

function suspendForUserOn(ctx, options): Promise<
| SuspendForUserCancelled
| {
answer?: unknown;
approved: true;
cancelled: false;
}
| {
answer?: unknown;
approved: false;
cancelled: false;
deadline: boolean;
}
| {
answer: unknown;
cancelled: false;
}>;

Wait for a user on ctx: the body of ctx.suspendForUser, which the runtime binds to each block's context.

Parameters​

ctx​

SuspendForUserContext

options​

SuspendForUserOptions

Returns​

Promise< | SuspendForUserCancelled | { answer?: unknown; approved: true; cancelled: false; } | { answer?: unknown; approved: false; cancelled: false; deadline: boolean; } | { answer: unknown; cancelled: false; }>

Throws​

At a review's or an input's deadline.

Throws​

When the host has no durable execution, as ctx.suspend does.


suspensionShape()​

function suspensionShape(item): SuspensionShape;

Pick the default card shape for a suspension from its reason, allow, and resumeSchema. Shared by react's built-in ItemRenderer dispatch, the polished UI dispatcher and the server's read of a user's pending suspensions, so they never diverge:

  • user_approval → approval.
  • user_input whose permitted actions don't include submit → approval. This covers a legacy record persisted before allow existed (the resume route treats a missing allow as binary approve/reject) and an explicitly binary user_input gate — rendering a submit-only card for either would show a button the server 409s.
  • otherwise user_input → form (flat object) / selection (enum) / question (everything else, including a schema richer than the bounded set). Pure.

Parameters​

item​
allow?​

ResumeAction[]

reason​

string

resumeSchema?​

Record<string, unknown>

Returns​

SuspensionShape


validateScheduleConfig()​

function validateScheduleConfig(args): void;

Per-entry validator. Used at registration time for the static map and at dispatch time by the adapter for resolved dynamic schedules. Throws on malformed input — adapter callers translate the throw into a 400.

Static-origin ids must match the strict pattern; dynamic ids are validated separately by the dispatch route and skip the id format check here (they may legitimately contain : and /).

Parameters​

args​
id​

string

kind​

string

origin​

"static" | "dynamic"

schedule​

ScheduleConfig

Returns​

void


validateSchedulesConfig()​

function validateSchedulesConfig(flowKind, schedules): void;

Iterate schedules.static and validate every entry. Called from createFlowInstance at registration time. Dynamic entries are not validated here — the adapter validates each one at dispatch time.

Parameters​

flowKind​

string

schedules​

SchedulesConfig | undefined

Returns​

void


validateWebhookConfig()​

function validateWebhookConfig(flowKind, webhooks): void;

Validate a flow's webhooks config at registration time. No-op when webhooks is absent. Throws when a provider declares no on map, an on binding has no block (a webhook binding is an action, so a handler block is required), a binding's input/sessionId/when is present-but-not-a-function, or a provider/event key is empty. Event-key spelling is NOT validated against any provider vocabulary — keys are opaque strings.

Throws plain Error, matching validateSchedulesConfig; the adapter translates a registration failure into a hard startup abort.

Parameters​

flowKind​

string

webhooks​

WebhookConfig | undefined

Returns​

void

References​

ActionConfig​

Re-exports ActionConfig


ActionCore​

Re-exports ActionCore


ActionEntry​

Re-exports ActionEntry


ActionMcpConfig​

Re-exports ActionMcpConfig


bindTaskDispatcher​

Re-exports bindTaskDispatcher


BlockContext​

Re-exports BlockContext


BlockDefinition​

Re-exports BlockDefinition


BlockDispatchType​

Re-exports BlockDispatchType


BlockInput​

Re-exports BlockInput


BlockKind​

Re-exports BlockKind


BlockOutput​

Re-exports BlockOutput


BlockResult​

Re-exports BlockResult


BooleanAnswer​

Re-exports BooleanAnswer


BooleanQuestion​

Re-exports BooleanQuestion


CachingBreakpointMode​

Re-exports CachingBreakpointMode


CachingConfig​

Re-exports CachingConfig


CachingTtl​

Re-exports CachingTtl


canListVoices​

Re-exports canListVoices


canSpeak​

Re-exports canSpeak


canSpeakStream​

Re-exports canSpeakStream


canTranscribe​

Re-exports canTranscribe


ChoiceAnswer​

Re-exports ChoiceAnswer


ChoiceQuestion​

Re-exports ChoiceQuestion


CollectionHookContext​

Re-exports CollectionHookContext


CompositeVoiceProviderConfig​

Re-exports CompositeVoiceProviderConfig


ConcurrencyConfig​

Re-exports ConcurrencyConfig


ConcurrencyKey​

Re-exports ConcurrencyKey


ConcurrencyKeyContext​

Re-exports ConcurrencyKeyContext


ConcurrencyPolicyName​

Re-exports ConcurrencyPolicyName


ContextOf​

Re-exports ContextOf


CostEstimate​

Re-exports CostEstimate


CostEstimator​

Re-exports CostEstimator


createCompositeVoiceProvider​

Re-exports createCompositeVoiceProvider


DEFAULT_ORG_ID​

Re-exports DEFAULT_ORG_ID


DefinedProjectedResourceCollection​

Re-exports DefinedProjectedResourceCollection


DefinedResource​

Re-exports DefinedResource


DefinedResourceCollection​

Re-exports DefinedResourceCollection


defineProjectedResourceCollection​

Re-exports defineProjectedResourceCollection


defineResource​

Re-exports defineResource


defineResourceCollection​

Re-exports defineResourceCollection


defineScheduleBinding​

Re-exports defineScheduleBinding


defineWebhookBinding​

Re-exports defineWebhookBinding


DISPATCH_TYPES​

Re-exports DISPATCH_TYPES


DispatchAddress​

Re-exports DispatchAddress


DispatchOutcome​

Re-exports DispatchOutcome


DispatchRefusal​

Re-exports DispatchRefusal


DispatchRefusedError​

Re-exports DispatchRefusedError


DispatchSpec​

Re-exports DispatchSpec


DispatchType​

Re-exports DispatchType


EvaluationInput​

Re-exports EvaluationInput


EvaluationModel​

Re-exports EvaluationModel


EvaluationQuestionType​

Re-exports EvaluationQuestionType


EvaluatorAnswer​

Re-exports EvaluatorAnswer


EvaluatorAnswers​

Re-exports EvaluatorAnswers


EvaluatorOutput​

Re-exports EvaluatorOutput


EvaluatorQuestion​

Re-exports EvaluatorQuestion


EvaluatorQuestions​

Re-exports EvaluatorQuestions


EvictionPolicy​

Re-exports EvictionPolicy


FacetedClientConfig​

Re-exports FacetedClientConfig


FacetedCollection​

Re-exports FacetedCollection


FacetedCollectionConfig​

Re-exports FacetedCollectionConfig


FacetedState​

Re-exports FacetedState


FacetReindexInput​

Re-exports FacetReindexInput


FacetReindexOutput​

Re-exports FacetReindexOutput


FacetSearchInput​

Re-exports FacetSearchInput


FacetSearchOutput​

Re-exports FacetSearchOutput


FacetsOf​

Re-exports FacetsOf


FlowCardinality​

Re-exports FlowCardinality


FlowConfigInput​

Re-exports FlowConfigInput


FlowConfigValue​

Re-exports FlowConfigValue


FlowContextView​

Re-exports FlowContextView


FlowDefinition​

Re-exports FlowDefinition


FlowInstance​

Re-exports FlowInstance


FlowInstanceOptions​

Re-exports FlowInstanceOptions


FlowStateSettings​

Re-exports FlowStateSettings


FlowType​

Re-exports FlowType


formatScheduleId​

Re-exports formatScheduleId


GeneratorModel​

Re-exports GeneratorModel


GeneratorModelCallOptions​

Re-exports GeneratorModelCallOptions


GeneratorModelLoopOptions​

Re-exports GeneratorModelLoopOptions


GeneratorModelResult​

Re-exports GeneratorModelResult


GeneratorModelSource​

Re-exports GeneratorModelSource


GeneratorModelTool​

Re-exports GeneratorModelTool


GeneratorModelToolCall​

Re-exports GeneratorModelToolCall


GeneratorModelUsage​

Re-exports GeneratorModelUsage


GeneratorSearchConfig​

Re-exports GeneratorSearchConfig


HistoryTurn​

Re-exports HistoryTurn


InferFlowConfigFromSchema​

Re-exports InferFlowConfigFromSchema


InstanceOwnerPin​

Re-exports InstanceOwnerPin


InternalEntry​

Re-exports InternalEntry


isDefinedResourceCollection​

Re-exports isDefinedResourceCollection


isValidOrgId​

Re-exports isValidOrgId


JsonObject​

Re-exports JsonObject


JsonPrimitive​

Re-exports JsonPrimitive


JsonValue​

Re-exports JsonValue


KeyedTaskSessionPolicy​

Re-exports KeyedTaskSessionPolicy


ListVoicesCapable​

Re-exports ListVoicesCapable


markDispatcher​

Re-exports markDispatcher


MaybePromise​

Re-exports MaybePromise


McpConfig​

Re-exports McpConfig


ModelIdentity​

Re-exports ModelIdentity


ModelResolver​

Re-exports ModelResolver


ModelUsageEntry​

Re-exports ModelUsageEntry


NormalizedActions​

Re-exports NormalizedActions


OrgScopeHandle​

Re-exports OrgScopeHandle


ownerSegment​

Re-exports ownerSegment


PrepareStepFn​

Re-exports PrepareStepFn


PrepareStepResult​

Re-exports PrepareStepResult


ProjectedReactiveBindings​

Re-exports ProjectedReactiveBindings


ProjectedRecordHit​

Re-exports ProjectedRecordHit


ProjectedResourceCollectionConfig​

Re-exports ProjectedResourceCollectionConfig


ProjectedResourceContext​

Re-exports ProjectedResourceContext


ProviderTool​

Re-exports ProviderTool


RequestScopeHandle​

Re-exports RequestScopeHandle


resolveTaskFlowKind​

Re-exports resolveTaskFlowKind


resolveTaskState​

Re-exports resolveTaskState


ResourceCollectionConfig​

Re-exports ResourceCollectionConfig


ResourceCollectionRef​

Re-exports ResourceCollectionRef


ResourceContext​

Re-exports ResourceContext


ResourceIndexDeclaration​

Re-exports ResourceIndexDeclaration


ResourceIndexFunction​

Re-exports ResourceIndexFunction


ResourceIndexValue​

Re-exports ResourceIndexValue


ResourceQuery​

Re-exports ResourceQuery


ResourceSearchResult​

Re-exports ResourceSearchResult


ResourceVisibility​

Re-exports ResourceVisibility


ResourceVisibilityRule​

Re-exports ResourceVisibilityRule


ResourceVisibilityTarget​

Re-exports ResourceVisibilityTarget


ResumeAction​

Re-exports ResumeAction


ScheduleConfig​

Re-exports ScheduleConfig


ScheduleInputContext​

Re-exports ScheduleInputContext


ScheduleInputFn​

Re-exports ScheduleInputFn


ScheduleResolutionContext​

Re-exports ScheduleResolutionContext


ScheduleResolutionStores​

Re-exports ScheduleResolutionStores


SchedulesConfig​

Re-exports SchedulesConfig


ScopeStateOps​

Re-exports ScopeStateOps


ScoreAnswer​

Re-exports ScoreAnswer


ScoreQuestion​

Re-exports ScoreQuestion


SessionHistoryWindow​

Re-exports SessionHistoryWindow


SessionScopeHandle​

Re-exports SessionScopeHandle


SessionTarget​

Re-exports SessionTarget


SpeakCapable​

Re-exports SpeakCapable


SpeakChunk​

Re-exports SpeakChunk


SpeakOptions​

Re-exports SpeakOptions


SpeakResult​

Re-exports SpeakResult


SpeakStreamCapable​

Re-exports SpeakStreamCapable


StateOf​

Re-exports StateOf


StopRequestOutcome​

Re-exports StopRequestOutcome


SuspendForUserKind​

Re-exports SuspendForUserKind


SUSPENSION_SKIPPED​

Re-exports SUSPENSION_SKIPPED


TaskBinding​

Re-exports TaskBinding


taskBindingOf​

Re-exports taskBindingOf


TaskDispatchInput​

Re-exports TaskDispatchInput


taskDispatchInputSchema​

Re-exports taskDispatchInputSchema


TaskEntry​

Re-exports TaskEntry


TaskEntryChoice​

Re-exports TaskEntryChoice


TaskFlowTarget​

Re-exports TaskFlowTarget


TaskSessionChoice​

Re-exports TaskSessionChoice


taskSessionKeyFor​

Re-exports taskSessionKeyFor


TaskSessionPolicy​

Re-exports TaskSessionPolicy


TaskStateTarget​

Re-exports TaskStateTarget


TaskTargetQuery​

Re-exports TaskTargetQuery


TokenCounter​

Re-exports TokenCounter


ToolLifecycleEvent​

Re-exports ToolLifecycleEvent


ToolsConfig​

Re-exports ToolsConfig


TranscribeCapable​

Re-exports TranscribeCapable


TranscribeOptions​

Re-exports TranscribeOptions


TranscribeResult​

Re-exports TranscribeResult


TTSConfig​

Re-exports TTSConfig


UserMessageEcho​

Re-exports UserMessageEcho


UserScopeHandle​

Re-exports UserScopeHandle


validateConcurrencyConfig​

Re-exports validateConcurrencyConfig


ViewChange​

Re-exports ViewChange


ViewConfig​

Re-exports ViewConfig


ViewDefinition​

Re-exports ViewDefinition


ViewElement​

Re-exports ViewElement


ViewHearing​

Re-exports ViewHearing


ViewInput​

Re-exports ViewInput


ViewOutput​

Re-exports ViewOutput


ViewRunContext​

Re-exports ViewRunContext


ViewScope​

Re-exports ViewScope


VoiceAbilities​

Re-exports VoiceAbilities


VoiceConfig​

Re-exports VoiceConfig


VoiceError​

Re-exports VoiceError


VoiceErrorKind​

Re-exports VoiceErrorKind


VoiceErrorOptions​

Re-exports VoiceErrorOptions


VoiceInfo​

Re-exports VoiceInfo


VoiceProvider​

Re-exports VoiceProvider


WebhookBindingsConfig​

Re-exports WebhookBindingsConfig


WebhookConfig​

Re-exports WebhookConfig


WebhookEventBinding​

Re-exports WebhookEventBinding


WebhookInboundEvent​

Re-exports WebhookInboundEvent


WebhookServiceConfig​

Re-exports WebhookServiceConfig


WebhookServiceRoute​

Re-exports WebhookServiceRoute


WebhookSubscriptionConfig​

Re-exports WebhookSubscriptionConfig