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
@@ -7,6 +7,7 @@ export const DEFAULT_TELEMETRY_ACCEPTANCE_POLICY = {
7
7
  telemetryCompletenessMinimum: 0.95,
8
8
  validationBeforeUpsertMinimum: 1,
9
9
  advisorBeforeRequirementWriteMinimum: 1,
10
+ lookupBeforeFirstEditMinimum: 1,
10
11
  sourceLookupZeroResultMaximum: 0.2,
11
12
  preflightMaxAgeSeconds: 60 * 60,
12
13
  advisorMaxAgeSeconds: 24 * 60 * 60,
@@ -15,8 +16,26 @@ export const DEFAULT_TELEMETRY_ACCEPTANCE_POLICY = {
15
16
  function isRecord(value) {
16
17
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
17
18
  }
19
+ /**
20
+ * Hook rows and line numbers of every array `parseTelemetryUsageLog`
21
+ * returned. The array itself keeps its operation-only shape, so callers that
22
+ * pass it straight to the analyzers need no change.
23
+ */
24
+ const parsedUsageLogs = new WeakMap();
25
+ /**
26
+ * Parse Kibi operation events from `.kb/usage.log`.
27
+ *
28
+ * Host plugin hooks share the log and tag their rows `interface: "hook"`.
29
+ * Those rows describe agent activity around Kibi calls, not Kibi operations,
30
+ * so they are left out of the returned array: otherwise a busy editing
31
+ * session would push every operation out of the bounded acceptance window.
32
+ * They stay attached to the array for `partitionTelemetryUsage`, which is how
33
+ * the `lookup_before_first_edit` metric reads them.
34
+ */
18
35
  export function parseTelemetryUsageLog(contents) {
19
36
  const events = [];
37
+ const operationLines = [];
38
+ const hookRows = [];
20
39
  for (const [index, line] of contents.split(/\r?\n/).entries()) {
21
40
  const trimmed = line.trim();
22
41
  if (!trimmed)
@@ -32,10 +51,48 @@ export function parseTelemetryUsageLog(contents) {
32
51
  if (!isRecord(parsed)) {
33
52
  throw new Error(`Failed to parse .kb/usage.log line ${index + 1}: expected object`);
34
53
  }
54
+ if (parsed.interface === "hook") {
55
+ hookRows.push({
56
+ event: parsed,
57
+ logLine: index + 1,
58
+ operationsBefore: events.length,
59
+ });
60
+ continue;
61
+ }
35
62
  events.push(parsed);
63
+ operationLines.push(index + 1);
36
64
  }
65
+ parsedUsageLogs.set(events, { operationLines, hookRows });
37
66
  return events;
38
67
  }
68
+ // implements REQ-kibi-telemetry-acceptance-gate-v2, REQ-claude-hook-usage-telemetry-v2
69
+ /**
70
+ * Split events into Kibi operations and host hook rows. Arrays from
71
+ * `parseTelemetryUsageLog` carry their hook rows and log lines; any other
72
+ * array is split on `interface: "hook"`, with positions as line numbers.
73
+ */
74
+ export function partitionTelemetryUsage(events) {
75
+ const parsed = parsedUsageLogs.get(events);
76
+ if (parsed !== undefined)
77
+ return { operations: events, ...parsed };
78
+ const operations = [];
79
+ const operationLines = [];
80
+ const hookRows = [];
81
+ for (const [index, event] of events.entries()) {
82
+ if (event.interface === "hook") {
83
+ hookRows.push({
84
+ event: event,
85
+ logLine: index + 1,
86
+ operationsBefore: operations.length,
87
+ });
88
+ }
89
+ else {
90
+ operations.push(event);
91
+ operationLines.push(index + 1);
92
+ }
93
+ }
94
+ return { operations, operationLines, hookRows };
95
+ }
39
96
  function eventArgs(event) {
40
97
  return event.business_args ?? event.args ?? {};
41
98
  }
@@ -251,6 +308,77 @@ function advisorBeforeRequirementWriteMetric(all, recentStart, policy) {
251
308
  },
252
309
  };
253
310
  }
311
+ // implements REQ-kibi-telemetry-acceptance-gate-v2
312
+ /** Kibi operations that count as looking up requirements before an edit. */
313
+ export const LOOKUP_BEFORE_EDIT_OPERATIONS = ["kb_query", "kb_search"];
314
+ function hookSession(event) {
315
+ const sessionId = event.session_id;
316
+ if (typeof sessionId !== "string" || sessionId.length === 0)
317
+ return undefined;
318
+ return `${event.host ?? "unknown"}:${sessionId}`;
319
+ }
320
+ // implements REQ-kibi-telemetry-acceptance-gate-v2, REQ-claude-hook-usage-telemetry-v2
321
+ /**
322
+ * For each host session, its first edit of a file whose symbols implement a
323
+ * requirement and whether a Kibi lookup (MCP or CLI) preceded it. Rows
324
+ * without a session id cannot be ordered within a session and are skipped;
325
+ * sessions whose first linked edit predates the evaluated window are left
326
+ * out.
327
+ */
328
+ export function firstLinkedEdits(hookRows, recentStart) {
329
+ const lookedUp = new Set();
330
+ const edited = new Set();
331
+ const firstEdits = [];
332
+ for (const row of hookRows) {
333
+ const session = hookSession(row.event);
334
+ if (session === undefined)
335
+ continue;
336
+ const { hook_action: action, kb_operation: operation } = row.event;
337
+ if (action === "kb_usage" &&
338
+ LOOKUP_BEFORE_EDIT_OPERATIONS.some((candidate) => candidate === operation)) {
339
+ lookedUp.add(session);
340
+ continue;
341
+ }
342
+ if (action !== "edited" ||
343
+ edited.has(session) ||
344
+ !Array.isArray(row.event.requirement_ids) ||
345
+ row.event.requirement_ids.length === 0) {
346
+ continue;
347
+ }
348
+ edited.add(session);
349
+ if (row.operationsBefore < recentStart)
350
+ continue;
351
+ firstEdits.push({ session, edit: row, lookedUp: lookedUp.has(session) });
352
+ }
353
+ return firstEdits;
354
+ }
355
+ function lookupBeforeFirstEditMetric(hookRows, recentStart, policy) {
356
+ const firstEdits = firstLinkedEdits(hookRows, recentStart);
357
+ const attempts = firstEdits.length;
358
+ const guided = firstEdits.filter((entry) => entry.lookedUp).length;
359
+ const unguidedEditPaths = new Set(firstEdits
360
+ .filter((entry) => !entry.lookedUp)
361
+ .map((entry) => entry.edit.event.path ?? "unknown path"));
362
+ const actual = rate(guided, attempts);
363
+ return {
364
+ id: "lookup_before_first_edit",
365
+ status: thresholdStatus(actual, ">=", policy.lookupBeforeFirstEditMinimum),
366
+ numerator: guided,
367
+ denominator: attempts,
368
+ ...(actual !== undefined ? { rate: actual } : {}),
369
+ threshold: {
370
+ operator: ">=",
371
+ value: policy.lookupBeforeFirstEditMinimum,
372
+ },
373
+ message: attempts === 0
374
+ ? "No host hook recorded an edit of a requirement-linked file in the evaluated window."
375
+ : `${guided}/${attempts} sessions ran kb_search or kb_query before their first edit of a requirement-linked file.`,
376
+ evidence: {
377
+ unguidedEditPaths: [...unguidedEditPaths].sort().slice(0, 20),
378
+ lookupOperations: [...LOOKUP_BEFORE_EDIT_OPERATIONS],
379
+ },
380
+ };
381
+ }
254
382
  function sourceLookupMessage(zeroResults, lookups, unobservable) {
255
383
  const unreadable = unobservable > 0
256
384
  ? `${unobservable} source-linked lookups recorded no readable result count.`
@@ -452,7 +580,8 @@ function reportStatus(metrics, fresh) {
452
580
  return "passed";
453
581
  }
454
582
  export function analyzeTelemetryAcceptance(events, now = new Date(), policy = DEFAULT_TELEMETRY_ACCEPTANCE_POLICY) {
455
- const all = events.map((event, index) => ({
583
+ const { operations, hookRows } = partitionTelemetryUsage(events);
584
+ const all = operations.map((event, index) => ({
456
585
  event,
457
586
  index,
458
587
  time: timestampMillis(event.timestamp),
@@ -473,15 +602,16 @@ export function analyzeTelemetryAcceptance(events, now = new Date(), policy = DE
473
602
  telemetryCompletenessMetric(recent, policy),
474
603
  advisorBeforeRequirementWriteMetric(all, recentStart, policy),
475
604
  validationBeforeUpsertMetric(all, recentStart, policy),
605
+ lookupBeforeFirstEditMetric(hookRows, recentStart, policy),
476
606
  sourceLookupMetric(recent, policy),
477
607
  proofGapRecoveryMetric(recent),
478
608
  receiptFreshnessMetric(recent),
479
609
  repeatedMutationFailuresMetric(recent, policy),
480
610
  ];
481
611
  const diagnostics = [];
482
- if (events.length === 0)
612
+ if (operations.length === 0)
483
613
  diagnostics.push("usage_log_empty");
484
- if (lastTime === null && events.length > 0) {
614
+ if (lastTime === null && operations.length > 0) {
485
615
  diagnostics.push("usage_log_timestamps_unavailable");
486
616
  }
487
617
  else if (!fresh) {
@@ -495,9 +625,9 @@ export function analyzeTelemetryAcceptance(events, now = new Date(), policy = DE
495
625
  evaluatedAt: now.toISOString(),
496
626
  policy,
497
627
  scope: {
498
- totalEvents: events.length,
628
+ totalEvents: operations.length,
499
629
  evaluatedEvents: recent.length,
500
- truncated: events.length > recent.length,
630
+ truncated: operations.length > recent.length,
501
631
  firstTimestamp: firstTime === null ? null : new Date(firstTime).toISOString(),
502
632
  lastTimestamp: lastTime === null ? null : new Date(lastTime).toISOString(),
503
633
  evidenceAgeSeconds: ageSeconds,
@@ -518,13 +648,19 @@ const METRIC_DIAGNOSTICS = {
518
648
  id: "semantic_advisor_bypassed",
519
649
  severity: "warning",
520
650
  rank: 30,
521
- suggestion: "Run kb_semantic_advisor on the complete current requirement prose before its next upsert, preserve the returned source hash, and recheck telemetry.",
651
+ suggestion: "Run kb_model with mode analyze (CLI: semantic-advisor) on the complete current requirement prose before its next upsert, preserve the returned source hash, and recheck telemetry.",
522
652
  },
523
653
  validation_before_upsert: {
524
654
  id: "mutation_validation_bypassed",
525
655
  severity: "warning",
526
656
  rank: 20,
527
- suggestion: "Run kb_validate_upsert for the exact payload no more than one hour before each sequential kb_upsert attempt.",
657
+ suggestion: "Run kb_upsert with dryRun true (CLI: validate-upsert) for the exact payload no more than one hour before each sequential kb_upsert attempt.",
658
+ },
659
+ lookup_before_first_edit: {
660
+ id: "lookup_before_first_edit_bypassed",
661
+ severity: "warning",
662
+ rank: 35,
663
+ suggestion: "Before a session's first edit of a requirement-linked file, run kb_search for the change (or kb_query with sourceFile for the file) and read the requirements it names; host hook rows in diagnostic mode record the order.",
528
664
  },
529
665
  source_lookup_zero_result_rate: {
530
666
  id: "source_lookup_zero_result_rate_high",
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry-remediation.d.ts","sourceRoot":"","sources":["../../src/public/telemetry-remediation.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAEzB,MAAM,2BAA2B,CAAC;AAEnC,eAAO,MAAM,6BAA6B,EACxC,+BAAwC,CAAC;AAE3C,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,iBAAiB,GAAG,oBAAoB,CAAC;IAC1D,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG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
2
+ import { DEFAULT_TELEMETRY_ACCEPTANCE_POLICY, analyzeTelemetryAcceptance, firstLinkedEdits, partitionTelemetryUsage, } from "./telemetry-acceptance.js";
3
3
  export const TELEMETRY_REMEDIATION_VERSION = "kibi.telemetry-remediation.v1";
4
4
  const RANKS = {
5
5
  repeated_mutation_failures: 10,
6
6
  validation_before_upsert: 20,
7
7
  advisor_before_requirement_write: 30,
8
+ lookup_before_first_edit: 35,
8
9
  e2e_receipt_freshness: 40,
9
10
  proof_gap_recovery: 50,
10
11
  source_lookup_zero_result_rate: 60,
@@ -66,7 +67,7 @@ function target(event) {
66
67
  }
67
68
  function reference(entry) {
68
69
  return {
69
- logLine: entry.index + 1,
70
+ logLine: entry.logLine,
70
71
  requestId: entry.event.request_id ?? null,
71
72
  timestamp: entry.event.timestamp ?? null,
72
73
  tool: entry.event.tool ?? null,
@@ -76,7 +77,7 @@ function reference(entry) {
76
77
  }
77
78
  function eventItem(metric, entry, itemTarget, reason, action) {
78
79
  return {
79
- id: `${metric}:line-${entry.index + 1}:${itemTarget}`,
80
+ id: `${metric}:line-${entry.logLine}:${itemTarget}`,
80
81
  rank: RANKS[metric],
81
82
  metric,
82
83
  scope: "event",
@@ -104,13 +105,16 @@ function isActionable(acceptance, metric) {
104
105
  }
105
106
  export function buildTelemetryRemediationReport(events, now = new Date(), policy = DEFAULT_TELEMETRY_ACCEPTANCE_POLICY) {
106
107
  const acceptance = analyzeTelemetryAcceptance(events, now, policy);
107
- const all = events.map((event, index) => ({
108
+ const { operations, operationLines, hookRows } = partitionTelemetryUsage(events);
109
+ const timeOf = (event) => event.timestamp === undefined ||
110
+ !Number.isFinite(Date.parse(event.timestamp))
111
+ ? null
112
+ : Date.parse(event.timestamp);
113
+ const all = operations.map((event, index) => ({
108
114
  event,
109
115
  index,
110
- time: event.timestamp === undefined ||
111
- !Number.isFinite(Date.parse(event.timestamp))
112
- ? null
113
- : Date.parse(event.timestamp),
116
+ logLine: operationLines[index] ?? index + 1,
117
+ time: timeOf(event),
114
118
  }));
115
119
  const recentStart = Math.max(0, all.length - policy.eventLimit);
116
120
  const recent = all.slice(recentStart);
@@ -142,7 +146,7 @@ export function buildTelemetryRemediationReport(events, now = new Date(), policy
142
146
  const match = (preflights.get(fingerprint(entry.event)) ?? []).findLast((candidate) => compatible(candidate.event, entry.event) &&
143
147
  withinAge(candidate.time, entry.time, policy.preflightMaxAgeSeconds));
144
148
  if (match === undefined) {
145
- items.push(eventItem("validation_before_upsert", entry, target(entry.event), "No recent successful preflight matches this exact payload and correlation context.", "Run kb_validate_upsert for this exact payload in the same session/actor context before retrying once."));
149
+ items.push(eventItem("validation_before_upsert", entry, target(entry.event), "No recent successful preflight matches this exact payload and correlation context.", "Run kb_upsert with dryRun true (CLI: validate-upsert) for this exact payload in the same session/actor context before retrying once."));
146
150
  }
147
151
  }
148
152
  }
@@ -176,10 +180,22 @@ export function buildTelemetryRemediationReport(events, now = new Date(), policy
176
180
  entry.event.semantic_source_hash) &&
177
181
  withinAge(candidate.time, entry.time, policy.advisorMaxAgeSeconds));
178
182
  if (match === undefined) {
179
- items.push(eventItem("advisor_before_requirement_write", entry, requirementId, "No recent semantic-advisor event matches this requirement, source hash, and correlation context.", "Run kb_semantic_advisor on the complete prose in the same session/actor context before the next upsert."));
183
+ items.push(eventItem("advisor_before_requirement_write", entry, requirementId, "No recent semantic-advisor event matches this requirement, source hash, and correlation context.", "Run kb_model with mode analyze (CLI: semantic-advisor) on the complete prose in the same session/actor context before the next upsert."));
180
184
  }
181
185
  }
182
186
  }
187
+ if (isActionable(acceptance, "lookup_before_first_edit")) {
188
+ for (const { edit, lookedUp } of firstLinkedEdits(hookRows, recentStart)) {
189
+ if (lookedUp)
190
+ continue;
191
+ items.push(eventItem("lookup_before_first_edit", {
192
+ event: edit.event,
193
+ index: edit.operationsBefore,
194
+ logLine: edit.logLine,
195
+ time: timeOf(edit.event),
196
+ }, edit.event.path ?? "unknown path", "This session edited a requirement-linked file before any kb_search or kb_query.", "Before the next edit of this file, run kb_search for the change or kb_query with this sourceFile, and read the requirements it names."));
197
+ }
198
+ }
183
199
  if (isActionable(acceptance, "source_lookup_zero_result_rate")) {
184
200
  for (const entry of recent) {
185
201
  const sourceFile = args(entry.event).sourceFile;
@@ -30,6 +30,11 @@ export declare function computeShardPath(kbRoot: string, entityId: string): stri
30
30
  * Throws on parse errors.
31
31
  */
32
32
  export declare function readShard(shardPath: string): RelationshipRecord[];
33
+ /**
34
+ * Parses relationship shard text read from `shardPath`.
35
+ * Returns an empty array for blank text. Throws on parse errors.
36
+ */
37
+ export declare function parseShardText(content: string, shardPath: string): RelationshipRecord[];
33
38
  /**
34
39
  * Writes a relationship shard file.
35
40
  * Creates parent directories if needed.
@@ -65,6 +70,14 @@ export declare function appendRelationship(kbRoot: string, relationship: Omit<Re
65
70
  shardPath: string;
66
71
  recordId: string;
67
72
  };
73
+ /**
74
+ * The shard text appendRelationship would publish for `relationship`, without
75
+ * writing it: `existing` is the current shard text, or null when the shard
76
+ * file does not exist. Returns null when the shard already records the
77
+ * relationship. Callers that must journal exact after-bytes before any write
78
+ * (atomic plan application) render a shard through this function.
79
+ */
80
+ export declare function renderShardWithRelationship(shardPath: string, existing: string | null, relationship: Omit<RelationshipRecord, "id">): string | null;
68
81
  /**
69
82
  * Lists all shard files in the relationships directory.
70
83
  */
@@ -1 +1 @@
1
- {"version":3,"file":"shards.d.ts","sourceRoot":"","sources":["../../src/relationships/shards.ts"],"names":[],"mappings":"AAwBA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,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,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAC3C,MAAM,GAAG,IAAI,CA8Bf;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAUnD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAUlE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,kBAAkB,EAAE,EAC7B,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,GAC1B,kBAAkB,EAAE,CAKtB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,MAAM,CAMR;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAE1B,QAAQ,EAAE,kBAAkB,EAAE,EAC9B,QAAQ,EAAE,kBAAkB,EAAE,GAC7B,kBAAkB,EAAE,CAgCtB"}
@@ -51,7 +51,14 @@ export function readShard(shardPath) {
51
51
  if (!fs.existsSync(shardPath)) {
52
52
  return [];
53
53
  }
54
- const content = fs.readFileSync(shardPath, "utf8");
54
+ return parseShardText(fs.readFileSync(shardPath, "utf8"), shardPath);
55
+ }
56
+ /**
57
+ * Parses relationship shard text read from `shardPath`.
58
+ * Returns an empty array for blank text. Throws on parse errors.
59
+ */
60
+ // implements REQ-kibi-operation-interface-parity
61
+ export function parseShardText(content, shardPath) {
55
62
  if (!content.trim()) {
56
63
  return [];
57
64
  }
@@ -121,7 +128,10 @@ export function writeShard(shardPath, records) {
121
128
  if (!fs.existsSync(dir)) {
122
129
  fs.mkdirSync(dir, { recursive: true });
123
130
  }
124
- // Sort and dedupe records
131
+ atomicWriteText(shardPath, renderShardRecords(records));
132
+ }
133
+ /** Canonical shard text for `records`: sorted and deduplicated. */
134
+ function renderShardRecords(records) {
125
135
  const sorted = sortRecords(records);
126
136
  const seen = new Set();
127
137
  const unique = [];
@@ -132,8 +142,7 @@ export function writeShard(shardPath, records) {
132
142
  seen.add(key);
133
143
  unique.push(record);
134
144
  }
135
- const yamlContent = serializeToYAML(unique);
136
- atomicWriteText(shardPath, yamlContent);
145
+ return serializeToYAML(unique);
137
146
  }
138
147
  /**
139
148
  * Publish one canonical shard replacement atomically. Relationship shards are
@@ -254,32 +263,49 @@ function sortRecords(records) {
254
263
  */
255
264
  export function appendRelationship(kbRoot, relationship) {
256
265
  const shardPath = computeShardPath(kbRoot, relationship.from);
257
- const existing = readShard(shardPath);
258
- // Generate deterministic ID
259
- const recordId = relationshipIdFor(relationship.type, relationship.from, relationship.to);
260
- // Check if relationship already exists
261
- const exists = existing.some((r) => r.type === relationship.type &&
262
- r.from === relationship.from &&
263
- r.to === relationship.to);
264
- if (!exists) {
265
- const newRecord = {
266
- ...relationship,
267
- id: recordId,
268
- };
269
- if (fs.existsSync(shardPath)) {
270
- const document = parseDocument(fs.readFileSync(shardPath, "utf8"));
271
- const sequence = document.get("relationships", true);
272
- if (!sequence || typeof sequence !== "object" || !("items" in sequence)) {
273
- throw new Error(`Invalid shard file: missing 'relationships' array at ${shardPath}`);
274
- }
275
- sequence.items.push(newRecord);
276
- atomicWriteText(shardPath, document.toString());
277
- }
278
- else {
279
- writeShard(shardPath, [newRecord]);
266
+ const existing = fs.existsSync(shardPath)
267
+ ? fs.readFileSync(shardPath, "utf8")
268
+ : null;
269
+ const next = renderShardWithRelationship(shardPath, existing, relationship);
270
+ if (next !== null) {
271
+ if (existing === null) {
272
+ fs.mkdirSync(path.dirname(shardPath), { recursive: true });
280
273
  }
274
+ atomicWriteText(shardPath, next);
281
275
  }
282
- return { shardPath, recordId };
276
+ return {
277
+ shardPath,
278
+ recordId: relationshipIdFor(relationship.type, relationship.from, relationship.to),
279
+ };
280
+ }
281
+ /**
282
+ * The shard text appendRelationship would publish for `relationship`, without
283
+ * writing it: `existing` is the current shard text, or null when the shard
284
+ * file does not exist. Returns null when the shard already records the
285
+ * relationship. Callers that must journal exact after-bytes before any write
286
+ * (atomic plan application) render a shard through this function.
287
+ */
288
+ // implements REQ-kibi-operation-interface-parity, REQ-core-atomic-upsert-persistence
289
+ export function renderShardWithRelationship(shardPath, existing, relationship) {
290
+ const records = existing === null ? [] : parseShardText(existing, shardPath);
291
+ if (records.some((r) => r.type === relationship.type &&
292
+ r.from === relationship.from &&
293
+ r.to === relationship.to)) {
294
+ return null;
295
+ }
296
+ const newRecord = {
297
+ ...relationship,
298
+ id: relationshipIdFor(relationship.type, relationship.from, relationship.to),
299
+ };
300
+ if (existing === null)
301
+ return renderShardRecords([newRecord]);
302
+ const document = parseDocument(existing);
303
+ const sequence = document.get("relationships", true);
304
+ if (!sequence || typeof sequence !== "object" || !("items" in sequence)) {
305
+ throw new Error(`Invalid shard file: missing 'relationships' array at ${shardPath}`);
306
+ }
307
+ sequence.items.push(newRecord);
308
+ return document.toString();
283
309
  }
284
310
  /**
285
311
  * Lists all shard files in the relationships directory.
@@ -1 +1 @@
1
- {"version":3,"file":"cli-runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/cli-runtime.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAKV,gBAAgB,EAEhB,cAAc,EACf,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,KAAK,qBAAqB,EAE3B,MAAM,6BAA6B,CAAC;AAErC,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,qBAAqB,GAChC,MAAM,CAOR;AAkFD,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,cAAmB,GAC3B,gBAAgB,CAwHlB"}
1
+ {"version":3,"file":"cli-runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/cli-runtime.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAKV,gBAAgB,EAEhB,cAAc,EACf,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAEL,KAAK,qBAAqB,EAE3B,MAAM,6BAA6B,CAAC;AAOrC,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,qBAAqB,GAChC,MAAM,CAOR;AA2GD,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,cAAmB,GAC3B,gBAAgB,CA4IlB"}
@@ -3,7 +3,8 @@ import { retryAttachAfterBreakingStaleLock } from "../prolog/store-lock.js";
3
3
  import { EngineClient } from "../engine.js";
4
4
  import { CapabilityRegistryCache, ensureCapabilityRegistry, } from "../plugins/registry.js";
5
5
  import { nodeFilesystem, nodeGit, nodeNetwork, } from "../public/operations/node-ports.js";
6
- import { resolveBranchAttachment, } from "../utils/branch-resolver.js";
6
+ import { resolveReadBranchAttachment, } from "../utils/branch-resolver.js";
7
+ import { declaresWriteEffect, refreshDetachedSnapshot, resolveOperationAttachment, } from "./detached-snapshot.js";
7
8
  export function attachmentFailureMessage(attachment) {
8
9
  const isNonGitContext = attachment.code === "NOT_A_GIT_REPO" ||
9
10
  attachment.code === "GIT_NOT_AVAILABLE";
@@ -65,6 +66,27 @@ function resolvePluginsOption(plugins) {
65
66
  return plugins;
66
67
  return async () => plugins;
67
68
  }
69
+ /**
70
+ * The detached-HEAD snapshot attachment for a KB read that may run without
71
+ * Prolog (status), or undefined when the checkout resolves normally (that
72
+ * path keeps its lazy, non-mutating behavior). A failed snapshot compile is
73
+ * reported but not fatal, so status can still diagnose the snapshot store.
74
+ */
75
+ // implements REQ-branch-store-recovery-v4
76
+ async function resolveDetachedReadAttachment(root) {
77
+ const attachment = resolveReadBranchAttachment(root);
78
+ if ("error" in attachment || attachment.readOnly === undefined) {
79
+ return undefined;
80
+ }
81
+ console.warn(`[KIBI] ${attachment.readOnly.notice}`);
82
+ try {
83
+ await refreshDetachedSnapshot(root, attachment);
84
+ }
85
+ catch (error) {
86
+ console.warn(`[KIBI] ${error instanceof Error ? error.message : String(error)}`);
87
+ }
88
+ return attachment;
89
+ }
68
90
  // implements REQ-kibi-operation-interface-parity
69
91
  export function createCliRuntime(options = {}) {
70
92
  const ownedPrologs = new WeakMap();
@@ -102,10 +124,16 @@ export function createCliRuntime(options = {}) {
102
124
  // That keeps pre-init and damaged-store diagnostics non-mutating.
103
125
  let lazyProlog = merged.prolog;
104
126
  const lazyContext = {};
127
+ // A KB read on a detached HEAD answers from the checkout's snapshot;
128
+ // resolve it up front so the operation reports which store it read.
129
+ const detachedAttachment = !declaresWriteEffect(spec.effects) && spec.effects.includes("kb-read")
130
+ ? await resolveDetachedReadAttachment(root)
131
+ : undefined;
105
132
  const ensureProlog = async () => {
106
133
  if (lazyProlog !== undefined)
107
134
  return bindSignal(lazyProlog, signal);
108
- const attachment = resolveBranchAttachment(root);
135
+ const attachment = detachedAttachment ??
136
+ (await resolveOperationAttachment(root, spec));
109
137
  if ("error" in attachment) {
110
138
  throw new Error(`Failed to resolve active branch: ${attachment.error}`);
111
139
  }
@@ -125,16 +153,29 @@ export function createCliRuntime(options = {}) {
125
153
  ? { prolog: bindSignal(merged.prolog, signal) }
126
154
  : {}),
127
155
  ...(lazyEngine ? { engine: lazyEngine } : {}),
156
+ ...(detachedAttachment
157
+ ? { branchAttachment: detachedAttachment }
158
+ : {}),
128
159
  ensureProlog,
129
160
  };
130
161
  lazyContext.current = context;
131
162
  return context;
132
163
  }
133
- const attachment = resolveBranchAttachment(root);
164
+ let attachment;
165
+ try {
166
+ attachment = await resolveOperationAttachment(root, spec);
167
+ }
168
+ catch (error) {
169
+ await merged.prolog?.terminate?.();
170
+ throw error;
171
+ }
134
172
  if ("error" in attachment) {
135
173
  await merged.prolog?.terminate?.();
136
174
  throw new Error(attachmentFailureMessage(attachment));
137
175
  }
176
+ if (attachment.readOnly !== undefined) {
177
+ console.warn(`[KIBI] ${attachment.readOnly.notice}`);
178
+ }
138
179
  if (attachment.migrationRequired) {
139
180
  console.warn(`[KIBI] Legacy branch attachment: Git '${attachment.gitBranch}' is reading KB '${attachment.kbBranch}'. Migrate with 'kibi branch migrate --from ${attachment.kbBranch} --to ${attachment.gitBranch} --apply'; writes are blocked until then.`);
140
181
  }
@@ -0,0 +1,38 @@
1
+ import type { OperationEffect } from "../public/operations/types.js";
2
+ import { type BranchAttachment, type BranchResolutionError } from "../utils/branch-resolver.js";
3
+ /** Envelope diagnostic code reported while a detached snapshot is attached. */
4
+ export declare const DETACHED_HEAD_READ_ONLY_CODE = "detached_head_read_only";
5
+ export type DetachedReadOnlyDiagnostic = {
6
+ readonly code: typeof DETACHED_HEAD_READ_ONLY_CODE;
7
+ readonly severity: "warning";
8
+ readonly message: string;
9
+ readonly detail: {
10
+ readonly head: string;
11
+ readonly branchesAtHead: readonly string[];
12
+ readonly kbBranch: string;
13
+ readonly storePath: string;
14
+ readonly writes: "refused";
15
+ };
16
+ };
17
+ /** True when an operation declares a KB or workspace write. */
18
+ export declare function declaresWriteEffect(effects: readonly OperationEffect[] | readonly string[]): boolean;
19
+ /**
20
+ * Compile (or incrementally refresh) the read-only snapshot of a detached
21
+ * checkout. The snapshot store is a cache of the checkout's tracked sources:
22
+ * refreshing it never touches a branch KB or an authored file.
23
+ */
24
+ export declare function refreshDetachedSnapshot(workspaceRoot: string, attachment: BranchAttachment): Promise<void>;
25
+ /**
26
+ * Resolve the branch attachment an operation may use.
27
+ *
28
+ * Writes keep the exact-branch contract and receive an actionable refusal on
29
+ * a detached HEAD. Reads on a detached HEAD that no single branch points at
30
+ * attach a freshly compiled read-only snapshot of the checkout.
31
+ */
32
+ export declare function resolveOperationAttachment(workspaceRoot: string, spec: {
33
+ readonly name: string;
34
+ readonly effects: readonly OperationEffect[];
35
+ }): Promise<BranchAttachment | BranchResolutionError>;
36
+ /** The envelope diagnostic for an operation answered from a snapshot. */
37
+ export declare function detachedReadOnlyDiagnostic(attachment: BranchAttachment | undefined): DetachedReadOnlyDiagnostic | undefined;
38
+ //# sourceMappingURL=detached-snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detached-snapshot.d.ts","sourceRoot":"","sources":["../../src/runtime/detached-snapshot.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACr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