@interf/compiler 0.7.3 → 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 +124 -90
- package/TRADEMARKS.md +1 -1
- package/agent-skills/interf-actions/SKILL.md +74 -0
- package/agent-skills/interf-actions/references/cli.md +190 -0
- package/{builtin-workflows/interf → builtin-methods/interf-default}/README.md +9 -9
- package/{builtin-workflows/interf → builtin-methods/interf-default}/compile/stages/shape/SKILL.md +4 -4
- package/{builtin-workflows/interf → builtin-methods/interf-default}/compile/stages/structure/SKILL.md +1 -1
- package/builtin-methods/interf-default/improve/SKILL.md +18 -0
- package/{builtin-workflows/interf/workflow.json → builtin-methods/interf-default/method.json} +9 -9
- package/{builtin-workflows/interf/workflow.schema.json → builtin-methods/interf-default/method.schema.json} +3 -3
- package/{builtin-workflows/interf → builtin-methods/interf-default}/use/query/SKILL.md +1 -1
- package/dist/cli/commands/check-draft.d.ts +11 -10
- package/dist/cli/commands/check-draft.js +21 -20
- package/dist/cli/commands/compile-controller.d.ts +10 -7
- package/dist/cli/commands/compile-controller.js +84 -79
- package/dist/cli/commands/compile.d.ts +3 -3
- package/dist/cli/commands/compile.js +101 -43
- package/dist/cli/commands/compiled-flow.d.ts +14 -11
- package/dist/cli/commands/compiled-flow.js +38 -33
- package/dist/cli/commands/control-path.d.ts +11 -0
- package/dist/cli/commands/control-path.js +72 -0
- package/dist/cli/commands/create-method-wizard.d.ts +76 -0
- package/dist/cli/commands/create-method-wizard.js +465 -0
- package/dist/cli/commands/create.d.ts +3 -3
- package/dist/cli/commands/create.js +81 -68
- package/dist/cli/commands/default.js +4 -3
- package/dist/cli/commands/doctor.js +5 -5
- package/dist/cli/commands/executor-flow.d.ts +6 -6
- package/dist/cli/commands/executor-flow.js +2 -2
- package/dist/cli/commands/init.d.ts +2 -2
- package/dist/cli/commands/init.js +415 -144
- package/dist/cli/commands/list.js +16 -14
- package/dist/cli/commands/preparation-selection.d.ts +6 -0
- package/dist/cli/commands/preparation-selection.js +11 -0
- package/dist/cli/commands/reset.js +3 -3
- package/dist/cli/commands/source-config-wizard.d.ts +12 -11
- package/dist/cli/commands/source-config-wizard.js +206 -228
- package/dist/cli/commands/status.js +152 -17
- package/dist/cli/commands/test-flow.d.ts +16 -16
- package/dist/cli/commands/test-flow.js +53 -243
- package/dist/cli/commands/test.d.ts +6 -2
- package/dist/cli/commands/test.js +136 -100
- package/dist/cli/commands/verify.js +13 -13
- package/dist/cli/commands/web.d.ts +11 -0
- package/dist/cli/commands/web.js +386 -0
- package/dist/cli/index.d.ts +2 -1
- package/dist/cli/index.js +3 -1
- 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/03~yq9q893hmn.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/06yhdspx~ca5-.js +5 -0
- package/dist/compiler-ui/_next/static/chunks/06z~l3kwb891e.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/08g7lvje.te.u.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/08m7vf5asqlsm.js +91 -0
- package/dist/compiler-ui/_next/static/chunks/0_i-3_5l9t2qe.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/0b-ywny_j0g~0.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/0b52v41o1gixx.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/0c9mu7yldxyyg.css +3 -0
- package/dist/compiler-ui/_next/static/chunks/0gpzgsv0w.q~m.js +31 -0
- package/dist/compiler-ui/_next/static/chunks/0ilwfezfvu6~-.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/0n51hrfoufc7g.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/0xxmf45eskdt~.css +1 -0
- package/dist/compiler-ui/_next/static/chunks/0y5z3t-z1c8ks.js.map +5 -0
- package/dist/compiler-ui/_next/static/chunks/14wtz~vq25~qq.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/15mks7ry_cupt.js +118 -0
- package/dist/compiler-ui/_next/static/chunks/turbopack-0.uq1k8c0j4s..js +1 -0
- package/dist/compiler-ui/_next/static/chunks/turbopack-10e~t1yzi4svj.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/turbopack-worker-0sjn--fhq~1cg.js +1 -0
- package/dist/compiler-ui/_next/static/media/GeistMono_Variable.p.17jn9btb_52pq.woff2 +0 -0
- package/dist/compiler-ui/_next/static/media/Geist_Variable-s.p.0-te~ja_gpvcf.woff2 +0 -0
- package/dist/compiler-ui/_next/static/media/worker.102zas1s52_pf.js +109 -0
- package/dist/compiler-ui/_next/static/pIZnDsV3Je6hdC3cOsGdK/_buildManifest.js +11 -0
- package/dist/compiler-ui/_next/static/pIZnDsV3Je6hdC3cOsGdK/_clientMiddlewareManifest.js +1 -0
- package/dist/compiler-ui/_next/static/pIZnDsV3Je6hdC3cOsGdK/_ssgManifest.js +1 -0
- 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/dist/compiler-ui/index.html +1 -0
- package/dist/compiler-ui/index.txt +20 -0
- package/dist/index.d.ts +11 -7
- package/dist/index.js +8 -4
- 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/execution.js +4 -2
- package/dist/packages/agents/lib/executors.d.ts +14 -13
- package/dist/packages/agents/lib/executors.js +1 -0
- package/dist/packages/agents/lib/preflight.d.ts +1 -0
- package/dist/packages/agents/lib/preflight.js +32 -9
- package/dist/packages/agents/lib/render.d.ts +2 -2
- package/dist/packages/agents/lib/render.js +10 -9
- package/dist/packages/agents/lib/shells.d.ts +27 -34
- package/dist/packages/agents/lib/shells.js +191 -235
- package/dist/packages/agents/lib/types.d.ts +3 -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 +5 -5
- package/dist/packages/compiler/compiled-paths.js +10 -10
- package/dist/packages/compiler/compiled-pipeline.d.ts +18 -12
- package/dist/packages/compiler/compiled-pipeline.js +34 -23
- 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 +11 -11
- package/dist/packages/compiler/compiled-stage-runner.d.ts +10 -5
- package/dist/packages/compiler/compiled-stage-runner.js +56 -8
- 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 +68 -93
- package/dist/packages/compiler/lib/schema.js +57 -89
- 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 +3 -3
- 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 +9 -9
- 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 +12 -9
- package/dist/packages/compiler/runtime-types.d.ts +9 -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 -62
- 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/adapters.d.ts +15 -0
- package/dist/packages/execution/adapters.js +1 -0
- package/dist/packages/execution/events.d.ts +8 -0
- package/dist/packages/execution/events.js +16 -0
- package/dist/packages/execution/index.d.ts +9 -0
- package/dist/packages/execution/index.js +6 -0
- package/dist/packages/execution/lib/schema.d.ts +1551 -0
- package/dist/packages/execution/lib/schema.js +296 -0
- package/dist/packages/local-service/action-values.d.ts +22 -0
- package/dist/packages/local-service/action-values.js +30 -0
- package/dist/packages/local-service/client.d.ts +119 -0
- package/dist/packages/local-service/client.js +356 -0
- package/dist/packages/local-service/index.d.ts +15 -0
- package/dist/packages/local-service/index.js +11 -0
- package/dist/packages/local-service/lib/schema.d.ts +6917 -0
- package/dist/packages/local-service/lib/schema.js +519 -0
- package/dist/packages/local-service/routes.d.ts +27 -0
- package/dist/packages/local-service/routes.js +32 -0
- 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 +130 -0
- package/dist/packages/local-service/runtime.js +2263 -0
- package/dist/packages/local-service/server.d.ts +18 -0
- package/dist/packages/local-service/server.js +577 -0
- 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} +65 -64
- 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 +20 -20
- 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/method-package/interf-method-package.js +496 -0
- 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} +27 -27
- 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} +13 -11
- package/dist/packages/{workflow-package/workflow-stage-runner.js → method-package/method-stage-runner.js} +8 -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 +2 -4
- package/dist/packages/project-model/index.js +1 -3
- package/dist/packages/project-model/interf-detect.d.ts +3 -3
- package/dist/packages/project-model/interf-detect.js +18 -14
- package/dist/packages/project-model/interf-scaffold.d.ts +2 -2
- package/dist/packages/project-model/interf-scaffold.js +40 -38
- 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 +24 -14
- package/dist/packages/project-model/lib/schema.js +22 -30
- 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 +19 -17
- package/dist/packages/project-model/source-config.js +144 -145
- package/dist/packages/project-model/source-folders.d.ts +11 -0
- package/dist/packages/project-model/source-folders.js +110 -0
- 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 +8 -8
- package/dist/packages/testing/test-paths.js +7 -9
- 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 +29 -30
- package/builtin-workflows/interf/improve/SKILL.md +0 -18
- package/dist/cli/commands/create-workflow-wizard.d.ts +0 -70
- package/dist/cli/commands/create-workflow-wizard.js +0 -361
- package/dist/cli/commands/dataset-selection.d.ts +0 -6
- package/dist/cli/commands/dataset-selection.js +0 -11
- package/dist/lib/agent-args.d.ts +0 -1
- package/dist/lib/agent-args.js +0 -1
- package/dist/lib/agent-constants.d.ts +0 -1
- package/dist/lib/agent-constants.js +0 -1
- package/dist/lib/agent-detection.d.ts +0 -1
- package/dist/lib/agent-detection.js +0 -1
- package/dist/lib/agent-execution.d.ts +0 -1
- package/dist/lib/agent-execution.js +0 -1
- package/dist/lib/agent-logs.d.ts +0 -1
- package/dist/lib/agent-logs.js +0 -1
- package/dist/lib/agent-preflight.d.ts +0 -1
- package/dist/lib/agent-preflight.js +0 -1
- package/dist/lib/agent-render.d.ts +0 -1
- package/dist/lib/agent-render.js +0 -1
- package/dist/lib/agent-shells.d.ts +0 -1
- package/dist/lib/agent-shells.js +0 -1
- package/dist/lib/agent-status.d.ts +0 -1
- package/dist/lib/agent-status.js +0 -1
- package/dist/lib/agent-types.d.ts +0 -1
- package/dist/lib/agent-types.js +0 -1
- package/dist/lib/agents.d.ts +0 -1
- package/dist/lib/agents.js +0 -1
- package/dist/lib/builtin-compiled-workflow.d.ts +0 -1
- package/dist/lib/builtin-compiled-workflow.js +0 -1
- package/dist/lib/chart-guidance.d.ts +0 -1
- package/dist/lib/chart-guidance.js +0 -1
- package/dist/lib/compiled-compile.d.ts +0 -1
- package/dist/lib/compiled-compile.js +0 -1
- package/dist/lib/compiled-paths.d.ts +0 -1
- package/dist/lib/compiled-paths.js +0 -3
- package/dist/lib/compiled-raw.d.ts +0 -1
- package/dist/lib/compiled-raw.js +0 -3
- package/dist/lib/compiled-reset.d.ts +0 -1
- package/dist/lib/compiled-reset.js +0 -3
- package/dist/lib/compiled-schema.d.ts +0 -1
- package/dist/lib/compiled-schema.js +0 -1
- package/dist/lib/discovery.d.ts +0 -1
- package/dist/lib/discovery.js +0 -1
- package/dist/lib/execution-profile.d.ts +0 -1
- package/dist/lib/execution-profile.js +0 -1
- package/dist/lib/executors.d.ts +0 -1
- package/dist/lib/executors.js +0 -1
- package/dist/lib/filesystem.d.ts +0 -1
- package/dist/lib/filesystem.js +0 -1
- package/dist/lib/interf-bootstrap.d.ts +0 -1
- package/dist/lib/interf-bootstrap.js +0 -3
- package/dist/lib/interf-detect.d.ts +0 -1
- package/dist/lib/interf-detect.js +0 -3
- package/dist/lib/interf-scaffold.d.ts +0 -1
- package/dist/lib/interf-scaffold.js +0 -3
- package/dist/lib/interf-workflow-package.d.ts +0 -1
- package/dist/lib/interf-workflow-package.js +0 -1
- package/dist/lib/interf.d.ts +0 -1
- package/dist/lib/interf.js +0 -3
- package/dist/lib/local-workflows.d.ts +0 -1
- package/dist/lib/local-workflows.js +0 -1
- package/dist/lib/logger.d.ts +0 -1
- package/dist/lib/logger.js +0 -1
- package/dist/lib/package-root.d.ts +0 -1
- package/dist/lib/package-root.js +0 -1
- package/dist/lib/parse.d.ts +0 -1
- package/dist/lib/parse.js +0 -1
- package/dist/lib/project-paths.d.ts +0 -1
- package/dist/lib/project-paths.js +0 -3
- package/dist/lib/runtime-acceptance.d.ts +0 -1
- package/dist/lib/runtime-acceptance.js +0 -1
- package/dist/lib/runtime-contracts.d.ts +0 -1
- package/dist/lib/runtime-contracts.js +0 -1
- package/dist/lib/runtime-inventory.d.ts +0 -1
- package/dist/lib/runtime-inventory.js +0 -1
- package/dist/lib/runtime-paths.d.ts +0 -1
- package/dist/lib/runtime-paths.js +0 -1
- package/dist/lib/runtime-prompt.d.ts +0 -1
- package/dist/lib/runtime-prompt.js +0 -1
- package/dist/lib/runtime-reconcile.d.ts +0 -1
- package/dist/lib/runtime-reconcile.js +0 -1
- package/dist/lib/runtime-runs.d.ts +0 -1
- package/dist/lib/runtime-runs.js +0 -1
- package/dist/lib/runtime-types.d.ts +0 -1
- package/dist/lib/runtime-types.js +0 -1
- package/dist/lib/runtime.d.ts +0 -1
- package/dist/lib/runtime.js +0 -1
- package/dist/lib/schema.d.ts +0 -4
- package/dist/lib/schema.js +0 -6
- package/dist/lib/source-config.d.ts +0 -1
- package/dist/lib/source-config.js +0 -3
- package/dist/lib/state-artifacts.d.ts +0 -1
- package/dist/lib/state-artifacts.js +0 -1
- package/dist/lib/state-health.d.ts +0 -1
- package/dist/lib/state-health.js +0 -1
- package/dist/lib/state-io.d.ts +0 -1
- package/dist/lib/state-io.js +0 -1
- package/dist/lib/state-paths.d.ts +0 -1
- package/dist/lib/state-paths.js +0 -1
- package/dist/lib/state-view.d.ts +0 -1
- package/dist/lib/state-view.js +0 -1
- package/dist/lib/state.d.ts +0 -1
- package/dist/lib/state.js +0 -1
- package/dist/lib/test-execution.d.ts +0 -1
- package/dist/lib/test-execution.js +0 -3
- package/dist/lib/test-matrices.d.ts +0 -1
- package/dist/lib/test-matrices.js +0 -3
- package/dist/lib/test-paths.d.ts +0 -1
- package/dist/lib/test-paths.js +0 -3
- package/dist/lib/test-profile-presets.d.ts +0 -1
- package/dist/lib/test-profile-presets.js +0 -3
- package/dist/lib/test-sandbox.d.ts +0 -1
- package/dist/lib/test-sandbox.js +0 -3
- package/dist/lib/test-specs.d.ts +0 -1
- package/dist/lib/test-specs.js +0 -3
- package/dist/lib/test-targets.d.ts +0 -1
- package/dist/lib/test-targets.js +0 -3
- package/dist/lib/test-types.d.ts +0 -1
- package/dist/lib/test-types.js +0 -3
- package/dist/lib/test.d.ts +0 -1
- package/dist/lib/test.js +0 -3
- package/dist/lib/util.d.ts +0 -1
- package/dist/lib/util.js +0 -1
- package/dist/lib/validate-compiled.d.ts +0 -1
- package/dist/lib/validate-compiled.js +0 -1
- package/dist/lib/validate-helpers.d.ts +0 -1
- package/dist/lib/validate-helpers.js +0 -1
- package/dist/lib/validate.d.ts +0 -1
- package/dist/lib/validate.js +0 -1
- package/dist/lib/workflow-authoring.d.ts +0 -1
- package/dist/lib/workflow-authoring.js +0 -1
- package/dist/lib/workflow-definitions.d.ts +0 -1
- package/dist/lib/workflow-definitions.js +0 -1
- package/dist/lib/workflow-edit-session.d.ts +0 -1
- package/dist/lib/workflow-edit-session.js +0 -1
- package/dist/lib/workflow-edit-utils.d.ts +0 -1
- package/dist/lib/workflow-edit-utils.js +0 -1
- package/dist/lib/workflow-helpers.d.ts +0 -1
- package/dist/lib/workflow-helpers.js +0 -1
- package/dist/lib/workflow-improvement.d.ts +0 -1
- package/dist/lib/workflow-improvement.js +0 -1
- package/dist/lib/workflow-primitives.d.ts +0 -1
- package/dist/lib/workflow-primitives.js +0 -1
- package/dist/lib/workflow-review-paths.d.ts +0 -1
- package/dist/lib/workflow-review-paths.js +0 -1
- package/dist/lib/workflow-stage-policy.d.ts +0 -1
- package/dist/lib/workflow-stage-policy.js +0 -1
- package/dist/lib/workflow-stage-runner.d.ts +0 -1
- package/dist/lib/workflow-stage-runner.js +0 -1
- package/dist/lib/workflows.d.ts +0 -1
- package/dist/lib/workflows.js +0 -1
- 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 -26
- package/dist/packages/workflow-authoring/workflow-authoring.js +0 -123
- package/dist/packages/workflow-authoring/workflow-edit-session.d.ts +0 -16
- package/dist/packages/workflow-authoring/workflow-edit-session.js +0 -60
- 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 -25
- package/dist/packages/workflow-package/interf-workflow-package.js +0 -389
- package/dist/packages/workflow-package/local-workflows.d.ts +0 -64
- package/dist/packages/workflow-package/local-workflows.js +0 -441
- package/dist/packages/workflow-package/workflow-definitions.d.ts +0 -82
- package/dist/packages/workflow-package/workflow-definitions.js +0 -210
- package/dist/packages/workflow-package/workflow-review-paths.d.ts +0 -10
- /package/{builtin-workflows/interf → builtin-methods/interf-default}/compile/stages/summarize/SKILL.md +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,116 @@
|
|
|
1
|
+
import { rmSync } from "node:fs";
|
|
2
|
+
import { createMethodAuthoringShell } from "../agents/lib/shells.js";
|
|
3
|
+
import { createScratchLocalMethodPackage } from "../method-package/interf-method-package.js";
|
|
4
|
+
import { CONTEXT_INTERFACE_FILE } from "../method-package/context-interface.js";
|
|
5
|
+
import { loadMethodDefinitionFromDir, validateMethodPackage, methodDefinitionPath, } from "../method-package/local-methods.js";
|
|
6
|
+
import { runMethodEditSession } from "./method-edit-session.js";
|
|
7
|
+
function buildMethodAuthoringPrompt() {
|
|
8
|
+
return [
|
|
9
|
+
"This is an automated Interf Method-authoring run, not an open-ended chat session.",
|
|
10
|
+
"Execute it now.",
|
|
11
|
+
"Create one standalone Method package for the source data, desired portable-context outputs, and proof requirements in this source folder.",
|
|
12
|
+
"Read `runtime/authoring-context.json` first.",
|
|
13
|
+
"Treat `task_prompt` as the user's preparation-and-evidence brief: source data, output shape, and evidence that should show the data is ready.",
|
|
14
|
+
`Then read \`method/README.md\`, \`method/method.json\`, and \`method/${CONTEXT_INTERFACE_FILE}\`.`,
|
|
15
|
+
"The `method/` directory starts as a neutral Method package scaffold, not as a suggested Method.",
|
|
16
|
+
"Replace the scaffold purpose, inputs, context interface, stages, stage docs, proof rules, and query guidance with the Method this agent work actually needs.",
|
|
17
|
+
"Review `artifacts/source-folder/raw/` before editing the package.",
|
|
18
|
+
"Prefer direct file-reading and search tools over shell commands for routine file inspection.",
|
|
19
|
+
"Do not use shell helpers like `cat`, `sed`, `ls`, or `find` when a native read/search tool can inspect the same files.",
|
|
20
|
+
"Edit only files under `method/`.",
|
|
21
|
+
"Keep the Method package valid for the current compiler API and `method.schema.json`.",
|
|
22
|
+
"Choose stage ids, stage order, reads, writes, acceptance criteria, and stage docs from the source data and preparation-and-evidence brief.",
|
|
23
|
+
"Use kebab-case ids everywhere: stage ids, skill_dir values, zone ids, reads/writes values, and package ids. Never use underscores.",
|
|
24
|
+
"Do not preserve the placeholder `prepare` stage unless the final Method genuinely needs a stage with that exact role.",
|
|
25
|
+
"When editing acceptance criteria: `zone_counts_at_least` maps declared zone ids to fixed numeric minimums.",
|
|
26
|
+
"`zone_counts_at_least_counts` also maps declared zone ids to runtime count-key strings such as `source_total`; `source_total` is a value, never a zone key.",
|
|
27
|
+
"For file output zones that replace scaffold files, add `artifacts_must_not_contain` entries that reject `Not yet compiled.` placeholder text; its keys must be artifact paths like `home.md`, not zone ids like `home`.",
|
|
28
|
+
"Before stopping, verify every zone-count acceptance key is declared in `method.schema.json`.",
|
|
29
|
+
"For every stage in `method.json`, create `method/compile/stages/<skill_dir>/SKILL.md` and make the folder name exactly match that stage's kebab-case `skill_dir`.",
|
|
30
|
+
"Every zone path in `method.schema.json` must be unique and non-overlapping. Do not declare both `knowledge/indexes` and `knowledge/indexes/some-file.md` as separate zones.",
|
|
31
|
+
"Make the package materially specific to this Preparation task, output shape, and proof requirement. A no-op scaffold is not acceptable.",
|
|
32
|
+
"Treat the Method package as four aligned layers: purpose, inputs, context interface, and stages.",
|
|
33
|
+
"Keep the portable-context entrypoint canonical: if the Method writes an agent entrypoint, declare zone id `home` with path `home.md` and make the final shaping stage own it.",
|
|
34
|
+
"Do not move the main entrypoint to `knowledge/home.md` or any other nested path.",
|
|
35
|
+
"Prefer explicit stage-doc, stage-policy, purpose, input-contract, and context-interface edits over vague rewrites.",
|
|
36
|
+
"Do not introduce wikilinks unless the Method also creates the target note by exact basename or explicit relative path.",
|
|
37
|
+
"Respect stage boundaries: a stage may only introduce links that resolve within that stage's declared writes or already-existing read zones.",
|
|
38
|
+
"Do not make one stage point at files or notes that are only created later by another stage.",
|
|
39
|
+
"Prefer conservative retrieval routing over speculative note sprawl.",
|
|
40
|
+
"Do not narrate plans or ask follow-up questions.",
|
|
41
|
+
"Only emit user-visible updates that begin with STATUS:, DONE:, BLOCKED:, or ERROR:.",
|
|
42
|
+
"As soon as the Method edits are complete, stop.",
|
|
43
|
+
].join("\n");
|
|
44
|
+
}
|
|
45
|
+
function validateAuthoredMethodPackage(methodPath) {
|
|
46
|
+
const validation = validateMethodPackage(methodPath);
|
|
47
|
+
if (!validation.ok)
|
|
48
|
+
return validation;
|
|
49
|
+
const definition = loadMethodDefinitionFromDir(methodPath);
|
|
50
|
+
if (!definition)
|
|
51
|
+
return validation;
|
|
52
|
+
const errors = [...validation.errors];
|
|
53
|
+
const placeholderStage = definition.stages?.find((stage) => stage.id === "prepare" &&
|
|
54
|
+
stage.contract_type === "method-draft-stage" &&
|
|
55
|
+
stage.writes.includes("draft-context"));
|
|
56
|
+
const placeholderZone = definition.method_schema.zones.find((zone) => zone.id === "draft-context");
|
|
57
|
+
const placeholderPurpose = definition.purpose?.label === "From-scratch Method draft" ||
|
|
58
|
+
definition.purpose?.task_hint?.includes("Replace this neutral scaffold");
|
|
59
|
+
if (placeholderStage) {
|
|
60
|
+
errors.push("Authored Method still contains the neutral scaffold stage `prepare`.");
|
|
61
|
+
}
|
|
62
|
+
if (placeholderZone) {
|
|
63
|
+
errors.push("Authored Method still contains the neutral scaffold zone `draft-context`.");
|
|
64
|
+
}
|
|
65
|
+
if (placeholderPurpose) {
|
|
66
|
+
errors.push("Authored Method still contains the neutral scaffold purpose.");
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
ok: validation.ok && errors.length === 0,
|
|
70
|
+
summary: errors.length === 0
|
|
71
|
+
? validation.summary
|
|
72
|
+
: `Method package has ${errors.length} issue(s).`,
|
|
73
|
+
errors,
|
|
74
|
+
counts: validation.counts,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export async function runMethodAuthoringDraft(options) {
|
|
78
|
+
const methodPath = createScratchLocalMethodPackage({
|
|
79
|
+
sourcePath: options.sourcePath,
|
|
80
|
+
methodId: options.methodId,
|
|
81
|
+
label: options.label,
|
|
82
|
+
hint: options.hint,
|
|
83
|
+
});
|
|
84
|
+
const shell = createMethodAuthoringShell({
|
|
85
|
+
methodPath,
|
|
86
|
+
methodId: options.methodId,
|
|
87
|
+
label: options.label,
|
|
88
|
+
referenceMethodId: options.baseMethodId ?? null,
|
|
89
|
+
sourceFolderPath: options.sourceFolderPath,
|
|
90
|
+
taskPrompt: options.taskPrompt,
|
|
91
|
+
checks: options.checks ?? [],
|
|
92
|
+
});
|
|
93
|
+
const session = await runMethodEditSession({
|
|
94
|
+
executor: options.executor,
|
|
95
|
+
methodPath,
|
|
96
|
+
shell,
|
|
97
|
+
prompt: buildMethodAuthoringPrompt(),
|
|
98
|
+
validate: validateAuthoredMethodPackage,
|
|
99
|
+
maxValidationRepairAttempts: 1,
|
|
100
|
+
onStatus: options.onStatus,
|
|
101
|
+
});
|
|
102
|
+
if (session.status !== "updated") {
|
|
103
|
+
rmSync(methodPath, { recursive: true, force: true });
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
status: session.status,
|
|
107
|
+
changed: session.changed,
|
|
108
|
+
summary: session.summary,
|
|
109
|
+
validation: session.validation,
|
|
110
|
+
methodPath,
|
|
111
|
+
shellPath: shell.rootPath,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
export function resolveMethodDraftPath(sourcePath, methodId) {
|
|
115
|
+
return methodDefinitionPath(sourcePath, methodId);
|
|
116
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { MethodExecutor } from "../agents/lib/executors.js";
|
|
2
|
+
import type { MethodValidationResult } from "../method-package/local-methods.js";
|
|
3
|
+
import { type MethodEditShellArtifacts } from "./lib/method-edit-utils.js";
|
|
4
|
+
export interface MethodEditSessionResult {
|
|
5
|
+
status: "updated" | "no-change" | "invalid" | "executor-failed";
|
|
6
|
+
changed: boolean;
|
|
7
|
+
validation: MethodValidationResult | null;
|
|
8
|
+
summary: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function runMethodEditSession(options: {
|
|
11
|
+
executor: MethodExecutor;
|
|
12
|
+
methodPath: string;
|
|
13
|
+
shell: MethodEditShellArtifacts;
|
|
14
|
+
prompt: string;
|
|
15
|
+
validate: (methodPath: string) => MethodValidationResult;
|
|
16
|
+
maxValidationRepairAttempts?: number;
|
|
17
|
+
onStatus?: (line: string) => void;
|
|
18
|
+
}): Promise<MethodEditSessionResult>;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { appendFileSync, existsSync, realpathSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { copyDirectory, directoriesMatch, } from "./lib/method-edit-utils.js";
|
|
4
|
+
export async function runMethodEditSession(options) {
|
|
5
|
+
const editableMethodPath = join(options.shell.rootPath, "method");
|
|
6
|
+
copyDirectory(options.methodPath, options.shell.methodBeforePath);
|
|
7
|
+
if (!existsSync(editableMethodPath)) {
|
|
8
|
+
copyDirectory(options.methodPath, editableMethodPath);
|
|
9
|
+
}
|
|
10
|
+
writeFileSync(options.shell.promptLogPath, `${options.prompt}\n`);
|
|
11
|
+
const maxValidationRepairAttempts = options.maxValidationRepairAttempts ?? 0;
|
|
12
|
+
let prompt = options.prompt;
|
|
13
|
+
for (let attempt = 0; attempt <= maxValidationRepairAttempts; attempt += 1) {
|
|
14
|
+
let code = 1;
|
|
15
|
+
let executeError = null;
|
|
16
|
+
try {
|
|
17
|
+
code = await options.executor.execute(options.shell.rootPath, prompt, {
|
|
18
|
+
eventLogPath: options.shell.eventLogPath,
|
|
19
|
+
statusLogPath: options.shell.statusLogPath,
|
|
20
|
+
completionCheck: () => {
|
|
21
|
+
try {
|
|
22
|
+
if (directoriesMatch(options.shell.methodBeforePath, editableMethodPath))
|
|
23
|
+
return false;
|
|
24
|
+
return options.validate(editableMethodPath).ok;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
onStatus: options.onStatus,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
executeError = error instanceof Error ? error.message : String(error);
|
|
35
|
+
}
|
|
36
|
+
copyDirectory(editableMethodPath, options.shell.methodAfterPath);
|
|
37
|
+
const changed = !directoriesMatch(options.shell.methodBeforePath, options.shell.methodAfterPath);
|
|
38
|
+
if (executeError) {
|
|
39
|
+
copyDirectory(options.shell.methodBeforePath, options.methodPath);
|
|
40
|
+
copyDirectory(options.shell.methodBeforePath, editableMethodPath);
|
|
41
|
+
return {
|
|
42
|
+
status: "executor-failed",
|
|
43
|
+
changed,
|
|
44
|
+
validation: null,
|
|
45
|
+
summary: `Method editor failed before completing: ${executeError}`,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (code !== 0) {
|
|
49
|
+
copyDirectory(options.shell.methodBeforePath, options.methodPath);
|
|
50
|
+
copyDirectory(options.shell.methodBeforePath, editableMethodPath);
|
|
51
|
+
return {
|
|
52
|
+
status: "executor-failed",
|
|
53
|
+
changed,
|
|
54
|
+
validation: null,
|
|
55
|
+
summary: `Method editor exited with code ${code}.`,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const validation = options.validate(editableMethodPath);
|
|
59
|
+
if (validation.ok) {
|
|
60
|
+
if (!sameRealPath(editableMethodPath, options.methodPath)) {
|
|
61
|
+
copyDirectory(editableMethodPath, options.methodPath);
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
status: changed ? "updated" : "no-change",
|
|
65
|
+
changed,
|
|
66
|
+
validation,
|
|
67
|
+
summary: changed
|
|
68
|
+
? "Method package updated and validated."
|
|
69
|
+
: "Method package is valid without additional edits.",
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const details = validation.errors.length > 0
|
|
73
|
+
? `: ${validation.errors.slice(0, 6).join("; ")}`
|
|
74
|
+
: "";
|
|
75
|
+
if (!changed || attempt >= maxValidationRepairAttempts) {
|
|
76
|
+
copyDirectory(options.shell.methodBeforePath, options.methodPath);
|
|
77
|
+
copyDirectory(options.shell.methodBeforePath, editableMethodPath);
|
|
78
|
+
return {
|
|
79
|
+
status: "invalid",
|
|
80
|
+
changed,
|
|
81
|
+
validation,
|
|
82
|
+
summary: changed
|
|
83
|
+
? `Method package failed validation: ${validation.summary}${details}`
|
|
84
|
+
: `Method package is invalid without any Method edits: ${validation.summary}${details}`,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
prompt = [
|
|
88
|
+
"This is an automated Interf Method validation-repair pass.",
|
|
89
|
+
"The previous edit did not pass package validation.",
|
|
90
|
+
"Fix only the validation errors below. Do not redesign the Method.",
|
|
91
|
+
"",
|
|
92
|
+
"Validation errors:",
|
|
93
|
+
...validation.errors.slice(0, 12).map((error) => `- ${error}`),
|
|
94
|
+
"",
|
|
95
|
+
"Rules:",
|
|
96
|
+
"- Edit only files under `method/`.",
|
|
97
|
+
"- Use kebab-case ids everywhere: stage ids, skill_dir values, zone ids, reads/writes values, and package ids. Never use underscores.",
|
|
98
|
+
"- Keep every stage `skill_dir` matched by `method/compile/stages/<skill_dir>/SKILL.md`.",
|
|
99
|
+
"- Keep `method.schema.json` zone paths unique and non-overlapping.",
|
|
100
|
+
"- Keep zone-count acceptance keys declared in `method.schema.json`.",
|
|
101
|
+
"- Keep `artifacts_must_not_contain` keys as portable-context relative artifact paths such as `home.md`, not zone ids.",
|
|
102
|
+
"- Preserve root `home.md` as the main portable-context entrypoint when the Method writes an entrypoint.",
|
|
103
|
+
"- Stop as soon as the package should validate.",
|
|
104
|
+
].join("\n");
|
|
105
|
+
appendFileSync(options.shell.promptLogPath, `\n\n---\n\n${prompt}\n`);
|
|
106
|
+
}
|
|
107
|
+
copyDirectory(options.shell.methodBeforePath, options.methodPath);
|
|
108
|
+
copyDirectory(options.shell.methodBeforePath, editableMethodPath);
|
|
109
|
+
return {
|
|
110
|
+
status: "invalid",
|
|
111
|
+
changed: true,
|
|
112
|
+
validation: null,
|
|
113
|
+
summary: "Method package failed validation.",
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function sameRealPath(leftPath, rightPath) {
|
|
117
|
+
try {
|
|
118
|
+
return existsSync(leftPath) &&
|
|
119
|
+
existsSync(rightPath) &&
|
|
120
|
+
realpathSync(leftPath) === realpathSync(rightPath);
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { MethodExecutor } from "../agents/lib/executors.js";
|
|
2
|
+
import { type MethodValidationResult } from "../method-package/local-methods.js";
|
|
3
|
+
import type { SourcePreparationConfig } from "../project-model/lib/schema.js";
|
|
4
|
+
import type { MethodImprovementLoopSummary } from "../compiler/lib/schema.js";
|
|
5
|
+
export interface MethodImprovementRunResult {
|
|
6
|
+
status: "updated" | "no-change" | "invalid" | "executor-failed";
|
|
7
|
+
changed: boolean;
|
|
8
|
+
validation: MethodValidationResult | null;
|
|
9
|
+
summary: string;
|
|
10
|
+
shellPath: string;
|
|
11
|
+
loopRootPath: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function runMethodImprovementLoop(options: {
|
|
14
|
+
executor: MethodExecutor;
|
|
15
|
+
compiledPath: string;
|
|
16
|
+
methodId: string;
|
|
17
|
+
compiledConfig: Pick<SourcePreparationConfig, "checks">;
|
|
18
|
+
runId: string;
|
|
19
|
+
loopIndex: number;
|
|
20
|
+
maxLoops: number;
|
|
21
|
+
maxAttempts: number;
|
|
22
|
+
previousVariations: MethodImprovementLoopSummary[];
|
|
23
|
+
}): Promise<MethodImprovementRunResult>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { appendFileSync, existsSync, mkdirSync, writeFileSync, } from "node:fs";
|
|
2
2
|
import { join, relative } from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { CONTEXT_INTERFACE_FILE } from "../
|
|
3
|
+
import { createMethodImprovementShell, freezeMethodImprovementShell, } from "../agents/lib/shells.js";
|
|
4
|
+
import { validateMethodPackage } from "../method-package/local-methods.js";
|
|
5
|
+
import { CONTEXT_INTERFACE_FILE } from "../method-package/context-interface.js";
|
|
6
6
|
import { readJsonFileWithSchema } from "../shared/parse.js";
|
|
7
|
-
import {
|
|
8
|
-
import { targetTestRunsRootForCompiled, targetTestSandboxesRootForCompiled,
|
|
7
|
+
import { resolveMethodImprovementReviewPaths } from "../method-package/method-review-paths.js";
|
|
8
|
+
import { targetTestRunsRootForCompiled, targetTestSandboxesRootForCompiled, methodImprovementRunRoot, methodPackagePathForCompiled, } from "../compiler/compiled-paths.js";
|
|
9
9
|
import { readInterfConfig } from "../project-model/interf.js";
|
|
10
10
|
import { saveCompiledInterfConfig } from "../project-model/source-config.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { MethodImprovementRunLedgerSchema, } from "../compiler/lib/schema.js";
|
|
12
|
+
import { runMethodEditSession } from "./method-edit-session.js";
|
|
13
13
|
function toShellArtifactPath(absolutePath, sourceRoot, shellRoot) {
|
|
14
14
|
if (!absolutePath)
|
|
15
15
|
return null;
|
|
@@ -33,16 +33,16 @@ function buildLoopContext(options) {
|
|
|
33
33
|
const previousVariations = options.previousVariations.map((summary) => mapLoopSummaryForShell(summary, options.compiledPath));
|
|
34
34
|
const latestFailure = previousVariations.at(-1) ?? null;
|
|
35
35
|
return {
|
|
36
|
-
kind: "interf-
|
|
36
|
+
kind: "interf-method-improvement-loop",
|
|
37
37
|
version: 1,
|
|
38
38
|
generated_at: new Date().toISOString(),
|
|
39
39
|
target_name: readInterfConfig(options.compiledPath)?.name ?? "compiled",
|
|
40
|
-
|
|
40
|
+
method_id: options.methodId,
|
|
41
41
|
loop_index: options.loopIndex,
|
|
42
42
|
max_loops: options.maxLoops,
|
|
43
43
|
max_attempts: options.maxAttempts,
|
|
44
|
-
review_paths:
|
|
45
|
-
|
|
44
|
+
review_paths: resolveMethodImprovementReviewPaths(options.compiledPath),
|
|
45
|
+
readiness_checks: {
|
|
46
46
|
count: options.compiledConfig.checks.length,
|
|
47
47
|
questions: options.compiledConfig.checks.map((check, index) => ({
|
|
48
48
|
id: check.id ?? `check-${index + 1}`,
|
|
@@ -53,86 +53,86 @@ function buildLoopContext(options) {
|
|
|
53
53
|
latest_failure: latestFailure,
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function buildMethodImprovementPrompt() {
|
|
57
57
|
return [
|
|
58
|
-
"This is an automated Interf
|
|
58
|
+
"This is an automated Interf Method-improvement run, not an open-ended chat session.",
|
|
59
59
|
"The user already invoked this through `interf compile` with self-improving loops enabled. Execute it now.",
|
|
60
60
|
"Read `runtime/loop-context.json` first.",
|
|
61
|
-
`Then read \`
|
|
62
|
-
"Review preserved evidence from earlier failures under `artifacts/` before you edit the
|
|
63
|
-
"Treat `
|
|
64
|
-
"Treat the
|
|
65
|
-
"Prefer editing the stage docs,
|
|
66
|
-
"Edit only files under `
|
|
67
|
-
"Do not edit checks, test specs, raw
|
|
68
|
-
"Keep the
|
|
61
|
+
`Then read \`method/README.md\`, \`method/method.json\`, \`method/${CONTEXT_INTERFACE_FILE}\`, and \`method/improve/SKILL.md\` if it exists.`,
|
|
62
|
+
"Review preserved evidence from earlier failures under `artifacts/` before you edit the Method.",
|
|
63
|
+
"Treat `method/improve/SKILL.md` as guidance for how to improve the Method, not as the default file to edit.",
|
|
64
|
+
"Treat the Method package as four aligned layers: purpose, inputs, context interface, and stages.",
|
|
65
|
+
"Prefer editing the stage docs, Method contract, input contract, or schema ownership that actually change portable-context outputs.",
|
|
66
|
+
"Edit only files under `method/`.",
|
|
67
|
+
"Do not edit checks, test specs, raw source files, or generated portable-context outputs.",
|
|
68
|
+
"Keep the Method package valid for the current compiler API and `method.schema.json`.",
|
|
69
69
|
"Respect stage boundaries: a stage may only introduce links that resolve within that stage's declared writes or already-existing read zones.",
|
|
70
70
|
"Do not make one stage point at files or notes that are only created later by another stage.",
|
|
71
|
-
"Prefer small, defensible changes to
|
|
71
|
+
"Prefer small, defensible changes to Method docs, stage docs, stage policies, or schema ownership over random churn.",
|
|
72
72
|
"Do not narrate plans or ask follow-up questions.",
|
|
73
73
|
"Only emit user-visible updates that begin with STATUS:, DONE:, BLOCKED:, or ERROR:.",
|
|
74
|
-
"As soon as the
|
|
74
|
+
"As soon as the Method edits are complete, stop.",
|
|
75
75
|
].join("\n");
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function updateCompiledMethodOrigin(options) {
|
|
78
78
|
const current = readInterfConfig(options.compiledPath);
|
|
79
79
|
if (!current)
|
|
80
80
|
return;
|
|
81
81
|
const nextConfig = {
|
|
82
82
|
...current,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
selected: options.
|
|
83
|
+
method: current.method ?? options.selectedMethodId,
|
|
84
|
+
method_origin: {
|
|
85
|
+
selected: options.selectedMethodId,
|
|
86
86
|
...(options.localDraft ? { local_draft: true } : {}),
|
|
87
87
|
},
|
|
88
88
|
};
|
|
89
89
|
saveCompiledInterfConfig(options.compiledPath, nextConfig);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
return join(
|
|
91
|
+
function methodImprovementRunLedgerPath(compiledPath, runId) {
|
|
92
|
+
return join(methodImprovementRunRoot(compiledPath, runId), "run.json");
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
return join(
|
|
94
|
+
function methodImprovementLoopHistoryPath(compiledPath, runId) {
|
|
95
|
+
return join(methodImprovementRunRoot(compiledPath, runId), "loop-history.jsonl");
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function methodImprovementLoopRecordPath(loopRootPath) {
|
|
98
98
|
return join(loopRootPath, "loop.json");
|
|
99
99
|
}
|
|
100
|
-
function
|
|
101
|
-
const ledgerPath =
|
|
100
|
+
function readMethodImprovementRunLedger(compiledPath, runId) {
|
|
101
|
+
const ledgerPath = methodImprovementRunLedgerPath(compiledPath, runId);
|
|
102
102
|
if (!existsSync(ledgerPath))
|
|
103
103
|
return null;
|
|
104
|
-
return readJsonFileWithSchema(ledgerPath, "
|
|
104
|
+
return readJsonFileWithSchema(ledgerPath, "Method improvement run ledger", MethodImprovementRunLedgerSchema);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const runRoot =
|
|
106
|
+
function writeMethodImprovementRunLedger(compiledPath, runId, record, options) {
|
|
107
|
+
const runRoot = methodImprovementRunRoot(compiledPath, runId);
|
|
108
108
|
mkdirSync(runRoot, { recursive: true });
|
|
109
|
-
const existing =
|
|
109
|
+
const existing = readMethodImprovementRunLedger(compiledPath, runId);
|
|
110
110
|
const generatedAt = existing?.generated_at ?? new Date().toISOString();
|
|
111
111
|
const ledger = {
|
|
112
|
-
kind: "interf-
|
|
112
|
+
kind: "interf-method-improvement-run",
|
|
113
113
|
version: 1,
|
|
114
114
|
generated_at: generatedAt,
|
|
115
115
|
updated_at: new Date().toISOString(),
|
|
116
116
|
run_id: runId,
|
|
117
117
|
target_name: options.targetName,
|
|
118
|
-
|
|
118
|
+
method_id: options.methodId,
|
|
119
119
|
max_loops: options.maxLoops,
|
|
120
120
|
max_attempts: options.maxAttempts,
|
|
121
121
|
loops: [...(existing?.loops ?? []), record],
|
|
122
122
|
};
|
|
123
|
-
writeFileSync(
|
|
124
|
-
writeFileSync(
|
|
125
|
-
appendFileSync(
|
|
123
|
+
writeFileSync(methodImprovementRunLedgerPath(compiledPath, runId), `${JSON.stringify(ledger, null, 2)}\n`);
|
|
124
|
+
writeFileSync(methodImprovementLoopRecordPath(record.loop_root_path), `${JSON.stringify(record, null, 2)}\n`);
|
|
125
|
+
appendFileSync(methodImprovementLoopHistoryPath(compiledPath, runId), `${JSON.stringify(record)}\n`);
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function buildMethodImprovementLoopRecord(options) {
|
|
128
128
|
return {
|
|
129
|
-
kind: "interf-
|
|
129
|
+
kind: "interf-method-improvement-loop-record",
|
|
130
130
|
version: 1,
|
|
131
131
|
recorded_at: new Date().toISOString(),
|
|
132
132
|
run_id: options.runId,
|
|
133
133
|
loop_index: options.loopIndex,
|
|
134
134
|
target_name: options.targetName,
|
|
135
|
-
|
|
135
|
+
method_id: options.methodId,
|
|
136
136
|
result: options.result,
|
|
137
137
|
changed: options.changed,
|
|
138
138
|
applied: options.result === "updated",
|
|
@@ -140,8 +140,8 @@ function buildWorkflowImprovementLoopRecord(options) {
|
|
|
140
140
|
shell_path: options.shellPath,
|
|
141
141
|
loop_root_path: options.loopRootPath,
|
|
142
142
|
context_path: join(options.shellPath, "runtime", "loop-context.json"),
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
method_before_path: options.methodBeforePath,
|
|
144
|
+
method_after_path: options.methodAfterPath,
|
|
145
145
|
prompt_log_path: options.promptLogPath,
|
|
146
146
|
event_log_path: options.eventLogPath,
|
|
147
147
|
status_log_path: options.statusLogPath,
|
|
@@ -149,35 +149,36 @@ function buildWorkflowImprovementLoopRecord(options) {
|
|
|
149
149
|
validation: options.validation,
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
|
-
export async function
|
|
152
|
+
export async function runMethodImprovementLoop(options) {
|
|
153
153
|
const compiledName = readInterfConfig(options.compiledPath)?.name ?? "compiled";
|
|
154
154
|
const context = buildLoopContext(options);
|
|
155
|
-
const shell =
|
|
155
|
+
const shell = createMethodImprovementShell({
|
|
156
156
|
compiledPath: options.compiledPath,
|
|
157
157
|
compiledName,
|
|
158
|
-
|
|
158
|
+
methodId: options.methodId,
|
|
159
159
|
runId: options.runId,
|
|
160
160
|
loopIndex: options.loopIndex,
|
|
161
161
|
context,
|
|
162
162
|
});
|
|
163
|
-
const
|
|
164
|
-
const session = await
|
|
163
|
+
const methodRoot = methodPackagePathForCompiled(options.compiledPath);
|
|
164
|
+
const session = await runMethodEditSession({
|
|
165
165
|
executor: options.executor,
|
|
166
|
-
|
|
166
|
+
methodPath: methodRoot,
|
|
167
167
|
shell,
|
|
168
|
-
prompt:
|
|
169
|
-
validate:
|
|
168
|
+
prompt: buildMethodImprovementPrompt(),
|
|
169
|
+
validate: validateMethodPackage,
|
|
170
|
+
maxValidationRepairAttempts: 1,
|
|
170
171
|
});
|
|
171
|
-
const preservedShellManifestPath =
|
|
172
|
-
|
|
172
|
+
const preservedShellManifestPath = freezeMethodImprovementShell(shell.rootPath);
|
|
173
|
+
writeMethodImprovementRunLedger(options.compiledPath, options.runId, buildMethodImprovementLoopRecord({
|
|
173
174
|
targetName: compiledName,
|
|
174
|
-
|
|
175
|
+
methodId: options.methodId,
|
|
175
176
|
runId: options.runId,
|
|
176
177
|
loopIndex: options.loopIndex,
|
|
177
178
|
shellPath: shell.rootPath,
|
|
178
179
|
loopRootPath: shell.loopRootPath,
|
|
179
|
-
|
|
180
|
-
|
|
180
|
+
methodBeforePath: shell.methodBeforePath,
|
|
181
|
+
methodAfterPath: shell.methodAfterPath,
|
|
181
182
|
promptLogPath: shell.promptLogPath,
|
|
182
183
|
eventLogPath: shell.eventLogPath,
|
|
183
184
|
statusLogPath: shell.statusLogPath,
|
|
@@ -188,14 +189,14 @@ export async function runWorkflowImprovementLoop(options) {
|
|
|
188
189
|
summary: session.summary,
|
|
189
190
|
}), {
|
|
190
191
|
targetName: compiledName,
|
|
191
|
-
|
|
192
|
+
methodId: options.methodId,
|
|
192
193
|
maxLoops: options.maxLoops,
|
|
193
194
|
maxAttempts: options.maxAttempts,
|
|
194
195
|
});
|
|
195
196
|
if (session.status === "updated") {
|
|
196
|
-
|
|
197
|
+
updateCompiledMethodOrigin({
|
|
197
198
|
compiledPath: options.compiledPath,
|
|
198
|
-
|
|
199
|
+
selectedMethodId: options.methodId,
|
|
199
200
|
localDraft: true,
|
|
200
201
|
});
|
|
201
202
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPILED_ZONE_KINDS, type CompiledZoneKind } from "../compiler/
|
|
1
|
+
import { COMPILED_ZONE_KINDS, type CompiledZoneKind } from "../compiler/method-primitives.js";
|
|
2
2
|
export declare const BUILTIN_COMPILED_STAGE_IDS: {
|
|
3
3
|
readonly SUMMARIZE: "summarize";
|
|
4
4
|
readonly STRUCTURE: "structure";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { readJsonFileWithSchema } from "../shared/parse.js";
|
|
4
|
-
import { COMPILED_ZONE_KINDS } from "../compiler/
|
|
5
|
-
import {
|
|
4
|
+
import { COMPILED_ZONE_KINDS } from "../compiler/method-primitives.js";
|
|
5
|
+
import { MethodCompiledSchemaSchema } from "../compiler/lib/schema.js";
|
|
6
6
|
import { PACKAGE_ROOT } from "./lib/package-root.js";
|
|
7
7
|
export const BUILTIN_COMPILED_STAGE_IDS = {
|
|
8
8
|
SUMMARIZE: "summarize",
|
|
@@ -20,44 +20,44 @@ export const BUILTIN_COMPILED_ZONE_IDS = {
|
|
|
20
20
|
};
|
|
21
21
|
const BUILTIN_ZONE_ID_SET = new Set(Object.values(BUILTIN_COMPILED_ZONE_IDS));
|
|
22
22
|
const BUILTIN_STAGE_ID_SET = new Set(Object.values(BUILTIN_COMPILED_STAGE_IDS));
|
|
23
|
-
const
|
|
23
|
+
const BuiltinMethodStageSchema = z.object({
|
|
24
24
|
id: z.string(),
|
|
25
25
|
contract_type: z.string(),
|
|
26
26
|
reads: z.array(z.string()).min(1),
|
|
27
27
|
writes: z.array(z.string()).min(1),
|
|
28
28
|
});
|
|
29
|
-
const
|
|
30
|
-
stages: z.array(
|
|
29
|
+
const BuiltinMethodPackageSchema = z.object({
|
|
30
|
+
stages: z.array(BuiltinMethodStageSchema).min(1),
|
|
31
31
|
});
|
|
32
32
|
let builtinCompiledContractCache = null;
|
|
33
|
-
function
|
|
34
|
-
return join(PACKAGE_ROOT, "builtin-
|
|
33
|
+
function builtinMethodRootPath() {
|
|
34
|
+
return join(PACKAGE_ROOT, "builtin-methods", "interf-default");
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
return join(
|
|
36
|
+
function builtinMethodPath(relativePath) {
|
|
37
|
+
return join(builtinMethodRootPath(), relativePath);
|
|
38
38
|
}
|
|
39
39
|
function assertBuiltinZoneId(value) {
|
|
40
40
|
if (!BUILTIN_ZONE_ID_SET.has(value)) {
|
|
41
|
-
throw new Error(`Built-in Interf
|
|
41
|
+
throw new Error(`Built-in Interf Method schema declares unsupported zone id "${value}".`);
|
|
42
42
|
}
|
|
43
43
|
return value;
|
|
44
44
|
}
|
|
45
45
|
function assertBuiltinStageId(value) {
|
|
46
46
|
if (!BUILTIN_STAGE_ID_SET.has(value)) {
|
|
47
|
-
throw new Error(`Built-in Interf
|
|
47
|
+
throw new Error(`Built-in Interf Method package declares unsupported stage id "${value}".`);
|
|
48
48
|
}
|
|
49
49
|
return value;
|
|
50
50
|
}
|
|
51
51
|
function loadBuiltinCompiledContract() {
|
|
52
52
|
if (builtinCompiledContractCache)
|
|
53
53
|
return builtinCompiledContractCache;
|
|
54
|
-
const schema = readJsonFileWithSchema(
|
|
54
|
+
const schema = readJsonFileWithSchema(builtinMethodPath("method.schema.json"), "built-in Interf Method schema", MethodCompiledSchemaSchema);
|
|
55
55
|
if (!schema) {
|
|
56
|
-
throw new Error(`Missing or invalid built-in
|
|
56
|
+
throw new Error(`Missing or invalid built-in Method schema at ${builtinMethodPath("method.schema.json")}.`);
|
|
57
57
|
}
|
|
58
|
-
const
|
|
59
|
-
if (!
|
|
60
|
-
throw new Error(`Missing or invalid built-in
|
|
58
|
+
const method = readJsonFileWithSchema(builtinMethodPath("method.json"), "built-in Interf Method package", BuiltinMethodPackageSchema);
|
|
59
|
+
if (!method) {
|
|
60
|
+
throw new Error(`Missing or invalid built-in Method package at ${builtinMethodPath("method.json")}.`);
|
|
61
61
|
}
|
|
62
62
|
const zones = schema.zones.map((zone) => ({
|
|
63
63
|
id: assertBuiltinZoneId(zone.id),
|
|
@@ -67,7 +67,7 @@ function loadBuiltinCompiledContract() {
|
|
|
67
67
|
required: zone.required,
|
|
68
68
|
description: zone.description,
|
|
69
69
|
}));
|
|
70
|
-
const stages =
|
|
70
|
+
const stages = method.stages.map((stage) => ({
|
|
71
71
|
id: assertBuiltinStageId(stage.id),
|
|
72
72
|
contract_type: stage.contract_type,
|
|
73
73
|
reads: stage.reads.map(assertBuiltinZoneId),
|