@interf/compiler 0.33.0 → 0.50.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 +122 -226
- package/dist/cli/commands/agents.js +1 -32
- package/dist/cli/commands/benchmark.d.ts +2 -3
- package/dist/cli/commands/benchmark.js +1 -31
- package/dist/cli/commands/build-plan.js +26 -50
- package/dist/cli/commands/build.d.ts +2 -3
- package/dist/cli/commands/build.js +1 -31
- package/dist/cli/commands/graphs.js +177 -32
- package/dist/cli/commands/mcp.d.ts +1 -0
- package/dist/cli/commands/mcp.js +223 -126
- package/dist/cli/commands/project.js +10 -36
- package/dist/cli/commands/reset.d.ts +2 -3
- package/dist/cli/commands/reset.js +1 -22
- package/dist/cli/commands/runs.js +86 -33
- package/dist/cli/commands/status.js +3 -24
- package/dist/cli/commands/traces.js +1 -29
- package/dist/cli/commands/wizard.js +17 -29
- package/dist/cli/lib/http-client.d.ts +39 -0
- package/dist/cli/lib/http-client.js +73 -0
- package/dist/packages/build-plans/authoring/brief.d.ts +25 -4
- package/dist/packages/build-plans/authoring/build-plan-authoring.d.ts +42 -1
- package/dist/packages/build-plans/authoring/build-plan-authoring.js +470 -63
- package/dist/packages/build-plans/authoring/build-plan-edit-session.d.ts +9 -0
- package/dist/packages/build-plans/authoring/build-plan-edit-session.js +27 -10
- package/dist/packages/build-plans/authoring/build-plan-improvement.js +62 -8
- package/dist/packages/build-plans/authoring/lib/build-plan-edit-utils.d.ts +1 -0
- package/dist/packages/build-plans/package/build-plan-definitions.d.ts +0 -1
- package/dist/packages/build-plans/package/build-plan-definitions.js +5 -3
- package/dist/packages/build-plans/package/build-plan-stage-runner.d.ts +1 -0
- package/dist/packages/build-plans/package/build-plan-stage-runner.js +2 -1
- package/dist/packages/build-plans/package/builtin-build-plan.d.ts +2 -2
- package/dist/packages/build-plans/package/builtin-build-plan.js +3 -3
- package/dist/packages/build-plans/package/context-interface.d.ts +3 -0
- package/dist/packages/build-plans/package/context-interface.js +5 -5
- package/dist/packages/build-plans/package/interf-build-plan-package.js +22 -22
- package/dist/packages/build-plans/package/local-build-plans.d.ts +10 -5
- package/dist/packages/build-plans/package/local-build-plans.js +57 -32
- package/dist/packages/contracts/index.d.ts +4 -3
- package/dist/packages/contracts/index.js +2 -1
- package/dist/packages/contracts/lib/context-graph-layer.d.ts +161 -0
- package/dist/packages/contracts/lib/context-graph-layer.js +216 -0
- package/dist/packages/contracts/lib/project-paths.d.ts +7 -0
- package/dist/packages/contracts/lib/project-paths.js +9 -0
- package/dist/packages/contracts/lib/project-schema.d.ts +264 -1
- package/dist/packages/contracts/lib/project-schema.js +38 -13
- package/dist/packages/contracts/lib/schema.d.ts +556 -23
- package/dist/packages/contracts/lib/schema.js +279 -18
- package/dist/packages/contracts/utils/filesystem.d.ts +1 -0
- package/dist/packages/contracts/utils/filesystem.js +29 -1
- package/dist/packages/projects/lib/schema.d.ts +6 -8
- package/dist/packages/projects/lib/schema.js +3 -1
- package/dist/packages/projects/source-config.d.ts +0 -5
- package/dist/packages/projects/source-config.js +9 -22
- package/dist/packages/runtime/actions/fields.d.ts +4 -0
- package/dist/packages/runtime/actions/form-builders.js +79 -31
- package/dist/packages/runtime/actions/form-validators.js +9 -3
- package/dist/packages/runtime/actions/helpers.js +3 -3
- package/dist/packages/runtime/actions/registry.d.ts +1 -1
- package/dist/packages/runtime/actions/registry.js +1 -1
- package/dist/packages/runtime/actions/requests.d.ts +1 -1
- package/dist/packages/runtime/actions/requests.js +12 -6
- package/dist/packages/runtime/actions/schemas.d.ts +7 -0
- package/dist/packages/runtime/actions/schemas.js +1 -0
- package/dist/packages/runtime/agent-handoff.js +8 -7
- package/dist/packages/runtime/agents/lib/execution-profile.d.ts +14 -0
- package/dist/packages/runtime/agents/lib/execution-profile.js +23 -0
- package/dist/packages/runtime/agents/lib/execution.js +14 -8
- package/dist/packages/runtime/agents/lib/executors.d.ts +1 -0
- package/dist/packages/runtime/agents/lib/executors.js +11 -2
- package/dist/packages/runtime/agents/lib/logs.d.ts +10 -0
- package/dist/packages/runtime/agents/lib/logs.js +32 -8
- package/dist/packages/runtime/agents/lib/preflight.js +4 -1
- package/dist/packages/runtime/agents/lib/render.d.ts +18 -0
- package/dist/packages/runtime/agents/lib/render.js +44 -18
- package/dist/packages/runtime/agents/lib/shell-templates.js +105 -63
- package/dist/packages/runtime/agents/lib/shells.d.ts +29 -0
- package/dist/packages/runtime/agents/lib/shells.js +158 -32
- package/dist/packages/runtime/agents/lib/source-context-scan.d.ts +10 -0
- package/dist/packages/runtime/agents/lib/source-context-scan.js +388 -0
- package/dist/packages/runtime/agents/lib/status.js +1 -14
- package/dist/packages/runtime/agents/lib/string-utils.d.ts +16 -0
- package/dist/packages/runtime/agents/lib/string-utils.js +36 -0
- package/dist/packages/runtime/agents/lib/types.d.ts +1 -0
- package/dist/packages/runtime/agents/providers/codex.js +2 -0
- package/dist/packages/runtime/agents/role-executors.js +2 -1
- package/dist/packages/runtime/auth/session-store.js +11 -3
- package/dist/packages/runtime/benchmark-question-draft.d.ts +3 -0
- package/dist/packages/runtime/benchmark-question-draft.js +57 -28
- package/dist/packages/runtime/build/artifact-status.d.ts +1 -1
- package/dist/packages/runtime/build/artifact-status.js +1 -1
- package/dist/packages/runtime/build/build-evidence.d.ts +2 -1
- package/dist/packages/runtime/build/build-evidence.js +11 -5
- package/dist/packages/runtime/build/build-pipeline.js +89 -5
- package/dist/packages/runtime/build/build-stage-plan.js +3 -1
- package/dist/packages/runtime/build/build-stage-runner.js +169 -32
- package/dist/packages/runtime/build/build-target.d.ts +3 -0
- package/dist/packages/runtime/build/build-target.js +25 -1
- package/dist/packages/runtime/build/check-evaluator.d.ts +1 -1
- package/dist/packages/runtime/build/check-evaluator.js +655 -4
- package/dist/packages/runtime/build/context-graph-paths.d.ts +13 -0
- package/dist/packages/runtime/build/context-graph-paths.js +27 -0
- package/dist/packages/runtime/build/index.d.ts +2 -2
- package/dist/packages/runtime/build/index.js +2 -2
- package/dist/packages/runtime/build/inspect-map.d.ts +10 -0
- package/dist/packages/runtime/build/inspect-map.js +270 -0
- package/dist/packages/runtime/build/lib/schema.d.ts +246 -53
- package/dist/packages/runtime/build/lib/schema.js +173 -15
- package/dist/packages/runtime/build/native-entrypoint.d.ts +2 -0
- package/dist/packages/runtime/build/native-entrypoint.js +286 -0
- package/dist/packages/runtime/build/runtime-contracts.js +9 -3
- package/dist/packages/runtime/build/runtime-log-paths.d.ts +3 -0
- package/dist/packages/runtime/build/runtime-log-paths.js +16 -0
- package/dist/packages/runtime/build/runtime-prompt.js +6 -4
- package/dist/packages/runtime/build/runtime-runs.js +63 -10
- package/dist/packages/runtime/build/runtime-types.d.ts +4 -1
- package/dist/packages/runtime/build/runtime.d.ts +3 -1
- package/dist/packages/runtime/build/runtime.js +3 -1
- package/dist/packages/runtime/build/source-files.js +11 -2
- package/dist/packages/runtime/build/source-inventory.d.ts +1 -0
- package/dist/packages/runtime/build/source-inventory.js +246 -7
- package/dist/packages/runtime/build/source-manifest.d.ts +11 -0
- package/dist/packages/runtime/build/source-manifest.js +30 -2
- package/dist/packages/runtime/build/stage-evidence.js +80 -11
- package/dist/packages/runtime/build/stage-manifest.d.ts +45 -0
- package/dist/packages/runtime/build/stage-manifest.js +1125 -0
- package/dist/packages/runtime/build/stage-reuse.js +12 -0
- package/dist/packages/runtime/build/stage-session.d.ts +81 -0
- package/dist/packages/runtime/build/stage-session.js +308 -0
- package/dist/packages/runtime/build/state-io.js +10 -11
- package/dist/packages/runtime/build/state-view.js +1 -1
- package/dist/packages/runtime/build/state.d.ts +1 -1
- package/dist/packages/runtime/build/state.js +1 -1
- package/dist/packages/runtime/build/summary-coverage-index.d.ts +21 -0
- package/dist/packages/runtime/build/summary-coverage-index.js +189 -0
- package/dist/packages/runtime/build/traces.js +3 -3
- package/dist/packages/runtime/build/validate-context-graph.d.ts +1 -1
- package/dist/packages/runtime/build/validate-context-graph.js +5 -5
- package/dist/packages/runtime/build/validate.d.ts +1 -1
- package/dist/packages/runtime/build/validate.js +1 -1
- package/dist/packages/runtime/client.d.ts +3 -3
- package/dist/packages/runtime/client.js +8 -13
- package/dist/packages/runtime/context-checks.js +13 -0
- package/dist/packages/runtime/context-graph-scaffold.js +2 -1
- package/dist/packages/runtime/context-graph-semantic-graph.d.ts +9 -0
- package/dist/packages/runtime/context-graph-semantic-graph.js +416 -0
- package/dist/packages/runtime/execution/lib/schema.d.ts +34 -31
- package/dist/packages/runtime/index.d.ts +2 -2
- package/dist/packages/runtime/index.js +1 -1
- package/dist/packages/runtime/native-run-handlers.d.ts +38 -0
- package/dist/packages/runtime/native-run-handlers.js +52 -33
- package/dist/packages/runtime/plan-artifact-contract.js +1 -1
- package/dist/packages/runtime/project-source-state.d.ts +4 -4
- package/dist/packages/runtime/project-source-state.js +5 -2
- package/dist/packages/runtime/project-store.d.ts +5 -0
- package/dist/packages/runtime/project-store.js +30 -3
- package/dist/packages/runtime/requested-artifacts.js +1 -1
- package/dist/packages/runtime/run-observability.js +9 -4
- package/dist/packages/runtime/runtime-action-proposals.js +3 -3
- package/dist/packages/runtime/runtime-build-plans.js +47 -3
- package/dist/packages/runtime/runtime-build-runs.js +9 -16
- package/dist/packages/runtime/runtime-caches.d.ts +26 -0
- package/dist/packages/runtime/runtime-caches.js +47 -0
- package/dist/packages/runtime/runtime-jobs.js +6 -6
- package/dist/packages/runtime/runtime-project-mutations.js +1 -0
- package/dist/packages/runtime/runtime-project-reads.d.ts +4 -1
- package/dist/packages/runtime/runtime-project-reads.js +229 -36
- package/dist/packages/runtime/runtime-proposal-helpers.js +6 -6
- package/dist/packages/runtime/runtime-resource-builders.d.ts +4 -2
- package/dist/packages/runtime/runtime-resource-builders.js +16 -14
- package/dist/packages/runtime/runtime-status.d.ts +14 -0
- package/dist/packages/runtime/runtime-status.js +15 -0
- package/dist/packages/runtime/runtime-verify-runs.js +6 -5
- package/dist/packages/runtime/runtime.d.ts +439 -22
- package/dist/packages/runtime/runtime.js +16 -2
- package/dist/packages/runtime/schemas/actions.d.ts +24 -0
- package/dist/packages/runtime/schemas/agents.d.ts +28 -0
- package/dist/packages/runtime/schemas/agents.js +33 -0
- package/dist/packages/runtime/schemas/build-plans.d.ts +181 -8
- package/dist/packages/runtime/schemas/build-plans.js +36 -2
- package/dist/packages/runtime/schemas/context-graphs.d.ts +1522 -0
- package/dist/packages/runtime/schemas/context-graphs.js +110 -0
- package/dist/packages/runtime/schemas/files.d.ts +7 -347
- package/dist/packages/runtime/schemas/files.js +1 -24
- package/dist/packages/runtime/schemas/index.d.ts +1 -0
- package/dist/packages/runtime/schemas/index.js +1 -0
- package/dist/packages/runtime/schemas/jobs.js +4 -0
- package/dist/packages/runtime/schemas/projects.d.ts +48 -21
- package/dist/packages/runtime/schemas/projects.js +34 -10
- package/dist/packages/runtime/schemas/runs.d.ts +1009 -240
- package/dist/packages/runtime/schemas/runs.js +17 -0
- package/dist/packages/runtime/service/openapi.js +1 -0
- package/dist/packages/runtime/service/operations.d.ts +1666 -145
- package/dist/packages/runtime/service/operations.js +147 -17
- package/dist/packages/runtime/service/routes.d.ts +11 -3
- package/dist/packages/runtime/service/routes.js +11 -3
- package/dist/packages/runtime/service/server-app-boot.js +2 -2
- package/dist/packages/runtime/service/server-helpers.d.ts +11 -0
- package/dist/packages/runtime/service/server-helpers.js +19 -0
- package/dist/packages/runtime/service/server-routes-action-proposals.js +4 -2
- package/dist/packages/runtime/service/server-routes-agents.js +19 -85
- package/dist/packages/runtime/service/server-routes-build-plans.js +14 -11
- package/dist/packages/runtime/service/server-routes-project-context.js +102 -7
- package/dist/packages/runtime/service/server-routes-project-jobs.js +19 -12
- package/dist/packages/runtime/service/server-routes-project-runs.js +5 -2
- package/dist/packages/runtime/service/server-routes-projects.js +6 -2
- package/dist/packages/runtime/service/server-routes-runs.js +11 -4
- package/dist/packages/runtime/verify/lib/schema.js +12 -0
- package/dist/packages/runtime/verify/test-file-guard.d.ts +2 -0
- package/dist/packages/runtime/verify/test-file-guard.js +29 -0
- package/dist/packages/runtime/verify/verify-execution.d.ts +7 -0
- package/dist/packages/runtime/verify/verify-execution.js +109 -35
- package/dist/packages/runtime/verify/verify-paths.d.ts +1 -0
- package/dist/packages/runtime/verify/verify-paths.js +4 -0
- package/dist/packages/runtime/verify/verify-specs.js +49 -39
- package/dist/packages/runtime/wire-schemas.d.ts +1 -1
- package/dist/packages/runtime/wire-schemas.js +1 -1
- package/package.json +2 -8
- package/public-repo/CONTRIBUTING.md +10 -3
- package/public-repo/README.md +122 -226
- package/public-repo/build-plans/interf-default/README.md +15 -12
- package/public-repo/build-plans/interf-default/build/stages/entrypoint/SKILL.md +74 -0
- package/public-repo/build-plans/interf-default/build/stages/knowledge/SKILL.md +95 -0
- package/public-repo/build-plans/interf-default/build/stages/summarize/SKILL.md +38 -5
- package/public-repo/build-plans/interf-default/build-plan.json +27 -23
- package/public-repo/build-plans/interf-default/build-plan.schema.json +24 -20
- package/public-repo/build-plans/interf-default/use/query/SKILL.md +8 -7
- package/public-repo/openapi/local-service.openapi.json +11637 -4213
- package/public-repo/skills/interf/SKILL.md +174 -134
- package/dist/packages/runtime/build/runtime-paths.d.ts +0 -8
- package/dist/packages/runtime/build/runtime-paths.js +0 -26
- package/dist/packages/runtime/build/state-paths.d.ts +0 -7
- package/dist/packages/runtime/build/state-paths.js +0 -22
- package/public-repo/build-plans/interf-default/build/stages/shape/SKILL.md +0 -34
- package/public-repo/build-plans/interf-default/build/stages/structure/SKILL.md +0 -28
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { CommandModule } from "yargs";
|
|
2
|
-
|
|
2
|
+
import { type ConnectionArgs } from "../lib/http-client.js";
|
|
3
|
+
interface BuildArgs extends ConnectionArgs {
|
|
3
4
|
projectId: string;
|
|
4
5
|
watch?: boolean;
|
|
5
6
|
quiet?: boolean;
|
|
6
7
|
idempotencyKey?: string;
|
|
7
|
-
url?: string;
|
|
8
|
-
token?: string;
|
|
9
8
|
}
|
|
10
9
|
export declare const buildCommand: CommandModule<unknown, BuildArgs>;
|
|
11
10
|
export {};
|
|
@@ -8,38 +8,8 @@
|
|
|
8
8
|
* Requires an active connection. Hits POST /v1/projects/<id>/build-runs.
|
|
9
9
|
*/
|
|
10
10
|
import chalk from "chalk";
|
|
11
|
-
import {
|
|
11
|
+
import { callJson, resolveConnection } from "../lib/http-client.js";
|
|
12
12
|
import { projectSubresourcePath } from "../../packages/runtime/service/routes.js";
|
|
13
|
-
function resolveConnection(args) {
|
|
14
|
-
const conn = readActiveConnection({
|
|
15
|
-
urlOverride: args.url,
|
|
16
|
-
authTokenOverride: args.token,
|
|
17
|
-
});
|
|
18
|
-
if (!conn) {
|
|
19
|
-
console.error(CONNECT_OR_ERROR_HINT);
|
|
20
|
-
process.exit(1);
|
|
21
|
-
}
|
|
22
|
-
return { url: conn.url.replace(/\/+$/, ""), token: conn.auth_token };
|
|
23
|
-
}
|
|
24
|
-
async function callJson(url, token, init = {}) {
|
|
25
|
-
const headers = new Headers(init.headers ?? {});
|
|
26
|
-
if (token)
|
|
27
|
-
headers.set("authorization", `Bearer ${token}`);
|
|
28
|
-
if (init.body && !headers.has("content-type"))
|
|
29
|
-
headers.set("content-type", "application/json");
|
|
30
|
-
const response = await fetch(url, { ...init, headers });
|
|
31
|
-
const raw = await response.text();
|
|
32
|
-
let body = null;
|
|
33
|
-
if (raw.length > 0) {
|
|
34
|
-
try {
|
|
35
|
-
body = JSON.parse(raw);
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
body = null;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return { status: response.status, body, raw };
|
|
42
|
-
}
|
|
43
13
|
export const buildCommand = {
|
|
44
14
|
command: "build <project-id>",
|
|
45
15
|
describe: "Build Context Graph for a Project",
|
|
@@ -4,44 +4,20 @@
|
|
|
4
4
|
* interf graphs ls --project <id>
|
|
5
5
|
* interf graphs show <graphId> --project <id>
|
|
6
6
|
* interf graphs open <graphId> --project <id>
|
|
7
|
+
* interf graphs sessions --project <id>
|
|
8
|
+
* interf graphs session <stageRunId> --project <id>
|
|
7
9
|
*/
|
|
8
10
|
import chalk from "chalk";
|
|
9
|
-
import {
|
|
10
|
-
import { ContextGraphListResponseSchema, ContextGraphResourceSchema, } from "../../packages/runtime/schemas/index.js";
|
|
11
|
-
function resolveConnection(args) {
|
|
12
|
-
const conn = readActiveConnection({
|
|
13
|
-
urlOverride: args.url,
|
|
14
|
-
authTokenOverride: args.token,
|
|
15
|
-
});
|
|
16
|
-
if (!conn) {
|
|
17
|
-
console.error(CONNECT_OR_ERROR_HINT);
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
return { url: conn.url.replace(/\/+$/, ""), token: conn.auth_token };
|
|
21
|
-
}
|
|
22
|
-
async function callJson(url, token, init = {}) {
|
|
23
|
-
const headers = new Headers(init.headers ?? {});
|
|
24
|
-
if (token)
|
|
25
|
-
headers.set("authorization", `Bearer ${token}`);
|
|
26
|
-
if (init.body && !headers.has("content-type"))
|
|
27
|
-
headers.set("content-type", "application/json");
|
|
28
|
-
const response = await fetch(url, { ...init, headers });
|
|
29
|
-
const raw = await response.text();
|
|
30
|
-
let body = null;
|
|
31
|
-
if (raw) {
|
|
32
|
-
try {
|
|
33
|
-
body = JSON.parse(raw);
|
|
34
|
-
}
|
|
35
|
-
catch {
|
|
36
|
-
body = null;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return { status: response.status, body, raw };
|
|
40
|
-
}
|
|
11
|
+
import { callJson, resolveConnection } from "../lib/http-client.js";
|
|
12
|
+
import { ContextGraphListResponseSchema, ContextGraphResourceSchema, ContextGraphSessionResponseSchema, ContextGraphSessionsResponseSchema, } from "../../packages/runtime/schemas/index.js";
|
|
41
13
|
function graphUrl(baseUrl, projectId, graphId) {
|
|
42
14
|
const root = `${baseUrl}/v1/projects/${encodeURIComponent(projectId)}/graphs`;
|
|
43
15
|
return graphId ? `${root}/${encodeURIComponent(graphId)}` : root;
|
|
44
16
|
}
|
|
17
|
+
function sessionsUrl(baseUrl, projectId, stageRunId) {
|
|
18
|
+
const root = `${baseUrl}/v1/projects/${encodeURIComponent(projectId)}/context-graph/sessions`;
|
|
19
|
+
return stageRunId ? `${root}/${encodeURIComponent(stageRunId)}` : root;
|
|
20
|
+
}
|
|
45
21
|
function statusColor(graph) {
|
|
46
22
|
const status = graph.readiness?.status;
|
|
47
23
|
if (graph.readiness?.ready || status === "ready")
|
|
@@ -50,6 +26,13 @@ function statusColor(graph) {
|
|
|
50
26
|
return chalk.red;
|
|
51
27
|
return chalk.yellow;
|
|
52
28
|
}
|
|
29
|
+
function formatMetric(metric) {
|
|
30
|
+
const count = typeof metric.total === "number"
|
|
31
|
+
? `${metric.value} / ${metric.total}`
|
|
32
|
+
: `${metric.value}`;
|
|
33
|
+
const unit = metric.unit ? ` ${metric.unit}` : "";
|
|
34
|
+
return metric.detail ? `${count}${unit} (${metric.detail})` : `${count}${unit}`;
|
|
35
|
+
}
|
|
53
36
|
function renderGraph(graph) {
|
|
54
37
|
const color = statusColor(graph);
|
|
55
38
|
const graphId = graph.graph_id ?? graph.latest_build_run_id ?? `${graph.project}-latest`;
|
|
@@ -65,10 +48,94 @@ function renderGraph(graph) {
|
|
|
65
48
|
if (graph.created_at)
|
|
66
49
|
console.log(chalk.dim(` created: ${graph.created_at}`));
|
|
67
50
|
console.log(chalk.dim(` path: ${graph.path}`));
|
|
51
|
+
for (const metric of graph.primary_metrics.slice(0, 5)) {
|
|
52
|
+
console.log(chalk.dim(` ${metric.label}: ${formatMetric(metric)}`));
|
|
53
|
+
}
|
|
54
|
+
if (graph.graph_manifest?.graph_outputs) {
|
|
55
|
+
const outputs = graph.graph_manifest.graph_outputs;
|
|
56
|
+
console.log(chalk.dim(` graph: ${outputs.nodes} nodes, ${outputs.edges} edges`));
|
|
57
|
+
}
|
|
68
58
|
if (graph.build_evidence?.summary)
|
|
69
59
|
console.log(chalk.dim(` evidence: ${graph.build_evidence.summary}`));
|
|
70
60
|
console.log();
|
|
71
61
|
}
|
|
62
|
+
function sessionStatusColor(status) {
|
|
63
|
+
if (status === "succeeded")
|
|
64
|
+
return chalk.green;
|
|
65
|
+
if (status === "failed")
|
|
66
|
+
return chalk.red;
|
|
67
|
+
return chalk.yellow;
|
|
68
|
+
}
|
|
69
|
+
function renderSessionLine(session) {
|
|
70
|
+
const color = sessionStatusColor(session.status);
|
|
71
|
+
console.log(` ${chalk.bold(session.stage_run_id)} ${color(`(${session.status})`)}`);
|
|
72
|
+
console.log(chalk.dim(` stage: ${session.stage_label} [${session.stage_id}] · attempt ${session.attempt} · ${session.contract_type}`));
|
|
73
|
+
const model = session.executor.model ? ` (${session.executor.model})` : "";
|
|
74
|
+
console.log(chalk.dim(` executor: ${session.executor.display_name || session.executor.name}${model}`));
|
|
75
|
+
const replay = session.shell.replay_ready
|
|
76
|
+
? chalk.green("replay-ready")
|
|
77
|
+
: chalk.dim(session.shell.retention_reason ? `pruned: ${session.shell.retention_reason}` : "no replay shell");
|
|
78
|
+
console.log(chalk.dim(` shell: ${replay}`));
|
|
79
|
+
}
|
|
80
|
+
function renderSession(session) {
|
|
81
|
+
const color = sessionStatusColor(session.status);
|
|
82
|
+
console.log();
|
|
83
|
+
console.log(` ${chalk.bold(session.stage_run_id)} ${color(`(${session.status})`)}`);
|
|
84
|
+
console.log(chalk.dim(` stage: ${session.stage_label} [${session.stage_id}]`));
|
|
85
|
+
console.log(chalk.dim(` attempt: ${session.attempt}`));
|
|
86
|
+
console.log(chalk.dim(` contract: ${session.contract_type}`));
|
|
87
|
+
console.log(chalk.dim(` project: ${session.project}`));
|
|
88
|
+
if (session.build_run_id)
|
|
89
|
+
console.log(chalk.dim(` build run: ${session.build_run_id}`));
|
|
90
|
+
console.log(chalk.dim(` Build Plan: ${session.build_plan}`));
|
|
91
|
+
const model = session.executor.model ? ` (${session.executor.model})` : "";
|
|
92
|
+
console.log(chalk.dim(` executor: ${session.executor.display_name || session.executor.name}${model}`));
|
|
93
|
+
console.log(chalk.dim(` updated: ${session.updated_at}`));
|
|
94
|
+
console.log();
|
|
95
|
+
console.log(chalk.bold(" Shell"));
|
|
96
|
+
console.log(chalk.dim(` root: ${session.shell.root_path}`));
|
|
97
|
+
console.log(` replay: ${session.shell.replay_ready ? chalk.green("ready") : chalk.yellow("not ready")}`
|
|
98
|
+
+ (session.shell.retention_reason ? chalk.dim(` (${session.shell.retention_reason})`) : ""));
|
|
99
|
+
const logPaths = Object.entries(session.logs).filter(([, value]) => Boolean(value));
|
|
100
|
+
if (logPaths.length > 0) {
|
|
101
|
+
console.log();
|
|
102
|
+
console.log(chalk.bold(" Logs"));
|
|
103
|
+
for (const [label, value] of logPaths) {
|
|
104
|
+
console.log(chalk.dim(` ${label.replace(/_path$/, "")}: ${value}`));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const reads = session.artifacts.reads;
|
|
108
|
+
const writes = session.artifacts.writes;
|
|
109
|
+
if (reads.length > 0 || writes.length > 0) {
|
|
110
|
+
console.log();
|
|
111
|
+
console.log(chalk.bold(" Artifacts"));
|
|
112
|
+
for (const mount of reads)
|
|
113
|
+
console.log(chalk.dim(` read ${mount.artifact_id}: ${mount.artifact_path}`));
|
|
114
|
+
for (const mount of writes)
|
|
115
|
+
console.log(chalk.dim(` write ${mount.artifact_id}: ${mount.artifact_path}`));
|
|
116
|
+
}
|
|
117
|
+
if (session.validation_attempts.length > 0) {
|
|
118
|
+
console.log();
|
|
119
|
+
console.log(chalk.bold(" Validation"));
|
|
120
|
+
for (const attempt of session.validation_attempts) {
|
|
121
|
+
const marker = attempt.status === "succeeded" ? chalk.green("pass") : chalk.red("fail");
|
|
122
|
+
console.log(` ${marker} attempt ${attempt.attempt}: ${chalk.dim(attempt.summary)}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (session.summary) {
|
|
126
|
+
console.log();
|
|
127
|
+
console.log(chalk.bold(" Summary"));
|
|
128
|
+
console.log(chalk.dim(` ${session.summary}`));
|
|
129
|
+
}
|
|
130
|
+
if (session.error) {
|
|
131
|
+
console.log();
|
|
132
|
+
console.log(chalk.red(" Error"));
|
|
133
|
+
console.log(chalk.dim(` ${session.error}`));
|
|
134
|
+
}
|
|
135
|
+
console.log();
|
|
136
|
+
console.log(chalk.dim(" Run with --json for the full session record (all runtime-file paths)."));
|
|
137
|
+
console.log();
|
|
138
|
+
}
|
|
72
139
|
export const graphsCommand = {
|
|
73
140
|
command: "graphs <subcommand>",
|
|
74
141
|
describe: "Inspect Context Graphs produced for a Project",
|
|
@@ -105,6 +172,9 @@ export const graphsCommand = {
|
|
|
105
172
|
const graphId = graph.graph_id ?? graph.latest_build_run_id ?? `${graph.project}-latest`;
|
|
106
173
|
console.log(` ${chalk.bold(graphId)} ${chalk.dim(`(${statusLabel}${marker})`)}`);
|
|
107
174
|
console.log(chalk.dim(` path: ${graph.path}`));
|
|
175
|
+
const metric = graph.primary_metrics[0];
|
|
176
|
+
if (metric)
|
|
177
|
+
console.log(chalk.dim(` ${metric.label}: ${formatMetric(metric)}`));
|
|
108
178
|
}
|
|
109
179
|
console.log();
|
|
110
180
|
})
|
|
@@ -156,6 +226,81 @@ export const graphsCommand = {
|
|
|
156
226
|
process.exit(1);
|
|
157
227
|
}
|
|
158
228
|
console.log(chalk.dim(` Opened ${resource.path}`));
|
|
229
|
+
})
|
|
230
|
+
.command("sessions", "List stage execution sessions for the latest Context Graph", (y) => y
|
|
231
|
+
.option("project", {
|
|
232
|
+
type: "string",
|
|
233
|
+
demandOption: true,
|
|
234
|
+
describe: "Project id",
|
|
235
|
+
})
|
|
236
|
+
.option("json", {
|
|
237
|
+
type: "boolean",
|
|
238
|
+
default: false,
|
|
239
|
+
describe: "Print the raw JSON session records",
|
|
240
|
+
}), async (args) => {
|
|
241
|
+
const { url, token } = resolveConnection(args);
|
|
242
|
+
const { status, body, raw } = await callJson(sessionsUrl(url, args.project), token);
|
|
243
|
+
if (status !== 200) {
|
|
244
|
+
console.error(chalk.red(`Failed to list execution sessions (HTTP ${status}).`));
|
|
245
|
+
if (raw)
|
|
246
|
+
console.error(raw);
|
|
247
|
+
process.exit(1);
|
|
248
|
+
}
|
|
249
|
+
const parsed = ContextGraphSessionsResponseSchema.safeParse(body);
|
|
250
|
+
if (!parsed.success) {
|
|
251
|
+
console.error(chalk.red("Failed to parse execution sessions."));
|
|
252
|
+
process.exit(1);
|
|
253
|
+
}
|
|
254
|
+
if (args.json) {
|
|
255
|
+
console.log(JSON.stringify(parsed.data.sessions, null, 2));
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const sessions = parsed.data.sessions;
|
|
259
|
+
if (sessions.length === 0) {
|
|
260
|
+
console.log(chalk.dim(" No stage execution sessions for the latest Build run."));
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
console.log();
|
|
264
|
+
for (const session of sessions)
|
|
265
|
+
renderSessionLine(session);
|
|
266
|
+
console.log();
|
|
267
|
+
console.log(chalk.dim(" interf graphs session <stage-run-id> --project <id> for one session."));
|
|
268
|
+
console.log();
|
|
269
|
+
})
|
|
270
|
+
.command("session <stageRunId>", "Show one stage execution session", (y) => y
|
|
271
|
+
.positional("stageRunId", {
|
|
272
|
+
type: "string",
|
|
273
|
+
demandOption: true,
|
|
274
|
+
describe: "Stage execution session id (stage_run_id)",
|
|
275
|
+
})
|
|
276
|
+
.option("project", {
|
|
277
|
+
type: "string",
|
|
278
|
+
demandOption: true,
|
|
279
|
+
describe: "Project id",
|
|
280
|
+
})
|
|
281
|
+
.option("json", {
|
|
282
|
+
type: "boolean",
|
|
283
|
+
default: false,
|
|
284
|
+
describe: "Print the raw JSON session record",
|
|
285
|
+
}), async (args) => {
|
|
286
|
+
const { url, token } = resolveConnection(args);
|
|
287
|
+
const { status, body, raw } = await callJson(sessionsUrl(url, args.project, args.stageRunId), token);
|
|
288
|
+
if (status !== 200) {
|
|
289
|
+
console.error(chalk.red(`Failed to read execution session ${args.stageRunId} (HTTP ${status}).`));
|
|
290
|
+
if (raw)
|
|
291
|
+
console.error(raw);
|
|
292
|
+
process.exit(1);
|
|
293
|
+
}
|
|
294
|
+
const parsed = ContextGraphSessionResponseSchema.safeParse(body);
|
|
295
|
+
if (!parsed.success) {
|
|
296
|
+
console.error(chalk.red(`Failed to parse execution session ${args.stageRunId}.`));
|
|
297
|
+
process.exit(1);
|
|
298
|
+
}
|
|
299
|
+
if (args.json) {
|
|
300
|
+
console.log(JSON.stringify(parsed.data.session, null, 2));
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
renderSession(parsed.data.session);
|
|
159
304
|
})
|
|
160
305
|
.demandCommand(1, "Choose a graphs subcommand."),
|
|
161
306
|
handler: () => {
|
|
@@ -5,5 +5,6 @@ export interface McpArgs {
|
|
|
5
5
|
url?: string;
|
|
6
6
|
token?: string;
|
|
7
7
|
}
|
|
8
|
+
export declare function generatedMcpId(prefix: string): string;
|
|
8
9
|
export declare function startInterfMcpServer(args: McpArgs): Promise<void>;
|
|
9
10
|
export declare const mcpCommand: CommandModule<unknown, McpArgs>;
|