owenloop 0.5.0 → 0.5.1

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 (211) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +137 -35
  3. package/bin/owenloop.mjs +49 -1
  4. package/dist/packages/work/src/agent/brief.d.ts +8 -4
  5. package/dist/packages/work/src/agent/brief.js +7 -3
  6. package/dist/packages/work/src/agent/loop.d.ts +13 -7
  7. package/dist/packages/work/src/agent/loop.js +136 -9
  8. package/dist/packages/work/src/agent/model-policy.d.ts +49 -0
  9. package/dist/packages/work/src/agent/model-policy.js +138 -0
  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 +12 -1
  20. package/dist/packages/work/src/exec/loop.js +137 -20
  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 +74 -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 +27 -9
  38. package/dist/packages/work/src/harness/session-store.js +271 -67
  39. package/dist/packages/work/src/hold/mcp.d.ts +25 -5
  40. package/dist/packages/work/src/hold/mcp.js +126 -11
  41. package/dist/packages/work/src/hub/client.d.ts +2 -1
  42. package/dist/packages/work/src/hub/client.js +14 -1
  43. package/dist/packages/work/src/hub/types.d.ts +69 -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 +116 -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 +4 -0
  53. package/dist/packages/work/src/roles/hold.js +44 -5
  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 +5 -0
  57. package/dist/packages/work/src/roles/shift.d.ts +1 -0
  58. package/dist/packages/work/src/roles/shift.js +23 -1
  59. package/dist/packages/work/src/settings/settings.d.ts +17 -1
  60. package/dist/packages/work/src/settings/settings.js +39 -0
  61. package/dist/packages/work/src/shift/loop.d.ts +14 -3
  62. package/dist/packages/work/src/shift/loop.js +447 -164
  63. package/dist/packages/work/src/shift/protocol.d.ts +4 -0
  64. package/dist/packages/work/src/shift/runtime.d.ts +2 -0
  65. package/dist/packages/work/src/shift/runtime.js +66 -3
  66. package/dist/packages/work/src/shift/spawn.d.ts +41 -18
  67. package/dist/packages/work/src/shift/spawn.js +89 -31
  68. package/dist/packages/work/src/shift/state.d.ts +53 -51
  69. package/dist/packages/work/src/shift/state.js +325 -102
  70. package/dist/packages/work/src/submit-proof.d.ts +36 -0
  71. package/dist/packages/work/src/submit-proof.js +93 -0
  72. package/dist/src/add.d.ts +64 -259
  73. package/dist/src/add.js +81 -615
  74. package/dist/src/archive.d.ts +97 -0
  75. package/dist/src/archive.js +591 -0
  76. package/dist/src/bundle/index.d.ts +64 -0
  77. package/dist/src/bundle/index.js +508 -0
  78. package/dist/src/bundle/manifest.d.ts +50 -0
  79. package/dist/src/bundle/manifest.js +435 -0
  80. package/dist/src/bundle/runtime.d.ts +26 -0
  81. package/dist/src/bundle/runtime.js +64 -0
  82. package/dist/src/bundle/tar.d.ts +62 -0
  83. package/dist/src/bundle/tar.js +238 -0
  84. package/dist/src/bundle/types.d.ts +105 -0
  85. package/dist/src/bundle/types.js +21 -0
  86. package/dist/src/cli.d.ts +90 -20
  87. package/dist/src/cli.js +2407 -365
  88. package/dist/src/credentials.d.ts +4 -3
  89. package/dist/src/credentials.js +21 -19
  90. package/dist/src/crypto/allowed-signers.d.ts +68 -0
  91. package/dist/src/crypto/allowed-signers.js +307 -0
  92. package/dist/src/crypto/canonical.d.ts +8 -0
  93. package/dist/src/crypto/canonical.js +92 -0
  94. package/dist/src/crypto/chain.d.ts +65 -0
  95. package/dist/src/crypto/chain.js +377 -0
  96. package/dist/src/crypto/dsse.d.ts +209 -0
  97. package/dist/src/crypto/dsse.js +282 -0
  98. package/dist/src/crypto/enrollment.d.ts +78 -0
  99. package/dist/src/crypto/enrollment.js +186 -0
  100. package/dist/src/crypto/index.d.ts +48 -0
  101. package/dist/src/crypto/index.js +44 -0
  102. package/dist/src/crypto/keys.d.ts +258 -0
  103. package/dist/src/crypto/keys.js +908 -0
  104. package/dist/src/crypto/org-root.d.ts +33 -0
  105. package/dist/src/crypto/org-root.js +78 -0
  106. package/dist/src/crypto/origin-rules.d.ts +56 -0
  107. package/dist/src/crypto/origin-rules.js +143 -0
  108. package/dist/src/crypto/policy-floor.d.ts +98 -0
  109. package/dist/src/crypto/policy-floor.js +353 -0
  110. package/dist/src/crypto/records.d.ts +316 -0
  111. package/dist/src/crypto/records.js +157 -0
  112. package/dist/src/crypto/scope.d.ts +49 -0
  113. package/dist/src/crypto/scope.js +83 -0
  114. package/dist/src/crypto/ssh.d.ts +171 -0
  115. package/dist/src/crypto/ssh.js +396 -0
  116. package/dist/src/crypto/submission.d.ts +33 -0
  117. package/dist/src/crypto/submission.js +47 -0
  118. package/dist/src/crypto/trust-roots.d.ts +29 -0
  119. package/dist/src/crypto/trust-roots.js +39 -0
  120. package/dist/src/crypto/verify-consumed.d.ts +67 -0
  121. package/dist/src/crypto/verify-consumed.js +259 -0
  122. package/dist/src/crypto/verify-origin.d.ts +50 -0
  123. package/dist/src/crypto/verify-origin.js +151 -0
  124. package/dist/src/crypto/verify-publication.d.ts +60 -0
  125. package/dist/src/crypto/verify-publication.js +150 -0
  126. package/dist/src/defs.d.ts +24 -1
  127. package/dist/src/defs.js +145 -25
  128. package/dist/src/engine.d.ts +99 -3
  129. package/dist/src/engine.js +238 -34
  130. package/dist/src/factory.d.ts +16 -0
  131. package/dist/src/factory.js +16 -4
  132. package/dist/src/global-config.d.ts +59 -0
  133. package/dist/src/global-config.js +84 -0
  134. package/dist/src/hub.d.ts +75 -21
  135. package/dist/src/hub.js +123 -40
  136. package/dist/src/index.d.ts +17 -2
  137. package/dist/src/index.js +20 -2
  138. package/dist/src/install.d.ts +538 -0
  139. package/dist/src/install.js +1981 -0
  140. package/dist/src/lock.d.ts +15 -57
  141. package/dist/src/lock.js +251 -143
  142. package/dist/src/mcp/serve.d.ts +46 -22
  143. package/dist/src/mcp/serve.js +167 -44
  144. package/dist/src/mcp/server.js +12 -1
  145. package/dist/src/model.d.ts +15 -0
  146. package/dist/src/model.js +111 -1
  147. package/dist/src/order-resolver.d.ts +184 -0
  148. package/dist/src/order-resolver.js +252 -0
  149. package/dist/src/package-version.d.ts +10 -0
  150. package/dist/src/package-version.js +42 -0
  151. package/dist/src/paths.d.ts +14 -1
  152. package/dist/src/paths.js +18 -0
  153. package/dist/src/schemas/enrollment-grant.v1.schema.json +90 -0
  154. package/dist/src/schemas/index.d.ts +1416 -0
  155. package/dist/src/schemas/index.js +31 -0
  156. package/dist/src/schemas/order.v1.schema.json +106 -0
  157. package/dist/src/schemas/origin.v1.schema.json +68 -0
  158. package/dist/src/schemas/policy-floor.v1.schema.json +29 -0
  159. package/dist/src/schemas/publication.v1.schema.json +31 -0
  160. package/dist/src/schemas/revocation.v1.schema.json +39 -0
  161. package/dist/src/schemas/submission.v1.schema.json +61 -0
  162. package/dist/src/store/def-source.d.ts +52 -0
  163. package/dist/src/store/def-source.js +335 -0
  164. package/dist/src/store/index-file.d.ts +69 -0
  165. package/dist/src/store/index-file.js +151 -0
  166. package/dist/src/store/index.d.ts +27 -0
  167. package/dist/src/store/index.js +22 -0
  168. package/dist/src/store/ingestor.d.ts +43 -0
  169. package/dist/src/store/ingestor.js +211 -0
  170. package/dist/src/store/install.d.ts +228 -0
  171. package/dist/src/store/install.js +555 -0
  172. package/dist/src/store/instruction-source.d.ts +49 -0
  173. package/dist/src/store/instruction-source.js +298 -0
  174. package/dist/src/store/origin-evidence.d.ts +21 -0
  175. package/dist/src/store/origin-evidence.js +66 -0
  176. package/dist/src/store/pre-commit-verifier.d.ts +68 -0
  177. package/dist/src/store/pre-commit-verifier.js +418 -0
  178. package/dist/src/store/resolve.d.ts +138 -0
  179. package/dist/src/store/resolve.js +363 -0
  180. package/dist/src/store/types.d.ts +288 -0
  181. package/dist/src/store/types.js +356 -0
  182. package/dist/src/types.d.ts +45 -11
  183. package/dist/src/untar.d.ts +8 -23
  184. package/dist/src/untar.js +10 -136
  185. package/docs/agent-runner.md +86 -0
  186. package/docs/authoring.md +57 -6
  187. package/docs/bundles.md +250 -0
  188. package/docs/cli.md +1171 -97
  189. package/docs/crypto.md +816 -0
  190. package/docs/design.md +342 -20
  191. package/docs/embedding.md +132 -25
  192. package/docs/wire-contracts.md +380 -0
  193. package/package.json +6 -1
  194. package/plugins/claude-code/.claude-plugin/marketplace.json +14 -0
  195. package/plugins/claude-code/plugin/.claude-plugin/plugin.json +8 -0
  196. package/plugins/claude-code/plugin/.mcp.json +14 -0
  197. package/plugins/claude-code/plugin/hooks/hooks.json +26 -0
  198. package/plugins/claude-code/plugin/hooks/session-end.sh +40 -0
  199. package/plugins/claude-code/plugin/hooks/session-start.sh +52 -0
  200. package/plugins/claude-code/plugin/skills/author/SKILL.md +181 -0
  201. package/plugins/claude-code/plugin/skills/conduct/SKILL.md +106 -0
  202. package/plugins/claude-code/plugin/skills/shift/SKILL.md +105 -0
  203. package/plugins/codex/.agents/plugins/marketplace.json +21 -0
  204. package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +7 -0
  205. package/plugins/codex/plugins/owenloop/.mcp.json +20 -0
  206. package/plugins/codex/plugins/owenloop/hooks/hooks.json +26 -0
  207. package/plugins/codex/plugins/owenloop/hooks/session-end.sh +40 -0
  208. package/plugins/codex/plugins/owenloop/hooks/session-start.sh +52 -0
  209. package/plugins/codex/plugins/owenloop/skills/author/SKILL.md +181 -0
  210. package/plugins/codex/plugins/owenloop/skills/conduct/SKILL.md +106 -0
  211. package/plugins/codex/plugins/owenloop/skills/shift/SKILL.md +105 -0
