kibi-cli 2.1.0 → 2.3.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 (398) hide show
  1. package/dist/cli-operation-loader.d.ts.map +1 -1
  2. package/dist/cli-operation-loader.js +3 -0
  3. package/dist/cli-operation-metadata.d.ts +4 -0
  4. package/dist/cli-operation-metadata.d.ts.map +1 -1
  5. package/dist/cli-operation-metadata.js +5 -0
  6. package/dist/cli-protocol.d.ts.map +1 -1
  7. package/dist/cli-protocol.js +3 -2
  8. package/dist/cli-register-reporting.d.ts.map +1 -1
  9. package/dist/cli-register-reporting.js +4 -0
  10. package/dist/commands/aggregated-checks.d.ts +7 -0
  11. package/dist/commands/aggregated-checks.d.ts.map +1 -1
  12. package/dist/commands/aggregated-checks.js +25 -1
  13. package/dist/commands/check-diff.d.ts +5 -0
  14. package/dist/commands/check-diff.d.ts.map +1 -0
  15. package/dist/commands/check-diff.js +62 -0
  16. package/dist/commands/check-generated.d.ts.map +1 -1
  17. package/dist/commands/check-generated.js +41 -18
  18. package/dist/commands/check.d.ts.map +1 -1
  19. package/dist/commands/check.js +231 -86
  20. package/dist/commands/doctor.d.ts.map +1 -1
  21. package/dist/commands/doctor.js +168 -53
  22. package/dist/commands/github-init.d.ts +1 -1
  23. package/dist/commands/github-init.d.ts.map +1 -1
  24. package/dist/commands/github-init.js +10 -3
  25. package/dist/commands/init-helpers.d.ts +17 -2
  26. package/dist/commands/init-helpers.d.ts.map +1 -1
  27. package/dist/commands/init-helpers.js +123 -23
  28. package/dist/commands/init.d.ts.map +1 -1
  29. package/dist/commands/init.js +110 -15
  30. package/dist/commands/prove.d.ts.map +1 -1
  31. package/dist/commands/prove.js +10 -18
  32. package/dist/commands/sync/cache.d.ts +20 -1
  33. package/dist/commands/sync/cache.d.ts.map +1 -1
  34. package/dist/commands/sync/cache.js +51 -2
  35. package/dist/commands/sync/discovery.d.ts.map +1 -1
  36. package/dist/commands/sync/discovery.js +1 -1
  37. package/dist/commands/sync/manifest.d.ts.map +1 -1
  38. package/dist/commands/sync/manifest.js +3 -1
  39. package/dist/commands/sync/persistence.d.ts.map +1 -1
  40. package/dist/commands/sync/persistence.js +8 -0
  41. package/dist/commands/sync.d.ts.map +1 -1
  42. package/dist/commands/sync.js +11 -3
  43. package/dist/engine.d.ts +41 -1
  44. package/dist/engine.d.ts.map +1 -1
  45. package/dist/engine.js +377 -80
  46. package/dist/extractors/manifest.d.ts.map +1 -1
  47. package/dist/extractors/manifest.js +66 -28
  48. package/dist/extractors/markdown.d.ts +2 -0
  49. package/dist/extractors/markdown.d.ts.map +1 -1
  50. package/dist/extractors/markdown.js +14 -3
  51. package/dist/extractors/relationships.d.ts.map +1 -1
  52. package/dist/extractors/relationships.js +1 -0
  53. package/dist/extractors/symbols-coordinator.d.ts +7 -0
  54. package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
  55. package/dist/extractors/symbols-coordinator.js +75 -39
  56. package/dist/intent-search.d.ts.map +1 -1
  57. package/dist/intent-search.js +68 -29
  58. package/dist/operations/bootstrap/generate.d.ts.map +1 -1
  59. package/dist/operations/bootstrap/generate.js +4 -3
  60. package/dist/operations/modeling/model-requirement.d.ts +1 -1
  61. package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
  62. package/dist/operations/modeling/model-requirement.js +176 -10
  63. package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
  64. package/dist/operations/modeling/predicate-applyplan.js +14 -2
  65. package/dist/operations/modeling/predicate-inference-1.js +1 -1
  66. package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
  67. package/dist/operations/modeling/predicate-loader.js +24 -0
  68. package/dist/operations/modeling/predicate-types.d.ts +4 -0
  69. package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
  70. package/dist/operations/modeling/predicate-vocabulary.d.ts +54 -0
  71. package/dist/operations/modeling/predicate-vocabulary.d.ts.map +1 -0
  72. package/dist/operations/modeling/predicate-vocabulary.js +169 -0
  73. package/dist/operations/modeling/requirement-types.d.ts +5 -0
  74. package/dist/operations/modeling/requirement-types.d.ts.map +1 -1
  75. package/dist/operations/modeling/vocabulary-alignment.d.ts +60 -0
  76. package/dist/operations/modeling/vocabulary-alignment.d.ts.map +1 -0
  77. package/dist/operations/modeling/vocabulary-alignment.js +178 -0
  78. package/dist/operations/mutation/contradictions.d.ts +3 -0
  79. package/dist/operations/mutation/contradictions.d.ts.map +1 -1
  80. package/dist/operations/mutation/contradictions.js +29 -0
  81. package/dist/operations/mutation/delete.d.ts.map +1 -1
  82. package/dist/operations/mutation/delete.js +33 -1
  83. package/dist/operations/mutation/predicate-vocabulary-guard.d.ts +8 -0
  84. package/dist/operations/mutation/predicate-vocabulary-guard.d.ts.map +1 -0
  85. package/dist/operations/mutation/predicate-vocabulary-guard.js +64 -0
  86. package/dist/operations/mutation/relationships.d.ts +1 -1
  87. package/dist/operations/mutation/relationships.d.ts.map +1 -1
  88. package/dist/operations/mutation/relationships.js +1 -0
  89. package/dist/operations/mutation/saga.d.ts +5 -0
  90. package/dist/operations/mutation/saga.d.ts.map +1 -1
  91. package/dist/operations/mutation/saga.js +10 -0
  92. package/dist/operations/mutation/serialization.d.ts.map +1 -1
  93. package/dist/operations/mutation/serialization.js +2 -0
  94. package/dist/operations/mutation/source-authoring.d.ts +6 -0
  95. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  96. package/dist/operations/mutation/source-authoring.js +213 -52
  97. package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
  98. package/dist/operations/mutation/strict-fact.js +5 -0
  99. package/dist/operations/mutation/types.d.ts +17 -0
  100. package/dist/operations/mutation/types.d.ts.map +1 -1
  101. package/dist/operations/mutation/upsert.d.ts +6 -0
  102. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  103. package/dist/operations/mutation/upsert.js +77 -11
  104. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
  105. package/dist/operations/mutation/validate-upsert.js +24 -1
  106. package/dist/operations/mutation/validation.d.ts.map +1 -1
  107. package/dist/operations/mutation/validation.js +16 -3
  108. package/dist/operations/planning/apply-plan.d.ts.map +1 -1
  109. package/dist/operations/planning/apply-plan.js +66 -26
  110. package/dist/operations/planning/compile-intent.d.ts.map +1 -1
  111. package/dist/operations/planning/compile-intent.js +3 -1
  112. package/dist/operations/proof/code-scope.d.ts +17 -0
  113. package/dist/operations/proof/code-scope.d.ts.map +1 -0
  114. package/dist/operations/proof/code-scope.js +60 -0
  115. package/dist/operations/proof/ingest-proof.d.ts +4 -2
  116. package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
  117. package/dist/operations/proof/ingest-proof.js +208 -74
  118. package/dist/operations/proof/migrate-legacy-receipts.d.ts.map +1 -1
  119. package/dist/operations/proof/migrate-legacy-receipts.js +7 -5
  120. package/dist/operations/proof/prune-receipts.d.ts.map +1 -1
  121. package/dist/operations/proof/prune-receipts.js +7 -5
  122. package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
  123. package/dist/operations/semantic-advisor/analysis-receipt.js +7 -1
  124. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  125. package/dist/operations/semantic-advisor/analyze-prose.js +26 -4
  126. package/dist/operations/semantic-advisor/clauses.d.ts +1 -0
  127. package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
  128. package/dist/operations/semantic-advisor/clauses.js +7 -1
  129. package/dist/performance-trace.d.ts +17 -0
  130. package/dist/performance-trace.d.ts.map +1 -0
  131. package/dist/performance-trace.js +134 -0
  132. package/dist/plugins/approved-source-analyzers.d.ts +13 -0
  133. package/dist/plugins/approved-source-analyzers.d.ts.map +1 -0
  134. package/dist/plugins/approved-source-analyzers.generated.d.ts +71 -0
  135. package/dist/plugins/approved-source-analyzers.generated.d.ts.map +1 -0
  136. package/dist/plugins/approved-source-analyzers.generated.js +77 -0
  137. package/dist/plugins/approved-source-analyzers.js +3 -0
  138. package/dist/plugins/compose-semantic-classifier.d.ts +6 -1
  139. package/dist/plugins/compose-semantic-classifier.d.ts.map +1 -1
  140. package/dist/plugins/compose-semantic-classifier.js +8 -3
  141. package/dist/plugins/compose-vocabulary-alignment.d.ts +23 -0
  142. package/dist/plugins/compose-vocabulary-alignment.d.ts.map +1 -0
  143. package/dist/plugins/compose-vocabulary-alignment.js +141 -0
  144. package/dist/plugins/external-allowlist.d.ts +7 -0
  145. package/dist/plugins/external-allowlist.d.ts.map +1 -1
  146. package/dist/plugins/external-allowlist.js +13 -0
  147. package/dist/plugins/index.d.ts +2 -0
  148. package/dist/plugins/index.d.ts.map +1 -1
  149. package/dist/plugins/index.js +4 -0
  150. package/dist/plugins/maintenance-source-analysis.d.ts +14 -0
  151. package/dist/plugins/maintenance-source-analysis.d.ts.map +1 -0
  152. package/dist/plugins/maintenance-source-analysis.js +191 -0
  153. package/dist/plugins/registry.d.ts +3 -1
  154. package/dist/plugins/registry.d.ts.map +1 -1
  155. package/dist/plugins/registry.js +27 -1
  156. package/dist/plugins/source-analysis-service.d.ts +36 -1
  157. package/dist/plugins/source-analysis-service.d.ts.map +1 -1
  158. package/dist/plugins/source-analysis-service.js +184 -27
  159. package/dist/plugins/source-change-analysis.d.ts +15 -0
  160. package/dist/plugins/source-change-analysis.d.ts.map +1 -0
  161. package/dist/plugins/source-change-analysis.js +54 -0
  162. package/dist/plugins/source-classification.d.ts +41 -0
  163. package/dist/plugins/source-classification.d.ts.map +1 -0
  164. package/dist/plugins/source-classification.js +490 -0
  165. package/dist/prolog/codec.d.ts.map +1 -1
  166. package/dist/prolog/codec.js +2 -0
  167. package/dist/prolog/swipl-resolver.d.ts +88 -0
  168. package/dist/prolog/swipl-resolver.d.ts.map +1 -0
  169. package/dist/prolog/swipl-resolver.js +446 -0
  170. package/dist/prolog.d.ts +51 -1
  171. package/dist/prolog.d.ts.map +1 -1
  172. package/dist/prolog.js +145 -15
  173. package/dist/public/diagnostic-usage.d.ts.map +1 -1
  174. package/dist/public/diagnostic-usage.js +7 -25
  175. package/dist/public/impact/analyzer.d.ts.map +1 -1
  176. package/dist/public/impact/analyzer.js +56 -5
  177. package/dist/public/impact/diagnostics.d.ts.map +1 -1
  178. package/dist/public/impact/diagnostics.js +3 -1
  179. package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
  180. package/dist/public/impact/full-kb-quality.js +4 -12
  181. package/dist/public/impact/manifest.d.ts.map +1 -1
  182. package/dist/public/impact/manifest.js +15 -1
  183. package/dist/public/impact/source-changes.d.ts.map +1 -1
  184. package/dist/public/impact/source-changes.js +35 -27
  185. package/dist/public/impact/types.d.ts +2 -0
  186. package/dist/public/impact/types.d.ts.map +1 -1
  187. package/dist/public/operations/catalog.d.ts +80 -7
  188. package/dist/public/operations/catalog.d.ts.map +1 -1
  189. package/dist/public/operations/catalog.js +2 -0
  190. package/dist/public/operations/check-executor.d.ts.map +1 -1
  191. package/dist/public/operations/check-executor.js +10 -2
  192. package/dist/public/operations/check-helpers.d.ts +6 -0
  193. package/dist/public/operations/check-helpers.d.ts.map +1 -1
  194. package/dist/public/operations/check-helpers.js +21 -1
  195. package/dist/public/operations/contracts.d.ts.map +1 -1
  196. package/dist/public/operations/contracts.js +325 -8
  197. package/dist/public/operations/discovery-entities.d.ts +42 -2
  198. package/dist/public/operations/discovery-entities.d.ts.map +1 -1
  199. package/dist/public/operations/discovery-entities.js +195 -22
  200. package/dist/public/operations/discovery-executors.d.ts +1 -0
  201. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  202. package/dist/public/operations/discovery-executors.js +75 -46
  203. package/dist/public/operations/impact-review-preparation.d.ts +14 -0
  204. package/dist/public/operations/impact-review-preparation.d.ts.map +1 -0
  205. package/dist/public/operations/impact-review-preparation.js +379 -0
  206. package/dist/public/operations/index.d.ts +2 -0
  207. package/dist/public/operations/index.d.ts.map +1 -1
  208. package/dist/public/operations/index.js +2 -0
  209. package/dist/public/operations/migration-plan.d.ts +2 -0
  210. package/dist/public/operations/migration-plan.d.ts.map +1 -1
  211. package/dist/public/operations/migration-plan.js +50 -0
  212. package/dist/public/operations/node-ports.d.ts.map +1 -1
  213. package/dist/public/operations/node-ports.js +1 -35
  214. package/dist/public/operations/predicate-schema-conformance.d.ts +41 -0
  215. package/dist/public/operations/predicate-schema-conformance.d.ts.map +1 -0
  216. package/dist/public/operations/predicate-schema-conformance.js +242 -0
  217. package/dist/public/operations/prolog-json.d.ts.map +1 -1
  218. package/dist/public/operations/prolog-json.js +9 -3
  219. package/dist/public/operations/proof-receipt-projection.d.ts +5 -0
  220. package/dist/public/operations/proof-receipt-projection.d.ts.map +1 -0
  221. package/dist/public/operations/proof-receipt-projection.js +36 -0
  222. package/dist/public/operations/result-envelope.d.ts +34 -1
  223. package/dist/public/operations/result-envelope.d.ts.map +1 -1
  224. package/dist/public/operations/result-envelope.js +78 -2
  225. package/dist/public/operations/runtime-types.d.ts +1 -1
  226. package/dist/public/operations/runtime-types.d.ts.map +1 -1
  227. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  228. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  229. package/dist/public/operations/specs/check-rules.generated.js +8 -1
  230. package/dist/public/operations/specs/check.d.ts +1 -1
  231. package/dist/public/operations/specs/discovery.d.ts +7 -1
  232. package/dist/public/operations/specs/discovery.d.ts.map +1 -1
  233. package/dist/public/operations/specs/discovery.js +7 -1
  234. package/dist/public/operations/specs/impact-review-preparation.d.ts +47 -0
  235. package/dist/public/operations/specs/impact-review-preparation.d.ts.map +1 -0
  236. package/dist/public/operations/specs/impact-review-preparation.js +43 -0
  237. package/dist/public/operations/specs/mutation-schemas.d.ts +27 -4
  238. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  239. package/dist/public/operations/specs/mutation-schemas.js +21 -3
  240. package/dist/public/operations/specs/reporting.d.ts +8 -0
  241. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  242. package/dist/public/operations/specs/reporting.js +46 -15
  243. package/dist/public/operations/specs/upsert.d.ts +28 -5
  244. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  245. package/dist/public/operations/specs/upsert.js +1 -1
  246. package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -1
  247. package/dist/public/operations/symbol-repair-plan.js +8 -3
  248. package/dist/public/operations/types.d.ts +1 -1
  249. package/dist/public/operations/types.d.ts.map +1 -1
  250. package/dist/public/schemas/entity.d.ts.map +1 -1
  251. package/dist/public/schemas/entity.js +22 -0
  252. package/dist/public/schemas/relationship.d.ts.map +1 -1
  253. package/dist/public/schemas/relationship.js +1 -0
  254. package/dist/public/skills/kibi-usage/SKILL.md +7 -3
  255. package/dist/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
  256. package/dist/public/skills/kibi-usage/resources/operation-access.md +1 -0
  257. package/dist/public/skills/kibi-usage/resources/relationship-directions.md +35 -17
  258. package/dist/public/skills/kibi-usage/resources/source-authoring.md +36 -0
  259. package/dist/public/skills/kibi-usage/resources/workflows.md +52 -1
  260. package/dist/public/telemetry-acceptance.d.ts.map +1 -1
  261. package/dist/public/telemetry-acceptance.js +21 -5
  262. package/dist/relationships/shards.d.ts +6 -0
  263. package/dist/relationships/shards.d.ts.map +1 -1
  264. package/dist/relationships/shards.js +26 -19
  265. package/dist/schemas/entity.schema.json +32 -0
  266. package/dist/traceability/analysis-gate.d.ts +39 -0
  267. package/dist/traceability/analysis-gate.d.ts.map +1 -0
  268. package/dist/traceability/analysis-gate.js +51 -0
  269. package/dist/traceability/git-change-snapshot.d.ts +27 -0
  270. package/dist/traceability/git-change-snapshot.d.ts.map +1 -0
  271. package/dist/traceability/git-change-snapshot.js +411 -0
  272. package/dist/traceability/git-staged.d.ts +5 -1
  273. package/dist/traceability/git-staged.d.ts.map +1 -1
  274. package/dist/traceability/git-staged.js +16 -11
  275. package/dist/traceability/impact-evaluator.d.ts +54 -0
  276. package/dist/traceability/impact-evaluator.d.ts.map +1 -0
  277. package/dist/traceability/impact-evaluator.js +270 -0
  278. package/dist/traceability/impact-git-tree.d.ts +12 -0
  279. package/dist/traceability/impact-git-tree.d.ts.map +1 -0
  280. package/dist/traceability/impact-git-tree.js +46 -0
  281. package/dist/traceability/impact-knowledge.d.ts +16 -0
  282. package/dist/traceability/impact-knowledge.d.ts.map +1 -0
  283. package/dist/traceability/impact-knowledge.js +165 -0
  284. package/dist/traceability/impact-policy.d.ts +15 -0
  285. package/dist/traceability/impact-policy.d.ts.map +1 -0
  286. package/dist/traceability/impact-policy.js +48 -0
  287. package/dist/traceability/impact-policy.v1.schema.json +48 -0
  288. package/dist/traceability/impact-pr-diff.d.ts +5 -0
  289. package/dist/traceability/impact-pr-diff.d.ts.map +1 -0
  290. package/dist/traceability/impact-pr-diff.js +83 -0
  291. package/dist/traceability/impact-record-validation.d.ts +9 -0
  292. package/dist/traceability/impact-record-validation.d.ts.map +1 -0
  293. package/dist/traceability/impact-record-validation.js +113 -0
  294. package/dist/traceability/impact-review.d.ts +148 -0
  295. package/dist/traceability/impact-review.d.ts.map +1 -0
  296. package/dist/traceability/impact-review.js +494 -0
  297. package/dist/traceability/impact-review.schema.json +365 -0
  298. package/dist/traceability/impact-side-evidence.d.ts +13 -0
  299. package/dist/traceability/impact-side-evidence.d.ts.map +1 -0
  300. package/dist/traceability/impact-side-evidence.js +240 -0
  301. package/dist/traceability/reviewed-coordinate-refresh.d.ts +10 -0
  302. package/dist/traceability/reviewed-coordinate-refresh.d.ts.map +1 -0
  303. package/dist/traceability/reviewed-coordinate-refresh.js +49 -0
  304. package/dist/traceability/snapshot-knowledge.d.ts +4 -0
  305. package/dist/traceability/snapshot-knowledge.d.ts.map +1 -0
  306. package/dist/traceability/snapshot-knowledge.js +98 -0
  307. package/dist/traceability/staged-diagnostics.d.ts +1 -1
  308. package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
  309. package/dist/traceability/staged-entity-id-style.d.ts +12 -0
  310. package/dist/traceability/staged-entity-id-style.d.ts.map +1 -0
  311. package/dist/traceability/staged-entity-id-style.js +68 -0
  312. package/dist/traceability/staged-file-coverage.d.ts +23 -0
  313. package/dist/traceability/staged-file-coverage.d.ts.map +1 -1
  314. package/dist/traceability/staged-impact-contract.d.ts.map +1 -1
  315. package/dist/traceability/staged-impact-contract.js +2 -16
  316. package/dist/traceability/staged-symbols-manifest.d.ts +4 -0
  317. package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
  318. package/dist/traceability/staged-symbols-manifest.js +17 -6
  319. package/dist/traceability/symbol-extract.d.ts +3 -5
  320. package/dist/traceability/symbol-extract.d.ts.map +1 -1
  321. package/dist/traceability/symbol-extract.js +49 -34
  322. package/dist/traceability/temp-kb.d.ts +1 -1
  323. package/dist/traceability/temp-kb.d.ts.map +1 -1
  324. package/dist/traceability/temp-kb.js +57 -13
  325. package/dist/traceability/trusted-pr-event.d.ts +13 -0
  326. package/dist/traceability/trusted-pr-event.d.ts.map +1 -0
  327. package/dist/traceability/trusted-pr-event.js +105 -0
  328. package/dist/traceability/validate.js +1 -1
  329. package/dist/types/entities.d.ts +2 -0
  330. package/dist/types/entities.d.ts.map +1 -1
  331. package/dist/types/relationships.d.ts +1 -1
  332. package/dist/types/relationships.d.ts.map +1 -1
  333. package/dist/utils/canonical-path.d.ts +3 -0
  334. package/dist/utils/canonical-path.d.ts.map +1 -0
  335. package/dist/utils/canonical-path.js +33 -0
  336. package/dist/utils/entity-id-style.d.ts +27 -0
  337. package/dist/utils/entity-id-style.d.ts.map +1 -0
  338. package/dist/utils/entity-id-style.js +81 -0
  339. package/dist/utils/git-repository-context.d.ts +50 -0
  340. package/dist/utils/git-repository-context.d.ts.map +1 -0
  341. package/dist/utils/git-repository-context.js +259 -0
  342. package/dist/utils/rule-registry.d.ts +5 -0
  343. package/dist/utils/rule-registry.d.ts.map +1 -1
  344. package/dist/utils/rule-registry.generated.d.ts +37 -0
  345. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  346. package/dist/utils/rule-registry.generated.js +44 -0
  347. package/dist/utils/strict-modeling.d.ts +7 -0
  348. package/dist/utils/strict-modeling.d.ts.map +1 -1
  349. package/dist/utils/strict-modeling.js +11 -0
  350. package/package.json +14 -5
  351. package/schema/entities.pl +60 -1
  352. package/schema/relationships.pl +17 -4
  353. package/schema/validation.pl +118 -20
  354. package/src/public/diagnostic-usage.ts +16 -24
  355. package/src/public/impact/analyzer.ts +88 -5
  356. package/src/public/impact/diagnostics.ts +7 -5
  357. package/src/public/impact/full-kb-quality.ts +4 -16
  358. package/src/public/impact/manifest.ts +14 -1
  359. package/src/public/impact/source-changes.ts +39 -34
  360. package/src/public/impact/types.ts +5 -0
  361. package/src/public/operations/catalog.ts +2 -0
  362. package/src/public/operations/check-executor.ts +12 -1
  363. package/src/public/operations/check-helpers.ts +27 -1
  364. package/src/public/operations/contracts.ts +404 -9
  365. package/src/public/operations/discovery-entities.ts +292 -23
  366. package/src/public/operations/discovery-executors.ts +91 -55
  367. package/src/public/operations/impact-review-preparation.ts +548 -0
  368. package/src/public/operations/index.ts +2 -0
  369. package/src/public/operations/migration-plan.ts +57 -0
  370. package/src/public/operations/node-ports.ts +1 -39
  371. package/src/public/operations/predicate-schema-conformance.ts +362 -0
  372. package/src/public/operations/prolog-json.ts +9 -3
  373. package/src/public/operations/proof-receipt-projection.ts +39 -0
  374. package/src/public/operations/result-envelope.ts +114 -2
  375. package/src/public/operations/runtime-types.ts +1 -1
  376. package/src/public/operations/specs/check-rules.generated.ts +8 -1
  377. package/src/public/operations/specs/discovery.ts +8 -1
  378. package/src/public/operations/specs/impact-review-preparation.ts +46 -0
  379. package/src/public/operations/specs/mutation-schemas.ts +23 -3
  380. package/src/public/operations/specs/reporting.ts +69 -22
  381. package/src/public/operations/specs/upsert.ts +1 -1
  382. package/src/public/operations/symbol-repair-plan.ts +13 -3
  383. package/src/public/operations/types.ts +1 -0
  384. package/src/public/schemas/entity.ts +22 -0
  385. package/src/public/schemas/relationship.ts +1 -0
  386. package/src/public/skills/kibi-usage/SKILL.md +7 -3
  387. package/src/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
  388. package/src/public/skills/kibi-usage/resources/operation-access.md +1 -0
  389. package/src/public/skills/kibi-usage/resources/relationship-directions.md +35 -17
  390. package/src/public/skills/kibi-usage/resources/source-authoring.md +36 -0
  391. package/src/public/skills/kibi-usage/resources/workflows.md +52 -1
  392. package/src/public/telemetry-acceptance.ts +37 -6
  393. package/src/schemas/entity.schema.json +32 -0
  394. package/src/schemas/relationship.schema.json +1 -0
  395. package/src/traceability/impact-policy.v1.schema.json +48 -0
  396. package/src/traceability/impact-review.schema.json +365 -0
  397. package/templates/github/kibi-badge.yml +0 -4
  398. package/templates/github/kibi-report.yml +0 -4
