owenloop 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +58 -31
  3. package/bin/owenloop.mjs +2 -2
  4. package/dist/packages/work/src/agent/brief.d.ts +172 -0
  5. package/dist/packages/work/src/agent/brief.js +193 -0
  6. package/dist/packages/work/src/agent/loop.d.ts +135 -0
  7. package/dist/packages/work/src/agent/loop.js +542 -0
  8. package/dist/packages/work/src/agent/workdir.d.ts +210 -0
  9. package/dist/packages/work/src/agent/workdir.js +319 -0
  10. package/dist/packages/work/src/bundle/cache.d.ts +90 -0
  11. package/dist/packages/work/src/bundle/cache.js +324 -0
  12. package/dist/packages/work/src/bundle/fetch.d.ts +85 -0
  13. package/dist/packages/work/src/bundle/fetch.js +325 -0
  14. package/dist/packages/work/src/bundle/types.d.ts +160 -0
  15. package/dist/packages/work/src/bundle/types.js +1 -0
  16. package/dist/packages/work/src/credentials/owenloop.d.ts +11 -0
  17. package/dist/packages/work/src/credentials/owenloop.js +28 -0
  18. package/dist/packages/work/src/credentials/reader.d.ts +36 -0
  19. package/dist/packages/work/src/credentials/reader.js +32 -0
  20. package/dist/packages/work/src/credentials/resolve.d.ts +19 -0
  21. package/dist/packages/work/src/credentials/resolve.js +56 -0
  22. package/dist/packages/work/src/exec/loop.d.ts +29 -0
  23. package/dist/packages/work/src/exec/loop.js +215 -0
  24. package/dist/packages/work/src/exec/receipt.d.ts +38 -0
  25. package/dist/packages/work/src/exec/receipt.js +21 -0
  26. package/dist/packages/work/src/exec/runner.d.ts +65 -0
  27. package/dist/packages/work/src/exec/runner.js +185 -0
  28. package/dist/packages/work/src/harness/child-env.d.ts +100 -0
  29. package/dist/packages/work/src/harness/child-env.js +127 -0
  30. package/dist/packages/work/src/harness/claude.d.ts +128 -0
  31. package/dist/packages/work/src/harness/claude.js +635 -0
  32. package/dist/packages/work/src/harness/codex.d.ts +110 -0
  33. package/dist/packages/work/src/harness/codex.js +896 -0
  34. package/dist/packages/work/src/harness/contract.d.ts +283 -0
  35. package/dist/packages/work/src/harness/contract.js +32 -0
  36. package/dist/packages/work/src/harness/fake.d.ts +59 -0
  37. package/dist/packages/work/src/harness/fake.js +90 -0
  38. package/dist/packages/work/src/harness/jsonrpc-stdio.d.ts +108 -0
  39. package/dist/packages/work/src/harness/jsonrpc-stdio.js +344 -0
  40. package/dist/packages/work/src/harness/permissions.d.ts +62 -0
  41. package/dist/packages/work/src/harness/permissions.js +93 -0
  42. package/dist/packages/work/src/harness/registry.d.ts +47 -0
  43. package/dist/packages/work/src/harness/registry.js +45 -0
  44. package/dist/packages/work/src/harness/session-store.d.ts +163 -0
  45. package/dist/packages/work/src/harness/session-store.js +319 -0
  46. package/dist/packages/work/src/harness/types.d.ts +29 -0
  47. package/dist/packages/work/src/harness/types.js +14 -0
  48. package/dist/packages/work/src/harnesses.d.ts +38 -0
  49. package/dist/packages/work/src/harnesses.js +38 -0
  50. package/dist/packages/work/src/hold/loop.d.ts +36 -0
  51. package/dist/packages/work/src/hold/loop.js +23 -0
  52. package/dist/packages/work/src/hold/mcp.d.ts +55 -0
  53. package/dist/packages/work/src/hold/mcp.js +149 -0
  54. package/dist/packages/work/src/hub/client.d.ts +22 -0
  55. package/dist/packages/work/src/hub/client.js +78 -0
  56. package/dist/packages/work/src/hub/types.d.ts +290 -0
  57. package/dist/packages/work/src/hub/types.js +28 -0
  58. package/dist/packages/work/src/lease/loop.d.ts +94 -0
  59. package/dist/packages/work/src/lease/loop.js +277 -0
  60. package/dist/packages/work/src/main.d.ts +1 -0
  61. package/dist/packages/work/src/main.js +48 -0
  62. package/dist/packages/work/src/mcp/server.d.ts +125 -0
  63. package/dist/packages/work/src/mcp/server.js +320 -0
  64. package/dist/packages/work/src/roles/agent-run.d.ts +118 -0
  65. package/dist/packages/work/src/roles/agent-run.js +447 -0
  66. package/dist/packages/work/src/roles/exec.d.ts +40 -0
  67. package/dist/packages/work/src/roles/exec.js +203 -0
  68. package/dist/packages/work/src/roles/hold.d.ts +68 -0
  69. package/dist/packages/work/src/roles/hold.js +324 -0
  70. package/dist/packages/work/src/roles/join.d.ts +18 -0
  71. package/dist/packages/work/src/roles/join.js +204 -0
  72. package/dist/packages/work/src/roles/lint.d.ts +59 -0
  73. package/dist/packages/work/src/roles/lint.js +200 -0
  74. package/dist/packages/work/src/roles/prepare.d.ts +1 -0
  75. package/dist/packages/work/src/roles/prepare.js +249 -0
  76. package/dist/packages/work/src/roles/release.d.ts +48 -0
  77. package/dist/packages/work/src/roles/release.js +137 -0
  78. package/dist/packages/work/src/roles/sessions.d.ts +61 -0
  79. package/dist/packages/work/src/roles/sessions.js +180 -0
  80. package/dist/packages/work/src/roles/settings.d.ts +6 -0
  81. package/dist/packages/work/src/roles/settings.js +66 -0
  82. package/dist/packages/work/src/roles/shift.d.ts +12 -0
  83. package/dist/packages/work/src/roles/shift.js +228 -0
  84. package/dist/packages/work/src/roles/signals.d.ts +55 -0
  85. package/dist/packages/work/src/roles/signals.js +62 -0
  86. package/dist/packages/work/src/settings/provision.d.ts +21 -0
  87. package/dist/packages/work/src/settings/provision.js +47 -0
  88. package/dist/packages/work/src/settings/settings.d.ts +120 -0
  89. package/dist/packages/work/src/settings/settings.js +116 -0
  90. package/dist/packages/work/src/shift/client.d.ts +24 -0
  91. package/dist/packages/work/src/shift/client.js +124 -0
  92. package/dist/packages/work/src/shift/loop.d.ts +120 -0
  93. package/dist/packages/work/src/shift/loop.js +468 -0
  94. package/dist/packages/work/src/shift/protocol.d.ts +91 -0
  95. package/dist/packages/work/src/shift/protocol.js +24 -0
  96. package/dist/packages/work/src/shift/routing.d.ts +35 -0
  97. package/dist/packages/work/src/shift/routing.js +50 -0
  98. package/dist/packages/work/src/shift/runtime.d.ts +43 -0
  99. package/dist/packages/work/src/shift/runtime.js +274 -0
  100. package/dist/packages/work/src/shift/server.d.ts +23 -0
  101. package/dist/packages/work/src/shift/server.js +716 -0
  102. package/dist/packages/work/src/shift/spawn.d.ts +86 -0
  103. package/dist/packages/work/src/shift/spawn.js +100 -0
  104. package/dist/packages/work/src/shift/state.d.ts +77 -0
  105. package/dist/packages/work/src/shift/state.js +162 -0
  106. package/dist/packages/work/src/usage.d.ts +6 -0
  107. package/dist/packages/work/src/usage.js +175 -0
  108. package/dist/{cli.d.ts → src/cli.d.ts} +18 -3
  109. package/dist/{cli.js → src/cli.js} +770 -114
  110. package/dist/{credentials.d.ts → src/credentials.d.ts} +18 -12
  111. package/dist/{credentials.js → src/credentials.js} +14 -12
  112. package/dist/{defs.js → src/defs.js} +36 -36
  113. package/dist/{engine.d.ts → src/engine.d.ts} +8 -8
  114. package/dist/{engine.js → src/engine.js} +14 -14
  115. package/dist/{hub.d.ts → src/hub.d.ts} +205 -10
  116. package/dist/{hub.js → src/hub.js} +370 -12
  117. package/dist/{index.d.ts → src/index.d.ts} +1 -1
  118. package/dist/{index.js → src/index.js} +1 -1
  119. package/dist/{mcp → src/mcp}/serve.d.ts +5 -4
  120. package/dist/{mcp → src/mcp}/serve.js +168 -31
  121. package/dist/{mcp → src/mcp}/server.d.ts +6 -9
  122. package/dist/{mcp → src/mcp}/server.js +6 -9
  123. package/dist/{model.js → src/model.js} +1 -1
  124. package/dist/{types.d.ts → src/types.d.ts} +18 -18
  125. package/dist/{util.d.ts → src/util.d.ts} +3 -2
  126. package/dist/{util.js → src/util.js} +3 -2
  127. package/dist/{owenwork.d.ts → src/work-settings.d.ts} +22 -22
  128. package/dist/{owenwork.js → src/work-settings.js} +27 -27
  129. package/docs/authoring.md +93 -53
  130. package/docs/cli.md +597 -76
  131. package/docs/design.md +33 -33
  132. package/docs/embedding.md +10 -9
  133. package/examples/workflows/{command-worker.yaml → command-executor.yaml} +15 -15
  134. package/examples/workflows/compile-dev-playbook.yaml +338 -0
  135. package/examples/workflows/judges/gate-sharpness.md +39 -0
  136. package/examples/workflows/judges/security.md +34 -0
  137. package/package.json +17 -8
  138. /package/dist/{add.d.ts → src/add.d.ts} +0 -0
  139. /package/dist/{add.js → src/add.js} +0 -0
  140. /package/dist/{defs.d.ts → src/defs.d.ts} +0 -0
  141. /package/dist/{factory.d.ts → src/factory.d.ts} +0 -0
  142. /package/dist/{factory.js → src/factory.js} +0 -0
  143. /package/dist/{lock.d.ts → src/lock.d.ts} +0 -0
  144. /package/dist/{lock.js → src/lock.js} +0 -0
  145. /package/dist/{model.d.ts → src/model.d.ts} +0 -0
  146. /package/dist/{paths.d.ts → src/paths.d.ts} +0 -0
  147. /package/dist/{paths.js → src/paths.js} +0 -0
  148. /package/dist/{schema.d.ts → src/schema.d.ts} +0 -0
  149. /package/dist/{schema.js → src/schema.js} +0 -0
  150. /package/dist/{store.d.ts → src/store.d.ts} +0 -0
  151. /package/dist/{store.js → src/store.js} +0 -0
  152. /package/dist/{types.js → src/types.js} +0 -0
  153. /package/dist/{untar.d.ts → src/untar.d.ts} +0 -0
  154. /package/dist/{untar.js → src/untar.js} +0 -0
