@codyswann/lisa 8.6.1 → 8.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/README.md +9 -0
  2. package/all/copy-overwrite/scripts/lib/changed-paths.mjs +146 -0
  3. package/all/copy-overwrite/scripts/lib/completion-proof-content.mjs +6 -2
  4. package/all/copy-overwrite/scripts/lisa-gates.mjs +16 -1
  5. package/all/copy-overwrite/scripts/lisa-hooks/block-direct-issue-create.sh +297 -177
  6. package/all/copy-overwrite/scripts/lisa-run-gates.mjs +24 -0
  7. package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +7 -6
  8. package/all/copy-overwrite/scripts/threshold-ratchet-compare.mjs +18 -12
  9. package/dist/cli/apply-cmd.d.ts +10 -0
  10. package/dist/cli/apply-cmd.d.ts.map +1 -0
  11. package/dist/cli/apply-cmd.js +28 -0
  12. package/dist/cli/apply-cmd.js.map +1 -0
  13. package/dist/cli/index.d.ts.map +1 -1
  14. package/dist/cli/index.js +3 -12
  15. package/dist/cli/index.js.map +1 -1
  16. package/dist/controls/attest-check.d.ts.map +1 -1
  17. package/dist/controls/attest-check.js +31 -18
  18. package/dist/controls/attest-check.js.map +1 -1
  19. package/dist/controls/attest-record.d.ts +3 -0
  20. package/dist/controls/attest-record.d.ts.map +1 -1
  21. package/dist/controls/attest-record.js +28 -5
  22. package/dist/controls/attest-record.js.map +1 -1
  23. package/dist/controls/checks-binding.d.ts.map +1 -1
  24. package/dist/controls/checks-binding.js +28 -1
  25. package/dist/controls/checks-binding.js.map +1 -1
  26. package/dist/controls/commands/attest-host-proof.d.ts +18 -0
  27. package/dist/controls/commands/attest-host-proof.d.ts.map +1 -0
  28. package/dist/controls/commands/attest-host-proof.js +168 -0
  29. package/dist/controls/commands/attest-host-proof.js.map +1 -0
  30. package/dist/controls/commands/attest-options.d.ts +4 -0
  31. package/dist/controls/commands/attest-options.d.ts.map +1 -1
  32. package/dist/controls/commands/attest.d.ts.map +1 -1
  33. package/dist/controls/commands/attest.js +52 -0
  34. package/dist/controls/commands/attest.js.map +1 -1
  35. package/dist/controls/commands/declaration-check.d.ts.map +1 -1
  36. package/dist/controls/commands/declaration-check.js +19 -5
  37. package/dist/controls/commands/declaration-check.js.map +1 -1
  38. package/dist/controls/commands/register.d.ts.map +1 -1
  39. package/dist/controls/commands/register.js +4 -1
  40. package/dist/controls/commands/register.js.map +1 -1
  41. package/dist/controls/evidence-document.d.ts.map +1 -1
  42. package/dist/controls/evidence-document.js +12 -0
  43. package/dist/controls/evidence-document.js.map +1 -1
  44. package/dist/controls/evidence-gather.d.ts +1 -0
  45. package/dist/controls/evidence-gather.d.ts.map +1 -1
  46. package/dist/controls/evidence-gather.js +5 -2
  47. package/dist/controls/evidence-gather.js.map +1 -1
  48. package/dist/controls/evidence-types.d.ts +19 -1
  49. package/dist/controls/evidence-types.d.ts.map +1 -1
  50. package/dist/controls/evidence-types.js +11 -0
  51. package/dist/controls/evidence-types.js.map +1 -1
  52. package/dist/controls/evidence-write.d.ts.map +1 -1
  53. package/dist/controls/evidence-write.js +7 -1
  54. package/dist/controls/evidence-write.js.map +1 -1
  55. package/dist/controls/exercise-declaration.d.ts +58 -0
  56. package/dist/controls/exercise-declaration.d.ts.map +1 -0
  57. package/dist/controls/exercise-declaration.js +138 -0
  58. package/dist/controls/exercise-declaration.js.map +1 -0
  59. package/dist/controls/exercise-observations.d.ts +32 -0
  60. package/dist/controls/exercise-observations.d.ts.map +1 -0
  61. package/dist/controls/exercise-observations.js +141 -0
  62. package/dist/controls/exercise-observations.js.map +1 -0
  63. package/dist/controls/exercise-record-shape.d.ts +10 -0
  64. package/dist/controls/exercise-record-shape.d.ts.map +1 -0
  65. package/dist/controls/exercise-record-shape.js +29 -0
  66. package/dist/controls/exercise-record-shape.js.map +1 -0
  67. package/dist/controls/exercise-records.d.ts +28 -0
  68. package/dist/controls/exercise-records.d.ts.map +1 -0
  69. package/dist/controls/exercise-records.js +113 -0
  70. package/dist/controls/exercise-records.js.map +1 -0
  71. package/dist/controls/exercise-result.d.ts +23 -0
  72. package/dist/controls/exercise-result.d.ts.map +1 -0
  73. package/dist/controls/exercise-result.js +186 -0
  74. package/dist/controls/exercise-result.js.map +1 -0
  75. package/dist/controls/host-proof-input.d.ts +53 -0
  76. package/dist/controls/host-proof-input.d.ts.map +1 -0
  77. package/dist/controls/host-proof-input.js +129 -0
  78. package/dist/controls/host-proof-input.js.map +1 -0
  79. package/dist/controls/host-proof-receipt.d.ts +47 -0
  80. package/dist/controls/host-proof-receipt.d.ts.map +1 -0
  81. package/dist/controls/host-proof-receipt.js +132 -0
  82. package/dist/controls/host-proof-receipt.js.map +1 -0
  83. package/dist/controls/host-proof-register.d.ts +37 -0
  84. package/dist/controls/host-proof-register.d.ts.map +1 -0
  85. package/dist/controls/host-proof-register.js +153 -0
  86. package/dist/controls/host-proof-register.js.map +1 -0
  87. package/dist/controls/host-proof-signature.d.ts +30 -0
  88. package/dist/controls/host-proof-signature.d.ts.map +1 -0
  89. package/dist/controls/host-proof-signature.js +49 -0
  90. package/dist/controls/host-proof-signature.js.map +1 -0
  91. package/dist/controls/host-proof-trust.d.ts +33 -0
  92. package/dist/controls/host-proof-trust.d.ts.map +1 -0
  93. package/dist/controls/host-proof-trust.js +124 -0
  94. package/dist/controls/host-proof-trust.js.map +1 -0
  95. package/dist/controls/pull-request-executor.d.ts +18 -6
  96. package/dist/controls/pull-request-executor.d.ts.map +1 -1
  97. package/dist/controls/pull-request-executor.js +19 -24
  98. package/dist/controls/pull-request-executor.js.map +1 -1
  99. package/dist/controls/register-types.d.ts +3 -4
  100. package/dist/controls/register-types.d.ts.map +1 -1
  101. package/dist/controls/register-types.js +3 -4
  102. package/dist/controls/register-types.js.map +1 -1
  103. package/dist/controls/register.d.ts +4 -7
  104. package/dist/controls/register.d.ts.map +1 -1
  105. package/dist/controls/register.js +17 -6
  106. package/dist/controls/register.js.map +1 -1
  107. package/dist/controls/verdict-answers.d.ts.map +1 -1
  108. package/dist/controls/verdict-answers.js +6 -2
  109. package/dist/controls/verdict-answers.js.map +1 -1
  110. package/dist/controls/verdict-types.d.ts +1 -1
  111. package/dist/controls/verdict-types.d.ts.map +1 -1
  112. package/dist/controls/verdict-types.js +2 -0
  113. package/dist/controls/verdict-types.js.map +1 -1
  114. package/dist/controls/verdict-wording.d.ts +2 -0
  115. package/dist/controls/verdict-wording.d.ts.map +1 -1
  116. package/dist/controls/verdict-wording.js +7 -0
  117. package/dist/controls/verdict-wording.js.map +1 -1
  118. package/dist/controls/verdict.d.ts +2 -0
  119. package/dist/controls/verdict.d.ts.map +1 -1
  120. package/dist/controls/verdict.js +17 -2
  121. package/dist/controls/verdict.js.map +1 -1
  122. package/dist/core/lisa-owned-hash-ledger.json +56 -4
  123. package/dist/core/nightly-e2e-guard-behavior-certificate.d.ts +5 -5
  124. package/dist/core/nightly-e2e-guard-behavior-certificate.js +7 -7
  125. package/dist/core/nightly-e2e-guard-behavior-certificate.js.map +1 -1
  126. package/dist/core/upstream-evidence-manifest.json +99 -27
  127. package/expo/copy-overwrite/scripts/check-bdd-coverage.mjs +4 -1
  128. package/expo/create-only/tsconfig.local.json +6 -1
  129. package/package.json +4 -4
  130. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  131. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  132. package/plugins/lisa/.codex-plugin/scripts/ready-queue-order.mjs +43 -18
  133. package/plugins/lisa/.codex-plugin/skills/lisa-attest/SKILL.md +1 -1
  134. package/plugins/lisa/.codex-plugin/skills/lisa-configure/SKILL.md +3 -2
  135. package/plugins/lisa/.codex-plugin/skills/lisa-configure/references/exercised-artifacts.md +55 -0
  136. package/plugins/lisa/.codex-plugin/skills/lisa-enforce/references/missing-capability-tickets.md +44 -5
  137. package/plugins/lisa/.codex-plugin/skills/lisa-enforce/references/pull-request-executor.md +34 -10
  138. package/plugins/lisa/.codex-plugin/skills/lisa-linear-write-issue/SKILL.md +6 -1
  139. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +9 -2
  140. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-queue.mjs +32 -8
  141. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/queue-github.mjs +44 -1
  142. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/stale-links-github.mjs +14 -3
  143. package/plugins/lisa/.codex-plugin/skills/lisa-tracker-evidence/references/completion-authorization.md +4 -0
  144. package/plugins/lisa/hooks/block-direct-issue-create.sh +297 -177
  145. package/plugins/lisa/hooks/threshold-ratchet-compare.mjs +18 -12
  146. package/plugins/lisa/rules/reference/config-resolution.md +2 -2
  147. package/plugins/lisa/scripts/ready-queue-order.mjs +43 -18
  148. package/plugins/lisa/skills/lisa-attest/SKILL.md +1 -1
  149. package/plugins/lisa/skills/lisa-configure/SKILL.md +3 -2
  150. package/plugins/lisa/skills/lisa-configure/references/exercised-artifacts.md +55 -0
  151. package/plugins/lisa/skills/lisa-enforce/references/missing-capability-tickets.md +44 -5
  152. package/plugins/lisa/skills/lisa-enforce/references/pull-request-executor.md +34 -10
  153. package/plugins/lisa/skills/lisa-linear-write-issue/SKILL.md +6 -1
  154. package/plugins/lisa/skills/lisa-session-manager/SKILL.md +9 -2
  155. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-queue.mjs +32 -8
  156. package/plugins/lisa/skills/lisa-session-manager/scripts/queue-github.mjs +44 -1
  157. package/plugins/lisa/skills/lisa-session-manager/scripts/stale-links-github.mjs +14 -3
  158. package/plugins/lisa/skills/lisa-tracker-evidence/references/completion-authorization.md +4 -0
  159. package/plugins/lisa-agy/hooks/block-direct-issue-create.sh +297 -177
  160. package/plugins/lisa-agy/plugin.json +1 -1
  161. package/plugins/lisa-agy/scripts/ready-queue-order.mjs +43 -18
  162. package/plugins/lisa-agy/skills/lisa-attest/SKILL.md +1 -1
  163. package/plugins/lisa-agy/skills/lisa-configure/SKILL.md +3 -2
  164. package/plugins/lisa-agy/skills/lisa-configure/references/exercised-artifacts.md +55 -0
  165. package/plugins/lisa-agy/skills/lisa-enforce/references/missing-capability-tickets.md +44 -5
  166. package/plugins/lisa-agy/skills/lisa-enforce/references/pull-request-executor.md +34 -10
  167. package/plugins/lisa-agy/skills/lisa-linear-write-issue/SKILL.md +6 -1
  168. package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +9 -2
  169. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-queue.mjs +32 -8
  170. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/queue-github.mjs +44 -1
  171. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/stale-links-github.mjs +14 -3
  172. package/plugins/lisa-agy/skills/lisa-tracker-evidence/references/completion-authorization.md +4 -0
  173. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  174. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  175. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  176. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  177. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  178. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  179. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  180. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  181. package/plugins/lisa-copilot/hooks/block-direct-issue-create.sh +297 -177
  182. package/plugins/lisa-copilot/hooks/threshold-ratchet-compare.mjs +18 -12
  183. package/plugins/lisa-copilot/rules/reference/config-resolution.md +2 -2
  184. package/plugins/lisa-copilot/scripts/ready-queue-order.mjs +43 -18
  185. package/plugins/lisa-copilot/skills/lisa-attest/SKILL.md +1 -1
  186. package/plugins/lisa-copilot/skills/lisa-configure/SKILL.md +3 -2
  187. package/plugins/lisa-copilot/skills/lisa-configure/references/exercised-artifacts.md +55 -0
  188. package/plugins/lisa-copilot/skills/lisa-enforce/references/missing-capability-tickets.md +44 -5
  189. package/plugins/lisa-copilot/skills/lisa-enforce/references/pull-request-executor.md +34 -10
  190. package/plugins/lisa-copilot/skills/lisa-linear-write-issue/SKILL.md +6 -1
  191. package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +9 -2
  192. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-queue.mjs +32 -8
  193. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/queue-github.mjs +44 -1
  194. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/stale-links-github.mjs +14 -3
  195. package/plugins/lisa-copilot/skills/lisa-tracker-evidence/references/completion-authorization.md +4 -0
  196. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  197. package/plugins/lisa-cursor/hooks/block-direct-issue-create.sh +297 -177
  198. package/plugins/lisa-cursor/hooks/threshold-ratchet-compare.mjs +18 -12
  199. package/plugins/lisa-cursor/rules/config-resolution-reference.mdc +2 -2
  200. package/plugins/lisa-cursor/scripts/ready-queue-order.mjs +43 -18
  201. package/plugins/lisa-cursor/skills/lisa-attest/SKILL.md +1 -1
  202. package/plugins/lisa-cursor/skills/lisa-configure/SKILL.md +3 -2
  203. package/plugins/lisa-cursor/skills/lisa-configure/references/exercised-artifacts.md +55 -0
  204. package/plugins/lisa-cursor/skills/lisa-enforce/references/missing-capability-tickets.md +44 -5
  205. package/plugins/lisa-cursor/skills/lisa-enforce/references/pull-request-executor.md +34 -10
  206. package/plugins/lisa-cursor/skills/lisa-linear-write-issue/SKILL.md +6 -1
  207. package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +9 -2
  208. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-queue.mjs +32 -8
  209. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/queue-github.mjs +44 -1
  210. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/stale-links-github.mjs +14 -3
  211. package/plugins/lisa-cursor/skills/lisa-tracker-evidence/references/completion-authorization.md +4 -0
  212. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  213. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  214. package/plugins/lisa-devin/hooks/block-direct-issue-create.sh +297 -177
  215. package/plugins/lisa-devin/hooks/threshold-ratchet-compare.mjs +18 -12
  216. package/plugins/lisa-devin/rules/reference/config-resolution.md +2 -2
  217. package/plugins/lisa-devin/scripts/ready-queue-order.mjs +43 -18
  218. package/plugins/lisa-devin/skills/lisa-attest/SKILL.md +1 -1
  219. package/plugins/lisa-devin/skills/lisa-configure/SKILL.md +3 -2
  220. package/plugins/lisa-devin/skills/lisa-configure/references/exercised-artifacts.md +55 -0
  221. package/plugins/lisa-devin/skills/lisa-enforce/references/missing-capability-tickets.md +44 -5
  222. package/plugins/lisa-devin/skills/lisa-enforce/references/pull-request-executor.md +34 -10
  223. package/plugins/lisa-devin/skills/lisa-linear-write-issue/SKILL.md +6 -1
  224. package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +9 -2
  225. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-queue.mjs +32 -8
  226. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/queue-github.mjs +44 -1
  227. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/stale-links-github.mjs +14 -3
  228. package/plugins/lisa-devin/skills/lisa-tracker-evidence/references/completion-authorization.md +4 -0
  229. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  230. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  231. package/plugins/lisa-expo-agy/plugin.json +1 -1
  232. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  233. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  234. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  235. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  236. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  237. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  238. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  239. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  240. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  241. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  242. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  243. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  244. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  245. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  246. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  247. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  248. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  249. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  250. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  251. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  252. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  253. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  254. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  255. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  256. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  257. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  258. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  259. package/plugins/lisa-rails-agy/plugin.json +1 -1
  260. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  261. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  262. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  263. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  264. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  265. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  266. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  267. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  268. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  269. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  270. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  271. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  272. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  273. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  274. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  275. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  276. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  277. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  278. package/plugins/src/base/hooks/block-direct-issue-create.sh +297 -177
  279. package/plugins/src/base/hooks/threshold-ratchet-compare.mjs +18 -12
  280. package/plugins/src/base/rules/reference/config-resolution.md +2 -2
  281. package/plugins/src/base/scripts/ready-queue-order.mjs +43 -18
  282. package/plugins/src/base/skills/lisa-attest/SKILL.md +1 -1
  283. package/plugins/src/base/skills/lisa-configure/SKILL.md +3 -2
  284. package/plugins/src/base/skills/lisa-configure/references/exercised-artifacts.md +55 -0
  285. package/plugins/src/base/skills/lisa-enforce/references/missing-capability-tickets.md +44 -5
  286. package/plugins/src/base/skills/lisa-enforce/references/pull-request-executor.md +34 -10
  287. package/plugins/src/base/skills/lisa-linear-write-issue/SKILL.md +6 -1
  288. package/plugins/src/base/skills/lisa-session-manager/SKILL.md +9 -2
  289. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-queue.mjs +32 -8
  290. package/plugins/src/base/skills/lisa-session-manager/scripts/queue-github.mjs +44 -1
  291. package/plugins/src/base/skills/lisa-session-manager/scripts/stale-links-github.mjs +14 -3
  292. package/plugins/src/base/skills/lisa-tracker-evidence/references/completion-authorization.md +4 -0
  293. package/rails/copy-overwrite/scripts/check-nightly-e2e-health.mjs +28 -2
  294. package/rails/copy-overwrite/scripts/threshold-ratchet-compare.mjs +18 -12
  295. package/schemas/control-evidence.schema.json +39 -1
  296. package/schemas/control-verdict.schema.json +1 -0
  297. package/typescript/copy-overwrite/scripts/check-nightly-e2e-health.mjs +28 -2
  298. package/typescript/copy-overwrite/scripts/threshold-ratchet-compare.mjs +18 -12
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Read the current, independently adjudicated result for each declared target.
3
+ * @module controls/exercise-observations
4
+ */
5
+ import { lstat } from "node:fs/promises";
6
+ import path from "node:path";
7
+ import { isJsonObject } from "../sync/json-path.js";
8
+ import { readEnv } from "../utils/process-environment.js";
9
+ import { blockedFolder } from "./carrier-edits.js";
10
+ import { bindChecks } from "./checks-binding.js";
11
+ import { readControlFile } from "./control-files.js";
12
+ import { EXERCISE_DECLARATION_PATH, EXERCISE_RESULTS_PATH, readExerciseDeclaration, } from "./exercise-declaration.js";
13
+ import { acceptExercise, } from "./exercise-result.js";
14
+ import { verifyHostProof } from "./host-proof-signature.js";
15
+ import { HOST_PROOF_TRUST_FILE, loadHostProofTrust, } from "./host-proof-trust.js";
16
+ import { readOriginUrl } from "./protect-platform.js";
17
+ import { digestOf } from "./verdict-digest.js";
18
+ /**
19
+ * Confirm a scope is present without following a link out of the checkout.
20
+ * @param root - Real repository path
21
+ * @param scope - The declared target folder
22
+ * @returns Whether all components are ordinary directories
23
+ */
24
+ async function scopeExists(root, scope) {
25
+ if (scope === ".")
26
+ return true;
27
+ if ((await blockedFolder(root, `${scope}/exercise`)) !== null)
28
+ return false;
29
+ try {
30
+ return (await lstat(path.join(root, scope))).isDirectory();
31
+ }
32
+ catch {
33
+ return false;
34
+ }
35
+ }
36
+ /**
37
+ * Read the candidate signed envelopes from the fixed result file.
38
+ * @param root - Real repository root
39
+ * @returns A bounded list of candidates or an explanation
40
+ */
41
+ async function exerciseStatements(root) {
42
+ const file = await readControlFile(root, EXERCISE_RESULTS_PATH);
43
+ if (file.kind === "missing")
44
+ return "No independently signed exercise results are on record.";
45
+ if (file.kind !== "text")
46
+ return "The exercise result file could not be read.";
47
+ try {
48
+ const value = JSON.parse(file.text);
49
+ return Array.isArray(value)
50
+ ? value
51
+ : "The exercise result file needs an array of signed statements.";
52
+ }
53
+ catch {
54
+ return "The exercise result file is not valid JSON.";
55
+ }
56
+ }
57
+ /**
58
+ * Match the trusted and signed observation to one configured target.
59
+ * @param target - A declared exercise
60
+ * @param statements - Candidate envelopes indexed by their claimed target
61
+ * @param trust - The externally administered review authority
62
+ * @param binding - The current check definitions and time
63
+ * @param root - Real path of the checkout containing the target scope
64
+ * @returns The accepted observation or a reason it could not be accepted
65
+ */
66
+ async function observeExercise(target, statements, trust, binding, root) {
67
+ const missing = (problem) => ({
68
+ target,
69
+ result: null,
70
+ problem,
71
+ });
72
+ if (!(await scopeExists(root, target.scope)))
73
+ return missing("The declared scope is not an ordinary repository folder.");
74
+ if (trust.adjudicator.id !== target.adjudicator)
75
+ return missing("The declared adjudicator is not authorized for this environment.");
76
+ const related = statements.filter(statement => isJsonObject(statement) &&
77
+ isJsonObject(statement.body) &&
78
+ statement.body.target_id === target.id);
79
+ if (related.length !== 1)
80
+ return missing(related.length === 0
81
+ ? "There is no result for this target."
82
+ : "There is more than one result for this target.");
83
+ const signed = verifyHostProof(related[0], "artifact-exercise", trust.adjudicator.key);
84
+ if (signed === null)
85
+ return missing("The exercise signature could not be verified with the authorized adjudicator key.");
86
+ const result = acceptExercise(target, signed, binding);
87
+ return typeof result === "string"
88
+ ? missing(result)
89
+ : {
90
+ target,
91
+ problem: null,
92
+ result: { ...result, statementDigest: digestOf(signed) },
93
+ };
94
+ }
95
+ /**
96
+ * Independently revalidate scope, signatures, binding and result in attest and check.
97
+ * @param context - The checkout, its current register and evidence binding
98
+ * @returns Accepted and unresolved targets with fixed diagnostics
99
+ */
100
+ export async function readExerciseObservations(context) {
101
+ const { root, checks } = context;
102
+ const declared = await readExerciseDeclaration(root);
103
+ if (declared.problems !== null)
104
+ return { targets: [], problems: declared.problems };
105
+ const { declaration } = declared;
106
+ if (declaration === null)
107
+ return { targets: [], problems: [] };
108
+ const unresolved = (problem) => ({
109
+ targets: declaration.targets.map(target => ({
110
+ target,
111
+ result: null,
112
+ problem,
113
+ })),
114
+ problems: [],
115
+ });
116
+ const statements = await exerciseStatements(root);
117
+ if (typeof statements === "string")
118
+ return unresolved(statements);
119
+ const trust = await loadHostProofTrust(root, readEnv(HOST_PROOF_TRUST_FILE));
120
+ if (trust === null ||
121
+ trust.environment !== declaration.environment ||
122
+ (await readOriginUrl(root)) !== trust.repository)
123
+ return unresolved("The external exercise trust file does not match this repository and environment.");
124
+ const current = await bindChecks({
125
+ repository: root,
126
+ also: checks.covered.map(file => file.path),
127
+ });
128
+ if (current.digest !== checks.digest ||
129
+ !current.covered.some(file => file.path === EXERCISE_DECLARATION_PATH))
130
+ return unresolved("The exercise declaration or check definitions changed after the exercise was recorded.");
131
+ const binding = {
132
+ repository: trust.repository,
133
+ environment: trust.environment,
134
+ checksDigest: current.digest,
135
+ now: context.now,
136
+ register: context.register,
137
+ };
138
+ const targets = await Promise.all(declaration.targets.map(target => observeExercise(target, statements, trust, binding, root)));
139
+ return { targets, problems: [] };
140
+ }
141
+ //# sourceMappingURL=exercise-observations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exercise-observations.js","sourceRoot":"","sources":["../../src/controls/exercise-observations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,UAAU,E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seRecordIdentity } from "./evidence-types.js";
3
+ /**
4
+ * Check the exercise's identity, outcome and relationship to the evidence file.
5
+ * @param record - A record whose fields are individually well formed
6
+ * @param exercise - Its typed artifact identity
7
+ * @returns Why its fields cannot form an exercised artifact, if anything differs
8
+ */
9
+ export declare function exerciseRecordProblems(record: EvidenceRecord, exercise: ExerciseRecordIdentity): string[];
10
+ //# sourceMappingURL=exercise-record-shape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exercise-record-shape.d.ts","sourceRoot":"","sources":["../../src/controls/exercise-record-shape.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC5B,MAAM,qBAAqB,CAAC;AAG7B;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,sBAAsB,GAC/B,MAAM,EAAE,CAkBV"}
@@ -0,0 +1,29 @@
1
+ /** Structural requirements for an exercised artifact in the evidence file. */
2
+ import { ARTIFACT_EXERCISED, exerciseRecordId, } from "./evidence-types.js";
3
+ import { EXERCISE_CRITERIA } from "./exercise-declaration.js";
4
+ /**
5
+ * Check the exercise's identity, outcome and relationship to the evidence file.
6
+ * @param record - A record whose fields are individually well formed
7
+ * @param exercise - Its typed artifact identity
8
+ * @returns Why its fields cannot form an exercised artifact, if anything differs
9
+ */
10
+ export function exerciseRecordProblems(record, exercise) {
11
+ return record.rung === "exercised" &&
12
+ record.result === "held" &&
13
+ record.reason === ARTIFACT_EXERCISED &&
14
+ record.entry_id === null &&
15
+ record.moment === null &&
16
+ record.command === null &&
17
+ record.commit === null &&
18
+ record.exit_status === null &&
19
+ record.output_excerpt === "" &&
20
+ !record.output_truncated &&
21
+ record.half === undefined &&
22
+ EXERCISE_CRITERIA.some(criterion => criterion === record.criterion) &&
23
+ record.id === exerciseRecordId(record.criterion, exercise.target)
24
+ ? []
25
+ : [
26
+ "An artifact exercise needs its typed criterion and target, the exercised rung and a held result without a gate or half",
27
+ ];
28
+ }
29
+ //# sourceMappingURL=exercise-record-shape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exercise-record-shape.js","sourceRoot":"","sources":["../../src/controls/exercise-record-shape.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GAGjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAAsB,EACtB,QAAgC;IAEhC,OAAO,MAAM,CAAC,IAAI,KAAK,WAAW;QAChC,MAAM,CAAC,MAAM,KAAK,MAAM;QACxB,MAAM,CAAC,MAAM,KAAK,kBAAkB;QACpC,MAAM,CAAC,QAAQ,KAAK,IAAI;QACxB,MAAM,CAAC,MAAM,KAAK,IAAI;QACtB,MAAM,CAAC,OAAO,KAAK,IAAI;QACvB,MAAM,CAAC,MAAM,KAAK,IAAI;QACtB,MAAM,CAAC,WAAW,KAAK,IAAI;QAC3B,MAAM,CAAC,cAAc,KAAK,EAAE;QAC5B,CAAC,MAAM,CAAC,gBAAgB;QACxB,MAAM,CAAC,IAAI,KAAK,SAAS;QACzB,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,KAAK,MAAM,CAAC,SAAS,CAAC;QACnE,MAAM,CAAC,EAAE,KAAK,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC;QACjE,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC;YACE,wHAAwH;SACzH,CAAC;AACR,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { type ChecksBinding, type EvidenceBatch, type EvidenceRecord } from "./evidence-types.js";
2
+ import type { ControlRegister } from "./register-types.js";
3
+ /** Exercise records and operator diagnostics derived from the same inputs. */
4
+ interface ExerciseRecords {
5
+ readonly batch: EvidenceBatch;
6
+ readonly notes: readonly string[];
7
+ }
8
+ /**
9
+ * Match saved exercise records to records rebuilt from authorized statements.
10
+ * @param stored - Evidence records already on disk
11
+ * @param rebuilt - Exercise records authenticated for the current binding
12
+ * @returns The verified ids and whether the stored set differs
13
+ */
14
+ export declare function compareExerciseRecords(stored: readonly EvidenceRecord[], rebuilt: readonly EvidenceRecord[]): {
15
+ current: Set<string>;
16
+ differs: boolean;
17
+ };
18
+ /**
19
+ * Rebuild the complete evidence for each criterion from current signed results.
20
+ * @param root - Real checkout path
21
+ * @param register - Current repository controls
22
+ * @param checks - Current check binding to compare with the signed results
23
+ * @param now - The time against which the results' freshness is checked
24
+ * @returns The artifact batch and any gaps the operator must address
25
+ */
26
+ export declare function verifiedExerciseRecords(root: string, register: ControlRegister, checks: ChecksBinding, now: Date): Promise<ExerciseRecords>;
27
+ export {};
28
+ //# sourceMappingURL=exercise-records.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exercise-records.d.ts","sourceRoot":"","sources":["../../src/controls/exercise-records.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAY3D,8EAA8E;AAC9E,UAAU,eAAe;IACvB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,cAAc,EAAE,EACjC,OAAO,EAAE,SAAS,cAAc,EAAE;;;EAenC;AA+DD;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,aAAa,EACrB,GAAG,EAAE,IAAI,GACR,OAAO,CAAC,eAAe,CAAC,CAoC1B"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Turn verified typed exercises into the evidence the verdict can use.
3
+ * @module controls/exercise-records
4
+ */
5
+ import { canonicalText } from "./canonical-json.js";
6
+ import { ARTIFACT_EXERCISED, DEFAULT_FRESHNESS_SECONDS, exerciseRecordId, } from "./evidence-types.js";
7
+ import { readExerciseObservations, } from "./exercise-observations.js";
8
+ import { isRequiredBeyondTheAuthor } from "./register-tier-rule.js";
9
+ /** What a record says without copying raw producer logs or credentials. */
10
+ const DESCRIPTION = {
11
+ "AC5.5": "The authoritative gate refused the known violation.",
12
+ "AC6.4": "The expected connection verified an identity on the declared execution surface.",
13
+ "AC7.2": "The rollback restored the preceding generation and verified recovery.",
14
+ "AC8.9": "The shadow comparison and adversarial qualification both passed.",
15
+ };
16
+ /**
17
+ * Match saved exercise records to records rebuilt from authorized statements.
18
+ * @param stored - Evidence records already on disk
19
+ * @param rebuilt - Exercise records authenticated for the current binding
20
+ * @returns The verified ids and whether the stored set differs
21
+ */
22
+ export function compareExerciseRecords(stored, rebuilt) {
23
+ const saved = stored.filter(record => record.exercise !== undefined);
24
+ const exact = new Map(saved.map(record => [record.id, canonicalText(record)]));
25
+ const current = new Set(rebuilt.flatMap(record => exact.get(record.id) === canonicalText(record) ? [record.id] : []));
26
+ return {
27
+ current,
28
+ differs: current.size !== saved.length || current.size !== rebuilt.length,
29
+ };
30
+ }
31
+ /**
32
+ * Check that an exercise plan covers each authoritative gate in its own scope.
33
+ * @param register - The current controls
34
+ * @param observations - The declared target observations from this repository
35
+ * @returns The gate entries the plan omitted
36
+ */
37
+ function uncoveredGates(register, observations) {
38
+ const gates = observations.flatMap(({ target }) => target.criterion === "AC5.5" ? [target] : []);
39
+ if (gates.length === 0)
40
+ return [];
41
+ return register.entries
42
+ .filter(entry => entry.tier === "authoritative" &&
43
+ isRequiredBeyondTheAuthor(entry.enforcement_points) &&
44
+ !gates.some(target => target.gate === entry.gate && target.scope === entry.scope))
45
+ .map(entry => entry.id);
46
+ }
47
+ /**
48
+ * Record one exercised artifact with its independently verifiable identity.
49
+ * @param observation - A result that was just verified
50
+ * @param checksDigest - Current definitions of the checks
51
+ * @returns A record when the measurement stood, or no record
52
+ */
53
+ function evidenceOf(observation, checksDigest) {
54
+ const { result, target } = observation;
55
+ if (result === null)
56
+ return null;
57
+ return {
58
+ id: exerciseRecordId(target.criterion, target.id),
59
+ criterion: target.criterion,
60
+ entry_id: null,
61
+ scope: target.scope,
62
+ rung: "exercised",
63
+ exercise: { target: target.id, statement_sha256: result.statementDigest },
64
+ moment: null,
65
+ result: "held",
66
+ reason: ARTIFACT_EXERCISED,
67
+ detail: DESCRIPTION[target.criterion],
68
+ commit: null,
69
+ checks_digest: checksDigest,
70
+ command: null,
71
+ exit_status: null,
72
+ started_at: result.completedAt,
73
+ completed_at: result.completedAt,
74
+ freshness_seconds: DEFAULT_FRESHNESS_SECONDS,
75
+ output_excerpt: "",
76
+ output_truncated: false,
77
+ };
78
+ }
79
+ /**
80
+ * Rebuild the complete evidence for each criterion from current signed results.
81
+ * @param root - Real checkout path
82
+ * @param register - Current repository controls
83
+ * @param checks - Current check binding to compare with the signed results
84
+ * @param now - The time against which the results' freshness is checked
85
+ * @returns The artifact batch and any gaps the operator must address
86
+ */
87
+ export async function verifiedExerciseRecords(root, register, checks, now) {
88
+ const { targets, problems } = await readExerciseObservations({
89
+ root,
90
+ register,
91
+ checks,
92
+ now,
93
+ });
94
+ const missingGates = uncoveredGates(register, targets);
95
+ const incomplete = new Set(targets.flatMap(({ target, problem }) => problem === null ? [] : [target.criterion]));
96
+ const exercises = targets.flatMap(row => {
97
+ const { criterion } = row.target;
98
+ if (incomplete.has(criterion) ||
99
+ (criterion === "AC5.5" && missingGates.length > 0))
100
+ return [];
101
+ const record = evidenceOf(row, checks.digest);
102
+ return record === null ? [] : [record];
103
+ });
104
+ const notes = [
105
+ ...problems,
106
+ ...missingGates.map(entry => `AC5.5 is missing an exercise target for the authoritative gate ${entry}.`),
107
+ ...targets.flatMap(({ target, problem }) => problem === null
108
+ ? []
109
+ : [`${target.criterion} exercise ${target.id}: ${problem}`]),
110
+ ];
111
+ return { batch: { entries: [], moments: [], results: [], exercises }, notes };
112
+ }
113
+ //# sourceMappingURL=exercise-records.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exercise-records.js","sourceRoot":"","sources":["../../src/controls/exercise-records.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,gBAAgB,GAIjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,wBAAwB,GAEzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAGpE,2EAA2E;AAC3E,MAAM,WAAW,GAAG;IAClB,OAAO,EAAE,qDAAqD;IAC9D,OAAO,EACL,iFAAiF;IACnF,OAAO,EACL,uEAAuE;IACzE,OAAO,EAAE,kEAAkE;CACnE,CAAC;AAQX;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAAiC,EACjC,OAAkC;IAElC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC;IACrE,MAAM,KAAK,GAAG,IAAI,GAAG,CACnB,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CACxD,CAAC;IACF,MAAM,OAAO,GAAG,IAAI,GAAG,CACrB,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CACvB,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,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M,CAAC;QACjC,IACE,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC;YACzB,CAAC,SAAS,KAAK,OAAO,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;YAElD,OAAO,EAAE,CAAC;QACZ,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAC9C,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IACH,MAAM,KAAK,GAAG;QACZ,GAAG,QAAQ;QACX,GAAG,YAAY,CAAC,GAAG,CACjB,KAAK,CAAC,EAAE,CACN,kEAAkE,KAAK,GAAG,CAC7E;QACD,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CACzC,OAAO,KAAK,IAAI;YACd,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,SAAS,aAAa,MAAM,CAAC,EAAE,KAAK,OAAO,EAAE,CAAC,CAC9D;KACF,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC;AAChF,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { type ExerciseTarget } from "./exercise-declaration.js";
2
+ import type { ControlRegister } from "./register-types.js";
3
+ /** The inputs attest can verify against the same signed statement later. */
4
+ export interface ExerciseBinding {
5
+ readonly repository: string;
6
+ readonly environment: string;
7
+ readonly checksDigest: string;
8
+ readonly now: Date;
9
+ readonly register: ControlRegister;
10
+ }
11
+ /** What a valid result establishes without including any raw command log. */
12
+ export interface AcceptedExercise {
13
+ readonly completedAt: string;
14
+ }
15
+ /**
16
+ * Bind an authenticated result to the exact target, environment, and current checks.
17
+ * @param target - The applicable criterion and declared surface
18
+ * @param result - A statement whose signer has already been checked
19
+ * @param binding - The current evidence context
20
+ * @returns The result's durable identity and completion time, or a fixed refusal
21
+ */
22
+ export declare function acceptExercise(target: ExerciseTarget, result: Readonly<Record<string, unknown>>, binding: ExerciseBinding): AcceptedExercise | string;
23
+ //# sourceMappingURL=exercise-result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exercise-result.d.ts","sourceRoot":"","sources":["../../src/controls/exercise-result.ts"],"names":[],"mappings":"AAQA,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhF,OAAO,KAAK,EACV,eAAe,EAEhB,MAAM,qBAAqB,CAAC;AAE7B,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IACnB,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;CACpC;AAED,6EAA6E;AAC7E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAoMD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,OAAO,EAAE,eAAe,GACvB,gBAAgB,GAAG,MAAM,CA+B3B"}
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Validate the producer's independently reviewed result for one exercise.
3
+ * @module controls/exercise-result
4
+ */
5
+ import { isJsonObject } from "../sync/json-path.js";
6
+ import { isCanonicalUtc, isEvidenceFresh } from "./evidence.js";
7
+ import { isSha256 } from "./evidence-binding.js";
8
+ import { DEFAULT_FRESHNESS_SECONDS } from "./evidence-types.js";
9
+ import { isExerciseName } from "./exercise-declaration.js";
10
+ import { declaredFailureText } from "./proof-plan.js";
11
+ import { isRequiredBeyondTheAuthor } from "./register-tier-rule.js";
12
+ /** A versioned source locator names a file at an exact Git object. */
13
+ const IMMUTABLE_SOURCE = /^git:[0-9a-f]{40}(?:[0-9a-f]{24})?:[^\r\n]{1,160}$/u;
14
+ /** A verified principal can be a service name, email address, or provider role id. */
15
+ const PRINCIPAL = /^[a-zA-Z0-9][a-zA-Z0-9._@:/-]{0,159}$/u;
16
+ /**
17
+ * Check the signed artifact's hash or immutable source locator.
18
+ * @param artifact - The claimed result's immutable identity
19
+ * @returns Whether it identifies immutable evidence
20
+ */
21
+ function isImmutableArtifact(artifact) {
22
+ return (isJsonObject(artifact) &&
23
+ Object.keys(artifact).length === 1 &&
24
+ (isSha256(artifact.sha256) ||
25
+ (typeof artifact.locator === "string" &&
26
+ IMMUTABLE_SOURCE.test(artifact.locator))));
27
+ }
28
+ /**
29
+ * The control gate exercise must reach the real declaration and named scope.
30
+ * @param target - The declared gate and moment to exercise
31
+ * @param register - The repository's current control register
32
+ * @returns Its authoritative entry for that scope and moment, if any
33
+ */
34
+ function authoritativeGate(target, register) {
35
+ return register.entries.find(entry => entry.gate === target.gate &&
36
+ entry.scope === target.scope &&
37
+ entry.tier === "authoritative" &&
38
+ isRequiredBeyondTheAuthor(entry.enforcement_points.filter(point => point.moment === target.moment)));
39
+ }
40
+ /**
41
+ * Validate the gate runner's refusal and the clean result when the gate declares one.
42
+ * @param target - Gate identity and the expected moment
43
+ * @param outcome - Signed observation from the authoritative gate runner
44
+ * @param register - Current declaration-derived register
45
+ * @returns Whether the observed results fit the declared failure
46
+ */
47
+ function gateExercise(target, outcome, register) {
48
+ const entry = authoritativeGate(target, register);
49
+ if (entry === undefined ||
50
+ outcome.gate !== target.gate ||
51
+ outcome.moment !== target.moment)
52
+ return false;
53
+ const { violation_exit, violation_output, clean_exit } = outcome;
54
+ const declared = declaredFailureText(entry);
55
+ const shape = declared.length === 0 ? [`required gate FAILED: ${entry.gate}`] : declared;
56
+ if (typeof violation_exit !== "number" ||
57
+ !Number.isInteger(violation_exit) ||
58
+ violation_exit <= 0 ||
59
+ violation_exit > 255 ||
60
+ typeof violation_output !== "string" ||
61
+ violation_output.length > 16_384 ||
62
+ !shape.some(line => violation_output.includes(line)))
63
+ return false;
64
+ const paired = entry.proof.clean !== null || entry.proof.violation !== null;
65
+ return paired || clean_exit !== undefined
66
+ ? Object.keys(outcome).length === 5 && clean_exit === 0
67
+ : Object.keys(outcome).length === 4;
68
+ }
69
+ /**
70
+ * Verify the declared connection and execution surface with an identified principal.
71
+ * @param target - The expected connection and surface
72
+ * @param outcome - Signed identity check result
73
+ * @returns Whether the result proves identity on that exact surface
74
+ */
75
+ function credentialExercise(target, outcome) {
76
+ return (Object.keys(outcome).length === 4 &&
77
+ outcome.connection === target.connection &&
78
+ outcome.surface === target.surface &&
79
+ outcome.identity_verified === true &&
80
+ typeof outcome.principal === "string" &&
81
+ PRINCIPAL.test(outcome.principal));
82
+ }
83
+ /**
84
+ * Confirm that the documented incident exercise reached the restored generation.
85
+ * @param target - The release track in the plan
86
+ * @param outcome - Signed incident and rollback result
87
+ * @param completed - When the full exercise finished
88
+ * @returns Whether the result contains an ordered, verified recovery
89
+ */
90
+ function rollbackExercise(target, outcome, completed) {
91
+ const { detected_at, rolled_back_at, verified_at } = outcome;
92
+ return (Object.keys(outcome).length === 11 &&
93
+ outcome.release_track === target.release_track &&
94
+ [
95
+ outcome.incident,
96
+ outcome.actor,
97
+ outcome.finding,
98
+ outcome.previous_generation,
99
+ outcome.rolled_back_from,
100
+ ].every(isExerciseName) &&
101
+ outcome.restored_generation === outcome.previous_generation &&
102
+ outcome.rolled_back_from !== outcome.previous_generation &&
103
+ outcome.recovery_verified === true &&
104
+ isCanonicalUtc(detected_at) &&
105
+ isCanonicalUtc(rolled_back_at) &&
106
+ isCanonicalUtc(verified_at) &&
107
+ detected_at <= rolled_back_at &&
108
+ rolled_back_at <= verified_at &&
109
+ verified_at <= completed);
110
+ }
111
+ /**
112
+ * Confirm independent shadow comparisons and adversarial staff qualification.
113
+ * @param target - The declared role and minimum shadow period
114
+ * @param outcome - Signed qualification result
115
+ * @param completed - When the full exercise finished
116
+ * @returns Whether the required period and both checks are present
117
+ */
118
+ function staffExercise(target, outcome, completed) {
119
+ const { shadow_started_at, shadow_completed_at, comparisons } = outcome;
120
+ return (Object.keys(outcome).length === 9 &&
121
+ outcome.role === target.role &&
122
+ isExerciseName(outcome.actor) &&
123
+ isSha256(outcome.roster_sha256) &&
124
+ isCanonicalUtc(shadow_started_at) &&
125
+ isCanonicalUtc(shadow_completed_at) &&
126
+ shadow_completed_at <= completed &&
127
+ Date.parse(shadow_completed_at) - Date.parse(shadow_started_at) >=
128
+ target.minimum_shadow_seconds * 1000 &&
129
+ typeof comparisons === "number" &&
130
+ Number.isSafeInteger(comparisons) &&
131
+ comparisons > 0 &&
132
+ outcome.shadow_agreed === true &&
133
+ outcome.adversarial_passed === true &&
134
+ outcome.qualification === "qualified");
135
+ }
136
+ /**
137
+ * Apply the exact schema and completion test for the declared criterion.
138
+ * @param target - The typed target from the repository's plan
139
+ * @param outcome - The independently reviewed result fields
140
+ * @param register - Current gate declaration and scope
141
+ * @param completed - The signed completion timestamp
142
+ * @returns Whether the exercise measured what its target requires
143
+ */
144
+ function acceptedOutcome(target, outcome, register, completed) {
145
+ switch (target.criterion) {
146
+ case "AC5.5":
147
+ return gateExercise(target, outcome, register);
148
+ case "AC6.4":
149
+ return credentialExercise(target, outcome);
150
+ case "AC7.2":
151
+ return rollbackExercise(target, outcome, completed);
152
+ case "AC8.9":
153
+ return staffExercise(target, outcome, completed);
154
+ }
155
+ }
156
+ /**
157
+ * Bind an authenticated result to the exact target, environment, and current checks.
158
+ * @param target - The applicable criterion and declared surface
159
+ * @param result - A statement whose signer has already been checked
160
+ * @param binding - The current evidence context
161
+ * @returns The result's durable identity and completion time, or a fixed refusal
162
+ */
163
+ export function acceptExercise(target, result, binding) {
164
+ if (Object.keys(result).length !== 12 ||
165
+ result.schema_version !== 1 ||
166
+ result.repository !== binding.repository ||
167
+ result.environment !== binding.environment ||
168
+ result.checks_digest !== binding.checksDigest ||
169
+ result.target_id !== target.id ||
170
+ result.criterion !== target.criterion ||
171
+ result.scope !== target.scope ||
172
+ result.producer !== target.producer ||
173
+ result.adjudicator !== target.adjudicator)
174
+ return "The exercise is bound to a different target, environment, check definition, or authority.";
175
+ const { artifact, completed_at: completed, outcome } = result;
176
+ if (!isImmutableArtifact(artifact) ||
177
+ !isCanonicalUtc(completed) ||
178
+ !isJsonObject(outcome))
179
+ return "The exercise needs an immutable artifact identity, a UTC completion time, and a typed result.";
180
+ if (!isEvidenceFresh({ completed_at: completed, freshness_seconds: DEFAULT_FRESHNESS_SECONDS }, binding.now))
181
+ return "The exercise is outside its evidence lifetime.";
182
+ return acceptedOutcome(target, outcome, binding.register, completed)
183
+ ? { completedAt: completed }
184
+ : "The result does not establish the declared exercise.";
185
+ }
186
+ //# sourceMappingURL=exercise-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exercise-result.js","sourceRoot":"","sources":["../../src/controls/exercise-result.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAuB,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAoBpE,sEAAsE;AACtE,MAAM,gBAAgB,GAAG,qDAAqD,CAAC;AAE/E,sFAAsF;AACtF,MAAM,SAAS,GA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AAC,EAAE;QAC9B,MAAM,CAAC,SAAS,KAAK,MAAM,CAAC,SAAS;QACrC,MAAM,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK;QAC7B,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ;QACnC,MAAM,CAAC,WAAW,KAAK,MAAM,CAAC,WAAW;QAEzC,OAAO,2FAA2F,CAAC;IACrG,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAC9D,IACE,CAAC,mBAAmB,CAAC,QAAQ,CAAC;QAC9B,CAAC,cAAc,CAAC,SAAS,CAAC;QAC1B,CAAC,YAAY,CAAC,OAAO,CAAC;QAEtB,OAAO,+FAA+F,CAAC;IACzG,IACE,CAAC,eAAe,CACd,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,EACzE,OAAO,CAAC,GAAG,CACZ;QAED,OAAO,gDAAgD,CAAC;IAC1D,OAAO,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC;QAClE,CAAC,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE;QAC5B,CAAC,CAAC,sDAAsD,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,53 @@
1
+ /** What both halves of the check were tied to in the host. */
2
+ export interface HostProofSubject {
3
+ readonly repository: string;
4
+ readonly environment: string;
5
+ readonly work_item: string;
6
+ readonly entry_id: string;
7
+ readonly platform: string;
8
+ readonly executor_path: string;
9
+ readonly checks_digest: string;
10
+ }
11
+ /** The identity retained when a run's output is kept separately. */
12
+ export interface HostProofRunIdentity {
13
+ readonly run_id: string;
14
+ readonly run_url: string;
15
+ readonly commit: string;
16
+ readonly artifact_sha256: string;
17
+ }
18
+ /** One immutable platform run and the end of its check output. */
19
+ interface HostProofRun extends HostProofRunIdentity {
20
+ readonly started_at: string;
21
+ readonly completed_at: string;
22
+ readonly exit_status: number;
23
+ readonly output_excerpt: string;
24
+ }
25
+ /** A signed input stays distinct from the receipt that attest writes. */
26
+ export interface HostProofInput {
27
+ readonly schema_version: 1;
28
+ readonly subject: HostProofSubject;
29
+ readonly producer: string;
30
+ readonly adjudicator: string;
31
+ readonly clean: HostProofRun;
32
+ readonly violation: HostProofRun;
33
+ }
34
+ /**
35
+ * Validate the target of a paired proof.
36
+ * @param value - The signed subject
37
+ * @returns Whether it names the specific repository, entry and check files
38
+ */
39
+ export declare function isHostProofSubject(value: unknown): value is HostProofSubject;
40
+ /**
41
+ * Validate the provenance fields shared between an input run and its receipt.
42
+ * @param value - A run record supplied by either authorized role
43
+ * @returns Whether it identifies one hosted run and its artifact
44
+ */
45
+ export declare function isHostProofRunIdentity(value: unknown): value is HostProofRunIdentity;
46
+ /**
47
+ * Read the two halves and their common binding from an authenticated input.
48
+ * @param value - The body of an authorized signed envelope
49
+ * @returns The well-formed pair, or null when the declaration cannot be used
50
+ */
51
+ export declare function hostProofInput(value: unknown): HostProofInput | null;
52
+ export {};
53
+ //# sourceMappingURL=host-proof-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-proof-input.d.ts","sourceRoot":"","sources":["../../src/controls/host-proof-input.ts"],"names":[],"mappings":"AAQA,8DAA8D;AAC9D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,oEAAoE;AACpE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,C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