@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,66 @@
1
+ /**
2
+ * Tests for the load-time manifest⇔Tool drift guard (release 2.8.0, Phase 1).
3
+ */
4
+ import { describe, expect, it } from 'vitest';
5
+ import { ValidationError } from '../../lib/errors.js';
6
+ import { assertManifestMatchesTool } from '../manifest-assert.js';
7
+ /** Minimal Tool stub — only the fields the guard inspects are meaningful. */
8
+ function makeTool(humanName, commandNames, stableId = '00000000-0000-4000-8000-000000000000') {
9
+ return {
10
+ metadata: { id: stableId, name: humanName, version: '0.0.0', description: 'test tool' },
11
+ commands: commandNames.map((name) => ({ name, description: `${name} desc` })),
12
+ };
13
+ }
14
+ function makeManifest(humanId, commandNames, stableId) {
15
+ return {
16
+ kind: 'tool',
17
+ id: humanId,
18
+ ...(stableId ? { stableId } : {}),
19
+ name: '@scope/test',
20
+ version: '0.0.0',
21
+ apiVersion: 1,
22
+ commands: commandNames.map((name) => ({ name, description: `${name} desc` })),
23
+ };
24
+ }
25
+ describe('assertManifestMatchesTool', () => {
26
+ it('passes when human id/name and command-name set match exactly', () => {
27
+ const tool = makeTool('fitness', ['fit', 'fit-list', 'fit-recipes'], 'afd68bd3-ff3c-4935-a5b6-76d8fc7a5224');
28
+ const manifest = makeManifest('fitness', ['fit', 'fit-list', 'fit-recipes'], 'afd68bd3-ff3c-4935-a5b6-76d8fc7a5224');
29
+ expect(() => assertManifestMatchesTool(manifest, tool)).not.toThrow();
30
+ });
31
+ it('passes when command names match but order differs (set equality)', () => {
32
+ const tool = makeTool('graph', ['graph', 'graph-lookup', 'sarif-export']);
33
+ const manifest = makeManifest('graph', ['sarif-export', 'graph', 'graph-lookup']);
34
+ expect(() => assertManifestMatchesTool(manifest, tool)).not.toThrow();
35
+ });
36
+ it('passes when manifest omits stableId (additive, legacy compat)', () => {
37
+ const tool = makeTool('fitness', ['fit'], 'afd68bd3-ff3c-4935-a5b6-76d8fc7a5224');
38
+ const manifest = makeManifest('fitness', ['fit']); // no stableId
39
+ expect(() => assertManifestMatchesTool(manifest, tool)).not.toThrow();
40
+ });
41
+ it('throws a ValidationError when the human id (manifest) differs from runtime name', () => {
42
+ const tool = makeTool('fitness', ['fit']);
43
+ const manifest = makeManifest('fit', ['fit']);
44
+ expect(() => assertManifestMatchesTool(manifest, tool)).toThrow(ValidationError);
45
+ expect(() => assertManifestMatchesTool(manifest, tool)).toThrow(/manifest id 'fit'.*runtime tool name 'fitness'/);
46
+ });
47
+ it('throws when manifest stableId differs from runtime id', () => {
48
+ const tool = makeTool('fitness', ['fit'], 'afd68bd3-ff3c-4935-a5b6-76d8fc7a5224');
49
+ const manifest = makeManifest('fitness', ['fit'], '11111111-1111-4111-8111-111111111111');
50
+ expect(() => assertManifestMatchesTool(manifest, tool)).toThrow(ValidationError);
51
+ expect(() => assertManifestMatchesTool(manifest, tool)).toThrow(/manifest stableId '11111111-1111-4111-8111-111111111111'.*runtime tool id 'afd68bd3-ff3c-4935-a5b6-76d8fc7a5224'/);
52
+ });
53
+ it('throws when a command is missing from the manifest', () => {
54
+ const tool = makeTool('graph', ['graph', 'graph-lookup']);
55
+ const manifest = makeManifest('graph', ['graph']);
56
+ expect(() => assertManifestMatchesTool(manifest, tool)).toThrow(ValidationError);
57
+ expect(() => assertManifestMatchesTool(manifest, tool)).toThrow(/missing from manifest: \[graph-lookup\]/);
58
+ });
59
+ it('throws when the manifest declares an extra command the tool lacks', () => {
60
+ const tool = makeTool('graph', ['graph']);
61
+ const manifest = makeManifest('graph', ['graph', 'graph-ghost']);
62
+ expect(() => assertManifestMatchesTool(manifest, tool)).toThrow(ValidationError);
63
+ expect(() => assertManifestMatchesTool(manifest, tool)).toThrow(/declared in manifest but not in tool: \[graph-ghost\]/);
64
+ });
65
+ });
66
+ //# sourceMappingURL=manifest-assert.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-assert.test.js","sourceRoot":"","sources":["../../../src/tools/__tests__/manifest-assert.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAKlE,6EAA6E;AAC7E,SAAS,QAAQ,CACf,SAAiB,EACjB,YAA+B,EAC/B,QAAQ,GAAG,sCAAsC;IAEjD,OAAO;QACL,QAAQ,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE;QACvF,QAAQ,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,IAAI,OAAO,EAAE,CAAC,CAAC;KAC9E,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CACnB,OAAe,EACf,YAA+B,EAC/B,QAAiB;IAEjB,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,EAAE,EAAE,OAAO;QACX,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjC,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,OAAO;QAChB,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,IAAI,OAAO,EAAE,CAAC,CAAC;KAC9E,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,2BAA2B,EAAE,G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CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QACjF,MAAM,CAAC,GAAG,EAAE,CAAC,yBAAyB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAC7D,yCAAyC,CAC1C,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;QAC3E,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;QAC1C,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;QACjE,MAAM,CAAC,GAAG,EAAE,CAAC,yBAAyB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QACjF,MAAM,CAAC,GAAG,EAAE,CAAC,yBAAyB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAC7D,uDAAuD,CACxD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=registry.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.test.d.ts","sourceRoot":"","sources":["../../../src/tools/__tests__/registry.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,93 @@
1
+ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
2
+ import { logger } from '../../lib/logger.js';
3
+ import { ToolRegistry } from '../registry.js';
4
+ const stub = (id, version = '0.0.0') => ({
5
+ metadata: {
6
+ id: '00000000-0000-4000-8000-000000000000',
7
+ name: id,
8
+ version,
9
+ description: `${id} stub`,
10
+ },
11
+ commands: [{ name: id, description: `${id} command` }],
12
+ });
13
+ describe('ToolRegistry', () => {
14
+ let reg;
15
+ let warnSpy;
16
+ beforeEach(() => {
17
+ reg = new ToolRegistry();
18
+ warnSpy = vi.spyOn(logger, 'warn').mockImplementation(() => undefined);
19
+ });
20
+ afterEach(() => {
21
+ vi.restoreAllMocks();
22
+ });
23
+ it('register + list round-trip', () => {
24
+ const a = stub('a');
25
+ reg.register(a);
26
+ expect(reg.list()).toEqual([a]);
27
+ });
28
+ it('get returns the registered tool by id', () => {
29
+ const a = stub('a');
30
+ reg.register(a);
31
+ expect(reg.get('a')).toBe(a);
32
+ });
33
+ it('get returns undefined for unknown ids', () => {
34
+ expect(reg.get('nope')).toBeUndefined();
35
+ });
36
+ it('register preserves the first entry on duplicate id (first writer wins)', () => {
37
+ const first = stub('a', '1.0.0');
38
+ const second = stub('a', '9.9.9');
39
+ reg.register(first);
40
+ reg.register(second);
41
+ expect(reg.list()).toHaveLength(1);
42
+ expect(reg.get('a')).toBe(first);
43
+ });
44
+ it('register emits a structured warning on duplicate id', () => {
45
+ reg.register(stub('a'));
46
+ reg.register(stub('a'));
47
+ expect(warnSpy).toHaveBeenCalledTimes(1);
48
+ expect(warnSpy).toHaveBeenCalledWith(expect.objectContaining({
49
+ evt: 'tool.registry.duplicate',
50
+ module: 'core:tools',
51
+ id: 'a',
52
+ }));
53
+ });
54
+ it('list() returns one entry per id even after a rejected duplicate', () => {
55
+ reg.register(stub('a'));
56
+ reg.register(stub('a'));
57
+ reg.register(stub('b'));
58
+ expect(reg.list()).toHaveLength(2);
59
+ });
60
+ it('clear removes every registered tool', () => {
61
+ reg.register(stub('a'));
62
+ reg.register(stub('b'));
63
+ reg.clear();
64
+ expect(reg.list()).toEqual([]);
65
+ });
66
+ it('list returns a fresh array each call (caller cannot mutate internal state)', () => {
67
+ reg.register(stub('a'));
68
+ const snapshot = reg.list();
69
+ // Mutating the returned array must not affect the registry.
70
+ snapshot.pop();
71
+ expect(reg.list()).toHaveLength(1);
72
+ });
73
+ describe('register with sourcePackage (third-party discovery path)', () => {
74
+ it('registers when no incumbent exists', () => {
75
+ const t = stub('a');
76
+ reg.register(t, { sourcePackage: '@vendor/a' });
77
+ expect(reg.get('a')).toBe(t);
78
+ });
79
+ it('rejects when an incumbent exists and surfaces the source package in the warning', () => {
80
+ const incumbent = stub('a');
81
+ reg.register(incumbent);
82
+ reg.register(stub('a'), { sourcePackage: '@vendor/a' });
83
+ expect(reg.get('a')).toBe(incumbent);
84
+ expect(warnSpy).toHaveBeenCalledWith(expect.objectContaining({
85
+ evt: 'tool.registry.duplicate',
86
+ module: 'core:tools',
87
+ id: 'a',
88
+ sourcePackage: '@vendor/a',
89
+ }));
90
+ });
91
+ });
92
+ });
93
+ //# sourceMappingURL=registry.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.test.js","sourceRoot":"","sources":["../../../src/tools/__tests__/registry.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C,MAAM,IAAI,GAAG,CAAC,EAAU,EAAE,OAAO,GAAG,OAAO,EAAQ,EAAE,CAAC,CAAC;IACrD,QAAQ,EAAE;QACR,EAAE,EAAE,sCAAsC;QAC1C,IAAI,EAAE,EAAE;QACR,OAAO;QACP,WAAW,EAAE,GAAG,EAAE,OAAO;KAC1B;IACD,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC;CACvD,CAAC,CAAC;AAEH,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,IAAI,GAAiB,CAAC;IACtB,IAAI,OAAoC,CAAC;IAEzC,UAAU,CAAC,GAAG,EAAE;QACd,GAAG,GAAG,IAAI,YAAY,EAAE,CAAC;QACzB,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,kBAAkB,C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,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.test.d.ts","sourceRoot":"","sources":["../../../src/tools/__tests__/types.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,51 @@
1
+ import { describe, it, expect, expectTypeOf } from 'vitest';
2
+ import { ToolError } from '../../lib/errors.js';
3
+ import { UnknownLiveViewError } from '../types.js';
4
+ describe('UnknownLiveViewError', () => {
5
+ it('is constructible with a viewKey and produces an actionable message', () => {
6
+ const err = new UnknownLiveViewError('fit');
7
+ expect(err).toBeInstanceOf(UnknownLiveViewError);
8
+ expect(err).toBeInstanceOf(ToolError);
9
+ expect(err).toBeInstanceOf(Error);
10
+ expect(err.viewKey).toBe('fit');
11
+ expect(err.code).toBe('UNKNOWN_LIVE_VIEW');
12
+ expect(err.name).toBe('UnknownLiveViewError');
13
+ expect(err.message).toContain("'fit'");
14
+ expect(err.message).toContain('registerLiveView');
15
+ });
16
+ it('preserves a custom error code when provided via options', () => {
17
+ const err = new UnknownLiveViewError('graph', { code: 'CUSTOM_CODE' });
18
+ expect(err.code).toBe('CUSTOM_CODE');
19
+ expect(err.viewKey).toBe('graph');
20
+ });
21
+ it('chains a cause through ToolErrorOptions', () => {
22
+ const cause = new Error('root');
23
+ const err = new UnknownLiveViewError('graph', { cause });
24
+ expect(err.cause).toBe(cause);
25
+ });
26
+ });
27
+ const fixtureRenderer = () => Promise.resolve();
28
+ describe('LiveViewRenderer', () => {
29
+ it('is exported as a structural type that accepts an unknown args payload', () => {
30
+ expectTypeOf().toBeFunction();
31
+ expectTypeOf().parameter(0).toBeUnknown();
32
+ // Host-owned-run-timing: live renderers return completion data to the host
33
+ // (or void) instead of persisting sessions themselves.
34
+ expectTypeOf().returns.resolves.toEqualTypeOf();
35
+ });
36
+ it('accepts a function value at runtime', () => {
37
+ expect(typeof fixtureRenderer).toBe('function');
38
+ });
39
+ });
40
+ describe('ToolRunSessions launch surface (host-owned-run-timing Phase 6)', () => {
41
+ it('exposes only the read-only `timing` lifecycle — no generic-session record(...)', () => {
42
+ // Compile-time guard (spec §6.5 / §11 / Phase 6 step 9): the public run seam
43
+ // must NOT carry a generic-session writer. Tools return a
44
+ // ToolSessionContribution (inside a ToolRunCompletion) and the host run plane
45
+ // persists it. If a `record(...)` (or any other member) is re-added to
46
+ // ToolRunSessions, `keyof` drifts from `'timing'` and this fails to compile.
47
+ expectTypeOf().toEqualTypeOf();
48
+ expectTypeOf().toEqualTypeOf();
49
+ });
50
+ });
51
+ //# sourceMappingURL=types.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.test.js","sourceRoot":"","sources":["../../../src/tools/__tests__/types.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAKnD,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,oEAAoE,EAAE,GAAG,EAAE;QAC5E,MAAM,GAAG,GAAG,IAAI,oBAAoB,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;QACjD,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAClC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,C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AY,EAAoB,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,EAA4B,CAAC;IAC9F,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC7C,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,gEAAgE,EAAE,GAAG,EAAE;IAC9E,EAAE,CAAC,gFAAgF,EAAE,GAAG,EAAE;QACxF,6EAA6E;QAC7E,0DAA0D;QAC1D,8EAA8E;QAC9E,uEAAuE;QACvE,6EAA6E;QAC7E,YAAY,EAAyB,CAAC,aAAa,EAAY,CAAC;QAChE,YAAY,EAA6B,CAAC,aAAa,EAAY,CAAC;IACtE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,257 @@
1
+ /**
2
+ * @fileoverview Capability domain model (launch, §5.3).
3
+ *
4
+ * A **capability domain** is a named extension point a tool OWNS — "fit
5
+ * has checks", "sim has scenarios", "graph has language adapters". Today
6
+ * the host knows these by a compiled-in enum (`MARKER_KINDS` in
7
+ * `marker-discovery.ts`). The capability model turns that knowledge into
8
+ * DATA: a tool declares the domains it owns in its static manifest
9
+ * (`ToolPluginManifest.capabilities`), and the host registers each one in
10
+ * a per-run capability registry WITHOUT being compiled to understand it.
11
+ *
12
+ * The host's only jobs are (a) record that a declared domain exists and
13
+ * who owns it, and (b) route an incoming contribution to the owning tool's
14
+ * registrar after checking it targets a declared domain and passes that
15
+ * domain's `contributionSchema`. The host never interprets the
16
+ * contribution itself — the owner supplies the registrar.
17
+ *
18
+ * `contributionSchema` is `unknown` at the kernel layer ON PURPOSE: `core`
19
+ * carries no Zod (the composer in `@opensip-cli/config` does). A domain
20
+ * validates a contribution either structurally (the host applies a
21
+ * built-in shallow check) or via an owner-supplied validator function
22
+ * (see {@link CapabilityValidator}) — never by importing a schema library
23
+ * into the kernel.
24
+ *
25
+ * These types live in **core** next to the `Tool` contract + manifest;
26
+ * `contracts` re-exports them for the public surface (core cannot import
27
+ * contracts).
28
+ */
29
+ /**
30
+ * How a contribution to a capability domain is delivered. Mirrors the
31
+ * three ways a pack contributes today, so an external tool can declare
32
+ * the same shapes the first-party tools use:
33
+ *
34
+ * - `module-export` — a value exported from a discovered `.mjs`/package
35
+ * module (checks, scenarios, recipes).
36
+ * - `manifest-entry` — a declaration carried inline in a manifest block.
37
+ * - `file` — a file on disk the owner reads (a scenario script,
38
+ * a config sidecar).
39
+ */
40
+ export type CapabilityContributionKind = 'module-export' | 'manifest-entry' | 'file';
41
+ /**
42
+ * How a domain's contribution PACKAGES are found on disk — the data the generic
43
+ * discovery substrate reads so the host never compiles in "fit has checks" /
44
+ * "graph has adapters" knowledge (§5.3). Two modes, mirroring the two shapes the
45
+ * first-party tools use:
46
+ *
47
+ * - `marker` — packages declaring `package.json#opensipTools.kind === markerKind`
48
+ * (fit's `fit-pack`, graph's `graph-adapter`).
49
+ * - `name-pattern` — packages named `<scope>/<prefix>*` under a set of scopes
50
+ * (sim's `@opensip-cli/scenarios-*`). A legitimate, ADR-documented per-domain
51
+ * difference (§6.7): the descriptor exists precisely to carry it.
52
+ */
53
+ export type CapabilityDiscoveryMode = {
54
+ readonly mode: 'marker';
55
+ readonly markerKind: string;
56
+ } | {
57
+ readonly mode: 'name-pattern';
58
+ readonly prefix: string;
59
+ readonly defaultScopes: readonly string[];
60
+ };
61
+ /**
62
+ * A SECONDARY export the same package walk also routes — to a (usually different)
63
+ * domain. The §5.3 separate-domains fold: a fit-pack/sim-pack package exports both
64
+ * its primary contributions (`checks`/`scenarios`) AND co-located `recipes`; the
65
+ * recipes are routed to a `fit-recipe`/`sim-recipe` domain by the SAME discovery
66
+ * walk, each item still schema-checked against its OWN domain. Tool-agnostic.
67
+ */
68
+ export interface CapabilityCoContribution {
69
+ /** The module export holding the secondary contributions (e.g. `recipes`). */
70
+ readonly exportName: string;
71
+ /** Whether `exportName` is an array of contributions or a single one. */
72
+ readonly exportShape: 'array' | 'single';
73
+ /** The domain id these secondary contributions route to (e.g. `fit-recipe`). */
74
+ readonly domainId: string;
75
+ }
76
+ /**
77
+ * The static descriptor for how a capability domain's contributions are
78
+ * discovered and loaded — declared in the owning tool's manifest
79
+ * (`ToolPluginManifest.capabilities[].discovery`) and read by the generic
80
+ * discovery substrate. Tool-agnostic by construction: the host walks/loads from
81
+ * this datum, never from compiled-in per-domain code.
82
+ */
83
+ export interface CapabilityDiscoveryDescriptor {
84
+ /** The on-disk discovery mode (marker or name-pattern). */
85
+ readonly discovery: CapabilityDiscoveryMode;
86
+ /** The module export the contributions live under (`checks`/`scenarios`/`adapter`). */
87
+ readonly exportName: string;
88
+ /** Whether `exportName` is an array of contributions or a single one. */
89
+ readonly exportShape: 'array' | 'single';
90
+ /**
91
+ * The `opensip-cli.config.yml` `plugins.*` keys this domain's preferences live
92
+ * under (the existing per-domain keys, mapped so the documented config keeps
93
+ * working unchanged). Omitted keys default to "auto-discover on, no explicit list".
94
+ */
95
+ readonly configKeys: {
96
+ readonly packages?: string;
97
+ readonly autoDiscover?: string;
98
+ readonly scopes?: string;
99
+ };
100
+ /**
101
+ * Optional package scope that marks a BUILT-IN contribution pack (resolved from
102
+ * the CLI install dir) vs a custom one (resolved from the project) — e.g. fit
103
+ * splits `@opensip-cli/` built-in check packs from project-local ones.
104
+ */
105
+ readonly builtinScope?: string;
106
+ /**
107
+ * How an explicit package list (`configKeys.packages`) interacts with
108
+ * auto-discovery:
109
+ * - `'replace'` (default) — an explicit list WINS; auto-discovery is skipped
110
+ * (sim/graph: a pinned list is deterministic).
111
+ * - `'augment'` — the explicit list is ADDED to auto-discovery, deduped (fit:
112
+ * `checkPackages` names packs that don't declare the marker yet, on top of
113
+ * marker discovery).
114
+ */
115
+ readonly explicitListMode?: 'replace' | 'augment';
116
+ /**
117
+ * Secondary exports the same package walk also routes to OTHER domains (§5.3
118
+ * separate-domains fold) — e.g. a fit-pack's co-located `recipes` routed to the
119
+ * `fit-recipe` domain. Each is read from every discovered package alongside the
120
+ * primary export.
121
+ */
122
+ readonly coContributions?: readonly CapabilityCoContribution[];
123
+ }
124
+ /**
125
+ * The static description of a capability domain a tool owns. Declared in
126
+ * the owning tool's manifest (see {@link ToolCapabilityDeclaration}) and
127
+ * registered into the per-run {@link CapabilityRegistry} alongside the
128
+ * owner-supplied registrar.
129
+ *
130
+ * The host stores this verbatim and uses it only to (a) confirm a routed
131
+ * contribution targets a declared domain and (b) validate the contribution
132
+ * against `contributionSchema` before handing it to the registrar. It is
133
+ * deliberately tool-agnostic — the kernel never reads a domain-specific
134
+ * field.
135
+ */
136
+ export interface CapabilityDomainSpec {
137
+ /** Stable domain id — e.g. 'fit-pack', 'sim-pack', 'graph-adapter', 'audit-rule'. */
138
+ readonly id: string;
139
+ /** The `ToolPluginManifest.id` of the tool that owns this domain. */
140
+ readonly ownerToolId: string;
141
+ /**
142
+ * Coarse integer epoch for THIS domain's contribution contract (distinct
143
+ * from the plugin-API epoch). Bumped when the contribution shape changes
144
+ * incompatibly; lets a domain version its own extension point.
145
+ */
146
+ readonly apiVersion: number;
147
+ /**
148
+ * The contract a contribution must satisfy. `unknown` at the kernel
149
+ * layer — the host validates it structurally (a shallow required-keys
150
+ * record, see {@link StructuralContributionSchema}) or via an
151
+ * owner-supplied {@link CapabilityValidator}. NEVER a Zod schema in core.
152
+ */
153
+ readonly contributionSchema: unknown;
154
+ /** How contributions to this domain are delivered. */
155
+ readonly contributionKind: CapabilityContributionKind;
156
+ /**
157
+ * How this domain's contribution packages are discovered + loaded (§5.3). When
158
+ * present, the generic discovery substrate auto-discovers contributions for this
159
+ * domain from it; when absent, the domain receives only explicit/manifest
160
+ * contributions (no auto-discovery).
161
+ */
162
+ readonly discovery?: CapabilityDiscoveryDescriptor;
163
+ }
164
+ /**
165
+ * A capability-domain declaration as it appears in a tool's static
166
+ * manifest (`ToolPluginManifest.capabilities[]`). Identical in shape to
167
+ * the runtime {@link CapabilityDomainSpec} EXCEPT `ownerToolId` is
168
+ * implied by the manifest's own `id` (the host stamps it on at read time),
169
+ * so a manifest author never repeats the owner id.
170
+ *
171
+ * Optional and additive: a manifest with no `capabilities` simply
172
+ * contributes no domains, and `MARKER_KINDS` remains the bootstrap-default
173
+ * vocabulary (a manifest domain EXTENDS that set, never replaces it).
174
+ */
175
+ export interface ToolCapabilityDeclaration {
176
+ /** Stable domain id this tool declares ownership of. */
177
+ readonly id: string;
178
+ /** Contribution-contract epoch for this domain. */
179
+ readonly apiVersion: number;
180
+ /** The contribution contract (structural record or validator). `unknown` in core. */
181
+ readonly contributionSchema: unknown;
182
+ /** How contributions to this domain are delivered. */
183
+ readonly contributionKind: CapabilityContributionKind;
184
+ /** How this domain's contribution packages are discovered + loaded (§5.3). */
185
+ readonly discovery?: CapabilityDiscoveryDescriptor;
186
+ }
187
+ /**
188
+ * The owner-supplied callback the host invokes once a contribution has passed
189
+ * the domain's schema check. The host hands the validated contribution
190
+ * straight through — it never inspects the contribution's domain-specific
191
+ * meaning. The registrar performs the actual registration into the owning
192
+ * tool's own registry (a `CheckRegistry`, scenario `Registry`, graph-adapter
193
+ * registry, …).
194
+ *
195
+ * Defined HERE (the leaf domain model) rather than in the host-side
196
+ * `capability-registry.ts` so the `Tool` contract (`tools/types.ts`) can name
197
+ * it without importing the host registry — which would pull in
198
+ * `lib/run-scope.ts` and reintroduce the `run-scope → … → tools/types`
199
+ * import cycle. `capability-registry.ts` re-exports it for back-compat.
200
+ */
201
+ export type CapabilityRegistrar = (contribution: unknown) => void;
202
+ /**
203
+ * A tool's namespaced configuration contribution, as the kernel sees it
204
+ * (launch, ADR-0023, Phase 4). The concrete schema-bearing type —
205
+ * `ToolConfigDeclaration` — lives in `@opensip-cli/config` (which carries
206
+ * Zod); core must not depend on config or Zod, so this kernel-side carrier
207
+ * keeps `schema` (and `defaults`/`env`) `unknown`. The composition root (the
208
+ * CLI, which DOES import `@opensip-cli/config`) narrows a tool's `config`
209
+ * slot back to the concrete `ToolConfigDeclaration` when it gathers the
210
+ * declarations to compose + validate the whole document.
211
+ *
212
+ * Any `ToolConfigDeclaration` is structurally assignable to this carrier (a
213
+ * `ZodType` is assignable to `unknown`), so a tool sets `config: myDeclaration`
214
+ * directly. Defined here (not in the host registry) so the leaf `Tool`
215
+ * contract can name it without an import cycle.
216
+ */
217
+ export interface ToolConfigContribution {
218
+ /** Top-level config key owned by this tool (e.g. `graph`, `fitness`). */
219
+ readonly namespace: string;
220
+ /** The tool's namespace schema — a Zod schema at the config layer, `unknown` here. */
221
+ readonly schema: unknown;
222
+ /** Optional defaults for the namespace (lowest-precedence source). */
223
+ readonly defaults?: unknown;
224
+ /** Optional environment-variable bindings for keys in this namespace. */
225
+ readonly env?: unknown;
226
+ }
227
+ /**
228
+ * An owner-supplied validator: returns `true` when `contribution` satisfies
229
+ * the domain's contract, or a string explaining why it does not. A domain
230
+ * whose `contributionSchema` is a function is validated by CALLING it; this
231
+ * is how a domain expresses a richer-than-structural contract without
232
+ * dragging a schema library into the kernel.
233
+ */
234
+ export type CapabilityValidator = (contribution: unknown) => true | string;
235
+ /**
236
+ * A structural contribution schema: the kernel's Zod-free default. Each
237
+ * listed key must be PRESENT (and non-`undefined`) on the contribution
238
+ * record; an optional `kind` predicate further narrows the value. The host
239
+ * checks these shallowly — enough to reject an obviously wrong-shaped
240
+ * contribution before it reaches the owner's registrar, without the kernel
241
+ * understanding the domain.
242
+ */
243
+ export interface StructuralContributionSchema {
244
+ /** Keys that must be present (and not `undefined`) on the contribution. */
245
+ readonly requiredKeys: readonly string[];
246
+ }
247
+ /**
248
+ * Type guard: a `contributionSchema` is an owner-supplied validator
249
+ * function (validated by calling it) rather than a structural record.
250
+ */
251
+ export declare function isCapabilityValidator(schema: unknown): schema is CapabilityValidator;
252
+ /**
253
+ * Type guard: a `contributionSchema` is a {@link StructuralContributionSchema}
254
+ * (a `{ requiredKeys: string[] }` record the host checks shallowly).
255
+ */
256
+ export declare function isStructuralContributionSchema(schema: unknown): schema is StructuralContributionSchema;
257
+ //# sourceMappingURL=capability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../../src/tools/capability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,0BAA0B,GAAG,eAAe,GAAG,gBAAgB,GAAG,MAAM,CAAC;AAErF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,uBAAuB,GAC/B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACxD;IACE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C,CAAC;AAEN;;;;;;GAMG;AACH,MAAM,WAAW,wBAAwB;IACvC,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,yEAAyE;IACzE,QAAQ,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzC,gFAAgF;IAChF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,6BAA6B;IAC5C,2DAA2D;IAC3D,QAAQ,CAAC,SAAS,EAAE,uBAAuB,CAAC;IAC5C,uFAAuF;IACvF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,yEAAyE;IACzE,QAAQ,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE;QACnB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QA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yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,sFAAsF;IACtF,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,yEAAyE;IACzE,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,YAAY,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,CAAC;AAE3E;;;;;;;GAOG;AACH,MAAM,WAAW,4BAA4B;IAC3C,2EAA2E;IAC3E,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,mBAAmB,CAEpF;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,4BAA4B,CAOxC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @fileoverview Capability domain model (launch, §5.3).
3
+ *
4
+ * A **capability domain** is a named extension point a tool OWNS — "fit
5
+ * has checks", "sim has scenarios", "graph has language adapters". Today
6
+ * the host knows these by a compiled-in enum (`MARKER_KINDS` in
7
+ * `marker-discovery.ts`). The capability model turns that knowledge into
8
+ * DATA: a tool declares the domains it owns in its static manifest
9
+ * (`ToolPluginManifest.capabilities`), and the host registers each one in
10
+ * a per-run capability registry WITHOUT being compiled to understand it.
11
+ *
12
+ * The host's only jobs are (a) record that a declared domain exists and
13
+ * who owns it, and (b) route an incoming contribution to the owning tool's
14
+ * registrar after checking it targets a declared domain and passes that
15
+ * domain's `contributionSchema`. The host never interprets the
16
+ * contribution itself — the owner supplies the registrar.
17
+ *
18
+ * `contributionSchema` is `unknown` at the kernel layer ON PURPOSE: `core`
19
+ * carries no Zod (the composer in `@opensip-cli/config` does). A domain
20
+ * validates a contribution either structurally (the host applies a
21
+ * built-in shallow check) or via an owner-supplied validator function
22
+ * (see {@link CapabilityValidator}) — never by importing a schema library
23
+ * into the kernel.
24
+ *
25
+ * These types live in **core** next to the `Tool` contract + manifest;
26
+ * `contracts` re-exports them for the public surface (core cannot import
27
+ * contracts).
28
+ */
29
+ /**
30
+ * Type guard: a `contributionSchema` is an owner-supplied validator
31
+ * function (validated by calling it) rather than a structural record.
32
+ */
33
+ export function isCapabilityValidator(schema) {
34
+ return typeof schema === 'function';
35
+ }
36
+ /**
37
+ * Type guard: a `contributionSchema` is a {@link StructuralContributionSchema}
38
+ * (a `{ requiredKeys: string[] }` record the host checks shallowly).
39
+ */
40
+ export function isStructuralContributionSchema(schema) {
41
+ return (typeof schema === 'object' &&
42
+ schema !== null &&
43
+ Array.isArray(schema.requiredKeys) &&
44
+ schema.requiredKeys.every((k) => typeof k === 'string'));
45
+ }
46
+ //# sourceMappingURL=capability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability.js","sourceRoot":"","sources":["../../src/tools/capability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAqOH;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAe;IACnD,OAAO,OAAO,MAAM,KAAK,UAAU,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,8BAA8B,CAC5C,MAAe;IAEf,OAAO,CACL,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,KAAK,IAAI;QACf,KAAK,CAAC,OAAO,CAAE,MAAqC,CAAC,YAAY,CAAC;QACjE,MAAsC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CACzF,CAAC;AACJ,CAAC"}