audit-tools 0.45.0 → 0.48.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 (288) hide show
  1. package/README.md +51 -18
  2. package/dispatch/merge-results.mjs +3 -3
  3. package/dispatch/validate-result.mjs +3 -3
  4. package/dist/audit/cli/charterExtractionPrompt.d.ts.map +1 -1
  5. package/dist/audit/cli/charterExtractionPrompt.js +11 -1
  6. package/dist/audit/cli/charterExtractionPrompt.js.map +1 -1
  7. package/dist/audit/cli/cleanupCommand.d.ts +25 -0
  8. package/dist/audit/cli/cleanupCommand.d.ts.map +1 -1
  9. package/dist/audit/cli/cleanupCommand.js +76 -1
  10. package/dist/audit/cli/cleanupCommand.js.map +1 -1
  11. package/dist/audit/cli/dispatch/hostHandoff.d.ts.map +1 -1
  12. package/dist/audit/cli/dispatch/hostHandoff.js +52 -76
  13. package/dist/audit/cli/dispatch/hostHandoff.js.map +1 -1
  14. package/dist/audit/cli/dispatch/packetFilter.d.ts +1 -1
  15. package/dist/audit/cli/fanoutLanes.d.ts.map +1 -1
  16. package/dist/audit/cli/fanoutLanes.js +6 -1
  17. package/dist/audit/cli/fanoutLanes.js.map +1 -1
  18. package/dist/audit/cli/laneSubmissions.d.ts +13 -0
  19. package/dist/audit/cli/laneSubmissions.d.ts.map +1 -1
  20. package/dist/audit/cli/laneSubmissions.js +38 -27
  21. package/dist/audit/cli/laneSubmissions.js.map +1 -1
  22. package/dist/audit/cli/nextStepCommand.d.ts +12 -0
  23. package/dist/audit/cli/nextStepCommand.d.ts.map +1 -1
  24. package/dist/audit/cli/nextStepCommand.js +23 -12
  25. package/dist/audit/cli/nextStepCommand.js.map +1 -1
  26. package/dist/audit/cli/nextStepHelpers.d.ts +3 -2
  27. package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
  28. package/dist/audit/cli/nextStepHelpers.js +65 -37
  29. package/dist/audit/cli/nextStepHelpers.js.map +1 -1
  30. package/dist/audit/cli/reviewRun.d.ts +1 -1
  31. package/dist/audit/cli/reviewRun.d.ts.map +1 -1
  32. package/dist/audit/cli/reviewRun.js +2 -9
  33. package/dist/audit/cli/reviewRun.js.map +1 -1
  34. package/dist/audit/cli/sampleRunCommand.d.ts +215 -0
  35. package/dist/audit/cli/sampleRunCommand.d.ts.map +1 -1
  36. package/dist/audit/cli/sampleRunCommand.js +60 -3
  37. package/dist/audit/cli/sampleRunCommand.js.map +1 -1
  38. package/dist/audit/cli/semanticReviewStep.d.ts.map +1 -1
  39. package/dist/audit/cli/semanticReviewStep.js +9 -1
  40. package/dist/audit/cli/semanticReviewStep.js.map +1 -1
  41. package/dist/audit/cli/steps.d.ts +6 -6
  42. package/dist/audit/contracts/workerSchemas.d.ts +36 -26
  43. package/dist/audit/contracts/workerSchemas.d.ts.map +1 -1
  44. package/dist/audit/contracts/workerSchemas.js +11 -1
  45. package/dist/audit/contracts/workerSchemas.js.map +1 -1
  46. package/dist/audit/contracts/wrapperResponse.d.ts +52 -28
  47. package/dist/audit/contracts/wrapperResponse.d.ts.map +1 -1
  48. package/dist/audit/contracts/wrapperResponse.js +8 -5
  49. package/dist/audit/contracts/wrapperResponse.js.map +1 -1
  50. package/dist/audit/decompose/sources.d.ts.map +1 -1
  51. package/dist/audit/decompose/sources.js +21 -5
  52. package/dist/audit/decompose/sources.js.map +1 -1
  53. package/dist/audit/extractors/analyzers/registry.d.ts +8 -5
  54. package/dist/audit/extractors/analyzers/registry.d.ts.map +1 -1
  55. package/dist/audit/extractors/analyzers/registry.js +28 -7
  56. package/dist/audit/extractors/analyzers/registry.js.map +1 -1
  57. package/dist/audit/extractors/designAssessment.js +1 -1
  58. package/dist/audit/extractors/gitHistory.d.ts +1 -1
  59. package/dist/audit/extractors/gitHistory.js +1 -1
  60. package/dist/audit/extractors/graph.d.ts +1 -1
  61. package/dist/audit/extractors/graph.js +1 -1
  62. package/dist/audit/extractors/risk.d.ts +1 -1
  63. package/dist/audit/extractors/risk.js +1 -1
  64. package/dist/audit/io/artifacts.d.ts.map +1 -1
  65. package/dist/audit/io/artifacts.js +5 -5
  66. package/dist/audit/io/artifacts.js.map +1 -1
  67. package/dist/audit/orchestrator/acquisitionExecutor.d.ts +12 -7
  68. package/dist/audit/orchestrator/acquisitionExecutor.d.ts.map +1 -1
  69. package/dist/audit/orchestrator/acquisitionExecutor.js +1 -1
  70. package/dist/audit/orchestrator/acquisitionExecutor.js.map +1 -1
  71. package/dist/audit/orchestrator/advance.d.ts +14 -10
  72. package/dist/audit/orchestrator/advance.d.ts.map +1 -1
  73. package/dist/audit/orchestrator/advance.js +49 -24
  74. package/dist/audit/orchestrator/advance.js.map +1 -1
  75. package/dist/audit/orchestrator/advanceTypes.d.ts +14 -0
  76. package/dist/audit/orchestrator/advanceTypes.d.ts.map +1 -1
  77. package/dist/audit/orchestrator/autoFixExecutor.d.ts +20 -1
  78. package/dist/audit/orchestrator/autoFixExecutor.d.ts.map +1 -1
  79. package/dist/audit/orchestrator/autoFixExecutor.js +77 -15
  80. package/dist/audit/orchestrator/autoFixExecutor.js.map +1 -1
  81. package/dist/audit/orchestrator/dependencyMap.js +1 -1
  82. package/dist/audit/orchestrator/dependencyMap.js.map +1 -1
  83. package/dist/audit/orchestrator/designReviewPrompt.d.ts.map +1 -1
  84. package/dist/audit/orchestrator/designReviewPrompt.js +7 -0
  85. package/dist/audit/orchestrator/designReviewPrompt.js.map +1 -1
  86. package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -1
  87. package/dist/audit/orchestrator/executorRunners.js +18 -4
  88. package/dist/audit/orchestrator/executorRunners.js.map +1 -1
  89. package/dist/audit/orchestrator/executors.d.ts +54 -0
  90. package/dist/audit/orchestrator/executors.d.ts.map +1 -1
  91. package/dist/audit/orchestrator/executors.js +352 -0
  92. package/dist/audit/orchestrator/executors.js.map +1 -1
  93. package/dist/audit/orchestrator/hostInputPause.d.ts +28 -13
  94. package/dist/audit/orchestrator/hostInputPause.d.ts.map +1 -1
  95. package/dist/audit/orchestrator/hostInputPause.js +17 -11
  96. package/dist/audit/orchestrator/hostInputPause.js.map +1 -1
  97. package/dist/audit/orchestrator/intentInterpreter.d.ts +15 -18
  98. package/dist/audit/orchestrator/intentInterpreter.d.ts.map +1 -1
  99. package/dist/audit/orchestrator/intentInterpreter.js +12 -26
  100. package/dist/audit/orchestrator/intentInterpreter.js.map +1 -1
  101. package/dist/audit/orchestrator/localCommands.d.ts +24 -1
  102. package/dist/audit/orchestrator/localCommands.d.ts.map +1 -1
  103. package/dist/audit/orchestrator/localCommands.js +44 -9
  104. package/dist/audit/orchestrator/localCommands.js.map +1 -1
  105. package/dist/audit/orchestrator/nextStep.d.ts +13 -0
  106. package/dist/audit/orchestrator/nextStep.d.ts.map +1 -1
  107. package/dist/audit/orchestrator/nextStep.js +13 -0
  108. package/dist/audit/orchestrator/nextStep.js.map +1 -1
  109. package/dist/audit/orchestrator/requeueCommand.d.ts +1 -1
  110. package/dist/audit/orchestrator/runtimeCommand.d.ts +32 -1
  111. package/dist/audit/orchestrator/runtimeCommand.d.ts.map +1 -1
  112. package/dist/audit/orchestrator/runtimeCommand.js +90 -3
  113. package/dist/audit/orchestrator/runtimeCommand.js.map +1 -1
  114. package/dist/audit/orchestrator/structureExecutors.js +1 -1
  115. package/dist/audit/orchestrator/structureExecutors.js.map +1 -1
  116. package/dist/audit/orchestrator/syntaxResolutionExecutor.d.ts +11 -1
  117. package/dist/audit/orchestrator/syntaxResolutionExecutor.d.ts.map +1 -1
  118. package/dist/audit/orchestrator/syntaxResolutionExecutor.js +25 -9
  119. package/dist/audit/orchestrator/syntaxResolutionExecutor.js.map +1 -1
  120. package/dist/audit/supervisor/operatorHandoff.d.ts +0 -1
  121. package/dist/audit/supervisor/operatorHandoff.d.ts.map +1 -1
  122. package/dist/audit/supervisor/operatorHandoff.js +2 -1
  123. package/dist/audit/supervisor/operatorHandoff.js.map +1 -1
  124. package/dist/audit/types.d.ts +18 -18
  125. package/dist/remediate/contractPipeline/derive.d.ts.map +1 -1
  126. package/dist/remediate/contractPipeline/derive.js +1 -0
  127. package/dist/remediate/contractPipeline/derive.js.map +1 -1
  128. package/dist/remediate/contractPipeline/semanticProjection.d.ts +5 -4
  129. package/dist/remediate/contractPipeline/semanticProjection.d.ts.map +1 -1
  130. package/dist/remediate/contractPipeline/semanticProjection.js +34 -19
  131. package/dist/remediate/contractPipeline/semanticProjection.js.map +1 -1
  132. package/dist/remediate/index.d.ts.map +1 -1
  133. package/dist/remediate/index.js +3 -2
  134. package/dist/remediate/index.js.map +1 -1
  135. package/dist/remediate/intake.js +1 -1
  136. package/dist/remediate/intake.js.map +1 -1
  137. package/dist/remediate/phases/close.d.ts +45 -2
  138. package/dist/remediate/phases/close.d.ts.map +1 -1
  139. package/dist/remediate/phases/close.js +111 -43
  140. package/dist/remediate/phases/close.js.map +1 -1
  141. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js +2 -2
  142. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js.map +1 -1
  143. package/dist/remediate/phases/triage.d.ts.map +1 -1
  144. package/dist/remediate/phases/triage.js +61 -19
  145. package/dist/remediate/phases/triage.js.map +1 -1
  146. package/dist/remediate/review/autonomousGate.d.ts +3 -7
  147. package/dist/remediate/review/autonomousGate.d.ts.map +1 -1
  148. package/dist/remediate/review/autonomousGate.js +10 -24
  149. package/dist/remediate/review/autonomousGate.js.map +1 -1
  150. package/dist/remediate/riskSignal.d.ts +8 -20
  151. package/dist/remediate/riskSignal.d.ts.map +1 -1
  152. package/dist/remediate/riskSignal.js +21 -76
  153. package/dist/remediate/riskSignal.js.map +1 -1
  154. package/dist/remediate/state/accessMemory.d.ts +2 -3
  155. package/dist/remediate/state/accessMemory.d.ts.map +1 -1
  156. package/dist/remediate/state/accessMemory.js +3 -6
  157. package/dist/remediate/state/accessMemory.js.map +1 -1
  158. package/dist/remediate/state/store.d.ts +6 -7
  159. package/dist/remediate/state/store.d.ts.map +1 -1
  160. package/dist/remediate/state/store.js.map +1 -1
  161. package/dist/remediate/state/types.d.ts +2 -84
  162. package/dist/remediate/state/types.d.ts.map +1 -1
  163. package/dist/remediate/state/types.js +1 -39
  164. package/dist/remediate/state/types.js.map +1 -1
  165. package/dist/remediate/steps/contractPipeline.d.ts +13 -19
  166. package/dist/remediate/steps/contractPipeline.d.ts.map +1 -1
  167. package/dist/remediate/steps/contractPipeline.js +157 -66
  168. package/dist/remediate/steps/contractPipeline.js.map +1 -1
  169. package/dist/remediate/steps/dispatch/hostHandoff.d.ts +1 -1
  170. package/dist/remediate/steps/dispatch/hostHandoff.d.ts.map +1 -1
  171. package/dist/remediate/steps/dispatch/hostHandoff.js +297 -141
  172. package/dist/remediate/steps/dispatch/hostHandoff.js.map +1 -1
  173. package/dist/remediate/steps/nextStep.d.ts +16 -7
  174. package/dist/remediate/steps/nextStep.d.ts.map +1 -1
  175. package/dist/remediate/steps/nextStep.js +207 -216
  176. package/dist/remediate/steps/nextStep.js.map +1 -1
  177. package/dist/remediate/steps/stepUtils.d.ts +10 -2
  178. package/dist/remediate/steps/stepUtils.d.ts.map +1 -1
  179. package/dist/remediate/steps/stepUtils.js +13 -3
  180. package/dist/remediate/steps/stepUtils.js.map +1 -1
  181. package/dist/remediate/steps/types.d.ts +1 -1
  182. package/dist/remediate/steps/types.d.ts.map +1 -1
  183. package/dist/remediate/steps/types.js.map +1 -1
  184. package/dist/remediate/types/options.d.ts +1 -1
  185. package/dist/remediate/validation/artifacts.d.ts.map +1 -1
  186. package/dist/remediate/validation/artifacts.js +1 -16
  187. package/dist/remediate/validation/artifacts.js.map +1 -1
  188. package/dist/remediate/validation/remediationState.d.ts +0 -1
  189. package/dist/remediate/validation/remediationState.d.ts.map +1 -1
  190. package/dist/remediate/validation/remediationState.js +0 -51
  191. package/dist/remediate/validation/remediationState.js.map +1 -1
  192. package/dist/shared/analyzerPolicy.d.ts +18 -6
  193. package/dist/shared/analyzerPolicy.d.ts.map +1 -1
  194. package/dist/shared/analyzerPolicy.js +15 -3
  195. package/dist/shared/analyzerPolicy.js.map +1 -1
  196. package/dist/shared/analyzers/acquisitionEngine.d.ts +71 -32
  197. package/dist/shared/analyzers/acquisitionEngine.d.ts.map +1 -1
  198. package/dist/shared/analyzers/acquisitionEngine.js +86 -28
  199. package/dist/shared/analyzers/acquisitionEngine.js.map +1 -1
  200. package/dist/shared/analyzers/binaryAcquisition.d.ts +8 -2
  201. package/dist/shared/analyzers/binaryAcquisition.d.ts.map +1 -1
  202. package/dist/shared/analyzers/binaryAcquisition.js +4 -4
  203. package/dist/shared/analyzers/binaryAcquisition.js.map +1 -1
  204. package/dist/shared/constitutionalDocPaths.d.ts.map +1 -1
  205. package/dist/shared/constitutionalDocPaths.js +7 -0
  206. package/dist/shared/constitutionalDocPaths.js.map +1 -1
  207. package/dist/shared/engine/obligationEngine.d.ts +44 -3
  208. package/dist/shared/engine/obligationEngine.d.ts.map +1 -1
  209. package/dist/shared/engine/obligationEngine.js +53 -7
  210. package/dist/shared/engine/obligationEngine.js.map +1 -1
  211. package/dist/shared/findings/dedupe.d.ts.map +1 -1
  212. package/dist/shared/findings/dedupe.js +8 -0
  213. package/dist/shared/findings/dedupe.js.map +1 -1
  214. package/dist/shared/friction/frictionRecord.d.ts +42 -2
  215. package/dist/shared/friction/frictionRecord.d.ts.map +1 -1
  216. package/dist/shared/friction/frictionRecord.js +111 -3
  217. package/dist/shared/friction/frictionRecord.js.map +1 -1
  218. package/dist/shared/friction/triage.d.ts +15 -0
  219. package/dist/shared/friction/triage.d.ts.map +1 -1
  220. package/dist/shared/friction/triage.js +33 -2
  221. package/dist/shared/friction/triage.js.map +1 -1
  222. package/dist/shared/index.d.ts +15 -9
  223. package/dist/shared/index.d.ts.map +1 -1
  224. package/dist/shared/index.js +15 -7
  225. package/dist/shared/index.js.map +1 -1
  226. package/dist/shared/intent/constraintClauses.d.ts +31 -0
  227. package/dist/shared/intent/constraintClauses.d.ts.map +1 -0
  228. package/dist/shared/intent/constraintClauses.js +37 -0
  229. package/dist/shared/intent/constraintClauses.js.map +1 -0
  230. package/dist/shared/io/fileLock.d.ts.map +1 -1
  231. package/dist/shared/io/fileLock.js +22 -3
  232. package/dist/shared/io/fileLock.js.map +1 -1
  233. package/dist/shared/io/frictionCapture.d.ts +73 -19
  234. package/dist/shared/io/frictionCapture.d.ts.map +1 -1
  235. package/dist/shared/io/frictionCapture.js +21 -30
  236. package/dist/shared/io/frictionCapture.js.map +1 -1
  237. package/dist/shared/io/lockedJsonStore.d.ts +24 -3
  238. package/dist/shared/io/lockedJsonStore.d.ts.map +1 -1
  239. package/dist/shared/io/lockedJsonStore.js +35 -7
  240. package/dist/shared/io/lockedJsonStore.js.map +1 -1
  241. package/dist/shared/io/stepContractWriter.d.ts +3 -3
  242. package/dist/shared/io/stepContractWriter.d.ts.map +1 -1
  243. package/dist/shared/io/stepContractWriter.js +97 -13
  244. package/dist/shared/io/stepContractWriter.js.map +1 -1
  245. package/dist/shared/submission/expectedSubmissions.d.ts +18 -0
  246. package/dist/shared/submission/expectedSubmissions.d.ts.map +1 -1
  247. package/dist/shared/submission/expectedSubmissions.js +17 -0
  248. package/dist/shared/submission/expectedSubmissions.js.map +1 -1
  249. package/dist/shared/submission/handRecovery.d.ts.map +1 -1
  250. package/dist/shared/submission/handRecovery.js +9 -11
  251. package/dist/shared/submission/handRecovery.js.map +1 -1
  252. package/dist/shared/submission/hostHandoffCore.d.ts +155 -0
  253. package/dist/shared/submission/hostHandoffCore.d.ts.map +1 -0
  254. package/dist/shared/submission/hostHandoffCore.js +210 -0
  255. package/dist/shared/submission/hostHandoffCore.js.map +1 -0
  256. package/dist/shared/submission/submissionLedger.d.ts +5 -1
  257. package/dist/shared/submission/submissionLedger.d.ts.map +1 -1
  258. package/dist/shared/submission/submissionLedger.js +33 -3
  259. package/dist/shared/submission/submissionLedger.js.map +1 -1
  260. package/dist/shared/tooling/commandShape.d.ts +29 -0
  261. package/dist/shared/tooling/commandShape.d.ts.map +1 -1
  262. package/dist/shared/tooling/commandShape.js +82 -10
  263. package/dist/shared/tooling/commandShape.js.map +1 -1
  264. package/dist/shared/tooling/exec.d.ts +32 -0
  265. package/dist/shared/tooling/exec.d.ts.map +1 -1
  266. package/dist/shared/tooling/exec.js +189 -0
  267. package/dist/shared/tooling/exec.js.map +1 -1
  268. package/docs/audit-pkg/contracts.md +2 -1
  269. package/docs/audit-pkg/operator-guide.md +12 -6
  270. package/docs/audit-pkg/product.md +22 -6
  271. package/package.json +13 -6
  272. package/schemas/audit-code-v1alpha1.schema.json +297 -0
  273. package/schemas/audit_result.schema.json +4 -0
  274. package/schemas/audit_results.schema.json +4 -0
  275. package/scripts/audit/postinstall.mjs +4 -2
  276. package/scripts/postinstall.mjs +1 -1
  277. package/scripts/remediate/postinstall.mjs +3 -1
  278. package/scripts/shared/install-host-assets.mjs +15 -8
  279. package/skills/audit-code/SKILL.md +4 -2
  280. package/skills/audit-code/audit-code.prompt.md +5 -2
  281. package/skills/audit-code/opencode-command-template.txt +1 -1
  282. package/wrapper/audit-code-wrapper-build.mjs +3 -3
  283. package/wrapper/audit-code-wrapper-install-hosts.mjs +3 -3
  284. package/wrapper/audit-code-wrapper-lib.mjs +82 -16
  285. package/wrapper/installer-verb-help.mjs +14 -4
  286. package/wrapper/remediate-code-wrapper-install-hosts.mjs +3 -3
  287. package/docs/audit-pkg/development.md +0 -113
  288. package/docs/audit-pkg/release.md +0 -140
