@interf/compiler 0.9.5 → 0.13.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 +96 -92
- package/TRADEMARKS.md +2 -13
- package/agent-skills/interf-actions/SKILL.md +95 -36
- package/agent-skills/interf-actions/references/cli.md +118 -51
- package/builtin-methods/interf-default/README.md +3 -4
- package/builtin-methods/interf-default/compile/stages/shape/SKILL.md +2 -2
- package/builtin-methods/interf-default/compile/stages/summarize/SKILL.md +2 -1
- package/builtin-methods/interf-default/improve/SKILL.md +1 -1
- package/builtin-methods/interf-default/method.json +10 -4
- package/builtin-methods/interf-default/method.schema.json +0 -9
- package/builtin-methods/interf-default/use/query/SKILL.md +5 -5
- package/dist/cli/commands/compile.d.ts +8 -25
- package/dist/cli/commands/compile.js +75 -360
- package/dist/cli/commands/doctor.js +1 -1
- package/dist/cli/commands/login.d.ts +7 -0
- package/dist/cli/commands/login.js +39 -0
- package/dist/cli/commands/logout.d.ts +2 -0
- package/dist/cli/commands/logout.js +16 -0
- package/dist/cli/commands/method.d.ts +2 -0
- package/dist/cli/commands/method.js +113 -0
- package/dist/cli/commands/prep.d.ts +2 -0
- package/dist/cli/commands/prep.js +134 -0
- package/dist/cli/commands/reset.d.ts +8 -1
- package/dist/cli/commands/reset.js +47 -26
- package/dist/cli/commands/runs.d.ts +2 -0
- package/dist/cli/commands/runs.js +120 -0
- package/dist/cli/commands/status.d.ts +6 -1
- package/dist/cli/commands/status.js +68 -111
- package/dist/cli/commands/test.d.ts +6 -14
- package/dist/cli/commands/test.js +65 -181
- package/dist/cli/commands/web.d.ts +0 -9
- package/dist/cli/commands/web.js +147 -120
- package/dist/cli/commands/wizard.d.ts +9 -0
- package/dist/cli/commands/wizard.js +442 -0
- package/dist/cli/index.d.ts +7 -6
- package/dist/cli/index.js +13 -10
- package/dist/compiler-ui/404.html +1 -1
- package/dist/compiler-ui/__next.__PAGE__.txt +2 -2
- package/dist/compiler-ui/__next._full.txt +3 -3
- package/dist/compiler-ui/__next._head.txt +1 -1
- package/dist/compiler-ui/__next._index.txt +2 -2
- package/dist/compiler-ui/__next._tree.txt +2 -2
- package/dist/compiler-ui/_next/static/chunks/{18a8f2jkv3z.c.css → 045gole2ojo3g.css} +1 -1
- package/dist/compiler-ui/_next/static/chunks/{177mvn4rse235.js → 17t-lulmyawg5.js} +9 -9
- package/dist/compiler-ui/_not-found/__next._full.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._head.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._index.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._not-found.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._tree.txt +2 -2
- package/dist/compiler-ui/_not-found.html +1 -1
- package/dist/compiler-ui/_not-found.txt +2 -2
- package/dist/compiler-ui/index.html +1 -1
- package/dist/compiler-ui/index.txt +3 -3
- package/dist/packages/agents/lib/shells.d.ts +1 -1
- package/dist/packages/agents/lib/shells.js +111 -52
- package/dist/packages/agents/lib/user-config.d.ts +4 -2
- package/dist/packages/agents/lib/user-config.js +15 -7
- package/dist/packages/compiler/compiled-paths.d.ts +9 -2
- package/dist/packages/compiler/compiled-paths.js +30 -15
- package/dist/packages/compiler/compiled-pipeline.js +23 -3
- package/dist/packages/compiler/compiled-stage-plan.js +4 -0
- package/dist/packages/compiler/compiled-target.d.ts +1 -1
- package/dist/packages/compiler/compiled-target.js +1 -1
- package/dist/packages/compiler/index.d.ts +1 -0
- package/dist/packages/compiler/index.js +1 -0
- package/dist/packages/compiler/lib/schema.d.ts +26 -31
- package/dist/packages/compiler/lib/schema.js +1 -12
- package/dist/packages/compiler/method-runs.d.ts +2 -3
- package/dist/packages/compiler/method-runs.js +2 -3
- package/dist/packages/compiler/reset.js +3 -1
- package/dist/packages/compiler/runtime-contracts.js +0 -3
- package/dist/packages/compiler/runtime-prompt.js +1 -1
- package/dist/packages/compiler/source-files.d.ts +46 -0
- package/dist/packages/compiler/source-files.js +149 -0
- package/dist/packages/compiler/state-artifacts.d.ts +3 -2
- package/dist/packages/compiler/state-artifacts.js +4 -3
- package/dist/packages/compiler/state-io.d.ts +3 -2
- package/dist/packages/compiler/state-io.js +11 -5
- package/dist/packages/compiler/state-paths.d.ts +2 -1
- package/dist/packages/compiler/state-paths.js +6 -3
- package/dist/packages/compiler/state-view.d.ts +3 -2
- package/dist/packages/compiler/state-view.js +18 -28
- package/dist/packages/compiler/state.d.ts +4 -4
- package/dist/packages/compiler/state.js +3 -3
- package/dist/packages/contracts/index.d.ts +1 -1
- package/dist/packages/contracts/lib/preparation-paths.d.ts +117 -0
- package/dist/packages/contracts/lib/preparation-paths.js +177 -0
- package/dist/packages/contracts/lib/schema.d.ts +85 -5
- package/dist/packages/contracts/lib/schema.js +46 -1
- package/dist/packages/execution/lib/schema.d.ts +50 -50
- package/dist/packages/execution/lib/schema.js +1 -1
- package/dist/packages/local-service/action-definitions.d.ts +14 -14
- package/dist/packages/local-service/action-definitions.js +27 -28
- package/dist/packages/local-service/action-planner.js +2 -1
- package/dist/packages/local-service/client.d.ts +51 -52
- package/dist/packages/local-service/client.js +132 -140
- package/dist/packages/local-service/connection-config.d.ts +38 -0
- package/dist/packages/local-service/connection-config.js +75 -0
- package/dist/packages/local-service/index.d.ts +11 -7
- package/dist/packages/local-service/index.js +6 -4
- package/dist/packages/local-service/instance-paths.d.ts +100 -0
- package/dist/packages/local-service/instance-paths.js +165 -0
- package/dist/packages/local-service/lib/schema.d.ts +405 -2297
- package/dist/packages/local-service/lib/schema.js +146 -62
- package/dist/packages/local-service/native-run-handlers.js +3 -3
- package/dist/packages/local-service/preparation-store.d.ts +92 -0
- package/dist/packages/local-service/preparation-store.js +171 -0
- package/dist/packages/local-service/routes.d.ts +33 -16
- package/dist/packages/local-service/routes.js +44 -20
- package/dist/packages/local-service/run-observability.js +11 -11
- package/dist/packages/local-service/runtime-caches.d.ts +76 -0
- package/dist/packages/local-service/runtime-caches.js +191 -0
- package/dist/packages/local-service/runtime-event-applier.d.ts +12 -0
- package/dist/packages/local-service/runtime-event-applier.js +177 -0
- package/dist/packages/local-service/runtime-persistence.d.ts +47 -0
- package/dist/packages/local-service/runtime-persistence.js +137 -0
- package/dist/packages/local-service/runtime-proposal-helpers.d.ts +35 -0
- package/dist/packages/local-service/runtime-proposal-helpers.js +251 -0
- package/dist/packages/local-service/runtime-resource-builders.d.ts +52 -0
- package/dist/packages/local-service/runtime-resource-builders.js +149 -0
- package/dist/packages/local-service/runtime.d.ts +197 -43
- package/dist/packages/local-service/runtime.js +800 -974
- package/dist/packages/local-service/server.d.ts +15 -0
- package/dist/packages/local-service/server.js +641 -273
- package/dist/packages/local-service/service-registry.d.ts +47 -0
- package/dist/packages/local-service/service-registry.js +137 -0
- package/dist/packages/method-authoring/method-authoring.d.ts +1 -1
- package/dist/packages/method-authoring/method-authoring.js +2 -2
- package/dist/packages/method-authoring/method-improvement.js +1 -1
- package/dist/packages/method-package/builtin-compiled-method.d.ts +4 -5
- package/dist/packages/method-package/builtin-compiled-method.js +8 -14
- package/dist/packages/method-package/context-interface.d.ts +4 -40
- package/dist/packages/method-package/context-interface.js +1 -23
- package/dist/packages/method-package/interf-method-package.d.ts +4 -4
- package/dist/packages/method-package/interf-method-package.js +21 -33
- package/dist/packages/method-package/local-methods.d.ts +10 -6
- package/dist/packages/method-package/local-methods.js +57 -39
- package/dist/packages/method-package/method-definitions.d.ts +8 -34
- package/dist/packages/method-package/method-definitions.js +49 -37
- package/dist/packages/method-package/method-helpers.d.ts +1 -13
- package/dist/packages/method-package/method-helpers.js +8 -42
- package/dist/packages/method-package/method-stage-runner.js +2 -2
- package/dist/packages/method-package/user-methods.d.ts +17 -0
- package/dist/packages/method-package/user-methods.js +77 -0
- package/dist/packages/project-model/index.d.ts +0 -1
- package/dist/packages/project-model/index.js +0 -1
- package/dist/packages/project-model/interf-detect.d.ts +8 -3
- package/dist/packages/project-model/interf-detect.js +34 -34
- package/dist/packages/project-model/interf-scaffold.d.ts +3 -3
- package/dist/packages/project-model/interf-scaffold.js +23 -32
- package/dist/packages/project-model/lib/schema.js +38 -1
- package/dist/packages/project-model/preparation-entries.d.ts +5 -5
- package/dist/packages/project-model/preparation-entries.js +14 -14
- package/dist/packages/project-model/source-config.d.ts +11 -11
- package/dist/packages/project-model/source-config.js +74 -46
- package/dist/packages/project-model/source-folders.d.ts +5 -5
- package/dist/packages/project-model/source-folders.js +14 -14
- package/dist/packages/shared/filesystem.d.ts +7 -0
- package/dist/packages/shared/filesystem.js +97 -10
- package/dist/packages/testing/lib/schema.d.ts +10 -10
- package/dist/packages/testing/lib/schema.js +2 -2
- package/dist/packages/testing/readiness-check-run.d.ts +4 -4
- package/dist/packages/testing/readiness-check-run.js +36 -36
- package/dist/packages/testing/test-execution.js +6 -6
- package/dist/packages/testing/test-paths.js +4 -3
- package/dist/packages/testing/test-sandbox.d.ts +0 -1
- package/dist/packages/testing/test-sandbox.js +14 -30
- package/dist/packages/testing/test-targets.d.ts +1 -1
- package/dist/packages/testing/test-targets.js +6 -6
- package/dist/packages/testing/test.d.ts +1 -1
- package/dist/packages/testing/test.js +1 -1
- package/package.json +3 -4
- package/CHANGELOG.md +0 -93
- package/LICENSE +0 -183
- package/dist/cli/commands/action-input-cli.d.ts +0 -25
- package/dist/cli/commands/action-input-cli.js +0 -73
- package/dist/cli/commands/control-path.d.ts +0 -11
- package/dist/cli/commands/control-path.js +0 -72
- package/dist/cli/commands/create-method-wizard.d.ts +0 -64
- package/dist/cli/commands/create-method-wizard.js +0 -434
- package/dist/cli/commands/create.d.ts +0 -6
- package/dist/cli/commands/create.js +0 -183
- package/dist/cli/commands/default.d.ts +0 -2
- package/dist/cli/commands/default.js +0 -39
- package/dist/cli/commands/executor-flow.d.ts +0 -29
- package/dist/cli/commands/executor-flow.js +0 -163
- package/dist/cli/commands/init.d.ts +0 -26
- package/dist/cli/commands/init.js +0 -771
- package/dist/cli/commands/list.d.ts +0 -2
- package/dist/cli/commands/list.js +0 -30
- package/dist/cli/commands/preparation-action.d.ts +0 -8
- package/dist/cli/commands/preparation-action.js +0 -29
- package/dist/cli/commands/preparation-picker.d.ts +0 -5
- package/dist/cli/commands/preparation-picker.js +0 -36
- package/dist/cli/commands/preparation-selection.d.ts +0 -6
- package/dist/cli/commands/preparation-selection.js +0 -11
- package/dist/cli/commands/service-action-flow.d.ts +0 -9
- package/dist/cli/commands/service-action-flow.js +0 -19
- package/dist/cli/commands/source-config-wizard.d.ts +0 -51
- package/dist/cli/commands/source-config-wizard.js +0 -670
- package/dist/cli/commands/verify.d.ts +0 -2
- package/dist/cli/commands/verify.js +0 -94
- package/dist/packages/compiler/raw-snapshot.d.ts +0 -49
- package/dist/packages/compiler/raw-snapshot.js +0 -101
- package/dist/packages/method-package/index.d.ts +0 -11
- package/dist/packages/method-package/index.js +0 -11
- package/dist/packages/method-package/method-stage-policy.d.ts +0 -5
- package/dist/packages/method-package/method-stage-policy.js +0 -31
- package/dist/packages/project-model/project-paths.d.ts +0 -12
- package/dist/packages/project-model/project-paths.js +0 -33
- /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → C6vVfy3aeYuIO3d2AoNvC}/_buildManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → C6vVfy3aeYuIO3d2AoNvC}/_clientMiddlewareManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → C6vVfy3aeYuIO3d2AoNvC}/_ssgManifest.js +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { cpSync, copyFileSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync, symlinkSync, } from "node:fs";
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
|
-
import { basename, dirname, join, relative } from "node:path";
|
|
3
|
+
import { basename, dirname, join, relative, sep as pathSep } from "node:path";
|
|
4
4
|
import { CHART_APPROXIMATION_NOTES } from "./chart-guidance.js";
|
|
5
|
-
import {
|
|
5
|
+
import { buildCompiledSourceFiles } from "../../compiler/source-files.js";
|
|
6
6
|
import { METHOD_PACKAGE_DIR } from "../../project-model/interf-detect.js";
|
|
7
7
|
import { CONTEXT_INTERFACE_FILE as METHOD_SCHEMA_FILE, contextInterfaceZoneAbsolutePath as compiledZoneAbsolutePath, readContextInterface as readCompiledSchemaFile, resolveContextInterfacePath as resolveMethodSchemaPath, } from "../../method-package/context-interface.js";
|
|
8
|
-
import { stageExecutionShellsRoot, methodImprovementLoopRoot, methodPackagePathForCompiled, compiledInterfConfigPath, compiledRuntimeRoot, } from "../../compiler/compiled-paths.js";
|
|
8
|
+
import { stageExecutionShellsRoot, methodImprovementLoopRoot, methodPackagePathForCompiled, compiledInterfConfigPath, compiledRuntimeRoot, compiledRuntimeSourceSnapshotPath, compiledRuntimeStageInputsPath, } from "../../compiler/compiled-paths.js";
|
|
9
9
|
import { ensureCompiledZoneTargets } from "../../compiler/compiled-schema.js";
|
|
10
10
|
import { listFilesRecursive } from "../../shared/filesystem.js";
|
|
11
11
|
import { resolveMethodImprovementReviewSourcePaths } from "../../method-package/method-review-paths.js";
|
|
@@ -54,12 +54,12 @@ export function renderCompiledAgents(compiledPath, name, methodId, about, option
|
|
|
54
54
|
"",
|
|
55
55
|
"1. Use the local native `interf-query` skill that Interf generated for this portable context.",
|
|
56
56
|
"2. Let the Method docs and declared output zones guide retrieval instead of assuming a fixed note layout.",
|
|
57
|
-
"3. Use `
|
|
57
|
+
"3. Use `.interf/runtime/source-snapshot.json` when you need to inspect the source references behind the output.",
|
|
58
58
|
"",
|
|
59
59
|
"## How this portable context works",
|
|
60
60
|
"",
|
|
61
61
|
"- The Method package defines the context interface this portable context implements on disk.",
|
|
62
|
-
"- `.interf/interf.json`
|
|
62
|
+
"- `.interf/interf.json` records the selected source binding and back-reference to the Interf Workspace.",
|
|
63
63
|
`- Method seed: \`${methodOriginSelected}\`.`,
|
|
64
64
|
...(methodLocalDraft
|
|
65
65
|
? ["- This portable context now carries a local Method draft improved from that seed. Recompiling this portable context reuses the local `.interf/method/` package."]
|
|
@@ -71,36 +71,34 @@ export function renderCompiledAgents(compiledPath, name, methodId, about, option
|
|
|
71
71
|
"- `.interf/method/use/query/` is the editable source for the generated native query shell.",
|
|
72
72
|
"- `.interf/method/compile/stages/` defines stage-specific docs that Interf projects into native execution shells for automated runs.",
|
|
73
73
|
"- Native local query skills are generated under local agent skill directories such as `.claude/skills/` and `.codex/skills/`.",
|
|
74
|
-
"- `
|
|
74
|
+
"- `.interf/runtime/source-snapshot.json` records the source files assigned to the latest runtime snapshot.",
|
|
75
75
|
`- Method zones are declared in \`.interf/method/${METHOD_SCHEMA_FILE}\`.`,
|
|
76
76
|
...zoneLines,
|
|
77
77
|
"- `.interf/runtime/` holds runtime artifacts written by Interf.",
|
|
78
78
|
"- `.interf/tests/` mirrors the latest saved readiness-check run and keeps detailed target runs plus preserved sandboxes.",
|
|
79
|
-
"- `.interf/tests/targets/` holds detailed
|
|
79
|
+
"- `.interf/tests/targets/` holds detailed source-files and compiled target runs plus preserved test sandboxes.",
|
|
80
80
|
"",
|
|
81
81
|
"## Manual query rules",
|
|
82
82
|
"",
|
|
83
|
-
"- Prefer the Method-declared context outputs before
|
|
83
|
+
"- Prefer the Method-declared context outputs before source re-checks.",
|
|
84
84
|
"- Use the generated native `interf-query` skill for manual querying. The editable source lives at `.interf/method/use/query/SKILL.md`.",
|
|
85
85
|
"- Treat `.interf/` as method/runtime metadata, not answer evidence, unless explicitly asked to inspect Method or test history.",
|
|
86
|
-
"- Use `
|
|
87
|
-
"- If exact chart, table, or image-derived evidence matters, inspect the
|
|
86
|
+
"- Use `.interf/runtime/source-snapshot.json` to find source references for quotes, verification, ambiguity, or evidence the portable context does not expose well.",
|
|
87
|
+
"- If exact chart, table, or image-derived evidence matters, inspect the source reference and say whether the answer was text-derived, table-derived, or chart-derived.",
|
|
88
88
|
"",
|
|
89
89
|
"## Commands",
|
|
90
90
|
"",
|
|
91
91
|
"```",
|
|
92
92
|
"interf compile build this portable context",
|
|
93
93
|
"interf test run checks against this portable context",
|
|
94
|
-
"interf verify stage <id> verify one Method stage",
|
|
95
|
-
"interf verify portable-context verify the full portable context output",
|
|
96
94
|
"interf status show deterministic health",
|
|
97
95
|
"```",
|
|
98
96
|
"",
|
|
99
97
|
"## Rules",
|
|
100
98
|
"",
|
|
101
|
-
"- Do not modify files
|
|
99
|
+
"- Do not modify source files while answering from this portable context.",
|
|
102
100
|
"- Treat prepared notes as working context, not final truth.",
|
|
103
|
-
"- When confidence is low, verify against
|
|
101
|
+
"- When confidence is low, verify against the source references before answering strongly.",
|
|
104
102
|
"",
|
|
105
103
|
].join("\n");
|
|
106
104
|
}
|
|
@@ -112,38 +110,38 @@ export function renderCompiledQuerySkill() {
|
|
|
112
110
|
"",
|
|
113
111
|
"Default loop:",
|
|
114
112
|
"1. Read `.interf/method/README.md` and this file first.",
|
|
115
|
-
`2. Use the Method zones declared in \`.interf/method/${METHOD_SCHEMA_FILE}\` before consulting
|
|
116
|
-
"3. Use `
|
|
113
|
+
`2. Use the Method zones declared in \`.interf/method/${METHOD_SCHEMA_FILE}\` before consulting source references.`,
|
|
114
|
+
"3. Use `.interf/runtime/source-snapshot.json` for direct quotes, verification, exact lookups, and cases where the portable context is missing the needed evidence or is ambiguous.",
|
|
117
115
|
"",
|
|
118
116
|
"Answering rule:",
|
|
119
|
-
"- do not modify files
|
|
117
|
+
"- do not modify source files while answering",
|
|
120
118
|
"- treat the Method as the portable-context contract and use its zones as the working retrieval surface",
|
|
121
|
-
"- say explicitly when an answer depends on approximation, bounded inference, or a
|
|
122
|
-
"- use
|
|
119
|
+
"- say explicitly when an answer depends on approximation, bounded inference, or a source re-check",
|
|
120
|
+
"- use source references to confirm source page, metric family, provenance, or exact wording when the portable context is missing the needed evidence or is ambiguous",
|
|
123
121
|
"- do not invent navigation or note structure beyond what this Method declares",
|
|
124
|
-
"- when the portable context is insufficient, verify
|
|
122
|
+
"- when the portable context is insufficient, verify against source references and then answer",
|
|
125
123
|
"",
|
|
126
124
|
"You can edit this file to bias manual question-answering behavior for this portable context.",
|
|
127
125
|
"",
|
|
128
126
|
].join("\n");
|
|
129
127
|
}
|
|
130
|
-
function
|
|
128
|
+
function renderSourceFilesTestAgents() {
|
|
131
129
|
const chartNotes = CHART_APPROXIMATION_NOTES.map((note) => `- ${note}`);
|
|
132
130
|
return [
|
|
133
|
-
"#
|
|
131
|
+
"# Source Files Test Shell",
|
|
134
132
|
"",
|
|
135
|
-
"This is an isolated
|
|
133
|
+
"This is an isolated source-files test shell generated by Interf.",
|
|
136
134
|
"There is no portable context in this shell.",
|
|
137
135
|
"",
|
|
138
136
|
"## How to use this shell",
|
|
139
137
|
"",
|
|
140
138
|
"1. Read this file first.",
|
|
141
139
|
"2. Use the local native `interf-query` skill available in this shell.",
|
|
142
|
-
"3. Read only
|
|
140
|
+
"3. Read `runtime/source-files.json` and use only the listed source references.",
|
|
143
141
|
"",
|
|
144
142
|
"## Rules",
|
|
145
143
|
"",
|
|
146
|
-
"- Answer only from
|
|
144
|
+
"- Answer only from source files listed in `runtime/source-files.json`.",
|
|
147
145
|
"- There is no portable context here, so do not assume any portable-context output zones exist.",
|
|
148
146
|
"- Do not treat hidden runtime files or test artifacts as evidence.",
|
|
149
147
|
...chartNotes,
|
|
@@ -151,23 +149,23 @@ function renderRawTestAgents() {
|
|
|
151
149
|
"",
|
|
152
150
|
].join("\n");
|
|
153
151
|
}
|
|
154
|
-
function
|
|
152
|
+
function renderSourceFilesTestQuerySkill() {
|
|
155
153
|
const chartNotes = CHART_APPROXIMATION_NOTES.map((note, index) => `${index + 3}. ${note}`);
|
|
156
154
|
return [
|
|
157
155
|
"---",
|
|
158
156
|
"name: interf-query",
|
|
159
157
|
"description: >",
|
|
160
|
-
" Native local query skill for an Interf
|
|
161
|
-
" to answer source-files readiness checks
|
|
158
|
+
" Native local query skill for an Interf source-files test shell. Use it only",
|
|
159
|
+
" to answer source-files readiness checks from `runtime/source-files.json` references.",
|
|
162
160
|
"---",
|
|
163
161
|
"",
|
|
164
|
-
"# Interf
|
|
162
|
+
"# Interf Source Files Test Query",
|
|
165
163
|
"",
|
|
166
|
-
"This is the native local query skill for an isolated
|
|
164
|
+
"This is the native local query skill for an isolated source-files test shell.",
|
|
167
165
|
"",
|
|
168
166
|
"Loop:",
|
|
169
|
-
"1. Read `
|
|
170
|
-
"2. Verify exact claims against the
|
|
167
|
+
"1. Read `runtime/source-files.json`.",
|
|
168
|
+
"2. Verify exact claims against the listed source locators before answering strongly.",
|
|
171
169
|
...chartNotes,
|
|
172
170
|
"8. Do not rely on portable-context artifacts because they do not exist in this shell.",
|
|
173
171
|
"",
|
|
@@ -225,6 +223,11 @@ function linkPath(targetPath, linkPathname) {
|
|
|
225
223
|
mkdirSync(dirname(linkPathname), { recursive: true });
|
|
226
224
|
symlinkSync(targetPath, linkPathname);
|
|
227
225
|
}
|
|
226
|
+
function linkIfExists(targetPath, linkPathname) {
|
|
227
|
+
if (!existsSync(targetPath))
|
|
228
|
+
return;
|
|
229
|
+
linkPath(targetPath, linkPathname);
|
|
230
|
+
}
|
|
228
231
|
function linkRelativePath(targetPath, linkPathname) {
|
|
229
232
|
mkdirSync(dirname(linkPathname), { recursive: true });
|
|
230
233
|
symlinkSync(relative(dirname(linkPathname), targetPath), linkPathname);
|
|
@@ -322,15 +325,18 @@ function renderStageExecutionAgents(compiledName, methodId, stage) {
|
|
|
322
325
|
"## Start Here",
|
|
323
326
|
"",
|
|
324
327
|
"1. Read `runtime/stage-contract.json` now.",
|
|
325
|
-
"2. Read `runtime/
|
|
326
|
-
"3.
|
|
327
|
-
|
|
328
|
+
"2. Read `runtime/source-snapshot.json` and `runtime/stage-inputs.json` now.",
|
|
329
|
+
"3. Read `runtime/paths.json` now.",
|
|
330
|
+
"4. Use the local native `interf-stage` skill now.",
|
|
331
|
+
`5. Execute only the current stage: \`${stage.id}\` (${stage.label}).`,
|
|
328
332
|
"",
|
|
329
333
|
"## Shell ABI",
|
|
330
334
|
"",
|
|
331
335
|
"- `inputs/<zone-id>/` = read mounts for the current stage.",
|
|
332
336
|
"- `outputs/<zone-id>/` = write mounts for the current stage.",
|
|
333
337
|
"- For file zones, `runtime/paths.json` points to the exact file path inside those mount roots.",
|
|
338
|
+
"- `runtime/source-snapshot.json` = source references captured for this run.",
|
|
339
|
+
"- `runtime/stage-inputs.json` = exact source references assigned to this stage.",
|
|
334
340
|
"- declared compiled zone paths are also projected at the shell root so Method-relative contract paths stay valid.",
|
|
335
341
|
"- `runtime/` = stage contract and machine-readable path map for this shell.",
|
|
336
342
|
"- `method/` = Method metadata, `method.schema.json`, and docs for the current stage only.",
|
|
@@ -371,7 +377,8 @@ function renderStageExecutionSkill(stage, stageMethodDoc) {
|
|
|
371
377
|
"",
|
|
372
378
|
"This local native skill exists for automated Interf stage execution.",
|
|
373
379
|
"Read `runtime/stage-contract.json` first.",
|
|
374
|
-
"Then read `runtime/
|
|
380
|
+
"Then read `runtime/source-snapshot.json`, `runtime/stage-inputs.json`, and `runtime/paths.json`.",
|
|
381
|
+
"Use the assigned source references and the mounted `inputs/` and `outputs/` zones for this stage.",
|
|
375
382
|
"Do not switch into manual query mode.",
|
|
376
383
|
"",
|
|
377
384
|
"## Current Stage",
|
|
@@ -399,7 +406,7 @@ function renderCompiledQueryNativeSkill(querySkillContent) {
|
|
|
399
406
|
"name: interf-query",
|
|
400
407
|
"description: >",
|
|
401
408
|
" Native local query skill for this portable context built by Interf.",
|
|
402
|
-
" Use it for manual questions against the portable context and source
|
|
409
|
+
" Use it for manual questions against the portable context and source references.",
|
|
403
410
|
"---",
|
|
404
411
|
"",
|
|
405
412
|
"# Interf Query",
|
|
@@ -568,6 +575,44 @@ function shouldSkipFrozenStageShellRelativePath(relativePath) {
|
|
|
568
575
|
normalized.endsWith("/improvement-loops") ||
|
|
569
576
|
normalized.includes("/improvement-loops/");
|
|
570
577
|
}
|
|
578
|
+
/**
|
|
579
|
+
* System path prefixes a malicious symlink in a Method package must
|
|
580
|
+
* never reach. Without this, the freeze-snapshot logic could be
|
|
581
|
+
* tricked into copying anything the running user has access to —
|
|
582
|
+
* `/etc/passwd`, `~/.ssh/id_rsa`, etc. (CSO finding).
|
|
583
|
+
*
|
|
584
|
+
* We deliberately allow targets that escape the immediate freeze
|
|
585
|
+
* root: legitimate execution shells contain symlinks pointing back
|
|
586
|
+
* to the parent workspace's `interf.json`. The threat is only links
|
|
587
|
+
* that resolve into truly system-level paths.
|
|
588
|
+
*/
|
|
589
|
+
const FORBIDDEN_SYMLINK_TARGET_PREFIXES = [
|
|
590
|
+
"/etc",
|
|
591
|
+
"/sys",
|
|
592
|
+
"/proc",
|
|
593
|
+
"/dev",
|
|
594
|
+
"/var/run",
|
|
595
|
+
"/var/lib",
|
|
596
|
+
"/usr",
|
|
597
|
+
"/bin",
|
|
598
|
+
"/sbin",
|
|
599
|
+
"/boot",
|
|
600
|
+
"/root",
|
|
601
|
+
];
|
|
602
|
+
function ensureSymlinkTargetSafe(realTarget, symlinkPath) {
|
|
603
|
+
for (const prefix of FORBIDDEN_SYMLINK_TARGET_PREFIXES) {
|
|
604
|
+
if (realTarget === prefix || realTarget.startsWith(`${prefix}${pathSep}`)) {
|
|
605
|
+
throw new Error(`Refusing to follow symlink ${symlinkPath} → ${realTarget}: ` +
|
|
606
|
+
`resolves into system directory ${prefix}.`);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
// Also refuse links that escape into another user's SSH directory
|
|
610
|
+
// even if the path is not on the literal forbidden list.
|
|
611
|
+
if (/\/\.ssh(\/|$)/.test(realTarget)) {
|
|
612
|
+
throw new Error(`Refusing to follow symlink ${symlinkPath} → ${realTarget}: ` +
|
|
613
|
+
`targets a .ssh directory.`);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
571
616
|
function copyResolvedTree(options) {
|
|
572
617
|
const relativePath = options.relativePath ?? "";
|
|
573
618
|
if (options.shellType === "stage-execution" && shouldSkipFrozenStageShellRelativePath(relativePath)) {
|
|
@@ -575,7 +620,24 @@ function copyResolvedTree(options) {
|
|
|
575
620
|
}
|
|
576
621
|
const stat = lstatSync(options.sourcePath);
|
|
577
622
|
if (stat.isSymbolicLink()) {
|
|
623
|
+
// existsSync follows symlinks, so a dangling link (target absent)
|
|
624
|
+
// returns false. Skip those entries: realpathSync would throw
|
|
625
|
+
// ENOENT, and the freeze step is best-effort review material —
|
|
626
|
+
// losing one unresolvable link is better than aborting the whole
|
|
627
|
+
// snapshot. Production trigger: createStageExecutionShell links
|
|
628
|
+
// runtime/stage-contract.json before writeStageContract runs, so
|
|
629
|
+
// any failure between those two points leaves a dangling link
|
|
630
|
+
// that the per-stage finally-block freeze would otherwise hit.
|
|
631
|
+
if (!existsSync(options.sourcePath)) {
|
|
632
|
+
return { materializedSymlinks: 0 };
|
|
633
|
+
}
|
|
578
634
|
const realTarget = realpathSync(options.sourcePath);
|
|
635
|
+
// Refuse symlinks resolving into system paths (CSO finding). We
|
|
636
|
+
// deliberately allow links that escape the immediate freeze root
|
|
637
|
+
// because legitimate execution shells contain links back to the
|
|
638
|
+
// parent workspace's interf.json — the only thing we care about
|
|
639
|
+
// is that the realpath does not land in /etc, /sys, /proc, etc.
|
|
640
|
+
ensureSymlinkTargetSafe(realTarget, options.sourcePath);
|
|
579
641
|
const realStat = statSync(realTarget);
|
|
580
642
|
if (realStat.isDirectory()) {
|
|
581
643
|
const mappedTarget = options.materializedRealPaths?.get(realTarget);
|
|
@@ -672,7 +734,7 @@ function renderMethodAuthoringAgents(options) {
|
|
|
672
734
|
"",
|
|
673
735
|
"1. Read `runtime/authoring-context.json` now.",
|
|
674
736
|
`2. Read \`method/README.md\`, \`method/method.json\`, and \`method/${METHOD_SCHEMA_FILE}\` now.`,
|
|
675
|
-
"3.
|
|
737
|
+
"3. Read `runtime/source-files.json` and review the listed source locators.",
|
|
676
738
|
"4. Use the local native `interf-method-author` skill now.",
|
|
677
739
|
"",
|
|
678
740
|
"## Boundaries",
|
|
@@ -712,7 +774,7 @@ function renderMethodAuthoringSkill() {
|
|
|
712
774
|
"# Interf Method Authoring",
|
|
713
775
|
"",
|
|
714
776
|
"Read `runtime/authoring-context.json` first.",
|
|
715
|
-
"Then review the neutral Method package scaffold under `method
|
|
777
|
+
"Then review the neutral Method package scaffold under `method/`, read `runtime/source-files.json`, and inspect the listed source locators when needed.",
|
|
716
778
|
"",
|
|
717
779
|
"Rules:",
|
|
718
780
|
"- edit only `method/`",
|
|
@@ -762,14 +824,7 @@ export function createMethodAuthoringShell(options) {
|
|
|
762
824
|
},
|
|
763
825
|
};
|
|
764
826
|
writeFileSync(join(shellRoot, "runtime", "authoring-context.json"), `${JSON.stringify(context, null, 2)}\n`);
|
|
765
|
-
|
|
766
|
-
sourcePath: options.sourceFolderPath,
|
|
767
|
-
destinationPath: join(shellRoot, "artifacts", "source-folder", "raw"),
|
|
768
|
-
compiledPath: shellRoot,
|
|
769
|
-
mode: "copy",
|
|
770
|
-
prune: true,
|
|
771
|
-
preserveTimestamps: true,
|
|
772
|
-
});
|
|
827
|
+
writeFileSync(join(shellRoot, "runtime", "source-files.json"), `${JSON.stringify(buildCompiledSourceFiles(shellRoot, options.sourceFolderPath), null, 2)}\n`);
|
|
773
828
|
copyResolvedTree({
|
|
774
829
|
sourcePath: options.methodPath,
|
|
775
830
|
targetPath: join(shellRoot, "method"),
|
|
@@ -808,7 +863,7 @@ function renderMethodImprovementAgents(compiledName, methodId, loopIndex) {
|
|
|
808
863
|
`- Method: \`${methodId}\`.`,
|
|
809
864
|
`- Improvement loop: ${loopIndex}.`,
|
|
810
865
|
"- Edit only files under `method/`.",
|
|
811
|
-
"- Do not edit checks, test specs,
|
|
866
|
+
"- Do not edit checks, test specs, source files, or generated context outputs.",
|
|
812
867
|
"- Review context outputs under `artifacts/compiled-view/` and test/runtime evidence under `artifacts/`.",
|
|
813
868
|
"- Keep the Method package valid for the current compiler API and `method.schema.json`.",
|
|
814
869
|
"- For acceptance criteria, use `zone_counts_at_least` for numeric fixed minimums and `zone_counts_at_least_counts` only for runtime count-key strings such as `source_total`.",
|
|
@@ -862,7 +917,7 @@ function projectCompiledReviewArtifactsSnapshot(compiledPath, shellRoot, schema)
|
|
|
862
917
|
const compiledViewRoot = join(shellRoot, "artifacts", "compiled-view");
|
|
863
918
|
mkdirSync(compiledViewRoot, { recursive: true });
|
|
864
919
|
for (const zone of schema.zones) {
|
|
865
|
-
if (zone.kind === "runtime" || zone.path === "
|
|
920
|
+
if (zone.kind === "runtime" || zone.path === "source-files")
|
|
866
921
|
continue;
|
|
867
922
|
const sourcePath = compiledZoneAbsolutePath(compiledPath, zone);
|
|
868
923
|
if (!existsSync(sourcePath))
|
|
@@ -893,7 +948,9 @@ function projectCompiledRuntimeArtifacts(compiledPath, shellRoot) {
|
|
|
893
948
|
"state.json",
|
|
894
949
|
"health.json",
|
|
895
950
|
"view-spec.json",
|
|
896
|
-
"
|
|
951
|
+
"source-files.json",
|
|
952
|
+
"source-snapshot.json",
|
|
953
|
+
"stages",
|
|
897
954
|
"logs",
|
|
898
955
|
];
|
|
899
956
|
for (const artifactName of artifactNames) {
|
|
@@ -908,8 +965,8 @@ export function projectCompiledQueryShell(compiledPath, compiledName, methodId,
|
|
|
908
965
|
const querySkillContent = readCompiledQuerySkillSource(compiledPath);
|
|
909
966
|
return writeNativeAgentSurface(compiledPath, agentsContent, "interf-query", renderCompiledQueryNativeSkill(querySkillContent));
|
|
910
967
|
}
|
|
911
|
-
export function
|
|
912
|
-
return writeNativeAgentSurface(rootPath,
|
|
968
|
+
export function projectSourceFilesTestQueryShell(rootPath) {
|
|
969
|
+
return writeNativeAgentSurface(rootPath, renderSourceFilesTestAgents(), "interf-query", renderSourceFilesTestQuerySkill());
|
|
913
970
|
}
|
|
914
971
|
export function createStageExecutionShell(compiledPath, compiledName, methodId, stage, writeArtifacts = []) {
|
|
915
972
|
const schema = ensureCompiledExecutionSurface(compiledPath);
|
|
@@ -922,6 +979,8 @@ export function createStageExecutionShell(compiledPath, compiledName, methodId,
|
|
|
922
979
|
mkdirSync(join(shellRoot, "outputs"), { recursive: true });
|
|
923
980
|
linkPath(compiledInterfConfigPath(compiledPath), join(shellRoot, "interf.json"));
|
|
924
981
|
linkPath(join(compiledRuntimeRoot(compiledPath), "stage-contract.json"), shellRuntimePath(shellRoot, "stage-contract.json"));
|
|
982
|
+
linkIfExists(compiledRuntimeSourceSnapshotPath(compiledPath), shellRuntimePath(shellRoot, "source-snapshot.json"));
|
|
983
|
+
linkIfExists(compiledRuntimeStageInputsPath(compiledPath, stage.id), shellRuntimePath(shellRoot, "stage-inputs.json"));
|
|
925
984
|
projectCompiledSchemaZones(compiledPath, shellRoot, schema, new Set([...stage.reads, ...stage.writes]), materializedZones);
|
|
926
985
|
projectMethodMetadata(compiledPath, shellRoot, stage);
|
|
927
986
|
projectStageZoneMountAliases(shellRoot, stage, schema);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type InterfUserConfig } from "./schema.js";
|
|
2
2
|
export type { InterfUserConfig } from "./schema.js";
|
|
3
|
-
|
|
4
|
-
export declare
|
|
3
|
+
/** `~/.interf/` (overridable via `INTERF_USER_HOME`). */
|
|
4
|
+
export declare function interfHome(): string;
|
|
5
|
+
/** `~/.interf/config.json` — local executor preferences. */
|
|
6
|
+
export declare function userConfigPath(): string;
|
|
5
7
|
export declare function loadUserConfig(): InterfUserConfig | null;
|
|
6
8
|
export declare function saveUserConfig(config: InterfUserConfig): void;
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
2
|
import { join } from "node:path";
|
|
4
3
|
import { readJsonFileWithSchema } from "../../shared/parse.js";
|
|
4
|
+
import { interfHomeRoot } from "../../contracts/lib/preparation-paths.js";
|
|
5
5
|
import { InterfUserConfigSchema } from "./schema.js";
|
|
6
|
-
|
|
7
|
-
export
|
|
6
|
+
/** `~/.interf/` (overridable via `INTERF_USER_HOME`). */
|
|
7
|
+
export function interfHome() {
|
|
8
|
+
return interfHomeRoot();
|
|
9
|
+
}
|
|
10
|
+
/** `~/.interf/config.json` — local executor preferences. */
|
|
11
|
+
export function userConfigPath() {
|
|
12
|
+
return join(interfHome(), "config.json");
|
|
13
|
+
}
|
|
8
14
|
export function loadUserConfig() {
|
|
9
|
-
|
|
15
|
+
const configPath = userConfigPath();
|
|
16
|
+
if (!existsSync(configPath))
|
|
10
17
|
return null;
|
|
11
|
-
return readJsonFileWithSchema(
|
|
18
|
+
return readJsonFileWithSchema(configPath, "user config", InterfUserConfigSchema);
|
|
12
19
|
}
|
|
13
20
|
export function saveUserConfig(config) {
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
const home = interfHome();
|
|
22
|
+
mkdirSync(home, { recursive: true });
|
|
23
|
+
writeFileSync(userConfigPath(), JSON.stringify(config, null, 2) + "\n");
|
|
16
24
|
}
|
|
@@ -7,7 +7,10 @@ export declare const COMPILED_RUNTIME_DIR = "runtime";
|
|
|
7
7
|
export declare const COMPILED_RUNTIME_STATE_FILE = "state.json";
|
|
8
8
|
export declare const COMPILED_RUNTIME_HEALTH_FILE = "health.json";
|
|
9
9
|
export declare const COMPILED_RUNTIME_VIEW_SPEC_FILE = "view-spec.json";
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const COMPILED_RUNTIME_SOURCE_FILES_FILE = "source-files.json";
|
|
11
|
+
export declare const COMPILED_RUNTIME_SOURCE_SNAPSHOT_FILE = "source-snapshot.json";
|
|
12
|
+
export declare const COMPILED_RUNTIME_STAGE_INPUTS_DIR = "stages";
|
|
13
|
+
export declare const COMPILED_RUNTIME_STAGE_INPUTS_FILE = "inputs.json";
|
|
11
14
|
export declare const COMPILED_RUNTIME_INVENTORY_FILE = "inventory.json";
|
|
12
15
|
export declare const COMPILED_RUNTIME_RUN_FILE = "run.json";
|
|
13
16
|
export declare const COMPILED_RUNTIME_RUN_HISTORY_FILE = "run-history.jsonl";
|
|
@@ -31,7 +34,11 @@ export declare function compiledQueryAcceptanceRoot(compiledPath: string): strin
|
|
|
31
34
|
export declare function compiledRuntimeStatePath(compiledPath: string): string;
|
|
32
35
|
export declare function compiledRuntimeHealthPath(compiledPath: string): string;
|
|
33
36
|
export declare function compiledRuntimeViewSpecPath(compiledPath: string): string;
|
|
34
|
-
export declare function
|
|
37
|
+
export declare function compiledRuntimeSourceFilesPath(compiledPath: string): string;
|
|
38
|
+
export declare function compiledRuntimeSourceSnapshotPath(compiledPath: string): string;
|
|
39
|
+
export declare function compiledRuntimeStagesRoot(compiledPath: string): string;
|
|
40
|
+
export declare function compiledRuntimeStageRoot(compiledPath: string, stageId: string): string;
|
|
41
|
+
export declare function compiledRuntimeStageInputsPath(compiledPath: string, stageId: string): string;
|
|
35
42
|
export declare function compiledRuntimeInventoryPath(compiledPath: string): string;
|
|
36
43
|
export declare function compiledRuntimeRunPath(compiledPath: string): string;
|
|
37
44
|
export declare function compiledRuntimeRunHistoryPath(compiledPath: string): string;
|
|
@@ -8,7 +8,10 @@ export const COMPILED_RUNTIME_DIR = "runtime";
|
|
|
8
8
|
export const COMPILED_RUNTIME_STATE_FILE = "state.json";
|
|
9
9
|
export const COMPILED_RUNTIME_HEALTH_FILE = "health.json";
|
|
10
10
|
export const COMPILED_RUNTIME_VIEW_SPEC_FILE = "view-spec.json";
|
|
11
|
-
export const
|
|
11
|
+
export const COMPILED_RUNTIME_SOURCE_FILES_FILE = "source-files.json";
|
|
12
|
+
export const COMPILED_RUNTIME_SOURCE_SNAPSHOT_FILE = "source-snapshot.json";
|
|
13
|
+
export const COMPILED_RUNTIME_STAGE_INPUTS_DIR = "stages";
|
|
14
|
+
export const COMPILED_RUNTIME_STAGE_INPUTS_FILE = "inputs.json";
|
|
12
15
|
export const COMPILED_RUNTIME_INVENTORY_FILE = "inventory.json";
|
|
13
16
|
export const COMPILED_RUNTIME_RUN_FILE = "run.json";
|
|
14
17
|
export const COMPILED_RUNTIME_RUN_HISTORY_FILE = "run-history.jsonl";
|
|
@@ -70,8 +73,20 @@ export function compiledRuntimeHealthPath(compiledPath) {
|
|
|
70
73
|
export function compiledRuntimeViewSpecPath(compiledPath) {
|
|
71
74
|
return compiledRuntimeFilePath(compiledPath, COMPILED_RUNTIME_VIEW_SPEC_FILE);
|
|
72
75
|
}
|
|
73
|
-
export function
|
|
74
|
-
return compiledRuntimeFilePath(compiledPath,
|
|
76
|
+
export function compiledRuntimeSourceFilesPath(compiledPath) {
|
|
77
|
+
return compiledRuntimeFilePath(compiledPath, COMPILED_RUNTIME_SOURCE_FILES_FILE);
|
|
78
|
+
}
|
|
79
|
+
export function compiledRuntimeSourceSnapshotPath(compiledPath) {
|
|
80
|
+
return compiledRuntimeFilePath(compiledPath, COMPILED_RUNTIME_SOURCE_SNAPSHOT_FILE);
|
|
81
|
+
}
|
|
82
|
+
export function compiledRuntimeStagesRoot(compiledPath) {
|
|
83
|
+
return join(compiledRuntimeRoot(compiledPath), COMPILED_RUNTIME_STAGE_INPUTS_DIR);
|
|
84
|
+
}
|
|
85
|
+
export function compiledRuntimeStageRoot(compiledPath, stageId) {
|
|
86
|
+
return join(compiledRuntimeStagesRoot(compiledPath), stageId);
|
|
87
|
+
}
|
|
88
|
+
export function compiledRuntimeStageInputsPath(compiledPath, stageId) {
|
|
89
|
+
return join(compiledRuntimeStageRoot(compiledPath, stageId), COMPILED_RUNTIME_STAGE_INPUTS_FILE);
|
|
75
90
|
}
|
|
76
91
|
export function compiledRuntimeInventoryPath(compiledPath) {
|
|
77
92
|
return compiledRuntimeFilePath(compiledPath, COMPILED_RUNTIME_INVENTORY_FILE);
|
|
@@ -86,19 +101,19 @@ export function compiledRuntimeStageContractPath(compiledPath) {
|
|
|
86
101
|
return compiledRuntimeFilePath(compiledPath, COMPILED_RUNTIME_STAGE_CONTRACT_FILE);
|
|
87
102
|
}
|
|
88
103
|
export function resolveSourceControlPathForCompiled(compiledPath) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
// Flat workspace layout: the portable context lives at
|
|
105
|
+
// `<workspace>/<preparation>/`, so the workspace root is the parent of the
|
|
106
|
+
// portable context. Reject the filesystem root (which has no parent) and the
|
|
107
|
+
// legacy `<workspace>/interf/<preparation>/` shape so stale fixtures fail loudly.
|
|
108
|
+
const compiledAbsolute = resolve(compiledPath);
|
|
109
|
+
const parent = dirname(compiledAbsolute);
|
|
110
|
+
if (parent === compiledAbsolute) {
|
|
111
|
+
throw new Error(`Portable context is not under the canonical Interf Workspace layout: ${compiledPath}`);
|
|
112
|
+
}
|
|
113
|
+
if (basename(parent) === "interf") {
|
|
114
|
+
throw new Error(`Portable context is not under the canonical Interf Workspace layout: ${compiledPath}`);
|
|
100
115
|
}
|
|
101
|
-
|
|
116
|
+
return parent;
|
|
102
117
|
}
|
|
103
118
|
export function defaultControlPathForCompiled(compiledPath) {
|
|
104
119
|
const relativePath = relative(compiledPath, resolveSourceControlPathForCompiled(compiledPath));
|
|
@@ -4,12 +4,12 @@ import { reportValidationFailure, } from "../method-package/method-helpers.js";
|
|
|
4
4
|
import { validateCompiledMethod, } from "./validate.js";
|
|
5
5
|
import { pruneStageExecutionShells, } from "../agents/lib/shells.js";
|
|
6
6
|
import { resetCompiledGeneratedState } from "./reset.js";
|
|
7
|
-
import { syncCompiledRawSnapshot } from "./raw-snapshot.js";
|
|
8
7
|
import { compiledExecutionStages, resolveCompiledContext, } from "./compiled-target.js";
|
|
9
8
|
import { discoverSourceFiles } from "./discovery.js";
|
|
10
9
|
import { runCompiledStage } from "./compiled-stage-runner.js";
|
|
11
10
|
import { resolveSourceInputPath } from "../project-model/interf-detect.js";
|
|
12
11
|
import { methodPackagePathForCompiled } from "./compiled-paths.js";
|
|
12
|
+
import { writeCompiledSourceRuntime } from "./source-files.js";
|
|
13
13
|
export async function runCompiledSummarize(options) {
|
|
14
14
|
const context = resolveCompiledContext(options.compiledPath);
|
|
15
15
|
const stageDefinition = options.stageDefinition
|
|
@@ -23,6 +23,13 @@ export async function runCompiledSummarize(options) {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
const sourceCount = discoverSourceFiles(context.sourcePath, options.compiledPath).totalCount;
|
|
26
|
+
writeCompiledSourceRuntime({
|
|
27
|
+
compiledPath: options.compiledPath,
|
|
28
|
+
methodId: context.methodId,
|
|
29
|
+
stageIds: [stageDefinition.id],
|
|
30
|
+
sourcePath: context.sourcePath,
|
|
31
|
+
runId: options.runId ?? null,
|
|
32
|
+
});
|
|
26
33
|
const result = await runCompiledStage({
|
|
27
34
|
executor: options.executor,
|
|
28
35
|
compiledPath: options.compiledPath,
|
|
@@ -50,6 +57,13 @@ export async function runCompiledCompile(options) {
|
|
|
50
57
|
try {
|
|
51
58
|
const context = resolveCompiledContext(options.compiledPath);
|
|
52
59
|
const stages = compiledExecutionStages(context.methodId, options.compiledPath);
|
|
60
|
+
writeCompiledSourceRuntime({
|
|
61
|
+
compiledPath: options.compiledPath,
|
|
62
|
+
methodId: context.methodId,
|
|
63
|
+
stageIds: stages.map((stage) => stage.id),
|
|
64
|
+
sourcePath: context.sourcePath,
|
|
65
|
+
runId: options.runId ?? null,
|
|
66
|
+
});
|
|
53
67
|
for (const [index, stageDefinition] of stages.entries()) {
|
|
54
68
|
const result = await runCompiledStage({
|
|
55
69
|
executor: options.executor,
|
|
@@ -86,8 +100,6 @@ export async function compileCompiled(options) {
|
|
|
86
100
|
failedStage: null,
|
|
87
101
|
};
|
|
88
102
|
try {
|
|
89
|
-
const sourceInputPath = resolveSourceInputPath(options.compiledPath);
|
|
90
|
-
syncCompiledRawSnapshot(options.compiledPath, sourceInputPath);
|
|
91
103
|
refreshCompiledBootstrapGuidance(options.compiledPath);
|
|
92
104
|
const methodValidation = validateMethodPackage(methodPackagePathForCompiled(options.compiledPath));
|
|
93
105
|
if (!methodValidation.ok) {
|
|
@@ -107,7 +119,15 @@ export async function compileCompiled(options) {
|
|
|
107
119
|
};
|
|
108
120
|
}
|
|
109
121
|
const context = resolveCompiledContext(options.compiledPath);
|
|
122
|
+
const sourceInputPath = resolveSourceInputPath(options.compiledPath);
|
|
110
123
|
const stages = compiledExecutionStages(context.methodId, options.compiledPath);
|
|
124
|
+
writeCompiledSourceRuntime({
|
|
125
|
+
compiledPath: options.compiledPath,
|
|
126
|
+
methodId: context.methodId,
|
|
127
|
+
stageIds: stages.map((stage) => stage.id),
|
|
128
|
+
sourcePath: sourceInputPath,
|
|
129
|
+
runId: options.runId ?? null,
|
|
130
|
+
});
|
|
111
131
|
for (const [index, stageDefinition] of stages.entries()) {
|
|
112
132
|
const stageResult = await runCompiledStage({
|
|
113
133
|
executor: options.executor,
|
|
@@ -59,6 +59,10 @@ export function buildStageContract(compiledPath, stageDefinition, instructions)
|
|
|
59
59
|
stageId: stageDefinition.id,
|
|
60
60
|
stageLabel: stageDefinition.label,
|
|
61
61
|
counts: buildStageCounts(compiledPath, stageDefinition),
|
|
62
|
+
extraReadArtifacts: [
|
|
63
|
+
".interf/runtime/source-snapshot.json",
|
|
64
|
+
`.interf/runtime/stages/${stageDefinition.id}/inputs.json`,
|
|
65
|
+
],
|
|
62
66
|
stageReadArtifacts: stageArtifacts.reads,
|
|
63
67
|
stageWriteArtifacts: stageArtifacts.writes,
|
|
64
68
|
methodNotes: getActiveCompiledStagePolicyNotes(compiledPath, stageDefinition.id),
|
|
@@ -5,7 +5,7 @@ export interface CompiledStageExecutionDefinition extends MethodStageDefinition
|
|
|
5
5
|
export declare function resolveCompiledContext(compiledPath: string): {
|
|
6
6
|
compiledName: string;
|
|
7
7
|
sourcePath: string;
|
|
8
|
-
|
|
8
|
+
prepDataDir: string;
|
|
9
9
|
methodId: CompiledMethodId;
|
|
10
10
|
};
|
|
11
11
|
export declare function compiledExecutionStages(_methodId: CompiledMethodId, compiledPath: string): CompiledStageExecutionDefinition[];
|
|
@@ -6,7 +6,7 @@ export function resolveCompiledContext(compiledPath) {
|
|
|
6
6
|
return {
|
|
7
7
|
compiledName: config?.name ?? "compiled",
|
|
8
8
|
sourcePath: resolveSourceFolderPath(compiledPath, config),
|
|
9
|
-
|
|
9
|
+
prepDataDir: resolveSourceControlPath(compiledPath),
|
|
10
10
|
methodId,
|
|
11
11
|
};
|
|
12
12
|
}
|
|
@@ -11,6 +11,7 @@ export * as runtimePrompt from "./runtime-prompt.js";
|
|
|
11
11
|
export * as runtimeReconcile from "./runtime-reconcile.js";
|
|
12
12
|
export * as runtimeRuns from "./runtime-runs.js";
|
|
13
13
|
export * as runtimeTypes from "./runtime-types.js";
|
|
14
|
+
export * as sourceFiles from "./source-files.js";
|
|
14
15
|
export * as state from "./state.js";
|
|
15
16
|
export * as stateArtifacts from "./state-artifacts.js";
|
|
16
17
|
export * as stateHealth from "./state-health.js";
|
|
@@ -11,6 +11,7 @@ export * as runtimePrompt from "./runtime-prompt.js";
|
|
|
11
11
|
export * as runtimeReconcile from "./runtime-reconcile.js";
|
|
12
12
|
export * as runtimeRuns from "./runtime-runs.js";
|
|
13
13
|
export * as runtimeTypes from "./runtime-types.js";
|
|
14
|
+
export * as sourceFiles from "./source-files.js";
|
|
14
15
|
export * as state from "./state.js";
|
|
15
16
|
export * as stateArtifacts from "./state-artifacts.js";
|
|
16
17
|
export * as stateHealth from "./state-health.js";
|