@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
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { isMethodId, listLocalMethodDefinitions, loadLocalMethodDefinition, loadMethodDefinitionFromDir, } from "./local-methods.js";
|
|
4
|
+
import { warnInterf } from "../shared/logger.js";
|
|
5
|
+
import { methodPackagePathForCompiled } from "../compiler/compiled-paths.js";
|
|
6
|
+
import { resolveSourceControlPath } from "../project-model/interf.js";
|
|
7
|
+
import { PACKAGE_ROOT } from "./lib/package-root.js";
|
|
8
|
+
import { deriveMethodInputsFromContextInterface, } from "./context-interface.js";
|
|
9
|
+
import { mergeStagePolicyNotesForStages } from "./method-stage-policy.js";
|
|
10
|
+
const DEFAULT_METHOD_ID = "interf-default";
|
|
11
|
+
let builtinDefaultMethodCache = null;
|
|
12
|
+
function toMethodStages(stages) {
|
|
13
|
+
return stages.map((stage) => ({
|
|
14
|
+
id: stage.id,
|
|
15
|
+
label: stage.label,
|
|
16
|
+
description: stage.description ?? stage.label,
|
|
17
|
+
contractType: stage.contract_type,
|
|
18
|
+
skillDir: stage.skill_dir ?? stage.id,
|
|
19
|
+
reads: [...stage.reads],
|
|
20
|
+
writes: [...stage.writes],
|
|
21
|
+
...(stage.acceptance ? { acceptance: stage.acceptance } : {}),
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
export function standaloneMethodDefinitionFromLocalPackage(local) {
|
|
25
|
+
if (!local.stages || local.stages.length === 0) {
|
|
26
|
+
throw new Error(`Method package "${local.id}" is missing explicit stages. Compiled-local and portable Method packages must be standalone.`);
|
|
27
|
+
}
|
|
28
|
+
const stages = toMethodStages(local.stages);
|
|
29
|
+
const contextInterface = local.method_schema;
|
|
30
|
+
const inputs = local.inputs?.length
|
|
31
|
+
? [...local.inputs]
|
|
32
|
+
: deriveMethodInputsFromContextInterface(contextInterface);
|
|
33
|
+
return {
|
|
34
|
+
id: local.id,
|
|
35
|
+
compilerApi: local.compiler_api ?? {
|
|
36
|
+
kind: "compiled",
|
|
37
|
+
version: 1,
|
|
38
|
+
},
|
|
39
|
+
...(local.purpose
|
|
40
|
+
? {
|
|
41
|
+
purpose: {
|
|
42
|
+
label: local.purpose.label,
|
|
43
|
+
taskHint: local.purpose.task_hint,
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
: {}),
|
|
47
|
+
inputs,
|
|
48
|
+
label: local.label,
|
|
49
|
+
hint: local.hint,
|
|
50
|
+
recommended: false,
|
|
51
|
+
contextInterface,
|
|
52
|
+
...(contextInterface ? { schema: contextInterface } : {}),
|
|
53
|
+
stages,
|
|
54
|
+
stagePolicyNotes: mergeStagePolicyNotesForStages(stages, undefined, local.stage_policy_notes),
|
|
55
|
+
starterDocs: [...local.starter_docs],
|
|
56
|
+
scope: "local",
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function builtinMethodPackagePath(methodId) {
|
|
60
|
+
return join(PACKAGE_ROOT, "builtin-methods", methodId);
|
|
61
|
+
}
|
|
62
|
+
function getBuiltinDefaultMethod() {
|
|
63
|
+
if (builtinDefaultMethodCache)
|
|
64
|
+
return builtinDefaultMethodCache;
|
|
65
|
+
const local = loadMethodDefinitionFromDir(builtinMethodPackagePath(DEFAULT_METHOD_ID));
|
|
66
|
+
if (!local) {
|
|
67
|
+
throw new Error(`Missing built-in Interf Method package at builtin-methods/${DEFAULT_METHOD_ID}.`);
|
|
68
|
+
}
|
|
69
|
+
const resolved = standaloneMethodDefinitionFromLocalPackage(local);
|
|
70
|
+
builtinDefaultMethodCache = {
|
|
71
|
+
...resolved,
|
|
72
|
+
id: DEFAULT_METHOD_ID,
|
|
73
|
+
recommended: true,
|
|
74
|
+
scope: "builtin",
|
|
75
|
+
};
|
|
76
|
+
return builtinDefaultMethodCache;
|
|
77
|
+
}
|
|
78
|
+
function listBuiltinCompiledMethods() {
|
|
79
|
+
return [getBuiltinDefaultMethod()];
|
|
80
|
+
}
|
|
81
|
+
function resolveCompiledMethodFromLocal(methodId, sourcePath) {
|
|
82
|
+
const local = loadLocalMethodDefinition(sourcePath, methodId);
|
|
83
|
+
if (!local)
|
|
84
|
+
return null;
|
|
85
|
+
const resolved = standaloneMethodDefinitionFromLocalPackage(local);
|
|
86
|
+
return resolved;
|
|
87
|
+
}
|
|
88
|
+
export function listCompiledMethodChoices(sourcePath) {
|
|
89
|
+
const builtins = listBuiltinCompiledMethods();
|
|
90
|
+
if (!sourcePath)
|
|
91
|
+
return builtins;
|
|
92
|
+
const methodsById = new Map();
|
|
93
|
+
for (const method of builtins) {
|
|
94
|
+
methodsById.set(method.id, method);
|
|
95
|
+
}
|
|
96
|
+
for (const definition of listLocalMethodDefinitions(sourcePath)) {
|
|
97
|
+
try {
|
|
98
|
+
const method = resolveCompiledMethodFromLocal(definition.id, sourcePath);
|
|
99
|
+
if (method)
|
|
100
|
+
methodsById.set(method.id, method);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
warnInterf(`Warning: skipping local Method "${definition.id}" because it could not be resolved cleanly: ${error instanceof Error ? error.message : String(error)}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return [...methodsById.values()];
|
|
107
|
+
}
|
|
108
|
+
export function getCompiledMethod(methodId, options = {}) {
|
|
109
|
+
const builtin = listBuiltinCompiledMethods().find((candidate) => candidate.id === methodId);
|
|
110
|
+
if (builtin)
|
|
111
|
+
return builtin;
|
|
112
|
+
if (options.sourcePath) {
|
|
113
|
+
const local = resolveCompiledMethodFromLocal(methodId, options.sourcePath);
|
|
114
|
+
if (local)
|
|
115
|
+
return local;
|
|
116
|
+
throw new Error(`No local Method package found for "${methodId}" under ${join(options.sourcePath, "interf", "methods", methodId)}.`);
|
|
117
|
+
}
|
|
118
|
+
throw new Error(`Method "${methodId}" is not built-in. Provide a source path so Interf can resolve a local Method package.`);
|
|
119
|
+
}
|
|
120
|
+
export function getActiveCompiledMethod(compiledPath) {
|
|
121
|
+
const methodPath = methodPackagePathForCompiled(compiledPath);
|
|
122
|
+
if (existsSync(join(methodPath, "method.json"))) {
|
|
123
|
+
const local = loadMethodDefinitionFromDir(methodPath);
|
|
124
|
+
if (!local) {
|
|
125
|
+
throw new Error(`Local Method package at ${methodPath} is missing or invalid. Interf compile runs the local package directly; recreate or reseed this portable context.`);
|
|
126
|
+
}
|
|
127
|
+
return standaloneMethodDefinitionFromLocalPackage(local);
|
|
128
|
+
}
|
|
129
|
+
throw new Error(`Missing local Method package at ${methodPath}. Interf compile runs the local package directly, so recreate or reseed this portable context under ${resolveSourceControlPath(compiledPath)}.`);
|
|
130
|
+
}
|
|
131
|
+
export function resolveCompiledMethodId(value) {
|
|
132
|
+
if (typeof value === "string" && isMethodId(value)) {
|
|
133
|
+
return value;
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
export function resolveCompiledMethodFromConfig(config) {
|
|
138
|
+
if (!config || typeof config !== "object")
|
|
139
|
+
return null;
|
|
140
|
+
const raw = config;
|
|
141
|
+
return resolveCompiledMethodId(raw.method);
|
|
142
|
+
}
|
|
143
|
+
export function resolveRequiredCompiledMethodFromConfig(config, label = "compiled config") {
|
|
144
|
+
const methodId = resolveCompiledMethodFromConfig(config);
|
|
145
|
+
if (!methodId) {
|
|
146
|
+
throw new Error(`Missing or invalid Method in ${label}.`);
|
|
147
|
+
}
|
|
148
|
+
return methodId;
|
|
149
|
+
}
|
|
150
|
+
export function formatCompiledMethodStageStep(methodId, stage, options = {}) {
|
|
151
|
+
return formatMethodStageStep(getCompiledMethod(methodId, options), stage);
|
|
152
|
+
}
|
|
153
|
+
function resolveMethodDefinitionForStageMetadata(methodId, sourcePath) {
|
|
154
|
+
if (sourcePath &&
|
|
155
|
+
existsSync(join(methodPackagePathForCompiled(sourcePath), "method.json"))) {
|
|
156
|
+
return getActiveCompiledMethod(sourcePath);
|
|
157
|
+
}
|
|
158
|
+
return getCompiledMethod(methodId, { sourcePath });
|
|
159
|
+
}
|
|
160
|
+
function formatMethodStageStep(method, stage) {
|
|
161
|
+
const stageIndex = method.stages.findIndex((candidate) => candidate.id === stage);
|
|
162
|
+
if (stageIndex === -1) {
|
|
163
|
+
throw new Error(`Stage "${stage}" is not part of the compiled runtime.`);
|
|
164
|
+
}
|
|
165
|
+
const stageDefinition = method.stages[stageIndex];
|
|
166
|
+
if (!stageDefinition) {
|
|
167
|
+
throw new Error(`Stage "${stage}" is not part of the compiled runtime.`);
|
|
168
|
+
}
|
|
169
|
+
return `Stage ${stageIndex + 1}/${method.stages.length} - ${stageDefinition.label}`;
|
|
170
|
+
}
|
|
171
|
+
export function getMethodStageDefinition(methodId, stage, sourcePath) {
|
|
172
|
+
const method = resolveMethodDefinitionForStageMetadata(methodId, sourcePath);
|
|
173
|
+
return method.stages.find((candidate) => candidate.id === stage) ?? null;
|
|
174
|
+
}
|
|
175
|
+
export function getMethodStagePosition(methodId, stage, sourcePath) {
|
|
176
|
+
const stages = getMethodStages(methodId, sourcePath);
|
|
177
|
+
const stageIndex = stages.findIndex((candidate) => candidate === stage);
|
|
178
|
+
if (stageIndex === -1)
|
|
179
|
+
return null;
|
|
180
|
+
return {
|
|
181
|
+
stageIndex: stageIndex + 1,
|
|
182
|
+
stageTotal: stages.length,
|
|
183
|
+
stages: [...stages],
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
export function getMethodStages(methodId, sourcePath) {
|
|
187
|
+
return resolveMethodDefinitionForStageMetadata(methodId, sourcePath).stages.map((definition) => definition.id);
|
|
188
|
+
}
|
|
189
|
+
export function getActiveCompiledStages(compiledPath) {
|
|
190
|
+
return getActiveCompiledMethod(compiledPath).stages.map((definition) => definition.id);
|
|
191
|
+
}
|
|
192
|
+
export function getMethodStagePolicyNotes(methodId, stage, sourcePath) {
|
|
193
|
+
const method = resolveMethodDefinitionForStageMetadata(methodId, sourcePath);
|
|
194
|
+
return [...(method.stagePolicyNotes?.[stage] ?? [])];
|
|
195
|
+
}
|
|
196
|
+
export function getActiveCompiledStagePolicyNotes(compiledPath, stage) {
|
|
197
|
+
const method = getActiveCompiledMethod(compiledPath);
|
|
198
|
+
return [...(method.stagePolicyNotes?.[stage] ?? [])];
|
|
199
|
+
}
|
|
200
|
+
export function resolveActiveCompiledStageAcceptance(compiledPath, stage) {
|
|
201
|
+
return getActiveCompiledMethod(compiledPath).stages.find((candidate) => candidate.id === stage)?.acceptance;
|
|
202
|
+
}
|
|
203
|
+
export function formatActiveCompiledMethodStageStep(compiledPath, stage) {
|
|
204
|
+
return formatMethodStageStep(getActiveCompiledMethod(compiledPath), stage);
|
|
205
|
+
}
|
package/dist/packages/{workflow-package/workflow-helpers.d.ts → method-package/method-helpers.d.ts}
RENAMED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { type LocalInstructionMode, type RuntimeInstructionMode, type RuntimeStageInstructions } from "../compiler/lib/schema.js";
|
|
2
|
-
import { type
|
|
3
|
-
export interface
|
|
2
|
+
import { type MethodStageDefinition } from "./method-definitions.js";
|
|
3
|
+
export interface MethodReporter {
|
|
4
4
|
line?: (message: string) => void;
|
|
5
5
|
blankLine?: () => void;
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
7
|
+
export interface MethodStageResult {
|
|
8
8
|
ok: boolean;
|
|
9
9
|
code: number;
|
|
10
10
|
summary?: string | null;
|
|
11
11
|
}
|
|
12
|
-
export declare function
|
|
13
|
-
export declare function
|
|
14
|
-
export declare function
|
|
12
|
+
export declare function methodQueryDirectory(): string;
|
|
13
|
+
export declare function methodImproveDirectory(): string;
|
|
14
|
+
export declare function methodCompileStageDirectory(stageDir: string): string;
|
|
15
15
|
export interface LocalSkillContractExtension {
|
|
16
16
|
reads: string[];
|
|
17
17
|
count: number;
|
|
@@ -25,10 +25,10 @@ export declare function buildLocalSkillContractExtension(rootPath: string, direc
|
|
|
25
25
|
export declare function buildLocalSkillContractExtensionRelativeTo(rootPath: string, relativeToPath: string, directories: string[], purpose: string): LocalSkillContractExtension;
|
|
26
26
|
export declare function mergeLocalSkillContractExtensions(extensions: LocalSkillContractExtension[]): LocalSkillContractExtension;
|
|
27
27
|
export declare function buildStageInstructions(stageSkillDir: string, localSkills: LocalSkillContractExtension): RuntimeStageInstructions;
|
|
28
|
-
export declare function reportLine(reporter:
|
|
29
|
-
export declare function reportBlankLine(reporter:
|
|
30
|
-
export declare function reportValidationFailure(reporter:
|
|
31
|
-
export declare function resolveStageAcceptance(
|
|
28
|
+
export declare function reportLine(reporter: MethodReporter | undefined, message: string): void;
|
|
29
|
+
export declare function reportBlankLine(reporter: MethodReporter | undefined): void;
|
|
30
|
+
export declare function reportValidationFailure(reporter: MethodReporter | undefined, summary: string, errors?: string[]): void;
|
|
31
|
+
export declare function resolveStageAcceptance(methodId: string, stageId: string, sourcePath?: string): MethodStageDefinition["acceptance"] | undefined;
|
|
32
32
|
export declare function validateStageOutcome(_dirPath: string, validation: {
|
|
33
33
|
ok: boolean;
|
|
34
34
|
summary: string;
|
package/dist/packages/{workflow-package/workflow-helpers.js → method-package/method-helpers.js}
RENAMED
|
@@ -3,16 +3,16 @@ import { join, relative, sep } from "node:path";
|
|
|
3
3
|
import { listFilesRecursive } from "../shared/filesystem.js";
|
|
4
4
|
import { parseJsonFrontmatter } from "../shared/parse.js";
|
|
5
5
|
import { isMarkdownFile } from "../shared/file-types.js";
|
|
6
|
-
import {
|
|
7
|
-
import { COMPILED_METHOD_DIR,
|
|
6
|
+
import { getCompiledMethod, } from "./method-definitions.js";
|
|
7
|
+
import { COMPILED_METHOD_DIR, methodPackagePathForCompiled } from "../compiler/compiled-paths.js";
|
|
8
8
|
const LOCAL_SKILL_READ_LIMIT = 50;
|
|
9
|
-
export function
|
|
9
|
+
export function methodQueryDirectory() {
|
|
10
10
|
return `${COMPILED_METHOD_DIR}/use/query`;
|
|
11
11
|
}
|
|
12
|
-
export function
|
|
12
|
+
export function methodImproveDirectory() {
|
|
13
13
|
return `${COMPILED_METHOD_DIR}/improve`;
|
|
14
14
|
}
|
|
15
|
-
export function
|
|
15
|
+
export function methodCompileStageDirectory(stageDir) {
|
|
16
16
|
return `${COMPILED_METHOD_DIR}/compile/stages/${stageDir}`;
|
|
17
17
|
}
|
|
18
18
|
export function emptyLocalSkillContractExtension() {
|
|
@@ -40,10 +40,10 @@ function collectLocalSkillDocs(rootPath, directories) {
|
|
|
40
40
|
}
|
|
41
41
|
function collectLocalSkillDocsRelativeTo(rootPath, relativeToPath, directories) {
|
|
42
42
|
const docs = new Map();
|
|
43
|
-
const
|
|
44
|
-
const rootReadme = join(
|
|
43
|
+
const methodRoot = methodPackagePathForCompiled(rootPath);
|
|
44
|
+
const rootReadme = join(methodRoot, "README.md");
|
|
45
45
|
if (existsSync(rootReadme)) {
|
|
46
|
-
const read =
|
|
46
|
+
const read = projectMethodReadPath(rootPath, relativeToPath, rootReadme);
|
|
47
47
|
docs.set(read, {
|
|
48
48
|
read,
|
|
49
49
|
absolutePath: rootReadme,
|
|
@@ -53,7 +53,7 @@ function collectLocalSkillDocsRelativeTo(rootPath, relativeToPath, directories)
|
|
|
53
53
|
for (const directory of directories) {
|
|
54
54
|
const absoluteDirectory = resolveAuthoringDirectory(rootPath, directory);
|
|
55
55
|
for (const filePath of listFilesRecursive(absoluteDirectory, isMarkdownFile)) {
|
|
56
|
-
const read =
|
|
56
|
+
const read = projectMethodReadPath(rootPath, relativeToPath, filePath);
|
|
57
57
|
docs.set(read, {
|
|
58
58
|
read,
|
|
59
59
|
absolutePath: filePath,
|
|
@@ -66,25 +66,21 @@ function collectLocalSkillDocsRelativeTo(rootPath, relativeToPath, directories)
|
|
|
66
66
|
.slice(0, LOCAL_SKILL_READ_LIMIT);
|
|
67
67
|
}
|
|
68
68
|
function resolveAuthoringDirectory(rootPath, directory) {
|
|
69
|
-
if (directory === COMPILED_METHOD_DIR
|
|
70
|
-
return
|
|
69
|
+
if (directory === COMPILED_METHOD_DIR) {
|
|
70
|
+
return methodPackagePathForCompiled(rootPath);
|
|
71
71
|
}
|
|
72
72
|
if (directory.startsWith(`${COMPILED_METHOD_DIR}${sep}`) || directory.startsWith(`${COMPILED_METHOD_DIR}/`)) {
|
|
73
73
|
const relativeMethodPath = directory.replace(/^method[\\/]/, "");
|
|
74
|
-
return join(
|
|
75
|
-
}
|
|
76
|
-
if (directory.startsWith(`workflow${sep}`) || directory.startsWith("workflow/")) {
|
|
77
|
-
const relativeWorkflowPath = directory.replace(/^workflow[\\/]/, "");
|
|
78
|
-
return join(workflowPackagePathForCompiled(rootPath), relativeWorkflowPath);
|
|
74
|
+
return join(methodPackagePathForCompiled(rootPath), relativeMethodPath);
|
|
79
75
|
}
|
|
80
76
|
return join(rootPath, directory);
|
|
81
77
|
}
|
|
82
|
-
function
|
|
83
|
-
const
|
|
84
|
-
const
|
|
85
|
-
if (absolutePath ===
|
|
86
|
-
const
|
|
87
|
-
return relative(relativeToPath, join(rootPath, COMPILED_METHOD_DIR,
|
|
78
|
+
function projectMethodReadPath(rootPath, relativeToPath, absolutePath) {
|
|
79
|
+
const methodRoot = methodPackagePathForCompiled(rootPath);
|
|
80
|
+
const normalizedMethodRoot = `${methodRoot}${sep}`;
|
|
81
|
+
if (absolutePath === methodRoot || absolutePath.startsWith(normalizedMethodRoot)) {
|
|
82
|
+
const relativeMethodPath = relative(methodRoot, absolutePath);
|
|
83
|
+
return relative(relativeToPath, join(rootPath, COMPILED_METHOD_DIR, relativeMethodPath));
|
|
88
84
|
}
|
|
89
85
|
return relative(relativeToPath, absolutePath);
|
|
90
86
|
}
|
|
@@ -116,8 +112,8 @@ function buildContractExtensionFromDocs(docs, directories, purpose) {
|
|
|
116
112
|
notes: [
|
|
117
113
|
readNotice,
|
|
118
114
|
localMode === "override"
|
|
119
|
-
? `${purpose} One or more local docs declare \`mode: override\`, so their
|
|
120
|
-
: `${purpose} These local
|
|
115
|
+
? `${purpose} One or more local docs declare \`mode: override\`, so their Method instructions replace Interf's bundled stage instructions for this run. They still do not bypass coverage proof, evidence weighting, required writes, or deterministic runtime reconciliation.`
|
|
116
|
+
: `${purpose} These local Method docs can refine the stage, but they do not bypass coverage proof, evidence weighting, required writes, or deterministic runtime reconciliation.`,
|
|
121
117
|
],
|
|
122
118
|
localMode,
|
|
123
119
|
effectiveMode: localMode ?? "builtin",
|
|
@@ -163,8 +159,8 @@ export function reportValidationFailure(reporter, summary, errors = []) {
|
|
|
163
159
|
reportLine(reporter, `- ${error}`);
|
|
164
160
|
}
|
|
165
161
|
}
|
|
166
|
-
export function resolveStageAcceptance(
|
|
167
|
-
return
|
|
162
|
+
export function resolveStageAcceptance(methodId, stageId, sourcePath) {
|
|
163
|
+
return getCompiledMethod(methodId, { sourcePath }).stages.find((stage) => stage.id === stageId)?.acceptance;
|
|
168
164
|
}
|
|
169
165
|
export function validateStageOutcome(_dirPath, validation) {
|
|
170
166
|
return validation;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MethodImprovementContext } from "../compiler/lib/schema.js";
|
|
2
|
+
export interface MethodImprovementReviewSourcePaths {
|
|
3
|
+
compiledRuntime: string | null;
|
|
4
|
+
testComparisons: string | null;
|
|
5
|
+
executionShells: string | null;
|
|
6
|
+
targetTestRuns: string | null;
|
|
7
|
+
targetTestSandboxes: string | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function resolveMethodImprovementReviewSourcePaths(compiledPath: string): MethodImprovementReviewSourcePaths;
|
|
10
|
+
export declare function resolveMethodImprovementReviewPaths(compiledPath: string): MethodImprovementContext["review_paths"];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { testRootForCompiled, targetTestRunsRootForCompiled, targetTestSandboxesRootForCompiled, stageExecutionShellsRoot, compiledRuntimeRoot, } from "../compiler/compiled-paths.js";
|
|
4
|
-
export function
|
|
4
|
+
export function resolveMethodImprovementReviewSourcePaths(compiledPath) {
|
|
5
5
|
const compiledRuntime = compiledRuntimeRoot(compiledPath);
|
|
6
6
|
const testComparisons = testRootForCompiled(compiledPath);
|
|
7
7
|
const executionShells = stageExecutionShellsRoot(compiledPath);
|
|
@@ -18,10 +18,10 @@ export function resolveWorkflowImprovementReviewSourcePaths(compiledPath) {
|
|
|
18
18
|
targetTestSandboxes: existsSync(targetTestSandboxes) ? targetTestSandboxes : null,
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
export function
|
|
22
|
-
const sources =
|
|
21
|
+
export function resolveMethodImprovementReviewPaths(compiledPath) {
|
|
22
|
+
const sources = resolveMethodImprovementReviewSourcePaths(compiledPath);
|
|
23
23
|
return {
|
|
24
|
-
|
|
24
|
+
method_root: "method",
|
|
25
25
|
compiled_runtime: sources.compiledRuntime ? "artifacts/compiled-runtime" : null,
|
|
26
26
|
test_comparisons: sources.testComparisons ? "artifacts/test-comparisons" : null,
|
|
27
27
|
execution_shells: sources.executionShells ? "artifacts/execution-shells" : null,
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type
|
|
1
|
+
import { type MethodExecutor } from "../agents/lib/executors.js";
|
|
2
|
+
import { type RuntimeStageInstructions } from "../compiler/lib/schema.js";
|
|
3
|
+
import type { RuntimeContractType } from "../contracts/lib/schema.js";
|
|
3
4
|
import { type RuntimeStageContractDraft } from "../compiler/runtime.js";
|
|
4
|
-
import { type
|
|
5
|
-
interface
|
|
5
|
+
import { type MethodReporter, type MethodStageResult } from "./method-helpers.js";
|
|
6
|
+
interface MethodStageShape<TContractType extends RuntimeContractType> {
|
|
6
7
|
id: string;
|
|
7
8
|
label: string;
|
|
8
9
|
contractType: TContractType;
|
|
9
10
|
}
|
|
10
11
|
interface ExecuteValidatedStageOptions<TContractType extends RuntimeContractType> {
|
|
11
|
-
executor:
|
|
12
|
+
executor: MethodExecutor;
|
|
12
13
|
compiledPath: string;
|
|
13
14
|
executionPath?: string;
|
|
14
15
|
targetName: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
stageDefinition:
|
|
16
|
+
method: string;
|
|
17
|
+
methodSourcePath?: string;
|
|
18
|
+
stageDefinition: MethodStageShape<TContractType>;
|
|
18
19
|
instructions: RuntimeStageInstructions;
|
|
19
20
|
summary: string;
|
|
20
21
|
contract: RuntimeStageContractDraft;
|
|
21
22
|
statusLines: string[];
|
|
22
|
-
reporter?:
|
|
23
|
+
reporter?: MethodReporter;
|
|
23
24
|
completionCheck?: (() => boolean) | null;
|
|
24
25
|
onStatus?: (line: string) => void;
|
|
25
26
|
syncWrites?: (() => void) | null;
|
|
@@ -37,6 +38,6 @@ interface ExecuteValidatedSummarizeStageOptions<TContractType extends RuntimeCon
|
|
|
37
38
|
export declare function findStageByContractType<TStage extends {
|
|
38
39
|
contractType: string;
|
|
39
40
|
}>(stages: TStage[], contractType: TStage["contractType"]): TStage;
|
|
40
|
-
export declare function executeValidatedStage<TContractType extends RuntimeContractType>(options: ExecuteValidatedStageOptions<TContractType>): Promise<
|
|
41
|
-
export declare function executeValidatedSummarizeStage<TContractType extends RuntimeContractType>(options: ExecuteValidatedSummarizeStageOptions<TContractType>): Promise<
|
|
41
|
+
export declare function executeValidatedStage<TContractType extends RuntimeContractType>(options: ExecuteValidatedStageOptions<TContractType>): Promise<MethodStageResult>;
|
|
42
|
+
export declare function executeValidatedSummarizeStage<TContractType extends RuntimeContractType>(options: ExecuteValidatedSummarizeStageOptions<TContractType>): Promise<MethodStageResult>;
|
|
42
43
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { markRuntimeRunSucceededAfterValidation, buildStagePrompt, markRuntimeRunFailedAfterValidation, runExecutorStage, runExecutorSummarizeStage, } from "../compiler/runtime.js";
|
|
2
|
-
import { reportValidationFailure, validateStageOutcome, } from "./
|
|
2
|
+
import { reportValidationFailure, validateStageOutcome, } from "./method-helpers.js";
|
|
3
3
|
export function findStageByContractType(stages, contractType) {
|
|
4
4
|
const stage = stages.find((candidate) => candidate.contractType === contractType);
|
|
5
5
|
if (!stage) {
|
|
6
|
-
throw new Error(`Missing
|
|
6
|
+
throw new Error(`Missing method stage for contract type: ${contractType}`);
|
|
7
7
|
}
|
|
8
8
|
return stage;
|
|
9
9
|
}
|
|
@@ -20,8 +20,8 @@ export async function executeValidatedStage(options) {
|
|
|
20
20
|
compiledPath: options.compiledPath,
|
|
21
21
|
executionPath: options.executionPath,
|
|
22
22
|
compiledName: options.targetName,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
method: options.method,
|
|
24
|
+
methodSourcePath: options.methodSourcePath,
|
|
25
25
|
stage: options.stageDefinition.id,
|
|
26
26
|
stageLabel: options.stageDefinition.label,
|
|
27
27
|
contractType: options.stageDefinition.contractType,
|
|
@@ -46,8 +46,8 @@ export async function executeValidatedSummarizeStage(options) {
|
|
|
46
46
|
compiledPath: options.compiledPath,
|
|
47
47
|
executionPath: options.executionPath,
|
|
48
48
|
compiledName: options.targetName,
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
method: options.method,
|
|
50
|
+
methodSourcePath: options.methodSourcePath,
|
|
51
51
|
stage: options.stageDefinition.id,
|
|
52
52
|
stageLabel: options.stageDefinition.label,
|
|
53
53
|
contractType: options.stageDefinition.contractType,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const DEFAULT_METHOD_ID = "interf-default";
|
|
2
|
+
export interface MethodSelectionLike {
|
|
3
|
+
method?: string | null;
|
|
4
|
+
}
|
|
5
|
+
export declare function methodIdForSourcePreparationConfig(preparationConfig: MethodSelectionLike | null | undefined): string | null;
|
|
6
|
+
export declare function resolveMethodId(selection: MethodSelectionLike | null | undefined, fallback?: string): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const DEFAULT_METHOD_ID = "interf-default";
|
|
2
|
+
export function methodIdForSourcePreparationConfig(preparationConfig) {
|
|
3
|
+
return preparationConfig?.method ?? null;
|
|
4
|
+
}
|
|
5
|
+
export function resolveMethodId(selection, fallback = DEFAULT_METHOD_ID) {
|
|
6
|
+
return methodIdForSourcePreparationConfig(selection) ?? fallback;
|
|
7
|
+
}
|
|
@@ -5,8 +5,5 @@ export * as interf from "./interf.js";
|
|
|
5
5
|
export * as detect from "./interf-detect.js";
|
|
6
6
|
export * as bootstrap from "./interf-bootstrap.js";
|
|
7
7
|
export * as scaffold from "./interf-scaffold.js";
|
|
8
|
-
export * as compiledPaths from "./compiled-paths.js";
|
|
9
8
|
export * as projectPaths from "./project-paths.js";
|
|
10
|
-
export
|
|
11
|
-
export * as compiledReset from "./compiled-reset.js";
|
|
12
|
-
export type { InterfConfig, MethodId, PreparationName, SourceDatasetConfig, SourceFolderBinding, SourcePreparationConfig, SourceReadinessCheck, SourceFolderConfig, } from "./lib/schema.js";
|
|
9
|
+
export type { InterfConfig, MethodId, PreparationName, SourceFolderBinding, SourcePreparationConfig, SourceReadinessCheck, SourceFolderConfig, } from "./lib/schema.js";
|
|
@@ -5,7 +5,4 @@ export * as interf from "./interf.js";
|
|
|
5
5
|
export * as detect from "./interf-detect.js";
|
|
6
6
|
export * as bootstrap from "./interf-bootstrap.js";
|
|
7
7
|
export * as scaffold from "./interf-scaffold.js";
|
|
8
|
-
export * as compiledPaths from "./compiled-paths.js";
|
|
9
8
|
export * as projectPaths from "./project-paths.js";
|
|
10
|
-
export * as compiledRaw from "./compiled-raw.js";
|
|
11
|
-
export * as compiledReset from "./compiled-reset.js";
|
|
@@ -7,13 +7,9 @@ export interface ResolvedCompiled {
|
|
|
7
7
|
}
|
|
8
8
|
export declare const INTERF_CONTAINER_NAME = "interf";
|
|
9
9
|
export declare const METHOD_CONTAINER_NAME = "methods";
|
|
10
|
-
export declare const WORKFLOW_CONTAINER_NAME = "methods";
|
|
11
|
-
export declare const LEGACY_WORKFLOW_CONTAINER_NAME = "workflows";
|
|
12
10
|
export declare const TEST_CONTAINER_NAME = "tests";
|
|
13
11
|
export declare const INTERF_CONFIG_FILE = "interf.json";
|
|
14
12
|
export declare const METHOD_PACKAGE_DIR = "method";
|
|
15
|
-
export declare const WORKFLOW_PACKAGE_DIR = "method";
|
|
16
|
-
export declare const LEGACY_WORKFLOW_PACKAGE_DIR = "workflow";
|
|
17
13
|
export declare function readInterfConfig(dirPath: string): InterfConfig | null;
|
|
18
14
|
export declare function hasSourceFolderInput(config: InterfConfig | null | undefined): config is InterfConfig & {
|
|
19
15
|
source: {
|
|
@@ -28,7 +24,7 @@ export declare function resolveCompiled(cwd: string): ResolvedCompiled | null;
|
|
|
28
24
|
export declare function resolveSourceFolderPath(compiledPath: string, config?: InterfConfig | null): string;
|
|
29
25
|
export declare function resolveSourceControlPath(compiledPath: string): string;
|
|
30
26
|
export declare function resolveSourceInputPath(compiledPath: string): string;
|
|
31
|
-
export declare function
|
|
27
|
+
export declare function listPortableContextsForSourceFolder(sourcePath: string): Array<{
|
|
32
28
|
path: string;
|
|
33
29
|
config: InterfConfig;
|
|
34
30
|
}>;
|
|
@@ -2,19 +2,15 @@ import { existsSync, readdirSync, statSync, } from "node:fs";
|
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { warnInterf } from "../shared/logger.js";
|
|
4
4
|
import { readJsonFileUnchecked } from "../shared/parse.js";
|
|
5
|
-
import {
|
|
5
|
+
import { portableContextPath, projectInterfRoot, } from "./project-paths.js";
|
|
6
6
|
import { resolveSourceControlPathForCompiled, compiledInterfConfigPath, } from "../compiler/compiled-paths.js";
|
|
7
7
|
import { InterfConfigSchema, } from "./lib/schema.js";
|
|
8
8
|
import { assertPathWithinRoot } from "../shared/path-guards.js";
|
|
9
9
|
export const INTERF_CONTAINER_NAME = "interf";
|
|
10
10
|
export const METHOD_CONTAINER_NAME = "methods";
|
|
11
|
-
export const WORKFLOW_CONTAINER_NAME = METHOD_CONTAINER_NAME;
|
|
12
|
-
export const LEGACY_WORKFLOW_CONTAINER_NAME = "workflows";
|
|
13
11
|
export const TEST_CONTAINER_NAME = "tests";
|
|
14
12
|
export const INTERF_CONFIG_FILE = "interf.json";
|
|
15
13
|
export const METHOD_PACKAGE_DIR = "method";
|
|
16
|
-
export const WORKFLOW_PACKAGE_DIR = METHOD_PACKAGE_DIR;
|
|
17
|
-
export const LEGACY_WORKFLOW_PACKAGE_DIR = "workflow";
|
|
18
14
|
export function readInterfConfig(dirPath) {
|
|
19
15
|
const configPath = compiledInterfConfigPath(dirPath);
|
|
20
16
|
if (!existsSync(configPath))
|
|
@@ -67,17 +63,13 @@ export function resolveSourceInputPath(compiledPath) {
|
|
|
67
63
|
const config = readInterfConfig(compiledPath);
|
|
68
64
|
const sourceBinding = typeof config?.source?.preparation_path === "string" && config.source.preparation_path.length > 0
|
|
69
65
|
? config.source.preparation_path
|
|
70
|
-
:
|
|
71
|
-
? config.source.source_folder_path
|
|
72
|
-
: typeof config?.source?.dataset_path === "string" && config.source.dataset_path.length > 0
|
|
73
|
-
? config.source.dataset_path
|
|
74
|
-
: null;
|
|
66
|
+
: null;
|
|
75
67
|
if (sourceBinding) {
|
|
76
68
|
return resolve(compiledPath, sourceBinding);
|
|
77
69
|
}
|
|
78
70
|
throw new Error(`Portable context is missing source.preparation_path in ${compiledInterfConfigPath(compiledPath)}.`);
|
|
79
71
|
}
|
|
80
|
-
export function
|
|
72
|
+
export function listPortableContextsForSourceFolder(sourcePath) {
|
|
81
73
|
const interfRoot = projectInterfRoot(sourcePath);
|
|
82
74
|
if (!existsSync(interfRoot))
|
|
83
75
|
return [];
|
|
@@ -91,11 +83,10 @@ export function listCompiledDatasetsForSourceFolder(sourcePath) {
|
|
|
91
83
|
}
|
|
92
84
|
return readdirSync(interfRoot)
|
|
93
85
|
.filter((entry) => !entry.startsWith(".") &&
|
|
94
|
-
entry !==
|
|
95
|
-
entry !== LEGACY_WORKFLOW_CONTAINER_NAME &&
|
|
86
|
+
entry !== METHOD_CONTAINER_NAME &&
|
|
96
87
|
entry !== TEST_CONTAINER_NAME &&
|
|
97
88
|
entry !== INTERF_CONFIG_FILE)
|
|
98
|
-
.map((entry) =>
|
|
89
|
+
.map((entry) => portableContextPath(sourcePath, entry))
|
|
99
90
|
.filter((compiledPath) => existsSync(compiledPath))
|
|
100
91
|
.map((compiledPath) => {
|
|
101
92
|
const config = readInterfConfig(compiledPath);
|
|
@@ -123,8 +114,7 @@ export function assertCompiledContainer(sourcePath) {
|
|
|
123
114
|
return true;
|
|
124
115
|
}
|
|
125
116
|
}
|
|
126
|
-
if (entry ===
|
|
127
|
-
entry === LEGACY_WORKFLOW_CONTAINER_NAME ||
|
|
117
|
+
if (entry === METHOD_CONTAINER_NAME ||
|
|
128
118
|
entry === TEST_CONTAINER_NAME) {
|
|
129
119
|
try {
|
|
130
120
|
return !statSync(entryPath).isDirectory();
|
|
@@ -167,8 +157,7 @@ export function assertCompiledContainer(sourcePath) {
|
|
|
167
157
|
return true;
|
|
168
158
|
}
|
|
169
159
|
}
|
|
170
|
-
if (entry ===
|
|
171
|
-
entry === LEGACY_WORKFLOW_CONTAINER_NAME ||
|
|
160
|
+
if (entry === METHOD_CONTAINER_NAME ||
|
|
172
161
|
entry === TEST_CONTAINER_NAME)
|
|
173
162
|
return false;
|
|
174
163
|
const entryPath = join(containerPath, entry);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function ensurePortableContextScaffold(sourcePath: string,
|
|
2
|
-
export declare function createCompiled(name: string, sourcePath: string,
|
|
1
|
+
export declare function ensurePortableContextScaffold(sourcePath: string, preparationName: string, methodId?: string): string;
|
|
2
|
+
export declare function createCompiled(name: string, sourcePath: string, methodId?: string, about?: string, sourceFolderPath?: string): string;
|
|
3
3
|
export declare function defaultCompiledNameForSource(sourcePath: string): string;
|