@@ -2,7 +2,7 @@
2
2
  * Credential WRITE + OAuth refresh library surface.
3
3
  *
4
4
  * Extracted from `src/cli.ts` (where these were module-private) so external
5
- * consumers — a future `owenloop mcp` stdio server, an `owenwork join` command —
5
+ * consumers — a future `owenloop mcp` stdio server, an `owenloop work join` command —
6
6
  * can store credentials and keep an OAuth access token fresh without depending
7
7
  * on the CLI module. The exported `storeCredential` / `deleteCredential` /
8
8
  * `ensureFreshOAuth` are re-imported by `cli.ts`, so every existing subcommand
@@ -182,13 +182,19 @@ export interface MintAgentResult {
182
182
  id: string;
183
183
  /** The minted agent's id — a non-secret handle. */
184
184
  agentId: string;
185
- /** Resolved pool NAMES from the server. */
186
- pools: string[];
185
+ /** Resolved crew NAMES from the server. */
186
+ crews: string[];
187
+ /**
188
+ * The minted token's scopes — the client-resolved request value (the H3 route
189
+ * requires non-empty scopes and honors them verbatim, so request == minted).
190
+ * Non-secret; lets callers print the truth instead of a hard-coded literal.
191
+ */
192
+ scopes: string[];
187
193
  /** Which local backend the token landed in. */
188
194
  storage: 'keychain' | 'file';
189
195
  }
