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,61 @@
1
+ import { PrincipalKeyManager } from '../../../src/crypto/index.ts';
2
+ import type { SshProcessAdapter } from '../../../src/crypto/ssh.ts';
3
+ import type { OrderPacket } from './hub/types.ts';
4
+ export type SubmissionKeyManager = Pick<PrincipalKeyManager, 'inspect' | 'resolveRef' | 'withSigningKey'>;
5
+ export interface SubmitProofOptions {
6
+ origin: string;
7
+ order: OrderPacket;
8
+ path: string;
9
+ value: unknown;
10
+ /** Exact target version issued by a version-aware, retry-safe hub protocol. */
11
+ version?: number;
12
+ now: () => number;
13
+ warn: (line: string) => void;
14
+ principalKeys?: SubmissionKeyManager;
15
+ env?: Record<string, string | undefined>;
16
+ /** Injectable ssh-keygen seam for hermetic callers and tests. */
17
+ sshProcess?: SshProcessAdapter;
18
+ }
19
+ /**
20
+ * Sign one driver submit at the transport boundary. A missing machine key is
21
+ * deliberately an unsigned fallback for WP-D2; signer/tool failures still
22
+ * propagate because silently dropping a configured key would hide corruption.
23
+ */
24
+ export declare function buildSubmitProof(opts: SubmitProofOptions): Promise<string | undefined>;
25
+ /**
26
+ * Resolve the version named by the next submission from authoritative lifecycle
27
+ * metadata only — never from a process-local guess.
28
+ *
29
+ * Three sources, in precedence order:
30
+ *
31
+ * 1. `explicit` — a caller-supplied target, used verbatim.
32
+ * 2. A judge approval attests the already-submitted version captured in the
33
+ * claim fingerprint and does not increment it (the engine's judge-approve
34
+ * branch flips acceptance without bumping `version`).
35
+ * 3. A producer submit uses `owes[].version`, the target the hub issued for
36
+ * this owed output inside the claim transaction. It is the version the
37
+ * next successful commit lands, which is exactly what the consumer checks
38
+ * the proof against.
39
+ *
40
+ * Retry-safety comes from the hub, not from this function. The target is
41
+ * computed once inside the claim transaction and persisted with the immutable
42
+ * order, so every retry of the same claim — a reconnect, a lost response, a
43
+ * restarted holder — reads the same number. The engine's refusal paths that
44
+ * leave the run open (schema-reject) do not bump the artifact, so the target
45
+ * survives in-claim retries; a refinement is a NEW claim and therefore a newly
46
+ * issued target. If a target ever did go stale, the consumer's version check
47
+ * refuses the artifact. The failure mode is a refusal, never an admitted
48
+ * unverified value.
49
+ *
50
+ * A hub that projects no `owes[].version` (pre-version-aware) yields
51
+ * `undefined`, and the caller submits unsigned rather than signing a guess.
52
+ *
53
+ * A target is only authoritative when it is a positive integer: the smallest
54
+ * commit any producer can land is v1, so 0 (or anything non-integral) is not a
55
+ * target this protocol issued — it is a pre-target-semantics hub or a corrupt
56
+ * packet. Both are treated as absent metadata and submit unsigned, rather than
57
+ * signing a number the consumer is guaranteed to reject.
58
+ */
59
+ export declare function outputVersionForSubmission(order: OrderPacket, path: string, explicit?: number): number | undefined;
60
+ /** Reset the process-local warning latch for hermetic tests. */
61
+ export declare function resetSubmitProofWarningForTests(): void;
@@ -0,0 +1,119 @@
1
+ import { DSSE_SSH_NAMESPACE, PrincipalKeyManager, buildSubmissionRecord, createSshSigner, signSubmission, } from "../../../src/crypto/index.js";
2
+ let warnedUnsigned = false;
3
+ /**
4
+ * Sign one driver submit at the transport boundary. A missing machine key is
5
+ * deliberately an unsigned fallback for WP-D2; signer/tool failures still
6
+ * propagate because silently dropping a configured key would hide corruption.
7
+ */
8
+ export async function buildSubmitProof(opts) {
9
+ const version = outputVersionForSubmission(opts.order, opts.path, opts.version);
10
+ if (version === undefined) {
11
+ warnUnsigned(opts.warn, `order ${opts.order.workflow}/${opts.order.run} omitted authoritative version metadata for output '${opts.path}'; submitting without a proof`);
12
+ return undefined;
13
+ }
14
+ const consumedFingerprint = submissionFingerprint(opts.order, opts.warn);
15
+ if (consumedFingerprint === undefined)
16
+ return undefined;
17
+ let keys;
18
+ try {
19
+ keys = opts.principalKeys ?? new PrincipalKeyManager({ env: opts.env ?? process.env });
20
+ }
21
+ catch (error) {
22
+ warnUnsigned(opts.warn, `machine signing is unavailable (${errorMessage(error)}); submitting without a proof`);
23
+ return undefined;
24
+ }
25
+ const ref = keys.resolveRef(opts.origin, 'machine');
26
+ if (ref === null) {
27
+ warnUnsigned(opts.warn, `no machine signing key for ${opts.origin}; submitting without a proof`);
28
+ return undefined;
29
+ }
30
+ const inspected = await keys.inspect(ref);
31
+ if (!inspected.exists || inspected.publicKey === undefined) {
32
+ warnUnsigned(opts.warn, `machine signing key for ${opts.origin} is unavailable; submitting without a proof`);
33
+ return undefined;
34
+ }
35
+ const record = buildSubmissionRecord({
36
+ run: opts.order.run,
37
+ workflow: opts.order.workflow,
38
+ defDigest: opts.order.defDigest,
39
+ step: opts.order.step,
40
+ key: opts.order.key,
41
+ ...(opts.order.index !== undefined ? { index: opts.order.index } : {}),
42
+ produced: [{ artifact: opts.path, version, value: opts.value }],
43
+ consumedFingerprint,
44
+ producerKeyId: inspected.publicKey.keyid,
45
+ timestamp: opts.now(),
46
+ });
47
+ return keys.withSigningKey(ref, async (keyPath) => {
48
+ const signer = createSshSigner({
49
+ namespace: DSSE_SSH_NAMESPACE,
50
+ signKeyPath: keyPath,
51
+ ...(opts.sshProcess !== undefined ? { process: opts.sshProcess } : {}),
52
+ });
53
+ return signSubmission(record, signer);
54
+ });
55
+ }
56
+ function submissionFingerprint(order, warn) {
57
+ if (order.consumedFingerprint !== undefined)
58
+ return order.consumedFingerprint;
59
+ if (order.inputs.length > 0 || Object.keys(order.consumes).length > 0) {
60
+ warnUnsigned(warn, `order ${order.workflow}/${order.run} omitted its consumed fingerprint; submitting without a proof`);
61
+ return undefined;
62
+ }
63
+ return {};
64
+ }
65
+ /**
66
+ * Resolve the version named by the next submission from authoritative lifecycle
67
+ * metadata only — never from a process-local guess.
68
+ *
69
+ * Three sources, in precedence order:
70
+ *
71
+ * 1. `explicit` — a caller-supplied target, used verbatim.
72
+ * 2. A judge approval attests the already-submitted version captured in the
73
+ * claim fingerprint and does not increment it (the engine's judge-approve
74
+ * branch flips acceptance without bumping `version`).
75
+ * 3. A producer submit uses `owes[].version`, the target the hub issued for
76
+ * this owed output inside the claim transaction. It is the version the
77
+ * next successful commit lands, which is exactly what the consumer checks
78
+ * the proof against.
79
+ *
80
+ * Retry-safety comes from the hub, not from this function. The target is
81
+ * computed once inside the claim transaction and persisted with the immutable
82
+ * order, so every retry of the same claim — a reconnect, a lost response, a
83
+ * restarted holder — reads the same number. The engine's refusal paths that
84
+ * leave the run open (schema-reject) do not bump the artifact, so the target
85
+ * survives in-claim retries; a refinement is a NEW claim and therefore a newly
86
+ * issued target. If a target ever did go stale, the consumer's version check
87
+ * refuses the artifact. The failure mode is a refusal, never an admitted
88
+ * unverified value.
89
+ *
90
+ * A hub that projects no `owes[].version` (pre-version-aware) yields
91
+ * `undefined`, and the caller submits unsigned rather than signing a guess.
92
+ *
93
+ * A target is only authoritative when it is a positive integer: the smallest
94
+ * commit any producer can land is v1, so 0 (or anything non-integral) is not a
95
+ * target this protocol issued — it is a pre-target-semantics hub or a corrupt
96
+ * packet. Both are treated as absent metadata and submit unsigned, rather than
97
+ * signing a number the consumer is guaranteed to reject.
98
+ */
99
+ export function outputVersionForSubmission(order, path, explicit) {
100
+ if (explicit !== undefined)
101
+ return explicit;
102
+ if (order.judge === path)
103
+ return order.consumedFingerprint?.[path];
104
+ const target = order.owes?.find((owed) => owed.path === path)?.version;
105
+ return typeof target === 'number' && Number.isInteger(target) && target > 0 ? target : undefined;
106
+ }
107
+ function errorMessage(error) {
108
+ return error instanceof Error ? error.message : String(error);
109
+ }
110
+ function warnUnsigned(warn, reason) {
111
+ if (warnedUnsigned)
112
+ return;
113
+ warnedUnsigned = true;
114
+ warn(`owenloop: ${reason}`);
115
+ }
116
+ /** Reset the process-local warning latch for hermetic tests. */
117
+ export function resetSubmitProofWarningForTests() {
118
+ warnedUnsigned = false;
119
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Producer-side mirror of the hub's raw-string submit normalization.
3
+ *
4
+ * WHY THIS EXISTS — the proof-dropping bug it fixes:
5
+ *
6
+ * An agent may hand `submit` a JSON-encoded STRING instead of an object
7
+ * (`'{"prUrl":"…","number":145}'`). The hub accepts that as a documented
8
+ * fallback: `hub-core`'s `submitOutput` runs `normalizeSubmitValue` on it and
9
+ * stores the resulting OBJECT. But because the stored bytes are no longer the
10
+ * bytes the producer signed, the hub cannot claim the signature covers what it
11
+ * stored, so it drops the submission proof outright:
12
+ *
13
+ * const narrowedProof = typeof rawValue === 'string' ? undefined
14
+ * : narrowSubmitProof(proof);
15
+ *
16
+ * The drop is silent on both sides. The producer signed successfully and got no
17
+ * warning; the hub committed the artifact with no proof. A downstream COMMAND
18
+ * step consuming that artifact then refuses it forever (`hardRule: true`), and
19
+ * nothing in either log says why. Observed live: the delivery `pr` artifact
20
+ * committed unproven while `workspace` — produced by an `exec` step, which
21
+ * always submits an object receipt — carried its proof fine.
22
+ *
23
+ * THE FIX: normalize here, before signing and before sending, so the producer
24
+ * signs exactly the object the hub will store and the hub never takes its
25
+ * string branch. This function is a deliberate byte-for-byte mirror of
26
+ * `owenloop-service` `packages/hub-core/src/normalize-submit-value.ts`; the two
27
+ * must agree, because any divergence produces a signature over bytes the hub
28
+ * did not store, which the consumer then rejects.
29
+ *
30
+ * A string this function cannot normalize is passed through UNCHANGED to the
31
+ * hub, which rejects it with `artifact-normalization-failed` exactly as it does
32
+ * today. Refusing locally would invent a failure mode the protocol does not
33
+ * have and would hide the hub's own diagnostic text from the agent.
34
+ */
35
+ /**
36
+ * The value to sign and send for `raw`.
37
+ *
38
+ * Non-string input is returned as-is: only the string fallback triggers the
39
+ * hub's normalization, so only a string can desynchronize signed bytes from
40
+ * stored bytes.
41
+ *
42
+ * A string is repaired the way the hub repairs it — strip a surrounding
43
+ * ```json fence, escape bare control characters inside string literals, parse —
44
+ * and the parsed plain object is returned. Anything that fails to parse, or
45
+ * parses to a non-object (a bare number, an array, `null`), is returned as the
46
+ * original string so the hub renders its own verdict on it.
47
+ */
48
+ export declare function normalizeSubmitValue(raw: unknown): unknown;
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Producer-side mirror of the hub's raw-string submit normalization.
3
+ *
4
+ * WHY THIS EXISTS — the proof-dropping bug it fixes:
5
+ *
6
+ * An agent may hand `submit` a JSON-encoded STRING instead of an object
7
+ * (`'{"prUrl":"…","number":145}'`). The hub accepts that as a documented
8
+ * fallback: `hub-core`'s `submitOutput` runs `normalizeSubmitValue` on it and
9
+ * stores the resulting OBJECT. But because the stored bytes are no longer the
10
+ * bytes the producer signed, the hub cannot claim the signature covers what it
11
+ * stored, so it drops the submission proof outright:
12
+ *
13
+ * const narrowedProof = typeof rawValue === 'string' ? undefined
14
+ * : narrowSubmitProof(proof);
15
+ *
16
+ * The drop is silent on both sides. The producer signed successfully and got no
17
+ * warning; the hub committed the artifact with no proof. A downstream COMMAND
18
+ * step consuming that artifact then refuses it forever (`hardRule: true`), and
19
+ * nothing in either log says why. Observed live: the delivery `pr` artifact
20
+ * committed unproven while `workspace` — produced by an `exec` step, which
21
+ * always submits an object receipt — carried its proof fine.
22
+ *
23
+ * THE FIX: normalize here, before signing and before sending, so the producer
24
+ * signs exactly the object the hub will store and the hub never takes its
25
+ * string branch. This function is a deliberate byte-for-byte mirror of
26
+ * `owenloop-service` `packages/hub-core/src/normalize-submit-value.ts`; the two
27
+ * must agree, because any divergence produces a signature over bytes the hub
28
+ * did not store, which the consumer then rejects.
29
+ *
30
+ * A string this function cannot normalize is passed through UNCHANGED to the
31
+ * hub, which rejects it with `artifact-normalization-failed` exactly as it does
32
+ * today. Refusing locally would invent a failure mode the protocol does not
33
+ * have and would hide the hub's own diagnostic text from the agent.
34
+ */
35
+ const FENCE_RE = /^\s*```(?:json)?\s*\n?([\s\S]*?)\n?```\s*$/;
36
+ /**
37
+ * The value to sign and send for `raw`.
38
+ *
39
+ * Non-string input is returned as-is: only the string fallback triggers the
40
+ * hub's normalization, so only a string can desynchronize signed bytes from
41
+ * stored bytes.
42
+ *
43
+ * A string is repaired the way the hub repairs it — strip a surrounding
44
+ * ```json fence, escape bare control characters inside string literals, parse —
45
+ * and the parsed plain object is returned. Anything that fails to parse, or
46
+ * parses to a non-object (a bare number, an array, `null`), is returned as the
47
+ * original string so the hub renders its own verdict on it.
48
+ */
49
+ export function normalizeSubmitValue(raw) {
50
+ if (typeof raw !== 'string')
51
+ return raw;
52
+ const fenceMatch = FENCE_RE.exec(raw);
53
+ const stripped = fenceMatch ? fenceMatch[1] : raw;
54
+ let parsed;
55
+ try {
56
+ parsed = JSON.parse(stripped);
57
+ }
58
+ catch {
59
+ try {
60
+ parsed = JSON.parse(escapeBareControlCharsInStrings(stripped));
61
+ }
62
+ catch {
63
+ return raw;
64
+ }
65
+ }
66
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed))
67
+ return raw;
68
+ return parsed;
69
+ }
70
+ /**
71
+ * Escape bare newlines/carriage-returns/tabs that appear INSIDE JSON string
72
+ * literals — the "worker emitted a multi-line string value" failure mode. A
73
+ * single pass tracking whether we are inside a string literal (respecting `\"`
74
+ * escapes) is enough; structural whitespace between tokens is left alone
75
+ * because `JSON.parse` already tolerates it raw.
76
+ */
77
+ function escapeBareControlCharsInStrings(text) {
78
+ let out = '';
79
+ let inString = false;
80
+ let escaped = false;
81
+ for (const ch of text) {
82
+ if (inString) {
83
+ if (escaped) {
84
+ out += ch;
85
+ escaped = false;
86
+ continue;
87
+ }
88
+ if (ch === '\\') {
89
+ out += ch;
90
+ escaped = true;
91
+ continue;
92
+ }
93
+ if (ch === '"') {
94
+ out += ch;
95
+ inString = false;
96
+ continue;
97
+ }
98
+ if (ch === '\n') {
99
+ out += '\\n';
100
+ continue;
101
+ }
102
+ if (ch === '\r') {
103
+ out += '\\r';
104
+ continue;
105
+ }
106
+ if (ch === '\t') {
107
+ out += '\\t';
108
+ continue;
109
+ }
110
+ out += ch;
111
+ continue;
112
+ }
113
+ if (ch === '"')
114
+ inString = true;
115
+ out += ch;
116
+ }
117
+ return out;
118
+ }
@@ -3,4 +3,4 @@
3
3
  * exit 0) and on a dispatch error (to stderr, exit 2). Keeping it in one place
