@opensip-cli/core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (604) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +8 -0
  3. package/README.md +31 -0
  4. package/dist/__tests__/config-resolution.test.d.ts +2 -0
  5. package/dist/__tests__/config-resolution.test.d.ts.map +1 -0
  6. package/dist/__tests__/config-resolution.test.js +94 -0
  7. package/dist/__tests__/config-resolution.test.js.map +1 -0
  8. package/dist/__tests__/public-api.test.d.ts +16 -0
  9. package/dist/__tests__/public-api.test.d.ts.map +1 -0
  10. package/dist/__tests__/public-api.test.js +209 -0
  11. package/dist/__tests__/public-api.test.js.map +1 -0
  12. package/dist/__tests__/signal-batch.test.d.ts +2 -0
  13. package/dist/__tests__/signal-batch.test.d.ts.map +1 -0
  14. package/dist/__tests__/signal-batch.test.js +39 -0
  15. package/dist/__tests__/signal-batch.test.js.map +1 -0
  16. package/dist/__tests__/signal-sink.test.d.ts +2 -0
  17. package/dist/__tests__/signal-sink.test.d.ts.map +1 -0
  18. package/dist/__tests__/signal-sink.test.js +25 -0
  19. package/dist/__tests__/signal-sink.test.js.map +1 -0
  20. package/dist/__tests__/strip-utils.test.d.ts +2 -0
  21. package/dist/__tests__/strip-utils.test.d.ts.map +1 -0
  22. package/dist/__tests__/strip-utils.test.js +397 -0
  23. package/dist/__tests__/strip-utils.test.js.map +1 -0
  24. package/dist/__tests__/text-tree.test.d.ts +2 -0
  25. package/dist/__tests__/text-tree.test.d.ts.map +1 -0
  26. package/dist/__tests__/text-tree.test.js +31 -0
  27. package/dist/__tests__/text-tree.test.js.map +1 -0
  28. package/dist/baseline/__tests__/fingerprint-strategy.test.d.ts +2 -0
  29. package/dist/baseline/__tests__/fingerprint-strategy.test.d.ts.map +1 -0
  30. package/dist/baseline/__tests__/fingerprint-strategy.test.js +69 -0
  31. package/dist/baseline/__tests__/fingerprint-strategy.test.js.map +1 -0
  32. package/dist/baseline/fingerprint-strategy.d.ts +70 -0
  33. package/dist/baseline/fingerprint-strategy.d.ts.map +1 -0
  34. package/dist/baseline/fingerprint-strategy.js +90 -0
  35. package/dist/baseline/fingerprint-strategy.js.map +1 -0
  36. package/dist/config-resolution.d.ts +27 -0
  37. package/dist/config-resolution.d.ts.map +1 -0
  38. package/dist/config-resolution.js +92 -0
  39. package/dist/config-resolution.js.map +1 -0
  40. package/dist/index.d.ts +81 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +165 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/languages/__tests__/content-filter-dispatch.test.d.ts +2 -0
  45. package/dist/languages/__tests__/content-filter-dispatch.test.d.ts.map +1 -0
  46. package/dist/languages/__tests__/content-filter-dispatch.test.js +87 -0
  47. package/dist/languages/__tests__/content-filter-dispatch.test.js.map +1 -0
  48. package/dist/languages/__tests__/non-code-formats.test.d.ts +2 -0
  49. package/dist/languages/__tests__/non-code-formats.test.d.ts.map +1 -0
  50. package/dist/languages/__tests__/non-code-formats.test.js +31 -0
  51. package/dist/languages/__tests__/non-code-formats.test.js.map +1 -0
  52. package/dist/languages/__tests__/parse-cache.test.d.ts +2 -0
  53. package/dist/languages/__tests__/parse-cache.test.d.ts.map +1 -0
  54. package/dist/languages/__tests__/parse-cache.test.js +228 -0
  55. package/dist/languages/__tests__/parse-cache.test.js.map +1 -0
  56. package/dist/languages/__tests__/registry.test.d.ts +2 -0
  57. package/dist/languages/__tests__/registry.test.d.ts.map +1 -0
  58. package/dist/languages/__tests__/registry.test.js +193 -0
  59. package/dist/languages/__tests__/registry.test.js.map +1 -0
  60. package/dist/languages/__tests__/workspace-unit-contract.test.d.ts +2 -0
  61. package/dist/languages/__tests__/workspace-unit-contract.test.d.ts.map +1 -0
  62. package/dist/languages/__tests__/workspace-unit-contract.test.js +66 -0
  63. package/dist/languages/__tests__/workspace-unit-contract.test.js.map +1 -0
  64. package/dist/languages/adapter.d.ts +66 -0
  65. package/dist/languages/adapter.d.ts.map +1 -0
  66. package/dist/languages/adapter.js +2 -0
  67. package/dist/languages/adapter.js.map +1 -0
  68. package/dist/languages/content-filter-dispatch.d.ts +36 -0
  69. package/dist/languages/content-filter-dispatch.d.ts.map +1 -0
  70. package/dist/languages/content-filter-dispatch.js +75 -0
  71. package/dist/languages/content-filter-dispatch.js.map +1 -0
  72. package/dist/languages/generic-types.d.ts +22 -0
  73. package/dist/languages/generic-types.d.ts.map +1 -0
  74. package/dist/languages/generic-types.js +3 -0
  75. package/dist/languages/generic-types.js.map +1 -0
  76. package/dist/languages/index.d.ts +12 -0
  77. package/dist/languages/index.d.ts.map +1 -0
  78. package/dist/languages/index.js +7 -0
  79. package/dist/languages/index.js.map +1 -0
  80. package/dist/languages/non-code-formats.d.ts +37 -0
  81. package/dist/languages/non-code-formats.d.ts.map +1 -0
  82. package/dist/languages/non-code-formats.js +45 -0
  83. package/dist/languages/non-code-formats.js.map +1 -0
  84. package/dist/languages/parse-cache-class.d.ts +69 -0
  85. package/dist/languages/parse-cache-class.d.ts.map +1 -0
  86. package/dist/languages/parse-cache-class.js +135 -0
  87. package/dist/languages/parse-cache-class.js.map +1 -0
  88. package/dist/languages/parse-cache.d.ts +54 -0
  89. package/dist/languages/parse-cache.d.ts.map +1 -0
  90. package/dist/languages/parse-cache.js +88 -0
  91. package/dist/languages/parse-cache.js.map +1 -0
  92. package/dist/languages/registry.d.ts +35 -0
  93. package/dist/languages/registry.d.ts.map +1 -0
  94. package/dist/languages/registry.js +123 -0
  95. package/dist/languages/registry.js.map +1 -0
  96. package/dist/languages/strip-scanners.d.ts +170 -0
  97. package/dist/languages/strip-scanners.d.ts.map +1 -0
  98. package/dist/languages/strip-scanners.js +233 -0
  99. package/dist/languages/strip-scanners.js.map +1 -0
  100. package/dist/languages/strip-utils.d.ts +66 -0
  101. package/dist/languages/strip-utils.d.ts.map +1 -0
  102. package/dist/languages/strip-utils.js +88 -0
  103. package/dist/languages/strip-utils.js.map +1 -0
  104. package/dist/languages/text-tree.d.ts +44 -0
  105. package/dist/languages/text-tree.d.ts.map +1 -0
  106. package/dist/languages/text-tree.js +34 -0
  107. package/dist/languages/text-tree.js.map +1 -0
  108. package/dist/languages/workspace-unit.d.ts +18 -0
  109. package/dist/languages/workspace-unit.d.ts.map +1 -0
  110. package/dist/languages/workspace-unit.js +2 -0
  111. package/dist/languages/workspace-unit.js.map +1 -0
  112. package/dist/lib/__tests__/config-version.test.d.ts +12 -0
  113. package/dist/lib/__tests__/config-version.test.d.ts.map +1 -0
  114. package/dist/lib/__tests__/config-version.test.js +92 -0
  115. package/dist/lib/__tests__/config-version.test.js.map +1 -0
  116. package/dist/lib/__tests__/diagnostics-bus.test.d.ts +7 -0
  117. package/dist/lib/__tests__/diagnostics-bus.test.d.ts.map +1 -0
  118. package/dist/lib/__tests__/diagnostics-bus.test.js +44 -0
  119. package/dist/lib/__tests__/diagnostics-bus.test.js.map +1 -0
  120. package/dist/lib/__tests__/env-registry.test.d.ts +7 -0
  121. package/dist/lib/__tests__/env-registry.test.d.ts.map +1 -0
  122. package/dist/lib/__tests__/env-registry.test.js +82 -0
  123. package/dist/lib/__tests__/env-registry.test.js.map +1 -0
  124. package/dist/lib/__tests__/errors.test.d.ts +2 -0
  125. package/dist/lib/__tests__/errors.test.d.ts.map +1 -0
  126. package/dist/lib/__tests__/errors.test.js +218 -0
  127. package/dist/lib/__tests__/errors.test.js.map +1 -0
  128. package/dist/lib/__tests__/format.test.d.ts +2 -0
  129. package/dist/lib/__tests__/format.test.d.ts.map +1 -0
  130. package/dist/lib/__tests__/format.test.js +23 -0
  131. package/dist/lib/__tests__/format.test.js.map +1 -0
  132. package/dist/lib/__tests__/ids.test.d.ts +2 -0
  133. package/dist/lib/__tests__/ids.test.d.ts.map +1 -0
  134. package/dist/lib/__tests__/ids.test.js +80 -0
  135. package/dist/lib/__tests__/ids.test.js.map +1 -0
  136. package/dist/lib/__tests__/logger.test.d.ts +2 -0
  137. package/dist/lib/__tests__/logger.test.d.ts.map +1 -0
  138. package/dist/lib/__tests__/logger.test.js +284 -0
  139. package/dist/lib/__tests__/logger.test.js.map +1 -0
  140. package/dist/lib/__tests__/package-version.test.d.ts +2 -0
  141. package/dist/lib/__tests__/package-version.test.d.ts.map +1 -0
  142. package/dist/lib/__tests__/package-version.test.js +47 -0
  143. package/dist/lib/__tests__/package-version.test.js.map +1 -0
  144. package/dist/lib/__tests__/paths.test.d.ts +5 -0
  145. package/dist/lib/__tests__/paths.test.d.ts.map +1 -0
  146. package/dist/lib/__tests__/paths.test.js +59 -0
  147. package/dist/lib/__tests__/paths.test.js.map +1 -0
  148. package/dist/lib/__tests__/payload-version.test.d.ts +2 -0
  149. package/dist/lib/__tests__/payload-version.test.d.ts.map +1 -0
  150. package/dist/lib/__tests__/payload-version.test.js +35 -0
  151. package/dist/lib/__tests__/payload-version.test.js.map +1 -0
  152. package/dist/lib/__tests__/phantom-detect.test.d.ts +10 -0
  153. package/dist/lib/__tests__/phantom-detect.test.d.ts.map +1 -0
  154. package/dist/lib/__tests__/phantom-detect.test.js +84 -0
  155. package/dist/lib/__tests__/phantom-detect.test.js.map +1 -0
  156. package/dist/lib/__tests__/project-context.test.d.ts +10 -0
  157. package/dist/lib/__tests__/project-context.test.d.ts.map +1 -0
  158. package/dist/lib/__tests__/project-context.test.js +240 -0
  159. package/dist/lib/__tests__/project-context.test.js.map +1 -0
  160. package/dist/lib/__tests__/registry.test.d.ts +2 -0
  161. package/dist/lib/__tests__/registry.test.d.ts.map +1 -0
  162. package/dist/lib/__tests__/registry.test.js +333 -0
  163. package/dist/lib/__tests__/registry.test.js.map +1 -0
  164. package/dist/lib/__tests__/retry.test.d.ts +2 -0
  165. package/dist/lib/__tests__/retry.test.d.ts.map +1 -0
  166. package/dist/lib/__tests__/retry.test.js +71 -0
  167. package/dist/lib/__tests__/retry.test.js.map +1 -0
  168. package/dist/lib/__tests__/run-diagnostics.test.d.ts +9 -0
  169. package/dist/lib/__tests__/run-diagnostics.test.d.ts.map +1 -0
  170. package/dist/lib/__tests__/run-diagnostics.test.js +61 -0
  171. package/dist/lib/__tests__/run-diagnostics.test.js.map +1 -0
  172. package/dist/lib/__tests__/run-scope.test.d.ts +2 -0
  173. package/dist/lib/__tests__/run-scope.test.d.ts.map +1 -0
  174. package/dist/lib/__tests__/run-scope.test.js +202 -0
  175. package/dist/lib/__tests__/run-scope.test.js.map +1 -0
  176. package/dist/lib/__tests__/run-timer.test.d.ts +2 -0
  177. package/dist/lib/__tests__/run-timer.test.d.ts.map +1 -0
  178. package/dist/lib/__tests__/run-timer.test.js +152 -0
  179. package/dist/lib/__tests__/run-timer.test.js.map +1 -0
  180. package/dist/lib/__tests__/severity-policy.test.d.ts +6 -0
  181. package/dist/lib/__tests__/severity-policy.test.d.ts.map +1 -0
  182. package/dist/lib/__tests__/severity-policy.test.js +47 -0
  183. package/dist/lib/__tests__/severity-policy.test.js.map +1 -0
  184. package/dist/lib/__tests__/telemetry.test.d.ts +2 -0
  185. package/dist/lib/__tests__/telemetry.test.d.ts.map +1 -0
  186. package/dist/lib/__tests__/telemetry.test.js +212 -0
  187. package/dist/lib/__tests__/telemetry.test.js.map +1 -0
  188. package/dist/lib/__tests__/verdict-policy.test.d.ts +7 -0
  189. package/dist/lib/__tests__/verdict-policy.test.d.ts.map +1 -0
  190. package/dist/lib/__tests__/verdict-policy.test.js +91 -0
  191. package/dist/lib/__tests__/verdict-policy.test.js.map +1 -0
  192. package/dist/lib/__tests__/yaml.test.d.ts +6 -0
  193. package/dist/lib/__tests__/yaml.test.d.ts.map +1 -0
  194. package/dist/lib/__tests__/yaml.test.js +79 -0
  195. package/dist/lib/__tests__/yaml.test.js.map +1 -0
  196. package/dist/lib/config-version.d.ts +49 -0
  197. package/dist/lib/config-version.d.ts.map +1 -0
  198. package/dist/lib/config-version.js +56 -0
  199. package/dist/lib/config-version.js.map +1 -0
  200. package/dist/lib/diagnostics-bus.d.ts +48 -0
  201. package/dist/lib/diagnostics-bus.d.ts.map +1 -0
  202. package/dist/lib/diagnostics-bus.js +74 -0
  203. package/dist/lib/diagnostics-bus.js.map +1 -0
  204. package/dist/lib/env-registry.d.ts +108 -0
  205. package/dist/lib/env-registry.d.ts.map +1 -0
  206. package/dist/lib/env-registry.js +92 -0
  207. package/dist/lib/env-registry.js.map +1 -0
  208. package/dist/lib/errors.d.ts +132 -0
  209. package/dist/lib/errors.d.ts.map +1 -0
  210. package/dist/lib/errors.js +160 -0
  211. package/dist/lib/errors.js.map +1 -0
  212. package/dist/lib/execution/__tests__/execution.test.d.ts +7 -0
  213. package/dist/lib/execution/__tests__/execution.test.d.ts.map +1 -0
  214. package/dist/lib/execution/__tests__/execution.test.js +254 -0
  215. package/dist/lib/execution/__tests__/execution.test.js.map +1 -0
  216. package/dist/lib/execution/index.d.ts +15 -0
  217. package/dist/lib/execution/index.d.ts.map +1 -0
  218. package/dist/lib/execution/index.js +10 -0
  219. package/dist/lib/execution/index.js.map +1 -0
  220. package/dist/lib/execution/options.d.ts +32 -0
  221. package/dist/lib/execution/options.d.ts.map +1 -0
  222. package/dist/lib/execution/options.js +15 -0
  223. package/dist/lib/execution/options.js.map +1 -0
  224. package/dist/lib/execution/pipeline.d.ts +36 -0
  225. package/dist/lib/execution/pipeline.d.ts.map +1 -0
  226. package/dist/lib/execution/pipeline.js +38 -0
  227. package/dist/lib/execution/pipeline.js.map +1 -0
  228. package/dist/lib/execution/retry.d.ts +38 -0
  229. package/dist/lib/execution/retry.d.ts.map +1 -0
  230. package/dist/lib/execution/retry.js +56 -0
  231. package/dist/lib/execution/retry.js.map +1 -0
  232. package/dist/lib/execution/run-with-timeout.d.ts +46 -0
  233. package/dist/lib/execution/run-with-timeout.d.ts.map +1 -0
  234. package/dist/lib/execution/run-with-timeout.js +86 -0
  235. package/dist/lib/execution/run-with-timeout.js.map +1 -0
  236. package/dist/lib/execution/schedule.d.ts +62 -0
  237. package/dist/lib/execution/schedule.d.ts.map +1 -0
  238. package/dist/lib/execution/schedule.js +130 -0
  239. package/dist/lib/execution/schedule.js.map +1 -0
  240. package/dist/lib/format.d.ts +17 -0
  241. package/dist/lib/format.d.ts.map +1 -0
  242. package/dist/lib/format.js +26 -0
  243. package/dist/lib/format.js.map +1 -0
  244. package/dist/lib/ids.d.ts +13 -0
  245. package/dist/lib/ids.d.ts.map +1 -0
  246. package/dist/lib/ids.js +48 -0
  247. package/dist/lib/ids.js.map +1 -0
  248. package/dist/lib/logger.d.ts +166 -0
  249. package/dist/lib/logger.d.ts.map +1 -0
  250. package/dist/lib/logger.js +283 -0
  251. package/dist/lib/logger.js.map +1 -0
  252. package/dist/lib/package-version.d.ts +17 -0
  253. package/dist/lib/package-version.d.ts.map +1 -0
  254. package/dist/lib/package-version.js +52 -0
  255. package/dist/lib/package-version.js.map +1 -0
  256. package/dist/lib/paths.d.ts +139 -0
  257. package/dist/lib/paths.d.ts.map +1 -0
  258. package/dist/lib/paths.js +105 -0
  259. package/dist/lib/paths.js.map +1 -0
  260. package/dist/lib/payload-version.d.ts +15 -0
  261. package/dist/lib/payload-version.d.ts.map +1 -0
  262. package/dist/lib/payload-version.js +24 -0
  263. package/dist/lib/payload-version.js.map +1 -0
  264. package/dist/lib/phantom-detect.d.ts +21 -0
  265. package/dist/lib/phantom-detect.d.ts.map +1 -0
  266. package/dist/lib/phantom-detect.js +76 -0
  267. package/dist/lib/phantom-detect.js.map +1 -0
  268. package/dist/lib/project-context.d.ts +66 -0
  269. package/dist/lib/project-context.d.ts.map +1 -0
  270. package/dist/lib/project-context.js +112 -0
  271. package/dist/lib/project-context.js.map +1 -0
  272. package/dist/lib/recipe-id.d.ts +13 -0
  273. package/dist/lib/recipe-id.d.ts.map +1 -0
  274. package/dist/lib/recipe-id.js +15 -0
  275. package/dist/lib/recipe-id.js.map +1 -0
  276. package/dist/lib/registry.d.ts +98 -0
  277. package/dist/lib/registry.d.ts.map +1 -0
  278. package/dist/lib/registry.js +152 -0
  279. package/dist/lib/registry.js.map +1 -0
  280. package/dist/lib/retry.d.ts +26 -0
  281. package/dist/lib/retry.d.ts.map +1 -0
  282. package/dist/lib/retry.js +48 -0
  283. package/dist/lib/retry.js.map +1 -0
  284. package/dist/lib/run-diagnostics.d.ts +64 -0
  285. package/dist/lib/run-diagnostics.d.ts.map +1 -0
  286. package/dist/lib/run-diagnostics.js +25 -0
  287. package/dist/lib/run-diagnostics.js.map +1 -0
  288. package/dist/lib/run-scope.d.ts +167 -0
  289. package/dist/lib/run-scope.d.ts.map +1 -0
  290. package/dist/lib/run-scope.js +176 -0
  291. package/dist/lib/run-scope.js.map +1 -0
  292. package/dist/lib/run-timer.d.ts +82 -0
  293. package/dist/lib/run-timer.d.ts.map +1 -0
  294. package/dist/lib/run-timer.js +79 -0
  295. package/dist/lib/run-timer.js.map +1 -0
  296. package/dist/lib/scope-types.d.ts +172 -0
  297. package/dist/lib/scope-types.d.ts.map +1 -0
  298. package/dist/lib/scope-types.js +27 -0
  299. package/dist/lib/scope-types.js.map +1 -0
  300. package/dist/lib/severity-policy.d.ts +38 -0
  301. package/dist/lib/severity-policy.d.ts.map +1 -0
  302. package/dist/lib/severity-policy.js +44 -0
  303. package/dist/lib/severity-policy.js.map +1 -0
  304. package/dist/lib/telemetry.d.ts +93 -0
  305. package/dist/lib/telemetry.d.ts.map +1 -0
  306. package/dist/lib/telemetry.js +144 -0
  307. package/dist/lib/telemetry.js.map +1 -0
  308. package/dist/lib/ui-context.d.ts +34 -0
  309. package/dist/lib/ui-context.d.ts.map +1 -0
  310. package/dist/lib/ui-context.js +16 -0
  311. package/dist/lib/ui-context.js.map +1 -0
  312. package/dist/lib/verdict-policy.d.ts +71 -0
  313. package/dist/lib/verdict-policy.d.ts.map +1 -0
  314. package/dist/lib/verdict-policy.js +82 -0
  315. package/dist/lib/verdict-policy.js.map +1 -0
  316. package/dist/lib/yaml.d.ts +74 -0
  317. package/dist/lib/yaml.d.ts.map +1 -0
  318. package/dist/lib/yaml.js +118 -0
  319. package/dist/lib/yaml.js.map +1 -0
  320. package/dist/plugins/__tests__/as-if-external.test.d.ts +18 -0
  321. package/dist/plugins/__tests__/as-if-external.test.d.ts.map +1 -0
  322. package/dist/plugins/__tests__/as-if-external.test.js +159 -0
  323. package/dist/plugins/__tests__/as-if-external.test.js.map +1 -0
  324. package/dist/plugins/__tests__/authored-tool-discovery.test.d.ts +8 -0
  325. package/dist/plugins/__tests__/authored-tool-discovery.test.d.ts.map +1 -0
  326. package/dist/plugins/__tests__/authored-tool-discovery.test.js +97 -0
  327. package/dist/plugins/__tests__/authored-tool-discovery.test.js.map +1 -0
  328. package/dist/plugins/__tests__/capability-discovery.test.d.ts +2 -0
  329. package/dist/plugins/__tests__/capability-discovery.test.d.ts.map +1 -0
  330. package/dist/plugins/__tests__/capability-discovery.test.js +349 -0
  331. package/dist/plugins/__tests__/capability-discovery.test.js.map +1 -0
  332. package/dist/plugins/__tests__/capability-from-manifest.test.d.ts +2 -0
  333. package/dist/plugins/__tests__/capability-from-manifest.test.d.ts.map +1 -0
  334. package/dist/plugins/__tests__/capability-from-manifest.test.js +172 -0
  335. package/dist/plugins/__tests__/capability-from-manifest.test.js.map +1 -0
  336. package/dist/plugins/__tests__/capability-loader.test.d.ts +2 -0
  337. package/dist/plugins/__tests__/capability-loader.test.d.ts.map +1 -0
  338. package/dist/plugins/__tests__/capability-loader.test.js +122 -0
  339. package/dist/plugins/__tests__/capability-loader.test.js.map +1 -0
  340. package/dist/plugins/__tests__/capability-registry.test.d.ts +2 -0
  341. package/dist/plugins/__tests__/capability-registry.test.d.ts.map +1 -0
  342. package/dist/plugins/__tests__/capability-registry.test.js +185 -0
  343. package/dist/plugins/__tests__/capability-registry.test.js.map +1 -0
  344. package/dist/plugins/__tests__/discover.test.d.ts +2 -0
  345. package/dist/plugins/__tests__/discover.test.d.ts.map +1 -0
  346. package/dist/plugins/__tests__/discover.test.js +311 -0
  347. package/dist/plugins/__tests__/discover.test.js.map +1 -0
  348. package/dist/plugins/__tests__/loader.test.d.ts +2 -0
  349. package/dist/plugins/__tests__/loader.test.d.ts.map +1 -0
  350. package/dist/plugins/__tests__/loader.test.js +191 -0
  351. package/dist/plugins/__tests__/loader.test.js.map +1 -0
  352. package/dist/plugins/__tests__/manifest-discovery.test.d.ts +2 -0
  353. package/dist/plugins/__tests__/manifest-discovery.test.d.ts.map +1 -0
  354. package/dist/plugins/__tests__/manifest-discovery.test.js +132 -0
  355. package/dist/plugins/__tests__/manifest-discovery.test.js.map +1 -0
  356. package/dist/plugins/__tests__/manifest-loader.test.d.ts +2 -0
  357. package/dist/plugins/__tests__/manifest-loader.test.d.ts.map +1 -0
  358. package/dist/plugins/__tests__/manifest-loader.test.js +434 -0
  359. package/dist/plugins/__tests__/manifest-loader.test.js.map +1 -0
  360. package/dist/plugins/__tests__/marker-discovery.test.d.ts +2 -0
  361. package/dist/plugins/__tests__/marker-discovery.test.d.ts.map +1 -0
  362. package/dist/plugins/__tests__/marker-discovery.test.js +164 -0
  363. package/dist/plugins/__tests__/marker-discovery.test.js.map +1 -0
  364. package/dist/plugins/__tests__/node-modules-walk.test.d.ts +2 -0
  365. package/dist/plugins/__tests__/node-modules-walk.test.d.ts.map +1 -0
  366. package/dist/plugins/__tests__/node-modules-walk.test.js +76 -0
  367. package/dist/plugins/__tests__/node-modules-walk.test.js.map +1 -0
  368. package/dist/plugins/__tests__/package-entry.test.d.ts +9 -0
  369. package/dist/plugins/__tests__/package-entry.test.d.ts.map +1 -0
  370. package/dist/plugins/__tests__/package-entry.test.js +117 -0
  371. package/dist/plugins/__tests__/package-entry.test.js.map +1 -0
  372. package/dist/plugins/__tests__/recipe-loader.test.d.ts +2 -0
  373. package/dist/plugins/__tests__/recipe-loader.test.d.ts.map +1 -0
  374. package/dist/plugins/__tests__/recipe-loader.test.js +130 -0
  375. package/dist/plugins/__tests__/recipe-loader.test.js.map +1 -0
  376. package/dist/plugins/__tests__/scope-validation.test.d.ts +2 -0
  377. package/dist/plugins/__tests__/scope-validation.test.d.ts.map +1 -0
  378. package/dist/plugins/__tests__/scope-validation.test.js +68 -0
  379. package/dist/plugins/__tests__/scope-validation.test.js.map +1 -0
  380. package/dist/plugins/__tests__/single-core-guard.test.d.ts +10 -0
  381. package/dist/plugins/__tests__/single-core-guard.test.d.ts.map +1 -0
  382. package/dist/plugins/__tests__/single-core-guard.test.js +89 -0
  383. package/dist/plugins/__tests__/single-core-guard.test.js.map +1 -0
  384. package/dist/plugins/__tests__/tool-package-discovery.test.d.ts +2 -0
  385. package/dist/plugins/__tests__/tool-package-discovery.test.d.ts.map +1 -0
  386. package/dist/plugins/__tests__/tool-package-discovery.test.js +215 -0
  387. package/dist/plugins/__tests__/tool-package-discovery.test.js.map +1 -0
  388. package/dist/plugins/authored-tool-discovery.d.ts +45 -0
  389. package/dist/plugins/authored-tool-discovery.d.ts.map +1 -0
  390. package/dist/plugins/authored-tool-discovery.js +61 -0
  391. package/dist/plugins/authored-tool-discovery.js.map +1 -0
  392. package/dist/plugins/capability-discovery.d.ts +80 -0
  393. package/dist/plugins/capability-discovery.d.ts.map +1 -0
  394. package/dist/plugins/capability-discovery.js +278 -0
  395. package/dist/plugins/capability-discovery.js.map +1 -0
  396. package/dist/plugins/capability-loader.d.ts +50 -0
  397. package/dist/plugins/capability-loader.d.ts.map +1 -0
  398. package/dist/plugins/capability-loader.js +85 -0
  399. package/dist/plugins/capability-loader.js.map +1 -0
  400. package/dist/plugins/capability-registry.d.ts +169 -0
  401. package/dist/plugins/capability-registry.d.ts.map +1 -0
  402. package/dist/plugins/capability-registry.js +319 -0
  403. package/dist/plugins/capability-registry.js.map +1 -0
  404. package/dist/plugins/discover.d.ts +64 -0
  405. package/dist/plugins/discover.d.ts.map +1 -0
  406. package/dist/plugins/discover.js +303 -0
  407. package/dist/plugins/discover.js.map +1 -0
  408. package/dist/plugins/index.d.ts +37 -0
  409. package/dist/plugins/index.d.ts.map +1 -0
  410. package/dist/plugins/index.js +40 -0
  411. package/dist/plugins/index.js.map +1 -0
  412. package/dist/plugins/json-guards.d.ts +11 -0
  413. package/dist/plugins/json-guards.d.ts.map +1 -0
  414. package/dist/plugins/json-guards.js +15 -0
  415. package/dist/plugins/json-guards.js.map +1 -0
  416. package/dist/plugins/loader.d.ts +67 -0
  417. package/dist/plugins/loader.d.ts.map +1 -0
  418. package/dist/plugins/loader.js +137 -0
  419. package/dist/plugins/loader.js.map +1 -0
  420. package/dist/plugins/manifest-discovery.d.ts +28 -0
  421. package/dist/plugins/manifest-discovery.d.ts.map +1 -0
  422. package/dist/plugins/manifest-discovery.js +103 -0
  423. package/dist/plugins/manifest-discovery.js.map +1 -0
  424. package/dist/plugins/manifest-loader.d.ts +120 -0
  425. package/dist/plugins/manifest-loader.d.ts.map +1 -0
  426. package/dist/plugins/manifest-loader.js +410 -0
  427. package/dist/plugins/manifest-loader.js.map +1 -0
  428. package/dist/plugins/marker-discovery.d.ts +115 -0
  429. package/dist/plugins/marker-discovery.d.ts.map +1 -0
  430. package/dist/plugins/marker-discovery.js +172 -0
  431. package/dist/plugins/marker-discovery.js.map +1 -0
  432. package/dist/plugins/node-modules-walk.d.ts +61 -0
  433. package/dist/plugins/node-modules-walk.d.ts.map +1 -0
  434. package/dist/plugins/node-modules-walk.js +99 -0
  435. package/dist/plugins/node-modules-walk.js.map +1 -0
  436. package/dist/plugins/package-entry.d.ts +38 -0
  437. package/dist/plugins/package-entry.d.ts.map +1 -0
  438. package/dist/plugins/package-entry.js +86 -0
  439. package/dist/plugins/package-entry.js.map +1 -0
  440. package/dist/plugins/recipe-loader.d.ts +63 -0
  441. package/dist/plugins/recipe-loader.d.ts.map +1 -0
  442. package/dist/plugins/recipe-loader.js +67 -0
  443. package/dist/plugins/recipe-loader.js.map +1 -0
  444. package/dist/plugins/scope-validation.d.ts +35 -0
  445. package/dist/plugins/scope-validation.d.ts.map +1 -0
  446. package/dist/plugins/scope-validation.js +55 -0
  447. package/dist/plugins/scope-validation.js.map +1 -0
  448. package/dist/plugins/single-core-guard.d.ts +28 -0
  449. package/dist/plugins/single-core-guard.d.ts.map +1 -0
  450. package/dist/plugins/single-core-guard.js +69 -0
  451. package/dist/plugins/single-core-guard.js.map +1 -0
  452. package/dist/plugins/tool-package-discovery.d.ts +93 -0
  453. package/dist/plugins/tool-package-discovery.d.ts.map +1 -0
  454. package/dist/plugins/tool-package-discovery.js +118 -0
  455. package/dist/plugins/tool-package-discovery.js.map +1 -0
  456. package/dist/plugins/types.d.ts +78 -0
  457. package/dist/plugins/types.d.ts.map +1 -0
  458. package/dist/plugins/types.js +15 -0
  459. package/dist/plugins/types.js.map +1 -0
  460. package/dist/recipes/__tests__/registry.test.d.ts +2 -0
  461. package/dist/recipes/__tests__/registry.test.d.ts.map +1 -0
  462. package/dist/recipes/__tests__/registry.test.js +170 -0
  463. package/dist/recipes/__tests__/registry.test.js.map +1 -0
  464. package/dist/recipes/__tests__/selector.test.d.ts +20 -0
  465. package/dist/recipes/__tests__/selector.test.d.ts.map +1 -0
  466. package/dist/recipes/__tests__/selector.test.js +173 -0
  467. package/dist/recipes/__tests__/selector.test.js.map +1 -0
  468. package/dist/recipes/__tests__/unit-config.test.d.ts +7 -0
  469. package/dist/recipes/__tests__/unit-config.test.d.ts.map +1 -0
  470. package/dist/recipes/__tests__/unit-config.test.js +52 -0
  471. package/dist/recipes/__tests__/unit-config.test.js.map +1 -0
  472. package/dist/recipes/registry.d.ts +105 -0
  473. package/dist/recipes/registry.d.ts.map +1 -0
  474. package/dist/recipes/registry.js +141 -0
  475. package/dist/recipes/registry.js.map +1 -0
  476. package/dist/recipes/selector.d.ts +112 -0
  477. package/dist/recipes/selector.d.ts.map +1 -0
  478. package/dist/recipes/selector.js +134 -0
  479. package/dist/recipes/selector.js.map +1 -0
  480. package/dist/recipes/unit-config.d.ts +63 -0
  481. package/dist/recipes/unit-config.d.ts.map +1 -0
  482. package/dist/recipes/unit-config.js +68 -0
  483. package/dist/recipes/unit-config.js.map +1 -0
  484. package/dist/runtime/__tests__/in-process-transport.test.d.ts +6 -0
  485. package/dist/runtime/__tests__/in-process-transport.test.d.ts.map +1 -0
  486. package/dist/runtime/__tests__/in-process-transport.test.js +73 -0
  487. package/dist/runtime/__tests__/in-process-transport.test.js.map +1 -0
  488. package/dist/runtime/__tests__/subprocess-transport.test.d.ts +11 -0
  489. package/dist/runtime/__tests__/subprocess-transport.test.d.ts.map +1 -0
  490. package/dist/runtime/__tests__/subprocess-transport.test.js +118 -0
  491. package/dist/runtime/__tests__/subprocess-transport.test.js.map +1 -0
  492. package/dist/runtime/in-process-transport.d.ts +20 -0
  493. package/dist/runtime/in-process-transport.d.ts.map +1 -0
  494. package/dist/runtime/in-process-transport.js +49 -0
  495. package/dist/runtime/in-process-transport.js.map +1 -0
  496. package/dist/runtime/progress-transport.d.ts +73 -0
  497. package/dist/runtime/progress-transport.d.ts.map +1 -0
  498. package/dist/runtime/progress-transport.js +17 -0
  499. package/dist/runtime/progress-transport.js.map +1 -0
  500. package/dist/runtime/subprocess-transport.d.ts +43 -0
  501. package/dist/runtime/subprocess-transport.d.ts.map +1 -0
  502. package/dist/runtime/subprocess-transport.js +134 -0
  503. package/dist/runtime/subprocess-transport.js.map +1 -0
  504. package/dist/signals/comment-openers.d.ts +29 -0
  505. package/dist/signals/comment-openers.d.ts.map +1 -0
  506. package/dist/signals/comment-openers.js +41 -0
  507. package/dist/signals/comment-openers.js.map +1 -0
  508. package/dist/signals/comment-openers.test.d.ts +7 -0
  509. package/dist/signals/comment-openers.test.d.ts.map +1 -0
  510. package/dist/signals/comment-openers.test.js +41 -0
  511. package/dist/signals/comment-openers.test.js.map +1 -0
  512. package/dist/signals/create-signal-from-violation.d.ts +29 -0
  513. package/dist/signals/create-signal-from-violation.d.ts.map +1 -0
  514. package/dist/signals/create-signal-from-violation.js +29 -0
  515. package/dist/signals/create-signal-from-violation.js.map +1 -0
  516. package/dist/signals/signal-sink.d.ts +49 -0
  517. package/dist/signals/signal-sink.d.ts.map +1 -0
  518. package/dist/signals/signal-sink.js +6 -0
  519. package/dist/signals/signal-sink.js.map +1 -0
  520. package/dist/signals/suppress.d.ts +102 -0
  521. package/dist/signals/suppress.d.ts.map +1 -0
  522. package/dist/signals/suppress.js +325 -0
  523. package/dist/signals/suppress.js.map +1 -0
  524. package/dist/signals/suppress.test.d.ts +2 -0
  525. package/dist/signals/suppress.test.d.ts.map +1 -0
  526. package/dist/signals/suppress.test.js +213 -0
  527. package/dist/signals/suppress.test.js.map +1 -0
  528. package/dist/tools/__tests__/command-spec.test.d.ts +2 -0
  529. package/dist/tools/__tests__/command-spec.test.d.ts.map +1 -0
  530. package/dist/tools/__tests__/command-spec.test.js +191 -0
  531. package/dist/tools/__tests__/command-spec.test.js.map +1 -0
  532. package/dist/tools/__tests__/compatibility.test.d.ts +5 -0
  533. package/dist/tools/__tests__/compatibility.test.d.ts.map +1 -0
  534. package/dist/tools/__tests__/compatibility.test.js +41 -0
  535. package/dist/tools/__tests__/compatibility.test.js.map +1 -0
  536. package/dist/tools/__tests__/ids.test.d.ts +5 -0
  537. package/dist/tools/__tests__/ids.test.d.ts.map +1 -0
  538. package/dist/tools/__tests__/ids.test.js +56 -0
  539. package/dist/tools/__tests__/ids.test.js.map +1 -0
  540. package/dist/tools/__tests__/manifest-assert.test.d.ts +5 -0
  541. package/dist/tools/__tests__/manifest-assert.test.d.ts.map +1 -0
  542. package/dist/tools/__tests__/manifest-assert.test.js +66 -0
  543. package/dist/tools/__tests__/manifest-assert.test.js.map +1 -0
  544. package/dist/tools/__tests__/registry.test.d.ts +2 -0
  545. package/dist/tools/__tests__/registry.test.d.ts.map +1 -0
  546. package/dist/tools/__tests__/registry.test.js +93 -0
  547. package/dist/tools/__tests__/registry.test.js.map +1 -0
  548. package/dist/tools/__tests__/types.test.d.ts +2 -0
  549. package/dist/tools/__tests__/types.test.d.ts.map +1 -0
  550. package/dist/tools/__tests__/types.test.js +51 -0
  551. package/dist/tools/__tests__/types.test.js.map +1 -0
  552. package/dist/tools/capability.d.ts +257 -0
  553. package/dist/tools/capability.d.ts.map +1 -0
  554. package/dist/tools/capability.js +46 -0
  555. package/dist/tools/capability.js.map +1 -0
  556. package/dist/tools/command-spec.d.ts +211 -0
  557. package/dist/tools/command-spec.d.ts.map +1 -0
  558. package/dist/tools/command-spec.js +110 -0
  559. package/dist/tools/command-spec.js.map +1 -0
  560. package/dist/tools/compatibility.d.ts +45 -0
  561. package/dist/tools/compatibility.d.ts.map +1 -0
  562. package/dist/tools/compatibility.js +49 -0
  563. package/dist/tools/compatibility.js.map +1 -0
  564. package/dist/tools/ids.d.ts +61 -0
  565. package/dist/tools/ids.d.ts.map +1 -0
  566. package/dist/tools/ids.js +61 -0
  567. package/dist/tools/ids.js.map +1 -0
  568. package/dist/tools/index.d.ts +22 -0
  569. package/dist/tools/index.d.ts.map +1 -0
  570. package/dist/tools/index.js +28 -0
  571. package/dist/tools/index.js.map +1 -0
  572. package/dist/tools/manifest-assert.d.ts +35 -0
  573. package/dist/tools/manifest-assert.d.ts.map +1 -0
  574. package/dist/tools/manifest-assert.js +67 -0
  575. package/dist/tools/manifest-assert.js.map +1 -0
  576. package/dist/tools/manifest.d.ts +178 -0
  577. package/dist/tools/manifest.d.ts.map +1 -0
  578. package/dist/tools/manifest.js +35 -0
  579. package/dist/tools/manifest.js.map +1 -0
  580. package/dist/tools/registry.d.ts +37 -0
  581. package/dist/tools/registry.d.ts.map +1 -0
  582. package/dist/tools/registry.js +49 -0
  583. package/dist/tools/registry.js.map +1 -0
  584. package/dist/tools/types.d.ts +1021 -0
  585. package/dist/tools/types.d.ts.map +1 -0
  586. package/dist/tools/types.js +77 -0
  587. package/dist/tools/types.js.map +1 -0
  588. package/dist/types/__tests__/signal.test.d.ts +2 -0
  589. package/dist/types/__tests__/signal.test.d.ts.map +1 -0
  590. package/dist/types/__tests__/signal.test.js +111 -0
  591. package/dist/types/__tests__/signal.test.js.map +1 -0
  592. package/dist/types/index.d.ts +5 -0
  593. package/dist/types/index.d.ts.map +1 -0
  594. package/dist/types/index.js +3 -0
  595. package/dist/types/index.js.map +1 -0
  596. package/dist/types/signal-batch.d.ts +56 -0
  597. package/dist/types/signal-batch.d.ts.map +1 -0
  598. package/dist/types/signal-batch.js +54 -0
  599. package/dist/types/signal-batch.js.map +1 -0
  600. package/dist/types/signal.d.ts +77 -0
  601. package/dist/types/signal.d.ts.map +1 -0
  602. package/dist/types/signal.js +42 -0
  603. package/dist/types/signal.js.map +1 -0
  604. package/package.json +57 -0