190
196
  /**
191
- * Mint a new agent identity on `origin` as the human `cred` and persist the
197
+ * Mint a new Scoped Identity on `origin` as the human `cred` and persist the
192
198
  * returned `olp_` token to slot `agent:<name>`. CLI-free (no `Args`, no exit
193
199
  * codes — the caller maps failures to exit codes) so both `owenloop agent new`
194
200
  * (O3) and `owenloop mcp`'s `create_agent` (O2) can reuse it.
@@ -209,12 +215,12 @@ export interface MintAgentResult {
209
215
  * today; explicit for symmetry with the store/refresh signatures).
210
216
  * @param params.scopes defaults to `['work']` — the H3 route REQUIRES a
211
217
  * non-empty `scopes`; an empty list is server-refused.
212
- * @param params.pools omitted when absent so the server defaults to the minter's
213
- * personal pool (`pools: []` is server-refused with `pool_invalid`).
218
+ * @param params.crews omitted when absent so the server defaults to the minter's
219
+ * personal crew (`crews: []` is server-refused with `crew_invalid`).
214
220
  */
215
221
  export declare function mintAgentCredential(io: CredentialIO, origin: string, humanSlot: CredentialSlotSelector, cred: Credential, params: {
216
222
  name: string;
217
- pools?: string[];
223
+ crews?: string[];
218
224
  scopes?: string[];
219
225
  }): Promise<MintAgentResult>;
220
226
  /**
@@ -224,8 +230,8 @@ export declare function mintAgentCredential(io: CredentialIO, origin: string, hu
224
230
  *
225
231
  * `revokedTokenIds` are the ids the rekey invalidated server-side — the OLD
226
232
  * installation's credential(s). Their presence is the honest signal that any
227
- * still-running copy of this agent elsewhere is now disconnected. No `pools`
228
- * field: rekey changes no pool membership.
233
+ * still-running copy of this agent elsewhere is now disconnected. No `crews`
234
+ * field: rekey changes no crew membership.
229
235
  */
