@gfdelarue/testkit 0.4.5 → 0.5.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 (774) hide show
  1. package/README.md +666 -463
  2. package/bin/testkit-windows-owner-arm64.exe +0 -0
  3. package/bin/testkit-windows-owner-x64.exe +0 -0
  4. package/dist/app/bugs/ci-report.js +2 -2
  5. package/dist/app/bugs/ci-summary.js +3 -3
  6. package/dist/app/bugs/draft.js +3 -3
  7. package/dist/app/bugs/file.js +1 -1
  8. package/dist/app/bugs/gate.js +1 -1
  9. package/dist/app/bugs/guide.js +3 -3
  10. package/dist/app/bugs/issue.js +4 -4
  11. package/dist/app/bugs/known-failures.js +1 -1
  12. package/dist/app/bugs/record.js +2 -2
  13. package/dist/app/bugs/run-reading.js +1 -1
  14. package/dist/app/bugs/supplied-reproduce.js +1 -0
  15. package/dist/app/campaigns/campaign.js +1 -1
  16. package/dist/app/cleanup/index.js +1 -1
  17. package/dist/app/db-schema/prepare.js +1 -1
  18. package/dist/app/destroy/index.js +1 -1
  19. package/dist/app/discover/index.js +2 -2
  20. package/dist/app/doctor/index.js +1 -1
  21. package/dist/app/environments/config-driven.js +1 -1
  22. package/dist/app/environments/environment-file.js +1 -0
  23. package/dist/app/environments/file-setup.js +1 -0
  24. package/dist/app/environments/routing.js +1 -1
  25. package/dist/app/environments/static-values.js +1 -0
  26. package/dist/app/environments/supplied-input.js +1 -0
  27. package/dist/app/environments/supplied.js +1 -1
  28. package/dist/app/environments/task-databases.js +2 -0
  29. package/dist/app/inspect/artifacts.js +1 -1
  30. package/dist/app/inspect/index.js +1 -1
  31. package/dist/app/lint/index.js +1 -1
  32. package/dist/app/lint/native.js +1 -1
  33. package/dist/app/lint/options.js +1 -1
  34. package/dist/app/lint/rules/data.js +1 -1
  35. package/dist/app/lint/rules/engine-imports.js +1 -1
  36. package/dist/app/lint/rules/syntax.js +1 -1
  37. package/dist/app/lint/rules/unit.js +1 -1
  38. package/dist/app/reports/prepare.js +1 -1
  39. package/dist/app/run/caller-redaction.js +1 -0
  40. package/dist/app/run/engine-execution-failures.js +1 -1
  41. package/dist/app/run/engine-execution-reporting.js +1 -1
  42. package/dist/app/run/engine-execution.js +1 -1
  43. package/dist/app/run/engine-orchestration.js +1 -1
  44. package/dist/app/run/environment.js +1 -1
  45. package/dist/app/run/failure-details.js +1 -1
  46. package/dist/app/run/live-run.js +1 -1
  47. package/dist/app/run/orchestrator.js +1 -1
  48. package/dist/app/run/planning.js +1 -1
  49. package/dist/app/run/request.js +1 -1
  50. package/dist/app/run/results.js +1 -1
  51. package/dist/app/run/run-events.js +1 -1
  52. package/dist/app/run/run-finalization.js +1 -1
  53. package/dist/app/run/scheduler/estimates.js +1 -1
  54. package/dist/app/run/scheduler/identity.js +1 -1
  55. package/dist/app/run/scheduler/index.js +1 -1
  56. package/dist/app/run/setup/runtime-node-setup-protocol.js +1 -1
  57. package/dist/app/run/setup/runtime-node-setup-worker.js +1 -1
  58. package/dist/app/run/setup/runtime-node-setup.js +2 -2
  59. package/dist/app/run/task-batches.js +1 -1
  60. package/dist/app/run/worker-loop.js +1 -1
  61. package/dist/app/status/runs.js +1 -1
  62. package/dist/app/typecheck/index.js +4 -4
  63. package/dist/cli/command-catalog.js +1 -1
  64. package/dist/cli/command-flags.js +1 -1
  65. package/dist/cli/commands/artifacts.js +2 -2
  66. package/dist/cli/commands/bug/file.js +2 -2
  67. package/dist/cli/commands/bug/record.js +2 -2
  68. package/dist/cli/commands/discover.js +1 -1
  69. package/dist/cli/commands/run.js +2 -2
  70. package/dist/cli/commands/typecheck.js +1 -1
  71. package/dist/cli/commands/workspace.js +1 -1
  72. package/dist/cli/framework/errors.js +1 -1
  73. package/dist/cli/framework/execute.js +7 -6
  74. package/dist/cli/framework/parser.js +1 -1
  75. package/dist/cli/operations/run/operation.js +2 -2
  76. package/dist/cli/renderers/bug/text.js +1 -1
  77. package/dist/cli/renderers/discover/report.js +1 -1
  78. package/dist/cli/renderers/run/events.js +2 -2
  79. package/dist/cli/renderers/run/formatting.js +1 -1
  80. package/dist/cli/renderers/run/status.js +1 -1
  81. package/dist/cli/renderers/run/text-reporter.js +24 -22
  82. package/dist/cli/terminal/colors.js +1 -1
  83. package/dist/cli/terminal/layout.js +2 -2
  84. package/dist/config/authoring/http-methods.js +1 -1
  85. package/dist/config/loader/config-loader.js +1 -1
  86. package/dist/config/loader/decode-execution.js +1 -1
  87. package/dist/config/loader/dependencies.js +1 -1
  88. package/dist/config/loader/discover-tests.js +1 -1
  89. package/dist/config/loader/discovery-summary.js +1 -1
  90. package/dist/config/loader/discovery.js +2 -2
  91. package/dist/config/loader/env.js +1 -1
  92. package/dist/config/loader/file-metadata.js +1 -1
  93. package/dist/config/loader/groups.js +1 -1
  94. package/dist/config/loader/index.js +1 -1
  95. package/dist/config/loader/load.js +1 -1
  96. package/dist/config/loader/managed-configs.js +1 -1
  97. package/dist/config/loader/owned-discovery.js +1 -0
  98. package/dist/config/loader/path-policy.js +1 -1
  99. package/dist/config/loader/runtime-isolation.js +1 -1
  100. package/dist/config/loader/runtime.js +1 -1
  101. package/dist/config/loader/skip-config.js +1 -1
  102. package/dist/config/loader/task-policy.js +1 -0
  103. package/dist/config/loader/test-selection.js +1 -1
  104. package/dist/config/loader/validation.js +1 -1
  105. package/dist/database/admin.js +2 -2
  106. package/dist/database/bindings.js +1 -0
  107. package/dist/database/cleanup.js +1 -1
  108. package/dist/database/docker-metadata.js +3 -3
  109. package/dist/database/docker.js +3 -3
  110. package/dist/database/index.js +1 -1
  111. package/dist/database/local-postgres.js +1 -1
  112. package/dist/database/naming.js +1 -1
  113. package/dist/database/postgres/connection-check.js +1 -0
  114. package/dist/database/postgres/protocol.js +2 -0
  115. package/dist/database/schema-operations.js +1 -1
  116. package/dist/database/schema-source.js +3 -3
  117. package/dist/database/source-schema-env.js +1 -0
  118. package/dist/database/state-files.js +1 -1
  119. package/dist/database/state.js +1 -1
  120. package/dist/database/steps.js +3 -3
  121. package/dist/domain/file-timeout.js +1 -1
  122. package/dist/domain/identifiers.js +1 -1
  123. package/dist/domain/retired-test-types.js +1 -0
  124. package/dist/domain/runtime-isolation-contract.js +1 -1
  125. package/dist/domain/suite-selection.js +1 -1
  126. package/dist/domain/test-types.js +1 -1
  127. package/dist/engines/adapters/evidence-files.js +1 -1
  128. package/dist/engines/adapters/execution.js +1 -1
  129. package/dist/engines/adapters/json-bounds.js +2 -0
  130. package/dist/engines/adapters/native-report.js +1 -1
  131. package/dist/engines/api/execution.js +1 -1
  132. package/dist/engines/api/index.js +1 -1
  133. package/dist/engines/api/runtime-artifact.js +1 -1
  134. package/dist/engines/catalog.js +1 -1
  135. package/dist/engines/contracts/environment-values.js +1 -0
  136. package/dist/engines/definitions.js +1 -1
  137. package/dist/engines/environment/handles.js +1 -0
  138. package/dist/engines/environment/index.js +1 -0
  139. package/dist/engines/factory.js +1 -1
  140. package/dist/engines/installations/node-vitest.js +1 -1
  141. package/dist/engines/installations/package-resolution.js +1 -1
  142. package/dist/engines/installations/playwright.js +1 -1
  143. package/dist/engines/managed-module-resolution.js +2 -2
  144. package/dist/engines/manager.js +1 -1
  145. package/dist/engines/node-vitest/adapter/adapter.js +1 -1
  146. package/dist/engines/node-vitest/adapter/driver.js +2 -0
  147. package/dist/engines/node-vitest/adapter/evidence.js +2 -2
  148. package/dist/engines/node-vitest/adapter/failure-details.js +4 -2
  149. package/dist/engines/node-vitest/adapter/reporter.js +1 -1
  150. package/dist/engines/node-vitest/adapter/workspace.js +26 -188
  151. package/dist/engines/node-vitest/inventory/index.js +2 -0
  152. package/dist/engines/node-vitest/inventory/list-files.js +3 -0
  153. package/dist/engines/node-vitest/runtime/contract/index.js +1 -1
  154. package/dist/engines/node-vitest/runtime/data/http.js +1 -1
  155. package/dist/engines/node-vitest/runtime/data/index.js +1 -1
  156. package/dist/engines/node-vitest/runtime/data/report.js +5 -6
  157. package/dist/engines/node-vitest/runtime/data/scenario.js +2 -2
  158. package/dist/engines/node-vitest/runtime/runtime-input.js +1 -1
  159. package/dist/engines/node-vitest/selection.js +1 -0
  160. package/dist/engines/playwright/adapter/adapter.js +1 -1
  161. package/dist/engines/playwright/adapter/config.js +3 -3
  162. package/dist/engines/playwright/adapter/evidence-validation.js +1 -1
  163. package/dist/engines/playwright/adapter/evidence.js +1 -1
  164. package/dist/engines/playwright/adapter/reporter.js +1 -1
  165. package/dist/engines/playwright/runtime/config-file.js +1 -1
  166. package/dist/engines/playwright/runtime/config.js +1 -1
  167. package/dist/engines/playwright/runtime/runtime-input.js +29 -10
  168. package/dist/engines/runtime-input-file.js +1 -1
  169. package/dist/environment/lifecycle-controller.js +1 -1
  170. package/dist/environment/lifecycle.js +1 -1
  171. package/dist/environment/ready-environment.js +1 -1
  172. package/dist/environment/run-stopping.js +1 -1
  173. package/dist/environment/runtime-contexts.js +1 -1
  174. package/dist/environment/runtime-manager.js +1 -1
  175. package/dist/environment/runtime-planning.js +1 -1
  176. package/dist/environment/runtime-preparation.js +1 -1
  177. package/dist/environment/services.js +3 -3
  178. package/dist/environment/template.js +1 -1
  179. package/dist/evidence/artifact-config.js +1 -1
  180. package/dist/evidence/artifacts.js +2 -2
  181. package/dist/evidence/bundles.js +1 -1
  182. package/dist/evidence/environment-record.js +1 -1
  183. package/dist/evidence/index.js +1 -1
  184. package/dist/evidence/read-run.js +1 -1
  185. package/dist/evidence/reading.js +1 -1
  186. package/dist/evidence/redaction.js +4 -0
  187. package/dist/evidence/reporting.js +1 -1
  188. package/dist/evidence/run-model.js +1 -0
  189. package/dist/evidence/storage.js +2 -2
  190. package/dist/evidence/timing.js +1 -1
  191. package/dist/kernel/error-serialization.js +1 -1
  192. package/dist/kernel/redaction-targets.js +1 -0
  193. package/dist/kernel/redaction.js +4 -1
  194. package/dist/kernel/unknown-values.js +1 -1
  195. package/dist/process/environment.js +1 -1
  196. package/dist/process/execa-bundle.json +3 -3
  197. package/dist/process/files/json-file.js +1 -1
  198. package/dist/process/host/platform.js +1 -1
  199. package/dist/process/host-process.js +1 -1
  200. package/dist/process/index.js +1 -1
  201. package/dist/process/locks.js +4 -4
  202. package/dist/process/port-listener.js +2 -0
  203. package/dist/process/process-group.js +1 -1
  204. package/dist/process/process.js +32 -32
  205. package/dist/process/readiness.js +1 -1
  206. package/dist/process/ready-deadline.js +1 -0
  207. package/dist/process/runs/ownership.js +1 -1
  208. package/dist/process/runs/stop.js +1 -1
  209. package/dist/process/service-processes.js +1 -1
  210. package/dist/process/windows-cli-owner.js +3 -3
  211. package/dist/process/windows-native.js +1 -1
  212. package/dist/repo/fingerprint-policy.js +1 -1
  213. package/dist/repo/managed-git.js +1 -1
  214. package/dist/repo/physical-tree.js +1 -1
  215. package/dist/repo/state.js +4 -4
  216. package/dist/steps/build-config.js +1 -1
  217. package/dist/steps/configured-step-testkit-modules.js +1 -1
  218. package/dist/steps/configured-steps.js +1 -1
  219. package/dist/steps/environment.js +1 -1
  220. package/dist/steps/index.js +1 -1
  221. package/dist/toolchains/index.js +3 -3
  222. package/dist/toolchains/semver.js +1 -1
  223. package/dist/toolchains/vitest/index.js +1 -1
  224. package/dist/tracker/redaction.js +1 -2
  225. package/dist/{config/runtime/build-assets.d.ts → types/config-build-assets.d.ts} +5 -3
  226. package/dist/{database/steps.d.ts → types/config-database-steps.d.ts} +7 -7
  227. package/dist/{config/runtime/next-runtime-tsconfig.d.ts → types/config-next-runtime-tsconfig.d.ts} +5 -3
  228. package/dist/types/config.d.ts +501 -0
  229. package/dist/types/drizzle.d.ts +13 -0
  230. package/dist/{config/runtime/env/index.d.ts → types/env.d.ts} +22 -20
  231. package/dist/types/environment.d.ts +40 -0
  232. package/dist/types/index.d.ts +21 -0
  233. package/dist/types/node-vitest-contract.d.ts +75 -0
  234. package/dist/types/node-vitest-data.d.ts +407 -0
  235. package/dist/types/playwright.d.ts +130 -0
  236. package/dist/types/tooling-vitest.d.ts +13 -0
  237. package/dist/types/workspace.d.ts +617 -0
  238. package/docs/bug-records.md +37 -37
  239. package/docs/engines.md +213 -0
  240. package/docs/test-types.md +35 -33
  241. package/package.json +22 -29
  242. package/testkit-config-schema.md +378 -184
  243. package/dist/app/bugs/areas.d.ts +0 -38
  244. package/dist/app/bugs/assessment.d.ts +0 -9
  245. package/dist/app/bugs/categories.d.ts +0 -41
  246. package/dist/app/bugs/ci-report.d.ts +0 -21
  247. package/dist/app/bugs/ci-summary.d.ts +0 -13
  248. package/dist/app/bugs/draft.d.ts +0 -70
  249. package/dist/app/bugs/facts.d.ts +0 -49
  250. package/dist/app/bugs/file.d.ts +0 -45
  251. package/dist/app/bugs/gate.d.ts +0 -22
  252. package/dist/app/bugs/guide.d.ts +0 -20
  253. package/dist/app/bugs/issue.d.ts +0 -18
  254. package/dist/app/bugs/known-failures.d.ts +0 -49
  255. package/dist/app/bugs/record.d.ts +0 -14
  256. package/dist/app/bugs/run-reading.d.ts +0 -51
  257. package/dist/app/bugs/store.d.ts +0 -34
  258. package/dist/app/campaigns/brief.d.ts +0 -7
  259. package/dist/app/campaigns/campaign.d.ts +0 -14
  260. package/dist/app/campaigns/index.d.ts +0 -38
  261. package/dist/app/campaigns/store.d.ts +0 -5
  262. package/dist/app/campaigns/summary.d.ts +0 -13
  263. package/dist/app/cleanup/index.d.ts +0 -52
  264. package/dist/app/db-schema/prepare.d.ts +0 -11
  265. package/dist/app/db-schema/refresh.d.ts +0 -17
  266. package/dist/app/db-schema/verify.d.ts +0 -11
  267. package/dist/app/destroy/index.d.ts +0 -16
  268. package/dist/app/discover/index.d.ts +0 -8
  269. package/dist/app/doctor/index.d.ts +0 -17
  270. package/dist/app/environments/config-driven.d.ts +0 -5
  271. package/dist/app/environments/routing.d.ts +0 -6
  272. package/dist/app/environments/supplied.d.ts +0 -3
  273. package/dist/app/file-selection.d.ts +0 -1
  274. package/dist/app/inspect/artifacts.d.ts +0 -30
  275. package/dist/app/inspect/index.d.ts +0 -112
  276. package/dist/app/lint/index.d.ts +0 -28
  277. package/dist/app/lint/native.d.ts +0 -10
  278. package/dist/app/lint/options.d.ts +0 -66
  279. package/dist/app/lint/policy.d.ts +0 -21
  280. package/dist/app/lint/rules/data.d.ts +0 -3
  281. package/dist/app/lint/rules/engine-imports.d.ts +0 -3
  282. package/dist/app/lint/rules/syntax.d.ts +0 -4
  283. package/dist/app/lint/rules/unit.d.ts +0 -3
  284. package/dist/app/lint/shared.d.ts +0 -34
  285. package/dist/app/package-inspection.d.ts +0 -20
  286. package/dist/app/reports/files.d.ts +0 -13
  287. package/dist/app/reports/prepare.d.ts +0 -20
  288. package/dist/app/reports/publish.d.ts +0 -21
  289. package/dist/app/run/endpoint-readiness.d.ts +0 -43
  290. package/dist/app/run/endpoint-readiness.js +0 -1
  291. package/dist/app/run/engine-evidence-persistence.d.ts +0 -39
  292. package/dist/app/run/engine-execution-cleanup.d.ts +0 -8
  293. package/dist/app/run/engine-execution-cleanup.js +0 -1
  294. package/dist/app/run/engine-execution-failures.d.ts +0 -41
  295. package/dist/app/run/engine-execution-observer.d.ts +0 -21
  296. package/dist/app/run/engine-execution-reporting.d.ts +0 -17
  297. package/dist/app/run/engine-execution.d.ts +0 -65
  298. package/dist/app/run/engine-failure-stack.d.ts +0 -1
  299. package/dist/app/run/engine-orchestration.d.ts +0 -30
  300. package/dist/app/run/environment.d.ts +0 -33
  301. package/dist/app/run/failure-details.d.ts +0 -37
  302. package/dist/app/run/live-run.d.ts +0 -29
  303. package/dist/app/run/operation-progress.d.ts +0 -13
  304. package/dist/app/run/orchestrator.d.ts +0 -75
  305. package/dist/app/run/planning-types.d.ts +0 -68
  306. package/dist/app/run/planning.d.ts +0 -14
  307. package/dist/app/run/request.d.ts +0 -30
  308. package/dist/app/run/results.d.ts +0 -161
  309. package/dist/app/run/run-events.d.ts +0 -144
  310. package/dist/app/run/run-finalization.d.ts +0 -56
  311. package/dist/app/run/run-guards.d.ts +0 -3
  312. package/dist/app/run/runtime-failures.d.ts +0 -18
  313. package/dist/app/run/runtime-fixtures.d.ts +0 -2
  314. package/dist/app/run/runtime-task-types.d.ts +0 -20
  315. package/dist/app/run/scheduler/estimates.d.ts +0 -32
  316. package/dist/app/run/scheduler/identity.d.ts +0 -9
  317. package/dist/app/run/scheduler/index.d.ts +0 -124
  318. package/dist/app/run/scheduler/locks.d.ts +0 -6
  319. package/dist/app/run/scheduler/observations.d.ts +0 -20
  320. package/dist/app/run/selection.d.ts +0 -9
  321. package/dist/app/run/setup/runtime-node-setup-errors.d.ts +0 -13
  322. package/dist/app/run/setup/runtime-node-setup-protocol.d.ts +0 -85
  323. package/dist/app/run/setup/runtime-node-setup-worker.d.ts +0 -1
  324. package/dist/app/run/setup/runtime-node-setup.d.ts +0 -48
  325. package/dist/app/run/task-batches.d.ts +0 -23
  326. package/dist/app/run/task-leases.d.ts +0 -15
  327. package/dist/app/run/worker-loop.d.ts +0 -66
  328. package/dist/app/setup/playwright.d.ts +0 -22
  329. package/dist/app/status/index.d.ts +0 -9
  330. package/dist/app/status/model.d.ts +0 -29
  331. package/dist/app/status/runs.d.ts +0 -99
  332. package/dist/app/stop/index.d.ts +0 -14
  333. package/dist/app/tracker/index.d.ts +0 -13
  334. package/dist/app/tracker/remote.d.ts +0 -13
  335. package/dist/app/tracker/token.d.ts +0 -7
  336. package/dist/app/typecheck/index.d.ts +0 -63
  337. package/dist/cli/command-catalog.d.ts +0 -156
  338. package/dist/cli/command-flags.d.ts +0 -19
  339. package/dist/cli/command-registry.d.ts +0 -3
  340. package/dist/cli/commands/artifacts.d.ts +0 -48
  341. package/dist/cli/commands/bug/file.d.ts +0 -16
  342. package/dist/cli/commands/bug/guide.d.ts +0 -5
  343. package/dist/cli/commands/bug/record.d.ts +0 -9
  344. package/dist/cli/commands/campaign/finish.d.ts +0 -10
  345. package/dist/cli/commands/campaign/start.d.ts +0 -7
  346. package/dist/cli/commands/campaign/status.d.ts +0 -13
  347. package/dist/cli/commands/ci/report.d.ts +0 -15
  348. package/dist/cli/commands/cleanup.d.ts +0 -13
  349. package/dist/cli/commands/db/schema/refresh.d.ts +0 -2
  350. package/dist/cli/commands/db/schema/verify.d.ts +0 -2
  351. package/dist/cli/commands/destroy.d.ts +0 -9
  352. package/dist/cli/commands/discover.d.ts +0 -2
  353. package/dist/cli/commands/doctor.d.ts +0 -2
  354. package/dist/cli/commands/guard/unsafe-entrypoint.d.ts +0 -2
  355. package/dist/cli/commands/lint.d.ts +0 -2
  356. package/dist/cli/commands/report/prepare.d.ts +0 -12
  357. package/dist/cli/commands/report/publish.d.ts +0 -13
  358. package/dist/cli/commands/run/status.d.ts +0 -5
  359. package/dist/cli/commands/run/stop.d.ts +0 -7
  360. package/dist/cli/commands/run.d.ts +0 -9
  361. package/dist/cli/commands/setup/playwright.d.ts +0 -2
  362. package/dist/cli/commands/status.d.ts +0 -5
  363. package/dist/cli/commands/stop.d.ts +0 -12
  364. package/dist/cli/commands/typecheck.d.ts +0 -2
  365. package/dist/cli/commands/workspace.d.ts +0 -2
  366. package/dist/cli/entrypoint.d.ts +0 -1
  367. package/dist/cli/framework/command.d.ts +0 -21
  368. package/dist/cli/framework/definitions.d.ts +0 -100
  369. package/dist/cli/framework/errors.d.ts +0 -6
  370. package/dist/cli/framework/execute.d.ts +0 -14
  371. package/dist/cli/framework/help.d.ts +0 -11
  372. package/dist/cli/framework/index.d.ts +0 -3
  373. package/dist/cli/framework/parser.d.ts +0 -6
  374. package/dist/cli/index.d.ts +0 -4
  375. package/dist/cli/json-errors.d.ts +0 -3
  376. package/dist/cli/operations/db/schema/refresh/operation.d.ts +0 -7
  377. package/dist/cli/operations/db/schema/verify/operation.d.ts +0 -7
  378. package/dist/cli/operations/run/operation.d.ts +0 -26
  379. package/dist/cli/process-signal.d.ts +0 -1
  380. package/dist/cli/renderers/bug/text.d.ts +0 -8
  381. package/dist/cli/renderers/campaign/text.d.ts +0 -2
  382. package/dist/cli/renderers/ci/text.d.ts +0 -2
  383. package/dist/cli/renderers/cleanup/format.d.ts +0 -14
  384. package/dist/cli/renderers/db-schema/text.d.ts +0 -4
  385. package/dist/cli/renderers/destroy/text.d.ts +0 -4
  386. package/dist/cli/renderers/discover/report.d.ts +0 -7
  387. package/dist/cli/renderers/discover/text.d.ts +0 -3
  388. package/dist/cli/renderers/doctor/text.d.ts +0 -2
  389. package/dist/cli/renderers/lint/text.d.ts +0 -2
  390. package/dist/cli/renderers/run/events.d.ts +0 -8
  391. package/dist/cli/renderers/run/failure.d.ts +0 -8
  392. package/dist/cli/renderers/run/formatting.d.ts +0 -79
  393. package/dist/cli/renderers/run/status.d.ts +0 -6
  394. package/dist/cli/renderers/run/text-reporter.d.ts +0 -19
  395. package/dist/cli/renderers/status/text.d.ts +0 -2
  396. package/dist/cli/renderers/stop/text.d.ts +0 -7
  397. package/dist/cli/renderers/typecheck/text.d.ts +0 -2
  398. package/dist/cli/terminal/colors.d.ts +0 -10
  399. package/dist/cli/terminal/layout.d.ts +0 -11
  400. package/dist/cli/version-drift.d.ts +0 -25
  401. package/dist/config/authoring/build-config-contract.d.ts +0 -27
  402. package/dist/config/authoring/configured-step-contract.d.ts +0 -18
  403. package/dist/config/authoring/http-execution-contract.d.ts +0 -70
  404. package/dist/config/authoring/http-methods.d.ts +0 -18
  405. package/dist/config/authoring/index.d.ts +0 -372
  406. package/dist/config/authoring/preset-env.d.ts +0 -19
  407. package/dist/config/authoring/runtime.d.ts +0 -64
  408. package/dist/config/loader/bugs.d.ts +0 -15
  409. package/dist/config/loader/config-loader.d.ts +0 -9
  410. package/dist/config/loader/database-materialization.d.ts +0 -19
  411. package/dist/config/loader/database-roles.d.ts +0 -2
  412. package/dist/config/loader/database.d.ts +0 -55
  413. package/dist/config/loader/decode-discovery.d.ts +0 -5
  414. package/dist/config/loader/decode-execution.d.ts +0 -7
  415. package/dist/config/loader/dependencies.d.ts +0 -7
  416. package/dist/config/loader/discover-tests.d.ts +0 -111
  417. package/dist/config/loader/discovery-summary.d.ts +0 -29
  418. package/dist/config/loader/discovery.d.ts +0 -53
  419. package/dist/config/loader/env.d.ts +0 -4
  420. package/dist/config/loader/execution-model.d.ts +0 -15
  421. package/dist/config/loader/file-metadata.d.ts +0 -19
  422. package/dist/config/loader/groups.d.ts +0 -33
  423. package/dist/config/loader/index.d.ts +0 -10
  424. package/dist/config/loader/load.d.ts +0 -89
  425. package/dist/config/loader/managed-configs.d.ts +0 -23
  426. package/dist/config/loader/path-policy.d.ts +0 -9
  427. package/dist/config/loader/paths.d.ts +0 -5
  428. package/dist/config/loader/runtime-isolation.d.ts +0 -44
  429. package/dist/config/loader/runtime.d.ts +0 -16
  430. package/dist/config/loader/skip-config.d.ts +0 -44
  431. package/dist/config/loader/test-selection.d.ts +0 -15
  432. package/dist/config/loader/validation.d.ts +0 -15
  433. package/dist/config/loader/values.d.ts +0 -3
  434. package/dist/config/loader/values.js +0 -1
  435. package/dist/database/activity-gate.d.ts +0 -22
  436. package/dist/database/admin.d.ts +0 -31
  437. package/dist/database/cleanup.d.ts +0 -36
  438. package/dist/database/configured-steps.d.ts +0 -27
  439. package/dist/database/constants.d.ts +0 -11
  440. package/dist/database/docker-metadata.d.ts +0 -3
  441. package/dist/database/docker.d.ts +0 -65
  442. package/dist/database/drizzle/index.d.ts +0 -13
  443. package/dist/database/fingerprint.d.ts +0 -12
  444. package/dist/database/index.d.ts +0 -39
  445. package/dist/database/lifecycle-cleanup.d.ts +0 -8
  446. package/dist/database/local-postgres.d.ts +0 -71
  447. package/dist/database/naming.d.ts +0 -17
  448. package/dist/database/postgres/index.d.ts +0 -71
  449. package/dist/database/progress.d.ts +0 -6
  450. package/dist/database/roles.d.ts +0 -19
  451. package/dist/database/runtime-config.d.ts +0 -16
  452. package/dist/database/runtime-reservations.d.ts +0 -19
  453. package/dist/database/schema-operations.d.ts +0 -18
  454. package/dist/database/schema-source.d.ts +0 -96
  455. package/dist/database/source-refresh-lock.d.ts +0 -8
  456. package/dist/database/source-url.d.ts +0 -21
  457. package/dist/database/state-files.d.ts +0 -13
  458. package/dist/database/state.d.ts +0 -26
  459. package/dist/database/template-steps.d.ts +0 -39
  460. package/dist/domain/file-timeout.d.ts +0 -25
  461. package/dist/domain/identifiers.d.ts +0 -9
  462. package/dist/domain/operation-display.d.ts +0 -10
  463. package/dist/domain/operation-reason.d.ts +0 -5
  464. package/dist/domain/postgres-route.d.ts +0 -4
  465. package/dist/domain/runtime-identity.d.ts +0 -1
  466. package/dist/domain/runtime-isolation-contract.d.ts +0 -5
  467. package/dist/domain/service-name.d.ts +0 -2
  468. package/dist/domain/suite-selection.d.ts +0 -20
  469. package/dist/domain/test-outcomes.d.ts +0 -2
  470. package/dist/domain/test-types.d.ts +0 -16
  471. package/dist/engines/adapters/evidence-files.d.ts +0 -32
  472. package/dist/engines/adapters/evidence-identity.d.ts +0 -12
  473. package/dist/engines/adapters/execution.d.ts +0 -41
  474. package/dist/engines/adapters/native-report.d.ts +0 -25
  475. package/dist/engines/adapters/node-startup-cache.d.ts +0 -8
  476. package/dist/engines/adapters/workspace.d.ts +0 -4
  477. package/dist/engines/api/capabilities.d.ts +0 -21
  478. package/dist/engines/api/capabilities.js +0 -1
  479. package/dist/engines/api/evidence.d.ts +0 -38
  480. package/dist/engines/api/execution-observer.d.ts +0 -8
  481. package/dist/engines/api/execution-scope.d.ts +0 -17
  482. package/dist/engines/api/execution.d.ts +0 -101
  483. package/dist/engines/api/index.d.ts +0 -5
  484. package/dist/engines/api/k6-runtime-input.d.ts +0 -26
  485. package/dist/engines/api/k6-runtime-input.js +0 -1
  486. package/dist/engines/api/runtime-artifact.d.ts +0 -19
  487. package/dist/engines/bundle-cache.d.ts +0 -32
  488. package/dist/engines/catalog.d.ts +0 -27
  489. package/dist/engines/contracts/fixture-manifest.d.ts +0 -34
  490. package/dist/engines/contracts/json-bounds.d.ts +0 -36
  491. package/dist/engines/contracts/json-bounds.js +0 -2
  492. package/dist/engines/contracts/k6-repository-configuration.d.ts +0 -12
  493. package/dist/engines/contracts/k6-repository-configuration.js +0 -1
  494. package/dist/engines/contracts/test-context.d.ts +0 -15
  495. package/dist/engines/contracts/test-context.js +0 -1
  496. package/dist/engines/definitions.d.ts +0 -23
  497. package/dist/engines/factory.d.ts +0 -6
  498. package/dist/engines/generated-performance.d.ts +0 -1
  499. package/dist/engines/installation-catalog.d.ts +0 -27
  500. package/dist/engines/installation-catalog.js +0 -1
  501. package/dist/engines/installations/k6.d.ts +0 -98
  502. package/dist/engines/installations/k6.js +0 -1
  503. package/dist/engines/installations/node-vitest.d.ts +0 -33
  504. package/dist/engines/installations/package-requirements.d.ts +0 -28
  505. package/dist/engines/installations/package-resolution.d.ts +0 -51
  506. package/dist/engines/installations/playwright-resolution-child.d.ts +0 -1
  507. package/dist/engines/installations/playwright.d.ts +0 -75
  508. package/dist/engines/installations/types.d.ts +0 -10
  509. package/dist/engines/k6/adapter/bundle.d.ts +0 -25
  510. package/dist/engines/k6/adapter/bundle.js +0 -112
  511. package/dist/engines/k6/adapter/evidence.d.ts +0 -15
  512. package/dist/engines/k6/adapter/evidence.js +0 -4
  513. package/dist/engines/k6/adapter/executor.d.ts +0 -13
  514. package/dist/engines/k6/adapter/executor.js +0 -1
  515. package/dist/engines/k6/adapter/index.d.ts +0 -1
  516. package/dist/engines/k6/adapter/index.js +0 -1
  517. package/dist/engines/k6/adapter/input.d.ts +0 -21
  518. package/dist/engines/k6/adapter/input.js +0 -1
  519. package/dist/engines/k6/adapter/native-summary.d.ts +0 -11
  520. package/dist/engines/k6/adapter/native-summary.js +0 -1
  521. package/dist/engines/k6/adapter/repository-configuration.d.ts +0 -2
  522. package/dist/engines/k6/adapter/repository-configuration.js +0 -1
  523. package/dist/engines/k6/authoring-type-paths.d.ts +0 -3
  524. package/dist/engines/k6/authoring-type-paths.js +0 -1
  525. package/dist/engines/k6/runtime/ambient-types/bundle-manifest.json +0 -146
  526. package/dist/engines/k6/runtime/ambient-types/k6/LICENSE +0 -21
  527. package/dist/engines/k6/runtime/ambient-types/k6/browser/index.d.ts +0 -6332
  528. package/dist/engines/k6/runtime/ambient-types/k6/crypto/index.d.ts +0 -218
  529. package/dist/engines/k6/runtime/ambient-types/k6/data/index.d.ts +0 -16
  530. package/dist/engines/k6/runtime/ambient-types/k6/encoding/index.d.ts +0 -46
  531. package/dist/engines/k6/runtime/ambient-types/k6/execution/index.d.ts +0 -127
  532. package/dist/engines/k6/runtime/ambient-types/k6/experimental/csv/index.d.ts +0 -96
  533. package/dist/engines/k6/runtime/ambient-types/k6/experimental/fs/index.d.ts +0 -104
  534. package/dist/engines/k6/runtime/ambient-types/k6/experimental/redis/index.d.ts +0 -821
  535. package/dist/engines/k6/runtime/ambient-types/k6/experimental/streams/index.d.ts +0 -198
  536. package/dist/engines/k6/runtime/ambient-types/k6/global.d.ts +0 -83
  537. package/dist/engines/k6/runtime/ambient-types/k6/html/index.d.ts +0 -1325
  538. package/dist/engines/k6/runtime/ambient-types/k6/http/index.d.ts +0 -806
  539. package/dist/engines/k6/runtime/ambient-types/k6/index.d.ts +0 -126
  540. package/dist/engines/k6/runtime/ambient-types/k6/metrics/index.d.ts +0 -66
  541. package/dist/engines/k6/runtime/ambient-types/k6/net/grpc/index.d.ts +0 -247
  542. package/dist/engines/k6/runtime/ambient-types/k6/options/index.d.ts +0 -459
  543. package/dist/engines/k6/runtime/ambient-types/k6/package.json +0 -79
  544. package/dist/engines/k6/runtime/ambient-types/k6/secrets/index.d.ts +0 -36
  545. package/dist/engines/k6/runtime/ambient-types/k6/timers/index.d.ts +0 -47
  546. package/dist/engines/k6/runtime/ambient-types/k6/websockets/index.d.ts +0 -324
  547. package/dist/engines/k6/runtime/ambient-types/k6/ws/index.d.ts +0 -283
  548. package/dist/engines/k6/runtime/ambient-types/xk6-sql/LICENSE +0 -201
  549. package/dist/engines/k6/runtime/ambient-types/xk6-sql/index.d.ts +0 -397
  550. package/dist/engines/k6/runtime/ambient-types/xk6-sql/package.json +0 -15
  551. package/dist/engines/k6/runtime/artifacts.d.ts +0 -2
  552. package/dist/engines/k6/runtime/artifacts.js +0 -1
  553. package/dist/engines/k6/runtime/checks.d.ts +0 -17
  554. package/dist/engines/k6/runtime/checks.js +0 -1
  555. package/dist/engines/k6/runtime/dal-fixtures.d.ts +0 -24
  556. package/dist/engines/k6/runtime/dal-fixtures.js +0 -1
  557. package/dist/engines/k6/runtime/dal-suite.d.ts +0 -24
  558. package/dist/engines/k6/runtime/dal-suite.js +0 -1
  559. package/dist/engines/k6/runtime/dal.d.ts +0 -10
  560. package/dist/engines/k6/runtime/dal.js +0 -1
  561. package/dist/engines/k6/runtime/fixtures.d.ts +0 -3
  562. package/dist/engines/k6/runtime/fixtures.js +0 -1
  563. package/dist/engines/k6/runtime/http-assertions.d.ts +0 -19
  564. package/dist/engines/k6/runtime/http-assertions.js +0 -1
  565. package/dist/engines/k6/runtime/http-checks.d.ts +0 -19
  566. package/dist/engines/k6/runtime/http-checks.js +0 -1
  567. package/dist/engines/k6/runtime/http-suite-runtime.d.ts +0 -103
  568. package/dist/engines/k6/runtime/http-suite-runtime.js +0 -1
  569. package/dist/engines/k6/runtime/http.d.ts +0 -15
  570. package/dist/engines/k6/runtime/http.js +0 -1
  571. package/dist/engines/k6/runtime/index.d.ts +0 -11
  572. package/dist/engines/k6/runtime/index.js +0 -1
  573. package/dist/engines/k6/runtime/input.d.ts +0 -3
  574. package/dist/engines/k6/runtime/input.js +0 -1
  575. package/dist/engines/k6/runtime/k6-repository-configuration.d.ts +0 -9
  576. package/dist/engines/k6/runtime/k6-repository-configuration.js +0 -1
  577. package/dist/engines/k6/runtime/node-setup.d.ts +0 -13
  578. package/dist/engines/k6/runtime/node-setup.js +0 -1
  579. package/dist/engines/k6/runtime/runtime-globals.d.ts +0 -10
  580. package/dist/engines/k6/runtime/runtime.d.ts +0 -54
  581. package/dist/engines/k6/runtime/runtime.js +0 -1
  582. package/dist/engines/k6/runtime/shared/assertion-details.d.ts +0 -19
  583. package/dist/engines/k6/runtime/shared/assertion-details.js +0 -2
  584. package/dist/engines/k6/runtime/shared/db-normalization.d.ts +0 -19
  585. package/dist/engines/k6/runtime/shared/db-normalization.js +0 -1
  586. package/dist/engines/k6/runtime/shared/error-body.d.ts +0 -3
  587. package/dist/engines/k6/runtime/shared/error-body.js +0 -1
  588. package/dist/engines/k6/runtime/shared/file-data.d.ts +0 -1
  589. package/dist/engines/k6/runtime/shared/file-data.js +0 -1
  590. package/dist/engines/k6/runtime/shared/fixture-engine.d.ts +0 -8
  591. package/dist/engines/k6/runtime/shared/fixture-engine.js +0 -2
  592. package/dist/engines/k6/runtime/shared/http-check-plan.d.ts +0 -29
  593. package/dist/engines/k6/runtime/shared/http-check-plan.js +0 -1
  594. package/dist/engines/k6/runtime/shared/http-parsing.d.ts +0 -10
  595. package/dist/engines/k6/runtime/shared/http-parsing.js +0 -3
  596. package/dist/engines/k6/runtime/shared/ordering.d.ts +0 -2
  597. package/dist/engines/k6/runtime/shared/ordering.js +0 -1
  598. package/dist/engines/k6/runtime/shared/properties.d.ts +0 -1
  599. package/dist/engines/k6/runtime/shared/properties.js +0 -1
  600. package/dist/engines/k6/runtime/suite.d.ts +0 -4
  601. package/dist/engines/k6/runtime/suite.js +0 -1
  602. package/dist/engines/k6/runtime/types.d.ts +0 -244
  603. package/dist/engines/k6/runtime/types.js +0 -1
  604. package/dist/engines/k6/runtime/xk6-sql-driver-postgres.d.ts +0 -7
  605. package/dist/engines/k6/runtime/xk6-sql-driver-postgres.js +0 -1
  606. package/dist/engines/managed-module-resolution-policy-input.d.ts +0 -8
  607. package/dist/engines/managed-module-resolution-policy.d.ts +0 -25
  608. package/dist/engines/managed-module-resolution.d.ts +0 -13
  609. package/dist/engines/manager.d.ts +0 -25
  610. package/dist/engines/node-vitest/adapter/adapter.d.ts +0 -16
  611. package/dist/engines/node-vitest/adapter/consumer-typescript-paths.d.ts +0 -17
  612. package/dist/engines/node-vitest/adapter/consumer-typescript-paths.js +0 -3
  613. package/dist/engines/node-vitest/adapter/evidence.d.ts +0 -33
  614. package/dist/engines/node-vitest/adapter/failure-details.d.ts +0 -3
  615. package/dist/engines/node-vitest/adapter/index.d.ts +0 -1
  616. package/dist/engines/node-vitest/adapter/reporter.d.ts +0 -7
  617. package/dist/engines/node-vitest/adapter/resolution.d.ts +0 -12
  618. package/dist/engines/node-vitest/adapter/resolution.js +0 -1
  619. package/dist/engines/node-vitest/adapter/workspace.d.ts +0 -19
  620. package/dist/engines/node-vitest/runtime/contract/index.d.ts +0 -64
  621. package/dist/engines/node-vitest/runtime/data/http.d.ts +0 -4
  622. package/dist/engines/node-vitest/runtime/data/index.d.ts +0 -8
  623. package/dist/engines/node-vitest/runtime/data/primitives.d.ts +0 -1
  624. package/dist/engines/node-vitest/runtime/data/report.d.ts +0 -3
  625. package/dist/engines/node-vitest/runtime/data/runner.d.ts +0 -4
  626. package/dist/engines/node-vitest/runtime/data/scenario.d.ts +0 -11
  627. package/dist/engines/node-vitest/runtime/data/types.d.ts +0 -384
  628. package/dist/engines/node-vitest/runtime/runtime-input.d.ts +0 -64
  629. package/dist/engines/playwright/adapter/adapter.d.ts +0 -18
  630. package/dist/engines/playwright/adapter/attachments.d.ts +0 -26
  631. package/dist/engines/playwright/adapter/config.d.ts +0 -45
  632. package/dist/engines/playwright/adapter/evidence-validation.d.ts +0 -9
  633. package/dist/engines/playwright/adapter/evidence.d.ts +0 -32
  634. package/dist/engines/playwright/adapter/failure-details.d.ts +0 -2
  635. package/dist/engines/playwright/adapter/index.d.ts +0 -3
  636. package/dist/engines/playwright/adapter/reporter.d.ts +0 -12
  637. package/dist/engines/playwright/runtime/config-file.d.ts +0 -2
  638. package/dist/engines/playwright/runtime/config.d.ts +0 -24
  639. package/dist/engines/playwright/runtime/index.d.ts +0 -4
  640. package/dist/engines/playwright/runtime/runtime-input.d.ts +0 -36
  641. package/dist/engines/playwright/runtime/sandbox.d.ts +0 -84
  642. package/dist/engines/runtime-input-file.d.ts +0 -27
  643. package/dist/environment/lifecycle-artifacts.d.ts +0 -7
  644. package/dist/environment/lifecycle-controller.d.ts +0 -60
  645. package/dist/environment/lifecycle.d.ts +0 -32
  646. package/dist/environment/maintenance.d.ts +0 -68
  647. package/dist/environment/planning-types.d.ts +0 -33
  648. package/dist/environment/ports.d.ts +0 -10
  649. package/dist/environment/ready-environment.d.ts +0 -16
  650. package/dist/environment/run-environment.d.ts +0 -39
  651. package/dist/environment/run-stopping.d.ts +0 -13
  652. package/dist/environment/runtime-contexts.d.ts +0 -37
  653. package/dist/environment/runtime-manager.d.ts +0 -87
  654. package/dist/environment/runtime-planning.d.ts +0 -16
  655. package/dist/environment/runtime-preparation.d.ts +0 -30
  656. package/dist/environment/runtime-service.d.ts +0 -12
  657. package/dist/environment/services.d.ts +0 -56
  658. package/dist/environment/state.d.ts +0 -15
  659. package/dist/environment/status-runtime.d.ts +0 -53
  660. package/dist/environment/template.d.ts +0 -164
  661. package/dist/evidence/artifact-config.d.ts +0 -14
  662. package/dist/evidence/artifact-validation.d.ts +0 -4
  663. package/dist/evidence/artifacts.d.ts +0 -75
  664. package/dist/evidence/bundles.d.ts +0 -27
  665. package/dist/evidence/ci-provenance.d.ts +0 -9
  666. package/dist/evidence/contracts.d.ts +0 -154
  667. package/dist/evidence/environment-record.d.ts +0 -22
  668. package/dist/evidence/file-evidence.d.ts +0 -23
  669. package/dist/evidence/finalization.d.ts +0 -9
  670. package/dist/evidence/index.d.ts +0 -8
  671. package/dist/evidence/logs.d.ts +0 -31
  672. package/dist/evidence/operation-timings.d.ts +0 -60
  673. package/dist/evidence/read-bundle.d.ts +0 -4
  674. package/dist/evidence/read-fields.d.ts +0 -21
  675. package/dist/evidence/read-provenance.d.ts +0 -2
  676. package/dist/evidence/read-redaction.d.ts +0 -2
  677. package/dist/evidence/read-retention.d.ts +0 -2
  678. package/dist/evidence/read-run.d.ts +0 -2
  679. package/dist/evidence/reading.d.ts +0 -28
  680. package/dist/evidence/reporting-types.d.ts +0 -349
  681. package/dist/evidence/reporting.d.ts +0 -3
  682. package/dist/evidence/secure-file-copy.d.ts +0 -24
  683. package/dist/evidence/setup-progress.d.ts +0 -63
  684. package/dist/evidence/step-output.d.ts +0 -16
  685. package/dist/evidence/storage-inventory.d.ts +0 -27
  686. package/dist/evidence/storage.d.ts +0 -25
  687. package/dist/evidence/timing.d.ts +0 -23
  688. package/dist/file.d.ts +0 -11
  689. package/dist/index.d.ts +0 -4
  690. package/dist/kernel/error-serialization.d.ts +0 -40
  691. package/dist/kernel/redaction.d.ts +0 -2
  692. package/dist/kernel/unknown-values.d.ts +0 -11
  693. package/dist/kernel/work-metrics.d.ts +0 -6
  694. package/dist/process/capture-output.d.ts +0 -7
  695. package/dist/process/command-shell.d.ts +0 -1
  696. package/dist/process/environment-overlay.d.ts +0 -17
  697. package/dist/process/environment.d.ts +0 -33
  698. package/dist/process/files/contained-path.d.ts +0 -8
  699. package/dist/process/files/directory-status.d.ts +0 -14
  700. package/dist/process/files/dotenv.d.ts +0 -2
  701. package/dist/process/files/file-snapshot.d.ts +0 -34
  702. package/dist/process/files/json-file.d.ts +0 -11
  703. package/dist/process/files/paths.d.ts +0 -3
  704. package/dist/process/files/product-dir.d.ts +0 -1
  705. package/dist/process/files/temp-dir.d.ts +0 -11
  706. package/dist/process/host/metadata.d.ts +0 -6
  707. package/dist/process/host/platform.d.ts +0 -57
  708. package/dist/process/host-command.d.ts +0 -4
  709. package/dist/process/host-inspection-command.d.ts +0 -13
  710. package/dist/process/host-process.d.ts +0 -19
  711. package/dist/process/index.d.ts +0 -9
  712. package/dist/process/lifecycle-fence.d.ts +0 -10
  713. package/dist/process/locks.d.ts +0 -28
  714. package/dist/process/process-contracts.d.ts +0 -78
  715. package/dist/process/process-group.d.ts +0 -12
  716. package/dist/process/process-identity.d.ts +0 -27
  717. package/dist/process/process-limits.d.ts +0 -6
  718. package/dist/process/process.d.ts +0 -12
  719. package/dist/process/readiness.d.ts +0 -43
  720. package/dist/process/recovery.d.ts +0 -3
  721. package/dist/process/runs/inspection.d.ts +0 -5
  722. package/dist/process/runs/manifest.d.ts +0 -86
  723. package/dist/process/runs/ownership.d.ts +0 -11
  724. package/dist/process/runs/product-state.d.ts +0 -2
  725. package/dist/process/runs/schema.d.ts +0 -3
  726. package/dist/process/runs/stop.d.ts +0 -19
  727. package/dist/process/runtime-socket.d.ts +0 -4
  728. package/dist/process/service-processes.d.ts +0 -13
  729. package/dist/process/shutdown.d.ts +0 -10
  730. package/dist/process/stoppable-settlement.d.ts +0 -26
  731. package/dist/process/url-redaction.d.ts +0 -1
  732. package/dist/process/windows-cli-owner.d.ts +0 -2
  733. package/dist/process/windows-native.d.ts +0 -12
  734. package/dist/process/windows-process-identity.d.ts +0 -4
  735. package/dist/repo/ci-environment.d.ts +0 -7
  736. package/dist/repo/fingerprint-policy.d.ts +0 -13
  737. package/dist/repo/git-path.d.ts +0 -2
  738. package/dist/repo/history.d.ts +0 -17
  739. package/dist/repo/managed-git.d.ts +0 -10
  740. package/dist/repo/metadata.d.ts +0 -3
  741. package/dist/repo/physical-tree.d.ts +0 -37
  742. package/dist/repo/publish-directory.d.ts +0 -20
  743. package/dist/repo/remote.d.ts +0 -6
  744. package/dist/repo/state.d.ts +0 -26
  745. package/dist/repo/tree-listing.d.ts +0 -10
  746. package/dist/steps/build-config.d.ts +0 -34
  747. package/dist/steps/configured-step-testkit-modules.d.ts +0 -19
  748. package/dist/steps/configured-steps.d.ts +0 -51
  749. package/dist/steps/environment.d.ts +0 -82
  750. package/dist/steps/index.d.ts +0 -2
  751. package/dist/steps/module-runner.d.ts +0 -1
  752. package/dist/steps/run.d.ts +0 -36
  753. package/dist/toolchains/archive.d.ts +0 -53
  754. package/dist/toolchains/esbuild.d.ts +0 -9
  755. package/dist/toolchains/host-node-support.d.ts +0 -3
  756. package/dist/toolchains/index.d.ts +0 -114
  757. package/dist/toolchains/managed-node-releases.d.ts +0 -28
  758. package/dist/toolchains/node-cache.d.ts +0 -20
  759. package/dist/toolchains/node-integrity.d.ts +0 -18
  760. package/dist/toolchains/node-provisioning.d.ts +0 -29
  761. package/dist/toolchains/semver.d.ts +0 -13
  762. package/dist/toolchains/shared-operation.d.ts +0 -11
  763. package/dist/toolchains/timeouts.d.ts +0 -1
  764. package/dist/toolchains/vitest/index.d.ts +0 -13
  765. package/dist/tracker/gitea.d.ts +0 -14
  766. package/dist/tracker/github.d.ts +0 -14
  767. package/dist/tracker/http.d.ts +0 -33
  768. package/dist/tracker/index.d.ts +0 -4
  769. package/dist/tracker/redaction.d.ts +0 -4
  770. package/dist/tracker/requests.d.ts +0 -17
  771. package/dist/tracker/responses.d.ts +0 -24
  772. package/dist/tracker/types.d.ts +0 -51
  773. package/docs/engine-architecture.md +0 -682
  774. /package/dist/engines/{k6/runtime/runtime-globals.js → api/profiles.js} +0 -0
