@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,74 @@
1
+ /**
2
+ * DiagnosticsBus — the scope-owned collector that gathers {@link DiagnosticEvent}s
3
+ * across the uniform tool lifecycle and snapshots them as {@link RunDiagnostics}
4
+ * to ride on a `CommandOutcome` (north-star §5.10, launch).
5
+ *
6
+ * Per-invocation state, held on {@link RunScope} (the no-module-singleton rule):
7
+ * library code deep in the call tree emits via `currentScope()?.diagnostics`, and
8
+ * the host assembler attaches `scope.diagnostics.snapshot()` to every outcome.
9
+ * Additive — the logger, runId, and graph OTEL spans stay; this is the
10
+ * structured, JSON-emittable layer on top.
11
+ *
12
+ * The bus is a runtime collector (like the logger), so it stamps wall-clock time
13
+ * (`new Date().toISOString()`) — the `Date.now()`-free contract applies to the
14
+ * pure formatters (`buildSignalEnvelope`), not to this collector. The OTEL trace
15
+ * bridge is best-effort: `snapshot().trace` carries the active span's
16
+ * trace/span ids when telemetry is on, parsed from the W3C `traceparent` the
17
+ * kernel already exposes — so bundled and external tools are observable
18
+ * identically, with no SDK dependency in the kernel.
19
+ */
20
+ import { currentTraceparent } from './telemetry.js';
21
+ /**
22
+ * Parse the `traceId` / `spanId` out of a W3C `traceparent`
23
+ * (`version-traceid-spanid-flags`). Returns `undefined` when telemetry is off
24
+ * (no active recording span → no traceparent) or the string is malformed.
25
+ */
26
+ function parseTrace() {
27
+ const traceparent = currentTraceparent();
28
+ if (traceparent === undefined)
29
+ return undefined;
30
+ const parts = traceparent.split('-');
31
+ if (parts.length < 4)
32
+ return undefined;
33
+ return { traceId: parts[1], spanId: parts[2] };
34
+ }
35
+ /**
36
+ * The per-invocation diagnostics collector. Construct one per {@link RunScope}.
37
+ */
38
+ export class DiagnosticsBus {
39
+ runId;
40
+ events = [];
41
+ metrics = new Map();
42
+ constructor(runId) {
43
+ this.runId = runId;
44
+ }
45
+ /**
46
+ * Append a lifecycle event. The bus stamps `at` (ISO-8601) when the caller did
47
+ * not supply one. Cheap and allocation-light; safe to call from any phase.
48
+ */
49
+ emit(event) {
50
+ this.events.push({ ...event, at: event.at ?? new Date().toISOString() });
51
+ }
52
+ /** Convenience: emit at a given phase/level with an optional data bag. */
53
+ event(phase, level, message, data) {
54
+ this.emit(data === undefined ? { phase, level, message } : { phase, level, message, data });
55
+ }
56
+ /** Increment a named counter (e.g. `'plugins.loaded'`). Defaults to +1. */
57
+ counter(name, delta = 1) {
58
+ this.metrics.set(name, (this.metrics.get(name) ?? 0) + delta);
59
+ }
60
+ /**
61
+ * Materialize the JSON-emittable snapshot carried on a `CommandOutcome`. Pure
62
+ * read: copies the event stream + metrics and bridges the active OTEL trace.
63
+ */
64
+ snapshot() {
65
+ const trace = parseTrace();
66
+ return {
67
+ runId: this.runId,
68
+ events: [...this.events],
69
+ ...(this.metrics.size > 0 ? { metrics: Object.fromEntries(this.metrics) } : {}),
70
+ ...(trace ? { trace } : {}),
71
+ };
72
+ }
73
+ }
74
+ //# sourceMappingURL=diagnostics-bus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics-bus.js","sourceRoot":"","sources":["../../src/lib/diagnostics-bus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAYpD;;;;GAIG;AACH,SAAS,UAAU;IACjB,MAAM,WAAW,GAAG,kBAAkB,EAAE,CAAC;IACzC,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAChD,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;I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,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/E,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5B,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * EnvRegistry — a governed registry of environment variables (north-star §5.12,
3
+ * launch).
4
+ *
5
+ * Environment variables are a user-facing configuration surface, but today they
6
+ * are read inline (`process.env.X`) across ~half a dozen packages with no
7
+ * canonical name, no alias policy, no coercion, no documentation, and no
8
+ * deprecation path. `EnvRegistry` is the single seam every env read flows through:
9
+ * a tool/host declares an {@link EnvVarSpec} (canonical name, aliases, coercion,
10
+ * default, docs, deprecation), and all reads go through {@link EnvRegistry.get}.
11
+ * The `env-via-registry` guardrail (launch) then fails CI on any raw `process.env`
12
+ * access outside this module.
13
+ *
14
+ * Layering / state: this is a KERNEL observability primitive, beside `logger` and
15
+ * `ids`. Reading `process.env` HERE is the one sanctioned site — the registry IS
16
+ * the seam the guardrail points everything else at. The DEFINITION table a caller
17
+ * passes in is an immutable constant; that does not violate the no-module-
18
+ * singleton rule (which targets mutable per-run state), and it is exactly why the
19
+ * registry can serve the pre-scope readers (terminal theme, graph heap-preflight)
20
+ * that run before `RunScope` exists — they read through a static instance over the
21
+ * immutable table, not a scope-bound one.
22
+ *
23
+ * Pure read model: `get` resolves canonical → aliases in declaration order,
24
+ * coerces, and applies the default; it never mutates `process.env`. Deprecation is
25
+ * surfaced (not logged here — core stays log-light) so the composing host can emit
26
+ * a structured `cli.env.read_deprecated` event when a deprecated alias is hit.
27
+ */
28
+ /**
29
+ * A deprecation note on an env var or one of its aliases. `since` is the release
30
+ * the deprecation began; `use` names the canonical replacement to migrate to.
31
+ */
32
+ export interface EnvDeprecation {
33
+ readonly since: string;
34
+ readonly use?: string;
35
+ }
36
+ /**
37
+ * Declarative description of one environment variable.
38
+ *
39
+ * @typeParam T - the coerced value type (defaults to `string` — the raw value).
40
+ */
41
+ export interface EnvVarSpec<T = string> {
42
+ /** Canonical, documented name (e.g. `OPENSIP_NO_UPDATE`). */
43
+ readonly canonical: string;
44
+ /**
45
+ * Accepted aliases, in resolution order AFTER the canonical name (e.g. the npm
46
+ * convention `NO_UPDATE_NOTIFIER`). A hit on an alias marked via
47
+ * {@link EnvVarSpec.deprecated} is reported by {@link EnvRegistry.get} so the
48
+ * caller can warn.
49
+ */
50
+ readonly aliases?: readonly string[];
51
+ /**
52
+ * Pure coercion from the raw string to `T` (e.g. `(raw) => raw === '1'`).
53
+ * Omitted ⇒ identity (the value type is `string`). Never reads other env.
54
+ */
55
+ readonly coerce?: (raw: string) => T;
56
+ /** Value when neither canonical nor any alias is set. */
57
+ readonly default?: T;
58
+ /** One-line documentation surfaced in the generated env-surface reference. */
59
+ readonly docs: string;
60
+ /** Deprecation policy for the canonical name (alias-level handled at read). */
61
+ readonly deprecated?: EnvDeprecation;
62
+ }
63
+ /**
64
+ * Result of an {@link EnvRegistry.get} read. `value` is the coerced value (or the
65
+ * spec default, or `undefined`); `source` names which key supplied it; and
66
+ * `deprecated` carries the note when the resolved key (canonical or alias) is
67
+ * deprecated, so the caller can emit a structured warning.
68
+ */
69
+ export interface EnvReadResult<T> {
70
+ readonly value: T | undefined;
71
+ readonly source: 'canonical' | 'alias' | 'default' | 'unset';
72
+ readonly deprecated?: EnvDeprecation;
73
+ }
74
+ /**
75
+ * The composed registry. Construct once (host) over the full {@link EnvVarSpec}
76
+ * set; read via {@link EnvRegistry.get} (coerced value only) or
77
+ * {@link EnvRegistry.read} (value + source + deprecation). The pre-scope static
78
+ * accessor (terminal theme, heap-preflight) constructs its own instance over the
79
+ * shared immutable host table.
80
+ */
81
+ export declare class EnvRegistry {
82
+ private readonly byCanonical;
83
+ constructor(specs: readonly EnvVarSpec<unknown>[]);
84
+ /** True when this canonical name is registered. */
85
+ has(canonical: string): boolean;
86
+ /** Every registered spec, for the generated env-surface reference doc. */
87
+ describe(): readonly EnvVarSpec<unknown>[];
88
+ /**
89
+ * Resolve a variable to its coerced value: canonical first, then aliases in
90
+ * order, else the spec default, else `undefined`. The convenience form of
91
+ * {@link EnvRegistry.read} when the caller does not need source/deprecation.
92
+ */
93
+ get<T = string>(canonical: string): T | undefined;
94
+ /**
95
+ * Resolve a variable to its value PLUS provenance. Reads `process.env` for the
96
+ * canonical name, then each alias in declaration order; the first set key wins.
97
+ * A deprecation note is attached when the resolved key is deprecated (the
98
+ * canonical's own `deprecated`, or — for an alias hit — the canonical
99
+ * `deprecated` if present, since an alias existing at all is the migration
100
+ * signal). Unknown canonical names throw: a typo in a host spec is a bug, not a
101
+ * silent `undefined`.
102
+ *
103
+ * @throws {Error} When `canonical` is not a registered {@link EnvVarSpec} — a
104
+ * host-spec typo surfaces loudly here rather than as a silent `undefined`.
105
+ */
106
+ read<T = string>(canonical: string): EnvReadResult<T>;
107
+ }
108
+ //# sourceMappingURL=env-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-registry.d.ts","sourceRoot":"","sources":["../../src/lib/env-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,MAAM;IACpC,6DAA6D;IAC7D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC,CAAC;IACrC,yDAAyD;IACzD,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACrB,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+EAA+E;IAC/E,QAAQ,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC;CACtC;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;IAC7D,QAAQ,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC;CACtC;AAED;;;;;;GAMG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA0C;gBAE1D,KAAK,EAAE,SAAS,UAAU,CAAC,OAAO,CAAC,EAAE;IAMjD,mDAAmD;IACnD,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAI/B,0EAA0E;IAC1E,QAAQ,IAAI,SAAS,UAAU,CAAC,OAAO,CAAC,EAAE;IAI1C;;;;OAIG;IACH,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAIjD;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC;CA4BtD"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * EnvRegistry — a governed registry of environment variables (north-star §5.12,
3
+ * launch).
4
+ *
5
+ * Environment variables are a user-facing configuration surface, but today they
6
+ * are read inline (`process.env.X`) across ~half a dozen packages with no
7
+ * canonical name, no alias policy, no coercion, no documentation, and no
8
+ * deprecation path. `EnvRegistry` is the single seam every env read flows through:
9
+ * a tool/host declares an {@link EnvVarSpec} (canonical name, aliases, coercion,
10
+ * default, docs, deprecation), and all reads go through {@link EnvRegistry.get}.
11
+ * The `env-via-registry` guardrail (launch) then fails CI on any raw `process.env`
12
+ * access outside this module.
13
+ *
14
+ * Layering / state: this is a KERNEL observability primitive, beside `logger` and
15
+ * `ids`. Reading `process.env` HERE is the one sanctioned site — the registry IS
16
+ * the seam the guardrail points everything else at. The DEFINITION table a caller
17
+ * passes in is an immutable constant; that does not violate the no-module-
18
+ * singleton rule (which targets mutable per-run state), and it is exactly why the
19
+ * registry can serve the pre-scope readers (terminal theme, graph heap-preflight)
20
+ * that run before `RunScope` exists — they read through a static instance over the
21
+ * immutable table, not a scope-bound one.
22
+ *
23
+ * Pure read model: `get` resolves canonical → aliases in declaration order,
24
+ * coerces, and applies the default; it never mutates `process.env`. Deprecation is
25
+ * surfaced (not logged here — core stays log-light) so the composing host can emit
26
+ * a structured `cli.env.read_deprecated` event when a deprecated alias is hit.
27
+ */
28
+ /**
29
+ * The composed registry. Construct once (host) over the full {@link EnvVarSpec}
30
+ * set; read via {@link EnvRegistry.get} (coerced value only) or
31
+ * {@link EnvRegistry.read} (value + source + deprecation). The pre-scope static
32
+ * accessor (terminal theme, heap-preflight) constructs its own instance over the
33
+ * shared immutable host table.
34
+ */
35
+ export class EnvRegistry {
36
+ byCanonical = new Map();
37
+ constructor(specs) {
38
+ for (const spec of specs) {
39
+ this.byCanonical.set(spec.canonical, spec);
40
+ }
41
+ }
42
+ /** True when this canonical name is registered. */
43
+ has(canonical) {
44
+ return this.byCanonical.has(canonical);
45
+ }
46
+ /** Every registered spec, for the generated env-surface reference doc. */
47
+ describe() {
48
+ return [...this.byCanonical.values()];
49
+ }
50
+ /**
51
+ * Resolve a variable to its coerced value: canonical first, then aliases in
52
+ * order, else the spec default, else `undefined`. The convenience form of
53
+ * {@link EnvRegistry.read} when the caller does not need source/deprecation.
54
+ */
55
+ get(canonical) {
56
+ return this.read(canonical).value;
57
+ }
58
+ /**
59
+ * Resolve a variable to its value PLUS provenance. Reads `process.env` for the
60
+ * canonical name, then each alias in declaration order; the first set key wins.
61
+ * A deprecation note is attached when the resolved key is deprecated (the
62
+ * canonical's own `deprecated`, or — for an alias hit — the canonical
63
+ * `deprecated` if present, since an alias existing at all is the migration
64
+ * signal). Unknown canonical names throw: a typo in a host spec is a bug, not a
65
+ * silent `undefined`.
66
+ *
67
+ * @throws {Error} When `canonical` is not a registered {@link EnvVarSpec} — a
68
+ * host-spec typo surfaces loudly here rather than as a silent `undefined`.
69
+ */
70
+ read(canonical) {
71
+ const spec = this.byCanonical.get(canonical);
72
+ if (spec === undefined) {
73
+ throw new Error(`EnvRegistry: unknown variable '${canonical}' — declare an EnvVarSpec before reading it.`);
74
+ }
75
+ const coerce = (raw) => (spec.coerce ? spec.coerce(raw) : raw);
76
+ const canonicalRaw = process.env[spec.canonical];
77
+ if (canonicalRaw !== undefined) {
78
+ return { value: coerce(canonicalRaw), source: 'canonical', deprecated: spec.deprecated };
79
+ }
80
+ for (const alias of spec.aliases ?? []) {
81
+ const aliasRaw = process.env[alias];
82
+ if (aliasRaw !== undefined) {
83
+ return { value: coerce(aliasRaw), source: 'alias', deprecated: spec.deprecated };
84
+ }
85
+ }
86
+ if (spec.default !== undefined) {
87
+ return { value: spec.default, source: 'default' };
88
+ }
89
+ return { value: undefined, source: 'unset' };
90
+ }
91
+ }
92
+ //# sourceMappingURL=env-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-registry.js","sourceRoot":"","sources":["../../src/lib/env-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAmDH;;;;;;GAMG;AACH,MAAM,OAAO,WAAW;IACL,WAAW,GAAG,IAAI,GAAG,EAA+B,CAAC;IAEtE,YAAY,KAAqC;QAC/C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC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EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;YACnF,CAAC;QACH,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;QACpD,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC/C,CAAC;CACF"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Typed error classes and Result pattern for opensip-cli.
3
+ */
4
+ /**
5
+ * Closed union of canonical error codes carried by `ToolError` and its
6
+ * subclasses. Open by intent at the consumer layer — callers may pass
7
+ * any string in `ToolErrorOptions.code` (subclass-specific subcodes
8
+ * like `'VALIDATION.RECIPE.DUPLICATE'` are common) — but the base
9
+ * default for each subclass is one of these literals, which means an
10
+ * `instanceof` check pairs naturally with an exhaustive switch on
11
+ * `code` for the no-override case.
12
+ */
13
+ export type ToolErrorCode = 'VALIDATION_ERROR' | 'NOT_FOUND' | 'SYSTEM_ERROR' | 'TIMEOUT' | 'NETWORK_ERROR' | 'CONFIGURATION_ERROR' | 'PLUGIN_INCOMPATIBLE' | 'UNKNOWN_LIVE_VIEW';
14
+ /** Constructor options for {@link ToolError}: `code` plus arbitrary diagnostic metadata. */
15
+ export interface ToolErrorOptions extends ErrorOptions {
16
+ code?: string;
17
+ [key: string]: unknown;
18
+ }
19
+ /** Base class for all opensip-cli errors; carries a `code` for programmatic dispatch. */
20
+ export declare class ToolError extends Error {
21
+ /**
22
+ * Error code. Typed as a `string` super-set of `ToolErrorCode` because
23
+ * subclass call sites may opt into a more specific subcode via
24
+ * `ToolErrorOptions.code` (e.g. `'VALIDATION.RECIPE.DUPLICATE'`). For
25
+ * exhaustive-switch use cases, narrow with the `ToolErrorCode` union
26
+ * after an `instanceof` check.
27
+ */
28
+ readonly code: string;
29
+ constructor(message: string, code: string, options?: ToolErrorOptions);
30
+ }
31
+ /** Thrown when user-supplied input (config, CLI flags, recipes) fails schema or domain validation. */
32
+ export declare class ValidationError extends ToolError {
33
+ constructor(message: string, options?: ToolErrorOptions);
34
+ }
35
+ /** Thrown when a named resource (check, recipe, file, session) cannot be located. */
36
+ export declare class NotFoundError extends ToolError {
37
+ constructor(message: string, options?: ToolErrorOptions);
38
+ }
39
+ /** Thrown for internal invariant violations or unexpected runtime failures. */
40
+ export declare class SystemError extends ToolError {
41
+ constructor(message: string, options?: ToolErrorOptions);
42
+ }
43
+ /** Thrown when an operation exceeds its allotted time budget. */
44
+ export declare class TimeoutError extends ToolError {
45
+ readonly timeoutMs?: number;
46
+ constructor(message: string, timeoutOrOptions?: number | ToolErrorOptions);
47
+ }
48
+ /** Thrown for HTTP or socket-level failures during outbound requests. */
49
+ export declare class NetworkError extends ToolError {
50
+ readonly statusCode?: number;
51
+ constructor(message: string, options?: ToolErrorOptions & {
52
+ statusCode?: number;
53
+ });
54
+ }
55
+ /** Thrown when project or tool configuration is missing, malformed, or contradictory. */
56
+ export declare class ConfigurationError extends ToolError {
57
+ constructor(message: string, options?: ToolErrorOptions);
58
+ }
59
+ /**
60
+ * Thrown when a tool plugin is rejected by the compatibility/trust gate
61
+ * (launch) and the rejection must fail the run rather than skip
62
+ * silently — i.e. the tool was explicitly requested but is incompatible,
63
+ * or a project-local executable tool was not allowlisted (deny-by-default).
64
+ *
65
+ * Mapped to `EXIT_CODES.PLUGIN_INCOMPATIBLE` (exit 5) by
66
+ * `mapToolErrorToExitCode` so an incompatible/untrusted plugin is
67
+ * diagnosable from the exit code alone. Carries the structured
68
+ * `diagnostic` the admission gate produced (compatibility reason or the
69
+ * trust-policy message) for surfacing through the CLI error boundary.
70
+ */
71
+ export declare class PluginIncompatibleError extends ToolError {
72
+ /** The admission diagnostic (compatibility reason or trust-policy message). */
73
+ readonly diagnostic?: string;
74
+ constructor(message: string, options?: ToolErrorOptions & {
75
+ diagnostic?: string;
76
+ });
77
+ }
78
+ /**
79
+ * Thrown when a contribution is routed to a capability domain that no tool
80
+ * has declared (launch, §5.3). A subclass of {@link NotFoundError}
81
+ * (so existing not-found handling still catches it) that additionally
82
+ * carries the structured diagnostic the capability registry produced: the
83
+ * unknown `domainId` and the set of `knownDomains`. Code defaults to
84
+ * `'CAPABILITY.DOMAIN.UNKNOWN'`.
85
+ */
86
+ export declare class UnknownCapabilityDomainError extends NotFoundError {
87
+ /** The domain id that was routed to but not declared. */
88
+ readonly domainId: string;
89
+ /** The domain ids that ARE declared on the registry (for diagnostics). */
90
+ readonly knownDomains: readonly string[];
91
+ constructor(message: string, options: ToolErrorOptions & {
92
+ domainId: string;
93
+ knownDomains: readonly string[];
94
+ });
95
+ }
96
+ /**
97
+ * Thrown when a contribution fails the schema check of the capability
98
+ * domain it targets (launch, §5.3). A subclass of
99
+ * {@link ValidationError} that carries the structured diagnostic: the
100
+ * `domainId`, the owning tool's `ownerToolId`, and a human-readable
101
+ * `diagnostic` reason. Code defaults to
102
+ * `'CAPABILITY.CONTRIBUTION.SCHEMA_MISMATCH'`.
103
+ */
104
+ export declare class CapabilitySchemaMismatchError extends ValidationError {
105
+ /** The domain id whose schema the contribution failed. */
106
+ readonly domainId: string;
107
+ /** The tool that owns the targeted domain. */
108
+ readonly ownerToolId: string;
109
+ /** Human-readable reason the contribution failed the schema. */
110
+ readonly diagnostic: string;
111
+ constructor(message: string, options: ToolErrorOptions & {
112
+ domainId: string;
113
+ ownerToolId: string;
114
+ diagnostic: string;
115
+ });
116
+ }
117
+ export type Result<T, E = ToolError> = {
118
+ readonly ok: true;
119
+ readonly value: T;
120
+ } | {
121
+ readonly ok: false;
122
+ readonly error: E;
123
+ };
124
+ /** Constructs a success {@link Result} carrying `value`. */
125
+ export declare function ok<T>(value: T): Result<T, never>;
126
+ /** Constructs a failure {@link Result} carrying `error`. */
127
+ export declare function err<E>(error: E): Result<never, E>;
128
+ /** Wraps an async function in a try/catch, returning a Result instead of throwing. */
129
+ export declare function tryCatchAsync<T>(fn: () => Promise<T>): Promise<Result<T, Error>>;
130
+ /** Wraps a sync function in a try/catch, returning a Result instead of throwing. */
131
+ export declare function tryCatch<T>(fn: () => T): Result<T, Error>;
132
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,GACrB,kBAAkB,GAClB,WAAW,GACX,cAAc,GACd,SAAS,GACT,eAAe,GACf,qBAAqB,GACrB,qBAAqB,GACrB,mBAAmB,CAAC;AAExB,4FAA4F;AAC5F,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,yFAAyF;AACzF,qBAAa,SAAU,SAAQ,KAAK;IAClC;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB;CAKtE;AAED,sGAAsG;AACtG,qBAAa,eAAgB,SAAQ,SAAS;gBAChC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB;CAIxD;AAED,qFAAqF;AACrF,qBAAa,aAAc,SAAQ,SAAS;gBAC9B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB;CAIxD;AAED,+EAA+E;AAC/E,qBAAa,WAAY,SAAQ,SAAS;gBAC5B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB;CAIxD;AAED,iEAAiE;AACjE,qBAAa,YAAa,SAAQ,SAAS;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC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AAO,EAAE,gBAAgB,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE;CAW5F;AAMD,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,IAC/B;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GACxC;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC;AAE9C,4DAA4D;AAC5D,wBAAgB,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAEhD;AAED,4DAA4D;AAC5D,wBAAgB,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAEjD;AAED,sFAAsF;AACtF,wBAAsB,aAAa,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAMtF;AAED,oFAAoF;AACpF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAMzD"}
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Typed error classes and Result pattern for opensip-cli.
3
+ */
4
+ /** Base class for all opensip-cli errors; carries a `code` for programmatic dispatch. */
5
+ export class ToolError extends Error {
6
+ /**
7
+ * Error code. Typed as a `string` super-set of `ToolErrorCode` because
8
+ * subclass call sites may opt into a more specific subcode via
9
+ * `ToolErrorOptions.code` (e.g. `'VALIDATION.RECIPE.DUPLICATE'`). For
10
+ * exhaustive-switch use cases, narrow with the `ToolErrorCode` union
11
+ * after an `instanceof` check.
12
+ */
13
+ code;
14
+ constructor(message, code, options) {
15
+ super(message, options);
16
+ this.name = 'ToolError';
17
+ this.code = code;
18
+ }
19
+ }
20
+ /** Thrown when user-supplied input (config, CLI flags, recipes) fails schema or domain validation. */
21
+ export class ValidationError extends ToolError {
22
+ constructor(message, options) {
23
+ super(message, options?.code ?? 'VALIDATION_ERROR', options);
24
+ this.name = 'ValidationError';
25
+ }
26
+ }
27
+ /** Thrown when a named resource (check, recipe, file, session) cannot be located. */
28
+ export class NotFoundError extends ToolError {
29
+ constructor(message, options) {
30
+ super(message, options?.code ?? 'NOT_FOUND', options);
31
+ this.name = 'NotFoundError';
32
+ }
33
+ }
34
+ /** Thrown for internal invariant violations or unexpected runtime failures. */
35
+ export class SystemError extends ToolError {
36
+ constructor(message, options) {
37
+ super(message, options?.code ?? 'SYSTEM_ERROR', options);
38
+ this.name = 'SystemError';
39
+ }
40
+ }
41
+ /** Thrown when an operation exceeds its allotted time budget. */
42
+ export class TimeoutError extends ToolError {
43
+ timeoutMs;
44
+ constructor(message, timeoutOrOptions) {
45
+ const options = typeof timeoutOrOptions === 'number' ? undefined : timeoutOrOptions;
46
+ super(message, options?.code ?? 'TIMEOUT', options);
47
+ this.name = 'TimeoutError';
48
+ this.timeoutMs = typeof timeoutOrOptions === 'number' ? timeoutOrOptions : undefined;
49
+ }
50
+ }
51
+ /** Thrown for HTTP or socket-level failures during outbound requests. */
52
+ export class NetworkError extends ToolError {
53
+ statusCode;
54
+ constructor(message, options) {
55
+ super(message, options?.code ?? 'NETWORK_ERROR', options);
56
+ this.name = 'NetworkError';
57
+ this.statusCode = options?.statusCode;
58
+ }
59
+ }
60
+ /** Thrown when project or tool configuration is missing, malformed, or contradictory. */
61
+ export class ConfigurationError extends ToolError {
62
+ constructor(message, options) {
63
+ super(message, options?.code ?? 'CONFIGURATION_ERROR', options);
64
+ this.name = 'ConfigurationError';
65
+ }
66
+ }
67
+ /**
68
+ * Thrown when a tool plugin is rejected by the compatibility/trust gate
69
+ * (launch) and the rejection must fail the run rather than skip
70
+ * silently — i.e. the tool was explicitly requested but is incompatible,
71
+ * or a project-local executable tool was not allowlisted (deny-by-default).
72
+ *
73
+ * Mapped to `EXIT_CODES.PLUGIN_INCOMPATIBLE` (exit 5) by
74
+ * `mapToolErrorToExitCode` so an incompatible/untrusted plugin is
75
+ * diagnosable from the exit code alone. Carries the structured
76
+ * `diagnostic` the admission gate produced (compatibility reason or the
77
+ * trust-policy message) for surfacing through the CLI error boundary.
78
+ */
79
+ export class PluginIncompatibleError extends ToolError {
80
+ /** The admission diagnostic (compatibility reason or trust-policy message). */
81
+ diagnostic;
82
+ constructor(message, options) {
83
+ super(message, options?.code ?? 'PLUGIN_INCOMPATIBLE', options);
84
+ this.name = 'PluginIncompatibleError';
85
+ this.diagnostic = options?.diagnostic;
86
+ }
87
+ }
88
+ /**
89
+ * Thrown when a contribution is routed to a capability domain that no tool
90
+ * has declared (launch, §5.3). A subclass of {@link NotFoundError}
91
+ * (so existing not-found handling still catches it) that additionally
92
+ * carries the structured diagnostic the capability registry produced: the
93
+ * unknown `domainId` and the set of `knownDomains`. Code defaults to
94
+ * `'CAPABILITY.DOMAIN.UNKNOWN'`.
95
+ */
96
+ export class UnknownCapabilityDomainError extends NotFoundError {
97
+ /** The domain id that was routed to but not declared. */
98
+ domainId;
99
+ /** The domain ids that ARE declared on the registry (for diagnostics). */
100
+ knownDomains;
101
+ constructor(message, options) {
102
+ super(message, { ...options, code: options.code ?? 'CAPABILITY.DOMAIN.UNKNOWN' });
103
+ this.name = 'UnknownCapabilityDomainError';
104
+ this.domainId = options.domainId;
105
+ this.knownDomains = options.knownDomains;
106
+ }
107
+ }
108
+ /**
109
+ * Thrown when a contribution fails the schema check of the capability
110
+ * domain it targets (launch, §5.3). A subclass of
111
+ * {@link ValidationError} that carries the structured diagnostic: the
112
+ * `domainId`, the owning tool's `ownerToolId`, and a human-readable
113
+ * `diagnostic` reason. Code defaults to
114
+ * `'CAPABILITY.CONTRIBUTION.SCHEMA_MISMATCH'`.
115
+ */
116
+ export class CapabilitySchemaMismatchError extends ValidationError {
117
+ /** The domain id whose schema the contribution failed. */
118
+ domainId;
119
+ /** The tool that owns the targeted domain. */
120
+ ownerToolId;
121
+ /** Human-readable reason the contribution failed the schema. */
122
+ diagnostic;
123
+ constructor(message, options) {
124
+ super(message, {
125
+ ...options,
126
+ code: options.code ?? 'CAPABILITY.CONTRIBUTION.SCHEMA_MISMATCH',
127
+ });
128
+ this.name = 'CapabilitySchemaMismatchError';
129
+ this.domainId = options.domainId;
130
+ this.ownerToolId = options.ownerToolId;
131
+ this.diagnostic = options.diagnostic;
132
+ }
133
+ }
134
+ /** Constructs a success {@link Result} carrying `value`. */
135
+ export function ok(value) {
136
+ return { ok: true, value };
137
+ }
138
+ /** Constructs a failure {@link Result} carrying `error`. */
139
+ export function err(error) {
140
+ return { ok: false, error };
141
+ }
142
+ /** Wraps an async function in a try/catch, returning a Result instead of throwing. */
143
+ export async function tryCatchAsync(fn) {
144
+ try {
145
+ return ok(await fn());
146
+ }
147
+ catch (error) {
148
+ return err(error instanceof Error ? error : new Error(String(error)));
149
+ }
150
+ }
151
+ /** Wraps a sync function in a try/catch, returning a Result instead of throwing. */
152
+ export function tryCatch(fn) {
153
+ try {
154
+ return ok(fn());
155
+ }
156
+ catch (error) {
157
+ return err(error instanceof Error ? error : new Error(String(error)));
158
+ }
159
+ }
160
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AA+BH,yFAAyF;AACzF,MAAM,OAAO,SAAU,SAAQ,KAAK;IAClC;;;;;;OAMG;IACM,IAAI,CAAS;IAEtB,YAAY,OAAe,EAAE,IAAY,EAAE,OAA0B;QACnE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC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AAI,EAAW;IACrC,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,GAAG,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Execution substrate — scheduleUnits (loop/concurrency/stop), runWithTimeout
3
+ * (the §4.3 timeout fix), runWithRetry (the fitness-hoisted retry), executePipeline
4
+ * (the combinator), and deriveRecipeId.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=execution.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/execution/__tests__/execution.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}