kibi-cli 2.3.0 → 2.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 (380) hide show
  1. package/dist/cli-json-command.d.ts +6 -0
  2. package/dist/cli-json-command.d.ts.map +1 -1
  3. package/dist/cli-json-command.js +39 -11
  4. package/dist/cli-operation-loader.d.ts.map +1 -1
  5. package/dist/cli-operation-loader.js +7 -0
  6. package/dist/cli-operation-metadata.d.ts +13 -5
  7. package/dist/cli-operation-metadata.d.ts.map +1 -1
  8. package/dist/cli-operation-metadata.js +15 -5
  9. package/dist/cli-protocol.d.ts +14 -0
  10. package/dist/cli-protocol.d.ts.map +1 -1
  11. package/dist/cli-protocol.js +31 -2
  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.map +1 -1
  15. package/dist/cli-register-proof.js +13 -0
  16. package/dist/commands/check.d.ts.map +1 -1
  17. package/dist/commands/check.js +11 -2
  18. package/dist/commands/discovery-shared.d.ts.map +1 -1
  19. package/dist/commands/discovery-shared.js +8 -2
  20. package/dist/commands/engine.d.ts.map +1 -1
  21. package/dist/commands/engine.js +4 -2
  22. package/dist/commands/gc.d.ts.map +1 -1
  23. package/dist/commands/gc.js +7 -0
  24. package/dist/commands/init-helpers.d.ts.map +1 -1
  25. package/dist/commands/init-helpers.js +0 -1
  26. package/dist/commands/merge-driver.d.ts +31 -0
  27. package/dist/commands/merge-driver.d.ts.map +1 -0
  28. package/dist/commands/merge-driver.js +268 -0
  29. package/dist/commands/migrate.d.ts.map +1 -1
  30. package/dist/commands/migrate.js +281 -14
  31. package/dist/commands/proof-compact.d.ts +9 -0
  32. package/dist/commands/proof-compact.d.ts.map +1 -0
  33. package/dist/commands/proof-compact.js +58 -0
  34. package/dist/commands/prove.d.ts +38 -0
  35. package/dist/commands/prove.d.ts.map +1 -1
  36. package/dist/commands/prove.js +222 -47
  37. package/dist/commands/sync/persistence.d.ts.map +1 -1
  38. package/dist/commands/sync/persistence.js +61 -16
  39. package/dist/commands/sync.d.ts +8 -0
  40. package/dist/commands/sync.d.ts.map +1 -1
  41. package/dist/commands/sync.js +42 -16
  42. package/dist/diagnostics.js +1 -1
  43. package/dist/engine-limits.d.ts +74 -0
  44. package/dist/engine-limits.d.ts.map +1 -0
  45. package/dist/engine-limits.js +201 -0
  46. package/dist/engine.d.ts +10 -0
  47. package/dist/engine.d.ts.map +1 -1
  48. package/dist/engine.js +57 -9
  49. package/dist/extractors/manifest.d.ts +8 -0
  50. package/dist/extractors/manifest.d.ts.map +1 -1
  51. package/dist/extractors/manifest.js +34 -5
  52. package/dist/extractors/markdown.d.ts +8 -0
  53. package/dist/extractors/markdown.d.ts.map +1 -1
  54. package/dist/extractors/markdown.js +57 -0
  55. package/dist/extractors/relationships.d.ts.map +1 -1
  56. package/dist/extractors/relationships.js +2 -0
  57. package/dist/intent-search.d.ts +4 -1
  58. package/dist/intent-search.d.ts.map +1 -1
  59. package/dist/intent-search.js +186 -33
  60. package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
  61. package/dist/operations/bootstrap/candidate-helpers.js +8 -1
  62. package/dist/operations/bootstrap/candidates.d.ts.map +1 -1
  63. package/dist/operations/bootstrap/candidates.js +55 -39
  64. package/dist/operations/bootstrap/discovery.js +1 -1
  65. package/dist/operations/bootstrap/generate.d.ts +2 -0
  66. package/dist/operations/bootstrap/generate.d.ts.map +1 -1
  67. package/dist/operations/bootstrap/generate.js +107 -37
  68. package/dist/operations/bootstrap/guidance-actions.d.ts.map +1 -1
  69. package/dist/operations/bootstrap/guidance-actions.js +3 -0
  70. package/dist/operations/bootstrap/guidance.d.ts.map +1 -1
  71. package/dist/operations/bootstrap/guidance.js +7 -1
  72. package/dist/operations/bootstrap/intent-claims.d.ts +17 -0
  73. package/dist/operations/bootstrap/intent-claims.d.ts.map +1 -0
  74. package/dist/operations/bootstrap/intent-claims.js +103 -0
  75. package/dist/operations/bootstrap/markdown-candidates.d.ts +2 -0
  76. package/dist/operations/bootstrap/markdown-candidates.d.ts.map +1 -1
  77. package/dist/operations/bootstrap/markdown-candidates.js +32 -10
  78. package/dist/operations/bootstrap/presentation.d.ts +2 -0
  79. package/dist/operations/bootstrap/presentation.d.ts.map +1 -1
  80. package/dist/operations/bootstrap/presentation.js +66 -3
  81. package/dist/operations/bootstrap/requirement-claims.d.ts +1 -0
  82. package/dist/operations/bootstrap/requirement-claims.d.ts.map +1 -1
  83. package/dist/operations/bootstrap/requirement-claims.js +13 -1
  84. package/dist/operations/bootstrap/types.d.ts +28 -0
  85. package/dist/operations/bootstrap/types.d.ts.map +1 -1
  86. package/dist/operations/bootstrap/types.js +16 -0
  87. package/dist/operations/bootstrap/validation.d.ts +4 -0
  88. package/dist/operations/bootstrap/validation.d.ts.map +1 -0
  89. package/dist/operations/bootstrap/validation.js +20 -0
  90. package/dist/operations/migration/inventory-rederive.d.ts +81 -0
  91. package/dist/operations/migration/inventory-rederive.d.ts.map +1 -0
  92. package/dist/operations/migration/inventory-rederive.js +484 -0
  93. package/dist/operations/migration/kb-sources.d.ts +53 -0
  94. package/dist/operations/migration/kb-sources.d.ts.map +1 -0
  95. package/dist/operations/migration/kb-sources.js +233 -0
  96. package/dist/operations/migration/origin-backfill.d.ts +39 -0
  97. package/dist/operations/migration/origin-backfill.d.ts.map +1 -0
  98. package/dist/operations/migration/origin-backfill.js +164 -0
  99. package/dist/operations/migration/polarity-values.d.ts +10 -0
  100. package/dist/operations/migration/polarity-values.d.ts.map +1 -0
  101. package/dist/operations/migration/polarity-values.js +60 -0
  102. package/dist/operations/migration/schema6.d.ts +59 -0
  103. package/dist/operations/migration/schema6.d.ts.map +1 -0
  104. package/dist/operations/migration/schema6.js +379 -0
  105. package/dist/operations/migration/source-paths.d.ts +131 -0
  106. package/dist/operations/migration/source-paths.d.ts.map +1 -0
  107. package/dist/operations/migration/source-paths.js +308 -0
  108. package/dist/operations/migration/superseded-closure.d.ts +54 -0
  109. package/dist/operations/migration/superseded-closure.d.ts.map +1 -0
  110. package/dist/operations/migration/superseded-closure.js +187 -0
  111. package/dist/operations/modeling/logic-modeling.d.ts.map +1 -1
  112. package/dist/operations/modeling/logic-modeling.js +3 -5
  113. package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
  114. package/dist/operations/modeling/model-requirement.js +225 -67
  115. package/dist/operations/mutation/contradictions.d.ts +16 -0
  116. package/dist/operations/mutation/contradictions.d.ts.map +1 -1
  117. package/dist/operations/mutation/contradictions.js +32 -0
  118. package/dist/operations/mutation/delete.d.ts.map +1 -1
  119. package/dist/operations/mutation/delete.js +15 -7
  120. package/dist/operations/mutation/origin.d.ts +21 -0
  121. package/dist/operations/mutation/origin.d.ts.map +1 -0
  122. package/dist/operations/mutation/origin.js +78 -0
  123. package/dist/operations/mutation/plan-apply-journal.d.ts +182 -0
  124. package/dist/operations/mutation/plan-apply-journal.d.ts.map +1 -0
  125. package/dist/operations/mutation/plan-apply-journal.js +613 -0
  126. package/dist/operations/mutation/predicate-vocabulary-guard.d.ts +3 -1
  127. package/dist/operations/mutation/predicate-vocabulary-guard.d.ts.map +1 -1
  128. package/dist/operations/mutation/predicate-vocabulary-guard.js +13 -2
  129. package/dist/operations/mutation/relationships.d.ts +5 -5
  130. package/dist/operations/mutation/relationships.d.ts.map +1 -1
  131. package/dist/operations/mutation/relationships.js +31 -11
  132. package/dist/operations/mutation/serialization.d.ts.map +1 -1
  133. package/dist/operations/mutation/serialization.js +3 -1
  134. package/dist/operations/mutation/source-authoring.d.ts +6 -0
  135. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  136. package/dist/operations/mutation/source-authoring.js +7 -1
  137. package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -1
  138. package/dist/operations/mutation/symbol-refresh.js +4 -1
  139. package/dist/operations/mutation/types.d.ts +14 -0
  140. package/dist/operations/mutation/types.d.ts.map +1 -1
  141. package/dist/operations/mutation/upsert.d.ts +30 -3
  142. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  143. package/dist/operations/mutation/upsert.js +105 -35
  144. package/dist/operations/mutation/validate-upsert.d.ts +6 -0
  145. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
  146. package/dist/operations/mutation/validate-upsert.js +34 -30
  147. package/dist/operations/planning/apply-plan.d.ts.map +1 -1
  148. package/dist/operations/planning/apply-plan.js +751 -144
  149. package/dist/operations/planning/compile-intent.d.ts +34 -1
  150. package/dist/operations/planning/compile-intent.d.ts.map +1 -1
  151. package/dist/operations/planning/compile-intent.js +314 -98
  152. package/dist/operations/proof/code-scope.d.ts +28 -0
  153. package/dist/operations/proof/code-scope.d.ts.map +1 -1
  154. package/dist/operations/proof/code-scope.js +72 -0
  155. package/dist/operations/proof/compact-receipts.d.ts +49 -0
  156. package/dist/operations/proof/compact-receipts.d.ts.map +1 -0
  157. package/dist/operations/proof/compact-receipts.js +160 -0
  158. package/dist/operations/proof/ingest-proof.d.ts +2 -0
  159. package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
  160. package/dist/operations/proof/ingest-proof.js +44 -23
  161. package/dist/operations/proof/prune-receipts.d.ts.map +1 -1
  162. package/dist/operations/proof/prune-receipts.js +5 -9
  163. package/dist/operations/proof/receipt-compaction.d.ts +48 -0
  164. package/dist/operations/proof/receipt-compaction.d.ts.map +1 -0
  165. package/dist/operations/proof/receipt-compaction.js +121 -0
  166. package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
  167. package/dist/operations/semantic-advisor/analysis-receipt.js +12 -1
  168. package/dist/operations/semantic-advisor/analyze-prose.d.ts +2 -1
  169. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  170. package/dist/operations/semantic-advisor/analyze-prose.js +51 -5
  171. package/dist/operations/semantic-advisor/clauses.d.ts +1 -0
  172. package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
  173. package/dist/operations/semantic-advisor/clauses.js +11 -1
  174. package/dist/operations/semantic-advisor/conditional-rules.d.ts +33 -0
  175. package/dist/operations/semantic-advisor/conditional-rules.d.ts.map +1 -0
  176. package/dist/operations/semantic-advisor/conditional-rules.js +262 -0
  177. package/dist/operations/semantic-advisor/ingestion-boundary.d.ts +3 -1
  178. package/dist/operations/semantic-advisor/ingestion-boundary.d.ts.map +1 -1
  179. package/dist/operations/semantic-advisor/ingestion-boundary.js +14 -6
  180. package/dist/operations/semantic-advisor/plugin-orchestration.js +1 -1
  181. package/dist/prolog/codec.d.ts.map +1 -1
  182. package/dist/prolog/codec.js +2 -1
  183. package/dist/prolog.d.ts +9 -0
  184. package/dist/prolog.d.ts.map +1 -1
  185. package/dist/prolog.js +56 -10
  186. package/dist/proof/command-test-report.d.ts +74 -0
  187. package/dist/proof/command-test-report.d.ts.map +1 -0
  188. package/dist/proof/command-test-report.js +206 -0
  189. package/dist/public/branch-resolver.d.ts +1 -0
  190. package/dist/public/branch-resolver.d.ts.map +1 -1
  191. package/dist/public/branch-resolver.js +1 -0
  192. package/dist/public/diagnostic-usage.d.ts +14 -0
  193. package/dist/public/diagnostic-usage.d.ts.map +1 -1
  194. package/dist/public/diagnostic-usage.js +55 -1
  195. package/dist/public/entity-origin.d.ts +69 -0
  196. package/dist/public/entity-origin.d.ts.map +1 -0
  197. package/dist/public/entity-origin.js +142 -0
  198. package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
  199. package/dist/public/impact/full-kb-quality.js +1 -0
  200. package/dist/public/impact/requirement-quality.js +1 -1
  201. package/dist/public/operations/catalog.d.ts +203 -20
  202. package/dist/public/operations/catalog.d.ts.map +1 -1
  203. package/dist/public/operations/catalog.js +3 -0
  204. package/dist/public/operations/check-executor.d.ts.map +1 -1
  205. package/dist/public/operations/check-executor.js +8 -0
  206. package/dist/public/operations/contracts.d.ts +0 -5
  207. package/dist/public/operations/contracts.d.ts.map +1 -1
  208. package/dist/public/operations/contracts.js +63 -14
  209. package/dist/public/operations/discovery-entities.d.ts +15 -0
  210. package/dist/public/operations/discovery-entities.d.ts.map +1 -1
  211. package/dist/public/operations/discovery-entities.js +59 -0
  212. package/dist/public/operations/discovery-executors.d.ts +6 -1
  213. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  214. package/dist/public/operations/discovery-executors.js +65 -6
  215. package/dist/public/operations/index.d.ts +1 -0
  216. package/dist/public/operations/index.d.ts.map +1 -1
  217. package/dist/public/operations/index.js +1 -0
  218. package/dist/public/operations/migration-plan.d.ts +5 -0
  219. package/dist/public/operations/migration-plan.d.ts.map +1 -1
  220. package/dist/public/operations/migration-plan.js +26 -1
  221. package/dist/public/operations/node-ports.d.ts.map +1 -1
  222. package/dist/public/operations/node-ports.js +24 -3
  223. package/dist/public/operations/origin-review.d.ts +51 -0
  224. package/dist/public/operations/origin-review.d.ts.map +1 -0
  225. package/dist/public/operations/origin-review.js +307 -0
  226. package/dist/public/operations/predicate-schema-conformance.js +1 -1
  227. package/dist/public/operations/repair-plan.d.ts.map +1 -1
  228. package/dist/public/operations/repair-plan.js +4 -0
  229. package/dist/public/operations/result-envelope.d.ts.map +1 -1
  230. package/dist/public/operations/result-envelope.js +17 -5
  231. package/dist/public/operations/runtime-types.d.ts +9 -0
  232. package/dist/public/operations/runtime-types.d.ts.map +1 -1
  233. package/dist/public/operations/schema6-check-actions.d.ts +127 -0
  234. package/dist/public/operations/schema6-check-actions.d.ts.map +1 -0
  235. package/dist/public/operations/schema6-check-actions.js +575 -0
  236. package/dist/public/operations/source-path-dangling.d.ts +17 -0
  237. package/dist/public/operations/source-path-dangling.d.ts.map +1 -0
  238. package/dist/public/operations/source-path-dangling.js +66 -0
  239. package/dist/public/operations/specs/bootstrap.d.ts +73 -1
  240. package/dist/public/operations/specs/bootstrap.d.ts.map +1 -1
  241. package/dist/public/operations/specs/bootstrap.js +66 -1
  242. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  243. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  244. package/dist/public/operations/specs/check-rules.generated.js +15 -1
  245. package/dist/public/operations/specs/check.d.ts +2 -2
  246. package/dist/public/operations/specs/check.js +1 -1
  247. package/dist/public/operations/specs/composite.d.ts +351 -0
  248. package/dist/public/operations/specs/composite.d.ts.map +1 -0
  249. package/dist/public/operations/specs/composite.js +96 -0
  250. package/dist/public/operations/specs/discovery.d.ts +8 -3
  251. package/dist/public/operations/specs/discovery.d.ts.map +1 -1
  252. package/dist/public/operations/specs/discovery.js +8 -3
  253. package/dist/public/operations/specs/modeling.d.ts +2 -2
  254. package/dist/public/operations/specs/modeling.js +2 -2
  255. package/dist/public/operations/specs/mutation-schemas.d.ts +73 -8
  256. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  257. package/dist/public/operations/specs/mutation-schemas.js +43 -7
  258. package/dist/public/operations/specs/mutation.d.ts +1 -1
  259. package/dist/public/operations/specs/mutation.js +1 -1
  260. package/dist/public/operations/specs/planning.d.ts +2 -2
  261. package/dist/public/operations/specs/planning.js +4 -4
  262. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  263. package/dist/public/operations/specs/reporting.js +13 -26
  264. package/dist/public/operations/specs/upsert.d.ts +79 -9
  265. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  266. package/dist/public/operations/specs/upsert.js +6 -1
  267. package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -1
  268. package/dist/public/operations/symbol-repair-plan.js +3 -1
  269. package/dist/public/operations/types.d.ts +1 -1
  270. package/dist/public/operations/types.d.ts.map +1 -1
  271. package/dist/public/proof-receipt.d.ts +1 -0
  272. package/dist/public/proof-receipt.d.ts.map +1 -1
  273. package/dist/public/schemas/entity.d.ts.map +1 -1
  274. package/dist/public/schemas/entity.js +52 -0
  275. package/dist/public/schemas/relationship.d.ts.map +1 -1
  276. package/dist/public/schemas/relationship.js +2 -0
  277. package/dist/public/skills/kibi-bootstrap/SKILL.md +52 -11
  278. package/dist/public/skills/kibi-bootstrap/resources/bootstrap.md +12 -1
  279. package/dist/public/skills/kibi-usage/SKILL.md +82 -18
  280. package/dist/public/skills/kibi-usage/resources/fact-lanes.md +5 -5
  281. package/dist/public/skills/kibi-usage/resources/kb-improvement.md +1 -1
  282. package/dist/public/skills/kibi-usage/resources/logic-ir.md +2 -2
  283. package/dist/public/skills/kibi-usage/resources/operation-access.md +29 -1
  284. package/dist/public/skills/kibi-usage/resources/ui-requirements.md +4 -4
  285. package/dist/public/skills/kibi-usage/resources/workflows.md +42 -25
  286. package/dist/public/telemetry-acceptance.d.ts +64 -0
  287. package/dist/public/telemetry-acceptance.d.ts.map +1 -1
  288. package/dist/public/telemetry-acceptance.js +143 -7
  289. package/dist/public/telemetry-remediation.d.ts.map +1 -1
  290. package/dist/public/telemetry-remediation.js +26 -10
  291. package/dist/relationships/shards.d.ts +13 -0
  292. package/dist/relationships/shards.d.ts.map +1 -1
  293. package/dist/relationships/shards.js +54 -28
  294. package/dist/runtime/cli-runtime.d.ts.map +1 -1
  295. package/dist/runtime/cli-runtime.js +44 -3
  296. package/dist/runtime/detached-snapshot.d.ts +38 -0
  297. package/dist/runtime/detached-snapshot.d.ts.map +1 -0
  298. package/dist/runtime/detached-snapshot.js +92 -0
  299. package/dist/schemas/entity.schema.json +122 -0
  300. package/dist/search-answer.d.ts +157 -0
  301. package/dist/search-answer.d.ts.map +1 -0
  302. package/dist/search-answer.js +846 -0
  303. package/dist/traceability/impact-knowledge.d.ts.map +1 -1
  304. package/dist/traceability/impact-knowledge.js +7 -0
  305. package/dist/traceability/symbol-extract.js +3 -3
  306. package/dist/traceability/temp-kb.d.ts.map +1 -1
  307. package/dist/traceability/temp-kb.js +12 -0
  308. package/dist/types/entities.d.ts +13 -0
  309. package/dist/types/entities.d.ts.map +1 -1
  310. package/dist/types/relationships.d.ts +1 -1
  311. package/dist/types/relationships.d.ts.map +1 -1
  312. package/dist/utils/branch-resolver.d.ts +37 -1
  313. package/dist/utils/branch-resolver.d.ts.map +1 -1
  314. package/dist/utils/branch-resolver.js +130 -3
  315. package/dist/utils/repo-relative-path.d.ts +18 -0
  316. package/dist/utils/repo-relative-path.d.ts.map +1 -0
  317. package/dist/utils/repo-relative-path.js +58 -0
  318. package/dist/utils/rule-registry.generated.d.ts +75 -3
  319. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  320. package/dist/utils/rule-registry.generated.js +89 -3
  321. package/dist/utils/schema-version.d.ts +1 -1
  322. package/dist/utils/schema-version.d.ts.map +1 -1
  323. package/dist/utils/schema-version.js +4 -3
  324. package/dist/utils/strict-modeling.d.ts +1 -1
  325. package/dist/utils/strict-modeling.d.ts.map +1 -1
  326. package/dist/utils/strict-modeling.js +23 -3
  327. package/package.json +3 -3
  328. package/schema/entities.pl +22 -0
  329. package/schema/relationships.pl +14 -0
  330. package/schema/validation.pl +45 -1
  331. package/src/public/branch-resolver.ts +1 -0
  332. package/src/public/diagnostic-usage.ts +59 -1
  333. package/src/public/entity-origin.ts +175 -0
  334. package/src/public/impact/full-kb-quality.ts +1 -0
  335. package/src/public/impact/requirement-quality.ts +1 -1
  336. package/src/public/operations/catalog.ts +3 -0
  337. package/src/public/operations/check-executor.ts +15 -0
  338. package/src/public/operations/contracts.ts +75 -15
  339. package/src/public/operations/discovery-entities.ts +74 -0
  340. package/src/public/operations/discovery-executors.ts +88 -10
  341. package/src/public/operations/index.ts +1 -0
  342. package/src/public/operations/migration-plan.ts +30 -1
  343. package/src/public/operations/node-ports.ts +24 -3
  344. package/src/public/operations/origin-review.ts +375 -0
  345. package/src/public/operations/predicate-schema-conformance.ts +1 -1
  346. package/src/public/operations/repair-plan.ts +4 -0
  347. package/src/public/operations/result-envelope.ts +18 -6
  348. package/src/public/operations/runtime-types.ts +9 -0
  349. package/src/public/operations/schema6-check-actions.ts +699 -0
  350. package/src/public/operations/source-path-dangling.ts +81 -0
  351. package/src/public/operations/specs/bootstrap.ts +78 -4
  352. package/src/public/operations/specs/check-rules.generated.ts +15 -1
  353. package/src/public/operations/specs/check.ts +1 -1
  354. package/src/public/operations/specs/composite.ts +141 -0
  355. package/src/public/operations/specs/discovery.ts +9 -3
  356. package/src/public/operations/specs/modeling.ts +2 -2
  357. package/src/public/operations/specs/mutation-schemas.ts +49 -7
  358. package/src/public/operations/specs/mutation.ts +1 -1
  359. package/src/public/operations/specs/planning.ts +4 -4
  360. package/src/public/operations/specs/reporting.ts +13 -38
  361. package/src/public/operations/specs/upsert.ts +7 -1
  362. package/src/public/operations/symbol-repair-plan.ts +3 -1
  363. package/src/public/operations/types.ts +2 -0
  364. package/src/public/proof-receipt.ts +1 -0
  365. package/src/public/schemas/entity.ts +57 -0
  366. package/src/public/schemas/relationship.ts +2 -0
  367. package/src/public/skills/kibi-bootstrap/SKILL.md +52 -11
  368. package/src/public/skills/kibi-bootstrap/resources/bootstrap.md +12 -1
  369. package/src/public/skills/kibi-usage/SKILL.md +82 -18
  370. package/src/public/skills/kibi-usage/resources/fact-lanes.md +5 -5
  371. package/src/public/skills/kibi-usage/resources/kb-improvement.md +1 -1
  372. package/src/public/skills/kibi-usage/resources/logic-ir.md +2 -2
  373. package/src/public/skills/kibi-usage/resources/operation-access.md +29 -1
  374. package/src/public/skills/kibi-usage/resources/ui-requirements.md +4 -4
  375. package/src/public/skills/kibi-usage/resources/workflows.md +42 -25
  376. package/src/public/telemetry-acceptance-types.d.ts +4 -1
  377. package/src/public/telemetry-acceptance.ts +210 -7
  378. package/src/public/telemetry-remediation.ts +39 -10
  379. package/src/schemas/entity.schema.json +122 -0
  380. package/src/schemas/relationship.schema.json +2 -0
