Task types JSON
Schema, startup validation checks, and deterministic variant selection for task-types.json.
{
"status": "draft",
"note": "Placeholder prices in whole cents, set over the measured raw cost per call (24 Nov live). The real prices are set by a person. Each task type has one product (the holon's service for it) and one or more variants; a step's variant is chosen in code from the run's path.",
"task_types": [
{
"id": "receive_message",
"name": "Receive a message",
"kind": "code",
"steps": ["message.receive"],
"product": { "id": "receive_message.service", "name": "Receive a message", "variants": [
{ "id": "code_only", "name": "Code only", "price_cents": 0, "unit": "message" }
] }
},
{
"id": "screen_message",
"name": "Screen a message",
"kind": "code",
"steps": ["message.screen"],
"product": { "id": "screen_message.service", "name": "Screen a message", "variants": [
{ "id": "code_only", "name": "Code only", "price_cents": 0, "unit": "message" }
] }
},
{
"id": "classify_message",
"name": "Classify a message",
"kind": "model",
"steps": ["message.checks"],
"product": { "id": "classify_message.service", "name": "Classify a message", "variants": [
{ "id": "standard", "name": "Standard", "price_cents": 1, "unit": "message" }
] }
},
{
"id": "apply_rules",
"name": "Apply the rules",
"kind": "code",
"steps": ["message.rules"],
"product": { "id": "apply_rules.service", "name": "Apply the rules", "variants": [
{ "id": "code_only", "name": "Code only", "price_cents": 0, "unit": "message" }
] }
},
{
"id": "prepare_reply",
"name": "Prepare a reply",
"kind": "model",
"steps": ["message.reply"],
"product": { "id": "prepare_reply.service", "name": "Prepare a reply", "variants": [
{ "id": "reviewed", "name": "Reviewed", "price_cents": 5, "unit": "reply" },
{ "id": "live", "name": "Live", "price_cents": 6, "unit": "reply" },
{ "id": "fixed", "name": "Fixed", "price_cents": 0, "unit": "reply" }
] }
},
{
"id": "check_reply",
"name": "Check a reply",
"kind": "model",
"steps": ["message.review"],
"product": { "id": "check_reply.service", "name": "Check a reply", "variants": [
{ "id": "standard", "name": "Standard", "price_cents": 1, "unit": "reply" },
{ "id": "code_only", "name": "Code only", "price_cents": 0, "unit": "reply" }
] }
},
{
"id": "store_record",
"name": "Store the record",
"kind": "code",
"steps": ["message.stored", "profile.stored"],
"product": { "id": "store_record.service", "name": "Store the record", "variants": [
{ "id": "code_only", "name": "Code only", "price_cents": 0, "unit": "run" }
] }
},
{
"id": "profile_organisation",
"name": "Profile an organisation",
"kind": "model",
"steps": ["profile.checks"],
"product": { "id": "profile_organisation.service", "name": "Profile an organisation", "variants": [
{ "id": "standard", "name": "Standard", "price_cents": 2, "unit": "organisation" }
] }
},
{
"id": "explore_type",
"name": "Explore a new type",
"kind": "model",
"steps": ["explore.explore"],
"product": { "id": "explore_type.service", "name": "Explore a new type", "variants": [
{ "id": "standard", "name": "Standard", "price_cents": 250, "unit": "type" }
] }
},
{
"id": "hold_for_review",
"name": "Hold for a person to review",
"kind": "code",
"steps": ["explore.review"],
"product": { "id": "hold_for_review.service", "name": "Hold for a person to review", "variants": [
{ "id": "code_only", "name": "Code only", "price_cents": 0, "unit": "type" }
] }
}
]
}Overview
task-types.json defines the step-level service task types that a holon's flows are billed as, kept in data rather than scattered through code. Reference: task-types.mjs Reference: task-types.json Each task type carries one product and one or more variants, each with a whole-cent price_cents and a unit. Screens always show Product · Variant · $X.XX / unit, never a bare Product or unlabelled price. Ruling 52 Wireframe review B12
flow.mjs calls loadTaskTypes() at module import time, so any missing or invalid file prevents the server from starting. Reference: flow.mjs Reference: task-types.mjs These step-level service types are distinct from the per-question decision task types in battery.mjs. Reference: task-types.mjs
All figures in task-types.json are placeholder draft prices set over measured raw model costs (status: "draft"). A typical reviewed message bills $0.07 ($0.01 classify + $0.05 reply + $0.01 check). Real commercial prices are set by a person, never by a model. Reference: task-types.json House note: three-service holon
Inputs
Top-level fields
| Field | Type | Required | Purpose |
|---|---|---|---|
status | string | Yes | Lifecycle marker ("draft" in the reference file) |
note | string | No | Human-readable provenance and pricing note |
task_types | array | Yes | List of service task-type definitions |
Task-type and variant fields
| Field | Type | Required | Purpose |
|---|---|---|---|
id | string | Yes | Unique snake-case task-type key (for example classify_message) |
name | string | Yes | Display name for the task type |
kind | string | Yes | Execution kind ("code" or "model") |
steps | string[] | Yes | One or more <flow>.<step> pairs mapped to this task type |
product.id | string | Yes | Unique product key across the file (for example classify_message.service) |
product.name | string | No (recommended) | Product display name |
product.variants | array | Yes | Non-empty list of purchasable variants |
variants[].id | string | Yes | Unique variant key within the product (code_only, standard, reviewed, live, fixed) |
variants[].name | string | Yes | Human-readable variant label shown beside the product |
variants[].price_cents | integer | Yes | Non-negative whole number of cents (0 for code-only or fixed-line steps) |
variants[].unit | string | Yes | Unit billed (message, reply, run, organisation, type) |
Outputs
validateTaskTypes(data) returns a frozen catalogue object with four properties: Reference: task-types.mjs
status: the top-level status string.taskTypes: the validated list of task-type objects.price(flow, step, variant): resolves${flow}.${step}and returns{ task_type, variant, price_cents }. Throws immediately if the(flow, step)pair is unmapped or ifvariantis not permitted for that pair inFLOW_STEPS.public(): returns{ [id]: { name, variants: { [variantId]: { name, price_cents } } } }forGET /api/state, strippingstepsandunit. Reference: task-types.mjs Reference: flow.mjs
In flow.mjs, every emitted step carries { task_type, variant, price_cents, raw_cost_micro }. A step whose status is 'failed' sets price_cents: 0 while keeping its raw_cost_micro, and endRun excludes any step still in 'running' status when totalling run.price_cents and metrics.billedCents. Reference: flow.mjs
Topics
Allowed flow steps (FLOW_STEPS)
task-types.mjs declares the exact closed map of (flow, step) pairs that the console emits and the variants code may select for each: Reference: task-types.mjs
export const FLOW_STEPS = Object.freeze({
'message.receive': ['code_only'],
'message.screen': ['code_only'],
'message.checks': ['standard'],
'message.rules': ['code_only'],
'message.reply': ['reviewed', 'live', 'fixed'],
'message.review': ['standard', 'code_only'],
'message.stored': ['code_only'],
'profile.checks': ['standard'],
'profile.stored': ['code_only'],
'explore.explore': ['standard'],
'explore.review': ['code_only'],
});Validation rules (validateTaskTypes)
validateTaskTypes collects every failure and throws a single combined error listing all problems: Reference: task-types.mjs
- The parsed root value must be a non-null object.
statusmust be a non-empty trimmed string.task_typesmust be an array.- Every task type must have a non-empty string
id, unique acrosstask_types. - Every task type must have a non-empty string
nameand a non-empty stringkind. - Every task type must have a non-null
productobject with a non-empty stringid, unique across all products. product.variantsmust be a non-empty array.- Every variant must have a non-empty string
id, unique within its product. - Every variant must have a non-empty string
nameand a non-empty stringunit. - Every variant's
price_centsmust satisfyNumber.isInteger(v.price_cents) && v.price_cents >= 0. - Every task type's
stepsmust be an array; each step pair must be an own property ofFLOW_STEPSand cannot already be mapped to another task type. - Every
(flow, step)pair inFLOW_STEPSmust map to a task type, and every variant listed for that pair inFLOW_STEPSmust exist on that task type'sproduct.variants. Reference: task-types.mjs
Deterministic variant selection
Code inside flow.mjs selects each step's variant solely from the run's execution path, never via model output: Reference: task-types.mjs Reference: flow.mjs
| Flow step | Variant chosen | Exact condition in flow.mjs |
|---|---|---|
message.reply | fixed ($0.00) | A blocking rule (redirect or abuse) fired, returning a fixed line without calling the reply model |
message.reply | live ($0.06) | streamMode === 'live' AND no strict rule (adviser, privacy) fired |
message.reply | reviewed ($0.05) | Default path: reply is held until code checks and the reply battery pass |
message.review | code_only ($0.00) | finish() caught a prompt 'leak' (short-circuiting the reply battery) OR reply reviewing is disabled |
message.review | standard ($0.01) | Code checks passed and the reply battery ran |
All other FLOW_STEPS | Single listed variant | 'code_only' ($0.00) for code steps; 'standard' for message.checks ($0.01), profile.checks ($0.02), and explore.explore ($2.50) |