@descryy/core 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (362) hide show
  1. package/dist/budget/reply.d.ts +11 -46
  2. package/dist/budget/reply.d.ts.map +1 -1
  3. package/dist/budget/reply.js +10 -39
  4. package/dist/budget/reply.js.map +1 -1
  5. package/dist/budget/size.d.ts +2 -21
  6. package/dist/budget/size.d.ts.map +1 -1
  7. package/dist/budget/size.js +3 -24
  8. package/dist/budget/size.js.map +1 -1
  9. package/dist/capabilities/preconditions.d.ts +7 -68
  10. package/dist/capabilities/preconditions.d.ts.map +1 -1
  11. package/dist/capabilities/preconditions.js +6 -57
  12. package/dist/capabilities/preconditions.js.map +1 -1
  13. package/dist/contracts/engine.d.ts +26 -12
  14. package/dist/contracts/engine.d.ts.map +1 -1
  15. package/dist/contracts/engine.js +28 -11
  16. package/dist/contracts/engine.js.map +1 -1
  17. package/dist/contracts/index.d.ts +1 -1
  18. package/dist/contracts/index.d.ts.map +1 -1
  19. package/dist/contracts/index.js.map +1 -1
  20. package/dist/contracts/orphans.d.ts +28 -77
  21. package/dist/contracts/orphans.d.ts.map +1 -1
  22. package/dist/contracts/orphans.js +124 -94
  23. package/dist/contracts/orphans.js.map +1 -1
  24. package/dist/contracts/paths.d.ts +4 -114
  25. package/dist/contracts/paths.d.ts.map +1 -1
  26. package/dist/contracts/paths.js +7 -140
  27. package/dist/contracts/paths.js.map +1 -1
  28. package/dist/contracts/shapes.d.ts +13 -66
  29. package/dist/contracts/shapes.d.ts.map +1 -1
  30. package/dist/contracts/shapes.js +20 -91
  31. package/dist/contracts/shapes.js.map +1 -1
  32. package/dist/governance/budget.d.ts +12 -48
  33. package/dist/governance/budget.d.ts.map +1 -1
  34. package/dist/governance/budget.js +12 -48
  35. package/dist/governance/budget.js.map +1 -1
  36. package/dist/governance/candidate-boundary.d.ts +4 -32
  37. package/dist/governance/candidate-boundary.d.ts.map +1 -1
  38. package/dist/governance/candidate-boundary.js +4 -32
  39. package/dist/governance/candidate-boundary.js.map +1 -1
  40. package/dist/governance/escalation.d.ts +7 -45
  41. package/dist/governance/escalation.d.ts.map +1 -1
  42. package/dist/governance/escalation.js +7 -45
  43. package/dist/governance/escalation.js.map +1 -1
  44. package/dist/governance/fact-boundary.d.ts +7 -49
  45. package/dist/governance/fact-boundary.d.ts.map +1 -1
  46. package/dist/governance/fact-boundary.js +5 -43
  47. package/dist/governance/fact-boundary.js.map +1 -1
  48. package/dist/governance/finding-funnel.d.ts +11 -72
  49. package/dist/governance/finding-funnel.d.ts.map +1 -1
  50. package/dist/governance/finding-funnel.js +9 -68
  51. package/dist/governance/finding-funnel.js.map +1 -1
  52. package/dist/graph/build.d.ts +13 -75
  53. package/dist/graph/build.d.ts.map +1 -1
  54. package/dist/graph/build.js +0 -0
  55. package/dist/graph/build.js.map +1 -1
  56. package/dist/graph/cross-language.d.ts +4 -43
  57. package/dist/graph/cross-language.d.ts.map +1 -1
  58. package/dist/graph/cross-language.js +9 -77
  59. package/dist/graph/cross-language.js.map +1 -1
  60. package/dist/graph/index.d.ts +1 -1
  61. package/dist/graph/index.d.ts.map +1 -1
  62. package/dist/graph/merge.d.ts +8 -76
  63. package/dist/graph/merge.d.ts.map +1 -1
  64. package/dist/graph/merge.js +27 -77
  65. package/dist/graph/merge.js.map +1 -1
  66. package/dist/graph/observed-tests.d.ts +7 -68
  67. package/dist/graph/observed-tests.d.ts.map +1 -1
  68. package/dist/graph/observed-tests.js +5 -60
  69. package/dist/graph/observed-tests.js.map +1 -1
  70. package/dist/graph/persist.d.ts +2 -25
  71. package/dist/graph/persist.d.ts.map +1 -1
  72. package/dist/graph/persist.js +2 -25
  73. package/dist/graph/persist.js.map +1 -1
  74. package/dist/graph/runtime-confirmation.d.ts +14 -91
  75. package/dist/graph/runtime-confirmation.d.ts.map +1 -1
  76. package/dist/graph/runtime-confirmation.js +19 -103
  77. package/dist/graph/runtime-confirmation.js.map +1 -1
  78. package/dist/ledger/mint.d.ts +9 -43
  79. package/dist/ledger/mint.d.ts.map +1 -1
  80. package/dist/ledger/mint.js +15 -65
  81. package/dist/ledger/mint.js.map +1 -1
  82. package/dist/ledger/resolve.d.ts +13 -81
  83. package/dist/ledger/resolve.d.ts.map +1 -1
  84. package/dist/ledger/resolve.js +13 -76
  85. package/dist/ledger/resolve.js.map +1 -1
  86. package/dist/multipr/fingerprint.d.ts +5 -46
  87. package/dist/multipr/fingerprint.d.ts.map +1 -1
  88. package/dist/multipr/fingerprint.js +22 -74
  89. package/dist/multipr/fingerprint.js.map +1 -1
  90. package/dist/multipr/hidden-dependency.d.ts +13 -73
  91. package/dist/multipr/hidden-dependency.d.ts.map +1 -1
  92. package/dist/multipr/hidden-dependency.js +12 -63
  93. package/dist/multipr/hidden-dependency.js.map +1 -1
  94. package/dist/multipr/mechanical.d.ts +25 -160
  95. package/dist/multipr/mechanical.d.ts.map +1 -1
  96. package/dist/multipr/mechanical.js +21 -137
  97. package/dist/multipr/mechanical.js.map +1 -1
  98. package/dist/multipr/migration-heads.d.ts +18 -105
  99. package/dist/multipr/migration-heads.d.ts.map +1 -1
  100. package/dist/multipr/migration-heads.js +15 -84
  101. package/dist/multipr/migration-heads.js.map +1 -1
  102. package/dist/multipr/overlap.d.ts +16 -94
  103. package/dist/multipr/overlap.d.ts.map +1 -1
  104. package/dist/multipr/overlap.js +25 -105
  105. package/dist/multipr/overlap.js.map +1 -1
  106. package/dist/multipr/scope-store.d.ts +15 -80
  107. package/dist/multipr/scope-store.d.ts.map +1 -1
  108. package/dist/multipr/scope-store.js +17 -87
  109. package/dist/multipr/scope-store.js.map +1 -1
  110. package/dist/multipr/superseded.d.ts +10 -95
  111. package/dist/multipr/superseded.d.ts.map +1 -1
  112. package/dist/multipr/superseded.js +7 -60
  113. package/dist/multipr/superseded.js.map +1 -1
  114. package/dist/query/confirmed-facts.d.ts +12 -58
  115. package/dist/query/confirmed-facts.d.ts.map +1 -1
  116. package/dist/query/confirmed-facts.js +8 -47
  117. package/dist/query/confirmed-facts.js.map +1 -1
  118. package/dist/query/declared-value-closure.d.ts +13 -104
  119. package/dist/query/declared-value-closure.d.ts.map +1 -1
  120. package/dist/query/declared-value-closure.js +15 -104
  121. package/dist/query/declared-value-closure.js.map +1 -1
  122. package/dist/query/memory.d.ts +5 -9
  123. package/dist/query/memory.d.ts.map +1 -1
  124. package/dist/query/memory.js +31 -15
  125. package/dist/query/memory.js.map +1 -1
  126. package/dist/query/prominence.d.ts +6 -55
  127. package/dist/query/prominence.d.ts.map +1 -1
  128. package/dist/query/prominence.js +6 -55
  129. package/dist/query/prominence.js.map +1 -1
  130. package/dist/query/provider.d.ts +28 -81
  131. package/dist/query/provider.d.ts.map +1 -1
  132. package/dist/query/provider.js +8 -29
  133. package/dist/query/provider.js.map +1 -1
  134. package/dist/query/queries.d.ts +15 -65
  135. package/dist/query/queries.d.ts.map +1 -1
  136. package/dist/query/queries.js +43 -100
  137. package/dist/query/queries.js.map +1 -1
  138. package/dist/query/refusal-fetch.d.ts +8 -85
  139. package/dist/query/refusal-fetch.d.ts.map +1 -1
  140. package/dist/query/refusal-fetch.js +11 -93
  141. package/dist/query/refusal-fetch.js.map +1 -1
  142. package/dist/query/refusal-questions.d.ts +17 -92
  143. package/dist/query/refusal-questions.d.ts.map +1 -1
  144. package/dist/query/refusal-questions.js +14 -78
  145. package/dist/query/refusal-questions.js.map +1 -1
  146. package/dist/query/resolution-floor.d.ts +3 -23
  147. package/dist/query/resolution-floor.d.ts.map +1 -1
  148. package/dist/query/resolution-floor.js +3 -23
  149. package/dist/query/resolution-floor.js.map +1 -1
  150. package/dist/query/root-cause-score.d.ts +11 -161
  151. package/dist/query/root-cause-score.d.ts.map +1 -1
  152. package/dist/query/root-cause-score.js +6 -137
  153. package/dist/query/root-cause-score.js.map +1 -1
  154. package/dist/query/row-closure-picture.d.ts +5 -67
  155. package/dist/query/row-closure-picture.d.ts.map +1 -1
  156. package/dist/query/row-closure-picture.js +6 -67
  157. package/dist/query/row-closure-picture.js.map +1 -1
  158. package/dist/query/similar-incidents.d.ts +6 -41
  159. package/dist/query/similar-incidents.d.ts.map +1 -1
  160. package/dist/query/similar-incidents.js +15 -69
  161. package/dist/query/similar-incidents.js.map +1 -1
  162. package/dist/query/sqlite.d.ts +3 -7
  163. package/dist/query/sqlite.d.ts.map +1 -1
  164. package/dist/query/sqlite.js +13 -16
  165. package/dist/query/sqlite.js.map +1 -1
  166. package/dist/query/test-coverage.d.ts +5 -45
  167. package/dist/query/test-coverage.d.ts.map +1 -1
  168. package/dist/query/test-coverage.js +10 -53
  169. package/dist/query/test-coverage.js.map +1 -1
  170. package/dist/query/traverse.d.ts +22 -126
  171. package/dist/query/traverse.d.ts.map +1 -1
  172. package/dist/query/traverse.js +0 -0
  173. package/dist/query/traverse.js.map +1 -1
  174. package/dist/query/unresolved.d.ts +19 -164
  175. package/dist/query/unresolved.d.ts.map +1 -1
  176. package/dist/query/unresolved.js +11 -138
  177. package/dist/query/unresolved.js.map +1 -1
  178. package/dist/query/verification-status.d.ts +12 -109
  179. package/dist/query/verification-status.d.ts.map +1 -1
  180. package/dist/query/verification-status.js +9 -99
  181. package/dist/query/verification-status.js.map +1 -1
  182. package/dist/recording/migrate.d.ts +4 -10
  183. package/dist/recording/migrate.d.ts.map +1 -1
  184. package/dist/recording/migrate.js +4 -10
  185. package/dist/recording/migrate.js.map +1 -1
  186. package/dist/recording/reader.d.ts +2 -7
  187. package/dist/recording/reader.d.ts.map +1 -1
  188. package/dist/recording/reader.js +2 -7
  189. package/dist/recording/reader.js.map +1 -1
  190. package/dist/recording/redact.d.ts +6 -57
  191. package/dist/recording/redact.d.ts.map +1 -1
  192. package/dist/recording/redact.js +8 -64
  193. package/dist/recording/redact.js.map +1 -1
  194. package/dist/recording/schema.d.ts +3 -38
  195. package/dist/recording/schema.d.ts.map +1 -1
  196. package/dist/recording/schema.js +3 -38
  197. package/dist/recording/schema.js.map +1 -1
  198. package/dist/recording/writer.d.ts +11 -74
  199. package/dist/recording/writer.d.ts.map +1 -1
  200. package/dist/recording/writer.js +3 -43
  201. package/dist/recording/writer.js.map +1 -1
  202. package/dist/scoping/fanout.d.ts +6 -68
  203. package/dist/scoping/fanout.d.ts.map +1 -1
  204. package/dist/scoping/fanout.js +6 -68
  205. package/dist/scoping/fanout.js.map +1 -1
  206. package/dist/scoping/score.d.ts +20 -70
  207. package/dist/scoping/score.d.ts.map +1 -1
  208. package/dist/scoping/score.js +20 -70
  209. package/dist/scoping/score.js.map +1 -1
  210. package/dist/scoping/tiers.d.ts +4 -16
  211. package/dist/scoping/tiers.d.ts.map +1 -1
  212. package/dist/scoping/tiers.js +4 -16
  213. package/dist/scoping/tiers.js.map +1 -1
  214. package/dist/scoping/traverse.d.ts +3 -25
  215. package/dist/scoping/traverse.d.ts.map +1 -1
  216. package/dist/scoping/traverse.js +14 -49
  217. package/dist/scoping/traverse.js.map +1 -1
  218. package/dist/scoping/weights.d.ts +10 -74
  219. package/dist/scoping/weights.d.ts.map +1 -1
  220. package/dist/scoping/weights.js +14 -86
  221. package/dist/scoping/weights.js.map +1 -1
  222. package/dist/sources/confirmed/incidents.d.ts +5 -35
  223. package/dist/sources/confirmed/incidents.d.ts.map +1 -1
  224. package/dist/sources/confirmed/incidents.js +14 -48
  225. package/dist/sources/confirmed/incidents.js.map +1 -1
  226. package/dist/sources/git/diff.d.ts +71 -65
  227. package/dist/sources/git/diff.d.ts.map +1 -1
  228. package/dist/sources/git/diff.js +136 -83
  229. package/dist/sources/git/diff.js.map +1 -1
  230. package/dist/sources/git/env.d.ts +7 -0
  231. package/dist/sources/git/env.d.ts.map +1 -1
  232. package/dist/sources/git/env.js +10 -11
  233. package/dist/sources/git/env.js.map +1 -1
  234. package/dist/sources/git/history.d.ts +64 -84
  235. package/dist/sources/git/history.d.ts.map +1 -1
  236. package/dist/sources/git/history.js +141 -112
  237. package/dist/sources/git/history.js.map +1 -1
  238. package/dist/sources/git/incidents.d.ts +13 -75
  239. package/dist/sources/git/incidents.d.ts.map +1 -1
  240. package/dist/sources/git/incidents.js +21 -91
  241. package/dist/sources/git/incidents.js.map +1 -1
  242. package/dist/sources/git/index.d.ts +5 -3
  243. package/dist/sources/git/index.d.ts.map +1 -1
  244. package/dist/sources/git/index.js +3 -2
  245. package/dist/sources/git/index.js.map +1 -1
  246. package/dist/sources/git/source.d.ts +9 -79
  247. package/dist/sources/git/source.d.ts.map +1 -1
  248. package/dist/sources/git/source.js +0 -0
  249. package/dist/sources/git/source.js.map +1 -1
  250. package/dist/sources/migrations/across-change.d.ts +94 -0
  251. package/dist/sources/migrations/across-change.d.ts.map +1 -0
  252. package/dist/sources/migrations/across-change.js +278 -0
  253. package/dist/sources/migrations/across-change.js.map +1 -0
  254. package/dist/sources/migrations/dialects.d.ts +20 -36
  255. package/dist/sources/migrations/dialects.d.ts.map +1 -1
  256. package/dist/sources/migrations/dialects.js +11 -36
  257. package/dist/sources/migrations/dialects.js.map +1 -1
  258. package/dist/sources/migrations/index.d.ts +3 -1
  259. package/dist/sources/migrations/index.d.ts.map +1 -1
  260. package/dist/sources/migrations/index.js +2 -1
  261. package/dist/sources/migrations/index.js.map +1 -1
  262. package/dist/sources/migrations/read.d.ts +14 -79
  263. package/dist/sources/migrations/read.d.ts.map +1 -1
  264. package/dist/sources/migrations/read.js +14 -89
  265. package/dist/sources/migrations/read.js.map +1 -1
  266. package/dist/sources/workspace/workspace.d.ts +6 -42
  267. package/dist/sources/workspace/workspace.d.ts.map +1 -1
  268. package/dist/sources/workspace/workspace.js +10 -53
  269. package/dist/sources/workspace/workspace.js.map +1 -1
  270. package/dist/store/driver/driver.d.ts +9 -38
  271. package/dist/store/driver/driver.d.ts.map +1 -1
  272. package/dist/store/driver/driver.js +4 -22
  273. package/dist/store/driver/driver.js.map +1 -1
  274. package/dist/store/driver/node-sqlite.d.ts +3 -12
  275. package/dist/store/driver/node-sqlite.d.ts.map +1 -1
  276. package/dist/store/driver/node-sqlite.js +4 -18
  277. package/dist/store/driver/node-sqlite.js.map +1 -1
  278. package/dist/store/index.d.ts +2 -7
  279. package/dist/store/index.d.ts.map +1 -1
  280. package/dist/store/index.js +4 -10
  281. package/dist/store/index.js.map +1 -1
  282. package/dist/store/migrate.d.ts +14 -50
  283. package/dist/store/migrate.d.ts.map +1 -1
  284. package/dist/store/migrate.js +15 -52
  285. package/dist/store/migrate.js.map +1 -1
  286. package/dist/store/reader.d.ts +19 -84
  287. package/dist/store/reader.d.ts.map +1 -1
  288. package/dist/store/reader.js +25 -92
  289. package/dist/store/reader.js.map +1 -1
  290. package/dist/store/schema.d.ts +14 -76
  291. package/dist/store/schema.d.ts.map +1 -1
  292. package/dist/store/schema.js +14 -76
  293. package/dist/store/schema.js.map +1 -1
  294. package/dist/store/writer.d.ts +14 -88
  295. package/dist/store/writer.d.ts.map +1 -1
  296. package/dist/store/writer.js +29 -123
  297. package/dist/store/writer.js.map +1 -1
  298. package/dist/tiers/certify.d.ts +46 -281
  299. package/dist/tiers/certify.d.ts.map +1 -1
  300. package/dist/tiers/certify.js +46 -226
  301. package/dist/tiers/certify.js.map +1 -1
  302. package/dist/tiers/ladder.d.ts +7 -51
  303. package/dist/tiers/ladder.d.ts.map +1 -1
  304. package/dist/tiers/ladder.js +13 -89
  305. package/dist/tiers/ladder.js.map +1 -1
  306. package/dist/validation/attributes.d.ts +47 -0
  307. package/dist/validation/attributes.d.ts.map +1 -0
  308. package/dist/validation/attributes.js +130 -0
  309. package/dist/validation/attributes.js.map +1 -0
  310. package/dist/validation/config-graph.d.ts +7 -56
  311. package/dist/validation/config-graph.d.ts.map +1 -1
  312. package/dist/validation/config-graph.js +15 -61
  313. package/dist/validation/config-graph.js.map +1 -1
  314. package/dist/validation/env.d.ts +53 -2
  315. package/dist/validation/env.d.ts.map +1 -1
  316. package/dist/validation/env.js +99 -4
  317. package/dist/validation/env.js.map +1 -1
  318. package/dist/validation/index.d.ts +5 -1
  319. package/dist/validation/index.d.ts.map +1 -1
  320. package/dist/validation/index.js +3 -1
  321. package/dist/validation/index.js.map +1 -1
  322. package/dist/validation/join-substitution.d.ts +22 -120
  323. package/dist/validation/join-substitution.d.ts.map +1 -1
  324. package/dist/validation/join-substitution.js +13 -90
  325. package/dist/validation/join-substitution.js.map +1 -1
  326. package/dist/validation/migration-integrity.d.ts +72 -0
  327. package/dist/validation/migration-integrity.d.ts.map +1 -0
  328. package/dist/validation/migration-integrity.js +238 -0
  329. package/dist/validation/migration-integrity.js.map +1 -0
  330. package/dist/validation/migrations.d.ts +23 -88
  331. package/dist/validation/migrations.d.ts.map +1 -1
  332. package/dist/validation/migrations.js +20 -79
  333. package/dist/validation/migrations.js.map +1 -1
  334. package/dist/validation/nodes.d.ts +3 -1
  335. package/dist/validation/nodes.d.ts.map +1 -1
  336. package/dist/validation/nodes.js +3 -1
  337. package/dist/validation/nodes.js.map +1 -1
  338. package/dist/validation/rollback.d.ts +10 -73
  339. package/dist/validation/rollback.d.ts.map +1 -1
  340. package/dist/validation/rollback.js +23 -81
  341. package/dist/validation/rollback.js.map +1 -1
  342. package/dist/validation/route-drift.d.ts +9 -62
  343. package/dist/validation/route-drift.d.ts.map +1 -1
  344. package/dist/validation/route-drift.js +7 -52
  345. package/dist/validation/route-drift.js.map +1 -1
  346. package/dist/validation/sources.d.ts +16 -94
  347. package/dist/validation/sources.d.ts.map +1 -1
  348. package/dist/validation/sources.js +51 -147
  349. package/dist/validation/sources.js.map +1 -1
  350. package/dist/worker/pool.d.ts +6 -45
  351. package/dist/worker/pool.d.ts.map +1 -1
  352. package/dist/worker/pool.js +5 -42
  353. package/dist/worker/pool.js.map +1 -1
  354. package/dist/worker/protocol.d.ts +7 -20
  355. package/dist/worker/protocol.d.ts.map +1 -1
  356. package/dist/worker/protocol.js +3 -10
  357. package/dist/worker/protocol.js.map +1 -1
  358. package/dist/worker/traversal.worker.d.ts +2 -21
  359. package/dist/worker/traversal.worker.d.ts.map +1 -1
  360. package/dist/worker/traversal.worker.js +4 -23
  361. package/dist/worker/traversal.worker.js.map +1 -1
  362. package/package.json +11 -2
