@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
|
@@ -15,8 +15,8 @@ import { existsSync, statSync } from "node:fs";
|
|
|
15
15
|
import { homedir } from "node:os";
|
|
16
16
|
import { basename, resolve } from "node:path";
|
|
17
17
|
import { spawn } from "node:child_process";
|
|
18
|
-
import {
|
|
19
|
-
import { LOCAL_SERVICE_DEFAULT_HOST, LOCAL_SERVICE_DEFAULT_PORT } from "../../packages/
|
|
18
|
+
import { readActiveConnection, writeConnection, } from "../../packages/engine/connection-config.js";
|
|
19
|
+
import { LOCAL_SERVICE_DEFAULT_HOST, LOCAL_SERVICE_DEFAULT_PORT } from "../../packages/engine/routes.js";
|
|
20
20
|
async function callJson(url, token) {
|
|
21
21
|
const headers = new Headers();
|
|
22
22
|
if (token)
|
|
@@ -61,12 +61,25 @@ async function probeHealth(url) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
64
|
+
* Connect to an engine. Either an existing one already running on the
|
|
65
|
+
* default port (with a `wasAlreadyRunning` flag so the caller can tell
|
|
66
|
+
* the user honestly) or a fresh one we spawn here.
|
|
67
|
+
*
|
|
68
|
+
* Returns null on timeout / error.
|
|
68
69
|
*/
|
|
69
70
|
async function startLocalEngineInBackground() {
|
|
71
|
+
// First: check whether an engine is ALREADY running on the default
|
|
72
|
+
// port. If so, don't pretend to start a new one — just connect.
|
|
73
|
+
if (await probeHealth(DEFAULT_ENGINE_URL)) {
|
|
74
|
+
try {
|
|
75
|
+
writeConnection({ url: DEFAULT_ENGINE_URL, auth_token: null });
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
// best effort
|
|
79
|
+
}
|
|
80
|
+
console.log(chalk.dim(` Engine already running at ${DEFAULT_ENGINE_URL} — connecting.`));
|
|
81
|
+
return { url: DEFAULT_ENGINE_URL, token: null, wasAlreadyRunning: true };
|
|
82
|
+
}
|
|
70
83
|
const spinner = p.spinner();
|
|
71
84
|
spinner.start("Starting local Interf engine…");
|
|
72
85
|
const child = spawn(process.argv[1] ?? "interf", ["web"], {
|
|
@@ -78,105 +91,47 @@ async function startLocalEngineInBackground() {
|
|
|
78
91
|
const timeoutMs = 30_000;
|
|
79
92
|
while (Date.now() - startedAt < timeoutMs) {
|
|
80
93
|
await new Promise((r) => setTimeout(r, 250));
|
|
81
|
-
// Path A: connection.json written by 0.13 server.
|
|
94
|
+
// Path A: connection.json written by the spawned 0.13+ server.
|
|
82
95
|
const conn = readActiveConnection();
|
|
83
96
|
if (conn) {
|
|
84
97
|
const url = conn.url.replace(/\/+$/, "");
|
|
85
98
|
if (await probeHealth(url)) {
|
|
86
99
|
spinner.stop(chalk.green(`Engine ready at ${url}`));
|
|
87
|
-
return { url, token: conn.auth_token };
|
|
100
|
+
return { url, token: conn.auth_token, wasAlreadyRunning: false };
|
|
88
101
|
}
|
|
89
102
|
}
|
|
90
|
-
// Path B:
|
|
91
|
-
// engine version, including older `interf` binaries that don't
|
|
92
|
-
// write connection.json.
|
|
103
|
+
// Path B: spawned engine is ready on the default URL.
|
|
93
104
|
if (await probeHealth(DEFAULT_ENGINE_URL)) {
|
|
94
|
-
// Recover the connection record so subsequent commands work.
|
|
95
105
|
try {
|
|
96
106
|
writeConnection({ url: DEFAULT_ENGINE_URL, auth_token: null });
|
|
97
107
|
}
|
|
98
108
|
catch {
|
|
99
|
-
// best effort
|
|
109
|
+
// best effort
|
|
100
110
|
}
|
|
101
111
|
spinner.stop(chalk.green(`Engine ready at ${DEFAULT_ENGINE_URL}`));
|
|
102
|
-
return { url: DEFAULT_ENGINE_URL, token: null };
|
|
112
|
+
return { url: DEFAULT_ENGINE_URL, token: null, wasAlreadyRunning: false };
|
|
103
113
|
}
|
|
104
114
|
}
|
|
105
115
|
spinner.stop(chalk.red("Timed out waiting for engine to start."));
|
|
106
116
|
return null;
|
|
107
117
|
}
|
|
108
|
-
/**
|
|
109
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Print the canonical connect-or-error hint and exit non-zero. Used
|
|
120
|
+
* whenever the wizard needs an engine but no reachable connection
|
|
121
|
+
* exists. The wizard does NOT auto-start an engine — `interf web` is
|
|
122
|
+
* the explicit, foreground way to run one.
|
|
123
|
+
*/
|
|
124
|
+
function exitNoEngineConnected(reason) {
|
|
110
125
|
console.log();
|
|
111
|
-
console.log(chalk.yellow(
|
|
126
|
+
console.log(chalk.yellow(` ${reason}`));
|
|
112
127
|
console.log();
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
});
|
|
121
|
-
if (p.isCancel(choice) || choice === "quit") {
|
|
122
|
-
p.outro("Bye.");
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
if (choice === "start") {
|
|
126
|
-
const started = await startLocalEngineInBackground();
|
|
127
|
-
if (started)
|
|
128
|
-
return started;
|
|
129
|
-
// Fall through to retry / custom URL fallback.
|
|
130
|
-
const retry = await p.select({
|
|
131
|
-
message: "Engine didn't come up. What now?",
|
|
132
|
-
options: [
|
|
133
|
-
{ value: "probe", label: `Try connecting to ${DEFAULT_ENGINE_URL} (maybe an older engine is already running)` },
|
|
134
|
-
{ value: "remote", label: "Connect to a different URL" },
|
|
135
|
-
{ value: "quit", label: "Quit" },
|
|
136
|
-
],
|
|
137
|
-
});
|
|
138
|
-
if (p.isCancel(retry) || retry === "quit")
|
|
139
|
-
return null;
|
|
140
|
-
if (retry === "probe") {
|
|
141
|
-
if (await probeHealth(DEFAULT_ENGINE_URL)) {
|
|
142
|
-
try {
|
|
143
|
-
writeConnection({ url: DEFAULT_ENGINE_URL, auth_token: null });
|
|
144
|
-
}
|
|
145
|
-
catch { /* best effort */ }
|
|
146
|
-
return { url: DEFAULT_ENGINE_URL, token: null };
|
|
147
|
-
}
|
|
148
|
-
console.log(chalk.red(` No engine reachable at ${DEFAULT_ENGINE_URL}.`));
|
|
149
|
-
return null;
|
|
150
|
-
}
|
|
151
|
-
// retry === "remote" falls through to the remote-URL block below
|
|
152
|
-
}
|
|
153
|
-
if (choice === "remote" || choice === "start") {
|
|
154
|
-
const remoteUrl = await p.text({
|
|
155
|
-
message: "Remote engine URL",
|
|
156
|
-
placeholder: "https://your-instance.example.com",
|
|
157
|
-
validate: (v) => (v.startsWith("http://") || v.startsWith("https://") ? undefined : "Must start with http:// or https://"),
|
|
158
|
-
});
|
|
159
|
-
if (p.isCancel(remoteUrl))
|
|
160
|
-
return null;
|
|
161
|
-
const remoteToken = await p.password({
|
|
162
|
-
message: "Bearer token (leave blank if none)",
|
|
163
|
-
});
|
|
164
|
-
if (p.isCancel(remoteToken))
|
|
165
|
-
return null;
|
|
166
|
-
const exitCode = await spawnInterf([
|
|
167
|
-
"login",
|
|
168
|
-
"--url",
|
|
169
|
-
String(remoteUrl),
|
|
170
|
-
...(remoteToken ? ["--token", String(remoteToken)] : []),
|
|
171
|
-
]);
|
|
172
|
-
if (exitCode !== 0)
|
|
173
|
-
return null;
|
|
174
|
-
const conn = readActiveConnection();
|
|
175
|
-
if (!conn)
|
|
176
|
-
return null;
|
|
177
|
-
return { url: conn.url.replace(/\/+$/, ""), token: conn.auth_token };
|
|
178
|
-
}
|
|
179
|
-
return null;
|
|
128
|
+
console.log(" Start one in another terminal:");
|
|
129
|
+
console.log(chalk.bold(" interf web"));
|
|
130
|
+
console.log();
|
|
131
|
+
console.log(" Or connect to a remote engine:");
|
|
132
|
+
console.log(chalk.bold(" interf login --url <https://…>"));
|
|
133
|
+
console.log();
|
|
134
|
+
process.exit(1);
|
|
180
135
|
}
|
|
181
136
|
/** Validate that a path exists and is a directory. */
|
|
182
137
|
function validateSourcePath(value) {
|
|
@@ -242,25 +197,40 @@ async function flowCreatePreparation(conn) {
|
|
|
242
197
|
});
|
|
243
198
|
if (p.isCancel(prepId))
|
|
244
199
|
return null;
|
|
200
|
+
const about = await p.text({
|
|
201
|
+
message: "What is this preparation for? (one line — the agent task intent)",
|
|
202
|
+
placeholder: "Prepare these notes so an agent can answer questions about them.",
|
|
203
|
+
});
|
|
204
|
+
if (p.isCancel(about))
|
|
205
|
+
return null;
|
|
206
|
+
const aboutText = String(about ?? "").trim();
|
|
245
207
|
const sourcePath = await promptSourcePath();
|
|
246
208
|
if (!sourcePath)
|
|
247
209
|
return null;
|
|
248
|
-
// Offer the methods that the connected instance knows about.
|
|
210
|
+
// Offer the methods that the connected instance knows about. Method
|
|
211
|
+
// binding is OPTIONAL at create time — the agent first creates the
|
|
212
|
+
// preparation (the unit of agent work) and may pick or draft a method
|
|
213
|
+
// for it later.
|
|
249
214
|
const methodsResp = await callJson(`${conn.url}/v1/methods`, conn.token);
|
|
250
215
|
const methods = methodsResp.body?.methods ?? [];
|
|
251
216
|
const methodOptions = methods
|
|
252
217
|
.map((m) => ({ value: m.method_id ?? m.id ?? "", label: `${m.method_id ?? m.id ?? "(?)"}${m.label ? ` — ${m.label}` : ""}` }))
|
|
253
218
|
.filter((opt) => opt.value !== "");
|
|
254
|
-
let methodId;
|
|
219
|
+
let methodId = null;
|
|
220
|
+
const skipOption = { value: "__skip__", label: chalk.dim("Skip — pick or draft a method later") };
|
|
221
|
+
const customOption = { value: "__custom__", label: "Other (type a method id)" };
|
|
255
222
|
if (methodOptions.length > 0) {
|
|
256
223
|
const chosen = await p.select({
|
|
257
|
-
message: "
|
|
258
|
-
options: [...methodOptions,
|
|
224
|
+
message: "Pick a method (optional — you can do this later)",
|
|
225
|
+
options: [...methodOptions, customOption, skipOption],
|
|
259
226
|
initialValue: methodOptions.find((o) => o.value === "interf-default")?.value ?? methodOptions[0]?.value,
|
|
260
227
|
});
|
|
261
228
|
if (p.isCancel(chosen))
|
|
262
229
|
return null;
|
|
263
|
-
if (chosen === "
|
|
230
|
+
if (chosen === "__skip__") {
|
|
231
|
+
methodId = null;
|
|
232
|
+
}
|
|
233
|
+
else if (chosen === "__custom__") {
|
|
264
234
|
const typed = await p.text({
|
|
265
235
|
message: "Method id",
|
|
266
236
|
placeholder: "interf-default",
|
|
@@ -274,13 +244,24 @@ async function flowCreatePreparation(conn) {
|
|
|
274
244
|
}
|
|
275
245
|
}
|
|
276
246
|
else {
|
|
277
|
-
const
|
|
278
|
-
message: "
|
|
279
|
-
|
|
247
|
+
const choose = await p.select({
|
|
248
|
+
message: "No methods registered yet — pick a method id?",
|
|
249
|
+
options: [
|
|
250
|
+
{ value: "__type__", label: "Type a method id" },
|
|
251
|
+
skipOption,
|
|
252
|
+
],
|
|
280
253
|
});
|
|
281
|
-
if (p.isCancel(
|
|
254
|
+
if (p.isCancel(choose))
|
|
282
255
|
return null;
|
|
283
|
-
|
|
256
|
+
if (choose === "__type__") {
|
|
257
|
+
const typed = await p.text({
|
|
258
|
+
message: "Method id",
|
|
259
|
+
initialValue: "interf-default",
|
|
260
|
+
});
|
|
261
|
+
if (p.isCancel(typed))
|
|
262
|
+
return null;
|
|
263
|
+
methodId = String(typed);
|
|
264
|
+
}
|
|
284
265
|
}
|
|
285
266
|
const exitCode = await spawnInterf([
|
|
286
267
|
"prep",
|
|
@@ -288,8 +269,8 @@ async function flowCreatePreparation(conn) {
|
|
|
288
269
|
String(prepId),
|
|
289
270
|
"--source",
|
|
290
271
|
resolve(String(sourcePath)),
|
|
291
|
-
"--method",
|
|
292
|
-
|
|
272
|
+
...(methodId ? ["--method", methodId] : []),
|
|
273
|
+
...(aboutText ? ["--about", aboutText] : []),
|
|
293
274
|
]);
|
|
294
275
|
if (exitCode !== 0)
|
|
295
276
|
return null;
|
|
@@ -313,15 +294,22 @@ async function pickPreparation(conn, message) {
|
|
|
313
294
|
return null;
|
|
314
295
|
return String(choice);
|
|
315
296
|
}
|
|
316
|
-
async function showActionMenu(conn) {
|
|
297
|
+
async function showActionMenu(conn, options = { allowCompileVerify: true }) {
|
|
298
|
+
const compileLabel = options.allowCompileVerify
|
|
299
|
+
? "Compile a preparation"
|
|
300
|
+
: chalk.dim("Compile a preparation (no agents available)");
|
|
301
|
+
const verifyLabel = options.allowCompileVerify
|
|
302
|
+
? "Verify a preparation's claim-checks"
|
|
303
|
+
: chalk.dim("Verify (no agents available)");
|
|
317
304
|
const action = await p.select({
|
|
318
305
|
message: "What do you want to do?",
|
|
319
306
|
options: [
|
|
307
|
+
{ value: "ui", label: "Open Compiler UI" },
|
|
320
308
|
{ value: "ls", label: "List preparations" },
|
|
321
309
|
{ value: "create", label: "Create a new preparation" },
|
|
322
|
-
{ value: "
|
|
323
|
-
{ value: "
|
|
324
|
-
{ value: "
|
|
310
|
+
{ value: "agents", label: "Manage agents (list / register / role-map)" },
|
|
311
|
+
{ value: "compile", label: compileLabel },
|
|
312
|
+
{ value: "verify", label: verifyLabel },
|
|
325
313
|
{ value: "stop", label: "Stop the local engine" },
|
|
326
314
|
{ value: "quit", label: "Quit" },
|
|
327
315
|
],
|
|
@@ -332,26 +320,47 @@ async function showActionMenu(conn) {
|
|
|
332
320
|
await spawnInterf(["prep", "ls"]);
|
|
333
321
|
return "continue";
|
|
334
322
|
}
|
|
323
|
+
if (action === "agents") {
|
|
324
|
+
await spawnInterf(["agents", "ls"]);
|
|
325
|
+
return "continue";
|
|
326
|
+
}
|
|
335
327
|
if (action === "create") {
|
|
336
328
|
const newId = await flowCreatePreparation(conn);
|
|
337
329
|
if (newId) {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
330
|
+
if (!options.allowCompileVerify) {
|
|
331
|
+
console.log(chalk.dim(" Skipping compile prompt — no agents available. Install one then run `interf compile " +
|
|
332
|
+
newId +
|
|
333
|
+
"`."));
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
const compileNow = await p.confirm({ message: `Compile ${newId} now?`, initialValue: true });
|
|
337
|
+
if (!p.isCancel(compileNow) && compileNow) {
|
|
338
|
+
await spawnInterf(["compile", newId]);
|
|
339
|
+
}
|
|
341
340
|
}
|
|
342
341
|
}
|
|
343
342
|
return "continue";
|
|
344
343
|
}
|
|
345
344
|
if (action === "compile") {
|
|
345
|
+
if (!options.allowCompileVerify) {
|
|
346
|
+
console.log(chalk.yellow(" Cannot compile — no agents available."));
|
|
347
|
+
console.log(" Install Claude Code, Codex, Gemini, or another agent CLI, or");
|
|
348
|
+
console.log(" register a custom CLI: `interf agents register <name> --command <cmd>`.");
|
|
349
|
+
return "continue";
|
|
350
|
+
}
|
|
346
351
|
const id = await pickPreparation(conn, "Which preparation to compile?");
|
|
347
352
|
if (id)
|
|
348
353
|
await spawnInterf(["compile", id]);
|
|
349
354
|
return "continue";
|
|
350
355
|
}
|
|
351
|
-
if (action === "
|
|
352
|
-
|
|
356
|
+
if (action === "verify") {
|
|
357
|
+
if (!options.allowCompileVerify) {
|
|
358
|
+
console.log(chalk.yellow(" Cannot verify — no agents available."));
|
|
359
|
+
return "continue";
|
|
360
|
+
}
|
|
361
|
+
const id = await pickPreparation(conn, "Which preparation to verify?");
|
|
353
362
|
if (id)
|
|
354
|
-
await spawnInterf(["
|
|
363
|
+
await spawnInterf(["verify", id]);
|
|
355
364
|
return "continue";
|
|
356
365
|
}
|
|
357
366
|
if (action === "ui") {
|
|
@@ -382,42 +391,280 @@ async function showActionMenu(conn) {
|
|
|
382
391
|
}
|
|
383
392
|
return "continue";
|
|
384
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* Agent install-cards menu shown when the connected engine has zero
|
|
396
|
+
* detected + registered agents. Returns:
|
|
397
|
+
* - "rerun" → user installed an agent and wants to retry detection
|
|
398
|
+
* - "skip" → continue in UI-only mode (no compile/verify)
|
|
399
|
+
* - "quit" → exit
|
|
400
|
+
*/
|
|
401
|
+
async function showAgentInstallCards() {
|
|
402
|
+
console.log();
|
|
403
|
+
console.log(chalk.yellow(" No agents detected."));
|
|
404
|
+
console.log();
|
|
405
|
+
console.log(" Interf needs at least one agent to compile and verify preparations.");
|
|
406
|
+
console.log();
|
|
407
|
+
const choice = await p.select({
|
|
408
|
+
message: "How do you want to proceed?",
|
|
409
|
+
options: [
|
|
410
|
+
{
|
|
411
|
+
value: "claude-code",
|
|
412
|
+
label: `Install Claude Code ${chalk.dim("(opens install docs)")}`,
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
value: "codex",
|
|
416
|
+
label: `Install OpenAI Codex ${chalk.dim("(opens install docs)")}`,
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
value: "gemini",
|
|
420
|
+
label: `Install Gemini CLI ${chalk.dim("(opens install docs)")}`,
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
value: "custom",
|
|
424
|
+
label: "Register a custom CLI as an agent",
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
value: "skip",
|
|
428
|
+
label: chalk.dim("Skip — UI-only mode (browse existing portable contexts only)"),
|
|
429
|
+
},
|
|
430
|
+
{ value: "quit", label: chalk.dim("Quit") },
|
|
431
|
+
],
|
|
432
|
+
});
|
|
433
|
+
if (p.isCancel(choice) || choice === "quit")
|
|
434
|
+
return "quit";
|
|
435
|
+
if (choice === "skip")
|
|
436
|
+
return "skip";
|
|
437
|
+
if (choice === "custom") {
|
|
438
|
+
const name = await p.text({
|
|
439
|
+
message: "Agent name (lowercase identifier)",
|
|
440
|
+
placeholder: "opencode",
|
|
441
|
+
validate: (value) => /^[a-z0-9][a-z0-9-]*$/.test(value)
|
|
442
|
+
? undefined
|
|
443
|
+
: "Lowercase letters, numbers, and dashes only.",
|
|
444
|
+
});
|
|
445
|
+
if (p.isCancel(name))
|
|
446
|
+
return "quit";
|
|
447
|
+
const command = await p.text({
|
|
448
|
+
message: "Command to invoke",
|
|
449
|
+
placeholder: "opencode --prompt",
|
|
450
|
+
});
|
|
451
|
+
if (p.isCancel(command))
|
|
452
|
+
return "quit";
|
|
453
|
+
const displayName = await p.text({
|
|
454
|
+
message: `Display name (defaults to "${name}")`,
|
|
455
|
+
placeholder: String(name),
|
|
456
|
+
});
|
|
457
|
+
if (p.isCancel(displayName))
|
|
458
|
+
return "quit";
|
|
459
|
+
const cliDisplayName = String(displayName).trim() || String(name);
|
|
460
|
+
const exitCode = await spawnInterf([
|
|
461
|
+
"agents",
|
|
462
|
+
"register",
|
|
463
|
+
String(name),
|
|
464
|
+
"--command",
|
|
465
|
+
String(command),
|
|
466
|
+
"--display-name",
|
|
467
|
+
cliDisplayName,
|
|
468
|
+
]);
|
|
469
|
+
return exitCode === 0 ? "rerun" : "quit";
|
|
470
|
+
}
|
|
471
|
+
// Print install instructions + offer to copy the install command.
|
|
472
|
+
const installCommands = {
|
|
473
|
+
"claude-code": {
|
|
474
|
+
command: "npm install -g @anthropic-ai/claude-code",
|
|
475
|
+
docs: "https://docs.claude.com/claude-code",
|
|
476
|
+
},
|
|
477
|
+
codex: {
|
|
478
|
+
command: "npm install -g @openai/codex",
|
|
479
|
+
docs: "https://github.com/openai/codex",
|
|
480
|
+
},
|
|
481
|
+
gemini: {
|
|
482
|
+
command: "npm install -g @google/gemini-cli",
|
|
483
|
+
docs: "https://github.com/google-gemini/gemini-cli",
|
|
484
|
+
},
|
|
485
|
+
};
|
|
486
|
+
const target = installCommands[String(choice)];
|
|
487
|
+
if (target) {
|
|
488
|
+
console.log();
|
|
489
|
+
console.log(` Install command: ${chalk.bold(target.command)}`);
|
|
490
|
+
console.log(` Docs: ${chalk.dim(target.docs)}`);
|
|
491
|
+
console.log();
|
|
492
|
+
const next = await p.select({
|
|
493
|
+
message: "What now?",
|
|
494
|
+
options: [
|
|
495
|
+
{ value: "rerun", label: "I installed it — re-detect" },
|
|
496
|
+
{ value: "skip", label: chalk.dim("Skip — continue in UI-only mode") },
|
|
497
|
+
{ value: "quit", label: chalk.dim("Quit") },
|
|
498
|
+
],
|
|
499
|
+
});
|
|
500
|
+
if (p.isCancel(next) || next === "quit")
|
|
501
|
+
return "quit";
|
|
502
|
+
if (next === "skip")
|
|
503
|
+
return "skip";
|
|
504
|
+
return "rerun";
|
|
505
|
+
}
|
|
506
|
+
return "rerun";
|
|
507
|
+
}
|
|
508
|
+
async function fetchAgentSnapshot(conn) {
|
|
509
|
+
const instance = await callJson(`${conn.url}/v1/instance`, conn.token);
|
|
510
|
+
const agentsResponse = await callJson(`${conn.url}/v1/agents`, conn.token);
|
|
511
|
+
if (instance.status !== 200)
|
|
512
|
+
return null;
|
|
513
|
+
// Engines pre-0.15 don't expose /v1/agents. Surface the gap explicitly
|
|
514
|
+
// so the wizard can tell the user to restart instead of silently going
|
|
515
|
+
// through the install-cards flow.
|
|
516
|
+
const engineSupportsAgents = agentsResponse.status === 200 && instance.body?.agent_count !== undefined;
|
|
517
|
+
return {
|
|
518
|
+
agentCount: instance.body?.agent_count ?? 0,
|
|
519
|
+
defaultAgent: instance.body?.default_agent ?? null,
|
|
520
|
+
agents: agentsResponse.body?.agents ?? [],
|
|
521
|
+
engineSupportsAgents,
|
|
522
|
+
};
|
|
523
|
+
}
|
|
385
524
|
async function runWizard(args) {
|
|
386
|
-
|
|
525
|
+
// Connect-or-error: the wizard never auto-starts an engine. If
|
|
526
|
+
// `~/.interf/connection.json` is missing or unreachable, exit
|
|
527
|
+
// non-zero and tell the user to run `interf web` (or
|
|
528
|
+
// `interf login`) explicitly. This keeps the engine lifecycle in
|
|
529
|
+
// the user's hands — no surprise background processes, no stale
|
|
530
|
+
// binaries served by a long-lived auto-spawn.
|
|
387
531
|
const initial = readActiveConnection({
|
|
388
532
|
urlOverride: args.url,
|
|
389
533
|
authTokenOverride: args.token,
|
|
390
534
|
});
|
|
391
535
|
if (!initial) {
|
|
392
|
-
|
|
393
|
-
if (!conn) {
|
|
394
|
-
console.log();
|
|
395
|
-
console.log(CONNECT_OR_ERROR_HINT);
|
|
396
|
-
process.exit(1);
|
|
397
|
-
}
|
|
536
|
+
exitNoEngineConnected("No Interf engine is connected.");
|
|
398
537
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
console.log(chalk.yellow(` Connection ${url} is unreachable.`));
|
|
404
|
-
conn = await offerEngineSetup();
|
|
405
|
-
if (!conn)
|
|
406
|
-
process.exit(1);
|
|
407
|
-
}
|
|
408
|
-
else {
|
|
409
|
-
conn = { url, token: initial.auth_token };
|
|
410
|
-
}
|
|
538
|
+
const url = initial.url.replace(/\/+$/, "");
|
|
539
|
+
const probe = await callJson(`${url}/health`, initial.auth_token);
|
|
540
|
+
if (probe.status === 0) {
|
|
541
|
+
exitNoEngineConnected(`Connection ${url} is unreachable.`);
|
|
411
542
|
}
|
|
543
|
+
let conn = { url, token: initial.auth_token };
|
|
412
544
|
const instance = await callJson(`${conn.url}/v1/instance`, conn.token);
|
|
413
545
|
console.log();
|
|
414
546
|
console.log(chalk.bold(` Connected to ${conn.url}`));
|
|
415
547
|
if (instance.body?.package_version) {
|
|
416
548
|
console.log(chalk.dim(` v${instance.body.package_version} · ${instance.body.preparation_count ?? 0} preparation(s)`));
|
|
417
549
|
}
|
|
550
|
+
// 0.15 — surface the connected agents up front. When zero are
|
|
551
|
+
// detected, run the install-cards menu before letting the user
|
|
552
|
+
// try to compile / verify.
|
|
553
|
+
let agents = await fetchAgentSnapshot(conn);
|
|
554
|
+
if (agents && !agents.engineSupportsAgents) {
|
|
555
|
+
console.log();
|
|
556
|
+
console.log(chalk.yellow(" ⚠ The connected engine is older than this CLI."));
|
|
557
|
+
console.log(chalk.dim(" /v1/agents is not available — agent management is disabled."));
|
|
558
|
+
console.log();
|
|
559
|
+
const choice = await p.select({
|
|
560
|
+
message: "Restart the engine now to pick up new features?",
|
|
561
|
+
options: [
|
|
562
|
+
{ value: "restart", label: "Yes — stop old engine, start new one" },
|
|
563
|
+
{ value: "continue", label: chalk.dim("No — continue with limited features (no agents UI / compile / verify)") },
|
|
564
|
+
{ value: "quit", label: "Quit" },
|
|
565
|
+
],
|
|
566
|
+
initialValue: "restart",
|
|
567
|
+
});
|
|
568
|
+
if (p.isCancel(choice) || choice === "quit") {
|
|
569
|
+
p.outro("Bye.");
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
if (choice === "restart") {
|
|
573
|
+
console.log();
|
|
574
|
+
console.log(chalk.dim(" Stopping old engine…"));
|
|
575
|
+
await spawnInterf(["web", "stop"]);
|
|
576
|
+
// Small grace period for the OS to release the port.
|
|
577
|
+
await new Promise((r) => setTimeout(r, 800));
|
|
578
|
+
const restarted = await startLocalEngineInBackground();
|
|
579
|
+
if (!restarted) {
|
|
580
|
+
console.log(chalk.red(" Could not start the new engine. Try manually: interf web"));
|
|
581
|
+
process.exit(1);
|
|
582
|
+
}
|
|
583
|
+
conn = restarted;
|
|
584
|
+
agents = await fetchAgentSnapshot(conn);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
// Treat "all registered agents are unavailable" the same as "no agents
|
|
588
|
+
// detected" — the install-cards menu lets the user install or register
|
|
589
|
+
// a real one before the active-agent picker runs.
|
|
590
|
+
function installedAgentCount(snapshot) {
|
|
591
|
+
if (!snapshot)
|
|
592
|
+
return 0;
|
|
593
|
+
return snapshot.agents.filter((agent) => agent.available !== false).length;
|
|
594
|
+
}
|
|
595
|
+
let allowCompileVerify = installedAgentCount(agents) > 0;
|
|
596
|
+
while (agents &&
|
|
597
|
+
agents.engineSupportsAgents &&
|
|
598
|
+
installedAgentCount(agents) === 0) {
|
|
599
|
+
const decision = await showAgentInstallCards();
|
|
600
|
+
if (decision === "quit") {
|
|
601
|
+
p.outro("Bye.");
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
if (decision === "skip") {
|
|
605
|
+
allowCompileVerify = false;
|
|
606
|
+
break;
|
|
607
|
+
}
|
|
608
|
+
// decision === "rerun"
|
|
609
|
+
agents = await fetchAgentSnapshot(conn);
|
|
610
|
+
allowCompileVerify = installedAgentCount(agents) > 0;
|
|
611
|
+
}
|
|
612
|
+
if (agents && agents.engineSupportsAgents && installedAgentCount(agents) > 0) {
|
|
613
|
+
// Always confirm the active agent before the action menu. Pre-select
|
|
614
|
+
// the current default; user presses Enter to keep it, Up/Down to
|
|
615
|
+
// change. Customizing per-stage (role-map) is opt-in advanced —
|
|
616
|
+
// accessible via `interf agents map <role> <agent>`.
|
|
617
|
+
//
|
|
618
|
+
// Custom agents whose CLI is no longer on PATH carry `available: false`
|
|
619
|
+
// — show them in a hint instead of as selectable choices so the picker
|
|
620
|
+
// does not let the user pick something the engine cannot run.
|
|
621
|
+
const stale = agents.agents.filter((agent) => agent.available === false);
|
|
622
|
+
if (stale.length > 0) {
|
|
623
|
+
const names = stale.map((agent) => agent.display_name || agent.name).join(", ");
|
|
624
|
+
console.log();
|
|
625
|
+
console.log(chalk.yellow(` ⚠ Registered but not installed: ${names}`));
|
|
626
|
+
console.log(chalk.dim(` Reinstall the CLI or run \`interf agents unregister <name>\` to remove the stale entry.`));
|
|
627
|
+
}
|
|
628
|
+
const installed = agents.agents.filter((agent) => agent.available !== false);
|
|
629
|
+
const options = installed.map((agent) => ({
|
|
630
|
+
value: agent.name,
|
|
631
|
+
label: `${agent.display_name || agent.name}${agent.name === agents.defaultAgent ? chalk.green(" (current active)") : ""}${agent.source === "user" ? chalk.dim(" [custom]") : ""}`,
|
|
632
|
+
}));
|
|
633
|
+
options.push({ value: "__register__", label: chalk.dim("Register a custom CLI as an agent…") });
|
|
634
|
+
const installedDefault = installed.some((agent) => agent.name === agents.defaultAgent)
|
|
635
|
+
? agents.defaultAgent
|
|
636
|
+
: null;
|
|
637
|
+
const choice = await p.select({
|
|
638
|
+
message: "Active agent for this session (will run every role unless overridden)",
|
|
639
|
+
options,
|
|
640
|
+
initialValue: installedDefault ?? options[0]?.value,
|
|
641
|
+
});
|
|
642
|
+
if (p.isCancel(choice)) {
|
|
643
|
+
p.outro("Bye.");
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
if (choice === "__register__") {
|
|
647
|
+
const decision = await showAgentInstallCards();
|
|
648
|
+
if (decision === "quit") {
|
|
649
|
+
p.outro("Bye.");
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
agents = await fetchAgentSnapshot(conn);
|
|
653
|
+
}
|
|
654
|
+
else if (choice !== agents.defaultAgent) {
|
|
655
|
+
// Switch active agent before proceeding. Reuse the existing CLI to
|
|
656
|
+
// sweep the role-map's `general` row + any role pinned to the
|
|
657
|
+
// previous active.
|
|
658
|
+
await spawnInterf(["agents", "use", String(choice)]);
|
|
659
|
+
agents = await fetchAgentSnapshot(conn);
|
|
660
|
+
}
|
|
661
|
+
if (agents && agents.defaultAgent) {
|
|
662
|
+
console.log(chalk.dim(` Active: ${agents.defaultAgent} · roles default to ${agents.defaultAgent}`));
|
|
663
|
+
}
|
|
664
|
+
}
|
|
418
665
|
for (;;) {
|
|
419
666
|
console.log();
|
|
420
|
-
const next = await showActionMenu(conn);
|
|
667
|
+
const next = await showActionMenu(conn, { allowCompileVerify });
|
|
421
668
|
if (next === "exit")
|
|
422
669
|
break;
|
|
423
670
|
}
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { agentsCommand } from "./commands/agents.js";
|
|
1
2
|
import { compileCommand } from "./commands/compile.js";
|
|
2
|
-
import {
|
|
3
|
+
import { verifyCommand } from "./commands/verify.js";
|
|
3
4
|
import { doctorCommand } from "./commands/doctor.js";
|
|
4
5
|
import { methodCommand } from "./commands/method.js";
|
|
6
|
+
import { mcpCommand } from "./commands/mcp.js";
|
|
5
7
|
import { runsCommand } from "./commands/runs.js";
|
|
6
8
|
import { statusCommand } from "./commands/status.js";
|
|
7
9
|
import { resetCommand } from "./commands/reset.js";
|
|
@@ -20,4 +22,4 @@ export declare function runCli(argv?: string[]): {
|
|
|
20
22
|
_: (string | number)[];
|
|
21
23
|
$0: string;
|
|
22
24
|
}>;
|
|
23
|
-
export { initCommand, compileCommand,
|
|
25
|
+
export { initCommand, compileCommand, verifyCommand, agentsCommand, doctorCommand, methodCommand, mcpCommand, runsCommand, statusCommand, resetCommand, webCommand, prepCommand, loginCommand, logoutCommand, wizardCommand, };
|