audit-tools 0.45.0 → 0.46.0

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 (227) hide show
  1. package/README.md +15 -2
  2. package/dist/audit/cli/charterExtractionPrompt.d.ts.map +1 -1
  3. package/dist/audit/cli/charterExtractionPrompt.js +11 -1
  4. package/dist/audit/cli/charterExtractionPrompt.js.map +1 -1
  5. package/dist/audit/cli/cleanupCommand.d.ts +25 -0
  6. package/dist/audit/cli/cleanupCommand.d.ts.map +1 -1
  7. package/dist/audit/cli/cleanupCommand.js +69 -0
  8. package/dist/audit/cli/cleanupCommand.js.map +1 -1
  9. package/dist/audit/cli/dispatch/hostHandoff.d.ts.map +1 -1
  10. package/dist/audit/cli/dispatch/hostHandoff.js +52 -76
  11. package/dist/audit/cli/dispatch/hostHandoff.js.map +1 -1
  12. package/dist/audit/cli/dispatch/packetFilter.d.ts +1 -1
  13. package/dist/audit/cli/fanoutLanes.d.ts.map +1 -1
  14. package/dist/audit/cli/fanoutLanes.js +6 -1
  15. package/dist/audit/cli/fanoutLanes.js.map +1 -1
  16. package/dist/audit/cli/laneSubmissions.d.ts +13 -0
  17. package/dist/audit/cli/laneSubmissions.d.ts.map +1 -1
  18. package/dist/audit/cli/laneSubmissions.js +38 -27
  19. package/dist/audit/cli/laneSubmissions.js.map +1 -1
  20. package/dist/audit/cli/nextStepCommand.d.ts.map +1 -1
  21. package/dist/audit/cli/nextStepCommand.js +8 -6
  22. package/dist/audit/cli/nextStepCommand.js.map +1 -1
  23. package/dist/audit/cli/nextStepHelpers.d.ts +3 -2
  24. package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
  25. package/dist/audit/cli/nextStepHelpers.js +37 -35
  26. package/dist/audit/cli/nextStepHelpers.js.map +1 -1
  27. package/dist/audit/cli/reviewRun.d.ts +1 -1
  28. package/dist/audit/cli/reviewRun.d.ts.map +1 -1
  29. package/dist/audit/cli/reviewRun.js +2 -9
  30. package/dist/audit/cli/reviewRun.js.map +1 -1
  31. package/dist/audit/cli/sampleRunCommand.d.ts.map +1 -1
  32. package/dist/audit/cli/sampleRunCommand.js +12 -1
  33. package/dist/audit/cli/sampleRunCommand.js.map +1 -1
  34. package/dist/audit/cli/semanticReviewStep.d.ts.map +1 -1
  35. package/dist/audit/cli/semanticReviewStep.js +9 -1
  36. package/dist/audit/cli/semanticReviewStep.js.map +1 -1
  37. package/dist/audit/cli/steps.d.ts +6 -6
  38. package/dist/audit/contracts/workerSchemas.d.ts +36 -26
  39. package/dist/audit/contracts/workerSchemas.d.ts.map +1 -1
  40. package/dist/audit/contracts/workerSchemas.js +11 -1
  41. package/dist/audit/contracts/workerSchemas.js.map +1 -1
  42. package/dist/audit/contracts/wrapperResponse.d.ts +52 -28
  43. package/dist/audit/contracts/wrapperResponse.d.ts.map +1 -1
  44. package/dist/audit/contracts/wrapperResponse.js +8 -5
  45. package/dist/audit/contracts/wrapperResponse.js.map +1 -1
  46. package/dist/audit/decompose/sources.d.ts.map +1 -1
  47. package/dist/audit/decompose/sources.js +21 -5
  48. package/dist/audit/decompose/sources.js.map +1 -1
  49. package/dist/audit/extractors/analyzers/registry.d.ts +8 -5
  50. package/dist/audit/extractors/analyzers/registry.d.ts.map +1 -1
  51. package/dist/audit/extractors/analyzers/registry.js +28 -7
  52. package/dist/audit/extractors/analyzers/registry.js.map +1 -1
  53. package/dist/audit/extractors/designAssessment.js +1 -1
  54. package/dist/audit/extractors/gitHistory.d.ts +1 -1
  55. package/dist/audit/extractors/gitHistory.js +1 -1
  56. package/dist/audit/extractors/graph.d.ts +1 -1
  57. package/dist/audit/extractors/graph.js +1 -1
  58. package/dist/audit/extractors/risk.d.ts +1 -1
  59. package/dist/audit/extractors/risk.js +1 -1
  60. package/dist/audit/io/artifacts.d.ts.map +1 -1
  61. package/dist/audit/io/artifacts.js +5 -5
  62. package/dist/audit/io/artifacts.js.map +1 -1
  63. package/dist/audit/orchestrator/acquisitionExecutor.d.ts +11 -6
  64. package/dist/audit/orchestrator/acquisitionExecutor.d.ts.map +1 -1
  65. package/dist/audit/orchestrator/acquisitionExecutor.js +1 -1
  66. package/dist/audit/orchestrator/acquisitionExecutor.js.map +1 -1
  67. package/dist/audit/orchestrator/advance.d.ts +14 -10
  68. package/dist/audit/orchestrator/advance.d.ts.map +1 -1
  69. package/dist/audit/orchestrator/advance.js +49 -24
  70. package/dist/audit/orchestrator/advance.js.map +1 -1
  71. package/dist/audit/orchestrator/advanceTypes.d.ts +14 -0
  72. package/dist/audit/orchestrator/advanceTypes.d.ts.map +1 -1
  73. package/dist/audit/orchestrator/autoFixExecutor.d.ts +20 -1
  74. package/dist/audit/orchestrator/autoFixExecutor.d.ts.map +1 -1
  75. package/dist/audit/orchestrator/autoFixExecutor.js +77 -15
  76. package/dist/audit/orchestrator/autoFixExecutor.js.map +1 -1
  77. package/dist/audit/orchestrator/dependencyMap.js +1 -1
  78. package/dist/audit/orchestrator/dependencyMap.js.map +1 -1
  79. package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -1
  80. package/dist/audit/orchestrator/executorRunners.js +18 -4
  81. package/dist/audit/orchestrator/executorRunners.js.map +1 -1
  82. package/dist/audit/orchestrator/executors.d.ts +54 -0
  83. package/dist/audit/orchestrator/executors.d.ts.map +1 -1
  84. package/dist/audit/orchestrator/executors.js +352 -0
  85. package/dist/audit/orchestrator/executors.js.map +1 -1
  86. package/dist/audit/orchestrator/hostInputPause.d.ts +20 -11
  87. package/dist/audit/orchestrator/hostInputPause.d.ts.map +1 -1
  88. package/dist/audit/orchestrator/hostInputPause.js +17 -11
  89. package/dist/audit/orchestrator/hostInputPause.js.map +1 -1
  90. package/dist/audit/orchestrator/localCommands.d.ts +24 -1
  91. package/dist/audit/orchestrator/localCommands.d.ts.map +1 -1
  92. package/dist/audit/orchestrator/localCommands.js +44 -9
  93. package/dist/audit/orchestrator/localCommands.js.map +1 -1
  94. package/dist/audit/orchestrator/nextStep.d.ts +13 -0
  95. package/dist/audit/orchestrator/nextStep.d.ts.map +1 -1
  96. package/dist/audit/orchestrator/nextStep.js +13 -0
  97. package/dist/audit/orchestrator/nextStep.js.map +1 -1
  98. package/dist/audit/orchestrator/requeueCommand.d.ts +1 -1
  99. package/dist/audit/orchestrator/runtimeCommand.d.ts +32 -1
  100. package/dist/audit/orchestrator/runtimeCommand.d.ts.map +1 -1
  101. package/dist/audit/orchestrator/runtimeCommand.js +90 -3
  102. package/dist/audit/orchestrator/runtimeCommand.js.map +1 -1
  103. package/dist/audit/orchestrator/structureExecutors.js +1 -1
  104. package/dist/audit/orchestrator/structureExecutors.js.map +1 -1
  105. package/dist/audit/orchestrator/syntaxResolutionExecutor.d.ts +11 -1
  106. package/dist/audit/orchestrator/syntaxResolutionExecutor.d.ts.map +1 -1
  107. package/dist/audit/orchestrator/syntaxResolutionExecutor.js +25 -9
  108. package/dist/audit/orchestrator/syntaxResolutionExecutor.js.map +1 -1
  109. package/dist/audit/supervisor/operatorHandoff.d.ts +0 -1
  110. package/dist/audit/supervisor/operatorHandoff.d.ts.map +1 -1
  111. package/dist/audit/supervisor/operatorHandoff.js +2 -1
  112. package/dist/audit/supervisor/operatorHandoff.js.map +1 -1
  113. package/dist/audit/types.d.ts +18 -18
  114. package/dist/remediate/contractPipeline/derive.d.ts.map +1 -1
  115. package/dist/remediate/contractPipeline/derive.js +1 -0
  116. package/dist/remediate/contractPipeline/derive.js.map +1 -1
  117. package/dist/remediate/contractPipeline/semanticProjection.d.ts +5 -4
  118. package/dist/remediate/contractPipeline/semanticProjection.d.ts.map +1 -1
  119. package/dist/remediate/contractPipeline/semanticProjection.js +34 -19
  120. package/dist/remediate/contractPipeline/semanticProjection.js.map +1 -1
  121. package/dist/remediate/index.d.ts.map +1 -1
  122. package/dist/remediate/index.js +3 -2
  123. package/dist/remediate/index.js.map +1 -1
  124. package/dist/remediate/phases/close.d.ts +37 -2
  125. package/dist/remediate/phases/close.d.ts.map +1 -1
  126. package/dist/remediate/phases/close.js +100 -31
  127. package/dist/remediate/phases/close.js.map +1 -1
  128. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js +2 -2
  129. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js.map +1 -1
  130. package/dist/remediate/phases/triage.d.ts.map +1 -1
  131. package/dist/remediate/phases/triage.js +61 -19
  132. package/dist/remediate/phases/triage.js.map +1 -1
  133. package/dist/remediate/steps/contractPipeline.d.ts +13 -0
  134. package/dist/remediate/steps/contractPipeline.d.ts.map +1 -1
  135. package/dist/remediate/steps/contractPipeline.js +82 -3
  136. package/dist/remediate/steps/contractPipeline.js.map +1 -1
  137. package/dist/remediate/steps/dispatch/hostHandoff.d.ts +1 -1
  138. package/dist/remediate/steps/dispatch/hostHandoff.d.ts.map +1 -1
  139. package/dist/remediate/steps/dispatch/hostHandoff.js +297 -139
  140. package/dist/remediate/steps/dispatch/hostHandoff.js.map +1 -1
  141. package/dist/remediate/steps/nextStep.d.ts.map +1 -1
  142. package/dist/remediate/steps/nextStep.js +37 -7
  143. package/dist/remediate/steps/nextStep.js.map +1 -1
  144. package/dist/remediate/types/options.d.ts +1 -1
  145. package/dist/shared/analyzers/acquisitionEngine.d.ts +61 -28
  146. package/dist/shared/analyzers/acquisitionEngine.d.ts.map +1 -1
  147. package/dist/shared/analyzers/acquisitionEngine.js +83 -24
  148. package/dist/shared/analyzers/acquisitionEngine.js.map +1 -1
  149. package/dist/shared/analyzers/binaryAcquisition.d.ts +8 -2
  150. package/dist/shared/analyzers/binaryAcquisition.d.ts.map +1 -1
  151. package/dist/shared/analyzers/binaryAcquisition.js +4 -4
  152. package/dist/shared/analyzers/binaryAcquisition.js.map +1 -1
  153. package/dist/shared/constitutionalDocPaths.d.ts.map +1 -1
  154. package/dist/shared/constitutionalDocPaths.js +7 -0
  155. package/dist/shared/constitutionalDocPaths.js.map +1 -1
  156. package/dist/shared/engine/obligationEngine.d.ts +44 -3
  157. package/dist/shared/engine/obligationEngine.d.ts.map +1 -1
  158. package/dist/shared/engine/obligationEngine.js +53 -7
  159. package/dist/shared/engine/obligationEngine.js.map +1 -1
  160. package/dist/shared/findings/dedupe.d.ts.map +1 -1
  161. package/dist/shared/findings/dedupe.js +8 -0
  162. package/dist/shared/findings/dedupe.js.map +1 -1
  163. package/dist/shared/friction/frictionRecord.d.ts +42 -2
  164. package/dist/shared/friction/frictionRecord.d.ts.map +1 -1
  165. package/dist/shared/friction/frictionRecord.js +111 -3
  166. package/dist/shared/friction/frictionRecord.js.map +1 -1
  167. package/dist/shared/friction/triage.d.ts +15 -0
  168. package/dist/shared/friction/triage.d.ts.map +1 -1
  169. package/dist/shared/friction/triage.js +33 -2
  170. package/dist/shared/friction/triage.js.map +1 -1
  171. package/dist/shared/index.d.ts +13 -9
  172. package/dist/shared/index.d.ts.map +1 -1
  173. package/dist/shared/index.js +14 -7
  174. package/dist/shared/index.js.map +1 -1
  175. package/dist/shared/io/fileLock.d.ts.map +1 -1
  176. package/dist/shared/io/fileLock.js +22 -3
  177. package/dist/shared/io/fileLock.js.map +1 -1
  178. package/dist/shared/io/frictionCapture.d.ts +73 -19
  179. package/dist/shared/io/frictionCapture.d.ts.map +1 -1
  180. package/dist/shared/io/frictionCapture.js +21 -30
  181. package/dist/shared/io/frictionCapture.js.map +1 -1
  182. package/dist/shared/io/lockedJsonStore.d.ts +24 -3
  183. package/dist/shared/io/lockedJsonStore.d.ts.map +1 -1
  184. package/dist/shared/io/lockedJsonStore.js +35 -7
  185. package/dist/shared/io/lockedJsonStore.js.map +1 -1
  186. package/dist/shared/io/stepContractWriter.d.ts +3 -3
  187. package/dist/shared/io/stepContractWriter.d.ts.map +1 -1
  188. package/dist/shared/io/stepContractWriter.js +97 -13
  189. package/dist/shared/io/stepContractWriter.js.map +1 -1
  190. package/dist/shared/submission/expectedSubmissions.d.ts +18 -0
  191. package/dist/shared/submission/expectedSubmissions.d.ts.map +1 -1
  192. package/dist/shared/submission/expectedSubmissions.js +17 -0
  193. package/dist/shared/submission/expectedSubmissions.js.map +1 -1
  194. package/dist/shared/submission/handRecovery.d.ts.map +1 -1
  195. package/dist/shared/submission/handRecovery.js +9 -11
  196. package/dist/shared/submission/handRecovery.js.map +1 -1
  197. package/dist/shared/submission/hostHandoffCore.d.ts +155 -0
  198. package/dist/shared/submission/hostHandoffCore.d.ts.map +1 -0
  199. package/dist/shared/submission/hostHandoffCore.js +210 -0
  200. package/dist/shared/submission/hostHandoffCore.js.map +1 -0
  201. package/dist/shared/submission/submissionLedger.d.ts +5 -1
  202. package/dist/shared/submission/submissionLedger.d.ts.map +1 -1
  203. package/dist/shared/submission/submissionLedger.js +33 -3
  204. package/dist/shared/submission/submissionLedger.js.map +1 -1
  205. package/dist/shared/tooling/commandShape.d.ts +29 -0
  206. package/dist/shared/tooling/commandShape.d.ts.map +1 -1
  207. package/dist/shared/tooling/commandShape.js +82 -10
  208. package/dist/shared/tooling/commandShape.js.map +1 -1
  209. package/dist/shared/tooling/exec.d.ts +32 -0
  210. package/dist/shared/tooling/exec.d.ts.map +1 -1
  211. package/dist/shared/tooling/exec.js +189 -0
  212. package/dist/shared/tooling/exec.js.map +1 -1
  213. package/docs/audit-pkg/contracts.md +2 -1
  214. package/docs/audit-pkg/operator-guide.md +5 -2
  215. package/docs/audit-pkg/product.md +22 -6
  216. package/package.json +10 -6
  217. package/schemas/audit-code-v1alpha1.schema.json +297 -0
  218. package/schemas/audit_result.schema.json +4 -0
  219. package/schemas/audit_results.schema.json +4 -0
  220. package/scripts/shared/install-host-assets.mjs +8 -5
  221. package/skills/audit-code/SKILL.md +4 -2
  222. package/skills/audit-code/audit-code.prompt.md +5 -2
  223. package/skills/audit-code/opencode-command-template.txt +1 -1
  224. package/wrapper/audit-code-wrapper-lib.mjs +81 -16
  225. package/wrapper/installer-verb-help.mjs +14 -4
  226. package/docs/audit-pkg/development.md +0 -113
  227. package/docs/audit-pkg/release.md +0 -140