@@ -1,35 +1,8 @@
1
- /**
2
- * The hard per-run budget — §41 rule 16, `ai-layer-plan.md` §11 (Phase 4,
3
- * P17/P18). `ai-governance-spec.md` §8 names this explicitly as *not* its
4
- * document's job: *"a property of the harness (Phase 4, P17/P18), not of a
5
- * per-finding gate... Full spec: Phase 4 (P17), not this document."* This
6
- * module is that property.
7
- *
8
- * *"Enforced by the runtime harness, not by the AI's own judgment of when to
9
- * stop"* (`descry-ai-layer.md`, "Execution budget"). A cap the model can
10
- * reason its way past is not a cap (§41 rule 16's own words) — so, same as
11
- * G1–G4, this is a pure function the pipeline calls, never a prompt
12
- * instruction.
13
- *
14
- * ## Four caps, two scopes
15
- *
16
- * `ai-layer-plan.md` §11 names four: *"max turns per investigation · max
17
- * cost per run · max concurrent open hypotheses · max tool calls per
18
- * hypothesis."* Two are per-run (cost, concurrency); two are per-hypothesis
19
- * (turns, tool calls) and are checked against every currently-open
20
- * hypothesis independently — one hypothesis running long does not budget-fail
21
- * a sibling that has spent nothing.
22
- *
23
- * ## The default values
24
- *
25
- * `documents/architecture/investigation-budget-spec.md` (P17) is where these
26
- * are ruled and justified; this module imports them from there in spirit —
27
- * they are declared once, here, because the spec document is prose and this
28
- * is the value the harness actually reads. A caller may always supply its
29
- * own {@link InvestigationBudget}; the exported default is a starting point,
30
- * tuned from data, the same convention `CLAUDE.md` already applies to node
31
- * budgets.
32
- */
1
+ /** Hard per-run budget — §41 rule 16, ai-layer-plan §11 P17/P18. Enforced
2
+ * by the harness as a pure function (same as G1-G4), never the model's own
3
+ * judgment of when to stop. Four caps, two scopes: per-run (cost,
4
+ * concurrency) and per-hypothesis (turns, tool calls — checked against each
5
+ * open hypothesis independently). Defaults are a tuning starting point (P17). */
33
6
  /** The four caps, `ai-layer-plan.md` §11's own names. */
