@opensip-cli/simulation 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 (348) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +8 -0
  3. package/README.md +31 -0
  4. package/dist/__tests__/internal-surface.test.d.ts +9 -0
  5. package/dist/__tests__/internal-surface.test.d.ts.map +1 -0
  6. package/dist/__tests__/internal-surface.test.js +38 -0
  7. package/dist/__tests__/internal-surface.test.js.map +1 -0
  8. package/dist/__tests__/plugin-loader.test.d.ts +2 -0
  9. package/dist/__tests__/plugin-loader.test.d.ts.map +1 -0
  10. package/dist/__tests__/plugin-loader.test.js +64 -0
  11. package/dist/__tests__/plugin-loader.test.js.map +1 -0
  12. package/dist/__tests__/public-api.test.d.ts +15 -0
  13. package/dist/__tests__/public-api.test.d.ts.map +1 -0
  14. package/dist/__tests__/public-api.test.js +73 -0
  15. package/dist/__tests__/public-api.test.js.map +1 -0
  16. package/dist/__tests__/registry-cross-kind.test.d.ts +6 -0
  17. package/dist/__tests__/registry-cross-kind.test.d.ts.map +1 -0
  18. package/dist/__tests__/registry-cross-kind.test.js +86 -0
  19. package/dist/__tests__/registry-cross-kind.test.js.map +1 -0
  20. package/dist/__tests__/scenario-execution.test.d.ts +10 -0
  21. package/dist/__tests__/scenario-execution.test.d.ts.map +1 -0
  22. package/dist/__tests__/scenario-execution.test.js +92 -0
  23. package/dist/__tests__/scenario-execution.test.js.map +1 -0
  24. package/dist/__tests__/sim-capability-contract.test.d.ts +10 -0
  25. package/dist/__tests__/sim-capability-contract.test.d.ts.map +1 -0
  26. package/dist/__tests__/sim-capability-contract.test.js +131 -0
  27. package/dist/__tests__/sim-capability-contract.test.js.map +1 -0
  28. package/dist/__tests__/sim-config-schema.test.d.ts +5 -0
  29. package/dist/__tests__/sim-config-schema.test.d.ts.map +1 -0
  30. package/dist/__tests__/sim-config-schema.test.js +23 -0
  31. package/dist/__tests__/sim-config-schema.test.js.map +1 -0
  32. package/dist/__tests__/sim-failure-signal.test.d.ts +10 -0
  33. package/dist/__tests__/sim-failure-signal.test.d.ts.map +1 -0
  34. package/dist/__tests__/sim-failure-signal.test.js +86 -0
  35. package/dist/__tests__/sim-failure-signal.test.js.map +1 -0
  36. package/dist/__tests__/surviving-surface-edges.test.d.ts +10 -0
  37. package/dist/__tests__/surviving-surface-edges.test.d.ts.map +1 -0
  38. package/dist/__tests__/surviving-surface-edges.test.js +122 -0
  39. package/dist/__tests__/surviving-surface-edges.test.js.map +1 -0
  40. package/dist/__tests__/test-utils/targets.d.ts +26 -0
  41. package/dist/__tests__/test-utils/targets.d.ts.map +1 -0
  42. package/dist/__tests__/test-utils/targets.js +38 -0
  43. package/dist/__tests__/test-utils/targets.js.map +1 -0
  44. package/dist/__tests__/test-utils/with-sim-scope.d.ts +12 -0
  45. package/dist/__tests__/test-utils/with-sim-scope.d.ts.map +1 -0
  46. package/dist/__tests__/test-utils/with-sim-scope.js +22 -0
  47. package/dist/__tests__/test-utils/with-sim-scope.js.map +1 -0
  48. package/dist/__tests__/tool-live-view.test.d.ts +20 -0
  49. package/dist/__tests__/tool-live-view.test.d.ts.map +1 -0
  50. package/dist/__tests__/tool-live-view.test.js +146 -0
  51. package/dist/__tests__/tool-live-view.test.js.map +1 -0
  52. package/dist/__tests__/tool-show-mode.test.d.ts +10 -0
  53. package/dist/__tests__/tool-show-mode.test.d.ts.map +1 -0
  54. package/dist/__tests__/tool-show-mode.test.js +156 -0
  55. package/dist/__tests__/tool-show-mode.test.js.map +1 -0
  56. package/dist/__tests__/tool.test.d.ts +15 -0
  57. package/dist/__tests__/tool.test.d.ts.map +1 -0
  58. package/dist/__tests__/tool.test.js +250 -0
  59. package/dist/__tests__/tool.test.js.map +1 -0
  60. package/dist/cli/__tests__/sim-config.test.d.ts +2 -0
  61. package/dist/cli/__tests__/sim-config.test.d.ts.map +1 -0
  62. package/dist/cli/__tests__/sim-config.test.js +94 -0
  63. package/dist/cli/__tests__/sim-config.test.js.map +1 -0
  64. package/dist/cli/__tests__/sim-runner.test.d.ts +23 -0
  65. package/dist/cli/__tests__/sim-runner.test.d.ts.map +1 -0
  66. package/dist/cli/__tests__/sim-runner.test.js +188 -0
  67. package/dist/cli/__tests__/sim-runner.test.js.map +1 -0
  68. package/dist/cli/__tests__/sim-worker.test.d.ts +12 -0
  69. package/dist/cli/__tests__/sim-worker.test.d.ts.map +1 -0
  70. package/dist/cli/__tests__/sim-worker.test.js +69 -0
  71. package/dist/cli/__tests__/sim-worker.test.js.map +1 -0
  72. package/dist/cli/__tests__/sim.test.d.ts +2 -0
  73. package/dist/cli/__tests__/sim.test.d.ts.map +1 -0
  74. package/dist/cli/__tests__/sim.test.js +232 -0
  75. package/dist/cli/__tests__/sim.test.js.map +1 -0
  76. package/dist/cli/sim-config-schema.d.ts +30 -0
  77. package/dist/cli/sim-config-schema.d.ts.map +1 -0
  78. package/dist/cli/sim-config-schema.js +33 -0
  79. package/dist/cli/sim-config-schema.js.map +1 -0
  80. package/dist/cli/sim-config.d.ts +22 -0
  81. package/dist/cli/sim-config.d.ts.map +1 -0
  82. package/dist/cli/sim-config.js +73 -0
  83. package/dist/cli/sim-config.js.map +1 -0
  84. package/dist/cli/sim-runner.d.ts +60 -0
  85. package/dist/cli/sim-runner.d.ts.map +1 -0
  86. package/dist/cli/sim-runner.js +175 -0
  87. package/dist/cli/sim-runner.js.map +1 -0
  88. package/dist/cli/sim-worker.d.ts +24 -0
  89. package/dist/cli/sim-worker.d.ts.map +1 -0
  90. package/dist/cli/sim-worker.js +65 -0
  91. package/dist/cli/sim-worker.js.map +1 -0
  92. package/dist/cli/sim.d.ts +56 -0
  93. package/dist/cli/sim.d.ts.map +1 -0
  94. package/dist/cli/sim.js +265 -0
  95. package/dist/cli/sim.js.map +1 -0
  96. package/dist/framework/__tests__/assertions.test.d.ts +2 -0
  97. package/dist/framework/__tests__/assertions.test.d.ts.map +1 -0
  98. package/dist/framework/__tests__/assertions.test.js +122 -0
  99. package/dist/framework/__tests__/assertions.test.js.map +1 -0
  100. package/dist/framework/__tests__/misc-coverage.test.d.ts +18 -0
  101. package/dist/framework/__tests__/misc-coverage.test.d.ts.map +1 -0
  102. package/dist/framework/__tests__/misc-coverage.test.js +142 -0
  103. package/dist/framework/__tests__/misc-coverage.test.js.map +1 -0
  104. package/dist/framework/__tests__/resolve-metric.test.d.ts +12 -0
  105. package/dist/framework/__tests__/resolve-metric.test.d.ts.map +1 -0
  106. package/dist/framework/__tests__/resolve-metric.test.js +124 -0
  107. package/dist/framework/__tests__/resolve-metric.test.js.map +1 -0
  108. package/dist/framework/__tests__/result-builder.test.d.ts +2 -0
  109. package/dist/framework/__tests__/result-builder.test.d.ts.map +1 -0
  110. package/dist/framework/__tests__/result-builder.test.js +180 -0
  111. package/dist/framework/__tests__/result-builder.test.js.map +1 -0
  112. package/dist/framework/__tests__/scenario-logger.test.d.ts +9 -0
  113. package/dist/framework/__tests__/scenario-logger.test.d.ts.map +1 -0
  114. package/dist/framework/__tests__/scenario-logger.test.js +110 -0
  115. package/dist/framework/__tests__/scenario-logger.test.js.map +1 -0
  116. package/dist/framework/__tests__/validation.test.d.ts +9 -0
  117. package/dist/framework/__tests__/validation.test.d.ts.map +1 -0
  118. package/dist/framework/__tests__/validation.test.js +126 -0
  119. package/dist/framework/__tests__/validation.test.js.map +1 -0
  120. package/dist/framework/assertions.d.ts +106 -0
  121. package/dist/framework/assertions.d.ts.map +1 -0
  122. package/dist/framework/assertions.js +256 -0
  123. package/dist/framework/assertions.js.map +1 -0
  124. package/dist/framework/execution/__tests__/execution-engine.test.d.ts +9 -0
  125. package/dist/framework/execution/__tests__/execution-engine.test.d.ts.map +1 -0
  126. package/dist/framework/execution/__tests__/execution-engine.test.js +138 -0
  127. package/dist/framework/execution/__tests__/execution-engine.test.js.map +1 -0
  128. package/dist/framework/execution/__tests__/fault-builders.test.d.ts +5 -0
  129. package/dist/framework/execution/__tests__/fault-builders.test.d.ts.map +1 -0
  130. package/dist/framework/execution/__tests__/fault-builders.test.js +23 -0
  131. package/dist/framework/execution/__tests__/fault-builders.test.js.map +1 -0
  132. package/dist/framework/execution/__tests__/fault-model.test.d.ts +6 -0
  133. package/dist/framework/execution/__tests__/fault-model.test.d.ts.map +1 -0
  134. package/dist/framework/execution/__tests__/fault-model.test.js +64 -0
  135. package/dist/framework/execution/__tests__/fault-model.test.js.map +1 -0
  136. package/dist/framework/execution/__tests__/http-target.test.d.ts +5 -0
  137. package/dist/framework/execution/__tests__/http-target.test.d.ts.map +1 -0
  138. package/dist/framework/execution/__tests__/http-target.test.js +36 -0
  139. package/dist/framework/execution/__tests__/http-target.test.js.map +1 -0
  140. package/dist/framework/execution/__tests__/run-load-window.test.d.ts +7 -0
  141. package/dist/framework/execution/__tests__/run-load-window.test.d.ts.map +1 -0
  142. package/dist/framework/execution/__tests__/run-load-window.test.js +89 -0
  143. package/dist/framework/execution/__tests__/run-load-window.test.js.map +1 -0
  144. package/dist/framework/execution/execution-engine.d.ts +55 -0
  145. package/dist/framework/execution/execution-engine.d.ts.map +1 -0
  146. package/dist/framework/execution/execution-engine.js +111 -0
  147. package/dist/framework/execution/execution-engine.js.map +1 -0
  148. package/dist/framework/execution/fault-builders.d.ts +26 -0
  149. package/dist/framework/execution/fault-builders.d.ts.map +1 -0
  150. package/dist/framework/execution/fault-builders.js +24 -0
  151. package/dist/framework/execution/fault-builders.js.map +1 -0
  152. package/dist/framework/execution/fault-model.d.ts +49 -0
  153. package/dist/framework/execution/fault-model.d.ts.map +1 -0
  154. package/dist/framework/execution/fault-model.js +108 -0
  155. package/dist/framework/execution/fault-model.js.map +1 -0
  156. package/dist/framework/execution/fault-spec.d.ts +40 -0
  157. package/dist/framework/execution/fault-spec.d.ts.map +1 -0
  158. package/dist/framework/execution/fault-spec.js +23 -0
  159. package/dist/framework/execution/fault-spec.js.map +1 -0
  160. package/dist/framework/execution/http-target.d.ts +34 -0
  161. package/dist/framework/execution/http-target.d.ts.map +1 -0
  162. package/dist/framework/execution/http-target.js +41 -0
  163. package/dist/framework/execution/http-target.js.map +1 -0
  164. package/dist/framework/execution/latency-tracker.d.ts +44 -0
  165. package/dist/framework/execution/latency-tracker.d.ts.map +1 -0
  166. package/dist/framework/execution/latency-tracker.js +76 -0
  167. package/dist/framework/execution/latency-tracker.js.map +1 -0
  168. package/dist/framework/execution/run-load-window.d.ts +45 -0
  169. package/dist/framework/execution/run-load-window.d.ts.map +1 -0
  170. package/dist/framework/execution/run-load-window.js +136 -0
  171. package/dist/framework/execution/run-load-window.js.map +1 -0
  172. package/dist/framework/execution/scenario-aborted-error.d.ts +14 -0
  173. package/dist/framework/execution/scenario-aborted-error.d.ts.map +1 -0
  174. package/dist/framework/execution/scenario-aborted-error.js +24 -0
  175. package/dist/framework/execution/scenario-aborted-error.js.map +1 -0
  176. package/dist/framework/execution/target.d.ts +35 -0
  177. package/dist/framework/execution/target.d.ts.map +1 -0
  178. package/dist/framework/execution/target.js +21 -0
  179. package/dist/framework/execution/target.js.map +1 -0
  180. package/dist/framework/registry.d.ts +67 -0
  181. package/dist/framework/registry.d.ts.map +1 -0
  182. package/dist/framework/registry.js +113 -0
  183. package/dist/framework/registry.js.map +1 -0
  184. package/dist/framework/resolve-metric.d.ts +79 -0
  185. package/dist/framework/resolve-metric.d.ts.map +1 -0
  186. package/dist/framework/resolve-metric.js +135 -0
  187. package/dist/framework/resolve-metric.js.map +1 -0
  188. package/dist/framework/result-builder.d.ts +72 -0
  189. package/dist/framework/result-builder.d.ts.map +1 -0
  190. package/dist/framework/result-builder.js +214 -0
  191. package/dist/framework/result-builder.js.map +1 -0
  192. package/dist/framework/result-renderers.d.ts +37 -0
  193. package/dist/framework/result-renderers.d.ts.map +1 -0
  194. package/dist/framework/result-renderers.js +62 -0
  195. package/dist/framework/result-renderers.js.map +1 -0
  196. package/dist/framework/runnable-scenario.d.ts +37 -0
  197. package/dist/framework/runnable-scenario.d.ts.map +1 -0
  198. package/dist/framework/runnable-scenario.js +9 -0
  199. package/dist/framework/runnable-scenario.js.map +1 -0
  200. package/dist/framework/scenario-executor-result.d.ts +44 -0
  201. package/dist/framework/scenario-executor-result.d.ts.map +1 -0
  202. package/dist/framework/scenario-executor-result.js +13 -0
  203. package/dist/framework/scenario-executor-result.js.map +1 -0
  204. package/dist/framework/scenario-logger.d.ts +18 -0
  205. package/dist/framework/scenario-logger.d.ts.map +1 -0
  206. package/dist/framework/scenario-logger.js +39 -0
  207. package/dist/framework/scenario-logger.js.map +1 -0
  208. package/dist/framework/scenario-metric-key.d.ts +24 -0
  209. package/dist/framework/scenario-metric-key.d.ts.map +1 -0
  210. package/dist/framework/scenario-metric-key.js +17 -0
  211. package/dist/framework/scenario-metric-key.js.map +1 -0
  212. package/dist/framework/validation.d.ts +83 -0
  213. package/dist/framework/validation.d.ts.map +1 -0
  214. package/dist/framework/validation.js +93 -0
  215. package/dist/framework/validation.js.map +1 -0
  216. package/dist/index.d.ts +35 -0
  217. package/dist/index.d.ts.map +1 -0
  218. package/dist/index.js +53 -0
  219. package/dist/index.js.map +1 -0
  220. package/dist/internal.d.ts +19 -0
  221. package/dist/internal.d.ts.map +1 -0
  222. package/dist/internal.js +16 -0
  223. package/dist/internal.js.map +1 -0
  224. package/dist/kinds/chaos/__tests__/executor.test.d.ts +6 -0
  225. package/dist/kinds/chaos/__tests__/executor.test.d.ts.map +1 -0
  226. package/dist/kinds/chaos/__tests__/executor.test.js +117 -0
  227. package/dist/kinds/chaos/__tests__/executor.test.js.map +1 -0
  228. package/dist/kinds/chaos/config.d.ts +48 -0
  229. package/dist/kinds/chaos/config.d.ts.map +1 -0
  230. package/dist/kinds/chaos/config.js +15 -0
  231. package/dist/kinds/chaos/config.js.map +1 -0
  232. package/dist/kinds/chaos/define.d.ts +32 -0
  233. package/dist/kinds/chaos/define.d.ts.map +1 -0
  234. package/dist/kinds/chaos/define.js +111 -0
  235. package/dist/kinds/chaos/define.js.map +1 -0
  236. package/dist/kinds/chaos/executor.d.ts +21 -0
  237. package/dist/kinds/chaos/executor.d.ts.map +1 -0
  238. package/dist/kinds/chaos/executor.js +107 -0
  239. package/dist/kinds/chaos/executor.js.map +1 -0
  240. package/dist/kinds/chaos/result.d.ts +43 -0
  241. package/dist/kinds/chaos/result.d.ts.map +1 -0
  242. package/dist/kinds/chaos/result.js +12 -0
  243. package/dist/kinds/chaos/result.js.map +1 -0
  244. package/dist/kinds/load/__tests__/executor.test.d.ts +6 -0
  245. package/dist/kinds/load/__tests__/executor.test.d.ts.map +1 -0
  246. package/dist/kinds/load/__tests__/executor.test.js +75 -0
  247. package/dist/kinds/load/__tests__/executor.test.js.map +1 -0
  248. package/dist/kinds/load/config.d.ts +30 -0
  249. package/dist/kinds/load/config.d.ts.map +1 -0
  250. package/dist/kinds/load/config.js +9 -0
  251. package/dist/kinds/load/config.js.map +1 -0
  252. package/dist/kinds/load/define.d.ts +47 -0
  253. package/dist/kinds/load/define.d.ts.map +1 -0
  254. package/dist/kinds/load/define.js +76 -0
  255. package/dist/kinds/load/define.js.map +1 -0
  256. package/dist/kinds/load/executor.d.ts +16 -0
  257. package/dist/kinds/load/executor.d.ts.map +1 -0
  258. package/dist/kinds/load/executor.js +90 -0
  259. package/dist/kinds/load/executor.js.map +1 -0
  260. package/dist/kinds/load/result.d.ts +21 -0
  261. package/dist/kinds/load/result.d.ts.map +1 -0
  262. package/dist/kinds/load/result.js +10 -0
  263. package/dist/kinds/load/result.js.map +1 -0
  264. package/dist/persistence/session-payload.d.ts +32 -0
  265. package/dist/persistence/session-payload.d.ts.map +1 -0
  266. package/dist/persistence/session-payload.js +46 -0
  267. package/dist/persistence/session-payload.js.map +1 -0
  268. package/dist/persistence/session-replay.d.ts +13 -0
  269. package/dist/persistence/session-replay.d.ts.map +1 -0
  270. package/dist/persistence/session-replay.js +76 -0
  271. package/dist/persistence/session-replay.js.map +1 -0
  272. package/dist/persistence/session-replay.test.d.ts +10 -0
  273. package/dist/persistence/session-replay.test.d.ts.map +1 -0
  274. package/dist/persistence/session-replay.test.js +169 -0
  275. package/dist/persistence/session-replay.test.js.map +1 -0
  276. package/dist/plugins/__tests__/loader-scenarios.test.d.ts +12 -0
  277. package/dist/plugins/__tests__/loader-scenarios.test.d.ts.map +1 -0
  278. package/dist/plugins/__tests__/loader-scenarios.test.js +61 -0
  279. package/dist/plugins/__tests__/loader-scenarios.test.js.map +1 -0
  280. package/dist/plugins/__tests__/scenario-package-discovery.test.d.ts +2 -0
  281. package/dist/plugins/__tests__/scenario-package-discovery.test.d.ts.map +1 -0
  282. package/dist/plugins/__tests__/scenario-package-discovery.test.js +43 -0
  283. package/dist/plugins/__tests__/scenario-package-discovery.test.js.map +1 -0
  284. package/dist/plugins/loader.d.ts +32 -0
  285. package/dist/plugins/loader.d.ts.map +1 -0
  286. package/dist/plugins/loader.js +119 -0
  287. package/dist/plugins/loader.js.map +1 -0
  288. package/dist/plugins/scenario-package-discovery.d.ts +23 -0
  289. package/dist/plugins/scenario-package-discovery.d.ts.map +1 -0
  290. package/dist/plugins/scenario-package-discovery.js +42 -0
  291. package/dist/plugins/scenario-package-discovery.js.map +1 -0
  292. package/dist/plugins/types.d.ts +24 -0
  293. package/dist/plugins/types.d.ts.map +1 -0
  294. package/dist/plugins/types.js +18 -0
  295. package/dist/plugins/types.js.map +1 -0
  296. package/dist/recipes/__tests__/recipes.test.d.ts +2 -0
  297. package/dist/recipes/__tests__/recipes.test.d.ts.map +1 -0
  298. package/dist/recipes/__tests__/recipes.test.js +515 -0
  299. package/dist/recipes/__tests__/recipes.test.js.map +1 -0
  300. package/dist/recipes/built-in-recipes.d.ts +16 -0
  301. package/dist/recipes/built-in-recipes.d.ts.map +1 -0
  302. package/dist/recipes/built-in-recipes.js +37 -0
  303. package/dist/recipes/built-in-recipes.js.map +1 -0
  304. package/dist/recipes/define-recipe.d.ts +29 -0
  305. package/dist/recipes/define-recipe.d.ts.map +1 -0
  306. package/dist/recipes/define-recipe.js +68 -0
  307. package/dist/recipes/define-recipe.js.map +1 -0
  308. package/dist/recipes/registry.d.ts +54 -0
  309. package/dist/recipes/registry.d.ts.map +1 -0
  310. package/dist/recipes/registry.js +89 -0
  311. package/dist/recipes/registry.js.map +1 -0
  312. package/dist/recipes/service.d.ts +61 -0
  313. package/dist/recipes/service.d.ts.map +1 -0
  314. package/dist/recipes/service.js +205 -0
  315. package/dist/recipes/service.js.map +1 -0
  316. package/dist/recipes/types.d.ts +62 -0
  317. package/dist/recipes/types.d.ts.map +1 -0
  318. package/dist/recipes/types.js +10 -0
  319. package/dist/recipes/types.js.map +1 -0
  320. package/dist/scaffold/examples.d.ts +22 -0
  321. package/dist/scaffold/examples.d.ts.map +1 -0
  322. package/dist/scaffold/examples.js +91 -0
  323. package/dist/scaffold/examples.js.map +1 -0
  324. package/dist/scope-augmentation.d.ts +70 -0
  325. package/dist/scope-augmentation.d.ts.map +1 -0
  326. package/dist/scope-augmentation.js +28 -0
  327. package/dist/scope-augmentation.js.map +1 -0
  328. package/dist/tool.d.ts +21 -0
  329. package/dist/tool.d.ts.map +1 -0
  330. package/dist/tool.js +347 -0
  331. package/dist/tool.js.map +1 -0
  332. package/dist/types/base-types.d.ts +35 -0
  333. package/dist/types/base-types.d.ts.map +1 -0
  334. package/dist/types/base-types.js +8 -0
  335. package/dist/types/base-types.js.map +1 -0
  336. package/dist/types/framework-types.d.ts +62 -0
  337. package/dist/types/framework-types.d.ts.map +1 -0
  338. package/dist/types/framework-types.js +15 -0
  339. package/dist/types/framework-types.js.map +1 -0
  340. package/dist/types/kind-types.d.ts +24 -0
  341. package/dist/types/kind-types.d.ts.map +1 -0
  342. package/dist/types/kind-types.js +22 -0
  343. package/dist/types/kind-types.js.map +1 -0
  344. package/dist/types/workload.d.ts +30 -0
  345. package/dist/types/workload.d.ts.map +1 -0
  346. package/dist/types/workload.js +20 -0
  347. package/dist/types/workload.js.map +1 -0
  348. package/package.json +120 -0