@@ -4,42 +4,37 @@ import { extractFromMarkdownString } from "../../extractors/markdown.js";
4
4
  import { confidenceBand, slug, upsert } from "./candidate-helpers.js";
5
5
  import { markdownCandidates, } from "./markdown-candidates.js";
6
6
  function typedCandidates(item, existingIds) {
7
- try {
8
- const results = item.kind === "symbol_manifest"
9
- ? extractFromManifestString(item.content ?? "", item.relativePath ?? item.label)
10
- : [
11
- extractFromMarkdownString(item.content ?? "", item.relativePath ?? item.label),
12
- ];
13
- return results.flatMap(({ entity, relationships }) => {
14
- if (existingIds.has(entity.id))
15
- return [];
16
- const sourceKind = item.kind === "symbol_manifest" ? "symbol_manifest" : "typed_markdown";
17
- return [
18
- {
19
- candidateId: `${sourceKind === "symbol_manifest" ? "mf" : "md"}:${item.relativePath}:${entity.id}`,
20
- entityType: entity.type,
21
- title: entity.title,
22
- sourceKind,
23
- sourcePath: item.absolutePath ?? item.label,
24
- confidence: sourceKind === "symbol_manifest" ? 0.98 : 1,
25
- confidenceBand: "high",
26
- evidence: [
27
- `extracted_from_${sourceKind}:${item.relativePath}`,
28
- `entity_id:${entity.id}`,
29
- ],
30
- relationships: relationships.map(({ type, from, to }) => ({
31
- type,
32
- from,
33
- to,
34
- })),
35
- applyPlan: [upsert(entity, relationships)],
36
- },
37
- ];
38
- });
39
- }
40
- catch {
41
- return [];
42
- }
7
+ const results = item.kind === "symbol_manifest"
8
+ ? extractFromManifestString(item.content ?? "", item.relativePath ?? item.label)
9
+ : [
10
+ extractFromMarkdownString(item.content ?? "", item.relativePath ?? item.label),
11
+ ];
12
+ return results.flatMap(({ entity, relationships }) => {
13
+ if (existingIds.has(entity.id))
14
+ return [];
15
+ const sourceKind = item.kind === "symbol_manifest" ? "symbol_manifest" : "typed_markdown";
16
+ return [
17
+ {
18
+ candidateId: `${sourceKind === "symbol_manifest" ? "mf" : "md"}:${item.relativePath}:${entity.id}`,
19
+ entityType: entity.type,
20
+ title: entity.title,
21
+ sourceKind,
22
+ sourcePath: item.absolutePath ?? item.label,
23
+ confidence: sourceKind === "symbol_manifest" ? 0.98 : 1,
24
+ confidenceBand: "high",
25
+ evidence: [
26
+ `extracted_from_${sourceKind}:${item.relativePath}`,
27
+ `entity_id:${entity.id}`,
28
+ ],
29
+ relationships: relationships.map(({ type, from, to }) => ({
30
+ type,
31
+ from,
32
+ to,
33
+ })),
34
+ applyPlan: [upsert(entity, relationships)],
35
+ },
36
+ ];
37
+ });
43
38
  }