package/dist/src/hub.d.ts CHANGED
@@ -87,6 +87,16 @@
87
87
  * still recognizes byte-identical content and replies `unchanged: true`.
88
88
  */
89
89
  export declare function hashDefForHub(yaml: string): string;
90
+ /**
91
+ * The production hub. The sole fallback rung for every hub-resolution ladder
92
+ * in this package that has one (`src/cli.ts`'s `resolveHub` and
93
+ * `resolveSetupHub`, `src/mcp/serve.ts`'s `resolveMcpOrigin`) — there must be
94
+ * exactly one literal `'https://api.owenloop.com'` in `src/`, and this is it.
95
+ * `resolveAgentHub` (`src/cli.ts`) deliberately has NO fallback to this
96
+ * constant: it mints credentials, and silently minting on the wrong org is
97
+ * not undone by a retry.
98
+ */
99
+ export declare const DEFAULT_HUB = "https://api.owenloop.com";
90
100
  /**
91
101
  * Normalize a hub URL to a bare origin (`scheme://host[:port]`), stripping any
92
102
  * path, query, trailing slash, and fragment. Requires an http(s) scheme. This
@@ -276,12 +286,32 @@ export interface Keychain {
276
286
  set(service: string, account: string, value: string): void;
277
287
  delete(service: string, account: string): void;
278
288
  }
289
+ /** Minimal command seam for the macOS `security` adapter. */
290
+ export interface MacosSecurityCommand {
291
+ args: string[];
292
+ /** Secret-bearing command input. Never include this value in an error. */
293
+ input?: string;
294
+ captureStdout?: boolean;
295
+ }
296
+ export type MacosSecurityRunner = (command: MacosSecurityCommand) => string;
297
+ /**
298
+ * Build the macOS generic-password backend around an injectable `security`
299
+ * command runner. Status 44 (`errSecItemNotFound`) alone means absence. Every
300
+ * other exit, signal, or start failure is a stable, secret-free error.
301
+ */
302
+ export declare function macosKeychain(runner?: MacosSecurityRunner): Keychain;
303
+ /**
304
+ * Every locally available Keychain backend, independent of the ordinary-store
305
+ * override. Defensive logout uses this resolver so `OWENLOOP_NO_KEYCHAIN=1`
306
+ * cannot hide a credential that would become authoritative again when the
307
+ * override is removed. An injected backend remains available on every platform;
308
+ * otherwise only macOS has a platform backend.
309
+ */
310
+ export declare function resolveLocalKeychain(injected?: Keychain): Keychain | undefined;
279
311
  /**
280
- * The default macOS keychain backend (generic passwords under service
281
- * `owenloop:<origin>`, account = the credential slot). The secret is fed through
282
- * the `security -i` command stream on stdin, never as a `-w` argv value, so it
283
- * never appears in `ps`/shell history. Returns `undefined` off macOS or when
284
- * `OWENLOOP_NO_KEYCHAIN=1`, so callers fall back to the 0600 credential file.
312
+ * The default Keychain selected for ordinary reads and writes. Returns
313
+ * `undefined` off macOS or when `OWENLOOP_NO_KEYCHAIN=1` selects the 0600 file
314
+ * store. Logout deliberately uses `resolveLocalKeychain` instead.
285
315
  */
