kibi-cli 1.0.1 → 2.1.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 (548) hide show
  1. package/dist/cli-errors.d.ts +3 -1
  2. package/dist/cli-errors.d.ts.map +1 -1
  3. package/dist/cli-errors.js +4 -1
  4. package/dist/cli-json-command.d.ts +1 -0
  5. package/dist/cli-json-command.d.ts.map +1 -1
  6. package/dist/cli-json-command.js +13 -4
  7. package/dist/cli-operation-loader.js +3 -3
  8. package/dist/cli-operation-metadata.d.ts +4 -3
  9. package/dist/cli-operation-metadata.d.ts.map +1 -1
  10. package/dist/cli-operation-metadata.js +7 -5
  11. package/dist/cli-protocol.js +1 -1
  12. package/dist/cli-register-maintenance.d.ts.map +1 -1
  13. package/dist/cli-register-maintenance.js +7 -0
  14. package/dist/cli-register-proof.d.ts +3 -0
  15. package/dist/cli-register-proof.d.ts.map +1 -0
  16. package/dist/cli-register-proof.js +127 -0
  17. package/dist/cli-register-reporting.d.ts.map +1 -1
  18. package/dist/cli-register-reporting.js +7 -0
  19. package/dist/cli.d.ts +4 -0
  20. package/dist/cli.d.ts.map +1 -1
  21. package/dist/cli.js +19 -10
  22. package/dist/commands/branch.d.ts +1 -0
  23. package/dist/commands/branch.d.ts.map +1 -1
  24. package/dist/commands/branch.js +8 -4
  25. package/dist/commands/check-generated.d.ts +7 -0
  26. package/dist/commands/check-generated.d.ts.map +1 -0
  27. package/dist/commands/check-generated.js +192 -0
  28. package/dist/commands/check.d.ts +14 -0
  29. package/dist/commands/check.d.ts.map +1 -1
  30. package/dist/commands/check.js +193 -46
  31. package/dist/commands/coverage.d.ts +1 -0
  32. package/dist/commands/coverage.d.ts.map +1 -1
  33. package/dist/commands/coverage.js +6 -0
  34. package/dist/commands/doctor.d.ts +22 -0
  35. package/dist/commands/doctor.d.ts.map +1 -1
  36. package/dist/commands/doctor.js +170 -23
  37. package/dist/commands/engine.d.ts +12 -0
  38. package/dist/commands/engine.d.ts.map +1 -1
  39. package/dist/commands/engine.js +42 -0
  40. package/dist/commands/github-init.d.ts +1 -0
  41. package/dist/commands/github-init.d.ts.map +1 -1
  42. package/dist/commands/github-init.js +9 -5
  43. package/dist/commands/init-helpers.d.ts.map +1 -1
  44. package/dist/commands/init-helpers.js +49 -10
  45. package/dist/commands/migrate.d.ts +4 -0
  46. package/dist/commands/migrate.d.ts.map +1 -1
  47. package/dist/commands/migrate.js +7 -7
  48. package/dist/commands/proof-explain.d.ts +10 -0
  49. package/dist/commands/proof-explain.d.ts.map +1 -0
  50. package/dist/commands/proof-explain.js +45 -0
  51. package/dist/commands/proof-impact.d.ts +7 -0
  52. package/dist/commands/proof-impact.d.ts.map +1 -0
  53. package/dist/commands/proof-impact.js +39 -0
  54. package/dist/commands/proof-migrate-legacy.d.ts +7 -0
  55. package/dist/commands/proof-migrate-legacy.d.ts.map +1 -0
  56. package/dist/commands/proof-migrate-legacy.js +45 -0
  57. package/dist/commands/proof-prune.d.ts +8 -0
  58. package/dist/commands/proof-prune.d.ts.map +1 -0
  59. package/dist/commands/proof-prune.js +53 -0
  60. package/dist/commands/prove.d.ts +37 -0
  61. package/dist/commands/prove.d.ts.map +1 -0
  62. package/dist/commands/prove.js +470 -0
  63. package/dist/commands/report.d.ts.map +1 -1
  64. package/dist/commands/report.js +18 -3
  65. package/dist/commands/sync/discovery.d.ts +3 -0
  66. package/dist/commands/sync/discovery.d.ts.map +1 -1
  67. package/dist/commands/sync/discovery.js +36 -28
  68. package/dist/commands/sync/manifest.d.ts +2 -1
  69. package/dist/commands/sync/manifest.d.ts.map +1 -1
  70. package/dist/commands/sync/manifest.js +55 -21
  71. package/dist/commands/sync/persistence.d.ts +4 -1
  72. package/dist/commands/sync/persistence.d.ts.map +1 -1
  73. package/dist/commands/sync/persistence.js +31 -14
  74. package/dist/commands/sync/staging.d.ts +1 -0
  75. package/dist/commands/sync/staging.d.ts.map +1 -1
  76. package/dist/commands/sync/staging.js +5 -2
  77. package/dist/commands/sync/untracked-targets.d.ts +24 -0
  78. package/dist/commands/sync/untracked-targets.d.ts.map +1 -0
  79. package/dist/commands/sync/untracked-targets.js +108 -0
  80. package/dist/commands/sync.d.ts +11 -1
  81. package/dist/commands/sync.d.ts.map +1 -1
  82. package/dist/commands/sync.js +74 -30
  83. package/dist/engine-daemon.d.ts +3 -1
  84. package/dist/engine-daemon.d.ts.map +1 -1
  85. package/dist/engine-daemon.js +49 -20
  86. package/dist/engine.d.ts +17 -77
  87. package/dist/engine.d.ts.map +1 -1
  88. package/dist/engine.js +331 -91
  89. package/dist/env/bootstrap.d.ts +84 -0
  90. package/dist/env/bootstrap.d.ts.map +1 -0
  91. package/dist/env/bootstrap.js +310 -0
  92. package/dist/extractors/manifest.d.ts +5 -0
  93. package/dist/extractors/manifest.d.ts.map +1 -1
  94. package/dist/extractors/manifest.js +46 -1
  95. package/dist/extractors/markdown.d.ts +7 -3
  96. package/dist/extractors/markdown.d.ts.map +1 -1
  97. package/dist/extractors/markdown.js +60 -24
  98. package/dist/extractors/playwright-cases.js +1 -1
  99. package/dist/extractors/relationships.d.ts +6 -0
  100. package/dist/extractors/relationships.d.ts.map +1 -1
  101. package/dist/extractors/relationships.js +1 -1
  102. package/dist/extractors/symbol-coordinates.d.ts.map +1 -1
  103. package/dist/extractors/symbols-coordinator.d.ts +8 -0
  104. package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
  105. package/dist/extractors/symbols-coordinator.js +40 -0
  106. package/dist/extractors/symbols-ts.d.ts +9 -19
  107. package/dist/extractors/symbols-ts.d.ts.map +1 -1
  108. package/dist/extractors/symbols-ts.js +34 -429
  109. package/dist/intent-search.d.ts +1 -0
  110. package/dist/intent-search.d.ts.map +1 -1
  111. package/dist/intent-search.js +11 -8
  112. package/dist/logic/ir.d.ts +1 -0
  113. package/dist/logic/ir.d.ts.map +1 -1
  114. package/dist/logic/ir.js +1 -1
  115. package/dist/operations/bootstrap/activation.d.ts +2 -1
  116. package/dist/operations/bootstrap/activation.d.ts.map +1 -1
  117. package/dist/operations/bootstrap/activation.js +11 -3
  118. package/dist/operations/bootstrap/generate.d.ts +2 -1
  119. package/dist/operations/bootstrap/generate.d.ts.map +1 -1
  120. package/dist/operations/bootstrap/generate.js +6 -3
  121. package/dist/operations/bootstrap/guidance.d.ts +1 -0
  122. package/dist/operations/bootstrap/guidance.d.ts.map +1 -1
  123. package/dist/operations/bootstrap/guidance.js +1 -1
  124. package/dist/operations/modeling/model-requirement.d.ts +5 -0
  125. package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
  126. package/dist/operations/modeling/model-requirement.js +57 -46
  127. package/dist/operations/modeling/predicate-applicability.d.ts.map +1 -1
  128. package/dist/operations/modeling/predicate-applicability.js +103 -4
  129. package/dist/operations/modeling/predicate-catalog-2.d.ts.map +1 -1
  130. package/dist/operations/modeling/predicate-catalog-2.js +18 -2
  131. package/dist/operations/modeling/predicate-catalog-3.d.ts.map +1 -1
  132. package/dist/operations/modeling/predicate-catalog-3.js +17 -1
  133. package/dist/operations/modeling/predicate-catalog-5.d.ts +10 -0
  134. package/dist/operations/modeling/predicate-catalog-5.d.ts.map +1 -0
  135. package/dist/operations/modeling/predicate-catalog-5.js +291 -0
  136. package/dist/operations/modeling/predicate-catalog.d.ts.map +1 -1
  137. package/dist/operations/modeling/predicate-catalog.js +4 -0
  138. package/dist/operations/modeling/predicate-loader.d.ts +1 -0
  139. package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
  140. package/dist/operations/modeling/predicate-loader.js +4 -3
  141. package/dist/operations/modeling/predicate-ranker.d.ts.map +1 -1
  142. package/dist/operations/modeling/predicate-ranker.js +4 -1
  143. package/dist/operations/modeling/predicate-types.d.ts +1 -1
  144. package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
  145. package/dist/operations/modeling/predicate-usage-hints-4.d.ts +3 -0
  146. package/dist/operations/modeling/predicate-usage-hints-4.d.ts.map +1 -0
  147. package/dist/operations/modeling/predicate-usage-hints-4.js +84 -0
  148. package/dist/operations/modeling/suggest-predicates.d.ts +4 -2
  149. package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
  150. package/dist/operations/modeling/suggest-predicates.js +82 -22
  151. package/dist/operations/mutation/contradictions.d.ts +2 -1
  152. package/dist/operations/mutation/contradictions.d.ts.map +1 -1
  153. package/dist/operations/mutation/contradictions.js +26 -5
  154. package/dist/operations/mutation/delete.d.ts +3 -0
  155. package/dist/operations/mutation/delete.d.ts.map +1 -1
  156. package/dist/operations/mutation/delete.js +100 -32
  157. package/dist/operations/mutation/relationships.d.ts +1 -0
  158. package/dist/operations/mutation/relationships.d.ts.map +1 -1
  159. package/dist/operations/mutation/relationships.js +6 -4
  160. package/dist/operations/mutation/saga.d.ts +51 -0
  161. package/dist/operations/mutation/saga.d.ts.map +1 -0
  162. package/dist/operations/mutation/saga.js +67 -0
  163. package/dist/operations/mutation/serialization.d.ts.map +1 -1
  164. package/dist/operations/mutation/serialization.js +3 -2
  165. package/dist/operations/mutation/source-authoring.d.ts +5 -1
  166. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  167. package/dist/operations/mutation/source-authoring.js +79 -46
  168. package/dist/operations/mutation/strict-fact.d.ts +1 -0
  169. package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
  170. package/dist/operations/mutation/strict-fact.js +8 -5
  171. package/dist/operations/mutation/symbol-compiler-lock.d.ts +5 -2
  172. package/dist/operations/mutation/symbol-compiler-lock.d.ts.map +1 -1
  173. package/dist/operations/mutation/symbol-compiler-lock.js +65 -2
  174. package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
  175. package/dist/operations/mutation/symbol-granularity.js +11 -89
  176. package/dist/operations/mutation/symbol-refresh.d.ts +1 -0
  177. package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -1
  178. package/dist/operations/mutation/symbol-refresh.js +10 -8
  179. package/dist/operations/mutation/upsert.d.ts +18 -2
  180. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  181. package/dist/operations/mutation/upsert.js +86 -54
  182. package/dist/operations/mutation/validate-upsert.js +2 -2
  183. package/dist/operations/mutation/validation.d.ts.map +1 -1
  184. package/dist/operations/mutation/validation.js +46 -4
  185. package/dist/operations/mutation/warnings.d.ts +1 -0
  186. package/dist/operations/mutation/warnings.d.ts.map +1 -1
  187. package/dist/operations/mutation/warnings.js +7 -5
  188. package/dist/operations/mutation/workspace-mutation-lock.d.ts +60 -0
  189. package/dist/operations/mutation/workspace-mutation-lock.d.ts.map +1 -0
  190. package/dist/operations/mutation/workspace-mutation-lock.js +362 -0
  191. package/dist/operations/planning/apply-plan.d.ts +8 -106
  192. package/dist/operations/planning/apply-plan.d.ts.map +1 -1
  193. package/dist/operations/planning/apply-plan.js +113 -36
  194. package/dist/operations/planning/compile-intent.d.ts +51 -0
  195. package/dist/operations/planning/compile-intent.d.ts.map +1 -1
  196. package/dist/operations/planning/compile-intent.js +133 -17
  197. package/dist/operations/proof/baseline-diff.d.ts +41 -0
  198. package/dist/operations/proof/baseline-diff.d.ts.map +1 -0
  199. package/dist/operations/proof/baseline-diff.js +153 -0
  200. package/dist/operations/proof/explain.d.ts +75 -0
  201. package/dist/operations/proof/explain.d.ts.map +1 -0
  202. package/dist/operations/proof/explain.js +294 -0
  203. package/dist/operations/proof/impact.d.ts +45 -0
  204. package/dist/operations/proof/impact.d.ts.map +1 -0
  205. package/dist/operations/proof/impact.js +118 -0
  206. package/dist/operations/proof/ingest-proof.d.ts +34 -0
  207. package/dist/operations/proof/ingest-proof.d.ts.map +1 -0
  208. package/dist/operations/proof/ingest-proof.js +348 -0
  209. package/dist/operations/proof/migrate-legacy-receipts.d.ts +30 -0
  210. package/dist/operations/proof/migrate-legacy-receipts.d.ts.map +1 -0
  211. package/dist/operations/proof/migrate-legacy-receipts.js +92 -0
  212. package/dist/operations/proof/prune-receipts.d.ts +35 -0
  213. package/dist/operations/proof/prune-receipts.d.ts.map +1 -0
  214. package/dist/operations/proof/prune-receipts.js +91 -0
  215. package/dist/operations/proof/receipt-document.d.ts +29 -0
  216. package/dist/operations/proof/receipt-document.d.ts.map +1 -0
  217. package/dist/operations/proof/receipt-document.js +117 -0
  218. package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
  219. package/dist/operations/semantic-advisor/analysis-receipt.js +3 -9
  220. package/dist/operations/semantic-advisor/analyze-prose.d.ts +1 -0
  221. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  222. package/dist/operations/semantic-advisor/analyze-prose.js +64 -93
  223. package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
  224. package/dist/operations/semantic-advisor/clauses.js +20 -7
  225. package/dist/operations/semantic-advisor/plugin-orchestration.d.ts +63 -0
  226. package/dist/operations/semantic-advisor/plugin-orchestration.d.ts.map +1 -0
  227. package/dist/operations/semantic-advisor/plugin-orchestration.js +489 -0
  228. package/dist/operations/semantic-advisor/predicate-rules-core.d.ts +15 -2
  229. package/dist/operations/semantic-advisor/predicate-rules-core.d.ts.map +1 -1
  230. package/dist/operations/semantic-advisor/predicate-rules-core.js +7 -140
  231. package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts +11 -12
  232. package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts.map +1 -1
  233. package/dist/operations/semantic-advisor/predicate-rules-launcher.js +6 -94
  234. package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts +16 -0
  235. package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts.map +1 -1
  236. package/dist/operations/semantic-advisor/predicate-rules-policy.js +7 -150
  237. package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts +9 -0
  238. package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts.map +1 -1
  239. package/dist/operations/semantic-advisor/predicate-rules-product-tail.js +7 -102
  240. package/dist/operations/semantic-advisor/predicate-rules-product.d.ts +13 -0
  241. package/dist/operations/semantic-advisor/predicate-rules-product.d.ts.map +1 -1
  242. package/dist/operations/semantic-advisor/predicate-rules-product.js +7 -133
  243. package/dist/operations/semantic-advisor/strict-count-rules.d.ts +2 -0
  244. package/dist/operations/semantic-advisor/strict-count-rules.d.ts.map +1 -1
  245. package/dist/operations/semantic-advisor/strict-count-rules.js +40 -25
  246. package/dist/operations/semantic-advisor/types.d.ts +1 -0
  247. package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
  248. package/dist/plugins/compose-ontology-packs.d.ts +51 -0
  249. package/dist/plugins/compose-ontology-packs.d.ts.map +1 -0
  250. package/dist/plugins/compose-ontology-packs.js +257 -0
  251. package/dist/plugins/compose-semantic-classifier.d.ts +42 -0
  252. package/dist/plugins/compose-semantic-classifier.d.ts.map +1 -0
  253. package/dist/plugins/compose-semantic-classifier.js +211 -0
  254. package/dist/plugins/external-allowlist.d.ts +10 -0
  255. package/dist/plugins/external-allowlist.d.ts.map +1 -0
  256. package/dist/plugins/external-allowlist.js +16 -0
  257. package/dist/plugins/index.d.ts +9 -0
  258. package/dist/plugins/index.d.ts.map +1 -0
  259. package/dist/plugins/index.js +33 -0
  260. package/dist/plugins/load-plugin.d.ts +19 -0
  261. package/dist/plugins/load-plugin.d.ts.map +1 -0
  262. package/dist/plugins/load-plugin.js +59 -0
  263. package/dist/plugins/project-config.d.ts +28 -0
  264. package/dist/plugins/project-config.d.ts.map +1 -0
  265. package/dist/plugins/project-config.js +90 -0
  266. package/dist/plugins/registry.d.ts +93 -0
  267. package/dist/plugins/registry.d.ts.map +1 -0
  268. package/dist/plugins/registry.js +338 -0
  269. package/dist/plugins/resolve-package.d.ts +47 -0
  270. package/dist/plugins/resolve-package.d.ts.map +1 -0
  271. package/dist/plugins/resolve-package.js +262 -0
  272. package/dist/plugins/source-analysis-service.d.ts +44 -0
  273. package/dist/plugins/source-analysis-service.d.ts.map +1 -0
  274. package/dist/plugins/source-analysis-service.js +232 -0
  275. package/dist/prolog/codec.d.ts +13 -1
  276. package/dist/prolog/codec.d.ts.map +1 -1
  277. package/dist/prolog/codec.js +269 -154
  278. package/dist/prolog/error-terms.d.ts +47 -0
  279. package/dist/prolog/error-terms.d.ts.map +1 -0
  280. package/dist/prolog/error-terms.js +334 -0
  281. package/dist/prolog/janitor.d.ts +50 -0
  282. package/dist/prolog/janitor.d.ts.map +1 -0
  283. package/dist/prolog/janitor.js +154 -0
  284. package/dist/prolog/store-lock.d.ts +45 -0
  285. package/dist/prolog/store-lock.d.ts.map +1 -0
  286. package/dist/prolog/store-lock.js +195 -0
  287. package/dist/prolog.d.ts +7 -0
  288. package/dist/prolog.d.ts.map +1 -1
  289. package/dist/prolog.js +55 -17
  290. package/dist/proof/evaluate.d.ts +27 -0
  291. package/dist/proof/evaluate.d.ts.map +1 -0
  292. package/dist/proof/evaluate.js +151 -0
  293. package/dist/proof/inspect.d.ts +12 -0
  294. package/dist/proof/inspect.d.ts.map +1 -0
  295. package/dist/proof/inspect.js +236 -0
  296. package/dist/proof/integrations.d.ts +35 -0
  297. package/dist/proof/integrations.d.ts.map +1 -0
  298. package/dist/proof/integrations.js +123 -0
  299. package/dist/proof/producers/junit-adapter.d.ts +26 -0
  300. package/dist/proof/producers/junit-adapter.d.ts.map +1 -0
  301. package/dist/proof/producers/junit-adapter.js +186 -0
  302. package/dist/{public → proof/producers}/playwright-case-id.d.ts +1 -1
  303. package/dist/proof/producers/playwright-case-id.d.ts.map +1 -0
  304. package/dist/{public → proof/producers}/playwright-case-id.js +1 -1
  305. package/dist/proof/producers/playwright-reporter.d.ts +27 -0
  306. package/dist/proof/producers/playwright-reporter.d.ts.map +1 -0
  307. package/dist/proof/producers/playwright-reporter.js +138 -0
  308. package/dist/proof/producers/tap-adapter.d.ts +10 -0
  309. package/dist/proof/producers/tap-adapter.d.ts.map +1 -0
  310. package/dist/proof/producers/tap-adapter.js +200 -0
  311. package/dist/proof/receipt-outcome.d.ts +2 -0
  312. package/dist/proof/receipt-outcome.d.ts.map +1 -0
  313. package/dist/proof/receipt-outcome.js +1 -0
  314. package/dist/public/diagnostic-usage.js +6 -6
  315. package/dist/public/distribution-parity.d.ts +7 -1
  316. package/dist/public/distribution-parity.d.ts.map +1 -1
  317. package/dist/public/distribution-parity.js +15 -10
  318. package/dist/public/extractors/symbols-coordinator.d.ts +1 -1
  319. package/dist/public/extractors/symbols-coordinator.d.ts.map +1 -1
  320. package/dist/public/extractors/symbols-coordinator.js +1 -1
  321. package/dist/public/impact/analyzer.d.ts +1 -1
  322. package/dist/public/impact/analyzer.d.ts.map +1 -1
  323. package/dist/public/impact/analyzer.js +6 -4
  324. package/dist/public/impact/coverage-depth-quality.d.ts +1 -0
  325. package/dist/public/impact/coverage-depth-quality.d.ts.map +1 -1
  326. package/dist/public/impact/coverage-depth-quality.js +1 -1
  327. package/dist/public/impact/diagnostics.d.ts.map +1 -1
  328. package/dist/public/impact/diagnostics.js +2 -2
  329. package/dist/public/impact/diff-meaning.d.ts +1 -0
  330. package/dist/public/impact/diff-meaning.d.ts.map +1 -1
  331. package/dist/public/impact/diff-meaning.js +5 -2
  332. package/dist/public/impact/full-kb-quality.d.ts +5 -2
  333. package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
  334. package/dist/public/impact/full-kb-quality.js +329 -64
  335. package/dist/public/operations/catalog.d.ts +450 -196
  336. package/dist/public/operations/catalog.d.ts.map +1 -1
  337. package/dist/public/operations/catalog.js +6 -4
  338. package/dist/public/operations/check-executor.d.ts.map +1 -1
  339. package/dist/public/operations/check-executor.js +4 -8
  340. package/dist/public/operations/check-helpers.d.ts +1 -1
  341. package/dist/public/operations/check-helpers.d.ts.map +1 -1
  342. package/dist/public/operations/check-helpers.js +1 -1
  343. package/dist/public/operations/contracts.d.ts +7 -0
  344. package/dist/public/operations/contracts.d.ts.map +1 -1
  345. package/dist/public/operations/contracts.js +66 -34
  346. package/dist/public/operations/discovery-entities.d.ts +15 -0
  347. package/dist/public/operations/discovery-entities.d.ts.map +1 -1
  348. package/dist/public/operations/discovery-entities.js +38 -0
  349. package/dist/public/operations/discovery-executors.d.ts +9 -9
  350. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  351. package/dist/public/operations/discovery-executors.js +39 -31
  352. package/dist/public/operations/index.d.ts +1 -1
  353. package/dist/public/operations/index.d.ts.map +1 -1
  354. package/dist/public/operations/index.js +1 -1
  355. package/dist/public/operations/migration-plan.d.ts +4 -3
  356. package/dist/public/operations/migration-plan.d.ts.map +1 -1
  357. package/dist/public/operations/migration-plan.js +23 -21
  358. package/dist/public/operations/node-ports.js +6 -6
  359. package/dist/public/operations/prolog-json.d.ts +1 -1
  360. package/dist/public/operations/prolog-json.d.ts.map +1 -1
  361. package/dist/public/operations/prolog-json.js +7 -7
  362. package/dist/public/operations/repair-plan.d.ts +3 -3
  363. package/dist/public/operations/repair-plan.d.ts.map +1 -1
  364. package/dist/public/operations/repair-plan.js +49 -19
  365. package/dist/public/operations/result-envelope.d.ts +1 -0
  366. package/dist/public/operations/result-envelope.d.ts.map +1 -1
  367. package/dist/public/operations/result-envelope.js +12 -10
  368. package/dist/public/operations/runtime-types.d.ts +21 -1
  369. package/dist/public/operations/runtime-types.d.ts.map +1 -1
  370. package/dist/public/operations/specs/check-rules.generated.d.ts +5 -0
  371. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -0
  372. package/dist/public/operations/specs/check-rules.generated.js +35 -0
  373. package/dist/public/operations/specs/check.d.ts +7 -2
  374. package/dist/public/operations/specs/check.d.ts.map +1 -1
  375. package/dist/public/operations/specs/check.js +8 -20
  376. package/dist/public/operations/specs/discovery.d.ts +3 -0
  377. package/dist/public/operations/specs/discovery.d.ts.map +1 -1
  378. package/dist/public/operations/specs/discovery.js +3 -0
  379. package/dist/public/operations/specs/mutation-schemas.d.ts +257 -163
  380. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  381. package/dist/public/operations/specs/mutation-schemas.js +15 -7
  382. package/dist/public/operations/specs/planning.d.ts +9 -0
  383. package/dist/public/operations/specs/planning.d.ts.map +1 -1
  384. package/dist/public/operations/specs/planning.js +6 -0
  385. package/dist/public/operations/specs/proof.d.ts +212 -0
  386. package/dist/public/operations/specs/proof.d.ts.map +1 -0
  387. package/dist/public/operations/specs/proof.js +30 -0
  388. package/dist/public/operations/specs/reporting.d.ts +20 -0
  389. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  390. package/dist/public/operations/specs/reporting.js +112 -12
  391. package/dist/public/operations/specs/semantic.d.ts +1 -1
  392. package/dist/public/operations/specs/semantic.d.ts.map +1 -1
  393. package/dist/public/operations/specs/semantic.js +54 -4
  394. package/dist/public/operations/specs/upsert.d.ts +257 -163
  395. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  396. package/dist/public/operations/symbol-repair-plan.d.ts +11 -0
  397. package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -1
  398. package/dist/public/operations/symbol-repair-plan.js +121 -4
  399. package/dist/public/operations/types.d.ts +6 -1
  400. package/dist/public/operations/types.d.ts.map +1 -1
  401. package/dist/public/proof-fingerprint.d.ts +54 -0
  402. package/dist/public/proof-fingerprint.d.ts.map +1 -0
  403. package/dist/public/proof-fingerprint.js +141 -0
  404. package/dist/public/proof-protocol.d.ts +354 -0
  405. package/dist/public/proof-protocol.d.ts.map +1 -0
  406. package/dist/public/proof-protocol.js +454 -0
  407. package/dist/public/proof-receipt.d.ts +279 -0
  408. package/dist/public/proof-receipt.d.ts.map +1 -0
  409. package/dist/public/proof-receipt.js +377 -0
  410. package/dist/public/schemas/entity.d.ts.map +1 -1
  411. package/dist/public/schemas/entity.js +21 -7
  412. package/dist/public/skills/kibi-freshness/SKILL.md +1 -1
  413. package/dist/public/skills/kibi-usage/SKILL.md +44 -12
  414. package/dist/public/skills/kibi-usage/resources/operation-access.md +1 -1
  415. package/dist/public/skills/kibi-usage/resources/proof.md +150 -0
  416. package/dist/public/skills/kibi-usage/resources/workflows.md +6 -6
  417. package/dist/public/symbol-granularity.d.ts +3 -14
  418. package/dist/public/symbol-granularity.d.ts.map +1 -1
  419. package/dist/public/symbol-granularity.generated.d.ts +16 -0
  420. package/dist/public/symbol-granularity.generated.d.ts.map +1 -0
  421. package/dist/public/symbol-granularity.generated.js +53 -0
  422. package/dist/public/symbol-granularity.js +6 -47
  423. package/dist/public/telemetry-acceptance.d.ts +3 -77
  424. package/dist/public/telemetry-acceptance.d.ts.map +1 -1
  425. package/dist/public/telemetry-acceptance.js +4 -2
  426. package/dist/public/telemetry-remediation.js +1 -1
  427. package/dist/report/html-report.css +1240 -0
  428. package/dist/report/html-report.d.ts +4 -2
  429. package/dist/report/html-report.d.ts.map +1 -1
  430. package/dist/report/html-report.js +37 -300
  431. package/dist/runtime/cli-runtime.d.ts +2 -0
  432. package/dist/runtime/cli-runtime.d.ts.map +1 -1
  433. package/dist/runtime/cli-runtime.js +32 -7
  434. package/dist/schemas/entity.schema.json +355 -215
  435. package/dist/search-ranking.d.ts +1 -0
  436. package/dist/search-ranking.d.ts.map +1 -1
  437. package/dist/search-ranking.js +3 -0
  438. package/dist/traceability/evidence-model.d.ts +28 -0
  439. package/dist/traceability/evidence-model.d.ts.map +1 -1
  440. package/dist/traceability/git-staged.d.ts +20 -0
  441. package/dist/traceability/git-staged.d.ts.map +1 -1
  442. package/dist/traceability/git-staged.js +145 -1
  443. package/dist/traceability/staged-diagnostics.d.ts +7 -0
  444. package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
  445. package/dist/traceability/staged-diagnostics.js +78 -7
  446. package/dist/traceability/staged-file-coverage.d.ts +33 -0
  447. package/dist/traceability/staged-file-coverage.d.ts.map +1 -0
  448. package/dist/traceability/staged-file-coverage.js +284 -0
  449. package/dist/traceability/staged-impact-contract.js +4 -4
  450. package/dist/traceability/staged-symbols-manifest.d.ts +13 -0
  451. package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
  452. package/dist/traceability/staged-symbols-manifest.js +138 -27
  453. package/dist/traceability/symbol-extract.d.ts +24 -2
  454. package/dist/traceability/symbol-extract.d.ts.map +1 -1
  455. package/dist/traceability/symbol-extract.js +64 -208
  456. package/dist/traceability/temp-kb.d.ts +2 -0
  457. package/dist/traceability/temp-kb.d.ts.map +1 -1
  458. package/dist/traceability/temp-kb.js +13 -4
  459. package/dist/types/entities.d.ts +5 -3
  460. package/dist/types/entities.d.ts.map +1 -1
  461. package/dist/utils/branch-resolver.d.ts +1 -0
  462. package/dist/utils/branch-resolver.d.ts.map +1 -1
  463. package/dist/utils/branch-resolver.js +7 -4
  464. package/dist/utils/branch-store.d.ts +6 -0
  465. package/dist/utils/branch-store.d.ts.map +1 -1
  466. package/dist/utils/branch-store.js +27 -0
  467. package/dist/utils/kb-paths.d.ts +1 -1
  468. package/dist/utils/kb-paths.d.ts.map +1 -1
  469. package/dist/utils/kb-paths.js +1 -1
  470. package/dist/utils/rule-registry.d.ts +1 -11
  471. package/dist/utils/rule-registry.d.ts.map +1 -1
  472. package/dist/utils/rule-registry.generated.d.ts +102 -0
  473. package/dist/utils/rule-registry.generated.d.ts.map +1 -0
  474. package/dist/utils/rule-registry.generated.js +131 -0
  475. package/dist/utils/rule-registry.js +12 -113
  476. package/dist/utils/strict-modeling.d.ts +1 -0
  477. package/dist/utils/strict-modeling.d.ts.map +1 -1
  478. package/dist/utils/strict-modeling.js +1 -1
  479. package/package.json +20 -20
  480. package/src/public/diagnostic-usage.ts +6 -6
  481. package/src/public/distribution-parity.ts +17 -10
  482. package/src/public/extractors/symbols-coordinator.ts +1 -0
  483. package/src/public/impact/analyzer.ts +15 -12
  484. package/src/public/impact/coverage-depth-quality.ts +1 -1
  485. package/src/public/impact/diagnostics.ts +2 -1
  486. package/src/public/impact/diff-meaning.ts +11 -4
  487. package/src/public/impact/full-kb-quality.ts +463 -72
  488. package/src/public/operations/catalog.ts +10 -4
  489. package/src/public/operations/check-executor.ts +4 -8
  490. package/src/public/operations/check-helpers.ts +2 -2
  491. package/src/public/operations/contracts.ts +78 -34
  492. package/src/public/operations/discovery-entities.ts +53 -0
  493. package/src/public/operations/discovery-executors.ts +64 -48
  494. package/src/public/operations/index.ts +1 -1
  495. package/src/public/operations/migration-plan.ts +32 -25
  496. package/src/public/operations/node-ports.ts +6 -6
  497. package/src/public/operations/prolog-json.ts +13 -5
  498. package/src/public/operations/repair-plan.ts +60 -23
  499. package/src/public/operations/result-envelope.ts +15 -10
  500. package/src/public/operations/runtime-types.ts +26 -2
  501. package/src/public/operations/specs/check-rules.generated.ts +38 -0
  502. package/src/public/operations/specs/check.ts +12 -21
  503. package/src/public/operations/specs/discovery.ts +3 -0
  504. package/src/public/operations/specs/mutation-schemas.ts +22 -9
  505. package/src/public/operations/specs/planning.ts +7 -0
  506. package/src/public/operations/specs/proof.ts +43 -0
  507. package/src/public/operations/specs/reporting.ts +140 -13
  508. package/src/public/operations/specs/semantic.ts +79 -17
  509. package/src/public/operations/symbol-repair-plan.ts +166 -7
  510. package/src/public/operations/types.ts +6 -1
  511. package/src/public/proof-fingerprint.ts +216 -0
  512. package/src/public/proof-protocol-types.d.ts +96 -0
  513. package/src/public/proof-protocol.ts +589 -0
  514. package/src/public/proof-receipt.ts +499 -0
  515. package/src/public/schemas/entity.ts +26 -10
  516. package/src/public/skills/kibi-freshness/SKILL.md +1 -1
  517. package/src/public/skills/kibi-usage/SKILL.md +44 -12
  518. package/src/public/skills/kibi-usage/resources/operation-access.md +1 -1
  519. package/src/public/skills/kibi-usage/resources/proof.md +150 -0
  520. package/src/public/skills/kibi-usage/resources/workflows.md +6 -6
  521. package/src/public/symbol-granularity.generated.ts +74 -0
  522. package/src/public/symbol-granularity.ts +34 -59
  523. package/src/public/telemetry-acceptance-types.d.ts +98 -0
  524. package/src/public/telemetry-acceptance.ts +22 -100
  525. package/src/public/telemetry-remediation.ts +1 -1
  526. package/src/schemas/entity.schema.json +355 -215
  527. package/dist/cli-register-verification.d.ts +0 -3
  528. package/dist/cli-register-verification.d.ts.map +0 -1
  529. package/dist/cli-register-verification.js +0 -16
  530. package/dist/commands/verify.d.ts +0 -10
  531. package/dist/commands/verify.d.ts.map +0 -1
  532. package/dist/commands/verify.js +0 -126
  533. package/dist/operations/verification/ingest-verification.d.ts +0 -29
  534. package/dist/operations/verification/ingest-verification.d.ts.map +0 -1
  535. package/dist/operations/verification/ingest-verification.js +0 -192
  536. package/dist/public/operations/specs/verification.d.ts +0 -78
  537. package/dist/public/operations/specs/verification.d.ts.map +0 -1
  538. package/dist/public/operations/specs/verification.js +0 -62
  539. package/dist/public/playwright-case-id.d.ts.map +0 -1
  540. package/dist/public/verification-receipt.d.ts +0 -242
  541. package/dist/public/verification-receipt.d.ts.map +0 -1
  542. package/dist/public/verification-receipt.js +0 -296
  543. package/dist/verification/playwright-reporter.d.ts +0 -21
  544. package/dist/verification/playwright-reporter.d.ts.map +0 -1
  545. package/dist/verification/playwright-reporter.js +0 -114
  546. package/src/public/operations/specs/verification.ts +0 -78
  547. package/src/public/playwright-case-id.ts +0 -35
  548. package/src/public/verification-receipt.ts +0 -412
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prune-receipts.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/prune-receipts.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AASjF,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,uDAAuD;IAEvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC,CAAC;AAGH,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAE7C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IAEzC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,uBAAuB,EAAE,CAAC;CAC3C,CAAC,CAAC;AAYH;;;;;;;;;GASG;AAEH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC;IACT,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,iBAAiB,EAAE,mBAAmB,CAAC;CACxC,CAAC,CAoED"}
@@ -0,0 +1,91 @@
1
+ /*
2
+ Kibi — repo-local, per-branch, queryable long-term memory for software projects
3
+ Copyright (C) 2026 Piotr Franczyk
4
+
5
+ This program is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU Affero General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU Affero General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Affero General Public License
16
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+ */
18
+ import { loadEntities } from "../../public/operations/discovery-entities.js";
19
+ import { proofReceiptHistoryErrors, } from "../../public/proof-receipt.js";
20
+ import { projectEntityProperties } from "../mutation/entity-projection.js";
21
+ import { executeUpsert } from "../mutation/upsert.js";
22
+ function parseKeep(value) {
23
+ if (value === undefined)
24
+ return 1;
25
+ if (!Number.isSafeInteger(value) || value < 1 || value > 50) {
26
+ throw new Error("Proof prune failed: keep must be an integer between 1 and 50");
27
+ }
28
+ return value;
29
+ }
30
+ /**
31
+ * Shrink each test's proof_receipts history to its newest entries.
32
+ *
33
+ * Re-proving the same snapshot appends duplicate passed receipts (one block
34
+ * per run), and consumers previously deduped them by hand. This is the one
35
+ * sanctioned history-shrinking mutation: pruned histories are still ordered,
36
+ * structurally valid evidence, and every shrink goes through the typed upsert
37
+ * with the prune carve-out (append-only validation is skipped for exactly
38
+ * this maintenance action).
39
+ */
40
+ // implements REQ-kibi-verification-evidence-contract
41
+ export async function executePruneReceipts(args, context) {
42
+ if (!context.prolog)
43
+ throw new Error("Proof prune requires a Prolog runtime");
44
+ if (context.fs === undefined)
45
+ throw new Error("Proof prune failed: this maintenance action rewrites authored test documents and requires a filesystem-capable runtime");
46
+ const keep = parseKeep(args.keep);
47
+ const tests = await loadEntities(context.prolog, {
48
+ type: "test",
49
+ ...(args.testId === undefined ? {} : { id: args.testId }),
50
+ });
51
+ if (args.testId !== undefined && tests.length === 0) {
52
+ throw new Error(`Proof prune failed: test ${args.testId} was not found`);
53
+ }
54
+ const results = [];
55
+ for (const test of tests) {
56
+ const testId = String(test.id);
57
+ const receipts = Array.isArray(test.proof_receipts)
58
+ ? test.proof_receipts.filter((value) => typeof value === "object" &&
59
+ value !== null &&
60
+ !Array.isArray(value))
61
+ : [];
62
+ if (receipts.length <= keep)
63
+ continue;
64
+ const nextReceipts = receipts.slice(-keep);
65
+ const historyErrors = proofReceiptHistoryErrors(testId, test.verification_scope, nextReceipts);
66
+ if (historyErrors.length > 0) {
67
+ throw new Error(`Proof prune failed for ${testId}: pruned history is invalid: ${historyErrors.join("; ")}`);
68
+ }
69
+ const properties = projectEntityProperties(test);
70
+ properties.proof_receipts = undefined;
71
+ await executeUpsert({
72
+ type: "test",
73
+ id: testId,
74
+ properties: { ...properties, proof_receipts: nextReceipts },
75
+ }, context, { allowReceiptsPrune: true });
76
+ results.push({
77
+ testId,
78
+ before: receipts.length,
79
+ after: nextReceipts.length,
80
+ pruned: receipts.length - nextReceipts.length,
81
+ });
82
+ }
83
+ const pruned = results.reduce((sum, row) => sum + row.pruned, 0);
84
+ const summary = results.length === 0
85
+ ? "No test had receipts beyond the keep window."
86
+ : `Pruned ${pruned} receipt(s) across ${results.length} test(s).`;
87
+ return {
88
+ content: [{ type: "text", text: `Proof receipts pruned. ${summary}` }],
89
+ structuredContent: { pruned, tests: results },
90
+ };
91
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Remove a top-level frontmatter block (`key:` plus its nested lines) from a
3
+ * markdown document, leaving every other byte untouched. Returns the patched
4
+ * content, or null when the content is not a well-formed frontmatter
5
+ * document the remover can safely splice.
6
+ *
7
+ * Used by proof maintenance to drop legacy `verification_receipts` blocks
8
+ * once a `proof_contract` exists, without canonicalizing the document.
9
+ */
10
+ export declare function removeFrontmatterBlock(content: string, key: string): string | null;
11
+ /**
12
+ * Patch the `proof_receipts` frontmatter block of an authored test document
13
+ * without re-rendering anything else.
14
+ *
15
+ * Receipt ingest used to route every append through the canonical entity
16
+ * renderer, which re-dumps the whole frontmatter: inline tag lists became
17
+ * block lists, timestamps gained milliseconds, and so on. Those non-receipt
18
+ * edits are not stripped by the workspace snapshotter, so the snapshot hash
19
+ * changed on the first ingest that touched a hand-authored document and every
20
+ * later integration in the same `kibi prove --all` run refused with
21
+ * "changed the tracked workspace". This patcher splices ONLY the receipts
22
+ * block, leaving the rest of the document byte-for-byte identical.
23
+ *
24
+ * Returns null when the content is not a well-formed frontmatter document the
25
+ * patcher can safely splice; the caller then falls back to the canonical
26
+ * render.
27
+ */
28
+ export declare function patchReceiptsIntoDocument(content: string, receipts: readonly Readonly<Record<string, unknown>>[]): string | null;
29
+ //# sourceMappingURL=receipt-document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receipt-document.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/receipt-document.ts"],"names":[],"mappings":"AAoBA;;;;;;;;GAQG;AAEH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,IAAI,CA4Bf;AAED;;;;;;;;;;;;;;;;GAgBG;AAEH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,GACrD,MAAM,GAAG,IAAI,CAyCf"}
@@ -0,0 +1,117 @@
1
+ /*
2
+ Kibi — repo-local, per-branch, queryable long-term memory for software projects
3
+ Copyright (C) 2026 Piotr Franczyk
4
+
5
+ This program is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU Affero General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU Affero General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Affero General Public License
16
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+ */
18
+ import { dump as dumpYaml } from "js-yaml";
19
+ /**
20
+ * Remove a top-level frontmatter block (`key:` plus its nested lines) from a
21
+ * markdown document, leaving every other byte untouched. Returns the patched
22
+ * content, or null when the content is not a well-formed frontmatter
23
+ * document the remover can safely splice.
24
+ *
25
+ * Used by proof maintenance to drop legacy `verification_receipts` blocks
26
+ * once a `proof_contract` exists, without canonicalizing the document.
27
+ */
28
+ // implements REQ-kibi-verification-evidence-contract
29
+ export function removeFrontmatterBlock(content, key) {
30
+ const lines = content.match(/[^\n]*\n|[^\n]+$/g) ?? [];
31
+ if (lines.length === 0 || lines[0]?.trim() !== "---")
32
+ return null;
33
+ let closingIndex = -1;
34
+ for (let index = 1; index < lines.length; index++) {
35
+ if (lines[index]?.trim() === "---") {
36
+ closingIndex = index;
37
+ break;
38
+ }
39
+ }
40
+ if (closingIndex === -1)
41
+ return null;
42
+ let blockStart = -1;
43
+ let blockEnd = closingIndex;
44
+ for (let index = 1; index < closingIndex; index++) {
45
+ if (new RegExp(`^${key}\\s*:`).test(lines[index] ?? "")) {
46
+ blockStart = index;
47
+ break;
48
+ }
49
+ }
50
+ if (blockStart === -1)
51
+ return null;
52
+ for (let index = blockStart + 1; index < closingIndex; index++) {
53
+ const line = lines[index] ?? "";
54
+ if (/^[A-Za-z_][A-Za-z0-9_-]*\s*:/.test(line)) {
55
+ blockEnd = index;
56
+ break;
57
+ }
58
+ }
59
+ return [...lines.slice(0, blockStart), ...lines.slice(blockEnd)].join("");
60
+ }
61
+ /**
62
+ * Patch the `proof_receipts` frontmatter block of an authored test document
63
+ * without re-rendering anything else.
64
+ *
65
+ * Receipt ingest used to route every append through the canonical entity
66
+ * renderer, which re-dumps the whole frontmatter: inline tag lists became
67
+ * block lists, timestamps gained milliseconds, and so on. Those non-receipt
68
+ * edits are not stripped by the workspace snapshotter, so the snapshot hash
69
+ * changed on the first ingest that touched a hand-authored document and every
70
+ * later integration in the same `kibi prove --all` run refused with
71
+ * "changed the tracked workspace". This patcher splices ONLY the receipts
72
+ * block, leaving the rest of the document byte-for-byte identical.
73
+ *
74
+ * Returns null when the content is not a well-formed frontmatter document the
75
+ * patcher can safely splice; the caller then falls back to the canonical
76
+ * render.
77
+ */
78
+ // implements REQ-kibi-verification-evidence-contract
79
+ export function patchReceiptsIntoDocument(content, receipts) {
80
+ const lines = content.match(/[^\n]*\n|[^\n]+$/g) ?? [];
81
+ if (lines.length === 0 || lines[0]?.trim() !== "---")
82
+ return null;
83
+ let closingIndex = -1;
84
+ for (let index = 1; index < lines.length; index++) {
85
+ if (lines[index]?.trim() === "---") {
86
+ closingIndex = index;
87
+ break;
88
+ }
89
+ }
90
+ if (closingIndex === -1)
91
+ return null;
92
+ let receiptsStart = -1;
93
+ let receiptsEnd = closingIndex;
94
+ for (let index = 1; index < closingIndex; index++) {
95
+ if (/^proof_receipts\s*:/.test(lines[index] ?? "")) {
96
+ receiptsStart = index;
97
+ break;
98
+ }
99
+ }
100
+ if (receiptsStart !== -1) {
101
+ for (let index = receiptsStart + 1; index < closingIndex; index++) {
102
+ const line = lines[index] ?? "";
103
+ if (/^[A-Za-z_][A-Za-z0-9_-]*\s*:/.test(line)) {
104
+ receiptsEnd = index;
105
+ break;
106
+ }
107
+ }
108
+ }
109
+ const block = dumpYaml({ proof_receipts: receipts.map((receipt) => ({ ...receipt })) }, { noRefs: true, lineWidth: -1, sortKeys: false });
110
+ const blockLines = block.match(/[^\n]*\n|[^\n]+$/g) ?? [];
111
+ const spliced = [
112
+ ...lines.slice(0, receiptsStart === -1 ? closingIndex : receiptsStart),
113
+ ...blockLines,
114
+ ...lines.slice(receiptsEnd),
115
+ ];
116
+ return spliced.join("");
117
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"analysis-receipt.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/analysis-receipt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,KAAK,OAAO,EAMb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,6BAA6B,EAI7B,4BAA4B,EAC5B,0BAA0B,EAC1B,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAC;AA0CpB,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,SAAS,0BAA0B,EAAE,EAClD,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,YAAY,EAAE,SAAS,mBAAmB,EAAE,EAC5C,eAAe,EAAE,SAAS,4BAA4B,EAAE,EACxD,cAAc,EAAE,SAAS,iBAAiB,EAAE,GAC3C,6BAA6B,CAkH/B"}
1
+ {"version":3,"file":"analysis-receipt.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/analysis-receipt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,KAAK,OAAO,EAMb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,6BAA6B,EAI7B,4BAA4B,EAC5B,0BAA0B,EAC1B,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAC;AAyBpB,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,SAAS,0BAA0B,EAAE,EAClD,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,YAAY,EAAE,SAAS,mBAAmB,EAAE,EAC5C,eAAe,EAAE,SAAS,4BAA4B,EAAE,EACxD,cAAc,EAAE,SAAS,iBAAiB,EAAE,GAC3C,6BAA6B,CAkH/B"}
@@ -1,14 +1,8 @@
1
+ import { chooseLane as chooseBuiltinLane } from "kibi-plugin-builtin";
1
2
  import { SEMANTIC_INVENTORY_VERSION, payloadHash, propertiesOf, semanticSourceHash, semanticSourceOf, } from "./shared.js";
3
+ /** Builtin classifier is the single source of signal→lane selection. */
2
4
  function chooseLane(signals) {
3
- if (signals.some(({ kind }) => kind === "numeric_cardinality" || kind === "numeric_threshold"))
4
- return "strict_property";
5
- if (signals.some(({ kind }) => kind === "conditional" ||
6
- kind === "permission" ||
7
- kind === "state_or_default"))
8
- return "predicate";
9
- return signals.some(({ kind }) => kind === "normative_modal")
10
- ? "observation_review"
11
- : "none";
5
+ return chooseBuiltinLane(signals);
12
6
  }
13
7
  function summary(readiness, lane) {
14
8
  if (readiness === "modeled")
@@ -1,5 +1,6 @@
1
1
  import type { SemanticAdvisorAnalysisResult, SemanticAdvisorInput } from "./types.js";
2
2
  export declare const SEMANTIC_ADVISOR_VERSION = "semantic-advisor-v2";
3
3
  export { semanticClaimKey } from "./clauses.js";
4
+ export declare function stringLogicClaims(value: unknown): string[];
4
5
  export declare function analyzeSemanticAdvisorInput(input: SemanticAdvisorInput): SemanticAdvisorAnalysisResult;
5
6
  //# sourceMappingURL=analyze-prose.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"analyze-prose.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/analyze-prose.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EACV,6BAA6B,EAC7B,oBAAoB,EAWrB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AA81BhD,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,oBAAoB,GAC1B,6BAA6B,CA+D/B"}
1
+ {"version":3,"file":"analyze-prose.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/analyze-prose.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EACV,6BAA6B,EAC7B,oBAAoB,EAWrB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAI1D;AAg0BD,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,oBAAoB,GAC1B,6BAA6B,CA+D/B"}
@@ -1,58 +1,18 @@
1
+ import { createBuiltinOntologyPack, detectSignals as detectBuiltinSignals, } from "kibi-plugin-builtin";
1
2
  import { utf8Span, validateLogicIr, } from "../../logic/ir.js";
2
3
  import { logicRuleFactId } from "../modeling/logic-modeling.js";
3
4
  import { buildAdvisorResult } from "./analysis-receipt.js";
4
5
  import { extractSemanticClauses, semanticClaimKey, } from "./clauses.js";
5
6
  import { observationPlan } from "./observation-plan.js";
6
- import { detectPredicateRules } from "./predicate-rule.js";
7
- import { CORE_PREDICATE_RULES } from "./predicate-rules-core.js";
8
- import { LAUNCHER_PREDICATE_RULES } from "./predicate-rules-launcher.js";
9
- import { POLICY_PREDICATE_RULES } from "./predicate-rules-policy.js";
10
- import { PRODUCT_TAIL_PREDICATE_RULES } from "./predicate-rules-product-tail.js";
11
- import { PRODUCT_PREDICATE_RULES } from "./predicate-rules-product.js";
12
- import { isRecord, payloadHash, propertiesOf, relationship, semanticClausesOf, semanticSourceHash, semanticSourceOf, sourceOf, statementOf, stringValue, } from "./shared.js";
7
+ import { predicateSuggestion as buildPredicateSuggestion, isRecord, payloadHash, propertiesOf, relationship, semanticClausesOf, semanticSourceHash, semanticSourceOf, sourceOf, statementOf, stringValue, } from "./shared.js";
13
8
  import { detectStrictSuggestion } from "./strict-rules.js";
14
9
  export const SEMANTIC_ADVISOR_VERSION = "semantic-advisor-v2";
15
10
  export { semanticClaimKey } from "./clauses.js";
16
- const SIGNAL_PATTERNS = [
17
- {
18
- kind: "numeric_cardinality",
19
- candidateLane: "strict_property",
20
- confidence: 0.92,
21
- pattern: /\b(?:(?:at\s+most|at\s+least|exactly|no\s+more\s+than|up\s+to|cap(?:ped)?\s+at)\s+)?(?:\d+|zero|one|two|three|four|five|six|seven|eight|nine|ten)\b/i,
22
- },
23
- {
24
- kind: "numeric_threshold",
25
- candidateLane: "strict_property",
26
- confidence: 0.86,
27
- pattern: /\b(?:maximum|minimum|under|within|below|above|expires?|retained\s+for)\s+(?:\d+|zero|one|two|three|four|five|six|seven|eight|nine|ten)\b/i,
28
- },
29
- {
30
- kind: "conditional",
31
- candidateLane: "predicate",
32
- confidence: 0.82,
33
- pattern: /\b(?:if|when|unless|except|only\s+if|provided\s+that)\b/i,
34
- },
35
- {
36
- kind: "permission",
37
- candidateLane: "predicate",
38
- confidence: 0.8,
39
- pattern: /\b(?:only|may|can|allowed|denied|forbidden|must\s+not|cannot|can't)\b/i,
40
- },
41
- {
42
- kind: "state_or_default",
43
- candidateLane: "predicate",
44
- confidence: 0.74,
45
- pattern: /\b(?:state|mode|defaults?\s+to|ready|disabled|enabled|terminal)\b/i,
46
- },
47
- {
48
- kind: "normative_modal",
49
- candidateLane: "observation_review",
50
- confidence: 0.65,
51
- // Modal-free validity, rejection, prohibition, and failure-outcome
52
- // assertions are normative even when they omit must/shall.
53
- pattern: /\b(?:must|shall|should|may|must\s+not|cannot|can't|invalid|unresolved|reject(?:ed|ion)?|prohibited|forbidden|fail(?:s|ed|ure)?\s+(?:clearly|explicitly|with)|required\s+outcome)\b/i,
54
- },
55
- ];
11
+ export function stringLogicClaims(value) {
12
+ return Array.isArray(value)
13
+ ? value.filter((entry) => typeof entry === "string")
14
+ : [];
15
+ }
56
16
  function proseOf(payload) {
57
17
  const properties = propertiesOf(payload);
58
18
  return [
@@ -101,22 +61,14 @@ function isModeled(payload, expectedClaimKeys) {
101
61
  types.has("requires_predicate") ||
102
62
  types.has("requires_rule")));
103
63
  }
64
+ /** Builtin semantic classifier is the single source of signal/lane detection. */
104
65
  function detectSignals(prose) {
105
- const seen = new Set();
106
- return SIGNAL_PATTERNS.flatMap((candidate) => {
107
- const evidence = prose.match(candidate.pattern)?.[0];
108
- if (!evidence || seen.has(candidate.kind))
109
- return [];
110
- seen.add(candidate.kind);
111
- return [
112
- {
113
- kind: candidate.kind,
114
- evidence,
115
- candidate_lane: candidate.candidateLane,
116
- confidence: candidate.confidence,
117
- },
118
- ];
119
- });
66
+ return detectBuiltinSignals(prose).map((signal) => ({
67
+ kind: signal.kind,
68
+ evidence: signal.evidence,
69
+ candidate_lane: signal.candidateLane,
70
+ confidence: signal.confidence,
71
+ }));
120
72
  }
121
73
  function ambiguitySuggestion(payload, statement) {
122
74
  const match = statement.match(/\b(?<value>\d+|zero|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?<resource>active\s+sessions?|sessions?)\b/i);
@@ -164,11 +116,15 @@ function ontologyGapSuggestion(payload, statement) {
164
116
  };
165
117
  }
166
118
  function predicateSuggestion(payload, statement) {
167
- return (detectPredicateRules(payload, statement, LAUNCHER_PREDICATE_RULES) ??
168
- detectPredicateRules(payload, statement, CORE_PREDICATE_RULES) ??
169
- detectPredicateRules(payload, statement, POLICY_PREDICATE_RULES) ??
170
- detectPredicateRules(payload, statement, PRODUCT_PREDICATE_RULES) ??
171
- detectPredicateRules(payload, statement, PRODUCT_TAIL_PREDICATE_RULES));
119
+ // Deterministic builtin pack — never loads external plugins on sync paths.
120
+ const matches = createBuiltinOntologyPack().match({
121
+ claimKey: "",
122
+ statement,
123
+ });
124
+ const hit = matches[0];
125
+ if (!hit)
126
+ return null;
127
+ return buildPredicateSuggestion(payload, hit.evidence, hit.predicateName, hit.arguments, hit.rationale ?? "", hit.polarity);
172
128
  }
173
129
  function ruleSuggestion(payload, candidate) {
174
130
  const validation = validateLogicIr(candidate.ir);
@@ -289,8 +245,9 @@ function modelingSuggestions(payload, modeled, clauses, interpretations) {
289
245
  return suggestions;
290
246
  }
291
247
  function withClauseProvenance(suggestion, clause, clauses, expectedClaimKeys, statement, sourceField) {
292
- const clauseOffset = statement.indexOf(clause.text);
293
- const clauseSpan = utf8Span(statement || clause.text, clauseOffset >= 0 ? clauseOffset : 0, clauseOffset >= 0 ? clauseOffset + clause.text.length : clause.text.length);
248
+ const clauseLocation = propositionSpan(statement, clause, 0);
249
+ const clauseText = clauseLocation.sourceText;
250
+ const clauseSpan = clauseLocation.span;
294
251
  const status = suggestion.kind === "ambiguity_observation"
295
252
  ? "ambiguous"
296
253
  : suggestion.kind === "ontology_gap"
@@ -309,7 +266,7 @@ function withClauseProvenance(suggestion, clause, clauses, expectedClaimKeys, st
309
266
  : "missing";
310
267
  return {
311
268
  claim_key: entry.claim_key,
312
- claim_text: entry.text,
269
+ claim_text: located.sourceText,
313
270
  role,
314
271
  status: entryStatus,
315
272
  span: located.span,
@@ -334,9 +291,7 @@ function withClauseProvenance(suggestion, clause, clauses, expectedClaimKeys, st
334
291
  if (properties === null)
335
292
  return step;
336
293
  if (step.type === "req") {
337
- const existing = Array.isArray(properties.logic_claims)
338
- ? properties.logic_claims.filter((value) => typeof value === "string")
339
- : [];
294
+ const existing = stringLogicClaims(properties.logic_claims);
340
295
  return {
341
296
  ...step,
342
297
  properties: {
@@ -357,7 +312,7 @@ function withClauseProvenance(suggestion, clause, clauses, expectedClaimKeys, st
357
312
  properties: {
358
313
  ...properties,
359
314
  claim_key: clause.claim_key,
360
- claim_text: clause.text,
315
+ claim_text: clauseText,
361
316
  claim_span_start: clauseSpan.start,
362
317
  claim_span_end: clauseSpan.end,
363
318
  },
@@ -366,14 +321,14 @@ function withClauseProvenance(suggestion, clause, clauses, expectedClaimKeys, st
366
321
  return {
367
322
  ...suggestion,
368
323
  claim_key: clause.claim_key,
369
- claim_text: clause.text,
324
+ claim_text: clauseText,
370
325
  applyPlan,
371
326
  ...(suggestion.kind === "predicate" && suggestion.relationshipPlan !== null
372
327
  ? {
373
328
  relationshipPlan: {
374
329
  ...suggestion.relationshipPlan,
375
330
  claimKey: clause.claim_key,
376
- claimText: clause.text,
331
+ claimText: clauseText,
377
332
  logicClaims: expectedClaimKeys,
378
333
  semanticClauses: clauses.map(({ text }) => text),
379
334
  semanticInventory,
@@ -387,7 +342,7 @@ function withClauseProvenance(suggestion, clause, clauses, expectedClaimKeys, st
387
342
  relationshipPlan: {
388
343
  ...suggestion.relationshipPlan,
389
344
  claimKey: clause.claim_key,
390
- claimText: clause.text,
345
+ claimText: clauseText,
391
346
  logicClaims: expectedClaimKeys,
392
347
  semanticClauses: clauses.map(({ text }) => text),
393
348
  semanticInventory,
@@ -554,12 +509,36 @@ function shadowAnalysis(text, interpretations) {
554
509
  }));
555
510
  }
556
511
  function propositionSpan(text, clause, cursor) {
557
- const exact = text.indexOf(clause.text, cursor);
512
+ const located = locateSourceText(text, clause.text, cursor);
513
+ return {
514
+ span: utf8Span(text, located.start, located.end),
515
+ next: Math.max(cursor, located.end),
516
+ sourceText: text.slice(located.start, located.end),
517
+ };
518
+ }
519
+ function escapeRegExp(value) {
520
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
521
+ }
522
+ /**
523
+ * Locate canonical claim text while accepting source-only whitespace layout.
524
+ * The caller receives the authored slice so strict ingestion can compare the
525
+ * span with the claim text without rewriting the source document.
526
+ */
527
+ function locateSourceText(source, claimText, cursor) {
528
+ const canonicalPattern = escapeRegExp(claimText).replace(/\s+/g, "\\s+");
529
+ const match = new RegExp(canonicalPattern).exec(source.slice(cursor));
530
+ if (match?.index !== undefined) {
531
+ const start = cursor + match.index;
532
+ return { start, end: start + match[0].length };
533
+ }
534
+ const exact = source.indexOf(claimText, cursor);
558
535
  const start = exact >= 0 ? exact : cursor;
559
- const end = exact >= 0
560
- ? exact + clause.text.length
561
- : Math.min(text.length, start + clause.text.length);
562
- return { span: utf8Span(text, start, end), next: Math.max(cursor, end) };
536
+ return {
537
+ start,
538
+ end: exact >= 0
539
+ ? exact + claimText.length
540
+ : Math.min(source.length, start + claimText.length),
541
+ };
563
542
  }
564
543
  function interpretationResults(interpretations, clauses, statement) {
565
544
  if (interpretations === undefined)
@@ -582,16 +561,8 @@ function interpretationResults(interpretations, clauses, statement) {
582
561
  (candidate.span.start < 0 || candidate.span.end < candidate.span.start))
583
562
  errors.push("interpretation span is invalid");
584
563
  if (clause && candidate.span) {
585
- const candidateStart = statement.indexOf(candidate.claim_text);
586
- const clauseStart = statement.indexOf(clause.text);
587
- const sourceStart = candidateStart >= 0 ? candidateStart : clauseStart;
588
- const sourceEnd = sourceStart >= 0
589
- ? sourceStart +
590
- (candidateStart >= 0
591
- ? candidate.claim_text.length
592
- : clause.text.length)
593
- : 0;
594
- const expectedSpan = utf8Span(statement, Math.max(0, sourceStart), Math.max(0, sourceEnd));
564
+ const candidateLocation = locateSourceText(statement, candidate.claim_text, 0);
565
+ const expectedSpan = utf8Span(statement, candidateLocation.start, candidateLocation.end);
595
566
  if (candidate.span.start !== expectedSpan.start ||
596
567
  candidate.span.end !== expectedSpan.end)
597
568
  errors.push(`interpretation span for ${candidate.claim_key} does not match the exact UTF-8 proposition span`);
@@ -671,7 +642,7 @@ function propositionInventory(statement, clauses, suggestions, interpretations,
671
642
  }
672
643
  return {
673
644
  claim_key: clause.claim_key,
674
- claim_text: clause.text,
645
+ claim_text: located.sourceText,
675
646
  role,
676
647
  status,
677
648
  span: located.span,
@@ -1 +1 @@
1
- {"version":3,"file":"clauses.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/clauses.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACjC,CAAC,CAAC;AAKH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAW7D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIrD;AA4BD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,GAClC,SAAS,cAAc,EAAE,CAgB3B"}
1
+ {"version":3,"file":"clauses.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/clauses.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACjC,CAAC,CAAC;AAKH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAW7D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIrD;AA4BD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,GAClC,SAAS,cAAc,EAAE,CA4B3B"}
@@ -46,11 +46,24 @@ export function extractSemanticClauses(text, suppliedClauses) {
46
46
  if (suppliedClauses !== undefined && normalized.length === 0) {
47
47
  throw new Error("Semantic advisor clauses must contain at least one non-empty atomic claim");
48
48
  }
49
- return normalized.map((clause, index) => ({
50
- claim_key: semanticClaimKey(clause),
51
- text: clause,
52
- index,
53
- normative: NORMATIVE_PATTERN.test(clause),
54
- source,
55
- }));
49
+ // A repeated sentence has one logical identity. Keep the first source
50
+ // occurrence for its source span and provenance; retaining repeated claim
51
+ // keys would make the inventory impossible to persist because logic_claims
52
+ // is a set-like manifest and grounding is one-to-one.
53
+ const seen = new Set();
54
+ return normalized.flatMap((clause, index) => {
55
+ const identity = clause.toLowerCase();
56
+ if (seen.has(identity))
57
+ return [];
58
+ seen.add(identity);
59
+ return [
60
+ {
61
+ claim_key: semanticClaimKey(clause),
62
+ text: clause,
63
+ index,
64
+ normative: NORMATIVE_PATTERN.test(clause),
65
+ source,
66
+ },
67
+ ];
68
+ });
56
69
  }
@@ -0,0 +1,63 @@
1
+ import type { PluginProviderStamp, SemanticClassificationDecision, SemanticClassifierInput } from "kibi-plugin-sdk";
2
+ import { type ComposedOntologyCatalog, type StampedOntologyCandidate } from "../../plugins/compose-ontology-packs.js";
3
+ import { type ComposedSemanticClassifierResult } from "../../plugins/compose-semantic-classifier.js";
4
+ import type { CapabilityRegistry } from "../../plugins/registry.js";
5
+ import type { OperationContext } from "../../public/operations/runtime-types.js";
6
+ import type { SemanticAdvisorAnalysisResult, SemanticAdvisorInput } from "./types.js";
7
+ export type SemanticPluginOrchestrationResult = Readonly<{
8
+ analysis: SemanticAdvisorAnalysisResult;
9
+ classification: ComposedSemanticClassifierResult | null;
10
+ ontologyCatalog: ComposedOntologyCatalog | null;
11
+ ontologyMatches: readonly StampedOntologyCandidate[];
12
+ ontologyShadowMatches: readonly StampedOntologyCandidate[];
13
+ stamps: readonly PluginProviderStamp[];
14
+ }>;
15
+ /**
16
+ * Drop sync-path builtin ontology `predicate` suggestions.
17
+ *
18
+ * `analyzeSemanticAdvisorInput` always consults the builtin pack for
19
+ * maintenance-safe deterministic matching. When a replace ontology pack is
20
+ * active, those suggestions must not survive into the public receipt —
21
+ * including when the replace pack abstains with a valid empty match set.
22
+ */
23
+ export declare function stripSyncBuiltinOntologySuggestions(analysis: SemanticAdvisorAnalysisResult): SemanticAdvisorAnalysisResult;
24
+ /**
25
+ * Host-construct advisory modeling suggestions from validated ontology matches.
26
+ *
27
+ * When `replaced` is true, matches replace any remaining claim-keyed
28
+ * suggestion for the matched claim (after sync builtin predicates were
29
+ * stripped). When false (augment/builtin), matches only fill claims that
30
+ * lack a suggestion.
31
+ */
32
+ export declare function applyOntologyMatchSuggestions(analysis: SemanticAdvisorAnalysisResult, ontologyMatches: readonly StampedOntologyCandidate[], options?: Readonly<{
33
+ replaced: boolean;
34
+ }>): SemanticAdvisorAnalysisResult;
35
+ /**
36
+ * Apply host-validated classifier decisions as a bounded routing seam.
37
+ *
38
+ * Plugins may influence per-proposition routing, candidate lane, suggested
39
+ * next tools, and advisory ambiguity metadata. They must not delete
40
+ * propositions, erase assertive unresolved obligations, downgrade modeled
41
+ * completeness, manufacture typed grounding, or invent mutation/proof.
42
+ */
43
+ export declare function applyClassificationRouting(analysis: SemanticAdvisorAnalysisResult, classification: ComposedSemanticClassifierResult, ontologyMatches?: readonly StampedOntologyCandidate[], options?: Readonly<{
44
+ replaced?: boolean;
45
+ /** True when a replace semantic classifier succeeded (not builtin fallback). */
46
+ classifierReplaced?: boolean;
47
+ }>): SemanticAdvisorAnalysisResult;
48
+ /**
49
+ * Async orchestration for allowlisted semantic operations.
50
+ * Maintenance paths must keep calling sync `analyzeSemanticAdvisorInput`.
51
+ */
52
+ export declare function analyzeSemanticAdvisorInputWithPlugins(input: SemanticAdvisorInput, options: Readonly<{
53
+ ensurePlugins?: () => Promise<CapabilityRegistry>;
54
+ operationName: string;
55
+ }>): Promise<SemanticPluginOrchestrationResult>;
56
+ /**
57
+ * Run allowlisted semantic classifier composition without re-running advisor
58
+ * analysis.
59
+ */
60
+ export declare function composeSemanticClassificationForOperation(context: OperationContext | undefined, operationName: string, input: SemanticClassifierInput): Promise<ComposedSemanticClassifierResult | null>;
61
+ export declare function composeOntologyCatalogForOperation(context: OperationContext | undefined, operationName: string): Promise<ComposedOntologyCatalog | null>;
62
+ export type { SemanticClassificationDecision };
63
+ //# sourceMappingURL=plugin-orchestration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-orchestration.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/plugin-orchestration.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAEV,mBAAmB,EACnB,8BAA8B,EAC9B,uBAAuB,EAExB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAG9B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,KAAK,gCAAgC,EAEtC,MAAM,8CAA8C,CAAC;AAEtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,OAAO,KAAK,EACV,6BAA6B,EAC7B,oBAAoB,EAKrB,MAAM,YAAY,CAAC;AAGpB,MAAM,MAAM,iCAAiC,GAAG,QAAQ,CAAC;IACvD,QAAQ,EAAE,6BAA6B,CAAC;IACxC,cAAc,EAAE,gCAAgC,GAAG,IAAI,CAAC;IACxD,eAAe,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAChD,eAAe,EAAE,SAAS,wBAAwB,EAAE,CAAC;IACrD,qBAAqB,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAC3D,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC;CACxC,CAAC,CAAC;AAmDH;;;;;;;GAOG;AAEH,wBAAgB,mCAAmC,CACjD,QAAQ,EAAE,6BAA6B,GACtC,6BAA6B,CAkB/B;AAED;;;;;;;GAOG;AAEH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,6BAA6B,EACvC,eAAe,EAAE,SAAS,wBAAwB,EAAE,EACpD,OAAO,GAAE,QAAQ,CAAC;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAuB,GAC7D,6BAA6B,CAiG/B;AAED;;;;;;;GAOG;AAEH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,6BAA6B,EACvC,cAAc,EAAE,gCAAgC,EAChD,eAAe,GAAE,SAAS,wBAAwB,EAAO,EACzD,OAAO,GAAE,QAAQ,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gFAAgF;IAChF,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAM,GACN,6BAA6B,CAqM/B;AAED;;;GAGG;AAEH,wBAAsB,sCAAsC,CAC1D,KAAK,EAAE,oBAAoB,EAC3B,OAAO,EAAE,QAAQ,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAClD,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC,GACD,OAAO,CAAC,iCAAiC,CAAC,CA8H5C;AAED;;;GAGG;AAEH,wBAAsB,yCAAyC,CAC7D,OAAO,EAAE,gBAAgB,GAAG,SAAS,EACrC,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,gCAAgC,GAAG,IAAI,CAAC,CAOlD;AAGD,wBAAsB,kCAAkC,CACtD,OAAO,EAAE,gBAAgB,GAAG,SAAS,EACrC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAOzC;AAED,YAAY,EAAE,8BAA8B,EAAE,CAAC"}