package/dist/tool.js ADDED
@@ -0,0 +1,347 @@
1
+ /**
2
+ * simulationTool — simulation as a Tool plugin.
3
+ *
4
+ * Owns the `sim` subcommand. The Commander wiring is no longer hand-rolled:
5
+ * the tool exports a
6
+ * declarative {@link CommandSpec} (`simCommand`) and the host's
7
+ * `mountCommandSpec` mounts it (name/description/aliases, the ADR-0021 common
8
+ * flags, the `--recipe` option) and owns the parse→handler→error→exit pipeline.
9
+ * This file owns only the sim runner — the `runSim` handler below — which keeps
10
+ * the JSON/Ink dispatch, cloud egress, and report auto-open exactly as the
11
+ * old `register()` action body did (byte-identical behaviour).
12
+ */
13
+ import { EXIT_CODES } from '@opensip-cli/contracts';
14
+ import { defineCommand, readPackageVersion } from '@opensip-cli/core';
15
+ import { resolveSession } from '@opensip-cli/session-store';
16
+ import { simulationConfigDeclaration } from './cli/sim-config-schema.js';
17
+ import { renderSimLive } from './cli/sim-runner.js';
18
+ import { simRunWorkerCommandSpec } from './cli/sim-worker.js';
19
+ import { executeSim } from './cli/sim.js';
20
+ import { createScenarioRegistry, createSimulationLoadState, currentScenarioRegistry, } from './framework/registry.js';
21
+ import { simReplayFromSession } from './persistence/session-replay.js';
22
+ import { SIM_PLUGIN_LAYOUT } from './plugins/loader.js';
23
+ import { createSimulationRecipeRegistry, currentSimulationRecipeRegistry, } from './recipes/registry.js';
24
+ import { simScaffoldExamples, simStableExampleIds } from './scaffold/examples.js';
25
+ // Side-effect import: ensures the RunScope.simulation augmentation is
26
+ // loaded so `scope.simulation` is the correctly-typed slot here.
27
+ import './scope-augmentation.js';
28
+ const SIM = {
29
+ name: 'sim',
30
+ description: 'Run simulation scenarios',
31
+ };
32
+ const SIM_RUN_WORKER = {
33
+ name: 'sim-run-worker',
34
+ description: '[internal] Run sim headless and stream progress + result over IPC (forked by the live view)',
35
+ };
36
+ // Live-view key — matches the `sim` subcommand name so the dispatcher's
37
+ // renderLive(key) lookup resolves it (ADR-0016). sim's Ink/React renderer
38
+ // (renderSimLive) is registered directly; the prior static-only path remains
39
+ // for json / non-TTY runs.
40
+ const SIM_LIVE_VIEW_KEY = 'sim';
41
+ /**
42
+ * Set sim's live view (ADR-0016) up on the host context — a synchronous,
43
+ * void-returning map write (named with the `set` prefix to signal that). Its
44
+ * effectful egress (cloud + `--report-to`) lives at the composition root:
45
+ * renderSimLive returns the run's envelope and this callback delivers it once
46
+ * the Ink app exits — the same contract fit uses.
47
+ *
48
+ * In the spec-mounted world there is no `register()` mount hook, so the handler
49
+ * sets the renderer up lazily at the top of its body (before any
50
+ * `cli.renderLive` lookup). `registerLiveView` is an idempotent map write, so
51
+ * doing this once per run — only on the interactive path that needs it — is
52
+ * equivalent to the old mount-time registration.
53
+ */
54
+ function setUpSimLiveView(cli) {
55
+ cli.registerLiveView(SIM_LIVE_VIEW_KEY, async (args, liveContext) => {
56
+ const simArgs = args;
57
+ // The renderer returns a ToolRunCompletion; the HOST persists its `session`
58
+ // after this resolves (host-owned-run-timing Phase 2).
59
+ const completion = await renderSimLive(simArgs, { setExitCode: cli.setExitCode }, liveContext);
60
+ if (completion.envelope !== undefined) {
61
+ // ADR-0035: the host derives the findings exit from envelope.verdict.passed.
62
+ await cli.deliverSignals(completion.envelope, {
63
+ cwd: simArgs.cwd,
64
+ reportTo: simArgs.reportTo,
65
+ apiKey: simArgs.apiKey,
66
+ });
67
+ }
68
+ return completion;
69
+ });
70
+ }
71
+ /**
72
+ * The `sim` command handler — the former `register()` action body, lifted to a
73
+ * spec handler. `output: 'raw-stream'` (handler owns its own IO): the host runs
74
+ * this and renders nothing further, so the handler keeps full ownership of the
75
+ * TTY-vs-static branch, the JSON/Ink dispatch, the cloud egress, the exit-code
76
+ * decision, and the report auto-open.
77
+ */
78
+ async function runSim(rawOpts, cli) {
79
+ const opts = rawOpts;
80
+ if (opts.show !== undefined && opts.show.length > 0) {
81
+ await runSimShowMode(opts, cli);
82
+ return;
83
+ }
84
+ // Interactive TTY (non-json): the animated live view. Egress + exit code +
85
+ // host session persistence are handled via the registerLiveView callback /
86
+ // renderSimLive (host completeLiveRender) after the Ink app exits.
87
+ if (opts.json !== true && process.stdout.isTTY === true) {
88
+ setUpSimLiveView(cli);
89
+ await cli.renderLive(SIM_LIVE_VIEW_KEY, opts);
90
+ await cli.maybeOpenReport({
91
+ openRequested: Boolean(opts.open),
92
+ jsonOutput: false,
93
+ });
94
+ return;
95
+ }
96
+ // json / non-TTY (pipe / CI): run the engine and render statically — the
97
+ // animated Ink view is a TTY-only affordance. Output is byte-for-byte the
98
+ // pre-live-view behavior.
99
+ const { result } = await executeSim(opts);
100
+ if (result.type === 'error') {
101
+ if (opts.json) {
102
+ // Structured error outcome: the host wraps and sets the exit code.
103
+ cli.emitError({ message: result.message, exitCode: result.exitCode });
104
+ }
105
+ else {
106
+ cli.setExitCode(result.exitCode);
107
+ await cli.render(result);
108
+ }
109
+ return;
110
+ }
111
+ // ADR-0011: one render path per mode. `--json` emits the envelope
112
+ // through the shared formatSignalJson; default renders the envelope-
113
+ // derived per-scenario table.
114
+ if (opts.json) {
115
+ cli.emitEnvelope(result.envelope);
116
+ }
117
+ else {
118
+ await cli.render(result);
119
+ }
120
+ // Effectful egress + host-owned findings exit live at the root (cloud sink +
121
+ // `--report-to` exit 4 + the verdict-derived exit, ADR-0035). Once per run.
122
+ await cli.deliverSignals(result.envelope, {
123
+ cwd: result.cwd,
124
+ reportTo: opts.reportTo,
125
+ apiKey: opts.apiKey,
126
+ });
127
+ await cli.maybeOpenReport({
128
+ openRequested: Boolean(opts.open),
129
+ jsonOutput: Boolean(opts.json),
130
+ });
131
+ // host-owned-run-timing Phase 3: RETURN the generic-session contribution; the
132
+ // host run plane persists it after this handler resolves (no tool-side write).
133
+ const { buildSimulationSessionPayload } = await import('./persistence/session-payload.js');
134
+ return {
135
+ session: {
136
+ tool: 'sim',
137
+ cwd: result.cwd,
138
+ recipe: result.recipeName,
139
+ score: result.envelope.verdict.score,
140
+ passed: result.envelope.verdict.passed,
141
+ payload: buildSimulationSessionPayload(result.envelope),
142
+ },
143
+ };
144
+ }
145
+ async function runSimShowMode(opts, cli) {
146
+ const datastore = cli.scope.datastore();
147
+ if (datastore === undefined) {
148
+ await emitSimShowError(opts, cli, 'datastore-unavailable', 'session replay requires a datastore');
149
+ return;
150
+ }
151
+ const resolved = resolveSession(datastore, {
152
+ ref: opts.show ?? 'latest',
153
+ tool: 'sim',
154
+ });
155
+ if (!resolved.ok) {
156
+ await emitSimShowError(opts, cli, resolved.reason, resolved.detail);
157
+ return;
158
+ }
159
+ try {
160
+ const replay = simReplayFromSession(resolved.session);
161
+ if (opts.json === true) {
162
+ cli.emitJson(sessionShowJson(resolved.session, replay));
163
+ return;
164
+ }
165
+ await cli.render(sessionReplayResult(resolved.session, replay));
166
+ }
167
+ catch (error) {
168
+ await emitSimShowError(opts, cli, 'decode-error', error instanceof Error ? error.message : String(error));
169
+ }
170
+ }
171
+ async function emitSimShowError(opts, cli, reason, detail) {
172
+ if (opts.json === true) {
173
+ // emitError sets the exit code itself (process exit == reported outcome).
174
+ cli.emitError({
175
+ message: detail,
176
+ exitCode: EXIT_CODES.CONFIGURATION_ERROR,
177
+ code: reason,
178
+ });
179
+ return;
180
+ }
181
+ cli.setExitCode(EXIT_CODES.CONFIGURATION_ERROR);
182
+ await cli.render({
183
+ type: 'error',
184
+ message: detail,
185
+ exitCode: EXIT_CODES.CONFIGURATION_ERROR,
186
+ });
187
+ }
188
+ function sessionShowJson(session, replay) {
189
+ return {
190
+ session: {
191
+ id: session.id,
192
+ tool: session.tool,
193
+ startedAt: session.startedAt,
194
+ completedAt: session.completedAt,
195
+ recipe: session.recipe,
196
+ cwd: session.cwd,
197
+ score: session.score,
198
+ passed: session.passed,
199
+ durationMs: session.durationMs,
200
+ },
201
+ fidelity: replay.fidelity,
202
+ envelope: replay.envelope,
203
+ };
204
+ }
205
+ /** The tool-agnostic `session-replay` view result (rendered via the shared
206
+ * envelope table; no live-run footer). `cli.render` takes `unknown`. */
207
+ function sessionReplayResult(session, replay) {
208
+ return {
209
+ type: 'session-replay',
210
+ session: {
211
+ id: session.id,
212
+ tool: session.tool,
213
+ startedAt: session.startedAt,
214
+ completedAt: session.completedAt,
215
+ ...(session.recipe === undefined ? {} : { recipe: session.recipe }),
216
+ score: session.score,
217
+ passed: session.passed,
218
+ durationMs: session.durationMs,
219
+ },
220
+ envelope: replay.envelope,
221
+ fidelity: replay.fidelity,
222
+ };
223
+ }
224
+ /**
225
+ * The declarative `sim` command. Replaces the hand-rolled `register()` body:
226
+ * the host mounts this
227
+ * spec, applies the ADR-0021 common flags + the `--recipe` option, and invokes
228
+ * `runSim`.
229
+ *
230
+ * `output: 'raw-stream'` because sim's handler owns its entire output surface —
231
+ * it dispatches between the interactive Ink live view and the static
232
+ * render/JSON path at runtime (TTY-dependent) and performs cloud egress, the
233
+ * report auto-open, and the exit-code decision itself. None of those are
234
+ * expressible through the `signal-envelope` dispatch arm (which only does
235
+ * `emitEnvelope`/`render`), so the host renders nothing and the handler stays
236
+ * authoritative — byte-identical to the former action body.
237
+ */
238
+ const simCommand = defineCommand({
239
+ name: SIM.name,
240
+ description: SIM.description,
241
+ // ADR-0021 cross-tool flags from the single registry: --cwd, --json, --quiet,
242
+ // --verbose, --debug, --report-to, --api-key, --open. sim carries -v/--verbose
243
+ // (per-scenario detail). `cwd` is seeded with process.cwd() by the mounter.
244
+ commonFlags: ['cwd', 'json', 'quiet', 'verbose', 'debug', 'reportTo', 'apiKey', 'open'],
245
+ options: [
246
+ {
247
+ flag: '--recipe',
248
+ value: '<name>',
249
+ description: 'Run a named sim recipe (default: built-in `default`)',
250
+ },
251
+ {
252
+ flag: '--show',
253
+ value: '<session>',
254
+ description: 'Replay a stored sim session by id, or latest for the latest sim session',
255
+ },
256
+ ],
257
+ scope: 'project',
258
+ output: 'raw-stream',
259
+ rawStreamReason: 'runtime-render-dispatch',
260
+ handler: runSim,
261
+ });
262
+ /**
263
+ * The simulation tool's REAL registrar for its `sim-pack` capability domain
264
+ * (§5.3 / Phase 4). The host registers the domain from sim's manifest with a
265
+ * deferred placeholder, then swaps in this registrar once sim's module loads.
266
+ * A routed contribution (host-checked against `requiredKeys: ['id']`) is
267
+ * registered into THIS run's scope-owned scenario registry.
268
+ */
269
+ const registerSimScenario = (contribution) => {
270
+ currentScenarioRegistry().register(contribution);
271
+ };
272
+ /**
273
+ * The simulation tool's registrar for its `sim-recipe` capability domain (§5.3
274
+ * separate-domains fold). A scenario pack's co-located `recipes` export is routed
275
+ * here by the SAME discovery walk that loads its scenarios. Host-checked against
276
+ * `requiredKeys: ['id', 'name']`; silently skips an already-registered id/name
277
+ * (mirroring the shared `registerRecipesFromMod` dedupe).
278
+ */
279
+ const registerSimRecipe = (contribution) => {
280
+ const recipe = contribution;
281
+ const registry = currentSimulationRecipeRegistry();
282
+ if (registry.has(recipe.id) || registry.has(recipe.name))
283
+ return;
284
+ registry.register(recipe, { allowOverwrite: false });
285
+ };
286
+ /**
287
+ * Per-run subscope contribution (D7). Called by the CLI's pre-action-hook
288
+ * after constructing the scope and before entering it; the kernel installs
289
+ * the returned `simulation` slot. Fresh scenario + recipe registries + a fresh
290
+ * `ensureScenariosLoaded` lifecycle slot per run (audit F1) so concurrent scopes
291
+ * carry independent simulation state.
292
+ */
293
+ function contributeScope() {
294
+ return {
295
+ simulation: {
296
+ scenarios: createScenarioRegistry(),
297
+ recipes: createSimulationRecipeRegistry(),
298
+ load: createSimulationLoadState(),
299
+ },
300
+ };
301
+ }
302
+ /**
303
+ * Per-tool contract version (ADR-0047).
304
+ */
305
+ export const SIMULATION_CONTRACT_VERSION = '1.0.0';
306
+ export const SIMULATION_STABLE_ID = '715d32c2-692c-4ed4-985b-a35deaf186aa';
307
+ export const simulationTool = {
308
+ metadata: {
309
+ id: SIMULATION_STABLE_ID, // stable UUID (per ADR-0048; matches Checks `id` naming)
310
+ name: 'simulation', // human key (previously the value in `id`)
311
+ version: readPackageVersion(import.meta.url),
312
+ description: 'Run simulation scenarios against a codebase',
313
+ },
314
+ commands: [SIM, SIM_RUN_WORKER],
315
+ pluginLayout: SIM_PLUGIN_LAYOUT,
316
+ // Sim declares its command surface; the host mounts it via mountCommandSpec.
317
+ // The deprecated
318
+ // `register()` fallback is gone — sim no longer touches Commander.
319
+ commandSpecs: [simCommand, simRunWorkerCommandSpec],
320
+ contributeScope,
321
+ sessionReplay: {
322
+ tool: 'sim',
323
+ replaySession: simReplayFromSession,
324
+ },
325
+ // ADR-0023 Phase 4: simulation contributes its namespaced `simulation:` Zod
326
+ // schema so the host composes + strict-validates the whole config document
327
+ // before dispatch.
328
+ config: simulationConfigDeclaration,
329
+ // §5.3 Phase 4: simulation owns the `sim-pack` capability domain (declared in
330
+ // its manifest). It supplies the REAL registrar so the host can replace the
331
+ // manifest-time deferred placeholder once sim's module loads.
332
+ capabilityRegistrars: {
333
+ 'sim-pack': registerSimScenario,
334
+ 'sim-recipe': registerSimRecipe,
335
+ },
336
+ // ADR-0038: simulation owns its `init` example bytes (language-independent). The
337
+ // host writes each returned file under userPluginDir('sim', file.kind).
338
+ scaffoldExamples: simScaffoldExamples,
339
+ stableExampleIds: simStableExampleIds,
340
+ // ADR-0047: per-tool contract version for simulation's domain surface
341
+ // (scenarios, recipes, execution model, etc.). Independent of core
342
+ // TOOL_CONTRACT_VERSION. Declared under extensionPoints.
343
+ extensionPoints: {
344
+ simulationContractVersion: SIMULATION_CONTRACT_VERSION,
345
+ },
346
+ };
347
+ //# sourceMappingURL=tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.js","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAwC,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EA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,EAAE,mBAAmB;IACrC,gBAAgB,EAAE,mBAAmB;IACrC,sEAAsE;IACtE,mEAAmE;IACnE,yDAAyD;IACzD,eAAe,EAAE;QACf,yBAAyB,EAAE,2BAA2B;KACvD;CACF,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @fileoverview Simulation-specific type definitions.
3
+ *
4
+ * Core scenario types shared across the framework: the assertion shape and the
5
+ * aggregated metrics struct produced by the load-window driver.
6
+ */
7
+ import type { ScenarioMetricKey } from '../framework/scenario-metric-key.js';
8
+ /** Less-than comparison operators */
9
+ type LessThanOperator = 'lt' | 'lte';
10
+ /** Greater-than comparison operators */
11
+ type GreaterThanOperator = 'gt' | 'gte';
12
+ /** Equality comparison operators */
13
+ type EqualityAssertionOperator = 'eq' | 'neq';
14
+ /** All assertion comparison operators */
15
+ export type AssertionOperator = LessThanOperator | GreaterThanOperator | EqualityAssertionOperator;
16
+ /** A metric assertion evaluated after a scenario run */
17
+ export interface ScenarioAssertion {
18
+ metric: ScenarioMetricKey;
19
+ operator: AssertionOperator;
20
+ value: number;
21
+ message: string;
22
+ }
23
+ /** Aggregated performance metrics measured during a simulation run */
24
+ export interface SimulationMetrics {
25
+ totalRequests: number;
26
+ successfulRequests: number;
27
+ failedRequests: number;
28
+ avgLatencyMs: number;
29
+ p50LatencyMs: number;
30
+ p95LatencyMs: number;
31
+ p99LatencyMs: number;
32
+ errorsGenerated: number;
33
+ }
34
+ export {};
35
+ //# sourceMappingURL=base-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-types.d.ts","sourceRoot":"","sources":["../../src/types/base-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAM7E,qCAAqC;AACrC,KAAK,gBAAgB,GAAG,IAAI,GAAG,KAAK,CAAC;AACrC,wCAAwC;AACxC,KAAK,mBAAmB,GAAG,IAAI,GAAG,KAAK,CAAC;AACxC,oCAAoC;AACpC,KAAK,yBAAyB,GAAG,IAAI,GAAG,KAAK,CAAC;AAC9C,yCAAyC;AACzC,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,yBAAyB,CAAC;AAEnG,wDAAwD;AACxD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAMD,sEAAsE;AACtE,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @fileoverview Simulation-specific type definitions.
3
+ *
4
+ * Core scenario types shared across the framework: the assertion shape and the
5
+ * aggregated metrics struct produced by the load-window driver.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=base-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-types.js","sourceRoot":"","sources":["../../src/types/base-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @fileoverview Cross-kind type definitions for the Simulation Framework.
3
+ *
4
+ * The framework exposes two kind-specific entry points (`defineLoadScenario`,
5
+ * `defineChaosScenario`). The discriminated union over kinds lives in
6
+ * `framework/scenario-executor-result.ts`; the cross-kind `RunnableScenario`
7
+ * lives in `framework/runnable-scenario.ts`.
8
+ *
9
+ * The exports below are the small set of cross-kind shapes that each kind's
10
+ * `define`/`executor`/`result` modules consume — execution context + logger,
11
+ * assertion + failed-assertion shapes, and the load result payload (produced by
12
+ * `ScenarioResultBuilder`).
13
+ */
14
+ import type { SimulationMetrics, ScenarioAssertion as MutableScenarioAssertion } from './base-types.js';
15
+ import type { Signal } from '@opensip-cli/core';
16
+ /**
17
+ * A scenario assertion definition (readonly variant for framework use).
18
+ */
19
+ export type ScenarioAssertion = Readonly<MutableScenarioAssertion>;
20
+ /**
21
+ * A failed assertion with actual value.
22
+ */
23
+ export interface FailedAssertion extends ScenarioAssertion {
24
+ readonly actual: number;
25
+ }
26
+ /**
27
+ * Context passed to scenario executors.
28
+ */
29
+ export interface ScenarioExecutionContext {
30
+ readonly scenarioId: string;
31
+ readonly correlationId: string;
32
+ readonly abortSignal: AbortSignal;
33
+ readonly logger: ScenarioLogger;
34
+ }
35
+ /**
36
+ * Logger interface for scenarios.
37
+ */
38
+ export interface ScenarioLogger {
39
+ info(message: string, data?: Record<string, unknown>): void;
40
+ warn(message: string, data?: Record<string, unknown>): void;
41
+ error(message: string, data?: Record<string, unknown>): void;
42
+ debug(message: string, data?: Record<string, unknown>): void;
43
+ }
44
+ /**
45
+ * Load-shaped scenario result payload, produced by `ScenarioResultBuilder`.
46
+ *
47
+ * This is the builder's output shape: the load and chaos executors build a
48
+ * payload of this shape and wrap it into their kind-specific
49
+ * `ScenarioExecutorResult` envelope (the discriminated union over kinds in
50
+ * `framework/scenario-executor-result.ts`).
51
+ */
52
+ export interface LoadResultPayload {
53
+ readonly passed: boolean;
54
+ readonly metrics: SimulationMetrics;
55
+ readonly assertions: {
56
+ readonly passed: readonly ScenarioAssertion[];
57
+ readonly failed: readonly FailedAssertion[];
58
+ };
59
+ readonly signals: readonly Signal[];
60
+ }
61
+ export { type AssertionOperator, type SimulationMetrics } from './base-types.js';
62
+ //# sourceMappingURL=framework-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-types.d.ts","sourceRoot":"","sources":["../../src/types/framework-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,iBAA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,EAAE,CAAC;QAC9C,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;KAC7C,CAAC;IACF,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAMD,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @fileoverview Cross-kind type definitions for the Simulation Framework.
3
+ *
4
+ * The framework exposes two kind-specific entry points (`defineLoadScenario`,
5
+ * `defineChaosScenario`). The discriminated union over kinds lives in
6
+ * `framework/scenario-executor-result.ts`; the cross-kind `RunnableScenario`
7
+ * lives in `framework/runnable-scenario.ts`.
8
+ *
9
+ * The exports below are the small set of cross-kind shapes that each kind's
10
+ * `define`/`executor`/`result` modules consume — execution context + logger,
11
+ * assertion + failed-assertion shapes, and the load result payload (produced by
12
+ * `ScenarioResultBuilder`).
13
+ */
14
+ export {};
15
+ //# sourceMappingURL=framework-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-types.js","sourceRoot":"","sources":["../../src/types/framework-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @fileoverview Discriminator + cross-kind shared types for the scenario kind system.
3
+ *
4
+ * The standalone simulation tool supports two scenario kinds, each with its own
5
+ * author-facing entry point and per-kind result outcome:
6
+ *
7
+ * - `load` — personas + ramp + sustain + assert SLO metrics
8
+ * - `chaos` — base load + failure injection + recovery assertions
9
+ *
10
+ * The `invariant` and `fix-evaluation` kinds were removed as parent-product-coupled
11
+ * (standalone-CLI trim, 2026-06-05; parent DEC-338 superseded here) — they were
12
+ * integration harnesses for the SaaS runtime (reconciler/DBOS/audit/Postgres).
13
+ *
14
+ * The discriminator is internal to the framework. Authors call the kind-specific
15
+ * `defineXxxScenario` entry point; that entry point sets `kind` on the resulting
16
+ * `RunnableScenario`. The discriminated union over `ScenarioExecutorResult`
17
+ * lets persistence + dashboard code dispatch on `kind` without leaking
18
+ * kind-internal types.
19
+ */
20
+ /** Scenario kind discriminator. */
21
+ export type ScenarioKind = 'load' | 'chaos';
22
+ /** All scenario kinds, frozen for runtime iteration. */
23
+ export declare const SCENARIO_KINDS: readonly ScenarioKind[];
24
+ //# sourceMappingURL=kind-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kind-types.d.ts","sourceRoot":"","sources":["../../src/types/kind-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,mCAAmC;AACnC,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5C,wDAAwD;AACxD,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAAqC,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @fileoverview Discriminator + cross-kind shared types for the scenario kind system.
3
+ *
4
+ * The standalone simulation tool supports two scenario kinds, each with its own
5
+ * author-facing entry point and per-kind result outcome:
6
+ *
7
+ * - `load` — personas + ramp + sustain + assert SLO metrics
8
+ * - `chaos` — base load + failure injection + recovery assertions
9
+ *
10
+ * The `invariant` and `fix-evaluation` kinds were removed as parent-product-coupled
11
+ * (standalone-CLI trim, 2026-06-05; parent DEC-338 superseded here) — they were
12
+ * integration harnesses for the SaaS runtime (reconciler/DBOS/audit/Postgres).
13
+ *
14
+ * The discriminator is internal to the framework. Authors call the kind-specific
15
+ * `defineXxxScenario` entry point; that entry point sets `kind` on the resulting
16
+ * `RunnableScenario`. The discriminated union over `ScenarioExecutorResult`
17
+ * lets persistence + dashboard code dispatch on `kind` without leaking
18
+ * kind-internal types.
19
+ */
20
+ /** All scenario kinds, frozen for runtime iteration. */
21
+ export const SCENARIO_KINDS = Object.freeze(['load', 'chaos']);
22
+ //# sourceMappingURL=kind-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kind-types.js","sourceRoot":"","sources":["../../src/types/kind-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,wDAAwD;AACxD,MAAM,CAAC,MAAM,cAAc,GAA4B,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @fileoverview `Workload` — the neutral arrival-rate model the load-window
3
+ * driver consumes.
4
+ *
5
+ * Replaces the persona model (buyer/seller/admin `spawnRate`), which was
6
+ * parent-SaaS domain vestige the driver only ever collapsed into a single RPS
7
+ * number. A workload states the target request rate directly, plus an optional
8
+ * in-flight concurrency cap and ramp-up.
9
+ */
10
+ /** Author-facing workload for a load/chaos scenario. */
11
+ export interface Workload {
12
+ /** Target requests per second the driver paces toward. */
13
+ readonly rps: number;
14
+ /**
15
+ * Maximum in-flight requests. When omitted, derived from `rps` via
16
+ * {@link resolveConcurrency} so authors need only specify `rps`.
17
+ */
18
+ readonly concurrency?: number;
19
+ /** Linear ramp-up from 0 to `rps`, in seconds. Defaults to 0 (no ramp). */
20
+ readonly rampUp?: number;
21
+ }
22
+ /**
23
+ * Resolve the in-flight concurrency cap for a workload.
24
+ *
25
+ * When `concurrency` is set, it wins. Otherwise derive a bound from `rps`:
26
+ * roughly one in-flight slot per 5 rps (min 1). This keeps a default scenario
27
+ * from issuing an unbounded burst while still letting real latency overlap.
28
+ */
29
+ export declare function resolveConcurrency(workload: Workload): number;
30
+ //# sourceMappingURL=workload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workload.d.ts","sourceRoot":"","sources":["../../src/types/workload.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,wDAAwD;AACxD,MAAM,WAAW,QAAQ;IACvB,0DAA0D;IAC1D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAE7D"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @fileoverview `Workload` — the neutral arrival-rate model the load-window
3
+ * driver consumes.
4
+ *
5
+ * Replaces the persona model (buyer/seller/admin `spawnRate`), which was
6
+ * parent-SaaS domain vestige the driver only ever collapsed into a single RPS
7
+ * number. A workload states the target request rate directly, plus an optional
8
+ * in-flight concurrency cap and ramp-up.
9
+ */
10
+ /**
11
+ * Resolve the in-flight concurrency cap for a workload.
12
+ *
13
+ * When `concurrency` is set, it wins. Otherwise derive a bound from `rps`:
14
+ * roughly one in-flight slot per 5 rps (min 1). This keeps a default scenario
15
+ * from issuing an unbounded burst while still letting real latency overlap.
16
+ */
17
+ export function resolveConcurrency(workload) {
18
+ return workload.concurrency ?? Math.max(1, Math.ceil(workload.rps / 5));
19
+ }
20
+ //# sourceMappingURL=workload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workload.js","sourceRoot":"","sources":["../../src/types/workload.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAeH;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAkB;IACnD,OAAO,QAAQ,CAAC,WAAW,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC"}