286
316
  export declare function defaultKeychain(env: Record<string, string | undefined>): Keychain | undefined;
287
317
  /**
@@ -380,24 +410,48 @@ export type ReadStoredCredentialOpts = CredentialSlotSelector & {
380
410
  * never `process.env` directly, so a caller passing `opts.env` stays hermetic;
381
411
  * only the top-level default falls back to `process.env`.
382
412
  *
383
- * **When `OWENLOOP_CREDENTIAL_COMMAND` is configured this function can THROW
384
- * instead of returning `null`**, and it does not consult a store at all. The
385
- * command is authoritative, so a nonzero exit, a timeout, empty output, or
386
- * output that is not a well-formed credential is a loud error naming the origin
387
- * and the slot — never a silent fallthrough to a stale local entry. See
388
- * `runCredentialCommand`. When it is NOT configured, behaviour is exactly what
389
- * it has always been.
413
+ * **An authoritative backend failure throws instead of returning `null`.** For
414
+ * `OWENLOOP_CREDENTIAL_COMMAND`, a nonzero exit, timeout, empty output, or
415
+ * malformed credential is a loud error naming the origin and slot. For the
416
+ * macOS Keychain, every `security` failure except status 44 is a stable,
417
+ * secret-free error. Neither backend falls through to a stale file entry.
390
418
  */
391
419
  export declare function readStoredCredential(origin: string, opts: ReadStoredCredentialOpts): Credential | null;
392
420
  /**
393
421
  * Enumerate the hub origins that have a usable `human` credential stored, or
394
422
  * `null` when the active backend cannot be enumerated.
395
423
  *
396
- * Consumer: `owenloop mcp`'s origin inference (`resolveMcpOrigin` in
397
- * `src/mcp/serve.ts`). When the host spawns the server with neither `--hub` nor
398
- * `OWENLOOP_HUB`, the server tries to infer the single hub the user is logged
399
- * in to. That inference is only sound on the FILE backend, which can list its
400
- * `hubs` map; the keychain and external-command backends cannot enumerate:
424
+ * Callers in `src/cli.ts` share a backend-aware discovery layer, while
425
+ * `src/mcp/serve.ts` consumes this fact directly. Their policies deliberately
426
+ * differ, turning the same three possible results (`null`, `[]`, length>1)
427
+ * into different outcomes:
428
+ *
429
+ * - `resolveAgentHub` (`agent new`, `capability bind|unbind|list`, and
430
+ * `crew`'s subcommands) — mutating, mint-like commands. Every non-single
431
+ * result (`null`, `[]`, or length>1) is an immediate `CliError` (exit 2)
432
+ * naming `--hub <origin>` as the fix. There is no `DEFAULT_HUB` fallback
433
+ * here at all: silently minting against the production hub while the
434
+ * operator is logged into a dev hub would mint on the wrong org, and a mint
435
+ * is not undone by a retry.
436
+ * - `resolveSetupHub` (`setup`, `doctor`) — `null` or `[]` fall back to
437
+ * `DEFAULT_HUB` with a printed notice so the operator can see what
438
+ * happened; length>1 is still a `CliError` (exit 2) naming the origins,
439
+ * because guessing among several logged-in hubs would be silently wrong for
440
+ * someone who has more than one.
441
+ * - `resolvePublishingHub` (`connect`, `push`, `publish`) — one file-backed
442
+ * origin is the global fallback; more than one or none is an exit-2 error.
443
+ * For `null`, and only for `null`, this policy may use the validated
444
+ * execution-settings `hubOrigin` after checking the requested credential
445
+ * slot. It never guesses `DEFAULT_HUB`.
446
+ * - `resolveMcpOrigin` (`owenloop mcp`'s origin ladder) — the most lenient:
447
+ * this is rung 4 of 5, tried only after `--hub`, `OWENLOOP_HUB`, and
448
+ * `~/.owenloop/config.json` have all had nothing to offer. `null`, `[]`,
449
+ * and length>1 are ALL just "this rung has nothing to offer either" and
450
+ * fall through silently to rung 5 (`DEFAULT_HUB`) — there is no error path
451
+ * left to reach from here.
452
+ *
453
+ * The backend determines whether enumeration is even possible in the first
454
+ * place, independent of which of the three callers is asking:
401
455
  *
402
456
  * - **file** → the origins in `readCredentialFile(credentialFilePath(env)).hubs`
403
457
  * whose `human` slot parses as a well-formed `Credential` (`parseCredential`).
@@ -412,10 +466,10 @@ export declare function readStoredCredential(origin: string, opts: ReadStoredCre
412
466
  * - **external** → `null`, for the same reason: the command answers a single
413
467
  * `(origin, slot)` query; it has no listing contract.
414
468
  *
415
- * `null` (cannot enumerate), `[]` (nothing stored), and a length>1 result are
416
- * all distinct signals the caller turns into tailored exit-2 messages — this
417
- * function reports the fact, it never decides the outcome. It never logs or
418
- * echoes any credential; only the origin KEYS (never secrets) are returned.
469
+ * This function only reports the fact (and the backend-level reason behind
470
+ * it); it never decides the outcome — that is each caller's job, per the list
471
+ * above. It never logs or echoes any credential; only the origin KEYS (never
472
+ * secrets) are returned.
419
473
  *
420
474
  * `env`/`keychain` are threaded exactly as `readStoredCredential` threads them,
421
475
  * so a caller passing a fixture `env` stays hermetic.
package/dist/src/hub.js CHANGED
@@ -111,6 +111,16 @@ export function hashDefForHub(yaml) {
111
111
  * and cheap to widen later (a two-way door).
112
112
  */