4
4
  * means the help output and the error output never drift apart.
5
5
  */
6
- export declare const USAGE = "owenloop work \u2014 execution-side CLI companion to owenloop\n\nUsage:\n owenloop work hold --order <id> [options] hold an order with a heartbeating lease\n owenloop work exec <order-id> [options] run a command order in a self-leasing loop\n owenloop work agent-run <order-id> [options] host an agent order's step agent in a\n harness, in a self-leasing loop\n owenloop work prepare <workflow> [--origin <url>]\n fetch, cache & normalize step specs\n owenloop work lint <workflow-name | path> lint x.harness option bags in a def\n owenloop work sessions [--all] [--json] list this machine's recorded harness\n sessions and how to re-open them\n owenloop work release --session <id> [options] drain a session's held claims\n owenloop work settings print the resolved settings file\n owenloop work join <code> [--hub <origin>] [--as <account>]\n redeem a join code and store the Scoped\n Identity credential (one-time provisioning)\n\nOptions:\n -h, --help show this help and exit 0\n --version print the owenloop work version and exit 0\n\n root shift options (run as owenloop shift start <crew...> | --all):\n <crew...> serve only these crews (positional, space\n separated); or --all for every crew on the key\n --all serve every crew on the key\n --origin <url> hub origin (else settings.hubOrigin)\n --as <account> Scoped Identity credential account to read + hand\n to dispatched holds/execs (default 'default')\n --name <n> Shift name (default <hostname>/<cwd>)\n --cap <n> max in-flight exec children (default 3)\n --poll-interval <ms> wake poll cadence (default 5000)\n --once bootstrap wake + one sweep, then exit (demo/e2e)\n --max-agents <n> max in-flight agent-run children, separate from\n --cap (default 4; else settings.maxConcurrentAgents)\n --cache-dir/--state-dir <p> override the resolved dirs\n\n hold options:\n --order <workflow>/<run> the order to hold (or --order <run> --workflow)\n --workflow <wf> required when --order is a bare run id\n --origin <url> hub origin (else settings.hubOrigin)\n --as <account> Scoped Identity credential account (default\n 'default'; the shift stamps this into born-bound\n holds)\n --session <id> session-holder tag (else env OWENLOOP_SESSION;\n else an anon:<hostname>:<pid> fallback \u2014 a\n holder is always sent)\n --shift <id> dispatching Shift's self-declared id (else\n env OWENLOOP_SHIFT_ID); advisory only\n --heartbeat-interval <ms> lease renew cadence (default 60000)\n --jump-tolerance <ms> wall-gap slack before a tick is treated as a\n clock jump / laptop sleep (default 30000)\n --ignore-stdin don't final-breath on stdin EOF (detached use)\n --mcp run as a stdio-MCP work-holder: tools get_order /\n submit, lease kept warm underneath (mutually\n exclusive with --ignore-stdin \u2014 stdin is the\n transport)\n\n exec options (usually spawned by shift, not run by hand):\n <workflow>/<run> the command order to run (positional order-id;\n or a bare <run> plus --workflow <wf>)\n --workflow <wf> required when the order-id is a bare run id\n --origin <url> hub origin (else settings.hubOrigin)\n --shift <id> dispatching Shift's self-declared id (else\n env OWENLOOP_SHIFT_ID); advisory only\n --heartbeat-interval <ms> lease renew cadence (default 60000)\n --jump-tolerance <ms> wall-gap slack before a tick is treated as a\n clock jump / laptop sleep (default 30000)\n\n agent-run options (spawned by the shift, not run by hand):\n <workflow>/<run> the agent order to host (positional order-id;\n or a bare <run> plus --workflow <wf>)\n --workflow <wf> required when the order-id is a bare run id\n --origin <url> hub origin (else settings.hubOrigin)\n --harness <id> which registered harness hosts the step agent\n (else env OWENLOOP_HARNESS, else the step def's\n 'harness' field, else the first registered one)\n --shift <id> dispatching Shift's self-declared id (else\n env OWENLOOP_SHIFT_ID); advisory only\n --heartbeat-interval <ms> lease renew cadence (default 60000)\n --jump-tolerance <ms> wall-gap slack before a tick is treated as a\n clock jump / laptop sleep (default 30000)\n --submit-grace <ms> after the turn ends, how long to keep asking the\n hub whether the agent's submit landed (default\n 15000). Task completion comes from the HUB, never\n from the harness stream.\n --confirm-interval <ms> poll cadence inside that grace (default 1000)\n\n release options:\n --session <id> session whose claims to drain (else env\n OWENLOOP_SESSION). Agent-held claims re-offer;\n exec-held claims are drain-exempt (B3).\n --origin <url> hub origin (else settings.hubOrigin)\n\n settings (no options in v1):\n prints the resolved settings file path, whether it exists, each known\n knob (hubOrigin, cacheDir, stateDir, dispatchCap, commandRouting,\n maxConcurrentAgents, workRoot, workRepo) with its value + provenance,\n and any unrecognized keys.\n settings.dispatchCap/stateDir are the lowest-precedence\n fallbacks for shift's --cap/--state-dir. NO secrets ever\n live in settings \u2014 credentials stay in owenloop's own store.\n\n sessions options:\n --all include 'dead' sessions (hidden by default \u2014\n a dead session can no longer be resumed)\n --json print the raw newest-per-step records, tokens\n included, instead of the table\n --cache-dir <p> override the resolved cache dir\n\n join options:\n --hub <origin> hub to redeem against (else settings.hubOrigin;\n one of the two is REQUIRED \u2014 the code never\n chooses the hub)\n --as <account> credential account to store under (default:\n the Scoped Identity name the hub returns)\n\n shift/hold/exec/prepare/release env:\n credentials come from owenloop's store \u2014 each role reads the\n agent:<account> slot for its origin (never the human slot); a\n missing slot refuses with a runnable 'owenloop login' command.\n OWENLOOP_ACCOUNT Scoped Identity account for exec/prepare/release\n (default 'default'; shift uses --as, and\n stamps it onto dispatched holds/execs)\n OWENLOOP_TOKEN dev-only bearer override \u2014 when set, used\n verbatim and the store + account are\n bypassed (NOT the primary path)\n OWENLOOP_CACHE_DIR cache root\n OWENLOOP_STATE_DIR shift in-flight state dir\n OWENLOOP_SESSION hold session-holder tag / release drain target\n OWENLOOP_SHIFT_ID dispatching Shift's self-declared id for\n hold/exec/agent-run's --shift (advisory\n only, never for auth/routing/dispatch)\n OWENLOOP_HARNESS agent-run harness id; below --harness, above\n the step def's 'harness' field\n OWENLOOP_WORK_ROOT root for per-RUN agent work dirs\n (<workRoot>/<workflow>/<run>); above\n settings.workRoot, default <cacheDir>/work.\n A hub-supplied OrderPacket.workdir still\n wins, and is never reaped.\n OWENLOOP_WORK_REPO local git repo to cut per-run work dirs from\n as worktrees instead of plain dirs; above\n settings.workRepo, default off\n\n Credentials / accounts:\n owenloop work's RUNTIME roles (shift/hold/exec/prepare/release) are READ-ONLY\n over owenloop's credential store \u2014 they never write credentials. Each\n role reads the agent:<account> slot for its origin (never the human\n slot); the account defaults to 'default'. 'owenloop work join' is the one\n deliberate provisioning-time writer: it stores the Scoped Identity token a hub\n redeem returns via owenloop's public storeCredential, once, at join time\n \u2014 not a runtime write.\n store / connect an account (run owenloop; owenloop work never writes it):\n owenloop login --hub <origin> --as agent:<account>\n (use --as agent for the default account)\n or provision a fresh box from a hub-issued join code:\n owenloop work join <code> --hub <origin>\n select an account at run time:\n --as <account> on shift / hold\n OWENLOOP_ACCOUNT on exec / prepare / release\n (shift resolves once and threads both channels)\n owenloop work does NOT list stored accounts \u2014 enumerating an origin's accounts\n is an owenloop-side capability; check owenloop for which slots are stored.\n\nExit codes:\n 0 success / help / version / lint clean or warnings-only\n 1 runtime failure (fetch/hub error, cache write) / lint found an error\n 2 usage error (unknown or missing role, missing required arg)\n 3 role not implemented yet (skeleton stub \u2014 lands in a later delivery)\n";
6
+ export declare const USAGE = "owenloop work \u2014 execution-side CLI companion to owenloop\n\nUsage:\n owenloop work hold --order <id> [options] hold an order with a heartbeating lease\n owenloop work exec <order-id> [options] run a command order in a self-leasing loop\n owenloop work agent-run <order-id> [options] host an agent order's step agent in a\n harness, in a self-leasing loop\n owenloop work prepare <workflow> [--origin <url>]\n fetch, cache & normalize step specs\n owenloop work lint <workflow-name | path> lint x.harness option bags in a def\n owenloop work sessions [--all] [--json] list this machine's recorded harness\n sessions and how to re-open them\n owenloop work release --session <id> [options] drain a session's held claims\n owenloop work settings print the resolved settings file\n owenloop work join <code> [--hub <origin>] [--as <account>]\n redeem a join code and store the Scoped\n Identity credential (one-time provisioning)\n\nOptions:\n -h, --help show this help and exit 0\n --version print the owenloop work version and exit 0\n\n root shift options (run as owenloop shift start <crew...> | --all):\n <crew...> serve only these crews (positional, space\n separated); or --all for every crew on the key\n --all serve every crew on the key\n --origin <url> hub origin (else settings.hubOrigin)\n --as <account> Scoped Identity credential account to read + hand\n to dispatched holds/execs (default 'default')\n --name <n> Shift name (default <hostname>/<cwd>)\n --cap <n> max in-flight exec children (default 3)\n --poll-interval <ms> wake poll cadence (default 5000)\n --once bootstrap wake + one sweep, then exit (demo/e2e)\n --max-agents <n> max in-flight agent-run children, separate from\n --cap (default 4; else settings.maxConcurrentAgents)\n --cache-dir/--state-dir <p> override the resolved dirs\n\n hold options:\n --order <workflow>/<run> the order to hold (or --order <run> --workflow)\n --workflow <wf> required when --order is a bare run id\n --origin <url> hub origin (else settings.hubOrigin)\n --as <account> Scoped Identity credential account (default\n 'default'; the shift stamps this into born-bound\n holds)\n --session <id> session-holder tag (else env OWENLOOP_SESSION;\n else an anon:<hostname>:<pid> fallback \u2014 a\n holder is always sent)\n --shift <id> dispatching Shift's self-declared id (else\n env OWENLOOP_SHIFT_ID); advisory only\n --heartbeat-interval <ms> lease renew cadence (default 60000)\n --jump-tolerance <ms> wall-gap slack before a tick is treated as a\n clock jump / laptop sleep (default 30000)\n --ignore-stdin don't final-breath on stdin EOF (detached use)\n --never-release another process holds the claim; stop without\n releasing it (agent-run spawns its --mcp child\n this way \u2014 see hold.ts HOLDER OF RECORD)\n --mcp run as a stdio-MCP work-holder: tools get_order /\n submit, lease kept warm underneath (mutually\n exclusive with --ignore-stdin \u2014 stdin is the\n transport)\n\n exec options (usually spawned by shift, not run by hand):\n <workflow>/<run> the command order to run (positional order-id;\n or a bare <run> plus --workflow <wf>)\n --workflow <wf> required when the order-id is a bare run id\n --origin <url> hub origin (else settings.hubOrigin)\n --shift <id> dispatching Shift's self-declared id (else\n env OWENLOOP_SHIFT_ID); advisory only\n --heartbeat-interval <ms> lease renew cadence (default 60000)\n --jump-tolerance <ms> wall-gap slack before a tick is treated as a\n clock jump / laptop sleep (default 30000)\n\n agent-run options (spawned by the shift, not run by hand):\n <workflow>/<run> the agent order to host (positional order-id;\n or a bare <run> plus --workflow <wf>)\n --workflow <wf> required when the order-id is a bare run id\n --origin <url> hub origin (else settings.hubOrigin)\n --harness <id> which registered harness hosts the step agent\n (else env OWENLOOP_HARNESS, else the step def's\n 'harness' field, else the first registered one)\n --shift <id> dispatching Shift's self-declared id (else\n env OWENLOOP_SHIFT_ID); advisory only\n --heartbeat-interval <ms> lease renew cadence (default 60000)\n --jump-tolerance <ms> wall-gap slack before a tick is treated as a\n clock jump / laptop sleep (default 30000)\n --submit-grace <ms> after the turn ends, how long to keep asking the\n hub whether the agent's submit landed (default\n 15000). Task completion comes from the HUB, never\n from the harness stream.\n --confirm-interval <ms> poll cadence inside that grace (default 1000)\n\n release options:\n --session <id> session whose claims to drain (else env\n OWENLOOP_SESSION). Agent-held claims re-offer;\n exec-held claims are drain-exempt (B3).\n --origin <url> hub origin (else settings.hubOrigin)\n\n settings (no options in v1):\n prints the resolved settings file path, whether it exists, each known\n knob (hubOrigin, cacheDir, stateDir, dispatchCap, commandRouting,\n maxConcurrentAgents, workRoot, workRepo) with its value + provenance,\n and any unrecognized keys.\n settings.dispatchCap/stateDir are the lowest-precedence\n fallbacks for shift's --cap/--state-dir. NO secrets ever\n live in settings \u2014 credentials stay in owenloop's own store.\n\n sessions options:\n --all include 'dead' sessions (hidden by default \u2014\n a dead session can no longer be resumed)\n --json print the raw newest-per-step records, tokens\n included, instead of the table\n --cache-dir <p> override the resolved cache dir\n\n join options:\n --hub <origin> hub to redeem against (else settings.hubOrigin;\n one of the two is REQUIRED \u2014 the code never\n chooses the hub)\n --as <account> credential account to store under (default:\n the Scoped Identity name the hub returns)\n\n shift/hold/exec/prepare/release env:\n credentials come from owenloop's store \u2014 each role reads the\n agent:<account> slot for its origin (never the human slot); a\n missing slot refuses with a runnable 'owenloop login' command.\n OWENLOOP_ACCOUNT Scoped Identity account for exec/prepare/release\n (default 'default'; shift uses --as, and\n stamps it onto dispatched holds/execs)\n OWENLOOP_TOKEN dev-only bearer override \u2014 when set, used\n verbatim and the store + account are\n bypassed (NOT the primary path)\n OWENLOOP_CACHE_DIR cache root\n OWENLOOP_STATE_DIR shift in-flight state dir\n OWENLOOP_SHIFT_LOG_DIR dir for the shift's shift.log and each\n worker's <run>.log; below --log-dir, above\n settings.shiftLogDir, default the state dir\n OWENLOOP_SHIFT_LOG_MAX_AGE_MS\n how long a worker's <run>.log is kept, in ms;\n below --log-max-age, above\n settings.shiftLogMaxAgeMs, default 14 days.\n Worker logs only \u2014 shift.log is never reaped\n OWENLOOP_SESSION hold session-holder tag / release drain target\n OWENLOOP_SHIFT_ID dispatching Shift's self-declared id for\n hold/exec/agent-run's --shift (advisory\n only, never for auth/routing/dispatch)\n OWENLOOP_HARNESS agent-run harness id; below --harness, above\n the step def's 'harness' field\n OWENLOOP_WORK_ROOT root for per-RUN agent work dirs\n (<workRoot>/<workflow>/<run>); above\n settings.workRoot, default <cacheDir>/work.\n A hub-supplied OrderPacket.workdir still\n wins, and is never reaped.\n OWENLOOP_WORK_REPO local git repo to cut per-run work dirs from\n as worktrees instead of plain dirs; above\n settings.workRepo, default off\n\n Credentials / accounts:\n owenloop work's RUNTIME roles (shift/hold/exec/prepare/release) are READ-ONLY\n over owenloop's credential store \u2014 they never write credentials. Each\n role reads the agent:<account> slot for its origin (never the human\n slot); the account defaults to 'default'. 'owenloop work join' is the one\n deliberate provisioning-time writer: it stores the Scoped Identity token a hub\n redeem returns via owenloop's public storeCredential, once, at join time\n \u2014 not a runtime write.\n store / connect an account (run owenloop; owenloop work never writes it):\n owenloop login --hub <origin> --as agent:<account>\n (use --as agent for the default account)\n or provision a fresh box from a hub-issued join code:\n owenloop work join <code> --hub <origin>\n select an account at run time:\n --as <account> on shift / hold\n OWENLOOP_ACCOUNT on exec / prepare / release\n (shift resolves once and threads both channels)\n owenloop work does NOT list stored accounts \u2014 enumerating an origin's accounts\n is an owenloop-side capability; check owenloop for which slots are stored.\n\nExit codes:\n 0 success / help / version / lint clean or warnings-only\n 1 runtime failure (fetch/hub error, cache write) / lint found an error\n 2 usage error (unknown or missing role, missing required arg)\n 3 role not implemented yet (skeleton stub \u2014 lands in a later delivery)\n";
@@ -56,6 +56,9 @@ Options:
56
56
  --jump-tolerance <ms> wall-gap slack before a tick is treated as a
