ppef 1.0.0 → 1.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 (336) hide show
  1. package/README.md +172 -0
  2. package/bin/ppef.mjs +20 -0
  3. package/dist/__tests__/framework-pipeline.integration.test.d.ts +7 -0
  4. package/dist/__tests__/framework-pipeline.integration.test.d.ts.map +1 -0
  5. package/dist/__tests__/framework-pipeline.integration.test.js +415 -0
  6. package/dist/__tests__/framework-pipeline.integration.test.js.map +1 -0
  7. package/dist/__tests__/index-exports.unit.test.d.ts +8 -0
  8. package/dist/__tests__/index-exports.unit.test.d.ts.map +1 -0
  9. package/dist/__tests__/index-exports.unit.test.js +127 -0
  10. package/dist/__tests__/index-exports.unit.test.js.map +1 -0
  11. package/dist/__tests__/registry-executor.integration.test.d.ts +5 -0
  12. package/dist/__tests__/registry-executor.integration.test.d.ts.map +1 -0
  13. package/dist/__tests__/registry-executor.integration.test.js +352 -0
  14. package/dist/__tests__/registry-executor.integration.test.js.map +1 -0
  15. package/dist/__tests__/test-helpers.d.ts +94 -0
  16. package/dist/__tests__/test-helpers.d.ts.map +1 -0
  17. package/dist/__tests__/test-helpers.js +271 -0
  18. package/dist/__tests__/test-helpers.js.map +1 -0
  19. package/dist/aggregation/__tests__/aggregators.unit.test.d.ts +7 -0
  20. package/dist/aggregation/__tests__/aggregators.unit.test.d.ts.map +1 -0
  21. package/dist/aggregation/__tests__/aggregators.unit.test.js +350 -0
  22. package/dist/aggregation/__tests__/aggregators.unit.test.js.map +1 -0
  23. package/dist/aggregation/__tests__/pipeline.unit.test.d.ts +7 -0
  24. package/dist/aggregation/__tests__/pipeline.unit.test.d.ts.map +1 -0
  25. package/dist/aggregation/__tests__/pipeline.unit.test.js +213 -0
  26. package/dist/aggregation/__tests__/pipeline.unit.test.js.map +1 -0
  27. package/dist/aggregation/aggregators.d.ts +63 -0
  28. package/dist/aggregation/aggregators.d.ts.map +1 -0
  29. package/dist/aggregation/aggregators.js +228 -0
  30. package/dist/aggregation/aggregators.js.map +1 -0
  31. package/dist/aggregation/index.d.ts +8 -0
  32. package/dist/aggregation/index.d.ts.map +1 -0
  33. package/dist/aggregation/index.js +8 -0
  34. package/dist/aggregation/index.js.map +1 -0
  35. package/dist/aggregation/pipeline.d.ts +38 -0
  36. package/dist/aggregation/pipeline.d.ts.map +1 -0
  37. package/dist/aggregation/pipeline.js +198 -0
  38. package/dist/aggregation/pipeline.js.map +1 -0
  39. package/dist/claims/__tests__/evaluator.unit.test.d.ts +12 -0
  40. package/dist/claims/__tests__/evaluator.unit.test.d.ts.map +1 -0
  41. package/dist/claims/__tests__/evaluator.unit.test.js +801 -0
  42. package/dist/claims/__tests__/evaluator.unit.test.js.map +1 -0
  43. package/dist/claims/evaluator.d.ts +33 -0
  44. package/dist/claims/evaluator.d.ts.map +1 -0
  45. package/dist/claims/evaluator.js +174 -0
  46. package/dist/claims/evaluator.js.map +1 -0
  47. package/dist/claims/index.d.ts +7 -0
  48. package/dist/claims/index.d.ts.map +1 -0
  49. package/dist/claims/index.js +7 -0
  50. package/dist/claims/index.js.map +1 -0
  51. package/dist/cli/__tests__/aggregate.command.unit.test.d.ts +7 -0
  52. package/dist/cli/__tests__/aggregate.command.unit.test.d.ts.map +1 -0
  53. package/dist/cli/__tests__/aggregate.command.unit.test.js +396 -0
  54. package/dist/cli/__tests__/aggregate.command.unit.test.js.map +1 -0
  55. package/dist/cli/__tests__/commands.unit.test.d.ts +10 -0
  56. package/dist/cli/__tests__/commands.unit.test.d.ts.map +1 -0
  57. package/dist/cli/__tests__/commands.unit.test.js +217 -0
  58. package/dist/cli/__tests__/commands.unit.test.js.map +1 -0
  59. package/dist/cli/__tests__/index.unit.test.d.ts +10 -0
  60. package/dist/cli/__tests__/index.unit.test.d.ts.map +1 -0
  61. package/dist/cli/__tests__/index.unit.test.js +65 -0
  62. package/dist/cli/__tests__/index.unit.test.js.map +1 -0
  63. package/dist/cli/__tests__/logger.unit.test.d.ts +11 -0
  64. package/dist/cli/__tests__/logger.unit.test.d.ts.map +1 -0
  65. package/dist/cli/__tests__/logger.unit.test.js +180 -0
  66. package/dist/cli/__tests__/logger.unit.test.js.map +1 -0
  67. package/dist/cli/__tests__/module-loader.unit.test.d.ts +11 -0
  68. package/dist/cli/__tests__/module-loader.unit.test.d.ts.map +1 -0
  69. package/dist/cli/__tests__/module-loader.unit.test.js +262 -0
  70. package/dist/cli/__tests__/module-loader.unit.test.js.map +1 -0
  71. package/dist/cli/__tests__/output-writer.unit.test.d.ts +10 -0
  72. package/dist/cli/__tests__/output-writer.unit.test.d.ts.map +1 -0
  73. package/dist/cli/__tests__/output-writer.unit.test.js +216 -0
  74. package/dist/cli/__tests__/output-writer.unit.test.js.map +1 -0
  75. package/dist/cli/__tests__/plan.command.unit.test.d.ts +7 -0
  76. package/dist/cli/__tests__/plan.command.unit.test.d.ts.map +1 -0
  77. package/dist/cli/__tests__/plan.command.unit.test.js +289 -0
  78. package/dist/cli/__tests__/plan.command.unit.test.js.map +1 -0
  79. package/dist/cli/__tests__/run.command.unit.test.d.ts +7 -0
  80. package/dist/cli/__tests__/run.command.unit.test.d.ts.map +1 -0
  81. package/dist/cli/__tests__/run.command.unit.test.js +422 -0
  82. package/dist/cli/__tests__/run.command.unit.test.js.map +1 -0
  83. package/dist/cli/__tests__/validate.command.unit.test.d.ts +7 -0
  84. package/dist/cli/__tests__/validate.command.unit.test.d.ts.map +1 -0
  85. package/dist/cli/__tests__/validate.command.unit.test.js +226 -0
  86. package/dist/cli/__tests__/validate.command.unit.test.js.map +1 -0
  87. package/dist/cli/command-deps.d.ts +125 -0
  88. package/dist/cli/command-deps.d.ts.map +1 -0
  89. package/dist/cli/command-deps.js +7 -0
  90. package/dist/cli/command-deps.js.map +1 -0
  91. package/dist/cli/commands/aggregate.d.ts +35 -0
  92. package/dist/cli/commands/aggregate.d.ts.map +1 -0
  93. package/dist/cli/commands/aggregate.js +121 -0
  94. package/dist/cli/commands/aggregate.js.map +1 -0
  95. package/dist/cli/commands/plan.d.ts +36 -0
  96. package/dist/cli/commands/plan.d.ts.map +1 -0
  97. package/dist/cli/commands/plan.js +109 -0
  98. package/dist/cli/commands/plan.js.map +1 -0
  99. package/dist/cli/commands/run.d.ts +33 -0
  100. package/dist/cli/commands/run.d.ts.map +1 -0
  101. package/dist/cli/commands/run.js +185 -0
  102. package/dist/cli/commands/run.js.map +1 -0
  103. package/dist/cli/commands/validate.d.ts +27 -0
  104. package/dist/cli/commands/validate.d.ts.map +1 -0
  105. package/dist/cli/commands/validate.js +88 -0
  106. package/dist/cli/commands/validate.js.map +1 -0
  107. package/dist/cli/config-loader.d.ts +30 -0
  108. package/dist/cli/config-loader.d.ts.map +1 -0
  109. package/dist/cli/config-loader.js +181 -0
  110. package/dist/cli/config-loader.js.map +1 -0
  111. package/dist/cli/index.d.ts +26 -0
  112. package/dist/cli/index.d.ts.map +1 -0
  113. package/dist/cli/index.js +58 -0
  114. package/dist/cli/index.js.map +1 -0
  115. package/dist/cli/logger.d.ts +75 -0
  116. package/dist/cli/logger.d.ts.map +1 -0
  117. package/dist/cli/logger.js +131 -0
  118. package/dist/cli/logger.js.map +1 -0
  119. package/dist/cli/module-loader.d.ts +46 -0
  120. package/dist/cli/module-loader.d.ts.map +1 -0
  121. package/dist/cli/module-loader.js +116 -0
  122. package/dist/cli/module-loader.js.map +1 -0
  123. package/dist/cli/output-writer.d.ts +51 -0
  124. package/dist/cli/output-writer.d.ts.map +1 -0
  125. package/dist/cli/output-writer.js +65 -0
  126. package/dist/cli/output-writer.js.map +1 -0
  127. package/dist/cli/types.d.ts +174 -0
  128. package/dist/cli/types.d.ts.map +1 -0
  129. package/dist/cli/types.js +7 -0
  130. package/dist/cli/types.js.map +1 -0
  131. package/dist/collector/__tests__/result-collector.unit.test.d.ts +7 -0
  132. package/dist/collector/__tests__/result-collector.unit.test.d.ts.map +1 -0
  133. package/dist/collector/__tests__/result-collector.unit.test.js +1021 -0
  134. package/dist/collector/__tests__/result-collector.unit.test.js.map +1 -0
  135. package/dist/collector/__tests__/schema.unit.test.d.ts +7 -0
  136. package/dist/collector/__tests__/schema.unit.test.d.ts.map +1 -0
  137. package/dist/collector/__tests__/schema.unit.test.js +360 -0
  138. package/dist/collector/__tests__/schema.unit.test.js.map +1 -0
  139. package/dist/collector/index.d.ts +8 -0
  140. package/dist/collector/index.d.ts.map +1 -0
  141. package/dist/collector/index.js +8 -0
  142. package/dist/collector/index.js.map +1 -0
  143. package/dist/collector/result-collector.d.ts +159 -0
  144. package/dist/collector/result-collector.d.ts.map +1 -0
  145. package/dist/collector/result-collector.js +213 -0
  146. package/dist/collector/result-collector.js.map +1 -0
  147. package/dist/collector/schema.d.ts +34 -0
  148. package/dist/collector/schema.d.ts.map +1 -0
  149. package/dist/collector/schema.js +145 -0
  150. package/dist/collector/schema.js.map +1 -0
  151. package/dist/executor/__tests__/checkpoint-hash-bug.diagnostic.test.d.ts +10 -0
  152. package/dist/executor/__tests__/checkpoint-hash-bug.diagnostic.test.d.ts.map +1 -0
  153. package/dist/executor/__tests__/checkpoint-hash-bug.diagnostic.test.js +122 -0
  154. package/dist/executor/__tests__/checkpoint-hash-bug.diagnostic.test.js.map +1 -0
  155. package/dist/executor/__tests__/checkpoint-manager.integration.test.d.ts +7 -0
  156. package/dist/executor/__tests__/checkpoint-manager.integration.test.d.ts.map +1 -0
  157. package/dist/executor/__tests__/checkpoint-manager.integration.test.js +330 -0
  158. package/dist/executor/__tests__/checkpoint-manager.integration.test.js.map +1 -0
  159. package/dist/executor/__tests__/checkpoint-manager.unit.test.d.ts +7 -0
  160. package/dist/executor/__tests__/checkpoint-manager.unit.test.d.ts.map +1 -0
  161. package/dist/executor/__tests__/checkpoint-manager.unit.test.js +531 -0
  162. package/dist/executor/__tests__/checkpoint-manager.unit.test.js.map +1 -0
  163. package/dist/executor/__tests__/checkpoint-merge-bug.diagnostic.test.d.ts +8 -0
  164. package/dist/executor/__tests__/checkpoint-merge-bug.diagnostic.test.d.ts.map +1 -0
  165. package/dist/executor/__tests__/checkpoint-merge-bug.diagnostic.test.js +493 -0
  166. package/dist/executor/__tests__/checkpoint-merge-bug.diagnostic.test.js.map +1 -0
  167. package/dist/executor/__tests__/checkpoint-merge-bug.unit.test.d.ts +8 -0
  168. package/dist/executor/__tests__/checkpoint-merge-bug.unit.test.d.ts.map +1 -0
  169. package/dist/executor/__tests__/checkpoint-merge-bug.unit.test.js +164 -0
  170. package/dist/executor/__tests__/checkpoint-merge-bug.unit.test.js.map +1 -0
  171. package/dist/executor/__tests__/checkpoint-storage.unit.test.d.ts +7 -0
  172. package/dist/executor/__tests__/checkpoint-storage.unit.test.d.ts.map +1 -0
  173. package/dist/executor/__tests__/checkpoint-storage.unit.test.js +490 -0
  174. package/dist/executor/__tests__/checkpoint-storage.unit.test.js.map +1 -0
  175. package/dist/executor/__tests__/executor.unit.test.d.ts +7 -0
  176. package/dist/executor/__tests__/executor.unit.test.d.ts.map +1 -0
  177. package/dist/executor/__tests__/executor.unit.test.js +202 -0
  178. package/dist/executor/__tests__/executor.unit.test.js.map +1 -0
  179. package/dist/executor/__tests__/memory-monitor.unit.test.d.ts +7 -0
  180. package/dist/executor/__tests__/memory-monitor.unit.test.d.ts.map +1 -0
  181. package/dist/executor/__tests__/memory-monitor.unit.test.js +285 -0
  182. package/dist/executor/__tests__/memory-monitor.unit.test.js.map +1 -0
  183. package/dist/executor/__tests__/parallel-checkpoint-merge.integration.test.d.ts +12 -0
  184. package/dist/executor/__tests__/parallel-checkpoint-merge.integration.test.d.ts.map +1 -0
  185. package/dist/executor/__tests__/parallel-checkpoint-merge.integration.test.js +196 -0
  186. package/dist/executor/__tests__/parallel-checkpoint-merge.integration.test.js.map +1 -0
  187. package/dist/executor/__tests__/parallel-executor.integration.test.d.ts +7 -0
  188. package/dist/executor/__tests__/parallel-executor.integration.test.d.ts.map +1 -0
  189. package/dist/executor/__tests__/parallel-executor.integration.test.js +249 -0
  190. package/dist/executor/__tests__/parallel-executor.integration.test.js.map +1 -0
  191. package/dist/executor/__tests__/parallel-executor.unit.test.d.ts +8 -0
  192. package/dist/executor/__tests__/parallel-executor.unit.test.d.ts.map +1 -0
  193. package/dist/executor/__tests__/parallel-executor.unit.test.js +473 -0
  194. package/dist/executor/__tests__/parallel-executor.unit.test.js.map +1 -0
  195. package/dist/executor/__tests__/run-id.unit.test.d.ts +8 -0
  196. package/dist/executor/__tests__/run-id.unit.test.d.ts.map +1 -0
  197. package/dist/executor/__tests__/run-id.unit.test.js +156 -0
  198. package/dist/executor/__tests__/run-id.unit.test.js.map +1 -0
  199. package/dist/executor/__tests__/worker-entry.integration.test.d.ts +24 -0
  200. package/dist/executor/__tests__/worker-entry.integration.test.d.ts.map +1 -0
  201. package/dist/executor/__tests__/worker-entry.integration.test.js +82 -0
  202. package/dist/executor/__tests__/worker-entry.integration.test.js.map +1 -0
  203. package/dist/executor/__tests__/worker-entry.unit.test.d.ts +7 -0
  204. package/dist/executor/__tests__/worker-entry.unit.test.d.ts.map +1 -0
  205. package/dist/executor/__tests__/worker-entry.unit.test.js +364 -0
  206. package/dist/executor/__tests__/worker-entry.unit.test.js.map +1 -0
  207. package/dist/executor/checkpoint-manager.d.ts +231 -0
  208. package/dist/executor/checkpoint-manager.d.ts.map +1 -0
  209. package/dist/executor/checkpoint-manager.js +395 -0
  210. package/dist/executor/checkpoint-manager.js.map +1 -0
  211. package/dist/executor/checkpoint-storage.d.ts +230 -0
  212. package/dist/executor/checkpoint-storage.d.ts.map +1 -0
  213. package/dist/executor/checkpoint-storage.js +370 -0
  214. package/dist/executor/checkpoint-storage.js.map +1 -0
  215. package/dist/executor/checkpoint-types.d.ts +48 -0
  216. package/dist/executor/checkpoint-types.d.ts.map +1 -0
  217. package/dist/executor/checkpoint-types.js +8 -0
  218. package/dist/executor/checkpoint-types.js.map +1 -0
  219. package/dist/executor/executor.d.ts +164 -0
  220. package/dist/executor/executor.d.ts.map +1 -0
  221. package/dist/executor/executor.js +408 -0
  222. package/dist/executor/executor.js.map +1 -0
  223. package/dist/executor/index.d.ts +11 -0
  224. package/dist/executor/index.d.ts.map +1 -0
  225. package/dist/executor/index.js +11 -0
  226. package/dist/executor/index.js.map +1 -0
  227. package/dist/executor/memory-monitor.d.ts +115 -0
  228. package/dist/executor/memory-monitor.d.ts.map +1 -0
  229. package/dist/executor/memory-monitor.js +168 -0
  230. package/dist/executor/memory-monitor.js.map +1 -0
  231. package/dist/executor/parallel-executor.d.ts +239 -0
  232. package/dist/executor/parallel-executor.d.ts.map +1 -0
  233. package/dist/executor/parallel-executor.js +329 -0
  234. package/dist/executor/parallel-executor.js.map +1 -0
  235. package/dist/executor/run-id.d.ts +71 -0
  236. package/dist/executor/run-id.d.ts.map +1 -0
  237. package/dist/executor/run-id.js +74 -0
  238. package/dist/executor/run-id.js.map +1 -0
  239. package/dist/executor/worker-entry.d.ts +10 -0
  240. package/dist/executor/worker-entry.d.ts.map +1 -0
  241. package/dist/executor/worker-entry.js +42 -0
  242. package/dist/executor/worker-entry.js.map +1 -0
  243. package/dist/executor/worker-executor.d.ts +156 -0
  244. package/dist/executor/worker-executor.d.ts.map +1 -0
  245. package/dist/executor/worker-executor.js +88 -0
  246. package/dist/executor/worker-executor.js.map +1 -0
  247. package/dist/index.cjs +11 -0
  248. package/dist/index.d.ts +15 -0
  249. package/dist/index.d.ts.map +1 -0
  250. package/dist/index.js +24 -0
  251. package/dist/index.js.map +1 -0
  252. package/dist/registry/case-registry.d.ts +113 -0
  253. package/dist/registry/case-registry.d.ts.map +1 -0
  254. package/dist/registry/case-registry.js +160 -0
  255. package/dist/registry/case-registry.js.map +1 -0
  256. package/dist/registry/index.d.ts +8 -0
  257. package/dist/registry/index.d.ts.map +1 -0
  258. package/dist/registry/index.js +8 -0
  259. package/dist/registry/index.js.map +1 -0
  260. package/dist/registry/sut-registry.d.ts +96 -0
  261. package/dist/registry/sut-registry.d.ts.map +1 -0
  262. package/dist/registry/sut-registry.js +126 -0
  263. package/dist/registry/sut-registry.js.map +1 -0
  264. package/dist/renderers/index.d.ts +10 -0
  265. package/dist/renderers/index.d.ts.map +1 -0
  266. package/dist/renderers/index.js +9 -0
  267. package/dist/renderers/index.js.map +1 -0
  268. package/dist/renderers/latex-renderer.d.ts +84 -0
  269. package/dist/renderers/latex-renderer.d.ts.map +1 -0
  270. package/dist/renderers/latex-renderer.js +208 -0
  271. package/dist/renderers/latex-renderer.js.map +1 -0
  272. package/dist/renderers/types.d.ts +106 -0
  273. package/dist/renderers/types.d.ts.map +1 -0
  274. package/dist/renderers/types.js +23 -0
  275. package/dist/renderers/types.js.map +1 -0
  276. package/dist/robustness/__tests__/analyzer.unit.test.d.ts +11 -0
  277. package/dist/robustness/__tests__/analyzer.unit.test.d.ts.map +1 -0
  278. package/dist/robustness/__tests__/analyzer.unit.test.js +455 -0
  279. package/dist/robustness/__tests__/analyzer.unit.test.js.map +1 -0
  280. package/dist/robustness/__tests__/perturbations.unit.test.d.ts +11 -0
  281. package/dist/robustness/__tests__/perturbations.unit.test.d.ts.map +1 -0
  282. package/dist/robustness/__tests__/perturbations.unit.test.js +284 -0
  283. package/dist/robustness/__tests__/perturbations.unit.test.js.map +1 -0
  284. package/dist/robustness/analyzer.d.ts +61 -0
  285. package/dist/robustness/analyzer.d.ts.map +1 -0
  286. package/dist/robustness/analyzer.js +191 -0
  287. package/dist/robustness/analyzer.js.map +1 -0
  288. package/dist/robustness/index.d.ts +8 -0
  289. package/dist/robustness/index.d.ts.map +1 -0
  290. package/dist/robustness/index.js +8 -0
  291. package/dist/robustness/index.js.map +1 -0
  292. package/dist/robustness/perturbations.d.ts +46 -0
  293. package/dist/robustness/perturbations.d.ts.map +1 -0
  294. package/dist/robustness/perturbations.js +184 -0
  295. package/dist/robustness/perturbations.js.map +1 -0
  296. package/dist/statistical/__tests__/mann-whitney-u.unit.test.d.ts +7 -0
  297. package/dist/statistical/__tests__/mann-whitney-u.unit.test.d.ts.map +1 -0
  298. package/dist/statistical/__tests__/mann-whitney-u.unit.test.js +185 -0
  299. package/dist/statistical/__tests__/mann-whitney-u.unit.test.js.map +1 -0
  300. package/dist/statistical/index.d.ts +8 -0
  301. package/dist/statistical/index.d.ts.map +1 -0
  302. package/dist/statistical/index.js +8 -0
  303. package/dist/statistical/index.js.map +1 -0
  304. package/dist/statistical/mann-whitney-u.d.ts +62 -0
  305. package/dist/statistical/mann-whitney-u.d.ts.map +1 -0
  306. package/dist/statistical/mann-whitney-u.js +127 -0
  307. package/dist/statistical/mann-whitney-u.js.map +1 -0
  308. package/dist/types/aggregate.d.ts +124 -0
  309. package/dist/types/aggregate.d.ts.map +1 -0
  310. package/dist/types/aggregate.js +9 -0
  311. package/dist/types/aggregate.js.map +1 -0
  312. package/dist/types/case.d.ts +105 -0
  313. package/dist/types/case.d.ts.map +1 -0
  314. package/dist/types/case.js +10 -0
  315. package/dist/types/case.js.map +1 -0
  316. package/dist/types/claims.d.ts +122 -0
  317. package/dist/types/claims.d.ts.map +1 -0
  318. package/dist/types/claims.js +14 -0
  319. package/dist/types/claims.js.map +1 -0
  320. package/dist/types/index.d.ts +12 -0
  321. package/dist/types/index.d.ts.map +1 -0
  322. package/dist/types/index.js +7 -0
  323. package/dist/types/index.js.map +1 -0
  324. package/dist/types/perturbation.d.ts +105 -0
  325. package/dist/types/perturbation.d.ts.map +1 -0
  326. package/dist/types/perturbation.js +9 -0
  327. package/dist/types/perturbation.js.map +1 -0
  328. package/dist/types/result.d.ts +150 -0
  329. package/dist/types/result.d.ts.map +1 -0
  330. package/dist/types/result.js +12 -0
  331. package/dist/types/result.js.map +1 -0
  332. package/dist/types/sut.d.ts +128 -0
  333. package/dist/types/sut.d.ts.map +1 -0
  334. package/dist/types/sut.js +12 -0
  335. package/dist/types/sut.js.map +1 -0
  336. package/package.json +290 -7
