@evalops/maestro 0.10.21 → 0.10.22
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/dist/agent/agent.d.ts +1 -0
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/agent.js +15 -4
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/swarm/executor.d.ts.map +1 -1
- package/dist/agent/swarm/executor.js +68 -3
- package/dist/agent/swarm/executor.js.map +1 -1
- package/dist/agent/swarm/types.d.ts +3 -0
- package/dist/agent/swarm/types.d.ts.map +1 -1
- package/dist/agent/swarm/types.js.map +1 -1
- package/dist/agent/transport.d.ts.map +1 -1
- package/dist/agent/transport.js +7 -1
- package/dist/agent/transport.js.map +1 -1
- package/dist/audit/logger.d.ts +1 -1
- package/dist/bootstrap/tools-setup.d.ts.map +1 -1
- package/dist/bootstrap/tools-setup.js +3 -2
- package/dist/bootstrap/tools-setup.js.map +1 -1
- package/dist/cli/commands/a2a.d.ts.map +1 -1
- package/dist/cli/commands/a2a.js +141 -8
- package/dist/cli/commands/a2a.js.map +1 -1
- package/dist/cli/commands/codex.d.ts.map +1 -1
- package/dist/cli/commands/codex.js +4 -3
- package/dist/cli/commands/codex.js.map +1 -1
- package/dist/cli/commands/hosted-runner.d.ts +1 -0
- package/dist/cli/commands/hosted-runner.d.ts.map +1 -1
- package/dist/cli/commands/hosted-runner.js +31 -2
- package/dist/cli/commands/hosted-runner.js.map +1 -1
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +2 -9
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli-tui/commands/a2a-handlers.d.ts.map +1 -1
- package/dist/cli-tui/commands/a2a-handlers.js +55 -0
- package/dist/cli-tui/commands/a2a-handlers.js.map +1 -1
- package/dist/cli.js +3924 -1972
- package/dist/codex/compatibility.d.ts +17 -1
- package/dist/codex/compatibility.d.ts.map +1 -1
- package/dist/codex/compatibility.js +57 -1
- package/dist/codex/compatibility.js.map +1 -1
- package/dist/guardian/config.d.ts +8 -6
- package/dist/guardian/config.d.ts.map +1 -1
- package/dist/guardian/config.js +33 -7
- package/dist/guardian/config.js.map +1 -1
- package/dist/guardian/runner.d.ts.map +1 -1
- package/dist/guardian/runner.js +54 -9
- package/dist/guardian/runner.js.map +1 -1
- package/dist/mcp/config.d.ts.map +1 -1
- package/dist/mcp/config.js +2 -0
- package/dist/mcp/config.js.map +1 -1
- package/dist/mcp/fathom-cua.d.ts +3 -0
- package/dist/mcp/fathom-cua.d.ts.map +1 -0
- package/dist/mcp/fathom-cua.js +158 -0
- package/dist/mcp/fathom-cua.js.map +1 -0
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +1 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/node_modules/@evalops/contracts/package.json +1 -1
- package/dist/node_modules/@evalops/tui/package.json +1 -1
- package/dist/platform/a2a-cockpit.d.ts +90 -0
- package/dist/platform/a2a-cockpit.d.ts.map +1 -0
- package/dist/platform/a2a-cockpit.js +302 -0
- package/dist/platform/a2a-cockpit.js.map +1 -0
- package/dist/platform/a2a-fleet.d.ts +14 -0
- package/dist/platform/a2a-fleet.d.ts.map +1 -1
- package/dist/platform/a2a-fleet.js +66 -1
- package/dist/platform/a2a-fleet.js.map +1 -1
- package/dist/platform/a2a-ownership.d.ts +27 -0
- package/dist/platform/a2a-ownership.d.ts.map +1 -0
- package/dist/platform/a2a-ownership.js +149 -0
- package/dist/platform/a2a-ownership.js.map +1 -0
- package/dist/platform/a2a-task-ledger.d.ts.map +1 -1
- package/dist/platform/a2a-task-ledger.js +29 -5
- package/dist/platform/a2a-task-ledger.js.map +1 -1
- package/dist/server/agent-trajectory-replay-lab.d.ts +36 -0
- package/dist/server/agent-trajectory-replay-lab.d.ts.map +1 -0
- package/dist/server/agent-trajectory-replay-lab.js +48 -0
- package/dist/server/agent-trajectory-replay-lab.js.map +1 -0
- package/dist/server/any-agent-control-plane-proof.d.ts +42 -0
- package/dist/server/any-agent-control-plane-proof.d.ts.map +1 -0
- package/dist/server/any-agent-control-plane-proof.js +175 -0
- package/dist/server/any-agent-control-plane-proof.js.map +1 -0
- package/dist/server/app-context.d.ts +1 -0
- package/dist/server/app-context.d.ts.map +1 -1
- package/dist/server/app-context.js.map +1 -1
- package/dist/server/handlers/a2a-cockpit.d.ts +3 -0
- package/dist/server/handlers/a2a-cockpit.d.ts.map +1 -0
- package/dist/server/handlers/a2a-cockpit.js +71 -0
- package/dist/server/handlers/a2a-cockpit.js.map +1 -0
- package/dist/server/handlers/headless-sessions.d.ts.map +1 -1
- package/dist/server/handlers/headless-sessions.js +17 -2
- package/dist/server/handlers/headless-sessions.js.map +1 -1
- package/dist/server/handlers/session-artifacts.d.ts.map +1 -1
- package/dist/server/handlers/session-artifacts.js +20 -3
- package/dist/server/handlers/session-artifacts.js.map +1 -1
- package/dist/server/handlers/session-replay-lab.d.ts +13 -0
- package/dist/server/handlers/session-replay-lab.d.ts.map +1 -0
- package/dist/server/handlers/session-replay-lab.js +80 -0
- package/dist/server/handlers/session-replay-lab.js.map +1 -0
- package/dist/server/handlers/stats.js +1 -1
- package/dist/server/handlers/stats.js.map +1 -1
- package/dist/server/handlers/status.d.ts +44 -3
- package/dist/server/handlers/status.d.ts.map +1 -1
- package/dist/server/handlers/status.js +227 -17
- package/dist/server/handlers/status.js.map +1 -1
- package/dist/server/headless-runtime-service.d.ts +17 -0
- package/dist/server/headless-runtime-service.d.ts.map +1 -1
- package/dist/server/headless-runtime-service.js +143 -3
- package/dist/server/headless-runtime-service.js.map +1 -1
- package/dist/server/hosted-agent-runtime-progress.d.ts +17 -0
- package/dist/server/hosted-agent-runtime-progress.d.ts.map +1 -1
- package/dist/server/hosted-agent-runtime-progress.js +352 -15
- package/dist/server/hosted-agent-runtime-progress.js.map +1 -1
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +14 -0
- package/dist/server/routes.js.map +1 -1
- package/dist/services/intelligent-router/index.d.ts +1 -1
- package/dist/services/intelligent-router/index.d.ts.map +1 -1
- package/dist/services/intelligent-router/index.js +1 -1
- package/dist/services/intelligent-router/index.js.map +1 -1
- package/dist/services/intelligent-router/normalize.d.ts +10 -2
- package/dist/services/intelligent-router/normalize.d.ts.map +1 -1
- package/dist/services/intelligent-router/normalize.js +20 -1
- package/dist/services/intelligent-router/normalize.js.map +1 -1
- package/dist/services/intelligent-router/service.d.ts.map +1 -1
- package/dist/services/intelligent-router/service.js +35 -0
- package/dist/services/intelligent-router/service.js.map +1 -1
- package/dist/services/intelligent-router/types.d.ts +13 -0
- package/dist/services/intelligent-router/types.d.ts.map +1 -1
- package/dist/services/intelligent-router/types.js +1 -0
- package/dist/services/intelligent-router/types.js.map +1 -1
- package/dist/telemetry/cli-command-aggregator.d.ts +1 -0
- package/dist/telemetry/cli-command-aggregator.d.ts.map +1 -1
- package/dist/telemetry/cli-command-aggregator.js +23 -0
- package/dist/telemetry/cli-command-aggregator.js.map +1 -1
- package/dist/telemetry/maestro-event-bus.d.ts.map +1 -1
- package/dist/telemetry/maestro-event-bus.js +11 -5
- package/dist/telemetry/maestro-event-bus.js.map +1 -1
- package/dist/telemetry/maestro-event-catalog.d.ts +15 -1
- package/dist/telemetry/maestro-event-catalog.d.ts.map +1 -1
- package/dist/telemetry/maestro-event-catalog.js +30 -0
- package/dist/telemetry/maestro-event-catalog.js.map +1 -1
- package/dist/version.json +2 -2
- package/package.json +289 -283
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { getEnvValue } from "../platform/client.js";
|
|
4
|
+
import { createLogger } from "../utils/logger.js";
|
|
5
|
+
const logger = createLogger("mcp:fathom-cua");
|
|
6
|
+
const DISABLED_VALUES = new Set(["0", "false", "no", "off"]);
|
|
7
|
+
const ENABLED_ENV_VARS = [
|
|
8
|
+
"MAESTRO_FATHOM_CUA_ENABLED",
|
|
9
|
+
"FATHOM_CUA_MCP_ENABLED",
|
|
10
|
+
];
|
|
11
|
+
const NAME_ENV_VARS = ["MAESTRO_FATHOM_CUA_MCP_NAME", "FATHOM_CUA_MCP_NAME"];
|
|
12
|
+
const COMMAND_ENV_VARS = [
|
|
13
|
+
"MAESTRO_FATHOM_CUA_CLIENT_COMMAND",
|
|
14
|
+
"FATHOM_CUA_CLIENT_COMMAND",
|
|
15
|
+
];
|
|
16
|
+
const ARGS_ENV_VARS = [
|
|
17
|
+
"MAESTRO_FATHOM_CUA_CLIENT_ARGS_JSON",
|
|
18
|
+
"FATHOM_CUA_CLIENT_ARGS_JSON",
|
|
19
|
+
];
|
|
20
|
+
const REPO_ENV_VARS = ["MAESTRO_FATHOM_CUA_REPO", "FATHOM_CUA_REPO"];
|
|
21
|
+
const CWD_ENV_VARS = [
|
|
22
|
+
"MAESTRO_FATHOM_CUA_CLIENT_CWD",
|
|
23
|
+
"FATHOM_CUA_CLIENT_CWD",
|
|
24
|
+
];
|
|
25
|
+
const WORKSPACE_ENV_VARS = [
|
|
26
|
+
"MAESTRO_FATHOM_CUA_WORKSPACE_ID",
|
|
27
|
+
"FATHOM_CUA_WORKSPACE_ID",
|
|
28
|
+
"MAESTRO_WORKSPACE_ID",
|
|
29
|
+
"MAESTRO_EVALOPS_WORKSPACE_ID",
|
|
30
|
+
"EVALOPS_WORKSPACE_ID",
|
|
31
|
+
];
|
|
32
|
+
const HELPER_ENDPOINT_ENV_VARS = [
|
|
33
|
+
"MAESTRO_FATHOM_CUA_HELPER_ENDPOINT",
|
|
34
|
+
"FATHOM_CUA_HELPER_ENDPOINT",
|
|
35
|
+
];
|
|
36
|
+
const IPC_ROOT_ENV_VARS = [
|
|
37
|
+
"MAESTRO_FATHOM_CUA_IPC_ROOT",
|
|
38
|
+
"FATHOM_CUA_IPC_ROOT",
|
|
39
|
+
"FATHOM_IPC_ROOT",
|
|
40
|
+
];
|
|
41
|
+
const SESSION_ID_ENV_VARS = [
|
|
42
|
+
"MAESTRO_FATHOM_CUA_SESSION_ID",
|
|
43
|
+
"FATHOM_CUA_SESSION_ID",
|
|
44
|
+
"MAESTRO_SESSION_ID",
|
|
45
|
+
];
|
|
46
|
+
const TURN_ID_ENV_VARS = [
|
|
47
|
+
"MAESTRO_FATHOM_CUA_TURN_ID",
|
|
48
|
+
"FATHOM_CUA_TURN_ID",
|
|
49
|
+
"MAESTRO_AGENT_RUN_ID",
|
|
50
|
+
"MAESTRO_REQUEST_ID",
|
|
51
|
+
];
|
|
52
|
+
const DISABLE_IPC_ENV_VARS = [
|
|
53
|
+
"MAESTRO_FATHOM_CUA_DISABLE_IPC",
|
|
54
|
+
"FATHOM_CUA_DISABLE_IPC",
|
|
55
|
+
];
|
|
56
|
+
const DEFAULT_SERVER_NAME = "fathom-cua";
|
|
57
|
+
function envFlagEnabled(names) {
|
|
58
|
+
const value = getEnvValue(names);
|
|
59
|
+
if (!value) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return !DISABLED_VALUES.has(value.trim().toLowerCase());
|
|
63
|
+
}
|
|
64
|
+
function envFlagDisabled(names) {
|
|
65
|
+
const value = getEnvValue(names);
|
|
66
|
+
if (!value) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
return DISABLED_VALUES.has(value.trim().toLowerCase());
|
|
70
|
+
}
|
|
71
|
+
function parseArgsJson(raw) {
|
|
72
|
+
if (!raw) {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const parsed = JSON.parse(raw);
|
|
77
|
+
if (!Array.isArray(parsed)) {
|
|
78
|
+
throw new Error("expected an array");
|
|
79
|
+
}
|
|
80
|
+
return parsed.map((item) => {
|
|
81
|
+
if (typeof item !== "string") {
|
|
82
|
+
throw new Error("expected only string arguments");
|
|
83
|
+
}
|
|
84
|
+
return item;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
logger.warn("Ignoring invalid Fathom CUA MCP args JSON", {
|
|
89
|
+
error: error instanceof Error ? error.message : String(error),
|
|
90
|
+
});
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function appendFlag(args, flag, value) {
|
|
95
|
+
if (value) {
|
|
96
|
+
args.push(flag, value);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function resolveFathomRepo() {
|
|
100
|
+
const configured = getEnvValue(REPO_ENV_VARS);
|
|
101
|
+
if (configured) {
|
|
102
|
+
return configured;
|
|
103
|
+
}
|
|
104
|
+
const candidates = [
|
|
105
|
+
join(process.cwd(), "..", "fathom"),
|
|
106
|
+
join(process.cwd(), "..", "..", "fathom"),
|
|
107
|
+
join(process.cwd(), "..", "..", "..", "fathom"),
|
|
108
|
+
];
|
|
109
|
+
return candidates.find((candidate) => existsSync(join(candidate, "cmd", "fathom-client", "main.go")));
|
|
110
|
+
}
|
|
111
|
+
function buildFathomCuaServer() {
|
|
112
|
+
const repo = resolveFathomRepo();
|
|
113
|
+
const configuredCommand = getEnvValue(COMMAND_ENV_VARS);
|
|
114
|
+
const configuredCwd = getEnvValue(CWD_ENV_VARS);
|
|
115
|
+
const command = configuredCommand ?? (repo ? "go" : "fathom-client");
|
|
116
|
+
const cwd = configuredCwd ?? (configuredCommand ? undefined : repo);
|
|
117
|
+
const extraArgs = parseArgsJson(getEnvValue(ARGS_ENV_VARS));
|
|
118
|
+
const args = configuredCommand
|
|
119
|
+
? [...extraArgs]
|
|
120
|
+
: repo
|
|
121
|
+
? ["run", "./cmd/fathom-client", ...extraArgs]
|
|
122
|
+
: [...extraArgs];
|
|
123
|
+
const workspaceId = getEnvValue(WORKSPACE_ENV_VARS);
|
|
124
|
+
const helperEndpoint = getEnvValue(HELPER_ENDPOINT_ENV_VARS);
|
|
125
|
+
const ipcRoot = getEnvValue(IPC_ROOT_ENV_VARS);
|
|
126
|
+
const sessionId = getEnvValue(SESSION_ID_ENV_VARS);
|
|
127
|
+
const turnId = getEnvValue(TURN_ID_ENV_VARS);
|
|
128
|
+
appendFlag(args, "-workspace-id", workspaceId);
|
|
129
|
+
appendFlag(args, "-helper-endpoint", helperEndpoint);
|
|
130
|
+
appendFlag(args, "-ipc-root", ipcRoot);
|
|
131
|
+
appendFlag(args, "-session-id", sessionId);
|
|
132
|
+
appendFlag(args, "-turn-id", turnId);
|
|
133
|
+
if (envFlagEnabled(DISABLE_IPC_ENV_VARS)) {
|
|
134
|
+
args.push("-disable-ipc");
|
|
135
|
+
}
|
|
136
|
+
const env = Object.fromEntries(Object.entries({
|
|
137
|
+
FATHOM_CALLER_PRODUCT: "maestro",
|
|
138
|
+
FATHOM_CUA_PRODUCT: "maestro",
|
|
139
|
+
FATHOM_CUA_WORKSPACE_ID: workspaceId,
|
|
140
|
+
FATHOM_IPC_ROOT: ipcRoot,
|
|
141
|
+
}).filter((entry) => Boolean(entry[1])));
|
|
142
|
+
return {
|
|
143
|
+
name: getEnvValue(NAME_ENV_VARS) ?? DEFAULT_SERVER_NAME,
|
|
144
|
+
transport: "stdio",
|
|
145
|
+
command,
|
|
146
|
+
args,
|
|
147
|
+
cwd,
|
|
148
|
+
env,
|
|
149
|
+
scope: "plugin",
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
export function getFathomCuaPluginServers() {
|
|
153
|
+
if (envFlagDisabled(ENABLED_ENV_VARS) || !envFlagEnabled(ENABLED_ENV_VARS)) {
|
|
154
|
+
return [];
|
|
155
|
+
}
|
|
156
|
+
return [buildFathomCuaServer()];
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=fathom-cua.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fathom-cua.js","sourceRoot":"","sources":["../../src/mcp/fathom-cua.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAA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,CAAC,CAClE,CAAC;IAEF,OAAO;QACN,IAAI,EAAE,WAAW,CAAC,aAAa,CAAC,IAAI,mBAAmB;QACvD,SAAS,EAAE,OAAO;QAClB,OAAO;QACP,IAAI;QACJ,GAAG;QACH,GAAG;QACH,KAAK,EAAE,QAAQ;KACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,yBAAyB;IACxC,IAAI,eAAe,CAAC,gBAAgB,CAAC,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC5E,OAAO,EAAE,CAAC;IACX,CAAC;IACD,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { getEnvValue } from \"../platform/client.js\";\nimport { createLogger } from \"../utils/logger.js\";\nimport type { McpServerConfig } from \"./types.js\";\n\nconst logger = createLogger(\"mcp:fathom-cua\");\n\nconst DISABLED_VALUES = new Set([\"0\", \"false\", \"no\", \"off\"]);\nconst ENABLED_ENV_VARS = [\n\t\"MAESTRO_FATHOM_CUA_ENABLED\",\n\t\"FATHOM_CUA_MCP_ENABLED\",\n] as const;\nconst NAME_ENV_VARS = [\"MAESTRO_FATHOM_CUA_MCP_NAME\", \"FATHOM_CUA_MCP_NAME\"];\nconst COMMAND_ENV_VARS = [\n\t\"MAESTRO_FATHOM_CUA_CLIENT_COMMAND\",\n\t\"FATHOM_CUA_CLIENT_COMMAND\",\n] as const;\nconst ARGS_ENV_VARS = [\n\t\"MAESTRO_FATHOM_CUA_CLIENT_ARGS_JSON\",\n\t\"FATHOM_CUA_CLIENT_ARGS_JSON\",\n] as const;\nconst REPO_ENV_VARS = [\"MAESTRO_FATHOM_CUA_REPO\", \"FATHOM_CUA_REPO\"] as const;\nconst CWD_ENV_VARS = [\n\t\"MAESTRO_FATHOM_CUA_CLIENT_CWD\",\n\t\"FATHOM_CUA_CLIENT_CWD\",\n] as const;\nconst WORKSPACE_ENV_VARS = [\n\t\"MAESTRO_FATHOM_CUA_WORKSPACE_ID\",\n\t\"FATHOM_CUA_WORKSPACE_ID\",\n\t\"MAESTRO_WORKSPACE_ID\",\n\t\"MAESTRO_EVALOPS_WORKSPACE_ID\",\n\t\"EVALOPS_WORKSPACE_ID\",\n] as const;\nconst HELPER_ENDPOINT_ENV_VARS = [\n\t\"MAESTRO_FATHOM_CUA_HELPER_ENDPOINT\",\n\t\"FATHOM_CUA_HELPER_ENDPOINT\",\n] as const;\nconst IPC_ROOT_ENV_VARS = [\n\t\"MAESTRO_FATHOM_CUA_IPC_ROOT\",\n\t\"FATHOM_CUA_IPC_ROOT\",\n\t\"FATHOM_IPC_ROOT\",\n] as const;\nconst SESSION_ID_ENV_VARS = [\n\t\"MAESTRO_FATHOM_CUA_SESSION_ID\",\n\t\"FATHOM_CUA_SESSION_ID\",\n\t\"MAESTRO_SESSION_ID\",\n] as const;\nconst TURN_ID_ENV_VARS = [\n\t\"MAESTRO_FATHOM_CUA_TURN_ID\",\n\t\"FATHOM_CUA_TURN_ID\",\n\t\"MAESTRO_AGENT_RUN_ID\",\n\t\"MAESTRO_REQUEST_ID\",\n] as const;\nconst DISABLE_IPC_ENV_VARS = [\n\t\"MAESTRO_FATHOM_CUA_DISABLE_IPC\",\n\t\"FATHOM_CUA_DISABLE_IPC\",\n] as const;\nconst DEFAULT_SERVER_NAME = \"fathom-cua\";\n\nfunction envFlagEnabled(names: readonly string[]): boolean {\n\tconst value = getEnvValue(names);\n\tif (!value) {\n\t\treturn false;\n\t}\n\treturn !DISABLED_VALUES.has(value.trim().toLowerCase());\n}\n\nfunction envFlagDisabled(names: readonly string[]): boolean {\n\tconst value = getEnvValue(names);\n\tif (!value) {\n\t\treturn false;\n\t}\n\treturn DISABLED_VALUES.has(value.trim().toLowerCase());\n}\n\nfunction parseArgsJson(raw: string | undefined): string[] {\n\tif (!raw) {\n\t\treturn [];\n\t}\n\ttry {\n\t\tconst parsed = JSON.parse(raw) as unknown;\n\t\tif (!Array.isArray(parsed)) {\n\t\t\tthrow new Error(\"expected an array\");\n\t\t}\n\t\treturn parsed.map((item) => {\n\t\t\tif (typeof item !== \"string\") {\n\t\t\t\tthrow new Error(\"expected only string arguments\");\n\t\t\t}\n\t\t\treturn item;\n\t\t});\n\t} catch (error) {\n\t\tlogger.warn(\"Ignoring invalid Fathom CUA MCP args JSON\", {\n\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t});\n\t\treturn [];\n\t}\n}\n\nfunction appendFlag(\n\targs: string[],\n\tflag: string,\n\tvalue: string | undefined,\n): void {\n\tif (value) {\n\t\targs.push(flag, value);\n\t}\n}\n\nfunction resolveFathomRepo(): string | undefined {\n\tconst configured = getEnvValue(REPO_ENV_VARS);\n\tif (configured) {\n\t\treturn configured;\n\t}\n\n\tconst candidates = [\n\t\tjoin(process.cwd(), \"..\", \"fathom\"),\n\t\tjoin(process.cwd(), \"..\", \"..\", \"fathom\"),\n\t\tjoin(process.cwd(), \"..\", \"..\", \"..\", \"fathom\"),\n\t];\n\treturn candidates.find((candidate) =>\n\t\texistsSync(join(candidate, \"cmd\", \"fathom-client\", \"main.go\")),\n\t);\n}\n\nfunction buildFathomCuaServer(): McpServerConfig {\n\tconst repo = resolveFathomRepo();\n\tconst configuredCommand = getEnvValue(COMMAND_ENV_VARS);\n\tconst configuredCwd = getEnvValue(CWD_ENV_VARS);\n\tconst command = configuredCommand ?? (repo ? \"go\" : \"fathom-client\");\n\tconst cwd = configuredCwd ?? (configuredCommand ? undefined : repo);\n\tconst extraArgs = parseArgsJson(getEnvValue(ARGS_ENV_VARS));\n\tconst args = configuredCommand\n\t\t? [...extraArgs]\n\t\t: repo\n\t\t\t? [\"run\", \"./cmd/fathom-client\", ...extraArgs]\n\t\t\t: [...extraArgs];\n\tconst workspaceId = getEnvValue(WORKSPACE_ENV_VARS);\n\tconst helperEndpoint = getEnvValue(HELPER_ENDPOINT_ENV_VARS);\n\tconst ipcRoot = getEnvValue(IPC_ROOT_ENV_VARS);\n\tconst sessionId = getEnvValue(SESSION_ID_ENV_VARS);\n\tconst turnId = getEnvValue(TURN_ID_ENV_VARS);\n\n\tappendFlag(args, \"-workspace-id\", workspaceId);\n\tappendFlag(args, \"-helper-endpoint\", helperEndpoint);\n\tappendFlag(args, \"-ipc-root\", ipcRoot);\n\tappendFlag(args, \"-session-id\", sessionId);\n\tappendFlag(args, \"-turn-id\", turnId);\n\tif (envFlagEnabled(DISABLE_IPC_ENV_VARS)) {\n\t\targs.push(\"-disable-ipc\");\n\t}\n\n\tconst env = Object.fromEntries(\n\t\tObject.entries({\n\t\t\tFATHOM_CALLER_PRODUCT: \"maestro\",\n\t\t\tFATHOM_CUA_PRODUCT: \"maestro\",\n\t\t\tFATHOM_CUA_WORKSPACE_ID: workspaceId,\n\t\t\tFATHOM_IPC_ROOT: ipcRoot,\n\t\t}).filter((entry): entry is [string, string] => Boolean(entry[1])),\n\t);\n\n\treturn {\n\t\tname: getEnvValue(NAME_ENV_VARS) ?? DEFAULT_SERVER_NAME,\n\t\ttransport: \"stdio\",\n\t\tcommand,\n\t\targs,\n\t\tcwd,\n\t\tenv,\n\t\tscope: \"plugin\",\n\t};\n}\n\nexport function getFathomCuaPluginServers(): McpServerConfig[] {\n\tif (envFlagDisabled(ENABLED_ENV_VARS) || !envFlagEnabled(ENABLED_ENV_VARS)) {\n\t\treturn [];\n\t}\n\treturn [buildFathomCuaServer()];\n}\n"]}
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { buildMcpToolName, isMcpTool, parseMcpToolName } from "./names.js";
|
|
|
5
5
|
export { defaultEnvValidators, evaluateEnvValidators, type EnvValidator, type EnvValidatorResult, } from "./env-limits.js";
|
|
6
6
|
export { getMcpRemoteHost, getOfficialMcpRegistryUrls, getOfficialMcpRegistryEntries, getOfficialMcpRegistryMatch, normalizeMcpRemoteUrl, officialMcpRegistryEntryMatchesUrl, prefetchOfficialMcpRegistry, resetOfficialMcpRegistryCacheForTesting, resolveOfficialMcpRegistryEntry, searchOfficialMcpRegistry, setOfficialMcpRegistryCacheForTesting, buildSuggestedMcpServerName, } from "./official-registry.js";
|
|
7
7
|
export { buildProjectMcpServerFingerprint, getProjectMcpServerApprovalStatus, setProjectMcpServerApprovalDecision, } from "./project-approvals.js";
|
|
8
|
+
export { getFathomCuaPluginServers } from "./fathom-cua.js";
|
|
8
9
|
export { getPlatformMcpPluginServers } from "./platform-plugin.js";
|
|
9
10
|
export type { McpAuthPresetConfig, McpAuthPresetStatus, McpConfig, McpOfficialRegistryEntry, McpOfficialRegistryInfo, McpOfficialRegistryUrlOption, McpProjectApprovalDecision, McpProjectApprovalStatus, McpServerConfig, McpServerStatus, McpManagerStatus, McpRemoteTrust, McpTransport, McpScope, } from "./types.js";
|
|
10
11
|
export type { McpAuthPresetInput, McpServerInput } from "./schema.js";
|
package/dist/mcp/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,wBAAwB,EACxB,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,uBAAuB,EACvB,aAAa,EACb,6BAA6B,EAC7B,yBAAyB,EACzB,2BAA2B,EAC3B,uBAAuB,EACvB,KAAK,gBAAgB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EACN,oBAAoB,EACpB,cAAc,EACd,aAAa,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EACN,oBAAoB,EACpB,qBAAqB,EACrB,KAAK,YAAY,EACjB,KAAK,kBAAkB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,gBAAgB,EAChB,0BAA0B,EAC1B,6BAA6B,EAC7B,2BAA2B,EAC3B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qBAAqB,EACrB,kCAAkC,EAClC,2BAA2B,EAC3B,uCAAuC,EACvC,+BAA+B,EAC/B,yBAAyB,EACzB,qCAAqC,EACrC,2BAA2B,GAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,gCAAgC,EAChC,iCAAiC,EACjC,mCAAmC,GACnC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACnE,YAAY,EACX,mBAAmB,EACnB,mBAAmB,EACnB,SAAS,EACT,wBAAwB,EACxB,uBAAuB,EACvB,4BAA4B,EAC5B,0BAA0B,EAC1B,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,QAAQ,GACR,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/mcp/index.js
CHANGED
|
@@ -5,5 +5,6 @@ export { buildMcpToolName, isMcpTool, parseMcpToolName } from "./names.js";
|
|
|
5
5
|
export { defaultEnvValidators, evaluateEnvValidators, } from "./env-limits.js";
|
|
6
6
|
export { getMcpRemoteHost, getOfficialMcpRegistryUrls, getOfficialMcpRegistryEntries, getOfficialMcpRegistryMatch, normalizeMcpRemoteUrl, officialMcpRegistryEntryMatchesUrl, prefetchOfficialMcpRegistry, resetOfficialMcpRegistryCacheForTesting, resolveOfficialMcpRegistryEntry, searchOfficialMcpRegistry, setOfficialMcpRegistryCacheForTesting, buildSuggestedMcpServerName, } from "./official-registry.js";
|
|
7
7
|
export { buildProjectMcpServerFingerprint, getProjectMcpServerApprovalStatus, setProjectMcpServerApprovalDecision, } from "./project-approvals.js";
|
|
8
|
+
export { getFathomCuaPluginServers } from "./fathom-cua.js";
|
|
8
9
|
export { getPlatformMcpPluginServers } from "./platform-plugin.js";
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
package/dist/mcp/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,wBAAwB,EACxB,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,uBAAuB,EACvB,aAAa,EACb,6BAA6B,EAC7B,yBAAyB,EACzB,2BAA2B,EAC3B,uBAAuB,GAEvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EACN,oBAAoB,EACpB,cAAc,EACd,aAAa,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EACN,oBAAoB,EACpB,qBAAqB,GAGrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,gBAAgB,EAChB,0BAA0B,EAC1B,6BAA6B,EAC7B,2BAA2B,EAC3B,qBAAqB,EACrB,kCAAkC,EAClC,2BAA2B,EAC3B,uCAAuC,EACvC,+BAA+B,EAC/B,yBAAyB,EACzB,qCAAqC,EACrC,2BAA2B,GAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,gCAAgC,EAChC,iCAAiC,EACjC,mCAAmC,GACnC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export {\n\taddMcpAuthPresetToConfig,\n\taddMcpServerToConfig,\n\tgetConfigPaths,\n\tgetWritableMcpConfigPath,\n\tinferRemoteMcpTransport,\n\tloadMcpConfig,\n\tremoveMcpAuthPresetFromConfig,\n\tremoveMcpServerFromConfig,\n\tupdateMcpAuthPresetInConfig,\n\tupdateMcpServerInConfig,\n\ttype WritableMcpScope,\n} from \"./config.js\";\nexport { mcpManager, McpClientManager } from \"./manager.js\";\nexport {\n\tcreateMcpToolWrapper,\n\tgetAllMcpTools,\n\tgetMcpToolMap,\n} from \"./tool-bridge.js\";\nexport { buildMcpToolName, isMcpTool, parseMcpToolName } from \"./names.js\";\nexport {\n\tdefaultEnvValidators,\n\tevaluateEnvValidators,\n\ttype EnvValidator,\n\ttype EnvValidatorResult,\n} from \"./env-limits.js\";\nexport {\n\tgetMcpRemoteHost,\n\tgetOfficialMcpRegistryUrls,\n\tgetOfficialMcpRegistryEntries,\n\tgetOfficialMcpRegistryMatch,\n\tnormalizeMcpRemoteUrl,\n\tofficialMcpRegistryEntryMatchesUrl,\n\tprefetchOfficialMcpRegistry,\n\tresetOfficialMcpRegistryCacheForTesting,\n\tresolveOfficialMcpRegistryEntry,\n\tsearchOfficialMcpRegistry,\n\tsetOfficialMcpRegistryCacheForTesting,\n\tbuildSuggestedMcpServerName,\n} from \"./official-registry.js\";\nexport {\n\tbuildProjectMcpServerFingerprint,\n\tgetProjectMcpServerApprovalStatus,\n\tsetProjectMcpServerApprovalDecision,\n} from \"./project-approvals.js\";\nexport { getPlatformMcpPluginServers } from \"./platform-plugin.js\";\nexport type {\n\tMcpAuthPresetConfig,\n\tMcpAuthPresetStatus,\n\tMcpConfig,\n\tMcpOfficialRegistryEntry,\n\tMcpOfficialRegistryInfo,\n\tMcpOfficialRegistryUrlOption,\n\tMcpProjectApprovalDecision,\n\tMcpProjectApprovalStatus,\n\tMcpServerConfig,\n\tMcpServerStatus,\n\tMcpManagerStatus,\n\tMcpRemoteTrust,\n\tMcpTransport,\n\tMcpScope,\n} from \"./types.js\";\nexport type { McpAuthPresetInput, McpServerInput } from \"./schema.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,wBAAwB,EACxB,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,uBAAuB,EACvB,aAAa,EACb,6BAA6B,EAC7B,yBAAyB,EACzB,2BAA2B,EAC3B,uBAAuB,GAEvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EACN,oBAAoB,EACpB,cAAc,EACd,aAAa,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EACN,oBAAoB,EACpB,qBAAqB,GAGrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,gBAAgB,EAChB,0BAA0B,EAC1B,6BAA6B,EAC7B,2BAA2B,EAC3B,qBAAqB,EACrB,kCAAkC,EAClC,2BAA2B,EAC3B,uCAAuC,EACvC,+BAA+B,EAC/B,yBAAyB,EACzB,qCAAqC,EACrC,2BAA2B,GAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,gCAAgC,EAChC,iCAAiC,EACjC,mCAAmC,GACnC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export {\n\taddMcpAuthPresetToConfig,\n\taddMcpServerToConfig,\n\tgetConfigPaths,\n\tgetWritableMcpConfigPath,\n\tinferRemoteMcpTransport,\n\tloadMcpConfig,\n\tremoveMcpAuthPresetFromConfig,\n\tremoveMcpServerFromConfig,\n\tupdateMcpAuthPresetInConfig,\n\tupdateMcpServerInConfig,\n\ttype WritableMcpScope,\n} from \"./config.js\";\nexport { mcpManager, McpClientManager } from \"./manager.js\";\nexport {\n\tcreateMcpToolWrapper,\n\tgetAllMcpTools,\n\tgetMcpToolMap,\n} from \"./tool-bridge.js\";\nexport { buildMcpToolName, isMcpTool, parseMcpToolName } from \"./names.js\";\nexport {\n\tdefaultEnvValidators,\n\tevaluateEnvValidators,\n\ttype EnvValidator,\n\ttype EnvValidatorResult,\n} from \"./env-limits.js\";\nexport {\n\tgetMcpRemoteHost,\n\tgetOfficialMcpRegistryUrls,\n\tgetOfficialMcpRegistryEntries,\n\tgetOfficialMcpRegistryMatch,\n\tnormalizeMcpRemoteUrl,\n\tofficialMcpRegistryEntryMatchesUrl,\n\tprefetchOfficialMcpRegistry,\n\tresetOfficialMcpRegistryCacheForTesting,\n\tresolveOfficialMcpRegistryEntry,\n\tsearchOfficialMcpRegistry,\n\tsetOfficialMcpRegistryCacheForTesting,\n\tbuildSuggestedMcpServerName,\n} from \"./official-registry.js\";\nexport {\n\tbuildProjectMcpServerFingerprint,\n\tgetProjectMcpServerApprovalStatus,\n\tsetProjectMcpServerApprovalDecision,\n} from \"./project-approvals.js\";\nexport { getFathomCuaPluginServers } from \"./fathom-cua.js\";\nexport { getPlatformMcpPluginServers } from \"./platform-plugin.js\";\nexport type {\n\tMcpAuthPresetConfig,\n\tMcpAuthPresetStatus,\n\tMcpConfig,\n\tMcpOfficialRegistryEntry,\n\tMcpOfficialRegistryInfo,\n\tMcpOfficialRegistryUrlOption,\n\tMcpProjectApprovalDecision,\n\tMcpProjectApprovalStatus,\n\tMcpServerConfig,\n\tMcpServerStatus,\n\tMcpManagerStatus,\n\tMcpRemoteTrust,\n\tMcpTransport,\n\tMcpScope,\n} from \"./types.js\";\nexport type { McpAuthPresetInput, McpServerInput } from \"./schema.js\";\n"]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { type A2AFleetSummary } from "./a2a-fleet.js";
|
|
2
|
+
import { type A2AOwnershipScope } from "./a2a-ownership.js";
|
|
3
|
+
import { type A2ATaskLedgerFile } from "./a2a-task-ledger.js";
|
|
4
|
+
import type { A2AWorkGraphMetadata } from "./a2a-work-graph.js";
|
|
5
|
+
export type A2ACockpitTaskStatus = "waiting" | "running" | "completed" | "failed" | "unknown";
|
|
6
|
+
export type A2ACockpitNextActionSeverity = "info" | "warning" | "critical";
|
|
7
|
+
export interface A2ACockpitOptions {
|
|
8
|
+
registryPath?: string;
|
|
9
|
+
tasksPath?: string;
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
peer?: string;
|
|
12
|
+
limit?: number;
|
|
13
|
+
ownershipScope?: A2AOwnershipScope;
|
|
14
|
+
}
|
|
15
|
+
export interface A2ACockpitSummary {
|
|
16
|
+
generatedAt: string;
|
|
17
|
+
registryPath: string;
|
|
18
|
+
tasksPath: string;
|
|
19
|
+
peer?: string;
|
|
20
|
+
counts: A2ACockpitCounts;
|
|
21
|
+
peers: A2ACockpitPeerSummary[];
|
|
22
|
+
tasks: A2ACockpitTaskSummary[];
|
|
23
|
+
nextActions: A2ACockpitNextAction[];
|
|
24
|
+
}
|
|
25
|
+
export interface A2ACockpitCounts {
|
|
26
|
+
peers: number;
|
|
27
|
+
onlinePeers: number;
|
|
28
|
+
unreachablePeers: number;
|
|
29
|
+
tasks: number;
|
|
30
|
+
runningTasks: number;
|
|
31
|
+
actionRequiredTasks: number;
|
|
32
|
+
failedTasks: number;
|
|
33
|
+
completedTasks: number;
|
|
34
|
+
}
|
|
35
|
+
export interface A2ACockpitPeerSummary {
|
|
36
|
+
name: string;
|
|
37
|
+
displayName?: string;
|
|
38
|
+
url: string;
|
|
39
|
+
status: "online" | "unreachable";
|
|
40
|
+
error?: string;
|
|
41
|
+
auth?: string;
|
|
42
|
+
model?: string;
|
|
43
|
+
cwd?: string;
|
|
44
|
+
taskCounts: Pick<A2ACockpitCounts, "tasks" | "runningTasks" | "actionRequiredTasks" | "failedTasks" | "completedTasks">;
|
|
45
|
+
lastTask?: {
|
|
46
|
+
id: string;
|
|
47
|
+
state: string;
|
|
48
|
+
status: A2ACockpitTaskStatus;
|
|
49
|
+
updatedAt: string;
|
|
50
|
+
text: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export interface A2ACockpitTaskSummary {
|
|
54
|
+
ledgerId: string;
|
|
55
|
+
peer: string;
|
|
56
|
+
peerDisplayName?: string;
|
|
57
|
+
orphanedPeer?: boolean;
|
|
58
|
+
taskId: string;
|
|
59
|
+
state: string;
|
|
60
|
+
status: A2ACockpitTaskStatus;
|
|
61
|
+
requiresInput: boolean;
|
|
62
|
+
terminal: boolean;
|
|
63
|
+
final: boolean;
|
|
64
|
+
text: string;
|
|
65
|
+
responseText?: string;
|
|
66
|
+
updatedAt: string;
|
|
67
|
+
completedAt?: string;
|
|
68
|
+
workGraph?: A2AWorkGraphMetadata;
|
|
69
|
+
nextCommand?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface A2ACockpitNextAction {
|
|
72
|
+
id: string;
|
|
73
|
+
label: string;
|
|
74
|
+
command: string;
|
|
75
|
+
severity: A2ACockpitNextActionSeverity;
|
|
76
|
+
peer: string;
|
|
77
|
+
taskId?: string;
|
|
78
|
+
reason: string;
|
|
79
|
+
}
|
|
80
|
+
export interface SummarizeA2ACockpitInput {
|
|
81
|
+
fleet: A2AFleetSummary;
|
|
82
|
+
ledger: A2ATaskLedgerFile;
|
|
83
|
+
peer?: string;
|
|
84
|
+
limit?: number;
|
|
85
|
+
generatedAt?: string;
|
|
86
|
+
ownershipScope?: A2AOwnershipScope;
|
|
87
|
+
}
|
|
88
|
+
export declare function buildA2ACockpit(options?: A2ACockpitOptions): Promise<A2ACockpitSummary>;
|
|
89
|
+
export declare function summarizeA2ACockpit(input: SummarizeA2ACockpitInput): A2ACockpitSummary;
|
|
90
|
+
//# sourceMappingURL=a2a-cockpit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"a2a-cockpit.d.ts","sourceRoot":"","sources":["../../src/platform/a2a-cockpit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,gBAAgB,CAAC;AACvE,OAAO,EACN,KAAK,iBAAiB,EAItB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEN,KAAK,iBAAiB,EAMtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE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AiB,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,iBAAiB,CAAC;CACnC;AAED,wBAAsB,eAAe,CACpC,OAAO,GAAE,iBAAsB,GAC7B,OAAO,CAAC,iBAAiB,CAAC,CAmB5B;AAqBD,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,wBAAwB,GAC7B,iBAAiB,CA8CnB"}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { inspectA2AFleet } from "./a2a-fleet.js";
|
|
2
|
+
import { hasA2AOwnershipRecordMarkers, hasA2AOwnershipScope, matchesA2AOwnershipScope, } from "./a2a-ownership.js";
|
|
3
|
+
import { isActionRequiredA2AState, isFinalA2AState, isTerminalA2AState, listA2ATaskEntries, loadA2ATaskLedger, } from "./a2a-task-ledger.js";
|
|
4
|
+
export async function buildA2ACockpit(options = {}) {
|
|
5
|
+
if (!hasA2AOwnershipScope(options.ownershipScope)) {
|
|
6
|
+
return buildA2ACockpitUnscoped(options);
|
|
7
|
+
}
|
|
8
|
+
const ledger = await loadA2ATaskLedger({ path: options.tasksPath });
|
|
9
|
+
const fleet = await inspectA2AFleet({
|
|
10
|
+
registryPath: options.registryPath,
|
|
11
|
+
tasksPath: options.tasksPath,
|
|
12
|
+
timeoutMs: options.timeoutMs,
|
|
13
|
+
ownershipScope: options.ownershipScope,
|
|
14
|
+
includePeerNames: scopedLedgerPeerNames(ledger, options.ownershipScope),
|
|
15
|
+
});
|
|
16
|
+
return summarizeA2ACockpit({
|
|
17
|
+
fleet,
|
|
18
|
+
ledger,
|
|
19
|
+
peer: options.peer,
|
|
20
|
+
limit: options.limit,
|
|
21
|
+
ownershipScope: options.ownershipScope,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
async function buildA2ACockpitUnscoped(options) {
|
|
25
|
+
const [fleet, ledger] = await Promise.all([
|
|
26
|
+
inspectA2AFleet({
|
|
27
|
+
registryPath: options.registryPath,
|
|
28
|
+
tasksPath: options.tasksPath,
|
|
29
|
+
timeoutMs: options.timeoutMs,
|
|
30
|
+
}),
|
|
31
|
+
loadA2ATaskLedger({ path: options.tasksPath }),
|
|
32
|
+
]);
|
|
33
|
+
return summarizeA2ACockpit({
|
|
34
|
+
fleet,
|
|
35
|
+
ledger,
|
|
36
|
+
peer: options.peer,
|
|
37
|
+
limit: options.limit,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export function summarizeA2ACockpit(input) {
|
|
41
|
+
const peerFilter = cleanPeer(input.peer);
|
|
42
|
+
const limit = normalizeLimit(input.limit);
|
|
43
|
+
const hasOwnershipScope = hasA2AOwnershipScope(input.ownershipScope);
|
|
44
|
+
const scopedOwnedPeerNames = new Set(hasOwnershipScope
|
|
45
|
+
? input.fleet.peers
|
|
46
|
+
.filter((peer) => matchesA2AOwnershipScope(peer, input.ownershipScope))
|
|
47
|
+
.map((peer) => peer.name)
|
|
48
|
+
: []);
|
|
49
|
+
const scopedLedger = filterLedgerForOwnership(input.ledger, input.ownershipScope, scopedOwnedPeerNames);
|
|
50
|
+
const scopedTaskPeerNames = new Set(scopedLedger.tasks.map((task) => task.peer));
|
|
51
|
+
const peers = input.fleet.peers
|
|
52
|
+
.filter((peer) => !hasOwnershipScope ||
|
|
53
|
+
scopedOwnedPeerNames.has(peer.name) ||
|
|
54
|
+
scopedTaskPeerNames.has(peer.name))
|
|
55
|
+
.filter((peer) => !peerFilter || peer.name === peerFilter)
|
|
56
|
+
.map((peer) => summarizePeer(peer, scopedLedger));
|
|
57
|
+
const registeredPeerNames = new Set(peers.map((peer) => peer.name));
|
|
58
|
+
const tasks = listA2ATaskEntries(scopedLedger, { peer: peerFilter })
|
|
59
|
+
.map((task) => summarizeTask(task, registeredPeerNames))
|
|
60
|
+
.sort(compareTasksForCockpit);
|
|
61
|
+
const limitedTasks = tasks.slice(0, limit);
|
|
62
|
+
const counts = summarizeCounts(peers, tasks);
|
|
63
|
+
return {
|
|
64
|
+
generatedAt: input.generatedAt ?? input.fleet.generatedAt,
|
|
65
|
+
registryPath: input.fleet.registryPath,
|
|
66
|
+
tasksPath: input.fleet.tasksPath,
|
|
67
|
+
...(peerFilter ? { peer: peerFilter } : {}),
|
|
68
|
+
counts,
|
|
69
|
+
peers,
|
|
70
|
+
tasks: limitedTasks,
|
|
71
|
+
nextActions: summarizeNextActions(peers, tasks, limit),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function filterLedgerForOwnership(ledger, scope, ownedPeerNames = new Set()) {
|
|
75
|
+
if (!hasA2AOwnershipScope(scope)) {
|
|
76
|
+
return ledger;
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
tasks: ledger.tasks.filter((entry) => hasA2AOwnershipRecordMarkers(entry)
|
|
80
|
+
? matchesA2AOwnershipScope(entry, scope)
|
|
81
|
+
: ownedPeerNames.has(entry.peer)),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function scopedLedgerPeerNames(ledger, scope) {
|
|
85
|
+
return [
|
|
86
|
+
...new Set(ledger.tasks
|
|
87
|
+
.filter((entry) => hasA2AOwnershipRecordMarkers(entry) &&
|
|
88
|
+
matchesA2AOwnershipScope(entry, scope))
|
|
89
|
+
.map((entry) => entry.peer)),
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
function summarizePeer(peer, ledger) {
|
|
93
|
+
const tasks = listA2ATaskEntries(ledger, { peer: peer.name }).map((task) => summarizeTask(task));
|
|
94
|
+
const lastTask = tasks[0];
|
|
95
|
+
return {
|
|
96
|
+
name: peer.name,
|
|
97
|
+
...(peer.displayName ? { displayName: peer.displayName } : {}),
|
|
98
|
+
url: peer.url,
|
|
99
|
+
status: peer.status,
|
|
100
|
+
...(peer.error ? { error: peer.error } : {}),
|
|
101
|
+
...(peer.auth ? { auth: peer.auth } : {}),
|
|
102
|
+
...(peer.model ? { model: peer.model } : {}),
|
|
103
|
+
...(peer.cwd ? { cwd: peer.cwd } : {}),
|
|
104
|
+
taskCounts: {
|
|
105
|
+
tasks: tasks.length,
|
|
106
|
+
runningTasks: tasks.filter((task) => task.status === "running").length,
|
|
107
|
+
actionRequiredTasks: tasks.filter((task) => task.status === "waiting")
|
|
108
|
+
.length,
|
|
109
|
+
failedTasks: tasks.filter((task) => task.status === "failed").length,
|
|
110
|
+
completedTasks: tasks.filter((task) => task.status === "completed")
|
|
111
|
+
.length,
|
|
112
|
+
},
|
|
113
|
+
...(lastTask
|
|
114
|
+
? {
|
|
115
|
+
lastTask: {
|
|
116
|
+
id: lastTask.taskId,
|
|
117
|
+
state: lastTask.state,
|
|
118
|
+
status: lastTask.status,
|
|
119
|
+
updatedAt: lastTask.updatedAt,
|
|
120
|
+
text: lastTask.text,
|
|
121
|
+
},
|
|
122
|
+
}
|
|
123
|
+
: {}),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function summarizeTask(entry, registeredPeerNames) {
|
|
127
|
+
const status = classifyTaskState(entry.state);
|
|
128
|
+
const requiresInput = isActionRequiredA2AState(entry.state);
|
|
129
|
+
const terminal = isTerminalA2AState(entry.state);
|
|
130
|
+
const final = isFinalA2AState(entry.state);
|
|
131
|
+
const orphanedPeer = registeredPeerNames !== undefined && !registeredPeerNames.has(entry.peer);
|
|
132
|
+
const nextCommand = orphanedPeer ? undefined : taskCommand(entry, status);
|
|
133
|
+
return {
|
|
134
|
+
ledgerId: entry.id,
|
|
135
|
+
peer: entry.peer,
|
|
136
|
+
...(entry.peerDisplayName
|
|
137
|
+
? { peerDisplayName: entry.peerDisplayName }
|
|
138
|
+
: {}),
|
|
139
|
+
...(orphanedPeer ? { orphanedPeer: true } : {}),
|
|
140
|
+
taskId: entry.taskId,
|
|
141
|
+
state: entry.state,
|
|
142
|
+
status,
|
|
143
|
+
requiresInput,
|
|
144
|
+
terminal,
|
|
145
|
+
final,
|
|
146
|
+
text: entry.text,
|
|
147
|
+
...(entry.responseText ? { responseText: entry.responseText } : {}),
|
|
148
|
+
updatedAt: entry.updatedAt,
|
|
149
|
+
...(entry.completedAt ? { completedAt: entry.completedAt } : {}),
|
|
150
|
+
...(entry.workGraph ? { workGraph: entry.workGraph } : {}),
|
|
151
|
+
...(nextCommand ? { nextCommand } : {}),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function summarizeCounts(peers, tasks) {
|
|
155
|
+
return {
|
|
156
|
+
peers: peers.length,
|
|
157
|
+
onlinePeers: peers.filter((peer) => peer.status === "online").length,
|
|
158
|
+
unreachablePeers: peers.filter((peer) => peer.status === "unreachable")
|
|
159
|
+
.length,
|
|
160
|
+
tasks: tasks.length,
|
|
161
|
+
runningTasks: tasks.filter((task) => task.status === "running").length,
|
|
162
|
+
actionRequiredTasks: tasks.filter((task) => task.status === "waiting")
|
|
163
|
+
.length,
|
|
164
|
+
failedTasks: tasks.filter((task) => task.status === "failed").length,
|
|
165
|
+
completedTasks: tasks.filter((task) => task.status === "completed").length,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function summarizeNextActions(peers, tasks, limit) {
|
|
169
|
+
const actions = tasks
|
|
170
|
+
.map((task) => nextActionForTask(task))
|
|
171
|
+
.filter((action) => Boolean(action))
|
|
172
|
+
.slice(0, limit);
|
|
173
|
+
if (actions.length > 0) {
|
|
174
|
+
return actions;
|
|
175
|
+
}
|
|
176
|
+
return peers
|
|
177
|
+
.filter((peer) => peer.status === "online" && peer.taskCounts.runningTasks === 0)
|
|
178
|
+
.slice(0, limit)
|
|
179
|
+
.map((peer) => ({
|
|
180
|
+
id: `delegate:${peer.name}`,
|
|
181
|
+
label: `Delegate fresh work to ${peer.name}`,
|
|
182
|
+
command: `maestro a2a delegate ${shellQuote(peer.name)} <objective> --wait --work-graph`,
|
|
183
|
+
severity: "info",
|
|
184
|
+
peer: peer.name,
|
|
185
|
+
reason: "Peer is reachable and has no active local A2A task in the ledger.",
|
|
186
|
+
}));
|
|
187
|
+
}
|
|
188
|
+
function nextActionForTask(task) {
|
|
189
|
+
if (task.orphanedPeer) {
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
192
|
+
if (task.status === "waiting") {
|
|
193
|
+
return {
|
|
194
|
+
id: `reply:${task.peer}:${task.taskId}`,
|
|
195
|
+
label: `Reply to ${task.peer} task ${task.taskId}`,
|
|
196
|
+
command: `maestro a2a reply ${shellQuote(task.peer)} ${shellQuote(task.taskId)} <response> --wait --work-graph`,
|
|
197
|
+
severity: "critical",
|
|
198
|
+
peer: task.peer,
|
|
199
|
+
taskId: task.taskId,
|
|
200
|
+
reason: "Peer returned an input-required or auth-required A2A state.",
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
if (task.status === "running") {
|
|
204
|
+
return {
|
|
205
|
+
id: `wait:${task.peer}:${task.taskId}`,
|
|
206
|
+
label: `Wait for ${task.peer} task ${task.taskId}`,
|
|
207
|
+
command: task.nextCommand ??
|
|
208
|
+
`maestro a2a wait ${shellQuote(task.peer)} ${shellQuote(task.taskId)} --work-graph`,
|
|
209
|
+
severity: "info",
|
|
210
|
+
peer: task.peer,
|
|
211
|
+
taskId: task.taskId,
|
|
212
|
+
reason: "Task is still non-terminal in the local A2A ledger.",
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
if (task.status === "failed") {
|
|
216
|
+
return {
|
|
217
|
+
id: `refresh:${task.peer}:${task.taskId}`,
|
|
218
|
+
label: `Refresh failed ${task.peer} task ${task.taskId}`,
|
|
219
|
+
command: `maestro a2a tasks ${shellQuote(task.peer)} --refresh --work-graph`,
|
|
220
|
+
severity: "warning",
|
|
221
|
+
peer: task.peer,
|
|
222
|
+
taskId: task.taskId,
|
|
223
|
+
reason: "Task reached a failed, rejected, or canceled final state.",
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
function taskCommand(entry, status) {
|
|
229
|
+
if (status === "waiting") {
|
|
230
|
+
return `maestro a2a reply ${shellQuote(entry.peer)} ${shellQuote(entry.taskId)} <response> --wait --work-graph`;
|
|
231
|
+
}
|
|
232
|
+
if (status === "running") {
|
|
233
|
+
return `maestro a2a wait ${shellQuote(entry.peer)} ${shellQuote(entry.taskId)} --work-graph`;
|
|
234
|
+
}
|
|
235
|
+
return undefined;
|
|
236
|
+
}
|
|
237
|
+
function classifyTaskState(state) {
|
|
238
|
+
const normalized = normalizeState(state);
|
|
239
|
+
if (!normalized) {
|
|
240
|
+
return "unknown";
|
|
241
|
+
}
|
|
242
|
+
if (isActionRequiredA2AState(normalized)) {
|
|
243
|
+
return "waiting";
|
|
244
|
+
}
|
|
245
|
+
if (normalized.includes("COMPLETED")) {
|
|
246
|
+
return "completed";
|
|
247
|
+
}
|
|
248
|
+
if (normalized.includes("FAILED") ||
|
|
249
|
+
normalized.includes("REJECTED") ||
|
|
250
|
+
normalized.includes("CANCELED") ||
|
|
251
|
+
normalized.includes("CANCELLED")) {
|
|
252
|
+
return "failed";
|
|
253
|
+
}
|
|
254
|
+
if (!isFinalA2AState(normalized)) {
|
|
255
|
+
return "running";
|
|
256
|
+
}
|
|
257
|
+
return "unknown";
|
|
258
|
+
}
|
|
259
|
+
function compareTasksForCockpit(left, right) {
|
|
260
|
+
const urgency = taskUrgency(right.status) - taskUrgency(left.status);
|
|
261
|
+
if (urgency !== 0) {
|
|
262
|
+
return urgency;
|
|
263
|
+
}
|
|
264
|
+
return right.updatedAt.localeCompare(left.updatedAt);
|
|
265
|
+
}
|
|
266
|
+
function taskUrgency(status) {
|
|
267
|
+
switch (status) {
|
|
268
|
+
case "waiting":
|
|
269
|
+
return 4;
|
|
270
|
+
case "failed":
|
|
271
|
+
return 3;
|
|
272
|
+
case "running":
|
|
273
|
+
return 2;
|
|
274
|
+
case "unknown":
|
|
275
|
+
return 1;
|
|
276
|
+
case "completed":
|
|
277
|
+
return 0;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
function normalizeLimit(limit) {
|
|
281
|
+
if (limit === undefined) {
|
|
282
|
+
return 8;
|
|
283
|
+
}
|
|
284
|
+
if (!Number.isFinite(limit) || limit <= 0) {
|
|
285
|
+
return 8;
|
|
286
|
+
}
|
|
287
|
+
return Math.min(Math.floor(limit), 50);
|
|
288
|
+
}
|
|
289
|
+
function cleanPeer(peer) {
|
|
290
|
+
const trimmed = peer?.trim();
|
|
291
|
+
return trimmed ? trimmed : undefined;
|
|
292
|
+
}
|
|
293
|
+
function normalizeState(state) {
|
|
294
|
+
return state.toUpperCase().replace(/[\s-]+/gu, "_");
|
|
295
|
+
}
|
|
296
|
+
function shellQuote(value) {
|
|
297
|
+
if (/^[A-Za-z0-9_./:-]+$/u.test(value)) {
|
|
298
|
+
return value;
|
|
299
|
+
}
|
|
300
|
+
return `'${value.replace(/'/gu, "'\\''")}'`;
|
|
301
|
+
}
|
|
302
|
+
//# sourceMappingURL=a2a-cockpit.js.map
|