113
113
  const LOOPBACK_HOSTS = new Set(['localhost', '127.0.0.1', '[::1]']);
114
+ /**
115
+ * The production hub. The sole fallback rung for every hub-resolution ladder
116
+ * in this package that has one (`src/cli.ts`'s `resolveHub` and
117
+ * `resolveSetupHub`, `src/mcp/serve.ts`'s `resolveMcpOrigin`) — there must be
118
+ * exactly one literal `'https://api.owenloop.com'` in `src/`, and this is it.
119
+ * `resolveAgentHub` (`src/cli.ts`) deliberately has NO fallback to this
120
+ * constant: it mints credentials, and silently minting on the wrong org is
121
+ * not undone by a retry.
122
+ */
123
+ export const DEFAULT_HUB = 'https://api.owenloop.com';
114
124
  /**
115
125
  * Normalize a hub URL to a bare origin (`scheme://host[:port]`), stripping any
116
126
  * path, query, trailing slash, and fragment. Requires an http(s) scheme. This
@@ -360,52 +370,101 @@ export function writeCredentialFile(path, file) {
360
370
  chmodSync(dir, 0o700);
361
371
  writeFileAtomic(path, `${JSON.stringify(file, null, 2)}\n`, { mode: 0o600 });
362
372
  }
373
+ const runMacosSecurity = (command) => {
374
+ if (command.captureStdout === true) {
375
+ return execFileSync('security', command.args, {
376
+ encoding: 'utf8',
377
+ stdio: ['ignore', 'pipe', 'ignore'],
378
+ });
379
+ }
380
+ execFileSync('security', command.args, {
381
+ ...(command.input === undefined ? {} : { input: command.input }),
382
+ stdio: command.input === undefined ? 'ignore' : ['pipe', 'ignore', 'ignore'],
383
+ });
384
+ return '';
385
+ };
386
+ function macosSecurityFailure(operation, error) {
387
+ const detail = error;
388
+ if (typeof detail.status === 'number') {
389
+ throw new Error(`macOS Keychain ${operation} failed: security exited with status ${detail.status}`);
390
+ }
391
+ if (typeof detail.signal === 'string') {
392
+ throw new Error(`macOS Keychain ${operation} failed: security terminated by signal ${detail.signal}`);
393
+ }
394
+ const code = typeof detail.code === 'string' ? detail.code : 'unknown error';
395
+ throw new Error(`macOS Keychain ${operation} failed: security could not be run (${code})`);
396
+ }
363
397
  /**
364
- * The default macOS keychain backend (generic passwords under service
365
- * `owenloop:<origin>`, account = the credential slot). The secret is fed through
366
- * the `security -i` command stream on stdin, never as a `-w` argv value, so it
367
- * never appears in `ps`/shell history. Returns `undefined` off macOS or when
368
- * `OWENLOOP_NO_KEYCHAIN=1`, so callers fall back to the 0600 credential file.
398
+ * Build the macOS generic-password backend around an injectable `security`
399
+ * command runner. Status 44 (`errSecItemNotFound`) alone means absence. Every
400
+ * other exit, signal, or start failure is a stable, secret-free error.
369
401
  */