@@ -0,0 +1,319 @@
1
+ /**
2
+ * @fileoverview Scope-owned capability registry (launch, §5.3).
3
+ *
4
+ * The host-side runtime for the capability model in `tools/capability.ts`.
5
+ * A tool declares the domains it OWNS in its static manifest; the host
6
+ * registers each declared domain here alongside the owner-supplied
7
+ * REGISTRAR, then routes incoming contributions to the owning registrar
8
+ * after a Zod-free schema check. The host never interprets a
9
+ * contribution — it only confirms "targets a declared domain + passes its
10
+ * schema" and hands off (north-star §4.5).
11
+ *
12
+ * **Per-`RunScope`, no module singleton.** Mirrors the simulation §5.11
13
+ * template (`createScenarioRegistry` / `currentScenarioRegistry`):
14
+ *
15
+ * - `createCapabilityRegistry()` — factory the CLI bootstrap calls once
16
+ * per invocation, attaching the result to `scope.capabilities`.
17
+ * - `currentCapabilityRegistry()` — reads the scope-bound registry off
18
+ * `currentScope()`; throws when called outside a `RunScope`.
19
+ *
20
+ * Unlike a tool subscope, the capability registry is a KERNEL concern (the
21
+ * host owns it, not any one tool), so its slot lives directly on
22
+ * `ToolScope` (`capabilities?`) rather than under a tool's name. A run that
23
+ * never constructs one carries `scope.capabilities === undefined` and reads
24
+ * return `undefined`.
25
+ *
26
+ * Errors are typed + structured (§ Steps 2.1.3): an unknown domain is a
27
+ * `NotFoundError` (`CAPABILITY.DOMAIN.UNKNOWN`); a schema mismatch is a
28
+ * `ValidationError` (`CAPABILITY.CONTRIBUTION.SCHEMA_MISMATCH`), both
29
+ * carrying a structured `diagnostic` for the CLI error boundary.
30
+ */
31
+ import { CapabilitySchemaMismatchError, SystemError, UnknownCapabilityDomainError, } from '../lib/errors.js';
32
+ import { logger as defaultLogger } from '../lib/logger.js';
33
+ import { currentScope } from '../lib/run-scope.js';
34
+ import { isCapabilityValidator, isStructuralContributionSchema, } from '../tools/capability.js';
35
+ /**
36
+ * Per-`RunScope` capability registry. Holds the declared domains (by id)
37
+ * and routes contributions to their owners. Construct one per CLI
38
+ * invocation via {@link createCapabilityRegistry}; read the scope-bound
39
+ * instance via {@link currentCapabilityRegistry}.
40
+ */
41
+ export class CapabilityRegistry {
42
+ domains = new Map();
43
+ /**
44
+ * Per-domain discovery load-state, keyed by domain id. This is the per-scope
45
+ * memoization that the capability loader reads/writes so a domain's
46
+ * contributions are discovered + routed exactly once per project per scope.
47
+ * Because the registry is itself per-`RunScope`, this state is per-scope too —
48
+ * a second run for the same project re-loads into its own fresh registry.
49
+ * This is the structural fix for the audit's F1 (sim's module-level
50
+ * `scenariosLoadedFor`): the marker lives on a scope-owned object, not a module.
51
+ */
52
+ loadState = new Map();
53
+ logger;
54
+ constructor(logger = defaultLogger) {
55
+ this.logger = logger;
56
+ }
57
+ /** True when domain `domainId` has been discovery-loaded for `projectKey` in this scope. */
58
+ isDomainLoaded(domainId, projectKey) {
59
+ return this.loadState.get(domainId)?.loadedFor === projectKey;
60
+ }
61
+ /** Record that `domainId` finished discovery-loading for `projectKey`, with any routing errors. */
62
+ markDomainLoaded(domainId, projectKey, errors) {
63
+ this.loadState.set(domainId, { loadedFor: projectKey, errors });
64
+ }
65
+ /** Routing errors recorded during the most recent load of `domainId` (empty if none / never loaded). */
66
+ domainLoadErrors(domainId) {
67
+ return this.loadState.get(domainId)?.errors ?? [];
68
+ }
69
+ /**
70
+ * Register a capability domain + its owner's registrar. First-writer-wins
71
+ * on duplicate domain id: a second registration of the same id is a no-op
72
+ * (logged at debug) — mirrors the discovery walker's nearest-ancestor
73
+ * dedup, so re-running discovery is idempotent.
74
+ *
75
+ * @param spec The domain description (id, owner, epoch, schema, kind).
76
+ * @param registrar The owner callback invoked for a validated contribution.
77
+ */
78
+ registerDomain(spec, registrar) {
79
+ if (this.domains.has(spec.id)) {
80
+ this.logger.debug({
81
+ evt: 'capability.domain.duplicate',
82
+ module: 'core:plugins',
83
+ domainId: spec.id,
84
+ ownerToolId: spec.ownerToolId,
85
+ msg: `capability domain '${spec.id}' already registered — keeping incumbent`,
86
+ });
87
+ return;
88
+ }
89
+ this.domains.set(spec.id, { spec, registrar });
90
+ this.logger.debug({
91
+ evt: 'capability.domain.registered',
92
+ module: 'core:plugins',
93
+ domainId: spec.id,
94
+ ownerToolId: spec.ownerToolId,
95
+ apiVersion: spec.apiVersion,
96
+ contributionKind: spec.contributionKind,
97
+ });
98
+ }
99
+ /**
100
+ * Replace the registrar for an ALREADY-REGISTERED domain (Phase 4). The
101
+ * manifest-read path ({@link registerCapabilityDomainsFromManifest})
102
+ * registers each declared domain with a DEFERRED placeholder registrar that
103
+ * throws on any contribution; once the owning tool's runtime module loads,
104
+ * the host calls this to swap in the tool's REAL registrar.
105
+ *
106
+ * This is the deliberate complement to {@link registerDomain}'s
107
+ * first-writer-wins: a domain's REGISTRAR is owner-replaceable (the owner
108
+ * supplies it late), but its SPEC is not — the spec stays exactly as the
109
+ * manifest declared it, so identity/epoch/schema cannot be overwritten by a
110
+ * late registrar wiring. Only the owning tool should call this (the host
111
+ * routes by `ownerToolId`); the spec is left untouched.
112
+ *
113
+ * @param domainId The domain whose registrar to replace.
114
+ * @param registrar The owner's real registrar.
115
+ * @throws {NotFoundError} (`CAPABILITY.DOMAIN.UNKNOWN`) when no domain
116
+ * `domainId` is registered — a registrar cannot be wired for a domain the
117
+ * host never declared (a manifest/tool-id mismatch).
118
+ */
119
+ setRegistrar(domainId, registrar) {
120
+ const entry = this.domains.get(domainId);
121
+ if (entry === undefined) {
122
+ const known = [...this.domains.keys()];
123
+ throw new UnknownCapabilityDomainError(`capability: cannot wire a registrar for undeclared domain '${domainId}'` +
124
+ (known.length > 0 ? ` (known domains: ${known.join(', ')})` : ' (no domains declared)'), { domainId, knownDomains: known });
125
+ }
126
+ // Replace the registrar; keep the manifest-declared spec verbatim.
127
+ this.domains.set(domainId, { spec: entry.spec, registrar });
128
+ this.logger.debug({
129
+ evt: 'capability.domain.registrar_wired',
130
+ module: 'core:plugins',
131
+ domainId,
132
+ ownerToolId: entry.spec.ownerToolId,
133
+ });
134
+ }
135
+ /** Whether a domain with `domainId` is registered. */
136
+ hasDomain(domainId) {
137
+ return this.domains.has(domainId);
138
+ }
139
+ /** Look up a registered domain's spec, or `undefined`. */
140
+ getDomain(domainId) {
141
+ return this.domains.get(domainId)?.spec;
142
+ }
143
+ /** All registered domain specs (registration order). */
144
+ listDomains() {
145
+ return [...this.domains.values()].map((d) => d.spec);
146
+ }
147
+ /**
148
+ * Route a contribution to the owner of `domainId`. The host (a) confirms
149
+ * the domain is declared, (b) validates `contribution` against the
150
+ * domain's `contributionSchema`, then (c) hands it to the owner's
151
+ * registrar. The host never interprets the contribution beyond the
152
+ * schema check — the domain owner does.
153
+ *
154
+ * @throws {NotFoundError} (`CAPABILITY.DOMAIN.UNKNOWN`) when no domain
155
+ * `domainId` is registered.
156
+ * @throws {ValidationError} (`CAPABILITY.CONTRIBUTION.SCHEMA_MISMATCH`)
157
+ * when the contribution fails the domain's schema check.
158
+ */
159
+ routeContribution(domainId, contribution) {
160
+ const entry = this.domains.get(domainId);
161
+ if (entry === undefined) {
162
+ const known = [...this.domains.keys()];
163
+ throw new UnknownCapabilityDomainError(`capability: no domain '${domainId}' is declared` +
164
+ (known.length > 0 ? ` (known domains: ${known.join(', ')})` : ' (no domains declared)'), { domainId, knownDomains: known });
165
+ }
166
+ const verdict = validateContribution(entry.spec.contributionSchema, contribution);
167
+ if (verdict !== true) {
168
+ throw new CapabilitySchemaMismatchError(`capability: contribution to domain '${domainId}' (owner '${entry.spec.ownerToolId}') ` +
169
+ `failed its schema: ${verdict}`, { domainId, ownerToolId: entry.spec.ownerToolId, diagnostic: verdict });
170
+ }
171
+ entry.registrar(contribution);
172
+ }
173
+ }
174
+ /**
175
+ * Validate a contribution against a domain's `contributionSchema` WITHOUT
176
+ * Zod. Three kinds of schema are accepted:
177
+ *
178
+ * - a {@link CapabilityValidator} function — called; its `true | string`
179
+ * result IS the verdict.
180
+ * - a {@link StructuralContributionSchema} (`{ requiredKeys }`) — each
181
+ * listed key must be present (and non-`undefined`) on a record-shaped
182
+ * contribution.
183
+ * - `undefined` / anything else — treated as "no constraint": any
184
+ * contribution passes (a domain may opt out of host-side checking and
185
+ * validate entirely inside its own registrar).
186
+ *
187
+ * @returns `true` when the contribution satisfies the schema, otherwise a
188
+ * human-readable reason string (surfaced in the `ValidationError`).
189
+ */
190
+ function validateContribution(schema, contribution) {
191
+ if (isCapabilityValidator(schema)) {
192
+ return schema(contribution);
193
+ }
194
+ if (isStructuralContributionSchema(schema)) {
195
+ if (typeof contribution !== 'object' || contribution === null) {
196
+ return `expected an object contribution with keys [${schema.requiredKeys.join(', ')}], got ${contribution === null ? 'null' : typeof contribution}`;
197
+ }
198
+ const record = contribution;
199
+ const missing = schema.requiredKeys.filter((k) => record[k] === undefined);
200
+ if (missing.length > 0) {
201
+ return `missing required key(s): ${missing.join(', ')}`;
202
+ }
203
+ return true;
204
+ }
205
+ // No declared constraint — defer all validation to the owner's registrar.
206
+ return true;
207
+ }
208
+ /** Construct a fresh capability registry for a single `RunScope`. */
209
+ export function createCapabilityRegistry(logger) {
210
+ return new CapabilityRegistry(logger);
211
+ }
212
+ /**
213
+ * Read the current scope's capability registry. Throws when no scope is
214
+ * active or when the scope has no capability registry — both indicate the
215
+ * caller is running outside the CLI's pre-action-hook (or a test fixture
216
+ * forgot to construct + attach one).
217
+ *
218
+ * @throws {Error} When called outside `runWithScope(...)`, or when the
219
+ * active scope carries no `capabilities` registry.
220
+ */
221
+ export function currentCapabilityRegistry() {
222
+ const scope = currentScope();
223
+ if (!scope) {
224
+ throw new Error('core: currentCapabilityRegistry() called outside a RunScope. ' +
225
+ 'Wrap the call site in runWithScope (production: the pre-action-hook ' +
226
+ 'constructs the scope; tests: construct a RunScope, attach ' +
227
+ 'createCapabilityRegistry() to scope.capabilities, then runWithScope).');
228
+ }
229
+ if (!scope.capabilities) {
230
+ throw new Error('core: scope.capabilities is missing. The CLI bootstrap must attach ' +
231
+ 'createCapabilityRegistry() to the scope before capability reads ' +
232
+ '(production: the pre-action-hook seeds it; tests: assign ' +
233
+ 'scope.capabilities = createCapabilityRegistry()).');
234
+ }
235
+ return scope.capabilities;
236
+ }
237
+ /**
238
+ * Register every capability domain a manifest declares into the per-run
239
+ * {@link CapabilityRegistry}, stamping `ownerToolId = manifest.stableId ??
240
+ * manifest.id` on each (§5.3 / Task 2.2; ADR-0048 — the owner key must equal the
241
+ * owning tool's `metadata.id`, which is the stable UUID for modern tools). This
242
+ * is how `MARKER_KINDS` becomes a BOOTSTRAP DEFAULT:
243
+ * the marker enum still seeds the discovery vocabulary, and a
244
+ * manifest-declared domain EXTENDS that set — registered here without any
245
+ * host-enum edit. Additive: a manifest with no `capabilities` registers
246
+ * nothing.
247
+ *
248
+ * The owner-supplied registrar is NOT known at manifest-read time (the
249
+ * tool's runtime module hasn't been imported), so this registers the
250
+ * domain with a deferred-registrar placeholder that THROWS if a
251
+ * contribution is routed before the owning tool wires its real registrar
252
+ * (Phase 4). The host knows the domain EXISTS and who owns it; the owner
253
+ * supplies the actual registrar when its module loads.
254
+ *
255
+ * Emits one structured `capability.domain.from_manifest` evt per domain so
256
+ * a manifest-sourced domain is observable in structured logs (Task 2.2.3).
257
+ *
258
+ * @param manifest The validated manifest carrying the declarations.
259
+ * @param registry The per-run capability registry to populate.
260
+ * @returns The {@link CapabilityDomainSpec}s registered (owner-stamped).
261
+ */
262
+ export function registerCapabilityDomainsFromManifest(manifest, registry) {
263
+ const declarations = manifest.capabilities ?? [];
264
+ const registered = [];
265
+ for (const decl of declarations) {
266
+ const spec = {
267
+ id: decl.id,
268
+ // ADR-0048: `ownerToolId` must equal the OWNING TOOL'S `metadata.id`, which
269
+ // the capability loader filters on (`d.ownerToolId === owningTool.metadata.id`).
270
+ // Post-ADR-0048 `metadata.id` is the stable UUID (== `manifest.stableId`) and
271
+ // `manifest.id` is the human name (== `metadata.name`). Prefer the stableId so
272
+ // the owner match works; fall back to the human `id` for legacy tools that
273
+ // declare no `stableId` (where `metadata.id` is still the human id).
274
+ ownerToolId: manifest.stableId ?? manifest.id,
275
+ apiVersion: decl.apiVersion,
276
+ contributionSchema: decl.contributionSchema,
277
+ contributionKind: decl.contributionKind,
278
+ // Carry the discovery descriptor onto the spec so the scope-owned capability
279
+ // loader can drive the generic substrate for this domain (§5.3). Absent →
280
+ // the domain auto-discovers nothing.
281
+ ...(decl.discovery === undefined ? {} : { discovery: decl.discovery }),
282
+ };
283
+ registry.registerDomain(spec, makeDeferredRegistrar(spec));
284
+ defaultLogger.info({
285
+ evt: 'capability.domain.from_manifest',
286
+ module: 'core:plugins',
287
+ domainId: spec.id,
288
+ ownerToolId: spec.ownerToolId,
289
+ apiVersion: spec.apiVersion,
290
+ contributionKind: spec.contributionKind,
291
+ });
292
+ registered.push(spec);
293
+ }
294
+ return registered;
295
+ }
296
+ /**
297
+ * A placeholder registrar for a manifest-declared domain whose owning tool
298
+ * has not wired its real registrar (Phase 4). Routing a contribution
299
+ * before then is a programming error — the host knows the domain exists,
300
+ * but no one can yet accept a contribution to it — so it throws a clear
301
+ * diagnostic rather than silently dropping the contribution.
302
+ *
303
+ * @param spec The domain being registered with this placeholder.
304
+ * @returns A {@link CapabilityRegistrar} that throws a {@link SystemError} on
305
+ * any invocation, until Phase 4 replaces it with the owning tool's real
306
+ * registrar.
307
+ */
308
+ function makeDeferredRegistrar(spec) {
309
+ return () => {
310
+ // A SystemError (internal invariant violation): the domain exists but its
311
+ // owning tool has not wired a real registrar yet, so a contribution arrived
312
+ // before anyone can accept it. Self-documenting typed error — the throw is
313
+ // intentional (placeholder until Phase 4 wires real registrars).
314
+ throw new SystemError(`capability: domain '${spec.id}' (owner '${spec.ownerToolId}') was declared in a ` +
315
+ `manifest but its owning tool has not registered a runtime registrar yet ` +
316
+ `(Phase 4 wires real registrars). Cannot accept a contribution.`);
317
+ };
318
+ }
319
+ //# sourceMappingURL=capability-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability-registry.js","sourceRoot":"","sources":["../../src/plugins/capability-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EACL,6BAA6B,EAC7B,WAAW,EACX,4BAA4B,GAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,IAAI,aAAa,EAAe,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EACL,qBAAqB,EACrB,8BAA8B,GAG/B,MAAM,wBAAwB,CAAC;AAehC;;;;;GAKG;AACH,MAAM,OAAO,kBAAkB;IACZ,OAAO,GAAG,IAAI,GAAG,EAA4B,CAAC;IAC/D;;;;;;;;OAQG;IACc,SAAS,GAAG,IAAI,GAAG,EAA4D,CAAC;IAChF,MAAM,CAAS;IAEhC,YAAY,SAAiB,aAAa;QACxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,4FAA4F;IAC5F,cAAc,CAAC,QAAgB,EAAE,UAAkB;QACjD,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,SAAS,KAAK,UAAU,CAAC;IAChE,CAAC;IAED,mGAAmG;IACnG,gBAAgB,CAAC,QAAgB,EAAE,UAAkB,EAAE,MAAyB;QAC9E,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,wGAAwG;IACxG,gBAAgB,CAAC,QAAgB;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,EAAE,CAAC;IACpD,CAAC;IAED;;;;;;;;OAQG;IACH,cAAc,CA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AAE,IAAI,CAAC,UAAU;YAC3B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,6EAA6E;YAC7E,0EAA0E;YAC1E,qCAAqC;YACrC,GAAG,CAAC,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;SACvE,CAAC;QACF,QAAQ,CAAC,cAAc,CAAC,IAAI,EAAE,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3D,aAAa,CAAC,IAAI,CAAC;YACjB,GAAG,EAAE,iCAAiC;YACtC,MAAM,EAAE,cAAc;YACtB,QAAQ,EAAE,IAAI,CAAC,EAAE;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;SACxC,CAAC,CAAC;QACH,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,qBAAqB,CAAC,IAA0B;IACvD,OAAO,GAAG,EAAE;QACV,0EAA0E;QAC1E,4EAA4E;QAC5E,2EAA2E;QAC3E,iEAAiE;QACjE,MAAM,IAAI,WAAW,CACnB,uBAAuB,IAAI,CAAC,EAAE,aAAa,IAAI,CAAC,WAAW,uBAAuB;YAChF,0EAA0E;YAC1E,gEAAgE,CACnE,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @fileoverview Plugin discovery for the project-local layout.
3
+ *
4
+ * Discovery is descriptor-driven: the caller passes a `PluginLayout`
5
+ * (`{ domain, userSubdirs }`) declared by the owning tool. The kernel
6
+ * never enumerates tool domains itself (ADR-0009 corollary 1). Two
7
+ * artifact sources are walked for the layout:
8
+ *
9
+ * 1. USER SOURCE — recursive `.js` / `.mjs` files under
10
+ * `<project>/opensip-cli/<domain>/<kind>/`
11
+ * for each `kind` in `layout.userSubdirs` (e.g. `checks`/`recipes`
12
+ * for fitness, `scenarios`/`recipes` for simulation). Auto-loaded
13
+ * by directory presence; no config opt-in.
14
+ *
15
+ * 2. NPM PLUGINS — packages installed under
16
+ * `<project>/opensip-cli/.runtime/plugins/<domain>/node_modules/`
17
+ * whose names appear in the project's
18
+ * `opensip-cli.config.yml#plugins.<domain>: [...]`. The explicit
19
+ * list is required so a `plugin install` step is intentional, not
20
+ * an accidental load of every transitive devDep.
21
+ *
22
+ * A layout with an empty `userSubdirs` and no declared npm plugins
23
+ * (e.g. the language-adapter domain, whose adapters ship as direct CLI
24
+ * deps) discovers nothing — an emergent property, not a special case.
25
+ */
26
+ import type { DiscoveredPlugin, PluginLayout } from './types.js';
27
+ /**
28
+ * Discover all plugins for a layout in the project layout.
29
+ *
30
+ * Returns a list of `DiscoveredPlugin` entries (loose .mjs files +
31
+ * npm packages) for the loader to import. Discovery is silent on a
32
+ * missing project directory or absent subdirs — callers that care
33
+ * about "did we find anything?" should check the returned length.
34
+ *
35
+ * @param layout The owning tool's `PluginLayout` (`{ domain,
36
+ * userSubdirs }`).
37
+ * @param projectDir Project root. Required — there is no user-global
38
+ * fallback. Pass undefined to discover nothing
39
+ * (used by callers that don't have a project
40
+ * context yet).
41
+ */
42
+ export declare function discoverPlugins(layout: PluginLayout, projectDir?: string): DiscoveredPlugin[];
43
+ /**
44
+ * Read the declared plugin list for a domain from the project config.
45
+ * Returns undefined when the config is absent, unreadable, or has no
46
+ * entry for the domain. Does NOT throw on YAML parse errors — returns
47
+ * undefined so discovery falls through gracefully and the config-layer
48
+ * schema validation surfaces parse errors on its own path.
49
+ *
50
+ * Config-path resolution mirrors `resolveProjectConfigPath` (the same
51
+ * helper the targets loader uses): --config flag → `package.json#
52
+ * opensip-cli.configPath` pointer → default `<projectDir>/opensip-
53
+ * tools.config.yml`. Without this, projects that locate their config
54
+ * via the package.json pointer have their `plugins.<domain>: [...]`
55
+ * declaration silently ignored — discovery falls through to the empty
56
+ * default path and the plugin pack never registers.
57
+ *
58
+ * The `--config` precedence is honored only when callers pass through
59
+ * their explicit value via `explicitConfigPath`; this entry point is
60
+ * the implicit one (no --config available at the discovery seam), so
61
+ * we resolve without an explicit path and rely on the pointer + default.
62
+ */
63
+ export declare function readProjectPluginsList(projectDir: string, domain: string): readonly string[] | undefined;
64
+ //# sourceMappingURL=discover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../src/plugins/discover.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAYH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AASjE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAuC7F;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,SAAS,MAAM,EAAE,GAAG,SAAS,CAqB/B"}