@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
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import { renderCompiledQuerySkill } from "../agents/lib/shells.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { CONTEXT_INTERFACE_FILE,
|
|
7
|
-
import {
|
|
8
|
-
import { mergeStagePolicyNotesForStages } from "./
|
|
9
|
-
function
|
|
10
|
-
return
|
|
4
|
+
import { copyMethodPackageDirectory, isPortableMethodPackage, patchMethodPackageMetadata, resolveMethodPackageSourcePath, methodDefinitionPath, } from "./local-methods.js";
|
|
5
|
+
import { getCompiledMethod, } from "./method-definitions.js";
|
|
6
|
+
import { CONTEXT_INTERFACE_FILE, deriveMethodInputsFromContextInterface, summarizeContextInterface, writeContextInterface, writeContextInterfaceFile, } from "./context-interface.js";
|
|
7
|
+
import { methodPackagePathForCompiled } from "../compiler/compiled-paths.js";
|
|
8
|
+
import { mergeStagePolicyNotesForStages } from "./method-stage-policy.js";
|
|
9
|
+
function methodPackagePath(dirPath) {
|
|
10
|
+
return methodPackagePathForCompiled(dirPath);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function writeMethodStarterDocs(dirPath, docs, options) {
|
|
13
13
|
for (const doc of docs ?? []) {
|
|
14
14
|
const targetPath = join(dirPath, doc.relativePath);
|
|
15
15
|
if (!options.overwrite && existsSync(targetPath))
|
|
@@ -18,32 +18,32 @@ function writeWorkflowStarterDocs(dirPath, docs, options) {
|
|
|
18
18
|
writeFileSync(targetPath, doc.content);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const targetPath = join(rootPath, "
|
|
21
|
+
function writeMethodPackageJson(rootPath, method, options) {
|
|
22
|
+
const targetPath = join(rootPath, "method.json");
|
|
23
23
|
if (!options.overwrite && existsSync(targetPath))
|
|
24
24
|
return;
|
|
25
|
-
const inputs =
|
|
26
|
-
?
|
|
27
|
-
:
|
|
25
|
+
const inputs = method.inputs?.length
|
|
26
|
+
? method.inputs
|
|
27
|
+
: deriveMethodInputsFromContextInterface(method.contextInterface ?? method.schema);
|
|
28
28
|
writeFileSync(targetPath, `${JSON.stringify({
|
|
29
|
-
id:
|
|
29
|
+
id: method.id,
|
|
30
30
|
type: "compiled",
|
|
31
|
-
compiler_api:
|
|
31
|
+
compiler_api: method.compilerApi ?? {
|
|
32
32
|
kind: "compiled",
|
|
33
33
|
version: 1,
|
|
34
34
|
},
|
|
35
|
-
...(
|
|
35
|
+
...(method.purpose
|
|
36
36
|
? {
|
|
37
37
|
purpose: {
|
|
38
|
-
label:
|
|
39
|
-
task_hint:
|
|
38
|
+
label: method.purpose.label,
|
|
39
|
+
task_hint: method.purpose.taskHint,
|
|
40
40
|
},
|
|
41
41
|
}
|
|
42
42
|
: {}),
|
|
43
43
|
...(inputs.length > 0 ? { inputs } : {}),
|
|
44
|
-
label:
|
|
45
|
-
hint:
|
|
46
|
-
stages:
|
|
44
|
+
label: method.label,
|
|
45
|
+
hint: method.hint,
|
|
46
|
+
stages: method.stages.map((stage) => ({
|
|
47
47
|
id: stage.id,
|
|
48
48
|
label: stage.label,
|
|
49
49
|
description: stage.description,
|
|
@@ -53,12 +53,12 @@ function writeWorkflowPackageJson(rootPath, workflow, options) {
|
|
|
53
53
|
writes: stage.writes,
|
|
54
54
|
...(stage.acceptance ? { acceptance: stage.acceptance } : {}),
|
|
55
55
|
})),
|
|
56
|
-
...(
|
|
56
|
+
...(method.stagePolicyNotes ? { stage_policy_notes: method.stagePolicyNotes } : {}),
|
|
57
57
|
}, null, 2)}\n`);
|
|
58
58
|
}
|
|
59
|
-
function
|
|
60
|
-
const contextInterface =
|
|
61
|
-
const stageLines =
|
|
59
|
+
function renderMethodReadme(method) {
|
|
60
|
+
const contextInterface = method.contextInterface ?? method.schema ?? null;
|
|
61
|
+
const stageLines = method.stages
|
|
62
62
|
.map((stage) => `- \`${stage.id}\` — ${stage.description} (${stage.contractType}; reads: ${stage.reads.join(", ")}; writes: ${stage.writes.join(", ")})`)
|
|
63
63
|
.join("\n");
|
|
64
64
|
const interfaceSummary = contextInterface
|
|
@@ -69,9 +69,9 @@ function renderWorkflowReadme(workflow) {
|
|
|
69
69
|
.map((zone) => `- \`${zone.id}\` — ${zone.role} ${zone.kind} at \`${zone.path}\`: ${zone.description}`)
|
|
70
70
|
.join("\n")
|
|
71
71
|
: null;
|
|
72
|
-
const inputs =
|
|
73
|
-
?
|
|
74
|
-
:
|
|
72
|
+
const inputs = method.inputs?.length
|
|
73
|
+
? method.inputs
|
|
74
|
+
: deriveMethodInputsFromContextInterface(contextInterface);
|
|
75
75
|
const inputLines = inputs.length > 0
|
|
76
76
|
? inputs
|
|
77
77
|
.map((input) => `- \`${input.id}\` — ${input.label}: ${input.description}${input.required ? " (required)" : ""}${input.examples?.length ? ` Example inputs: ${input.examples.join("; ")}` : ""}`)
|
|
@@ -86,16 +86,16 @@ function renderWorkflowReadme(workflow) {
|
|
|
86
86
|
].join("\n")
|
|
87
87
|
: null;
|
|
88
88
|
return [
|
|
89
|
-
`# ${
|
|
89
|
+
`# ${method.label}`,
|
|
90
90
|
"",
|
|
91
|
-
|
|
92
|
-
...(
|
|
91
|
+
method.hint,
|
|
92
|
+
...(method.purpose
|
|
93
93
|
? [
|
|
94
94
|
"",
|
|
95
95
|
"## Purpose",
|
|
96
96
|
"",
|
|
97
|
-
`- ${
|
|
98
|
-
`- ${
|
|
97
|
+
`- ${method.purpose.label}`,
|
|
98
|
+
`- ${method.purpose.taskHint}`,
|
|
99
99
|
]
|
|
100
100
|
: []),
|
|
101
101
|
...(inputLines
|
|
@@ -125,11 +125,11 @@ function renderWorkflowReadme(workflow) {
|
|
|
125
125
|
"",
|
|
126
126
|
"## Package",
|
|
127
127
|
"",
|
|
128
|
-
"- `
|
|
129
|
-
"- `
|
|
128
|
+
"- `method.json` = stage graph, compiler API target, and compile contract mapping",
|
|
129
|
+
"- `method.schema.json` = deterministic context interface for the Method package",
|
|
130
130
|
"- `improve/`, `compile/stages/`, and `use/query/` = human-readable authoring docs",
|
|
131
|
-
"- Portable
|
|
132
|
-
"- Interf projects native agent shells from these docs for query use, stage execution, and
|
|
131
|
+
"- Portable Method packages are standalone: explicit stages, schema, and docs live together in this folder",
|
|
132
|
+
"- Interf projects native agent shells from these docs for query use, stage execution, and Method-improvement loops",
|
|
133
133
|
"",
|
|
134
134
|
"## Stages",
|
|
135
135
|
"",
|
|
@@ -139,14 +139,14 @@ function renderWorkflowReadme(workflow) {
|
|
|
139
139
|
"",
|
|
140
140
|
].join("\n");
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function renderDerivedMethodReadme(options) {
|
|
143
143
|
return [
|
|
144
144
|
`# ${options.label}`,
|
|
145
145
|
"",
|
|
146
146
|
options.hint,
|
|
147
147
|
"",
|
|
148
|
-
`This
|
|
149
|
-
"It starts with that
|
|
148
|
+
`This Method package was forked from \`${options.baseMethodId}\` and materialized as a standalone package for this kind of agent work.`,
|
|
149
|
+
"It starts with that Method's topology; edit the package when the agent work needs different stages, zones, or proof.",
|
|
150
150
|
"",
|
|
151
151
|
"Interf runs the local copy of this package directly. Keep purpose, inputs, context interface, and stage docs self-contained in this folder instead of relying on runtime inheritance.",
|
|
152
152
|
"",
|
|
@@ -158,58 +158,58 @@ function renderDerivedWorkflowReadme(options) {
|
|
|
158
158
|
"",
|
|
159
159
|
].join("\n");
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function renderSeedMethodReadme(options) {
|
|
162
162
|
return [
|
|
163
163
|
`# ${options.label}`,
|
|
164
164
|
"",
|
|
165
165
|
options.hint,
|
|
166
166
|
"",
|
|
167
|
-
`This
|
|
168
|
-
"It starts with that
|
|
167
|
+
`This Method package was forked from \`${options.baseMethodId}\` as a standalone local package.`,
|
|
168
|
+
"It starts with that Method's topology; edit the package when the agent work needs different stages, zones, or proof.",
|
|
169
169
|
"",
|
|
170
170
|
"Interf runs the local copy of this package directly. Refine purpose, inputs, context interface, and stage instructions in this folder instead of relying on inheritance.",
|
|
171
171
|
"",
|
|
172
172
|
].join("\n");
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function renderScratchMethodReadme(options) {
|
|
175
175
|
return [
|
|
176
176
|
`# ${options.label}`,
|
|
177
177
|
"",
|
|
178
178
|
options.hint,
|
|
179
179
|
"",
|
|
180
|
-
"This
|
|
180
|
+
"This Method package is a neutral from-scratch authoring scaffold.",
|
|
181
181
|
"",
|
|
182
182
|
"It is not copied from `interf-default`, and its placeholder stage is not a recommended topology.",
|
|
183
|
-
"Replace purpose, inputs, context interface, stages, stage docs, proof rules, and query guidance with the
|
|
183
|
+
"Replace purpose, inputs, context interface, stages, stage docs, proof rules, and query guidance with the Method this source data and task actually need.",
|
|
184
184
|
"",
|
|
185
185
|
].join("\n");
|
|
186
186
|
}
|
|
187
|
-
function renderImproveSkill(
|
|
187
|
+
function renderImproveSkill(method) {
|
|
188
188
|
return [
|
|
189
|
-
"#
|
|
189
|
+
"# Method Improvement",
|
|
190
190
|
"",
|
|
191
|
-
`
|
|
191
|
+
`Method: ${method.id}`,
|
|
192
192
|
"",
|
|
193
|
-
"This file is the editable authoring source for Interf's generated native
|
|
193
|
+
"This file is the editable authoring source for Interf's generated native Method-improver shell.",
|
|
194
194
|
"The improver edits this local package directly.",
|
|
195
195
|
"",
|
|
196
196
|
"Default loop:",
|
|
197
197
|
"1. Read the loop context first.",
|
|
198
198
|
"2. Review preserved stage shells, runtime logs, and saved test runs from failed attempts.",
|
|
199
|
-
"3. Edit only the local Method package for this portable context to create a better Method variation for this kind of work.",
|
|
200
|
-
`4. Keep purpose, inputs, \`
|
|
199
|
+
"3. Edit only the local Method package for this portable context to create a better Method variation for this kind of agent work.",
|
|
200
|
+
`4. Keep purpose, inputs, \`method.json\`, \`${CONTEXT_INTERFACE_FILE}\`, and any changed stage docs aligned.`,
|
|
201
201
|
"",
|
|
202
202
|
"Guardrails:",
|
|
203
203
|
"- do not edit checks, test specs, or raw files",
|
|
204
|
-
"- do not hardcode expected answers into
|
|
205
|
-
"- keep this package standalone; do not
|
|
206
|
-
"- keep the
|
|
207
|
-
"- prefer small, defensible
|
|
204
|
+
"- do not hardcode expected answers into Method docs",
|
|
205
|
+
"- keep this package standalone; do not rely on runtime inheritance",
|
|
206
|
+
"- keep the Method stack coherent: purpose, inputs, context interface, and stages should describe the same job",
|
|
207
|
+
"- prefer small, defensible Method changes over random churn",
|
|
208
208
|
"",
|
|
209
209
|
].join("\n");
|
|
210
210
|
}
|
|
211
|
-
function renderStageSkill(
|
|
212
|
-
const notes =
|
|
211
|
+
function renderStageSkill(method, stage) {
|
|
212
|
+
const notes = method.stagePolicyNotes?.[stage.id] ?? [];
|
|
213
213
|
const acceptanceKeys = stage.acceptance ? Object.keys(stage.acceptance) : [];
|
|
214
214
|
const abstractRules = stage.contractType === "compiled-file-evidence"
|
|
215
215
|
? [
|
|
@@ -232,11 +232,11 @@ function renderStageSkill(workflow, stage) {
|
|
|
232
232
|
"",
|
|
233
233
|
"## Requirements",
|
|
234
234
|
"",
|
|
235
|
-
"- Treat `
|
|
235
|
+
"- Treat `method.json` and `method.schema.json` as the authoritative package contract for this stage.",
|
|
236
236
|
"- Read only from the declared input zones unless this package explicitly documents a broader method.",
|
|
237
237
|
"- Write only inside the declared output zones for this stage. Do not invent undeclared zones or implicit outputs.",
|
|
238
|
-
"- Keep stage instructions, zone ownership, and
|
|
239
|
-
"- Treat runtime files as proof and execution state, not as the source of truth for
|
|
238
|
+
"- Keep stage instructions, zone ownership, and Method-level acceptance aligned when you change this stage.",
|
|
239
|
+
"- Treat runtime files as proof and execution state, not as the source of truth for Method behavior.",
|
|
240
240
|
"- Prefer direct file-reading and search tools over shell commands for routine file inspection.",
|
|
241
241
|
...abstractRules,
|
|
242
242
|
"",
|
|
@@ -258,95 +258,95 @@ function renderStageSkill(workflow, stage) {
|
|
|
258
258
|
: []),
|
|
259
259
|
].join("\n");
|
|
260
260
|
}
|
|
261
|
-
export function
|
|
262
|
-
|
|
261
|
+
export function writeCompiledMethodPackage(compiledPath, method) {
|
|
262
|
+
writeMethodPackageToDir(methodPackagePath(compiledPath), method);
|
|
263
263
|
}
|
|
264
|
-
export function
|
|
264
|
+
export function writeMethodPackageToDir(methodDir, method, options = {}) {
|
|
265
265
|
const overwrite = options.overwrite ?? true;
|
|
266
|
-
mkdirSync(join(
|
|
267
|
-
mkdirSync(join(
|
|
268
|
-
mkdirSync(join(
|
|
269
|
-
for (const stage of
|
|
270
|
-
mkdirSync(join(
|
|
266
|
+
mkdirSync(join(methodDir, "improve"), { recursive: true });
|
|
267
|
+
mkdirSync(join(methodDir, "use", "query"), { recursive: true });
|
|
268
|
+
mkdirSync(join(methodDir, "compile", "stages"), { recursive: true });
|
|
269
|
+
for (const stage of method.stages) {
|
|
270
|
+
mkdirSync(join(methodDir, "compile", "stages", stage.skillDir), { recursive: true });
|
|
271
271
|
}
|
|
272
|
-
|
|
273
|
-
if (overwrite || !existsSync(join(
|
|
274
|
-
const contextInterface =
|
|
272
|
+
writeMethodPackageJson(methodDir, method, { overwrite });
|
|
273
|
+
if (overwrite || !existsSync(join(methodDir, CONTEXT_INTERFACE_FILE))) {
|
|
274
|
+
const contextInterface = method.contextInterface ?? method.schema;
|
|
275
275
|
if (contextInterface) {
|
|
276
|
-
writeContextInterface(
|
|
276
|
+
writeContextInterface(methodDir, {
|
|
277
277
|
...contextInterface,
|
|
278
|
-
label: contextInterface.label || `${
|
|
278
|
+
label: contextInterface.label || `${method.label} Method schema`,
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
else {
|
|
282
|
-
writeContextInterfaceFile(
|
|
282
|
+
writeContextInterfaceFile(methodDir, method.stages, `${method.label} Method schema`);
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
-
if (overwrite || !existsSync(join(
|
|
286
|
-
writeFileSync(join(
|
|
285
|
+
if (overwrite || !existsSync(join(methodDir, "README.md"))) {
|
|
286
|
+
writeFileSync(join(methodDir, "README.md"), renderMethodReadme(method));
|
|
287
287
|
}
|
|
288
|
-
if (overwrite || !existsSync(join(
|
|
289
|
-
writeFileSync(join(
|
|
288
|
+
if (overwrite || !existsSync(join(methodDir, "improve", "SKILL.md"))) {
|
|
289
|
+
writeFileSync(join(methodDir, "improve", "SKILL.md"), renderImproveSkill(method));
|
|
290
290
|
}
|
|
291
|
-
if (overwrite || !existsSync(join(
|
|
292
|
-
writeFileSync(join(
|
|
291
|
+
if (overwrite || !existsSync(join(methodDir, "use", "query", "SKILL.md"))) {
|
|
292
|
+
writeFileSync(join(methodDir, "use", "query", "SKILL.md"), renderCompiledQuerySkill());
|
|
293
293
|
}
|
|
294
|
-
for (const stage of
|
|
295
|
-
const targetPath = join(
|
|
294
|
+
for (const stage of method.stages) {
|
|
295
|
+
const targetPath = join(methodDir, "compile", "stages", stage.skillDir, "SKILL.md");
|
|
296
296
|
if (overwrite || !existsSync(targetPath)) {
|
|
297
|
-
writeFileSync(targetPath, renderStageSkill(
|
|
297
|
+
writeFileSync(targetPath, renderStageSkill(method, stage));
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
-
|
|
300
|
+
writeMethodStarterDocs(methodDir, method.starterDocs, { overwrite });
|
|
301
301
|
}
|
|
302
|
-
export function
|
|
303
|
-
const
|
|
302
|
+
export function seedCompiledMethodPackage(options) {
|
|
303
|
+
const resolvedMethod = getCompiledMethod(options.methodId, {
|
|
304
304
|
sourcePath: options.sourcePath,
|
|
305
305
|
});
|
|
306
|
-
const
|
|
307
|
-
if (
|
|
306
|
+
const sourceMethodPath = resolveMethodPackageSourcePath(options.sourcePath, resolvedMethod.id);
|
|
307
|
+
if (sourceMethodPath && isPortableMethodPackage(sourceMethodPath)) {
|
|
308
308
|
// Portable seed packages can be copied directly because compile runs the
|
|
309
|
-
// local package folder without reading source-root
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
id:
|
|
313
|
-
inputs:
|
|
314
|
-
label:
|
|
315
|
-
hint:
|
|
316
|
-
stagePolicyNotes:
|
|
309
|
+
// local package folder without reading source-root Method packages.
|
|
310
|
+
copyMethodPackageDirectory(sourceMethodPath, methodPackagePath(options.compiledPath));
|
|
311
|
+
patchMethodPackageMetadata(methodPackagePath(options.compiledPath), {
|
|
312
|
+
id: resolvedMethod.id,
|
|
313
|
+
inputs: resolvedMethod.inputs,
|
|
314
|
+
label: resolvedMethod.label,
|
|
315
|
+
hint: resolvedMethod.hint,
|
|
316
|
+
stagePolicyNotes: resolvedMethod.stagePolicyNotes,
|
|
317
317
|
});
|
|
318
|
-
if (
|
|
319
|
-
writeFileSync(join(
|
|
318
|
+
if (resolvedMethod.scope === "builtin") {
|
|
319
|
+
writeFileSync(join(methodPackagePath(options.compiledPath), "README.md"), renderMethodReadme(resolvedMethod));
|
|
320
320
|
}
|
|
321
321
|
return;
|
|
322
322
|
}
|
|
323
323
|
// Legacy or partially-defined seed packages are resolved once and
|
|
324
324
|
// materialized into a standalone local package.
|
|
325
|
-
|
|
325
|
+
writeCompiledMethodPackage(options.compiledPath, resolvedMethod);
|
|
326
326
|
}
|
|
327
|
-
export function
|
|
328
|
-
const targetPath =
|
|
327
|
+
export function createLocalMethodPackageFromTemplate(options) {
|
|
328
|
+
const targetPath = seedLocalMethodPackageFromBase({
|
|
329
329
|
sourcePath: options.sourcePath,
|
|
330
|
-
|
|
331
|
-
|
|
330
|
+
baseMethodId: options.baseMethodId,
|
|
331
|
+
methodId: options.methodId,
|
|
332
332
|
label: options.label,
|
|
333
333
|
hint: options.hint,
|
|
334
334
|
});
|
|
335
|
-
const
|
|
335
|
+
const baseMethod = getCompiledMethod(options.baseMethodId, {
|
|
336
336
|
sourcePath: options.sourcePath,
|
|
337
337
|
});
|
|
338
|
-
const stagePolicyNotes = mergeStagePolicyNotesForStages(
|
|
339
|
-
|
|
340
|
-
id: options.
|
|
338
|
+
const stagePolicyNotes = mergeStagePolicyNotesForStages(baseMethod.stages, baseMethod.stagePolicyNotes, options.stagePolicyNotes);
|
|
339
|
+
patchMethodPackageMetadata(targetPath, {
|
|
340
|
+
id: options.methodId,
|
|
341
341
|
label: options.label,
|
|
342
342
|
hint: options.hint,
|
|
343
343
|
stagePolicyNotes,
|
|
344
344
|
});
|
|
345
|
-
writeFileSync(join(targetPath, "README.md"),
|
|
345
|
+
writeFileSync(join(targetPath, "README.md"), renderDerivedMethodReadme({
|
|
346
346
|
label: options.label,
|
|
347
347
|
hint: options.hint,
|
|
348
|
-
|
|
349
|
-
emphasis:
|
|
348
|
+
baseMethodId: options.baseMethodId,
|
|
349
|
+
emphasis: baseMethod.stages
|
|
350
350
|
.map((stage) => ({
|
|
351
351
|
stageId: stage.id,
|
|
352
352
|
label: stage.label,
|
|
@@ -356,33 +356,33 @@ export function createLocalWorkflowPackageFromTemplate(options) {
|
|
|
356
356
|
}));
|
|
357
357
|
return targetPath;
|
|
358
358
|
}
|
|
359
|
-
export function
|
|
360
|
-
const
|
|
359
|
+
export function seedLocalMethodPackageFromBase(options) {
|
|
360
|
+
const baseMethod = getCompiledMethod(options.baseMethodId, {
|
|
361
361
|
sourcePath: options.sourcePath,
|
|
362
362
|
});
|
|
363
|
-
const
|
|
364
|
-
const targetPath =
|
|
365
|
-
if (
|
|
363
|
+
const sourceMethodPath = resolveMethodPackageSourcePath(options.sourcePath, options.baseMethodId);
|
|
364
|
+
const targetPath = methodDefinitionPath(options.sourcePath, options.methodId);
|
|
365
|
+
if (sourceMethodPath && isPortableMethodPackage(sourceMethodPath)) {
|
|
366
366
|
// Copy directly when the base package is already portable and standalone.
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
id: options.
|
|
370
|
-
inputs:
|
|
367
|
+
copyMethodPackageDirectory(sourceMethodPath, targetPath);
|
|
368
|
+
patchMethodPackageMetadata(targetPath, {
|
|
369
|
+
id: options.methodId,
|
|
370
|
+
inputs: baseMethod.inputs,
|
|
371
371
|
label: options.label,
|
|
372
372
|
hint: options.hint,
|
|
373
373
|
});
|
|
374
|
-
writeFileSync(join(targetPath, "README.md"),
|
|
374
|
+
writeFileSync(join(targetPath, "README.md"), renderSeedMethodReadme({
|
|
375
375
|
label: options.label,
|
|
376
376
|
hint: options.hint,
|
|
377
|
-
|
|
377
|
+
baseMethodId: options.baseMethodId,
|
|
378
378
|
}));
|
|
379
379
|
return targetPath;
|
|
380
380
|
}
|
|
381
|
-
//
|
|
382
|
-
//
|
|
383
|
-
const
|
|
384
|
-
...
|
|
385
|
-
id: options.
|
|
381
|
+
// Base packages are materialized immediately so the new local Method package
|
|
382
|
+
// is standalone from its first write.
|
|
383
|
+
const localMethod = {
|
|
384
|
+
...baseMethod,
|
|
385
|
+
id: options.methodId,
|
|
386
386
|
label: options.label,
|
|
387
387
|
hint: options.hint,
|
|
388
388
|
recommended: false,
|
|
@@ -390,29 +390,29 @@ export function seedLocalWorkflowPackageFromBase(options) {
|
|
|
390
390
|
starterDocs: [
|
|
391
391
|
{
|
|
392
392
|
relativePath: "README.md",
|
|
393
|
-
content:
|
|
393
|
+
content: renderSeedMethodReadme({
|
|
394
394
|
label: options.label,
|
|
395
395
|
hint: options.hint,
|
|
396
|
-
|
|
396
|
+
baseMethodId: options.baseMethodId,
|
|
397
397
|
}),
|
|
398
398
|
},
|
|
399
|
-
...(
|
|
399
|
+
...(baseMethod.starterDocs ?? []).filter((doc) => doc.relativePath !== "README.md"),
|
|
400
400
|
],
|
|
401
401
|
};
|
|
402
|
-
|
|
402
|
+
writeMethodPackageToDir(targetPath, localMethod);
|
|
403
403
|
return targetPath;
|
|
404
404
|
}
|
|
405
|
-
export function
|
|
406
|
-
const targetPath =
|
|
407
|
-
const
|
|
408
|
-
id: options.
|
|
405
|
+
export function createScratchLocalMethodPackage(options) {
|
|
406
|
+
const targetPath = methodDefinitionPath(options.sourcePath, options.methodId);
|
|
407
|
+
const method = {
|
|
408
|
+
id: options.methodId,
|
|
409
409
|
compilerApi: {
|
|
410
410
|
kind: "compiled",
|
|
411
411
|
version: 1,
|
|
412
412
|
},
|
|
413
413
|
purpose: {
|
|
414
|
-
label: "From-scratch
|
|
415
|
-
taskHint: "Replace this neutral scaffold with the
|
|
414
|
+
label: "From-scratch Method draft",
|
|
415
|
+
taskHint: "Replace this neutral scaffold with the Method stages, outputs, and proof rules this agent work requires.",
|
|
416
416
|
},
|
|
417
417
|
inputs: [
|
|
418
418
|
{
|
|
@@ -427,10 +427,10 @@ export function createScratchLocalWorkflowPackage(options) {
|
|
|
427
427
|
recommended: false,
|
|
428
428
|
scope: "local",
|
|
429
429
|
contextInterface: {
|
|
430
|
-
kind: "
|
|
430
|
+
kind: "method-schema",
|
|
431
431
|
version: 1,
|
|
432
432
|
target_type: "compiled",
|
|
433
|
-
label: `${options.label}
|
|
433
|
+
label: `${options.label} Method schema`,
|
|
434
434
|
zones: [
|
|
435
435
|
{
|
|
436
436
|
id: "raw",
|
|
@@ -465,8 +465,8 @@ export function createScratchLocalWorkflowPackage(options) {
|
|
|
465
465
|
{
|
|
466
466
|
id: "prepare",
|
|
467
467
|
label: "Prepare",
|
|
468
|
-
description: "Neutral placeholder stage for
|
|
469
|
-
contractType: "
|
|
468
|
+
description: "Neutral placeholder stage for Method authoring. Replace this stage with the topology this agent work needs.",
|
|
469
|
+
contractType: "method-draft-stage",
|
|
470
470
|
skillDir: "prepare",
|
|
471
471
|
reads: ["raw", "runtime"],
|
|
472
472
|
writes: ["draft-context"],
|
|
@@ -477,20 +477,20 @@ export function createScratchLocalWorkflowPackage(options) {
|
|
|
477
477
|
],
|
|
478
478
|
stagePolicyNotes: {
|
|
479
479
|
prepare: [
|
|
480
|
-
"This is a neutral authoring scaffold, not a recommended
|
|
481
|
-
"Replace this stage, output zone, and proof rule when drafting the final
|
|
480
|
+
"This is a neutral authoring scaffold, not a recommended method topology.",
|
|
481
|
+
"Replace this stage, output zone, and proof rule when drafting the final method.",
|
|
482
482
|
],
|
|
483
483
|
},
|
|
484
484
|
starterDocs: [
|
|
485
485
|
{
|
|
486
486
|
relativePath: "README.md",
|
|
487
|
-
content:
|
|
487
|
+
content: renderScratchMethodReadme({
|
|
488
488
|
label: options.label,
|
|
489
489
|
hint: options.hint,
|
|
490
490
|
}),
|
|
491
491
|
},
|
|
492
492
|
],
|
|
493
493
|
};
|
|
494
|
-
|
|
494
|
+
writeMethodPackageToDir(targetPath, method);
|
|
495
495
|
return targetPath;
|
|
496
496
|
}
|
|
@@ -2,5 +2,5 @@ import { dirname, join } from "node:path";
|
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
const __filename = fileURLToPath(import.meta.url);
|
|
4
4
|
const __dirname = dirname(__filename);
|
|
5
|
-
// Package root (dist/packages/
|
|
5
|
+
// Package root (dist/packages/method-package/lib/ -> package root)
|
|
6
6
|
export const PACKAGE_ROOT = join(__dirname, "..", "..", "..", "..");
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { MethodCompilerApiSchema, RuntimeStageAcceptanceSchema, MethodPurposeSchema, MethodStageZoneAccessSchema } from "../compiler/lib/schema.js";
|
|
3
|
+
import { RuntimeContractTypeSchema } from "../contracts/lib/schema.js";
|
|
4
|
+
import { MethodInputSpecSchema, type ContextInterface, type MethodInputSpec } from "./context-interface.js";
|
|
5
|
+
export interface LocalMethodStarterDoc {
|
|
6
|
+
relativePath: string;
|
|
7
|
+
content: string;
|
|
8
|
+
}
|
|
9
|
+
export interface LocalMethodStageDefinition {
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
contract_type: z.infer<typeof RuntimeContractTypeSchema>;
|
|
13
|
+
skill_dir?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
reads: z.infer<typeof MethodStageZoneAccessSchema>;
|
|
16
|
+
writes: z.infer<typeof MethodStageZoneAccessSchema>;
|
|
17
|
+
acceptance?: z.infer<typeof RuntimeStageAcceptanceSchema>;
|
|
18
|
+
}
|
|
19
|
+
export interface LocalMethodDefinition {
|
|
20
|
+
id: string;
|
|
21
|
+
type: "compiled";
|
|
22
|
+
compiler_api?: z.infer<typeof MethodCompilerApiSchema>;
|
|
23
|
+
purpose?: z.infer<typeof MethodPurposeSchema>;
|
|
24
|
+
inputs?: Array<z.infer<typeof MethodInputSpecSchema>>;
|
|
25
|
+
label: string;
|
|
26
|
+
hint: string;
|
|
27
|
+
stages?: LocalMethodStageDefinition[];
|
|
28
|
+
stage_policy_notes?: Record<string, string[]>;
|
|
29
|
+
method_schema: ContextInterface;
|
|
30
|
+
starter_docs: LocalMethodStarterDoc[];
|
|
31
|
+
directoryPath: string;
|
|
32
|
+
methodPath: string;
|
|
33
|
+
methodSchemaPath: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function methodDefinitionPath(sourcePath: string, id: string): string;
|
|
36
|
+
export declare function loadMethodDefinitionFromDir(dirPath: string): LocalMethodDefinition | null;
|
|
37
|
+
export declare function listLocalMethodDefinitions(sourcePath: string): LocalMethodDefinition[];
|
|
38
|
+
export declare function loadLocalMethodDefinition(sourcePath: string, id: string): LocalMethodDefinition | null;
|
|
39
|
+
export declare function resolveMethodPackageSourcePath(sourcePath: string, methodId: string): string | null;
|
|
40
|
+
export declare function seedLocalDefaultMethod(options: {
|
|
41
|
+
sourcePath: string;
|
|
42
|
+
}): {
|
|
43
|
+
methodId: string;
|
|
44
|
+
targetPath: string;
|
|
45
|
+
alreadyExisted: boolean;
|
|
46
|
+
};
|
|
47
|
+
export declare function isMethodId(value: string): boolean;
|
|
48
|
+
export declare function patchMethodPackageMetadata(dirPath: string, options?: {
|
|
49
|
+
id?: string;
|
|
50
|
+
inputs?: MethodInputSpec[];
|
|
51
|
+
label?: string;
|
|
52
|
+
hint?: string;
|
|
53
|
+
stagePolicyNotes?: Record<string, string[]>;
|
|
54
|
+
}): void;
|
|
55
|
+
export declare function describeMethodPackagePortability(dirPath: string): string[];
|
|
56
|
+
export declare function isPortableMethodPackage(dirPath: string): boolean;
|
|
57
|
+
export declare function copyMethodPackageDirectory(sourceMethodPath: string, targetMethodPath: string): void;
|
|
58
|
+
export interface MethodValidationResult {
|
|
59
|
+
ok: boolean;
|
|
60
|
+
summary: string;
|
|
61
|
+
errors: string[];
|
|
62
|
+
counts: Record<string, number>;
|
|
63
|
+
}
|
|
64
|
+
export declare function validateMethodPackage(dirPath: string): MethodValidationResult;
|