owenloop 0.5.0 → 0.5.2

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 (229) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +144 -35
  3. package/bin/owenloop.mjs +49 -1
  4. package/dist/packages/work/src/agent/brief.d.ts +29 -4
  5. package/dist/packages/work/src/agent/brief.js +49 -4
  6. package/dist/packages/work/src/agent/capability-model.d.ts +123 -0
  7. package/dist/packages/work/src/agent/capability-model.js +148 -0
  8. package/dist/packages/work/src/agent/loop.d.ts +56 -7
  9. package/dist/packages/work/src/agent/loop.js +166 -9
  10. package/dist/packages/work/src/bundle/cache.d.ts +7 -5
  11. package/dist/packages/work/src/bundle/cache.js +20 -6
  12. package/dist/packages/work/src/bundle/fetch.d.ts +7 -5
  13. package/dist/packages/work/src/bundle/fetch.js +27 -7
  14. package/dist/packages/work/src/bundle/types.d.ts +8 -4
  15. package/dist/packages/work/src/consumed-verifier.d.ts +45 -0
  16. package/dist/packages/work/src/consumed-verifier.js +205 -0
  17. package/dist/packages/work/src/exec/instructions.d.ts +99 -0
  18. package/dist/packages/work/src/exec/instructions.js +323 -0
  19. package/dist/packages/work/src/exec/loop.d.ts +29 -1
  20. package/dist/packages/work/src/exec/loop.js +313 -35
  21. package/dist/packages/work/src/exec/payload.d.ts +29 -0
  22. package/dist/packages/work/src/exec/payload.js +54 -0
  23. package/dist/packages/work/src/exec/receipt.d.ts +9 -6
  24. package/dist/packages/work/src/exec/receipt.js +12 -1
  25. package/dist/packages/work/src/exec/runner.d.ts +7 -1
  26. package/dist/packages/work/src/exec/runner.js +84 -3
  27. package/dist/packages/work/src/harness/child-env.js +7 -0
  28. package/dist/packages/work/src/harness/claude.d.ts +20 -8
  29. package/dist/packages/work/src/harness/claude.js +260 -58
  30. package/dist/packages/work/src/harness/codex.d.ts +5 -4
  31. package/dist/packages/work/src/harness/codex.js +169 -41
  32. package/dist/packages/work/src/harness/contract.d.ts +36 -11
  33. package/dist/packages/work/src/harness/fake.js +1 -0
  34. package/dist/packages/work/src/harness/jsonrpc-stdio.js +7 -0
  35. package/dist/packages/work/src/harness/permissions.d.ts +16 -3
  36. package/dist/packages/work/src/harness/permissions.js +102 -13
  37. package/dist/packages/work/src/harness/session-store.d.ts +30 -10
  38. package/dist/packages/work/src/harness/session-store.js +317 -89
  39. package/dist/packages/work/src/hold/mcp.d.ts +25 -5
  40. package/dist/packages/work/src/hold/mcp.js +134 -12
  41. package/dist/packages/work/src/hub/client.d.ts +8 -1
  42. package/dist/packages/work/src/hub/client.js +15 -1
  43. package/dist/packages/work/src/hub/types.d.ts +137 -33
  44. package/dist/packages/work/src/hub/types.js +8 -10
  45. package/dist/packages/work/src/mcp/server.js +1 -1
  46. package/dist/packages/work/src/owenloop-bin.d.ts +1 -0
  47. package/dist/packages/work/src/owenloop-bin.js +18 -0
  48. package/dist/packages/work/src/roles/agent-run.d.ts +12 -6
  49. package/dist/packages/work/src/roles/agent-run.js +115 -34
  50. package/dist/packages/work/src/roles/exec.d.ts +8 -0
  51. package/dist/packages/work/src/roles/exec.js +27 -2
  52. package/dist/packages/work/src/roles/hold.d.ts +6 -0
  53. package/dist/packages/work/src/roles/hold.js +83 -13
  54. package/dist/packages/work/src/roles/lint.d.ts +3 -4
  55. package/dist/packages/work/src/roles/lint.js +41 -7
  56. package/dist/packages/work/src/roles/settings.js +19 -2
  57. package/dist/packages/work/src/roles/shift.d.ts +1 -0
  58. package/dist/packages/work/src/roles/shift.js +36 -2
  59. package/dist/packages/work/src/settings/settings.d.ts +70 -1
  60. package/dist/packages/work/src/settings/settings.js +90 -4
  61. package/dist/packages/work/src/shift/logretention.d.ts +253 -0
  62. package/dist/packages/work/src/shift/logretention.js +407 -0
  63. package/dist/packages/work/src/shift/logsink.d.ts +14 -0
  64. package/dist/packages/work/src/shift/logsink.js +98 -0
  65. package/dist/packages/work/src/shift/loop.d.ts +32 -4
  66. package/dist/packages/work/src/shift/loop.js +687 -166
  67. package/dist/packages/work/src/shift/protocol.d.ts +128 -1
  68. package/dist/packages/work/src/shift/protocol.js +14 -0
  69. package/dist/packages/work/src/shift/runtime.d.ts +16 -0
  70. package/dist/packages/work/src/shift/runtime.js +291 -5
  71. package/dist/packages/work/src/shift/server.d.ts +13 -0
  72. package/dist/packages/work/src/shift/server.js +61 -36
  73. package/dist/packages/work/src/shift/spawn.d.ts +115 -19
  74. package/dist/packages/work/src/shift/spawn.js +234 -30
  75. package/dist/packages/work/src/shift/state.d.ts +76 -49
  76. package/dist/packages/work/src/shift/state.js +350 -103
  77. package/dist/packages/work/src/shift/truncate.d.ts +35 -0
  78. package/dist/packages/work/src/shift/truncate.js +73 -0
  79. package/dist/packages/work/src/submit-proof.d.ts +61 -0
  80. package/dist/packages/work/src/submit-proof.js +119 -0
  81. package/dist/packages/work/src/submit-value.d.ts +48 -0
  82. package/dist/packages/work/src/submit-value.js +118 -0
  83. package/dist/packages/work/src/usage.d.ts +1 -1
  84. package/dist/packages/work/src/usage.js +11 -0
  85. package/dist/src/add.d.ts +64 -259
  86. package/dist/src/add.js +81 -615
  87. package/dist/src/archive.d.ts +97 -0
  88. package/dist/src/archive.js +591 -0
  89. package/dist/src/bundle/index.d.ts +64 -0
  90. package/dist/src/bundle/index.js +508 -0
  91. package/dist/src/bundle/manifest.d.ts +50 -0
  92. package/dist/src/bundle/manifest.js +435 -0
  93. package/dist/src/bundle/runtime.d.ts +26 -0
  94. package/dist/src/bundle/runtime.js +64 -0
  95. package/dist/src/bundle/tar.d.ts +62 -0
  96. package/dist/src/bundle/tar.js +238 -0
  97. package/dist/src/bundle/types.d.ts +105 -0
  98. package/dist/src/bundle/types.js +21 -0
  99. package/dist/src/capabilities.d.ts +93 -0
  100. package/dist/src/capabilities.js +101 -0
  101. package/dist/src/cli.d.ts +90 -20
  102. package/dist/src/cli.js +2421 -374
  103. package/dist/src/credentials.d.ts +4 -3
  104. package/dist/src/credentials.js +21 -19
  105. package/dist/src/crypto/allowed-signers.d.ts +68 -0
  106. package/dist/src/crypto/allowed-signers.js +307 -0
  107. package/dist/src/crypto/canonical.d.ts +8 -0
  108. package/dist/src/crypto/canonical.js +92 -0
  109. package/dist/src/crypto/chain.d.ts +65 -0
  110. package/dist/src/crypto/chain.js +377 -0
  111. package/dist/src/crypto/dsse.d.ts +209 -0
  112. package/dist/src/crypto/dsse.js +282 -0
  113. package/dist/src/crypto/enrollment.d.ts +78 -0
  114. package/dist/src/crypto/enrollment.js +186 -0
  115. package/dist/src/crypto/index.d.ts +48 -0
  116. package/dist/src/crypto/index.js +44 -0
  117. package/dist/src/crypto/keys.d.ts +258 -0
  118. package/dist/src/crypto/keys.js +908 -0
  119. package/dist/src/crypto/org-root.d.ts +33 -0
  120. package/dist/src/crypto/org-root.js +78 -0
  121. package/dist/src/crypto/origin-rules.d.ts +56 -0
  122. package/dist/src/crypto/origin-rules.js +143 -0
  123. package/dist/src/crypto/policy-floor.d.ts +98 -0
  124. package/dist/src/crypto/policy-floor.js +353 -0
  125. package/dist/src/crypto/records.d.ts +319 -0
  126. package/dist/src/crypto/records.js +168 -0
  127. package/dist/src/crypto/scope.d.ts +49 -0
  128. package/dist/src/crypto/scope.js +83 -0
  129. package/dist/src/crypto/ssh.d.ts +171 -0
  130. package/dist/src/crypto/ssh.js +396 -0
  131. package/dist/src/crypto/submission.d.ts +33 -0
  132. package/dist/src/crypto/submission.js +47 -0
  133. package/dist/src/crypto/trust-roots.d.ts +29 -0
  134. package/dist/src/crypto/trust-roots.js +39 -0
  135. package/dist/src/crypto/verify-consumed.d.ts +67 -0
  136. package/dist/src/crypto/verify-consumed.js +259 -0
  137. package/dist/src/crypto/verify-origin.d.ts +50 -0
  138. package/dist/src/crypto/verify-origin.js +151 -0
  139. package/dist/src/crypto/verify-publication.d.ts +60 -0
  140. package/dist/src/crypto/verify-publication.js +150 -0
  141. package/dist/src/defs.d.ts +24 -1
  142. package/dist/src/defs.js +335 -27
  143. package/dist/src/engine.d.ts +211 -6
  144. package/dist/src/engine.js +459 -59
  145. package/dist/src/factory.d.ts +16 -0
  146. package/dist/src/factory.js +16 -4
  147. package/dist/src/global-config.d.ts +59 -0
  148. package/dist/src/global-config.js +84 -0
  149. package/dist/src/hub.d.ts +102 -32
  150. package/dist/src/hub.js +147 -58
  151. package/dist/src/index.d.ts +19 -2
  152. package/dist/src/index.js +23 -2
  153. package/dist/src/install.d.ts +538 -0
  154. package/dist/src/install.js +1981 -0
  155. package/dist/src/lock.d.ts +15 -57
  156. package/dist/src/lock.js +251 -143
  157. package/dist/src/mcp/serve.d.ts +46 -22
  158. package/dist/src/mcp/serve.js +174 -44
  159. package/dist/src/mcp/server.js +12 -1
  160. package/dist/src/model.d.ts +51 -0
  161. package/dist/src/model.js +157 -1
  162. package/dist/src/order-resolver.d.ts +184 -0
  163. package/dist/src/order-resolver.js +252 -0
  164. package/dist/src/package-version.d.ts +10 -0
  165. package/dist/src/package-version.js +42 -0
  166. package/dist/src/paths.d.ts +14 -1
  167. package/dist/src/paths.js +18 -0
  168. package/dist/src/schemas/enrollment-grant.v1.schema.json +90 -0
  169. package/dist/src/schemas/index.d.ts +1433 -0
  170. package/dist/src/schemas/index.js +31 -0
  171. package/dist/src/schemas/order.v1.schema.json +120 -0
  172. package/dist/src/schemas/origin.v1.schema.json +68 -0
  173. package/dist/src/schemas/policy-floor.v1.schema.json +29 -0
  174. package/dist/src/schemas/publication.v1.schema.json +31 -0
  175. package/dist/src/schemas/revocation.v1.schema.json +39 -0
  176. package/dist/src/schemas/submission.v1.schema.json +61 -0
  177. package/dist/src/store/def-source.d.ts +52 -0
  178. package/dist/src/store/def-source.js +335 -0
  179. package/dist/src/store/index-file.d.ts +69 -0
  180. package/dist/src/store/index-file.js +151 -0
  181. package/dist/src/store/index.d.ts +27 -0
  182. package/dist/src/store/index.js +22 -0
  183. package/dist/src/store/ingestor.d.ts +43 -0
  184. package/dist/src/store/ingestor.js +211 -0
  185. package/dist/src/store/install.d.ts +228 -0
  186. package/dist/src/store/install.js +555 -0
  187. package/dist/src/store/instruction-source.d.ts +49 -0
  188. package/dist/src/store/instruction-source.js +298 -0
  189. package/dist/src/store/origin-evidence.d.ts +21 -0
  190. package/dist/src/store/origin-evidence.js +66 -0
  191. package/dist/src/store/pre-commit-verifier.d.ts +68 -0
  192. package/dist/src/store/pre-commit-verifier.js +418 -0
  193. package/dist/src/store/resolve.d.ts +138 -0
  194. package/dist/src/store/resolve.js +363 -0
  195. package/dist/src/store/types.d.ts +288 -0
  196. package/dist/src/store/types.js +356 -0
  197. package/dist/src/store.d.ts +33 -1
  198. package/dist/src/store.js +57 -4
  199. package/dist/src/types.d.ts +146 -12
  200. package/dist/src/untar.d.ts +8 -23
  201. package/dist/src/untar.js +10 -136
  202. package/docs/agent-runner.md +86 -0
  203. package/docs/authoring.md +64 -6
  204. package/docs/bundles.md +350 -0
  205. package/docs/cli.md +1298 -106
  206. package/docs/crypto.md +832 -0
  207. package/docs/design.md +342 -20
  208. package/docs/embedding.md +132 -25
  209. package/docs/shift-logs.md +642 -0
  210. package/docs/wire-contracts.md +395 -0
  211. package/package.json +6 -1
  212. package/plugins/claude-code/.claude-plugin/marketplace.json +14 -0
  213. package/plugins/claude-code/plugin/.claude-plugin/plugin.json +8 -0
  214. package/plugins/claude-code/plugin/.mcp.json +14 -0
  215. package/plugins/claude-code/plugin/hooks/hooks.json +26 -0
  216. package/plugins/claude-code/plugin/hooks/session-end.sh +40 -0
  217. package/plugins/claude-code/plugin/hooks/session-start.sh +52 -0
  218. package/plugins/claude-code/plugin/skills/author/SKILL.md +181 -0
  219. package/plugins/claude-code/plugin/skills/conduct/SKILL.md +106 -0
  220. package/plugins/claude-code/plugin/skills/shift/SKILL.md +105 -0
  221. package/plugins/codex/.agents/plugins/marketplace.json +21 -0
  222. package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +7 -0
  223. package/plugins/codex/plugins/owenloop/.mcp.json +20 -0
  224. package/plugins/codex/plugins/owenloop/hooks/hooks.json +26 -0
  225. package/plugins/codex/plugins/owenloop/hooks/session-end.sh +40 -0
  226. package/plugins/codex/plugins/owenloop/hooks/session-start.sh +52 -0
  227. package/plugins/codex/plugins/owenloop/skills/author/SKILL.md +181 -0
  228. package/plugins/codex/plugins/owenloop/skills/conduct/SKILL.md +106 -0
  229. package/plugins/codex/plugins/owenloop/skills/shift/SKILL.md +105 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,73 @@ All notable changes to this project are documented here. The format is based on
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
5
5
  adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.5.2](https://github.com/typicalday/owenloop/compare/v0.5.1...v0.5.2) (2026-08-14)
8
+
9
+
10
+ ### Features
11
+
12
+ * durable on-disk shift logs (shift.log + per-run worker logs) ([#150](https://github.com/typicalday/owenloop/issues/150)) ([ad95862](https://github.com/typicalday/owenloop/commit/ad9586292b2d977f3c0be3f2f005c537eba03bfc))
13
+ * pass consumed inputs to command steps and warn on cwd fallback ([#149](https://github.com/typicalday/owenloop/issues/149)) ([76f0783](https://github.com/typicalday/owenloop/commit/76f0783201eb93b8af8ece4c8910952bec781b61))
14
+ * per-crew tier profiles with model and effort resolution ([#140](https://github.com/typicalday/owenloop/issues/140)) ([98d96bb](https://github.com/typicalday/owenloop/commit/98d96bbeaf3e17e0aa097389b766248f78e87451))
15
+ * route agent orders by composed capability instead of model tiers ([#152](https://github.com/typicalday/owenloop/issues/152)) ([a48068b](https://github.com/typicalday/owenloop/commit/a48068b547e16d1db763e3bc739c8277ae1fb628))
16
+ * routing modifiers, capability composition, and escalation in the engine ([#151](https://github.com/typicalday/owenloop/issues/151)) ([6d440a9](https://github.com/typicalday/owenloop/commit/6d440a951bc15bd961e4004c4652f6e87c88560c))
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * brake a shift step on worker failure, not on dispatch count ([#146](https://github.com/typicalday/owenloop/issues/146)) ([2b4c0c6](https://github.com/typicalday/owenloop/commit/2b4c0c657173c114377daa432b878a8dd12d0c05))
22
+ * distinguish a corrupt session record from a schema-invalid one ([#145](https://github.com/typicalday/owenloop/issues/145)) ([c65416b](https://github.com/typicalday/owenloop/commit/c65416b523efa5784a2e8f173ac44bd6b77435b0))
23
+ * issue a retry-safe owed target version so producer submits can sign ([#143](https://github.com/typicalday/owenloop/issues/143)) ([1a27f65](https://github.com/typicalday/owenloop/commit/1a27f65eb2abdba50f52931fd08c99ae3b3d2df6))
24
+ * measure escalation.after against the highest per-produce maxAttempts ([#153](https://github.com/typicalday/owenloop/issues/153)) ([0d654f9](https://github.com/typicalday/owenloop/commit/0d654f9e593ecdbc10a50cad8f59a5a73036016f))
25
+ * normalize a JSON-string submit value before signing it ([#147](https://github.com/typicalday/owenloop/issues/147)) ([2f67b12](https://github.com/typicalday/owenloop/commit/2f67b12453631ca9425ea66050eeb9afbbd32817))
26
+ * read the capability payloads under the hub's own field names ([#142](https://github.com/typicalday/owenloop/issues/142)) ([eb53609](https://github.com/typicalday/owenloop/commit/eb536093f4202afdd491269e7aab07bb60e21a1f))
27
+ * stop the agent-run MCP hold child from releasing its parent's claim ([#144](https://github.com/typicalday/owenloop/issues/144)) ([4b46fa8](https://github.com/typicalday/owenloop/commit/4b46fa84c15074924a937ff0954ee967bf4a1523))
28
+
29
+ ## [0.5.1](https://github.com/typicalday/owenloop/compare/v0.5.0...v0.5.1) (2026-08-12)
30
+
31
+
32
+ ### Features
33
+
34
+ * add bundle runtime compatibility requirements ([#137](https://github.com/typicalday/owenloop/issues/137)) ([6a241a3](https://github.com/typicalday/owenloop/commit/6a241a34f516da820e1dda5fd6953c28993ea1f5))
35
+ * add CLI/plugin compatibility checks ([#109](https://github.com/typicalday/owenloop/issues/109)) ([8f0b0b9](https://github.com/typicalday/owenloop/commit/8f0b0b9c2f8179ac316772fcbf61d5efe4fa9019))
36
+ * add command payload and judge reject transport ([#126](https://github.com/typicalday/owenloop/issues/126)) ([847a1fa](https://github.com/typicalday/owenloop/commit/847a1fabdd41ba7a021b967ba0c55e5f25526bb5))
37
+ * add deterministic workflow bundles ([#106](https://github.com/typicalday/owenloop/issues/106)) ([dfc598b](https://github.com/typicalday/owenloop/commit/dfc598b1ecf040d4c635cdb52443bdb0191f398b))
38
+ * add enrollment chain validation, attenuation, and revocation ([#117](https://github.com/typicalday/owenloop/issues/117)) ([2bc10c8](https://github.com/typicalday/owenloop/commit/2bc10c8226fe4960e9655e3672ebd0a17a7ed512))
39
+ * add signed origin records for published bundles ([#119](https://github.com/typicalday/owenloop/issues/119)) ([a5fbd8f](https://github.com/typicalday/owenloop/commit/a5fbd8fd5b5cec199e3028e8784a13662dcae58e))
40
+ * add signed submission records ([#121](https://github.com/typicalday/owenloop/issues/121)) ([f171227](https://github.com/typicalday/owenloop/commit/f171227a8ca1bf4f4f0c84edecf482c245ab203e))
41
+ * add signed workflow bundle publication ([#112](https://github.com/typicalday/owenloop/issues/112)) ([224f7a8](https://github.com/typicalday/owenloop/commit/224f7a834c747d954d1cf77316f0066e5252f09e))
42
+ * add SSHSIG signing, DSSE envelopes, and principal keys ([#102](https://github.com/typicalday/owenloop/issues/102)) ([5125545](https://github.com/typicalday/owenloop/commit/51255459ac21012365b6984d444efc0ae51dfa15))
43
+ * add v2 multi-workflow delivery bundles ([#127](https://github.com/typicalday/owenloop/issues/127)) ([26a59d7](https://github.com/typicalday/owenloop/commit/26a59d7bb9728fd4936d8d4eb2b2bb158983ff89))
44
+ * converge Claude Code and Codex plugins ([#113](https://github.com/typicalday/owenloop/issues/113)) ([1c6623d](https://github.com/typicalday/owenloop/commit/1c6623dff9649a4311382fa34c4bc6ac489a4f9f))
45
+ * enforce harness policy ([4f8796f](https://github.com/typicalday/owenloop/commit/4f8796f6415a486aad92725eec842d8a22e504f8))
46
+ * enforce local workflow instruction resolution ([#111](https://github.com/typicalday/owenloop/issues/111)) ([c5827d7](https://github.com/typicalday/owenloop/commit/c5827d7dd248ebc49a3a199dd8f1231249f280b5))
47
+ * enforce workflow origin policy at install and execution ([#122](https://github.com/typicalday/owenloop/issues/122)) ([d91e881](https://github.com/typicalday/owenloop/commit/d91e881583efabbe1efe3427d3fc69fd20f1d6fc))
48
+ * enforce workflow publication trust at install and execution ([#114](https://github.com/typicalday/owenloop/issues/114)) ([3b0d931](https://github.com/typicalday/owenloop/commit/3b0d931f6b37ca48b6c50a5b33a8b461e3410b8b))
49
+ * expose installed bundle assets to workers ([#125](https://github.com/typicalday/owenloop/issues/125)) ([2c8b498](https://github.com/typicalday/owenloop/commit/2c8b4981c1a395b78205c8b076893ac3efa4416f))
50
+ * expose run identity to command children ([#131](https://github.com/typicalday/owenloop/issues/131)) ([e7e18c1](https://github.com/typicalday/owenloop/commit/e7e18c1a84ce772fac80dfb493f267d7fbd8cde2))
51
+ * freeze launch wire contracts ([#110](https://github.com/typicalday/owenloop/issues/110)) ([571a8f9](https://github.com/typicalday/owenloop/commit/571a8f90532d90e3db786890885d31d3446edf21))
52
+ * reference-mode orders — instructions resolve by defDigest (WP-B1) ([#101](https://github.com/typicalday/owenloop/issues/101)) ([5e4071e](https://github.com/typicalday/owenloop/commit/5e4071ee5e56753cbcc330ac3c0b749518355ffc))
53
+ * register signed machine enrollments ([#116](https://github.com/typicalday/owenloop/issues/116)) ([25ef244](https://github.com/typicalday/owenloop/commit/25ef2442de6277001c24b9e375513bfcb20a0ef1))
54
+ * resolve agent model tiers and retry escalation ([#128](https://github.com/typicalday/owenloop/issues/128)) ([3098494](https://github.com/typicalday/owenloop/commit/3098494f2d34c3abdbe7ae2adee0deb73156f9b8))
55
+ * resolve CAS bundle workflows through calls: ([#130](https://github.com/typicalday/owenloop/issues/130)) ([444b868](https://github.com/typicalday/owenloop/commit/444b868f50b37e2e377976a935bf17ea60fe6190))
56
+ * ship Claude Code plugin pack ([#104](https://github.com/typicalday/owenloop/issues/104)) ([a76bea7](https://github.com/typicalday/owenloop/commit/a76bea789eaa78599b8ed23f590f5f559b907279))
57
+ * ship the Codex plugin tree and launch the plugin MCP server from PATH ([#107](https://github.com/typicalday/owenloop/issues/107)) ([d165d28](https://github.com/typicalday/owenloop/commit/d165d284d125304321b3c5d10a304cc3d606e0e3))
58
+ * support dynamic workdirs from consumed artifacts ([#129](https://github.com/typicalday/owenloop/issues/129)) ([6c4ada1](https://github.com/typicalday/owenloop/commit/6c4ada1478e4a2c1468c1565a6542ae3936ac383))
59
+ * two-level content-addressed workflow store with .wnlp bundle installs ([#103](https://github.com/typicalday/owenloop/issues/103)) ([029d06c](https://github.com/typicalday/owenloop/commit/029d06cfebcad2aeff20350a0f9c83402ede1b3a))
60
+ * verify admin-signed org policy floors and merge them as a strictness floor ([#120](https://github.com/typicalday/owenloop/issues/120)) ([da381b3](https://github.com/typicalday/owenloop/commit/da381b36d160de02a967926da71a6da6c19b21b8))
61
+ * verify consumed artifact values and producer enrollment at the driver boundary ([#123](https://github.com/typicalday/owenloop/issues/123)) ([9629d14](https://github.com/typicalday/owenloop/commit/9629d1444e5576629336dfbc31dcc3d1b0297a4c))
62
+
63
+
64
+ ### Bug Fixes
65
+
66
+ * allow packaged plugins through npm publish gate ([#139](https://github.com/typicalday/owenloop/issues/139)) ([ef83b67](https://github.com/typicalday/owenloop/commit/ef83b67c5f491783c9d88b2f3fa0fa0c4ef2c582))
67
+ * inherit producer policy in native judges ([152eee1](https://github.com/typicalday/owenloop/commit/152eee148b1d269b45f5bb2ef4fae92efe830007))
68
+ * lock plugin manifest versions to package ([#108](https://github.com/typicalday/owenloop/issues/108)) ([8c2a93e](https://github.com/typicalday/owenloop/commit/8c2a93ea9f92293ac06c578d54384c381dd52f42))
69
+ * make hosted Shift delivery reliable ([#132](https://github.com/typicalday/owenloop/issues/132)) ([a8e3fc3](https://github.com/typicalday/owenloop/commit/a8e3fc318d581cb858b81d627d6b237ae8c9c757))
70
+ * resolve publishing hubs without project bindings ([#133](https://github.com/typicalday/owenloop/issues/133)) ([15795fd](https://github.com/typicalday/owenloop/commit/15795fda0f3c4835aacaeb0e905bfb1495ac2783))
71
+ * resolve the MCP hub origin from config instead of enumerating the credential store ([#118](https://github.com/typicalday/owenloop/issues/118)) ([07c140d](https://github.com/typicalday/owenloop/commit/07c140db6ba7169cba68eb09034dc23c70fdba28))
72
+ * select workflow versions deterministically ([#138](https://github.com/typicalday/owenloop/issues/138)) ([85e17c1](https://github.com/typicalday/owenloop/commit/85e17c149a1181ba745fd701d6a46be9dfcf5d05))
73
+
7
74
  ## [0.5.0](https://github.com/typicalday/owenloop/compare/v0.4.1...v0.5.0) (2026-08-04)
8
75
 
9
76
 
package/README.md CHANGED
@@ -159,9 +159,10 @@ Two things make this more than running steps in dependency order:
159
159
  itself (which steps exist, what each consumes and produces) is fixed when
160
160
  the definition loads, not mutable while an instance runs.
161
161
  - **Not a command runner.** `executor:`/`command:` declare which kind of
162
- executor an order is for and carry a command string through untouched —
163
- the engine never shells out, executes, or interprets it. Actually running
164
- anything is always the dispatcher's job, on the other side of `tick`.
162
+ worker an order is for (`Order.worker`) and what command text a worker
163
+ resolves for it — the engine never shells out, executes, or interprets
164
+ it. Actually running anything is always the dispatcher's job, on the other
165
+ side of `tick`.
165
166
 
166
167
  ---
167
168
 
@@ -256,15 +257,20 @@ will do. See
256
257
 
257
258
  ### Worker dispatch
258
259
 
259
- `executor: agent | command | …` declares which kind of executor a step's order
260
- is for — the default (`agent`, silent when omitted) is unaffected; every
261
- def written before this feature stays byte for byte the same. Opt a step
262
- into `executor: command` and give it a `command:` string to switch it to a
263
- deterministic executor instead of an LLM — the engine never runs it, only
264
- carries it through on the order for your dispatcher to branch on. An
265
- optional `spec:` map carries further opaque config (a timeout, a working
266
- directory), and a judge entry accepts the same fields, so a quality gate can
267
- be a script's exit code instead of a verdict. See
260
+ `executor: agent | command | …` declares which kind of worker a step's order
261
+ is for — the authored value lands on the order as `Order.worker`, and the
262
+ default (`agent`, silent when omitted) is unaffected; every def written
263
+ before this feature stays byte for byte the same. Opt a step into
264
+ `executor: command` and give it a `command:` string to switch it to a
265
+ deterministic worker instead of an LLM — the engine never runs it; your
266
+ dispatcher branches on `order.worker` and resolves the authored command text
267
+ from the local workflow store through the order's `defDigest` at the
268
+ `(defDigest, step, key)` boundary. The packet itself carries no command text:
269
+ a command worker must refuse when the digest or command cannot be resolved and
270
+ must never spawn from transport-supplied text. An optional `spec:` map carries
271
+ further opaque config (a timeout, a working directory), and a judge entry
272
+ accepts the same fields, so a quality gate can be a script's exit code instead
273
+ of a verdict. See
268
274
  [`docs/authoring.md`](docs/authoring.md#executor--declaring-the-executor) and
269
275
  [`command-executor.yaml`](examples/workflows/command-executor.yaml).
270
276
 
@@ -275,6 +281,51 @@ pushes a typed event the instant a mutation commits, so a host can react
275
281
  instead of ticking on a timer. See [Embedding it](#embedding-it) and
276
282
  [`docs/embedding.md`](docs/embedding.md).
277
283
 
284
+ ### Shared workflows — the content-addressed store
285
+
286
+ Workflow definitions are shared, not hand-copied. Two install routes land
287
+ them in the tree, both all-or-nothing with crash recovery:
288
+
289
+ - **GitHub repos** — `owenloop add <owner>/<repo>[@ref]` fetches a public
290
+ repo's `workflows/**`, validates every def with the engine's strict pass,
291
+ and installs it under `<defsDir>/<owner>-<repo>-<hash>/`, recording
292
+ provenance (resolved commit sha) in `.owenloop/installed.json`.
293
+ - **Workflow bundles** — `owenloop add widget.wnlp [--global]` (a local
294
+ `.wnlp` file or an `https://` URL) installs into a **content-addressed
295
+ store**: the project store lives under the defs dir, `--global` installs
296
+ into `<home>/.owenloop/workflows`. Each store holds an `index.json` mapping
297
+ `namespace/name@version` coordinates to content digests, plus immutable
298
+ objects at `objects/sha256/<digest>/` — identical content deduplicates to
299
+ one object, and an object's identity is its digest alone (never its name
300
+ or source). Objects are hardened read-only in place, and every resolution
301
+ re-verifies the bytes before returning a path. Execution workers resolve
302
+ static prompt and command text from those verified local objects by the
303
+ order's `defDigest`; a remote packet cannot substitute instruction text.
304
+
305
+ The bundle route derives `<home>` from the first non-blank caller-injected
306
+ `HOME` or `USERPROFILE` value (`HOME` wins), and uses that home for the default
307
+ recovery-marker directory. A bundle install refuses when neither variable is
308
+ supplied rather than falling back to the process user's ambient home.
309
+
310
+ Bundle installs fail closed without their two required adapters (bundle
311
+ ingestion and pre-commit verification). The default CLI binds the real
312
+ bundle ingestor, so a `.wnlp` produced by `packBundle` reaches the normal
313
+ entrypoint-aware install validation; the pre-commit verifier remains unbound,
314
+ so the CLI still fails closed rather than accepting an unverified bundle. There
315
+ is no default accepting signature verifier; the `add` route does not consume
316
+ publication sidecars or verify a bundle's signature. Use `owenloop publish` to
317
+ create the `.wnlp` bundle plus a signed publication sidecar and optional signed
318
+ origin sidecar, or an explicitly unsigned marker.
319
+ `--global` applies only to `.wnlp` bundle sources; a GitHub source with `--global`
320
+ is refused before any network request. Resolution is
321
+ deliberately split: execution resolves by **digest only** (project first,
322
+ fall-through to global only when the project object is absent — a corrupt
323
+ project object is a hard error, never masked by a global copy), while
324
+ human-facing lookups resolve by **coordinate** and surface a structured
325
+ ambiguity error when the two levels disagree — never a silent project-first
326
+ pick. Full semantics:
327
+ [`docs/cli.md`](docs/cli.md#add-with-bundles--the-content-addressed-workflow-store).
328
+
278
329
  ---
279
330
 
280
331
  ## Driving it with a loop
@@ -338,12 +389,42 @@ The skill interviews you for anything missing, writes and validates the YAML
338
389
  definition, then conducts the instance to done — dispatching each order to a
339
390
  fresh subagent, relaying knock-backs, and escalating stalls to you. Already
340
391
  have a def? *"Conduct the report workflow"* hands it to
341
- [`owenloop-conduct`](skills/owenloop-conduct/SKILL.md). The engine itself
342
- arrives via `npx owenloop` (Node ≥ 22.13 required) — no clone, no build, no
343
- environment variables, no CLI verbs to memorize. The same package also includes
344
- the execution-side companion; use `owenloop work <subcommand>` for lower-level
392
+ [`owenloop-conduct`](skills/owenloop-conduct/SKILL.md). The engine itself is the
393
+ `owenloop` CLI (Node ≥ 22.13 required). Install the package so `owenloop` is on
394
+ `PATH`; the shipped Claude Code and Codex plugins launch that same command as
395
+ `owenloop mcp`, rather than using a separate npx-pinned server. The plugins
396
+ check the installed CLI/plugin version pair at session start when their hooks
397
+ are enabled, and the MCP server reports a readable mismatch error on tool calls; run `owenloop setup` when the versions differ. For one-off shell
398
+ use, `npx owenloop` still works — no clone, no build, no environment
399
+ variables, no CLI verbs to memorize. The same package also includes the
400
+ execution-side companion; use `owenloop work <subcommand>` for lower-level
345
401
  execution tasks. There is no separate `owenwork` package or binary.
346
402
 
403
+ ### Deterministic workflow bundles
404
+
405
+ A workflow and its referenced regular files can be packaged as one deterministic
406
+ `.wnlp` file. The package format uses a canonical POSIX/PAX tar stream wrapped
407
+ in gzip; the package digest is SHA-256 over the exact uncompressed canonical
408
+ tar, not over the gzip bytes. `bundle.yaml` carries package identity, platform
409
+ selectors, requested capabilities, generated per-file SHA-256 values, and
410
+ namespace-qualified, digest-pinned `calls:` references. `workflow.yaml` remains
411
+ the only execution definition.
412
+
413
+ ```sh
414
+ owenloop bundle pack ./report --output ./report-1.2.0.wnlp
415
+ owenloop bundle inspect ./report-1.2.0.wnlp
416
+ owenloop bundle digest ./report-1.2.0.wnlp
417
+ owenloop bundle unpack ./report-1.2.0.wnlp ./unpacked-report
418
+ ```
419
+
420
+ Bundle commands are filesystem-only: they do not open or create the local
421
+ `.owenloop/state.db` and do not contact a remote service. Packing never edits
422
+ the source manifest. Inspection and unpacking reject unsafe paths, symlinks,
423
+ unsupported archive entry types, malformed canonical headers, duplicate files,
424
+ invalid manifests, workflow/manifest name mismatches, missing lock entries, and
425
+ integrity mismatches before files are written. See the [bundle format
426
+ reference](docs/bundles.md) and the [CLI bundle commands](docs/cli.md#bundles).
427
+
347
428
  For a foreground local shift, start the daemon in one terminal. Run the client
348
429
  commands from another terminal:
349
430
 
@@ -362,6 +443,11 @@ explicitly; `--all` serves all Crews for the Scoped Identity. `shift next` waits
362
443
  up to 90 seconds by default. For flags, JSON output, daemon behavior, and exit
363
444
  codes, see the [`shift` reference](docs/cli.md#shift--foreground-daemon-and-client).
364
445
 
446
+ A running shift also writes to disk: its own dispatch record as JSON Lines in
447
+ `shift.log`, and each dispatched worker's stdout and stderr in `<run>.log`. Both
448
+ outlive the shift, which is what makes a postmortem possible after a shift dies.
449
+ See [`docs/shift-logs.md`](docs/shift-logs.md).
450
+
365
451
  **Want to see or drive the machinery yourself?** Everything above goes
366
452
  through the same small CLI (`create`, `tick`, `green`, `reject`, …).
367
453
  [`docs/cli.md`](docs/cli.md) has the full command reference and a hand-driven
@@ -390,8 +476,10 @@ Publishing your defs to a hosted hub instead? `owenloop login` authenticates
390
476
  the CLI (loopback OAuth, or a pasted token via `--with-token`; the credential
391
477
  goes into the macOS Keychain or a `0600` file, never the repo, and is verified
392
478
  against the hub before it's ever stored), `owenloop connect` binds the project
393
- to a hub, and `owenloop push` publishes your defs — idempotent against the
394
- hub's own def hashes, so an unchanged re-push is a no-op. `owenloop agent new
479
+ to a hub, and `owenloop push` publishes your defs. Use `owenloop push --bundle
480
+ <bundle.wnlp>` after `owenloop publish` when execution must be pinned to the
481
+ exact signed bundle digest; plain YAML pushes remain idempotent against the
482
+ hub's own def hashes. `owenloop agent new
395
483
  <name>` mints a Scoped Identity on the hub and stores its token in slot
396
484
  `agent:<name>` without ever printing it. See the
397
485
  [Hub](docs/cli.md#hub-login--connect--push--logout) section in `docs/cli.md`.
@@ -402,13 +490,15 @@ and, when needed, mint or rekey and store a Scoped Identity. Setup writes only
402
490
  file is `$XDG_CONFIG_HOME/owenloop/settings.json` when `XDG_CONFIG_HOME` is
403
491
  set to a non-blank value; otherwise `$HOME/.config/owenloop/settings.json`. For
404
492
  a non-default account,
405
- setup only prints the `OWENLOOP_ACCOUNT=<name>` instruction. Setup probes the
406
- Claude Code plugin and, when it is missing, prints the manual commands
407
- `claude plugin marketplace add owenloop` and
408
- `claude plugin install owenloop@owenloop`; setup does not install the plugin.
409
- `owenloop doctor` is the read-only counterpart: it checks each piece and prints a
410
- `✓`/`✗` line with the remedy. See [`setup`](docs/cli.md#setup--onboard-a-machine)
411
- and [`doctor`](docs/cli.md#doctor--check-a-machines-install) in `docs/cli.md`.
493
+ setup only prints the `OWENLOOP_ACCOUNT=<name>` instruction. Setup probes and,
494
+ when needed, converges the bundled `owenloop` plugins for Claude Code and Codex.
495
+ Plugin convergence is non-fatal; a missing harness or failed plugin command does
496
+ not fail setup. A second run with the expected plugin version already installed
497
+ performs no plugin writes. `owenloop doctor` is the read-only counterpart: it
498
+ checks both harness plugin states, reports version skew, and prints a `✓`/`✗`
499
+ line with the remedy. See
500
+ [`setup`](docs/cli.md#setup--onboard-a-machine) and
501
+ [`doctor`](docs/cli.md#doctor--check-a-machines-install) in `docs/cli.md`.
412
502
 
413
503
  Driving the hub from an MCP host instead? `owenloop mcp` serves the hub control
414
504
  plane to a local MCP host (Claude Code) over stdio — MCP hosts spawn it, you
@@ -427,6 +517,13 @@ never surfacing a token to the model. See the
427
517
  - **No native dependencies.** `node:sqlite` is built in, so there's nothing to
428
518
  compile. The only runtime deps are `yaml` (parsing defs) and
429
519
  `@cfworker/json-schema` (optional per-artifact schema validation).
520
+ - **OpenSSH `ssh-keygen` with `-Y` support** (OpenSSH 8.1+) for the signing
521
+ features. `owenloop setup` automatically ensures an Ed25519 signing key for
522
+ each of the three local principals — human, machine, agent — and signs /
523
+ verifies records with stock SSHSIG (`ssh-keygen -Y`). Keys land in the macOS
524
+ Keychain, Linux libsecret (`secret-tool`), or a `0700`/`0600` file store
525
+ under `$HOME/.owenloop/keys/`; one backend is chosen once and never
526
+ error-fallback. See [Signing and key storage](docs/crypto.md).
430
527
 
431
528
  ```sh
432
529
  npm install owenloop
@@ -500,7 +597,7 @@ is an ordinary class, so you can drive it **in-process** and get typed objects b
500
597
  ```ts
501
598
  import { createEngine } from 'owenloop';
502
599
 
503
- const { engine, store } = createEngine({
600
+ const { engine, store, resolver } = createEngine({
504
601
  db: '.owenloop/state.db', // or ':memory:' for an ephemeral instance
505
602
  defsDir: 'workflows', // load YAML defs from a dir … or pass `defs: [myDef]`
506
603
  });
@@ -510,12 +607,16 @@ const wf = engine.createInstance('delivery', {
510
607
  provide: { proposal: { text: 'add dark mode' } },
511
608
  });
512
609
 
513
- // the Step Agent loop: tick → run → report
610
+ // the Step Agent loop: tick → resolve → run → report
514
611
  const { orders } = engine.tick(wf);
515
612
  for (const order of orders) {
516
- const result = await runYourAgent(order); // ← your domain
517
- engine.green(wf, order.run, order.outputs[0], result); // typed CommitResult back
518
- engine.close(wf, order.run);
613
+ // orders are reference packets: routing + dynamic data + a defDigest, never
614
+ // authored prompt/command text. Resolve before dispatch — same boundary the
615
+ // CLI uses; an unknown digest throws UnknownDefDigestError here.
616
+ const instructions = resolver.resolveOrder(order); // { prompt?, command? }
617
+ const result = await runYourAgent(order, instructions); // ← your domain
618
+ engine.green(order.workflow, order.run, order.outputs[0], result); // typed CommitResult back
619
+ engine.close(order.workflow, order.run);
519
620
  }
520
621
 
521
622
  engine.status(wf); // typed WorkflowStatus: done / debts / eligible / blocked
@@ -546,7 +647,9 @@ owenloop is small and split along a pure-core / imperative-shell line:
546
647
  | [`src/defs.ts`](src/defs.ts) | load YAML → validated `WorkflowDef` (the static wiring checks) |
547
648
  | [`src/schema.ts`](src/schema.ts) | JSON Schema validation of artifact values, via `@cfworker/json-schema` |
548
649
  | [`src/model.ts`](src/model.ts) | the pure core: what's eligible, the cascade, status, stall detection |
549
- | [`src/store.ts`](src/store.ts) | `node:sqlite` persistence; transactions; the commit check |
650
+ | [`src/store.ts`](src/store.ts) | the SQLite **runtime** store — `node:sqlite` persistence; transactions; the commit check (instance/artifact state) |
651
+ | [`src/install.ts`](src/install.ts) | the host-neutral install transaction: safe staging, atomic swap with a retained backup, two-phase journal, lock, recovery |
652
+ | [`src/store/`](src/store/) | the content-addressed **workflow** store — digest-addressed definition objects, the two-level coordinate index, `.wnlp` bundle install, fail-closed resolution (immutable defs; distinct from the runtime store) |
550
653
  | [`src/engine.ts`](src/engine.ts) | the imperative shell: `tick`/`green`/`reject`/… → mutate → `settle()` |
551
654
  | [`src/cli.ts`](src/cli.ts) | argv → engine calls, JSON on stdout |
552
655
 
@@ -566,9 +669,12 @@ carries a monotonic version, so the engine can always ask "is this green output
566
669
  resting on the inputs it was built from?".
567
670
 
568
671
  **Retention and disposal.** That file is the system of record and it keeps
569
- everything: every artifact version's value and every run's issued order packet —
672
+ everything: every artifact version's value and every run's issued order
673
+ packet — the dynamic input values it consumed and its rejection reasons,
570
674
  including any sensitive values that flowed through an input — persist after a
571
- workflow finishes. The default location is `.owenloop/state.db` (plus its WAL
675
+ workflow finishes. Authored prompt and command text are not in the packet
676
+ (orders are reference packets that carry a `defDigest` instead), so
677
+ instruction text is retained once, in the definition, not per firing. The default location is `.owenloop/state.db` (plus its WAL
572
678
  `-wal`/`-shm` sidecar files), or wherever `--db` / `OWENLOOP_DB` / the `db:`
573
679
  embed option points. Rotating or scrubbing that data is the operator's job:
574
680
  `owenloop delete <wf>` removes an instance's rows, but SQLite frees those pages
@@ -634,8 +740,11 @@ owenloop is a faithful, decoupled implementation of a dataflow-engine spec.
634
740
  [`docs/design.md`](docs/design.md) is a self-contained walkthrough — the lifecycle,
635
741
  firing rule, forward cascade, the reject kinds, the liveness rules, and the concurrency
636
742
  model — cross-referenced from the source. [`docs/cli.md`](docs/cli.md) has the full
637
- command reference, and [`docs/authoring.md`](docs/authoring.md) has the full YAML
638
- grammar.
743
+ command reference, [`docs/authoring.md`](docs/authoring.md) has the full YAML
744
+ grammar, [`docs/wire-contracts.md`](docs/wire-contracts.md) defines the
745
+ versioned trust-boundary records, and
746
+ [`docs/shift-logs.md`](docs/shift-logs.md) is the on-disk log contract a shift
747
+ writes and an uploader reads.
639
748
 
640
749
  ---
641
750
 
package/bin/owenloop.mjs CHANGED
@@ -2,6 +2,54 @@
2
2
  // Thin shim: all real logic lives in src/cli.ts (so it stays testable) and is
3
3
  // shipped compiled to dist/src/cli.js. Node cannot type-strip files under
4
4
  // node_modules, so the published package runs plain JS, not TypeScript source.
5
- import { mainAsync } from '../dist/src/cli.js';
5
+ import { readFile, rm } from 'node:fs/promises';
6
+ import { performance } from 'node:perf_hooks';
7
+ import { setTimeout as sleep } from 'node:timers/promises';
6
8
 
9
+ const START_GATE_TIMEOUT_MS = 2 * 60_000;
10
+
11
+ /**
12
+ * A Shift-spawned worker cannot import or execute the CLI until the parent has
13
+ * durably replaced its reservation with a PID-bearing record. Missing,
14
+ * cancelled, or expired gates fail closed before any role can contact the hub.
15
+ */
16
+ async function waitForStartGate(path) {
17
+ const deadline = performance.now() + START_GATE_TIMEOUT_MS;
18
+ for (;;) {
19
+ let signal;
20
+ try {
21
+ signal = (await readFile(path, 'utf8')).trim();
22
+ } catch (error) {
23
+ if (error?.code === 'ENOENT') return false;
24
+ throw error;
25
+ }
26
+ if (signal === 'start') {
27
+ await rm(path, { force: true });
28
+ return true;
29
+ }
30
+ if (signal === 'cancel') {
31
+ await rm(path, { force: true });
32
+ return false;
33
+ }
34
+ if (performance.now() >= deadline) {
35
+ await rm(path, { force: true });
36
+ return false;
37
+ }
38
+ await sleep(25);
39
+ }
40
+ }
41
+
42
+ const gatePath = process.env.OWENLOOP_START_GATE;
43
+ if (gatePath !== undefined && gatePath !== '') {
44
+ let allowed = false;
45
+ try {
46
+ allowed = await waitForStartGate(gatePath);
47
+ } catch (error) {
48
+ process.stderr.write(`owenloop: start gate failed: ${error instanceof Error ? error.message : String(error)}\n`);
49
+ }
50
+ if (!allowed) process.exit(75);
51
+ delete process.env.OWENLOOP_START_GATE;
52
+ }
53
+
54
+ const { mainAsync } = await import('../dist/src/cli.js');
7
55
  mainAsync(process.argv.slice(2)).then((code) => process.exit(code));
@@ -9,8 +9,10 @@
9
9
  * minus the file. The worker hands the result straight to
10
10
  * `HarnessAdapter.start` as `StartArgs.brief`.
11
11
  * - `buildOwenloopMcp(spec)` — the `{command, args}` stdio mount for owenloop's
12
- * own work-holder MCP surface, byte-identical to the `mcpServers.owenloop`
13
- * literal the legacy host adapter injects into stamped frontmatter today.
12
+ * own full work-holder MCP surface, byte-identical to the
13
+ * `mcpServers.owenloop` literal the legacy host adapter injects into stamped
14
+ * frontmatter today. A restricted adapter may append the hold role's positive
15
+ * tool selector without changing the born-bound identity arguments.
14
16
  *
15
17
  * WHY THE TOKENS ARE DECLARED HERE AND NOT IMPORTED (plan D4): the legacy
16
18
  * host-adapter module under `src/adapters/` is what Phase 5 deletes, and it is
@@ -55,6 +57,18 @@ export interface BriefSpec {
55
57
  origin: string;
56
58
  account: string;
57
59
  shiftId?: string;
60
+ /**
61
+ * The run's routing modifier (`express` | `standard` | `deep` — whatever the
62
+ * def declared), as the caller asked for at `start_run`. Absent on a run
63
+ * started without one.
64
+ */
65
+ modifier?: string;
66
+ /**
67
+ * `true` when the engine re-offered THIS step at its escalation target
68
+ * instead of the run's own modifier — the step is on the recovery path after
69
+ * repeated rejections, not a first attempt.
70
+ */
71
+ escalated?: boolean;
58
72
  }
59
73
  /**
60
74
  * Substitute the four dispatch tokens into a step template.
@@ -66,15 +80,26 @@ export interface BriefSpec {
66
80
  export declare function renderBrief(templateContent: string, spec: BriefSpec): string;
67
81
  /**
68
82
  * The born-bound work-holder mount handed to `HarnessAdapter.start` as
69
- * `StartArgs.owenloopMcp`. The adapter mounts it verbatim and never builds it.
83
+ * `StartArgs.owenloopMcp`. The adapter never constructs or changes the bound
84
+ * identity. A restricted adapter may append the hold role's positive MCP tool
85
+ * selector before mounting the command.
70
86
  *
71
87
  * `--shift=<cid>` is ONE argv element, not two. An absent cid then degrades
72
88
  * to the single well-formed string `"--shift="` instead of a dangling flag
73
89
  * with no value or a null array entry, which is what `hold`'s parser expects.
74
90
  * (The shape originated with the deleted stamp path, which had to survive a YAML
75
91
  * args array; it is kept because it is still the correct, unambiguous form.)
92
+ *
93
+ * `--never-release` is load-bearing. This child runs its own lease loop, but it
94
+ * is NOT the holder of record: `agent-run`'s `exec` loop already claimed the
95
+ * order and is the only thing entitled to hand it back. Without the flag the
96
+ * child's stdin EOF — which in `--mcp` mode is just the harness closing the
97
+ * JSON-RPC transport — fired a final-breath `release`, unclaiming a run the
98
+ * agent was still working. The mount's terminal guard then fast-failed every
99
+ * later get_order/submit, the agent finished with nothing, and the shift
100
+ * re-dispatched the same order into a fresh worker that did it all again.
76
101
  */
77
- export declare function buildOwenloopMcp(spec: BriefSpec): {
102
+ export declare function buildOwenloopMcp(spec: BriefSpec, binPath?: string, execPath?: string): {
78
103
  command: string;
79
104
  args: string[];
80
105
  };
@@ -1,3 +1,4 @@
1
+ import { resolveOwenloopBin } from "../owenloop-bin.js";
1
2
  /** The composite `<workflow>/<run>` order id token. */
2
3
  export const ORDER_TOKEN = '__OWENLOOP_ORDER__';
3
4
  /** The hub origin token. */
@@ -18,7 +19,7 @@ function composite(spec) {
18
19
  * (no accidental `$&` expansion from template text the author controls).
19
20
  */
20
21
  export function renderBrief(templateContent, spec) {
21
- return templateContent
22
+ const substituted = templateContent
22
23
  .split(ORDER_TOKEN)
23
24
  .join(composite(spec))
24
25
  .split(ORIGIN_TOKEN)
@@ -27,21 +28,64 @@ export function renderBrief(templateContent, spec) {
27
28
  .join(spec.account)
28
29
  .split(SHIFT_TOKEN)
29
30
  .join(spec.shiftId ?? '');
31
+ const routing = renderRoutingLine(spec);
32
+ return routing === '' ? substituted : `${routing}\n\n${substituted}`;
33
+ }
34
+ /**
35
+ * The run's depth, stated to the agent in one line, PREPENDED rather than
36
+ * substituted into a token.
37
+ *
38
+ * A token would only reach agents whose def author remembered to write it, and
39
+ * the whole point of the modifier is that the SAME step body runs at three
40
+ * different depths — the author has one template and cannot mark every place
41
+ * depth matters. Prepending puts it in front of every agent on every run at no
42
+ * cost to existing bundles.
43
+ *
44
+ * It is deliberately DESCRIPTIVE, not directive: it tells the agent what depth
45
+ * the run was started at and leaves the interpretation to the step's own body.
46
+ * The modifier already decided the model and effort before this line was
47
+ * written; restating it as an order ("think harder") would be the brief trying
48
+ * to do the router's job.
49
+ *
50
+ * Empty string when the run carries no modifier — a run started without one has
51
+ * nothing true to say here, and a line reading "modifier: none" would invite an
52
+ * agent to reason about an absence that means nothing.
53
+ */
54
+ function renderRoutingLine(spec) {
55
+ if (spec.modifier === undefined || spec.modifier === '')
56
+ return '';
57
+ const escalated = spec.escalated === true
58
+ ? ' This step was RE-OFFERED at a deeper modifier after repeated rejections of its output —' +
59
+ ' it is a recovery attempt, not a first pass.'
60
+ : '';
61
+ return `Routing: this run was started at the '${spec.modifier}' depth modifier.${escalated}`;
30
62
  }
31
63
  /**
32
64
  * The born-bound work-holder mount handed to `HarnessAdapter.start` as
33
- * `StartArgs.owenloopMcp`. The adapter mounts it verbatim and never builds it.
65
+ * `StartArgs.owenloopMcp`. The adapter never constructs or changes the bound
66
+ * identity. A restricted adapter may append the hold role's positive MCP tool
67
+ * selector before mounting the command.
34
68
  *
35
69
  * `--shift=<cid>` is ONE argv element, not two. An absent cid then degrades
36
70
  * to the single well-formed string `"--shift="` instead of a dangling flag
37
71
  * with no value or a null array entry, which is what `hold`'s parser expects.
38
72
  * (The shape originated with the deleted stamp path, which had to survive a YAML
39
73
  * args array; it is kept because it is still the correct, unambiguous form.)
74
+ *
75
+ * `--never-release` is load-bearing. This child runs its own lease loop, but it
76
+ * is NOT the holder of record: `agent-run`'s `exec` loop already claimed the
77
+ * order and is the only thing entitled to hand it back. Without the flag the
78
+ * child's stdin EOF — which in `--mcp` mode is just the harness closing the
79
+ * JSON-RPC transport — fired a final-breath `release`, unclaiming a run the
80
+ * agent was still working. The mount's terminal guard then fast-failed every
81
+ * later get_order/submit, the agent finished with nothing, and the shift
82
+ * re-dispatched the same order into a fresh worker that did it all again.
40
83
  */
41
- export function buildOwenloopMcp(spec) {
84
+ export function buildOwenloopMcp(spec, binPath = resolveOwenloopBin(), execPath = process.execPath) {
42
85
  return {
43
- command: 'owenloop',
86
+ command: execPath,
44
87
  args: [
88
+ binPath,
45
89
  'work',
46
90
  'hold',
47
91
  '--order',
@@ -52,6 +96,7 @@ export function buildOwenloopMcp(spec) {
52
96
  spec.account,
53
97
  `--shift=${spec.shiftId ?? ''}`,
54
98
  '--mcp',
99
+ '--never-release',
55
100
  ],
56
101
  };
57
102
  }