@interf/compiler 0.9.1 → 0.9.3
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 +9 -9
- package/agent-skills/interf-actions/SKILL.md +3 -0
- package/agent-skills/interf-actions/references/cli.md +13 -13
- package/{builtin-workflows/interf → builtin-methods/interf-default}/README.md +2 -2
- package/builtin-methods/interf-default/improve/SKILL.md +18 -0
- package/{builtin-workflows/interf/workflow.json → builtin-methods/interf-default/method.json} +4 -4
- package/{builtin-workflows/interf/workflow.schema.json → builtin-methods/interf-default/method.schema.json} +2 -2
- package/dist/cli/commands/check-draft.d.ts +6 -6
- package/dist/cli/commands/check-draft.js +5 -5
- package/dist/cli/commands/compile-controller.d.ts +7 -7
- package/dist/cli/commands/compile-controller.js +35 -38
- package/dist/cli/commands/compile.d.ts +3 -3
- package/dist/cli/commands/compile.js +23 -21
- package/dist/cli/commands/compiled-flow.d.ts +11 -11
- package/dist/cli/commands/compiled-flow.js +33 -30
- package/dist/cli/commands/create-method-wizard.d.ts +76 -0
- package/dist/cli/commands/{create-workflow-wizard.js → create-method-wizard.js} +153 -163
- package/dist/cli/commands/create.d.ts +3 -3
- package/dist/cli/commands/create.js +44 -45
- package/dist/cli/commands/default.js +1 -1
- package/dist/cli/commands/executor-flow.d.ts +6 -6
- package/dist/cli/commands/executor-flow.js +1 -1
- package/dist/cli/commands/init.d.ts +2 -2
- package/dist/cli/commands/init.js +139 -118
- package/dist/cli/commands/list.js +11 -10
- package/dist/cli/commands/preparation-selection.d.ts +3 -3
- package/dist/cli/commands/source-config-wizard.d.ts +9 -9
- package/dist/cli/commands/source-config-wizard.js +43 -43
- package/dist/cli/commands/status.js +36 -9
- package/dist/cli/commands/test-flow.d.ts +15 -15
- package/dist/cli/commands/test-flow.js +29 -219
- package/dist/cli/commands/test.d.ts +2 -2
- package/dist/cli/commands/test.js +50 -51
- package/dist/cli/commands/verify.js +7 -7
- package/dist/cli/commands/web.js +41 -28
- package/dist/compiler-ui/404.html +1 -0
- package/dist/compiler-ui/__next.__PAGE__.txt +10 -0
- package/dist/compiler-ui/__next._full.txt +20 -0
- package/dist/compiler-ui/__next._head.txt +5 -0
- package/dist/compiler-ui/__next._index.txt +5 -0
- package/dist/compiler-ui/__next._tree.txt +5 -0
- package/dist/compiler-ui/_next/static/chunks/06yhdspx~ca5-.js +5 -0
- package/{apps/compiler-ui/.next/static/chunks/13g~4mamjft.c.css → dist/compiler-ui/_next/static/chunks/0c9mu7yldxyyg.css} +1 -1
- package/{apps/compiler-ui/.next/static/chunks/0fgt_8knmicoz.js → dist/compiler-ui/_next/static/chunks/15mks7ry_cupt.js} +15 -21
- package/{apps/compiler-ui/.next/static/chunks/turbopack-109rtik40vwh5.js → dist/compiler-ui/_next/static/chunks/turbopack-0.uq1k8c0j4s..js} +1 -1
- package/dist/compiler-ui/_not-found/__next._full.txt +15 -0
- package/dist/compiler-ui/_not-found/__next._head.txt +5 -0
- package/dist/compiler-ui/_not-found/__next._index.txt +5 -0
- package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +5 -0
- package/dist/compiler-ui/_not-found/__next._not-found.txt +5 -0
- package/dist/compiler-ui/_not-found/__next._tree.txt +2 -0
- package/dist/compiler-ui/_not-found.html +1 -0
- package/dist/compiler-ui/_not-found.txt +15 -0
- package/{apps/compiler-ui/.next/server/app → dist/compiler-ui}/index.html +1 -1
- package/dist/compiler-ui/index.txt +20 -0
- package/dist/index.d.ts +8 -6
- package/dist/index.js +5 -3
- package/dist/packages/agents/index.d.ts +1 -1
- package/dist/packages/agents/lib/args.d.ts +2 -2
- package/dist/packages/agents/lib/compiled-bootstrap.js +7 -6
- package/dist/packages/agents/lib/execution-profile.d.ts +5 -5
- package/dist/packages/agents/lib/execution-profile.js +7 -6
- package/dist/packages/agents/lib/executors.d.ts +13 -13
- package/dist/packages/agents/lib/preflight.d.ts +1 -0
- package/dist/packages/agents/lib/preflight.js +32 -9
- package/dist/packages/agents/lib/shells.d.ts +25 -24
- package/dist/packages/agents/lib/shells.js +161 -154
- package/dist/packages/agents/lib/types.d.ts +2 -2
- package/dist/packages/compiler/artifact-counts.d.ts +1 -0
- package/dist/packages/compiler/artifact-counts.js +30 -0
- package/dist/packages/compiler/compiled-paths.d.ts +4 -7
- package/dist/packages/compiler/compiled-paths.js +9 -15
- package/dist/packages/compiler/compiled-pipeline.d.ts +11 -12
- package/dist/packages/compiler/compiled-pipeline.js +22 -22
- package/dist/packages/compiler/compiled-schema.d.ts +20 -20
- package/dist/packages/compiler/compiled-schema.js +29 -29
- package/dist/packages/compiler/compiled-stage-plan.d.ts +4 -4
- package/dist/packages/compiler/compiled-stage-plan.js +8 -8
- package/dist/packages/compiler/compiled-stage-runner.d.ts +5 -5
- package/dist/packages/compiler/compiled-stage-runner.js +7 -7
- package/dist/packages/compiler/compiled-target.d.ts +5 -5
- package/dist/packages/compiler/compiled-target.js +5 -5
- package/dist/packages/compiler/index.d.ts +3 -3
- package/dist/packages/compiler/index.js +2 -2
- package/dist/packages/compiler/lib/schema.d.ts +62 -247
- package/dist/packages/compiler/lib/schema.js +56 -174
- package/dist/packages/compiler/{workflows.d.ts → method-runs.d.ts} +4 -4
- package/dist/packages/compiler/{workflows.js → method-runs.js} +4 -3
- package/dist/packages/compiler/raw-snapshot.d.ts +0 -7
- package/dist/packages/compiler/raw-snapshot.js +0 -1
- package/dist/packages/compiler/reset.js +3 -3
- package/dist/packages/compiler/runtime-acceptance.js +9 -16
- package/dist/packages/compiler/runtime-contracts.js +9 -9
- package/dist/packages/compiler/runtime-prompt.js +4 -4
- package/dist/packages/compiler/runtime-reconcile.d.ts +2 -2
- package/dist/packages/compiler/runtime-reconcile.js +3 -3
- package/dist/packages/compiler/runtime-runs.js +9 -9
- package/dist/packages/compiler/runtime-types.d.ts +8 -7
- package/dist/packages/compiler/state-health.js +26 -35
- package/dist/packages/compiler/state-view.js +6 -6
- package/dist/packages/compiler/validate-compiled.d.ts +5 -5
- package/dist/packages/compiler/validate-compiled.js +56 -64
- package/dist/packages/compiler/validate.d.ts +2 -2
- package/dist/packages/compiler/validate.js +22 -14
- package/dist/packages/contracts/index.d.ts +2 -0
- package/dist/packages/contracts/index.js +1 -0
- package/dist/packages/contracts/lib/schema.d.ts +205 -0
- package/dist/packages/contracts/lib/schema.js +101 -0
- package/dist/packages/execution/index.d.ts +2 -2
- package/dist/packages/execution/index.js +1 -1
- package/dist/packages/execution/lib/schema.d.ts +80 -83
- package/dist/packages/execution/lib/schema.js +25 -48
- package/dist/packages/local-service/action-values.d.ts +0 -1
- package/dist/packages/local-service/action-values.js +0 -1
- package/dist/packages/local-service/client.d.ts +4 -4
- package/dist/packages/local-service/client.js +4 -4
- package/dist/packages/local-service/index.d.ts +3 -3
- package/dist/packages/local-service/index.js +2 -2
- package/dist/packages/local-service/lib/schema.d.ts +536 -974
- package/dist/packages/local-service/lib/schema.js +43 -160
- package/dist/packages/local-service/run-observability.d.ts +6 -0
- package/dist/packages/local-service/run-observability.js +592 -0
- package/dist/packages/local-service/runtime.d.ts +19 -23
- package/dist/packages/local-service/runtime.js +302 -880
- package/dist/packages/local-service/server.d.ts +1 -0
- package/dist/packages/local-service/server.js +25 -20
- package/dist/packages/method-authoring/index.d.ts +4 -0
- package/dist/packages/method-authoring/index.js +4 -0
- package/dist/packages/{workflow-authoring/lib/workflow-edit-utils.d.ts → method-authoring/lib/method-edit-utils.d.ts} +3 -3
- package/dist/packages/method-authoring/method-authoring.d.ts +24 -0
- package/dist/packages/method-authoring/method-authoring.js +116 -0
- package/dist/packages/method-authoring/method-edit-session.d.ts +18 -0
- package/dist/packages/method-authoring/method-edit-session.js +125 -0
- package/dist/packages/method-authoring/method-improvement.d.ts +23 -0
- package/dist/packages/{workflow-authoring/workflow-improvement.js → method-authoring/method-improvement.js} +63 -63
- package/dist/packages/{workflow-package/builtin-compiled-workflow.d.ts → method-package/builtin-compiled-method.d.ts} +1 -1
- package/dist/packages/{workflow-package/builtin-compiled-workflow.js → method-package/builtin-compiled-method.js} +17 -17
- package/dist/packages/{workflow-package → method-package}/context-interface.d.ts +12 -12
- package/dist/packages/{workflow-package → method-package}/context-interface.js +19 -19
- package/dist/packages/method-package/index.d.ts +11 -0
- package/dist/packages/method-package/index.js +11 -0
- package/dist/packages/method-package/interf-method-package.d.ts +31 -0
- package/dist/packages/{workflow-package/interf-workflow-package.js → method-package/interf-method-package.js} +145 -145
- package/dist/packages/{workflow-package → method-package}/lib/package-root.js +1 -1
- package/dist/packages/method-package/local-methods.d.ts +64 -0
- package/dist/packages/method-package/local-methods.js +466 -0
- package/dist/packages/method-package/method-definitions.d.ts +83 -0
- package/dist/packages/method-package/method-definitions.js +205 -0
- package/dist/packages/{workflow-package/workflow-helpers.d.ts → method-package/method-helpers.d.ts} +10 -10
- package/dist/packages/{workflow-package/workflow-helpers.js → method-package/method-helpers.js} +22 -26
- package/dist/packages/method-package/method-review-paths.d.ts +10 -0
- package/dist/packages/{workflow-package/workflow-review-paths.js → method-package/method-review-paths.js} +4 -4
- package/dist/packages/{workflow-package/workflow-stage-runner.d.ts → method-package/method-stage-runner.d.ts} +12 -11
- package/dist/packages/{workflow-package/workflow-stage-runner.js → method-package/method-stage-runner.js} +6 -6
- package/dist/packages/methods/index.d.ts +2 -0
- package/dist/packages/methods/index.js +2 -0
- package/dist/packages/methods/method-resolution.d.ts +6 -0
- package/dist/packages/methods/method-resolution.js +7 -0
- package/dist/packages/project-model/index.d.ts +1 -4
- package/dist/packages/project-model/index.js +0 -3
- package/dist/packages/project-model/interf-detect.d.ts +1 -5
- package/dist/packages/project-model/interf-detect.js +7 -18
- package/dist/packages/project-model/interf-scaffold.d.ts +2 -2
- package/dist/packages/project-model/interf-scaffold.js +38 -39
- package/dist/packages/project-model/interf.d.ts +1 -2
- package/dist/packages/project-model/interf.js +1 -2
- package/dist/packages/project-model/lib/schema.d.ts +2 -66
- package/dist/packages/project-model/lib/schema.js +5 -23
- package/dist/packages/project-model/project-paths.d.ts +9 -10
- package/dist/packages/project-model/project-paths.js +14 -17
- package/dist/packages/project-model/source-config.d.ts +11 -18
- package/dist/packages/project-model/source-config.js +42 -60
- package/dist/packages/project-model/source-folders.d.ts +4 -4
- package/dist/packages/project-model/source-folders.js +10 -10
- package/dist/packages/testing/index.d.ts +2 -2
- package/dist/packages/testing/index.js +1 -1
- package/dist/packages/testing/lib/schema.d.ts +11 -11
- package/dist/packages/testing/lib/schema.js +8 -9
- package/dist/packages/testing/readiness-check-run.d.ts +67 -0
- package/dist/packages/testing/readiness-check-run.js +258 -0
- package/dist/packages/testing/test-execution.d.ts +3 -3
- package/dist/packages/testing/test-execution.js +5 -5
- package/dist/packages/testing/test-paths.js +6 -6
- package/dist/packages/testing/test-profile-presets.js +2 -2
- package/dist/packages/testing/test-sandbox.js +10 -11
- package/dist/packages/testing/test-targets.d.ts +1 -1
- package/dist/packages/testing/test-targets.js +8 -7
- package/dist/packages/testing/test-types.d.ts +1 -1
- package/package.json +16 -33
- package/apps/compiler-ui/.next/static/chunks/0ti_66mx7~w2-.js +0 -5
- package/builtin-workflows/interf/improve/SKILL.md +0 -18
- package/dist/cli/commands/create-workflow-wizard.d.ts +0 -76
- package/dist/packages/project-model/compiled-paths.d.ts +0 -1
- package/dist/packages/project-model/compiled-paths.js +0 -1
- package/dist/packages/project-model/compiled-raw.d.ts +0 -1
- package/dist/packages/project-model/compiled-raw.js +0 -1
- package/dist/packages/project-model/compiled-reset.d.ts +0 -1
- package/dist/packages/project-model/compiled-reset.js +0 -1
- package/dist/packages/shared/index.d.ts +0 -7
- package/dist/packages/shared/index.js +0 -7
- package/dist/packages/shared/util.d.ts +0 -3
- package/dist/packages/shared/util.js +0 -3
- package/dist/packages/testing/test-matrices.d.ts +0 -90
- package/dist/packages/testing/test-matrices.js +0 -96
- package/dist/packages/workflow-authoring/index.d.ts +0 -4
- package/dist/packages/workflow-authoring/index.js +0 -4
- package/dist/packages/workflow-authoring/workflow-authoring.d.ts +0 -24
- package/dist/packages/workflow-authoring/workflow-authoring.js +0 -82
- package/dist/packages/workflow-authoring/workflow-edit-session.d.ts +0 -18
- package/dist/packages/workflow-authoring/workflow-edit-session.js +0 -91
- package/dist/packages/workflow-authoring/workflow-improvement.d.ts +0 -23
- package/dist/packages/workflow-package/index.d.ts +0 -11
- package/dist/packages/workflow-package/index.js +0 -11
- package/dist/packages/workflow-package/interf-workflow-package.d.ts +0 -31
- package/dist/packages/workflow-package/local-workflows.d.ts +0 -64
- package/dist/packages/workflow-package/local-workflows.js +0 -457
- package/dist/packages/workflow-package/workflow-definitions.d.ts +0 -82
- package/dist/packages/workflow-package/workflow-definitions.js +0 -211
- package/dist/packages/workflow-package/workflow-review-paths.d.ts +0 -10
- /package/{builtin-workflows/interf → builtin-methods/interf-default}/compile/stages/shape/SKILL.md +0 -0
- /package/{builtin-workflows/interf → builtin-methods/interf-default}/compile/stages/structure/SKILL.md +0 -0
- /package/{builtin-workflows/interf → builtin-methods/interf-default}/compile/stages/summarize/SKILL.md +0 -0
- /package/{builtin-workflows/interf → builtin-methods/interf-default}/use/query/SKILL.md +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/03~yq9q893hmn.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/06z~l3kwb891e.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/08g7lvje.te.u.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/08m7vf5asqlsm.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0_i-3_5l9t2qe.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0b-ywny_j0g~0.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0b52v41o1gixx.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0gpzgsv0w.q~m.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0ilwfezfvu6~-.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0n51hrfoufc7g.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0xxmf45eskdt~.css +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0y5z3t-z1c8ks.js.map +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/14wtz~vq25~qq.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/turbopack-10e~t1yzi4svj.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/turbopack-worker-0sjn--fhq~1cg.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/media/GeistMono_Variable.p.17jn9btb_52pq.woff2 +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/media/Geist_Variable-s.p.0-te~ja_gpvcf.woff2 +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/media/worker.102zas1s52_pf.js +0 -0
- /package/{apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J → dist/compiler-ui/_next/static/pIZnDsV3Je6hdC3cOsGdK}/_buildManifest.js +0 -0
- /package/{apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J → dist/compiler-ui/_next/static/pIZnDsV3Je6hdC3cOsGdK}/_clientMiddlewareManifest.js +0 -0
- /package/{apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J → dist/compiler-ui/_next/static/pIZnDsV3Je6hdC3cOsGdK}/_ssgManifest.js +0 -0
- /package/dist/packages/compiler/{workflow-primitives.d.ts → method-primitives.d.ts} +0 -0
- /package/dist/packages/compiler/{workflow-primitives.js → method-primitives.js} +0 -0
- /package/dist/packages/{workflow-authoring/lib/workflow-edit-utils.js → method-authoring/lib/method-edit-utils.js} +0 -0
- /package/dist/packages/{workflow-package → method-package}/lib/package-root.d.ts +0 -0
- /package/dist/packages/{workflow-package/workflow-stage-policy.d.ts → method-package/method-stage-policy.d.ts} +0 -0
- /package/dist/packages/{workflow-package/workflow-stage-policy.js → method-package/method-stage-policy.js} +0 -0
|
@@ -6,7 +6,7 @@ import { parseJsonFrontmatter } from "../shared/parse.js";
|
|
|
6
6
|
import { loadRuntimeRun } from "./runtime.js";
|
|
7
7
|
import { initCompiledState, loadState, refreshCompiledArtifacts, saveState, } from "./state.js";
|
|
8
8
|
import { compiledInventoryFromEntries } from "./runtime-inventory.js";
|
|
9
|
-
import { compiledRuntimeRoot,
|
|
9
|
+
import { compiledRuntimeRoot, methodPackagePathForCompiled } from "./compiled-paths.js";
|
|
10
10
|
import { extractSynthAbstract, isOutputMarkdownFile } from "./validate.js";
|
|
11
11
|
function readActiveRunStartedAtMs(dirPath) {
|
|
12
12
|
const run = loadRuntimeRun(dirPath);
|
|
@@ -93,7 +93,7 @@ function buildInventoryMetadata(options) {
|
|
|
93
93
|
return metadata;
|
|
94
94
|
}
|
|
95
95
|
function buildStageInventoryEntries(dirPath, stage) {
|
|
96
|
-
const schema = readCompiledSchemaFile(
|
|
96
|
+
const schema = readCompiledSchemaFile(methodPackagePathForCompiled(dirPath));
|
|
97
97
|
if (!schema)
|
|
98
98
|
return [];
|
|
99
99
|
const readableInputZones = stage.reads
|
|
@@ -155,7 +155,7 @@ export function reconcileCompiledStageRun(dirPath, stage) {
|
|
|
155
155
|
const startedAtMs = readActiveRunStartedAtMs(dirPath);
|
|
156
156
|
if (startedAtMs === null)
|
|
157
157
|
return false;
|
|
158
|
-
const schema = readCompiledSchemaFile(
|
|
158
|
+
const schema = readCompiledSchemaFile(methodPackagePathForCompiled(dirPath));
|
|
159
159
|
if (!schema)
|
|
160
160
|
return false;
|
|
161
161
|
const writeZones = stage.writes
|
|
@@ -4,7 +4,7 @@ import chalk from "chalk";
|
|
|
4
4
|
import { countFilesRecursive } from "../shared/filesystem.js";
|
|
5
5
|
import { buildRuntimeExecutorInfo } from "../agents/lib/executors.js";
|
|
6
6
|
import { RuntimeRunSchema, } from "./lib/schema.js";
|
|
7
|
-
import {
|
|
7
|
+
import { getMethodStageDefinition, getMethodStagePosition, getMethodStages, } from "../method-package/method-definitions.js";
|
|
8
8
|
import { archivedStageContractPath, eventLogPath, logsDirPath, promptLogPath, runHistoryPath, runPath, stageContractPath, statusLogPath, } from "./runtime-paths.js";
|
|
9
9
|
import { warnInterf } from "../shared/logger.js";
|
|
10
10
|
export function loadRuntimeRun(dirPath) {
|
|
@@ -147,9 +147,9 @@ export function markRuntimeRunSucceededAfterValidation(dirPath, summary) {
|
|
|
147
147
|
function startRuntimeRun(options) {
|
|
148
148
|
const runId = createRunId();
|
|
149
149
|
const generatedAt = new Date().toISOString();
|
|
150
|
-
const
|
|
151
|
-
const stagePosition =
|
|
152
|
-
const stageDefinition =
|
|
150
|
+
const methodStages = getMethodStages(options.method, options.methodSourcePath);
|
|
151
|
+
const stagePosition = getMethodStagePosition(options.method, options.stage, options.methodSourcePath);
|
|
152
|
+
const stageDefinition = getMethodStageDefinition(options.method, options.stage, options.methodSourcePath);
|
|
153
153
|
const contract = {
|
|
154
154
|
kind: "interf-stage-contract",
|
|
155
155
|
version: 1,
|
|
@@ -157,11 +157,11 @@ function startRuntimeRun(options) {
|
|
|
157
157
|
run_id: runId,
|
|
158
158
|
target_type: "compiled",
|
|
159
159
|
target_name: options.compiledName,
|
|
160
|
-
|
|
161
|
-
id: options.
|
|
160
|
+
method: {
|
|
161
|
+
id: options.method,
|
|
162
162
|
stage_index: stagePosition?.stageIndex ?? null,
|
|
163
|
-
stage_total: stagePosition?.stageTotal ??
|
|
164
|
-
stages: stagePosition?.stages ??
|
|
163
|
+
stage_total: stagePosition?.stageTotal ?? methodStages.length,
|
|
164
|
+
stages: stagePosition?.stages ?? methodStages,
|
|
165
165
|
},
|
|
166
166
|
stage: options.stage,
|
|
167
167
|
stage_label: stageDefinition?.label ?? options.stageLabel,
|
|
@@ -181,7 +181,7 @@ function startRuntimeRun(options) {
|
|
|
181
181
|
run_id: runId,
|
|
182
182
|
target_type: "compiled",
|
|
183
183
|
target_name: options.compiledName,
|
|
184
|
-
|
|
184
|
+
method: options.method,
|
|
185
185
|
stage: options.stage,
|
|
186
186
|
stage_label: stageDefinition?.label ?? options.stageLabel,
|
|
187
187
|
contract_type: options.contractType,
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type
|
|
1
|
+
import { type MethodExecutor } from "../agents/lib/executors.js";
|
|
2
|
+
import { type RuntimeRun, type RuntimeStageAcceptance, type RuntimeStageContract, type RuntimeStageInstructions } from "./lib/schema.js";
|
|
3
|
+
import type { MethodId, RuntimeContractType, RuntimeStage } from "../contracts/lib/schema.js";
|
|
3
4
|
export type RuntimeRunStatus = "running" | "succeeded" | "failed";
|
|
4
|
-
export type RuntimeStageContractDraft = Omit<RuntimeStageContract, "kind" | "version" | "generated_at" | "run_id" | "target_type" | "target_name" | "
|
|
5
|
+
export type RuntimeStageContractDraft = Omit<RuntimeStageContract, "kind" | "version" | "generated_at" | "run_id" | "target_type" | "target_name" | "method" | "stage" | "stage_label" | "contract_type" | "executor">;
|
|
5
6
|
export interface RuntimeStageExecutionOptions {
|
|
6
|
-
executor:
|
|
7
|
+
executor: MethodExecutor;
|
|
7
8
|
compiledPath: string;
|
|
8
9
|
executionPath?: string;
|
|
9
10
|
compiledName: string;
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
method: MethodId;
|
|
12
|
+
methodSourcePath?: string;
|
|
12
13
|
stage: RuntimeStage;
|
|
13
14
|
stageLabel: string;
|
|
14
15
|
contractType: RuntimeContractType;
|
|
@@ -35,7 +36,7 @@ export interface RuntimeStageContractOptions {
|
|
|
35
36
|
extraReadArtifacts?: string[];
|
|
36
37
|
stageReadArtifacts: string[];
|
|
37
38
|
stageWriteArtifacts: string[];
|
|
38
|
-
|
|
39
|
+
methodNotes?: string[];
|
|
39
40
|
localSkillDocs?: string[];
|
|
40
41
|
instructions: RuntimeStageInstructions;
|
|
41
42
|
acceptance?: RuntimeStageAcceptance;
|
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
import { basename
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
1
|
+
import { basename } from "node:path";
|
|
3
2
|
import { readInterfConfig, resolveSourceFolderPath, } from "../project-model/interf-detect.js";
|
|
4
3
|
import { discoverSourceFiles } from "./discovery.js";
|
|
5
4
|
import { loadRuntimeRun } from "./runtime.js";
|
|
6
5
|
import { loadState } from "./state-io.js";
|
|
7
|
-
import { validateCompiled, validateCompiledStage,
|
|
6
|
+
import { validateCompiled, validateCompiledStage, validateCompiledMethod, } from "./validate.js";
|
|
8
7
|
import { readCompiledSchemaFile } from "./compiled-schema.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
function countZoneArtifacts(compiledPath, zonePath, kind) {
|
|
13
|
-
const absolutePath = join(compiledPath, zonePath);
|
|
14
|
-
if (!existsSync(absolutePath))
|
|
15
|
-
return 0;
|
|
16
|
-
if (kind === "file")
|
|
17
|
-
return 1;
|
|
18
|
-
return listFilesRecursive(absolutePath).length;
|
|
19
|
-
}
|
|
8
|
+
import { methodPackagePathForCompiled } from "./compiled-paths.js";
|
|
9
|
+
import { getActiveCompiledMethod, resolveRequiredCompiledMethodFromConfig } from "../method-package/method-definitions.js";
|
|
10
|
+
import { countCompiledZoneArtifacts } from "./artifact-counts.js";
|
|
20
11
|
export function computeCompiledHealth(dirPath) {
|
|
21
12
|
const now = new Date().toISOString();
|
|
22
13
|
const config = readInterfConfig(dirPath);
|
|
@@ -26,38 +17,38 @@ export function computeCompiledHealth(dirPath) {
|
|
|
26
17
|
const state = loadState(dirPath);
|
|
27
18
|
const validation = validateCompiled(dirPath);
|
|
28
19
|
const activeRun = loadRuntimeRun(dirPath);
|
|
29
|
-
const
|
|
30
|
-
?
|
|
20
|
+
const methodId = config
|
|
21
|
+
? resolveRequiredCompiledMethodFromConfig(config, `.interf/interf.json for ${dirPath}`)
|
|
31
22
|
: null;
|
|
32
|
-
let
|
|
33
|
-
if (
|
|
23
|
+
let method = null;
|
|
24
|
+
if (methodId) {
|
|
34
25
|
try {
|
|
35
|
-
|
|
26
|
+
method = getActiveCompiledMethod(dirPath);
|
|
36
27
|
}
|
|
37
28
|
catch {
|
|
38
|
-
|
|
29
|
+
method = null;
|
|
39
30
|
}
|
|
40
31
|
}
|
|
41
|
-
const stageResults =
|
|
32
|
+
const stageResults = method?.stages.map((stage) => ({
|
|
42
33
|
stage,
|
|
43
34
|
validation: validateCompiledStage(dirPath, stage.id),
|
|
44
35
|
})) ?? [];
|
|
45
36
|
const completedStages = stageResults.filter((entry) => entry.validation.ok).length;
|
|
46
37
|
const firstFailed = stageResults.find((entry) => !entry.validation.ok) ?? null;
|
|
47
|
-
const
|
|
48
|
-
const schema = readCompiledSchemaFile(
|
|
38
|
+
const methodValidation = validateCompiledMethod(dirPath);
|
|
39
|
+
const schema = readCompiledSchemaFile(methodPackagePathForCompiled(dirPath));
|
|
49
40
|
const zoneMetrics = Object.fromEntries((schema?.zones ?? []).map((zone) => [
|
|
50
41
|
`zone_${zone.id}`,
|
|
51
|
-
|
|
42
|
+
countCompiledZoneArtifacts(dirPath, zone.path, zone.kind),
|
|
52
43
|
]));
|
|
53
44
|
let status = "idle";
|
|
54
45
|
let stage = "idle";
|
|
55
46
|
let summary = "Idle — no source files have been compiled yet.";
|
|
56
|
-
const errors =
|
|
57
|
-
if (!validation.config_present || !validation.config_valid || !validation.config_type_match || !validation.
|
|
47
|
+
const errors = methodValidation.errors.length;
|
|
48
|
+
if (!validation.config_present || !validation.config_valid || !validation.config_type_match || !validation.method_valid || !validation.schema_valid) {
|
|
58
49
|
status = "failed";
|
|
59
50
|
stage = "failed";
|
|
60
|
-
summary =
|
|
51
|
+
summary = methodValidation.summary;
|
|
61
52
|
}
|
|
62
53
|
else if (activeRun?.status === "running") {
|
|
63
54
|
status = "running";
|
|
@@ -74,22 +65,22 @@ export function computeCompiledHealth(dirPath) {
|
|
|
74
65
|
stage = activeRun.stage;
|
|
75
66
|
summary = activeRun.error ?? activeRun.summary;
|
|
76
67
|
}
|
|
77
|
-
else if (
|
|
68
|
+
else if (methodValidation.ok) {
|
|
78
69
|
status = "compiled";
|
|
79
70
|
stage = "compiled";
|
|
80
|
-
summary = `Compiled — ${completedStages}/${
|
|
71
|
+
summary = `Compiled — ${completedStages}/${method?.stages.length ?? 0} method stages satisfied.`;
|
|
81
72
|
}
|
|
82
73
|
else {
|
|
83
74
|
status = "stale";
|
|
84
75
|
stage = firstFailed?.stage.id ?? "compiled";
|
|
85
|
-
summary = firstFailed?.validation.summary ??
|
|
76
|
+
summary = firstFailed?.validation.summary ?? methodValidation.summary;
|
|
86
77
|
}
|
|
87
78
|
const checks = {
|
|
88
79
|
...validation,
|
|
89
|
-
...(
|
|
90
|
-
? Object.fromEntries(
|
|
91
|
-
`stage_${
|
|
92
|
-
stageResults.find((entry) => entry.stage.id ===
|
|
80
|
+
...(method
|
|
81
|
+
? Object.fromEntries(method.stages.map((methodStage) => [
|
|
82
|
+
`stage_${methodStage.id}_ok`,
|
|
83
|
+
stageResults.find((entry) => entry.stage.id === methodStage.id)?.validation.ok ?? false,
|
|
93
84
|
]))
|
|
94
85
|
: {}),
|
|
95
86
|
};
|
|
@@ -103,7 +94,7 @@ export function computeCompiledHealth(dirPath) {
|
|
|
103
94
|
summary,
|
|
104
95
|
metrics: {
|
|
105
96
|
source_total: sourceTotal,
|
|
106
|
-
stage_total:
|
|
97
|
+
stage_total: method?.stages.length ?? 0,
|
|
107
98
|
completed_stages: completedStages,
|
|
108
99
|
warnings: state?.warning_count ?? 0,
|
|
109
100
|
errors: (state?.error_count ?? 0) + errors,
|
|
@@ -4,9 +4,9 @@ import { discoverSourceFiles } from "./discovery.js";
|
|
|
4
4
|
import { readInterfConfig, resolveSourceFolderPath } from "../project-model/interf-detect.js";
|
|
5
5
|
import { loadCompiledViewSpec, saveCompiledViewSpec, } from "./state-io.js";
|
|
6
6
|
import { rawSnapshotPath } from "./state-paths.js";
|
|
7
|
-
import { compiledRuntimeRoot,
|
|
7
|
+
import { compiledRuntimeRoot, methodPackagePathForCompiled } from "./compiled-paths.js";
|
|
8
8
|
import { readCompiledSchemaFile } from "./compiled-schema.js";
|
|
9
|
-
import {
|
|
9
|
+
import { getActiveCompiledMethod, resolveRequiredCompiledMethodFromConfig } from "../method-package/method-definitions.js";
|
|
10
10
|
export function ensureCompiledViewSpec(dirPath) {
|
|
11
11
|
const existing = loadCompiledViewSpec(dirPath);
|
|
12
12
|
const now = new Date().toISOString();
|
|
@@ -70,9 +70,9 @@ export function normalizeCompiledViewSpec(existing, defaults) {
|
|
|
70
70
|
}
|
|
71
71
|
function buildDefaultCompiledViewSpec(dirPath, compiledName, generatedAt) {
|
|
72
72
|
const config = readInterfConfig(dirPath);
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
const schema = readCompiledSchemaFile(
|
|
73
|
+
resolveRequiredCompiledMethodFromConfig(config, `.interf/interf.json for ${dirPath}`);
|
|
74
|
+
const method = getActiveCompiledMethod(dirPath);
|
|
75
|
+
const schema = readCompiledSchemaFile(methodPackagePathForCompiled(dirPath));
|
|
76
76
|
const outputDocumentPaths = (schema?.zones ?? [])
|
|
77
77
|
.filter((zone) => zone.role === "output" && zone.kind !== "runtime")
|
|
78
78
|
.map((zone) => zone.path);
|
|
@@ -97,7 +97,7 @@ function buildDefaultCompiledViewSpec(dirPath, compiledName, generatedAt) {
|
|
|
97
97
|
...(outputDocumentPaths.length > 0
|
|
98
98
|
? [{ id: "outputs", type: "documents", title: "Output Zones", paths: outputDocumentPaths }]
|
|
99
99
|
: []),
|
|
100
|
-
{ id: "method", type: "documents", title: "Method Docs", paths: ["method/README.md", ...
|
|
100
|
+
{ id: "method", type: "documents", title: "Method Docs", paths: ["method/README.md", ...method.stages.map((stage) => `method/compile/stages/${stage.skillDir}`)] },
|
|
101
101
|
],
|
|
102
102
|
};
|
|
103
103
|
}
|
|
@@ -2,8 +2,8 @@ export interface CompiledValidationSummary {
|
|
|
2
2
|
config_present: boolean;
|
|
3
3
|
config_valid: boolean;
|
|
4
4
|
config_type_match: boolean;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
method_present: boolean;
|
|
6
|
+
method_valid: boolean;
|
|
7
7
|
schema_present: boolean;
|
|
8
8
|
schema_valid: boolean;
|
|
9
9
|
}
|
|
@@ -16,12 +16,12 @@ export interface CompiledStageValidation {
|
|
|
16
16
|
checks: Record<string, boolean>;
|
|
17
17
|
errors: string[];
|
|
18
18
|
}
|
|
19
|
-
export interface
|
|
19
|
+
export interface CompiledMethodValidation extends CompiledStageValidation {
|
|
20
20
|
stage_results: Record<string, boolean>;
|
|
21
21
|
}
|
|
22
22
|
export declare function validateCompiled(dirPath: string): CompiledValidationSummary;
|
|
23
23
|
export declare function validateCompiledStage(dirPath: string, stageId: string): CompiledStageValidation;
|
|
24
|
-
export declare function
|
|
24
|
+
export declare function validateCompiledMethod(dirPath: string): CompiledMethodValidation;
|
|
25
25
|
export declare function validateCompiledSummarize(dirPath: string): CompiledStageValidation;
|
|
26
26
|
export declare function validateCompiledStructure(dirPath: string): CompiledStageValidation;
|
|
27
|
-
export declare function validateCompiledCompile(dirPath: string):
|
|
27
|
+
export declare function validateCompiledCompile(dirPath: string): CompiledMethodValidation;
|
|
@@ -1,53 +1,45 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { discoverSourceFiles } from "./discovery.js";
|
|
3
|
-
import {
|
|
3
|
+
import { METHOD_SCHEMA_FILE, findCompiledSchemaZone, readCompiledSchemaFile, methodSchemaExists, } from "./compiled-schema.js";
|
|
4
4
|
import { resolveSourceFolderPath } from "../project-model/interf-detect.js";
|
|
5
|
-
import { compiledInterfConfigPath,
|
|
5
|
+
import { compiledInterfConfigPath, methodPackagePathForCompiled } from "./compiled-paths.js";
|
|
6
6
|
import { readCompiledConfig } from "./validate.js";
|
|
7
7
|
import { loadState } from "./state.js";
|
|
8
8
|
import { validateResolvedStageAcceptance, stageRecordFromState } from "./runtime-acceptance.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
function
|
|
12
|
-
return
|
|
9
|
+
import { getActiveCompiledMethod, resolveRequiredCompiledMethodFromConfig, } from "../method-package/method-definitions.js";
|
|
10
|
+
import { countCompiledZoneArtifacts } from "./artifact-counts.js";
|
|
11
|
+
function methodSchemaPresent(dirPath) {
|
|
12
|
+
return methodSchemaExists(methodPackagePathForCompiled(dirPath));
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
return existsSync(
|
|
14
|
+
function methodJsonPresent(dirPath) {
|
|
15
|
+
return existsSync(methodPackagePathForCompiled(dirPath) + "/method.json");
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
const absolutePath = compiledZoneAbsolutePath(compiledPath, { path: zonePath });
|
|
19
|
-
if (!existsSync(absolutePath))
|
|
20
|
-
return 0;
|
|
21
|
-
if (kind === "file")
|
|
22
|
-
return 1;
|
|
23
|
-
return listFilesRecursive(absolutePath).length;
|
|
24
|
-
}
|
|
25
|
-
function readWorkflowContext(dirPath) {
|
|
17
|
+
function readMethodContext(dirPath) {
|
|
26
18
|
const config = readCompiledConfig(dirPath);
|
|
27
|
-
const
|
|
28
|
-
?
|
|
19
|
+
const methodId = config.valid
|
|
20
|
+
? resolveRequiredCompiledMethodFromConfig(config.value, `.interf/interf.json for ${dirPath}`)
|
|
29
21
|
: null;
|
|
30
|
-
let
|
|
31
|
-
if (
|
|
22
|
+
let method = null;
|
|
23
|
+
if (methodId) {
|
|
32
24
|
try {
|
|
33
|
-
|
|
25
|
+
method = getActiveCompiledMethod(dirPath);
|
|
34
26
|
}
|
|
35
27
|
catch {
|
|
36
|
-
|
|
28
|
+
method = null;
|
|
37
29
|
}
|
|
38
30
|
}
|
|
39
|
-
const schema = readCompiledSchemaFile(
|
|
31
|
+
const schema = readCompiledSchemaFile(methodPackagePathForCompiled(dirPath));
|
|
40
32
|
const state = loadState(dirPath);
|
|
41
33
|
const sourceTotal = config.valid
|
|
42
34
|
? discoverSourceFiles(resolveSourceFolderPath(dirPath, config.value), dirPath).totalCount
|
|
43
35
|
: 0;
|
|
44
36
|
return {
|
|
45
37
|
config,
|
|
46
|
-
|
|
38
|
+
method,
|
|
47
39
|
schema,
|
|
48
40
|
state,
|
|
49
41
|
sourceTotal,
|
|
50
|
-
|
|
42
|
+
methodId,
|
|
51
43
|
};
|
|
52
44
|
}
|
|
53
45
|
function stageRequired(sourceTotal, writeCounts, stageRecordPresent) {
|
|
@@ -60,7 +52,7 @@ function zoneWriteCount(compiledPath, schema, stage) {
|
|
|
60
52
|
const zone = findCompiledSchemaZone(schema, zoneId);
|
|
61
53
|
if (!zone)
|
|
62
54
|
continue;
|
|
63
|
-
const count =
|
|
55
|
+
const count = countCompiledZoneArtifacts(compiledPath, zone.path, zone.kind);
|
|
64
56
|
zoneCounts[zoneId] = count;
|
|
65
57
|
total += count;
|
|
66
58
|
}
|
|
@@ -82,26 +74,26 @@ function mergeValidationCounts(sourceTotal, stageRecord, zoneCounts) {
|
|
|
82
74
|
return merged;
|
|
83
75
|
}
|
|
84
76
|
export function validateCompiled(dirPath) {
|
|
85
|
-
const context =
|
|
77
|
+
const context = readMethodContext(dirPath);
|
|
86
78
|
return {
|
|
87
79
|
config_present: context.config.present,
|
|
88
80
|
config_valid: context.config.valid,
|
|
89
81
|
config_type_match: context.config.typeMatch(),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
schema_present:
|
|
82
|
+
method_present: methodJsonPresent(dirPath),
|
|
83
|
+
method_valid: context.method !== null,
|
|
84
|
+
schema_present: methodSchemaPresent(dirPath),
|
|
93
85
|
schema_valid: context.schema !== null,
|
|
94
86
|
};
|
|
95
87
|
}
|
|
96
88
|
export function validateCompiledStage(dirPath, stageId) {
|
|
97
|
-
const context =
|
|
89
|
+
const context = readMethodContext(dirPath);
|
|
98
90
|
const checks = {
|
|
99
91
|
config_present: context.config.present,
|
|
100
92
|
config_valid: context.config.valid,
|
|
101
93
|
config_type_match: context.config.typeMatch(),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
schema_present:
|
|
94
|
+
method_present: methodJsonPresent(dirPath),
|
|
95
|
+
method_valid: context.method !== null,
|
|
96
|
+
schema_present: methodSchemaPresent(dirPath),
|
|
105
97
|
schema_valid: context.schema !== null,
|
|
106
98
|
};
|
|
107
99
|
const errors = [];
|
|
@@ -110,34 +102,34 @@ export function validateCompiledStage(dirPath, stageId) {
|
|
|
110
102
|
else if (!checks.config_valid)
|
|
111
103
|
errors.push(`Could not parse ${compiledInterfConfigPath(dirPath)}.`);
|
|
112
104
|
else if (!checks.config_type_match)
|
|
113
|
-
errors.push("Config is not a
|
|
114
|
-
if (!checks.
|
|
115
|
-
errors.push("Missing .interf/method/
|
|
116
|
-
else if (!checks.
|
|
117
|
-
errors.push("Could not load the active
|
|
105
|
+
errors.push("Config is not a portable context.");
|
|
106
|
+
if (!checks.method_present)
|
|
107
|
+
errors.push("Missing .interf/method/method.json.");
|
|
108
|
+
else if (!checks.method_valid)
|
|
109
|
+
errors.push("Could not load the active Method package.");
|
|
118
110
|
if (!checks.schema_present)
|
|
119
|
-
errors.push(`Missing .interf/method/${
|
|
111
|
+
errors.push(`Missing .interf/method/${METHOD_SCHEMA_FILE}.`);
|
|
120
112
|
else if (!checks.schema_valid)
|
|
121
|
-
errors.push(`Could not parse .interf/method/${
|
|
122
|
-
const
|
|
123
|
-
checks.stage_present =
|
|
113
|
+
errors.push(`Could not parse .interf/method/${METHOD_SCHEMA_FILE}.`);
|
|
114
|
+
const methodStage = context.method?.stages.find((stage) => stage.id === stageId) ?? null;
|
|
115
|
+
checks.stage_present = methodStage !== null;
|
|
124
116
|
if (!checks.stage_present) {
|
|
125
|
-
errors.push(`
|
|
117
|
+
errors.push(`Method does not declare stage "${stageId}".`);
|
|
126
118
|
}
|
|
127
119
|
const stageRecord = stageRecordFromState(context.state, stageId);
|
|
128
120
|
checks.stage_record_present = stageRecord !== null;
|
|
129
121
|
checks.stage_finished = Boolean(stageRecord?.finished_at);
|
|
130
122
|
checks.stage_succeeded = stageRecord?.status === "succeeded";
|
|
131
|
-
const writeCounts =
|
|
132
|
-
? zoneWriteCount(dirPath, context.schema,
|
|
123
|
+
const writeCounts = methodStage && context.schema
|
|
124
|
+
? zoneWriteCount(dirPath, context.schema, methodStage)
|
|
133
125
|
: { total: 0, zoneCounts: {} };
|
|
134
126
|
const acceptanceCounts = mergeValidationCounts(context.sourceTotal, stageRecord, writeCounts.zoneCounts);
|
|
135
127
|
const required = stageRequired(context.sourceTotal, writeCounts.total, checks.stage_record_present);
|
|
136
128
|
let acceptanceErrors = [];
|
|
137
|
-
if (
|
|
129
|
+
if (methodStage && context.schema) {
|
|
138
130
|
const acceptanceValidation = validateResolvedStageAcceptance(dirPath, {
|
|
139
131
|
stageId,
|
|
140
|
-
acceptance:
|
|
132
|
+
acceptance: methodStage.acceptance,
|
|
141
133
|
counts: acceptanceCounts,
|
|
142
134
|
});
|
|
143
135
|
checks.acceptance_ok = acceptanceValidation.ok;
|
|
@@ -169,30 +161,30 @@ export function validateCompiledStage(dirPath, stageId) {
|
|
|
169
161
|
counts: {
|
|
170
162
|
...acceptanceCounts,
|
|
171
163
|
write_artifacts: writeCounts.total,
|
|
172
|
-
declared_write_zones:
|
|
164
|
+
declared_write_zones: methodStage?.writes.length ?? 0,
|
|
173
165
|
},
|
|
174
166
|
checks,
|
|
175
167
|
errors,
|
|
176
168
|
};
|
|
177
169
|
}
|
|
178
|
-
export function
|
|
179
|
-
const context =
|
|
170
|
+
export function validateCompiledMethod(dirPath) {
|
|
171
|
+
const context = readMethodContext(dirPath);
|
|
180
172
|
const checks = {
|
|
181
173
|
config_present: context.config.present,
|
|
182
174
|
config_valid: context.config.valid,
|
|
183
175
|
config_type_match: context.config.typeMatch(),
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
schema_present:
|
|
176
|
+
method_present: methodJsonPresent(dirPath),
|
|
177
|
+
method_valid: context.method !== null,
|
|
178
|
+
schema_present: methodSchemaPresent(dirPath),
|
|
187
179
|
schema_valid: context.schema !== null,
|
|
188
180
|
};
|
|
189
|
-
if (!context.
|
|
190
|
-
const errors = ["Could not load the active
|
|
181
|
+
if (!context.method) {
|
|
182
|
+
const errors = ["Could not load the active Method package."];
|
|
191
183
|
return {
|
|
192
184
|
ok: false,
|
|
193
185
|
required: true,
|
|
194
|
-
stage: "
|
|
195
|
-
summary: `Compiled
|
|
186
|
+
stage: "method",
|
|
187
|
+
summary: `Compiled Method failed — ${errors[0]}`,
|
|
196
188
|
counts: { source_total: context.sourceTotal, stage_total: 0, completed_stages: 0 },
|
|
197
189
|
checks,
|
|
198
190
|
errors,
|
|
@@ -203,7 +195,7 @@ export function validateCompiledWorkflow(dirPath) {
|
|
|
203
195
|
const errors = [];
|
|
204
196
|
let completedStages = 0;
|
|
205
197
|
let failedStage = "compiled";
|
|
206
|
-
for (const stage of context.
|
|
198
|
+
for (const stage of context.method.stages) {
|
|
207
199
|
const validation = validateCompiledStage(dirPath, stage.id);
|
|
208
200
|
stageResults[stage.id] = validation.ok;
|
|
209
201
|
if (validation.ok) {
|
|
@@ -220,11 +212,11 @@ export function validateCompiledWorkflow(dirPath) {
|
|
|
220
212
|
required: context.sourceTotal > 0,
|
|
221
213
|
stage: failedStage,
|
|
222
214
|
summary: ok
|
|
223
|
-
? `Compiled
|
|
224
|
-
: `Compiled
|
|
215
|
+
? `Compiled Method verified — ${completedStages}/${context.method.stages.length} stages satisfied.`
|
|
216
|
+
: `Compiled Method failed — ${errors[0] ?? "stage acceptance not satisfied."}`,
|
|
225
217
|
counts: {
|
|
226
218
|
source_total: context.sourceTotal,
|
|
227
|
-
stage_total: context.
|
|
219
|
+
stage_total: context.method.stages.length,
|
|
228
220
|
completed_stages: completedStages,
|
|
229
221
|
},
|
|
230
222
|
checks,
|
|
@@ -239,5 +231,5 @@ export function validateCompiledStructure(dirPath) {
|
|
|
239
231
|
return validateCompiledStage(dirPath, "structure");
|
|
240
232
|
}
|
|
241
233
|
export function validateCompiledCompile(dirPath) {
|
|
242
|
-
return
|
|
234
|
+
return validateCompiledMethod(dirPath);
|
|
243
235
|
}
|
|
@@ -17,5 +17,5 @@ export declare function isOutputMarkdownFile(filePath: string): boolean;
|
|
|
17
17
|
export declare function safeReadText(filePath: string): string | null;
|
|
18
18
|
export declare function extractSynthAbstract(frontmatter: Record<string, unknown>, body: string): string | null;
|
|
19
19
|
export declare function countSynthAbstractWords(frontmatter: Record<string, unknown>, body: string): number;
|
|
20
|
-
export { validateCompiled, validateCompiledStage,
|
|
21
|
-
export type { CompiledValidationSummary, CompiledStageValidation,
|
|
20
|
+
export { validateCompiled, validateCompiledStage, validateCompiledMethod, validateCompiledSummarize, validateCompiledStructure, validateCompiledCompile, } from "./validate-compiled.js";
|
|
21
|
+
export type { CompiledValidationSummary, CompiledStageValidation, CompiledMethodValidation, } from "./validate-compiled.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { existsSync, readFileSync, statSync, } from "node:fs";
|
|
2
|
-
import { basename, extname, join } from "node:path";
|
|
2
|
+
import { basename, dirname, extname, join, resolve } from "node:path";
|
|
3
3
|
import { readCompiledSchemaFile } from "./compiled-schema.js";
|
|
4
4
|
import { compiledKnowledgeRootPath } from "./compiled-schema.js";
|
|
5
|
-
import {
|
|
5
|
+
import { methodPackagePathForCompiled } from "./compiled-paths.js";
|
|
6
6
|
import { listFilesRecursive } from "../shared/filesystem.js";
|
|
7
7
|
import { readInterfConfig } from "../project-model/interf-detect.js";
|
|
8
8
|
import { parseJsonFrontmatter } from "../shared/parse.js";
|
|
@@ -75,15 +75,15 @@ export function countBrokenWikilinks(compiledRoot, noteIndexRoots, linkScanRoots
|
|
|
75
75
|
if (!target)
|
|
76
76
|
continue;
|
|
77
77
|
if (target.includes("/")) {
|
|
78
|
-
if (!wikilinkPathExists(compiledRoot, target, zonePathById, knowledgeRelativePrefixes)) {
|
|
78
|
+
if (!wikilinkPathExists(compiledRoot, target, zonePathById, knowledgeRelativePrefixes, filePath)) {
|
|
79
79
|
brokenLinks += 1;
|
|
80
80
|
}
|
|
81
81
|
continue;
|
|
82
82
|
}
|
|
83
83
|
if (!noteIndex.has(target.toLowerCase()) &&
|
|
84
84
|
!noteIndex.has(noteName(target).toLowerCase()) &&
|
|
85
|
-
!wikilinkPathExists(compiledRoot, target, zonePathById, knowledgeRelativePrefixes) &&
|
|
86
|
-
!wikilinkPathExists(compiledRoot, noteName(target), zonePathById, knowledgeRelativePrefixes)) {
|
|
85
|
+
!wikilinkPathExists(compiledRoot, target, zonePathById, knowledgeRelativePrefixes, filePath) &&
|
|
86
|
+
!wikilinkPathExists(compiledRoot, noteName(target), zonePathById, knowledgeRelativePrefixes, filePath)) {
|
|
87
87
|
brokenLinks += 1;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -172,13 +172,16 @@ function countWords(text) {
|
|
|
172
172
|
function noteName(filePath) {
|
|
173
173
|
return basename(filePath, extname(filePath));
|
|
174
174
|
}
|
|
175
|
-
function wikilinkPathExists(compiledRoot, target, zonePathById, knowledgeRelativePrefixes) {
|
|
176
|
-
return linkPathCandidates(compiledRoot, target, zonePathById, knowledgeRelativePrefixes)
|
|
175
|
+
function wikilinkPathExists(compiledRoot, target, zonePathById, knowledgeRelativePrefixes, sourceFilePath) {
|
|
176
|
+
return linkPathCandidates(compiledRoot, target, zonePathById, knowledgeRelativePrefixes, sourceFilePath)
|
|
177
177
|
.some((candidate) => existsSync(candidate));
|
|
178
178
|
}
|
|
179
|
-
function linkPathCandidates(compiledRoot, target, zonePathById, knowledgeRelativePrefixes) {
|
|
179
|
+
function linkPathCandidates(compiledRoot, target, zonePathById, knowledgeRelativePrefixes, sourceFilePath) {
|
|
180
180
|
const candidates = new Set();
|
|
181
181
|
addPathCandidate(candidates, join(compiledRoot, target));
|
|
182
|
+
if (sourceFilePath && (target.startsWith("./") || target.startsWith("../"))) {
|
|
183
|
+
addPathCandidateIfInside(candidates, compiledRoot, resolve(dirname(sourceFilePath), target));
|
|
184
|
+
}
|
|
182
185
|
const [firstSegment] = target.split("/");
|
|
183
186
|
if (firstSegment && knowledgeRelativePrefixes.has(firstSegment)) {
|
|
184
187
|
addPathCandidate(candidates, join(compiledKnowledgeRootPath(compiledRoot), target));
|
|
@@ -194,13 +197,18 @@ function linkPathCandidates(compiledRoot, target, zonePathById, knowledgeRelativ
|
|
|
194
197
|
}
|
|
195
198
|
function addPathCandidate(candidates, absolutePath) {
|
|
196
199
|
candidates.add(absolutePath);
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
+
candidates.add(`${absolutePath}.md`);
|
|
201
|
+
}
|
|
202
|
+
function addPathCandidateIfInside(candidates, compiledRoot, absolutePath) {
|
|
203
|
+
const root = resolve(compiledRoot);
|
|
204
|
+
const candidate = resolve(absolutePath);
|
|
205
|
+
if (candidate !== root && !candidate.startsWith(`${root}/`))
|
|
206
|
+
return;
|
|
207
|
+
addPathCandidate(candidates, candidate);
|
|
200
208
|
}
|
|
201
209
|
function compiledZoneDirectoryPaths(compiledRoot) {
|
|
202
|
-
const
|
|
203
|
-
const schema = readCompiledSchemaFile(
|
|
210
|
+
const methodRoot = methodPackagePathForCompiled(compiledRoot);
|
|
211
|
+
const schema = readCompiledSchemaFile(methodRoot);
|
|
204
212
|
if (!schema)
|
|
205
213
|
return new Map();
|
|
206
214
|
return new Map(schema.zones
|
|
@@ -246,4 +254,4 @@ function addFrontmatterLinkTarget(targets, value) {
|
|
|
246
254
|
}
|
|
247
255
|
}
|
|
248
256
|
}
|
|
249
|
-
export { validateCompiled, validateCompiledStage,
|
|
257
|
+
export { validateCompiled, validateCompiledStage, validateCompiledMethod, validateCompiledSummarize, validateCompiledStructure, validateCompiledCompile, } from "./validate-compiled.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export * as schema from "./lib/schema.js";
|
|
2
|
+
export type { MethodId, PreparationName, ReadinessCheck, ReadinessGate, ReadinessState, ReadinessStatus, ReadinessTargetResult, RuntimeContractType, RuntimeExecutorInfo, RuntimeStage, RuntimeTargetType, TestCaseExpect, TestTargetType, } from "./lib/schema.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as schema from "./lib/schema.js";
|