@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,86 @@
1
+ /**
2
+ * runWithTimeout — the per-unit timeout/abort/retry wrapper of the execution
3
+ * substrate (north-star §5.8, launch).
4
+ *
5
+ * One unit's lifecycle: install an `AbortController` + `setTimeout`, run the
6
+ * domain function under that signal (optionally with retry), and classify the
7
+ * outcome as `ok` / `timeout` / `error`. The single-source abort invariant is
8
+ * preserved from fitness's `runOneCheck`: the controller is aborted ONLY by the
9
+ * timeout, so a post-run `signal.aborted` IS a timeout.
10
+ *
11
+ * This is the shared primitive that makes "a declared `timeout` actually aborts"
12
+ * true in every domain — the §4.3 fix for simulation, whose `runSingle` declared
13
+ * `execution.timeout` but never installed one.
14
+ */
15
+ import { runWithRetry } from './retry.js';
16
+ /**
17
+ * Run one unit under a timeout, returning a classified outcome (never throws for
18
+ * a domain error — it is returned as `status:'error'`). Mirrors the proven
19
+ * timeout-detection of fitness's `runOneCheck` (clear the timer, then a
20
+ * `signal.aborted` check is canonical-timeout because the controller has a single
21
+ * abort source).
22
+ */
23
+ export async function runWithTimeout(opts) {
24
+ const controller = new AbortController();
25
+ const startTime = Date.now();
26
+ const timeoutId = setTimeout(() => controller.abort(), opts.timeoutMs);
27
+ const finish = () => {
28
+ clearTimeout(timeoutId);
29
+ return Date.now() - startTime;
30
+ };
31
+ // Execute the domain work (retry or direct) and always classify to an outcome.
32
+ // This promise may never settle if the callee ignores the abort signal.
33
+ const workPromise = (async () => {
34
+ try {
35
+ if (opts.retry) {
36
+ const retry = await runWithRetry(() => opts.run(controller.signal), opts.retry);
37
+ const durationMs = finish();
38
+ if (controller.signal.aborted) {
39
+ return { status: 'timeout', durationMs, timeoutMs: opts.timeoutMs };
40
+ }
41
+ if (retry.result === undefined) {
42
+ return { status: 'error', error: retry.lastError, durationMs };
43
+ }
44
+ return { status: 'ok', result: retry.result, durationMs };
45
+ }
46
+ const result = await opts.run(controller.signal);
47
+ const durationMs = finish();
48
+ // A run that resolved AFTER the timeout fired is reported as a timeout
49
+ // (single-source abort invariant), matching fitness's post-run check.
50
+ if (controller.signal.aborted) {
51
+ return { status: 'timeout', durationMs, timeoutMs: opts.timeoutMs };
52
+ }
53
+ return { status: 'ok', result, durationMs };
54
+ }
55
+ catch (error) {
56
+ const durationMs = finish();
57
+ if (controller.signal.aborted) {
58
+ return { status: 'timeout', durationMs, timeoutMs: opts.timeoutMs };
59
+ }
60
+ return { status: 'error', error, durationMs };
61
+ }
62
+ })();
63
+ // Hard timeout: this settles the *function* with a timeout outcome even if
64
+ // the domain work never settles. We still abort the controller so cooperative
65
+ // callees can stop. Report the exact budget as duration for the timeout case
66
+ // (avoids sampling skew from the setTimeout fire time).
67
+ const hardTimeout = new Promise((resolve) => {
68
+ setTimeout(() => {
69
+ controller.abort();
70
+ resolve({
71
+ status: 'timeout',
72
+ durationMs: opts.timeoutMs,
73
+ timeoutMs: opts.timeoutMs,
74
+ });
75
+ }, opts.timeoutMs);
76
+ });
77
+ // Race so a non-settling domain cannot hang the scheduler/recipe.
78
+ const outcome = await Promise.race([workPromise, hardTimeout]);
79
+ // If the hard timeout won, the domain promise may still settle (or reject) later.
80
+ // Attach a no-op handler so a late rejection does not become an unhandled promise rejection.
81
+ workPromise.catch(() => {
82
+ /* late settlement after timeout is expected and ignored; the abort signal was delivered */
83
+ });
84
+ return outcome;
85
+ }
86
+ //# sourceMappingURL=run-with-timeout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-with-timeout.js","sourceRoot":"","sources":["../../../src/lib/execution/run-with-timeout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,YAAY,EAA6B,MAAM,YAAY,CAAC;AAiBrE;;;;;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D,kFAAkF;IAClF,6FAA6F;IAC7F,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE;QACrB,2FAA2F;IAC7F,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * scheduleUnits — the bounded scheduler of the execution substrate (north-star
3
+ * §5.8, launch).
4
+ *
5
+ * Owns the scheduling SHAPE — a `parallel` sliding window bounded by `maxParallel`,
6
+ * or a `sequential` one-at-a-time loop — plus the stop policy and an external
7
+ * abort check. The per-unit lifecycle (timeout/retry/result) is the caller's
8
+ * `runUnit`, which returns whether scheduling should stop (the domain's
9
+ * `stopOnFirstFailure` decision). This is the one loop fit + sim run on, replacing
10
+ * their hand-rolled parallel pools and `for-of` loops (the `same-recipe-semantics`
11
+ * guarantee).
12
+ *
13
+ * Faithfully generalized from fitness's `executeParallel` (sliding window: launch
14
+ * up to `maxParallel`, refill on each completion unless stopping/aborted, resolve
15
+ * when drained) and `executeSequential` (`for-of`, abort-check at the top, break
16
+ * on stop).
17
+ */
18
+ /**
19
+ * Hand control back to the event loop's macrotask queue. `await runUnit()` only
20
+ * yields to the MICROtask queue, so a `setInterval` timer (the 80ms live-progress
21
+ * clock) and Ink's repaint never get a turn between back-to-back synchronous
22
+ * units. A `setImmediate` boundary lets them run — the interim live-view smoothing
23
+ * (the durable fix runs the engine off the main thread; ADR-0016/ADR-0028).
24
+ */
25
+ export declare const yieldToEventLoop: () => Promise<void>;
26
+ export interface ScheduleUnitsOptions<Unit> {
27
+ readonly units: readonly Unit[];
28
+ readonly mode: 'parallel' | 'sequential';
29
+ /** Concurrency bound in `parallel` mode (ignored for `sequential`). Default 1. */
30
+ readonly maxParallel?: number;
31
+ /**
32
+ * Run one unit (its full timeout/retry/result lifecycle) and report whether the
33
+ * scheduler should stop launching further units. Receives the 0-based index.
34
+ */
35
+ readonly runUnit: (unit: Unit, index: number) => Promise<{
36
+ readonly shouldStop: boolean;
37
+ }>;
38
+ /** External abort check (e.g. a service-level AbortController); polled before each launch. */
39
+ readonly shouldAbort?: () => boolean;
40
+ /**
41
+ * When true, insert a macrotask boundary ({@link yieldToEventLoop}) after each
42
+ * unit completes, so a live-progress timer + renderer on the same thread can
43
+ * paint between units. Opt-in (default off) — only the interactive (TTY) run
44
+ * paths set it; `--json`/non-TTY callers don't need it.
45
+ */
46
+ readonly yieldBetweenUnits?: boolean;
47
+ }
48
+ /**
49
+ * Schedule `units` through `runUnit` per the mode/concurrency/stop policy.
50
+ *
51
+ * Cognitive complexity is high (19) because the implementation unifies two
52
+ * scheduling shapes (sliding-window parallel with dynamic refill, and
53
+ * sequential for-of) plus shared abort latching, drain detection, and the
54
+ * optional yieldToEventLoop wrapper for live UI. This is the single
55
+ * scheduler used by fitness and simulation engines (the "same-recipe-semantics"
56
+ * contract). Extracting helpers would make the refill-vs-drain state machine
57
+ * harder to audit as a whole. Disable is scoped to this function.
58
+ *
59
+ * @throws {Error} When `mode` is neither 'sequential' nor 'parallel'.
60
+ */
61
+ export declare function scheduleUnits<Unit>(opts: ScheduleUnitsOptions<Unit>): Promise<void>;
62
+ //# sourceMappingURL=schedule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../src/lib/execution/schedule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,QAAO,OAAO,CAAC,IAAI,CAG5C,CAAC;AAEL,MAAM,WAAW,oBAAoB,CAAC,IAAI;IACxC,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAAC;IACzC,kFAAkF;IAClF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC3F,8FAA8F;IAC9F,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC;IACrC;;;;;OAKG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CACtC;AAGD;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,oBAAoB,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA2FzF"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * scheduleUnits — the bounded scheduler of the execution substrate (north-star
3
+ * §5.8, launch).
4
+ *
5
+ * Owns the scheduling SHAPE — a `parallel` sliding window bounded by `maxParallel`,
6
+ * or a `sequential` one-at-a-time loop — plus the stop policy and an external
7
+ * abort check. The per-unit lifecycle (timeout/retry/result) is the caller's
8
+ * `runUnit`, which returns whether scheduling should stop (the domain's
9
+ * `stopOnFirstFailure` decision). This is the one loop fit + sim run on, replacing
10
+ * their hand-rolled parallel pools and `for-of` loops (the `same-recipe-semantics`
11
+ * guarantee).
12
+ *
13
+ * Faithfully generalized from fitness's `executeParallel` (sliding window: launch
14
+ * up to `maxParallel`, refill on each completion unless stopping/aborted, resolve
15
+ * when drained) and `executeSequential` (`for-of`, abort-check at the top, break
16
+ * on stop).
17
+ */
18
+ /**
19
+ * Hand control back to the event loop's macrotask queue. `await runUnit()` only
20
+ * yields to the MICROtask queue, so a `setInterval` timer (the 80ms live-progress
21
+ * clock) and Ink's repaint never get a turn between back-to-back synchronous
22
+ * units. A `setImmediate` boundary lets them run — the interim live-view smoothing
23
+ * (the durable fix runs the engine off the main thread; ADR-0016/ADR-0028).
24
+ */
25
+ export const yieldToEventLoop = () => new Promise((resolve) => {
26
+ setImmediate(resolve);
27
+ });
28
+ /* eslint-disable sonarjs/cognitive-complexity -- unifies parallel sliding-window and sequential scheduling with shared abort/drain latching; one scheduler for fitness and simulation (rationale below) */
29
+ /**
30
+ * Schedule `units` through `runUnit` per the mode/concurrency/stop policy.
31
+ *
32
+ * Cognitive complexity is high (19) because the implementation unifies two
33
+ * scheduling shapes (sliding-window parallel with dynamic refill, and
34
+ * sequential for-of) plus shared abort latching, drain detection, and the
35
+ * optional yieldToEventLoop wrapper for live UI. This is the single
36
+ * scheduler used by fitness and simulation engines (the "same-recipe-semantics"
37
+ * contract). Extracting helpers would make the refill-vs-drain state machine
38
+ * harder to audit as a whole. Disable is scoped to this function.
39
+ *
40
+ * @throws {Error} When `mode` is neither 'sequential' nor 'parallel'.
41
+ */
42
+ export async function scheduleUnits(opts) {
43
+ const { units, mode, shouldAbort } = opts;
44
+ if (units.length === 0)
45
+ return;
46
+ if (mode !== 'sequential' && mode !== 'parallel') {
47
+ throw new Error(`scheduleUnits: mode must be 'parallel' or 'sequential' (got '${String(mode)}')`);
48
+ }
49
+ // Each unit's promise resolves AFTER a macrotask yield when requested, so a
50
+ // same-thread live-progress timer + renderer paint between units. Wrapping
51
+ // `runUnit` (rather than the scheduling logic) keeps the parallel sliding
52
+ // window's activeCount/relaunch bookkeeping synchronous and correct in both modes.
53
+ const runUnit = opts.yieldBetweenUnits === true
54
+ ? async (unit, index) => {
55
+ // @fitness-ignore-next-line async-waterfall-detection -- deliberately sequential: the macrotask yield MUST run AFTER the unit completes (it is the between-units boundary); parallelizing with Promise.all would defeat the purpose.
56
+ const outcome = await opts.runUnit(unit, index);
57
+ await yieldToEventLoop();
58
+ return outcome;
59
+ }
60
+ : opts.runUnit;
61
+ // Shared abort observation that also latches a local flag so that once an
62
+ // external abort is seen we treat it as a terminal drain condition (prevents
63
+ // the "no more refills + active drains but resolve condition never fires"
64
+ // hang when there are still unlaunched units).
65
+ let aborted = false;
66
+ const observeAbort = () => {
67
+ if (shouldAbort?.() === true) {
68
+ aborted = true;
69
+ return true;
70
+ }
71
+ return false;
72
+ };
73
+ if (mode === 'sequential') {
74
+ for (const [index, unit] of units.entries()) {
75
+ if (observeAbort())
76
+ break;
77
+ const { shouldStop } = await runUnit(unit, index);
78
+ if (shouldStop)
79
+ break;
80
+ }
81
+ return;
82
+ }
83
+ // Parallel sliding window — mirrors fitness's executeParallel.
84
+ // Defensive: even though recipe authors go through defineSimulationRecipe (and
85
+ // fitness through its own paths), a direct caller or future plugin could pass
86
+ // NaN/0/negative. Force a safe minimum.
87
+ const maxParallel = Math.max(1, Number.isFinite(opts.maxParallel) ? opts.maxParallel : 1);
88
+ let nextIndex = 0;
89
+ let activeCount = 0;
90
+ let stopping = false;
91
+ await new Promise((resolve) => {
92
+ const launch = (unit, index) => {
93
+ activeCount++;
94
+ void runUnit(unit, index)
95
+ .then(({ shouldStop }) => {
96
+ if (shouldStop)
97
+ stopping = true;
98
+ })
99
+ .finally(() => {
100
+ activeCount--;
101
+ // Only refill if we are not in any terminal state (stopping, list done, or aborted).
102
+ if (!stopping && !aborted && nextIndex < units.length && !observeAbort()) {
103
+ const next = units[nextIndex];
104
+ if (next !== undefined) {
105
+ const idx = nextIndex;
106
+ nextIndex++;
107
+ launch(next, idx);
108
+ }
109
+ }
110
+ // Drain condition now includes external abort as a terminal reason.
111
+ // Once all in-flight units complete, we resolve even if units remain.
112
+ if (activeCount === 0 && (nextIndex >= units.length || stopping || aborted)) {
113
+ resolve();
114
+ }
115
+ });
116
+ };
117
+ const initialBatch = Math.min(maxParallel, units.length);
118
+ for (let i = 0; i < initialBatch; i++) {
119
+ if (observeAbort())
120
+ break;
121
+ const unit = units[i];
122
+ if (unit !== undefined) {
123
+ nextIndex = i + 1;
124
+ launch(unit, i);
125
+ }
126
+ }
127
+ });
128
+ }
129
+ /* eslint-enable sonarjs/cognitive-complexity */
130
+ //# sourceMappingURL=schedule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../../src/lib/execution/schedule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;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AI,IAAI,KAAK,SAAS,EAAE,CAAC;wBACvB,MAAM,GAAG,GAAG,SAAS,CAAC;wBACtB,SAAS,EAAE,CAAC;wBACZ,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;oBACpB,CAAC;gBACH,CAAC;gBACD,oEAAoE;gBACpE,sEAAsE;gBACtE,IAAI,WAAW,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,MAAM,IAAI,QAAQ,IAAI,OAAO,CAAC,EAAE,CAAC;oBAC5E,OAAO,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QAEF,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACzD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,IAAI,YAAY,EAAE;gBAAE,MAAM;YAC1B,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACtB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACvB,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC;gBAClB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AACD,gDAAgD"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @fileoverview Shared presentation formatters.
3
+ *
4
+ * Small, dependency-free helpers used by more than one tool's CLI/report
5
+ * layer. Kept in core because tools sit in a peer layer and cannot depend on
6
+ * each other — core is their only shared home.
7
+ */
8
+ /**
9
+ * Format a millisecond duration as `"Xms"` under one second, `"X.Ys"` for
10
+ * sub-minute durations, or `"Xm Y.Ys"` at minute scale.
11
+ *
12
+ * @example formatDuration(450) // "450ms"
13
+ * @example formatDuration(1500) // "1.5s"
14
+ * @example formatDuration(1471600) // "24m 31.6s"
15
+ */
16
+ export declare function formatDuration(ms: number): string;
17
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/lib/format.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CASjD"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @fileoverview Shared presentation formatters.
3
+ *
4
+ * Small, dependency-free helpers used by more than one tool's CLI/report
5
+ * layer. Kept in core because tools sit in a peer layer and cannot depend on
6
+ * each other — core is their only shared home.
7
+ */
8
+ /**
9
+ * Format a millisecond duration as `"Xms"` under one second, `"X.Ys"` for
10
+ * sub-minute durations, or `"Xm Y.Ys"` at minute scale.
11
+ *
12
+ * @example formatDuration(450) // "450ms"
13
+ * @example formatDuration(1500) // "1.5s"
14
+ * @example formatDuration(1471600) // "24m 31.6s"
15
+ */
16
+ export function formatDuration(ms) {
17
+ if (ms < 1000)
18
+ return `${String(ms)}ms`;
19
+ const totalTenths = Math.round(ms / 100);
20
+ if (totalTenths < 600)
21
+ return `${(totalTenths / 10).toFixed(1)}s`;
22
+ const minutes = Math.floor(totalTenths / 600);
23
+ const remainingTenths = totalTenths % 600;
24
+ return `${minutes}m ${(remainingTenths / 10).toFixed(1)}s`;
25
+ }
26
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/lib/format.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,IAAI,EAAE,GAAG,IAAI;QAAE,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;IAExC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;IACzC,IAAI,WAAW,GAAG,GAAG;QAAE,OAAO,GAAG,CAAC,WAAW,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAElE,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,GAAG,CAAC,CAAC;IAC9C,MAAM,eAAe,GAAG,WAAW,GAAG,GAAG,CAAC;IAC1C,OAAO,GAAG,OAAO,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ID generation for opensip-cli.
3
+ * Uses ULID for time-sortable, unique identifiers.
4
+ */
5
+ /** Generate a ULID (time-sortable, 26 lowercase crockford base32 chars) */
6
+ export declare function generateId(prefix?: string): string;
7
+ /** Generate a prefixed ULID — e.g., generatePrefixedId('run') → 'RUN_01HXYZ...' */
8
+ export declare function generatePrefixedId(prefix: string): string;
9
+ /** Extract the timestamp from a ULID string. Returns null if invalid. */
10
+ export declare function extractTimestamp(id: string): Date | null;
11
+ /** Generate a standard UUID v4 (for cases where ULID is not appropriate) */
12
+ export declare function generateUUID(): string;
13
+ //# sourceMappingURL=ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../src/lib/ids.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,2EAA2E;AAC3E,wBAAgB,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAGlD;AAED,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAwBxD;AAED,4EAA4E;AAC5E,wBAAgB,YAAY,IAAI,MAAM,CAErC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * ID generation for opensip-cli.
3
+ * Uses ULID for time-sortable, unique identifiers.
4
+ */
5
+ import { randomUUID } from 'node:crypto';
6
+ import { ulid } from 'ulid';
7
+ /** Generate a ULID (time-sortable, 26 lowercase crockford base32 chars) */
8
+ export function generateId(prefix) {
9
+ const id = ulid();
10
+ return prefix ? `${prefix}_${id}` : id;
11
+ }
12
+ /** Generate a prefixed ULID — e.g., generatePrefixedId('run') → 'RUN_01HXYZ...' */
13
+ export function generatePrefixedId(prefix) {
14
+ return `${prefix.toUpperCase()}_${ulid()}`;
15
+ }
16
+ /** Extract the timestamp from a ULID string. Returns null if invalid. */
17
+ export function extractTimestamp(id) {
18
+ // ULIDs are exactly 26 Crockford Base32 chars; the prefix (if any) may
19
+ // contain underscores itself — e.g. `generatePrefixedId('my_tool')`
20
+ // produces `MY_TOOL_<ulid>`. Splitting on the first '_' would slice off
21
+ // only `MY` and leave `TOOL_<ulid>`, failing the length check. Take the
22
+ // trailing 26 chars instead, since ULIDs never contain underscores.
23
+ const ulidPart = id.length >= 26 ? id.slice(-26) : id;
24
+ if (ulidPart.length !== 26)
25
+ return null;
26
+ try {
27
+ // ULID encodes timestamp in first 10 chars as Crockford Base32
28
+ const ENCODING = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';
29
+ const upper = ulidPart.toUpperCase();
30
+ let time = 0;
31
+ for (let i = 0; i < 10; i++) {
32
+ const idx = ENCODING.indexOf(upper[i]);
33
+ if (idx === -1)
34
+ return null;
35
+ time = time * 32 + idx;
36
+ }
37
+ return new Date(time);
38
+ }
39
+ catch {
40
+ // @fitness-ignore-next-line error-handling-quality -- parse-or-null helper; exception → null is the function's contract, caller checks for null.
41
+ return null;
42
+ }
43
+ }
44
+ /** Generate a standard UUID v4 (for cases where ULID is not appropriate) */
45
+ export function generateUUID() {
46
+ return randomUUID();
47
+ }
48
+ //# sourceMappingURL=ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/lib/ids.ts"],"names":[],"mappings":"AAAA;;;GAGG;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QACzB,CAAC;QACD,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,iJAAiJ;QACjJ,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,YAAY;IAC1B,OAAO,UAAU,EAAE,CAAC;AACtB,CAAC"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Structured logger for opensip-cli.
3
+ *
4
+ * Outputs JSON log lines with:
5
+ * - ts: ISO timestamp
6
+ * - level: debug | info | warn | error
7
+ * - evt: event name (e.g., 'cli.start', 'cli.check.complete')
8
+ * - runId: correlation ID for the current CLI invocation
9
+ * - msg: human-readable message
10
+ * - ...data: additional structured fields
11
+ *
12
+ * Destinations:
13
+ * - File: <project>/opensip-cli/.runtime/logs/{YYYY-MM-DD}.jsonl
14
+ * The CLI bootstrap supplies this path via configureLogger({ logDir }).
15
+ * Without that, file output is disabled — user-global state
16
+ * (`~/.opensip-cli/`) is reserved for config.yml only.
17
+ * - stderr: when debug mode is enabled (Ink renders to stdout, logs to stderr)
18
+ *
19
+ * The `silent: true` option only suppresses stderr output, NOT file output.
20
+ *
21
+ * Two access patterns:
22
+ *
23
+ * 1. The exported `logger` singleton + `configureLogger(opts)`. Used
24
+ * by the CLI bootstrap and any production caller that wants the
25
+ * process-wide configuration. The four prior free mutators
26
+ * (`setSilent`, `setDebugMode`, `setRunId`, `initLogFile`) were
27
+ * collapsed into `configureLogger` in T1 deferred Item C.
28
+ *
29
+ * 2. The exported `LoggerImpl` class. Used by tests (or tools that
30
+ * need an isolated logger) to construct a fresh instance whose
31
+ * state is independent of the singleton.
32
+ */
33
+ /** Structured logger surface; accepts a message string or a structured record. */
34
+ export interface Logger {
35
+ debug(msgOrObj: string | Record<string, unknown>, data?: Record<string, unknown>): void;
36
+ info(msgOrObj: string | Record<string, unknown>, data?: Record<string, unknown>): void;
37
+ warn(msgOrObj: string | Record<string, unknown>, data?: Record<string, unknown>): void;
38
+ error(msgOrObj: string | Record<string, unknown>, data?: Record<string, unknown>): void;
39
+ }
40
+ /** Log severity levels, ordered from most to least verbose. */
41
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
42
+ /**
43
+ * Concrete logger implementation. Production code uses the exported
44
+ * `logger` singleton (typed as the `Logger` interface so the
45
+ * configuration surface is hidden from generic call sites); tests
46
+ * (or tools that need an isolated logger) can construct a fresh
47
+ * `LoggerImpl()` to exercise the logger without polluting (or being
48
+ * polluted by) the singleton's state.
49
+ *
50
+ * @remarks Treat this class as advanced / discouraged for general
51
+ * production use — the `Logger` interface is the seam. Importing
52
+ * `LoggerImpl` is appropriate for tests and for tools that genuinely
53
+ * need an isolated logger; everywhere else the typed `logger`
54
+ * singleton is the right import.
55
+ */
56
+ /**
57
+ * Construction-time options for `LoggerImpl`. Also the shape accepted
58
+ * by `configureLogger(opts)`, the single bootstrap-time configuration
59
+ * seam that replaced the four free mutators (`setSilent`,
60
+ * `setDebugMode`, `setRunId`, `initLogFile`) — T1 deferred Item C.
61
+ */
62
+ export interface LoggerOptions {
63
+ /** Initial log level. Defaults to `'warn'`. */
64
+ readonly level?: LogLevel;
65
+ /** Suppress stderr output (file output still occurs). Defaults to `false`. */
66
+ readonly silent?: boolean;
67
+ /** Enable debug-level output to stderr. Defaults to `false`. */
68
+ readonly debugMode?: boolean;
69
+ /** Correlation id for the current CLI invocation. */
70
+ readonly runId?: string;
71
+ /**
72
+ * Directory the daily `.jsonl` log file is written to. When provided,
73
+ * the logger initialises the file path and prunes logs older than
74
+ * 7 days. Best-effort; failures are swallowed.
75
+ */
76
+ readonly logDir?: string;
77
+ }
78
+ /**
79
+ * Optional indirection for the runId on each log entry. The CLI binds
80
+ * this to `() => currentScope()?.runId` at module init (in run-scope.ts,
81
+ * which already depends on logger.ts — this preserves the dependency
82
+ * direction and avoids a logger→run-scope import cycle that depcruise
83
+ * would reject). Returns `undefined` when no scope is bound, in which
84
+ * case `LoggerImpl.log` falls back to its instance-level `runId`.
85
+ *
86
+ * Tests that construct an isolated `new LoggerImpl()` skip this path
87
+ * entirely — they call `setRunId(...)` on the instance.
88
+ */
89
+ export type RunIdProvider = () => string | undefined;
90
+ /** Concrete logger writing JSONL to stderr and an optional daily file. */
91
+ export declare class LoggerImpl implements Logger {
92
+ private currentLevel;
93
+ private silent;
94
+ private debugMode;
95
+ private runId;
96
+ private logFilePath;
97
+ private runIdProvider;
98
+ constructor(opts?: LoggerOptions);
99
+ /**
100
+ * Apply a `LoggerOptions` bag to this instance. Used by the singleton
101
+ * via `configureLogger(opts)` — the bootstrap-time configuration seam
102
+ * that collapsed the four prior free mutators into one shot. Each
103
+ * field is independent: an `applyOptions({ silent: true })` leaves
104
+ * `debugMode` and `runId` alone.
105
+ */
106
+ applyOptions(opts: LoggerOptions): void;
107
+ debug(msgOrObj: string | Record<string, unknown>, data?: Record<string, unknown>): void;
108
+ info(msgOrObj: string | Record<string, unknown>, data?: Record<string, unknown>): void;
109
+ warn(msgOrObj: string | Record<string, unknown>, data?: Record<string, unknown>): void;
110
+ error(msgOrObj: string | Record<string, unknown>, data?: Record<string, unknown>): void;
111
+ /**
112
+ * Suppress stderr output. File output still occurs. Used by the CLI
113
+ * to silence the logger during Ink renders (Ink owns stdout; stderr
114
+ * is reserved for `--debug` traces). Tests use this on fresh
115
+ * `new LoggerImpl()` instances to verify the silent-mode contract.
116
+ */
117
+ setSilent(value: boolean): void;
118
+ /**
119
+ * Enable debug-level output to stderr. Sets the current level to
120
+ * `'debug'` when enabled. Disabling does NOT restore a prior level.
121
+ */
122
+ setDebugMode(value: boolean): void;
123
+ /** Set the correlation id stamped on each log entry. */
124
+ setRunId(id: string): void;
125
+ getRunId(): string | undefined;
126
+ /**
127
+ * Inject a runId source consulted on every `log()`. Lets the kernel
128
+ * route the singleton through the RunScope-bound runId without the
129
+ * logger module having to import run-scope.ts (which would create a
130
+ * cycle, since run-scope already imports the logger).
131
+ */
132
+ setRunIdProvider(provider: RunIdProvider | undefined): void;
133
+ /**
134
+ * Initialize the log file for this instance.
135
+ *
136
+ * Writes to `<dir>/<YYYY-MM-DD>.jsonl`; the CLI bootstrap supplies
137
+ * the path from `resolveProjectPaths(cwd).logsDir`. Without a call
138
+ * to this function, file output is disabled (logs still hit stderr
139
+ * in debug mode).
140
+ *
141
+ * Prunes log files older than 7 days inside the chosen directory.
142
+ *
143
+ * @internal — production callers route through `configureLogger`'s
144
+ * `logDir` option. The method is `private` from a domain-design
145
+ * standpoint but TypeScript can't mark it `private` because the
146
+ * constructor calls it via `applyOptions`.
147
+ */
148
+ initLogFile(dir: string): void;
149
+ private shouldLog;
150
+ private shouldWriteToFile;
151
+ private log;
152
+ }
153
+ export declare const logger: Logger;
154
+ /**
155
+ * One-shot configuration for the process-wide `logger` singleton.
156
+ * Replaces the four free mutators that previously each mutated one
157
+ * field. The CLI's pre-action-hook calls this once with all relevant
158
+ * options after flags are parsed and the project context is resolved.
159
+ *
160
+ * SaaS hosts that run multiple invocations concurrently should NOT use
161
+ * this — they construct per-invocation `new LoggerImpl({...})` and
162
+ * wire it into the `RunScope.logger` field so each run has its own
163
+ * file path and runId.
164
+ */
165
+ export declare function configureLogger(opts: LoggerOptions): void;
166
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAKH,kFAAkF;AAClF,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxF,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,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