230
236
  export interface RekeyAgentResult {
231
237
  /** New token id — a non-secret revocation handle. */
@@ -240,14 +246,14 @@ export interface RekeyAgentResult {
240
246
  storage: 'keychain' | 'file';
241
247
  }
242
248
  /**
243
- * Re-key an EXISTING agent identity on `origin` as the human `cred`: the hub
249
+ * Re-key an EXISTING Scoped Identity on `origin` as the human `cred`: the hub
244
250
  * mints a fresh `olp_` token for `agentId`, REVOKES the identity's current
245
251
  * token(s), and this function persists the new token into the SAME
246
252
  * `agent:<name>` slot — overwriting the old one. Sibling of
247
253
  * `mintAgentCredential` with the identical §6 discipline; the only shape
248
254
  * differences are the endpoint (`/api/rekey_agent_token`), the request body
249
- * (`{agentId}` — no name/scopes/pools; rekey preserves pools), and the response
250
- * guard (`asRekeyAgentTokenOk` — no `pools` field).
255
+ * (`{agentId}` — no name/scopes/crews; rekey preserves crews), and the response
256
+ * guard (`asRekeyAgentTokenOk` — no `crews` field).
251
257
  *
252
258
  * **The token NEVER leaves this function.** It flows exactly one hop —
253
259
  * `asRekeyAgentTokenOk(body).token` → `storeCredential` — and is never returned,
@@ -2,7 +2,7 @@
2
2
  * Credential WRITE + OAuth refresh library surface.
3
3
  *
4
4
  * Extracted from `src/cli.ts` (where these were module-private) so external
5
- * consumers — a future `owenloop mcp` stdio server, an `owenwork join` command —
5
+ * consumers — a future `owenloop mcp` stdio server, an `owenloop work join` command —
6
6
  * can store credentials and keep an OAuth access token fresh without depending
7
7
  * on the CLI module. The exported `storeCredential` / `deleteCredential` /
8
8
  * `ensureFreshOAuth` are re-imported by `cli.ts`, so every existing subcommand
@@ -460,7 +460,7 @@ export async function refreshOAuth(io, origin, slot, cred, persist = true) {
460
460
  }
461
461
  }
462
462
  /**
463
- * Mint a new agent identity on `origin` as the human `cred` and persist the
463
+ * Mint a new Scoped Identity on `origin` as the human `cred` and persist the
464
464
  * returned `olp_` token to slot `agent:<name>`. CLI-free (no `Args`, no exit
465
465
  * codes — the caller maps failures to exit codes) so both `owenloop agent new`
466
466
  * (O3) and `owenloop mcp`'s `create_agent` (O2) can reuse it.
@@ -481,8 +481,8 @@ export async function refreshOAuth(io, origin, slot, cred, persist = true) {
481
481
  * today; explicit for symmetry with the store/refresh signatures).
482
482
  * @param params.scopes defaults to `['work']` — the H3 route REQUIRES a
483
483
  * non-empty `scopes`; an empty list is server-refused.
484
- * @param params.pools omitted when absent so the server defaults to the minter's
485
- * personal pool (`pools: []` is server-refused with `pool_invalid`).
484
+ * @param params.crews omitted when absent so the server defaults to the minter's
485
+ * personal crew (`crews: []` is server-refused with `crew_invalid`).
486
486
  */
487
487
  export async function mintAgentCredential(io, origin, humanSlot, cred, params) {
488
488
  // 1. Validate the agent name before any I/O. The client regex is byte-identical
@@ -508,12 +508,12 @@ export async function mintAgentCredential(io, origin, humanSlot, cred, params) {
508
508
  'Content-Type': 'application/json',
509
509
  Accept: 'application/json',
510
510
  },
511
- // `pools` omitted entirely when absent (server default = personal pool);
511
+ // `crews` omitted entirely when absent (server default = personal crew);
512
512
  // never sent as `[]` (server-refused).
513
513
  body: JSON.stringify({
514
514
  name: params.name,
515
515
  scopes,
516
- ...(params.pools !== undefined ? { pools: params.pools } : {}),
516
+ ...(params.crews !== undefined ? { crews: params.crews } : {}),
517
517
  }),
518
518
  });
519
519
  // 4 + 5. POST; on a 401 with an oauth credential, refresh once and retry once —
@@ -530,7 +530,7 @@ export async function mintAgentCredential(io, origin, humanSlot, cred, params) {
530
530
  throw new CliError('credential rejected by the hub — run `owenloop login`');
531
531
  }
532
532
  // 6. Any other non-2xx: surface the hub's typed `message` VERBATIM (this is how
533
- // H1's `agent name already taken: "…"`, `pool_invalid`, `bad_request`, and
533
+ // H1's `agent name already taken: "…"`, `crew_invalid`, `bad_request`, and
534
534
  // `forbidden` all surface uniformly). Never include raw body text.
535
535
  if (!res.ok) {
536
536
  let message;
@@ -580,18 +580,20 @@ export async function mintAgentCredential(io, origin, humanSlot, cred, params) {
580
580
  `The agent '${params.name}' now exists on the hub — recover via the console (Reconnect/re-key) ` +
581
581
  `once storage works; re-running \`agent new ${params.name}\` will refuse the taken name`);
582
582
  }
