@tiangong-lca/foundry 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (323) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +532 -0
  3. package/docs/architecture.md +450 -0
  4. package/docs/foundry-task-contracts.md +147 -0
  5. package/docs/import-profiles/bafu/constraints.md +343 -0
  6. package/docs/import-profiles/bafu/leaf-process-classification-authoring.md +153 -0
  7. package/docs/import-profiles/bafu/profile.md +183 -0
  8. package/docs/import-profiles/uslci/constraints.md +29 -0
  9. package/docs/import-profiles/uslci/profile.md +43 -0
  10. package/docs/import-profiles/worldsteel/constraints.md +77 -0
  11. package/docs/import-profiles/worldsteel/import-coverage.md +93 -0
  12. package/docs/import-profiles/worldsteel/import-plan.md +375 -0
  13. package/docs/import-profiles/worldsteel/profile.md +78 -0
  14. package/docs/package-distribution-contract.md +287 -0
  15. package/docs/public-runtime-contract.md +218 -0
  16. package/docs/runtime-context-contract.md +138 -0
  17. package/docs/safety-policy.md +164 -0
  18. package/docs/task-authorization-contract.md +131 -0
  19. package/docs/uslci-import-runbook.md +336 -0
  20. package/docs/workspace-migration-contract.md +127 -0
  21. package/package-dist/assets/foundry-package-descriptor.json +1661 -0
  22. package/package-dist/scripts/foundry-facade.d.ts +78 -0
  23. package/package-dist/scripts/foundry-facade.js +1317 -0
  24. package/package-dist/scripts/foundry-runtime.d.ts +180 -0
  25. package/package-dist/scripts/foundry-runtime.js +190 -0
  26. package/package-dist/scripts/lib/batch-orchestration/scope-attempt-ledger.d.ts +27 -0
  27. package/package-dist/scripts/lib/batch-orchestration/scope-attempt-ledger.js +85 -0
  28. package/package-dist/scripts/lib/batch-orchestration/scope-resume-contract.d.ts +38 -0
  29. package/package-dist/scripts/lib/batch-orchestration/scope-resume-contract.js +90 -0
  30. package/package-dist/scripts/lib/bundle-row-types.d.ts +44 -0
  31. package/package-dist/scripts/lib/bundle-row-types.js +46 -0
  32. package/package-dist/scripts/lib/bundle-sample-utils.d.ts +183 -0
  33. package/package-dist/scripts/lib/bundle-sample-utils.js +526 -0
  34. package/package-dist/scripts/lib/bundle-source-context.d.ts +31 -0
  35. package/package-dist/scripts/lib/bundle-source-context.js +142 -0
  36. package/package-dist/scripts/lib/canonical-description.d.ts +12 -0
  37. package/package-dist/scripts/lib/canonical-description.js +72 -0
  38. package/package-dist/scripts/lib/canonical-support-rewrites.d.ts +127 -0
  39. package/package-dist/scripts/lib/canonical-support-rewrites.js +527 -0
  40. package/package-dist/scripts/lib/decision-owners/classification.d.ts +245 -0
  41. package/package-dist/scripts/lib/decision-owners/classification.js +754 -0
  42. package/package-dist/scripts/lib/decision-owners/identity-preflight.d.ts +333 -0
  43. package/package-dist/scripts/lib/decision-owners/identity-preflight.js +1353 -0
  44. package/package-dist/scripts/lib/decision-owners/identity-task.d.ts +130 -0
  45. package/package-dist/scripts/lib/decision-owners/identity-task.js +494 -0
  46. package/package-dist/scripts/lib/decision-owners/identity.d.ts +74 -0
  47. package/package-dist/scripts/lib/decision-owners/identity.js +443 -0
  48. package/package-dist/scripts/lib/decision-owners/location.d.ts +239 -0
  49. package/package-dist/scripts/lib/decision-owners/location.js +704 -0
  50. package/package-dist/scripts/lib/decision-task-utils.d.ts +484 -0
  51. package/package-dist/scripts/lib/decision-task-utils.js +735 -0
  52. package/package-dist/scripts/lib/finalize-owners/cli-wrappers.d.ts +52 -0
  53. package/package-dist/scripts/lib/finalize-owners/cli-wrappers.js +146 -0
  54. package/package-dist/scripts/lib/finalize-owners/commit-handoff.d.ts +79 -0
  55. package/package-dist/scripts/lib/finalize-owners/commit-handoff.js +515 -0
  56. package/package-dist/scripts/lib/finalize-owners/post-authoring.d.ts +234 -0
  57. package/package-dist/scripts/lib/finalize-owners/post-authoring.js +1720 -0
  58. package/package-dist/scripts/lib/finalize-owners/post-write-closeout.d.ts +140 -0
  59. package/package-dist/scripts/lib/finalize-owners/post-write-closeout.js +656 -0
  60. package/package-dist/scripts/lib/foundry-args.d.ts +7 -0
  61. package/package-dist/scripts/lib/foundry-args.js +38 -0
  62. package/package-dist/scripts/lib/foundry-authentication-environment.d.ts +17 -0
  63. package/package-dist/scripts/lib/foundry-authentication-environment.js +55 -0
  64. package/package-dist/scripts/lib/foundry-authorization-input.d.ts +31 -0
  65. package/package-dist/scripts/lib/foundry-authorization-input.js +151 -0
  66. package/package-dist/scripts/lib/foundry-command-metadata.d.ts +32 -0
  67. package/package-dist/scripts/lib/foundry-command-metadata.js +1012 -0
  68. package/package-dist/scripts/lib/foundry-command-registry.d.ts +34 -0
  69. package/package-dist/scripts/lib/foundry-command-registry.js +241 -0
  70. package/package-dist/scripts/lib/foundry-command-spec.d.ts +1 -0
  71. package/package-dist/scripts/lib/foundry-command-spec.js +1 -0
  72. package/package-dist/scripts/lib/foundry-decision-owners.d.ts +17 -0
  73. package/package-dist/scripts/lib/foundry-decision-owners.js +68 -0
  74. package/package-dist/scripts/lib/foundry-decision-routing.d.ts +3 -0
  75. package/package-dist/scripts/lib/foundry-decision-routing.js +38 -0
  76. package/package-dist/scripts/lib/foundry-execution-admission.d.ts +33 -0
  77. package/package-dist/scripts/lib/foundry-execution-admission.js +225 -0
  78. package/package-dist/scripts/lib/foundry-execution-attempt.d.ts +11 -0
  79. package/package-dist/scripts/lib/foundry-execution-attempt.js +33 -0
  80. package/package-dist/scripts/lib/foundry-execution-context-format.d.ts +18 -0
  81. package/package-dist/scripts/lib/foundry-execution-context-format.js +83 -0
  82. package/package-dist/scripts/lib/foundry-facade-store.d.ts +25 -0
  83. package/package-dist/scripts/lib/foundry-facade-store.js +449 -0
  84. package/package-dist/scripts/lib/foundry-finalize-owners.d.ts +21 -0
  85. package/package-dist/scripts/lib/foundry-finalize-owners.js +203 -0
  86. package/package-dist/scripts/lib/foundry-identity-owners.d.ts +13 -0
  87. package/package-dist/scripts/lib/foundry-identity-owners.js +58 -0
  88. package/package-dist/scripts/lib/foundry-managed-host.d.ts +7 -0
  89. package/package-dist/scripts/lib/foundry-managed-host.js +173 -0
  90. package/package-dist/scripts/lib/foundry-migration-adoption-plan.d.ts +39 -0
  91. package/package-dist/scripts/lib/foundry-migration-adoption-plan.js +467 -0
  92. package/package-dist/scripts/lib/foundry-migration-adoption.d.ts +31 -0
  93. package/package-dist/scripts/lib/foundry-migration-adoption.js +187 -0
  94. package/package-dist/scripts/lib/foundry-migration-authority.d.ts +42 -0
  95. package/package-dist/scripts/lib/foundry-migration-authority.js +280 -0
  96. package/package-dist/scripts/lib/foundry-migration-inventory.d.ts +31 -0
  97. package/package-dist/scripts/lib/foundry-migration-inventory.js +148 -0
  98. package/package-dist/scripts/lib/foundry-migration-plan.d.ts +48 -0
  99. package/package-dist/scripts/lib/foundry-migration-plan.js +234 -0
  100. package/package-dist/scripts/lib/foundry-migration-replay.d.ts +3 -0
  101. package/package-dist/scripts/lib/foundry-migration-replay.js +134 -0
  102. package/package-dist/scripts/lib/foundry-migration-stage.d.ts +15 -0
  103. package/package-dist/scripts/lib/foundry-migration-stage.js +152 -0
  104. package/package-dist/scripts/lib/foundry-migration-transfer-io.d.ts +13 -0
  105. package/package-dist/scripts/lib/foundry-migration-transfer-io.js +226 -0
  106. package/package-dist/scripts/lib/foundry-migration-transfer.d.ts +36 -0
  107. package/package-dist/scripts/lib/foundry-migration-transfer.js +350 -0
  108. package/package-dist/scripts/lib/foundry-operation-result.d.ts +71 -0
  109. package/package-dist/scripts/lib/foundry-operation-result.js +264 -0
  110. package/package-dist/scripts/lib/foundry-owner-execution-store.d.ts +319 -0
  111. package/package-dist/scripts/lib/foundry-owner-execution-store.js +293 -0
  112. package/package-dist/scripts/lib/foundry-owner-readback.d.ts +22 -0
  113. package/package-dist/scripts/lib/foundry-owner-readback.js +189 -0
  114. package/package-dist/scripts/lib/foundry-owner-trace-acceptance.d.ts +15 -0
  115. package/package-dist/scripts/lib/foundry-owner-trace-acceptance.js +68 -0
  116. package/package-dist/scripts/lib/foundry-package-contract.d.ts +56 -0
  117. package/package-dist/scripts/lib/foundry-package-contract.js +392 -0
  118. package/package-dist/scripts/lib/foundry-private-path.d.ts +2 -0
  119. package/package-dist/scripts/lib/foundry-private-path.js +20 -0
  120. package/package-dist/scripts/lib/foundry-runtime-cache.d.ts +3 -0
  121. package/package-dist/scripts/lib/foundry-runtime-cache.js +25 -0
  122. package/package-dist/scripts/lib/foundry-runtime-command-policy.d.ts +20 -0
  123. package/package-dist/scripts/lib/foundry-runtime-command-policy.js +173 -0
  124. package/package-dist/scripts/lib/foundry-runtime-context-types.d.ts +59 -0
  125. package/package-dist/scripts/lib/foundry-runtime-context-types.js +1 -0
  126. package/package-dist/scripts/lib/foundry-runtime-context.d.ts +27 -0
  127. package/package-dist/scripts/lib/foundry-runtime-context.js +668 -0
  128. package/package-dist/scripts/lib/foundry-runtime-environment.d.ts +9 -0
  129. package/package-dist/scripts/lib/foundry-runtime-environment.js +90 -0
  130. package/package-dist/scripts/lib/foundry-runtime-error.d.ts +4 -0
  131. package/package-dist/scripts/lib/foundry-runtime-error.js +8 -0
  132. package/package-dist/scripts/lib/foundry-runtime-identity.d.ts +18 -0
  133. package/package-dist/scripts/lib/foundry-runtime-identity.js +127 -0
  134. package/package-dist/scripts/lib/foundry-runtime-paths.d.ts +16 -0
  135. package/package-dist/scripts/lib/foundry-runtime-paths.js +159 -0
  136. package/package-dist/scripts/lib/foundry-runtime-qualification.d.ts +66 -0
  137. package/package-dist/scripts/lib/foundry-runtime-qualification.js +223 -0
  138. package/package-dist/scripts/lib/foundry-runtime-selection-record.d.ts +16 -0
  139. package/package-dist/scripts/lib/foundry-runtime-selection-record.js +32 -0
  140. package/package-dist/scripts/lib/foundry-runtime-selection.d.ts +14 -0
  141. package/package-dist/scripts/lib/foundry-runtime-selection.js +123 -0
  142. package/package-dist/scripts/lib/foundry-runtime-utils.d.ts +178 -0
  143. package/package-dist/scripts/lib/foundry-runtime-utils.js +603 -0
  144. package/package-dist/scripts/lib/foundry-semantic-input.d.ts +30 -0
  145. package/package-dist/scripts/lib/foundry-semantic-input.js +132 -0
  146. package/package-dist/scripts/lib/foundry-task-authorization.d.ts +68 -0
  147. package/package-dist/scripts/lib/foundry-task-authorization.js +350 -0
  148. package/package-dist/scripts/lib/foundry-task-io.d.ts +18 -0
  149. package/package-dist/scripts/lib/foundry-task-io.js +92 -0
  150. package/package-dist/scripts/lib/foundry-task-registration.d.ts +6 -0
  151. package/package-dist/scripts/lib/foundry-task-registration.js +384 -0
  152. package/package-dist/scripts/lib/foundry-task-start-spec.d.ts +34 -0
  153. package/package-dist/scripts/lib/foundry-task-start-spec.js +161 -0
  154. package/package-dist/scripts/lib/foundry-task-store.d.ts +18 -0
  155. package/package-dist/scripts/lib/foundry-task-store.js +466 -0
  156. package/package-dist/scripts/lib/foundry-task-types.d.ts +99 -0
  157. package/package-dist/scripts/lib/foundry-task-types.js +1 -0
  158. package/package-dist/scripts/lib/foundry-workflow-approval-continuation.d.ts +6 -0
  159. package/package-dist/scripts/lib/foundry-workflow-approval-continuation.js +136 -0
  160. package/package-dist/scripts/lib/foundry-workflow-assessment.d.ts +3 -0
  161. package/package-dist/scripts/lib/foundry-workflow-assessment.js +231 -0
  162. package/package-dist/scripts/lib/foundry-workflow-authorization.d.ts +22 -0
  163. package/package-dist/scripts/lib/foundry-workflow-authorization.js +174 -0
  164. package/package-dist/scripts/lib/foundry-workflow-context.d.ts +3 -0
  165. package/package-dist/scripts/lib/foundry-workflow-context.js +99 -0
  166. package/package-dist/scripts/lib/foundry-workflow-decisions.d.ts +18 -0
  167. package/package-dist/scripts/lib/foundry-workflow-decisions.js +123 -0
  168. package/package-dist/scripts/lib/foundry-workflow-execution.d.ts +8 -0
  169. package/package-dist/scripts/lib/foundry-workflow-execution.js +248 -0
  170. package/package-dist/scripts/lib/foundry-workflow-finalize.d.ts +13 -0
  171. package/package-dist/scripts/lib/foundry-workflow-finalize.js +264 -0
  172. package/package-dist/scripts/lib/foundry-workflow-identity-apply.d.ts +14 -0
  173. package/package-dist/scripts/lib/foundry-workflow-identity-apply.js +159 -0
  174. package/package-dist/scripts/lib/foundry-workflow-identity.d.ts +6 -0
  175. package/package-dist/scripts/lib/foundry-workflow-identity.js +153 -0
  176. package/package-dist/scripts/lib/foundry-workflow-import.d.ts +4 -0
  177. package/package-dist/scripts/lib/foundry-workflow-import.js +70 -0
  178. package/package-dist/scripts/lib/foundry-workflow-io.d.ts +11 -0
  179. package/package-dist/scripts/lib/foundry-workflow-io.js +77 -0
  180. package/package-dist/scripts/lib/foundry-workflow-reference-verify.d.ts +41 -0
  181. package/package-dist/scripts/lib/foundry-workflow-reference-verify.js +266 -0
  182. package/package-dist/scripts/lib/foundry-workflow-rows.d.ts +2 -0
  183. package/package-dist/scripts/lib/foundry-workflow-rows.js +47 -0
  184. package/package-dist/scripts/lib/foundry-workflow-semantic.d.ts +5 -0
  185. package/package-dist/scripts/lib/foundry-workflow-semantic.js +367 -0
  186. package/package-dist/scripts/lib/foundry-workflow-state.d.ts +37 -0
  187. package/package-dist/scripts/lib/foundry-workflow-state.js +158 -0
  188. package/package-dist/scripts/lib/full-context-proof.d.ts +51 -0
  189. package/package-dist/scripts/lib/full-context-proof.js +932 -0
  190. package/package-dist/scripts/lib/identity-preflight-artifacts.d.ts +184 -0
  191. package/package-dist/scripts/lib/identity-preflight-artifacts.js +573 -0
  192. package/package-dist/scripts/lib/identity-preflight-proof.d.ts +117 -0
  193. package/package-dist/scripts/lib/identity-preflight-proof.js +341 -0
  194. package/package-dist/scripts/lib/identity-reference-rewrite-utils.d.ts +147 -0
  195. package/package-dist/scripts/lib/identity-reference-rewrite-utils.js +817 -0
  196. package/package-dist/scripts/lib/import-curation/authoring-packages.d.ts +28 -0
  197. package/package-dist/scripts/lib/import-curation/authoring-packages.js +92 -0
  198. package/package-dist/scripts/lib/import-curation/curation-cleanup.d.ts +32 -0
  199. package/package-dist/scripts/lib/import-curation/curation-cleanup.js +203 -0
  200. package/package-dist/scripts/lib/import-curation/curation-gate.d.ts +47 -0
  201. package/package-dist/scripts/lib/import-curation/curation-gate.js +528 -0
  202. package/package-dist/scripts/lib/import-curation/internal/artifact-inputs.d.ts +24 -0
  203. package/package-dist/scripts/lib/import-curation/internal/artifact-inputs.js +152 -0
  204. package/package-dist/scripts/lib/import-curation/internal/authoring-patch-workflow.d.ts +3 -0
  205. package/package-dist/scripts/lib/import-curation/internal/authoring-patch-workflow.js +3 -0
  206. package/package-dist/scripts/lib/import-curation/internal/authoring-task-workflow.d.ts +1 -0
  207. package/package-dist/scripts/lib/import-curation/internal/authoring-task-workflow.js +1 -0
  208. package/package-dist/scripts/lib/import-curation/internal/context-inputs.d.ts +56 -0
  209. package/package-dist/scripts/lib/import-curation/internal/context-inputs.js +206 -0
  210. package/package-dist/scripts/lib/import-curation/internal/curation-gate-workflow.d.ts +14 -0
  211. package/package-dist/scripts/lib/import-curation/internal/curation-gate-workflow.js +14 -0
  212. package/package-dist/scripts/lib/import-curation/internal/dataset-payload.d.ts +70 -0
  213. package/package-dist/scripts/lib/import-curation/internal/dataset-payload.js +141 -0
  214. package/package-dist/scripts/lib/import-curation/internal/dataset-types.d.ts +25 -0
  215. package/package-dist/scripts/lib/import-curation/internal/dataset-types.js +45 -0
  216. package/package-dist/scripts/lib/import-curation/internal/full-context-proof.d.ts +129 -0
  217. package/package-dist/scripts/lib/import-curation/internal/full-context-proof.js +552 -0
  218. package/package-dist/scripts/lib/import-curation/internal/hash-utils.d.ts +2 -0
  219. package/package-dist/scripts/lib/import-curation/internal/hash-utils.js +10 -0
  220. package/package-dist/scripts/lib/import-curation/internal/mutation-manifest-workflow.d.ts +15 -0
  221. package/package-dist/scripts/lib/import-curation/internal/mutation-manifest-workflow.js +15 -0
  222. package/package-dist/scripts/lib/import-curation/internal/prewrite-cleanup.d.ts +31 -0
  223. package/package-dist/scripts/lib/import-curation/internal/prewrite-cleanup.js +467 -0
  224. package/package-dist/scripts/lib/import-curation/internal/profiles-config.d.ts +47 -0
  225. package/package-dist/scripts/lib/import-curation/internal/profiles-config.js +88 -0
  226. package/package-dist/scripts/lib/import-curation/internal/runtime-io.d.ts +23 -0
  227. package/package-dist/scripts/lib/import-curation/internal/runtime-io.js +132 -0
  228. package/package-dist/scripts/lib/import-curation/internal/trace-summary.d.ts +53 -0
  229. package/package-dist/scripts/lib/import-curation/internal/trace-summary.js +114 -0
  230. package/package-dist/scripts/lib/import-curation/internal/workflow-authoring-tasks.d.ts +141 -0
  231. package/package-dist/scripts/lib/import-curation/internal/workflow-authoring-tasks.js +854 -0
  232. package/package-dist/scripts/lib/import-curation/internal/workflow-decision-apply-context.d.ts +20 -0
  233. package/package-dist/scripts/lib/import-curation/internal/workflow-decision-apply-context.js +46 -0
  234. package/package-dist/scripts/lib/import-curation/internal/workflow-decision-full-context.d.ts +110 -0
  235. package/package-dist/scripts/lib/import-curation/internal/workflow-decision-full-context.js +782 -0
  236. package/package-dist/scripts/lib/import-curation/internal/workflow-dry-run-context.d.ts +24 -0
  237. package/package-dist/scripts/lib/import-curation/internal/workflow-dry-run-context.js +191 -0
  238. package/package-dist/scripts/lib/import-curation/internal/workflow-evidence-scope.d.ts +80 -0
  239. package/package-dist/scripts/lib/import-curation/internal/workflow-evidence-scope.js +359 -0
  240. package/package-dist/scripts/lib/import-curation/internal/workflow-identity-decision-context.d.ts +146 -0
  241. package/package-dist/scripts/lib/import-curation/internal/workflow-identity-decision-context.js +381 -0
  242. package/package-dist/scripts/lib/import-curation/internal/workflow-identity-preflight.d.ts +223 -0
  243. package/package-dist/scripts/lib/import-curation/internal/workflow-identity-preflight.js +1079 -0
  244. package/package-dist/scripts/lib/import-curation/internal/workflow-patch-collect.d.ts +41 -0
  245. package/package-dist/scripts/lib/import-curation/internal/workflow-patch-collect.js +412 -0
  246. package/package-dist/scripts/lib/import-curation/internal/workflow-patch-evidence-context.d.ts +117 -0
  247. package/package-dist/scripts/lib/import-curation/internal/workflow-patch-evidence-context.js +278 -0
  248. package/package-dist/scripts/lib/import-curation/internal/workflow-patch-evidence.d.ts +59 -0
  249. package/package-dist/scripts/lib/import-curation/internal/workflow-patch-evidence.js +593 -0
  250. package/package-dist/scripts/lib/import-curation/internal/workflow-queue-context.d.ts +58 -0
  251. package/package-dist/scripts/lib/import-curation/internal/workflow-queue-context.js +263 -0
  252. package/package-dist/scripts/lib/import-curation/internal/workflow-reference-closure.d.ts +177 -0
  253. package/package-dist/scripts/lib/import-curation/internal/workflow-reference-closure.js +812 -0
  254. package/package-dist/scripts/lib/import-curation/internal/workflow-row-transform-context.d.ts +159 -0
  255. package/package-dist/scripts/lib/import-curation/internal/workflow-row-transform-context.js +466 -0
  256. package/package-dist/scripts/lib/import-curation/internal/workflow-semantic-actions.d.ts +152 -0
  257. package/package-dist/scripts/lib/import-curation/internal/workflow-semantic-actions.js +1377 -0
  258. package/package-dist/scripts/lib/import-curation/internal/workflow-source-reference-context.d.ts +38 -0
  259. package/package-dist/scripts/lib/import-curation/internal/workflow-source-reference-context.js +116 -0
  260. package/package-dist/scripts/lib/import-curation/mutation-manifest.d.ts +51 -0
  261. package/package-dist/scripts/lib/import-curation/mutation-manifest.js +542 -0
  262. package/package-dist/scripts/lib/import-curation/patch-collect.d.ts +18 -0
  263. package/package-dist/scripts/lib/import-curation/patch-collect.js +172 -0
  264. package/package-dist/scripts/lib/import-curation/profiles.d.ts +1 -0
  265. package/package-dist/scripts/lib/import-curation/profiles.js +1 -0
  266. package/package-dist/scripts/lib/import-curation/trace-summary.d.ts +1 -0
  267. package/package-dist/scripts/lib/import-curation/trace-summary.js +1 -0
  268. package/package-dist/scripts/lib/oauth-session-reference.d.ts +1 -0
  269. package/package-dist/scripts/lib/oauth-session-reference.js +20 -0
  270. package/package-dist/scripts/lib/post-authoring-finalize-utils.d.ts +95 -0
  271. package/package-dist/scripts/lib/post-authoring-finalize-utils.js +548 -0
  272. package/package-dist/scripts/lib/post-write-root-proof.d.ts +44 -0
  273. package/package-dist/scripts/lib/post-write-root-proof.js +169 -0
  274. package/package-dist/scripts/lib/reference-description-text.d.ts +2 -0
  275. package/package-dist/scripts/lib/reference-description-text.js +12 -0
  276. package/package-dist/scripts/lib/remote-verification-accepted-diff.d.ts +42 -0
  277. package/package-dist/scripts/lib/remote-verification-accepted-diff.js +424 -0
  278. package/package-dist/scripts/lib/same-identity-commit-recovery.d.ts +8 -0
  279. package/package-dist/scripts/lib/same-identity-commit-recovery.js +52 -0
  280. package/package-dist/scripts/lib/source-semantics.d.ts +255 -0
  281. package/package-dist/scripts/lib/source-semantics.js +888 -0
  282. package/package-dist/scripts/lib/stage-contract.d.ts +36 -0
  283. package/package-dist/scripts/lib/stage-contract.js +25 -0
  284. package/package-dist/scripts/lib/task-authorization.d.ts +84 -0
  285. package/package-dist/scripts/lib/task-authorization.js +210 -0
  286. package/package-dist/scripts/lib/tidas-adapter.d.ts +113 -0
  287. package/package-dist/scripts/lib/tidas-adapter.js +525 -0
  288. package/package-dist/scripts/lib/tidas-language-utils.d.ts +8 -0
  289. package/package-dist/scripts/lib/tidas-language-utils.js +206 -0
  290. package/package-dist/scripts/lib/tidas-row-utils.d.ts +70 -0
  291. package/package-dist/scripts/lib/tidas-row-utils.js +225 -0
  292. package/package-dist/scripts/lib/trace-coverage.d.ts +53 -0
  293. package/package-dist/scripts/lib/trace-coverage.js +178 -0
  294. package/package-dist/scripts/package-entry.d.ts +2 -0
  295. package/package-dist/scripts/package-entry.js +4 -0
  296. package/package-dist/scripts/public-api.d.ts +80 -0
  297. package/package-dist/scripts/public-api.js +28 -0
  298. package/package-dist/scripts/runtime-entry.d.ts +23 -0
  299. package/package-dist/scripts/runtime-entry.js +424 -0
  300. package/package.json +93 -0
  301. package/specs/canonical-support/flow-properties-unit-groups.json +2692 -0
  302. package/specs/import-profiles.json +118 -0
  303. package/specs/prewrite-content-policy.json +105 -0
  304. package/specs/schemas/authorization-derivation.schema.json +34 -0
  305. package/specs/schemas/execution-context.schema.json +68 -0
  306. package/specs/schemas/foundry-authorization-input.schema.json +120 -0
  307. package/specs/schemas/foundry-facade-request-index.schema.json +78 -0
  308. package/specs/schemas/foundry-managed-runtime.schema.json +122 -0
  309. package/specs/schemas/foundry-migration-activation.schema.json +213 -0
  310. package/specs/schemas/foundry-migration-adoption-plan.schema.json +548 -0
  311. package/specs/schemas/foundry-migration-transfer-receipt.schema.json +93 -0
  312. package/specs/schemas/foundry-operation-result.schema.json +147 -0
  313. package/specs/schemas/foundry-package-descriptor.schema.json +134 -0
  314. package/specs/schemas/foundry-runtime-selection.schema.json +59 -0
  315. package/specs/schemas/foundry-semantic-input.schema.json +36 -0
  316. package/specs/schemas/foundry-task-start.schema.json +123 -0
  317. package/specs/schemas/foundry-workspace-migration-pending.schema.json +17 -0
  318. package/specs/schemas/foundry-workspace-migration-plan.schema.json +59 -0
  319. package/specs/schemas/foundry-workspace-migration-transfer-plan.schema.json +357 -0
  320. package/specs/schemas/foundry-workspace-v2.schema.json +70 -0
  321. package/specs/schemas/runtime-qualification.schema.json +63 -0
  322. package/specs/schemas/task-authorization.schema.json +154 -0
  323. package/specs/schemas/tidas-runtime-expectation.schema.json +54 -0
