v0.3.0 — input contracts + durable steps
Workflow input contracts — meta.argsSchema
A workflow module can now declare a JSON Schema for its --args:
export const meta = {
argsSchema: {
type: 'object',
required: ['target'],
properties: { target: { type: 'string', minLength: 1 } },
additionalProperties: false,
},
}- Validates the effective args verbatim at admission time, on fresh runs and resumes alike — a violation terminates the run before any agent or step executes.
- Failures always produce full terminal artifacts (journal
endrecord,result.json, no agent events) — including malformed schemas, unsupported keywords, and validator throws. Nothing escapes as a bare crash. - The validator's supported subset (
type,required,properties,additionalProperties: false,items,enum,const, min/max bounds,anyOf) rejects anything it doesn't enforce loudly — no silently ignored constraints.
Durable side-effect nodes — step(name, args?, fn)
Journaled local work (git commands, file writes, API calls) with replay-on-resume:
const sha = await step('commit', { msg }, async () => {
await exec(`git commit -m "${msg}"`)
return exec('git rev-parse HEAD')
})- A completed callback's JSON result is journaled and replayed on resume without re-executing; failed or crash-window (start-only) attempts re-run.
- The contract is durable memoization, not exactly-once — callbacks should be idempotent or carry idempotency keys.
- Steps use an independent per-branch counter and a separate key domain, so adding or removing a
step()never shifts agent resume keys (existing journals stay resumable; key version unchanged). - The completed journal record seals the outcome: telemetry failures after completion can never cause a re-run.
- Strict JSON normalization for args/results:
undefined, functions,BigInt,NaN, cycles, and sparse arrays are rejected loudly;-0normalizes to0; a void callback resolves tonull.
Observability
Steps are first-class everywhere: CLI status/tail, the MCP surface, and the web viewer cockpit (step lifecycle, replay markers, failures, durations).
Docs
New examples/durable-steps.workflow.js, plus README, guide, architecture, skill, and TypeScript declaration updates for both features.