@@ -0,0 +1,230 @@
1
+ /**
2
+ * Checkpoint Storage Backends
3
+ *
4
+ * Pluggable storage for experiment checkpoints:
5
+ * - FileStorage: JSON files in local filesystem (fast, no git required)
6
+ * - GitStorage: Git notes attached to commits (version controlled, shareable)
7
+ *
8
+ * Dependency Injection:
9
+ * - FileSystem interface enables mocking for tests
10
+ * - Lock interface enables pluggable concurrency control
11
+ *
12
+ * Usage:
13
+ * ```typescript
14
+ * // File-based (default)
15
+ * const fileStorage = new FileStorage("results/execute/checkpoint.json");
16
+ *
17
+ * // Git-based (stores as git notes)
18
+ * const gitStorage = new GitStorage("results-execute");
19
+ *
20
+ * // With mock file system for testing
21
+ * const mockFs = new MockFileSystem();
22
+ * const fileStorage = new FileStorage("checkpoint.json", mockFs);
23
+ *
24
+ * // Auto-detect based on mode
25
+ * const storage = createCheckpointStorage("file", "results/execute/checkpoint.json");
26
+ * const storage = createCheckpointStorage("git", "results-execute");
27
+ * ```
28
+ */
29
+ import type { CheckpointData } from "./checkpoint-manager.js";
30
+ /**
31
+ * Interface for file system operations.
32
+ * Enables mocking for testing and alternative storage backends.
33
+ */
34
+ export interface FileSystem {
35
+ /**
36
+ * Read file contents as UTF-8 string.
37
+ * @param path - Absolute file path
38
+ * @returns File contents or throws if not found
39
+ */
40
+ readFile(path: string): Promise<string>;
41
+ /**
42
+ * Write string content to a file.
43
+ * @param path - Absolute file path
44
+ * @param content - Content to write
45
+ */
46
+ writeFile(path: string, content: string): Promise<void>;
47
+ /**
48
+ * Create directory recursively if it doesn't exist.
49
+ * @param path - Directory path
50
+ * @param options - Options including recursive flag
51
+ */
52
+ mkdir(path: string, options: {
53
+ recursive: boolean;
54
+ }): Promise<void>;
55
+ /**
56
+ * Delete a file if it exists.
57
+ * @param path - File path to delete
58
+ */
59
+ unlink(path: string): Promise<void>;
60
+ /**
61
+ * Check if file/directory exists.
62
+ * @param path - Path to check
63
+ */
64
+ access(path: string): Promise<void>;
65
+ /**
66
+ * List directory contents.
67
+ * @param path - Directory path
68
+ * @returns Array of entry names
69
+ */
70
+ readdir(path: string): Promise<string[]>;
71
+ }
72
+ /**
73
+ * Production file system implementation using node:fs/promises.
74
+ */
75
+ export declare class NodeFileSystem implements FileSystem {
76
+ readFile(path: string): Promise<string>;
77
+ writeFile(path: string, content: string): Promise<void>;
78
+ mkdir(path: string, options: {
79
+ recursive: boolean;
80
+ }): Promise<void>;
81
+ unlink(path: string): Promise<void>;
82
+ access(path: string): Promise<void>;
83
+ readdir(path: string): Promise<string[]>;
84
+ }
85
+ /**
86
+ * Interface for concurrency control.
87
+ * Enables pluggable locking mechanisms for checkpoint saves.
88
+ */
89
+ export interface Lock {
90
+ /**
91
+ * Acquire the lock, waiting if necessary.
92
+ */
93
+ acquire(): Promise<void>;
94
+ /**
95
+ * Release the lock.
96
+ */
97
+ release(): void;
98
+ }
99
+ /**
100
+ * In-memory lock for single-process use.
101
+ * Provides queue-based locking for concurrent saves within a process.
102
+ */
103
+ export declare class InMemoryLock implements Lock {
104
+ private locked;
105
+ private queue;
106
+ acquire(): Promise<void>;
107
+ release(): void;
108
+ }
109
+ /**
110
+ * Checkpoint storage mode.
111
+ */
112
+ export type CheckpointMode = "file" | "git" | "auto";
113
+ /**
114
+ * Abstract checkpoint storage interface.
115
+ */
116
+ export interface CheckpointStorage {
117
+ /**
118
+ * Load checkpoint data from storage.
119
+ * @returns Checkpoint data or null if not found
120
+ */
121
+ load(): CheckpointData | null | Promise<CheckpointData | null>;
122
+ /**
123
+ * Save checkpoint data to storage.
124
+ * @param data - Checkpoint data to save
125
+ */
126
+ save(data: CheckpointData): Promise<void>;
127
+ /**
128
+ * Delete checkpoint from storage.
129
+ */
130
+ delete(): void | Promise<void>;
131
+ /**
132
+ * Check if checkpoint exists.
133
+ */
134
+ exists(): boolean | Promise<boolean>;
135
+ /**
136
+ * Get storage type identifier.
137
+ */
138
+ readonly type: string;
139
+ }
140
+ /**
141
+ * File-based checkpoint storage.
142
+ * Stores checkpoints as JSON files in the local filesystem.
143
+ *
144
+ * Supports dependency injection of FileSystem for testing.
145
+ */
146
+ export declare class FileStorage implements CheckpointStorage {
147
+ readonly type = "file";
148
+ private readonly path;
149
+ private readonly fs;
150
+ constructor(path: string, fs?: FileSystem);
151
+ load(): Promise<CheckpointData | null>;
152
+ save(data: CheckpointData): Promise<void>;
153
+ delete(): Promise<void>;
154
+ exists(): Promise<boolean>;
155
+ getPath(): string;
156
+ /**
157
+ * Find all worker checkpoint shard files in a directory.
158
+ * Looks for files matching the pattern "checkpoint-worker-*.json".
159
+ *
160
+ * @param baseDir - Directory to search for shard files
161
+ * @param fs - FileSystem implementation (defaults to NodeFileSystem)
162
+ * @returns Sorted array of shard file paths
163
+ */
164
+ static findShards(baseDir: string, fs?: FileSystem): Promise<string[]>;
165
+ /**
166
+ * Generate a shard file path for a specific worker.
167
+ *
168
+ * @param baseDir - Base directory for checkpoints
169
+ * @param workerIndex - Worker index (0-based)
170
+ * @returns Path to the shard checkpoint file
171
+ */
172
+ static shardPath(baseDir: string, workerIndex: number): string;
173
+ }
174
+ /**
175
+ * Git-based checkpoint storage using git notes.
176
+ *
177
+ * Checkpoints are stored as git notes attached to the current HEAD.
178
+ * This provides:
179
+ * - Version control: Checkpoints tracked in git history
180
+ * - Shareability: Team members can access each other's checkpoints
181
+ * - Reproducibility: Linked to specific commits
182
+ * - Safety: No accidental deletion through git clean
183
+ *
184
+ * Each checkpoint is stored as a note with a unique ref based on the namespace.
185
+ */
186
+ export declare class GitStorage implements CheckpointStorage {
187
+ readonly type = "git";
188
+ private readonly namespace;
189
+ private readonly repoRoot;
190
+ constructor(namespace: string, repoRoot?: string);
191
+ /**
192
+ * Get the full notes ref for this checkpoint.
193
+ */
194
+ private getNotesRef;
195
+ /**
196
+ * Check if git is available and we're in a git repo.
197
+ */
198
+ private checkGitAvailable;
199
+ load(): CheckpointData | null;
200
+ save(data: CheckpointData): Promise<void>;
201
+ delete(): void;
202
+ exists(): boolean;
203
+ /**
204
+ * List all checkpoints for this namespace across git history.
205
+ * Returns a map of commit SHA to checkpoint metadata.
206
+ */
207
+ listHistory(): {
208
+ commit: string;
209
+ checkpoint: CheckpointData;
210
+ }[];
211
+ /**
212
+ * Restore checkpoint from a specific commit.
213
+ * @param commitSha
214
+ */
215
+ restoreFromCommit(commitSha: string): CheckpointData | null;
216
+ }
217
+ /**
218
+ * Create a checkpoint storage instance based on mode.
219
+ * @param mode - Storage mode ("file", "git", or "auto")
220
+ * @param pathOrNamespace - File path or git namespace
221
+ * @param repoRoot - Git repository root (for git storage)
222
+ */
223
+ export declare const createCheckpointStorage: (mode: CheckpointMode, pathOrNamespace: string, repoRoot?: string) => CheckpointStorage;
224
+ /**
225
+ * Get default checkpoint namespace for git storage.
226
+ * Based on results directory path.
227
+ * @param resultsDir
228
+ */
229
+ export declare const getGitNamespace: (resultsDir: string) => string;
230
+ //# sourceMappingURL=checkpoint-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint-storage.d.ts","sourceRoot":"","sources":["../../src/executor/checkpoint-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,UAAU;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAExC;;;;OAIG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExD;;;;OAIG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpE;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpC;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpC;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MA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,OAAO,CAAC,IAAI,CAAC;IA2B/C,MAAM,IAAI,IAAI;IAgBd,MAAM,IAAI,OAAO;IAKjB;;;OAGG;IACH,WAAW,IAAI;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,cAAc,CAAA;KAAE,EAAE;IAmC/D;;;OAGG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;CAe3D;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GACnC,MAAM,cAAc,EACpB,iBAAiB,MAAM,EACvB,WAAW,MAAM,KACf,iBAQF,CAAC;AAyBF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,YAAY,MAAM,KAAG,MACoB,CAAC"}
@@ -0,0 +1,370 @@
1
+ /**
2
+ * Checkpoint Storage Backends
3
+ *
4
+ * Pluggable storage for experiment checkpoints:
5
+ * - FileStorage: JSON files in local filesystem (fast, no git required)
6
+ * - GitStorage: Git notes attached to commits (version controlled, shareable)
7
+ *
8
+ * Dependency Injection:
9
+ * - FileSystem interface enables mocking for tests
10
+ * - Lock interface enables pluggable concurrency control
11
+ *
12
+ * Usage:
13
+ * ```typescript
14
+ * // File-based (default)
15
+ * const fileStorage = new FileStorage("results/execute/checkpoint.json");
16
+ *
17
+ * // Git-based (stores as git notes)
18
+ * const gitStorage = new GitStorage("results-execute");
19
+ *
20
+ * // With mock file system for testing
21
+ * const mockFs = new MockFileSystem();
22
+ * const fileStorage = new FileStorage("checkpoint.json", mockFs);
23
+ *
24
+ * // Auto-detect based on mode
25
+ * const storage = createCheckpointStorage("file", "results/execute/checkpoint.json");
26
+ * const storage = createCheckpointStorage("git", "results-execute");
27
+ * ```
28
+ */
29
+ import { execSync } from "node:child_process";
30
+ import { mkdir, readdir, readFile, unlink, writeFile } from "node:fs/promises";
31
+ import { dirname, resolve } from "node:path";
32
+ /**
33
+ * Production file system implementation using node:fs/promises.
34
+ */
35
+ export class NodeFileSystem {
36
+ async readFile(path) {
37
+ return readFile(path, "utf-8");
38
+ }
39
+ async writeFile(path, content) {
40
+ await writeFile(path, content, "utf-8");
41
+ }
42
+ async mkdir(path, options) {
43
+ await mkdir(path, options);
44
+ }
45
+ async unlink(path) {
46
+ await unlink(path);
47
+ }
48
+ async access(path) {
49
+ const { constants } = await import("node:fs/promises");
50
+ const { access } = await import("node:fs/promises");
51
+ await access(path, constants.F_OK);
52
+ }
53
+ async readdir(path) {
54
+ return readdir(path);
55
+ }
56
+ }
57
+ /**
58
+ * In-memory lock for single-process use.
59
+ * Provides queue-based locking for concurrent saves within a process.
60
+ */
61
+ export class InMemoryLock {
62
+ locked = false;
63
+ queue = [];
64
+ async acquire() {
65
+ return new Promise((resolve) => {
66
+ if (this.locked) {
67
+ this.queue.push(resolve);
68
+ }
69
+ else {
70
+ this.locked = true;
71
+ resolve();
72
+ }
73
+ });
74
+ }
75
+ release() {
76
+ const next = this.queue.shift();
77
+ if (next) {
78
+ next();
79
+ }
80
+ else {
81
+ this.locked = false;
82
+ }
83
+ }
84
+ }
85
+ /**
86
+ * File-based checkpoint storage.
87
+ * Stores checkpoints as JSON files in the local filesystem.
88
+ *
89
+ * Supports dependency injection of FileSystem for testing.
90
+ */
91
+ export class FileStorage {
92
+ type = "file";
93
+ path;
94
+ fs;
95
+ constructor(path, fs) {
96
+ this.path = resolve(path);
97
+ this.fs = fs ?? new NodeFileSystem();
98
+ }
99
+ async load() {
100
+ try {
101
+ const content = await this.fs.readFile(this.path);
102
+ return JSON.parse(content);
103
+ }
104
+ catch {
105
+ return null;
106
+ }
107
+ }
108
+ async save(data) {
109
+ try {
110
+ await this.fs.mkdir(dirname(this.path), { recursive: true });
111
+ data.updatedAt = new Date().toISOString();
112
+ const content = JSON.stringify(data, null, 2);
113
+ await this.fs.writeFile(this.path, content);
114
+ }
115
+ catch (error) {
116
+ console.warn(`Failed to save checkpoint to ${this.path}: ${String(error)}`);
117
+ throw error;
118
+ }
119
+ }
120
+ async delete() {
121
+ try {
122
+ await this.fs.unlink(this.path);
123
+ }
124
+ catch {
125
+ // Ignore if file doesn't exist
126
+ }
127
+ }
128
+ async exists() {
129
+ try {
130
+ const content = await this.fs.readFile(this.path);
131
+ const data = JSON.parse(content);
132
+ return data !== null && typeof data === "object";
133
+ }
134
+ catch {
135
+ return false;
136
+ }
137
+ }
138
+ getPath() {
139
+ return this.path;
140
+ }
141
+ /**
142
+ * Find all worker checkpoint shard files in a directory.
143
+ * Looks for files matching the pattern "checkpoint-worker-*.json".
144
+ *
145
+ * @param baseDir - Directory to search for shard files
146
+ * @param fs - FileSystem implementation (defaults to NodeFileSystem)
147
+ * @returns Sorted array of shard file paths
148
+ */
149
+ static async findShards(baseDir, fs) {
150
+ const fileSystem = fs ?? new NodeFileSystem();
151
+ const shardFiles = [];
152
+ try {
153
+ const entries = await fileSystem.readdir(baseDir);
154
+ for (const entry of entries) {
155
+ if (entry.startsWith("checkpoint-worker-") && entry.endsWith(".json")) {
156
+ shardFiles.push(resolve(baseDir, entry));
157
+ }
158
+ }
159
+ }
160
+ catch {
161
+ // Directory doesn't exist or is not readable
162
+ return [];
163
+ }
164
+ // Sort by worker index (extract numeric part for proper ordering)
165
+ return shardFiles.sort((a, b) => {
166
+ const aMatch = /checkpoint-worker-(\d+)\.json/.exec(a);
167
+ const bMatch = /checkpoint-worker-(\d+)\.json/.exec(b);
168
+ const aIndex = aMatch ? Number.parseInt(aMatch[1], 10) : -1;
169
+ const bIndex = bMatch ? Number.parseInt(bMatch[1], 10) : -1;
170
+ return aIndex - bIndex;
171
+ });
172
+ }
173
+ /**
174
+ * Generate a shard file path for a specific worker.
175
+ *
176
+ * @param baseDir - Base directory for checkpoints
177
+ * @param workerIndex - Worker index (0-based)
178
+ * @returns Path to the shard checkpoint file
179
+ */
180
+ static shardPath(baseDir, workerIndex) {
181
+ return resolve(baseDir, `checkpoint-worker-${String(workerIndex).padStart(2, "0")}.json`);
182
+ }
183
+ }
184
+ /**
185
+ * Git-based checkpoint storage using git notes.
186
+ *
187
+ * Checkpoints are stored as git notes attached to the current HEAD.
188
+ * This provides:
189
+ * - Version control: Checkpoints tracked in git history
190
+ * - Shareability: Team members can access each other's checkpoints
191
+ * - Reproducibility: Linked to specific commits
192
+ * - Safety: No accidental deletion through git clean
193
+ *
194
+ * Each checkpoint is stored as a note with a unique ref based on the namespace.
195
+ */
196
+ export class GitStorage {
197
+ type = "git";
198
+ namespace;
199
+ repoRoot;
200
+ constructor(namespace, repoRoot = process.cwd()) {
201
+ this.namespace = namespace;
202
+ this.repoRoot = repoRoot;
203
+ }
204
+ /**
205
+ * Get the full notes ref for this checkpoint.
206
+ */
207
+ getNotesRef() {
208
+ return `refs/notes/checkpoints/${this.namespace}`;
209
+ }
210
+ /**
211
+ * Check if git is available and we're in a git repo.
212
+ */
213
+ checkGitAvailable() {
214
+ try {
215
+ execSync("git rev-parse --git-dir", {
216
+ cwd: this.repoRoot,
217
+ stdio: "pipe",
218
+ });
219
+ return true;
220
+ }
221
+ catch {
222
+ return false;
223
+ }
224
+ }
225
+ load() {
226
+ if (!this.checkGitAvailable()) {
227
+ console.warn("Git not available, falling back to null checkpoint");
228
+ return null;
229
+ }
230
+ try {
231
+ // Get the note content
232
+ const content = execSync(`git --work-tree="${this.repoRoot}" notes --ref=${this.getNotesRef()} show 2>/dev/null || echo ""`, { encoding: "utf-8", cwd: this.repoRoot });
233
+ if (!content.trim()) {
234
+ return null;
235
+ }
236
+ return JSON.parse(content);
237
+ }
238
+ catch {
239
+ return null;
240
+ }
241
+ }
242
+ async save(data) {
243
+ if (!this.checkGitAvailable()) {
244
+ console.warn("Git not available, skipping checkpoint save");
245
+ return;
246
+ }
247
+ try {
248
+ data.updatedAt = new Date().toISOString();
249
+ // Write to a temp file first
250
+ const temporaryPath = resolve(this.repoRoot, ".git", "checkpoint-tmp.json");
251
+ await writeFile(temporaryPath, JSON.stringify(data, null, 2), "utf-8");
252
+ // Add the note using the temp file
253
+ execSync(`git --work-tree="${this.repoRoot}" notes --ref=${this.getNotesRef()} add -F "${temporaryPath}"`, { stdio: "pipe", cwd: this.repoRoot });
254
+ // Clean up temp file
255
+ await unlink(temporaryPath).catch(() => undefined);
256
+ }
257
+ catch (error) {
258
+ console.warn(`Failed to save git checkpoint: ${String(error)}`);
259
+ throw error;
260
+ }
261
+ }
262
+ delete() {
263
+ if (!this.checkGitAvailable()) {
264
+ return undefined;
265
+ }
266
+ try {
267
+ execSync(`git --work-tree="${this.repoRoot}" notes --ref=${this.getNotesRef()} remove`, {
268
+ stdio: "pipe",
269
+ cwd: this.repoRoot,
270
+ });
271
+ }
272
+ catch {
273
+ // Ignore if note doesn't exist
274
+ }
275
+ return undefined;
276
+ }
277
+ exists() {
278
+ const data = this.load();
279
+ return data !== null;
280
+ }
281
+ /**
282
+ * List all checkpoints for this namespace across git history.
283
+ * Returns a map of commit SHA to checkpoint metadata.
284
+ */
285
+ listHistory() {
286
+ if (!this.checkGitAvailable()) {
287
+ return [];
288
+ }
289
+ try {
290
+ // Get all commits that have notes for this namespace
291
+ const output = execSync(`git --work-tree="${this.repoRoot}" notes --ref=${this.getNotesRef()} list`, { encoding: "utf-8", cwd: this.repoRoot });
292
+ const lines = output.trim().split("\n");
293
+ const results = [];
294
+ for (const line of lines) {
295
+ const [commitSha] = line.split(/\s+/);
296
+ try {
297
+ const content = execSync(`git --work-tree="${this.repoRoot}" notes --ref=${this.getNotesRef()} show ${commitSha}`, { encoding: "utf-8", cwd: this.repoRoot });
298
+ const checkpoint = JSON.parse(content);
299
+ results.push({ commit: commitSha, checkpoint });
300
+ }
301
+ catch {
302
+ // Skip invalid entries
303
+ }
304
+ }
305
+ return results;
306
+ }
307
+ catch {
308
+ return [];
309
+ }
310
+ }
311
+ /**
312
+ * Restore checkpoint from a specific commit.
313
+ * @param commitSha
314
+ */
315
+ restoreFromCommit(commitSha) {
316
+ if (!this.checkGitAvailable()) {
317
+ return null;
318
+ }
319
+ try {
320
+ const content = execSync(`git --work-tree="${this.repoRoot}" notes --ref=${this.getNotesRef()} show ${commitSha}`, { encoding: "utf-8", cwd: this.repoRoot });
321
+ return JSON.parse(content);
322
+ }
323
+ catch {
324
+ return null;
325
+ }
326
+ }
327
+ }
328
+ /**
329
+ * Create a checkpoint storage instance based on mode.
330
+ * @param mode - Storage mode ("file", "git", or "auto")
331
+ * @param pathOrNamespace - File path or git namespace
332
+ * @param repoRoot - Git repository root (for git storage)
333
+ */
334
+ export const createCheckpointStorage = (mode, pathOrNamespace, repoRoot) => {
335
+ const effectiveMode = mode === "auto" ? detectPreferredMode() : mode;
336
+ if (effectiveMode === "git") {
337
+ return new GitStorage(pathOrNamespace, repoRoot);
338
+ }
339
+ return new FileStorage(pathOrNamespace);
340
+ };
341
+ /**
342
+ * Detect preferred checkpoint mode based on environment.
343
+ * Returns "git" if in a git repo with commits, otherwise "file".
344
+ */
345
+ const detectPreferredMode = () => {
346
+ try {
347
+ // Check if we're in a git repo with commits
348
+ execSync("git rev-parse --git-dir > /dev/null 2>&1", { stdio: "pipe" });
349
+ // Check if there are any commits
350
+ try {
351
+ execSync("git rev-parse HEAD > /dev/null 2>&1", { stdio: "pipe" });
352
+ return "git";
353
+ }
354
+ catch {
355
+ // Git repo but no commits yet
356
+ return "file";
357
+ }
358
+ }
359
+ catch {
360
+ // Not a git repo
361
+ return "file";
362
+ }
363
+ };
364
+ /**
365
+ * Get default checkpoint namespace for git storage.
366
+ * Based on results directory path.
367
+ * @param resultsDir
368
+ */
369
+ export const getGitNamespace = (resultsDir) => resultsDir.replace(/[/\\]/g, "-").replace(/^\./, "").replace(/^\/+/, "");
370
+ //# sourceMappingURL=checkpoint-storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint-storage.js","sourceRoot":"","sources":["../../src/executor/checkpoint-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,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C;QACR,iBAAiB;QACjB,OAAO,MAAM,CAAC;IACf,CAAC;AACF,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,UAAkB,EAAU,EAAE,CAC7D,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Checkpoint Types
3
+ *
4
+ * Central type definitions for the checkpoint system.
5
+ * Separated from implementation files for clarity and testability.
6
+ */
7
+ import type { CheckpointStorage, Lock } from "./checkpoint-storage.js";
8
+ /**
9
+ * Checkpoint manager configuration options.
10
+ */
11
+ export interface CheckpointConfig {
12
+ /** Storage backend for checkpoint data */
13
+ storage: CheckpointStorage;
14
+ /** Concurrency lock for checkpoint saves */
15
+ lock?: Lock;
16
+ /** Worker identity for sharded mode */
17
+ workerIndex?: number;
18
+ /** Total number of workers in sharded mode */
19
+ totalWorkers?: number;
20
+ /** Base checkpoint path (for sharding) */
21
+ basePath?: string;
22
+ }
23
+ /**
24
+ * Worker identity for sharded checkpoint execution.
25
+ */
26
+ export interface WorkerIdentity {
27
+ /** Index of this worker (0-based) */
28
+ index: number;
29
+ /** Total number of workers */
30
+ total: number;
31
+ /** Human-readable name */
32
+ name: string;
33
+ }
34
+ /**
35
+ * Checkpoint shard information.
36
+ */
37
+ export interface CheckpointShard {
38
+ /** Path to this shard's checkpoint file */
39
+ path: string;
40
+ /** Worker index that owns this shard */
41
+ workerIndex: number;
42
+ /** Number of completed runs in this shard */
43
+ completedCount: number;
44
+ /** Whether this shard exists and is valid */
45
+ valid: boolean;
46
+ }
47
+ export { type Lock } from "./checkpoint-storage.js";
48
+ //# sourceMappingURL=checkpoint-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint-types.d.ts","sourceRoot":"","sources":["../../src/executor/checkpoint-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAIvE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,0CAA0C;IAC1C,OAAO,EAAE,iBAAiB,CAAC;IAE3B,4CAA4C;IAC5C,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IAEd,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IAEd,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IAEb,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IAEpB,6CAA6C;IAC7C,cAAc,EAAE,MAAM,CAAC;IAEvB,6CAA6C;IAC7C,KAAK,EAAE,OAAO,CAAC;CACf;AAED,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Checkpoint Types
3
+ *
4
+ * Central type definitions for the checkpoint system.
5
+ * Separated from implementation files for clarity and testability.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=checkpoint-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint-types.js","sourceRoot":"","sources":["../../src/executor/checkpoint-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}