@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
|
@@ -7,6 +7,15 @@ export interface BuildPlanEditSessionResult {
|
|
|
7
7
|
validation: BuildPlanValidationResult | null;
|
|
8
8
|
summary: string;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Stable Build Plan editing rules shared verbatim by every prompt that edits a
|
|
12
|
+
* Build Plan package — the from-scratch authoring prompt
|
|
13
|
+
* (`build-plan-authoring.ts`) and the validation-repair prompt below. Defined
|
|
14
|
+
* once so the wording cannot drift between the two prompts. Each entry is the
|
|
15
|
+
* bare rule text; the repair prompt renders it as a `- ` bullet, the authoring
|
|
16
|
+
* prompt renders it as a plain line.
|
|
17
|
+
*/
|
|
18
|
+
export declare const SHARED_BUILD_PLAN_EDIT_RULES: readonly string[];
|
|
10
19
|
export declare function runBuildPlanEditSession(options: {
|
|
11
20
|
executor: AgentExecutor;
|
|
12
21
|
buildPlanPath: string;
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { appendFileSync, existsSync, realpathSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { copyDirectory, directoriesMatch, } from "./lib/build-plan-edit-utils.js";
|
|
4
|
+
/**
|
|
5
|
+
* Stable Build Plan editing rules shared verbatim by every prompt that edits a
|
|
6
|
+
* Build Plan package — the from-scratch authoring prompt
|
|
7
|
+
* (`build-plan-authoring.ts`) and the validation-repair prompt below. Defined
|
|
8
|
+
* once so the wording cannot drift between the two prompts. Each entry is the
|
|
9
|
+
* bare rule text; the repair prompt renders it as a `- ` bullet, the authoring
|
|
10
|
+
* prompt renders it as a plain line.
|
|
11
|
+
*/
|
|
12
|
+
export const SHARED_BUILD_PLAN_EDIT_RULES = [
|
|
13
|
+
"Use kebab-case ids everywhere: stage ids, skill_dir values, requested output ids, reads/writes values, and package ids. Never use underscores.",
|
|
14
|
+
"Use `runtime/authoring-context.json.check_param_contracts` as the exact parameter contract for each check kind.",
|
|
15
|
+
"Every deterministic diagnostic must include a human-readable `description` that names the user's assertion; keep `kind` and `params` as the machine evaluator and never as user copy.",
|
|
16
|
+
];
|
|
4
17
|
export async function runBuildPlanEditSession(options) {
|
|
5
18
|
const editableBuildPlanPath = join(options.shell.rootPath, "build-plan");
|
|
6
19
|
copyDirectory(options.buildPlanPath, options.shell.buildPlanBeforePath);
|
|
@@ -17,6 +30,7 @@ export async function runBuildPlanEditSession(options) {
|
|
|
17
30
|
code = await options.executor.execute(options.shell.rootPath, prompt, {
|
|
18
31
|
eventLogPath: options.shell.eventLogPath,
|
|
19
32
|
statusLogPath: options.shell.statusLogPath,
|
|
33
|
+
reasoningLogPath: options.shell.reasoningLogPath,
|
|
20
34
|
completionCheck: () => {
|
|
21
35
|
try {
|
|
22
36
|
if (directoriesMatch(options.shell.buildPlanBeforePath, editableBuildPlanPath))
|
|
@@ -94,18 +108,21 @@ export async function runBuildPlanEditSession(options) {
|
|
|
94
108
|
"",
|
|
95
109
|
"Rules:",
|
|
96
110
|
"- Edit only files under `build-plan/`.",
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
"-
|
|
100
|
-
"-
|
|
101
|
-
"-
|
|
111
|
+
// Stable kebab-case-id rule (shared with the authoring prompt).
|
|
112
|
+
`- ${SHARED_BUILD_PLAN_EDIT_RULES[0]}`,
|
|
113
|
+
"- Stage `reads` may only contain requested output ids declared in `build-plan.schema.json` and produced by an earlier stage. Source files are implicit input; never use `source` or source paths in `reads`.",
|
|
114
|
+
"- Keep coverage expectations, requested outputs, and backed output ids aligned with the Project intent.",
|
|
115
|
+
"- If `runtime/authoring-context.json.artifact_requirements[]` is non-empty, copy every required output `id`, `shape`, and `checks[]` exactly into `build-plan.schema.json`.",
|
|
116
|
+
"- Do not rename, move, merge, split, or reinterpret required outputs while repairing validation errors.",
|
|
102
117
|
"- Keep every stage `skill_dir` matched by `build-plan/build/stages/<skill_dir>/SKILL.md`.",
|
|
103
|
-
"- Keep `build-plan.schema.json`
|
|
104
|
-
"-
|
|
118
|
+
"- Keep `build-plan.schema.json` requested output paths unique. Child outputs may live under the required layer directories `summaries/`, `knowledge/`, and `artifacts/`; unrelated output paths must not overlap.",
|
|
119
|
+
"- Keep deterministic validation on requested output `checks[]` minimal; do not add stage `acceptance` blocks.",
|
|
105
120
|
"- Use only CheckKind values listed in `runtime/authoring-context.json`; replace invented aliases with valid kinds.",
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
121
|
+
// Stable check-param-contract + diagnostic-description rules (shared with
|
|
122
|
+
// the authoring prompt).
|
|
123
|
+
`- ${SHARED_BUILD_PLAN_EDIT_RULES[1]}`,
|
|
124
|
+
`- ${SHARED_BUILD_PLAN_EDIT_RULES[2]}`,
|
|
125
|
+
"- If the Build Plan writes a graph index, keep it declared as a requested output owned by the producing stage.",
|
|
109
126
|
"- Stop as soon as the package should validate.",
|
|
110
127
|
].join("\n");
|
|
111
128
|
appendFileSync(options.shell.promptLogPath, `\n\n---\n\n${prompt}\n`);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { appendFileSync, existsSync, mkdirSync, writeFileSync, } from "node:fs";
|
|
2
2
|
import { join, relative } from "node:path";
|
|
3
3
|
import { createBuildPlanImprovementShell, freezeBuildPlanImprovementShell, } from "../../runtime/agents/lib/shells.js";
|
|
4
|
-
import { validateBuildPlanPackage } from "../package/local-build-plans.js";
|
|
5
4
|
import { CONTEXT_INTERFACE_FILE } from "../package/context-interface.js";
|
|
6
5
|
import { readJsonFileWithSchema } from "../../contracts/utils/parse.js";
|
|
7
6
|
import { resolveBuildPlanImprovementReviewPaths } from "../package/build-plan-review-paths.js";
|
|
8
7
|
import { targetTestRunsRootForContextGraph, targetTestSandboxesRootForContextGraph, buildPlanImprovementRunRoot, buildPlanPackagePathForContextGraph, } from "../../runtime/build/context-graph-paths.js";
|
|
9
|
-
import { readInterfConfig } from "../../projects/interf.js";
|
|
8
|
+
import { readInterfConfig, resolveSourceFolderPath } from "../../projects/interf.js";
|
|
9
|
+
import { scanSourceContext } from "../../runtime/agents/lib/source-context-scan.js";
|
|
10
10
|
import { saveContextGraphInterfConfig } from "../../projects/source-config.js";
|
|
11
11
|
import { BuildPlanImprovementRunLedgerSchema, } from "../../runtime/build/lib/schema.js";
|
|
12
12
|
import { runBuildPlanEditSession } from "./build-plan-edit-session.js";
|
|
13
|
-
import { ensureStageRoles } from "./build-plan-authoring.js";
|
|
13
|
+
import { ensureStageRoles, validateImproveTailoringNonRegression, validateLifecycleBuildPlanPackage, } from "./build-plan-authoring.js";
|
|
14
14
|
function toShellArtifactPath(absolutePath, sourceRoot, shellRoot) {
|
|
15
15
|
if (!absolutePath)
|
|
16
16
|
return null;
|
|
@@ -51,6 +51,31 @@ function buildLoopContext(options) {
|
|
|
51
51
|
latest_failure: latestFailure,
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Resolve the SAME cheap, contents-free Source inventory the draft path scans,
|
|
56
|
+
* but from the Context Graph the improvement loop is editing. The Context
|
|
57
|
+
* Graph's `interf.json` carries the Project's Source binding, so the improve
|
|
58
|
+
* path CAN reach the Source (`resolveSourceFolderPath` → `scanSourceContext`)
|
|
59
|
+
* exactly like the draft path does — it is not blind to the Source.
|
|
60
|
+
*
|
|
61
|
+
* Returns null (and the tailoring non-regression guard becomes a no-op) only
|
|
62
|
+
* when there is genuinely nothing to scan: no Source binding in the config, or
|
|
63
|
+
* the Source has no readable files. A null here never fabricates an inventory.
|
|
64
|
+
*/
|
|
65
|
+
function resolveImproveSourceContext(contextGraphPath) {
|
|
66
|
+
const config = readInterfConfig(contextGraphPath);
|
|
67
|
+
let sourceFolderPath;
|
|
68
|
+
try {
|
|
69
|
+
sourceFolderPath = resolveSourceFolderPath(contextGraphPath, config);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
// No Source binding in the Context Graph config — nothing to tailor
|
|
73
|
+
// against. The draft path always has a Source folder; the improve path may
|
|
74
|
+
// run against a Context Graph whose binding is missing, so degrade quietly.
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
return scanSourceContext(sourceFolderPath) ?? null;
|
|
78
|
+
}
|
|
54
79
|
function buildBuildPlanImprovementPrompt() {
|
|
55
80
|
return [
|
|
56
81
|
"This is an automated Interf Build Plan improvement run, not an open-ended chat session.",
|
|
@@ -59,12 +84,12 @@ function buildBuildPlanImprovementPrompt() {
|
|
|
59
84
|
`Then read \`build-plan/README.md\`, \`build-plan/build-plan.json\`, \`build-plan/${CONTEXT_INTERFACE_FILE}\`, and \`build-plan/improve/SKILL.md\` if it exists.`,
|
|
60
85
|
"Review preserved evidence from earlier failures under `artifacts/` before you edit the Build Plan.",
|
|
61
86
|
"Treat `build-plan/improve/SKILL.md` as guidance for how to improve the Build Plan, not as the default file to edit.",
|
|
62
|
-
"Treat the Build Plan package as four aligned layers: purpose, inputs, requested
|
|
63
|
-
"Prefer editing the stage docs, Build Plan contract, input contract, or
|
|
87
|
+
"Treat the Build Plan package as four aligned layers: purpose, inputs, requested output contract, and stages.",
|
|
88
|
+
"Prefer editing the stage docs, Build Plan contract, input contract, or requested output ownership that actually change graph outputs.",
|
|
64
89
|
"Edit only files under `build-plan/`.",
|
|
65
|
-
"Do not edit checks, benchmark specs, source files, or generated requested
|
|
90
|
+
"Do not edit checks, benchmark specs, source files, or generated requested outputs.",
|
|
66
91
|
"Keep the Build Plan package valid for the current build API and `build-plan.schema.json`.",
|
|
67
|
-
"Respect stage boundaries: a stage may only introduce links that resolve within that stage's declared writes or already-existing read
|
|
92
|
+
"Respect stage boundaries: a stage may only introduce links that resolve within that stage's declared writes or already-existing read outputs.",
|
|
68
93
|
"Do not make one stage point at files or notes that are only created later by another stage.",
|
|
69
94
|
"Prefer small, defensible changes to Build Plan docs, stage docs, stage policies, or schema ownership over random churn.",
|
|
70
95
|
"Do not narrate plans or ask follow-up questions.",
|
|
@@ -142,6 +167,9 @@ function buildBuildPlanImprovementLoopRecord(options) {
|
|
|
142
167
|
prompt_log_path: options.promptLogPath,
|
|
143
168
|
event_log_path: options.eventLogPath,
|
|
144
169
|
status_log_path: options.statusLogPath,
|
|
170
|
+
// Same canonical location the shell teed reasoning to and the freeze
|
|
171
|
+
// preserved (derived from shell_path, like context_path above).
|
|
172
|
+
reasoning_path: join(options.shellPath, "runtime", "agent-reasoning.jsonl"),
|
|
145
173
|
preserved_shell_manifest_path: options.preservedShellManifestPath,
|
|
146
174
|
validation: options.validation,
|
|
147
175
|
};
|
|
@@ -158,12 +186,38 @@ export async function runBuildPlanImprovementLoop(options) {
|
|
|
158
186
|
context,
|
|
159
187
|
});
|
|
160
188
|
const buildPlanRoot = buildPlanPackagePathForContextGraph(options.contextGraphPath);
|
|
189
|
+
// Scan the Source ONCE (from the Context Graph's own binding) so the tailoring
|
|
190
|
+
// non-regression guard below compares before/after against one stable
|
|
191
|
+
// inventory. Null when there is no Source binding or no readable files, which
|
|
192
|
+
// makes that guard a no-op.
|
|
193
|
+
const improveSourceContext = resolveImproveSourceContext(options.contextGraphPath);
|
|
161
194
|
const session = await runBuildPlanEditSession({
|
|
162
195
|
executor: options.executor,
|
|
163
196
|
buildPlanPath: buildPlanRoot,
|
|
164
197
|
shell,
|
|
165
198
|
prompt: buildBuildPlanImprovementPrompt(),
|
|
166
|
-
|
|
199
|
+
// Run the SHARED lifecycle validator (base + product-critical backlink and
|
|
200
|
+
// canonical-top-level-layer invariants), PLUS a tailoring non-regression
|
|
201
|
+
// delta. An improvement edit must not silently strip those invariants, and
|
|
202
|
+
// — closing the original C1 gap — it must not DE-TAILOR a plan that was
|
|
203
|
+
// tailored to the Source back to a generic skeleton. The scaffold-removal,
|
|
204
|
+
// artifact-requirement, and ABSOLUTE tailoring guards stay authoring-only
|
|
205
|
+
// (draft-time concerns); the improve path enforces the non-regression delta
|
|
206
|
+
// so it never false-rejects a faithful improvement to a generic-by-design
|
|
207
|
+
// plan such as `interf-default`.
|
|
208
|
+
validate: (afterBuildPlanPath) => {
|
|
209
|
+
const lifecycle = validateLifecycleBuildPlanPackage(afterBuildPlanPath);
|
|
210
|
+
const tailoringErrors = validateImproveTailoringNonRegression(shell.buildPlanBeforePath, afterBuildPlanPath, improveSourceContext);
|
|
211
|
+
if (tailoringErrors.length === 0)
|
|
212
|
+
return lifecycle;
|
|
213
|
+
const errors = [...lifecycle.errors, ...tailoringErrors];
|
|
214
|
+
return {
|
|
215
|
+
ok: false,
|
|
216
|
+
summary: `Build Plan package has ${errors.length} issue(s).`,
|
|
217
|
+
errors,
|
|
218
|
+
counts: lifecycle.counts,
|
|
219
|
+
};
|
|
220
|
+
},
|
|
167
221
|
maxValidationRepairAttempts: 1,
|
|
168
222
|
});
|
|
169
223
|
if (session.status === "updated") {
|
|
@@ -35,7 +35,6 @@ export interface BuildPlanDefinition<TId extends string> {
|
|
|
35
35
|
hint: string;
|
|
36
36
|
recommended?: boolean;
|
|
37
37
|
contextInterface?: ContextInterface;
|
|
38
|
-
schema?: ContextInterface;
|
|
39
38
|
stages: BuildPlanStageDefinition[];
|
|
40
39
|
stagePolicyNotes?: Record<string, string[]>;
|
|
41
40
|
starterDocs?: BuildPlanStarterDoc[];
|
|
@@ -7,7 +7,7 @@ import { buildPlanPackagePathForContextGraph } from "../../runtime/build/context
|
|
|
7
7
|
import { asProjectDataDir, projectBuildPlanPackagePath } from "../../contracts/lib/project-paths.js";
|
|
8
8
|
import { resolveSourceControlPath } from "../../projects/interf.js";
|
|
9
9
|
import { deriveBuildPlanInputsFromContextInterface, } from "./context-interface.js";
|
|
10
|
-
|
|
10
|
+
import { DEFAULT_BUILD_PLAN_ID } from "../build-plan-resolution.js";
|
|
11
11
|
let builtinDefaultBuildPlanCache = null;
|
|
12
12
|
function toBuildPlanStages(stages) {
|
|
13
13
|
return stages.map((stage) => ({
|
|
@@ -16,7 +16,10 @@ function toBuildPlanStages(stages) {
|
|
|
16
16
|
description: stage.description ?? stage.label,
|
|
17
17
|
contractType: stage.contract_type,
|
|
18
18
|
skillDir: stage.skill_dir ?? stage.id,
|
|
19
|
-
|
|
19
|
+
// Store the TRIMMED role so a padded value like " general " maps to the
|
|
20
|
+
// same agent-role-map key the validity check (`.trim().length > 0`) tested,
|
|
21
|
+
// matching how `ensureStageRoles` (build-plan-authoring.ts) stores roles.
|
|
22
|
+
role: stage.role && stage.role.trim().length > 0 ? stage.role.trim() : "general",
|
|
20
23
|
reads: [...stage.reads],
|
|
21
24
|
writes: [...stage.writes],
|
|
22
25
|
}));
|
|
@@ -50,7 +53,6 @@ export function standaloneBuildPlanDefinitionFromLocalPackage(local) {
|
|
|
50
53
|
hint: local.hint,
|
|
51
54
|
recommended: false,
|
|
52
55
|
contextInterface,
|
|
53
|
-
...(contextInterface ? { schema: contextInterface } : {}),
|
|
54
56
|
stages,
|
|
55
57
|
stagePolicyNotes: mergeStagePolicyNotesForStages(stages, undefined, local.stage_policy_notes),
|
|
56
58
|
starterDocs: [...local.starter_docs],
|
|
@@ -15,6 +15,7 @@ interface ExecuteValidatedStageOptions<TContractType extends RuntimeContractType
|
|
|
15
15
|
targetName: string;
|
|
16
16
|
buildPlan: string;
|
|
17
17
|
buildPlanSourcePath?: string;
|
|
18
|
+
buildRunId?: string | null;
|
|
18
19
|
stageDefinition: BuildPlanStageShape<TContractType>;
|
|
19
20
|
instructions: RuntimeStageInstructions;
|
|
20
21
|
summary: string;
|
|
@@ -23,6 +23,7 @@ export async function executeValidatedStage(options) {
|
|
|
23
23
|
contextGraphName: options.targetName,
|
|
24
24
|
buildPlan: options.buildPlan,
|
|
25
25
|
buildPlanSourcePath: options.buildPlanSourcePath,
|
|
26
|
+
buildRunId: options.buildRunId ?? null,
|
|
26
27
|
stage: options.stageDefinition.id,
|
|
27
28
|
stageLabel: options.stageDefinition.label,
|
|
28
29
|
contractType: options.stageDefinition.contractType,
|
|
@@ -43,7 +44,7 @@ function finalizeValidatedStage(options, code) {
|
|
|
43
44
|
if (!reconciled && validation.ok) {
|
|
44
45
|
return {
|
|
45
46
|
ok: false,
|
|
46
|
-
summary: "Stage did not update any declared output
|
|
47
|
+
summary: "Stage did not update any declared requested output.",
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
50
|
return validation;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type BuildPlanArtifactKind } from "../../runtime/build/build-plan-primitives.js";
|
|
2
2
|
declare const BUILTIN_BUILD_PLAN_STAGE_IDS: {
|
|
3
3
|
readonly SUMMARIZE: "summarize";
|
|
4
|
-
readonly
|
|
5
|
-
readonly
|
|
4
|
+
readonly KNOWLEDGE: "knowledge";
|
|
5
|
+
readonly ENTRYPOINT: "entrypoint";
|
|
6
6
|
};
|
|
7
7
|
type BuiltinBuildStageId = typeof BUILTIN_BUILD_PLAN_STAGE_IDS[keyof typeof BUILTIN_BUILD_PLAN_STAGE_IDS];
|
|
8
8
|
export declare const BUILTIN_BUILD_PLAN_ARTIFACT_IDS: {
|
|
@@ -5,8 +5,8 @@ import { BuildPlanContextSchemaSchema } from "../../runtime/build/lib/schema.js"
|
|
|
5
5
|
import { PACKAGE_ROOT } from "./lib/package-root.js";
|
|
6
6
|
const BUILTIN_BUILD_PLAN_STAGE_IDS = {
|
|
7
7
|
SUMMARIZE: "summarize",
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
KNOWLEDGE: "knowledge",
|
|
9
|
+
ENTRYPOINT: "entrypoint",
|
|
10
10
|
};
|
|
11
11
|
export const BUILTIN_BUILD_PLAN_ARTIFACT_IDS = {
|
|
12
12
|
SUMMARIES: "summaries",
|
|
@@ -30,7 +30,7 @@ let builtinBuildPlanContractCache = null;
|
|
|
30
30
|
const BUILTIN_DEFAULT_BUILD_PLAN_ROOT = join(PACKAGE_ROOT, "public-repo", "build-plans", "interf-default");
|
|
31
31
|
function assertBuiltinArtifactId(value) {
|
|
32
32
|
if (!BUILTIN_ARTIFACT_ID_SET.has(value)) {
|
|
33
|
-
throw new Error(`Built-in Interf Build Plan schema declares unsupported
|
|
33
|
+
throw new Error(`Built-in Interf Build Plan schema declares unsupported requested output id "${value}".`);
|
|
34
34
|
}
|
|
35
35
|
return value;
|
|
36
36
|
}
|
|
@@ -30,6 +30,9 @@ export declare const ContextInterfaceSchema: z.ZodObject<{
|
|
|
30
30
|
frontmatter_required_keys: "frontmatter_required_keys";
|
|
31
31
|
frontmatter_nonempty_keys: "frontmatter_nonempty_keys";
|
|
32
32
|
source_refs_required: "source_refs_required";
|
|
33
|
+
summary_backlinks_present: "summary_backlinks_present";
|
|
34
|
+
knowledge_web_connectivity: "knowledge_web_connectivity";
|
|
35
|
+
graph_notes_connected: "graph_notes_connected";
|
|
33
36
|
wikilinks_valid: "wikilinks_valid";
|
|
34
37
|
must_not_contain: "must_not_contain";
|
|
35
38
|
must_contain: "must_contain";
|
|
@@ -5,7 +5,7 @@ import { warnInterf } from "../../contracts/utils/logger.js";
|
|
|
5
5
|
import { readJsonFileUnchecked } from "../../contracts/utils/parse.js";
|
|
6
6
|
import { BuildPlanContextSchemaSchema, BuildPlanArtifactIdSchema, } from "../../runtime/build/lib/schema.js";
|
|
7
7
|
import { listBuiltinBuildPlanArtifactSpecs, requiredBuildPlanArtifactOwners, } from "./builtin-build-plan.js";
|
|
8
|
-
// Build Plan packages define the requested
|
|
8
|
+
// Build Plan packages define the requested output contract. The local service persists the
|
|
9
9
|
// same schema on disk, but higher layers should prefer this boundary when they
|
|
10
10
|
// mean "the Build Plan-declared shape the Context Graph must implement."
|
|
11
11
|
export const CONTEXT_INTERFACE_FILE = "build-plan.schema.json";
|
|
@@ -13,7 +13,7 @@ export const ContextInterfaceSchema = BuildPlanContextSchemaSchema;
|
|
|
13
13
|
// Package-owned input contract for authoring, review, and future authoring flows.
|
|
14
14
|
// This does not change build execution semantics; it describes what data a
|
|
15
15
|
// Build Plan expects to organize before the local service materializes the context
|
|
16
|
-
// requested
|
|
16
|
+
// requested output contract on disk.
|
|
17
17
|
export const BuildPlanInputSpecSchema = z.object({
|
|
18
18
|
id: BuildPlanArtifactIdSchema,
|
|
19
19
|
label: z.string().min(1),
|
|
@@ -69,7 +69,7 @@ export function summarizeContextInterface(contextInterface) {
|
|
|
69
69
|
export function deriveBuildPlanInputsFromContextInterface(_contextInterface) {
|
|
70
70
|
return [];
|
|
71
71
|
}
|
|
72
|
-
export function buildContextInterface(stages, label = "Build Plan requested
|
|
72
|
+
export function buildContextInterface(stages, label = "Build Plan requested output contract") {
|
|
73
73
|
return {
|
|
74
74
|
kind: "build-plan-schema",
|
|
75
75
|
version: 1,
|
|
@@ -102,12 +102,12 @@ export function readContextInterface(rootPath) {
|
|
|
102
102
|
const path = contextInterfaceFilePath(rootPath);
|
|
103
103
|
if (!existsSync(path))
|
|
104
104
|
return null;
|
|
105
|
-
const raw = readJsonFileUnchecked(path, "Build Plan requested
|
|
105
|
+
const raw = readJsonFileUnchecked(path, "Build Plan requested output contract");
|
|
106
106
|
if (raw === null)
|
|
107
107
|
return null;
|
|
108
108
|
const parsed = ContextInterfaceSchema.safeParse(raw);
|
|
109
109
|
if (!parsed.success) {
|
|
110
|
-
warnInterf(`Warning: failed to validate Build Plan requested
|
|
110
|
+
warnInterf(`Warning: failed to validate Build Plan requested output contract at ${path}: ${parsed.error.issues.map((issue) => issue.message).join("; ")}`);
|
|
111
111
|
return null;
|
|
112
112
|
}
|
|
113
113
|
return normalizeContextInterface(parsed.data);
|
|
@@ -20,7 +20,7 @@ function writeBuildPlanPackageJson(rootPath, buildPlan, options) {
|
|
|
20
20
|
return;
|
|
21
21
|
const inputs = buildPlan.inputs?.length
|
|
22
22
|
? buildPlan.inputs
|
|
23
|
-
: deriveBuildPlanInputsFromContextInterface(buildPlan.contextInterface
|
|
23
|
+
: deriveBuildPlanInputsFromContextInterface(buildPlan.contextInterface);
|
|
24
24
|
writeFileSync(targetPath, `${JSON.stringify({
|
|
25
25
|
id: buildPlan.id,
|
|
26
26
|
type: "build-plan",
|
|
@@ -53,7 +53,7 @@ function writeBuildPlanPackageJson(rootPath, buildPlan, options) {
|
|
|
53
53
|
}, null, 2)}\n`);
|
|
54
54
|
}
|
|
55
55
|
function renderBuildPlanReadme(buildPlan) {
|
|
56
|
-
const contextInterface = buildPlan.contextInterface ??
|
|
56
|
+
const contextInterface = buildPlan.contextInterface ?? null;
|
|
57
57
|
const stageLines = buildPlan.stages
|
|
58
58
|
.map((stage) => `- \`${stage.id}\` — ${stage.description} (${stage.contractType}; reads: ${stage.reads.join(", ")}; writes: ${stage.writes.join(", ")})`)
|
|
59
59
|
.join("\n");
|
|
@@ -65,7 +65,7 @@ function renderBuildPlanReadme(buildPlan) {
|
|
|
65
65
|
: [];
|
|
66
66
|
const contextInterfaceLines = contextInterfaceArtifacts.length > 0
|
|
67
67
|
? contextInterfaceArtifacts
|
|
68
|
-
.map((artifact) => `- \`${artifact.id}\` — ${artifact.kind}
|
|
68
|
+
.map((artifact) => `- \`${artifact.id}\` — ${artifact.kind} requested output at \`${artifact.path}\`: ${artifact.description}`)
|
|
69
69
|
.join("\n")
|
|
70
70
|
: null;
|
|
71
71
|
const inputs = buildPlan.inputs?.length
|
|
@@ -78,7 +78,7 @@ function renderBuildPlanReadme(buildPlan) {
|
|
|
78
78
|
: null;
|
|
79
79
|
const contextInterfaceSummaryLines = interfaceSummary
|
|
80
80
|
? [
|
|
81
|
-
`-
|
|
81
|
+
`- Requested outputs: ${interfaceSummary.outputArtifacts.length > 0 ? interfaceSummary.outputArtifacts.map((artifact) => `\`${artifact.id}\``).join(", ") : "none"}`,
|
|
82
82
|
].join("\n")
|
|
83
83
|
: null;
|
|
84
84
|
return [
|
|
@@ -105,7 +105,7 @@ function renderBuildPlanReadme(buildPlan) {
|
|
|
105
105
|
...(contextInterfaceLines
|
|
106
106
|
? [
|
|
107
107
|
"",
|
|
108
|
-
"## Requested
|
|
108
|
+
"## Requested Output Contract",
|
|
109
109
|
"",
|
|
110
110
|
...(contextInterfaceSummaryLines
|
|
111
111
|
? [
|
|
@@ -113,7 +113,7 @@ function renderBuildPlanReadme(buildPlan) {
|
|
|
113
113
|
"",
|
|
114
114
|
]
|
|
115
115
|
: []),
|
|
116
|
-
"
|
|
116
|
+
"Requested output map:",
|
|
117
117
|
"",
|
|
118
118
|
contextInterfaceLines,
|
|
119
119
|
]
|
|
@@ -122,7 +122,7 @@ function renderBuildPlanReadme(buildPlan) {
|
|
|
122
122
|
"## Package",
|
|
123
123
|
"",
|
|
124
124
|
"- `build-plan.json` = Build Plan stage flow, local-engine API target, and build contract mapping",
|
|
125
|
-
"- `build-plan.schema.json` = deterministic requested
|
|
125
|
+
"- `build-plan.schema.json` = deterministic requested output contract for the Build Plan",
|
|
126
126
|
"- `improve/`, `build/stages/`, and `use/query/` = human-readable authoring docs",
|
|
127
127
|
"- Build Plans are standalone: explicit stages, schema, and docs live together in this folder",
|
|
128
128
|
"- Interf projects native agent shells from these docs for query use, stage execution, and Build Plan improvement loops",
|
|
@@ -142,9 +142,9 @@ function renderDerivedBuildPlanReadme(options) {
|
|
|
142
142
|
options.hint,
|
|
143
143
|
"",
|
|
144
144
|
`This Build Plan package was forked from \`${options.baseBuildPlanId}\` and materialized as a standalone package for this kind of agent task.`,
|
|
145
|
-
"It starts with that Build Plan topology; edit the package when the agent task needs different stages,
|
|
145
|
+
"It starts with that Build Plan topology; edit the package when the agent task needs different stages, requested outputs, entrypoints, or diagnostics.",
|
|
146
146
|
"",
|
|
147
|
-
"Interf runs the local copy of this package directly. Keep purpose, inputs, requested
|
|
147
|
+
"Interf runs the local copy of this package directly. Keep purpose, inputs, requested output contract, and stage docs self-contained in this folder instead of relying on runtime inheritance.",
|
|
148
148
|
"",
|
|
149
149
|
"## Emphasis",
|
|
150
150
|
"",
|
|
@@ -161,9 +161,9 @@ function renderSeedBuildPlanReadme(options) {
|
|
|
161
161
|
options.hint,
|
|
162
162
|
"",
|
|
163
163
|
`This Build Plan package was forked from \`${options.baseBuildPlanId}\` as a standalone local package.`,
|
|
164
|
-
"It starts with that Build Plan topology; edit the package when the agent task needs different stages,
|
|
164
|
+
"It starts with that Build Plan topology; edit the package when the agent task needs different stages, requested outputs, entrypoints, or diagnostics.",
|
|
165
165
|
"",
|
|
166
|
-
"Interf runs the local copy of this package directly. Refine purpose, inputs, requested
|
|
166
|
+
"Interf runs the local copy of this package directly. Refine purpose, inputs, requested output contract, and stage instructions in this folder instead of relying on inheritance.",
|
|
167
167
|
"",
|
|
168
168
|
].join("\n");
|
|
169
169
|
}
|
|
@@ -176,7 +176,7 @@ function renderScratchBuildPlanReadme(options) {
|
|
|
176
176
|
"This Build Plan package is a neutral from-scratch authoring scaffold.",
|
|
177
177
|
"",
|
|
178
178
|
"It is not copied from `interf-default`, and its placeholder stage is not a recommended topology.",
|
|
179
|
-
"Replace purpose, inputs, requested
|
|
179
|
+
"Replace purpose, inputs, requested output contract, stages, stage docs, coverage rules, and query guidance with the Build Plan this source data and task actually need.",
|
|
180
180
|
"",
|
|
181
181
|
].join("\n");
|
|
182
182
|
}
|
|
@@ -199,7 +199,7 @@ function renderImproveSkill(buildPlan) {
|
|
|
199
199
|
"- do not edit checks, benchmark specs, or source artifacts",
|
|
200
200
|
"- do not hardcode expected answers into Build Plan docs",
|
|
201
201
|
"- keep this package standalone; do not rely on runtime inheritance",
|
|
202
|
-
"- keep the Build Plan stack coherent: purpose, inputs, requested
|
|
202
|
+
"- keep the Build Plan stack coherent: purpose, inputs, requested output contract, and stages should describe the same agent task",
|
|
203
203
|
"- prefer small, defensible Build Plan changes over random churn",
|
|
204
204
|
"",
|
|
205
205
|
].join("\n");
|
|
@@ -222,15 +222,15 @@ function renderStageSkill(buildPlan, stage) {
|
|
|
222
222
|
"## Stage Contract",
|
|
223
223
|
"",
|
|
224
224
|
`- Contract type: \`${stage.contractType}\``,
|
|
225
|
-
`- Reads
|
|
226
|
-
`- Writes
|
|
225
|
+
`- Reads requested outputs: ${stage.reads.map((artifactId) => `\`${artifactId}\``).join(", ")}`,
|
|
226
|
+
`- Writes requested outputs: ${stage.writes.map((artifactId) => `\`${artifactId}\``).join(", ")}`,
|
|
227
227
|
"",
|
|
228
228
|
"## Requirements",
|
|
229
229
|
"",
|
|
230
230
|
"- Treat `build-plan.json` and `build-plan.schema.json` as the authoritative package contract for this stage.",
|
|
231
|
-
"- Read only from the declared input
|
|
232
|
-
"- Write only inside the declared
|
|
233
|
-
"- Keep stage instructions,
|
|
231
|
+
"- Read only from the declared input outputs unless this package explicitly documents broader Build Plan behavior.",
|
|
232
|
+
"- Write only inside the declared requested outputs for this stage. Do not invent undeclared outputs.",
|
|
233
|
+
"- Keep stage instructions, output ownership, and Build Plan diagnostics aligned when you change this stage.",
|
|
234
234
|
"- Treat runtime files as evidence and execution state, not as the source of truth for Build Plan behavior.",
|
|
235
235
|
"- Prefer direct file-reading and search tools over shell commands for routine file inspection.",
|
|
236
236
|
...abstractRules,
|
|
@@ -258,7 +258,7 @@ function writeBuildPlanPackageToDir(buildPlanDir, buildPlan, options = {}) {
|
|
|
258
258
|
}
|
|
259
259
|
writeBuildPlanPackageJson(buildPlanDir, buildPlan, { overwrite });
|
|
260
260
|
if (overwrite || !existsSync(join(buildPlanDir, CONTEXT_INTERFACE_FILE))) {
|
|
261
|
-
const contextInterface = buildPlan.contextInterface
|
|
261
|
+
const contextInterface = buildPlan.contextInterface;
|
|
262
262
|
if (contextInterface) {
|
|
263
263
|
writeContextInterface(buildPlanDir, {
|
|
264
264
|
...contextInterface,
|
|
@@ -422,13 +422,13 @@ export function createScratchLocalBuildPlanPackage(options) {
|
|
|
422
422
|
artifacts: [
|
|
423
423
|
{
|
|
424
424
|
id: "draft-context",
|
|
425
|
-
description: "Temporary placeholder
|
|
425
|
+
description: "Temporary placeholder requested output for the neutral authoring scaffold. Replace it with task-specific outputs.",
|
|
426
426
|
shape: { kind: "path", path: "draft", artifact_kind: "directory" },
|
|
427
427
|
checks: [
|
|
428
428
|
{
|
|
429
429
|
id: "exists",
|
|
430
430
|
kind: "min_file_count",
|
|
431
|
-
description: "The draft
|
|
431
|
+
description: "The draft output exists and contains at least one file.",
|
|
432
432
|
required: true,
|
|
433
433
|
params: { min: 1 },
|
|
434
434
|
},
|
|
@@ -452,7 +452,7 @@ export function createScratchLocalBuildPlanPackage(options) {
|
|
|
452
452
|
stagePolicyNotes: {
|
|
453
453
|
prepare: [
|
|
454
454
|
"This is a neutral authoring scaffold, not a recommended Build Plan topology.",
|
|
455
|
-
"Replace this stage,
|
|
455
|
+
"Replace this stage, requested output, and diagnostic when drafting the final Build Plan.",
|
|
456
456
|
],
|
|
457
457
|
},
|
|
458
458
|
starterDocs: [
|
|
@@ -3,10 +3,7 @@ import { BuildPlanRuntimeApiSchema, BuildPlanPurposeSchema, type BuildPlanStageA
|
|
|
3
3
|
import { RuntimeContractTypeSchema } from "../../contracts/lib/schema.js";
|
|
4
4
|
import { BuildPlanInputSpecSchema, type ContextInterface, type BuildPlanInputSpec } from "./context-interface.js";
|
|
5
5
|
import { type BuildPlanAuthoringBrief } from "../authoring/brief.js";
|
|
6
|
-
|
|
7
|
-
relativePath: string;
|
|
8
|
-
content: string;
|
|
9
|
-
}
|
|
6
|
+
import type { BuildPlanStarterDoc } from "./build-plan-definitions.js";
|
|
10
7
|
interface LocalBuildPlanStageDefinition {
|
|
11
8
|
id: string;
|
|
12
9
|
label: string;
|
|
@@ -34,7 +31,7 @@ export interface LocalBuildPlanDefinition {
|
|
|
34
31
|
stages?: LocalBuildPlanStageDefinition[];
|
|
35
32
|
stage_policy_notes?: Record<string, string[]>;
|
|
36
33
|
build_plan_schema: ContextInterface;
|
|
37
|
-
starter_docs:
|
|
34
|
+
starter_docs: BuildPlanStarterDoc[];
|
|
38
35
|
directoryPath: string;
|
|
39
36
|
buildPlanPath: string;
|
|
40
37
|
buildPlanSchemaPath: string;
|
|
@@ -73,4 +70,12 @@ export interface BuildPlanValidationResult {
|
|
|
73
70
|
counts: Record<string, number>;
|
|
74
71
|
}
|
|
75
72
|
export declare function validateBuildPlanPackage(dirPath: string): BuildPlanValidationResult;
|
|
73
|
+
/**
|
|
74
|
+
* Explain WHY a `build-plan.schema.json` failed to read. Exported so the
|
|
75
|
+
* regression test can assert the corrected branch directly: a valid schema must
|
|
76
|
+
* return `[]` (no issues), an invalid one must return the concrete Zod issues.
|
|
77
|
+
* The previous inverted `if (parsed.success)` reported a VALID schema as
|
|
78
|
+
* "missing or invalid."
|
|
79
|
+
*/
|
|
80
|
+
export declare function describeContextInterfaceValidationIssues(dirPath: string): string[];
|
|
76
81
|
export {};
|