@@ -2,9 +2,11 @@ import { createHash } from "node:crypto";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
+ import { isDeepStrictEqual } from "node:util";
5
6
  import { dump as dumpYaml, load as loadYaml } from "js-yaml";
6
7
  import { parseDocument, stringify } from "yaml";
7
8
  import { OperationError } from "../../cli-errors.js";
9
+ import { canonicalFilesystemPath } from "../../utils/canonical-path.js";
8
10
  import { CANONICAL_ENTITY_PATHS, isDerivedKbPath, } from "../../utils/kb-paths.js";
9
11
  function digest(value) {
10
12
  return createHash("sha256").update(value).digest("hex");
@@ -22,6 +24,26 @@ export function writePendingSourceReceipt(workspaceRoot, relativePath, afterHash
22
24
  createdAt: new Date().toISOString(),
23
25
  }, null, 2)}\n`, { mode: 0o600 });
24
26
  }
27
+ /**
28
+ * Retire the pending receipt of a source that a committed plan deleted. A
29
+ * receipt binds untracked input to exact bytes, so one left behind for a
30
+ * removed file makes every later sync fail on a missing pending source.
31
+ */
32
+ // implements REQ-core-atomic-upsert-persistence, REQ-kibi-operation-interface-parity
33
+ export function retirePendingSourceReceipt(workspaceRoot, relativePath) {
34
+ try {
35
+ fs.unlinkSync(pendingReceiptPath(workspaceRoot, relativePath));
36
+ }
37
+ catch (error) {
38
+ if (error.code !== "ENOENT")
39
+ throw error;
40
+ }
41
+ }
42
+ /**
43
+ * Authored YAML round-trips keep long scalars on one line, matching sync and
44
+ * coordinate refresh output, so editing one entry never refolds the others.
45
+ */
46
+ const AUTHORED_YAML_OPTIONS = { lineWidth: 0 };
25
47
  function authoredPath(value) {
26
48
  if (typeof value !== "string" || !value.trim())
27
49
  return undefined;
@@ -49,21 +71,24 @@ export function resolveContainedSourcePath(workspaceRoot, relative) {
49
71
  throw new OperationError("SOURCE_PATH_INVALID", `document.path cannot target Kibi's derived state under ${workspaceRelative}: ${relative}`);
