@gfdelarue/testkit 0.4.4 → 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.
- package/README.md +752 -462
- package/bin/testkit-windows-owner-arm64.exe +0 -0
- package/bin/testkit-windows-owner-x64.exe +0 -0
- package/dist/app/bugs/categories.js +1 -1
- package/dist/app/bugs/ci-report.js +2 -2
- package/dist/app/bugs/ci-summary.js +3 -3
- package/dist/app/bugs/draft.js +4 -4
- package/dist/app/bugs/facts.js +2 -2
- package/dist/app/bugs/file.js +1 -1
- package/dist/app/bugs/gate.js +1 -1
- package/dist/app/bugs/guide.js +3 -3
- package/dist/app/bugs/issue.js +4 -4
- package/dist/app/bugs/known-failures.js +1 -1
- package/dist/app/bugs/record.js +2 -2
- package/dist/app/bugs/run-reading.js +1 -1
- package/dist/app/bugs/supplied-reproduce.js +1 -0
- package/dist/app/campaigns/campaign.js +1 -1
- package/dist/app/cleanup/index.js +1 -1
- package/dist/app/db-schema/prepare.js +1 -1
- package/dist/app/destroy/index.js +1 -1
- package/dist/app/discover/index.js +2 -2
- package/dist/app/doctor/index.js +1 -1
- package/dist/app/environments/config-driven.js +1 -0
- package/dist/app/environments/environment-file.js +1 -0
- package/dist/app/environments/file-setup.js +1 -0
- package/dist/app/environments/routing.js +1 -0
- package/dist/app/environments/static-values.js +1 -0
- package/dist/app/environments/supplied-input.js +1 -0
- package/dist/app/environments/supplied.js +1 -0
- package/dist/app/environments/task-databases.js +2 -0
- package/dist/app/file-selection.js +1 -1
- package/dist/app/inspect/artifacts.js +1 -1
- package/dist/app/inspect/index.js +1 -1
- package/dist/app/lint/index.js +1 -1
- package/dist/app/lint/native.js +1 -1
- package/dist/app/lint/options.js +1 -1
- package/dist/app/lint/rules/data.js +1 -1
- package/dist/app/lint/rules/engine-imports.js +1 -1
- package/dist/app/lint/rules/syntax.js +1 -1
- package/dist/app/lint/rules/unit.js +1 -1
- package/dist/app/lint/shared.js +1 -1
- package/dist/app/package-inspection.js +1 -1
- package/dist/app/reports/files.js +1 -0
- package/dist/app/reports/prepare.js +2 -0
- package/dist/app/reports/publish.js +1 -0
- package/dist/app/run/caller-redaction.js +1 -0
- package/dist/app/run/engine-evidence-persistence.js +1 -1
- package/dist/app/run/engine-execution-failures.js +1 -1
- package/dist/app/run/engine-execution-reporting.js +1 -1
- package/dist/app/run/engine-execution.js +1 -1
- package/dist/app/run/engine-orchestration.js +1 -1
- package/dist/app/run/environment.js +1 -0
- package/dist/app/run/failure-details.js +1 -1
- package/dist/app/run/live-run.js +1 -1
- package/dist/app/run/orchestrator.js +1 -1
- package/dist/app/run/planning.js +1 -1
- package/dist/app/run/request.js +1 -1
- package/dist/app/run/results.js +1 -1
- package/dist/app/run/run-events.js +1 -1
- package/dist/app/run/run-finalization.js +1 -1
- package/dist/app/run/runtime-fixtures.js +1 -1
- package/dist/app/run/scheduler/estimates.js +1 -1
- package/dist/app/run/scheduler/identity.js +1 -1
- package/dist/app/run/scheduler/index.js +1 -1
- package/dist/app/run/scheduler/locks.js +1 -0
- package/dist/app/run/selection.js +1 -1
- package/dist/app/run/setup/runtime-node-setup-protocol.js +1 -1
- package/dist/app/run/setup/runtime-node-setup-worker.js +1 -1
- package/dist/app/run/setup/runtime-node-setup.js +2 -2
- package/dist/app/run/task-batches.js +1 -1
- package/dist/app/run/task-leases.js +1 -0
- package/dist/app/run/worker-loop.js +1 -1
- package/dist/app/status/runs.js +1 -1
- package/dist/app/tracker/index.js +1 -1
- package/dist/app/typecheck/index.js +4 -4
- package/dist/cli/command-catalog.js +1 -1
- package/dist/cli/command-flags.js +1 -1
- package/dist/cli/command-registry.js +1 -1
- package/dist/cli/commands/artifacts.js +2 -2
- package/dist/cli/commands/bug/file.js +2 -2
- package/dist/cli/commands/bug/record.js +2 -2
- package/dist/cli/commands/discover.js +1 -1
- package/dist/cli/commands/report/prepare.js +5 -0
- package/dist/cli/commands/report/publish.js +2 -0
- package/dist/cli/commands/run.js +2 -2
- package/dist/cli/commands/typecheck.js +1 -1
- package/dist/cli/commands/workspace.js +1 -1
- package/dist/cli/framework/errors.js +1 -1
- package/dist/cli/framework/execute.js +7 -6
- package/dist/cli/framework/parser.js +1 -1
- package/dist/cli/json-errors.js +1 -1
- package/dist/cli/operations/run/operation.js +2 -2
- package/dist/cli/renderers/bug/text.js +1 -1
- package/dist/cli/renderers/discover/report.js +1 -1
- package/dist/cli/renderers/doctor/text.js +1 -1
- package/dist/cli/renderers/run/events.js +2 -2
- package/dist/cli/renderers/run/formatting.js +1 -1
- package/dist/cli/renderers/run/status.js +1 -1
- package/dist/cli/renderers/run/text-reporter.js +24 -22
- package/dist/cli/terminal/colors.js +1 -1
- package/dist/cli/terminal/layout.js +2 -2
- package/dist/config/authoring/http-methods.js +1 -1
- package/dist/config/authoring/index.js +1 -1
- package/dist/config/authoring/preset-env.js +1 -1
- package/dist/config/loader/config-loader.js +1 -1
- package/dist/config/loader/database.js +1 -1
- package/dist/config/loader/decode-execution.js +1 -1
- package/dist/config/loader/dependencies.js +1 -1
- package/dist/config/loader/discover-tests.js +1 -1
- package/dist/config/loader/discovery-summary.js +1 -1
- package/dist/config/loader/discovery.js +2 -2
- package/dist/config/loader/env.js +1 -1
- package/dist/config/loader/execution-model.js +1 -1
- package/dist/config/loader/file-metadata.js +1 -1
- package/dist/config/loader/groups.js +1 -0
- package/dist/config/loader/index.js +1 -1
- package/dist/config/loader/load.js +1 -1
- package/dist/config/loader/managed-configs.js +1 -1
- package/dist/config/loader/owned-discovery.js +1 -0
- package/dist/config/loader/path-policy.js +1 -1
- package/dist/config/loader/runtime-isolation.js +1 -1
- package/dist/config/loader/runtime.js +1 -1
- package/dist/config/loader/skip-config.js +1 -1
- package/dist/config/loader/task-policy.js +1 -0
- package/dist/config/loader/test-selection.js +1 -1
- package/dist/config/loader/validation.js +1 -1
- package/dist/database/activity-gate.js +1 -1
- package/dist/database/admin.js +2 -2
- package/dist/database/bindings.js +1 -0
- package/dist/database/cleanup.js +1 -1
- package/dist/database/docker-metadata.js +3 -3
- package/dist/database/docker.js +3 -3
- package/dist/database/index.js +1 -1
- package/dist/database/lifecycle-cleanup.js +1 -1
- package/dist/database/local-postgres.js +1 -1
- package/dist/database/naming.js +1 -1
- package/dist/database/postgres/connection-check.js +1 -0
- package/dist/database/postgres/protocol.js +2 -0
- package/dist/database/schema-operations.js +1 -1
- package/dist/database/schema-source.js +3 -3
- package/dist/database/source-schema-env.js +1 -0
- package/dist/database/source-url.js +2 -2
- package/dist/database/state-files.js +1 -1
- package/dist/database/state.js +1 -1
- package/dist/database/steps.js +3 -3
- package/dist/domain/file-timeout.js +1 -1
- package/dist/domain/identifiers.js +1 -1
- package/dist/domain/operation-display.js +1 -1
- package/dist/domain/retired-test-types.js +1 -0
- package/dist/domain/runtime-isolation-contract.js +1 -1
- package/dist/domain/suite-selection.js +1 -1
- package/dist/domain/test-outcomes.js +1 -1
- package/dist/domain/test-types.js +1 -1
- package/dist/engines/adapters/evidence-files.js +1 -1
- package/dist/engines/adapters/evidence-identity.js +1 -1
- package/dist/engines/adapters/execution.js +1 -1
- package/dist/engines/adapters/json-bounds.js +2 -0
- package/dist/engines/adapters/native-report.js +1 -1
- package/dist/engines/api/execution-scope.js +1 -1
- package/dist/engines/api/execution.js +1 -1
- package/dist/engines/api/index.js +1 -1
- package/dist/engines/api/runtime-artifact.js +1 -1
- package/dist/engines/bundle-cache.js +1 -1
- package/dist/engines/catalog.js +1 -1
- package/dist/engines/contracts/environment-values.js +1 -0
- package/dist/engines/contracts/fixture-manifest.js +1 -1
- package/dist/engines/definitions.js +1 -1
- package/dist/engines/environment/handles.js +1 -0
- package/dist/engines/environment/index.js +1 -0
- package/dist/engines/factory.js +1 -1
- package/dist/engines/installations/node-vitest.js +1 -1
- package/dist/engines/installations/package-resolution.js +1 -1
- package/dist/engines/installations/playwright-resolution-child.js +1 -1
- package/dist/engines/installations/playwright.js +1 -1
- package/dist/engines/managed-module-resolution-policy-input.js +1 -1
- package/dist/engines/managed-module-resolution-policy.js +1 -1
- package/dist/engines/managed-module-resolution.js +2 -2
- package/dist/engines/manager.js +1 -1
- package/dist/engines/node-vitest/adapter/adapter.js +1 -1
- package/dist/engines/node-vitest/adapter/driver.js +2 -0
- package/dist/engines/node-vitest/adapter/evidence.js +2 -2
- package/dist/engines/node-vitest/adapter/failure-details.js +4 -2
- package/dist/engines/node-vitest/adapter/reporter.js +1 -1
- package/dist/engines/node-vitest/adapter/workspace.js +31 -192
- package/dist/engines/node-vitest/inventory/index.js +2 -0
- package/dist/engines/node-vitest/inventory/list-files.js +3 -0
- package/dist/engines/node-vitest/runtime/contract/index.js +1 -1
- package/dist/engines/node-vitest/runtime/data/http.js +1 -1
- package/dist/engines/node-vitest/runtime/data/index.js +1 -1
- package/dist/engines/node-vitest/runtime/data/report.js +5 -6
- package/dist/engines/node-vitest/runtime/data/scenario.js +2 -2
- package/dist/engines/node-vitest/runtime/runtime-input.js +1 -1
- package/dist/engines/node-vitest/selection.js +1 -0
- package/dist/engines/playwright/adapter/adapter.js +1 -1
- package/dist/engines/playwright/adapter/config.js +4 -4
- package/dist/engines/playwright/adapter/evidence-validation.js +1 -1
- package/dist/engines/playwright/adapter/evidence.js +1 -1
- package/dist/engines/playwright/adapter/reporter.js +1 -1
- package/dist/engines/playwright/runtime/config-file.js +1 -1
- package/dist/engines/playwright/runtime/config.js +1 -1
- package/dist/engines/playwright/runtime/runtime-input.js +43 -20
- package/dist/engines/runtime-input-file.js +1 -1
- package/dist/environment/lifecycle-artifacts.js +1 -1
- package/dist/environment/lifecycle-controller.js +1 -1
- package/dist/environment/lifecycle.js +1 -1
- package/dist/environment/ports.js +1 -0
- package/dist/environment/ready-environment.js +1 -1
- package/dist/environment/run-environment.js +1 -1
- package/dist/environment/run-stopping.js +1 -1
- package/dist/environment/runtime-contexts.js +1 -1
- package/dist/environment/runtime-manager.js +1 -1
- package/dist/environment/runtime-planning.js +1 -1
- package/dist/environment/runtime-preparation.js +1 -1
- package/dist/environment/services.js +3 -1
- package/dist/environment/state.js +1 -1
- package/dist/environment/template.js +1 -1
- package/dist/evidence/artifact-config.js +1 -1
- package/dist/evidence/artifact-validation.js +1 -1
- package/dist/evidence/artifacts.js +2 -2
- package/dist/evidence/bundles.js +1 -1
- package/dist/evidence/environment-record.js +1 -0
- package/dist/evidence/index.js +1 -1
- package/dist/evidence/logs.js +2 -2
- package/dist/evidence/operation-timings.js +1 -1
- package/dist/evidence/read-fields.js +1 -1
- package/dist/evidence/read-run.js +1 -1
- package/dist/evidence/reading.js +1 -1
- package/dist/evidence/redaction.js +4 -0
- package/dist/evidence/reporting.js +1 -1
- package/dist/evidence/run-model.js +1 -0
- package/dist/evidence/storage.js +2 -2
- package/dist/evidence/timing.js +1 -1
- package/dist/kernel/error-serialization.js +1 -1
- package/dist/kernel/redaction-targets.js +1 -0
- package/dist/kernel/redaction.js +4 -1
- package/dist/kernel/unknown-values.js +1 -1
- package/dist/process/environment.js +1 -1
- package/dist/process/execa-bundle.json +3 -3
- package/dist/process/files/json-file.js +1 -1
- package/dist/process/files/paths.js +1 -1
- package/dist/process/host/metadata.js +1 -1
- package/dist/process/host/platform.js +1 -1
- package/dist/process/host-process.js +1 -1
- package/dist/process/index.js +1 -1
- package/dist/process/lifecycle-fence.js +1 -1
- package/dist/process/locks.js +4 -4
- package/dist/process/port-listener.js +2 -0
- package/dist/process/process-group.js +1 -1
- package/dist/process/process-identity.js +1 -1
- package/dist/process/process.js +33 -33
- package/dist/process/readiness.js +1 -1
- package/dist/process/ready-deadline.js +1 -0
- package/dist/process/recovery.js +1 -1
- package/dist/process/runs/manifest.js +1 -1
- package/dist/process/runs/ownership.js +1 -1
- package/dist/process/runs/product-state.js +1 -1
- package/dist/process/runs/stop.js +1 -1
- package/dist/process/service-processes.js +1 -1
- package/dist/process/stoppable-settlement.js +1 -0
- package/dist/process/url-redaction.js +1 -0
- package/dist/process/windows-cli-owner.js +3 -3
- package/dist/process/windows-native.js +1 -1
- package/dist/repo/ci-environment.js +1 -1
- package/dist/repo/fingerprint-policy.js +1 -1
- package/dist/repo/managed-git.js +1 -1
- package/dist/repo/physical-tree.js +1 -1
- package/dist/repo/publish-directory.js +3 -0
- package/dist/repo/state.js +4 -4
- package/dist/steps/build-config.js +1 -1
- package/dist/steps/configured-step-testkit-modules.js +1 -1
- package/dist/steps/configured-steps.js +1 -1
- package/dist/steps/environment.js +1 -1
- package/dist/steps/index.js +1 -1
- package/dist/steps/run.js +2 -2
- package/dist/toolchains/archive.js +1 -1
- package/dist/toolchains/index.js +3 -3
- package/dist/toolchains/node-provisioning.js +2 -2
- package/dist/toolchains/semver.js +1 -1
- package/dist/toolchains/vitest/index.js +1 -1
- package/dist/tracker/redaction.js +1 -2
- package/dist/{config/runtime/build-assets.d.ts → types/config-build-assets.d.ts} +5 -3
- package/dist/{database/steps.d.ts → types/config-database-steps.d.ts} +7 -7
- package/dist/{config/runtime/next-runtime-tsconfig.d.ts → types/config-next-runtime-tsconfig.d.ts} +5 -3
- package/dist/types/config.d.ts +501 -0
- package/dist/types/drizzle.d.ts +13 -0
- package/dist/{config/runtime/env/index.d.ts → types/env.d.ts} +22 -20
- package/dist/types/environment.d.ts +40 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/node-vitest-contract.d.ts +75 -0
- package/dist/types/node-vitest-data.d.ts +407 -0
- package/dist/types/playwright.d.ts +130 -0
- package/dist/types/tooling-vitest.d.ts +13 -0
- package/dist/types/workspace.d.ts +617 -0
- package/docs/bug-records.md +83 -81
- package/docs/engines.md +213 -0
- package/docs/test-types.md +35 -33
- package/package.json +22 -29
- package/testkit-config-schema.md +403 -171
- package/dist/app/bugs/areas.d.ts +0 -38
- package/dist/app/bugs/assessment.d.ts +0 -9
- package/dist/app/bugs/categories.d.ts +0 -41
- package/dist/app/bugs/ci-report.d.ts +0 -21
- package/dist/app/bugs/ci-summary.d.ts +0 -13
- package/dist/app/bugs/draft.d.ts +0 -70
- package/dist/app/bugs/facts.d.ts +0 -48
- package/dist/app/bugs/file.d.ts +0 -45
- package/dist/app/bugs/gate.d.ts +0 -22
- package/dist/app/bugs/guide.d.ts +0 -20
- package/dist/app/bugs/issue.d.ts +0 -18
- package/dist/app/bugs/known-failures.d.ts +0 -49
- package/dist/app/bugs/record.d.ts +0 -14
- package/dist/app/bugs/run-reading.d.ts +0 -51
- package/dist/app/bugs/store.d.ts +0 -34
- package/dist/app/campaigns/brief.d.ts +0 -7
- package/dist/app/campaigns/campaign.d.ts +0 -14
- package/dist/app/campaigns/index.d.ts +0 -38
- package/dist/app/campaigns/store.d.ts +0 -5
- package/dist/app/campaigns/summary.d.ts +0 -13
- package/dist/app/cleanup/index.d.ts +0 -52
- package/dist/app/db-schema/prepare.d.ts +0 -11
- package/dist/app/db-schema/refresh.d.ts +0 -17
- package/dist/app/db-schema/verify.d.ts +0 -11
- package/dist/app/destroy/index.d.ts +0 -16
- package/dist/app/discover/index.d.ts +0 -8
- package/dist/app/doctor/index.d.ts +0 -17
- package/dist/app/file-selection.d.ts +0 -1
- package/dist/app/inspect/artifacts.d.ts +0 -30
- package/dist/app/inspect/index.d.ts +0 -112
- package/dist/app/lint/index.d.ts +0 -28
- package/dist/app/lint/native.d.ts +0 -10
- package/dist/app/lint/options.d.ts +0 -67
- package/dist/app/lint/policy.d.ts +0 -21
- package/dist/app/lint/rules/data.d.ts +0 -3
- package/dist/app/lint/rules/engine-imports.d.ts +0 -3
- package/dist/app/lint/rules/syntax.d.ts +0 -4
- package/dist/app/lint/rules/unit.d.ts +0 -3
- package/dist/app/lint/shared.d.ts +0 -36
- package/dist/app/package-inspection.d.ts +0 -20
- package/dist/app/run/endpoint-readiness.d.ts +0 -43
- package/dist/app/run/endpoint-readiness.js +0 -1
- package/dist/app/run/engine-evidence-persistence.d.ts +0 -39
- package/dist/app/run/engine-execution-cleanup.d.ts +0 -8
- package/dist/app/run/engine-execution-cleanup.js +0 -1
- package/dist/app/run/engine-execution-failures.d.ts +0 -41
- package/dist/app/run/engine-execution-observer.d.ts +0 -21
- package/dist/app/run/engine-execution-reporting.d.ts +0 -17
- package/dist/app/run/engine-execution.d.ts +0 -63
- package/dist/app/run/engine-failure-stack.d.ts +0 -1
- package/dist/app/run/engine-orchestration.d.ts +0 -49
- package/dist/app/run/failure-details.d.ts +0 -37
- package/dist/app/run/live-run.d.ts +0 -27
- package/dist/app/run/operation-progress.d.ts +0 -13
- package/dist/app/run/orchestrator.d.ts +0 -68
- package/dist/app/run/planning-types.d.ts +0 -68
- package/dist/app/run/planning.d.ts +0 -15
- package/dist/app/run/playwright-configuration.d.ts +0 -2
- package/dist/app/run/playwright-configuration.js +0 -1
- package/dist/app/run/request.d.ts +0 -30
- package/dist/app/run/results.d.ts +0 -161
- package/dist/app/run/run-events.d.ts +0 -144
- package/dist/app/run/run-finalization.d.ts +0 -52
- package/dist/app/run/run-guards.d.ts +0 -3
- package/dist/app/run/runtime-failures.d.ts +0 -18
- package/dist/app/run/runtime-fixtures.d.ts +0 -2
- package/dist/app/run/runtime-task-types.d.ts +0 -20
- package/dist/app/run/scheduler/estimates.d.ts +0 -32
- package/dist/app/run/scheduler/identity.d.ts +0 -9
- package/dist/app/run/scheduler/index.d.ts +0 -124
- package/dist/app/run/scheduler/observations.d.ts +0 -20
- package/dist/app/run/selection.d.ts +0 -10
- package/dist/app/run/setup/runtime-node-setup-errors.d.ts +0 -13
- package/dist/app/run/setup/runtime-node-setup-protocol.d.ts +0 -85
- package/dist/app/run/setup/runtime-node-setup-worker.d.ts +0 -1
- package/dist/app/run/setup/runtime-node-setup.d.ts +0 -48
- package/dist/app/run/task-batches.d.ts +0 -23
- package/dist/app/run/worker-loop.d.ts +0 -57
- package/dist/app/setup/playwright.d.ts +0 -22
- package/dist/app/status/index.d.ts +0 -9
- package/dist/app/status/model.d.ts +0 -29
- package/dist/app/status/runs.d.ts +0 -99
- package/dist/app/stop/index.d.ts +0 -14
- package/dist/app/tracker/index.d.ts +0 -8
- package/dist/app/tracker/remote.d.ts +0 -13
- package/dist/app/tracker/token.d.ts +0 -7
- package/dist/app/typecheck/index.d.ts +0 -63
- package/dist/cli/command-catalog.d.ts +0 -137
- package/dist/cli/command-flags.d.ts +0 -19
- package/dist/cli/command-registry.d.ts +0 -3
- package/dist/cli/commands/artifacts.d.ts +0 -48
- package/dist/cli/commands/bug/file.d.ts +0 -16
- package/dist/cli/commands/bug/guide.d.ts +0 -5
- package/dist/cli/commands/bug/record.d.ts +0 -9
- package/dist/cli/commands/campaign/finish.d.ts +0 -10
- package/dist/cli/commands/campaign/start.d.ts +0 -7
- package/dist/cli/commands/campaign/status.d.ts +0 -13
- package/dist/cli/commands/ci/report.d.ts +0 -15
- package/dist/cli/commands/cleanup.d.ts +0 -13
- package/dist/cli/commands/db/schema/refresh.d.ts +0 -2
- package/dist/cli/commands/db/schema/verify.d.ts +0 -2
- package/dist/cli/commands/destroy.d.ts +0 -9
- package/dist/cli/commands/discover.d.ts +0 -2
- package/dist/cli/commands/doctor.d.ts +0 -2
- package/dist/cli/commands/guard/unsafe-entrypoint.d.ts +0 -2
- package/dist/cli/commands/lint.d.ts +0 -2
- package/dist/cli/commands/run/status.d.ts +0 -5
- package/dist/cli/commands/run/stop.d.ts +0 -7
- package/dist/cli/commands/run.d.ts +0 -9
- package/dist/cli/commands/setup/playwright.d.ts +0 -2
- package/dist/cli/commands/status.d.ts +0 -5
- package/dist/cli/commands/stop.d.ts +0 -12
- package/dist/cli/commands/typecheck.d.ts +0 -2
- package/dist/cli/commands/workspace.d.ts +0 -2
- package/dist/cli/entrypoint.d.ts +0 -1
- package/dist/cli/framework/command.d.ts +0 -21
- package/dist/cli/framework/definitions.d.ts +0 -100
- package/dist/cli/framework/errors.d.ts +0 -6
- package/dist/cli/framework/execute.d.ts +0 -14
- package/dist/cli/framework/help.d.ts +0 -11
- package/dist/cli/framework/index.d.ts +0 -3
- package/dist/cli/framework/parser.d.ts +0 -6
- package/dist/cli/index.d.ts +0 -4
- package/dist/cli/json-errors.d.ts +0 -3
- package/dist/cli/operations/db/schema/refresh/operation.d.ts +0 -7
- package/dist/cli/operations/db/schema/verify/operation.d.ts +0 -7
- package/dist/cli/operations/run/operation.d.ts +0 -24
- package/dist/cli/process-signal.d.ts +0 -1
- package/dist/cli/renderers/bug/text.d.ts +0 -8
- package/dist/cli/renderers/campaign/text.d.ts +0 -2
- package/dist/cli/renderers/ci/text.d.ts +0 -2
- package/dist/cli/renderers/cleanup/format.d.ts +0 -14
- package/dist/cli/renderers/db-schema/text.d.ts +0 -4
- package/dist/cli/renderers/destroy/text.d.ts +0 -4
- package/dist/cli/renderers/discover/report.d.ts +0 -7
- package/dist/cli/renderers/discover/text.d.ts +0 -3
- package/dist/cli/renderers/doctor/text.d.ts +0 -2
- package/dist/cli/renderers/lint/text.d.ts +0 -2
- package/dist/cli/renderers/run/events.d.ts +0 -8
- package/dist/cli/renderers/run/failure.d.ts +0 -8
- package/dist/cli/renderers/run/formatting.d.ts +0 -79
- package/dist/cli/renderers/run/status.d.ts +0 -6
- package/dist/cli/renderers/run/text-reporter.d.ts +0 -19
- package/dist/cli/renderers/status/text.d.ts +0 -2
- package/dist/cli/renderers/stop/text.d.ts +0 -7
- package/dist/cli/renderers/typecheck/text.d.ts +0 -2
- package/dist/cli/terminal/colors.d.ts +0 -10
- package/dist/cli/terminal/layout.d.ts +0 -11
- package/dist/cli/version-drift.d.ts +0 -25
- package/dist/config/authoring/build-config-contract.d.ts +0 -27
- package/dist/config/authoring/configured-step-contract.d.ts +0 -18
- package/dist/config/authoring/http-execution-contract.d.ts +0 -70
- package/dist/config/authoring/http-methods.d.ts +0 -18
- package/dist/config/authoring/index.d.ts +0 -381
- package/dist/config/authoring/preset-env.d.ts +0 -19
- package/dist/config/authoring/runtime.d.ts +0 -64
- package/dist/config/loader/bugs.d.ts +0 -15
- package/dist/config/loader/config-loader.d.ts +0 -9
- package/dist/config/loader/database-materialization.d.ts +0 -19
- package/dist/config/loader/database-roles.d.ts +0 -2
- package/dist/config/loader/database.d.ts +0 -55
- package/dist/config/loader/decode-discovery.d.ts +0 -5
- package/dist/config/loader/decode-execution.d.ts +0 -9
- package/dist/config/loader/dependencies.d.ts +0 -7
- package/dist/config/loader/discover-tests.d.ts +0 -111
- package/dist/config/loader/discovery-summary.d.ts +0 -29
- package/dist/config/loader/discovery.d.ts +0 -54
- package/dist/config/loader/env.d.ts +0 -4
- package/dist/config/loader/execution-model.d.ts +0 -16
- package/dist/config/loader/file-metadata.d.ts +0 -19
- package/dist/config/loader/index.d.ts +0 -10
- package/dist/config/loader/load.d.ts +0 -91
- package/dist/config/loader/managed-configs.d.ts +0 -23
- package/dist/config/loader/path-policy.d.ts +0 -9
- package/dist/config/loader/paths.d.ts +0 -5
- package/dist/config/loader/runtime-isolation.d.ts +0 -44
- package/dist/config/loader/runtime.d.ts +0 -25
- package/dist/config/loader/skip-config.d.ts +0 -44
- package/dist/config/loader/test-selection.d.ts +0 -15
- package/dist/config/loader/validation.d.ts +0 -16
- package/dist/config/loader/values.d.ts +0 -4
- package/dist/config/loader/values.js +0 -1
- package/dist/database/activity-gate.d.ts +0 -22
- package/dist/database/admin.d.ts +0 -31
- package/dist/database/cleanup.d.ts +0 -36
- package/dist/database/configured-steps.d.ts +0 -27
- package/dist/database/constants.d.ts +0 -11
- package/dist/database/docker-metadata.d.ts +0 -3
- package/dist/database/docker.d.ts +0 -65
- package/dist/database/drizzle/index.d.ts +0 -13
- package/dist/database/fingerprint.d.ts +0 -12
- package/dist/database/index.d.ts +0 -39
- package/dist/database/lifecycle-cleanup.d.ts +0 -7
- package/dist/database/local-postgres.d.ts +0 -71
- package/dist/database/naming.d.ts +0 -17
- package/dist/database/postgres/index.d.ts +0 -71
- package/dist/database/progress.d.ts +0 -6
- package/dist/database/roles.d.ts +0 -19
- package/dist/database/runtime-config.d.ts +0 -16
- package/dist/database/runtime-reservations.d.ts +0 -19
- package/dist/database/schema-operations.d.ts +0 -18
- package/dist/database/schema-source.d.ts +0 -96
- package/dist/database/source-refresh-lock.d.ts +0 -8
- package/dist/database/source-url.d.ts +0 -22
- package/dist/database/state-files.d.ts +0 -13
- package/dist/database/state.d.ts +0 -26
- package/dist/database/template-steps.d.ts +0 -39
- package/dist/domain/file-timeout.d.ts +0 -28
- package/dist/domain/identifiers.d.ts +0 -9
- package/dist/domain/operation-display.d.ts +0 -10
- package/dist/domain/operation-reason.d.ts +0 -5
- package/dist/domain/postgres-route.d.ts +0 -4
- package/dist/domain/runtime-identity.d.ts +0 -1
- package/dist/domain/runtime-isolation-contract.d.ts +0 -5
- package/dist/domain/service-name.d.ts +0 -2
- package/dist/domain/suite-selection.d.ts +0 -20
- package/dist/domain/test-outcomes.d.ts +0 -3
- package/dist/domain/test-types.d.ts +0 -16
- package/dist/engines/adapters/evidence-files.d.ts +0 -32
- package/dist/engines/adapters/evidence-identity.d.ts +0 -12
- package/dist/engines/adapters/execution.d.ts +0 -42
- package/dist/engines/adapters/native-report.d.ts +0 -25
- package/dist/engines/adapters/node-startup-cache.d.ts +0 -8
- package/dist/engines/adapters/workspace.d.ts +0 -4
- package/dist/engines/api/capabilities.d.ts +0 -31
- package/dist/engines/api/capabilities.js +0 -1
- package/dist/engines/api/evidence.d.ts +0 -38
- package/dist/engines/api/execution-observer.d.ts +0 -8
- package/dist/engines/api/execution-scope.d.ts +0 -17
- package/dist/engines/api/execution.d.ts +0 -101
- package/dist/engines/api/index.d.ts +0 -5
- package/dist/engines/api/k6-runtime-input.d.ts +0 -26
- package/dist/engines/api/k6-runtime-input.js +0 -1
- package/dist/engines/api/runtime-artifact.d.ts +0 -19
- package/dist/engines/bundle-cache.d.ts +0 -32
- package/dist/engines/catalog.d.ts +0 -27
- package/dist/engines/contracts/fixture-manifest.d.ts +0 -34
- package/dist/engines/contracts/json-bounds.d.ts +0 -36
- package/dist/engines/contracts/json-bounds.js +0 -2
- package/dist/engines/contracts/k6-repository-configuration.d.ts +0 -12
- package/dist/engines/contracts/k6-repository-configuration.js +0 -1
- package/dist/engines/contracts/test-context.d.ts +0 -15
- package/dist/engines/contracts/test-context.js +0 -1
- package/dist/engines/definitions.d.ts +0 -22
- package/dist/engines/factory.d.ts +0 -6
- package/dist/engines/generated-performance.d.ts +0 -1
- package/dist/engines/installation-catalog.d.ts +0 -27
- package/dist/engines/installation-catalog.js +0 -1
- package/dist/engines/installations/k6.d.ts +0 -98
- package/dist/engines/installations/k6.js +0 -1
- package/dist/engines/installations/node-vitest.d.ts +0 -33
- package/dist/engines/installations/package-requirements.d.ts +0 -28
- package/dist/engines/installations/package-resolution.d.ts +0 -51
- package/dist/engines/installations/playwright-resolution-child.d.ts +0 -1
- package/dist/engines/installations/playwright.d.ts +0 -75
- package/dist/engines/installations/types.d.ts +0 -10
- package/dist/engines/k6/adapter/bundle.d.ts +0 -25
- package/dist/engines/k6/adapter/bundle.js +0 -112
- package/dist/engines/k6/adapter/evidence.d.ts +0 -15
- package/dist/engines/k6/adapter/evidence.js +0 -4
- package/dist/engines/k6/adapter/executor.d.ts +0 -13
- package/dist/engines/k6/adapter/executor.js +0 -1
- package/dist/engines/k6/adapter/index.d.ts +0 -1
- package/dist/engines/k6/adapter/index.js +0 -1
- package/dist/engines/k6/adapter/input.d.ts +0 -21
- package/dist/engines/k6/adapter/input.js +0 -1
- package/dist/engines/k6/adapter/native-summary.d.ts +0 -11
- package/dist/engines/k6/adapter/native-summary.js +0 -1
- package/dist/engines/k6/adapter/repository-configuration.d.ts +0 -2
- package/dist/engines/k6/adapter/repository-configuration.js +0 -1
- package/dist/engines/k6/authoring-type-paths.d.ts +0 -3
- package/dist/engines/k6/authoring-type-paths.js +0 -1
- package/dist/engines/k6/runtime/ambient-types/bundle-manifest.json +0 -146
- package/dist/engines/k6/runtime/ambient-types/k6/LICENSE +0 -21
- package/dist/engines/k6/runtime/ambient-types/k6/browser/index.d.ts +0 -6332
- package/dist/engines/k6/runtime/ambient-types/k6/crypto/index.d.ts +0 -218
- package/dist/engines/k6/runtime/ambient-types/k6/data/index.d.ts +0 -16
- package/dist/engines/k6/runtime/ambient-types/k6/encoding/index.d.ts +0 -46
- package/dist/engines/k6/runtime/ambient-types/k6/execution/index.d.ts +0 -127
- package/dist/engines/k6/runtime/ambient-types/k6/experimental/csv/index.d.ts +0 -96
- package/dist/engines/k6/runtime/ambient-types/k6/experimental/fs/index.d.ts +0 -104
- package/dist/engines/k6/runtime/ambient-types/k6/experimental/redis/index.d.ts +0 -821
- package/dist/engines/k6/runtime/ambient-types/k6/experimental/streams/index.d.ts +0 -198
- package/dist/engines/k6/runtime/ambient-types/k6/global.d.ts +0 -83
- package/dist/engines/k6/runtime/ambient-types/k6/html/index.d.ts +0 -1325
- package/dist/engines/k6/runtime/ambient-types/k6/http/index.d.ts +0 -806
- package/dist/engines/k6/runtime/ambient-types/k6/index.d.ts +0 -126
- package/dist/engines/k6/runtime/ambient-types/k6/metrics/index.d.ts +0 -66
- package/dist/engines/k6/runtime/ambient-types/k6/net/grpc/index.d.ts +0 -247
- package/dist/engines/k6/runtime/ambient-types/k6/options/index.d.ts +0 -459
- package/dist/engines/k6/runtime/ambient-types/k6/package.json +0 -79
- package/dist/engines/k6/runtime/ambient-types/k6/secrets/index.d.ts +0 -36
- package/dist/engines/k6/runtime/ambient-types/k6/timers/index.d.ts +0 -47
- package/dist/engines/k6/runtime/ambient-types/k6/websockets/index.d.ts +0 -324
- package/dist/engines/k6/runtime/ambient-types/k6/ws/index.d.ts +0 -283
- package/dist/engines/k6/runtime/ambient-types/xk6-sql/LICENSE +0 -201
- package/dist/engines/k6/runtime/ambient-types/xk6-sql/index.d.ts +0 -397
- package/dist/engines/k6/runtime/ambient-types/xk6-sql/package.json +0 -15
- package/dist/engines/k6/runtime/artifacts.d.ts +0 -2
- package/dist/engines/k6/runtime/artifacts.js +0 -1
- package/dist/engines/k6/runtime/checks.d.ts +0 -17
- package/dist/engines/k6/runtime/checks.js +0 -1
- package/dist/engines/k6/runtime/dal-fixtures.d.ts +0 -24
- package/dist/engines/k6/runtime/dal-fixtures.js +0 -1
- package/dist/engines/k6/runtime/dal-suite.d.ts +0 -24
- package/dist/engines/k6/runtime/dal-suite.js +0 -1
- package/dist/engines/k6/runtime/dal.d.ts +0 -10
- package/dist/engines/k6/runtime/dal.js +0 -1
- package/dist/engines/k6/runtime/fixtures.d.ts +0 -3
- package/dist/engines/k6/runtime/fixtures.js +0 -1
- package/dist/engines/k6/runtime/http-assertions.d.ts +0 -19
- package/dist/engines/k6/runtime/http-assertions.js +0 -1
- package/dist/engines/k6/runtime/http-checks.d.ts +0 -19
- package/dist/engines/k6/runtime/http-checks.js +0 -1
- package/dist/engines/k6/runtime/http-suite-runtime.d.ts +0 -103
- package/dist/engines/k6/runtime/http-suite-runtime.js +0 -1
- package/dist/engines/k6/runtime/http.d.ts +0 -15
- package/dist/engines/k6/runtime/http.js +0 -1
- package/dist/engines/k6/runtime/index.d.ts +0 -11
- package/dist/engines/k6/runtime/index.js +0 -1
- package/dist/engines/k6/runtime/input.d.ts +0 -3
- package/dist/engines/k6/runtime/input.js +0 -1
- package/dist/engines/k6/runtime/k6-repository-configuration.d.ts +0 -9
- package/dist/engines/k6/runtime/k6-repository-configuration.js +0 -1
- package/dist/engines/k6/runtime/node-setup.d.ts +0 -13
- package/dist/engines/k6/runtime/node-setup.js +0 -1
- package/dist/engines/k6/runtime/runtime-globals.d.ts +0 -10
- package/dist/engines/k6/runtime/runtime.d.ts +0 -54
- package/dist/engines/k6/runtime/runtime.js +0 -1
- package/dist/engines/k6/runtime/shared/assertion-details.d.ts +0 -19
- package/dist/engines/k6/runtime/shared/assertion-details.js +0 -2
- package/dist/engines/k6/runtime/shared/db-normalization.d.ts +0 -19
- package/dist/engines/k6/runtime/shared/db-normalization.js +0 -1
- package/dist/engines/k6/runtime/shared/error-body.d.ts +0 -3
- package/dist/engines/k6/runtime/shared/error-body.js +0 -1
- package/dist/engines/k6/runtime/shared/file-data.d.ts +0 -1
- package/dist/engines/k6/runtime/shared/file-data.js +0 -1
- package/dist/engines/k6/runtime/shared/fixture-engine.d.ts +0 -8
- package/dist/engines/k6/runtime/shared/fixture-engine.js +0 -2
- package/dist/engines/k6/runtime/shared/http-check-plan.d.ts +0 -29
- package/dist/engines/k6/runtime/shared/http-check-plan.js +0 -1
- package/dist/engines/k6/runtime/shared/http-parsing.d.ts +0 -10
- package/dist/engines/k6/runtime/shared/http-parsing.js +0 -3
- package/dist/engines/k6/runtime/shared/ordering.d.ts +0 -2
- package/dist/engines/k6/runtime/shared/ordering.js +0 -1
- package/dist/engines/k6/runtime/shared/properties.d.ts +0 -1
- package/dist/engines/k6/runtime/shared/properties.js +0 -1
- package/dist/engines/k6/runtime/suite.d.ts +0 -4
- package/dist/engines/k6/runtime/suite.js +0 -1
- package/dist/engines/k6/runtime/types.d.ts +0 -244
- package/dist/engines/k6/runtime/types.js +0 -1
- package/dist/engines/k6/runtime/xk6-sql-driver-postgres.d.ts +0 -7
- package/dist/engines/k6/runtime/xk6-sql-driver-postgres.js +0 -1
- package/dist/engines/managed-module-resolution-policy-input.d.ts +0 -9
- package/dist/engines/managed-module-resolution-policy.d.ts +0 -25
- package/dist/engines/managed-module-resolution.d.ts +0 -13
- package/dist/engines/manager.d.ts +0 -25
- package/dist/engines/node-vitest/adapter/adapter.d.ts +0 -16
- package/dist/engines/node-vitest/adapter/consumer-typescript-paths.d.ts +0 -17
- package/dist/engines/node-vitest/adapter/consumer-typescript-paths.js +0 -3
- package/dist/engines/node-vitest/adapter/evidence.d.ts +0 -33
- package/dist/engines/node-vitest/adapter/failure-details.d.ts +0 -3
- package/dist/engines/node-vitest/adapter/index.d.ts +0 -1
- package/dist/engines/node-vitest/adapter/reporter.d.ts +0 -7
- package/dist/engines/node-vitest/adapter/resolution.d.ts +0 -12
- package/dist/engines/node-vitest/adapter/resolution.js +0 -1
- package/dist/engines/node-vitest/adapter/workspace.d.ts +0 -19
- package/dist/engines/node-vitest/runtime/contract/index.d.ts +0 -64
- package/dist/engines/node-vitest/runtime/data/http.d.ts +0 -4
- package/dist/engines/node-vitest/runtime/data/index.d.ts +0 -8
- package/dist/engines/node-vitest/runtime/data/primitives.d.ts +0 -1
- package/dist/engines/node-vitest/runtime/data/report.d.ts +0 -3
- package/dist/engines/node-vitest/runtime/data/runner.d.ts +0 -4
- package/dist/engines/node-vitest/runtime/data/scenario.d.ts +0 -12
- package/dist/engines/node-vitest/runtime/data/types.d.ts +0 -412
- package/dist/engines/node-vitest/runtime/runtime-input.d.ts +0 -64
- package/dist/engines/playwright/adapter/adapter.d.ts +0 -18
- package/dist/engines/playwright/adapter/attachments.d.ts +0 -26
- package/dist/engines/playwright/adapter/config.d.ts +0 -45
- package/dist/engines/playwright/adapter/evidence-validation.d.ts +0 -12
- package/dist/engines/playwright/adapter/evidence.d.ts +0 -32
- package/dist/engines/playwright/adapter/failure-details.d.ts +0 -2
- package/dist/engines/playwright/adapter/index.d.ts +0 -3
- package/dist/engines/playwright/adapter/reporter.d.ts +0 -12
- package/dist/engines/playwright/runtime/config-file.d.ts +0 -2
- package/dist/engines/playwright/runtime/config.d.ts +0 -24
- package/dist/engines/playwright/runtime/index.d.ts +0 -4
- package/dist/engines/playwright/runtime/runtime-input.d.ts +0 -36
- package/dist/engines/playwright/runtime/sandbox.d.ts +0 -84
- package/dist/engines/runtime-input-file.d.ts +0 -27
- package/dist/environment/lifecycle-artifacts.d.ts +0 -7
- package/dist/environment/lifecycle-controller.d.ts +0 -70
- package/dist/environment/lifecycle.d.ts +0 -29
- package/dist/environment/maintenance.d.ts +0 -68
- package/dist/environment/planning-types.d.ts +0 -35
- package/dist/environment/readiness.d.ts +0 -12
- package/dist/environment/readiness.js +0 -1
- package/dist/environment/ready-environment.d.ts +0 -19
- package/dist/environment/run-environment.d.ts +0 -38
- package/dist/environment/run-stopping.d.ts +0 -13
- package/dist/environment/runtime-contexts.d.ts +0 -33
- package/dist/environment/runtime-manager.d.ts +0 -95
- package/dist/environment/runtime-planning.d.ts +0 -16
- package/dist/environment/runtime-preparation.d.ts +0 -30
- package/dist/environment/runtime-service.d.ts +0 -18
- package/dist/environment/services.d.ts +0 -48
- package/dist/environment/state.d.ts +0 -18
- package/dist/environment/status-runtime.d.ts +0 -53
- package/dist/environment/template.d.ts +0 -180
- package/dist/evidence/artifact-config.d.ts +0 -14
- package/dist/evidence/artifact-validation.d.ts +0 -5
- package/dist/evidence/artifacts.d.ts +0 -75
- package/dist/evidence/bundles.d.ts +0 -27
- package/dist/evidence/ci-provenance.d.ts +0 -9
- package/dist/evidence/contracts.d.ts +0 -154
- package/dist/evidence/file-evidence.d.ts +0 -23
- package/dist/evidence/finalization.d.ts +0 -9
- package/dist/evidence/index.d.ts +0 -8
- package/dist/evidence/logs.d.ts +0 -31
- package/dist/evidence/operation-timings.d.ts +0 -60
- package/dist/evidence/read-bundle.d.ts +0 -4
- package/dist/evidence/read-fields.d.ts +0 -22
- package/dist/evidence/read-provenance.d.ts +0 -2
- package/dist/evidence/read-redaction.d.ts +0 -2
- package/dist/evidence/read-retention.d.ts +0 -2
- package/dist/evidence/read-run.d.ts +0 -2
- package/dist/evidence/reading.d.ts +0 -28
- package/dist/evidence/reporting-types.d.ts +0 -330
- package/dist/evidence/reporting.d.ts +0 -3
- package/dist/evidence/secure-file-copy.d.ts +0 -24
- package/dist/evidence/setup-progress.d.ts +0 -63
- package/dist/evidence/step-output.d.ts +0 -16
- package/dist/evidence/storage-inventory.d.ts +0 -27
- package/dist/evidence/storage.d.ts +0 -27
- package/dist/evidence/timing.d.ts +0 -23
- package/dist/file.d.ts +0 -11
- package/dist/index.d.ts +0 -4
- package/dist/kernel/error-serialization.d.ts +0 -38
- package/dist/kernel/redaction.d.ts +0 -2
- package/dist/kernel/unknown-values.d.ts +0 -6
- package/dist/kernel/work-metrics.d.ts +0 -6
- package/dist/process/capture-output.d.ts +0 -7
- package/dist/process/command-shell.d.ts +0 -1
- package/dist/process/environment-overlay.d.ts +0 -17
- package/dist/process/environment.d.ts +0 -33
- package/dist/process/files/contained-path.d.ts +0 -8
- package/dist/process/files/directory-status.d.ts +0 -14
- package/dist/process/files/dotenv.d.ts +0 -2
- package/dist/process/files/file-snapshot.d.ts +0 -34
- package/dist/process/files/json-file.d.ts +0 -12
- package/dist/process/files/paths.d.ts +0 -1
- package/dist/process/files/product-dir.d.ts +0 -1
- package/dist/process/files/temp-dir.d.ts +0 -11
- package/dist/process/host/metadata.d.ts +0 -6
- package/dist/process/host/platform.d.ts +0 -57
- package/dist/process/host-command.d.ts +0 -4
- package/dist/process/host-inspection-command.d.ts +0 -13
- package/dist/process/host-process.d.ts +0 -19
- package/dist/process/index.d.ts +0 -9
- package/dist/process/lifecycle-fence.d.ts +0 -11
- package/dist/process/locks.d.ts +0 -28
- package/dist/process/process-contracts.d.ts +0 -78
- package/dist/process/process-group.d.ts +0 -12
- package/dist/process/process-identity.d.ts +0 -27
- package/dist/process/process-limits.d.ts +0 -6
- package/dist/process/process.d.ts +0 -12
- package/dist/process/readiness.d.ts +0 -37
- package/dist/process/recovery.d.ts +0 -3
- package/dist/process/runs/inspection.d.ts +0 -5
- package/dist/process/runs/manifest.d.ts +0 -86
- package/dist/process/runs/ownership.d.ts +0 -11
- package/dist/process/runs/product-state.d.ts +0 -2
- package/dist/process/runs/schema.d.ts +0 -3
- package/dist/process/runs/stop.d.ts +0 -19
- package/dist/process/runtime-socket.d.ts +0 -4
- package/dist/process/service-processes.d.ts +0 -13
- package/dist/process/shutdown.d.ts +0 -10
- package/dist/process/windows-cli-owner.d.ts +0 -2
- package/dist/process/windows-native.d.ts +0 -6
- package/dist/process/windows-process-identity.d.ts +0 -4
- package/dist/repo/ci-environment.d.ts +0 -7
- package/dist/repo/fingerprint-policy.d.ts +0 -15
- package/dist/repo/git-path.d.ts +0 -2
- package/dist/repo/history.d.ts +0 -17
- package/dist/repo/managed-git.d.ts +0 -10
- package/dist/repo/metadata.d.ts +0 -3
- package/dist/repo/physical-tree.d.ts +0 -37
- package/dist/repo/remote.d.ts +0 -6
- package/dist/repo/state.d.ts +0 -26
- package/dist/repo/tree-listing.d.ts +0 -10
- package/dist/steps/build-config.d.ts +0 -35
- package/dist/steps/configured-step-testkit-modules.d.ts +0 -19
- package/dist/steps/configured-steps.d.ts +0 -51
- package/dist/steps/environment.d.ts +0 -84
- package/dist/steps/index.d.ts +0 -2
- package/dist/steps/module-runner.d.ts +0 -1
- package/dist/steps/run.d.ts +0 -36
- package/dist/toolchains/archive.d.ts +0 -53
- package/dist/toolchains/esbuild.d.ts +0 -9
- package/dist/toolchains/host-node-support.d.ts +0 -3
- package/dist/toolchains/index.d.ts +0 -114
- package/dist/toolchains/managed-node-releases.d.ts +0 -28
- package/dist/toolchains/node-cache.d.ts +0 -20
- package/dist/toolchains/node-integrity.d.ts +0 -18
- package/dist/toolchains/node-provisioning.d.ts +0 -29
- package/dist/toolchains/semver.d.ts +0 -13
- package/dist/toolchains/shared-operation.d.ts +0 -11
- package/dist/toolchains/timeouts.d.ts +0 -1
- package/dist/toolchains/vitest/index.d.ts +0 -13
- package/dist/tracker/gitea.d.ts +0 -14
- package/dist/tracker/github.d.ts +0 -14
- package/dist/tracker/http.d.ts +0 -33
- package/dist/tracker/index.d.ts +0 -4
- package/dist/tracker/redaction.d.ts +0 -4
- package/dist/tracker/requests.d.ts +0 -17
- package/dist/tracker/responses.d.ts +0 -24
- package/dist/tracker/types.d.ts +0 -51
- package/docs/engine-architecture.md +0 -654
- /package/dist/engines/{k6/runtime/runtime-globals.js → api/profiles.js} +0 -0
package/dist/evidence/storage.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{isWorkObserved as f,recordWork as l}from"../kernel/work-metrics.js";import{isPathWithin as p}from"../process/files/paths.js";import x from"crypto";import i from"fs";import o from"path";import{RUNS_DIRNAME as m}from"./contracts.js";import{
|
|
2
|
-
`)}export function hashFile(r){const t=i.readFileSync(r);return l("evidence.hashFilesRead",1),l("evidence.hashBytesRead",t.byteLength),sha256(t)}export function sha256(r){return
|
|
1
|
+
import{isWorkObserved as f,recordWork as l}from"../kernel/work-metrics.js";import{isPathWithin as p}from"../process/files/paths.js";import{isUnknownRecord as x}from"../kernel/unknown-values.js";import v from"crypto";import i from"fs";import o from"path";import{RUNS_DIRNAME as m}from"./contracts.js";import{requireManifestRelativePath as g}from"./read-fields.js";import{posixPath as w}from"../process/files/paths.js";import{errorMessage as E}from"../kernel/error-serialization.js";export function readJsonFile(r){try{let t;if(f()){const n=i.readFileSync(r);l("json.filesRead",1),l("json.bytesRead",n.byteLength),t=n.toString("utf8")}else t=i.readFileSync(r,"utf8");return JSON.parse(t)}catch(t){throw new Error(`Invalid JSON in ${r}: ${E(t)}`,{cause:t})}}export function runIncludesFile(r,t){const e=w(t);return r.groups.some(n=>n.suites.some(u=>u.files.some(s=>s.path===e||s.path.endsWith(e))))}export function requireRunId(r){const t=r.run.id==null?null:normalizeRunId(r.run.id);if(t===null)throw new Error("Cannot seal a run bundle without a run id");return t}export function normalizeRunId(r){const t=typeof r=="string"?r:"";if(!t||t==="."||t===".."||t.includes("\0")||t.includes("/")||t.includes("\\"))throw new Error(`Invalid Testkit run id: ${t||"<empty>"}`);return t}export function walkFiles(r){if(!i.existsSync(r))return[];const t=[];for(const e of i.readdirSync(r,{withFileTypes:!0})){const n=o.join(r,e.name);e.isDirectory()?t.push(...walkFiles(n)):e.isFile()&&t.push(n)}return t}export function treeBytes(r){return walkFiles(r).reduce((t,e)=>t+i.statSync(e).size,0)}export function writeBufferAtomic(r,t){i.mkdirSync(o.dirname(r),{recursive:!0});const e=`${r}.${String(process.pid)}.${String(Date.now())}.tmp`;i.writeFileSync(e,t);try{i.renameSync(e,r)}catch(n){if(i.rmSync(e,{force:!0}),!i.existsSync(r))throw n}}export function writeJson(r,t){i.mkdirSync(o.dirname(r),{recursive:!0});const e=JSON.stringify(t,null,2);l("json.serializations"),f()&&l("json.bytesSerialized",Buffer.byteLength(e)),i.writeFileSync(r,`${e}
|
|
2
|
+
`)}export function hashFile(r){const t=i.readFileSync(r);return l("evidence.hashFilesRead",1),l("evidence.hashBytesRead",t.byteLength),sha256(t)}export function sha256(r){return v.createHash("sha256").update(r).digest("hex")}export function stableJson(r){const t=JSON.stringify(d(r));return l("json.canonicalSerializations"),f()&&l("json.canonicalBytesSerialized",Buffer.byteLength(t)),t}function d(r){return Array.isArray(r)?r.map(d):x(r)?Object.fromEntries(Object.keys(r).sort().map(t=>[t,d(r[t])])):r}export function resolveRunBundleDirectory(r,t){const e=resolveRunsRoot(r,!1),n=o.join(e,t),u=i.lstatSync(n,{throwIfNoEntry:!1});if(u===void 0)return n;if(u.isSymbolicLink())throw new Error(`Immutable run bundle directory must not be a symbolic link: ${t}`);if(!u.isDirectory())throw new Error(`Immutable run bundle path must be a directory: ${t}`);const s=i.realpathSync(e),c=i.realpathSync(n),a=o.relative(s,c);if(a.length===0||a===".."||a.startsWith(`..${o.sep}`)||o.isAbsolute(a))throw new Error(`Immutable run bundle directory must resolve within the runs root: ${t}`);return n}export function resolveRunsRoot(r,t){const e=o.resolve(r),n=resultsRoot(e),u=o.join(n,m);if(t)k(e,n,"Testkit results root"),i.mkdirSync(n,{recursive:!0});else if(!i.existsSync(n))return u;const s=S(n,"Testkit results root");if(y(i.realpathSync(e),s,"Testkit results root must resolve within the product directory"),t)i.mkdirSync(u,{recursive:!0});else if(!i.existsSync(u))return u;const c=S(u,"Immutable run bundles root");return y(s,c,"Immutable run bundles root must resolve within .testkit/results"),u}function k(r,t,e){const n=o.resolve(r),u=i.realpathSync(n);let s=o.resolve(t),c=i.lstatSync(s,{throwIfNoEntry:!1});for(;c===void 0;){const a=o.dirname(s);if(a===s)throw new Error(`${e} has no existing parent directory`);s=a,c=i.lstatSync(s,{throwIfNoEntry:!1})}if(s!==n&&c.isSymbolicLink())throw new Error(`${e} must not traverse a symbolic link`);if(!c.isDirectory())throw new Error(`${e} parent must be a directory`);y(u,i.realpathSync(s),`${e} must resolve within the product directory`,!0)}function S(r,t){const e=i.lstatSync(r,{throwIfNoEntry:!1});if(e===void 0)throw new Error(`${t} does not exist`);if(e.isSymbolicLink())throw new Error(`${t} must not be a symbolic link`);if(!e.isDirectory())throw new Error(`${t} must be a directory`);return i.realpathSync(r)}function y(r,t,e,n=!1){const u=o.relative(r,t);if(!n&&u.length===0||u===".."||u.startsWith(`..${o.sep}`)||o.isAbsolute(u))throw new Error(e)}export function requirePublicationPathOutsideResults(r,t){const e=o.resolve(resultsRoot(r)),n=o.resolve(t);if(p(e,n))throw new Error("Publication directory must be outside .testkit/results");const u=i.realpathSync(e);let s=n,c=i.lstatSync(s,{throwIfNoEntry:!1});for(;c===void 0;){const h=o.dirname(s);if(h===s)throw new Error("Publication directory has no existing parent");s=h,c=i.lstatSync(s,{throwIfNoEntry:!1})}const a=i.realpathSync(s);if(p(u,a))throw new Error("Publication directory must be outside .testkit/results")}export function resolveManifestEntryPath(r,t){const e=o.resolve(r),n=o.resolve(e,g(t,"manifest entry path"));return b(e,n,t),i.existsSync(n)&&b(i.realpathSync(e),i.realpathSync(n),t),n}function b(r,t,e){const n=o.relative(r,t);if(n.length===0||n===".."||n.startsWith(`..${o.sep}`)||o.isAbsolute(n))throw new Error(`manifest path escapes bundle directory: ${e}`)}export function optionalStringArray(r){return Array.isArray(r)?r.filter(t=>typeof t=="string"):[]}export function optionalUnknownArray(r){return Array.isArray(r)?r:[]}export function bundleRelativePath(r,t){return w(o.join(".testkit","results",m,r,t))}export function resultsRoot(r){return o.join(r,".testkit","results")}export function sanitizeSegment(r){return r.toLowerCase().replace(/[^a-z0-9._-]+/gu,"-").replace(/^-+|-+$/gu,"")||"product"}
|
package/dist/evidence/timing.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function createEmptyTimings(){return{version:2,files:{}}}export function normalizeTimings(t){if(!m(t)||t.version!==2||!m(t.files))return createEmptyTimings();const n={};for(const[e,r]of Object.entries(t.files)){if(!m(r))continue;const u=D(r);u&&(n[e]=u)}return{version:2,files:n}}export function applyTimingUpdates(t,n,e=new Date().toISOString()){const r={...t.files},u=e||null;for(const o of n){const i=Math.max(1,Math.round(o.durationMs)),s=r[o.key];if(!s){r[o.key]={durationMs:i,avgDurationMs:i,lastDurationMs:i,minDurationMs:i,maxDurationMs:i,runs:1,lastStatus:o.status||null,updatedAt:u};continue}const M=s.runs,c=M+1,d=s.avgDurationMs||s.durationMs||i,f=Math.max(1,Math.round((d*M+i)/c));r[o.key]={durationMs:f,avgDurationMs:f,lastDurationMs:i,minDurationMs:Math.min(s.minDurationMs||i,i),maxDurationMs:Math.max(s.maxDurationMs||i,i),runs:c,lastStatus:(o.status||null)??s.lastStatus,updatedAt:u}}return{version:2,files:r}}function D(t){if(!p(t.durationMs))return null;const n=a(t.durationMs);return{durationMs:n,avgDurationMs:a(t.avgDurationMs,n),lastDurationMs:a(t.lastDurationMs,n),minDurationMs:a(t.minDurationMs,n),maxDurationMs:a(t.maxDurationMs,n),runs:g(t.runs),lastStatus:l(t.lastStatus),updatedAt:l(t.updatedAt)}}function p(t){return typeof t=="number"?Number.isFinite(t):typeof t!="string"||t.trim().length===0?!1:Number.isFinite(Number(t))}function a(t,n=0){const r=Number(t||n);return Number.isFinite(r)?Math.max(0,Math.round(r)):n}function g(t){const n=Number(t||0);return Number.isFinite(n)?Math.max(0,Math.floor(n)):0}
|
|
1
|
+
import{isUnknownRecord as m,optionalString as l}from"../kernel/unknown-values.js";export function createEmptyTimings(){return{version:2,files:{}}}export function normalizeTimings(t){if(!m(t)||t.version!==2||!m(t.files))return createEmptyTimings();const n={};for(const[e,r]of Object.entries(t.files)){if(!m(r))continue;const u=D(r);u&&(n[e]=u)}return{version:2,files:n}}export function applyTimingUpdates(t,n,e=new Date().toISOString()){const r={...t.files},u=e||null;for(const o of n){const i=Math.max(1,Math.round(o.durationMs)),s=r[o.key];if(!s){r[o.key]={durationMs:i,avgDurationMs:i,lastDurationMs:i,minDurationMs:i,maxDurationMs:i,runs:1,lastStatus:o.status||null,updatedAt:u};continue}const M=s.runs,c=M+1,d=s.avgDurationMs||s.durationMs||i,f=Math.max(1,Math.round((d*M+i)/c));r[o.key]={durationMs:f,avgDurationMs:f,lastDurationMs:i,minDurationMs:Math.min(s.minDurationMs||i,i),maxDurationMs:Math.max(s.maxDurationMs||i,i),runs:c,lastStatus:(o.status||null)??s.lastStatus,updatedAt:u}}return{version:2,files:r}}function D(t){if(!p(t.durationMs))return null;const n=a(t.durationMs);return{durationMs:n,avgDurationMs:a(t.avgDurationMs,n),lastDurationMs:a(t.lastDurationMs,n),minDurationMs:a(t.minDurationMs,n),maxDurationMs:a(t.maxDurationMs,n),runs:g(t.runs),lastStatus:l(t.lastStatus),updatedAt:l(t.updatedAt)}}function p(t){return typeof t=="number"?Number.isFinite(t):typeof t!="string"||t.trim().length===0?!1:Number.isFinite(Number(t))}function a(t,n=0){const r=Number(t||n);return Number.isFinite(r)?Math.max(0,Math.round(r)):n}function g(t){const n=Number(t||0);return Number.isFinite(n)?Math.max(0,Math.floor(n)):0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
import{redactSensitiveText as O}from"./redaction.js";import{isPropertyContainer as k,isNonNullObject as r,isUnknownArray as p}from"./unknown-values.js";const m="testkitOperation",y="testkitDiagnostics",o=String;export function attachErrorOperation(t,n){if(!r(t)||!r(n)||s(t,m))return t;const e=E(n);return e!==null&&d(t,m,e),t}export function attachErrorDiagnostics(t,n){if(!r(t)||!r(n))return t;const e=getErrorDiagnostics(t),i={...a(e),...a(n)};return d(t,y,i),t}export function getErrorOperation(t){return r(t)?E(s(t,m)||s(t,"operation")):null}export function getErrorDiagnostics(t){return r(t)?a(s(t,y)||s(t,"diagnostics")):{}}export function errorMessage(t){return t instanceof Error?t.message:o(t)}export function formatError(t){return sanitizeErrorMessage(errorMessage(t))}export function sanitizeErrorMessage(t){return O(t)}export function errorDetail(t){if(r(t)){const n=s(t,"stack");if(typeof n=="string"&&n.length>0)return n;const e=s(t,"message");if(typeof e=="string"&&e.length>0)return e}return t instanceof Error?t.stack||t.message:o(t)}export function serializeError(t,{includeStack:n=!1}={}){if(t instanceof Error){const e=getErrorOperation(t),i=getErrorDiagnostics(t),c=s(t,"code"),u=s(t,"exitCode"),f=s(t,"status");return{name:t.name||"Error",message:t.message||o(t),...typeof c=="string"?{code:c}:{},...typeof u=="number"&&Number.isInteger(u)?{exitCode:u}:{},...typeof f=="number"&&Number.isInteger(f)?{status:f}:{},...e?{phase:e.name,operation:e}:{},...Object.keys(i).length>0?{diagnostics:i}:{},...n&&typeof t.stack=="string"?{stack:t.stack}:{}}}return{name:"Error",message:o(t)}}function d(t,n,e){Object.defineProperty(t,n,{value:e,configurable:!0,enumerable:!1,writable:!0})}function E(t){if(!r(t))return null;const n=s(t,"id"),e=s(t,"source"),i=s(t,"name"),c=s(t,"kind"),u=s(t,"summary"),f=s(t,"status"),g=s(t,"error");return{...n?{id:o(n)}:{},source:typeof e=="string"?e:"testkit",name:typeof i=="string"&&i?i:"operation",kind:typeof c=="string"&&c?c:"operation",...u?{summary:o(u)}:{},scope:a(s(t,"scope")),...f?{status:o(f)}:{},...g?{error:o(g)}:{}}}function a(t){if(!r(t)||p(t))return{};const n=[];for(const e of Object.keys(t)){const i=s(t,e);i!==void 0&&n.push([e,l(i)])}return Object.fromEntries(n)}function l(t){return t===null?null:typeof t=="string"||typeof t=="number"||typeof t=="boolean"?t:p(t)?t.map(n=>l(n)):r(t)?a(t):o(t)}function s(t,n){return Reflect.get(t,n)}export function toError(t){return t instanceof Error?t:new Error(String(t))}export function hasErrorCode(t,n){return k(t)&&Reflect.get(t,"code")===n}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{REDACTED as m,SENSITIVE_KEY_PATTERN as E}from"./redaction.js";import{recordWork as A}from"./work-metrics.js";export const MIN_REDACTION_TARGET_LENGTH=8;const l=/^[a-z][a-z0-9+.-]*:\/\/([^/?#]*)/iu,M=/^postgres(?:ql)?:\/\//iu,u=/["'`]?(?:…|\.\.\.)/gu;export function sensitiveKeyMatcher(t=[]){const r=new Set(t.map(n=>n.toUpperCase()));return n=>E.test(n)||r.has(n.toUpperCase())}export function isRedactionTarget(t){return t.length>=MIN_REDACTION_TARGET_LENGTH}export function envRedactionTargets(t,r=sensitiveKeyMatcher()){return Object.entries(t).flatMap(([n,e])=>e===void 0?[]:valueRedactionTargets(n,e,r))}export function valueRedactionTargets(t,r,n=sensitiveKeyMatcher()){return l.test(r)?urlRedactionTargets(r):n(t)&&isRedactionTarget(r)?[r]:[]}export function jsonRedactionTargets(t,r,n=sensitiveKeyMatcher()){return typeof r=="string"?valueRedactionTargets(t,r,n):Array.isArray(r)?r.flatMap(e=>jsonRedactionTargets(t,e,n)):r!==null&&typeof r=="object"?Object.entries(r).flatMap(([e,o])=>jsonRedactionTargets(e,o,n)):[]}export function urlRedactionTargets(t){const r=l.exec(t);if(r===null)return[];const n=r[1].slice(0,Math.max(r[1].lastIndexOf("@"),0)),e=n.indexOf(":"),o=[...e<0?[]:[n.slice(e+1)],...M.test(t)?O(t.slice(r[0].length)):[]];return[...new Set(o.flatMap(s=>[s,x(s)]))].filter(isRedactionTarget)}function O(t){return(/\?([^#]*)/u.exec(t)?.[1]??"").split("&").flatMap(n=>{const e=n.indexOf("=");return e>0&&x(n.slice(0,e))==="password"?[n.slice(e+1)]:[]})}export function orderRedactionTargets(t){const r=[...t].filter(isRedactionTarget).flatMap(n=>[n,...n.split(/\r?\n/u)]).flatMap(n=>{const e=T(n);return[n,e,T(e)]});return[...new Set(r)].filter(isRedactionTarget).sort((n,e)=>e.length-n.length)}export function replaceRedactionTargets(t,r,n=()=>m){let e=t,o=0;for(const c of r){if(!e.includes(c))continue;const i=e.split(c);o+=i.length-1,e=i.join(n(c))}const s=N(e,r,n);return{replacements:o+s.replacements,text:s.text}}export function redactionTargetSpans(t,r){const n=[];for(const e of r)for(let o=t.indexOf(e);o!==-1;o=t.indexOf(e,o+1))n.push({cut:!1,end:o+e.length,start:o});for(const e of t.matchAll(u)){const o=h(t,e.index,0,r);o>0&&n.push({cut:!0,end:e.index,start:e.index-o})}return n}function N(t,r,n){const e=[];let o=0,s=0;for(const c of t.matchAll(u)){const i=h(t,c.index,o,r);i!==0&&(e.push(t.slice(o,c.index-i),n(t.slice(c.index-i,c.index))),o=c.index,s+=1)}return e.push(t.slice(o)),{replacements:s,text:e.join("")}}const d=new WeakMap;function h(t,r,n,e){let o=d.get(e);o===void 0&&(o=e.map(_),d.set(e,o));let s=0,c=0;return e.forEach((i,R)=>{const p=Math.max(n,r-(i.length-1));if(r-p<=s||r-p<MIN_REDACTION_TARGET_LENGTH)return;const g=o[R];let f=0;for(let a=p;a<r;a++){for(c+=1;f>0&&i[f]!==t[a];)f=g[f-1],c+=1;i[f]===t[a]&&(f+=1)}f>=MIN_REDACTION_TARGET_LENGTH&&f>s&&(s=f)}),A("redaction.truncationSteps",c),s}function _(t){const r=new Int32Array(t.length);let n=0;for(let e=1;e<t.length;e++){for(;n>0&&t[n]!==t[e];)n=r[n-1];t[n]===t[e]&&(n+=1),r[e]=n}return r}function T(t){return JSON.stringify(t).slice(1,-1)}function x(t){try{return decodeURIComponent(t)}catch{return t}}
|
package/dist/kernel/redaction.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export const SENSITIVE_KEY_PATTERN=/PASSWORD|TOKEN|SECRET|PRIVATE_KEY|AUTH|COOKIE|SESSION|API_KEY/iu,REDACTED="<redacted>";const I=/\b([A-Z0-9_]+)=(?=\S)/giu,a=/(?:^|_)URL$/iu,P=/["']?[a-z][a-z0-9+.-]*:\/\//iuy,m=/(?:basic|bearer|digest|negotiate|token)[ \t]/iuy,O=/(:\/\/[^:\s/@]*:|%3A\/\/(?:(?!%3A)[^:\s/@])*%3A)[^\s/]+(?=@)/giu,l=/\s/u,b=/(["'`]?)(?:\b|(?<=\\[nrt]))(?:(?:proxy-)?authorization|(?:set-)?cookie)[ \t]*(?::|%3A)[ \t]*(?=\S)/giu,$=/'password'\s*(?::|%3A)\s*'/giu,w=/\\(?:u([\dA-Fa-f]{4})|([\s\S]))/gu,D={b:"\b",f:"\f",n:`
|
|
2
|
+
`,r:"\r",t:" "},U=8,C=String,E=["\uE000","\uE001","\uE002","\uE003","\uE004","\uE005","\uE006","\uE007","\0"],g=()=>REDACTED;export function redactSensitiveText(n){return _(C(n??""),g)}export function sensitiveTextRanges(n){const e=E.find(s=>!n.includes(s))??E[E.length-1],r=_(n,s=>e.repeat(s.length)),t=[];for(let s=r.indexOf(e);s!==-1;s=r.indexOf(e,s)){let c=s;for(;r[c]===e;)c+=1;t.push({end:c,start:s}),s=c}return t}function _(n,e){return redactUntilUnchanged(n,r=>L(M(K(V(k(r,e),e),e),e),e),e)}export function redactUntilUnchanged(n,e,r=g){let t=n;for(let s=0;s<U;s+=1){const c=e(t);if(c===t)return t;t=c}return r(t)}function k(n,e){const r=[];let t=0;for(const s of n.matchAll(I)){if(s.index<t)continue;const c=s[1];if(!SENSITIVE_KEY_PATTERN.test(c))continue;const i=s.index+s[0].length;if(a.test(c)&&p(P,n,i))continue;const d=y(n,i,e);r.push(n.slice(t,i),d.text),t=d.end}return r.push(n.slice(t)),r.join("")}function y(n,e,r){const t=n[e];if(t==='"'||t==="'"){const o=u(n,e+1,t),f=r(n.slice(e+1,o));return n[o]===t?{end:o+1,text:`${t}${f}${t}`}:{end:o,text:`${t}${f}`}}let s=0;for(;n[e+s]==="\\";)s+=1;const c=n[e+s],i=s>0&&(c==='"'||c==="'")?x(c,s):0;if(i>0&&Number.isFinite(i)){const o=e+s+1,f=A(n,o,c,i),h=n.slice(e,o);return{end:f.end,text:f.closed?`${h}${r(n.slice(o,f.contentEnd))}${n.slice(f.contentEnd,f.end)}`:`${h}${r(n.slice(o,f.end))}`}}let d=n.length;if(p(m,n,e))d=u(n,e,"");else for(let o=e;o<n.length;o+=1)if(l.test(n[o])){d=o;break}return{end:d,text:r(n.slice(e,d))}}function p(n,e,r){return n.lastIndex=r,n.test(e)}function V(n,e){return n.replace(O,(r,t)=>`${t}${e(r.slice(t.length))}`)}function K(n,e){const r=[];let t=0;for(const s of n.matchAll(b)){if(s.index<t)continue;const c=s.index+s[0].length,i=u(n,c,s[1]);r.push(n.slice(t,c),e(n.slice(c,i))),t=i}return r.push(n.slice(t)),r.join("")}function L(n,e){const r=[];let t=0;for(const s of n.matchAll($)){if(s.index<t)continue;const c=s.index+s[0].length,i=u(n,c,"'");r.push(n.slice(t,c),e(n.slice(c,i))),t=i}return r.push(n.slice(t)),r.join("")}function u(n,e,r){for(let t=e;t<n.length;t+=1){const s=n[t];if(s==="\r"||s===`
|
|
3
|
+
`||s===r&&n[t-1]!=="\\")return t}return n.length}function R(n,e,r){let t=0;for(;e-t>r&&n[e-1-t]==="\\";)t+=1;return t}function A(n,e,r,t){const s=r==="'"?t-1:t,c=i=>({closed:!1,contentEnd:i,end:i});for(let i=e;i<n.length;i+=1){const d=n[i];if(d==="\r"||d===`
|
|
4
|
+
`)return c(i);if(d!==r&&d!=='"'&&d!=="n"&&d!=="r")continue;const o=R(n,i,e);if(d===r){const f=x(r,o);if(f===t)return{closed:!0,contentEnd:i-T(r,t),end:i+1};if(f<t)return c(i-T(r,f))}else if(d==='"'){const f=S(o);if(f<s)return c(i-T('"',f))}else if(o>0&&N(o)<=s)return c(i-2**(N(o)-1))}return c(n.length)}function x(n,e){if(n==='"')return S(e);if(e===0)return Number.POSITIVE_INFINITY;let r=e,t=0;for(;r%2===0;)r/=2,t+=1;return r===1?t+1:Number.POSITIVE_INFINITY}function T(n,e){return n==='"'?2**e-1:2**(e-1)}function S(n){let e=n,r=0;for(;e%2===1;)e=(e-1)/2,r+=1;return r}function N(n){let e=n,r=1;for(;e%2===0;)e/=2,r+=1;return r}function M(n,e){const r=[];let t=0;for(let s=n.indexOf('"');s!==-1;s=n.indexOf('"',s+1)){if(s<t)continue;const c=H(n,s);if(c===null)continue;const i=A(n,c.valueStart,'"',c.depth).contentEnd;r.push(n.slice(t,c.valueStart),e(n.slice(c.valueStart,i))),t=i,s=Math.max(s,t-1)}return r.push(n.slice(t)),r.join("")}function H(n,e){const r=S(R(n,e,0)),t=A(n,e+1,'"',r);if(!t.closed)return null;let s=t.end;for(;l.test(n[s]??"");)s+=1;const c=/^(?::|%3A)/iu.exec(n.slice(s,s+3))?.[0].length;if(c===void 0)return null;for(s+=c;l.test(n[s]??"");)s+=1;return s=J(n,s,2**r-1),s<0||!SENSITIVE_KEY_PATTERN.test(Y(n.slice(e+1,t.contentEnd),r))?null:{depth:r,valueStart:s}}function Y(n,e){let r=n;for(let t=0;t<=e&&r.includes("\\");t+=1)r=r.replace(w,(s,c,i)=>c===void 0?D[i]??i:String.fromCharCode(Number.parseInt(c,16)));return r}function J(n,e,r){for(let t=0;t<r;t+=1)if(n[e+t]!=="\\")return-1;return n[e+r]==='"'?e+r+1:-1}
|
|
@@ -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,
|
|
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
|
|
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": "
|
|
5
|
-
"bundleSha256": "
|
|
6
|
-
"packageLockSha256": "
|
|
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
|
|
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 t from"node:path";export function isPathWithin(r
|
|
1
|
+
import t from"node:path";export function isPathWithin(i,r){const e=t.relative(t.resolve(i),t.resolve(r));return e===""||!e.startsWith(`..${t.sep}`)&&e!==".."&&!t.isAbsolute(e)}export function posixPath(i){return i.split(t.sep).join("/")}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"node:fs";import n from"node:os";export function readPackageMetadata(){try{const
|
|
1
|
+
import t from"node:fs";import n from"node:os";import{isUnknownRecord as o}from"../../kernel/unknown-values.js";export function readPackageMetadata(){try{const e=new URL("../../../package.json",import.meta.url),r=JSON.parse(t.readFileSync(e,"utf8"));return o(r)&&typeof r.version=="string"?{...r,version:r.version}:{version:"unknown"}}catch{return{version:"unknown"}}}export function safeHostname(){try{return n.hostname()}catch{return null}}export function safeUsername(){try{return n.userInfo().username}catch{return process.env.USER||process.env.USERNAME||null}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
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
|
|
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}
|
package/dist/process/index.js
CHANGED
|
@@ -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 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import c from"node:fs";import r from"node:path";import{withProcessLock as a}from"./locks.js";const l=Object.freeze([".testkit","_locks"]),s="run-maintenance.lock",f=Symbol("ProductLifecycleFence"),n=new WeakSet;export function resolveProductLifecycleLockPath(e){const t=c.realpathSync.native(r.resolve(e));return r.join(t,...l,s)}export async function withProductLifecycleFence(e,t,u={}){const o=E(e),i=resolveProductLifecycleLockPath(o.productDir);return c.mkdirSync(r.dirname(i),{recursive:!0}),a(i,()=>L(o,t),{signal:u.signal,timeoutMs:null})}export function requireProductLifecycleFenceProductDir(e){if(!n.has(e))throw new Error("Product lifecycle mutation requires an active lifecycle fence");return e.productDir}function E(e){return Object.freeze({[f]:!0,productDir:c.realpathSync.native(r.resolve(e))})}async function L(e,t){n.add(e);try{return await t(e)}finally{n.delete(e)}}
|
package/dist/process/locks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{AsyncLocalStorage as
|
|
2
|
-
`,{encoding:"utf8",flag:"wx",mode:384}),i.writeFileSync(
|
|
3
|
-
`,{encoding:"utf8",flag:"wx",mode:384})}catch(
|
|
4
|
-
`,{encoding:"utf8",flag:"wx",mode:384}),i.rmSync(
|
|
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
|
|
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}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{execFileSync as
|
|
1
|
+
import{execFileSync as c}from"node:child_process";import d from"node:fs";import{DARWIN_PS_EXECUTABLE as f,HOST_POSIX_INSPECTION_ENVIRONMENT as l,requireWindowsHostPowerShellCommand as m}from"./host-inspection-command.js";import{formatWindowsKernelProcessIdentity as p,parseWindowsKernelProcessIdentity as w}from"./windows-process-identity.js";import{windowsOwnerExecutable as I}from"./windows-native.js";import{hasErrorCode as u}from"../kernel/error-serialization.js";const S=3e3,E=16*1024,T=8e3;let o;export function captureProcessCreationIdentity(e){const t=Number(e);if(!Number.isSafeInteger(t)||t<=0)return null;if(t===process.pid&&o!==void 0)return o;try{let r=null;return process.platform==="linux"?r=P(t):process.platform==="darwin"?r=y(t):process.platform==="win32"&&(r=g(t)),t===process.pid&&r!==null&&(o=r),r}catch{return null}}export function processCreationIdentityMatches(e,t){return observeProcessCreationIdentity(e,t)==="matches"}export function observeProcessCreationIdentity(e,t,r={}){const n=Number(e);if(!Number.isSafeInteger(n)||n<=0||typeof t!="string"||t.length===0)return"unknown";const i=(r.captureIdentity??captureProcessCreationIdentity)(n);return i!==null?i===t?"matches":"different":(r.inspectLiveness??inspectProcessLiveness)(n)==="absent"?"different":"unknown"}export function parseWindowsProcessCreationIdentity(e){return w(e)}function P(e){return parseLinuxProcessCreationIdentity(e,d.readFileSync(`/proc/${e.toString()}/stat`,"utf8"))}export function parseLinuxProcessCreationIdentity(e,t){if(!Number.isSafeInteger(e)||e<=0)throw new Error("Linux process stat identity requires a positive pid");const r=t.trim(),n=r.lastIndexOf(")"),i=r.indexOf(" ");if(n<0||i<1||Number(r.slice(0,i))!==e)throw new Error("Linux process stat identity is malformed");const s=r.slice(n+1).trim().split(/\s+/u)[19];if(!/^\d+$/u.test(s))throw new Error("Linux process stat start time is malformed");return`linux-proc-start:${s}`}function y(e){const t=runBoundedProcessIdentityQuery({args:["-p",e.toString(),"-o","pid=,lstart="],environment:l,executable:f,timeoutMs:S,windowsHide:!1});return parseDarwinProcessCreationIdentity(e,t)}export function parseDarwinProcessCreationIdentity(e,t){if(!Number.isSafeInteger(e)||e<=0)throw new Error("Darwin process start identity requires a positive pid");const r=t.trim().replace(/\s+/gu," "),n=/^(\d+) ((?:Sun|Mon|Tue|Wed|Thu|Fri|Sat) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (?:[1-9]|[12]\d|3[01]) (?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d \d{4})$/u.exec(r);if(n===null||Number(n[1])!==e)throw new Error("Darwin process start identity is malformed");return`darwin-ps-start:${n[2]}`}function g(e){const t=runBoundedProcessIdentityQuery({args:["process-identity",e.toString()],environment:m().environment,executable:I(),timeoutMs:T,windowsHide:!0});if(!/^\d+$/u.test(t))throw new Error("Windows process creation identity is malformed");return p(t)}export function windowsProcessCreationIdentityScript(e){if(!Number.isSafeInteger(e)||e<=0)throw new Error("Windows process creation identity script requires a positive pid");return`$ErrorActionPreference = "Stop"; $p = [Diagnostics.Process]::GetProcessById(${e.toString()}); try { $fileTime = [Int64]$p.StartTime.ToUniversalTime().ToFileTimeUtc(); if ($fileTime -le 0) { exit 3 }; [Console]::Write($fileTime.ToString([Globalization.CultureInfo]::InvariantCulture)) } finally { $p.Dispose() }`}export function runBoundedProcessIdentityQuery(e){if(!Number.isSafeInteger(e.timeoutMs)||e.timeoutMs<=0)throw new Error("Process identity query timeout must be a positive safe integer in milliseconds");return c(e.executable,[...e.args],{encoding:"utf8",env:e.environment,killSignal:"SIGKILL",maxBuffer:E,stdio:["ignore","pipe","ignore"],timeout:e.timeoutMs,windowsHide:e.windowsHide}).trim()}export function inspectProcessLiveness(e){try{return process.kill(e,0),"alive"}catch(t){return u(t,"ESRCH")?"absent":u(t,"EPERM")?"alive":"unknown"}}
|