@interf/compiler 0.22.2 → 0.50.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 +119 -282
- package/dist/bin-mcp.d.ts +2 -0
- package/dist/bin-mcp.js +63 -0
- package/dist/bin-runtime.d.ts +2 -0
- package/dist/bin-runtime.js +111 -0
- package/dist/cli/commands/agents.js +4 -35
- package/dist/cli/commands/auth.d.ts +20 -0
- package/dist/cli/commands/auth.js +161 -0
- package/dist/cli/commands/benchmark.d.ts +9 -0
- package/dist/cli/commands/benchmark.js +58 -0
- package/dist/cli/commands/build-plan.js +107 -139
- package/dist/cli/commands/build.d.ts +3 -4
- package/dist/cli/commands/build.js +16 -45
- package/dist/cli/commands/doctor.js +3 -3
- package/dist/cli/commands/graphs.d.ts +2 -0
- package/dist/cli/commands/graphs.js +344 -0
- package/dist/cli/commands/login.js +4 -6
- package/dist/cli/commands/logout.js +1 -1
- package/dist/cli/commands/mcp.d.ts +4 -2
- package/dist/cli/commands/mcp.js +846 -232
- package/dist/cli/commands/project.d.ts +2 -0
- package/dist/cli/commands/project.js +176 -0
- package/dist/cli/commands/reset.d.ts +3 -4
- package/dist/cli/commands/reset.js +10 -31
- package/dist/cli/commands/runs.js +136 -57
- package/dist/cli/commands/runtime.d.ts +24 -0
- package/dist/cli/commands/runtime.js +373 -0
- package/dist/cli/commands/status.d.ts +1 -0
- package/dist/cli/commands/status.js +35 -45
- package/dist/cli/commands/traces.d.ts +2 -0
- package/dist/cli/commands/traces.js +97 -0
- package/dist/cli/commands/wizard.js +171 -178
- package/dist/cli/index.d.ts +7 -4
- package/dist/cli/index.js +13 -7
- package/dist/cli/lib/http-client.d.ts +39 -0
- package/dist/cli/lib/http-client.js +73 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/packages/build-plans/authoring/brief.d.ts +538 -0
- package/dist/packages/build-plans/authoring/brief.js +89 -0
- package/dist/packages/build-plans/authoring/build-plan-authoring.d.ts +52 -11
- package/dist/packages/build-plans/authoring/build-plan-authoring.js +493 -46
- package/dist/packages/build-plans/authoring/build-plan-edit-session.d.ts +10 -1
- package/dist/packages/build-plans/authoring/build-plan-edit-session.js +27 -4
- package/dist/packages/build-plans/authoring/build-plan-improvement.d.ts +9 -6
- package/dist/packages/build-plans/authoring/build-plan-improvement.js +97 -46
- package/dist/packages/build-plans/authoring/lib/build-plan-edit-utils.d.ts +1 -0
- package/dist/packages/build-plans/authoring/lib/build-plan-edit-utils.js +7 -7
- package/dist/packages/build-plans/build-plan-resolution.d.ts +1 -1
- package/dist/packages/build-plans/build-plan-resolution.js +3 -3
- package/dist/packages/build-plans/index.d.ts +1 -1
- package/dist/packages/build-plans/index.js +1 -1
- package/dist/packages/build-plans/package/build-plan-definitions.d.ts +14 -13
- package/dist/packages/build-plans/package/build-plan-definitions.js +45 -42
- package/dist/packages/build-plans/package/build-plan-helpers.d.ts +3 -2
- package/dist/packages/build-plans/package/build-plan-helpers.js +27 -13
- package/dist/packages/build-plans/package/build-plan-review-paths.d.ts +5 -5
- package/dist/packages/build-plans/package/build-plan-review-paths.js +15 -15
- package/dist/packages/build-plans/package/build-plan-stage-runner.d.ts +5 -4
- package/dist/packages/build-plans/package/build-plan-stage-runner.js +23 -11
- package/dist/packages/build-plans/package/builtin-build-plan.d.ts +7 -8
- package/dist/packages/build-plans/package/builtin-build-plan.js +10 -11
- package/dist/packages/build-plans/package/context-interface.d.ts +14 -9
- package/dist/packages/build-plans/package/context-interface.js +14 -33
- package/dist/packages/build-plans/package/interf-build-plan-package.d.ts +6 -17
- package/dist/packages/build-plans/package/interf-build-plan-package.js +68 -64
- package/dist/packages/build-plans/package/local-build-plans.d.ts +21 -14
- package/dist/packages/build-plans/package/local-build-plans.js +105 -55
- package/dist/packages/build-plans/package/user-build-plans.js +1 -1
- package/dist/packages/contracts/index.d.ts +5 -2
- package/dist/packages/contracts/index.js +3 -1
- package/dist/packages/contracts/lib/context-graph-layer.d.ts +161 -0
- package/dist/packages/contracts/lib/context-graph-layer.js +216 -0
- package/dist/packages/contracts/lib/project-paths.d.ts +144 -0
- package/dist/packages/contracts/lib/project-paths.js +220 -0
- package/dist/packages/contracts/lib/project-schema.d.ts +423 -0
- package/dist/packages/contracts/lib/project-schema.js +138 -0
- package/dist/packages/contracts/lib/schema.d.ts +1273 -81
- package/dist/packages/contracts/lib/schema.js +675 -79
- package/dist/packages/contracts/utils/filesystem.d.ts +1 -0
- package/dist/packages/contracts/utils/filesystem.js +29 -1
- package/dist/packages/contracts/utils/parse.js +67 -0
- package/dist/packages/projects/index.d.ts +6 -0
- package/dist/packages/{project → projects}/index.js +0 -3
- package/dist/packages/{project → projects}/interf-detect.d.ts +12 -12
- package/dist/packages/{project → projects}/interf-detect.js +56 -50
- package/dist/packages/projects/interf.d.ts +2 -0
- package/dist/packages/projects/interf.js +1 -0
- package/dist/packages/projects/lib/schema.d.ts +77 -0
- package/dist/packages/projects/lib/schema.js +91 -0
- package/dist/packages/projects/source-config.d.ts +53 -0
- package/dist/packages/projects/source-config.js +339 -0
- package/dist/packages/projects/source-folders.d.ts +11 -0
- package/dist/packages/{project → projects}/source-folders.js +26 -26
- package/dist/packages/{engine → runtime}/action-planner.d.ts +1 -1
- package/dist/packages/{engine → runtime}/action-planner.js +20 -22
- package/dist/packages/runtime/action-values.d.ts +1 -0
- package/dist/packages/runtime/action-values.js +1 -0
- package/dist/packages/runtime/actions/errors.d.ts +2 -0
- package/dist/packages/runtime/actions/errors.js +12 -0
- package/dist/packages/runtime/actions/fields.d.ts +86 -0
- package/dist/packages/runtime/actions/form-builders.d.ts +14 -0
- package/dist/packages/runtime/actions/form-builders.js +667 -0
- package/dist/packages/runtime/actions/form-validators.d.ts +8 -0
- package/dist/packages/runtime/actions/form-validators.js +134 -0
- package/dist/packages/runtime/actions/helpers.d.ts +11 -0
- package/dist/packages/runtime/actions/helpers.js +80 -0
- package/dist/packages/runtime/actions/index.d.ts +8 -0
- package/dist/packages/runtime/actions/index.js +11 -0
- package/dist/packages/runtime/actions/registry.d.ts +64 -0
- package/dist/packages/runtime/actions/registry.js +62 -0
- package/dist/packages/runtime/actions/requests.d.ts +45 -0
- package/dist/packages/runtime/actions/requests.js +164 -0
- package/dist/packages/runtime/actions/schemas.d.ts +161 -0
- package/dist/packages/runtime/actions/schemas.js +37 -0
- package/dist/packages/runtime/agent-handoff.d.ts +11 -0
- package/dist/packages/runtime/agent-handoff.js +102 -0
- package/dist/packages/{engine → runtime}/agents/index.d.ts +1 -2
- package/dist/packages/{engine → runtime}/agents/index.js +1 -2
- package/dist/packages/runtime/agents/lib/args.d.ts +14 -0
- package/dist/packages/runtime/agents/lib/args.js +24 -0
- package/dist/packages/{engine → runtime}/agents/lib/constants.d.ts +4 -1
- package/dist/packages/runtime/agents/lib/constants.js +13 -0
- package/dist/packages/runtime/agents/lib/context-graph-bootstrap.d.ts +3 -0
- package/dist/packages/{engine/agents/lib/verifiable-context-bootstrap.js → runtime/agents/lib/context-graph-bootstrap.js} +5 -6
- package/dist/packages/{engine → runtime}/agents/lib/detection.d.ts +5 -0
- package/dist/packages/{engine → runtime}/agents/lib/detection.js +16 -7
- package/dist/packages/{engine → runtime}/agents/lib/execution-profile.d.ts +14 -0
- package/dist/packages/{engine → runtime}/agents/lib/execution-profile.js +31 -14
- package/dist/packages/{engine → runtime}/agents/lib/execution.js +22 -6
- package/dist/packages/{engine → runtime}/agents/lib/executors.d.ts +1 -0
- package/dist/packages/{engine → runtime}/agents/lib/executors.js +11 -2
- package/dist/packages/runtime/agents/lib/logs.d.ts +12 -0
- package/dist/packages/runtime/agents/lib/logs.js +41 -0
- package/dist/packages/{engine → runtime}/agents/lib/preflight.js +19 -14
- package/dist/packages/runtime/agents/lib/render.d.ts +26 -0
- package/dist/packages/{engine → runtime}/agents/lib/render.js +48 -22
- package/dist/packages/runtime/agents/lib/shell-fs.d.ts +18 -0
- package/dist/packages/runtime/agents/lib/shell-fs.js +190 -0
- package/dist/packages/runtime/agents/lib/shell-paths.d.ts +16 -0
- package/dist/packages/runtime/agents/lib/shell-paths.js +63 -0
- package/dist/packages/runtime/agents/lib/shell-projection.d.ts +25 -0
- package/dist/packages/runtime/agents/lib/shell-projection.js +314 -0
- package/dist/packages/runtime/agents/lib/shell-templates.d.ts +30 -0
- package/dist/packages/runtime/agents/lib/shell-templates.js +494 -0
- package/dist/packages/runtime/agents/lib/shell-workspace.d.ts +17 -0
- package/dist/packages/runtime/agents/lib/shell-workspace.js +70 -0
- package/dist/packages/runtime/agents/lib/shells.d.ts +92 -0
- package/dist/packages/runtime/agents/lib/shells.js +509 -0
- package/dist/packages/runtime/agents/lib/source-context-scan.d.ts +10 -0
- package/dist/packages/runtime/agents/lib/source-context-scan.js +388 -0
- package/dist/packages/{engine → runtime}/agents/lib/status.js +1 -14
- package/dist/packages/runtime/agents/lib/string-utils.d.ts +16 -0
- package/dist/packages/runtime/agents/lib/string-utils.js +36 -0
- package/dist/packages/{engine → runtime}/agents/lib/types.d.ts +1 -0
- package/dist/packages/{engine → runtime}/agents/lib/user-config.d.ts +8 -2
- package/dist/packages/{engine → runtime}/agents/lib/user-config.js +8 -2
- package/dist/packages/runtime/agents/providers/claude-code.d.ts +13 -0
- package/dist/packages/runtime/agents/providers/claude-code.js +45 -0
- package/dist/packages/runtime/agents/providers/codex.d.ts +17 -0
- package/dist/packages/runtime/agents/providers/codex.js +66 -0
- package/dist/packages/runtime/agents/providers/cursor.d.ts +9 -0
- package/dist/packages/runtime/agents/providers/cursor.js +24 -0
- package/dist/packages/runtime/agents/providers/index.d.ts +9 -0
- package/dist/packages/runtime/agents/providers/index.js +31 -0
- package/dist/packages/runtime/agents/providers/types.d.ts +50 -0
- package/dist/packages/{engine → runtime}/agents/registry.d.ts +13 -2
- package/dist/packages/{engine → runtime}/agents/registry.js +48 -10
- package/dist/packages/{engine → runtime}/agents/role-executors.d.ts +1 -1
- package/dist/packages/{engine → runtime}/agents/role-executors.js +9 -7
- package/dist/packages/{engine → runtime}/agents/role-router.js +7 -5
- package/dist/packages/runtime/auth/account-context.d.ts +52 -0
- package/dist/packages/runtime/auth/account-context.js +68 -0
- package/dist/packages/runtime/auth/auth-flow.d.ts +73 -0
- package/dist/packages/runtime/auth/auth-flow.js +189 -0
- package/dist/packages/runtime/auth/jwt-validator.d.ts +58 -0
- package/dist/packages/runtime/auth/jwt-validator.js +86 -0
- package/dist/packages/runtime/auth/keychain.d.ts +35 -0
- package/dist/packages/runtime/auth/keychain.js +85 -0
- package/dist/packages/runtime/auth/session-store.d.ts +38 -0
- package/dist/packages/runtime/auth/session-store.js +96 -0
- package/dist/packages/runtime/auth/workos-client.d.ts +58 -0
- package/dist/packages/runtime/auth/workos-client.js +87 -0
- package/dist/packages/runtime/benchmark-question-draft.d.ts +23 -0
- package/dist/packages/runtime/benchmark-question-draft.js +153 -0
- package/dist/packages/runtime/build/artifact-counts.d.ts +1 -0
- package/dist/packages/{engine → runtime}/build/artifact-counts.js +5 -9
- package/dist/packages/{engine → runtime}/build/artifact-status.d.ts +6 -6
- package/dist/packages/{engine → runtime}/build/artifact-status.js +26 -24
- package/dist/packages/runtime/build/atomic-fs.d.ts +3 -0
- package/dist/packages/runtime/build/atomic-fs.js +95 -0
- package/dist/packages/runtime/build/billing-events.d.ts +78 -0
- package/dist/packages/{engine → runtime}/build/billing-events.js +17 -19
- package/dist/packages/runtime/build/build-evidence.d.ts +16 -0
- package/dist/packages/runtime/build/build-evidence.js +179 -0
- package/dist/packages/{engine → runtime}/build/build-pipeline.d.ts +12 -8
- package/dist/packages/runtime/build/build-pipeline.js +388 -0
- package/dist/packages/{engine → runtime}/build/build-plan-primitives.d.ts +1 -1
- package/dist/packages/{engine → runtime}/build/build-plan-primitives.js +0 -1
- package/dist/packages/runtime/build/build-plan-runs.d.ts +14 -0
- package/dist/packages/runtime/build/build-plan-runs.js +31 -0
- package/dist/packages/runtime/build/build-stage-plan.d.ts +16 -0
- package/dist/packages/runtime/build/build-stage-plan.js +101 -0
- package/dist/packages/{engine → runtime}/build/build-stage-runner.d.ts +2 -1
- package/dist/packages/runtime/build/build-stage-runner.js +302 -0
- package/dist/packages/{engine → runtime}/build/build-target.d.ts +7 -4
- package/dist/packages/runtime/build/build-target.js +40 -0
- package/dist/packages/{engine → runtime}/build/check-evaluator.d.ts +14 -16
- package/dist/packages/runtime/build/check-evaluator.js +1226 -0
- package/dist/packages/runtime/build/context-graph-paths.d.ts +64 -0
- package/dist/packages/runtime/build/context-graph-paths.js +160 -0
- package/dist/packages/runtime/build/context-graph-schema.d.ts +19 -0
- package/dist/packages/runtime/build/context-graph-schema.js +39 -0
- package/dist/packages/{engine → runtime}/build/discovery.d.ts +2 -2
- package/dist/packages/{engine → runtime}/build/discovery.js +4 -4
- package/dist/packages/{engine → runtime}/build/index.d.ts +7 -5
- package/dist/packages/{engine → runtime}/build/index.js +7 -5
- package/dist/packages/runtime/build/inspect-map.d.ts +10 -0
- package/dist/packages/runtime/build/inspect-map.js +270 -0
- package/dist/packages/{engine → runtime}/build/lib/schema.d.ts +449 -123
- package/dist/packages/runtime/build/lib/schema.js +494 -0
- package/dist/packages/runtime/build/native-entrypoint.d.ts +2 -0
- package/dist/packages/runtime/build/native-entrypoint.js +286 -0
- package/dist/packages/runtime/build/reset.d.ts +2 -0
- package/dist/packages/runtime/build/reset.js +62 -0
- package/dist/packages/{engine → runtime}/build/runtime-contracts.js +13 -7
- package/dist/packages/runtime/build/runtime-inventory.d.ts +7 -0
- package/dist/packages/{engine → runtime}/build/runtime-inventory.js +3 -3
- package/dist/packages/runtime/build/runtime-log-paths.d.ts +3 -0
- package/dist/packages/runtime/build/runtime-log-paths.js +16 -0
- package/dist/packages/{engine → runtime}/build/runtime-prompt.js +12 -9
- package/dist/packages/{engine → runtime}/build/runtime-reconcile.d.ts +1 -1
- package/dist/packages/{engine → runtime}/build/runtime-reconcile.js +25 -21
- package/dist/packages/runtime/build/runtime-runs.d.ts +10 -0
- package/dist/packages/runtime/build/runtime-runs.js +318 -0
- package/dist/packages/{engine → runtime}/build/runtime-types.d.ts +9 -6
- package/dist/packages/runtime/build/runtime-types.js +1 -0
- package/dist/packages/runtime/build/runtime.d.ts +8 -0
- package/dist/packages/runtime/build/runtime.js +7 -0
- package/dist/packages/runtime/build/source-files.d.ts +58 -0
- package/dist/packages/runtime/build/source-files.js +193 -0
- package/dist/packages/runtime/build/source-inventory.d.ts +28 -0
- package/dist/packages/runtime/build/source-inventory.js +512 -0
- package/dist/packages/runtime/build/source-manifest.d.ts +63 -0
- package/dist/packages/runtime/build/source-manifest.js +220 -0
- package/dist/packages/runtime/build/stage-evidence.d.ts +22 -0
- package/dist/packages/runtime/build/stage-evidence.js +386 -0
- package/dist/packages/runtime/build/stage-manifest.d.ts +45 -0
- package/dist/packages/runtime/build/stage-manifest.js +1125 -0
- package/dist/packages/runtime/build/stage-reuse.d.ts +11 -0
- package/dist/packages/runtime/build/stage-reuse.js +154 -0
- package/dist/packages/runtime/build/stage-session.d.ts +81 -0
- package/dist/packages/runtime/build/stage-session.js +308 -0
- package/dist/packages/runtime/build/state-artifacts.d.ts +9 -0
- package/dist/packages/runtime/build/state-artifacts.js +14 -0
- package/dist/packages/runtime/build/state-health.d.ts +4 -0
- package/dist/packages/{engine → runtime}/build/state-health.js +21 -26
- package/dist/packages/runtime/build/state-io.d.ts +12 -0
- package/dist/packages/runtime/build/state-io.js +118 -0
- package/dist/packages/runtime/build/state-view.d.ts +5 -0
- package/dist/packages/runtime/build/state-view.js +121 -0
- package/dist/packages/runtime/build/state.d.ts +7 -0
- package/dist/packages/runtime/build/state.js +12 -0
- package/dist/packages/runtime/build/summary-coverage-index.d.ts +21 -0
- package/dist/packages/runtime/build/summary-coverage-index.js +189 -0
- package/dist/packages/runtime/build/traces.d.ts +30 -0
- package/dist/packages/runtime/build/traces.js +133 -0
- package/dist/packages/{engine/build/validate-verifiable-context.d.ts → runtime/build/validate-context-graph.d.ts} +6 -6
- package/dist/packages/{engine/build/validate-verifiable-context.js → runtime/build/validate-context-graph.js} +49 -36
- package/dist/packages/{engine → runtime}/build/validate.d.ts +5 -5
- package/dist/packages/{engine → runtime}/build/validate.js +26 -26
- package/dist/packages/{engine → runtime}/client.d.ts +18 -18
- package/dist/packages/{engine → runtime}/client.js +48 -36
- package/dist/packages/{engine → runtime}/connection-config.d.ts +3 -2
- package/dist/packages/{engine → runtime}/connection-config.js +9 -8
- package/dist/packages/runtime/context-checks.d.ts +10 -0
- package/dist/packages/runtime/context-checks.js +127 -0
- package/dist/packages/runtime/context-graph-scaffold.d.ts +9 -0
- package/dist/packages/runtime/context-graph-scaffold.js +135 -0
- package/dist/packages/runtime/context-graph-semantic-graph.d.ts +9 -0
- package/dist/packages/runtime/context-graph-semantic-graph.js +416 -0
- package/dist/packages/runtime/entitlement-guard.d.ts +43 -0
- package/dist/packages/runtime/entitlement-guard.js +70 -0
- package/dist/packages/{engine → runtime}/execution/index.d.ts +2 -2
- package/dist/packages/{engine → runtime}/execution/index.js +1 -1
- package/dist/packages/{engine → runtime}/execution/lib/schema.d.ts +272 -191
- package/dist/packages/{engine → runtime}/execution/lib/schema.js +35 -32
- package/dist/packages/runtime/index.d.ts +29 -0
- package/dist/packages/runtime/index.js +21 -0
- package/dist/packages/runtime/instance-paths.d.ts +30 -0
- package/dist/packages/runtime/instance-paths.js +29 -0
- package/dist/packages/runtime/native-run-handlers.d.ts +63 -0
- package/dist/packages/{engine → runtime}/native-run-handlers.js +217 -166
- package/dist/packages/runtime/plan-artifact-contract.d.ts +17 -0
- package/dist/packages/runtime/plan-artifact-contract.js +42 -0
- package/dist/packages/runtime/project-entries.d.ts +11 -0
- package/dist/packages/runtime/project-entries.js +49 -0
- package/dist/packages/runtime/project-source-state.d.ts +26 -0
- package/dist/packages/runtime/project-source-state.js +56 -0
- package/dist/packages/runtime/project-store.d.ts +90 -0
- package/dist/packages/runtime/project-store.js +195 -0
- package/dist/packages/runtime/requested-artifacts.d.ts +7 -0
- package/dist/packages/{engine → runtime}/requested-artifacts.js +23 -1
- package/dist/packages/{engine → runtime}/run-observability.d.ts +2 -1
- package/dist/packages/{engine → runtime}/run-observability.js +174 -87
- package/dist/packages/runtime/runtime-action-proposals.d.ts +7 -0
- package/dist/packages/runtime/runtime-action-proposals.js +542 -0
- package/dist/packages/runtime/runtime-build-plans.d.ts +5 -0
- package/dist/packages/runtime/runtime-build-plans.js +175 -0
- package/dist/packages/runtime/runtime-build-runs.d.ts +47 -0
- package/dist/packages/runtime/runtime-build-runs.js +555 -0
- package/dist/packages/runtime/runtime-caches.d.ts +117 -0
- package/dist/packages/runtime/runtime-caches.js +266 -0
- package/dist/packages/{engine → runtime}/runtime-event-applier.d.ts +3 -1
- package/dist/packages/{engine → runtime}/runtime-event-applier.js +53 -17
- package/dist/packages/runtime/runtime-executor.d.ts +22 -0
- package/dist/packages/runtime/runtime-executor.js +131 -0
- package/dist/packages/runtime/runtime-jobs.d.ts +13 -0
- package/dist/packages/runtime/runtime-jobs.js +463 -0
- package/dist/packages/runtime/runtime-observability.d.ts +11 -0
- package/dist/packages/runtime/runtime-observability.js +39 -0
- package/dist/packages/{engine → runtime}/runtime-persistence.d.ts +9 -18
- package/dist/packages/{engine → runtime}/runtime-persistence.js +25 -25
- package/dist/packages/runtime/runtime-project-mutations.d.ts +7 -0
- package/dist/packages/runtime/runtime-project-mutations.js +65 -0
- package/dist/packages/runtime/runtime-project-reads.d.ts +18 -0
- package/dist/packages/runtime/runtime-project-reads.js +574 -0
- package/dist/packages/runtime/runtime-proposal-helpers.d.ts +22 -0
- package/dist/packages/runtime/runtime-proposal-helpers.js +223 -0
- package/dist/packages/{engine → runtime}/runtime-resource-builders.d.ts +23 -16
- package/dist/packages/{engine → runtime}/runtime-resource-builders.js +58 -46
- package/dist/packages/runtime/runtime-status.d.ts +14 -0
- package/dist/packages/runtime/runtime-status.js +15 -0
- package/dist/packages/runtime/runtime-verify-runs.d.ts +84 -0
- package/dist/packages/runtime/runtime-verify-runs.js +296 -0
- package/dist/packages/runtime/runtime.d.ts +1582 -0
- package/dist/packages/runtime/runtime.js +431 -0
- package/dist/packages/runtime/schemas/actions.d.ts +1206 -0
- package/dist/packages/runtime/schemas/actions.js +117 -0
- package/dist/packages/runtime/schemas/agents.d.ts +104 -0
- package/dist/packages/runtime/schemas/agents.js +74 -0
- package/dist/packages/runtime/schemas/build-plans.d.ts +1132 -0
- package/dist/packages/runtime/schemas/build-plans.js +141 -0
- package/dist/packages/runtime/schemas/context-graphs.d.ts +1522 -0
- package/dist/packages/runtime/schemas/context-graphs.js +110 -0
- package/dist/packages/runtime/schemas/files.d.ts +227 -0
- package/dist/packages/runtime/schemas/files.js +28 -0
- package/dist/packages/runtime/schemas/index.d.ts +9 -0
- package/dist/packages/runtime/schemas/index.js +13 -0
- package/dist/packages/runtime/schemas/instance.d.ts +141 -0
- package/dist/packages/runtime/schemas/instance.js +143 -0
- package/dist/packages/runtime/schemas/jobs.d.ts +339 -0
- package/dist/packages/runtime/schemas/jobs.js +107 -0
- package/dist/packages/runtime/schemas/projects.d.ts +366 -0
- package/dist/packages/runtime/schemas/projects.js +160 -0
- package/dist/packages/runtime/schemas/runs.d.ts +3445 -0
- package/dist/packages/runtime/schemas/runs.js +115 -0
- package/dist/packages/runtime/service/index.d.ts +3 -0
- package/dist/packages/runtime/service/index.js +3 -0
- package/dist/packages/runtime/service/openapi.d.ts +7 -0
- package/dist/packages/runtime/service/openapi.js +118 -0
- package/dist/packages/runtime/service/operations.d.ts +3011 -0
- package/dist/packages/runtime/service/operations.js +375 -0
- package/dist/packages/runtime/service/routes.d.ts +114 -0
- package/dist/packages/runtime/service/routes.js +128 -0
- package/dist/packages/runtime/service/server-api-files.d.ts +10 -0
- package/dist/packages/runtime/service/server-api-files.js +85 -0
- package/dist/packages/runtime/service/server-app-boot.d.ts +4 -0
- package/dist/packages/runtime/service/server-app-boot.js +46 -0
- package/dist/packages/runtime/service/server-guards.d.ts +63 -0
- package/dist/packages/runtime/service/server-guards.js +181 -0
- package/dist/packages/runtime/service/server-helpers.d.ts +38 -0
- package/dist/packages/runtime/service/server-helpers.js +108 -0
- package/dist/packages/runtime/service/server-instance-helpers.d.ts +30 -0
- package/dist/packages/runtime/service/server-instance-helpers.js +114 -0
- package/dist/packages/runtime/service/server-routes-action-proposals.d.ts +3 -0
- package/dist/packages/runtime/service/server-routes-action-proposals.js +45 -0
- package/dist/packages/runtime/service/server-routes-agents.d.ts +4 -0
- package/dist/packages/runtime/service/server-routes-agents.js +132 -0
- package/dist/packages/runtime/service/server-routes-auth.d.ts +33 -0
- package/dist/packages/runtime/service/server-routes-auth.js +138 -0
- package/dist/packages/runtime/service/server-routes-build-plans.d.ts +3 -0
- package/dist/packages/runtime/service/server-routes-build-plans.js +86 -0
- package/dist/packages/runtime/service/server-routes-discovery.d.ts +4 -0
- package/dist/packages/runtime/service/server-routes-discovery.js +196 -0
- package/dist/packages/runtime/service/server-routes-events.d.ts +5 -0
- package/dist/packages/runtime/service/server-routes-events.js +99 -0
- package/dist/packages/runtime/service/server-routes-project-context.d.ts +9 -0
- package/dist/packages/runtime/service/server-routes-project-context.js +287 -0
- package/dist/packages/runtime/service/server-routes-project-jobs.d.ts +9 -0
- package/dist/packages/runtime/service/server-routes-project-jobs.js +137 -0
- package/dist/packages/runtime/service/server-routes-project-runs.d.ts +14 -0
- package/dist/packages/runtime/service/server-routes-project-runs.js +88 -0
- package/dist/packages/runtime/service/server-routes-projects.d.ts +4 -0
- package/dist/packages/runtime/service/server-routes-projects.js +96 -0
- package/dist/packages/runtime/service/server-routes-runs.d.ts +3 -0
- package/dist/packages/runtime/service/server-routes-runs.js +119 -0
- package/dist/packages/runtime/service/server.d.ts +37 -0
- package/dist/packages/runtime/service/server.js +300 -0
- package/dist/packages/{engine → runtime/service}/service-registry.d.ts +5 -5
- package/dist/packages/{engine → runtime/service}/service-registry.js +7 -7
- package/dist/packages/runtime/verify/benchmark-run.d.ts +81 -0
- package/dist/packages/runtime/verify/benchmark-run.js +303 -0
- package/dist/packages/{engine → runtime}/verify/index.d.ts +2 -2
- package/dist/packages/{engine → runtime}/verify/index.js +1 -1
- package/dist/packages/{engine → runtime}/verify/lib/schema.d.ts +83 -16
- package/dist/packages/{engine → runtime}/verify/lib/schema.js +38 -18
- package/dist/packages/runtime/verify/test-file-guard.d.ts +2 -0
- package/dist/packages/runtime/verify/test-file-guard.js +29 -0
- package/dist/packages/{engine → runtime}/verify/verify-execution.d.ts +7 -0
- package/dist/packages/{engine → runtime}/verify/verify-execution.js +119 -45
- package/dist/packages/{engine → runtime}/verify/verify-paths.d.ts +5 -4
- package/dist/packages/runtime/verify/verify-paths.js +65 -0
- package/dist/packages/{engine → runtime}/verify/verify-sandbox.d.ts +1 -1
- package/dist/packages/runtime/verify/verify-sandbox.js +88 -0
- package/dist/packages/{engine → runtime}/verify/verify-specs.d.ts +2 -0
- package/dist/packages/runtime/verify/verify-specs.js +126 -0
- package/dist/packages/runtime/verify/verify-targets.d.ts +5 -0
- package/dist/packages/{engine → runtime}/verify/verify-targets.js +12 -12
- package/dist/packages/runtime/verify/verify-types.js +1 -0
- package/dist/packages/{engine → runtime}/verify/verify.d.ts +1 -1
- package/dist/packages/{engine → runtime}/verify/verify.js +1 -1
- package/dist/packages/runtime/wire-schemas.d.ts +18 -0
- package/dist/packages/runtime/wire-schemas.js +27 -0
- package/package.json +32 -30
- package/public-repo/CONTRIBUTING.md +16 -18
- package/public-repo/README.md +119 -282
- package/public-repo/SECURITY.md +3 -4
- package/public-repo/build-plans/interf-default/README.md +24 -16
- package/public-repo/build-plans/interf-default/build/stages/entrypoint/SKILL.md +74 -0
- package/public-repo/build-plans/interf-default/build/stages/knowledge/SKILL.md +95 -0
- package/public-repo/build-plans/interf-default/build/stages/summarize/SKILL.md +49 -4
- package/public-repo/build-plans/interf-default/build-plan.json +49 -39
- package/public-repo/build-plans/interf-default/build-plan.schema.json +59 -33
- package/public-repo/build-plans/interf-default/improve/SKILL.md +3 -3
- package/public-repo/build-plans/interf-default/use/query/SKILL.md +18 -11
- package/public-repo/openapi/local-service.openapi.json +14227 -0
- package/public-repo/skills/interf/SKILL.md +508 -187
- package/dist/cli/commands/prep.d.ts +0 -2
- package/dist/cli/commands/prep.js +0 -240
- package/dist/cli/commands/test.d.ts +0 -10
- package/dist/cli/commands/test.js +0 -85
- package/dist/cli/commands/web.d.ts +0 -2
- package/dist/cli/commands/web.js +0 -286
- package/dist/interf-ui/404.html +0 -1
- package/dist/interf-ui/__next.__PAGE__.txt +0 -10
- package/dist/interf-ui/__next._full.txt +0 -20
- package/dist/interf-ui/__next._head.txt +0 -5
- package/dist/interf-ui/__next._index.txt +0 -5
- package/dist/interf-ui/__next._tree.txt +0 -5
- package/dist/interf-ui/_next/static/--reS3xBzM5zc6QxNjZd6/_buildManifest.js +0 -11
- package/dist/interf-ui/_next/static/--reS3xBzM5zc6QxNjZd6/_clientMiddlewareManifest.js +0 -1
- package/dist/interf-ui/_next/static/--reS3xBzM5zc6QxNjZd6/_ssgManifest.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0.tjb6f4golw..css +0 -3
- package/dist/interf-ui/_next/static/chunks/03~yq9q893hmn.js +0 -1
- package/dist/interf-ui/_next/static/chunks/085-n_jv2ng_q.css +0 -1
- package/dist/interf-ui/_next/static/chunks/0dn41fa_zvgsl.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0g-ea0zj5d-0k.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0gwqglc4iz583.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0haldgm65ve6l.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0nv3am99vjzn4.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0s77gt_o4jwtx.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0y5z3t-z1c8ks.js.map +0 -5
- package/dist/interf-ui/_next/static/chunks/0~a36ujuzpaz..js +0 -116
- package/dist/interf-ui/_next/static/chunks/10jeodxe4nkgj.js +0 -31
- package/dist/interf-ui/_next/static/chunks/119h2rouych2t.js +0 -1
- package/dist/interf-ui/_next/static/chunks/13c8b~m8knjsf.js +0 -1
- package/dist/interf-ui/_next/static/chunks/14dznb2qpt-ho.js +0 -91
- package/dist/interf-ui/_next/static/chunks/15z_en80lrq-3.js +0 -5
- package/dist/interf-ui/_next/static/chunks/turbopack-0p.pvcjrtq-jh.js +0 -1
- package/dist/interf-ui/_next/static/chunks/turbopack-0usj_75.8frlw.js +0 -1
- package/dist/interf-ui/_next/static/chunks/turbopack-worker-0sjn--fhq~1cg.js +0 -1
- package/dist/interf-ui/_next/static/media/GeistMono_Variable.p.17jn9btb_52pq.woff2 +0 -0
- package/dist/interf-ui/_next/static/media/Geist_Variable-s.p.0-te~ja_gpvcf.woff2 +0 -0
- package/dist/interf-ui/_next/static/media/worker.102zas1s52_pf.js +0 -109
- package/dist/interf-ui/_not-found/__next._full.txt +0 -15
- package/dist/interf-ui/_not-found/__next._head.txt +0 -5
- package/dist/interf-ui/_not-found/__next._index.txt +0 -5
- package/dist/interf-ui/_not-found/__next._not-found.__PAGE__.txt +0 -5
- package/dist/interf-ui/_not-found/__next._not-found.txt +0 -5
- package/dist/interf-ui/_not-found/__next._tree.txt +0 -2
- package/dist/interf-ui/_not-found.html +0 -1
- package/dist/interf-ui/_not-found.txt +0 -15
- package/dist/interf-ui/index.html +0 -1
- package/dist/interf-ui/index.txt +0 -20
- package/dist/packages/contracts/lib/preparation-paths.d.ts +0 -117
- package/dist/packages/contracts/lib/preparation-paths.js +0 -177
- package/dist/packages/engine/action-definitions.d.ts +0 -407
- package/dist/packages/engine/action-definitions.js +0 -1158
- package/dist/packages/engine/action-values.d.ts +0 -1
- package/dist/packages/engine/action-values.js +0 -1
- package/dist/packages/engine/agents/lib/args.d.ts +0 -4
- package/dist/packages/engine/agents/lib/args.js +0 -52
- package/dist/packages/engine/agents/lib/chart-guidance.d.ts +0 -1
- package/dist/packages/engine/agents/lib/chart-guidance.js +0 -8
- package/dist/packages/engine/agents/lib/constants.js +0 -28
- package/dist/packages/engine/agents/lib/logs.d.ts +0 -2
- package/dist/packages/engine/agents/lib/logs.js +0 -17
- package/dist/packages/engine/agents/lib/render.d.ts +0 -8
- package/dist/packages/engine/agents/lib/schema.d.ts +0 -8
- package/dist/packages/engine/agents/lib/schema.js +0 -7
- package/dist/packages/engine/agents/lib/shells.d.ts +0 -74
- package/dist/packages/engine/agents/lib/shells.js +0 -1052
- package/dist/packages/engine/agents/lib/verifiable-context-bootstrap.d.ts +0 -3
- package/dist/packages/engine/build/artifact-counts.d.ts +0 -1
- package/dist/packages/engine/build/billing-events.d.ts +0 -89
- package/dist/packages/engine/build/build-pipeline.js +0 -175
- package/dist/packages/engine/build/build-plan-runs.d.ts +0 -14
- package/dist/packages/engine/build/build-plan-runs.js +0 -31
- package/dist/packages/engine/build/build-stage-plan.d.ts +0 -16
- package/dist/packages/engine/build/build-stage-plan.js +0 -100
- package/dist/packages/engine/build/build-stage-runner.js +0 -94
- package/dist/packages/engine/build/build-target.js +0 -16
- package/dist/packages/engine/build/check-evaluator.js +0 -298
- package/dist/packages/engine/build/lib/schema.js +0 -316
- package/dist/packages/engine/build/reset.d.ts +0 -2
- package/dist/packages/engine/build/reset.js +0 -74
- package/dist/packages/engine/build/runtime-inventory.d.ts +0 -7
- package/dist/packages/engine/build/runtime-paths.d.ts +0 -8
- package/dist/packages/engine/build/runtime-paths.js +0 -26
- package/dist/packages/engine/build/runtime-runs.d.ts +0 -10
- package/dist/packages/engine/build/runtime-runs.js +0 -224
- package/dist/packages/engine/build/runtime.d.ts +0 -5
- package/dist/packages/engine/build/runtime.js +0 -4
- package/dist/packages/engine/build/source-files.d.ts +0 -46
- package/dist/packages/engine/build/source-files.js +0 -149
- package/dist/packages/engine/build/state-artifacts.d.ts +0 -9
- package/dist/packages/engine/build/state-artifacts.js +0 -14
- package/dist/packages/engine/build/state-health.d.ts +0 -4
- package/dist/packages/engine/build/state-io.d.ts +0 -11
- package/dist/packages/engine/build/state-io.js +0 -82
- package/dist/packages/engine/build/state-paths.d.ts +0 -5
- package/dist/packages/engine/build/state-paths.js +0 -16
- package/dist/packages/engine/build/state-view.d.ts +0 -5
- package/dist/packages/engine/build/state-view.js +0 -94
- package/dist/packages/engine/build/state.d.ts +0 -7
- package/dist/packages/engine/build/state.js +0 -12
- package/dist/packages/engine/build/validate-helpers.d.ts +0 -12
- package/dist/packages/engine/build/validate-helpers.js +0 -41
- package/dist/packages/engine/build/verifiable-context-paths.d.ts +0 -47
- package/dist/packages/engine/build/verifiable-context-paths.js +0 -121
- package/dist/packages/engine/build/verifiable-context-schema.d.ts +0 -21
- package/dist/packages/engine/build/verifiable-context-schema.js +0 -126
- package/dist/packages/engine/cloud-seams.d.ts +0 -115
- package/dist/packages/engine/cloud-seams.js +0 -84
- package/dist/packages/engine/index.d.ts +0 -22
- package/dist/packages/engine/index.js +0 -15
- package/dist/packages/engine/instance-paths.d.ts +0 -106
- package/dist/packages/engine/instance-paths.js +0 -171
- package/dist/packages/engine/lib/schema.d.ts +0 -6304
- package/dist/packages/engine/lib/schema.js +0 -730
- package/dist/packages/engine/native-run-handlers.d.ts +0 -25
- package/dist/packages/engine/preparation-store.d.ts +0 -105
- package/dist/packages/engine/preparation-store.js +0 -213
- package/dist/packages/engine/readiness-check-draft.d.ts +0 -20
- package/dist/packages/engine/readiness-check-draft.js +0 -111
- package/dist/packages/engine/requested-artifacts.d.ts +0 -5
- package/dist/packages/engine/routes.d.ts +0 -85
- package/dist/packages/engine/routes.js +0 -99
- package/dist/packages/engine/runtime-caches.d.ts +0 -76
- package/dist/packages/engine/runtime-caches.js +0 -191
- package/dist/packages/engine/runtime-proposal-helpers.d.ts +0 -35
- package/dist/packages/engine/runtime-proposal-helpers.js +0 -247
- package/dist/packages/engine/runtime.d.ts +0 -371
- package/dist/packages/engine/runtime.js +0 -2463
- package/dist/packages/engine/server.d.ts +0 -58
- package/dist/packages/engine/server.js +0 -1399
- package/dist/packages/engine/verify/readiness-check-run.d.ts +0 -82
- package/dist/packages/engine/verify/readiness-check-run.js +0 -265
- package/dist/packages/engine/verify/verify-paths.js +0 -61
- package/dist/packages/engine/verify/verify-sandbox.js +0 -88
- package/dist/packages/engine/verify/verify-specs.js +0 -114
- package/dist/packages/engine/verify/verify-targets.d.ts +0 -5
- package/dist/packages/engine/wire-schemas.d.ts +0 -547
- package/dist/packages/engine/wire-schemas.js +0 -59
- package/dist/packages/project/index.d.ts +0 -9
- package/dist/packages/project/interf-bootstrap.d.ts +0 -1
- package/dist/packages/project/interf-bootstrap.js +0 -1
- package/dist/packages/project/interf-scaffold.d.ts +0 -3
- package/dist/packages/project/interf-scaffold.js +0 -136
- package/dist/packages/project/interf.d.ts +0 -4
- package/dist/packages/project/interf.js +0 -3
- package/dist/packages/project/lib/schema.d.ts +0 -328
- package/dist/packages/project/lib/schema.js +0 -136
- package/dist/packages/project/preparation-entries.d.ts +0 -11
- package/dist/packages/project/preparation-entries.js +0 -49
- package/dist/packages/project/source-config.d.ts +0 -46
- package/dist/packages/project/source-config.js +0 -394
- package/dist/packages/project/source-folders.d.ts +0 -11
- package/public-repo/build-plans/interf-default/build/stages/shape/SKILL.md +0 -27
- package/public-repo/build-plans/interf-default/build/stages/structure/SKILL.md +0 -21
- package/public-repo/plugins/README.md +0 -9
- package/public-repo/plugins/interf/.claude-plugin/plugin.json +0 -21
- package/public-repo/plugins/interf/.mcp.json +0 -12
- package/public-repo/plugins/interf/README.md +0 -32
- package/public-repo/plugins/interf/skills/interf/SKILL.md +0 -376
- /package/dist/packages/{engine/agents/lib/types.js → runtime/actions/fields.js} +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/agents.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/agents.js +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/execution.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/preflight.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/status.d.ts +0 -0
- /package/dist/packages/{engine/build/runtime-types.js → runtime/agents/lib/types.js} +0 -0
- /package/dist/packages/{engine/verify/verify-types.js → runtime/agents/providers/types.js} +0 -0
- /package/dist/packages/{engine → runtime}/agents/role-router.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/build/build-execution.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/build/build-execution.js +0 -0
- /package/dist/packages/{engine → runtime}/build/runtime-contracts.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/build/runtime-prompt.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/execution/adapters.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/execution/adapters.js +0 -0
- /package/dist/packages/{engine → runtime}/execution/events.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/execution/events.js +0 -0
- /package/dist/packages/{engine → runtime}/verify/verify-profile-presets.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/verify/verify-profile-presets.js +0 -0
- /package/dist/packages/{engine → runtime}/verify/verify-types.d.ts +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { RuntimeExecutorInfoSchema, TestCaseExpectSchema, TestTargetTypeSchema,
|
|
2
|
+
import { RuntimeExecutorInfoSchema, TestCaseExpectSchema, TestTargetTypeSchema, ProjectIdSchema, } from "../../../contracts/lib/schema.js";
|
|
3
|
+
import { isSafeRelativeTestFile } from "../test-file-guard.js";
|
|
3
4
|
const TestCaseCoreSchema = z.object({
|
|
4
5
|
id: z.string().regex(/^[a-z0-9][a-z0-9-]{0,79}$/),
|
|
5
6
|
question: z.string().min(1),
|
|
@@ -14,6 +15,17 @@ const TestCaseCoreSchema = z.object({
|
|
|
14
15
|
message: "Test cases need at least one of file, answer, or expect.",
|
|
15
16
|
});
|
|
16
17
|
}
|
|
18
|
+
// H2: a `file` target is a project-relative output path that is later joined
|
|
19
|
+
// onto the (sandboxed) target directory. Reject absolute or `..`-escaping
|
|
20
|
+
// values at parse time so they can never reach `path.join`. Centralizing the
|
|
21
|
+
// guard here means H1 (verify-execution join) and H3 (spec writer) inherit it.
|
|
22
|
+
if (value.file !== undefined && !isSafeRelativeTestFile(value.file)) {
|
|
23
|
+
ctx.addIssue({
|
|
24
|
+
code: z.ZodIssueCode.custom,
|
|
25
|
+
path: ["file"],
|
|
26
|
+
message: "Test case file must be a relative path without '..' or a leading '/'.",
|
|
27
|
+
});
|
|
28
|
+
}
|
|
17
29
|
});
|
|
18
30
|
export const TestCaseSchema = TestCaseCoreSchema;
|
|
19
31
|
const TestSpecCoreSchema = z.object({
|
|
@@ -81,7 +93,13 @@ export const TestTargetRunSchema = z.object({
|
|
|
81
93
|
target_count: z.number(),
|
|
82
94
|
results: z.array(TestTargetResultSchema),
|
|
83
95
|
});
|
|
84
|
-
export const TestRunModeSchema = z.enum(["source-files", "
|
|
96
|
+
export const TestRunModeSchema = z.enum(["source-files", "context-graph", "both"]);
|
|
97
|
+
export const BenchmarkSourceUsageSchema = z.enum([
|
|
98
|
+
"source-baseline",
|
|
99
|
+
"graph-only",
|
|
100
|
+
"graph-source-verified",
|
|
101
|
+
"unknown",
|
|
102
|
+
]);
|
|
85
103
|
export const TestRunTargetSummarySchema = z.object({
|
|
86
104
|
label: z.string(),
|
|
87
105
|
run_path: z.string(),
|
|
@@ -90,6 +108,8 @@ export const TestRunTargetSummarySchema = z.object({
|
|
|
90
108
|
total_cases: z.number(),
|
|
91
109
|
passed_checks: z.number(),
|
|
92
110
|
total_checks: z.number(),
|
|
111
|
+
executor: RuntimeExecutorInfoSchema.nullable().optional(),
|
|
112
|
+
source_usage: BenchmarkSourceUsageSchema.default("unknown"),
|
|
93
113
|
target: z.object({
|
|
94
114
|
type: TestTargetTypeSchema,
|
|
95
115
|
name: z.string(),
|
|
@@ -97,12 +117,12 @@ export const TestRunTargetSummarySchema = z.object({
|
|
|
97
117
|
build_plan: z.string(),
|
|
98
118
|
}),
|
|
99
119
|
});
|
|
100
|
-
function
|
|
120
|
+
function mapBenchmarkRun(value) {
|
|
101
121
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
102
122
|
return value;
|
|
103
123
|
const record = value;
|
|
104
|
-
const
|
|
105
|
-
? record.
|
|
124
|
+
const project = record.project && typeof record.project === "object" && !Array.isArray(record.project)
|
|
125
|
+
? record.project
|
|
106
126
|
: null;
|
|
107
127
|
const summary = record.summary && typeof record.summary === "object" && !Array.isArray(record.summary)
|
|
108
128
|
? record.summary
|
|
@@ -110,36 +130,36 @@ function mapReadinessCheckRun(value) {
|
|
|
110
130
|
return {
|
|
111
131
|
...record,
|
|
112
132
|
mode: record.mode,
|
|
113
|
-
|
|
133
|
+
project: project
|
|
114
134
|
? {
|
|
115
|
-
...
|
|
116
|
-
|
|
135
|
+
...project,
|
|
136
|
+
context_graph_path: project.context_graph_path,
|
|
117
137
|
}
|
|
118
|
-
: record.
|
|
119
|
-
|
|
138
|
+
: record.project,
|
|
139
|
+
context_graph: record.context_graph,
|
|
120
140
|
summary: summary
|
|
121
141
|
? {
|
|
122
142
|
...summary,
|
|
123
|
-
|
|
143
|
+
context_graph_pass_rate: summary.context_graph_pass_rate,
|
|
124
144
|
}
|
|
125
145
|
: record.summary,
|
|
126
146
|
};
|
|
127
147
|
}
|
|
128
|
-
export const
|
|
129
|
-
kind: z.literal("interf-
|
|
148
|
+
export const BenchmarkRunSchema = z.preprocess(mapBenchmarkRun, z.object({
|
|
149
|
+
kind: z.literal("interf-benchmark-run"),
|
|
130
150
|
version: z.literal(1),
|
|
131
151
|
generated_at: z.string(),
|
|
132
152
|
mode: TestRunModeSchema,
|
|
133
153
|
source_path: z.string(),
|
|
134
154
|
checks_fingerprint: z.string().min(1).optional(),
|
|
135
|
-
|
|
136
|
-
name:
|
|
137
|
-
|
|
155
|
+
project: z.object({
|
|
156
|
+
name: ProjectIdSchema,
|
|
157
|
+
context_graph_path: z.string().nullable(),
|
|
138
158
|
}),
|
|
139
159
|
source_files: TestRunTargetSummarySchema.nullable(),
|
|
140
|
-
|
|
160
|
+
context_graph: TestRunTargetSummarySchema.nullable(),
|
|
141
161
|
summary: z.object({
|
|
142
162
|
source_files_pass_rate: z.number().nullable(),
|
|
143
|
-
|
|
163
|
+
context_graph_pass_rate: z.number().nullable(),
|
|
144
164
|
}),
|
|
145
165
|
}));
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Pure, Node-free guard for a `testCase.file` value. A test file is a
|
|
2
|
+
// project-relative output path inside the (sandboxed) target directory, so it
|
|
3
|
+
// must never be absolute, never escape via `..`, and stay within a conservative
|
|
4
|
+
// character set. This is the single guard both the schema (H2) and the spec
|
|
5
|
+
// writer (H3) consume so a malicious `file` cannot reach `path.join` and a later
|
|
6
|
+
// `existsSync`/`readFileSync`.
|
|
7
|
+
//
|
|
8
|
+
// This module imports no Node builtins so it is safe to pull into the schemas
|
|
9
|
+
// barrel (`@interf/compiler/schemas`) and bundle into the renderer. The
|
|
10
|
+
// filesystem-aware path helpers live in `verify-paths.ts`, which re-exports
|
|
11
|
+
// these guards for server-side callers.
|
|
12
|
+
const TEST_FILE_PATTERN = /^[A-Za-z0-9._/-]+$/;
|
|
13
|
+
export function isSafeRelativeTestFile(file) {
|
|
14
|
+
if (file.length === 0)
|
|
15
|
+
return false;
|
|
16
|
+
if (file.startsWith("/"))
|
|
17
|
+
return false;
|
|
18
|
+
if (!TEST_FILE_PATTERN.test(file))
|
|
19
|
+
return false;
|
|
20
|
+
// Reject `..` as a whole path segment (e.g. `..`, `../x`, `a/../b`, `a/..`).
|
|
21
|
+
if (file.split("/").some((segment) => segment === ".."))
|
|
22
|
+
return false;
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
export function assertSafeRelativeTestFile(file) {
|
|
26
|
+
if (!isSafeRelativeTestFile(file)) {
|
|
27
|
+
throw new Error(`Invalid test case file: ${file}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { type AgentExecutor } from "../agents/lib/executors.js";
|
|
2
2
|
import type { TestTargetRun, TestTargetCandidate, LoadedTestSpec } from "./verify-types.js";
|
|
3
3
|
import { type TestSandboxRetentionMode } from "./verify-sandbox.js";
|
|
4
|
+
export declare function resolveTargetFilePath(targetPath: string, file: string): string;
|
|
5
|
+
interface TestJudgeVerdict {
|
|
6
|
+
pass: boolean;
|
|
7
|
+
summary: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function readTestJudgeVerdictFromStatus(statusPath: string): TestJudgeVerdict | null;
|
|
4
10
|
export declare function runTargetTests(sourcePath: string, spec: LoadedTestSpec, targets: TestTargetCandidate[]): TestTargetRun;
|
|
5
11
|
export declare function runTargetTestsWithJudge(sourcePath: string, spec: LoadedTestSpec, targets: TestTargetCandidate[], executor: AgentExecutor, options?: {
|
|
6
12
|
preserveSandboxes?: TestSandboxRetentionMode;
|
|
@@ -12,3 +18,4 @@ export declare function runTargetTestsAuto(sourcePath: string, spec: LoadedTestS
|
|
|
12
18
|
artifactRootPath?: string;
|
|
13
19
|
}): Promise<TestTargetRun>;
|
|
14
20
|
export declare function saveTargetTestRun(artifactRootPath: string, result: TestTargetRun): string;
|
|
21
|
+
export {};
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync, } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
|
+
import { assertPathWithinRoot } from "../../contracts/utils/path-guards.js";
|
|
4
5
|
import { buildRuntimeExecutorInfo } from "../agents/lib/executors.js";
|
|
5
6
|
import { targetTestRunGitignorePath, targetTestRunsPath, targetTestSandboxGitignorePath, targetTestSandboxesPath, normalizeTestId, } from "./verify-paths.js";
|
|
6
7
|
import { createTestSandbox, } from "./verify-sandbox.js";
|
|
8
|
+
import { freezePreservedShell } from "../agents/lib/shell-fs.js";
|
|
9
|
+
// H1: `testCase.file` is a project-relative output path joined onto the target
|
|
10
|
+
// directory. `path.join` resolves `..` at string level, so a malicious file can
|
|
11
|
+
// escape the (sandboxed) target and be read via existsSync/readFileSync. Resolve
|
|
12
|
+
// the join and assert it stays within target.path before any filesystem access.
|
|
13
|
+
// Centralized so every read of a test-case file inherits the bound (ENGINE-POLICY
|
|
14
|
+
// rule 7). The schema/spec-writer guards (H2/H3) are defense-in-depth ahead of
|
|
15
|
+
// this; this is the last line before the filesystem.
|
|
16
|
+
export function resolveTargetFilePath(targetPath, file) {
|
|
17
|
+
return assertPathWithinRoot(targetPath, join(targetPath, file), "test case file");
|
|
18
|
+
}
|
|
7
19
|
function parseWords(content) {
|
|
8
20
|
return content.trim().split(/\s+/).filter(Boolean).length;
|
|
9
21
|
}
|
|
@@ -66,7 +78,7 @@ function runTestCase(target, testCase) {
|
|
|
66
78
|
if (!testCase.file) {
|
|
67
79
|
throw new Error(`Test case "${testCase.id}" requires an executor because it has no file target.`);
|
|
68
80
|
}
|
|
69
|
-
const outputPath =
|
|
81
|
+
const outputPath = resolveTargetFilePath(target.path, testCase.file);
|
|
70
82
|
const checks = [];
|
|
71
83
|
if (!existsSync(outputPath)) {
|
|
72
84
|
checks.push({
|
|
@@ -133,7 +145,13 @@ function readTestJudgeVerdict(verdictPath) {
|
|
|
133
145
|
summary: typeof raw.summary === "string" ? raw.summary : "",
|
|
134
146
|
};
|
|
135
147
|
}
|
|
136
|
-
|
|
148
|
+
// M13: verdict.json is the single source of truth for a judge pass/fail. This is
|
|
149
|
+
// a strict fallback for when the agent omitted the JSON file: only an explicit
|
|
150
|
+
// `pass=true` / `pass=false` token on a terminal DONE:/BLOCKED:/ERROR: line is
|
|
151
|
+
// honored. The prompt mandates `DONE: pass=true|false - <summary>`, so a benign
|
|
152
|
+
// status line that merely mentions a match must NOT be read as a pass. A terminal
|
|
153
|
+
// line with no explicit pass token yields no verdict (treated as missing/invalid).
|
|
154
|
+
export function readTestJudgeVerdictFromStatus(statusPath) {
|
|
137
155
|
if (!existsSync(statusPath))
|
|
138
156
|
return null;
|
|
139
157
|
const lines = readFileSync(statusPath, "utf8")
|
|
@@ -148,79 +166,127 @@ function readTestJudgeVerdictFromStatus(statusPath) {
|
|
|
148
166
|
continue;
|
|
149
167
|
const normalized = line.toLowerCase();
|
|
150
168
|
const summary = line.replace(/^(DONE|BLOCKED|ERROR):\s*/i, "").trim();
|
|
151
|
-
if (
|
|
152
|
-
return { pass: true, summary };
|
|
153
|
-
}
|
|
154
|
-
if (normalized.includes("pass=false")) {
|
|
155
|
-
return { pass: false, summary };
|
|
156
|
-
}
|
|
157
|
-
if (/values match expected|matches expected|candidate matches|answer matches|expected values match/i.test(line)) {
|
|
169
|
+
if (/\bpass=true\b/.test(normalized)) {
|
|
158
170
|
return { pass: true, summary };
|
|
159
171
|
}
|
|
160
|
-
if (
|
|
172
|
+
if (/\bpass=false\b/.test(normalized)) {
|
|
161
173
|
return { pass: false, summary };
|
|
162
174
|
}
|
|
175
|
+
// Terminal line reached without an explicit pass token: no trustworthy
|
|
176
|
+
// verdict. Stop scanning so an earlier, benign line cannot be misread.
|
|
177
|
+
return null;
|
|
163
178
|
}
|
|
164
179
|
return null;
|
|
165
180
|
}
|
|
166
|
-
async function runTargetTestsJudge(testCase, executor, candidateLabel, candidateContent
|
|
167
|
-
|
|
181
|
+
async function runTargetTestsJudge(testCase, executor, candidateLabel, candidateContent,
|
|
182
|
+
// When supplied, the judge shell is created at this durable path and preserved
|
|
183
|
+
// (frozen) on finish so the judge execution is inspectable: prompt, reasoning
|
|
184
|
+
// transcript, the candidate it judged, and the JSON verdict all survive. Lives
|
|
185
|
+
// under the benchmark sandbox so it is preserved with the sandbox on failure.
|
|
186
|
+
// When omitted, the shell is an ephemeral /tmp dir removed on finish.
|
|
187
|
+
preservedShellRoot) {
|
|
188
|
+
const preserve = Boolean(preservedShellRoot);
|
|
189
|
+
const tempDir = preservedShellRoot
|
|
190
|
+
? (mkdirSync(preservedShellRoot, { recursive: true }), preservedShellRoot)
|
|
191
|
+
: mkdtempSync(join(tmpdir(), "interf-test-judge-"));
|
|
192
|
+
// The preserved shell needs a runtime/ dir up front: freezePreservedShell
|
|
193
|
+
// writes its manifest to runtime/preserved-shell.json, and reasoning is teed
|
|
194
|
+
// there too. (The ephemeral path doesn't need it.)
|
|
195
|
+
if (preserve) {
|
|
196
|
+
mkdirSync(join(tempDir, "runtime"), { recursive: true });
|
|
197
|
+
}
|
|
168
198
|
let executionError = null;
|
|
169
199
|
let verdict = null;
|
|
170
200
|
try {
|
|
171
201
|
const verdictPath = join(tempDir, "verdict.json");
|
|
172
202
|
const statusPath = join(tempDir, "judge.status.log");
|
|
173
203
|
const prompt = buildTestJudgePrompt(testCase, candidateLabel, candidateContent, verdictPath);
|
|
204
|
+
// Preserve the rendered prompt and the candidate it judged so the preserved
|
|
205
|
+
// shell holds everything needed to reproduce the verdict, not just the output.
|
|
206
|
+
if (preserve) {
|
|
207
|
+
writeFileSync(join(tempDir, "prompt.txt"), `${prompt}\n`);
|
|
208
|
+
writeFileSync(join(tempDir, "candidate.txt"), `${candidateContent}\n`);
|
|
209
|
+
}
|
|
210
|
+
// Same canonical convention as the stage path: reasoning is teed into the
|
|
211
|
+
// shell's runtime/ dir so it is preserved when the shell is frozen.
|
|
212
|
+
const reasoningLogPath = preserve ? join(tempDir, "runtime", "agent-reasoning.jsonl") : null;
|
|
174
213
|
try {
|
|
175
214
|
await executor.execute(tempDir, prompt, {
|
|
176
215
|
statusLogPath: statusPath,
|
|
216
|
+
reasoningLogPath,
|
|
177
217
|
});
|
|
178
218
|
}
|
|
179
219
|
catch (error) {
|
|
180
220
|
executionError = error instanceof Error ? error.message : String(error);
|
|
181
221
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
222
|
+
// M12: first error wins. If execute() already failed, do not read verdict
|
|
223
|
+
// files — a throw in verdict-reading would otherwise overwrite the real
|
|
224
|
+
// execution failure and mask why the judge never ran. Only read the verdict
|
|
225
|
+
// when execution itself reported no error.
|
|
226
|
+
if (!executionError) {
|
|
227
|
+
try {
|
|
228
|
+
verdict = readTestJudgeVerdict(verdictPath);
|
|
229
|
+
if (!verdict) {
|
|
230
|
+
verdict = readTestJudgeVerdictFromStatus(statusPath);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
catch (error) {
|
|
234
|
+
executionError = error instanceof Error ? error.message : String(error);
|
|
186
235
|
}
|
|
187
|
-
}
|
|
188
|
-
catch (error) {
|
|
189
|
-
executionError = error instanceof Error ? error.message : String(error);
|
|
190
236
|
}
|
|
191
237
|
}
|
|
192
238
|
finally {
|
|
193
|
-
|
|
239
|
+
// Preserve a durable judge shell (freeze materializes symlinks + writes the
|
|
240
|
+
// preserved-shell manifest, path unchanged); only remove an ephemeral one.
|
|
241
|
+
if (preserve) {
|
|
242
|
+
freezePreservedShell(tempDir, "test-judge");
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
246
|
+
}
|
|
194
247
|
}
|
|
195
248
|
return { verdict, error: executionError };
|
|
196
249
|
}
|
|
197
|
-
|
|
198
|
-
|
|
250
|
+
/**
|
|
251
|
+
* Durable judge-shell root under a benchmark sandbox target. Lives beside the
|
|
252
|
+
* sandbox's other preserved runtime artifacts so a preserved sandbox carries the
|
|
253
|
+
* judge execution too. Keyed by case + candidate so multiple judged cases in one
|
|
254
|
+
* target don't collide.
|
|
255
|
+
*/
|
|
256
|
+
function judgeShellRoot(targetPath, testCase, candidateLabel) {
|
|
257
|
+
const slug = `${normalizeTestId(testCase.id) || "case"}-${normalizeTestId(candidateLabel) || "candidate"}`;
|
|
258
|
+
return join(targetPath, ".interf", "runtime", "test-judge", slug);
|
|
259
|
+
}
|
|
260
|
+
function buildTestQueryPrompt(target, testCase, answerPath, tracePath, retryReason) {
|
|
261
|
+
const header = target.type === "context-graph"
|
|
199
262
|
? [
|
|
200
|
-
"You are running an Interf
|
|
263
|
+
"You are running an Interf benchmark inside an isolated sandboxed context-graph copy.",
|
|
201
264
|
"Read `AGENTS.md` first.",
|
|
202
|
-
"Use the local native `interf-query` skill available in this
|
|
203
|
-
"Answer the check question the same way you would answer a real user inside this
|
|
204
|
-
"Prefer the Build Plan-declared
|
|
205
|
-
"This sandbox is self-contained: the copied
|
|
206
|
-
"The original Interf instance state is intentionally absent from this sandbox. Use the source locators only when the
|
|
265
|
+
"Use the local native `interf-query` skill available in this Context Graph.",
|
|
266
|
+
"Answer the check question the same way you would answer a real user inside this Context Graph.",
|
|
267
|
+
"Prefer the Build Plan-declared context-graph outputs before consulting source references.",
|
|
268
|
+
"This sandbox is self-contained: the copied Context Graph has authoritative source references in `.interf/runtime/source-manifest.json`.",
|
|
269
|
+
"The original Interf instance state is intentionally absent from this sandbox. Use the source locators only when the Context Graph needs verification.",
|
|
207
270
|
]
|
|
208
271
|
: [
|
|
209
|
-
"You are running an Interf baseline
|
|
272
|
+
"You are running an Interf baseline benchmark inside an isolated source-files benchmark shell.",
|
|
210
273
|
"Read `AGENTS.md` first.",
|
|
211
274
|
"Use the local native `interf-query` skill available in this shell.",
|
|
212
|
-
"There is no
|
|
213
|
-
"Answer only from source references listed in `runtime/source-
|
|
275
|
+
"There is no Context Graph in this sandbox.",
|
|
276
|
+
"Answer only from source references listed in `runtime/source-manifest.json` inside this shell.",
|
|
214
277
|
"The original control plane folder is intentionally absent from this sandbox.",
|
|
215
278
|
];
|
|
216
279
|
return [
|
|
217
280
|
...header,
|
|
218
281
|
"Emit only STATUS:, DONE:, BLOCKED:, or ERROR: lines.",
|
|
219
282
|
"Do not ask follow-up questions.",
|
|
283
|
+
"Create both required output files before printing DONE.",
|
|
284
|
+
"The output paths are absolute temp file paths outside the Context Graph sandbox; write them exactly as given.",
|
|
220
285
|
`Write the answer to ${JSON.stringify(answerPath)}.`,
|
|
221
286
|
`Write the trace to ${JSON.stringify(tracePath)} with keys: case_id, target, artifacts_consulted, source_paths_read, used_source_files, answer_summary.`,
|
|
222
287
|
`Set \`case_id\` to ${JSON.stringify(testCase.id)}.`,
|
|
223
288
|
`Set \`target\` to ${JSON.stringify(target.type)}.`,
|
|
289
|
+
...(retryReason ? [`Retry reason: ${retryReason}`] : []),
|
|
224
290
|
`Question: ${testCase.question}`,
|
|
225
291
|
].join("\n");
|
|
226
292
|
}
|
|
@@ -228,20 +294,26 @@ async function runLiveTestCase(target, testCase, executor) {
|
|
|
228
294
|
const tempDir = mkdtempSync(join(tmpdir(), "interf-test-live-"));
|
|
229
295
|
const answerPath = join(tempDir, "answer.md");
|
|
230
296
|
const tracePath = join(tempDir, "trace.json");
|
|
231
|
-
const statusPath = join(tempDir, "status.log");
|
|
232
|
-
const eventPath = join(tempDir, "events.ndjson");
|
|
233
|
-
const prompt = buildTestQueryPrompt(target, testCase, answerPath, tracePath);
|
|
234
297
|
let executionError = null;
|
|
235
298
|
let code = -1;
|
|
236
299
|
try {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
300
|
+
for (let attempt = 1; attempt <= 2; attempt += 1) {
|
|
301
|
+
const statusPath = join(tempDir, `status-${attempt}.log`);
|
|
302
|
+
const eventPath = join(tempDir, `events-${attempt}.ndjson`);
|
|
303
|
+
const prompt = buildTestQueryPrompt(target, testCase, answerPath, tracePath, attempt === 1
|
|
304
|
+
? undefined
|
|
305
|
+
: `Attempt ${attempt - 1} exited without writing ${!existsSync(answerPath) ? "the answer file" : "the trace file"}. Write both files before DONE.`);
|
|
306
|
+
try {
|
|
307
|
+
code = await executor.execute(target.path, prompt, {
|
|
308
|
+
eventLogPath: eventPath,
|
|
309
|
+
statusLogPath: statusPath,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
catch (error) {
|
|
313
|
+
executionError = error instanceof Error ? error.message : String(error);
|
|
314
|
+
}
|
|
315
|
+
if (existsSync(answerPath) && existsSync(tracePath))
|
|
316
|
+
break;
|
|
245
317
|
}
|
|
246
318
|
const checks = [];
|
|
247
319
|
if (!existsSync(answerPath)) {
|
|
@@ -294,7 +366,8 @@ async function runLiveTestCase(target, testCase, executor) {
|
|
|
294
366
|
});
|
|
295
367
|
}
|
|
296
368
|
if (testCase.answer) {
|
|
297
|
-
const
|
|
369
|
+
const candidateLabel = `generated answer for ${testCase.id}`;
|
|
370
|
+
const judged = await runTargetTestsJudge(testCase, executor, candidateLabel, answer, judgeShellRoot(target.path, testCase, candidateLabel));
|
|
298
371
|
checks.push({
|
|
299
372
|
label: "judge verdict",
|
|
300
373
|
ok: judged.verdict?.pass === true,
|
|
@@ -324,7 +397,7 @@ async function runTestCaseWithJudge(target, testCase, executor) {
|
|
|
324
397
|
if (!testCase.file) {
|
|
325
398
|
return runLiveTestCase(target, testCase, executor);
|
|
326
399
|
}
|
|
327
|
-
const outputPath =
|
|
400
|
+
const outputPath = resolveTargetFilePath(target.path, testCase.file);
|
|
328
401
|
const checks = [];
|
|
329
402
|
if (!existsSync(outputPath)) {
|
|
330
403
|
checks.push({
|
|
@@ -353,7 +426,8 @@ async function runTestCaseWithJudge(target, testCase, executor) {
|
|
|
353
426
|
});
|
|
354
427
|
checks.push(...evaluated.checks);
|
|
355
428
|
if (testCase.answer) {
|
|
356
|
-
const
|
|
429
|
+
const candidateLabel = `Context Graph file ${outputPath}`;
|
|
430
|
+
const judged = await runTargetTestsJudge(testCase, executor, candidateLabel, content, judgeShellRoot(target.path, testCase, candidateLabel));
|
|
357
431
|
checks.push({
|
|
358
432
|
label: "judge verdict",
|
|
359
433
|
ok: judged.verdict?.pass === true,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { TestTargetType } from "./verify-types.js";
|
|
2
2
|
export declare const TEST_SPEC_EXTENSIONS: Set<string>;
|
|
3
|
+
export { isSafeRelativeTestFile, assertSafeRelativeTestFile, } from "./test-file-guard.js";
|
|
3
4
|
export declare function testSpecRootPath(sourcePath: string): string;
|
|
4
5
|
export declare function testSpecTypePath(sourcePath: string, type: TestTargetType): string;
|
|
5
|
-
export declare function targetTestRunsPath(
|
|
6
|
-
export declare function targetTestRunGitignorePath(
|
|
7
|
-
export declare function targetTestSandboxesPath(
|
|
8
|
-
export declare function targetTestSandboxGitignorePath(
|
|
6
|
+
export declare function targetTestRunsPath(contextGraphPath: string, type: TestTargetType): string;
|
|
7
|
+
export declare function targetTestRunGitignorePath(contextGraphPath: string, type: TestTargetType): string;
|
|
8
|
+
export declare function targetTestSandboxesPath(contextGraphPath: string, type: TestTargetType): string;
|
|
9
|
+
export declare function targetTestSandboxGitignorePath(contextGraphPath: string, type: TestTargetType): string;
|
|
9
10
|
export declare function testSpecFilePath(sourcePath: string, type: TestTargetType, id: string): string;
|
|
10
11
|
export declare function normalizeTestId(input: string): string;
|
|
11
12
|
export declare function assertTestId(id: string): void;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { basename, dirname, join } from "node:path";
|
|
3
|
+
import { targetTestRunsRootForContextGraph, targetTestSandboxesRootForContextGraph, contextGraphInterfConfigPath, } from "../build/context-graph-paths.js";
|
|
4
|
+
import { asProjectDataDir, projectTestsSpecsRoot, } from "../../contracts/lib/project-paths.js";
|
|
5
|
+
const TEST_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,79}$/;
|
|
6
|
+
export const TEST_SPEC_EXTENSIONS = new Set([".json"]);
|
|
7
|
+
// The `testCase.file` safelist guard lives in a Node-free module so the schemas
|
|
8
|
+
// barrel can import it without pulling Node builtins into the renderer bundle.
|
|
9
|
+
// Re-exported here for server-side path callers.
|
|
10
|
+
export { isSafeRelativeTestFile, assertSafeRelativeTestFile, } from "./test-file-guard.js";
|
|
11
|
+
export function testSpecRootPath(sourcePath) {
|
|
12
|
+
return projectTestsSpecsRoot(asProjectDataDir(sourcePath));
|
|
13
|
+
}
|
|
14
|
+
export function testSpecTypePath(sourcePath, type) {
|
|
15
|
+
return join(testSpecRootPath(sourcePath), type);
|
|
16
|
+
}
|
|
17
|
+
function isProjectTestsRootPath(artifactRootPath) {
|
|
18
|
+
return basename(artifactRootPath) === "tests" &&
|
|
19
|
+
basename(dirname(artifactRootPath)) === ".interf";
|
|
20
|
+
}
|
|
21
|
+
export function targetTestRunsPath(contextGraphPath, type) {
|
|
22
|
+
if (existsSync(contextGraphInterfConfigPath(contextGraphPath))) {
|
|
23
|
+
return join(targetTestRunsRootForContextGraph(contextGraphPath), type);
|
|
24
|
+
}
|
|
25
|
+
if (isProjectTestsRootPath(contextGraphPath)) {
|
|
26
|
+
return join(contextGraphPath, type === "source-files" ? "source-files" : "context-graph", "runs");
|
|
27
|
+
}
|
|
28
|
+
throw new Error(`Unsupported test artifact root: ${contextGraphPath}. Expected context graph or interf/<project>/.interf/tests root.`);
|
|
29
|
+
}
|
|
30
|
+
export function targetTestRunGitignorePath(contextGraphPath, type) {
|
|
31
|
+
return join(targetTestRunsPath(contextGraphPath, type), ".gitignore");
|
|
32
|
+
}
|
|
33
|
+
export function targetTestSandboxesPath(contextGraphPath, type) {
|
|
34
|
+
if (existsSync(contextGraphInterfConfigPath(contextGraphPath))) {
|
|
35
|
+
return join(targetTestSandboxesRootForContextGraph(contextGraphPath), type);
|
|
36
|
+
}
|
|
37
|
+
if (isProjectTestsRootPath(contextGraphPath)) {
|
|
38
|
+
return join(contextGraphPath, type === "source-files" ? "source-files" : "context-graph", "sandboxes");
|
|
39
|
+
}
|
|
40
|
+
throw new Error(`Unsupported test artifact root: ${contextGraphPath}. Expected context graph or interf/<project>/.interf/tests root.`);
|
|
41
|
+
}
|
|
42
|
+
export function targetTestSandboxGitignorePath(contextGraphPath, type) {
|
|
43
|
+
return join(targetTestSandboxesPath(contextGraphPath, type), ".gitignore");
|
|
44
|
+
}
|
|
45
|
+
export function testSpecFilePath(sourcePath, type, id) {
|
|
46
|
+
return join(testSpecTypePath(sourcePath, type), `${id}.json`);
|
|
47
|
+
}
|
|
48
|
+
export function normalizeTestId(input) {
|
|
49
|
+
return input
|
|
50
|
+
.toLowerCase()
|
|
51
|
+
.trim()
|
|
52
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
53
|
+
.replace(/^-+|-+$/g, "")
|
|
54
|
+
.slice(0, 80);
|
|
55
|
+
}
|
|
56
|
+
export function assertTestId(id) {
|
|
57
|
+
if (!TEST_ID_PATTERN.test(id)) {
|
|
58
|
+
throw new Error(`Invalid test id: ${id}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function assertWritableTestSpecPath(filePath) {
|
|
62
|
+
if (existsSync(filePath)) {
|
|
63
|
+
throw new Error(`Test spec already exists: ${filePath}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -3,7 +3,7 @@ export type TestSandboxRetentionMode = "on-failure" | "always";
|
|
|
3
3
|
export interface TestSandbox {
|
|
4
4
|
rootPath: string;
|
|
5
5
|
targetPath: string;
|
|
6
|
-
|
|
6
|
+
contextGraphPath: string | null;
|
|
7
7
|
preserve(destinationPath: string): string;
|
|
8
8
|
cleanup(): void;
|
|
9
9
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { cpSync, mkdirSync, mkdtempSync, renameSync, rmSync, writeFileSync, } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { refreshContextGraphBootstrapGuidance } from "../agents/lib/context-graph-bootstrap.js";
|
|
5
|
+
import { readInterfConfig } from "../../projects/interf.js";
|
|
6
|
+
import { projectSourceFilesTestQueryShell } from "../agents/lib/shells.js";
|
|
7
|
+
import { asProjectDataDir, projectContextGraphPath, } from "../../contracts/lib/project-paths.js";
|
|
8
|
+
import { saveContextGraphInterfConfig } from "../../projects/source-config.js";
|
|
9
|
+
import { loadContextGraphSourceManifest, sourceManifestToSourceFiles, } from "../build/source-manifest.js";
|
|
10
|
+
import { refreshContextGraphArtifacts } from "../build/state.js";
|
|
11
|
+
import { testRootForContextGraph, stageExecutionShellsRoot, targetTestSandboxesRootForContextGraph, buildPlanImprovementLoopsRoot, contextGraphQueryAcceptanceRoot, contextGraphRuntimeLogsRoot, } from "../build/context-graph-paths.js";
|
|
12
|
+
function sanitizeContextGraphArtifacts(contextGraphPath) {
|
|
13
|
+
for (const absolutePath of [
|
|
14
|
+
testRootForContextGraph(contextGraphPath),
|
|
15
|
+
targetTestSandboxesRootForContextGraph(contextGraphPath),
|
|
16
|
+
stageExecutionShellsRoot(contextGraphPath),
|
|
17
|
+
buildPlanImprovementLoopsRoot(contextGraphPath),
|
|
18
|
+
contextGraphRuntimeLogsRoot(contextGraphPath),
|
|
19
|
+
contextGraphQueryAcceptanceRoot(contextGraphPath),
|
|
20
|
+
]) {
|
|
21
|
+
rmSync(absolutePath, { recursive: true, force: true });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function createTestSandbox(target) {
|
|
25
|
+
let sandboxRoot = mkdtempSync(join(tmpdir(), "interf-test-sandbox-"));
|
|
26
|
+
let preserved = false;
|
|
27
|
+
const sandboxContextGraphPath = () => (target.type === "context-graph"
|
|
28
|
+
? projectContextGraphPath(asProjectDataDir(sandboxRoot), target.name)
|
|
29
|
+
: null);
|
|
30
|
+
const sandboxTargetPath = () => (target.type === "context-graph"
|
|
31
|
+
? projectContextGraphPath(asProjectDataDir(sandboxRoot), target.name)
|
|
32
|
+
: sandboxRoot);
|
|
33
|
+
try {
|
|
34
|
+
if (target.type === "context-graph") {
|
|
35
|
+
mkdirSync(dirname(sandboxTargetPath()), { recursive: true });
|
|
36
|
+
cpSync(target.path, sandboxTargetPath(), { recursive: true });
|
|
37
|
+
sanitizeContextGraphArtifacts(sandboxTargetPath());
|
|
38
|
+
const sandboxConfig = readInterfConfig(sandboxTargetPath());
|
|
39
|
+
if (!sandboxConfig) {
|
|
40
|
+
throw new Error(`Sandbox Context Graph is missing interf.json: ${sandboxTargetPath()}`);
|
|
41
|
+
}
|
|
42
|
+
saveContextGraphInterfConfig(sandboxTargetPath(), {
|
|
43
|
+
...sandboxConfig,
|
|
44
|
+
source: sandboxConfig.source,
|
|
45
|
+
});
|
|
46
|
+
refreshContextGraphBootstrapGuidance(sandboxTargetPath());
|
|
47
|
+
refreshContextGraphArtifacts(sandboxTargetPath(), { ensureViewSpec: true });
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
mkdirSync(join(sandboxTargetPath(), "runtime"), { recursive: true });
|
|
51
|
+
const manifest = loadContextGraphSourceManifest(target.path);
|
|
52
|
+
if (!manifest) {
|
|
53
|
+
throw new Error(`Source-files benchmark target has no Source Manifest: ${target.path}`);
|
|
54
|
+
}
|
|
55
|
+
writeFileSync(join(sandboxTargetPath(), "runtime", "source-manifest.json"), `${JSON.stringify(manifest, null, 2)}\n`);
|
|
56
|
+
writeFileSync(join(sandboxTargetPath(), "runtime", "source-files.json"), `${JSON.stringify(sourceManifestToSourceFiles(manifest), null, 2)}\n`);
|
|
57
|
+
projectSourceFilesTestQueryShell(sandboxTargetPath());
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
rmSync(sandboxRoot, { recursive: true, force: true });
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
get rootPath() {
|
|
66
|
+
return sandboxRoot;
|
|
67
|
+
},
|
|
68
|
+
get targetPath() {
|
|
69
|
+
return sandboxTargetPath();
|
|
70
|
+
},
|
|
71
|
+
get contextGraphPath() {
|
|
72
|
+
return sandboxContextGraphPath();
|
|
73
|
+
},
|
|
74
|
+
preserve(destinationPath) {
|
|
75
|
+
mkdirSync(dirname(destinationPath), { recursive: true });
|
|
76
|
+
rmSync(destinationPath, { recursive: true, force: true });
|
|
77
|
+
renameSync(sandboxRoot, destinationPath);
|
|
78
|
+
sandboxRoot = destinationPath;
|
|
79
|
+
preserved = true;
|
|
80
|
+
return sandboxRoot;
|
|
81
|
+
},
|
|
82
|
+
cleanup() {
|
|
83
|
+
if (preserved)
|
|
84
|
+
return;
|
|
85
|
+
rmSync(sandboxRoot, { recursive: true, force: true });
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -4,4 +4,6 @@ export declare function loadTestSpec(sourcePath: string, type: TestTargetType, i
|
|
|
4
4
|
export declare function loadTestSpecFromFile(filePath: string): LoadedTestSpec | null;
|
|
5
5
|
export declare function writeTestSpec(sourcePath: string, spec: TestSpec & {
|
|
6
6
|
id?: string;
|
|
7
|
+
}, options?: {
|
|
8
|
+
overwrite?: boolean;
|
|
7
9
|
}): string;
|