@interf/compiler 0.9.5 → 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 +135 -91
- package/TRADEMARKS.md +2 -13
- package/agent-skills/interf-actions/SKILL.md +143 -38
- package/agent-skills/interf-actions/references/cli.md +134 -67
- package/builtin-methods/interf-default/README.md +3 -4
- package/builtin-methods/interf-default/compile/stages/shape/SKILL.md +2 -2
- package/builtin-methods/interf-default/compile/stages/summarize/SKILL.md +2 -1
- package/builtin-methods/interf-default/improve/SKILL.md +1 -1
- package/builtin-methods/interf-default/method.json +10 -4
- package/builtin-methods/interf-default/method.schema.json +0 -9
- package/builtin-methods/interf-default/use/query/SKILL.md +5 -5
- package/dist/cli/commands/agents.d.ts +2 -0
- package/dist/cli/commands/agents.js +213 -0
- package/dist/cli/commands/compile.d.ts +8 -25
- package/dist/cli/commands/compile.js +83 -359
- package/dist/cli/commands/doctor.js +2 -2
- package/dist/cli/commands/login.d.ts +7 -0
- package/dist/cli/commands/login.js +39 -0
- package/dist/cli/commands/logout.d.ts +2 -0
- package/dist/cli/commands/logout.js +16 -0
- package/dist/cli/commands/mcp.d.ts +42 -0
- package/dist/cli/commands/mcp.js +239 -0
- package/dist/cli/commands/method.d.ts +2 -0
- package/dist/cli/commands/method.js +113 -0
- package/dist/cli/commands/prep.d.ts +2 -0
- package/dist/cli/commands/prep.js +152 -0
- package/dist/cli/commands/reset.d.ts +8 -1
- package/dist/cli/commands/reset.js +47 -26
- package/dist/cli/commands/runs.d.ts +2 -0
- package/dist/cli/commands/runs.js +120 -0
- package/dist/cli/commands/status.d.ts +6 -1
- package/dist/cli/commands/status.js +68 -111
- package/dist/cli/commands/verify.d.ts +7 -1
- package/dist/cli/commands/verify.js +69 -85
- package/dist/cli/commands/web.d.ts +0 -9
- package/dist/cli/commands/web.js +201 -121
- package/dist/cli/commands/wizard.d.ts +9 -0
- package/dist/cli/commands/wizard.js +689 -0
- package/dist/cli/index.d.ts +10 -7
- package/dist/cli/index.js +19 -12
- 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/{177mvn4rse235.js → 0jipmpez3_ehh.js} +16 -16
- package/dist/compiler-ui/_next/static/chunks/{18a8f2jkv3z.c.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/preparation-paths.d.ts +117 -0
- package/dist/packages/contracts/lib/preparation-paths.js +177 -0
- package/dist/packages/contracts/lib/schema.d.ts +187 -13
- package/dist/packages/contracts/lib/schema.js +148 -3
- package/dist/packages/contracts/utils/filesystem.d.ts +9 -0
- package/dist/packages/contracts/utils/filesystem.js +142 -0
- package/dist/packages/{local-service → engine}/action-definitions.d.ts +14 -14
- package/dist/packages/{local-service → engine}/action-definitions.js +35 -29
- package/dist/packages/{local-service → engine}/action-planner.d.ts +1 -1
- package/dist/packages/{local-service → engine}/action-planner.js +3 -2
- 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 +5 -5
- package/dist/packages/{agents → engine/agents}/lib/shells.js +117 -58
- package/dist/packages/{agents → engine/agents}/lib/user-config.d.ts +4 -2
- package/dist/packages/engine/agents/lib/user-config.js +24 -0
- 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 +59 -60
- package/dist/packages/{local-service → engine}/client.js +137 -145
- package/dist/packages/{compiler → engine/compile}/artifact-counts.js +1 -1
- package/dist/packages/{compiler → engine/compile}/compiled-paths.d.ts +9 -2
- package/dist/packages/{compiler → engine/compile}/compiled-paths.js +30 -15
- package/dist/packages/{compiler → engine/compile}/compiled-pipeline.d.ts +12 -1
- package/dist/packages/{compiler → engine/compile}/compiled-pipeline.js +39 -9
- 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 +8 -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 +3 -3
- package/dist/packages/{compiler → engine/compile}/compiled-target.js +3 -3
- package/dist/packages/{compiler → engine/compile}/discovery.js +1 -1
- package/dist/packages/{compiler → engine/compile}/index.d.ts +1 -0
- package/dist/packages/{compiler → engine/compile}/index.js +1 -0
- package/dist/packages/{compiler → engine/compile}/lib/schema.d.ts +26 -31
- package/dist/packages/{compiler → engine/compile}/lib/schema.js +2 -13
- package/dist/packages/engine/compile/method-runs.d.ts +14 -0
- package/dist/packages/{compiler → engine/compile}/method-runs.js +5 -6
- package/dist/packages/{compiler → engine/compile}/reset.js +3 -1
- package/dist/packages/{compiler → engine/compile}/runtime-acceptance.js +17 -14
- package/dist/packages/{compiler → engine/compile}/runtime-contracts.js +0 -3
- package/dist/packages/{compiler → engine/compile}/runtime-prompt.js +1 -1
- 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/engine/compile/source-files.d.ts +46 -0
- package/dist/packages/engine/compile/source-files.js +149 -0
- package/dist/packages/engine/compile/state-artifacts.d.ts +9 -0
- package/dist/packages/{compiler → engine/compile}/state-artifacts.js +4 -3
- package/dist/packages/{compiler → engine/compile}/state-health.js +2 -2
- package/dist/packages/{compiler → engine/compile}/state-io.d.ts +3 -2
- package/dist/packages/{compiler → engine/compile}/state-io.js +13 -7
- package/dist/packages/{compiler → engine/compile}/state-paths.d.ts +2 -1
- package/dist/packages/engine/compile/state-paths.js +16 -0
- package/dist/packages/engine/compile/state-view.d.ts +5 -0
- package/dist/packages/{compiler → engine/compile}/state-view.js +20 -30
- package/dist/packages/engine/compile/state.d.ts +7 -0
- package/dist/packages/{compiler → engine/compile}/state.js +3 -3
- 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/engine/connection-config.d.ts +38 -0
- package/dist/packages/engine/connection-config.js +75 -0
- package/dist/packages/{execution → engine/execution}/lib/schema.d.ts +52 -72
- package/dist/packages/{execution → engine/execution}/lib/schema.js +3 -3
- package/dist/packages/engine/index.d.ts +22 -0
- package/dist/packages/engine/index.js +15 -0
- package/dist/packages/engine/instance-paths.d.ts +100 -0
- package/dist/packages/engine/instance-paths.js +165 -0
- package/dist/packages/{local-service → engine}/lib/schema.d.ts +392 -2408
- package/dist/packages/{local-service → engine}/lib/schema.js +164 -76
- package/dist/packages/{local-service → engine}/native-run-handlers.d.ts +7 -5
- package/dist/packages/{local-service → engine}/native-run-handlers.js +71 -27
- package/dist/packages/engine/preparation-store.d.ts +104 -0
- package/dist/packages/engine/preparation-store.js +194 -0
- package/dist/packages/{local-service → engine}/readiness-check-draft.d.ts +2 -2
- package/dist/packages/engine/routes.d.ts +78 -0
- package/dist/packages/engine/routes.js +92 -0
- package/dist/packages/{local-service → engine}/run-observability.d.ts +3 -3
- package/dist/packages/{local-service → engine}/run-observability.js +25 -24
- package/dist/packages/engine/runtime-caches.d.ts +76 -0
- package/dist/packages/engine/runtime-caches.js +191 -0
- package/dist/packages/engine/runtime-event-applier.d.ts +12 -0
- package/dist/packages/engine/runtime-event-applier.js +177 -0
- package/dist/packages/engine/runtime-persistence.d.ts +47 -0
- package/dist/packages/engine/runtime-persistence.js +137 -0
- package/dist/packages/engine/runtime-proposal-helpers.d.ts +35 -0
- package/dist/packages/engine/runtime-proposal-helpers.js +251 -0
- package/dist/packages/engine/runtime-resource-builders.d.ts +52 -0
- package/dist/packages/engine/runtime-resource-builders.js +149 -0
- package/dist/packages/engine/runtime.d.ts +318 -0
- package/dist/packages/{local-service → engine}/runtime.js +835 -1011
- package/dist/packages/{local-service → engine}/server.d.ts +15 -0
- package/dist/packages/engine/server.js +1257 -0
- package/dist/packages/engine/service-registry.d.ts +47 -0
- package/dist/packages/engine/service-registry.js +137 -0
- package/dist/packages/{testing → engine/verify}/lib/schema.d.ts +11 -11
- package/dist/packages/{testing → engine/verify}/lib/schema.js +3 -3
- package/dist/packages/{testing → engine/verify}/readiness-check-run.d.ts +9 -16
- package/dist/packages/{testing → engine/verify}/readiness-check-run.js +38 -94
- package/dist/packages/{testing → engine/verify}/test-execution.js +6 -6
- package/dist/packages/{testing → engine/verify}/test-paths.js +5 -4
- package/dist/packages/{testing → engine/verify}/test-sandbox.d.ts +0 -1
- package/dist/packages/{testing → engine/verify}/test-sandbox.js +17 -33
- package/dist/packages/{testing → engine/verify}/test-specs.js +1 -1
- package/dist/packages/{testing → engine/verify}/test-targets.d.ts +1 -1
- package/dist/packages/{testing → engine/verify}/test-targets.js +9 -9
- package/dist/packages/{testing → engine/verify}/test.d.ts +1 -1
- package/dist/packages/{testing → engine/verify}/test.js +1 -1
- package/dist/packages/{method-authoring → methods/authoring}/method-authoring.d.ts +12 -4
- package/dist/packages/{method-authoring → methods/authoring}/method-authoring.js +70 -7
- 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 +16 -10
- package/dist/packages/{method-package → methods/package}/builtin-compiled-method.d.ts +4 -5
- package/dist/packages/{method-package → methods/package}/builtin-compiled-method.js +10 -16
- package/dist/packages/{method-package → methods/package}/context-interface.d.ts +5 -41
- package/dist/packages/{method-package → methods/package}/context-interface.js +3 -25
- package/dist/packages/{method-package → methods/package}/interf-method-package.d.ts +4 -4
- package/dist/packages/{method-package → methods/package}/interf-method-package.js +24 -35
- package/dist/packages/{method-package → methods/package}/lib/package-root.js +2 -2
- package/dist/packages/{method-package → methods/package}/local-methods.d.ts +18 -8
- package/dist/packages/{method-package → methods/package}/local-methods.js +64 -45
- package/dist/packages/{method-package → methods/package}/method-definitions.d.ts +16 -36
- package/dist/packages/{method-package → methods/package}/method-definitions.js +53 -40
- package/dist/packages/{method-package → methods/package}/method-helpers.d.ts +2 -14
- package/dist/packages/{method-package → methods/package}/method-helpers.js +12 -46
- 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 +3 -31
- package/dist/packages/methods/package/user-methods.d.ts +17 -0
- package/dist/packages/methods/package/user-methods.js +77 -0
- package/dist/packages/{project-model → project}/index.d.ts +0 -1
- package/dist/packages/{project-model → project}/index.js +0 -1
- 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.d.ts +8 -3
- package/dist/packages/{project-model → project}/interf-detect.js +38 -38
- package/dist/packages/project/interf-scaffold.d.ts +3 -0
- package/dist/packages/{project-model → project}/interf-scaffold.js +30 -39
- package/dist/packages/{project-model → project}/lib/schema.d.ts +2 -2
- package/dist/packages/{project-model → project}/lib/schema.js +39 -2
- package/dist/packages/project/preparation-entries.d.ts +11 -0
- package/dist/packages/{project-model → project}/preparation-entries.js +14 -14
- package/dist/packages/{project-model → project}/source-config.d.ts +12 -12
- package/dist/packages/{project-model → project}/source-config.js +81 -53
- package/dist/packages/{project-model → project}/source-folders.d.ts +5 -5
- package/dist/packages/{project-model → project}/source-folders.js +16 -16
- package/package.json +8 -8
- package/CHANGELOG.md +0 -93
- package/LICENSE +0 -183
- package/dist/cli/commands/action-input-cli.d.ts +0 -25
- package/dist/cli/commands/action-input-cli.js +0 -73
- package/dist/cli/commands/control-path.d.ts +0 -11
- package/dist/cli/commands/control-path.js +0 -72
- package/dist/cli/commands/create-method-wizard.d.ts +0 -64
- package/dist/cli/commands/create-method-wizard.js +0 -434
- package/dist/cli/commands/create.d.ts +0 -6
- package/dist/cli/commands/create.js +0 -183
- package/dist/cli/commands/default.d.ts +0 -2
- package/dist/cli/commands/default.js +0 -39
- package/dist/cli/commands/executor-flow.d.ts +0 -29
- package/dist/cli/commands/executor-flow.js +0 -163
- package/dist/cli/commands/init.d.ts +0 -26
- package/dist/cli/commands/init.js +0 -771
- package/dist/cli/commands/list.d.ts +0 -2
- package/dist/cli/commands/list.js +0 -30
- package/dist/cli/commands/preparation-action.d.ts +0 -8
- package/dist/cli/commands/preparation-action.js +0 -29
- package/dist/cli/commands/preparation-picker.d.ts +0 -5
- package/dist/cli/commands/preparation-picker.js +0 -36
- package/dist/cli/commands/preparation-selection.d.ts +0 -6
- package/dist/cli/commands/preparation-selection.js +0 -11
- package/dist/cli/commands/service-action-flow.d.ts +0 -9
- package/dist/cli/commands/service-action-flow.js +0 -19
- package/dist/cli/commands/source-config-wizard.d.ts +0 -51
- package/dist/cli/commands/source-config-wizard.js +0 -670
- package/dist/cli/commands/test.d.ts +0 -17
- package/dist/cli/commands/test.js +0 -188
- package/dist/packages/agents/lib/detection.d.ts +0 -7
- package/dist/packages/agents/lib/user-config.js +0 -16
- package/dist/packages/compiler/method-runs.d.ts +0 -15
- package/dist/packages/compiler/raw-snapshot.d.ts +0 -49
- package/dist/packages/compiler/raw-snapshot.js +0 -101
- package/dist/packages/compiler/state-artifacts.d.ts +0 -8
- package/dist/packages/compiler/state-paths.js +0 -13
- package/dist/packages/compiler/state-view.d.ts +0 -4
- package/dist/packages/compiler/state.d.ts +0 -7
- package/dist/packages/local-service/index.d.ts +0 -18
- package/dist/packages/local-service/index.js +0 -13
- package/dist/packages/local-service/routes.d.ts +0 -32
- package/dist/packages/local-service/routes.js +0 -37
- package/dist/packages/local-service/runtime.d.ts +0 -133
- package/dist/packages/local-service/server.js +0 -627
- package/dist/packages/method-package/index.d.ts +0 -11
- package/dist/packages/method-package/index.js +0 -11
- package/dist/packages/method-package/method-stage-policy.d.ts +0 -5
- package/dist/packages/method-package/method-stage-policy.js +0 -31
- package/dist/packages/project-model/interf-scaffold.d.ts +0 -3
- package/dist/packages/project-model/preparation-entries.d.ts +0 -11
- package/dist/packages/project-model/project-paths.d.ts +0 -12
- package/dist/packages/project-model/project-paths.js +0 -33
- package/dist/packages/shared/filesystem.d.ts +0 -2
- package/dist/packages/shared/filesystem.js +0 -55
- /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → a3UiUF0DiMEbfWy_0gihg}/_buildManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → a3UiUF0DiMEbfWy_0gihg}/_clientMiddlewareManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → 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}/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-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/{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}/discovery.d.ts +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}/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-inventory.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/runtime-inventory.js +0 -0
- /package/dist/packages/{compiler → engine/compile}/runtime-paths.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/runtime-paths.js +0 -0
- /package/dist/packages/{compiler → engine/compile}/runtime-prompt.d.ts +0 -0
- /package/dist/packages/{compiler → engine/compile}/runtime-types.js +0 -0
- /package/dist/packages/{compiler → engine/compile}/state-health.d.ts +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/{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}/readiness-check-draft.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-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-specs.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/{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}/lib/package-root.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
|
@@ -0,0 +1,689 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `interf` (no subcommand) and `interf init` — the wizard.
|
|
3
|
+
*
|
|
4
|
+
* Casual-user entry point. End-to-end onboarding:
|
|
5
|
+
* - If no connection → offer to start a local engine inline (or connect remote, or quit).
|
|
6
|
+
* - Once connected → action menu (list / create / compile / test / open UI / stop engine / quit).
|
|
7
|
+
* - Each action loops back to the menu instead of exiting.
|
|
8
|
+
*
|
|
9
|
+
* Agents bypass the wizard entirely. They use `interf prep`, `interf compile`,
|
|
10
|
+
* etc. directly. The wizard is purely a UX wrapper around those CLI commands.
|
|
11
|
+
*/
|
|
12
|
+
import chalk from "chalk";
|
|
13
|
+
import * as p from "@clack/prompts";
|
|
14
|
+
import { existsSync, statSync } from "node:fs";
|
|
15
|
+
import { homedir } from "node:os";
|
|
16
|
+
import { basename, resolve } from "node:path";
|
|
17
|
+
import { spawn } from "node:child_process";
|
|
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
|
+
async function callJson(url, token) {
|
|
21
|
+
const headers = new Headers();
|
|
22
|
+
if (token)
|
|
23
|
+
headers.set("authorization", `Bearer ${token}`);
|
|
24
|
+
try {
|
|
25
|
+
const response = await fetch(url, { headers });
|
|
26
|
+
const raw = await response.text();
|
|
27
|
+
let body = null;
|
|
28
|
+
if (raw) {
|
|
29
|
+
try {
|
|
30
|
+
body = JSON.parse(raw);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
body = null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return { status: response.status, body };
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return { status: 0, body: null };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function spawnInterf(args) {
|
|
43
|
+
return new Promise((resolveSpawn) => {
|
|
44
|
+
const child = spawn(process.argv[1] ?? "interf", args, { stdio: "inherit" });
|
|
45
|
+
child.on("exit", (code) => resolveSpawn(code ?? 0));
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const DEFAULT_ENGINE_URL = `http://${LOCAL_SERVICE_DEFAULT_HOST}:${LOCAL_SERVICE_DEFAULT_PORT}`;
|
|
49
|
+
/**
|
|
50
|
+
* Probe a URL's `/health` endpoint and return whether the engine is up.
|
|
51
|
+
* Used as a fallback when `connection.json` may be missing (e.g. older
|
|
52
|
+
* `interf web` binaries that don't write the 0.13 record).
|
|
53
|
+
*/
|
|
54
|
+
async function probeHealth(url) {
|
|
55
|
+
try {
|
|
56
|
+
const response = await fetch(`${url.replace(/\/+$/, "")}/health`);
|
|
57
|
+
return response.status === 200;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
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.
|
|
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
|
+
}
|
|
83
|
+
const spinner = p.spinner();
|
|
84
|
+
spinner.start("Starting local Interf engine…");
|
|
85
|
+
const child = spawn(process.argv[1] ?? "interf", ["web"], {
|
|
86
|
+
detached: true,
|
|
87
|
+
stdio: "ignore",
|
|
88
|
+
});
|
|
89
|
+
child.unref();
|
|
90
|
+
const startedAt = Date.now();
|
|
91
|
+
const timeoutMs = 30_000;
|
|
92
|
+
while (Date.now() - startedAt < timeoutMs) {
|
|
93
|
+
await new Promise((r) => setTimeout(r, 250));
|
|
94
|
+
// Path A: connection.json written by the spawned 0.13+ server.
|
|
95
|
+
const conn = readActiveConnection();
|
|
96
|
+
if (conn) {
|
|
97
|
+
const url = conn.url.replace(/\/+$/, "");
|
|
98
|
+
if (await probeHealth(url)) {
|
|
99
|
+
spinner.stop(chalk.green(`Engine ready at ${url}`));
|
|
100
|
+
return { url, token: conn.auth_token, wasAlreadyRunning: false };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// Path B: spawned engine is ready on the default URL.
|
|
104
|
+
if (await probeHealth(DEFAULT_ENGINE_URL)) {
|
|
105
|
+
try {
|
|
106
|
+
writeConnection({ url: DEFAULT_ENGINE_URL, auth_token: null });
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
// best effort
|
|
110
|
+
}
|
|
111
|
+
spinner.stop(chalk.green(`Engine ready at ${DEFAULT_ENGINE_URL}`));
|
|
112
|
+
return { url: DEFAULT_ENGINE_URL, token: null, wasAlreadyRunning: false };
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
spinner.stop(chalk.red("Timed out waiting for engine to start."));
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
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) {
|
|
125
|
+
console.log();
|
|
126
|
+
console.log(chalk.yellow(` ${reason}`));
|
|
127
|
+
console.log();
|
|
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);
|
|
135
|
+
}
|
|
136
|
+
/** Validate that a path exists and is a directory. */
|
|
137
|
+
function validateSourcePath(value) {
|
|
138
|
+
const abs = resolve(value);
|
|
139
|
+
if (!existsSync(abs))
|
|
140
|
+
return `Source folder does not exist: ${abs}`;
|
|
141
|
+
if (!statSync(abs).isDirectory())
|
|
142
|
+
return `Source folder is not a directory: ${abs}`;
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
/** Offer the user a curated source-path picker before falling back to free-form input. */
|
|
146
|
+
async function promptSourcePath() {
|
|
147
|
+
const cwd = process.cwd();
|
|
148
|
+
const home = homedir();
|
|
149
|
+
const commonCandidates = [
|
|
150
|
+
cwd,
|
|
151
|
+
`${home}/Documents`,
|
|
152
|
+
`${home}/Downloads`,
|
|
153
|
+
`${home}/Desktop`,
|
|
154
|
+
home,
|
|
155
|
+
];
|
|
156
|
+
const seen = new Set();
|
|
157
|
+
const options = [];
|
|
158
|
+
for (const candidate of commonCandidates) {
|
|
159
|
+
const abs = resolve(candidate);
|
|
160
|
+
if (seen.has(abs))
|
|
161
|
+
continue;
|
|
162
|
+
if (!existsSync(abs))
|
|
163
|
+
continue;
|
|
164
|
+
if (!statSync(abs).isDirectory())
|
|
165
|
+
continue;
|
|
166
|
+
seen.add(abs);
|
|
167
|
+
const isCwd = abs === resolve(cwd);
|
|
168
|
+
const label = `${basename(abs) || abs} ${chalk.dim(`— ${abs}${isCwd ? " (current dir)" : ""}`)}`;
|
|
169
|
+
options.push({ value: abs, label });
|
|
170
|
+
}
|
|
171
|
+
options.push({ value: "__custom__", label: chalk.dim("Type a custom path…") });
|
|
172
|
+
const choice = await p.select({
|
|
173
|
+
message: "Where's the source folder?",
|
|
174
|
+
options,
|
|
175
|
+
initialValue: resolve(cwd),
|
|
176
|
+
});
|
|
177
|
+
if (p.isCancel(choice))
|
|
178
|
+
return null;
|
|
179
|
+
if (choice === "__custom__") {
|
|
180
|
+
const typed = await p.text({
|
|
181
|
+
message: "Custom source folder path",
|
|
182
|
+
placeholder: cwd,
|
|
183
|
+
initialValue: cwd,
|
|
184
|
+
validate: validateSourcePath,
|
|
185
|
+
});
|
|
186
|
+
if (p.isCancel(typed))
|
|
187
|
+
return null;
|
|
188
|
+
return resolve(String(typed));
|
|
189
|
+
}
|
|
190
|
+
return String(choice);
|
|
191
|
+
}
|
|
192
|
+
async function flowCreatePreparation(conn) {
|
|
193
|
+
const prepId = await p.text({
|
|
194
|
+
message: "Preparation id (a short name for this unit of agent work)",
|
|
195
|
+
placeholder: "my-prep",
|
|
196
|
+
validate: (value) => (/^[a-z0-9][a-z0-9-]*$/.test(value) ? undefined : "Lowercase letters, numbers, and dashes only."),
|
|
197
|
+
});
|
|
198
|
+
if (p.isCancel(prepId))
|
|
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();
|
|
207
|
+
const sourcePath = await promptSourcePath();
|
|
208
|
+
if (!sourcePath)
|
|
209
|
+
return null;
|
|
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.
|
|
214
|
+
const methodsResp = await callJson(`${conn.url}/v1/methods`, conn.token);
|
|
215
|
+
const methods = methodsResp.body?.methods ?? [];
|
|
216
|
+
const methodOptions = methods
|
|
217
|
+
.map((m) => ({ value: m.method_id ?? m.id ?? "", label: `${m.method_id ?? m.id ?? "(?)"}${m.label ? ` — ${m.label}` : ""}` }))
|
|
218
|
+
.filter((opt) => opt.value !== "");
|
|
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)" };
|
|
222
|
+
if (methodOptions.length > 0) {
|
|
223
|
+
const chosen = await p.select({
|
|
224
|
+
message: "Pick a method (optional — you can do this later)",
|
|
225
|
+
options: [...methodOptions, customOption, skipOption],
|
|
226
|
+
initialValue: methodOptions.find((o) => o.value === "interf-default")?.value ?? methodOptions[0]?.value,
|
|
227
|
+
});
|
|
228
|
+
if (p.isCancel(chosen))
|
|
229
|
+
return null;
|
|
230
|
+
if (chosen === "__skip__") {
|
|
231
|
+
methodId = null;
|
|
232
|
+
}
|
|
233
|
+
else if (chosen === "__custom__") {
|
|
234
|
+
const typed = await p.text({
|
|
235
|
+
message: "Method id",
|
|
236
|
+
placeholder: "interf-default",
|
|
237
|
+
});
|
|
238
|
+
if (p.isCancel(typed))
|
|
239
|
+
return null;
|
|
240
|
+
methodId = String(typed);
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
methodId = String(chosen);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
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
|
+
],
|
|
253
|
+
});
|
|
254
|
+
if (p.isCancel(choose))
|
|
255
|
+
return null;
|
|
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
|
+
}
|
|
265
|
+
}
|
|
266
|
+
const exitCode = await spawnInterf([
|
|
267
|
+
"prep",
|
|
268
|
+
"create",
|
|
269
|
+
String(prepId),
|
|
270
|
+
"--source",
|
|
271
|
+
resolve(String(sourcePath)),
|
|
272
|
+
...(methodId ? ["--method", methodId] : []),
|
|
273
|
+
...(aboutText ? ["--about", aboutText] : []),
|
|
274
|
+
]);
|
|
275
|
+
if (exitCode !== 0)
|
|
276
|
+
return null;
|
|
277
|
+
return String(prepId);
|
|
278
|
+
}
|
|
279
|
+
async function pickPreparation(conn, message) {
|
|
280
|
+
const preps = await callJson(`${conn.url}/v1/preparations`, conn.token);
|
|
281
|
+
const list = preps.body?.preparations ?? [];
|
|
282
|
+
if (list.length === 0) {
|
|
283
|
+
console.log(chalk.dim(" No preparations yet. Create one first."));
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
const choice = await p.select({
|
|
287
|
+
message,
|
|
288
|
+
options: list.map((prep) => ({
|
|
289
|
+
value: prep.id,
|
|
290
|
+
label: `${prep.id} ${chalk.dim(`(${prep.method_id} · ${prep.readiness?.status ?? "—"})`)}`,
|
|
291
|
+
})),
|
|
292
|
+
});
|
|
293
|
+
if (p.isCancel(choice))
|
|
294
|
+
return null;
|
|
295
|
+
return String(choice);
|
|
296
|
+
}
|
|
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)");
|
|
304
|
+
const action = await p.select({
|
|
305
|
+
message: "What do you want to do?",
|
|
306
|
+
options: [
|
|
307
|
+
{ value: "ui", label: "Open Compiler UI" },
|
|
308
|
+
{ value: "ls", label: "List preparations" },
|
|
309
|
+
{ value: "create", label: "Create a new preparation" },
|
|
310
|
+
{ value: "agents", label: "Manage agents (list / register / role-map)" },
|
|
311
|
+
{ value: "compile", label: compileLabel },
|
|
312
|
+
{ value: "verify", label: verifyLabel },
|
|
313
|
+
{ value: "stop", label: "Stop the local engine" },
|
|
314
|
+
{ value: "quit", label: "Quit" },
|
|
315
|
+
],
|
|
316
|
+
});
|
|
317
|
+
if (p.isCancel(action) || action === "quit")
|
|
318
|
+
return "exit";
|
|
319
|
+
if (action === "ls") {
|
|
320
|
+
await spawnInterf(["prep", "ls"]);
|
|
321
|
+
return "continue";
|
|
322
|
+
}
|
|
323
|
+
if (action === "agents") {
|
|
324
|
+
await spawnInterf(["agents", "ls"]);
|
|
325
|
+
return "continue";
|
|
326
|
+
}
|
|
327
|
+
if (action === "create") {
|
|
328
|
+
const newId = await flowCreatePreparation(conn);
|
|
329
|
+
if (newId) {
|
|
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
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return "continue";
|
|
343
|
+
}
|
|
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
|
+
}
|
|
351
|
+
const id = await pickPreparation(conn, "Which preparation to compile?");
|
|
352
|
+
if (id)
|
|
353
|
+
await spawnInterf(["compile", id]);
|
|
354
|
+
return "continue";
|
|
355
|
+
}
|
|
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?");
|
|
362
|
+
if (id)
|
|
363
|
+
await spawnInterf(["verify", id]);
|
|
364
|
+
return "continue";
|
|
365
|
+
}
|
|
366
|
+
if (action === "ui") {
|
|
367
|
+
const target = `${conn.url}/`;
|
|
368
|
+
console.log();
|
|
369
|
+
console.log(` Opening ${chalk.bold(target)} in your browser…`);
|
|
370
|
+
const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
371
|
+
try {
|
|
372
|
+
const child = spawn(command, [target], { detached: true, stdio: "ignore" });
|
|
373
|
+
child.on("error", () => {
|
|
374
|
+
console.log(chalk.dim(` (Could not open browser; visit ${target} manually.)`));
|
|
375
|
+
});
|
|
376
|
+
child.unref();
|
|
377
|
+
}
|
|
378
|
+
catch {
|
|
379
|
+
console.log(chalk.dim(` (Could not open browser; visit ${target} manually.)`));
|
|
380
|
+
}
|
|
381
|
+
console.log();
|
|
382
|
+
return "continue";
|
|
383
|
+
}
|
|
384
|
+
if (action === "stop") {
|
|
385
|
+
const ok = await p.confirm({ message: "Stop the connected engine?", initialValue: false });
|
|
386
|
+
if (!p.isCancel(ok) && ok) {
|
|
387
|
+
await spawnInterf(["web", "stop"]);
|
|
388
|
+
return "exit";
|
|
389
|
+
}
|
|
390
|
+
return "continue";
|
|
391
|
+
}
|
|
392
|
+
return "continue";
|
|
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
|
+
}
|
|
524
|
+
async function runWizard(args) {
|
|
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.
|
|
531
|
+
const initial = readActiveConnection({
|
|
532
|
+
urlOverride: args.url,
|
|
533
|
+
authTokenOverride: args.token,
|
|
534
|
+
});
|
|
535
|
+
if (!initial) {
|
|
536
|
+
exitNoEngineConnected("No Interf engine is connected.");
|
|
537
|
+
}
|
|
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.`);
|
|
542
|
+
}
|
|
543
|
+
let conn = { url, token: initial.auth_token };
|
|
544
|
+
const instance = await callJson(`${conn.url}/v1/instance`, conn.token);
|
|
545
|
+
console.log();
|
|
546
|
+
console.log(chalk.bold(` Connected to ${conn.url}`));
|
|
547
|
+
if (instance.body?.package_version) {
|
|
548
|
+
console.log(chalk.dim(` v${instance.body.package_version} · ${instance.body.preparation_count ?? 0} preparation(s)`));
|
|
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
|
+
}
|
|
665
|
+
for (;;) {
|
|
666
|
+
console.log();
|
|
667
|
+
const next = await showActionMenu(conn, { allowCompileVerify });
|
|
668
|
+
if (next === "exit")
|
|
669
|
+
break;
|
|
670
|
+
}
|
|
671
|
+
p.outro("Bye.");
|
|
672
|
+
}
|
|
673
|
+
export const wizardCommand = {
|
|
674
|
+
command: "$0",
|
|
675
|
+
describe: "Open the interactive wizard (default when no subcommand is given)",
|
|
676
|
+
builder: (yargs) => yargs
|
|
677
|
+
.option("url", { type: "string", describe: "Override the active connection URL" })
|
|
678
|
+
.option("token", { type: "string", describe: "Override the active bearer token" }),
|
|
679
|
+
handler: runWizard,
|
|
680
|
+
};
|
|
681
|
+
/** Alias: `interf init` runs the same wizard. */
|
|
682
|
+
export const initCommand = {
|
|
683
|
+
command: "init",
|
|
684
|
+
describe: "Open the interactive wizard",
|
|
685
|
+
builder: (yargs) => yargs
|
|
686
|
+
.option("url", { type: "string", describe: "Override the active connection URL" })
|
|
687
|
+
.option("token", { type: "string", describe: "Override the active bearer token" }),
|
|
688
|
+
handler: runWizard,
|
|
689
|
+
};
|