owenloop 0.4.0 → 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 (155) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +98 -25
  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/{add.d.ts → src/add.d.ts} +12 -40
  109. package/dist/{add.js → src/add.js} +11 -176
  110. package/dist/src/cli.d.ts +147 -0
  111. package/dist/{cli.js → src/cli.js} +1643 -353
  112. package/dist/src/credentials.d.ts +280 -0
  113. package/dist/src/credentials.js +697 -0
  114. package/dist/{defs.js → src/defs.js} +59 -36
  115. package/dist/{engine.d.ts → src/engine.d.ts} +8 -8
  116. package/dist/{engine.js → src/engine.js} +29 -20
  117. package/dist/{hub.d.ts → src/hub.d.ts} +330 -2
  118. package/dist/{hub.js → src/hub.js} +531 -1
  119. package/dist/{index.d.ts → src/index.d.ts} +3 -1
  120. package/dist/{index.js → src/index.js} +2 -1
  121. package/dist/src/lock.d.ts +80 -0
  122. package/dist/src/lock.js +217 -0
  123. package/dist/src/mcp/serve.d.ts +85 -0
  124. package/dist/src/mcp/serve.js +702 -0
  125. package/dist/src/mcp/server.d.ts +132 -0
  126. package/dist/src/mcp/server.js +327 -0
  127. package/dist/{model.d.ts → src/model.d.ts} +59 -4
  128. package/dist/{model.js → src/model.js} +149 -22
  129. package/dist/{types.d.ts → src/types.d.ts} +66 -24
  130. package/dist/{util.d.ts → src/util.d.ts} +25 -0
  131. package/dist/{util.js → src/util.js} +26 -0
  132. package/dist/src/work-settings.d.ts +57 -0
  133. package/dist/src/work-settings.js +84 -0
  134. package/docs/authoring.md +102 -53
  135. package/docs/cli.md +883 -29
  136. package/docs/design.md +119 -45
  137. package/docs/embedding.md +39 -14
  138. package/examples/workflows/{command-worker.yaml → command-executor.yaml} +15 -15
  139. package/examples/workflows/compile-dev-playbook.yaml +338 -0
  140. package/examples/workflows/judges/gate-sharpness.md +39 -0
  141. package/examples/workflows/judges/security.md +34 -0
  142. package/package.json +17 -8
  143. package/dist/cli.d.ts +0 -83
  144. /package/dist/{defs.d.ts → src/defs.d.ts} +0 -0
  145. /package/dist/{factory.d.ts → src/factory.d.ts} +0 -0
  146. /package/dist/{factory.js → src/factory.js} +0 -0
  147. /package/dist/{paths.d.ts → src/paths.d.ts} +0 -0
  148. /package/dist/{paths.js → src/paths.js} +0 -0
  149. /package/dist/{schema.d.ts → src/schema.d.ts} +0 -0
  150. /package/dist/{schema.js → src/schema.js} +0 -0
  151. /package/dist/{store.d.ts → src/store.d.ts} +0 -0
  152. /package/dist/{store.js → src/store.js} +0 -0
  153. /package/dist/{types.js → src/types.js} +0 -0
  154. /package/dist/{untar.d.ts → src/untar.d.ts} +0 -0
  155. /package/dist/{untar.js → src/untar.js} +0 -0
@@ -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) {
@@ -1006,6 +1006,18 @@ export function validateDef(def) {
1006
1006
  errors.push(`step '${l.name}' produces a per-element output but has no map (\$i) consume to bind it`);
1007
1007
  }
1008
1008
  }
1009
+ // a reduce-mode step whose only produces are collections can never fire: eligibleFirings'
1010
+ // reduce branch (src/model.ts) derives the discharge set from singletonProduces(step) only,
1011
+ // so zero singleton produces means outs.length === 0 and no firing is ever pushed — the step
1012
+ // is silently dead (collection debt owed forever, absent from eligible/pending/blocked).
1013
+ for (const l of def.steps) {
1014
+ const isReduce = l.consumes.some((c) => c.mode === 'reduce');
1015
+ const hasCollectionProduce = l.produces.some((p) => p.kind === 'collection');
1016
+ const hasSingletonProduce = l.produces.some((p) => p.kind === 'singleton');
1017
+ if (isReduce && hasCollectionProduce && !hasSingletonProduce) {
1018
+ errors.push(`step ${l.name} is reduce-mode but produces only collections; reduce steps can only discharge singleton produces`);
1019
+ }
1020
+ }
1009
1021
  // same stem in both produces: and generates: on the same step is a hard error
