@interf/compiler 0.33.0 → 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 +122 -226
- package/dist/cli/commands/agents.js +1 -32
- package/dist/cli/commands/benchmark.d.ts +2 -3
- package/dist/cli/commands/benchmark.js +1 -31
- package/dist/cli/commands/build-plan.js +26 -50
- package/dist/cli/commands/build.d.ts +2 -3
- package/dist/cli/commands/build.js +1 -31
- package/dist/cli/commands/graphs.js +177 -32
- package/dist/cli/commands/mcp.d.ts +1 -0
- package/dist/cli/commands/mcp.js +223 -126
- package/dist/cli/commands/project.js +10 -36
- package/dist/cli/commands/reset.d.ts +2 -3
- package/dist/cli/commands/reset.js +1 -22
- package/dist/cli/commands/runs.js +86 -33
- package/dist/cli/commands/status.js +3 -24
- package/dist/cli/commands/traces.js +1 -29
- package/dist/cli/commands/wizard.js +17 -29
- package/dist/cli/lib/http-client.d.ts +39 -0
- package/dist/cli/lib/http-client.js +73 -0
- package/dist/packages/build-plans/authoring/brief.d.ts +25 -4
- package/dist/packages/build-plans/authoring/build-plan-authoring.d.ts +42 -1
- package/dist/packages/build-plans/authoring/build-plan-authoring.js +470 -63
- package/dist/packages/build-plans/authoring/build-plan-edit-session.d.ts +9 -0
- package/dist/packages/build-plans/authoring/build-plan-edit-session.js +27 -10
- package/dist/packages/build-plans/authoring/build-plan-improvement.js +62 -8
- package/dist/packages/build-plans/authoring/lib/build-plan-edit-utils.d.ts +1 -0
- package/dist/packages/build-plans/package/build-plan-definitions.d.ts +0 -1
- package/dist/packages/build-plans/package/build-plan-definitions.js +5 -3
- package/dist/packages/build-plans/package/build-plan-stage-runner.d.ts +1 -0
- package/dist/packages/build-plans/package/build-plan-stage-runner.js +2 -1
- package/dist/packages/build-plans/package/builtin-build-plan.d.ts +2 -2
- package/dist/packages/build-plans/package/builtin-build-plan.js +3 -3
- package/dist/packages/build-plans/package/context-interface.d.ts +3 -0
- package/dist/packages/build-plans/package/context-interface.js +5 -5
- package/dist/packages/build-plans/package/interf-build-plan-package.js +22 -22
- package/dist/packages/build-plans/package/local-build-plans.d.ts +10 -5
- package/dist/packages/build-plans/package/local-build-plans.js +57 -32
- package/dist/packages/contracts/index.d.ts +4 -3
- package/dist/packages/contracts/index.js +2 -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 +7 -0
- package/dist/packages/contracts/lib/project-paths.js +9 -0
- package/dist/packages/contracts/lib/project-schema.d.ts +264 -1
- package/dist/packages/contracts/lib/project-schema.js +38 -13
- package/dist/packages/contracts/lib/schema.d.ts +556 -23
- package/dist/packages/contracts/lib/schema.js +279 -18
- package/dist/packages/contracts/utils/filesystem.d.ts +1 -0
- package/dist/packages/contracts/utils/filesystem.js +29 -1
- package/dist/packages/projects/lib/schema.d.ts +6 -8
- package/dist/packages/projects/lib/schema.js +3 -1
- package/dist/packages/projects/source-config.d.ts +0 -5
- package/dist/packages/projects/source-config.js +9 -22
- package/dist/packages/runtime/actions/fields.d.ts +4 -0
- package/dist/packages/runtime/actions/form-builders.js +79 -31
- package/dist/packages/runtime/actions/form-validators.js +9 -3
- package/dist/packages/runtime/actions/helpers.js +3 -3
- package/dist/packages/runtime/actions/registry.d.ts +1 -1
- package/dist/packages/runtime/actions/registry.js +1 -1
- package/dist/packages/runtime/actions/requests.d.ts +1 -1
- package/dist/packages/runtime/actions/requests.js +12 -6
- package/dist/packages/runtime/actions/schemas.d.ts +7 -0
- package/dist/packages/runtime/actions/schemas.js +1 -0
- package/dist/packages/runtime/agent-handoff.js +8 -7
- package/dist/packages/runtime/agents/lib/execution-profile.d.ts +14 -0
- package/dist/packages/runtime/agents/lib/execution-profile.js +23 -0
- package/dist/packages/runtime/agents/lib/execution.js +14 -8
- package/dist/packages/runtime/agents/lib/executors.d.ts +1 -0
- package/dist/packages/runtime/agents/lib/executors.js +11 -2
- package/dist/packages/runtime/agents/lib/logs.d.ts +10 -0
- package/dist/packages/runtime/agents/lib/logs.js +32 -8
- package/dist/packages/runtime/agents/lib/preflight.js +4 -1
- package/dist/packages/runtime/agents/lib/render.d.ts +18 -0
- package/dist/packages/runtime/agents/lib/render.js +44 -18
- package/dist/packages/runtime/agents/lib/shell-templates.js +105 -63
- package/dist/packages/runtime/agents/lib/shells.d.ts +29 -0
- package/dist/packages/runtime/agents/lib/shells.js +158 -32
- 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/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/runtime/agents/lib/types.d.ts +1 -0
- package/dist/packages/runtime/agents/providers/codex.js +2 -0
- package/dist/packages/runtime/agents/role-executors.js +2 -1
- package/dist/packages/runtime/auth/session-store.js +11 -3
- package/dist/packages/runtime/benchmark-question-draft.d.ts +3 -0
- package/dist/packages/runtime/benchmark-question-draft.js +57 -28
- package/dist/packages/runtime/build/artifact-status.d.ts +1 -1
- package/dist/packages/runtime/build/artifact-status.js +1 -1
- package/dist/packages/runtime/build/build-evidence.d.ts +2 -1
- package/dist/packages/runtime/build/build-evidence.js +11 -5
- package/dist/packages/runtime/build/build-pipeline.js +89 -5
- package/dist/packages/runtime/build/build-stage-plan.js +3 -1
- package/dist/packages/runtime/build/build-stage-runner.js +169 -32
- package/dist/packages/runtime/build/build-target.d.ts +3 -0
- package/dist/packages/runtime/build/build-target.js +25 -1
- package/dist/packages/runtime/build/check-evaluator.d.ts +1 -1
- package/dist/packages/runtime/build/check-evaluator.js +655 -4
- package/dist/packages/runtime/build/context-graph-paths.d.ts +13 -0
- package/dist/packages/runtime/build/context-graph-paths.js +27 -0
- package/dist/packages/runtime/build/index.d.ts +2 -2
- package/dist/packages/runtime/build/index.js +2 -2
- package/dist/packages/runtime/build/inspect-map.d.ts +10 -0
- package/dist/packages/runtime/build/inspect-map.js +270 -0
- package/dist/packages/runtime/build/lib/schema.d.ts +246 -53
- package/dist/packages/runtime/build/lib/schema.js +173 -15
- 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/runtime-contracts.js +9 -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/runtime/build/runtime-prompt.js +6 -4
- package/dist/packages/runtime/build/runtime-runs.js +63 -10
- package/dist/packages/runtime/build/runtime-types.d.ts +4 -1
- package/dist/packages/runtime/build/runtime.d.ts +3 -1
- package/dist/packages/runtime/build/runtime.js +3 -1
- package/dist/packages/runtime/build/source-files.js +11 -2
- package/dist/packages/runtime/build/source-inventory.d.ts +1 -0
- package/dist/packages/runtime/build/source-inventory.js +246 -7
- package/dist/packages/runtime/build/source-manifest.d.ts +11 -0
- package/dist/packages/runtime/build/source-manifest.js +30 -2
- package/dist/packages/runtime/build/stage-evidence.js +80 -11
- 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.js +12 -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-io.js +10 -11
- package/dist/packages/runtime/build/state-view.js +1 -1
- package/dist/packages/runtime/build/state.d.ts +1 -1
- package/dist/packages/runtime/build/state.js +1 -1
- 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.js +3 -3
- package/dist/packages/runtime/build/validate-context-graph.d.ts +1 -1
- package/dist/packages/runtime/build/validate-context-graph.js +5 -5
- package/dist/packages/runtime/build/validate.d.ts +1 -1
- package/dist/packages/runtime/build/validate.js +1 -1
- package/dist/packages/runtime/client.d.ts +3 -3
- package/dist/packages/runtime/client.js +8 -13
- package/dist/packages/runtime/context-checks.js +13 -0
- package/dist/packages/runtime/context-graph-scaffold.js +2 -1
- 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/execution/lib/schema.d.ts +34 -31
- package/dist/packages/runtime/index.d.ts +2 -2
- package/dist/packages/runtime/index.js +1 -1
- package/dist/packages/runtime/native-run-handlers.d.ts +38 -0
- package/dist/packages/runtime/native-run-handlers.js +52 -33
- package/dist/packages/runtime/plan-artifact-contract.js +1 -1
- package/dist/packages/runtime/project-source-state.d.ts +4 -4
- package/dist/packages/runtime/project-source-state.js +5 -2
- package/dist/packages/runtime/project-store.d.ts +5 -0
- package/dist/packages/runtime/project-store.js +30 -3
- package/dist/packages/runtime/requested-artifacts.js +1 -1
- package/dist/packages/runtime/run-observability.js +9 -4
- package/dist/packages/runtime/runtime-action-proposals.js +3 -3
- package/dist/packages/runtime/runtime-build-plans.js +47 -3
- package/dist/packages/runtime/runtime-build-runs.js +9 -16
- package/dist/packages/runtime/runtime-caches.d.ts +26 -0
- package/dist/packages/runtime/runtime-caches.js +47 -0
- package/dist/packages/runtime/runtime-jobs.js +6 -6
- package/dist/packages/runtime/runtime-project-mutations.js +1 -0
- package/dist/packages/runtime/runtime-project-reads.d.ts +4 -1
- package/dist/packages/runtime/runtime-project-reads.js +229 -36
- package/dist/packages/runtime/runtime-proposal-helpers.js +6 -6
- package/dist/packages/runtime/runtime-resource-builders.d.ts +4 -2
- package/dist/packages/runtime/runtime-resource-builders.js +16 -14
- 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.js +6 -5
- package/dist/packages/runtime/runtime.d.ts +439 -22
- package/dist/packages/runtime/runtime.js +16 -2
- package/dist/packages/runtime/schemas/actions.d.ts +24 -0
- package/dist/packages/runtime/schemas/agents.d.ts +28 -0
- package/dist/packages/runtime/schemas/agents.js +33 -0
- package/dist/packages/runtime/schemas/build-plans.d.ts +181 -8
- package/dist/packages/runtime/schemas/build-plans.js +36 -2
- 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 +7 -347
- package/dist/packages/runtime/schemas/files.js +1 -24
- package/dist/packages/runtime/schemas/index.d.ts +1 -0
- package/dist/packages/runtime/schemas/index.js +1 -0
- package/dist/packages/runtime/schemas/jobs.js +4 -0
- package/dist/packages/runtime/schemas/projects.d.ts +48 -21
- package/dist/packages/runtime/schemas/projects.js +34 -10
- package/dist/packages/runtime/schemas/runs.d.ts +1009 -240
- package/dist/packages/runtime/schemas/runs.js +17 -0
- package/dist/packages/runtime/service/openapi.js +1 -0
- package/dist/packages/runtime/service/operations.d.ts +1666 -145
- package/dist/packages/runtime/service/operations.js +147 -17
- package/dist/packages/runtime/service/routes.d.ts +11 -3
- package/dist/packages/runtime/service/routes.js +11 -3
- package/dist/packages/runtime/service/server-app-boot.js +2 -2
- package/dist/packages/runtime/service/server-helpers.d.ts +11 -0
- package/dist/packages/runtime/service/server-helpers.js +19 -0
- package/dist/packages/runtime/service/server-routes-action-proposals.js +4 -2
- package/dist/packages/runtime/service/server-routes-agents.js +19 -85
- package/dist/packages/runtime/service/server-routes-build-plans.js +14 -11
- package/dist/packages/runtime/service/server-routes-project-context.js +102 -7
- package/dist/packages/runtime/service/server-routes-project-jobs.js +19 -12
- package/dist/packages/runtime/service/server-routes-project-runs.js +5 -2
- package/dist/packages/runtime/service/server-routes-projects.js +6 -2
- package/dist/packages/runtime/service/server-routes-runs.js +11 -4
- package/dist/packages/runtime/verify/lib/schema.js +12 -0
- 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/runtime/verify/verify-execution.d.ts +7 -0
- package/dist/packages/runtime/verify/verify-execution.js +109 -35
- package/dist/packages/runtime/verify/verify-paths.d.ts +1 -0
- package/dist/packages/runtime/verify/verify-paths.js +4 -0
- package/dist/packages/runtime/verify/verify-specs.js +49 -39
- package/dist/packages/runtime/wire-schemas.d.ts +1 -1
- package/dist/packages/runtime/wire-schemas.js +1 -1
- package/package.json +2 -8
- package/public-repo/CONTRIBUTING.md +10 -3
- package/public-repo/README.md +122 -226
- package/public-repo/build-plans/interf-default/README.md +15 -12
- 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 +38 -5
- package/public-repo/build-plans/interf-default/build-plan.json +27 -23
- package/public-repo/build-plans/interf-default/build-plan.schema.json +24 -20
- package/public-repo/build-plans/interf-default/use/query/SKILL.md +8 -7
- package/public-repo/openapi/local-service.openapi.json +11637 -4213
- package/public-repo/skills/interf/SKILL.md +174 -134
- package/dist/packages/runtime/build/runtime-paths.d.ts +0 -8
- package/dist/packages/runtime/build/runtime-paths.js +0 -26
- package/dist/packages/runtime/build/state-paths.d.ts +0 -7
- package/dist/packages/runtime/build/state-paths.js +0 -22
- package/public-repo/build-plans/interf-default/build/stages/shape/SKILL.md +0 -34
- package/public-repo/build-plans/interf-default/build/stages/structure/SKILL.md +0 -28
|
@@ -2,6 +2,7 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { SourceFilesSchema, SourceManifestSchema, SourceStateSchema, StageInputsSchema, } from "../../contracts/lib/schema.js";
|
|
4
4
|
import { readJsonFileWithSchema } from "../../contracts/utils/parse.js";
|
|
5
|
+
import { isFilesystemArtifact } from "../../contracts/utils/filesystem.js";
|
|
5
6
|
import { contextGraphRuntimeSourceManifestPath, contextGraphRuntimeSourceFilesPath, contextGraphRuntimeSourceStatePath, contextGraphRuntimeStageInputsPath, } from "./context-graph-paths.js";
|
|
6
7
|
import { writeJsonAtomic } from "./atomic-fs.js";
|
|
7
8
|
function shortHash(value, length = 16) {
|
|
@@ -47,6 +48,26 @@ export function buildShellSourceState(sourceState, stageInputs) {
|
|
|
47
48
|
})),
|
|
48
49
|
});
|
|
49
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Drop OS-generated filesystem junk (`.DS_Store`, AppleDouble forks, `Thumbs.db`,
|
|
53
|
+
* etc.) from the Source Manifest before it is materialized into runtime coverage
|
|
54
|
+
* inputs. These are not Source content, so they must never become required
|
|
55
|
+
* `expected` inputs — otherwise a Source folder shows "not ready" purely because
|
|
56
|
+
* Finder/Explorer left a sidecar behind. Matched by filename only (provable),
|
|
57
|
+
* never by an agent's `not-relevant` label, so a genuinely skipped content file
|
|
58
|
+
* still counts toward readiness. `source_total` is recomputed to stay equal to
|
|
59
|
+
* the filtered file count.
|
|
60
|
+
*/
|
|
61
|
+
export function dropFilesystemArtifacts(manifest) {
|
|
62
|
+
const files = manifest.files.filter((file) => !isFilesystemArtifact(file.path));
|
|
63
|
+
if (files.length === manifest.files.length)
|
|
64
|
+
return manifest;
|
|
65
|
+
return SourceManifestSchema.parse({
|
|
66
|
+
...manifest,
|
|
67
|
+
source_total: files.length,
|
|
68
|
+
files,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
50
71
|
export function sourceManifestToSourceFiles(manifest) {
|
|
51
72
|
return SourceFilesSchema.parse({
|
|
52
73
|
kind: "interf-source-files",
|
|
@@ -129,10 +150,10 @@ export function writeBuildStageInputs(options) {
|
|
|
129
150
|
return stageInputs;
|
|
130
151
|
}
|
|
131
152
|
export function writeBuildSourceRuntimeFromManifest(options) {
|
|
132
|
-
const sourceManifest = SourceManifestSchema.parse({
|
|
153
|
+
const sourceManifest = dropFilesystemArtifacts(SourceManifestSchema.parse({
|
|
133
154
|
...options.sourceManifest,
|
|
134
155
|
run_id: options.runId ?? options.sourceManifest.run_id,
|
|
135
|
-
});
|
|
156
|
+
}));
|
|
136
157
|
writeJson(contextGraphRuntimeSourceManifestPath(options.contextGraphPath), sourceManifest);
|
|
137
158
|
const sourceFiles = sourceManifestToSourceFiles(sourceManifest);
|
|
138
159
|
writeJson(contextGraphRuntimeSourceFilesPath(options.contextGraphPath), sourceFiles);
|
|
@@ -166,6 +187,13 @@ export function loadContextGraphSourceManifest(contextGraphPath) {
|
|
|
166
187
|
return null;
|
|
167
188
|
return readJsonFileWithSchema(filePath, "context-graph source manifest", SourceManifestSchema);
|
|
168
189
|
}
|
|
190
|
+
// COMPAT — source-files.json / source-state.json file fallbacks are read by
|
|
191
|
+
// loaders only when no Source Manifest exists (pre-refactor builds). Every
|
|
192
|
+
// current Build writes the Source Manifest first via
|
|
193
|
+
// writeBuildSourceRuntimeFromManifest; the manifest is the authority. Removal
|
|
194
|
+
// path: once no live Context Graph predates Source Manifest, drop the file
|
|
195
|
+
// fallbacks and have these loaders return null whenever the manifest is
|
|
196
|
+
// missing.
|
|
169
197
|
export function loadContextGraphSourceFiles(contextGraphPath) {
|
|
170
198
|
const manifest = loadContextGraphSourceManifest(contextGraphPath);
|
|
171
199
|
if (manifest)
|
|
@@ -2,20 +2,25 @@ import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync, } fro
|
|
|
2
2
|
import { dirname, join, relative } from "node:path";
|
|
3
3
|
import { StageEvidenceSchema, } from "../../contracts/lib/schema.js";
|
|
4
4
|
import { buildPlanPackagePathForContextGraph, contextGraphRuntimeLogsRoot, } from "./context-graph-paths.js";
|
|
5
|
+
import { relativePathEqualsOrWithin } from "../agents/lib/shell-paths.js";
|
|
5
6
|
import { findBuildPlanContextArtifact, readBuildPlanContextFile, } from "./context-graph-schema.js";
|
|
6
7
|
import { StageEvidenceReconciliationSchema, } from "./lib/schema.js";
|
|
7
8
|
import { loadBuildStageInputs } from "./source-manifest.js";
|
|
8
9
|
import { loadExecutionStageLedger, updateExecutionStageLedger, } from "./runtime-runs.js";
|
|
9
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Relativize a stage evidence/output-ref path so it is always graph-relative.
|
|
12
|
+
*
|
|
13
|
+
* This is intentionally MORE permissive than the canonical `normalizeLayerPath`
|
|
14
|
+
* (`contracts/lib/context-graph-layer.ts`): its leading regex is `/^\.?\//`, so
|
|
15
|
+
* it strips a bare leading `/` as well as a leading `./`. An agent-reported
|
|
16
|
+
* output ref may arrive as `/outputs/...` or `/runtime/...`; this strips the
|
|
17
|
+
* absolute-looking prefix so the downstream `runtime/`/`outputs/` membership
|
|
18
|
+
* tests compare graph-relative paths. It is NOT the canonical layer-path
|
|
19
|
+
* normalization and must not be swapped for it.
|
|
20
|
+
*/
|
|
21
|
+
function normalizeGraphRelativeRefPath(path) {
|
|
10
22
|
return path.replaceAll("\\", "/").replace(/^\.?\//, "").replace(/\/+$/g, "");
|
|
11
23
|
}
|
|
12
|
-
function relativePathEqualsOrWithin(basePath, candidatePath) {
|
|
13
|
-
const base = normalizeRelativePath(basePath);
|
|
14
|
-
const candidate = normalizeRelativePath(candidatePath);
|
|
15
|
-
if (base.length === 0 || candidate.length === 0)
|
|
16
|
-
return false;
|
|
17
|
-
return candidate === base || candidate.startsWith(`${base}/`);
|
|
18
|
-
}
|
|
19
24
|
export function supportsStageEvidenceHarness(stage) {
|
|
20
25
|
return stage.contractType === "build-file-evidence";
|
|
21
26
|
}
|
|
@@ -69,6 +74,7 @@ function renderStageHarnessMarkdown(contract) {
|
|
|
69
74
|
"",
|
|
70
75
|
"Write `runtime/stage-evidence.json` before you emit DONE.",
|
|
71
76
|
"Each evidence item must reference real assigned Source paths or declared output paths.",
|
|
77
|
+
"Do NOT list `runtime/reviewed-inputs.json` or any other `runtime/*` path in `output_refs`. Those files are runtime control surfaces, not stage outputs; the runner records them separately. Evidence outputs must live under a declared artifact path.",
|
|
72
78
|
"Agent status lines and self-reported completion do not count as accepted evidence.",
|
|
73
79
|
"",
|
|
74
80
|
"Minimum shape:",
|
|
@@ -191,7 +197,22 @@ function reconcileParsedStageEvidence(options) {
|
|
|
191
197
|
const allowedSourcePaths = new Set((stageInputs?.inputs ?? []).map((input) => input.path));
|
|
192
198
|
const allowedSourceIds = new Set((stageInputs?.inputs ?? []).map((input) => input.source_file_id));
|
|
193
199
|
const acceptedItems = [];
|
|
194
|
-
|
|
200
|
+
const droppedRuntimeRefs = [];
|
|
201
|
+
for (const rawItem of options.evidence.items) {
|
|
202
|
+
const { item, droppedRuntimeRefs: itemDropped } = normalizeEvidenceItem({
|
|
203
|
+
contextGraphPath: options.contextGraphPath,
|
|
204
|
+
item: rawItem,
|
|
205
|
+
});
|
|
206
|
+
if (itemDropped.length > 0)
|
|
207
|
+
droppedRuntimeRefs.push(...itemDropped.map((p) => `${item.id}: ${p}`));
|
|
208
|
+
// If an item was entirely composed of runtime/* output refs (with no source refs),
|
|
209
|
+
// dropping those refs leaves nothing to validate. Skip with a warning instead of
|
|
210
|
+
// rejecting — the agent already records that coverage via runtime/reviewed-inputs.json.
|
|
211
|
+
const itemWasPurelyRuntime = itemDropped.length > 0 &&
|
|
212
|
+
item.output_refs.length === 0 &&
|
|
213
|
+
item.source_refs.length === 0;
|
|
214
|
+
if (itemWasPurelyRuntime)
|
|
215
|
+
continue;
|
|
195
216
|
const reason = invalidItemReason({
|
|
196
217
|
contextGraphPath: options.contextGraphPath,
|
|
197
218
|
item,
|
|
@@ -224,12 +245,16 @@ function reconcileParsedStageEvidence(options) {
|
|
|
224
245
|
}
|
|
225
246
|
const acceptedItemIds = new Set(acceptedItems.map((item) => item.id));
|
|
226
247
|
const acceptedEdges = [];
|
|
248
|
+
const warnings = [...(options.evidence.warnings ?? [])];
|
|
249
|
+
for (const dropped of droppedRuntimeRefs) {
|
|
250
|
+
warnings.push(`Dropped output ref ${dropped}; runtime/* paths are control surfaces, not stage outputs.`);
|
|
251
|
+
}
|
|
227
252
|
for (const edge of options.evidence.edges) {
|
|
228
253
|
if (edge.stage_id !== options.stage.id) {
|
|
229
254
|
rejected.push({ kind: "edge", id: `${edge.from}:${edge.to}`, reason: "Edge stage does not match the active stage." });
|
|
230
255
|
}
|
|
231
256
|
else if (!acceptedItemIds.has(edge.from) || !acceptedItemIds.has(edge.to)) {
|
|
232
|
-
|
|
257
|
+
warnings.push(`Dropped evidence edge ${edge.from}:${edge.to}; endpoints were not both accepted evidence items.`);
|
|
233
258
|
}
|
|
234
259
|
else {
|
|
235
260
|
acceptedEdges.push(edge);
|
|
@@ -243,9 +268,53 @@ function reconcileParsedStageEvidence(options) {
|
|
|
243
268
|
edges: acceptedEdges,
|
|
244
269
|
},
|
|
245
270
|
rejected,
|
|
246
|
-
warnings
|
|
271
|
+
warnings,
|
|
247
272
|
});
|
|
248
273
|
}
|
|
274
|
+
function normalizeEvidenceItem(options) {
|
|
275
|
+
const droppedRuntimeRefs = [];
|
|
276
|
+
const output_refs = [];
|
|
277
|
+
for (const outputRef of options.item.output_refs) {
|
|
278
|
+
const normalized = normalizeEvidenceOutputRef({
|
|
279
|
+
contextGraphPath: options.contextGraphPath,
|
|
280
|
+
outputRef,
|
|
281
|
+
});
|
|
282
|
+
if (normalizeGraphRelativeRefPath(normalized.path).startsWith("runtime/")) {
|
|
283
|
+
droppedRuntimeRefs.push(normalized.path);
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
output_refs.push(normalized);
|
|
287
|
+
}
|
|
288
|
+
return {
|
|
289
|
+
item: { ...options.item, output_refs },
|
|
290
|
+
droppedRuntimeRefs,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function normalizeEvidenceOutputRef(options) {
|
|
294
|
+
const schema = readBuildPlanContextFile(buildPlanPackagePathForContextGraph(options.contextGraphPath));
|
|
295
|
+
const artifact = schema ? findBuildPlanContextArtifact(schema, options.outputRef.artifact_id) : null;
|
|
296
|
+
if (!artifact)
|
|
297
|
+
return options.outputRef;
|
|
298
|
+
const path = normalizeGraphRelativeRefPath(options.outputRef.path);
|
|
299
|
+
const artifactRoot = normalizeGraphRelativeRefPath(artifact.path);
|
|
300
|
+
const outputMount = `outputs/${options.outputRef.artifact_id}`;
|
|
301
|
+
if (path === outputMount) {
|
|
302
|
+
return { ...options.outputRef, path: artifactRoot };
|
|
303
|
+
}
|
|
304
|
+
if (path.startsWith(`${outputMount}/`)) {
|
|
305
|
+
return {
|
|
306
|
+
...options.outputRef,
|
|
307
|
+
path: normalizeGraphRelativeRefPath(`${artifactRoot}/${path.slice(outputMount.length + 1)}`),
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
if (path.startsWith("outputs/")) {
|
|
311
|
+
const stripped = normalizeGraphRelativeRefPath(path.slice("outputs/".length));
|
|
312
|
+
if (relativePathEqualsOrWithin(artifactRoot, stripped)) {
|
|
313
|
+
return { ...options.outputRef, path: stripped };
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return options.outputRef;
|
|
317
|
+
}
|
|
249
318
|
function invalidItemReason(options) {
|
|
250
319
|
if (options.item.stage_id !== options.stage.id)
|
|
251
320
|
return "Item stage does not match the active stage.";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type ExpectedInputsFile, type GraphManifest, type SourceManifest, type StageManifest, type StageInputs } from "../../contracts/lib/schema.js";
|
|
2
|
+
import type { BuildPlanStageDefinition } from "../../build-plans/package/build-plan-definitions.js";
|
|
3
|
+
export declare function persistStageReviewedInputsFromShell(options: {
|
|
4
|
+
contextGraphPath: string;
|
|
5
|
+
shellRoot: string;
|
|
6
|
+
stageId: string;
|
|
7
|
+
}): {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
summary: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function writeStageExpectedInputs(options: {
|
|
12
|
+
contextGraphPath: string;
|
|
13
|
+
stage: Pick<BuildPlanStageDefinition, "id" | "reads" | "writes" | "contractType">;
|
|
14
|
+
generatedAt?: string;
|
|
15
|
+
}): ExpectedInputsFile | null;
|
|
16
|
+
export declare function writeSourceStageManifest(options: {
|
|
17
|
+
contextGraphPath: string;
|
|
18
|
+
buildPlanId: string;
|
|
19
|
+
sourceManifest: SourceManifest;
|
|
20
|
+
runId?: string | null;
|
|
21
|
+
generatedAt?: string;
|
|
22
|
+
}): StageManifest;
|
|
23
|
+
export declare function loadStageManifest(contextGraphPath: string, stageId: string): StageManifest | null;
|
|
24
|
+
export declare function listStageManifests(contextGraphPath: string): StageManifest[];
|
|
25
|
+
export declare function writeStageManifestFromOutputs(options: {
|
|
26
|
+
contextGraphPath: string;
|
|
27
|
+
buildPlanId: string;
|
|
28
|
+
projectId: string;
|
|
29
|
+
runId?: string | null;
|
|
30
|
+
stage: BuildPlanStageDefinition;
|
|
31
|
+
generatedAt?: string;
|
|
32
|
+
}): StageManifest | null;
|
|
33
|
+
export declare function loadGraphManifest(contextGraphPath: string): GraphManifest | null;
|
|
34
|
+
export declare function writeGraphManifest(options: {
|
|
35
|
+
contextGraphPath: string;
|
|
36
|
+
projectId: string;
|
|
37
|
+
buildPlanId: string;
|
|
38
|
+
intent?: string | null;
|
|
39
|
+
runId?: string | null;
|
|
40
|
+
graphId?: string | null;
|
|
41
|
+
generatedAt?: string;
|
|
42
|
+
}): GraphManifest;
|
|
43
|
+
export declare function reviewedInputsFilePath(contextGraphPath: string, stageId: string): string;
|
|
44
|
+
export declare function expectedInputsFilePath(contextGraphPath: string, stageId: string): string;
|
|
45
|
+
export declare function loadStageInputsForManifest(contextGraphPath: string, stageId: string): StageInputs | null;
|