50
72
  }
51
73
  // A symlinked existing file or parent could otherwise escape the workspace.
52
- let existing = fs.existsSync(absolute) ? absolute : path.dirname(absolute);
53
- while (!fs.existsSync(existing) && path.dirname(existing) !== existing) {
54
- existing = path.dirname(existing);
55
- }
56
- const real = fs.realpathSync.native(existing);
57
- if (real !== root && !real.startsWith(`${root}${path.sep}`)) {
74
+ const realRoot = canonicalFilesystemPath(root);
75
+ const real = canonicalFilesystemPath(absolute);
76
+ if (real !== realRoot && !real.startsWith(`${realRoot}${path.sep}`)) {
58
77
  throw new OperationError("SOURCE_PATH_INVALID", `document.path resolves outside the workspace: ${relative}`);
59
78
  }
60
79
  return absolute;
61
80
  }
62
81
  export function normalizeAuthoredSourcePath(workspaceRoot, source) {
63
82
  const normalized = source.replaceAll("\\", "/");
64
- const relative = path.isAbsolute(normalized)
65
- ? path.relative(path.resolve(workspaceRoot), path.resolve(normalized))
66
- : normalized;
83
+ const root = path.resolve(workspaceRoot);
84
+ let relative = normalized;
85
+ if (path.isAbsolute(normalized)) {
86
+ const absolute = path.resolve(normalized);
87
+ relative =
88
+ absolute === root || absolute.startsWith(`${root}${path.sep}`)
89
+ ? path.relative(root, absolute)
90
+ : path.relative(canonicalFilesystemPath(root), canonicalFilesystemPath(absolute));
91
+ }
67
92
  return path
68
93
  .relative(path.resolve(workspaceRoot), resolveContainedSourcePath(workspaceRoot, relative))
69
94
  .replaceAll(path.sep, "/");
@@ -226,13 +251,97 @@ export function manifestRelationships(item) {
226
251
  : [];
227
252
  });
