@ai-primitives-hub/core 0.2.1 → 0.2.2-next.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 (336) hide show
  1. package/dist/domain/bundle/version.d.ts +13 -0
  2. package/dist/domain/bundle/version.d.ts.map +1 -1
  3. package/dist/domain/bundle/version.js +27 -0
  4. package/dist/domain/bundle/version.js.map +1 -1
  5. package/dist/domain/collection/apm-release-plan.d.ts +39 -0
  6. package/dist/domain/collection/apm-release-plan.d.ts.map +1 -0
  7. package/dist/domain/collection/apm-release-plan.js +185 -0
  8. package/dist/domain/collection/apm-release-plan.js.map +1 -0
  9. package/dist/domain/collection/contribution.d.ts +126 -0
  10. package/dist/domain/collection/contribution.d.ts.map +1 -0
  11. package/dist/domain/collection/contribution.js +462 -0
  12. package/dist/domain/collection/contribution.js.map +1 -0
  13. package/dist/domain/collection/diagnostics.d.ts +166 -0
  14. package/dist/domain/collection/diagnostics.d.ts.map +1 -0
  15. package/dist/domain/collection/diagnostics.js +3 -0
  16. package/dist/domain/collection/diagnostics.js.map +1 -0
  17. package/dist/domain/collection/manifest-validator.d.ts +3 -2
  18. package/dist/domain/collection/manifest-validator.d.ts.map +1 -1
  19. package/dist/domain/collection/manifest-validator.js +99 -17
  20. package/dist/domain/collection/manifest-validator.js.map +1 -1
  21. package/dist/domain/collection/release-manifest-plan.d.ts +9 -0
  22. package/dist/domain/collection/release-manifest-plan.d.ts.map +1 -1
  23. package/dist/domain/collection/release-manifest-plan.js +45 -14
  24. package/dist/domain/collection/release-manifest-plan.js.map +1 -1
  25. package/dist/domain/collection/validate.d.ts +5 -0
  26. package/dist/domain/collection/validate.d.ts.map +1 -1
  27. package/dist/domain/collection/validate.js +7 -2
  28. package/dist/domain/collection/validate.js.map +1 -1
  29. package/dist/domain/diagnostics/primitives/catalogue.d.ts +40 -0
  30. package/dist/domain/diagnostics/primitives/catalogue.d.ts.map +1 -0
  31. package/dist/domain/diagnostics/primitives/catalogue.js +78 -0
  32. package/dist/domain/diagnostics/primitives/catalogue.js.map +1 -0
  33. package/dist/domain/diagnostics/primitives/classifier.d.ts +81 -0
  34. package/dist/domain/diagnostics/primitives/classifier.d.ts.map +1 -0
  35. package/dist/domain/diagnostics/primitives/classifier.js +138 -0
  36. package/dist/domain/diagnostics/primitives/classifier.js.map +1 -0
  37. package/dist/domain/diagnostics/primitives/evaluators.d.ts +138 -0
  38. package/dist/domain/diagnostics/primitives/evaluators.d.ts.map +1 -0
  39. package/dist/domain/diagnostics/primitives/evaluators.js +485 -0
  40. package/dist/domain/diagnostics/primitives/evaluators.js.map +1 -0
  41. package/dist/domain/diagnostics/primitives/fixture.d.ts +97 -0
  42. package/dist/domain/diagnostics/primitives/fixture.d.ts.map +1 -0
  43. package/dist/domain/diagnostics/primitives/fixture.js +265 -0
  44. package/dist/domain/diagnostics/primitives/fixture.js.map +1 -0
  45. package/dist/domain/diagnostics/primitives/index.d.ts +18 -0
  46. package/dist/domain/diagnostics/primitives/index.d.ts.map +1 -0
  47. package/dist/domain/diagnostics/primitives/index.js +34 -0
  48. package/dist/domain/diagnostics/primitives/index.js.map +1 -0
  49. package/dist/domain/diagnostics/primitives/known-gaps.d.ts +50 -0
  50. package/dist/domain/diagnostics/primitives/known-gaps.d.ts.map +1 -0
  51. package/dist/domain/diagnostics/primitives/known-gaps.js +148 -0
  52. package/dist/domain/diagnostics/primitives/known-gaps.js.map +1 -0
  53. package/dist/domain/diagnostics/primitives/manifest-view.d.ts +28 -0
  54. package/dist/domain/diagnostics/primitives/manifest-view.d.ts.map +1 -0
  55. package/dist/domain/diagnostics/primitives/manifest-view.js +50 -0
  56. package/dist/domain/diagnostics/primitives/manifest-view.js.map +1 -0
  57. package/dist/domain/diagnostics/primitives/placements.d.ts +51 -0
  58. package/dist/domain/diagnostics/primitives/placements.d.ts.map +1 -0
  59. package/dist/domain/diagnostics/primitives/placements.js +76 -0
  60. package/dist/domain/diagnostics/primitives/placements.js.map +1 -0
  61. package/dist/domain/diagnostics/primitives/planner.d.ts +60 -0
  62. package/dist/domain/diagnostics/primitives/planner.d.ts.map +1 -0
  63. package/dist/domain/diagnostics/primitives/planner.js +60 -0
  64. package/dist/domain/diagnostics/primitives/planner.js.map +1 -0
  65. package/dist/domain/diagnostics/primitives/plugin-projection.d.ts +38 -0
  66. package/dist/domain/diagnostics/primitives/plugin-projection.d.ts.map +1 -0
  67. package/dist/domain/diagnostics/primitives/plugin-projection.js +173 -0
  68. package/dist/domain/diagnostics/primitives/plugin-projection.js.map +1 -0
  69. package/dist/domain/diagnostics/primitives/report.d.ts +122 -0
  70. package/dist/domain/diagnostics/primitives/report.d.ts.map +1 -0
  71. package/dist/domain/diagnostics/primitives/report.js +85 -0
  72. package/dist/domain/diagnostics/primitives/report.js.map +1 -0
  73. package/dist/domain/diagnostics/primitives/sandbox.d.ts +59 -0
  74. package/dist/domain/diagnostics/primitives/sandbox.d.ts.map +1 -0
  75. package/dist/domain/diagnostics/primitives/sandbox.js +193 -0
  76. package/dist/domain/diagnostics/primitives/sandbox.js.map +1 -0
  77. package/dist/domain/diagnostics/primitives/support-matrix.d.ts +36 -0
  78. package/dist/domain/diagnostics/primitives/support-matrix.d.ts.map +1 -0
  79. package/dist/domain/diagnostics/primitives/support-matrix.js +69 -0
  80. package/dist/domain/diagnostics/primitives/support-matrix.js.map +1 -0
  81. package/dist/domain/diagnostics/primitives/types.d.ts +117 -0
  82. package/dist/domain/diagnostics/primitives/types.d.ts.map +1 -0
  83. package/dist/domain/diagnostics/primitives/types.js +62 -0
  84. package/dist/domain/diagnostics/primitives/types.js.map +1 -0
  85. package/dist/domain/governance/catalogue.d.ts +11 -0
  86. package/dist/domain/governance/catalogue.d.ts.map +1 -0
  87. package/dist/domain/governance/catalogue.js +45 -0
  88. package/dist/domain/governance/catalogue.js.map +1 -0
  89. package/dist/domain/governance/effective-rules.d.ts +19 -0
  90. package/dist/domain/governance/effective-rules.d.ts.map +1 -0
  91. package/dist/domain/governance/effective-rules.js +49 -0
  92. package/dist/domain/governance/effective-rules.js.map +1 -0
  93. package/dist/domain/governance/evaluate.d.ts +16 -0
  94. package/dist/domain/governance/evaluate.d.ts.map +1 -0
  95. package/dist/domain/governance/evaluate.js +34 -0
  96. package/dist/domain/governance/evaluate.js.map +1 -0
  97. package/dist/domain/governance/hub-scope.d.ts +74 -0
  98. package/dist/domain/governance/hub-scope.d.ts.map +1 -0
  99. package/dist/domain/governance/hub-scope.js +202 -0
  100. package/dist/domain/governance/hub-scope.js.map +1 -0
  101. package/dist/domain/governance/hub-scoped-inventory.d.ts +22 -0
  102. package/dist/domain/governance/hub-scoped-inventory.d.ts.map +1 -0
  103. package/dist/domain/governance/hub-scoped-inventory.js +59 -0
  104. package/dist/domain/governance/hub-scoped-inventory.js.map +1 -0
  105. package/dist/domain/governance/index.d.ts +15 -0
  106. package/dist/domain/governance/index.d.ts.map +1 -0
  107. package/dist/domain/governance/index.js +31 -0
  108. package/dist/domain/governance/index.js.map +1 -0
  109. package/dist/domain/governance/rule-registry.d.ts +20 -0
  110. package/dist/domain/governance/rule-registry.d.ts.map +1 -0
  111. package/dist/domain/governance/rule-registry.js +40 -0
  112. package/dist/domain/governance/rule-registry.js.map +1 -0
  113. package/dist/domain/governance/rules/collection.d.ts +32 -0
  114. package/dist/domain/governance/rules/collection.d.ts.map +1 -0
  115. package/dist/domain/governance/rules/collection.js +153 -0
  116. package/dist/domain/governance/rules/collection.js.map +1 -0
  117. package/dist/domain/governance/rules/config.d.ts +15 -0
  118. package/dist/domain/governance/rules/config.d.ts.map +1 -0
  119. package/dist/domain/governance/rules/config.js +38 -0
  120. package/dist/domain/governance/rules/config.js.map +1 -0
  121. package/dist/domain/governance/rules/hub.d.ts +7 -0
  122. package/dist/domain/governance/rules/hub.d.ts.map +1 -0
  123. package/dist/domain/governance/rules/hub.js +10 -0
  124. package/dist/domain/governance/rules/hub.js.map +1 -0
  125. package/dist/domain/governance/types.d.ts +70 -0
  126. package/dist/domain/governance/types.d.ts.map +1 -0
  127. package/dist/domain/governance/types.js +7 -0
  128. package/dist/domain/governance/types.js.map +1 -0
  129. package/dist/domain/hub/diagnostics.d.ts +92 -0
  130. package/dist/domain/hub/diagnostics.d.ts.map +1 -0
  131. package/dist/domain/hub/diagnostics.js +11 -0
  132. package/dist/domain/hub/diagnostics.js.map +1 -0
  133. package/dist/domain/hub/profile-requirements.d.ts +16 -0
  134. package/dist/domain/hub/profile-requirements.d.ts.map +1 -0
  135. package/dist/domain/hub/profile-requirements.js +16 -0
  136. package/dist/domain/hub/profile-requirements.js.map +1 -0
  137. package/dist/domain/hub/replicate.d.ts +23 -0
  138. package/dist/domain/hub/replicate.d.ts.map +1 -1
  139. package/dist/domain/hub/replicate.js +13 -0
  140. package/dist/domain/hub/replicate.js.map +1 -1
  141. package/dist/domain/hub/types.d.ts +2 -0
  142. package/dist/domain/hub/types.d.ts.map +1 -1
  143. package/dist/domain/hub/validate.d.ts +150 -2
  144. package/dist/domain/hub/validate.d.ts.map +1 -1
  145. package/dist/domain/hub/validate.js +421 -37
  146. package/dist/domain/hub/validate.js.map +1 -1
  147. package/dist/domain/index.d.ts +17 -0
  148. package/dist/domain/index.d.ts.map +1 -1
  149. package/dist/domain/index.js +17 -0
  150. package/dist/domain/index.js.map +1 -1
  151. package/dist/domain/install/category.d.ts +31 -0
  152. package/dist/domain/install/category.d.ts.map +1 -0
  153. package/dist/domain/install/category.js +33 -0
  154. package/dist/domain/install/category.js.map +1 -0
  155. package/dist/domain/install/file-mode.d.ts +49 -0
  156. package/dist/domain/install/file-mode.d.ts.map +1 -0
  157. package/dist/domain/install/file-mode.js +54 -0
  158. package/dist/domain/install/file-mode.js.map +1 -0
  159. package/dist/domain/install/git-exclude.d.ts +22 -0
  160. package/dist/domain/install/git-exclude.d.ts.map +1 -0
  161. package/dist/domain/install/git-exclude.js +56 -0
  162. package/dist/domain/install/git-exclude.js.map +1 -0
  163. package/dist/domain/install/installable.d.ts +2 -0
  164. package/dist/domain/install/installable.d.ts.map +1 -1
  165. package/dist/domain/install/kind-route.d.ts +80 -0
  166. package/dist/domain/install/kind-route.d.ts.map +1 -0
  167. package/dist/domain/install/kind-route.js +135 -0
  168. package/dist/domain/install/kind-route.js.map +1 -0
  169. package/dist/domain/install/record-errors.d.ts +53 -0
  170. package/dist/domain/install/record-errors.d.ts.map +1 -0
  171. package/dist/domain/install/record-errors.js +104 -0
  172. package/dist/domain/install/record-errors.js.map +1 -0
  173. package/dist/domain/install/record-object.d.ts +21 -0
  174. package/dist/domain/install/record-object.d.ts.map +1 -0
  175. package/dist/domain/install/record-object.js +38 -0
  176. package/dist/domain/install/record-object.js.map +1 -0
  177. package/dist/domain/install/record-parse.d.ts +23 -0
  178. package/dist/domain/install/record-parse.d.ts.map +1 -0
  179. package/dist/domain/install/record-parse.js +73 -0
  180. package/dist/domain/install/record-parse.js.map +1 -0
  181. package/dist/domain/install/record-path.d.ts +26 -0
  182. package/dist/domain/install/record-path.d.ts.map +1 -0
  183. package/dist/domain/install/record-path.js +130 -0
  184. package/dist/domain/install/record-path.js.map +1 -0
  185. package/dist/domain/install/record-types.d.ts +183 -0
  186. package/dist/domain/install/record-types.d.ts.map +1 -0
  187. package/dist/domain/install/record-types.js +92 -0
  188. package/dist/domain/install/record-types.js.map +1 -0
  189. package/dist/domain/install/types.d.ts +2 -0
  190. package/dist/domain/install/types.d.ts.map +1 -1
  191. package/dist/domain/mcp/index.d.ts +1 -0
  192. package/dist/domain/mcp/index.d.ts.map +1 -1
  193. package/dist/domain/mcp/index.js +1 -0
  194. package/dist/domain/mcp/index.js.map +1 -1
  195. package/dist/domain/mcp/server-key.d.ts +35 -0
  196. package/dist/domain/mcp/server-key.d.ts.map +1 -0
  197. package/dist/domain/mcp/server-key.js +44 -0
  198. package/dist/domain/mcp/server-key.js.map +1 -0
  199. package/dist/domain/plugin/agent-plugin-spec.d.ts +8 -0
  200. package/dist/domain/plugin/agent-plugin-spec.d.ts.map +1 -1
  201. package/dist/domain/plugin/agent-plugin-spec.js +22 -8
  202. package/dist/domain/plugin/agent-plugin-spec.js.map +1 -1
  203. package/dist/domain/registry-error.d.ts +1 -1
  204. package/dist/domain/registry-error.d.ts.map +1 -1
  205. package/dist/domain/registry-error.js +2 -1
  206. package/dist/domain/registry-error.js.map +1 -1
  207. package/dist/domain/security/fingerprint.d.ts +18 -0
  208. package/dist/domain/security/fingerprint.d.ts.map +1 -0
  209. package/dist/domain/security/fingerprint.js +34 -0
  210. package/dist/domain/security/fingerprint.js.map +1 -0
  211. package/dist/domain/security/high-impact-rules.d.ts +30 -0
  212. package/dist/domain/security/high-impact-rules.d.ts.map +1 -0
  213. package/dist/domain/security/high-impact-rules.js +160 -0
  214. package/dist/domain/security/high-impact-rules.js.map +1 -0
  215. package/dist/domain/security/index.d.ts +10 -0
  216. package/dist/domain/security/index.d.ts.map +1 -0
  217. package/dist/domain/security/index.js +26 -0
  218. package/dist/domain/security/index.js.map +1 -0
  219. package/dist/domain/security/markdown-context.d.ts +17 -0
  220. package/dist/domain/security/markdown-context.d.ts.map +1 -0
  221. package/dist/domain/security/markdown-context.js +74 -0
  222. package/dist/domain/security/markdown-context.js.map +1 -0
  223. package/dist/domain/security/policy.d.ts +17 -0
  224. package/dist/domain/security/policy.d.ts.map +1 -0
  225. package/dist/domain/security/policy.js +31 -0
  226. package/dist/domain/security/policy.js.map +1 -0
  227. package/dist/domain/security/rating/findings-document.d.ts +22 -0
  228. package/dist/domain/security/rating/findings-document.d.ts.map +1 -0
  229. package/dist/domain/security/rating/findings-document.js +57 -0
  230. package/dist/domain/security/rating/findings-document.js.map +1 -0
  231. package/dist/domain/security/rating/index.d.ts +5 -0
  232. package/dist/domain/security/rating/index.d.ts.map +1 -0
  233. package/dist/domain/security/rating/index.js +21 -0
  234. package/dist/domain/security/rating/index.js.map +1 -0
  235. package/dist/domain/security/rating/scoring.d.ts +83 -0
  236. package/dist/domain/security/rating/scoring.d.ts.map +1 -0
  237. package/dist/domain/security/rating/scoring.js +115 -0
  238. package/dist/domain/security/rating/scoring.js.map +1 -0
  239. package/dist/domain/security/rating/security-rating-report.d.ts +111 -0
  240. package/dist/domain/security/rating/security-rating-report.d.ts.map +1 -0
  241. package/dist/domain/security/rating/security-rating-report.js +152 -0
  242. package/dist/domain/security/rating/security-rating-report.js.map +1 -0
  243. package/dist/domain/security/rating/types.d.ts +22 -0
  244. package/dist/domain/security/rating/types.d.ts.map +1 -0
  245. package/dist/domain/security/rating/types.js +11 -0
  246. package/dist/domain/security/rating/types.js.map +1 -0
  247. package/dist/domain/security/remediations.d.ts +17 -0
  248. package/dist/domain/security/remediations.d.ts.map +1 -0
  249. package/dist/domain/security/remediations.js +61 -0
  250. package/dist/domain/security/remediations.js.map +1 -0
  251. package/dist/domain/security/rule-engine.d.ts +8 -0
  252. package/dist/domain/security/rule-engine.d.ts.map +1 -0
  253. package/dist/domain/security/rule-engine.js +875 -0
  254. package/dist/domain/security/rule-engine.js.map +1 -0
  255. package/dist/domain/security/suppression.d.ts +19 -0
  256. package/dist/domain/security/suppression.d.ts.map +1 -0
  257. package/dist/domain/security/suppression.js +78 -0
  258. package/dist/domain/security/suppression.js.map +1 -0
  259. package/dist/domain/security/types.d.ts +91 -0
  260. package/dist/domain/security/types.d.ts.map +1 -0
  261. package/dist/domain/security/types.js +10 -0
  262. package/dist/domain/security/types.js.map +1 -0
  263. package/dist/index.d.ts +8 -0
  264. package/dist/index.d.ts.map +1 -1
  265. package/dist/index.js +12 -1
  266. package/dist/index.js.map +1 -1
  267. package/dist/ports/app-storage.d.ts +11 -15
  268. package/dist/ports/app-storage.d.ts.map +1 -1
  269. package/dist/ports/app-storage.js +8 -8
  270. package/dist/ports/argv-process-runner.d.ts +6 -0
  271. package/dist/ports/argv-process-runner.d.ts.map +1 -0
  272. package/dist/ports/argv-process-runner.js +3 -0
  273. package/dist/ports/argv-process-runner.js.map +1 -0
  274. package/dist/ports/bundle-extractor.d.ts +16 -3
  275. package/dist/ports/bundle-extractor.d.ts.map +1 -1
  276. package/dist/ports/collection-contribution.d.ts +36 -0
  277. package/dist/ports/collection-contribution.d.ts.map +1 -0
  278. package/dist/ports/collection-contribution.js +3 -0
  279. package/dist/ports/collection-contribution.js.map +1 -0
  280. package/dist/ports/filesystem.d.ts +12 -0
  281. package/dist/ports/filesystem.d.ts.map +1 -1
  282. package/dist/ports/hub-collection-index.d.ts +27 -0
  283. package/dist/ports/hub-collection-index.d.ts.map +1 -0
  284. package/dist/ports/hub-collection-index.js +3 -0
  285. package/dist/ports/hub-collection-index.js.map +1 -0
  286. package/dist/ports/hub-contribution.d.ts +158 -0
  287. package/dist/ports/hub-contribution.d.ts.map +1 -0
  288. package/dist/ports/hub-contribution.js +3 -0
  289. package/dist/ports/hub-contribution.js.map +1 -0
  290. package/dist/ports/index.d.ts +12 -0
  291. package/dist/ports/index.d.ts.map +1 -1
  292. package/dist/ports/index.js +12 -0
  293. package/dist/ports/index.js.map +1 -1
  294. package/dist/ports/primitive-diagnostics-driver.d.ts +96 -0
  295. package/dist/ports/primitive-diagnostics-driver.d.ts.map +1 -0
  296. package/dist/ports/primitive-diagnostics-driver.js +3 -0
  297. package/dist/ports/primitive-diagnostics-driver.js.map +1 -0
  298. package/dist/ports/record-fs.d.ts +46 -0
  299. package/dist/ports/record-fs.d.ts.map +1 -0
  300. package/dist/ports/record-fs.js +9 -0
  301. package/dist/ports/record-fs.js.map +1 -0
  302. package/dist/ports/registry-operations.d.ts +3 -2
  303. package/dist/ports/registry-operations.d.ts.map +1 -1
  304. package/dist/ports/release-lookup.d.ts +24 -0
  305. package/dist/ports/release-lookup.d.ts.map +1 -0
  306. package/dist/ports/release-lookup.js +7 -0
  307. package/dist/ports/release-lookup.js.map +1 -0
  308. package/dist/ports/release-source.d.ts +17 -3
  309. package/dist/ports/release-source.d.ts.map +1 -1
  310. package/dist/ports/repository-exclusion.d.ts +30 -0
  311. package/dist/ports/repository-exclusion.d.ts.map +1 -0
  312. package/dist/ports/repository-exclusion.js +3 -0
  313. package/dist/ports/repository-exclusion.js.map +1 -0
  314. package/dist/ports/schema-validator.d.ts +25 -0
  315. package/dist/ports/schema-validator.d.ts.map +1 -0
  316. package/dist/ports/schema-validator.js +7 -0
  317. package/dist/ports/schema-validator.js.map +1 -0
  318. package/dist/ports/security-report-store.d.ts +9 -0
  319. package/dist/ports/security-report-store.d.ts.map +1 -0
  320. package/dist/ports/security-report-store.js +4 -0
  321. package/dist/ports/security-report-store.js.map +1 -0
  322. package/dist/ports/security-scan-engine.d.ts +32 -0
  323. package/dist/ports/security-scan-engine.d.ts.map +1 -0
  324. package/dist/ports/security-scan-engine.js +6 -0
  325. package/dist/ports/security-scan-engine.js.map +1 -0
  326. package/dist/ports/security-scan-input.d.ts +63 -0
  327. package/dist/ports/security-scan-input.d.ts.map +1 -0
  328. package/dist/ports/security-scan-input.js +3 -0
  329. package/dist/ports/security-scan-input.js.map +1 -0
  330. package/dist/ports/source-adapter.d.ts +11 -0
  331. package/dist/ports/source-adapter.d.ts.map +1 -1
  332. package/dist/public/schemas/collection.schema.json +0 -1
  333. package/dist/public/schemas/hub-governance.schema.json +21 -0
  334. package/dist/public/schemas/install-record.schema.json +343 -0
  335. package/dist/public/schemas/security-rating-report.schema.json +113 -0
  336. package/package.json +2 -2
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Domain layer — the primitive diagnostics report.
3
+ *
4
+ * `assemblePrimitiveReport` classifies the raw bundle and case results and
5
+ * builds the stable report in plan order, whatever the completion order.
6
+ * Fields may be added to the report, never renamed.
7
+ * @module domain/diagnostics/primitives/report
8
+ */
9
+ import type { TargetType } from '../../install/target';
10
+ import type { PrimitiveKind } from '../../primitive/types';
11
+ import type { InstallStatus } from './evaluators';
12
+ import type { KnownGap } from './known-gaps';
13
+ import type { PrimitiveDiagnosticsPlan } from './planner';
14
+ import type { ExpectedInstallStatus } from './support-matrix';
15
+ import type { DiagnosticCheck, DiagnosticScope, InvariantId, RollupOutcome } from './types';
16
+ /** Why a run could not start (setup steps) or the orchestration itself failed (`internal`). */
17
+ export interface PrimitiveDiagnosticsError {
18
+ step: 'preflight' | 'workspace' | 'sandbox' | 'fixture' | 'internal';
19
+ message: string;
20
+ }
21
+ /**
22
+ * Report of a `doctor diagnostics --primitives` run.
23
+ *
24
+ * Path labels are sandbox-relative ($HOME/…, $XDG_*\/…, $TMPDIR/…, <workspace>/…, <case>/…).
25
+ * `<workspace>` in a label = the case's project directory, not `workspace` below.
26
+ */
27
+ export interface PrimitiveDiagnosticsReport {
28
+ ok: boolean;
29
+ summary: {
30
+ cases: number;
31
+ pass: number;
32
+ knownGap: number;
33
+ fail: number;
34
+ bundles: {
35
+ bundles: number;
36
+ pass: number;
37
+ knownGap: number;
38
+ fail: number;
39
+ };
40
+ };
41
+ filters: PrimitiveDiagnosticsPlan['filters'];
42
+ notCovered: {
43
+ kinds: PrimitiveKind[];
44
+ };
45
+ bundles: {
46
+ id: string;
47
+ kinds: PrimitiveKind[];
48
+ outcome: RollupOutcome;
49
+ checks: DiagnosticCheck[];
50
+ }[];
51
+ cases: {
52
+ id: string;
53
+ bundle: string;
54
+ kinds: PrimitiveKind[];
55
+ target: TargetType;
56
+ scope: DiagnosticScope;
57
+ effectiveScope: string | null;
58
+ status: InstallStatus | null;
59
+ expectedStatus: ExpectedInstallStatus;
60
+ outcome: RollupOutcome;
61
+ gapIds: string[];
62
+ checks: DiagnosticCheck[];
63
+ destinations: string[];
64
+ durationMs: number;
65
+ }[];
66
+ /** `issue`: the GitHub issue that tracks the fix, when the entry names one. */
67
+ knownGaps: {
68
+ key: string;
69
+ id: string;
70
+ invariant: InvariantId;
71
+ absorbed: number;
72
+ issue?: number;
73
+ }[];
74
+ unusedKnownGaps: {
75
+ key: string;
76
+ id: string;
77
+ invariant: InvariantId;
78
+ issue?: number;
79
+ }[];
80
+ /** Absolute run workspace. */
81
+ workspace: string;
82
+ workspaceRetained: boolean;
83
+ durationMs: number;
84
+ /** Present only when the run could not start or the orchestration itself failed. */
85
+ error?: PrimitiveDiagnosticsError;
86
+ }
87
+ /** Raw (unclassified) checks of one bundle. */
88
+ export interface BundleResult {
89
+ id: string;
90
+ checks: readonly DiagnosticCheck[];
91
+ }
92
+ /** Raw (unclassified) result of one case. */
93
+ export interface CaseResult {
94
+ id: string;
95
+ effectiveScope: string | null;
96
+ status: InstallStatus | null;
97
+ checks: readonly DiagnosticCheck[];
98
+ destinations: readonly string[];
99
+ durationMs: number;
100
+ }
101
+ /** Run facts that are not results. */
102
+ export interface PrimitiveReportMeta {
103
+ workspace: string;
104
+ workspaceRetained: boolean;
105
+ durationMs: number;
106
+ error?: PrimitiveDiagnosticsError;
107
+ }
108
+ /**
109
+ * Assemble the report in plan order.
110
+ *
111
+ * With no error or an `internal` one, every planned bundle and case is
112
+ * reported; a planned item without a result gets `[HARNESS] not run:
113
+ * internal error`. A setup error reports no bundles and no cases.
114
+ * @param plan - The run's plan.
115
+ * @param bundleResults - Raw bundle results, in any order.
116
+ * @param caseResults - Raw case results, in any order.
117
+ * @param gaps - Known gaps the run classifies against.
118
+ * @param meta - Workspace, duration and error.
119
+ * @returns The report.
120
+ */
121
+ export declare function assemblePrimitiveReport(plan: PrimitiveDiagnosticsPlan, bundleResults: readonly BundleResult[], caseResults: readonly CaseResult[], gaps: readonly KnownGap[], meta: PrimitiveReportMeta): PrimitiveDiagnosticsReport;
122
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../../src/domain/diagnostics/primitives/report.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EACV,UAAU,EACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EACV,aAAa,EACd,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,QAAQ,EACT,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,wBAAwB,EACzB,MAAM,WAAW,CAAC;AACnB,OAAO,KAA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,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,yBAAyB,CAAC;CACnC;AAaD;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,wBAAwB,EAC9B,aAAa,EAAE,SAAS,YAAY,EAAE,EACtC,WAAW,EAAE,SAAS,UAAU,EAAE,EAClC,IAAI,EAAE,SAAS,QAAQ,EAAE,EACzB,IAAI,EAAE,mBAAmB,GACxB,0BAA0B,CA+D5B"}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assemblePrimitiveReport = assemblePrimitiveReport;
4
+ const classifier_1 = require("./classifier");
5
+ const NOT_RUN = { invariant: 'HARNESS', outcome: 'fail', detail: 'not run: internal error' };
6
+ const withIssue = (entry, gap) => (gap.issue === undefined ? entry : { ...entry, issue: gap.issue });
7
+ const tally = (outcomes) => ({
8
+ pass: outcomes.filter((o) => o === 'pass').length,
9
+ knownGap: outcomes.filter((o) => o === 'known-gap').length,
10
+ fail: outcomes.filter((o) => o === 'fail').length
11
+ });
12
+ /**
13
+ * Assemble the report in plan order.
14
+ *
15
+ * With no error or an `internal` one, every planned bundle and case is
16
+ * reported; a planned item without a result gets `[HARNESS] not run:
17
+ * internal error`. A setup error reports no bundles and no cases.
18
+ * @param plan - The run's plan.
19
+ * @param bundleResults - Raw bundle results, in any order.
20
+ * @param caseResults - Raw case results, in any order.
21
+ * @param gaps - Known gaps the run classifies against.
22
+ * @param meta - Workspace, duration and error.
23
+ * @returns The report.
24
+ */
25
+ function assemblePrimitiveReport(plan, bundleResults, caseResults, gaps, meta) {
26
+ const setupError = meta.error !== undefined && meta.error.step !== 'internal';
27
+ const bundleById = new Map(bundleResults.map((result) => [result.id, result]));
28
+ const caseById = new Map(caseResults.map((result) => [result.id, result]));
29
+ const records = [];
30
+ const bundles = setupError
31
+ ? []
32
+ : plan.bundles.map((bundle) => {
33
+ const classified = (0, classifier_1.classifyBundle)(bundle, bundleById.get(bundle.id)?.checks ?? [NOT_RUN], gaps);
34
+ records.push(...classified.records);
35
+ return { id: bundle.id, kinds: bundle.items.map((item) => item.kind), outcome: classified.outcome, checks: classified.checks };
36
+ });
37
+ const cases = setupError
38
+ ? []
39
+ : plan.cases.map((planned) => {
40
+ const result = caseById.get(planned.id);
41
+ const classified = (0, classifier_1.classifyCase)(planned, result?.checks ?? [NOT_RUN], gaps);
42
+ records.push(...classified.records);
43
+ return {
44
+ id: planned.id,
45
+ bundle: planned.bundle,
46
+ kinds: [...planned.kinds],
47
+ target: planned.target,
48
+ scope: planned.scope,
49
+ effectiveScope: result?.effectiveScope ?? null,
50
+ status: result?.status ?? null,
51
+ expectedStatus: planned.expectedStatus,
52
+ outcome: classified.outcome,
53
+ gapIds: classified.gapIds,
54
+ checks: classified.checks,
55
+ destinations: [...(result?.destinations ?? [])],
56
+ durationMs: result?.durationMs ?? 0
57
+ };
58
+ });
59
+ const absorbed = new Map();
60
+ for (const key of records.flatMap((record) => record.absorbedBy)) {
61
+ absorbed.set(key, (absorbed.get(key) ?? 0) + 1);
62
+ }
63
+ const caseTally = tally(cases.map((c) => c.outcome));
64
+ const bundleTally = tally(bundles.map((b) => b.outcome));
65
+ const report = {
66
+ ok: meta.error === undefined && caseTally.fail === 0 && bundleTally.fail === 0,
67
+ summary: { cases: cases.length, ...caseTally, bundles: { bundles: bundles.length, ...bundleTally } },
68
+ filters: plan.filters,
69
+ notCovered: plan.notCovered,
70
+ bundles,
71
+ cases,
72
+ knownGaps: gaps
73
+ .filter((gap) => (absorbed.get(gap.key) ?? 0) > 0)
74
+ .map((gap) => withIssue({ key: gap.key, id: gap.id, invariant: gap.invariant, absorbed: absorbed.get(gap.key) }, gap)),
75
+ unusedKnownGaps: (0, classifier_1.findUnusedKnownGaps)(records, gaps).map((gap) => withIssue({ key: gap.key, id: gap.id, invariant: gap.invariant }, gap)),
76
+ workspace: meta.workspace,
77
+ workspaceRetained: meta.workspaceRetained,
78
+ durationMs: meta.durationMs
79
+ };
80
+ if (meta.error !== undefined) {
81
+ report.error = meta.error;
82
+ }
83
+ return report;
84
+ }
85
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../../../../src/domain/diagnostics/primitives/report.ts"],"names":[],"mappings":";;AA6HA,0DAqEC;AApLD,6CAKsB;AAkFtB,MAAM,OAAO,GAAoB,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAC;AAE9G,MAAM,SAAS,GAAG,CAAmB,KAAQ,EAAE,GAAa,EAA0B,EAAE,CACtF,CAAC,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;AAErE,MAAM,KAAK,GAAG,CAAC,QAAkC,EAAoD,EAAE,CAAC,CAAC;IACvG,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,MAAM;IACjD,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,MAAM;IAC1D,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,MAAM;CAClD,CAAC,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,SAAgB,uBAAuB,CACrC,IAA8B,EAC9B,aAAsC,EACtC,WAAkC,EAClC,IAAyB,EACzB,IAAyB;IAEzB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;IAC9E,MAAM,UAAU,GAAG,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BAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC;IACF,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IAC5B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,59 @@
1
+ import type { PreparedSandbox, SnapshotRoot } from '../../../ports/primitive-diagnostics-driver';
2
+ /** Sandbox snapshot: label → sha256 hex of the file bytes. */
3
+ export type Snapshot = ReadonlyMap<string, string>;
4
+ /**
5
+ * Whether `p` is `root` or inside it, by path segments (never a string prefix).
6
+ * @param root - Absolute directory.
7
+ * @param p - Absolute path.
8
+ * @returns True when `p` is `root` or below it.
9
+ */
10
+ export declare function isInside(root: string, p: string): boolean;
11
+ /**
12
+ * Label an absolute path with the longest root that contains it.
13
+ * @param roots - Labelled roots.
14
+ * @param absolute - Absolute path.
15
+ * @returns `${label}/${relative}` with `/` separators, the bare label for the root itself,
16
+ * or undefined outside every root.
17
+ */
18
+ export declare function labelSandboxPath(roots: readonly SnapshotRoot[], absolute: string): string | undefined;
19
+ /**
20
+ * Absolute path of a sandbox label: the inverse of {@link labelSandboxPath}.
21
+ * @param roots - Labelled roots.
22
+ * @param label - `${rootLabel}/${relative}` or a bare root label.
23
+ * @returns The absolute path, or undefined when no root has the label's first segment.
24
+ */
25
+ export declare function resolveSandboxLabel(roots: readonly SnapshotRoot[], label: string): string | undefined;
26
+ /**
27
+ * Whether a sandbox label is APH bookkeeping rather than a user-facing write.
28
+ * `<case>/…` is never bookkeeping.
29
+ * @param label - Sandbox label.
30
+ * @returns True for APH state, lockfiles, project config, scratch dirs and `.git/**`.
31
+ */
32
+ export declare function isBookkeepingLabel(label: string): boolean;
33
+ /** Labels that differ between two snapshots, each list sorted. */
34
+ export interface SnapshotDiff {
35
+ added: string[];
36
+ modified: string[];
37
+ removed: string[];
38
+ }
39
+ /**
40
+ * Diff two snapshots.
41
+ * @param before - Earlier snapshot.
42
+ * @param after - Later snapshot.
43
+ * @returns Sorted added, modified and removed labels.
44
+ */
45
+ export declare function diffSnapshots(before: Snapshot, after: Snapshot): SnapshotDiff;
46
+ /**
47
+ * SHA-256 of bytes.
48
+ * @param bytes - Content.
49
+ * @returns Lowercase hex digest.
50
+ */
51
+ export declare const sha256Hex: (bytes: Uint8Array) => string;
52
+ /**
53
+ * Check that a prepared sandbox cannot write outside its case root.
54
+ * @param sandbox - Prepared sandbox.
55
+ * @returns The names of every `userDirs` entry and every `storage.<key>` value outside
56
+ * `sandbox.root`; empty when contained.
57
+ */
58
+ export declare function checkSandboxContainment(sandbox: PreparedSandbox): string[];
59
+ //# sourceMappingURL=sandbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../../../src/domain/diagnostics/primitives/sandbox.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACb,MAAM,6CAA6C,CAAC;AAKrD,8DAA8D;AAC9D,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEnD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAGzD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAYrG;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIrG;AAeD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAqBzD;AAED,kEAAkE;AAClE,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,GAAG,YAAY,CAkB7E;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,UAAU,KAAG,MAA0D,CAAC;AAEzG;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,EAAE,CAa1E"}
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.sha256Hex = void 0;
37
+ exports.isInside = isInside;
38
+ exports.labelSandboxPath = labelSandboxPath;
39
+ exports.resolveSandboxLabel = resolveSandboxLabel;
40
+ exports.isBookkeepingLabel = isBookkeepingLabel;
41
+ exports.diffSnapshots = diffSnapshots;
42
+ exports.checkSandboxContainment = checkSandboxContainment;
43
+ /**
44
+ * Domain layer — primitive diagnostics sandbox rules.
45
+ *
46
+ * Path containment, sandbox path labelling (`$HOME/…`, `$XDG_*`/…,
47
+ * `$TMPDIR/…`, `<workspace>/…`, `<case>/…`), the bookkeeping rule that
48
+ * separates APH's own state from user-facing writes, snapshot diffs and the
49
+ * containment check run before any command. Pure functions: no I/O.
50
+ *
51
+ * The bookkeeping names owned by app or infra are literals, because core
52
+ * cannot import them; an app drift-guard test labels the real constants and
53
+ * resolvers. The install record names come from core's `RECORD_FILE_NAMES`.
54
+ * @module domain/diagnostics/primitives/sandbox
55
+ */
56
+ const node_crypto_1 = require("node:crypto");
57
+ const path = __importStar(require("node:path"));
58
+ const record_types_1 = require("../../install/record-types");
59
+ /**
60
+ * Whether `p` is `root` or inside it, by path segments (never a string prefix).
61
+ * @param root - Absolute directory.
62
+ * @param p - Absolute path.
63
+ * @returns True when `p` is `root` or below it.
64
+ */
65
+ function isInside(root, p) {
66
+ const r = path.relative(root, p);
67
+ return r === '' || (!r.startsWith('..') && !path.isAbsolute(r));
68
+ }
69
+ /**
70
+ * Label an absolute path with the longest root that contains it.
71
+ * @param roots - Labelled roots.
72
+ * @param absolute - Absolute path.
73
+ * @returns `${label}/${relative}` with `/` separators, the bare label for the root itself,
74
+ * or undefined outside every root.
75
+ */
76
+ function labelSandboxPath(roots, absolute) {
77
+ let best;
78
+ for (const root of roots) {
79
+ if (isInside(root.path, absolute) && (best === undefined || root.path.length > best.path.length)) {
80
+ best = root;
81
+ }
82
+ }
83
+ if (best === undefined) {
84
+ return undefined;
85
+ }
86
+ const relative = path.relative(best.path, absolute).split(path.sep).join('/');
87
+ return relative === '' ? best.label : `${best.label}/${relative}`;
88
+ }
89
+ /**
90
+ * Absolute path of a sandbox label: the inverse of {@link labelSandboxPath}.
91
+ * @param roots - Labelled roots.
92
+ * @param label - `${rootLabel}/${relative}` or a bare root label.
93
+ * @returns The absolute path, or undefined when no root has the label's first segment.
94
+ */
95
+ function resolveSandboxLabel(roots, label) {
96
+ const [rootLabel, ...rest] = label.split('/');
97
+ const root = roots.find((candidate) => candidate.label === rootLabel);
98
+ return root === undefined ? undefined : path.join(root.path, ...rest);
99
+ }
100
+ /** APH's own sub-directory under each XDG base dir (infra `APP_SUBDIR`). */
101
+ const APP_SUBDIR = 'ai-primitives-hub';
102
+ const XDG_APP_LABELS = ['$XDG_CONFIG_HOME', '$XDG_DATA_HOME', '$XDG_CACHE_HOME', '$XDG_STATE_HOME'];
103
+ const SCRATCH_LABELS = ['$XDG_RUNTIME_DIR', '$TMPDIR'];
104
+ const WORKSPACE_BOOKKEEPING_FILES = new Set([
105
+ 'ai-primitives-hub.yml',
106
+ 'ai-primitives-hub.yaml',
107
+ 'prompt-registry.lock.json',
108
+ 'prompt-registry.local.lock.json',
109
+ ...record_types_1.RECORD_FILE_NAMES
110
+ ]);
111
+ const STATE_DIR = '.ai-primitives-hub';
112
+ /**
113
+ * Whether a sandbox label is APH bookkeeping rather than a user-facing write.
114
+ * `<case>/…` is never bookkeeping.
115
+ * @param label - Sandbox label.
116
+ * @returns True for APH state, lockfiles, project config, scratch dirs and `.git/**`.
117
+ */
118
+ function isBookkeepingLabel(label) {
119
+ const [root, ...rest] = label.split('/');
120
+ if (root === '<case>') {
121
+ return false;
122
+ }
123
+ if (rest.includes('.git')) {
124
+ return true;
125
+ }
126
+ if (SCRATCH_LABELS.includes(root)) {
127
+ return true;
128
+ }
129
+ if (XDG_APP_LABELS.includes(root)) {
130
+ return rest[0] === APP_SUBDIR;
131
+ }
132
+ if (root === '<workspace>') {
133
+ return (rest.length === 1 && WORKSPACE_BOOKKEEPING_FILES.has(rest[0])) || rest[0] === STATE_DIR;
134
+ }
135
+ if (root === '$HOME') {
136
+ return rest[0] === STATE_DIR;
137
+ }
138
+ return false;
139
+ }
140
+ /**
141
+ * Diff two snapshots.
142
+ * @param before - Earlier snapshot.
143
+ * @param after - Later snapshot.
144
+ * @returns Sorted added, modified and removed labels.
145
+ */
146
+ function diffSnapshots(before, after) {
147
+ const added = [];
148
+ const modified = [];
149
+ const removed = [];
150
+ for (const [label, digest] of after) {
151
+ const previous = before.get(label);
152
+ if (previous === undefined) {
153
+ added.push(label);
154
+ }
155
+ else if (previous !== digest) {
156
+ modified.push(label);
157
+ }
158
+ }
159
+ for (const label of before.keys()) {
160
+ if (!after.has(label)) {
161
+ removed.push(label);
162
+ }
163
+ }
164
+ return { added: added.toSorted(), modified: modified.toSorted(), removed: removed.toSorted() };
165
+ }
166
+ /**
167
+ * SHA-256 of bytes.
168
+ * @param bytes - Content.
169
+ * @returns Lowercase hex digest.
170
+ */
171
+ const sha256Hex = (bytes) => (0, node_crypto_1.createHash)('sha256').update(bytes).digest('hex');
172
+ exports.sha256Hex = sha256Hex;
173
+ /**
174
+ * Check that a prepared sandbox cannot write outside its case root.
175
+ * @param sandbox - Prepared sandbox.
176
+ * @returns The names of every `userDirs` entry and every `storage.<key>` value outside
177
+ * `sandbox.root`; empty when contained.
178
+ */
179
+ function checkSandboxContainment(sandbox) {
180
+ const escaped = [];
181
+ for (const [name, dir] of Object.entries(sandbox.userDirs)) {
182
+ if (!isInside(sandbox.root, dir)) {
183
+ escaped.push(name);
184
+ }
185
+ }
186
+ for (const [key, value] of Object.entries(sandbox.storage)) {
187
+ if (!isInside(sandbox.root, value)) {
188
+ escaped.push(`storage.${key}`);
189
+ }
190
+ }
191
+ return escaped;
192
+ }
193
+ //# sourceMappingURL=sandbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../../../../src/domain/diagnostics/prim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,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;AACjG,CAAC;AAED;;;;GAIG;AACI,MAAM,SAAS,GAAG,CAAC,KAAiB,EAAU,EAAE,CAAC,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAA5F,QAAA,SAAS,aAAmF;AAEzG;;;;;GAKG;AACH,SAAgB,uBAAuB,CAAC,OAAwB;IAC9D,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3D,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IACD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3D,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;YACnC,OAAO,CAAC,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Domain layer — primitive diagnostics support matrix.
3
+ *
4
+ * Which kind each target supports, as observed after #532. A cell the
5
+ * product should support but rejects today is `native` and covered by a
6
+ * known gap (`kiro-hook-rejected`, `kiro-plugin-rejected`, `mcp-server-rejected`).
7
+ * chat-mode on copilot-cli installs since #526. `projected` (installed
8
+ * through a projection onto another kind) is reserved and unused here.
9
+ * @module domain/diagnostics/primitives/support-matrix
10
+ */
11
+ import { type TargetType } from '../../install/target';
12
+ import type { PrimitiveKind } from '../../primitive/types';
13
+ /** How a target supports a kind. */
14
+ export type SupportLevel = 'native' | 'projected' | 'unsupported';
15
+ /** Support level per catalogued kind and target (same for both scopes). */
16
+ export declare const PRIMITIVE_SUPPORT_MATRIX: Readonly<Partial<Record<PrimitiveKind, Readonly<Record<TargetType, SupportLevel>>>>>;
17
+ /**
18
+ * Expected install status of a bundle on a target.
19
+ *
20
+ * `partial` is the contract for a bundle that mixes kinds the target
21
+ * supports with kinds it does not: the supported items install and the
22
+ * others are reported. The doctor runs the default all-or-nothing
23
+ * `install`, so a `partial` case is rejected and reported as a known gap;
24
+ * `install --skip-unsupported` (#550) is the opt-in partial install.
25
+ */
26
+ export type ExpectedInstallStatus = 'installed' | 'partial' | 'rejected';
27
+ /**
28
+ * Expected install status of a bundle on a target.
29
+ * @param kinds - Kinds of the bundle.
30
+ * @param target - Target type.
31
+ * @returns 'installed' when every kind is native/projected on the target, 'rejected' when
32
+ * none is, else 'partial'. A single-kind bundle is never 'partial'.
33
+ * @throws {Error} When a kind has no support-matrix row.
34
+ */
35
+ export declare function expectedStatus(kinds: readonly PrimitiveKind[], target: TargetType): ExpectedInstallStatus;
36
+ //# sourceMappingURL=support-matrix.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support-matrix.d.ts","sourceRoot":"","sources":["../../../../src/domain/diagnostics/primitives/support-matrix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAEL,KAAK,UAAU,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B,oCAAoC;AACpC,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,WAAW,GAAG,aAAa,CAAC;AAalE,2EAA2E;AAC3E,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAkBzH,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CAAC;AAEzE;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,EAAE,MAAM,EAAE,UAAU,GAAG,qBAAqB,CAezG"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PRIMITIVE_SUPPORT_MATRIX = void 0;
4
+ exports.expectedStatus = expectedStatus;
5
+ /**
6
+ * Domain layer — primitive diagnostics support matrix.
7
+ *
8
+ * Which kind each target supports, as observed after #532. A cell the
9
+ * product should support but rejects today is `native` and covered by a
10
+ * known gap (`kiro-hook-rejected`, `kiro-plugin-rejected`, `mcp-server-rejected`).
11
+ * chat-mode on copilot-cli installs since #526. `projected` (installed
12
+ * through a projection onto another kind) is reserved and unused here.
13
+ * @module domain/diagnostics/primitives/support-matrix
14
+ */
15
+ const target_1 = require("../../install/target");
16
+ /**
17
+ * Build a matrix row.
18
+ * @param supportedOn - Targets with native support, or 'all'.
19
+ * @returns One level per target, in `TARGET_TYPES` order.
20
+ */
21
+ const row = (supportedOn) => Object.fromEntries(target_1.TARGET_TYPES.map((target) => [
22
+ target,
23
+ supportedOn === 'all' || supportedOn.includes(target) ? 'native' : 'unsupported'
24
+ ]));
25
+ /** Support level per catalogued kind and target (same for both scopes). */
26
+ exports.PRIMITIVE_SUPPORT_MATRIX = {
27
+ prompt: row('all'),
28
+ instruction: row('all'),
29
+ 'chat-mode': row('all'),
30
+ agent: row('all'),
31
+ skill: row('all'),
32
+ plugin: row('all'),
33
+ hook: row('all'),
34
+ 'mcp-server': row('all'),
35
+ steering: row(['kiro', 'kiro-cli']),
36
+ spec: row(['kiro', 'kiro-cli']),
37
+ command: row(['claude-code']),
38
+ rule: row(['cursor']),
39
+ 'output-style': row(['claude-code']),
40
+ tool: row(['opencode']),
41
+ power: row(['kiro', 'kiro-cli', 'devin', 'devin-cli']),
42
+ knowledge: row(['devin', 'devin-cli']),
43
+ playbook: row(['devin', 'devin-cli'])
44
+ };
45
+ /**
46
+ * Expected install status of a bundle on a target.
47
+ * @param kinds - Kinds of the bundle.
48
+ * @param target - Target type.
49
+ * @returns 'installed' when every kind is native/projected on the target, 'rejected' when
50
+ * none is, else 'partial'. A single-kind bundle is never 'partial'.
51
+ * @throws {Error} When a kind has no support-matrix row.
52
+ */
53
+ function expectedStatus(kinds, target) {
54
+ let supported = 0;
55
+ for (const kind of kinds) {
56
+ const levels = exports.PRIMITIVE_SUPPORT_MATRIX[kind];
57
+ if (levels === undefined) {
58
+ throw new Error(`no support-matrix row for ${kind}`);
59
+ }
60
+ if (levels[target] !== 'unsupported') {
61
+ supported += 1;
62
+ }
63
+ }
64
+ if (supported === kinds.length) {
65
+ return 'installed';
66
+ }
67
+ return supported === 0 ? 'rejected' : 'partial';
68
+ }
69
+ //# sourceMappingURL=support-matrix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support-matrix.js","sourceRoot":"","sources":["../../../../src/domain/diagnostics/primitives/support-matrix.ts"],"names":[],"mappings":";;;AAwEA,wCAeC;AAvFD;;;;;;;;;GASG;AACH,iDAG8B;AAQ9B;;;;GAIG;AACH,MAAM,GAAG,GAAG,CAAC,WAA0C,EAA8C,EAAE,CACrG,MAAM,CAAC,WAAW,CAAC,qBAAY,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;IAC9C,MAAM;IACN,WAAW,KAAK,KAAK,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ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