@interf/compiler 0.9.4 → 0.13.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 +96 -91
- package/TRADEMARKS.md +2 -13
- package/agent-skills/interf-actions/SKILL.md +97 -32
- package/agent-skills/interf-actions/references/cli.md +124 -71
- 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/compile.d.ts +9 -31
- package/dist/cli/commands/compile.js +75 -388
- package/dist/cli/commands/doctor.js +1 -1
- 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/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 +134 -0
- package/dist/cli/commands/reset.d.ts +8 -1
- package/dist/cli/commands/reset.js +47 -15
- 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 +61 -220
- package/dist/cli/commands/test.d.ts +6 -15
- package/dist/cli/commands/test.js +63 -342
- package/dist/cli/commands/web.d.ts +0 -9
- package/dist/cli/commands/web.js +140 -367
- package/dist/cli/commands/wizard.d.ts +9 -0
- package/dist/cli/commands/wizard.js +442 -0
- package/dist/cli/index.d.ts +7 -6
- package/dist/cli/index.js +13 -10
- package/dist/compiler-ui/404.html +1 -1
- package/dist/compiler-ui/__next.__PAGE__.txt +2 -2
- package/dist/compiler-ui/__next._full.txt +3 -3
- package/dist/compiler-ui/__next._head.txt +1 -1
- package/dist/compiler-ui/__next._index.txt +2 -2
- package/dist/compiler-ui/__next._tree.txt +2 -2
- package/dist/compiler-ui/_next/static/chunks/045gole2ojo3g.css +3 -0
- package/dist/compiler-ui/_next/static/chunks/17t-lulmyawg5.js +89 -0
- package/dist/compiler-ui/_not-found/__next._full.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._head.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._index.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._not-found.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._tree.txt +2 -2
- package/dist/compiler-ui/_not-found.html +1 -1
- package/dist/compiler-ui/_not-found.txt +2 -2
- package/dist/compiler-ui/index.html +1 -1
- package/dist/compiler-ui/index.txt +3 -3
- package/dist/index.d.ts +0 -23
- package/dist/index.js +0 -16
- package/dist/packages/agents/lib/shells.d.ts +1 -1
- package/dist/packages/agents/lib/shells.js +113 -54
- package/dist/packages/agents/lib/user-config.d.ts +4 -2
- package/dist/packages/agents/lib/user-config.js +15 -7
- package/dist/packages/compiler/compiled-paths.d.ts +9 -2
- package/dist/packages/compiler/compiled-paths.js +30 -15
- package/dist/packages/compiler/compiled-pipeline.js +23 -3
- package/dist/packages/compiler/compiled-stage-plan.js +4 -0
- package/dist/packages/compiler/compiled-target.d.ts +1 -1
- package/dist/packages/compiler/compiled-target.js +1 -1
- package/dist/packages/compiler/index.d.ts +1 -0
- package/dist/packages/compiler/index.js +1 -0
- package/dist/packages/compiler/lib/schema.d.ts +27 -32
- package/dist/packages/compiler/lib/schema.js +2 -13
- package/dist/packages/compiler/method-runs.d.ts +2 -3
- package/dist/packages/compiler/method-runs.js +2 -3
- package/dist/packages/compiler/reset.js +3 -1
- package/dist/packages/compiler/runtime-contracts.js +0 -3
- package/dist/packages/compiler/runtime-prompt.js +1 -1
- package/dist/packages/compiler/source-files.d.ts +46 -0
- package/dist/packages/compiler/source-files.js +149 -0
- package/dist/packages/compiler/state-artifacts.d.ts +3 -2
- package/dist/packages/compiler/state-artifacts.js +4 -3
- package/dist/packages/compiler/state-io.d.ts +3 -2
- package/dist/packages/compiler/state-io.js +11 -5
- package/dist/packages/compiler/state-paths.d.ts +2 -1
- package/dist/packages/compiler/state-paths.js +6 -3
- package/dist/packages/compiler/state-view.d.ts +3 -2
- package/dist/packages/compiler/state-view.js +18 -28
- package/dist/packages/compiler/state.d.ts +4 -4
- package/dist/packages/compiler/state.js +3 -3
- package/dist/packages/contracts/index.d.ts +1 -1
- 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 +85 -6
- package/dist/packages/contracts/lib/schema.js +46 -2
- package/dist/packages/execution/lib/schema.d.ts +50 -57
- package/dist/packages/execution/lib/schema.js +1 -2
- package/dist/packages/local-service/action-definitions.d.ts +246 -0
- package/dist/packages/local-service/action-definitions.js +1147 -0
- package/dist/packages/local-service/action-planner.d.ts +9 -0
- package/dist/packages/local-service/action-planner.js +135 -0
- package/dist/packages/local-service/action-values.d.ts +1 -23
- package/dist/packages/local-service/action-values.js +1 -31
- package/dist/packages/local-service/client.d.ts +76 -46
- package/dist/packages/local-service/client.js +184 -149
- package/dist/packages/local-service/connection-config.d.ts +38 -0
- package/dist/packages/local-service/connection-config.js +75 -0
- package/dist/packages/local-service/index.d.ts +14 -7
- package/dist/packages/local-service/index.js +8 -4
- package/dist/packages/local-service/instance-paths.d.ts +100 -0
- package/dist/packages/local-service/instance-paths.js +165 -0
- package/dist/packages/local-service/lib/schema.d.ts +689 -2575
- package/dist/packages/local-service/lib/schema.js +260 -101
- package/dist/packages/local-service/native-run-handlers.d.ts +23 -0
- package/dist/{cli/commands/compile-controller.js → packages/local-service/native-run-handlers.js} +204 -20
- package/dist/packages/local-service/preparation-store.d.ts +92 -0
- package/dist/packages/local-service/preparation-store.js +171 -0
- package/dist/{cli/commands/check-draft.d.ts → packages/local-service/readiness-check-draft.d.ts} +2 -2
- package/dist/packages/local-service/routes.d.ts +33 -11
- package/dist/packages/local-service/routes.js +44 -15
- package/dist/packages/local-service/run-observability.js +25 -27
- package/dist/packages/local-service/runtime-caches.d.ts +76 -0
- package/dist/packages/local-service/runtime-caches.js +191 -0
- package/dist/packages/local-service/runtime-event-applier.d.ts +12 -0
- package/dist/packages/local-service/runtime-event-applier.js +177 -0
- package/dist/packages/local-service/runtime-persistence.d.ts +47 -0
- package/dist/packages/local-service/runtime-persistence.js +137 -0
- package/dist/packages/local-service/runtime-proposal-helpers.d.ts +35 -0
- package/dist/packages/local-service/runtime-proposal-helpers.js +251 -0
- package/dist/packages/local-service/runtime-resource-builders.d.ts +52 -0
- package/dist/packages/local-service/runtime-resource-builders.js +149 -0
- package/dist/packages/local-service/runtime.d.ts +201 -44
- package/dist/packages/local-service/runtime.js +1062 -1106
- package/dist/packages/local-service/server.d.ts +15 -0
- package/dist/packages/local-service/server.js +651 -233
- package/dist/packages/local-service/service-registry.d.ts +47 -0
- package/dist/packages/local-service/service-registry.js +137 -0
- package/dist/packages/method-authoring/method-authoring.d.ts +1 -1
- package/dist/packages/method-authoring/method-authoring.js +2 -2
- package/dist/packages/method-authoring/method-improvement.js +1 -1
- package/dist/packages/method-package/builtin-compiled-method.d.ts +4 -5
- package/dist/packages/method-package/builtin-compiled-method.js +8 -14
- package/dist/packages/method-package/context-interface.d.ts +4 -40
- package/dist/packages/method-package/context-interface.js +1 -23
- package/dist/packages/method-package/interf-method-package.d.ts +4 -4
- package/dist/packages/method-package/interf-method-package.js +21 -33
- package/dist/packages/method-package/local-methods.d.ts +10 -6
- package/dist/packages/method-package/local-methods.js +57 -39
- package/dist/packages/method-package/method-definitions.d.ts +8 -34
- package/dist/packages/method-package/method-definitions.js +49 -37
- package/dist/packages/method-package/method-helpers.d.ts +1 -13
- package/dist/packages/method-package/method-helpers.js +8 -42
- package/dist/packages/method-package/method-review-paths.d.ts +1 -1
- package/dist/packages/method-package/method-review-paths.js +5 -5
- package/dist/packages/method-package/method-stage-runner.js +2 -2
- package/dist/packages/method-package/user-methods.d.ts +17 -0
- package/dist/packages/method-package/user-methods.js +77 -0
- package/dist/packages/project-model/index.d.ts +1 -1
- package/dist/packages/project-model/index.js +1 -1
- package/dist/packages/project-model/interf-detect.d.ts +8 -3
- package/dist/packages/project-model/interf-detect.js +34 -34
- package/dist/packages/project-model/interf-scaffold.d.ts +3 -3
- package/dist/packages/project-model/interf-scaffold.js +23 -32
- package/dist/packages/project-model/lib/schema.js +38 -1
- package/dist/packages/project-model/preparation-entries.d.ts +11 -0
- package/dist/packages/project-model/preparation-entries.js +49 -0
- package/dist/packages/project-model/source-config.d.ts +11 -10
- package/dist/packages/project-model/source-config.js +83 -44
- package/dist/packages/project-model/source-folders.d.ts +5 -5
- package/dist/packages/project-model/source-folders.js +14 -14
- package/dist/packages/shared/filesystem.d.ts +7 -0
- package/dist/packages/shared/filesystem.js +97 -10
- package/dist/packages/testing/lib/schema.d.ts +12 -13
- package/dist/packages/testing/lib/schema.js +4 -5
- package/dist/packages/testing/readiness-check-run.d.ts +7 -7
- package/dist/packages/testing/readiness-check-run.js +46 -51
- package/dist/packages/testing/test-execution.js +6 -6
- package/dist/packages/testing/test-paths.js +4 -3
- package/dist/packages/testing/test-sandbox.d.ts +0 -1
- package/dist/packages/testing/test-sandbox.js +14 -30
- package/dist/packages/testing/test-targets.d.ts +1 -1
- package/dist/packages/testing/test-targets.js +6 -6
- package/dist/packages/testing/test.d.ts +1 -1
- package/dist/packages/testing/test.js +1 -1
- package/package.json +6 -26
- package/LICENSE +0 -183
- package/dist/cli/commands/compile-controller.d.ts +0 -17
- package/dist/cli/commands/compiled-flow.d.ts +0 -25
- package/dist/cli/commands/compiled-flow.js +0 -112
- 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 -76
- package/dist/cli/commands/create-method-wizard.js +0 -465
- package/dist/cli/commands/create.d.ts +0 -8
- package/dist/cli/commands/create.js +0 -189
- 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 -11
- package/dist/cli/commands/init.js +0 -784
- package/dist/cli/commands/list.d.ts +0 -2
- package/dist/cli/commands/list.js +0 -30
- package/dist/cli/commands/preparation-selection.d.ts +0 -6
- package/dist/cli/commands/preparation-selection.js +0 -11
- package/dist/cli/commands/source-config-wizard.d.ts +0 -52
- package/dist/cli/commands/source-config-wizard.js +0 -680
- package/dist/cli/commands/test-flow.d.ts +0 -58
- package/dist/cli/commands/test-flow.js +0 -231
- package/dist/cli/commands/verify.d.ts +0 -2
- package/dist/cli/commands/verify.js +0 -94
- package/dist/compiler-ui/_next/static/chunks/0d~8t0zm6545p.js +0 -118
- package/dist/compiler-ui/_next/static/chunks/0xnel.ax9a.2c.css +0 -3
- package/dist/packages/compiler/raw-snapshot.d.ts +0 -49
- package/dist/packages/compiler/raw-snapshot.js +0 -101
- 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/project-paths.d.ts +0 -12
- package/dist/packages/project-model/project-paths.js +0 -33
- /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → C6vVfy3aeYuIO3d2AoNvC}/_buildManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → C6vVfy3aeYuIO3d2AoNvC}/_clientMiddlewareManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → C6vVfy3aeYuIO3d2AoNvC}/_ssgManifest.js +0 -0
- /package/dist/{cli/commands/check-draft.js → packages/local-service/readiness-check-draft.js} +0 -0
|
@@ -1,7 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { CompileRunCreateRequestSchema, CompileRunResourceSchema, ActionProposalApprovalRequestSchema, ActionProposalCreateRequestSchema, ActionProposalResourceSchema, LocalJobRunResourceSchema, LocalServiceHealthSchema, ReadinessCheckDraftCreateRequestSchema, ReadinessCheckDraftResultSchema, ResetRequestSchema, ResetResultSchema, TestRunCreateRequestSchema, TestRunResourceSchema, MethodAuthoringCreateRequestSchema, MethodAuthoringResultSchema, } from "./lib/schema.js";
|
|
2
|
+
import { LOCAL_SERVICE_ROUTES, buildLocalServiceUrl, preparationSubresourcePath, } from "./routes.js";
|
|
3
|
+
import { readActiveConnection } from "./connection-config.js";
|
|
4
|
+
async function connectOrNull(options = {}) {
|
|
5
|
+
const conn = readActiveConnection({
|
|
6
|
+
urlOverride: options.url ?? null,
|
|
7
|
+
authTokenOverride: options.authToken ?? null,
|
|
8
|
+
});
|
|
9
|
+
if (!conn)
|
|
10
|
+
return null;
|
|
11
|
+
// Probe the engine; we expose the LocalServiceHealth-shaped object the
|
|
12
|
+
// legacy callers expect so submitCompileRun et al. keep compiling.
|
|
13
|
+
try {
|
|
14
|
+
const headers = {};
|
|
15
|
+
if (conn.auth_token)
|
|
16
|
+
headers["authorization"] = `Bearer ${conn.auth_token}`;
|
|
17
|
+
const response = await fetch(`${conn.url.replace(/\/+$/, "")}/health`, { headers });
|
|
18
|
+
if (response.status !== 200)
|
|
19
|
+
return null;
|
|
20
|
+
const health = (await response.json());
|
|
21
|
+
return { serviceUrl: conn.url, health, authToken: conn.auth_token ?? null };
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
5
27
|
function trimTrailingSlash(value) {
|
|
6
28
|
return value.replace(/\/+$/, "");
|
|
7
29
|
}
|
|
@@ -11,26 +33,17 @@ export function configuredLocalServiceUrl() {
|
|
|
11
33
|
return trimTrailingSlash(explicit);
|
|
12
34
|
return buildLocalServiceUrl();
|
|
13
35
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function localServiceUrlCandidates(projectPath) {
|
|
27
|
-
const explicit = process.env.INTERF_SERVICE_URL?.trim();
|
|
36
|
+
/**
|
|
37
|
+
* Resolve the bearer token for the active connection. In 0.13 there is
|
|
38
|
+
* exactly one source of truth: `~/.interf/connection.json` (or the
|
|
39
|
+
* `INTERF_SERVICE_TOKEN` env override).
|
|
40
|
+
*/
|
|
41
|
+
export function resolveLocalServiceAuthToken() {
|
|
42
|
+
const explicit = process.env.INTERF_SERVICE_TOKEN?.trim();
|
|
28
43
|
if (explicit)
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
buildLocalServiceUrl(),
|
|
33
|
-
].filter((value) => Boolean(value))));
|
|
44
|
+
return explicit;
|
|
45
|
+
const conn = readActiveConnection();
|
|
46
|
+
return conn?.auth_token ?? null;
|
|
34
47
|
}
|
|
35
48
|
async function fetchJson(url, options = {}) {
|
|
36
49
|
const controller = new AbortController();
|
|
@@ -54,40 +67,35 @@ async function fetchJson(url, options = {}) {
|
|
|
54
67
|
clearTimeout(timeout);
|
|
55
68
|
}
|
|
56
69
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Resolve a connection. In 0.13 this is the only path to the engine — read
|
|
72
|
+
* `~/.interf/connection.json` (written by `interf web`) or honor the
|
|
73
|
+
* `INTERF_SERVICE_URL` / `INTERF_SERVICE_TOKEN` env overrides.
|
|
74
|
+
*/
|
|
75
|
+
export async function findLocalService(options = {}) {
|
|
76
|
+
void options.timeoutMs;
|
|
77
|
+
return connectOrNull();
|
|
63
78
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
for (const serviceUrl of localServiceUrlCandidates(options.projectPath)) {
|
|
67
|
-
try {
|
|
68
|
-
const health = LocalServiceHealthSchema.parse(await fetchJson(`${serviceUrl}${LOCAL_SERVICE_ROUTES.health}`, {
|
|
69
|
-
method: "GET",
|
|
70
|
-
timeoutMs: options.timeoutMs,
|
|
71
|
-
}));
|
|
72
|
-
if (!healthMatchesProject(health, options.projectPath, explicitServiceUrl)) {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
return { serviceUrl, health };
|
|
76
|
-
}
|
|
77
|
-
catch {
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return null;
|
|
79
|
+
function authHeaders(authToken) {
|
|
80
|
+
return authToken ? { authorization: `Bearer ${authToken}` } : {};
|
|
82
81
|
}
|
|
82
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
83
|
+
// Preparation-keyed run submission helpers (0.13)
|
|
84
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
83
85
|
export async function submitCompileRunToLocalService(options) {
|
|
84
|
-
const connection = await
|
|
86
|
+
const connection = await connectOrNull();
|
|
85
87
|
if (!connection)
|
|
86
88
|
return null;
|
|
87
89
|
const request = CompileRunCreateRequestSchema.parse(options.request);
|
|
88
|
-
const
|
|
90
|
+
const headers = {
|
|
91
|
+
...authHeaders(connection.authToken),
|
|
92
|
+
...(options.idempotencyKey ? { "x-interf-idempotency-key": options.idempotencyKey } : {}),
|
|
93
|
+
};
|
|
94
|
+
const url = `${connection.serviceUrl}${preparationSubresourcePath(options.preparationId, "compileRuns")}`;
|
|
95
|
+
const resource = CompileRunResourceSchema.parse(await fetchJson(url, {
|
|
89
96
|
method: "POST",
|
|
90
97
|
body: JSON.stringify(request),
|
|
98
|
+
headers,
|
|
91
99
|
}));
|
|
92
100
|
return {
|
|
93
101
|
serviceUrl: connection.serviceUrl,
|
|
@@ -95,19 +103,82 @@ export async function submitCompileRunToLocalService(options) {
|
|
|
95
103
|
};
|
|
96
104
|
}
|
|
97
105
|
export async function submitTestRunToLocalService(options) {
|
|
98
|
-
const connection = await
|
|
106
|
+
const connection = await connectOrNull();
|
|
99
107
|
if (!connection)
|
|
100
108
|
return null;
|
|
101
109
|
const request = TestRunCreateRequestSchema.parse(options.request);
|
|
102
|
-
const
|
|
110
|
+
const url = `${connection.serviceUrl}${preparationSubresourcePath(options.preparationId, "testRuns")}`;
|
|
111
|
+
const resource = TestRunResourceSchema.parse(await fetchJson(url, {
|
|
112
|
+
method: "POST",
|
|
113
|
+
body: JSON.stringify(request),
|
|
114
|
+
headers: authHeaders(connection.authToken),
|
|
115
|
+
}));
|
|
116
|
+
return {
|
|
117
|
+
serviceUrl: connection.serviceUrl,
|
|
118
|
+
resource,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export async function submitResetToLocalService(options) {
|
|
122
|
+
const connection = await connectOrNull();
|
|
123
|
+
if (!connection)
|
|
124
|
+
return null;
|
|
125
|
+
const request = ResetRequestSchema.parse(options.request);
|
|
126
|
+
const url = `${connection.serviceUrl}${preparationSubresourcePath(options.preparationId, "reset")}`;
|
|
127
|
+
const result = ResetResultSchema.parse(await fetchJson(url, {
|
|
128
|
+
method: "POST",
|
|
129
|
+
body: JSON.stringify(request),
|
|
130
|
+
headers: authHeaders(connection.authToken),
|
|
131
|
+
}));
|
|
132
|
+
return {
|
|
133
|
+
serviceUrl: connection.serviceUrl,
|
|
134
|
+
result,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
export async function createActionProposalInLocalService(options) {
|
|
138
|
+
const connection = await connectOrNull();
|
|
139
|
+
if (!connection)
|
|
140
|
+
return null;
|
|
141
|
+
const request = ActionProposalCreateRequestSchema.parse(options.request);
|
|
142
|
+
const resource = ActionProposalResourceSchema.parse(await fetchJson(`${connection.serviceUrl}${LOCAL_SERVICE_ROUTES.actionProposals}`, {
|
|
143
|
+
method: "POST",
|
|
144
|
+
body: JSON.stringify(request),
|
|
145
|
+
headers: authHeaders(connection.authToken),
|
|
146
|
+
}));
|
|
147
|
+
return {
|
|
148
|
+
serviceUrl: connection.serviceUrl,
|
|
149
|
+
resource,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
export async function decideActionProposalInLocalService(options) {
|
|
153
|
+
const connection = options.serviceUrl
|
|
154
|
+
? { serviceUrl: options.serviceUrl, authToken: options.authToken ?? resolveLocalServiceAuthToken() }
|
|
155
|
+
: (await connectOrNull());
|
|
156
|
+
if (!connection)
|
|
157
|
+
return null;
|
|
158
|
+
const request = ActionProposalApprovalRequestSchema.parse(options.request);
|
|
159
|
+
const resource = ActionProposalResourceSchema.parse(await fetchJson(`${connection.serviceUrl}${LOCAL_SERVICE_ROUTES.actionProposals}/${encodeURIComponent(options.proposalId)}/decision`, {
|
|
103
160
|
method: "POST",
|
|
104
161
|
body: JSON.stringify(request),
|
|
162
|
+
headers: authHeaders(connection.authToken ?? null),
|
|
105
163
|
}));
|
|
106
164
|
return {
|
|
107
165
|
serviceUrl: connection.serviceUrl,
|
|
108
166
|
resource,
|
|
109
167
|
};
|
|
110
168
|
}
|
|
169
|
+
export async function approveActionProposalInLocalService(options) {
|
|
170
|
+
const proposal = await createActionProposalInLocalService(options);
|
|
171
|
+
if (!proposal)
|
|
172
|
+
return null;
|
|
173
|
+
if (proposal.resource.status !== "awaiting_approval")
|
|
174
|
+
return proposal;
|
|
175
|
+
const decided = await decideActionProposalInLocalService({
|
|
176
|
+
proposalId: proposal.resource.proposal_id,
|
|
177
|
+
request: { approved: true },
|
|
178
|
+
serviceUrl: proposal.serviceUrl,
|
|
179
|
+
});
|
|
180
|
+
return decided ?? proposal;
|
|
181
|
+
}
|
|
111
182
|
function isTerminalJobStatus(status) {
|
|
112
183
|
return status === "succeeded" || status === "failed" || status === "cancelled";
|
|
113
184
|
}
|
|
@@ -115,85 +186,88 @@ function isTerminalRunStatus(status) {
|
|
|
115
186
|
return status === "succeeded" || status === "failed" || status === "cancelled";
|
|
116
187
|
}
|
|
117
188
|
export async function getLocalCompileRun(options) {
|
|
118
|
-
return CompileRunResourceSchema.parse(await fetchJson(`${options.serviceUrl}
|
|
189
|
+
return CompileRunResourceSchema.parse(await fetchJson(`${options.serviceUrl}/v1/compile-runs/${encodeURIComponent(options.runId)}`, {
|
|
119
190
|
method: "GET",
|
|
120
191
|
timeoutMs: 2000,
|
|
192
|
+
headers: authHeaders(options.authToken ?? resolveLocalServiceAuthToken()),
|
|
121
193
|
}));
|
|
122
194
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
method: "GET",
|
|
195
|
+
/**
|
|
196
|
+
* Ask the local service to cancel a running compile run by id. Resolves
|
|
197
|
+
* with the typed cancel result on success and throws when the service
|
|
198
|
+
* returns 404 (unknown run id) or any non-2xx status.
|
|
199
|
+
*/
|
|
200
|
+
export async function cancelLocalCompileRun(options) {
|
|
201
|
+
const value = await fetchJson(`${options.serviceUrl}/v1/compile-runs/${encodeURIComponent(options.runId)}/cancel`, {
|
|
202
|
+
method: "POST",
|
|
132
203
|
timeoutMs: options.timeoutMs ?? 2000,
|
|
133
|
-
|
|
204
|
+
headers: authHeaders(options.authToken ?? resolveLocalServiceAuthToken()),
|
|
205
|
+
});
|
|
206
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
207
|
+
throw new Error("Local service returned an unexpected cancel response.");
|
|
208
|
+
}
|
|
209
|
+
const record = value;
|
|
210
|
+
const cancelled = record.cancelled === true;
|
|
211
|
+
const reason = typeof record.reason === "string" && record.reason.trim().length > 0
|
|
212
|
+
? record.reason.trim()
|
|
213
|
+
: undefined;
|
|
214
|
+
return reason ? { cancelled, reason } : { cancelled };
|
|
134
215
|
}
|
|
135
216
|
export async function waitForLocalCompileRun(options) {
|
|
136
|
-
|
|
217
|
+
// Exponential backoff: start at 250ms (responsive for short runs) and
|
|
218
|
+
// double up to 4s (don't hammer the local service for long compile
|
|
219
|
+
// runs). When the caller passes an explicit `pollMs`, honor it as a
|
|
220
|
+
// fixed interval to keep the previous opt-out path.
|
|
221
|
+
const explicit = options.pollMs;
|
|
222
|
+
let delay = explicit ?? 250;
|
|
137
223
|
while (true) {
|
|
138
224
|
const resource = await getLocalCompileRun({
|
|
139
225
|
serviceUrl: options.serviceUrl,
|
|
140
226
|
runId: options.runId,
|
|
227
|
+
authToken: options.authToken ?? null,
|
|
141
228
|
});
|
|
142
229
|
options.onUpdate?.(resource);
|
|
143
230
|
if (isTerminalRunStatus(resource.run.status))
|
|
144
231
|
return resource;
|
|
145
|
-
await new Promise((resolveWait) => setTimeout(resolveWait,
|
|
232
|
+
await new Promise((resolveWait) => setTimeout(resolveWait, delay));
|
|
233
|
+
if (explicit === undefined) {
|
|
234
|
+
delay = Math.min(delay * 2, 4000);
|
|
235
|
+
}
|
|
146
236
|
}
|
|
147
237
|
}
|
|
148
238
|
export async function getLocalTestRun(options) {
|
|
149
|
-
return TestRunResourceSchema.parse(await fetchJson(`${options.serviceUrl}
|
|
239
|
+
return TestRunResourceSchema.parse(await fetchJson(`${options.serviceUrl}/v1/test-runs/${encodeURIComponent(options.runId)}`, {
|
|
150
240
|
method: "GET",
|
|
151
241
|
timeoutMs: 2000,
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
export async function listLocalTestRuns(options) {
|
|
155
|
-
return TestRunListResponseSchema.parse(await fetchJson(`${options.serviceUrl}${LOCAL_SERVICE_ROUTES.testRuns}`, {
|
|
156
|
-
method: "GET",
|
|
157
|
-
timeoutMs: options.timeoutMs ?? 2000,
|
|
242
|
+
headers: authHeaders(options.authToken ?? resolveLocalServiceAuthToken()),
|
|
158
243
|
}));
|
|
159
244
|
}
|
|
160
245
|
export async function waitForLocalTestRun(options) {
|
|
161
|
-
|
|
246
|
+
// Same exponential backoff as `waitForLocalCompileRun`.
|
|
247
|
+
const explicit = options.pollMs;
|
|
248
|
+
let delay = explicit ?? 250;
|
|
162
249
|
while (true) {
|
|
163
250
|
const resource = await getLocalTestRun({
|
|
164
251
|
serviceUrl: options.serviceUrl,
|
|
165
252
|
runId: options.runId,
|
|
253
|
+
authToken: options.authToken ?? null,
|
|
166
254
|
});
|
|
167
255
|
options.onUpdate?.(resource);
|
|
168
256
|
if (isTerminalRunStatus(resource.status))
|
|
169
257
|
return resource;
|
|
170
|
-
await new Promise((resolveWait) => setTimeout(resolveWait,
|
|
258
|
+
await new Promise((resolveWait) => setTimeout(resolveWait, delay));
|
|
259
|
+
if (explicit === undefined) {
|
|
260
|
+
delay = Math.min(delay * 2, 4000);
|
|
261
|
+
}
|
|
171
262
|
}
|
|
172
263
|
}
|
|
173
264
|
export async function getLocalJobRun(options) {
|
|
174
|
-
return LocalJobRunResourceSchema.parse(await fetchJson(`${options.serviceUrl}
|
|
265
|
+
return LocalJobRunResourceSchema.parse(await fetchJson(`${options.serviceUrl}/v1/jobs/${encodeURIComponent(options.runId)}`, {
|
|
175
266
|
method: "GET",
|
|
176
267
|
timeoutMs: 2000,
|
|
268
|
+
headers: authHeaders(options.authToken ?? resolveLocalServiceAuthToken()),
|
|
177
269
|
}));
|
|
178
270
|
}
|
|
179
|
-
export async function listLocalJobRuns(options) {
|
|
180
|
-
return LocalJobRunListResponseSchema.parse(await fetchJson(`${options.serviceUrl}${LOCAL_SERVICE_ROUTES.jobs}`, {
|
|
181
|
-
method: "GET",
|
|
182
|
-
timeoutMs: options.timeoutMs ?? 2000,
|
|
183
|
-
}));
|
|
184
|
-
}
|
|
185
|
-
export async function readLocalServiceRunSnapshot(options) {
|
|
186
|
-
const [jobs, compileRuns, testRuns] = await Promise.all([
|
|
187
|
-
listLocalJobRuns(options),
|
|
188
|
-
listLocalCompileRuns(options),
|
|
189
|
-
listLocalTestRuns(options),
|
|
190
|
-
]);
|
|
191
|
-
return {
|
|
192
|
-
jobs: jobs.jobs,
|
|
193
|
-
compileRuns: compileRuns.compile_runs,
|
|
194
|
-
testRuns: testRuns.test_runs,
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
271
|
export async function waitForLocalJobRun(options) {
|
|
198
272
|
const startedAt = Date.now();
|
|
199
273
|
const pollMs = options.pollMs ?? 1000;
|
|
@@ -201,6 +275,7 @@ export async function waitForLocalJobRun(options) {
|
|
|
201
275
|
const job = await getLocalJobRun({
|
|
202
276
|
serviceUrl: options.serviceUrl,
|
|
203
277
|
runId: options.runId,
|
|
278
|
+
authToken: options.authToken ?? null,
|
|
204
279
|
});
|
|
205
280
|
options.onUpdate?.(job);
|
|
206
281
|
if (isTerminalJobStatus(job.status))
|
|
@@ -220,13 +295,14 @@ function resultError(job, defaultMessage) {
|
|
|
220
295
|
return job.error ?? defaultMessage;
|
|
221
296
|
}
|
|
222
297
|
export async function submitReadinessCheckDraftToLocalService(options) {
|
|
223
|
-
const connection = await
|
|
298
|
+
const connection = await connectOrNull();
|
|
224
299
|
if (!connection)
|
|
225
300
|
return null;
|
|
226
301
|
const request = ReadinessCheckDraftCreateRequestSchema.parse(options.request);
|
|
227
|
-
const initialJob = LocalJobRunResourceSchema.parse(await fetchJson(`${connection.serviceUrl}${
|
|
302
|
+
const initialJob = LocalJobRunResourceSchema.parse(await fetchJson(`${connection.serviceUrl}${preparationSubresourcePath(options.preparationId, "readinessCheckDrafts")}`, {
|
|
228
303
|
method: "POST",
|
|
229
304
|
body: JSON.stringify(request),
|
|
305
|
+
headers: authHeaders(connection.authToken),
|
|
230
306
|
}));
|
|
231
307
|
options.onSubmitted?.({
|
|
232
308
|
serviceUrl: connection.serviceUrl,
|
|
@@ -235,6 +311,7 @@ export async function submitReadinessCheckDraftToLocalService(options) {
|
|
|
235
311
|
const job = await waitForLocalJobRun({
|
|
236
312
|
serviceUrl: connection.serviceUrl,
|
|
237
313
|
runId: initialJob.run_id,
|
|
314
|
+
authToken: connection.authToken,
|
|
238
315
|
onUpdate: options.onUpdate,
|
|
239
316
|
});
|
|
240
317
|
if (job.status !== "succeeded") {
|
|
@@ -242,7 +319,7 @@ export async function submitReadinessCheckDraftToLocalService(options) {
|
|
|
242
319
|
serviceUrl: connection.serviceUrl,
|
|
243
320
|
job,
|
|
244
321
|
result: null,
|
|
245
|
-
error: resultError(job, "
|
|
322
|
+
error: resultError(job, "Drafting readiness checks failed in the local Interf service."),
|
|
246
323
|
};
|
|
247
324
|
}
|
|
248
325
|
const parsed = ReadinessCheckDraftResultSchema.safeParse(job.result);
|
|
@@ -251,7 +328,7 @@ export async function submitReadinessCheckDraftToLocalService(options) {
|
|
|
251
328
|
serviceUrl: connection.serviceUrl,
|
|
252
329
|
job,
|
|
253
330
|
result: null,
|
|
254
|
-
error: "
|
|
331
|
+
error: "Drafting readiness checks finished without a valid result.",
|
|
255
332
|
};
|
|
256
333
|
}
|
|
257
334
|
return {
|
|
@@ -261,13 +338,14 @@ export async function submitReadinessCheckDraftToLocalService(options) {
|
|
|
261
338
|
};
|
|
262
339
|
}
|
|
263
340
|
export async function submitMethodAuthoringRunToLocalService(options) {
|
|
264
|
-
const connection = await
|
|
341
|
+
const connection = await connectOrNull();
|
|
265
342
|
if (!connection)
|
|
266
343
|
return null;
|
|
267
344
|
const request = MethodAuthoringCreateRequestSchema.parse(options.request);
|
|
268
|
-
const initialJob = LocalJobRunResourceSchema.parse(await fetchJson(`${connection.serviceUrl}${
|
|
345
|
+
const initialJob = LocalJobRunResourceSchema.parse(await fetchJson(`${connection.serviceUrl}${preparationSubresourcePath(options.preparationId, "methodAuthoringRuns")}`, {
|
|
269
346
|
method: "POST",
|
|
270
347
|
body: JSON.stringify(request),
|
|
348
|
+
headers: authHeaders(connection.authToken),
|
|
271
349
|
}));
|
|
272
350
|
options.onSubmitted?.({
|
|
273
351
|
serviceUrl: connection.serviceUrl,
|
|
@@ -276,6 +354,7 @@ export async function submitMethodAuthoringRunToLocalService(options) {
|
|
|
276
354
|
const job = await waitForLocalJobRun({
|
|
277
355
|
serviceUrl: connection.serviceUrl,
|
|
278
356
|
runId: initialJob.run_id,
|
|
357
|
+
authToken: connection.authToken,
|
|
279
358
|
onUpdate: options.onUpdate,
|
|
280
359
|
});
|
|
281
360
|
if (job.status !== "succeeded") {
|
|
@@ -301,56 +380,12 @@ export async function submitMethodAuthoringRunToLocalService(options) {
|
|
|
301
380
|
result: parsed.data,
|
|
302
381
|
};
|
|
303
382
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
body: JSON.stringify(event),
|
|
312
|
-
}));
|
|
313
|
-
}
|
|
314
|
-
export async function startLocalJobRun(options) {
|
|
315
|
-
const connection = await findLocalService({ projectPath: options.projectPath });
|
|
316
|
-
if (!connection)
|
|
317
|
-
return null;
|
|
318
|
-
const request = LocalJobRunCreateRequestSchema.parse(options.request);
|
|
319
|
-
const resource = LocalJobRunResourceSchema.parse(await fetchJson(`${connection.serviceUrl}${LOCAL_SERVICE_ROUTES.jobs}`, {
|
|
320
|
-
method: "POST",
|
|
321
|
-
body: JSON.stringify(request),
|
|
383
|
+
/**
|
|
384
|
+
* Fetch the engine instance health/status.
|
|
385
|
+
*/
|
|
386
|
+
export async function getLocalServiceHealth(options) {
|
|
387
|
+
return LocalServiceHealthSchema.parse(await fetchJson(`${options.serviceUrl}${LOCAL_SERVICE_ROUTES.health}`, {
|
|
388
|
+
method: "GET",
|
|
389
|
+
timeoutMs: options.timeoutMs ?? 2000,
|
|
322
390
|
}));
|
|
323
|
-
const emit = (event) => {
|
|
324
|
-
void appendLocalJobRunEvent({
|
|
325
|
-
projectPath: options.projectPath,
|
|
326
|
-
runId: resource.run_id,
|
|
327
|
-
event,
|
|
328
|
-
}).catch(() => { });
|
|
329
|
-
};
|
|
330
|
-
return {
|
|
331
|
-
serviceUrl: connection.serviceUrl,
|
|
332
|
-
runId: resource.run_id,
|
|
333
|
-
resource,
|
|
334
|
-
emit,
|
|
335
|
-
complete: async (message) => {
|
|
336
|
-
await appendLocalJobRunEvent({
|
|
337
|
-
projectPath: options.projectPath,
|
|
338
|
-
runId: resource.run_id,
|
|
339
|
-
event: {
|
|
340
|
-
type: "job.completed",
|
|
341
|
-
...(message ? { message } : {}),
|
|
342
|
-
},
|
|
343
|
-
});
|
|
344
|
-
},
|
|
345
|
-
fail: async (message) => {
|
|
346
|
-
await appendLocalJobRunEvent({
|
|
347
|
-
projectPath: options.projectPath,
|
|
348
|
-
runId: resource.run_id,
|
|
349
|
-
event: {
|
|
350
|
-
type: "job.failed",
|
|
351
|
-
message,
|
|
352
|
-
},
|
|
353
|
-
});
|
|
354
|
-
},
|
|
355
|
-
};
|
|
356
391
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single CLI connection record at `~/.interf/connection.json`.
|
|
3
|
+
*
|
|
4
|
+
* The CLI is a thin authorized client of one connected instance. Switch by
|
|
5
|
+
* starting `interf web` (writes a local connection), `interf login` (writes a
|
|
6
|
+
* remote connection), or by passing `--url` / env vars to override per-call.
|
|
7
|
+
*
|
|
8
|
+
* No per-folder pointer files. No registry of multiple connections.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
export declare const ConnectionRecordSchema: z.ZodObject<{
|
|
12
|
+
url: z.ZodString;
|
|
13
|
+
auth_token: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
export type ConnectionRecord = z.infer<typeof ConnectionRecordSchema>;
|
|
16
|
+
export declare const INTERF_SERVICE_URL_ENV = "INTERF_SERVICE_URL";
|
|
17
|
+
export declare const INTERF_AUTH_TOKEN_ENV = "INTERF_AUTH_TOKEN";
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the active connection.
|
|
20
|
+
*
|
|
21
|
+
* Order of precedence:
|
|
22
|
+
* 1. Explicit `urlOverride` argument (e.g. CLI --url flag).
|
|
23
|
+
* 2. `INTERF_SERVICE_URL` / `INTERF_AUTH_TOKEN` env vars.
|
|
24
|
+
* 3. `~/.interf/connection.json`.
|
|
25
|
+
* 4. null — caller must error with the connect-or-error hint.
|
|
26
|
+
*/
|
|
27
|
+
export declare function readActiveConnection(options?: {
|
|
28
|
+
urlOverride?: string | null;
|
|
29
|
+
authTokenOverride?: string | null;
|
|
30
|
+
}): ConnectionRecord | null;
|
|
31
|
+
/** Write a new connection record. Overwrites any existing record. */
|
|
32
|
+
export declare function writeConnection(record: ConnectionRecord): void;
|
|
33
|
+
/** Clear the connection record. No-op if missing. */
|
|
34
|
+
export declare function clearConnection(): void;
|
|
35
|
+
/** Ensure `~/.interf/` exists and is a directory. */
|
|
36
|
+
export declare function ensureInterfHome(): void;
|
|
37
|
+
/** Canonical message printed when a CLI command needs a connection but has none. */
|
|
38
|
+
export declare const CONNECT_OR_ERROR_HINT: string;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single CLI connection record at `~/.interf/connection.json`.
|
|
3
|
+
*
|
|
4
|
+
* The CLI is a thin authorized client of one connected instance. Switch by
|
|
5
|
+
* starting `interf web` (writes a local connection), `interf login` (writes a
|
|
6
|
+
* remote connection), or by passing `--url` / env vars to override per-call.
|
|
7
|
+
*
|
|
8
|
+
* No per-folder pointer files. No registry of multiple connections.
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
11
|
+
import { dirname } from "node:path";
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
import { connectionConfigPath, interfHomeRoot } from "./instance-paths.js";
|
|
14
|
+
export const ConnectionRecordSchema = z.object({
|
|
15
|
+
url: z.string().url(),
|
|
16
|
+
/** Bearer token for non-loopback connections. Null for loopback. */
|
|
17
|
+
auth_token: z.string().min(1).nullable().default(null),
|
|
18
|
+
}).strict();
|
|
19
|
+
export const INTERF_SERVICE_URL_ENV = "INTERF_SERVICE_URL";
|
|
20
|
+
export const INTERF_AUTH_TOKEN_ENV = "INTERF_AUTH_TOKEN";
|
|
21
|
+
/**
|
|
22
|
+
* Resolve the active connection.
|
|
23
|
+
*
|
|
24
|
+
* Order of precedence:
|
|
25
|
+
* 1. Explicit `urlOverride` argument (e.g. CLI --url flag).
|
|
26
|
+
* 2. `INTERF_SERVICE_URL` / `INTERF_AUTH_TOKEN` env vars.
|
|
27
|
+
* 3. `~/.interf/connection.json`.
|
|
28
|
+
* 4. null — caller must error with the connect-or-error hint.
|
|
29
|
+
*/
|
|
30
|
+
export function readActiveConnection(options = {}) {
|
|
31
|
+
const overrideUrl = options.urlOverride?.trim();
|
|
32
|
+
if (overrideUrl) {
|
|
33
|
+
return ConnectionRecordSchema.parse({
|
|
34
|
+
url: overrideUrl,
|
|
35
|
+
auth_token: options.authTokenOverride?.trim() || null,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const envUrl = process.env[INTERF_SERVICE_URL_ENV]?.trim();
|
|
39
|
+
if (envUrl) {
|
|
40
|
+
return ConnectionRecordSchema.parse({
|
|
41
|
+
url: envUrl,
|
|
42
|
+
auth_token: process.env[INTERF_AUTH_TOKEN_ENV]?.trim() || null,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const configPath = connectionConfigPath();
|
|
46
|
+
if (!existsSync(configPath))
|
|
47
|
+
return null;
|
|
48
|
+
try {
|
|
49
|
+
const raw = readFileSync(configPath, "utf8");
|
|
50
|
+
return ConnectionRecordSchema.parse(JSON.parse(raw));
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** Write a new connection record. Overwrites any existing record. */
|
|
57
|
+
export function writeConnection(record) {
|
|
58
|
+
const validated = ConnectionRecordSchema.parse(record);
|
|
59
|
+
const configPath = connectionConfigPath();
|
|
60
|
+
mkdirSync(dirname(configPath), { recursive: true });
|
|
61
|
+
writeFileSync(configPath, `${JSON.stringify(validated, null, 2)}\n`);
|
|
62
|
+
}
|
|
63
|
+
/** Clear the connection record. No-op if missing. */
|
|
64
|
+
export function clearConnection() {
|
|
65
|
+
const configPath = connectionConfigPath();
|
|
66
|
+
if (existsSync(configPath))
|
|
67
|
+
rmSync(configPath, { force: true });
|
|
68
|
+
}
|
|
69
|
+
/** Ensure `~/.interf/` exists and is a directory. */
|
|
70
|
+
export function ensureInterfHome() {
|
|
71
|
+
mkdirSync(interfHomeRoot(), { recursive: true });
|
|
72
|
+
}
|
|
73
|
+
/** Canonical message printed when a CLI command needs a connection but has none. */
|
|
74
|
+
export const CONNECT_OR_ERROR_HINT = "Not connected to any Interf instance.\n" +
|
|
75
|
+
"Start one with `interf web`, or set --url / `interf login` for a remote one.";
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
export * as schema from "./lib/schema.js";
|
|
2
2
|
export * as actionValues from "./action-values.js";
|
|
3
|
+
export * as actionDefinitions from "./action-definitions.js";
|
|
3
4
|
export * as routes from "./routes.js";
|
|
4
5
|
export * as client from "./client.js";
|
|
5
6
|
export * as runtime from "./runtime.js";
|
|
6
7
|
export * as server from "./server.js";
|
|
7
|
-
export type { CompileRunCreateRequest, CompileRunResource, CompileRunSummary, LocalServiceDiscovery, PortableContextMapping,
|
|
8
|
-
export { CompileRunCreateRequestSchema, CompileRunResourceSchema, CompileRunSummarySchema, LocalServiceDiscoverySchema, PortableContextMappingSchema,
|
|
9
|
-
export { LOCAL_SERVICE_DEFAULT_HOST, LOCAL_SERVICE_DEFAULT_PORT,
|
|
10
|
-
export type {
|
|
11
|
-
export {
|
|
12
|
-
export
|
|
8
|
+
export type { CompileRunCreateRequest, CompileRunResource, CompileRunSummary, LocalServiceDiscovery, PortableContextMapping, PreparationRunLinkage, PreparationResource, MethodResource, LocalJobAgent, LocalJobEvent, LocalJobEventAppendRequest, LocalJobEventType, LocalJobRunCreateRequest, LocalJobRunResource, LocalJobStatus, LocalRunHandlerResult, LocalJobStep, LocalJobType, LocalServiceConfig, LocalServiceError, LocalServiceHealth, LocalExecutorStatus, ActionClientOrigin, ActionProposalApproval, ActionProposalApprovalRequest, ActionProposalCreateRequest, ActionProposalListResponse, ActionProposalPlan, ActionProposalPlanActionType, ActionProposalResource, ActionProposalStatus, ActionProposalType, MethodChangeResult, PreparationChangeResult, PreparationSetupResult, ResetRequest, ResetResult, PortableContextResource, ReadinessResource, SourceFileResource, ReadinessCheckDraftCreateRequest, ReadinessCheckDraftResult, TestRunCreateRequest, TestRunResource, TestRunStatus, RunObservabilityListResponse, RunObservabilityResource, MethodAuthoringCreateRequest, MethodAuthoringResult, PreparationListResponse, MethodListResponse, PortableContextListResponse, SourceFileListResponse, OpenPathRequest, OpenPathResponse, WorkspaceFileResource, } from "./lib/schema.js";
|
|
9
|
+
export { CompileRunCreateRequestSchema, CompileRunResourceSchema, CompileRunSummarySchema, LocalServiceDiscoverySchema, PortableContextMappingSchema, PreparationRunLinkageSchema, PreparationResourceSchema, MethodResourceSchema, LocalJobAgentSchema, LocalJobEventAppendRequestSchema, LocalJobEventSchema, LocalJobEventTypeSchema, LocalJobRunCreateRequestSchema, LocalJobRunResourceSchema, LocalJobStatusSchema, LocalRunHandlerResultSchema, LocalJobStepSchema, LocalJobTypeSchema, LocalServiceConfigSchema, LocalServiceErrorSchema, LocalServiceHealthSchema, PortableContextResourceSchema, ReadinessResourceSchema, SourceFileResourceSchema, ReadinessCheckDraftCreateRequestSchema, ReadinessCheckDraftResultSchema, TestRunCreateRequestSchema, TestRunResourceSchema, TestRunStatusSchema, RunObservabilityResourceSchema, RunObservabilityListResponseSchema, LocalExecutorStatusSchema, ActionClientOriginSchema, ActionProposalApprovalRequestSchema, ActionProposalApprovalSchema, ActionProposalCreateRequestSchema, ActionProposalListResponseSchema, ActionProposalPlanSchema, ActionProposalPlanActionTypeSchema, ActionProposalResourceSchema, ActionProposalStatusSchema, ActionProposalTypeSchema, ResetRequestSchema, ResetResultSchema, MethodAuthoringCreateRequestSchema, MethodAuthoringResultSchema, PreparationListResponseSchema, MethodListResponseSchema, PortableContextListResponseSchema, SourceFileListResponseSchema, OpenPathRequestSchema, OpenPathResponseSchema, } from "./lib/schema.js";
|
|
10
|
+
export { LOCAL_SERVICE_DEFAULT_HOST, LOCAL_SERVICE_DEFAULT_PORT, LOCAL_SERVICE_ROUTES, buildLocalServiceUrl, } from "./routes.js";
|
|
11
|
+
export type { ServiceRegistry, ServiceRegistryEntry, ServiceRegistryWorkspace, } from "./lib/schema.js";
|
|
12
|
+
export { ServiceRegistrySchema, ServiceRegistryEntrySchema, ServiceRegistryWorkspaceSchema, } from "./lib/schema.js";
|
|
13
|
+
export { readServiceRegistry, registerServiceLocally, unregisterService, writeServiceRegistry, serviceRegistryPath, } from "./service-registry.js";
|
|
14
|
+
export type { LocalServiceJobSubmission, LocalServiceJobSubmitted, LocalServiceConnection, } from "./client.js";
|
|
15
|
+
export type { LocalCompileRunCancelResult, } from "./client.js";
|
|
16
|
+
export { approveActionProposalInLocalService, cancelLocalCompileRun, configuredLocalServiceUrl, resolveLocalServiceAuthToken, createActionProposalInLocalService, decideActionProposalInLocalService, findLocalService, getLocalJobRun, getLocalCompileRun, getLocalServiceHealth, getLocalTestRun, submitCompileRunToLocalService, submitReadinessCheckDraftToLocalService, submitResetToLocalService, submitTestRunToLocalService, submitMethodAuthoringRunToLocalService, waitForLocalJobRun, waitForLocalCompileRun, waitForLocalTestRun, } from "./client.js";
|
|
17
|
+
export type { LocalServiceActionPlanningContext, LocalServiceCompileRunContext, LocalServiceJobRunContext, LocalServiceRunHandlers, LocalServiceRuntimeOptions, LocalServiceTestRunContext, PreparationContext, } from "./runtime.js";
|
|
13
18
|
export { LocalServiceRuntime, createLocalServiceRuntime, } from "./runtime.js";
|
|
14
19
|
export type { StartedLocalService, StartLocalServiceOptions, } from "./server.js";
|
|
15
|
-
export { createLocalServiceServer, startLocalService, } from "./server.js";
|
|
20
|
+
export { createLocalServiceServer, createLocalServiceAuthToken, startLocalService, } from "./server.js";
|
|
21
|
+
export type { NativeLocalServiceRunHandlerOptions, } from "./native-run-handlers.js";
|
|
22
|
+
export { createNativeLocalServiceRunHandlers, } from "./native-run-handlers.js";
|