34
7
  export interface InvestigationBudget {
35
8
  /** Loop iterations spent investigating one hypothesis before it is forced to a terminal state. */
@@ -41,11 +14,8 @@ export interface InvestigationBudget {
41
14
  /** Total spend for the whole run, in USD. */
42
15
  readonly costCeilingPerRunUsd: number;
43
16
  }
44
- /**
45
- * P17's ruled starting values — `documents/architecture/investigation-budget-spec.md`.
46
- * Not a measurement; a starting point to tune from real runs, same as the
47
- * node budgets `CLAUDE.md` already treats this way.
48
- */
17
+ /** P17's starting values (`investigation-budget-spec.md`) — not a
18
+ * measurement, tuned from real runs like `CLAUDE.md`'s node budgets. */
49
19
  export declare const DEFAULT_INVESTIGATION_BUDGET: InvestigationBudget;
50
20
  /** Usage accumulated for one open hypothesis. */
51
21
  export interface HypothesisBudgetUsage {
@@ -73,17 +43,11 @@ export interface BudgetCheckResult {
73
43
  /** Every cap currently exceeded — empty when `withinBudget`. More than one may fire at once. */
74
44
  readonly exceeded: readonly BudgetCapExceeded[];
75
45
  }
76
- /**
77
- * Check `usage` against `budget`. Never throws — this is a check, not an
78
- * execution of the thing it is checking, same posture as G1–G4.
79
- */
46
+ /** Checks `usage` against `budget`. Never throws — a check, not an
47
+ * execution of the thing being checked (same posture as G1–G4). */
80
48
  export declare function checkRunBudget(budget: InvestigationBudget, usage: RunBudgetUsage): BudgetCheckResult;
81
- /**
82
- * Whether a specific hypothesis has reached its per-hypothesis round limit —
83
- * the input `../../ir/src/hypothesis.ts`'s `deriveHypothesisState` needs for
84
- * its `roundLimitReached` field. A thin, named convenience over
85
- * {@link checkRunBudget} so a caller does not have to re-derive "does this
86
- * one hypothesis's own cap show up in `exceeded`" by hand.
87
- */
49
+ /** Whether one hypothesis hit its round limit — feeds
50
+ * `hypothesis.ts`'s `deriveHypothesisState.roundLimitReached`. Thin
51
+ * convenience over {@link checkRunBudget}. */
88
52
  export declare function hypothesisRoundLimitReached(budget: InvestigationBudget, usage: HypothesisBudgetUsage): boolean;
89
53
  //# sourceMappingURL=budget.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"budget.d.ts","sourceRoot":"","sources":["../../src/governance/budget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;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Q,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sFAAsF;IACtF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,gGAAgG;IAChG,QAAQ,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACjD;AAED;oEACoE;AACpE,wBAAgB,cAAc,CAAC,MAAM,EAAE,mBAAmB,EAAE,KAAK,EAAE,cAAc,GAAG,iBAAiB,CAuCpG;AAED;;+CAE+C;AAC/C,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAKT"}
@@ -1,40 +1,10 @@
1
- /**
2
- * The hard per-run budget — §41 rule 16, `ai-layer-plan.md` §11 (Phase 4,
3
- * P17/P18). `ai-governance-spec.md` §8 names this explicitly as *not* its
4
- * document's job: *"a property of the harness (Phase 4, P17/P18), not of a
5
- * per-finding gate... Full spec: Phase 4 (P17), not this document."* This
6
- * module is that property.
7
- *
8
- * *"Enforced by the runtime harness, not by the AI's own judgment of when to
9
- * stop"* (`descry-ai-layer.md`, "Execution budget"). A cap the model can
10
- * reason its way past is not a cap (§41 rule 16's own words) — so, same as
11
- * G1–G4, this is a pure function the pipeline calls, never a prompt
12
- * instruction.
13
- *
14
- * ## Four caps, two scopes
15
- *
16
- * `ai-layer-plan.md` §11 names four: *"max turns per investigation · max
17
- * cost per run · max concurrent open hypotheses · max tool calls per
18
- * hypothesis."* Two are per-run (cost, concurrency); two are per-hypothesis
19
- * (turns, tool calls) and are checked against every currently-open
20
- * hypothesis independently — one hypothesis running long does not budget-fail
21
- * a sibling that has spent nothing.
22
- *
23
- * ## The default values
24
- *
25
- * `documents/architecture/investigation-budget-spec.md` (P17) is where these
26
- * are ruled and justified; this module imports them from there in spirit —
27
- * they are declared once, here, because the spec document is prose and this
28
- * is the value the harness actually reads. A caller may always supply its
29
- * own {@link InvestigationBudget}; the exported default is a starting point,
30
- * tuned from data, the same convention `CLAUDE.md` already applies to node
31
- * budgets.
32
- */
33
- /**
34
- * P17's ruled starting values — `documents/architecture/investigation-budget-spec.md`.
35
- * Not a measurement; a starting point to tune from real runs, same as the
36
- * node budgets `CLAUDE.md` already treats this way.
37
- */
1
+ /** Hard per-run budget — §41 rule 16, ai-layer-plan §11 P17/P18. Enforced
2
+ * by the harness as a pure function (same as G1-G4), never the model's own
3
+ * judgment of when to stop. Four caps, two scopes: per-run (cost,
4
+ * concurrency) and per-hypothesis (turns, tool calls — checked against each
5
+ * open hypothesis independently). Defaults are a tuning starting point (P17). */
6
+ /** P17's starting values (`investigation-budget-spec.md`) — not a
7
+ * measurement, tuned from real runs like `CLAUDE.md`'s node budgets. */
38
8
  export const DEFAULT_INVESTIGATION_BUDGET = {
39
9
  maxTurnsPerInvestigation: 8,
40
10
  maxToolCallsPerHypothesis: 6,
@@ -47,10 +17,8 @@ export const BUDGET_CAP_NAMES = [
47
17
  "maxConcurrentOpenHypotheses",
48
18
  "costCeilingPerRunUsd",
49
19
  ];
50
- /**
51
- * Check `usage` against `budget`. Never throws — this is a check, not an
52
- * execution of the thing it is checking, same posture as G1–G4.
53
- */
20
+ /** Checks `usage` against `budget`. Never throws — a check, not an
21
+ * execution of the thing being checked (same posture as G1–G4). */
54
22
  export function checkRunBudget(budget, usage) {
55
23
  const exceeded = [];
56
24
  if (usage.costSpentUsd > budget.costCeilingPerRunUsd) {
@@ -87,13 +55,9 @@ export function checkRunBudget(budget, usage) {
87
55
  }
88
56
  return { withinBudget: exceeded.length === 0, exceeded };
89
57
  }
90
- /**
91
- * Whether a specific hypothesis has reached its per-hypothesis round limit —
92
- * the input `../../ir/src/hypothesis.ts`'s `deriveHypothesisState` needs for
93
- * its `roundLimitReached` field. A thin, named convenience over
94
- * {@link checkRunBudget} so a caller does not have to re-derive "does this
95
- * one hypothesis's own cap show up in `exceeded`" by hand.
96
- */
58
+ /** Whether one hypothesis hit its round limit — feeds
59
+ * `hypothesis.ts`'s `deriveHypothesisState.roundLimitReached`. Thin
60
+ * convenience over {@link checkRunBudget}. */
97
61
  export function hypothesisRoundLimitReached(budget, usage) {
98
62
  return (usage.turnsSpent > budget.maxTurnsPerInvestigation ||
99
63
  usage.toolCallsSpent > budget.maxToolCallsPerHypothesis);
@@ -1 +1 @@
1
- {"version":3,"file":"budget.js","sourceRoot":"","sources":["../../src/governance/budget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAcH;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAwB;IAC/D,wBAAwB,EAAE,CAAC;IAC3B,yBAAyB,EAAE,CAAC;IAC5B,2BAA2B,EAAE,CAAC;IAC9B,oBAAoB,EAAE,GAAG;CAC1B,CAAC;AAgBF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,0BAA0B;IAC1B,2BAA2B;IAC3B,6BAA6B;IAC7B,sBAAsB;CACd,CAAC;AAkBX;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAA2B,EAAE,KAAqB;IAC/E,MAAM,QAAQ,GAAwB,EAAE,CAAC;IAEzC,IAAI,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC,oBAAoB,EAAE,CAAC;QACrD,QAAQ,CAAC,IAAI,CAAC;YACZ,GAAG,EAAE,sBAAsB;YAC3B,KAAK,EAAE,MAAM,CAAC,oBAAoB;YAClC,MAAM,EAAE,KAAK,CAAC,YAAY;SAC3B,CAAC,CAAC;IACL,CAAC;IAED,IAAI,KAAK,CAAC,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC,2BAA2B,EAAE,CAAC;QACrE,QAAQ,CAAC,IAAI,CAAC;YACZ,GAAG,EAAE,6BAA6B;YAClC,KAAK,EAAE,MAAM,CAAC,2BAA2B;YACzC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM;SACpC,CAAC,CAAC;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CAAC,YAAY;aACtC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;AAC3D,CAAC;AAED;;+CAE+C;AAC/C,MAAM,UAAU,2BAA2B,CACzC,MAA2B,EAC3B,KAA4B;IAE5B,OAAO,CACL,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC,wBAAwB;QAClD,KAAK,CAAC,cAAc,GAAG,MAAM,CAAC,yBAAyB,CACxD,CAAC;AACJ,CAAC"}
@@ -1,30 +1,6 @@
1
1
  /**
2
- * G2 — the candidate boundary (`ai-governance-spec.md` §3, `ai-layer-plan.md` §5).
3
- *
4
- * **The plan (stage 6) may only contain items from the deterministic
5
- * candidate set stages 3–5 produced.** Stage 5 (risk prioritization) is
6
- * itself deterministic — "scores in, ordering out. Does not invent
7
- * candidates" (`ai-layer-plan.md` §1) — so a plan item naming a node outside
8
- * that set could only have been invented by stage 6's own model slot, and is
9
- * rejected outright rather than down-ranked.
10
- *
11
- * Same shape as G1, one stage later, and built as the same kind of pure
12
- * function: `ai-governance-spec.md` §10 — "candidate-set membership checking
13
- * on the plan... no new tool surface, no new IR type." A candidate set is a
14
- * set of node ids; this module does not care how stages 3–5 produced it.
15
- *
16
- * ## Reject the item, not the plan
17
- *
18
- * `ai-governance-spec.md` §3's own negative control: "a plan naming a target
19
- * outside the candidate set. G2 must reject the item, not the whole plan —
20
- * the rest of the plan proceeds if the remaining items are valid." So the
21
- * result partitions the plan rather than failing it wholesale.
22
- *
23
- * `PlanItem` is deliberately the smallest shape G2 needs — one node id.
24
- * Phase 3's real plan item will carry more (a rationale, a priority, a test
25
- * strategy); the generic parameter lets a caller pass its real type through
26
- * unchanged and get it back in `accepted`/`rejected`, rather than this
27
- * module owning a plan-item type the pipeline would then have to conform to.
2
+ * G2, the candidate boundary (ai-governance-spec.md §3, ai-layer-plan.md §5): the stage-6 plan may only contain items from the deterministic candidate set stages 3-5 produced.
3
+ * A plan item naming an outside node can only have been invented by stage 6's model slot, rejected outright — the item, not the whole plan (§3's negative control). `PlanItem` is just a node id; the generic parameter passes a caller's real type through unchanged.
28
4
  */
29
5
  /** The smallest shape G2 needs from a plan item: what node it targets. */
30
6
  export interface PlanItem {
@@ -39,11 +15,7 @@ export interface CandidateBoundaryResult<T extends PlanItem> {
39
15
  readonly accepted: readonly T[];
40
16
  readonly rejected: readonly RejectedPlanItem<T>[];
41
17
  }
42
- /**
43
- * Check every item in `plan` against `candidateNodeIds` — the deterministic
44
- * set stages 3–5 produced. An item whose `targetNodeId` is not in that set
45
- * is rejected with a reason; the rest of the plan is unaffected. Never
46
- * throws — this is a check, not an execution of the thing it is checking.
47
- */
18
+ /** Check every plan item against candidateNodeIds; an item outside the set
19
+ * is rejected with a reason, the rest unaffected. Never throws. */
48
20
  export declare function checkCandidateBoundary<T extends PlanItem>(plan: readonly T[], candidateNodeIds: ReadonlySet<string>): CandidateBoundaryResult<T>;
49
21
  //# sourceMappingURL=candidate-boundary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"candidate-boundary.d.ts","sourceRoot":"","sources":["../../src/governance/candidate-boundary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,0EAA0E;AAC1E,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,QAAQ;IAClD,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACjB,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,uBAAuB,CAAC,CAAC,SAAS,QAAQ;IACzD,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;CACnD;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,QAAQ,EACvD,IAAI,EAAE,SAAS,CAAC,EAAE,EAClB,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,GACpC,uBAAuB,CAAC,CAAC,CAAC,CAgB5B"}
1
+ {"version":3,"file":"candidate-boundary.d.ts","sourceRoot":"","sources":["../../src/governance/candidate-boundary.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0EAA0E;AAC1E,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,QAAQ;IAClD,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACjB,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,uBAAuB,CAAC,CAAC,SAAS,QAAQ;IACzD,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;CACnD;AAED;oEACoE;AACpE,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,QAAQ,EACvD,IAAI,EAAE,SAAS,CAAC,EAAE,EAClB,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,GACpC,uBAAuB,CAAC,CAAC,CAAC,CAgB5B"}
@@ -1,37 +1,9 @@
1
1
  /**
2
- * G2 — the candidate boundary (`ai-governance-spec.md` §3, `ai-layer-plan.md` §5).
3
- *
4
- * **The plan (stage 6) may only contain items from the deterministic
5
- * candidate set stages 3–5 produced.** Stage 5 (risk prioritization) is
6
- * itself deterministic — "scores in, ordering out. Does not invent
7
- * candidates" (`ai-layer-plan.md` §1) — so a plan item naming a node outside
8
- * that set could only have been invented by stage 6's own model slot, and is
9
- * rejected outright rather than down-ranked.
10
- *
11
- * Same shape as G1, one stage later, and built as the same kind of pure
12
- * function: `ai-governance-spec.md` §10 — "candidate-set membership checking
13
- * on the plan... no new tool surface, no new IR type." A candidate set is a
14
- * set of node ids; this module does not care how stages 3–5 produced it.
15
- *
16
- * ## Reject the item, not the plan
17
- *
18
- * `ai-governance-spec.md` §3's own negative control: "a plan naming a target
19
- * outside the candidate set. G2 must reject the item, not the whole plan —
20
- * the rest of the plan proceeds if the remaining items are valid." So the
21
- * result partitions the plan rather than failing it wholesale.
22
- *
23
- * `PlanItem` is deliberately the smallest shape G2 needs — one node id.
24
- * Phase 3's real plan item will carry more (a rationale, a priority, a test
25
- * strategy); the generic parameter lets a caller pass its real type through
26
- * unchanged and get it back in `accepted`/`rejected`, rather than this
27
- * module owning a plan-item type the pipeline would then have to conform to.
28
- */
29
- /**
30
- * Check every item in `plan` against `candidateNodeIds` — the deterministic
31
- * set stages 3–5 produced. An item whose `targetNodeId` is not in that set
32
- * is rejected with a reason; the rest of the plan is unaffected. Never
33
- * throws — this is a check, not an execution of the thing it is checking.
2
+ * G2, the candidate boundary (ai-governance-spec.md §3, ai-layer-plan.md §5): the stage-6 plan may only contain items from the deterministic candidate set stages 3-5 produced.
3
+ * A plan item naming an outside node can only have been invented by stage 6's model slot, rejected outright — the item, not the whole plan (§3's negative control). `PlanItem` is just a node id; the generic parameter passes a caller's real type through unchanged.
34
4
  */
5
+ /** Check every plan item against candidateNodeIds; an item outside the set
6
+ * is rejected with a reason, the rest unaffected. Never throws. */
35
7
  export function checkCandidateBoundary(plan, candidateNodeIds) {
36
8
  const accepted = [];
37
9
  const rejected = [];
@@ -1 +1 @@
1
- {"version":3,"file":"candidate-boundary.js","sourceRoot":"","sources":["../../src/governance/candidate-boundary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAkBH;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAAkB,EAClB,gBAAqC;IAErC,MAAM,QAAQ,GAAQ,EAAE,CAAC;IACzB,MAAM,QAAQ,GAA0B,EAAE,CAAC;IAE3C,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;QACxB,IAAI,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YAC5C,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI;gBACJ,MAAM,EAAE,eAAe,IAAI,CAAC,YAAY,kDAAkD;aAC3F,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAChC,CAAC"}
1
+ {"version":3,"file":"candidate-boundary.js","sourceRoot":"","sources":["../../src/governance/candidate-boundary.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkBH;oEACoE;AACpE,MAAM,UAAU,sBAAsB,CACpC,IAAkB,EAClB,gBAAqC;IAErC,MAAM,QAAQ,GAAQ,EAAE,CAAC;IACzB,MAAM,QAAQ,GAA0B,EAAE,CAAC;IAE3C,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;QACxB,IAAI,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YAC5C,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI;gBACJ,MAAM,EAAE,eAAe,IAAI,CAAC,YAAY,kDAAkD;aAC3F,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAChC,CAAC"}
@@ -1,43 +1,8 @@
1
- /**
2
- * Escalation — §41 rule 17, `ai-layer-plan.md` §11 (Phase 4, P17/P18).
3
- *
4
- * *"AI must escalate to the developer rather than keep investigating
5
- * when..."* — three conditions named in the architecture (budget exhausted,
6
- * a hypothesis stuck past its round limit, unresolved graph/runtime
7
- * contradiction), widened to five in the plan's own §11: *"budget exhausted
8
- * with hypotheses open · unresolved contradictory evidence · a fact only a
9
- * human holds · an action gate reached · every hypothesis refuted with the
10
- * anomaly unexplained."*
11
- *
12
- * Same shape as {@link "./budget.ts"} and G1–G4: a pure function over
13
- * caller-supplied facts, evaluated outside the model, never a prompt telling
14
- * the model when to stop. `ai-layer-plan.md` §0's own words, one layer up:
15
- * *"a rule the model can reason its way past is not a rule."*
16
- *
17
- * ## Four of five inputs are not computed here
18
- *
19
- * Only the budget trigger is derivable from `./budget.ts`'s own output.
20
- * The other four name conditions this module has no way to detect on its
21
- * own, and deliberately does not try to:
22
- *
23
- * - **Unresolved contradictory evidence** — §10's graph-vs-runtime
24
- * contradiction machinery (P21) is what detects a contradiction at all;
25
- * this module only reacts to the caller having found one.
26
- * - **A fact only a human holds** — inherits the `questions` MCP tool /
27
- * `ConfirmedFact` machinery (`packages/core/src/query/refusal-questions.ts`,
28
- * `confirmed-facts.ts`) already built for a different stage. Whether an
29
- * open, unanswered question exists is that machinery's own state, not
30
- * something recomputed here.
31
- * - **An action gate reached** — G5 (`ai-tool-contract.md` §7's two-call
32
- * handshake) already governs whether a write may proceed; this module
33
- * just names the fact of having reached it as one more reason to stop and
34
- * hand control back.
35
- * - **Every hypothesis refuted, anomaly unexplained** — depends on every
36
- * open hypothesis's terminal state (`../../ir/src/hypothesis.ts`) plus a
37
- * judgement that no other explanation covers the original anomaly. The
38
- * "no other explanation" half is not a fact this module can derive from a
39
- * list of rejected hypotheses alone, so it stays a caller-supplied flag.
40
- */
1
+ /** Escalation — §41 rule 17, ai-layer-plan §11 P17/P18. Pure function over
2
+ * caller-supplied facts (like `budget.ts`/G1-G4) — never a prompt telling
3
+ * the model when to stop. Five triggers: budget exhausted w/ open
4
+ * hypotheses (only one computed here); unresolved contradiction; a fact
5
+ * only a human holds; an action gate reached; every hypothesis refuted, anomaly unexplained. */
41
6
  export declare const ESCALATION_TRIGGERS: readonly ["budget-exhausted-with-hypotheses-open", "unresolved-contradictory-evidence", "fact-only-a-human-holds", "action-gate-reached", "every-hypothesis-refuted-unexplained"];
42
7
  export type EscalationTrigger = (typeof ESCALATION_TRIGGERS)[number];
43
8
  export interface EscalationCheckInput {
@@ -54,10 +19,7 @@ export interface EscalationCheckInput {
54
19
  /** Caller-supplied: every hypothesis this run opened has reached `rejected`, and the anomaly that started the investigation still has no confirmed or supported explanation. */
55
20
  readonly allHypothesesRejectedAnomalyUnexplained: boolean;
56
21
  }
57
- /**
58
- * Check `input` against all five triggers. Never throws — a check, not an
59
- * execution of the thing it is checking. More than one trigger may fire in
60
- * the same call; an empty result means the loop may keep running.
61
- */
22
+ /** Checks `input` against all five triggers. Never throws — more than one
23
+ * may fire at once; empty means the loop may keep running. */
62
24
  export declare function checkEscalation(input: EscalationCheckInput): readonly EscalationTrigger[];
63
25
  //# sourceMappingURL=escalation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"escalation.d.ts","sourceRoot":"","sources":["../../src/governance/escalation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,eAAO,MAAM,mBAAmB,mLAMtB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,MAAM,WAAW,oBAAoB;IACnC,yEAAyE;IACzE,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,wGAAwG;IACxG,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,2IAA2I;IAC3I,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC;IAC7C,uIAAuI;IACvI,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC;IAC7C,4GAA4G;IAC5G,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,gLAAgL;IAChL,QAAQ,CAAC,uCAAuC,EAAE,OAAO,CAAC;CAC3D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,SAAS,iBAAiB,EAAE,CAoBzF"}
1
+ {"version":3,"file":"escalation.d.ts","sourceRoot":"","sources":["../../src/governance/escalation.ts"],"names":[],"mappings":"AAAA;;;;iGAIiG;AAEjG,eAAO,MAAM,mBAAmB,mLAMtB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,MAAM,WAAW,oBAAoB;IACnC,yEAAyE;IACzE,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,wGAAwG;IACxG,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,2IAA2I;IAC3I,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC;IAC7C,uIAAuI;IACvI,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC;IAC7C,4GAA4G;IAC5G,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,gLAAgL;IAChL,QAAQ,CAAC,uCAAuC,EAAE,OAAO,CAAC;CAC3D;AAED;+DAC+D;AAC/D,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,SAAS,iBAAiB,EAAE,CAoBzF"}
@@ -1,43 +1,8 @@
1
- /**
2
- * Escalation — §41 rule 17, `ai-layer-plan.md` §11 (Phase 4, P17/P18).
3
- *
4
- * *"AI must escalate to the developer rather than keep investigating
5
- * when..."* — three conditions named in the architecture (budget exhausted,
6
- * a hypothesis stuck past its round limit, unresolved graph/runtime
7
- * contradiction), widened to five in the plan's own §11: *"budget exhausted
8
- * with hypotheses open · unresolved contradictory evidence · a fact only a
9
- * human holds · an action gate reached · every hypothesis refuted with the
10
- * anomaly unexplained."*
11
- *
12
- * Same shape as {@link "./budget.ts"} and G1–G4: a pure function over
13
- * caller-supplied facts, evaluated outside the model, never a prompt telling
14
- * the model when to stop. `ai-layer-plan.md` §0's own words, one layer up:
15
- * *"a rule the model can reason its way past is not a rule."*
16
- *
17
- * ## Four of five inputs are not computed here
18
- *
19
- * Only the budget trigger is derivable from `./budget.ts`'s own output.
20
- * The other four name conditions this module has no way to detect on its
21
- * own, and deliberately does not try to:
22
- *
23
- * - **Unresolved contradictory evidence** — §10's graph-vs-runtime
24
- * contradiction machinery (P21) is what detects a contradiction at all;
25
- * this module only reacts to the caller having found one.
26
- * - **A fact only a human holds** — inherits the `questions` MCP tool /
27
- * `ConfirmedFact` machinery (`packages/core/src/query/refusal-questions.ts`,
28
- * `confirmed-facts.ts`) already built for a different stage. Whether an
29
- * open, unanswered question exists is that machinery's own state, not
30
- * something recomputed here.
31
- * - **An action gate reached** — G5 (`ai-tool-contract.md` §7's two-call
32
- * handshake) already governs whether a write may proceed; this module
33
- * just names the fact of having reached it as one more reason to stop and
34
- * hand control back.
35
- * - **Every hypothesis refuted, anomaly unexplained** — depends on every
36
- * open hypothesis's terminal state (`../../ir/src/hypothesis.ts`) plus a
37
- * judgement that no other explanation covers the original anomaly. The
38
- * "no other explanation" half is not a fact this module can derive from a
39
- * list of rejected hypotheses alone, so it stays a caller-supplied flag.
40
- */
1
+ /** Escalation — §41 rule 17, ai-layer-plan §11 P17/P18. Pure function over
2
+ * caller-supplied facts (like `budget.ts`/G1-G4) — never a prompt telling
3
+ * the model when to stop. Five triggers: budget exhausted w/ open
4
+ * hypotheses (only one computed here); unresolved contradiction; a fact
5
+ * only a human holds; an action gate reached; every hypothesis refuted, anomaly unexplained. */
41
6
  export const ESCALATION_TRIGGERS = [
42
7
  "budget-exhausted-with-hypotheses-open",
43
8
  "unresolved-contradictory-evidence",
@@ -45,11 +10,8 @@ export const ESCALATION_TRIGGERS = [
45
10
  "action-gate-reached",
46
11
  "every-hypothesis-refuted-unexplained",
47
12
  ];
48
- /**
49
- * Check `input` against all five triggers. Never throws — a check, not an
50
- * execution of the thing it is checking. More than one trigger may fire in
51
- * the same call; an empty result means the loop may keep running.
52
- */
13
+ /** Checks `input` against all five triggers. Never throws — more than one
14
+ * may fire at once; empty means the loop may keep running. */
53
15
  export function checkEscalation(input) {
54
16
  const triggers = [];
55
17
  if (input.budgetExceeded && input.openHypothesesCount > 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"escalation.js","sourceRoot":"","sources":["../../src/governance/escalation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,uCAAuC;IACvC,mCAAmC;IACnC,yBAAyB;IACzB,qBAAqB;IACrB,sCAAsC;CAC9B,CAAC;AAmBX;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,QAAQ,GAAwB,EAAE,CAAC;IAEzC,IAAI,KAAK,CAAC,cAAc,IAAI,KAAK,CAAC,mBAAmB,GAAG,CAAC,EAAE,CAAC;QAC1D,QAAQ,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;IACzD,CAAC;IACD,IAAI,KAAK,CAAC,0BAA0B,EAAE,CAAC;QACrC,QAAQ,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,KAAK,CAAC,0BAA0B,EAAE,CAAC;QACrC,QAAQ,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAC3C,CAAC;IACD,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC5B,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,KAAK,CAAC,uCAAuC,EAAE,CAAC;QAClD,QAAQ,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
1
+ {"version":3,"file":"escalation.js","sourceRoot":"","sources":["../../src/governance/escalation.ts"],"names":[],"mappings":"AAAA;;;;iGAIiG;AAEjG,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,uCAAuC;IACvC,mCAAmC;IACnC,yBAAyB;IACzB,qBAAqB;IACrB,sCAAsC;CAC9B,CAAC;AAmBX;+DAC+D;AAC/D,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,QAAQ,GAAwB,EAAE,CAAC;IAEzC,IAAI,KAAK,CAAC,cAAc,IAAI,KAAK,CAAC,mBAAmB,GAAG,CAAC,EAAE,CAAC;QAC1D,QAAQ,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;IACzD,CAAC;IACD,IAAI,KAAK,CAAC,0BAA0B,EAAE,CAAC;QACrC,QAAQ,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,KAAK,CAAC,0BAA0B,EAAE,CAAC;QACrC,QAAQ,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAC3C,CAAC;IACD,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC5B,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,KAAK,CAAC,uCAAuC,EAAE,CAAC;QAClD,QAAQ,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,49 +1,11 @@
1
- /**
2
- * G1 — the fact boundary (`ai-governance-spec.md` §2, `ai-layer-plan.md` §5).
3
- *
4
- * **No fact enters the model's context unless a tool produced it. No fact
5
- * leaves a model slot unless it references something a tool returned.**
6
- *
7
- * This is the first of the two gates P9 builds (`ai-governance-spec.md` §10):
8
- * "citation-checking on every slot output... a pure function over
9
- * already-recorded tool calls... no new tool surface, no new IR type."
10
- *
11
- * ## Why a citation is `{ seq }`, not `{ runId, seq }`
12
- *
13
- * `recorded_calls`'s primary key is `(run_id, seq)` (`../recording/schema.ts`),
14
- * and the gate is defined as checking a claim "against **this run's own**
15
- * recorded tool calls" — the run is the boundary, not a parameter a slot
16
- * output gets to name. `checkFactBoundary` takes the `RecordedRun` it is
17
- * checking against and a citation carries only `seq`. A citation naming a
18
- * call from a different run does not fail because the run id mismatches —
19
- * it fails because no call with that `seq` exists in *this* run's own
20
- * ordered list, which is the same failure as a fabricated seq and needs no
21
- * separate case (negative control 7, `ai-layer-plan.md` §9 layer 5).
22
- *
23
- * ## Why a whole claim is rejected on any unresolved citation
24
- *
25
- * A claim with two citations, one real and one fabricated, is not "half
26
- * true." §41.1 (never invent graph facts) does not have a partial-credit
27
- * form, so one bad citation invalidates the claim it was attached to, not
28
- * just itself — the same posture `ai-tool-contract.md`'s invariants take
29
- * toward a payload that "looks complete."
30
- *
31
- * ## Path is a key array, not a string
32
- *
33
- * `data.callers[0]` is a plausible citation shape, but parsing that string
34
- * back into a traversal is a small grammar this gate does not need to own.
35
- * `readonly (string | number)[]` says the same thing with no parser and no
36
- * ambiguity about what `[0]` means against an object vs. an array.
37
- */
1
+ /** G1 fact boundary (`ai-governance-spec.md` §2, `ai-layer-plan.md` §5): no fact enters or leaves
2
+ * a model slot without a tool citation. Citation is `{seq}`, not `{runId,seq}` — the run itself
3
+ * is the boundary. One unresolved citation rejects the whole claim (§41.1: no partial credit). */
38
4
  import type { RecordedRun } from "../recording/reader.ts";
39
5
  /** One segment of a citation path: an object key or an array index. */
40
6
  export type CitationPathSegment = string | number;
41
- /**
42
- * A pointer at one fact a tool call actually returned, within the run being
43
- * checked. `seq` names the call (`recorded_calls.seq`); `path`, when given,
44
- * narrows the citation to a field within that call's `result` rather than
45
- * the whole envelope. Omitted `path` cites the whole result.
46
- */
7
+ /** A pointer at one fact a tool call returned, within the run being checked. `seq` names the
8
+ * call; `path`, when given, narrows to a field in that call's `result`. Omitted `path` cites the whole result. */
47
9
  export interface Citation {
48
10
  readonly seq: number;
49
11
  readonly path?: readonly CitationPathSegment[];
@@ -67,11 +29,7 @@ export interface FactBoundaryResult {
67
29
  readonly accepted: readonly FactualClaim[];
68
30
  readonly rejected: readonly RejectedClaim[];
69
31
  }
70
- /**
71
- * Check every claim in `output` against `run`'s own recorded calls. A claim
72
- * with no citations, or with any citation that does not resolve, is
73
- * rejected with its reasons; everything else is accepted. Never throws —
74
- * this is a check, not an execution of the thing it is checking.
75
- */
32
+ /** Checks every claim in `output` against `run`'s own recorded calls. Uncited or unresolved
33
+ * citations reject the claim with reasons; everything else is accepted. Never throws — a check, not an execution. */
76
34
  export declare function checkFactBoundary(output: SlotOutput, run: RecordedRun): FactBoundaryResult;
77
35
  //# sourceMappingURL=fact-boundary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fact-boundary.d.ts","sourceRoot":"","sources":["../../src/governance/fact-boundary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAExE,uEAAuE;AACvE,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,CAAC;AAElD;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;CAChD;AAED,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,gGAAgG;IAChG,QAAQ,CAAC,SAAS,EAAE,SAAS,QAAQ,EAAE,CAAC;CACzC;AAED,kGAAkG;AAClG,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;CAC1C;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,6FAA6F;IAC7F,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,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AAW,GAAG,kBAAkB,CAwB1F"}
@@ -1,40 +1,6 @@
1
- /**
2
- * G1 — the fact boundary (`ai-governance-spec.md` §2, `ai-layer-plan.md` §5).
3
- *
4
- * **No fact enters the model's context unless a tool produced it. No fact
5
- * leaves a model slot unless it references something a tool returned.**
6
- *
7
- * This is the first of the two gates P9 builds (`ai-governance-spec.md` §10):
8
- * "citation-checking on every slot output... a pure function over
9
- * already-recorded tool calls... no new tool surface, no new IR type."
10
- *
11
- * ## Why a citation is `{ seq }`, not `{ runId, seq }`
12
- *
13
- * `recorded_calls`'s primary key is `(run_id, seq)` (`../recording/schema.ts`),
14
- * and the gate is defined as checking a claim "against **this run's own**
15
- * recorded tool calls" — the run is the boundary, not a parameter a slot
16
- * output gets to name. `checkFactBoundary` takes the `RecordedRun` it is
17
- * checking against and a citation carries only `seq`. A citation naming a
18
- * call from a different run does not fail because the run id mismatches —
19
- * it fails because no call with that `seq` exists in *this* run's own
20
- * ordered list, which is the same failure as a fabricated seq and needs no
21
- * separate case (negative control 7, `ai-layer-plan.md` §9 layer 5).
22
- *
23
- * ## Why a whole claim is rejected on any unresolved citation
24
- *
25
- * A claim with two citations, one real and one fabricated, is not "half
26
- * true." §41.1 (never invent graph facts) does not have a partial-credit
27
- * form, so one bad citation invalidates the claim it was attached to, not
28
- * just itself — the same posture `ai-tool-contract.md`'s invariants take
29
- * toward a payload that "looks complete."
30
- *
31
- * ## Path is a key array, not a string
32
- *
33
- * `data.callers[0]` is a plausible citation shape, but parsing that string
34
- * back into a traversal is a small grammar this gate does not need to own.
35
- * `readonly (string | number)[]` says the same thing with no parser and no
36
- * ambiguity about what `[0]` means against an object vs. an array.
37
- */
1
+ /** G1 fact boundary (`ai-governance-spec.md` §2, `ai-layer-plan.md` §5): no fact enters or leaves
2
+ * a model slot without a tool citation. Citation is `{seq}`, not `{runId,seq}` — the run itself
3
+ * is the boundary. One unresolved citation rejects the whole claim (§41.1: no partial credit). */
38
4
  function resolvesWithin(value, path) {
39
5
  let cursor = value;
40
6
  for (const key of path) {
@@ -61,12 +27,8 @@ function checkCitation(citation, callsBySeq) {
61
27
  }
62
28
  return null;
63
29
  }
64
- /**
65
- * Check every claim in `output` against `run`'s own recorded calls. A claim
66
- * with no citations, or with any citation that does not resolve, is
67
- * rejected with its reasons; everything else is accepted. Never throws —
68
- * this is a check, not an execution of the thing it is checking.
69
- */
30
+ /** Checks every claim in `output` against `run`'s own recorded calls. Uncited or unresolved
31
+ * citations reject the claim with reasons; everything else is accepted. Never throws — a check, not an execution. */
70
32
  export function checkFactBoundary(output, run) {
71
33
  const callsBySeq = new Map(run.calls.map((call) => [call.seq, call]));
72
34
  const accepted = [];
@@ -1 +1 @@
1
- {"version":3,"file":"fact-boundary.js","sourceRoot":"","sources":["../../src/governance/fact-boundary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAyCH,SAAS,cAAc,CAAC,KAAc,EAAE,IAAoC;IAC1E,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAChE,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,IAAI,MAAM,CAAC,MAAM;gBAAE,OAAO,KAAK,CAAC;QACzG,CAAC;aAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;YACvC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,GAAI,MAA+C,CAAC,GAAG,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED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