228
253
  }
229
- function mergeManifestRelationships(existing, incoming, entityId) {
254
+ // implements REQ-source-analysis-v2
255
+ function manifestRecord(item) {
256
+ if (item === null ||
257
+ typeof item !== "object" ||
258
+ !("toJSON" in item) ||
259
+ typeof item.toJSON !== "function") {
260
+ return undefined;
261
+ }
262
+ const value = item.toJSON();
263
+ return value !== null && typeof value === "object" && !Array.isArray(value)
264
+ ? value
265
+ : undefined;
266
+ }
267
+ // implements REQ-source-analysis-v2
268
+ function failDuplicateConflict(entityId, field) {
269
+ throw new OperationError("SOURCE_DUPLICATE_CONFLICT", `Duplicate symbol ${entityId} has conflicting authored field "${field}"; no source was written`, false);
270
+ }
271
+ // implements REQ-source-analysis-v2
272
+ function mergeCompatibleManifestField(target, field, value, entityId, conflictField = field) {
273
+ if (Object.hasOwn(target, field)) {
274
+ if (!isDeepStrictEqual(target[field], value)) {
275
+ failDuplicateConflict(entityId, conflictField);
276
+ }
277
+ return;
278
+ }
279
+ Object.defineProperty(target, field, {
280
+ configurable: true,
281
+ enumerable: true,
282
+ value,
283
+ writable: true,
284
+ });
285
+ }
286
+ // implements REQ-source-analysis-v2
287
+ function mergeDuplicateManifestFields(records, entityId) {
288
+ const merged = Object.create(null);
289
+ for (const record of records) {
290
+ // Links and typed relationships are collections, so merge them separately
291
+ // instead of treating a difference as conflicting scalar metadata.
292
+ const authored = Object.fromEntries(Object.entries(symbolManifestRecord(record)).filter(([key]) => key !== "links"));
293
+ for (const [key, value] of Object.entries(authored)) {
294
+ mergeCompatibleManifestField(merged, key, value, entityId);
295
+ }
296
+ }
297
+ return merged;
298
+ }
299
+ // implements REQ-source-analysis-v2
300
+ function manifestRelationshipRecords(record, entityId) {
301
+ if (record.relationships === undefined)
302
+ return [];
303
+ if (!Array.isArray(record.relationships)) {
304
+ failDuplicateConflict(entityId, "relationships");
305
+ }
306
+ return record.relationships;
307
+ }
308
+ // implements REQ-source-analysis-v2
309
+ function mergeManifestRelationshipRecords(records, incoming, entityId) {
230
310
  const merged = new Map();
231
- for (const relationship of existing) {
232
- merged.set(`${relationship.type}\u0000${relationship.target}`, {
233
- type: relationship.type,
234
- target: relationship.target,
235
- });
311
+ const untyped = [];
312
+ for (const record of records) {
313
+ for (const row of manifestRelationshipRecords(record, entityId)) {
314
+ if (row === null || typeof row !== "object" || Array.isArray(row)) {
315
+ if (!untyped.some((value) => isDeepStrictEqual(value, row))) {
316
+ untyped.push(row);
317
+ }
318
+ continue;
319
+ }
320
+ const candidate = row;
321
+ const type = candidate.type;
322
+ const target = candidate.target ?? candidate.to;
323
+ if (typeof type !== "string" || typeof target !== "string") {
324
+ if (!untyped.some((value) => isDeepStrictEqual(value, row))) {
325
+ untyped.push(row);
326
+ }
327
+ continue;
328
+ }
329
+ const key = `${type}\u0000${target}`;
330
+ const normalized = {
331
+ ...Object.fromEntries(Object.entries(candidate).filter(([key]) => key !== "to")),
332
+ type,
333
+ target,
334
+ };
335
+ const previous = merged.get(key);
336
+ if (previous) {
337
+ for (const [field, value] of Object.entries(normalized)) {
338
+ mergeCompatibleManifestField(previous, field, value, entityId, `relationship ${type} -> ${target}.${field}`);
339
+ }
340
+ }
341
+ else {
342
+ merged.set(key, normalized);
343
+ }
344
+ }
236
345
  }
237
346
  for (const relationship of incoming) {
238
347
  if (relationship.from !== entityId ||
@@ -240,19 +349,63 @@ function mergeManifestRelationships(existing, incoming, entityId) {
240
349
  typeof relationship.to !== "string") {
241
350
  continue;
242
351
  }
243
- const normalized = { type: relationship.type, target: relationship.to };
244
- merged.set(`${normalized.type}\u0000${normalized.target}`, normalized);
352
+ const key = `${relationship.type}\u0000${relationship.to}`;
353
+ const normalized = {
354
+ ...Object.fromEntries(Object.entries(relationship).filter(([key]) => key !== "from" && key !== "to")),
355
+ type: relationship.type,
356
+ target: relationship.to,
357
+ };
358
+ const previous = merged.get(key);
359
+ if (previous) {
360
+ for (const [field, value] of Object.entries(normalized)) {
361
+ mergeCompatibleManifestField(previous, field, value, entityId, `relationship ${relationship.type} -> ${relationship.to}.${field}`);
362
+ }
363
+ }
364
+ else {
365
+ merged.set(key, normalized);
366
+ }
367
+ }
368
+ return [
369
+ ...[...merged.values()].sort((left, right) => `${String(left.type)}\u0000${String(left.target)}`.localeCompare(`${String(right.type)}\u0000${String(right.target)}`)),
370
+ ...untyped,
371
+ ];
372
+ }
373
+ // implements REQ-source-analysis-v2
374
+ function mergeManifestLinks(records, entity) {
375
+ const values = [
376
+ ...records.map((record) => record.links),
377
+ entity.links,
378
+ ].filter((value) => value !== undefined);
379
+ if (values.length === 0)
380
+ return undefined;
381
+ const links = [];
382
+ for (const value of values) {
383
+ const entries = Array.isArray(value) ? value : [value];
384
+ for (const entry of entries) {
385
+ if (!links.some((existing) => isDeepStrictEqual(existing, entry))) {
386
+ links.push(entry);
387
+ }
388
+ }
245
389
  }
246
- return [...merged.values()].sort((left, right) => `${left.type}\u0000${left.target}`.localeCompare(`${right.type}\u0000${right.target}`));
390
+ return links;
391
+ }
392
+ /** Indexes of every manifest entry whose `id` equals `id`, in file order. */
393
+ function symbolManifestIndexes(items, id) {
394
+ return items.flatMap((item, index) => item &&
395
+ typeof item === "object" &&
396
+ "get" in item &&
397
+ String(item.get("id")) === id
398
+ ? [index]
399
+ : []);
247
400
  }
248
401
  function renderSymbolManifest(entity, relationships, existingContent) {
249
402
  if (existingContent === undefined) {
250
- const doc = parseDocument(stringify({
251
- symbols: [
252
- symbolManifestRecord(entity, mergeManifestRelationships([], relationships, String(entity.id))),
253
- ],
254
- }));
255
- return doc.toString();
403
+ const created = symbolManifestRecord(entity);
404
+ const rows = mergeManifestRelationshipRecords([], relationships, String(entity.id));
405
+ if (rows.length > 0)
406
+ created.relationships = rows;
407
+ const doc = parseDocument(stringify({ symbols: [created] }));
408
+ return doc.toString(AUTHORED_YAML_OPTIONS);
256
409
  }
257
410
  const doc = parseDocument(existingContent);
258
411
  const symbols = doc.get("symbols", true);
@@ -261,31 +414,40 @@ function renderSymbolManifest(entity, relationships, existingContent) {
261
414
  }
262
415
  const items = symbols.items;
263
416
  const id = String(entity.id);
264
- const index = items.findIndex((item) => {
417
+ const indices = items.flatMap((item, index) => {
265
418
  if (!item || typeof item !== "object" || !("get" in item))
266
- return false;
267
- return String(item.get("id")) === id;
419
+ return [];
420
+ return String(item.get("id")) === id
421
+ ? [index]
422
+ : [];
268
423
  });
269
- const existingRelationships = index >= 0 ? manifestRelationships(items[index]) : [];
270
- let next = symbolManifestRecord(entity, mergeManifestRelationships(existingRelationships, relationships, id));
271
- if (index >= 0) {
272
- // Partial symbol payloads (for example a relationship-only upsert) must
273
- // never erase authored provenance from the manifest. Preserve fields the
274
- // payload omits, with incoming values winning on explicit conflicts.
275
- const item = items[index];
276
- const previous = typeof item?.toJSON === "function" ? item.toJSON() : null;
277
- if (typeof previous === "object" &&
278
- previous !== null &&
279
- !Array.isArray(previous)) {
280
- const preserved = symbolManifestRecord(previous, []);
281
- next = { ...preserved, ...next };
424
+ const existingRecords = indices
425
+ .map((index) => manifestRecord(items[index]))
426
+ .filter((record) => record !== undefined);
427
+ if (existingRecords.length !== indices.length) {
428
+ failDuplicateConflict(id, "record");
429
+ }
430
+ const previous = mergeDuplicateManifestFields(existingRecords, id);
431
+ const next = { ...previous, ...symbolManifestRecord(entity) };
432
+ const mergedRelationships = mergeManifestRelationshipRecords(existingRecords, relationships, id);
433
+ if (mergedRelationships.length > 0) {
434
+ next.relationships = mergedRelationships;
435
+ }
436
+ const mergedLinks = mergeManifestLinks(existingRecords, entity);
437
+ if (mergedLinks !== undefined)
438
+ next.links = mergedLinks;
439
+ if (indices.length > 0) {
440
+ // Patch one canonical row and remove all redundant copies only after
441
+ // compatible authored fields and all links have been merged successfully.
442
+ doc.setIn(["symbols", indices[0]], next);
443
+ for (const duplicateIndex of indices.slice(1).reverse()) {
444
+ items.splice(duplicateIndex, 1);
282
445
  }
283
- doc.setIn(["symbols", index], next);
284
446
  }
285
447
  else {
286
448
  doc.addIn(["symbols"], next);
287
449
  }
288
- return doc.toString();
450
+ return doc.toString(AUTHORED_YAML_OPTIONS);
289
451
  }
290
452
  export function renderSourceDeletion(sourcePathValue, entityId, entityType, existingContent) {
291
453
  const extension = path.extname(sourcePathValue).toLowerCase();
@@ -306,16 +468,15 @@ export function renderSourceDeletion(sourcePathValue, entityId, entityType, exis
306
468
  throw new OperationError("SOURCE_FORMAT_INVALID", "Symbol manifest must contain a symbols array");
307
469
  }
308
470
  const items = symbols.items;
309
- const index = items.findIndex((item) => {
310
- if (!item || typeof item !== "object" || !("get" in item))
311
- return false;
312
- return (String(item.get("id")) === entityId);
313
- });
314
- if (index < 0) {
471
+ const matches = symbolManifestIndexes(items, entityId);
472
+ if (matches.length === 0) {
315
473
  throw new OperationError("SOURCE_ENTITY_MISMATCH", `Symbol manifest ${sourcePathValue} does not contain ${entityId}`);
316
474
  }
317
- doc.deleteIn(["symbols", index]);
318
- return { mode: "write", body: doc.toString() };
475
+ // Delete every copy, last first so earlier indexes stay valid.
476
+ for (const match of [...matches].reverse()) {
477
+ doc.deleteIn(["symbols", match]);
478
+ }
479
+ return { mode: "write", body: doc.toString(AUTHORED_YAML_OPTIONS) };
319
480
  }
320
481
  throw new OperationError("SOURCE_FORMAT_UNSUPPORTED", `Unsupported authored source format: ${extension || "unknown"}`);
321
482
  }
@@ -381,7 +542,7 @@ export function renderMarkdownRelationshipDeletion(sourcePathValue, existingCont
381
542
  return { body: existingContent, removed: false };
382
543
  const body = existingContent.slice(marker + "\n---".length);
383
544
  return {
384
- body: `---\n${frontmatter.toString()}---${body.startsWith("\n") ? "" : "\n"}${body}`,
545
+ body: `---\n${frontmatter.toString(AUTHORED_YAML_OPTIONS)}---${body.startsWith("\n") ? "" : "\n"}${body}`,
385
546
  removed: true,
386
547
  };
387
548
  }
@@ -437,7 +598,7 @@ export function renderYamlRelationshipDeletion(sourcePathValue, existingContent,
437
598
  }
438
599
  }
439
600
  return removed
440
- ? { body: doc.toString(), removed: true }
601
+ ? { body: doc.toString(AUTHORED_YAML_OPTIONS), removed: true }
441
602
  : { body: existingContent, removed: false };
442
603
  }
443
604
  function renderSourceDocument(input, entity, existingContent, relativePath) {
@@ -1 +1 @@
1
- {"version":3,"file":"strict-fact.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/strict-fact.ts"],"names":[],"mappings":"AAUA,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAarD;AAGD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,MAAM,EAAE,CA+EV;AAED,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,OAAO,EACtB,aAAa,EAAE,OAAO,GACrB,IAAI,CAUN;AAGD,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,IAAI,CA+CN"}
1
+ {"version":3,"file":"strict-fact.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/strict-fact.ts"],"names":[],"mappings":"AAWA,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAarD;AAGD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,MAAM,EAAE,CA+EV;AAED,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,OAAO,EACtB,aAAa,EAAE,OAAO,GACrB,IAAI,CAUN;AAGD,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,IAAI,CAmDN"}
@@ -1,4 +1,5 @@
1
1
  import { validateLogicIr } from "../../logic/ir.js";
2
+ import { predicateVocabularyErrors } from "../modeling/predicate-vocabulary.js";
2
3
  const PROPERTY_VALUE_FIELDS = [
3
4
  "value_string",
4
5
  "value_int",
@@ -106,6 +107,10 @@ export function validateFactModelingShape(entity) {
106
107
  if (hints.length > 0) {
107
108
  throw new Error(`Entity validation failed: ${hints.join("; ")}`);
108
109
  }
110
+ const vocabularyErrors = predicateVocabularyErrors(entity);
111
+ if (vocabularyErrors.length > 0) {
112
+ throw new Error(`Entity validation failed: ${vocabularyErrors.join("; ")}`);
113
+ }
109
114
  if (entity.type === "fact" && entity.fact_kind === "rule") {
110
115
  const validation = validateLogicIr(entity.rule_ir);
111
116
  if (!validation.valid || !validation.semanticKey) {
@@ -1,4 +1,5 @@
1
1
  import type { SemanticAdvisorReceipt } from "../semantic-advisor/types.js";
2
+ import type { SagaRollbackFailure } from "./saga.js";
2
3
  export type RelationshipInput = Readonly<Record<string, unknown>>;
3
4
  export type UpsertInput = {
4
5
  readonly type: string;
@@ -48,6 +49,20 @@ export type UpsertPayload = {
48
49
  readonly checked_req_id: string;
49
50
  readonly strict_readiness: string;
50
51
  };
52
+ readonly deferredCommit?: DeferredUpsertCommit;
53
+ };
54
+ /**
55
+ * Internal lifecycle for source writes prepared ahead of a batched Prolog
56
+ * commit. Finalization crosses the compiled commit boundary and permanently
57
+ * disables source rollback for that mutation.
58
+ */
59
+ export type DeferredUpsertCommit = {
60
+ readonly entity: Readonly<Record<string, unknown>>;
61
+ readonly relationships: readonly RelationshipInput[];
62
+ readonly skipContradictionCheck: boolean;
63
+ readonly state: "prepared" | "rolling_back" | "rolled_back" | "committed";
64
+ readonly finalize: () => void;
65
+ readonly rollback: () => Promise<readonly SagaRollbackFailure[]>;
51
66
  };
52
67
  export type ValidateUpsertPayload = {
53
68
  readonly valid: boolean;
@@ -74,6 +89,8 @@ export type DeletePayload = {
74
89
  readonly error_codes?: readonly Readonly<Record<string, unknown>>[];
75
90
  readonly relationship_results?: readonly Record<string, unknown>[];
76
91
  readonly sync_required?: boolean;
92
+ /** Declared effects this call did not perform, such as a plan-only result. */
93
+ readonly skippedEffects?: readonly string[];
77
94
  readonly sourceWrites?: readonly {
78
95
  readonly path: string;
79
96
  readonly mode?: "write" | "delete";
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src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AAS,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS;QAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;QACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QAClC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;KAC3B,EAAE,CAAC;IACJ,QAAQ,CAAC,YAAY,CAAC,EAAE;QACtB,QAAQ,CAAC,OAAO,EAAE,8BAA8B,CAAC;QACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;QACtC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;QAC/D,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS;YAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;YACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;YAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;YACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;YAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;SACxB,EAAE,CAAC;QACJ,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;KACxC,CAAC;CACH,CAAC"}
@@ -18,6 +18,12 @@ export type UpsertExecutionOptions = Readonly<{
18
18
  * entries. Everything else keeps the append-only invariant fail-closed.
19
19
  */
20
20
  readonly allowReceiptsPrune?: boolean;
21
+ /**
22
+ * Prepare source and validation, then return the commit payload without
23
+ * talking to Prolog. Proof ingest batches those payloads into one
24
+ * transaction.
25
+ */
26
+ readonly deferCompiledCommit?: boolean;
21
27
  }>;
22
28
  export declare function executeUpsert(input: UpsertInput, context: OperationContext, options?: UpsertExecutionOptions): Promise<OperationResult<UpsertPayload>>;
23
29
  //# sourceMappingURL=upsert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/upsert.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAkCxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAuGhF,wBAAsB,+BAA+B,CACnD,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,IAAI,CAAC,CAaf;AAED,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,aAAa,EAAE,SAAS,iBAAiB,EAAE,EAC3C,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,SAAS,iBAAiB,EAAE,CAAC,CAuBvC;AAmCD,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC5C;;;;;;OAMG;IAEH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CACvC,CAAC,CAAC;AAEH,wBAAsB,aAAa,CACjC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,gBAAgB,EACzB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAsczC"}
1
+ {"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/upsert.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAqCxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAoGhF,wBAAsB,+BAA+B,CACnD,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,IAAI,CAAC,CAaf;AAED,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,aAAa,EAAE,SAAS,iBAAiB,EAAE,EAC3C,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,SAAS,iBAAiB,EAAE,CAAC,CAuBvC;AAmCD,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC5C;;;;;;OAMG;IAEH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IACtC;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACxC,CAAC,CAAC;AAEH,wBAAsB,aAAa,CACjC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,gBAAgB,EACzB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAshBzC"}
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- import { existsSync, readFileSync, realpathSync, unlinkSync, writeFileSync, } from "node:fs";
2
+ import { existsSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
3
3
  import path from "node:path";
4
4
  import { OperationError } from "../../cli-errors.js";
5
5
  import { readManifestWithCoordinateOverlay } from "../../extractors/manifest.js";
@@ -9,11 +9,14 @@ import { loadEntities } from "../../public/operations/discovery-entities.js";
9
9
  import { appendOnlyProofReceiptHistoryErrors } from "../../public/proof-receipt.js";
10
10
  import { appendRelationship, computeShardPath, } from "../../relationships/shards.js";
11
11
  import { resolveBranchAttachment } from "../../utils/branch-resolver.js";
12
+ import { canonicalFilesystemPath } from "../../utils/canonical-path.js";
13
+ import { entityIdStyleWarnings } from "../../utils/entity-id-style.js";
12
14
  import { analyzeSemanticAdvisorInput } from "../semantic-advisor/analyze-prose.js";
13
15
  import { assertLogicalGroundingClaimKeys, assertSemanticInventoryBoundary, } from "../semantic-advisor/ingestion-boundary.js";
14
16
  import { buildUpsertCommitGoal, formatUpsertError } from "./contradictions.js";
17
+ import { assertPredicateArgumentVocabulary } from "./predicate-vocabulary-guard.js";
15
18
  import { existingRelationships, validateLiveRelationshipTargets, validateRelationshipSources, validateStrictLanePairing, validateSupersedesSourceHistory, } from "./relationships.js";
16
- import { MutationSaga } from "./saga.js";
19
+ import { MutationRollbackFailureError, MutationSaga } from "./saga.js";
17
20
  import { writePendingSourceReceipt, writeSourceForUpsert, } from "./source-authoring.js";
18
21
  import { acquireSymbolCompilerLock, releaseSymbolCompilerLock, } from "./symbol-compiler-lock.js";
19
22
  import { validateSymbolGranularity } from "./symbol-granularity.js";
@@ -55,12 +58,9 @@ function assertRelationshipShardContained(workspaceRoot, shardPath) {
55
58
  if (!absolute.startsWith(`${relationshipRoot}${path.sep}`)) {
56
59
  throw new OperationError("SOURCE_PATH_INVALID", `Relationship shard escapes the canonical workspace lane: ${shardPath}`);
57
60
  }
58
- let existing = absolute;
59
- while (!existsSync(existing) && path.dirname(existing) !== existing) {
60
- existing = path.dirname(existing);
61
- }
62
- const real = realpathSync.native(existing);
63
- if (real !== root && !real.startsWith(`${root}${path.sep}`)) {
61
+ const realRoot = canonicalFilesystemPath(root);
62
+ const real = canonicalFilesystemPath(absolute);
63
+ if (real !== realRoot && !real.startsWith(`${realRoot}${path.sep}`)) {
64
64
  throw new OperationError("SOURCE_PATH_INVALID", `Relationship shard follows a symlink outside the workspace: ${shardPath}`);
65
65
  }
66
66
  }
@@ -220,6 +220,7 @@ export async function executeUpsert(input, context, options = {}) {
220
220
  semanticAdvisor = semantic.receipt;
221
221
  assertSemanticInventoryBoundary({ ...input, relationships }, relationships, semantic.receipt);
222
222
  await assertLogicalGroundingClaimKeys(prolog, { ...input, relationships }, relationships);
223
+ await assertPredicateArgumentVocabulary(prolog, validated.entity);
223
224
  if (context.fs !== undefined && context.sourceFirst !== false) {
224
225
  const existingRows = await loadEntities(prolog, {
225
226
  id: input.id,
@@ -329,6 +330,57 @@ export async function executeUpsert(input, context, options = {}) {
329
330
  source: sourceWrite.receipt.path,
330
331
  };
331
332
  }
333
+ if (options.deferCompiledCommit === true) {
334
+ let deferredState = "prepared";
335
+ let rollbackPromise;
336
+ const deferredCommit = {
337
+ entity: commitEntity ?? validated.entity,
338
+ relationships: validated.relationships,
339
+ skipContradictionCheck: input._skipContradictionCheck === true,
340
+ get state() {
341
+ return deferredState;
342
+ },
343
+ finalize: () => {
344
+ if (deferredState !== "prepared") {
345
+ throw new Error(`Cannot finalize deferred upsert ${input.id} from state ${deferredState}`);
346
+ }
347
+ saga.markCommitted();
348
+ deferredState = "committed";
349
+ },
350
+ rollback: () => {
351
+ if (deferredState === "committed") {
352
+ return Promise.reject(new Error(`Cannot roll back deferred upsert ${input.id} after its compiled commit`));
353
+ }
354
+ if (deferredState === "rolled_back")
355
+ return Promise.resolve([]);
356
+ if (rollbackPromise !== undefined)
357
+ return rollbackPromise;
358
+ deferredState = "rolling_back";
359
+ rollbackPromise = saga.rollback().then((failures) => {
360
+ deferredState = "rolled_back";
361
+ return failures;
362
+ });
363
+ return rollbackPromise;
364
+ },
365
+ };
366
+ return {
367
+ content: [
368
+ {
369
+ type: "text",
370
+ text: `Prepared ${input.id} for a batched proof commit.`,
371
+ },
372
+ ],
373
+ structuredContent: {
374
+ created: 0,
375
+ updated: 0,
376
+ relationships_created: validated.relationships.length,
377
+ warnings: semantic.warnings,
378
+ semanticAdvisor: semantic.receipt,
379
+ deferredCommit,
380
+ ...(sourceWrite ? { sourceWrites: [sourceWrite.receipt] } : {}),
381
+ },
382
+ };
383
+ }
332
384
  const transaction = buildUpsertCommitGoal({
333
385
  entity: commitEntity ?? validated.entity,
334
386
  relationships: validated.relationships,
@@ -349,6 +401,15 @@ export async function executeUpsert(input, context, options = {}) {
349
401
  }
350
402
  const coverage = await scenarioCoverageWarnings(prolog, validated.relationships, input.type, input.id);
351
403
  const created = changeKind === "created" ? 1 : 0;
404
+ const idStyleWarnings = created === 1
405
+ ? entityIdStyleWarnings({
406
+ id: input.id,
407
+ sourcePath: sourceWrite?.receipt.path ??
408
+ (typeof validated.entity.source === "string"
409
+ ? validated.entity.source
410
+ : undefined),
411
+ })
412
+ : [];
352
413
  const shardWarnings = [];
353
414
  const relationshipSourceWrites = [];
354
415
  for (const [shardPath, before] of relationshipShardBefore) {
@@ -382,7 +443,12 @@ export async function executeUpsert(input, context, options = {}) {
382
443
  created,
383
444
  updated: changeKind === "updated" ? 1 : 0,
384
445
  relationships_created: validated.relationships.length,
385
- warnings: [...semantic.warnings, ...coverage, ...shardWarnings],
446
+ warnings: [
447
+ ...semantic.warnings,
448
+ ...coverage,
449
+ ...idStyleWarnings,
450
+ ...shardWarnings,
451
+ ],
386
452
  semanticAdvisor: semantic.receipt,
387
453
  ...(shardWarnings.length > 0
388
454
  ? {
@@ -480,7 +546,7 @@ export async function executeUpsert(input, context, options = {}) {
480
546
  }
481
547
  const coordinateFailure = rollbackFailures.find((failure) => failure.step === "symbol-coordinates");
482
548
  if (coordinateFailure !== undefined) {
483
- const failure = new AggregateError([error, coordinateFailure.error], `Upsert failed and coordinate artifact rollback failed for ${input.id}`);
549
+ const failure = new MutationRollbackFailureError([error, coordinateFailure.error], `Upsert failed and coordinate artifact rollback failed for ${input.id}`, rollbackFailures);
484
550
  operationFailure = { error: failure };
485
551
  throw failure;
486
552
  }
@@ -489,7 +555,7 @@ export async function executeUpsert(input, context, options = {}) {
489
555
  const rollbackMessage = sourceFailure.error instanceof Error
490
556
  ? sourceFailure.error.message
491
557
  : String(sourceFailure.error);
492
- const failure = new AggregateError([error, sourceFailure.error], `Upsert failed and authored source rollback failed for ${input.id}: ${rollbackMessage}`);
558
+ const failure = new MutationRollbackFailureError([error, sourceFailure.error], `Upsert failed and authored source rollback failed for ${input.id}: ${rollbackMessage}`, rollbackFailures);
493
559
  operationFailure = { error: failure };
494
560
  throw failure;
495
561
  }
@@ -1 +1 @@
1
- {"version":3,"file":"validate-upsert.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/validate-upsert.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAYxE,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAOrE,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAC,CAoFjD"}
1
+ {"version":3,"file":"validate-upsert.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/validate-upsert.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAcxE,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAerE,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAC,CAoGjD"}