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
@@ -0,0 +1,395 @@
1
+ # Wire contracts
2
+
3
+ This document describes the versioned records that cross an owenloop trust
4
+ boundary. The checked-in TypeScript definitions in `src/crypto/records.ts` and
5
+ the JSON Schemas in `src/schemas/` describe the same fields. The test suite
6
+ checks both directions: a field added to one side without the other fails the
7
+ build.
8
+
9
+ This package defines shapes only. Signing, verification, enrollment, revocation
10
+ processing, scope attenuation, origin recording, and policy evaluation are
11
+ separate responsibilities.
12
+
13
+ ## DSSE envelope
14
+
15
+ The records use a DSSEv1 envelope with this shape:
16
+
17
+ ```json
18
+ {
19
+ "payloadType": "application/vnd.owenloop.submission.v1+json",
20
+ "payload": "<base64 payload bytes>",
21
+ "signatures": [{ "keyid": "<optional hint>", "sig": "<base64 signature>" }]
22
+ }
23
+ ```
24
+
25
+ `payloadType` is part of the signed data. The type is bound to the record class,
26
+ so a valid signature for one class cannot be consumed as another class.
27
+ `payload` and `sig` are standard Base64 when produced. Verification accepts the
28
+ standard and URL-safe alphabets but rejects malformed encodings.
29
+
30
+ The DSSE pre-authentication encoding is:
31
+
32
+ ```text
33
+ DSSEv1 SP len(typeBytes) SP typeBytes SP len(payloadBytes) SP payloadBytes
34
+ ```
35
+
36
+ Both lengths are ASCII decimal **byte counts**. `typeBytes` is the UTF-8 byte
37
+ sequence for `payloadType`; the payload length is the exact number of payload
38
+ bytes. The length is not the number of characters in a string. This distinction
39
+ matters for non-ASCII payload types or payload data.
40
+
41
+ ## Versioned payload types
42
+
43
+ The six bound records defined here use the existing media types:
44
+
45
+ | Record | Payload type |
46
+ | --- | --- |
47
+ | Enrollment grant | `application/vnd.owenloop.enrollment-grant.v1+json` |
48
+ | Revocation | `application/vnd.owenloop.revocation.v1+json` |
49
+ | Submission | `application/vnd.owenloop.submission.v1+json` |
50
+ | Policy floor | `application/vnd.owenloop.policy-floor.v1+json` |
51
+ | Origin | `application/vnd.owenloop.origin.v1+json` |
52
+ | Publication | `application/vnd.owenloop.publication.v1+json` |
53
+
54
+ Origin is a bound record class, not a label. Its source fields are signed
55
+ content in a separate DSSE envelope, and the hub or another relay cannot write,
56
+ derive, or default them.
57
+
58
+ A contract change that removes a field, makes an optional field required, or
59
+ narrows an accepted value is breaking. Such a change requires a new payload
60
+ type at `.v2`; do not edit the meaning of `.v1`. Adding an optional field whose
61
+ absence preserves the old meaning is compatible and may update `.v1`, but the
62
+ TypeScript type, field manifest, schema, fixtures, and documentation must move
63
+ together in one commit.
64
+
65
+ ## Submission record
66
+
67
+ Payload type: `application/vnd.owenloop.submission.v1+json`.
68
+
69
+ | Field | Required | Meaning |
70
+ | --- | --- | --- |
71
+ | `run` | yes | Workflow run identifier. |
72
+ | `workflow` | yes | Workflow instance identifier. |
73
+ | `defDigest` | yes | Non-empty opaque reference to the instruction snapshot. The resolver seam does not require a fixed digest alphabet. |
74
+ | `step` | yes | Producing step name. |
75
+ | `key` | yes | Binding key, including the empty key used by non-map firings. |
76
+ | `index` | no | Map/index position when the firing has one. |
77
+ | `produced` | yes | One or more produced values. |
78
+ | `consumedFingerprint` | yes | Open artifact-path map to the non-negative input version consumed at claim time. |
79
+ | `producerKeyId` | yes | `SHA256:<unpadded-base64>` fingerprint of the producer key. |
80
+ | `timestamp` | yes | Epoch milliseconds. |
81
+
82
+ Each `produced` entry has `artifact`, non-negative integer `version`, and a
83
+ lowercase SHA-256 `valueDigest`.
84
+
85
+ A driver signs only when the driver can name the exact artifact version without
86
+ inferring mutable coordinator state. A judge approval can use the judged path's
87
+ claim-time `consumedFingerprint` entry because the approval attests that existing
88
+ version and does not allocate a new version. A producer submit uses
89
+ `owes[].version`, the target version the hub issues for that owed output: the
90
+ version the next successful commit lands (claim-time committed version + 1), and
91
+ therefore the version the consumer supplies to `verifyConsumed` as
92
+ `expectedVersion`.
93
+
94
+ The target is retry-safe because the engine computes it inside the claim
95
+ transaction and persists it with the immutable order. Every read of that claim
96
+ returns the same number, so a refinement, a committed submit whose response was
97
+ lost, an unsigned commit, or a client process restart cannot move it. Refusal
98
+ paths that leave the run open do not bump the artifact, and a refinement is a
99
+ new claim with a newly issued target. A stale target fails the consumer's
100
+ version check — a refusal, never an admitted unverified value.
101
+
102
+ A target counts as authoritative only when it is a positive integer, since the
103
+ smallest commit a producer can land is v1. Given an absent target, a `0`, or a
104
+ non-integer, built-in clients submit the producer value without a proof rather
105
+ than sign a number the consumer is guaranteed to reject.
106
+
107
+ A consuming driver verifies the envelope before trusting the value. The
108
+ verified signer key must equal `producerKeyId`; the signed `produced[]` entry
109
+ must cover the requested artifact path; and the signed `valueDigest` and
110
+ `version` must match the delivered value and the consumer's claim-time version
111
+ when supplied. The driver then validates the producer's local enrollment chain,
112
+ revocations, and any supplied demand's scope. These checks belong to the
113
+ consuming driver, not the hub or another transport relay.
114
+
115
+ The built-in production `exec`, `agent-run`, and `hold` roles currently supply
116
+ no pool, label, or namespace demand, and `OrderPacket` has no demand field from
117
+ which to derive one. Production consume gates therefore enforce chain
118
+ termination, per-link signatures, attenuation, and revocation, but the
119
+ demand-dependent `scopePermits` restriction is currently vacuous. A verifier
120
+ caller that supplies a demand receives the full scope check. This is a named
121
+ follow-up, not hub-side trust.
122
+
123
+ ### Deployed hub compatibility
124
+
125
+ The schema above is the target wire contract, not evidence that every deployed
126
+ hub carries every optional field. As of 2026-08-12, hub-core projects
127
+ `consumedFingerprint`, `owes[].proof`, and `consumesProof` onto served orders and
128
+ persists a client-supplied submit `proof` beside the committed artifact. It still
129
+ omits `owes[].version`, for two independent reasons: the pinned engine copy under
130
+ `packages/engine-do/vendor/` predates the field, and the served-order projection
131
+ in `packages/hub-core/src/reference-order.ts` allow-lists `path`,
132
+ `judgmentRejects`, `schemaRejects`, `reasons`, and `proof` without it. Both must
133
+ change, and the change must be deployed, before a served order names a target
134
+ version.
135
+
136
+ Client transport types keep these fields optional so one client remains
137
+ compatible with both a pre-target-semantics hub and a version-aware hub. Against
138
+ a hub that serves no `owes[].version`, a producer submit carries no proof, and a
139
+ command step consuming that artifact refuses it — the hard rule for command
140
+ steps is never relaxed to admit an unverified value.
141
+
142
+ ## Publication record
143
+
144
+ Payload type: `application/vnd.owenloop.publication.v1+json`.
145
+
146
+ A publication record binds one signed statement to one canonical workflow
147
+ bundle. The `digest` is the lowercase 64-hex SHA-256 digest of the exact
148
+ uncompressed canonical tar inside the `.wnlp` bundle. The record is serialized
149
+ with the package's canonical JSON rules before DSSE signing; the signature does
150
+ not cover a gzip wrapper hash or a compiled-definition hash.
151
+
152
+ | Field | Required | Meaning |
153
+ | --- | --- | --- |
154
+ | `digest` | yes | Canonical bundle digest: lowercase 64-hex SHA-256 over the uncompressed canonical tar. |
155
+ | `name` | yes | Package name from the bundle manifest. |
156
+ | `version` | yes | Package version from the bundle manifest. |
157
+ | `publisherKeyId` | yes | Publisher public-key fingerprint in `SHA256:<unpadded-base64>` form. |
158
+ | `timestamp` | yes | Unix epoch milliseconds when the author created the publication record. |
159
+
160
+ The v1 publication object is closed: unknown properties are rejected. The
161
+ publication payload type is bound to this record by the runtime DSSE allow-list,
162
+ field manifest, and JSON Schema together.
163
+
164
+ ## Origin record
165
+
166
+ Payload type: `application/vnd.owenloop.origin.v1+json`.
167
+
168
+ An origin record is a signed provenance statement for one canonical workflow
169
+ bundle. Its `digest` is the lowercase 64-hex SHA-256 digest of the exact
170
+ uncompressed canonical tar inside the `.wnlp` bundle. The origin and publication
171
+ records use the same digest and are signed inside the same signing scope with the
172
+ same signer, but each record has its own DSSE envelope and sidecar.
173
+
174
+ | Field | Required | Meaning |
175
+ | --- | --- | --- |
176
+ | `digest` | yes | Canonical bundle digest: lowercase 64-hex SHA-256 over the uncompressed canonical tar. |
177
+ | `name` | yes | Package name from the bundle manifest. |
178
+ | `version` | yes | Package version from the bundle manifest. |
179
+ | `source` | yes | Signed provenance union; one of the `git`, `console`, or `agent` forms below. |
180
+ | `attesterKeyId` | yes | Untrusted candidate-selection hint for the signing key; verification cross-checks it against the verified signer. |
181
+ | `timestamp` | yes | Unix epoch milliseconds when the author created the origin record. |
182
+
183
+ `source` is a closed discriminated union:
184
+
185
+ - `{ "kind": "git", "repo": "...", "commit": "..." }` records the
186
+ explicitly supplied repository identifier and a 40- or 64-hex commit SHA.
187
+ - `{ "kind": "console", "user": "..." }` records the authoring user
188
+ identity from a client-side signing ceremony.
189
+ - `{ "kind": "agent", "agent": "...", "session": "..." }` records the
190
+ agent identity and session.
191
+
192
+ The source value is not derived by the hub. A caller supplies source data (for
193
+ example through `owenloop publish --source '<json>'`), and the signer signs the
194
+ resulting origin record. A remote coordinator stores or relays the signed record
195
+ but never authors, stamps, or completes the origin.
196
+
197
+ ## Enrollment grant
198
+
199
+ Payload type: `application/vnd.owenloop.enrollment-grant.v1+json`.
200
+
201
+ | Field | Required | Meaning |
202
+ | --- | --- | --- |
203
+ | `newKey` | yes | Public descriptor for the key being granted: `keyid`, `keyType`, `openSshPublicKey`, and optional `comment`. |
204
+ | `principal` | yes | `{ kind, id }`, where `kind` is `human`, `machine`, or `agent`. |
205
+ | `scope` | yes | Complete claim, production, publication, and delegation scope. |
206
+ | `grantedBy` | yes | Grantor key fingerprint in `SHA256:<unpadded-base64>` form. |
207
+ | `validFrom` | yes | Epoch milliseconds at which the grant becomes valid. |
208
+
209
+ `scope.pools`, `scope.labels`, and `scope.namespaces` are each either an array
210
+ of strings or the literal `"*"`. The empty array means no values; `"*"` means
211
+ every value. Each axis is required so a reader never has to guess a default.
212
+
213
+ `scope.delegation` is a discriminated union:
214
+
215
+ ```json
216
+ { "allowed": false }
217
+ ```
218
+
219
+ or:
220
+
221
+ ```json
222
+ { "allowed": true, "maxDepth": 2 }
223
+ ```
224
+
225
+ `maxDepth` is a non-negative integer or `"unbounded"`. A non-delegating grant
226
+ has no `maxDepth` field.
227
+
228
+ The wire record does not identify an organization or mark an org root. Chain
229
+ validation receives the org-root public key as a local trust anchor; the root
230
+ has no grant record. See [Enrollment chains, attenuation, and revocation](crypto.md#enrollment-chains-attenuation-and-revocation)
231
+ for chain termination, per-link signature verification, and scope attenuation.
232
+
233
+ ## Revocation
234
+
235
+ Payload type: `application/vnd.owenloop.revocation.v1+json`.
236
+
237
+ | Field | Required | Meaning |
238
+ | --- | --- | --- |
239
+ | `revokedKey` | yes | Key fingerprint being revoked. |
240
+ | `principal` | yes | `{ kind, id }` for the principal that owns the key. |
241
+ | `revokedBy` | yes | Signer key fingerprint. |
242
+ | `issuedAt` | yes | Epoch milliseconds when the record was issued. |
243
+ | `effectiveFrom` | yes | Epoch milliseconds at which the revocation cut applies. |
244
+ | `backdated` | yes | Explicit marker for a cut earlier than issuance. |
245
+ | `reason` | no | Human-readable explanation. |
246
+
247
+ A normal forward cut uses `effectiveFrom === issuedAt` and
248
+ `backdated: false`. Verification must cross-check the boolean against the two
249
+ timestamps. JSON Schema checks each field's individual shape, while the
250
+ cross-field consistency rule is verification-time logic. A backdated cut is
251
+ structurally visible so the verifier can apply the stronger signer rule without
252
+ inferring intent from clock arithmetic alone.
253
+
254
+ Revocation cuts apply forward. An artifact that was valid before the cut is not
255
+ retroactively changed solely because a later revocation record exists. The
256
+ validator also checks timestamp consistency, signer authority, and the
257
+ org-root-only rule for backdated cuts. See [Enrollment chains, attenuation, and revocation](crypto.md#enrollment-chains-attenuation-and-revocation)
258
+ for those verification rules.
259
+
260
+ ## Policy floor
261
+
262
+ Payload type: `application/vnd.owenloop.policy-floor.v1+json`.
263
+
264
+ | Field | Required | Meaning |
265
+ | --- | --- | --- |
266
+ | `org` | yes | Organization identifier. |
267
+ | `issuedAt` | yes | Epoch milliseconds when the floor was issued. |
268
+ | `signedBy` | yes | Admin key fingerprint. |
269
+ | `floor` | yes | Normative minimum settings. |
270
+ | `preset` | no | Optional `L0`, `L1`, or `L2` label. |
271
+
272
+ `floor` always carries the four normative axes. `trustMode` is a frozen wire
273
+ value; this package carries the value but does not evaluate trust-mode behavior.
274
+ The exact accepted literals are pinned in
275
+ `src/schemas/policy-floor.v1.schema.json`. The other three axes use these
276
+ literals:
277
+
278
+ - `unsignedDefs`: `warn` or `refuse`;
279
+ - `unsignedArtifacts`: `warn` or `refuse`;
280
+ - `originRules`: `advisory` or `enforced`.
281
+
282
+ A floor is a minimum. A driver may require a stricter local policy, and a
283
+ relaying transport cannot use this record to weaken that local policy. The
284
+ transport relays the record; the transport is not the signer. `preset` is only
285
+ a label for a set of floor values, never a replacement for those values, so a
286
+ future preset can change without changing the required wire fields.
287
+
288
+ ## Reference-mode Order
289
+
290
+ `Order` is the sixth launch contract. The existing `Order` interface in
291
+ `src/types.ts` is authoritative; this package adds a schema and a manifest but
292
+ does not declare a second `Order` interface.
293
+
294
+ Required fields are `run`, `workflow`, `step`, `key`, `defDigest`, `inputs`,
295
+ `outputs`, `consumes`, and `owes`.
296
+
297
+ Optional fields are `index`, `workdir`, `model`, `worker`, `judge`, `spec`, `x`,
298
+ `consumedFingerprint`, `consumesProof`, and `cause`. `workdir` may be authored
299
+ as a literal `workdir:` or resolved by the engine from a consumed artifact's
300
+ `workdirFrom:` value; the Order wire shape remains unchanged.
301
+
302
+ `defDigest` is a non-empty opaque reference. `inputs` and `outputs` are string
303
+ arrays. `consumes` is an open artifact-path map; `spec` and `x` are opaque
304
+ objects carried through without engine interpretation. `owes` contains the owed
305
+ path, an optional target `version` (the version the next successful commit for
306
+ that path lands, issued inside the claim transaction), judgment/schema rejection
307
+ counters, reason entries, and an optional opaque `proof` string. `cause`, when present, is
308
+ `inputsGreen`, `allGreen`, or `idle`.
309
+
310
+ **Decision A — version cross-check without fingerprint recomputation.** The
311
+ `consumedFingerprint`, when present, is an open artifact-path map whose values
312
+ are the non-negative versions captured when the engine claimed the order. The
313
+ producer covers the map in its `submission.v1` signature. A driver enforces the
314
+ versions supplied in this map against signed `produced[].version`, but does not
315
+ recompute the producer's complete map from consumed values. A driver
316
+ distinguishes an absent map from a genuinely empty map: if the order has
317
+ consumed inputs but omits the map, the driver submits without a proof and emits
318
+ a warning; when independent authoritative output-version metadata is available,
319
+ an order with no consumed inputs may sign an explicitly empty `{}` map.
320
+
321
+ An explicit `{}` or partial map alongside a non-empty consumed set is still a
322
+ signed assertion of the map supplied on the wire. A consuming driver verifies
323
+ the supplied entries and enforces the versions that are present; the driver
324
+ does not recompute the producer's complete fingerprint map from values that
325
+ arrived in the same order. A hub that implements this target contract stores and relays the signed
326
+ content; the hub does not verify, repair, or authorize the assertion. The
327
+ current production hub does not yet implement that proof transport.
328
+
329
+ `consumesProof` is a JSON-serialized map from artifact path to serialized DSSE
330
+ envelope:
331
+
332
+ ```json
333
+ {"input":"{\"payloadType\":\"application/vnd.owenloop.submission.v1+json\",\"payload\":\"...\",\"signatures\":[...] }"}
334
+ ```
335
+
336
+ The map lets one order carry proofs from multiple producers without changing
337
+ the frozen string slot. In the target service protocol, the hub stores each
338
+ accepted submit proof beside the exact committed artifact version and omits
339
+ paths with no stored proof; `consumesProof` never contains null or empty-string
340
+ entries. The current production service does not provide that persistence or
341
+ projection. A consuming driver treats a missing entry as the `absent` verdict
342
+ and applies the configured artifact policy rather than stripping that artifact
343
+ from the order.
344
+
345
+ `owes[].proof`, when present, uses the same serialized DSSE envelope format. The
346
+ signed `submission.v1` record contains one `produced[]` entry for the owed path;
347
+ its `valueDigest` covers the complete `owes[].reasons` array at signing time.
348
+ A driver verifies the complete reason thread before any prompt renderer
349
+ truncates or summarizes the thread. The `submission.v1` record shape itself is
350
+ unchanged.
351
+
352
+ **Decision B — consumer-owned revocation anchor.** At consume time, the driver
353
+ samples its own clock once for the complete gate and evaluates revocations at
354
+ that instant. A producer-signed timestamp cannot move the `effectiveFrom <= at`
355
+ boundary; a timestamp ahead of the consumer clock is diagnostic only. A prior
356
+ successful consumption is not rewritten, but a later consumption can refuse the
357
+ same producer's artifact after a forward revocation cut.
358
+
359
+ ## Trust posture
360
+
361
+ A hub or other remote coordinator is a transport, not an integrity authority.
362
+ A compromised transport may delay or stall progress, but a driver must verify
363
+ that executable instructions, shell commands, dynamic artifact values, and
364
+ trusted signer identities were not altered before acting on them. These wire
365
+ contracts carry the data needed for those checks; consume-side verification is
366
+ implemented at the consuming driver boundary and never delegated to the hub.
367
+
368
+ ## Command payload and worker reject contracts
369
+
370
+ A command worker may emit one payload marker line on stdout:
371
+
372
+ ```text
373
+ ##owenloop:payload## {"...json..."}
374
+ ```
375
+
376
+ The worker scans stdout lines and uses the last line whose marker starts at the
377
+ beginning of the line. A marker in the middle of a line is not a match. The JSON
378
+ text after the marker is capped at 64 KiB. A missing marker leaves `payload`
379
+ out of the `CommandReceipt`; malformed or over-cap JSON produces
380
+ `payloadError` and no `payload`, while leaving the command exit code unchanged.
381
+ When the hub supplies authoritative output-version metadata and the driver can
382
+ sign, the parsed payload is part of the receipt value covered by the DSSE
383
+ submission proof. Current producer command receipts are unsigned because the
384
+ deployed hub does not supply a retry-safe target version.
385
+
386
+ A worker rejects an artifact through the `reject` verb. The request is exactly:
387
+
388
+ ```json
389
+ {"workflow":"<workflow>","run":"<run>","path":"<artifact stem>","text":"<reasons>"}
390
+ ```
391
+
392
+ The request has no `by` field. The hub derives the rejecting step from the
393
+ claiming run. The response carries the common `text` field plus `ok` and an
394
+ optional `closed`; `closed: true` means the claiming run is already closed and
395
+ the holder must stop without releasing it again.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owenloop",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Deterministic rails for agentic workflows. Declare steps and dependencies; the engine guarantees order, redoes what changes invalidate, and stops what keeps failing — instead of hoping the agent follows through.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "typicalday",
@@ -43,6 +43,8 @@
43
43
  "dist",
44
44
  "bin",
45
45
  "examples/workflows",
46
+ "plugins/claude-code",
47
+ "plugins/codex",
46
48
  "docs",
47
49
  "CHANGELOG.md"
48
50
  ],
@@ -53,9 +55,11 @@
53
55
  "owenloop": "node bin/owenloop.mjs",
54
56
  "test": "node --test --test-reporter=spec test/*.test.ts packages/work/test/*.test.ts",
55
57
  "test:quiet": "node --test test/*.test.ts packages/work/test/*.test.ts",
58
+ "test:crypto": "node --test test/crypto-dsse.test.ts test/crypto-allowed-signers.test.ts test/crypto-ssh.test.ts test/crypto-keys.test.ts",
56
59
  "typecheck": "tsc --noEmit",
57
60
  "lint": "eslint src packages/work/src",
58
61
  "clean": "rm -rf dist",
62
+ "materialize:plugins": "node scripts/materialize-plugins.mjs",
59
63
  "build": "npm run clean && tsc -p tsconfig.build.json",
60
64
  "pretest": "npm run build",
61
65
  "check": "npm run typecheck && npm run lint && npm run build && npm run test:quiet",
@@ -65,6 +69,7 @@
65
69
  "dependencies": {
66
70
  "@anthropic-ai/claude-agent-sdk": "0.3.220",
67
71
  "@cfworker/json-schema": "^4.1.1",
72
+ "semver": "^7.8.5",
68
73
  "yaml": "^2.9.0"
69
74
  },
70
75
  "devDependencies": {
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "owenloop",
3
+ "description": "Claude Code driver pack for the hosted owenloop workflow engine.",
4
+ "owner": {
5
+ "name": "Typical Day"
6
+ },
7
+ "plugins": [
8
+ {
9
+ "name": "owenloop",
10
+ "source": "./plugin",
11
+ "description": "Claude Code driver for the owenloop workflow engine."
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "owenloop",
3
+ "version": "0.5.2",
4
+ "description": "Claude Code driver for owenloop — cross-harness shift and conduct skills driven by the owenloop CLI, plus one hub control-plane MCP server backing an author skill and a fallback worker, for conducting and authoring workflows against your hosted owenloop server.",
5
+ "author": {
6
+ "name": "Typical Day"
7
+ }
8
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "mcpServers": {
3
+ "owenloop": {
4
+ "type": "stdio",
5
+ "command": "owenloop",
6
+ "args": [
7
+ "mcp"
8
+ ],
9
+ "env": {
10
+ "OWENLOOP_PLUGIN_VERSION": "0.5.2"
11
+ }
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh",
9
+ "timeout": 10
10
+ }
11
+ ]
12
+ }
13
+ ],
14
+ "SessionEnd": [
15
+ {
16
+ "hooks": [
17
+ {
18
+ "type": "command",
19
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/session-end.sh",
20
+ "timeout": 30
21
+ }
22
+ ]
23
+ }
24
+ ]
25
+ }
26
+ }
@@ -0,0 +1,40 @@
1
+ #!/bin/sh
2
+ # SessionEnd hook: best-effort drain of this session's daemon-held claims.
3
+ #
4
+ # The owenloop work daemon tags a hold with a session id (OWENWORK_SESSION);
5
+ # `owenloop work release --session <id>` re-offers that session's agent-held
6
+ # claims immediately so a closed shift session doesn't leave orders parked
7
+ # until their lease TTL lapses. This is belt-and-braces: every holder also
8
+ # final-breath-releases on stdin EOF, and the lease TTL is the ultimate
9
+ # backstop. SessionEnd cannot block and must never wedge teardown, so this
10
+ # ALWAYS exits 0.
11
+
12
+ # Read the hook's stdin JSON payload (carries session_id, cwd, hook_event_name).
13
+ payload="$(cat)"
14
+
15
+ # Extract session_id without jq (not guaranteed installed) — flat string field.
16
+ session_id="$(printf '%s' "$payload" | sed -n 's/.*"session_id"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p')"
17
+
18
+ # Nothing to drain without a session id, and no owenloop binary means no holds
19
+ # this hook could have created — no-op in both cases.
20
+ if [ -z "$session_id" ]; then
21
+ exit 0
22
+ fi
23
+ if ! command -v owenloop >/dev/null 2>&1; then
24
+ exit 0
25
+ fi
26
+
27
+ # Origin: `owenloop work release` resolves --origin flag > settings.hubOrigin
28
+ # (written by `owenloop setup`), no built-in default. OWENWORK_ORIGIN overrides
29
+ # when set; otherwise settings decide. On a legacy install with neither, the
30
+ # drain fails non-blockingly and claims fall back to their lease TTL — the
31
+ # designed backstop.
32
+ if [ -n "${OWENWORK_ORIGIN:-}" ]; then
33
+ set -- --origin "$OWENWORK_ORIGIN"
34
+ else
35
+ set --
36
+ fi
37
+ if ! owenloop work release --session "$session_id" "$@" 2>&1; then
38
+ echo "owenloop SessionEnd: owenloop work release --session $session_id failed (claims fall back to lease TTL)" >&2
39
+ fi
40
+ exit 0
@@ -0,0 +1,52 @@
1
+ #!/bin/sh
2
+ # SessionStart hook: report a CLI/plugin version mismatch before MCP calls begin.
3
+ #
4
+ # The root CLI has no --version flag, so ask its MCP initialize response for the
5
+ # server version instead. Read the plugin manifest at runtime so this hook does
6
+ # not add another copied version literal, and always exit 0 so a diagnostic never
7
+ # blocks session startup.
8
+
9
+ plugin_root="${CLAUDE_PLUGIN_ROOT:-}"
10
+ if [ -z "$plugin_root" ]; then
11
+ exit 0
12
+ fi
13
+
14
+ manifest="$plugin_root/.claude-plugin/plugin.json"
15
+ if [ ! -f "$manifest" ]; then
16
+ manifest="$plugin_root/.codex-plugin/plugin.json"
17
+ fi
18
+ if [ ! -f "$manifest" ]; then
19
+ exit 0
20
+ fi
21
+
22
+ # Extract the first flat JSON version field without jq (not guaranteed installed).
23
+ plugin_version="$(tr ',' '\n' < "$manifest" | sed -n 's/[^\"]*"version"[[:space:]]*:[[:space:]]*"\([^\"]*\)".*/\1/p' | sed -n '1p')"
24
+ if [ -z "$plugin_version" ]; then
25
+ echo "owenloop plugin version could not be determined. Run: owenloop setup" >&2
26
+ exit 0
27
+ fi
28
+
29
+ if ! command -v owenloop >/dev/null 2>&1; then
30
+ echo "owenloop CLI was not found on PATH. Run: owenloop setup" >&2
31
+ exit 0
32
+ fi
33
+
34
+ # The initialize response is the root CLI's supported version surface. It is
35
+ # also safe for old CLIs: one that lacks `mcp` fails below and gets a diagnosis.
36
+ initialize_request='{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18"}}'
37
+ # An explicit probe origin bypasses credential-store discovery. The placeholder
38
+ # is scoped to this subprocess, so the probe is deterministic and cannot spend
39
+ # the MCP enrollment probe timeout on a real hub network request.
40
+ probe_hub='https://plugin-version-probe.invalid'
41
+ cli_output="$(printf '%s\n' "$initialize_request" | OWENLOOP_HUB="$probe_hub" owenloop mcp 2>&1)"
42
+ cli_status=$?
43
+ cli_version="$(printf '%s\n' "$cli_output" | tr ',' '\n' | sed -n 's/[^\"]*"version"[[:space:]]*:[[:space:]]*"\([^\"]*\)".*/\1/p' | sed -n '1p')"
44
+ if [ "$cli_status" -ne 0 ] || [ -z "$cli_version" ]; then
45
+ echo "owenloop plugin $plugin_version could not determine the owenloop CLI version. Run: owenloop setup" >&2
46
+ exit 0
47
+ fi
48
+
49
+ if [ "$plugin_version" != "$cli_version" ]; then
50
+ echo "owenloop plugin $plugin_version does not match owenloop CLI $cli_version. Run: owenloop setup" >&2
51
+ fi
52
+ exit 0