370
- export function defaultKeychain(env) {
371
- if (env.OWENLOOP_NO_KEYCHAIN === '1')
372
- return undefined;
373
- if (process.platform !== 'darwin')
374
- return undefined;
402
+ export function macosKeychain(runner = runMacosSecurity) {
375
403
  return {
376
404
  get(service, account) {
377
405
  try {
378
- const out = execFileSync('security', ['find-generic-password', '-s', service, '-a', account, '-w'], {
379
- encoding: 'utf8',
380
- stdio: ['ignore', 'pipe', 'ignore'],
406
+ const out = runner({
407
+ args: ['find-generic-password', '-s', service, '-a', account, '-w'],
408
+ captureStdout: true,
381
409
  });
382
410
  return out.replace(/\n$/, '');
383
411
  }
384
- catch {
385
- return null; // not found (errSecItemNotFound) — treated as "no credential"
412
+ catch (error) {
413
+ if (error.status === 44)
414
+ return null;
415
+ return macosSecurityFailure('lookup', error);
386
416
  }
387
417
  },
388
418
  set(service, account, value) {
389
419
  // `security -i` reads newline-terminated commands from stdin; the secret
390
420
  // rides in that stdin stream (single-quoted), never on this process's argv.
391
- // The service string now carries `:` and `//` — inert for `security`, but
392
- // the single-quote escaping stays as the general guard it always was.
393
- const sq = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
421
+ // `security -i` treats `\` as an escape character even inside single
422
+ // quotes, so backslashes are doubled before quote escaping.
423
+ const sq = (s) => `'${s.replace(/\\/g, '\\\\').replace(/'/g, `'\\''`)}'`;
394
424
  const cmd = `add-generic-password -U -s ${sq(service)} -a ${sq(account)} -w ${sq(value)}\n`;
395
- execFileSync('security', ['-i'], { input: cmd, stdio: ['pipe', 'ignore', 'ignore'] });
425
+ try {
426
+ runner({ args: ['-i'], input: cmd });
427
+ }
428
+ catch (error) {
429
+ return macosSecurityFailure('write', error);
430
+ }
396
431
  },
397
432
  delete(service, account) {
398
433
  try {
399
- execFileSync('security', ['delete-generic-password', '-s', service, '-a', account], {
400
- stdio: 'ignore',
401
- });
434
+ runner({ args: ['delete-generic-password', '-s', service, '-a', account] });
402
435
  }
403
- catch {
404
- // Not found — already absent; a no-op delete is success.
436
+ catch (error) {
437
+ if (error.status === 44)
438
+ return;
439
+ return macosSecurityFailure('delete', error);
405
440
  }
406
441
  },
407
442
  };
408
443
  }
444
+ /**
445
+ * Every locally available Keychain backend, independent of the ordinary-store
446
+ * override. Defensive logout uses this resolver so `OWENLOOP_NO_KEYCHAIN=1`
447
+ * cannot hide a credential that would become authoritative again when the
448
+ * override is removed. An injected backend remains available on every platform;
449
+ * otherwise only macOS has a platform backend.
450
+ */
451
+ export function resolveLocalKeychain(injected) {
452
+ if (injected !== undefined)
453
+ return injected;
454
+ if (process.platform !== 'darwin')
455
+ return undefined;
456
+ return macosKeychain();
457
+ }
458
+ /**
459
+ * The default Keychain selected for ordinary reads and writes. Returns
460
+ * `undefined` off macOS or when `OWENLOOP_NO_KEYCHAIN=1` selects the 0600 file
461
+ * store. Logout deliberately uses `resolveLocalKeychain` instead.
462
+ */
463
+ export function defaultKeychain(env) {
464
+ if (env.OWENLOOP_NO_KEYCHAIN === '1')
465
+ return undefined;
466
+ return resolveLocalKeychain();
467
+ }
409
468
  /**
410
469
  * The configured external credential command, or `undefined` when it is unset
411
470
  * or blank.
@@ -575,13 +634,11 @@ export function credentialBackend(env, injected) {
575
634
  * never `process.env` directly, so a caller passing `opts.env` stays hermetic;
576
635
  * only the top-level default falls back to `process.env`.
577
636
  *
578
- * **When `OWENLOOP_CREDENTIAL_COMMAND` is configured this function can THROW
579
- * instead of returning `null`**, and it does not consult a store at all. The
580
- * command is authoritative, so a nonzero exit, a timeout, empty output, or
581
- * output that is not a well-formed credential is a loud error naming the origin
582
- * and the slot — never a silent fallthrough to a stale local entry. See
583
- * `runCredentialCommand`. When it is NOT configured, behaviour is exactly what
584
- * it has always been.
637
+ * **An authoritative backend failure throws instead of returning `null`.** For
638
+ * `OWENLOOP_CREDENTIAL_COMMAND`, a nonzero exit, timeout, empty output, or
639
+ * malformed credential is a loud error naming the origin and slot. For the
640
+ * macOS Keychain, every `security` failure except status 44 is a stable,
641
+ * secret-free error. Neither backend falls through to a stale file entry.
585
642
  */
586
643
  export function readStoredCredential(origin, opts) {
587
644
  const env = opts.env ?? process.env;
@@ -614,11 +671,37 @@ export function readStoredCredential(origin, opts) {
614
671
  * Enumerate the hub origins that have a usable `human` credential stored, or
615
672
  * `null` when the active backend cannot be enumerated.
616
673
  *
617
- * Consumer: `owenloop mcp`'s origin inference (`resolveMcpOrigin` in
618
- * `src/mcp/serve.ts`). When the host spawns the server with neither `--hub` nor
619
- * `OWENLOOP_HUB`, the server tries to infer the single hub the user is logged
620
- * in to. That inference is only sound on the FILE backend, which can list its
621
- * `hubs` map; the keychain and external-command backends cannot enumerate:
674
+ * Callers in `src/cli.ts` share a backend-aware discovery layer, while
675
+ * `src/mcp/serve.ts` consumes this fact directly. Their policies deliberately
676
+ * differ, turning the same three possible results (`null`, `[]`, length>1)
677
+ * into different outcomes:
678
+ *
679
+ * - `resolveAgentHub` (`agent new`, `capability bind|unbind|list`, and
680
+ * `crew`'s subcommands) — mutating, mint-like commands. Every non-single
681
+ * result (`null`, `[]`, or length>1) is an immediate `CliError` (exit 2)
682
+ * naming `--hub <origin>` as the fix. There is no `DEFAULT_HUB` fallback
683
+ * here at all: silently minting against the production hub while the
684
+ * operator is logged into a dev hub would mint on the wrong org, and a mint
685
+ * is not undone by a retry.
686
+ * - `resolveSetupHub` (`setup`, `doctor`) — `null` or `[]` fall back to
687
+ * `DEFAULT_HUB` with a printed notice so the operator can see what
688
+ * happened; length>1 is still a `CliError` (exit 2) naming the origins,
689
+ * because guessing among several logged-in hubs would be silently wrong for
690
+ * someone who has more than one.
691
+ * - `resolvePublishingHub` (`connect`, `push`, `publish`) — one file-backed
692
+ * origin is the global fallback; more than one or none is an exit-2 error.
693
+ * For `null`, and only for `null`, this policy may use the validated
694
+ * execution-settings `hubOrigin` after checking the requested credential
695
+ * slot. It never guesses `DEFAULT_HUB`.
696
+ * - `resolveMcpOrigin` (`owenloop mcp`'s origin ladder) — the most lenient:
697
+ * this is rung 4 of 5, tried only after `--hub`, `OWENLOOP_HUB`, and
698
+ * `~/.owenloop/config.json` have all had nothing to offer. `null`, `[]`,
699
+ * and length>1 are ALL just "this rung has nothing to offer either" and
700
+ * fall through silently to rung 5 (`DEFAULT_HUB`) — there is no error path
701
+ * left to reach from here.
702
+ *
703
+ * The backend determines whether enumeration is even possible in the first
704
+ * place, independent of which of the three callers is asking:
622
705
  *
623
706
  * - **file** → the origins in `readCredentialFile(credentialFilePath(env)).hubs`
624
707
  * whose `human` slot parses as a well-formed `Credential` (`parseCredential`).
@@ -633,10 +716,10 @@ export function readStoredCredential(origin, opts) {
633
716
  * - **external** → `null`, for the same reason: the command answers a single
634
717
  * `(origin, slot)` query; it has no listing contract.
635
718
  *
636
- * `null` (cannot enumerate), `[]` (nothing stored), and a length>1 result are
637
- * all distinct signals the caller turns into tailored exit-2 messages — this
638
- * function reports the fact, it never decides the outcome. It never logs or
639
- * echoes any credential; only the origin KEYS (never secrets) are returned.
719
+ * This function only reports the fact (and the backend-level reason behind
720
+ * it); it never decides the outcome — that is each caller's job, per the list
721
+ * above. It never logs or echoes any credential; only the origin KEYS (never
722
+ * secrets) are returned.
640
723
  *
641
724
  * `env`/`keychain` are threaded exactly as `readStoredCredential` threads them,
642
725
  * so a caller passing a fixture `env` stays hermetic.
@@ -11,22 +11,37 @@
11
11
  * workflow definitions + a Step Agent that executes orders) layers a concrete
12
12
  * process — software delivery, research, triage — on top of it.
13
13
  */
14
- export { Engine } from './engine.ts';
14
+ export { CallsPinError, Engine } from './engine.ts';
15
15
  export type { CommitResult, CreateOpts, DefResolver, DeferredFiring, DeferredReason, EmitResult, EngineEvent, EngineListener, EngineWorkflowStatus, Order, ReapDetail, ReapReason, TickResult, } from './engine.ts';
16
16
  export { createEngine } from './factory.ts';
17
17
  export type { CreateEngineOpts, CreatedEngine } from './factory.ts';
18
+ export { createDefInstructionSource, defInstructionDigest, OrderResolver, substituteOrderVars, UnknownDefDigestError, UnknownInstructionError, } from './order-resolver.ts';
19
+ export type { OrderInstructionLookup, OrderInstructionRef, OrderInstructionSource, OrderRuntimeVars, ResolvedInstructionRecord, ResolvedInstructions, } from './order-resolver.ts';
18
20
  export { Store, openStore, StoreVersionError } from './store.ts';
19
21
  export type { ArtifactRow, RunRow, TaskRow, WorkflowRow } from './store.ts';
20
- export { buildDef, DefError, expandIncludes, finalizeDefs, hashDef, lintDef, loadDefFile, loadDefs, loadDefsRaw, parseDef, SUPPORTED_ENGINE_VERSION, validateDef } from './defs.ts';
22
+ export { defDigest, emptyWorkflowStoreIndex, globalStoreRoot, hardenObjectModes, installWorkflowBundle, inspectCasDefs, isDefDigest, loadCasDefs, objectDestRelPath, objectDirForDigest, parseWorkflowCoordinate, parseWorkflowStoreIndex, projectStoreRoot, probeObjectDir, probeStoreRoot, readWorkflowStoreIndex, recoverWorkflowStore, resolveWorkflowCoordinate, resolveWorkflowDigest, serializeWorkflowStoreIndex, storeIndexPath, workflowCoordinate, workflowStoreStatePaths, WORKFLOW_STORE_INDEX_VERSION, WorkflowStoreError, StoreIndexError, StoreDigestError, StoreCoordinateError, StoreAmbiguityError, StoreNotFoundError, StoreIntegrityError, StoreConflictError, StoreDefinitionVerificationError, StoreOriginPolicyError, StorePathError, BundleIngestorUnavailableError, PreCommitVerifierUnavailableError, createExecutionOriginVerifier, originEvidencePath, persistOriginEvidence, readOriginEvidence, } from './store/index.ts';
23
+ export type { BundleInstallResult, BundleIngestor, BundleSource, CasDefInspectionResult, CasDefRegistration, DefDigest, LoadCasDefsArgs, InstallWorkflowBundleArgs, PreCommitVerifier, ExecutionOriginVerifierInput, RecoverWorkflowStoreArgs, ResolvedWorkflowObject, ResolveWorkflowCoordinateArgs, ResolveWorkflowDigestArgs, ResolutionLevel, StoreLevel, WorkflowCoordinate, WorkflowStoreIndex, WorkflowStoreIndexEntry, WorkflowStoreStatePaths, } from './store/index.ts';
24
+ export { buildDef, DefError, expandIncludes, finalizeDefs, hashDef, lintDef, loadDefFile, loadDefs, loadDefsRaw, parseDef, resolveCallsTarget, SUPPORTED_ENGINE_VERSION, validateDef } from './defs.ts';
21
25
  export { credentialSlot, hashDefForHub, keychainServiceFor, normalizeOrigin, readStoredCredential } from './hub.ts';
22
26
  export type { Credential, CredentialSlotSelector, Keychain, ReadStoredCredentialOpts } from './hub.ts';
23
27
  export type { DefLoadFailure } from './defs.ts';
24
28
  export { deleteCredential, ensureFreshOAuth, storeCredential } from './credentials.ts';
25
29
  export type { CredentialIO } from './credentials.ts';
30
+ export { DSSE_SSH_NAMESPACE, DSSE_VERSION, DSSE_RECORD_PAYLOAD_TYPES, DsseEnvelopeError, isDsseRecordPayloadType, PAYLOAD_TYPE_ENROLLMENT_GRANT, PAYLOAD_TYPE_ORIGIN, PAYLOAD_TYPE_POLICY_FLOOR, PAYLOAD_TYPE_PUBLICATION, PAYLOAD_TYPE_REVOCATION, PAYLOAD_TYPE_SUBMISSION, PrincipalKeyManager, SshSigner, SshSignerError, assertEd25519PubText, assertKeyRef, canonicalKeyRef, createSshSigner, decodeBase64Strict, dsseSignEnrollmentGrant, dsseSignEnvelope, dsseSignOrigin, dsseSignPolicyFloor, dsseSignPublication, dsseSignRecord, dsseSignRevocation, dsseSignSubmission, dsseVerifyEnrollmentGrant, dsseVerifyEnvelope, dsseVerifyOrigin, dsseVerifyPolicyFloor, dsseVerifyPublication, dsseVerifyRecord, dsseVerifyRevocation, dsseVerifySubmission, encodeBase64, keyidFromBlob, keyRefHash, parseAllowedSigners, preAuthEncode, publicKeyDescriptor, allowedSignersPath, resolveAllowedSigners, resolveAllowedSignersFile, isDefPolicy, verifyOrigin, verifyOriginSidecar, verifyPublication, verifyPublicationSidecar, verifyConsumed, verifyConsumedArtifact, DEFAULT_MACHINE_SCOPE, buildEnrollmentGrant, verifyRosterEntry, validateEnrollmentChain, validateProducer, revocationTemporalConsistency, attenuate, axisPermits, delegationPermits, ORG_ROOT_SCOPE, scopePermits, loadRoster, loadRevocations, orgRootPrivateKeyPath, orgRootPublicKeyPath, resolveOrgRoot, revocationsDir, rosterDir, ENROLLMENT_GRANT_FIELDS, ENROLLMENT_KEY_FIELDS, GRANT_DELEGATION_ALLOWED_FIELDS, GRANT_DELEGATION_DENIED_FIELDS, GRANT_SCOPE_FIELDS, ORDER_FIELDS, ORDER_OWED_FIELDS, ORDER_REASON_FIELDS, ORIGIN_FIELDS, ORIGIN_SOURCE_AGENT_FIELDS, ORIGIN_SOURCE_CONSOLE_FIELDS, ORIGIN_SOURCE_GIT_FIELDS, POLICY_FLOOR_FIELDS, POLICY_FLOOR_RECORD_FIELDS, PRINCIPAL_REFERENCE_FIELDS, PUBLICATION_FIELDS, RECORD_PAYLOAD_TYPES, REVOCATION_FIELDS, SUBMISSION_FIELDS, SUBMISSION_PRODUCED_FIELDS, } from './crypto/index.ts';
31
+ export type { AllowedSignerEntry, AllowedSignerOptions, AllowedSignersFile, AllowedSignersParseError, AllowedSignersResolution, AllowedSignersPresent, AllowedSignersAbsent, DefPolicy, DefVerdict, OriginVerdict, VerifyOriginInput, VerifyOriginOptions, ConsumedVerdict, VerifyConsumedInput, VerifyConsumedOptions, VerifyPublicationInput, VerifyPublicationOptions, BuildEnrollmentGrantArgs, EnrollmentChainValidator, RosterVerdict, VerifyRosterEntryInput, VerifyRosterEntryOptions, ChainInput, ChainOptions, ChainVerdict, ScopeAxis, OrgRootAbsent, OrgRootPresent, OrgRootResolution, DetachedSignature, DsseEnvelope, DsseRecordPayloadType, DsseSignature, DsseVerifyResult, EnsureKeyResult, InspectKeyResult, KeyStorageBackendKind, PrincipalKeyRef, PrincipalKind, PublicKeyDescriptor, EnrollmentGrantRecord, EnrollmentKeyDescriptor, FieldManifest, GrantDelegation, GrantDelegationAllowed, GrantDelegationDenied, GrantScope, OptionalKeys, OriginRecord, OriginSource, OriginSourceAgent, OriginSourceConsole, OriginSourceGit, PolicyFloor, PolicyFloorRecord, PrincipalReference, PublicationRecord, RequiredKeys, RevocationRecord, SubmissionProducedArtifact, SubmissionRecord, Signer, SshProcessAdapter, SshSignerConfig, VerifiedSignature, } from './crypto/index.ts';
32
+ export { DEF_POLICY_RANK, POLICY_FLOOR_PRESETS, artifactPolicyMinimum, floorDefPolicyMinimum, mergePolicyFloorWithLocal, originRulesMinimum, policyFloorGaps, stricterDefPolicy, verifyPolicyFloorRecord, } from './crypto/index.ts';
33
+ export type { PolicyFloorGap, PolicyFloorMergeResult, PolicyFloorVerdict, VerifyPolicyFloorInput, VerifyPolicyFloorOptions, } from './crypto/index.ts';
34
+ export { ORIGIN_SOURCE_RANK, OriginRulesError, evaluateOriginRule, matchOriginRule, parseOriginRules, } from './crypto/index.ts';
35
+ export type { OriginPolicy, OriginRuleEvaluation, OriginRuleMatch, OriginRuleValue, OriginRules, } from './crypto/index.ts';
26
36
  export { buildGraph, buildTrace, eligibleFirings, graphToDot, graphToMermaid, isStalled, modelCheck, workflowStatus, } from './model.ts';
27
37
  export type { ArtifactMap, Blocker, Firing, TimeFacts, WorkflowStatus } from './model.ts';
28
38
  export { parseConsume, parseProduce, } from './paths.ts';
29
39
  export { assertValidSchema, summarizeIssues, validateValue } from './schema.ts';
30
40
  export type { SchemaCheck, SchemaIssue } from './schema.ts';
41
+ export { enrollmentGrantSchema, orderSchema, originSchema, policyFloorSchema, publicationSchema, RECORD_SCHEMAS, revocationSchema, SCHEMA_BY_PAYLOAD_TYPE, submissionSchema, WIRE_SCHEMAS, } from './schemas/index.ts';
42
+ export { BundleError, DEFAULT_BUNDLE_LIMITS, digestBundle, inspectBundle, packBundle, unpackBundle } from './bundle/index.ts';
43
+ export type { BundleEntryInfo, BundleErrorCode, BundleLimits, BundleManifest, BundleRuntimeRequirements, InspectOptions, InspectResult, PackOptions, PackResult, } from './bundle/index.ts';
31
44
  export { DEBT_STATES, SETTLED_STATES } from './types.ts';
32
45
  export type { Acceptance, ArtifactBiography, ArtifactData, Author, CheckFinding, CheckOptions, CheckReport, CheckStep, ConsumePattern, FiringTrigger, Fingerprint, GraphEdge, GraphNode, GraphNodeState, InputDef, InvariantDef, InvariantPredicate, InvariantViolation, JsonSchema, StepDef, ProducePattern, ReasonEntry, RejectKind, RunData, TaskData, TimelineEvent, WorkflowDef, WorkflowGraph, WorkflowTrace, } from './types.ts';
46
+ export { canonicalValueBytes, valueDigestHex, buildSubmissionRecord, signSubmission } from './crypto/index.ts';
47
+ export type { BuildSubmissionRecordInput, SubmissionProducedInput } from './crypto/index.ts';
package/dist/src/index.js CHANGED
@@ -11,13 +11,31 @@
11
11
  * workflow definitions + a Step Agent that executes orders) layers a concrete
12
12
  * process — software delivery, research, triage — on top of it.
13
13
  */
14
- export { Engine } from "./engine.js";
14
+ export { CallsPinError, Engine } from "./engine.js";
15
15
  export { createEngine } from "./factory.js";
16
+ export { createDefInstructionSource, defInstructionDigest, OrderResolver, substituteOrderVars, UnknownDefDigestError, UnknownInstructionError, } from "./order-resolver.js";
16
17
  export { Store, openStore, StoreVersionError } from "./store.js";
17
- export { buildDef, DefError, expandIncludes, finalizeDefs, hashDef, lintDef, loadDefFile, loadDefs, loadDefsRaw, parseDef, SUPPORTED_ENGINE_VERSION, validateDef } from "./defs.js";
18
+ // The content-addressed WORKFLOW store (distinct from the SQLite runtime
19
+ // store above): two-level digest-addressed workflow objects + coordinate
20
+ // index, `.wnlp` bundle installation, and fail-closed resolution.
21
+ export { defDigest, emptyWorkflowStoreIndex, globalStoreRoot, hardenObjectModes, installWorkflowBundle, inspectCasDefs, isDefDigest, loadCasDefs, objectDestRelPath, objectDirForDigest, parseWorkflowCoordinate, parseWorkflowStoreIndex, projectStoreRoot, probeObjectDir, probeStoreRoot, readWorkflowStoreIndex, recoverWorkflowStore, resolveWorkflowCoordinate, resolveWorkflowDigest, serializeWorkflowStoreIndex, storeIndexPath, workflowCoordinate, workflowStoreStatePaths, WORKFLOW_STORE_INDEX_VERSION, WorkflowStoreError, StoreIndexError, StoreDigestError, StoreCoordinateError, StoreAmbiguityError, StoreNotFoundError, StoreIntegrityError, StoreConflictError, StoreDefinitionVerificationError, StoreOriginPolicyError, StorePathError, BundleIngestorUnavailableError, PreCommitVerifierUnavailableError, createExecutionOriginVerifier, originEvidencePath, persistOriginEvidence, readOriginEvidence, } from "./store/index.js";
22
+ export { buildDef, DefError, expandIncludes, finalizeDefs, hashDef, lintDef, loadDefFile, loadDefs, loadDefsRaw, parseDef, resolveCallsTarget, SUPPORTED_ENGINE_VERSION, validateDef } from "./defs.js";
18
23
  export { credentialSlot, hashDefForHub, keychainServiceFor, normalizeOrigin, readStoredCredential } from "./hub.js";
19
24
  export { deleteCredential, ensureFreshOAuth, storeCredential } from "./credentials.js";
25
+ export { DSSE_SSH_NAMESPACE, DSSE_VERSION, DSSE_RECORD_PAYLOAD_TYPES, DsseEnvelopeError, isDsseRecordPayloadType, PAYLOAD_TYPE_ENROLLMENT_GRANT, PAYLOAD_TYPE_ORIGIN, PAYLOAD_TYPE_POLICY_FLOOR, PAYLOAD_TYPE_PUBLICATION, PAYLOAD_TYPE_REVOCATION, PAYLOAD_TYPE_SUBMISSION, PrincipalKeyManager, SshSigner, SshSignerError, assertEd25519PubText, assertKeyRef, canonicalKeyRef, createSshSigner, decodeBase64Strict, dsseSignEnrollmentGrant, dsseSignEnvelope, dsseSignOrigin, dsseSignPolicyFloor, dsseSignPublication, dsseSignRecord, dsseSignRevocation, dsseSignSubmission, dsseVerifyEnrollmentGrant, dsseVerifyEnvelope, dsseVerifyOrigin, dsseVerifyPolicyFloor, dsseVerifyPublication, dsseVerifyRecord, dsseVerifyRevocation, dsseVerifySubmission, encodeBase64, keyidFromBlob, keyRefHash, parseAllowedSigners, preAuthEncode, publicKeyDescriptor, allowedSignersPath, resolveAllowedSigners, resolveAllowedSignersFile, isDefPolicy, verifyOrigin, verifyOriginSidecar, verifyPublication, verifyPublicationSidecar, verifyConsumed, verifyConsumedArtifact, DEFAULT_MACHINE_SCOPE, buildEnrollmentGrant, verifyRosterEntry, validateEnrollmentChain, validateProducer, revocationTemporalConsistency, attenuate, axisPermits, delegationPermits, ORG_ROOT_SCOPE, scopePermits, loadRoster, loadRevocations, orgRootPrivateKeyPath, orgRootPublicKeyPath, resolveOrgRoot, revocationsDir, rosterDir, ENROLLMENT_GRANT_FIELDS, ENROLLMENT_KEY_FIELDS, GRANT_DELEGATION_ALLOWED_FIELDS, GRANT_DELEGATION_DENIED_FIELDS, GRANT_SCOPE_FIELDS, ORDER_FIELDS, ORDER_OWED_FIELDS, ORDER_REASON_FIELDS, ORIGIN_FIELDS, ORIGIN_SOURCE_AGENT_FIELDS, ORIGIN_SOURCE_CONSOLE_FIELDS, ORIGIN_SOURCE_GIT_FIELDS, POLICY_FLOOR_FIELDS, POLICY_FLOOR_RECORD_FIELDS, PRINCIPAL_REFERENCE_FIELDS, PUBLICATION_FIELDS, RECORD_PAYLOAD_TYPES, REVOCATION_FIELDS, SUBMISSION_FIELDS, SUBMISSION_PRODUCED_FIELDS, } from "./crypto/index.js";
26
+ // ---- policy floors ----
27
+ export { DEF_POLICY_RANK, POLICY_FLOOR_PRESETS, artifactPolicyMinimum, floorDefPolicyMinimum, mergePolicyFloorWithLocal, originRulesMinimum, policyFloorGaps, stricterDefPolicy, verifyPolicyFloorRecord, } from "./crypto/index.js";
28
+ // ---- WP-E2a origin execution policy ----
29
+ export { ORIGIN_SOURCE_RANK, OriginRulesError, evaluateOriginRule, matchOriginRule, parseOriginRules, } from "./crypto/index.js";
20
30
  export { buildGraph, buildTrace, eligibleFirings, graphToDot, graphToMermaid, isStalled, modelCheck, workflowStatus, } from "./model.js";
21
31
  export { parseConsume, parseProduce, } from "./paths.js";
22
32
  export { assertValidSchema, summarizeIssues, validateValue } from "./schema.js";
33
+ export { enrollmentGrantSchema, orderSchema, originSchema, policyFloorSchema, publicationSchema, RECORD_SCHEMAS, revocationSchema, SCHEMA_BY_PAYLOAD_TYPE, submissionSchema, WIRE_SCHEMAS, } from "./schemas/index.js";
34
+ // Deterministic `.wnlp` bundle format (WP-A1) — the HIGH-LEVEL API only:
35
+ // pack/inspect/digest/unpack plus result/manifest types, limits/options, and
36
+ // typed errors. Low-level tar builders and add install primitives are
37
+ // deliberately NOT exported through this surface (see docs/bundles.md).
38
+ export { BundleError, DEFAULT_BUNDLE_LIMITS, digestBundle, inspectBundle, packBundle, unpackBundle } from "./bundle/index.js";
23
39
  export { DEBT_STATES, SETTLED_STATES } from "./types.js";
40
+ // ---- WP-D2 signed submission records ----
41
+ export { canonicalValueBytes, valueDigestHex, buildSubmissionRecord, signSubmission } from "./crypto/index.js";