@interf/compiler 0.16.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -0
- package/README.md +90 -73
- package/TRADEMARKS.md +4 -4
- package/dist/cli/commands/mcp.d.ts +0 -34
- package/dist/cli/commands/mcp.js +246 -45
- package/dist/cli/commands/method.js +261 -15
- package/dist/cli/commands/prep.js +116 -15
- package/dist/cli/commands/runs.js +103 -9
- package/dist/cli/commands/status.js +4 -2
- package/dist/cli/commands/test.d.ts +10 -0
- package/dist/cli/commands/{verify.js → test.js} +24 -17
- package/dist/cli/commands/web.js +82 -8
- package/dist/cli/commands/wizard.js +158 -51
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +3 -3
- package/dist/compiler-ui/404.html +1 -1
- package/dist/compiler-ui/__next.__PAGE__.txt +5 -5
- package/dist/compiler-ui/__next._full.txt +13 -12
- package/dist/compiler-ui/__next._head.txt +3 -3
- package/dist/compiler-ui/__next._index.txt +5 -4
- package/dist/compiler-ui/__next._tree.txt +4 -3
- package/dist/compiler-ui/_next/static/chunks/01646j7yi.w5a.css +1 -0
- package/dist/compiler-ui/_next/static/chunks/{0n51hrfoufc7g.js → 02f_.8.ebn556.js} +1 -1
- package/dist/compiler-ui/_next/static/chunks/02r7siaw-_p5w.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/{08m7vf5asqlsm.js → 04d0ly-7xb~-j.js} +10 -10
- package/dist/compiler-ui/_next/static/chunks/0fhs9psnxqd8s.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/0mssmhpbifj15.css +2 -0
- package/dist/compiler-ui/_next/static/chunks/0nypu~ddwxari.js +116 -0
- package/dist/compiler-ui/_next/static/chunks/0p3s8iyhgcww2.js +31 -0
- package/dist/compiler-ui/_next/static/chunks/0tjf-vu_rz8s0.css +1 -0
- package/dist/compiler-ui/_next/static/chunks/0u6p3fpbbfgtl.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/0wpx5..8dnh0w.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/0y0uj160p0ts~.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/10t8l~_oenf.c.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/13gz9e7z~imx1.js +5 -0
- package/dist/compiler-ui/_next/static/chunks/156xed-b6czaw.js +1 -0
- package/dist/compiler-ui/_next/static/chunks/{turbopack-0.uq1k8c0j4s..js → turbopack-02-3e_c-yz~5g.js} +1 -1
- package/dist/compiler-ui/_next/static/chunks/{turbopack-10e~t1yzi4svj.js → turbopack-0apv8vb-nczuy.js} +1 -1
- package/dist/compiler-ui/_not-found/__next._full.txt +10 -9
- package/dist/compiler-ui/_not-found/__next._head.txt +3 -3
- package/dist/compiler-ui/_not-found/__next._index.txt +5 -4
- package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._not-found.txt +3 -3
- package/dist/compiler-ui/_not-found/__next._tree.txt +3 -2
- package/dist/compiler-ui/_not-found.html +1 -1
- package/dist/compiler-ui/_not-found.txt +10 -9
- package/dist/compiler-ui/index.html +1 -1
- package/dist/compiler-ui/index.txt +13 -12
- package/dist/packages/contracts/index.d.ts +2 -2
- package/dist/packages/contracts/index.js +1 -1
- package/dist/packages/contracts/lib/schema.d.ts +275 -72
- package/dist/packages/contracts/lib/schema.js +244 -83
- package/dist/packages/engine/action-definitions.d.ts +174 -13
- package/dist/packages/engine/action-definitions.js +125 -122
- package/dist/packages/engine/action-planner.js +4 -11
- package/dist/packages/engine/agents/lib/shells.d.ts +15 -5
- package/dist/packages/engine/agents/lib/shells.js +134 -123
- package/dist/packages/engine/agents/role-executors.js +1 -1
- package/dist/packages/engine/cloud-seams.d.ts +115 -0
- package/dist/packages/engine/cloud-seams.js +84 -0
- package/dist/packages/engine/compile/artifact-counts.d.ts +1 -1
- package/dist/packages/engine/compile/artifact-counts.js +3 -3
- package/dist/packages/engine/compile/artifact-status.d.ts +41 -0
- package/dist/packages/engine/compile/artifact-status.js +166 -0
- package/dist/packages/engine/compile/billing-events.d.ts +89 -0
- package/dist/packages/engine/compile/billing-events.js +74 -0
- package/dist/packages/engine/compile/check-evaluator.d.ts +66 -0
- package/dist/packages/engine/compile/check-evaluator.js +298 -0
- package/dist/packages/engine/compile/compiled-paths.js +6 -6
- package/dist/packages/engine/compile/compiled-schema.d.ts +7 -17
- package/dist/packages/engine/compile/compiled-schema.js +55 -70
- package/dist/packages/engine/compile/compiled-stage-plan.d.ts +1 -0
- package/dist/packages/engine/compile/compiled-stage-plan.js +32 -15
- package/dist/packages/engine/compile/compiled-stage-runner.js +1 -1
- package/dist/packages/engine/compile/index.d.ts +0 -1
- package/dist/packages/engine/compile/index.js +0 -1
- package/dist/packages/engine/compile/lib/schema.d.ts +111 -92
- package/dist/packages/engine/compile/lib/schema.js +35 -39
- package/dist/packages/engine/compile/method-primitives.d.ts +2 -2
- package/dist/packages/engine/compile/method-primitives.js +1 -1
- package/dist/packages/engine/compile/reset.js +4 -4
- package/dist/packages/engine/compile/runtime-contracts.js +2 -1
- package/dist/packages/engine/compile/runtime-prompt.js +3 -2
- package/dist/packages/engine/compile/runtime-reconcile.js +35 -35
- package/dist/packages/engine/compile/runtime-runs.js +0 -1
- package/dist/packages/engine/compile/runtime-types.d.ts +7 -8
- package/dist/packages/engine/compile/runtime.d.ts +1 -2
- package/dist/packages/engine/compile/runtime.js +0 -1
- package/dist/packages/engine/compile/state-health.js +6 -6
- package/dist/packages/engine/compile/state-view.js +7 -6
- package/dist/packages/engine/compile/validate-compiled.js +61 -30
- package/dist/packages/engine/compile/validate.js +26 -24
- package/dist/packages/engine/connection-config.js +1 -1
- package/dist/packages/engine/execution/lib/schema.d.ts +89 -33
- package/dist/packages/engine/execution/lib/schema.js +13 -5
- package/dist/packages/engine/index.d.ts +2 -2
- package/dist/packages/engine/index.js +1 -1
- package/dist/packages/engine/instance-paths.d.ts +15 -9
- package/dist/packages/engine/instance-paths.js +15 -9
- package/dist/packages/engine/lib/schema.d.ts +1316 -351
- package/dist/packages/engine/lib/schema.js +99 -36
- package/dist/packages/engine/native-run-handlers.js +25 -15
- package/dist/packages/engine/preparation-store.d.ts +9 -7
- package/dist/packages/engine/preparation-store.js +20 -0
- package/dist/packages/engine/requested-artifacts.d.ts +5 -0
- package/dist/packages/engine/requested-artifacts.js +36 -0
- package/dist/packages/engine/routes.d.ts +7 -1
- package/dist/packages/engine/routes.js +7 -1
- package/dist/packages/engine/run-observability.js +4 -4
- package/dist/packages/engine/runtime-event-applier.js +7 -0
- package/dist/packages/engine/runtime-proposal-helpers.d.ts +2 -2
- package/dist/packages/engine/runtime-proposal-helpers.js +6 -8
- package/dist/packages/engine/runtime-resource-builders.d.ts +11 -6
- package/dist/packages/engine/runtime-resource-builders.js +18 -6
- package/dist/packages/engine/runtime.d.ts +70 -8
- package/dist/packages/engine/runtime.js +304 -49
- package/dist/packages/engine/server.d.ts +25 -0
- package/dist/packages/engine/server.js +161 -50
- package/dist/packages/engine/verify/index.d.ts +10 -10
- package/dist/packages/engine/verify/index.js +8 -8
- package/dist/packages/engine/verify/readiness-check-run.d.ts +27 -4
- package/dist/packages/engine/verify/readiness-check-run.js +92 -24
- package/dist/packages/engine/verify/{test-execution.d.ts → verify-execution.d.ts} +2 -2
- package/dist/packages/engine/verify/{test-execution.js → verify-execution.js} +3 -3
- package/dist/packages/engine/verify/{test-paths.d.ts → verify-paths.d.ts} +1 -1
- package/dist/packages/engine/verify/{test-sandbox.d.ts → verify-sandbox.d.ts} +1 -1
- package/dist/packages/engine/verify/{test-specs.d.ts → verify-specs.d.ts} +1 -1
- package/dist/packages/engine/verify/{test-specs.js → verify-specs.js} +1 -1
- package/dist/packages/engine/verify/{test-targets.d.ts → verify-targets.d.ts} +1 -1
- package/dist/packages/engine/verify/{test.d.ts → verify.d.ts} +4 -4
- package/dist/packages/engine/verify/{test.js → verify.js} +3 -3
- package/dist/packages/engine/wire-schemas.d.ts +549 -0
- package/dist/packages/engine/wire-schemas.js +59 -0
- package/dist/packages/methods/authoring/method-authoring.d.ts +5 -1
- package/dist/packages/methods/authoring/method-authoring.js +68 -18
- package/dist/packages/methods/authoring/method-edit-session.js +5 -5
- package/dist/packages/methods/authoring/method-improvement.js +1 -1
- package/dist/packages/methods/package/builtin-compiled-method.d.ts +12 -12
- package/dist/packages/methods/package/builtin-compiled-method.js +26 -23
- package/dist/packages/methods/package/context-interface.d.ts +39 -26
- package/dist/packages/methods/package/context-interface.js +48 -39
- package/dist/packages/methods/package/interf-method-package.js +28 -47
- package/dist/packages/methods/package/local-methods.d.ts +4 -4
- package/dist/packages/methods/package/local-methods.js +53 -66
- package/dist/packages/methods/package/method-definitions.d.ts +4 -6
- package/dist/packages/methods/package/method-definitions.js +1 -5
- package/dist/packages/methods/package/method-helpers.d.ts +0 -2
- package/dist/packages/methods/package/method-helpers.js +0 -4
- package/dist/packages/project/interf-detect.js +6 -6
- package/dist/packages/project/interf-scaffold.js +12 -12
- package/dist/packages/project/lib/schema.d.ts +193 -0
- package/dist/packages/project/lib/schema.js +46 -1
- package/dist/packages/project/source-config.js +6 -1
- package/dist/packages/project/source-folders.js +1 -1
- package/package.json +12 -23
- package/public-repo/CONTRIBUTING.md +47 -0
- package/public-repo/LICENSE.md +1 -0
- package/public-repo/README.md +325 -0
- package/public-repo/SECURITY.md +67 -0
- package/public-repo/TRADEMARKS.md +8 -0
- package/{builtin-methods → public-repo/methods}/interf-default/README.md +10 -7
- package/{builtin-methods → public-repo/methods}/interf-default/compile/stages/shape/SKILL.md +4 -8
- package/{builtin-methods → public-repo/methods}/interf-default/method.json +8 -69
- package/public-repo/methods/interf-default/method.schema.json +75 -0
- package/public-repo/methods/interf-default/use/query/SKILL.md +23 -0
- package/public-repo/plugins/README.md +9 -0
- package/public-repo/plugins/interf/.claude-plugin/plugin.json +21 -0
- package/public-repo/plugins/interf/.mcp.json +12 -0
- package/public-repo/plugins/interf/README.md +29 -0
- package/public-repo/plugins/interf/skills/interf/SKILL.md +477 -0
- package/public-repo/skills/interf/SKILL.md +477 -0
- package/agent-skills/interf-actions/SKILL.md +0 -185
- package/agent-skills/interf-actions/references/cli.md +0 -243
- package/builtin-methods/interf-default/method.schema.json +0 -73
- package/builtin-methods/interf-default/use/query/SKILL.md +0 -28
- package/dist/cli/commands/verify.d.ts +0 -8
- package/dist/compiler-ui/_next/static/chunks/06yhdspx~ca5-.js +0 -5
- package/dist/compiler-ui/_next/static/chunks/06z~l3kwb891e.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/08g7lvje.te.u.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/0_i-3_5l9t2qe.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/0b-ywny_j0g~0.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/0b52v41o1gixx.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/0gpzgsv0w.q~m.js +0 -31
- package/dist/compiler-ui/_next/static/chunks/0ilwfezfvu6~-.js +0 -1
- package/dist/compiler-ui/_next/static/chunks/0jipmpez3_ehh.js +0 -89
- package/dist/compiler-ui/_next/static/chunks/0xxmf45eskdt~.css +0 -1
- package/dist/compiler-ui/_next/static/chunks/13awzu4tooflw.css +0 -3
- package/dist/compiler-ui/_next/static/chunks/14wtz~vq25~qq.js +0 -1
- package/dist/packages/engine/compile/runtime-acceptance.d.ts +0 -9
- package/dist/packages/engine/compile/runtime-acceptance.js +0 -265
- /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → tYHMLL9oKds1yDoNYgkPV}/_buildManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → tYHMLL9oKds1yDoNYgkPV}/_clientMiddlewareManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → tYHMLL9oKds1yDoNYgkPV}/_ssgManifest.js +0 -0
- /package/dist/packages/engine/verify/{test-paths.js → verify-paths.js} +0 -0
- /package/dist/packages/engine/verify/{test-profile-presets.d.ts → verify-profile-presets.d.ts} +0 -0
- /package/dist/packages/engine/verify/{test-profile-presets.js → verify-profile-presets.js} +0 -0
- /package/dist/packages/engine/verify/{test-sandbox.js → verify-sandbox.js} +0 -0
- /package/dist/packages/engine/verify/{test-targets.js → verify-targets.js} +0 -0
- /package/dist/packages/engine/verify/{test-types.d.ts → verify-types.d.ts} +0 -0
- /package/dist/packages/engine/verify/{test-types.js → verify-types.js} +0 -0
- /package/{builtin-methods → public-repo/methods}/interf-default/compile/stages/structure/SKILL.md +0 -0
- /package/{builtin-methods → public-repo/methods}/interf-default/compile/stages/summarize/SKILL.md +0 -0
- /package/{builtin-methods → public-repo/methods}/interf-default/improve/SKILL.md +0 -0
package/dist/cli/commands/mcp.js
CHANGED
|
@@ -1,25 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `interf mcp` — Model Context Protocol server.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the local-service HTTP API as a typed agent surface so coding
|
|
5
|
+
* agents can interact with Interf the same way they call other MCP tools
|
|
6
|
+
* (instead of shelling out to the CLI).
|
|
7
|
+
*
|
|
8
|
+
* interf mcp # stdio transport (default)
|
|
9
|
+
* interf mcp --transport=http --port=4889 # advanced: HTTP transport
|
|
10
|
+
*
|
|
11
|
+
* API-backed tools read `~/.interf/connection.json` (the same file every
|
|
12
|
+
* other client uses) on each call. The MCP server can start before an
|
|
13
|
+
* engine is connected so local plugin hosts such as Cowork can load the
|
|
14
|
+
* tool surface first, then call `web_start` or `web_status`. The MCP
|
|
15
|
+
* server itself holds no Interf runtime state. The transport options are
|
|
16
|
+
* intentionally minimal — agents speaking MCP today are stdio-first.
|
|
17
|
+
*
|
|
18
|
+
* Tool list:
|
|
19
|
+
* web_start shell out to `interf web start`
|
|
20
|
+
* web_stop shell out to `interf web stop`
|
|
21
|
+
* web_status shell out to `interf web status`
|
|
22
|
+
* prep_list GET /v1/preparations
|
|
23
|
+
* prep_create POST /v1/preparations
|
|
24
|
+
* prep_show GET /v1/preparations/{id}
|
|
25
|
+
* prep_set_method PATCH /v1/preparations/{id}
|
|
26
|
+
* prep_remove DELETE /v1/preparations/{id}
|
|
27
|
+
* prep_compile POST /v1/preparations/{id}/compile-runs
|
|
28
|
+
* prep_test POST /v1/preparations/{id}/verify-runs
|
|
29
|
+
* method_list GET /v1/methods
|
|
30
|
+
* method_draft POST /v1/preparations/{id}/method-authoring-runs
|
|
31
|
+
* method_improve POST /v1/preparations/{id}/method-improvement-runs
|
|
32
|
+
* runs_status GET /v1/runs/{run-id}
|
|
33
|
+
* runs_watch GET /v1/runs/{run-id}/events (snapshot, not SSE)
|
|
34
|
+
* runs_cancel POST /v1/runs/{run-id}/cancel
|
|
35
|
+
* runs_fetch GET /v1/runs/{run-id}/artifacts
|
|
36
|
+
* instance_status GET /v1/instance
|
|
37
|
+
*/
|
|
38
|
+
import { spawn } from "node:child_process";
|
|
39
|
+
import { readFileSync } from "node:fs";
|
|
1
40
|
import { z } from "zod";
|
|
2
41
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
42
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
43
|
import { CONNECT_OR_ERROR_HINT, readActiveConnection, } from "../../packages/engine/connection-config.js";
|
|
5
44
|
import { LOCAL_SERVICE_ROUTES, preparationResourcePath, preparationSubresourcePath, runResourcePath, runSubresourcePath, } from "../../packages/engine/routes.js";
|
|
45
|
+
import { MethodAuthoringArtifactRequirementSchema, } from "../../packages/engine/lib/schema.js";
|
|
46
|
+
import { RequestedArtifactSchema, SourceProfileSchema, } from "../../packages/project/lib/schema.js";
|
|
6
47
|
function trimTrailingSlash(value) {
|
|
7
48
|
return value.replace(/\/+$/, "");
|
|
8
49
|
}
|
|
9
|
-
function
|
|
50
|
+
function packageVersionFromManifest() {
|
|
51
|
+
try {
|
|
52
|
+
const url = new URL("../../../package.json", import.meta.url);
|
|
53
|
+
const raw = readFileSync(url, "utf8");
|
|
54
|
+
const parsed = JSON.parse(raw);
|
|
55
|
+
return parsed.version ?? "0.0.0";
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return "0.0.0";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function resolveConnectionOrNull(args) {
|
|
10
62
|
const conn = readActiveConnection({
|
|
11
63
|
urlOverride: args.url ?? null,
|
|
12
64
|
authTokenOverride: args.token ?? null,
|
|
13
65
|
});
|
|
14
|
-
if (!conn)
|
|
15
|
-
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
66
|
+
if (!conn)
|
|
67
|
+
return null;
|
|
18
68
|
return {
|
|
19
69
|
url: trimTrailingSlash(conn.url),
|
|
20
70
|
token: conn.auth_token ?? null,
|
|
21
71
|
};
|
|
22
72
|
}
|
|
73
|
+
function runInterfCli(args) {
|
|
74
|
+
const binPath = process.argv[1];
|
|
75
|
+
if (!binPath) {
|
|
76
|
+
return Promise.resolve({
|
|
77
|
+
code: 1,
|
|
78
|
+
signal: null,
|
|
79
|
+
stdout: "",
|
|
80
|
+
stderr: "Cannot locate the Interf CLI entrypoint.",
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return new Promise((resolve) => {
|
|
84
|
+
const child = spawn(process.execPath, [binPath, ...args], {
|
|
85
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
86
|
+
env: process.env,
|
|
87
|
+
});
|
|
88
|
+
let stdout = "";
|
|
89
|
+
let stderr = "";
|
|
90
|
+
child.stdout.setEncoding("utf8");
|
|
91
|
+
child.stderr.setEncoding("utf8");
|
|
92
|
+
child.stdout.on("data", (chunk) => {
|
|
93
|
+
stdout += chunk;
|
|
94
|
+
});
|
|
95
|
+
child.stderr.on("data", (chunk) => {
|
|
96
|
+
stderr += chunk;
|
|
97
|
+
});
|
|
98
|
+
child.on("error", (error) => {
|
|
99
|
+
resolve({
|
|
100
|
+
code: 1,
|
|
101
|
+
signal: null,
|
|
102
|
+
stdout,
|
|
103
|
+
stderr: stderr || error.message,
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
child.on("close", (code, signal) => {
|
|
107
|
+
resolve({ code, signal, stdout, stderr });
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
}
|
|
23
111
|
async function callApi(conn, path, init = {}) {
|
|
24
112
|
const headers = new Headers(init.headers ?? {});
|
|
25
113
|
if (conn.token)
|
|
@@ -57,38 +145,109 @@ function toolErrorJson(message, payload) {
|
|
|
57
145
|
isError: true,
|
|
58
146
|
};
|
|
59
147
|
}
|
|
60
|
-
|
|
148
|
+
function cliToolResult(result) {
|
|
149
|
+
const output = [
|
|
150
|
+
result.stdout.trim(),
|
|
151
|
+
result.stderr.trim(),
|
|
152
|
+
].filter(Boolean).join("\n");
|
|
153
|
+
if (result.code === 0)
|
|
154
|
+
return toolResultJson(output || "OK");
|
|
155
|
+
return toolErrorJson(`interf command exited with ${result.signal ?? result.code ?? "unknown"}.`, output);
|
|
156
|
+
}
|
|
157
|
+
async function callAndReturn(args, path, init = {}) {
|
|
158
|
+
const conn = resolveConnectionOrNull(args);
|
|
159
|
+
if (!conn)
|
|
160
|
+
return toolErrorJson(CONNECT_OR_ERROR_HINT);
|
|
61
161
|
const response = await callApi(conn, path, init);
|
|
62
162
|
if (response.status >= 200 && response.status < 300) {
|
|
63
163
|
return toolResultJson(response.body ?? response.raw);
|
|
64
164
|
}
|
|
65
165
|
return toolErrorJson(`Local service responded with HTTP ${response.status}.`, response.body ?? response.raw);
|
|
66
166
|
}
|
|
67
|
-
function registerTools(server,
|
|
167
|
+
function registerTools(server, connectionArgs) {
|
|
168
|
+
// ── Local engine lifecycle ─────────────────────────────────────────────
|
|
169
|
+
server.registerTool("web_start", {
|
|
170
|
+
title: "Start local Interf engine",
|
|
171
|
+
description: "Start the Interf engine in the background on the user's machine. "
|
|
172
|
+
+ "Use this when no Interf instance is connected yet.",
|
|
173
|
+
inputSchema: {
|
|
174
|
+
host: z.string().min(1).optional().describe("Host to bind. Defaults to 127.0.0.1."),
|
|
175
|
+
port: z.number().int().positive().optional().describe("Port to bind. Defaults to 4873."),
|
|
176
|
+
timeout_ms: z.number().int().positive().optional().describe("Startup timeout in milliseconds."),
|
|
177
|
+
log: z.string().min(1).optional().describe("Optional path for background engine logs."),
|
|
178
|
+
},
|
|
179
|
+
}, async (args) => {
|
|
180
|
+
const cliArgs = ["web", "start"];
|
|
181
|
+
if (args.host)
|
|
182
|
+
cliArgs.push("--host", args.host);
|
|
183
|
+
if (args.port)
|
|
184
|
+
cliArgs.push("--port", String(args.port));
|
|
185
|
+
if (args.timeout_ms)
|
|
186
|
+
cliArgs.push("--timeout-ms", String(args.timeout_ms));
|
|
187
|
+
if (args.log)
|
|
188
|
+
cliArgs.push("--log", args.log);
|
|
189
|
+
return cliToolResult(await runInterfCli(cliArgs));
|
|
190
|
+
});
|
|
191
|
+
server.registerTool("web_stop", {
|
|
192
|
+
title: "Stop local Interf engine",
|
|
193
|
+
description: "Stop the connected Interf engine or the live engine recorded in the "
|
|
194
|
+
+ "local service registry.",
|
|
195
|
+
inputSchema: {
|
|
196
|
+
url: z.string().url().optional().describe("Optional engine URL to stop."),
|
|
197
|
+
token: z.string().min(1).optional().describe("Optional bearer token."),
|
|
198
|
+
},
|
|
199
|
+
}, async (args) => {
|
|
200
|
+
const cliArgs = ["web", "stop"];
|
|
201
|
+
if (args.url)
|
|
202
|
+
cliArgs.push("--url", args.url);
|
|
203
|
+
if (args.token)
|
|
204
|
+
cliArgs.push("--token", args.token);
|
|
205
|
+
return cliToolResult(await runInterfCli(cliArgs));
|
|
206
|
+
});
|
|
207
|
+
server.registerTool("web_status", {
|
|
208
|
+
title: "Show local Interf engine status",
|
|
209
|
+
description: "Return the connected engine status using the same connection record "
|
|
210
|
+
+ "as the CLI.",
|
|
211
|
+
inputSchema: {
|
|
212
|
+
url: z.string().url().optional().describe("Optional engine URL."),
|
|
213
|
+
token: z.string().min(1).optional().describe("Optional bearer token."),
|
|
214
|
+
},
|
|
215
|
+
}, async (args) => {
|
|
216
|
+
const cliArgs = ["web", "status"];
|
|
217
|
+
if (args.url)
|
|
218
|
+
cliArgs.push("--url", args.url);
|
|
219
|
+
if (args.token)
|
|
220
|
+
cliArgs.push("--token", args.token);
|
|
221
|
+
return cliToolResult(await runInterfCli(cliArgs));
|
|
222
|
+
});
|
|
68
223
|
// ── Preparations ────────────────────────────────────────────────────────
|
|
69
224
|
server.registerTool("prep_list", {
|
|
70
225
|
title: "List preparations",
|
|
71
226
|
description: "List every Preparation registered on the connected Interf instance, "
|
|
72
|
-
+ "with source binding, Method id, and current readiness.",
|
|
227
|
+
+ "with source binding, Build Plan / Method package id, and current readiness.",
|
|
73
228
|
inputSchema: {},
|
|
74
|
-
}, async () => callAndReturn(
|
|
229
|
+
}, async () => callAndReturn(connectionArgs, LOCAL_SERVICE_ROUTES.preparations));
|
|
75
230
|
server.registerTool("prep_create", {
|
|
76
231
|
title: "Create a preparation",
|
|
77
|
-
description: "Create a new Preparation. The Preparation binds a Source
|
|
78
|
-
+ "
|
|
232
|
+
description: "Create a new Preparation. The Preparation binds a Source, "
|
|
233
|
+
+ "agent intent, requested Artifacts, and optional Build Plan.",
|
|
79
234
|
inputSchema: {
|
|
80
235
|
id: z.string().min(1).describe("Preparation id (kebab-case)."),
|
|
81
|
-
source_path: z.string().min(1).describe("
|
|
82
|
-
method_id: z.string().min(1).optional().describe("Optional Method id to
|
|
236
|
+
source_path: z.string().min(1).describe("Source path visible to the connected instance."),
|
|
237
|
+
method_id: z.string().min(1).optional().describe("Optional Build Plan / Method id to select. Select later with prep_set_method if omitted."),
|
|
83
238
|
about: z.string().min(1).optional().describe("Optional human-readable description."),
|
|
239
|
+
requested_artifacts: z.array(RequestedArtifactSchema).optional().describe("Requested Artifacts the agent/user confirmed for this Preparation."),
|
|
240
|
+
source_profile: SourceProfileSchema.optional().describe("Advisory source profile from the agent's inspection before compile."),
|
|
84
241
|
},
|
|
85
|
-
}, async (args) => callAndReturn(
|
|
242
|
+
}, async (args) => callAndReturn(connectionArgs, LOCAL_SERVICE_ROUTES.preparations, {
|
|
86
243
|
method: "POST",
|
|
87
244
|
body: JSON.stringify({
|
|
88
245
|
id: args.id,
|
|
89
246
|
source: { kind: "local-folder", locator: args.source_path },
|
|
90
247
|
...(args.method_id ? { method_id: args.method_id } : {}),
|
|
91
248
|
...(args.about ? { about: args.about } : {}),
|
|
249
|
+
...(args.requested_artifacts ? { requested_artifacts: args.requested_artifacts } : {}),
|
|
250
|
+
...(args.source_profile ? { source_profile: args.source_profile } : {}),
|
|
92
251
|
}),
|
|
93
252
|
}));
|
|
94
253
|
server.registerTool("prep_show", {
|
|
@@ -97,16 +256,16 @@ function registerTools(server, conn) {
|
|
|
97
256
|
inputSchema: {
|
|
98
257
|
id: z.string().min(1).describe("Preparation id."),
|
|
99
258
|
},
|
|
100
|
-
}, async (args) => callAndReturn(
|
|
259
|
+
}, async (args) => callAndReturn(connectionArgs, preparationResourcePath(args.id)));
|
|
101
260
|
server.registerTool("prep_set_method", {
|
|
102
|
-
title: "
|
|
103
|
-
description: "Update the Method binding on a Preparation. Use this to swap "
|
|
104
|
-
+ "
|
|
261
|
+
title: "Select a Build Plan for a Preparation",
|
|
262
|
+
description: "Update the Build Plan / Method-package binding on a Preparation. Use this to swap "
|
|
263
|
+
+ "Build Plans between compile runs without rebuilding the Preparation.",
|
|
105
264
|
inputSchema: {
|
|
106
265
|
id: z.string().min(1).describe("Preparation id."),
|
|
107
|
-
method_id: z.string().min(1).describe("Method id to
|
|
266
|
+
method_id: z.string().min(1).describe("Build Plan / Method id to use."),
|
|
108
267
|
},
|
|
109
|
-
}, async (args) => callAndReturn(
|
|
268
|
+
}, async (args) => callAndReturn(connectionArgs, preparationResourcePath(args.id), {
|
|
110
269
|
method: "PATCH",
|
|
111
270
|
body: JSON.stringify({ method_id: args.method_id }),
|
|
112
271
|
}));
|
|
@@ -116,10 +275,10 @@ function registerTools(server, conn) {
|
|
|
116
275
|
inputSchema: {
|
|
117
276
|
id: z.string().min(1).describe("Preparation id."),
|
|
118
277
|
},
|
|
119
|
-
}, async (args) => callAndReturn(
|
|
278
|
+
}, async (args) => callAndReturn(connectionArgs, preparationResourcePath(args.id), {
|
|
120
279
|
method: "DELETE",
|
|
121
280
|
}));
|
|
122
|
-
// ── Compile +
|
|
281
|
+
// ── Compile + readiness-check runs ─────────────────────────────────────
|
|
123
282
|
server.registerTool("prep_compile", {
|
|
124
283
|
title: "Start a compile run",
|
|
125
284
|
description: "Kick off a compile run for a Preparation. Returns the new run "
|
|
@@ -128,41 +287,84 @@ function registerTools(server, conn) {
|
|
|
128
287
|
inputSchema: {
|
|
129
288
|
id: z.string().min(1).describe("Preparation id."),
|
|
130
289
|
},
|
|
131
|
-
}, async (args) => callAndReturn(
|
|
132
|
-
server.registerTool("
|
|
290
|
+
}, async (args) => callAndReturn(connectionArgs, preparationSubresourcePath(args.id, "compileRuns"), { method: "POST", body: "{}" }));
|
|
291
|
+
server.registerTool("prep_test", {
|
|
133
292
|
title: "Run readiness checks",
|
|
134
293
|
description: "Run the Preparation's readiness checks against the latest portable "
|
|
135
|
-
+ "context.
|
|
294
|
+
+ "context.",
|
|
136
295
|
inputSchema: {
|
|
137
296
|
id: z.string().min(1).describe("Preparation id."),
|
|
138
297
|
},
|
|
139
|
-
}, async (args) => callAndReturn(
|
|
298
|
+
}, async (args) => callAndReturn(connectionArgs, preparationSubresourcePath(args.id, "verifyRuns"), {
|
|
140
299
|
method: "POST",
|
|
141
300
|
body: JSON.stringify({}),
|
|
142
301
|
}));
|
|
143
302
|
// ── Methods ─────────────────────────────────────────────────────────────
|
|
144
303
|
server.registerTool("method_list", {
|
|
145
304
|
title: "List Methods",
|
|
146
|
-
description: "List every Method visible to the connected instance:
|
|
147
|
-
+ "
|
|
305
|
+
description: "List every Method visible to the connected instance: user-authored "
|
|
306
|
+
+ "Methods, the user library at ~/.interf/methods/, and bundled Methods.",
|
|
148
307
|
inputSchema: {},
|
|
149
|
-
}, async () => callAndReturn(
|
|
308
|
+
}, async () => callAndReturn(connectionArgs, LOCAL_SERVICE_ROUTES.methods));
|
|
150
309
|
server.registerTool("method_draft", {
|
|
151
|
-
title: "
|
|
152
|
-
description: "Run the
|
|
153
|
-
+ "
|
|
310
|
+
title: "Draft a Build Plan",
|
|
311
|
+
description: "Run the Build Plan authoring agent for a Preparation. Saved requested "
|
|
312
|
+
+ "Artifacts are used automatically when omitted from the request.",
|
|
154
313
|
inputSchema: {
|
|
155
314
|
prep_id: z.string().min(1).describe("Preparation id."),
|
|
315
|
+
source_folder_path: z.string().min(1).describe("Source folder path visible to the connected instance."),
|
|
316
|
+
method_id: z.string().min(1).describe("Build Plan / Method id to create."),
|
|
317
|
+
label: z.string().min(1).describe("Human-readable Build Plan label."),
|
|
318
|
+
hint: z.string().min(1).describe("Short Build Plan hint."),
|
|
319
|
+
task_prompt: z.string().min(1).describe("Agent job this Build Plan should support."),
|
|
320
|
+
requested_artifacts: z.array(RequestedArtifactSchema).optional(),
|
|
321
|
+
source_profile: SourceProfileSchema.nullable().optional(),
|
|
322
|
+
artifact_requirements: z.array(MethodAuthoringArtifactRequirementSchema).optional(),
|
|
156
323
|
},
|
|
157
|
-
}, async (args) => callAndReturn(
|
|
324
|
+
}, async (args) => callAndReturn(connectionArgs, preparationSubresourcePath(args.prep_id, "methodAuthoringRuns"), {
|
|
325
|
+
method: "POST",
|
|
326
|
+
body: JSON.stringify({
|
|
327
|
+
preparation: args.prep_id,
|
|
328
|
+
source_folder_path: args.source_folder_path,
|
|
329
|
+
method_id: args.method_id,
|
|
330
|
+
label: args.label,
|
|
331
|
+
hint: args.hint,
|
|
332
|
+
task_prompt: args.task_prompt,
|
|
333
|
+
...(args.requested_artifacts ? { requested_artifacts: args.requested_artifacts } : {}),
|
|
334
|
+
...(args.source_profile !== undefined ? { source_profile: args.source_profile } : {}),
|
|
335
|
+
...(args.artifact_requirements ? { artifact_requirements: args.artifact_requirements } : {}),
|
|
336
|
+
}),
|
|
337
|
+
}));
|
|
158
338
|
server.registerTool("method_improve", {
|
|
159
|
-
title: "
|
|
160
|
-
description: "Run the
|
|
161
|
-
+ "the
|
|
339
|
+
title: "Improve a Build Plan",
|
|
340
|
+
description: "Run the Build Plan improvement agent for a Preparation. Iterates on "
|
|
341
|
+
+ "the selected Method package based on requested Artifacts and latest readiness evidence.",
|
|
162
342
|
inputSchema: {
|
|
163
343
|
prep_id: z.string().min(1).describe("Preparation id."),
|
|
344
|
+
source_folder_path: z.string().min(1).describe("Source folder path visible to the connected instance."),
|
|
345
|
+
method_id: z.string().min(1).describe("Selected Build Plan / Method id to improve."),
|
|
346
|
+
label: z.string().min(1).describe("Human-readable Build Plan label."),
|
|
347
|
+
hint: z.string().min(1).describe("Short Build Plan hint."),
|
|
348
|
+
task_prompt: z.string().min(1).describe("Change request or improvement goal."),
|
|
349
|
+
requested_artifacts: z.array(RequestedArtifactSchema).optional(),
|
|
350
|
+
source_profile: SourceProfileSchema.nullable().optional(),
|
|
351
|
+
artifact_requirements: z.array(MethodAuthoringArtifactRequirementSchema).optional(),
|
|
164
352
|
},
|
|
165
|
-
}, async (args) => callAndReturn(
|
|
353
|
+
}, async (args) => callAndReturn(connectionArgs, preparationSubresourcePath(args.prep_id, "methodImprovementRuns"), {
|
|
354
|
+
method: "POST",
|
|
355
|
+
body: JSON.stringify({
|
|
356
|
+
preparation: args.prep_id,
|
|
357
|
+
source_folder_path: args.source_folder_path,
|
|
358
|
+
method_id: args.method_id,
|
|
359
|
+
reference_method_id: args.method_id,
|
|
360
|
+
label: args.label,
|
|
361
|
+
hint: args.hint,
|
|
362
|
+
task_prompt: args.task_prompt,
|
|
363
|
+
...(args.requested_artifacts ? { requested_artifacts: args.requested_artifacts } : {}),
|
|
364
|
+
...(args.source_profile !== undefined ? { source_profile: args.source_profile } : {}),
|
|
365
|
+
...(args.artifact_requirements ? { artifact_requirements: args.artifact_requirements } : {}),
|
|
366
|
+
}),
|
|
367
|
+
}));
|
|
166
368
|
// ── Runs ────────────────────────────────────────────────────────────────
|
|
167
369
|
server.registerTool("runs_status", {
|
|
168
370
|
title: "Get run status",
|
|
@@ -170,7 +372,7 @@ function registerTools(server, conn) {
|
|
|
170
372
|
inputSchema: {
|
|
171
373
|
run_id: z.string().min(1).describe("Run id."),
|
|
172
374
|
},
|
|
173
|
-
}, async (args) => callAndReturn(
|
|
375
|
+
}, async (args) => callAndReturn(connectionArgs, runResourcePath(args.run_id)));
|
|
174
376
|
server.registerTool("runs_watch", {
|
|
175
377
|
title: "Read run events",
|
|
176
378
|
description: "Read the events log for one run as a snapshot. Returns the same "
|
|
@@ -179,14 +381,14 @@ function registerTools(server, conn) {
|
|
|
179
381
|
inputSchema: {
|
|
180
382
|
run_id: z.string().min(1).describe("Run id."),
|
|
181
383
|
},
|
|
182
|
-
}, async (args) => callAndReturn(
|
|
384
|
+
}, async (args) => callAndReturn(connectionArgs, runSubresourcePath(args.run_id, "events")));
|
|
183
385
|
server.registerTool("runs_cancel", {
|
|
184
386
|
title: "Cancel a run",
|
|
185
387
|
description: "Request cancellation of an in-flight run.",
|
|
186
388
|
inputSchema: {
|
|
187
389
|
run_id: z.string().min(1).describe("Run id."),
|
|
188
390
|
},
|
|
189
|
-
}, async (args) => callAndReturn(
|
|
391
|
+
}, async (args) => callAndReturn(connectionArgs, runSubresourcePath(args.run_id, "cancel"), { method: "POST", body: "{}" }));
|
|
190
392
|
server.registerTool("runs_fetch", {
|
|
191
393
|
title: "Fetch run artifacts",
|
|
192
394
|
description: "Return the artifact manifest for a finished run (portable context, "
|
|
@@ -194,19 +396,18 @@ function registerTools(server, conn) {
|
|
|
194
396
|
inputSchema: {
|
|
195
397
|
run_id: z.string().min(1).describe("Run id."),
|
|
196
398
|
},
|
|
197
|
-
}, async (args) => callAndReturn(
|
|
399
|
+
}, async (args) => callAndReturn(connectionArgs, runSubresourcePath(args.run_id, "artifacts")));
|
|
198
400
|
// ── Instance ────────────────────────────────────────────────────────────
|
|
199
401
|
server.registerTool("instance_status", {
|
|
200
402
|
title: "Show instance status",
|
|
201
403
|
description: "Return the engine's instance resource: started_at, package "
|
|
202
404
|
+ "version, registered preparations, active runs, idle seconds.",
|
|
203
405
|
inputSchema: {},
|
|
204
|
-
}, async () => callAndReturn(
|
|
406
|
+
}, async () => callAndReturn(connectionArgs, LOCAL_SERVICE_ROUTES.instance));
|
|
205
407
|
}
|
|
206
408
|
async function startStdioServer(args) {
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
registerTools(server, conn);
|
|
409
|
+
const server = new McpServer({ name: "interf", version: packageVersionFromManifest() }, { capabilities: { tools: {} } });
|
|
410
|
+
registerTools(server, args);
|
|
210
411
|
const transport = new StdioServerTransport();
|
|
211
412
|
await server.connect(transport);
|
|
212
413
|
}
|