@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
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ResetResult } from "./schemas/index.js";
|
|
2
|
+
import type { ProjectConfig } from "../projects/lib/schema.js";
|
|
3
|
+
import type { LocalServiceRuntime } from "./runtime.js";
|
|
4
|
+
export declare function applyReset(runtime: LocalServiceRuntime, projectDataDir: string, requestValue: unknown): ResetResult;
|
|
5
|
+
export declare function resolveProjectConfig(projectDataDir: string, projectName: string, overrides?: Partial<Pick<ProjectConfig, "build_plan">>): ProjectConfig;
|
|
6
|
+
export declare function ensureContextGraphForRun(projectDataDir: string, projectConfig: ProjectConfig, runId: string): string;
|
|
7
|
+
export declare function defaultProjectId(projectDataDir: string): string;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { asProjectDataDir, projectContextGraphPath, projectRunContextGraphPath, } from "../contracts/lib/project-paths.js";
|
|
3
|
+
import { buildPlanIdForProjectConfig, findProjectConfig, listProjectConfigs, loadSourceFolderConfig, syncContextGraphInterfConfigFromProjectConfig, } from "../projects/source-config.js";
|
|
4
|
+
import { ensureContextGraphScaffoldAt, } from "./context-graph-scaffold.js";
|
|
5
|
+
import { resetBuildGeneratedState, } from "./build/reset.js";
|
|
6
|
+
import { ResetRequestSchema, ResetResultSchema, } from "./schemas/index.js";
|
|
7
|
+
import { requireSelectedBuildPlan } from "./runtime-proposal-helpers.js";
|
|
8
|
+
export function applyReset(runtime, projectDataDir, requestValue) {
|
|
9
|
+
const request = ResetRequestSchema.parse(requestValue);
|
|
10
|
+
const project = findProjectConfig(loadSourceFolderConfig(projectDataDir), request.project);
|
|
11
|
+
if (!project) {
|
|
12
|
+
throw new Error(`Project "${request.project}" is not saved.`);
|
|
13
|
+
}
|
|
14
|
+
const projectData = asProjectDataDir(projectDataDir);
|
|
15
|
+
const contextGraphPath = project.latest_context_graph_run_id
|
|
16
|
+
? projectRunContextGraphPath(projectData, project.latest_context_graph_run_id)
|
|
17
|
+
: projectContextGraphPath(projectData, request.project);
|
|
18
|
+
if (!existsSync(contextGraphPath)) {
|
|
19
|
+
throw new Error(`Context Graph for Project "${request.project}" does not exist.`);
|
|
20
|
+
}
|
|
21
|
+
resetBuildGeneratedState(contextGraphPath, request.scope);
|
|
22
|
+
// Reset wipes generated state, including saved Build/benchmark/readiness records.
|
|
23
|
+
runtime.buildRunCache.invalidateProject(projectDataDir, request.project);
|
|
24
|
+
runtime.verifyRunCache.invalidateProject(projectDataDir, request.project);
|
|
25
|
+
runtime.readinessCache.invalidateProject(projectDataDir, request.project);
|
|
26
|
+
runtime.contextGraphResourceCache.invalidateProject(projectDataDir);
|
|
27
|
+
return ResetResultSchema.parse({
|
|
28
|
+
kind: "interf-reset-result",
|
|
29
|
+
version: 1,
|
|
30
|
+
project: request.project,
|
|
31
|
+
scope: request.scope,
|
|
32
|
+
context_graph_path: contextGraphPath,
|
|
33
|
+
changed: true,
|
|
34
|
+
message: `Reset ${request.scope} state for Project ${request.project}.`,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export function resolveProjectConfig(projectDataDir, projectName, overrides = {}) {
|
|
38
|
+
const project = findProjectConfig(loadSourceFolderConfig(projectDataDir), projectName);
|
|
39
|
+
if (!project) {
|
|
40
|
+
throw new Error(`Project "${projectName}" is not saved in this control plane folder.`);
|
|
41
|
+
}
|
|
42
|
+
const buildPlan = overrides.build_plan ?? buildPlanIdForProjectConfig(project) ?? undefined;
|
|
43
|
+
return {
|
|
44
|
+
...project,
|
|
45
|
+
...(buildPlan ? { build_plan: buildPlan } : {}),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function ensureContextGraphForRun(projectDataDir, projectConfig, runId) {
|
|
49
|
+
const buildPlanId = requireSelectedBuildPlan(projectConfig);
|
|
50
|
+
const contextGraphPath = ensureContextGraphScaffoldAt({
|
|
51
|
+
projectDataDir,
|
|
52
|
+
contextGraphPath: projectRunContextGraphPath(asProjectDataDir(projectDataDir), runId),
|
|
53
|
+
projectName: projectConfig.name,
|
|
54
|
+
buildPlanId,
|
|
55
|
+
});
|
|
56
|
+
syncContextGraphInterfConfigFromProjectConfig(contextGraphPath, projectConfig);
|
|
57
|
+
return contextGraphPath;
|
|
58
|
+
}
|
|
59
|
+
export function defaultProjectId(projectDataDir) {
|
|
60
|
+
const project = listProjectConfigs(loadSourceFolderConfig(projectDataDir))[0];
|
|
61
|
+
if (!project) {
|
|
62
|
+
throw new Error("No Project is saved in this control plane folder.");
|
|
63
|
+
}
|
|
64
|
+
return project.name;
|
|
65
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Readiness } from "../contracts/lib/schema.js";
|
|
2
|
+
import { type ContextGraphHandoff } from "../contracts/lib/project-schema.js";
|
|
3
|
+
import { type ProjectResource, type SourceFileResource, type ContextGraphResource, type StageExecutionSession } from "./schemas/index.js";
|
|
4
|
+
import type { ProjectConfig } from "../projects/lib/schema.js";
|
|
5
|
+
import type { LocalServiceRuntime } from "./runtime.js";
|
|
6
|
+
export declare function listProjects(runtime: LocalServiceRuntime, projectDataDir: string): ProjectResource[];
|
|
7
|
+
export declare function getProject(runtime: LocalServiceRuntime, projectDataDir: string, projectName: string): ProjectResource | null;
|
|
8
|
+
export declare function listProjectReadiness(runtime: LocalServiceRuntime, projectDataDir: string): Readiness[];
|
|
9
|
+
export declare function getProjectReadiness(runtime: LocalServiceRuntime, projectDataDir: string, projectName: string): Readiness | null;
|
|
10
|
+
export declare function listReadiness(runtime: LocalServiceRuntime, projectDataDir: string): Readiness[];
|
|
11
|
+
export declare function getReadiness(runtime: LocalServiceRuntime, projectDataDir: string, projectName: string): Readiness | null;
|
|
12
|
+
export declare function computeProjectReadiness(runtime: LocalServiceRuntime, projectDataDir: string, project: ProjectConfig): Readiness;
|
|
13
|
+
export declare function listSourceFiles(runtime: LocalServiceRuntime, projectDataDir: string, projectName?: string | null): SourceFileResource[];
|
|
14
|
+
export declare function listContextGraphs(runtime: LocalServiceRuntime, projectDataDir: string, projectName?: string | null): ContextGraphResource[];
|
|
15
|
+
export declare function getContextGraph(runtime: LocalServiceRuntime, projectDataDir: string, graphId: string): ContextGraphResource | null;
|
|
16
|
+
export declare function getLatestContextGraph(runtime: LocalServiceRuntime, projectDataDir: string, projectName: string): ContextGraphResource | null;
|
|
17
|
+
export declare function listLatestContextGraphStageSessions(runtime: LocalServiceRuntime, projectDataDir: string, projectName: string): StageExecutionSession[];
|
|
18
|
+
export declare function getContextGraphHandoff(runtime: LocalServiceRuntime, projectDataDir: string, projectName: string): ContextGraphHandoff | null;
|
|
@@ -0,0 +1,574 @@
|
|
|
1
|
+
import { existsSync, statSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { asProjectDataDir, projectConfigPath, projectRunContextGraphPath, } from "../contracts/lib/project-paths.js";
|
|
4
|
+
import { layerForPath } from "../contracts/lib/context-graph-layer.js";
|
|
5
|
+
import { buildPlanIdForProjectConfig, buildTestSpecFromSourceFolderConfig, fingerprintSavedBenchmarkSpec, findProjectConfig, listProjectConfigs, loadSourceFolderConfig, resolveProjectSourceBindingPath, } from "../projects/source-config.js";
|
|
6
|
+
import { isInterfRelativePath, ReadinessSchema, } from "../contracts/lib/schema.js";
|
|
7
|
+
import { ContextGraphHandoffSchema, } from "../contracts/lib/project-schema.js";
|
|
8
|
+
import { readInterfConfig, } from "../projects/interf.js";
|
|
9
|
+
import { loadContextGraphSourceManifest, } from "./build/source-manifest.js";
|
|
10
|
+
import { loadGraphManifest, } from "./build/stage-manifest.js";
|
|
11
|
+
import { contextGraphRuntimeGraphManifestPath, } from "./build/context-graph-paths.js";
|
|
12
|
+
import { listStageExecutionSessions, } from "./build/stage-session.js";
|
|
13
|
+
import { buildProjectResource, readinessSummaryForStatus, readinessTargetResult, } from "./runtime-resource-builders.js";
|
|
14
|
+
import { aggregateArtifactVerdict, } from "./build/artifact-status.js";
|
|
15
|
+
import { buildBuildEvidence, } from "./build/build-evidence.js";
|
|
16
|
+
import { buildContextGraphSemanticGraph, } from "./context-graph-semantic-graph.js";
|
|
17
|
+
import { validateContextGraph } from "./build/validate.js";
|
|
18
|
+
import { SourceFileResourceSchema, ContextGraphResourceSchema, StageExecutionSessionSchema, } from "./schemas/index.js";
|
|
19
|
+
import { uniqueArtifacts } from "./run-observability.js";
|
|
20
|
+
import { listBuildRunsForProject, } from "./runtime-build-runs.js";
|
|
21
|
+
import { readExecutionStageLedgerHistory } from "./runtime-persistence.js";
|
|
22
|
+
import { getBuildPlan } from "../build-plans/package/build-plan-definitions.js";
|
|
23
|
+
import { listContextInterfaceArtifacts } from "../build-plans/package/context-interface.js";
|
|
24
|
+
import { latestTopLevelVerifyRun, listVerifyRunsForProject, readLatestBenchmarkRun, } from "./runtime-verify-runs.js";
|
|
25
|
+
export function listProjects(runtime, projectDataDir) {
|
|
26
|
+
const config = loadSourceFolderConfig(projectDataDir);
|
|
27
|
+
// Per-project config file mtime is a migration-free "last touched" signal —
|
|
28
|
+
// each Project owns its `~/.interf/projects/<id>/interf.json`. Clients sort
|
|
29
|
+
// the Projects list newest-first by this so a just-created Project lands on
|
|
30
|
+
// top instead of buried alphabetically.
|
|
31
|
+
const configPath = projectConfigPath(asProjectDataDir(projectDataDir));
|
|
32
|
+
let updatedAt = null;
|
|
33
|
+
try {
|
|
34
|
+
updatedAt = statSync(configPath).mtime.toISOString();
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
updatedAt = null;
|
|
38
|
+
}
|
|
39
|
+
return listProjectConfigs(config).map((project) => {
|
|
40
|
+
const buildRuns = listBuildRunsForProject(runtime, projectDataDir, project.name);
|
|
41
|
+
const verifyRuns = listVerifyRunsForProject(runtime, projectDataDir, project.name);
|
|
42
|
+
const latestVerifyRun = latestTopLevelVerifyRun(verifyRuns);
|
|
43
|
+
const contextGraphRun = latestContextGraphBuildRun(project, buildRuns);
|
|
44
|
+
const readiness = computeProjectReadiness(runtime, projectDataDir, project);
|
|
45
|
+
return buildProjectResource(project, readiness, {
|
|
46
|
+
latestBuildRunId: buildRuns[0]?.run_id ?? null,
|
|
47
|
+
latestContextGraphBuildRunId: contextGraphRun?.run_id ?? null,
|
|
48
|
+
latestTestRunId: latestVerifyRun?.run_id ?? null,
|
|
49
|
+
}, resolveProjectSourceBindingPath(projectDataDir, project, config), configPath,
|
|
50
|
+
// Surface per-Artifact status from the latest Build run so the UI can
|
|
51
|
+
// render Artifact rows on the Project page without a separate fetch.
|
|
52
|
+
contextGraphRun?.artifacts ?? [], updatedAt);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
export function getProject(runtime, projectDataDir, projectName) {
|
|
56
|
+
return listProjects(runtime, projectDataDir).find((project) => project.name === projectName) ?? null;
|
|
57
|
+
}
|
|
58
|
+
export function listProjectReadiness(runtime, projectDataDir) {
|
|
59
|
+
return listReadiness(runtime, projectDataDir);
|
|
60
|
+
}
|
|
61
|
+
export function getProjectReadiness(runtime, projectDataDir, projectName) {
|
|
62
|
+
return getReadiness(runtime, projectDataDir, projectName);
|
|
63
|
+
}
|
|
64
|
+
export function listReadiness(runtime, projectDataDir) {
|
|
65
|
+
const config = loadSourceFolderConfig(projectDataDir);
|
|
66
|
+
return listProjectConfigs(config).map((project) => computeProjectReadiness(runtime, projectDataDir, project));
|
|
67
|
+
}
|
|
68
|
+
export function getReadiness(runtime, projectDataDir, projectName) {
|
|
69
|
+
const project = findProjectConfig(loadSourceFolderConfig(projectDataDir), projectName);
|
|
70
|
+
return project ? computeProjectReadiness(runtime, projectDataDir, project) : null;
|
|
71
|
+
}
|
|
72
|
+
export function computeProjectReadiness(runtime, projectDataDir, project) {
|
|
73
|
+
return runtime.readinessCache.get(projectDataDir, project.name, () => computeProjectReadinessUncached(runtime, projectDataDir, project));
|
|
74
|
+
}
|
|
75
|
+
function latestContextGraphBuildRun(project, buildRuns) {
|
|
76
|
+
const selected = project.latest_context_graph_run_id
|
|
77
|
+
? buildRuns.find((run) => run.run_id === project.latest_context_graph_run_id && run.status === "succeeded") ?? null
|
|
78
|
+
: null;
|
|
79
|
+
return selected ?? buildRuns.find((run) => run.status === "succeeded") ?? null;
|
|
80
|
+
}
|
|
81
|
+
function contextGraphPathForBuildRun(projectDataDir, buildRun) {
|
|
82
|
+
if (!buildRun)
|
|
83
|
+
return null;
|
|
84
|
+
if (existsSync(buildRun.context_graph_path))
|
|
85
|
+
return buildRun.context_graph_path;
|
|
86
|
+
const projectOwnedPath = projectRunContextGraphPath(asProjectDataDir(projectDataDir), buildRun.run_id);
|
|
87
|
+
if (existsSync(projectOwnedPath))
|
|
88
|
+
return projectOwnedPath;
|
|
89
|
+
return buildRun.context_graph_path;
|
|
90
|
+
}
|
|
91
|
+
function computeProjectReadinessUncached(runtime, projectDataDir, project) {
|
|
92
|
+
const generatedAt = new Date().toISOString();
|
|
93
|
+
const buildRuns = listBuildRunsForProject(runtime, projectDataDir, project.name);
|
|
94
|
+
const buildRun = buildRuns[0] ?? null;
|
|
95
|
+
const contextGraphRun = latestContextGraphBuildRun(project, buildRuns);
|
|
96
|
+
const contextGraphPath = contextGraphPathForBuildRun(projectDataDir, contextGraphRun);
|
|
97
|
+
const contextExists = Boolean(contextGraphPath && existsSync(contextGraphPath));
|
|
98
|
+
const contextGraphValidation = contextGraphPath && contextExists
|
|
99
|
+
? validateContextGraph(contextGraphPath)
|
|
100
|
+
: null;
|
|
101
|
+
const graphManifest = contextGraphPath && contextExists ? loadGraphManifest(contextGraphPath) : null;
|
|
102
|
+
const contextReady = Boolean(contextGraphRun && contextGraphValidation?.ok);
|
|
103
|
+
const verifyRun = latestTopLevelVerifyRun(listVerifyRunsForProject(runtime, projectDataDir, project.name));
|
|
104
|
+
const benchmarkRun = readLatestBenchmarkRun(projectDataDir, project.name);
|
|
105
|
+
const artifactStatuses = contextGraphRun?.artifacts ?? [];
|
|
106
|
+
const hasArtifactContract = artifactStatuses.length > 0;
|
|
107
|
+
const artifactVerdict = aggregateArtifactVerdict(artifactStatuses);
|
|
108
|
+
const artifactFailures = artifactStatuses.filter((artifact) => artifact.status !== "ready");
|
|
109
|
+
const artifactCheckResults = artifactStatuses.flatMap((artifact) => artifact.check_results ?? []);
|
|
110
|
+
const requiredArtifactCheckResults = artifactCheckResults.filter((result) => result.required !== false);
|
|
111
|
+
const passedArtifactCheckResults = requiredArtifactCheckResults.filter((result) => result.passed);
|
|
112
|
+
const requiredContextChecks = (contextGraphRun?.context_checks ?? []).filter((check) => check.required !== false);
|
|
113
|
+
const failedContextChecks = requiredContextChecks.filter((check) => check.status !== "passed");
|
|
114
|
+
const contextChecksPassed = requiredContextChecks.length === 0 || failedContextChecks.length === 0;
|
|
115
|
+
const savedBenchmarkSpec = buildTestSpecFromSourceFolderConfig({
|
|
116
|
+
projectDataDir,
|
|
117
|
+
targetName: project.name,
|
|
118
|
+
targetType: "context-graph",
|
|
119
|
+
});
|
|
120
|
+
const configuredChecks = savedBenchmarkSpec?.cases.length ?? 0;
|
|
121
|
+
const currentFingerprint = savedBenchmarkSpec
|
|
122
|
+
? fingerprintSavedBenchmarkSpec({
|
|
123
|
+
projectDataDir,
|
|
124
|
+
projectName: project.name,
|
|
125
|
+
targetType: "context-graph",
|
|
126
|
+
})
|
|
127
|
+
: null;
|
|
128
|
+
const benchmarkRunFingerprint = benchmarkRun?.checks_fingerprint ?? null;
|
|
129
|
+
const sourceResult = readinessTargetResult(benchmarkRun?.source_files, currentFingerprint, benchmarkRunFingerprint);
|
|
130
|
+
const contextResult = readinessTargetResult(benchmarkRun?.context_graph, currentFingerprint, benchmarkRunFingerprint);
|
|
131
|
+
const checksStale = Boolean(currentFingerprint && benchmarkRunFingerprint && currentFingerprint !== benchmarkRunFingerprint);
|
|
132
|
+
const buildCheck = (() => {
|
|
133
|
+
if (!buildRun) {
|
|
134
|
+
return {
|
|
135
|
+
gate: "build-run",
|
|
136
|
+
ok: false,
|
|
137
|
+
status: "not-built",
|
|
138
|
+
summary: "Context Graph has not been built yet.",
|
|
139
|
+
artifact_path: contextReady ? contextGraphPath : null,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
if (buildRun.status === "succeeded") {
|
|
143
|
+
return {
|
|
144
|
+
gate: "build-run",
|
|
145
|
+
ok: contextReady,
|
|
146
|
+
status: contextReady ? "built" : "failed",
|
|
147
|
+
summary: contextReady
|
|
148
|
+
? "Latest Build produced the Context Graph."
|
|
149
|
+
: "Latest Build finished but did not produce a Context Graph.",
|
|
150
|
+
run_id: buildRun.run_id,
|
|
151
|
+
artifact_path: contextReady ? contextGraphPath : null,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
if (buildRun.status === "queued" || buildRun.status === "running") {
|
|
155
|
+
return {
|
|
156
|
+
gate: "build-run",
|
|
157
|
+
ok: false,
|
|
158
|
+
status: "building",
|
|
159
|
+
summary: "Build is in progress.",
|
|
160
|
+
run_id: buildRun.run_id,
|
|
161
|
+
artifact_path: contextExists ? contextGraphPath : null,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
gate: "build-run",
|
|
166
|
+
ok: false,
|
|
167
|
+
status: "failed",
|
|
168
|
+
summary: buildRun.status === "cancelled"
|
|
169
|
+
? "Latest Build was cancelled."
|
|
170
|
+
: "Latest Build failed.",
|
|
171
|
+
run_id: buildRun.run_id,
|
|
172
|
+
artifact_path: contextReady ? contextGraphPath : null,
|
|
173
|
+
};
|
|
174
|
+
})();
|
|
175
|
+
if (graphManifest && buildRun?.status === "succeeded" && contextReady) {
|
|
176
|
+
const status = graphManifest.readiness.ready ? "ready" : "not-ready";
|
|
177
|
+
return ReadinessSchema.parse({
|
|
178
|
+
kind: "interf-readiness-state",
|
|
179
|
+
version: 1,
|
|
180
|
+
generated_at: generatedAt,
|
|
181
|
+
project: project.name,
|
|
182
|
+
status,
|
|
183
|
+
ready: graphManifest.readiness.ready,
|
|
184
|
+
summary: graphManifest.readiness.summary,
|
|
185
|
+
context_graph_path: contextGraphPath,
|
|
186
|
+
latest_build_run_id: buildRun.run_id,
|
|
187
|
+
latest_benchmark_run_id: verifyRun?.run_id ?? null,
|
|
188
|
+
build: buildCheck,
|
|
189
|
+
check_results: {
|
|
190
|
+
configured: configuredChecks,
|
|
191
|
+
fingerprint: currentFingerprint,
|
|
192
|
+
source_files: sourceResult,
|
|
193
|
+
context_graph: contextResult,
|
|
194
|
+
},
|
|
195
|
+
checks: [
|
|
196
|
+
{
|
|
197
|
+
gate: "context-graph",
|
|
198
|
+
ok: graphManifest.readiness.ready,
|
|
199
|
+
status,
|
|
200
|
+
summary: graphManifest.readiness.summary,
|
|
201
|
+
artifact_path: contextGraphPath,
|
|
202
|
+
},
|
|
203
|
+
buildCheck,
|
|
204
|
+
],
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
// COMPAT fallback — reached only when no GraphManifest exists yet
|
|
208
|
+
// (pre-refactor build or build still running). The primary readiness path
|
|
209
|
+
// is the early return above that reads graphManifest.readiness directly.
|
|
210
|
+
// Keep these legacy gates so old UIs that consume readiness.checks don't
|
|
211
|
+
// crash; do not add new gates here. Removal path: once every active Build
|
|
212
|
+
// produces a GraphManifest, the early return covers all cases and this
|
|
213
|
+
// fallback can be replaced with a single "not yet built" check.
|
|
214
|
+
const checks = [
|
|
215
|
+
{
|
|
216
|
+
gate: "context-graph",
|
|
217
|
+
ok: contextReady,
|
|
218
|
+
status: contextReady ? "built" : "not-built",
|
|
219
|
+
summary: contextReady
|
|
220
|
+
? "Context Graph is built."
|
|
221
|
+
: "Context Graph has not been built yet.",
|
|
222
|
+
artifact_path: contextReady ? contextGraphPath : null,
|
|
223
|
+
},
|
|
224
|
+
buildCheck,
|
|
225
|
+
{
|
|
226
|
+
gate: "artifact-diagnostics",
|
|
227
|
+
ok: !hasArtifactContract || artifactVerdict === "ready",
|
|
228
|
+
status: !hasArtifactContract
|
|
229
|
+
? "not-configured"
|
|
230
|
+
: artifactVerdict === "ready" ? "ready" : "not-ready",
|
|
231
|
+
summary: !hasArtifactContract
|
|
232
|
+
? "No outputs declared by the selected Build Plan."
|
|
233
|
+
: artifactVerdict === "ready"
|
|
234
|
+
? `${artifactStatuses.length} Artifact${artifactStatuses.length === 1 ? "" : "s"} ready; ${passedArtifactCheckResults.length}/${requiredArtifactCheckResults.length} required diagnostic${requiredArtifactCheckResults.length === 1 ? "" : "s"} passed.`
|
|
235
|
+
: `${artifactFailures.length} Artifact${artifactFailures.length === 1 ? "" : "s"} not ready.`,
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
gate: "context-checks",
|
|
239
|
+
ok: contextChecksPassed,
|
|
240
|
+
status: requiredContextChecks.length === 0
|
|
241
|
+
? "not-configured"
|
|
242
|
+
: contextChecksPassed ? "ready" : "not-ready",
|
|
243
|
+
summary: requiredContextChecks.length === 0
|
|
244
|
+
? "No GraphManifest coverage rollup exists for this Build."
|
|
245
|
+
: contextChecksPassed
|
|
246
|
+
? `${requiredContextChecks.length} legacy readiness check${requiredContextChecks.length === 1 ? "" : "s"} passed.`
|
|
247
|
+
: `${failedContextChecks.length} legacy readiness check${failedContextChecks.length === 1 ? "" : "s"} not passed.`,
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
gate: "benchmarks",
|
|
251
|
+
ok: true,
|
|
252
|
+
status: configuredChecks > 0 ? "built" : "not-configured",
|
|
253
|
+
summary: configuredChecks > 0
|
|
254
|
+
? `${configuredChecks} benchmark check${configuredChecks === 1 ? "" : "s"} configured.`
|
|
255
|
+
: "No benchmark checks configured yet.",
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
gate: "benchmarks-current",
|
|
259
|
+
ok: !checksStale,
|
|
260
|
+
status: checksStale ? "stale" : "built",
|
|
261
|
+
summary: checksStale
|
|
262
|
+
? "Latest benchmark result is stale — your checks have changed since."
|
|
263
|
+
: "Latest benchmark result matches the saved checks.",
|
|
264
|
+
},
|
|
265
|
+
];
|
|
266
|
+
const status = (() => {
|
|
267
|
+
if (buildRun?.status === "queued" || buildRun?.status === "running")
|
|
268
|
+
return "building";
|
|
269
|
+
if (verifyRun?.status === "queued" || verifyRun?.status === "running")
|
|
270
|
+
return "checking";
|
|
271
|
+
if (buildRun?.status === "failed" || buildRun?.status === "cancelled")
|
|
272
|
+
return "failed";
|
|
273
|
+
if (!buildRun || !contextReady)
|
|
274
|
+
return "not-built";
|
|
275
|
+
if (hasArtifactContract && artifactVerdict !== "ready")
|
|
276
|
+
return "not-ready";
|
|
277
|
+
if (!contextChecksPassed)
|
|
278
|
+
return "not-ready";
|
|
279
|
+
if (checksStale)
|
|
280
|
+
return "stale";
|
|
281
|
+
if (configuredChecks === 0)
|
|
282
|
+
return hasArtifactContract ? "ready" : "built";
|
|
283
|
+
if (!contextResult)
|
|
284
|
+
return "built";
|
|
285
|
+
return contextResult.total > 0 && contextResult.passed === contextResult.total ? "ready" : "not-ready";
|
|
286
|
+
})();
|
|
287
|
+
const ready = status === "ready";
|
|
288
|
+
return ReadinessSchema.parse({
|
|
289
|
+
kind: "interf-readiness-state",
|
|
290
|
+
version: 1,
|
|
291
|
+
generated_at: generatedAt,
|
|
292
|
+
project: project.name,
|
|
293
|
+
status,
|
|
294
|
+
ready,
|
|
295
|
+
summary: readinessSummaryForStatus(status),
|
|
296
|
+
context_graph_path: contextReady ? contextGraphPath : null,
|
|
297
|
+
latest_build_run_id: buildRun?.run_id ?? null,
|
|
298
|
+
latest_benchmark_run_id: verifyRun?.run_id ?? null,
|
|
299
|
+
build: buildCheck,
|
|
300
|
+
check_results: {
|
|
301
|
+
configured: configuredChecks,
|
|
302
|
+
fingerprint: currentFingerprint,
|
|
303
|
+
source_files: sourceResult,
|
|
304
|
+
context_graph: contextResult,
|
|
305
|
+
},
|
|
306
|
+
checks,
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Real on-disk size + mtime for a source file, read live from the source
|
|
311
|
+
* folder. The build manifest only sometimes carries `size_bytes` (older
|
|
312
|
+
* builds omit it) and never carries an mtime, so reads that trusted the
|
|
313
|
+
* manifest showed "0 B / -" for files that are really tens of KB to MBs.
|
|
314
|
+
* Returns null when the file moved or the locator isn't a local path.
|
|
315
|
+
*/
|
|
316
|
+
function statSourceFile(sourceLocator, relativePath) {
|
|
317
|
+
try {
|
|
318
|
+
const absolute = join(sourceLocator, relativePath);
|
|
319
|
+
if (!existsSync(absolute))
|
|
320
|
+
return null;
|
|
321
|
+
const info = statSync(absolute);
|
|
322
|
+
return info.isFile() ? { size: info.size, mtime: info.mtime } : null;
|
|
323
|
+
}
|
|
324
|
+
catch {
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
export function listSourceFiles(runtime, projectDataDir, projectName) {
|
|
329
|
+
const config = loadSourceFolderConfig(projectDataDir);
|
|
330
|
+
const projects = listProjectConfigs(config)
|
|
331
|
+
.filter((project) => !projectName || project.name === projectName);
|
|
332
|
+
return projects.flatMap((project) => {
|
|
333
|
+
const buildRuns = listBuildRunsForProject(runtime, projectDataDir, project.name);
|
|
334
|
+
const latestRun = latestContextGraphBuildRun(project, buildRuns);
|
|
335
|
+
const contextGraphPath = contextGraphPathForBuildRun(projectDataDir, latestRun);
|
|
336
|
+
const manifest = contextGraphPath ? loadContextGraphSourceManifest(contextGraphPath) : null;
|
|
337
|
+
if (!manifest)
|
|
338
|
+
return [];
|
|
339
|
+
return manifest.files.map((file) => {
|
|
340
|
+
const stat = statSourceFile(manifest.source.locator, file.path);
|
|
341
|
+
return SourceFileResourceSchema.parse({
|
|
342
|
+
project: project.name,
|
|
343
|
+
source_manifest_id: manifest.manifest_id,
|
|
344
|
+
source_file_id: file.id,
|
|
345
|
+
path: file.path,
|
|
346
|
+
locator: file.locator,
|
|
347
|
+
kind: file.kind,
|
|
348
|
+
absolute_path: file.locator,
|
|
349
|
+
size_bytes: stat?.size ?? file.size_bytes ?? 0,
|
|
350
|
+
modified_at: stat ? stat.mtime.toISOString() : null,
|
|
351
|
+
source_folder_path: manifest.source.locator,
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
export function listContextGraphs(runtime, projectDataDir, projectName) {
|
|
357
|
+
return listProjectConfigs(loadSourceFolderConfig(projectDataDir))
|
|
358
|
+
.filter((project) => !projectName || project.name === projectName)
|
|
359
|
+
.flatMap((project) => listProjectContextGraphs(runtime, projectDataDir, project))
|
|
360
|
+
.filter((graph) => graph !== null);
|
|
361
|
+
}
|
|
362
|
+
export function getContextGraph(runtime, projectDataDir, graphId) {
|
|
363
|
+
return listContextGraphs(runtime, projectDataDir)
|
|
364
|
+
.find((graph) => graph.graph_id === graphId || graph.build_run_id === graphId) ?? null;
|
|
365
|
+
}
|
|
366
|
+
export function getLatestContextGraph(runtime, projectDataDir, projectName) {
|
|
367
|
+
const project = findProjectConfig(loadSourceFolderConfig(projectDataDir), projectName);
|
|
368
|
+
if (!project)
|
|
369
|
+
return null;
|
|
370
|
+
const buildRuns = listBuildRunsForProject(runtime, projectDataDir, project.name);
|
|
371
|
+
const contextGraphRun = latestContextGraphBuildRun(project, buildRuns);
|
|
372
|
+
const context = getProjectContextGraph(runtime, projectDataDir, project, contextGraphRun);
|
|
373
|
+
if (!context?.exists || !context.path)
|
|
374
|
+
return null;
|
|
375
|
+
const buildRunId = contextGraphRun?.run_id ?? null;
|
|
376
|
+
const rows = context.build_evidence?.rows ?? [];
|
|
377
|
+
const passing = rows.filter((row) => !row.issue_state || row.issue_state === "pass").length;
|
|
378
|
+
const primaryMetricCount = context.primary_metrics.length;
|
|
379
|
+
return ContextGraphResourceSchema.parse({
|
|
380
|
+
...context,
|
|
381
|
+
kind: "interf-context-graph",
|
|
382
|
+
version: 1,
|
|
383
|
+
graph_id: buildRunId ?? `${projectName}-latest`,
|
|
384
|
+
project_id: projectName,
|
|
385
|
+
build_run_id: buildRunId,
|
|
386
|
+
created_at: contextGraphRun?.finished_at ?? contextGraphRun?.started_at ?? contextGraphRun?.created_at ?? context.readiness.generated_at,
|
|
387
|
+
is_latest: true,
|
|
388
|
+
build_evidence: context.build_evidence
|
|
389
|
+
? {
|
|
390
|
+
...context.build_evidence,
|
|
391
|
+
summary: primaryMetricCount > 0
|
|
392
|
+
? `${context.build_evidence.summary} · ${primaryMetricCount} primary metric${primaryMetricCount === 1 ? "" : "s"}`
|
|
393
|
+
: `${context.build_evidence.summary} · ${passing}/${rows.length} diagnostic rows`,
|
|
394
|
+
}
|
|
395
|
+
: context.build_evidence,
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
export function listLatestContextGraphStageSessions(runtime, projectDataDir, projectName) {
|
|
399
|
+
const project = findProjectConfig(loadSourceFolderConfig(projectDataDir), projectName);
|
|
400
|
+
if (!project)
|
|
401
|
+
return [];
|
|
402
|
+
const latestRun = listBuildRunsForProject(runtime, projectDataDir, project.name)[0] ?? null;
|
|
403
|
+
const contextGraphPath = contextGraphPathForBuildRun(projectDataDir, latestRun);
|
|
404
|
+
if (!contextGraphPath || !existsSync(contextGraphPath))
|
|
405
|
+
return [];
|
|
406
|
+
return listStageExecutionSessions(contextGraphPath)
|
|
407
|
+
.map((session) => StageExecutionSessionSchema.parse(session));
|
|
408
|
+
}
|
|
409
|
+
export function getContextGraphHandoff(runtime, projectDataDir, projectName) {
|
|
410
|
+
const context = getLatestContextGraph(runtime, projectDataDir, projectName);
|
|
411
|
+
if (!context)
|
|
412
|
+
return null;
|
|
413
|
+
return ContextGraphHandoffSchema.parse({
|
|
414
|
+
kind: "interf-context-graph-handoff",
|
|
415
|
+
version: 1,
|
|
416
|
+
entrypoint: context.entrypoint_artifact ?? contextGraphEntrypointHandoff(context.path),
|
|
417
|
+
artifacts: context.artifact_handoffs,
|
|
418
|
+
...(context.portable_handoff ? { portable: context.portable_handoff } : {}),
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
function listProjectContextGraphs(runtime, projectDataDir, project) {
|
|
422
|
+
const buildRuns = listBuildRunsForProject(runtime, projectDataDir, project.name);
|
|
423
|
+
const latest = latestContextGraphBuildRun(project, buildRuns);
|
|
424
|
+
const graphs = buildRuns
|
|
425
|
+
.filter((run) => run.status === "succeeded")
|
|
426
|
+
.map((run) => getProjectContextGraph(runtime, projectDataDir, project, run, run.run_id === latest?.run_id))
|
|
427
|
+
.filter((graph) => graph !== null);
|
|
428
|
+
return graphs;
|
|
429
|
+
}
|
|
430
|
+
function getProjectContextGraph(runtime, projectDataDir, project, buildRun, isLatest = true) {
|
|
431
|
+
if (!buildRun)
|
|
432
|
+
return null;
|
|
433
|
+
const path = contextGraphPathForBuildRun(projectDataDir, buildRun);
|
|
434
|
+
if (!path)
|
|
435
|
+
return null;
|
|
436
|
+
// A succeeded Build's Context Graph is immutable: cache the fully-built
|
|
437
|
+
// resource keyed by run id + graph-manifest mtime. Non-succeeded runs (and
|
|
438
|
+
// graphs without a readable manifest) fall through to a fresh compute every
|
|
439
|
+
// time. `isLatest` flips the `is_latest` flag but is otherwise stable per
|
|
440
|
+
// run within a request, so fold it into the cache key suffix.
|
|
441
|
+
if (buildRun.status === "succeeded") {
|
|
442
|
+
return runtime.contextGraphResourceCache.get(projectDataDir, `${buildRun.run_id}:${isLatest ? "latest" : "historical"}`, contextGraphRuntimeGraphManifestPath(path), () => buildProjectContextGraphResource(runtime, projectDataDir, project, buildRun, path, isLatest));
|
|
443
|
+
}
|
|
444
|
+
return buildProjectContextGraphResource(runtime, projectDataDir, project, buildRun, path, isLatest);
|
|
445
|
+
}
|
|
446
|
+
function buildProjectContextGraphResource(runtime, projectDataDir, project, buildRun, path, isLatest) {
|
|
447
|
+
const config = readInterfConfig(path);
|
|
448
|
+
const sourceManifest = loadContextGraphSourceManifest(path);
|
|
449
|
+
const graphManifest = loadGraphManifest(path);
|
|
450
|
+
const verifyRuns = listVerifyRunsForProject(runtime, projectDataDir, project.name);
|
|
451
|
+
const latestVerifyRun = latestTopLevelVerifyRun(verifyRuns);
|
|
452
|
+
const readiness = computeProjectReadiness(runtime, projectDataDir, project);
|
|
453
|
+
const buildPlan = config?.build_plan ?? buildRun.build_plan ?? buildPlanIdForProjectConfig(project);
|
|
454
|
+
const sourceFileCount = listSourceFiles(runtime, projectDataDir, project.name).length;
|
|
455
|
+
let expectedStageCount;
|
|
456
|
+
let expectedOutputCount;
|
|
457
|
+
if (buildPlan) {
|
|
458
|
+
try {
|
|
459
|
+
const activeBuildPlan = getBuildPlan(buildPlan, { projectDataDir });
|
|
460
|
+
expectedStageCount = activeBuildPlan.stages.length;
|
|
461
|
+
const contextInterface = activeBuildPlan.contextInterface;
|
|
462
|
+
expectedOutputCount = contextInterface ? listContextInterfaceArtifacts(contextInterface).length : undefined;
|
|
463
|
+
}
|
|
464
|
+
catch {
|
|
465
|
+
expectedStageCount = undefined;
|
|
466
|
+
expectedOutputCount = undefined;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
const artifacts = uniqueArtifacts(buildRun.stages.flatMap((stage) => stage.artifacts));
|
|
470
|
+
const artifactHandoffs = contextGraphArtifactHandoffs(path, artifacts);
|
|
471
|
+
const createdAt = buildRun.finished_at ?? buildRun.started_at ?? buildRun.created_at ?? readiness.generated_at;
|
|
472
|
+
const semanticEntrypointPath = artifactHandoffs.find((handoff) => handoff.path?.endsWith(".md"))?.path
|
|
473
|
+
?? artifactHandoffs[0]?.path
|
|
474
|
+
?? null;
|
|
475
|
+
return ContextGraphResourceSchema.parse({
|
|
476
|
+
kind: "interf-context-graph",
|
|
477
|
+
version: 1,
|
|
478
|
+
graph_id: buildRun.run_id,
|
|
479
|
+
project_id: project.name,
|
|
480
|
+
intent: project.intent ?? "",
|
|
481
|
+
build_run_id: buildRun.run_id,
|
|
482
|
+
source_manifest_id: sourceManifest?.manifest_id ?? null,
|
|
483
|
+
created_at: createdAt,
|
|
484
|
+
is_latest: isLatest,
|
|
485
|
+
project: project.name,
|
|
486
|
+
path,
|
|
487
|
+
exists: existsSync(path),
|
|
488
|
+
readiness,
|
|
489
|
+
build_plan: buildPlan,
|
|
490
|
+
latest_build_run_id: buildRun.run_id,
|
|
491
|
+
latest_benchmark_run_id: latestVerifyRun?.run_id ?? null,
|
|
492
|
+
entrypoint_artifact: artifactHandoffs[0] ?? null,
|
|
493
|
+
artifact_handoffs: artifactHandoffs,
|
|
494
|
+
portable_handoff: {
|
|
495
|
+
locator: { kind: "local-path", value: path },
|
|
496
|
+
instructions: "Start from home.md, then follow links into knowledge/, summaries/, and source refs.",
|
|
497
|
+
},
|
|
498
|
+
artifacts,
|
|
499
|
+
semantic_graph: buildContextGraphSemanticGraph({
|
|
500
|
+
contextGraphPath: path,
|
|
501
|
+
projectId: project.name,
|
|
502
|
+
generatedAt: createdAt,
|
|
503
|
+
sourceManifest,
|
|
504
|
+
entrypointPath: semanticEntrypointPath,
|
|
505
|
+
}),
|
|
506
|
+
graph_manifest: graphManifest,
|
|
507
|
+
primary_metrics: graphManifest?.primary_metrics ?? [],
|
|
508
|
+
stage_summaries: graphManifest?.stages ?? [],
|
|
509
|
+
entrypoints: graphManifest?.entrypoints ?? [],
|
|
510
|
+
resources: graphManifest?.resources ?? [],
|
|
511
|
+
readiness_rollup: graphManifest?.readiness ?? null,
|
|
512
|
+
stage_sessions: listStageExecutionSessions(path),
|
|
513
|
+
build_evidence: buildBuildEvidence({
|
|
514
|
+
projectId: project.name,
|
|
515
|
+
buildRun,
|
|
516
|
+
readiness,
|
|
517
|
+
sourceFileCount,
|
|
518
|
+
expectedStageCount,
|
|
519
|
+
expectedOutputCount,
|
|
520
|
+
stageEvidence: latestStageEvidenceForContext(path),
|
|
521
|
+
primaryMetrics: graphManifest?.primary_metrics ?? [],
|
|
522
|
+
}),
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
function contextGraphArtifactHandoffs(contextGraphPath, artifacts) {
|
|
526
|
+
const entrypoint = contextGraphEntrypointHandoff(contextGraphPath);
|
|
527
|
+
const outputs = artifacts.filter((artifact) => artifact.role === "output" && isInterfRelativePath(artifact.path));
|
|
528
|
+
const artifactEntrypoints = outputs.filter((artifact) => layerForPath(artifact.path) === "artifacts");
|
|
529
|
+
const ordered = [
|
|
530
|
+
...artifactEntrypoints,
|
|
531
|
+
...outputs.filter((artifact) => !artifactEntrypoints.includes(artifact)),
|
|
532
|
+
];
|
|
533
|
+
const seen = new Set([entrypoint.path]);
|
|
534
|
+
const handoffs = ordered
|
|
535
|
+
.filter((artifact) => {
|
|
536
|
+
if (seen.has(artifact.path))
|
|
537
|
+
return false;
|
|
538
|
+
seen.add(artifact.path);
|
|
539
|
+
return true;
|
|
540
|
+
})
|
|
541
|
+
.map((artifact) => ({
|
|
542
|
+
label: artifact.label ?? artifact.path,
|
|
543
|
+
locator: { kind: "local-path", value: join(contextGraphPath, artifact.path) },
|
|
544
|
+
path: artifact.path,
|
|
545
|
+
role: "artifact",
|
|
546
|
+
...(artifact.stage_id ? { summary: `Produced by stage ${artifact.stage_id}.` } : {}),
|
|
547
|
+
}));
|
|
548
|
+
return [entrypoint, ...handoffs];
|
|
549
|
+
}
|
|
550
|
+
function contextGraphEntrypointHandoff(contextGraphPath) {
|
|
551
|
+
return {
|
|
552
|
+
artifact_id: "home",
|
|
553
|
+
label: "Context Graph home",
|
|
554
|
+
locator: { kind: "local-path", value: join(contextGraphPath, "home.md") },
|
|
555
|
+
path: "home.md",
|
|
556
|
+
artifact_kind: "file",
|
|
557
|
+
role: "entrypoint",
|
|
558
|
+
summary: "Primary downstream agent entrypoint. Start here before following links into knowledge/ and summaries/.",
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
function latestStageEvidenceForContext(contextGraphPath) {
|
|
562
|
+
const latestByStage = new Map();
|
|
563
|
+
for (const entry of readExecutionStageLedgerHistory(contextGraphPath)) {
|
|
564
|
+
if (!entry.evidence)
|
|
565
|
+
continue;
|
|
566
|
+
const existing = latestByStage.get(entry.stage);
|
|
567
|
+
if (!existing || entry.updated_at >= existing.updated_at) {
|
|
568
|
+
latestByStage.set(entry.stage, entry);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
return [...latestByStage.values()]
|
|
572
|
+
.map((entry) => entry.evidence)
|
|
573
|
+
.filter((entry) => entry !== undefined);
|
|
574
|
+
}
|