@@ -0,0 +1,155 @@
1
+ /** Code-unit lexical order — the shared comparator for every id sort here. */
2
+ export declare function compareCodeUnits(left: string, right: string): number;
3
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
4
+ /** Exact key set, order-insensitive: a persisted envelope admits no extra keys. */
5
+ export declare function hasExactKeys(value: Record<string, unknown>, expected: readonly string[]): boolean;
6
+ export declare function isSha256(value: unknown): value is string;
7
+ /** Full sha1/sha256 commit id — the only form a baseline may take. */
8
+ export declare function isCommit(value: unknown): value is string;
9
+ export declare function requireNonEmptyString(value: unknown, label: string): string;
10
+ export declare function stringArray(value: unknown): readonly string[] | null;
11
+ /** Element-wise equality of two string arrays (order-significant). */
12
+ export declare function sameStrings(left: readonly string[], right: readonly string[]): boolean;
13
+ /** The dedupe key for an accepted binding: work item × prompt digest. */
14
+ export declare function bindingIdentity(entry: {
15
+ readonly work_item_id: string;
16
+ readonly prompt_sha256: string;
17
+ }): string;
18
+ /**
19
+ * The run-scoped paths one host-handoff boundary lives at.
20
+ *
21
+ * Both twins resolved these with the same three calls (`assertSubmissionRunId`,
22
+ * containment on the artifacts dir, containment on `runs/<runId>`), differing
23
+ * only in whether the run directory carried a sub-segment. The sub-segment is a
24
+ * parameter here, not a fork: remediate's run dir sits under `runs/<id>/implement`
25
+ * because its runs dir also holds triage/closing lanes; audit's sits directly
26
+ * under `runs/<id>`.
27
+ */
28
+ export interface HostHandoffPaths {
29
+ /** Absolute repository root everything is contained beneath. */
30
+ readonly root: string;
31
+ /** Absolute artifacts dir (`.audit-tools/<tool>/`). */
32
+ readonly artifactsDir: string;
33
+ /** Absolute run directory the workload and results live under. */
34
+ readonly runDir: string;
35
+ /** Absolute directory submissions land in. */
36
+ readonly resultDir: string;
37
+ /** Absolute path of the persisted workload document. */
38
+ readonly workloadPath: string;
39
+ }
40
+ /**
41
+ * Resolve the run-scoped boundary paths. Throws when the run id leaves the
42
+ * shared grammar or either declared root escapes containment — before any
43
+ * caller has a path to write to.
44
+ */
45
+ export declare function resolveHostHandoffPaths(params: {
46
+ readonly root: string;
47
+ readonly artifactsDir: string;
48
+ readonly runId: string;
49
+ /**
50
+ * Segments between the RUN DIRECTORY and its lane sub-directory — i.e. AFTER
51
+ * the run id: `runs/<runId>/<segments…>`. Empty for audit's flat
52
+ * `runs/<runId>/`; `["implement"]` for remediate's lane-scoped one. Order is
53
+ * load-bearing: validators join submissions to their run by the FIRST path
54
+ * segment under `runs/`, so the run id must stay that segment.
55
+ */
56
+ readonly runDirSegments?: readonly string[];
57
+ /** Names this draw in the run-id refusal (`Invalid <label>: …`). */
58
+ readonly runIdLabel?: string;
59
+ }): HostHandoffPaths;
60
+ /**
61
+ * The bound path for one work item's submission — the SHARED rule, not a local
62
+ * copy of it. `<resultDir>/<sha256(id)>.json`, repository-relative and
63
+ * forward-slashed. This replaces the byte-equivalent private `resultPathFor`
64
+ * copies both twins carried; a divergence between them would have been silent
65
+ * on both sides.
66
+ */
67
+ export declare function hostHandoffResultPath(paths: HostHandoffPaths, id: string): string;
68
+ /** Absolute form of {@link hostHandoffResultPath}, for readers on disk. */
69
+ export declare function absoluteHostHandoffResultPath(paths: HostHandoffPaths, id: string): string;
70
+ /** Content digest of one prompt text — the binding between ask and answer. */
71
+ export declare function promptSha256(promptText: string): string;
72
+ /** Content digest of one canonical JSON rendering. */
73
+ export declare function contentSha256(value: unknown): string;
74
+ export type WorkloadEnvelopeParse = {
75
+ readonly ok: true;
76
+ readonly rawItems: readonly unknown[];
77
+ } | {
78
+ readonly ok: false;
79
+ };
80
+ /**
81
+ * Validate a persisted workload ENVELOPE against this run: exact keys, the
82
+ * draw's contract version, the run id, and an array of raw items. Item-level
83
+ * shape is the draw's parser ({@link parseAllWorkloadItems}); anything the
84
+ * persisted trusted binding further pins (a digest, a baseline) is the draw's
85
+ * policy layered on top of the `ok` case.
86
+ */
87
+ export declare function parseWorkloadEnvelope(value: unknown, params: {
88
+ readonly contractVersion: string;
89
+ readonly runId: string;
90
+ }): WorkloadEnvelopeParse;
91
+ /** Map raw items through the draw's parser; `null` when ANY item refuses. */
92
+ export declare function parseAllWorkloadItems<T>(rawItems: readonly unknown[], parseItem: (raw: unknown) => T | null): readonly T[] | null;
93
+ /** Every id distinct — the duplicate-work-item refusal. */
94
+ export declare function idsAreUnique(ids: readonly string[]): boolean;
95
+ /**
96
+ * Strictly ascending in code-unit order — which is BOTH "sorted" and
97
+ * "duplicate-free", the two properties every persisted workload's id list must
98
+ * have for a re-derivation to compare equal byte-for-byte.
99
+ */
100
+ export declare function idsAreStrictlyAscending(ids: readonly string[]): boolean;
101
+ /**
102
+ * The identity binding EVERY submitted result carries, identical on both
103
+ * draws: a non-empty `result_id`, this run's id, this work item's id, and the
104
+ * prompt digest of the ask. A refusal here is a REFUSAL, never a repair — the
105
+ * tool cannot know which of the three the host meant.
106
+ */
107
+ export declare function resultIdentityIsBound(value: Record<string, unknown>, params: {
108
+ readonly runId: string;
109
+ readonly workItemId: string;
110
+ readonly promptSha256: string;
111
+ }): boolean;
112
+ /** The minimal view of a parsed work item the result-map check needs. */
113
+ export interface ResultMappedItem {
114
+ readonly id: string;
115
+ readonly prompt: {
116
+ readonly sha256: string;
117
+ };
118
+ readonly result_path: string;
119
+ }
120
+ /** One `host-result-map.json` entry, as both draws persist it. */
121
+ export interface ResultMapEntry {
122
+ readonly work_item_id: string;
123
+ readonly prompt_sha256: string;
124
+ readonly result_path: string;
125
+ }
126
+ /**
127
+ * RESULT-MAP IDENTITY: the map names exactly the workload's items, once each,
128
+ * with each item's own prompt digest and derived bound path. This was the
129
+ * second half of the audit twin's `validateHandoffBinding`, hand-inlined there;
130
+ * the remediate draw pins the same facts through its whole-document digest
131
+ * instead — but the CHECK itself is the draw-independent statement of "the map
132
+ * and the workload agree", so it lives here for whichever draw parses a map.
133
+ *
134
+ * The failure is CLASSIFIED, not collapsed: `coverage` means the map does not
135
+ * name this workload's items exactly once each; `identity` means an entry
136
+ * names the right item but pins another item's prompt digest or a bound path
137
+ * the shared rule does not derive. The two are not interchangeable to the
138
+ * caller — one says the MAP is wrong, the other names the BINDING that broke.
139
+ */
140
+ export type ResultMapIdentity<TItem extends ResultMappedItem> = {
141
+ readonly ok: true;
142
+ readonly byId: ReadonlyMap<string, TItem>;
143
+ } | {
144
+ readonly ok: false;
145
+ readonly reason: "coverage" | "identity";
146
+ readonly workItemId?: string;
147
+ };
148
+ export declare function resultMapIdentity<TItem extends ResultMappedItem>(items: readonly TItem[], entries: readonly ResultMapEntry[]): ResultMapIdentity<TItem>;
149
+ /**
150
+ * First duplicate identity in `entries`, or null. The accepted-results ledger
151
+ * and any other keyed record derives its dedupe refusal from this rather than
152
+ * from a hand-rolled Set walk whose message and predicate can drift apart.
153
+ */
154
+ export declare function firstDuplicateIdentity<T>(entries: readonly T[], identity: (entry: T) => string): T | null;
155
+ //# sourceMappingURL=hostHandoffCore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hostHandoffCore.d.ts","sourceRoot":"","sources":["../../../src/shared/submission/hostHandoffCore.ts"],"names":[],"mappings":"AA0BA,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED,mFAAmF;AACnF,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC1B,OAAO,CAQT;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD;AAED,sEAAsE;AACtE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAKxD;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK3E;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,GAAG,IAAI,CAIpE;AAED,sEAAsE;AACtE,wBAAgB,WAAW,CACzB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,OAAO,CAKT;AASD,yEAAyE;AACzE,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC,GAAG,MAAM,CAET;AAED;;;;;;;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AAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,iBAAiB,CAAC,KAAK,SAAS,gBAAgB,IACxD;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;CAAE,GAChE;IACE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;IACzC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEN,wBAAgB,iBAAiB,CAAC,KAAK,SAAS,gBAAgB,EAC9D,KAAK,EAAE,SAAS,KAAK,EAAE,EACvB,OAAO,EAAE,SAAS,cAAc,EAAE,GACjC,iBAAiB,CAAC,KAAK,CAAC,CAsB1B;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,OAAO,EAAE,SAAS,CAAC,EAAE,EACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,GAC7B,CAAC,GAAG,IAAI,CAQV"}
@@ -0,0 +1,210 @@
1
+ /**
2
+ * The ONE host-handoff boundary both orchestrators draw from.
3
+ *
4
+ * The audit host handoff (`src/audit/cli/dispatch/hostHandoff.ts`) and the
5
+ * remediation one (`src/remediate/steps/dispatch/hostHandoff.ts`) were two
6
+ * independently evolved bodies that had already converged on the same skeleton:
7
+ * resolve a run-scoped boundary, derive each work item's bound result path
8
+ * through the shared submission-path rule, hash the prompt, validate the
9
+ * workload against its bindings, and refuse a result whose identity, prompt
10
+ * binding, or result-map entry does not match the derivation. Every place they
11
+ * differed in TEXT but not in MEANING is what this core owns now; what remains
12
+ * in each twin is its DRAW — the contract versions and shapes it persists, the
13
+ * domain validation it applies on top, the state it mutates.
14
+ */
15
+ // Sibling modules imported DIRECTLY, never through ../index.js: the barrel
16
+ // re-exports this module, so importing the barrel here would close a cycle
17
+ // (index → hostHandoffCore → index) that check:depgraph refuses.
18
+ import { hashContent } from "../hash.js";
19
+ import { stableStringify } from "../stableStringify.js";
20
+ import { assertSubmissionRunId, resolveContainedPath, submissionPathFor, } from "./submissionIdentity.js";
21
+ import { join, resolve } from "node:path";
22
+ /** Code-unit lexical order — the shared comparator for every id sort here. */
23
+ export function compareCodeUnits(left, right) {
24
+ return left < right ? -1 : left > right ? 1 : 0;
25
+ }
26
+ export function isRecord(value) {
27
+ return typeof value === "object" && value !== null && !Array.isArray(value);
28
+ }
29
+ /** Exact key set, order-insensitive: a persisted envelope admits no extra keys. */
30
+ export function hasExactKeys(value, expected) {
31
+ const actual = Object.keys(value).sort(compareCodeUnits);
32
+ return (actual.length === expected.length &&
33
+ actual.every((key, index) => key === [...expected].sort(compareCodeUnits)[index]));
34
+ }
35
+ export function isSha256(value) {
36
+ return typeof value === "string" && /^[0-9a-f]{64}$/u.test(value);
37
+ }
38
+ /** Full sha1/sha256 commit id — the only form a baseline may take. */
39
+ export function isCommit(value) {
40
+ return (typeof value === "string" &&
41
+ /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u.test(value));
42
+ }
43
+ export function requireNonEmptyString(value, label) {
44
+ if (typeof value !== "string" || value.length === 0) {
45
+ throw new Error(`${label} must be a non-empty string`);
46
+ }
47
+ return value;
48
+ }
49
+ export function stringArray(value) {
50
+ return Array.isArray(value) && value.every((entry) => typeof entry === "string")
51
+ ? value
52
+ : null;
53
+ }
54
+ /** Element-wise equality of two string arrays (order-significant). */
55
+ export function sameStrings(left, right) {
56
+ return (left.length === right.length &&
57
+ left.every((entry, index) => entry === right[index]));
58
+ }
59
+ /**
60
+ * The dedupe key for an accepted binding: work item × prompt digest, joined by
61
+ * NUL (`String.fromCharCode(0)` in source — never the raw control byte in this
62
+ * file, which git would treat as binary).
63
+ */
64
+ const BINDING_IDENTITY_SEPARATOR = String.fromCharCode(0);
65
+ /** The dedupe key for an accepted binding: work item × prompt digest. */
66
+ export function bindingIdentity(entry) {
67
+ return `${entry.work_item_id}${BINDING_IDENTITY_SEPARATOR}${entry.prompt_sha256}`;
68
+ }
69
+ /**
70
+ * Resolve the run-scoped boundary paths. Throws when the run id leaves the
71
+ * shared grammar or either declared root escapes containment — before any
72
+ * caller has a path to write to.
73
+ */
74
+ export function resolveHostHandoffPaths(params) {
75
+ assertSubmissionRunId(params.runId, params.runIdLabel ?? "host handoff run id");
76
+ const root = resolve(params.root);
77
+ const artifactsDir = resolveContainedPath(root, params.artifactsDir, "artifactsDir");
78
+ const segments = params.runDirSegments ?? [];
79
+ const runDir = resolveContainedPath(artifactsDir, join("runs", params.runId, ...segments), "host handoff run directory");
80
+ return {
81
+ root,
82
+ artifactsDir,
83
+ runDir,
84
+ resultDir: join(runDir, "host-results"),
85
+ workloadPath: join(runDir, "host-workload.json"),
86
+ };
87
+ }
88
+ /**
89
+ * The bound path for one work item's submission — the SHARED rule, not a local
90
+ * copy of it. `<resultDir>/<sha256(id)>.json`, repository-relative and
91
+ * forward-slashed. This replaces the byte-equivalent private `resultPathFor`
92
+ * copies both twins carried; a divergence between them would have been silent
93
+ * on both sides.
94
+ */
95
+ export function hostHandoffResultPath(paths, id) {
96
+ return submissionPathFor({ root: paths.root, submissionDir: paths.resultDir }, id);
97
+ }
98
+ /** Absolute form of {@link hostHandoffResultPath}, for readers on disk. */
99
+ export function absoluteHostHandoffResultPath(paths, id) {
100
+ return resolveContainedPath(paths.root, hostHandoffResultPath(paths, id), `result path for ${id}`);
101
+ }
102
+ /** Content digest of one prompt text — the binding between ask and answer. */
103
+ export function promptSha256(promptText) {
104
+ return hashContent(promptText);
105
+ }
106
+ /** Content digest of one canonical JSON rendering. */
107
+ export function contentSha256(value) {
108
+ return hashContent(stableStringify(value));
109
+ }
110
+ // ── Envelope, item, and binding validation ──────────────────────────────────
111
+ //
112
+ // Both draws parse the SAME document family out of the run directory — a
113
+ // workload envelope carrying `work_items`, per-item trusted bindings keyed by
114
+ // work item, and a result map naming where each answer lands — and both used to
115
+ // re-derive the scaffolding by hand. The shapes below are the shared skeleton;
116
+ // a draw adds only its own contract version, its own item parser, and whatever
117
+ // domain fields its bindings carry.
118
+ /** The `{ contract_version, run_id, work_items }` envelope both workloads use. */
119
+ const WORKLOAD_ENVELOPE_KEYS = ["contract_version", "run_id", "work_items"];
120
+ /**
121
+ * Validate a persisted workload ENVELOPE against this run: exact keys, the
122
+ * draw's contract version, the run id, and an array of raw items. Item-level
123
+ * shape is the draw's parser ({@link parseAllWorkloadItems}); anything the
124
+ * persisted trusted binding further pins (a digest, a baseline) is the draw's
125
+ * policy layered on top of the `ok` case.
126
+ */
127
+ export function parseWorkloadEnvelope(value, params) {
128
+ if (!isRecord(value) ||
129
+ !hasExactKeys(value, WORKLOAD_ENVELOPE_KEYS) ||
130
+ value.contract_version !== params.contractVersion ||
131
+ value.run_id !== params.runId ||
132
+ !Array.isArray(value.work_items)) {
133
+ return { ok: false };
134
+ }
135
+ return { ok: true, rawItems: value.work_items };
136
+ }
137
+ /** Map raw items through the draw's parser; `null` when ANY item refuses. */
138
+ export function parseAllWorkloadItems(rawItems, parseItem) {
139
+ const items = [];
140
+ for (const raw of rawItems) {
141
+ const item = parseItem(raw);
142
+ if (item === null)
143
+ return null;
144
+ items.push(item);
145
+ }
146
+ return items;
147
+ }
148
+ /** Every id distinct — the duplicate-work-item refusal. */
149
+ export function idsAreUnique(ids) {
150
+ return new Set(ids).size === ids.length;
151
+ }
152
+ /**
153
+ * Strictly ascending in code-unit order — which is BOTH "sorted" and
154
+ * "duplicate-free", the two properties every persisted workload's id list must
155
+ * have for a re-derivation to compare equal byte-for-byte.
156
+ */
157
+ export function idsAreStrictlyAscending(ids) {
158
+ return !ids.some((id, index) => index > 0 && compareCodeUnits(ids[index - 1], id) >= 0);
159
+ }
160
+ /**
161
+ * The identity binding EVERY submitted result carries, identical on both
162
+ * draws: a non-empty `result_id`, this run's id, this work item's id, and the
163
+ * prompt digest of the ask. A refusal here is a REFUSAL, never a repair — the
164
+ * tool cannot know which of the three the host meant.
165
+ */
166
+ export function resultIdentityIsBound(value, params) {
167
+ return (typeof value.result_id === "string" &&
168
+ value.result_id.length > 0 &&
169
+ value.run_id === params.runId &&
170
+ value.work_item_id === params.workItemId &&
171
+ value.prompt_sha256 === params.promptSha256);
172
+ }
173
+ export function resultMapIdentity(items, entries) {
174
+ const byId = new Map(items.map((item) => [item.id, item]));
175
+ if (entries.length !== byId.size)
176
+ return { ok: false, reason: "coverage" };
177
+ const seen = new Set();
178
+ for (const entry of entries) {
179
+ const item = byId.get(entry.work_item_id);
180
+ if (item === undefined || seen.has(entry.work_item_id)) {
181
+ return { ok: false, reason: "coverage" };
182
+ }
183
+ if (entry.prompt_sha256 !== item.prompt.sha256 ||
184
+ entry.result_path !== item.result_path) {
185
+ return {
186
+ ok: false,
187
+ reason: "identity",
188
+ workItemId: entry.work_item_id,
189
+ };
190
+ }
191
+ seen.add(entry.work_item_id);
192
+ }
193
+ return { ok: true, byId };
194
+ }
195
+ /**
196
+ * First duplicate identity in `entries`, or null. The accepted-results ledger
197
+ * and any other keyed record derives its dedupe refusal from this rather than
198
+ * from a hand-rolled Set walk whose message and predicate can drift apart.
199
+ */
200
+ export function firstDuplicateIdentity(entries, identity) {
201
+ const seen = new Set();
202
+ for (const entry of entries) {
203
+ const key = identity(entry);
204
+ if (seen.has(key))
205
+ return entry;
206
+ seen.add(key);
207
+ }
208
+ return null;
209
+ }
210
+ //# sourceMappingURL=hostHandoffCore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hostHandoffCore.js","sourceRoot":"","sources":["../../../src/shared/submission/hostHandoffCore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,2EAA2E;AAC3E,2EAA2E;AAC3E,iEAAiE;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,qB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,WAAW,EACtC,CAAC;YACD,OAAO;gBACL,EAAE,EAAE,KAAK;gBACT,MAAM,EAAE,UAAU;gBAClB,UAAU,EAAE,KAAK,CAAC,YAAY;aAC/B,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAqB,EACrB,QAA8B;IAE9B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;QAChC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -22,7 +22,11 @@ export interface SubmissionLedgerEvent<TIssueCode extends string = SubmissionIss
22
22
  }
