@interf/compiler 0.13.0 → 0.18.0
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/LICENSE.md +1 -0
- package/README.md +50 -7
- package/TRADEMARKS.md +4 -4
- package/agent-skills/interf-actions/SKILL.md +51 -5
- package/agent-skills/interf-actions/references/cli.md +82 -82
- package/builtin-methods/interf-default/README.md +6 -7
- package/builtin-methods/interf-default/method.json +7 -68
- package/builtin-methods/interf-default/method.schema.json +52 -50
- package/dist/cli/commands/agents.d.ts +2 -0
- package/dist/cli/commands/agents.js +213 -0
- package/dist/cli/commands/compile.js +10 -1
- package/dist/cli/commands/doctor.js +1 -1
- package/dist/cli/commands/login.js +1 -1
- package/dist/cli/commands/logout.js +1 -1
- package/dist/cli/commands/mcp.d.ts +42 -0
- package/dist/cli/commands/mcp.js +239 -0
- package/dist/cli/commands/method.js +1 -1
- package/dist/cli/commands/prep.js +81 -7
- package/dist/cli/commands/reset.js +1 -1
- package/dist/cli/commands/runs.js +1 -1
- package/dist/cli/commands/status.js +1 -1
- package/dist/cli/commands/verify.d.ts +10 -0
- package/dist/cli/commands/{test.js → verify.js} +30 -15
- package/dist/cli/commands/web.js +71 -18
- package/dist/cli/commands/wizard.js +462 -107
- package/dist/cli/index.d.ts +4 -2
- package/dist/cli/index.js +7 -3
- package/dist/compiler-ui/404.html +1 -1
- package/dist/compiler-ui/__next.__PAGE__.txt +2 -2
- package/dist/compiler-ui/__next._full.txt +3 -3
- package/dist/compiler-ui/__next._head.txt +1 -1
- package/dist/compiler-ui/__next._index.txt +2 -2
- package/dist/compiler-ui/__next._tree.txt +2 -2
- package/dist/compiler-ui/_next/static/chunks/{045gole2ojo3g.css → 0_c_tvh-cukjz.css} +1 -1
- package/dist/compiler-ui/_next/static/chunks/0f_geuwdesg_c.js +114 -0
- package/dist/compiler-ui/_not-found/__next._full.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._head.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._index.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._not-found.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._tree.txt +2 -2
- package/dist/compiler-ui/_not-found.html +1 -1
- package/dist/compiler-ui/_not-found.txt +2 -2
- package/dist/compiler-ui/index.html +1 -1
- package/dist/compiler-ui/index.txt +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/packages/contracts/index.d.ts +2 -1
- package/dist/packages/contracts/index.js +1 -0
- package/dist/packages/contracts/lib/schema.d.ts +324 -31
- package/dist/packages/contracts/lib/schema.js +281 -21
- package/dist/packages/{local-service → engine}/action-definitions.js +9 -2
- package/dist/packages/{local-service → engine}/action-planner.d.ts +1 -1
- package/dist/packages/{local-service → engine}/action-planner.js +1 -1
- package/dist/packages/{agents → engine/agents}/index.d.ts +3 -0
- package/dist/packages/{agents → engine/agents}/index.js +3 -0
- package/dist/packages/{agents → engine/agents}/lib/compiled-bootstrap.js +2 -2
- package/dist/packages/engine/agents/lib/detection.d.ts +13 -0
- package/dist/packages/{agents → engine/agents}/lib/detection.js +11 -0
- package/dist/packages/{agents → engine/agents}/lib/executors.d.ts +2 -2
- package/dist/packages/{agents → engine/agents}/lib/shells.d.ts +14 -6
- package/dist/packages/{agents → engine/agents}/lib/shells.js +133 -126
- package/dist/packages/{agents → engine/agents}/lib/user-config.js +2 -2
- package/dist/packages/engine/agents/registry.d.ts +91 -0
- package/dist/packages/engine/agents/registry.js +321 -0
- package/dist/packages/engine/agents/role-executors.d.ts +35 -0
- package/dist/packages/engine/agents/role-executors.js +88 -0
- package/dist/packages/engine/agents/role-router.d.ts +66 -0
- package/dist/packages/engine/agents/role-router.js +73 -0
- package/dist/packages/{local-service → engine}/client.d.ts +9 -9
- package/dist/packages/{local-service → engine}/client.js +11 -11
- package/dist/packages/engine/cloud-seams.d.ts +115 -0
- package/dist/packages/engine/cloud-seams.js +84 -0
- package/dist/packages/engine/compile/artifact-counts.d.ts +1 -0
- package/dist/packages/{compiler → engine/compile}/artifact-counts.js +4 -4
- package/dist/packages/engine/compile/artifact-status.d.ts +41 -0
- package/dist/packages/engine/compile/artifact-status.js +166 -0
- package/dist/packages/engine/compile/billing-events.d.ts +89 -0
- package/dist/packages/engine/compile/billing-events.js +74 -0
- package/dist/packages/engine/compile/check-evaluator.d.ts +66 -0
- package/dist/packages/engine/compile/check-evaluator.js +298 -0
- package/dist/packages/{compiler → engine/compile}/compiled-pipeline.d.ts +12 -1
- package/dist/packages/{compiler → engine/compile}/compiled-pipeline.js +16 -6
- package/dist/packages/engine/compile/compiled-schema.d.ts +21 -0
- package/dist/packages/engine/compile/compiled-schema.js +126 -0
- package/dist/packages/{compiler → engine/compile}/compiled-stage-plan.d.ts +2 -1
- package/dist/packages/{compiler → engine/compile}/compiled-stage-plan.js +35 -18
- package/dist/packages/{compiler → engine/compile}/compiled-stage-runner.d.ts +1 -1
- package/dist/packages/{compiler → engine/compile}/compiled-stage-runner.js +4 -4
- package/dist/packages/{compiler → engine/compile}/compiled-target.d.ts +2 -2
- package/dist/packages/{compiler → engine/compile}/compiled-target.js +2 -2
- package/dist/packages/{compiler → engine/compile}/discovery.js +1 -1
- package/dist/packages/{compiler → engine/compile}/index.d.ts +0 -1
- package/dist/packages/{compiler → engine/compile}/index.js +0 -1
- package/dist/packages/{compiler → engine/compile}/lib/schema.d.ts +113 -94
- package/dist/packages/{compiler → engine/compile}/lib/schema.js +35 -39
- package/dist/packages/engine/compile/method-primitives.d.ts +2 -0
- package/dist/packages/{compiler → engine/compile}/method-primitives.js +1 -1
- package/dist/packages/{compiler → engine/compile}/method-runs.d.ts +3 -3
- package/dist/packages/{compiler → engine/compile}/method-runs.js +3 -3
- package/dist/packages/{compiler → engine/compile}/reset.js +4 -4
- package/dist/packages/{compiler → engine/compile}/runtime-contracts.js +2 -1
- package/dist/packages/{compiler → engine/compile}/runtime-prompt.js +3 -2
- package/dist/packages/{compiler → engine/compile}/runtime-reconcile.d.ts +1 -1
- package/dist/packages/{compiler → engine/compile}/runtime-reconcile.js +47 -45
- package/dist/packages/{compiler → engine/compile}/runtime-runs.d.ts +1 -2
- package/dist/packages/{compiler → engine/compile}/runtime-runs.js +3 -44
- package/dist/packages/{compiler → engine/compile}/runtime-types.d.ts +7 -12
- package/dist/packages/engine/compile/runtime.d.ts +5 -0
- package/dist/packages/{compiler → engine/compile}/runtime.js +1 -2
- package/dist/packages/{compiler → engine/compile}/source-files.d.ts +1 -1
- package/dist/packages/{compiler → engine/compile}/source-files.js +3 -3
- package/dist/packages/{compiler → engine/compile}/state-health.js +8 -8
- package/dist/packages/{compiler → engine/compile}/state-io.js +2 -2
- package/dist/packages/{compiler → engine/compile}/state-view.js +9 -8
- package/dist/packages/{compiler → engine/compile}/validate-compiled.js +63 -32
- package/dist/packages/{compiler → engine/compile}/validate.d.ts +1 -1
- package/dist/packages/{compiler → engine/compile}/validate.js +29 -27
- package/dist/packages/{execution → engine/execution}/lib/schema.d.ts +81 -55
- package/dist/packages/{execution → engine/execution}/lib/schema.js +14 -6
- package/dist/packages/engine/index.d.ts +22 -0
- package/dist/packages/engine/index.js +15 -0
- package/dist/packages/{local-service → engine}/lib/schema.d.ts +620 -435
- package/dist/packages/{local-service → engine}/lib/schema.js +103 -63
- package/dist/packages/{local-service → engine}/native-run-handlers.d.ts +7 -5
- package/dist/packages/{local-service → engine}/native-run-handlers.js +81 -29
- package/dist/packages/{local-service → engine}/preparation-store.d.ts +22 -4
- package/dist/packages/{local-service → engine}/preparation-store.js +56 -25
- package/dist/packages/{local-service → engine}/readiness-check-draft.d.ts +2 -2
- package/dist/packages/{local-service → engine}/routes.d.ts +36 -1
- package/dist/packages/{local-service → engine}/routes.js +38 -1
- package/dist/packages/{local-service → engine}/run-observability.d.ts +3 -3
- package/dist/packages/{local-service → engine}/run-observability.js +15 -15
- package/dist/packages/{local-service → engine}/runtime-event-applier.d.ts +1 -1
- package/dist/packages/{local-service → engine}/runtime-event-applier.js +7 -0
- package/dist/packages/{local-service → engine}/runtime-persistence.d.ts +6 -6
- package/dist/packages/{local-service → engine}/runtime-persistence.js +9 -9
- package/dist/packages/{local-service → engine}/runtime-proposal-helpers.d.ts +1 -1
- package/dist/packages/{local-service → engine}/runtime-proposal-helpers.js +5 -5
- package/dist/packages/{local-service → engine}/runtime-resource-builders.d.ts +12 -12
- package/dist/packages/{local-service → engine}/runtime-resource-builders.js +6 -5
- package/dist/packages/{local-service → engine}/runtime.d.ts +147 -56
- package/dist/packages/{local-service → engine}/runtime.js +333 -205
- package/dist/packages/{local-service → engine}/server.d.ts +25 -0
- package/dist/packages/{local-service → engine}/server.js +338 -17
- package/dist/packages/engine/verify/index.d.ts +13 -0
- package/dist/packages/engine/verify/index.js +10 -0
- package/dist/packages/{testing → engine/verify}/lib/schema.d.ts +1 -1
- package/dist/packages/{testing → engine/verify}/lib/schema.js +1 -1
- package/dist/packages/{testing → engine/verify}/readiness-check-run.d.ts +27 -11
- package/dist/packages/{testing → engine/verify}/readiness-check-run.js +72 -60
- package/dist/packages/{testing/test-execution.d.ts → engine/verify/verify-execution.d.ts} +2 -2
- package/dist/packages/{testing/test-execution.js → engine/verify/verify-execution.js} +2 -2
- package/dist/packages/{testing/test-paths.d.ts → engine/verify/verify-paths.d.ts} +1 -1
- package/dist/packages/{testing/test-paths.js → engine/verify/verify-paths.js} +2 -2
- package/dist/packages/{testing/test-sandbox.d.ts → engine/verify/verify-sandbox.d.ts} +1 -1
- package/dist/packages/{testing/test-sandbox.js → engine/verify/verify-sandbox.js} +6 -6
- package/dist/packages/{testing/test-specs.d.ts → engine/verify/verify-specs.d.ts} +1 -1
- package/dist/packages/{testing/test-specs.js → engine/verify/verify-specs.js} +2 -2
- package/dist/packages/{testing/test-targets.d.ts → engine/verify/verify-targets.d.ts} +1 -1
- package/dist/packages/{testing/test-targets.js → engine/verify/verify-targets.js} +3 -3
- package/dist/packages/{testing/test.d.ts → engine/verify/verify.d.ts} +4 -4
- package/dist/packages/{testing/test.js → engine/verify/verify.js} +3 -3
- package/dist/packages/engine/wire-schemas.d.ts +545 -0
- package/dist/packages/engine/wire-schemas.js +59 -0
- package/dist/packages/methods/authoring/method-authoring.d.ts +34 -0
- package/dist/packages/methods/authoring/method-authoring.js +260 -0
- package/dist/packages/{method-authoring → methods/authoring}/method-edit-session.d.ts +2 -2
- package/dist/packages/{method-authoring → methods/authoring}/method-edit-session.js +5 -5
- package/dist/packages/{method-authoring → methods/authoring}/method-improvement.d.ts +4 -4
- package/dist/packages/{method-authoring → methods/authoring}/method-improvement.js +16 -10
- package/dist/packages/{method-package → methods/package}/builtin-compiled-method.d.ts +12 -12
- package/dist/packages/{method-package → methods/package}/builtin-compiled-method.js +27 -24
- package/dist/packages/methods/package/context-interface.d.ts +73 -0
- package/dist/packages/{method-package → methods/package}/context-interface.js +50 -41
- package/dist/packages/{method-package → methods/package}/interf-method-package.js +31 -49
- package/dist/packages/{method-package → methods/package}/lib/package-root.js +2 -2
- package/dist/packages/{method-package → methods/package}/local-methods.d.ts +10 -5
- package/dist/packages/{method-package → methods/package}/local-methods.js +41 -68
- package/dist/packages/{method-package → methods/package}/method-definitions.d.ts +11 -7
- package/dist/packages/{method-package → methods/package}/method-definitions.js +5 -8
- package/dist/packages/{method-package → methods/package}/method-helpers.d.ts +1 -3
- package/dist/packages/{method-package → methods/package}/method-helpers.js +4 -8
- package/dist/packages/{method-package → methods/package}/method-review-paths.d.ts +1 -1
- package/dist/packages/{method-package → methods/package}/method-review-paths.js +1 -1
- package/dist/packages/{method-package → methods/package}/method-stage-runner.d.ts +4 -9
- package/dist/packages/{method-package → methods/package}/method-stage-runner.js +1 -29
- package/dist/packages/{method-package → methods/package}/user-methods.js +2 -2
- package/dist/packages/{project-model → project}/interf-bootstrap.d.ts +1 -1
- package/dist/packages/{project-model → project}/interf-bootstrap.js +1 -1
- package/dist/packages/{project-model → project}/interf-detect.js +4 -4
- package/dist/packages/{project-model → project}/interf-scaffold.js +18 -18
- package/dist/packages/{project-model → project}/lib/schema.d.ts +2 -2
- package/dist/packages/{project-model → project}/lib/schema.js +1 -1
- package/dist/packages/{project-model → project}/source-config.d.ts +1 -1
- package/dist/packages/{project-model → project}/source-config.js +9 -8
- package/dist/packages/{project-model → project}/source-folders.js +2 -2
- package/package.json +7 -16
- package/dist/cli/commands/test.d.ts +0 -9
- package/dist/compiler-ui/_next/static/chunks/17t-lulmyawg5.js +0 -89
- package/dist/packages/agents/lib/detection.d.ts +0 -7
- package/dist/packages/compiler/artifact-counts.d.ts +0 -1
- package/dist/packages/compiler/compiled-schema.d.ts +0 -31
- package/dist/packages/compiler/compiled-schema.js +0 -141
- package/dist/packages/compiler/method-primitives.d.ts +0 -2
- package/dist/packages/compiler/runtime-acceptance.d.ts +0 -9
- package/dist/packages/compiler/runtime-acceptance.js +0 -262
- package/dist/packages/compiler/runtime.d.ts +0 -6
- package/dist/packages/local-service/index.d.ts +0 -22
- package/dist/packages/local-service/index.js +0 -15
- package/dist/packages/method-authoring/method-authoring.d.ts +0 -24
- package/dist/packages/method-authoring/method-authoring.js +0 -116
- package/dist/packages/method-package/context-interface.d.ts +0 -60
- package/dist/packages/testing/index.d.ts +0 -13
- package/dist/packages/testing/index.js +0 -10
- /package/dist/compiler-ui/_next/static/{C6vVfy3aeYuIO3d2AoNvC → 6qyE1u9m_oBUkvAhhoCmO}/_buildManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{C6vVfy3aeYuIO3d2AoNvC → 6qyE1u9m_oBUkvAhhoCmO}/_clientMiddlewareManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{C6vVfy3aeYuIO3d2AoNvC → 6qyE1u9m_oBUkvAhhoCmO}/_ssgManifest.js +0 -0
- /package/dist/packages/{shared → contracts/utils}/file-types.d.ts +0 -0
- /package/dist/packages/{shared → contracts/utils}/file-types.js +0 -0
- /package/dist/packages/{shared → contracts/utils}/filesystem.d.ts +0 -0
- /package/dist/packages/{shared → contracts/utils}/filesystem.js +0 -0
- /package/dist/packages/{shared → contracts/utils}/logger.d.ts +0 -0
- /package/dist/packages/{shared → contracts/utils}/logger.js +0 -0
- /package/dist/packages/{shared → contracts/utils}/naming.d.ts +0 -0
- /package/dist/packages/{shared → contracts/utils}/naming.js +0 -0
- /package/dist/packages/{shared → contracts/utils}/parse.d.ts +0 -0
- /package/dist/packages/{shared → contracts/utils}/parse.js +0 -0
- /package/dist/packages/{shared → contracts/utils}/path-guards.d.ts +0 -0
- /package/dist/packages/{shared → contracts/utils}/path-guards.js +0 -0
- /package/dist/packages/{local-service → engine}/action-definitions.d.ts +0 -0
- /package/dist/packages/{local-service → engine}/action-values.d.ts +0 -0
- /package/dist/packages/{local-service → engine}/action-values.js +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/agents.d.ts +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/agents.js +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/args.d.ts +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/args.js +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/chart-guidance.d.ts +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/chart-guidance.js +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/compiled-bootstrap.d.ts +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/constants.d.ts +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/constants.js +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/execution-profile.d.ts +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/execution-profile.js +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/execution.d.ts +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/execution.js +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/executors.js +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/logs.d.ts +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/logs.js +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/preflight.d.ts +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/preflight.js +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/render.d.ts +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/render.js +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/schema.d.ts +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/schema.js +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/status.d.ts +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/status.js +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/types.d.ts +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/types.js +0 -0
- /package/dist/packages/{agents → engine/agents}/lib/user-config.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/compiled-compile.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/compiled-compile.js +0 -0
- /package/dist/packages/{compiler → engine/compile}/compiled-paths.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/compiled-paths.js +0 -0
- /package/dist/packages/{compiler → engine/compile}/discovery.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/reset.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/runtime-contracts.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/runtime-inventory.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/runtime-inventory.js +0 -0
- /package/dist/packages/{compiler → engine/compile}/runtime-paths.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/runtime-paths.js +0 -0
- /package/dist/packages/{compiler → engine/compile}/runtime-prompt.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/runtime-types.js +0 -0
- /package/dist/packages/{compiler → engine/compile}/state-artifacts.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/state-artifacts.js +0 -0
- /package/dist/packages/{compiler → engine/compile}/state-health.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/state-io.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/state-paths.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/state-paths.js +0 -0
- /package/dist/packages/{compiler → engine/compile}/state-view.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/state.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/state.js +0 -0
- /package/dist/packages/{compiler → engine/compile}/validate-compiled.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/validate-helpers.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/validate-helpers.js +0 -0
- /package/dist/packages/{local-service → engine}/connection-config.d.ts +0 -0
- /package/dist/packages/{local-service → engine}/connection-config.js +0 -0
- /package/dist/packages/{execution → engine/execution}/adapters.d.ts +0 -0
- /package/dist/packages/{execution → engine/execution}/adapters.js +0 -0
- /package/dist/packages/{execution → engine/execution}/events.d.ts +0 -0
- /package/dist/packages/{execution → engine/execution}/events.js +0 -0
- /package/dist/packages/{execution → engine/execution}/index.d.ts +0 -0
- /package/dist/packages/{execution → engine/execution}/index.js +0 -0
- /package/dist/packages/{local-service → engine}/instance-paths.d.ts +0 -0
- /package/dist/packages/{local-service → engine}/instance-paths.js +0 -0
- /package/dist/packages/{local-service → engine}/readiness-check-draft.js +0 -0
- /package/dist/packages/{local-service → engine}/runtime-caches.d.ts +0 -0
- /package/dist/packages/{local-service → engine}/runtime-caches.js +0 -0
- /package/dist/packages/{local-service → engine}/service-registry.d.ts +0 -0
- /package/dist/packages/{local-service → engine}/service-registry.js +0 -0
- /package/dist/packages/{testing/test-profile-presets.d.ts → engine/verify/verify-profile-presets.d.ts} +0 -0
- /package/dist/packages/{testing/test-profile-presets.js → engine/verify/verify-profile-presets.js} +0 -0
- /package/dist/packages/{testing/test-types.d.ts → engine/verify/verify-types.d.ts} +0 -0
- /package/dist/packages/{testing/test-types.js → engine/verify/verify-types.js} +0 -0
- /package/dist/packages/{method-authoring → methods/authoring}/index.d.ts +0 -0
- /package/dist/packages/{method-authoring → methods/authoring}/index.js +0 -0
- /package/dist/packages/{method-authoring → methods/authoring}/lib/method-edit-utils.d.ts +0 -0
- /package/dist/packages/{method-authoring → methods/authoring}/lib/method-edit-utils.js +0 -0
- /package/dist/packages/{method-package → methods/package}/interf-method-package.d.ts +0 -0
- /package/dist/packages/{method-package → methods/package}/lib/package-root.d.ts +0 -0
- /package/dist/packages/{method-package → methods/package}/user-methods.d.ts +0 -0
- /package/dist/packages/{project-model → project}/index.d.ts +0 -0
- /package/dist/packages/{project-model → project}/index.js +0 -0
- /package/dist/packages/{project-model → project}/interf-detect.d.ts +0 -0
- /package/dist/packages/{project-model → project}/interf-scaffold.d.ts +0 -0
- /package/dist/packages/{project-model → project}/interf.d.ts +0 -0
- /package/dist/packages/{project-model → project}/interf.js +0 -0
- /package/dist/packages/{project-model → project}/preparation-entries.d.ts +0 -0
- /package/dist/packages/{project-model → project}/preparation-entries.js +0 -0
- /package/dist/packages/{project-model → project}/source-folders.d.ts +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type Server } from "node:http";
|
|
2
2
|
import { type LocalServiceRunHandlers, type LocalServiceRuntime } from "./runtime.js";
|
|
3
|
+
import type { IdempotencyStore, RunLeaseStore, TokenValidator } from "./cloud-seams.js";
|
|
4
|
+
import type { BillingEventSink } from "./compile/billing-events.js";
|
|
3
5
|
/** Generate a fresh per-instance bearer token. */
|
|
4
6
|
export declare function createLocalServiceAuthToken(): string;
|
|
5
7
|
export interface StartLocalServiceOptions {
|
|
@@ -21,6 +23,29 @@ export interface StartLocalServiceOptions {
|
|
|
21
23
|
* and any caller that explicitly opts in).
|
|
22
24
|
*/
|
|
23
25
|
authToken?: string | null | "auto";
|
|
26
|
+
/**
|
|
27
|
+
* 0.17 — cloud-variant auth seam (B4.3). When provided, every
|
|
28
|
+
* mutating request runs through this validator instead of the local
|
|
29
|
+
* constant-time bearer check, and the resulting `account_id` is
|
|
30
|
+
* stashed on the runtime context for billing-event attribution.
|
|
31
|
+
* Local default: `undefined` — fall back to `runtime.authToken`
|
|
32
|
+
* comparison.
|
|
33
|
+
*/
|
|
34
|
+
tokenValidator?: TokenValidator;
|
|
35
|
+
/**
|
|
36
|
+
* 0.17 — cloud-variant interface seams forwarded to
|
|
37
|
+
* `LocalServiceRuntime`. Local default: in-process `Map`s on the
|
|
38
|
+
* runtime. Cloud variants pass shared implementations (Redis,
|
|
39
|
+
* Cassandra, etc.) so multi-replica engines coordinate. See
|
|
40
|
+
* `cloud-seams.ts` for the contracts.
|
|
41
|
+
*/
|
|
42
|
+
idempotencyStore?: IdempotencyStore;
|
|
43
|
+
runLeaseStore?: RunLeaseStore;
|
|
44
|
+
/**
|
|
45
|
+
* 0.17 — billing event sink. Local default writes per-run JSONL.
|
|
46
|
+
* Cloud variants inject a Metronome HTTP sender once 0.18+ ships.
|
|
47
|
+
*/
|
|
48
|
+
billingEventSink?: BillingEventSink;
|
|
24
49
|
}
|
|
25
50
|
export interface StartedLocalService {
|
|
26
51
|
runtime: LocalServiceRuntime;
|
|
@@ -5,12 +5,15 @@ import { existsSync, statSync, readFileSync } from "node:fs";
|
|
|
5
5
|
import { dirname, extname, join, normalize, resolve, sep } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { LOCAL_SERVICE_LOOPBACK_HOSTS, LocalServiceConfigSchema, LocalServiceDiscoverySchema, LocalServiceErrorSchema, OpenPathRequestSchema, ServiceRegistryEntrySchema, } from "./lib/schema.js";
|
|
8
|
-
import { assertPathWithinRoot, } from "../
|
|
8
|
+
import { assertPathWithinRoot, } from "../contracts/utils/path-guards.js";
|
|
9
9
|
import { createLocalServiceRuntime, } from "./runtime.js";
|
|
10
10
|
import { buildLocalServiceUrl, LOCAL_SERVICE_DEFAULT_HOST, LOCAL_SERVICE_DEFAULT_PORT, LOCAL_SERVICE_ROUTES, PREPARATION_SUBRESOURCES, } from "./routes.js";
|
|
11
11
|
import { registerServiceLocally, unregisterService, } from "./service-registry.js";
|
|
12
|
-
import { createStoredPreparation, deleteStoredPreparation, getStoredPreparation, listStoredPreparations, preparationWireShape, rehydratePreparations, } from "./preparation-store.js";
|
|
12
|
+
import { createStoredPreparation, deleteStoredPreparation, getStoredPreparation, listStoredPreparations, preparationWireShape, rehydratePreparations, updateStoredPreparation, } from "./preparation-store.js";
|
|
13
13
|
import { clearConnection, readActiveConnection, writeConnection, } from "./connection-config.js";
|
|
14
|
+
import { userMethodsRoot } from "./instance-paths.js";
|
|
15
|
+
import { builtinMethodPackagePath, methodDefinitionPath, } from "../methods/package/local-methods.js";
|
|
16
|
+
import { userMethodPath, userMethodExists } from "../methods/package/user-methods.js";
|
|
14
17
|
/** HTTP methods that require an authenticated bearer token + Origin guard. */
|
|
15
18
|
const MUTATING_METHODS = new Set(["POST", "PUT", "PATCH", "DELETE"]);
|
|
16
19
|
/** Generate a fresh per-instance bearer token. */
|
|
@@ -85,7 +88,7 @@ function corsHeadersFor(origin, allowed) {
|
|
|
85
88
|
"access-control-allow-origin": origin ?? allowed.hostUrls[0] ?? "",
|
|
86
89
|
"access-control-allow-credentials": "false",
|
|
87
90
|
"access-control-allow-methods": "GET,POST,PATCH,DELETE,OPTIONS",
|
|
88
|
-
"access-control-allow-headers": "content-type, authorization, x-interf-
|
|
91
|
+
"access-control-allow-headers": "content-type, authorization, x-interf-idempotency-key",
|
|
89
92
|
vary: "origin",
|
|
90
93
|
};
|
|
91
94
|
}
|
|
@@ -152,6 +155,11 @@ function contentType(filePath) {
|
|
|
152
155
|
return "image/x-icon";
|
|
153
156
|
case ".txt":
|
|
154
157
|
return "text/plain; charset=utf-8";
|
|
158
|
+
case ".md":
|
|
159
|
+
return "text/markdown; charset=utf-8";
|
|
160
|
+
case ".yml":
|
|
161
|
+
case ".yaml":
|
|
162
|
+
return "application/yaml; charset=utf-8";
|
|
155
163
|
case ".map":
|
|
156
164
|
return "application/json; charset=utf-8";
|
|
157
165
|
case ".webmanifest":
|
|
@@ -274,15 +282,45 @@ function safeStaticPath(root, relativePath) {
|
|
|
274
282
|
}
|
|
275
283
|
return absolute;
|
|
276
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* Resolve the on-disk root path for a method id. Used by the
|
|
287
|
+
* `/v1/methods/<id>/files/<relpath>` route. Resolution order matches
|
|
288
|
+
* the runtime: preparation-draft (if a prep id is supplied) → user
|
|
289
|
+
* library → built-in. Returns `null` when the method id resolves
|
|
290
|
+
* nowhere.
|
|
291
|
+
*/
|
|
292
|
+
function resolveMethodPackageRoot(methodId, prepDataDir) {
|
|
293
|
+
if (prepDataDir) {
|
|
294
|
+
const localPath = methodDefinitionPath(prepDataDir, methodId);
|
|
295
|
+
if (existsSync(join(localPath, "method.json")))
|
|
296
|
+
return localPath;
|
|
297
|
+
}
|
|
298
|
+
if (userMethodExists(methodId)) {
|
|
299
|
+
return userMethodPath(methodId);
|
|
300
|
+
}
|
|
301
|
+
const builtinPath = builtinMethodPackagePath(methodId);
|
|
302
|
+
if (existsSync(join(builtinPath, "method.json")))
|
|
303
|
+
return builtinPath;
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
277
306
|
function sendFile(res, filePath) {
|
|
278
307
|
if (!existsSync(filePath))
|
|
279
308
|
return false;
|
|
280
309
|
try {
|
|
281
310
|
if (!statSync(filePath).isFile())
|
|
282
311
|
return false;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
312
|
+
const type = contentType(filePath);
|
|
313
|
+
const headers = { "content-type": type };
|
|
314
|
+
// 0.17 — never cache HTML responses. UI deploys ship a fresh
|
|
315
|
+
// dist via `npm run web:build` and a restart; without `no-store`,
|
|
316
|
+
// a browser sitting on a stale `index.html` would keep loading
|
|
317
|
+
// hashed asset paths that no longer exist. Hashed Next.js bundles
|
|
318
|
+
// under `_next/static/<hash>/` keep the default long-cache
|
|
319
|
+
// because the filename itself changes when content changes.
|
|
320
|
+
if (type.startsWith("text/html")) {
|
|
321
|
+
headers["cache-control"] = "no-store";
|
|
322
|
+
}
|
|
323
|
+
writeHeaders(res, 200, headers);
|
|
286
324
|
res.end(readFileSync(filePath));
|
|
287
325
|
return true;
|
|
288
326
|
}
|
|
@@ -290,6 +328,25 @@ function sendFile(res, filePath) {
|
|
|
290
328
|
return false;
|
|
291
329
|
}
|
|
292
330
|
}
|
|
331
|
+
/**
|
|
332
|
+
* Reject any path that contains `..` or absolute segments — used by the
|
|
333
|
+
* 0.16 file-serving endpoints (`/v1/methods/<id>/files/...`,
|
|
334
|
+
* `/v1/preparations/<id>/files/...`). The `safeStaticPath` helper used
|
|
335
|
+
* by the static-asset path silently strips traversal segments; for the
|
|
336
|
+
* API endpoints we want a hard reject so the response is unambiguous.
|
|
337
|
+
*/
|
|
338
|
+
function isTraversalRelativePath(relPath) {
|
|
339
|
+
if (relPath.length === 0)
|
|
340
|
+
return true;
|
|
341
|
+
const segments = relPath.split(/[\\/]+/);
|
|
342
|
+
for (const segment of segments) {
|
|
343
|
+
if (segment === ".." || segment === "")
|
|
344
|
+
return true;
|
|
345
|
+
}
|
|
346
|
+
if (relPath.startsWith("/") || /^[A-Za-z]:/.test(relPath))
|
|
347
|
+
return true;
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
293
350
|
function sendCompilerUiAsset(req, res, _runtime) {
|
|
294
351
|
const staticRoot = compilerUiStaticRoot();
|
|
295
352
|
const url = parseRequestUrl(req);
|
|
@@ -378,6 +435,7 @@ async function routeApi(req, res, runtime) {
|
|
|
378
435
|
runs: LOCAL_SERVICE_ROUTES.runs,
|
|
379
436
|
action_proposals: LOCAL_SERVICE_ROUTES.actionProposals,
|
|
380
437
|
executor: LOCAL_SERVICE_ROUTES.executor,
|
|
438
|
+
agents: LOCAL_SERVICE_ROUTES.agents,
|
|
381
439
|
open_path: LOCAL_SERVICE_ROUTES.openPath,
|
|
382
440
|
},
|
|
383
441
|
}));
|
|
@@ -390,6 +448,15 @@ async function routeApi(req, res, runtime) {
|
|
|
390
448
|
const uptimeSeconds = Number.isFinite(startedMs)
|
|
391
449
|
? Math.max(0, Math.floor((Date.now() - startedMs) / 1000))
|
|
392
450
|
: 0;
|
|
451
|
+
const agentSnapshot = runtime.getAgentsRegistry();
|
|
452
|
+
// 0.16 — `connection_kind` lets the UI know whether OS-open is even
|
|
453
|
+
// possible. A loopback bind means the engine has filesystem access
|
|
454
|
+
// to the same host as the user; non-loopback (cloud) returns
|
|
455
|
+
// "remote" so the UI routes to api-served / signed-URL paths
|
|
456
|
+
// instead. The current binary refuses non-loopback binds (see the
|
|
457
|
+
// host whitelist below), so the value is "local" today; the field
|
|
458
|
+
// is in place so the UI can read it without a CLI version sniff.
|
|
459
|
+
const isLoopback = LOCAL_SERVICE_LOOPBACK_HOSTS.includes(runtime.host);
|
|
393
460
|
sendJson(res, 200, {
|
|
394
461
|
kind: "interf-instance",
|
|
395
462
|
version: 1,
|
|
@@ -402,6 +469,11 @@ async function routeApi(req, res, runtime) {
|
|
|
402
469
|
package_version: runtime.packageVersion ?? null,
|
|
403
470
|
preparation_count: listStoredPreparations().length,
|
|
404
471
|
auth_required: Boolean(runtime.authToken),
|
|
472
|
+
// 0.15 connected-agents fields:
|
|
473
|
+
agent_count: agentSnapshot.agents.length,
|
|
474
|
+
default_agent: agentSnapshot.active_agent?.name ?? null,
|
|
475
|
+
// 0.16 connection-mode flag:
|
|
476
|
+
connection_kind: isLoopback ? "local" : "remote",
|
|
405
477
|
});
|
|
406
478
|
return true;
|
|
407
479
|
}
|
|
@@ -434,6 +506,17 @@ async function routeApi(req, res, runtime) {
|
|
|
434
506
|
sendError(res, 400, "Missing required field: source.locator");
|
|
435
507
|
return true;
|
|
436
508
|
}
|
|
509
|
+
// TODO(cloud): activate remote-folder validator branch when the
|
|
510
|
+
// cloud variant lands. The local binary only knows how to read
|
|
511
|
+
// bytes from a local path; a `remote-folder` binding requires
|
|
512
|
+
// the cloud variant's per-account object-storage mount layer.
|
|
513
|
+
// Until then, reject any kind other than `local-folder` so the
|
|
514
|
+
// wire shape and runtime stay consistent.
|
|
515
|
+
const requestedKind = typeof body.source.kind === "string" ? body.source.kind : "local-folder";
|
|
516
|
+
if (requestedKind !== "local-folder") {
|
|
517
|
+
sendError(res, 400, `Unsupported source kind: ${requestedKind}. The local engine only accepts local-folder bindings; remote-folder requires the cloud variant.`);
|
|
518
|
+
return true;
|
|
519
|
+
}
|
|
437
520
|
const stored = createStoredPreparation(runtime, {
|
|
438
521
|
id: body.id,
|
|
439
522
|
source: { kind: "local-folder", locator: body.source.locator },
|
|
@@ -471,6 +554,25 @@ async function routeApi(req, res, runtime) {
|
|
|
471
554
|
sendJson(res, 200, preparationWireShape(storedPrep));
|
|
472
555
|
return true;
|
|
473
556
|
}
|
|
557
|
+
if (method === "PATCH") {
|
|
558
|
+
try {
|
|
559
|
+
const body = (await readJsonBody(req));
|
|
560
|
+
if (!body || typeof body !== "object") {
|
|
561
|
+
sendError(res, 400, "Request body must be a JSON object.");
|
|
562
|
+
return true;
|
|
563
|
+
}
|
|
564
|
+
const updated = updateStoredPreparation(decodedPrepId, {
|
|
565
|
+
method_id: body.method_id,
|
|
566
|
+
about: body.about,
|
|
567
|
+
...(body.checks !== undefined ? { checks: body.checks } : {}),
|
|
568
|
+
});
|
|
569
|
+
sendJson(res, 200, preparationWireShape(updated));
|
|
570
|
+
}
|
|
571
|
+
catch (error) {
|
|
572
|
+
sendError(res, 400, error instanceof Error ? error.message : String(error));
|
|
573
|
+
}
|
|
574
|
+
return true;
|
|
575
|
+
}
|
|
474
576
|
if (method === "DELETE") {
|
|
475
577
|
deleteStoredPreparation(runtime, decodedPrepId);
|
|
476
578
|
sendJson(res, 200, { id: decodedPrepId, deleted: true });
|
|
@@ -479,6 +581,10 @@ async function routeApi(req, res, runtime) {
|
|
|
479
581
|
}
|
|
480
582
|
else if (subPath === PREPARATION_SUBRESOURCES.compileRuns) {
|
|
481
583
|
if (method === "POST") {
|
|
584
|
+
if (!storedPrep.methodId) {
|
|
585
|
+
sendError(res, 400, `Preparation ${storedPrep.id} has no method bound. Set one via PATCH /v1/preparations/${storedPrep.id} { "method_id": "<id>" } before compiling.`);
|
|
586
|
+
return true;
|
|
587
|
+
}
|
|
482
588
|
try {
|
|
483
589
|
const body = (await readJsonBody(req));
|
|
484
590
|
const request = { preparation: storedPrep.id, ...(body ?? {}) };
|
|
@@ -509,12 +615,16 @@ async function routeApi(req, res, runtime) {
|
|
|
509
615
|
return true;
|
|
510
616
|
}
|
|
511
617
|
}
|
|
512
|
-
else if (subPath === PREPARATION_SUBRESOURCES.
|
|
618
|
+
else if (subPath === PREPARATION_SUBRESOURCES.verifyRuns) {
|
|
513
619
|
if (method === "POST") {
|
|
620
|
+
if (!storedPrep.methodId) {
|
|
621
|
+
sendError(res, 400, `Preparation ${storedPrep.id} has no method bound. Set one via PATCH /v1/preparations/${storedPrep.id} { "method_id": "<id>" } before verifying.`);
|
|
622
|
+
return true;
|
|
623
|
+
}
|
|
514
624
|
try {
|
|
515
625
|
const body = (await readJsonBody(req));
|
|
516
626
|
const request = { preparation: storedPrep.id, ...(body ?? {}) };
|
|
517
|
-
const resource = await runtime.
|
|
627
|
+
const resource = await runtime.createVerifyRun(storedPrep.prepDataDir, request);
|
|
518
628
|
sendJson(res, 201, resource);
|
|
519
629
|
}
|
|
520
630
|
catch (error) {
|
|
@@ -620,6 +730,58 @@ async function routeApi(req, res, runtime) {
|
|
|
620
730
|
return true;
|
|
621
731
|
}
|
|
622
732
|
}
|
|
733
|
+
else if (subPath.startsWith(`${PREPARATION_SUBRESOURCES.files}/`)) {
|
|
734
|
+
// GET /v1/preparations/<id>/files/<relpath> — read-only file
|
|
735
|
+
// serving inside the prep's portable-context root. Used by the
|
|
736
|
+
// locator pattern's `api-served` kind.
|
|
737
|
+
if (method === "GET") {
|
|
738
|
+
const rawRelPath = subPath.slice(PREPARATION_SUBRESOURCES.files.length + 1);
|
|
739
|
+
let relPath;
|
|
740
|
+
try {
|
|
741
|
+
relPath = decodeURIComponent(rawRelPath);
|
|
742
|
+
}
|
|
743
|
+
catch {
|
|
744
|
+
sendError(res, 400, "File path is not valid URI-encoded UTF-8.");
|
|
745
|
+
return true;
|
|
746
|
+
}
|
|
747
|
+
if (isTraversalRelativePath(relPath)) {
|
|
748
|
+
sendError(res, 400, "File path escapes portable-context root.");
|
|
749
|
+
return true;
|
|
750
|
+
}
|
|
751
|
+
const safePath = safeStaticPath(storedPrep.portableContextPath, relPath);
|
|
752
|
+
if (!safePath) {
|
|
753
|
+
sendError(res, 400, "File path escapes portable-context root.");
|
|
754
|
+
return true;
|
|
755
|
+
}
|
|
756
|
+
if (!sendFile(res, safePath)) {
|
|
757
|
+
sendError(res, 404, `File not found: ${relPath}`);
|
|
758
|
+
}
|
|
759
|
+
return true;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
else if (subPath.startsWith(`${PREPARATION_SUBRESOURCES.artifacts}/`)) {
|
|
763
|
+
// GET /v1/preparations/<id>/artifacts/<artifact-id> — per-Artifact
|
|
764
|
+
// status from the latest compile run. 0.17.
|
|
765
|
+
if (method === "GET") {
|
|
766
|
+
const rawArtifactId = subPath.slice(PREPARATION_SUBRESOURCES.artifacts.length + 1);
|
|
767
|
+
let artifactId;
|
|
768
|
+
try {
|
|
769
|
+
artifactId = decodeURIComponent(rawArtifactId);
|
|
770
|
+
}
|
|
771
|
+
catch {
|
|
772
|
+
sendError(res, 400, "Artifact id is not valid URI-encoded UTF-8.");
|
|
773
|
+
return true;
|
|
774
|
+
}
|
|
775
|
+
const preparation = runtime.getPreparation(storedPrep.prepDataDir, storedPrep.id);
|
|
776
|
+
const status = preparation?.artifacts.find((entry) => entry.artifact_id === artifactId);
|
|
777
|
+
if (!status) {
|
|
778
|
+
sendError(res, 404, `Artifact not found: ${artifactId}`);
|
|
779
|
+
return true;
|
|
780
|
+
}
|
|
781
|
+
sendJson(res, 200, status);
|
|
782
|
+
return true;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
623
785
|
sendError(res, 404, `Unknown preparation sub-route: ${subPath}`);
|
|
624
786
|
return true;
|
|
625
787
|
}
|
|
@@ -644,6 +806,50 @@ async function routeApi(req, res, runtime) {
|
|
|
644
806
|
sendJson(res, 200, methodResource);
|
|
645
807
|
return true;
|
|
646
808
|
}
|
|
809
|
+
const methodRunsMatch = path.match(/^\/v1\/methods\/([^/]+)\/runs$/);
|
|
810
|
+
if (method === "GET" && methodRunsMatch?.[1]) {
|
|
811
|
+
const firstPrep = listStoredPreparations()[0];
|
|
812
|
+
const runs = runtime.listMethodRuns(firstPrep?.prepDataDir ?? runtime.rootPath, decodeURIComponent(methodRunsMatch[1]));
|
|
813
|
+
sendJson(res, 200, { runs });
|
|
814
|
+
return true;
|
|
815
|
+
}
|
|
816
|
+
// GET /v1/methods/<id>/files/<relpath> — read-only file serving inside
|
|
817
|
+
// the method root. Used by the locator pattern's `api-served` kind so
|
|
818
|
+
// the UI can render SKILL.md / contract files in a side drawer over a
|
|
819
|
+
// remote engine. Resolution: prep-draft (when first prep exists) →
|
|
820
|
+
// user library → built-in. Path-guard rejects any traversal outside
|
|
821
|
+
// the resolved root.
|
|
822
|
+
const methodFilesMatch = path.match(/^\/v1\/methods\/([^/]+)\/files\/(.+)$/);
|
|
823
|
+
if (method === "GET" && methodFilesMatch?.[1] && methodFilesMatch[2]) {
|
|
824
|
+
const methodId = decodeURIComponent(methodFilesMatch[1]);
|
|
825
|
+
let relPath;
|
|
826
|
+
try {
|
|
827
|
+
relPath = decodeURIComponent(methodFilesMatch[2]);
|
|
828
|
+
}
|
|
829
|
+
catch {
|
|
830
|
+
sendError(res, 400, "File path is not valid URI-encoded UTF-8.");
|
|
831
|
+
return true;
|
|
832
|
+
}
|
|
833
|
+
if (isTraversalRelativePath(relPath)) {
|
|
834
|
+
sendError(res, 400, "File path escapes method root.");
|
|
835
|
+
return true;
|
|
836
|
+
}
|
|
837
|
+
const firstPrep = listStoredPreparations()[0];
|
|
838
|
+
const root = resolveMethodPackageRoot(methodId, firstPrep?.prepDataDir);
|
|
839
|
+
if (!root) {
|
|
840
|
+
sendError(res, 404, `Method not found: ${methodId}`);
|
|
841
|
+
return true;
|
|
842
|
+
}
|
|
843
|
+
const safePath = safeStaticPath(root, relPath);
|
|
844
|
+
if (!safePath) {
|
|
845
|
+
sendError(res, 400, "File path escapes method root.");
|
|
846
|
+
return true;
|
|
847
|
+
}
|
|
848
|
+
if (!sendFile(res, safePath)) {
|
|
849
|
+
sendError(res, 404, `File not found: ${relPath}`);
|
|
850
|
+
}
|
|
851
|
+
return true;
|
|
852
|
+
}
|
|
647
853
|
// ─────────────────────────────────────────────────────────────────────────
|
|
648
854
|
// Run observability — instance-wide. Each run record carries a workspace,
|
|
649
855
|
// so the runtime takes a "first prep" hint to scan registered preparations.
|
|
@@ -755,12 +961,12 @@ async function routeApi(req, res, runtime) {
|
|
|
755
961
|
return true;
|
|
756
962
|
}
|
|
757
963
|
}
|
|
758
|
-
const
|
|
759
|
-
if (method === "GET" &&
|
|
964
|
+
const verifyRunMatch = path.match(/^\/v1\/verify-runs\/([^/]+)$/);
|
|
965
|
+
if (method === "GET" && verifyRunMatch?.[1]) {
|
|
760
966
|
const firstPrep = listStoredPreparations()[0];
|
|
761
|
-
const run = runtime.
|
|
967
|
+
const run = runtime.getVerifyRun(firstPrep?.prepDataDir ?? runtime.rootPath, decodeURIComponent(verifyRunMatch[1]));
|
|
762
968
|
if (!run)
|
|
763
|
-
sendError(res, 404, "
|
|
969
|
+
sendError(res, 404, "Verify run not found.");
|
|
764
970
|
else
|
|
765
971
|
sendJson(res, 200, run);
|
|
766
972
|
return true;
|
|
@@ -800,19 +1006,119 @@ async function routeApi(req, res, runtime) {
|
|
|
800
1006
|
sendJson(res, 202, runtime.selectExecutor(body));
|
|
801
1007
|
return true;
|
|
802
1008
|
}
|
|
1009
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
1010
|
+
// Connected agents (0.15) — registry, role-map, role list.
|
|
1011
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
1012
|
+
if (path === LOCAL_SERVICE_ROUTES.agents) {
|
|
1013
|
+
if (method === "GET") {
|
|
1014
|
+
sendJson(res, 200, runtime.getAgentsRegistry());
|
|
1015
|
+
return true;
|
|
1016
|
+
}
|
|
1017
|
+
if (method === "POST") {
|
|
1018
|
+
try {
|
|
1019
|
+
const body = (await readJsonBody(req));
|
|
1020
|
+
if (!body || typeof body !== "object") {
|
|
1021
|
+
sendError(res, 400, "Request body must be a JSON object.");
|
|
1022
|
+
return true;
|
|
1023
|
+
}
|
|
1024
|
+
if (!body.name || typeof body.name !== "string") {
|
|
1025
|
+
sendError(res, 400, "Missing required field: name");
|
|
1026
|
+
return true;
|
|
1027
|
+
}
|
|
1028
|
+
if (!body.display_name || typeof body.display_name !== "string") {
|
|
1029
|
+
sendError(res, 400, "Missing required field: display_name");
|
|
1030
|
+
return true;
|
|
1031
|
+
}
|
|
1032
|
+
if (!body.command || typeof body.command !== "string") {
|
|
1033
|
+
sendError(res, 400, "Missing required field: command");
|
|
1034
|
+
return true;
|
|
1035
|
+
}
|
|
1036
|
+
const updated = runtime.registerCustomAgent({
|
|
1037
|
+
name: body.name,
|
|
1038
|
+
display_name: body.display_name,
|
|
1039
|
+
command: body.command,
|
|
1040
|
+
});
|
|
1041
|
+
sendJson(res, 201, updated);
|
|
1042
|
+
}
|
|
1043
|
+
catch (error) {
|
|
1044
|
+
sendError(res, 400, error instanceof Error ? error.message : String(error));
|
|
1045
|
+
}
|
|
1046
|
+
return true;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
if (method === "GET" && path === `${LOCAL_SERVICE_ROUTES.agents}/roles`) {
|
|
1050
|
+
sendJson(res, 200, {
|
|
1051
|
+
kind: "interf-canonical-roles",
|
|
1052
|
+
version: 1,
|
|
1053
|
+
roles: ["extractor", "summarizer", "structurer", "verifier", "general"],
|
|
1054
|
+
});
|
|
1055
|
+
return true;
|
|
1056
|
+
}
|
|
1057
|
+
if (path === `${LOCAL_SERVICE_ROUTES.agents}/role-map`) {
|
|
1058
|
+
if (method === "GET") {
|
|
1059
|
+
const snapshot = runtime.getAgentsRegistry();
|
|
1060
|
+
sendJson(res, 200, {
|
|
1061
|
+
role_map: snapshot.role_map,
|
|
1062
|
+
active_agent: snapshot.active_agent,
|
|
1063
|
+
});
|
|
1064
|
+
return true;
|
|
1065
|
+
}
|
|
1066
|
+
if (method === "PATCH") {
|
|
1067
|
+
try {
|
|
1068
|
+
const body = (await readJsonBody(req));
|
|
1069
|
+
if (!body || typeof body !== "object") {
|
|
1070
|
+
sendError(res, 400, "Request body must be a JSON object.");
|
|
1071
|
+
return true;
|
|
1072
|
+
}
|
|
1073
|
+
const patch = {};
|
|
1074
|
+
for (const [role, value] of Object.entries(body)) {
|
|
1075
|
+
if (typeof value !== "string") {
|
|
1076
|
+
sendError(res, 400, `Role-map values must be strings (or "" to clear). Got ${typeof value} for role "${role}".`);
|
|
1077
|
+
return true;
|
|
1078
|
+
}
|
|
1079
|
+
patch[role] = value;
|
|
1080
|
+
}
|
|
1081
|
+
const updated = runtime.patchAgentsRoleMap(patch);
|
|
1082
|
+
sendJson(res, 200, updated);
|
|
1083
|
+
}
|
|
1084
|
+
catch (error) {
|
|
1085
|
+
sendError(res, 400, error instanceof Error ? error.message : String(error));
|
|
1086
|
+
}
|
|
1087
|
+
return true;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
// /v1/agents/<name> — only DELETE; built-in names return 400.
|
|
1091
|
+
const agentMatch = path.match(/^\/v1\/agents\/([^/]+)$/);
|
|
1092
|
+
if (agentMatch?.[1] && method === "DELETE") {
|
|
1093
|
+
const name = decodeURIComponent(agentMatch[1]);
|
|
1094
|
+
try {
|
|
1095
|
+
const updated = runtime.unregisterCustomAgent(name);
|
|
1096
|
+
sendJson(res, 200, updated);
|
|
1097
|
+
}
|
|
1098
|
+
catch (error) {
|
|
1099
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1100
|
+
// Rejecting a built-in unregister is a 400 (bad request, the
|
|
1101
|
+
// caller is asking for something the contract doesn't allow).
|
|
1102
|
+
const status = /built-in agent/.test(message) ? 400 : 404;
|
|
1103
|
+
sendError(res, status, message);
|
|
1104
|
+
}
|
|
1105
|
+
return true;
|
|
1106
|
+
}
|
|
803
1107
|
if (method === "POST" && path === LOCAL_SERVICE_ROUTES.openPath) {
|
|
804
1108
|
const body = OpenPathRequestSchema.parse(await readJsonBody(req));
|
|
805
|
-
// Permit opening
|
|
1109
|
+
// Permit opening:
|
|
1110
|
+
// - any registered preparation root or its bound source folder
|
|
1111
|
+
// - the user method library at `~/.interf/methods/`
|
|
1112
|
+
// - the bundled built-in method root inside the installed package
|
|
1113
|
+
// (so SKILL.md / contract files in `interf-default` open correctly)
|
|
806
1114
|
const allowedRoots = [];
|
|
807
1115
|
for (const stored of listStoredPreparations()) {
|
|
808
1116
|
allowedRoots.push(stored.prepDataDir);
|
|
809
1117
|
if (stored.source.locator)
|
|
810
1118
|
allowedRoots.push(stored.source.locator);
|
|
811
1119
|
}
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
return true;
|
|
815
|
-
}
|
|
1120
|
+
allowedRoots.push(userMethodsRoot());
|
|
1121
|
+
allowedRoots.push(packageRoot()); // covers <pkg>/builtin-methods/...
|
|
816
1122
|
const openedPath = await openLocalPath(allowedRoots, body.path);
|
|
817
1123
|
sendJson(res, 202, { opened: true, path: openedPath });
|
|
818
1124
|
return true;
|
|
@@ -919,7 +1225,22 @@ export async function startLocalService(options = {}) {
|
|
|
919
1225
|
packageVersion: options.packageVersion,
|
|
920
1226
|
handlers: options.handlers,
|
|
921
1227
|
...(authToken ? { authToken } : {}),
|
|
1228
|
+
// 0.17 — forward cloud-variant injection points. Local default
|
|
1229
|
+
// ignores idempotencyStore / runLeaseStore (the runtime's
|
|
1230
|
+
// in-process maps stay authoritative); they're accepted on the
|
|
1231
|
+
// options surface so cloud forks have a stable target.
|
|
1232
|
+
...(options.billingEventSink ? { billingEventSink: options.billingEventSink } : {}),
|
|
1233
|
+
...(options.idempotencyStore ? { idempotencyStore: options.idempotencyStore } : {}),
|
|
1234
|
+
...(options.runLeaseStore ? { runLeaseStore: options.runLeaseStore } : {}),
|
|
922
1235
|
});
|
|
1236
|
+
// 0.17 — token validator (B4.3). Local default: undefined. Cloud
|
|
1237
|
+
// variants pass an async per-account validator. Stashed on the
|
|
1238
|
+
// runtime via `setTokenValidator` so `isAuthorizedMutation` can
|
|
1239
|
+
// pick it up; the local engine ignores it (the static bearer
|
|
1240
|
+
// check still runs).
|
|
1241
|
+
if (options.tokenValidator) {
|
|
1242
|
+
runtime.setTokenValidator(options.tokenValidator);
|
|
1243
|
+
}
|
|
923
1244
|
// Rehydrate 0.13 preparations as synthetic workspaces so subsequent
|
|
924
1245
|
// compile / test / readiness calls find them after a service restart.
|
|
925
1246
|
try {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * as schema from "./lib/schema.js";
|
|
2
|
+
export * as verify from "./verify.js";
|
|
3
|
+
export * as execution from "./verify-execution.js";
|
|
4
|
+
export * as paths from "./verify-paths.js";
|
|
5
|
+
export * as profilePresets from "./verify-profile-presets.js";
|
|
6
|
+
export * as readinessCheckRun from "./readiness-check-run.js";
|
|
7
|
+
export * as sandbox from "./verify-sandbox.js";
|
|
8
|
+
export * as specs from "./verify-specs.js";
|
|
9
|
+
export * as targets from "./verify-targets.js";
|
|
10
|
+
export * as types from "./verify-types.js";
|
|
11
|
+
export type { TestCase, TestCaseExpect, TestCheckResult, TestCaseResult, TestSpec, TestTargetResult, TestTargetRun, ReadinessCheckRun, TestTargetType, } from "./lib/schema.js";
|
|
12
|
+
export type { LoadedTestSpec, TestTargetCandidate, } from "./verify-types.js";
|
|
13
|
+
export type { TestSandboxRetentionMode, } from "./verify-sandbox.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * as schema from "./lib/schema.js";
|
|
2
|
+
export * as verify from "./verify.js";
|
|
3
|
+
export * as execution from "./verify-execution.js";
|
|
4
|
+
export * as paths from "./verify-paths.js";
|
|
5
|
+
export * as profilePresets from "./verify-profile-presets.js";
|
|
6
|
+
export * as readinessCheckRun from "./readiness-check-run.js";
|
|
7
|
+
export * as sandbox from "./verify-sandbox.js";
|
|
8
|
+
export * as specs from "./verify-specs.js";
|
|
9
|
+
export * as targets from "./verify-targets.js";
|
|
10
|
+
export * as types from "./verify-types.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { type TestCaseExpect, type TestTargetType } from "
|
|
2
|
+
import { type TestCaseExpect, type TestTargetType } from "../../../contracts/lib/schema.js";
|
|
3
3
|
export declare const TestCaseSchema: z.ZodObject<{
|
|
4
4
|
id: z.ZodString;
|
|
5
5
|
question: z.ZodString;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { RuntimeExecutorInfoSchema, TestCaseExpectSchema, TestTargetTypeSchema, PreparationNameSchema, } from "
|
|
2
|
+
import { RuntimeExecutorInfoSchema, TestCaseExpectSchema, TestTargetTypeSchema, PreparationNameSchema, } from "../../../contracts/lib/schema.js";
|
|
3
3
|
const TestCaseCoreSchema = z.object({
|
|
4
4
|
id: z.string().regex(/^[a-z0-9][a-z0-9-]{0,79}$/),
|
|
5
5
|
question: z.string().min(1),
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { MethodExecutor } from "../agents/lib/executors.js";
|
|
2
|
-
import type { SourcePreparationConfig } from "
|
|
3
|
-
import
|
|
4
|
-
import type
|
|
5
|
-
import
|
|
2
|
+
import type { SourcePreparationConfig } from "../../project/lib/schema.js";
|
|
3
|
+
import type { TestTargetType } from "../../contracts/lib/schema.js";
|
|
4
|
+
import { type TestTargetCandidate, type TestTargetResult } from "./verify.js";
|
|
5
|
+
import type { TestSandboxRetentionMode } from "./verify-sandbox.js";
|
|
6
|
+
import { type ReadinessCheckRun } from "./lib/schema.js";
|
|
6
7
|
export interface SavedReadinessCheckOutcome {
|
|
7
8
|
runPath: string;
|
|
8
9
|
displayRunPath?: string;
|
|
@@ -13,7 +14,11 @@ export interface ReadinessCheckRunResult {
|
|
|
13
14
|
sourcePath: string;
|
|
14
15
|
preparationConfig: SourcePreparationConfig;
|
|
15
16
|
portableContextPath: string | null;
|
|
16
|
-
|
|
17
|
+
/**
|
|
18
|
+
* 0.17 — restored. Populated when the verify run targets
|
|
19
|
+
* `source-files`; null when targeting `compiled`. Aggregates back
|
|
20
|
+
* onto the saved `ReadinessCheckRun` payload's `source_files` field.
|
|
21
|
+
*/
|
|
17
22
|
sourceFilesOutcome: SavedReadinessCheckOutcome | null;
|
|
18
23
|
compiledOutcome: SavedReadinessCheckOutcome | null;
|
|
19
24
|
readinessRunPath: string | null;
|
|
@@ -36,22 +41,28 @@ export declare function saveReadinessCheckRun(options: {
|
|
|
36
41
|
portableContextPath: string | null;
|
|
37
42
|
preparationName: string;
|
|
38
43
|
checksFingerprint: string;
|
|
39
|
-
|
|
40
|
-
sourceFilesOutcome: SavedReadinessCheckOutcome | null;
|
|
44
|
+
sourceFilesOutcome?: SavedReadinessCheckOutcome | null;
|
|
41
45
|
compiledOutcome: SavedReadinessCheckOutcome | null;
|
|
42
46
|
}): string;
|
|
43
|
-
export declare function
|
|
47
|
+
export declare function runSavedPortableContextCheck(options: {
|
|
44
48
|
sourcePath: string;
|
|
45
49
|
preparationConfig: SourcePreparationConfig;
|
|
46
50
|
executor?: MethodExecutor | null;
|
|
51
|
+
portableContextPath?: string | null;
|
|
47
52
|
preserveSandboxes?: TestSandboxRetentionMode;
|
|
48
53
|
runSuffix?: string | null;
|
|
49
54
|
}): Promise<SavedReadinessCheckOutcome | null>;
|
|
50
|
-
|
|
55
|
+
/**
|
|
56
|
+
* 0.17 — restored. Runs the saved readiness checks against the source
|
|
57
|
+
* folder baseline (no portable-context indirection) so users can see how
|
|
58
|
+
* much value the Method actually adds. The lower-level `verify-execution`
|
|
59
|
+
* + `verify-sandbox` source-files paths have stayed in tree since 0.13;
|
|
60
|
+
* this is the orchestrator hook that was missing.
|
|
61
|
+
*/
|
|
62
|
+
export declare function runSavedSourceFilesCheck(options: {
|
|
51
63
|
sourcePath: string;
|
|
52
64
|
preparationConfig: SourcePreparationConfig;
|
|
53
65
|
executor?: MethodExecutor | null;
|
|
54
|
-
portableContextPath?: string | null;
|
|
55
66
|
preserveSandboxes?: TestSandboxRetentionMode;
|
|
56
67
|
runSuffix?: string | null;
|
|
57
68
|
}): Promise<SavedReadinessCheckOutcome | null>;
|
|
@@ -59,9 +70,14 @@ export declare function runReadinessChecksForExecutor(options: {
|
|
|
59
70
|
sourcePath: string;
|
|
60
71
|
preparationConfig: SourcePreparationConfig;
|
|
61
72
|
portableContextPath: string | null;
|
|
62
|
-
mode: TestRunMode;
|
|
63
73
|
executor?: MethodExecutor | null;
|
|
64
74
|
preserveSandboxes?: TestSandboxRetentionMode;
|
|
65
75
|
runSuffix?: string | null;
|
|
66
76
|
saveLatest?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* 0.17 — selects which target the readiness checks judge against.
|
|
79
|
+
* Defaults to `compiled` for backward compatibility with existing
|
|
80
|
+
* callers.
|
|
81
|
+
*/
|
|
82
|
+
target?: TestTargetType;
|
|
67
83
|
}): Promise<ReadinessCheckRunResult>;
|