583
- // 9. Return non-secret handles only — no token field exists to leak.
584
- return { id: ok.id, agentId: ok.agentId, pools: ok.pools, storage };
583
+ // 9. Return non-secret handles only — no token field exists to leak. `scopes`
584
+ // is the client-resolved request value (server honors it verbatim), not a
585
+ // server-body field — the mint response guard does not parse scopes.
586
+ return { id: ok.id, agentId: ok.agentId, crews: ok.crews, scopes, storage };
585
587
  }
586
588
  /**
587
- * Re-key an EXISTING agent identity on `origin` as the human `cred`: the hub
589
+ * Re-key an EXISTING Scoped Identity on `origin` as the human `cred`: the hub
588
590
  * mints a fresh `olp_` token for `agentId`, REVOKES the identity's current
589
591
  * token(s), and this function persists the new token into the SAME
590
592
  * `agent:<name>` slot — overwriting the old one. Sibling of
591
593
  * `mintAgentCredential` with the identical §6 discipline; the only shape
592
594
  * differences are the endpoint (`/api/rekey_agent_token`), the request body
593
- * (`{agentId}` — no name/scopes/pools; rekey preserves pools), and the response
594
- * guard (`asRekeyAgentTokenOk` — no `pools` field).
595
+ * (`{agentId}` — no name/scopes/crews; rekey preserves crews), and the response
596
+ * guard (`asRekeyAgentTokenOk` — no `crews` field).
595
597
  *
596
598
  * **The token NEVER leaves this function.** It flows exactly one hop —
597
599
  * `asRekeyAgentTokenOk(body).token` → `storeCredential` — and is never returned,
@@ -35,13 +35,13 @@ const RAW_PRODUCE_KEYS = ['name', 'schema', 'judges', 'maxAttempts', 'maxSchemaF
35
35
  * fields, so it gets its own allowlist rather than folding into
36
36
  * RAW_PRODUCE_KEYS (§27 unknown-key rejection). */
37
37
  const RAW_GROUP_KEYS = ['group', 'mode', 'of'];
38
- const RAW_JUDGE_KEYS = ['name', 'body', 'bodyFile', 'model', 'inputs', 'cadence', 'maxRunsPerDay', 'worker', 'command', 'spec'];
38
+ const RAW_JUDGE_KEYS = ['name', 'body', 'bodyFile', 'model', 'inputs', 'cadence', 'maxRunsPerDay', 'executor', 'command', 'spec'];
39
39
  /** Keys valid on a normal (non-calls:, non-include:) step entry. */
40
40
  const RAW_STEP_KEYS = [
41
41
  'name', 'consumes', 'produces', 'generates', 'invalidates', 'cadence',
42
42
  'maxRunsPerDay', 'parallel', 'maxAttempts', 'maxSchemaFailures', 'model',
43
43
  'workdir', 'terminal', 'effect', 'on', 'idleAfter', 'body', 'bodyFile',
44
- 'calls', 'reapTtl', 'labels', 'maxLease', 'x', 'worker', 'command', 'spec',
44
+ 'calls', 'reapTtl', 'capabilities', 'maxLease', 'x', 'executor', 'command', 'spec',
45
45
  ];
46
46
  /** Keys valid on a calls: step entry — a DIFFERENT (smaller) shape than RawStep;
47
47
  * the `calls:` key is what routes an entry here instead of RAW_STEP_KEYS. */
@@ -49,7 +49,7 @@ const RAW_CALLS_KEYS = ['name', 'calls', 'inputs', 'produces'];
49
49
  /** Keys valid on an include: directive entry — the `include:` key is the
50
50
  * discriminator that routes an entry here instead of RAW_STEP_KEYS/RAW_CALLS_KEYS. */
51
51
  const RAW_INCLUDE_KEYS = ['include', 'as', 'inputs'];
52
- const RAW_DEF_KEYS = ['name', 'title', 'description', 'inputs', 'steps', 'outputs', 'invariants', 'engine', 'x', 'workers'];
52
+ const RAW_DEF_KEYS = ['name', 'title', 'description', 'inputs', 'steps', 'outputs', 'invariants', 'engine', 'x', 'executors'];
53
53
  // ---- defaults ----------------------------------------------------------------