57
57
  clock jump / laptop sleep (default 30000)
58
58
  --ignore-stdin don't final-breath on stdin EOF (detached use)
59
+ --never-release another process holds the claim; stop without
60
+ releasing it (agent-run spawns its --mcp child
61
+ this way — see hold.ts HOLDER OF RECORD)
59
62
  --mcp run as a stdio-MCP work-holder: tools get_order /
60
63
  submit, lease kept warm underneath (mutually
61
64
  exclusive with --ignore-stdin — stdin is the
@@ -132,6 +135,14 @@ Options:
132
135
  bypassed (NOT the primary path)
133
136
  OWENLOOP_CACHE_DIR cache root
134
137
  OWENLOOP_STATE_DIR shift in-flight state dir
138
+ OWENLOOP_SHIFT_LOG_DIR dir for the shift's shift.log and each
139
+ worker's <run>.log; below --log-dir, above
140
+ settings.shiftLogDir, default the state dir
141
+ OWENLOOP_SHIFT_LOG_MAX_AGE_MS
142
+ how long a worker's <run>.log is kept, in ms;
143
+ below --log-max-age, above
144
+ settings.shiftLogMaxAgeMs, default 14 days.
145
+ Worker logs only — shift.log is never reaped
135
146
  OWENLOOP_SESSION hold session-holder tag / release drain target
136
147
  OWENLOOP_SHIFT_ID dispatching Shift's self-declared id for
137
148
  hold/exec/agent-run's --shift (advisory