44
39
  function providerCandidate(item, existingIds, minConfidence) {
45
40
  if (!new Set([
@@ -91,18 +86,37 @@ function providerCandidate(item, existingIds, minConfidence) {
91
86
  },
92
87
  ];
93
88
  }
94
- // implements REQ-mcp-kibi-bootstrap-bootstrap-v1, REQ-kibi-operation-interface-parity
89
+ // implements REQ-KIBI-BOOTSTRAP-PLAN, REQ-kibi-operation-interface-parity
95
90
  // implements REQ-KIBI-BOOTSTRAP-PLAN
96
91
  export function buildBootstrapCandidates(evidence, existingIds, minConfidence, includeGenericMarkdown) {
97
92
  const candidates = [];
98
93
  const sourceOnlySignals = [];
94
+ const diagnostics = [];
95
+ const suppressed = [];
99
96
  for (const item of evidence) {
100
- if (item.kind === "typed_markdown" || item.kind === "symbol_manifest")
101
- candidates.push(...typedCandidates(item, existingIds));
97
+ if (item.kind === "typed_markdown" || item.kind === "symbol_manifest") {
98
+ try {
99
+ candidates.push(...typedCandidates(item, existingIds));
100
+ }
101
+ catch (error) {
102
+ const message = error instanceof Error ? error.message : String(error);
103
+ const sourcePath = item.relativePath ?? item.label;
104
+ diagnostics.push(`Bootstrap extraction failed at ${sourcePath}: ${message}`);
105
+ suppressed.push({
106
+ candidateId: "",
107
+ sourcePath,
108
+ entityType: "",
109
+ reason: "extraction_failed",
110
+ message,
111
+ });
112
+ }
113
+ }
102
114
  if (item.kind === "generic_markdown" && includeGenericMarkdown) {
103
115
  const built = markdownCandidates(item, existingIds, minConfidence);
104
116
  candidates.push(...built.candidates);
105
117
  sourceOnlySignals.push(...built.sourceOnlySignals);
118
+ diagnostics.push(...built.diagnostics);
119
+ suppressed.push(...built.suppressed);
106
120
  }
107
121
  if (item.kind === "test_topology") {
108
122
  const confidence = typeof item.data.confidence === "number" ? item.data.confidence : 0.8;
@@ -122,6 +136,8 @@ export function buildBootstrapCandidates(evidence, existingIds, minConfidence, i
122
136
  }
123
137
  return {
124
138
  candidates,
139
+ diagnostics,
140
+ suppressed,
125
141
  sourceOnlySignals: sourceOnlySignals.sort((left, right) => right.confidence - left.confidence ||
126
142
  left.sourcePath.localeCompare(right.sourcePath)),
127
143
  };
@@ -63,7 +63,7 @@ function frameworks(evidence) {
63
63
  : [])),
64
64
  ].sort();
65
65
  }
66
- // implements REQ-mcp-kibi-bootstrap-bootstrap-v1, REQ-kibi-operation-interface-parity
66
+ // implements REQ-KIBI-BOOTSTRAP-PLAN, REQ-kibi-operation-interface-parity
67
67
  // implements REQ-KIBI-BOOTSTRAP-PLAN
68
68
  export async function discoverBootstrap(context) {
69
69
  const scan = await scanEvidence(context);
@@ -4,6 +4,8 @@ export declare function filterSourceOnlySignals(signals: readonly SourceOnlySign
4
4
  export declare function selectBootstrapCandidates(input: readonly Candidate[], existingIds: ReadonlySet<string>, entityTypes: readonly string[] | undefined, maximum: number): {
5
5
  readonly candidates: readonly Candidate[];
6
6
  readonly suppressed: readonly Readonly<Record<string, unknown>>[];
7
+ readonly sourceOnlySignals: readonly SourceOnlySignal[];
8
+ readonly diagnostics: readonly string[];
7
9
  };
8
10
  export declare function executePlanBootstrap(args: PlanBootstrapArgs, context: OperationContext): Promise<PlanBootstrapResult>;
9
11
  //# sourceMappingURL=generate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/generate.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAKjF,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACzC,SAAS,gBAAgB,EAAE,CAI7B;AA2BD,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC1C,OAAO,EAAE,MAAM,GACd;IACD,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CACnE,CAiDA;AA+GD,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,mBAAmB,CAAC,CAyD9B"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/generate.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAOjF,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACzC,SAAS,gBAAgB,EAAE,CAI7B;AA8BD,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC1C,OAAO,EAAE,MAAM,GACd;IACD,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAClE,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACxD,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC,CAsFA;AAiHD,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,mBAAmB,CAAC,CA6F9B"}
@@ -5,7 +5,9 @@ import { executeStatus } from "../../public/operations/discovery-executors.js";
5
5
  import { readWorkspaceSnapshot } from "../../public/operations/workspace-snapshot.js";
6
6
  import { buildBootstrapCandidates } from "./candidates.js";
7
7
  import { discoverBootstrap } from "./discovery.js";
8
- import { presentBootstrap } from "./presentation.js";
8
+ import { buildIntentClaimCandidates } from "./intent-claims.js";
9
+ import { normalizeBootstrapContext, presentBootstrap } from "./presentation.js";
10
+ import { validateBootstrapPayload } from "./validation.js";
9
11
  export function filterSourceOnlySignals(signals, entityTypes) {
10
12
  return entityTypes && entityTypes.length > 0
11
13
  ? signals.filter((signal) => entityTypes.includes(signal.kind))
@@ -19,7 +21,7 @@ function titleKey(candidate) {
19
21
  return `${candidate.entityType}::${candidate.title.trim().toLowerCase().replace(/\s+/g, " ")}`;
20
22
  }
21
23
  function firstUpsertId(candidate) {
22
- const first = candidate.applyPlan[0];
24
+ const first = candidate.applyPlan.find((payload) => payload.type === candidate.entityType) ?? candidate.applyPlan[0];
23
25
  if (typeof first?.id === "string")
24
26
  return first.id;
25
27
  const properties = first?.properties;
@@ -34,48 +36,84 @@ function sha256(value) {
34
36
  return createHash("sha256").update(value).digest("hex");
35
37
  }
36
38
  export function selectBootstrapCandidates(input, existingIds, entityTypes, maximum) {
37
- const allowed = entityTypes && entityTypes.length > 0 ? new Set(entityTypes) : null;
38
- const sorted = input
39
- .filter((candidate) => allowed?.has(candidate.entityType) ?? true)
40
- .sort((left, right) => right.confidence - left.confidence ||
41
- left.sourcePath.localeCompare(right.sourcePath))
42
- .slice(0, maximum);
43
- const typedTitles = new Set(sorted
44
- .filter((candidate) => candidate.sourceKind === "typed_markdown")
45
- .map(titleKey));
46
- const selected = new Map();
39
+ const allowed = entityTypes?.length ? new Set(entityTypes) : null;
40
+ const lane = (candidate) => {
41
+ if (candidate.sourceKind === "intent_claim")
42
+ return 0;
43
+ if (candidate.entityType === "req" &&
44
+ ["typed_markdown", "generic_markdown"].includes(candidate.sourceKind))
45
+ return 1;
46
+ return 2;
47
+ };
47
48
  const suppressed = [];
48
- const suppress = (candidate, reason) => {
49
+ const sourceOnlySignals = [];
50
+ const diagnostics = [];
51
+ const suppress = (candidate, reason, message) => {
49
52
  suppressed.push({
50
53
  candidateId: candidate.candidateId,
51
54
  reason,
52
55
  sourcePath: candidate.sourcePath,
53
56
  entityType: candidate.entityType,
57
+ ...(message ? { message } : {}),
54
58
  });
55
59
  };
56
- for (const candidate of sorted) {
60
+ const writable = input
61
+ .filter((candidate) => {
62
+ if (allowed && !allowed.has(candidate.entityType))
63
+ return false;
57
64
  if (existingIds.has(firstUpsertId(candidate))) {
58
65
  suppress(candidate, "entity_exists");
59
- continue;
66
+ return false;
67
+ }
68
+ try {
69
+ if (candidate.applyPlan.length === 0)
70
+ throw new Error("Candidate has no write actions");
71
+ for (const payload of candidate.applyPlan)
72
+ validateBootstrapPayload(payload, new Date());
73
+ return true;
60
74
  }
75
+ catch (error) {
76
+ const message = error instanceof Error ? error.message : String(error);
77
+ suppress(candidate, "invalid_write", message);
78
+ diagnostics.push(`Invalid bootstrap candidate at ${candidate.sourcePath}: ${message}`);
79
+ sourceOnlySignals.push({
80
+ kind: "req",
81
+ title: `Author requirement: ${candidate.title}`,
82
+ sourcePath: candidate.sourcePath,
83
+ confidence: candidate.confidence,
84
+ evidence: candidate.evidence,
85
+ });
86
+ return false;
87
+ }
88
+ })
89
+ .sort((left, right) => lane(left) - lane(right) ||
90
+ right.confidence - left.confidence ||
91
+ left.sourcePath.localeCompare(right.sourcePath) ||
92
+ left.candidateId.localeCompare(right.candidateId));
93
+ const typedTitles = new Set(writable
94
+ .filter((candidate) => candidate.sourceKind === "typed_markdown")
95
+ .map(titleKey));
96
+ const selected = new Map();
97
+ for (const candidate of writable) {
61
98
  const key = titleKey(candidate);
62
99
  if (candidate.sourceKind === "generic_markdown" && typedTitles.has(key)) {
63
100
  suppress(candidate, "shadowed_by_typed_source");
64
- continue;
65
101
  }
66
- const previous = selected.get(key);
67
- if (!previous) {
68
- selected.set(key, candidate);
69
- continue;
102
+ else if (selected.has(key)) {
103
+ suppress(candidate, "duplicate_title");
70
104
  }
71
- const keepCandidate = candidate.confidence > previous.confidence ||
72
- (candidate.confidence === previous.confidence &&
73
- candidate.sourcePath < previous.sourcePath);
74
- suppress(keepCandidate ? previous : candidate, "duplicate_title");
75
- if (keepCandidate)
105
+ else
76
106
  selected.set(key, candidate);
77
107
  }
78
- return { candidates: [...selected.values()], suppressed };
108
+ const unique = [...selected.values()];
109
+ for (const candidate of unique.slice(maximum))
110
+ suppress(candidate, "over_limit");
111
+ return {
112
+ candidates: unique.slice(0, maximum),
113
+ suppressed,
114
+ sourceOnlySignals,
115
+ diagnostics,
116
+ };
79
117
  }
80
118
  async function existingEntityIds(context) {
81
119
  if (!context.prolog)
@@ -85,8 +123,8 @@ async function existingEntityIds(context) {
85
123
  // just to build this set exceeds the bounded engine output.
86
124
  return new Set((await loadEntityIds(context.prolog)).filter(Boolean));
87
125
  }
88
- catch {
89
- return new Set();
126
+ catch (error) {
127
+ throw new Error(`Bootstrap binding could not read existing entity IDs: ${error instanceof Error ? error.message : String(error)}`);
90
128
  }
91
129
  }
92
130
  async function expectedSnapshots(context, evidencePaths) {
@@ -164,15 +202,19 @@ async function expectedSnapshots(context, evidencePaths) {
164
202
  };
165
203
  }
166
204
  }
167
- // implements REQ-mcp-kibi-bootstrap-bootstrap-v1, REQ-kibi-operation-interface-parity
205
+ // implements REQ-KIBI-BOOTSTRAP-PLAN, REQ-kibi-operation-interface-parity
168
206
  // implements REQ-KIBI-BOOTSTRAP-PLAN
169
207
  export async function executePlanBootstrap(args, context) {
170
208
  const includeGenericMarkdown = args.includeGenericMarkdown ?? true;
171
209
  const minConfidence = clamp(args.minConfidence ?? 0.8, 0.6, 0.95);
172
210
  const maxCandidates = clamp(Math.trunc(args.maxCandidates ?? 50), 1, 200);
211
+ const entityBindingDiagnostics = [];
173
212
  const [discovery, existingIds] = await Promise.all([
174
213
  discoverBootstrap(context),
175
- existingEntityIds(context),
214
+ existingEntityIds(context).catch((error) => {
215
+ entityBindingDiagnostics.push(error.message);
216
+ return new Set();
217
+ }),
176
218
  ]);
177
219
  // Discovery runs before planning so its evidence paths can be bound into
178
220
  // the exact plan rather than leaving the reviewer to reconstruct them.
@@ -180,10 +222,25 @@ export async function executePlanBootstrap(args, context) {
180
222
  .map((evidence) => evidence.relativePath)
181
223
  .filter((value) => Boolean(value)));
182
224
  const built = discovery.activation.allowCandidateGeneration
183
- ? buildBootstrapCandidates(discovery.evidence, existingIds, minConfidence, includeGenericMarkdown)
184
- : { candidates: [], sourceOnlySignals: [] };
185
- const filteredSignals = filterSourceOnlySignals(built.sourceOnlySignals, args.entityTypes);
186
- const selected = selectBootstrapCandidates(built.candidates.filter((candidate) => candidate.confidence >= minConfidence), existingIds, args.entityTypes, maxCandidates);
225
+ ? buildBootstrapCandidates(discovery.evidence, new Set(), minConfidence, includeGenericMarkdown)
226
+ : {
227
+ candidates: [],
228
+ sourceOnlySignals: [],
229
+ suppressed: [],
230
+ diagnostics: [],
231
+ };
232
+ // Intent harvested from declared knowledge sources joins the repository
233
+ // evidence under the same activation policy, filters, and selection.
234
+ const claimed = discovery.activation.allowCandidateGeneration
235
+ ? buildIntentClaimCandidates(normalizeBootstrapContext(args.bootstrapContext), existingIds, minConfidence)
236
+ : {
237
+ candidates: [],
238
+ sourceOnlySignals: [],
239
+ suppressed: [],
240
+ diagnostics: [],
241
+ };
242
+ const filteredSignals = filterSourceOnlySignals([...built.sourceOnlySignals, ...claimed.sourceOnlySignals], args.entityTypes);
243
+ const selected = selectBootstrapCandidates([...built.candidates, ...claimed.candidates].filter((candidate) => candidate.confidence >= minConfidence), existingIds, args.entityTypes, maxCandidates);
187
244
  const ignored = discovery.ignoredSources.map((sourcePath) => ({
188
245
  candidateId: "",
189
246
  reason: "ignored_source",
@@ -200,9 +257,22 @@ export async function executePlanBootstrap(args, context) {
200
257
  ? { bootstrapContext: args.bootstrapContext }
201
258
  : {}),
202
259
  candidates: selected.candidates,
203
- sourceOnlySignals: filteredSignals,
204
- suppressedCandidates: [...selected.suppressed, ...ignored],
260
+ sourceOnlySignals: [
261
+ ...filteredSignals,
262
+ ...filterSourceOnlySignals(selected.sourceOnlySignals, args.entityTypes),
263
+ ],
264
+ suppressedCandidates: [
265
+ ...selected.suppressed,
266
+ ...claimed.suppressed,
267
+ ...built.suppressed,
268
+ ...ignored,
269
+ ],
205
270
  expected,
206
- bindingDiagnostics,
271
+ bindingDiagnostics: [...bindingDiagnostics, ...entityBindingDiagnostics],
272
+ contextDiagnostics: [
273
+ ...claimed.diagnostics,
274
+ ...built.diagnostics,
275
+ ...selected.diagnostics,
276
+ ],
207
277
  });
208
278
  }
@@ -1 +1 @@
1
- {"version":3,"file":"guidance-actions.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/guidance-actions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAgBpB,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,gBAAgB,EAC5B,QAAQ,EAAE,wBAAwB,EAClC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,EAAE,SAAS,gBAAgB,EAAE,GACnC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAuE9C"}
1
+ {"version":3,"file":"guidance-actions.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/guidance-actions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAkBpB,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,gBAAgB,EAC5B,QAAQ,EAAE,wBAAwB,EAClC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,EAAE,SAAS,gBAAgB,EAAE,GACnC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAuE9C"}
@@ -1,5 +1,8 @@
1
1
  import path from "node:path";
2
2
  function relative(root, target) {
3
+ // Intent claims cite tickets and URLs, which are not workspace paths.
4
+ if (!path.isAbsolute(target))
5
+ return target;
3
6
  const value = path.relative(root, target);
4
7
  return value.startsWith("..") || path.isAbsolute(value)
5
8
  ? target.split(path.sep).join("/")
@@ -1 +1 @@
1
- {"version":3,"file":"guidance.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/guidance.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAkFpB,wBAAgB,UAAU,CACxB,UAAU,EAAE,gBAAgB,EAC5B,QAAQ,EAAE,wBAAwB,EAClC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,WAAW,EAAE,MAAM,GAClB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAgEnC;AAGD,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,GAAG;IACF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACvD,QAAQ,CAAC,OAAO,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CAChE,CA0BA"}
1
+ {"version":3,"file":"guidance.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/guidance.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAwFpB,wBAAgB,UAAU,CACxB,UAAU,EAAE,gBAAgB,EAC5B,QAAQ,EAAE,wBAAwB,EAClC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,WAAW,EAAE,MAAM,GAClB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAiEnC;AAGD,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,GAAG;IACF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACvD,QAAQ,CAAC,OAAO,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CAChE,CA0BA"}
@@ -1,6 +1,9 @@
1
1
  import path from "node:path";
2
2
  import { buildActions } from "./guidance-actions.js";
3
3
  function relative(root, target) {
4
+ // Intent claims cite tickets and URLs, which are not workspace paths.
5
+ if (!path.isAbsolute(target))
6
+ return target;
4
7
  const value = path.relative(root, target);
5
8
  return value.startsWith("..") || path.isAbsolute(value)
6
9
  ? target.split(path.sep).join("/")
@@ -28,6 +31,8 @@ function prompt(root, activation, declared, candidates, signals, warnings) {
28
31
  bullets.push(`- Summary: ${declared.projectSummary}`);
29
32
  if (declared.sourceOfTruthPaths.length > 0)
30
33
  bullets.push(`- Source of truth: ${summary(declared.sourceOfTruthPaths)}.`);
34
+ if (declared.knowledgeSources)
35
+ bullets.push(`- Knowledge sources: ${summary(declared.knowledgeSources.map((source) => `${source.title} (${source.authority})`))}; ${declared.intentClaims?.length ?? 0} cited intent claim(s).`);
31
36
  if (candidates.length > 0) {
32
37
  const formatted = Object.entries(counts(candidates))
33
38
  .sort(([left], [right]) => left.localeCompare(right))
@@ -81,7 +86,8 @@ export function confidence(activation, declared, candidates, signals, promptBloc
81
86
  declared.sourceOfTruthPaths.length +
82
87
  declared.sourceOfTruthNotes.length +
83
88
  declared.priorityRoots.length +
84
- declared.verificationAnchors.length >
89
+ declared.verificationAnchors.length +
90
+ (declared.knowledgeSources?.length ?? 0) >
85
91
  0) {
86
92
  score += 0.08;
87
93
  reasons.push("Declared bootstrap context grounds the output.");
@@ -0,0 +1,17 @@
1
+ import type { BootstrapDeclaredContext, Candidate, SourceOnlySignal } from "./types.js";
2
+ export type IntentClaimBuildResult = {
3
+ readonly candidates: readonly Candidate[];
4
+ readonly sourceOnlySignals: readonly SourceOnlySignal[];
5
+ readonly suppressed: readonly Readonly<Record<string, unknown>>[];
6
+ readonly diagnostics: readonly string[];
7
+ };
8
+ /**
9
+ * Turn intent the agent harvested from declared knowledge sources into cited
10
+ * bootstrap candidates. Kibi never contacts those sources: it only records
11
+ * what the agent read, binds it into the plan hash through the declared
12
+ * context, and keeps the citation on every candidate it produces. A claim the
13
+ * strict modeler cannot ground stays an explicit authoring follow-up instead
14
+ * of becoming unverifiable knowledge.
15
+ */
16
+ export declare function buildIntentClaimCandidates(declared: BootstrapDeclaredContext, existingIds: ReadonlySet<string>, minConfidence: number): IntentClaimBuildResult;
17
+ //# sourceMappingURL=intent-claims.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent-claims.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/intent-claims.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,wBAAwB,EAGxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAQpB,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACxD,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAClE,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC,CAAC;AAcF;;;;;;;GAOG;AAEH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,wBAAwB,EAClC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,aAAa,EAAE,MAAM,GACpB,sBAAsB,CA2FxB"}
@@ -0,0 +1,103 @@
1
+ import { buildStrictWriteSet } from "../../utils/strict-modeling.js";
2
+ import { confidenceBand, strictPlan } from "./candidate-helpers.js";
3
+ import { claimFor } from "./requirement-claims.js";
4
+ /** How much a claim is trusted follows the authority the human assigned. */
5
+ const AUTHORITY_CONFIDENCE = {
6
+ authoritative: 0.9,
7
+ supporting: 0.82,
8
+ };
9
+ function citation(source, claim) {
10
+ return [
11
+ `intent_claim:${source.id}:${claim.reference}`,
12
+ `knowledge_source:${source.kind}:${source.locator}`,
13
+ `source_authority:${source.authority}`,
14
+ ...(source.connector ? [`connector:${source.connector}`] : []),
15
+ ];
16
+ }
17
+ /**
18
+ * Turn intent the agent harvested from declared knowledge sources into cited
19
+ * bootstrap candidates. Kibi never contacts those sources: it only records
20
+ * what the agent read, binds it into the plan hash through the declared
21
+ * context, and keeps the citation on every candidate it produces. A claim the
22
+ * strict modeler cannot ground stays an explicit authoring follow-up instead
23
+ * of becoming unverifiable knowledge.
24
+ */
25
+ // implements REQ-kibi-bootstrap-knowledge-sources
26
+ export function buildIntentClaimCandidates(declared, existingIds, minConfidence) {
27
+ const sources = new Map((declared.knowledgeSources ?? []).map((source) => [source.id, source]));
28
+ const candidates = [];
29
+ const sourceOnlySignals = [];
30
+ const suppressed = [];
31
+ const diagnostics = [];
32
+ for (const claim of declared.intentClaims ?? []) {
33
+ const source = sources.get(claim.sourceId);
34
+ if (!source) {
35
+ diagnostics.push(`Intent claim cites an undeclared knowledge source "${claim.sourceId}" (${claim.reference}); declare it in knowledgeSources or drop the claim.`);
36
+ continue;
37
+ }
38
+ if (source.authority === "stale") {
39
+ suppressed.push({
40
+ candidateId: "",
41
+ reason: "stale_knowledge_source",
42
+ sourcePath: claim.reference,
43
+ entityType: "req",
44
+ statement: claim.statement,
45
+ sourceId: source.id,
46
+ });
47
+ continue;
48
+ }
49
+ const confidence = AUTHORITY_CONFIDENCE[source.authority];
50
+ const evidence = citation(source, claim);
51
+ const provenance = `${source.id}:${claim.reference}`;
52
+ let writeSet = null;
53
+ try {
54
+ const modeled = claimFor(claim.statement, `knowledge-source:${source.id}`, confidence, provenance);
55
+ writeSet = modeled
56
+ ? buildStrictWriteSet({ claim: modeled, statement: claim.statement })
57
+ : null;
58
+ if (!modeled)
59
+ diagnostics.push(`Intent claim needs authoring at ${source.id}:${claim.reference}: ${claim.statement}`);
60
+ }
61
+ catch (error) {
62
+ diagnostics.push(`Intent claim extraction failed at ${source.id}:${claim.reference}: ${error instanceof Error ? error.message : String(error)}`);
63
+ }
64
+ if (writeSet?.isStrict &&
65
+ confidence >= minConfidence &&
66
+ !existingIds.has(writeSet.req.id)) {
67
+ candidates.push({
68
+ candidateId: `claim:${source.id}:${writeSet.req.id.toLowerCase()}`,
69
+ entityType: "req",
70
+ title: claim.statement,
71
+ sourceKind: "intent_claim",
72
+ sourcePath: claim.reference,
73
+ confidence,
74
+ confidenceBand: confidenceBand(confidence),
75
+ evidence,
76
+ relationships: writeSet.relationships.map(({ type, from, to }) => ({
77
+ type,
78
+ from,
79
+ to,
80
+ })),
81
+ applyPlan: strictPlan(writeSet),
82
+ });
83
+ continue;
84
+ }
85
+ if (writeSet?.isStrict && existingIds.has(writeSet.req.id)) {
86
+ suppressed.push({
87
+ candidateId: `claim:${source.id}:${writeSet.req.id.toLowerCase()}`,
88
+ reason: "entity_exists",
89
+ sourcePath: claim.reference,
90
+ entityType: "req",
91
+ });
92
+ continue;
93
+ }
94
+ sourceOnlySignals.push({
95
+ kind: "req",
96
+ title: `Author requirement from ${source.title} ${claim.reference}: ${claim.statement}`,
97
+ sourcePath: claim.reference,
98
+ confidence,
99
+ evidence,
100
+ });
101
+ }
102
+ return { candidates, sourceOnlySignals, suppressed, diagnostics };
103
+ }
@@ -2,6 +2,8 @@ import type { BootstrapEvidence, Candidate, SourceOnlySignal } from "./types.js"
2
2
  export type CandidateBuildResult = {
3
3
  readonly candidates: readonly Candidate[];
4
4
  readonly sourceOnlySignals: readonly SourceOnlySignal[];
5
+ readonly diagnostics: readonly string[];
6
+ readonly suppressed: readonly Readonly<Record<string, unknown>>[];
5
7
  };
6
8
  export declare function markdownCandidates(item: BootstrapEvidence, existingIds: ReadonlySet<string>, minConfidence: number): CandidateBuildResult;
7
9
  //# sourceMappingURL=markdown-candidates.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-candidates.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/markdown-candidates.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACzD,CAAC;AA4HF,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,iBAAiB,EACvB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,aAAa,EAAE,MAAM,GACpB,oBAAoB,CAoDtB"}
1
+ {"version":3,"file":"markdown-candidates.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/markdown-candidates.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACxD,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CACnE,CAAC;AA4HF,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,iBAAiB,EACvB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,aAAa,EAAE,MAAM,GACpB,oBAAoB,CAkFtB"}
@@ -1,7 +1,7 @@
1
1
  import path from "node:path";
2
2
  import { buildStrictWriteSet } from "../../utils/strict-modeling.js";
3
3
  import { confidenceBand, slug, strictPlan, upsert, } from "./candidate-helpers.js";
4
- import { claimFor } from "./requirement-claims.js";
4
+ import { claimFor, normalizeClaimStatement } from "./requirement-claims.js";
5
5
  function headingSignals(heading, sourcePath, textRef, minConfidence) {
6
6
  const result = [];
7
7
  for (const [kind, pattern, confidence] of [
@@ -74,7 +74,7 @@ function requirementCandidate(item, statement, line, heading, headingLine, exist
74
74
  if (!claim)
75
75
  return null;
76
76
  const writeSet = buildStrictWriteSet({ claim, statement });
77
- if (!writeSet.isStrict || existingIds.has(writeSet.req.id))
77
+ if (!writeSet.isStrict)
78
78
  return null;
79
79
  return {
80
80
  candidateId: `norm:${writeSet.req.id.toLowerCase()}`,
@@ -100,6 +100,7 @@ function requirementCandidate(item, statement, line, heading, headingLine, exist
100
100
  export function markdownCandidates(item, existingIds, minConfidence) {
101
101
  const candidates = [];
102
102
  const sourceOnlySignals = [];
103
+ const diagnostics = [];
103
104
  const relativePath = item.relativePath ?? item.label;
104
105
  let heading;
105
106
  let headingLine = 0;
@@ -121,15 +122,36 @@ export function markdownCandidates(item, existingIds, minConfidence) {
121
122
  sourceOnlySignals.push(...headingSignals(heading, item.absolutePath ?? relativePath, `${relativePath}#L${headingLine}`, minConfidence));
122
123
  continue;
123
124
  }
124
- const statement = line
125
- .replace(/^\s*[-*+]\s+/, "")
126
- .replace(/^\s*\d+[.)]\s+/, "")
127
- .trim();
125
+ const statement = normalizeClaimStatement(line);
128
126
  if (!statement || !/\b(must|shall|should)\b/i.test(statement))
129
127
  continue;
130
- const candidate = requirementCandidate(item, statement, index + 1, heading, headingLine, existingIds, minConfidence);
131
- if (candidate)
132
- candidates.push(candidate);
128
+ try {
129
+ const candidate = requirementCandidate(item, statement, index + 1, heading, headingLine, existingIds, minConfidence);
130
+ if (candidate) {
131
+ if (!candidate.applyPlan.some((payload) => payload.type === "req" && existingIds.has(String(payload.id))))
132
+ candidates.push(candidate);
133
+ }
134
+ else {
135
+ diagnostics.push(`Requirement needs authoring at ${relativePath}#L${index + 1}: ${statement}`);
136
+ sourceOnlySignals.push({
137
+ kind: "req",
138
+ title: `Author requirement: ${statement}`,
139
+ sourcePath: `${relativePath}#L${index + 1}`,
140
+ confidence: 0.8,
141
+ evidence: [`normative_statement:${relativePath}#L${index + 1}`],
142
+ });
143
+ }
144
+ }
145
+ catch (error) {
146
+ diagnostics.push(`Requirement extraction failed at ${relativePath}#L${index + 1}: ${error instanceof Error ? error.message : String(error)}`);
147
+ sourceOnlySignals.push({
148
+ kind: "req",
149
+ title: `Review requirement: ${statement}`,
150
+ sourcePath: `${relativePath}#L${index + 1}`,
151
+ confidence: 0.8,
152
+ evidence: [`normative_statement:${relativePath}#L${index + 1}`],
153
+ });
154
+ }
133
155
  }
134
- return { candidates, sourceOnlySignals };
156
+ return { candidates, sourceOnlySignals, diagnostics, suppressed: [] };
135
157
  }
@@ -11,5 +11,7 @@ export declare function presentBootstrap(input: {
11
11
  readonly suppressedCandidates: readonly Readonly<Record<string, unknown>>[];
12
12
  readonly expected: BootstrapPlanV1["expected"];
13
13
  readonly bindingDiagnostics?: readonly string[];
14
+ /** Advisory findings about declared context; they never block apply. */
15
+ readonly contextDiagnostics?: readonly string[];
14
16
  }): PlanBootstrapResult;
15
17
  //# sourceMappingURL=presentation.d.ts.map