@@ -1 +1 @@
1
- export function isUnknownRecord(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}export function asUnknownRecord(n){return isUnknownRecord(n)?n:null}export function optionalString(n){return typeof n=="string"&&n.length>0?n:null}export function displayString(n,r){return optionalString(n)??r}export function isUnknownArray(n){return Array.isArray(n)}export function isPropertyContainer(n){return typeof n=="object"&&n!==null||typeof n=="function"}export function readDynamicProperty(n,r){return isPropertyContainer(n)?Reflect.get(n,r):void 0}export function isNullableString(n){return n===null||typeof n=="string"}
1
+ export function isUnknownRecord(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}export function asUnknownRecord(n){return isUnknownRecord(n)?n:null}export function optionalString(n){return typeof n=="string"&&n.length>0?n:null}export function displayString(n,t){return optionalString(n)??t}export function isNonNullObject(n){return n!==null&&typeof n=="object"}export function normalizeOptionalString(n){if(typeof n!="string")return null;const t=n.trim();return t.length>0?t:null}export function isUnknownArray(n){return Array.isArray(n)}export function isPropertyContainer(n){return typeof n=="object"&&n!==null||typeof n=="function"}export function readDynamicProperty(n,t){return isPropertyContainer(n)?Reflect.get(n,t):void 0}export function isNullableString(n){return n===null||typeof n=="string"}
@@ -1 +1 @@
1
- import c from"node:fs/promises";import A from"node:os";import n from"node:path";import{toError as w}from"../kernel/error-serialization.js";export const ENGINE_PROCESS_RESERVED_ENVIRONMENT_KEYS=Object.freeze(["APPDATA","ComSpec","HOME","LANG","LC_ALL","LOCALAPPDATA","PATH","PATHEXT","SystemRoot","TEMP","TMP","TMPDIR","USERPROFILE","XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME"]);export function nativeTemporaryRoot(t=process.env,o=process.platform){return T(t,o)}export async function createInvocationProcessEnvironment(t,o=process.env,r=process.platform){const e=n.join(t,"tmp");return d(t,e,!0,o,r)}export async function createNativeInvocationProcessEnvironment(t,o={}){const r=o.platform??process.platform,e=o.ambientEnvironment??process.env,s=await v(o.nativeTemporaryRootDirectory??nativeTemporaryRoot(e,r));let a=null;try{const i=await c.mkdtemp(n.join(s,"testkit-engine-"));return a=i,r!=="win32"&&await c.chmod(i,448),a=await P(i,s,r),await d(t,a,!1,e,r)}catch(i){if(a===null)throw i;try{await c.rm(a,{force:!0,recursive:!0})}catch(p){throw new AggregateError([w(i),w(p)],`Could not initialize or remove native invocation temporary directory ${a}`,{cause:p})}throw i}}async function d(t,o,r,e,s){if(!n.isAbsolute(t))throw new Error("Engine invocation directory must be absolute");if(!n.isAbsolute(o))throw new Error("Engine invocation temporary directory must be absolute");const a=n.join(t,"home"),i=n.join(t,"cache"),p=n.join(t,"config"),l=n.join(t,"data"),f=n.join(t,"local-app-data"),E=n.join(t,"app-data");await Promise.all([a,...r?[o]:[],i,p,l,f,E].map(y=>c.mkdir(y,{mode:448})));const m={APPDATA:E,HOME:a,LOCALAPPDATA:f,TEMP:o,TMP:o,TMPDIR:o,USERPROFILE:a,XDG_CACHE_HOME:i,XDG_CONFIG_HOME:p,XDG_DATA_HOME:l};return u(m,e,"LANG"),u(m,e,"LC_ALL"),s==="win32"&&(m.PATH="",u(m,e,"ComSpec"),u(m,e,"SystemRoot")),Object.freeze({environment:Object.freeze(m),homeDirectory:a,temporaryDirectory:o})}async function v(t){if(!n.isAbsolute(t))throw new Error("Native invocation temporary root must be absolute");const o=await c.realpath(t);if(!(await c.stat(o)).isDirectory())throw new Error("Native invocation temporary root must be a directory");return o}async function P(t,o,r){const e=await c.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error("Native invocation temporary directory must be a non-symbolic-link directory");if(r!=="win32"&&(e.mode&63)!==0)throw new Error("Native invocation temporary directory must not grant group or other access");const s=await c.realpath(t);if(n.dirname(s)!==o)throw new Error("Native invocation temporary directory escaped its operating-system root");return s}function T(t,o){if(o!=="win32")return"/tmp";const r=t.TEMP??t.TMP;return r===void 0||r.length===0?A.tmpdir():r}function u(t,o,r){const e=o[r];e!==void 0&&(t[r]=e)}
1
+ import c from"node:fs/promises";import y from"node:os";import a from"node:path";import{toError as w}from"../kernel/error-serialization.js";export const ENGINE_PROCESS_RESERVED_ENVIRONMENT_KEYS=Object.freeze(["APPDATA","ComSpec","HOME","LANG","LC_ALL","LOCALAPPDATA","PATH","PATHEXT","SystemRoot","TEMP","TMP","TMPDIR","USERPROFILE","XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME"]);export async function createInvocationProcessEnvironment(t,o=process.env,r=process.platform){const e=a.join(t,"tmp");return d(t,e,!0,o,r)}export async function createNativeInvocationProcessEnvironment(t,o={}){const r=o.platform??process.platform,e=o.ambientEnvironment??process.env,s=await v(o.nativeTemporaryRootDirectory??T(e,r));let n=null;try{const i=await c.mkdtemp(a.join(s,"testkit-engine-"));return n=i,r!=="win32"&&await c.chmod(i,448),n=await P(i,s,r),await d(t,n,!1,e,r)}catch(i){if(n===null)throw i;try{await c.rm(n,{force:!0,recursive:!0})}catch(p){throw new AggregateError([w(i),w(p)],`Could not initialize or remove native invocation temporary directory ${n}`,{cause:p})}throw i}}async function d(t,o,r,e,s){if(!a.isAbsolute(t))throw new Error("Engine invocation directory must be absolute");if(!a.isAbsolute(o))throw new Error("Engine invocation temporary directory must be absolute");const n=a.join(t,"home"),i=a.join(t,"cache"),p=a.join(t,"config"),l=a.join(t,"data"),E=a.join(t,"local-app-data"),f=a.join(t,"app-data");await Promise.all([n,...r?[o]:[],i,p,l,E,f].map(A=>c.mkdir(A,{mode:448})));const m={APPDATA:f,HOME:n,LOCALAPPDATA:E,TEMP:o,TMP:o,TMPDIR:o,USERPROFILE:n,XDG_CACHE_HOME:i,XDG_CONFIG_HOME:p,XDG_DATA_HOME:l};return u(m,e,"LANG"),u(m,e,"LC_ALL"),s==="win32"&&(m.PATH="",u(m,e,"ComSpec"),u(m,e,"SystemRoot")),Object.freeze({environment:Object.freeze(m),homeDirectory:n,temporaryDirectory:o})}async function v(t){if(!a.isAbsolute(t))throw new Error("Native invocation temporary root must be absolute");const o=await c.realpath(t);if(!(await c.stat(o)).isDirectory())throw new Error("Native invocation temporary root must be a directory");return o}async function P(t,o,r){const e=await c.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error("Native invocation temporary directory must be a non-symbolic-link directory");if(r!=="win32"&&(e.mode&63)!==0)throw new Error("Native invocation temporary directory must not grant group or other access");const s=await c.realpath(t);if(a.dirname(s)!==o)throw new Error("Native invocation temporary directory escaped its operating-system root");return s}function T(t,o){if(o!=="win32")return"/tmp";const r=t.TEMP??t.TMP;return r===void 0||r.length===0?y.tmpdir():r}function u(t,o,r){const e=o[r];e!==void 0&&(t[r]=e)}
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "entrypoint": "dist/process/process.js",
4
- "sourceSha256": "6ad324171090dad3d43ff3b3356edce675b04fe12550b59db3a08f0593e0ebe5",
5
- "bundleSha256": "38b6bf24433229155a2b0b82062feb2d57b5f4d2bc17081167a38e9088707269",
6
- "packageLockSha256": "2197c742d835b790241553916187f6f45f27a14d62f6d793411aa285d4bd9779",
4
+ "sourceSha256": "6607c0273f046a00eb72ed4a0cac0f9b1c54d638be535b11188e1c8e20cdea67",
5
+ "bundleSha256": "6ce5a9db43a95cc11dd3f265a67cbad9bd4c492ea2f33187c6c2474150ce16df",
6
+ "packageLockSha256": "53ab4740dd4220dec486ba6f21059b6307964fea2ef9b1635598b131ef0a10de",
7
7
  "esbuildVersion": "0.28.1",