@@ -1,7 +1,7 @@
1
1
  import { cp } from "node:fs/promises";
2
2
  /**
3
3
  * Tool-emitted end-of-run friction capture, single-sourced for BOTH orchestrators
4
- * (audit-code + remediate-code) so the artifact shape, filename, persist helper,
4
+ * (audit-code + remediate-code) so the artifact shape, filename, path derivation,
5
5
  * and "already captured?" check cannot drift between the two halves of the
6
6
  * pipeline. The host (the active LLM agent) owns ONLY the friction CONTENT; the
7
7
  * tool owns the structure, the filename, the per-run `run_id` key, and the
@@ -9,8 +9,8 @@ import { cp } from "node:fs/promises";
9
9
  *
10
10
  * Properties this module guarantees (the obligation that drives the close-out
11
11
  * lives in each orchestrator's nextStep; this is the shared substrate):
12
- * - DETERMINISTIC: the persist + the "captured?" probe are pure file ops keyed
13
- * only off `(artifactsDir, run_id)`, never host discretion.
12
+ * - DETERMINISTIC: the path derivation and the "captured?" probe are pure file
13
+ * ops keyed only off `(artifactsDir, run_id)`, never host discretion.
14
14
  * - PARITY: one shape, one helper — both orchestrators import the same code, so
15
15
  * a divergent spelling is impossible.
16
16
  * - DEGRADE-CLEANLY: a run with ZERO frictions still writes a valid artifact
@@ -40,12 +40,73 @@ export interface FrictionItem {
40
40
  /** Optional path/area the friction relates to. */
