@flow-state-dev/workforce/kit
Interfaces
GeneratedWorkforce
What fsdev gen renders into workforce/workforce.gen.ts: the app imports it and hands it over whole.
Properties
blocks?
readonly blocks?: Readonly<Record<string, BlockDefinition<any, any, any, any>>>;
One block per file under blocks/: the agent flow's tool catalog, when its config names none.
packageBlocks?
readonly packageBlocks?: Readonly<Record<string, Readonly<Record<string, BlockDefinition<any, any, any, any>>>>>;
The blocks each package carries.
resourceModules?
readonly resourceModules?: ResourceModules;
One export per TypeScript file in a resources/ folder: its capabilities
go in the uses of the agent and coordinator flows the kit builds, and
its resources beside the folder's documents, for a worker to be granted.
workerBlocks?
readonly workerBlocks?: Readonly<Record<string, Readonly<Record<string, BlockDefinition<any, any, any, any>>>>>;
The blocks each standard worker's own folders register.
workerFlows?
readonly workerFlows?: Readonly<Record<string, WorkerFlowEntry>>;
One worker flow per file under flows/workers/. One named agent or coordinator replaces the kit's own.
WorkforceConfig
The workforce kit's config.
Properties
agent?
agent?: WorkforceAgentOptions;
The built-in agent flow's options. Omitted: its defaults, unless workerFlows holds an agent.
consult?
consult?: ConsultSessionsOptions;
Consulting another of the user's conversations: the model and budget it reads on.
coordinator?
coordinator?: WorkforceCoordinatorOptions;
The coordinator flow's options. Omitted: no coordinator flow, unless workerFlows holds one.
generated?
generated?: GeneratedWorkforce;
The app's generated workforce.gen.ts, imported whole.
github?
github?: Omit<GitHubServiceFlowOptions, "installation">;
GitHub's service flow, which delivers GitHub's events to the conversations that follow them. Omitted: none.
hire?
hire?: HireChecks;
What every hire and edit of a user's worker is checked against, on the roster and from a conversation alike: models, the models a worker may run on. Omitted: any the flow takes.
internalEvents?
internalEvents?: Omit<InternalServiceFlowOptions, "installation">;
Internal events: the topics a session may publish on and a routine may follow. The kit serves the internal service flow, adds its provider to routines, and a worker flow built on the installation reaches its publish through internalEventsOf. Omitted: none.
messages?
messages?: MessageLimits;
The limits on worker messages.
projectCoordinator?
projectCoordinator?: string;
The standard worker each user's project coordinator runs as.
routines?
routines?: RoutinesOptions;
Routines: the schedule index, the providers an event routine follows, polling, the app's declared ones.
sessionFields?
sessionFields?: Readonly<Record<string, ZodTypeAny>>;
Session fields the app declares on every worker session, a schema each,
by name. Only the server writes one: once on a user's conversation at
open, through the agent and coordinator flows' setSessionFields
action, and on a task's session at each hand-over, from its filer. A
create that seeds one is refused, naming it, and the client reads it off
the session.
Every field is visible to the session's browser. Never put a secret here.
taskChainLimit?
taskChainLimit?: number;
The most tasks one top task may have under it. Omitted: 100.
Type Aliases
WorkforceAgentOptions
type WorkforceAgentOptions = Omit<AgentWorkerFlowOptions, "installation"> & object;
The built-in agent flow's options, as the kit's config takes them.
Type Declaration
retiredSettings?
retiredSettings?: readonly string[];
Settings the app no longer takes: a stored worker that set one reads without it, and a hire or an edit naming one is refused.
showSettings?
showSettings?: readonly string[];
The settings a user sees on a worker's roster row (icon, color).
WorkforceCoordinatorOptions
type WorkforceCoordinatorOptions = Omit<CoordinatorFlowOptions, "installation">;
The coordinator flow's options, as the kit's config takes them.
WorkforceFlowsBuilder
type WorkforceFlowsBuilder = (installation) => readonly FlowInstance<any, any>[];
A flows entry: builds flows on the installation the kit hired.
Parameters
installation
Returns
readonly FlowInstance<any, any>[]
Variables
workforce
const workforce: KitFactory;
Workforce, as a kit. Its folder defaults to workforce/ beside the app.
Example
createFlowState({ kits: [workforce({ agent: { model: "openai/gpt-6-luna" } })], stores });
Functions
internalEventsOf()
function internalEventsOf(installation): InternalServiceFlow;
The internal events the workforce kit serves for installation: its
publishEvent, the resources a block that calls it declares, and its tool
as a capability. Call it in a worker flow's builder, or a flows builder,
with the installation it is handed.
Parameters
installation
Returns
Throws
When the kit that hired installation has no internalEvents config.