Skip to main content

@flow-state-dev/workforce

Classes​

ProjectRefusedError​

A project or workstream write refused on the project's own terms.

Extends​

  • Error

Constructors​

Constructor​
new ProjectRefusedError(reason, detail): ProjectRefusedError;
Parameters​
reason​

ProjectRefusalReason

detail​

string

Returns​

ProjectRefusedError

Overrides​

Error.constructor

Properties​

cause?​
cause?: unknown;
Inherited from​

Error.cause

message​
message: string;
Inherited from​

Error.message

name​
name: string;
Inherited from​

Error.name

reason​
readonly reason: ProjectRefusalReason;
stack?​
stack?: string;
Inherited from​

Error.stack


WorkerTurnRefusedError​

Thrown when a turn can't run as the session's worker: it was fired, now names another flow, names something the installation no longer registers, or runs on a flow kept for standard workers. Nothing is written; the row and the session stay for a fix.

Extends​

  • Error

Constructors​

Constructor​
new WorkerTurnRefusedError(workerId, message): WorkerTurnRefusedError;
Parameters​
workerId​

string | undefined

message​

string

Returns​

WorkerTurnRefusedError

Overrides​

Error.constructor

Properties​

cause?​
cause?: unknown;
Inherited from​

Error.cause

code​
readonly code: "worker-turn-refused" = "worker-turn-refused";
message​
message: string;
Inherited from​

Error.message

name​
name: string;
Inherited from​

Error.name

stack?​
stack?: string;
Inherited from​

Error.stack

workerId​
readonly workerId: string | undefined;

Interfaces​

AgentWorkerFlowOptions​

What the app supplies. Everything else is a worker's own setting.

Properties​

afterAnswer?​
afterAnswer?: BlockDefinition<any, any, any, any>;

A block run after the worker answers, as a side-chain — it cannot change the answer, and a failure in it never fails a conversation turn. In a task it fails the attempt, as any background step's failure does, except in a task whose result goes to the conversation, where it is logged and the task keeps its answer.

It receives the answer generator's output: the assistant's reply text, as a string. .sideChain with no connector passes the preceding step's output straight through, and agent-answer declares no outputSchema. The type here is deliberately wide (core's own .sideChain takes BlockDefinition<any, any>), so a block expecting some other shape compiles and fails at run time — check yours against a string, or give it a connectInput connector that reads what it actually needs. mem.captureFromItems is the latter: its connector ignores this input and reads the session's items.

The write-side door. Memory's capture pipeline goes here (afterAnswer: mem.captureFromItems); without it a worker carrying memory reads what something else stored and records nothing of its own.

Omitted, the flow's sequence is exactly what it is today.

answerAgain?​
answerAgain?: true | BlockDefinition<any, any, any, any>;

Answer again, in the same request, with the tasks that finished while the worker answered. After the worker answers, this block runs; when it returns { message }, the worker answers again about that message, and the block runs again after that answer. Its input is the worker's answer.

  • true uses the package's pre-built block (finishedTasksAnswerAgain): it takes what finished (takeFinishedTasks), says each result as a line under its delegate's name, and tells the worker to use them.
  • A block replaces it, to change what the worker is told: finishedTasksAnswerAgain({ message }), or a sequencer of your own around takeFinishedTasks.

It feeds the one answer-again step the worker's plan already runs, so the answer after the plan and these count toward one cap, MAX_ANSWERS_AGAIN answers again per request. The take hands over nothing outside a turn a user's own message started, so in a task's turn, or a turn a notice or another worker's message started, results arrive after the turn as before. Only on an installation, where the worker files tasks.

Omitted, a turn answers once (and again after its plan), and every result is heard after the turn.

beforeAnswer?​
beforeAnswer?: BlockDefinition<any, any, any, any>;

A block run on every turn just before the worker answers, the mirror of afterAnswer. It runs as a .tap: it sees the turn's input and cannot change it, and its output is dropped. Unlike afterAnswer, a failure in it fails the turn, so a block that must not (a history summary's fold, say) rescues its own.

Every worker already folds older turns into a history summary by default. An app that wants its own summary puts its fold here (beforeAnswer: earlier.fold, with earlier.capability in uses), and it replaces the default: fold, context section and all.

Omitted, the flow's sequence is exactly what it is today.

catalog?​
catalog?: ToolCatalog;

The tools workers may name in their tools: setting, by key. A worker naming a key this catalog does not carry is refused at the mint.

Omitted, the built-in carries no tools at all — a tool is running code and a file on disk can only carry its name, so only the app holds the map.

classifierModel?​
classifierModel?: string;

Model the up-front matcher's third tier uses, when a worker opts in. Mirrors createSkillActivator's option of the same name.

An app-level option rather than a worker setting because the matcher is built once for the flow: a per-worker value could not be honoured, and a setting that is silently ignored is the failure this flow's tool handling exists to prevent.

confidenceThreshold?​
confidenceThreshold?: number;

Confidence the matcher's third tier must reach. Mirrors createSkillActivator.

installation?​
installation?: WorkerInstallation;

Run workers as data: one copy of this flow for every worker, each session naming its worker when it is created (the installation's create check), and each turn loading that worker's configuration before anything reads it. The drawer is kept per worker.

Omitted, the flow reads its settings off the copy, as a copy minted for one worker does.

isolateUserState?​
isolateUserState?: boolean;

Key this flow's user-scoped storage by the flow copy's id, instead of one cell the user's other flows share. Default: false, matching the framework.

Forwarded to the flow untouched. On an installation every worker runs on the one agent copy, so its workers still share one cell per user; only the skills drawer is kept per worker. On a copy minted for one worker, the key is that worker's id, so renaming it leaves its isolated data behind under the old name — and so does flipping this flag on a roster already in use.

A memory tier that declares its own flowIsolation (system({ semantic: { flowIsolation: false } })) wins over this flag in both directions, so one worker flow can isolate some tiers and share others.

maxSteps?​
maxSteps?: number;

How many model steps a turn may take: each step is one model call, and a step that calls tools leads to another. The last one offers no tools, so a worker still looking things up answers with what it found. Defaults to DEFAULT_MAX_STEPS (50). Raise it for workers that dig further: a researcher reading a whole repository spends a step per file.

model?​
model?: string;

Default model for workers that name none. Defaults to DEFAULT_MODEL.

settings?​
settings?: ZodRawShape;

The app's own settings a worker on this flow may set in its file, beside the flow's built-in ones, as a schema shape by key. Pair one with showSettings on the flow's registration and a view reads its value off the worker's roster() row: an icon, a color.

Refused when the flow is built if a key is one the flow already declares. Omitted, a worker's file can set only the built-in settings.

The flow never reads one of these to change how it runs: they only ride to the row. A setting that should change the flow's behaviour is a new built-in setting instead.

skills?​
skills?: InitialSkill[];

Skills seeded into the library every worker on this flow reads.

uses?​
uses?: UsesSlot;

Capabilities every worker on this flow carries, composed onto the answer generator beside the skills library — which stays first and is never displaced.

Deliberately generic. This is the door an app composes memory through (uses: [mem.capability.presets({ ... })]); it is not a memory option, and this package knows nothing about memory.

A STATIC entry's resources reach the flow on their own, through the generator's declaredResources and defineFlow's merge — so a capability passed as a plain ref needs nothing declared alongside it.

A DYNAMIC entry ((ctx) => refs) does not. UsesSlot accepts both, and a resolver function contributes context, tools and control tools only: resources have to exist before the block runs, so they must be declared statically somewhere (see UsesEntry in @flow-state-dev/core). Pass a capability dynamically and its stores are not installed by that entry alone.

A worker picks presets from what this option installs. A worker file's capabilities: key names a capability listed here and the presets that worker wants; a name that is not a top-level static entry of this array is refused at the mint. Selecting only ever ADDS to what the entry already carries — see ./worker-capabilities.

Tool-carrying presets ARE fenced. Core drops a capability's catalog-granted tools when the consuming block declares tools:, and this flow declares it on every worker — so a preset that ships a tool reaches a worker only when that worker's own file picks the preset and writes no tools: line, or names the tool in its line. A preset switched on here by default grants no worker anything it did not pick. A capability's controlTools are exempt by design.


BoardWakeBackfillOptions​

Properties​

now?​
readonly now?: number;

When the wakes fall due. Defaults to now.

userCell​
readonly userCell: (userId, orgId) => string;

The storage key of a user's cell, where user-scoped rows are kept: the engine's resolveUserStorageKey(userId, orgId, { id, isolateUserState: false }). The shared cell is the only one to read: the conversation ledger is partitioned, and a partitioned ledger is never isolated per flow (defineTaskCollection sets flowIsolation: false), also on a flow that isolates its user state.

Parameters​
userId​

string

orgId​

string

Returns​

string


BoardWakeBackfillStores​

The stores the backfill reads and writes: the engine's StoreRegistry fits.

Properties​

resourceState​
readonly resourceState: object;
getByPrefix()​
getByPrefix(
scopeType,
scopeId,
prefix
): Promise<Record<string, {
state: unknown;
}>>;
Parameters​
scopeType​

"user"

scopeId​

string

prefix​

string

Returns​

Promise<Record<string, { state: unknown; }>>

session​
readonly session: object;
list()​
list(options?): Promise<StoredSession[]>;
Parameters​
options?​
parentage?​

"all"

Returns​

Promise<StoredSession[]>

wakes?​
readonly wakes?: object;

Absent on a store that keeps no wakes: the backfill writes nothing.

owe()​
owe(input): Promise<unknown>;
Parameters​
input​
dueAt​

number

entry​

string

flowKind​

string

landBy​

number

orgId​

string

sessionId​

string

tenantId?​

string

userId​

string

Returns​

Promise<unknown>


CheckedTarget​

A target the check let through: the session it lands in, and the worker that runs it.

Properties​

sessionId​
readonly sessionId: string;
worker​
readonly worker: RosterWorker;

ClearShadowedReferencesInput​

Everything clearShadowedReferences needs.

Properties​

content​
content: ReferenceContentStore;

The engine's content store — stores.content.

dryRun?​
dryRun?: boolean;

Report what WOULD be cleared and delete nothing.

installedOn​
installedOn: ReferenceInstallFlow;

The flow the references were installed on. See the coordinate.

orgId​
orgId: string;

The org whose rows to check.

references​
references: DeclaredResources;

The app's references, keyed by ref — the map referencesFromDocs returns. Only these keys are touched; a resources/ document's row is never read and never deleted.


ClearShadowedReferencesResult​

What clearShadowedReferences found and did.

Properties​

checked​
checked: string[];

Every reference that was checked. cleared.length out of checked.length is the line worth logging, because "cleared 0" and "checked nothing" are the two outcomes a silent migration confuses.

cleared​
cleared: ShadowedReference[];

Every reference whose row was cleared — or WOULD be, when ClearShadowedReferencesResult.dryRun is true.

Empty is the ordinary answer — a tree that was never written to, or one already migrated. Non-empty is the finding: each entry is a file that was being ignored in favour of a stored write.

dryRun​
dryRun: boolean;

Whether this was a preview.

On the result, not only in the caller's memory, because describeShadowedReferences reads it. A preview that prints "have been cleared" is worse than no preview: an operator reads a completed migration, moves on, and leaves the stale content live.

scopeId​
scopeId: string;

The bucket the rows were addressed in, for a log that has to be believed.


ConnectorKeyStatus​

One offered connector, as the keys route answers it. Never the key.

Properties​

name​
name: string;
setAt​
setAt: string | null;

When the caller's key for it was set, ISO 8601; null when it isn't.


CoordinatorFlowOptions​

What the coordinator flow is built from.

Properties​

agent?​
agent?: Omit<AgentWorkerFlowOptions, "installation" | "taskLists" | "answerAgain">;

What the judgment turn is built with: the options the app gives the built-in agent flow (its tool catalog, capabilities, skills and model choices). Judgment is the agent's own turn, so a coordinator worker's model, tools, skills and capabilities read the way an agent worker's do, against the same catalog. Its isolateUserState keys this flow's user-scoped storage by its copy, as it does the agent flow's. Omitted, the agent's defaults.

installation​
installation: WorkerInstallation;

The worker installation the coordinator's workers, and their delegates, belong to.

roundDeadlineMs?​
roundDeadlineMs?: number;

How long a round waits for its answers, in whole milliseconds, before it closes without the ones still out and its answers go back out. Only a coordinator whose rounds: is above 0 has rounds to close. Defaults to five minutes (ROUND_DEADLINE_MS).

routeModel​
routeModel: string | EvaluationModel;

The model best fit's one fit check (../fit-check.ts) runs on: a model string the app's resolver turns into an evaluation model, or an evaluation model. Required; the package names no default, and an evaluator takes no intent.

routines?​
routines?: boolean;

true: the flow takes the four routine verbs as actions (listRoutines, saveRoutine, pauseRoutine, deleteRoutine), so its user keeps the routines that act through this conversation, among them an event routine with unmatched: true that hears what no other subscription heard, under its inferredWork:. Its providers are the ones hireWorkforce's routines.providers names. Omitted, a coordinator keeps no routines.


CustomScreen​

An app's own screen (D2): a function over the event, what the screens read of the subscription, and the running request. undefined passes; a string refuses, and is the reason. It runs in routing, in the service's request, and again at delivery, as the subscriber: an answer it reads (a document row, a permission) is read each time, so an edit applies to the next event.

Properties​

describe​
readonly describe: string;

What it passes, in a few words: the subscribe tool lists it, so a model knows when to list it.

resources?​
readonly resources?: Readonly<Record<string, DeclaredResourceEntry>>;

The resources it reads, declared on the steps that run it so the request carries them.

screen​
readonly screen: (event, entry, ctx) => string | Promise<string | undefined> | undefined;
Parameters​
event​
addressed?​

true

at​

number

audience​

"private" | "public"

chain?​

string

closes?​

true

deliveryId?​

string

hop?​

number

kind​

string

labels​

string[]

object​

{ id: string; version: number; }

object.id​

string

object.version​

number

owner?​

{ tenantId?: string; userId: string; }

owner.tenantId?​

string

owner.userId​

string

provider​

string

received​

number

sender​

{ id: string; name: string; role: "bot" | "collaborator" | "member" | "outsider" | "unknown"; }

sender.id​

string

sender.name​

string

sender.role​

"bot" | "collaborator" | "member" | "outsider" | "unknown"

text​

string

threads​

string[]

title​

string

url​

string

entry​
botsScreenedBy?​

string

followRev?​

2

hearsClose?​

true

hostScreens?​

( | { any: string[]; screen: "labels"; } | { any: string[]; screen: "words"; } | { bots?: string[]; ids: string[]; screen: "allow"; } | { name: string; screen: "custom"; } | { screen: "interest"; })[]

interest?​

string

kinds?​

string[]

orgId​

string

outsiders?​

true

provider​

string

screens​

( | { any: string[]; screen: "labels"; } | { any: string[]; screen: "words"; } | { bots?: string[]; ids: string[]; screen: "allow"; } | { name: string; screen: "custom"; } | { screen: "interest"; })[]

self?​

string

tenantId?​

string

thread​

string

unmatched?​

true

userId​

string

ctx​

BlockContext

Returns​

string | Promise<string | undefined> | undefined


DeclaredRoutine​

A routine the app declares in config (routines.declared). Seeded for each user when their roster flow runs a request, or for its owner only.

Properties​

description?​
readonly description?: string;
id​
readonly id: string;

Stable across deploys: the stored key is derived from it.

owner?​
readonly owner?: object;

Seed it for this one user only. Omitted, for every user.

orgId​
readonly orgId: string;
userId​
readonly userId: string;
task?​
readonly task?: object;

A clock routine's task, its filer named.

assignee?​
assignee?: string;
filer​
filer: string;
goal​
goal: string;
input?​
input?: Record<string, unknown>;
metadata?​
metadata?: Record<string, unknown>;
priority?​
priority?: number;
title?​
title?: string;
trigger​
readonly trigger:
| {
clock: {
cron: string;
timezone?: string;
};
}
| {
event: {
everyMinutes?: number;
interest: string;
kinds?: string[];
outsiders?: true;
provider: string;
screens?: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: string[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
thread: string;
unmatched?: true;
};
};
worker?​
readonly worker?: string;

An event routine's hearer.


DeclaredWorkerId​

A declared worker's id, read back into the folder names it was minted from.

Properties​

name​
name: string;

The worker's own folder name.

team?​
team?: string;

The team folder, or undefined for an org worker (org/workers/<name>/).


DeclaredWorkforce​

The declared half, as the sources need it — a structural subset of DeclaredRoster, so readDeclaredRoster(...)'s result satisfies it directly.

Typed this loosely on purpose: a hand-built roster is as valid a declaration as a walked tree, and requiring the loader's exact return would drag a node-only type into a node-free module.

Properties​

workers​
workers: readonly WorkerManifest[];

One record per declared worker.


DelegateAnswer​

A delegate's answer, as its item names it.

Properties​

taskId​
readonly taskId: string;

The task it answered, by id.

worker​
readonly worker: string;

The worker that answered, by id.


ErrorHistoryCollectionOptions​

Options for defineErrorHistoryCollection.

Properties​

reporter?​
readonly reporter?: ErrorReporter;

The reporter whose history it reads. Absent (a Lab with no Error Reporter): the view has no record.


ErrorReporter​

The reporter: the engine's handler, the host binding, and what its flow reads.

Properties​

flowKind​
readonly flowKind: string;
limits​
readonly limits: Partial<ReportLimits> | undefined;
operator​
readonly operator: ErrorReporterOperator;
preview​
readonly preview:
| {
autoFile?: readonly string[];
autoFileAfterMs?: number;
}
| undefined;
Union Members​
Type Literal​
{
autoFile?: readonly string[];
autoFileAfterMs?: number;
}
autoFile?​
readonly autoFile?: readonly string[];

Error codes, or sources (request / task / manual / storm), that file without a preview. Default none.

autoFileAfterMs?​
readonly autoFileAfterMs?: number;

File as drafted when the preview goes unanswered this long. Default never.


undefined

tracker​
readonly tracker:
| {
hint?: string;
project: string;
}
| undefined;
Union Members​
Type Literal​
{
hint?: string;
project: string;
}
hint?​
readonly hint?: string;

A hint for the filing run, such as the tracker's team.

project​
readonly project: string;

The project whose MCP servers reach the tracker, as <visibility>/<id> (shared/storefront).


undefined

worker​
readonly worker: string;

Methods​

bind()​
bind(host): Promise<void>;

Bind the runtime, and restart what the store says is still owed.

Parameters​
host​

ErrorReporterHost

Returns​

Promise<void>

capture()​
capture(event): void;

The engine's errorCapture handler. Takes final events only; never throws.

Parameters​
event​

FinalFailureEvent

Returns​

void

dispose()​
dispose(): void;

Start nothing more: a host that is closing calls it before its stores close. What is owed stays owed.

Returns​

void

dossierOf()​
dossierOf(row): Promise<Record<string, unknown>>;

The dossier a report is drafted from, gathered by code.

Parameters​
row​
approved?​

{ instructions?: string; }

approved.instructions?​

string

claim?​

{ by: string; until: number; }

claim.by​

string

claim.until​

number

commentOwed?​

boolean

context?​

{ links?: Record<string, string>; project?: string; }

Record<string, string>

context.project?​

string

count​

number

countAtLastComment?​

number

description?​

string

dismissedUntil?​

number

draft?​

{ body: string; questions: string[]; title: string; }

draft.body​

string

draft.questions​

string[]

draft.title​

string

earlier?​

object[]

errorClass​

string

filedAt?​

number

fingerprint​

string

firstSeenAt​

number

heldRequests?​

object[]

id​

string

issue?​

{ identifier?: string; url: string; }

issue.identifier?​

string

issue.url​

string

kind​

"report" | "storm"

lastCommentAt?​

number

lastRunError?​

string

lastSeenAt​

number

named?​

{ by?: string; project?: string; sessionId?: string; taskId?: string; }

named.by?​

string

named.project?​

string

named.sessionId?​

string

named.taskId?​

string

occurrences​

object[]

parts​

{ actionName: string; blockPath?: string; code?: string; flowKind: string; message: string; }

parts.actionName​

string

parts.blockPath?​

string

parts.code?​

string

parts.flowKind​

string

parts.message​

string

previousIssue?​

{ identifier?: string; url: string; }

previousIssue.identifier?​

string

previousIssue.url​

string

runs​

number

seen?​

string[]

sessionId?​

string

source​

"task" | "request" | "storm" | "manual"

status​

| "filing" | "filed" | "closed" | "dismissed" | "drafting" | "owed" | "previewing"

storm?​

{ entries: object[]; windowStart: number; }

storm.entries​

object[]

storm.windowStart​

number

task?​

{ assignee?: string; error: string; goal?: string; title?: string; }

task.assignee?​

string

task.error​

string

task.goal?​

string

task.title?​

string

userIds?​

string[]

Returns​

Promise<Record<string, unknown>>

follow()​
follow(decision): void;

Start what an intake's decision owes: a report's run, or a counted comment.

Parameters​
decision​

IntakeDecision

Returns​

void

idle()​
idle(): Promise<void>;

Resolves when every run the reporter started so far has settled.

Returns​

Promise<void>

inboxLinkOf()​
inboxLinkOf(reportId): string | undefined;

The Lab's link to a report's Inbox item (its inboxLink), or undefined when it names none. Give it to the operator only.

Parameters​
reportId​

string

Returns​

string | undefined

log()​
log(message): void;

Where the reporter says what went wrong with itself: the Lab's log.

Parameters​
message​

string

Returns​

void

readHistory()​
readHistory(request): Promise<object[] | undefined>;

The history records one reader may read, read as the operator through the bound host and projected inside that run: one record by ref, or a search's hits. undefined before the bind.

Parameters​
request​

Who reads (from a trusted caller), which days, and what.

days​

string[]

limit?​

number

prefix?​

string

ref?​

string

string

viewer​

| { kind: "operator"; } | { kind: "user"; userId: string; }

Returns​

Promise<object[] | undefined>

say()​
say(text, forOperator?): Promise<void>;

A line in the reporter's conversation; forOperator instead when that conversation is the operator's.

Parameters​
text​

string

forOperator?​

string

Returns​

Promise<void>

secrets()​
secrets(): readonly string[];

The Lab's own secrets.

Returns​

readonly string[]

takes()​
takes(event): boolean;

Whether the Lab's filter takes this failure. A filter that throws takes nothing.

Parameters​
event​

FinalFailureEvent

Returns​

boolean


ErrorReporterFlowOptions​

Options for defineErrorReporterFlow.

Properties​

agent?​
agent?: Omit<AgentWorkerFlowOptions, "installation">;

The conversation turn's options: its model and catalog.

cwd?​
cwd?: string | ((ctx) => string | Promise<string>);

Where the harness reads the code: a directory, or one per run. Default process.cwd().

harness​
harness: (feeds) => HarnessBlock;

Build the harness from its feeds. Claude Code in a Lab; read-only tools are enough to draft.

Parameters​
feeds​

ErrorReporterHarnessFeeds

Returns​

HarnessBlock

installation​
installation: WorkerInstallation;

The worker installation the reporter's WORKER.md is a standard worker of.

mcpTools?​
mcpTools?: ProjectMcpToolsResolver;

The Lab's project MCP servers (projectMcpTools), through which a report files.

reporter​
reporter: ErrorReporter;

The reporter this flow serves: its worker, operator, tracker, limits and preview.


ErrorReporterHarnessFeeds​

What the harness is handed per run, as a coding harness is.

Properties​

cwd​
cwd: (ctx) => string | Promise<string>;

Where the run reads the code.

Parameters​
ctx​

HarnessCallbackContext

Returns​

string | Promise<string>

mcpTools?​
mcpTools?: ProjectMcpToolsResolver;

The project's MCP servers, every call's arguments redacted. Handed only to the harness that files and comments, after the operator approved; the one that drafts gets none.


ErrorReporterHost​

The runtime operations a Lab hands the reporter.

Properties​

conversationSessionId?​
readonly conversationSessionId?: string;

The reporter's conversation, where it says what it filed.

Methods​

openSession()​
openSession(open): Promise<void>;

Make sure a session exists, created with state when it doesn't.

Parameters​
open​
flowKind​

string

orgId​

string

sessionId​

string

state​

Readonly<Record<string, unknown>>

userId​

string

Returns​

Promise<void>

readRequest()?​
readRequest?(requestId): Promise<unknown>;

What one request was: its input, status and error.

Parameters​
requestId​

string

Returns​

Promise<unknown>

readSession()​
readSession(sessionId): Promise<ReporterSessionFacts | undefined>;

What one session holds, or undefined when it doesn't exist.

Parameters​
sessionId​

string

Returns​

Promise<ReporterSessionFacts | undefined>

readSessionState()?​
readSessionState?(sessionId): Promise<Readonly<Record<string, unknown>> | undefined>;

Only a session's state, or undefined: read for every final failure, to hold a task's failed request for its ending. Without it, readSession is used.

Parameters​
sessionId​

string

Returns​

Promise<Readonly<Record<string, unknown>> | undefined>

recentSessions()?​
recentSessions?(userId, limit): Promise<ReporterSessionFacts[]>;

A user's newest sessions, for a problem a user reported without naming one.

Parameters​
userId​

string

limit​

number

Returns​

Promise<ReporterSessionFacts[]>

run()​
run(request): Promise<ReporterRunResult>;

Run an action of a flow as userId. source: "internal" reaches an internal entry.

Parameters​
request​
action​

string

flowKind​

string

input​

unknown

orgId​

string

sessionId​

string

source​

"internal" | "http"

userId​

string

Returns​

Promise<ReporterRunResult>


ErrorReporterIntakeFlowOptions​

Options for defineErrorReporterIntakeFlow.

Properties​

reporter​
reporter: ErrorReporter;

The reporter the intake starts runs for.


ErrorReporterOperator​

Who a report waits on and files as: the Lab's operator.

Properties​

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

ErrorReporterOptions​

Options for createErrorReporter.

Properties​

filter?​
readonly filter?: (event) => boolean;

Report only the failures this returns true for.

Parameters​
event​

FinalFailureEvent

Returns​

boolean

readonly inboxLink?: (report) => string;

The link that opens a report's Inbox item, built from the report's own session (error-report~<id>), where its preview waits. Only the operator is given it. Absent: the reporter says where a report waits, with no link.

Parameters​
report​
sessionId​

string

Returns​

string

limits?​
readonly limits?: Partial<ReportLimits>;

The intake's limits.

readonly links?: (ids) => Record<string, string>;

Links for an occurrence (a devtool trace, a Shift Manager page), by label.

Parameters​
ids​
at​

number

attempt?​

number

boardId?​

string

orgId?​

string

partition?​

string

requestId?​

string

sessionId?​

string

taskId?​

string

userId?​

string

Returns​

Record<string, string>

log?​
readonly log?: (message) => void;

Where the reporter says what went wrong with itself. Default console.warn.

Parameters​
message​

string

Returns​

void

operator​
readonly operator: ErrorReporterOperator;

Who previews and files.

preview?​
readonly preview?: object;

The preview. Every report waits for it unless named here.

autoFile?​
readonly autoFile?: readonly string[];

Error codes, or sources (request / task / manual / storm), that file without a preview. Default none.

autoFileAfterMs?​
readonly autoFileAfterMs?: number;

File as drafted when the preview goes unanswered this long. Default never.

secrets?​
readonly secrets?: () => readonly string[];

Values no report may hold, beside the environment's keys and the operator's MCP keys.

Returns​

readonly string[]

tracker?​
readonly tracker?: object;

Where reports file: a project whose MCP servers reach the tracker. Absent: reports are kept and not filed.

hint?​
readonly hint?: string;

A hint for the filing run, such as the tracker's team.

project​
readonly project: string;

The project whose MCP servers reach the tracker, as <visibility>/<id> (shared/storefront).

worker​
readonly worker: string;

The reporter's worker id: the WORKER.md its sessions run.


FinalFailureEvent​

A final failure, as the engine's errorCapture hands it: only the fields the reporter reads. An event without final is a block's error on the way, and is never reported.

Properties​

actionName​
readonly actionName: string;
blockName?​
readonly blockName?: string;
blockPath?​
readonly blockPath?: string;
error​
readonly error: object;
code?​
readonly code?: string;
message​
readonly message: string;
final?​
readonly final?: true;
flowKind​
readonly flowKind: string;
orgId?​
readonly orgId?: string;
requestId​
readonly requestId: string;
sessionId?​
readonly sessionId?: string;
userId​
readonly userId: string;

FingerprintParts​

The parts a fingerprint is made from.

Properties​

actionName​
readonly actionName: string;
blockPath?​
readonly blockPath?: string;
code?​
readonly code?: string;
flowKind​
readonly flowKind: string;
message​
readonly message: string;

FinishedTasksAnswerAgainOptions​

What finishedTasksAnswerAgain is built with.

Properties​

message?​
readonly message?: (finished) => string;

What the worker is told when tasks finished while it answered, from the lines the take said. Default: the lines, and to use them in its answer.

Parameters​
finished​

readonly object[]

Returns​

string


FollowPullRequestOptions​

What followPullRequest is built with.

Properties​

botsScreenedBy?​
readonly botsScreenedBy?: string;

Hand every bot sender on to this custom screen, which screens must list, rather than only the bots the service trusts: that screen decides which bots this follow hears. No other subscription is affected.

installation?​
readonly installation?: WorkerInstallation;

The app's installation, when the app polls: following a pull request makes the user's poll for it once hireWorkforce was given routines.poll.

onFollowed?​
readonly onFollowed?: (pr, outcome, ctx) => void | Promise<void>;

Called with what each subscribe came to, for a host that records it.

Parameters​
pr​

RecordedPullRequest

outcome​

SubscribeOutcome

ctx​

BlockContext

Returns​

void | Promise<void>

outsiders?​
readonly outsiders?: true;

Also hear senders outside the project (not members, collaborators or trusted bots). Only with a screen that names who is heard, such as an allow list: on its own it lets anyone through.

providers​
readonly providers: readonly SubscriptionProvider[];

The providers a session may subscribe on; GitHub's must be among them.

screens?​
readonly screens?: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: string[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];

The screens the follow lists, for a host whose coding session acts on what it hears: an event they refuse never reaches the session (a custom screen such as the trusted reviewers' list screen, declared on the provider). Absent: every sender the sender screen passes.


GitHubEventInput​

One GitHub event, as the webhook route or a poll hands it to normalizeGitHubEvent. Pinned.

Properties​

deliveryId?​
readonly deliveryId?: string;

The webhook's delivery id: provenance only.

eventType​
readonly eventType: string;

The event name: the webhook's X-GitHub-Event (pull_request_review, check_run, …).

payload​
readonly payload: unknown;

The webhook payload, or a poll's object of the same shape.

received​
readonly received: number;

When the service received it, in ms.


GitHubNormalizeOptions​

What normalize reads besides the event.

Properties​

agentHandles?​
readonly agentHandles?: readonly string[];

The app's agent handles (logins, any case, [bot] or not): an event that mentions, assigns or asks one for review is addressed.


GitHubServiceFlowOptions​

What githubServiceFlow is built with.

Properties​

agentHandles?​
readonly agentHandles?: readonly string[];

The app's agent handles: an event that mentions one (outside quotes and code), assigns one, or requests its review is addressed. Default the provider's App bot login, when it has one; else none.

capPerHour?​
readonly capPerHour?: number;

The most messages one subscription sends in an hour.

forwards?​
readonly forwards?: object;

The kinds of event forwarded to a coordinator that follows the thread unmatched, when no other subscription heard one (["issue", "comment"]). Unset, nothing is forwarded.

kinds​
readonly kinds: readonly string[];
installation​
readonly installation: WorkerInstallation;

The app's worker installation: the sessions it delivers to run its workers.

kind?​
readonly kind?: string;

The flow kind, and so the webhook URL's flow segment. Default GITHUB_SERVICE_FLOW.

maxOwnerRuns?​
readonly maxOwnerRuns?: number;

The most subscriptions one event is delivered to.

poll?​
readonly poll?: boolean;

Poll GitHub for subscriptions with no webhook: see defineSubscriptionServiceFlow's poll.

provider​
readonly provider: GitHubSubscriptionProvider;

GitHub's provider (githubSubscriptionProvider): the same one the coding sessions subscribe on.

trustedBots?​
readonly trustedBots?: readonly string[];

Bot ids the sender screen lets through, without [bot] (github-actions, codex).


GitHubSubscriptionProvider​

GitHub's provider: a SubscriptionProvider, with the App's bot login when it has one.

Extends​

Properties​

agentHandle?​
readonly agentHandle?: string;

The App's bot login as an id (acme-agent), when the app is a GitHub App.

provider​
readonly provider: string;

The provider key, as events and thread keys carry it (github).

Inherited from​

SubscriptionProvider.provider

screens?​
readonly screens?: SubscriptionScreens;

The app's own screens on this provider, declared once: its custom functions, and the model interest asks.

Inherited from​

SubscriptionProvider.screens

Methods​

canRead()​
canRead(thread, ctx): boolean | Promise<boolean>;

Whether the running request's user can read thread. Asked at subscribe, and again before a private event is delivered.

Parameters​
thread​

string

ctx​

BlockContext

Returns​

boolean | Promise<boolean>

Inherited from​

SubscriptionProvider.canRead

poll()?​
poll?(
thread,
cursor,
ctx
): Promise<SubscriptionPollResult>;

Fetch what happened on thread since the cursor, as the running request's own user, on that user's credentials (ER-4): normalized events, each named by the same object and version a webhook delivery of it names. With etags, a provider may answer unchanged when nothing moved. Absent, the provider's subscriptions are never polled.

Parameters​
thread​

string

cursor​

SubscriptionPollCursor

ctx​

BlockContext

Returns​

Promise<SubscriptionPollResult>

Inherited from​

SubscriptionProvider.poll

refuses()?​
refuses?(thread, kinds): string | undefined;

Why a subscription to thread hearing kinds can't be taken, naming what can (an undeclared topic or kind), or undefined when it can. Asked at subscribe, before canRead. Absent, nothing is refused here.

Parameters​
thread​

string

kinds​

readonly string[] | undefined

Returns​

string | undefined

Inherited from​

SubscriptionProvider.refuses

self()?​
self?(ctx, hearer): string | Promise<string | undefined> | undefined;

The running user's own id at the provider, so their own actions are dropped (own). hearer is the session the subscription is written for: a provider whose senders are sessions (internal events) answers it.

Parameters​
ctx​

BlockContext

hearer​
sessionId​

string

Returns​

string | Promise<string | undefined> | undefined

Inherited from​

SubscriptionProvider.self


GitHubSubscriptionProviderOptions​

What githubSubscriptionProvider is built with.

Properties​

apiUrl?​
readonly apiUrl?: string;

GitHub's REST API root. Default https://api.github.com (a GitHub Enterprise host names its own).

appBotLogin?​
readonly appBotLogin?: string;

The GitHub App's bot login, when the app is a GitHub App (acme-agent[bot]): the agent handle githubServiceFlow asks by default.

fetch?​
readonly fetch?: (input, init?) => Promise<Response>;

The fetch it calls. Default the global one.

MDN Reference

Parameters​
input​

RequestInfo | URL

init?​

RequestInit

Returns​

Promise<Response>

screens?​
readonly screens?: SubscriptionScreens;

The app's own screens on GitHub: its custom functions, and the model the interest screen asks. Without an interestModel, a subscription that lists interest is refused.

Methods​

token()​
token(ctx): string | Promise<string | undefined> | undefined;

The running user's GitHub token, from the app's own store; none reads nothing. Never from the request's input.

Parameters​
ctx​

BlockContext

Returns​

string | Promise<string | undefined> | undefined


GitHubTrustedReviewers​

The trusted reviewers, as a host installs them: githubTrustedReviewers.

Properties​

capability​
readonly capability: DefinedCapability;

The same tool as a capability, githubReviewers, with the document: for a worker that writes no tools: line, which picks it under capabilities: (githubReviewers: [tool]). Picked by no worker, it grants nothing.

document​
readonly document: DeclaredResourceEntry;

The github-reviewers document, its definition content built from GITHUB_REVIEWERS.

resources​
readonly resources: Readonly<Record<string, DeclaredResourceEntry>>;

{ [GITHUB_REVIEWERS_DOC]: document }, for a block or flow that declares it.

tool​
readonly tool: SequencerDefinition<{
logins: string[];
}>;

The coordinator's setGitHubReviewers tool: the list's only writer, on the operator's own typed word, judged, and approved in Inbox. A worker holds it by naming it in its tools: line.

Methods​

follow()​
follow(github): (installation) => PullRequestFollower;

The follower a coding run's pull request is followed through: followPullRequest listing the list screen first, taking outsiders, and handing bots on to it. github must declare the screen (operatorGitHub({ reviewers }) does).

Parameters​
github​

SubscriptionProvider

Returns​

(installation) => PullRequestFollower

read()​
read(ctx): Promise<string[]>;

The listed accounts, read from the document for this request: the stored row, else the default.

Parameters​
ctx​

BlockContext

Returns​

Promise<string[]>


GitHubTrustedReviewersOptions​

What githubTrustedReviewers is built with.

Properties​

env?​
readonly env?: Readonly<Record<string, string | undefined>>;

Where GITHUB_REVIEWERS is read from, once, when this is called. Default process.env.

holders​
readonly holders: readonly string[];

The workers that may use the tool (worker ids): the host's coordinator. Any other worker that reaches it, a hired one that picked its capability or named it in tools:, is refused.

judgeModel​
readonly judgeModel: string;

The evaluation model the tool's judge reads the operator's message on.

operator​
readonly operator: string;

The one user who may change the list: the host's operator, as the session's server-set user.


GitHubTrustedReviewersScreenOptions​

What githubTrustedReviewersScreen is built with.

Properties​

apiUrl?​
readonly apiUrl?: string;

GitHub's REST API root. Default https://api.github.com.

fetch?​
readonly fetch?: (input, init?) => Promise<Response>;

The fetch it calls. Default the global one.

MDN Reference

Parameters​
input​

RequestInfo | URL

init?​

RequestInit

Returns​

Promise<Response>

resources?​
readonly resources?: Readonly<Record<string, DeclaredResourceEntry>>;

The resources reviewers reads, declared on the steps that run the screen.

Methods​

reviewers()​
reviewers(ctx): readonly string[] | Promise<readonly string[]>;

The trusted accounts (login, or name[bot] for a bot), read when each event arrives.

Parameters​
ctx​

BlockContext

Returns​

readonly string[] | Promise<readonly string[]>

token()​
token(ctx, entry): string | Promise<string | undefined> | undefined;

A token that can read the repository's collaborators, for the subscription being screened (its owner is entry.userId, set by the server); none fails the screen.

Parameters​
ctx​

BlockContext

entry​
botsScreenedBy?​

string

followRev?​

2

hearsClose?​

true

hostScreens?​

( | { any: string[]; screen: "labels"; } | { any: string[]; screen: "words"; } | { bots?: string[]; ids: string[]; screen: "allow"; } | { name: string; screen: "custom"; } | { screen: "interest"; })[]

interest?​

string

kinds?​

string[]

orgId​

string

outsiders?​

true

provider​

string

screens​

( | { any: string[]; screen: "labels"; } | { any: string[]; screen: "words"; } | { bots?: string[]; ids: string[]; screen: "allow"; } | { name: string; screen: "custom"; } | { screen: "interest"; })[]

self?​

string

tenantId?​

string

thread​

string

unmatched?​

true

userId​

string

Returns​

string | Promise<string | undefined> | undefined


HireChecks​

What every hire and edit is checked against beyond the worker's flow: the kit's hire config.

Properties​

models?​
models?: readonly string[];

The models a worker may name in settings.model, as model strings (openai/gpt-6-luna, openrouter:nvidia/…). Each must also have a key or gateway in the server's environment (describeModelRoute): a key handed to a model resolver in code isn't seen. Omitted: any model the flow takes.


HireOptions​

Properties​

documents?​
documents?: DeclaredResources;

The documents this app declared, keyed by ref — the map resourcesFromDocs(documents) returns, handed over unchanged.

Handed over, never worked out. A worker's resources: grant narrows the DOCUMENTS in the map its worker flow declares at flow level and leaves the rest of that map — the app's boards, its stores — standing. Telling a document from a board is what this answers, and the app is the only party that knows: inferring it from an entry's shape would make the boundary of a permission feature rest on a heuristic, and a board that happened to look like a document would become grantable.

The same list the app already spreads into its own flow-level map, so there is one catalog and not a second table describing the same documents.

Optional, and consulted only for a worker that declares resources:. A roster where no worker does hires exactly as it did before this existed. A worker that DOES declare one while this is absent refuses, rather than resolving every ref to nothing — a lockout that reads like a typo.

packageBlocks?​
packageBlocks?: Record<string, Record<string, BlockDefinition<any, any, any, any>>>;

The blocks each package carries, keyed by the package's address and then by block name — fsdev gen's packageBlocks export, passed straight through.

A package's blocks reach only the workers that HOLD the package: the ones with it in their own packages/ folder, and the ones whose packages: line takes it from their team's or the org's library. They are never put in a worker flow's catalog, so no other worker can name them. A worker holding a package with no tools: line can call every block in it; a worker that writes a tools: line can call the ones it lists.

Optional. Omitted, a held package brings its instructions and no tools.

references?​
references?: DeclaredResources;

The references this app declared, keyed by ref — the map referencesFromDocs(references) returns, handed over unchanged.

Handed over for the reason documents is, and used for more. It says which entries on a worker flow's map are references, which is what the derived tree wall narrows: a worker reaches the references at or above its place in the tree, and no others. That wall applies whether or not the worker declares references: — the key narrows within it, and can never widen past it.

Optional. Absent, no entry is a reference, no wall applies, and every worker is minted exactly as it was before this existed.

A ref may not appear in both this map and HireOptions.documents: the two behave differently and one accessor cannot be both, so the pair is refused rather than resolved.

workerBlocks?​
workerBlocks?: Record<string, Record<string, BlockDefinition<any, any, any, any>>>;

The blocks each worker's own folders REGISTER, keyed by worker id and then by block name — fsdev gen's workerBlocks export, passed straight through.

Registration, not a grant. An entry here makes that name resolvable by that worker; the worker's tools: is still what decides whether it may call it, and a registered block the file never names is not on the model's toolset. A name resolves worker folder → team folder → the app's catalog, first match wins; the first two arrive here already collapsed by the generated map, and this step is where the last hop happens.

Per worker and never installed on the worker flow: a flow's capabilities and resources are shared by every worker of it, so one worker's folder installed there would change every sibling. That is why a block here may USE a store the flow has and may not DECLARE one — see colocatedResourceMessage.

Optional. Omitted, every worker hires exactly as it did before this existed.

workerFlows?​
workerFlows?: Record<string, WorkerFlowEntry>;

The app's worker flows, by name — defineFlow(...) results, passed directly, or { flow, standardOnly: true } for a flow kept for the workers the app's WORKER.md files define. A record's flow names one, and it is called once per worker to mint that worker's copy.

Every flow here, and the built-in agent under them, is checked against the worker contract before any worker is hired: it takes the configuration a hire supplies, has one door, and declares any resource with writtenBy through sharedResource() (workerFlowProblems). One problem refuses the whole call.

Optional: the built-in agent flow is always available underneath, so a roster of records that name no flow needs none of these. Passing a flow under agent replaces the built-in for every worker, and its standardOnly is the entry's.

Standard-only is checked after the agent default: a hired worker (a runtime hire or a stored roster row, org-visible or private: any record carrying an owner) that names no flow is refused when agent is kept for declared workers.


InternalServiceFlow​

What internalServiceFlow builds.

Properties​

capability​
readonly capability: DefinedCapability<"internalEvents", Record<string, never>, "tools" | "default", Record<string, PresetDef<any>>, undefined, {
workforceMessageChains: object & ResourceCollectionConfig<JsonObject> & object;
workforceMessages: object & ResourceCollectionConfig<JsonObject> & object;
}, undefined, undefined, undefined> & object;

publishEvent as a worker's tool: name it in a worker flow's uses.

Type Declaration​
__configInType?​
readonly __configInType?: undefined;
resourcesType?​
readonly resourcesType?: unknown;
sequencerStateType?​
readonly sequencerStateType?: unknown;
sessionStateType?​
readonly sessionStateType?: unknown;
stateSchemaType?​
readonly stateSchemaType?: unknown;
targetStatesType?​
readonly targetStatesType?: unknown;
flow​
readonly flow: FlowInstance<NormalizedActions<{
}>>;

The service flow: register it with the app's flows.

provider​
readonly provider: SubscriptionProvider;

The internal provider: give it to hireWorkforce's routines.providers beside the others.

resources​
readonly resources: object;

What a block that calls publishEvent declares: the message chains a publish pays its place in.

workforceMessageChains​
workforceMessageChains: object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
flowIsolation​
readonly flowIsolation: false;
pattern​
readonly pattern: "workforce/message-chains/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: ZodObject<{
sent: ZodDefault<ZodArray<ZodString, "many">>;
}, "strip", ZodTypeAny, {
sent: string[];
}, {
sent?: string[];
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.sent​
sent: string[];
StateType​
StateType: object;
StateType.sent​
sent: string[];
workforceMessages​
workforceMessages: object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
client​
readonly client: object;
client.state​
readonly state: object;
client.state.read​
readonly read: true;
flowIsolation​
readonly flowIsolation: false;
indexes​
readonly indexes: object;
indexes.inReplyTo​
readonly inReplyTo: (_key, message) => any;
Parameters​
_key​

string

message​

any

Returns​

any

indexes.open​
readonly open: (_key, message) => any[] | null;
Parameters​
_key​

string

message​

any

Returns​

any[] | null

pattern​
readonly pattern: "workforce/messages/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: ZodObject<{
addressedBy: ZodOptional<ZodEnum<["task", "session"]>>;
answeredBy: ZodOptional<ZodString>;
at: ZodNumber;
chain: ZodOptional<ZodString>;
deadlineAt: ZodOptional<ZodNumber>;
deliveredAs: ZodOptional<ZodString>;
deliveredAt: ZodOptional<ZodNumber>;
exchange: ZodString;
forward: ZodOptional<ZodObject<{
as: ZodEnum<["addressed", "inferred"]>;
url: ZodString;
}, "strict", ZodTypeAny, {
as: "addressed" | "inferred";
url: string;
}, {
as: "addressed" | "inferred";
url: string;
}>>;
from: ZodString;
fromFlow: ZodString;
fromSession: ZodString;
hop: ZodNumber;
id: ZodString;
inReplyTo: ZodOptional<ZodString>;
noAnswer: ZodOptional<ZodLiteral<true>>;
queuedBehind: ZodOptional<ZodLiteral<"user">>;
reason: ZodOptional<ZodString>;
replyRequested: ZodOptional<ZodLiteral<true>>;
resent: ZodOptional<ZodObject<{
at: ZodNumber;
n: ZodNumber;
}, "strip", ZodTypeAny, {
at: number;
n: number;
}, {
at: number;
n: number;
}>>;
status: ZodEnum<["unconfirmed", "delivered", "refused", "undeliverable"]>;
takenBy: ZodOptional<ZodString>;
text: ZodString;
to: ZodString;
toFlow: ZodString;
toldAt: ZodOptional<ZodNumber>;
toSession: ZodString;
toState: ZodOptional<ZodRecord<ZodString, ZodString>>;
toTask: ZodOptional<ZodString>;
waitEndedAt: ZodOptional<ZodNumber>;
waitGate: ZodOptional<ZodObject<{
gateId: ZodString;
requestId: ZodString;
}, "strip", ZodTypeAny, {
gateId: string;
requestId: string;
}, {
gateId: string;
requestId: string;
}>>;
}, "strip", ZodTypeAny, {
addressedBy?: "session" | "task";
answeredBy?: string;
at: number;
chain?: string;
deadlineAt?: number;
deliveredAs?: string;
deliveredAt?: number;
exchange: string;
forward?: {
as: "addressed" | "inferred";
url: string;
};
from: string;
fromFlow: string;
fromSession: string;
hop: number;
id: string;
inReplyTo?: string;
noAnswer?: true;
queuedBehind?: "user";
reason?: string;
replyRequested?: true;
resent?: {
at: number;
n: number;
};
status: "unconfirmed" | "delivered" | "refused" | "undeliverable";
takenBy?: string;
text: string;
to: string;
toFlow: string;
toldAt?: number;
toSession: string;
toState?: Record<string, string>;
toTask?: string;
waitEndedAt?: number;
waitGate?: {
gateId: string;
requestId: string;
};
}, {
addressedBy?: "session" | "task";
answeredBy?: string;
at: number;
chain?: string;
deadlineAt?: number;
deliveredAs?: string;
deliveredAt?: number;
exchange: string;
forward?: {
as: "addressed" | "inferred";
url: string;
};
from: string;
fromFlow: string;
fromSession: string;
hop: number;
id: string;
inReplyTo?: string;
noAnswer?: true;
queuedBehind?: "user";
reason?: string;
replyRequested?: true;
resent?: {
at: number;
n: number;
};
status: "unconfirmed" | "delivered" | "refused" | "undeliverable";
takenBy?: string;
text: string;
to: string;
toFlow: string;
toldAt?: number;
toSession: string;
toState?: Record<string, string>;
toTask?: string;
waitEndedAt?: number;
waitGate?: {
gateId: string;
requestId: string;
};
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.addressedBy?​
addressedBy?: "session" | "task";
ClientType.answeredBy?​
answeredBy?: string;
ClientType.at​
at: number;
ClientType.chain?​
chain?: string;
ClientType.deadlineAt?​
deadlineAt?: number;
ClientType.deliveredAs?​
deliveredAs?: string;
ClientType.deliveredAt?​
deliveredAt?: number;
ClientType.exchange​
exchange: string;
ClientType.forward?​
forward?: object;
ClientType.forward.as​
as: "addressed" | "inferred";
ClientType.forward.url​
url: string;
ClientType.from​
from: string;
ClientType.fromFlow​
fromFlow: string;
ClientType.fromSession​
fromSession: string;
ClientType.hop​
hop: number;
ClientType.id​
id: string;
ClientType.inReplyTo?​
inReplyTo?: string;
ClientType.noAnswer?​
noAnswer?: true;
ClientType.queuedBehind?​
queuedBehind?: "user";
ClientType.reason?​
reason?: string;
ClientType.replyRequested?​
replyRequested?: true;
ClientType.resent?​
resent?: object;
ClientType.resent.at​
at: number;
ClientType.resent.n​
n: number;
ClientType.status​
status: "unconfirmed" | "delivered" | "refused" | "undeliverable";
ClientType.takenBy?​
takenBy?: string;
ClientType.text​
text: string;
ClientType.to​
to: string;
ClientType.toFlow​
toFlow: string;
ClientType.toldAt?​
toldAt?: number;
ClientType.toSession​
toSession: string;
ClientType.toState?​
toState?: Record<string, string>;
ClientType.toTask?​
toTask?: string;
ClientType.waitEndedAt?​
waitEndedAt?: number;
ClientType.waitGate?​
waitGate?: object;
ClientType.waitGate.gateId​
gateId: string;
ClientType.waitGate.requestId​
requestId: string;
StateType​
StateType: object;
StateType.addressedBy?​
addressedBy?: "session" | "task";
StateType.answeredBy?​
answeredBy?: string;
StateType.at​
at: number;
StateType.chain?​
chain?: string;
StateType.deadlineAt?​
deadlineAt?: number;
StateType.deliveredAs?​
deliveredAs?: string;
StateType.deliveredAt?​
deliveredAt?: number;
StateType.exchange​
exchange: string;
StateType.forward?​
forward?: object;
StateType.forward.as​
as: "addressed" | "inferred";
StateType.forward.url​
url: string;
StateType.from​
from: string;
StateType.fromFlow​
fromFlow: string;
StateType.fromSession​
fromSession: string;
StateType.hop​
hop: number;
StateType.id​
id: string;
StateType.inReplyTo?​
inReplyTo?: string;
StateType.noAnswer?​
noAnswer?: true;
StateType.queuedBehind?​
queuedBehind?: "user";
StateType.reason?​
reason?: string;
StateType.replyRequested?​
replyRequested?: true;
StateType.resent?​
resent?: object;
StateType.resent.at​
at: number;
StateType.resent.n​
n: number;
StateType.status​
status: "unconfirmed" | "delivered" | "refused" | "undeliverable";
StateType.takenBy?​
takenBy?: string;
StateType.text​
text: string;
StateType.to​
to: string;
StateType.toFlow​
toFlow: string;
StateType.toldAt?​
toldAt?: number;
StateType.toSession​
toSession: string;
StateType.toState?​
toState?: Record<string, string>;
StateType.toTask?​
toTask?: string;
StateType.waitEndedAt?​
waitEndedAt?: number;
StateType.waitGate?​
waitGate?: object;
StateType.waitGate.gateId​
gateId: string;
StateType.waitGate.requestId​
requestId: string;

Methods​

publishEvent()​
publishEvent(ctx, input): Promise<PublishOutcome>;

Publish from a block in any flow: { topic, kind, title, text, data? } in, { published } or { refused } out, never who heard. The block declares InternalServiceFlow.resources.

Parameters​
ctx​

BlockContext

input​

unknown

Returns​

Promise<PublishOutcome>


InternalServiceFlowOptions​

What internalServiceFlow is built with.

Properties​

capPerHour?​
readonly capPerHour?: number;

The most messages one subscription sends in an hour.

installation​
readonly installation: WorkerInstallation;

The app's worker installation: the sessions it delivers to run its workers, and its message budget is the loop guard.

kind?​
readonly kind?: string;

The flow kind. Default INTERNAL_SERVICE_FLOW.

maxOwnerRuns?​
readonly maxOwnerRuns?: number;

The most subscriptions one event is delivered to.

screens?​
readonly screens?: SubscriptionScreens;

The app's own screens on its topics: its custom functions, and the model a routine's interest asks.

topics​
readonly topics: InternalTopics;

The topics a session may publish on and a routine may follow.


InternalTopic​

One declared topic: the kinds of event on it, the schema its data is checked by, and what it is for.

Properties​

data?​
readonly data?: ZodTypeAny;

The schema an event's data must pass. Absent, the topic takes no data.

description?​
readonly description?: string;

What the topic announces, in a few words: the publish tool lists it.

kinds​
readonly kinds: readonly string[];

The kinds an event on the topic may be; a subscription may hear some of them.


InventoryActionRequest​

One action the binder asks the app's door to run.

Properties​

action​
action: string;

The action's name: INVENTORY_REGISTER_WORKERS.

flowKind​
flowKind: string;

The flow to run on: the worker writer's.

input​
input: unknown;

The action's input: the worker entries.

orgId​
orgId: string;

The org the rows are written in. Always present: the binder refuses without one.

sessionId​
sessionId: string;

The session to run in: the worker writer's.

source?​
source?: string;

"internal": the worker write.

The worker-registration action lives only in the flow's internal.actions map, not its public one (see inventoryWriterActions in worker-writer.ts), because its whole input is caller-supplied row data with nothing to validate it against. run must forward this straight into runAction's own source option — runAction({ source: request.source, ... }) — so the worker write resolves from internal.actions instead of the public one. A door that drops this field on the floor makes the worker write unreachable rather than insecure: resolveEntry reads one map per dispatch type with no fallback, so a run that always dispatches as "http" gets no-entry for the worker write, never a public hit on it.

userId​
userId: string;

The user the run is made as.


InventoryBinding​

What one boot wrote, and what it could not.

Properties​

problems​
problems: string[];

What failed, named. Never thrown: the caller decides whether a workerless inventory is worth refusing to boot over.

workers​
workers: number;

How many worker entries were written. The count is the worker action's own, read from what run returns: the action's output, or a run result carrying it as output. A door whose return carries neither (an HTTP action client returns no output) gets the number of rows sent instead.


InventoryKeys​

Which resource-registry key the live worker inventory is mounted under, on the block that carries the door.

A key is how a source finds its collection at call time; with the key omitted the door registers no source at all and carries one domain fewer, which reads as "nothing here" rather than as a fault.

Properties​

workers?​
workers?: string;

Registry key for the worker inventory (defineWorkerInventoryCollection).


InventoryRoster​

What the binder registers: the workers that were hired.

Properties​

workers​
workers: readonly InventoryWorker[];

The registered workers: inventoryWorkers(installation), the standard workers with their flows' actions.


InventoryWorker​

One registered worker, as the binder needs it.

Structurally typed, and satisfied by hireWorkforce's own return value: a hired worker is a flow copy carrying these three fields. Typed this loosely on purpose — what belongs in the inventory is the workers that actually exist, and a manifest the hire step refused never became one.

Properties​

actions​
actions: Readonly<Record<string, unknown>>;

The worker's public actions, which its door is read from (see worker-door.ts). A hired worker carries them. Required, so a caller that builds { id, kind } by hand can't register a worker as taking no message by forgetting them: pass {} to say the worker has no door.

id​
id: string;

The worker's id ("<teamId>.<name>", or a bare "<name>" for an org worker) — the id its row is keyed by.

kind​
kind: string;

The worker flow it was hired into.

name?​
name?: string | null;

The worker's display name; absent or null when it has none, and a view shows its id.

teamName?​
teamName?: string | null;

Its team's display name; absent or null when the team has none, or the worker has no team.


InventoryWorkerWriter​

Where the worker entries are written.

See​

OpenInventoryOptions.workerWriter

Properties​

flowKind​
flowKind: string;

A flow kind carrying INVENTORY_REGISTER_WORKERS.

sessionId?​
sessionId?: string;

The session to run the write in. Defaults to INVENTORY_WORKER_WRITER_SESSION.


MessageLimits​

What hireWorkforce's messages takes.

Properties​

budget?​
readonly budget?: number;

The most worker messages in a chain with no user's turn between them. Omitted, 6.

perTurn?​
readonly perTurn?: number;

The most messages one turn sends. Omitted, 3.


OpenInventoryOptions​

The live inventory: org-scoped rows for the workers registered in this org.

collections.ts owns the explanation — what the collection answers and who may read it. open-inventory.ts owns the boot binder that fills it, and worker-writer.ts the action it runs. This file only re-exports.

Properties​

orgId?​
orgId?: string;

The org the rows are written in.

Optional in this type only because the boot options beside it are; a run without one is refused. The inventory is org-scoped storage, so a write with no org goes somewhere no flow in the app can read back — the failure is an inventory that reads empty everywhere, which points at nothing.

run​
run: (request) => Promise<unknown>;

The action door — one call, for the workers.

Structurally typed and supplied by the app, because this package depends on no client package. It is a one-liner over whatever the app already uses to run an action:

const run = (req) =>
createClient({ baseUrl, userId: req.userId })
.flow(req.flowKind)
.send(req.action, req.input, { sessionId: req.sessionId });

It must reject when the action fails. A door that hands back a failed run as an ordinary value reports the workers written when nothing was, and the binder has no other way to tell: an action's return value arrives in whatever shape that door gives it, so the rejection is the only signal this package can read.

Return the action's output, or a run result carrying it as output (runAction's shape), and InventoryBinding.workers counts the worker entries that actually landed; any other return counts the rows sent.

Parameters​
request​

InventoryActionRequest

Returns​

Promise<unknown>

userId​
userId: string;

The user the run is made as.

workerWriter?​
workerWriter?: InventoryWorkerWriter;

Where the WORKER entries are written.

A worker has no session of its own, and a collection can only be written from inside a running flow — so the worker entries need a flow to run in, and the binder cannot derive one. Any flow of the app's own that spreads inventoryWriterActions() into its internal.actions carries the writer. Naming it is one line, and it is the single thing about this call that is not already decided by the roster.

Required when the roster carries workers, and refused by name when it is missing. A roster with no workers does not need one.


OperatorGitHubOptions​

What operatorGitHub is built with.

Properties​

apiUrl?​
apiUrl?: string;

GitHub's REST API root. Default GitHub's own; a check names its stub.

interestModel?​
interestModel?: string | EvaluationModel;

The model a routine's interest screen is judged on. Absent: a routine listing interest is refused.

operator​
operator: string;

The one user the token serves: the host's operator.

reviewers?​
reviewers?: GitHubTrustedReviewers;

The trusted reviewers (githubTrustedReviewers): the provider declares their list screen, first among its custom screens, for their follow to list.

token​
token: string | undefined;

The operator's token (operatorGitHubToken). Absent: every GitHub routine is refused.


PackageManifest​

One package, as read off disk: a packages/<name>/ folder's PACKAGE.md.

Carries the package's text and where it sits. Its blocks are not here: code is found by fsdev gen and arrives at the hire on the generated packageBlocks map, keyed by PackageManifest.path, which is where the two halves meet.

Properties​

description​
description: string;

The file's required description — a label for people, never handed to a model.

instructions?​
instructions?: string;

The file's body, verbatim. Absent when it is empty or whitespace, never "", for the reason a team's instructions are: whitespace is not instructions.

level​
level: "org" | "team" | "worker";

Where the folder sits: the org's library, a team's library, or one worker's own folder.

name​
name: string;

The folder's name — what a worker's packages: takes it by.

path​
path: string;

The folder's slash-separated path under the workforce root — for example teams/support/packages/escalation. The package's address, and the key its blocks sit under on packageBlocks.

team?​
team?: string;

The team whose folder holds it. Set at the team level, and at the worker level for a team worker.

worker?​
worker?: string;

The worker id (<team>.<worker>, or <worker> for an org worker) whose folder holds it. Set at the worker level only.


PersonaCollectionConfig​

Properties​

contentTemplate?​
contentTemplate?: string;

Template applied to each collection instance.

contentTemplateRef?​
contentTemplateRef?: string;

Reference to an external template resource.

maxInstances?​
maxInstances?: number;
pattern​
pattern: string;

Collection pattern (e.g. "personas/*").

scope?​
scope?: ResourceScope;
stateSchema?​
stateSchema?: ZodTypeAny;

PersonaResourceConfig​

Properties​

contentTemplate​
contentTemplate: string;

The template body rendered against state via LiquidJS.

initialState?​
initialState?: JsonValue;
ref​
ref: string;

Resource ref / storage key (e.g. "persona-analyst").

scope?​
scope?: ResourceScope;
stateSchema?​
stateSchema?: ZodTypeAny;

ProjectBlocksOptions​

Options for defineProjectBlocks.

Properties​

checkRepository?​
checkRepository?: RepositoryCheck;

Whether a run on a repository would get a checkout on this machine (a workspace host's checkRepository). Given: createProject and setRepository refuse an unusable one repository-unusable with the host's words, and a checkRepository view asks first, with no session. Absent: no refusal and no view.

mcpServers?​
mcpServers?: readonly string[];

The names of the MCP servers this host offers its projects. A project may name only these. Absent or empty: it offers none, and every name is refused unknown-mcp-server.

projectCoordinator?​
projectCoordinator?: () => string | null;

The worker each user's project coordinator runs as (an installation's projectCoordinator()?.worker ?? null), asked on each read of the projectSetup view. Absent: the view answers null.

Returns​

string | null


ProjectCheckout​

A checkout on the server's machine that some shared projects' runs work in, instead of a clone of their remote. The operator's config, never a row.

Properties​

baseRef?​
baseRef?: string;

The branch a run's branch is cut from. Omitted: whatever the checkout has checked out (HEAD).

checkout​
checkout: string;

The checkout's absolute path. List it in the host's localRepositories too.

projects​
projects: readonly object[];

The shared projects whose runs work here, each by its organization and id. tenantId is matched exactly: an entry that names one matches only a run in that tenant, and one that names none only a run with none.

remote​
remote: string;

The remote, exactly as the projects' rows store it in repository.


ProjectMcpCapabilityOptions​

Options for projectMcpCapability.

Properties​

_createClient?​
_createClient?: (config) => Promise<MCPClient>;

Test-only: how a server's client is made. Default: the tools manager's own.

Parameters​
config​

MCPServerConfig

Returns​

Promise<MCPClient>

allow?​
allow?: (server, tool) => boolean;

Which of a server's tools a worker gets, by server and the tool's own name (get_issue). Default: all of them.

Parameters​
server​

string

tool​

string

Returns​

boolean

Example​
(server, tool) => server !== "linear" || /^(get|list|search)_/.test(tool)
env?​
env?: Readonly<Record<string, string | undefined>>;

Where seedEnv is read from, on each resolve. Default process.env.

idleMs?​
idleMs?: number;

How long a kept connection stays open without a call or a resolve. Default PROJECT_MCP_IDLE_MS.

operator?​
operator?: string;

The host's operator user id: the one user a server's seedEnv stands in for.


ProjectMcpServerConfig​

One MCP server a host offers: its HTTP address, and the variable that seeds the operator's key.

Properties​

seedEnv?​
seedEnv?: string;

An environment variable holding a key for the host's operator identity, read only for that user and only while they have no stored key. For runs nobody is at the keyboard for (a goal check, CI).

url​
url: string;

The server's Streamable HTTP address, https://… (or http://…).


ProjectMcpToolsOptions​

Options for projectMcpTools.

Properties​

_createClient?​
_createClient?: (config) => Promise<MCPClient>;

Test-only: how a server's client is made. Default: the tools manager's own.

Parameters​
config​

MCPServerConfig

Returns​

Promise<MCPClient>

env?​
env?: Readonly<Record<string, string | undefined>>;

Where seedEnv is read from, on each call. Default process.env.

operator?​
operator?: string;

The host's operator user id: the one user a server's seedEnv stands in for.


ProjectMcpToolsResolver()​

The resolver a coding harness calls once per run, with that run's context only, and what a harness that takes no relayed tools asks instead.

ProjectMcpToolsResolver(ctx): Promise<Record<string, RelayedMcpServer>>;

The resolver a coding harness calls once per run, with that run's context only, and what a harness that takes no relayed tools asks instead.

Parameters​

ctx​

HarnessCallbackContext

Returns​

Promise<Record<string, RelayedMcpServer>>

Methods​

named()​
named(ctx): Promise<string[]>;

The servers the run's project names, without reading a key or connecting: for a harness that can't take relayed tools, to say in the run's session which it runs without. [] when the lookup refuses.

Parameters​
ctx​

HarnessCallbackContext

Returns​

Promise<string[]>


ProjectSourceCapabilityOptions​

Options for projectSourceCapability.

Properties​

workspace​
workspace: WorkspaceHost;

The workspace host the app's coding runs use, built with source: projectWorkspace(). It must have a read view (readSource).


ProjectWorkspaceOptions​

Options for projectWorkspace.

Properties​

checkouts?​
checkouts?: readonly ProjectCheckout[];

Checkouts on this machine, and the shared projects whose runs work in each.


ReferenceContentStore​

The slice of the engine's ContentStore this needs: read one row, delete one row.

Declared structurally rather than imported, so workforce does not take a runtime dependency on engine for two method signatures. Any ContentStore satisfies it — stores.content is passed straight in.

Methods​

delete()​
delete(
scopeType,
scopeId,
resourceKey
): Promise<void>;

Delete a single resource's stored content.

Parameters​
scopeType​

"org"

scopeId​

string

resourceKey​

string

Returns​

Promise<void>

get()​
get(
scopeType,
scopeId,
resourceKey
): Promise<string | undefined>;

Read a single resource's stored content, or undefined when there is none.

Parameters​
scopeType​

"org"

scopeId​

string

resourceKey​

string

Returns​

Promise<string | undefined>


ReferenceInstallFlow​

The flow the references are installed on, as the storage coordinate needs it.

Properties​

id​
id: string;

The registered flow's id — half the bucket when the org scope is isolated.

isolatesOrgState​
isolatesOrgState: boolean;

Whether that flow isolates its org scope (isolateOrgState).

Required, not optional. A reference inherits the flow's org isolation, and the two settings address different buckets — so a default here would be a guess that reports success while looking in the wrong place.


RelayedMcpServer​

One relayed server: its tools, and how to close its connection when the run ends.

Properties​

tools​
tools: RelayedMcpTool[];

Methods​

close()​
close(): Promise<void>;
Returns​

Promise<void>


RelayedMcpTool​

One tool relayed to a run: what an in-process MCP server lists and calls.

Properties​

description​
description: string;
inputSchema​
inputSchema: Record<string, unknown>;

The tool's input JSON Schema, as the server published it.

name​
name: string;

The tool's name on its server, unprefixed (get_issue).

Methods​

call()​
call(args, options): Promise<unknown>;

Call it through FSD's connection; resolves to the server's answer.

Parameters​
args​

Record<string, unknown>

options​
signal?​

AbortSignal

Returns​

Promise<unknown>


ReporterRunResult​

The outcome of one run the host started: its output, or why it failed.

Properties​

error?​
readonly error?: string;
output?​
readonly output?: unknown;

ReporterSessionFacts​

What a session holds, as the host reads it for a dossier.

Properties​

flowKind?​
readonly flowKind?: string;
id​
readonly id: string;
state?​
readonly state?: Readonly<Record<string, unknown>>;
summary?​
readonly summary?: unknown;

What happened in it, as the host chooses to summarize it (its last items).

userId?​
readonly userId?: string;

ReportLimits​

The limits the intake applies.

Properties​

commentEveryMs​
readonly commentEveryMs: number;

The least time between two counted comments on one filed issue. Default one hour.

dismissForMs​
readonly dismissForMs: number;

How long a Don't file answer holds. Default 24 hours.

newPerWindow​
readonly newPerWindow: number;

New reports per window, the rest into the window's storm report. Default 5.

windowMs​
readonly windowMs: number;

The window, in ms. Default one hour.


ResolvedWorker​

The worker a turn runs as, with what it runs with.

Properties​

config​
config: Readonly<Record<string, unknown>>;

Its configuration, as the flow's own configSchema parsed it: the worker's settings, its instructions, and its tools, skills and packages resolved against what the installation registers. Read this, never ctx.flow.config, which the shared copy holds once for every worker.

description​
description: string | null;

Its description, or null.

flow​
flow: string;

The flow it runs on, which is the running flow.

id​
id: string;

The worker's id: a row on the user's roster, or a standard worker's id.

standard​
standard: boolean;

Whether it is a standard worker (from the files) rather than one of the user's own.

Methods​

reaches()​
reaches(accessor): boolean;

Whether the worker reaches the flow's resource under accessor on this turn: its document grants and the reference wall, applied per turn on the flow's one copy. A resource that isn't a document or a reference is always reached.

Parameters​
accessor​

string

Returns​

boolean


ResourceDoc​

One file-declared document, as read off disk or hand-built. The resources convention's record, mirroring WorkerManifest's three fields.

Named a document rather than a manifest deliberately: ResourceManifest is already the framework's name for the client-facing list of a session's public resources over HTTP, and one term cannot carry both meanings.

Properties​

body​
body: string;

The document itself: Markdown body verbatim, frontmatter removed.

declared​
declared: Record<string, unknown>;

Frontmatter exactly as written — keys as the file spelled them, values uninterpreted.

filePath?​
filePath?: string;

The absolute path the record was read from.

Absent on a hand-built record, which is the difference between "read from this file" and "there was no file" — the same shape WorkerManifest.skills uses, and the reason this is optional rather than "".

A references/ document needs it: its content is served FROM the file on every execution context rather than copied into a stored row, so the path is the thing the install half installs. A resources/ document carries it too — the walk knows where it read, and one walk that records provenance beats two walks that disagree about whether to — but nothing consumes it there, and ResourceDoc.body stays that document's source.

ref​
ref: string;

Storage-key namespace and accessor key.

The rule: the ref is the document's path under the workforce root with the resources/ segment removed and a leading org/ removed. The four forms it currently produces, one per place a resources/ slot can sit:

  • org/resources/<name>.md → <name>
  • teams/<teamId>/resources/<name>.md → teams/<teamId>/<name>
  • org/workers/<worker>/resources/<name>.md → workers/<worker>/<name>
  • teams/<teamId>/workers/<worker>/resources/<name>.md → teams/<teamId>/workers/<worker>/<name>

The rule leads and the list follows it on purpose: a level added later gets its ref from the same rule rather than from a new case, so a stale list costs a reader nothing the rule above it has not already told them.

Path-joined, not dot-joined: this is the key the atlas fixes for a team document, and unlike a worker id it never routes, so a / in it is safe. Minted by the loader, in one helper.


ResourceModuleHalves​

What a resourceModules map splits into — the two slots an app already has.

Properties​

capabilities​
capabilities: DefinedCapability<string, Record<string, (...args) => any>, string, Record<string, PresetDef<any>>, undefined, undefined, undefined, undefined, undefined>[];

The capabilities, in the map's own order, for the worker flow's uses.

A list rather than a map: uses takes refs, and a capability is addressed by its own name from there on. Duplicates and name collisions are core's to judge — it dedupes two paths to one capability and refuses two different capabilities sharing a name — and a second ruling here would be a second answer to one question.

resources​
resources: DeclaredResources;

The plain resources, keyed by ref, to merge into the flow's resource map.

Null-prototype, like the document half's, and spread into the app's own map at the app's own call site.


ReviewReplies​

The poster, as a host hands it to the harness manager (harnessManager({ replies })).

Properties​

resources?​
readonly resources?: Readonly<Record<string, DeclaredResourceEntry>>;

The resources post reads (the trusted reviewers' list), declared on the step that runs it.

Methods​

post()​
post(
ctx,
drafts,
scope
): Promise<ReviewReplyOutcome[]>;

Check and post each draft; never throws, each draft ends posted or refused.

Parameters​
ctx​

BlockContext

drafts​

readonly ReviewReplyDraft[]

scope​
pullRequests​

readonly ReviewReplyPullRequest[]

task?​

ReviewReplyTask

Returns​

Promise<ReviewReplyOutcome[]>


ReviewReplyDraft​

One reply a run drafted: the link to the comment it answers, and what it says.

Properties​

body​
readonly body: string;

The reply, as written.

file​
readonly file: string;

The draft's file name, for the session's line.

readonly link: string;

The comment's link, as GitHub gives it (…/pull/7#discussion_r123).


ReviewReplyOutcome​

What became of one draft: the reply's link, or why it wasn't posted.

Properties​

file​
readonly file: string;
readonly link: string;
posted?​
readonly posted?: string;

The reply's link on GitHub.

refused?​
readonly refused?: string;

Why nothing was posted.


ReviewReplyPullRequest​

A pull request the task's run opened or landed on.

Properties​

number​
readonly number: number;
repository​
readonly repository: string;

owner/name.


ReviewReplyTask​

What the poster reads off the task: the filing's stamp and its steers.

Properties​

metadata?​
readonly metadata?: Readonly<Record<string, unknown>> | null;
steers?​
readonly steers?: readonly object[] | null;

RosterWorker​

A worker on a user's roster, as WorkerInstallation.rosterWorker reads it: enough to tell whether it is theirs and what it runs on, without loading its configuration.

Properties​

delegates​
delegates: "all" | readonly string[];

The delegates its configuration lists (delegates:), by worker id; empty when it lists none. "all" when its file says delegates: all: the whole roster, read when it is used.

description​
description: string | null;

Its description, or null.

flow​
flow: string;

The flow it names.

id​
id: string;

The worker's id.

name​
name: string | null;

Its display name: its row's name, or its file's name:; null when it has none.

problem?​
problem?: string;

Why it can't run, when its row can't be read or names a flow kept for standard workers.

standard​
standard: boolean;

Whether it is a standard worker (from the files) rather than one of the user's own.

teamName​
teamName: string | null;

Its team's display name, its TEAM.md name:, or null when it has none or no team.


RoutinesOptions​

What hireWorkforce takes for routines.

Properties​

declared?​
readonly declared?: readonly DeclaredRoutine[];

The app's own routines, seeded for each user (or an entry's owner).

index?​
readonly index?: ScheduleIndex;

A schedule index (a polling or BullMQ one) to mirror every clock routine into, for a tick to find due schedules. Omitted, the host's own cron POSTs to each schedule's dispatch endpoint. The routines capability a worker flow uses mirrors into it too.

poll?​
readonly poll?: object;

Polling, for providers an app has no webhook for: a schedule index of its own (not index: one index ticks one flow, and this one ticks the service flow, whose poll is on), and the cadence an event routine that names none polls at (one of ROUTINE_CADENCES; omitted, 5). Omitted, nothing polls.

everyMinutes?​
readonly everyMinutes?: number;
index​
readonly index: ScheduleIndex;
providers?​
readonly providers?: readonly SubscriptionProvider[];

The providers an event routine may follow a thread on. Omitted, none.


SendMessageInput​

What a send asks for: the tool's input.

Properties​

inReplyTo?​
readonly inReplyTo?: string;
text​
readonly text: string;
to​
readonly to: MessageTarget;

A worker's id, a task ({ task }), or one of the user's conversations ({ session }).


SessionBoardOptions​

What a session board is built from.

Properties​

flowKind​
readonly flowKind: string;

The worker flow that carries the board: its workers are loaded on it, and the tasks it hands over send their notices back to it.

inferredWork?​
readonly inferredWork?: (ctx) => "off" | "observe" | "auto";

What the running session may do with work nobody asked for: an inferred forward (an event no other subscription heard). off lands it as a line with no turn; observe runs the turn, and every task it files waits on the user's yes, and it sends no message; auto runs it as any turn. Read at the turn. Unset reads observe: a flow that never set it holds.

Parameters​
ctx​

BlockContext

Returns​

"off" | "observe" | "auto"

installation​
readonly installation: WorkerInstallation;

The worker installation the flow's workers, and their delegates, belong to.

routes?​
readonly routes?: RoutedFiling;

How a flow that routes messages files a routed task from its model's turn: on a turn routing one, a filing whose result goes to the conversation is handed here, which attaches the message.

seed?​
readonly seed?: (ctx) => Promise<readonly object[] | undefined>;

The records a session's delegates start with beside its worker's defaults, copied in the first time they are read or changed. A project coordinator's flow seeds one per workstream its user has open there.

Parameters​
ctx​

BlockContext

Returns​

Promise<readonly object[] | undefined>


ShadowedReference​

One reference that had a stored row shadowing its file.

Properties​

ref​
ref: string;

The reference's ref, which is also its storage key.

shadowedContent​
shadowedContent: string;

What the stored row was serving instead of the file.

Carried so the caller can log it, diff it, or keep it: this is the only moment the written body still exists anywhere, and a migration that discards it without showing it is a migration that loses an edit somebody made on purpose. Truncation is the caller's call, not this function's.


SourceReadCapabilityOptions​

Options for sourceReadCapability.

Properties​

workspace​
workspace: WorkspaceHost;

The workspace host whose run source the reads read. It must have a read view (readSource).


SubscribeTarget​

The session a subscription is written for when it isn't the running one: derived on the server by the caller, never from a tool's input.

Properties​

flow​
readonly flow: string;

The flow that session runs on: a delivery opens it there when absent.

sessionId​
readonly sessionId: string;

The session that hears.

taskId?​
readonly taskId?: string;

The task that session works: its failure or cancel ends the subscription.

tenantId?​
readonly tenantId?: string;

The tenant that session runs under; omitted, none. A target's tenant wins over the running session's: a resume from another tenant's roster keeps the saved subscription's.

worker​
readonly worker: string;

The worker that session runs.


SubscribeWrite​

How a server-side caller writes the subscription. Never a model's input.

Properties​

botsScreenedBy?​
readonly botsScreenedBy?: string;

The custom screen any bot sender is handed on to, past the sender screen, which then decides: a host's follow whose own screen admits bots (githubTrustedReviewers().follow). The input must list that custom screen, or the write is refused. Never a model's input: SubscribeInput has no such field, and a later write that doesn't list the screen drops it.

hearsClose?​
readonly hearsClose?: true;

Its thread's close reaches it whatever its kinds, screens and cap, then it ends: followPullRequest's.

id?​
readonly id?: string;

The subscription's id: a resume's saved one, or a declared routine's cfg_ key. Omitted, derived from session and thread.

madeBy?​
readonly madeBy?:
| {
by: "user";
}
| {
by: "worker";
worker: string;
}
| {
by: "app";
entry: string;
};

Who made it, kept with the subscription.

polling?​
readonly polling?: SubscriptionPolling;

The app's polling, when it polls: an enabled subscription under no tenant makes, or speeds up, the user's poll for its thread.

taskId?​
readonly taskId?: string;

The task it is made for, when the session's own state names none (a coding run in a session that works many tasks): that task's failure or cancel ends it. Wins over the session's.


SubscriptionPollCursor​

Where a poll fetches from: the poll's mark, and its validators while no delivery is owed.

Properties​

etags?​
readonly etags?: Readonly<Record<string, string>>;

The validators the last poll returned, by endpoint: a provider sends them as conditional requests.

since?​
readonly since?: number;

Fetch events whose time is at or after this one, in ms. Absent, from the provider's own start.


SubscriptionPolling​

An installation's polling: the poll schedules' collection, mirrored into its index, and the default cadence.

Properties​

everyMinutes​
readonly everyMinutes: number;

The cadence a subscription that names none polls at: routines.poll.everyMinutes, else 5.

index​
readonly index: ScheduleIndex;
resources​
readonly resources: object;

The poll schedules, for a flow's (or a block's) resources.

workforceSubscriptionPolls​
readonly workforceSubscriptionPolls: object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
client?​
client?: CollectionClientConfig;
flowIsolation?​
flowIsolation?: boolean;
pattern​
pattern: string;
runBy?​
runBy?: ResourceRunBy;
scope​
scope: "user";
stampOrgId​
stampOrgId: boolean;
stateSchema​
stateSchema: ZodObject<{
cron: ZodString;
description: ZodOptional<ZodString>;
enabled: ZodDefault<ZodBoolean>;
input: ZodOptional<ZodUnknown>;
kind: ZodString;
metadata: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
onOverlap: ZodOptional<ZodEnum<["skip", "allow"]>>;
orgId: ZodOptional<ZodString>;
timezone: ZodOptional<ZodString>;
}, "strip", ZodTypeAny, {
cron: string;
description?: string;
enabled: boolean;
input?: unknown;
kind: string;
metadata?: Record<string, unknown>;
onOverlap?: "allow" | "skip";
orgId?: string;
timezone?: string;
}, {
cron: string;
description?: string;
enabled?: boolean;
input?: unknown;
kind: string;
metadata?: Record<string, unknown>;
onOverlap?: "allow" | "skip";
orgId?: string;
timezone?: string;
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: JsonObject;
StateType​
StateType: JsonObject;

SubscriptionProvider​

A provider a session can subscribe on: its key, who may read a thread, and who the running user is there. Both read the running request's own user, on that user's credentials.

Extended by​

Properties​

provider​
readonly provider: string;

The provider key, as events and thread keys carry it (github).

screens?​
readonly screens?: SubscriptionScreens;

The app's own screens on this provider, declared once: its custom functions, and the model interest asks.

Methods​

canRead()​
canRead(thread, ctx): boolean | Promise<boolean>;

Whether the running request's user can read thread. Asked at subscribe, and again before a private event is delivered.

Parameters​
thread​

string

ctx​

BlockContext

Returns​

boolean | Promise<boolean>

poll()?​
poll?(
thread,
cursor,
ctx
): Promise<SubscriptionPollResult>;

Fetch what happened on thread since the cursor, as the running request's own user, on that user's credentials (ER-4): normalized events, each named by the same object and version a webhook delivery of it names. With etags, a provider may answer unchanged when nothing moved. Absent, the provider's subscriptions are never polled.

Parameters​
thread​

string

cursor​

SubscriptionPollCursor

ctx​

BlockContext

Returns​

Promise<SubscriptionPollResult>

refuses()?​
refuses?(thread, kinds): string | undefined;

Why a subscription to thread hearing kinds can't be taken, naming what can (an undeclared topic or kind), or undefined when it can. Asked at subscribe, before canRead. Absent, nothing is refused here.

Parameters​
thread​

string

kinds​

readonly string[] | undefined

Returns​

string | undefined

self()?​
self?(ctx, hearer): string | Promise<string | undefined> | undefined;

The running user's own id at the provider, so their own actions are dropped (own). hearer is the session the subscription is written for: a provider whose senders are sessions (internal events) answers it.

Parameters​
ctx​

BlockContext

hearer​
sessionId​

string

Returns​

string | Promise<string | undefined> | undefined


SubscriptionScreens​

The screens an app adds on one provider, declared once (D2).

Properties​

custom?​
readonly custom?: Readonly<Record<string, CustomScreen>>;

The app's custom screens by name, run in this order. A subscription lists one as { screen: "custom", name }.

interestModel?​
readonly interestModel?: string | EvaluationModel;

The one evaluation model the interest screen asks: a model string the app's resolver turns into one, or one. Without it, subscribe refuses a subscription that lists interest.


SubscriptionServiceOptions​

What a service flow is built with.

Properties​

capPerHour?​
readonly capPerHour?: number;

The most messages one subscription sends in an hour; past it, events are held and counted.

forwards?​
readonly forwards?: object;

The kinds of event the app forwards to a coordinator that follows the thread unmatched, when no other subscription heard one. Unset, nothing is forwarded, and an unheard event is dropped and counted.

kinds​
readonly kinds: readonly string[];
installation​
readonly installation: WorkerInstallation;

The app's worker installation: the sessions it delivers to run its workers.

kind​
readonly kind: string;

The flow's kind: what the owner runs it names dispatch to.

maxOwnerRuns?​
readonly maxOwnerRuns?: number;

The most subscriptions one event is delivered to; past it, refused with the cap as the reason. Default DEFAULT_MAX_OWNER_RUNS. On push it counts every subscription the event reaches; on a poll, which runs per user and thread, it counts that user's subscriptions on that thread, so N users polling one thread can each reach the cap.

normalize?​
readonly normalize?: (event, at) => readonly object[];

The provider's webhook delivery as normalized events. Given, the flow declares the webhook service route for provider.provider, and a verified delivery is routed through this flow's routing entry. Unset, only an ingestion that calls routeServiceEvent itself (a poll) routes to it.

The delivery as zero or more normalized events. Pure: the same delivery maps to the same events, so a redelivery names the same objects at the same versions. received is when the transport took it, in ms.

Parameters​
event​

WebhookInboundEvent

at​
received​

number

Returns​

readonly object[]

poll?​
readonly poll?: boolean;

Poll the provider for the subscriptions an app has no webhook for: one schedule resource per user and thread, fired by the tick (serve() runs one for a flow with a schedule index). Needs the provider's poll, and polling configured once on the installation: hireWorkforce(installation, { routines: { poll: { index, everyMinutes } } }). At each fire, a declared event routine's subscription (cfg_…) whose entry left routines.declared ends, as config_removed.

provider​
readonly provider: SubscriptionProvider;
published?​
readonly published?: true;

Events are published from inside the app (publishEvent) and enter through the dispatch seam: the routing entry is a service route, which the host runs as service:<provider> in the publisher's org, stamping the event's sender (named by its session's worker) and its owner (the publisher's user and tenant), and firing only that user's runs in that tenant. Routing nominates only that owner's subscriptions. Set by internalServiceFlow.

trustedBots?​
readonly trustedBots?: readonly string[];

Bot ids the sender screen lets through (codex).


TaskDelegates​

The running session's delegates as a task sees them: who takes one now, and why the rest can't.

Properties​

available​
readonly available: ReadonlyMap<string, string>;

Each delegate that takes a task now, by worker id, with the flow it runs on.

records​
readonly records: readonly object[];

The list's records, as read now: a worker with a target on its record leads that workstream here, and a task for that record names it (target).

unavailable​
readonly unavailable: ReadonlyMap<string, string>;

Each delegate on the list that can't take a task now, by worker id, with why.


TaskInputCheckContext​

What refuse and check are handed beside the input.

Extended by​

Properties​

assignee​
readonly assignee: string;

The worker the task is for.

ctx​
readonly ctx: BlockContext;

The request's context: the filing request's.

flow​
readonly flow: string;

The flow it runs on.

worker​
readonly worker: TaskInputWorker;

That worker, read now.


TaskInputFillContext​

What fill is handed.

Extends​

Properties​

assignee​
readonly assignee: string;

The worker the task is for.

Inherited from​

TaskInputCheckContext.assignee

at​
readonly at: "filing" | "claim";

When it runs: "filing" on a write that files the task for this flow (a filing, a move onto the flow, or an edit of a row its stamp doesn't match), or "claim" when a claim finds the row was filled under another declaration or flow. A claim has no filing turn: read nothing a later turn can change.

ctx​
readonly ctx: BlockContext;

The request's context: the filing request's.

Inherited from​

TaskInputCheckContext.ctx

flow​
readonly flow: string;

The flow it runs on.

Inherited from​

TaskInputCheckContext.flow

worker​
readonly worker: TaskInputWorker;

That worker, read now.

Inherited from​

TaskInputCheckContext.worker


TaskInputSchema​

A flow's task-input declaration: built by taskInputSchema.

Type Parameters​

T​

T extends TaskInputRecord = TaskInputRecord

Properties​

[DECLARATION]​
readonly [DECLARATION]: true;
check​
readonly check: ((input, context) => T | Promise<T>) | undefined;
filerSchema​
readonly filerSchema: Readonly<Record<string, unknown>>;

What a filer may write, as JSON Schema draft-07, fully inlined: the schema less its server-owned fields.

fill​
readonly fill:
| ((context) =>
| TaskInputRecord
| Promise<TaskInputRecord>)
| undefined;
fingerprint​
readonly fingerprint: string;

Names this declaration: its JSON Schema, server-owned names and project requirement.

notObject?​
readonly notObject?: string;

What the schema is when it isn't an object schema (z.object or z.record, refined or not), which workerTaskEntry refuses; absent for an object.

project​
readonly project: "optional" | "required";
refuse​
readonly refuse: ((sent, context) => void | Promise<void>) | undefined;
schema​
readonly schema: ZodType<T, ZodTypeDef, unknown>;

The schema the worker block is handed the input parsed by.

serverOwned​
readonly serverOwned: readonly string[];
stored​
readonly stored: ((raw) => TaskInputRecord) | undefined;
unstable?​
readonly unstable?: object;

The first step in the schema that can break the JSON round trip, which workerTaskEntry refuses; absent when none.

path​
readonly path: string;
step​
readonly step: string;

TaskInputSchemaOptions​

The options of taskInputSchema.

Type Parameters​

T​

T extends TaskInputRecord

Properties​

check?​
readonly check?: (input, context) => T | Promise<T>;

A rule the schema can't say: given the parsed input, return the input to store, or throw a TaskWriteRefusedError. It may change a filer's field, never a server-owned one. Runs on every filing and edit, never at claim. A rule only this enforces belongs in the field's .describe() text too, so a model reads it in listDelegates before it is refused.

Parameters​
input​

T

context​

TaskInputCheckContext

Returns​

T | Promise<T>

fill?​
readonly fill?: (context) =>
| TaskInputRecord
| Promise<TaskInputRecord>;

The server-owned values for this task. Anything else it returns is ignored.

Parameters​
context​

TaskInputFillContext

Returns​

| TaskInputRecord | Promise<TaskInputRecord>

project?​
readonly project?: "optional" | "required";

"required": a task for the flow filed with no project to work in is refused no_project. Omitted, "optional".

refuse?​
readonly refuse?: (sent, context) => void | Promise<void>;

Refuse by what the filer sent, before anything is dropped: throw a TaskWriteRefusedError. Runs on every filing and edit.

Parameters​
sent​

TaskInputRecord

context​

TaskInputCheckContext

Returns​

void | Promise<void>

serverOwned?​
readonly serverOwned?: readonly string[];

The fields only the server writes: a filer's value is dropped, and fill writes them.

stored?​
readonly stored?: (raw) => TaskInputRecord;

Read a stored row in a shape the flow no longer files: its old shape mapped to the current one. Runs only on stored rows: at claim, and when an edit reads the values it keeps. A write never goes through it.

Parameters​
raw​

TaskInputRecord

Returns​

TaskInputRecord


TaskInputWorker​

The worker a task is for, as the hooks are handed it: its id, and its configuration as declared (its row's settings, or its file's front matter).

Properties​

config​
readonly config: Readonly<Record<string, unknown>>;
id​
readonly id: string;

TeamManifest​

One team, as read off disk.

The record TEAM_MD produces, beside WorkerManifest and ResourceDoc in this dialect. Declared here with them for the reason they are: node-free, so the reader (which reads folders) and the join (which reads nothing) never hold two spellings of one record.

A team is not a worker. This record declares no flow, reaches no hireWorkforce roster, and mints no address — it carries what a team says about itself and what it tells its workers, and nothing else.

Properties​

declared​
declared: Record<string, unknown>;

Frontmatter exactly as written — keys as the file spelled them, values uninterpreted.

description​
description: string;

What this team is, in one line — its file's required description.

Surfaced here rather than parsed and discarded. Nothing reads it yet: no roster view exists, and building one is not this convention's job. Required all the same, because the dialect requires it on every file an author writes by hand, and validating a value only to drop it is worse than either reading it or not asking for it.

id​
id: string;

The team's id, which is its folder's name. Derived, never declared.

instructions?​
instructions?: string;

What every worker on this team is told: the file's Markdown body, verbatim.

Absent when the body is empty or whitespace, never "". Whitespace is not instructions — the rule the worker factory already applies one level up, where an empty body handed over as a setting turned every thin worker into a failed hire.

name?​
name?: string;

Display name from the file's optional name: (e.g. "Engineering" for eng). Absent when the file names none.


TreePlace​

A place in the workforce tree — the only thing reachability is decided from.

undefined means "not at that level", so the org level is { team: undefined, worker: undefined } and a team's own folder is { team: "engineering", worker: undefined }.

Properties​

team?​
team?: string;

The team folder, or undefined at the org level.

worker?​
worker?: string;

The worker folder, or undefined when this is not inside one.


WorkerFlowBuilder​

A worker flow waiting for its installation. See workerFlow.

Properties​

[BUILDER]​
readonly [BUILDER]: true;
build​
readonly build: (installation) => unknown;

Builds the flow on the installation that runs its workers. Called once per installation.

Parameters​
installation​

WorkerInstallation

Returns​

unknown

retiredSettings​
readonly retiredSettings: readonly string[];

Settings the flow no longer takes: a stored worker that set one reads without it, and a hire or an edit naming one is refused.

roles​
readonly roles:
| readonly ("contributor" | "manager" | "coordinator")[]
| undefined;

The roles the flow declares, beside every worker's door; undefined when the builder names none, so a built-in flow it builds keeps its own.

showSettings​
readonly showSettings: readonly string[];

The flow's settings a user may see on the roster; empty when it names none.

standardOnly​
readonly standardOnly: boolean;

Whether the app keeps the flow for the workers its files define.


WorkerGrants​

The two ways an installation's documents and references are handed to a worker flow.

Extended by​

Properties​

documents​
readonly documents: DeclaredResources;

Every document and reference a worker may be granted, by accessor. A worker flow whose model reaches documents declares them all in its resources, and sets resourceVisibility so each turn's model reaches only its worker's.

resourceVisibility​
readonly resourceVisibility: ResourceVisibilityRule;

The flow's resourceVisibility: on each turn, a granted document is visible to the model's resource tools when the worker resolveWorker loaded on this turn reaches it, read-only when its grant is, and hidden otherwise, including on a turn that loaded no worker. Every other resource is visible.


WorkerHireBlocks​

The five blocks, ready to mount as actions.

Properties​

edit​
edit: BlockDefinition<ZodEffects<ZodObject<{
additionalInstructions: ZodOptional<ZodNullable<ZodString>>;
description: ZodOptional<ZodNullable<ZodString>>;
flow: ZodOptional<ZodString>;
id: ZodString;
instructions: ZodOptional<ZodNullable<ZodString>>;
name: ZodOptional<ZodNullable<ZodString>>;
settings: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
settingsPatch: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
skills: ZodOptional<ZodArray<ZodString, "many">>;
}, "strict", ZodTypeAny, {
additionalInstructions?: string | null;
description?: string | null;
flow?: string;
id: string;
instructions?: string | null;
name?: string | null;
settings?: Record<string, unknown>;
settingsPatch?: Record<string, unknown>;
skills?: string[];
}, {
additionalInstructions?: string | null;
description?: string | null;
flow?: string;
id: string;
instructions?: string | null;
name?: string | null;
settings?: Record<string, unknown>;
settingsPatch?: Record<string, unknown>;
skills?: string[];
}>, {
additionalInstructions?: string | null;
description?: string | null;
flow?: string;
id: string;
instructions?: string | null;
name?: string | null;
settings?: Record<string, unknown>;
settingsPatch?: Record<string, unknown>;
skills?: string[];
}, {
additionalInstructions?: string | null;
description?: string | null;
flow?: string;
id: string;
instructions?: string | null;
name?: string | null;
settings?: Record<string, unknown>;
settingsPatch?: Record<string, unknown>;
skills?: string[];
}>, ZodObject<{
flow: ZodString;
id: ZodString;
}, "strip", ZodTypeAny, {
flow: string;
id: string;
}, {
flow: string;
id: string;
}>>;

Change one of the caller's own workers: { id, ...fields to replace }. On a standard worker's id, it first copies that worker onto the caller's roster under the same id, unless the caller already has the copy.

fire​
fire: BlockDefinition<ZodObject<{
id: ZodString;
}, "strict", ZodTypeAny, {
id: string;
}, {
id: string;
}>, ZodObject<{
id: ZodString;
}, UnknownKeysParam, ZodTypeAny, {
id: string;
}, {
id: string;
}>>;

Delete one of the caller's own workers: { id }.

fork​
fork: BlockDefinition<ZodObject<{
from: ZodString;
id: ZodString;
}, "strict", ZodTypeAny, {
from: string;
id: string;
}, {
from: string;
id: string;
}>, ZodObject<{
flow: ZodString;
id: ZodString;
}, "strip", ZodTypeAny, {
flow: string;
id: string;
}, {
flow: string;
id: string;
}>>;

Fork a standard worker, or one of the caller's own, under a new id: { from, id }.

hire​
hire: BlockDefinition<ZodObject<{
description: ZodOptional<ZodString>;
flow: ZodOptional<ZodString>;
id: ZodString;
instructions: ZodOptional<ZodString>;
name: ZodOptional<ZodString>;
settings: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
skills: ZodOptional<ZodArray<ZodString, "many">>;
}, "strict", ZodTypeAny, {
description?: string;
flow?: string;
id: string;
instructions?: string;
name?: string;
settings?: Record<string, unknown>;
skills?: string[];
}, {
description?: string;
flow?: string;
id: string;
instructions?: string;
name?: string;
settings?: Record<string, unknown>;
skills?: string[];
}>, ZodObject<{
flow: ZodString;
id: ZodString;
}, "strip", ZodTypeAny, {
flow: string;
id: string;
}, {
flow: string;
id: string;
}>>;

Hire a new worker of the caller's own: { id, flow?, description?, instructions?, skills?, settings? }.

reset​
reset: BlockDefinition<ZodObject<{
id: ZodString;
}, "strict", ZodTypeAny, {
id: string;
}, {
id: string;
}>, ZodObject<{
id: ZodString;
}, UnknownKeysParam, ZodTypeAny, {
id: string;
}, {
id: string;
}>>;

Delete the caller's copy of a standard worker, so the file is read again: { id }.


WorkerInstallation​

The installation's worker model. Build it once, at boot.

Extends​

Properties​

createCheck​
readonly createCheck: SessionCreateCheck;

The create check a worker flow declares as session.createCheck.

documents​
readonly documents: DeclaredResources;

Every document and reference a worker may be granted, by accessor. A worker flow whose model reaches documents declares them all in its resources, and sets resourceVisibility so each turn's model reaches only its worker's.

Inherited from​

WorkerGrants.documents

resources​
readonly resources: object & object;

The two worker collections, the user's own workers and the standard ones projected from the files, and the workstream entries the create check reads a workstream session's link from, and the worker-usage records every request's spend is added to, and the user's routine collections, which a worker's request seeds the app's declared routines into. A worker flow spreads them into its resources, and so does every block that calls resolveWorker or writes a worker.

Type Declaration​
workforceScheduledFires​
workforceScheduledFires: object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
flowIsolation​
readonly flowIsolation: false;
pattern​
readonly pattern: "scheduled-fires/**";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: ZodObject<{
lastFiredAt: ZodNumber;
}, "passthrough", ZodTypeAny, objectOutputType<{
lastFiredAt: ZodNumber;
}, ZodTypeAny, "passthrough">, objectInputType<{
lastFiredAt: ZodNumber;
}, ZodTypeAny, "passthrough">>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: JsonObject;
StateType​
StateType: JsonObject;
workforceSchedules​
workforceSchedules: object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
client?​
client?: CollectionClientConfig<JsonObject>;
flowIsolation?​
flowIsolation?: boolean;
pattern​
pattern: string;
runBy?​
runBy?: ResourceRunBy;
scope​
scope: "user";
stampOrgId​
stampOrgId: boolean;
stateSchema​
stateSchema: ZodObject<{
cron: ZodString;
description: ZodOptional<ZodString>;
enabled: ZodDefault<ZodBoolean>;
input: ZodOptional<ZodUnknown>;
kind: ZodString;
metadata: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
onOverlap: ZodOptional<ZodEnum<["skip", "allow"]>>;
orgId: ZodOptional<ZodString>;
timezone: ZodOptional<ZodString>;
}, "strip", ZodTypeAny, {
cron: string;
description?: string;
enabled: boolean;
input?: unknown;
kind: string;
metadata?: Record<string, unknown>;
onOverlap?: "allow" | "skip";
orgId?: string;
timezone?: string;
}, {
cron: string;
description?: string;
enabled?: boolean;
input?: unknown;
kind: string;
metadata?: Record<string, unknown>;
onOverlap?: "allow" | "skip";
orgId?: string;
timezone?: string;
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: JsonObject;
StateType​
StateType: JsonObject;
workforceSubscriptionCursors​
workforceSubscriptionCursors: object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
flowIsolation​
readonly flowIsolation: false;
pattern​
readonly pattern: "workforce/subscription-cursors/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: ZodObject<{
held: ZodDefault<ZodNumber>;
inFlight: ZodDefault<ZodArray<ZodTuple<[ZodString, ZodNumber, ZodNumber], null>, "many">>;
screened: ZodDefault<ZodArray<ZodTuple<[ZodString, ZodNumber, ZodNumber], null>, "many">>;
seen: ZodDefault<ZodArray<ZodTuple<[ZodString, ZodNumber], null>, "many">>;
window: ZodDefault<ZodObject<{
sent: ZodNumber;
start: ZodNumber;
}, "strip", ZodTypeAny, {
sent: number;
start: number;
}, {
sent: number;
start: number;
}>>;
}, "strip", ZodTypeAny, {
held: number;
inFlight: [string, number, number][];
screened: [string, number, number][];
seen: [string, number][];
window: {
sent: number;
start: number;
};
}, {
held?: number;
inFlight?: [string, number, number][];
screened?: [string, number, number][];
seen?: [string, number][];
window?: {
sent: number;
start: number;
};
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.held​
held: number;
ClientType.inFlight​
inFlight: [string, number, number][];
ClientType.screened​
screened: [string, number, number][];
ClientType.seen​
seen: [string, number][];
ClientType.window​
window: object;
ClientType.window.sent​
sent: number;
ClientType.window.start​
start: number;
StateType​
StateType: object;
StateType.held​
held: number;
StateType.inFlight​
inFlight: [string, number, number][];
StateType.screened​
screened: [string, number, number][];
StateType.seen​
seen: [string, number][];
StateType.window​
window: object;
StateType.window.sent​
sent: number;
StateType.window.start​
start: number;
workforceSubscriptionIndex​
workforceSubscriptionIndex: object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
flowIsolation​
readonly flowIsolation: false;
pattern​
readonly pattern: "workforce/subscription-index/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "org";
stateSchema​
readonly stateSchema: ZodObject<{
subscriptions: ZodDefault<ZodRecord<ZodString, ZodObject<object & object, "strip", ZodTypeAny, {
botsScreenedBy?: ... | ...;
followRev?: ... | ...;
hearsClose?: ... | ...;
hostScreens?: ... | ...;
interest?: ... | ...;
kinds?: ... | ...;
orgId: string;
outsiders?: ... | ...;
provider: string;
screens: ...[];
self?: ... | ...;
tenantId?: ... | ...;
thread: string;
unmatched?: ... | ...;
userId: string;
}, {
botsScreenedBy?: ... | ...;
followRev?: ... | ...;
hearsClose?: ... | ...;
hostScreens?: ... | ...;
interest?: ... | ...;
kinds?: ... | ...;
orgId: string;
outsiders?: ... | ...;
provider: string;
screens?: ... | ...;
self?: ... | ...;
tenantId?: ... | ...;
thread: string;
unmatched?: ... | ...;
userId: string;
}>>>;
}, "strip", ZodTypeAny, {
subscriptions: Record<string, {
botsScreenedBy?: string;
followRev?: 2;
hearsClose?: true;
hostScreens?: ...[];
interest?: string;
kinds?: string[];
orgId: string;
outsiders?: true;
provider: string;
screens: (... | ... | ... | ... | ...)[];
self?: string;
tenantId?: string;
thread: string;
unmatched?: true;
userId: string;
}>;
}, {
subscriptions?: Record<string, {
botsScreenedBy?: string;
followRev?: 2;
hearsClose?: true;
hostScreens?: ...[];
interest?: string;
kinds?: ...[];
orgId: string;
outsiders?: true;
provider: string;
screens?: ...[];
self?: string;
tenantId?: string;
thread: string;
unmatched?: true;
userId: string;
}>;
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.subscriptions​
subscriptions: Record<string, {
botsScreenedBy?: string;
followRev?: 2;
hearsClose?: true;
hostScreens?: (... | ... | ... | ... | ...)[];
interest?: string;
kinds?: string[];
orgId: string;
outsiders?: true;
provider: string;
screens: (
| {
any: ...;
screen: ...;
}
| {
any: ...;
screen: ...;
}
| {
bots?: ...;
ids: ...;
screen: ...;
}
| {
name: ...;
screen: ...;
}
| {
screen: ...;
})[];
self?: string;
tenantId?: string;
thread: string;
unmatched?: true;
userId: string;
}>;
StateType​
StateType: object;
StateType.subscriptions​
subscriptions: Record<string, {
botsScreenedBy?: string;
followRev?: 2;
hearsClose?: true;
hostScreens?: (... | ... | ... | ... | ...)[];
interest?: string;
kinds?: string[];
orgId: string;
outsiders?: true;
provider: string;
screens: (
| {
any: ...;
screen: ...;
}
| {
any: ...;
screen: ...;
}
| {
bots?: ...;
ids: ...;
screen: ...;
}
| {
name: ...;
screen: ...;
}
| {
screen: ...;
})[];
self?: string;
tenantId?: string;
thread: string;
unmatched?: true;
userId: string;
}>;
workforceSubscriptionPolls​
workforceSubscriptionPolls: object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
client?​
client?: CollectionClientConfig;
flowIsolation?​
flowIsolation?: boolean;
pattern​
pattern: string;
runBy?​
runBy?: ResourceRunBy;
scope​
scope: "user";
stampOrgId​
stampOrgId: boolean;
stateSchema​
stateSchema: ZodObject<{
cron: ZodString;
description: ZodOptional<ZodString>;
enabled: ZodDefault<ZodBoolean>;
input: ZodOptional<ZodUnknown>;
kind: ZodString;
metadata: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
onOverlap: ZodOptional<ZodEnum<["skip", "allow"]>>;
orgId: ZodOptional<ZodString>;
timezone: ZodOptional<ZodString>;
}, "strip", ZodTypeAny, {
cron: string;
description?: string;
enabled: boolean;
input?: unknown;
kind: string;
metadata?: Record<string, unknown>;
onOverlap?: "allow" | "skip";
orgId?: string;
timezone?: string;
}, {
cron: string;
description?: string;
enabled?: boolean;
input?: unknown;
kind: string;
metadata?: Record<string, unknown>;
onOverlap?: "allow" | "skip";
orgId?: string;
timezone?: string;
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: JsonObject;
StateType​
StateType: JsonObject;
workforceSubscriptions​
workforceSubscriptions: object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
client​
readonly client: object;
client.state​
readonly state: object;
client.state.read​
readonly read: true;
flowIsolation​
readonly flowIsolation: false;
pattern​
readonly pattern: "workforce/subscriptions/*";
prefetchMode​
readonly prefetchMode: "lazy";
runBy​
readonly runBy: object;
runBy.flow​
flow: "workforce-roster";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: ZodObject<object & object, "strip", ZodTypeAny, {
at: number;
botsScreenedBy?: string;
enabled: boolean;
endedAt?: number;
endedReason?: string;
everyMinutes?: number;
flow: string;
followRev?: 2;
hearsClose?: true;
hostScreens?: (
| {
any: ...[];
screen: "labels";
}
| {
any: ...[];
screen: "words";
}
| {
bots?: ... | ...;
ids: ...[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
id: string;
interest: string;
kinds?: string[];
madeBy?: | {
by: "user";
}
| {
by: "worker";
worker: string;
}
| {
by: "app";
entry: string;
};
orgId: string;
outsiders?: true;
provider: string;
screens: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: ...[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
self?: string;
sessionId: string;
taskId?: string;
tenantId?: string;
thread: string;
unmatched?: true;
userId: string;
worker: string;
}, {
at: number;
botsScreenedBy?: string;
enabled: boolean;
endedAt?: number;
endedReason?: string;
everyMinutes?: number;
flow: string;
followRev?: 2;
hearsClose?: true;
hostScreens?: (
| {
any: ...[];
screen: "labels";
}
| {
any: ...[];
screen: "words";
}
| {
bots?: ... | ...;
ids: ...[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
id: string;
interest: string;
kinds?: string[];
madeBy?: | {
by: "user";
}
| {
by: "worker";
worker: string;
}
| {
by: "app";
entry: string;
};
orgId: string;
outsiders?: true;
provider: string;
screens?: (
| {
any: ...[];
screen: "labels";
}
| {
any: ...[];
screen: "words";
}
| {
bots?: ... | ...;
ids: ...[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
self?: string;
sessionId: string;
taskId?: string;
tenantId?: string;
thread: string;
unmatched?: true;
userId: string;
worker: string;
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.at​
at: number;
ClientType.botsScreenedBy?​
botsScreenedBy?: string;
ClientType.enabled​
enabled: boolean;
ClientType.endedAt?​
endedAt?: number;
ClientType.endedReason?​
endedReason?: string;
ClientType.everyMinutes?​
everyMinutes?: number;
ClientType.flow​
flow: string;
ClientType.followRev?​
followRev?: 2;
ClientType.hearsClose?​
hearsClose?: true;
ClientType.hostScreens?​
hostScreens?: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: ...[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
ClientType.id​
id: string;
ClientType.interest​
interest: string;
ClientType.kinds?​
kinds?: string[];
ClientType.madeBy?​
madeBy?:
| {
by: "user";
}
| {
by: "worker";
worker: string;
}
| {
by: "app";
entry: string;
};
ClientType.orgId​
orgId: string;
ClientType.outsiders?​
outsiders?: true;
ClientType.provider​
provider: string;
ClientType.screens​
screens: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: string[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
ClientType.self?​
self?: string;
ClientType.sessionId​
sessionId: string;
ClientType.taskId?​
taskId?: string;
ClientType.tenantId?​
tenantId?: string;
ClientType.thread​
thread: string;
ClientType.unmatched?​
unmatched?: true;
ClientType.userId​
userId: string;
ClientType.worker​
worker: string;
StateType​
StateType: object;
StateType.at​
at: number;
StateType.botsScreenedBy?​
botsScreenedBy?: string;
StateType.enabled​
enabled: boolean;
StateType.endedAt?​
endedAt?: number;
StateType.endedReason?​
endedReason?: string;
StateType.everyMinutes?​
everyMinutes?: number;
StateType.flow​
flow: string;
StateType.followRev?​
followRev?: 2;
StateType.hearsClose?​
hearsClose?: true;
StateType.hostScreens?​
hostScreens?: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: ...[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
StateType.id​
id: string;
StateType.interest​
interest: string;
StateType.kinds?​
kinds?: string[];
StateType.madeBy?​
madeBy?:
| {
by: "user";
}
| {
by: "worker";
worker: string;
}
| {
by: "app";
entry: string;
};
StateType.orgId​
orgId: string;
StateType.outsiders?​
outsiders?: true;
StateType.provider​
provider: string;
StateType.screens​
screens: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: string[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
StateType.self?​
self?: string;
StateType.sessionId​
sessionId: string;
StateType.taskId?​
taskId?: string;
StateType.tenantId?​
tenantId?: string;
StateType.thread​
thread: string;
StateType.unmatched?​
unmatched?: true;
StateType.userId​
userId: string;
StateType.worker​
worker: string;
workforceSubscriptionTaskEndings​
workforceSubscriptionTaskEndings: object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
flowIsolation​
readonly flowIsolation: false;
pattern​
readonly pattern: "workforce/subscription-task-endings/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: ZodObject<{
at: ZodNumber;
attempt: ZodOptional<ZodNumber>;
ending: ZodEnum<["errored", "cancelled"]>;
}, "strip", ZodTypeAny, {
at: number;
attempt?: number;
ending: "errored" | "cancelled";
}, {
at: number;
attempt?: number;
ending: "errored" | "cancelled";
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.at​
at: number;
ClientType.attempt?​
attempt?: number;
ClientType.ending​
ending: "errored" | "cancelled";
StateType​
StateType: object;
StateType.at​
at: number;
StateType.attempt?​
attempt?: number;
StateType.ending​
ending: "errored" | "cancelled";
privateWorkstreams​
readonly privateWorkstreams: ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
stateSchema​
stateSchema: ZodTypeAny;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: any;
StateType​
StateType: any;
worker-usage​
readonly "worker-usage": object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
flowIsolation​
readonly flowIsolation: false;
llmWritable​
readonly llmWritable: false;
pattern​
readonly pattern: "worker-usage/**";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: ZodObject<{
day: ZodDefault<ZodString>;
sources: ZodDefault<ZodArray<ZodObject<{
billing: ZodDefault<...>;
costUsd: ZodDefault<...>;
inputTokens: ZodDefault<...>;
kind: ZodEnum<...>;
outputTokens: ZodDefault<...>;
runs: ZodDefault<...>;
source: ZodString;
unreported: ZodDefault<...>;
}, "strip", ZodTypeAny, {
billing: ... | ... | ...;
costUsd: ... | ...;
inputTokens: number;
kind: ... | ...;
outputTokens: number;
runs: number;
source: string;
unreported: number;
}, {
billing?: ... | ... | ... | ...;
costUsd?: ... | ... | ...;
inputTokens?: ... | ...;
kind: ... | ...;
outputTokens?: ... | ...;
runs?: ... | ...;
source: string;
unreported?: ... | ...;
}>, "many">>;
worker: ZodDefault<ZodString>;
}, "strip", ZodTypeAny, {
day: string;
sources: object[];
worker: string;
}, {
day?: string;
sources?: object[];
worker?: string;
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.day​
day: string;
ClientType.sources​
sources: object[];
ClientType.worker​
worker: string;
StateType​
StateType: object;
StateType.day​
day: string;
StateType.sources​
sources: object[];
StateType.worker​
worker: string;
workforceStandardWorkers​
readonly workforceStandardWorkers: DefinedProjectedResourceCollection<JsonObject>;
workforceWorkers​
readonly workforceWorkers: object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
client​
readonly client: object;
client.data​
readonly data: (row) => object;
Parameters​
row​

Readonly<any>

Returns​

object

description​
description: any;
flow​
flow: any;
forkedFrom​
forkedFrom: any;
name​
name: any;
settings​
settings: never;
client.state​
readonly state: object;
client.state.read​
readonly read: true;
flowIsolation​
readonly flowIsolation: false;
pattern​
readonly pattern: "workforce/workers/*";
runBy​
readonly runBy: object;
runBy.flow​
flow: "workforce-roster";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: ZodObject<{
additionalInstructions: ZodDefault<ZodNullable<ZodString>>;
description: ZodDefault<ZodNullable<ZodString>>;
flow: ZodString;
forkedFrom: ZodDefault<ZodNullable<ZodString>>;
instructions: ZodDefault<ZodNullable<ZodString>>;
name: ZodDefault<ZodNullable<ZodString>>;
settings: ZodDefault<ZodRecord<ZodString, ZodUnknown>>;
skills: ZodDefault<ZodArray<ZodString, "many">>;
teamInstructions: ZodDefault<ZodNullable<ZodString>>;
}, "passthrough", ZodTypeAny, objectOutputType<{
additionalInstructions: ZodDefault<ZodNullable<ZodString>>;
description: ZodDefault<ZodNullable<ZodString>>;
flow: ZodString;
forkedFrom: ZodDefault<ZodNullable<ZodString>>;
instructions: ZodDefault<ZodNullable<ZodString>>;
name: ZodDefault<ZodNullable<ZodString>>;
settings: ZodDefault<ZodRecord<ZodString, ZodUnknown>>;
skills: ZodDefault<ZodArray<ZodString, "many">>;
teamInstructions: ZodDefault<ZodNullable<ZodString>>;
}, ZodTypeAny, "passthrough">, objectInputType<{
additionalInstructions: ZodDefault<ZodNullable<ZodString>>;
description: ZodDefault<ZodNullable<ZodString>>;
flow: ZodString;
forkedFrom: ZodDefault<ZodNullable<ZodString>>;
instructions: ZodDefault<ZodNullable<ZodString>>;
name: ZodDefault<ZodNullable<ZodString>>;
settings: ZodDefault<ZodRecord<ZodString, ZodUnknown>>;
skills: ZodDefault<ZodArray<ZodString, "many">>;
teamInstructions: ZodDefault<ZodNullable<ZodString>>;
}, ZodTypeAny, "passthrough">>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.description​
description: any;
ClientType.flow​
flow: any;
ClientType.forkedFrom​
forkedFrom: any;
ClientType.name​
name: any;
ClientType.settings​
settings: never;
StateType​
StateType: JsonObject;
workstreams​
readonly workstreams: ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
stateSchema​
stateSchema: ZodTypeAny;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: any;
StateType​
StateType: any;
resourceVisibility​
readonly resourceVisibility: ResourceVisibilityRule;

The flow's resourceVisibility: on each turn, a granted document is visible to the model's resource tools when the worker resolveWorker loaded on this turn reaches it, read-only when its grant is, and hidden otherwise, including on a turn that loaded no worker. Every other resource is visible.

Inherited from​

WorkerGrants.resourceVisibility

sessionFields​
readonly sessionFields: SessionFields;

The app's session fields (WorkerInstallationOptions.sessionFields): session declares them on every worker flow, and each hand-over carries the filer's values down. Empty when the app declares none.

sessionStateShape​
readonly sessionStateShape: object;

The session-state fields a worker flow declares, readonly: spread them into the flow's session stateSchema, beside the flow's own fields. workerId names the session's worker; filingSessionId, when a coordinator's delivery set it, names the conversation it was opened for; workstreamId, when a workstream's open set it, names the workstream the session leads; taskId, when a conversation's board handed a task over, names the task the session works, filingWorkstreamId the workstream it was filed from, and filingProjectId the project; projectId, on a project coordinator's session, names its project; workProjectId, on a user's own conversation, names the project they set it to work in (not readonly: the work-project action writes and replaces it).

filingFlow​
readonly filingFlow: ZodOptional<ZodReadonly<ZodString>>;
filingProjectId​
readonly filingProjectId: ZodOptional<ZodReadonly<ZodString>>;
filingSessionId​
readonly filingSessionId: ZodOptional<ZodReadonly<ZodString>>;
filingWorkerId​
readonly filingWorkerId: ZodOptional<ZodReadonly<ZodString>>;
filingWorkstreamId​
readonly filingWorkstreamId: ZodOptional<ZodReadonly<ZodString>>;
projectId​
readonly projectId: ZodOptional<ZodReadonly<ZodString>>;
routedFrom​
readonly routedFrom: ZodOptional<ZodString>;
taskChain​
readonly taskChain: ZodOptional<ZodReadonly<ZodObject<{
depth: ZodNumber;
top: ZodObject<{
partition: ZodString;
taskId: ZodString;
}, "strict", ZodTypeAny, {
partition: string;
taskId: string;
}, {
partition: string;
taskId: string;
}>;
}, "strict", ZodTypeAny, {
depth: number;
top: {
partition: string;
taskId: string;
};
}, {
depth: number;
top: {
partition: string;
taskId: string;
};
}>>>;
taskFlow​
readonly taskFlow: ZodOptional<ZodReadonly<ZodString>>;
taskId​
readonly taskId: ZodOptional<ZodReadonly<ZodString>>;
taskTitle​
readonly taskTitle: ZodOptional<ZodString>;
workerId​
readonly workerId: ZodReadonly<ZodString>;
workerName​
readonly workerName: ZodOptional<ZodReadonly<ZodString>>;
workProjectId​
readonly workProjectId: ZodOptional<ZodString>;
workstreamId​
readonly workstreamId: ZodOptional<ZodReadonly<ZodString>>;

Methods​

configurationProblems()​
configurationProblems(id, row): string[];

Check a worker's configuration as its flow would on a turn, without running anything: the same resolution and the same refusals. Used by hire, fork and edit before they write.

Parameters​
id​

string

row​
additionalInstructions​

string | null

description​

string | null

flow​

string

forkedFrom​

string | null

instructions​

string | null

name​

string | null

settings​

Record<string, unknown>

skills​

string[]

teamInstructions​

string | null

Returns​

string[]

The reasons it would be refused; empty when it would run.

projectCoordinator()​
projectCoordinator():
| {
flow: string;
worker: string;
}
| undefined;

The standard worker every user's project coordinator runs as, and the flow it runs on, or undefined when the installation names none.

Returns​

| { flow: string; worker: string; } | undefined

resolveWorker()​
resolveWorker(ctx, flowKind): Promise<ResolvedWorker>;

The worker this turn runs as, loaded now: the session's worker read from the user's roster or the standard workers, with its configuration resolved. Call it on every turn of a worker flow: in the flow's request.onStarted, which runs again when a request resumes, or in the block that reads the worker. Not in an earlier step of the turn: a resumed request reuses a finished step's recorded output without running it, so the worker it loaded is gone on the resumed run.

Parameters​
ctx​

WorkerTurnContext

The block's context. The block must declare resources.

flowKind​

string

The running flow's name.

Returns​

Promise<ResolvedWorker>

Throws​

WorkerTurnRefusedError when the turn can't run as the worker.

roster()​
roster(ctx): Promise<RosterWorker[]>;

The session user's whole roster, read now: their own workers (one list of their worker collection) and every standard worker, by id order. A standard worker of the same id as one of theirs is theirs: a hire can't take a standard id, so this only matters for a row written by hand.

Parameters​
ctx​

WorkerTurnContext

The block's context. The block must declare resources.

Returns​

Promise<RosterWorker[]>

rosterWorker()​
rosterWorker(ctx, workerId): Promise<RosterWorker | undefined>;

The worker workerId names on the session user's roster, read by id now: one of their own (read at their scope, so another user's is simply not there) or a standard one. undefined when the user has no such worker, which is also the answer for another user's.

Answers "is it yours", not "may it run": nothing is minted.

Parameters​
ctx​

WorkerTurnContext

The block's context. The block must declare resources.

workerId​

string

Returns​

Promise<RosterWorker | undefined>

session()​
session<TShape>(extraShape?): object;

A worker flow's session declaration: sessionStateShape, the state every worker's onMessageReceived keeps, and extraShape as its stateSchema, createCheck, and as serverOwned the delegate and board fields only the server writes (SESSION_BOARD_SERVER_OWNED, which carries workProjectId too). A flow without those fields still refuses a create that seeds one, by name, rather than dropping it. workProjectId is exposed to the session read too, so a screen shows the project a conversation works in. The app's sessionFields join the schema, serverOwned and the session read. Its label names a session by its worker, and its task when it has one. It also carries, under a framework-only symbol, the request-end hook that adds every request's spend to the worker's usage record (worker-usage).

Type Parameters​
TShape​

TShape extends ZodRawShape = Record<never, never>

Parameters​
extraShape?​

TShape

Returns​

object

[SESSION_REQUEST_END_HOOK]​
[SESSION_REQUEST_END_HOOK]: SessionRequestEndHook;
client​
client: object;
client.expose​
expose: readonly string[];
createCheck​
createCheck: SessionCreateCheck;
label​
label: SessionLabel;
serverOwned​
serverOwned: readonly string[];
stateSchema​
stateSchema: ZodObject<object & TShape>;
standardWorker()​
standardWorker(id): WorkerManifest | undefined;

A standard worker by id, or undefined.

Parameters​
id​

string

Returns​

WorkerManifest | undefined

standardWorkerProblems()​
standardWorkerProblems(): string[];

Check every standard worker the same way, as its file declares it. Used by hireWorkforce, which refuses to register anything while one would be refused on its first turn.

Returns​

string[]

Each refusal, prefixed with the worker's id; empty when every one would run.

standardWorkers()​
standardWorkers(): readonly WorkerManifest[];

Every standard worker, by id order.

Returns​

readonly WorkerManifest[]

workerFlows()​
workerFlows(): Record<string, ResolvedWorkerFlow>;

The worker flows, resolved: each one's flow and whether it is kept for standard workers.

Returns​

Record<string, ResolvedWorkerFlow>


WorkerLookup​

The lookup, and the shapes the framework plugs it in as.

Properties​

flowKind​
flowKind: TaskFlowTarget;

The per-task target for a list's fallback: dispatcher({ action: "work", session: "per-task", flowKind: lookup.flowKind, state: lookup.state }). A name no worker holds answers nothing, which refuses the hand-over flow-not-found naming it; a worker whose flow takes no tasks throws its own sentence. Either way the claim is still held, so the task fails through the list's ordinary error path.

state​
state: TaskStateTarget;

The per-task child state, beside flowKind: names the worker the task names, so the worker flow's create check confirms it when the task's session is created. Read from the task the board hands over, never from its input.

Methods​

filingCheck()​
filingCheck(aliases?): (name, listId, ctx) => string | undefined;

The check a door makes before it files a task for name on list listId: undefined when the name is fine, else the sentence to refuse with. A name a board over that list declares as its own worker (DevTeam's coder) passes without the lookup, since that board routes it itself.

Parameters​
aliases?​

Readonly<Record<string, readonly string[]>>

Each list's own worker names, by list id, as the host read them off the boards it built.

Returns​

(name, listId, ctx) => string | undefined

find()​
find(name, ctx?): WorkerLookupAnswer;

Which worker name means: the flow it runs on, or why there is none.

Parameters​
name​

string

ctx?​

BlockContext<Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, AnyResourceRef>, Record<string, unknown>, unknown, Record<string, ZodTypeAny>, { }, Record<string, unknown>, Record<string, unknown>, Readonly<Record<string, unknown>>>

Returns​

WorkerLookupAnswer


WorkerLookupOptions​

Properties​

installation​
installation: WorkerInstallation;

The installation whose standard workers a task can name.


WorkerManifest​

One worker, as declared on disk or hand-built. Declared once, in this module; the loader returns this type rather than a second one of its own.

Properties​

body​
body: string;

The worker's instructions: Markdown body verbatim, frontmatter removed. Empty for a thin worker; reaches a hired flow as config.instructions.

declared​
declared: Record<string, unknown>;

Frontmatter exactly as written — keys as the file spelled them, values uninterpreted.

id​
id: string;

The worker's identity and flow address. On a file-declared record it is one of two declared shapes:

  • a team worker (teams/<teamId>/workers/<name>/) is "<teamId>.<name>", e.g. "engineering.lead";
  • an org worker (org/workers/<name>/) has no team and is the bare "<name>", e.g. "shift-coordinator". On a runtime hire it is the org-qualified address instead, and the declared id is WorkerManifest.workerId. To read a worker's team, parse manifest.workerId ?? manifest.id with parseDeclaredWorkerId rather than splitting on the dot; never parse a hire's id, whose org reads as a team. Dot-joined, not slash-joined: a "/" here is unroutable (decision 2). Minted once, by the loader, in one helper — and the record's only identity field.
packages?​
packages?: PackageManifest[];

The packages this worker can reach — the org's library, its team's library, and the ones in its own folder — in that order.

Filled by the joined loader (readWorkforce), and absent when none are in reach, as on a hand-built record. Reach is not holding: the hire gives the worker every package at the worker level and, from the two libraries, only the ones its file names in packages:.

skills?​
skills?: InitialSkill[];

The skills this worker can see — the org ∪ team (team workers only) ∪ own-folder union, already resolved, in level order.

Filled by the joined loader (readWorkforce) and absent on a hand-built record, which is the difference between "this worker has no skills" and "nobody read any folders for it". A non-empty set reaches a hired flow as config.workerSkills (WORKER_SKILLS_KEY), the same way a body reaches it as instructions.

Carried on the record rather than looked up at run time because a running block deliberately cannot see which instance it is: the record is what the mint reads, so the record is where a per-worker set has to ride.

teamInstructions?​
teamInstructions?: string;

The instructions this worker's TEAM wrote — its team's, never its own.

Filled by the joined loader (readWorkforce) from the team's TEAM_MD, and absent on a hand-built record, which is the difference between "this worker's team wrote none" and "nobody read a team file for it" — the same shape and the same story as WorkerManifest.skills.

Absent rather than empty when a team wrote nothing, all the way down: it reaches a hired flow as config.teamInstructions (TEAM_INSTRUCTIONS_KEY) only when it is here, so a team with no file changes nothing about the bag its workers receive. Always absent on an org worker, which has no team.

Never merged with WorkerManifest.body. Two layers that cannot be told apart at the seam are one layer, and a worker flow that wants only the worker's own charter must be able to have it.

teamName?​
teamName?: string;

Its team's display name, from the team's TEAM_MD name:. Absent when the file names none, on an org worker, and on a hand-built record.


WorkerRecipients​

Who a worker can reach, by how it hears.

Properties​

messageable​
readonly messageable: readonly RosterWorker[];

Workers a message by name reaches.

self​
readonly self: RosterWorker | undefined;

The running worker's own roster entry, from the same read; undefined when it isn't on the roster.

taskOnly​
readonly taskOnly: readonly RosterWorker[];

Workers that hear only in their tasks' sessions: reached by filing a task.


WorkerTaskClaim​

The claim the gate verified for the task a block entry runs: the ledger the row was read from, and its partition (a conversation's filingSessionId; absent on an unpartitioned list). Server-supplied, from the ticket the gate minted off the verified row, never from the dispatch or the task's input.

Properties​

collectionId​
readonly collectionId: string;
incarnationId?​
readonly incarnationId?: string;

The row's identity nonce as of the claim, when the row carries one.

partition?​
readonly partition?: string;

WorkerUsageView​

One worker's usage for a period, as the workerUsage view answers it.

Properties​

bySource​
bySource: object[];

Each source's spend, ordered by source, then billing.

billing​
billing: "api-key" | "subscription" | null;
costUsd​
costUsd: number | null;
inputTokens​
inputTokens: number;
kind​
kind: "model" | "harness";
outputTokens​
outputTokens: number;
runs​
runs: number;
source​
source: string;
unreported​
unreported: number;
costUsd​
costUsd: number | null;

Billed cost across every source, or null when no source reported one.

gone​
gone: boolean;

true when the worker is no longer on the reader's roster.

tokens​
tokens: object;

Tokens across every source.

input​
input: number;
output​
output: number;
worker​
worker: string;

The worker's id.


WorkforceCapabilityOptions​

Properties​

inventory​
inventory: InventoryKeys;

Which resource-registry keys the live inventory collections are mounted under, on the block that carries this capability.

A domain with no key registers no source, and the door carries one domain fewer — an ordinary state, not an error.

roster​
roster: DeclaredWorkforce;

What the tree declared, resolved at boot — readDeclaredRoster(...)'s result passes straight in.

Read here rather than on the discover path: readDeclaredRoster is a synchronous filesystem tree walk, and the door sits behind a tool a model may call on every step.

sources?​
sources?: readonly BlockManifestSource[];

Other domains' sources to put behind the same door — skillsManifestSource() from @flow-state-dev/orchestration, resourcesManifestSource() from @flow-state-dev/core.

Here rather than in a second capability because a model should have one place to ask. Two sources claiming one domain are refused at construction, naming both sites.


WorkforceManifestSourceOptions​

Properties​

inventory​
inventory: InventoryKeys;

Where the live rows are mounted. A domain with no key gets no source.

roster​
roster: DeclaredWorkforce;

What the tree declared, resolved at boot.


WorkstreamBlocksOptions​

What the workstream blocks are built from.

Properties​

installation​
installation: WorkerInstallation;

The worker installation the leads belong to: a lead is a worker on the caller's roster.

leadFit?​
leadFit?: object;

Check a worker's pick of lead against the work before its openWorkstreamTool opens it, with the one fit check on this model (asked again as a language model when the model serves no evaluations). Left out, the tool opens with any lead that can lead.

model​
model: string;
leadFlows​
leadFlows: readonly object[];

The worker flows a lead can run on. Each declares the internal onWorkstreamOpened entry (workstreamOpenedEntry()), as the built-in agent flow does. A worker on any other flow is refused as a lead.

Type Aliases​

BestFitWhy​

type BestFitWhy = z.infer<typeof bestFitWhySchema>;

CheckRepositoryView​

type CheckRepositoryView = ViewDefinition<BlockDefinition<typeof checkRepositoryInputSchema, typeof repositoryCheckAnswerSchema>, "user">;

The repository check as a view, as defineProjectBlocks builds it from the host's check.


ConsultSessionsOptions​

type ConsultSessionsOptions = object;

Options for consultSessionsCapability.

Properties​

budgetTokens?​
budgetTokens?: number;

The hard cap on the history tokens one consult reads. Default 24,000.

model?​
model?: GeneratorConfig["model"];

The model the answer runs on. Default intent/utility: the app's models.intents.utility.


CoordinatorConfig​

type CoordinatorConfig = z.infer<z.ZodObject<ReturnType<typeof coordinatorShape>>> & object;

The keys every coordinator configuration carries, whatever its base.

Type Declaration​

delegates​
delegates: string[] | "all";

Its default delegates, or "all": the whole roster, read per call.

instructions?​
instructions?: string;
model?​
model?: string;

CoordinatorRouteRecord​

type CoordinatorRouteRecord = z.infer<typeof coordinatorRouteRecordSchema>;

CoordinatorRouting​

type CoordinatorRouting = typeof COORDINATOR_ROUTING[number];

CreateProjectInput​

type CreateProjectInput = z.infer<typeof createProjectInputSchema>;

See​

createProjectInputSchema


CreateProjectOutput​

type CreateProjectOutput = z.infer<typeof createProjectOutputSchema>;

See​

createProjectOutputSchema


DelegateRecord​

type DelegateRecord = z.infer<typeof delegateRecordSchema>;

DelegateTakes​

type DelegateTakes = typeof DELEGATE_TAKES[number];

DeriveWorkerSessionIdInput​

type DeriveWorkerSessionIdInput = object;

The inputs a derived id is computed from.

Properties​

criteria​
criteria: WorkerSessionCriteria;

What the session is for.

flow​
flow: string;

The flow the session runs on: the worker's flow.

orgId​
orgId: string;

The organization it is created in.

userId​
userId: string;

The user the session belongs to.


EditWorkstreamInput​

type EditWorkstreamInput = z.infer<typeof editWorkstreamInputSchema>;

See​

editWorkstreamInputSchema


FinishedTask​

type FinishedTask = z.infer<typeof finishedTaskSchema>;

IntakeDecision​

type IntakeDecision =
| {
decision: "new";
reportId: string;
}
| {
commentOwed: boolean;
decision: "counted";
reportId: string;
}
| {
commentOwed: boolean;
decision: "storm";
isNew: boolean;
reportId: string;
}
| {
decision: "held";
taskId: string;
}
| {
decision: "ignored";
reason: string;
};

What the intake did with one occurrence.

Union Members​

Type Literal​
{
decision: "new";
reportId: string;
}

A new report, owed a run.


Type Literal​
{
commentOwed: boolean;
decision: "counted";
reportId: string;
}

Counted on an existing report; commentOwed when a filed issue is owed a comment.


Type Literal​
{
commentOwed: boolean;
decision: "storm";
isNew: boolean;
reportId: string;
}

Over the cap: listed on the window's storm report; new when that report was just made, commentOwed once it is filed.


Type Literal​
{
decision: "held";
taskId: string;
}

A failed request of a task, held for the task's ending.


Type Literal​
{
decision: "ignored";
reason: string;
}

The reporter's own failure: never reported.


InternalTopics​

type InternalTopics = Readonly<Record<string, InternalTopic>>;

The app's declared topics, by name (deploy.finished).


ListedRoutine​

type ListedRoutine = z.infer<typeof listedRoutineSchema>;

ListLeadsOutput​

type ListLeadsOutput = z.infer<typeof listLeadsOutputSchema>;

See​

listLeadsOutputSchema


ListProjectsOutput​

type ListProjectsOutput = z.infer<typeof listProjectsOutputSchema>;

See​

listProjectsOutputSchema


McpCredential​

type McpCredential = z.infer<typeof mcpCredentialSchema>;

See​

mcpCredentialSchema


MessageAddress​

type MessageAddress = z.infer<typeof messageAddressSchema>;

MessageHearing​

type MessageHearing = "task-sessions";

Where a worker hears messages. "task-sessions": only in its tasks' sessions, so a message to it by name is refused before anything is written (task_sessions_only). Absent: wherever a message lands.


MessageReceived​

type MessageReceived = z.infer<typeof messageReceivedSchema>;

messageReceivedSchema's type.


MessageTarget​

type MessageTarget =
| string
| {
task: string;
}
| {
session: string;
};

A message's target: a worker by its id, a task by its id, or one of the user's conversations by its session id.


Occurrence​

type Occurrence = z.infer<typeof occurrenceSchema>;

OpenWorkstreamInput​

type OpenWorkstreamInput = z.infer<typeof openWorkstreamInputSchema>;

See​

openWorkstreamInputSchema


OpenWorkstreamOutput​

type OpenWorkstreamOutput = z.infer<typeof openWorkstreamOutputSchema>;

See​

openWorkstreamOutputSchema


OperatorGitHub​

type OperatorGitHub = GitHubSubscriptionProvider & object;

What operatorGitHub builds: the routines' provider, and the review replies' poster.

Type Declaration​

reviewReplies​
readonly reviewReplies: ReviewReplies;

The poster a coding run's review replies go through: hand it to harnessManager({ replies }).


ParsedWorkstreamEntry​

type ParsedWorkstreamEntry = WorkstreamEntry & WorkstreamEntryPlace;

One entry as a reader parses it: the stored fields, with its place.


PreviewAnswer​

type PreviewAnswer = z.infer<typeof previewAnswerSchema>;

ProgressEntry​

type ProgressEntry = object;

One entry as progress reads it: its place, and the fields it counts.

Properties​

due​
due: string | null;
id​
id: string;
objectives​
objectives: readonly object[];
owner​
owner: string;
status​
status: string;
updatedAt​
updatedAt: string;

ProjectAddress​

type ProjectAddress = z.infer<typeof projectAddressSchema>;

See​

projectAddressSchema


ProjectBlocks​

type ProjectBlocks = object;

The project writes, the project read and the project files read, the same blocks as an actions map, the repository check and the project setup as a views map, and the connector keys route as a transport adapter.

Properties​

actions​
actions: object;
createProject​
createProject: ActionConfig;
listProjects​
listProjects: ActionConfig;
readProject​
readProject: ActionConfig;
readProjectFiles​
readProjectFiles: ActionConfig;
setBrief​
setBrief: ActionConfig;
setChecks​
setChecks: ActionConfig;
setMcpServers​
setMcpServers: ActionConfig;
setRepository​
setRepository: ActionConfig;
connectorKeys​
connectorKeys: InboundTransportAdapter;

The connector keys route, for createFlowState({ adapters }): each user's own key for a server in mcpServers, read, set and cleared at CONNECTOR_KEYS_PATH, the caller verified by the projects flow's sign-in. Serves no route when the host offers none.

createProject​
createProject: ReturnType<typeof defineWriteProject>;
listProjects​
listProjects: typeof listProjects;
readProject​
readProject: typeof readProject;
readProjectFiles​
readProjectFiles: typeof readProjectFiles;
setBrief​
setBrief: typeof setBrief;
setChecks​
setChecks: typeof setChecks;
setMcpServers​
setMcpServers: ReturnType<typeof defineSetMcpServers>;
setRepository​
setRepository: ReturnType<typeof defineSetRepository>;
views​
views: object;
checkRepository?​
checkRepository?: CheckRepositoryView;

Present only when the host gave checkRepository.

projectSetup​
projectSetup: ProjectSetupView;

Always: the host's project coordinator, null when it gave none.


ProjectChecksResolver​

type ProjectChecksResolver = (run) => Promise<string[]>;

A resolver answering one run's project's checks, handed the run's context as harness-manager hands it.

Parameters​

run​
ctx​

BlockContext

Returns​

Promise<string[]>


ProjectFile​

type ProjectFile = z.infer<typeof projectFileSchema>;

See​

projectFileSchema


ProjectMcpServers​

type ProjectMcpServers = Readonly<Record<string, ProjectMcpServerConfig>>;

The servers a host offers, by name.


ProjectProgress​

type ProjectProgress = object;

A project's progress.

Properties​

byStatus​
byStatus: Record<string, number>;

How many carry each status label, for the labels present.

nextDue​
nextDue: string | null;

The earliest due date of a workstream that isn't done, overdue ones included, or null.

objectives​
objectives: object;

Objectives met, of all the objectives of every workstream.

met​
met: number;
total​
total: number;
stale​
stale: object[];

The workstreams not done whose entry hasn't changed for STALE_AFTER_MS, oldest first.

id​
id: string;
owner​
owner: string;
updatedAt​
updatedAt: string;
workstreams​
workstreams: number;

How many workstreams the project has, done ones included.


ProjectRefusalReason​

type ProjectRefusalReason =
| "not-a-member"
| "no-such-project"
| "private-has-members"
| "invalid-workstream-id"
| "no-such-worker"
| "cannot-lead"
| "lead-doesnt-fit"
| "lead-differs"
| "no-such-workstream"
| "not-a-workstream-session"
| "project-id-held"
| "invalid-project-id"
| "invalid-repository"
| "repository-unusable"
| "too-many-workstreams"
| "other-project"
| "invalid-mcp-server"
| "unknown-mcp-server"
| "invalid-check";

Why a project or workstream write was refused. Each leaves the row and the entries as they were.

  • not-a-member: the session's owner is not in the row's members.
  • no-such-project: no row holds the id at that visibility. Another user's private project is not there to find, so it gets this too.
  • private-has-members: a private create named someone besides its owner.
  • invalid-workstream-id: a workstream id is empty or not one path segment.
  • no-such-worker: the lead is not a worker on the caller's roster. Another user's worker gets this too.
  • cannot-lead: the lead's flow can't lead a workstream.
  • lead-doesnt-fit: the fit check answered that none fits a worker's pick of lead: its own description says it does a different sort of work.
  • lead-differs: the workstream is open already, with another lead.
  • no-such-workstream: the caller has no such workstream in the project.
  • not-a-workstream-session: the lead's tool ran on a session that leads no workstream.
  • project-id-held: another owner's row holds the id.
  • invalid-project-id: the id is unassigned, empty, or not one path segment.
  • invalid-repository: the repository is a path, starts with -, or carries a credential. The refusal never repeats the value.
  • repository-unusable: the host's repository check (checkRepository) says no run could check it out on this machine: no such folder, not a git repository, a remote the host doesn't reach, or one that doesn't ignore the directory runs write to. The detail is the host's sentence, with the fix.
  • too-many-workstreams: the owner has as many open workstreams in the project as their project coordinator holds delegates.
  • other-project: an open from a conversation linked to one project named another.
  • invalid-mcp-server: an MCP server is not a bare name (lowercase letters, digits and hyphens). The refusal never repeats the value.
  • unknown-mcp-server: the server doesn't offer an MCP server of that name.

ProjectResourceState​

type ProjectResourceState = z.infer<typeof projectResourceStateSchema>;

One stored project.

See​

projectResourceStateSchema


ProjectSetup​

type ProjectSetup = z.infer<typeof projectSetupOutputSchema>;

See​

projectSetupOutputSchema


ProjectSetupView​

type ProjectSetupView = ViewDefinition<BlockDefinition<typeof projectSetupInputSchema, typeof projectSetupOutputSchema>, "user">;

The project setup as a view, as defineProjectBlocks builds it.


ProjectVisibility​

type ProjectVisibility = z.infer<typeof projectVisibilitySchema>;

See​

projectVisibilitySchema


ProjectWorkspaceRefusalReason​

type ProjectWorkspaceRefusalReason =
| "no-project"
| "no-such-workstream"
| "no-such-project"
| "not-the-owner"
| "not-a-member"
| "other-project";

Why a run's project lookup refused. The refusal's message names the workstream, the project or the users.


PublishOutcome​

type PublishOutcome =
| {
published: string;
}
| {
refused: string;
};

What a publish came to: the event's id, or why nothing was published. Never who heard.


ReadProjectFilesInput​

type ReadProjectFilesInput = z.infer<typeof readProjectFilesInputSchema>;

See​

readProjectFilesInputSchema


ReadProjectFilesOutput​

type ReadProjectFilesOutput = z.infer<typeof readProjectFilesOutputSchema>;

See​

readProjectFilesOutputSchema


ReadProjectInput​

type ReadProjectInput = z.infer<typeof readProjectInputSchema>;

See​

readProjectInputSchema


ReadProjectOutput​

type ReadProjectOutput = z.infer<typeof readProjectOutputSchema>;

See​

readProjectOutputSchema


ReportResourceState​

type ReportResourceState = z.infer<typeof reportResourceStateSchema>;

RepositoryCheck​

type RepositoryCheck = (repository) => Promise<RepositoryCheckAnswer>;

Asks the host whether a run on repository would get a checkout. See ProjectBlocksOptions.checkRepository.

Parameters​

repository​

string

Returns​

Promise<RepositoryCheckAnswer>


RepositoryCheckAnswer​

type RepositoryCheckAnswer = z.infer<typeof repositoryCheckAnswerSchema>;

See​

repositoryCheckAnswerSchema


ResourceModuleExport​

type ResourceModuleExport = DefinedCapability | DeclaredResourceEntry;

A module in the organisation's or a team's resources/ folder: a capability the worker flow installs, or a resource that merges into the one resource map.

A module exporting neither fails here, in the app's own typecheck, naming its file — which is where a check on an export's shape belongs, since nothing in the walk ever looks inside one.


ResourceModules​

type ResourceModules = Record<string, ResourceModuleExport>;

The generated resourceModules map: one entry per discovered module, keyed by the ref a document of that name in that folder would have.


RosterView​

type RosterView = ViewDefinition<BlockDefinition<z.ZodObject<Record<string, never>>, typeof rosterSchema>, "user">;

The roster view, as defineRosterView builds it. Import as a type in client code.


Routed​

type Routed = z.infer<typeof routedSchema>;

RoutedDelegate​

type RoutedDelegate = z.infer<typeof routedDelegateSchema>;

RoutineMaker​

type RoutineMaker = z.infer<typeof routineMakerSchema>;

ScheduledTaskInput​

type ScheduledTaskInput = z.infer<typeof scheduledTaskInputSchema>;

ScreenKind​

type ScreenKind = typeof SCREEN_KINDS[number];

ScreenVerdict​

type ScreenVerdict = z.infer<typeof screenVerdictSchema>;

SendOutcome​

type SendOutcome =
| {
id: string;
ok: true;
requestId?: string;
}
| {
error: string;
ok: false;
};

What a send came to.

Union Members​

Type Literal​
{
id: string;
ok: true;
requestId?: string;
}

requestId: the request the send's own dispatch became, when the host accepted it.


Type Literal​
{
error: string;
ok: false;
}

SessionBoard​

type SessionBoard = ReturnType<typeof defineSessionBoard>;

SetBriefInput​

type SetBriefInput = z.infer<typeof setBriefInputSchema>;

See​

setBriefInputSchema


SetChecksInput​

type SetChecksInput = z.infer<typeof setChecksInputSchema>;

See​

setChecksInputSchema


SetMcpServersInput​

type SetMcpServersInput = z.infer<typeof setMcpServersInputSchema>;

See​

setMcpServersInputSchema


SetRepositoryInput​

type SetRepositoryInput = z.infer<typeof setRepositoryInputSchema>;

See​

setRepositoryInputSchema


SetWorkProjectInput​

type SetWorkProjectInput = z.infer<typeof setWorkProjectInputSchema>;

SetWorkProjectOutput​

type SetWorkProjectOutput = z.infer<typeof setWorkProjectOutputSchema>;

SharedWriteContext​

type SharedWriteContext = object;

The slice of a block's context the helper reads. A block's own context satisfies it.

Properties​

resources​
resources: Readonly<Record<string, unknown>>;
session​
session: object;
identity​
identity: object;
identity.userId?​
userId?: string;

StandardWorkerResourceState​

type StandardWorkerResourceState = z.infer<typeof standardWorkerResourceStateSchema>;

One standard worker as the projection shows it.


StandingRule​

type StandingRule = z.infer<typeof standingRuleSchema>;

Standing rules: one list per worker, per user.


StandingRules​

type StandingRules = z.infer<typeof standingRulesStateSchema>;

Standing rules: one list per worker, per user.


StandingRulesActionInput​

type StandingRulesActionInput = z.infer<typeof standingRulesActionInputSchema>;

StandingRulesActionOutput​

type StandingRulesActionOutput = z.infer<typeof standingRulesActionOutputSchema>;

SteerTurnEntryOptions​

type SteerTurnEntryOptions = object & (
| {
block?: never;
turn: BlockDefinition<any, any>;
}
| {
block: BlockDefinition<any, any>;
turn?: never;
});

The steer turn's options: the worker's turn, or a block that takes the task itself. Exactly one.

Type Declaration​

name​
readonly name: string;

Names the entry's blocks.


SubscribeInput​

type SubscribeInput = z.infer<typeof subscribeInputSchema>;

SubscribeOutcome​

type SubscribeOutcome =
| {
id: string;
}
| {
refused: string;
};

What a subscribe came to.


SubscriptionEnd​

type SubscriptionEnd =
| "unsubscribed"
| "thread_closed"
| "task_errored"
| "task_cancelled"
| "paused"
| "config_removed";

Why a subscription ended.


SubscriptionPollResult​

type SubscriptionPollResult =
| {
unchanged: true;
}
| {
etags?: Readonly<Record<string, string>>;
events: readonly SubscriptionEvent[];
incomplete?: true;
through: number;
};

What a poll fetched: nothing new, or the events and how far it read.

Union Members​

Type Literal​
{
unchanged: true;
}

Type Literal​
{
etags?: Readonly<Record<string, string>>;
events: readonly SubscriptionEvent[];
incomplete?: true;
through: number;
}
etags?​
readonly etags?: Readonly<Record<string, string>>;
events​
readonly events: readonly SubscriptionEvent[];
incomplete?​
readonly incomplete?: true;

The provider read less than everything since the mark (a list busier than it reads in one poll): the fire says so in each session.

through​
readonly through: number;

The time it read up to, in ms: the next poll's mark when nothing is owed.


SubscriptionResourceState​

type SubscriptionResourceState = z.infer<typeof subscriptionResourceStateSchema>;

TargetCheck​

type TargetCheck =
| {
ok: true;
target: CheckedTarget;
}
| {
error: string;
ok: false;
};

What a check came to: the target, or a refusal for the model.


TaskInputRecord​

type TaskInputRecord = Record<string, unknown>;

A task's input as stored or sent: a plain object.


UpdateOwnWorkstreamInput​

type UpdateOwnWorkstreamInput = z.infer<typeof updateOwnWorkstreamInputSchema>;

See​

updateOwnWorkstreamInputSchema


UpdateWorkstreamInput​

type UpdateWorkstreamInput = z.infer<typeof updateWorkstreamInputSchema>;

See​

updateWorkstreamInputSchema


UpdateWorkstreamOutput​

type UpdateWorkstreamOutput = z.infer<typeof updateWorkstreamOutputSchema>;

See​

updateWorkstreamOutputSchema


WorkerCapabilitySelection​

type WorkerCapabilitySelection = Record<string, readonly string[]>;

What a worker file's capabilities: key parses to — capability name to the presets that worker wants.

capabilities:
research: [briefing]

An empty list is legal and means carry this capability's defaults, which is also what naming the capability nowhere means. It reads as a no-op because it is one; refusing it would make an author delete a line to say the thing the line already says.


WorkerConfig​

type WorkerConfig = z.infer<ReturnType<typeof workerConfigSchema>>;

What a hireable worker flow receives, as a type — the parsed shape of workerConfigSchema.

A worker flow that extends the contract gets its own inferred config; this is the part every worker flow shares, and what a helper written against any worker's settings should take.


WorkerDoor​

type WorkerDoor = object;

What the hire found for one worker.

Properties​

door​
door: string | null;

respond when the worker flow's door is in order, or null when it isn't.

problem?​
problem?: string;

Set when the door isn't in order: what to fix.

takesTask​
takesTask: boolean;

Whether the door takes an optional taskId and names it as the turn's task (see doorTask). false when the door isn't in order.


WorkerFlowEntry​

type WorkerFlowEntry =
| AnyFlowType
| {
flow: AnyFlowType;
retiredSettings?: readonly string[];
roles?: readonly WorkerRole[];
showSettings?: readonly string[];
standardOnly?: boolean;
}
| WorkerFlowBuilder;

One entry of HireOptions.workerFlows: a flow; a flow with whether this app keeps it for declared workers and the roles it declares; or a workerFlow(...) builder the installation builds on itself.

roles is what the flow does beside taking a user's message on respond: contributor (takes tasks on work), manager (runs its delegation board on dispatch), coordinator (routes messages; the built-in coordinator's). The hire checks each declared role's entries, and refuses a role's piece on a flow that doesn't declare it. Omitted, a flow has no role beyond every worker's; a built-in flow declares its own.

showSettings names the flow's settings a user may see: each worker's value for them rides on its roster() row. Every other setting stays on the server. Omitted, none shows.

retiredSettings names settings the flow no longer takes: a stored worker that set one reads without it, and a hire or an edit naming one is refused.

Whether the flow's tasks need a project, and what else they take, is the flow's own: its work entry's inputSchema (taskInputSchema(schema, { project })).


WorkerInstructions​

type WorkerInstructions = object;

A worker's instructions, as a turn and the instructions view read them.

Properties​

additionalInstructions​
additionalInstructions: string | null;

What the user added after them, or null.

fixed​
fixed: boolean;

Whether the core instructions are a standard worker's, which an edit can't replace.

instructions​
instructions: string | null;

Its core instructions, or null when it has none.


WorkerInstructionsView​

type WorkerInstructionsView = ViewDefinition<BlockDefinition<typeof inputSchema, typeof outputSchema>, "user">;

The worker instructions view, as defineWorkerInstructionsView builds it. Import as a type in client code.


WorkerInventoryResourceState​

type WorkerInventoryResourceState = z.infer<typeof workerInventoryResourceStateSchema>;

One worker in the worker inventory.

See​

workerInventoryResourceStateSchema


WorkerLookupAnswer​

type WorkerLookupAnswer =
| {
flowId: string;
found: true;
}
| {
found: false;
message: string;
reason: "not-found";
}
| {
flowId: string;
found: false;
message: string;
reason: "takes-no-tasks";
};

What the lookup answers for one name.

Union Members​

Type Literal​
{
flowId: string;
found: true;
}

Type Literal​
{
found: false;
message: string;
reason: "not-found";
}
found​
found: false;
message​
message: string;

One sentence naming the worker, for the refusal a door or a hand-over shows.

reason​
reason: "not-found";

Type Literal​
{
flowId: string;
found: false;
message: string;
reason: "takes-no-tasks";
}
flowId​
flowId: string;

The flow the worker runs on, for a caller that wants it for something other than a task.

found​
found: false;
message​
message: string;
reason​
reason: "takes-no-tasks";

The name means a worker, but its flow declares no task entry.


WorkerMessageResourceState​

type WorkerMessageResourceState = z.infer<typeof workerMessageResourceStateSchema>;

WorkerResourceModuleExport​

type WorkerResourceModuleExport = DeclaredResourceEntry;

A module in a single worker's OWN resources/ folder: a resource, and never a capability.

Every worker on a flow shares that flow's capabilities, so a capability installed from one worker's folder would quietly change every other worker on that flow. Giving one worker behaviour nobody else has needs a per-worker install, which the convention rules out on purpose — so the honest answer is to refuse the file rather than to install it flow-wide or skip it in silence.

Named rather than inlined so the generated map says at its own call site which entries are held to it. The name is not what the compiler prints — TS resolves an alias of a union down to the union's own name — so the sentence an author needs is emitted as a comment above the map instead, on the line their editor puts the error next to.


WorkerResourceState​

type WorkerResourceState = z.infer<typeof workerResourceStateSchema>;

One stored worker.

See​

workerResourceStateSchema


WorkerRole​

type WorkerRole = typeof WORKER_ROLES[number];

One of WORKER_ROLES.


WorkerSessionCriteria​

type WorkerSessionCriteria = object;

What a worker session is looked up and created by: worker, plus a key for each later reader (a task, a workstream, a coordinator's conversation), each a readonly session-state field: filingSessionId, workstreamId and projectId, and taskId.

Properties​

filingSessionId?​
filingSessionId?: string;

The conversation the session was opened for: a coordinator conversation's filingSessionId, as its listDelegates returns it. Named, the lookup returns that conversation's delegate session; omitted, it never returns a session that carries one. The conversation opens that session; ensureWorkerSession never creates one.

projectId?​
projectId?: ProjectAddressRef;

The project the session is linked to: its address. Named, the lookup returns the user's coordinator for that project; omitted, it never returns one. Only a session of the coordinator the installation names as every project's coordinator carries it, one per user per project, and a create naming a project its user can't read is refused.

taskId?​
taskId?: string;

The task the session was opened for, on the board of the conversation filingSessionId names: a task session, which a conversation's board opens when it hands the task over. Named, the lookup returns that task's session within that conversation; omitted, it never returns a task session. ensureWorkerSession never creates one.

worker​
worker: string;

The worker the session runs: a worker id on the user's roster, or a standard one.

workstreamId?​
workstreamId?: WorkstreamAddress;

The workstream the session leads: its project's address and its id, the owner being the user asking. Named, the lookup returns the lead's workstream session; omitted, it never returns one. A workstream's open creates that session; a create naming a workstream the user has no entry for, or one its entry doesn't name this worker to lead, is refused.


WorkerSessionStateShape​

type WorkerSessionStateShape = typeof workerSessionStateSchema.shape;

The session-state fields every worker flow declares: readonly birth fields, and the server-owned routed-from.


WorkerSourceSpend​

type WorkerSourceSpend = z.infer<typeof sourceSpendSchema>;

One source's spend, as a record and a query row carry it.


WorkerTaskBlockInput​

type WorkerTaskBlockInput = TaskWorkerInput & object;

What a block entry's block is handed: the task as the board packed it, and the claim it runs under.

Type Declaration​

claim​
readonly claim: WorkerTaskClaim;

WorkerTaskEntryOptions​

type WorkerTaskEntryOptions = object & (
| {
block?: never;
turn: BlockDefinition<any, any>;
}
| {
block: BlockDefinition<any, any>;
turn?: never;
});

What a flow's work entry is built from: a turn or a block, exactly one.

Type Declaration​

inputSchema?​
readonly inputSchema?: TaskInputSchema<any>;

What the flow's tasks take (taskInputSchema(schema, { ... })): every write that files a task for one of its workers is checked against it, the claim parses the stored row again, and the worker block is handed the parsed input. Omitted, its tasks take any object, unchecked.

name​
readonly name: string;

Names the entry's blocks.


WorkerTurnContext​

type WorkerTurnContext = object;

The slice of a block's context a turn's worker is loaded from: the session's state, and the resources the block declares. Any block's context satisfies it.

Properties​

resources​
readonly resources: unknown;
session​
readonly session: object;
state​
readonly state: unknown;

WorkerUsageState​

type WorkerUsageState = z.infer<typeof workerUsageStateSchema>;

WorkerUsageViewDefinition​

type WorkerUsageViewDefinition = ViewDefinition<BlockDefinition<typeof workerUsageInputSchema, typeof workerUsageOutputSchema>, "user">;

The worker usage view, as defineWorkerUsageView builds it. Import as a type in client code.


WorkstreamAddress​

type WorkstreamAddress = object;

A workstream's address: its project's address and its id. Its owner is whoever asks.

Properties​

id​
id: string;

The workstream's id: one path segment, unique per project and owner.

project​
project: object;

The project's address: where it lives, and its id.

id​
id: string;
visibility​
visibility: "shared" | "private";

WorkstreamBlocks​

type WorkstreamBlocks = object;

The workstream writes, and the same blocks as an actions map and a tool.

Properties​

actions​
actions: object;
openWorkstream​
openWorkstream: ActionConfig;
updateWorkstream​
updateWorkstream: ActionConfig;
editWorkstreamTool​
editWorkstreamTool: BlockDefinition<typeof editWorkstreamInputSchema, typeof updateWorkstreamOutputSchema, EditWorkstreamInput, UpdateWorkstreamOutput>;

The owner's tool: changes one of the caller's workstreams by id (its title, status, due date or objectives), in the project the conversation is linked to. Give it to a project coordinator.

listLeadsTool​
listLeadsTool: BlockDefinition<z.ZodObject<{
}, "strict">, typeof listLeadsOutputSchema, Record<string, never>, ListLeadsOutput>;

The workers on the caller's roster that can lead a workstream, read now: their own workers (one a hire made counts) and the standard ones, each on a lead flow and listing delegates. Give it to whoever picks a lead.

openWorkstream​
openWorkstream: BlockDefinition<typeof openWorkstreamInputSchema, typeof openWorkstreamOutputSchema, OpenWorkstreamInput, OpenWorkstreamOutput>;
openWorkstreamTool​
openWorkstreamTool: BlockDefinition<typeof openWorkstreamInputSchema, z.ZodTypeAny, OpenWorkstreamInput, OpenWorkstreamOutput>;

openWorkstream for a worker to call: with leadFit set, it first asks the one fit check about the lead, and refuses lead-doesnt-fit only when it answers that none fits. Work that doesn't say what sort it is is never refused. Without leadFit, it is openWorkstream.

updateWorkstream​
updateWorkstream: BlockDefinition<typeof updateWorkstreamInputSchema, typeof updateWorkstreamOutputSchema, UpdateWorkstreamInput, UpdateWorkstreamOutput>;
updateWorkstreamTool​
updateWorkstreamTool: BlockDefinition<typeof updateOwnWorkstreamInputSchema, typeof updateWorkstreamOutputSchema, UpdateOwnWorkstreamInput, UpdateWorkstreamOutput>;

The lead's tool: updates the workstream its session leads. Give it to a lead's flow.


WorkstreamDelegateChange​

type WorkstreamDelegateChange = z.infer<typeof workstreamDelegateChangeSchema>;

See​

workstreamDelegateChangeSchema


WorkstreamEntry​

type WorkstreamEntry = z.infer<typeof workstreamEntrySchema>;

See​

workstreamEntrySchema


WorkstreamEntryPlace​

type WorkstreamEntryPlace = object;

An entry's place, read off its storage path: its project, its owner and its id.

Properties​

id​
id: string;
owner​
owner: string;
project​
project: string;

WorkstreamObjective​

type WorkstreamObjective = z.infer<typeof workstreamObjectiveSchema>;

See​

workstreamObjectiveSchema


WorkstreamStatus​

type WorkstreamStatus = z.infer<typeof workstreamStatusSchema>;

See​

workstreamStatusSchema


WorkstreamView​

type WorkstreamView = z.infer<typeof workstreamViewSchema>;

See​

workstreamViewSchema


WrittenBy​

type WrittenBy = z.infer<typeof writtenBySchema>;

Who wrote one entry of a shared resource.

Variables​

ADD_DELEGATE​

const ADD_DELEGATE: "addDelegate" = "addDelegate";

The four delegate actions. Pinned: an app sends them by name.


AGENT_FLOW​

const AGENT_FLOW: "agent" = "agent";

The worker flow name the hire step resolves a record to when it names none, and the key an app registers its own flow under to replace this one.


ALL_DELEGATES​

const ALL_DELEGATES: "all" = "all";

A worker file's delegates: all: the whole roster, read on every call, rather than a written list.


CONNECTOR_KEYS_PATH​

const CONNECTOR_KEYS_PATH: "/api/flows/mcp-credentials";

Where the connector keys route (defineProjectBlocks().connectorKeys) is served: GET reads which keys the caller has set, POST and DELETE <path>/<server> set and clear one. The path keeps the keys' wire name, as their stored prefix does.


CONSULT_SESSION_HISTORY_TOOL​

const CONSULT_SESSION_HISTORY_TOOL: "consultSessionHistory" = "consultSessionHistory";

The tool's name, as the model calls it.


CONSULT_SESSIONS_CAPABILITY​

const CONSULT_SESSIONS_CAPABILITY: "consultSessions" = "consultSessions";

The capability's name, as a worker file names it.


consultSessionHistoryInputSchema​

const consultSessionHistoryInputSchema: z.ZodObject<{
of: z.ZodUnion<[z.ZodString, z.ZodObject<{
task: z.ZodString;
}, "strict", z.ZodTypeAny, {
task: string;
}, {
task: string;
}>, z.ZodObject<{
session: z.ZodString;
}, "strict", z.ZodTypeAny, {
session: string;
}, {
session: string;
}>]>;
question: z.ZodString;
}, "strict", z.ZodTypeAny, {
of: | string
| {
task: string;
}
| {
session: string;
};
question: string;
}, {
of: | string
| {
task: string;
}
| {
session: string;
};
question: string;
}>;

What the model passes. Strict: nothing else is taken.


COORDINATOR_FLOW​

const COORDINATOR_FLOW: "coordinator" = "coordinator";

The coordinator flow's name. Pinned: a worker's flow: names it.


COORDINATOR_JUDGMENT​

const COORDINATOR_JUDGMENT: "coordinator-judgment" = "coordinator-judgment";

The judgment turn's generator block, which a scripted model resolves by name.


COORDINATOR_ROUTE​

const COORDINATOR_ROUTE: "coordinator-route" = "coordinator-route";

The data type every routing decision is recorded under, and the name of best fit's fit check (../fit-check.ts). Pinned: a client tells a record from a line by it, and a scripted model resolves the check's evaluator by it, and its language-model ask by coordinator-route-ask.


COORDINATOR_ROUTING​

const COORDINATOR_ROUTING: readonly ["judgment", "best-fit", "round-robin", "everyone"];

The routing policies a coordinator can name.


coordinatorRouteRecordSchema​

const coordinatorRouteRecordSchema: z.ZodObject<{
answeredItself: z.ZodOptional<z.ZodLiteral<true>>;
by: z.ZodEnum<["judgment", "held", "evaluated", "fallback", "round-robin", "everyone", "unplaced"]>;
delegates: z.ZodArray<z.ZodObject<object & object, "strip", z.ZodTypeAny, {
outcome: "delivered" | "failed" | "skipped";
reason?: string;
target?: string;
worker: string;
}, {
outcome: "delivered" | "failed" | "skipped";
reason?: string;
target?: string;
worker: string;
}>, "many">;
evaluationFailed: z.ZodOptional<z.ZodString>;
fit: z.ZodOptional<z.ZodObject<{
choice: z.ZodOptional<z.ZodString>;
confidence: z.ZodOptional<z.ZodNumber>;
minConfidence: z.ZodOptional<z.ZodNumber>;
reason: z.ZodEnum<["coordinator", "below-floor", "no-confidence", "failed", "not-a-choice", "no-delegates"]>;
}, "strip", z.ZodTypeAny, {
choice?: string;
confidence?: number;
minConfidence?: number;
reason: | "below-floor"
| "coordinator"
| "failed"
| "no-confidence"
| "no-delegates"
| "not-a-choice";
}, {
choice?: string;
confidence?: number;
minConfidence?: number;
reason: | "below-floor"
| "coordinator"
| "failed"
| "no-confidence"
| "no-delegates"
| "not-a-choice";
}>>;
messageRequestId: z.ZodString;
none: z.ZodOptional<z.ZodString>;
note: z.ZodOptional<z.ZodString>;
policy: z.ZodString;
round: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
answeredItself?: true;
by: | "evaluated"
| "everyone"
| "fallback"
| "held"
| "judgment"
| "round-robin"
| "unplaced";
delegates: object[];
evaluationFailed?: string;
fit?: {
choice?: string;
confidence?: number;
minConfidence?: number;
reason: | "below-floor"
| "coordinator"
| "failed"
| "no-confidence"
| "no-delegates"
| "not-a-choice";
};
messageRequestId: string;
none?: string;
note?: string;
policy: string;
round: number;
}, {
answeredItself?: true;
by: | "evaluated"
| "everyone"
| "fallback"
| "held"
| "judgment"
| "round-robin"
| "unplaced";
delegates: object[];
evaluationFailed?: string;
fit?: {
choice?: string;
confidence?: number;
minConfidence?: number;
reason: | "below-floor"
| "coordinator"
| "failed"
| "no-confidence"
| "no-delegates"
| "not-a-choice";
};
messageRequestId: string;
none?: string;
note?: string;
policy: string;
round: number;
}>;

One routing decision's record.


createProjectInputSchema​

const createProjectInputSchema: z.ZodObject<{
brief: z.ZodOptional<z.ZodString>;
checks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
id: z.ZodString;
mcpServers: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
members: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
repository: z.ZodOptional<z.ZodNullable<z.ZodString>>;
title: z.ZodString;
visibility: z.ZodOptional<z.ZodEnum<["shared", "private"]>>;
}, "strict", z.ZodTypeAny, {
brief?: string;
checks?: string[];
id: string;
mcpServers?: unknown[];
members?: string[];
repository?: string | null;
title: string;
visibility?: "private" | "shared";
}, {
brief?: string;
checks?: string[];
id: string;
mcpServers?: unknown[];
members?: string[];
repository?: string | null;
title: string;
visibility?: "private" | "shared";
}>;

What creating a project takes. Closed: nothing in it names the owner.


createProjectOutputSchema​

const createProjectOutputSchema: z.ZodObject<{
created: z.ZodBoolean;
project: z.ZodObject<{
brief: z.ZodDefault<z.ZodNullable<z.ZodString>>;
checks: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
id: z.ZodString;
mcpServers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
members: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
ownerUserId: z.ZodString;
repository: z.ZodDefault<z.ZodNullable<z.ZodString>>;
status: z.ZodDefault<z.ZodString>;
title: z.ZodString;
}, "strip", z.ZodTypeAny, {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
}, {
brief?: string | null;
checks?: string[];
id: string;
mcpServers?: string[];
members?: string[];
ownerUserId: string;
repository?: string | null;
status?: string;
title: string;
}>;
visibility: z.ZodEnum<["shared", "private"]>;
}, "strip", z.ZodTypeAny, {
created: boolean;
project: {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
};
visibility: "private" | "shared";
}, {
created: boolean;
project: {
brief?: string | null;
checks?: string[];
id: string;
mcpServers?: string[];
members?: string[];
ownerUserId: string;
repository?: string | null;
status?: string;
title: string;
};
visibility: "private" | "shared";
}>;

What creating a project returns: the row, where it lives, and whether this call wrote it.


DEFAULT_LIMITS​

const DEFAULT_LIMITS: ReportLimits;

DEFAULT_MESSAGE_BUDGET​

const DEFAULT_MESSAGE_BUDGET: 6 = 6;

A chain of worker messages with no user in between stops after this many, when the app sets none.


DEFAULT_MESSAGES_PER_TURN​

const DEFAULT_MESSAGES_PER_TURN: 3 = 3;

One turn sends at most this many messages, when the app sets none.


DEFAULT_SUBSCRIPTION_CAP_PER_HOUR​

const DEFAULT_SUBSCRIPTION_CAP_PER_HOUR: 30 = 30;

The default cap: the most messages one subscription sends in an hour.


delegateRecordSchema​

const delegateRecordSchema: z.ZodObject<object & object, "strip", z.ZodTypeAny, {
note?: string;
target?: string;
worker: string;
}, {
note?: string;
target?: string;
worker: string;
}>;

One delegate record.


DERIVED_WORKER_SESSION_PREFIX​

const DERIVED_WORKER_SESSION_PREFIX: "wks_" = "wks_";

The prefix every derived worker-session id starts with.


DONE_STATUS​

const DONE_STATUS: "done" = "done";

The one status label with a meaning: a done workstream stays listed, is never stale and is never the next due date. Every other label is the owner's own word, counted as written.


editWorkstreamInputSchema​

const editWorkstreamInputSchema: z.ZodObject<{
due: z.ZodOptional<z.ZodNullable<z.ZodString>>;
id: z.ZodString;
objectives: z.ZodOptional<z.ZodArray<z.ZodObject<{
met: z.ZodBoolean;
text: z.ZodString;
}, "strict", z.ZodTypeAny, {
met: boolean;
text: string;
}, {
met: boolean;
text: string;
}>, "many">>;
project: z.ZodOptional<z.ZodObject<{
id: z.ZodString;
visibility: z.ZodEnum<["shared", "private"]>;
}, "strict", z.ZodTypeAny, {
id: string;
visibility: "private" | "shared";
}, {
id: string;
visibility: "private" | "shared";
}>>;
status: z.ZodOptional<z.ZodString>;
title: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
due?: string | null;
id: string;
objectives?: object[];
project?: {
id: string;
visibility: "private" | "shared";
};
status?: string;
title?: string;
}, {
due?: string | null;
id: string;
objectives?: object[];
project?: {
id: string;
visibility: "private" | "shared";
};
status?: string;
title?: string;
}>;

What the coordinator's editWorkstream tool takes: one of the caller's own workstreams, by id, and the changes. The latest report stays the lead's. Left out, project is the one the conversation is linked to, the only one such a conversation may change.


ERROR_HISTORY_RESOURCE​

const ERROR_HISTORY_RESOURCE: "errorHistory" = "errorHistory";

The accessor a flow declares the history view under.


ERROR_REPORTER_FLOW​

const ERROR_REPORTER_FLOW: "error-reporter" = "error-reporter";

The flow the reporter runs on: its conversation and its report sessions.


ERROR_REPORTER_INTAKE_FLOW​

const ERROR_REPORTER_INTAKE_FLOW: "error-reporter-intake" = "error-reporter-intake";

The flow of the reporter's intake. A board dispatches an errored task's occurrence to it.


ERROR_REPORTS_RESOURCE​

const ERROR_REPORTS_RESOURCE: "errorReports" = "errorReports";

The accessor a flow declares the report rows under.


errorReportsCollection​

const errorReportsCollection: object & ResourceCollectionConfig & object;

The collection's declaration. Org scope: one Lab's reports, shared by its users. Never read by a browser.

Type Declaration​

client​
readonly client: object;
client.content​
readonly content: object;
client.content.create​
readonly create: false;
client.content.delete​
readonly delete: false;
client.content.read​
readonly read: false;
client.content.update​
readonly update: false;
client.state​
readonly state: object;
client.state.read​
readonly read: false;
pattern​
readonly pattern: "error-reports/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "org";
stateSchema​
readonly stateSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: JsonObject;
StateType​
StateType: JsonObject;

FILING_FLOW_STATE_KEY​

const FILING_FLOW_STATE_KEY: "filingFlow" = "filingFlow";

The session-state field that names the flow a task session's filer runs on: set when a session's board hands a task over, beside TASK_ID_STATE_KEY, so the task's notice reaches the filing session on its own flow, whichever flow that is. Readonly, and set only by the hand-over: the installation's create check refuses a create on any other path that names it.


FILING_PROJECT_STATE_KEY​

const FILING_PROJECT_STATE_KEY: "filingProjectId" = "filingProjectId";

The session-state field that names the project a task session was filed from: its filer's PROJECT_STATE_KEY (a project conversation), or its filer's own filing project, carried down at each hand-over (projectRef form, <visibility>/<projectId>). Set only by the hand-over, like FILING_WORKSTREAM_STATE_KEY, so a coding run in the task session works in the project its conversation belongs to. Readonly.


FILING_SESSION_STATE_KEY​

const FILING_SESSION_STATE_KEY: "filingSessionId" = "filingSessionId";

The session-state field that names the conversation a worker session was opened for: a coordinator's delivery sets it on the delegate's session, from the coordinator conversation's id and incarnation. Readonly, like WORKER_ID_STATE_KEY, so a lookup can filter by it. Pinned: the criteria key findWorkerSession and ensureWorkerSession take.


FILING_WORKER_STATE_KEY​

const FILING_WORKER_STATE_KEY: "filingWorkerId" = "filingWorkerId";

Session-state field naming the worker that filed the work a task's or a delegate's session runs: the filing session's worker, set by the hand-over beside FILING_SESSION_STATE_KEY, so a message from here to that worker lands in the session that filed it. Readonly, and set only by the hand-over.


FILING_WORKSTREAM_STATE_KEY​

const FILING_WORKSTREAM_STATE_KEY: "filingWorkstreamId" = "filingWorkstreamId";

The session-state field that names the workstream a task session works for: the one its filer leads, or its filer's own, carried down at each hand-over from the session that filed the task (workstreamRef form). Set only by the hand-over, like TASK_ID_STATE_KEY, so a coding run in a task session finds its project through the workstream it was filed from. Readonly.


finishedTaskSchema​

const finishedTaskSchema: z.ZodObject<{
ending: z.ZodEnum<["completed", "errored", "cancelled"]>;
line: z.ZodString;
taskId: z.ZodString;
worker: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
ending: "cancelled" | "completed" | "errored";
line: string;
taskId: string;
worker?: string;
}, {
ending: "cancelled" | "completed" | "errored";
line: string;
taskId: string;
worker?: string;
}>;

One task that finished while the turn ran, as takeFinishedTasks hands it back.


GITHUB_REVIEWERS_DOC​

const GITHUB_REVIEWERS_DOC: "github-reviewers" = "github-reviewers";

The document's ref and accessor: the org's one list. Pinned: a saved list reads under it.


globProjectSourceOutputSchema​

const globProjectSourceOutputSchema: z.ZodUnion<[z.ZodObject<{
kind: z.ZodLiteral<"refused">;
message: z.ZodString;
reason: z.ZodString;
}, "strip", z.ZodTypeAny, {
kind: "refused";
message: string;
reason: string;
}, {
kind: "refused";
message: string;
reason: string;
}>, z.ZodObject<{
at: z.ZodUnion<[z.ZodObject<{
ageMs: z.ZodNullable<z.ZodNumber>;
branch: z.ZodString;
commit: z.ZodString;
fetchedAt: z.ZodNullable<z.ZodString>;
kind: z.ZodLiteral<"repo">;
}, "strip", z.ZodTypeAny, {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}, {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}>, z.ZodObject<{
kind: z.ZodLiteral<"files">;
}, "strip", z.ZodTypeAny, {
kind: "files";
}, {
kind: "files";
}>]>;
cut: z.ZodNullable<z.ZodObject<{
by: z.ZodEnum<["paths", "lines", "bytes", "matches", "limit"]>;
left: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
by: "bytes" | "limit" | "lines" | "matches" | "paths";
left: number;
}, {
by: "bytes" | "limit" | "lines" | "matches" | "paths";
left: number;
}>>;
kind: z.ZodLiteral<"glob">;
paths: z.ZodArray<z.ZodString, "many">;
}, "strip", z.ZodTypeAny, {
at: | {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}
| {
kind: "files";
};
cut: | {
by: "bytes" | "limit" | "lines" | "matches" | "paths";
left: number;
}
| null;
kind: "glob";
paths: string[];
}, {
at: | {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}
| {
kind: "files";
};
cut: | {
by: "bytes" | "limit" | "lines" | "matches" | "paths";
left: number;
}
| null;
kind: "glob";
paths: string[];
}>]>;

What globProjectSource answers.


grepProjectSourceOutputSchema​

const grepProjectSourceOutputSchema: z.ZodUnion<[z.ZodObject<{
kind: z.ZodLiteral<"refused">;
message: z.ZodString;
reason: z.ZodString;
}, "strip", z.ZodTypeAny, {
kind: "refused";
message: string;
reason: string;
}, {
kind: "refused";
message: string;
reason: string;
}>, z.ZodObject<{
at: z.ZodUnion<[z.ZodObject<{
ageMs: z.ZodNullable<z.ZodNumber>;
branch: z.ZodString;
commit: z.ZodString;
fetchedAt: z.ZodNullable<z.ZodString>;
kind: z.ZodLiteral<"repo">;
}, "strip", z.ZodTypeAny, {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}, {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}>, z.ZodObject<{
kind: z.ZodLiteral<"files">;
}, "strip", z.ZodTypeAny, {
kind: "files";
}, {
kind: "files";
}>]>;
binary: z.ZodLiteral<"skipped">;
cut: z.ZodNullable<z.ZodObject<{
by: z.ZodEnum<["paths", "lines", "bytes", "matches", "limit"]>;
left: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
by: "bytes" | "limit" | "lines" | "matches" | "paths";
left: number;
}, {
by: "bytes" | "limit" | "lines" | "matches" | "paths";
left: number;
}>>;
dialect: z.ZodEnum<["extended-regex", "javascript-regex", "literal"]>;
kind: z.ZodLiteral<"grep">;
matches: z.ZodArray<z.ZodObject<{
line: z.ZodNumber;
path: z.ZodString;
snippet: z.ZodString;
}, "strip", z.ZodTypeAny, {
line: number;
path: string;
snippet: string;
}, {
line: number;
path: string;
snippet: string;
}>, "many">;
}, "strip", z.ZodTypeAny, {
at: | {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}
| {
kind: "files";
};
binary: "skipped";
cut: | {
by: "bytes" | "limit" | "lines" | "matches" | "paths";
left: number;
}
| null;
dialect: "extended-regex" | "javascript-regex" | "literal";
kind: "grep";
matches: object[];
}, {
at: | {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}
| {
kind: "files";
};
binary: "skipped";
cut: | {
by: "bytes" | "limit" | "lines" | "matches" | "paths";
left: number;
}
| null;
dialect: "extended-regex" | "javascript-regex" | "literal";
kind: "grep";
matches: object[];
}>]>;

What grepProjectSource answers.


INTAKE_SESSION_ID​

const INTAKE_SESSION_ID: "error-report-intake" = "error-report-intake";

The intake's session: the reporter's own, and the key of each board's child session.


INVENTORY_REGISTER_WORKERS​

const INVENTORY_REGISTER_WORKERS: "registerWorkersInInventory" = "registerWorkersInInventory";

The action the boot binder dispatches ONCE, carrying the roster's workers.

Pinned: openInventory names this string. One run for the whole roster rather than one per worker: a worker holds no session, so there is no per-worker place this has to land, and the rows are a straight copy of what the binder already holds.

Lives in internal.actions, never the public map — its whole input is the row data, with nothing to check it against. Reachable only by the binder's own direct, trusted runAction({ source: "internal", ... }) call.


INVENTORY_WORKER_WRITER_SESSION​

const INVENTORY_WORKER_WRITER_SESSION: "inventory-binder" = "inventory-binder";

The session the worker write runs in when the caller names none.

An ordinary session on the writer's flow, created on the first boot and reused after.


inventoryWorkersRegisteredSchema​

const inventoryWorkersRegisteredSchema: z.ZodObject<{
written: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
written: number;
}, {
written: number;
}>;

What the worker write reports: how many rows landed.


LIST_DELEGATES​

const LIST_DELEGATES: "listDelegates" = "listDelegates";

A worker's delegates: the workers it hands work to, which any worker's file may list as delegates:.

  • The pinned names: the four delegate actions an app sends (addDelegate, removeDelegate, setFallback, listDelegates) and the most delegates one session holds.
  • delegateRecordSchema: one delegate record, as listDelegates answers it.
  • DelegateTakes: what listDelegates says each delegate takes.
  • TaskDelegates: a session's delegates as a task sees them.

A flow carries them, with the task board they file onto, through defineSessionBoard.


LIST_ROUTINES_ACTION​

const LIST_ROUTINES_ACTION: "listRoutines" = "listRoutines";

The verb a screen lists the user's routines through, on the roster flow.


listedForCodingSchema​

const listedForCodingSchema: z.ZodObject<object & object, "strip", z.ZodTypeAny, {
forCoding: string;
projects: object[];
}, {
forCoding: string;
projects: object[];
}>;

The user's projects, with what a coder's task that names no project does next.


listedProjectSchema​

const listedProjectSchema: z.ZodObject<{
brief: z.ZodOptional<z.ZodNullable<z.ZodString>>;
id: z.ZodString;
repository: z.ZodNullable<z.ZodString>;
title: z.ZodString;
visibility: z.ZodEnum<["shared", "private"]>;
}, "strip", z.ZodTypeAny, {
brief?: string | null;
id: string;
repository: string | null;
title: string;
visibility: "private" | "shared";
}, {
brief?: string | null;
id: string;
repository: string | null;
title: string;
visibility: "private" | "shared";
}>;

One project the caller is a member of, as listProjects lists it.


listedRoutineSchema​

const listedRoutineSchema: z.ZodObject<{
description: z.ZodOptional<z.ZodString>;
id: z.ZodString;
madeBy: z.ZodOptional<z.ZodDiscriminatedUnion<"by", [z.ZodObject<{
by: z.ZodLiteral<"user">;
}, "strict", z.ZodTypeAny, {
by: "user";
}, {
by: "user";
}>, z.ZodObject<{
by: z.ZodLiteral<"worker">;
worker: z.ZodString;
}, "strict", z.ZodTypeAny, {
by: "worker";
worker: string;
}, {
by: "worker";
worker: string;
}>, z.ZodObject<{
by: z.ZodLiteral<"app">;
entry: z.ZodString;
}, "strict", z.ZodTypeAny, {
by: "app";
entry: string;
}, {
by: "app";
entry: string;
}>]>>;
name: z.ZodString;
paused: z.ZodBoolean;
task: z.ZodOptional<z.ZodUnknown>;
trigger: z.ZodUnion<[z.ZodObject<{
clock: z.ZodObject<{
cron: z.ZodString;
nextRunAt: z.ZodNullable<z.ZodString>;
timezone: z.ZodString;
}, "strip", z.ZodTypeAny, {
cron: string;
nextRunAt: string | null;
timezone: string;
}, {
cron: string;
nextRunAt: string | null;
timezone: string;
}>;
}, "strip", z.ZodTypeAny, {
clock: {
cron: string;
nextRunAt: string | null;
timezone: string;
};
}, {
clock: {
cron: string;
nextRunAt: string | null;
timezone: string;
};
}>, z.ZodObject<{
event: z.ZodObject<{
interest: z.ZodString;
kinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
provider: z.ZodString;
screens: z.ZodArray<z.ZodUnknown, "many">;
thread: z.ZodString;
}, "strip", z.ZodTypeAny, {
interest: string;
kinds?: string[];
provider: string;
screens: unknown[];
thread: string;
}, {
interest: string;
kinds?: string[];
provider: string;
screens: unknown[];
thread: string;
}>;
}, "strip", z.ZodTypeAny, {
event: {
interest: string;
kinds?: string[];
provider: string;
screens: unknown[];
thread: string;
};
}, {
event: {
interest: string;
kinds?: string[];
provider: string;
screens: unknown[];
thread: string;
};
}>]>;
worker: z.ZodString;
}, "strip", z.ZodTypeAny, {
description?: string;
id: string;
madeBy?: | {
by: "user";
}
| {
by: "worker";
worker: string;
}
| {
by: "app";
entry: string;
};
name: string;
paused: boolean;
task?: unknown;
trigger: | {
clock: {
cron: string;
nextRunAt: string | null;
timezone: string;
};
}
| {
event: {
interest: string;
kinds?: string[];
provider: string;
screens: unknown[];
thread: string;
};
};
worker: string;
}, {
description?: string;
id: string;
madeBy?: | {
by: "user";
}
| {
by: "worker";
worker: string;
}
| {
by: "app";
entry: string;
};
name: string;
paused: boolean;
task?: unknown;
trigger: | {
clock: {
cron: string;
nextRunAt: string | null;
timezone: string;
};
}
| {
event: {
interest: string;
kinds?: string[];
provider: string;
screens: unknown[];
thread: string;
};
};
worker: string;
}>;

One routine as the list shows it. listRoutines answers clock routines soonest next run first, then event routines, each by name, then by id.


listedScreenSchema​

const listedScreenSchema: z.ZodDiscriminatedUnion<"screen", [z.ZodObject<{
any: z.ZodArray<z.ZodString, "many">;
screen: z.ZodLiteral<"labels">;
}, "strict", z.ZodTypeAny, {
any: string[];
screen: "labels";
}, {
any: string[];
screen: "labels";
}>, z.ZodObject<{
any: z.ZodArray<z.ZodString, "many">;
screen: z.ZodLiteral<"words">;
}, "strict", z.ZodTypeAny, {
any: string[];
screen: "words";
}, {
any: string[];
screen: "words";
}>, z.ZodObject<{
bots: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
ids: z.ZodArray<z.ZodString, "many">;
screen: z.ZodLiteral<"allow">;
}, "strict", z.ZodTypeAny, {
bots?: string[];
ids: string[];
screen: "allow";
}, {
bots?: string[];
ids: string[];
screen: "allow";
}>, z.ZodObject<{
name: z.ZodString;
screen: z.ZodLiteral<"custom">;
}, "strict", z.ZodTypeAny, {
name: string;
screen: "custom";
}, {
name: string;
screen: "custom";
}>, z.ZodObject<{
screen: z.ZodLiteral<"interest">;
}, "strict", z.ZodTypeAny, {
screen: "interest";
}, {
screen: "interest";
}>]>;

A screen a subscription lists (D1). sender and own always run and are not listed. Pinned: saved subscriptions carry these kind names.

  • labels: the event carries at least one of these labels.
  • words: the event's title or text contains at least one of these words, ignoring case.
  • allow: the event's sender is one of these ids. With bots, a bot sender must be one of bots and any other sender one of ids: a bot's id and a user's login share one form, so a user named like a listed bot isn't that bot. Without bots, the sender's id alone is checked, as saved rows were.
  • custom: the app's own screen of this name, declared once on the provider (D2).
  • interest: a model judges whether the event matches the subscription's sentence, after every code screen passed it (D1).

listLeadsOutputSchema​

const listLeadsOutputSchema: z.ZodObject<{
leads: z.ZodArray<z.ZodObject<{
description: z.ZodNullable<z.ZodString>;
id: z.ZodString;
}, "strip", z.ZodTypeAny, {
description: string | null;
id: string;
}, {
description: string | null;
id: string;
}>, "many">;
}, "strip", z.ZodTypeAny, {
leads: object[];
}, {
leads: object[];
}>;

What the lead list answers: each worker on the caller's roster that can lead, with what it does.


listProjects​

const listProjects: BlockDefinition;

List the projects the session's owner is a member of: each one's address, title, repository and brief.


listProjectsInputSchema​

const listProjectsInputSchema: z.ZodObject<{
}, "strict", z.ZodTypeAny, {
}, {
}>;

What listing the caller's projects takes: nothing.


listProjectsOutputSchema​

const listProjectsOutputSchema: z.ZodObject<{
projects: z.ZodArray<z.ZodObject<{
brief: z.ZodOptional<z.ZodNullable<z.ZodString>>;
id: z.ZodString;
repository: z.ZodNullable<z.ZodString>;
title: z.ZodString;
visibility: z.ZodEnum<["shared", "private"]>;
}, "strip", z.ZodTypeAny, {
brief?: string | null;
id: string;
repository: string | null;
title: string;
visibility: "private" | "shared";
}, {
brief?: string | null;
id: string;
repository: string | null;
title: string;
visibility: "private" | "shared";
}>, "many">;
}, "strip", z.ZodTypeAny, {
projects: object[];
}, {
projects: object[];
}>;

What listing the caller's projects returns: shared ones first, then private, each by id.


MAX_ANSWERS_AGAIN​

const MAX_ANSWERS_AGAIN: 3 = 3;

The most times one request answers again after its turn: the answer after its plan and each answer a source asked for count alike, so a source that always has a message can't loop a turn forever. After the last one no source runs, and what it would have taken stays for after the turn. Apart from core's maxSteps, which counts model calls in one answer, and the board's pass rounds, which count drains.


MAX_DELEGATES​

const MAX_DELEGATES: 25 = 25;

The most delegate records one session holds, and the most a worker's delegates: lists.


MAX_LISTED_RECIPIENTS​

const MAX_LISTED_RECIPIENTS: 25 = 25;

The most workers either list carries.


MAX_MESSAGE_CHARS​

const MAX_MESSAGE_CHARS: 8000 = 8000;

The longest text a message may carry. A longer one is refused, not cut.


MAX_ROUNDS​

const MAX_ROUNDS: 3 = 3;

The highest rounds: a coordinator may set.


MAX_RULE_CHARS​

const MAX_RULE_CHARS: 300 = 300;

The most characters one rule may hold.


MAX_RULES​

const MAX_RULES: 20 = 20;

The most rules one worker keeps for one user.


MCP_CREDENTIALS_PREFIX​

const MCP_CREDENTIALS_PREFIX: "mcp-credentials/" = "mcp-credentials/";

The keys' storage prefix, at user scope: a record's key is mcp-credentials/<server>.


MCP_CREDENTIALS_RESOURCE​

const MCP_CREDENTIALS_RESOURCE: "mcpCredentials" = "mcpCredentials";

The resource-map ref the keys are declared under.


mcpCredentialsCapability​

const mcpCredentialsCapability: DefinedCapability & object;

The keys collection, for the block a coding run's tools are resolved on.

Type Declaration​

__configInType?​
readonly __configInType?: undefined;
resourcesType?​
readonly resourcesType?: unknown;
sequencerStateType?​
readonly sequencerStateType?: unknown;
sessionStateType?​
readonly sessionStateType?: unknown;
stateSchemaType?​
readonly stateSchemaType?: unknown;
targetStatesType?​
readonly targetStatesType?: unknown;

mcpCredentialSchema​

const mcpCredentialSchema: z.ZodObject<{
setAt: z.ZodString;
value: z.ZodString;
}, "strip", z.ZodTypeAny, {
setAt: string;
value: string;
}, {
setAt: string;
value: string;
}>;

One stored key: the value as written, and when it was set (ISO 8601).


MESSAGE_STATUSES​

const MESSAGE_STATUSES: readonly ["unconfirmed", "delivered", "refused", "undeliverable"];

What became of a message: unconfirmed until the recipient's onMessageReceived takes it; delivered once it landed there; refused, final; undeliverable once it was owed past the host's debt age.


messageReceivedInputSchema​

const messageReceivedInputSchema: z.ZodObject<{
messageId: z.ZodString;
}, "strict", z.ZodTypeAny, {
messageId: string;
}, {
messageId: string;
}>;

What the entry takes: the message's id, and nothing a sender could shape.


messageReceivedSchema​

const messageReceivedSchema: z.ZodObject<{
budget: z.ZodNumber;
from: z.ZodString;
id: z.ZodString;
inReplyTo: z.ZodOptional<z.ZodString>;
replyRequested: z.ZodOptional<z.ZodBoolean>;
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
budget: number;
from: string;
id: string;
inReplyTo?: string;
replyRequested?: boolean;
text: string;
}, {
budget: number;
from: string;
id: string;
inReplyTo?: string;
replyRequested?: boolean;
text: string;
}>;

What a flow's turn hears: every field from the message's row and its chain, none from a sender's input.


NO_PROJECT_ID​

const NO_PROJECT_ID: "unassigned" = "unassigned";

The route id Shift Manager gives the workstreams no project lists. A project can never take it, or its page would be the No project page.


openWorkstreamInputSchema​

const openWorkstreamInputSchema: z.ZodObject<{
due: z.ZodOptional<z.ZodNullable<z.ZodString>>;
id: z.ZodString;
lead: z.ZodString;
objectives: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
project: z.ZodOptional<z.ZodObject<{
id: z.ZodString;
visibility: z.ZodEnum<["shared", "private"]>;
}, "strict", z.ZodTypeAny, {
id: string;
visibility: "private" | "shared";
}, {
id: string;
visibility: "private" | "shared";
}>>;
title: z.ZodString;
}, "strict", z.ZodTypeAny, {
due?: string | null;
id: string;
lead: string;
objectives?: string[];
project?: {
id: string;
visibility: "private" | "shared";
};
title: string;
}, {
due?: string | null;
id: string;
lead: string;
objectives?: string[];
project?: {
id: string;
visibility: "private" | "shared";
};
title: string;
}>;

What opening a workstream takes. Closed: nothing in it names the owner.


openWorkstreamOutputSchema​

const openWorkstreamOutputSchema: z.ZodObject<{
opened: z.ZodBoolean;
workstream: z.ZodObject<object & object, "strip", z.ZodTypeAny, {
due: string | null;
id: string;
lead: string;
objectives: object[];
openedAt: string;
owner: string;
project: {
id: string;
visibility: "private" | "shared";
};
sessionId: string | null;
status: string;
title: string;
updatedAt: string;
writtenBy: {
userId: string;
workerId?: string;
};
}, {
due?: string | null;
id: string;
lead: string;
objectives?: object[];
openedAt: string;
owner: string;
project: {
id: string;
visibility: "private" | "shared";
};
sessionId?: string | null;
status?: string;
title: string;
updatedAt: string;
writtenBy: {
userId: string;
workerId?: string;
};
}>;
}, "strip", z.ZodTypeAny, {
opened: boolean;
workstream: {
due: string | null;
id: string;
lead: string;
objectives: object[];
openedAt: string;
owner: string;
project: {
id: string;
visibility: "private" | "shared";
};
sessionId: string | null;
status: string;
title: string;
updatedAt: string;
writtenBy: {
userId: string;
workerId?: string;
};
};
}, {
opened: boolean;
workstream: {
due?: string | null;
id: string;
lead: string;
objectives?: object[];
openedAt: string;
owner: string;
project: {
id: string;
visibility: "private" | "shared";
};
sessionId?: string | null;
status?: string;
title: string;
updatedAt: string;
writtenBy: {
userId: string;
workerId?: string;
};
};
}>;

What opening a workstream returns: the entry, and whether this call made it.


previewAnswerSchema​

const previewAnswerSchema: z.ZodObject<{
decision: z.ZodEnum<["file", "dont-file"]>;
instructions: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
decision: "dont-file" | "file";
instructions?: string;
}, {
decision: "dont-file" | "file";
instructions?: string;
}>;

The operator's answer to a preview: an ordinary form.


PRIVATE_PROJECT_FILES_RESOURCE​

const PRIVATE_PROJECT_FILES_RESOURCE: "privateProjectFiles" = "privateProjectFiles";

The resource-map ref of the private projects' files: project-files/** at the owner's user scope.


PRIVATE_PROJECTS_RESOURCE​

const PRIVATE_PROJECTS_RESOURCE: "privateProjects" = "privateProjects";

The resource-map ref of the private projects: projects/* at the owner's user scope.


PRIVATE_WORKSTREAMS_RESOURCE​

const PRIVATE_WORKSTREAMS_RESOURCE: "privateWorkstreams" = "privateWorkstreams";

The resource-map ref of a private project's workstream entries, at the owner's user scope.


PROJECT_FILES_RESOURCE​

const PROJECT_FILES_RESOURCE: "project-files" = "project-files";

The resource-map ref of the project files.


PROJECT_MCP_CAPABILITY​

const PROJECT_MCP_CAPABILITY: "projectMcp" = "projectMcp";

The capability's name, as a worker's file names it under capabilities:.


PROJECT_MCP_IDLE_MS​

const PROJECT_MCP_IDLE_MS: number;

How long a kept connection stays open without a call or a resolve, by default: five minutes.


PROJECT_SOURCE_CAPABILITY​

const PROJECT_SOURCE_CAPABILITY: "projectSource" = "projectSource";

The capability's name, as a worker's file names it under capabilities:.


PROJECT_STATE_KEY​

const PROJECT_STATE_KEY: "projectId" = "projectId";

The session-state field that links a worker session to one project: the project's address, as projectRef writes it (<visibility>/<projectId>). Set when the session is created, only on a session of the standard coordinator the installation names as every project's coordinator, and checked at create: the creator must be able to read the project. Readonly. Pinned: the criteria key findWorkerSession and ensureWorkerSession take.


projectAddressSchema​

const projectAddressSchema: z.ZodObject<{
id: z.ZodString;
visibility: z.ZodEnum<["shared", "private"]>;
}, "strict", z.ZodTypeAny, {
id: string;
visibility: "private" | "shared";
}, {
id: string;
visibility: "private" | "shared";
}>;

A project's address: its visibility and its id. Every project read and write after the create takes one, and picks the collection from it. A private address only ever reaches the caller's own user scope.


projectCoordinatorTools​

const projectCoordinatorTools: object;

The tools a project coordinator's file can name, by key: put them in the agent catalog the coordinator flow is built with (defineCoordinatorFlow({ agent: { catalog } })), and list readProject in the project coordinator's tools:. Handing work to a workstream is the coordinator's own createTask with the routing settings, naming the workstream's delegate record by its target.

Type Declaration​

readProject​
readonly readProject: BlockDefinition<z.ZodObject<{
}, "strict", z.ZodTypeAny, {
}, {
}>, z.ZodObject<object & object, "strip", z.ZodTypeAny, {
progress: {
byStatus: Record<string, number>;
nextDue: string | null;
objectives: {
met: number;
total: number;
};
stale: object[];
workstreams: number;
};
project: {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
};
visibility: "private" | "shared";
workstreams: object[];
}, {
progress: {
byStatus: Record<string, number>;
nextDue: string | null;
objectives: {
met: number;
total: number;
};
stale: object[];
workstreams: number;
};
project: {
brief?: string | null;
checks?: string[];
id: string;
mcpServers?: string[];
members?: string[];
ownerUserId: string;
repository?: string | null;
status?: string;
title: string;
};
visibility: "private" | "shared";
workstreams: object[];
}>, {
}, {
progress: {
byStatus: Record<string, number>;
nextDue: string | null;
objectives: {
met: number;
total: number;
};
stale: object[];
workstreams: number;
};
project: {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
};
visibility: "private" | "shared";
workstreams: object[];
}>;

projectFileSchema​

const projectFileSchema: z.ZodObject<{
hash: z.ZodDefault<z.ZodNullable<z.ZodString>>;
path: z.ZodDefault<z.ZodNullable<z.ZodString>>;
updatedAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
hash: string | null;
path: string | null;
updatedAt: string | null;
}, {
hash?: string | null;
path?: string | null;
updatedAt?: string | null;
}>;

One file a project keeps, as a workspace projection commits it: its path under the project, its content hash, and when it was last synced. The file's body is the row's content, not its state. Nullable with a null default, so a row written with less still reads.


projectProgressSchema​

const projectProgressSchema: z.ZodObject<{
byStatus: z.ZodRecord<z.ZodString, z.ZodNumber>;
nextDue: z.ZodNullable<z.ZodString>;
objectives: z.ZodObject<{
met: z.ZodNumber;
total: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
met: number;
total: number;
}, {
met: number;
total: number;
}>;
stale: z.ZodArray<z.ZodObject<{
id: z.ZodString;
owner: z.ZodString;
updatedAt: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
owner: string;
updatedAt: string;
}, {
id: string;
owner: string;
updatedAt: string;
}>, "many">;
workstreams: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
byStatus: Record<string, number>;
nextDue: string | null;
objectives: {
met: number;
total: number;
};
stale: object[];
workstreams: number;
}, {
byStatus: Record<string, number>;
nextDue: string | null;
objectives: {
met: number;
total: number;
};
stale: object[];
workstreams: number;
}>;

A project's progress, as readProject answers it.

See​

projectProgress


projectResourceStateSchema​

const projectResourceStateSchema: z.ZodObject<{
brief: z.ZodDefault<z.ZodNullable<z.ZodString>>;
checks: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
id: z.ZodString;
mcpServers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
members: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
ownerUserId: z.ZodString;
repository: z.ZodDefault<z.ZodNullable<z.ZodString>>;
status: z.ZodDefault<z.ZodString>;
title: z.ZodString;
}, "strip", z.ZodTypeAny, {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
}, {
brief?: string | null;
checks?: string[];
id: string;
mcpServers?: string[];
members?: string[];
ownerUserId: string;
repository?: string | null;
status?: string;
title: string;
}>;

One project, as it is stored.

id, title and ownerUserId are required: a row that lost one is not a thinner project, it is one nobody can address or own. Every other field carries a default so a row written by an earlier version still reads.

members decides who opens workstreams in a shared project. It is written only by trusted code — the creator's own grant at create — and nothing a member does adds to it.


PROJECTS_FLOW​

const PROJECTS_FLOW: "projects";

The flow a host registers its project writes on (defineProjectBlocks().actions), and the projects collections' runBy: a client's createProject or setBrief runs here. Pinned: a host that serves projects to a client registers its projects flow under this name.


PROJECTS_PATTERN​

const PROJECTS_PATTERN: "projects/*";

The projects' key pattern, at org scope for a shared project and the owner's user scope for a private one.


PROJECTS_RESOURCE​

const PROJECTS_RESOURCE: "projects" = "projects";

The resource-map ref of the projects collection. Pinned: Shift Manager reads it by this name.


projectSetupOutputSchema​

const projectSetupOutputSchema: z.ZodObject<{
projectCoordinator: z.ZodNullable<z.ZodString>;
}, "strip", z.ZodTypeAny, {
projectCoordinator: string | null;
}, {
projectCoordinator: string | null;
}>;

What the project setup view answers: the worker each user's project coordinator runs as, or null.


projectVisibilitySchema​

const projectVisibilitySchema: z.ZodEnum<["shared", "private"]>;

Where a project lives: "shared" in the organization, "private" in its owner's user scope. A create that names none makes a shared project.


projectWorkspaceCapability​

const projectWorkspaceCapability: DefinedCapability & object;

The collections projectWorkspace reads: the workstream entries, the projects and the project files, at both visibilities, and the conversation ledger a task is read from. Pass it on the uses of the block that asks the source (for harness-manager, harnessManager({ uses: [projectWorkspaceCapability] })).

The same declarations the project blocks install, so it meets them in one flow without a conflict.

Type Declaration​

__configInType?​
readonly __configInType?: undefined;
resourcesType?​
readonly resourcesType?: unknown;
sequencerStateType?​
readonly sequencerStateType?: unknown;
sessionStateType?​
readonly sessionStateType?: unknown;
stateSchemaType?​
readonly stateSchemaType?: unknown;
targetStatesType?​
readonly targetStatesType?: unknown;

readProject​

const readProject: BlockDefinition;

Read a project, its entries and its progress. no-such-project when the address names none.


readProjectFilesInputSchema​

const readProjectFilesInputSchema: z.ZodObject<{
project: z.ZodObject<{
id: z.ZodString;
visibility: z.ZodEnum<["shared", "private"]>;
}, "strict", z.ZodTypeAny, {
id: string;
visibility: "private" | "shared";
}, {
id: string;
visibility: "private" | "shared";
}>;
}, "strict", z.ZodTypeAny, {
project: {
id: string;
visibility: "private" | "shared";
};
}, {
project: {
id: string;
visibility: "private" | "shared";
};
}>;

What reading a project's files takes: the project's address.


readProjectFilesOutputSchema​

const readProjectFilesOutputSchema: z.ZodObject<{
files: z.ZodArray<z.ZodObject<{
path: z.ZodString;
size: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
path: string;
size: number;
}, {
path: string;
size: number;
}>, "many">;
}, "strip", z.ZodTypeAny, {
files: object[];
}, {
files: object[];
}>;

What reading a project's files returns: each file's path under the project, and its size in UTF-8 bytes.


readProjectInputSchema​

const readProjectInputSchema: z.ZodObject<{
project: z.ZodObject<{
id: z.ZodString;
visibility: z.ZodEnum<["shared", "private"]>;
}, "strict", z.ZodTypeAny, {
id: string;
visibility: "private" | "shared";
}, {
id: string;
visibility: "private" | "shared";
}>;
}, "strict", z.ZodTypeAny, {
project: {
id: string;
visibility: "private" | "shared";
};
}, {
project: {
id: string;
visibility: "private" | "shared";
};
}>;

What reading a project takes: its address.


readProjectOutputSchema​

const readProjectOutputSchema: z.ZodObject<{
progress: z.ZodObject<{
byStatus: z.ZodRecord<z.ZodString, z.ZodNumber>;
nextDue: z.ZodNullable<z.ZodString>;
objectives: z.ZodObject<{
met: z.ZodNumber;
total: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
met: number;
total: number;
}, {
met: number;
total: number;
}>;
stale: z.ZodArray<z.ZodObject<{
id: z.ZodString;
owner: z.ZodString;
updatedAt: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
owner: string;
updatedAt: string;
}, {
id: string;
owner: string;
updatedAt: string;
}>, "many">;
workstreams: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
byStatus: Record<string, number>;
nextDue: string | null;
objectives: {
met: number;
total: number;
};
stale: object[];
workstreams: number;
}, {
byStatus: Record<string, number>;
nextDue: string | null;
objectives: {
met: number;
total: number;
};
stale: object[];
workstreams: number;
}>;
project: z.ZodObject<{
brief: z.ZodDefault<z.ZodNullable<z.ZodString>>;
checks: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
id: z.ZodString;
mcpServers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
members: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
ownerUserId: z.ZodString;
repository: z.ZodDefault<z.ZodNullable<z.ZodString>>;
status: z.ZodDefault<z.ZodString>;
title: z.ZodString;
}, "strip", z.ZodTypeAny, {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
}, {
brief?: string | null;
checks?: string[];
id: string;
mcpServers?: string[];
members?: string[];
ownerUserId: string;
repository?: string | null;
status?: string;
title: string;
}>;
visibility: z.ZodEnum<["shared", "private"]>;
workstreams: z.ZodArray<z.ZodObject<object & object, "strip", z.ZodTypeAny, {
due: string | null;
id: string;
lead: string;
objectives: object[];
openedAt: string;
owner: string;
project: {
id: string;
visibility: "private" | "shared";
};
sessionId: string | null;
status: string;
title: string;
updatedAt: string;
writtenBy: {
userId: string;
workerId?: string;
};
}, {
due?: string | null;
id: string;
lead: string;
objectives?: object[];
openedAt: string;
owner: string;
project: {
id: string;
visibility: "private" | "shared";
};
sessionId?: string | null;
status?: string;
title: string;
updatedAt: string;
writtenBy: {
userId: string;
workerId?: string;
};
}>, "many">;
}, "strip", z.ZodTypeAny, {
progress: {
byStatus: Record<string, number>;
nextDue: string | null;
objectives: {
met: number;
total: number;
};
stale: object[];
workstreams: number;
};
project: {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
};
visibility: "private" | "shared";
workstreams: object[];
}, {
progress: {
byStatus: Record<string, number>;
nextDue: string | null;
objectives: {
met: number;
total: number;
};
stale: object[];
workstreams: number;
};
project: {
brief?: string | null;
checks?: string[];
id: string;
mcpServers?: string[];
members?: string[];
ownerUserId: string;
repository?: string | null;
status?: string;
title: string;
};
visibility: "private" | "shared";
workstreams: object[];
}>;

What reading a project returns.


readProjectSourceOutputSchema​

const readProjectSourceOutputSchema: z.ZodUnion<[z.ZodObject<{
kind: z.ZodLiteral<"refused">;
message: z.ZodString;
reason: z.ZodString;
}, "strip", z.ZodTypeAny, {
kind: "refused";
message: string;
reason: string;
}, {
kind: "refused";
message: string;
reason: string;
}>, z.ZodObject<{
at: z.ZodUnion<[z.ZodObject<{
ageMs: z.ZodNullable<z.ZodNumber>;
branch: z.ZodString;
commit: z.ZodString;
fetchedAt: z.ZodNullable<z.ZodString>;
kind: z.ZodLiteral<"repo">;
}, "strip", z.ZodTypeAny, {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}, {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}>, z.ZodObject<{
kind: z.ZodLiteral<"files">;
}, "strip", z.ZodTypeAny, {
kind: "files";
}, {
kind: "files";
}>]>;
bytes: z.ZodOptional<z.ZodNumber>;
content: z.ZodOptional<z.ZodString>;
cut: z.ZodOptional<z.ZodNullable<z.ZodObject<{
by: z.ZodEnum<["paths", "lines", "bytes", "matches", "limit"]>;
left: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
by: "bytes" | "limit" | "lines" | "matches" | "paths";
left: number;
}, {
by: "bytes" | "limit" | "lines" | "matches" | "paths";
left: number;
}>>>;
endLine: z.ZodOptional<z.ZodNumber>;
kind: z.ZodLiteral<"read">;
path: z.ZodString;
startLine: z.ZodOptional<z.ZodNumber>;
status: z.ZodEnum<["ok", "missing", "directory", "binary", "too-large"]>;
totalLines: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
at: | {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}
| {
kind: "files";
};
bytes?: number;
content?: string;
cut?: | {
by: "bytes" | "limit" | "lines" | "matches" | "paths";
left: number;
}
| null;
endLine?: number;
kind: "read";
path: string;
startLine?: number;
status: "binary" | "directory" | "missing" | "ok" | "too-large";
totalLines?: number;
}, {
at: | {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}
| {
kind: "files";
};
bytes?: number;
content?: string;
cut?: | {
by: "bytes" | "limit" | "lines" | "matches" | "paths";
left: number;
}
| null;
endLine?: number;
kind: "read";
path: string;
startLine?: number;
status: "binary" | "directory" | "missing" | "ok" | "too-large";
totalLines?: number;
}>]>;

What readProjectSource answers.


RECEIVED_MESSAGE_DATA_TYPE​

const RECEIVED_MESSAGE_DATA_TYPE: "workforce:received" = "workforce:received";

The client-only data record a received message is drawn from. Pinned: an app's renderer is keyed by it.


REDACTED​

const REDACTED: "[redacted]" = "[redacted]";

What a removed value is replaced with.


REMOVE_DELEGATE​

const REMOVE_DELEGATE: "removeDelegate" = "removeDelegate";

A worker's delegates: the workers it hands work to, which any worker's file may list as delegates:.

  • The pinned names: the four delegate actions an app sends (addDelegate, removeDelegate, setFallback, listDelegates) and the most delegates one session holds.
  • delegateRecordSchema: one delegate record, as listDelegates answers it.
  • DelegateTakes: what listDelegates says each delegate takes.
  • TaskDelegates: a session's delegates as a task sees them.

A flow carries them, with the task board they file onto, through defineSessionBoard.


REPORT_SESSION_PREFIX​

const REPORT_SESSION_PREFIX: "error-report~" = "error-report~";

A report's session: one per report row, its id the row's key behind this prefix.


repositoryCheckAnswerSchema​

const repositoryCheckAnswerSchema: z.ZodUnion<[z.ZodObject<{
how: z.ZodEnum<["worktree", "clone"]>;
usable: z.ZodLiteral<true>;
}, "strip", z.ZodTypeAny, {
how: "clone" | "worktree";
usable: true;
}, {
how: "clone" | "worktree";
usable: true;
}>, z.ZodObject<{
problem: z.ZodString;
usable: z.ZodLiteral<false>;
}, "strip", z.ZodTypeAny, {
problem: string;
usable: false;
}, {
problem: string;
usable: false;
}>]>;

The host's answer for one repository: where a run's checkout would be, or why there would be none.


ROSTER_FLOW​

const ROSTER_FLOW: "workforce-roster" = "workforce-roster";

The roster flow's flow kind: a flow that runs no worker and declares the two worker collections, so a client can read a user's roster through a session of its own. Its own kind, so a listing of a worker flow's sessions never shows a roster session.


rosterView​

const rosterView: ViewRef;

The roster view, for useView(rosterView) or client.view(rosterView).


ROUTINE_CADENCES​

const ROUTINE_CADENCES: readonly [5, 10, 15, 20, 30, 60];

The cadences an event routine may poll at, in minutes. Checked here; a pushed provider ignores them.


ROUTINE_VERBS​

const ROUTINE_VERBS: object;

The four routine verbs, the same names as roster actions and as a worker's tools.

Type Declaration​

delete​
readonly delete: "deleteRoutine";
list​
readonly list: "listRoutines";
pause​
readonly pause: "pauseRoutine";
save​
readonly save: "saveRoutine";

routineMakerSchema​

const routineMakerSchema: z.ZodDiscriminatedUnion<"by", [z.ZodObject<{
by: z.ZodLiteral<"user">;
}, "strict", z.ZodTypeAny, {
by: "user";
}, {
by: "user";
}>, z.ZodObject<{
by: z.ZodLiteral<"worker">;
worker: z.ZodString;
}, "strict", z.ZodTypeAny, {
by: "worker";
worker: string;
}, {
by: "worker";
worker: string;
}>, z.ZodObject<{
by: z.ZodLiteral<"app">;
entry: z.ZodString;
}, "strict", z.ZodTypeAny, {
by: "app";
entry: string;
}, {
by: "app";
entry: string;
}>]>;

Who made a routine: the user, a worker in one of their conversations, or the app's config (routines.declared, by entry id). Stored with the routine, and optional there: one saved before it names no maker.


RULE_TOOLS​

const RULE_TOOLS: object;

The four rule tools' names. Pinned: model-facing, and named in the docs.

Type Declaration​

add​
readonly add: "rules/add";
change​
readonly change: "rules/change";
read​
readonly read: "rules/read";
remove​
readonly remove: "rules/remove";

scheduledTaskInputSchema​

const scheduledTaskInputSchema: z.ZodObject<{
assignee: z.ZodOptional<z.ZodString>;
filer: z.ZodString;
goal: z.ZodString;
input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
priority: z.ZodOptional<z.ZodNumber>;
title: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
assignee?: string;
filer: string;
goal: string;
input?: Record<string, unknown>;
metadata?: Record<string, unknown>;
priority?: number;
title?: string;
}, {
assignee?: string;
filer: string;
goal: string;
input?: Record<string, unknown>;
metadata?: Record<string, unknown>;
priority?: number;
title?: string;
}>;

The task a fire files: the worker whose board it lands on, and the task as the board's filing takes it. Fields that would make the filing anything but a new task (a recorded task's id, a wait, a post) are refused by name.


SCHEDULES_PATTERN​

const SCHEDULES_PATTERN: "workforce/schedules/*" = "workforce/schedules/*";

Where a user's schedules are stored, one row per schedule, at user scope (per organization). Pinned: persisted, and part of each schedule's dispatch id (<orgId>/<userId>/<key>, the key relative to this pattern).


SCHEDULES_RESOURCE​

const SCHEDULES_RESOURCE: "workforceSchedules" = "workforceSchedules";

The accessor the roster flow declares the user's schedule collection under.


SCREEN_KINDS​

const SCREEN_KINDS: readonly ["sender", "own", "labels", "words", "allow"];

The five screen kinds, in the order the chain runs them. Pinned.


screenVerdictSchema​

const screenVerdictSchema: z.ZodObject<{
failed: z.ZodOptional<z.ZodLiteral<true>>;
pass: z.ZodBoolean;
reason: z.ZodString;
subscription: z.ZodString;
}, "strip", z.ZodTypeAny, {
failed?: true;
pass: boolean;
reason: string;
subscription: string;
}, {
failed?: true;
pass: boolean;
reason: string;
subscription: string;
}>;

One verdict: a subscription, whether it passed, and the screen that decided it and why. Pinned (D1). failed marks a refusal by a screen that couldn't run (it threw, answered with no string, or isn't declared): it decided nothing about the event. Set only by the screens themselves, never read off a reason.


SEND_MESSAGE_TOOL​

const SEND_MESSAGE_TOOL: "sendMessage" = "sendMessage";

The tool a worker's model sends a message with. Pinned: an app draws its calls by name.


sendMessageInputSchema​

const sendMessageInputSchema: z.ZodObject<{
deadline: z.ZodOptional<z.ZodNumber>;
inReplyTo: z.ZodOptional<z.ZodString>;
replyRequested: z.ZodOptional<z.ZodBoolean>;
text: z.ZodString;
to: z.ZodUnion<[z.ZodString, z.ZodObject<{
task: z.ZodString;
}, "strict", z.ZodTypeAny, {
task: string;
}, {
task: string;
}>, z.ZodObject<{
session: z.ZodString;
}, "strict", z.ZodTypeAny, {
session: string;
}, {
session: string;
}>]>;
wait: z.ZodOptional<z.ZodBoolean>;
}, "strict", z.ZodTypeAny, {
deadline?: number;
inReplyTo?: string;
replyRequested?: boolean;
text: string;
to: | string
| {
task: string;
}
| {
session: string;
};
wait?: boolean;
}, {
deadline?: number;
inReplyTo?: string;
replyRequested?: boolean;
text: string;
to: | string
| {
task: string;
}
| {
session: string;
};
wait?: boolean;
}>;

What the model passes. Strict: nothing else is taken.


serviceSender​

const serviceSender: (provider) => string;

The sender a delivery's message names: service:<provider> (epic D9).

Parameters​

provider​

string

Returns​

string


sessionTurnsViewRef​

const sessionTurnsViewRef: () => ViewRef;

One session's turns, by status: useView(sessionTurnsViewRef(), { sessionId }).

Returns​

ViewRef


SET_FALLBACK​

const SET_FALLBACK: "setFallback" = "setFallback";

A worker's delegates: the workers it hands work to, which any worker's file may list as delegates:.

  • The pinned names: the four delegate actions an app sends (addDelegate, removeDelegate, setFallback, listDelegates) and the most delegates one session holds.
  • delegateRecordSchema: one delegate record, as listDelegates answers it.
  • DelegateTakes: what listDelegates says each delegate takes.
  • TaskDelegates: a session's delegates as a task sees them.

A flow carries them, with the task board they file onto, through defineSessionBoard.


SET_SESSION_FIELDS_ACTION​

const SET_SESSION_FIELDS_ACTION: "setSessionFields" = "setSessionFields";

The action that writes the app's session fields (the installation's sessionFields) on the user's own conversation it runs in, once each: the server's write at open. The agent and coordinator flows declare it when the app declares a field.


SET_WORK_PROJECT_ACTION​

const SET_WORK_PROJECT_ACTION: "setWorkProject" = "setWorkProject";

The action that sets WORK_PROJECT_STATE_KEY on the session it runs in. Every worker flow declares it.


setBriefInputSchema​

const setBriefInputSchema: z.ZodObject<{
brief: z.ZodNullable<z.ZodString>;
project: z.ZodOptional<z.ZodObject<{
id: z.ZodString;
visibility: z.ZodEnum<["shared", "private"]>;
}, "strict", z.ZodTypeAny, {
id: string;
visibility: "private" | "shared";
}, {
id: string;
visibility: "private" | "shared";
}>>;
}, "strict", z.ZodTypeAny, {
brief: string | null;
project?: {
id: string;
visibility: "private" | "shared";
};
}, {
brief: string | null;
project?: {
id: string;
visibility: "private" | "shared";
};
}>;

What setBrief takes: the address and the new brief or null. No address: the linked project.


setBriefOutputSchema​

const setBriefOutputSchema: z.ZodObject<{
project: z.ZodObject<{
brief: z.ZodDefault<z.ZodNullable<z.ZodString>>;
checks: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
id: z.ZodString;
mcpServers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
members: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
ownerUserId: z.ZodString;
repository: z.ZodDefault<z.ZodNullable<z.ZodString>>;
status: z.ZodDefault<z.ZodString>;
title: z.ZodString;
}, "strip", z.ZodTypeAny, {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
}, {
brief?: string | null;
checks?: string[];
id: string;
mcpServers?: string[];
members?: string[];
ownerUserId: string;
repository?: string | null;
status?: string;
title: string;
}>;
}, "strip", z.ZodTypeAny, {
project: {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
};
}, {
project: {
brief?: string | null;
checks?: string[];
id: string;
mcpServers?: string[];
members?: string[];
ownerUserId: string;
repository?: string | null;
status?: string;
title: string;
};
}>;

What setting a project's brief returns: the row as written.


setChecksInputSchema​

const setChecksInputSchema: z.ZodObject<{
checks: z.ZodArray<z.ZodString, "many">;
project: z.ZodOptional<z.ZodObject<{
id: z.ZodString;
visibility: z.ZodEnum<["shared", "private"]>;
}, "strict", z.ZodTypeAny, {
id: string;
visibility: "private" | "shared";
}, {
id: string;
visibility: "private" | "shared";
}>>;
}, "strict", z.ZodTypeAny, {
checks: string[];
project?: {
id: string;
visibility: "private" | "shared";
};
}, {
checks: string[];
project?: {
id: string;
visibility: "private" | "shared";
};
}>;

What setChecks takes: the address and the whole new list of commands; [] names none. No address: the linked project.


setChecksOutputSchema​

const setChecksOutputSchema: z.ZodObject<{
project: z.ZodObject<{
brief: z.ZodDefault<z.ZodNullable<z.ZodString>>;
checks: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
id: z.ZodString;
mcpServers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
members: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
ownerUserId: z.ZodString;
repository: z.ZodDefault<z.ZodNullable<z.ZodString>>;
status: z.ZodDefault<z.ZodString>;
title: z.ZodString;
}, "strip", z.ZodTypeAny, {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
}, {
brief?: string | null;
checks?: string[];
id: string;
mcpServers?: string[];
members?: string[];
ownerUserId: string;
repository?: string | null;
status?: string;
title: string;
}>;
}, "strip", z.ZodTypeAny, {
project: {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
};
}, {
project: {
brief?: string | null;
checks?: string[];
id: string;
mcpServers?: string[];
members?: string[];
ownerUserId: string;
repository?: string | null;
status?: string;
title: string;
};
}>;

What setting a project's checks returns: the row as written.


setMcpServersInputSchema​

const setMcpServersInputSchema: z.ZodObject<{
mcpServers: z.ZodArray<z.ZodUnknown, "many">;
project: z.ZodOptional<z.ZodObject<{
id: z.ZodString;
visibility: z.ZodEnum<["shared", "private"]>;
}, "strict", z.ZodTypeAny, {
id: string;
visibility: "private" | "shared";
}, {
id: string;
visibility: "private" | "shared";
}>>;
}, "strict", z.ZodTypeAny, {
mcpServers: unknown[];
project?: {
id: string;
visibility: "private" | "shared";
};
}, {
mcpServers: unknown[];
project?: {
id: string;
visibility: "private" | "shared";
};
}>;

What setMcpServers takes: the address and the whole new list of MCP server names; [] turns them all off. No address: the linked project. Each item is checked by the write, not here, so a value that isn't a name is refused as invalid-mcp-server without being repeated.


setMcpServersOutputSchema​

const setMcpServersOutputSchema: z.ZodObject<{
project: z.ZodObject<{
brief: z.ZodDefault<z.ZodNullable<z.ZodString>>;
checks: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
id: z.ZodString;
mcpServers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
members: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
ownerUserId: z.ZodString;
repository: z.ZodDefault<z.ZodNullable<z.ZodString>>;
status: z.ZodDefault<z.ZodString>;
title: z.ZodString;
}, "strip", z.ZodTypeAny, {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
}, {
brief?: string | null;
checks?: string[];
id: string;
mcpServers?: string[];
members?: string[];
ownerUserId: string;
repository?: string | null;
status?: string;
title: string;
}>;
}, "strip", z.ZodTypeAny, {
project: {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
};
}, {
project: {
brief?: string | null;
checks?: string[];
id: string;
mcpServers?: string[];
members?: string[];
ownerUserId: string;
repository?: string | null;
status?: string;
title: string;
};
}>;

What setting a project's MCP servers returns: the row as written.


setRepositoryInputSchema​

const setRepositoryInputSchema: z.ZodObject<{
project: z.ZodOptional<z.ZodObject<{
id: z.ZodString;
visibility: z.ZodEnum<["shared", "private"]>;
}, "strict", z.ZodTypeAny, {
id: string;
visibility: "private" | "shared";
}, {
id: string;
visibility: "private" | "shared";
}>>;
repository: z.ZodNullable<z.ZodString>;
}, "strict", z.ZodTypeAny, {
project?: {
id: string;
visibility: "private" | "shared";
};
repository: string | null;
}, {
project?: {
id: string;
visibility: "private" | "shared";
};
repository: string | null;
}>;

What setRepository takes: the address and the new remote or null. No address: the linked project.


setRepositoryOutputSchema​

const setRepositoryOutputSchema: z.ZodObject<{
project: z.ZodObject<{
brief: z.ZodDefault<z.ZodNullable<z.ZodString>>;
checks: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
id: z.ZodString;
mcpServers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
members: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
ownerUserId: z.ZodString;
repository: z.ZodDefault<z.ZodNullable<z.ZodString>>;
status: z.ZodDefault<z.ZodString>;
title: z.ZodString;
}, "strip", z.ZodTypeAny, {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
}, {
brief?: string | null;
checks?: string[];
id: string;
mcpServers?: string[];
members?: string[];
ownerUserId: string;
repository?: string | null;
status?: string;
title: string;
}>;
}, "strip", z.ZodTypeAny, {
project: {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
};
}, {
project: {
brief?: string | null;
checks?: string[];
id: string;
mcpServers?: string[];
members?: string[];
ownerUserId: string;
repository?: string | null;
status?: string;
title: string;
};
}>;

What setting a project's repository returns: the row as written.


setWorkProjectAction​

const setWorkProjectAction: object;

The action, as a worker flow declares it under SET_WORK_PROJECT_ACTION.

Type Declaration​

block​
block: BlockDefinition;
inputSchema​
inputSchema: z.ZodObject<{
project: z.ZodObject<{
id: z.ZodString;
visibility: z.ZodEnum<["shared", "private"]>;
}, "strict", z.ZodTypeAny, {
id: string;
visibility: "private" | "shared";
}, {
id: string;
visibility: "private" | "shared";
}>;
worker: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
project: {
id: string;
visibility: "private" | "shared";
};
worker?: string;
}, {
project: {
id: string;
visibility: "private" | "shared";
};
worker?: string;
}>;

setWorkProjectInputSchema​

const setWorkProjectInputSchema: z.ZodObject<{
project: z.ZodObject<{
id: z.ZodString;
visibility: z.ZodEnum<["shared", "private"]>;
}, "strict", z.ZodTypeAny, {
id: string;
visibility: "private" | "shared";
}, {
id: string;
visibility: "private" | "shared";
}>;
worker: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
project: {
id: string;
visibility: "private" | "shared";
};
worker?: string;
}, {
project: {
id: string;
visibility: "private" | "shared";
};
worker?: string;
}>;

What the action takes: the project, by visibility and id, and the worker the caller means the session to run, which it must. worker is a check on the caller's intent, which the workforce client always sends, not a boundary: a caller that leaves it out sets whichever of its own sessions it names.


setWorkProjectOutputSchema​

const setWorkProjectOutputSchema: z.ZodObject<{
project: z.ZodObject<{
id: z.ZodString;
visibility: z.ZodEnum<["shared", "private"]>;
}, "strict", z.ZodTypeAny, {
id: string;
visibility: "private" | "shared";
}, {
id: string;
visibility: "private" | "shared";
}>;
}, "strip", z.ZodTypeAny, {
project: {
id: string;
visibility: "private" | "shared";
};
}, {
project: {
id: string;
visibility: "private" | "shared";
};
}>;

What the action answers: the project the conversation now works in.


setWorkProjectTool​

const setWorkProjectTool: BlockDefinition;

The work-project action as a tool, setWorkProject: the worker pins the project its own conversation works in, the one it just created or picked, so the tasks it files there run in that project. The same block and the same refusals as the action (./work-project): only in the user's own conversation with the worker, on a project they may work in.


STALE_AFTER_MS​

const STALE_AFTER_MS: number;

How long an entry can go unchanged before it reads as stale: seven days.


STANDARD_WORKERS_PATTERN​

const STANDARD_WORKERS_PATTERN: "workforce/standard-workers/*" = "workforce/standard-workers/*";

Where the standard workers are projected from the installation's files.


STANDARD_WORKERS_RESOURCE​

const STANDARD_WORKERS_RESOURCE: "workforceStandardWorkers" = "workforceStandardWorkers";

The accessor a flow declares the standard-worker projection under.


standardWorkerResourceStateSchema​

const standardWorkerResourceStateSchema: z.ZodObject<{
description: z.ZodNullable<z.ZodString>;
flow: z.ZodString;
name: z.ZodNullable<z.ZodString>;
settings: z.ZodRecord<z.ZodString, z.ZodUnknown>;
teamName: z.ZodNullable<z.ZodString>;
}, "strip", z.ZodTypeAny, {
description: string | null;
flow: string;
name: string | null;
settings: Record<string, unknown>;
teamName: string | null;
}, {
description: string | null;
flow: string;
name: string | null;
settings: Record<string, unknown>;
teamName: string | null;
}>;

What a standard worker's projected row says: which flow it runs on, what it's for, the names a user reads it and its team by (its file's name: and its team's TEAM.md name:, each null when unset), and the settings its flow shows.


STANDING_RULES_ACTION​

const STANDING_RULES_ACTION: "standingRules" = "standingRules";

The action a page reads and edits a worker's rules through, on the worker's own flow.


STANDING_RULES_LINE​

const STANDING_RULES_LINE: "standing-rules" = "standing-rules";

The agentName the line a rule write posts carries, so a renderer can tell it from a reply.


STANDING_RULES_RESOURCE​

const STANDING_RULES_RESOURCE: "standing-rules" = "standing-rules";

The accessor a flow declares the record under. Pinned: a reader rests on it.


standingRulesActionInputSchema​

const standingRulesActionInputSchema: z.ZodDiscriminatedUnion<"op", [z.ZodObject<{
op: z.ZodLiteral<"read">;
}, "strict", z.ZodTypeAny, {
op: "read";
}, {
op: "read";
}>, z.ZodObject<{
op: z.ZodLiteral<"add">;
text: z.ZodString;
version: z.ZodNumber;
}, "strict", z.ZodTypeAny, {
op: "add";
text: string;
version: number;
}, {
op: "add";
text: string;
version: number;
}>, z.ZodObject<{
current: z.ZodString;
number: z.ZodNumber;
op: z.ZodLiteral<"change">;
text: z.ZodString;
version: z.ZodNumber;
}, "strict", z.ZodTypeAny, {
current: string;
number: number;
op: "change";
text: string;
version: number;
}, {
current: string;
number: number;
op: "change";
text: string;
version: number;
}>, z.ZodObject<{
current: z.ZodString;
number: z.ZodNumber;
op: z.ZodLiteral<"remove">;
version: z.ZodNumber;
}, "strict", z.ZodTypeAny, {
current: string;
number: number;
op: "remove";
version: number;
}, {
current: string;
number: number;
op: "remove";
version: number;
}>]>;

What the action takes: a read, or one write naming the version of the list it read.


standingRulesActionOutputSchema​

const standingRulesActionOutputSchema: z.ZodObject<{
line: z.ZodOptional<z.ZodString>;
rules: z.ZodArray<z.ZodObject<{
addedAt: z.ZodNumber;
number: z.ZodNumber;
sessionId: z.ZodNullable<z.ZodString>;
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
addedAt: number;
number: number;
sessionId: string | null;
text: string;
}, {
addedAt: number;
number: number;
sessionId: string | null;
text: string;
}>, "many">;
version: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
line?: string;
rules: object[];
version: number;
}, {
line?: string;
rules: object[];
version: number;
}>;

What the action answers: the list as it stands after the call, and the line a write produced.


standingRuleSchema​

const standingRuleSchema: z.ZodObject<{
addedAt: z.ZodNumber;
sessionId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
addedAt: number;
sessionId: string | null;
text: string;
}, {
addedAt: number;
sessionId?: string | null;
text: string;
}>;

One standing rule: its text, when it was added, and the conversation it came from.


standingRulesStateSchema​

const standingRulesStateSchema: z.ZodObject<{
rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
addedAt: z.ZodNumber;
sessionId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
addedAt: number;
sessionId: string | null;
text: string;
}, {
addedAt: number;
sessionId?: string | null;
text: string;
}>, "many">>;
version: z.ZodDefault<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
rules: object[];
version: number;
}, {
rules?: object[];
version?: number;
}>;

A worker's rules for one user. version counts the writes the list has taken: every write names the version it read, and one that read an older list is refused rather than landing on a list it never saw.


subscribeInputSchema​

const subscribeInputSchema: z.ZodObject<{
everyMinutes: z.ZodOptional<z.ZodNumber>;
interest: z.ZodString;
kinds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
outsiders: z.ZodOptional<z.ZodLiteral<true>>;
provider: z.ZodString;
screens: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"screen", [z.ZodObject<{
any: z.ZodArray<z.ZodString, "many">;
screen: z.ZodLiteral<"labels">;
}, "strict", z.ZodTypeAny, {
any: string[];
screen: "labels";
}, {
any: string[];
screen: "labels";
}>, z.ZodObject<{
any: z.ZodArray<z.ZodString, "many">;
screen: z.ZodLiteral<"words">;
}, "strict", z.ZodTypeAny, {
any: string[];
screen: "words";
}, {
any: string[];
screen: "words";
}>, z.ZodObject<{
bots: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
ids: z.ZodArray<z.ZodString, "many">;
screen: z.ZodLiteral<"allow">;
}, "strict", z.ZodTypeAny, {
bots?: string[];
ids: string[];
screen: "allow";
}, {
bots?: string[];
ids: string[];
screen: "allow";
}>, z.ZodObject<{
name: z.ZodString;
screen: z.ZodLiteral<"custom">;
}, "strict", z.ZodTypeAny, {
name: string;
screen: "custom";
}, {
name: string;
screen: "custom";
}>, z.ZodObject<{
screen: z.ZodLiteral<"interest">;
}, "strict", z.ZodTypeAny, {
screen: "interest";
}, {
screen: "interest";
}>]>, "many">>;
thread: z.ZodString;
unmatched: z.ZodOptional<z.ZodLiteral<true>>;
}, "strict", z.ZodTypeAny, {
everyMinutes?: number;
interest: string;
kinds?: string[];
outsiders?: true;
provider: string;
screens?: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: string[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
thread: string;
unmatched?: true;
}, {
everyMinutes?: number;
interest: string;
kinds?: string[];
outsiders?: true;
provider: string;
screens?: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: string[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
thread: string;
unmatched?: true;
}>;

What subscribe takes: the tool's input.


SUBSCRIPTION_CURSORS_PATTERN​

const SUBSCRIPTION_CURSORS_PATTERN: "workforce/subscription-cursors/*" = "workforce/subscription-cursors/*";

One cursor per subscription, at user scope: the versions it has seen, and its cap's count. Pinned: persisted.


SUBSCRIPTION_INDEX_PATTERN​

const SUBSCRIPTION_INDEX_PATTERN: "workforce/subscription-index/*" = "workforce/subscription-index/*";

The thread index, at org scope: one row per thread key, naming the subscriptions that follow it. It nominates; it grants nothing. Pinned: persisted. Server-only.


subscriptionCursorSchema​

const subscriptionCursorSchema: z.ZodObject<{
held: z.ZodDefault<z.ZodNumber>;
inFlight: z.ZodDefault<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodNumber, z.ZodNumber], null>, "many">>;
screened: z.ZodDefault<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodNumber, z.ZodNumber], null>, "many">>;
seen: z.ZodDefault<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodNumber], null>, "many">>;
window: z.ZodDefault<z.ZodObject<{
sent: z.ZodNumber;
start: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
sent: number;
start: number;
}, {
sent: number;
start: number;
}>>;
}, "strip", z.ZodTypeAny, {
held: number;
inFlight: [string, number, number][];
screened: [string, number, number][];
seen: [string, number][];
window: {
sent: number;
start: number;
};
}, {
held?: number;
inFlight?: [string, number, number][];
screened?: [string, number, number][];
seen?: [string, number][];
window?: {
sent: number;
start: number;
};
}>;

One subscription's delivery state.


subscriptionResources​

const subscriptionResources: object;

The flow resources a flow that subscribes, delivers or ends subscriptions declares.

Type Declaration​

workforceSubscriptionCursors​
readonly workforceSubscriptionCursors: object & ResourceCollectionConfig & object;
Type Declaration​
flowIsolation​
readonly flowIsolation: false;
pattern​
readonly pattern: "workforce/subscription-cursors/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: z.ZodObject<{
held: z.ZodDefault<z.ZodNumber>;
inFlight: z.ZodDefault<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodNumber, z.ZodNumber], null>, "many">>;
screened: z.ZodDefault<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodNumber, z.ZodNumber], null>, "many">>;
seen: z.ZodDefault<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodNumber], null>, "many">>;
window: z.ZodDefault<z.ZodObject<{
sent: z.ZodNumber;
start: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
sent: number;
start: number;
}, {
sent: number;
start: number;
}>>;
}, "strip", z.ZodTypeAny, {
held: number;
inFlight: [string, number, number][];
screened: [string, number, number][];
seen: [string, number][];
window: {
sent: number;
start: number;
};
}, {
held?: number;
inFlight?: [string, number, number][];
screened?: [string, number, number][];
seen?: [string, number][];
window?: {
sent: number;
start: number;
};
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.held​
held: number;
ClientType.inFlight​
inFlight: [string, number, number][];
ClientType.screened​
screened: [string, number, number][];
ClientType.seen​
seen: [string, number][];
ClientType.window​
window: object;
ClientType.window.sent​
sent: number;
ClientType.window.start​
start: number;
StateType​
StateType: object;
StateType.held​
held: number;
StateType.inFlight​
inFlight: [string, number, number][];
StateType.screened​
screened: [string, number, number][];
StateType.seen​
seen: [string, number][];
StateType.window​
window: object;
StateType.window.sent​
sent: number;
StateType.window.start​
start: number;
workforceSubscriptionIndex​
readonly workforceSubscriptionIndex: object & ResourceCollectionConfig & object;
Type Declaration​
flowIsolation​
readonly flowIsolation: false;
pattern​
readonly pattern: "workforce/subscription-index/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "org";
stateSchema​
readonly stateSchema: z.ZodObject<{
subscriptions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<object & object, "strip", z.ZodTypeAny, {
botsScreenedBy?: string;
followRev?: 2;
hearsClose?: true;
hostScreens?: ...[];
interest?: string;
kinds?: ...[];
orgId: string;
outsiders?: true;
provider: string;
screens: ...[];
self?: string;
tenantId?: string;
thread: string;
unmatched?: true;
userId: string;
}, {
botsScreenedBy?: string;
followRev?: 2;
hearsClose?: true;
hostScreens?: ...[];
interest?: string;
kinds?: ...[];
orgId: string;
outsiders?: true;
provider: string;
screens?: ...[];
self?: string;
tenantId?: string;
thread: string;
unmatched?: true;
userId: string;
}>>>;
}, "strip", z.ZodTypeAny, {
subscriptions: Record<string, {
botsScreenedBy?: string;
followRev?: 2;
hearsClose?: true;
hostScreens?: (... | ... | ... | ... | ...)[];
interest?: string;
kinds?: string[];
orgId: string;
outsiders?: true;
provider: string;
screens: (
| {
any: ...;
screen: ...;
}
| {
any: ...;
screen: ...;
}
| {
bots?: ...;
ids: ...;
screen: ...;
}
| {
name: ...;
screen: ...;
}
| {
screen: ...;
})[];
self?: string;
tenantId?: string;
thread: string;
unmatched?: true;
userId: string;
}>;
}, {
subscriptions?: Record<string, {
botsScreenedBy?: string;
followRev?: 2;
hearsClose?: true;
hostScreens?: ...[];
interest?: string;
kinds?: string[];
orgId: string;
outsiders?: true;
provider: string;
screens?: ...[];
self?: string;
tenantId?: string;
thread: string;
unmatched?: true;
userId: string;
}>;
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.subscriptions​
subscriptions: Record<string, {
botsScreenedBy?: string;
followRev?: 2;
hearsClose?: true;
hostScreens?: (
| {
any: ...;
screen: ...;
}
| {
any: ...;
screen: ...;
}
| {
bots?: ...;
ids: ...;
screen: ...;
}
| {
name: ...;
screen: ...;
}
| {
screen: ...;
})[];
interest?: string;
kinds?: string[];
orgId: string;
outsiders?: true;
provider: string;
screens: (
| {
any: ...[];
screen: "labels";
}
| {
any: ...[];
screen: "words";
}
| {
bots?: ... | ...;
ids: ...[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
self?: string;
tenantId?: string;
thread: string;
unmatched?: true;
userId: string;
}>;
StateType​
StateType: object;
StateType.subscriptions​
subscriptions: Record<string, {
botsScreenedBy?: string;
followRev?: 2;
hearsClose?: true;
hostScreens?: (
| {
any: ...;
screen: ...;
}
| {
any: ...;
screen: ...;
}
| {
bots?: ...;
ids: ...;
screen: ...;
}
| {
name: ...;
screen: ...;
}
| {
screen: ...;
})[];
interest?: string;
kinds?: string[];
orgId: string;
outsiders?: true;
provider: string;
screens: (
| {
any: ...[];
screen: "labels";
}
| {
any: ...[];
screen: "words";
}
| {
bots?: ... | ...;
ids: ...[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
self?: string;
tenantId?: string;
thread: string;
unmatched?: true;
userId: string;
}>;
workforceSubscriptions​
readonly workforceSubscriptions: object & ResourceCollectionConfig & object;
Type Declaration​
client​
readonly client: object;
client.state​
readonly state: object;
client.state.read​
readonly read: true;
flowIsolation​
readonly flowIsolation: false;
pattern​
readonly pattern: "workforce/subscriptions/*";
prefetchMode​
readonly prefetchMode: "lazy";
runBy​
readonly runBy: object;
runBy.flow​
flow: "workforce-roster";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: z.ZodObject<object & object, "strip", z.ZodTypeAny, {
at: number;
botsScreenedBy?: string;
enabled: boolean;
endedAt?: number;
endedReason?: string;
everyMinutes?: number;
flow: string;
followRev?: 2;
hearsClose?: true;
hostScreens?: (
| {
any: ...[];
screen: "labels";
}
| {
any: ...[];
screen: "words";
}
| {
bots?: ... | ...;
ids: ...[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
id: string;
interest: string;
kinds?: string[];
madeBy?: | {
by: "user";
}
| {
by: "worker";
worker: string;
}
| {
by: "app";
entry: string;
};
orgId: string;
outsiders?: true;
provider: string;
screens: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: ...[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
self?: string;
sessionId: string;
taskId?: string;
tenantId?: string;
thread: string;
unmatched?: true;
userId: string;
worker: string;
}, {
at: number;
botsScreenedBy?: string;
enabled: boolean;
endedAt?: number;
endedReason?: string;
everyMinutes?: number;
flow: string;
followRev?: 2;
hearsClose?: true;
hostScreens?: (
| {
any: ...[];
screen: "labels";
}
| {
any: ...[];
screen: "words";
}
| {
bots?: ... | ...;
ids: ...[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
id: string;
interest: string;
kinds?: string[];
madeBy?: | {
by: "user";
}
| {
by: "worker";
worker: string;
}
| {
by: "app";
entry: string;
};
orgId: string;
outsiders?: true;
provider: string;
screens?: (
| {
any: ...[];
screen: "labels";
}
| {
any: ...[];
screen: "words";
}
| {
bots?: ... | ...;
ids: ...[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
self?: string;
sessionId: string;
taskId?: string;
tenantId?: string;
thread: string;
unmatched?: true;
userId: string;
worker: string;
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.at​
at: number;
ClientType.botsScreenedBy?​
botsScreenedBy?: string;
ClientType.enabled​
enabled: boolean;
ClientType.endedAt?​
endedAt?: number;
ClientType.endedReason?​
endedReason?: string;
ClientType.everyMinutes?​
everyMinutes?: number;
ClientType.flow​
flow: string;
ClientType.followRev?​
followRev?: 2;
ClientType.hearsClose?​
hearsClose?: true;
ClientType.hostScreens?​
hostScreens?: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: ...[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
ClientType.id​
id: string;
ClientType.interest​
interest: string;
ClientType.kinds?​
kinds?: string[];
ClientType.madeBy?​
madeBy?:
| {
by: "user";
}
| {
by: "worker";
worker: string;
}
| {
by: "app";
entry: string;
};
ClientType.orgId​
orgId: string;
ClientType.outsiders?​
outsiders?: true;
ClientType.provider​
provider: string;
ClientType.screens​
screens: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: string[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
ClientType.self?​
self?: string;
ClientType.sessionId​
sessionId: string;
ClientType.taskId?​
taskId?: string;
ClientType.tenantId?​
tenantId?: string;
ClientType.thread​
thread: string;
ClientType.unmatched?​
unmatched?: true;
ClientType.userId​
userId: string;
ClientType.worker​
worker: string;
StateType​
StateType: object;
StateType.at​
at: number;
StateType.botsScreenedBy?​
botsScreenedBy?: string;
StateType.enabled​
enabled: boolean;
StateType.endedAt?​
endedAt?: number;
StateType.endedReason?​
endedReason?: string;
StateType.everyMinutes?​
everyMinutes?: number;
StateType.flow​
flow: string;
StateType.followRev?​
followRev?: 2;
StateType.hearsClose?​
hearsClose?: true;
StateType.hostScreens?​
hostScreens?: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: ...[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
StateType.id​
id: string;
StateType.interest​
interest: string;
StateType.kinds?​
kinds?: string[];
StateType.madeBy?​
madeBy?:
| {
by: "user";
}
| {
by: "worker";
worker: string;
}
| {
by: "app";
entry: string;
};
StateType.orgId​
orgId: string;
StateType.outsiders?​
outsiders?: true;
StateType.provider​
provider: string;
StateType.screens​
screens: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: string[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
StateType.self?​
self?: string;
StateType.sessionId​
sessionId: string;
StateType.taskId?​
taskId?: string;
StateType.tenantId?​
tenantId?: string;
StateType.thread​
thread: string;
StateType.unmatched?​
unmatched?: true;
StateType.userId​
userId: string;
StateType.worker​
worker: string;
workforceSubscriptionTaskEndings​
readonly workforceSubscriptionTaskEndings: object & ResourceCollectionConfig & object;
Type Declaration​
flowIsolation​
readonly flowIsolation: false;
pattern​
readonly pattern: "workforce/subscription-task-endings/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: z.ZodObject<{
at: z.ZodNumber;
attempt: z.ZodOptional<z.ZodNumber>;
ending: z.ZodEnum<["errored", "cancelled"]>;
}, "strip", z.ZodTypeAny, {
at: number;
attempt?: number;
ending: "cancelled" | "errored";
}, {
at: number;
attempt?: number;
ending: "cancelled" | "errored";
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.at​
at: number;
ClientType.attempt?​
attempt?: number;
ClientType.ending​
ending: "cancelled" | "errored";
StateType​
StateType: object;
StateType.at​
at: number;
StateType.attempt?​
attempt?: number;
StateType.ending​
ending: "cancelled" | "errored";

subscriptionResourceStateSchema​

const subscriptionResourceStateSchema: z.ZodObject<object & object, "strip", z.ZodTypeAny, {
at: number;
botsScreenedBy?: string;
enabled: boolean;
endedAt?: number;
endedReason?: string;
everyMinutes?: number;
flow: string;
followRev?: 2;
hearsClose?: true;
hostScreens?: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: string[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
id: string;
interest: string;
kinds?: string[];
madeBy?: | {
by: "user";
}
| {
by: "worker";
worker: string;
}
| {
by: "app";
entry: string;
};
orgId: string;
outsiders?: true;
provider: string;
screens: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: string[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
self?: string;
sessionId: string;
taskId?: string;
tenantId?: string;
thread: string;
unmatched?: true;
userId: string;
worker: string;
}, {
at: number;
botsScreenedBy?: string;
enabled: boolean;
endedAt?: number;
endedReason?: string;
everyMinutes?: number;
flow: string;
followRev?: 2;
hearsClose?: true;
hostScreens?: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: string[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
id: string;
interest: string;
kinds?: string[];
madeBy?: | {
by: "user";
}
| {
by: "worker";
worker: string;
}
| {
by: "app";
entry: string;
};
orgId: string;
outsiders?: true;
provider: string;
screens?: (
| {
any: string[];
screen: "labels";
}
| {
any: string[];
screen: "words";
}
| {
bots?: string[];
ids: string[];
screen: "allow";
}
| {
name: string;
screen: "custom";
}
| {
screen: "interest";
})[];
self?: string;
sessionId: string;
taskId?: string;
tenantId?: string;
thread: string;
unmatched?: true;
userId: string;
worker: string;
}>;

One subscription. Server-written: the session, worker, task and user come from the subscribing turn, never from the tool's input.


SUBSCRIPTIONS_PATTERN​

const SUBSCRIPTIONS_PATTERN: "workforce/subscriptions/*" = "workforce/subscriptions/*";

A session's subscriptions, one row each, at user scope. Pinned: persisted.


takeFinishedTasks​

const takeFinishedTasks: BlockDefinition<z.ZodUnknown, z.ZodArray<z.ZodObject<{
ending: z.ZodEnum<["completed", "errored", "cancelled"]>;
line: z.ZodString;
taskId: z.ZodString;
worker: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
ending: "cancelled" | "completed" | "errored";
line: string;
taskId: string;
worker?: string;
}, {
ending: "cancelled" | "completed" | "errored";
line: string;
taskId: string;
worker?: string;
}>, "many">, unknown, object[]>;

Take the tasks this conversation filed whose endings haven't been heard yet (usually ones that finished while the turn ran), say each as a line under its delegate's name, and hand the lines back. Empty outside a turn a user's own message started, and when nothing finished. Input is ignored.


TASK_ID_STATE_KEY​

const TASK_ID_STATE_KEY: "taskId" = "taskId";

The session-state field that names the task a worker session was opened for: set when a conversation's board hands the task over, beside the worker and the filing conversation's filingSessionId, so the task's session is found within the conversation that filed it. Readonly, and set only by the hand-over: the installation's create check refuses a create on any other path that names it. Pinned: the criteria key findWorkerSession takes.


TASK_SCHEDULE_HANDLER​

const TASK_SCHEDULE_HANDLER: "task" = "task";

The schedule handler Workforce keeps, a row's kind: "task": a fire files an ordinary task on the board of the worker its input.filer names. Pinned: persisted on each row.


TURN_ACTIONS​

const TURN_ACTIONS: readonly string[];

The actions that run a worker session's turn block.


updateOwnWorkstreamInputSchema​

const updateOwnWorkstreamInputSchema: z.ZodObject<{
due: z.ZodOptional<z.ZodNullable<z.ZodString>>;
objectives: z.ZodOptional<z.ZodArray<z.ZodObject<{
met: z.ZodBoolean;
text: z.ZodString;
}, "strict", z.ZodTypeAny, {
met: boolean;
text: string;
}, {
met: boolean;
text: string;
}>, "many">>;
report: z.ZodOptional<z.ZodString>;
status: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
due?: string | null;
objectives?: object[];
report?: string;
status?: string;
}, {
due?: string | null;
objectives?: object[];
report?: string;
status?: string;
}>;

What the lead's tool takes: the changes, but never a title. Its workstream is the one its session leads. A workstream's name is its owner's, set at the open and changed by the owner or their project coordinator: a lead of several workstreams is handed each post with the coordinator conversation's recent lines, which name the others, and with a title to write it could put one's name on another.


updateWorkstreamInputSchema​

const updateWorkstreamInputSchema: z.ZodObject<{
due: z.ZodOptional<z.ZodNullable<z.ZodString>>;
id: z.ZodString;
objectives: z.ZodOptional<z.ZodArray<z.ZodObject<{
met: z.ZodBoolean;
text: z.ZodString;
}, "strict", z.ZodTypeAny, {
met: boolean;
text: string;
}, {
met: boolean;
text: string;
}>, "many">>;
owner: z.ZodOptional<z.ZodString>;
project: z.ZodObject<{
id: z.ZodString;
visibility: z.ZodEnum<["shared", "private"]>;
}, "strict", z.ZodTypeAny, {
id: string;
visibility: "private" | "shared";
}, {
id: string;
visibility: "private" | "shared";
}>;
report: z.ZodOptional<z.ZodString>;
status: z.ZodOptional<z.ZodString>;
title: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
due?: string | null;
id: string;
objectives?: object[];
owner?: string;
project: {
id: string;
visibility: "private" | "shared";
};
report?: string;
status?: string;
title?: string;
}, {
due?: string | null;
id: string;
objectives?: object[];
owner?: string;
project: {
id: string;
visibility: "private" | "shared";
};
report?: string;
status?: string;
title?: string;
}>;

What updating a workstream from the app takes: the entry's place (its project's address, its owner and its id), and the changes. owner defaults to the caller. Naming anyone else addresses their entry, and the store refuses the write by the owner rule.


updateWorkstreamOutputSchema​

const updateWorkstreamOutputSchema: z.ZodObject<{
workstream: z.ZodObject<object & object, "strip", z.ZodTypeAny, {
due: string | null;
id: string;
lead: string;
objectives: object[];
openedAt: string;
owner: string;
project: {
id: string;
visibility: "private" | "shared";
};
sessionId: string | null;
status: string;
title: string;
updatedAt: string;
writtenBy: {
userId: string;
workerId?: string;
};
}, {
due?: string | null;
id: string;
lead: string;
objectives?: object[];
openedAt: string;
owner: string;
project: {
id: string;
visibility: "private" | "shared";
};
sessionId?: string | null;
status?: string;
title: string;
updatedAt: string;
writtenBy: {
userId: string;
workerId?: string;
};
}>;
}, "strip", z.ZodTypeAny, {
workstream: {
due: string | null;
id: string;
lead: string;
objectives: object[];
openedAt: string;
owner: string;
project: {
id: string;
visibility: "private" | "shared";
};
sessionId: string | null;
status: string;
title: string;
updatedAt: string;
writtenBy: {
userId: string;
workerId?: string;
};
};
}, {
workstream: {
due?: string | null;
id: string;
lead: string;
objectives?: object[];
openedAt: string;
owner: string;
project: {
id: string;
visibility: "private" | "shared";
};
sessionId?: string | null;
status?: string;
title: string;
updatedAt: string;
writtenBy: {
userId: string;
workerId?: string;
};
};
}>;

What an update returns: the entry as written.


WORK_PROJECT_STATE_KEY​

const WORK_PROJECT_STATE_KEY: "workProjectId" = "workProjectId";

The session-state field that names the project a user's own conversation with a worker works in: a new session of the worker, or the worker's one default conversation. projectRef form, <visibility>/<projectId>. Written only by the SET_WORK_PROJECT_ACTION action, which checks the user is a member of the project, and declared server-owned, so no create can seed it. Not readonly: the user can set another project later, and the tasks already filed keep the one they were filed in. Never on a project coordinator's, a task's, a delegate's or a workstream lead's session, which take their project from where they were created, filed or opened.


WORKER_DISCOVER_KEY​

const WORKER_DISCOVER_KEY: "discover" = "discover";

The worker-file key, pinned.

Authored by a human in WORKER.md; renaming it later breaks files already on disk.


WORKER_ID_STATE_KEY​

const WORKER_ID_STATE_KEY: "workerId" = "workerId";

The session-state field that names a session's worker. A worker flow declares it .readonly(), so it is set when the session is created, checked there, and never changes. Pinned: persisted, and writtenBy.workerId names the same worker.


WORKER_MESSAGES_PATTERN​

const WORKER_MESSAGES_PATTERN: "workforce/messages/*" = "workforce/messages/*";

Where the rows live, one per message, at user scope. Pinned: persisted, and read by Shift Manager's Messages view.


WORKER_MESSAGES_RESOURCE​

const WORKER_MESSAGES_RESOURCE: "workforceMessages" = "workforceMessages";

The accessor a flow declares the log under.


WORKER_REFERENCES_KEY​

const WORKER_REFERENCES_KEY: "references" = "references";

The key a worker's file names its references under.

Public: a user types it, and it matches the references/ folder the documents come from. Read from here by every door, never spelled as a literal — a renamed key with a literal left behind is an access grant that silently does not apply.


WORKER_ROLES​

const WORKER_ROLES: readonly ["contributor", "manager", "coordinator"];

The roles a worker flow may declare, beside every worker's door.


WORKER_USAGE_DEFAULT_DAYS​

const WORKER_USAGE_DEFAULT_DAYS: 7 = 7;

The period the query reads when none is asked for, in days.


WORKER_USAGE_MAX_DAYS​

const WORKER_USAGE_MAX_DAYS: 90 = 90;

The longest period the query reads, in days.


WORKER_USAGE_RESOURCE​

const WORKER_USAGE_RESOURCE: "worker-usage";

Accessor key and storage prefix for the usage records.


workerInstructionsView​

const workerInstructionsView: ViewRef;

One worker's instructions, for client.view(workerInstructionsView, { id }).


workerInventoryResourceStateSchema​

const workerInventoryResourceStateSchema: z.ZodObject<{
door: z.ZodDefault<z.ZodNullable<z.ZodString>>;
doorTakesTask: z.ZodDefault<z.ZodBoolean>;
hired: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
id: z.ZodString;
incarnation: z.ZodDefault<z.ZodNullable<z.ZodString>>;
kind: z.ZodString;
name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
rules: z.ZodDefault<z.ZodBoolean>;
teamName: z.ZodDefault<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
door: string | null;
doorTakesTask: boolean;
hired: boolean | null;
id: string;
incarnation: string | null;
kind: string;
name: string | null;
rules: boolean;
teamName: string | null;
}, {
door?: string | null;
doorTakesTask?: boolean;
hired?: boolean | null;
id: string;
incarnation?: string | null;
kind: string;
name?: string | null;
rules?: boolean;
teamName?: string | null;
}>;

One registered worker: the thing a WORKER.md declared and hireWorkforce turned into a flow copy.

Closed on purpose, unlike the skills collection's passthrough schema — that one holds heterogeneous entries (manifests beside plain supporting files) and has to tolerate anything. These rows have one writer and one shape, so an unknown key is a mistake rather than a payload, and Zod's default strip drops it on the way in.

id and kind are required rather than defaulted. A row that lost them is not a thinner row, it is a row that cannot be joined, and a default of "" would hand a consumer something that looks structurally fine and matches nothing. Required means the framework's read path surfaces such a row as empty instead, which is visible.


workerMessageResourceStateSchema​

const workerMessageResourceStateSchema: z.ZodObject<{
addressedBy: z.ZodOptional<z.ZodEnum<["task", "session"]>>;
answeredBy: z.ZodOptional<z.ZodString>;
at: z.ZodNumber;
chain: z.ZodOptional<z.ZodString>;
deadlineAt: z.ZodOptional<z.ZodNumber>;
deliveredAs: z.ZodOptional<z.ZodString>;
deliveredAt: z.ZodOptional<z.ZodNumber>;
exchange: z.ZodString;
forward: z.ZodOptional<z.ZodObject<{
as: z.ZodEnum<["addressed", "inferred"]>;
url: z.ZodString;
}, "strict", z.ZodTypeAny, {
as: "addressed" | "inferred";
url: string;
}, {
as: "addressed" | "inferred";
url: string;
}>>;
from: z.ZodString;
fromFlow: z.ZodString;
fromSession: z.ZodString;
hop: z.ZodNumber;
id: z.ZodString;
inReplyTo: z.ZodOptional<z.ZodString>;
noAnswer: z.ZodOptional<z.ZodLiteral<true>>;
queuedBehind: z.ZodOptional<z.ZodLiteral<"user">>;
reason: z.ZodOptional<z.ZodString>;
replyRequested: z.ZodOptional<z.ZodLiteral<true>>;
resent: z.ZodOptional<z.ZodObject<{
at: z.ZodNumber;
n: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
at: number;
n: number;
}, {
at: number;
n: number;
}>>;
status: z.ZodEnum<["unconfirmed", "delivered", "refused", "undeliverable"]>;
takenBy: z.ZodOptional<z.ZodString>;
text: z.ZodString;
to: z.ZodString;
toFlow: z.ZodString;
toldAt: z.ZodOptional<z.ZodNumber>;
toSession: z.ZodString;
toState: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
toTask: z.ZodOptional<z.ZodString>;
waitEndedAt: z.ZodOptional<z.ZodNumber>;
waitGate: z.ZodOptional<z.ZodObject<{
gateId: z.ZodString;
requestId: z.ZodString;
}, "strip", z.ZodTypeAny, {
gateId: string;
requestId: string;
}, {
gateId: string;
requestId: string;
}>>;
}, "strip", z.ZodTypeAny, {
addressedBy?: "session" | "task";
answeredBy?: string;
at: number;
chain?: string;
deadlineAt?: number;
deliveredAs?: string;
deliveredAt?: number;
exchange: string;
forward?: {
as: "addressed" | "inferred";
url: string;
};
from: string;
fromFlow: string;
fromSession: string;
hop: number;
id: string;
inReplyTo?: string;
noAnswer?: true;
queuedBehind?: "user";
reason?: string;
replyRequested?: true;
resent?: {
at: number;
n: number;
};
status: "delivered" | "refused" | "unconfirmed" | "undeliverable";
takenBy?: string;
text: string;
to: string;
toFlow: string;
toldAt?: number;
toSession: string;
toState?: Record<string, string>;
toTask?: string;
waitEndedAt?: number;
waitGate?: {
gateId: string;
requestId: string;
};
}, {
addressedBy?: "session" | "task";
answeredBy?: string;
at: number;
chain?: string;
deadlineAt?: number;
deliveredAs?: string;
deliveredAt?: number;
exchange: string;
forward?: {
as: "addressed" | "inferred";
url: string;
};
from: string;
fromFlow: string;
fromSession: string;
hop: number;
id: string;
inReplyTo?: string;
noAnswer?: true;
queuedBehind?: "user";
reason?: string;
replyRequested?: true;
resent?: {
at: number;
n: number;
};
status: "delivered" | "refused" | "unconfirmed" | "undeliverable";
takenBy?: string;
text: string;
to: string;
toFlow: string;
toldAt?: number;
toSession: string;
toState?: Record<string, string>;
toTask?: string;
waitEndedAt?: number;
waitGate?: {
gateId: string;
requestId: string;
};
}>;

One message.


workerMessagesCollection​

const workerMessagesCollection: object & ResourceCollectionConfig & object;

The log, at workforce/messages/* in the user's scope. Shared across flows: a message runs between whatever flows its two workers run on, and the roster flow declares it so an app reads it.

Type Declaration​

client​
readonly client: object;
client.state​
readonly state: object;
client.state.read​
readonly read: true;
flowIsolation​
readonly flowIsolation: false;
indexes​
readonly indexes: object;
indexes.inReplyTo​
readonly inReplyTo: (_key, message) => any;
Parameters​
_key​

string

message​

any

Returns​

any

indexes.open​
readonly open: (_key, message) => any[] | null;
Parameters​
_key​

string

message​

any

Returns​

any[] | null

pattern​
readonly pattern: "workforce/messages/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: z.ZodObject<{
addressedBy: z.ZodOptional<z.ZodEnum<["task", "session"]>>;
answeredBy: z.ZodOptional<z.ZodString>;
at: z.ZodNumber;
chain: z.ZodOptional<z.ZodString>;
deadlineAt: z.ZodOptional<z.ZodNumber>;
deliveredAs: z.ZodOptional<z.ZodString>;
deliveredAt: z.ZodOptional<z.ZodNumber>;
exchange: z.ZodString;
forward: z.ZodOptional<z.ZodObject<{
as: z.ZodEnum<["addressed", "inferred"]>;
url: z.ZodString;
}, "strict", z.ZodTypeAny, {
as: "addressed" | "inferred";
url: string;
}, {
as: "addressed" | "inferred";
url: string;
}>>;
from: z.ZodString;
fromFlow: z.ZodString;
fromSession: z.ZodString;
hop: z.ZodNumber;
id: z.ZodString;
inReplyTo: z.ZodOptional<z.ZodString>;
noAnswer: z.ZodOptional<z.ZodLiteral<true>>;
queuedBehind: z.ZodOptional<z.ZodLiteral<"user">>;
reason: z.ZodOptional<z.ZodString>;
replyRequested: z.ZodOptional<z.ZodLiteral<true>>;
resent: z.ZodOptional<z.ZodObject<{
at: z.ZodNumber;
n: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
at: number;
n: number;
}, {
at: number;
n: number;
}>>;
status: z.ZodEnum<["unconfirmed", "delivered", "refused", "undeliverable"]>;
takenBy: z.ZodOptional<z.ZodString>;
text: z.ZodString;
to: z.ZodString;
toFlow: z.ZodString;
toldAt: z.ZodOptional<z.ZodNumber>;
toSession: z.ZodString;
toState: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
toTask: z.ZodOptional<z.ZodString>;
waitEndedAt: z.ZodOptional<z.ZodNumber>;
waitGate: z.ZodOptional<z.ZodObject<{
gateId: z.ZodString;
requestId: z.ZodString;
}, "strip", z.ZodTypeAny, {
gateId: string;
requestId: string;
}, {
gateId: string;
requestId: string;
}>>;
}, "strip", z.ZodTypeAny, {
addressedBy?: "session" | "task";
answeredBy?: string;
at: number;
chain?: string;
deadlineAt?: number;
deliveredAs?: string;
deliveredAt?: number;
exchange: string;
forward?: {
as: "addressed" | "inferred";
url: string;
};
from: string;
fromFlow: string;
fromSession: string;
hop: number;
id: string;
inReplyTo?: string;
noAnswer?: true;
queuedBehind?: "user";
reason?: string;
replyRequested?: true;
resent?: {
at: number;
n: number;
};
status: "delivered" | "refused" | "unconfirmed" | "undeliverable";
takenBy?: string;
text: string;
to: string;
toFlow: string;
toldAt?: number;
toSession: string;
toState?: Record<string, string>;
toTask?: string;
waitEndedAt?: number;
waitGate?: {
gateId: string;
requestId: string;
};
}, {
addressedBy?: "session" | "task";
answeredBy?: string;
at: number;
chain?: string;
deadlineAt?: number;
deliveredAs?: string;
deliveredAt?: number;
exchange: string;
forward?: {
as: "addressed" | "inferred";
url: string;
};
from: string;
fromFlow: string;
fromSession: string;
hop: number;
id: string;
inReplyTo?: string;
noAnswer?: true;
queuedBehind?: "user";
reason?: string;
replyRequested?: true;
resent?: {
at: number;
n: number;
};
status: "delivered" | "refused" | "unconfirmed" | "undeliverable";
takenBy?: string;
text: string;
to: string;
toFlow: string;
toldAt?: number;
toSession: string;
toState?: Record<string, string>;
toTask?: string;
waitEndedAt?: number;
waitGate?: {
gateId: string;
requestId: string;
};
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.addressedBy?​
addressedBy?: "session" | "task";
ClientType.answeredBy?​
answeredBy?: string;
ClientType.at​
at: number;
ClientType.chain?​
chain?: string;
ClientType.deadlineAt?​
deadlineAt?: number;
ClientType.deliveredAs?​
deliveredAs?: string;
ClientType.deliveredAt?​
deliveredAt?: number;
ClientType.exchange​
exchange: string;
ClientType.forward?​
forward?: object;
ClientType.forward.as​
as: "addressed" | "inferred";
ClientType.forward.url​
url: string;
ClientType.from​
from: string;
ClientType.fromFlow​
fromFlow: string;
ClientType.fromSession​
fromSession: string;
ClientType.hop​
hop: number;
ClientType.id​
id: string;
ClientType.inReplyTo?​
inReplyTo?: string;
ClientType.noAnswer?​
noAnswer?: true;
ClientType.queuedBehind?​
queuedBehind?: "user";
ClientType.reason?​
reason?: string;
ClientType.replyRequested?​
replyRequested?: true;
ClientType.resent?​
resent?: object;
ClientType.resent.at​
at: number;
ClientType.resent.n​
n: number;
ClientType.status​
status: "delivered" | "refused" | "unconfirmed" | "undeliverable";
ClientType.takenBy?​
takenBy?: string;
ClientType.text​
text: string;
ClientType.to​
to: string;
ClientType.toFlow​
toFlow: string;
ClientType.toldAt?​
toldAt?: number;
ClientType.toSession​
toSession: string;
ClientType.toState?​
toState?: Record<string, string>;
ClientType.toTask?​
toTask?: string;
ClientType.waitEndedAt?​
waitEndedAt?: number;
ClientType.waitGate?​
waitGate?: object;
ClientType.waitGate.gateId​
gateId: string;
ClientType.waitGate.requestId​
requestId: string;
StateType​
StateType: object;
StateType.addressedBy?​
addressedBy?: "session" | "task";
StateType.answeredBy?​
answeredBy?: string;
StateType.at​
at: number;
StateType.chain?​
chain?: string;
StateType.deadlineAt?​
deadlineAt?: number;
StateType.deliveredAs?​
deliveredAs?: string;
StateType.deliveredAt?​
deliveredAt?: number;
StateType.exchange​
exchange: string;
StateType.forward?​
forward?: object;
StateType.forward.as​
as: "addressed" | "inferred";
StateType.forward.url​
url: string;
StateType.from​
from: string;
StateType.fromFlow​
fromFlow: string;
StateType.fromSession​
fromSession: string;
StateType.hop​
hop: number;
StateType.id​
id: string;
StateType.inReplyTo?​
inReplyTo?: string;
StateType.noAnswer?​
noAnswer?: true;
StateType.queuedBehind?​
queuedBehind?: "user";
StateType.reason?​
reason?: string;
StateType.replyRequested?​
replyRequested?: true;
StateType.resent?​
resent?: object;
StateType.resent.at​
at: number;
StateType.resent.n​
n: number;
StateType.status​
status: "delivered" | "refused" | "unconfirmed" | "undeliverable";
StateType.takenBy?​
takenBy?: string;
StateType.text​
text: string;
StateType.to​
to: string;
StateType.toFlow​
toFlow: string;
StateType.toldAt?​
toldAt?: number;
StateType.toSession​
toSession: string;
StateType.toState?​
toState?: Record<string, string>;
StateType.toTask?​
toTask?: string;
StateType.waitEndedAt?​
waitEndedAt?: number;
StateType.waitGate?​
waitGate?: object;
StateType.waitGate.gateId​
gateId: string;
StateType.waitGate.requestId​
requestId: string;

workerMessagesResources​

const workerMessagesResources: object;

The flow resources that install the log and the chain rows.

Type Declaration​

workforceMessageChains​
readonly workforceMessageChains: object & ResourceCollectionConfig & object;
Type Declaration​
flowIsolation​
readonly flowIsolation: false;
pattern​
readonly pattern: "workforce/message-chains/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: z.ZodObject<{
sent: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
}, "strip", z.ZodTypeAny, {
sent: string[];
}, {
sent?: string[];
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.sent​
sent: string[];
StateType​
StateType: object;
StateType.sent​
sent: string[];
workforceMessages​
readonly workforceMessages: object & ResourceCollectionConfig & object;
Type Declaration​
client​
readonly client: object;
client.state​
readonly state: object;
client.state.read​
readonly read: true;
flowIsolation​
readonly flowIsolation: false;
indexes​
readonly indexes: object;
indexes.inReplyTo​
readonly inReplyTo: (_key, message) => any;
Parameters​
_key​

string

message​

any

Returns​

any

indexes.open​
readonly open: (_key, message) => any[] | null;
Parameters​
_key​

string

message​

any

Returns​

any[] | null

pattern​
readonly pattern: "workforce/messages/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: z.ZodObject<{
addressedBy: z.ZodOptional<z.ZodEnum<["task", "session"]>>;
answeredBy: z.ZodOptional<z.ZodString>;
at: z.ZodNumber;
chain: z.ZodOptional<z.ZodString>;
deadlineAt: z.ZodOptional<z.ZodNumber>;
deliveredAs: z.ZodOptional<z.ZodString>;
deliveredAt: z.ZodOptional<z.ZodNumber>;
exchange: z.ZodString;
forward: z.ZodOptional<z.ZodObject<{
as: z.ZodEnum<["addressed", "inferred"]>;
url: z.ZodString;
}, "strict", z.ZodTypeAny, {
as: "addressed" | "inferred";
url: string;
}, {
as: "addressed" | "inferred";
url: string;
}>>;
from: z.ZodString;
fromFlow: z.ZodString;
fromSession: z.ZodString;
hop: z.ZodNumber;
id: z.ZodString;
inReplyTo: z.ZodOptional<z.ZodString>;
noAnswer: z.ZodOptional<z.ZodLiteral<true>>;
queuedBehind: z.ZodOptional<z.ZodLiteral<"user">>;
reason: z.ZodOptional<z.ZodString>;
replyRequested: z.ZodOptional<z.ZodLiteral<true>>;
resent: z.ZodOptional<z.ZodObject<{
at: z.ZodNumber;
n: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
at: number;
n: number;
}, {
at: number;
n: number;
}>>;
status: z.ZodEnum<["unconfirmed", "delivered", "refused", "undeliverable"]>;
takenBy: z.ZodOptional<z.ZodString>;
text: z.ZodString;
to: z.ZodString;
toFlow: z.ZodString;
toldAt: z.ZodOptional<z.ZodNumber>;
toSession: z.ZodString;
toState: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
toTask: z.ZodOptional<z.ZodString>;
waitEndedAt: z.ZodOptional<z.ZodNumber>;
waitGate: z.ZodOptional<z.ZodObject<{
gateId: z.ZodString;
requestId: z.ZodString;
}, "strip", z.ZodTypeAny, {
gateId: string;
requestId: string;
}, {
gateId: string;
requestId: string;
}>>;
}, "strip", z.ZodTypeAny, {
addressedBy?: "session" | "task";
answeredBy?: string;
at: number;
chain?: string;
deadlineAt?: number;
deliveredAs?: string;
deliveredAt?: number;
exchange: string;
forward?: {
as: "addressed" | "inferred";
url: string;
};
from: string;
fromFlow: string;
fromSession: string;
hop: number;
id: string;
inReplyTo?: string;
noAnswer?: true;
queuedBehind?: "user";
reason?: string;
replyRequested?: true;
resent?: {
at: number;
n: number;
};
status: "delivered" | "refused" | "unconfirmed" | "undeliverable";
takenBy?: string;
text: string;
to: string;
toFlow: string;
toldAt?: number;
toSession: string;
toState?: Record<string, string>;
toTask?: string;
waitEndedAt?: number;
waitGate?: {
gateId: string;
requestId: string;
};
}, {
addressedBy?: "session" | "task";
answeredBy?: string;
at: number;
chain?: string;
deadlineAt?: number;
deliveredAs?: string;
deliveredAt?: number;
exchange: string;
forward?: {
as: "addressed" | "inferred";
url: string;
};
from: string;
fromFlow: string;
fromSession: string;
hop: number;
id: string;
inReplyTo?: string;
noAnswer?: true;
queuedBehind?: "user";
reason?: string;
replyRequested?: true;
resent?: {
at: number;
n: number;
};
status: "delivered" | "refused" | "unconfirmed" | "undeliverable";
takenBy?: string;
text: string;
to: string;
toFlow: string;
toldAt?: number;
toSession: string;
toState?: Record<string, string>;
toTask?: string;
waitEndedAt?: number;
waitGate?: {
gateId: string;
requestId: string;
};
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.addressedBy?​
addressedBy?: "session" | "task";
ClientType.answeredBy?​
answeredBy?: string;
ClientType.at​
at: number;
ClientType.chain?​
chain?: string;
ClientType.deadlineAt?​
deadlineAt?: number;
ClientType.deliveredAs?​
deliveredAs?: string;
ClientType.deliveredAt?​
deliveredAt?: number;
ClientType.exchange​
exchange: string;
ClientType.forward?​
forward?: object;
ClientType.forward.as​
as: "addressed" | "inferred";
ClientType.forward.url​
url: string;
ClientType.from​
from: string;
ClientType.fromFlow​
fromFlow: string;
ClientType.fromSession​
fromSession: string;
ClientType.hop​
hop: number;
ClientType.id​
id: string;
ClientType.inReplyTo?​
inReplyTo?: string;
ClientType.noAnswer?​
noAnswer?: true;
ClientType.queuedBehind?​
queuedBehind?: "user";
ClientType.reason?​
reason?: string;
ClientType.replyRequested?​
replyRequested?: true;
ClientType.resent?​
resent?: object;
ClientType.resent.at​
at: number;
ClientType.resent.n​
n: number;
ClientType.status​
status: "delivered" | "refused" | "unconfirmed" | "undeliverable";
ClientType.takenBy?​
takenBy?: string;
ClientType.text​
text: string;
ClientType.to​
to: string;
ClientType.toFlow​
toFlow: string;
ClientType.toldAt?​
toldAt?: number;
ClientType.toSession​
toSession: string;
ClientType.toState?​
toState?: Record<string, string>;
ClientType.toTask?​
toTask?: string;
ClientType.waitEndedAt?​
waitEndedAt?: number;
ClientType.waitGate?​
waitGate?: object;
ClientType.waitGate.gateId​
gateId: string;
ClientType.waitGate.requestId​
requestId: string;
StateType​
StateType: object;
StateType.addressedBy?​
addressedBy?: "session" | "task";
StateType.answeredBy?​
answeredBy?: string;
StateType.at​
at: number;
StateType.chain?​
chain?: string;
StateType.deadlineAt?​
deadlineAt?: number;
StateType.deliveredAs?​
deliveredAs?: string;
StateType.deliveredAt?​
deliveredAt?: number;
StateType.exchange​
exchange: string;
StateType.forward?​
forward?: object;
StateType.forward.as​
as: "addressed" | "inferred";
StateType.forward.url​
url: string;
StateType.from​
from: string;
StateType.fromFlow​
fromFlow: string;
StateType.fromSession​
fromSession: string;
StateType.hop​
hop: number;
StateType.id​
id: string;
StateType.inReplyTo?​
inReplyTo?: string;
StateType.noAnswer?​
noAnswer?: true;
StateType.queuedBehind?​
queuedBehind?: "user";
StateType.reason?​
reason?: string;
StateType.replyRequested?​
replyRequested?: true;
StateType.resent?​
resent?: object;
StateType.resent.at​
at: number;
StateType.resent.n​
n: number;
StateType.status​
status: "delivered" | "refused" | "unconfirmed" | "undeliverable";
StateType.takenBy?​
takenBy?: string;
StateType.text​
text: string;
StateType.to​
to: string;
StateType.toFlow​
toFlow: string;
StateType.toldAt?​
toldAt?: number;
StateType.toSession​
toSession: string;
StateType.toState?​
toState?: Record<string, string>;
StateType.toTask?​
toTask?: string;
StateType.waitEndedAt?​
waitEndedAt?: number;
StateType.waitGate?​
waitGate?: object;
StateType.waitGate.gateId​
gateId: string;
StateType.waitGate.requestId​
requestId: string;

workerMessagesViewRef​

const workerMessagesViewRef: () => ViewRef;

A worker's open messages, and the rows and answers of the messages on screen: useView(workerMessagesViewRef(), { worker, ids }).

Returns​

ViewRef


workerPackageSchema​

const workerPackageSchema: z.ZodObject<{
instructions: z.ZodOptional<z.ZodString>;
name: z.ZodString;
path: z.ZodString;
tools: z.ZodArray<z.ZodType<BlockDefinition<any, any, any, any>, z.ZodTypeDef, BlockDefinition<any, any, any, any>>, "many">;
}, "strict", z.ZodTypeAny, {
instructions?: string;
name: string;
path: string;
tools: BlockDefinition<any, any, any, any>[];
}, {
instructions?: string;
name: string;
path: string;
tools: BlockDefinition<any, any, any, any>[];
}>;

One held package as it rides into the bag. Structural, like workerSkillSchema: the hire built it from records the loader already validated.


workerResourceStateSchema​

const workerResourceStateSchema: z.ZodObject<{
additionalInstructions: z.ZodDefault<z.ZodNullable<z.ZodString>>;
description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
flow: z.ZodString;
forkedFrom: z.ZodDefault<z.ZodNullable<z.ZodString>>;
instructions: z.ZodDefault<z.ZodNullable<z.ZodString>>;
name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
settings: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
skills: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
teamInstructions: z.ZodDefault<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
additionalInstructions: string | null;
description: string | null;
flow: string;
forkedFrom: string | null;
instructions: string | null;
name: string | null;
settings: Record<string, unknown>;
skills: string[];
teamInstructions: string | null;
}, {
additionalInstructions?: string | null;
description?: string | null;
flow: string;
forkedFrom?: string | null;
instructions?: string | null;
name?: string | null;
settings?: Record<string, unknown>;
skills?: string[];
teamInstructions?: string | null;
}>;

One stored worker.

settings passes keys through: it belongs to the worker's flow, whose own configSchema checks it, and it is free to grow keys this package has never heard of. The envelope is this package's.


WORKERS_PATTERN​

const WORKERS_PATTERN: "workforce/workers/*" = "workforce/workers/*";

Where a user's own workers are stored, one row per worker, at user scope (per organization). Pinned: persisted, and read elsewhere.


WORKERS_RESOURCE​

const WORKERS_RESOURCE: "workforceWorkers" = "workforceWorkers";

The accessor a flow declares the user's worker collection under. A worker flow's create check reads the creating user's row through it, and a turn loads the session's worker through it.


workerSessionsViewRef​

const workerSessionsViewRef: () => ViewRef;

A user's conversations with a worker: useView(workerSessionsViewRef(), { worker }).

Returns​

ViewRef


workerSkillSchema​

const workerSkillSchema: z.ZodObject<{
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
content: z.ZodString;
path: z.ZodString;
}, "strict", z.ZodTypeAny, {
content: string;
path: string;
}, {
content: string;
path: string;
}>, "many">>;
name: z.ZodString;
skillMd: z.ZodString;
}, "strict", z.ZodTypeAny, {
files?: object[];
name: string;
skillMd: string;
}, {
files?: object[];
name: string;
skillMd: string;
}>;

One skill as it rides into the bag.

Structural, not a second parser: the loader has already parsed every SKILL.md that reaches here, so this checks the SHAPE arrived intact (a hand-built roster is the case it catches) and leaves the contents to the seeder, which parses them again where a parse failure can be reported per skill.

Declared here rather than privately inside the built-in agent worker flow, which is where it used to sit: every hireable worker flow now receives this shape, so a copy per flow would be the two-spellings bug again.


workerSpendHook​

const workerSpendHook: SessionRequestEndHook;

The request-end hook a worker flow's session installs: when a request ends, its spend is added to the record of the worker its session names. A session that names no worker writes nothing. A failed write is logged and never fails the request. A flow without the collection fails loudly in development and warns in production.


workerUsageCollection​

const workerUsageCollection: object & ResourceCollectionConfig & object;

The collection, which every worker flow installs through installation.resources. llmWritable: false: recordWorkerSpend is its only writer. Not client-readable: the query is the read path.

Type Declaration​

flowIsolation​
readonly flowIsolation: false;
llmWritable​
readonly llmWritable: false;
pattern​
readonly pattern: "worker-usage/**";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: z.ZodObject<{
day: z.ZodDefault<z.ZodString>;
sources: z.ZodDefault<z.ZodArray<z.ZodObject<{
billing: z.ZodDefault<z.ZodNullable<z.ZodEnum<...>>>;
costUsd: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
inputTokens: z.ZodDefault<z.ZodNumber>;
kind: z.ZodEnum<["model", "harness"]>;
outputTokens: z.ZodDefault<z.ZodNumber>;
runs: z.ZodDefault<z.ZodNumber>;
source: z.ZodString;
unreported: z.ZodDefault<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
billing: "api-key" | "subscription" | null;
costUsd: number | null;
inputTokens: number;
kind: "harness" | "model";
outputTokens: number;
runs: number;
source: string;
unreported: number;
}, {
billing?: "api-key" | "subscription" | null;
costUsd?: number | null;
inputTokens?: number;
kind: "harness" | "model";
outputTokens?: number;
runs?: number;
source: string;
unreported?: number;
}>, "many">>;
worker: z.ZodDefault<z.ZodString>;
}, "strip", z.ZodTypeAny, {
day: string;
sources: object[];
worker: string;
}, {
day?: string;
sources?: object[];
worker?: string;
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.day​
day: string;
ClientType.sources​
sources: object[];
ClientType.worker​
worker: string;
StateType​
StateType: object;
StateType.day​
day: string;
StateType.sources​
sources: object[];
StateType.worker​
worker: string;

workerUsageStateSchema​

const workerUsageStateSchema: z.ZodObject<{
day: z.ZodDefault<z.ZodString>;
sources: z.ZodDefault<z.ZodArray<z.ZodObject<{
billing: z.ZodDefault<z.ZodNullable<z.ZodEnum<["api-key", "subscription"]>>>;
costUsd: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
inputTokens: z.ZodDefault<z.ZodNumber>;
kind: z.ZodEnum<["model", "harness"]>;
outputTokens: z.ZodDefault<z.ZodNumber>;
runs: z.ZodDefault<z.ZodNumber>;
source: z.ZodString;
unreported: z.ZodDefault<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
billing: "api-key" | "subscription" | null;
costUsd: number | null;
inputTokens: number;
kind: "harness" | "model";
outputTokens: number;
runs: number;
source: string;
unreported: number;
}, {
billing?: "api-key" | "subscription" | null;
costUsd?: number | null;
inputTokens?: number;
kind: "harness" | "model";
outputTokens?: number;
runs?: number;
source: string;
unreported?: number;
}>, "many">>;
worker: z.ZodDefault<z.ZodString>;
}, "strip", z.ZodTypeAny, {
day: string;
sources: object[];
worker: string;
}, {
day?: string;
sources?: object[];
worker?: string;
}>;

One worker's record for one UTC day. Every field defaults.


workerUsageView​

const workerUsageView: ViewRef;

Each worker's usage over a period, for client.view(workerUsageView, { days }) or useView.


WORKSTREAM_DELEGATE_ACTION​

const WORKSTREAM_DELEGATE_ACTION: "changeWorkstreamDelegate" = "changeWorkstreamDelegate";

The coordinator's internal entry an entry path dispatches into the user's coordinator session, to add or remove one workstream's record. Pinned: the workstream writes name it.


WORKSTREAM_RESOURCES​

const WORKSTREAM_RESOURCES: object;

Both declarations, as one resource map a block or a flow spreads into its resources.

Type Declaration​

privateWorkstreams​
readonly privateWorkstreams: ResourceCollectionConfig & object & ResourceCollectionConfig & object;
Type Declaration​
stateSchema​
stateSchema: z.ZodTypeAny;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: any;
StateType​
StateType: any;
workstreams​
readonly workstreams: ResourceCollectionConfig & object & ResourceCollectionConfig & object;
Type Declaration​
stateSchema​
stateSchema: z.ZodTypeAny;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: any;
StateType​
StateType: any;

WORKSTREAM_STATUS_MAX_LENGTH​

const WORKSTREAM_STATUS_MAX_LENGTH: 80 = 80;

The longest status label an entry takes, in characters.


workstreamAddressSchema​

const workstreamAddressSchema: z.ZodObject<{
id: z.ZodString;
project: z.ZodObject<{
id: z.ZodString;
visibility: z.ZodEnum<["shared", "private"]>;
}, "strict", z.ZodTypeAny, {
id: string;
visibility: "private" | "shared";
}, {
id: string;
visibility: "private" | "shared";
}>;
}, "strict", z.ZodTypeAny, {
id: string;
project: {
id: string;
visibility: "private" | "shared";
};
}, {
id: string;
project: {
id: string;
visibility: "private" | "shared";
};
}>;

A workstream's address: its project's address and its id. Its owner is the user asking, so an address only ever reaches the caller's own entry. Its one-string form is workstreamRef (workstream-ref.ts).


workstreamDelegateChangeSchema​

const workstreamDelegateChangeSchema: z.ZodObject<{
change: z.ZodEnum<["add", "remove"]>;
target: z.ZodString;
worker: z.ZodString;
}, "strict", z.ZodTypeAny, {
change: "add" | "remove";
target: string;
worker: string;
}, {
change: "add" | "remove";
target: string;
worker: string;
}>;

What a workstream's entry path hands its coordinator: the change, and the record.


workstreamDueSchema​

const workstreamDueSchema: z.ZodString;

A calendar date, YYYY-MM-DD, which sorts as text.


workstreamEntrySchema​

const workstreamEntrySchema: z.ZodObject<{
due: z.ZodDefault<z.ZodNullable<z.ZodString>>;
lead: z.ZodString;
objectives: z.ZodDefault<z.ZodArray<z.ZodObject<{
met: z.ZodDefault<z.ZodBoolean>;
metAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
metBy: z.ZodDefault<z.ZodNullable<z.ZodObject<{
userId: z.ZodString;
workerId: z.ZodOptional<...>;
}, "strict", z.ZodTypeAny, {
userId: string;
workerId?: ... | ...;
}, {
userId: string;
workerId?: ... | ...;
}>>>;
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
met: boolean;
metAt: string | null;
metBy: | {
userId: string;
workerId?: string;
}
| null;
text: string;
}, {
met?: boolean;
metAt?: string | null;
metBy?: | {
userId: string;
workerId?: string;
}
| null;
text: string;
}>, "many">>;
openedAt: z.ZodString;
sessionId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
status: z.ZodDefault<z.ZodString>;
title: z.ZodString;
updatedAt: z.ZodString;
writtenBy: z.ZodObject<{
userId: z.ZodString;
workerId: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
userId: string;
workerId?: string;
}, {
userId: string;
workerId?: string;
}>;
}, "strip", z.ZodTypeAny, {
due: string | null;
lead: string;
objectives: object[];
openedAt: string;
sessionId: string | null;
status: string;
title: string;
updatedAt: string;
writtenBy: {
userId: string;
workerId?: string;
};
}, {
due?: string | null;
lead: string;
objectives?: object[];
openedAt: string;
sessionId?: string | null;
status?: string;
title: string;
updatedAt: string;
writtenBy: {
userId: string;
workerId?: string;
};
}>;

One workstream entry, as stored. Its latest report is the entry's content.


workstreamObjectiveSchema​

const workstreamObjectiveSchema: z.ZodObject<{
met: z.ZodDefault<z.ZodBoolean>;
metAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
metBy: z.ZodDefault<z.ZodNullable<z.ZodObject<{
userId: z.ZodString;
workerId: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
userId: string;
workerId?: string;
}, {
userId: string;
workerId?: string;
}>>>;
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
met: boolean;
metAt: string | null;
metBy: | {
userId: string;
workerId?: string;
}
| null;
text: string;
}, {
met?: boolean;
metAt?: string | null;
metBy?: | {
userId: string;
workerId?: string;
}
| null;
text: string;
}>;

One objective: what it is, and whether it is met, when and by whom. metAt and metBy are set by the write that met it, from the server's clock and the session.


WORKSTREAMS_PATTERN​

const WORKSTREAMS_PATTERN: "workstreams/[project]/[owner]/[workstream]" = "workstreams/[project]/[owner]/[workstream]";

The entries' key pattern. Pinned: persisted, and read by other packages.


WORKSTREAMS_RESOURCE​

const WORKSTREAMS_RESOURCE: "workstreams" = "workstreams";

The resource-map ref of a shared project's workstream entries, at org scope.


workstreamStatusSchema​

const workstreamStatusSchema: z.ZodString;

Where a workstream stands: a short label in the owner's own words ("on-track", "waiting on legal"), trimmed, not empty, at most WORKSTREAM_STATUS_MAX_LENGTH characters. One label has a meaning, "done" (DONE_STATUS): a done workstream stays listed, is never stale and is never the next due date.


workstreamViewSchema​

const workstreamViewSchema: z.ZodObject<object & object, "strip", z.ZodTypeAny, {
due: string | null;
id: string;
lead: string;
objectives: object[];
openedAt: string;
owner: string;
project: {
id: string;
visibility: "private" | "shared";
};
sessionId: string | null;
status: string;
title: string;
updatedAt: string;
writtenBy: {
userId: string;
workerId?: string;
};
}, {
due?: string | null;
id: string;
lead: string;
objectives?: object[];
openedAt: string;
owner: string;
project: {
id: string;
visibility: "private" | "shared";
};
sessionId?: string | null;
status?: string;
title: string;
updatedAt: string;
writtenBy: {
userId: string;
workerId?: string;
};
}>;

One workstream as the project reads and writes answer it: its entry, with its project, its owner and its id.

Functions​

answerTextOf()​

function answerTextOf(output): string | undefined;

A completed task's answer, as a line the user reads: its output when that is text (an agent worker's answer), or its answer (a coder's run, whose output also carries its branch and commits). undefined when blank or absent.

Parameters​

output​

unknown

Returns​

string | undefined


backfillBoardWakes()​

function backfillBoardWakes(stores, options): Promise<number>;

Owe a wake for the board's pass in every session that holds a debt recorded before wakes existed. Returns how many sessions it owed one for.

Parameters​

stores​

BoardWakeBackfillStores

options​

BoardWakeBackfillOptions

Returns​

Promise<number>


checkedMcpServers()​

function checkedMcpServers(names, offered): string[];

Check a list of server names against the names the host offers, and return it with duplicates dropped, in first-seen order.

Parameters​

names​

readonly unknown[]

The list as a caller sent it.

offered​

readonly string[]

The names the host offers; empty when it offers none.

Returns​

string[]

Throws​

ProjectRefusedError invalid-mcp-server for a value that is not a bare name (never repeated), then unknown-mcp-server for a name the host doesn't offer, naming the ones it does.


checkTargetSession()​

function checkTargetSession(
ctx,
installation,
sessionId,
of
): Promise<TargetCheck>;

Check a session a message would land in, before anything is written.

Parameters​

ctx​

BlockContext

installation​

WorkerInstallation

sessionId​

string

of​

| { session: true; } | { ledger: TaskCollectionRef; task: string; }

What the session was reached by: a { session } as typed, or a task's session, with the ledger the task is on (its rows decide whether a coding task there still runs).

Returns​

Promise<TargetCheck>


checkTaskTarget()​

function checkTaskTarget(
ctx,
installation,
taskId
): Promise<TargetCheck>;

Resolve { task: id } to the session its run named, then check it. No row, no run link (not started, or a plan step), an id held in more than one of the user's conversations, and another user's: one refusal, no_task_session, so it says nothing of another user's tasks.

Parameters​

ctx​

BlockContext

installation​

WorkerInstallation

taskId​

string

Returns​

Promise<TargetCheck>


clearShadowedReferences()​

function clearShadowedReferences(input): Promise<ClearShadowedReferencesResult>;

Clear every stored content row shadowing a reference's file, for one org.

Idempotent: a second run over a migrated tree finds nothing and clears nothing, because the seal means no new row can appear.

Parameters​

input​

ClearShadowedReferencesInput

The references, the org, the store, and the flow they are installed on. See ClearShadowedReferencesInput.

Returns​

Promise<ClearShadowedReferencesResult>

What was checked, what was cleared, and whether it was a preview. Nothing is thrown for an absent row; that is the ordinary case.

Throws​

If the org or flow id needs the engine's bucket escaping — see the coordinate.


connectorKeyStatuses()​

function connectorKeyStatuses(
host,
cell,
offered
): Promise<ConnectorKeyStatus[]>;

Each offered connector, and when the user whose cell this is set a key for it. Read through the store directly, and only setAt leaves it: what the route's read answers, and what a host's start line can say.

Parameters​

host​

Pick<InboundTransportHost, "stores">

The engine host (or runtime) whose stores hold the keys.

cell​

string

The user's cell (resolveSharedUserCellKey).

offered​

readonly string[]

The connectors the host offers.

Returns​

Promise<ConnectorKeyStatus[]>


consultSessionsCapability()​

function consultSessionsCapability(installation, options?): DefinedCapability<"consultSessions", Record<string, never>, "default" | "consult", Record<string, PresetDef<any>>, undefined, {
privateWorkstreams: ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object;
"worker-usage": object & ResourceCollectionConfig<JsonObject> & object;
workforceScheduledFires: object & ResourceCollectionConfig<JsonObject> & object;
workforceSchedules: object & ResourceCollectionConfig<JsonObject> & object;
workforceStandardWorkers: DefinedProjectedResourceCollection<JsonObject>;
workforceSubscriptionCursors: object & ResourceCollectionConfig<JsonObject> & object;
workforceSubscriptionIndex: object & ResourceCollectionConfig<JsonObject> & object;
workforceSubscriptionPolls: object & ResourceCollectionConfig<JsonObject> & object;
workforceSubscriptions: object & ResourceCollectionConfig<JsonObject> & object;
workforceSubscriptionTaskEndings: object & ResourceCollectionConfig<JsonObject> & object;
workforceWorkers: object & ResourceCollectionConfig<JsonObject> & object;
workstreams: ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object;
}, undefined, undefined, undefined> & object;

The capability: consultSessionHistory on the turns of a worker whose own file names consultSessions: [consult].

Parameters​

installation​

WorkerInstallation

options?​

ConsultSessionsOptions

Returns​

DefinedCapability<"consultSessions", Record<string, never>, "default" | "consult", Record<string, PresetDef<any>>, undefined, { privateWorkstreams: ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object; "worker-usage": object & ResourceCollectionConfig<JsonObject> & object; workforceScheduledFires: object & ResourceCollectionConfig<JsonObject> & object; workforceSchedules: object & ResourceCollectionConfig<JsonObject> & object; workforceStandardWorkers: DefinedProjectedResourceCollection<JsonObject>; workforceSubscriptionCursors: object & ResourceCollectionConfig<JsonObject> & object; workforceSubscriptionIndex: object & ResourceCollectionConfig<JsonObject> & object; workforceSubscriptionPolls: object & ResourceCollectionConfig<JsonObject> & object; workforceSubscriptions: object & ResourceCollectionConfig<JsonObject> & object; workforceSubscriptionTaskEndings: object & ResourceCollectionConfig<JsonObject> & object; workforceWorkers: object & ResourceCollectionConfig<JsonObject> & object; workstreams: ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object; }, undefined, undefined, undefined> & object

Example​

defineAgentWorkerFlow({ installation, model, uses: [consultSessionsCapability(installation)] });
// and the app says what "cheaper" is, once:
createFlowState({ flows, stores, models: { default: model, intents: { utility: ["openai/gpt-6-luna"] } } });

conversationLedgers()​

function conversationLedgers(
ledgerId,
ctx,
partition,
taskId?
): Promise<TaskCollectionRef<unknown, unknown> | undefined>;

The ledger resolver a work entry's gate uses for a conversation's board, and the one a harness manager takes for boards it resolves per claim: the conversation ledger at partition, at the running user's scope, for the conversation the running session was opened for, or, for a worker's step filed session: "new", the plan ledger at that same partition; or, for another conversation's ledger, only when the row it names was filed for this very session (a routed task for a workstream, whose filing resolved its session: Task.targetSessionId, server-written). undefined for any other ledger, a missing partition, or any other conversation's row.

Parameters​

ledgerId​

string

The ledger the claim names.

ctx​

BlockContext

The running block's context. Its flow must declare the conversation ledger (workerTaskEntry installs it).

partition​

string | undefined

The partition the claim names.

taskId?​

string

The row the claim names.

Returns​

Promise<TaskCollectionRef<unknown, unknown> | undefined>


coordinatorConfigSchema()​

function coordinatorConfigSchema<TBase>(base?):
| ZodObject<object & object, any, any, {
[x: string]: any;
editsOwnDelegates?: unknown;
fallback?: unknown;
inferredWork?: unknown;
minConfidence?: unknown;
rounds?: unknown;
routing?: unknown;
}, {
[x: string]: any;
editsOwnDelegates?: unknown;
fallback?: unknown;
inferredWork?: unknown;
minConfidence?: unknown;
rounds?: unknown;
routing?: unknown;
}>
| ZodObject<object & object & object, "strip", ZodTypeAny, {
defaults?: | false
| {
date?: boolean;
historySummary?: boolean;
skillsIndex?: boolean;
};
delegates: string[] | "all";
editsOwnDelegates: boolean;
fallback?: string;
inferredWork: "off" | "observe" | "auto";
instructions?: string;
minConfidence?: number;
model?: string;
rounds: number;
routing: "judgment" | "best-fit" | "round-robin" | "everyone";
teamInstructions?: string;
workerId?: string;
workerPackages?: object[];
workerSkills: object[];
workerTools: BlockDefinition<any, any, any, any>[];
}, {
defaults?: | false
| {
date?: boolean;
historySummary?: boolean;
skillsIndex?: boolean;
};
delegates?: string[] | "all";
editsOwnDelegates?: boolean;
fallback?: string;
inferredWork?: "off" | "observe" | "auto";
instructions?: string;
minConfidence?: number;
model?: string;
rounds?: number;
routing?: "judgment" | "best-fit" | "round-robin" | "everyone";
teamInstructions?: string;
workerId?: string;
workerPackages?: object[];
workerSkills?: object[];
workerTools?: BlockDefinition<any, any, any, any>[];
}>;

A coordinator's configuration schema: the settings of the turn it runs plus its own. On the coordinator flow the base is the built-in agent's settings (its model, tools, skills and capabilities), since its judgment is the agent's turn; with no base, the worker contract and a model.

Type Parameters​

TBase​

TBase extends AnyZodObject

Parameters​

base?​

TBase

Returns​

| ZodObject<object & object, any, any, { [x: string]: any; editsOwnDelegates?: unknown; fallback?: unknown; inferredWork?: unknown; minConfidence?: unknown; rounds?: unknown; routing?: unknown; }, { [x: string]: any; editsOwnDelegates?: unknown; fallback?: unknown; inferredWork?: unknown; minConfidence?: unknown; rounds?: unknown; routing?: unknown; }> | ZodObject<object & object & object, "strip", ZodTypeAny, { defaults?: | false | { date?: boolean; historySummary?: boolean; skillsIndex?: boolean; }; delegates: string[] | "all"; editsOwnDelegates: boolean; fallback?: string; inferredWork: "off" | "observe" | "auto"; instructions?: string; minConfidence?: number; model?: string; rounds: number; routing: "judgment" | "best-fit" | "round-robin" | "everyone"; teamInstructions?: string; workerId?: string; workerPackages?: object[]; workerSkills: object[]; workerTools: BlockDefinition<any, any, any, any>[]; }, { defaults?: | false | { date?: boolean; historySummary?: boolean; skillsIndex?: boolean; }; delegates?: string[] | "all"; editsOwnDelegates?: boolean; fallback?: string; inferredWork?: "off" | "observe" | "auto"; instructions?: string; minConfidence?: number; model?: string; rounds?: number; routing?: "judgment" | "best-fit" | "round-robin" | "everyone"; teamInstructions?: string; workerId?: string; workerPackages?: object[]; workerSkills?: object[]; workerTools?: BlockDefinition<any, any, any, any>[]; }>


createErrorReporter()​

function createErrorReporter(options): ErrorReporter;

Create the Error Reporter.

Parameters​

options​

ErrorReporterOptions

Its worker, operator, tracker, preview and limits.

Returns​

ErrorReporter


createRoutinesCapability()​

function createRoutinesCapability(installation): DefinedCapability<"routines", Record<string, never>, "tools" | "default", Record<string, PresetDef<any>>, undefined, {
workforceScheduledFires: object & ResourceCollectionConfig<JsonObject> & object;
workforceSchedules: object & ResourceCollectionConfig<JsonObject> & object;
workforceSubscriptionCursors: object & ResourceCollectionConfig<JsonObject> & object;
workforceSubscriptionIndex: object & ResourceCollectionConfig<JsonObject> & object;
workforceSubscriptionPolls: object & ResourceCollectionConfig<JsonObject> & object;
workforceSubscriptions: object & ResourceCollectionConfig<JsonObject> & object;
workforceSubscriptionTaskEndings: object & ResourceCollectionConfig<JsonObject> & object;
}, undefined, undefined, undefined> & object;

Routines on a worker's turn, for a worker flow that names it in uses: the four routine tools, which list, save, pause and delete the routines that act through this worker. A clock routine it saves files on its own board; an event routine it saves is heard in this conversation, and by this task when it is a task's. Each lists the worker as its maker. hireWorkforce adds it to no worker on its own.

Configured once: the providers an event routine follows a thread on and the schedule index a clock routine is mirrored into are the ones hireWorkforce(installation, { routines }) was given.

Parameters​

installation​

WorkerInstallation

The installation whose hireWorkforce sets the routines.

Returns​

DefinedCapability<"routines", Record<string, never>, "tools" | "default", Record<string, PresetDef<any>>, undefined, { workforceScheduledFires: object & ResourceCollectionConfig<JsonObject> & object; workforceSchedules: object & ResourceCollectionConfig<JsonObject> & object; workforceSubscriptionCursors: object & ResourceCollectionConfig<JsonObject> & object; workforceSubscriptionIndex: object & ResourceCollectionConfig<JsonObject> & object; workforceSubscriptionPolls: object & ResourceCollectionConfig<JsonObject> & object; workforceSubscriptions: object & ResourceCollectionConfig<JsonObject> & object; workforceSubscriptionTaskEndings: object & ResourceCollectionConfig<JsonObject> & object; }, undefined, undefined, undefined> & object


createWorkerHireBlocks()​

function createWorkerHireBlocks(installation, checks?): WorkerHireBlocks;

Build the hire, fork, edit, fire and reset blocks over installation. checks adds the app's own refusals to hire and edit.

Each block declares the worker collection through the installation and reads or writes the caller's own roster.

Parameters​

installation​

WorkerInstallation

checks?​

HireChecks

Returns​

WorkerHireBlocks


createWorkerLookup()​

function createWorkerLookup(options): WorkerLookup;

Build the worker lookup over an installation.

Parameters​

options​

WorkerLookupOptions

The installation.

Returns​

WorkerLookup

find for the filing check and the wake, flowKind and state for a list's fallback.


createWorkforceCapability()​

function createWorkforceCapability(options): DefinedCapability;

Build the workforce discovery capability.

Parameters​

options​

WorkforceCapabilityOptions

The boot-resolved roster, the inventory keys, and any other domains' sources to put behind the same door.

Returns​

DefinedCapability

A capability named workforce, contributing the discover control tool and nothing else.

Throws​

when two sources claim the same domain, naming both registration sites — at construction, not at the first ambiguous read.


declaredRoutineKey()​

function declaredRoutineKey(entryId): Promise<string>;

The stored key of a declared entry: cfg_<hash of the roster flow kind and the entry id>.

Parameters​

entryId​

string

Returns​

Promise<string>


defineAgentWorkerFlow()​

function defineAgentWorkerFlow(given?): FlowType<NormalizedActions<{
addDelegate?: {
block: BlockDefinition<ZodObject<{
note: ZodOptional<ZodString>;
worker: ZodString;
}, "strict", ZodTypeAny, {
note?: string;
worker: string;
}, {
note?: string;
worker: string;
}>, ZodObject<{
delegates: ZodArray<ZodObject<... & ..., "strip", ZodTypeAny, {
note?: ...;
target?: ...;
worker: ...;
}, {
note?: ...;
target?: ...;
worker: ...;
}>, "many">;
fallback: ZodNullable<ZodObject<{
target: ...;
worker: ...;
}, "strip", ZodTypeAny, {
target?: ...;
worker: ...;
}, {
target?: ...;
worker: ...;
}>>;
filingSessionId: ZodString;
max: ZodNumber;
}, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: ... | ...;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: ... | ...;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, {
note?: string;
worker: string;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>;
description: string;
inputSchema: ZodObject<{
note: ZodOptional<ZodString>;
worker: ZodString;
}, "strict", ZodTypeAny, {
note?: string;
worker: string;
}, {
note?: string;
worker: string;
}>;
};
listDelegates?: {
block: BlockDefinition<ZodObject<{
}, "strict", ZodTypeAny, {
}, {
}>, ZodObject<object & object, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: ... | ...;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: ... | ...;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, {
}, {
delegates: (object & object)[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>;
description: string;
inputSchema: ZodObject<{
}, "strict", ZodTypeAny, {
}, {
}>;
};
removeDelegate?: {
block: BlockDefinition<ZodObject<{
worker: ZodString;
}, "strict", ZodTypeAny, {
worker: string;
}, {
worker: string;
}>, ZodObject<{
delegates: ZodArray<ZodObject<... & ..., "strip", ZodTypeAny, {
note?: ...;
target?: ...;
worker: ...;
}, {
note?: ...;
target?: ...;
worker: ...;
}>, "many">;
fallback: ZodNullable<ZodObject<{
target: ...;
worker: ...;
}, "strip", ZodTypeAny, {
target?: ...;
worker: ...;
}, {
target?: ...;
worker: ...;
}>>;
filingSessionId: ZodString;
max: ZodNumber;
}, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: ... | ...;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: ... | ...;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, {
worker: string;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>;
description: string;
inputSchema: ZodObject<{
worker: ZodString;
}, "strict", ZodTypeAny, {
worker: string;
}, {
worker: string;
}>;
};
respond: {
block: BlockDefinition<any, ZodTypeAny, any, any>;
concurrency: {
key: (ctx) => string | undefined;
policy: "hold";
};
inputSchema: ZodObject<object & object, "strip" | "strict", ZodTypeAny, {
message: string;
taskId?: string;
}, {
message: string;
taskId?: string;
}>;
taskOf: (input) => string | undefined;
userMessage: (input) => any;
};
setFallback?: {
block: BlockDefinition<ZodObject<{
worker: ZodNullable<ZodString>;
}, "strict", ZodTypeAny, {
worker: string | null;
}, {
worker: string | null;
}>, ZodObject<{
delegates: ZodArray<ZodObject<... & ..., "strip", ZodTypeAny, {
note?: ...;
target?: ...;
worker: ...;
}, {
note?: ...;
target?: ...;
worker: ...;
}>, "many">;
fallback: ZodNullable<ZodObject<{
target: ...;
worker: ...;
}, "strip", ZodTypeAny, {
target?: ...;
worker: ...;
}, {
target?: ...;
worker: ...;
}>>;
filingSessionId: ZodString;
max: ZodNumber;
}, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: ... | ...;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: ... | ...;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, {
worker: string | null;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>;
description: string;
inputSchema: ZodObject<{
worker: ZodNullable<ZodString>;
}, "strict", ZodTypeAny, {
worker: string | null;
}, {
worker: string | null;
}>;
};
setSessionFields?: {
block: BlockDefinition<ZodObject<{
fields: ZodRecord<ZodString, ZodUnknown>;
worker: ZodOptional<ZodString>;
}, "strict", ZodTypeAny, {
fields: Record<string, unknown>;
worker?: string;
}, {
fields: Record<string, unknown>;
worker?: string;
}>, ZodObject<{
fields: ZodRecord<ZodString, ZodUnknown>;
}, "strip", ZodTypeAny, {
fields: Record<string, unknown>;
}, {
fields: Record<string, unknown>;
}>, {
fields: Record<string, unknown>;
worker?: string;
}, {
fields: Record<string, unknown>;
}>;
inputSchema: ZodObject<{
fields: ZodRecord<ZodString, ZodUnknown>;
worker: ZodOptional<ZodString>;
}, "strict", ZodTypeAny, {
fields: Record<string, unknown>;
worker?: string;
}, {
fields: Record<string, unknown>;
worker?: string;
}>;
};
setWorkProject: {
block: BlockDefinition<ZodObject<{
project: ZodObject<{
id: ZodString;
visibility: ZodEnum<[..., ...]>;
}, "strict", ZodTypeAny, {
id: string;
visibility: "shared" | "private";
}, {
id: string;
visibility: "shared" | "private";
}>;
worker: ZodOptional<ZodString>;
}, "strict", ZodTypeAny, {
project: {
id: string;
visibility: "shared" | "private";
};
worker?: string;
}, {
project: {
id: string;
visibility: "shared" | "private";
};
worker?: string;
}>, ZodObject<{
project: ZodObject<{
id: ZodString;
visibility: ZodEnum<[..., ...]>;
}, "strict", ZodTypeAny, {
id: string;
visibility: "shared" | "private";
}, {
id: string;
visibility: "shared" | "private";
}>;
}, "strip", ZodTypeAny, {
project: {
id: string;
visibility: "shared" | "private";
};
}, {
project: {
id: string;
visibility: "shared" | "private";
};
}>, {
project: {
id: string;
visibility: "shared" | "private";
};
worker?: string;
}, {
project: {
id: string;
visibility: "shared" | "private";
};
}>;
inputSchema: ZodObject<{
project: ZodObject<{
id: ZodString;
visibility: ZodEnum<["shared", "private"]>;
}, "strict", ZodTypeAny, {
id: string;
visibility: "shared" | "private";
}, {
id: string;
visibility: "shared" | "private";
}>;
worker: ZodOptional<ZodString>;
}, "strict", ZodTypeAny, {
project: {
id: string;
visibility: "shared" | "private";
};
worker?: string;
}, {
project: {
id: string;
visibility: "shared" | "private";
};
worker?: string;
}>;
};
standingRules: {
block: BlockDefinition<ZodDiscriminatedUnion<"op", [ZodObject<{
op: ZodLiteral<"read">;
}, "strict", ZodTypeAny, {
op: "read";
}, {
op: "read";
}>, ZodObject<{
op: ZodLiteral<"add">;
text: ZodString;
version: ZodNumber;
}, "strict", ZodTypeAny, {
op: "add";
text: string;
version: number;
}, {
op: "add";
text: string;
version: number;
}>, ZodObject<{
current: ZodString;
number: ZodNumber;
op: ZodLiteral<"change">;
text: ZodString;
version: ZodNumber;
}, "strict", ZodTypeAny, {
current: string;
number: number;
op: "change";
text: string;
version: number;
}, {
current: string;
number: number;
op: "change";
text: string;
version: number;
}>, ZodObject<{
current: ZodString;
number: ZodNumber;
op: ZodLiteral<"remove">;
version: ZodNumber;
}, "strict", ZodTypeAny, {
current: string;
number: number;
op: "remove";
version: number;
}, {
current: string;
number: number;
op: "remove";
version: number;
}>]>, ZodObject<{
line: ZodOptional<ZodString>;
rules: ZodArray<ZodObject<{
addedAt: ZodNumber;
number: ZodNumber;
sessionId: ZodNullable<...>;
text: ZodString;
}, "strip", ZodTypeAny, {
addedAt: number;
number: number;
sessionId: ... | ...;
text: string;
}, {
addedAt: number;
number: number;
sessionId: ... | ...;
text: string;
}>, "many">;
version: ZodNumber;
}, "strip", ZodTypeAny, {
line?: string;
rules: object[];
version: number;
}, {
line?: string;
rules: object[];
version: number;
}>,
| {
op: "read";
}
| {
op: "add";
text: string;
version: number;
}
| {
current: string;
number: number;
op: "change";
text: string;
version: number;
}
| {
current: string;
number: number;
op: "remove";
version: number;
}, {
line?: string;
rules: object[];
version: number;
}>;
inputSchema: ZodDiscriminatedUnion<"op", [ZodObject<{
op: ZodLiteral<"read">;
}, "strict", ZodTypeAny, {
op: "read";
}, {
op: "read";
}>, ZodObject<{
op: ZodLiteral<"add">;
text: ZodString;
version: ZodNumber;
}, "strict", ZodTypeAny, {
op: "add";
text: string;
version: number;
}, {
op: "add";
text: string;
version: number;
}>, ZodObject<{
current: ZodString;
number: ZodNumber;
op: ZodLiteral<"change">;
text: ZodString;
version: ZodNumber;
}, "strict", ZodTypeAny, {
current: string;
number: number;
op: "change";
text: string;
version: number;
}, {
current: string;
number: number;
op: "change";
text: string;
version: number;
}>, ZodObject<{
current: ZodString;
number: ZodNumber;
op: ZodLiteral<"remove">;
version: ZodNumber;
}, "strict", ZodTypeAny, {
current: string;
number: number;
op: "remove";
version: number;
}, {
current: string;
number: number;
op: "remove";
version: number;
}>]>;
};
}>, SessionConfig, {
onStarted: BlockDefinition<any, any>;
}, UserConfig | undefined, OrgConfig | undefined, Record<string, DeclaredResourceEntry>, ZodObject<object & object, "strip", ZodTypeAny, {
capabilities: Record<string, string[]>;
defaults?: | false
| {
date?: boolean;
historySummary?: boolean;
skillsIndex?: boolean;
};
delegates: string[] | "all";
discover?: ("workers" | "skills" | "resources")[];
instructions?: string;
model: string;
skills: {
activateTool?: boolean;
active: string[];
enableLlmClassifier: boolean;
};
teamInstructions?: string;
tools?: string[];
workerId?: string;
workerPackages?: object[];
workerSkills: object[];
workerTools: BlockDefinition<any, any, any, any>[];
}, {
capabilities?: Record<string, string[]>;
defaults?: | false
| {
date?: boolean;
historySummary?: boolean;
skillsIndex?: boolean;
};
delegates?: string[] | "all";
discover?: ("workers" | "skills" | "resources")[];
instructions?: string;
model?: string;
skills?: {
activateTool?: boolean;
active?: string[];
enableLlmClassifier?: boolean;
};
teamInstructions?: string;
tools?: string[];
workerId?: string;
workerPackages?: object[];
workerSkills?: object[];
workerTools?: BlockDefinition<any, any, any, any>[];
}>>;

Build a worker flow.

Called with no arguments this returns the built-in — the worker flow a worker file that names no flow: is hired into. Called with arguments it returns a configured one; register it as workerFlows: { agent: defineAgentWorkerFlow({ ... }) } and it wins for every worker on the roster.

Define once, hire many: call this at module scope or app bootstrap, never per hire or per request.

Parameters​

given?​

AgentWorkerFlowOptions

Returns​

FlowType<NormalizedActions<{ addDelegate?: { block: BlockDefinition<ZodObject<{ note: ZodOptional<ZodString>; worker: ZodString; }, "strict", ZodTypeAny, { note?: string; worker: string; }, { note?: string; worker: string; }>, ZodObject<{ delegates: ZodArray<ZodObject<... & ..., "strip", ZodTypeAny, { note?: ...; target?: ...; worker: ...; }, { note?: ...; target?: ...; worker: ...; }>, "many">; fallback: ZodNullable<ZodObject<{ target: ...; worker: ...; }, "strip", ZodTypeAny, { target?: ...; worker: ...; }, { target?: ...; worker: ...; }>>; filingSessionId: ZodString; max: ZodNumber; }, "strip", ZodTypeAny, { delegates: object[]; fallback: | { target?: ... | ...; worker: string; } | null; filingSessionId: string; max: number; }, { delegates: object[]; fallback: | { target?: ... | ...; worker: string; } | null; filingSessionId: string; max: number; }>, { note?: string; worker: string; }, { delegates: object[]; fallback: | { target?: string; worker: string; } | null; filingSessionId: string; max: number; }>; description: string; inputSchema: ZodObject<{ note: ZodOptional<ZodString>; worker: ZodString; }, "strict", ZodTypeAny, { note?: string; worker: string; }, { note?: string; worker: string; }>; }; listDelegates?: { block: BlockDefinition<ZodObject<{ }, "strict", ZodTypeAny, { }, { }>, ZodObject<object & object, "strip", ZodTypeAny, { delegates: object[]; fallback: | { target?: ... | ...; worker: string; } | null; filingSessionId: string; max: number; }, { delegates: object[]; fallback: | { target?: ... | ...; worker: string; } | null; filingSessionId: string; max: number; }>, { }, { delegates: (object & object)[]; fallback: | { target?: string; worker: string; } | null; filingSessionId: string; max: number; }>; description: string; inputSchema: ZodObject<{ }, "strict", ZodTypeAny, { }, { }>; }; removeDelegate?: { block: BlockDefinition<ZodObject<{ worker: ZodString; }, "strict", ZodTypeAny, { worker: string; }, { worker: string; }>, ZodObject<{ delegates: ZodArray<ZodObject<... & ..., "strip", ZodTypeAny, { note?: ...; target?: ...; worker: ...; }, { note?: ...; target?: ...; worker: ...; }>, "many">; fallback: ZodNullable<ZodObject<{ target: ...; worker: ...; }, "strip", ZodTypeAny, { target?: ...; worker: ...; }, { target?: ...; worker: ...; }>>; filingSessionId: ZodString; max: ZodNumber; }, "strip", ZodTypeAny, { delegates: object[]; fallback: | { target?: ... | ...; worker: string; } | null; filingSessionId: string; max: number; }, { delegates: object[]; fallback: | { target?: ... | ...; worker: string; } | null; filingSessionId: string; max: number; }>, { worker: string; }, { delegates: object[]; fallback: | { target?: string; worker: string; } | null; filingSessionId: string; max: number; }>; description: string; inputSchema: ZodObject<{ worker: ZodString; }, "strict", ZodTypeAny, { worker: string; }, { worker: string; }>; }; respond: { block: BlockDefinition<any, ZodTypeAny, any, any>; concurrency: { key: (ctx) => string | undefined; policy: "hold"; }; inputSchema: ZodObject<object & object, "strip" | "strict", ZodTypeAny, { message: string; taskId?: string; }, { message: string; taskId?: string; }>; taskOf: (input) => string | undefined; userMessage: (input) => any; }; setFallback?: { block: BlockDefinition<ZodObject<{ worker: ZodNullable<ZodString>; }, "strict", ZodTypeAny, { worker: string | null; }, { worker: string | null; }>, ZodObject<{ delegates: ZodArray<ZodObject<... & ..., "strip", ZodTypeAny, { note?: ...; target?: ...; worker: ...; }, { note?: ...; target?: ...; worker: ...; }>, "many">; fallback: ZodNullable<ZodObject<{ target: ...; worker: ...; }, "strip", ZodTypeAny, { target?: ...; worker: ...; }, { target?: ...; worker: ...; }>>; filingSessionId: ZodString; max: ZodNumber; }, "strip", ZodTypeAny, { delegates: object[]; fallback: | { target?: ... | ...; worker: string; } | null; filingSessionId: string; max: number; }, { delegates: object[]; fallback: | { target?: ... | ...; worker: string; } | null; filingSessionId: string; max: number; }>, { worker: string | null; }, { delegates: object[]; fallback: | { target?: string; worker: string; } | null; filingSessionId: string; max: number; }>; description: string; inputSchema: ZodObject<{ worker: ZodNullable<ZodString>; }, "strict", ZodTypeAny, { worker: string | null; }, { worker: string | null; }>; }; setSessionFields?: { block: BlockDefinition<ZodObject<{ fields: ZodRecord<ZodString, ZodUnknown>; worker: ZodOptional<ZodString>; }, "strict", ZodTypeAny, { fields: Record<string, unknown>; worker?: string; }, { fields: Record<string, unknown>; worker?: string; }>, ZodObject<{ fields: ZodRecord<ZodString, ZodUnknown>; }, "strip", ZodTypeAny, { fields: Record<string, unknown>; }, { fields: Record<string, unknown>; }>, { fields: Record<string, unknown>; worker?: string; }, { fields: Record<string, unknown>; }>; inputSchema: ZodObject<{ fields: ZodRecord<ZodString, ZodUnknown>; worker: ZodOptional<ZodString>; }, "strict", ZodTypeAny, { fields: Record<string, unknown>; worker?: string; }, { fields: Record<string, unknown>; worker?: string; }>; }; setWorkProject: { block: BlockDefinition<ZodObject<{ project: ZodObject<{ id: ZodString; visibility: ZodEnum<[..., ...]>; }, "strict", ZodTypeAny, { id: string; visibility: "shared" | "private"; }, { id: string; visibility: "shared" | "private"; }>; worker: ZodOptional<ZodString>; }, "strict", ZodTypeAny, { project: { id: string; visibility: "shared" | "private"; }; worker?: string; }, { project: { id: string; visibility: "shared" | "private"; }; worker?: string; }>, ZodObject<{ project: ZodObject<{ id: ZodString; visibility: ZodEnum<[..., ...]>; }, "strict", ZodTypeAny, { id: string; visibility: "shared" | "private"; }, { id: string; visibility: "shared" | "private"; }>; }, "strip", ZodTypeAny, { project: { id: string; visibility: "shared" | "private"; }; }, { project: { id: string; visibility: "shared" | "private"; }; }>, { project: { id: string; visibility: "shared" | "private"; }; worker?: string; }, { project: { id: string; visibility: "shared" | "private"; }; }>; inputSchema: ZodObject<{ project: ZodObject<{ id: ZodString; visibility: ZodEnum<["shared", "private"]>; }, "strict", ZodTypeAny, { id: string; visibility: "shared" | "private"; }, { id: string; visibility: "shared" | "private"; }>; worker: ZodOptional<ZodString>; }, "strict", ZodTypeAny, { project: { id: string; visibility: "shared" | "private"; }; worker?: string; }, { project: { id: string; visibility: "shared" | "private"; }; worker?: string; }>; }; standingRules: { block: BlockDefinition<ZodDiscriminatedUnion<"op", [ZodObject<{ op: ZodLiteral<"read">; }, "strict", ZodTypeAny, { op: "read"; }, { op: "read"; }>, ZodObject<{ op: ZodLiteral<"add">; text: ZodString; version: ZodNumber; }, "strict", ZodTypeAny, { op: "add"; text: string; version: number; }, { op: "add"; text: string; version: number; }>, ZodObject<{ current: ZodString; number: ZodNumber; op: ZodLiteral<"change">; text: ZodString; version: ZodNumber; }, "strict", ZodTypeAny, { current: string; number: number; op: "change"; text: string; version: number; }, { current: string; number: number; op: "change"; text: string; version: number; }>, ZodObject<{ current: ZodString; number: ZodNumber; op: ZodLiteral<"remove">; version: ZodNumber; }, "strict", ZodTypeAny, { current: string; number: number; op: "remove"; version: number; }, { current: string; number: number; op: "remove"; version: number; }>]>, ZodObject<{ line: ZodOptional<ZodString>; rules: ZodArray<ZodObject<{ addedAt: ZodNumber; number: ZodNumber; sessionId: ZodNullable<...>; text: ZodString; }, "strip", ZodTypeAny, { addedAt: number; number: number; sessionId: ... | ...; text: string; }, { addedAt: number; number: number; sessionId: ... | ...; text: string; }>, "many">; version: ZodNumber; }, "strip", ZodTypeAny, { line?: string; rules: object[]; version: number; }, { line?: string; rules: object[]; version: number; }>, | { op: "read"; } | { op: "add"; text: string; version: number; } | { current: string; number: number; op: "change"; text: string; version: number; } | { current: string; number: number; op: "remove"; version: number; }, { line?: string; rules: object[]; version: number; }>; inputSchema: ZodDiscriminatedUnion<"op", [ZodObject<{ op: ZodLiteral<"read">; }, "strict", ZodTypeAny, { op: "read"; }, { op: "read"; }>, ZodObject<{ op: ZodLiteral<"add">; text: ZodString; version: ZodNumber; }, "strict", ZodTypeAny, { op: "add"; text: string; version: number; }, { op: "add"; text: string; version: number; }>, ZodObject<{ current: ZodString; number: ZodNumber; op: ZodLiteral<"change">; text: ZodString; version: ZodNumber; }, "strict", ZodTypeAny, { current: string; number: number; op: "change"; text: string; version: number; }, { current: string; number: number; op: "change"; text: string; version: number; }>, ZodObject<{ current: ZodString; number: ZodNumber; op: ZodLiteral<"remove">; version: ZodNumber; }, "strict", ZodTypeAny, { current: string; number: number; op: "remove"; version: number; }, { current: string; number: number; op: "remove"; version: number; }>]>; }; }>, SessionConfig, { onStarted: BlockDefinition<any, any>; }, UserConfig | undefined, OrgConfig | undefined, Record<string, DeclaredResourceEntry>, ZodObject<object & object, "strip", ZodTypeAny, { capabilities: Record<string, string[]>; defaults?: | false | { date?: boolean; historySummary?: boolean; skillsIndex?: boolean; }; delegates: string[] | "all"; discover?: ("workers" | "skills" | "resources")[]; instructions?: string; model: string; skills: { activateTool?: boolean; active: string[]; enableLlmClassifier: boolean; }; teamInstructions?: string; tools?: string[]; workerId?: string; workerPackages?: object[]; workerSkills: object[]; workerTools: BlockDefinition<any, any, any, any>[]; }, { capabilities?: Record<string, string[]>; defaults?: | false | { date?: boolean; historySummary?: boolean; skillsIndex?: boolean; }; delegates?: string[] | "all"; discover?: ("workers" | "skills" | "resources")[]; instructions?: string; model?: string; skills?: { activateTool?: boolean; active?: string[]; enableLlmClassifier?: boolean; }; teamInstructions?: string; tools?: string[]; workerId?: string; workerPackages?: object[]; workerSkills?: object[]; workerTools?: BlockDefinition<any, any, any, any>[]; }>>

A defineFlow result whose flow kind is agent, cardinality collection.


defineCoordinatorFlow()​

function defineCoordinatorFlow(options): FlowType<NormalizedActions<Record<string, ActionEntry<BlockDefinition<ZodTypeAny, ZodTypeAny, any, any>>>>, SessionConfig | undefined, RequestConfig | undefined, UserConfig | undefined, OrgConfig | undefined, Record<string, DeclaredResourceEntry>, ZodTypeAny | undefined>;

Build the coordinator flow.

Parameters​

options​

CoordinatorFlowOptions

Returns​

FlowType<NormalizedActions<Record<string, ActionEntry<BlockDefinition<ZodTypeAny, ZodTypeAny, any, any>>>>, SessionConfig | undefined, RequestConfig | undefined, UserConfig | undefined, OrgConfig | undefined, Record<string, DeclaredResourceEntry>, ZodTypeAny | undefined>


defineErrorHistoryCollection()​

function defineErrorHistoryCollection(options?): DefinedProjectedResourceCollection<{
count: number;
cut: number;
day: string;
entries: object[];
error: string;
firstSeen: string;
inbox: string | null;
issue: | {
identifier: string | null;
url: string;
}
| null;
lastSeen: string;
ref: string;
source: string;
status: string;
taskIds: string[];
title: string;
}, ZodObject<{
count: ZodNumber;
cut: ZodNumber;
day: ZodString;
entries: ZodArray<ZodObject<{
at: ZodString;
issue: ZodNullable<ZodObject<{
identifier: ZodNullable<ZodString>;
url: ZodString;
}, "strip", ZodTypeAny, {
identifier: string | null;
url: string;
}, {
identifier: string | null;
url: string;
}>>;
kind: ZodEnum<["occurrence", "status"]>;
message: ZodNullable<ZodString>;
requestId: ZodNullable<ZodString>;
sessionId: ZodNullable<ZodString>;
source: ZodNullable<ZodString>;
status: ZodNullable<ZodString>;
taskId: ZodNullable<ZodString>;
userId: ZodNullable<ZodString>;
}, "strip", ZodTypeAny, {
at: string;
issue: | {
identifier: string | null;
url: string;
}
| null;
kind: "status" | "occurrence";
message: string | null;
requestId: string | null;
sessionId: string | null;
source: string | null;
status: string | null;
taskId: string | null;
userId: string | null;
}, {
at: string;
issue: | {
identifier: string | null;
url: string;
}
| null;
kind: "status" | "occurrence";
message: string | null;
requestId: string | null;
sessionId: string | null;
source: string | null;
status: string | null;
taskId: string | null;
userId: string | null;
}>, "many">;
error: ZodString;
firstSeen: ZodString;
inbox: ZodNullable<ZodString>;
issue: ZodNullable<ZodObject<{
identifier: ZodNullable<ZodString>;
url: ZodString;
}, "strip", ZodTypeAny, {
identifier: string | null;
url: string;
}, {
identifier: string | null;
url: string;
}>>;
lastSeen: ZodString;
ref: ZodString;
source: ZodString;
status: ZodString;
taskIds: ZodArray<ZodString, "many">;
title: ZodString;
}, "strip", ZodTypeAny, {
count: number;
cut: number;
day: string;
entries: object[];
error: string;
firstSeen: string;
inbox: string | null;
issue: | {
identifier: string | null;
url: string;
}
| null;
lastSeen: string;
ref: string;
source: string;
status: string;
taskIds: string[];
title: string;
}, {
count: number;
cut: number;
day: string;
entries: object[];
error: string;
firstSeen: string;
inbox: string | null;
issue: | {
identifier: string | null;
url: string;
}
| null;
lastSeen: string;
ref: string;
source: string;
status: string;
taskIds: string[];
title: string;
}>, {
count: number;
cut: number;
day: string;
entries: object[];
error: string;
firstSeen: string;
inbox: string | null;
issue: | {
identifier: string | null;
url: string;
}
| null;
lastSeen: string;
ref: string;
source: string;
status: string;
taskIds: string[];
title: string;
}>;

The read-only error-history/** view over the Error Reporter's reports and history, org scope, read by a worker's searchResources and readResourceContent. A search with no day in its prefix reads the last 7 days; error-history/<YYYY-MM-DD> narrows it to one. Before the reporter is bound, and with no reporter, it has no record. No client reads it.

Parameters​

options?​

ErrorHistoryCollectionOptions

The reporter it reads through.

Returns​

DefinedProjectedResourceCollection<{ count: number; cut: number; day: string; entries: object[]; error: string; firstSeen: string; inbox: string | null; issue: | { identifier: string | null; url: string; } | null; lastSeen: string; ref: string; source: string; status: string; taskIds: string[]; title: string; }, ZodObject<{ count: ZodNumber; cut: ZodNumber; day: ZodString; entries: ZodArray<ZodObject<{ at: ZodString; issue: ZodNullable<ZodObject<{ identifier: ZodNullable<ZodString>; url: ZodString; }, "strip", ZodTypeAny, { identifier: string | null; url: string; }, { identifier: string | null; url: string; }>>; kind: ZodEnum<["occurrence", "status"]>; message: ZodNullable<ZodString>; requestId: ZodNullable<ZodString>; sessionId: ZodNullable<ZodString>; source: ZodNullable<ZodString>; status: ZodNullable<ZodString>; taskId: ZodNullable<ZodString>; userId: ZodNullable<ZodString>; }, "strip", ZodTypeAny, { at: string; issue: | { identifier: string | null; url: string; } | null; kind: "status" | "occurrence"; message: string | null; requestId: string | null; sessionId: string | null; source: string | null; status: string | null; taskId: string | null; userId: string | null; }, { at: string; issue: | { identifier: string | null; url: string; } | null; kind: "status" | "occurrence"; message: string | null; requestId: string | null; sessionId: string | null; source: string | null; status: string | null; taskId: string | null; userId: string | null; }>, "many">; error: ZodString; firstSeen: ZodString; inbox: ZodNullable<ZodString>; issue: ZodNullable<ZodObject<{ identifier: ZodNullable<ZodString>; url: ZodString; }, "strip", ZodTypeAny, { identifier: string | null; url: string; }, { identifier: string | null; url: string; }>>; lastSeen: ZodString; ref: ZodString; source: ZodString; status: ZodString; taskIds: ZodArray<ZodString, "many">; title: ZodString; }, "strip", ZodTypeAny, { count: number; cut: number; day: string; entries: object[]; error: string; firstSeen: string; inbox: string | null; issue: | { identifier: string | null; url: string; } | null; lastSeen: string; ref: string; source: string; status: string; taskIds: string[]; title: string; }, { count: number; cut: number; day: string; entries: object[]; error: string; firstSeen: string; inbox: string | null; issue: | { identifier: string | null; url: string; } | null; lastSeen: string; ref: string; source: string; status: string; taskIds: string[]; title: string; }>, { count: number; cut: number; day: string; entries: object[]; error: string; firstSeen: string; inbox: string | null; issue: | { identifier: string | null; url: string; } | null; lastSeen: string; ref: string; source: string; status: string; taskIds: string[]; title: string; }>


defineErrorReporterFlow()​

function defineErrorReporterFlow(options): FlowType<NormalizedActions<Record<string, ActionEntry<BlockDefinition<ZodTypeAny, ZodTypeAny, any, any>>>>, SessionConfig | undefined, RequestConfig | undefined, UserConfig | undefined, OrgConfig | undefined, Record<string, DeclaredResourceEntry>, undefined>;

Build the Error Reporter's flow.

Parameters​

options​

ErrorReporterFlowOptions

The reporter, the installation, the harness slot and where it reads the code.

Returns​

FlowType<NormalizedActions<Record<string, ActionEntry<BlockDefinition<ZodTypeAny, ZodTypeAny, any, any>>>>, SessionConfig | undefined, RequestConfig | undefined, UserConfig | undefined, OrgConfig | undefined, Record<string, DeclaredResourceEntry>, undefined>


defineErrorReporterIntakeFlow()​

function defineErrorReporterIntakeFlow(options): FlowType<NormalizedActions<Record<string, ActionEntry<BlockDefinition<ZodTypeAny, ZodTypeAny, any, any>>>>, SessionConfig | undefined, RequestConfig | undefined, UserConfig | undefined, OrgConfig | undefined, Record<string, DeclaredResourceEntry>, undefined>;

The reporter's intake, on a flow of its own: the one door every occurrence comes in by. The reporter's capture runs it for a failed request; a board dispatches it for a task that ended errored, from whatever flow the board is on. It runs no worker and opens to no caller: its entries are internal.

Parameters​

options​

ErrorReporterIntakeFlowOptions

The reporter.

Returns​

FlowType<NormalizedActions<Record<string, ActionEntry<BlockDefinition<ZodTypeAny, ZodTypeAny, any, any>>>>, SessionConfig | undefined, RequestConfig | undefined, UserConfig | undefined, OrgConfig | undefined, Record<string, DeclaredResourceEntry>, undefined>


defineMcpCredentialsCollection()​

function defineMcpCredentialsCollection(): object & ResourceCollectionConfig<JsonObject> & object;

The keys collection, at mcp-credentials/* in each user's own scope. The same declaration every call returns, so two blocks that hold it meet in one flow without a conflict.

Returns​

object & ResourceCollectionConfig<JsonObject> & object


definePersona()​

Call Signature​

function definePersona(config): DefinedResourceCollection;
Parameters​
config​

PersonaCollectionConfig

Returns​

DefinedResourceCollection

Call Signature​

function definePersona(config): DefinedResource;
Parameters​
config​

PersonaResourceConfig

Returns​

DefinedResource


definePrivateProjectFilesCollection()​

function definePrivateProjectFilesCollection(): object & ResourceCollectionConfig<JsonObject> & object;

The private projects' files, at project-files/<projectId>/<path> in each user's own scope: a private project's files, which only its owner reads. Lazy and with no browser read, like defineProjectFilesCollection.

Returns​

object & ResourceCollectionConfig<JsonObject> & object


definePrivateProjectsCollection()​

function definePrivateProjectsCollection(): object & ResourceCollectionConfig<JsonObject> & object;

The private projects, at projects/* in each user's own scope: the same row as a shared project's, which only its owner lists or reads. User scope is one cell per user per organization, so a private project shows only in the organization it was made in.

Install it beside defineProjectsCollection wherever projects are read or written; the project blocks hold both. Readable by a browser, which reads its own user's rows only.

Returns​

object & ResourceCollectionConfig<JsonObject> & object


definePrivateWorkstreamsCollection()​

function definePrivateWorkstreamsCollection(): ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object;

A private project's workstream entries, at its owner's user scope.

Returns​

ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object


defineProjectBlocks()​

function defineProjectBlocks(options?): ProjectBlocks;

Build the project writes, the project read, the caller's project list and the project files read. Register them on a flow at PROJECTS_FLOW: the projects collections' runBy names that flow, so a client's project write runs there. Mount connectorKeys among the host's adapters, so each user can set their key for the servers a project names.

Parameters​

options?​

ProjectBlocksOptions

mcpServers: the MCP server names this host offers its projects, and the connectors the keys route takes keys for. Absent: none, a project can name no server, and the route serves nothing. checkRepository: the host's repository check (see ProjectBlocksOptions.checkRepository). projectCoordinator: what the projectSetup view answers.

Returns​

ProjectBlocks

Example​

const projects = defineProjectBlocks({ mcpServers: ["linear"] });
defineFlow({ kind: PROJECTS_FLOW, actions: { ...projects.actions }, views: { ...projects.views } });
createFlowState({ flows, adapters: [projects.connectorKeys] });

defineProjectFilesCollection()​

function defineProjectFilesCollection(): object & ResourceCollectionConfig<JsonObject> & object;

The files each project keeps, at project-files/<projectId>/<path>: an agent's notes and memory, and the whole of a no-repository project's code. One collection for the organization, keyed by project, so a reader or a workspace mount scoped to <projectId>/ sees that project's files and no other's. Lazy, because a project's files grow without bound; no browser read, because only the project's members may read them, through readProjectFiles (project-files.ts).

Returns​

object & ResourceCollectionConfig<JsonObject> & object


defineProjectsCollection()​

function defineProjectsCollection(): object & ResourceCollectionConfig<JsonObject> & object;

The organization's projects, at projects/*.

Install it wherever projects are read or written. Org-scoped, shared across flows, and readable by a browser through expose. Takes no options: the prefix, the scope and the sharing are what Shift Manager joins against. The declaration returned is the same one every call returns.

Write a row with create(), never upsert(). create() refuses a key that is held, and that refusal is what stops a second project taking an id. The project blocks (defineProjectBlocks) are the writers; prefer them.

Returns​

object & ResourceCollectionConfig<JsonObject> & object

Example​

// workforce/org/resources/projects.ts
export default defineProjectsCollection();

defineSessionBoard()​

function defineSessionBoard(options): object;

Build the filing factory for one worker flow.

Parameters​

options​

SessionBoardOptions

The installation, the flow's name, its seed and its routing.

Returns​

actions​
actions: object;

The task actions (<tool>_tasks) and the four delegate actions, for the flow's actions. A manager's.

actions.addDelegate​
addDelegate: object;
actions.addDelegate.block​
block: BlockDefinition<ZodObject<{
note: ZodOptional<ZodString>;
worker: ZodString;
}, "strict", ZodTypeAny, {
note?: string;
worker: string;
}, {
note?: string;
worker: string;
}>, ZodObject<{
delegates: ZodArray<ZodObject<object & object, "strip", ZodTypeAny, {
note?: string;
target?: string;
worker: string;
}, {
note?: string;
target?: string;
worker: string;
}>, "many">;
fallback: ZodNullable<ZodObject<{
target: ZodOptional<ZodString>;
worker: ZodString;
}, "strip", ZodTypeAny, {
target?: string;
worker: string;
}, {
target?: string;
worker: string;
}>>;
filingSessionId: ZodString;
max: ZodNumber;
}, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, {
note?: string;
worker: string;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>;
actions.addDelegate.description​
description: string;
actions.addDelegate.inputSchema​
inputSchema: ZodObject<{
note: ZodOptional<ZodString>;
worker: ZodString;
}, "strict", ZodTypeAny, {
note?: string;
worker: string;
}, {
note?: string;
worker: string;
}>;
actions.listDelegates​
listDelegates: object;
actions.listDelegates.block​
block: BlockDefinition<ZodObject<{
}, "strict", ZodTypeAny, {
}, {
}>, ZodObject<object & object, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, {
}, {
delegates: (object & object)[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>;
actions.listDelegates.description​
description: string;
actions.listDelegates.inputSchema​
inputSchema: ZodObject<{
}, "strict", ZodTypeAny, {
}, {
}>;
actions.removeDelegate​
removeDelegate: object;
actions.removeDelegate.block​
block: BlockDefinition<ZodObject<{
worker: ZodString;
}, "strict", ZodTypeAny, {
worker: string;
}, {
worker: string;
}>, ZodObject<{
delegates: ZodArray<ZodObject<object & object, "strip", ZodTypeAny, {
note?: string;
target?: string;
worker: string;
}, {
note?: string;
target?: string;
worker: string;
}>, "many">;
fallback: ZodNullable<ZodObject<{
target: ZodOptional<ZodString>;
worker: ZodString;
}, "strip", ZodTypeAny, {
target?: string;
worker: string;
}, {
target?: string;
worker: string;
}>>;
filingSessionId: ZodString;
max: ZodNumber;
}, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, {
worker: string;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>;
actions.removeDelegate.description​
description: string;
actions.removeDelegate.inputSchema​
inputSchema: ZodObject<{
worker: ZodString;
}, "strict", ZodTypeAny, {
worker: string;
}, {
worker: string;
}>;
actions.setFallback​
setFallback: object;
actions.setFallback.block​
block: BlockDefinition<ZodObject<{
worker: ZodNullable<ZodString>;
}, "strict", ZodTypeAny, {
worker: string | null;
}, {
worker: string | null;
}>, ZodObject<{
delegates: ZodArray<ZodObject<object & object, "strip", ZodTypeAny, {
note?: string;
target?: string;
worker: string;
}, {
note?: string;
target?: string;
worker: string;
}>, "many">;
fallback: ZodNullable<ZodObject<{
target: ZodOptional<ZodString>;
worker: ZodString;
}, "strip", ZodTypeAny, {
target?: string;
worker: string;
}, {
target?: string;
worker: string;
}>>;
filingSessionId: ZodString;
max: ZodNumber;
}, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, {
worker: string | null;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>;
actions.setFallback.description​
description: string;
actions.setFallback.inputSchema​
inputSchema: ZodObject<{
worker: ZodNullable<ZodString>;
}, "strict", ZodTypeAny, {
worker: string | null;
}, {
worker: string | null;
}>;
board​
board: object;

The board itself: its resolver, its roster and its run.

board.actions​
actions: Record<string, ActionConfig>;
board.board​
board: TaskBoardHandle<unknown, unknown, "conversation-tasks", false>;
board.fileRouted​
fileRouted: (ctx, filing) => Promise<"filed" | "exists">;
Parameters​
ctx​

BlockContext

filing​

TaskInit<unknown> & object

Returns​

Promise<"filed" | "exists">

board.files​
files: (ctx) => Promise<boolean>;
Parameters​
ctx​

BlockContext

Returns​

Promise<boolean>

board.planned​
planned: (turn, answerAgain?) => BlockDefinition<any, any>;
Parameters​
turn​

BlockDefinition<any, any>

answerAgain?​

BlockDefinition<any, any, any, any>

Returns​

BlockDefinition<any, any>

board.resolver​
resolver: TaskCollectionResolver;
board.resources​
resources: object;
board.resources.workforceRoutedSessions​
workforceRoutedSessions: object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
flowIsolation​
readonly flowIsolation: false;
pattern​
readonly pattern: "workforce/routed-sessions/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: ZodObject<{
partition: ZodString;
taskId: ZodString;
}, "strip", ZodTypeAny, {
partition: string;
taskId: string;
}, {
partition: string;
taskId: string;
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.partition​
partition: string;
ClientType.taskId​
taskId: string;
StateType​
StateType: object;
StateType.partition​
partition: string;
StateType.taskId​
taskId: string;
board.resources.workforceTaskChains​
workforceTaskChains: object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
flowIsolation​
readonly flowIsolation: false;
pattern​
readonly pattern: "workforce/task-chains/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: ZodObject<{
entries: ZodDefault<ZodRecord<ZodString, ZodObject<{
at: ...;
state: ...;
}, "strip", ZodTypeAny, {
at: ...;
state: ...;
}, {
at: ...;
state: ...;
}>>>;
top: ZodObject<{
partition: ZodString;
taskId: ZodString;
}, "strict", ZodTypeAny, {
partition: string;
taskId: string;
}, {
partition: string;
taskId: string;
}>;
}, "strip", ZodTypeAny, {
entries: Record<string, {
at: number;
state: "added" | "reserved";
}>;
top: {
partition: string;
taskId: string;
};
}, {
entries?: Record<string, {
at: number;
state: ... | ...;
}>;
top: {
partition: string;
taskId: string;
};
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.entries​
entries: Record<string, {
at: number;
state: "added" | "reserved";
}>;
ClientType.top​
top: object;
ClientType.top.partition​
partition: string;
ClientType.top.taskId​
taskId: string;
StateType​
StateType: object;
StateType.entries​
entries: Record<string, {
at: number;
state: "added" | "reserved";
}>;
StateType.top​
top: object;
StateType.top.partition​
partition: string;
StateType.top.taskId​
taskId: string;
board.roster​
roster: (ctx) => AssigneeRoster | Promise<AssigneeRoster>;
Parameters​
ctx​

BlockContext

Returns​

AssigneeRoster | Promise<AssigneeRoster>

board.runBoard​
runBoard: BlockDefinition<any, any, any, any>;
board.tools​
tools: DefinedCapability<"taskTools", Record<string, never>, "tools" | "default", Record<string, PresetDef<any>>, undefined, {
workforceTaskChains: object & ResourceCollectionConfig<JsonObject> & object;
}, undefined, undefined, undefined> & object;
Type Declaration​
__configInType?​
readonly __configInType?: undefined;
resourcesType?​
readonly resourcesType?: unknown;
sequencerStateType?​
readonly sequencerStateType?: unknown;
sessionStateType?​
readonly sessionStateType?: unknown;
stateSchemaType?​
readonly stateSchemaType?: unknown;
targetStatesType?​
readonly targetStatesType?: unknown;
board.triggerPass​
triggerPass: BlockDefinition<ZodUnknown, ZodObject<{
}, "strip", ZodTypeAny, {
}, {
}>, unknown, {
}>;
board.turnResolver​
turnResolver: TaskCollectionResolver;
board.views​
views: Record<string, ViewDefinition>;
delegates​
delegates: object;

The session's delegates: the one check, the list a task sees, the four actions and tools.

delegates.actions​
actions: object;
delegates.actions.addDelegate​
addDelegate: object;
delegates.actions.addDelegate.block​
block: BlockDefinition<ZodObject<{
note: ZodOptional<ZodString>;
worker: ZodString;
}, "strict", ZodTypeAny, {
note?: string;
worker: string;
}, {
note?: string;
worker: string;
}>, ZodObject<{
delegates: ZodArray<ZodObject<object & object, "strip", ZodTypeAny, {
note?: ... | ...;
target?: ... | ...;
worker: string;
}, {
note?: ... | ...;
target?: ... | ...;
worker: string;
}>, "many">;
fallback: ZodNullable<ZodObject<{
target: ZodOptional<...>;
worker: ZodString;
}, "strip", ZodTypeAny, {
target?: ... | ...;
worker: string;
}, {
target?: ... | ...;
worker: string;
}>>;
filingSessionId: ZodString;
max: ZodNumber;
}, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, {
note?: string;
worker: string;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>;
delegates.actions.addDelegate.description​
description: string;
delegates.actions.addDelegate.inputSchema​
inputSchema: ZodObject<{
note: ZodOptional<ZodString>;
worker: ZodString;
}, "strict", ZodTypeAny, {
note?: string;
worker: string;
}, {
note?: string;
worker: string;
}>;
delegates.actions.listDelegates​
listDelegates: object;
delegates.actions.listDelegates.block​
block: BlockDefinition<ZodObject<{
}, "strict", ZodTypeAny, {
}, {
}>, ZodObject<object & object, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, {
}, {
delegates: (object & object)[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>;
delegates.actions.listDelegates.description​
description: string;
delegates.actions.listDelegates.inputSchema​
inputSchema: ZodObject<{
}, "strict", ZodTypeAny, {
}, {
}>;
delegates.actions.removeDelegate​
removeDelegate: object;
delegates.actions.removeDelegate.block​
block: BlockDefinition<ZodObject<{
worker: ZodString;
}, "strict", ZodTypeAny, {
worker: string;
}, {
worker: string;
}>, ZodObject<{
delegates: ZodArray<ZodObject<object & object, "strip", ZodTypeAny, {
note?: ... | ...;
target?: ... | ...;
worker: string;
}, {
note?: ... | ...;
target?: ... | ...;
worker: string;
}>, "many">;
fallback: ZodNullable<ZodObject<{
target: ZodOptional<...>;
worker: ZodString;
}, "strip", ZodTypeAny, {
target?: ... | ...;
worker: string;
}, {
target?: ... | ...;
worker: string;
}>>;
filingSessionId: ZodString;
max: ZodNumber;
}, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, {
worker: string;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>;
delegates.actions.removeDelegate.description​
description: string;
delegates.actions.removeDelegate.inputSchema​
inputSchema: ZodObject<{
worker: ZodString;
}, "strict", ZodTypeAny, {
worker: string;
}, {
worker: string;
}>;
delegates.actions.setFallback​
setFallback: object;
delegates.actions.setFallback.block​
block: BlockDefinition<ZodObject<{
worker: ZodNullable<ZodString>;
}, "strict", ZodTypeAny, {
worker: string | null;
}, {
worker: string | null;
}>, ZodObject<{
delegates: ZodArray<ZodObject<object & object, "strip", ZodTypeAny, {
note?: ... | ...;
target?: ... | ...;
worker: string;
}, {
note?: ... | ...;
target?: ... | ...;
worker: string;
}>, "many">;
fallback: ZodNullable<ZodObject<{
target: ZodOptional<...>;
worker: ZodString;
}, "strip", ZodTypeAny, {
target?: ... | ...;
worker: string;
}, {
target?: ... | ...;
worker: string;
}>>;
filingSessionId: ZodString;
max: ZodNumber;
}, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, {
worker: string | null;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>;
delegates.actions.setFallback.description​
description: string;
delegates.actions.setFallback.inputSchema​
inputSchema: ZodObject<{
worker: ZodNullable<ZodString>;
}, "strict", ZodTypeAny, {
worker: string | null;
}, {
worker: string | null;
}>;
delegates.check​
check: (ctx, workerId, use) => Promise<DelegateCheck>;
Parameters​
ctx​

WorkerTurnContext

workerId​

string

use​

"add" | "task"

Returns​

Promise<DelegateCheck>

delegates.defaults​
defaults: (ctx) => Promise<DelegateDefaults>;
Parameters​
ctx​

BlockContext

Returns​

Promise<DelegateDefaults>

delegates.taskDelegates​
taskDelegates: (ctx) => Promise<TaskDelegates>;
Parameters​
ctx​

BlockContext

Returns​

Promise<TaskDelegates>

delegates.tools​
tools: readonly [BlockDefinition<ZodObject<{
}, "strict", ZodTypeAny, {
}, {
}>, ZodObject<object & object, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, {
}, {
delegates: (object & object)[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, BlockDefinition<ZodObject<{
note: ZodOptional<ZodString>;
worker: ZodString;
}, "strict", ZodTypeAny, {
note?: string;
worker: string;
}, {
note?: string;
worker: string;
}>, ZodUnion<[ZodObject<{
delegates: ZodArray<ZodObject<... & ..., "strip", ZodTypeAny, {
note?: ...;
target?: ...;
worker: ...;
}, {
note?: ...;
target?: ...;
worker: ...;
}>, "many">;
fallback: ZodNullable<ZodObject<{
target: ...;
worker: ...;
}, "strip", ZodTypeAny, {
target?: ...;
worker: ...;
}, {
target?: ...;
worker: ...;
}>>;
filingSessionId: ZodString;
max: ZodNumber;
}, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: ... | ...;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: ... | ...;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, ZodObject<{
refused: ZodString;
}, "strip", ZodTypeAny, {
refused: string;
}, {
refused: string;
}>]>, {
note?: string;
worker: string;
},
| {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}
| {
refused: string;
}>, BlockDefinition<ZodObject<{
worker: ZodString;
}, "strict", ZodTypeAny, {
worker: string;
}, {
worker: string;
}>, ZodUnion<[ZodObject<{
delegates: ZodArray<ZodObject<... & ..., "strip", ZodTypeAny, {
note?: ...;
target?: ...;
worker: ...;
}, {
note?: ...;
target?: ...;
worker: ...;
}>, "many">;
fallback: ZodNullable<ZodObject<{
target: ...;
worker: ...;
}, "strip", ZodTypeAny, {
target?: ...;
worker: ...;
}, {
target?: ...;
worker: ...;
}>>;
filingSessionId: ZodString;
max: ZodNumber;
}, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: ... | ...;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: ... | ...;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, ZodObject<{
refused: ZodString;
}, "strip", ZodTypeAny, {
refused: string;
}, {
refused: string;
}>]>, {
worker: string;
},
| {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}
| {
refused: string;
}>, BlockDefinition<ZodObject<{
worker: ZodNullable<ZodString>;
}, "strict", ZodTypeAny, {
worker: string | null;
}, {
worker: string | null;
}>, ZodUnion<[ZodObject<{
delegates: ZodArray<ZodObject<... & ..., "strip", ZodTypeAny, {
note?: ...;
target?: ...;
worker: ...;
}, {
note?: ...;
target?: ...;
worker: ...;
}>, "many">;
fallback: ZodNullable<ZodObject<{
target: ...;
worker: ...;
}, "strip", ZodTypeAny, {
target?: ...;
worker: ...;
}, {
target?: ...;
worker: ...;
}>>;
filingSessionId: ZodString;
max: ZodNumber;
}, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: ... | ...;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: ... | ...;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, ZodObject<{
refused: ZodString;
}, "strip", ZodTypeAny, {
refused: string;
}, {
refused: string;
}>]>, {
worker: string | null;
},
| {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}
| {
refused: string;
}>];
delegates.toolsCapability​
toolsCapability: DefinedCapability<"delegateTools", Record<string, never>, "tools" | "default", Record<string, PresetDef<any>>, undefined, undefined, undefined, undefined, undefined> & object;
Type Declaration​
__configInType?​
readonly __configInType?: undefined;
resourcesType?​
readonly resourcesType?: unknown;
sequencerStateType?​
readonly sequencerStateType?: unknown;
sessionStateType?​
readonly sessionStateType?: unknown;
stateSchemaType?​
readonly stateSchemaType?: unknown;
targetStatesType?​
readonly targetStatesType?: unknown;
delegates.view​
view: ViewDefinition<BlockDefinition<ZodObject<{
}, "strict", ZodTypeAny, {
}, {
}>, ZodObject<object & object, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, {
}, {
delegates: (object & object)[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, "session">;
delegateTools​
delegateTools: DefinedCapability<"delegateTools", Record<string, never>, "tools" | "default", Record<string, PresetDef<any>>, undefined, undefined, undefined, undefined, undefined> & object;

The delegate tools a model's turn is offered: listDelegates always, and addDelegate, removeDelegate and setFallback only on a coordinator set to editsOwnDelegates. One entry for uses.

Type Declaration​
__configInType?​
readonly __configInType?: undefined;
resourcesType?​
readonly resourcesType?: unknown;
sequencerStateType?​
readonly sequencerStateType?: unknown;
sessionStateType?​
readonly sessionStateType?: unknown;
stateSchemaType?​
readonly stateSchemaType?: unknown;
targetStatesType?​
readonly targetStatesType?: unknown;
fileRouted​
fileRouted: (ctx, filing) => Promise<"filed" | "exists">;

File a routed task and start it: the write under a coordinator's one filing step.

Parameters​
ctx​

BlockContext

filing​

TaskInit<unknown> & object

Returns​

Promise<"filed" | "exists">

files​
files: (ctx) => Promise<boolean>;

Whether the running session files now: one of its delegates takes a task. A task session files its task's pieces.

Parameters​
ctx​

BlockContext

Returns​

Promise<boolean>

messages​
messages: DefinedCapability<"workerMessages", Record<string, never>, "tools" | "default", Record<string, PresetDef<any>>, undefined, {
workforceMessageChains: object & ResourceCollectionConfig<JsonObject> & object;
workforceMessages: object & ResourceCollectionConfig<JsonObject> & object;
}, undefined, undefined, undefined> & object;

sendMessage, on every turn of a session that runs a worker: one entry for the model block's uses, beside tools.

Type Declaration​
__configInType?​
readonly __configInType?: undefined;
resourcesType?​
readonly resourcesType?: unknown;
sequencerStateType?​
readonly sequencerStateType?: unknown;
sessionStateType?​
readonly sessionStateType?: unknown;
stateSchemaType?​
readonly stateSchemaType?: unknown;
targetStatesType?​
readonly targetStatesType?: unknown;
planned​
planned: (turn, answerAgain?) => BlockDefinition<any, any>;

Wrap a turn so the steps the worker files for itself run in its request: { message } in, the answer out. Wrap each turn the flow runs as the worker, and pass the wrapped turn to entries: a worker is offered its steps only on a flow that wraps one.

Parameters​
turn​

BlockDefinition<any, any>

answerAgain?​

BlockDefinition<any, any, any, any>

Returns​

BlockDefinition<any, any>

progress​
progress: DefinedCapability<"taskProgress", Record<string, never>, "tools" | "default", Record<string, PresetDef<any>>, undefined, {
[x: string]: DefinedResourceCollection<JsonObject, JsonValue>;
}, undefined, undefined, undefined> & object;

reportProgress, on a task turn holding a running row: one entry for the model block's uses, beside tools.

Type Declaration​
__configInType?​
readonly __configInType?: undefined;
resourcesType?​
readonly resourcesType?: unknown;
sequencerStateType?​
readonly sequencerStateType?: unknown;
sessionStateType?​
readonly sessionStateType?: unknown;
stateSchemaType?​
readonly stateSchemaType?: unknown;
targetStatesType?​
readonly targetStatesType?: unknown;
questions​
questions: DefinedCapability<"userWaits", Record<string, never>, "tools" | "default", Record<string, PresetDef<any>>, undefined, {
[x: string]: DefinedResourceCollection<JsonObject, JsonValue>;
}, undefined, undefined, undefined> & object;

holdTaskForUser on a task turn, and suspendForUser for an approval, a review or (with no task) input: one entry for the model block's uses, beside tools.

Type Declaration​
__configInType?​
readonly __configInType?: undefined;
resourcesType?​
readonly resourcesType?: unknown;
sequencerStateType?​
readonly sequencerStateType?: unknown;
sessionStateType?​
readonly sessionStateType?: unknown;
stateSchemaType?​
readonly stateSchemaType?: unknown;
targetStatesType?​
readonly targetStatesType?: unknown;
resources​
resources: object;

The ledger, the chain records and the message log, for the flow's resources.

resources.workforceMessageChains​
workforceMessageChains: object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
flowIsolation​
readonly flowIsolation: false;
pattern​
readonly pattern: "workforce/message-chains/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: ZodObject<{
sent: ZodDefault<ZodArray<ZodString, "many">>;
}, "strip", ZodTypeAny, {
sent: string[];
}, {
sent?: string[];
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.sent​
sent: string[];
StateType​
StateType: object;
StateType.sent​
sent: string[];
resources.workforceMessages​
workforceMessages: object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
client​
readonly client: object;
client.state​
readonly state: object;
client.state.read​
readonly read: true;
flowIsolation​
readonly flowIsolation: false;
indexes​
readonly indexes: object;
indexes.inReplyTo​
readonly inReplyTo: (_key, message) => any;
Parameters​
_key​

string

message​

any

Returns​

any

indexes.open​
readonly open: (_key, message) => any[] | null;
Parameters​
_key​

string

message​

any

Returns​

any[] | null

pattern​
readonly pattern: "workforce/messages/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: ZodObject<{
addressedBy: ZodOptional<ZodEnum<["task", "session"]>>;
answeredBy: ZodOptional<ZodString>;
at: ZodNumber;
chain: ZodOptional<ZodString>;
deadlineAt: ZodOptional<ZodNumber>;
deliveredAs: ZodOptional<ZodString>;
deliveredAt: ZodOptional<ZodNumber>;
exchange: ZodString;
forward: ZodOptional<ZodObject<{
as: ZodEnum<[..., ...]>;
url: ZodString;
}, "strict", ZodTypeAny, {
as: "addressed" | "inferred";
url: string;
}, {
as: "addressed" | "inferred";
url: string;
}>>;
from: ZodString;
fromFlow: ZodString;
fromSession: ZodString;
hop: ZodNumber;
id: ZodString;
inReplyTo: ZodOptional<ZodString>;
noAnswer: ZodOptional<ZodLiteral<true>>;
queuedBehind: ZodOptional<ZodLiteral<"user">>;
reason: ZodOptional<ZodString>;
replyRequested: ZodOptional<ZodLiteral<true>>;
resent: ZodOptional<ZodObject<{
at: ZodNumber;
n: ZodNumber;
}, "strip", ZodTypeAny, {
at: number;
n: number;
}, {
at: number;
n: number;
}>>;
status: ZodEnum<["unconfirmed", "delivered", "refused", "undeliverable"]>;
takenBy: ZodOptional<ZodString>;
text: ZodString;
to: ZodString;
toFlow: ZodString;
toldAt: ZodOptional<ZodNumber>;
toSession: ZodString;
toState: ZodOptional<ZodRecord<ZodString, ZodString>>;
toTask: ZodOptional<ZodString>;
waitEndedAt: ZodOptional<ZodNumber>;
waitGate: ZodOptional<ZodObject<{
gateId: ZodString;
requestId: ZodString;
}, "strip", ZodTypeAny, {
gateId: string;
requestId: string;
}, {
gateId: string;
requestId: string;
}>>;
}, "strip", ZodTypeAny, {
addressedBy?: "session" | "task";
answeredBy?: string;
at: number;
chain?: string;
deadlineAt?: number;
deliveredAs?: string;
deliveredAt?: number;
exchange: string;
forward?: {
as: "addressed" | "inferred";
url: string;
};
from: string;
fromFlow: string;
fromSession: string;
hop: number;
id: string;
inReplyTo?: string;
noAnswer?: true;
queuedBehind?: "user";
reason?: string;
replyRequested?: true;
resent?: {
at: number;
n: number;
};
status: "unconfirmed" | "delivered" | "refused" | "undeliverable";
takenBy?: string;
text: string;
to: string;
toFlow: string;
toldAt?: number;
toSession: string;
toState?: Record<string, string>;
toTask?: string;
waitEndedAt?: number;
waitGate?: {
gateId: string;
requestId: string;
};
}, {
addressedBy?: "session" | "task";
answeredBy?: string;
at: number;
chain?: string;
deadlineAt?: number;
deliveredAs?: string;
deliveredAt?: number;
exchange: string;
forward?: {
as: "addressed" | "inferred";
url: string;
};
from: string;
fromFlow: string;
fromSession: string;
hop: number;
id: string;
inReplyTo?: string;
noAnswer?: true;
queuedBehind?: "user";
reason?: string;
replyRequested?: true;
resent?: {
at: number;
n: number;
};
status: "unconfirmed" | "delivered" | "refused" | "undeliverable";
takenBy?: string;
text: string;
to: string;
toFlow: string;
toldAt?: number;
toSession: string;
toState?: Record<string, string>;
toTask?: string;
waitEndedAt?: number;
waitGate?: {
gateId: string;
requestId: string;
};
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.addressedBy?​
addressedBy?: "session" | "task";
ClientType.answeredBy?​
answeredBy?: string;
ClientType.at​
at: number;
ClientType.chain?​
chain?: string;
ClientType.deadlineAt?​
deadlineAt?: number;
ClientType.deliveredAs?​
deliveredAs?: string;
ClientType.deliveredAt?​
deliveredAt?: number;
ClientType.exchange​
exchange: string;
ClientType.forward?​
forward?: object;
ClientType.forward.as​
as: "addressed" | "inferred";
ClientType.forward.url​
url: string;
ClientType.from​
from: string;
ClientType.fromFlow​
fromFlow: string;
ClientType.fromSession​
fromSession: string;
ClientType.hop​
hop: number;
ClientType.id​
id: string;
ClientType.inReplyTo?​
inReplyTo?: string;
ClientType.noAnswer?​
noAnswer?: true;
ClientType.queuedBehind?​
queuedBehind?: "user";
ClientType.reason?​
reason?: string;
ClientType.replyRequested?​
replyRequested?: true;
ClientType.resent?​
resent?: object;
ClientType.resent.at​
at: number;
ClientType.resent.n​
n: number;
ClientType.status​
status: "unconfirmed" | "delivered" | "refused" | "undeliverable";
ClientType.takenBy?​
takenBy?: string;
ClientType.text​
text: string;
ClientType.to​
to: string;
ClientType.toFlow​
toFlow: string;
ClientType.toldAt?​
toldAt?: number;
ClientType.toSession​
toSession: string;
ClientType.toState?​
toState?: Record<string, string>;
ClientType.toTask?​
toTask?: string;
ClientType.waitEndedAt?​
waitEndedAt?: number;
ClientType.waitGate?​
waitGate?: object;
ClientType.waitGate.gateId​
gateId: string;
ClientType.waitGate.requestId​
requestId: string;
StateType​
StateType: object;
StateType.addressedBy?​
addressedBy?: "session" | "task";
StateType.answeredBy?​
answeredBy?: string;
StateType.at​
at: number;
StateType.chain?​
chain?: string;
StateType.deadlineAt?​
deadlineAt?: number;
StateType.deliveredAs?​
deliveredAs?: string;
StateType.deliveredAt?​
deliveredAt?: number;
StateType.exchange​
exchange: string;
StateType.forward?​
forward?: object;
StateType.forward.as​
as: "addressed" | "inferred";
StateType.forward.url​
url: string;
StateType.from​
from: string;
StateType.fromFlow​
fromFlow: string;
StateType.fromSession​
fromSession: string;
StateType.hop​
hop: number;
StateType.id​
id: string;
StateType.inReplyTo?​
inReplyTo?: string;
StateType.noAnswer?​
noAnswer?: true;
StateType.queuedBehind?​
queuedBehind?: "user";
StateType.reason?​
reason?: string;
StateType.replyRequested?​
replyRequested?: true;
StateType.resent?​
resent?: object;
StateType.resent.at​
at: number;
StateType.resent.n​
n: number;
StateType.status​
status: "unconfirmed" | "delivered" | "refused" | "undeliverable";
StateType.takenBy?​
takenBy?: string;
StateType.text​
text: string;
StateType.to​
to: string;
StateType.toFlow​
toFlow: string;
StateType.toldAt?​
toldAt?: number;
StateType.toSession​
toSession: string;
StateType.toState?​
toState?: Record<string, string>;
StateType.toTask?​
toTask?: string;
StateType.waitEndedAt?​
waitEndedAt?: number;
StateType.waitGate?​
waitGate?: object;
StateType.waitGate.gateId​
gateId: string;
StateType.waitGate.requestId​
requestId: string;
resources.workforceRoutedSessions​
workforceRoutedSessions: object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
flowIsolation​
readonly flowIsolation: false;
pattern​
readonly pattern: "workforce/routed-sessions/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: ZodObject<{
partition: ZodString;
taskId: ZodString;
}, "strip", ZodTypeAny, {
partition: string;
taskId: string;
}, {
partition: string;
taskId: string;
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.partition​
partition: string;
ClientType.taskId​
taskId: string;
StateType​
StateType: object;
StateType.partition​
partition: string;
StateType.taskId​
taskId: string;
resources.workforceTaskChains​
workforceTaskChains: object & ResourceCollectionConfig<JsonObject> & object;
Type Declaration​
flowIsolation​
readonly flowIsolation: false;
pattern​
readonly pattern: "workforce/task-chains/*";
prefetchMode​
readonly prefetchMode: "lazy";
scope​
readonly scope: "user";
stateSchema​
readonly stateSchema: ZodObject<{
entries: ZodDefault<ZodRecord<ZodString, ZodObject<{
at: ZodNumber;
state: ZodEnum<...>;
}, "strip", ZodTypeAny, {
at: number;
state: ... | ...;
}, {
at: number;
state: ... | ...;
}>>>;
top: ZodObject<{
partition: ZodString;
taskId: ZodString;
}, "strict", ZodTypeAny, {
partition: string;
taskId: string;
}, {
partition: string;
taskId: string;
}>;
}, "strip", ZodTypeAny, {
entries: Record<string, {
at: number;
state: "added" | "reserved";
}>;
top: {
partition: string;
taskId: string;
};
}, {
entries?: Record<string, {
at: number;
state: "reserved" | "added";
}>;
top: {
partition: string;
taskId: string;
};
}>;
__brand​
readonly __brand: "ResourceCollection";
ClientType​
ClientType: object;
ClientType.entries​
entries: Record<string, {
at: number;
state: "added" | "reserved";
}>;
ClientType.top​
top: object;
ClientType.top.partition​
partition: string;
ClientType.top.taskId​
taskId: string;
StateType​
StateType: object;
StateType.entries​
entries: Record<string, {
at: number;
state: "added" | "reserved";
}>;
StateType.top​
top: object;
StateType.top.partition​
partition: string;
StateType.top.taskId​
taskId: string;
serverOwned​
serverOwned: readonly string[];

The session-state fields only this factory writes, for the flow's session.serverOwned.

sessionStateShape​
sessionStateShape: object;

The session state the delegates, the board and worker messages keep, for installation.session(...).

sessionStateShape.delegates​
delegates: ZodDefault<ZodNullable<ZodArray<ZodObject<object & object, "strip", ZodTypeAny, {
note?: string;
target?: string;
worker: string;
}, {
note?: string;
target?: string;
worker: string;
}>, "many">>>;
sessionStateShape.fallback​
fallback: ZodDefault<ZodNullable<ZodObject<{
target: ZodOptional<ZodString>;
worker: ZodString;
}, "strip", ZodTypeAny, {
target?: string;
worker: string;
}, {
target?: string;
worker: string;
}>>>;
sessionStateShape.taskNotices​
taskNotices: ZodDefault<ZodArray<ZodString, "many">>;
sessionStateShape.workerMessagesOwed​
workerMessagesOwed: ZodDefault<ZodArray<ZodObject<{
by: ZodString;
id: ZodString;
}, "strip", ZodTypeAny, {
by: string;
id: string;
}, {
by: string;
id: string;
}>, "many">>;
sessionStateShape.workerRepliesOwed​
workerRepliesOwed: ZodDefault<ZodArray<ZodObject<{
by: ZodString;
id: ZodString;
}, "strip", ZodTypeAny, {
by: string;
id: string;
}, {
by: string;
id: string;
}>, "many">>;
sessionStateShape.workforceMessageChain​
workforceMessageChain: ZodDefault<ZodNullable<ZodString>>;
sessionStateShape.workforceMessageHop​
workforceMessageHop: ZodDefault<ZodNumber>;
sessionStateShape.workforceUserLines​
workforceUserLines: ZodDefault<ZodNumber>;
steers​
steers: DefinedCapability<"taskSteers", Record<string, never>, "default" | "steers", Record<string, PresetDef<any>>, undefined, {
[x: string]: DefinedResourceCollection<JsonObject, JsonValue>;
}, undefined, undefined, undefined> & object;

The steers a running task took, in the worker's context, read before each model call: one entry for the model block's uses, beside tools.

Type Declaration​
__configInType?​
readonly __configInType?: undefined;
resourcesType?​
readonly resourcesType?: unknown;
sequencerStateType?​
readonly sequencerStateType?: unknown;
sessionStateType?​
readonly sessionStateType?: unknown;
stateSchemaType?​
readonly stateSchemaType?: unknown;
targetStatesType?​
readonly targetStatesType?: unknown;
taskDelegates​
taskDelegates: (ctx) => Promise<TaskDelegates>;

The session's delegates as a task sees them, read now.

Parameters​
ctx​

BlockContext

Returns​

Promise<TaskDelegates>

tools​
tools: DefinedCapability<"taskTools", Record<string, never>, "tools" | "default", Record<string, PresetDef<any>>, undefined, {
workforceTaskChains: object & ResourceCollectionConfig<JsonObject> & object;
}, undefined, undefined, undefined> & object;

The model's task tools, granted per call: one entry for the model block's uses.

Type Declaration​
__configInType?​
readonly __configInType?: undefined;
resourcesType?​
readonly resourcesType?: unknown;
sequencerStateType?​
readonly sequencerStateType?: unknown;
sessionStateType?​
readonly sessionStateType?: unknown;
stateSchemaType?​
readonly stateSchemaType?: unknown;
targetStatesType?​
readonly targetStatesType?: unknown;
views​
views: object;

The task list as a session view, listTasks_tasks, and the delegates as one, delegates, for the flow's views.

views.delegates​
delegates: ViewDefinition<BlockDefinition<ZodObject<{
}, "strict", ZodTypeAny, {
}, {
}>, ZodObject<object & object, "strip", ZodTypeAny, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}, {
delegates: object[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, {
}, {
delegates: (object & object)[];
fallback: | {
target?: string;
worker: string;
}
| null;
filingSessionId: string;
max: number;
}>, "session">;
entries()​
entries(
turn,
policy?,
onRouted?
): object;

The internal entries the board needs on its flow, in this order: a run of the board (dispatch); the notice of a task the session filed (onTaskSettled), the two a flow declaring manager is checked for; a check of the session's waiting task (CHECK_TASK_ENTRY); the turn a late steer is owed (STEER_TURN_ENTRY); a worker's message (onMessageReceived), which always wakes the turn; and a scheduled task's filing (fileScheduledTask), through the board's own createTask_tasks. Spread into internal: { actions: ... }.

Parameters​
turn​

BlockDefinition<any, any>

The flow's turn for one message ({ message } in), woken with a notice as its message.

policy?​

(ctx) => NoticePolicy

For the notice entry: whether a notice wakes the turn (judgment, the default) or lands as a line only (fixed), for the running session.

onRouted?​

BlockDefinition<any, any, any, any>

For a flow that routes messages: a conversation-result task's completion, failure or cancel (RoutedEnding in), handed to the flow's own handling instead of a line.

Returns​

object

checkWaitingTask​
checkWaitingTask: object;
checkWaitingTask.block​
block: SequencerDefinition<unknown, unknown, undefined, undefined>;
checkWaitingTask.concurrency​
concurrency: ConcurrencyConfig;
checkWaitingTask.inputSchema​
inputSchema: ZodObject<{
}, "passthrough", ZodTypeAny, objectOutputType<{
}, ZodTypeAny, "passthrough">, objectInputType<{
}, ZodTypeAny, "passthrough">>;
dispatch​
dispatch: object;
dispatch.block​
block: BlockDefinition<any, any, any, any>;
dispatch.concurrency​
concurrency: object;
dispatch.concurrency.key​
readonly key: (ctx) => string | undefined;
Parameters​
ctx​

ConcurrencyKeyContext

Returns​

string | undefined

dispatch.concurrency.policy​
readonly policy: "defer";
dispatch.inputSchema​
inputSchema: ZodObject<{
}, "strict", ZodTypeAny, {
}, {
}>;
fileScheduledTask​
fileScheduledTask: InternalEntry;
onMessageReceived​
onMessageReceived: object;
onMessageReceived.block​
block: SequencerDefinition<{
messageId: string;
}, {
act: "none" | "heard" | "landed";
received?: {
budget: number;
from: string;
id: string;
inReplyTo?: string;
replyRequested?: boolean;
text: string;
};
}, undefined, undefined>;
onMessageReceived.concurrency​
concurrency: object;
onMessageReceived.concurrency.key​
readonly key: (ctx) => string | undefined;
Parameters​
ctx​

ConcurrencyKeyContext

Returns​

string | undefined

onMessageReceived.concurrency.policy​
readonly policy: "defer";
onMessageReceived.inputSchema​
inputSchema: ZodObject<{
messageId: ZodString;
}, "strict", ZodTypeAny, {
messageId: string;
}, {
messageId: string;
}>;
onTaskSettled​
onTaskSettled: object;
onTaskSettled.block​
block: SequencerDefinition<
| {
}
| {
attempt: number;
boardId: string;
cancelled?: string[];
ending: "completed" | "errored" | "cancelled" | "retried";
error?: string;
output?: unknown;
question?: string;
taskId: string;
waitedOn?: true;
}, {
notice?: {
attempt: number;
boardId: string;
cancelled?: string[];
ending: "completed" | "errored" | "cancelled" | "retried";
error?: string;
output?: unknown;
question?: string;
taskId: string;
waitedOn?: true;
};
owed: boolean;
}, undefined, undefined>;
onTaskSettled.concurrency​
concurrency: ConcurrencyConfig;
onTaskSettled.inputSchema​
inputSchema: ZodUnion<[ZodObject<{
attempt: ZodNumber;
boardId: ZodString;
cancelled: ZodOptional<ZodArray<ZodString, "many">>;
ending: ZodEnum<["completed", "errored", "retried", "cancelled"]>;
error: ZodOptional<ZodString>;
output: ZodOptional<ZodUnknown>;
question: ZodOptional<ZodString>;
taskId: ZodString;
waitedOn: ZodOptional<ZodLiteral<true>>;
}, "strict", ZodTypeAny, {
attempt: number;
boardId: string;
cancelled?: string[];
ending: "completed" | "errored" | "cancelled" | "retried";
error?: string;
output?: unknown;
question?: string;
taskId: string;
waitedOn?: true;
}, {
attempt: number;
boardId: string;
cancelled?: string[];
ending: "completed" | "errored" | "cancelled" | "retried";
error?: string;
output?: unknown;
question?: string;
taskId: string;
waitedOn?: true;
}>, ZodObject<{
}, "strict", ZodTypeAny, {
}, {
}>]>;
onTaskSteered​
onTaskSteered: object;
onTaskSteered.block​
block: SequencerDefinition<unknown, any, undefined, undefined>;
onTaskSteered.concurrency​
concurrency:
| ConcurrencyConfig
| {
key: (ctx) => string | undefined;
policy: "defer";
};
onTaskSteered.inputSchema​
inputSchema: ZodObject<{
}, "passthrough", ZodTypeAny, objectOutputType<{
}, ZodTypeAny, "passthrough">, objectInputType<{
}, ZodTypeAny, "passthrough">>;

defineSetWorkProjectBlock()​

function defineSetWorkProjectBlock(otherSession?): BlockDefinition<ZodObject<{
project: ZodObject<{
id: ZodString;
visibility: ZodEnum<["shared", "private"]>;
}, "strict", ZodTypeAny, {
id: string;
visibility: "shared" | "private";
}, {
id: string;
visibility: "shared" | "private";
}>;
worker: ZodOptional<ZodString>;
}, "strict", ZodTypeAny, {
project: {
id: string;
visibility: "shared" | "private";
};
worker?: string;
}, {
project: {
id: string;
visibility: "shared" | "private";
};
worker?: string;
}>, ZodObject<{
project: ZodObject<{
id: ZodString;
visibility: ZodEnum<["shared", "private"]>;
}, "strict", ZodTypeAny, {
id: string;
visibility: "shared" | "private";
}, {
id: string;
visibility: "shared" | "private";
}>;
}, "strip", ZodTypeAny, {
project: {
id: string;
visibility: "shared" | "private";
};
}, {
project: {
id: string;
visibility: "shared" | "private";
};
}>, {
project: {
id: string;
visibility: "shared" | "private";
};
worker?: string;
}, {
project: {
id: string;
visibility: "shared" | "private";
};
}>;

The action's block, refusing too each session otherSession names as not the user's own conversation: sessions a flow's own code opens, which carry none of the fields above (the Error Reporter's report sessions).

Parameters​

otherSession?​

(sessionId) => string | undefined

What a session that isn't the user's own conversation is, by its id, for the refusal; undefined admits it.

Returns​

BlockDefinition<ZodObject<{ project: ZodObject<{ id: ZodString; visibility: ZodEnum<["shared", "private"]>; }, "strict", ZodTypeAny, { id: string; visibility: "shared" | "private"; }, { id: string; visibility: "shared" | "private"; }>; worker: ZodOptional<ZodString>; }, "strict", ZodTypeAny, { project: { id: string; visibility: "shared" | "private"; }; worker?: string; }, { project: { id: string; visibility: "shared" | "private"; }; worker?: string; }>, ZodObject<{ project: ZodObject<{ id: ZodString; visibility: ZodEnum<["shared", "private"]>; }, "strict", ZodTypeAny, { id: string; visibility: "shared" | "private"; }, { id: string; visibility: "shared" | "private"; }>; }, "strip", ZodTypeAny, { project: { id: string; visibility: "shared" | "private"; }; }, { project: { id: string; visibility: "shared" | "private"; }; }>, { project: { id: string; visibility: "shared" | "private"; }; worker?: string; }, { project: { id: string; visibility: "shared" | "private"; }; }>


defineStandardWorkerCollection()​

function defineStandardWorkerCollection(
standard,
defaultFlow,
shown?
): DefinedProjectedResourceCollection<JsonObject, ZodObject<{
description: ZodNullable<ZodString>;
flow: ZodString;
name: ZodNullable<ZodString>;
settings: ZodRecord<ZodString, ZodUnknown>;
teamName: ZodNullable<ZodString>;
}, "strip", ZodTypeAny, {
description: string | null;
flow: string;
name: string | null;
settings: Record<string, unknown>;
teamName: string | null;
}, {
description: string | null;
flow: string;
name: string | null;
settings: Record<string, unknown>;
teamName: string | null;
}>, JsonObject>;

The standard-worker projection, read from standard() on every read.

Parameters​

standard​

() => ReadonlyMap<string, WorkerManifest>

The installation's standard workers, by id.

defaultFlow​

string

The flow a worker that names none runs on.

shown?​

ShownSettingsOf

Which settings each flow shows (showSettings). Omitted, none.

Returns​

DefinedProjectedResourceCollection<JsonObject, ZodObject<{ description: ZodNullable<ZodString>; flow: ZodString; name: ZodNullable<ZodString>; settings: ZodRecord<ZodString, ZodUnknown>; teamName: ZodNullable<ZodString>; }, "strip", ZodTypeAny, { description: string | null; flow: string; name: string | null; settings: Record<string, unknown>; teamName: string | null; }, { description: string | null; flow: string; name: string | null; settings: Record<string, unknown>; teamName: string | null; }>, JsonObject>


defineSubscriptionServiceFlow()​

function defineSubscriptionServiceFlow(options): FlowInstance<NormalizedActions<{
}>, {
retention: {
maxAge: "24h";
};
}, RequestConfig | undefined, UserConfig | undefined, OrgConfig | undefined, object & object, undefined>;

Build a provider's service flow.

Parameters​

options​

SubscriptionServiceOptions

Returns​

FlowInstance<NormalizedActions<{ }>, { retention: { maxAge: "24h"; }; }, RequestConfig | undefined, UserConfig | undefined, OrgConfig | undefined, object & object, undefined>


defineWorkerCollection()​

function defineWorkerCollection(shown?): object & ResourceCollectionConfig<JsonObject> & object;

The user's worker collection: one row per worker, at user scope.

Shared across flows (flowIsolation: false): every flow that declares it reads the same roster, so a worker hired through one flow runs on another. A browser may read the user's own rows through a session of a flow that declares it, and sees each worker's flow, name, description and forkedFrom, and as settings only the ones its flow shows; its other settings and its instructions stay on the server.

Write a new worker with create(): it throws when the id is taken, and that throw is the refusal of a second hire under one id, racing ones included.

Parameters​

shown?​

ShownSettingsOf

Which settings each flow shows (showSettings). Omitted, none.

Returns​

object & ResourceCollectionConfig<JsonObject> & object


defineWorkerInventoryCollection()​

function defineWorkerInventoryCollection(): object & ResourceCollectionConfig<JsonObject> & object;

The worker inventory — one row per registered worker, at inventory/workers/*.

Install it under any block's resources map. Org-scoped: every flow in the org reads the same rows, and a flow under a different orgId reads none.

Takes no options. The prefix, the scope, the sharing and the browser read (see the module header) are the contract other layers join against, not app settings.

Returns​

object & ResourceCollectionConfig<JsonObject> & object

Example​

resources: { workers: defineWorkerInventoryCollection() }

defineWorkerRosterFlow()​

function defineWorkerRosterFlow(
installation,
actions?,
routines?
): FlowType<NormalizedActions<Record<string, ActionEntry>>, SessionConfig | undefined, {
onStarted: BlockDefinition<any, any, any, any>;
}, UserConfig | undefined, OrgConfig | undefined, {
inventoryWorkers: object & ResourceCollectionConfig<JsonObject> & object;
privateProjects: object & ResourceCollectionConfig<JsonObject> & object;
privateWorkstreams: ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object;
projects: object & ResourceCollectionConfig<JsonObject> & object;
"worker-usage": object & ResourceCollectionConfig<JsonObject> & object;
workforceMessageChains: object & ResourceCollectionConfig<JsonObject> & object;
workforceMessages: object & ResourceCollectionConfig<JsonObject> & object;
workforceScheduledFires: object & ResourceCollectionConfig<JsonObject> & object;
workforceSchedules: object & ResourceCollectionConfig<JsonObject> & object;
workforceStandardWorkers: DefinedProjectedResourceCollection<JsonObject>;
workforceSubscriptionCursors: object & ResourceCollectionConfig<JsonObject> & object;
workforceSubscriptionIndex: object & ResourceCollectionConfig<JsonObject> & object;
workforceSubscriptionPolls: object & ResourceCollectionConfig<JsonObject> & object;
workforceSubscriptions: object & ResourceCollectionConfig<JsonObject> & object;
workforceSubscriptionTaskEndings: object & ResourceCollectionConfig<JsonObject> & object;
workforceWorkers: object & ResourceCollectionConfig<JsonObject> & object;
workstreams: ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object;
}, undefined>;

Define the roster flow over installation. Register what it returns.

Parameters​

installation​

WorkerInstallation

The installation whose worker collections it declares.

actions?​

Record<string, ActionEntry>

Actions to mount on it, such as the hire, fork, edit and fire blocks (createWorkerHireBlocks). Omitted, it reads and writes nothing.

routines?​

The routine collections, the resolver clock fires go through (defineScheduledWork), the declared routines' seed, run as each request starts, and the routines view. Omitted, it keeps no routines.

resources​

Record<string, unknown>

schedules​

SchedulesConfig

seed?​

BlockDefinition<any, any, any, any>

view?​

ViewDefinition

Returns​

FlowType<NormalizedActions<Record<string, ActionEntry>>, SessionConfig | undefined, { onStarted: BlockDefinition<any, any, any, any>; }, UserConfig | undefined, OrgConfig | undefined, { inventoryWorkers: object & ResourceCollectionConfig<JsonObject> & object; privateProjects: object & ResourceCollectionConfig<JsonObject> & object; privateWorkstreams: ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object; projects: object & ResourceCollectionConfig<JsonObject> & object; "worker-usage": object & ResourceCollectionConfig<JsonObject> & object; workforceMessageChains: object & ResourceCollectionConfig<JsonObject> & object; workforceMessages: object & ResourceCollectionConfig<JsonObject> & object; workforceScheduledFires: object & ResourceCollectionConfig<JsonObject> & object; workforceSchedules: object & ResourceCollectionConfig<JsonObject> & object; workforceStandardWorkers: DefinedProjectedResourceCollection<JsonObject>; workforceSubscriptionCursors: object & ResourceCollectionConfig<JsonObject> & object; workforceSubscriptionIndex: object & ResourceCollectionConfig<JsonObject> & object; workforceSubscriptionPolls: object & ResourceCollectionConfig<JsonObject> & object; workforceSubscriptions: object & ResourceCollectionConfig<JsonObject> & object; workforceSubscriptionTaskEndings: object & ResourceCollectionConfig<JsonObject> & object; workforceWorkers: object & ResourceCollectionConfig<JsonObject> & object; workstreams: ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object; }, undefined>


defineWorkstreamBlocks()​

function defineWorkstreamBlocks(options): WorkstreamBlocks;

Build the workstream writes.

Parameters​

options​

WorkstreamBlocksOptions

Returns​

WorkstreamBlocks

Throws​

When a lead flow declares no onWorkstreamOpened entry.

Example​

const workstreams = defineWorkstreamBlocks({ installation, leadFlows: [agentFlow] });
defineFlow({ kind: PROJECTS_FLOW, actions: { ...projects.actions, ...workstreams.actions } });

defineWorkstreamsCollection()​

function defineWorkstreamsCollection(): ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object;

A shared project's workstream entries, at org scope.

Returns​

ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object


delegateAnswerMetadata()​

function delegateAnswerMetadata(answer): object;

The metadata a delegate's answer is emitted with: ctx.emit.message(answer, { agentName: worker, metadata: delegateAnswerMetadata({ worker, taskId }) }).

Parameters​

answer​

DelegateAnswer

Returns​

object

delegateAnswer​
delegateAnswer: DelegateAnswer;

delegateAnswerOf()​

function delegateAnswerOf(item): DelegateAnswer | undefined;

The delegate's answer a message item is, or undefined for any other item. An answer stored before its item carried the marker reads as undefined: nothing on it told a delegate's answer apart then, but a guess at its agentName.

Parameters​

item​

A stored or streamed item: a message's metadata.

metadata?​

Readonly<Record<string, unknown>>

type?​

string

Returns​

DelegateAnswer | undefined


deliveryMessageId()​

function deliveryMessageId(
object,
sessionId,
tenantId?
): string;

A delivery's message id: one object, at one version, for one session in its tenant (epic D4): sub_<object>@<version>:<session>, or sub_<object>@<version>@<tenant>:<session> under a tenant. A session id is unique only within its tenant, and every tenant's log rows share the user's cell. The object and the tenant are URI-encoded, so neither holds an @ or a : and the parts read back apart.

Parameters​

object​
id​

string

version​

number

sessionId​

string

tenantId?​

string

Returns​

string


deliveryText()​

function deliveryText(
event,
thread,
held,
forward?
): string;

The message a delivery sends: marked as outside content, so the recipient reads it as information, not instructions.

Parameters​

event​
addressed?​

true

at​

number

audience​

"private" | "public"

chain?​

string

closes?​

true

deliveryId?​

string

hop?​

number

kind​

string

labels​

string[]

object​

{ id: string; version: number; }

object.id​

string

object.version​

number

owner?​

{ tenantId?: string; userId: string; }

owner.tenantId?​

string

owner.userId​

string

provider​

string

received​

number

sender​

{ id: string; name: string; role: "bot" | "collaborator" | "member" | "outsider" | "unknown"; }

sender.id​

string

sender.name​

string

sender.role​

"bot" | "collaborator" | "member" | "outsider" | "unknown"

text​

string

threads​

string[]

title​

string

url​

string

thread​

string

held​

number

forward?​

"addressed" | "inferred"

Returns​

string


deriveWorkerSessionId()​

function deriveWorkerSessionId(input): Promise<string>;

The derived id for one worker session.

Every criteria key is part of it, sorted by name, so two lookups that name different criteria never share an id. A workstream and a project are taken in their one-string forms, so an object's key order can't change the id.

Parameters​

input​

DeriveWorkerSessionIdInput

The user, organization, flow and criteria.

Returns​

Promise<string>

An id starting with DERIVED_WORKER_SESSION_PREFIX.


describeShadowedReferences()​

function describeShadowedReferences(result): string;

The migration's result as one line for a deploy log.

Exported so the sentence is the same wherever it is printed, and because the caller that most needs it is a boot script that should not have to invent one. Bodies are not included — they can be a whole handbook; the result carries them for a caller that wants them.

A preview says would, and says it is a preview. That is the whole reason dryRun is on the result rather than only in the caller's memory.

Parameters​

result​

ClearShadowedReferencesResult

Returns​

string


doorTask()​

function doorTask<TShape, TKeys>(inputSchema): object;

Lets a door take the task a line is sent from. Spread into the respond action: it returns the door's input extended with an optional, non-empty taskId (a strict input stays strict), and the matching taskOf, so the engine stamps the id on the user's line and on every item the turn emits. Together, so a door can't take the key and forget to stamp it. A door that uses it does not also mark its scope with the same id.

The id is a label for the task's view. It never routes the line: a steer still picks the session's open task from server state.

Type Parameters​

TShape​

TShape extends ZodRawShape

TKeys​

TKeys extends UnknownKeysParam

Parameters​

inputSchema​

ZodObject<TShape, TKeys>

The door's own input, { message } at least.

Returns​

object

inputSchema​
inputSchema: ZodObject<extendShape<TShape, {
taskId: ZodOptional<ZodString>;
}>, TKeys, ZodTypeAny, objectOutputType<extendShape<TShape, {
taskId: ZodOptional<ZodString>;
}>, ZodTypeAny, TKeys>, objectInputType<extendShape<TShape, {
taskId: ZodOptional<ZodString>;
}>, ZodTypeAny, TKeys>>;
taskOf​
taskOf: (input) => string | undefined;
Parameters​
input​
taskId?​

string

Returns​

string | undefined


endTaskSubscriptions()​

function endTaskSubscriptions(
ctx,
taskId,
ending,
attempt?
): Promise<number>;

End the live and paused subscriptions a task's session made, when the task failed or was cancelled (ER-7 as amended): a paused one ends too, so no resume brings back a failed task's. A completed task's stay: its session keeps hearing its thread until the thread closes. It marks the task's ending before it sweeps, so a subscribe for the task that commits after the sweep ends too.

Parameters​

ctx​

BlockContext

taskId​

string

ending​

"errored" | "cancelled"

attempt?​

number

Returns​

Promise<number>


filingConversationBoard()​

function filingConversationBoard(ctx): Promise<
| {
filingFlow: string;
filingSession: string;
runEntry: string;
tasks: TaskCollectionRef;
}
| undefined>;

The board of the conversation a task session was opened for, and how to run that board in the conversation: its run entry, on the flow that filed the task. All three come from the session's readonly fields the hand-over wrote at its birth, never from a request. undefined outside a conversation's task session.

For a host's door over a worker's runs: the row the session works is on this board, and filingSession is the conversation that filed it.

Parameters​

ctx​

BlockContext

The running block's context, in the task session. Its flow must declare the conversation ledger (workerTaskEntry installs it).

Returns​

Promise< | { filingFlow: string; filingSession: string; runEntry: string; tasks: TaskCollectionRef; } | undefined>


fingerprintOf()​

function fingerprintOf(parts): Promise<string>;

A failure's fingerprint: a digest of its flow kind, action, block path, code and normalized message.

Parameters​

parts​

FingerprintParts

Returns​

Promise<string>


finishedTasksAnswerAgain()​

function finishedTasksAnswerAgain(options?): BlockDefinition<any, any>;

The pre-built source for the agent flow's answerAgain: take what finished (takeFinishedTasks), then turn the lines into the message the worker answers again about. {} when nothing finished, so the step answers no more. answerAgain: true is this with its default message.

Parameters​

options?​

FinishedTasksAnswerAgainOptions

Returns​

BlockDefinition<any, any>


followPullRequest()​

function followPullRequest(options): PullRequestFollower;

Build the follower: each newly recorded GitHub pull request subscribes the session to it.

Parameters​

options​

FollowPullRequestOptions

Returns​

PullRequestFollower


githubLoginsListed()​

function githubLoginsListed(document): string[];

The accounts a document lists, one to a Markdown list item (- octocat, * @octocat, - cursor[bot]), each lower-cased, a bot keeping its [bot]. Every other line, prose and headings included, names nobody.

Parameters​

document​

string | null | undefined

Returns​

string[]


githubReviewersDocument()​

function githubReviewersDocument(logins, options?): string;

The github-reviewers document's body for logins: what a save stores, and, with { unsaved: true }, the default that stands until the first save.

Parameters​

logins​

readonly string[]

options?​
unsaved?​

true

Returns​

string


githubServiceFlow()​

function githubServiceFlow(options): FlowInstance<NormalizedActions<{
}>, {
retention: {
maxAge: "24h";
};
}, RequestConfig | undefined, UserConfig | undefined, OrgConfig | undefined, object & object, undefined>;

Build GitHub's service flow, with its webhook service route.

Parameters​

options​

GitHubServiceFlowOptions

Returns​

FlowInstance<NormalizedActions<{ }>, { retention: { maxAge: "24h"; }; }, RequestConfig | undefined, UserConfig | undefined, OrgConfig | undefined, object & object, undefined>


githubSubscriptionProvider()​

function githubSubscriptionProvider(options): GitHubSubscriptionProvider;

Build GitHub's subscription provider.

Parameters​

options​

GitHubSubscriptionProviderOptions

Returns​

GitHubSubscriptionProvider


githubTrustedReviewers()​

function githubTrustedReviewers(options): GitHubTrustedReviewers;

The trusted GitHub reviewers: the one stored list, its default read from GITHUB_REVIEWERS now, at host start, its tool and its follow.

Parameters​

options​

GitHubTrustedReviewersOptions

Returns​

GitHubTrustedReviewers


githubTrustedReviewersScreen()​

function githubTrustedReviewersScreen(options): CustomScreen;

Build the screen.

Parameters​

options​

GitHubTrustedReviewersScreenOptions

Returns​

CustomScreen


hireWorkersCapability()​

function hireWorkersCapability(installation, checks?): DefinedCapability<"hireWorkers", Record<string, never>, "tools" | "default", Record<string, PresetDef<any>>, undefined, {
privateWorkstreams: ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object;
"worker-usage": object & ResourceCollectionConfig<JsonObject> & object;
workforceScheduledFires: object & ResourceCollectionConfig<JsonObject> & object;
workforceSchedules: object & ResourceCollectionConfig<JsonObject> & object;
workforceStandardWorkers: DefinedProjectedResourceCollection<JsonObject>;
workforceSubscriptionCursors: object & ResourceCollectionConfig<JsonObject> & object;
workforceSubscriptionIndex: object & ResourceCollectionConfig<JsonObject> & object;
workforceSubscriptionPolls: object & ResourceCollectionConfig<JsonObject> & object;
workforceSubscriptions: object & ResourceCollectionConfig<JsonObject> & object;
workforceSubscriptionTaskEndings: object & ResourceCollectionConfig<JsonObject> & object;
workforceWorkers: object & ResourceCollectionConfig<JsonObject> & object;
workstreams: ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object;
}, undefined, undefined, undefined> & object;

hire and fire over installation, as the capability hireWorkers. checks is what the roster's own hire is checked against: pass the app's hire config, the same the kit gives the roster flow.

Parameters​

installation​

WorkerInstallation

checks?​

HireChecks

Returns​

DefinedCapability<"hireWorkers", Record<string, never>, "tools" | "default", Record<string, PresetDef<any>>, undefined, { privateWorkstreams: ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object; "worker-usage": object & ResourceCollectionConfig<JsonObject> & object; workforceScheduledFires: object & ResourceCollectionConfig<JsonObject> & object; workforceSchedules: object & ResourceCollectionConfig<JsonObject> & object; workforceStandardWorkers: DefinedProjectedResourceCollection<JsonObject>; workforceSubscriptionCursors: object & ResourceCollectionConfig<JsonObject> & object; workforceSubscriptionIndex: object & ResourceCollectionConfig<JsonObject> & object; workforceSubscriptionPolls: object & ResourceCollectionConfig<JsonObject> & object; workforceSubscriptions: object & ResourceCollectionConfig<JsonObject> & object; workforceSubscriptionTaskEndings: object & ResourceCollectionConfig<JsonObject> & object; workforceWorkers: object & ResourceCollectionConfig<JsonObject> & object; workstreams: ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object; }, undefined, undefined, undefined> & object


intakeOccurrence()​

function intakeOccurrence(
reports,
raw,
options
): Promise<IntakeDecision>;

Take one occurrence: hold it, count it, or make a report for it, under the cap. The occurrence is redacted before anything of it is written.

Parameters​

reports​

ResourceCollectionRef

The report rows, as the running flow holds them.

raw​

| { actionName: string; at: number; blockName?: string; blockPath?: string; code?: string; flowKind: string; kind: "request"; message: string; orgId?: string; requestId: string; sessionId?: string; userId: string; } | { actionName: string; at: number; blockName?: string; blockPath?: string; code?: string; flowKind: string; kind: "held"; message: string; orgId?: string; requestId: string; sessionId?: string; taskId: string; userId: string; } | { assignee?: string; at: number; attempt: number; boardId: string; error: string; goal?: string; kind: "task"; orgId?: string; partition?: string; requestId?: string; sessionId?: string; taskId: string; title?: string; userId: string; } | { at: number; description: string; kind: "manual"; named?: { project?: string; sessionId?: string; taskId?: string; }; orgId?: string; sessionId: string; userId: string; }

options​

The reporter's own flow (never reported), the limits, and the values no row may hold.

limits?​

Partial<ReportLimits>

log?​

(message) => void

Where a history write that failed is said; the intake still returns its decision.

reporterFlow​

string

secrets?​

readonly string[]

Returns​

Promise<IntakeDecision>


internalServiceFlow()​

function internalServiceFlow(options): InternalServiceFlow;

Build the internal service flow: its flow, its provider, and publishEvent.

const internal = internalServiceFlow({ installation, topics: {
"deploy.finished": { kinds: ["succeeded", "failed"], data: z.object({ service: z.string(), sha: z.string() }) },
} });
hireWorkforce(installation, { routines: { providers: [github, internal.provider] } });

Parameters​

options​

InternalServiceFlowOptions

Returns​

InternalServiceFlow


inventoryWorkers()​

function inventoryWorkers(installation): InventoryWorker[];

The installation's standard workers as openInventory takes workers: each worker's id, the flow it runs on, and that flow's actions, which its door is read from. The org's inventory lists these, the workers every user has; a user's own workers are theirs, on their roster.

Parameters​

installation​

WorkerInstallation

Returns​

InventoryWorker[]


inventoryWriterActions()​

function inventoryWriterActions(): object;

The block that writes the worker entries, keyed by its action name.

It refuses an org-less request by name. The inventory is org-scoped storage, so without an org there is nothing to write in — and the resource registry would report the collection as unregistered, which sends a reader to check a registration that is fine.

Returns​

object

The entry, keyed by INVENTORY_REGISTER_WORKERS. The block declares the collection it writes, so installing the entry installs the collection too. Spread it into internal.actions, never actions: its whole input is caller-supplied row data with nothing to check it against, so a public caller could write fabricated worker entries.

registerWorkersInInventory​
registerWorkersInInventory: object;
registerWorkersInInventory.block​
block: BlockDefinition<ZodObject<{
workers: ZodArray<ZodObject<{
door: ZodDefault<ZodNullable<ZodString>>;
doorTakesTask: ZodDefault<ZodBoolean>;
hired: ZodDefault<ZodNullable<ZodBoolean>>;
id: ZodString;
incarnation: ZodDefault<ZodNullable<ZodString>>;
kind: ZodString;
name: ZodDefault<ZodNullable<ZodString>>;
rules: ZodDefault<ZodBoolean>;
teamName: ZodDefault<ZodNullable<ZodString>>;
}, "strip", ZodTypeAny, {
door: string | null;
doorTakesTask: boolean;
hired: boolean | null;
id: string;
incarnation: string | null;
kind: string;
name: string | null;
rules: boolean;
teamName: string | null;
}, {
door?: string | null;
doorTakesTask?: boolean;
hired?: boolean | null;
id: string;
incarnation?: string | null;
kind: string;
name?: string | null;
rules?: boolean;
teamName?: string | null;
}>, "many">;
}, "strict", ZodTypeAny, {
workers: object[];
}, {
workers: object[];
}>, ZodObject<{
written: ZodNumber;
}, "strip", ZodTypeAny, {
written: number;
}, {
written: number;
}>, {
workers: object[];
}, {
written: number;
}>;
registerWorkersInInventory.description​
description: string;

Example​

defineFlow({
kind: "inventory-writer",
internal: { actions: { ...inventoryWriterActions() } }
});

isDerivedWorkerSessionId()​

function isDerivedWorkerSessionId(sessionId): boolean;

Whether sessionId has the shape of a derived worker-session id. A create at such an id must be the creating user's own derivation.

Parameters​

sessionId​

string

Returns​

boolean


isMcpServerName()​

function isMcpServerName(value): value is string;

Whether value is a bare MCP server name.

Parameters​

value​

unknown

Returns​

value is string


isUserTurn()​

function isUserTurn(ctx): boolean;

Whether this request is a turn a user's own message started.

Parameters​

ctx​

BlockContext

Returns​

boolean


linkedProjectOf()​

function linkedProjectOf(state):
| {
id: string;
visibility: "shared" | "private";
}
| undefined;

The project a session is linked to by its readonly projectId, or undefined.

Parameters​

state​

unknown

Returns​

| { id: string; visibility: "shared" | "private"; } | undefined


mcpCredentialProblem()​

function mcpCredentialProblem(value): string | undefined;

Why value can't be stored as a key, or undefined when it can. Empty, too long, or holding whitespace or a control character. Never repeats the value.

Parameters​

value​

unknown

Returns​

string | undefined


mergeWorkerFlows()​

function mergeWorkerFlows<F, S>(flows, workers): Record<string, F | S>;

Add workers to flows under their ids, refusing any collision.

Type Parameters​

F​

F

S​

S extends object

Parameters​

flows​

Record<string, F>

The app's own flows, by id (an app's worker flow, or any other flow).

workers​

readonly S[]

The hired workers, from hireWorkforce.

Returns​

Record<string, F | S>

A new record holding both; flows is not changed.

Throws​

If a worker's id is already a key of flows, or two workers share an id. The message names the id and says to rename the worker's folder.


messageReceivedEntry()​

function messageReceivedEntry(options): object;

Build the onMessageReceived entry for a flow: spread it under internal: { actions: { onMessageReceived: messageReceivedEntry({ ... }) } }. The session factory's entries(turn) spreads it already.

Parameters​

options​
flowKind​

string

hears?​

"task-sessions"

Where the worker hears messages; see MessageHearing.

installation​

WorkerInstallation

landsOnly?​

(ctx, message) => boolean | Promise<boolean>

Whether this landed message runs no turn: it lands as its items only, as on a flow with no turn. Read after the take, from the message the server wrote.

turn?​

BlockDefinition<any, any, any, any>

The flow's turn for a message (MessageReceived in). Absent, the message lands as its items and nothing runs.

Returns​

object

block​
block: SequencerDefinition<{
messageId: string;
}, {
act: "none" | "heard" | "landed";
received?: {
budget: number;
from: string;
id: string;
inReplyTo?: string;
replyRequested?: boolean;
text: string;
};
}, undefined, undefined>;
concurrency​
concurrency: object;
concurrency.key​
readonly key: (ctx) => string | undefined;
Parameters​
ctx​

ConcurrencyKeyContext

Returns​

string | undefined

concurrency.policy​
readonly policy: "defer";
inputSchema​
inputSchema: ZodObject<{
messageId: ZodString;
}, "strict", ZodTypeAny, {
messageId: string;
}, {
messageId: string;
}>;

normalizeErrorMessage()​

function normalizeErrorMessage(message): string;

A message with its ids, numbers and paths taken out, lower-cased, with whitespace collapsed: what is left is the words that say what went wrong.

Parameters​

message​

string

Returns​

string


normalizeGitHubEvent()​

function normalizeGitHubEvent(input, options?): object[];

One GitHub event as zero or more normalized events. Pinned: the webhook route and the poll call this one function.

Parameters​

input​

GitHubEventInput

options?​

GitHubNormalizeOptions

Returns​

object[]


openInventory()​

function openInventory(roster, options): Promise<InventoryBinding>;

Fill the org's live inventory: one row per hired worker.

Re-running over an unchanged roster is a no-op: every write is keyed by the record's own id, so nothing duplicates and nothing appends.

Parameters​

roster​

InventoryRoster

The hired workers.

options​

OpenInventoryOptions

run: the action door. workerWriter: the flow the worker entries are written through. userId / orgId: who and where.

Returns​

Promise<InventoryBinding>

What was written, and one named entry per failure. Nothing is retried.

Throws​

If no orgId was given, or if the roster carries workers and no workerWriter was named. Both are wiring mistakes an app should not boot past — a run that continued would report success and write where nobody can read. An app with no authentication passes DEFAULT_ORG_ID explicitly; it is the absent value, not that one, that is refused.


operatorGitHub()​

function operatorGitHub(options): OperatorGitHub;

GitHub's subscription provider, reading GitHub with the operator's token for the operator alone. A GitHub routine asked for with no token, or by any user but the operator, is refused at subscribe, naming GITHUB_TOKEN, and saves nothing; a poll for anyone else reads nothing.

Parameters​

options​

OperatorGitHubOptions

Returns​

OperatorGitHub


operatorGitHubToken()​

function operatorGitHubToken(env?): string | undefined;

The operator's GitHub token: GITHUB_TOKEN, else what gh auth token answers, read once at start and never from a request. undefined when neither has one.

Parameters​

env?​

any

Returns​

string | undefined


parseDeclaredWorkerId()​

function parseDeclaredWorkerId(workerId): DeclaredWorkerId | undefined;

Read a declared worker's id back into the folders it was minted from.

The one rule every reader that needs a worker's team uses, so none of them splits an id on its own. The loader mints two shapes:

  • "<name>" — no dot: an org worker, declared at org/workers/<name>/;
  • "<teamId>.<name>" — a team worker, at teams/<teamId>/workers/<name>/.

The split is at the first dot. Neither folder name may hold a ., so the two shapes never overlap, and an id with a second dot is neither.

Both halves are held to the segment rule the loader mints by (validateSegment), so an id the loader could not have minted — Bad_Name, eng.Lead, an empty half, a /, a second dot — names no worker rather than being placed.

Parameters​

workerId​

string

The worker's declared id: a record's workerId ?? id. Never a runtime hire's id, which is its org-qualified address.

Returns​

DeclaredWorkerId | undefined

The folders, or undefined for an id the loader cannot mint.

Example​

parseDeclaredWorkerId("shift-coordinator"); // { name: "shift-coordinator" }
parseDeclaredWorkerId("eng.lead"); // { team: "eng", name: "lead" }

parseProjectRef()​

function parseProjectRef(ref): ProjectAddressRef | undefined;

The address a projectRef names, or undefined when it names none.

Parameters​

ref​

string

Returns​

ProjectAddressRef | undefined


parseWorkerResourceState()​

function parseWorkerResourceState(value):
| {
worker: {
additionalInstructions: string | null;
description: string | null;
flow: string;
forkedFrom: string | null;
instructions: string | null;
name: string | null;
settings: Record<string, unknown>;
skills: string[];
teamInstructions: string | null;
};
}
| {
problem: string;
};

Parse one stored value as a worker, or say why it can't be read. Never throws and never writes.

Parameters​

value​

unknown

Returns​

| { worker: { additionalInstructions: string | null; description: string | null; flow: string; forkedFrom: string | null; instructions: string | null; name: string | null; settings: Record<string, unknown>; skills: string[]; teamInstructions: string | null; }; } | { problem: string; }


parseWorkstreamEntry()​

function parseWorkstreamEntry(path, state): ParsedWorkstreamEntry | undefined;

Parse the entry stored at path: its place read off the key, its fields checked against workstreamEntrySchema. undefined for a path that is not a direct entry of a project. The one parser for an entry, shared by readProject on the server and an app's browser read of the same rows, so the two can't drift.

Parameters​

path​

string

The entry's storage key, workstreams/<project>/<~owner>/<id>.

state​

unknown

The entry's stored state, or what a browser read publishes of it.

Returns​

ParsedWorkstreamEntry | undefined

Throws​

ZodError when the state is not an entry.


parseWorkstreamRef()​

function parseWorkstreamRef(ref): WorkstreamAddress | undefined;

The address a workstreamRef names, or undefined when it names none.

Parameters​

ref​

string

Returns​

WorkstreamAddress | undefined


placeOfReference()​

function placeOfReference(ref): TreePlace | undefined;

Read a reference's ref back into the place its file sits.

The inverse of mintResourceRef, and total: anything that is not one of the four shapes the minter produces returns undefined, which the wall reads as unreachable. Denying an unrecognised shape is the safe direction — a hand-built catalog can hold any string, and a permission boundary that guesses at one it does not recognise is a boundary that can be talked past.

The four shapes, and the two length rules that keep them apart:

  • <name> — the org level
  • teams/<teamId>/<name> — a team's
  • workers/<worker>/<name> — an org worker's
  • teams/<teamId>/workers/<worker>/<name> — a team worker's

A workers first segment is only read as the workers LEVEL when exactly two segments follow it. Otherwise a document legitimately named workers, which mints teams/eng/workers, would be misread as a malformed worker address.

Parameters​

ref​

string

A reference's ref, as the loader minted it.

Returns​

TreePlace | undefined

Where its file sits, or undefined if the ref is not a shape the convention mints.


placeOfWorker()​

function placeOfWorker(workerId): TreePlace | undefined;

Read a worker's id back into the place its folder sits.

Through parseDeclaredWorkerId: an org worker ("<name>") sits at org/workers/<name>/, a team worker ("<teamId>.<name>") at teams/<teamId>/workers/<name>/.

Returns undefined for an id the loader cannot mint, so there is no folder to place it at and no honest answer to what is above it; workerHasNoPlaceMessage is what the caller does with it.

Parameters​

workerId​

string

The worker's id, as the roster minted it.

Returns​

TreePlace | undefined

Where the worker sits, or undefined if the id names no place.


projectChecks()​

function projectChecks(): ProjectChecksResolver;

The resolver. The run's context must hold the collections projectWorkspaceCapability installs, as a run on projectWorkspace() does.

Returns​

ProjectChecksResolver


projectFilesPrefix()​

function projectFilesPrefix(projectId): string;

The key prefix of one project's files, relative to the collection: <projectId>/. The trailing slash is what keeps apollo from reading apollo2's files.

Parameters​

projectId​

string

Returns​

string


projectMcpCapability()​

function projectMcpCapability(servers, options?): DefinedCapability<"projectMcp", Record<string, never>, "tools" | "default", Record<string, PresetDef<any>>, undefined, undefined, undefined, undefined, undefined> & object;

Build the capability that gives a worker its conversation's project MCP servers as tools.

Parameters​

servers​

ProjectMcpServers

The servers the host offers, by name: the same map projectMcpTools takes.

options?​

ProjectMcpCapabilityOptions

operator, allow, idleMs.

Returns​

DefinedCapability<"projectMcp", Record<string, never>, "tools" | "default", Record<string, PresetDef<any>>, undefined, undefined, undefined, undefined, undefined> & object

A capability named projectMcp with one preset, tools, off by default. Pass it on the worker flow's uses (defineAgentWorkerFlow({ uses }), or defineCoordinatorFlow({ agent: { uses } })).

Throws​

When built, for a server entry projectMcpTools refuses, or an idleMs that isn't a positive whole number.

Example​

defineCoordinatorFlow({
installation,
agent: { uses: [projectMcpCapability({ linear: { url: "https://mcp.linear.app/mcp", seedEnv: "LINEAR_API_KEY" } })] }
});

projectMcpTools()​

function projectMcpTools(servers, options?): ProjectMcpToolsResolver;

Build the resolver for a coding harness's per-run MCP tools.

The block that calls it must hold projectWorkspaceCapability and mcpCredentialsCapability: the project read and the keys.

Parameters​

servers​

ProjectMcpServers

The servers the host offers, by name.

options?​

ProjectMcpToolsOptions

operator, the user seedEnv stands in for.

Returns​

ProjectMcpToolsResolver

A resolver answering { [name]: { tools, close } } for one run, and its named, the servers a run's project names.

Throws​

When built, for a name that isn't a bare name, an address that isn't an HTTP(S) URL, or a seedEnv that isn't a variable name. The message names the entry, never the address.

Example​

claudeCodeAgent({
uses: [projectWorkspaceCapability, mcpCredentialsCapability],
mcpTools: projectMcpTools({ linear: { url: "https://mcp.linear.app/mcp" } }, { operator: "u_ops" }),
});

projectProgress()​

function projectProgress(entries, now): ProjectProgress;

Work out a project's progress from its entries.

Parameters​

entries​

readonly ProgressEntry[]

The project's entries, as one prefix read returned them.

now​

number

The time to judge staleness against, in milliseconds. A caller passes the clock's; a test passes its own.

Returns​

ProjectProgress


projectRef()​

function projectRef(project): string;

<visibility>/<projectId>: a project's address as one string, what a project coordinator session's readonly projectId field carries.

Parameters​

project​

ProjectAddressRef

Returns​

string


projectSourceCapability()​

function projectSourceCapability(options): DefinedCapability<"projectSource", Record<string, never>, "read" | "default", Record<string, PresetDef<any>>, undefined, undefined, undefined, undefined, undefined> & object;

The capability a worker flow installs so its workers can read their session's project.

Its one preset, read, is off until a worker's own file names it:

capabilities:
projectSource: [read]

It carries projectWorkspaceCapability, whose collections the run source reads.

Parameters​

options​

ProjectSourceCapabilityOptions

workspace: the host the app's coding runs use.

Returns​

DefinedCapability<"projectSource", Record<string, never>, "read" | "default", Record<string, PresetDef<any>>, undefined, undefined, undefined, undefined, undefined> & object

Throws​

When the host has no read view (readSource).

Example​

const workspace = localWorkspaceHost({ root, remotes: { allow: ["github.com"] }, source: projectWorkspace() });
defineAgentWorkerFlow({ installation, model, uses: [projectSourceCapability({ workspace })] });

projectSourceTools()​

function projectSourceTools(workspace): object;

The three read tools over workspace, for the session's project. An app installs them through the capability, or, for workers that write a tools: line, puts them in its worker flow's catalog and uses projectWorkspaceCapability, whose collections they read.

Parameters​

workspace​

WorkspaceHost

Returns​

object

globProjectSource​
globProjectSource: BlockDefinition<ZodObject<{
limit: ZodDefault<ZodNullable<ZodNumber>>;
pattern: ZodDefault<ZodNullable<ZodString>>;
}, "strip", ZodTypeAny, {
limit: number | null;
pattern: string | null;
}, {
limit?: number | null;
pattern?: string | null;
}>, ZodUnion<[ZodObject<{
kind: ZodLiteral<"refused">;
message: ZodString;
reason: ZodString;
}, "strip", ZodTypeAny, {
kind: "refused";
message: string;
reason: string;
}, {
kind: "refused";
message: string;
reason: string;
}>, ZodObject<{
at: ZodUnion<[ZodObject<{
ageMs: ZodNullable<...>;
branch: ZodString;
commit: ZodString;
fetchedAt: ZodNullable<...>;
kind: ZodLiteral<...>;
}, "strip", ZodTypeAny, {
ageMs: ... | ...;
branch: string;
commit: string;
fetchedAt: ... | ...;
kind: "repo";
}, {
ageMs: ... | ...;
branch: string;
commit: string;
fetchedAt: ... | ...;
kind: "repo";
}>, ZodObject<{
kind: ZodLiteral<...>;
}, "strip", ZodTypeAny, {
kind: "files";
}, {
kind: "files";
}>]>;
cut: ZodNullable<ZodObject<{
by: ZodEnum<[..., ..., ..., ..., ...]>;
left: ZodNumber;
}, "strip", ZodTypeAny, {
by: "paths" | "lines" | "bytes" | "matches" | "limit";
left: number;
}, {
by: "paths" | "lines" | "bytes" | "matches" | "limit";
left: number;
}>>;
kind: ZodLiteral<"glob">;
paths: ZodArray<ZodString, "many">;
}, "strip", ZodTypeAny, {
at: | {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}
| {
kind: "files";
};
cut: | {
by: "paths" | "lines" | "bytes" | "matches" | "limit";
left: number;
}
| null;
kind: "glob";
paths: string[];
}, {
at: | {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}
| {
kind: "files";
};
cut: | {
by: "paths" | "lines" | "bytes" | "matches" | "limit";
left: number;
}
| null;
kind: "glob";
paths: string[];
}>]>, {
limit: number | null;
pattern: string | null;
}, never>;
grepProjectSource​
grepProjectSource: BlockDefinition<ZodObject<{
maxResults: ZodDefault<ZodNullable<ZodNumber>>;
pattern: ZodString;
prefix: ZodDefault<ZodNullable<ZodString>>;
}, "strip", ZodTypeAny, {
maxResults: number | null;
pattern: string;
prefix: string | null;
}, {
maxResults?: number | null;
pattern: string;
prefix?: string | null;
}>, ZodUnion<[ZodObject<{
kind: ZodLiteral<"refused">;
message: ZodString;
reason: ZodString;
}, "strip", ZodTypeAny, {
kind: "refused";
message: string;
reason: string;
}, {
kind: "refused";
message: string;
reason: string;
}>, ZodObject<{
at: ZodUnion<[ZodObject<{
ageMs: ZodNullable<...>;
branch: ZodString;
commit: ZodString;
fetchedAt: ZodNullable<...>;
kind: ZodLiteral<...>;
}, "strip", ZodTypeAny, {
ageMs: ... | ...;
branch: string;
commit: string;
fetchedAt: ... | ...;
kind: "repo";
}, {
ageMs: ... | ...;
branch: string;
commit: string;
fetchedAt: ... | ...;
kind: "repo";
}>, ZodObject<{
kind: ZodLiteral<...>;
}, "strip", ZodTypeAny, {
kind: "files";
}, {
kind: "files";
}>]>;
binary: ZodLiteral<"skipped">;
cut: ZodNullable<ZodObject<{
by: ZodEnum<[..., ..., ..., ..., ...]>;
left: ZodNumber;
}, "strip", ZodTypeAny, {
by: "paths" | "lines" | "bytes" | "matches" | "limit";
left: number;
}, {
by: "paths" | "lines" | "bytes" | "matches" | "limit";
left: number;
}>>;
dialect: ZodEnum<["extended-regex", "javascript-regex", "literal"]>;
kind: ZodLiteral<"grep">;
matches: ZodArray<ZodObject<{
line: ZodNumber;
path: ZodString;
snippet: ZodString;
}, "strip", ZodTypeAny, {
line: number;
path: string;
snippet: string;
}, {
line: number;
path: string;
snippet: string;
}>, "many">;
}, "strip", ZodTypeAny, {
at: | {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}
| {
kind: "files";
};
binary: "skipped";
cut: | {
by: "paths" | "lines" | "bytes" | "matches" | "limit";
left: number;
}
| null;
dialect: "extended-regex" | "javascript-regex" | "literal";
kind: "grep";
matches: object[];
}, {
at: | {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}
| {
kind: "files";
};
binary: "skipped";
cut: | {
by: "paths" | "lines" | "bytes" | "matches" | "limit";
left: number;
}
| null;
dialect: "extended-regex" | "javascript-regex" | "literal";
kind: "grep";
matches: object[];
}>]>, {
maxResults: number | null;
pattern: string;
prefix: string | null;
}, never>;
readProjectSource​
readProjectSource: BlockDefinition<ZodObject<{
endLine: ZodDefault<ZodNullable<ZodNumber>>;
path: ZodString;
startLine: ZodDefault<ZodNullable<ZodNumber>>;
}, "strip", ZodTypeAny, {
endLine: number | null;
path: string;
startLine: number | null;
}, {
endLine?: number | null;
path: string;
startLine?: number | null;
}>, ZodUnion<[ZodObject<{
kind: ZodLiteral<"refused">;
message: ZodString;
reason: ZodString;
}, "strip", ZodTypeAny, {
kind: "refused";
message: string;
reason: string;
}, {
kind: "refused";
message: string;
reason: string;
}>, ZodObject<{
at: ZodUnion<[ZodObject<{
ageMs: ZodNullable<...>;
branch: ZodString;
commit: ZodString;
fetchedAt: ZodNullable<...>;
kind: ZodLiteral<...>;
}, "strip", ZodTypeAny, {
ageMs: ... | ...;
branch: string;
commit: string;
fetchedAt: ... | ...;
kind: "repo";
}, {
ageMs: ... | ...;
branch: string;
commit: string;
fetchedAt: ... | ...;
kind: "repo";
}>, ZodObject<{
kind: ZodLiteral<...>;
}, "strip", ZodTypeAny, {
kind: "files";
}, {
kind: "files";
}>]>;
bytes: ZodOptional<ZodNumber>;
content: ZodOptional<ZodString>;
cut: ZodOptional<ZodNullable<ZodObject<{
by: ZodEnum<...>;
left: ZodNumber;
}, "strip", ZodTypeAny, {
by: ... | ... | ... | ... | ...;
left: number;
}, {
by: ... | ... | ... | ... | ...;
left: number;
}>>>;
endLine: ZodOptional<ZodNumber>;
kind: ZodLiteral<"read">;
path: ZodString;
startLine: ZodOptional<ZodNumber>;
status: ZodEnum<["ok", "missing", "directory", "binary", "too-large"]>;
totalLines: ZodOptional<ZodNumber>;
}, "strip", ZodTypeAny, {
at: | {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}
| {
kind: "files";
};
bytes?: number;
content?: string;
cut?: | {
by: "paths" | "lines" | "bytes" | "matches" | "limit";
left: number;
}
| null;
endLine?: number;
kind: "read";
path: string;
startLine?: number;
status: "ok" | "missing" | "directory" | "binary" | "too-large";
totalLines?: number;
}, {
at: | {
ageMs: number | null;
branch: string;
commit: string;
fetchedAt: string | null;
kind: "repo";
}
| {
kind: "files";
};
bytes?: number;
content?: string;
cut?: | {
by: "paths" | "lines" | "bytes" | "matches" | "limit";
left: number;
}
| null;
endLine?: number;
kind: "read";
path: string;
startLine?: number;
status: "ok" | "missing" | "directory" | "binary" | "too-large";
totalLines?: number;
}>]>, {
endLine: number | null;
path: string;
startLine: number | null;
}, never>;

projectTools()​

function projectTools(blocks): object;

The project writes and the project list as tools, listProjects, createProject, setRepository and setBrief, over blocks.

listProjects is how a worker knows which project a coder's task works in: the projects the user is a member of, read when asked, never guessed. The owner of a project createProject makes is the session's user, who is always a member; members adds whoever they name.

Parameters​

blocks​

ProjectBlocks

The host's project blocks (defineProjectBlocks()), the same ones its projects flow runs.

Returns​

object

createProject​
createProject: SequencerDefinition<{
brief?: string;
checks?: string[];
id: string;
members?: string[];
repository?: string | null;
title: string;
visibility?: "shared" | "private";
}, {
created: boolean;
project: {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
};
visibility: "shared" | "private";
}, undefined, undefined>;
listProjects​
listProjects: SequencerDefinition<{
}, {
forCoding: string;
projects: object[];
}, undefined, undefined>;
setBrief​
setBrief: BlockDefinition<ZodObject<{
brief: ZodNullable<ZodString>;
project: ZodOptional<ZodObject<{
id: ZodString;
visibility: ZodEnum<["shared", "private"]>;
}, "strict", ZodTypeAny, {
id: string;
visibility: "shared" | "private";
}, {
id: string;
visibility: "shared" | "private";
}>>;
}, "strict", ZodTypeAny, {
brief: string | null;
project?: {
id: string;
visibility: "shared" | "private";
};
}, {
brief: string | null;
project?: {
id: string;
visibility: "shared" | "private";
};
}>, ZodObject<{
project: ZodObject<{
brief: ZodDefault<ZodNullable<ZodString>>;
checks: ZodDefault<ZodArray<ZodString, "many">>;
id: ZodString;
mcpServers: ZodDefault<ZodArray<ZodString, "many">>;
members: ZodDefault<ZodArray<ZodString, "many">>;
ownerUserId: ZodString;
repository: ZodDefault<ZodNullable<ZodString>>;
status: ZodDefault<ZodString>;
title: ZodString;
}, "strip", ZodTypeAny, {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
}, {
brief?: string | null;
checks?: string[];
id: string;
mcpServers?: string[];
members?: string[];
ownerUserId: string;
repository?: string | null;
status?: string;
title: string;
}>;
}, "strip", ZodTypeAny, {
project: {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
};
}, {
project: {
brief?: string | null;
checks?: string[];
id: string;
mcpServers?: string[];
members?: string[];
ownerUserId: string;
repository?: string | null;
status?: string;
title: string;
};
}>, {
brief: string | null;
project?: {
id: string;
visibility: "shared" | "private";
};
}, {
project: {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
};
}>;
setRepository​
setRepository: SequencerDefinition<{
project?: {
id: string;
visibility: "shared" | "private";
};
repository: string | null;
}, {
project: {
brief: string | null;
checks: string[];
id: string;
mcpServers: string[];
members: string[];
ownerUserId: string;
repository: string | null;
status: string;
title: string;
};
}, undefined, undefined>;

projectWorkspace()​

function projectWorkspace(options?): RunSource;

The run source for coding runs on a project.

Answers { kind: "repo", repo, projectId, files } for a project with a repository, { kind: "files", projectId, files } for one with none, or a refusal (ProjectWorkspaceRefusalReason). A shared project named in checkouts, in the run's own organization and tenant and on the entry's remote, is answered with the entry's checkout as its repo and the entry's baseRef.

Parameters​

options?​

ProjectWorkspaceOptions

checkouts: see ProjectCheckout.

Returns​

RunSource

A RunSource to hand localWorkspaceHost({ source }).

Throws​

When called, for a checkout that isn't an absolute path, a remote a project's entry couldn't store, or a project (organization, tenant and id) named twice, naming the entry. When asked, if the block asking does not hold projectWorkspaceCapability.

Example​

harnessManager({
workspace: localWorkspaceHost({ root, remotes: { allow: ["github.com"] }, source: projectWorkspace() }),
uses: [projectWorkspaceCapability],
// ...
});

promptedMessageTurn()​

function promptedMessageTurn(turn, name?): SequencerDefinition<{
budget: number;
from: string;
id: string;
inReplyTo?: string;
replyRequested?: boolean;
text: string;
}, any, undefined, undefined>;

A turn that takes { message } as a turn for messageReceivedEntry: its input is receivedMessagePrompt's text.

Parameters​

turn​

BlockDefinition<any, any>

name?​

string

Returns​

SequencerDefinition<{ budget: number; from: string; id: string; inReplyTo?: string; replyRequested?: boolean; text: string; }, any, undefined, undefined>


readWorkerUsage()​

function readWorkerUsage(
ctx,
days,
onRoster,
now?
): Promise<WorkerUsageView[]>;

Read days UTC days of the caller's records, ending today, as one row per worker. Marks a worker gone when it is not in onRoster.

Parameters​

ctx​
resources?​

unknown

days​

number

onRoster​

ReadonlySet<string>

now?​

number

Returns​

Promise<WorkerUsageView[]>


receivedMessagePrompt()​

function receivedMessagePrompt(received): string;

The text a model's turn reads for a received message: who wrote, which message, and how to answer it. For a flow whose turn takes { message }.

Parameters​

received​
budget​

number

from​

string

id​

string

inReplyTo?​

string

replyRequested?​

boolean

text​

string

Returns​

string


recordWorkerSpend()​

function recordWorkerSpend(
ctx,
worker,
spend,
at?
): Promise<void>;

Add what one request spent to worker's record for the UTC day at falls on. The only writer of worker-usage/**. Atomic: concurrent writes for one record both land. Writes nothing when the request spent nothing.

Parameters​

ctx​
resources?​

unknown

worker​

string

spend​

RequestSpend

at?​

number

Returns​

Promise<void>


redact()​

function redact<T>(value, secrets): T;

value with every secret taken out of every string in it, at any depth. Object keys are kept; a value that is not a string, array or plain object is kept as it is.

Type Parameters​

T​

T

Parameters​

value​

T

secrets​

readonly string[]

Values to take out wherever they appear (longest first is not required).

Returns​

T


referenceBody()​

function referenceBody(raw): string;

Serve the document, not the file.

contentFile hands the engine the bytes on disk, frontmatter and all, while a resources/ document is installed with its parsed body. Without this a reference would read as ---\ndescription: …\n---\n followed by the handbook, which is a content change nobody asked for and one every prompt would carry.

The SAME splitFrontmatter the loader parses with, deliberately: a second way of finding where the body starts is a way for the two to disagree about a file with --- in it.

Applied per read, over the string the context already holds — no disk I/O, so a grep across a hundred references costs what it costs today.

Parameters​

raw​

string

Returns​

string


referenceReachableByWorker()​

function referenceReachableByWorker(worker, reference): boolean;

Whether a worker can reach a reference: is the reference's folder at or above the worker's place?

Three ways yes, and nothing else:

  • the org level is above everyone;
  • the worker's own team's folder (a team worker's);
  • the worker's own worker folder — under its team, or under org/workers/ for an org worker.

Everything else is no, and the two that matter are the ones a user expects to be yes and should not be: another team's folder, and a sibling worker's folder on the same team. The walk inherits downward only — a sibling's folder is not above anyone.

An org WORKER's folder (workers/<w>/<name>) is also no to every worker but that org worker, for the same reason: it is an address beside the org level, not above anyone else. And an org worker has no team, so no team's folder is above it.

Parameters​

worker​

TreePlace

reference​

TreePlace

Returns​

boolean


referencesFromDocs()​

function referencesFromDocs(references): DeclaredResources;

Build the resource map from reference records, keyed by each one's ref.

The accessor key is the ref, so a team's handbook reaches a block as ctx.resources["teams/engineering/handbook"] — the same namespace a resources/ document lands in, which is what makes a basename claimed by both refusable rather than silently resolved.

Every entry here is org-scoped, the same as resourcesFromDocs's. Nothing needs declaring for that: organization identity is unconditional, so the org resource registry is always built.

Throws rather than collecting, matching the mutable install half: a reference that cannot become a resource is startup misconfiguration.

Parameters​

references​

ResourceDoc[]

Records from readReferencesDirectory, or hand-built ones carrying an absolute ResourceDoc.filePath.

Returns​

DeclaredResources

The L1 map, keyed by ref.

Throws​

If a record declares a derived setting, carries no file path, or defineResource rejects its frontmatter.


refusedOnContent()​

function refusedOnContent(verdict): boolean;

Whether a verdict refused the event on its content. interest: unjudged, a screen that failed (marked failed), and no verdict are not, so an outage leaves an event unheard by nobody's choice, never forwarded (D1).

Parameters​

verdict​
failed?​

true

pass​

boolean

reason​

string

subscription​

string

Returns​

boolean


resourcesFromDocs()​

function resourcesFromDocs(documents): DeclaredResources;

Build the resource map from document records, keyed by each document's ref.

The accessor key is the ref, so a team's handbook reaches a block as ctx.resources["teams/engineering/handbook"].

Every document here is org-scoped. Nothing needs declaring for that to work: organization identity is unconditional, so every admitted request carries one and the org resource registry is always built. The requireOrg declaration this used to depend on no longer exists.

Throws, rather than collecting, when a record cannot become a resource — a declaration the convention derives, or frontmatter defineResource itself rejects. That is startup misconfiguration, and the loader's collect-don't-throw discipline does not extend to it, exactly as hireWorkforce throws where readWorkforceDirectory collects.

Parameters​

documents​

ResourceDoc[]

Returns​

DeclaredResources


rosterDisplayName()​

function rosterDisplayName(worker): string;

A worker's name as a user reads it: its file's name:, else its id's worker segment.

Parameters​

worker​

Pick<RosterWorker, "id" | "name">

Returns​

string


rosterTeamName()​

function rosterTeamName(worker): string | undefined;

A worker's team as a user reads it: its TEAM.md name:, else its id's team segment, else none.

Parameters​

worker​

Pick<RosterWorker, "id" | "teamName">

Returns​

string | undefined


routedTaskHistory()​

function routedTaskHistory(_input, ctx): Promise<LLMMessage[]>;

A generator's history for a turn that may work a routed task: the session's history, as history: true reads it, with the brief's lines as one user-role message between the earlier turns and this turn's own items, so just before the message. Resolved for each model call and never stored; on any other turn, and on a routed task with no lines, it is the session's history unchanged. The built-in agent flow's turn uses it; a flow of your own whose work turn is a generator passes it as that generator's history to show its model the same lines.

Parameters​

_input​

unknown

ctx​

BlockContext<Record<string, unknown> & object>

Returns​

Promise<LLMMessage[]>


screenRefusal()​

function screenRefusal(
kind,
event,
entry,
options
): string | undefined;

One config screen's answer for one subscription: undefined to pass, or why it refused.

Parameters​

kind​

"labels" | "allow" | "words" | "sender" | "own"

event​
addressed?​

true

at​

number

audience​

"private" | "public"

chain?​

string

closes?​

true

deliveryId?​

string

hop?​

number

kind​

string

labels​

string[]

object​

{ id: string; version: number; }

object.id​

string

object.version​

number

owner?​

{ tenantId?: string; userId: string; }

owner.tenantId?​

string

owner.userId​

string

provider​

string

received​

number

sender​

{ id: string; name: string; role: "bot" | "collaborator" | "member" | "outsider" | "unknown"; }

sender.id​

string

sender.name​

string

sender.role​

"bot" | "collaborator" | "member" | "outsider" | "unknown"

text​

string

threads​

string[]

title​

string

url​

string

entry​
botsScreenedBy?​

string

followRev?​

2

hearsClose?​

true

hostScreens?​

( | { any: string[]; screen: "labels"; } | { any: string[]; screen: "words"; } | { bots?: string[]; ids: string[]; screen: "allow"; } | { name: string; screen: "custom"; } | { screen: "interest"; })[]

interest?​

string

kinds?​

string[]

orgId​

string

outsiders?​

true

provider​

string

screens​

( | { any: string[]; screen: "labels"; } | { any: string[]; screen: "words"; } | { bots?: string[]; ids: string[]; screen: "allow"; } | { name: string; screen: "custom"; } | { screen: "interest"; })[]

self?​

string

tenantId?​

string

thread​

string

unmatched?​

true

userId​

string

options​

ScreenOptions

Returns​

string | undefined


secretsFromEnv()​

function secretsFromEnv(env): string[];

The values of the environment variables whose names say they hold a secret (*_KEY, *_TOKEN, *SECRET*, …), at least MIN_SECRET long.

Parameters​

env​

Readonly<Record<string, string | undefined>>

Returns​

string[]


sendMessage()​

function sendMessage(
ctx,
installation,
flowKind,
input,
from,
options?
): Promise<SendOutcome>;

Send one message from the running session's worker.

Parameters​

ctx​

BlockContext

installation​

WorkerInstallation

flowKind​

string

The flow the running session runs on.

input​

SendMessageInput

from​

string

The sending block's name, for the dispatch's provenance.

options?​

SendOptions

Returns​

Promise<SendOutcome>


sessionIdOfFiling()​

function sessionIdOfFiling(filingSessionId): string;

The session id a filingSessionId was made from: everything before its last ~. The value is server-written (filingSessionIdOf), so this reads no caller's input.

Parameters​

filingSessionId​

string

Returns​

string


sharedResource()​

function sharedResource<T>(
pattern,
shape,
options?
): ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object;

Declare a shared resource: a collection whose every entry names who wrote it. Org-scoped unless options.scope says otherwise.

const notes = sharedResource("team-notes/*", { text: z.string() });
// in a block: resources: { notes }, then writeShared(ctx, "notes", key, { text })

Type Parameters​

T​

T extends ZodRawShape

Parameters​

pattern​

string

The collection's key pattern, as defineResourceCollection takes it.

shape​

T

The entry's own fields. writtenBy is added, required.

options?​

SharedResourceOptions

The rest of the collection's declaration (ownerWrites, client, flowIsolation, prefetchMode, a "user" scope), passed through to defineResourceCollection.

Returns​

ResourceCollectionConfig<any> & object & ResourceCollectionConfig<JsonObject> & object


sourceReadCapability()​

function sourceReadCapability(options): DefinedCapability<"sourceRead", Record<string, never>, "read" | "default", Record<string, PresetDef<any>>, undefined, undefined, undefined, undefined, undefined> & object;

The capability a worker flow installs so its workers can read the host's source. Its one preset, read, is off until a worker's own file names it.

Parameters​

options​

SourceReadCapabilityOptions

Returns​

DefinedCapability<"sourceRead", Record<string, never>, "read" | "default", Record<string, PresetDef<any>>, undefined, undefined, undefined, undefined, undefined> & object

Throws​

When the host has no read view (readSource).

Example​

const workspace = localRepoWorkspaceHost({ root, repo });
workforce({ agent: { model, uses: [sourceReadCapability({ workspace })] } });

splitResourceModules()​

function splitResourceModules(modules): ResourceModuleHalves;

Split a generated resourceModules map into the capabilities a worker flow installs and the resources a flow declares.

const { capabilities, resources } = splitResourceModules(resourceModules);

const workerFlow = defineAgentWorkerFlow({ uses: capabilities, ... });
const flowResources = { ...resourcesFromDocs(documents), ...resources };

The two maps are spread by the app, in that order, and a ref in both is the module's. It cannot arise from a tree the command generated — a document and a module of one name in one folder are refused by name at generation, and refs are minted from the path by the one rule both doors share — so a collision here means the generated module and the tree have drifted apart, which is what fsdev gen --check exists to catch in CI.

Throws, rather than collecting, when an entry cannot be either half. That is startup misconfiguration, and it is the same line resourcesFromDocs draws: the loader's collect-don't-throw discipline covers reading a tree, not building from what was read.

Parameters​

modules​

ResourceModules

The generated map, keyed by ref.

Returns​

ResourceModuleHalves

The capabilities, in map order, and the resources, keyed by ref.


startOwedSteerTurn()​

function startOwedSteerTurn(
ctx,
row,
flowKind?
): Promise<boolean>;

Start the turn owed to row's untaken steer (D2), in the session its run link names: the wake first, so a lost start is still paid, then the entry at once. A row with no run in a session yet has no turn to start: its next attempt's brief carries the steer.

Parameters​

ctx​

BlockContext

row​

Task

flowKind?​

string

The flow that session runs on, when it isn't the running one.

Returns​

Promise<boolean>

Whether the turn was started or owed: false when the task names no session, or neither the wake nor the start could be written (a start the runtime refused counts as not written).


steerTurnEntry()​

function steerTurnEntry(options): object;

The internal entry for the turn a late steer is owed (D2). Spread it as internal: { actions: { onTaskSteered: steerTurnEntry({ ... }) } } on every flow whose work entry is a workerTaskEntry, with the same turn or block.

A turn is handed the steers as its message; a block is handed the task as the board packs it, with the claim. The steers it takes are shown in the session as lines from their senders, so a later turn there reads them too. A start that finds nothing to do runs nothing. The wake is cleared once the task no longer waits on a steer. concurrency defaults to the session's notices, so this runs once the request working the task has ended.

Parameters​

options​

SteerTurnEntryOptions & object

Returns​

object

block​
block: SequencerDefinition<unknown, any, undefined, undefined>;
concurrency​
concurrency:
| ConcurrencyConfig
| {
key: (ctx) => string | undefined;
policy: "defer";
};
inputSchema​
inputSchema: ZodObject<{
}, "passthrough", ZodTypeAny, objectOutputType<{
}, ZodTypeAny, "passthrough">, objectInputType<{
}, ZodTypeAny, "passthrough">>;

subscribe()​

function subscribe(
ctx,
providers,
input,
target?,
write?
): Promise<SubscribeOutcome>;

Subscribe a session to one thread: the running one, or target.

Parameters​

ctx​

BlockContext

providers​

readonly SubscriptionProvider[]

The providers a session may subscribe on.

input​
everyMinutes?​

number

interest​

string

kinds?​

string[]

outsiders?​

true

provider​

string

screens?​

( | { any: string[]; screen: "labels"; } | { any: string[]; screen: "words"; } | { bots?: string[]; ids: string[]; screen: "allow"; } | { name: string; screen: "custom"; } | { screen: "interest"; })[]

thread​

string

unmatched?​

true

target?​

SubscribeTarget

The session that hears, when it isn't the running one.

write?​

SubscribeWrite

The subscription's id and maker, from server code.

Returns​

Promise<SubscribeOutcome>


taskInputSchema()​

function taskInputSchema<T>(schema, options?): TaskInputSchema<T>;

Declare what a worker flow's tasks take, for its work entry: workerTaskEntry({ name, turn, inputSchema: taskInputSchema(schema, { ... }) }).

Type Parameters​

T​

T extends TaskInputRecord

Parameters​

schema​

ZodType<T, ZodTypeDef, unknown>

An object schema whose parse survives a JSON round trip. One that uses a step that can break it (.transform, .preprocess, .pipe, .catch, z.coerce.*, z.date, z.bigint, z.map, z.set) is refused by workerTaskEntry, which names its entry, the step and where.

options?​

TaskInputSchemaOptions<T>

Returns​

TaskInputSchema<T>


unheard()​

function unheard(routed): boolean;

Whether no subscription heard a routed event, each by its own choice: every verdict a refusal on the event's content, none cut, and no subscription hearing it as its thread's close. Only such an event may be forwarded as unmatched: one refused interest: unjudged, or by a screen that failed, was heard by nobody but not unheard, so an outage forwards nothing.

Parameters​

routed​

Pick<Routed, "verdicts" | "verdictsCut" | "closeHeard">

Returns​

boolean


unsubscribe()​

function unsubscribe(
ctx,
id,
reason
): Promise<boolean>;

End one of the running user's subscriptions, as saved: off, out of the index. A pause ends only an enabled one; any other end ends an enabled or a paused one; an ended one stays as it ended.

Parameters​

ctx​

BlockContext

id​

string

reason​

SubscriptionEnd

Returns​

Promise<boolean>

Whether it was live.


verifiedWorkerOf()​

function verifiedWorkerOf(session): string | undefined;

The worker this request's turn was verified to run as, or undefined when no worker was resolved, which is the case on every flow that isn't a worker flow. Attribution reads this, never the session's state directly: a flow that isn't a worker flow can hold a workerId a caller wrote.

Parameters​

session​

object

The block context's session handle.

Returns​

string | undefined


workerConfigOf()​

function workerConfigOf(ctx): Readonly<Record<string, unknown>>;

The configuration of the worker this turn loaded with resolveWorker, for a block of a worker flow that reads a setting after the turn's first step: the same value resolveWorker returned as config. Synchronous, so a prompt, a tool list or a step condition can read it.

Parameters​

ctx​

Any block's context in the turn.

session​

object

Returns​

Readonly<Record<string, unknown>>

Throws​

When the turn loaded no worker: call installation.resolveWorker in the flow's request.onStarted.


workerConfigSchema()​

function workerConfigSchema(): ZodObject<{
defaults: ZodOptional<ZodUnion<[ZodLiteral<false>, ZodObject<{
date: ZodOptional<ZodBoolean>;
historySummary: ZodOptional<ZodBoolean>;
skillsIndex: ZodOptional<ZodBoolean>;
}, "strict", ZodTypeAny, {
date?: boolean;
historySummary?: boolean;
skillsIndex?: boolean;
}, {
date?: boolean;
historySummary?: boolean;
skillsIndex?: boolean;
}>]>>;
delegates: ZodDefault<ZodUnion<[ZodLiteral<"all">, ZodArray<ZodString, "many">]>>;
instructions: ZodOptional<ZodString>;
teamInstructions: ZodOptional<ZodString>;
workerId: ZodOptional<ZodString>;
workerPackages: ZodOptional<ZodArray<ZodObject<{
instructions: ZodOptional<ZodString>;
name: ZodString;
path: ZodString;
tools: ZodArray<ZodType<BlockDefinition<any, any, any, any>, ZodTypeDef, BlockDefinition<any, any, any, any>>, "many">;
}, "strict", ZodTypeAny, {
instructions?: string;
name: string;
path: string;
tools: BlockDefinition<any, any, any, any>[];
}, {
instructions?: string;
name: string;
path: string;
tools: BlockDefinition<any, any, any, any>[];
}>, "many">>;
workerSkills: ZodDefault<ZodArray<ZodObject<{
files: ZodOptional<ZodArray<ZodObject<{
content: ZodString;
path: ZodString;
}, "strict", ZodTypeAny, {
content: string;
path: string;
}, {
content: string;
path: string;
}>, "many">>;
name: ZodString;
skillMd: ZodString;
}, "strict", ZodTypeAny, {
files?: object[];
name: string;
skillMd: string;
}, {
files?: object[];
name: string;
skillMd: string;
}>, "many">>;
workerTools: ZodDefault<ZodArray<ZodType<BlockDefinition<any, any, any, any>, ZodTypeDef, BlockDefinition<any, any, any, any>>, "many">>;
}, "strip", ZodTypeAny, {
defaults?: | false
| {
date?: boolean;
historySummary?: boolean;
skillsIndex?: boolean;
};
delegates: string[] | "all";
instructions?: string;
teamInstructions?: string;
workerId?: string;
workerPackages?: object[];
workerSkills: object[];
workerTools: BlockDefinition<any, any, any, any>[];
}, {
defaults?: | false
| {
date?: boolean;
historySummary?: boolean;
skillsIndex?: boolean;
};
delegates?: string[] | "all";
instructions?: string;
teamInstructions?: string;
workerId?: string;
workerPackages?: object[];
workerSkills?: object[];
workerTools?: BlockDefinition<any, any, any, any>[];
}>;

The settings every hireable worker flow admits.

Compose it into a worker flow's own schema and add that flow's settings at the top level:

defineFlow({
kind: "request-triage",
configSchema: workerConfigSchema().extend({ desk: z.string().default("front") }),
actions: { ... }
})

A fresh schema per call, not a shared constant: .extend() returns a new object schema either way, but a worker flow that overrides one of these keys (the built-in agent worker flow refines workerSkills against the app's own skill names) must not be editing a value other worker flows hold.

Reading any of it is optional. A worker flow that composes the contract and never looks at workerSkills mints and runs exactly as before; ignoring the bag is not an error. The door is what is mandatory.

Returns​

ZodObject<{ defaults: ZodOptional<ZodUnion<[ZodLiteral<false>, ZodObject<{ date: ZodOptional<ZodBoolean>; historySummary: ZodOptional<ZodBoolean>; skillsIndex: ZodOptional<ZodBoolean>; }, "strict", ZodTypeAny, { date?: boolean; historySummary?: boolean; skillsIndex?: boolean; }, { date?: boolean; historySummary?: boolean; skillsIndex?: boolean; }>]>>; delegates: ZodDefault<ZodUnion<[ZodLiteral<"all">, ZodArray<ZodString, "many">]>>; instructions: ZodOptional<ZodString>; teamInstructions: ZodOptional<ZodString>; workerId: ZodOptional<ZodString>; workerPackages: ZodOptional<ZodArray<ZodObject<{ instructions: ZodOptional<ZodString>; name: ZodString; path: ZodString; tools: ZodArray<ZodType<BlockDefinition<any, any, any, any>, ZodTypeDef, BlockDefinition<any, any, any, any>>, "many">; }, "strict", ZodTypeAny, { instructions?: string; name: string; path: string; tools: BlockDefinition<any, any, any, any>[]; }, { instructions?: string; name: string; path: string; tools: BlockDefinition<any, any, any, any>[]; }>, "many">>; workerSkills: ZodDefault<ZodArray<ZodObject<{ files: ZodOptional<ZodArray<ZodObject<{ content: ZodString; path: ZodString; }, "strict", ZodTypeAny, { content: string; path: string; }, { content: string; path: string; }>, "many">>; name: ZodString; skillMd: ZodString; }, "strict", ZodTypeAny, { files?: object[]; name: string; skillMd: string; }, { files?: object[]; name: string; skillMd: string; }>, "many">>; workerTools: ZodDefault<ZodArray<ZodType<BlockDefinition<any, any, any, any>, ZodTypeDef, BlockDefinition<any, any, any, any>>, "many">>; }, "strip", ZodTypeAny, { defaults?: | false | { date?: boolean; historySummary?: boolean; skillsIndex?: boolean; }; delegates: string[] | "all"; instructions?: string; teamInstructions?: string; workerId?: string; workerPackages?: object[]; workerSkills: object[]; workerTools: BlockDefinition<any, any, any, any>[]; }, { defaults?: | false | { date?: boolean; historySummary?: boolean; skillsIndex?: boolean; }; delegates?: string[] | "all"; instructions?: string; teamInstructions?: string; workerId?: string; workerPackages?: object[]; workerSkills?: object[]; workerTools?: BlockDefinition<any, any, any, any>[]; }>


workerDate()​

function workerDate(): string;

Today's date block, read from the server's clock each time it is called.

A generator context value: put it under the date key, as the built-in worker flow does, and every call renders the day of that turn, not the day the server started. A standalone generator composes the same block:

generator({ ..., context: { date: workerDate } })

Returns​

string


workerDoorOf()​

function workerDoorOf(worker): WorkerDoor;

The door of a hired worker, read off its flow's public actions.

Parameters​

worker​

Pick<FlowInstance, "kind" | "id"> & object

A worker hireWorkforce returned (or any registered flow).

Returns​

WorkerDoor

respond and whether it takes a task id, or null with the problem when the flow's door isn't in order.


workerFlow()​

function workerFlow(build, options?): WorkerFlowBuilder;

Declare a worker flow built on its installation.

Parameters​

build​

(installation) => unknown

Builds the flow (defineFlow({ ..., session: installation.session() })).

options?​

standardOnly keeps the flow for the workers the app's files define. roles declares what it does beside taking a user's message on respond: contributor (takes tasks on work, from workerTaskEntry) and manager (runs its delegation board on dispatch, from defineSessionBoard). The hire checks each role's entries, and refuses a role's piece on a flow that doesn't declare it. showSettings names the flow's settings a user may see on the roster. retiredSettings names settings it no longer takes: a stored worker that set one reads without it, and a hire or an edit naming one is refused. Whether its tasks need a project is its work entry's inputSchema (taskInputSchema(schema, { project })).

retiredSettings?​

readonly string[]

roles?​

readonly ("contributor" | "manager" | "coordinator")[]

showSettings?​

readonly string[]

standardOnly?​

boolean

Returns​

WorkerFlowBuilder

An entry for createWorkerInstallation({ workerFlows }), and for the workerFlows map fsdev gen writes.


workerFlowProblems()​

function workerFlowProblems(
name,
flow,
roles?
): string[];

Every way flow misses the worker contract, registered as name — or an empty list when it is a worker flow.

The check a hire runs once per flow, before any worker runs, and exported so a library of worker flows can call it in its own tests without an app: expect(workerFlowProblems("triage", triageFlow)).toEqual([]).

Reads the definition only; it runs no block and writes nothing.

Parameters​

name​

string

The name the flow is registered under. It must be the flow's own kind.

flow​

WorkerFlowDefinition

The flow definition, as defineFlow returned it.

roles?​

readonly ("contributor" | "manager" | "coordinator")[]

The roles its registration declares (contributor, manager, coordinator). Omitted, the roles a built-in flow declares itself, and none for any other flow.

Returns​

string[]

One sentence per problem, each naming the flow.


workerIdentityPrompt()​

function workerIdentityPrompt(ctx, installation): Promise<string | undefined>;

The running worker's default layer, or undefined when the turn runs no roster worker (so the prompt slot drops it, never a blank line).

Parameters​

ctx​

BlockContext

installation​

WorkerInstallation

Returns​

Promise<string | undefined>


workerRecipients()​

function workerRecipients(
ctx,
installation,
self
): Promise<WorkerRecipients>;

The workers self can reach, read from the roster once per request.

Parameters​

ctx​

BlockContext

installation​

WorkerInstallation

self​

string

The running worker's id. Never listed.

Returns​

Promise<WorkerRecipients>


workerTaskEntry()​

function workerTaskEntry(options): object;

Build a worker flow's work task entry: spread it as task: { actions: { work: workerTaskEntry({ ... }) } }.

Parameters​

options​

WorkerTaskEntryOptions

Returns​

object

block​
block: SequencerDefinition<{
attachments?: object[];
attempts: number;
context?: string;
deps?: Record<string, unknown>;
feedback?: string;
followUpOf?: string;
goal: string;
input?: unknown;
metadata?: Record<string, unknown>;
priorWork?: unknown;
sealed?: Record<string, unknown>;
steers?: object[];
taskId: string;
title?: string;
}, any, undefined, undefined>;
concurrency​
concurrency: object;
concurrency.key​
readonly key: (ctx) => string | undefined;
Parameters​
ctx​

ConcurrencyKeyContext

Returns​

string | undefined

concurrency.policy​
readonly policy: "hold";
from​
from: TaskBinding;
userMessage​
userMessage: (dispatch) => object;
Parameters​
dispatch​
assignee​

string

attempt​

number

boardId​

string

createdAt​

number

incarnationId?​

string

partition?​

string

payload?​

unknown

taskId​

string

turn?​

number

Returns​

object

attachments?​
attachments?: object[];
metadata​
metadata: object;
metadata.taskBrief​
taskBrief: TaskBrief;
text​
text: string;

workforceManifestSources()​

function workforceManifestSources(options): BlockManifestSource[];

The workforce's manifest sources — the workers domain, when its inventory key was named.

Exported beside createWorkforceCapability for an app that assembles its own registry (a flow that is not a worker flow, say). The capability is the ordinary door and calls this.

Parameters​

options​

WorkforceManifestSourceOptions

The boot-resolved roster and the inventory registry keys.

Returns​

BlockManifestSource[]

No source, or the workers source.


workstreamEntriesPrefix()​

function workstreamEntriesPrefix(project): string;

The prefix of one project's entries, relative to the collection: <projectId>/. The trailing slash keeps apollo from reading apollo2's.

Parameters​

project​

string

Returns​

string


workstreamEntryKey()​

function workstreamEntryKey(
project,
owner,
workstream
): Record<string, string>;

The key of owner's entry workstream in project, relative to the collection.

Parameters​

project​

string

owner​

string

workstream​

string

Returns​

Record<string, string>


workstreamOpenedEntry()​

function workstreamOpenedEntry(): object;

The internal entry that lets a flow's workers lead workstreams: declare it as internal: { actions: { onWorkstreamOpened: workstreamOpenedEntry() } }. The hire refuses it under any other name.

Returns​

object

block​
block: BlockDefinition<ZodObject<{
}, "strict", ZodTypeAny, {
}, {
}>, ZodObject<{
}, "strip", ZodTypeAny, {
}, {
}>, {
}, {
}>;
inputSchema​
inputSchema: ZodObject<{
}, "strict", ZodTypeAny, {
}, {
}>;

workstreamPlaceOf()​

function workstreamPlaceOf(path): WorkstreamEntryPlace | undefined;

Where the entry at path sits, or undefined for a path that is not a direct entry of a project (workstreams/<project>/<~owner>/<id>).

Parameters​

path​

string

Returns​

WorkstreamEntryPlace | undefined


workstreamRef()​

function workstreamRef(address): string;

<visibility>/<projectId>/<workstreamId>. Each part is one segment, so it reads back unambiguously (parseWorkstreamRef).

Parameters​

address​

WorkstreamAddress

Returns​

string


writeShared()​

function writeShared(
ctx,
accessor,
key,
data
): Promise<void>;

Write one entry of a shared resource, naming the session's user and, when a worker is running, the worker.

Creates the entry, or replaces it when the key is taken; the entry then names whoever wrote it last. A writtenBy in data is ignored: the name always comes from the session. The worker is the session's worker, as the turn's resolveWorker loaded and checked it: the one the session was created with, never anything the input or a caller's state says. A turn that resolved no worker, which is every turn on a flow that isn't a worker flow, names the user alone.

Parameters​

ctx​

SharedWriteContext

The block's context. Its block must declare accessor.

accessor​

string

The resource's accessor on the block, e.g. "notes".

key​

string

The entry's key under the collection's pattern.

data​

Record<string, unknown>

The entry's own fields.

Returns​

Promise<void>

Throws​

When the session has no user, so nothing could be named, or the block declares no resource under accessor.