owenloop 0.5.8 → 0.5.10
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.
- package/CHANGELOG.md +69 -0
- package/README.md +81 -39
- package/bin/owenloop.mjs +16 -1
- package/dist/packages/work/src/agent/loop.d.ts +23 -8
- package/dist/packages/work/src/agent/loop.js +55 -6
- package/dist/packages/work/src/bundle/pull.d.ts +21 -0
- package/dist/packages/work/src/bundle/pull.js +118 -0
- package/dist/packages/work/src/consumed-verifier.js +6 -17
- package/dist/packages/work/src/exec/instructions.d.ts +4 -1
- package/dist/packages/work/src/exec/instructions.js +3 -0
- package/dist/packages/work/src/exec/loop.d.ts +2 -2
- package/dist/packages/work/src/exec/loop.js +273 -46
- package/dist/packages/work/src/exec/receipt.d.ts +7 -7
- package/dist/packages/work/src/exec/receipt.js +6 -6
- package/dist/packages/work/src/harness/claude.js +116 -0
- package/dist/packages/work/src/harness/codex.d.ts +8 -0
- package/dist/packages/work/src/harness/codex.js +27 -1
- package/dist/packages/work/src/harness/contract.d.ts +9 -0
- package/dist/packages/work/src/hub/client.d.ts +19 -4
- package/dist/packages/work/src/hub/client.js +7 -3
- package/dist/packages/work/src/hub/types.d.ts +84 -0
- package/dist/packages/work/src/main.js +1 -0
- package/dist/packages/work/src/roles/agent-run.js +57 -32
- package/dist/packages/work/src/roles/exec.js +27 -8
- package/dist/packages/work/src/roles/settings.js +2 -0
- package/dist/packages/work/src/roles/shift.js +14 -2
- package/dist/packages/work/src/roles/util.d.ts +1 -0
- package/dist/packages/work/src/roles/util.js +10 -0
- package/dist/packages/work/src/settings/hub-roster-cache.d.ts +68 -0
- package/dist/packages/work/src/settings/hub-roster-cache.js +370 -0
- package/dist/packages/work/src/settings/roster.d.ts +84 -0
- package/dist/packages/work/src/settings/roster.js +364 -5
- package/dist/packages/work/src/settings/serving.d.ts +17 -0
- package/dist/packages/work/src/settings/serving.js +79 -0
- package/dist/packages/work/src/settings/settings.d.ts +14 -1
- package/dist/packages/work/src/settings/settings.js +14 -0
- package/dist/packages/work/src/shift/loop.d.ts +108 -5
- package/dist/packages/work/src/shift/loop.js +416 -54
- package/dist/packages/work/src/shift/protocol.d.ts +7 -5
- package/dist/packages/work/src/shift/runtime.d.ts +18 -0
- package/dist/packages/work/src/shift/runtime.js +104 -5
- package/dist/packages/work/src/shift/server.js +2 -0
- package/dist/packages/work/src/shift/spawn.d.ts +17 -2
- package/dist/packages/work/src/shift/spawn.js +16 -13
- package/dist/packages/work/src/shift/state.d.ts +29 -2
- package/dist/packages/work/src/shift/state.js +45 -15
- package/dist/packages/work/src/submit-proof.d.ts +11 -8
- package/dist/packages/work/src/submit-proof.js +11 -8
- package/dist/packages/work/src/usage.d.ts +1 -1
- package/dist/packages/work/src/usage.js +7 -1
- package/dist/packages/work/src/util/modifier-init.d.ts +7 -0
- package/dist/packages/work/src/util/modifier-init.js +73 -0
- package/dist/src/bundle/tar.d.ts +9 -4
- package/dist/src/bundle/tar.js +9 -4
- package/dist/src/capabilities.d.ts +76 -6
- package/dist/src/capabilities.js +49 -6
- package/dist/src/capability-mapping-client.d.ts +29 -0
- package/dist/src/capability-mapping-client.js +160 -0
- package/dist/src/cli.d.ts +16 -3
- package/dist/src/cli.js +1925 -281
- package/dist/src/config-dir.d.ts +1 -1
- package/dist/src/config-dir.js +1 -1
- package/dist/src/crypto/index.d.ts +1 -1
- package/dist/src/crypto/index.js +1 -1
- package/dist/src/crypto/org-root.d.ts +30 -12
- package/dist/src/crypto/org-root.js +162 -14
- package/dist/src/crypto/records.d.ts +2 -0
- package/dist/src/crypto/records.js +2 -0
- package/dist/src/defs.d.ts +38 -2
- package/dist/src/defs.js +593 -86
- package/dist/src/engine.d.ts +103 -25
- package/dist/src/engine.js +331 -79
- package/dist/src/hub.d.ts +77 -0
- package/dist/src/hub.js +162 -0
- package/dist/src/implements.d.ts +56 -0
- package/dist/src/implements.js +790 -0
- package/dist/src/index.d.ts +11 -9
- package/dist/src/index.js +6 -5
- package/dist/src/mcp/serve.d.ts +22 -0
- package/dist/src/mcp/serve.js +330 -41
- package/dist/src/mcp/server.d.ts +10 -7
- package/dist/src/mcp/server.js +53 -8
- package/dist/src/model.d.ts +48 -10
- package/dist/src/model.js +252 -99
- package/dist/src/order-resolver.d.ts +1 -0
- package/dist/src/order-resolver.js +8 -1
- package/dist/src/schemas/index.d.ts +11 -0
- package/dist/src/schemas/order.v1.schema.json +7 -1
- package/dist/src/store/def-source.d.ts +19 -0
- package/dist/src/store/def-source.js +87 -17
- package/dist/src/store/gc-recovery.d.ts +46 -0
- package/dist/src/store/gc-recovery.js +258 -0
- package/dist/src/store/gc.d.ts +94 -0
- package/dist/src/store/gc.js +562 -0
- package/dist/src/store/index.d.ts +3 -1
- package/dist/src/store/index.js +2 -0
- package/dist/src/store/install.d.ts +34 -5
- package/dist/src/store/install.js +73 -11
- package/dist/src/store/pre-commit-verifier.js +42 -2
- package/dist/src/store/snapshot-guard.d.ts +18 -0
- package/dist/src/store/snapshot-guard.js +94 -0
- package/dist/src/store.d.ts +69 -4
- package/dist/src/store.js +254 -16
- package/dist/src/types.d.ts +101 -20
- package/dist/src/util.js +4 -1
- package/docs/authoring.md +235 -10
- package/docs/bundles.md +45 -2
- package/docs/cli.md +437 -55
- package/docs/crypto.md +32 -10
- package/docs/design.md +177 -47
- package/docs/evals/mcp-charter-baseline.json +428 -0
- package/docs/mcp-charter-eval.md +124 -0
- package/docs/routing.md +189 -34
- package/docs/shift-logs.md +38 -9
- package/docs/wire-contracts.md +78 -14
- package/examples/workflows/compile-dev-playbook.yaml +1 -1
- package/examples/workflows/delivery.yaml +31 -14
- package/examples/workflows/ship.yaml +38 -4
- package/package.json +2 -1
- package/plugins/claude-code/plugin/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/plugin/.mcp.json +1 -1
- package/plugins/claude-code/plugin/skills/author/SKILL.md +22 -0
- package/plugins/claude-code/plugin/skills/ephemeral/SKILL.md +95 -0
- package/plugins/claude-code/plugin/skills/graduate/SKILL.md +156 -0
- package/plugins/claude-code/plugin/skills/plan/SKILL.md +236 -0
- package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +1 -1
- package/plugins/codex/plugins/owenloop/.mcp.json +1 -1
- package/plugins/codex/plugins/owenloop/skills/author/SKILL.md +22 -0
- package/plugins/codex/plugins/owenloop/skills/ephemeral/SKILL.md +95 -0
- package/plugins/codex/plugins/owenloop/skills/graduate/SKILL.md +156 -0
- package/plugins/codex/plugins/owenloop/skills/plan/SKILL.md +236 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,75 @@ 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.10](https://github.com/typicalday/owenloop/compare/v0.5.9...v0.5.10) (2026-08-21)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* add graduate skill for ephemeral plan promotion ([#254](https://github.com/typicalday/owenloop/issues/254)) ([3dd4e81](https://github.com/typicalday/owenloop/commit/3dd4e81c7e2a557fd3e61ab29ec71f154cff8590))
|
|
13
|
+
* add hub ephemeral workflow skill ([#230](https://github.com/typicalday/owenloop/issues/230)) ([64b069b](https://github.com/typicalday/owenloop/commit/64b069bc1868f121c302a1f4380446bdd9c683c9))
|
|
14
|
+
* add plan compiler skill ([#251](https://github.com/typicalday/owenloop/issues/251)) ([8a1fb9a](https://github.com/typicalday/owenloop/commit/8a1fb9ac5c658f25eac28647c5f8b7d8ea282575))
|
|
15
|
+
* add safe workflow bundle garbage collection ([#221](https://github.com/typicalday/owenloop/issues/221)) ([2c2ca81](https://github.com/typicalday/owenloop/commit/2c2ca8149fa07c8ca0b6ad647903d43e62af6f12))
|
|
16
|
+
* add x.discovery lint convention ([#218](https://github.com/typicalday/owenloop/issues/218)) ([06ee581](https://github.com/typicalday/owenloop/commit/06ee5810c0ca4bed4c8bb9e61bb367300d071d76))
|
|
17
|
+
* declare and check workflow interface claims ([#252](https://github.com/typicalday/owenloop/issues/252)) ([fae1d83](https://github.com/typicalday/owenloop/commit/fae1d83b527ea41581cb5c6edad98c77929dd79e))
|
|
18
|
+
* **engine:** map authored capabilities to org names before composition ([#213](https://github.com/typicalday/owenloop/issues/213)) ([775813e](https://github.com/typicalday/owenloop/commit/775813e6a8caa874f48dd78beb2311d26bd0239a))
|
|
19
|
+
* expose pending gates to MCP and CLI clients ([#223](https://github.com/typicalday/owenloop/issues/223)) ([38ba485](https://github.com/typicalday/owenloop/commit/38ba4851ba29f1afcb0b02064a47725d63ae1eea))
|
|
20
|
+
* expose search_workflows over MCP ([#231](https://github.com/typicalday/owenloop/issues/231)) ([7223021](https://github.com/typicalday/owenloop/commit/7223021746cc2e7702319d5e3206972556ae5555))
|
|
21
|
+
* expose workflow discovery metadata in defs ([#222](https://github.com/typicalday/owenloop/issues/222)) ([ad8ca3b](https://github.com/typicalday/owenloop/commit/ad8ca3b15cfd2d21a2233a2d2bf4dcb4bae3e786))
|
|
22
|
+
* install outside defs under scoped capabilities ([#214](https://github.com/typicalday/owenloop/issues/214)) ([ae375cd](https://github.com/typicalday/owenloop/commit/ae375cd2d442336ddd254bff5899fc50216a55dc))
|
|
23
|
+
* **mcp:** add chief-of-staff charter ([#219](https://github.com/typicalday/owenloop/issues/219)) ([cc3f02f](https://github.com/typicalday/owenloop/commit/cc3f02f6747ed08cc0a36d9dcd32d503574d2f15))
|
|
24
|
+
* support oneOf, anyOf, and uniqueItems in interface compatibility ([#256](https://github.com/typicalday/owenloop/issues/256)) ([fb6710b](https://github.com/typicalday/owenloop/commit/fb6710bc2f65e0ca8078716247a3c58d48386d8b))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* a claim released for capacity re-arms the next sweep ([#217](https://github.com/typicalday/owenloop/issues/217)) ([f09e93b](https://github.com/typicalday/owenloop/commit/f09e93b57eab64bbbc93fa4e9be4714fede86552))
|
|
30
|
+
* a returned lease is not a run for budget or cadence ([#215](https://github.com/typicalday/owenloop/issues/215)) ([e79fcc5](https://github.com/typicalday/owenloop/commit/e79fcc5ca325ce62a18f0558125dc0cf8edf5083))
|
|
31
|
+
* calls joins wait for whole-child completion ([#239](https://github.com/typicalday/owenloop/issues/239)) ([934215d](https://github.com/typicalday/owenloop/commit/934215d69381bb1fc189be1c424fb73d09070b3d))
|
|
32
|
+
* classify future idle waits as stalls, not deadlocks ([#250](https://github.com/typicalday/owenloop/issues/250)) ([1efec61](https://github.com/typicalday/owenloop/commit/1efec617ca27d24e8ceaab45c879f8677480e3cd))
|
|
33
|
+
* **cli:** report auth rate limits accurately ([#228](https://github.com/typicalday/owenloop/issues/228)) ([44da220](https://github.com/typicalday/owenloop/commit/44da2202b026deb49b69a2cc17bba5812180f12e))
|
|
34
|
+
* **cli:** route reject and provide to hub ([#220](https://github.com/typicalday/owenloop/issues/220)) ([1697b8d](https://github.com/typicalday/owenloop/commit/1697b8d17ea549516fb0f326de55aab94966d594))
|
|
35
|
+
* damp repeated capacity reclaims in Shift ([#243](https://github.com/typicalday/owenloop/issues/243)) ([c20003a](https://github.com/typicalday/owenloop/commit/c20003a179c71763043961d1c583da3cbe0865a0))
|
|
36
|
+
* drain CLI output before exit ([#235](https://github.com/typicalday/owenloop/issues/235)) ([eecf853](https://github.com/typicalday/owenloop/commit/eecf85327b631eca5512bc87d522db060b603ba7))
|
|
37
|
+
* **engine:** re-stamp owed version target when a reject re-arms a claim ([#211](https://github.com/typicalday/owenloop/issues/211)) ([ccf956c](https://github.com/typicalday/owenloop/commit/ccf956c02ed2cdec2659861724c3a235be99a6b8))
|
|
38
|
+
* keep a source schema's own constraints when checking its union branches ([#260](https://github.com/typicalday/owenloop/issues/260)) ([4803906](https://github.com/typicalday/owenloop/commit/4803906d7f41b61b8f617b3a40da3e6f6d6227e4))
|
|
39
|
+
* **mcp:** expose hub passthrough fields ([#227](https://github.com/typicalday/owenloop/issues/227)) ([32548f1](https://github.com/typicalday/owenloop/commit/32548f1cf2747f6599fd1e00a2cc859a8da64b53))
|
|
40
|
+
* **mcp:** put the catalog rule first in the chief-of-staff charter ([#233](https://github.com/typicalday/owenloop/issues/233)) ([e5ff766](https://github.com/typicalday/owenloop/commit/e5ff76656041bfe4c66785e5d1ce0d573114a020))
|
|
41
|
+
* model all collection member retractions ([#234](https://github.com/typicalday/owenloop/issues/234)) ([9b87542](https://github.com/typicalday/owenloop/commit/9b875423dd56f4153c386b75e3eda0861933ab15))
|
|
42
|
+
* read the capability mappings the hub actually returns ([#216](https://github.com/typicalday/owenloop/issues/216)) ([f416396](https://github.com/typicalday/owenloop/commit/f416396039baefeb6ca86a1c063ae53b28a6c2fa))
|
|
43
|
+
* report collection search cap usage ([#245](https://github.com/typicalday/owenloop/issues/245)) ([de4925c](https://github.com/typicalday/owenloop/commit/de4925cd0c72c8a4193bd3c8eee2a4507ba9f6f4))
|
|
44
|
+
* retry rate-limited exec receipt submissions ([#225](https://github.com/typicalday/owenloop/issues/225)) ([c5ce4bb](https://github.com/typicalday/owenloop/commit/c5ce4bb505c83ea420b3549f928ea51891d76eac))
|
|
45
|
+
* revive exclusive-group siblings when the winner is un-greened ([#253](https://github.com/typicalday/owenloop/issues/253)) ([66eab0a](https://github.com/typicalday/owenloop/commit/66eab0ad2805f09d0196673d968a54203a637222))
|
|
46
|
+
* settle a calls output when its gate input is skipped ([#257](https://github.com/typicalday/owenloop/issues/257)) ([c773a4e](https://github.com/typicalday/owenloop/commit/c773a4ef8cd6b012b007d8134a80ca282ba9bf9e))
|
|
47
|
+
* validate calls edges in lint and check ([#240](https://github.com/typicalday/owenloop/issues/240)) ([5741261](https://github.com/typicalday/owenloop/commit/5741261c19c7f694c2f25a919abd2acf2af13038))
|
|
48
|
+
* validate hub workflow IDs locally ([#244](https://github.com/typicalday/owenloop/issues/244)) ([da5e91f](https://github.com/typicalday/owenloop/commit/da5e91f8072f500d26f752aa4060beea70b6b0fb))
|
|
49
|
+
* **work:** surface and resolve command-step orders whose bundle is missing from the store ([#261](https://github.com/typicalday/owenloop/issues/261)) ([9dbd4f0](https://github.com/typicalday/owenloop/commit/9dbd4f03b1411b18c4f38e36a7da00cd1fc38b90))
|
|
50
|
+
|
|
51
|
+
## [0.5.9](https://github.com/typicalday/owenloop/compare/v0.5.8...v0.5.9) (2026-08-19)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Features
|
|
55
|
+
|
|
56
|
+
* add --scope and --priority to owenloop start, default MCP scope to repo name ([#205](https://github.com/typicalday/owenloop/issues/205)) ([1270885](https://github.com/typicalday/owenloop/commit/12708856d837b6bba40c8294ad62d76940b3944a))
|
|
57
|
+
* add hub retry artifact controls ([#191](https://github.com/typicalday/owenloop/issues/191)) ([2afcaf6](https://github.com/typicalday/owenloop/commit/2afcaf6321ab952be7c7895e4e85907efd4965e5))
|
|
58
|
+
* bind artifact values to run modifier and meta, with deterministic init ([#200](https://github.com/typicalday/owenloop/issues/200)) ([ca7c402](https://github.com/typicalday/owenloop/commit/ca7c4026ff60816987dca43dfca492610dc43b09))
|
|
59
|
+
* declare cleanup steps for cancelled runs ([#204](https://github.com/typicalday/owenloop/issues/204)) ([bc3d1ef](https://github.com/typicalday/owenloop/commit/bc3d1ef94ca177cafa37c697709c26bef6d3a59d))
|
|
60
|
+
* **shift:** advertise serving capabilities ([#194](https://github.com/typicalday/owenloop/issues/194)) ([4ff4010](https://github.com/typicalday/owenloop/commit/4ff4010c57ba91c4b12cab812d0cbd2cc4b33b75))
|
|
61
|
+
* stamp matched crews on orders and resolve worker rosters from the stamp ([#193](https://github.com/typicalday/owenloop/issues/193)) ([aceae05](https://github.com/typicalday/owenloop/commit/aceae055d72eb54a0da8b5edb87b4ce3caddebe5))
|
|
62
|
+
* sync hub org rosters into the shift cache and merge them as the weakest layers ([#190](https://github.com/typicalday/owenloop/issues/190)) ([643e2fd](https://github.com/typicalday/owenloop/commit/643e2fdfe93c4b6d9dd80cd15a211c275b130918))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### Bug Fixes
|
|
66
|
+
|
|
67
|
+
* carry the child command output tail into a payload reject ([#197](https://github.com/typicalday/owenloop/issues/197)) ([e3ee61f](https://github.com/typicalday/owenloop/commit/e3ee61fbc51598d883a310e33b84abafb399aa98))
|
|
68
|
+
* do not hold hub claims a shift cannot dispatch ([#209](https://github.com/typicalday/owenloop/issues/209)) ([5b61433](https://github.com/typicalday/owenloop/commit/5b61433cab384107f5cf126253e0fd1b3c62e0c2))
|
|
69
|
+
* escalate failed command diagnostics through ask ([#203](https://github.com/typicalday/owenloop/issues/203)) ([583d4c3](https://github.com/typicalday/owenloop/commit/583d4c34772d32035b7067abc71620bf46143acc))
|
|
70
|
+
* log claude adapter turn activity ([#188](https://github.com/typicalday/owenloop/issues/188)) ([c9ba76a](https://github.com/typicalday/owenloop/commit/c9ba76a8948dd5dc0733a204313374322f2fa22f))
|
|
71
|
+
* make the bind shorthand resolve a key path instead of the whole value ([#206](https://github.com/typicalday/owenloop/issues/206)) ([03ac38c](https://github.com/typicalday/owenloop/commit/03ac38ca2066cf6e23592f693e484601efdd6ebb))
|
|
72
|
+
* make the modifier vocabulary consistent across parse, start, and bind ([#210](https://github.com/typicalday/owenloop/issues/210)) ([afd33a6](https://github.com/typicalday/owenloop/commit/afd33a6d5f49525e3e7e65a8df481af6b53c1a55))
|
|
73
|
+
* reserve dispatch capacity for exec orders ([#207](https://github.com/typicalday/owenloop/issues/207)) ([91c6a66](https://github.com/typicalday/owenloop/commit/91c6a66869b5b2c06c9db228818c6bb19c7ede9e))
|
|
74
|
+
* **shift:** release exited workers and resweep braked steps ([#196](https://github.com/typicalday/owenloop/issues/196)) ([1b23815](https://github.com/typicalday/owenloop/commit/1b238153caf5d4dacdce7731c06b64830dbe15ce))
|
|
75
|
+
|
|
7
76
|
## [0.5.8](https://github.com/typicalday/owenloop/compare/v0.5.7...v0.5.8) (2026-08-17)
|
|
8
77
|
|
|
9
78
|
|
package/README.md
CHANGED
|
@@ -307,6 +307,38 @@ The bundle route derives `<home>` from the first non-blank caller-injected
|
|
|
307
307
|
recovery-marker directory. A bundle install refuses when neither variable is
|
|
308
308
|
supplied rather than falling back to the process user's ambient home.
|
|
309
309
|
|
|
310
|
+
Normal definition discovery no longer floods stderr for expected bundle
|
|
311
|
+
history. It emits at most one `note: N superseded bundle versions hidden;
|
|
312
|
+
--verbose to list them`; the global `--verbose` flag restores every detailed
|
|
313
|
+
superseded-version notice. The actionable `has no selectable version` warning
|
|
314
|
+
for competing non-SemVer versions is never hidden.
|
|
315
|
+
|
|
316
|
+
Store history can be bounded safely with a dry run first:
|
|
317
|
+
|
|
318
|
+
```sh
|
|
319
|
+
owenloop bundle gc --keep 2 # project store, report only
|
|
320
|
+
owenloop bundle gc --keep 2 --yes # recompute under lock and apply
|
|
321
|
+
owenloop bundle gc --global # global store, report only
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
The default keep count is 2 (current plus one rollback version). GC preserves
|
|
325
|
+
selected versions, explicit pins, retained local instance snapshots, transitive
|
|
326
|
+
bundle locks from every retained coordinate in either root, exact versioned
|
|
327
|
+
calls from retained legacy snapshots and current project/add definitions, and
|
|
328
|
+
project-index fallback into the global store. Reachability is coordinate- and
|
|
329
|
+
root-aware, so
|
|
330
|
+
an intact non-target copy does not keep a redundant target history beyond
|
|
331
|
+
`--keep`. It never contacts the hub; `--yes` is the only destructive switch
|
|
332
|
+
and only the target bundle index/object tree is changed. Applied GC takes both
|
|
333
|
+
roots' writer locks (creating only coordination state at a known missing
|
|
334
|
+
counterpart root when necessary). Project GC also takes the legacy GitHub-add
|
|
335
|
+
lock and recovers its journal before clearing their shared staging tree; global
|
|
336
|
+
GC uses that lock as a read barrier without recovering or otherwise mutating the
|
|
337
|
+
project tree.
|
|
338
|
+
CAS-backed snapshot writers share the store locks, and bundle installs
|
|
339
|
+
revalidate exact manifest locks before commit, so stale definitions or callers
|
|
340
|
+
cannot be pinned during or immediately after collection.
|
|
341
|
+
|
|
310
342
|
Bundle installs fail closed without their two required adapters (bundle
|
|
311
343
|
ingestion and pre-commit verification). The default CLI binds the real
|
|
312
344
|
bundle ingestor, so a `.wnlp` produced by `packBundle` reaches the normal
|
|
@@ -356,42 +388,41 @@ looks like:
|
|
|
356
388
|
as scratch discipline rather than standing infrastructure.
|
|
357
389
|
|
|
358
390
|
The engine doesn't know or care which of these is ticking it — an order is an
|
|
359
|
-
order.
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
-
|
|
368
|
-
|
|
369
|
-
|
|
391
|
+
order. The Owenloop Claude Code and Codex plugins provide six hub-native skills:
|
|
392
|
+
|
|
393
|
+
- [`conduct`](plugins/_skills/conduct/SKILL.md) — supervise one existing workflow
|
|
394
|
+
through a scoped Shift, check its status, and relay human gates.
|
|
395
|
+
- [`author`](plugins/_skills/author/SKILL.md) — interview a human, draft a workflow,
|
|
396
|
+
validate it through `create_workflow`, present it for approval, and offer
|
|
397
|
+
`start_run`. Use `conduct` or `shift` to supervise the resulting run.
|
|
398
|
+
- [`ephemeral`](plugins/_skills/ephemeral/SKILL.md) — structure the caller's own
|
|
399
|
+
one-off work with an ephemeral workflow.
|
|
400
|
+
- [`graduate`](plugins/_skills/graduate/SKILL.md) — turn evidence from a
|
|
401
|
+
completed ephemeral composite into a reusable, policy-conformant library candidate.
|
|
402
|
+
- [`plan`](plugins/_skills/plan/SKILL.md) — compile novel multi-domain work into
|
|
403
|
+
a checked, approval-gated ephemeral composite that delegates library playbooks.
|
|
404
|
+
- [`shift`](plugins/_skills/shift/SKILL.md) — attend a crew's ongoing workflow
|
|
405
|
+
workload through the blocking Shift loop and relay human gates.
|
|
406
|
+
|
|
407
|
+
Put the `owenloop` CLI on `PATH` and run `owenloop setup`; the setup flow converges
|
|
408
|
+
the bundled Claude Code and Codex plugins on that same CLI and hub connection.
|
|
370
409
|
|
|
371
410
|
---
|
|
372
411
|
|
|
373
412
|
## Quick start
|
|
374
413
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
```sh
|
|
379
|
-
npx skills add typicalday/owenloop
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
Then ask your Prime Agent for what you want:
|
|
414
|
+
Put the `owenloop` CLI (Node ≥ 22.13) on `PATH` and run `owenloop setup` once. Then
|
|
415
|
+
ask your Prime Agent for what you want:
|
|
383
416
|
|
|
384
|
-
> Use
|
|
417
|
+
> Use author to build me a workflow that researches a topic, writes
|
|
385
418
|
> a report, and doesn't accept it until an independent reviewer signs off —
|
|
386
419
|
> then run it on "tidepools".
|
|
387
420
|
|
|
388
|
-
The skill interviews you for anything missing, writes and validates the
|
|
389
|
-
definition,
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
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
|
|
421
|
+
The `author` skill interviews you for anything missing, writes and validates the
|
|
422
|
+
YAML definition, and presents the process for approval before offering to start it.
|
|
423
|
+
Already have a def? *"Conduct the report workflow"* hands it to
|
|
424
|
+
[`conduct`](plugins/_skills/conduct/SKILL.md). The shipped Claude Code and Codex
|
|
425
|
+
plugins launch the same `owenloop` command as
|
|
395
426
|
`owenloop mcp`, rather than using a separate npx-pinned server. The plugins
|
|
396
427
|
check the installed CLI/plugin version pair at session start when their hooks
|
|
397
428
|
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
|
|
@@ -417,8 +448,10 @@ owenloop bundle digest ./report-1.2.0.wnlp
|
|
|
417
448
|
owenloop bundle unpack ./report-1.2.0.wnlp ./unpacked-report
|
|
418
449
|
```
|
|
419
450
|
|
|
420
|
-
|
|
421
|
-
|
|
451
|
+
The bundle format commands (`pack`, `inspect`, `digest`, and `unpack`) are
|
|
452
|
+
filesystem-only: they do not open or create the local `.owenloop/state.db` and
|
|
453
|
+
do not contact a remote service. `bundle gc` is intentionally store- and
|
|
454
|
+
local-snapshot-aware, but likewise never contacts the hub. Packing never edits
|
|
422
455
|
the source manifest. Inspection and unpacking reject unsafe paths, symlinks,
|
|
423
456
|
unsupported archive entry types, malformed canonical headers, duplicate files,
|
|
424
457
|
invalid manifests, workflow/manifest name mismatches, missing lock entries, and
|
|
@@ -453,8 +486,10 @@ through the same small CLI (`create`, `tick`, `green`, `reject`, …).
|
|
|
453
486
|
[`docs/cli.md`](docs/cli.md) has the full command reference and a hand-driven
|
|
454
487
|
walkthrough of a pipeline — including a rejection knock-back and a stall —
|
|
455
488
|
and [`examples/workflows`](examples/workflows) has seventeen runnable defs, from a
|
|
456
|
-
minimal review loop
|
|
457
|
-
|
|
489
|
+
minimal review loop written to teach the wiring
|
|
490
|
+
([`delivery`](examples/workflows/delivery.yaml) — a four-step example, not the
|
|
491
|
+
production line) to a production-shaped pipeline
|
|
492
|
+
([`ship`](examples/workflows/ship.yaml)), a
|
|
458
493
|
collections-heavy research pipeline
|
|
459
494
|
([`research`](examples/workflows/research.yaml)), and a compiler that turns
|
|
460
495
|
live vendor docs into a new gate-checked def
|
|
@@ -479,7 +514,11 @@ against the hub before it's ever stored), `owenloop connect` binds the project
|
|
|
479
514
|
to a hub, and `owenloop push` publishes your defs. Use `owenloop push --bundle
|
|
480
515
|
<bundle.wnlp>` after `owenloop publish` when execution must be pinned to the
|
|
481
516
|
exact signed bundle digest; plain YAML pushes remain idempotent against the
|
|
482
|
-
hub's own def hashes. `owenloop
|
|
517
|
+
hub's own def hashes. To publish an *outside* repo's defs, `owenloop install
|
|
518
|
+
<owner>/<repo>` scopes every capability they author to `<defName>.<capability>`
|
|
519
|
+
unless you deliberately map it onto a name your crews already serve — see
|
|
520
|
+
[`install`](docs/cli.md#install--publish-an-outside-repos-defs-under-scoped-capabilities).
|
|
521
|
+
`owenloop agent new
|
|
483
522
|
<name>` mints a Scoped Identity on the hub and stores its token in slot
|
|
484
523
|
`agent:<name>` without ever printing it. See the
|
|
485
524
|
[Hub](docs/cli.md#hub-login--connect--push--logout) section in `docs/cli.md`.
|
|
@@ -717,13 +756,16 @@ can NEVER fire regardless of search bounds are **structurally dead** — a real
|
|
|
717
756
|
defect, reported nonzero exit — while steps that CAN fire but the bounded search
|
|
718
757
|
just didn't reach are **unreached within bounds** — informational only, exit 0.
|
|
719
758
|
It also splits every reachable non-done, no-moves state into exactly one of two
|
|
720
|
-
buckets: a **stall state** — the state
|
|
721
|
-
(maxAttempts / maxSchemaFailures / held)
|
|
722
|
-
lifted (a human `retry` =
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
759
|
+
buckets: a **stall state** — the state is blocked only by a frozen/stalled debt
|
|
760
|
+
(maxAttempts / maxSchemaFailures / held) *or* an idle trigger waiting for its
|
|
761
|
+
threshold; recomputing eligibility with the freeze lifted (a human `retry` =
|
|
762
|
+
unlimited attempts) and with eventual idle time shows a move would become
|
|
763
|
+
available. This is an EXPECTED, by-design human-escalation brake or future wait
|
|
764
|
+
and never fails the check. The classifier does not add future idle transitions to
|
|
765
|
+
the timeless reachability search, so an idle-only completion path can still report
|
|
766
|
+
`completable: false`. A **true deadlock** is a state where the same recompute STILL
|
|
767
|
+
yields no moves, a genuine structural dead-end which fails the check nonzero when
|
|
768
|
+
the search is exhaustive. See [`docs/design.md` §25](docs/design.md#25-the-model-checker-owenloop-check--scope)
|
|
727
769
|
for the full breakdown.
|
|
728
770
|
|
|
729
771
|
By default, `seedOwed` inputs are assumed provided (modeling the operator's `provide`
|
package/bin/owenloop.mjs
CHANGED
|
@@ -51,5 +51,20 @@ if (gatePath !== undefined && gatePath !== '') {
|
|
|
51
51
|
delete process.env.OWENLOOP_START_GATE;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
function handleStreamError(error) {
|
|
55
|
+
if (error?.code === 'EPIPE') return;
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function drain(stream) {
|
|
60
|
+
return new Promise((resolve) => stream.write('', resolve));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
process.stdout.on('error', handleStreamError);
|
|
64
|
+
process.stderr.on('error', handleStreamError);
|
|
65
|
+
|
|
54
66
|
const { mainAsync } = await import('../dist/src/cli.js');
|
|
55
|
-
mainAsync(process.argv.slice(2)).then((code) =>
|
|
67
|
+
mainAsync(process.argv.slice(2)).then(async (code) => {
|
|
68
|
+
await Promise.all([drain(process.stdout), drain(process.stderr)]);
|
|
69
|
+
process.exit(code);
|
|
70
|
+
});
|
|
@@ -7,7 +7,7 @@ import { type SessionRecord, type SessionTaskRef } from '../harness/session-stor
|
|
|
7
7
|
import { type CapabilityMatch } from './capability-model.ts';
|
|
8
8
|
import type { MergedRoster } from '../settings/roster.ts';
|
|
9
9
|
/** Discriminated result of one worker life; the role maps these to exit codes. */
|
|
10
|
-
export type AgentRunOutcome = 'submitted' | 'completed' | 'misroute' | 'workdir-denied' | 'no-template' | 'no-harness' | 'incompatible-harness-policy' | 'unresolvable-capability' | 'unverified-consumed' | 'session-store-failed' | 'no-submit' | 'killed' | 'lease-lost' | 'ownership-error' | 'hub-unreachable' | 'stopped';
|
|
10
|
+
export type AgentRunOutcome = 'submitted' | 'completed' | 'misroute' | 'workdir-denied' | 'no-template' | 'no-harness' | 'incompatible-harness-policy' | 'unstamped-order' | 'unresolvable-crew' | 'unresolvable-capability' | 'unverified-consumed' | 'session-store-failed' | 'no-submit' | 'killed' | 'lease-lost' | 'ownership-error' | 'hub-unreachable' | 'stopped';
|
|
11
11
|
/**
|
|
12
12
|
* Locate the normalized step spec for an order. Injected because the lookup is
|
|
13
13
|
* I/O (the verified workflow store) and because resolving the local definition
|
|
@@ -36,6 +36,21 @@ export interface AdapterResolution {
|
|
|
36
36
|
}
|
|
37
37
|
/** The two harness inputs are rank 1 (roster) and rank 3 (step definition). */
|
|
38
38
|
export type AdapterResolver = (chosenHarness: string | undefined, stepHarness: string | undefined) => AdapterResolution;
|
|
39
|
+
/** Outcome of turning a STAMPED crew name list into merged rosters. */
|
|
40
|
+
export type CrewRosterResolution = {
|
|
41
|
+
ok: true;
|
|
42
|
+
rosters: readonly MergedRoster[];
|
|
43
|
+
} | {
|
|
44
|
+
ok: false;
|
|
45
|
+
crew: string;
|
|
46
|
+
detail: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Turns the crews the HUB STAMPED on an order into merged rosters, in the
|
|
50
|
+
* stamped order. Injected by the role so the loop stays free of filesystem and
|
|
51
|
+
* environment reads.
|
|
52
|
+
*/
|
|
53
|
+
export type CrewRosterResolver = (crews: readonly string[]) => CrewRosterResolution;
|
|
39
54
|
/** Default confirm-phase cadence: one `get_order` per second. */
|
|
40
55
|
export declare const DEFAULT_CONFIRM_INTERVAL_MS = 1000;
|
|
41
56
|
/** Default confirm-phase bound: give the hub 15s to show the submit's outcome. */
|
|
@@ -70,12 +85,10 @@ export interface AgentRunLoopOptions {
|
|
|
70
85
|
loadStep: StepLoader;
|
|
71
86
|
resolveAdapter: AdapterResolver;
|
|
72
87
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* The Phase 1 crew selection is interim: Phase 2 replaces it with crews
|
|
76
|
-
* stamped by the hub on the order.
|
|
88
|
+
* Resolves the crews the hub stamped on the order. REQUIRED — this loop has
|
|
89
|
+
* no crew source other than the order's stamp.
|
|
77
90
|
*/
|
|
78
|
-
|
|
91
|
+
resolveCrewRosters: CrewRosterResolver;
|
|
79
92
|
/**
|
|
80
93
|
* Phase-1 availability is adapter-registry membership at the composition
|
|
81
94
|
* root. A real binary/credential probe needs new adapter-contract surface.
|
|
@@ -174,9 +187,11 @@ export type OrderRouting = {
|
|
|
174
187
|
} | {
|
|
175
188
|
kind: 'refused';
|
|
176
189
|
capabilities: readonly string[];
|
|
177
|
-
reason: 'harness-policy' | 'unresolvable-capability';
|
|
190
|
+
reason: 'harness-policy' | 'unstamped-order' | 'unresolvable-crew' | 'unresolvable-capability';
|
|
178
191
|
offered?: readonly string[];
|
|
179
192
|
stepHarness?: string;
|
|
193
|
+
crew?: string;
|
|
194
|
+
detail?: string;
|
|
180
195
|
} | {
|
|
181
196
|
kind: 'unrouted';
|
|
182
197
|
};
|
|
@@ -188,7 +203,7 @@ export type OrderRouting = {
|
|
|
188
203
|
* abstract rung with no meaning left, and reading it as a model id would put a
|
|
189
204
|
* literal `strong` on the wire to a vendor.
|
|
190
205
|
*/
|
|
191
|
-
export declare function resolveOrderRouting(packet: OrderPacket,
|
|
206
|
+
export declare function resolveOrderRouting(packet: OrderPacket, resolveCrewRosters: CrewRosterResolver, stepHarness: string | undefined, isAvailable: (harnessId: string) => boolean): OrderRouting;
|
|
192
207
|
/**
|
|
193
208
|
* Poll `get_order` at `intervalMs` for at most `graceMs`, answering ONE
|
|
194
209
|
* question: did the hub see the agent's `submit`?
|
|
@@ -124,12 +124,47 @@ function briefOwes(packet) {
|
|
|
124
124
|
* abstract rung with no meaning left, and reading it as a model id would put a
|
|
125
125
|
* literal `strong` on the wire to a vendor.
|
|
126
126
|
*/
|
|
127
|
-
export function resolveOrderRouting(packet,
|
|
127
|
+
export function resolveOrderRouting(packet, resolveCrewRosters, stepHarness, isAvailable) {
|
|
128
128
|
const capabilities = packet.capabilities ?? [];
|
|
129
129
|
if (capabilities.length === 0)
|
|
130
130
|
return { kind: 'unrouted' };
|
|
131
|
+
const stamp = packet.crews;
|
|
132
|
+
if (stamp === undefined) {
|
|
133
|
+
return {
|
|
134
|
+
kind: 'refused',
|
|
135
|
+
capabilities,
|
|
136
|
+
reason: 'unstamped-order',
|
|
137
|
+
detail: 'the order carries no crews field',
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
if (!Array.isArray(stamp) || stamp.length === 0) {
|
|
141
|
+
return {
|
|
142
|
+
kind: 'refused',
|
|
143
|
+
capabilities,
|
|
144
|
+
reason: 'unstamped-order',
|
|
145
|
+
detail: `unusable crews stamp (${JSON.stringify(stamp)})`,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
if (stamp.some((crew) => typeof crew !== 'string' || crew.trim() === '')) {
|
|
149
|
+
return {
|
|
150
|
+
kind: 'refused',
|
|
151
|
+
capabilities,
|
|
152
|
+
reason: 'unstamped-order',
|
|
153
|
+
detail: `unusable crews stamp (${JSON.stringify(stamp)})`,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const resolved = resolveCrewRosters(stamp);
|
|
157
|
+
if (!resolved.ok) {
|
|
158
|
+
return {
|
|
159
|
+
kind: 'refused',
|
|
160
|
+
capabilities,
|
|
161
|
+
reason: 'unresolvable-crew',
|
|
162
|
+
crew: resolved.crew,
|
|
163
|
+
detail: resolved.detail,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
131
166
|
let firstHarnessPolicy;
|
|
132
|
-
for (const roster of rosters
|
|
167
|
+
for (const roster of resolved.rosters) {
|
|
133
168
|
// Preserve arbitrary capability names through the boundary between the
|
|
134
169
|
// provenance-bearing merged roster and the candidate-only selector.
|
|
135
170
|
const candidateRows = Object.create(null);
|
|
@@ -360,6 +395,13 @@ export function createAgentRunLoop(opts) {
|
|
|
360
395
|
case 'progress':
|
|
361
396
|
opts.err(`owenloop work agent-run: ${e.text}`);
|
|
362
397
|
return;
|
|
398
|
+
case 'assistant_response':
|
|
399
|
+
// The eval uses this typed event as report evidence. Regular work must
|
|
400
|
+
// not persist this additional unbounded copy merely because an adapter
|
|
401
|
+
// surfaced it. Existing adapter-owned, capped progress telemetry remains
|
|
402
|
+
// unchanged and is still logged by the `progress` case above.
|
|
403
|
+
opts.err('owenloop work agent-run: final response evidence received (redacted)');
|
|
404
|
+
return;
|
|
363
405
|
case 'needs_input':
|
|
364
406
|
opts.err(`owenloop work agent-run: WARNING the step agent asked for input and this contract has no reply channel — ${e.question}`);
|
|
365
407
|
return;
|
|
@@ -502,10 +544,7 @@ export function createAgentRunLoop(opts) {
|
|
|
502
544
|
* closures below. This const carries the narrowing across. */
|
|
503
545
|
const step = material;
|
|
504
546
|
// ---- ROUTING: select a roster candidate before resolving an adapter ----
|
|
505
|
-
|
|
506
|
-
// Phase 1's crew order is interim. Phase 2 replaces these locally supplied
|
|
507
|
-
// rosters with crew stamps the hub puts on each offer.
|
|
508
|
-
const routing = resolveOrderRouting(packet, opts.rosters, step.harness, opts.harnessAvailable);
|
|
547
|
+
const routing = resolveOrderRouting(packet, opts.resolveCrewRosters, step.harness, opts.harnessAvailable);
|
|
509
548
|
await reportResolution(routing);
|
|
510
549
|
if (routing.kind === 'refused') {
|
|
511
550
|
if (routing.reason === 'harness-policy') {
|
|
@@ -513,6 +552,16 @@ export function createAgentRunLoop(opts) {
|
|
|
513
552
|
`but its roster candidates offer [${(routing.offered ?? []).join(', ')}] — releasing`);
|
|
514
553
|
return releaseWith('incompatible-harness-policy', 'incompatible-harness-policy');
|
|
515
554
|
}
|
|
555
|
+
if (routing.reason === 'unstamped-order') {
|
|
556
|
+
opts.err(packet.crews === undefined
|
|
557
|
+
? `owenloop work agent-run: order ${order} was offered under capabilities [${routing.capabilities.join(', ')}] but carries NO crews stamp. This worker resolves crew rosters only from the hub's offer-time stamp; there is no fallback to the crews this shift was started with. The hub at ${opts.origin} must stamp crews on every capability-bearing order. Releasing.`
|
|
558
|
+
: `owenloop work agent-run: order ${order} was offered under capabilities [${routing.capabilities.join(', ')}] but carries an unusable crews stamp (${JSON.stringify(packet.crews)}). Expected a non-empty array of non-empty crew names. This worker resolves crew rosters only from the hub's offer-time stamp; there is no fallback to the crews this shift was started with. The hub at ${opts.origin} must stamp crews on every capability-bearing order. Releasing.`);
|
|
559
|
+
return releaseWith('unstamped-order', 'unstamped-order');
|
|
560
|
+
}
|
|
561
|
+
if (routing.reason === 'unresolvable-crew') {
|
|
562
|
+
opts.err(`owenloop work agent-run: order ${order} is stamped with crews [${packet.crews.join(', ')}], but crew '${routing.crew}' cannot be resolved on this machine: ${routing.detail}. Releasing.`);
|
|
563
|
+
return releaseWith('unresolvable-crew', 'unresolvable-crew');
|
|
564
|
+
}
|
|
516
565
|
opts.err(`owenloop work agent-run: no crew roster row for ${order} — the order's capabilities ` +
|
|
517
566
|
`[${routing.capabilities.join(', ')}] match neither an exact row nor a bare name row in 'roster'. ` +
|
|
518
567
|
`Add a candidate array for one of them and restart the shift. Releasing — this shift will not pick ` +
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { MissingObjectHandler } from '../../../../src/store/index.ts';
|
|
2
|
+
export interface HubBundleRecoveryOptions {
|
|
3
|
+
/** Authenticated hub origin; a trailing slash is accepted. */
|
|
4
|
+
origin: string;
|
|
5
|
+
/** Scoped worker/shift bearer. It is sent only in the Authorization header. */
|
|
6
|
+
token: string;
|
|
7
|
+
/** Injected home, used for the global store and its recovery marker directory. */
|
|
8
|
+
home: string;
|
|
9
|
+
/** Current project root, used by install's exact-lock validation. */
|
|
10
|
+
projectRoot: string;
|
|
11
|
+
/** Environment used by the pre-commit trust policy. */
|
|
12
|
+
env: Record<string, string | undefined>;
|
|
13
|
+
/** Diagnostic sink for warn policy decisions. */
|
|
14
|
+
warn?: (line: string) => void;
|
|
15
|
+
/** Injectable transport for hermetic recovery tests. */
|
|
16
|
+
fetchImpl?: typeof fetch;
|
|
17
|
+
/** Per-request deadline; production uses the fixed 30-second default. */
|
|
18
|
+
timeoutMs?: number;
|
|
19
|
+
}
|
|
20
|
+
/** Build the existing store's one-shot `onMissing` hook for a scoped worker. */
|
|
21
|
+
export declare function createHubBundleRecoveryHandler(args: HubBundleRecoveryOptions): MissingObjectHandler;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authenticated, one-shot recovery of a workflow bundle missing from both
|
|
3
|
+
* local stores. This is deliberately an internal store-miss adapter, not a
|
|
4
|
+
* user-facing pull command: it obtains raw canonical bundle bytes and the
|
|
5
|
+
* evidence that the normal install trust boundary must validate.
|
|
6
|
+
*/
|
|
7
|
+
import { defaultRecoveryMarkerDir } from "../../../../src/install.js";
|
|
8
|
+
import { readBodyBounded } from "../../../../src/credentials.js";
|
|
9
|
+
import { createBundleIngestor, createPreCommitVerifier, defDigest, globalStoreRoot, installWorkflowBundle, workflowStoreStatePaths, } from "../../../../src/store/index.js";
|
|
10
|
+
const BUNDLE_MAX_BYTES = 25_000_000;
|
|
11
|
+
const EVIDENCE_MAX_BYTES = 64 * 1024;
|
|
12
|
+
const RECOVERY_TIMEOUT_MS = 30_000;
|
|
13
|
+
function originBase(origin) {
|
|
14
|
+
const trimmed = origin.replace(/\/+$/, '');
|
|
15
|
+
if (trimmed === '')
|
|
16
|
+
throw new Error('cannot recover workflow bundle: hub origin is empty');
|
|
17
|
+
return trimmed;
|
|
18
|
+
}
|
|
19
|
+
function routeFor(origin, resource, digest) {
|
|
20
|
+
return `${originBase(origin)}/api/${resource}/${encodeURIComponent(digest)}`;
|
|
21
|
+
}
|
|
22
|
+
function failure(route, detail) {
|
|
23
|
+
// This deliberately names only a route and status/classification. Never pass
|
|
24
|
+
// through fetch request options or headers: the bearer must not become error
|
|
25
|
+
// text or a shift log record.
|
|
26
|
+
return new Error(`workflow bundle recovery failed for ${route}: ${detail}`);
|
|
27
|
+
}
|
|
28
|
+
async function request(args, route) {
|
|
29
|
+
const timeoutMs = args.timeoutMs ?? RECOVERY_TIMEOUT_MS;
|
|
30
|
+
try {
|
|
31
|
+
return await (args.fetchImpl ?? globalThis.fetch)(route, {
|
|
32
|
+
method: 'GET',
|
|
33
|
+
headers: { Authorization: `Bearer ${args.token}` },
|
|
34
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
35
|
+
redirect: 'error',
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
const name = error instanceof Error ? error.name : 'request error';
|
|
40
|
+
const detail = name === 'TimeoutError' || name === 'AbortError'
|
|
41
|
+
? `timed out after ${timeoutMs / 1_000}s`
|
|
42
|
+
: 'request failed';
|
|
43
|
+
throw failure(route, detail);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function bytesFrom(response, route, cap) {
|
|
47
|
+
try {
|
|
48
|
+
return await readBodyBounded(response, cap, route);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
const detail = error instanceof Error && /cap/u.test(error.message)
|
|
52
|
+
? `response exceeds the ${cap}-byte cap`
|
|
53
|
+
: 'could not read response body';
|
|
54
|
+
throw failure(route, detail);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** Build the existing store's one-shot `onMissing` hook for a scoped worker. */
|
|
58
|
+
export function createHubBundleRecoveryHandler(args) {
|
|
59
|
+
return {
|
|
60
|
+
async onMissing(requestedDigest) {
|
|
61
|
+
const digest = defDigest(requestedDigest);
|
|
62
|
+
const bundleRoute = routeFor(args.origin, 'bundles', digest);
|
|
63
|
+
const bundleResponse = await request(args, bundleRoute);
|
|
64
|
+
if (!bundleResponse.ok)
|
|
65
|
+
throw failure(bundleRoute, `hub returned HTTP ${bundleResponse.status}`);
|
|
66
|
+
const bytes = await bytesFrom(bundleResponse, bundleRoute, BUNDLE_MAX_BYTES);
|
|
67
|
+
const publicationRoute = routeFor(args.origin, 'publications', digest);
|
|
68
|
+
const publicationResponse = await request(args, publicationRoute);
|
|
69
|
+
if (!publicationResponse.ok) {
|
|
70
|
+
throw failure(publicationRoute, `hub returned HTTP ${publicationResponse.status}`);
|
|
71
|
+
}
|
|
72
|
+
const state = publicationResponse.headers.get('x-owenloop-publication-state');
|
|
73
|
+
if (state !== 'signed' && state !== 'unsigned') {
|
|
74
|
+
throw failure(publicationRoute, 'missing or invalid X-Owenloop-Publication-State header');
|
|
75
|
+
}
|
|
76
|
+
const publicationBytes = await bytesFrom(publicationResponse, publicationRoute, EVIDENCE_MAX_BYTES);
|
|
77
|
+
if (state === 'signed' && publicationBytes.byteLength === 0) {
|
|
78
|
+
throw failure(publicationRoute, 'signed publication evidence is empty');
|
|
79
|
+
}
|
|
80
|
+
const originRoute = routeFor(args.origin, 'origins', digest);
|
|
81
|
+
const originResponse = await request(args, originRoute);
|
|
82
|
+
let originDsseBytes;
|
|
83
|
+
if (originResponse.status === 404) {
|
|
84
|
+
await originResponse.body?.cancel().catch(() => { });
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
if (!originResponse.ok)
|
|
88
|
+
throw failure(originRoute, `hub returned HTTP ${originResponse.status}`);
|
|
89
|
+
originDsseBytes = await bytesFrom(originResponse, originRoute, EVIDENCE_MAX_BYTES);
|
|
90
|
+
if (originDsseBytes.byteLength === 0)
|
|
91
|
+
throw failure(originRoute, 'origin evidence is empty');
|
|
92
|
+
}
|
|
93
|
+
const globalRoot = globalStoreRoot(args.home);
|
|
94
|
+
const statePaths = workflowStoreStatePaths(globalRoot);
|
|
95
|
+
await installWorkflowBundle({
|
|
96
|
+
bytes,
|
|
97
|
+
source: { kind: 'url', url: bundleRoute },
|
|
98
|
+
root: globalRoot,
|
|
99
|
+
level: 'global',
|
|
100
|
+
projectRoot: args.projectRoot,
|
|
101
|
+
globalRoot,
|
|
102
|
+
lockPath: statePaths.lockPath,
|
|
103
|
+
journalPath: statePaths.journalPath,
|
|
104
|
+
recoveryMarkerDir: defaultRecoveryMarkerDir(args.home),
|
|
105
|
+
ingestor: createBundleIngestor(),
|
|
106
|
+
verifier: createPreCommitVerifier({ env: args.env, ...(args.warn !== undefined ? { warn: args.warn } : {}) }),
|
|
107
|
+
expectedDigest: digest,
|
|
108
|
+
verificationEvidence: {
|
|
109
|
+
publication: state === 'signed'
|
|
110
|
+
? { state, dsseBytes: publicationBytes }
|
|
111
|
+
: { state, markerBytes: publicationBytes },
|
|
112
|
+
...(originDsseBytes !== undefined ? { originDsseBytes } : {}),
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
return 'retry';
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { mergePolicyFloorWithLocal, } from "../../../src/crypto/policy-floor.js";
|
|
10
10
|
import { resolveArtifactPolicy, } from "../../../src/store/pre-commit-verifier.js";
|
|
11
|
-
import { loadRevocations,
|
|
11
|
+
import { loadRevocations, loadGrants, resolveOrgRoot, } from "../../../src/crypto/org-root.js";
|
|
12
12
|
import { verifyConsumed, } from "../../../src/crypto/verify-consumed.js";
|
|
13
13
|
import { validateProducer } from "../../../src/crypto/chain.js";
|
|
14
14
|
/** Missing-org-root warnings are intentionally latched once per order process-wide. */
|
|
@@ -97,25 +97,14 @@ export function createConsumedVerifier(args) {
|
|
|
97
97
|
let revocations;
|
|
98
98
|
try {
|
|
99
99
|
root = resolveOrgRoot(args.env);
|
|
100
|
-
grants =
|
|
100
|
+
grants = loadGrants(args.env);
|
|
101
101
|
revocations = loadRevocations(args.env);
|
|
102
102
|
}
|
|
103
103
|
catch (error) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (result !== undefined)
|
|
109
|
-
return result;
|
|
110
|
-
}
|
|
111
|
-
for (const owed of order.owes) {
|
|
112
|
-
if (owed.reasons.length === 0 && owed.proof === undefined)
|
|
113
|
-
continue;
|
|
114
|
-
const result = policyOutcome(order, opts.hardRule, policy, owed.path, { kind: 'unverifiable', reason }, warnings);
|
|
115
|
-
if (result !== undefined)
|
|
116
|
-
return result;
|
|
117
|
-
}
|
|
118
|
-
return { ok: true, order, warnings };
|
|
104
|
+
return {
|
|
105
|
+
ok: false,
|
|
106
|
+
reason: `consumed artifact gate refusal for ${order.workflow}/${order.run} step '${order.step}': local producer trust material could not be loaded: ${errorText(error)}`,
|
|
107
|
+
};
|
|
119
108
|
}
|
|
120
109
|
const prerequisite = root.kind === 'absent'
|
|
121
110
|
? 'prerequisite: no org-root anchor is configured'
|