8
8
  "options": {
9
9
  "format": "esm",
@@ -1 +1 @@
1
- import s from"node:fs";import a from"node:path";import{isPropertyContainer as E}from"../../kernel/unknown-values.js";const y=String;export function readProperty(t,r){return Reflect.get(t,r)}export function serializeJson(t,r){let e;try{e=JSON.stringify(t,null,2)}catch(o){throw new Error(`${r} is not JSON serializable`,{cause:o})}if(typeof e!="string")throw new Error(`${r} is not JSON serializable`);return e}export function errorMessage(t){if(t instanceof Error)return t.message;if(E(t)){const r=readProperty(t,"message");if(typeof r=="string"&&r.length>0)return r}return y(t)}const u=new Set(["EPERM","EACCES","EBUSY"]),l=process.platform==="win32"?100:25,A=10,S=100;class R extends Error{attempts;code="TESTKIT_ATOMIC_WRITE_FAILED";cause;path;tempPath;constructor(r,e,o,n){super(`Failed to atomically replace ${r} after ${o.toString()} attempt${o===1?"":"s"}: ${errorMessage(n)}`,{cause:n}),this.name="AtomicWriteError",this.attempts=o,this.cause=n,this.path=r,this.tempPath=e}}export function writeJsonFileAtomicWithRetry(t,r,e={}){writeTextFileAtomicWithRetry(t,serializeJson(r,`atomic JSON file ${t}`),e)}export function writeTextFileAtomicWithRetry(t,r,e={}){const o=a.dirname(t),n=a.join(o,`.${a.basename(t)}.${process.pid.toString()}.${Date.now().toString()}.${Math.random().toString(16).slice(2)}.tmp`),c=e.attempts??l,f=e.baseDelayMs??A,p=e.maxDelayMs??S;s.writeFileSync(n,r);try{for(let i=1;i<=c;i+=1)try{s.renameSync(n,t);return}catch(m){if(!isRetryableAtomicReplaceError(m)||i>=c||T(t))throw new R(t,n,i,m);_(Math.min(p,f*i))}}finally{s.rmSync(n,{force:!0})}}export function isRetryableAtomicReplaceError(t){if(!E(t))return!1;const r=readProperty(t,"code");return typeof r=="string"&&u.has(r)}function T(t){try{return s.lstatSync(t).isDirectory()}catch{return!1}}function _(t){if(t<=0)return;const r=new SharedArrayBuffer(4);Atomics.wait(new Int32Array(r),0,0,t)}
1
+ import s from"node:fs";import a from"node:path";import{isPropertyContainer as p}from"../../kernel/unknown-values.js";const E=String;export function readProperty(t,r){return Reflect.get(t,r)}export function readJsonFileOrNull(t){try{return JSON.parse(s.readFileSync(t,"utf8"))}catch{return null}}export function serializeJson(t,r){let e;try{e=JSON.stringify(t,null,2)}catch(o){throw new Error(`${r} is not JSON serializable`,{cause:o})}if(typeof e!="string")throw new Error(`${r} is not JSON serializable`);return e}export function errorMessage(t){if(t instanceof Error)return t.message;if(p(t)){const r=readProperty(t,"message");if(typeof r=="string"&&r.length>0)return r}return E(t)}const l=new Set(["EPERM","EACCES","EBUSY"]),y=process.platform==="win32"?100:25,S=10,A=100;class R extends Error{attempts;code="TESTKIT_ATOMIC_WRITE_FAILED";cause;path;tempPath;constructor(r,e,o,n){super(`Failed to atomically replace ${r} after ${o.toString()} attempt${o===1?"":"s"}: ${errorMessage(n)}`,{cause:n}),this.name="AtomicWriteError",this.attempts=o,this.cause=n,this.path=r,this.tempPath=e}}export function writeJsonFileAtomicWithRetry(t,r,e={}){writeTextFileAtomicWithRetry(t,serializeJson(r,`atomic JSON file ${t}`),e)}export function writeTextFileAtomicWithRetry(t,r,e={}){const o=a.dirname(t),n=a.join(o,`.${a.basename(t)}.${process.pid.toString()}.${Date.now().toString()}.${Math.random().toString(16).slice(2)}.tmp`),c=e.attempts??y,f=e.baseDelayMs??S,u=e.maxDelayMs??A;s.writeFileSync(n,r);try{for(let i=1;i<=c;i+=1)try{s.renameSync(n,t);return}catch(m){if(!isRetryableAtomicReplaceError(m)||i>=c||T(t))throw new R(t,n,i,m);_(Math.min(u,f*i))}}finally{s.rmSync(n,{force:!0})}}export function isRetryableAtomicReplaceError(t){if(!p(t))return!1;const r=readProperty(t,"code");return typeof r=="string"&&l.has(r)}function T(t){try{return s.lstatSync(t).isDirectory()}catch{return!1}}function _(t){if(t<=0)return;const r=new SharedArrayBuffer(4);Atomics.wait(new Int32Array(r),0,0,t)}
@@ -1 +1 @@
1
- import u from"node:fs";import a from"node:path";import{isUnknownArray as w,isUnknownRecord as m}from"../../kernel/unknown-values.js";export const SUPPORTED_PLATFORMS=["darwin","linux","win32"],SUPPORTED_ARCHITECTURES=["arm64","x64"],SUPPORTED_PLATFORM_TARGETS=Object.freeze([Object.freeze({arch:"arm64",platform:"darwin"}),Object.freeze({arch:"x64",platform:"darwin"}),Object.freeze({arch:"arm64",platform:"linux"}),Object.freeze({arch:"x64",platform:"linux"}),Object.freeze({arch:"x64",platform:"win32"})]);export class UnsupportedPlatformTargetError extends Error{arch;code="TESTKIT_PLATFORM_TARGET_UNSUPPORTED";platform;constructor(t,e,o="platform target"){super(`${o} does not support ${t}-${e}`),this.name="UnsupportedPlatformTargetError",this.platform=t,this.arch=e}}export function platformTargetKey(r){return`${r.platform}-${r.arch}`}export function currentPlatformTarget(r=process.platform,t=process.arch){if(!isSupportedPlatform(r)||!isSupportedArchitecture(t))throw new UnsupportedPlatformTargetError(r,t);const e={platform:r,arch:t};return assertSupportedPlatformTarget(e,"current platform target"),e}export function currentLinuxLibc(){if(process.platform!=="linux")return null;const r=process.report.getReport(),t=m(r)?r.header:null,e=m(t)?t.glibcVersionRuntime:null;return typeof e=="string"&&e.trim().length>0?"glibc":"musl"}export function assertSupportedPlatformTarget(r,t="platform target"){if(r.platform==="win32"&&r.arch!=="x64")throw new UnsupportedPlatformTargetError(r.platform,r.arch,t)}export function isSupportedPlatform(r){return SUPPORTED_PLATFORMS.includes(r)}export function isSupportedArchitecture(r){return SUPPORTED_ARCHITECTURES.includes(r)}export function isWindows(r=process.platform){return r==="win32"}export function commandName(r,t=process.platform){const e=i(r||"").trim();if(!e)throw new Error("commandName requires a non-empty command name");return!isWindows(t)||/\.(?:cmd|bat|exe)$/i.test(e)?e:`${e}.cmd`}export function executableName(r,t=process.platform){const e=i(r||"").trim();if(!e)throw new Error("executableName requires a non-empty command name");return!isWindows(t)||/\.exe$/i.test(e)?e:`${e}.exe`}export function resolveCommandForSpawn(r,t={}){const e=t.platform||process.platform,o=t.env||process.env,n=i(r||"").trim();if(!n)throw new Error("resolveCommandForSpawn requires a non-empty command name");if(!isWindows(e))return n;if(/[\\/]/u.test(n)||a.win32.isAbsolute(n))return A(n);const s=g(n,o),c=[...i(o.PATH||o.Path||"").split(d(e)).map(l=>l.trim()).filter(Boolean),...t.extraWindowsDirs||[],...E(n,o)];for(const l of c)for(const x of s){const f=a.join(l,`${n}${x}`);if(u.existsSync(f))return f}return commandName(n,e)}export function prepareCommandForSpawn(r,t=[],e={}){const o=e.platform||process.platform,n=e.env||process.env,s=resolveCommandForSpawn(r,{...e,platform:o,env:n}),c=w(t)?t.map(l=>i(l)):[];return!isWindows(o)||!/\.(?:cmd|bat)$/i.test(s)?{command:s,args:c,windowsVerbatimArguments:!1}:{command:n.ComSpec||n.COMSPEC||"cmd.exe",args:["/d","/s","/c",P([s,...c])],windowsVerbatimArguments:!0}}export function packageBinPath(r,t,e=process.platform){const o=a.resolve(r||process.cwd()),n=i(t||"").trim();if(!/^[A-Za-z0-9@._/-]+$/.test(n))throw new Error(`Invalid package bin name: ${i(t)}`);const s=a.basename(n);return a.join(o,"node_modules",".bin",commandName(s,e))}export function shellQuote(r,t=process.platform){const e=i(r);return isWindows(t)?h(e):/^[A-Za-z0-9_/:.,@%+=-]*$/.test(e)?e:`'${e.replaceAll("'","'\\''")}'`}function h(r){return/^[A-Za-z0-9_/:.,@%+=\\-]*$/.test(r)?r:`"${r.replaceAll('"','\\"')}"`}function P(r){const[t,...e]=r;return`"${[p(t,{force:!0}),...e.map(o=>p(o))].join(" ")}"`}function p(r,t={}){const e=i(r);return!t.force&&e.length>0&&!/[\s&()<>^|"]/u.test(e)?e:`"${e.replace(/(\\*)"/gu,'$1$1\\"').replace(/\\+$/u,"$&$&")}"`}export function joinPathList(r,t=process.platform){const e=r.filter(Boolean).map(c=>i(c)),n=T(t)||d(t),s=Reflect.apply(Array.prototype.join,e,[n]);if(typeof s!="string")throw new Error("Path-list construction returned an invalid result");return s}function d(r){return isWindows(r)?";":":"}function g(r,t){if(/\.(?:cmd|bat|exe|com)$/i.test(r))return[""];const e=i(t.PATHEXT||".COM;.EXE;.BAT;.CMD").split(";").map(o=>o.trim().toLowerCase()).filter(Boolean);return[...new Set([".cmd",".exe",".bat",".com",...e])]}function A(r){if(u.existsSync(r)||/\.(?:cmd|bat|exe|com)$/i.test(r))return r;for(const t of[".cmd",".exe",".bat",".com"]){const e=`${r}${t}`;if(u.existsSync(e))return e}return commandName(r)}function E(r,t){return r.toLowerCase()!=="volta"?[]:[t.VOLTA_HOME,t.ProgramFiles?a.join(t.ProgramFiles,"Volta"):null,t["ProgramFiles(x86)"]?a.join(t["ProgramFiles(x86)"],"Volta"):null,t.LOCALAPPDATA?a.join(t.LOCALAPPDATA,"Volta","bin"):null,t.USERPROFILE?a.join(t.USERPROFILE,"AppData","Local","Volta","bin"):null].filter(e=>!!e)}export function dockerHostAddress(r,t=process.platform){const e=i(r||"").trim().toLowerCase();return["win32","darwin"].includes(t)&&(e==="127.0.0.1"||e==="localhost"||e==="::1")?"host.docker.internal":r}export function shouldUseDockerHostNetwork(r=process.platform){return r==="linux"}function i(r){const t=Reflect.apply(String,void 0,[r]);if(typeof t!="string")throw new Error("String conversion returned an invalid result");return t}function T(r){const t=a;if(!m(t))return;const e=t.delimiterForPlatform;if(e!=null){if(typeof e!="function")throw new TypeError("path.delimiterForPlatform is not a function");return Reflect.apply(e,t,[r])}}
1
+ import l from"node:fs";import s from"node:path";import{isUnknownArray as x,isUnknownRecord as u}from"../../kernel/unknown-values.js";export const SUPPORTED_PLATFORMS=["darwin","linux","win32"],SUPPORTED_ARCHITECTURES=["arm64","x64"],SUPPORTED_PLATFORM_TARGETS=Object.freeze([Object.freeze({arch:"arm64",platform:"darwin"}),Object.freeze({arch:"x64",platform:"darwin"}),Object.freeze({arch:"arm64",platform:"linux"}),Object.freeze({arch:"x64",platform:"linux"}),Object.freeze({arch:"x64",platform:"win32"})]);export class UnsupportedPlatformTargetError extends Error{arch;code="TESTKIT_PLATFORM_TARGET_UNSUPPORTED";platform;constructor(t,e,o="platform target"){super(`${o} does not support ${t}-${e}`),this.name="UnsupportedPlatformTargetError",this.platform=t,this.arch=e}}export function platformTargetKey(r){return`${r.platform}-${r.arch}`}export function currentPlatformTarget(r=process.platform,t=process.arch){if(!isSupportedPlatform(r)||!isSupportedArchitecture(t))throw new UnsupportedPlatformTargetError(r,t);const e={platform:r,arch:t};return assertSupportedPlatformTarget(e,"current platform target"),e}export function currentLinuxLibc(){if(process.platform!=="linux")return null;const r=process.report.getReport(),t=u(r)?r.header:null,e=u(t)?t.glibcVersionRuntime:null;return typeof e=="string"&&e.trim().length>0?"glibc":"musl"}export function assertSupportedPlatformTarget(r,t="platform target"){if(r.platform==="win32"&&r.arch!=="x64")throw new UnsupportedPlatformTargetError(r.platform,r.arch,t)}export function isSupportedPlatform(r){return SUPPORTED_PLATFORMS.includes(r)}export function isSupportedArchitecture(r){return SUPPORTED_ARCHITECTURES.includes(r)}export function isWindows(r=process.platform){return r==="win32"}export function commandName(r,t=process.platform){const e=stringifyUnknown(r||"").trim();if(!e)throw new Error("commandName requires a non-empty command name");return!isWindows(t)||/\.(?:cmd|bat|exe)$/i.test(e)?e:`${e}.cmd`}export function executableName(r,t=process.platform){const e=stringifyUnknown(r||"").trim();if(!e)throw new Error("executableName requires a non-empty command name");return!isWindows(t)||/\.exe$/i.test(e)?e:`${e}.exe`}export function resolveCommandForSpawn(r,t={}){const e=t.platform||process.platform,o=t.env||process.env,n=stringifyUnknown(r||"").trim();if(!n)throw new Error("resolveCommandForSpawn requires a non-empty command name");if(!isWindows(e))return n;if(/[\\/]/u.test(n)||s.win32.isAbsolute(n))return g(n);const i=P(n,o),a=[...stringifyUnknown(o.PATH||o.Path||"").split(p(e)).map(c=>c.trim()).filter(Boolean),...A(n,o)];for(const c of a)for(const d of i){const m=s.join(c,`${n}${d}`);if(l.existsSync(m))return m}return commandName(n,e)}export function prepareCommandForSpawn(r,t=[],e={}){const o=e.platform||process.platform,n=e.env||process.env,i=resolveCommandForSpawn(r,{...e,platform:o,env:n}),a=x(t)?t.map(c=>stringifyUnknown(c)):[];return!isWindows(o)||!/\.(?:cmd|bat)$/i.test(i)?{command:i,args:a,windowsVerbatimArguments:!1}:{command:n.ComSpec||n.COMSPEC||"cmd.exe",args:["/d","/s","/c",h([i,...a])],windowsVerbatimArguments:!0}}export function packageBinPath(r,t,e=process.platform){const o=s.resolve(r||process.cwd()),n=stringifyUnknown(t||"").trim();if(!/^[A-Za-z0-9@._/-]+$/.test(n))throw new Error(`Invalid package bin name: ${stringifyUnknown(t)}`);const i=s.basename(n);return s.join(o,"node_modules",".bin",commandName(i,e))}export function shellQuote(r,t=process.platform){const e=stringifyUnknown(r);return isWindows(t)?w(e):/^[A-Za-z0-9_/:.,@%+=-]*$/.test(e)?e:`'${e.replaceAll("'","'\\''")}'`}function w(r){return/^[A-Za-z0-9_/:.,@%+=\\-]*$/.test(r)?r:`"${r.replaceAll('"','\\"')}"`}function h(r){const[t,...e]=r;return`"${[f(t,{force:!0}),...e.map(o=>f(o))].join(" ")}"`}function f(r,t={}){const e=stringifyUnknown(r);return!t.force&&e.length>0&&!/[\s&()<>^|"]/u.test(e)?e:`"${e.replace(/(\\*)"/gu,'$1$1\\"').replace(/\\+$/u,"$&$&")}"`}export function joinPathList(r,t=process.platform){const e=r.filter(Boolean).map(a=>stringifyUnknown(a)),n=E(t)||p(t),i=Reflect.apply(Array.prototype.join,e,[n]);if(typeof i!="string")throw new Error("Path-list construction returned an invalid result");return i}function p(r){return isWindows(r)?";":":"}function P(r,t){if(/\.(?:cmd|bat|exe|com)$/i.test(r))return[""];const e=stringifyUnknown(t.PATHEXT||".COM;.EXE;.BAT;.CMD").split(";").map(o=>o.trim().toLowerCase()).filter(Boolean);return[...new Set([".cmd",".exe",".bat",".com",...e])]}function g(r){if(l.existsSync(r)||/\.(?:cmd|bat|exe|com)$/i.test(r))return r;for(const t of[".cmd",".exe",".bat",".com"]){const e=`${r}${t}`;if(l.existsSync(e))return e}return commandName(r)}function A(r,t){return r.toLowerCase()!=="volta"?[]:[t.VOLTA_HOME,t.ProgramFiles?s.join(t.ProgramFiles,"Volta"):null,t["ProgramFiles(x86)"]?s.join(t["ProgramFiles(x86)"],"Volta"):null,t.LOCALAPPDATA?s.join(t.LOCALAPPDATA,"Volta","bin"):null,t.USERPROFILE?s.join(t.USERPROFILE,"AppData","Local","Volta","bin"):null].filter(e=>!!e)}export function dockerHostAddress(r,t=process.platform){const e=stringifyUnknown(r||"").trim().toLowerCase();return["win32","darwin"].includes(t)&&(e==="127.0.0.1"||e==="localhost"||e==="::1")?"host.docker.internal":r}export function shouldUseDockerHostNetwork(r=process.platform){return r==="linux"}export function stringifyUnknown(r){const t=Reflect.apply(String,void 0,[r]);if(typeof t!="string")throw new Error("String conversion returned an invalid result");return t}function E(r){const t=s;if(!u(t))return;const e=t.delimiterForPlatform;if(e!=null){if(typeof e!="function")throw new TypeError("path.delimiterForPlatform is not a function");return Reflect.apply(e,t,[r])}}
@@ -1 +1 @@
1
- import l from"node:fs";import s from"node:path";import{runManagedProcess as E,startSupervisedProcess as f}from"./process.js";import{hasErrorCode as m}from"../kernel/error-serialization.js";export function runManagedHostProcess(e){const r=p(e);return E(r)}export function startManagedHostProcess(e){const r=p(e);return e.recoveryIdentity==="none"?f({...r,outputMode:e.outputMode,recoveryIdentity:"none"}):f({...r,outputMode:e.outputMode})}export function managedHostProcessInfrastructureError(e,r){const o=[];if(r.terminationError&&o.push(`process-scope termination was incomplete: ${r.terminationError.message}`),r.error&&o.push(`could not execute: ${r.error.message}`),r.timedOut&&o.push("exceeded its managed deadline"),r.cancelled&&o.push("was cancelled"),r.outputLimitExceeded&&o.push("exceeded the managed stdout/stderr capture limit"),o.length===0)return null;const n=new Error(`${e} ${o.join("; ")}`);return Object.defineProperty(n,"result",{enumerable:!1,value:Object.freeze({...r})}),n}export function normalizeManagedHostEnvironment(e=process.env,r=process.platform){const o=Object.entries(e).filter(t=>typeof t[1]=="string");if(r!=="win32")return Object.fromEntries(o);const n=new Map;for(const[t,a]of o){const c=t.toLowerCase();n.set(c,{key:y(c,t),value:a})}return Object.fromEntries([...n.entries()].sort(([t],[a])=>t.localeCompare(a)).map(([,t])=>[t.key,t.value]))}export function resolveManagedHostExecutable(e,r,o,n=process.platform){const t=resolveManagedHostExecutableIfAvailable(e,r,o,n);if(t)return t;throw o.PATH?new Error(`Could not resolve managed host executable ${JSON.stringify(e)}`):new Error(`Could not resolve managed host executable ${JSON.stringify(e)} because PATH is unavailable`)}export function resolveManagedHostExecutableIfAvailable(e,r,o,n=process.platform){if(e.trim().length===0)throw new Error("Managed host process executable must be non-empty");if(!s.isAbsolute(r))throw new Error("Managed host process working directory must be absolute");if(s.isAbsolute(e))return w(e,n);if(e.includes("/")||e.includes("\\"))throw new Error(`Managed host process executable paths must be absolute, got ${JSON.stringify(e)}`);const t=o.PATH;if(!t)return null;const a=b(e,o,n),c=n==="win32"?";":":";for(const u of t.split(c)){if(u.length===0)continue;const g=s.isAbsolute(u)?u:s.resolve(r,u);for(const h of a){const d=s.join(g,`${e}${h}`);try{const i=l.statSync(d,{throwIfNoEntry:!1});if(i!==void 0&&i.isFile()&&(n==="win32"||(i.mode&73)!==0))return w(d,n)}catch(i){if(!m(i,"ENOENT")&&!m(i,"ENOTDIR"))throw i}}}return null}function p(e){const r=s.resolve(e.cwd),o=normalizeManagedHostEnvironment(e.env);return{args:e.args,cwd:r,displayLabel:e.displayLabel,env:o,executable:resolveManagedHostExecutable(e.executable,r,o),signal:e.signal??new AbortController().signal,timeoutMs:e.timeoutMs,windowsVerbatimArguments:e.windowsVerbatimArguments}}function b(e,r,o){return o!=="win32"?[""]:s.extname(e).length>0?[""]:(r.PATHEXT||".COM;.EXE").split(";").map(t=>t.trim()).filter(t=>[".com",".exe"].includes(t.toLowerCase()))}function w(e,r){if(r==="win32"&&[".bat",".cmd"].includes(s.extname(e).toLowerCase()))throw new Error(`Windows batch wrappers are not managed host executables: ${e}`);const o=l.statSync(e);if(!o.isFile())throw new Error(`Managed host executable is not a regular file: ${e}`);if(r!=="win32"&&(o.mode&73)===0)throw new Error(`Managed host executable is not executable: ${e}`);return e}function y(e,r){return e==="path"?"PATH":e==="pathext"?"PATHEXT":e==="comspec"?"ComSpec":r}
1
+ import f from"node:fs";import s from"node:path";import{runManagedProcess as E,startSupervisedProcess as l}from"./process.js";import{hasErrorCode as m}from"../kernel/error-serialization.js";export function runManagedHostProcess(e){const t=p(e);return E(t)}export function startManagedHostProcess(e){const t=p(e);return e.recoveryIdentity==="none"?l({...t,outputMode:e.outputMode,recoveryIdentity:"none"}):l({...t,outputMode:e.outputMode})}export function managedHostProcessInfrastructureError(e,t){const r=[];if(t.terminationError&&r.push(`process-scope termination was incomplete: ${t.terminationError.message}`),t.error&&r.push(`could not execute: ${t.error.message}`),t.timedOut&&r.push("exceeded its managed deadline"),t.cancelled&&r.push("was cancelled"),t.outputLimitExceeded&&r.push("exceeded the managed stdout/stderr capture limit"),r.length===0)return null;const n=new Error(`${e} ${r.join("; ")}`);return Object.defineProperty(n,"result",{enumerable:!1,value:Object.freeze({...t})}),n}export function normalizeManagedHostEnvironment(e=process.env,t=process.platform){const r=Object.entries(e).filter(o=>typeof o[1]=="string");if(t!=="win32")return Object.fromEntries(r);const n=new Map;for(const[o,a]of r){const c=o.toLowerCase();n.set(c,{key:y(c,o),value:a})}return Object.fromEntries([...n.entries()].sort(([o],[a])=>o.localeCompare(a)).map(([,o])=>[o.key,o.value]))}export function resolveManagedHostExecutable(e,t,r,n=process.platform){const o=resolveManagedHostExecutableIfAvailable(e,t,r,n);if(o)return o;throw r.PATH?new Error(`Could not resolve managed host executable ${JSON.stringify(e)}`):new Error(`Could not resolve managed host executable ${JSON.stringify(e)} because PATH is unavailable`)}export function resolveManagedHostExecutableIfAvailable(e,t,r,n=process.platform){if(e.trim().length===0)throw new Error("Managed host process executable must be non-empty");if(!s.isAbsolute(t))throw new Error("Managed host process working directory must be absolute");if(s.isAbsolute(e))return w(e,n);if(e.includes("/")||e.includes("\\"))throw new Error(`Managed host process executable paths must be absolute, got ${JSON.stringify(e)}`);const o=r.PATH;if(!o)return null;const a=b(e,r,n),c=n==="win32"?";":":";for(const u of o.split(c)){if(u.length===0)continue;const h=s.isAbsolute(u)?u:s.resolve(t,u);for(const g of a){const d=s.join(h,`${e}${g}`);try{const i=f.statSync(d,{throwIfNoEntry:!1});if(i!==void 0&&i.isFile()&&(n==="win32"||(i.mode&73)!==0))return w(d,n)}catch(i){if(!m(i,"ENOENT")&&!m(i,"ENOTDIR"))throw i}}}return null}function p(e){const t=s.resolve(e.cwd),r=normalizeManagedHostEnvironment(e.env);return{args:e.args,cwd:t,displayLabel:e.displayLabel,env:r,executable:resolveManagedHostExecutable(e.executable,t,r),signal:e.signal??new AbortController().signal,timeoutMs:e.timeoutMs,...e.timeoutStartsWhenReady===void 0?{}:{timeoutStartsWhenReady:e.timeoutStartsWhenReady},windowsVerbatimArguments:e.windowsVerbatimArguments}}function b(e,t,r){return r!=="win32"?[""]:s.extname(e).length>0?[""]:(t.PATHEXT||".COM;.EXE").split(";").map(o=>o.trim()).filter(o=>[".com",".exe"].includes(o.toLowerCase()))}function w(e,t){if(t==="win32"&&[".bat",".cmd"].includes(s.extname(e).toLowerCase()))throw new Error(`Windows batch wrappers are not managed host executables: ${e}`);const r=f.statSync(e);if(!r.isFile())throw new Error(`Managed host executable is not a regular file: ${e}`);if(t!=="win32"&&(r.mode&73)===0)throw new Error(`Managed host executable is not executable: ${e}`);return e}function y(e,t){return e==="path"?"PATH":e==="pathext"?"PATHEXT":e==="comspec"?"ComSpec":t}
@@ -1 +1 @@
1
- export{runManagedProcess,ProcessExitedBeforeReadyError,startSupervisedProcess,terminateAttributedProcessLineage,terminateOwnedPosixProcessGroup}from"./process.js";export{managedHostProcessInfrastructureError,normalizeManagedHostEnvironment,resolveManagedHostExecutable,resolveManagedHostExecutableIfAvailable,runManagedHostProcess,startManagedHostProcess}from"./host-process.js";export{requireManagedHostCommandSuccess,runManagedHostCommand}from"./host-command.js";export{resolvePosixCommandShell}from"./command-shell.js";export{captureOutput}from"./capture-output.js";export{captureProcessCreationIdentity,observeProcessCreationIdentity,processCreationIdentityMatches}from"./process-identity.js";export{createInvocationProcessEnvironment,createNativeInvocationProcessEnvironment,ENGINE_PROCESS_RESERVED_ENVIRONMENT_KEYS}from"./environment.js";export{installManagedProcessEnvironmentOverlay,managedProcessEnvironmentOverlayInstallerSource,MANAGED_PROCESS_ENVIRONMENT_OVERLAY_STATE_SYMBOL}from"./environment-overlay.js";export{DEFAULT_SHUTDOWN_TIMEOUT_MS}from"./shutdown.js";
1
+ export{runManagedProcess,ProcessExitedBeforeReadyError,startSupervisedProcess,terminateAttributedProcessLineage,terminateOwnedPosixProcessGroup}from"./process.js";export{managedHostProcessInfrastructureError,normalizeManagedHostEnvironment,resolveManagedHostExecutable,resolveManagedHostExecutableIfAvailable,runManagedHostProcess,startManagedHostProcess}from"./host-process.js";export{requireManagedHostCommandSuccess,runManagedHostCommand}from"./host-command.js";export{resolvePosixCommandShell}from"./command-shell.js";export{captureOutput}from"./capture-output.js";export{captureProcessCreationIdentity,observeProcessCreationIdentity,processCreationIdentityMatches}from"./process-identity.js";export{createInvocationProcessEnvironment,createNativeInvocationProcessEnvironment,ENGINE_PROCESS_RESERVED_ENVIRONMENT_KEYS}from"./environment.js";export{installManagedProcessEnvironmentOverlay,managedProcessEnvironmentOverlayInstallerSource,MANAGED_PROCESS_ENVIRONMENT_OVERLAY_STATE_SYMBOL}from"./environment-overlay.js";export{DEFAULT_SHUTDOWN_TIMEOUT_MS}from"./shutdown.js";export{startReadyDeadline}from"./ready-deadline.js";
@@ -1,4 +1,4 @@
1
- import{AsyncLocalStorage as te}from"node:async_hooks";import{randomUUID as re}from"node:crypto";import i from"node:fs";import ne from"node:os";import a from"node:path";import{setTimeout as oe}from"node:timers/promises";import{captureProcessCreationIdentity as F}from"./process-identity.js";import{channel as se}from"node:diagnostics_channel";const x=se("testkit.work");import{isUnknownRecord as j}from"../kernel/unknown-values.js";import{hasErrorCode as c}from"../kernel/error-serialization.js";function ie(e){try{i.mkdirSync(e,{mode:448})}catch(t){if(!c(t,"EEXIST"))throw t}return U(e)}function ce(e){try{const t=i.lstatSync(e);return t.isDirectory()&&!t.isSymbolicLink()?"real":"unsafe"}catch(t){if(c(t,"ENOENT"))return"absent";throw t}}function K(e){const t=i.lstatSync(e,{bigint:!0});if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Process lock path is not a real directory: ${e}`);return{birthtimeNs:t.birthtimeNs,dev:t.dev,ino:t.ino}}function U(e){try{return K(e)}catch(t){if(c(t,"ENOENT")||ue(t))return null;throw t}}function h(e,t){const n=U(e);return n!==null&&n.birthtimeNs===t.birthtimeNs&&n.dev===t.dev&&n.ino===t.ino}function ae(e,t,n){return h(e,t)?v(n)?"unsafe":"retry":h(n,t)?"published":"unsafe"}function ue(e){return e instanceof Error&&e.message.startsWith("Process lock path is not a real directory:")}const V="owner.json",A=1,T="claim-",M="choosing",W="ticket",le=100,q=65e3,fe=100,me=new Set(["EACCES","EBUSY","EPERM"]),de=5e3,Y=ne.hostname(),he=process.platform==="win32"?de:0,O=new te;class H extends Error{constructor(t,n){super(`Timed out waiting for process lock ${a.basename(t)}${Fe(n)}`),this.name="ProcessLockTimeoutError"}}export async function withProcessLock(e,t,n={}){const r=J(e);_e(r);const o=await ye(r,n),s=O.getStore(),u=new Set(s??[]);u.add(r);try{return await O.run(u,t)}finally{o()}}export async function tryWithProcessLock(e,t,n={}){let r;try{r=await withProcessLock(e,async()=>{try{return{ok:!0,value:await t()}}catch(o){return{error:o,ok:!1}}},{...n,timeoutMs:0})}catch(o){if(o instanceof H)return{acquired:!1};throw o}if(!r.ok)throw r.error;return{acquired:!0,value:r.value}}export function probeProcessLock(e,t={}){const n=J(e),r=G(n);if(!v(r))return"absent";const o=t.identityObservations??new Map,s=R(r,o,t);return s.rootAvailable&&s.claims.length===0?(_(r),"absent"):"active"}async function ye(e,t){const n=xe(t.timeoutMs,null,"process lock timeout"),r=je(t.retryIntervalMs,le,"process lock retry interval");let o=t.retryIntervalMs===void 0?10:r;async function s(){const b=o;o=Math.min(r,o*2),await $e(b,t.signal,e)}const u=t.identityObservations??new Map,f=F(process.pid);if(f===null)throw new Error(`Cannot acquire process lock ${e}: current process creation identity is unavailable`);const E=Date.now(),y={createdAt:new Date(E).toISOString(),hostname:Y,pid:process.pid,processIdentity:f,schemaVersion:A,token:re()},m=G(e),l=a.join(m,`${T}${y.token}`),k=`${m}.preparing-${y.token}`;we(k,y);let w=null,$=!1,S=null,I=!1,D=0;try{for(w=K(k);;){L(t.signal,e);const p=ie(m);if(p!==null){try{i.renameSync(k,l),I=!0,S=p}catch(d){if(!c(d,"ENOENT"))if(Ee(d)){const N=ae(k,w,l);if(N==="published")I=!0,S=p;else if(N==="retry"&&D<fe)D+=1;else throw d}else throw d}if(I){if(!h(m,p))throw new Error(`Process lock directory changed during claim publication: ${m}`);if(!h(l,w))throw new Error(`Process lock claim changed during publication: ${l}`);break}}else R(m,u,t);Q(e,null,E,n),await s()}if(S===null)throw new Error(`Process lock claim was published without its directory identity: ${l}`);const b=S,Z=R(m,u,t,b),g=ke(Z.claims);for(pe(l,g);;){L(t.signal,e);const p=R(m,u,t,b),d=p.claims.find(ee=>ee.claimDirectory===l);if(d?.state!=="ready"||d.ticket!==g||d.ownerRecord===null||!X(d.ownerRecord,y))throw new Error(`Process lock claim disappeared or changed before acquisition: ${l}`);const N=Se(p.claims,d);if(N===null)return $=!0,()=>{ge(l,m,b,y,g)};Q(e,N.ownerRecord,E,n),await s()}}finally{I?!$&&S!==null&&w!==null&&h(m,S)&&h(l,w)&&(i.rmSync(l,{force:!0,recursive:!0}),u.delete(l),_(m)):w!==null&&h(k,w)&&i.rmSync(k,{force:!0,recursive:!0})}}function Ee(e){return process.platform==="win32"&&j(e)&&typeof e.code=="string"&&me.has(e.code)}function we(e,t){i.mkdirSync(e,{mode:448});try{i.writeFileSync(a.join(e,V),`${JSON.stringify(t)}
2
- `,{encoding:"utf8",flag:"wx",mode:384}),i.writeFileSync(a.join(e,M),`${t.token}
3
- `,{encoding:"utf8",flag:"wx",mode:384})}catch(n){throw i.rmSync(e,{force:!0,recursive:!0}),n}}function pe(e,t){i.writeFileSync(a.join(e,W),`${t.toString()}
4
- `,{encoding:"utf8",flag:"wx",mode:384}),i.rmSync(a.join(e,M))}function ke(e){const t=e.reduce((n,r)=>r.ticket===null?n:Math.max(n,r.ticket),0);if(t>=Number.MAX_SAFE_INTEGER)throw new Error("Process lock ticket space is exhausted");return t+1}function Se(e,t){if(t.ticket===null||t.ownerRecord===null)return t;const n=t.ownerRecord.token;for(const r of e){if(r.claimDirectory===t.claimDirectory)continue;if(r.state!=="ready"||r.ticket===null||r.ownerRecord===null)return r;const o=r.ownerRecord.token;if(be(r.ticket,o,t.ticket,n)<0)return r}return null}function be(e,t,n,r){return e===n?t.localeCompare(r):e-n}function R(e,t,n,r=null){const o=ce(e);if(o==="absent")return{claims:[],rootAvailable:!0};if(o==="unsafe"){const f=P(e);return Le(e,t,n)?{claims:[],rootAvailable:!0}:{claims:[f],rootAvailable:!1}}if(r!==null&&!h(e,r))return{claims:[P(e)],rootAvailable:!1};let s;try{s=i.readdirSync(e,{withFileTypes:!0})}catch(f){if(c(f,"ENOENT"))return{claims:[],rootAvailable:!0};throw f}const u=[];for(const f of s){const E=a.join(e,f.name),y=!f.name.startsWith(T)||!f.isDirectory()?P(E):z(E);Ie(y,t,n)?Re(E,t):u.push(y)}return{claims:u,rootAvailable:!0}}function P(e){return{claimDirectory:e,ownerRecord:null,state:"malformed",ticket:null}}function z(e){const t=Me(e),n=v(a.join(e,M)),r=Ne(e),o=a.basename(e).slice(T.length),s=t===null||t.token===o;return{claimDirectory:e,ownerRecord:t,state:t===null||!s?"malformed":n?"choosing":r===null?"malformed":"ready",ticket:r}}function Ne(e){try{const t=i.readFileSync(a.join(e,W),"utf8").trim(),n=Number(t);return Number.isSafeInteger(n)&&n>0?n:null}catch{return null}}function Ie(e,t,n){const r=e.ownerRecord;if(r===null||r.hostname!==Y)return n.hostScope==="current-host"&&Ce(e.claimDirectory)>=q;if(ve(r.pid)==="absent")return!0;const o=C(r),s=t.get(e.claimDirectory);if(s?.ownerKey===o&&Date.now()-s.checkedAtMs<he)return!1;const u=F(r.pid);return t.set(e.claimDirectory,{checkedAtMs:Date.now(),ownerKey:o}),u!==null&&u!==r.processIdentity}function Re(e,t){t.delete(e),i.rmSync(e,{force:!0,recursive:!0})}function Le(e,t,n){if(n.hostScope!=="current-host")return!1;const r=B(e);if(r==="absent")return!0;if(r==="real-directory"||Te(r)<q)return!1;const o=B(e);if(o==="absent")return!0;if(o==="real-directory"||!Ae(o,r))return!1;try{return i.unlinkSync(e),t.delete(e),!0}catch(s){if(c(s,"ENOENT"))return!0;if(c(s,"EISDIR")||c(s,"EPERM"))return!1;throw s}}function ge(e,t,n,r,o){if(!h(t,n))throw new Error(`Process lock directory changed before release: ${t}`);const s=z(e);if(s.state!=="ready"||s.ticket!==o||s.ownerRecord===null||!X(s.ownerRecord,r))throw new Error(`Process lock ownership changed before release: ${e}`);i.rmSync(e,{force:!0,recursive:!0}),_(t)}function B(e){try{const t=i.lstatSync(e,{bigint:!0});return t.isDirectory()&&!t.isSymbolicLink()?"real-directory":{birthtimeNs:t.birthtimeNs,ctimeNs:t.ctimeNs,dev:t.dev,ino:t.ino,mode:t.mode,mtimeNs:t.mtimeNs,size:t.size}}catch(t){if(c(t,"ENOENT"))return"absent";throw t}}function Ae(e,t){return e.birthtimeNs===t.birthtimeNs&&e.ctimeNs===t.ctimeNs&&e.dev===t.dev&&e.ino===t.ino&&e.mode===t.mode&&e.mtimeNs===t.mtimeNs&&e.size===t.size}function Te(e){return Math.max(0,Date.now()-Number(e.mtimeNs)/1e6)}function _(e){try{i.rmdirSync(e)}catch(t){if(!c(t,"ENOENT")&&!c(t,"ENOTEMPTY")&&!c(t,"EEXIST"))throw t}}function Me(e){let t;try{t=JSON.parse(i.readFileSync(a.join(e,V),"utf8"))}catch{return null}return j(t)?Oe(t):null}function Oe(e){const t=Object.keys(e).sort(),n=["createdAt","hostname","pid","processIdentity","schemaVersion","token"];return t.length!==n.length||t.some((r,o)=>r!==n[o])||e.schemaVersion!==A||!Ke(e.createdAt)||typeof e.hostname!="string"||e.hostname.length===0||!Ue(e.pid)||typeof e.processIdentity!="string"||e.processIdentity.length===0||typeof e.token!="string"||e.token.length===0?null:{createdAt:e.createdAt,hostname:e.hostname,pid:e.pid,processIdentity:e.processIdentity,schemaVersion:A,token:e.token}}function X(e,t){return C(e)===C(t)}function C(e){return[e.hostname,e.pid.toString(),e.processIdentity,e.token,e.createdAt].join("\0")}function G(e){return`${e}.dir`}function J(e){const t=a.resolve(Pe(e)),n=i.realpathSync.native(a.dirname(t));return a.join(n,a.basename(t))}function Pe(e){if(e.trim().length===0)throw new Error("Process lock path must not be empty");return e}function _e(e){if(O.getStore()?.has(e))throw new Error(`Reentrant process lock acquisition is not allowed: ${e}`)}function Q(e,t,n,r){if(r!==null&&Date.now()-n>=r)throw new H(e,t)}function Ce(e){try{return Math.max(0,Date.now()-i.lstatSync(e).mtimeMs)}catch(t){if(c(t,"ENOENT"))return Number.POSITIVE_INFINITY;throw t}}function ve(e){try{return process.kill(e,0),"alive"}catch(t){return c(t,"ESRCH")?"absent":c(t,"EPERM")?"alive":"unknown"}}async function $e(e,t,n){L(t,n),x.hasSubscribers&&x.publish({metric:"locks.contentionRetries",amount:1});try{await oe(e,void 0,{signal:t})}catch(r){throw L(t,n),r}}function L(e,t){if(e?.aborted)throw De(e,t)}function De(e,t){return e.reason instanceof Error?e.reason:new Error(`Waiting for process lock was aborted: ${t}`)}function Fe(e){return e===null?"":` (host=${e.hostname} pid=${e.pid.toString()} identity=${e.processIdentity} createdAt=${e.createdAt})`}function xe(e,t,n){const r=e===void 0?t:e;if(r!==null&&(!Number.isSafeInteger(r)||r<0))throw new Error(`${n} must be null or a non-negative safe integer`);return r}function je(e,t,n){const r=e??t;if(!Number.isSafeInteger(r)||r<=0)throw new Error(`${n} must be a positive safe integer`);return r}function Ke(e){return typeof e=="string"&&e.length>0&&Number.isFinite(Date.parse(e))}function Ue(e){return Number.isSafeInteger(e)&&Number(e)>0}function v(e){try{return i.lstatSync(e),!0}catch(t){if(c(t,"ENOENT"))return!1;throw t}}
1
+ import{AsyncLocalStorage as we}from"node:async_hooks";import{randomUUID as P}from"node:crypto";import i from"node:fs";import Ee from"node:os";import u from"node:path";import{setTimeout as q}from"node:timers/promises";import{captureProcessCreationIdentity as Y,inspectProcessLiveness as pe}from"./process-identity.js";import{retireWindowsClaim as ke}from"./windows-native.js";import{channel as Se}from"node:diagnostics_channel";const I=Se("testkit.work");import{isUnknownRecord as H}from"../kernel/unknown-values.js";import{hasErrorCode as a}from"../kernel/error-serialization.js";function Ne(e){try{i.mkdirSync(e,{mode:448})}catch(t){if(!a(t,"EEXIST"))throw t}return B(e)}function be(e){try{const t=i.lstatSync(e);return t.isDirectory()&&!t.isSymbolicLink()?"real":"unsafe"}catch(t){if(a(t,"ENOENT"))return"absent";throw t}}function X(e){const t=i.lstatSync(e,{bigint:!0});if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Process lock path is not a real directory: ${e}`);return{birthtimeNs:t.birthtimeNs,dev:t.dev,ino:t.ino}}function B(e){try{return X(e)}catch(t){if(a(t,"ENOENT")||Ie(t))return null;throw t}}function y(e,t){return G(B(e),t)}function G(e,t){return e!==null&&e.birthtimeNs===t.birthtimeNs&&e.dev===t.dev&&e.ino===t.ino}export function processLockClaimPublicationState(e,t,r){if(y(e,t))try{return K(r)?"unsafe":"retry"}catch(o){if(C(o))return"retry";throw o}return y(r,t)?"published":"unsafe"}function Ie(e){return e instanceof Error&&e.message.startsWith("Process lock path is not a real directory:")}const J="owner.json",v=1,$="claim-",D="choosing",z="ticket",Q=100,Z=65e3,Re=100,Le=new Set(["EACCES","EBUSY","EPERM"]),Te=1e4,_e=3,ge=20,Ae=5,Me=20,Ce=5e3,ee=Ee.hostname(),Oe=process.platform==="win32"?Ce:0,x=new we;class te extends Error{constructor(t,r){super(`Timed out waiting for process lock ${u.basename(t)}${Qe(r)}`),this.name="ProcessLockTimeoutError"}}export async function withProcessLock(e,t,r={}){const n=he(e);Ge(n);const o=await Pe(n,r),s=x.getStore(),c=new Set(s??[]);c.add(n);try{return await x.run(c,t)}finally{await o()}}export async function tryWithProcessLock(e,t,r={}){let n;try{n=await withProcessLock(e,async()=>{try{return{ok:!0,value:await t()}}catch(o){return{error:o,ok:!1}}},{...r,timeoutMs:0})}catch(o){if(o instanceof te)return{acquired:!1};throw o}if(!n.ok)throw n.error;return{acquired:!0,value:n.value}}export function probeProcessLock(e,t={}){const r=he(e),n=me(r);if(!K(n))return"absent";const o=t.identityObservations??new Map,s=oe(n,ne(n),o,re(),t);return s.rootAvailable&&s.claims.length===0?(j(n),"absent"):"active"}async function Pe(e,t){const r=Ze(t.timeoutMs,null,"process lock timeout"),n=et(t.retryIntervalMs,Q,"process lock retry interval");let o=t.retryIntervalMs===void 0?10:n;async function s(){const h=o;o=Math.min(n,o*2),await Je(h,t.signal,e)}const c=t.identityObservations??new Map,E=re(),l=async h=>oe(m,await _(()=>ne(m,h),t.signal,e),c,E,t),w=Y(process.pid);if(w===null)throw new Error(`Cannot acquire process lock ${e}: current process creation identity is unavailable`);const p=Date.now(),R={createdAt:new Date(p).toISOString(),hostname:ee,pid:process.pid,processIdentity:w,schemaVersion:v,token:P()},m=me(e),f=u.join(m,`${$}${R.token}`),N=`${m}.preparing-${R.token}`;ve(N,R);let k=null,U=!1,b=null,A=!1,V=0;try{for(k=X(N);;){g(t.signal,e);const S=await _(()=>Ne(m),t.signal,e);if(S!==null){try{i.renameSync(N,f),A=!0,b=S}catch(d){if(!a(d,"ENOENT"))if(C(d)){const T=processLockClaimPublicationState(N,k,f);if(T==="published")A=!0,b=S;else if(T==="retry"&&V<Re)V+=1;else throw d}else throw d}if(A){if(!y(m,S))throw new Error(`Process lock directory changed during claim publication: ${m}`);if(!y(f,k))throw new Error(`Process lock claim changed during publication: ${f}`);break}}else await l(null);O(e,null,p,r),await s()}if(b===null)throw new Error(`Process lock claim was published without its directory identity: ${f}`);const h=b;let L=nextProcessLockTicket((await l(h)).claims);for(;L===null;)O(e,null,p,r),await s(),L=nextProcessLockTicket((await l(h)).claims);const M=L;for($e(f,M);;){g(t.signal,e);const S=await l(h),d=S.claims.find(ye=>ye.claimDirectory===f);if(d?.state==="changing"){O(e,null,p,r),await s();continue}if(d?.state!=="ready"||d.ticket!==M||d.ownerRecord===null||!de(d.ownerRecord,R))throw new Error(`Process lock claim disappeared or changed before acquisition: ${f}`);const T=firstElectionBlocker(S.claims,d);if(T===null)return U=!0,()=>Ve(f,m,h,R,M);O(e,T.ownerRecord,p,r),await s()}}finally{if(!A)k!==null&&y(N,k)&&i.rmSync(N,{force:!0,recursive:!0});else if(!U&&b!==null&&k!==null){const h=b,L=k;await le(f,m,()=>y(m,h)&&y(f,L))&&c.delete(f)}}}function C(e,t=process.platform){return t==="win32"&&H(e)&&typeof e.code=="string"&&Le.has(e.code)}export function tolerateTransientClaimFailure(e,t,r,n=Date.now(),o=process.platform){if(!C(r,o))throw r;const s=e.get(t),c={count:(s?.count??0)+1,firstAtMs:s?.firstAtMs??n};if(c.count>=_e&&n-c.firstAtMs>=Te)throw r;e.set(t,c)}export function transientWindowsLockRetryDelayMs(e,t,r=process.platform){return!C(e,r)||t>=ge?null:Math.min(Q,10*t)}async function _(e,t,r=""){for(let n=1;;n+=1)try{return e()}catch(o){const s=transientWindowsLockRetryDelayMs(o,n);if(s===null)throw o;I.hasSubscribers&&I.publish({metric:"locks.transientWindowsRetries",amount:1});try{await q(s,void 0,{signal:t})}catch(c){throw g(t,r),c}}}function re(){return{entryReads:new Map,retirements:new Map}}function ve(e,t){i.mkdirSync(e,{mode:448});try{i.writeFileSync(u.join(e,J),`${JSON.stringify(t)}
2
+ `,{encoding:"utf8",flag:"wx",mode:384}),i.writeFileSync(u.join(e,D),`${t.token}
3
+ `,{encoding:"utf8",flag:"wx",mode:384})}catch(r){throw i.rmSync(e,{force:!0,recursive:!0}),r}}function $e(e,t){i.writeFileSync(u.join(e,z),`${t.toString()}
4
+ `,{encoding:"utf8",flag:"wx",mode:384}),i.rmSync(u.join(e,D))}export function nextProcessLockTicket(e){if(e.some(r=>r.state==="changing"))return null;const t=e.reduce((r,n)=>n.ticket===null?r:Math.max(r,n.ticket),0);if(t>=Number.MAX_SAFE_INTEGER)throw new Error("Process lock ticket space is exhausted");return t+1}export function firstElectionBlocker(e,t){if(t.ticket===null||t.ownerRecord===null)return t;const r=t.ownerRecord.token;for(const n of e){if(n.claimDirectory===t.claimDirectory)continue;if(n.state!=="ready"||n.ticket===null||n.ownerRecord===null)return n;const o=n.ownerRecord.token;if(De(n.ticket,o,t.ticket,r)<0)return n}return null}function De(e,t,r,n){return e===r?t.localeCompare(n):e-r}function ne(e,t=null){const r=be(e);if(r!=="real")return{state:r};if(t!==null&&!y(e,t))return{state:"changed"};try{return{entries:i.readdirSync(e,{withFileTypes:!0}),state:"listed"}}catch(n){if(a(n,"ENOENT"))return{state:"absent"};throw n}}function oe(e,t,r,n,o){if(t.state!=="listed")return t.state==="absent"?{claims:[],rootAvailable:!0}:t.state==="unsafe"&&Ue(e,r,o)?{claims:[],rootAvailable:!0}:{claims:[ie(e)],rootAvailable:!1};const{entries:s}=t,c=[];for(const E of s){const l=u.join(e,E.name);let w;try{w=xe(E,l)}catch(p){tolerateTransientClaimFailure(n.entryReads,l,p),c.push(ce(l));continue}n.entryReads.delete(l),w===null?n.retirements.delete(l):Fe(w,r,o)?Ke(e,l,w.identity,r,n.retirements)==="held"&&c.push(ce(l)):(n.retirements.delete(l),c.push(w.claim))}return{claims:c,rootAvailable:!0}}function xe(e,t){const r=W(t);if(r===null)return null;const n=!e.name.startsWith($)||!e.isDirectory()?ie(t):ae(t),o=W(t);return o===null?null:{claim:n,identity:se(r),modifiedAtMs:Number(o.mtimeMs)}}function We(e){const t=W(e);return t===null?null:se(t)}function W(e){try{return i.lstatSync(e,{bigint:!0})}catch(t){if(a(t,"ENOENT"))return null;throw t}}function se(e){return{birthtimeNs:e.birthtimeNs,dev:e.dev,ino:e.ino}}function ie(e){return{claimDirectory:e,ownerRecord:null,state:"malformed",ticket:null}}function ce(e){return{claimDirectory:e,ownerRecord:null,state:"changing",ticket:null}}function ae(e){const t=He(e),r=K(u.join(e,D)),n=je(e),o=u.basename(e).slice($.length),s=t===null||t.token===o;return{claimDirectory:e,ownerRecord:t,state:t===null||!s?"malformed":r?"choosing":n===null?"malformed":"ready",ticket:n}}function je(e){const t=ue(u.join(e,z));if(t===null)return null;const r=Number(t.trim());return Number.isSafeInteger(r)&&r>0?r:null}function ue(e){try{return i.readFileSync(e,"utf8")}catch(t){if(a(t,"ENOENT")||a(t,"EISDIR"))return null;throw t}}function Fe({claim:e,modifiedAtMs:t},r,n){const o=e.ownerRecord;if(o===null||o.hostname!==ee)return n.hostScope==="current-host"&&Date.now()-t>=Z;if(pe(o.pid)==="absent")return!0;const s=F(o),c=r.get(e.claimDirectory);if(c?.ownerKey===s&&Date.now()-c.checkedAtMs<Oe)return!1;const E=Y(o.pid);return r.set(e.claimDirectory,{checkedAtMs:Date.now(),ownerKey:s}),E!==null&&E!==o.processIdentity}function Ke(e,t,r,n,o){n.delete(t);const s=`${e}.reclaiming-${P()}`;try{if(process.platform==="win32"){if(ke(t,s,r)==="absent")return o.delete(t),"removed"}else i.renameSync(t,s)}catch(c){return process.platform!=="win32"&&a(c,"ENOENT")?(o.delete(t),"removed"):(tolerateTransientClaimFailure(o,t,c),"held")}if(o.delete(t),!G(We(s),r))throw new Error(`Process lock claim ${t} changed before reclamation and is now at ${s}`);return i.rmSync(s,{maxRetries:Ae,recursive:!0,retryDelay:Me}),I.hasSubscribers&&I.publish({metric:"locks.reclaimedClaims",amount:1}),"removed"}function Ue(e,t,r){if(r.hostScope!=="current-host")return!1;const n=fe(e);if(n==="absent")return!0;if(n==="real-directory"||Ye(n)<Z)return!1;const o=fe(e);if(o==="absent")return!0;if(o==="real-directory"||!qe(o,n))return!1;try{return i.unlinkSync(e),t.delete(e),!0}catch(s){if(a(s,"ENOENT"))return!0;if(a(s,"EISDIR")||a(s,"EPERM"))return!1;throw s}}async function Ve(e,t,r,n,o){await le(e,t,()=>{if(!y(t,r))throw new Error(`Process lock directory changed before release: ${t}`);const s=ae(e);if(s.state!=="ready"||s.ticket!==o||s.ownerRecord===null||!de(s.ownerRecord,n))throw new Error(`Process lock ownership changed before release: ${e}`);return!0})}async function le(e,t,r){if(process.platform!=="win32")return r()?(i.rmSync(e,{force:!0,recursive:!0}),j(t),!0):!1;const n=`${t}.releasing-${P()}`;return await _(()=>r()?(i.renameSync(e,n),!0):!1)?(await _(()=>{i.rmSync(n,{force:!0,recursive:!0})}),await _(()=>{j(t)}),!0):!1}function fe(e){try{const t=i.lstatSync(e,{bigint:!0});return t.isDirectory()&&!t.isSymbolicLink()?"real-directory":{birthtimeNs:t.birthtimeNs,ctimeNs:t.ctimeNs,dev:t.dev,ino:t.ino,mode:t.mode,mtimeNs:t.mtimeNs,size:t.size}}catch(t){if(a(t,"ENOENT"))return"absent";throw t}}function qe(e,t){return e.birthtimeNs===t.birthtimeNs&&e.ctimeNs===t.ctimeNs&&e.dev===t.dev&&e.ino===t.ino&&e.mode===t.mode&&e.mtimeNs===t.mtimeNs&&e.size===t.size}function Ye(e){return Math.max(0,Date.now()-Number(e.mtimeNs)/1e6)}function j(e){try{i.rmdirSync(e)}catch(t){if(!a(t,"ENOENT")&&!a(t,"ENOTEMPTY")&&!a(t,"EEXIST"))throw t}}function He(e){const t=ue(u.join(e,J));if(t===null)return null;let r;try{r=JSON.parse(t)}catch{return null}return H(r)?Xe(r):null}function Xe(e){const t=Object.keys(e).sort(),r=["createdAt","hostname","pid","processIdentity","schemaVersion","token"];return t.length!==r.length||t.some((n,o)=>n!==r[o])||e.schemaVersion!==v||!tt(e.createdAt)||typeof e.hostname!="string"||e.hostname.length===0||!rt(e.pid)||typeof e.processIdentity!="string"||e.processIdentity.length===0||typeof e.token!="string"||e.token.length===0?null:{createdAt:e.createdAt,hostname:e.hostname,pid:e.pid,processIdentity:e.processIdentity,schemaVersion:v,token:e.token}}function de(e,t){return F(e)===F(t)}function F(e){return[e.hostname,e.pid.toString(),e.processIdentity,e.token,e.createdAt].join("\0")}function me(e){return`${e}.dir`}function he(e){const t=u.resolve(Be(e)),r=i.realpathSync.native(u.dirname(t));return u.join(r,u.basename(t))}function Be(e){if(e.trim().length===0)throw new Error("Process lock path must not be empty");return e}function Ge(e){if(x.getStore()?.has(e))throw new Error(`Reentrant process lock acquisition is not allowed: ${e}`)}function O(e,t,r,n){if(n!==null&&Date.now()-r>=n)throw new te(e,t)}async function Je(e,t,r){g(t,r),I.hasSubscribers&&I.publish({metric:"locks.contentionRetries",amount:1});try{await q(e,void 0,{signal:t})}catch(n){throw g(t,r),n}}function g(e,t){if(e?.aborted)throw ze(e,t)}function ze(e,t){return e.reason instanceof Error?e.reason:new Error(`Waiting for process lock was aborted: ${t}`)}function Qe(e){return e===null?"":` (host=${e.hostname} pid=${e.pid.toString()} identity=${e.processIdentity} createdAt=${e.createdAt})`}function Ze(e,t,r){const n=e===void 0?t:e;if(n!==null&&(!Number.isSafeInteger(n)||n<0))throw new Error(`${r} must be null or a non-negative safe integer`);return n}function et(e,t,r){const n=e??t;if(!Number.isSafeInteger(n)||n<=0)throw new Error(`${r} must be a positive safe integer`);return n}function tt(e){return typeof e=="string"&&e.length>0&&Number.isFinite(Date.parse(e))}function rt(e){return Number.isSafeInteger(e)&&Number(e)>0}function K(e){try{return i.lstatSync(e),!0}catch(t){if(a(t,"ENOENT"))return!1;throw t}}
@@ -0,0 +1,2 @@
1
+ import{spawn as u}from"node:child_process";import{once as f}from"node:events";import c from"node:fs";import{windowsCliOwned as d}from"./windows-cli-owner.js";import{windowsOwnerExecutable as p}from"./windows-native.js";const a=1e4;export async function portListenerOwner(r,i){try{if(process.platform==="linux")return l(m(r),i);if(process.platform!=="win32"||!d())return"unknown";const o=u(p(),["job-listener",String(r)],{detached:!0,stdio:["ignore","pipe","ignore"],timeout:a,windowsHide:!0});let t="";o.stdout.setEncoding("utf8").on("data",e=>t+=e);const[n]=await f(o,"close");return n===0&&(t==="ours"||t==="foreign")?t:"unknown"}catch{return"unknown"}}function l(r,i){return r.length===0?"unknown":r.every(o=>o.length===0||o.includes(i))?"ours":"foreign"}function m(r){const i=new Set;for(const t of["/proc/net/tcp","/proc/net/tcp6"])if(c.existsSync(t))for(const n of c.readFileSync(t,"utf8").trim().split(`
2
+ `).slice(1)){const e=n.trim().split(/\s+/u);e[3]==="0A"&&Number.parseInt(e[1]?.split(":")[1]??"",16)===r&&i.add(e[9])}const o=new Map;for(const t of c.readdirSync("/proc").filter(n=>/^\d+$/u.test(n))){let n;try{n=c.readdirSync(`/proc/${t}/fd`)}catch{continue}for(const e of n){const s=/^socket:\[(\d+)\]$/u.exec(w(`/proc/${t}/fd/${e}`))?.[1];s!==void 0&&i.has(s)&&o.set(s,[...o.get(s)??[],Number(t)])}}return[...i].map(t=>(o.get(t)??[]).map(n=>{const e=c.readFileSync(`/proc/${n.toString()}/stat`,"utf8");return Number(e.slice(e.lastIndexOf(")")+2).split(" ")[2])}))}function w(r){try{return c.readlinkSync(r)}catch{return""}}
@@ -1 +1 @@
1
- import{DEFAULT_SHUTDOWN_TIMEOUT_MS as f,FORCE_TERMINATION_WAIT_MS as m}from"./shutdown.js";import{hasErrorCode as c,toError as E}from"../kernel/error-serialization.js";export async function cleanupExitedProcessGroup(e,r={}){if((r.platform??process.platform)==="win32")return null;const t=r.groupExists??processGroupExists,n=r.sendSignal??M,o=r.sleep??g,s=r.graceMs??f,l=r.forceWaitMs??m;try{return!t(e)||(r.initialSignalSent||n(e,"SIGTERM"),await i(e,s,t,o,r.remainingMs))?null:(n(e,"SIGKILL"),await i(e,l,t,o)?null:new Error(`Managed process group ${e.toString()} did not stop`))}catch(u){return c(u,"ESRCH")?null:E(u)}}async function i(e,r,a,t,n){const o=performance.now(),s=n??(()=>r-(performance.now()-o));for(;s()>0;){if(!a(e))return!0;await t(Math.min(25,Math.max(1,s())))}return!a(e)}function M(e,r){process.kill(-e,r)}function g(e){return new Promise(r=>setTimeout(r,e))}export function processGroupExists(e){try{return process.kill(-e,0),!0}catch(r){if(c(r,"ESRCH"))return!1;if(c(r,"EPERM"))return!0;throw r}}
1
+ import{DEFAULT_SHUTDOWN_TIMEOUT_MS as f,FORCE_TERMINATION_WAIT_MS as m}from"./shutdown.js";import{hasErrorCode as c,toError as E}from"../kernel/error-serialization.js";export async function cleanupExitedProcessGroup(e,r={}){if((r.platform??process.platform)==="win32")return null;const t=r.groupExists??processGroupExists,n=r.sendSignal??M,o=r.sleep??delay,s=r.graceMs??f,l=r.forceWaitMs??m;try{return!t(e)||(r.initialSignalSent||n(e,"SIGTERM"),await i(e,s,t,o,r.remainingMs))?null:(n(e,"SIGKILL"),await i(e,l,t,o)?null:new Error(`Managed process group ${e.toString()} did not stop`))}catch(u){return c(u,"ESRCH")?null:E(u)}}async function i(e,r,a,t,n){const o=performance.now(),s=n??(()=>r-(performance.now()-o));for(;s()>0;){if(!a(e))return!0;await t(Math.min(25,Math.max(1,s())))}return!a(e)}function M(e,r){process.kill(-e,r)}export function delay(e){return new Promise(r=>setTimeout(r,e))}export function processGroupExists(e){try{return process.kill(-e,0),!0}catch(r){if(c(r,"ESRCH"))return!1;if(c(r,"EPERM"))return!0;throw r}}