54
54
  const DEFAULTS = {
55
55
  cadence: '0s',
@@ -263,8 +263,8 @@ function parseJudges(v, ctx, baseDir) {
263
263
  if (raw.maxRunsPerDay !== undefined) {
264
264
  judge.maxRunsPerDay = asNumber(raw.maxRunsPerDay, DEFAULTS.maxRunsPerDay, `judge '${name}'.maxRunsPerDay`);
265
265
  }
266
- if (raw.worker !== undefined)
267
- judge.worker = asString(raw.worker, `judge '${name}'.worker`);
266
+ if (raw.executor !== undefined)
267
+ judge.executor = asString(raw.executor, `judge '${name}'.executor`);
268
268
  if (raw.command !== undefined)
269
269
  judge.command = asString(raw.command, `judge '${name}'.command`);
270
270
  if (raw.spec !== undefined)
@@ -574,8 +574,8 @@ export function buildDef(raw, source, baseDir) {
574
574
  }
575
575
  if (r.x !== undefined)
576
576
  def.x = asExtension(r.x, `workflow '${name}'.x`);
577
- if (r.workers !== undefined)
578
- def.workers = asStringArray(r.workers, `workflow '${name}'.workers`);
577
+ if (r.executors !== undefined)
578
+ def.executors = asStringArray(r.executors, `workflow '${name}'.executors`);
579
579
  return def;
580
580
  }
581
581
  // ---- Mode 1 expand helpers (M1-EXPAND) ----------------------------------------
@@ -780,8 +780,8 @@ function synthesizeJudgeSteps(producerStepName, pat, producerConsumeStems) {
780
780
  };
781
781
  if (j.model !== undefined)
782
782
  step.model = j.model;
783
- if (j.worker !== undefined)
784
- step.worker = j.worker;
783
+ if (j.executor !== undefined)
784
+ step.executor = j.executor;
785
785
  if (j.command !== undefined)
786
786
  step.command = j.command;
787
787
  if (j.spec !== undefined)
@@ -879,8 +879,8 @@ function buildStep(rl, i, baseDir) {
879
879
  step.workdir = asString(rl.workdir, `step '${name}'.workdir`);
880
880
  if (rl.model !== undefined)
881
881
  step.model = asString(rl.model, `step '${name}'.model`);
882
- if (rl.worker !== undefined)
883
- step.worker = asString(rl.worker, `step '${name}'.worker`);
882
+ if (rl.executor !== undefined)
883
+ step.executor = asString(rl.executor, `step '${name}'.executor`);
884
884
  if (rl.command !== undefined)
885
885
  step.command = asString(rl.command, `step '${name}'.command`);
886
886
  if (rl.spec !== undefined)
@@ -929,12 +929,12 @@ function buildStep(rl, i, baseDir) {
929
929
  const reapTtlStr = asString(rl.reapTtl, `step '${name}'.reapTtl`);
930
930
  step.reapTtlMs = parseDurationMs(reapTtlStr);
931
931
  }
932
- // A2: opaque routing labels. Empty list normalizes to absent (claimable by
932
+ // A2: opaque routing capabilities. Empty list normalizes to absent (claimable by
933
933
  // any caller), mirroring the groups.length > 0 pattern below.
934
- if (rl.labels !== undefined) {
935
- const ls = asStringArray(rl.labels, `step '${name}'.labels`);
934
+ if (rl.capabilities !== undefined) {
935
+ const ls = asStringArray(rl.capabilities, `step '${name}'.capabilities`);
936
936
  if (ls.length > 0)
937
- step.labels = ls;
937
+ step.capabilities = ls;
938
938
  }
939
939
  // A3: per-step max total lease lifetime (duration string, same as reapTtl).
940
940
  if (rl.maxLease !== undefined) {
@@ -1098,40 +1098,40 @@ export function validateDef(def) {
1098
1098
  }
1099
1099
  }
1100
1100
  }
1101
- // W1-VALIDATE: worker:/command: shape rules (declarative executor dispatch).
1102
- // Only two hard requirements; any other worker value is fully opaque.
1101
+ // W1-VALIDATE: executor:/command: shape rules (declarative executor dispatch).
1102
+ // Only two hard requirements; any other executor value is fully opaque.
1103
1103
  for (const l of def.steps) {
1104
- const worker = l.worker ?? 'agent';
1105
- // Deliberately `l.worker === 'agent'` (explicit opt-in), NOT
1106
- // `(l.worker ?? 'agent') === 'agent'` — that stricter form would also
1104
+ const executor = l.executor ?? 'agent';
1105
+ // Deliberately `l.executor === 'agent'` (explicit opt-in), NOT
1106
+ // `(l.executor ?? 'agent') === 'agent'` — that stricter form would also
1107
1107
  // catch every default-agent step that already gets away with an empty
1108
1108
  // body today (e.g. calls:-adjacent or generator-only fixtures), breaking
1109
- // existing defs that never write `worker:` at all. Scoping the check to
1110
- // an EXPLICIT `worker: agent` keeps every pre-existing def byte-for-byte
1111
- // unaffected while still catching "someone opted into the agent worker
1109
+ // existing defs that never write `executor:` at all. Scoping the check to
1110
+ // an EXPLICIT `executor: agent` keeps every pre-existing def byte-for-byte
1111
+ // unaffected while still catching "someone opted into the agent executor
1112
1112
  // type and forgot a body".
1113
- if (l.worker === 'agent' && l.body.trim() === '') {
1114
- errors.push(`step '${l.name}' has worker 'agent' but no body: (an agent step needs a prompt)`);
1113
+ if (l.executor === 'agent' && l.body.trim() === '') {
1114
+ errors.push(`step '${l.name}' has executor 'agent' but no body: (an agent step needs a prompt)`);
1115
1115
  }
1116
- else if (worker === 'command') {
1116
+ else if (executor === 'command') {
1117
1117
  if (l.command === undefined) {
1118
- errors.push(`step '${l.name}' has worker 'command' but no command:`);
1118
+ errors.push(`step '${l.name}' has executor 'command' but no command:`);
1119
1119
  }
1120
1120
  }
1121
- // any other worker value: opaque, no body/command requirement
1121
+ // any other executor value: opaque, no body/command requirement
1122
1122
  }
1123
- // W1-VALIDATE: workers: def-level allow-list typo guard. Applied AFTER the
1124
- // per-step `worker` default (?? 'agent') — a def declaring `workers:
1123
+ // W1-VALIDATE: executors: def-level allow-list typo guard. Applied AFTER the
1124
+ // per-step `executor` default (?? 'agent') — a def declaring `executors:
1125
1125
  // [command]` (deliberately excluding 'agent') still fails a step that omits
1126
- // `worker:` entirely, since its effective worker is 'agent'. This is
1126
+ // `executor:` entirely, since its effective executor is 'agent'. This is
1127
1127
  // intended (the list is exhaustive once declared), documented in
1128
1128
  // docs/authoring.md.
1129
- if (def.workers && def.workers.length > 0) {
1130
- const allowed = new Set(def.workers);
1129
+ if (def.executors && def.executors.length > 0) {
1130
+ const allowed = new Set(def.executors);
1131
1131
  for (const l of def.steps) {
1132
- const worker = l.worker ?? 'agent';
1133
- if (!allowed.has(worker)) {
1134
- errors.push(`step '${l.name}' has worker '${worker}' but workflow '${def.name}'.workers does not list it`);
1132
+ const executor = l.executor ?? 'agent';
1133
+ if (!allowed.has(executor)) {
1134
+ errors.push(`step '${l.name}' has executor '${executor}' but workflow '${def.name}'.executors does not list it`);
1135
1135
  }
1136
1136
  }
1137
1137
  }
@@ -45,11 +45,11 @@ export declare class SchemaRefusalError extends Error {
45
45
  * step's daily run allowance is exhausted (binding over parallel); `'parallel-cap'`
46
46
  * — the step's concurrency cap is the binding constraint. Always emitted by
47
47
  * `applySchedule` or `tick`; never alters which firings are selected or claimed.
48
- * `'label-mismatch'` (A2) — the tick caller passed a label filter that does not
49
- * intersect the step's declared labels, so a peer orchestrator serving other
50
- * labels leaves it for the matching caller.
48
+ * `'capability-mismatch'` (A2) — the tick caller passed a capability filter that does not
49
+ * intersect the step's declared capabilities, so a peer orchestrator serving other
50
+ * capabilities leaves it for the matching caller.
51
51
  */
52
- export type DeferredReason = 'in-flight' | 'cadence' | 'daily-budget' | 'parallel-cap' | 'label-mismatch';
52
+ export type DeferredReason = 'in-flight' | 'cadence' | 'daily-budget' | 'parallel-cap' | 'capability-mismatch';
53
53
  export interface DeferredFiring {
54
54
  step: string;
55
55
  key: string;
@@ -428,7 +428,7 @@ export declare class Engine {
428
428
  tick(workflow: string, opts?: {
429
429
  now?: number;
430
430
  deep?: boolean;
431
- labels?: string[];
431
+ capabilities?: string[];
432
432
  }): TickResult;
433
433
  /**
434
434
  * The recursive tick worker. Runs this instance's own maintain → reap →
@@ -501,9 +501,9 @@ export declare class Engine {
501
501
  private callsDescendTargets;
502
502
  /**
503
503
  * Per-step cadence + daily budget + parallel cap over the eligible firings.
504
- * A2: `labels` is the tick caller's optional claim filter — when non-empty, a
505
- * step whose own `labels` are also non-empty is only schedulable when the two
506
- * intersect; a disjoint step's firings are deferred as `'label-mismatch'`.
504
+ * A2: `capabilities` is the tick caller's optional claim filter — when non-empty, a
505
+ * step whose own `capabilities` are also non-empty is only schedulable when the two
506
+ * intersect; a disjoint step's firings are deferred as `'capability-mismatch'`.
507
507
  * Filtering here (before cadence/budget) means a mismatched firing never
508
508
  * consumes the caller's slots and never perturbs cadence math.
509
509
  */
@@ -806,7 +806,7 @@ export class Engine {
806
806
  * only this instance's own orders. See `TickResult` for the fold semantics.
807
807
  */
808
808
  tick(workflow, opts = {}) {
809
- return this.tickInternal(workflow, opts.now ?? nowMs(), opts.deep ?? true, opts.labels ?? [], new Set(), 0);
809
+ return this.tickInternal(workflow, opts.now ?? nowMs(), opts.deep ?? true, opts.capabilities ?? [], new Set(), 0);
810
810
  }
811
811
  /**
812
812
  * The recursive tick worker. Runs this instance's own maintain → reap →
@@ -847,7 +847,7 @@ export class Engine {
847
847
  * edge it hangs from. The guard is silent (no debt/reasons/events), mirroring
848
848
  * the abort discipline of `publishCallsGreen`/`provisionCallsChild`.
849
849
  */
850
- tickInternal(workflow, now, deep, labels, visited, depth, parentEdge) {
850
+ tickInternal(workflow, now, deep, capabilities, visited, depth, parentEdge) {
851
851
  if (depth > this.maxCallDepth) {
852
852
  throw new Error(`calls depth limit exceeded (maxCallDepth=${this.maxCallDepth}) ticking '${workflow}': `
853
853
  + `a calls: composition is deeper than the bound, which usually means a calls: cycle `
@@ -893,7 +893,7 @@ export class Engine {
893
893
  // Compute time facts for idle eligibility (clock-read boundary).
894
894
  const timeFacts = this.computeTimeFacts(def, workflow, arts, now);
895
895
  const firings = eligibleFirings(def, arts, timeFacts);
896
- const { selected, deferred } = this.applySchedule(workflow, def, firings, now, labels);
896
+ const { selected, deferred } = this.applySchedule(workflow, def, firings, now, capabilities);
897
897
  // Clear alarm_at for any idle firing that was selected (consume the alarm).
898
898
  for (const f of selected) {
899
899
  if (f.cause === 'idle') {
@@ -927,7 +927,7 @@ export class Engine {
927
927
  // subtree — do not tick grandchildren off a frame that issued nothing.
928
928
  if (deep && !staleEdge) {
929
929
  for (const { step, child } of this.callsDescendTargets(workflow, def)) {
930
- const cr = this.tickInternal(child.id, now, deep, labels, visited, depth + 1, {
930
+ const cr = this.tickInternal(child.id, now, deep, capabilities, visited, depth + 1, {
931
931
  parentWf: workflow,
932
932
  step,
933
933
  callsStem: step.produces[0].stem,
@@ -1001,13 +1001,13 @@ export class Engine {
1001
1001
  }
1002
1002
  /**
1003
1003
  * Per-step cadence + daily budget + parallel cap over the eligible firings.
1004
- * A2: `labels` is the tick caller's optional claim filter — when non-empty, a
1005
- * step whose own `labels` are also non-empty is only schedulable when the two
1006
- * intersect; a disjoint step's firings are deferred as `'label-mismatch'`.
1004
+ * A2: `capabilities` is the tick caller's optional claim filter — when non-empty, a
1005
+ * step whose own `capabilities` are also non-empty is only schedulable when the two
1006
+ * intersect; a disjoint step's firings are deferred as `'capability-mismatch'`.
1007
1007
  * Filtering here (before cadence/budget) means a mismatched firing never
1008
1008
  * consumes the caller's slots and never perturbs cadence math.
1009
1009
  */
1010
- applySchedule(workflow, def, firings, now, labels) {
1010
+ applySchedule(workflow, def, firings, now, capabilities) {
1011
1011
  const midnight = localMidnightMs(now);
1012
1012
  const selected = [];
1013
1013
  const deferred = [];
@@ -1021,13 +1021,13 @@ export class Engine {
1021
1021
  const stepFirings = firings.filter((f) => f.step === step.name);
1022
1022
  if (stepFirings.length === 0)
1023
1023
  continue;
1024
- // A2: caller label filter vs. step labels. Both non-empty and disjoint →
1024
+ // A2: caller capability filter vs. step capabilities. Both non-empty and disjoint →
1025
1025
  // this caller must not claim the step; defer every firing and skip it
1026
1026
  // before it touches cadence/budget/slot math.
1027
- if (labels.length > 0 && step.labels && step.labels.length > 0 &&
1028
- !step.labels.some((l) => labels.includes(l))) {
1027
+ if (capabilities.length > 0 && step.capabilities && step.capabilities.length > 0 &&
1028
+ !step.capabilities.some((l) => capabilities.includes(l))) {
1029
1029
  for (const f of stepFirings)
1030
- defer(f, 'label-mismatch');
1030
+ defer(f, 'capability-mismatch');
1031
1031
  continue;
1032
1032
  }
1033
1033
  const latest = this.store.latestRun(workflow, step.name);
@@ -1187,8 +1187,8 @@ export class Engine {
1187
1187
  order.workdir = step.workdir;
1188
1188
  if (step.model !== undefined)
1189
1189
  order.model = step.model;
1190
- if (step.worker !== undefined)
1191
- order.worker = step.worker;
1190
+ if (step.executor !== undefined)
1191
+ order.executor = step.executor;
1192
1192
  if (step.command !== undefined)
1193
1193
  order.command = step.command;
1194
1194
  if (step.spec !== undefined)