@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,1052 +0,0 @@
|
|
|
1
|
-
import { cpSync, copyFileSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync, symlinkSync, } from "node:fs";
|
|
2
|
-
import { tmpdir } from "node:os";
|
|
3
|
-
import { basename, dirname, join, relative, sep as pathSep } from "node:path";
|
|
4
|
-
import { CHART_APPROXIMATION_NOTES } from "./chart-guidance.js";
|
|
5
|
-
import { buildVerifiableContextSourceFiles } from "../../build/source-files.js";
|
|
6
|
-
import { BUILD_PLAN_PACKAGE_DIR } from "../../../project/interf-detect.js";
|
|
7
|
-
import { CHECK_KINDS, } from "../../../contracts/lib/schema.js";
|
|
8
|
-
import { CONTEXT_INTERFACE_FILE as BUILD_PLAN_SCHEMA_FILE, contextInterfaceArtifactAbsolutePath as verifiableContextArtifactAbsolutePath, listContextInterfaceArtifacts, readContextInterface as readBuildPlanContextFile, resolveContextInterfacePath as resolveBuildPlanSchemaPath, } from "../../../build-plans/package/context-interface.js";
|
|
9
|
-
import { stageExecutionShellsRoot, buildPlanImprovementLoopRoot, buildPlanPackagePathForVerifiableContext, verifiableContextInterfConfigPath, verifiableContextRuntimeRoot, verifiableContextRuntimeSourceSnapshotPath, verifiableContextRuntimeStageInputsPath, } from "../../build/verifiable-context-paths.js";
|
|
10
|
-
import { ensureBuildPlanArtifactTargets } from "../../build/verifiable-context-schema.js";
|
|
11
|
-
import { listFilesRecursive } from "../../../contracts/utils/filesystem.js";
|
|
12
|
-
import { resolveBuildPlanImprovementReviewSourcePaths } from "../../../build-plans/package/build-plan-review-paths.js";
|
|
13
|
-
const LOCAL_SKILL_ROOTS = [
|
|
14
|
-
".claude/skills",
|
|
15
|
-
".codex/skills",
|
|
16
|
-
".agents/skills",
|
|
17
|
-
".cursor/skills",
|
|
18
|
-
];
|
|
19
|
-
export function writeNativeAgentSurface(rootPath, agentsContent, skillName, skillContent) {
|
|
20
|
-
let changed = false;
|
|
21
|
-
changed = writeIfChanged(join(rootPath, "AGENTS.md"), `${agentsContent.trimEnd()}\n`) || changed;
|
|
22
|
-
changed =
|
|
23
|
-
writeIfChanged(join(rootPath, "CLAUDE.md"), renderClaudeBootstrap(agentsContent)) || changed;
|
|
24
|
-
changed = writeNativeSkillCopies(rootPath, skillName, skillContent) || changed;
|
|
25
|
-
return changed;
|
|
26
|
-
}
|
|
27
|
-
function verifiableContextQuerySkillSourcePath(verifiableContextPath) {
|
|
28
|
-
return join(buildPlanPackagePathForVerifiableContext(verifiableContextPath), "use", "query", "SKILL.md");
|
|
29
|
-
}
|
|
30
|
-
function verifiableContextArtifactSummaryLines(verifiableContextPath) {
|
|
31
|
-
const schema = readBuildPlanContextFile(buildPlanPackagePathForVerifiableContext(verifiableContextPath));
|
|
32
|
-
if (!schema)
|
|
33
|
-
return ["- No Build Plan schema is available yet."];
|
|
34
|
-
return listContextInterfaceArtifacts(schema)
|
|
35
|
-
.filter((artifact) => artifact.kind !== "runtime")
|
|
36
|
-
.map((artifact) => `- \`${artifact.id}\` -> \`${artifact.path}\` (${artifact.role} ${artifact.kind})`);
|
|
37
|
-
}
|
|
38
|
-
export function renderVerifiableContextAgents(verifiableContextPath, name, buildPlanId, about, options = {}) {
|
|
39
|
-
const buildPlanOriginSelected = options.buildPlanOriginSelected ?? buildPlanId;
|
|
40
|
-
const buildPlanLocalDraft = options.buildPlanLocalDraft === true;
|
|
41
|
-
const artifactLines = verifiableContextArtifactSummaryLines(verifiableContextPath);
|
|
42
|
-
return [
|
|
43
|
-
`# ${name}`,
|
|
44
|
-
"",
|
|
45
|
-
"This is verifiable context built by Interf.",
|
|
46
|
-
"This folder gives agents prepared evidence, structure, and cross-file connections so they do not have to rediscover the full picture from source files during the job.",
|
|
47
|
-
"",
|
|
48
|
-
...(about
|
|
49
|
-
? [
|
|
50
|
-
`About: ${about}`,
|
|
51
|
-
"",
|
|
52
|
-
]
|
|
53
|
-
: []),
|
|
54
|
-
"## How to use this verifiable context",
|
|
55
|
-
"",
|
|
56
|
-
"1. Use the local native `interf-query` skill that Interf generated for this verifiable context.",
|
|
57
|
-
"2. Let the Build Plan docs and declared Artifacts guide retrieval instead of assuming a fixed note layout.",
|
|
58
|
-
"3. Use `.interf/runtime/source-snapshot.json` when you need to inspect the source references behind the output.",
|
|
59
|
-
"",
|
|
60
|
-
"## How this verifiable context works",
|
|
61
|
-
"",
|
|
62
|
-
"- The Build Plan defines the context interface this verifiable context implements on disk.",
|
|
63
|
-
"- `.interf/interf.json` records the selected Source binding and Preparation metadata.",
|
|
64
|
-
`- Build Plan seed: \`${buildPlanOriginSelected}\`.`,
|
|
65
|
-
...(buildPlanLocalDraft
|
|
66
|
-
? ["- This verifiable context now carries a local Build Plan draft improved from that seed. Rebuilding this verifiable context reuses the local `.interf/build-plan/` package."]
|
|
67
|
-
: []),
|
|
68
|
-
`- Selected Build Plan id: \`${buildPlanId}\`.`,
|
|
69
|
-
"- `.interf/build-plan/` is the local editable Build Plan package for this verifiable context.",
|
|
70
|
-
`- \`.interf/build-plan/${BUILD_PLAN_SCHEMA_FILE}\` is the deterministic context interface for this verifiable context.`,
|
|
71
|
-
"- `.interf/build-plan/improve/` is the editable source for Build Plan improvement loops.",
|
|
72
|
-
"- `.interf/build-plan/use/query/` is the editable source for the generated native query shell.",
|
|
73
|
-
"- `.interf/build-plan/build/stages/` defines stage-specific docs that Interf projects into native execution shells for automated runs.",
|
|
74
|
-
"- Native local query skills are generated under local agent skill directories such as `.claude/skills/` and `.codex/skills/`.",
|
|
75
|
-
"- `.interf/runtime/source-snapshot.json` records the source files assigned to the latest runtime snapshot.",
|
|
76
|
-
`- Build Plan Artifacts are declared in \`.interf/build-plan/${BUILD_PLAN_SCHEMA_FILE}\`.`,
|
|
77
|
-
...artifactLines,
|
|
78
|
-
"- `.interf/runtime/` holds runtime artifacts written by Interf.",
|
|
79
|
-
"- `.interf/tests/` mirrors the latest saved readiness-check run and keeps detailed target runs plus preserved sandboxes.",
|
|
80
|
-
"- `.interf/tests/targets/` holds detailed source-files and verifiable-context target runs plus preserved test sandboxes.",
|
|
81
|
-
"",
|
|
82
|
-
"## Manual query rules",
|
|
83
|
-
"",
|
|
84
|
-
"- Prefer the Build Plan-declared context outputs before source re-checks.",
|
|
85
|
-
"- Use the generated native `interf-query` skill for manual querying. The editable source lives at `.interf/build-plan/use/query/SKILL.md`.",
|
|
86
|
-
"- Treat `.interf/` as Build Plan/runtime metadata, not answer evidence, unless explicitly asked to inspect Build Plan or test history.",
|
|
87
|
-
"- Use `.interf/runtime/source-snapshot.json` to find source references for quotes, verification, ambiguity, or evidence the verifiable context does not expose well.",
|
|
88
|
-
"- If exact chart, table, or image-derived evidence matters, inspect the source reference and say whether the answer was text-derived, table-derived, or chart-derived.",
|
|
89
|
-
"",
|
|
90
|
-
"## Commands",
|
|
91
|
-
"",
|
|
92
|
-
"```",
|
|
93
|
-
"interf build <prep-id> build this verifiable context",
|
|
94
|
-
"interf test run readiness checks against this verifiable context",
|
|
95
|
-
"interf status show deterministic health",
|
|
96
|
-
"```",
|
|
97
|
-
"",
|
|
98
|
-
"## Rules",
|
|
99
|
-
"",
|
|
100
|
-
"- Do not modify source files while answering from this verifiable context.",
|
|
101
|
-
"- Treat prepared notes as working context, not final truth.",
|
|
102
|
-
"- When confidence is low, verify against the source references before answering strongly.",
|
|
103
|
-
"",
|
|
104
|
-
].join("\n");
|
|
105
|
-
}
|
|
106
|
-
export function renderVerifiableContextQuerySkill() {
|
|
107
|
-
return [
|
|
108
|
-
"# Manual Query Loop",
|
|
109
|
-
"",
|
|
110
|
-
"This file is the editable authoring source for the generated native local `interf-query` skill.",
|
|
111
|
-
"",
|
|
112
|
-
"Default loop:",
|
|
113
|
-
"1. Read `.interf/build-plan/README.md` and this file first.",
|
|
114
|
-
`2. Use the Build Plan Artifacts declared in \`.interf/build-plan/${BUILD_PLAN_SCHEMA_FILE}\` before consulting source references.`,
|
|
115
|
-
"3. Use `.interf/runtime/source-snapshot.json` for direct quotes, verification, exact lookups, and cases where the verifiable context is missing the needed evidence or is ambiguous.",
|
|
116
|
-
"",
|
|
117
|
-
"Answering rule:",
|
|
118
|
-
"- do not modify source files while answering",
|
|
119
|
-
"- treat the Build Plan as the verifiable-context contract and use its Artifacts as the working retrieval surface",
|
|
120
|
-
"- say explicitly when an answer depends on approximation, bounded inference, or a source re-check",
|
|
121
|
-
"- use source references to confirm source page, metric family, provenance, or exact wording when the verifiable context is missing the needed evidence or is ambiguous",
|
|
122
|
-
"- do not invent navigation or note structure beyond what this Build Plan declares",
|
|
123
|
-
"- when the verifiable context is insufficient, verify against source references and then answer",
|
|
124
|
-
"",
|
|
125
|
-
"You can edit this file to bias manual question-answering behavior for this verifiable context.",
|
|
126
|
-
"",
|
|
127
|
-
].join("\n");
|
|
128
|
-
}
|
|
129
|
-
function renderSourceFilesTestAgents() {
|
|
130
|
-
const chartNotes = CHART_APPROXIMATION_NOTES.map((note) => `- ${note}`);
|
|
131
|
-
return [
|
|
132
|
-
"# Source Files Test Shell",
|
|
133
|
-
"",
|
|
134
|
-
"This is an isolated source-files test shell generated by Interf.",
|
|
135
|
-
"There is no verifiable context in this shell.",
|
|
136
|
-
"",
|
|
137
|
-
"## How to use this shell",
|
|
138
|
-
"",
|
|
139
|
-
"1. Read this file first.",
|
|
140
|
-
"2. Use the local native `interf-query` skill available in this shell.",
|
|
141
|
-
"3. Read `runtime/source-files.json` and use only the listed source references.",
|
|
142
|
-
"",
|
|
143
|
-
"## Rules",
|
|
144
|
-
"",
|
|
145
|
-
"- Answer only from source files listed in `runtime/source-files.json`.",
|
|
146
|
-
"- There is no verifiable context here, so do not assume any verifiable-context Artifacts exist.",
|
|
147
|
-
"- Do not treat hidden runtime files or test artifacts as evidence.",
|
|
148
|
-
...chartNotes,
|
|
149
|
-
"- Write the requested answer and trace files, then stop.",
|
|
150
|
-
"",
|
|
151
|
-
].join("\n");
|
|
152
|
-
}
|
|
153
|
-
function renderSourceFilesTestQuerySkill() {
|
|
154
|
-
const chartNotes = CHART_APPROXIMATION_NOTES.map((note, index) => `${index + 3}. ${note}`);
|
|
155
|
-
return [
|
|
156
|
-
"---",
|
|
157
|
-
"name: interf-query",
|
|
158
|
-
"description: >",
|
|
159
|
-
" Native local query skill for an Interf source-files test shell. Use it only",
|
|
160
|
-
" to answer source-files readiness checks from `runtime/source-files.json` references.",
|
|
161
|
-
"---",
|
|
162
|
-
"",
|
|
163
|
-
"# Interf Source Files Test Query",
|
|
164
|
-
"",
|
|
165
|
-
"This is the native local query skill for an isolated source-files test shell.",
|
|
166
|
-
"",
|
|
167
|
-
"Loop:",
|
|
168
|
-
"1. Read `runtime/source-files.json`.",
|
|
169
|
-
"2. Verify exact claims against the listed source locators before answering strongly.",
|
|
170
|
-
...chartNotes,
|
|
171
|
-
"8. Do not rely on verifiable-context artifacts because they do not exist in this shell.",
|
|
172
|
-
"",
|
|
173
|
-
].join("\n");
|
|
174
|
-
}
|
|
175
|
-
function readVerifiableContextQuerySkillSource(verifiableContextPath) {
|
|
176
|
-
const filePath = verifiableContextQuerySkillSourcePath(verifiableContextPath);
|
|
177
|
-
if (!existsSync(filePath)) {
|
|
178
|
-
throw new Error(`Missing verifiable-context query skill source at ${filePath}. Interf build runs the local Build Plan package directly, so reseed or repair this verifiable context instead of auto-healing query docs.`);
|
|
179
|
-
}
|
|
180
|
-
return readFileSync(filePath, "utf8").trim();
|
|
181
|
-
}
|
|
182
|
-
function stageShellBuildPlanRoot(shellRoot) {
|
|
183
|
-
return join(shellRoot, BUILD_PLAN_PACKAGE_DIR);
|
|
184
|
-
}
|
|
185
|
-
function shellInputArtifactPath(shellRoot, artifactId) {
|
|
186
|
-
return join(shellRoot, "inputs", artifactId);
|
|
187
|
-
}
|
|
188
|
-
function shellOutputArtifactPath(shellRoot, artifactId) {
|
|
189
|
-
return join(shellRoot, "outputs", artifactId);
|
|
190
|
-
}
|
|
191
|
-
function shellArtifactAliasMountPath(shellRoot, artifact, mountKind) {
|
|
192
|
-
const mountRoot = mountKind === "inputs"
|
|
193
|
-
? shellInputArtifactPath(shellRoot, artifact.id)
|
|
194
|
-
: shellOutputArtifactPath(shellRoot, artifact.id);
|
|
195
|
-
return artifact.kind === "file"
|
|
196
|
-
? join(mountRoot, basename(artifact.path))
|
|
197
|
-
: mountRoot;
|
|
198
|
-
}
|
|
199
|
-
function describeShellArtifactAliasMountPath(artifact, mountKind) {
|
|
200
|
-
return artifact.kind === "file"
|
|
201
|
-
? `${mountKind}/${artifact.id}/${basename(artifact.path)}`
|
|
202
|
-
: `${mountKind}/${artifact.id}`;
|
|
203
|
-
}
|
|
204
|
-
function shellRuntimePath(shellRoot, relativePath) {
|
|
205
|
-
return join(shellRoot, "runtime", relativePath);
|
|
206
|
-
}
|
|
207
|
-
function writeIfChanged(path, content) {
|
|
208
|
-
if (existsSync(path) && readFileSync(path, "utf8") === content) {
|
|
209
|
-
return false;
|
|
210
|
-
}
|
|
211
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
212
|
-
writeFileSync(path, content);
|
|
213
|
-
return true;
|
|
214
|
-
}
|
|
215
|
-
function writeNativeSkillCopies(rootPath, skillName, content) {
|
|
216
|
-
let changed = false;
|
|
217
|
-
for (const skillsRoot of LOCAL_SKILL_ROOTS) {
|
|
218
|
-
const skillPath = join(rootPath, skillsRoot, skillName, "SKILL.md");
|
|
219
|
-
changed = writeIfChanged(skillPath, content) || changed;
|
|
220
|
-
}
|
|
221
|
-
return changed;
|
|
222
|
-
}
|
|
223
|
-
function linkPath(targetPath, linkPathname) {
|
|
224
|
-
mkdirSync(dirname(linkPathname), { recursive: true });
|
|
225
|
-
symlinkSync(targetPath, linkPathname);
|
|
226
|
-
}
|
|
227
|
-
function linkIfExists(targetPath, linkPathname) {
|
|
228
|
-
if (!existsSync(targetPath))
|
|
229
|
-
return;
|
|
230
|
-
linkPath(targetPath, linkPathname);
|
|
231
|
-
}
|
|
232
|
-
function linkRelativePath(targetPath, linkPathname) {
|
|
233
|
-
mkdirSync(dirname(linkPathname), { recursive: true });
|
|
234
|
-
symlinkSync(relative(dirname(linkPathname), targetPath), linkPathname);
|
|
235
|
-
}
|
|
236
|
-
function loadVerifiableContextSchema(verifiableContextPath) {
|
|
237
|
-
const buildPlanRoot = buildPlanPackagePathForVerifiableContext(verifiableContextPath);
|
|
238
|
-
const schema = readBuildPlanContextFile(buildPlanRoot);
|
|
239
|
-
if (!schema) {
|
|
240
|
-
throw new Error(`Missing Build Plan schema at ${join(buildPlanRoot, BUILD_PLAN_SCHEMA_FILE)}`);
|
|
241
|
-
}
|
|
242
|
-
return schema;
|
|
243
|
-
}
|
|
244
|
-
function artifactMap(schema) {
|
|
245
|
-
return new Map(listContextInterfaceArtifacts(schema).map((artifact) => [artifact.id, artifact]));
|
|
246
|
-
}
|
|
247
|
-
function artifactOrThrow(artifacts, artifactId) {
|
|
248
|
-
const artifact = artifacts.get(artifactId);
|
|
249
|
-
if (!artifact) {
|
|
250
|
-
throw new Error(`Missing Build Plan schema Artifact "${artifactId}" for stage shell projection.`);
|
|
251
|
-
}
|
|
252
|
-
return artifact;
|
|
253
|
-
}
|
|
254
|
-
function normalizeArtifactRelativePath(path) {
|
|
255
|
-
return path
|
|
256
|
-
.replaceAll("\\", "/")
|
|
257
|
-
.replace(/^\.?\//, "")
|
|
258
|
-
.replace(/\/+$/g, "");
|
|
259
|
-
}
|
|
260
|
-
function relativePathEqualsOrWithin(basePath, candidatePath) {
|
|
261
|
-
const base = normalizeArtifactRelativePath(basePath);
|
|
262
|
-
const candidate = normalizeArtifactRelativePath(candidatePath);
|
|
263
|
-
if (base.length === 0 || candidate.length === 0)
|
|
264
|
-
return false;
|
|
265
|
-
return candidate === base || candidate.startsWith(`${base}/`);
|
|
266
|
-
}
|
|
267
|
-
function stageWriteArtifactSet(schema, stage) {
|
|
268
|
-
const artifacts = listContextInterfaceArtifacts(schema);
|
|
269
|
-
return new Set(stage.writes.filter((artifactId) => artifacts.some((artifact) => artifact.id === artifactId)));
|
|
270
|
-
}
|
|
271
|
-
function stageMaterializedArtifactSet(schema, stage, writeArtifacts = []) {
|
|
272
|
-
const materialized = stageWriteArtifactSet(schema, stage);
|
|
273
|
-
for (const artifact of listContextInterfaceArtifacts(schema)) {
|
|
274
|
-
if (artifact.kind === "runtime" && stage.reads.includes(artifact.id)) {
|
|
275
|
-
materialized.add(artifact.id);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
for (const artifactPath of writeArtifacts) {
|
|
279
|
-
const normalizedArtifactPath = normalizeArtifactRelativePath(artifactPath);
|
|
280
|
-
if (normalizedArtifactPath.length === 0)
|
|
281
|
-
continue;
|
|
282
|
-
const owner = listContextInterfaceArtifacts(schema).find((artifact) => relativePathEqualsOrWithin(artifact.path, normalizedArtifactPath));
|
|
283
|
-
if (owner) {
|
|
284
|
-
materialized.add(owner.id);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
return materialized;
|
|
288
|
-
}
|
|
289
|
-
function ensureShellLocalProjection(sourcePath, targetPath, artifact) {
|
|
290
|
-
if (existsSync(sourcePath)) {
|
|
291
|
-
copyResolvedTree({
|
|
292
|
-
sourcePath,
|
|
293
|
-
targetPath,
|
|
294
|
-
shellType: "stage-execution",
|
|
295
|
-
});
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
if (artifact.kind === "file") {
|
|
299
|
-
mkdirSync(dirname(targetPath), { recursive: true });
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
mkdirSync(targetPath, { recursive: true });
|
|
303
|
-
}
|
|
304
|
-
function ensureBuildExecutionSurface(verifiableContextPath) {
|
|
305
|
-
mkdirSync(verifiableContextRuntimeRoot(verifiableContextPath), { recursive: true });
|
|
306
|
-
mkdirSync(buildPlanPackagePathForVerifiableContext(verifiableContextPath), { recursive: true });
|
|
307
|
-
const schema = loadVerifiableContextSchema(verifiableContextPath);
|
|
308
|
-
ensureBuildPlanArtifactTargets(verifiableContextPath, schema);
|
|
309
|
-
return schema;
|
|
310
|
-
}
|
|
311
|
-
function readStageBuildPlanDoc(verifiableContextPath, stage) {
|
|
312
|
-
const path = join(buildPlanPackagePathForVerifiableContext(verifiableContextPath), "build", "stages", stage.skillDir, "SKILL.md");
|
|
313
|
-
if (!existsSync(path))
|
|
314
|
-
return null;
|
|
315
|
-
return readFileSync(path, "utf8").trim();
|
|
316
|
-
}
|
|
317
|
-
function stageBuildPlanDocsPath(verifiableContextPath, stage) {
|
|
318
|
-
return join(buildPlanPackagePathForVerifiableContext(verifiableContextPath), "build", "stages", stage.skillDir);
|
|
319
|
-
}
|
|
320
|
-
function renderStageExecutionAgents(verifiableContextName, buildPlanId, stage) {
|
|
321
|
-
return [
|
|
322
|
-
`# ${verifiableContextName} — ${stage.label} Execution Shell`,
|
|
323
|
-
"",
|
|
324
|
-
"This is an ephemeral stage-execution shell generated by Interf.",
|
|
325
|
-
"It is for automated pipeline execution only, not for manual querying.",
|
|
326
|
-
"",
|
|
327
|
-
"## Start Here",
|
|
328
|
-
"",
|
|
329
|
-
"1. Read `runtime/stage-contract.json` now.",
|
|
330
|
-
"2. Read `runtime/source-snapshot.json` and `runtime/stage-inputs.json` now.",
|
|
331
|
-
"3. Read `runtime/paths.json` now.",
|
|
332
|
-
"4. Use the local native `interf-stage` skill now.",
|
|
333
|
-
`5. Execute only the current stage: \`${stage.id}\` (${stage.label}).`,
|
|
334
|
-
"",
|
|
335
|
-
"## Shell ABI",
|
|
336
|
-
"",
|
|
337
|
-
"- `inputs/<artifact-id>/` = read mounts for the current stage.",
|
|
338
|
-
"- `outputs/<artifact-id>/` = write mounts for the current stage.",
|
|
339
|
-
"- For file Artifacts, `runtime/paths.json` points to the exact file path inside those mount roots.",
|
|
340
|
-
"- `runtime/source-snapshot.json` = source references captured for this run.",
|
|
341
|
-
"- `runtime/stage-inputs.json` = exact source references assigned to this stage.",
|
|
342
|
-
"- declared Artifact paths are also projected at the shell root so Build Plan-relative contract paths stay valid.",
|
|
343
|
-
"- `runtime/` = stage contract and machine-readable path map for this shell.",
|
|
344
|
-
"- `build-plan/` = Build Plan metadata, `build-plan.schema.json`, and docs for the current stage only.",
|
|
345
|
-
"",
|
|
346
|
-
"## Boundaries",
|
|
347
|
-
"",
|
|
348
|
-
`- Build Plan: \`${buildPlanId}\`.`,
|
|
349
|
-
`- Contract type: \`${stage.contractType}\`.`,
|
|
350
|
-
"- This shell has its own AGENTS/CLAUDE/native skills. It does not inherit the verifiable-context query shell.",
|
|
351
|
-
"- The verifiable-context root itself is not linked into this shell.",
|
|
352
|
-
"- Do not switch into query mode or act like a user-facing assistant.",
|
|
353
|
-
"- Do not modify files under `inputs/` unless the same Artifact is also mounted under `outputs/`.",
|
|
354
|
-
"",
|
|
355
|
-
"## Current Stage Artifacts",
|
|
356
|
-
"",
|
|
357
|
-
`- reads: ${stage.reads.join(", ")}`,
|
|
358
|
-
`- writes: ${stage.writes.join(", ")}`,
|
|
359
|
-
"",
|
|
360
|
-
"## Goal",
|
|
361
|
-
"",
|
|
362
|
-
"- complete the current stage",
|
|
363
|
-
"- honor the deterministic contract",
|
|
364
|
-
"- write outputs through the declared Artifact mounts",
|
|
365
|
-
"- stop when the stage is complete",
|
|
366
|
-
"",
|
|
367
|
-
].join("\n");
|
|
368
|
-
}
|
|
369
|
-
function renderStageExecutionSkill(stage, stageBuildPlanDoc) {
|
|
370
|
-
return [
|
|
371
|
-
"---",
|
|
372
|
-
"name: interf-stage",
|
|
373
|
-
"description: >",
|
|
374
|
-
` Native local execution skill for the ${stage.label} stage in this`,
|
|
375
|
-
" Interf run. Use it only inside an automated stage execution shell.",
|
|
376
|
-
"---",
|
|
377
|
-
"",
|
|
378
|
-
`# Interf Stage Execution — ${stage.label}`,
|
|
379
|
-
"",
|
|
380
|
-
"This local native skill exists for automated Interf stage execution.",
|
|
381
|
-
"Read `runtime/stage-contract.json` first.",
|
|
382
|
-
"Then read `runtime/source-snapshot.json`, `runtime/stage-inputs.json`, and `runtime/paths.json`.",
|
|
383
|
-
"Use the assigned source references and the mounted `inputs/` and `outputs/` Artifacts for this stage.",
|
|
384
|
-
"Do not switch into manual query mode.",
|
|
385
|
-
"",
|
|
386
|
-
"## Current Stage",
|
|
387
|
-
"",
|
|
388
|
-
`- id: \`${stage.id}\``,
|
|
389
|
-
`- label: ${stage.label}`,
|
|
390
|
-
`- contract type: \`${stage.contractType}\``,
|
|
391
|
-
`- reads: ${stage.reads.join(", ")}`,
|
|
392
|
-
`- writes: ${stage.writes.join(", ")}`,
|
|
393
|
-
`- editable source: \`build-plan/build/stages/${stage.skillDir}/SKILL.md\``,
|
|
394
|
-
"",
|
|
395
|
-
...(stageBuildPlanDoc
|
|
396
|
-
? [
|
|
397
|
-
"## Stage Build Plan",
|
|
398
|
-
"",
|
|
399
|
-
stageBuildPlanDoc,
|
|
400
|
-
"",
|
|
401
|
-
]
|
|
402
|
-
: []),
|
|
403
|
-
].join("\n");
|
|
404
|
-
}
|
|
405
|
-
function renderVerifiableContextQueryNativeSkill(querySkillContent) {
|
|
406
|
-
return [
|
|
407
|
-
"---",
|
|
408
|
-
"name: interf-query",
|
|
409
|
-
"description: >",
|
|
410
|
-
" Native local query skill for verifiable context built by Interf.",
|
|
411
|
-
" Use it for manual questions against verifiable context and source references.",
|
|
412
|
-
"---",
|
|
413
|
-
"",
|
|
414
|
-
"# Interf Query",
|
|
415
|
-
"",
|
|
416
|
-
"This is the native local query skill for verifiable context built by Interf.",
|
|
417
|
-
"Use it when reading this verifiable context manually.",
|
|
418
|
-
"Editable source: `.interf/build-plan/use/query/SKILL.md`.",
|
|
419
|
-
"",
|
|
420
|
-
querySkillContent.trim(),
|
|
421
|
-
"",
|
|
422
|
-
].join("\n");
|
|
423
|
-
}
|
|
424
|
-
function projectBuildPlanMetadata(verifiableContextPath, shellRoot, stage) {
|
|
425
|
-
const shellBuildPlanRoot = stageShellBuildPlanRoot(shellRoot);
|
|
426
|
-
mkdirSync(join(shellBuildPlanRoot, "build", "stages"), { recursive: true });
|
|
427
|
-
const verifiableContextBuildPlanRoot = buildPlanPackagePathForVerifiableContext(verifiableContextPath);
|
|
428
|
-
const buildPlanJsonPath = join(verifiableContextBuildPlanRoot, "build-plan.json");
|
|
429
|
-
if (existsSync(buildPlanJsonPath)) {
|
|
430
|
-
linkPath(buildPlanJsonPath, join(shellBuildPlanRoot, "build-plan.json"));
|
|
431
|
-
}
|
|
432
|
-
const buildPlanSchemaPath = resolveBuildPlanSchemaPath(verifiableContextBuildPlanRoot);
|
|
433
|
-
if (buildPlanSchemaPath) {
|
|
434
|
-
linkPath(buildPlanSchemaPath, join(shellBuildPlanRoot, BUILD_PLAN_SCHEMA_FILE));
|
|
435
|
-
}
|
|
436
|
-
const readmePath = join(verifiableContextBuildPlanRoot, "README.md");
|
|
437
|
-
if (existsSync(readmePath)) {
|
|
438
|
-
linkPath(readmePath, join(shellBuildPlanRoot, "README.md"));
|
|
439
|
-
}
|
|
440
|
-
const stageDocsPath = stageBuildPlanDocsPath(verifiableContextPath, stage);
|
|
441
|
-
if (existsSync(stageDocsPath)) {
|
|
442
|
-
linkPath(stageDocsPath, join(shellBuildPlanRoot, "build", "stages", stage.skillDir));
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
function projectVerifiableContextSchemaArtifacts(verifiableContextPath, shellRoot, schema, artifactIds, materializedArtifactIds) {
|
|
446
|
-
const allowedArtifactIds = artifactIds ? new Set(artifactIds) : null;
|
|
447
|
-
for (const artifact of listContextInterfaceArtifacts(schema)) {
|
|
448
|
-
if (allowedArtifactIds && !allowedArtifactIds.has(artifact.id))
|
|
449
|
-
continue;
|
|
450
|
-
const sourcePath = verifiableContextArtifactAbsolutePath(verifiableContextPath, artifact);
|
|
451
|
-
const targetPath = join(shellRoot, artifact.path);
|
|
452
|
-
if (materializedArtifactIds?.has(artifact.id)) {
|
|
453
|
-
ensureShellLocalProjection(sourcePath, targetPath, artifact);
|
|
454
|
-
continue;
|
|
455
|
-
}
|
|
456
|
-
linkPath(sourcePath, targetPath);
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
function buildStageArtifactMounts(verifiableContextPath, shellRoot, stage, schema) {
|
|
460
|
-
const artifacts = artifactMap(schema);
|
|
461
|
-
const mountFor = (artifactId) => {
|
|
462
|
-
const artifact = artifactOrThrow(artifacts, artifactId);
|
|
463
|
-
return {
|
|
464
|
-
artifact_id: artifact.id,
|
|
465
|
-
artifact_path: artifact.path,
|
|
466
|
-
shell_root_path: artifact.path,
|
|
467
|
-
input_mount_path: stage.reads.includes(artifactId)
|
|
468
|
-
? describeShellArtifactAliasMountPath(artifact, "inputs")
|
|
469
|
-
: null,
|
|
470
|
-
output_mount_path: stage.writes.includes(artifactId)
|
|
471
|
-
? describeShellArtifactAliasMountPath(artifact, "outputs")
|
|
472
|
-
: null,
|
|
473
|
-
};
|
|
474
|
-
};
|
|
475
|
-
return {
|
|
476
|
-
reads: stage.reads.map(mountFor),
|
|
477
|
-
writes: stage.writes.map(mountFor),
|
|
478
|
-
};
|
|
479
|
-
}
|
|
480
|
-
function projectStageArtifactMountAliases(shellRoot, stage, schema) {
|
|
481
|
-
const artifacts = artifactMap(schema);
|
|
482
|
-
for (const artifactId of new Set([...stage.reads, ...stage.writes])) {
|
|
483
|
-
const artifact = artifactOrThrow(artifacts, artifactId);
|
|
484
|
-
const targetPath = join(shellRoot, artifact.path);
|
|
485
|
-
if (stage.reads.includes(artifactId)) {
|
|
486
|
-
linkRelativePath(targetPath, shellArtifactAliasMountPath(shellRoot, artifact, "inputs"));
|
|
487
|
-
}
|
|
488
|
-
if (stage.writes.includes(artifactId)) {
|
|
489
|
-
linkRelativePath(targetPath, shellArtifactAliasMountPath(shellRoot, artifact, "outputs"));
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
function writeExecutionShellPathsFile(shellRoot, buildPlanId, stage, mounts) {
|
|
494
|
-
const paths = {
|
|
495
|
-
kind: "interf-execution-shell",
|
|
496
|
-
version: 1,
|
|
497
|
-
build_plan: buildPlanId,
|
|
498
|
-
stage: stage.id,
|
|
499
|
-
reads: mounts.reads,
|
|
500
|
-
writes: mounts.writes,
|
|
501
|
-
};
|
|
502
|
-
writeFileSync(shellRuntimePath(shellRoot, "paths.json"), `${JSON.stringify(paths, null, 2)}\n`);
|
|
503
|
-
}
|
|
504
|
-
export function syncStageExecutionShellWrites(verifiableContextPath, shellRoot, stage, writeArtifacts = []) {
|
|
505
|
-
const schema = ensureBuildExecutionSurface(verifiableContextPath);
|
|
506
|
-
const artifacts = artifactMap(schema);
|
|
507
|
-
const stageWriteArtifacts = Array.from(stageWriteArtifactSet(schema, stage))
|
|
508
|
-
.map((artifactId) => artifactOrThrow(artifacts, artifactId));
|
|
509
|
-
for (const artifact of stageWriteArtifacts) {
|
|
510
|
-
const canonicalShellArtifactPath = join(shellRoot, artifact.path);
|
|
511
|
-
const outputAliasPath = shellArtifactAliasMountPath(shellRoot, artifact, "outputs");
|
|
512
|
-
const shellArtifactPath = artifact.kind === "file" &&
|
|
513
|
-
existsSync(outputAliasPath) &&
|
|
514
|
-
!lstatSync(outputAliasPath).isSymbolicLink()
|
|
515
|
-
? outputAliasPath
|
|
516
|
-
: canonicalShellArtifactPath;
|
|
517
|
-
if (!existsSync(shellArtifactPath))
|
|
518
|
-
continue;
|
|
519
|
-
const shellArtifactStat = lstatSync(shellArtifactPath);
|
|
520
|
-
if (shellArtifactStat.isSymbolicLink())
|
|
521
|
-
continue;
|
|
522
|
-
const verifiableContextArtifactPath = verifiableContextArtifactAbsolutePath(verifiableContextPath, artifact);
|
|
523
|
-
if (shellArtifactStat.isDirectory()) {
|
|
524
|
-
const shellArtifactFiles = listFilesRecursive(shellArtifactPath);
|
|
525
|
-
const verifiableContextArtifactFiles = existsSync(verifiableContextArtifactPath)
|
|
526
|
-
? listFilesRecursive(verifiableContextArtifactPath)
|
|
527
|
-
: [];
|
|
528
|
-
if (shellArtifactFiles.length === 0 && verifiableContextArtifactFiles.length > 0) {
|
|
529
|
-
continue;
|
|
530
|
-
}
|
|
531
|
-
rmSync(verifiableContextArtifactPath, { recursive: true, force: true });
|
|
532
|
-
mkdirSync(dirname(verifiableContextArtifactPath), { recursive: true });
|
|
533
|
-
cpSync(shellArtifactPath, verifiableContextArtifactPath, {
|
|
534
|
-
recursive: true,
|
|
535
|
-
force: true,
|
|
536
|
-
});
|
|
537
|
-
continue;
|
|
538
|
-
}
|
|
539
|
-
mkdirSync(dirname(verifiableContextArtifactPath), { recursive: true });
|
|
540
|
-
copyFileSync(shellArtifactPath, verifiableContextArtifactPath);
|
|
541
|
-
}
|
|
542
|
-
for (const artifactPath of writeArtifacts) {
|
|
543
|
-
const normalizedArtifactPath = normalizeArtifactRelativePath(artifactPath);
|
|
544
|
-
if (normalizedArtifactPath.length === 0 ||
|
|
545
|
-
stageWriteArtifacts.some((artifact) => relativePathEqualsOrWithin(artifact.path, normalizedArtifactPath))) {
|
|
546
|
-
continue;
|
|
547
|
-
}
|
|
548
|
-
const shellArtifactPath = join(shellRoot, normalizedArtifactPath);
|
|
549
|
-
if (!existsSync(shellArtifactPath))
|
|
550
|
-
continue;
|
|
551
|
-
const verifiableContextArtifactPath = join(verifiableContextPath, normalizedArtifactPath);
|
|
552
|
-
const shellArtifactStat = lstatSync(shellArtifactPath);
|
|
553
|
-
if (shellArtifactStat.isSymbolicLink())
|
|
554
|
-
continue;
|
|
555
|
-
if (shellArtifactStat.isDirectory()) {
|
|
556
|
-
rmSync(verifiableContextArtifactPath, { recursive: true, force: true });
|
|
557
|
-
mkdirSync(dirname(verifiableContextArtifactPath), { recursive: true });
|
|
558
|
-
cpSync(shellArtifactPath, verifiableContextArtifactPath, {
|
|
559
|
-
recursive: true,
|
|
560
|
-
force: true,
|
|
561
|
-
});
|
|
562
|
-
continue;
|
|
563
|
-
}
|
|
564
|
-
mkdirSync(dirname(verifiableContextArtifactPath), { recursive: true });
|
|
565
|
-
copyFileSync(shellArtifactPath, verifiableContextArtifactPath);
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
function preservedShellManifestPath(rootPath) {
|
|
569
|
-
return shellRuntimePath(rootPath, "preserved-shell.json");
|
|
570
|
-
}
|
|
571
|
-
function shouldSkipFrozenStageShellRelativePath(relativePath) {
|
|
572
|
-
const normalized = relativePath.replaceAll("\\", "/");
|
|
573
|
-
return normalized === "execution-shells" ||
|
|
574
|
-
normalized.endsWith("/execution-shells") ||
|
|
575
|
-
normalized.includes("/execution-shells/") ||
|
|
576
|
-
normalized === "improvement-loops" ||
|
|
577
|
-
normalized.endsWith("/improvement-loops") ||
|
|
578
|
-
normalized.includes("/improvement-loops/");
|
|
579
|
-
}
|
|
580
|
-
/**
|
|
581
|
-
* System path prefixes a malicious symlink in a Build Plan package must
|
|
582
|
-
* never reach. Without this, the freeze-snapshot logic could be
|
|
583
|
-
* tricked into copying anything the running user has access to —
|
|
584
|
-
* `/etc/passwd`, `~/.ssh/id_rsa`, etc. (CSO finding).
|
|
585
|
-
*
|
|
586
|
-
* We deliberately allow targets that escape the immediate freeze
|
|
587
|
-
* root: legitimate execution shells contain symlinks pointing back
|
|
588
|
-
* to the parent Preparation's `interf.json`. The threat is only links
|
|
589
|
-
* that resolve into truly system-level paths.
|
|
590
|
-
*/
|
|
591
|
-
const FORBIDDEN_SYMLINK_TARGET_PREFIXES = [
|
|
592
|
-
"/etc",
|
|
593
|
-
"/sys",
|
|
594
|
-
"/proc",
|
|
595
|
-
"/dev",
|
|
596
|
-
"/var/run",
|
|
597
|
-
"/var/lib",
|
|
598
|
-
"/usr",
|
|
599
|
-
"/bin",
|
|
600
|
-
"/sbin",
|
|
601
|
-
"/boot",
|
|
602
|
-
"/root",
|
|
603
|
-
];
|
|
604
|
-
function ensureSymlinkTargetSafe(realTarget, symlinkPath) {
|
|
605
|
-
for (const prefix of FORBIDDEN_SYMLINK_TARGET_PREFIXES) {
|
|
606
|
-
if (realTarget === prefix || realTarget.startsWith(`${prefix}${pathSep}`)) {
|
|
607
|
-
throw new Error(`Refusing to follow symlink ${symlinkPath} → ${realTarget}: ` +
|
|
608
|
-
`resolves into system directory ${prefix}.`);
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
// Also refuse links that escape into another user's SSH directory
|
|
612
|
-
// even if the path is not on the literal forbidden list.
|
|
613
|
-
if (/\/\.ssh(\/|$)/.test(realTarget)) {
|
|
614
|
-
throw new Error(`Refusing to follow symlink ${symlinkPath} → ${realTarget}: ` +
|
|
615
|
-
`targets a .ssh directory.`);
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
function copyResolvedTree(options) {
|
|
619
|
-
const relativePath = options.relativePath ?? "";
|
|
620
|
-
if (options.shellType === "stage-execution" && shouldSkipFrozenStageShellRelativePath(relativePath)) {
|
|
621
|
-
return { materializedSymlinks: 0 };
|
|
622
|
-
}
|
|
623
|
-
const stat = lstatSync(options.sourcePath);
|
|
624
|
-
if (stat.isSymbolicLink()) {
|
|
625
|
-
// existsSync follows symlinks, so a dangling link (target absent)
|
|
626
|
-
// returns false. Skip those entries: realpathSync would throw
|
|
627
|
-
// ENOENT, and the freeze step is best-effort review material —
|
|
628
|
-
// losing one unresolvable link is better than aborting the whole
|
|
629
|
-
// snapshot. Production trigger: createStageExecutionShell links
|
|
630
|
-
// runtime/stage-contract.json before writeStageContract runs, so
|
|
631
|
-
// any failure between those two points leaves a dangling link
|
|
632
|
-
// that the per-stage finally-block freeze would otherwise hit.
|
|
633
|
-
if (!existsSync(options.sourcePath)) {
|
|
634
|
-
return { materializedSymlinks: 0 };
|
|
635
|
-
}
|
|
636
|
-
const realTarget = realpathSync(options.sourcePath);
|
|
637
|
-
// Refuse symlinks resolving into system paths (CSO finding). We
|
|
638
|
-
// deliberately allow links that escape the immediate freeze root
|
|
639
|
-
// because legitimate execution shells contain links back to the
|
|
640
|
-
// parent Preparation's interf.json — the only thing we care about
|
|
641
|
-
// is that the realpath does not land in /etc, /sys, /proc, etc.
|
|
642
|
-
ensureSymlinkTargetSafe(realTarget, options.sourcePath);
|
|
643
|
-
const realStat = statSync(realTarget);
|
|
644
|
-
if (realStat.isDirectory()) {
|
|
645
|
-
const mappedTarget = options.materializedRealPaths?.get(realTarget);
|
|
646
|
-
if (mappedTarget) {
|
|
647
|
-
linkRelativePath(mappedTarget, options.targetPath);
|
|
648
|
-
return { materializedSymlinks: 1 };
|
|
649
|
-
}
|
|
650
|
-
return {
|
|
651
|
-
materializedSymlinks: 1 + copyResolvedTree({
|
|
652
|
-
sourcePath: realTarget,
|
|
653
|
-
targetPath: options.targetPath,
|
|
654
|
-
shellType: options.shellType,
|
|
655
|
-
relativePath,
|
|
656
|
-
activeRealPaths: options.activeRealPaths,
|
|
657
|
-
materializedRealPaths: options.materializedRealPaths,
|
|
658
|
-
}).materializedSymlinks,
|
|
659
|
-
};
|
|
660
|
-
}
|
|
661
|
-
mkdirSync(dirname(options.targetPath), { recursive: true });
|
|
662
|
-
copyFileSync(realTarget, options.targetPath);
|
|
663
|
-
return { materializedSymlinks: 1 };
|
|
664
|
-
}
|
|
665
|
-
if (stat.isDirectory()) {
|
|
666
|
-
const realSource = realpathSync(options.sourcePath);
|
|
667
|
-
const mappedTarget = options.materializedRealPaths?.get(realSource);
|
|
668
|
-
if (mappedTarget && mappedTarget !== options.targetPath) {
|
|
669
|
-
linkRelativePath(mappedTarget, options.targetPath);
|
|
670
|
-
return { materializedSymlinks: 0 };
|
|
671
|
-
}
|
|
672
|
-
const nextRealPaths = new Set([...(options.activeRealPaths ?? []), realSource]);
|
|
673
|
-
const nextMaterializedRealPaths = new Map(options.materializedRealPaths ?? []);
|
|
674
|
-
nextMaterializedRealPaths.set(realSource, options.targetPath);
|
|
675
|
-
mkdirSync(options.targetPath, { recursive: true });
|
|
676
|
-
let materializedSymlinks = 0;
|
|
677
|
-
for (const entry of readdirSync(options.sourcePath)) {
|
|
678
|
-
const childRelativePath = relativePath.length > 0 ? `${relativePath}/${entry}` : entry;
|
|
679
|
-
const copied = copyResolvedTree({
|
|
680
|
-
sourcePath: join(options.sourcePath, entry),
|
|
681
|
-
targetPath: join(options.targetPath, entry),
|
|
682
|
-
shellType: options.shellType,
|
|
683
|
-
relativePath: childRelativePath,
|
|
684
|
-
activeRealPaths: nextRealPaths,
|
|
685
|
-
materializedRealPaths: nextMaterializedRealPaths,
|
|
686
|
-
});
|
|
687
|
-
materializedSymlinks += copied.materializedSymlinks;
|
|
688
|
-
}
|
|
689
|
-
return { materializedSymlinks };
|
|
690
|
-
}
|
|
691
|
-
mkdirSync(dirname(options.targetPath), { recursive: true });
|
|
692
|
-
copyFileSync(options.sourcePath, options.targetPath);
|
|
693
|
-
return { materializedSymlinks: 0 };
|
|
694
|
-
}
|
|
695
|
-
function freezePreservedShell(rootPath, shellType) {
|
|
696
|
-
if (!existsSync(rootPath))
|
|
697
|
-
return null;
|
|
698
|
-
const manifestPath = preservedShellManifestPath(rootPath);
|
|
699
|
-
if (existsSync(manifestPath))
|
|
700
|
-
return manifestPath;
|
|
701
|
-
const tempRoot = `${rootPath}.frozen-${Date.now().toString(36)}`;
|
|
702
|
-
const copied = copyResolvedTree({
|
|
703
|
-
sourcePath: rootPath,
|
|
704
|
-
targetPath: tempRoot,
|
|
705
|
-
shellType,
|
|
706
|
-
});
|
|
707
|
-
const manifest = {
|
|
708
|
-
kind: "interf-preserved-shell",
|
|
709
|
-
version: 1,
|
|
710
|
-
shell_type: shellType,
|
|
711
|
-
generated_at: new Date().toISOString(),
|
|
712
|
-
root_path: rootPath,
|
|
713
|
-
materialized_symlinks: copied.materializedSymlinks,
|
|
714
|
-
};
|
|
715
|
-
writeFileSync(preservedShellManifestPath(tempRoot), `${JSON.stringify(manifest, null, 2)}\n`);
|
|
716
|
-
rmSync(rootPath, { recursive: true, force: true });
|
|
717
|
-
renameSync(tempRoot, rootPath);
|
|
718
|
-
return manifestPath;
|
|
719
|
-
}
|
|
720
|
-
export function renderClaudeBootstrap(content) {
|
|
721
|
-
return [
|
|
722
|
-
"<!-- Generated mirror of AGENTS.md. Interf may rewrite this file. -->",
|
|
723
|
-
"",
|
|
724
|
-
content.trimEnd(),
|
|
725
|
-
"",
|
|
726
|
-
].join("\n");
|
|
727
|
-
}
|
|
728
|
-
function renderBuildPlanAuthoringAgents(options) {
|
|
729
|
-
return [
|
|
730
|
-
`# ${options.label} — Build Plan Authoring Shell`,
|
|
731
|
-
"",
|
|
732
|
-
"This is an automated Build Plan authoring shell generated by Interf.",
|
|
733
|
-
"It exists to create one standalone Build Plan package from the source data, desired verifiable-context outputs, and proof requirements in this task.",
|
|
734
|
-
"",
|
|
735
|
-
"## Start Here",
|
|
736
|
-
"",
|
|
737
|
-
"1. Read `runtime/authoring-context.json` now.",
|
|
738
|
-
`2. Read \`build-plan/README.md\`, \`build-plan/build-plan.json\`, and \`build-plan/${BUILD_PLAN_SCHEMA_FILE}\` now.`,
|
|
739
|
-
"3. Read `runtime/source-files.json` and review the listed source locators.",
|
|
740
|
-
"4. Use the local native `interf-build-plan-author` skill now.",
|
|
741
|
-
"",
|
|
742
|
-
"## Boundaries",
|
|
743
|
-
"",
|
|
744
|
-
`- New Build Plan id: \`${options.buildPlanId}\`.`,
|
|
745
|
-
"- Authoring mode: from scratch.",
|
|
746
|
-
...(options.referenceBuildPlanId
|
|
747
|
-
? [`- Reference Build Plan id: \`${options.referenceBuildPlanId}\` (context only, not a seed).`]
|
|
748
|
-
: []),
|
|
749
|
-
"- Edit only files under `build-plan/`.",
|
|
750
|
-
"- Do not edit source artifacts.",
|
|
751
|
-
"- Keep the Build Plan package valid for the current build API and `build-plan.schema.json`.",
|
|
752
|
-
"- Use kebab-case ids everywhere: stage ids, skill_dir values, Artifact ids, reads/writes values, and package ids. Never use underscores.",
|
|
753
|
-
"- Put deterministic validation on Artifact `checks[]`; do not add stage `acceptance` blocks.",
|
|
754
|
-
"- Prefer direct file-reading and search tools over shell commands for routine file inspection.",
|
|
755
|
-
"- Do not use shell helpers like `cat`, `sed`, `ls`, or `find` when a native read/search tool can inspect the same files.",
|
|
756
|
-
"",
|
|
757
|
-
"## Goal",
|
|
758
|
-
"",
|
|
759
|
-
"- produce one standalone Build Plan package tuned to the source data, desired outputs, and checks in this task",
|
|
760
|
-
"- replace the neutral scaffold topology with the stage graph this agent work needs",
|
|
761
|
-
"- define Artifacts and checks so Interf can show whether the data is ready",
|
|
762
|
-
"- satisfy every `artifact_requirements[]` entry from `runtime/authoring-context.json` when entries are present",
|
|
763
|
-
"- otherwise draft the Build Plan Artifacts from every `requested_artifacts[]` entry; do not ignore or truncate them",
|
|
764
|
-
"- preserve deterministic stage and context-interface contracts",
|
|
765
|
-
"- stop once the Build Plan edits are complete",
|
|
766
|
-
"",
|
|
767
|
-
].join("\n");
|
|
768
|
-
}
|
|
769
|
-
function renderBuildPlanAuthoringSkill() {
|
|
770
|
-
return [
|
|
771
|
-
"---",
|
|
772
|
-
"name: interf-build-plan-author",
|
|
773
|
-
"description: >",
|
|
774
|
-
" Native local Build Plan authoring skill for an automated Interf Build Plan draft run.",
|
|
775
|
-
"---",
|
|
776
|
-
"",
|
|
777
|
-
"# Interf Build Plan Authoring",
|
|
778
|
-
"",
|
|
779
|
-
"Read `runtime/authoring-context.json` first.",
|
|
780
|
-
"Then review the neutral Build Plan package scaffold under `build-plan/`, read `runtime/source-files.json`, and inspect the listed source locators when needed.",
|
|
781
|
-
"",
|
|
782
|
-
"Rules:",
|
|
783
|
-
"- edit only `build-plan/`",
|
|
784
|
-
`- keep \`build-plan.json\`, \`${BUILD_PLAN_SCHEMA_FILE}\`, and any changed stage docs aligned`,
|
|
785
|
-
"- put deterministic validation on Artifact `checks[]`; do not add stage `acceptance` blocks",
|
|
786
|
-
"- use only CheckKind values listed in `runtime/authoring-context.json`; do not invent aliases",
|
|
787
|
-
"- keep Artifact checks aligned with produced outputs; use stage docs to describe the output contract without requiring exact source-specific phrases in the stage docs",
|
|
788
|
-
"- satisfy every `artifact_requirements[]` entry from `runtime/authoring-context.json` when entries are present",
|
|
789
|
-
"- otherwise draft the Build Plan Artifacts from every `requested_artifacts[]` entry; do not ignore or truncate them",
|
|
790
|
-
"- design the stage graph from the source data and preparation-and-evidence brief",
|
|
791
|
-
"- use kebab-case ids everywhere: stage ids, skill_dir values, Artifact ids, reads/writes values, and package ids; never use underscores",
|
|
792
|
-
"- replace the placeholder `prepare` stage unless that exact stage is truly the final Build Plan",
|
|
793
|
-
"- keep the package standalone; do not introduce runtime inheritance or hidden source-package assumptions",
|
|
794
|
-
"- do not introduce wikilinks unless the Build Plan also creates the target note by exact basename or explicit relative path",
|
|
795
|
-
"- respect stage boundaries: do not make structure outputs link to notes or entrypoints first created by later stages",
|
|
796
|
-
"- prefer conservative routing changes over speculative note sprawl",
|
|
797
|
-
"- prefer direct file-reading and search tools over shell commands for routine file inspection",
|
|
798
|
-
"- do not use shell helpers like `cat`, `sed`, `ls`, or `find` when a native read/search tool can inspect the same files",
|
|
799
|
-
"- do not hardcode readiness-check answers into reusable Build Plan docs",
|
|
800
|
-
"- do not edit source artifacts",
|
|
801
|
-
"",
|
|
802
|
-
].join("\n");
|
|
803
|
-
}
|
|
804
|
-
function improvementBuildPlanDocsPath(verifiableContextPath) {
|
|
805
|
-
return join(buildPlanPackagePathForVerifiableContext(verifiableContextPath), "improve");
|
|
806
|
-
}
|
|
807
|
-
export function createBuildPlanAuthoringShell(options) {
|
|
808
|
-
const shellRoot = mkdtempSync(join(tmpdir(), `interf-build-plan-author-${options.buildPlanId}-`));
|
|
809
|
-
mkdirSync(join(shellRoot, "runtime"), { recursive: true });
|
|
810
|
-
mkdirSync(join(shellRoot, "artifacts"), { recursive: true });
|
|
811
|
-
mkdirSync(join(shellRoot, "logs"), { recursive: true });
|
|
812
|
-
const context = {
|
|
813
|
-
kind: "interf-build-plan-authoring",
|
|
814
|
-
version: 1,
|
|
815
|
-
generated_at: new Date().toISOString(),
|
|
816
|
-
authoring_mode: "from-scratch",
|
|
817
|
-
build_plan_id: options.buildPlanId,
|
|
818
|
-
build_plan_label: options.label,
|
|
819
|
-
...(options.referenceBuildPlanId ? { reference_build_plan_id: options.referenceBuildPlanId } : {}),
|
|
820
|
-
task_prompt: options.taskPrompt,
|
|
821
|
-
allowed_check_kinds: CHECK_KINDS,
|
|
822
|
-
requested_artifacts: options.requestedArtifacts ?? [],
|
|
823
|
-
artifact_requirements: options.artifactRequirements ?? [],
|
|
824
|
-
preparation: {
|
|
825
|
-
source_folder_path: options.sourceFolderPath,
|
|
826
|
-
source_profile: options.sourceProfile ?? null,
|
|
827
|
-
checks: {
|
|
828
|
-
count: options.checks.length,
|
|
829
|
-
questions: options.checks.map((check, index) => ({
|
|
830
|
-
id: check.id ?? `check-${index + 1}`,
|
|
831
|
-
question: check.question,
|
|
832
|
-
})),
|
|
833
|
-
},
|
|
834
|
-
},
|
|
835
|
-
};
|
|
836
|
-
writeFileSync(join(shellRoot, "runtime", "authoring-context.json"), `${JSON.stringify(context, null, 2)}\n`);
|
|
837
|
-
writeFileSync(join(shellRoot, "runtime", "source-files.json"), `${JSON.stringify(buildVerifiableContextSourceFiles(shellRoot, options.sourceFolderPath), null, 2)}\n`);
|
|
838
|
-
copyResolvedTree({
|
|
839
|
-
sourcePath: options.buildPlanPath,
|
|
840
|
-
targetPath: join(shellRoot, "build-plan"),
|
|
841
|
-
shellType: "build-plan-authoring",
|
|
842
|
-
});
|
|
843
|
-
writeNativeAgentSurface(shellRoot, renderBuildPlanAuthoringAgents({
|
|
844
|
-
buildPlanId: options.buildPlanId,
|
|
845
|
-
label: options.label,
|
|
846
|
-
referenceBuildPlanId: options.referenceBuildPlanId ?? null,
|
|
847
|
-
}), "interf-build-plan-author", renderBuildPlanAuthoringSkill());
|
|
848
|
-
return {
|
|
849
|
-
rootPath: shellRoot,
|
|
850
|
-
buildPlanBeforePath: join(shellRoot, "artifacts", "build-plan-before"),
|
|
851
|
-
buildPlanAfterPath: join(shellRoot, "artifacts", "build-plan-after"),
|
|
852
|
-
promptLogPath: join(shellRoot, "logs", "build-plan-author.prompt.txt"),
|
|
853
|
-
eventLogPath: join(shellRoot, "logs", "build-plan-author.events.ndjson"),
|
|
854
|
-
statusLogPath: join(shellRoot, "logs", "build-plan-author.status.log"),
|
|
855
|
-
};
|
|
856
|
-
}
|
|
857
|
-
function renderBuildPlanImprovementAgents(verifiableContextName, buildPlanId, loopIndex) {
|
|
858
|
-
return [
|
|
859
|
-
`# ${verifiableContextName} — Build Plan Improvement Shell`,
|
|
860
|
-
"",
|
|
861
|
-
"This is an automated Build Plan improvement shell generated by Interf.",
|
|
862
|
-
"It exists to review failed Build/check runs and edit the Build Plan package for the next variation.",
|
|
863
|
-
"",
|
|
864
|
-
"## Start Here",
|
|
865
|
-
"",
|
|
866
|
-
"1. Read `runtime/loop-context.json` now.",
|
|
867
|
-
`2. Read \`build-plan/README.md\`, \`build-plan/build-plan.json\`, and \`build-plan/${BUILD_PLAN_SCHEMA_FILE}\` now.`,
|
|
868
|
-
"3. Read `build-plan/improve/SKILL.md` now.",
|
|
869
|
-
"4. Use the local native `interf-build-plan-improver` skill now.",
|
|
870
|
-
"",
|
|
871
|
-
"## Boundaries",
|
|
872
|
-
"",
|
|
873
|
-
`- Build Plan: \`${buildPlanId}\`.`,
|
|
874
|
-
`- Improvement loop: ${loopIndex}.`,
|
|
875
|
-
"- Edit only files under `build-plan/`.",
|
|
876
|
-
"- Do not edit checks, test specs, source files, or generated context outputs.",
|
|
877
|
-
"- Review verifiable-context outputs under `artifacts/verifiable-context-view/` and test/runtime evidence under `artifacts/`.",
|
|
878
|
-
"- Keep the Build Plan package valid for the current build API and `build-plan.schema.json`.",
|
|
879
|
-
"- Put deterministic validation on Artifact `checks[]`; do not add stage `acceptance` blocks.",
|
|
880
|
-
"",
|
|
881
|
-
"## Goal",
|
|
882
|
-
"",
|
|
883
|
-
"- create a better Build Plan variation for this kind of agent work",
|
|
884
|
-
"- preserve deterministic verifiable-context structure",
|
|
885
|
-
"- stop after the Build Plan edits are complete",
|
|
886
|
-
"",
|
|
887
|
-
].join("\n");
|
|
888
|
-
}
|
|
889
|
-
function readBuildPlanImprovementDoc(verifiableContextPath) {
|
|
890
|
-
const path = join(improvementBuildPlanDocsPath(verifiableContextPath), "SKILL.md");
|
|
891
|
-
if (!existsSync(path))
|
|
892
|
-
return null;
|
|
893
|
-
return readFileSync(path, "utf8").trim();
|
|
894
|
-
}
|
|
895
|
-
function renderBuildPlanImprovementSkill(buildPlanId, loopIndex, improvementDoc) {
|
|
896
|
-
return [
|
|
897
|
-
"---",
|
|
898
|
-
"name: interf-build-plan-improver",
|
|
899
|
-
"description: >",
|
|
900
|
-
" Native local Build Plan improvement skill for this Interf run.",
|
|
901
|
-
" Use it only inside an automated Build Plan improvement shell.",
|
|
902
|
-
"---",
|
|
903
|
-
"",
|
|
904
|
-
`# Interf Build Plan Improvement — ${buildPlanId}`,
|
|
905
|
-
"",
|
|
906
|
-
"This local native skill exists for automated Build Plan improvement loops.",
|
|
907
|
-
"Read `runtime/loop-context.json` first.",
|
|
908
|
-
"Then review the linked Build Plan package, `artifacts/verifiable-context-view/`, preserved stage shells, runtime logs, and saved test outputs before editing `build-plan/`.",
|
|
909
|
-
"",
|
|
910
|
-
"## Current Loop",
|
|
911
|
-
"",
|
|
912
|
-
`- Build Plan: \`${buildPlanId}\``,
|
|
913
|
-
`- loop index: ${loopIndex}`,
|
|
914
|
-
"- editable source: `build-plan/improve/SKILL.md`",
|
|
915
|
-
"",
|
|
916
|
-
...(improvementDoc
|
|
917
|
-
? [
|
|
918
|
-
"## Improvement Guidance",
|
|
919
|
-
"",
|
|
920
|
-
improvementDoc,
|
|
921
|
-
"",
|
|
922
|
-
]
|
|
923
|
-
: []),
|
|
924
|
-
].join("\n");
|
|
925
|
-
}
|
|
926
|
-
function projectVerifiableContextReviewArtifactsSnapshot(verifiableContextPath, shellRoot, schema) {
|
|
927
|
-
const verifiableContextViewRoot = join(shellRoot, "artifacts", "verifiable-context-view");
|
|
928
|
-
mkdirSync(verifiableContextViewRoot, { recursive: true });
|
|
929
|
-
for (const artifact of listContextInterfaceArtifacts(schema)) {
|
|
930
|
-
if (artifact.kind === "runtime" || artifact.path === "source-files")
|
|
931
|
-
continue;
|
|
932
|
-
const sourcePath = verifiableContextArtifactAbsolutePath(verifiableContextPath, artifact);
|
|
933
|
-
if (!existsSync(sourcePath))
|
|
934
|
-
continue;
|
|
935
|
-
copyResolvedTree({
|
|
936
|
-
sourcePath,
|
|
937
|
-
targetPath: join(verifiableContextViewRoot, artifact.path),
|
|
938
|
-
shellType: "build-plan-improvement",
|
|
939
|
-
});
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
function copyIfExists(sourcePath, targetPath, shellType) {
|
|
943
|
-
if (!existsSync(sourcePath))
|
|
944
|
-
return;
|
|
945
|
-
copyResolvedTree({
|
|
946
|
-
sourcePath,
|
|
947
|
-
targetPath,
|
|
948
|
-
shellType,
|
|
949
|
-
});
|
|
950
|
-
}
|
|
951
|
-
function projectVerifiableContextRuntimeArtifacts(verifiableContextPath, shellRoot) {
|
|
952
|
-
const runtimeTarget = join(shellRoot, "artifacts", "verifiable-context-runtime");
|
|
953
|
-
mkdirSync(runtimeTarget, { recursive: true });
|
|
954
|
-
const runtimeRoot = verifiableContextRuntimeRoot(verifiableContextPath);
|
|
955
|
-
const artifactNames = [
|
|
956
|
-
"run.json",
|
|
957
|
-
"run-history.jsonl",
|
|
958
|
-
"state.json",
|
|
959
|
-
"health.json",
|
|
960
|
-
"view-spec.json",
|
|
961
|
-
"source-files.json",
|
|
962
|
-
"source-snapshot.json",
|
|
963
|
-
"stages",
|
|
964
|
-
"logs",
|
|
965
|
-
];
|
|
966
|
-
for (const artifactName of artifactNames) {
|
|
967
|
-
copyIfExists(join(runtimeRoot, artifactName), join(runtimeTarget, artifactName), "build-plan-improvement");
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
export function pruneStageExecutionShells(verifiableContextPath) {
|
|
971
|
-
rmSync(stageExecutionShellsRoot(verifiableContextPath), { recursive: true, force: true });
|
|
972
|
-
}
|
|
973
|
-
export function projectVerifiableContextQueryShell(verifiableContextPath, verifiableContextName, buildPlanId, about, options) {
|
|
974
|
-
const agentsContent = renderVerifiableContextAgents(verifiableContextPath, verifiableContextName, buildPlanId, about, options);
|
|
975
|
-
const querySkillContent = readVerifiableContextQuerySkillSource(verifiableContextPath);
|
|
976
|
-
return writeNativeAgentSurface(verifiableContextPath, agentsContent, "interf-query", renderVerifiableContextQueryNativeSkill(querySkillContent));
|
|
977
|
-
}
|
|
978
|
-
export function projectSourceFilesTestQueryShell(rootPath) {
|
|
979
|
-
return writeNativeAgentSurface(rootPath, renderSourceFilesTestAgents(), "interf-query", renderSourceFilesTestQuerySkill());
|
|
980
|
-
}
|
|
981
|
-
export function createStageExecutionShell(verifiableContextPath, verifiableContextName, buildPlanId, stage, writeArtifacts = []) {
|
|
982
|
-
const schema = ensureBuildExecutionSurface(verifiableContextPath);
|
|
983
|
-
const materializedArtifacts = stageMaterializedArtifactSet(schema, stage, writeArtifacts);
|
|
984
|
-
const shellsRoot = stageExecutionShellsRoot(verifiableContextPath);
|
|
985
|
-
const shellRoot = join(shellsRoot, `${stage.id}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`);
|
|
986
|
-
mkdirSync(shellRoot, { recursive: true });
|
|
987
|
-
mkdirSync(join(shellRoot, "runtime"), { recursive: true });
|
|
988
|
-
mkdirSync(join(shellRoot, ".interf", "runtime"), { recursive: true });
|
|
989
|
-
mkdirSync(join(shellRoot, "inputs"), { recursive: true });
|
|
990
|
-
mkdirSync(join(shellRoot, "outputs"), { recursive: true });
|
|
991
|
-
linkPath(verifiableContextInterfConfigPath(verifiableContextPath), join(shellRoot, "interf.json"));
|
|
992
|
-
linkPath(join(verifiableContextRuntimeRoot(verifiableContextPath), "stage-contract.json"), shellRuntimePath(shellRoot, "stage-contract.json"));
|
|
993
|
-
linkIfExists(verifiableContextRuntimeSourceSnapshotPath(verifiableContextPath), shellRuntimePath(shellRoot, "source-snapshot.json"));
|
|
994
|
-
linkIfExists(verifiableContextRuntimeStageInputsPath(verifiableContextPath, stage.id), shellRuntimePath(shellRoot, "stage-inputs.json"));
|
|
995
|
-
projectVerifiableContextSchemaArtifacts(verifiableContextPath, shellRoot, schema, new Set([...stage.reads, ...stage.writes]), materializedArtifacts);
|
|
996
|
-
projectBuildPlanMetadata(verifiableContextPath, shellRoot, stage);
|
|
997
|
-
projectStageArtifactMountAliases(shellRoot, stage, schema);
|
|
998
|
-
writeExecutionShellPathsFile(shellRoot, buildPlanId, stage, buildStageArtifactMounts(verifiableContextPath, shellRoot, stage, schema));
|
|
999
|
-
const agentsContent = renderStageExecutionAgents(verifiableContextName, buildPlanId, stage);
|
|
1000
|
-
writeNativeAgentSurface(shellRoot, agentsContent, "interf-stage", renderStageExecutionSkill(stage, readStageBuildPlanDoc(verifiableContextPath, stage)));
|
|
1001
|
-
return {
|
|
1002
|
-
rootPath: shellRoot,
|
|
1003
|
-
};
|
|
1004
|
-
}
|
|
1005
|
-
export function freezeStageExecutionShell(rootPath) {
|
|
1006
|
-
return freezePreservedShell(rootPath, "stage-execution");
|
|
1007
|
-
}
|
|
1008
|
-
export function createBuildPlanImprovementShell(options) {
|
|
1009
|
-
const schema = ensureBuildExecutionSurface(options.verifiableContextPath);
|
|
1010
|
-
const loopRootPath = buildPlanImprovementLoopRoot(options.verifiableContextPath, options.runId, options.loopIndex);
|
|
1011
|
-
const shellRoot = join(loopRootPath, "shell");
|
|
1012
|
-
mkdirSync(shellRoot, { recursive: true });
|
|
1013
|
-
mkdirSync(join(shellRoot, "runtime"), { recursive: true });
|
|
1014
|
-
mkdirSync(join(shellRoot, "artifacts"), { recursive: true });
|
|
1015
|
-
mkdirSync(join(loopRootPath, "logs"), { recursive: true });
|
|
1016
|
-
writeFileSync(join(shellRoot, "runtime", "loop-context.json"), `${JSON.stringify(options.context, null, 2)}\n`);
|
|
1017
|
-
projectVerifiableContextReviewArtifactsSnapshot(options.verifiableContextPath, shellRoot, schema);
|
|
1018
|
-
copyResolvedTree({
|
|
1019
|
-
sourcePath: buildPlanPackagePathForVerifiableContext(options.verifiableContextPath),
|
|
1020
|
-
targetPath: join(shellRoot, "build-plan"),
|
|
1021
|
-
shellType: "build-plan-improvement",
|
|
1022
|
-
});
|
|
1023
|
-
copyIfExists(verifiableContextInterfConfigPath(options.verifiableContextPath), join(shellRoot, "interf.json"), "build-plan-improvement");
|
|
1024
|
-
projectVerifiableContextRuntimeArtifacts(options.verifiableContextPath, shellRoot);
|
|
1025
|
-
const reviewSources = resolveBuildPlanImprovementReviewSourcePaths(options.verifiableContextPath);
|
|
1026
|
-
if (reviewSources.executionShells) {
|
|
1027
|
-
copyIfExists(reviewSources.executionShells, join(shellRoot, "artifacts", "execution-shells"), "build-plan-improvement");
|
|
1028
|
-
}
|
|
1029
|
-
if (reviewSources.readinessRuns) {
|
|
1030
|
-
copyIfExists(reviewSources.readinessRuns, join(shellRoot, "artifacts", "readiness-runs"), "build-plan-improvement");
|
|
1031
|
-
}
|
|
1032
|
-
if (reviewSources.targetTestRuns) {
|
|
1033
|
-
copyIfExists(reviewSources.targetTestRuns, join(shellRoot, "artifacts", "test-runs"), "build-plan-improvement");
|
|
1034
|
-
}
|
|
1035
|
-
if (reviewSources.targetTestSandboxes) {
|
|
1036
|
-
copyIfExists(reviewSources.targetTestSandboxes, join(shellRoot, "artifacts", "test-sandboxes"), "build-plan-improvement");
|
|
1037
|
-
}
|
|
1038
|
-
const agentsContent = renderBuildPlanImprovementAgents(options.verifiableContextName, options.buildPlanId, options.loopIndex);
|
|
1039
|
-
writeNativeAgentSurface(shellRoot, agentsContent, "interf-build-plan-improver", renderBuildPlanImprovementSkill(options.buildPlanId, options.loopIndex, readBuildPlanImprovementDoc(options.verifiableContextPath)));
|
|
1040
|
-
return {
|
|
1041
|
-
rootPath: shellRoot,
|
|
1042
|
-
loopRootPath,
|
|
1043
|
-
buildPlanBeforePath: join(loopRootPath, "build-plan-before"),
|
|
1044
|
-
buildPlanAfterPath: join(loopRootPath, "build-plan-after"),
|
|
1045
|
-
promptLogPath: join(loopRootPath, "logs", "build-plan-improver.prompt.txt"),
|
|
1046
|
-
eventLogPath: join(loopRootPath, "logs", "build-plan-improver.events.ndjson"),
|
|
1047
|
-
statusLogPath: join(loopRootPath, "logs", "build-plan-improver.status.log"),
|
|
1048
|
-
};
|
|
1049
|
-
}
|
|
1050
|
-
export function freezeBuildPlanImprovementShell(rootPath) {
|
|
1051
|
-
return freezePreservedShell(rootPath, "build-plan-improvement");
|
|
1052
|
-
}
|