41
41
  area?: string;
42
42
  }
43
+ /**
44
+ * The runs a friction record RELATES to, named by reference. THE contract statement for
45
+ * the linkage — every other site (the merge, the writer seam, the by-reference reader,
46
+ * the call sites) points here rather than restating it.
47
+ *
48
+ * Three run notions coexist and their lifecycles genuinely differ — the step-envelope
49
+ * run on the step contract, the host-handoff (dispatch) run, and the record's own
50
+ * `run_id` key — so they are NOT collapsed into one identity. What the record owes is
51
+ * VISIBILITY of the relation: a reader holding a dispatch run id must be able to tell
52
+ * which friction record it belongs to instead of guessing at the key.
53
+ *
54
+ * Both fields are ALWAYS PRESENT reference ARRAYS, empty when nothing is recorded — so
55
+ * "no relation recorded" is a stated answer rather than an absent key.
56
+ *
57
+ * They are arrays because the relation is genuinely ONE-TO-MANY: one record can span
58
+ * many rounds (audit keys its record by a fixed literal for the whole session, while
59
+ * `ensureSemanticReviewRun` re-mints a review/dispatch run id per round). A scalar would
60
+ * be first-writer-wins and hide rounds 2..N — the very invisibility this linkage exists
61
+ * to close. So the merge ACCUMULATES: a supplied id is appended if new, never replaces
62
+ * one already present, and no writer can drop one. Entries are deduped and held in
63
+ * code-unit order of the id itself, never write order, so the array stays content-ordered.
64
+ *
65
+ * The two arrays are independent SETS, NOT positionally paired: content order discards
66
+ * write order, so which step run accompanied which dispatch run in a given round is not
67
+ * recoverable from the record. Never zip them.
68
+ *
69
+ * The rule for what may be written is PROVENANCE, not distinctness: a writer may record a
70
+ * reference only from the envelope that owns it, and records nothing for one it does not
71
+ * hold — it may never synthesize a reference out of `run_id` or out of the other
72
+ * reference. Value COINCIDENCE is permitted and is in fact today's state on both draws:
73
+ * on remediate all three ids resolve to the same value at the dispatch seam, and on audit
74
+ * both references are the active review run. The reference is written anyway so the
75
+ * relation survives if the lifecycles diverge, which they may — an early-lifecycle step
76
+ * mints its own envelope run. Never assume the values differ; only that each was sourced,
77
+ * not invented.
78
+ */
79
+ export interface FrictionRunLinks {
80
+ /**
81
+ * Every step-envelope `run_id` (the step contract's own run key, see
82
+ * `stepContractWriter.ts`) this record relates to. Lifecycle: one step contract,
83
+ * rewritten every next-step call. Empty when no envelope run was recorded.
84
+ */
85
+ step_run_ids: readonly string[];
86
+ /**
87
+ * Every host-handoff run id this record relates to — the run keys the dispatch
88
+ * workload, task bindings, and result map are filed under. Lifecycle: one dispatch
89
+ * round, outliving the step contract that published it. Empty when no dispatch round
90
+ * was ever in scope for this record.
91
+ */
92
+ dispatch_run_ids: readonly string[];
93
+ }
94
+ /**
95
+ * ONE write against {@link FrictionRunLinks}: the single step run and/or dispatch run the
96
+ * writing seam holds this round. An omitted key or an explicit `null` records nothing on
97
+ * that axis; a supplied id accumulates into the corresponding array. Also the query shape
98
+ * for the by-reference reader, which matches on MEMBERSHIP of the supplied id.
99
+ */
100
+ export interface FrictionRunLinkUpdate {
101
+ readonly step_run_id?: string | null;
102
+ readonly dispatch_run_id?: string | null;
103
+ }
43
104
  /** The per-run friction artifact. The tool owns every field except `frictions`. */
