@interf/compiler 0.21.0 → 0.22.2
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 +65 -63
- package/dist/cli/commands/build-plan.d.ts +2 -0
- package/dist/cli/commands/{method.js → build-plan.js} +89 -72
- package/dist/cli/commands/{compile.d.ts → build.d.ts} +2 -2
- package/dist/cli/commands/{compile.js → build.js} +18 -18
- package/dist/cli/commands/doctor.js +2 -2
- package/dist/cli/commands/mcp.js +48 -48
- package/dist/cli/commands/prep.js +16 -29
- package/dist/cli/commands/reset.d.ts +1 -1
- package/dist/cli/commands/reset.js +6 -6
- package/dist/cli/commands/runs.js +6 -28
- package/dist/cli/commands/status.js +1 -1
- package/dist/cli/commands/test.d.ts +1 -1
- package/dist/cli/commands/test.js +8 -8
- package/dist/cli/commands/web.js +3 -3
- package/dist/cli/commands/wizard.js +38 -38
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +5 -5
- package/dist/interf-ui/404.html +1 -0
- package/dist/interf-ui/__next.__PAGE__.txt +10 -0
- package/dist/interf-ui/__next._full.txt +20 -0
- package/dist/interf-ui/__next._head.txt +5 -0
- package/dist/interf-ui/__next._index.txt +5 -0
- package/dist/{compiler-ui → interf-ui}/__next._tree.txt +3 -4
- package/dist/interf-ui/_next/static/chunks/0.tjb6f4golw..css +3 -0
- package/dist/interf-ui/_next/static/chunks/085-n_jv2ng_q.css +1 -0
- package/dist/interf-ui/_next/static/chunks/0dn41fa_zvgsl.js +1 -0
- package/dist/interf-ui/_next/static/chunks/0g-ea0zj5d-0k.js +1 -0
- package/dist/interf-ui/_next/static/chunks/0gwqglc4iz583.js +1 -0
- package/dist/interf-ui/_next/static/chunks/0haldgm65ve6l.js +1 -0
- package/dist/interf-ui/_next/static/chunks/0nv3am99vjzn4.js +1 -0
- package/dist/{compiler-ui/_next/static/chunks/02f_.8.ebn556.js → interf-ui/_next/static/chunks/0s77gt_o4jwtx.js} +1 -1
- package/dist/interf-ui/_next/static/chunks/0~a36ujuzpaz..js +116 -0
- package/dist/interf-ui/_next/static/chunks/10jeodxe4nkgj.js +31 -0
- package/dist/interf-ui/_next/static/chunks/119h2rouych2t.js +1 -0
- package/dist/interf-ui/_next/static/chunks/13c8b~m8knjsf.js +1 -0
- package/dist/interf-ui/_next/static/chunks/14dznb2qpt-ho.js +91 -0
- package/dist/interf-ui/_next/static/chunks/15z_en80lrq-3.js +5 -0
- package/dist/{compiler-ui/_next/static/chunks/turbopack-0apv8vb-nczuy.js → interf-ui/_next/static/chunks/turbopack-0p.pvcjrtq-jh.js} +1 -1
- package/dist/interf-ui/_next/static/chunks/turbopack-0usj_75.8frlw.js +1 -0
- package/dist/interf-ui/_not-found/__next._full.txt +15 -0
- package/dist/interf-ui/_not-found/__next._head.txt +5 -0
- package/dist/interf-ui/_not-found/__next._index.txt +5 -0
- package/dist/{compiler-ui → interf-ui}/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/dist/interf-ui/_not-found/__next._not-found.txt +5 -0
- package/dist/{compiler-ui → interf-ui}/_not-found/__next._tree.txt +2 -3
- package/dist/interf-ui/_not-found.html +1 -0
- package/dist/interf-ui/_not-found.txt +15 -0
- package/dist/interf-ui/index.html +1 -0
- package/dist/interf-ui/index.txt +20 -0
- package/dist/packages/build-plans/authoring/build-plan-authoring.d.ts +36 -0
- package/dist/packages/{methods/authoring/method-authoring.js → build-plans/authoring/build-plan-authoring.js} +52 -52
- package/dist/packages/build-plans/authoring/build-plan-edit-session.d.ts +18 -0
- package/dist/packages/{methods/authoring/method-edit-session.js → build-plans/authoring/build-plan-edit-session.js} +34 -34
- package/dist/packages/build-plans/authoring/build-plan-improvement.d.ts +23 -0
- package/dist/packages/build-plans/authoring/build-plan-improvement.js +216 -0
- package/dist/packages/build-plans/authoring/index.d.ts +4 -0
- package/dist/packages/build-plans/authoring/index.js +4 -0
- package/dist/packages/{methods/authoring/lib/method-edit-utils.d.ts → build-plans/authoring/lib/build-plan-edit-utils.d.ts} +3 -3
- package/dist/packages/build-plans/build-plan-resolution.d.ts +6 -0
- package/dist/packages/build-plans/build-plan-resolution.js +7 -0
- package/dist/packages/build-plans/index.d.ts +2 -0
- package/dist/packages/build-plans/index.js +2 -0
- package/dist/packages/build-plans/package/build-plan-definitions.d.ts +61 -0
- package/dist/packages/build-plans/package/build-plan-definitions.js +214 -0
- package/dist/packages/{methods/package/method-helpers.d.ts → build-plans/package/build-plan-helpers.d.ts} +7 -7
- package/dist/packages/{methods/package/method-helpers.js → build-plans/package/build-plan-helpers.js} +20 -20
- package/dist/packages/build-plans/package/build-plan-review-paths.d.ts +10 -0
- package/dist/packages/build-plans/package/build-plan-review-paths.js +31 -0
- package/dist/packages/{methods/package/method-stage-runner.d.ts → build-plans/package/build-plan-stage-runner.d.ts} +12 -12
- package/dist/packages/{methods/package/method-stage-runner.js → build-plans/package/build-plan-stage-runner.js} +10 -10
- package/dist/packages/build-plans/package/builtin-build-plan.d.ts +37 -0
- package/dist/packages/build-plans/package/builtin-build-plan.js +91 -0
- package/dist/packages/{methods → build-plans}/package/context-interface.d.ts +11 -11
- package/dist/packages/{methods → build-plans}/package/context-interface.js +23 -23
- package/dist/packages/build-plans/package/interf-build-plan-package.d.ts +31 -0
- package/dist/packages/build-plans/package/interf-build-plan-package.js +466 -0
- package/dist/packages/{methods → build-plans}/package/lib/package-root.js +1 -1
- package/dist/packages/build-plans/package/local-build-plans.d.ts +74 -0
- package/dist/packages/{methods/package/local-methods.js → build-plans/package/local-build-plans.js} +152 -152
- package/dist/packages/build-plans/package/user-build-plans.d.ts +17 -0
- package/dist/packages/build-plans/package/user-build-plans.js +77 -0
- package/dist/packages/contracts/index.d.ts +1 -1
- package/dist/packages/contracts/lib/preparation-paths.d.ts +37 -37
- package/dist/packages/contracts/lib/preparation-paths.js +43 -43
- package/dist/packages/contracts/lib/schema.d.ts +34 -41
- package/dist/packages/contracts/lib/schema.js +42 -34
- package/dist/packages/engine/action-definitions.d.ts +60 -60
- package/dist/packages/engine/action-definitions.js +198 -197
- package/dist/packages/engine/action-planner.d.ts +2 -2
- package/dist/packages/engine/action-planner.js +5 -5
- package/dist/packages/engine/action-values.d.ts +1 -1
- package/dist/packages/engine/action-values.js +1 -1
- package/dist/packages/engine/agents/index.d.ts +2 -2
- package/dist/packages/engine/agents/index.js +1 -1
- package/dist/packages/engine/agents/lib/args.d.ts +2 -2
- package/dist/packages/engine/agents/lib/args.js +1 -1
- package/dist/packages/engine/agents/lib/constants.js +1 -1
- package/dist/packages/engine/agents/lib/execution-profile.d.ts +5 -5
- package/dist/packages/engine/agents/lib/execution-profile.js +3 -3
- package/dist/packages/engine/agents/lib/executors.d.ts +11 -11
- package/dist/packages/engine/agents/lib/render.js +4 -4
- package/dist/packages/engine/agents/lib/shells.d.ts +30 -30
- package/dist/packages/engine/agents/lib/shells.js +248 -248
- package/dist/packages/engine/agents/lib/types.d.ts +2 -2
- package/dist/packages/engine/agents/lib/verifiable-context-bootstrap.d.ts +3 -0
- package/dist/packages/engine/agents/lib/verifiable-context-bootstrap.js +19 -0
- package/dist/packages/engine/agents/role-executors.d.ts +7 -7
- package/dist/packages/engine/agents/role-executors.js +2 -2
- package/dist/packages/engine/agents/role-router.d.ts +2 -2
- package/dist/packages/engine/agents/role-router.js +1 -1
- package/dist/packages/engine/build/artifact-counts.d.ts +1 -0
- package/dist/packages/engine/{compile → build}/artifact-counts.js +7 -7
- package/dist/packages/engine/{compile → build}/artifact-status.d.ts +8 -8
- package/dist/packages/engine/{compile → build}/artifact-status.js +19 -19
- package/dist/packages/engine/{compile → build}/billing-events.d.ts +4 -4
- package/dist/packages/engine/{compile → build}/billing-events.js +4 -4
- package/dist/packages/engine/build/build-execution.d.ts +4 -0
- package/dist/packages/engine/build/build-execution.js +4 -0
- package/dist/packages/engine/build/build-pipeline.d.ts +56 -0
- package/dist/packages/engine/{compile/compiled-pipeline.js → build/build-pipeline.js} +55 -55
- package/dist/packages/engine/build/build-plan-primitives.d.ts +2 -0
- package/dist/packages/engine/{compile/method-primitives.js → build/build-plan-primitives.js} +1 -1
- package/dist/packages/engine/build/build-plan-runs.d.ts +14 -0
- package/dist/packages/engine/build/build-plan-runs.js +31 -0
- package/dist/packages/engine/build/build-stage-plan.d.ts +16 -0
- package/dist/packages/engine/build/build-stage-plan.js +100 -0
- package/dist/packages/engine/build/build-stage-runner.d.ts +15 -0
- package/dist/packages/engine/{compile/compiled-stage-runner.js → build/build-stage-runner.js} +21 -21
- package/dist/packages/engine/build/build-target.d.ts +11 -0
- package/dist/packages/engine/build/build-target.js +16 -0
- package/dist/packages/engine/{compile → build}/check-evaluator.d.ts +4 -4
- package/dist/packages/engine/{compile → build}/check-evaluator.js +1 -1
- package/dist/packages/engine/{compile → build}/discovery.d.ts +2 -2
- package/dist/packages/engine/{compile → build}/discovery.js +4 -4
- package/dist/packages/engine/{compile → build}/index.d.ts +6 -6
- package/dist/packages/engine/{compile → build}/index.js +5 -5
- package/dist/packages/engine/{compile → build}/lib/schema.d.ts +79 -79
- package/dist/packages/engine/{compile → build}/lib/schema.js +71 -71
- package/dist/packages/engine/build/reset.d.ts +2 -0
- package/dist/packages/engine/build/reset.js +74 -0
- package/dist/packages/engine/{compile → build}/runtime-contracts.js +8 -8
- package/dist/packages/engine/build/runtime-inventory.d.ts +7 -0
- package/dist/packages/engine/{compile → build}/runtime-inventory.js +8 -8
- package/dist/packages/engine/{compile → build}/runtime-paths.js +6 -6
- package/dist/packages/engine/{compile → build}/runtime-prompt.js +11 -11
- package/dist/packages/engine/build/runtime-reconcile.d.ts +2 -0
- package/dist/packages/engine/{compile → build}/runtime-reconcile.js +18 -18
- package/dist/packages/engine/{compile → build}/runtime-runs.js +27 -27
- package/dist/packages/engine/{compile → build}/runtime-types.d.ts +10 -10
- package/dist/packages/engine/build/source-files.d.ts +46 -0
- package/dist/packages/engine/{compile → build}/source-files.js +32 -32
- package/dist/packages/engine/build/state-artifacts.d.ts +9 -0
- package/dist/packages/engine/build/state-artifacts.js +14 -0
- package/dist/packages/engine/build/state-health.d.ts +4 -0
- package/dist/packages/engine/{compile → build}/state-health.js +40 -40
- package/dist/packages/engine/build/state-io.d.ts +11 -0
- package/dist/packages/engine/{compile → build}/state-io.js +22 -22
- package/dist/packages/engine/build/state-paths.js +16 -0
- package/dist/packages/engine/build/state-view.d.ts +5 -0
- package/dist/packages/engine/{compile → build}/state-view.js +29 -29
- package/dist/packages/engine/build/state.d.ts +7 -0
- package/dist/packages/engine/build/state.js +12 -0
- package/dist/packages/engine/build/validate-verifiable-context.d.ts +27 -0
- package/dist/packages/engine/{compile/validate-compiled.js → build/validate-verifiable-context.js} +73 -73
- package/dist/packages/engine/{compile → build}/validate.d.ts +4 -4
- package/dist/packages/engine/{compile → build}/validate.js +27 -27
- package/dist/packages/engine/build/verifiable-context-paths.d.ts +47 -0
- package/dist/packages/engine/build/verifiable-context-paths.js +121 -0
- package/dist/packages/engine/build/verifiable-context-schema.d.ts +21 -0
- package/dist/packages/engine/build/verifiable-context-schema.js +126 -0
- package/dist/packages/engine/client.d.ts +16 -16
- package/dist/packages/engine/client.js +21 -21
- package/dist/packages/engine/cloud-seams.d.ts +3 -3
- package/dist/packages/engine/execution/index.d.ts +2 -2
- package/dist/packages/engine/execution/index.js +1 -1
- package/dist/packages/engine/execution/lib/schema.d.ts +90 -95
- package/dist/packages/engine/execution/lib/schema.js +31 -31
- package/dist/packages/engine/index.d.ts +7 -7
- package/dist/packages/engine/index.js +3 -3
- package/dist/packages/engine/instance-paths.d.ts +39 -39
- package/dist/packages/engine/instance-paths.js +48 -48
- package/dist/packages/engine/lib/schema.d.ts +900 -472
- package/dist/packages/engine/lib/schema.js +137 -153
- package/dist/packages/engine/native-run-handlers.d.ts +12 -12
- package/dist/packages/engine/native-run-handlers.js +135 -135
- package/dist/packages/engine/preparation-store.d.ts +22 -23
- package/dist/packages/engine/preparation-store.js +30 -31
- package/dist/packages/engine/readiness-check-draft.d.ts +2 -2
- package/dist/packages/engine/readiness-check-draft.js +1 -1
- package/dist/packages/engine/requested-artifacts.d.ts +2 -2
- package/dist/packages/engine/routes.d.ts +18 -17
- package/dist/packages/engine/routes.js +20 -19
- package/dist/packages/engine/run-observability.d.ts +5 -3
- package/dist/packages/engine/run-observability.js +101 -89
- package/dist/packages/engine/runtime-caches.d.ts +16 -16
- package/dist/packages/engine/runtime-caches.js +26 -26
- package/dist/packages/engine/runtime-event-applier.d.ts +2 -2
- package/dist/packages/engine/runtime-event-applier.js +1 -1
- package/dist/packages/engine/runtime-persistence.d.ts +9 -9
- package/dist/packages/engine/runtime-persistence.js +16 -16
- package/dist/packages/engine/runtime-proposal-helpers.d.ts +14 -14
- package/dist/packages/engine/runtime-proposal-helpers.js +78 -80
- package/dist/packages/engine/runtime-resource-builders.d.ts +12 -12
- package/dist/packages/engine/runtime-resource-builders.js +19 -19
- package/dist/packages/engine/runtime.d.ts +52 -61
- package/dist/packages/engine/runtime.js +440 -463
- package/dist/packages/engine/server.d.ts +2 -2
- package/dist/packages/engine/server.js +147 -116
- package/dist/packages/engine/service-registry.d.ts +5 -17
- package/dist/packages/engine/service-registry.js +5 -20
- package/dist/packages/engine/verify/lib/schema.d.ts +19 -19
- package/dist/packages/engine/verify/lib/schema.js +36 -8
- package/dist/packages/engine/verify/readiness-check-run.d.ts +15 -16
- package/dist/packages/engine/verify/readiness-check-run.js +46 -46
- package/dist/packages/engine/verify/verify-execution.d.ts +3 -3
- package/dist/packages/engine/verify/verify-execution.js +10 -10
- package/dist/packages/engine/verify/verify-paths.d.ts +4 -4
- package/dist/packages/engine/verify/verify-paths.js +17 -17
- package/dist/packages/engine/verify/verify-sandbox.d.ts +1 -1
- package/dist/packages/engine/verify/verify-sandbox.js +26 -26
- package/dist/packages/engine/verify/verify-targets.d.ts +2 -2
- package/dist/packages/engine/verify/verify-targets.js +17 -17
- package/dist/packages/engine/verify/verify-types.d.ts +2 -2
- package/dist/packages/engine/verify/verify.d.ts +1 -1
- package/dist/packages/engine/verify/verify.js +1 -1
- package/dist/packages/engine/wire-schemas.d.ts +38 -40
- package/dist/packages/engine/wire-schemas.js +13 -13
- package/dist/packages/project/index.d.ts +1 -1
- package/dist/packages/project/interf-bootstrap.d.ts +1 -1
- package/dist/packages/project/interf-bootstrap.js +1 -1
- package/dist/packages/project/interf-detect.d.ts +11 -11
- package/dist/packages/project/interf-detect.js +30 -30
- package/dist/packages/project/interf-scaffold.d.ts +3 -3
- package/dist/packages/project/interf-scaffold.js +72 -72
- package/dist/packages/project/interf.d.ts +4 -4
- package/dist/packages/project/interf.js +3 -3
- package/dist/packages/project/lib/schema.d.ts +12 -12
- package/dist/packages/project/lib/schema.js +14 -14
- package/dist/packages/project/preparation-entries.d.ts +3 -3
- package/dist/packages/project/preparation-entries.js +19 -19
- package/dist/packages/project/source-config.d.ts +10 -10
- package/dist/packages/project/source-config.js +58 -58
- package/package.json +15 -15
- package/public-repo/CONTRIBUTING.md +12 -12
- package/public-repo/README.md +65 -63
- package/public-repo/SECURITY.md +3 -3
- package/public-repo/build-plans/interf-default/README.md +33 -0
- package/public-repo/{methods/interf-default/compile → build-plans/interf-default/build}/stages/shape/SKILL.md +10 -10
- package/public-repo/{methods/interf-default/compile → build-plans/interf-default/build}/stages/structure/SKILL.md +2 -2
- package/public-repo/{methods/interf-default/compile → build-plans/interf-default/build}/stages/summarize/SKILL.md +1 -1
- package/public-repo/{methods/interf-default/method.json → build-plans/interf-default/build-plan.json} +15 -15
- package/public-repo/{methods/interf-default/method.schema.json → build-plans/interf-default/build-plan.schema.json} +4 -4
- package/public-repo/build-plans/interf-default/improve/SKILL.md +18 -0
- package/public-repo/{methods → build-plans}/interf-default/use/query/SKILL.md +6 -6
- package/public-repo/plugins/README.md +1 -1
- package/public-repo/plugins/interf/.claude-plugin/plugin.json +3 -3
- package/public-repo/plugins/interf/README.md +4 -1
- package/public-repo/plugins/interf/skills/interf/SKILL.md +189 -290
- package/public-repo/skills/interf/SKILL.md +189 -290
- package/LICENSE.md +0 -1
- package/TRADEMARKS.md +0 -8
- package/dist/cli/commands/method.d.ts +0 -2
- package/dist/compiler-ui/404.html +0 -1
- package/dist/compiler-ui/__next.__PAGE__.txt +0 -10
- package/dist/compiler-ui/__next._full.txt +0 -21
- package/dist/compiler-ui/__next._head.txt +0 -5
- package/dist/compiler-ui/__next._index.txt +0 -6
- package/dist/compiler-ui/_next/static/chunks/01646j7yi.w5a.css +0 -1
- package/dist/compiler-ui/_next/static/chunks/02r7siaw-_p5w.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/04d0ly-7xb~-j.js +0 -91
- package/dist/compiler-ui/_next/static/chunks/0fhs9psnxqd8s.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/0mssmhpbifj15.css +0 -2
- package/dist/compiler-ui/_next/static/chunks/0nypu~ddwxari.js +0 -116
- package/dist/compiler-ui/_next/static/chunks/0p3s8iyhgcww2.js +0 -31
- package/dist/compiler-ui/_next/static/chunks/0tjf-vu_rz8s0.css +0 -1
- package/dist/compiler-ui/_next/static/chunks/0u6p3fpbbfgtl.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/0wpx5..8dnh0w.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/0y0uj160p0ts~.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/10t8l~_oenf.c.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/13gz9e7z~imx1.js +0 -5
- package/dist/compiler-ui/_next/static/chunks/156xed-b6czaw.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/turbopack-02-3e_c-yz~5g.js +0 -1
- package/dist/compiler-ui/_not-found/__next._full.txt +0 -16
- package/dist/compiler-ui/_not-found/__next._head.txt +0 -5
- package/dist/compiler-ui/_not-found/__next._index.txt +0 -6
- package/dist/compiler-ui/_not-found/__next._not-found.txt +0 -5
- package/dist/compiler-ui/_not-found.html +0 -1
- package/dist/compiler-ui/_not-found.txt +0 -16
- package/dist/compiler-ui/index.html +0 -1
- package/dist/compiler-ui/index.txt +0 -21
- package/dist/packages/engine/agents/lib/compiled-bootstrap.d.ts +0 -3
- package/dist/packages/engine/agents/lib/compiled-bootstrap.js +0 -19
- package/dist/packages/engine/compile/artifact-counts.d.ts +0 -1
- package/dist/packages/engine/compile/compiled-compile.d.ts +0 -4
- package/dist/packages/engine/compile/compiled-compile.js +0 -4
- package/dist/packages/engine/compile/compiled-paths.d.ts +0 -47
- package/dist/packages/engine/compile/compiled-paths.js +0 -121
- package/dist/packages/engine/compile/compiled-pipeline.d.ts +0 -56
- package/dist/packages/engine/compile/compiled-schema.d.ts +0 -21
- package/dist/packages/engine/compile/compiled-schema.js +0 -126
- package/dist/packages/engine/compile/compiled-stage-plan.d.ts +0 -16
- package/dist/packages/engine/compile/compiled-stage-plan.js +0 -100
- package/dist/packages/engine/compile/compiled-stage-runner.d.ts +0 -15
- package/dist/packages/engine/compile/compiled-target.d.ts +0 -11
- package/dist/packages/engine/compile/compiled-target.js +0 -16
- package/dist/packages/engine/compile/method-primitives.d.ts +0 -2
- package/dist/packages/engine/compile/method-runs.d.ts +0 -14
- package/dist/packages/engine/compile/method-runs.js +0 -31
- package/dist/packages/engine/compile/reset.d.ts +0 -2
- package/dist/packages/engine/compile/reset.js +0 -74
- package/dist/packages/engine/compile/runtime-inventory.d.ts +0 -7
- package/dist/packages/engine/compile/runtime-reconcile.d.ts +0 -2
- package/dist/packages/engine/compile/source-files.d.ts +0 -46
- package/dist/packages/engine/compile/state-artifacts.d.ts +0 -9
- package/dist/packages/engine/compile/state-artifacts.js +0 -14
- package/dist/packages/engine/compile/state-health.d.ts +0 -4
- package/dist/packages/engine/compile/state-io.d.ts +0 -11
- package/dist/packages/engine/compile/state-paths.js +0 -16
- package/dist/packages/engine/compile/state-view.d.ts +0 -5
- package/dist/packages/engine/compile/state.d.ts +0 -7
- package/dist/packages/engine/compile/state.js +0 -12
- package/dist/packages/engine/compile/validate-compiled.d.ts +0 -27
- package/dist/packages/methods/authoring/index.d.ts +0 -4
- package/dist/packages/methods/authoring/index.js +0 -4
- package/dist/packages/methods/authoring/method-authoring.d.ts +0 -36
- package/dist/packages/methods/authoring/method-edit-session.d.ts +0 -18
- package/dist/packages/methods/authoring/method-improvement.d.ts +0 -23
- package/dist/packages/methods/authoring/method-improvement.js +0 -217
- package/dist/packages/methods/index.d.ts +0 -2
- package/dist/packages/methods/index.js +0 -2
- package/dist/packages/methods/method-resolution.d.ts +0 -6
- package/dist/packages/methods/method-resolution.js +0 -7
- package/dist/packages/methods/package/builtin-compiled-method.d.ts +0 -37
- package/dist/packages/methods/package/builtin-compiled-method.js +0 -91
- package/dist/packages/methods/package/interf-method-package.d.ts +0 -31
- package/dist/packages/methods/package/interf-method-package.js +0 -466
- package/dist/packages/methods/package/local-methods.d.ts +0 -74
- package/dist/packages/methods/package/method-definitions.d.ts +0 -61
- package/dist/packages/methods/package/method-definitions.js +0 -214
- package/dist/packages/methods/package/method-review-paths.d.ts +0 -10
- package/dist/packages/methods/package/method-review-paths.js +0 -31
- package/dist/packages/methods/package/user-methods.d.ts +0 -17
- package/dist/packages/methods/package/user-methods.js +0 -77
- package/public-repo/methods/interf-default/README.md +0 -33
- package/public-repo/methods/interf-default/improve/SKILL.md +0 -18
- /package/dist/{compiler-ui/_next/static/tYHMLL9oKds1yDoNYgkPV → interf-ui/_next/static/--reS3xBzM5zc6QxNjZd6}/_buildManifest.js +0 -0
- /package/dist/{compiler-ui/_next/static/tYHMLL9oKds1yDoNYgkPV → interf-ui/_next/static/--reS3xBzM5zc6QxNjZd6}/_clientMiddlewareManifest.js +0 -0
- /package/dist/{compiler-ui/_next/static/tYHMLL9oKds1yDoNYgkPV → interf-ui/_next/static/--reS3xBzM5zc6QxNjZd6}/_ssgManifest.js +0 -0
- /package/dist/{compiler-ui → interf-ui}/_next/static/chunks/03~yq9q893hmn.js +0 -0
- /package/dist/{compiler-ui → interf-ui}/_next/static/chunks/0y5z3t-z1c8ks.js.map +0 -0
- /package/dist/{compiler-ui → interf-ui}/_next/static/chunks/turbopack-worker-0sjn--fhq~1cg.js +0 -0
- /package/dist/{compiler-ui → interf-ui}/_next/static/media/GeistMono_Variable.p.17jn9btb_52pq.woff2 +0 -0
- /package/dist/{compiler-ui → interf-ui}/_next/static/media/Geist_Variable-s.p.0-te~ja_gpvcf.woff2 +0 -0
- /package/dist/{compiler-ui → interf-ui}/_next/static/media/worker.102zas1s52_pf.js +0 -0
- /package/dist/packages/{methods/authoring/lib/method-edit-utils.js → build-plans/authoring/lib/build-plan-edit-utils.js} +0 -0
- /package/dist/packages/{methods → build-plans}/package/lib/package-root.d.ts +0 -0
- /package/dist/packages/engine/{compile → build}/runtime-contracts.d.ts +0 -0
- /package/dist/packages/engine/{compile → build}/runtime-paths.d.ts +0 -0
- /package/dist/packages/engine/{compile → build}/runtime-prompt.d.ts +0 -0
- /package/dist/packages/engine/{compile → build}/runtime-runs.d.ts +0 -0
- /package/dist/packages/engine/{compile → build}/runtime-types.js +0 -0
- /package/dist/packages/engine/{compile → build}/runtime.d.ts +0 -0
- /package/dist/packages/engine/{compile → build}/runtime.js +0 -0
- /package/dist/packages/engine/{compile → build}/state-paths.d.ts +0 -0
- /package/dist/packages/engine/{compile → build}/validate-helpers.d.ts +0 -0
- /package/dist/packages/engine/{compile → build}/validate-helpers.js +0 -0
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, rmSync, statSync, } from "node:fs";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { BuildRunSchema, } from "./execution/lib/schema.js";
|
|
4
4
|
import { createRunEventId, createRunEventTimestamp, } from "./execution/events.js";
|
|
5
|
-
import { loadState, } from "./
|
|
6
|
-
import { actionProposalPath, actionProposalsRoot, byCreatedAtDesc,
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { ACTION_PLANNER_CLARIFICATION_MESSAGE, actionAssistantMessage, actionCommandPreview, actionTypeFromValues,
|
|
5
|
+
import { loadState, } from "./build/state.js";
|
|
6
|
+
import { actionProposalPath, actionProposalsRoot, byCreatedAtDesc, buildRunPath, buildRunsRoot, listJsonFiles, localJobPath, localJobsRoot, newestFirst, readActionProposalAt, readBuildRunAt, readLocalJobRunAt, readRuntimeRunHistory, readVerifyRunAt, verifyRunPath, verifyRunsRoot, timestampKey, writeJsonFile, } from "./runtime-persistence.js";
|
|
7
|
+
import { BuildPlanListingCache, MtimeListingCache, ReadinessCache, RunListingCache, } from "./runtime-caches.js";
|
|
8
|
+
import { applyEventToBuildRun, applyEventToLocalJob, } from "./runtime-event-applier.js";
|
|
9
|
+
import { buildBuildPlanResource, buildPreparationResource, createRunId, logsForRuntimeRun, logsForStageRun, proofForStage, readinessStateToPreparationReadiness, readinessSummaryForStatus, readinessTargetResult, stageArtifactRefs, } from "./runtime-resource-builders.js";
|
|
10
|
+
import { ACTION_PLANNER_CLARIFICATION_MESSAGE, actionAssistantMessage, actionCommandPreview, actionTypeFromValues, actionValueBuildPlanTaskPrompt, configuredAgentName, createActionProposalId, detachBuildPlanFromPreparation, detectedExecutorOptions, directServiceEndpointForAction, hasVerifiableContextTestTarget, buildPlanAuthoringHintFromPrompt, buildPlanAuthoringPromptFallback, buildPlanIdForProposal, buildPlanLabelFromId, numberValue, requireSelectedBuildPlan, sanitizeActionProposalPlan, stringValue, testModeFromValues, } from "./runtime-proposal-helpers.js";
|
|
11
11
|
import { ReadinessSchema, } from "../contracts/lib/schema.js";
|
|
12
|
-
import { discoverSourceFiles, } from "./
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { findSourcePreparationConfig, fingerprintReadinessChecks, listSourcePreparationConfigs, loadSourceFolderConfig,
|
|
12
|
+
import { discoverSourceFiles, } from "./build/discovery.js";
|
|
13
|
+
import { resetBuildGeneratedState, } from "./build/reset.js";
|
|
14
|
+
import { ensureVerifiableContextScaffold, readInterfConfig, } from "../project/interf.js";
|
|
15
|
+
import { findSourcePreparationConfig, fingerprintReadinessChecks, listSourcePreparationConfigs, loadSourceFolderConfig, DEFAULT_BUILD_PLAN_ID, buildPlanIdForSourcePreparationConfig, resolveConfiguredSourceFolderPath, resolveSourcePreparationPath, removeSourcePreparationConfig, saveSourceFolderConfig, syncVerifiableContextInterfConfigFromSourcePreparationConfig, upsertSourcePreparationConfig, } from "../project/source-config.js";
|
|
16
16
|
import { listSourceFolderChoices, } from "../project/source-folders.js";
|
|
17
|
-
import { asPreparationDataDir,
|
|
18
|
-
import {
|
|
19
|
-
import { aggregateArtifactVerdict, computeArtifactStatuses, } from "./
|
|
20
|
-
import { JsonlBillingEventSink, buildCompilationEventsForRun, defaultBillingEventLogPath, } from "./
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { PACKAGE_ROOT } from "../
|
|
17
|
+
import { asPreparationDataDir, preparationVerifiableContextPath, userBuildPlansRoot, preparationConfigPath, preparationBuildPlanPackagePath, preparationBuildPlansRoot, } from "../contracts/lib/preparation-paths.js";
|
|
18
|
+
import { getBuildPlan, listBuildPlanChoices, } from "../build-plans/package/build-plan-definitions.js";
|
|
19
|
+
import { aggregateArtifactVerdict, computeArtifactStatuses, } from "./build/artifact-status.js";
|
|
20
|
+
import { JsonlBillingEventSink, buildCompilationEventsForRun, defaultBillingEventLogPath, } from "./build/billing-events.js";
|
|
21
|
+
import { buildPlanDefinitionPath, resolveBuildPlanPackageSourcePath, } from "../build-plans/package/local-build-plans.js";
|
|
22
|
+
import { seedLocalBuildPlanPackageFromBase, } from "../build-plans/package/interf-build-plan-package.js";
|
|
23
|
+
import { PACKAGE_ROOT } from "../build-plans/package/lib/package-root.js";
|
|
24
24
|
import { resolveAgent, detectAgents, supportsAutomatedRuns, } from "./agents/lib/detection.js";
|
|
25
25
|
import { loadUserConfig, saveUserConfig, } from "./agents/lib/user-config.js";
|
|
26
26
|
import { loadAgentsRegistry, registerCustomAgent, unregisterCustomAgent, patchRoleMap, setActiveAgent, } from "./agents/registry.js";
|
|
27
27
|
import { readSavedReadinessCheckRun, } from "./verify/readiness-check-run.js";
|
|
28
|
-
import {
|
|
29
|
-
import { ActionProposalApprovalRequestSchema, ActionProposalCreateRequestSchema, ActionProposalPlanSchema, ActionProposalResourceSchema, ActionProposalTypeSchema,
|
|
28
|
+
import { createVerifiableContextTestTarget, } from "./verify/verify-targets.js";
|
|
29
|
+
import { ActionProposalApprovalRequestSchema, ActionProposalCreateRequestSchema, ActionProposalPlanSchema, ActionProposalResourceSchema, ActionProposalTypeSchema, BuildRunCreateRequestSchema, BuildRunResourceSchema, LocalExecutorStatusSchema, LocalExecutorSelectRequestSchema, LocalServiceHealthSchema, LocalRunHandlerResultSchema, LocalJobEventAppendRequestSchema, LocalJobRunCreateRequestSchema, LocalJobRunResourceSchema, SourceFileResourceSchema, VerifiableContextResourceSchema, PreparationSetupCreateRequestSchema, PreparationSetupResultSchema, BuildPlanChangeCreateRequestSchema, BuildPlanChangeResultSchema, PreparationChangeCreateRequestSchema, PreparationChangeResultSchema, ReadinessCheckDraftCreateRequestSchema, ReadinessCheckDraftResultSchema, ResetRequestSchema, ResetResultSchema, VerifyRunCreateRequestSchema, VerifyRunResourceSchema, BuildPlanAuthoringCreateRequestSchema, BuildPlanAuthoringResultSchema, } from "./lib/schema.js";
|
|
30
30
|
import { buildLocalServiceUrl, } from "./routes.js";
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
31
|
+
import { BuildPlanAuthoringActionValuesSchema, PreparationSetupActionValuesSchema, } from "./action-values.js";
|
|
32
|
+
import { buildRunToObservability, jobRunToObservability, verifyRunToObservability, uniqueArtifacts, } from "./run-observability.js";
|
|
33
33
|
import { artifactRequirementsFromRequestedArtifacts } from "./requested-artifacts.js";
|
|
34
|
-
/** TTL for `
|
|
34
|
+
/** TTL for `POS../../build-runs` idempotency-key dedupe entries. */
|
|
35
35
|
const IDEMPOTENCY_TTL_MS = 60 * 60 * 1000;
|
|
36
36
|
/** Idempotency cache size at which to schedule an opportunistic prune. */
|
|
37
37
|
const IDEMPOTENCY_PRUNE_THRESHOLD = 64;
|
|
38
|
-
const INTERRUPTED_COMPILE_RUN_MESSAGE = "
|
|
38
|
+
const INTERRUPTED_COMPILE_RUN_MESSAGE = "Build run interrupted because the Interf engine stopped before the run reached a terminal state.";
|
|
39
39
|
const INTERRUPTED_JOB_RUN_MESSAGE = "Job interrupted because the Interf engine stopped before the job reached a terminal state.";
|
|
40
|
-
function
|
|
40
|
+
function isTerminalBuildRunStatus(status) {
|
|
41
41
|
return status === "succeeded" || status === "failed" || status === "cancelled";
|
|
42
42
|
}
|
|
43
43
|
function isTerminalJobStatus(status) {
|
|
44
44
|
return status === "succeeded" || status === "failed" || status === "cancelled";
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function countsFromVerifiableContextState(state) {
|
|
47
47
|
const counts = {};
|
|
48
48
|
for (const stage of Object.values(state.stages ?? {})) {
|
|
49
49
|
for (const [key, value] of Object.entries(stage.counts ?? {})) {
|
|
@@ -66,8 +66,8 @@ export class LocalServiceRuntime {
|
|
|
66
66
|
/**
|
|
67
67
|
* The seed root path the runtime was constructed with. Used as a
|
|
68
68
|
* non-preparation fallback when a preparation-independent route
|
|
69
|
-
* (
|
|
70
|
-
* shared state (user-library
|
|
69
|
+
* (Build Plans, action proposals, runs listings) needs an anchor to load
|
|
70
|
+
* shared state (user-library Build Plans, bundled Build Plans, etc).
|
|
71
71
|
*/
|
|
72
72
|
rootPath;
|
|
73
73
|
/**
|
|
@@ -82,8 +82,8 @@ export class LocalServiceRuntime {
|
|
|
82
82
|
/** In-flight runs across all preparations. Used for `idle_for_seconds`. */
|
|
83
83
|
activeRunCount = 0;
|
|
84
84
|
/**
|
|
85
|
-
* Active
|
|
86
|
-
* when a
|
|
85
|
+
* Active Build run cancellation handles, keyed by run id. Populated
|
|
86
|
+
* when a Build run is launched and cleared once the run reaches a
|
|
87
87
|
* terminal state. Each entry remembers where the persisted record lives
|
|
88
88
|
* so cancel can mark it without re-resolving the Preparation.
|
|
89
89
|
*
|
|
@@ -92,9 +92,9 @@ export class LocalServiceRuntime {
|
|
|
92
92
|
* need a shared lease store so a replica can take over a run whose
|
|
93
93
|
* owning replica died.
|
|
94
94
|
*/
|
|
95
|
-
|
|
95
|
+
activeBuildRuns = new Map();
|
|
96
96
|
/**
|
|
97
|
-
* Idempotency-key cache for `
|
|
97
|
+
* Idempotency-key cache for `POS../../build-runs`. Outer key is the
|
|
98
98
|
* resolved preparation root; inner key is the client-supplied idempotency
|
|
99
99
|
* value. Namespacing per preparation prevents key collisions across
|
|
100
100
|
* tenants on the same engine (CSO finding: a malicious preparation could
|
|
@@ -108,17 +108,17 @@ export class LocalServiceRuntime {
|
|
|
108
108
|
*/
|
|
109
109
|
idempotencyKeyCache = new Map();
|
|
110
110
|
/**
|
|
111
|
-
* Read-side caches. Polling clients (
|
|
111
|
+
* Read-side caches. Polling clients (Interf UI, CLI status loops)
|
|
112
112
|
* hit list/get endpoints multiple times per second; without these,
|
|
113
113
|
* every request re-walks the filesystem and re-parses every JSON
|
|
114
114
|
* record through Zod. The runtime invalidates each cache on the
|
|
115
115
|
* matching write path. See {@link runtime-caches} for design notes.
|
|
116
116
|
*/
|
|
117
|
-
|
|
117
|
+
buildRunCache = new RunListingCache();
|
|
118
118
|
verifyRunCache = new RunListingCache();
|
|
119
119
|
readinessCache = new ReadinessCache();
|
|
120
120
|
sourceFilesCache = new MtimeListingCache();
|
|
121
|
-
|
|
121
|
+
buildPlanListingCache = new BuildPlanListingCache();
|
|
122
122
|
/**
|
|
123
123
|
* 0.17 — sink for per-Artifact billing events. Set once at construction.
|
|
124
124
|
* Lazy-defaults to a per-run JSONL writer when no override was injected.
|
|
@@ -149,7 +149,7 @@ export class LocalServiceRuntime {
|
|
|
149
149
|
// Auto-register the initial preparation so single-preparation callers
|
|
150
150
|
// (existing tests, the current `interf web` command) work without
|
|
151
151
|
// additional bootstrapping. The constructor seed is the only role
|
|
152
|
-
// `options.rootPath` plays; runtime
|
|
152
|
+
// `options.rootPath` plays; runtime operations take `prepDataDir`
|
|
153
153
|
// explicitly afterwards.
|
|
154
154
|
this.registerPreparation(this.rootPath);
|
|
155
155
|
}
|
|
@@ -191,7 +191,7 @@ export class LocalServiceRuntime {
|
|
|
191
191
|
lastActivity: now,
|
|
192
192
|
};
|
|
193
193
|
this.preparationContexts.set(resolved, context);
|
|
194
|
-
this.
|
|
194
|
+
this.finalizeInterruptedBuildRuns(resolved);
|
|
195
195
|
this.finalizeInterruptedJobRuns(resolved);
|
|
196
196
|
this.onRegistryChanged?.();
|
|
197
197
|
return context;
|
|
@@ -268,20 +268,6 @@ export class LocalServiceRuntime {
|
|
|
268
268
|
context.lastActivity = new Date().toISOString();
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
/**
|
|
272
|
-
* Snapshot of registered preparations for the registry / status output.
|
|
273
|
-
* Wire shape (`ServiceRegistryWorkspace`) keeps the legacy
|
|
274
|
-
* "workspace" name for backward compatibility with the public health
|
|
275
|
-
* response and `~/.interf/services.json`. Synthetic-workspace bridge
|
|
276
|
-
* code; do not rename without coordinating an API break.
|
|
277
|
-
*/
|
|
278
|
-
registeredPreparationSnapshots() {
|
|
279
|
-
return this.listRegisteredPreparations().map((context) => ServiceRegistryWorkspaceSchema.parse({
|
|
280
|
-
control_path: context.rootPath,
|
|
281
|
-
registered_at: context.startedAt,
|
|
282
|
-
last_activity: context.lastActivity,
|
|
283
|
-
}));
|
|
284
|
-
}
|
|
285
271
|
/** Seconds since the most recent preparation activity (0 if active). */
|
|
286
272
|
idleForSeconds() {
|
|
287
273
|
const all = this.listRegisteredPreparations();
|
|
@@ -314,7 +300,6 @@ export class LocalServiceRuntime {
|
|
|
314
300
|
started_at: this.startedAt,
|
|
315
301
|
...(this.packageVersion ? { package_version: this.packageVersion } : {}),
|
|
316
302
|
instance_started_at: this.startedAt,
|
|
317
|
-
registered_workspaces: this.registeredPreparationSnapshots(),
|
|
318
303
|
active_runs: this.activeRunCount,
|
|
319
304
|
idle_for_seconds: this.idleForSeconds(),
|
|
320
305
|
});
|
|
@@ -322,14 +307,14 @@ export class LocalServiceRuntime {
|
|
|
322
307
|
listPreparations(prepDataDir) {
|
|
323
308
|
const config = loadSourceFolderConfig(prepDataDir);
|
|
324
309
|
return listSourcePreparationConfigs(config).map((preparation) => {
|
|
325
|
-
const
|
|
310
|
+
const buildRuns = this.listBuildRunsForPreparation(prepDataDir, preparation.name);
|
|
326
311
|
const verifyRuns = this.listVerifyRunsForPreparation(prepDataDir, preparation.name);
|
|
327
312
|
const readiness = this.computePreparationReadiness(prepDataDir, preparation);
|
|
328
|
-
return buildPreparationResource(prepDataDir, preparation, readiness,
|
|
329
|
-
// 0.17 — surface per-Artifact status from the latest
|
|
313
|
+
return buildPreparationResource(prepDataDir, preparation, readiness, buildRuns[0]?.run_id ?? null, verifyRuns[0]?.run_id ?? null,
|
|
314
|
+
// 0.17 — surface per-Artifact status from the latest build
|
|
330
315
|
// run so the UI can render artifact rows on the Preparation
|
|
331
316
|
// page without a separate fetch.
|
|
332
|
-
|
|
317
|
+
buildRuns[0]?.artifacts ?? []);
|
|
333
318
|
});
|
|
334
319
|
}
|
|
335
320
|
getPreparation(prepDataDir, preparationName) {
|
|
@@ -355,14 +340,14 @@ export class LocalServiceRuntime {
|
|
|
355
340
|
}
|
|
356
341
|
computePreparationReadinessUncached(prepDataDir, preparation) {
|
|
357
342
|
const generatedAt = new Date().toISOString();
|
|
358
|
-
const
|
|
359
|
-
const contextExists = existsSync(
|
|
360
|
-
const
|
|
361
|
-
const contextReady =
|
|
362
|
-
const
|
|
343
|
+
const verifiableContextPath = preparationVerifiableContextPath(asPreparationDataDir(prepDataDir), preparation.name);
|
|
344
|
+
const contextExists = existsSync(verifiableContextPath);
|
|
345
|
+
const verifiableContextTarget = createVerifiableContextTestTarget(verifiableContextPath, preparation.name, buildPlanIdForSourcePreparationConfig(preparation) ?? DEFAULT_BUILD_PLAN_ID);
|
|
346
|
+
const contextReady = verifiableContextTarget.eligible;
|
|
347
|
+
const buildRun = this.listBuildRunsForPreparation(prepDataDir, preparation.name)[0] ?? null;
|
|
363
348
|
const verifyRun = this.listVerifyRunsForPreparation(prepDataDir, preparation.name)[0] ?? null;
|
|
364
349
|
const readinessRun = this.readLatestReadinessRun(prepDataDir, preparation.name);
|
|
365
|
-
const artifactStatuses =
|
|
350
|
+
const artifactStatuses = buildRun?.artifacts ?? [];
|
|
366
351
|
const hasArtifactContract = artifactStatuses.length > 0;
|
|
367
352
|
const artifactVerdict = aggregateArtifactVerdict(artifactStatuses);
|
|
368
353
|
const artifactFailures = artifactStatuses.filter((artifact) => artifact.status !== "ready");
|
|
@@ -373,49 +358,49 @@ export class LocalServiceRuntime {
|
|
|
373
358
|
const currentFingerprint = configuredChecks > 0 ? fingerprintReadinessChecks(preparation.checks) : null;
|
|
374
359
|
const readinessRunFingerprint = readinessRun?.checks_fingerprint ?? null;
|
|
375
360
|
const sourceResult = readinessTargetResult(readinessRun?.source_files, currentFingerprint, readinessRunFingerprint);
|
|
376
|
-
const contextResult = readinessTargetResult(readinessRun?.
|
|
361
|
+
const contextResult = readinessTargetResult(readinessRun?.verifiable_context, currentFingerprint, readinessRunFingerprint);
|
|
377
362
|
const checksStale = Boolean(currentFingerprint && readinessRunFingerprint && currentFingerprint !== readinessRunFingerprint);
|
|
378
|
-
const
|
|
379
|
-
if (!
|
|
363
|
+
const buildCheck = (() => {
|
|
364
|
+
if (!buildRun) {
|
|
380
365
|
return {
|
|
381
|
-
gate: "
|
|
366
|
+
gate: "build-run",
|
|
382
367
|
ok: false,
|
|
383
368
|
status: "not-built",
|
|
384
|
-
summary: "No
|
|
385
|
-
artifact_path: contextReady ?
|
|
369
|
+
summary: "No Build run has built verifiable context yet.",
|
|
370
|
+
artifact_path: contextReady ? verifiableContextPath : null,
|
|
386
371
|
};
|
|
387
372
|
}
|
|
388
|
-
if (
|
|
373
|
+
if (buildRun.status === "succeeded") {
|
|
389
374
|
return {
|
|
390
|
-
gate: "
|
|
375
|
+
gate: "build-run",
|
|
391
376
|
ok: contextReady,
|
|
392
377
|
status: contextReady ? "built" : "failed",
|
|
393
378
|
summary: contextReady
|
|
394
|
-
? "Latest
|
|
395
|
-
: "Latest
|
|
396
|
-
run_id:
|
|
397
|
-
artifact_path: contextReady ?
|
|
379
|
+
? "Latest Build run built verifiable context."
|
|
380
|
+
: "Latest Build run finished, but verifiable context is missing.",
|
|
381
|
+
run_id: buildRun.run_id,
|
|
382
|
+
artifact_path: contextReady ? verifiableContextPath : null,
|
|
398
383
|
};
|
|
399
384
|
}
|
|
400
|
-
if (
|
|
385
|
+
if (buildRun.status === "queued" || buildRun.status === "running") {
|
|
401
386
|
return {
|
|
402
|
-
gate: "
|
|
387
|
+
gate: "build-run",
|
|
403
388
|
ok: false,
|
|
404
389
|
status: "building",
|
|
405
|
-
summary: "Latest
|
|
406
|
-
run_id:
|
|
407
|
-
artifact_path: contextExists ?
|
|
390
|
+
summary: "Latest Build run is still building verifiable context.",
|
|
391
|
+
run_id: buildRun.run_id,
|
|
392
|
+
artifact_path: contextExists ? verifiableContextPath : null,
|
|
408
393
|
};
|
|
409
394
|
}
|
|
410
395
|
return {
|
|
411
|
-
gate: "
|
|
396
|
+
gate: "build-run",
|
|
412
397
|
ok: false,
|
|
413
398
|
status: "failed",
|
|
414
|
-
summary:
|
|
415
|
-
? "Latest
|
|
416
|
-
: "Latest
|
|
417
|
-
run_id:
|
|
418
|
-
artifact_path: contextReady ?
|
|
399
|
+
summary: buildRun.status === "cancelled"
|
|
400
|
+
? "Latest Build run was cancelled."
|
|
401
|
+
: "Latest Build run failed.",
|
|
402
|
+
run_id: buildRun.run_id,
|
|
403
|
+
artifact_path: contextReady ? verifiableContextPath : null,
|
|
419
404
|
};
|
|
420
405
|
})();
|
|
421
406
|
const checks = [
|
|
@@ -425,15 +410,15 @@ export class LocalServiceRuntime {
|
|
|
425
410
|
summary: "Preparation is saved in this control plane folder.",
|
|
426
411
|
},
|
|
427
412
|
{
|
|
428
|
-
gate: "
|
|
413
|
+
gate: "verifiable-context",
|
|
429
414
|
ok: contextReady,
|
|
430
415
|
status: contextReady ? "built" : "not-built",
|
|
431
416
|
summary: contextReady
|
|
432
|
-
? "
|
|
433
|
-
: "
|
|
434
|
-
artifact_path: contextReady ?
|
|
417
|
+
? "Verifiable context is built."
|
|
418
|
+
: "Verifiable context has not been built.",
|
|
419
|
+
artifact_path: contextReady ? verifiableContextPath : null,
|
|
435
420
|
},
|
|
436
|
-
|
|
421
|
+
buildCheck,
|
|
437
422
|
{
|
|
438
423
|
gate: "artifact-checks",
|
|
439
424
|
ok: !hasArtifactContract || artifactVerdict === "ready",
|
|
@@ -464,13 +449,13 @@ export class LocalServiceRuntime {
|
|
|
464
449
|
},
|
|
465
450
|
];
|
|
466
451
|
const status = (() => {
|
|
467
|
-
if (
|
|
452
|
+
if (buildRun?.status === "queued" || buildRun?.status === "running")
|
|
468
453
|
return "building";
|
|
469
454
|
if (verifyRun?.status === "queued" || verifyRun?.status === "running")
|
|
470
455
|
return "checking";
|
|
471
|
-
if (
|
|
456
|
+
if (buildRun?.status === "failed" || buildRun?.status === "cancelled")
|
|
472
457
|
return "failed";
|
|
473
|
-
if (!
|
|
458
|
+
if (!buildRun || !contextReady)
|
|
474
459
|
return "not-built";
|
|
475
460
|
if (hasArtifactContract && artifactVerdict !== "ready")
|
|
476
461
|
return "not-ready";
|
|
@@ -491,15 +476,15 @@ export class LocalServiceRuntime {
|
|
|
491
476
|
status,
|
|
492
477
|
ready,
|
|
493
478
|
summary: readinessSummaryForStatus(status),
|
|
494
|
-
|
|
495
|
-
|
|
479
|
+
verifiable_context_path: contextReady ? verifiableContextPath : null,
|
|
480
|
+
latest_build_run_id: buildRun?.run_id ?? null,
|
|
496
481
|
latest_test_run_id: verifyRun?.run_id ?? null,
|
|
497
|
-
|
|
482
|
+
build: buildCheck,
|
|
498
483
|
check_results: {
|
|
499
484
|
configured: configuredChecks,
|
|
500
485
|
fingerprint: currentFingerprint,
|
|
501
486
|
source_files: sourceResult,
|
|
502
|
-
|
|
487
|
+
verifiable_context: contextResult,
|
|
503
488
|
},
|
|
504
489
|
checks,
|
|
505
490
|
});
|
|
@@ -510,19 +495,19 @@ export class LocalServiceRuntime {
|
|
|
510
495
|
.filter((preparation) => !preparationName || preparation.name === preparationName);
|
|
511
496
|
// 0.13+ source binding: the source folder is the user-supplied
|
|
512
497
|
// absolute path on `source_folder.path`. `preparation.path` is the
|
|
513
|
-
//
|
|
514
|
-
//
|
|
515
|
-
// the actual source bytes, not the
|
|
498
|
+
// verifiable-context name inside `prepDataDir` (legacy field; in the
|
|
499
|
+
// current Preparation layout it equals `preparation.name`). Walk
|
|
500
|
+
// the actual source bytes, not the verifiable-context subdir.
|
|
516
501
|
const sourceFolderPath = resolveConfiguredSourceFolderPath(prepDataDir, config) ?? prepDataDir;
|
|
517
502
|
return preparations.flatMap((preparation) => {
|
|
518
|
-
const
|
|
503
|
+
const verifiableContextPath = preparationVerifiableContextPath(asPreparationDataDir(prepDataDir), preparation.name);
|
|
519
504
|
// Cache by source-folder root mtime so identical UI polls do not
|
|
520
505
|
// re-walk and re-stat the entire tree. The cache imposes a short
|
|
521
506
|
// TTL (see runtime-caches.ts) so deeper changes are still picked
|
|
522
507
|
// up promptly.
|
|
523
|
-
const cacheKey = `${preparation.name}\0${sourceFolderPath}\0${
|
|
508
|
+
const cacheKey = `${preparation.name}\0${sourceFolderPath}\0${verifiableContextPath}`;
|
|
524
509
|
return this.sourceFilesCache.get(cacheKey, sourceFolderPath, () => {
|
|
525
|
-
return discoverSourceFiles(sourceFolderPath,
|
|
510
|
+
return discoverSourceFiles(sourceFolderPath, verifiableContextPath).sourceFiles.map((relativePath) => {
|
|
526
511
|
const absolutePath = join(sourceFolderPath, relativePath);
|
|
527
512
|
let sizeBytes = 0;
|
|
528
513
|
let modifiedAt = null;
|
|
@@ -547,57 +532,34 @@ export class LocalServiceRuntime {
|
|
|
547
532
|
});
|
|
548
533
|
});
|
|
549
534
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
let modifiedAt = null;
|
|
556
|
-
try {
|
|
557
|
-
const stat = statSync(absolutePath);
|
|
558
|
-
sizeBytes = stat.size;
|
|
559
|
-
modifiedAt = stat.mtime.toISOString();
|
|
560
|
-
}
|
|
561
|
-
catch {
|
|
562
|
-
sizeBytes = 0;
|
|
563
|
-
modifiedAt = null;
|
|
564
|
-
}
|
|
565
|
-
return WorkspaceFileResourceSchema.parse({
|
|
566
|
-
path: relativePath,
|
|
567
|
-
absolute_path: absolutePath,
|
|
568
|
-
size_bytes: sizeBytes,
|
|
569
|
-
modified_at: modifiedAt,
|
|
570
|
-
});
|
|
571
|
-
});
|
|
572
|
-
}
|
|
573
|
-
listMethods(prepDataDir) {
|
|
574
|
-
// The Method choices list is dominated by repeated reads of
|
|
575
|
-
// method.json + context-interface across builtin / user / workspace
|
|
576
|
-
// method roots. Key the cache off mtimes for the three roots; if
|
|
577
|
-
// any of them changes (a new local Method, an edit to the user
|
|
535
|
+
listBuildPlans(prepDataDir) {
|
|
536
|
+
// The Build Plan choices list is dominated by repeated reads of
|
|
537
|
+
// build-plan.json + context-interface across bundled, user-library, and
|
|
538
|
+
// Preparation-local Build Plan package roots. Key the cache off mtimes; if
|
|
539
|
+
// any of them changes (a new local Build Plan, an edit to the user
|
|
578
540
|
// library, etc.) the cache misses and we re-resolve.
|
|
579
|
-
const builtinRoot = join(PACKAGE_ROOT, "public-repo", "
|
|
580
|
-
const localRoot =
|
|
581
|
-
const userRoot =
|
|
582
|
-
return this.
|
|
541
|
+
const builtinRoot = join(PACKAGE_ROOT, "public-repo", "build-plans");
|
|
542
|
+
const localRoot = preparationBuildPlansRoot(asPreparationDataDir(prepDataDir));
|
|
543
|
+
const userRoot = userBuildPlansRoot();
|
|
544
|
+
return this.buildPlanListingCache.get(prepDataDir, [builtinRoot, localRoot, userRoot], () => {
|
|
583
545
|
const preparations = listSourcePreparationConfigs(loadSourceFolderConfig(prepDataDir));
|
|
584
|
-
const choices =
|
|
585
|
-
return choices.map((
|
|
546
|
+
const choices = listBuildPlanChoices(prepDataDir);
|
|
547
|
+
return choices.map((buildPlan) => {
|
|
586
548
|
const activeForPreparations = preparations
|
|
587
|
-
.filter((preparation) =>
|
|
549
|
+
.filter((preparation) => buildPlanIdForSourcePreparationConfig(preparation) === buildPlan.id)
|
|
588
550
|
.map((preparation) => preparation.name);
|
|
589
|
-
return
|
|
590
|
-
id:
|
|
591
|
-
path:
|
|
592
|
-
label:
|
|
593
|
-
hint:
|
|
594
|
-
purpose:
|
|
595
|
-
inputs:
|
|
596
|
-
source_kind:
|
|
597
|
-
built_in:
|
|
551
|
+
return buildBuildPlanResource({
|
|
552
|
+
id: buildPlan.id,
|
|
553
|
+
path: resolveBuildPlanPackageSourcePath(prepDataDir, buildPlan.id) ?? buildPlan.id,
|
|
554
|
+
label: buildPlan.label,
|
|
555
|
+
hint: buildPlan.hint,
|
|
556
|
+
purpose: buildPlan.purpose,
|
|
557
|
+
inputs: buildPlan.inputs,
|
|
558
|
+
source_kind: buildPlan.scope === "builtin" ? "builtin" : "local",
|
|
559
|
+
built_in: buildPlan.scope === "builtin",
|
|
598
560
|
active_for_preparations: activeForPreparations,
|
|
599
|
-
artifacts:
|
|
600
|
-
stages:
|
|
561
|
+
artifacts: buildPlan.contextInterface?.artifacts ?? [],
|
|
562
|
+
stages: buildPlan.stages.map((stage) => ({
|
|
601
563
|
id: stage.id,
|
|
602
564
|
label: stage.label,
|
|
603
565
|
description: stage.description,
|
|
@@ -611,8 +573,8 @@ export class LocalServiceRuntime {
|
|
|
611
573
|
});
|
|
612
574
|
});
|
|
613
575
|
}
|
|
614
|
-
|
|
615
|
-
return this.
|
|
576
|
+
getBuildPlanResource(prepDataDir, buildPlanId) {
|
|
577
|
+
return this.listBuildPlans(prepDataDir).find((buildPlan) => buildPlan.id === buildPlanId) ?? null;
|
|
616
578
|
}
|
|
617
579
|
listJobs(prepDataDir) {
|
|
618
580
|
return byCreatedAtDesc(listJsonFiles(localJobsRoot(prepDataDir))
|
|
@@ -797,7 +759,7 @@ export class LocalServiceRuntime {
|
|
|
797
759
|
}
|
|
798
760
|
listRunObservability(prepDataDir) {
|
|
799
761
|
return [
|
|
800
|
-
...this.
|
|
762
|
+
...this.listBuildRuns(prepDataDir).map((resource) => buildRunToObservability({
|
|
801
763
|
...resource.run,
|
|
802
764
|
readiness: this.getReadiness(prepDataDir, resource.run.preparation),
|
|
803
765
|
})),
|
|
@@ -813,17 +775,17 @@ export class LocalServiceRuntime {
|
|
|
813
775
|
return this.listRunObservability(prepDataDir).find((run) => run.run_id === runId) ?? null;
|
|
814
776
|
}
|
|
815
777
|
/**
|
|
816
|
-
*
|
|
817
|
-
*
|
|
818
|
-
* `GET /v1/
|
|
819
|
-
* trail of authoring + improvement work
|
|
778
|
+
* Build Plan Activity runs: every Build Plan draft or improvement job whose
|
|
779
|
+
* Build Plan id matches `buildPlanId`. Surfaced through
|
|
780
|
+
* `GET /v1/build-plans/<id>/runs` so Build Plan detail can show the full
|
|
781
|
+
* audit trail of authoring + improvement work.
|
|
820
782
|
*/
|
|
821
|
-
|
|
783
|
+
listBuildPlanRuns(prepDataDir, buildPlanId) {
|
|
822
784
|
return this.listRunObservability(prepDataDir).filter((run) => {
|
|
823
|
-
if (run.
|
|
785
|
+
if (run.build_plan !== buildPlanId)
|
|
824
786
|
return false;
|
|
825
|
-
return (run.run_type === "
|
|
826
|
-
run.run_type === "
|
|
787
|
+
return (run.run_type === "build-plan-draft" ||
|
|
788
|
+
run.run_type === "build-plan-improvement");
|
|
827
789
|
});
|
|
828
790
|
}
|
|
829
791
|
createJobRun(prepDataDir, requestValue) {
|
|
@@ -838,7 +800,7 @@ export class LocalServiceRuntime {
|
|
|
838
800
|
status: "running",
|
|
839
801
|
title: request.title,
|
|
840
802
|
...(request.preparation !== undefined ? { preparation: request.preparation } : {}),
|
|
841
|
-
...(request.
|
|
803
|
+
...(request.build_plan !== undefined ? { build_plan: request.build_plan } : {}),
|
|
842
804
|
...(request.source_path !== undefined ? { source_path: request.source_path } : {}),
|
|
843
805
|
...(request.output_path !== undefined ? { output_path: request.output_path } : {}),
|
|
844
806
|
...(request.agent !== undefined ? { agent: request.agent } : {}),
|
|
@@ -941,115 +903,116 @@ export class LocalServiceRuntime {
|
|
|
941
903
|
void this.runReadinessCheckDraftInBackground(prepDataDir, request, job.run_id);
|
|
942
904
|
return this.getJob(prepDataDir, job.run_id) ?? job;
|
|
943
905
|
}
|
|
944
|
-
|
|
945
|
-
const request =
|
|
906
|
+
applyBuildPlanChange(prepDataDir, requestValue) {
|
|
907
|
+
const request = BuildPlanChangeCreateRequestSchema.parse(requestValue);
|
|
908
|
+
const buildPlanId = request.build_plan;
|
|
946
909
|
const outputPath = request.operation === "duplicate"
|
|
947
|
-
?
|
|
948
|
-
:
|
|
910
|
+
? buildPlanDefinitionPath(prepDataDir, request.new_build_plan_id)
|
|
911
|
+
: buildPlanDefinitionPath(prepDataDir, buildPlanId);
|
|
949
912
|
if (request.operation === "duplicate") {
|
|
950
|
-
if (
|
|
951
|
-
throw new Error(`
|
|
913
|
+
if (resolveBuildPlanPackageSourcePath(prepDataDir, request.new_build_plan_id)) {
|
|
914
|
+
throw new Error(`Build Plan "${request.new_build_plan_id}" already exists.`);
|
|
952
915
|
}
|
|
953
|
-
if (!
|
|
954
|
-
throw new Error(`
|
|
916
|
+
if (!resolveBuildPlanPackageSourcePath(prepDataDir, buildPlanId)) {
|
|
917
|
+
throw new Error(`Build Plan "${buildPlanId}" does not exist.`);
|
|
955
918
|
}
|
|
956
|
-
const label = request.label ??
|
|
957
|
-
const hint = request.hint ?? `Duplicate of ${
|
|
958
|
-
const
|
|
919
|
+
const label = request.label ?? buildPlanLabelFromId(request.new_build_plan_id);
|
|
920
|
+
const hint = request.hint ?? `Duplicate of ${buildPlanId}`;
|
|
921
|
+
const buildPlanPath = seedLocalBuildPlanPackageFromBase({
|
|
959
922
|
prepDataDir,
|
|
960
|
-
|
|
961
|
-
|
|
923
|
+
baseBuildPlanId: buildPlanId,
|
|
924
|
+
buildPlanId: request.new_build_plan_id,
|
|
962
925
|
label,
|
|
963
926
|
hint,
|
|
964
927
|
});
|
|
965
|
-
this.
|
|
966
|
-
return
|
|
967
|
-
kind: "interf-
|
|
928
|
+
this.buildPlanListingCache.invalidate(prepDataDir);
|
|
929
|
+
return BuildPlanChangeResultSchema.parse({
|
|
930
|
+
kind: "interf-build-plan-change-result",
|
|
968
931
|
version: 1,
|
|
969
932
|
operation: "duplicate",
|
|
970
|
-
|
|
971
|
-
|
|
933
|
+
build_plan: buildPlanId,
|
|
934
|
+
new_build_plan_id: request.new_build_plan_id,
|
|
972
935
|
updated_preparations: [],
|
|
973
|
-
|
|
936
|
+
build_plan_path: buildPlanPath,
|
|
974
937
|
changed: true,
|
|
975
|
-
message: `Duplicated
|
|
938
|
+
message: `Duplicated Build Plan ${buildPlanId} as ${request.new_build_plan_id}.`,
|
|
976
939
|
});
|
|
977
940
|
}
|
|
978
|
-
if (request.confirmation !==
|
|
979
|
-
throw new Error(`Type ${
|
|
941
|
+
if (request.confirmation !== buildPlanId) {
|
|
942
|
+
throw new Error(`Type ${buildPlanId} to confirm Build Plan removal.`);
|
|
980
943
|
}
|
|
981
|
-
const
|
|
982
|
-
if (
|
|
983
|
-
throw new Error(`
|
|
944
|
+
const localBuildPlanPath = buildPlanDefinitionPath(prepDataDir, buildPlanId);
|
|
945
|
+
if (buildPlanId === DEFAULT_BUILD_PLAN_ID || !existsSync(localBuildPlanPath)) {
|
|
946
|
+
throw new Error(`Build Plan "${buildPlanId}" is not a removable local Build Plan.`);
|
|
984
947
|
}
|
|
985
948
|
const preparations = listSourcePreparationConfigs(loadSourceFolderConfig(prepDataDir));
|
|
986
949
|
const updatedPreparations = preparations
|
|
987
|
-
.filter((preparation) =>
|
|
950
|
+
.filter((preparation) => buildPlanIdForSourcePreparationConfig(preparation) === buildPlanId);
|
|
988
951
|
if (updatedPreparations.length > 0) {
|
|
989
952
|
saveSourceFolderConfig(prepDataDir, {
|
|
990
|
-
preparations: preparations.map((preparation) =>
|
|
953
|
+
preparations: preparations.map((preparation) => detachBuildPlanFromPreparation(preparation, buildPlanId)),
|
|
991
954
|
});
|
|
992
|
-
// Detaching a
|
|
955
|
+
// Detaching a Build Plan changes readiness shape for those Preparations.
|
|
993
956
|
for (const preparation of updatedPreparations) {
|
|
994
957
|
this.readinessCache.invalidatePreparation(prepDataDir, preparation.name);
|
|
995
958
|
}
|
|
996
959
|
}
|
|
997
960
|
rmSync(outputPath, { recursive: true, force: true });
|
|
998
|
-
this.
|
|
999
|
-
return
|
|
1000
|
-
kind: "interf-
|
|
961
|
+
this.buildPlanListingCache.invalidate(prepDataDir);
|
|
962
|
+
return BuildPlanChangeResultSchema.parse({
|
|
963
|
+
kind: "interf-build-plan-change-result",
|
|
1001
964
|
version: 1,
|
|
1002
965
|
operation: "remove",
|
|
1003
|
-
|
|
966
|
+
build_plan: buildPlanId,
|
|
1004
967
|
updated_preparations: updatedPreparations.map((preparation) => preparation.name),
|
|
1005
|
-
|
|
968
|
+
build_plan_path: outputPath,
|
|
1006
969
|
changed: true,
|
|
1007
970
|
message: updatedPreparations.length > 0
|
|
1008
|
-
? `Removed
|
|
1009
|
-
: `Removed
|
|
971
|
+
? `Removed Build Plan ${buildPlanId} and cleared it from ${updatedPreparations.length} Preparation(s).`
|
|
972
|
+
: `Removed Build Plan ${buildPlanId}.`,
|
|
1010
973
|
});
|
|
1011
974
|
}
|
|
1012
975
|
applyPreparationSetup(prepDataDir, requestValue) {
|
|
1013
976
|
const request = PreparationSetupCreateRequestSchema.parse(requestValue);
|
|
1014
977
|
const preparationConfig = request.preparation;
|
|
1015
|
-
const
|
|
1016
|
-
if (request.setup_mode === "select-
|
|
978
|
+
const buildPlanId = buildPlanIdForSourcePreparationConfig(preparationConfig);
|
|
979
|
+
if (request.setup_mode === "select-build-plan" && !buildPlanId) {
|
|
1017
980
|
throw new Error("Build Plan is required when selecting a Build Plan for a Preparation.");
|
|
1018
981
|
}
|
|
1019
|
-
const normalizedPreparationConfig =
|
|
1020
|
-
? { ...preparationConfig,
|
|
982
|
+
const normalizedPreparationConfig = buildPlanId
|
|
983
|
+
? { ...preparationConfig, build_plan: buildPlanId }
|
|
1021
984
|
: (() => {
|
|
1022
|
-
const {
|
|
1023
|
-
return
|
|
985
|
+
const { build_plan: _ignoredBuildPlan, ...withoutBuildPlan } = preparationConfig;
|
|
986
|
+
return withoutBuildPlan;
|
|
1024
987
|
})();
|
|
1025
988
|
const sourceFolderPath = resolveSourcePreparationPath(prepDataDir, normalizedPreparationConfig);
|
|
1026
989
|
if (!existsSync(sourceFolderPath) || !statSync(sourceFolderPath).isDirectory()) {
|
|
1027
990
|
throw new Error(`Source folder "${preparationConfig.path}" is not available.`);
|
|
1028
991
|
}
|
|
1029
992
|
upsertSourcePreparationConfig(prepDataDir, normalizedPreparationConfig);
|
|
1030
|
-
// The Preparation's bound source folder +
|
|
1031
|
-
// bust the per-preparation readiness, runs, and
|
|
993
|
+
// The Preparation's bound source folder + Build Plan may have changed:
|
|
994
|
+
// bust the per-preparation readiness, runs, and Build Plan listing
|
|
1032
995
|
// caches so the next read reflects the new shape.
|
|
1033
996
|
this.readinessCache.invalidatePreparation(prepDataDir, normalizedPreparationConfig.name);
|
|
1034
|
-
this.
|
|
997
|
+
this.buildRunCache.invalidatePreparation(prepDataDir, normalizedPreparationConfig.name);
|
|
1035
998
|
this.verifyRunCache.invalidatePreparation(prepDataDir, normalizedPreparationConfig.name);
|
|
1036
|
-
this.
|
|
1037
|
-
const operation = request.setup_mode === "select-
|
|
999
|
+
this.buildPlanListingCache.invalidate(prepDataDir);
|
|
1000
|
+
const operation = request.setup_mode === "select-build-plan" ? "select-build-plan" : "create";
|
|
1038
1001
|
return PreparationSetupResultSchema.parse({
|
|
1039
1002
|
kind: "interf-preparation-setup-result",
|
|
1040
1003
|
version: 1,
|
|
1041
1004
|
operation,
|
|
1042
1005
|
preparation: normalizedPreparationConfig.name,
|
|
1043
|
-
|
|
1006
|
+
build_plan: buildPlanId ?? null,
|
|
1044
1007
|
source_folder_path: sourceFolderPath,
|
|
1045
1008
|
config_path: preparationConfigPath(asPreparationDataDir(prepDataDir)),
|
|
1046
|
-
|
|
1009
|
+
verifiable_context_path: preparationVerifiableContextPath(asPreparationDataDir(prepDataDir), normalizedPreparationConfig.name),
|
|
1047
1010
|
changed: true,
|
|
1048
|
-
message: operation === "select-
|
|
1049
|
-
? `Preparation ${normalizedPreparationConfig.name} now uses Build Plan ${
|
|
1050
|
-
:
|
|
1051
|
-
? `Preparation ${normalizedPreparationConfig.name} is saved with Build Plan ${
|
|
1052
|
-
: `Preparation ${normalizedPreparationConfig.name} is saved. Draft or select a Build Plan before
|
|
1011
|
+
message: operation === "select-build-plan"
|
|
1012
|
+
? `Preparation ${normalizedPreparationConfig.name} now uses Build Plan ${buildPlanId}.`
|
|
1013
|
+
: buildPlanId
|
|
1014
|
+
? `Preparation ${normalizedPreparationConfig.name} is saved with Build Plan ${buildPlanId}.`
|
|
1015
|
+
: `Preparation ${normalizedPreparationConfig.name} is saved. Draft or select a Build Plan before building.`,
|
|
1053
1016
|
});
|
|
1054
1017
|
}
|
|
1055
1018
|
applyPreparationChange(prepDataDir, requestValue) {
|
|
@@ -1063,19 +1026,19 @@ export class LocalServiceRuntime {
|
|
|
1063
1026
|
}
|
|
1064
1027
|
removeSourcePreparationConfig(prepDataDir, request.preparation);
|
|
1065
1028
|
this.readinessCache.invalidatePreparation(prepDataDir, request.preparation);
|
|
1066
|
-
this.
|
|
1029
|
+
this.buildRunCache.invalidatePreparation(prepDataDir, request.preparation);
|
|
1067
1030
|
this.verifyRunCache.invalidatePreparation(prepDataDir, request.preparation);
|
|
1068
|
-
this.
|
|
1031
|
+
this.buildPlanListingCache.invalidate(prepDataDir);
|
|
1069
1032
|
return PreparationChangeResultSchema.parse({
|
|
1070
1033
|
kind: "interf-preparation-change-result",
|
|
1071
1034
|
version: 1,
|
|
1072
1035
|
operation: "remove",
|
|
1073
1036
|
preparation: request.preparation,
|
|
1074
1037
|
config_path: preparationConfigPath(asPreparationDataDir(prepDataDir)),
|
|
1075
|
-
|
|
1076
|
-
|
|
1038
|
+
verifiable_context_path: preparationVerifiableContextPath(asPreparationDataDir(prepDataDir), request.preparation),
|
|
1039
|
+
verifiable_context_retained: true,
|
|
1077
1040
|
changed: true,
|
|
1078
|
-
message: `Removed Preparation ${request.preparation}.
|
|
1041
|
+
message: `Removed Preparation ${request.preparation}. Verifiable context files were retained.`,
|
|
1079
1042
|
});
|
|
1080
1043
|
}
|
|
1081
1044
|
applyReset(prepDataDir, requestValue) {
|
|
@@ -1084,13 +1047,13 @@ export class LocalServiceRuntime {
|
|
|
1084
1047
|
if (!preparation) {
|
|
1085
1048
|
throw new Error(`Preparation "${request.preparation}" is not saved.`);
|
|
1086
1049
|
}
|
|
1087
|
-
const
|
|
1088
|
-
if (!existsSync(
|
|
1089
|
-
throw new Error(`
|
|
1050
|
+
const verifiableContextPath = preparationVerifiableContextPath(asPreparationDataDir(prepDataDir), request.preparation);
|
|
1051
|
+
if (!existsSync(verifiableContextPath)) {
|
|
1052
|
+
throw new Error(`Verifiable context for Preparation "${request.preparation}" does not exist.`);
|
|
1090
1053
|
}
|
|
1091
|
-
|
|
1092
|
-
// Reset wipes generated state, including saved
|
|
1093
|
-
this.
|
|
1054
|
+
resetBuildGeneratedState(verifiableContextPath, request.scope);
|
|
1055
|
+
// Reset wipes generated state, including saved build/test/readiness records.
|
|
1056
|
+
this.buildRunCache.invalidatePreparation(prepDataDir, request.preparation);
|
|
1094
1057
|
this.verifyRunCache.invalidatePreparation(prepDataDir, request.preparation);
|
|
1095
1058
|
this.readinessCache.invalidatePreparation(prepDataDir, request.preparation);
|
|
1096
1059
|
return ResetResultSchema.parse({
|
|
@@ -1098,13 +1061,13 @@ export class LocalServiceRuntime {
|
|
|
1098
1061
|
version: 1,
|
|
1099
1062
|
preparation: request.preparation,
|
|
1100
1063
|
scope: request.scope,
|
|
1101
|
-
|
|
1064
|
+
verifiable_context_path: verifiableContextPath,
|
|
1102
1065
|
changed: true,
|
|
1103
1066
|
message: `Reset ${request.scope} state for Preparation ${request.preparation}.`,
|
|
1104
1067
|
});
|
|
1105
1068
|
}
|
|
1106
|
-
async
|
|
1107
|
-
const parsedRequest =
|
|
1069
|
+
async createBuildPlanAuthoringRun(prepDataDir, requestValue, jobType = "build-plan-draft") {
|
|
1070
|
+
const parsedRequest = BuildPlanAuthoringCreateRequestSchema.parse(requestValue);
|
|
1108
1071
|
const savedPreparation = parsedRequest.preparation
|
|
1109
1072
|
? findSourcePreparationConfig(loadSourceFolderConfig(prepDataDir), parsedRequest.preparation)
|
|
1110
1073
|
: null;
|
|
@@ -1115,14 +1078,14 @@ export class LocalServiceRuntime {
|
|
|
1115
1078
|
: savedPreparation?.requested_artifacts ?? [],
|
|
1116
1079
|
source_profile: parsedRequest.source_profile ?? savedPreparation?.source_profile ?? null,
|
|
1117
1080
|
};
|
|
1118
|
-
const isImprovement = jobType === "
|
|
1081
|
+
const isImprovement = jobType === "build-plan-improvement";
|
|
1119
1082
|
const job = this.createJobRun(prepDataDir, {
|
|
1120
1083
|
job_type: jobType,
|
|
1121
|
-
title: isImprovement ? `Improve
|
|
1084
|
+
title: isImprovement ? `Improve Build Plan ${request.build_plan_id}` : `Draft Build Plan ${request.build_plan_id}`,
|
|
1122
1085
|
preparation: request.preparation ?? null,
|
|
1123
|
-
|
|
1086
|
+
build_plan: request.build_plan_id,
|
|
1124
1087
|
source_path: request.source_folder_path,
|
|
1125
|
-
output_path:
|
|
1088
|
+
output_path: preparationBuildPlanPackagePath(asPreparationDataDir(prepDataDir), request.build_plan_id),
|
|
1126
1089
|
steps: [
|
|
1127
1090
|
{
|
|
1128
1091
|
id: "inspect-source",
|
|
@@ -1136,9 +1099,9 @@ export class LocalServiceRuntime {
|
|
|
1136
1099
|
},
|
|
1137
1100
|
{
|
|
1138
1101
|
id: "draft-package",
|
|
1139
|
-
label: isImprovement ? "Improve
|
|
1102
|
+
label: isImprovement ? "Improve Build Plan definition" : "Draft Build Plan definition",
|
|
1140
1103
|
input: {
|
|
1141
|
-
|
|
1104
|
+
build_plan_id: request.build_plan_id,
|
|
1142
1105
|
label: request.label,
|
|
1143
1106
|
task_prompt: request.task_prompt,
|
|
1144
1107
|
requested_artifacts: request.requested_artifacts.length,
|
|
@@ -1147,9 +1110,9 @@ export class LocalServiceRuntime {
|
|
|
1147
1110
|
},
|
|
1148
1111
|
{
|
|
1149
1112
|
id: "validate-package",
|
|
1150
|
-
label: "Validate
|
|
1113
|
+
label: "Validate Build Plan definition",
|
|
1151
1114
|
input: {
|
|
1152
|
-
|
|
1115
|
+
build_plan_id: request.build_plan_id,
|
|
1153
1116
|
},
|
|
1154
1117
|
},
|
|
1155
1118
|
],
|
|
@@ -1157,7 +1120,7 @@ export class LocalServiceRuntime {
|
|
|
1157
1120
|
this.appendJobRunEvent(prepDataDir, job.run_id, {
|
|
1158
1121
|
type: "step.started",
|
|
1159
1122
|
step_id: "inspect-source",
|
|
1160
|
-
message: isImprovement ? "Inspecting source files for
|
|
1123
|
+
message: isImprovement ? "Inspecting source files for Build Plan improvement." : "Inspecting source files for Build Plan drafting.",
|
|
1161
1124
|
input: {
|
|
1162
1125
|
preparation: request.preparation ?? null,
|
|
1163
1126
|
source_folder_path: request.source_folder_path,
|
|
@@ -1178,118 +1141,118 @@ export class LocalServiceRuntime {
|
|
|
1178
1141
|
this.appendJobRunEvent(prepDataDir, job.run_id, {
|
|
1179
1142
|
type: "step.started",
|
|
1180
1143
|
step_id: "draft-package",
|
|
1181
|
-
message: isImprovement ? "Improving
|
|
1144
|
+
message: isImprovement ? "Improving Build Plan definition." : "Drafting Build Plan definition.",
|
|
1182
1145
|
input: {
|
|
1183
|
-
|
|
1146
|
+
build_plan_id: request.build_plan_id,
|
|
1184
1147
|
label: request.label,
|
|
1185
1148
|
task_prompt: request.task_prompt,
|
|
1186
1149
|
requested_artifacts: request.requested_artifacts.length,
|
|
1187
1150
|
artifact_requirements: request.artifact_requirements.length,
|
|
1188
1151
|
},
|
|
1189
1152
|
});
|
|
1190
|
-
void this.
|
|
1153
|
+
void this.runBuildPlanAuthoringInBackground(prepDataDir, request, job.run_id);
|
|
1191
1154
|
return this.getJob(prepDataDir, job.run_id) ?? job;
|
|
1192
1155
|
}
|
|
1193
|
-
|
|
1156
|
+
listVerifiableContexts(prepDataDir) {
|
|
1194
1157
|
return listSourcePreparationConfigs(loadSourceFolderConfig(prepDataDir))
|
|
1195
|
-
.map((preparation) => this.
|
|
1158
|
+
.map((preparation) => this.getVerifiableContext(prepDataDir, preparation.name))
|
|
1196
1159
|
.filter((context) => context !== null);
|
|
1197
1160
|
}
|
|
1198
|
-
|
|
1161
|
+
getVerifiableContext(prepDataDir, preparationName) {
|
|
1199
1162
|
const preparation = findSourcePreparationConfig(loadSourceFolderConfig(prepDataDir), preparationName);
|
|
1200
1163
|
if (!preparation)
|
|
1201
1164
|
return null;
|
|
1202
|
-
const path =
|
|
1165
|
+
const path = preparationVerifiableContextPath(asPreparationDataDir(prepDataDir), preparation.name);
|
|
1203
1166
|
const config = readInterfConfig(path);
|
|
1204
|
-
const
|
|
1167
|
+
const buildRuns = this.listBuildRunsForPreparation(prepDataDir, preparation.name);
|
|
1205
1168
|
const verifyRuns = this.listVerifyRunsForPreparation(prepDataDir, preparation.name);
|
|
1206
1169
|
const readiness = this.computePreparationReadiness(prepDataDir, preparation);
|
|
1207
|
-
const
|
|
1208
|
-
return
|
|
1170
|
+
const buildPlan = config?.build_plan ?? buildPlanIdForSourcePreparationConfig(preparation);
|
|
1171
|
+
return VerifiableContextResourceSchema.parse({
|
|
1209
1172
|
preparation: preparation.name,
|
|
1210
1173
|
path,
|
|
1211
1174
|
exists: existsSync(path),
|
|
1212
1175
|
readiness,
|
|
1213
|
-
|
|
1214
|
-
|
|
1176
|
+
build_plan: buildPlan,
|
|
1177
|
+
latest_build_run_id: buildRuns[0]?.run_id ?? null,
|
|
1215
1178
|
latest_test_run_id: verifyRuns[0]?.run_id ?? null,
|
|
1216
|
-
artifacts: uniqueArtifacts(
|
|
1179
|
+
artifacts: uniqueArtifacts(buildRuns[0]?.stages.flatMap((stage) => stage.artifacts) ?? []),
|
|
1217
1180
|
});
|
|
1218
1181
|
}
|
|
1219
|
-
|
|
1182
|
+
listBuildRuns(prepDataDir) {
|
|
1220
1183
|
return byCreatedAtDesc(listSourcePreparationConfigs(loadSourceFolderConfig(prepDataDir))
|
|
1221
|
-
.flatMap((preparation) => this.
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
return this.
|
|
1225
|
-
const
|
|
1226
|
-
return byCreatedAtDesc(listJsonFiles(
|
|
1227
|
-
.map(
|
|
1228
|
-
.filter((run) => run !== null)).map((run) => this.
|
|
1184
|
+
.flatMap((preparation) => this.listBuildRunsForPreparation(prepDataDir, preparation.name))).map((run) => BuildRunResourceSchema.parse({ run }));
|
|
1185
|
+
}
|
|
1186
|
+
listBuildRunsForPreparation(prepDataDir, preparationName) {
|
|
1187
|
+
return this.buildRunCache.get(prepDataDir, preparationName, () => {
|
|
1188
|
+
const verifiableContextPath = preparationVerifiableContextPath(asPreparationDataDir(prepDataDir), preparationName);
|
|
1189
|
+
return byCreatedAtDesc(listJsonFiles(buildRunsRoot(verifiableContextPath))
|
|
1190
|
+
.map(readBuildRunAt)
|
|
1191
|
+
.filter((run) => run !== null)).map((run) => this.hydrateBuildRunFromRuntime(prepDataDir, verifiableContextPath, run));
|
|
1229
1192
|
}, (run) => run.run_id);
|
|
1230
1193
|
}
|
|
1231
|
-
|
|
1194
|
+
getBuildRun(prepDataDir, runId) {
|
|
1232
1195
|
// Fast path: if the runId was seen during a recent listing, look up
|
|
1233
1196
|
// its owning preparation directly and return that preparation's
|
|
1234
1197
|
// cached entry instead of scanning every preparation on disk.
|
|
1235
|
-
const known = this.
|
|
1198
|
+
const known = this.buildRunCache.preparationFor(prepDataDir, runId);
|
|
1236
1199
|
if (known) {
|
|
1237
|
-
const found = this.
|
|
1200
|
+
const found = this.listBuildRunsForPreparation(prepDataDir, known).find((entry) => entry.run_id === runId);
|
|
1238
1201
|
if (found)
|
|
1239
|
-
return
|
|
1202
|
+
return BuildRunResourceSchema.parse({ run: found });
|
|
1240
1203
|
}
|
|
1241
1204
|
// Slow path: scan all preparations. Falls through after a cache
|
|
1242
1205
|
// miss for an in-flight run created before this process restarted.
|
|
1243
|
-
for (const resource of this.
|
|
1206
|
+
for (const resource of this.listBuildRuns(prepDataDir)) {
|
|
1244
1207
|
if (resource.run.run_id === runId)
|
|
1245
1208
|
return resource;
|
|
1246
1209
|
}
|
|
1247
1210
|
return null;
|
|
1248
1211
|
}
|
|
1249
|
-
|
|
1250
|
-
return this.
|
|
1212
|
+
getBuildRunEvents(prepDataDir, runId) {
|
|
1213
|
+
return this.getBuildRun(prepDataDir, runId)?.run.events ?? null;
|
|
1251
1214
|
}
|
|
1252
|
-
|
|
1253
|
-
const run = this.
|
|
1215
|
+
getBuildRunProof(prepDataDir, runId) {
|
|
1216
|
+
const run = this.getBuildRun(prepDataDir, runId)?.run;
|
|
1254
1217
|
if (!run)
|
|
1255
1218
|
return null;
|
|
1256
1219
|
return run.stages
|
|
1257
1220
|
.map((stage) => stage.latest_proof ?? null)
|
|
1258
1221
|
.filter((proof) => proof !== null);
|
|
1259
1222
|
}
|
|
1260
|
-
|
|
1261
|
-
const run = this.
|
|
1223
|
+
getBuildRunArtifacts(prepDataDir, runId) {
|
|
1224
|
+
const run = this.getBuildRun(prepDataDir, runId)?.run;
|
|
1262
1225
|
if (!run)
|
|
1263
1226
|
return null;
|
|
1264
1227
|
return uniqueArtifacts(run.stages.flatMap((stage) => stage.artifacts));
|
|
1265
1228
|
}
|
|
1266
|
-
async
|
|
1267
|
-
const request =
|
|
1229
|
+
async createBuildRun(prepDataDir, requestValue) {
|
|
1230
|
+
const request = BuildRunCreateRequestSchema.parse(requestValue);
|
|
1268
1231
|
const preparationConfig = this.resolvePreparationConfig(prepDataDir, request.preparation, {
|
|
1269
|
-
|
|
1232
|
+
build_plan: request.build_plan,
|
|
1270
1233
|
max_attempts: request.max_attempts,
|
|
1271
1234
|
max_loops: request.max_loops,
|
|
1272
1235
|
});
|
|
1273
|
-
const
|
|
1274
|
-
const runId = createRunId("
|
|
1236
|
+
const verifiableContextPath = this.ensureVerifiableContextForRun(prepDataDir, preparationConfig);
|
|
1237
|
+
const runId = createRunId("build");
|
|
1275
1238
|
const now = new Date().toISOString();
|
|
1276
|
-
const
|
|
1239
|
+
const buildPlan = getBuildPlan(requireSelectedBuildPlan(preparationConfig), {
|
|
1277
1240
|
prepDataDir,
|
|
1278
1241
|
});
|
|
1279
|
-
const stageTotal =
|
|
1280
|
-
const run =
|
|
1281
|
-
kind: "interf-
|
|
1242
|
+
const stageTotal = buildPlan.stages.length;
|
|
1243
|
+
const run = BuildRunSchema.parse({
|
|
1244
|
+
kind: "interf-build-run",
|
|
1282
1245
|
version: 1,
|
|
1283
1246
|
run_id: runId,
|
|
1284
1247
|
status: "running",
|
|
1285
1248
|
preparation: preparationConfig.name,
|
|
1286
|
-
|
|
1249
|
+
build_plan: buildPlan.id,
|
|
1287
1250
|
backend: "native",
|
|
1288
1251
|
source_path: resolveSourcePreparationPath(prepDataDir, preparationConfig),
|
|
1289
|
-
|
|
1252
|
+
verifiable_context_path: verifiableContextPath,
|
|
1290
1253
|
created_at: now,
|
|
1291
1254
|
started_at: now,
|
|
1292
|
-
stages:
|
|
1255
|
+
stages: buildPlan.stages
|
|
1293
1256
|
.map((stage, index) => {
|
|
1294
1257
|
return {
|
|
1295
1258
|
run_id: runId,
|
|
@@ -1310,45 +1273,45 @@ export class LocalServiceRuntime {
|
|
|
1310
1273
|
}),
|
|
1311
1274
|
events: [],
|
|
1312
1275
|
});
|
|
1313
|
-
this.
|
|
1314
|
-
this.
|
|
1276
|
+
this.writeBuildRun(prepDataDir, verifiableContextPath, run);
|
|
1277
|
+
this.activeBuildRuns.set(runId, {
|
|
1315
1278
|
prepDataDir,
|
|
1316
|
-
|
|
1279
|
+
verifiableContextPath,
|
|
1317
1280
|
preparation: preparationConfig.name,
|
|
1318
1281
|
cancelled: false,
|
|
1319
1282
|
});
|
|
1320
|
-
await this.
|
|
1283
|
+
await this.recordBuildRunEvent(prepDataDir, verifiableContextPath, runId, {
|
|
1321
1284
|
type: "run.started",
|
|
1322
1285
|
event_id: createRunEventId("event"),
|
|
1323
1286
|
run_id: runId,
|
|
1324
1287
|
timestamp: now,
|
|
1325
1288
|
preparation: preparationConfig.name,
|
|
1326
|
-
|
|
1327
|
-
|
|
1289
|
+
build_plan: buildPlan.id,
|
|
1290
|
+
verifiable_context_path: verifiableContextPath,
|
|
1328
1291
|
backend: "native",
|
|
1329
1292
|
});
|
|
1330
1293
|
const sink = {
|
|
1331
|
-
emit: (event) => this.
|
|
1294
|
+
emit: (event) => this.recordBuildRunEvent(prepDataDir, verifiableContextPath, runId, event),
|
|
1332
1295
|
};
|
|
1333
|
-
void this.
|
|
1296
|
+
void this.runBuildInBackground(prepDataDir, request, {
|
|
1334
1297
|
runId,
|
|
1335
1298
|
sourcePath: prepDataDir,
|
|
1336
|
-
|
|
1299
|
+
verifiableContextPath,
|
|
1337
1300
|
preparationConfig,
|
|
1338
1301
|
events: sink,
|
|
1339
1302
|
});
|
|
1340
|
-
const saved = this.
|
|
1341
|
-
return
|
|
1303
|
+
const saved = this.readBuildRun(verifiableContextPath, runId) ?? run;
|
|
1304
|
+
return BuildRunResourceSchema.parse({ run: saved });
|
|
1342
1305
|
}
|
|
1343
1306
|
/**
|
|
1344
|
-
* Cancel an in-flight
|
|
1307
|
+
* Cancel an in-flight Build run. Marks the persisted record as
|
|
1345
1308
|
* `cancelled`, emits a `run.cancelled` event to capture the cancellation in
|
|
1346
1309
|
* the run timeline, and clears the active handle so retries may start a
|
|
1347
1310
|
* fresh run. If the run already finished, returns
|
|
1348
1311
|
* `{ cancelled: false, reason: "already finished" }` and persists nothing.
|
|
1349
1312
|
*/
|
|
1350
|
-
|
|
1351
|
-
const handle = this.
|
|
1313
|
+
cancelBuildRun(runId) {
|
|
1314
|
+
const handle = this.activeBuildRuns.get(runId);
|
|
1352
1315
|
if (!handle) {
|
|
1353
1316
|
// Either unknown or already terminal. The server route already 404s
|
|
1354
1317
|
// unknown ids before calling this, so anything reaching here is a run
|
|
@@ -1361,14 +1324,14 @@ export class LocalServiceRuntime {
|
|
|
1361
1324
|
const cancelledAt = new Date().toISOString();
|
|
1362
1325
|
handle.cancelled = true;
|
|
1363
1326
|
handle.cancelledAt = cancelledAt;
|
|
1364
|
-
const current = this.
|
|
1365
|
-
if (current && !
|
|
1366
|
-
this.
|
|
1327
|
+
const current = this.readBuildRun(handle.verifiableContextPath, runId);
|
|
1328
|
+
if (current && !isTerminalBuildRunStatus(current.status)) {
|
|
1329
|
+
this.writeBuildRun(handle.prepDataDir, handle.verifiableContextPath, applyEventToBuildRun(current, {
|
|
1367
1330
|
type: "run.cancelled",
|
|
1368
1331
|
event_id: createRunEventId("event"),
|
|
1369
1332
|
run_id: runId,
|
|
1370
1333
|
timestamp: cancelledAt,
|
|
1371
|
-
reason: "
|
|
1334
|
+
reason: "Build run cancelled by request.",
|
|
1372
1335
|
}));
|
|
1373
1336
|
}
|
|
1374
1337
|
return { cancelled: true };
|
|
@@ -1379,7 +1342,7 @@ export class LocalServiceRuntime {
|
|
|
1379
1342
|
* elapsed. The preparation argument is required so that the same key in
|
|
1380
1343
|
* two different preparations always returns two different runs.
|
|
1381
1344
|
*/
|
|
1382
|
-
|
|
1345
|
+
findIdempotentBuildRun(prepDataDir, key) {
|
|
1383
1346
|
const resolvedRoot = resolve(prepDataDir);
|
|
1384
1347
|
const bucket = this.idempotencyKeyCache.get(resolvedRoot);
|
|
1385
1348
|
if (!bucket)
|
|
@@ -1390,7 +1353,7 @@ export class LocalServiceRuntime {
|
|
|
1390
1353
|
if (entry.expiresAt <= Date.now()) {
|
|
1391
1354
|
// Opportunistic single-key prune. The bulk prune runs on writes
|
|
1392
1355
|
// when the cache crosses the size threshold (see
|
|
1393
|
-
// {@link
|
|
1356
|
+
// {@link recordIdempotentBuildRun}).
|
|
1394
1357
|
bucket.delete(key);
|
|
1395
1358
|
if (bucket.size === 0)
|
|
1396
1359
|
this.idempotencyKeyCache.delete(resolvedRoot);
|
|
@@ -1405,7 +1368,7 @@ export class LocalServiceRuntime {
|
|
|
1405
1368
|
* every read AND write, which was O(N) per request. Now we only sweep
|
|
1406
1369
|
* when the cache grows past {@link IDEMPOTENCY_PRUNE_THRESHOLD}.
|
|
1407
1370
|
*/
|
|
1408
|
-
|
|
1371
|
+
recordIdempotentBuildRun(prepDataDir, key, runId) {
|
|
1409
1372
|
const resolvedRoot = resolve(prepDataDir);
|
|
1410
1373
|
let bucket = this.idempotencyKeyCache.get(resolvedRoot);
|
|
1411
1374
|
if (!bucket) {
|
|
@@ -1461,8 +1424,8 @@ export class LocalServiceRuntime {
|
|
|
1461
1424
|
}
|
|
1462
1425
|
listVerifyRunsForPreparation(prepDataDir, preparationName) {
|
|
1463
1426
|
return this.verifyRunCache.get(prepDataDir, preparationName, () => {
|
|
1464
|
-
const
|
|
1465
|
-
return newestFirst(listJsonFiles(verifyRunsRoot(
|
|
1427
|
+
const verifiableContextPath = preparationVerifiableContextPath(asPreparationDataDir(prepDataDir), preparationName);
|
|
1428
|
+
return newestFirst(listJsonFiles(verifyRunsRoot(verifiableContextPath))
|
|
1466
1429
|
.map(readVerifyRunAt)
|
|
1467
1430
|
.filter((run) => run !== null));
|
|
1468
1431
|
}, (run) => run.run_id);
|
|
@@ -1479,8 +1442,8 @@ export class LocalServiceRuntime {
|
|
|
1479
1442
|
async createVerifyRun(prepDataDir, requestValue) {
|
|
1480
1443
|
const request = VerifyRunCreateRequestSchema.parse(requestValue);
|
|
1481
1444
|
const preparationConfig = this.resolvePreparationConfig(prepDataDir, request.preparation);
|
|
1482
|
-
const
|
|
1483
|
-
const
|
|
1445
|
+
const verifiableContextPath = preparationVerifiableContextPath(asPreparationDataDir(prepDataDir), preparationConfig.name);
|
|
1446
|
+
const verifiableContextTarget = createVerifiableContextTestTarget(verifiableContextPath, preparationConfig.name, buildPlanIdForSourcePreparationConfig(preparationConfig) ?? DEFAULT_BUILD_PLAN_ID);
|
|
1484
1447
|
const runId = createRunId("verify");
|
|
1485
1448
|
const now = new Date().toISOString();
|
|
1486
1449
|
const initial = VerifyRunResourceSchema.parse({
|
|
@@ -1488,74 +1451,74 @@ export class LocalServiceRuntime {
|
|
|
1488
1451
|
status: "running",
|
|
1489
1452
|
preparation: preparationConfig.name,
|
|
1490
1453
|
source_path: prepDataDir,
|
|
1491
|
-
|
|
1454
|
+
verifiable_context_path: verifiableContextTarget.eligible ? verifiableContextPath : null,
|
|
1492
1455
|
started_at: now,
|
|
1493
1456
|
readiness_run: null,
|
|
1494
1457
|
events: [],
|
|
1495
1458
|
});
|
|
1496
|
-
this.writeVerifyRun(prepDataDir,
|
|
1459
|
+
this.writeVerifyRun(prepDataDir, verifiableContextPath, initial);
|
|
1497
1460
|
void this.runTestInBackground(prepDataDir, request, {
|
|
1498
1461
|
runId,
|
|
1499
1462
|
sourcePath: prepDataDir,
|
|
1500
|
-
|
|
1463
|
+
verifiableContextPath,
|
|
1501
1464
|
preparationConfig,
|
|
1502
1465
|
}, initial);
|
|
1503
1466
|
return initial;
|
|
1504
1467
|
}
|
|
1505
|
-
async
|
|
1468
|
+
async runBuildInBackground(prepDataDir, request, context) {
|
|
1506
1469
|
this.beginActiveRun();
|
|
1507
1470
|
try {
|
|
1508
|
-
if (!this.handlers.
|
|
1509
|
-
throw new Error("No
|
|
1471
|
+
if (!this.handlers.createBuildRun) {
|
|
1472
|
+
throw new Error("No build-run handler is configured for this local service.");
|
|
1510
1473
|
}
|
|
1511
|
-
const result = LocalRunHandlerResultSchema.parse(await this.handlers.
|
|
1512
|
-
const wasCancelled = this.
|
|
1474
|
+
const result = LocalRunHandlerResultSchema.parse(await this.handlers.createBuildRun(request, context));
|
|
1475
|
+
const wasCancelled = this.activeBuildRuns.get(context.runId)?.cancelled === true;
|
|
1513
1476
|
if (wasCancelled) {
|
|
1514
1477
|
// The run was cancelled while the handler was still running. The
|
|
1515
1478
|
// cancellation path already wrote a `cancelled` record; just refresh
|
|
1516
1479
|
// observability and skip emitting a second terminal event.
|
|
1517
|
-
this.
|
|
1518
|
-
await this.emitRuntimeDerivedEvents(prepDataDir, context.
|
|
1519
|
-
await this.
|
|
1480
|
+
this.refreshBuildRunFromRuntime(prepDataDir, context.verifiableContextPath, context.runId);
|
|
1481
|
+
await this.emitRuntimeDerivedEvents(prepDataDir, context.verifiableContextPath, context.runId);
|
|
1482
|
+
await this.recordBuildRunEvent(prepDataDir, context.verifiableContextPath, context.runId, this.readinessUpdatedEvent(context.runId, context.preparationConfig.name, this.computePreparationReadiness(prepDataDir, context.preparationConfig)));
|
|
1520
1483
|
return;
|
|
1521
1484
|
}
|
|
1522
|
-
this.
|
|
1523
|
-
await this.emitRuntimeDerivedEvents(prepDataDir, context.
|
|
1485
|
+
this.refreshBuildRunFromRuntime(prepDataDir, context.verifiableContextPath, context.runId);
|
|
1486
|
+
await this.emitRuntimeDerivedEvents(prepDataDir, context.verifiableContextPath, context.runId);
|
|
1524
1487
|
if (!result.ok) {
|
|
1525
|
-
await this.
|
|
1488
|
+
await this.recordBuildRunEvent(prepDataDir, context.verifiableContextPath, context.runId, {
|
|
1526
1489
|
type: "run.failed",
|
|
1527
1490
|
event_id: createRunEventId("event"),
|
|
1528
1491
|
run_id: context.runId,
|
|
1529
1492
|
timestamp: createRunEventTimestamp(),
|
|
1530
|
-
error: result.error ?? "
|
|
1493
|
+
error: result.error ?? "Build run failed.",
|
|
1531
1494
|
});
|
|
1532
1495
|
}
|
|
1533
1496
|
else {
|
|
1534
|
-
await this.
|
|
1497
|
+
await this.recordBuildRunEvent(prepDataDir, context.verifiableContextPath, context.runId, {
|
|
1535
1498
|
type: "run.completed",
|
|
1536
1499
|
event_id: createRunEventId("event"),
|
|
1537
1500
|
run_id: context.runId,
|
|
1538
1501
|
timestamp: createRunEventTimestamp(),
|
|
1539
|
-
summary: "
|
|
1502
|
+
summary: "Verifiable context ready.",
|
|
1540
1503
|
});
|
|
1541
1504
|
}
|
|
1542
|
-
await this.
|
|
1505
|
+
await this.recordBuildRunEvent(prepDataDir, context.verifiableContextPath, context.runId, this.readinessUpdatedEvent(context.runId, context.preparationConfig.name, this.computePreparationReadiness(prepDataDir, context.preparationConfig)));
|
|
1543
1506
|
// 0.17 — emit per-Artifact billing events (stub form: JSONL).
|
|
1544
1507
|
// Production sink (Metronome HTTP) wires in 0.18+.
|
|
1545
1508
|
this.emitBillingEventsForRun(prepDataDir, context);
|
|
1546
1509
|
}
|
|
1547
1510
|
catch (error) {
|
|
1548
|
-
await this.
|
|
1511
|
+
await this.recordBuildRunEvent(prepDataDir, context.verifiableContextPath, context.runId, {
|
|
1549
1512
|
type: "run.failed",
|
|
1550
1513
|
event_id: createRunEventId("event"),
|
|
1551
1514
|
run_id: context.runId,
|
|
1552
1515
|
timestamp: createRunEventTimestamp(),
|
|
1553
1516
|
error: error instanceof Error ? error.message : String(error),
|
|
1554
1517
|
});
|
|
1555
|
-
await this.
|
|
1518
|
+
await this.recordBuildRunEvent(prepDataDir, context.verifiableContextPath, context.runId, this.readinessUpdatedEvent(context.runId, context.preparationConfig.name, this.computePreparationReadiness(prepDataDir, context.preparationConfig)));
|
|
1556
1519
|
}
|
|
1557
1520
|
finally {
|
|
1558
|
-
this.
|
|
1521
|
+
this.activeBuildRuns.delete(context.runId);
|
|
1559
1522
|
this.endActiveRun();
|
|
1560
1523
|
}
|
|
1561
1524
|
}
|
|
@@ -1578,7 +1541,7 @@ export class LocalServiceRuntime {
|
|
|
1578
1541
|
events: resultEvent ? [resultEvent] : [],
|
|
1579
1542
|
...(!result.ok ? { error: result.error ?? "Readiness check failed." } : {}),
|
|
1580
1543
|
});
|
|
1581
|
-
this.writeVerifyRun(prepDataDir, context.
|
|
1544
|
+
this.writeVerifyRun(prepDataDir, context.verifiableContextPath, nextWithoutReadiness);
|
|
1582
1545
|
const readiness = this.computePreparationReadiness(prepDataDir, context.preparationConfig);
|
|
1583
1546
|
const next = VerifyRunResourceSchema.parse({
|
|
1584
1547
|
...nextWithoutReadiness,
|
|
@@ -1588,7 +1551,7 @@ export class LocalServiceRuntime {
|
|
|
1588
1551
|
this.readinessUpdatedEvent(context.runId, context.preparationConfig.name, readiness),
|
|
1589
1552
|
],
|
|
1590
1553
|
});
|
|
1591
|
-
this.writeVerifyRun(prepDataDir, context.
|
|
1554
|
+
this.writeVerifyRun(prepDataDir, context.verifiableContextPath, next);
|
|
1592
1555
|
}
|
|
1593
1556
|
catch (error) {
|
|
1594
1557
|
const failedWithoutReadiness = VerifyRunResourceSchema.parse({
|
|
@@ -1597,14 +1560,14 @@ export class LocalServiceRuntime {
|
|
|
1597
1560
|
finished_at: new Date().toISOString(),
|
|
1598
1561
|
error: error instanceof Error ? error.message : String(error),
|
|
1599
1562
|
});
|
|
1600
|
-
this.writeVerifyRun(prepDataDir, context.
|
|
1563
|
+
this.writeVerifyRun(prepDataDir, context.verifiableContextPath, failedWithoutReadiness);
|
|
1601
1564
|
const readiness = this.computePreparationReadiness(prepDataDir, context.preparationConfig);
|
|
1602
1565
|
const next = VerifyRunResourceSchema.parse({
|
|
1603
1566
|
...failedWithoutReadiness,
|
|
1604
1567
|
readiness,
|
|
1605
1568
|
events: [this.readinessUpdatedEvent(context.runId, context.preparationConfig.name, readiness)],
|
|
1606
1569
|
});
|
|
1607
|
-
this.writeVerifyRun(prepDataDir, context.
|
|
1570
|
+
this.writeVerifyRun(prepDataDir, context.verifiableContextPath, next);
|
|
1608
1571
|
}
|
|
1609
1572
|
finally {
|
|
1610
1573
|
this.endActiveRun();
|
|
@@ -1668,18 +1631,18 @@ export class LocalServiceRuntime {
|
|
|
1668
1631
|
});
|
|
1669
1632
|
}
|
|
1670
1633
|
}
|
|
1671
|
-
async
|
|
1634
|
+
async runBuildPlanAuthoringInBackground(prepDataDir, request, runId) {
|
|
1672
1635
|
this.beginActiveRun();
|
|
1673
|
-
return this.
|
|
1636
|
+
return this.runBuildPlanAuthoringInBackgroundInner(prepDataDir, request, runId).finally(() => {
|
|
1674
1637
|
this.endActiveRun();
|
|
1675
1638
|
});
|
|
1676
1639
|
}
|
|
1677
|
-
async
|
|
1640
|
+
async runBuildPlanAuthoringInBackgroundInner(prepDataDir, request, runId) {
|
|
1678
1641
|
try {
|
|
1679
|
-
if (!this.handlers.
|
|
1680
|
-
throw new Error("No
|
|
1642
|
+
if (!this.handlers.createBuildPlanAuthoringRun) {
|
|
1643
|
+
throw new Error("No Build Plan-authoring handler is configured for this local service.");
|
|
1681
1644
|
}
|
|
1682
|
-
const result =
|
|
1645
|
+
const result = BuildPlanAuthoringResultSchema.parse(await this.handlers.createBuildPlanAuthoringRun(request, this.jobRunContext(prepDataDir, runId)));
|
|
1683
1646
|
this.setJobRunResult(prepDataDir, runId, result);
|
|
1684
1647
|
this.appendJobRunEvent(prepDataDir, runId, {
|
|
1685
1648
|
type: result.status === "executor-failed" ? "step.failed" : "step.completed",
|
|
@@ -1688,36 +1651,36 @@ export class LocalServiceRuntime {
|
|
|
1688
1651
|
output: {
|
|
1689
1652
|
status: result.status,
|
|
1690
1653
|
changed: result.changed,
|
|
1691
|
-
|
|
1654
|
+
build_plan_path: result.build_plan_path,
|
|
1692
1655
|
shell_path: result.shell_path,
|
|
1693
1656
|
},
|
|
1694
1657
|
});
|
|
1695
1658
|
this.appendJobRunEvent(prepDataDir, runId, {
|
|
1696
1659
|
type: "step.started",
|
|
1697
1660
|
step_id: "validate-package",
|
|
1698
|
-
message: "Validating
|
|
1661
|
+
message: "Validating Build Plan package structure and stage contract.",
|
|
1699
1662
|
input: {
|
|
1700
|
-
|
|
1663
|
+
build_plan_path: result.build_plan_path,
|
|
1701
1664
|
},
|
|
1702
1665
|
});
|
|
1703
1666
|
if (result.status === "updated" || result.status === "no-change") {
|
|
1704
1667
|
let selectedPreparation = null;
|
|
1705
1668
|
if (request.preparation) {
|
|
1706
1669
|
const selected = this.resolvePreparationConfig(prepDataDir, request.preparation, {
|
|
1707
|
-
|
|
1670
|
+
build_plan: request.build_plan_id,
|
|
1708
1671
|
});
|
|
1709
1672
|
upsertSourcePreparationConfig(prepDataDir, selected);
|
|
1710
1673
|
this.readinessCache.invalidatePreparation(prepDataDir, selected.name);
|
|
1711
|
-
this.
|
|
1674
|
+
this.buildRunCache.invalidatePreparation(prepDataDir, selected.name);
|
|
1712
1675
|
this.verifyRunCache.invalidatePreparation(prepDataDir, selected.name);
|
|
1713
|
-
this.
|
|
1676
|
+
this.buildPlanListingCache.invalidate(prepDataDir);
|
|
1714
1677
|
selectedPreparation = selected.name;
|
|
1715
1678
|
}
|
|
1716
1679
|
this.appendJobRunEvent(prepDataDir, runId, {
|
|
1717
1680
|
type: "step.completed",
|
|
1718
1681
|
step_id: "validate-package",
|
|
1719
1682
|
message: selectedPreparation
|
|
1720
|
-
? `${result.summary} Selected Build Plan ${request.
|
|
1683
|
+
? `${result.summary} Selected Build Plan ${request.build_plan_id} for Preparation ${selectedPreparation}.`
|
|
1721
1684
|
: result.summary,
|
|
1722
1685
|
output: {
|
|
1723
1686
|
status: result.status,
|
|
@@ -1728,7 +1691,7 @@ export class LocalServiceRuntime {
|
|
|
1728
1691
|
this.appendJobRunEvent(prepDataDir, runId, {
|
|
1729
1692
|
type: "job.completed",
|
|
1730
1693
|
message: selectedPreparation
|
|
1731
|
-
? `${result.summary} Selected Build Plan ${request.
|
|
1694
|
+
? `${result.summary} Selected Build Plan ${request.build_plan_id} for Preparation ${selectedPreparation}.`
|
|
1732
1695
|
: result.summary,
|
|
1733
1696
|
});
|
|
1734
1697
|
}
|
|
@@ -1796,13 +1759,13 @@ export class LocalServiceRuntime {
|
|
|
1796
1759
|
preparations,
|
|
1797
1760
|
preparationHealth: preparations.map((preparation) => {
|
|
1798
1761
|
const readinessChecks = preparation.checks?.length ?? 0;
|
|
1799
|
-
const
|
|
1762
|
+
const verifiableContextReady = hasVerifiableContextTestTarget(prepDataDir, preparation);
|
|
1800
1763
|
return {
|
|
1801
1764
|
name: preparation.name,
|
|
1802
1765
|
readiness_checks: readinessChecks,
|
|
1803
|
-
|
|
1804
|
-
can_check_readiness: readinessChecks > 0 &&
|
|
1805
|
-
recommended_next_actions:
|
|
1766
|
+
verifiable_context_ready: verifiableContextReady,
|
|
1767
|
+
can_check_readiness: readinessChecks > 0 && verifiableContextReady,
|
|
1768
|
+
recommended_next_actions: verifiableContextReady
|
|
1806
1769
|
? readinessChecks > 0
|
|
1807
1770
|
? ["check readiness", "improve", "prepare again"]
|
|
1808
1771
|
: ["draft readiness checks", "prepare again"]
|
|
@@ -1836,8 +1799,8 @@ export class LocalServiceRuntime {
|
|
|
1836
1799
|
}
|
|
1837
1800
|
const label = options.actionType === "preparation-setup"
|
|
1838
1801
|
? "Preparation setup"
|
|
1839
|
-
: options.actionType === "
|
|
1840
|
-
? "
|
|
1802
|
+
: options.actionType === "build-plan-change"
|
|
1803
|
+
? "Build Plan change"
|
|
1841
1804
|
: "Preparation change";
|
|
1842
1805
|
const now = new Date().toISOString();
|
|
1843
1806
|
return ActionProposalResourceSchema.parse({
|
|
@@ -1851,7 +1814,7 @@ export class LocalServiceRuntime {
|
|
|
1851
1814
|
assistant_message: `${label} must be submitted directly to ${endpoint}. Action proposals are only for freeform planning or async local-agent-backed work.`,
|
|
1852
1815
|
message: options.message,
|
|
1853
1816
|
preparation: options.preparation ?? null,
|
|
1854
|
-
|
|
1817
|
+
build_plan: options.buildPlan ?? null,
|
|
1855
1818
|
request: {
|
|
1856
1819
|
message: options.message,
|
|
1857
1820
|
endpoint,
|
|
@@ -1869,7 +1832,7 @@ export class LocalServiceRuntime {
|
|
|
1869
1832
|
}
|
|
1870
1833
|
async buildActionProposal(prepDataDir, request) {
|
|
1871
1834
|
const structuredPreparationSetup = PreparationSetupActionValuesSchema.safeParse(request.values);
|
|
1872
|
-
const
|
|
1835
|
+
const structuredBuildPlanAuthoring = BuildPlanAuthoringActionValuesSchema.safeParse(request.values);
|
|
1873
1836
|
const structuredActionType = actionTypeFromValues(request.values);
|
|
1874
1837
|
const structuredDirectActionType = structuredPreparationSetup.success
|
|
1875
1838
|
? "preparation-setup"
|
|
@@ -1880,12 +1843,14 @@ export class LocalServiceRuntime {
|
|
|
1880
1843
|
return this.directServiceActionClarification({
|
|
1881
1844
|
actionType: structuredDirectActionType,
|
|
1882
1845
|
message: request.message,
|
|
1883
|
-
|
|
1846
|
+
buildPlan: stringValue(request.values, "build_plan") ??
|
|
1847
|
+
stringValue(request.values, "build_plan_id") ??
|
|
1848
|
+
stringValue(request.values, "new_build_plan_id"),
|
|
1884
1849
|
preparation: request.preparation ?? stringValue(request.values, "preparation") ?? stringValue(request.values, "name"),
|
|
1885
1850
|
values: request.values,
|
|
1886
1851
|
});
|
|
1887
1852
|
}
|
|
1888
|
-
const structuredPlanActionType =
|
|
1853
|
+
const structuredPlanActionType = structuredBuildPlanAuthoring.success ? "build-plan-draft" : structuredActionType;
|
|
1889
1854
|
// Typed UI/CLI actions already carry the service contract; only freeform chat needs planner inference.
|
|
1890
1855
|
const plan = structuredPlanActionType
|
|
1891
1856
|
? ActionProposalPlanSchema.parse({
|
|
@@ -1898,7 +1863,11 @@ export class LocalServiceRuntime {
|
|
|
1898
1863
|
return this.directServiceActionClarification({
|
|
1899
1864
|
actionType,
|
|
1900
1865
|
message: request.message,
|
|
1901
|
-
|
|
1866
|
+
buildPlan: plan.build_plan ??
|
|
1867
|
+
stringValue(plan.values, "build_plan") ??
|
|
1868
|
+
stringValue(plan.values, "build_plan_id") ??
|
|
1869
|
+
stringValue(request.values, "build_plan") ??
|
|
1870
|
+
stringValue(request.values, "build_plan_id"),
|
|
1902
1871
|
preparation: plan.preparation ?? request.preparation ?? stringValue(plan.values, "preparation") ?? stringValue(request.values, "preparation"),
|
|
1903
1872
|
values: {
|
|
1904
1873
|
...(plan.values ?? {}),
|
|
@@ -1921,7 +1890,7 @@ export class LocalServiceRuntime {
|
|
|
1921
1890
|
...(plan.command_preview ? { command_preview: plan.command_preview } : {}),
|
|
1922
1891
|
message: request.message,
|
|
1923
1892
|
preparation: plan.preparation ?? request.preparation ?? null,
|
|
1924
|
-
|
|
1893
|
+
build_plan: plan.build_plan ?? null,
|
|
1925
1894
|
request: {
|
|
1926
1895
|
message: request.message,
|
|
1927
1896
|
...(plan.values ? { values: plan.values } : {}),
|
|
@@ -1939,7 +1908,7 @@ export class LocalServiceRuntime {
|
|
|
1939
1908
|
...(plan.values ?? {}),
|
|
1940
1909
|
...(request.values ?? {}),
|
|
1941
1910
|
};
|
|
1942
|
-
if (actionType === "
|
|
1911
|
+
if (actionType === "build-plan-draft" || actionType === "build-plan-improvement") {
|
|
1943
1912
|
const requestedPreparationName = plan.preparation ?? request.preparation ?? null;
|
|
1944
1913
|
const fallbackPreparation = requestedPreparationName
|
|
1945
1914
|
? null
|
|
@@ -1950,23 +1919,27 @@ export class LocalServiceRuntime {
|
|
|
1950
1919
|
const preparationPath = preparationConfig
|
|
1951
1920
|
? resolveSourcePreparationPath(prepDataDir, preparationConfig)
|
|
1952
1921
|
: resolveConfiguredSourceFolderPath(prepDataDir) ?? prepDataDir;
|
|
1953
|
-
const
|
|
1954
|
-
stringValue(request.values, "
|
|
1955
|
-
const
|
|
1956
|
-
stringValue(plan.values, "
|
|
1957
|
-
stringValue(plan.values, "
|
|
1958
|
-
const
|
|
1959
|
-
const taskPrompt =
|
|
1922
|
+
const requestedBuildPlanId = stringValue(request.values, "build_plan_id") ??
|
|
1923
|
+
stringValue(request.values, "build_plan");
|
|
1924
|
+
const plannedBuildPlanId = plan.build_plan ??
|
|
1925
|
+
stringValue(plan.values, "build_plan_id") ??
|
|
1926
|
+
stringValue(plan.values, "build_plan");
|
|
1927
|
+
const buildPlanId = requestedBuildPlanId ?? plannedBuildPlanId ?? buildPlanIdForProposal(request.message, proposalValues);
|
|
1928
|
+
const taskPrompt = actionValueBuildPlanTaskPrompt(proposalValues) ??
|
|
1960
1929
|
stringValue(proposalValues, "task_prompt") ??
|
|
1961
|
-
|
|
1962
|
-
const hint = stringValue(proposalValues, "hint") ??
|
|
1930
|
+
buildPlanAuthoringPromptFallback(request.message, buildPlanId);
|
|
1931
|
+
const hint = stringValue(proposalValues, "hint") ?? buildPlanAuthoringHintFromPrompt(taskPrompt);
|
|
1963
1932
|
const actionRequest = {
|
|
1964
1933
|
preparation: preparationConfig?.name ?? null,
|
|
1965
1934
|
source_folder_path: preparationPath,
|
|
1966
|
-
|
|
1967
|
-
...(stringValue(proposalValues, "
|
|
1968
|
-
|
|
1969
|
-
|
|
1935
|
+
build_plan_id: buildPlanId,
|
|
1936
|
+
...(stringValue(proposalValues, "base_build_plan_id") ?? stringValue(proposalValues, "base_build_plan_id")
|
|
1937
|
+
? { base_build_plan_id: stringValue(proposalValues, "base_build_plan_id") ?? stringValue(proposalValues, "base_build_plan_id") }
|
|
1938
|
+
: {}),
|
|
1939
|
+
...(stringValue(proposalValues, "reference_build_plan_id") ?? stringValue(proposalValues, "reference_build_plan_id")
|
|
1940
|
+
? { reference_build_plan_id: stringValue(proposalValues, "reference_build_plan_id") ?? stringValue(proposalValues, "reference_build_plan_id") }
|
|
1941
|
+
: {}),
|
|
1942
|
+
label: stringValue(proposalValues, "label") ?? buildPlanLabelFromId(buildPlanId),
|
|
1970
1943
|
hint,
|
|
1971
1944
|
task_prompt: taskPrompt,
|
|
1972
1945
|
checks: preparationConfig?.checks ?? [],
|
|
@@ -1975,21 +1948,21 @@ export class LocalServiceRuntime {
|
|
|
1975
1948
|
artifact_requirements: artifactRequirementsFromRequestedArtifacts(preparationConfig?.requested_artifacts ?? []),
|
|
1976
1949
|
};
|
|
1977
1950
|
const commandPreview = (usePlannerText ? plan.command_preview : undefined) ??
|
|
1978
|
-
actionCommandPreview(actionType, preparationConfig?.name ?? null,
|
|
1951
|
+
actionCommandPreview(actionType, preparationConfig?.name ?? null, buildPlanId, proposalValues);
|
|
1979
1952
|
return ActionProposalResourceSchema.parse({
|
|
1980
1953
|
kind: "interf-action-proposal",
|
|
1981
1954
|
version: 1,
|
|
1982
1955
|
proposal_id: createActionProposalId(),
|
|
1983
1956
|
status: "awaiting_approval",
|
|
1984
1957
|
action_type: actionType,
|
|
1985
|
-
title: (usePlannerText ? plan.title : undefined) ?? `Draft
|
|
1986
|
-
summary: (usePlannerText ? plan.summary : undefined) ?? "Ask the configured local executor to create a reusable
|
|
1958
|
+
title: (usePlannerText ? plan.title : undefined) ?? `Draft Build Plan ${buildPlanId}`,
|
|
1959
|
+
summary: (usePlannerText ? plan.summary : undefined) ?? "Ask the configured local executor to create a reusable Build Plan.",
|
|
1987
1960
|
assistant_message: (usePlannerText ? plan.assistant_message : undefined) ??
|
|
1988
1961
|
actionAssistantMessage(actionType, preparationConfig?.name ?? null, commandPreview),
|
|
1989
1962
|
command_preview: commandPreview,
|
|
1990
1963
|
message: request.message,
|
|
1991
1964
|
preparation: preparationConfig?.name ?? null,
|
|
1992
|
-
|
|
1965
|
+
build_plan: buildPlanId,
|
|
1993
1966
|
request: actionRequest,
|
|
1994
1967
|
created_at: now,
|
|
1995
1968
|
updated_at: now,
|
|
@@ -2003,12 +1976,12 @@ export class LocalServiceRuntime {
|
|
|
2003
1976
|
const preparationConfig = this.resolvePreparationConfig(prepDataDir, plan.preparation ?? request.preparation ?? this.defaultPreparationName(prepDataDir));
|
|
2004
1977
|
const proposalActionType = ActionProposalTypeSchema.parse(actionType);
|
|
2005
1978
|
const preparationPath = resolveSourcePreparationPath(prepDataDir, preparationConfig);
|
|
2006
|
-
const
|
|
2007
|
-
stringValue(request.values, "
|
|
2008
|
-
const
|
|
2009
|
-
stringValue(plan.values, "
|
|
2010
|
-
stringValue(plan.values, "
|
|
2011
|
-
const
|
|
1979
|
+
const requestedBuildPlanId = stringValue(request.values, "build_plan_id") ??
|
|
1980
|
+
stringValue(request.values, "build_plan");
|
|
1981
|
+
const plannedBuildPlanId = plan.build_plan ??
|
|
1982
|
+
stringValue(plan.values, "build_plan_id") ??
|
|
1983
|
+
stringValue(plan.values, "build_plan");
|
|
1984
|
+
const buildPlanId = requestedBuildPlanId ?? plannedBuildPlanId ?? buildPlanIdForSourcePreparationConfig(preparationConfig);
|
|
2012
1985
|
const clarifyResolvedAction = (options) => ActionProposalResourceSchema.parse({
|
|
2013
1986
|
kind: "interf-action-proposal",
|
|
2014
1987
|
version: 1,
|
|
@@ -2020,7 +1993,7 @@ export class LocalServiceRuntime {
|
|
|
2020
1993
|
assistant_message: options.assistantMessage,
|
|
2021
1994
|
message: request.message,
|
|
2022
1995
|
preparation: preparationConfig.name,
|
|
2023
|
-
|
|
1996
|
+
build_plan: buildPlanId ?? null,
|
|
2024
1997
|
request: {
|
|
2025
1998
|
message: request.message,
|
|
2026
1999
|
...(proposalValues ? { values: proposalValues } : {}),
|
|
@@ -2036,7 +2009,7 @@ export class LocalServiceRuntime {
|
|
|
2036
2009
|
if (actionType === "test") {
|
|
2037
2010
|
const requestedMode = testModeFromValues(proposalValues);
|
|
2038
2011
|
const hasReadinessChecks = (preparationConfig.checks ?? []).length > 0;
|
|
2039
|
-
const
|
|
2012
|
+
const verifiableContextReady = hasVerifiableContextTestTarget(prepDataDir, preparationConfig);
|
|
2040
2013
|
if (!hasReadinessChecks) {
|
|
2041
2014
|
return clarifyResolvedAction({
|
|
2042
2015
|
title: `Add readiness checks for ${preparationConfig.name}`,
|
|
@@ -2044,24 +2017,24 @@ export class LocalServiceRuntime {
|
|
|
2044
2017
|
assistantMessage: `Preparation "${preparationConfig.name}" does not have saved readiness checks yet. Ask me to draft readiness checks after the Source Folder is prepared, or add readiness guidance first.`,
|
|
2045
2018
|
});
|
|
2046
2019
|
}
|
|
2047
|
-
if (!
|
|
2020
|
+
if (!verifiableContextReady && requestedMode !== "source-files") {
|
|
2048
2021
|
return clarifyResolvedAction({
|
|
2049
|
-
title: `
|
|
2050
|
-
summary: "Readiness checks need
|
|
2051
|
-
assistantMessage: `Preparation "${preparationConfig.name}" has no
|
|
2022
|
+
title: `Build ${preparationConfig.name} first`,
|
|
2023
|
+
summary: "Readiness checks need verifiable context unless you explicitly ask for a source-files-only baseline.",
|
|
2024
|
+
assistantMessage: `Preparation "${preparationConfig.name}" has no built verifiable context yet. Build it first; after that Interf can check readiness. If you specifically want a source-files-only baseline, ask for source files only.`,
|
|
2052
2025
|
});
|
|
2053
2026
|
}
|
|
2054
2027
|
}
|
|
2055
2028
|
const actionRequest = (() => {
|
|
2056
|
-
if (actionType === "
|
|
2029
|
+
if (actionType === "build") {
|
|
2057
2030
|
return {
|
|
2058
2031
|
preparation: preparationConfig.name,
|
|
2059
|
-
...(
|
|
2032
|
+
...(buildPlanId ? { build_plan: buildPlanId } : {}),
|
|
2060
2033
|
};
|
|
2061
2034
|
}
|
|
2062
2035
|
if (actionType === "test") {
|
|
2063
|
-
// 0.15 — verify runs always judge against the
|
|
2064
|
-
//
|
|
2036
|
+
// 0.15 — verify runs always judge against the verifiable context
|
|
2037
|
+
// verifiable context. The legacy `mode` field is gone from the
|
|
2065
2038
|
// wire request shape.
|
|
2066
2039
|
return {
|
|
2067
2040
|
preparation: preparationConfig.name,
|
|
@@ -2075,18 +2048,22 @@ export class LocalServiceRuntime {
|
|
|
2075
2048
|
target_count: Math.max(1, Math.min(8, Math.round(numberValue(proposalValues, "target_count") ?? 4))),
|
|
2076
2049
|
};
|
|
2077
2050
|
}
|
|
2078
|
-
const
|
|
2079
|
-
const taskPrompt =
|
|
2051
|
+
const fallbackBuildPlanId = buildPlanId ?? buildPlanIdForProposal(request.message, proposalValues);
|
|
2052
|
+
const taskPrompt = actionValueBuildPlanTaskPrompt(proposalValues) ??
|
|
2080
2053
|
stringValue(proposalValues, "task_prompt") ??
|
|
2081
|
-
|
|
2082
|
-
const hint = stringValue(proposalValues, "hint") ??
|
|
2054
|
+
buildPlanAuthoringPromptFallback(request.message, fallbackBuildPlanId);
|
|
2055
|
+
const hint = stringValue(proposalValues, "hint") ?? buildPlanAuthoringHintFromPrompt(taskPrompt);
|
|
2083
2056
|
return {
|
|
2084
2057
|
preparation: preparationConfig.name,
|
|
2085
2058
|
source_folder_path: preparationPath,
|
|
2086
|
-
|
|
2087
|
-
...(stringValue(proposalValues, "
|
|
2088
|
-
|
|
2089
|
-
|
|
2059
|
+
build_plan_id: fallbackBuildPlanId,
|
|
2060
|
+
...(stringValue(proposalValues, "base_build_plan_id") ?? stringValue(proposalValues, "base_build_plan_id")
|
|
2061
|
+
? { base_build_plan_id: stringValue(proposalValues, "base_build_plan_id") ?? stringValue(proposalValues, "base_build_plan_id") }
|
|
2062
|
+
: {}),
|
|
2063
|
+
...(stringValue(proposalValues, "reference_build_plan_id") ?? stringValue(proposalValues, "reference_build_plan_id")
|
|
2064
|
+
? { reference_build_plan_id: stringValue(proposalValues, "reference_build_plan_id") ?? stringValue(proposalValues, "reference_build_plan_id") }
|
|
2065
|
+
: {}),
|
|
2066
|
+
label: stringValue(proposalValues, "label") ?? buildPlanLabelFromId(fallbackBuildPlanId),
|
|
2090
2067
|
hint,
|
|
2091
2068
|
task_prompt: taskPrompt,
|
|
2092
2069
|
checks: preparationConfig.checks ?? [],
|
|
@@ -2098,27 +2075,27 @@ export class LocalServiceRuntime {
|
|
|
2098
2075
|
const title = (() => {
|
|
2099
2076
|
if (plan.title)
|
|
2100
2077
|
return plan.title;
|
|
2101
|
-
if (proposalActionType === "
|
|
2102
|
-
return `
|
|
2078
|
+
if (proposalActionType === "build")
|
|
2079
|
+
return `Build ${preparationConfig.name}`;
|
|
2103
2080
|
if (proposalActionType === "test")
|
|
2104
2081
|
return `Check readiness for ${preparationConfig.name}`;
|
|
2105
2082
|
if (proposalActionType === "readiness-check-draft")
|
|
2106
2083
|
return `Draft readiness checks for ${preparationConfig.name}`;
|
|
2107
|
-
return `Draft
|
|
2084
|
+
return `Draft Build Plan ${buildPlanId}`;
|
|
2108
2085
|
})();
|
|
2109
2086
|
const summary = (() => {
|
|
2110
2087
|
if (plan.summary)
|
|
2111
2088
|
return plan.summary;
|
|
2112
|
-
if (proposalActionType === "
|
|
2113
|
-
return "Build
|
|
2089
|
+
if (proposalActionType === "build")
|
|
2090
|
+
return "Build verifiable context agents can use.";
|
|
2114
2091
|
if (proposalActionType === "test")
|
|
2115
|
-
return "Run readiness checks against source files and
|
|
2092
|
+
return "Run readiness checks against source files and verifiable context.";
|
|
2116
2093
|
if (proposalActionType === "readiness-check-draft")
|
|
2117
2094
|
return "Ask the configured local executor to draft saved readiness checks.";
|
|
2118
|
-
return "Ask the configured local executor to create a reusable
|
|
2095
|
+
return "Ask the configured local executor to create a reusable Build Plan.";
|
|
2119
2096
|
})();
|
|
2120
2097
|
const previewValues = proposalValues;
|
|
2121
|
-
const commandPreview = plan.command_preview ?? actionCommandPreview(proposalActionType, preparationConfig.name,
|
|
2098
|
+
const commandPreview = plan.command_preview ?? actionCommandPreview(proposalActionType, preparationConfig.name, buildPlanId, previewValues);
|
|
2122
2099
|
return ActionProposalResourceSchema.parse({
|
|
2123
2100
|
kind: "interf-action-proposal",
|
|
2124
2101
|
version: 1,
|
|
@@ -2131,7 +2108,7 @@ export class LocalServiceRuntime {
|
|
|
2131
2108
|
command_preview: commandPreview,
|
|
2132
2109
|
message: request.message,
|
|
2133
2110
|
preparation: preparationConfig.name,
|
|
2134
|
-
|
|
2111
|
+
build_plan: buildPlanId,
|
|
2135
2112
|
request: actionRequest,
|
|
2136
2113
|
created_at: now,
|
|
2137
2114
|
updated_at: now,
|
|
@@ -2146,11 +2123,11 @@ export class LocalServiceRuntime {
|
|
|
2146
2123
|
if (proposal.action_type === "clarification") {
|
|
2147
2124
|
throw new Error("Clarification proposals cannot be submitted.");
|
|
2148
2125
|
}
|
|
2149
|
-
if (proposal.action_type === "
|
|
2150
|
-
const resource = await this.
|
|
2126
|
+
if (proposal.action_type === "build") {
|
|
2127
|
+
const resource = await this.createBuildRun(prepDataDir, proposal.request);
|
|
2151
2128
|
return {
|
|
2152
2129
|
runId: resource.run.run_id,
|
|
2153
|
-
runType: "
|
|
2130
|
+
runType: "build-run",
|
|
2154
2131
|
};
|
|
2155
2132
|
}
|
|
2156
2133
|
if (proposal.action_type === "test") {
|
|
@@ -2171,7 +2148,7 @@ export class LocalServiceRuntime {
|
|
|
2171
2148
|
if (directEndpoint) {
|
|
2172
2149
|
throw new Error(`Action "${proposal.action_type}" must be submitted directly to ${directEndpoint}.`);
|
|
2173
2150
|
}
|
|
2174
|
-
const job = await this.
|
|
2151
|
+
const job = await this.createBuildPlanAuthoringRun(prepDataDir, proposal.request, proposal.action_type === "build-plan-improvement" ? "build-plan-improvement" : "build-plan-draft");
|
|
2175
2152
|
return {
|
|
2176
2153
|
runId: job.run_id,
|
|
2177
2154
|
runType: "job-run",
|
|
@@ -2182,30 +2159,30 @@ export class LocalServiceRuntime {
|
|
|
2182
2159
|
if (!preparation) {
|
|
2183
2160
|
throw new Error(`Preparation "${preparationName}" is not saved in this control plane folder.`);
|
|
2184
2161
|
}
|
|
2185
|
-
const
|
|
2162
|
+
const buildPlan = overrides.build_plan ?? buildPlanIdForSourcePreparationConfig(preparation) ?? undefined;
|
|
2186
2163
|
return {
|
|
2187
2164
|
...preparation,
|
|
2188
|
-
...(
|
|
2165
|
+
...(buildPlan ? { build_plan: buildPlan } : {}),
|
|
2189
2166
|
...(typeof overrides.max_attempts === "number" ? { max_attempts: overrides.max_attempts } : {}),
|
|
2190
2167
|
...(typeof overrides.max_loops === "number" ? { max_loops: overrides.max_loops } : {}),
|
|
2191
2168
|
};
|
|
2192
2169
|
}
|
|
2193
|
-
|
|
2194
|
-
const
|
|
2195
|
-
const
|
|
2196
|
-
|
|
2197
|
-
return
|
|
2170
|
+
ensureVerifiableContextForRun(prepDataDir, preparationConfig) {
|
|
2171
|
+
const buildPlanId = requireSelectedBuildPlan(preparationConfig);
|
|
2172
|
+
const verifiableContextPath = ensureVerifiableContextScaffold(prepDataDir, preparationConfig.name, buildPlanId);
|
|
2173
|
+
syncVerifiableContextInterfConfigFromSourcePreparationConfig(verifiableContextPath, preparationConfig);
|
|
2174
|
+
return verifiableContextPath;
|
|
2198
2175
|
}
|
|
2199
|
-
|
|
2200
|
-
return
|
|
2176
|
+
readBuildRun(verifiableContextPath, runId) {
|
|
2177
|
+
return readBuildRunAt(buildRunPath(verifiableContextPath, runId));
|
|
2201
2178
|
}
|
|
2202
|
-
|
|
2203
|
-
if (!
|
|
2179
|
+
hydrateBuildRunFromRuntime(prepDataDir, verifiableContextPath, run) {
|
|
2180
|
+
if (!isTerminalBuildRunStatus(run.status))
|
|
2204
2181
|
return run;
|
|
2205
|
-
this.
|
|
2206
|
-
return this.
|
|
2182
|
+
this.refreshBuildRunFromRuntime(prepDataDir, verifiableContextPath, run.run_id);
|
|
2183
|
+
return this.readBuildRun(verifiableContextPath, run.run_id) ?? run;
|
|
2207
2184
|
}
|
|
2208
|
-
|
|
2185
|
+
finalizeInterruptedBuildRuns(prepDataDir) {
|
|
2209
2186
|
let preparations;
|
|
2210
2187
|
try {
|
|
2211
2188
|
preparations = listSourcePreparationConfigs(loadSourceFolderConfig(prepDataDir));
|
|
@@ -2214,11 +2191,11 @@ export class LocalServiceRuntime {
|
|
|
2214
2191
|
return;
|
|
2215
2192
|
}
|
|
2216
2193
|
for (const preparation of preparations) {
|
|
2217
|
-
const
|
|
2218
|
-
for (const run of listJsonFiles(
|
|
2219
|
-
.map(
|
|
2194
|
+
const verifiableContextPath = preparationVerifiableContextPath(asPreparationDataDir(prepDataDir), preparation.name);
|
|
2195
|
+
for (const run of listJsonFiles(buildRunsRoot(verifiableContextPath))
|
|
2196
|
+
.map(readBuildRunAt)
|
|
2220
2197
|
.filter((entry) => entry !== null)) {
|
|
2221
|
-
if (
|
|
2198
|
+
if (isTerminalBuildRunStatus(run.status) || this.activeBuildRuns.has(run.run_id))
|
|
2222
2199
|
continue;
|
|
2223
2200
|
const timestamp = createRunEventTimestamp();
|
|
2224
2201
|
const interruptedRun = {
|
|
@@ -2235,7 +2212,7 @@ export class LocalServiceRuntime {
|
|
|
2235
2212
|
};
|
|
2236
2213
|
}),
|
|
2237
2214
|
};
|
|
2238
|
-
this.
|
|
2215
|
+
this.writeBuildRun(prepDataDir, verifiableContextPath, applyEventToBuildRun(interruptedRun, {
|
|
2239
2216
|
type: "run.cancelled",
|
|
2240
2217
|
event_id: createRunEventId("event"),
|
|
2241
2218
|
run_id: run.run_id,
|
|
@@ -2273,7 +2250,7 @@ export class LocalServiceRuntime {
|
|
|
2273
2250
|
}
|
|
2274
2251
|
}
|
|
2275
2252
|
/**
|
|
2276
|
-
* 0.17 — emit per-Artifact billing events when a
|
|
2253
|
+
* 0.17 — emit per-Artifact billing events when a Build run reaches
|
|
2277
2254
|
* a terminal state. STUB FORM: writes a JSONL file alongside the run
|
|
2278
2255
|
* record by default. Production sink (Metronome HTTP) wires in 0.18+.
|
|
2279
2256
|
* The JSONL output is observability/dev fixture, NOT production
|
|
@@ -2281,7 +2258,7 @@ export class LocalServiceRuntime {
|
|
|
2281
2258
|
*/
|
|
2282
2259
|
emitBillingEventsForRun(prepDataDir, context) {
|
|
2283
2260
|
try {
|
|
2284
|
-
const run = this.
|
|
2261
|
+
const run = this.readBuildRun(context.verifiableContextPath, context.runId);
|
|
2285
2262
|
if (!run || run.artifacts.length === 0)
|
|
2286
2263
|
return;
|
|
2287
2264
|
const sink = this.billingEventSink ?? new JsonlBillingEventSink(defaultBillingEventLogPath({
|
|
@@ -2292,7 +2269,7 @@ export class LocalServiceRuntime {
|
|
|
2292
2269
|
const events = buildCompilationEventsForRun({
|
|
2293
2270
|
runId: context.runId,
|
|
2294
2271
|
preparation: run.preparation,
|
|
2295
|
-
|
|
2272
|
+
buildPlanId: run.build_plan,
|
|
2296
2273
|
accountId: null, // 0.17 — loopback only; cloud variant fills via tokenValidator (B4.3).
|
|
2297
2274
|
artifacts: run.artifacts,
|
|
2298
2275
|
startedAt: run.started_at ?? null,
|
|
@@ -2304,17 +2281,17 @@ export class LocalServiceRuntime {
|
|
|
2304
2281
|
}
|
|
2305
2282
|
catch {
|
|
2306
2283
|
// Billing is observability-only in 0.17; never let stub failures
|
|
2307
|
-
// block a successful
|
|
2284
|
+
// block a successful build.
|
|
2308
2285
|
}
|
|
2309
2286
|
}
|
|
2310
|
-
|
|
2311
|
-
mkdirSync(
|
|
2312
|
-
writeJsonFile(
|
|
2287
|
+
writeBuildRun(prepDataDir, verifiableContextPath, run) {
|
|
2288
|
+
mkdirSync(buildRunsRoot(verifiableContextPath), { recursive: true });
|
|
2289
|
+
writeJsonFile(buildRunPath(verifiableContextPath, run.run_id), BuildRunSchema.parse(run));
|
|
2313
2290
|
// Bust per-preparation list + readiness caches so the next read
|
|
2314
2291
|
// reflects the write. We invalidate broadly (per-preparation, not
|
|
2315
2292
|
// per-record) because list recompute cost is bounded by run count
|
|
2316
2293
|
// and the simpler model avoids fan-out bugs.
|
|
2317
|
-
this.
|
|
2294
|
+
this.buildRunCache.invalidatePreparation(prepDataDir, run.preparation);
|
|
2318
2295
|
this.readinessCache.invalidatePreparation(prepDataDir, run.preparation);
|
|
2319
2296
|
}
|
|
2320
2297
|
writeJobRun(prepDataDir, run) {
|
|
@@ -2341,24 +2318,24 @@ export class LocalServiceRuntime {
|
|
|
2341
2318
|
result: normalizedResult,
|
|
2342
2319
|
}));
|
|
2343
2320
|
}
|
|
2344
|
-
async
|
|
2345
|
-
const current = this.
|
|
2321
|
+
async recordBuildRunEvent(prepDataDir, verifiableContextPath, runId, event) {
|
|
2322
|
+
const current = this.readBuildRun(verifiableContextPath, runId);
|
|
2346
2323
|
if (!current)
|
|
2347
2324
|
return;
|
|
2348
|
-
this.
|
|
2325
|
+
this.writeBuildRun(prepDataDir, verifiableContextPath, applyEventToBuildRun(current, event));
|
|
2349
2326
|
if (event.type === "stage.passed" || event.type === "stage.failed") {
|
|
2350
|
-
this.
|
|
2327
|
+
this.refreshBuildRunFromRuntime(prepDataDir, verifiableContextPath, runId);
|
|
2351
2328
|
}
|
|
2352
2329
|
}
|
|
2353
|
-
|
|
2354
|
-
const current = this.
|
|
2330
|
+
refreshBuildRunFromRuntime(prepDataDir, verifiableContextPath, runId) {
|
|
2331
|
+
const current = this.readBuildRun(verifiableContextPath, runId);
|
|
2355
2332
|
if (!current)
|
|
2356
2333
|
return;
|
|
2357
|
-
const state = loadState(
|
|
2334
|
+
const state = loadState(verifiableContextPath);
|
|
2358
2335
|
if (!state?.stages)
|
|
2359
2336
|
return;
|
|
2360
2337
|
const historyByStage = new Map();
|
|
2361
|
-
for (const run of readRuntimeRunHistory(
|
|
2338
|
+
for (const run of readRuntimeRunHistory(verifiableContextPath)) {
|
|
2362
2339
|
if (run.target_name !== current.preparation)
|
|
2363
2340
|
continue;
|
|
2364
2341
|
const existing = historyByStage.get(run.stage);
|
|
@@ -2397,25 +2374,25 @@ export class LocalServiceRuntime {
|
|
|
2397
2374
|
}),
|
|
2398
2375
|
};
|
|
2399
2376
|
next.latest_proof = [...next.stages].reverse().find((stage) => Boolean(stage.latest_proof))?.latest_proof ?? next.latest_proof;
|
|
2400
|
-
// Recompute per-Artifact status whenever the
|
|
2377
|
+
// Recompute per-Artifact status whenever the Build run is
|
|
2401
2378
|
// refreshed from runtime state.
|
|
2402
2379
|
try {
|
|
2403
|
-
const
|
|
2380
|
+
const buildPlan = getBuildPlan(current.build_plan, { prepDataDir });
|
|
2404
2381
|
next.artifacts = computeArtifactStatuses({
|
|
2405
|
-
|
|
2406
|
-
|
|
2382
|
+
buildPlan,
|
|
2383
|
+
verifiableContextPath,
|
|
2407
2384
|
stageRuns: next.stages,
|
|
2408
|
-
counts:
|
|
2385
|
+
counts: countsFromVerifiableContextState(state),
|
|
2409
2386
|
});
|
|
2410
2387
|
}
|
|
2411
2388
|
catch {
|
|
2412
2389
|
next.artifacts = current.artifacts ?? [];
|
|
2413
2390
|
}
|
|
2414
|
-
this.
|
|
2391
|
+
this.writeBuildRun(prepDataDir, verifiableContextPath, next);
|
|
2415
2392
|
}
|
|
2416
|
-
async emitRuntimeDerivedEvents(prepDataDir,
|
|
2417
|
-
const state = loadState(
|
|
2418
|
-
const run = this.
|
|
2393
|
+
async emitRuntimeDerivedEvents(prepDataDir, verifiableContextPath, runId) {
|
|
2394
|
+
const state = loadState(verifiableContextPath);
|
|
2395
|
+
const run = this.readBuildRun(verifiableContextPath, runId);
|
|
2419
2396
|
if (!state?.stages || !run)
|
|
2420
2397
|
return;
|
|
2421
2398
|
for (const stage of run.stages) {
|
|
@@ -2424,7 +2401,7 @@ export class LocalServiceRuntime {
|
|
|
2424
2401
|
continue;
|
|
2425
2402
|
const artifacts = stageArtifactRefs(stage.stage_id, stageState.artifacts);
|
|
2426
2403
|
for (const artifact of artifacts) {
|
|
2427
|
-
await this.
|
|
2404
|
+
await this.recordBuildRunEvent(prepDataDir, verifiableContextPath, runId, {
|
|
2428
2405
|
type: "artifact.written",
|
|
2429
2406
|
event_id: createRunEventId("event"),
|
|
2430
2407
|
run_id: runId,
|
|
@@ -2433,7 +2410,7 @@ export class LocalServiceRuntime {
|
|
|
2433
2410
|
artifact,
|
|
2434
2411
|
});
|
|
2435
2412
|
}
|
|
2436
|
-
await this.
|
|
2413
|
+
await this.recordBuildRunEvent(prepDataDir, verifiableContextPath, runId, {
|
|
2437
2414
|
type: "proof.updated",
|
|
2438
2415
|
event_id: createRunEventId("event"),
|
|
2439
2416
|
run_id: runId,
|
|
@@ -2453,7 +2430,7 @@ export class LocalServiceRuntime {
|
|
|
2453
2430
|
return readSavedReadinessCheckRun(prepDataDir, preparationName);
|
|
2454
2431
|
}
|
|
2455
2432
|
checksEvaluatedEvent(runId, readinessRun) {
|
|
2456
|
-
const target = readinessRun.
|
|
2433
|
+
const target = readinessRun.verifiable_context ?? readinessRun.source_files;
|
|
2457
2434
|
return {
|
|
2458
2435
|
type: "checks.evaluated",
|
|
2459
2436
|
event_id: createRunEventId("event"),
|
|
@@ -2474,9 +2451,9 @@ export class LocalServiceRuntime {
|
|
|
2474
2451
|
readiness,
|
|
2475
2452
|
};
|
|
2476
2453
|
}
|
|
2477
|
-
writeVerifyRun(prepDataDir,
|
|
2478
|
-
mkdirSync(verifyRunsRoot(
|
|
2479
|
-
writeJsonFile(verifyRunPath(
|
|
2454
|
+
writeVerifyRun(prepDataDir, verifiableContextPath, run) {
|
|
2455
|
+
mkdirSync(verifyRunsRoot(verifiableContextPath), { recursive: true });
|
|
2456
|
+
writeJsonFile(verifyRunPath(verifiableContextPath, run.run_id), VerifyRunResourceSchema.parse(run));
|
|
2480
2457
|
this.verifyRunCache.invalidatePreparation(prepDataDir, run.preparation);
|
|
2481
2458
|
this.readinessCache.invalidatePreparation(prepDataDir, run.preparation);
|
|
2482
2459
|
}
|