23
23
  /** `<artifactsDir>/submissions/submission-ledger.jsonl`. */
24
24
  export declare function submissionLedgerPath(artifactsDir: string): string;
25
- /** Append one event. The parent directory is created on demand. */
25
+ /**
26
+ * Append one event under the shared file lock, so concurrent appends cannot
27
+ * interleave mid-line. The parent directory is created on demand (the lock
28
+ * acquire creates its own parent; `appendNdjsonFile` creates the ledger's).
29
+ */
26
30
  export declare function appendSubmissionEvent<TIssueCode extends string = SubmissionIssueCode>(artifactsDir: string, event: SubmissionLedgerEvent<TIssueCode>): Promise<void>;
27
31
  /** Why one ledger line did not become an event. */
28
32
  export type SubmissionLedgerDropReason =
@@ -1 +1 @@
1
- {"version":3,"file":"submissionLedger.d.ts","sourceRoot":"","sources":["../../../src/shared/submission/submissionLedger.ts"],"names":[],"mappings":"AA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AIG;AACH,wBAAsB,qBAAqB,CACzC,UAAU,SAAS,MAAM,GAAG,mBAAmB,EAC/C,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,qBAAqB,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ/E;AAED,mDAAmD;AACnD,MAAM,MAAM,0BAA0B;AACpC,yEAAyE;AACvE,YAAY;AACd,sEAAsE;GACpE,yBAAyB,CAAC;AAE9B,uEAAuE;AACvE,MAAM,WAAW,oBAAoB;IACnC,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,0BAA0B,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,oBAAoB,GAAG,SAAS,qBAAqB,EAAE,GAAG;IACpE,QAAQ,CAAC,MAAM,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAClD,QAAQ,CAAC,OAAO,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACnD,CAAC;AAqBF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,oBAAoB,CAAC,CA4C/B"}
@@ -17,6 +17,8 @@
17
17
  import { join } from "node:path";