44
- export interface FrictionCaptureArtifact {
105
+ export interface FrictionCaptureArtifact extends FrictionRunLinks {
45
106
  schema_version: typeof FRICTION_CAPTURE_SCHEMA_VERSION;
46
107
  /** Which orchestrator emitted this record. */
47
108
  tool: "audit-code" | "remediate-code";
48
- /** Per-project run id this close-out belongs to. */
109
+ /** Per-project run id this close-out belongs to — this record's OWN key. */
49
110
  run_id: string;
50
111
  /** ISO timestamp the record was persisted. */
51
112
  captured_at: string;
@@ -68,6 +129,13 @@ export declare function sanitizeRunId(runId: string): string;
68
129
  * obligation must short-circuit so it never re-loops.
69
130
  */
70
131
  export declare function frictionCaptured(artifactsDir: string, runId: string): Promise<boolean>;
132
+ /**
133
+ * Every per-run friction record filename under `<artifactsDir>/friction/`, sorted by
134
+ * name — a stable, content-derived order, never `readdir` order. A missing friction
135
+ * dir yields `[]` (nothing captured yet is not an error). Single-sourced here, where
136
+ * the dir itself is owned, so every reader of the dir applies the same `.json` filter.
137
+ */
138
+ export declare function listFrictionRecordFilenames(artifactsDir: string): Promise<string[]>;
71
139
  /**
72
140
  * Archive every per-run friction record out of `<artifactsDir>/friction/` into
73
141
  * `destDir` as `<prefix>-<basename>` (e.g. `audit-friction-run.json`), returning
@@ -87,18 +155,4 @@ export declare function archiveFrictionRecords(params: {
87
155
  copyFile?: typeof cp;
88
156
  warn?: (message: string) => void;
89
157
  }): Promise<string[]>;
90
- /**
91
- * Persist the per-run friction artifact via a SINGLE shared atomic write
92
- * (`writeJsonFile` is temp-then-rename). The tool stamps `schema_version`,
93
- * `run_id`, `tool`, and `captured_at`; the caller supplies only the
94
- * host-recorded `frictions` (defaulting to `[]` for the clean-degrade case).
95
- * Idempotent enough for a close-out: re-persisting overwrites the same run_id
96
- * record atomically.
97
- */
98
- export declare function persistFrictionCapture(params: {
99
- artifactsDir: string;
100
- runId: string;
101
- tool: FrictionCaptureArtifact["tool"];
102
- frictions?: FrictionItem[];
103
- }): Promise<FrictionCaptureArtifact>;
104
158
  //# sourceMappingURL=frictionCapture.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"frictionCapture.d.ts","sourceRoot":"","sources":["../../../src/shared/io/frictionCapture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAW,MAAM,kBAAkB,CAAC;AAI/C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,eAAO,MAAM,+BAA+B,8BAA8B,CAAC;AAE3E,6EAA6E;AAC7E,eAAO,MAAM,wBAAwB,aAAa,CAAC;AAEnD,oEAAoE;AACpE,MAAM,WAAW,YAAY;IAC3B,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC9C,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,YAAY,CAAC;IACzC,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,mFAAmF;AACnF,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,OAAO,+BAA+B,CAAC;IACvD,8CAA8C;IAC9C,IAAI,EAAE,YAAY,GAAG,gBAAgB,CAAC;IACtC,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,SAAS,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/E;AAgDD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA8BnD;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,MAAM,EACpB,KAAK,E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AE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAmBpB"}
@@ -1,11 +1,11 @@
1
1
  import { join } from "node:path";
2
2
  import { createHash } from "node:crypto";
3
3
  import { cp, readdir } from "node:fs/promises";
4
- import { readOptionalJsonFile, writeJsonFile } from "./json.js";
4
+ import { readOptionalJsonFile } from "./json.js";
5
5
  import { discardOnSchemaVersionMismatch } from "./schemaVersion.js";
6
6
  /**
7
7
  * Tool-emitted end-of-run friction capture, single-sourced for BOTH orchestrators
8
- * (audit-code + remediate-code) so the artifact shape, filename, persist helper,
8
+ * (audit-code + remediate-code) so the artifact shape, filename, path derivation,
9
9
  * and "already captured?" check cannot drift between the two halves of the
10
10
  * pipeline. The host (the active LLM agent) owns ONLY the friction CONTENT; the
11
11
  * tool owns the structure, the filename, the per-run `run_id` key, and the
@@ -13,8 +13,8 @@ import { discardOnSchemaVersionMismatch } from "./schemaVersion.js";
13
13
  *
14
14
  * Properties this module guarantees (the obligation that drives the close-out
15
15
  * lives in each orchestrator's nextStep; this is the shared substrate):
16
- * - DETERMINISTIC: the persist + the "captured?" probe are pure file ops keyed
17
- * only off `(artifactsDir, run_id)`, never host discretion.
16
+ * - DETERMINISTIC: the path derivation and the "captured?" probe are pure file
17
+ * ops keyed only off `(artifactsDir, run_id)`, never host discretion.
18
18
  * - PARITY: one shape, one helper — both orchestrators import the same code, so
19
19
  * a divergent spelling is impossible.
20
20
  * - DEGRADE-CLEANLY: a run with ZERO frictions still writes a valid artifact
@@ -133,6 +133,22 @@ export async function frictionCaptured(artifactsDir, runId) {
133
133
  const existing = discardOnSchemaVersionMismatch(await readOptionalJsonFile(frictionCapturePath(artifactsDir, runId)), FRICTION_CAPTURE_SCHEMA_VERSION);
134
134
  return existing !== undefined && existing !== null;
135
135
  }
136
+ /**
137
+ * Every per-run friction record filename under `<artifactsDir>/friction/`, sorted by
138
+ * name — a stable, content-derived order, never `readdir` order. A missing friction
139
+ * dir yields `[]` (nothing captured yet is not an error). Single-sourced here, where
140
+ * the dir itself is owned, so every reader of the dir applies the same `.json` filter.
141
+ */
142
+ export async function listFrictionRecordFilenames(artifactsDir) {
143
+ try {
144
+ return (await readdir(frictionCaptureDir(artifactsDir)))
145
+ .filter((name) => name.endsWith(".json"))
146
+ .sort();
147
+ }
148
+ catch {
149
+ return [];
150
+ }
151
+ }
136
152
  /**
137
153
  * Archive every per-run friction record out of `<artifactsDir>/friction/` into
138
154
  * `destDir` as `<prefix>-<basename>` (e.g. `audit-friction-run.json`), returning
@@ -149,13 +165,7 @@ export async function archiveFrictionRecords(params) {
149
165
  const copyFile = params.copyFile ?? cp;
150
166
  const warn = params.warn ?? ((message) => process.stderr.write(`${message}\n`));
151
167
  const dir = frictionCaptureDir(params.artifactsDir);
152
- let names;
153
- try {
154
- names = (await readdir(dir)).filter((name) => name.endsWith(".json"));
155
- }
156
- catch {
157
- return []; // no friction dir → nothing to archive
158
- }
168
+ const names = await listFrictionRecordFilenames(params.artifactsDir);
159
169
  const archived = [];
160
170
  for (const name of names) {
161
171
  const destination = join(params.destDir, `${params.prefix}-${name}`);
@@ -170,23 +180,4 @@ export async function archiveFrictionRecords(params) {
170
180
  }
171
181
  return archived;
172
182
  }
173
- /**
174
- * Persist the per-run friction artifact via a SINGLE shared atomic write
175
- * (`writeJsonFile` is temp-then-rename). The tool stamps `schema_version`,
176
- * `run_id`, `tool`, and `captured_at`; the caller supplies only the
177
- * host-recorded `frictions` (defaulting to `[]` for the clean-degrade case).
178
- * Idempotent enough for a close-out: re-persisting overwrites the same run_id
179
- * record atomically.
180
- */
181
- export async function persistFrictionCapture(params) {
182
- const artifact = {
183
- schema_version: FRICTION_CAPTURE_SCHEMA_VERSION,
184
- tool: params.tool,
185
- run_id: params.runId,
186
- captured_at: new Date().toISOString(),
187
- frictions: params.frictions ?? [],
188
- };
189
- await writeJsonFile(frictionCapturePath(params.artifactsDir, params.runId), artifact);
190
- return artifact;
191
- }
192
183
  //# sourceMappingURL=frictionCapture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"frictionCapture.js","sourceRoot":"","sources":["../../../src/shared/io/frictionCapture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,CAAC,MAAM,+BAA+B,GAAG,2BAA2B,CAAC;AAE3E,6EAA6E;AAC7E,MAAM,CAAC,MAAM,wBAAwB,GAAG,UAAU,CAAC;AA2BnD,kFAAkF;AAClF,MAAM,UAAU,kBAAkB,CAAC,YAAoB;IACrD,OAAO,IAAI,CAAC,YAAY,EAAE,wBAAwB,CAAC,CAAC;AACtD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,YAAoB,EAAE,KAAa;IACrE,OAAO,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAChF,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,iFAAiF;AACjF,MAAM,uBAAuB,GAAG,GAAG,CAAC;AACpC,2EAA2E;AAC3E,MAAM,2BAA2B,GAAG,EAAE,CAAC;AACvC,MAAM,qBAAqB,GAAG,6CAA6C,CAAC;AAE5E,SAAS,eAAe,CAAC,EAAU;IACjC,IAAI,GAAG,GA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AI,CAAC,WAAW,CAAC,CAAC;QAC7B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CACF,qCAAqC,IAAI,OAAO,WAAW,IAAI;gBAC7D,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAC3D,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -28,6 +28,16 @@ export interface LockedJsonStoreOptions<T> {
28
28
  * a {@link SKIP_WRITE} no-op.
29
29
  */
30
30
  validate?: (next: T) => void;
31
+ /**
32
+ * Degrade-not-throw for a corrupt file (CP-NODE-5's recorded design for the
33
+ * expected-submission set): a read that fails because the file exists but
34
+ * does not PARSE resolves as if the file were absent — `parse` receives
35
+ * `undefined`, so the caller's absent-path (rebuild / merge-from-nothing /
36
+ * skip) IS the degrade. Infrastructure IO errors still propagate, as does a
37
+ * `parse` that throws on its own judgment of the content. Off by default: the
38
+ * loud-fail stores (analyzer policy, remediate state) keep their refusal.
39
+ */
40
+ tolerateCorruptRead?: boolean;
31
41
  }
32
42
  export interface LockedJsonStore<T> {
33
43
  /**
@@ -58,9 +68,20 @@ export interface LockedJsonStore<T> {
58
68
  /**
59
69
  * A JSON file guarded by the shared {@link withFileLock}: read-under-lock →
60
70
  * domain parse/validate → atomic write, with the below-stale lock timeout
61
- * derived in one place. Owns only what its two real consumers share (audit
62
- * `analyzer-policy.json`, remediate `state.json`); domain validation and
63
- * public API shape stay with the thin adapters.
71
+ * derived in one place. Owns only what its consumers share (the analyzer-policy
72
+ * store, the remediate state store, and — with
73
+ * {@link LockedJsonStoreOptions.tolerateCorruptRead} the audit expected-
74
+ * submission set, whose corrupt read degrades to absent per CP-NODE-5);
75
+ * domain validation and public API shape stay with the thin adapters.
64
76
  */
65
77
  export declare function createLockedJsonStore<T>(options: LockedJsonStoreOptions<T>): LockedJsonStore<T>;
78
+ /**
79
+ * The sibling lock path for one store/ledger file: `<file>.lock`, named off the
80
+ * file's own stem so the lock is visibly the lock FOR that file rather than an
81
+ * independently invented name. Consumers that already hold an established lock
82
+ * name declare `lockPath` explicitly instead (see {@link LockedJsonStoreOptions});
83
+ * this is for the ones that own their file outright — the submission ledger,
84
+ * which appends under exactly this derivation.
85
+ */
86
+ export declare function siblingLockPath(targetPath: string): string;
66
87
  //# sourceMappingURL=lockedJsonStore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lockedJsonStore.d.ts","sourceRoot":"","sources":["../../../src/shared/io/lockedJsonStore.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,4BAA4B,QAAyC,CAAC;AAEnF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,OAAO,MAA+C,CAAC;AAEhF,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,KAAK,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,KAAK,CAAC,CAAC;IACvC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC;;;;OAIG;IACH,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IACvB;;;;;;;;OAQG;IACH,MAAM,EAAE,CACN,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,UAAU,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,UAAU,CAAC,KACvE,OAAO,CAAC,CAAC,CAAC,CAAC;IAChB;;;;;;OAMG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED;;;;;;GAMG;AACH,wBA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AgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE1D"}
@@ -1,5 +1,5 @@
1
1
  import { withFileLock, STALE_LOCK_MS } from "./fileLock.js";
2
- import { readOptionalJsonFile, writeJsonFile } from "./json.js";
2
+ import { isJsonParseError, readOptionalJsonFile, writeJsonFile, } from "./json.js";
3
3
  // Acquire timeout for a locked JSON store, DERIVED to stay safely below shared
4
4
  // fileLock's STALE_LOCK_MS rather than hardcoded — tying them programmatically so
5
5
  // the invariant can't silently drift. A fresh-but-held lock then times out
@@ -22,18 +22,34 @@ export const SKIP_WRITE = Symbol("locked-json-store/skip-write");
22
22
  /**
23
23
  * A JSON file guarded by the shared {@link withFileLock}: read-under-lock →
24
24
  * domain parse/validate → atomic write, with the below-stale lock timeout
25
- * derived in one place. Owns only what its two real consumers share (audit
26
- * `analyzer-policy.json`, remediate `state.json`); domain validation and
27
- * public API shape stay with the thin adapters.
25
+ * derived in one place. Owns only what its consumers share (the analyzer-policy
26
+ * store, the remediate state store, and — with
27
+ * {@link LockedJsonStoreOptions.tolerateCorruptRead} the audit expected-
28
+ * submission set, whose corrupt read degrades to absent per CP-NODE-5);
29
+ * domain validation and public API shape stay with the thin adapters.
28
30
  */
29
31
  export function createLockedJsonStore(options) {
30
- const { path, lockPath, parse, validate } = options;
31
- const read = async () => parse(await readOptionalJsonFile(path));
32
+ const { path, lockPath, parse, validate, tolerateCorruptRead } = options;
33
+ const read = async () => {
34
+ let raw;
35
+ try {
36
+ raw = await readOptionalJsonFile(path);
37
+ }
38
+ catch (error) {
39
+ if (!(tolerateCorruptRead && isJsonParseError(error)))
40
+ throw error;
41
+ // Degrade: a corrupt file reads as absent (see the option's note), so
42
+ // the caller's absent-path is the recovery — and the next write replaces
43
+ // the corrupt bytes wholesale.
44
+ raw = undefined;
45
+ }
46
+ return parse(raw);
47
+ };
32
48
  const persist = async (next) => {
33
49
  validate?.(next);
34
50
  await writeJsonFile(path, next);
35
51
  };
36
- return {
52
+ const store = {
37
53
  read,
38
54
  async mutate(fn) {
39
55
  let result;
@@ -55,5 +71,17 @@ export function createLockedJsonStore(options) {
55
71
  }, LOCKED_JSON_STORE_TIMEOUT_MS);
56
72
  },
57
73
  };
74
+ return store;
75
+ }
76
+ /**
77
+ * The sibling lock path for one store/ledger file: `<file>.lock`, named off the
78
+ * file's own stem so the lock is visibly the lock FOR that file rather than an
79
+ * independently invented name. Consumers that already hold an established lock
80
+ * name declare `lockPath` explicitly instead (see {@link LockedJsonStoreOptions});
81
+ * this is for the ones that own their file outright — the submission ledger,
82
+ * which appends under exactly this derivation.
83
+ */
84
+ export function siblingLockPath(targetPath) {
85
+ return `${targetPath}.lock`;
58
86
  }
59
87
  //# sourceMappingURL=lockedJsonStore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lockedJsonStore.js","sourceRoot":"","sources":["../../../src/shared/io/lockedJsonStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAEhE,+EAA+E;AAC/E,kFAAkF;AAClF,2EAA2E;AAC3E,4EAA4E;AAC5E,8EAA8E;AAC9E,4EAA4E;AAC5E,uEAAuE;AACvE,EAAE;AACF,6EAA6E;AAC7E,wEAAwE;AACxE,MAAM,sBAAsB,GAAG,MAAM,CAAC;AACtC,MAAM,CAAC,MAAM,4BAA4B,GAAG,aAAa,GAAG,sBAAsB,CAAC;AAEnF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAkB,MAAM,CAAC,8BAA8B,CAAC,CAAC;AAuDhF;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAkC;IAElC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAEpD,MAAM,IAAI,GAAG,KAAK,IAAgB,EAAE,CAClC,KAAK,CAAC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G,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC;gBAC/B,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;oBACxB,MAAM,GAAG,OAAO,CAAC;oBACjB,OAAO;gBACT,CAAC;gBACD,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;gBACpB,MAAM,GAAG,IAAI,CAAC;YAChB,CAAC,EACD,4BAA4B,CAC7B,CAAC;YACF,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,IAAI;YAChB,MAAM,YAAY,CAChB,QAAQ,EACR,KAAK,IAAI,EAAE;gBACT,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;YACtB,CAAC,EACD,4BAA4B,CAC7B,CAAC;QACJ,CAAC;KACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,OAAO,GAAG,UAAU,OAAO,CAAC;AAC9B,CAAC"}
@@ -110,9 +110,9 @@ export interface WriteStepContractInput<TStepKind extends string = string, TArti
110
110
  export declare function writeStepContract<TStep extends BaseStepContract<TStepKind, TArtifactValue>, TStepKind extends string = string, TArtifactValue extends string | null = string | null>(input: WriteStepContractInput<TStepKind, TArtifactValue>): Promise<TStep>;
111
111
  /**
112
112
  * Run `body` under the terminal-exit backstop both next-step CLIs share
113
- * (backlog: abnormal-exit no-step-contract). If `body` throws — the engine's
114
- * maxTransitions cycle abort, a mis-shaped-submission parse crash,
115
- * an IO failure — write a blocked step contract naming the cause via
113
+ * (backlog: abnormal-exit no-step-contract). If `body` throws — a
114
+ * mis-shaped-submission parse crash, a host-handoff abort, an IO failure —
115
+ * write a blocked step contract naming the cause via
116
116
  * `writeBlockedStep`, then rethrow the ORIGINAL error so the caller's exit
117
117
  * semantics (stderr report + nonzero exit) are unchanged. This guarantees the
118
118
  * step-contract property mechanically: after ANY terminal exit of a next-step
@@ -1 +1 @@
1
- {"version":3,"file":"stepContractW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AAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;CAC/C,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAc5B"}
@@ -1,4 +1,4 @@
1
- import { mkdir, writeFile, readdir, stat, rm } from "node:fs/promises";
1
+ import { mkdir, writeFile, readFile, readdir, stat, rm } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
3
  import { stepsDir } from "./auditToolsPaths.js";
4
4
  import { writeJsonFile } from "./json.js";
@@ -61,10 +61,61 @@ export function processAgentId() {
61
61
  return cachedProcessAgentId;
62
62
  }
63
63
  // Best-effort GC of stale per-agent step slots so they don't accumulate across
64
- // many next-step processes. Removes `steps/<id>/` subdirs whose `current-step.json`
65
- // is older than the TTL; never touches the shared `current-*` files (they live
66
- // directly in `steps/`, not a subdir) and never throws.
64
+ // many next-step processes. Age is necessary but NOT sufficient: a slot whose
65
+ // owner process is still alive is NEVER removed, however old its mtime (an idle
66
+ // peer's slot is old and live). Removal requires BOTH past-TTL age AND a dead
67
+ // or unidentifiable owner. Every decision is logged with its reason; never throws.
67
68
  const STEP_SLOT_TTL_MS = 60 * 60_000;
69
+ /** Liveness marker written into every per-agent slot: `{ "pid": <owner pid> }`. */
70
+ const SLOT_OWNER_FILE = "owner.json";
71
+ /**
72
+ * Every non-trivial GC decision (removal, live-peer keep, unreadable skip) is
73
+ * reported with its reason — best-effort observability on stderr, never fatal.
74
+ */
75
+ function emitSlotGc(event) {
76
+ console.warn(`[step-contract] agent-slot gc ${event.reason}: ${event.slot}${event.detail ? ` (${event.detail})` : ""}`);
77
+ }
78
+ /** Parse `a-<pid>-<ts>-<rand>` back to its pid; null when not our grammar. */
79
+ function parseAgentIdPid(agentId) {
80
+ if (!agentId.startsWith("a-"))
81
+ return null;
82
+ const pidPart = agentId.slice(2).split("-")[0];
83
+ if (!/^\d+$/.test(pidPart))
84
+ return null;
85
+ const pid = Number.parseInt(pidPart, 10);
86
+ return Number.isSafeInteger(pid) && pid > 0 ? pid : null;
87
+ }
88
+ /**
89
+ * Liveness probe for a slot's owning process. `kill(pid, 0)` sends no signal;
90
+ * it reports deliverability, so an EPERM host still learns the peer EXISTS.
91
+ */
92
+ function isProcessLive(pid) {
93
+ try {
94
+ process.kill(pid, 0);
95
+ return true;
96
+ }
97
+ catch (error) {
98
+ return error.code === "EPERM";
99
+ }
100
+ }
101
+ /**
102
+ * Resolve a slot's owner pid from its LIVENESS SIGNAL — the `owner.json`
103
+ * marker written when the slot is created — falling back to the pid embedded
104
+ * in the slot name. Null when neither yields a usable pid.
105
+ */
106
+ async function resolveOwnerPid(slot, agentName) {
107
+ try {
108
+ const raw = await readFile(join(slot, SLOT_OWNER_FILE), "utf8");
109
+ const parsed = JSON.parse(raw);
110
+ if (typeof parsed.pid === "number" && Number.isSafeInteger(parsed.pid) && parsed.pid > 0) {
111
+ return parsed.pid;
112
+ }
113
+ }
114
+ catch {
115
+ /* absent/corrupt marker — fall through to the id grammar */
116
+ }
117
+ return parseAgentIdPid(agentName);
118
+ }
68
119
  async function gcStaleAgentSlots(stepsDirPath, keepAgentId) {
69
120
  try {
70
121
  const entries = await readdir(stepsDirPath, { withFileTypes: true });
@@ -75,17 +126,45 @@ async function gcStaleAgentSlots(stepsDirPath, keepAgentId) {
75
126
  const slot = join(stepsDirPath, e.name);
76
127
  try {
77
128
  const st = await stat(join(slot, "current-step.json"));
78
- if (now - st.mtimeMs > STEP_SLOT_TTL_MS) {
79
- await rm(slot, { recursive: true, force: true });
129
+ // Young slots are the common case: silently kept, never spammed.
130
+ if (now - st.mtimeMs <= STEP_SLOT_TTL_MS) {
131
+ return;
132
+ }
133
+ // Past-TTL age alone never removes a slot: confirm the owner is
134
+ // actually gone first. An idle-but-live peer keeps its slot.
135
+ const ownerPid = await resolveOwnerPid(slot, e.name);
136
+ if (ownerPid !== null && isProcessLive(ownerPid)) {
137
+ emitSlotGc({
138
+ slot,
139
+ reason: "kept_live_peer",
140
+ detail: `owner pid ${ownerPid} alive past TTL`,
141
+ });
142
+ return;
80
143
  }
144
+ await rm(slot, { recursive: true, force: true });
145
+ emitSlotGc({
146
+ slot,
147
+ reason: "stale_and_owner_dead",
148
+ detail: ownerPid === null
149
+ ? "past TTL, no identifiable live owner"
150
+ : `past TTL, owner pid ${ownerPid} not running`,
151
+ });
81
152
  }
82
- catch {
83
- /* missing marker / race — leave it, next pass may collect it */
153
+ catch (error) {
154
+ emitSlotGc({
155
+ slot,
156
+ reason: "unreadable_marker",
157
+ detail: error instanceof Error ? error.message : String(error),
158
+ });
84
159
  }
85
160
  }));
86
161
  }
87
- catch {
88
- /* steps dir unreadable — nothing to collect */
162
+ catch (error) {
163
+ emitSlotGc({
164
+ slot: stepsDirPath,
165
+ reason: "steps_dir_unreadable",
166
+ detail: error instanceof Error ? error.message : String(error),
167
+ });
89
168
  }
90
169
  }
91
170
  /**
@@ -103,6 +182,11 @@ export async function writeStepContract(input) {
103
182
  const agentId = processAgentId();
104
183
  const agentSlotDir = join(stepsDirPath, agentId);
105
184
  await mkdir(agentSlotDir, { recursive: true });
185
+ // Liveness signal for the GC (and any external reaper): the owning pid. The
186
+ // id grammar already embeds it, but the marker is explicit, survives a rename
187
+ // of the id grammar, and is what makes "is this peer still running?" a read
188
+ // instead of an inference.
189
+ await writeFile(join(agentSlotDir, SLOT_OWNER_FILE), `${JSON.stringify({ pid: process.pid })}\n`, "utf8");
106
190
  // The returned/canonical paths are the PER-AGENT slot so a concurrent peer
107
191
  // never reads this step from a shared file another peer has clobbered.
108
192
  const promptPath = currentPromptPath(input.artifactsDir, agentId);
@@ -154,9 +238,9 @@ export async function writeStepContract(input) {
154
238
  }
155
239
  /**
156
240
  * Run `body` under the terminal-exit backstop both next-step CLIs share
157
- * (backlog: abnormal-exit no-step-contract). If `body` throws — the engine's
158
- * maxTransitions cycle abort, a mis-shaped-submission parse crash,
159
- * an IO failure — write a blocked step contract naming the cause via
241
+ * (backlog: abnormal-exit no-step-contract). If `body` throws — a
242
+ * mis-shaped-submission parse crash, a host-handoff abort, an IO failure —
243
+ * write a blocked step contract naming the cause via
160
244
  * `writeBlockedStep`, then rethrow the ORIGINAL error so the caller's exit
161
245
  * semantics (stderr report + nonzero exit) are unchanged. This guarantees the
162
246
  * step-contract property mechanically: after ANY terminal exit of a next-step
@@ -1 +1 @@
1
- {"version":3,"file":"stepContractWriter.js","sourceRoot":"","sources":["../../../src/shared/io/stepContractWriter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,YAAoB,EAAE,OAAgB;IACpE,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IACrF,OAAO,IAAI,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;AACxC,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,iBAAiB,CAAC,YAAoB,EAAE,OAAgB;IACtE,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IACrF,OAAO,IAAI,CAAC,GAAG,EAAE,m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B;QACzC,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,QAAQ,EAAE,SAAS;QACnB,MAAM,EAAE,SAAS;QACjB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,eAAe,EAAE,EAAE;QACnB,aAAa,EAAE,8BAA8B;QAC7C,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,MAAM,EAAE,uBAAuB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;QAC3D,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,EAAE;QACzC,WAAW,EAAE,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE;KACtD,CAAC,CAAC;AACL,CAAC"}
@@ -39,6 +39,14 @@ export interface ExpectedSubmissionLane {
39
39
  readonly lane: string;
40
40
  readonly submissionId: string;
41
41
  readonly promptSha256: string;
42
+ /**
43
+ * False for a lane whose submission the TOOL never reads — a host-side
44
+ * intermediate another lane consumes (the conceptual perspectives, which only
45
+ * the judge reads). Declared so the builder below can REFUSE one rather than
46
+ * mint an expectation that can never be satisfied or dropped. Absent/true is
47
+ * the ordinary lane.
48
+ */
49
+ readonly expected?: boolean;
42
50
  }
43
51
  /** Per-member verdict of a diff. */
44
52
  export type SubmissionClassification = {
@@ -60,6 +68,16 @@ export interface ExpectedSetDiff {
60
68
  * Build the set one emission owes. Entries are ordered by `submission_id` — a
61
69
  * content-derived key, never emission or filesystem order, so re-recording an
62
70
  * unchanged set produces byte-identical content.
71
+ *
72
+ * A lane declaring `expected: false` is REFUSED here, at the ONE seam every
73
+ * emitter builds its set through: the tool never reads that lane's submission,
74
+ * so an expectation recorded against it can never be satisfied or dropped —
75
+ * it would accumulate as a permanent, false shortfall the run reports forever.
76
+ * Throwing (not filtering) is the fail-closed shape: a caller that routes its
77
+ * un-expected lanes through this builder anyway has misstated what it owes,
78
+ * and a silently narrowed set would hide exactly that. The audit draw's
79
+ * materializer filters at its own boundary first; this is the backstop that
80
+ * makes the filter's omission non-optional.
63
81
  */
64
82
  export declare function buildExpectedSubmissionSet(params: {
65
83
  readonly runId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"expectedSubmissions.d.ts","sourceRoot":"","sources":["../../../src/shared/submission/expectedSubmissions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,eAAO,MAAM,6BAA6B,EACxC,kCAA2C,CAAC;AAE9C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,6EAA6E;IAC7E,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,6BAA6B,CAAC;IAChE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACjD;AAED,uDAAuD;AACvD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,oCAAoC;AACpC,MAAM,MAAM,wBAAwB,GAChC;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GAC/D;IACE,QAAQ,CAAC,MAAM,EAAE,OAAO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