@interf/compiler 0.13.0 → 0.16.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/README.md +40 -0
- package/agent-skills/interf-actions/SKILL.md +51 -5
- package/agent-skills/interf-actions/references/cli.md +82 -82
- 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 +23 -5
- 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 +8 -0
- package/dist/cli/commands/{test.js → verify.js} +24 -18
- package/dist/cli/commands/web.js +71 -18
- package/dist/cli/commands/wizard.js +373 -126
- 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/{17t-lulmyawg5.js → 0jipmpez3_ehh.js} +16 -16
- package/dist/compiler-ui/_next/static/chunks/{045gole2ojo3g.css → 13awzu4tooflw.css} +1 -1
- 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 +102 -8
- package/dist/packages/contracts/lib/schema.js +102 -2
- package/dist/packages/{local-service → engine}/action-definitions.js +8 -1
- 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 +4 -4
- package/dist/packages/{agents → engine/agents}/lib/shells.js +8 -8
- 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/{compiler → engine/compile}/artifact-counts.js +1 -1
- 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/{compiler → engine/compile}/compiled-schema.d.ts +2 -2
- package/dist/packages/{compiler → engine/compile}/compiled-schema.js +4 -4
- package/dist/packages/{compiler → engine/compile}/compiled-stage-plan.d.ts +1 -1
- package/dist/packages/{compiler → engine/compile}/compiled-stage-plan.js +4 -4
- package/dist/packages/{compiler → engine/compile}/compiled-stage-runner.d.ts +1 -1
- package/dist/packages/{compiler → engine/compile}/compiled-stage-runner.js +3 -3
- 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}/lib/schema.d.ts +4 -4
- package/dist/packages/{compiler → engine/compile}/lib/schema.js +2 -2
- 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}/runtime-acceptance.js +17 -14
- package/dist/packages/{compiler → engine/compile}/runtime-reconcile.d.ts +1 -1
- package/dist/packages/{compiler → engine/compile}/runtime-reconcile.js +12 -10
- package/dist/packages/{compiler → engine/compile}/runtime-runs.d.ts +1 -2
- package/dist/packages/{compiler → engine/compile}/runtime-runs.js +3 -43
- package/dist/packages/{compiler → engine/compile}/runtime-types.d.ts +1 -5
- package/dist/packages/{compiler → engine/compile}/runtime.d.ts +2 -2
- package/dist/packages/{compiler → engine/compile}/runtime.js +1 -1
- 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 +2 -2
- package/dist/packages/{compiler → engine/compile}/state-io.js +2 -2
- package/dist/packages/{compiler → engine/compile}/state-view.js +2 -2
- package/dist/packages/{compiler → engine/compile}/validate-compiled.js +2 -2
- package/dist/packages/{compiler → engine/compile}/validate.d.ts +1 -1
- package/dist/packages/{compiler → engine/compile}/validate.js +3 -3
- package/dist/packages/{execution → engine/execution}/lib/schema.d.ts +2 -22
- package/dist/packages/{execution → engine/execution}/lib/schema.js +2 -2
- package/dist/packages/{local-service → engine}/index.d.ts +4 -4
- package/dist/packages/{local-service → engine}/index.js +2 -2
- package/dist/packages/{local-service → engine}/lib/schema.d.ts +85 -209
- package/dist/packages/{local-service → engine}/lib/schema.js +58 -54
- package/dist/packages/{local-service → engine}/native-run-handlers.d.ts +7 -5
- package/dist/packages/{local-service → engine}/native-run-handlers.js +69 -25
- package/dist/packages/{local-service → engine}/preparation-store.d.ts +16 -4
- package/dist/packages/{local-service → engine}/preparation-store.js +48 -25
- package/dist/packages/{local-service → engine}/readiness-check-draft.d.ts +2 -2
- package/dist/packages/{local-service → engine}/routes.d.ts +30 -1
- package/dist/packages/{local-service → engine}/routes.js +32 -1
- package/dist/packages/{local-service → engine}/run-observability.d.ts +3 -3
- package/dist/packages/{local-service → engine}/run-observability.js +14 -13
- package/dist/packages/{local-service → engine}/runtime-event-applier.d.ts +1 -1
- 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 +6 -6
- package/dist/packages/{local-service → engine}/runtime-resource-builders.js +1 -1
- package/dist/packages/{local-service → engine}/runtime.d.ts +80 -49
- package/dist/packages/{local-service → engine}/runtime.js +177 -179
- package/dist/packages/{local-service → engine}/server.js +276 -14
- 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 +6 -13
- package/dist/packages/{testing → engine/verify}/readiness-check-run.js +25 -81
- package/dist/packages/{testing → engine/verify}/test-paths.js +2 -2
- package/dist/packages/{testing → engine/verify}/test-sandbox.js +6 -6
- package/dist/packages/{testing → engine/verify}/test-specs.js +1 -1
- package/dist/packages/{testing → engine/verify}/test-targets.js +3 -3
- package/dist/packages/{method-authoring → methods/authoring}/method-authoring.d.ts +11 -3
- package/dist/packages/{method-authoring → methods/authoring}/method-authoring.js +68 -5
- package/dist/packages/{method-authoring → methods/authoring}/method-edit-session.d.ts +2 -2
- package/dist/packages/{method-authoring → methods/authoring}/method-improvement.d.ts +4 -4
- package/dist/packages/{method-authoring → methods/authoring}/method-improvement.js +15 -9
- package/dist/packages/{method-package → methods/package}/builtin-compiled-method.d.ts +1 -1
- package/dist/packages/{method-package → methods/package}/builtin-compiled-method.js +2 -2
- package/dist/packages/{method-package → methods/package}/context-interface.d.ts +1 -1
- package/dist/packages/{method-package → methods/package}/context-interface.js +3 -3
- package/dist/packages/{method-package → methods/package}/interf-method-package.js +3 -2
- package/dist/packages/{method-package → methods/package}/lib/package-root.js +2 -2
- package/dist/packages/{method-package → methods/package}/local-methods.d.ts +8 -2
- package/dist/packages/{method-package → methods/package}/local-methods.js +8 -7
- package/dist/packages/{method-package → methods/package}/method-definitions.d.ts +8 -2
- package/dist/packages/{method-package → methods/package}/method-definitions.js +5 -4
- package/dist/packages/{method-package → methods/package}/method-helpers.d.ts +1 -1
- package/dist/packages/{method-package → methods/package}/method-helpers.js +4 -4
- 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 +7 -7
- 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 +7 -7
- package/dist/packages/{project-model → project}/source-folders.js +2 -2
- package/package.json +6 -5
- package/dist/cli/commands/test.d.ts +0 -9
- package/dist/packages/agents/lib/detection.d.ts +0 -7
- /package/dist/compiler-ui/_next/static/{C6vVfy3aeYuIO3d2AoNvC → a3UiUF0DiMEbfWy_0gihg}/_buildManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{C6vVfy3aeYuIO3d2AoNvC → a3UiUF0DiMEbfWy_0gihg}/_clientMiddlewareManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{C6vVfy3aeYuIO3d2AoNvC → a3UiUF0DiMEbfWy_0gihg}/_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}/artifact-counts.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}/index.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/index.js +0 -0
- /package/dist/packages/{compiler → engine/compile}/method-primitives.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/method-primitives.js +0 -0
- /package/dist/packages/{compiler → engine/compile}/reset.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/reset.js +0 -0
- /package/dist/packages/{compiler → engine/compile}/runtime-acceptance.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/runtime-contracts.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/runtime-contracts.js +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-prompt.js +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}/runtime-event-applier.js +0 -0
- /package/dist/packages/{local-service → engine}/server.d.ts +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 → engine/verify}/index.d.ts +0 -0
- /package/dist/packages/{testing → engine/verify}/index.js +0 -0
- /package/dist/packages/{testing → engine/verify}/test-execution.d.ts +0 -0
- /package/dist/packages/{testing → engine/verify}/test-execution.js +0 -0
- /package/dist/packages/{testing → engine/verify}/test-paths.d.ts +0 -0
- /package/dist/packages/{testing → engine/verify}/test-profile-presets.d.ts +0 -0
- /package/dist/packages/{testing → engine/verify}/test-profile-presets.js +0 -0
- /package/dist/packages/{testing → engine/verify}/test-sandbox.d.ts +0 -0
- /package/dist/packages/{testing → engine/verify}/test-specs.d.ts +0 -0
- /package/dist/packages/{testing → engine/verify}/test-targets.d.ts +0 -0
- /package/dist/packages/{testing → engine/verify}/test-types.d.ts +0 -0
- /package/dist/packages/{testing → engine/verify}/test-types.js +0 -0
- /package/dist/packages/{testing → engine/verify}/test.d.ts +0 -0
- /package/dist/packages/{testing → engine/verify}/test.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-authoring → methods/authoring}/method-edit-session.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
|
@@ -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,6 +282,27 @@ 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;
|
|
@@ -290,6 +319,25 @@ function sendFile(res, filePath) {
|
|
|
290
319
|
return false;
|
|
291
320
|
}
|
|
292
321
|
}
|
|
322
|
+
/**
|
|
323
|
+
* Reject any path that contains `..` or absolute segments — used by the
|
|
324
|
+
* 0.16 file-serving endpoints (`/v1/methods/<id>/files/...`,
|
|
325
|
+
* `/v1/preparations/<id>/files/...`). The `safeStaticPath` helper used
|
|
326
|
+
* by the static-asset path silently strips traversal segments; for the
|
|
327
|
+
* API endpoints we want a hard reject so the response is unambiguous.
|
|
328
|
+
*/
|
|
329
|
+
function isTraversalRelativePath(relPath) {
|
|
330
|
+
if (relPath.length === 0)
|
|
331
|
+
return true;
|
|
332
|
+
const segments = relPath.split(/[\\/]+/);
|
|
333
|
+
for (const segment of segments) {
|
|
334
|
+
if (segment === ".." || segment === "")
|
|
335
|
+
return true;
|
|
336
|
+
}
|
|
337
|
+
if (relPath.startsWith("/") || /^[A-Za-z]:/.test(relPath))
|
|
338
|
+
return true;
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
293
341
|
function sendCompilerUiAsset(req, res, _runtime) {
|
|
294
342
|
const staticRoot = compilerUiStaticRoot();
|
|
295
343
|
const url = parseRequestUrl(req);
|
|
@@ -378,6 +426,7 @@ async function routeApi(req, res, runtime) {
|
|
|
378
426
|
runs: LOCAL_SERVICE_ROUTES.runs,
|
|
379
427
|
action_proposals: LOCAL_SERVICE_ROUTES.actionProposals,
|
|
380
428
|
executor: LOCAL_SERVICE_ROUTES.executor,
|
|
429
|
+
agents: LOCAL_SERVICE_ROUTES.agents,
|
|
381
430
|
open_path: LOCAL_SERVICE_ROUTES.openPath,
|
|
382
431
|
},
|
|
383
432
|
}));
|
|
@@ -390,6 +439,15 @@ async function routeApi(req, res, runtime) {
|
|
|
390
439
|
const uptimeSeconds = Number.isFinite(startedMs)
|
|
391
440
|
? Math.max(0, Math.floor((Date.now() - startedMs) / 1000))
|
|
392
441
|
: 0;
|
|
442
|
+
const agentSnapshot = runtime.getAgentsRegistry();
|
|
443
|
+
// 0.16 — `connection_kind` lets the UI know whether OS-open is even
|
|
444
|
+
// possible. A loopback bind means the engine has filesystem access
|
|
445
|
+
// to the same host as the user; non-loopback (cloud) returns
|
|
446
|
+
// "remote" so the UI routes to api-served / signed-URL paths
|
|
447
|
+
// instead. The current binary refuses non-loopback binds (see the
|
|
448
|
+
// host whitelist below), so the value is "local" today; the field
|
|
449
|
+
// is in place so the UI can read it without a CLI version sniff.
|
|
450
|
+
const isLoopback = LOCAL_SERVICE_LOOPBACK_HOSTS.includes(runtime.host);
|
|
393
451
|
sendJson(res, 200, {
|
|
394
452
|
kind: "interf-instance",
|
|
395
453
|
version: 1,
|
|
@@ -402,6 +460,11 @@ async function routeApi(req, res, runtime) {
|
|
|
402
460
|
package_version: runtime.packageVersion ?? null,
|
|
403
461
|
preparation_count: listStoredPreparations().length,
|
|
404
462
|
auth_required: Boolean(runtime.authToken),
|
|
463
|
+
// 0.15 connected-agents fields:
|
|
464
|
+
agent_count: agentSnapshot.agents.length,
|
|
465
|
+
default_agent: agentSnapshot.active_agent?.name ?? null,
|
|
466
|
+
// 0.16 connection-mode flag:
|
|
467
|
+
connection_kind: isLoopback ? "local" : "remote",
|
|
405
468
|
});
|
|
406
469
|
return true;
|
|
407
470
|
}
|
|
@@ -471,6 +534,24 @@ async function routeApi(req, res, runtime) {
|
|
|
471
534
|
sendJson(res, 200, preparationWireShape(storedPrep));
|
|
472
535
|
return true;
|
|
473
536
|
}
|
|
537
|
+
if (method === "PATCH") {
|
|
538
|
+
try {
|
|
539
|
+
const body = (await readJsonBody(req));
|
|
540
|
+
if (!body || typeof body !== "object") {
|
|
541
|
+
sendError(res, 400, "Request body must be a JSON object.");
|
|
542
|
+
return true;
|
|
543
|
+
}
|
|
544
|
+
const updated = updateStoredPreparation(decodedPrepId, {
|
|
545
|
+
method_id: body.method_id,
|
|
546
|
+
about: body.about,
|
|
547
|
+
});
|
|
548
|
+
sendJson(res, 200, preparationWireShape(updated));
|
|
549
|
+
}
|
|
550
|
+
catch (error) {
|
|
551
|
+
sendError(res, 400, error instanceof Error ? error.message : String(error));
|
|
552
|
+
}
|
|
553
|
+
return true;
|
|
554
|
+
}
|
|
474
555
|
if (method === "DELETE") {
|
|
475
556
|
deleteStoredPreparation(runtime, decodedPrepId);
|
|
476
557
|
sendJson(res, 200, { id: decodedPrepId, deleted: true });
|
|
@@ -479,6 +560,10 @@ async function routeApi(req, res, runtime) {
|
|
|
479
560
|
}
|
|
480
561
|
else if (subPath === PREPARATION_SUBRESOURCES.compileRuns) {
|
|
481
562
|
if (method === "POST") {
|
|
563
|
+
if (!storedPrep.methodId) {
|
|
564
|
+
sendError(res, 400, `Preparation ${storedPrep.id} has no method bound. Set one via PATCH /v1/preparations/${storedPrep.id} { "method_id": "<id>" } before compiling.`);
|
|
565
|
+
return true;
|
|
566
|
+
}
|
|
482
567
|
try {
|
|
483
568
|
const body = (await readJsonBody(req));
|
|
484
569
|
const request = { preparation: storedPrep.id, ...(body ?? {}) };
|
|
@@ -509,12 +594,16 @@ async function routeApi(req, res, runtime) {
|
|
|
509
594
|
return true;
|
|
510
595
|
}
|
|
511
596
|
}
|
|
512
|
-
else if (subPath === PREPARATION_SUBRESOURCES.
|
|
597
|
+
else if (subPath === PREPARATION_SUBRESOURCES.verifyRuns) {
|
|
513
598
|
if (method === "POST") {
|
|
599
|
+
if (!storedPrep.methodId) {
|
|
600
|
+
sendError(res, 400, `Preparation ${storedPrep.id} has no method bound. Set one via PATCH /v1/preparations/${storedPrep.id} { "method_id": "<id>" } before verifying.`);
|
|
601
|
+
return true;
|
|
602
|
+
}
|
|
514
603
|
try {
|
|
515
604
|
const body = (await readJsonBody(req));
|
|
516
605
|
const request = { preparation: storedPrep.id, ...(body ?? {}) };
|
|
517
|
-
const resource = await runtime.
|
|
606
|
+
const resource = await runtime.createVerifyRun(storedPrep.prepDataDir, request);
|
|
518
607
|
sendJson(res, 201, resource);
|
|
519
608
|
}
|
|
520
609
|
catch (error) {
|
|
@@ -620,6 +709,35 @@ async function routeApi(req, res, runtime) {
|
|
|
620
709
|
return true;
|
|
621
710
|
}
|
|
622
711
|
}
|
|
712
|
+
else if (subPath.startsWith(`${PREPARATION_SUBRESOURCES.files}/`)) {
|
|
713
|
+
// GET /v1/preparations/<id>/files/<relpath> — read-only file
|
|
714
|
+
// serving inside the prep's portable-context root. Used by the
|
|
715
|
+
// locator pattern's `api-served` kind.
|
|
716
|
+
if (method === "GET") {
|
|
717
|
+
const rawRelPath = subPath.slice(PREPARATION_SUBRESOURCES.files.length + 1);
|
|
718
|
+
let relPath;
|
|
719
|
+
try {
|
|
720
|
+
relPath = decodeURIComponent(rawRelPath);
|
|
721
|
+
}
|
|
722
|
+
catch {
|
|
723
|
+
sendError(res, 400, "File path is not valid URI-encoded UTF-8.");
|
|
724
|
+
return true;
|
|
725
|
+
}
|
|
726
|
+
if (isTraversalRelativePath(relPath)) {
|
|
727
|
+
sendError(res, 400, "File path escapes portable-context root.");
|
|
728
|
+
return true;
|
|
729
|
+
}
|
|
730
|
+
const safePath = safeStaticPath(storedPrep.portableContextPath, relPath);
|
|
731
|
+
if (!safePath) {
|
|
732
|
+
sendError(res, 400, "File path escapes portable-context root.");
|
|
733
|
+
return true;
|
|
734
|
+
}
|
|
735
|
+
if (!sendFile(res, safePath)) {
|
|
736
|
+
sendError(res, 404, `File not found: ${relPath}`);
|
|
737
|
+
}
|
|
738
|
+
return true;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
623
741
|
sendError(res, 404, `Unknown preparation sub-route: ${subPath}`);
|
|
624
742
|
return true;
|
|
625
743
|
}
|
|
@@ -644,6 +762,50 @@ async function routeApi(req, res, runtime) {
|
|
|
644
762
|
sendJson(res, 200, methodResource);
|
|
645
763
|
return true;
|
|
646
764
|
}
|
|
765
|
+
const methodRunsMatch = path.match(/^\/v1\/methods\/([^/]+)\/runs$/);
|
|
766
|
+
if (method === "GET" && methodRunsMatch?.[1]) {
|
|
767
|
+
const firstPrep = listStoredPreparations()[0];
|
|
768
|
+
const runs = runtime.listMethodRuns(firstPrep?.prepDataDir ?? runtime.rootPath, decodeURIComponent(methodRunsMatch[1]));
|
|
769
|
+
sendJson(res, 200, { runs });
|
|
770
|
+
return true;
|
|
771
|
+
}
|
|
772
|
+
// GET /v1/methods/<id>/files/<relpath> — read-only file serving inside
|
|
773
|
+
// the method root. Used by the locator pattern's `api-served` kind so
|
|
774
|
+
// the UI can render SKILL.md / contract files in a side drawer over a
|
|
775
|
+
// remote engine. Resolution: prep-draft (when first prep exists) →
|
|
776
|
+
// user library → built-in. Path-guard rejects any traversal outside
|
|
777
|
+
// the resolved root.
|
|
778
|
+
const methodFilesMatch = path.match(/^\/v1\/methods\/([^/]+)\/files\/(.+)$/);
|
|
779
|
+
if (method === "GET" && methodFilesMatch?.[1] && methodFilesMatch[2]) {
|
|
780
|
+
const methodId = decodeURIComponent(methodFilesMatch[1]);
|
|
781
|
+
let relPath;
|
|
782
|
+
try {
|
|
783
|
+
relPath = decodeURIComponent(methodFilesMatch[2]);
|
|
784
|
+
}
|
|
785
|
+
catch {
|
|
786
|
+
sendError(res, 400, "File path is not valid URI-encoded UTF-8.");
|
|
787
|
+
return true;
|
|
788
|
+
}
|
|
789
|
+
if (isTraversalRelativePath(relPath)) {
|
|
790
|
+
sendError(res, 400, "File path escapes method root.");
|
|
791
|
+
return true;
|
|
792
|
+
}
|
|
793
|
+
const firstPrep = listStoredPreparations()[0];
|
|
794
|
+
const root = resolveMethodPackageRoot(methodId, firstPrep?.prepDataDir);
|
|
795
|
+
if (!root) {
|
|
796
|
+
sendError(res, 404, `Method not found: ${methodId}`);
|
|
797
|
+
return true;
|
|
798
|
+
}
|
|
799
|
+
const safePath = safeStaticPath(root, relPath);
|
|
800
|
+
if (!safePath) {
|
|
801
|
+
sendError(res, 400, "File path escapes method root.");
|
|
802
|
+
return true;
|
|
803
|
+
}
|
|
804
|
+
if (!sendFile(res, safePath)) {
|
|
805
|
+
sendError(res, 404, `File not found: ${relPath}`);
|
|
806
|
+
}
|
|
807
|
+
return true;
|
|
808
|
+
}
|
|
647
809
|
// ─────────────────────────────────────────────────────────────────────────
|
|
648
810
|
// Run observability — instance-wide. Each run record carries a workspace,
|
|
649
811
|
// so the runtime takes a "first prep" hint to scan registered preparations.
|
|
@@ -755,12 +917,12 @@ async function routeApi(req, res, runtime) {
|
|
|
755
917
|
return true;
|
|
756
918
|
}
|
|
757
919
|
}
|
|
758
|
-
const
|
|
759
|
-
if (method === "GET" &&
|
|
920
|
+
const verifyRunMatch = path.match(/^\/v1\/verify-runs\/([^/]+)$/);
|
|
921
|
+
if (method === "GET" && verifyRunMatch?.[1]) {
|
|
760
922
|
const firstPrep = listStoredPreparations()[0];
|
|
761
|
-
const run = runtime.
|
|
923
|
+
const run = runtime.getVerifyRun(firstPrep?.prepDataDir ?? runtime.rootPath, decodeURIComponent(verifyRunMatch[1]));
|
|
762
924
|
if (!run)
|
|
763
|
-
sendError(res, 404, "
|
|
925
|
+
sendError(res, 404, "Verify run not found.");
|
|
764
926
|
else
|
|
765
927
|
sendJson(res, 200, run);
|
|
766
928
|
return true;
|
|
@@ -800,19 +962,119 @@ async function routeApi(req, res, runtime) {
|
|
|
800
962
|
sendJson(res, 202, runtime.selectExecutor(body));
|
|
801
963
|
return true;
|
|
802
964
|
}
|
|
965
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
966
|
+
// Connected agents (0.15) — registry, role-map, role list.
|
|
967
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
968
|
+
if (path === LOCAL_SERVICE_ROUTES.agents) {
|
|
969
|
+
if (method === "GET") {
|
|
970
|
+
sendJson(res, 200, runtime.getAgentsRegistry());
|
|
971
|
+
return true;
|
|
972
|
+
}
|
|
973
|
+
if (method === "POST") {
|
|
974
|
+
try {
|
|
975
|
+
const body = (await readJsonBody(req));
|
|
976
|
+
if (!body || typeof body !== "object") {
|
|
977
|
+
sendError(res, 400, "Request body must be a JSON object.");
|
|
978
|
+
return true;
|
|
979
|
+
}
|
|
980
|
+
if (!body.name || typeof body.name !== "string") {
|
|
981
|
+
sendError(res, 400, "Missing required field: name");
|
|
982
|
+
return true;
|
|
983
|
+
}
|
|
984
|
+
if (!body.display_name || typeof body.display_name !== "string") {
|
|
985
|
+
sendError(res, 400, "Missing required field: display_name");
|
|
986
|
+
return true;
|
|
987
|
+
}
|
|
988
|
+
if (!body.command || typeof body.command !== "string") {
|
|
989
|
+
sendError(res, 400, "Missing required field: command");
|
|
990
|
+
return true;
|
|
991
|
+
}
|
|
992
|
+
const updated = runtime.registerCustomAgent({
|
|
993
|
+
name: body.name,
|
|
994
|
+
display_name: body.display_name,
|
|
995
|
+
command: body.command,
|
|
996
|
+
});
|
|
997
|
+
sendJson(res, 201, updated);
|
|
998
|
+
}
|
|
999
|
+
catch (error) {
|
|
1000
|
+
sendError(res, 400, error instanceof Error ? error.message : String(error));
|
|
1001
|
+
}
|
|
1002
|
+
return true;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
if (method === "GET" && path === `${LOCAL_SERVICE_ROUTES.agents}/roles`) {
|
|
1006
|
+
sendJson(res, 200, {
|
|
1007
|
+
kind: "interf-canonical-roles",
|
|
1008
|
+
version: 1,
|
|
1009
|
+
roles: ["extractor", "summarizer", "structurer", "verifier", "general"],
|
|
1010
|
+
});
|
|
1011
|
+
return true;
|
|
1012
|
+
}
|
|
1013
|
+
if (path === `${LOCAL_SERVICE_ROUTES.agents}/role-map`) {
|
|
1014
|
+
if (method === "GET") {
|
|
1015
|
+
const snapshot = runtime.getAgentsRegistry();
|
|
1016
|
+
sendJson(res, 200, {
|
|
1017
|
+
role_map: snapshot.role_map,
|
|
1018
|
+
active_agent: snapshot.active_agent,
|
|
1019
|
+
});
|
|
1020
|
+
return true;
|
|
1021
|
+
}
|
|
1022
|
+
if (method === "PATCH") {
|
|
1023
|
+
try {
|
|
1024
|
+
const body = (await readJsonBody(req));
|
|
1025
|
+
if (!body || typeof body !== "object") {
|
|
1026
|
+
sendError(res, 400, "Request body must be a JSON object.");
|
|
1027
|
+
return true;
|
|
1028
|
+
}
|
|
1029
|
+
const patch = {};
|
|
1030
|
+
for (const [role, value] of Object.entries(body)) {
|
|
1031
|
+
if (typeof value !== "string") {
|
|
1032
|
+
sendError(res, 400, `Role-map values must be strings (or "" to clear). Got ${typeof value} for role "${role}".`);
|
|
1033
|
+
return true;
|
|
1034
|
+
}
|
|
1035
|
+
patch[role] = value;
|
|
1036
|
+
}
|
|
1037
|
+
const updated = runtime.patchAgentsRoleMap(patch);
|
|
1038
|
+
sendJson(res, 200, updated);
|
|
1039
|
+
}
|
|
1040
|
+
catch (error) {
|
|
1041
|
+
sendError(res, 400, error instanceof Error ? error.message : String(error));
|
|
1042
|
+
}
|
|
1043
|
+
return true;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
// /v1/agents/<name> — only DELETE; built-in names return 400.
|
|
1047
|
+
const agentMatch = path.match(/^\/v1\/agents\/([^/]+)$/);
|
|
1048
|
+
if (agentMatch?.[1] && method === "DELETE") {
|
|
1049
|
+
const name = decodeURIComponent(agentMatch[1]);
|
|
1050
|
+
try {
|
|
1051
|
+
const updated = runtime.unregisterCustomAgent(name);
|
|
1052
|
+
sendJson(res, 200, updated);
|
|
1053
|
+
}
|
|
1054
|
+
catch (error) {
|
|
1055
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1056
|
+
// Rejecting a built-in unregister is a 400 (bad request, the
|
|
1057
|
+
// caller is asking for something the contract doesn't allow).
|
|
1058
|
+
const status = /built-in agent/.test(message) ? 400 : 404;
|
|
1059
|
+
sendError(res, status, message);
|
|
1060
|
+
}
|
|
1061
|
+
return true;
|
|
1062
|
+
}
|
|
803
1063
|
if (method === "POST" && path === LOCAL_SERVICE_ROUTES.openPath) {
|
|
804
1064
|
const body = OpenPathRequestSchema.parse(await readJsonBody(req));
|
|
805
|
-
// Permit opening
|
|
1065
|
+
// Permit opening:
|
|
1066
|
+
// - any registered preparation root or its bound source folder
|
|
1067
|
+
// - the user method library at `~/.interf/methods/`
|
|
1068
|
+
// - the bundled built-in method root inside the installed package
|
|
1069
|
+
// (so SKILL.md / contract files in `interf-default` open correctly)
|
|
806
1070
|
const allowedRoots = [];
|
|
807
1071
|
for (const stored of listStoredPreparations()) {
|
|
808
1072
|
allowedRoots.push(stored.prepDataDir);
|
|
809
1073
|
if (stored.source.locator)
|
|
810
1074
|
allowedRoots.push(stored.source.locator);
|
|
811
1075
|
}
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
return true;
|
|
815
|
-
}
|
|
1076
|
+
allowedRoots.push(userMethodsRoot());
|
|
1077
|
+
allowedRoots.push(packageRoot()); // covers <pkg>/builtin-methods/...
|
|
816
1078
|
const openedPath = await openLocalPath(allowedRoots, body.path);
|
|
817
1079
|
sendJson(res, 202, { opened: true, path: openedPath });
|
|
818
1080
|
return true;
|
|
@@ -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,8 @@
|
|
|
1
1
|
import type { MethodExecutor } from "../agents/lib/executors.js";
|
|
2
|
-
import type { SourcePreparationConfig } from "
|
|
2
|
+
import type { SourcePreparationConfig } from "../../project/lib/schema.js";
|
|
3
3
|
import { type TestTargetCandidate, type TestTargetResult } from "./test.js";
|
|
4
4
|
import type { TestSandboxRetentionMode } from "./test-sandbox.js";
|
|
5
|
-
import { type ReadinessCheckRun
|
|
5
|
+
import { type ReadinessCheckRun } from "./lib/schema.js";
|
|
6
6
|
export interface SavedReadinessCheckOutcome {
|
|
7
7
|
runPath: string;
|
|
8
8
|
displayRunPath?: string;
|
|
@@ -13,7 +13,10 @@ export interface ReadinessCheckRunResult {
|
|
|
13
13
|
sourcePath: string;
|
|
14
14
|
preparationConfig: SourcePreparationConfig;
|
|
15
15
|
portableContextPath: string | null;
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* 0.15 — `sourceFilesOutcome` is always `null`. Kept on the type so
|
|
18
|
+
* older readers parse cleanly during the rollout; remove in 0.16+.
|
|
19
|
+
*/
|
|
17
20
|
sourceFilesOutcome: SavedReadinessCheckOutcome | null;
|
|
18
21
|
compiledOutcome: SavedReadinessCheckOutcome | null;
|
|
19
22
|
readinessRunPath: string | null;
|
|
@@ -36,17 +39,8 @@ export declare function saveReadinessCheckRun(options: {
|
|
|
36
39
|
portableContextPath: string | null;
|
|
37
40
|
preparationName: string;
|
|
38
41
|
checksFingerprint: string;
|
|
39
|
-
mode: TestRunMode;
|
|
40
|
-
sourceFilesOutcome: SavedReadinessCheckOutcome | null;
|
|
41
42
|
compiledOutcome: SavedReadinessCheckOutcome | null;
|
|
42
43
|
}): string;
|
|
43
|
-
export declare function runSavedSourceFilesCheck(options: {
|
|
44
|
-
sourcePath: string;
|
|
45
|
-
preparationConfig: SourcePreparationConfig;
|
|
46
|
-
executor?: MethodExecutor | null;
|
|
47
|
-
preserveSandboxes?: TestSandboxRetentionMode;
|
|
48
|
-
runSuffix?: string | null;
|
|
49
|
-
}): Promise<SavedReadinessCheckOutcome | null>;
|
|
50
44
|
export declare function runSavedPortableContextCheck(options: {
|
|
51
45
|
sourcePath: string;
|
|
52
46
|
preparationConfig: SourcePreparationConfig;
|
|
@@ -59,7 +53,6 @@ export declare function runReadinessChecksForExecutor(options: {
|
|
|
59
53
|
sourcePath: string;
|
|
60
54
|
preparationConfig: SourcePreparationConfig;
|
|
61
55
|
portableContextPath: string | null;
|
|
62
|
-
mode: TestRunMode;
|
|
63
56
|
executor?: MethodExecutor | null;
|
|
64
57
|
preserveSandboxes?: TestSandboxRetentionMode;
|
|
65
58
|
runSuffix?: string | null;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
|
-
import { buildTestSpecFromCompiledPreparationConfig,
|
|
4
|
-
import { asPreparationDataDir, preparationLatestReadinessRunPath, preparationLatestReadinessSummaryPath, preparationTestRunPath, preparationTestRunsRoot, normalizePreparationTestRunId, preparationPortableContextPath, } from "
|
|
5
|
-
import { testRootForCompiled } from "../
|
|
6
|
-
import { readJsonFileWithSchema } from "
|
|
7
|
-
import { resolveMethodId } from "
|
|
8
|
-
import { createCompiledTestTarget,
|
|
3
|
+
import { buildTestSpecFromCompiledPreparationConfig, fingerprintReadinessChecks, } from "../../project/source-config.js";
|
|
4
|
+
import { asPreparationDataDir, preparationLatestReadinessRunPath, preparationLatestReadinessSummaryPath, preparationTestRunPath, preparationTestRunsRoot, normalizePreparationTestRunId, preparationPortableContextPath, } from "../../contracts/lib/preparation-paths.js";
|
|
5
|
+
import { testRootForCompiled } from "../compile/compiled-paths.js";
|
|
6
|
+
import { readJsonFileWithSchema } from "../../contracts/utils/parse.js";
|
|
7
|
+
import { resolveMethodId } from "../../methods/method-resolution.js";
|
|
8
|
+
import { createCompiledTestTarget, runTargetTestsAuto, saveTargetTestRun, } from "./test.js";
|
|
9
9
|
import { ReadinessCheckRunSchema, } from "./lib/schema.js";
|
|
10
10
|
export function readinessPassRate(outcome) {
|
|
11
11
|
return outcome.result.totalCases > 0
|
|
@@ -82,20 +82,9 @@ export function readCurrentSavedReadinessCheckRun(options) {
|
|
|
82
82
|
}
|
|
83
83
|
export function saveReadinessCheckRun(options) {
|
|
84
84
|
const generatedAt = new Date().toISOString();
|
|
85
|
-
const sourceFilesSummary = options.sourceFilesOutcome
|
|
86
|
-
? summarizeSavedTestOutcome("Source files", options.sourceFilesOutcome)
|
|
87
|
-
: null;
|
|
88
85
|
const compiledSummary = options.compiledOutcome
|
|
89
86
|
? summarizeSavedTestOutcome("Portable Context", options.compiledOutcome)
|
|
90
87
|
: null;
|
|
91
|
-
const effectiveMode = sourceFilesSummary && compiledSummary
|
|
92
|
-
? "both"
|
|
93
|
-
: sourceFilesSummary
|
|
94
|
-
? "source-files"
|
|
95
|
-
: "compiled";
|
|
96
|
-
const sourceFilesPassRate = sourceFilesSummary
|
|
97
|
-
? Math.round((sourceFilesSummary.passed_cases / sourceFilesSummary.total_cases) * 100)
|
|
98
|
-
: null;
|
|
99
88
|
const compiledPassRate = compiledSummary
|
|
100
89
|
? Math.round((compiledSummary.passed_cases / compiledSummary.total_cases) * 100)
|
|
101
90
|
: null;
|
|
@@ -103,17 +92,20 @@ export function saveReadinessCheckRun(options) {
|
|
|
103
92
|
kind: "interf-readiness-check-run",
|
|
104
93
|
version: 1,
|
|
105
94
|
generated_at: generatedAt,
|
|
106
|
-
mode
|
|
95
|
+
// 0.15 — verify always runs in compiled-only mode. We keep the
|
|
96
|
+
// `mode: "compiled"` literal in the saved payload so existing
|
|
97
|
+
// dashboards / consumers that expect the field still parse.
|
|
98
|
+
mode: "compiled",
|
|
107
99
|
source_path: options.sourcePath,
|
|
108
100
|
checks_fingerprint: options.checksFingerprint,
|
|
109
101
|
preparation: {
|
|
110
102
|
name: options.preparationName,
|
|
111
103
|
portable_context_path: options.portableContextPath,
|
|
112
104
|
},
|
|
113
|
-
source_files:
|
|
105
|
+
source_files: null,
|
|
114
106
|
compiled: compiledSummary,
|
|
115
107
|
summary: {
|
|
116
|
-
source_files_pass_rate:
|
|
108
|
+
source_files_pass_rate: null,
|
|
117
109
|
portable_context_pass_rate: compiledPassRate,
|
|
118
110
|
},
|
|
119
111
|
};
|
|
@@ -127,40 +119,6 @@ export function saveReadinessCheckRun(options) {
|
|
|
127
119
|
}
|
|
128
120
|
return latestStatePath;
|
|
129
121
|
}
|
|
130
|
-
export async function runSavedSourceFilesCheck(options) {
|
|
131
|
-
const spec = buildTestSpecFromSourceFolderConfig({
|
|
132
|
-
prepDataDir: options.sourcePath,
|
|
133
|
-
targetName: options.preparationConfig.name,
|
|
134
|
-
targetType: "source-files",
|
|
135
|
-
});
|
|
136
|
-
if (!spec)
|
|
137
|
-
return null;
|
|
138
|
-
const sourceFolderPath = resolveSourcePreparationPath(options.sourcePath, options.preparationConfig);
|
|
139
|
-
const target = createSourceFilesTestTarget(sourceFolderPath);
|
|
140
|
-
const artifactRoot = preparationLatestReadinessRunPath(asPreparationDataDir(options.sourcePath), options.preparationConfig.name);
|
|
141
|
-
const run = await runTargetTestsAuto(sourceFolderPath, spec, [target], {
|
|
142
|
-
executor: options.executor,
|
|
143
|
-
preserveSandboxes: options.preserveSandboxes ?? "on-failure",
|
|
144
|
-
artifactRootPath: dirname(artifactRoot),
|
|
145
|
-
});
|
|
146
|
-
const result = run.results[0];
|
|
147
|
-
if (!result)
|
|
148
|
-
return null;
|
|
149
|
-
const preparationRunPath = writePreparationTargetRun({
|
|
150
|
-
prepDataDir: options.sourcePath,
|
|
151
|
-
preparationName: options.preparationConfig.name,
|
|
152
|
-
target: "source-files",
|
|
153
|
-
generatedAt: run.generated_at,
|
|
154
|
-
runId: normalizePreparationTestRunId(spec.id),
|
|
155
|
-
runSuffix: options.runSuffix,
|
|
156
|
-
payload: run,
|
|
157
|
-
});
|
|
158
|
-
return {
|
|
159
|
-
runPath: preparationRunPath,
|
|
160
|
-
target,
|
|
161
|
-
result,
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
122
|
export async function runSavedPortableContextCheck(options) {
|
|
165
123
|
const portableContextPath = options.portableContextPath
|
|
166
124
|
?? portableContextPathForPreparation(options.sourcePath, options.preparationConfig.name);
|
|
@@ -199,29 +157,18 @@ export async function runSavedPortableContextCheck(options) {
|
|
|
199
157
|
};
|
|
200
158
|
}
|
|
201
159
|
export async function runReadinessChecksForExecutor(options) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
:
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
preparationConfig: options.preparationConfig,
|
|
215
|
-
executor: options.executor,
|
|
216
|
-
portableContextPath: options.portableContextPath,
|
|
217
|
-
preserveSandboxes: options.preserveSandboxes,
|
|
218
|
-
runSuffix: options.runSuffix,
|
|
219
|
-
})
|
|
220
|
-
: Promise.resolve(null);
|
|
221
|
-
const [sourceFilesOutcome, compiledOutcome] = await Promise.all([sourceFilesPromise, compiledPromise]);
|
|
222
|
-
const modeSatisfied = (options.mode !== "source-files" || Boolean(sourceFilesOutcome)) &&
|
|
223
|
-
(options.mode !== "compiled" || Boolean(compiledOutcome)) &&
|
|
224
|
-
(options.mode !== "both" || (Boolean(sourceFilesOutcome) && Boolean(compiledOutcome)));
|
|
160
|
+
// 0.15 — verify runs always judge against the compiled portable
|
|
161
|
+
// context. The legacy `source-files` and `both` modes were retired
|
|
162
|
+
// in 0.13.1 and removed from the wire shape here.
|
|
163
|
+
const compiledOutcome = await runSavedPortableContextCheck({
|
|
164
|
+
sourcePath: options.sourcePath,
|
|
165
|
+
preparationConfig: options.preparationConfig,
|
|
166
|
+
executor: options.executor,
|
|
167
|
+
portableContextPath: options.portableContextPath,
|
|
168
|
+
preserveSandboxes: options.preserveSandboxes,
|
|
169
|
+
runSuffix: options.runSuffix,
|
|
170
|
+
});
|
|
171
|
+
const modeSatisfied = Boolean(compiledOutcome);
|
|
225
172
|
const shouldSave = options.saveLatest !== false;
|
|
226
173
|
const readinessRunPath = shouldSave && modeSatisfied
|
|
227
174
|
? saveReadinessCheckRun({
|
|
@@ -229,8 +176,6 @@ export async function runReadinessChecksForExecutor(options) {
|
|
|
229
176
|
portableContextPath: options.portableContextPath,
|
|
230
177
|
preparationName: options.preparationConfig.name,
|
|
231
178
|
checksFingerprint: fingerprintReadinessChecks(options.preparationConfig.checks),
|
|
232
|
-
mode: options.mode,
|
|
233
|
-
sourceFilesOutcome,
|
|
234
179
|
compiledOutcome,
|
|
235
180
|
})
|
|
236
181
|
: null;
|
|
@@ -241,8 +186,7 @@ export async function runReadinessChecksForExecutor(options) {
|
|
|
241
186
|
sourcePath: options.sourcePath,
|
|
242
187
|
preparationConfig: options.preparationConfig,
|
|
243
188
|
portableContextPath: options.portableContextPath,
|
|
244
|
-
|
|
245
|
-
sourceFilesOutcome,
|
|
189
|
+
sourceFilesOutcome: null,
|
|
246
190
|
compiledOutcome,
|
|
247
191
|
readinessRunPath,
|
|
248
192
|
readinessRun,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { basename, dirname, join } from "node:path";
|
|
3
|
-
import { targetTestRunsRootForCompiled, targetTestSandboxesRootForCompiled, compiledInterfConfigPath, } from "../
|
|
4
|
-
import { asPreparationDataDir, preparationTestsSpecsRoot, } from "
|
|
3
|
+
import { targetTestRunsRootForCompiled, targetTestSandboxesRootForCompiled, compiledInterfConfigPath, } from "../compile/compiled-paths.js";
|
|
4
|
+
import { asPreparationDataDir, preparationTestsSpecsRoot, } from "../../contracts/lib/preparation-paths.js";
|
|
5
5
|
const TEST_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,79}$/;
|
|
6
6
|
export const TEST_SPEC_EXTENSIONS = new Set([".json"]);
|
|
7
7
|
export function testSpecRootPath(sourcePath) {
|