1010
1022
  for (const l of def.steps) {
1011
1023
  if (!l.generates || l.generates.length === 0)
@@ -1086,40 +1098,40 @@ export function validateDef(def) {
1086
1098
  }
1087
1099
  }
1088
1100
  }
1089
- // W1-VALIDATE: worker:/command: shape rules (declarative executor dispatch).
1090
- // 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.
1091
1103
  for (const l of def.steps) {
1092
- const worker = l.worker ?? 'agent';
1093
- // Deliberately `l.worker === 'agent'` (explicit opt-in), NOT
1094
- // `(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
1095
1107
  // catch every default-agent step that already gets away with an empty
1096
1108
  // body today (e.g. calls:-adjacent or generator-only fixtures), breaking
1097
- // existing defs that never write `worker:` at all. Scoping the check to
1098
- // an EXPLICIT `worker: agent` keeps every pre-existing def byte-for-byte
1099
- // 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
1100
1112
  // type and forgot a body".
1101
- if (l.worker === 'agent' && l.body.trim() === '') {
1102
- 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)`);
1103
1115
  }
1104
- else if (worker === 'command') {
1116
+ else if (executor === 'command') {
1105
1117
  if (l.command === undefined) {
1106
- errors.push(`step '${l.name}' has worker 'command' but no command:`);
1118
+ errors.push(`step '${l.name}' has executor 'command' but no command:`);
1107
1119
  }
1108
1120
  }
1109
- // any other worker value: opaque, no body/command requirement
1121
+ // any other executor value: opaque, no body/command requirement
1110
1122
  }
1111
- // W1-VALIDATE: workers: def-level allow-list typo guard. Applied AFTER the
1112
- // 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:
1113
1125
  // [command]` (deliberately excluding 'agent') still fails a step that omits
1114
- // `worker:` entirely, since its effective worker is 'agent'. This is
1126
+ // `executor:` entirely, since its effective executor is 'agent'. This is
1115
1127
  // intended (the list is exhaustive once declared), documented in
1116
1128
  // docs/authoring.md.
1117
- if (def.workers && def.workers.length > 0) {
1118
- const allowed = new Set(def.workers);
1129
+ if (def.executors && def.executors.length > 0) {
1130
+ const allowed = new Set(def.executors);
1119
1131
  for (const l of def.steps) {
1120
- const worker = l.worker ?? 'agent';
1121
- if (!allowed.has(worker)) {
1122
- 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`);
1123
1135
  }
1124
1136
  }
1125
1137
  }
@@ -1147,6 +1159,17 @@ export function validateDef(def) {
1147
1159
  errors.push(`step '${l.name}': idleAfter is set but 'idle' is not in on:; idleAfter is only meaningful with the idle trigger`);
1148
1160
  }
1149
1161
  }
1162
+ // an allGreen/idle evaluator step that declares consumes can never commit: both firings
1163
+ // (src/model.ts) are built with inputs: [], so the claim fingerprint is empty, but commit-time
1164
+ // casCheck (src/engine.ts) derives required inputs from consumes and finds no fingerprint
1165
+ // entry for them — every firing is born-rejected forever. Evaluators must declare their
1166
+ // output under generates: with no consumes: (see examples/workflows/sla-watchdog.yaml, monitor).
1167
+ for (const l of def.steps) {
1168
+ const triggers = l.on ?? ['inputsGreen'];
1169
+ if (triggers.some((t) => t === 'allGreen' || t === 'idle') && l.consumes.length > 0) {
1170
+ errors.push(`evaluator step ${l.name} (on: allGreen/idle) must not declare consumes; its firings carry no input fingerprint`);
1171
+ }
1172
+ }
1150
1173
  // M2-VALIDATE: calls: step per-def rules.
1151
1174
  // Note: cross-def checks (target-def existence, child input-key validity) cannot be done here
1152
1175
  // because validateDef is a pure per-def function with no resolver. Those checks live in loadDefs
@@ -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)
@@ -1337,7 +1337,7 @@ export class Engine {
1337
1337
  const req = requiredInputs(def, arts, art);
1338
1338
  const cas = this.casCheck(arts, req, r.fingerprint ?? {});
1339
1339
  if (cas.moved) {
1340
- this.bornReject(art, cas.moved);
1340
+ this.bornReject(art, cas.moved, cas.reason);
1341
1341
  this.releaseLeaseOnBornReject(workflow, run);
1342
1342
  this.settle(workflow, def);
1343
1343
  return { path, outcome: 'born-rejected', reason: cas.reason };
@@ -1419,7 +1419,7 @@ export class Engine {
1419
1419
  if (cas.moved) {
1420
1420
  const seal = arts.get(sealPath(stem));
1421
1421
  if (seal)
1422
- this.bornReject(seal, cas.moved);
1422
+ this.bornReject(seal, cas.moved, cas.reason);
1423
1423
  this.releaseLeaseOnBornReject(workflow, run);
1424
1424
  this.settle(workflow, def);
1425
1425
  return { outcome: 'born-rejected', created: [], reason: cas.reason };
@@ -1512,7 +1512,7 @@ export class Engine {
1512
1512
  const req = plainConsumes(step).map((c) => c.stem);
1513
1513
  const cas = this.casCheck(arts, req, r.fingerprint ?? {});
1514
1514
  if (cas.moved) {
1515
- this.bornReject(sealArt, cas.moved);
1515
+ this.bornReject(sealArt, cas.moved, cas.reason);
1516
1516
  this.releaseLeaseOnBornReject(workflow, run);
1517
1517
  this.settle(workflow, def);
1518
1518
  return { path: sealP, outcome: 'born-rejected', reason: cas.reason };
@@ -2297,13 +2297,13 @@ export class Engine {
2297
2297
  });
2298
2298
  }
2299
2299
  }
2300
- bornReject(art, movedPath) {
2300
+ bornReject(art, movedPath, reasonText) {
2301
2301
  this.store.putArtifact({
2302
2302
  ...art,
2303
2303
  acceptance: 'rejected',
2304
2304
  reasons: [
2305
2305
  ...art.reasons,
2306
- reason('born-rejected', 'structural', 'engine', `born-rejected: ${movedPath} moved during this run`, art.version),
2306
+ reason('born-rejected', 'structural', 'engine', `born-rejected: ${reasonText ?? `${movedPath} moved during this run`}`, art.version),
2307
2307
  ],
2308
2308
  });
2309
2309
  }
@@ -2315,7 +2315,16 @@ export class Engine {
2315
2315
  }
2316
2316
  if (!fingerprintMatches(arts, req, fp)) {
2317
2317
  const moved = req.find((p) => (arts.get(p)?.version ?? -1) !== fp[p]) ?? req[0] ?? 'inputs';
2318
- return { moved, reason: `${moved} moved version during this run` };
2318
+ // Two structurally different causes share this branch: (a) ABSENT — the path
2319
+ // was never in the claim fingerprint at all (e.g. an allGreen/idle firing whose
2320
+ // inputs: [] yields fp={}, but the step still declares consumes:), so there is
2321
+ // no claimed version to have "moved" from; (b) CHANGED — the path WAS
2322
+ // fingerprinted but a concurrent commit moved it since claim. Keep the wording
2323
+ // distinct so the diagnostic doesn't lie about case (a).
2324
+ if (fp[moved] === undefined) {
2325
+ return { moved, reason: `${moved} was not in the claim fingerprint (this firing carried no input version for it)` };
2326
+ }
2327
+ return { moved, reason: `${moved} moved version during this run (claimed v${fp[moved]}, now v${arts.get(moved)?.version ?? -1})` };
2319
2328
  }
2320
2329
  return {};
2321
2330
  }