18
18
  import { readFile } from "node:fs/promises";
19
19
  import { appendNdjsonFile } from "../io/json.js";
20
+ import { siblingLockPath } from "../io/lockedJsonStore.js";
21
+ import { withFileLock } from "../io/fileLock.js";
20
22
  import { discardOnSchemaVersionMismatch } from "../io/schemaVersion.js";
21
23
  import { submissionsDir } from "../io/auditToolsPaths.js";
22
24
  export const SUBMISSION_LEDGER_EVENT_CONTRACT_VERSION = "submission-ledger-event/v1alpha1";
@@ -51,9 +53,27 @@ export const SUBMISSION_EVENT_KINDS = [
51
53
  export function submissionLedgerPath(artifactsDir) {
52
54
  return join(submissionsDir(artifactsDir), "submission-ledger.jsonl");
53
55
  }
54
- /** Append one event. The parent directory is created on demand. */
56
+ // Sibling lock serializing every append. Two concurrent appends used to be two
57
+ // independent open-append syscalls on one file: on Windows (and wherever O_APPEND
58
+ // is not what the runtime actually performs) they can interleave so one event's
59
+ // line lands INSIDE the other's, and both lines are then torn — the ledger
60
+ // silently loses an event, which is precisely the clean-vs-repaired collapse it
61
+ // exists to prevent. The name is the locked-JSON-store module's OWN derivation
62
+ // (`siblingLockPath`), so the ledger's lock is the same rule the stores use
63
+ // rather than a second spelling of it.
64
+ function ledgerLockPath(ledgerPath) {
65
+ return siblingLockPath(ledgerPath);
66
+ }
67
+ /**
68
+ * Append one event under the shared file lock, so concurrent appends cannot
69
+ * interleave mid-line. The parent directory is created on demand (the lock
70
+ * acquire creates its own parent; `appendNdjsonFile` creates the ledger's).
71
+ */
55
72
  export async function appendSubmissionEvent(artifactsDir, event) {
56
- await appendNdjsonFile(submissionLedgerPath(artifactsDir), event);
73
+ const ledgerPath = submissionLedgerPath(artifactsDir);
74
+ await withFileLock(ledgerLockPath(ledgerPath), async () => {
75
+ await appendNdjsonFile(ledgerPath, event);
76
+ });
57
77
  }
58
78
  function ledgerRead(events, dropped) {
59
79
  Object.defineProperty(events, "events", {
@@ -115,7 +135,17 @@ export async function readSubmissionLedger(artifactsDir) {
115
135
  continue;
116
136
  let parsed;
117
137
  try {
118
- parsed = JSON.parse(line);
138
+ const value = JSON.parse(line);
139
+ // A line that is valid JSON but not an OBJECT is still not an event: the
140
+ // version check below reads properties off it (`in`), which throws on a
141
+ // primitive or array and broke this function's documented never-throw
142
+ // guarantee — one stray line failed the whole call that records drift.
143
+ // Classified exactly like a torn line instead.
144
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
145
+ dropped.push({ line: lineNumber, reason: "unparsable" });
146
+ continue;
147
+ }
148
+ parsed = value;
119
149
  }
120
150
  catch {
121
151
  dropped.push({ line: lineNumber, reason: "unparsable" });
@@ -1 +1 @@
1
- {"version":3,"file":"submissionLedger.js","sourceRoot":"","sources":["../../../src/shared/submission/submiss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IACrB,CAAC;IACD,OAAO,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACrC,CAAC"}
1
+ {"version":3,"file":"submissionLedger.js","sourceRoot":"","sources":["../../../src/shared/submission/submissionLedger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG1D,MAAM,CAAC,MAAM,wCAAwC,GACnD,kCAA2C,CAAC;AAE9C,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,yDAAyD;IACzD,UAAU;IACV,kDAAkD;IAClD,UAAU;IACV,oEAAoE;IACpE,UAAU;IACV,4EAA4E;IAC5E,mBAAmB;IACnB;;;;;;OAMG;IACH,uBAAuB;IACvB;;;;;;;OAOG;IACH,qBAAqB;CACb,CAAC;AAyBX,4DAA4D;AAC5D,MAAM,UAAU,oBAAoB,CAAC,YAAoB;IACvD,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE,yBAAyB,CAAC,CAAC;AACvE,CAAC;AAED,+EAA+E;AAC/E,kFAAkF;AAClF,gFAAgF;AAChF,2EAA2E;AAC3E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,uCAAuC;AACvC,SAAS,cAAc,CAAC,UAAkB;IACxC,OAAO,eAAe,CAAC,UAAU,CAAC,CAAC;AACrC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAEzC,YA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AAI,EAAE,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QACvC,IAAI,MAA6B,CAAC;QAClC,IAAI,CAAC;YACH,MAAM,KAAK,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACxC,yEAAyE;YACzE,wEAAwE;YACxE,sEAAsE;YACtE,uEAAuE;YACvE,+CAA+C;YAC/C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACxE,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;gBACzD,SAAS;YACX,CAAC;YACD,MAAM,GAAG,KAA8B,CAAC;QAC1C,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;YACzD,SAAS;QACX,CAAC;QACD,MAAM,KAAK,GAAG,8BAA8B,CAC1C,MAAM,EACN,wCAAwC,CACzC,CAAC;QACF,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAC,CAAC;YACtE,SAAS;QACX,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACrC,CAAC"}
@@ -18,4 +18,33 @@ export declare function partitionCommandsByDeclaredShape(commands: readonly stri
18
18
  commands: string[];
19
19
  refusals: string[];
20
20
  };
21
+ /**
22
+ * Split a command string into an argv array, so it can be spawned with
23
+ * `shell: false`.
24
+ *
25
+ * TOTAL, and its guarantee is stated in terms of `shell: false` — not in terms
26
+ * of a precondition a caller has to remember. Exactly two characters are
27
+ * special: an unquoted space ENDS a token, and a double quote toggles grouping
28
+ * and is dropped. EVERY other byte — including `' \ ^ % $` and backtick, and
29
+ * including `& | ; < > ( )` — is copied into the token literally, which under
30
+ * `shell: false` is precisely what the child receives, because no shell ever
31
+ * parses the result. So for any input this produces the argv that a shell-free
32
+ * spawn will actually deliver; it never silently drops meaning.
33
+ *
34
+ * What it does NOT do is decide whether a command was ADMISSIBLE. A string that
35
+ * fails {@link commandLeavesDeclaredShape} still splits — `a && b` becomes
36
+ * `["a", "&&", "b"]`, three literal argv tokens — and that argv is a faithful
37
+ * rendering of what `shell: false` would run, not an execution of the chain the
38
+ * author wrote. That is a declaration the contract cannot honour, so it must be
39
+ * REFUSED by the gate before it reaches a spawn; this function is not the place
40
+ * that decision is made, and it is not a shell parser standing in for one.
41
+ *
42
+ * Windows note: because `\` is an ordinary byte here, an absolute Windows path
43
+ * survives intact through the split (`C:\Program Files\nodejs\node.exe` stays
44
+ * one token when double-quoted). The declared-shape gate refuses `\` in every
45
+ * position, so such a path can only reach this function from a caller that did
46
+ * not gate — see {@link commandLeavesDeclaredShape}'s header for why the
47
+ * refusal is about the declaration rather than the spawn.
48
+ */
49
+ export declare function parseCommandString(command: string): string[];
21
50
  //# sourceMappingURL=commandShape.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"commandShape.d.ts","sourceRoot":"","sources":["../../../src/shared/tooling/commandShape.ts"],"names":[],"mappings":"AAgEA;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CA6BnE;AAED;;;;;;;;GAQG;AACH,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,eAAe,EAAE,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,EAAE,GAAG,EAAE,OAAO,KAAK,MAAM,GACxE;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAgB5C"}
1
+ {"version":3,"file":"commandShape.d.ts","sourceRoot":"","sources":["../../../src/shared/tooling/commandShape.ts"],"names":[],"mappings":"AAgFA;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CA6BnE;AAED;;;;;;;;GAQG;AACH,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,eAAe,EAAE,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,EAAE,GAAG,EAAE,OAAO,KAAK,MAAM,GACxE;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAgB5C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAyB5D"}
@@ -2,18 +2,34 @@ import { scanStringAware } from "../parsing/stringAwareScanner.js";
2
2
  /**
3
3
  * THE declared single-invocation command shape — one rule, every boundary.
4
4
  *
5
- * A declared command (a block's `targeted_commands`) is executed VERBATIM
6
- * through `shell: true` in the repository root, so anything that chains,
7
- * redirects, substitutes or subshells turns one declared test into arbitrary
8
- * execution. A flat regex cannot decide this: `node -e "process.exit(0)"` is an
9
- * ordinary test invocation whose parens are inside quotes, and refusing it would
10
- * refuse the normal case.
5
+ * A declared command (a block's `targeted_commands`) is a string an operator
6
+ * wrote and this tool then RUNS. The rule exists because such a string must
7
+ * denote exactly ONE invocation: anything that chains, redirects, substitutes
8
+ * or subshells turns one declared test into arbitrary execution. A flat regex
9
+ * cannot decide this: `node -e "process.exit(0)"` is an ordinary test
10
+ * invocation whose parens are inside quotes, and refusing it would refuse the
11
+ * normal case.
12
+ *
13
+ * WHAT THE RULE IS *NOT*: an escaping scheme for one particular spawn. The
14
+ * consumers no longer agree on how they spawn — the closing suites and the
15
+ * required-test rerun split the string with {@link parseCommandString} and
16
+ * spawn `shell: false`, while the triage re-verification path still hands it to
17
+ * a shell — and the rule is identical for all of them. That is the point of
18
+ * stating it once here: the property enforced belongs to the DECLARATION, not
19
+ * to the spawner. A string carrying `&&` or a redirect declares work this
20
+ * contract cannot faithfully run as ONE invocation, and must be refused up
21
+ * front — whether the consumer would have let a shell act on it or would have
22
+ * silently reduced it to literal argv bytes. Enforcing the same rule at every
23
+ * boundary is also what keeps producer and consumer agreeing about which
24
+ * declarations are admissible at all.
11
25
  *
12
26
  * So the scan is QUOTE-AWARE — a tiny, fully-owned grammar, not a shell parser.
13
- * It is deliberately narrower than EITHER shell's grammar, because `shell: true`
14
- * is TWO grammars and no per-grammar state machine is sound for both: `/bin/sh
15
- * -c` on posix, `cmd.exe /d /s /c` on win32. Where they disagree, tracking state
16
- * under one of them MIS-CLASSIFIES the other:
27
+ * It is deliberately narrower than EITHER shell's grammar, because a declared
28
+ * command historically reached `shell: true` — TWO grammars, and no per-grammar
29
+ * state machine is sound for both: `/bin/sh -c` on posix, `cmd.exe /d /s /c` on
30
+ * win32. Where they disagree, tracking state under one of them MIS-CLASSIFIES
31
+ * the other, and keeping the union-of-both-grammars refusal is what lets the
32
+ * same admission decision hold on every platform:
17
33
  *
18
34
  * - `'` quotes on sh and is an ORDINARY CHARACTER on cmd.exe, so crediting it
19
35
  * reads `echo '& evil.exe'` as fully quoted while cmd.exe reads `&` as a
@@ -117,4 +133,60 @@ export function partitionCommandsByDeclaredShape(commands, describeRefusal) {
117
133
  }
118
134
  return { commands: admitted, refusals };
119
135
  }
136
+ /**
137
+ * Split a command string into an argv array, so it can be spawned with
138
+ * `shell: false`.
139
+ *
140
+ * TOTAL, and its guarantee is stated in terms of `shell: false` — not in terms
141
+ * of a precondition a caller has to remember. Exactly two characters are
142
+ * special: an unquoted space ENDS a token, and a double quote toggles grouping
143
+ * and is dropped. EVERY other byte — including `' \ ^ % $` and backtick, and
144
+ * including `& | ; < > ( )` — is copied into the token literally, which under
145
+ * `shell: false` is precisely what the child receives, because no shell ever
146
+ * parses the result. So for any input this produces the argv that a shell-free
147
+ * spawn will actually deliver; it never silently drops meaning.
148
+ *
149
+ * What it does NOT do is decide whether a command was ADMISSIBLE. A string that
150
+ * fails {@link commandLeavesDeclaredShape} still splits — `a && b` becomes
151
+ * `["a", "&&", "b"]`, three literal argv tokens — and that argv is a faithful
152
+ * rendering of what `shell: false` would run, not an execution of the chain the
153
+ * author wrote. That is a declaration the contract cannot honour, so it must be
154
+ * REFUSED by the gate before it reaches a spawn; this function is not the place
155
+ * that decision is made, and it is not a shell parser standing in for one.
156
+ *
157
+ * Windows note: because `\` is an ordinary byte here, an absolute Windows path
158
+ * survives intact through the split (`C:\Program Files\nodejs\node.exe` stays
159
+ * one token when double-quoted). The declared-shape gate refuses `\` in every
160
+ * position, so such a path can only reach this function from a caller that did
161
+ * not gate — see {@link commandLeavesDeclaredShape}'s header for why the
162
+ * refusal is about the declaration rather than the spawn.
163
+ */
164
+ export function parseCommandString(command) {
165
+ const argv = [];
166
+ let current = "";
167
+ let quoted = false;
168
+ let started = false;
169
+ for (const char of command) {
170
+ if (char === '"') {
171
+ // A quote both toggles the state and MARKS the token as started, so an
172
+ // explicit empty argument (`""`) survives as an empty string rather than
173
+ // vanishing at the length check below.
174
+ quoted = !quoted;
175
+ started = true;
176
+ continue;
177
+ }
178
+ if (char === " " && !quoted) {
179
+ if (started)
180
+ argv.push(current);
181
+ current = "";
182
+ started = false;
183
+ continue;
184
+ }
185
+ current += char;
186
+ started = true;
187
+ }
188
+ if (started)
189
+ argv.push(current);
190
+ return argv;
191
+ }
120
192
  //# sourceMappingURL=commandShape.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commandShape.js","sourceRoot":"","sources":["../../../src/shared/tooling/commandShape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH;;;;;GAKG;AACH,MA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