@@ -0,0 +1,41 @@
1
+ interface JsonRecord {
2
+ [key: string]: unknown;
3
+ }
4
+ interface PatchTask extends JsonRecord {
5
+ entity?: unknown;
6
+ }
7
+ interface PatchSet extends JsonRecord {
8
+ row_index?: unknown;
9
+ rowIndex?: unknown;
10
+ }
11
+ interface ValidateCollectedPatchSetOptions {
12
+ repoRoot: string;
13
+ task: PatchTask;
14
+ patchSet: PatchSet;
15
+ patchSetIndex: unknown;
16
+ patchPath: unknown;
17
+ }
18
+ export interface JsonArtifact {
19
+ path: string;
20
+ value: unknown;
21
+ }
22
+ export interface NormalizedSourceReferenceRewriteRow extends JsonRecord {
23
+ dataset_type: string | null;
24
+ dataset_id: string;
25
+ dataset_version: string;
26
+ relation: string | null;
27
+ path: string | null;
28
+ action: string;
29
+ reason: string | null;
30
+ evidence: JsonRecord;
31
+ }
32
+ export declare function validateCollectedPatchSet({ repoRoot, task, patchSet, patchSetIndex, patchPath, }: ValidateCollectedPatchSetOptions): JsonRecord[];
33
+ export declare function readJsonLines(filePath: unknown): unknown[];
34
+ export declare function readRowsIfExists(filePath: unknown): unknown[];
35
+ export declare function readJsonIfOption(repoRoot: string, value: unknown): JsonArtifact | null;
36
+ export declare function readJsonArtifactsIfOption(repoRoot: string, value: unknown): JsonArtifact[];
37
+ export declare function identityDecisionApplyReportOptionValues(options: unknown): string[];
38
+ export declare function readFileArtifactIfOption(repoRoot: string, value: unknown): string | null;
39
+ export declare function defaultSourceReferenceRewriteFile(rowsFile: unknown): string | null;
40
+ export declare function normalizeSourceReferenceRewriteRow(row: unknown): NormalizedSourceReferenceRewriteRow;
41
+ export {};
@@ -0,0 +1,412 @@
1
+ import path from "node:path";
2
+ import { annualSupplyMissingDataSentinelText } from "./prewrite-cleanup.js";
3
+ import { asText, ensureArray, fileExists, optionList, readJson, readRows, readText, repoRelativePath, resolveRepoPath, unique, } from "./runtime-io.js";
4
+ import { operationFullContextEvidenceBlockers, operationHasEvidence, operationResolution, operationResolutionMode, operationTouchesCommonOther, operationUsedContextKinds, patchSetAuthoringPackage, patchSetDatasetId, patchSetDatasetVersion, patchSetOperations, taskRequiredContextKinds, taskRequiresFullContextEvidence, } from "./workflow-authoring-tasks.js";
5
+ import { containsAiTemplatePlaceholder, operationClosesAnnualSupplyTarget, operationClosureCodes, operationClosureKeys, operationTargetsLocationCode, taskActionItemKeys, taskActionItemsForOperation, taskAuthoringPackageName, validateDeferredCommonOtherTrace, validateFlowClassificationDecisionOperation, validateLocationDecisionOperation, validateProcessClassificationDecisionOperation, validateSourceExchangeCompletenessTrace, } from "./workflow-patch-evidence.js";
6
+ import { allowedPatchResolutionModes } from "./workflow-semantic-actions.js";
7
+ // part-05.mjs
8
+ export function validateCollectedPatchSet({ repoRoot, task, patchSet, patchSetIndex, patchPath, }) {
9
+ const blockers = [];
10
+ const operations = patchSetOperations(patchSet);
11
+ const entity = (task.entity ?? {});
12
+ const datasetId = patchSetDatasetId(patchSet);
13
+ const datasetVersion = patchSetDatasetVersion(patchSet);
14
+ const expectedPackage = taskAuthoringPackageName(repoRoot, task);
15
+ const authoringPackage = patchSetAuthoringPackage(patchSet);
16
+ const patchLocation = repoRelativePath(repoRoot, patchPath);
17
+ if (!operations) {
18
+ blockers.push({
19
+ code: "patch_set_invalid",
20
+ message: "AI patch output must contain patch sets with operations[].",
21
+ patch_file: patchLocation,
22
+ patch_set_index: patchSetIndex,
23
+ entity,
24
+ });
25
+ return blockers;
26
+ }
27
+ const nonTestOperations = operations.filter((operation) => asText(operation?.op) !== "test");
28
+ const deferredAnnualSupply = nonTestOperations.some((operation) => operationResolutionMode(operation) === "deferred_to_common_other" &&
29
+ operationClosesAnnualSupplyTarget(operation));
30
+ if (deferredAnnualSupply) {
31
+ blockers.push({
32
+ code: "patch_deferred_annual_supply_not_allowed",
33
+ message: "annualSupplyOrProductionVolume is schema-required and must not be deferred to common:other; use Foundry deterministic cleanup to write the searchable 9999 missing-data sentinel when source evidence is missing.",
34
+ sentinel_value: annualSupplyMissingDataSentinelText,
35
+ patch_file: patchLocation,
36
+ patch_set_index: patchSetIndex,
37
+ entity,
38
+ });
39
+ }
40
+ if (nonTestOperations.length === 0) {
41
+ blockers.push({
42
+ code: "patch_effective_operation_missing",
43
+ message: "Patch set must include at least one non-test operation for AI-authored curation.",
44
+ patch_file: patchLocation,
45
+ patch_set_index: patchSetIndex,
46
+ entity,
47
+ });
48
+ }
49
+ if (!datasetId && patchSet.row_index === undefined && patchSet.rowIndex === undefined) {
50
+ blockers.push({
51
+ code: "patch_target_missing",
52
+ message: "Patch set must target a row by dataset_id/id/uuid/entity_id or row_index.",
53
+ patch_file: patchLocation,
54
+ patch_set_index: patchSetIndex,
55
+ entity,
56
+ });
57
+ }
58
+ if (datasetId && datasetId !== entity.entity_id) {
59
+ blockers.push({
60
+ code: "patch_dataset_id_mismatch",
61
+ message: `Patch dataset id ${datasetId} does not match task entity ${entity.entity_id}.`,
62
+ patch_file: patchLocation,
63
+ patch_set_index: patchSetIndex,
64
+ entity,
65
+ });
66
+ }
67
+ if (datasetVersion && datasetVersion !== entity.version) {
68
+ blockers.push({
69
+ code: "patch_dataset_version_mismatch",
70
+ message: `Patch dataset version ${datasetVersion} does not match task version ${entity.version}.`,
71
+ patch_file: patchLocation,
72
+ patch_set_index: patchSetIndex,
73
+ entity,
74
+ });
75
+ }
76
+ if (!authoringPackage) {
77
+ blockers.push({
78
+ code: "patch_authoring_package_missing",
79
+ message: "Patch set must include authoring_package.",
80
+ patch_file: patchLocation,
81
+ patch_set_index: patchSetIndex,
82
+ entity,
83
+ });
84
+ }
85
+ else if (expectedPackage && path.basename(authoringPackage) !== expectedPackage) {
86
+ blockers.push({
87
+ code: "patch_authoring_package_mismatch",
88
+ message: `Patch authoring_package ${authoringPackage} does not match ${expectedPackage}.`,
89
+ patch_file: patchLocation,
90
+ patch_set_index: patchSetIndex,
91
+ entity,
92
+ });
93
+ }
94
+ const closed = new Set(nonTestOperations.flatMap(operationClosureKeys));
95
+ for (const required of taskActionItemKeys(task)) {
96
+ const [code, itemPath] = required.split("\u0000");
97
+ const matched = [...closed].some((closure) => {
98
+ const [closedCode, closedPath] = closure.split("\u0000");
99
+ return closedCode === code && (!closedPath || !itemPath || closedPath === itemPath);
100
+ });
101
+ if (!matched) {
102
+ blockers.push({
103
+ code: "patch_action_item_unclosed",
104
+ message: `Patch set does not close required action item ${code}.`,
105
+ path: itemPath || null,
106
+ patch_file: patchLocation,
107
+ patch_set_index: patchSetIndex,
108
+ entity,
109
+ });
110
+ }
111
+ }
112
+ operations.forEach((operation, operationIndex) => {
113
+ const op = asText(operation?.op);
114
+ const pointer = asText(operation?.path);
115
+ const mode = operationResolutionMode(operation);
116
+ if (!["add", "replace", "remove", "test"].includes(op)) {
117
+ blockers.push({
118
+ code: "patch_operation_invalid",
119
+ message: `Unsupported or missing patch operation: ${op || "(missing)"}.`,
120
+ patch_file: patchLocation,
121
+ patch_set_index: patchSetIndex,
122
+ operation_index: operationIndex,
123
+ entity,
124
+ });
125
+ }
126
+ if (op !== "test") {
127
+ if (!operationResolution(operation)) {
128
+ blockers.push({
129
+ code: "patch_resolution_missing",
130
+ message: "Non-test patch operations must include resolution with mode and used_context_kinds.",
131
+ patch_file: patchLocation,
132
+ patch_set_index: patchSetIndex,
133
+ operation_index: operationIndex,
134
+ entity,
135
+ });
136
+ }
137
+ else {
138
+ if (!allowedPatchResolutionModes.has(mode)) {
139
+ blockers.push({
140
+ code: "patch_resolution_mode_invalid",
141
+ message: `Unsupported patch resolution mode: ${mode || "(missing)"}.`,
142
+ patch_file: patchLocation,
143
+ patch_set_index: patchSetIndex,
144
+ operation_index: operationIndex,
145
+ entity,
146
+ });
147
+ }
148
+ for (const actionItem of taskActionItemsForOperation(task, operation)) {
149
+ const allowedModes = ensureArray(actionItem?.allowed_resolution_modes)
150
+ .map((item) => asText(item))
151
+ .filter(Boolean);
152
+ if (allowedModes.length > 0 && !allowedModes.includes(mode)) {
153
+ blockers.push({
154
+ code: "patch_resolution_mode_not_allowed_for_action_item",
155
+ message: `Patch resolution mode ${mode || "(missing)"} is not allowed for action item ${asText(actionItem.code) || "(unknown)"}.`,
156
+ allowed_resolution_modes: allowedModes,
157
+ action_item_code: asText(actionItem.code) || null,
158
+ action_item_path: asText(actionItem.path) || null,
159
+ patch_file: patchLocation,
160
+ patch_set_index: patchSetIndex,
161
+ operation_index: operationIndex,
162
+ entity,
163
+ });
164
+ }
165
+ }
166
+ const usedKinds = new Set(operationUsedContextKinds(operation));
167
+ for (const requiredKind of taskRequiredContextKinds(task)) {
168
+ if (!usedKinds.has(requiredKind)) {
169
+ blockers.push({
170
+ code: "patch_resolution_context_kind_missing",
171
+ message: `Patch resolution does not declare use of required context kind '${requiredKind}'.`,
172
+ required_kind: requiredKind,
173
+ patch_file: patchLocation,
174
+ patch_set_index: patchSetIndex,
175
+ operation_index: operationIndex,
176
+ entity,
177
+ });
178
+ }
179
+ }
180
+ if (["deferred_to_common_other", "source_trace_verified"].includes(mode) &&
181
+ !operationTouchesCommonOther(operation)) {
182
+ blockers.push({
183
+ code: "patch_resolution_trace_not_in_common_other",
184
+ message: "deferred_to_common_other and source_trace_verified resolutions must add or update common:other provenance.",
185
+ patch_file: patchLocation,
186
+ patch_set_index: patchSetIndex,
187
+ operation_index: operationIndex,
188
+ entity,
189
+ });
190
+ }
191
+ const traceContractBlockers = mode === "deferred_to_common_other"
192
+ ? validateDeferredCommonOtherTrace({
193
+ operation,
194
+ actionItems: taskActionItemsForOperation(task, operation),
195
+ })
196
+ : mode === "source_trace_verified"
197
+ ? validateSourceExchangeCompletenessTrace(operation)
198
+ : [];
199
+ traceContractBlockers.forEach((blocker) => {
200
+ blockers.push({
201
+ ...blocker,
202
+ patch_file: patchLocation,
203
+ patch_set_index: patchSetIndex,
204
+ operation_index: operationIndex,
205
+ entity,
206
+ });
207
+ });
208
+ const closureCodes = operationClosureCodes(operation);
209
+ if (closureCodes.some((code) => code.includes("only_output_exchange")) &&
210
+ !["source_trace_verified", "exchange_set_repaired"].includes(mode)) {
211
+ blockers.push({
212
+ code: "patch_resolution_mode_mismatch",
213
+ message: "Only-output exchange action items must be resolved by source_trace_verified or exchange_set_repaired.",
214
+ patch_file: patchLocation,
215
+ patch_set_index: patchSetIndex,
216
+ operation_index: operationIndex,
217
+ entity,
218
+ });
219
+ }
220
+ if (closureCodes.some((code) => code.includes("classification")) &&
221
+ mode !== "classification_decision") {
222
+ blockers.push({
223
+ code: "patch_resolution_mode_mismatch",
224
+ message: "Classification action items must be resolved by classification_decision.",
225
+ patch_file: patchLocation,
226
+ patch_set_index: patchSetIndex,
227
+ operation_index: operationIndex,
228
+ entity,
229
+ });
230
+ }
231
+ if (closureCodes.some((code) => code.includes("classification")) &&
232
+ mode === "classification_decision") {
233
+ validateProcessClassificationDecisionOperation({
234
+ repoRoot,
235
+ task,
236
+ operation,
237
+ }).forEach((blocker) => {
238
+ blockers.push({
239
+ ...blocker,
240
+ patch_file: patchLocation,
241
+ patch_set_index: patchSetIndex,
242
+ operation_index: operationIndex,
243
+ entity,
244
+ });
245
+ });
246
+ validateFlowClassificationDecisionOperation({
247
+ repoRoot,
248
+ task,
249
+ operation,
250
+ }).forEach((blocker) => {
251
+ blockers.push({
252
+ ...blocker,
253
+ patch_file: patchLocation,
254
+ patch_set_index: patchSetIndex,
255
+ operation_index: operationIndex,
256
+ entity,
257
+ });
258
+ });
259
+ }
260
+ if (closureCodes.some((code) => code.includes("location")) &&
261
+ mode !== "location_decision") {
262
+ blockers.push({
263
+ code: "patch_resolution_mode_mismatch",
264
+ message: "Location action items must be resolved by location_decision.",
265
+ patch_file: patchLocation,
266
+ patch_set_index: patchSetIndex,
267
+ operation_index: operationIndex,
268
+ entity,
269
+ });
270
+ }
271
+ if (closureCodes.some((code) => code.includes("location")) &&
272
+ mode === "location_decision" &&
273
+ operationTargetsLocationCode(operation)) {
274
+ validateLocationDecisionOperation({
275
+ repoRoot,
276
+ operation,
277
+ }).forEach((blocker) => {
278
+ blockers.push({
279
+ ...blocker,
280
+ patch_file: patchLocation,
281
+ patch_set_index: patchSetIndex,
282
+ operation_index: operationIndex,
283
+ entity,
284
+ });
285
+ });
286
+ }
287
+ }
288
+ }
289
+ if (!pointer.startsWith("/")) {
290
+ blockers.push({
291
+ code: "patch_path_invalid",
292
+ message: "Patch operation path must be a JSON Pointer.",
293
+ patch_file: patchLocation,
294
+ patch_set_index: patchSetIndex,
295
+ operation_index: operationIndex,
296
+ entity,
297
+ });
298
+ }
299
+ if (op !== "test" && !operationHasEvidence(operation)) {
300
+ blockers.push({
301
+ code: "patch_evidence_missing",
302
+ message: "Non-test patch operations need basis or evidence before collect/apply.",
303
+ patch_file: patchLocation,
304
+ patch_set_index: patchSetIndex,
305
+ operation_index: operationIndex,
306
+ entity,
307
+ });
308
+ }
309
+ if (op !== "test") {
310
+ if (taskRequiresFullContextEvidence(task) && operationClosureKeys(operation).length === 0) {
311
+ blockers.push({
312
+ code: "patch_action_item_closure_missing_full_context",
313
+ message: "Full-context AI patch operations must close at least one authoring action item so mutation-manifest evidence remains fully traceable.",
314
+ patch_file: patchLocation,
315
+ patch_set_index: patchSetIndex,
316
+ operation_index: operationIndex,
317
+ entity,
318
+ });
319
+ }
320
+ operationFullContextEvidenceBlockers({ operation, task }).forEach((blocker) => {
321
+ blockers.push({
322
+ ...blocker,
323
+ patch_file: patchLocation,
324
+ patch_set_index: patchSetIndex,
325
+ operation_index: operationIndex,
326
+ entity,
327
+ });
328
+ });
329
+ }
330
+ if (containsAiTemplatePlaceholder(operation)) {
331
+ blockers.push({
332
+ code: "patch_template_placeholder_unresolved",
333
+ message: "Patch operation still contains an AI template placeholder.",
334
+ patch_file: patchLocation,
335
+ patch_set_index: patchSetIndex,
336
+ operation_index: operationIndex,
337
+ entity,
338
+ });
339
+ }
340
+ });
341
+ return blockers;
342
+ }
343
+ export function readJsonLines(filePath) {
344
+ if (!filePath || !fileExists(filePath))
345
+ return [];
346
+ const text = readText(filePath).trim();
347
+ if (!text)
348
+ return [];
349
+ return text
350
+ .split(/\r?\n/u)
351
+ .filter(Boolean)
352
+ .map((line) => JSON.parse(line));
353
+ }
354
+ export function readRowsIfExists(filePath) {
355
+ return filePath && fileExists(filePath) ? readRows(filePath) : [];
356
+ }
357
+ export function readJsonIfOption(repoRoot, value) {
358
+ const resolved = resolveRepoPath(repoRoot, value);
359
+ return resolved && fileExists(resolved) ? { path: resolved, value: readJson(resolved) } : null;
360
+ }
361
+ export function readJsonArtifactsIfOption(repoRoot, value) {
362
+ return optionList(value)
363
+ .map((entry) => {
364
+ const resolved = resolveRepoPath(repoRoot, entry);
365
+ return resolved && fileExists(resolved)
366
+ ? { path: resolved, value: readJson(resolved) }
367
+ : null;
368
+ })
369
+ .filter(Boolean);
370
+ }
371
+ export function identityDecisionApplyReportOptionValues(options) {
372
+ const typedOptions = options;
373
+ return unique([
374
+ ...optionList(typedOptions.identityDecisionApplyReport),
375
+ ...optionList(typedOptions.identityDecisionsApplyReport),
376
+ ...optionList(typedOptions.identityDecisionApplyReports),
377
+ ...optionList(typedOptions.identityDecisionsApplyReports),
378
+ ]);
379
+ }
380
+ export function readFileArtifactIfOption(repoRoot, value) {
381
+ const resolved = resolveRepoPath(repoRoot, value);
382
+ return resolved && fileExists(resolved) ? resolved : null;
383
+ }
384
+ export function defaultSourceReferenceRewriteFile(rowsFile) {
385
+ const rowsDir = path.dirname(rowsFile);
386
+ const candidates = [
387
+ path.join(rowsDir, "source-reference-rewrites.jsonl"),
388
+ path.join(path.dirname(rowsDir), "source-reference-rewrites.jsonl"),
389
+ ];
390
+ return candidates.find((candidate) => fileExists(candidate)) ?? null;
391
+ }
392
+ export function normalizeSourceReferenceRewriteRow(row) {
393
+ const record = row;
394
+ const normalized = {
395
+ ...row,
396
+ dataset_type: asText(record?.dataset_type ?? record?.datasetType) || null,
397
+ dataset_id: asText(record?.dataset_id ?? record?.datasetId ?? record?.entity_id),
398
+ dataset_version: asText(record?.dataset_version ?? record?.datasetVersion ?? record?.version) || "00.00.001",
399
+ relation: asText(record?.relation) || null,
400
+ path: asText(record?.path) || null,
401
+ action: asText(record?.action) || "rewrite_to_canonical_source_reference",
402
+ reason: asText(record?.reason) || null,
403
+ };
404
+ normalized.evidence = {
405
+ source: "source-reference-rewrites.jsonl",
406
+ source_file: asText(record?.source_file ?? record?.sourceFile) || null,
407
+ original: record?.original ?? null,
408
+ canonical: record?.canonical ?? null,
409
+ reason: normalized.reason,
410
+ };
411
+ return normalized;
412
+ }
@@ -0,0 +1,117 @@
1
+ interface JsonRecord {
2
+ [key: string]: unknown;
3
+ }
4
+ interface PatchEvidenceEntry extends JsonRecord {
5
+ row_index?: unknown;
6
+ dataset_id?: unknown;
7
+ entity_id?: unknown;
8
+ id?: unknown;
9
+ dataset_version?: unknown;
10
+ version?: unknown;
11
+ op?: unknown;
12
+ operation?: unknown;
13
+ path?: unknown;
14
+ basis?: unknown;
15
+ evidence?: unknown;
16
+ resolution?: unknown;
17
+ authoring_package?: unknown;
18
+ authoring_package_sha256?: unknown;
19
+ closes_action_items?: unknown;
20
+ }
21
+ export interface CompactPatchEvidenceEntry extends JsonRecord {
22
+ row_index: number | null;
23
+ dataset_id: string | null;
24
+ dataset_version: string | null;
25
+ operation: string | null;
26
+ path: string | null;
27
+ basis: string | null;
28
+ evidence: unknown;
29
+ resolution: unknown;
30
+ authoring_package: string | null;
31
+ authoring_package_sha256: string | null;
32
+ closes_action_items: unknown[];
33
+ }
34
+ interface PatchApplyReport extends JsonRecord {
35
+ status?: unknown;
36
+ evidence_count?: unknown;
37
+ input_path?: unknown;
38
+ inputPath?: unknown;
39
+ out_path?: unknown;
40
+ outPath?: unknown;
41
+ output_path?: unknown;
42
+ outputPath?: unknown;
43
+ files?: unknown;
44
+ }
45
+ interface ArtifactEnvelope {
46
+ path?: unknown;
47
+ value?: unknown;
48
+ }
49
+ export interface PatchApplyContext {
50
+ status: unknown;
51
+ report: PatchApplyReport | null;
52
+ reportPath: unknown;
53
+ inputRowsFile: string | null;
54
+ outputRows: string[];
55
+ inputPayloadSha256ByIdentity: Map<string, string>;
56
+ outputPayloadSha256ByIdentity: Map<string, string>;
57
+ evidenceFile: string | null;
58
+ evidenceRows: unknown[];
59
+ byIdentity: Map<string, CompactPatchEvidenceEntry[]>;
60
+ byRowIndex: Map<number, CompactPatchEvidenceEntry[]>;
61
+ globalBlockers: JsonRecord[];
62
+ }
63
+ interface DatasetIdentity {
64
+ id?: unknown;
65
+ version?: unknown;
66
+ }
67
+ interface ReadIndex<TKey, TValue> {
68
+ get(key: TKey): TValue[] | undefined;
69
+ }
70
+ interface CleanupContext extends JsonRecord {
71
+ status?: unknown;
72
+ sourceExchangeCompletenessProofs?: unknown;
73
+ }
74
+ interface DeterministicSourceCleanupOptions {
75
+ trace: unknown;
76
+ cleanupContext: CleanupContext | null | undefined;
77
+ identity: DatasetIdentity | null | undefined;
78
+ rowIndex: unknown;
79
+ }
80
+ interface TraceSummary extends JsonRecord {
81
+ unresolved_traces?: unknown;
82
+ source_exchange_completeness?: unknown;
83
+ }
84
+ interface TracePatchEvidenceOptions {
85
+ traceSummary?: TraceSummary | null;
86
+ aiPatchEvidence: PatchEvidenceEntry[];
87
+ identityDecisionApplyContext?: unknown;
88
+ cleanupContext?: CleanupContext | null;
89
+ identity?: DatasetIdentity | null;
90
+ rowIndex?: unknown;
91
+ }
92
+ interface PolicyProfile {
93
+ docs?: unknown;
94
+ }
95
+ export interface PolicySnapshot {
96
+ kind: unknown;
97
+ path: unknown;
98
+ exists: boolean;
99
+ sha256: string | null;
100
+ }
101
+ export declare function patchEvidenceIdentityKey(entry: unknown): string | null;
102
+ export declare function compactPatchEvidenceEntry(entry: unknown): CompactPatchEvidenceEntry;
103
+ export declare function readPatchApplyContext(repoRoot: string, patchApplyArtifact: ArtifactEnvelope | null | undefined, patchEvidenceFile: string | null | undefined): PatchApplyContext;
104
+ export declare function patchEvidenceForRow<TEntry, TRowIndex>(patchApplyContext: {
105
+ byIdentity: ReadIndex<string, TEntry>;
106
+ byRowIndex: ReadIndex<TRowIndex, TEntry>;
107
+ } | null | undefined, identity: {
108
+ id: string;
109
+ version: unknown;
110
+ }, rowIndex: TRowIndex): TEntry[];
111
+ export declare function patchEvidenceClosureCodes(entry: unknown): string[];
112
+ export declare function isDeterministicAnnualSupplyCleanupTrace(trace: unknown): boolean;
113
+ export declare function isDeterministicSourceExchangeCleanupTrace({ trace, cleanupContext, identity, rowIndex, }: DeterministicSourceCleanupOptions): boolean;
114
+ export declare function tracePatchEvidenceBlockers({ traceSummary, aiPatchEvidence, identityDecisionApplyContext, cleanupContext, identity, rowIndex, }: TracePatchEvidenceOptions): JsonRecord[];
115
+ export declare function readPolicySnapshots(repoRoot: string, profile: PolicyProfile | null | undefined): PolicySnapshot[];
116
+ export declare function hasImportOnlyTrace(value: unknown): boolean;
117
+ export {};