@evalops/maestro 0.10.13 → 0.10.15
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 +1 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +26 -0
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli.js +91 -1
- package/dist/evalops/agent-bootstrap.d.ts +15 -0
- package/dist/evalops/agent-bootstrap.d.ts.map +1 -1
- package/dist/evalops/agent-bootstrap.js +57 -0
- package/dist/evalops/agent-bootstrap.js.map +1 -1
- package/dist/evalops/managed-context.d.ts +5 -0
- package/dist/evalops/managed-context.d.ts.map +1 -1
- package/dist/evalops/managed-context.js +19 -0
- package/dist/evalops/managed-context.js.map +1 -1
- package/dist/mcp/platform-plugin.d.ts.map +1 -1
- package/dist/mcp/platform-plugin.js +5 -0
- package/dist/mcp/platform-plugin.js.map +1 -1
- package/dist/version.json +2 -2
- package/node_modules/@evalops/contracts/package.json +1 -1
- package/node_modules/@evalops/tui/package.json +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -98,6 +98,7 @@ See [Safety](docs/SAFETY.md) and the [Threat Model](docs/THREAT_MODEL.md) for th
|
|
|
98
98
|
| Set up MCP servers | [MCP Guide](docs/MCP_GUIDE.md) |
|
|
99
99
|
| Work on the repo as a contributor | [Contributor Runbook](docs/CONTRIBUTOR_RUNBOOK.md) |
|
|
100
100
|
| Integrate Maestro headlessly | [Headless protocol](docs/protocols/headless.md) |
|
|
101
|
+
| Bring any coding agent into EvalOps | [Any-Agent Control Plane](docs/design/ANY_AGENT_CONTROL_PLANE.md) |
|
|
101
102
|
| Browse the full docs map | [Documentation index](docs/README.md) |
|
|
102
103
|
|
|
103
104
|
## Contributing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,kBAAkB,EACvB,qBAAqB,EACrB,MAAM,kCAAkC,CAAC;AAG1C,wBAAgB,cAAc,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,kBAAkB,EACvB,qBAAqB,EACrB,MAAM,kCAAkC,CAAC;AAG1C,wBAAgB,cAAc,IAAI,MAAM,CAuBvC;AA4BD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,kBAAkB,CA+FhE;AAMD,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,GACvD,MAAM,CAuCR;AAED,wBAAsB,iBAAiB,CAAC,IAAI,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA+C1E"}
|
|
@@ -10,6 +10,11 @@ export function formatInitHelp() {
|
|
|
10
10
|
Options
|
|
11
11
|
--agent-type <type> Agent type to register, defaults to maestro
|
|
12
12
|
--surface <surface> Surface to register, defaults to cli
|
|
13
|
+
--integration-profile <profile> mcp_only, mcp_otlp, managed_runtime, sdk_integrated, or provider_proxy
|
|
14
|
+
--shim-type <type> native_mcp, command_wrapper, hook, provider_proxy, sdk, or mcp_firewall_proxy
|
|
15
|
+
--trace-mode <mode> none, mcp_events, or otlp
|
|
16
|
+
--memory-mode <mode> none, read_only, durable, or cerebro
|
|
17
|
+
--runtime-owner <owner> external or evalops
|
|
13
18
|
--workspace, --workspace-id <id> Workspace to associate with the registration
|
|
14
19
|
--scope <scope[,scope...]> Registration scopes to request
|
|
15
20
|
--key-scope <scope[,scope...]> API key scopes to request
|
|
@@ -67,6 +72,10 @@ export function parseInitArgs(args) {
|
|
|
67
72
|
case "--force-login":
|
|
68
73
|
options.forceLogin = true;
|
|
69
74
|
break;
|
|
75
|
+
case "--integration-profile":
|
|
76
|
+
options.integrationProfile = readValue(args, i, arg);
|
|
77
|
+
i++;
|
|
78
|
+
break;
|
|
70
79
|
case "--json":
|
|
71
80
|
options.json = true;
|
|
72
81
|
break;
|
|
@@ -78,6 +87,10 @@ export function parseInitArgs(args) {
|
|
|
78
87
|
options.manifestUrl = readValue(args, i, arg);
|
|
79
88
|
i++;
|
|
80
89
|
break;
|
|
90
|
+
case "--memory-mode":
|
|
91
|
+
options.memoryMode = readValue(args, i, arg);
|
|
92
|
+
i++;
|
|
93
|
+
break;
|
|
81
94
|
case "--register-scope":
|
|
82
95
|
case "--scope":
|
|
83
96
|
options.registerScopes = appendScopes(options.registerScopes, readValue(args, i, arg));
|
|
@@ -86,10 +99,22 @@ export function parseInitArgs(args) {
|
|
|
86
99
|
case "--rotate-key":
|
|
87
100
|
options.rotateKey = true;
|
|
88
101
|
break;
|
|
102
|
+
case "--runtime-owner":
|
|
103
|
+
options.runtimeOwner = readValue(args, i, arg);
|
|
104
|
+
i++;
|
|
105
|
+
break;
|
|
106
|
+
case "--shim-type":
|
|
107
|
+
options.shimType = readValue(args, i, arg);
|
|
108
|
+
i++;
|
|
109
|
+
break;
|
|
89
110
|
case "--surface":
|
|
90
111
|
options.surface = readValue(args, i, arg);
|
|
91
112
|
i++;
|
|
92
113
|
break;
|
|
114
|
+
case "--trace-mode":
|
|
115
|
+
options.traceMode = readValue(args, i, arg);
|
|
116
|
+
i++;
|
|
117
|
+
break;
|
|
93
118
|
case "--ttl-seconds":
|
|
94
119
|
options.ttlSeconds = parsePositiveInteger(readValue(args, i, arg), arg);
|
|
95
120
|
i++;
|
|
@@ -121,6 +146,7 @@ export function formatInitSuccess(result) {
|
|
|
121
146
|
checkLine(`Authenticated as ${authenticatedAs}`),
|
|
122
147
|
checkLine(`${keyMode} managed inference key`),
|
|
123
148
|
checkLine("Registered local agent runtime"),
|
|
149
|
+
checkLine(`Integration profile ${result.integrationProfile ?? "managed_runtime"} via ${result.shimType ?? "sdk"}`),
|
|
124
150
|
checkLine(`Loaded ${governedActions} governed actions`),
|
|
125
151
|
checkLine(result.approvalPolicyAttached
|
|
126
152
|
? "Attached default approval policy"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEN,qBAAqB,GACrB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE7D,MAAM,UAAU,cAAc;IAC7B,OAAO,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG,KAAK,CAC/C;;;;;;;;;;;;;;kEAcgE,CAChE,EAAE,CAAC;AACL,CAAC;AAED,SAAS,SAAS,CAAC,IAAc,EAAE,KAAa,EAAE,IAAY;IAC7D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IAC9B,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,mBAAmB,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAa,EAAE,IAAY;IACxD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,6BAA6B,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,QAA8B,EAAE,KAAa;IAClE,OAAO;QACN,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;QACnB,GAAG,KAAK;aACN,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,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BAC9B,OAAO;YACR,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACxC,CAAC;KACD,CAAC,CAAC;IAEH,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7C,OAAO;IACR,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import chalk from \"chalk\";\nimport {\n\ttype EvalOpsInitOptions,\n\tbootstrapEvalOpsAgent,\n} from \"../../evalops/agent-bootstrap.js\";\nimport { muted, sectionHeading } from \"../../style/theme.js\";\n\nexport function formatInitHelp(): string {\n\treturn `${sectionHeading(\"maestro init\")}${muted(\n\t\t` maestro init Login, create or reuse an API key, and register this agent\n maestro init --rotate-key Replace the stored agent MCP API key\n maestro init --mcp-url <url> Override the EvalOps agent MCP endpoint\n maestro init --json Emit machine-readable bootstrap output\n\nOptions\n --agent-type <type> Agent type to register, defaults to maestro\n --surface <surface> Surface to register, defaults to cli\n --workspace, --workspace-id <id> Workspace to associate with the registration\n --scope <scope[,scope...]> Registration scopes to request\n --key-scope <scope[,scope...]> API key scopes to request\n --expires-in-days <days> API key TTL in days\n --force-login Re-run EvalOps OAuth before bootstrapping\n --manifest-url <url> Override the agent MCP manifest URL\n --ttl-seconds <seconds> Registration TTL in seconds`,\n\t)}`;\n}\n\nfunction readValue(args: string[], index: number, flag: string): string {\n\tconst value = args[index + 1];\n\tif (!value || value.startsWith(\"-\")) {\n\t\tthrow new Error(`${flag} requires a value`);\n\t}\n\treturn value;\n}\n\nfunction parsePositiveInteger(value: string, flag: string): number {\n\tconst parsed = Number.parseInt(value, 10);\n\tif (!Number.isInteger(parsed) || parsed <= 0) {\n\t\tthrow new Error(`${flag} must be a positive integer`);\n\t}\n\treturn parsed;\n}\n\nfunction appendScopes(existing: string[] | undefined, value: string): string[] {\n\treturn [\n\t\t...(existing ?? []),\n\t\t...value\n\t\t\t.split(\",\")\n\t\t\t.map((entry) => entry.trim())\n\t\t\t.filter((entry) => entry.length > 0),\n\t];\n}\n\nexport function parseInitArgs(args: string[]): EvalOpsInitOptions {\n\tconst options: EvalOpsInitOptions = {};\n\tfor (let i = 0; i < args.length; i++) {\n\t\tconst arg = args[i];\n\t\tswitch (arg) {\n\t\t\tcase \"--agent-mcp-url\":\n\t\t\tcase \"--mcp-url\":\n\t\t\t\toptions.mcpUrl = readValue(args, i, arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--agent-type\":\n\t\t\t\toptions.agentType = readValue(args, i, arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--api-key-scope\":\n\t\t\tcase \"--key-scope\":\n\t\t\t\toptions.apiKeyScopes = appendScopes(\n\t\t\t\t\toptions.apiKeyScopes,\n\t\t\t\t\treadValue(args, i, arg),\n\t\t\t\t);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--expires-in-days\":\n\t\t\t\toptions.expiresInDays = parsePositiveInteger(\n\t\t\t\t\treadValue(args, i, arg),\n\t\t\t\t\targ,\n\t\t\t\t);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--force-login\":\n\t\t\t\toptions.forceLogin = true;\n\t\t\t\tbreak;\n\t\t\tcase \"--json\":\n\t\t\t\toptions.json = true;\n\t\t\t\tbreak;\n\t\t\tcase \"--key-name\":\n\t\t\t\toptions.keyName = readValue(args, i, arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--manifest-url\":\n\t\t\t\toptions.manifestUrl = readValue(args, i, arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--register-scope\":\n\t\t\tcase \"--scope\":\n\t\t\t\toptions.registerScopes = appendScopes(\n\t\t\t\t\toptions.registerScopes,\n\t\t\t\t\treadValue(args, i, arg),\n\t\t\t\t);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--rotate-key\":\n\t\t\t\toptions.rotateKey = true;\n\t\t\t\tbreak;\n\t\t\tcase \"--surface\":\n\t\t\t\toptions.surface = readValue(args, i, arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--ttl-seconds\":\n\t\t\t\toptions.ttlSeconds = parsePositiveInteger(readValue(args, i, arg), arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--workspace\":\n\t\t\tcase \"--workspace-id\":\n\t\t\t\toptions.workspaceId = readValue(args, i, arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif (arg?.startsWith(\"-\")) {\n\t\t\t\t\tthrow new Error(`Unknown maestro init option: ${arg}`);\n\t\t\t\t}\n\t\t\t\tthrow new Error(`Unexpected maestro init argument: ${arg}`);\n\t\t}\n\t}\n\treturn options;\n}\n\nfunction checkLine(text: string): string {\n\treturn `${chalk.green(\"✓\")} ${text}`;\n}\n\nexport function formatInitSuccess(\n\tresult: Awaited<ReturnType<typeof bootstrapEvalOpsAgent>>,\n): string {\n\tconst keyMode = result.apiKeyCreated ? \"Created\" : \"Reused\";\n\tconst authenticatedAs = result.authenticatedAs ?? \"EvalOps\";\n\tconst governedActions = result.governedActionsLoaded ?? 0;\n\tconst lines = [\n\t\tchalk.bold(\"EvalOps Maestro bootstrap\"),\n\t\t\"\",\n\t\tcheckLine(`Authenticated as ${authenticatedAs}`),\n\t\tcheckLine(`${keyMode} managed inference key`),\n\t\tcheckLine(\"Registered local agent runtime\"),\n\t\tcheckLine(`Loaded ${governedActions} governed actions`),\n\t\tcheckLine(\n\t\t\tresult.approvalPolicyAttached\n\t\t\t\t? \"Attached default approval policy\"\n\t\t\t\t: \"Queued approval policy review\",\n\t\t),\n\t\tcheckLine(\n\t\t\tresult.traceIngestionStarted\n\t\t\t\t? \"Started trace ingestion\"\n\t\t\t\t: \"Requested trace ingestion\",\n\t\t),\n\t\tcheckLine(\n\t\t\tresult.governedInferenceCheckRan\n\t\t\t\t? \"Ran first governed inference check\"\n\t\t\t\t: \"Queued first governed inference check\",\n\t\t),\n\t\tcheckLine(\n\t\t\tresult.evidenceEventPublished\n\t\t\t\t? \"Published evidence event\"\n\t\t\t\t: \"Queued evidence event\",\n\t\t),\n\t\t\"\",\n\t\t\"Open console:\",\n\t\tresult.consoleUrl ?? \"https://app.evalops.dev/overview?env=production\",\n\t];\n\treturn lines.join(\"\\n\");\n}\n\nexport async function handleInitCommand(args: string[] = []): Promise<void> {\n\tif (args.includes(\"--help\") || args.includes(\"-h\")) {\n\t\tconsole.log(formatInitHelp());\n\t\treturn;\n\t}\n\n\tlet options: EvalOpsInitOptions;\n\ttry {\n\t\toptions = parseInitArgs(args);\n\t} catch (error) {\n\t\tconsole.error(\n\t\t\tchalk.red(error instanceof Error ? error.message : String(error)),\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\tconst result = await bootstrapEvalOpsAgent(options, {\n\t\tonAuthUrl: (url) => {\n\t\t\tif (options.json) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t\"Open this URL in your browser to authenticate with EvalOps:\",\n\t\t\t\t);\n\t\t\t\tconsole.error(url);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconsole.log(\n\t\t\t\tchalk.yellow(\n\t\t\t\t\t\"Open this URL in your browser to authenticate with EvalOps:\",\n\t\t\t\t),\n\t\t\t);\n\t\t\tconsole.log(chalk.underline(url));\n\t\t},\n\t\tonStatus: (status) => {\n\t\t\tif (options.json) {\n\t\t\t\tconsole.error(status.message);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconsole.log(chalk.dim(status.message));\n\t\t},\n\t});\n\n\tif (options.json) {\n\t\tconsole.log(JSON.stringify(result, null, 2));\n\t\treturn;\n\t}\n\n\tconsole.log(format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ootstrapEvalOpsAgent,\n} from \"../../evalops/agent-bootstrap.js\";\nimport { muted, sectionHeading } from \"../../style/theme.js\";\n\nexport function formatInitHelp(): string {\n\treturn `${sectionHeading(\"maestro init\")}${muted(\n\t\t` maestro init Login, create or reuse an API key, and register this agent\n maestro init --rotate-key Replace the stored agent MCP API key\n maestro init --mcp-url <url> Override the EvalOps agent MCP endpoint\n maestro init --json Emit machine-readable bootstrap output\n\nOptions\n --agent-type <type> Agent type to register, defaults to maestro\n --surface <surface> Surface to register, defaults to cli\n --integration-profile <profile> mcp_only, mcp_otlp, managed_runtime, sdk_integrated, or provider_proxy\n --shim-type <type> native_mcp, command_wrapper, hook, provider_proxy, sdk, or mcp_firewall_proxy\n --trace-mode <mode> none, mcp_events, or otlp\n --memory-mode <mode> none, read_only, durable, or cerebro\n --runtime-owner <owner> external or evalops\n --workspace, --workspace-id <id> Workspace to associate with the registration\n --scope <scope[,scope...]> Registration scopes to request\n --key-scope <scope[,scope...]> API key scopes to request\n --expires-in-days <days> API key TTL in days\n --force-login Re-run EvalOps OAuth before bootstrapping\n --manifest-url <url> Override the agent MCP manifest URL\n --ttl-seconds <seconds> Registration TTL in seconds`,\n\t)}`;\n}\n\nfunction readValue(args: string[], index: number, flag: string): string {\n\tconst value = args[index + 1];\n\tif (!value || value.startsWith(\"-\")) {\n\t\tthrow new Error(`${flag} requires a value`);\n\t}\n\treturn value;\n}\n\nfunction parsePositiveInteger(value: string, flag: string): number {\n\tconst parsed = Number.parseInt(value, 10);\n\tif (!Number.isInteger(parsed) || parsed <= 0) {\n\t\tthrow new Error(`${flag} must be a positive integer`);\n\t}\n\treturn parsed;\n}\n\nfunction appendScopes(existing: string[] | undefined, value: string): string[] {\n\treturn [\n\t\t...(existing ?? []),\n\t\t...value\n\t\t\t.split(\",\")\n\t\t\t.map((entry) => entry.trim())\n\t\t\t.filter((entry) => entry.length > 0),\n\t];\n}\n\nexport function parseInitArgs(args: string[]): EvalOpsInitOptions {\n\tconst options: EvalOpsInitOptions = {};\n\tfor (let i = 0; i < args.length; i++) {\n\t\tconst arg = args[i];\n\t\tswitch (arg) {\n\t\t\tcase \"--agent-mcp-url\":\n\t\t\tcase \"--mcp-url\":\n\t\t\t\toptions.mcpUrl = readValue(args, i, arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--agent-type\":\n\t\t\t\toptions.agentType = readValue(args, i, arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--api-key-scope\":\n\t\t\tcase \"--key-scope\":\n\t\t\t\toptions.apiKeyScopes = appendScopes(\n\t\t\t\t\toptions.apiKeyScopes,\n\t\t\t\t\treadValue(args, i, arg),\n\t\t\t\t);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--expires-in-days\":\n\t\t\t\toptions.expiresInDays = parsePositiveInteger(\n\t\t\t\t\treadValue(args, i, arg),\n\t\t\t\t\targ,\n\t\t\t\t);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--force-login\":\n\t\t\t\toptions.forceLogin = true;\n\t\t\t\tbreak;\n\t\t\tcase \"--integration-profile\":\n\t\t\t\toptions.integrationProfile = readValue(args, i, arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--json\":\n\t\t\t\toptions.json = true;\n\t\t\t\tbreak;\n\t\t\tcase \"--key-name\":\n\t\t\t\toptions.keyName = readValue(args, i, arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--manifest-url\":\n\t\t\t\toptions.manifestUrl = readValue(args, i, arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--memory-mode\":\n\t\t\t\toptions.memoryMode = readValue(args, i, arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--register-scope\":\n\t\t\tcase \"--scope\":\n\t\t\t\toptions.registerScopes = appendScopes(\n\t\t\t\t\toptions.registerScopes,\n\t\t\t\t\treadValue(args, i, arg),\n\t\t\t\t);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--rotate-key\":\n\t\t\t\toptions.rotateKey = true;\n\t\t\t\tbreak;\n\t\t\tcase \"--runtime-owner\":\n\t\t\t\toptions.runtimeOwner = readValue(args, i, arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--shim-type\":\n\t\t\t\toptions.shimType = readValue(args, i, arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--surface\":\n\t\t\t\toptions.surface = readValue(args, i, arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--trace-mode\":\n\t\t\t\toptions.traceMode = readValue(args, i, arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--ttl-seconds\":\n\t\t\t\toptions.ttlSeconds = parsePositiveInteger(readValue(args, i, arg), arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tcase \"--workspace\":\n\t\t\tcase \"--workspace-id\":\n\t\t\t\toptions.workspaceId = readValue(args, i, arg);\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif (arg?.startsWith(\"-\")) {\n\t\t\t\t\tthrow new Error(`Unknown maestro init option: ${arg}`);\n\t\t\t\t}\n\t\t\t\tthrow new Error(`Unexpected maestro init argument: ${arg}`);\n\t\t}\n\t}\n\treturn options;\n}\n\nfunction checkLine(text: string): string {\n\treturn `${chalk.green(\"✓\")} ${text}`;\n}\n\nexport function formatInitSuccess(\n\tresult: Awaited<ReturnType<typeof bootstrapEvalOpsAgent>>,\n): string {\n\tconst keyMode = result.apiKeyCreated ? \"Created\" : \"Reused\";\n\tconst authenticatedAs = result.authenticatedAs ?? \"EvalOps\";\n\tconst governedActions = result.governedActionsLoaded ?? 0;\n\tconst lines = [\n\t\tchalk.bold(\"EvalOps Maestro bootstrap\"),\n\t\t\"\",\n\t\tcheckLine(`Authenticated as ${authenticatedAs}`),\n\t\tcheckLine(`${keyMode} managed inference key`),\n\t\tcheckLine(\"Registered local agent runtime\"),\n\t\tcheckLine(\n\t\t\t`Integration profile ${result.integrationProfile ?? \"managed_runtime\"} via ${result.shimType ?? \"sdk\"}`,\n\t\t),\n\t\tcheckLine(`Loaded ${governedActions} governed actions`),\n\t\tcheckLine(\n\t\t\tresult.approvalPolicyAttached\n\t\t\t\t? \"Attached default approval policy\"\n\t\t\t\t: \"Queued approval policy review\",\n\t\t),\n\t\tcheckLine(\n\t\t\tresult.traceIngestionStarted\n\t\t\t\t? \"Started trace ingestion\"\n\t\t\t\t: \"Requested trace ingestion\",\n\t\t),\n\t\tcheckLine(\n\t\t\tresult.governedInferenceCheckRan\n\t\t\t\t? \"Ran first governed inference check\"\n\t\t\t\t: \"Queued first governed inference check\",\n\t\t),\n\t\tcheckLine(\n\t\t\tresult.evidenceEventPublished\n\t\t\t\t? \"Published evidence event\"\n\t\t\t\t: \"Queued evidence event\",\n\t\t),\n\t\t\"\",\n\t\t\"Open console:\",\n\t\tresult.consoleUrl ?? \"https://app.evalops.dev/overview?env=production\",\n\t];\n\treturn lines.join(\"\\n\");\n}\n\nexport async function handleInitCommand(args: string[] = []): Promise<void> {\n\tif (args.includes(\"--help\") || args.includes(\"-h\")) {\n\t\tconsole.log(formatInitHelp());\n\t\treturn;\n\t}\n\n\tlet options: EvalOpsInitOptions;\n\ttry {\n\t\toptions = parseInitArgs(args);\n\t} catch (error) {\n\t\tconsole.error(\n\t\t\tchalk.red(error instanceof Error ? error.message : String(error)),\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\tconst result = await bootstrapEvalOpsAgent(options, {\n\t\tonAuthUrl: (url) => {\n\t\t\tif (options.json) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t\"Open this URL in your browser to authenticate with EvalOps:\",\n\t\t\t\t);\n\t\t\t\tconsole.error(url);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconsole.log(\n\t\t\t\tchalk.yellow(\n\t\t\t\t\t\"Open this URL in your browser to authenticate with EvalOps:\",\n\t\t\t\t),\n\t\t\t);\n\t\t\tconsole.log(chalk.underline(url));\n\t\t},\n\t\tonStatus: (status) => {\n\t\t\tif (options.json) {\n\t\t\t\tconsole.error(status.message);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconsole.log(chalk.dim(status.message));\n\t\t},\n\t});\n\n\tif (options.json) {\n\t\tconsole.log(JSON.stringify(result, null, 2));\n\t\treturn;\n\t}\n\n\tconsole.log(formatInitSuccess(result));\n}\n"]}
|
package/dist/cli.js
CHANGED
|
@@ -38284,9 +38284,14 @@ function storedAgentMcp(credentials) {
|
|
|
38284
38284
|
agentId: recordValue(agentMcp, "agentId"),
|
|
38285
38285
|
apiKey: recordValue(agentMcp, "apiKey"),
|
|
38286
38286
|
endpoint: recordValue(agentMcp, "endpoint"),
|
|
38287
|
+
integrationProfile: recordValue(agentMcp, "integrationProfile"),
|
|
38287
38288
|
keyPrefix: recordValue(agentMcp, "keyPrefix"),
|
|
38289
|
+
memoryMode: recordValue(agentMcp, "memoryMode"),
|
|
38288
38290
|
runId: recordValue(agentMcp, "runId"),
|
|
38291
|
+
runtimeOwner: recordValue(agentMcp, "runtimeOwner"),
|
|
38289
38292
|
sessionExpiresAt: recordValue(agentMcp, "sessionExpiresAt"),
|
|
38293
|
+
shimType: recordValue(agentMcp, "shimType"),
|
|
38294
|
+
traceMode: recordValue(agentMcp, "traceMode"),
|
|
38290
38295
|
workspaceId: recordValue(agentMcp, "workspaceId")
|
|
38291
38296
|
};
|
|
38292
38297
|
}
|
|
@@ -38348,15 +38353,20 @@ function resolveManagedEvalOpsContext(env = process.env, loadCredentials) {
|
|
|
38348
38353
|
evidencePublisher: managed ? "EvalOps" : "none",
|
|
38349
38354
|
expiresAt: credentials?.expires,
|
|
38350
38355
|
inference: managed ? "managed" : "local",
|
|
38356
|
+
integrationProfile: agentMcp?.integrationProfile,
|
|
38351
38357
|
keyPrefix: agentMcp?.keyPrefix,
|
|
38352
38358
|
managed,
|
|
38359
|
+
memoryMode: agentMcp?.memoryMode,
|
|
38353
38360
|
mode,
|
|
38354
38361
|
organizationId,
|
|
38355
38362
|
providerRef,
|
|
38356
38363
|
runId,
|
|
38364
|
+
runtimeOwner: agentMcp?.runtimeOwner,
|
|
38357
38365
|
sessionExpiresAt: agentMcp?.sessionExpiresAt,
|
|
38358
38366
|
sessionId: readEnv2(env, ["MAESTRO_SESSION_ID"]),
|
|
38367
|
+
shimType: agentMcp?.shimType,
|
|
38359
38368
|
traceIngestion: managed && runId ? "live" : "not configured",
|
|
38369
|
+
traceMode: agentMcp?.traceMode,
|
|
38360
38370
|
userEmail: nonEmptyString(metadata?.email),
|
|
38361
38371
|
userId: readEnv2(env, USER_ENV) ?? nonEmptyString(metadata?.userId),
|
|
38362
38372
|
workspaceId
|
|
@@ -38384,6 +38394,15 @@ function formatManagedEvalOpsStatus(context2, options = {}) {
|
|
|
38384
38394
|
lines.push(`${dim("Agent")}: ${context2.agentId}`);
|
|
38385
38395
|
if (context2.runId)
|
|
38386
38396
|
lines.push(`${dim("Run")}: ${context2.runId}`);
|
|
38397
|
+
if (context2.integrationProfile) {
|
|
38398
|
+
lines.push(`${dim("Integration profile")}: ${context2.integrationProfile}`);
|
|
38399
|
+
}
|
|
38400
|
+
if (context2.shimType)
|
|
38401
|
+
lines.push(`${dim("Shim")}: ${context2.shimType}`);
|
|
38402
|
+
if (context2.traceMode)
|
|
38403
|
+
lines.push(`${dim("Trace mode")}: ${context2.traceMode}`);
|
|
38404
|
+
if (context2.memoryMode)
|
|
38405
|
+
lines.push(`${dim("Memory mode")}: ${context2.memoryMode}`);
|
|
38387
38406
|
lines.push(`${good("Trace ingestion")}: ${context2.traceIngestion}`);
|
|
38388
38407
|
lines.push(`${good("Evidence publisher")}: ${context2.evidencePublisher}`);
|
|
38389
38408
|
lines.push(`${good("Inference")}: ${context2.inference}`);
|
|
@@ -87399,14 +87418,19 @@ function getStoredAgentMcpMetadata(credentials) {
|
|
|
87399
87418
|
surface,
|
|
87400
87419
|
agentId: nonEmptyString2(agentMcp?.agentId),
|
|
87401
87420
|
expiresAt: nonEmptyString2(agentMcp?.expiresAt),
|
|
87421
|
+
integrationProfile: nonEmptyString2(agentMcp?.integrationProfile),
|
|
87402
87422
|
keyId: nonEmptyString2(agentMcp?.keyId),
|
|
87403
87423
|
keyName: nonEmptyString2(agentMcp?.keyName),
|
|
87404
87424
|
keyPrefix: nonEmptyString2(agentMcp?.keyPrefix),
|
|
87405
87425
|
manifestUrl: nonEmptyString2(agentMcp?.manifestUrl),
|
|
87426
|
+
memoryMode: nonEmptyString2(agentMcp?.memoryMode),
|
|
87406
87427
|
registryVisible: typeof agentMcp?.registryVisible === "boolean" ? agentMcp.registryVisible : void 0,
|
|
87407
87428
|
runId: nonEmptyString2(agentMcp?.runId),
|
|
87429
|
+
runtimeOwner: nonEmptyString2(agentMcp?.runtimeOwner),
|
|
87408
87430
|
scopes: stringArray(agentMcp?.scopes),
|
|
87409
87431
|
sessionExpiresAt: nonEmptyString2(agentMcp?.sessionExpiresAt),
|
|
87432
|
+
shimType: nonEmptyString2(agentMcp?.shimType),
|
|
87433
|
+
traceMode: nonEmptyString2(agentMcp?.traceMode),
|
|
87410
87434
|
workspaceId: nonEmptyString2(agentMcp?.workspaceId)
|
|
87411
87435
|
};
|
|
87412
87436
|
}
|
|
@@ -87604,6 +87628,21 @@ function buildKeyName(options, now2) {
|
|
|
87604
87628
|
const host = hostname().replace(/[^a-zA-Z0-9._-]+/gu, "-").slice(0, 48);
|
|
87605
87629
|
return `maestro-init-${host || "local"}-${now2.toISOString().slice(0, 10)}`;
|
|
87606
87630
|
}
|
|
87631
|
+
function integrationProfileForOptions(options) {
|
|
87632
|
+
return nonEmptyString2(options.integrationProfile) ?? (options.agentType && options.agentType !== DEFAULT_AGENT_TYPE ? "mcp_otlp" : "managed_runtime");
|
|
87633
|
+
}
|
|
87634
|
+
function shimTypeForOptions(options) {
|
|
87635
|
+
return nonEmptyString2(options.shimType) ?? (integrationProfileForOptions(options) === "managed_runtime" ? "sdk" : "native_mcp");
|
|
87636
|
+
}
|
|
87637
|
+
function traceModeForOptions(options) {
|
|
87638
|
+
return nonEmptyString2(options.traceMode) ?? (integrationProfileForOptions(options) === "mcp_only" ? "mcp_events" : "otlp");
|
|
87639
|
+
}
|
|
87640
|
+
function memoryModeForOptions(options) {
|
|
87641
|
+
return nonEmptyString2(options.memoryMode) ?? (integrationProfileForOptions(options) === "managed_runtime" ? "durable" : "none");
|
|
87642
|
+
}
|
|
87643
|
+
function runtimeOwnerForOptions(options) {
|
|
87644
|
+
return nonEmptyString2(options.runtimeOwner) ?? (integrationProfileForOptions(options) === "managed_runtime" ? "evalops" : "external");
|
|
87645
|
+
}
|
|
87607
87646
|
async function createAgentAPIKey(options, identityBaseUrl, oauthToken, fetchImpl, now2) {
|
|
87608
87647
|
const expiresInDays = positiveInteger(options.expiresInDays);
|
|
87609
87648
|
const expiresAt = expiresInDays ? new Date(now2.getTime() + expiresInDays * 24 * 60 * 60 * 1e3).toISOString() : void 0;
|
|
@@ -87641,8 +87680,13 @@ async function registerAgent(options, client) {
|
|
|
87641
87680
|
const output = await callConnectedMcpTool(client, "evalops_register", {
|
|
87642
87681
|
agent_type: options.agentType ?? DEFAULT_AGENT_TYPE,
|
|
87643
87682
|
capabilities: ["maestro:init", "maestro:cli"],
|
|
87683
|
+
integration_profile: integrationProfileForOptions(options),
|
|
87684
|
+
memory_mode: memoryModeForOptions(options),
|
|
87685
|
+
runtime_owner: runtimeOwnerForOptions(options),
|
|
87644
87686
|
...options.registerScopes?.length ? { scopes: options.registerScopes } : {},
|
|
87687
|
+
shim_type: shimTypeForOptions(options),
|
|
87645
87688
|
surface: options.surface ?? DEFAULT_SURFACE2,
|
|
87689
|
+
trace_mode: traceModeForOptions(options),
|
|
87646
87690
|
...positiveInteger(options.ttlSeconds) ? { ttl_seconds: options.ttlSeconds } : {},
|
|
87647
87691
|
...options.workspaceId ? { workspace_id: options.workspaceId } : {}
|
|
87648
87692
|
});
|
|
@@ -87827,6 +87871,11 @@ async function bootstrapEvalOpsAgent(options = {}, dependencies = {}) {
|
|
|
87827
87871
|
}
|
|
87828
87872
|
const keyPrefix = nonEmptyString2(keyOutput?.prefix) ?? stored?.keyPrefix;
|
|
87829
87873
|
const scopes = keyOutput?.scopes ?? stored?.scopes;
|
|
87874
|
+
const integrationProfile = nonEmptyString2(registerOutput.integration_profile) ?? integrationProfileForOptions(options);
|
|
87875
|
+
const memoryMode = nonEmptyString2(registerOutput.memory_mode) ?? memoryModeForOptions(options);
|
|
87876
|
+
const runtimeOwner = nonEmptyString2(registerOutput.runtime_owner) ?? runtimeOwnerForOptions(options);
|
|
87877
|
+
const shimType = nonEmptyString2(registerOutput.shim_type) ?? shimTypeForOptions(options);
|
|
87878
|
+
const traceMode = nonEmptyString2(registerOutput.trace_mode) ?? traceModeForOptions(options);
|
|
87830
87879
|
const agentMcp = {
|
|
87831
87880
|
type: "agent-mcp",
|
|
87832
87881
|
apiKey,
|
|
@@ -87836,14 +87885,19 @@ async function bootstrapEvalOpsAgent(options = {}, dependencies = {}) {
|
|
|
87836
87885
|
surface: options.surface ?? DEFAULT_SURFACE2,
|
|
87837
87886
|
agentId: registerOutput.agent_id,
|
|
87838
87887
|
expiresAt: nonEmptyString2(keyOutput?.expires_at) ?? stored?.expiresAt,
|
|
87888
|
+
integrationProfile,
|
|
87839
87889
|
keyId: nonEmptyString2(keyOutput?.key_id) ?? stored?.keyId,
|
|
87840
87890
|
keyName: nonEmptyString2(keyOutput?.name) ?? stored?.keyName,
|
|
87841
87891
|
keyPrefix,
|
|
87842
87892
|
manifestUrl: endpoint.manifestUrl,
|
|
87893
|
+
memoryMode,
|
|
87843
87894
|
registryVisible: registerOutput.registry_visible,
|
|
87844
87895
|
runId: registerOutput.run_id,
|
|
87896
|
+
runtimeOwner,
|
|
87845
87897
|
scopes,
|
|
87846
87898
|
sessionExpiresAt: registerOutput.expires_at,
|
|
87899
|
+
shimType,
|
|
87900
|
+
traceMode,
|
|
87847
87901
|
workspaceId: options.workspaceId ?? organizationIdFromCredentials(credentials)
|
|
87848
87902
|
};
|
|
87849
87903
|
saveBootstrapMetadata(credentials, agentMcp, deps.saveCredentials);
|
|
@@ -87858,16 +87912,21 @@ async function bootstrapEvalOpsAgent(options = {}, dependencies = {}) {
|
|
|
87858
87912
|
evidenceEvents: (controlPlaneSummary.evidence ?? []).length,
|
|
87859
87913
|
governedActionsLoaded: governedActionCount(controlPlaneSummary),
|
|
87860
87914
|
governedInferenceCheckRan: Boolean(governedInferenceCheck.decision),
|
|
87915
|
+
integrationProfile,
|
|
87861
87916
|
keyPrefix,
|
|
87862
87917
|
manifestUrl: endpoint.manifestUrl,
|
|
87918
|
+
memoryMode,
|
|
87863
87919
|
organizationId: organizationIdFromCredentials(credentials),
|
|
87864
87920
|
registryVisible: registerOutput.registry_visible,
|
|
87865
87921
|
riskFindings: countHighRiskFindings(controlPlaneSummary),
|
|
87866
87922
|
runId: registerOutput.run_id,
|
|
87923
|
+
runtimeOwner,
|
|
87867
87924
|
scopesGranted: registerOutput.scopes_granted,
|
|
87868
87925
|
sessionExpiresAt: registerOutput.expires_at,
|
|
87926
|
+
shimType,
|
|
87869
87927
|
stored: true,
|
|
87870
|
-
traceIngestionStarted: hasTraceEvidence(controlPlaneSummary)
|
|
87928
|
+
traceIngestionStarted: hasTraceEvidence(controlPlaneSummary),
|
|
87929
|
+
traceMode
|
|
87871
87930
|
};
|
|
87872
87931
|
}
|
|
87873
87932
|
var DEFAULT_AGENT_MCP_BASE_URL = "https://app.evalops.dev";
|
|
@@ -87911,9 +87970,14 @@ function buildPlatformMcpHeaders() {
|
|
|
87911
87970
|
"X-EvalOps-Session-Id": getEnvValue3(["MAESTRO_SESSION_ID"]),
|
|
87912
87971
|
"X-EvalOps-Agent-Id": getEnvValue3(PLATFORM_MCP_AGENT_ID_ENV_VARS) ?? stored?.agentId,
|
|
87913
87972
|
"X-EvalOps-Agent-Run-Id": getEnvValue3(["MAESTRO_AGENT_RUN_ID"]) ?? stored?.runId,
|
|
87973
|
+
"X-EvalOps-Integration-Profile": stored?.integrationProfile,
|
|
87974
|
+
"X-EvalOps-Memory-Mode": stored?.memoryMode,
|
|
87975
|
+
"X-EvalOps-Runtime-Owner": stored?.runtimeOwner,
|
|
87914
87976
|
"X-EvalOps-Scopes": getEnvValue3(PLATFORM_MCP_SCOPES_ENV_VARS),
|
|
87977
|
+
"X-EvalOps-Shim-Type": stored?.shimType,
|
|
87915
87978
|
"X-EvalOps-Request-Id": getEnvValue3(["MAESTRO_REQUEST_ID"]),
|
|
87916
87979
|
"X-EvalOps-Trace-Id": getEnvValue3(["TRACE_ID", "OTEL_TRACE_ID"]),
|
|
87980
|
+
"X-EvalOps-Trace-Mode": stored?.traceMode,
|
|
87917
87981
|
"X-EvalOps-Maestro-Surface": getEnvValue3(["MAESTRO_SURFACE"]) ?? "maestro"
|
|
87918
87982
|
}).filter((entry2) => typeof entry2[1] === "string" && entry2[1].trim().length > 0));
|
|
87919
87983
|
return Object.keys(headers).length > 0 ? headers : void 0;
|
|
@@ -171210,6 +171274,11 @@ function formatInitHelp() {
|
|
|
171210
171274
|
Options
|
|
171211
171275
|
--agent-type <type> Agent type to register, defaults to maestro
|
|
171212
171276
|
--surface <surface> Surface to register, defaults to cli
|
|
171277
|
+
--integration-profile <profile> mcp_only, mcp_otlp, managed_runtime, sdk_integrated, or provider_proxy
|
|
171278
|
+
--shim-type <type> native_mcp, command_wrapper, hook, provider_proxy, sdk, or mcp_firewall_proxy
|
|
171279
|
+
--trace-mode <mode> none, mcp_events, or otlp
|
|
171280
|
+
--memory-mode <mode> none, read_only, durable, or cerebro
|
|
171281
|
+
--runtime-owner <owner> external or evalops
|
|
171213
171282
|
--workspace, --workspace-id <id> Workspace to associate with the registration
|
|
171214
171283
|
--scope <scope[,scope...]> Registration scopes to request
|
|
171215
171284
|
--key-scope <scope[,scope...]> API key scopes to request
|
|
@@ -171264,6 +171333,10 @@ function parseInitArgs(args) {
|
|
|
171264
171333
|
case "--force-login":
|
|
171265
171334
|
options.forceLogin = true;
|
|
171266
171335
|
break;
|
|
171336
|
+
case "--integration-profile":
|
|
171337
|
+
options.integrationProfile = readValue(args, i2, arg);
|
|
171338
|
+
i2++;
|
|
171339
|
+
break;
|
|
171267
171340
|
case "--json":
|
|
171268
171341
|
options.json = true;
|
|
171269
171342
|
break;
|
|
@@ -171275,6 +171348,10 @@ function parseInitArgs(args) {
|
|
|
171275
171348
|
options.manifestUrl = readValue(args, i2, arg);
|
|
171276
171349
|
i2++;
|
|
171277
171350
|
break;
|
|
171351
|
+
case "--memory-mode":
|
|
171352
|
+
options.memoryMode = readValue(args, i2, arg);
|
|
171353
|
+
i2++;
|
|
171354
|
+
break;
|
|
171278
171355
|
case "--register-scope":
|
|
171279
171356
|
case "--scope":
|
|
171280
171357
|
options.registerScopes = appendScopes(options.registerScopes, readValue(args, i2, arg));
|
|
@@ -171283,10 +171360,22 @@ function parseInitArgs(args) {
|
|
|
171283
171360
|
case "--rotate-key":
|
|
171284
171361
|
options.rotateKey = true;
|
|
171285
171362
|
break;
|
|
171363
|
+
case "--runtime-owner":
|
|
171364
|
+
options.runtimeOwner = readValue(args, i2, arg);
|
|
171365
|
+
i2++;
|
|
171366
|
+
break;
|
|
171367
|
+
case "--shim-type":
|
|
171368
|
+
options.shimType = readValue(args, i2, arg);
|
|
171369
|
+
i2++;
|
|
171370
|
+
break;
|
|
171286
171371
|
case "--surface":
|
|
171287
171372
|
options.surface = readValue(args, i2, arg);
|
|
171288
171373
|
i2++;
|
|
171289
171374
|
break;
|
|
171375
|
+
case "--trace-mode":
|
|
171376
|
+
options.traceMode = readValue(args, i2, arg);
|
|
171377
|
+
i2++;
|
|
171378
|
+
break;
|
|
171290
171379
|
case "--ttl-seconds":
|
|
171291
171380
|
options.ttlSeconds = parsePositiveInteger(readValue(args, i2, arg), arg);
|
|
171292
171381
|
i2++;
|
|
@@ -171318,6 +171407,7 @@ function formatInitSuccess(result) {
|
|
|
171318
171407
|
checkLine(`Authenticated as ${authenticatedAs}`),
|
|
171319
171408
|
checkLine(`${keyMode} managed inference key`),
|
|
171320
171409
|
checkLine("Registered local agent runtime"),
|
|
171410
|
+
checkLine(`Integration profile ${result.integrationProfile ?? "managed_runtime"} via ${result.shimType ?? "sdk"}`),
|
|
171321
171411
|
checkLine(`Loaded ${governedActions} governed actions`),
|
|
171322
171412
|
checkLine(result.approvalPolicyAttached ? "Attached default approval policy" : "Queued approval policy review"),
|
|
171323
171413
|
checkLine(result.traceIngestionStarted ? "Started trace ingestion" : "Requested trace ingestion"),
|
|
@@ -6,13 +6,18 @@ export interface EvalOpsInitOptions {
|
|
|
6
6
|
apiKeyScopes?: string[];
|
|
7
7
|
expiresInDays?: number;
|
|
8
8
|
forceLogin?: boolean;
|
|
9
|
+
integrationProfile?: string;
|
|
9
10
|
json?: boolean;
|
|
10
11
|
keyName?: string;
|
|
11
12
|
manifestUrl?: string;
|
|
13
|
+
memoryMode?: string;
|
|
12
14
|
mcpUrl?: string;
|
|
13
15
|
registerScopes?: string[];
|
|
14
16
|
rotateKey?: boolean;
|
|
17
|
+
runtimeOwner?: string;
|
|
18
|
+
shimType?: string;
|
|
15
19
|
surface?: string;
|
|
20
|
+
traceMode?: string;
|
|
16
21
|
ttlSeconds?: number;
|
|
17
22
|
workspaceId?: string;
|
|
18
23
|
}
|
|
@@ -22,16 +27,21 @@ export interface EvalOpsAgentMcpMetadata {
|
|
|
22
27
|
createdAt: string;
|
|
23
28
|
endpoint: string;
|
|
24
29
|
expiresAt?: string;
|
|
30
|
+
integrationProfile?: string;
|
|
25
31
|
keyId?: string;
|
|
26
32
|
keyName?: string;
|
|
27
33
|
keyPrefix?: string;
|
|
28
34
|
manifestUrl?: string;
|
|
35
|
+
memoryMode?: string;
|
|
29
36
|
registeredAt: string;
|
|
30
37
|
registryVisible?: boolean;
|
|
31
38
|
runId?: string;
|
|
39
|
+
runtimeOwner?: string;
|
|
32
40
|
scopes?: string[];
|
|
33
41
|
sessionExpiresAt?: string;
|
|
42
|
+
shimType?: string;
|
|
34
43
|
surface: string;
|
|
44
|
+
traceMode?: string;
|
|
35
45
|
type: "agent-mcp";
|
|
36
46
|
workspaceId?: string;
|
|
37
47
|
}
|
|
@@ -46,16 +56,21 @@ export interface EvalOpsInitResult {
|
|
|
46
56
|
evidenceEvents?: number;
|
|
47
57
|
governedActionsLoaded?: number;
|
|
48
58
|
governedInferenceCheckRan?: boolean;
|
|
59
|
+
integrationProfile?: string;
|
|
49
60
|
keyPrefix?: string;
|
|
50
61
|
manifestUrl?: string;
|
|
62
|
+
memoryMode?: string;
|
|
51
63
|
organizationId?: string;
|
|
52
64
|
registryVisible?: boolean;
|
|
53
65
|
riskFindings?: number;
|
|
54
66
|
runId?: string;
|
|
67
|
+
runtimeOwner?: string;
|
|
55
68
|
scopesGranted?: string[];
|
|
56
69
|
sessionExpiresAt?: string;
|
|
70
|
+
shimType?: string;
|
|
57
71
|
stored: boolean;
|
|
58
72
|
traceIngestionStarted?: boolean;
|
|
73
|
+
traceMode?: string;
|
|
59
74
|
}
|
|
60
75
|
export interface EvalOpsInitStatus {
|
|
61
76
|
message: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-bootstrap.d.ts","sourceRoot":"","sources":["../../src/evalops/agent-bootstrap.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAEN,oBAAoB,EACpB,oBAAoB,EACpB,MAAM,qBAAqB,CAAC;AAqB7B,MAAM,WAAW,kBAAkB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB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E,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC/C,eAAe,CAAC,EAAE,OAAO,oBAAoB,CAAC;CAC9C;AAED,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CACP,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC3B,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AA6HD,wBAAgB,gCAAgC,IAC7C,uBAAuB,GACvB,SAAS,CAEX;AAqjBD,wBAAsB,qBAAqB,CAC1C,OAAO,GAAE,kBAAuB,EAChC,YAAY,GAAE,uBAA4B,GACxC,OAAO,CAAC,iBAAiB,CAAC,CAqL5B"}
|
|
@@ -63,16 +63,21 @@ function getStoredAgentMcpMetadata(credentials) {
|
|
|
63
63
|
surface,
|
|
64
64
|
agentId: nonEmptyString(agentMcp?.agentId),
|
|
65
65
|
expiresAt: nonEmptyString(agentMcp?.expiresAt),
|
|
66
|
+
integrationProfile: nonEmptyString(agentMcp?.integrationProfile),
|
|
66
67
|
keyId: nonEmptyString(agentMcp?.keyId),
|
|
67
68
|
keyName: nonEmptyString(agentMcp?.keyName),
|
|
68
69
|
keyPrefix: nonEmptyString(agentMcp?.keyPrefix),
|
|
69
70
|
manifestUrl: nonEmptyString(agentMcp?.manifestUrl),
|
|
71
|
+
memoryMode: nonEmptyString(agentMcp?.memoryMode),
|
|
70
72
|
registryVisible: typeof agentMcp?.registryVisible === "boolean"
|
|
71
73
|
? agentMcp.registryVisible
|
|
72
74
|
: undefined,
|
|
73
75
|
runId: nonEmptyString(agentMcp?.runId),
|
|
76
|
+
runtimeOwner: nonEmptyString(agentMcp?.runtimeOwner),
|
|
74
77
|
scopes: stringArray(agentMcp?.scopes),
|
|
75
78
|
sessionExpiresAt: nonEmptyString(agentMcp?.sessionExpiresAt),
|
|
79
|
+
shimType: nonEmptyString(agentMcp?.shimType),
|
|
80
|
+
traceMode: nonEmptyString(agentMcp?.traceMode),
|
|
76
81
|
workspaceId: nonEmptyString(agentMcp?.workspaceId),
|
|
77
82
|
};
|
|
78
83
|
}
|
|
@@ -299,6 +304,36 @@ function buildKeyName(options, now) {
|
|
|
299
304
|
.slice(0, 48);
|
|
300
305
|
return `maestro-init-${host || "local"}-${now.toISOString().slice(0, 10)}`;
|
|
301
306
|
}
|
|
307
|
+
function integrationProfileForOptions(options) {
|
|
308
|
+
return (nonEmptyString(options.integrationProfile) ??
|
|
309
|
+
(options.agentType && options.agentType !== DEFAULT_AGENT_TYPE
|
|
310
|
+
? "mcp_otlp"
|
|
311
|
+
: "managed_runtime"));
|
|
312
|
+
}
|
|
313
|
+
function shimTypeForOptions(options) {
|
|
314
|
+
return (nonEmptyString(options.shimType) ??
|
|
315
|
+
(integrationProfileForOptions(options) === "managed_runtime"
|
|
316
|
+
? "sdk"
|
|
317
|
+
: "native_mcp"));
|
|
318
|
+
}
|
|
319
|
+
function traceModeForOptions(options) {
|
|
320
|
+
return (nonEmptyString(options.traceMode) ??
|
|
321
|
+
(integrationProfileForOptions(options) === "mcp_only"
|
|
322
|
+
? "mcp_events"
|
|
323
|
+
: "otlp"));
|
|
324
|
+
}
|
|
325
|
+
function memoryModeForOptions(options) {
|
|
326
|
+
return (nonEmptyString(options.memoryMode) ??
|
|
327
|
+
(integrationProfileForOptions(options) === "managed_runtime"
|
|
328
|
+
? "durable"
|
|
329
|
+
: "none"));
|
|
330
|
+
}
|
|
331
|
+
function runtimeOwnerForOptions(options) {
|
|
332
|
+
return (nonEmptyString(options.runtimeOwner) ??
|
|
333
|
+
(integrationProfileForOptions(options) === "managed_runtime"
|
|
334
|
+
? "evalops"
|
|
335
|
+
: "external"));
|
|
336
|
+
}
|
|
302
337
|
async function createAgentAPIKey(options, identityBaseUrl, oauthToken, fetchImpl, now) {
|
|
303
338
|
const expiresInDays = positiveInteger(options.expiresInDays);
|
|
304
339
|
const expiresAt = expiresInDays
|
|
@@ -344,10 +379,15 @@ async function registerAgent(options, client) {
|
|
|
344
379
|
const output = await callConnectedMcpTool(client, "evalops_register", {
|
|
345
380
|
agent_type: options.agentType ?? DEFAULT_AGENT_TYPE,
|
|
346
381
|
capabilities: ["maestro:init", "maestro:cli"],
|
|
382
|
+
integration_profile: integrationProfileForOptions(options),
|
|
383
|
+
memory_mode: memoryModeForOptions(options),
|
|
384
|
+
runtime_owner: runtimeOwnerForOptions(options),
|
|
347
385
|
...(options.registerScopes?.length
|
|
348
386
|
? { scopes: options.registerScopes }
|
|
349
387
|
: {}),
|
|
388
|
+
shim_type: shimTypeForOptions(options),
|
|
350
389
|
surface: options.surface ?? DEFAULT_SURFACE,
|
|
390
|
+
trace_mode: traceModeForOptions(options),
|
|
351
391
|
...(positiveInteger(options.ttlSeconds)
|
|
352
392
|
? { ttl_seconds: options.ttlSeconds }
|
|
353
393
|
: {}),
|
|
@@ -550,6 +590,13 @@ export async function bootstrapEvalOpsAgent(options = {}, dependencies = {}) {
|
|
|
550
590
|
}
|
|
551
591
|
const keyPrefix = nonEmptyString(keyOutput?.prefix) ?? stored?.keyPrefix;
|
|
552
592
|
const scopes = keyOutput?.scopes ?? stored?.scopes;
|
|
593
|
+
const integrationProfile = nonEmptyString(registerOutput.integration_profile) ??
|
|
594
|
+
integrationProfileForOptions(options);
|
|
595
|
+
const memoryMode = nonEmptyString(registerOutput.memory_mode) ?? memoryModeForOptions(options);
|
|
596
|
+
const runtimeOwner = nonEmptyString(registerOutput.runtime_owner) ??
|
|
597
|
+
runtimeOwnerForOptions(options);
|
|
598
|
+
const shimType = nonEmptyString(registerOutput.shim_type) ?? shimTypeForOptions(options);
|
|
599
|
+
const traceMode = nonEmptyString(registerOutput.trace_mode) ?? traceModeForOptions(options);
|
|
553
600
|
const agentMcp = {
|
|
554
601
|
type: "agent-mcp",
|
|
555
602
|
apiKey,
|
|
@@ -561,14 +608,19 @@ export async function bootstrapEvalOpsAgent(options = {}, dependencies = {}) {
|
|
|
561
608
|
surface: options.surface ?? DEFAULT_SURFACE,
|
|
562
609
|
agentId: registerOutput.agent_id,
|
|
563
610
|
expiresAt: nonEmptyString(keyOutput?.expires_at) ?? stored?.expiresAt,
|
|
611
|
+
integrationProfile,
|
|
564
612
|
keyId: nonEmptyString(keyOutput?.key_id) ?? stored?.keyId,
|
|
565
613
|
keyName: nonEmptyString(keyOutput?.name) ?? stored?.keyName,
|
|
566
614
|
keyPrefix,
|
|
567
615
|
manifestUrl: endpoint.manifestUrl,
|
|
616
|
+
memoryMode,
|
|
568
617
|
registryVisible: registerOutput.registry_visible,
|
|
569
618
|
runId: registerOutput.run_id,
|
|
619
|
+
runtimeOwner,
|
|
570
620
|
scopes,
|
|
571
621
|
sessionExpiresAt: registerOutput.expires_at,
|
|
622
|
+
shimType,
|
|
623
|
+
traceMode,
|
|
572
624
|
workspaceId: options.workspaceId ?? organizationIdFromCredentials(credentials),
|
|
573
625
|
};
|
|
574
626
|
saveBootstrapMetadata(credentials, agentMcp, deps.saveCredentials);
|
|
@@ -583,16 +635,21 @@ export async function bootstrapEvalOpsAgent(options = {}, dependencies = {}) {
|
|
|
583
635
|
evidenceEvents: (controlPlaneSummary.evidence ?? []).length,
|
|
584
636
|
governedActionsLoaded: governedActionCount(controlPlaneSummary),
|
|
585
637
|
governedInferenceCheckRan: Boolean(governedInferenceCheck.decision),
|
|
638
|
+
integrationProfile,
|
|
586
639
|
keyPrefix,
|
|
587
640
|
manifestUrl: endpoint.manifestUrl,
|
|
641
|
+
memoryMode,
|
|
588
642
|
organizationId: organizationIdFromCredentials(credentials),
|
|
589
643
|
registryVisible: registerOutput.registry_visible,
|
|
590
644
|
riskFindings: countHighRiskFindings(controlPlaneSummary),
|
|
591
645
|
runId: registerOutput.run_id,
|
|
646
|
+
runtimeOwner,
|
|
592
647
|
scopesGranted: registerOutput.scopes_granted,
|
|
593
648
|
sessionExpiresAt: registerOutput.expires_at,
|
|
649
|
+
shimType,
|
|
594
650
|
stored: true,
|
|
595
651
|
traceIngestionStarted: hasTraceEvidence(controlPlaneSummary),
|
|
652
|
+
traceMode,
|
|
596
653
|
};
|
|
597
654
|
}
|
|
598
655
|
//# sourceMappingURL=agent-bootstrap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-bootstrap.js","sourceRoot":"","sources":["../../src/evalops/agent-bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAEnG,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAEN,oBAAoB,EACpB,oBAAoB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,MAAM,0BAA0B,GAAG,yBAAyB,CAAC;AAC7D,MAAM,yBAAyB,GAAG,8BAA8B,CAAC;AACjE,MAAM,uBAAuB,GAAG,qCAAqC,CAAC;AACtE,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,MAAM,kBAAkB,GAAG,SAAS,CAAC;AACrC,MAAM,eAAe,GAAG,KAAK,CAAC;AAC9B,MAAM,sBAAsB,GAAG;IAC9B,gBAAgB;IAChB,iBAAiB;IACjB,qBAAqB;IACrB,oBAAoB;IACpB,eAAe;IACf,gBAAgB;IAChB,cAAc;CACd,CAAC;AAyIF,SAAS,QAAQ,CAAC,KAA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QACb,sBAAsB,EAAE,gBAAgB,CAAC,mBAAmB,CAAC;QAC7D,eAAe,EAAE,8BAA8B,CAAC,WAAW,CAAC;QAC5D,UAAU,EAAE,sBAAsB,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACrD,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,sBAAsB,EAAE,CAAC,mBAAmB,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC;QACvE,cAAc,EAAE,CAAC,mBAAmB,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM;QAC3D,qBAAqB,EAAE,mBAAmB,CAAC,mBAAmB,CAAC;QAC/D,yBAAyB,EAAE,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC;QACnE,SAAS;QACT,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,cAAc,EAAE,6BAA6B,CAAC,WAAW,CAAC;QAC1D,eAAe,EAAE,cAAc,CAAC,gBAAgB;QAChD,YAAY,EAAE,qBAAqB,CAAC,mBAAmB,CAAC;QACxD,KAAK,EAAE,cAAc,CAAC,MAAM;QAC5B,aAAa,EAAE,cAAc,CAAC,cAAc;QAC5C,gBAAgB,EAAE,cAAc,CAAC,UAAU;QAC3C,MAAM,EAAE,IAAI;QACZ,qBAAqB,EAAE,gBAAgB,CAAC,mBAAmB,CAAC;KAC5D,CAAC;AACH,CAAC","sourcesContent":["import { hostname } from \"node:os\";\nimport { Client } from \"@modelcontextprotocol/sdk/client/index.js\";\nimport { StreamableHTTPClientTransport } from \"@modelcontextprotocol/sdk/client/streamableHttp.js\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport { getOAuthToken, hasOAuthCredentials, login } from \"../oauth/index.js\";\nimport {\n\ttype OAuthCredentials,\n\tloadOAuthCredentials,\n\tsaveOAuthCredentials,\n} from \"../oauth/storage.js\";\nimport { getPackageVersion } from \"../package-metadata.js\";\nimport { getEnvValue, normalizeBaseUrl } from \"../platform/client.js\";\nimport { PLATFORM_HTTP_ROUTES } from \"../platform/core-services.js\";\n\nconst DEFAULT_AGENT_MCP_BASE_URL = \"https://app.evalops.dev\";\nconst DEFAULT_IDENTITY_BASE_URL = \"https://identity.evalops.dev\";\nconst AGENT_MCP_MANIFEST_PATH = \"/.well-known/evalops/agent-mcp.json\";\nconst AGENT_MCP_PATH = \"/mcp\";\nconst DEFAULT_AGENT_TYPE = \"maestro\";\nconst DEFAULT_SURFACE = \"cli\";\nconst DEFAULT_API_KEY_SCOPES = [\n\t\"agent:register\",\n\t\"agent:heartbeat\",\n\t\"governance:evaluate\",\n\t\"llm_gateway:invoke\",\n\t\"memories:read\",\n\t\"memories:write\",\n\t\"meter:record\",\n];\n\nexport interface EvalOpsInitOptions {\n\tagentType?: string;\n\tapiKeyScopes?: string[];\n\texpiresInDays?: number;\n\tforceLogin?: boolean;\n\tjson?: boolean;\n\tkeyName?: string;\n\tmanifestUrl?: string;\n\tmcpUrl?: string;\n\tregisterScopes?: string[];\n\trotateKey?: boolean;\n\tsurface?: string;\n\tttlSeconds?: number;\n\tworkspaceId?: string;\n}\n\nexport interface EvalOpsAgentMcpMetadata {\n\tagentId?: string;\n\tapiKey?: string;\n\tcreatedAt: string;\n\tendpoint: string;\n\texpiresAt?: string;\n\tkeyId?: string;\n\tkeyName?: string;\n\tkeyPrefix?: string;\n\tmanifestUrl?: string;\n\tregisteredAt: string;\n\tregistryVisible?: boolean;\n\trunId?: string;\n\tscopes?: string[];\n\tsessionExpiresAt?: string;\n\tsurface: string;\n\ttype: \"agent-mcp\";\n\tworkspaceId?: string;\n}\n\nexport interface EvalOpsInitResult {\n\tagentId?: string;\n\tapiKeyCreated: boolean;\n\tapprovalPolicyAttached?: boolean;\n\tauthenticatedAs?: string;\n\tconsoleUrl?: string;\n\tendpoint: string;\n\tevidenceEventPublished?: boolean;\n\tevidenceEvents?: number;\n\tgovernedActionsLoaded?: number;\n\tgovernedInferenceCheckRan?: boolean;\n\tkeyPrefix?: string;\n\tmanifestUrl?: string;\n\torganizationId?: string;\n\tregistryVisible?: boolean;\n\triskFindings?: number;\n\trunId?: string;\n\tscopesGranted?: string[];\n\tsessionExpiresAt?: string;\n\tstored: boolean;\n\ttraceIngestionStarted?: boolean;\n}\n\nexport interface EvalOpsInitStatus {\n\tmessage: string;\n}\n\nexport interface EvalOpsInitDependencies {\n\tcreateMcpClient?: (endpoint: string, bearerToken: string) => EvalOpsMcpClient;\n\tfetch?: typeof fetch;\n\tgetOAuthToken?: typeof getOAuthToken;\n\thasOAuthCredentials?: typeof hasOAuthCredentials;\n\tloadCredentials?: typeof loadOAuthCredentials;\n\tlogin?: typeof login;\n\tnow?: () => Date;\n\tonAuthUrl?: (url: string) => void;\n\tonStatus?: (status: EvalOpsInitStatus) => void;\n\tsaveCredentials?: typeof saveOAuthCredentials;\n}\n\nexport interface EvalOpsMcpClient {\n\tcallTool(\n\t\tname: string,\n\t\targs: Record<string, unknown>,\n\t): Promise<CallToolResult>;\n\tclose(): Promise<void>;\n\tconnect(): Promise<void>;\n}\n\ninterface CreateAPIKeyOutput {\n\tapi_key: string;\n\texpires_at?: string;\n\tkey_id?: string;\n\tname?: string;\n\tprefix?: string;\n\tscopes?: string[];\n}\n\ninterface CreateAPIKeyHTTPOutput extends Partial<CreateAPIKeyOutput> {\n\terror?: string;\n\tkey?: Record<string, unknown>;\n\tscopes_granted?: unknown;\n}\n\ninterface RegisterOutput {\n\tagent_id?: string;\n\texpires_at?: string;\n\tregistered?: boolean;\n\tregistry_visible?: boolean;\n\trun_id?: string;\n\tscopes_denied?: string[];\n\tscopes_granted?: string[];\n}\n\ninterface CheckActionOutput {\n\tdecision?: string;\n\trisk_level?: string;\n\treasons?: string[];\n}\n\ninterface ControlPlaneSummaryOutput {\n\tevidence?: unknown[];\n\tfindings?: unknown[];\n\tmetrics?: {\n\t\tapproval_required_tools?: number;\n\t\thigh_risk_tools?: number;\n\t\ttotal_tools?: number;\n\t};\n\tpolicy_controls?: unknown[];\n\ttools?: unknown[];\n}\n\ninterface AgentMcpEndpoint {\n\tendpoint: string;\n\tidentityBaseUrl?: string;\n\tmanifestUrl?: string;\n\tpreferDerivedIdentity?: boolean;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction nonEmptyString(value: unknown): string | undefined {\n\treturn typeof value === \"string\" && value.trim().length > 0\n\t\t? value.trim()\n\t\t: undefined;\n}\n\nfunction stringArray(value: unknown): string[] | undefined {\n\tif (!Array.isArray(value)) {\n\t\treturn undefined;\n\t}\n\tconst values = value\n\t\t.map((entry) => nonEmptyString(entry))\n\t\t.filter((entry): entry is string => Boolean(entry));\n\treturn values.length > 0 ? values : undefined;\n}\n\nfunction positiveInteger(value: number | undefined): number | undefined {\n\treturn typeof value === \"number\" && Number.isInteger(value) && value > 0\n\t\t? value\n\t\t: undefined;\n}\n\nfunction getStoredAgentMcpMetadata(\n\tcredentials: OAuthCredentials | null,\n): EvalOpsAgentMcpMetadata | undefined {\n\tconst metadata = credentials?.metadata;\n\tconst agentMcp = isRecord(metadata?.agentMcp) ? metadata.agentMcp : undefined;\n\tconst apiKey = nonEmptyString(agentMcp?.apiKey);\n\tconst endpoint = nonEmptyString(agentMcp?.endpoint);\n\tconst registeredAt = nonEmptyString(agentMcp?.registeredAt);\n\tconst createdAt = nonEmptyString(agentMcp?.createdAt);\n\tconst surface = nonEmptyString(agentMcp?.surface);\n\tif (!apiKey || !endpoint || !registeredAt || !createdAt || !surface) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\ttype: \"agent-mcp\",\n\t\tapiKey,\n\t\tcreatedAt,\n\t\tendpoint,\n\t\tregisteredAt,\n\t\tsurface,\n\t\tagentId: nonEmptyString(agentMcp?.agentId),\n\t\texpiresAt: nonEmptyString(agentMcp?.expiresAt),\n\t\tkeyId: nonEmptyString(agentMcp?.keyId),\n\t\tkeyName: nonEmptyString(agentMcp?.keyName),\n\t\tkeyPrefix: nonEmptyString(agentMcp?.keyPrefix),\n\t\tmanifestUrl: nonEmptyString(agentMcp?.manifestUrl),\n\t\tregistryVisible:\n\t\t\ttypeof agentMcp?.registryVisible === \"boolean\"\n\t\t\t\t? agentMcp.registryVisible\n\t\t\t\t: undefined,\n\t\trunId: nonEmptyString(agentMcp?.runId),\n\t\tscopes: stringArray(agentMcp?.scopes),\n\t\tsessionExpiresAt: nonEmptyString(agentMcp?.sessionExpiresAt),\n\t\tworkspaceId: nonEmptyString(agentMcp?.workspaceId),\n\t};\n}\n\nexport function getStoredEvalOpsAgentMcpMetadata():\n\t| EvalOpsAgentMcpMetadata\n\t| undefined {\n\treturn getStoredAgentMcpMetadata(loadOAuthCredentials(\"evalops\"));\n}\n\nfunction normalizeMcpEndpoint(url: string): string {\n\tconst normalized = normalizeBaseUrl(url);\n\tconst parsed = new URL(normalized);\n\tif (\n\t\tparsed.pathname === \"\" ||\n\t\tparsed.pathname === \"/\" ||\n\t\tparsed.pathname === AGENT_MCP_MANIFEST_PATH\n\t) {\n\t\tparsed.pathname = AGENT_MCP_PATH;\n\t\tparsed.search = \"\";\n\t\tparsed.hash = \"\";\n\t}\n\treturn normalizeBaseUrl(parsed.toString());\n}\n\nfunction normalizeManifestUrl(url: string): string {\n\tconst normalized = normalizeBaseUrl(url);\n\tconst parsed = new URL(normalized);\n\tif (parsed.pathname === \"\" || parsed.pathname === \"/\") {\n\t\tparsed.pathname = AGENT_MCP_MANIFEST_PATH;\n\t}\n\treturn parsed.toString();\n}\n\nfunction resolveIdentityBaseUrl(\n\tcredentials: OAuthCredentials | null,\n\tendpoint?: AgentMcpEndpoint,\n): string {\n\tconst configured = getEnvValue([\n\t\t\"MAESTRO_IDENTITY_URL\",\n\t\t\"EVALOPS_IDENTITY_URL\",\n\t\t\"MAESTRO_PLATFORM_BASE_URL\",\n\t\t\"MAESTRO_EVALOPS_BASE_URL\",\n\t\t\"EVALOPS_BASE_URL\",\n\t]);\n\tconst stored =\n\t\ttypeof credentials?.metadata?.identityBaseUrl === \"string\"\n\t\t\t? credentials.metadata.identityBaseUrl\n\t\t\t: undefined;\n\tconst derived = identityBaseUrlFromMcpEndpoint(endpoint?.endpoint);\n\tconst storedBeforeDerived = endpoint\n\t\t? !endpoint.preferDerivedIdentity && isCustomMcpEndpoint(endpoint.endpoint)\n\t\t: false;\n\treturn normalizeBaseUrl(\n\t\tconfigured ??\n\t\t\tendpoint?.identityBaseUrl ??\n\t\t\t(endpoint?.preferDerivedIdentity ? derived : undefined) ??\n\t\t\t(storedBeforeDerived ? stored : undefined) ??\n\t\t\tderived ??\n\t\t\tstored ??\n\t\t\tDEFAULT_IDENTITY_BASE_URL,\n\t\tObject.values(PLATFORM_HTTP_ROUTES.identity),\n\t);\n}\n\nfunction isCustomMcpEndpoint(endpoint: string): boolean {\n\tconst parsed = new URL(normalizeBaseUrl(endpoint));\n\treturn (\n\t\tparsed.hostname !== \"app.evalops.dev\" &&\n\t\tparsed.hostname !== \"staging.evalops.dev\"\n\t);\n}\n\nfunction identityBaseUrlFromMcpEndpoint(\n\tendpoint: string | undefined,\n): string | undefined {\n\tif (!endpoint) {\n\t\treturn undefined;\n\t}\n\tconst parsed = new URL(normalizeBaseUrl(endpoint));\n\tif (parsed.hostname === \"app.evalops.dev\") {\n\t\treturn DEFAULT_IDENTITY_BASE_URL;\n\t}\n\tif (parsed.hostname === \"staging.evalops.dev\") {\n\t\treturn \"https://api.staging.evalops.dev\";\n\t}\n\tif (parsed.hostname.startsWith(\"app.\")) {\n\t\tparsed.hostname = `identity.${parsed.hostname.slice(\"app.\".length)}`;\n\t}\n\tparsed.pathname = \"\";\n\tparsed.search = \"\";\n\tparsed.hash = \"\";\n\treturn normalizeBaseUrl(parsed.toString());\n}\n\nasync function resolveEndpointFromManifest(\n\tmanifestUrl: string,\n\tfetchImpl: typeof fetch,\n): Promise<AgentMcpEndpoint> {\n\tconst response = await fetchImpl(manifestUrl, {\n\t\theaders: { accept: \"application/json\" },\n\t});\n\tif (!response.ok) {\n\t\tthrow new Error(\n\t\t\t`Failed to fetch EvalOps MCP manifest (${response.status} ${response.statusText})`,\n\t\t);\n\t}\n\tconst payload = (await response.json()) as unknown;\n\tconst payloadRecord = isRecord(payload) ? payload : undefined;\n\tconst protocol =\n\t\tpayloadRecord && isRecord(payloadRecord.protocol)\n\t\t\t? payloadRecord.protocol\n\t\t\t: undefined;\n\tconst endpoint = nonEmptyString(protocol?.endpoint);\n\tif (!endpoint) {\n\t\tthrow new Error(\"EvalOps MCP manifest did not include protocol.endpoint\");\n\t}\n\tconst identity = payloadRecord?.identity;\n\tconst identityBaseUrl =\n\t\tnonEmptyString(isRecord(identity) ? identity.base_url : undefined) ??\n\t\tnonEmptyString(isRecord(identity) ? identity.baseUrl : undefined) ??\n\t\tnonEmptyString(isRecord(identity) ? identity.url : undefined) ??\n\t\tnonEmptyString(payloadRecord?.identity_base_url) ??\n\t\tnonEmptyString(payloadRecord?.identityBaseUrl);\n\treturn {\n\t\tendpoint: normalizeMcpEndpoint(endpoint),\n\t\tidentityBaseUrl,\n\t\tmanifestUrl,\n\t\tpreferDerivedIdentity: true,\n\t};\n}\n\nasync function resolveAgentMcpEndpoint(\n\toptions: EvalOpsInitOptions,\n\tdeps: Required<Pick<EvalOpsInitDependencies, \"fetch\" | \"loadCredentials\">>,\n): Promise<AgentMcpEndpoint> {\n\tif (options.mcpUrl) {\n\t\treturn {\n\t\t\tendpoint: normalizeMcpEndpoint(options.mcpUrl),\n\t\t\tpreferDerivedIdentity: true,\n\t\t};\n\t}\n\tif (options.manifestUrl) {\n\t\treturn resolveEndpointFromManifest(\n\t\t\tnormalizeManifestUrl(options.manifestUrl),\n\t\t\tdeps.fetch,\n\t\t);\n\t}\n\n\tconst configuredMcpUrl = getEnvValue([\n\t\t\"MAESTRO_PLATFORM_MCP_URL\",\n\t\t\"MAESTRO_AGENT_MCP_URL\",\n\t\t\"MAESTRO_EVALOPS_AGENT_MCP_URL\",\n\t]);\n\tif (configuredMcpUrl) {\n\t\treturn {\n\t\t\tendpoint: normalizeMcpEndpoint(configuredMcpUrl),\n\t\t\tpreferDerivedIdentity: true,\n\t\t};\n\t}\n\n\tconst configuredManifestUrl = getEnvValue([\n\t\t\"MAESTRO_PLATFORM_MCP_MANIFEST_URL\",\n\t\t\"MAESTRO_AGENT_MCP_MANIFEST_URL\",\n\t\t\"MAESTRO_EVALOPS_AGENT_MCP_MANIFEST_URL\",\n\t]);\n\tif (configuredManifestUrl) {\n\t\treturn resolveEndpointFromManifest(\n\t\t\tnormalizeManifestUrl(configuredManifestUrl),\n\t\t\tdeps.fetch,\n\t\t);\n\t}\n\n\tconst stored = getStoredAgentMcpMetadata(deps.loadCredentials(\"evalops\"));\n\tif (stored?.endpoint) {\n\t\treturn {\n\t\t\tendpoint: normalizeMcpEndpoint(stored.endpoint),\n\t\t\tmanifestUrl: stored.manifestUrl,\n\t\t};\n\t}\n\n\treturn resolveEndpointFromManifest(\n\t\t`${DEFAULT_AGENT_MCP_BASE_URL}${AGENT_MCP_MANIFEST_PATH}`,\n\t\tdeps.fetch,\n\t);\n}\n\nfunction createDefaultMcpClient(\n\tendpoint: string,\n\tbearerToken: string,\n): EvalOpsMcpClient {\n\tconst client = new Client(\n\t\t{\n\t\t\tname: \"maestro\",\n\t\t\tversion: getPackageVersion(),\n\t\t},\n\t\t{\n\t\t\tcapabilities: {},\n\t\t},\n\t);\n\tconst headers = {\n\t\taccept: \"application/json, text/event-stream\",\n\t\t\"content-type\": \"application/json\",\n\t\t...(bearerToken ? { authorization: `Bearer ${bearerToken}` } : {}),\n\t};\n\tconst transport = new StreamableHTTPClientTransport(new URL(endpoint), {\n\t\trequestInit: {\n\t\t\theaders,\n\t\t},\n\t});\n\treturn {\n\t\tcallTool: (name, args) =>\n\t\t\tclient.callTool({\n\t\t\t\tname,\n\t\t\t\targuments: args,\n\t\t\t}) as Promise<CallToolResult>,\n\t\tclose: () => client.close(),\n\t\tconnect: () => client.connect(transport),\n\t};\n}\n\nasync function callConnectedMcpTool<T>(\n\tclient: EvalOpsMcpClient,\n\ttoolName: string,\n\targs: Record<string, unknown>,\n): Promise<T> {\n\tconst result = await client.callTool(toolName, args);\n\tif (result.isError) {\n\t\tthrow new Error(`${toolName} returned an MCP error`);\n\t}\n\treturn parseToolOutput<T>(toolName, result);\n}\n\nfunction parseToolOutput<T>(toolName: string, result: CallToolResult): T {\n\tconst structuredContent = isRecord(result.structuredContent)\n\t\t? result.structuredContent\n\t\t: undefined;\n\tif (structuredContent) {\n\t\treturn structuredContent as T;\n\t}\n\tconst text = Array.isArray(result.content)\n\t\t? result.content\n\t\t\t\t.map((entry) =>\n\t\t\t\t\tentry.type === \"text\" && typeof entry.text === \"string\"\n\t\t\t\t\t\t? entry.text\n\t\t\t\t\t\t: undefined,\n\t\t\t\t)\n\t\t\t\t.find((entry): entry is string => Boolean(entry))\n\t\t: undefined;\n\tif (text) {\n\t\tconst parsed = JSON.parse(text) as unknown;\n\t\tif (isRecord(parsed)) {\n\t\t\treturn parsed as T;\n\t\t}\n\t}\n\tthrow new Error(`${toolName} did not return structured JSON output`);\n}\n\nasync function ensureEvalOpsLogin(\n\toptions: EvalOpsInitOptions,\n\tdeps: Required<\n\t\tPick<\n\t\t\tEvalOpsInitDependencies,\n\t\t\t| \"getOAuthToken\"\n\t\t\t| \"hasOAuthCredentials\"\n\t\t\t| \"login\"\n\t\t\t| \"onAuthUrl\"\n\t\t\t| \"onStatus\"\n\t\t>\n\t>,\n): Promise<string> {\n\tif (options.forceLogin || !deps.hasOAuthCredentials(\"evalops\")) {\n\t\tdeps.onStatus({ message: \"Opening EvalOps login\" });\n\t\tawait deps.login(\"evalops\", {\n\t\t\tonAuthUrl: deps.onAuthUrl,\n\t\t\tonStatus: (message) => deps.onStatus({ message }),\n\t\t});\n\t}\n\n\tlet token = await deps.getOAuthToken(\"evalops\");\n\tif (!token) {\n\t\tdeps.onStatus({ message: \"Refreshing EvalOps login\" });\n\t\tawait deps.login(\"evalops\", {\n\t\t\tonAuthUrl: deps.onAuthUrl,\n\t\t\tonStatus: (message) => deps.onStatus({ message }),\n\t\t});\n\t\ttoken = await deps.getOAuthToken(\"evalops\");\n\t}\n\tif (!token) {\n\t\tthrow new Error(\"EvalOps login did not produce an access token\");\n\t}\n\treturn token;\n}\n\nfunction buildKeyName(options: EvalOpsInitOptions, now: Date): string {\n\tif (options.keyName?.trim()) {\n\t\treturn options.keyName.trim();\n\t}\n\tconst host = hostname()\n\t\t.replace(/[^a-zA-Z0-9._-]+/gu, \"-\")\n\t\t.slice(0, 48);\n\treturn `maestro-init-${host || \"local\"}-${now.toISOString().slice(0, 10)}`;\n}\n\nasync function createAgentAPIKey(\n\toptions: EvalOpsInitOptions,\n\tidentityBaseUrl: string,\n\toauthToken: string,\n\tfetchImpl: typeof fetch,\n\tnow: Date,\n): Promise<CreateAPIKeyOutput> {\n\tconst expiresInDays = positiveInteger(options.expiresInDays);\n\tconst expiresAt = expiresInDays\n\t\t? new Date(\n\t\t\t\tnow.getTime() + expiresInDays * 24 * 60 * 60 * 1000,\n\t\t\t).toISOString()\n\t\t: undefined;\n\tconst response = await fetchImpl(\n\t\t`${identityBaseUrl}${PLATFORM_HTTP_ROUTES.identity.apiKeys}`,\n\t\t{\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${oauthToken}`,\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t},\n\t\t\tbody: JSON.stringify({\n\t\t\t\tname: buildKeyName(options, now),\n\t\t\t\tscopes: options.apiKeyScopes ?? DEFAULT_API_KEY_SCOPES,\n\t\t\t\t...(expiresAt ? { expires_at: expiresAt } : {}),\n\t\t\t}),\n\t\t},\n\t);\n\tconst output = (await response\n\t\t.json()\n\t\t.catch(() => ({}))) as CreateAPIKeyHTTPOutput;\n\tif (!response.ok) {\n\t\tthrow new Error(\n\t\t\ttypeof output.error === \"string\" && output.error.trim()\n\t\t\t\t? output.error\n\t\t\t\t: `EvalOps API key creation failed (${response.status})`,\n\t\t);\n\t}\n\tconst key = isRecord(output.key) ? output.key : undefined;\n\tconst normalized: CreateAPIKeyOutput = {\n\t\tapi_key: nonEmptyString(output.api_key) ?? \"\",\n\t\texpires_at:\n\t\t\tnonEmptyString(output.expires_at) ?? nonEmptyString(key?.expires_at),\n\t\tkey_id: nonEmptyString(output.key_id) ?? nonEmptyString(key?.id),\n\t\tname: nonEmptyString(output.name) ?? nonEmptyString(key?.name),\n\t\tprefix: nonEmptyString(output.prefix) ?? nonEmptyString(key?.prefix),\n\t\tscopes:\n\t\t\tstringArray(output.scopes) ??\n\t\t\tstringArray(key?.scopes) ??\n\t\t\tstringArray(output.scopes_granted),\n\t};\n\tif (!nonEmptyString(normalized.api_key)) {\n\t\tthrow new Error(\"EvalOps API key creation did not return api_key\");\n\t}\n\treturn normalized;\n}\n\nasync function registerAgent(\n\toptions: EvalOpsInitOptions,\n\tclient: EvalOpsMcpClient,\n): Promise<RegisterOutput> {\n\tconst output = await callConnectedMcpTool<RegisterOutput>(\n\t\tclient,\n\t\t\"evalops_register\",\n\t\t{\n\t\t\tagent_type: options.agentType ?? DEFAULT_AGENT_TYPE,\n\t\t\tcapabilities: [\"maestro:init\", \"maestro:cli\"],\n\t\t\t...(options.registerScopes?.length\n\t\t\t\t? { scopes: options.registerScopes }\n\t\t\t\t: {}),\n\t\t\tsurface: options.surface ?? DEFAULT_SURFACE,\n\t\t\t...(positiveInteger(options.ttlSeconds)\n\t\t\t\t? { ttl_seconds: options.ttlSeconds }\n\t\t\t\t: {}),\n\t\t\t...(options.workspaceId ? { workspace_id: options.workspaceId } : {}),\n\t\t},\n\t);\n\tif (output.registered !== true || !nonEmptyString(output.agent_id)) {\n\t\tthrow new Error(\"EvalOps agent registration did not return an agent_id\");\n\t}\n\treturn output;\n}\n\nasync function runGovernedInferenceCheck(\n\tclient: EvalOpsMcpClient,\n): Promise<CheckActionOutput> {\n\treturn callConnectedMcpTool<CheckActionOutput>(\n\t\tclient,\n\t\t\"evalops_check_action\",\n\t\t{\n\t\t\taction_type: \"llm_gateway.invoke\",\n\t\t\taction_payload: \"maestro init first governed inference check\",\n\t\t\tdeclared_risk_level: \"low\",\n\t\t},\n\t);\n}\n\nasync function loadControlPlaneSummary(\n\tclient: EvalOpsMcpClient,\n): Promise<ControlPlaneSummaryOutput> {\n\treturn callConnectedMcpTool<ControlPlaneSummaryOutput>(\n\t\tclient,\n\t\t\"evalops_control_plane_summary\",\n\t\t{},\n\t);\n}\n\nfunction organizationIdFromCredentials(\n\tcredentials: OAuthCredentials | null,\n): string | undefined {\n\treturn (\n\t\tnonEmptyString(credentials?.metadata?.organizationId) ??\n\t\tnonEmptyString(credentials?.metadata?.organization_id)\n\t);\n}\n\nfunction authenticatedAsFromCredentials(\n\tcredentials: OAuthCredentials | null,\n): string | undefined {\n\tconst metadata = credentials?.metadata;\n\tconst user = isRecord(metadata?.user) ? metadata.user : undefined;\n\treturn (\n\t\tnonEmptyString(metadata?.email) ??\n\t\tnonEmptyString(metadata?.preferred_username) ??\n\t\tnonEmptyString(metadata?.preferredUsername) ??\n\t\tnonEmptyString(metadata?.user) ??\n\t\tnonEmptyString(user?.email) ??\n\t\tnonEmptyString(user?.name)\n\t);\n}\n\nfunction consoleUrlFromEndpoint(endpoint: string): string {\n\tconst parsed = new URL(endpoint);\n\tparsed.pathname = \"/overview\";\n\tparsed.search = \"\";\n\tparsed.hash = \"\";\n\tconst env =\n\t\tparsed.hostname === \"app.evalops.dev\"\n\t\t\t? \"production\"\n\t\t\t: parsed.hostname === \"staging.evalops.dev\"\n\t\t\t\t? \"staging\"\n\t\t\t\t: \"local\";\n\tparsed.searchParams.set(\"env\", env);\n\treturn parsed.toString();\n}\n\nfunction countHighRiskFindings(summary: ControlPlaneSummaryOutput): number {\n\tconst findings = Array.isArray(summary.findings) ? summary.findings : [];\n\tconst findingCount = findings.filter((finding) => {\n\t\tconst record = isRecord(finding) ? finding : undefined;\n\t\tconst severity = nonEmptyString(record?.severity)?.toLowerCase();\n\t\treturn severity === \"critical\" || severity === \"high\";\n\t}).length;\n\tconst metricCount = summary.metrics?.high_risk_tools;\n\tif (typeof metricCount === \"number\" && Number.isFinite(metricCount)) {\n\t\treturn Math.max(findingCount, Math.max(0, Math.trunc(metricCount)));\n\t}\n\treturn findingCount;\n}\n\nfunction hasPolicyControl(summary: ControlPlaneSummaryOutput): boolean {\n\tconst approvalRequired = summary.metrics?.approval_required_tools ?? 0;\n\tif (approvalRequired > 0) {\n\t\treturn true;\n\t}\n\tconst controls = Array.isArray(summary.policy_controls)\n\t\t? summary.policy_controls\n\t\t: [];\n\treturn controls.some((control) => {\n\t\tconst record = isRecord(control) ? control : undefined;\n\t\treturn /approval|policy|starter/i.test(\n\t\t\t[\n\t\t\t\tnonEmptyString(record?.label),\n\t\t\t\tnonEmptyString(record?.value),\n\t\t\t\tnonEmptyString(record?.detail),\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(\" \"),\n\t\t);\n\t});\n}\n\nfunction hasTraceEvidence(summary: ControlPlaneSummaryOutput): boolean {\n\tconst evidence = Array.isArray(summary.evidence) ? summary.evidence : [];\n\treturn evidence.some((entry) => {\n\t\tconst record = isRecord(entry) ? entry : undefined;\n\t\treturn Boolean(\n\t\t\tnonEmptyString(record?.trace) ??\n\t\t\t\tnonEmptyString(record?.trace_id) ??\n\t\t\t\tnonEmptyString(record?.traceId),\n\t\t);\n\t});\n}\n\nfunction governedActionCount(summary: ControlPlaneSummaryOutput): number {\n\tconst metricTotal = summary.metrics?.total_tools;\n\tif (typeof metricTotal === \"number\" && Number.isFinite(metricTotal)) {\n\t\treturn Math.max(0, Math.trunc(metricTotal));\n\t}\n\treturn Array.isArray(summary.tools) ? summary.tools.length : 0;\n}\n\nfunction saveBootstrapMetadata(\n\tcredentials: OAuthCredentials,\n\tagentMcp: EvalOpsAgentMcpMetadata,\n\tsaveCredentials: typeof saveOAuthCredentials,\n): void {\n\tsaveCredentials(\"evalops\", {\n\t\t...credentials,\n\t\tmetadata: {\n\t\t\t...credentials.metadata,\n\t\t\tagentId: agentMcp.agentId ?? credentials.metadata?.agentId,\n\t\t\trunId: agentMcp.runId ?? credentials.metadata?.runId,\n\t\t\tsurface: agentMcp.surface,\n\t\t\tagentMcp,\n\t\t},\n\t});\n}\n\nexport async function bootstrapEvalOpsAgent(\n\toptions: EvalOpsInitOptions = {},\n\tdependencies: EvalOpsInitDependencies = {},\n): Promise<EvalOpsInitResult> {\n\tconst deps = {\n\t\tcreateMcpClient: dependencies.createMcpClient ?? createDefaultMcpClient,\n\t\tfetch: dependencies.fetch ?? fetch,\n\t\tgetOAuthToken: dependencies.getOAuthToken ?? getOAuthToken,\n\t\thasOAuthCredentials:\n\t\t\tdependencies.hasOAuthCredentials ?? hasOAuthCredentials,\n\t\tloadCredentials: dependencies.loadCredentials ?? loadOAuthCredentials,\n\t\tlogin: dependencies.login ?? login,\n\t\tnow: dependencies.now ?? (() => new Date()),\n\t\tonAuthUrl:\n\t\t\tdependencies.onAuthUrl ??\n\t\t\t((url: string) => {\n\t\t\t\tprocess.stdout.write(`${url}\\n`);\n\t\t\t}),\n\t\tonStatus: dependencies.onStatus ?? (() => undefined),\n\t\tsaveCredentials: dependencies.saveCredentials ?? saveOAuthCredentials,\n\t};\n\n\tconst oauthToken = await ensureEvalOpsLogin(options, deps);\n\tconst endpoint = await resolveAgentMcpEndpoint(options, deps);\n\tconst credentialsBeforeKey = deps.loadCredentials(\"evalops\");\n\tconst stored = getStoredAgentMcpMetadata(credentialsBeforeKey);\n\tconst identityBaseUrl = resolveIdentityBaseUrl(\n\t\tcredentialsBeforeKey,\n\t\tendpoint,\n\t);\n\tconst now = deps.now();\n\n\tlet apiKey = stored && !options.rotateKey ? stored.apiKey : undefined;\n\tlet keyOutput: CreateAPIKeyOutput | undefined;\n\tlet apiKeyCreated = false;\n\n\tif (!apiKey) {\n\t\tdeps.onStatus({ message: \"Creating EvalOps agent API key\" });\n\t\tkeyOutput = await createAgentAPIKey(\n\t\t\toptions,\n\t\t\tidentityBaseUrl,\n\t\t\toauthToken,\n\t\t\tdeps.fetch,\n\t\t\tnow,\n\t\t);\n\t\tapiKey = keyOutput.api_key;\n\t\tapiKeyCreated = true;\n\t} else {\n\t\tdeps.onStatus({ message: \"Reusing stored EvalOps agent API key\" });\n\t}\n\n\tdeps.onStatus({ message: \"Registering Maestro with EvalOps agent MCP\" });\n\tlet registerOutput: RegisterOutput;\n\tlet client: EvalOpsMcpClient;\n\tconst openAndRegister = async (token: string) => {\n\t\tconst mcpClient = deps.createMcpClient(endpoint.endpoint, token);\n\t\tawait mcpClient.connect();\n\t\ttry {\n\t\t\tconst output = await registerAgent(options, mcpClient);\n\t\t\treturn { client: mcpClient, registerOutput: output };\n\t\t} catch (error) {\n\t\t\tawait mcpClient.close().catch(() => undefined);\n\t\t\tthrow error;\n\t\t}\n\t};\n\ttry {\n\t\t({ client, registerOutput } = await openAndRegister(apiKey));\n\t} catch (error) {\n\t\tif (apiKeyCreated) {\n\t\t\tthrow error;\n\t\t}\n\t\tdeps.onStatus({\n\t\t\tmessage: \"Stored EvalOps agent API key failed; rotating and retrying\",\n\t\t});\n\t\tkeyOutput = await createAgentAPIKey(\n\t\t\t{ ...options, rotateKey: true },\n\t\t\tidentityBaseUrl,\n\t\t\toauthToken,\n\t\t\tdeps.fetch,\n\t\t\tnow,\n\t\t);\n\t\tapiKey = keyOutput.api_key;\n\t\tapiKeyCreated = true;\n\t\t({ client, registerOutput } = await openAndRegister(apiKey));\n\t}\n\n\tlet governedInferenceCheck: CheckActionOutput = {};\n\tlet controlPlaneSummary: ControlPlaneSummaryOutput = {};\n\ttry {\n\t\tdeps.onStatus({ message: \"Running first governed inference check\" });\n\t\tgovernedInferenceCheck = await runGovernedInferenceCheck(client);\n\t} catch (error) {\n\t\tconst reason = error instanceof Error ? error.message : String(error);\n\t\tdeps.onStatus({\n\t\t\tmessage: `EvalOps governed inference check unavailable; continuing bootstrap (${reason})`,\n\t\t});\n\t}\n\ttry {\n\t\tdeps.onStatus({ message: \"Loading EvalOps control-plane proof\" });\n\t\tcontrolPlaneSummary = await loadControlPlaneSummary(client);\n\t} catch (error) {\n\t\tconst reason = error instanceof Error ? error.message : String(error);\n\t\tdeps.onStatus({\n\t\t\tmessage: `EvalOps control-plane proof unavailable; continuing bootstrap (${reason})`,\n\t\t});\n\t} finally {\n\t\tawait client.close().catch(() => undefined);\n\t}\n\n\tconst credentials = deps.loadCredentials(\"evalops\");\n\tif (!credentials) {\n\t\tthrow new Error(\"EvalOps OAuth credentials disappeared during init\");\n\t}\n\tconst keyPrefix = nonEmptyString(keyOutput?.prefix) ?? stored?.keyPrefix;\n\tconst scopes = keyOutput?.scopes ?? stored?.scopes;\n\tconst agentMcp: EvalOpsAgentMcpMetadata = {\n\t\ttype: \"agent-mcp\",\n\t\tapiKey,\n\t\tcreatedAt: (apiKeyCreated\n\t\t\t? now\n\t\t\t: new Date(stored?.createdAt ?? now)\n\t\t).toISOString(),\n\t\tendpoint: endpoint.endpoint,\n\t\tregisteredAt: deps.now().toISOString(),\n\t\tsurface: options.surface ?? DEFAULT_SURFACE,\n\t\tagentId: registerOutput.agent_id,\n\t\texpiresAt: nonEmptyString(keyOutput?.expires_at) ?? stored?.expiresAt,\n\t\tkeyId: nonEmptyString(keyOutput?.key_id) ?? stored?.keyId,\n\t\tkeyName: nonEmptyString(keyOutput?.name) ?? stored?.keyName,\n\t\tkeyPrefix,\n\t\tmanifestUrl: endpoint.manifestUrl,\n\t\tregistryVisible: registerOutput.registry_visible,\n\t\trunId: registerOutput.run_id,\n\t\tscopes,\n\t\tsessionExpiresAt: registerOutput.expires_at,\n\t\tworkspaceId:\n\t\t\toptions.workspaceId ?? organizationIdFromCredentials(credentials),\n\t};\n\tsaveBootstrapMetadata(credentials, agentMcp, deps.saveCredentials);\n\n\treturn {\n\t\tagentId: registerOutput.agent_id,\n\t\tapiKeyCreated,\n\t\tapprovalPolicyAttached: hasPolicyControl(controlPlaneSummary),\n\t\tauthenticatedAs: authenticatedAsFromCredentials(credentials),\n\t\tconsoleUrl: consoleUrlFromEndpoint(endpoint.endpoint),\n\t\tendpoint: endpoint.endpoint,\n\t\tevidenceEventPublished: (controlPlaneSummary.evidence ?? []).length > 0,\n\t\tevidenceEvents: (controlPlaneSummary.evidence ?? []).length,\n\t\tgovernedActionsLoaded: governedActionCount(controlPlaneSummary),\n\t\tgovernedInferenceCheckRan: Boolean(governedInferenceCheck.decision),\n\t\tkeyPrefix,\n\t\tmanifestUrl: endpoint.manifestUrl,\n\t\torganizationId: organizationIdFromCredentials(credentials),\n\t\tregistryVisible: registerOutput.registry_visible,\n\t\triskFindings: countHighRiskFindings(controlPlaneSummary),\n\t\trunId: registerOutput.run_id,\n\t\tscopesGranted: registerOutput.scopes_granted,\n\t\tsessionExpiresAt: registerOutput.expires_at,\n\t\tstored: true,\n\t\ttraceIngestionStarted: hasTraceEvidence(controlPlaneSummary),\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"agent-bootstrap.js","sourceRoot":"","sources":["../../src/evalops/agent-bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAEnG,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAEN,oBAAoB,EACpB,oBAAoB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,MAAM,0BAA0B,GAAG,yBAAyB,CAAC;AAC7D,MAAM,yBAAyB,GAAG,8BAA8B,CAAC;AACjE,MAAM,uBAAuB,GAAG,q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sBAAsB,EAAE,gBAAgB,CAAC,mBAAmB,CAAC;QAC7D,eAAe,EAAE,8BAA8B,CAAC,WAAW,CAAC;QAC5D,UAAU,EAAE,sBAAsB,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACrD,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,sBAAsB,EAAE,CAAC,mBAAmB,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC;QACvE,cAAc,EAAE,CAAC,mBAAmB,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM;QAC3D,qBAAqB,EAAE,mBAAmB,CAAC,mBAAmB,CAAC;QAC/D,yBAAyB,EAAE,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC;QACnE,kBAAkB;QAClB,SAAS;QACT,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,UAAU;QACV,cAAc,EAAE,6BAA6B,CAAC,WAAW,CAAC;QAC1D,eAAe,EAAE,cAAc,CAAC,gBAAgB;QAChD,YAAY,EAAE,qBAAqB,CAAC,mBAAmB,CAAC;QACxD,KAAK,EAAE,cAAc,CAAC,MAAM;QAC5B,YAAY;QACZ,aAAa,EAAE,cAAc,CAAC,cAAc;QAC5C,gBAAgB,EAAE,cAAc,CAAC,UAAU;QAC3C,QAAQ;QACR,MAAM,EAAE,IAAI;QACZ,qBAAqB,EAAE,gBAAgB,CAAC,mBAAmB,CAAC;QAC5D,SAAS;KACT,CAAC;AACH,CAAC","sourcesContent":["import { hostname } from \"node:os\";\nimport { Client } from \"@modelcontextprotocol/sdk/client/index.js\";\nimport { StreamableHTTPClientTransport } from \"@modelcontextprotocol/sdk/client/streamableHttp.js\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport { getOAuthToken, hasOAuthCredentials, login } from \"../oauth/index.js\";\nimport {\n\ttype OAuthCredentials,\n\tloadOAuthCredentials,\n\tsaveOAuthCredentials,\n} from \"../oauth/storage.js\";\nimport { getPackageVersion } from \"../package-metadata.js\";\nimport { getEnvValue, normalizeBaseUrl } from \"../platform/client.js\";\nimport { PLATFORM_HTTP_ROUTES } from \"../platform/core-services.js\";\n\nconst DEFAULT_AGENT_MCP_BASE_URL = \"https://app.evalops.dev\";\nconst DEFAULT_IDENTITY_BASE_URL = \"https://identity.evalops.dev\";\nconst AGENT_MCP_MANIFEST_PATH = \"/.well-known/evalops/agent-mcp.json\";\nconst AGENT_MCP_PATH = \"/mcp\";\nconst DEFAULT_AGENT_TYPE = \"maestro\";\nconst DEFAULT_SURFACE = \"cli\";\nconst DEFAULT_API_KEY_SCOPES = [\n\t\"agent:register\",\n\t\"agent:heartbeat\",\n\t\"governance:evaluate\",\n\t\"llm_gateway:invoke\",\n\t\"memories:read\",\n\t\"memories:write\",\n\t\"meter:record\",\n];\n\nexport interface EvalOpsInitOptions {\n\tagentType?: string;\n\tapiKeyScopes?: string[];\n\texpiresInDays?: number;\n\tforceLogin?: boolean;\n\tintegrationProfile?: string;\n\tjson?: boolean;\n\tkeyName?: string;\n\tmanifestUrl?: string;\n\tmemoryMode?: string;\n\tmcpUrl?: string;\n\tregisterScopes?: string[];\n\trotateKey?: boolean;\n\truntimeOwner?: string;\n\tshimType?: string;\n\tsurface?: string;\n\ttraceMode?: string;\n\tttlSeconds?: number;\n\tworkspaceId?: string;\n}\n\nexport interface EvalOpsAgentMcpMetadata {\n\tagentId?: string;\n\tapiKey?: string;\n\tcreatedAt: string;\n\tendpoint: string;\n\texpiresAt?: string;\n\tintegrationProfile?: string;\n\tkeyId?: string;\n\tkeyName?: string;\n\tkeyPrefix?: string;\n\tmanifestUrl?: string;\n\tmemoryMode?: string;\n\tregisteredAt: string;\n\tregistryVisible?: boolean;\n\trunId?: string;\n\truntimeOwner?: string;\n\tscopes?: string[];\n\tsessionExpiresAt?: string;\n\tshimType?: string;\n\tsurface: string;\n\ttraceMode?: string;\n\ttype: \"agent-mcp\";\n\tworkspaceId?: string;\n}\n\nexport interface EvalOpsInitResult {\n\tagentId?: string;\n\tapiKeyCreated: boolean;\n\tapprovalPolicyAttached?: boolean;\n\tauthenticatedAs?: string;\n\tconsoleUrl?: string;\n\tendpoint: string;\n\tevidenceEventPublished?: boolean;\n\tevidenceEvents?: number;\n\tgovernedActionsLoaded?: number;\n\tgovernedInferenceCheckRan?: boolean;\n\tintegrationProfile?: string;\n\tkeyPrefix?: string;\n\tmanifestUrl?: string;\n\tmemoryMode?: string;\n\torganizationId?: string;\n\tregistryVisible?: boolean;\n\triskFindings?: number;\n\trunId?: string;\n\truntimeOwner?: string;\n\tscopesGranted?: string[];\n\tsessionExpiresAt?: string;\n\tshimType?: string;\n\tstored: boolean;\n\ttraceIngestionStarted?: boolean;\n\ttraceMode?: string;\n}\n\nexport interface EvalOpsInitStatus {\n\tmessage: string;\n}\n\nexport interface EvalOpsInitDependencies {\n\tcreateMcpClient?: (endpoint: string, bearerToken: string) => EvalOpsMcpClient;\n\tfetch?: typeof fetch;\n\tgetOAuthToken?: typeof getOAuthToken;\n\thasOAuthCredentials?: typeof hasOAuthCredentials;\n\tloadCredentials?: typeof loadOAuthCredentials;\n\tlogin?: typeof login;\n\tnow?: () => Date;\n\tonAuthUrl?: (url: string) => void;\n\tonStatus?: (status: EvalOpsInitStatus) => void;\n\tsaveCredentials?: typeof saveOAuthCredentials;\n}\n\nexport interface EvalOpsMcpClient {\n\tcallTool(\n\t\tname: string,\n\t\targs: Record<string, unknown>,\n\t): Promise<CallToolResult>;\n\tclose(): Promise<void>;\n\tconnect(): Promise<void>;\n}\n\ninterface CreateAPIKeyOutput {\n\tapi_key: string;\n\texpires_at?: string;\n\tkey_id?: string;\n\tname?: string;\n\tprefix?: string;\n\tscopes?: string[];\n}\n\ninterface CreateAPIKeyHTTPOutput extends Partial<CreateAPIKeyOutput> {\n\terror?: string;\n\tkey?: Record<string, unknown>;\n\tscopes_granted?: unknown;\n}\n\ninterface RegisterOutput {\n\tagent_id?: string;\n\texpires_at?: string;\n\tintegration_profile?: string;\n\tmemory_mode?: string;\n\tregistered?: boolean;\n\tregistry_visible?: boolean;\n\trun_id?: string;\n\truntime_owner?: string;\n\tscopes_denied?: string[];\n\tscopes_granted?: string[];\n\tshim_type?: string;\n\ttrace_mode?: string;\n}\n\ninterface CheckActionOutput {\n\tdecision?: string;\n\trisk_level?: string;\n\treasons?: string[];\n}\n\ninterface ControlPlaneSummaryOutput {\n\tevidence?: unknown[];\n\tfindings?: unknown[];\n\tmetrics?: {\n\t\tapproval_required_tools?: number;\n\t\thigh_risk_tools?: number;\n\t\ttotal_tools?: number;\n\t};\n\tpolicy_controls?: unknown[];\n\ttools?: unknown[];\n}\n\ninterface AgentMcpEndpoint {\n\tendpoint: string;\n\tidentityBaseUrl?: string;\n\tmanifestUrl?: string;\n\tpreferDerivedIdentity?: boolean;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction nonEmptyString(value: unknown): string | undefined {\n\treturn typeof value === \"string\" && value.trim().length > 0\n\t\t? value.trim()\n\t\t: undefined;\n}\n\nfunction stringArray(value: unknown): string[] | undefined {\n\tif (!Array.isArray(value)) {\n\t\treturn undefined;\n\t}\n\tconst values = value\n\t\t.map((entry) => nonEmptyString(entry))\n\t\t.filter((entry): entry is string => Boolean(entry));\n\treturn values.length > 0 ? values : undefined;\n}\n\nfunction positiveInteger(value: number | undefined): number | undefined {\n\treturn typeof value === \"number\" && Number.isInteger(value) && value > 0\n\t\t? value\n\t\t: undefined;\n}\n\nfunction getStoredAgentMcpMetadata(\n\tcredentials: OAuthCredentials | null,\n): EvalOpsAgentMcpMetadata | undefined {\n\tconst metadata = credentials?.metadata;\n\tconst agentMcp = isRecord(metadata?.agentMcp) ? metadata.agentMcp : undefined;\n\tconst apiKey = nonEmptyString(agentMcp?.apiKey);\n\tconst endpoint = nonEmptyString(agentMcp?.endpoint);\n\tconst registeredAt = nonEmptyString(agentMcp?.registeredAt);\n\tconst createdAt = nonEmptyString(agentMcp?.createdAt);\n\tconst surface = nonEmptyString(agentMcp?.surface);\n\tif (!apiKey || !endpoint || !registeredAt || !createdAt || !surface) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\ttype: \"agent-mcp\",\n\t\tapiKey,\n\t\tcreatedAt,\n\t\tendpoint,\n\t\tregisteredAt,\n\t\tsurface,\n\t\tagentId: nonEmptyString(agentMcp?.agentId),\n\t\texpiresAt: nonEmptyString(agentMcp?.expiresAt),\n\t\tintegrationProfile: nonEmptyString(agentMcp?.integrationProfile),\n\t\tkeyId: nonEmptyString(agentMcp?.keyId),\n\t\tkeyName: nonEmptyString(agentMcp?.keyName),\n\t\tkeyPrefix: nonEmptyString(agentMcp?.keyPrefix),\n\t\tmanifestUrl: nonEmptyString(agentMcp?.manifestUrl),\n\t\tmemoryMode: nonEmptyString(agentMcp?.memoryMode),\n\t\tregistryVisible:\n\t\t\ttypeof agentMcp?.registryVisible === \"boolean\"\n\t\t\t\t? agentMcp.registryVisible\n\t\t\t\t: undefined,\n\t\trunId: nonEmptyString(agentMcp?.runId),\n\t\truntimeOwner: nonEmptyString(agentMcp?.runtimeOwner),\n\t\tscopes: stringArray(agentMcp?.scopes),\n\t\tsessionExpiresAt: nonEmptyString(agentMcp?.sessionExpiresAt),\n\t\tshimType: nonEmptyString(agentMcp?.shimType),\n\t\ttraceMode: nonEmptyString(agentMcp?.traceMode),\n\t\tworkspaceId: nonEmptyString(agentMcp?.workspaceId),\n\t};\n}\n\nexport function getStoredEvalOpsAgentMcpMetadata():\n\t| EvalOpsAgentMcpMetadata\n\t| undefined {\n\treturn getStoredAgentMcpMetadata(loadOAuthCredentials(\"evalops\"));\n}\n\nfunction normalizeMcpEndpoint(url: string): string {\n\tconst normalized = normalizeBaseUrl(url);\n\tconst parsed = new URL(normalized);\n\tif (\n\t\tparsed.pathname === \"\" ||\n\t\tparsed.pathname === \"/\" ||\n\t\tparsed.pathname === AGENT_MCP_MANIFEST_PATH\n\t) {\n\t\tparsed.pathname = AGENT_MCP_PATH;\n\t\tparsed.search = \"\";\n\t\tparsed.hash = \"\";\n\t}\n\treturn normalizeBaseUrl(parsed.toString());\n}\n\nfunction normalizeManifestUrl(url: string): string {\n\tconst normalized = normalizeBaseUrl(url);\n\tconst parsed = new URL(normalized);\n\tif (parsed.pathname === \"\" || parsed.pathname === \"/\") {\n\t\tparsed.pathname = AGENT_MCP_MANIFEST_PATH;\n\t}\n\treturn parsed.toString();\n}\n\nfunction resolveIdentityBaseUrl(\n\tcredentials: OAuthCredentials | null,\n\tendpoint?: AgentMcpEndpoint,\n): string {\n\tconst configured = getEnvValue([\n\t\t\"MAESTRO_IDENTITY_URL\",\n\t\t\"EVALOPS_IDENTITY_URL\",\n\t\t\"MAESTRO_PLATFORM_BASE_URL\",\n\t\t\"MAESTRO_EVALOPS_BASE_URL\",\n\t\t\"EVALOPS_BASE_URL\",\n\t]);\n\tconst stored =\n\t\ttypeof credentials?.metadata?.identityBaseUrl === \"string\"\n\t\t\t? credentials.metadata.identityBaseUrl\n\t\t\t: undefined;\n\tconst derived = identityBaseUrlFromMcpEndpoint(endpoint?.endpoint);\n\tconst storedBeforeDerived = endpoint\n\t\t? !endpoint.preferDerivedIdentity && isCustomMcpEndpoint(endpoint.endpoint)\n\t\t: false;\n\treturn normalizeBaseUrl(\n\t\tconfigured ??\n\t\t\tendpoint?.identityBaseUrl ??\n\t\t\t(endpoint?.preferDerivedIdentity ? derived : undefined) ??\n\t\t\t(storedBeforeDerived ? stored : undefined) ??\n\t\t\tderived ??\n\t\t\tstored ??\n\t\t\tDEFAULT_IDENTITY_BASE_URL,\n\t\tObject.values(PLATFORM_HTTP_ROUTES.identity),\n\t);\n}\n\nfunction isCustomMcpEndpoint(endpoint: string): boolean {\n\tconst parsed = new URL(normalizeBaseUrl(endpoint));\n\treturn (\n\t\tparsed.hostname !== \"app.evalops.dev\" &&\n\t\tparsed.hostname !== \"staging.evalops.dev\"\n\t);\n}\n\nfunction identityBaseUrlFromMcpEndpoint(\n\tendpoint: string | undefined,\n): string | undefined {\n\tif (!endpoint) {\n\t\treturn undefined;\n\t}\n\tconst parsed = new URL(normalizeBaseUrl(endpoint));\n\tif (parsed.hostname === \"app.evalops.dev\") {\n\t\treturn DEFAULT_IDENTITY_BASE_URL;\n\t}\n\tif (parsed.hostname === \"staging.evalops.dev\") {\n\t\treturn \"https://api.staging.evalops.dev\";\n\t}\n\tif (parsed.hostname.startsWith(\"app.\")) {\n\t\tparsed.hostname = `identity.${parsed.hostname.slice(\"app.\".length)}`;\n\t}\n\tparsed.pathname = \"\";\n\tparsed.search = \"\";\n\tparsed.hash = \"\";\n\treturn normalizeBaseUrl(parsed.toString());\n}\n\nasync function resolveEndpointFromManifest(\n\tmanifestUrl: string,\n\tfetchImpl: typeof fetch,\n): Promise<AgentMcpEndpoint> {\n\tconst response = await fetchImpl(manifestUrl, {\n\t\theaders: { accept: \"application/json\" },\n\t});\n\tif (!response.ok) {\n\t\tthrow new Error(\n\t\t\t`Failed to fetch EvalOps MCP manifest (${response.status} ${response.statusText})`,\n\t\t);\n\t}\n\tconst payload = (await response.json()) as unknown;\n\tconst payloadRecord = isRecord(payload) ? payload : undefined;\n\tconst protocol =\n\t\tpayloadRecord && isRecord(payloadRecord.protocol)\n\t\t\t? payloadRecord.protocol\n\t\t\t: undefined;\n\tconst endpoint = nonEmptyString(protocol?.endpoint);\n\tif (!endpoint) {\n\t\tthrow new Error(\"EvalOps MCP manifest did not include protocol.endpoint\");\n\t}\n\tconst identity = payloadRecord?.identity;\n\tconst identityBaseUrl =\n\t\tnonEmptyString(isRecord(identity) ? identity.base_url : undefined) ??\n\t\tnonEmptyString(isRecord(identity) ? identity.baseUrl : undefined) ??\n\t\tnonEmptyString(isRecord(identity) ? identity.url : undefined) ??\n\t\tnonEmptyString(payloadRecord?.identity_base_url) ??\n\t\tnonEmptyString(payloadRecord?.identityBaseUrl);\n\treturn {\n\t\tendpoint: normalizeMcpEndpoint(endpoint),\n\t\tidentityBaseUrl,\n\t\tmanifestUrl,\n\t\tpreferDerivedIdentity: true,\n\t};\n}\n\nasync function resolveAgentMcpEndpoint(\n\toptions: EvalOpsInitOptions,\n\tdeps: Required<Pick<EvalOpsInitDependencies, \"fetch\" | \"loadCredentials\">>,\n): Promise<AgentMcpEndpoint> {\n\tif (options.mcpUrl) {\n\t\treturn {\n\t\t\tendpoint: normalizeMcpEndpoint(options.mcpUrl),\n\t\t\tpreferDerivedIdentity: true,\n\t\t};\n\t}\n\tif (options.manifestUrl) {\n\t\treturn resolveEndpointFromManifest(\n\t\t\tnormalizeManifestUrl(options.manifestUrl),\n\t\t\tdeps.fetch,\n\t\t);\n\t}\n\n\tconst configuredMcpUrl = getEnvValue([\n\t\t\"MAESTRO_PLATFORM_MCP_URL\",\n\t\t\"MAESTRO_AGENT_MCP_URL\",\n\t\t\"MAESTRO_EVALOPS_AGENT_MCP_URL\",\n\t]);\n\tif (configuredMcpUrl) {\n\t\treturn {\n\t\t\tendpoint: normalizeMcpEndpoint(configuredMcpUrl),\n\t\t\tpreferDerivedIdentity: true,\n\t\t};\n\t}\n\n\tconst configuredManifestUrl = getEnvValue([\n\t\t\"MAESTRO_PLATFORM_MCP_MANIFEST_URL\",\n\t\t\"MAESTRO_AGENT_MCP_MANIFEST_URL\",\n\t\t\"MAESTRO_EVALOPS_AGENT_MCP_MANIFEST_URL\",\n\t]);\n\tif (configuredManifestUrl) {\n\t\treturn resolveEndpointFromManifest(\n\t\t\tnormalizeManifestUrl(configuredManifestUrl),\n\t\t\tdeps.fetch,\n\t\t);\n\t}\n\n\tconst stored = getStoredAgentMcpMetadata(deps.loadCredentials(\"evalops\"));\n\tif (stored?.endpoint) {\n\t\treturn {\n\t\t\tendpoint: normalizeMcpEndpoint(stored.endpoint),\n\t\t\tmanifestUrl: stored.manifestUrl,\n\t\t};\n\t}\n\n\treturn resolveEndpointFromManifest(\n\t\t`${DEFAULT_AGENT_MCP_BASE_URL}${AGENT_MCP_MANIFEST_PATH}`,\n\t\tdeps.fetch,\n\t);\n}\n\nfunction createDefaultMcpClient(\n\tendpoint: string,\n\tbearerToken: string,\n): EvalOpsMcpClient {\n\tconst client = new Client(\n\t\t{\n\t\t\tname: \"maestro\",\n\t\t\tversion: getPackageVersion(),\n\t\t},\n\t\t{\n\t\t\tcapabilities: {},\n\t\t},\n\t);\n\tconst headers = {\n\t\taccept: \"application/json, text/event-stream\",\n\t\t\"content-type\": \"application/json\",\n\t\t...(bearerToken ? { authorization: `Bearer ${bearerToken}` } : {}),\n\t};\n\tconst transport = new StreamableHTTPClientTransport(new URL(endpoint), {\n\t\trequestInit: {\n\t\t\theaders,\n\t\t},\n\t});\n\treturn {\n\t\tcallTool: (name, args) =>\n\t\t\tclient.callTool({\n\t\t\t\tname,\n\t\t\t\targuments: args,\n\t\t\t}) as Promise<CallToolResult>,\n\t\tclose: () => client.close(),\n\t\tconnect: () => client.connect(transport),\n\t};\n}\n\nasync function callConnectedMcpTool<T>(\n\tclient: EvalOpsMcpClient,\n\ttoolName: string,\n\targs: Record<string, unknown>,\n): Promise<T> {\n\tconst result = await client.callTool(toolName, args);\n\tif (result.isError) {\n\t\tthrow new Error(`${toolName} returned an MCP error`);\n\t}\n\treturn parseToolOutput<T>(toolName, result);\n}\n\nfunction parseToolOutput<T>(toolName: string, result: CallToolResult): T {\n\tconst structuredContent = isRecord(result.structuredContent)\n\t\t? result.structuredContent\n\t\t: undefined;\n\tif (structuredContent) {\n\t\treturn structuredContent as T;\n\t}\n\tconst text = Array.isArray(result.content)\n\t\t? result.content\n\t\t\t\t.map((entry) =>\n\t\t\t\t\tentry.type === \"text\" && typeof entry.text === \"string\"\n\t\t\t\t\t\t? entry.text\n\t\t\t\t\t\t: undefined,\n\t\t\t\t)\n\t\t\t\t.find((entry): entry is string => Boolean(entry))\n\t\t: undefined;\n\tif (text) {\n\t\tconst parsed = JSON.parse(text) as unknown;\n\t\tif (isRecord(parsed)) {\n\t\t\treturn parsed as T;\n\t\t}\n\t}\n\tthrow new Error(`${toolName} did not return structured JSON output`);\n}\n\nasync function ensureEvalOpsLogin(\n\toptions: EvalOpsInitOptions,\n\tdeps: Required<\n\t\tPick<\n\t\t\tEvalOpsInitDependencies,\n\t\t\t| \"getOAuthToken\"\n\t\t\t| \"hasOAuthCredentials\"\n\t\t\t| \"login\"\n\t\t\t| \"onAuthUrl\"\n\t\t\t| \"onStatus\"\n\t\t>\n\t>,\n): Promise<string> {\n\tif (options.forceLogin || !deps.hasOAuthCredentials(\"evalops\")) {\n\t\tdeps.onStatus({ message: \"Opening EvalOps login\" });\n\t\tawait deps.login(\"evalops\", {\n\t\t\tonAuthUrl: deps.onAuthUrl,\n\t\t\tonStatus: (message) => deps.onStatus({ message }),\n\t\t});\n\t}\n\n\tlet token = await deps.getOAuthToken(\"evalops\");\n\tif (!token) {\n\t\tdeps.onStatus({ message: \"Refreshing EvalOps login\" });\n\t\tawait deps.login(\"evalops\", {\n\t\t\tonAuthUrl: deps.onAuthUrl,\n\t\t\tonStatus: (message) => deps.onStatus({ message }),\n\t\t});\n\t\ttoken = await deps.getOAuthToken(\"evalops\");\n\t}\n\tif (!token) {\n\t\tthrow new Error(\"EvalOps login did not produce an access token\");\n\t}\n\treturn token;\n}\n\nfunction buildKeyName(options: EvalOpsInitOptions, now: Date): string {\n\tif (options.keyName?.trim()) {\n\t\treturn options.keyName.trim();\n\t}\n\tconst host = hostname()\n\t\t.replace(/[^a-zA-Z0-9._-]+/gu, \"-\")\n\t\t.slice(0, 48);\n\treturn `maestro-init-${host || \"local\"}-${now.toISOString().slice(0, 10)}`;\n}\n\nfunction integrationProfileForOptions(options: EvalOpsInitOptions): string {\n\treturn (\n\t\tnonEmptyString(options.integrationProfile) ??\n\t\t(options.agentType && options.agentType !== DEFAULT_AGENT_TYPE\n\t\t\t? \"mcp_otlp\"\n\t\t\t: \"managed_runtime\")\n\t);\n}\n\nfunction shimTypeForOptions(options: EvalOpsInitOptions): string {\n\treturn (\n\t\tnonEmptyString(options.shimType) ??\n\t\t(integrationProfileForOptions(options) === \"managed_runtime\"\n\t\t\t? \"sdk\"\n\t\t\t: \"native_mcp\")\n\t);\n}\n\nfunction traceModeForOptions(options: EvalOpsInitOptions): string {\n\treturn (\n\t\tnonEmptyString(options.traceMode) ??\n\t\t(integrationProfileForOptions(options) === \"mcp_only\"\n\t\t\t? \"mcp_events\"\n\t\t\t: \"otlp\")\n\t);\n}\n\nfunction memoryModeForOptions(options: EvalOpsInitOptions): string {\n\treturn (\n\t\tnonEmptyString(options.memoryMode) ??\n\t\t(integrationProfileForOptions(options) === \"managed_runtime\"\n\t\t\t? \"durable\"\n\t\t\t: \"none\")\n\t);\n}\n\nfunction runtimeOwnerForOptions(options: EvalOpsInitOptions): string {\n\treturn (\n\t\tnonEmptyString(options.runtimeOwner) ??\n\t\t(integrationProfileForOptions(options) === \"managed_runtime\"\n\t\t\t? \"evalops\"\n\t\t\t: \"external\")\n\t);\n}\n\nasync function createAgentAPIKey(\n\toptions: EvalOpsInitOptions,\n\tidentityBaseUrl: string,\n\toauthToken: string,\n\tfetchImpl: typeof fetch,\n\tnow: Date,\n): Promise<CreateAPIKeyOutput> {\n\tconst expiresInDays = positiveInteger(options.expiresInDays);\n\tconst expiresAt = expiresInDays\n\t\t? new Date(\n\t\t\t\tnow.getTime() + expiresInDays * 24 * 60 * 60 * 1000,\n\t\t\t).toISOString()\n\t\t: undefined;\n\tconst response = await fetchImpl(\n\t\t`${identityBaseUrl}${PLATFORM_HTTP_ROUTES.identity.apiKeys}`,\n\t\t{\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${oauthToken}`,\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t},\n\t\t\tbody: JSON.stringify({\n\t\t\t\tname: buildKeyName(options, now),\n\t\t\t\tscopes: options.apiKeyScopes ?? DEFAULT_API_KEY_SCOPES,\n\t\t\t\t...(expiresAt ? { expires_at: expiresAt } : {}),\n\t\t\t}),\n\t\t},\n\t);\n\tconst output = (await response\n\t\t.json()\n\t\t.catch(() => ({}))) as CreateAPIKeyHTTPOutput;\n\tif (!response.ok) {\n\t\tthrow new Error(\n\t\t\ttypeof output.error === \"string\" && output.error.trim()\n\t\t\t\t? output.error\n\t\t\t\t: `EvalOps API key creation failed (${response.status})`,\n\t\t);\n\t}\n\tconst key = isRecord(output.key) ? output.key : undefined;\n\tconst normalized: CreateAPIKeyOutput = {\n\t\tapi_key: nonEmptyString(output.api_key) ?? \"\",\n\t\texpires_at:\n\t\t\tnonEmptyString(output.expires_at) ?? nonEmptyString(key?.expires_at),\n\t\tkey_id: nonEmptyString(output.key_id) ?? nonEmptyString(key?.id),\n\t\tname: nonEmptyString(output.name) ?? nonEmptyString(key?.name),\n\t\tprefix: nonEmptyString(output.prefix) ?? nonEmptyString(key?.prefix),\n\t\tscopes:\n\t\t\tstringArray(output.scopes) ??\n\t\t\tstringArray(key?.scopes) ??\n\t\t\tstringArray(output.scopes_granted),\n\t};\n\tif (!nonEmptyString(normalized.api_key)) {\n\t\tthrow new Error(\"EvalOps API key creation did not return api_key\");\n\t}\n\treturn normalized;\n}\n\nasync function registerAgent(\n\toptions: EvalOpsInitOptions,\n\tclient: EvalOpsMcpClient,\n): Promise<RegisterOutput> {\n\tconst output = await callConnectedMcpTool<RegisterOutput>(\n\t\tclient,\n\t\t\"evalops_register\",\n\t\t{\n\t\t\tagent_type: options.agentType ?? DEFAULT_AGENT_TYPE,\n\t\t\tcapabilities: [\"maestro:init\", \"maestro:cli\"],\n\t\t\tintegration_profile: integrationProfileForOptions(options),\n\t\t\tmemory_mode: memoryModeForOptions(options),\n\t\t\truntime_owner: runtimeOwnerForOptions(options),\n\t\t\t...(options.registerScopes?.length\n\t\t\t\t? { scopes: options.registerScopes }\n\t\t\t\t: {}),\n\t\t\tshim_type: shimTypeForOptions(options),\n\t\t\tsurface: options.surface ?? DEFAULT_SURFACE,\n\t\t\ttrace_mode: traceModeForOptions(options),\n\t\t\t...(positiveInteger(options.ttlSeconds)\n\t\t\t\t? { ttl_seconds: options.ttlSeconds }\n\t\t\t\t: {}),\n\t\t\t...(options.workspaceId ? { workspace_id: options.workspaceId } : {}),\n\t\t},\n\t);\n\tif (output.registered !== true || !nonEmptyString(output.agent_id)) {\n\t\tthrow new Error(\"EvalOps agent registration did not return an agent_id\");\n\t}\n\treturn output;\n}\n\nasync function runGovernedInferenceCheck(\n\tclient: EvalOpsMcpClient,\n): Promise<CheckActionOutput> {\n\treturn callConnectedMcpTool<CheckActionOutput>(\n\t\tclient,\n\t\t\"evalops_check_action\",\n\t\t{\n\t\t\taction_type: \"llm_gateway.invoke\",\n\t\t\taction_payload: \"maestro init first governed inference check\",\n\t\t\tdeclared_risk_level: \"low\",\n\t\t},\n\t);\n}\n\nasync function loadControlPlaneSummary(\n\tclient: EvalOpsMcpClient,\n): Promise<ControlPlaneSummaryOutput> {\n\treturn callConnectedMcpTool<ControlPlaneSummaryOutput>(\n\t\tclient,\n\t\t\"evalops_control_plane_summary\",\n\t\t{},\n\t);\n}\n\nfunction organizationIdFromCredentials(\n\tcredentials: OAuthCredentials | null,\n): string | undefined {\n\treturn (\n\t\tnonEmptyString(credentials?.metadata?.organizationId) ??\n\t\tnonEmptyString(credentials?.metadata?.organization_id)\n\t);\n}\n\nfunction authenticatedAsFromCredentials(\n\tcredentials: OAuthCredentials | null,\n): string | undefined {\n\tconst metadata = credentials?.metadata;\n\tconst user = isRecord(metadata?.user) ? metadata.user : undefined;\n\treturn (\n\t\tnonEmptyString(metadata?.email) ??\n\t\tnonEmptyString(metadata?.preferred_username) ??\n\t\tnonEmptyString(metadata?.preferredUsername) ??\n\t\tnonEmptyString(metadata?.user) ??\n\t\tnonEmptyString(user?.email) ??\n\t\tnonEmptyString(user?.name)\n\t);\n}\n\nfunction consoleUrlFromEndpoint(endpoint: string): string {\n\tconst parsed = new URL(endpoint);\n\tparsed.pathname = \"/overview\";\n\tparsed.search = \"\";\n\tparsed.hash = \"\";\n\tconst env =\n\t\tparsed.hostname === \"app.evalops.dev\"\n\t\t\t? \"production\"\n\t\t\t: parsed.hostname === \"staging.evalops.dev\"\n\t\t\t\t? \"staging\"\n\t\t\t\t: \"local\";\n\tparsed.searchParams.set(\"env\", env);\n\treturn parsed.toString();\n}\n\nfunction countHighRiskFindings(summary: ControlPlaneSummaryOutput): number {\n\tconst findings = Array.isArray(summary.findings) ? summary.findings : [];\n\tconst findingCount = findings.filter((finding) => {\n\t\tconst record = isRecord(finding) ? finding : undefined;\n\t\tconst severity = nonEmptyString(record?.severity)?.toLowerCase();\n\t\treturn severity === \"critical\" || severity === \"high\";\n\t}).length;\n\tconst metricCount = summary.metrics?.high_risk_tools;\n\tif (typeof metricCount === \"number\" && Number.isFinite(metricCount)) {\n\t\treturn Math.max(findingCount, Math.max(0, Math.trunc(metricCount)));\n\t}\n\treturn findingCount;\n}\n\nfunction hasPolicyControl(summary: ControlPlaneSummaryOutput): boolean {\n\tconst approvalRequired = summary.metrics?.approval_required_tools ?? 0;\n\tif (approvalRequired > 0) {\n\t\treturn true;\n\t}\n\tconst controls = Array.isArray(summary.policy_controls)\n\t\t? summary.policy_controls\n\t\t: [];\n\treturn controls.some((control) => {\n\t\tconst record = isRecord(control) ? control : undefined;\n\t\treturn /approval|policy|starter/i.test(\n\t\t\t[\n\t\t\t\tnonEmptyString(record?.label),\n\t\t\t\tnonEmptyString(record?.value),\n\t\t\t\tnonEmptyString(record?.detail),\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(\" \"),\n\t\t);\n\t});\n}\n\nfunction hasTraceEvidence(summary: ControlPlaneSummaryOutput): boolean {\n\tconst evidence = Array.isArray(summary.evidence) ? summary.evidence : [];\n\treturn evidence.some((entry) => {\n\t\tconst record = isRecord(entry) ? entry : undefined;\n\t\treturn Boolean(\n\t\t\tnonEmptyString(record?.trace) ??\n\t\t\t\tnonEmptyString(record?.trace_id) ??\n\t\t\t\tnonEmptyString(record?.traceId),\n\t\t);\n\t});\n}\n\nfunction governedActionCount(summary: ControlPlaneSummaryOutput): number {\n\tconst metricTotal = summary.metrics?.total_tools;\n\tif (typeof metricTotal === \"number\" && Number.isFinite(metricTotal)) {\n\t\treturn Math.max(0, Math.trunc(metricTotal));\n\t}\n\treturn Array.isArray(summary.tools) ? summary.tools.length : 0;\n}\n\nfunction saveBootstrapMetadata(\n\tcredentials: OAuthCredentials,\n\tagentMcp: EvalOpsAgentMcpMetadata,\n\tsaveCredentials: typeof saveOAuthCredentials,\n): void {\n\tsaveCredentials(\"evalops\", {\n\t\t...credentials,\n\t\tmetadata: {\n\t\t\t...credentials.metadata,\n\t\t\tagentId: agentMcp.agentId ?? credentials.metadata?.agentId,\n\t\t\trunId: agentMcp.runId ?? credentials.metadata?.runId,\n\t\t\tsurface: agentMcp.surface,\n\t\t\tagentMcp,\n\t\t},\n\t});\n}\n\nexport async function bootstrapEvalOpsAgent(\n\toptions: EvalOpsInitOptions = {},\n\tdependencies: EvalOpsInitDependencies = {},\n): Promise<EvalOpsInitResult> {\n\tconst deps = {\n\t\tcreateMcpClient: dependencies.createMcpClient ?? createDefaultMcpClient,\n\t\tfetch: dependencies.fetch ?? fetch,\n\t\tgetOAuthToken: dependencies.getOAuthToken ?? getOAuthToken,\n\t\thasOAuthCredentials:\n\t\t\tdependencies.hasOAuthCredentials ?? hasOAuthCredentials,\n\t\tloadCredentials: dependencies.loadCredentials ?? loadOAuthCredentials,\n\t\tlogin: dependencies.login ?? login,\n\t\tnow: dependencies.now ?? (() => new Date()),\n\t\tonAuthUrl:\n\t\t\tdependencies.onAuthUrl ??\n\t\t\t((url: string) => {\n\t\t\t\tprocess.stdout.write(`${url}\\n`);\n\t\t\t}),\n\t\tonStatus: dependencies.onStatus ?? (() => undefined),\n\t\tsaveCredentials: dependencies.saveCredentials ?? saveOAuthCredentials,\n\t};\n\n\tconst oauthToken = await ensureEvalOpsLogin(options, deps);\n\tconst endpoint = await resolveAgentMcpEndpoint(options, deps);\n\tconst credentialsBeforeKey = deps.loadCredentials(\"evalops\");\n\tconst stored = getStoredAgentMcpMetadata(credentialsBeforeKey);\n\tconst identityBaseUrl = resolveIdentityBaseUrl(\n\t\tcredentialsBeforeKey,\n\t\tendpoint,\n\t);\n\tconst now = deps.now();\n\n\tlet apiKey = stored && !options.rotateKey ? stored.apiKey : undefined;\n\tlet keyOutput: CreateAPIKeyOutput | undefined;\n\tlet apiKeyCreated = false;\n\n\tif (!apiKey) {\n\t\tdeps.onStatus({ message: \"Creating EvalOps agent API key\" });\n\t\tkeyOutput = await createAgentAPIKey(\n\t\t\toptions,\n\t\t\tidentityBaseUrl,\n\t\t\toauthToken,\n\t\t\tdeps.fetch,\n\t\t\tnow,\n\t\t);\n\t\tapiKey = keyOutput.api_key;\n\t\tapiKeyCreated = true;\n\t} else {\n\t\tdeps.onStatus({ message: \"Reusing stored EvalOps agent API key\" });\n\t}\n\n\tdeps.onStatus({ message: \"Registering Maestro with EvalOps agent MCP\" });\n\tlet registerOutput: RegisterOutput;\n\tlet client: EvalOpsMcpClient;\n\tconst openAndRegister = async (token: string) => {\n\t\tconst mcpClient = deps.createMcpClient(endpoint.endpoint, token);\n\t\tawait mcpClient.connect();\n\t\ttry {\n\t\t\tconst output = await registerAgent(options, mcpClient);\n\t\t\treturn { client: mcpClient, registerOutput: output };\n\t\t} catch (error) {\n\t\t\tawait mcpClient.close().catch(() => undefined);\n\t\t\tthrow error;\n\t\t}\n\t};\n\ttry {\n\t\t({ client, registerOutput } = await openAndRegister(apiKey));\n\t} catch (error) {\n\t\tif (apiKeyCreated) {\n\t\t\tthrow error;\n\t\t}\n\t\tdeps.onStatus({\n\t\t\tmessage: \"Stored EvalOps agent API key failed; rotating and retrying\",\n\t\t});\n\t\tkeyOutput = await createAgentAPIKey(\n\t\t\t{ ...options, rotateKey: true },\n\t\t\tidentityBaseUrl,\n\t\t\toauthToken,\n\t\t\tdeps.fetch,\n\t\t\tnow,\n\t\t);\n\t\tapiKey = keyOutput.api_key;\n\t\tapiKeyCreated = true;\n\t\t({ client, registerOutput } = await openAndRegister(apiKey));\n\t}\n\n\tlet governedInferenceCheck: CheckActionOutput = {};\n\tlet controlPlaneSummary: ControlPlaneSummaryOutput = {};\n\ttry {\n\t\tdeps.onStatus({ message: \"Running first governed inference check\" });\n\t\tgovernedInferenceCheck = await runGovernedInferenceCheck(client);\n\t} catch (error) {\n\t\tconst reason = error instanceof Error ? error.message : String(error);\n\t\tdeps.onStatus({\n\t\t\tmessage: `EvalOps governed inference check unavailable; continuing bootstrap (${reason})`,\n\t\t});\n\t}\n\ttry {\n\t\tdeps.onStatus({ message: \"Loading EvalOps control-plane proof\" });\n\t\tcontrolPlaneSummary = await loadControlPlaneSummary(client);\n\t} catch (error) {\n\t\tconst reason = error instanceof Error ? error.message : String(error);\n\t\tdeps.onStatus({\n\t\t\tmessage: `EvalOps control-plane proof unavailable; continuing bootstrap (${reason})`,\n\t\t});\n\t} finally {\n\t\tawait client.close().catch(() => undefined);\n\t}\n\n\tconst credentials = deps.loadCredentials(\"evalops\");\n\tif (!credentials) {\n\t\tthrow new Error(\"EvalOps OAuth credentials disappeared during init\");\n\t}\n\tconst keyPrefix = nonEmptyString(keyOutput?.prefix) ?? stored?.keyPrefix;\n\tconst scopes = keyOutput?.scopes ?? stored?.scopes;\n\tconst integrationProfile =\n\t\tnonEmptyString(registerOutput.integration_profile) ??\n\t\tintegrationProfileForOptions(options);\n\tconst memoryMode =\n\t\tnonEmptyString(registerOutput.memory_mode) ?? memoryModeForOptions(options);\n\tconst runtimeOwner =\n\t\tnonEmptyString(registerOutput.runtime_owner) ??\n\t\truntimeOwnerForOptions(options);\n\tconst shimType =\n\t\tnonEmptyString(registerOutput.shim_type) ?? shimTypeForOptions(options);\n\tconst traceMode =\n\t\tnonEmptyString(registerOutput.trace_mode) ?? traceModeForOptions(options);\n\tconst agentMcp: EvalOpsAgentMcpMetadata = {\n\t\ttype: \"agent-mcp\",\n\t\tapiKey,\n\t\tcreatedAt: (apiKeyCreated\n\t\t\t? now\n\t\t\t: new Date(stored?.createdAt ?? now)\n\t\t).toISOString(),\n\t\tendpoint: endpoint.endpoint,\n\t\tregisteredAt: deps.now().toISOString(),\n\t\tsurface: options.surface ?? DEFAULT_SURFACE,\n\t\tagentId: registerOutput.agent_id,\n\t\texpiresAt: nonEmptyString(keyOutput?.expires_at) ?? stored?.expiresAt,\n\t\tintegrationProfile,\n\t\tkeyId: nonEmptyString(keyOutput?.key_id) ?? stored?.keyId,\n\t\tkeyName: nonEmptyString(keyOutput?.name) ?? stored?.keyName,\n\t\tkeyPrefix,\n\t\tmanifestUrl: endpoint.manifestUrl,\n\t\tmemoryMode,\n\t\tregistryVisible: registerOutput.registry_visible,\n\t\trunId: registerOutput.run_id,\n\t\truntimeOwner,\n\t\tscopes,\n\t\tsessionExpiresAt: registerOutput.expires_at,\n\t\tshimType,\n\t\ttraceMode,\n\t\tworkspaceId:\n\t\t\toptions.workspaceId ?? organizationIdFromCredentials(credentials),\n\t};\n\tsaveBootstrapMetadata(credentials, agentMcp, deps.saveCredentials);\n\n\treturn {\n\t\tagentId: registerOutput.agent_id,\n\t\tapiKeyCreated,\n\t\tapprovalPolicyAttached: hasPolicyControl(controlPlaneSummary),\n\t\tauthenticatedAs: authenticatedAsFromCredentials(credentials),\n\t\tconsoleUrl: consoleUrlFromEndpoint(endpoint.endpoint),\n\t\tendpoint: endpoint.endpoint,\n\t\tevidenceEventPublished: (controlPlaneSummary.evidence ?? []).length > 0,\n\t\tevidenceEvents: (controlPlaneSummary.evidence ?? []).length,\n\t\tgovernedActionsLoaded: governedActionCount(controlPlaneSummary),\n\t\tgovernedInferenceCheckRan: Boolean(governedInferenceCheck.decision),\n\t\tintegrationProfile,\n\t\tkeyPrefix,\n\t\tmanifestUrl: endpoint.manifestUrl,\n\t\tmemoryMode,\n\t\torganizationId: organizationIdFromCredentials(credentials),\n\t\tregistryVisible: registerOutput.registry_visible,\n\t\triskFindings: countHighRiskFindings(controlPlaneSummary),\n\t\trunId: registerOutput.run_id,\n\t\truntimeOwner,\n\t\tscopesGranted: registerOutput.scopes_granted,\n\t\tsessionExpiresAt: registerOutput.expires_at,\n\t\tshimType,\n\t\tstored: true,\n\t\ttraceIngestionStarted: hasTraceEvidence(controlPlaneSummary),\n\t\ttraceMode,\n\t};\n}\n"]}
|
|
@@ -12,15 +12,20 @@ export interface EvalOpsManagedContext {
|
|
|
12
12
|
evidencePublisher: EvalOpsManagedEvidencePublisher;
|
|
13
13
|
expiresAt?: number;
|
|
14
14
|
inference: EvalOpsManagedInferenceState;
|
|
15
|
+
integrationProfile?: string;
|
|
15
16
|
keyPrefix?: string;
|
|
16
17
|
managed: boolean;
|
|
18
|
+
memoryMode?: string;
|
|
17
19
|
mode: "EvalOps managed" | "EvalOps authenticated" | "local";
|
|
18
20
|
organizationId?: string;
|
|
19
21
|
providerRef?: Record<string, unknown>;
|
|
20
22
|
runId?: string;
|
|
23
|
+
runtimeOwner?: string;
|
|
21
24
|
sessionExpiresAt?: string;
|
|
22
25
|
sessionId?: string;
|
|
26
|
+
shimType?: string;
|
|
23
27
|
traceIngestion: EvalOpsManagedTraceState;
|
|
28
|
+
traceMode?: string;
|
|
24
29
|
userEmail?: string;
|
|
25
30
|
userId?: string;
|
|
26
31
|
workspaceId?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"managed-context.d.ts","sourceRoot":"","sources":["../../src/evalops/managed-context.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,gBAAgB,EAGrB,MAAM,qBAAqB,CAAC;AAE7B,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAE9C,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,gBAAgB,CAAC;AACjE,MAAM,MAAM,+BAA+B,GAAG,SAAS,GAAG,MAAM,CAAC;AACjE,MAAM,MAAM,4BAA4B,GAAG,SAAS,GAAG,OAAO,CAAC;AAE/D,MAAM,WAAW,qBAAqB;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAA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: recordValue(agentMcp, "agentId"),
|
|
52
52
|
apiKey: recordValue(agentMcp, "apiKey"),
|
|
53
53
|
endpoint: recordValue(agentMcp, "endpoint"),
|
|
54
|
+
integrationProfile: recordValue(agentMcp, "integrationProfile"),
|
|
54
55
|
keyPrefix: recordValue(agentMcp, "keyPrefix"),
|
|
56
|
+
memoryMode: recordValue(agentMcp, "memoryMode"),
|
|
55
57
|
runId: recordValue(agentMcp, "runId"),
|
|
58
|
+
runtimeOwner: recordValue(agentMcp, "runtimeOwner"),
|
|
56
59
|
sessionExpiresAt: recordValue(agentMcp, "sessionExpiresAt"),
|
|
60
|
+
shimType: recordValue(agentMcp, "shimType"),
|
|
61
|
+
traceMode: recordValue(agentMcp, "traceMode"),
|
|
57
62
|
workspaceId: recordValue(agentMcp, "workspaceId"),
|
|
58
63
|
};
|
|
59
64
|
}
|
|
@@ -124,15 +129,20 @@ export function resolveManagedEvalOpsContext(env = process.env, loadCredentials)
|
|
|
124
129
|
evidencePublisher: managed ? "EvalOps" : "none",
|
|
125
130
|
expiresAt: credentials?.expires,
|
|
126
131
|
inference: managed ? "managed" : "local",
|
|
132
|
+
integrationProfile: agentMcp?.integrationProfile,
|
|
127
133
|
keyPrefix: agentMcp?.keyPrefix,
|
|
128
134
|
managed,
|
|
135
|
+
memoryMode: agentMcp?.memoryMode,
|
|
129
136
|
mode,
|
|
130
137
|
organizationId,
|
|
131
138
|
providerRef,
|
|
132
139
|
runId,
|
|
140
|
+
runtimeOwner: agentMcp?.runtimeOwner,
|
|
133
141
|
sessionExpiresAt: agentMcp?.sessionExpiresAt,
|
|
134
142
|
sessionId: readEnv(env, ["MAESTRO_SESSION_ID"]),
|
|
143
|
+
shimType: agentMcp?.shimType,
|
|
135
144
|
traceIngestion: managed && runId ? "live" : "not configured",
|
|
145
|
+
traceMode: agentMcp?.traceMode,
|
|
136
146
|
userEmail: nonEmptyString(metadata?.email),
|
|
137
147
|
userId: readEnv(env, USER_ENV) ?? nonEmptyString(metadata?.userId),
|
|
138
148
|
workspaceId,
|
|
@@ -160,6 +170,15 @@ export function formatManagedEvalOpsStatus(context, options = {}) {
|
|
|
160
170
|
lines.push(`${dim("Agent")}: ${context.agentId}`);
|
|
161
171
|
if (context.runId)
|
|
162
172
|
lines.push(`${dim("Run")}: ${context.runId}`);
|
|
173
|
+
if (context.integrationProfile) {
|
|
174
|
+
lines.push(`${dim("Integration profile")}: ${context.integrationProfile}`);
|
|
175
|
+
}
|
|
176
|
+
if (context.shimType)
|
|
177
|
+
lines.push(`${dim("Shim")}: ${context.shimType}`);
|
|
178
|
+
if (context.traceMode)
|
|
179
|
+
lines.push(`${dim("Trace mode")}: ${context.traceMode}`);
|
|
180
|
+
if (context.memoryMode)
|
|
181
|
+
lines.push(`${dim("Memory mode")}: ${context.memoryMode}`);
|
|
163
182
|
lines.push(`${good("Trace ingestion")}: ${context.traceIngestion}`);
|
|
164
183
|
lines.push(`${good("Evidence publisher")}: ${context.evidencePublisher}`);
|
|
165
184
|
lines.push(`${good("Inference")}: ${context.inference}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"managed-context.js","sourceRoot":"","sources":["../../src/evalops/managed-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEN,uBAAuB,EACvB,oBAAoB,GACpB,MAAM,qBAAqB,CAAC;AA2C7B,MAAM,2BAA2B,GAAG,MAAM,CAAC;AAC3C,IAAI,sBAMQ,CAAC;AAEb,MAAM,OAAO,GAAG;IACf,wBAAwB;IACxB,yBAAyB;IACzB,gBAAgB;IAChB,2BAA2B;IAC3B,4BAA4B;IAC5B,8BAA8B;CACrB,CAAC;AAEX,MAAM,aAAa,GAAG;IACrB,8BAA8B;IAC9B,sBAAsB;IACtB,oCAAoC;IACpC,sBAAsB;CACb,CAAC;AAEX,MAAM,QAAQ,GAAG;IAChB,yBAAyB;IACzB,iBAAiB;IACjB,iBAAiB;CACR,CAAC;AAEX,MAAM,SAAS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AAI,CAAC,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,CAAC;QACjD,KAAK,CAAC,IAAI,CACT,GAAG,GAAG,CAAC,cAAc,CAAC,iBAAiB,OAAO,UAAU,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAClF,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC","sourcesContent":["import chalk from \"chalk\";\nimport {\n\ttype OAuthCredentials,\n\tgetOAuthStorageRevision,\n\tloadOAuthCredentials,\n} from \"../oauth/storage.js\";\n\ntype Env = Record<string, string | undefined>;\n\nexport type EvalOpsManagedTraceState = \"live\" | \"not configured\";\nexport type EvalOpsManagedEvidencePublisher = \"EvalOps\" | \"none\";\nexport type EvalOpsManagedInferenceState = \"managed\" | \"local\";\n\nexport interface EvalOpsManagedContext {\n\taccessToken?: string;\n\tagentId?: string;\n\tauthenticated: boolean;\n\tcontrolPlaneEnvironment?: string;\n\tcontrolPlaneUrl?: string;\n\tevidencePublisher: EvalOpsManagedEvidencePublisher;\n\texpiresAt?: number;\n\tinference: EvalOpsManagedInferenceState;\n\tkeyPrefix?: string;\n\tmanaged: boolean;\n\tmode: \"EvalOps managed\" | \"EvalOps authenticated\" | \"local\";\n\torganizationId?: string;\n\tproviderRef?: Record<string, unknown>;\n\trunId?: string;\n\tsessionExpiresAt?: string;\n\tsessionId?: string;\n\ttraceIngestion: EvalOpsManagedTraceState;\n\tuserEmail?: string;\n\tuserId?: string;\n\tworkspaceId?: string;\n}\n\ninterface StoredAgentMcpMetadata {\n\tagentId?: string;\n\tapiKey?: string;\n\tendpoint?: string;\n\tkeyPrefix?: string;\n\trunId?: string;\n\tsessionExpiresAt?: string;\n\tworkspaceId?: string;\n}\n\nexport type LoadEvalOpsCredentials = () => OAuthCredentials | null;\n\nconst PROCESS_CREDENTIAL_CACHE_MS = 30_000;\nlet processCredentialCache:\n\t| {\n\t\t\tcredentials: OAuthCredentials | null;\n\t\t\texpiresAt: number;\n\t\t\trevision: number;\n\t }\n\t| undefined;\n\nconst ORG_ENV = [\n\t\"MAESTRO_EVALOPS_ORG_ID\",\n\t\"EVALOPS_ORGANIZATION_ID\",\n\t\"EVALOPS_ORG_ID\",\n\t\"MAESTRO_ENTERPRISE_ORG_ID\",\n\t\"MAESTRO_LLM_GATEWAY_ORG_ID\",\n\t\"MAESTRO_REMOTE_RUNNER_ORG_ID\",\n] as const;\n\nconst WORKSPACE_ENV = [\n\t\"MAESTRO_EVALOPS_WORKSPACE_ID\",\n\t\"EVALOPS_WORKSPACE_ID\",\n\t\"MAESTRO_REMOTE_RUNNER_WORKSPACE_ID\",\n\t\"MAESTRO_WORKSPACE_ID\",\n] as const;\n\nconst USER_ENV = [\n\t\"MAESTRO_EVALOPS_USER_ID\",\n\t\"EVALOPS_USER_ID\",\n\t\"MAESTRO_USER_ID\",\n] as const;\n\nconst TOKEN_ENV = [\"MAESTRO_EVALOPS_ACCESS_TOKEN\", \"EVALOPS_TOKEN\"] as const;\n\nfunction nonEmptyString(value: unknown): string | undefined {\n\treturn typeof value === \"string\" && value.trim().length > 0\n\t\t? value.trim()\n\t\t: undefined;\n}\n\nfunction readEnv(env: Env, names: readonly string[]): string | undefined {\n\tfor (const name of names) {\n\t\tconst value = nonEmptyString(env[name]);\n\t\tif (value) return value;\n\t}\n\treturn undefined;\n}\n\nfunction recordValue(\n\trecord: Record<string, unknown> | undefined,\n\tkey: string,\n): string | undefined {\n\treturn nonEmptyString(record?.[key]);\n}\n\nfunction asRecord(value: unknown): Record<string, unknown> | undefined {\n\treturn value && typeof value === \"object\" && !Array.isArray(value)\n\t\t? (value as Record<string, unknown>)\n\t\t: undefined;\n}\n\nfunction storedAgentMcp(\n\tcredentials: OAuthCredentials | null,\n): StoredAgentMcpMetadata | undefined {\n\tconst agentMcp = asRecord(credentials?.metadata?.agentMcp);\n\tif (!agentMcp) return undefined;\n\treturn {\n\t\tagentId: recordValue(agentMcp, \"agentId\"),\n\t\tapiKey: recordValue(agentMcp, \"apiKey\"),\n\t\tendpoint: recordValue(agentMcp, \"endpoint\"),\n\t\tkeyPrefix: recordValue(agentMcp, \"keyPrefix\"),\n\t\trunId: recordValue(agentMcp, \"runId\"),\n\t\tsessionExpiresAt: recordValue(agentMcp, \"sessionExpiresAt\"),\n\t\tworkspaceId: recordValue(agentMcp, \"workspaceId\"),\n\t};\n}\n\nfunction controlPlaneEnvironment(\n\tendpoint: string | undefined,\n): string | undefined {\n\tif (!endpoint) return undefined;\n\ttry {\n\t\tconst parsed = new URL(endpoint);\n\t\tif (parsed.hostname === \"app.evalops.dev\") return \"production\";\n\t\tif (parsed.hostname === \"staging.evalops.dev\") return \"staging\";\n\t\treturn parsed.hostname;\n\t} catch {\n\t\treturn endpoint;\n\t}\n}\n\nfunction safeLoadCredentials(loadCredentials: LoadEvalOpsCredentials) {\n\ttry {\n\t\treturn loadCredentials();\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction loadProcessEvalOpsCredentialsCached(): OAuthCredentials | null {\n\tconst now = Date.now();\n\tconst revision = getOAuthStorageRevision();\n\tif (\n\t\tprocessCredentialCache &&\n\t\tprocessCredentialCache.revision === revision &&\n\t\tprocessCredentialCache.expiresAt > now\n\t) {\n\t\treturn processCredentialCache.credentials;\n\t}\n\tconst credentials = loadOAuthCredentials(\"evalops\");\n\tprocessCredentialCache = {\n\t\tcredentials,\n\t\texpiresAt: now + PROCESS_CREDENTIAL_CACHE_MS,\n\t\trevision,\n\t};\n\treturn credentials;\n}\n\nexport function resolveManagedEvalOpsContext(\n\tenv: Env = process.env,\n\tloadCredentials?: LoadEvalOpsCredentials,\n): EvalOpsManagedContext {\n\tconst credentials = safeLoadCredentials(\n\t\tloadCredentials ??\n\t\t\t(env === process.env ? loadProcessEvalOpsCredentialsCached : () => null),\n\t);\n\tconst metadata = credentials?.metadata;\n\tconst providerRef = asRecord(metadata?.providerRef);\n\tconst agentMcp = storedAgentMcp(credentials);\n\tconst accessToken =\n\t\treadEnv(env, TOKEN_ENV) ?? nonEmptyString(credentials?.access);\n\tconst organizationId =\n\t\treadEnv(env, ORG_ENV) ?? nonEmptyString(metadata?.organizationId);\n\tconst workspaceId =\n\t\treadEnv(env, WORKSPACE_ENV) ?? agentMcp?.workspaceId ?? organizationId;\n\tconst agentId = readEnv(env, [\"MAESTRO_AGENT_ID\"]) ?? agentMcp?.agentId;\n\tconst runId = readEnv(env, [\"MAESTRO_AGENT_RUN_ID\"]) ?? agentMcp?.runId;\n\tconst authenticated = Boolean(accessToken || credentials);\n\tconst managedAgentSession = Boolean(\n\t\tagentMcp?.apiKey || (readEnv(env, TOKEN_ENV) && (agentId || runId)),\n\t);\n\tconst managed = Boolean(organizationId && managedAgentSession);\n\tconst mode = managed\n\t\t? \"EvalOps managed\"\n\t\t: authenticated\n\t\t\t? \"EvalOps authenticated\"\n\t\t\t: \"local\";\n\n\treturn {\n\t\taccessToken,\n\t\tagentId,\n\t\tauthenticated,\n\t\tcontrolPlaneEnvironment: controlPlaneEnvironment(agentMcp?.endpoint),\n\t\tcontrolPlaneUrl: agentMcp?.endpoint,\n\t\tevidencePublisher: managed ? \"EvalOps\" : \"none\",\n\t\texpiresAt: credentials?.expires,\n\t\tinference: managed ? \"managed\" : \"local\",\n\t\tkeyPrefix: agentMcp?.keyPrefix,\n\t\tmanaged,\n\t\tmode,\n\t\torganizationId,\n\t\tproviderRef,\n\t\trunId,\n\t\tsessionExpiresAt: agentMcp?.sessionExpiresAt,\n\t\tsessionId: readEnv(env, [\"MAESTRO_SESSION_ID\"]),\n\t\ttraceIngestion: managed && runId ? \"live\" : \"not configured\",\n\t\tuserEmail: nonEmptyString(metadata?.email),\n\t\tuserId: readEnv(env, USER_ENV) ?? nonEmptyString(metadata?.userId),\n\t\tworkspaceId,\n\t};\n}\n\nexport function formatManagedEvalOpsStatus(\n\tcontext: EvalOpsManagedContext,\n\toptions: { color?: boolean } = {},\n): string {\n\tconst color = options.color ?? true;\n\tconst good = (value: string) => (color ? chalk.green(value) : value);\n\tconst dim = (value: string) => (color ? chalk.dim(value) : value);\n\tconst lines = [\n\t\t`${good(\"Mode\")}: ${context.mode}`,\n\t\t`${good(\"Control plane\")}: ${context.controlPlaneEnvironment ?? \"not configured\"}`,\n\t];\n\tif (context.controlPlaneUrl) {\n\t\tlines.push(`${dim(\"Control plane URL\")}: ${context.controlPlaneUrl}`);\n\t}\n\tif (context.userEmail)\n\t\tlines.push(`${dim(\"Authenticated as\")}: ${context.userEmail}`);\n\tif (context.organizationId)\n\t\tlines.push(`${dim(\"Organization\")}: ${context.organizationId}`);\n\tif (context.workspaceId)\n\t\tlines.push(`${dim(\"Workspace\")}: ${context.workspaceId}`);\n\tlines.push(\n\t\t`${good(\"Agent runtime\")}: ${context.agentId ? \"registered\" : \"not registered\"}`,\n\t);\n\tif (context.agentId) lines.push(`${dim(\"Agent\")}: ${context.agentId}`);\n\tif (context.runId) lines.push(`${dim(\"Run\")}: ${context.runId}`);\n\tlines.push(`${good(\"Trace ingestion\")}: ${context.traceIngestion}`);\n\tlines.push(`${good(\"Evidence publisher\")}: ${context.evidencePublisher}`);\n\tlines.push(`${good(\"Inference\")}: ${context.inference}`);\n\tif (context.providerRef) {\n\t\tconst provider = nonEmptyString(context.providerRef.provider) ?? \"openai\";\n\t\tconst environment =\n\t\t\tnonEmptyString(context.providerRef.environment) ?? \"prod\";\n\t\tlines.push(`${dim(\"Provider ref\")}: ${provider}/${environment}`);\n\t}\n\tif (context.keyPrefix) lines.push(`${dim(\"API key\")}: ${context.keyPrefix}`);\n\tif (context.sessionExpiresAt) {\n\t\tlines.push(`${dim(\"Agent session expires\")}: ${context.sessionExpiresAt}`);\n\t}\n\tif (context.expiresAt) {\n\t\tconst remainingMs = Math.max(0, context.expiresAt - Date.now());\n\t\tconst minutes = Math.round(remainingMs / 60_000);\n\t\tlines.push(\n\t\t\t`${dim(\"Access token\")}: expires in ~${minutes} minute${minutes === 1 ? \"\" : \"s\"}`,\n\t\t);\n\t}\n\treturn lines.join(\"\\n\");\n}\n"]}
|
|
1
|
+
{"version":3,"file":"managed-context.js","sourceRoot":"","sources":["../../src/evalops/managed-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEN,uBAAuB,EACvB,oBAAoB,GACpB,MAAM,qBAAqB,CAAC;AAqD7B,MAAM,2BAA2B,GAAG,MAAM,CAAC;AAC3C,IAAI,sBAMQ,CAAC;AAEb,MAAM,OAAO,GAAG;IACf,wBAAwB;IACxB,yBAAyB;IACzB,gBAAgB;IAChB,2BAA2B;IAC3B,4BAA4B;IAC5B,8BAA8B;CACrB,CAAC;AAEX,MAAM,aAAa,GAAG;IACrB,8BAA8B;IAC9B,sBAAsB;IACtB,oCAAoC;IACpC,sBAAsB;CACb,CAAC;AAEX,MAAM,QAAQ,GAAG;IAChB,yBAAyB;IACzB,iBAAiB;IACjB,iBAAiB;CACR,CAAC;AAEX,MAAM,SAAS,GAAG,CAAC,8BAA8B,EAAE,eAAe,CAAU,CAAC;AAE7E,SAAS,cAAc,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QAC1D,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE;QACd,CAAC,CAAC,SAAS,CAAC;AACd,CAAC;AAED,SAAS,OAAO,CAAC,GAAQ,EAAE,KAAwB;IAClD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QACxC,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC;IACzB,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,SAAS,WAAW,CACnB,MAA2C,EAC3C,GAAW;IAEX,OAAO,cAAc,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,C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,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,KAAK,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAC7E,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,uBAAuB,CAAC,KAAK,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC5E,CAAC;IACD,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACvB,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAChE,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,CAAC;QACjD,KAAK,CAAC,IAAI,CACT,GAAG,GAAG,CAAC,cAAc,CAAC,iBAAiB,OAAO,UAAU,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAClF,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC","sourcesContent":["import chalk from \"chalk\";\nimport {\n\ttype OAuthCredentials,\n\tgetOAuthStorageRevision,\n\tloadOAuthCredentials,\n} from \"../oauth/storage.js\";\n\ntype Env = Record<string, string | undefined>;\n\nexport type EvalOpsManagedTraceState = \"live\" | \"not configured\";\nexport type EvalOpsManagedEvidencePublisher = \"EvalOps\" | \"none\";\nexport type EvalOpsManagedInferenceState = \"managed\" | \"local\";\n\nexport interface EvalOpsManagedContext {\n\taccessToken?: string;\n\tagentId?: string;\n\tauthenticated: boolean;\n\tcontrolPlaneEnvironment?: string;\n\tcontrolPlaneUrl?: string;\n\tevidencePublisher: EvalOpsManagedEvidencePublisher;\n\texpiresAt?: number;\n\tinference: EvalOpsManagedInferenceState;\n\tintegrationProfile?: string;\n\tkeyPrefix?: string;\n\tmanaged: boolean;\n\tmemoryMode?: string;\n\tmode: \"EvalOps managed\" | \"EvalOps authenticated\" | \"local\";\n\torganizationId?: string;\n\tproviderRef?: Record<string, unknown>;\n\trunId?: string;\n\truntimeOwner?: string;\n\tsessionExpiresAt?: string;\n\tsessionId?: string;\n\tshimType?: string;\n\ttraceIngestion: EvalOpsManagedTraceState;\n\ttraceMode?: string;\n\tuserEmail?: string;\n\tuserId?: string;\n\tworkspaceId?: string;\n}\n\ninterface StoredAgentMcpMetadata {\n\tagentId?: string;\n\tapiKey?: string;\n\tendpoint?: string;\n\tintegrationProfile?: string;\n\tkeyPrefix?: string;\n\tmemoryMode?: string;\n\trunId?: string;\n\truntimeOwner?: string;\n\tsessionExpiresAt?: string;\n\tshimType?: string;\n\ttraceMode?: string;\n\tworkspaceId?: string;\n}\n\nexport type LoadEvalOpsCredentials = () => OAuthCredentials | null;\n\nconst PROCESS_CREDENTIAL_CACHE_MS = 30_000;\nlet processCredentialCache:\n\t| {\n\t\t\tcredentials: OAuthCredentials | null;\n\t\t\texpiresAt: number;\n\t\t\trevision: number;\n\t }\n\t| undefined;\n\nconst ORG_ENV = [\n\t\"MAESTRO_EVALOPS_ORG_ID\",\n\t\"EVALOPS_ORGANIZATION_ID\",\n\t\"EVALOPS_ORG_ID\",\n\t\"MAESTRO_ENTERPRISE_ORG_ID\",\n\t\"MAESTRO_LLM_GATEWAY_ORG_ID\",\n\t\"MAESTRO_REMOTE_RUNNER_ORG_ID\",\n] as const;\n\nconst WORKSPACE_ENV = [\n\t\"MAESTRO_EVALOPS_WORKSPACE_ID\",\n\t\"EVALOPS_WORKSPACE_ID\",\n\t\"MAESTRO_REMOTE_RUNNER_WORKSPACE_ID\",\n\t\"MAESTRO_WORKSPACE_ID\",\n] as const;\n\nconst USER_ENV = [\n\t\"MAESTRO_EVALOPS_USER_ID\",\n\t\"EVALOPS_USER_ID\",\n\t\"MAESTRO_USER_ID\",\n] as const;\n\nconst TOKEN_ENV = [\"MAESTRO_EVALOPS_ACCESS_TOKEN\", \"EVALOPS_TOKEN\"] as const;\n\nfunction nonEmptyString(value: unknown): string | undefined {\n\treturn typeof value === \"string\" && value.trim().length > 0\n\t\t? value.trim()\n\t\t: undefined;\n}\n\nfunction readEnv(env: Env, names: readonly string[]): string | undefined {\n\tfor (const name of names) {\n\t\tconst value = nonEmptyString(env[name]);\n\t\tif (value) return value;\n\t}\n\treturn undefined;\n}\n\nfunction recordValue(\n\trecord: Record<string, unknown> | undefined,\n\tkey: string,\n): string | undefined {\n\treturn nonEmptyString(record?.[key]);\n}\n\nfunction asRecord(value: unknown): Record<string, unknown> | undefined {\n\treturn value && typeof value === \"object\" && !Array.isArray(value)\n\t\t? (value as Record<string, unknown>)\n\t\t: undefined;\n}\n\nfunction storedAgentMcp(\n\tcredentials: OAuthCredentials | null,\n): StoredAgentMcpMetadata | undefined {\n\tconst agentMcp = asRecord(credentials?.metadata?.agentMcp);\n\tif (!agentMcp) return undefined;\n\treturn {\n\t\tagentId: recordValue(agentMcp, \"agentId\"),\n\t\tapiKey: recordValue(agentMcp, \"apiKey\"),\n\t\tendpoint: recordValue(agentMcp, \"endpoint\"),\n\t\tintegrationProfile: recordValue(agentMcp, \"integrationProfile\"),\n\t\tkeyPrefix: recordValue(agentMcp, \"keyPrefix\"),\n\t\tmemoryMode: recordValue(agentMcp, \"memoryMode\"),\n\t\trunId: recordValue(agentMcp, \"runId\"),\n\t\truntimeOwner: recordValue(agentMcp, \"runtimeOwner\"),\n\t\tsessionExpiresAt: recordValue(agentMcp, \"sessionExpiresAt\"),\n\t\tshimType: recordValue(agentMcp, \"shimType\"),\n\t\ttraceMode: recordValue(agentMcp, \"traceMode\"),\n\t\tworkspaceId: recordValue(agentMcp, \"workspaceId\"),\n\t};\n}\n\nfunction controlPlaneEnvironment(\n\tendpoint: string | undefined,\n): string | undefined {\n\tif (!endpoint) return undefined;\n\ttry {\n\t\tconst parsed = new URL(endpoint);\n\t\tif (parsed.hostname === \"app.evalops.dev\") return \"production\";\n\t\tif (parsed.hostname === \"staging.evalops.dev\") return \"staging\";\n\t\treturn parsed.hostname;\n\t} catch {\n\t\treturn endpoint;\n\t}\n}\n\nfunction safeLoadCredentials(loadCredentials: LoadEvalOpsCredentials) {\n\ttry {\n\t\treturn loadCredentials();\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction loadProcessEvalOpsCredentialsCached(): OAuthCredentials | null {\n\tconst now = Date.now();\n\tconst revision = getOAuthStorageRevision();\n\tif (\n\t\tprocessCredentialCache &&\n\t\tprocessCredentialCache.revision === revision &&\n\t\tprocessCredentialCache.expiresAt > now\n\t) {\n\t\treturn processCredentialCache.credentials;\n\t}\n\tconst credentials = loadOAuthCredentials(\"evalops\");\n\tprocessCredentialCache = {\n\t\tcredentials,\n\t\texpiresAt: now + PROCESS_CREDENTIAL_CACHE_MS,\n\t\trevision,\n\t};\n\treturn credentials;\n}\n\nexport function resolveManagedEvalOpsContext(\n\tenv: Env = process.env,\n\tloadCredentials?: LoadEvalOpsCredentials,\n): EvalOpsManagedContext {\n\tconst credentials = safeLoadCredentials(\n\t\tloadCredentials ??\n\t\t\t(env === process.env ? loadProcessEvalOpsCredentialsCached : () => null),\n\t);\n\tconst metadata = credentials?.metadata;\n\tconst providerRef = asRecord(metadata?.providerRef);\n\tconst agentMcp = storedAgentMcp(credentials);\n\tconst accessToken =\n\t\treadEnv(env, TOKEN_ENV) ?? nonEmptyString(credentials?.access);\n\tconst organizationId =\n\t\treadEnv(env, ORG_ENV) ?? nonEmptyString(metadata?.organizationId);\n\tconst workspaceId =\n\t\treadEnv(env, WORKSPACE_ENV) ?? agentMcp?.workspaceId ?? organizationId;\n\tconst agentId = readEnv(env, [\"MAESTRO_AGENT_ID\"]) ?? agentMcp?.agentId;\n\tconst runId = readEnv(env, [\"MAESTRO_AGENT_RUN_ID\"]) ?? agentMcp?.runId;\n\tconst authenticated = Boolean(accessToken || credentials);\n\tconst managedAgentSession = Boolean(\n\t\tagentMcp?.apiKey || (readEnv(env, TOKEN_ENV) && (agentId || runId)),\n\t);\n\tconst managed = Boolean(organizationId && managedAgentSession);\n\tconst mode = managed\n\t\t? \"EvalOps managed\"\n\t\t: authenticated\n\t\t\t? \"EvalOps authenticated\"\n\t\t\t: \"local\";\n\n\treturn {\n\t\taccessToken,\n\t\tagentId,\n\t\tauthenticated,\n\t\tcontrolPlaneEnvironment: controlPlaneEnvironment(agentMcp?.endpoint),\n\t\tcontrolPlaneUrl: agentMcp?.endpoint,\n\t\tevidencePublisher: managed ? \"EvalOps\" : \"none\",\n\t\texpiresAt: credentials?.expires,\n\t\tinference: managed ? \"managed\" : \"local\",\n\t\tintegrationProfile: agentMcp?.integrationProfile,\n\t\tkeyPrefix: agentMcp?.keyPrefix,\n\t\tmanaged,\n\t\tmemoryMode: agentMcp?.memoryMode,\n\t\tmode,\n\t\torganizationId,\n\t\tproviderRef,\n\t\trunId,\n\t\truntimeOwner: agentMcp?.runtimeOwner,\n\t\tsessionExpiresAt: agentMcp?.sessionExpiresAt,\n\t\tsessionId: readEnv(env, [\"MAESTRO_SESSION_ID\"]),\n\t\tshimType: agentMcp?.shimType,\n\t\ttraceIngestion: managed && runId ? \"live\" : \"not configured\",\n\t\ttraceMode: agentMcp?.traceMode,\n\t\tuserEmail: nonEmptyString(metadata?.email),\n\t\tuserId: readEnv(env, USER_ENV) ?? nonEmptyString(metadata?.userId),\n\t\tworkspaceId,\n\t};\n}\n\nexport function formatManagedEvalOpsStatus(\n\tcontext: EvalOpsManagedContext,\n\toptions: { color?: boolean } = {},\n): string {\n\tconst color = options.color ?? true;\n\tconst good = (value: string) => (color ? chalk.green(value) : value);\n\tconst dim = (value: string) => (color ? chalk.dim(value) : value);\n\tconst lines = [\n\t\t`${good(\"Mode\")}: ${context.mode}`,\n\t\t`${good(\"Control plane\")}: ${context.controlPlaneEnvironment ?? \"not configured\"}`,\n\t];\n\tif (context.controlPlaneUrl) {\n\t\tlines.push(`${dim(\"Control plane URL\")}: ${context.controlPlaneUrl}`);\n\t}\n\tif (context.userEmail)\n\t\tlines.push(`${dim(\"Authenticated as\")}: ${context.userEmail}`);\n\tif (context.organizationId)\n\t\tlines.push(`${dim(\"Organization\")}: ${context.organizationId}`);\n\tif (context.workspaceId)\n\t\tlines.push(`${dim(\"Workspace\")}: ${context.workspaceId}`);\n\tlines.push(\n\t\t`${good(\"Agent runtime\")}: ${context.agentId ? \"registered\" : \"not registered\"}`,\n\t);\n\tif (context.agentId) lines.push(`${dim(\"Agent\")}: ${context.agentId}`);\n\tif (context.runId) lines.push(`${dim(\"Run\")}: ${context.runId}`);\n\tif (context.integrationProfile) {\n\t\tlines.push(`${dim(\"Integration profile\")}: ${context.integrationProfile}`);\n\t}\n\tif (context.shimType) lines.push(`${dim(\"Shim\")}: ${context.shimType}`);\n\tif (context.traceMode)\n\t\tlines.push(`${dim(\"Trace mode\")}: ${context.traceMode}`);\n\tif (context.memoryMode)\n\t\tlines.push(`${dim(\"Memory mode\")}: ${context.memoryMode}`);\n\tlines.push(`${good(\"Trace ingestion\")}: ${context.traceIngestion}`);\n\tlines.push(`${good(\"Evidence publisher\")}: ${context.evidencePublisher}`);\n\tlines.push(`${good(\"Inference\")}: ${context.inference}`);\n\tif (context.providerRef) {\n\t\tconst provider = nonEmptyString(context.providerRef.provider) ?? \"openai\";\n\t\tconst environment =\n\t\t\tnonEmptyString(context.providerRef.environment) ?? \"prod\";\n\t\tlines.push(`${dim(\"Provider ref\")}: ${provider}/${environment}`);\n\t}\n\tif (context.keyPrefix) lines.push(`${dim(\"API key\")}: ${context.keyPrefix}`);\n\tif (context.sessionExpiresAt) {\n\t\tlines.push(`${dim(\"Agent session expires\")}: ${context.sessionExpiresAt}`);\n\t}\n\tif (context.expiresAt) {\n\t\tconst remainingMs = Math.max(0, context.expiresAt - Date.now());\n\t\tconst minutes = Math.round(remainingMs / 60_000);\n\t\tlines.push(\n\t\t\t`${dim(\"Access token\")}: expires in ~${minutes} minute${minutes === 1 ? \"\" : \"s\"}`,\n\t\t);\n\t}\n\treturn lines.join(\"\\n\");\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-plugin.d.ts","sourceRoot":"","sources":["../../src/mcp/platform-plugin.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"platform-plugin.d.ts","sourceRoot":"","sources":["../../src/mcp/platform-plugin.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAwHlD,wBAAgB,2BAA2B,IAAI,eAAe,EAAE,CAqB/D"}
|
|
@@ -65,9 +65,14 @@ function buildPlatformMcpHeaders() {
|
|
|
65
65
|
"X-EvalOps-Session-Id": getEnvValue(["MAESTRO_SESSION_ID"]),
|
|
66
66
|
"X-EvalOps-Agent-Id": getEnvValue(PLATFORM_MCP_AGENT_ID_ENV_VARS) ?? stored?.agentId,
|
|
67
67
|
"X-EvalOps-Agent-Run-Id": getEnvValue(["MAESTRO_AGENT_RUN_ID"]) ?? stored?.runId,
|
|
68
|
+
"X-EvalOps-Integration-Profile": stored?.integrationProfile,
|
|
69
|
+
"X-EvalOps-Memory-Mode": stored?.memoryMode,
|
|
70
|
+
"X-EvalOps-Runtime-Owner": stored?.runtimeOwner,
|
|
68
71
|
"X-EvalOps-Scopes": getEnvValue(PLATFORM_MCP_SCOPES_ENV_VARS),
|
|
72
|
+
"X-EvalOps-Shim-Type": stored?.shimType,
|
|
69
73
|
"X-EvalOps-Request-Id": getEnvValue(["MAESTRO_REQUEST_ID"]),
|
|
70
74
|
"X-EvalOps-Trace-Id": getEnvValue(["TRACE_ID", "OTEL_TRACE_ID"]),
|
|
75
|
+
"X-EvalOps-Trace-Mode": stored?.traceMode,
|
|
71
76
|
"X-EvalOps-Maestro-Surface": getEnvValue(["MAESTRO_SURFACE"]) ?? "maestro",
|
|
72
77
|
}).filter((entry) => typeof entry[1] === "string" && entry[1].trim().length > 0));
|
|
73
78
|
return Object.keys(headers).length > 0 ? headers : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-plugin.js","sourceRoot":"","sources":["../../src/mcp/platform-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EACN,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,GAClB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AAC1E,MAAM,6BAA6B,GAAG;IACrC,8BAA8B;IAC9B,2BAA2B;CAClB,CAAC;AACX,MAAM,0BAA0B,GAAG;IAClC,2BAA2B;IAC3B,wBAAwB;CACf,CAAC;AACX,MAAM,yBAAyB,GAAG;IACjC,0BAA0B;IAC1B,uBAAuB;IACvB,+BAA+B;CACtB,CAAC;AACX,MAAM,kCAAkC,GAAG;IAC1C,mCAAmC;IACnC,gCAAgC;IAChC,wCAAwC;CAC/B,CAAC;AACX,MAAM,2BAA2B,GAAG;IACnC,4BAA4B;IAC5B,yBAAyB;IACzB,8BAA8B;IAC9B,eAAe;CACN,CAAC;AACX,MAAM,+BAA+B,GAAG;IACvC,sBAAsB;IACtB,8BAA8B;IAC9B,wBAAwB;IACxB,yBAAyB;IACzB,2BAA2B;CAClB,CAAC;AACX,MAAM,8BAA8B,GAAG;IACtC,kBAAkB;IAClB,0BAA0B;CACjB,CAAC;AACX,MAAM,4BAA4B,GAAG;IACpC,6BAA6B;IAC7B,0BAA0B;IAC1B,kCAAkC;IAClC,4BAA4B;CACnB,CAAC;AACX,MAAM,gCAAgC,GAAG,SAAS,CAAC;AACnD,MAAM,uBAAuB,GAAG,qCAAqC,CAAC;AACtE,MAAM,cAAc,GAAG,MAAM,CAAC;AAE9B,SAAS,+BAA+B;IACvC,MAAM,OAA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E,CAAC;QACV,OAAO,EAAE,CAAC;IACX,CAAC;IAED,OAAO;QACN;YACC,IAAI,EACH,WAAW,CAAC,0BAA0B,CAAC;gBACvC,gCAAgC;YACjC,SAAS,EAAE,MAAM;YACjB,GAAG,EAAE,4BAA4B,CAAC,GAAG,CAAC;YACtC,OAAO,EAAE,uBAAuB,EAAE;YAClC,KAAK,EAAE,QAAQ;SACf;KACD,CAAC;AACH,CAAC","sourcesContent":["import { getStoredEvalOpsAgentMcpMetadata } from \"../evalops/agent-bootstrap.js\";\nimport {\n\tgetEnvValue,\n\tnormalizeBaseUrl,\n\tresolveConfiguredToken,\n\tresolveWorkspaceId,\n} from \"../platform/client.js\";\nimport type { McpServerConfig } from \"./types.js\";\n\nconst PLATFORM_MCP_DISABLED_VALUES = new Set([\"0\", \"false\", \"no\", \"off\"]);\nconst PLATFORM_MCP_ENABLED_ENV_VARS = [\n\t\"MAESTRO_PLATFORM_MCP_ENABLED\",\n\t\"MAESTRO_AGENT_MCP_ENABLED\",\n] as const;\nconst PLATFORM_MCP_NAME_ENV_VARS = [\n\t\"MAESTRO_PLATFORM_MCP_NAME\",\n\t\"MAESTRO_AGENT_MCP_NAME\",\n] as const;\nconst PLATFORM_MCP_URL_ENV_VARS = [\n\t\"MAESTRO_PLATFORM_MCP_URL\",\n\t\"MAESTRO_AGENT_MCP_URL\",\n\t\"MAESTRO_EVALOPS_AGENT_MCP_URL\",\n] as const;\nconst PLATFORM_MCP_MANIFEST_URL_ENV_VARS = [\n\t\"MAESTRO_PLATFORM_MCP_MANIFEST_URL\",\n\t\"MAESTRO_AGENT_MCP_MANIFEST_URL\",\n\t\"MAESTRO_EVALOPS_AGENT_MCP_MANIFEST_URL\",\n] as const;\nconst PLATFORM_MCP_TOKEN_ENV_VARS = [\n\t\"MAESTRO_PLATFORM_MCP_TOKEN\",\n\t\"MAESTRO_AGENT_MCP_TOKEN\",\n\t\"MAESTRO_EVALOPS_ACCESS_TOKEN\",\n\t\"EVALOPS_TOKEN\",\n] as const;\nconst PLATFORM_MCP_WORKSPACE_ENV_VARS = [\n\t\"MAESTRO_WORKSPACE_ID\",\n\t\"MAESTRO_EVALOPS_WORKSPACE_ID\",\n\t\"MAESTRO_EVALOPS_ORG_ID\",\n\t\"EVALOPS_ORGANIZATION_ID\",\n\t\"MAESTRO_ENTERPRISE_ORG_ID\",\n] as const;\nconst PLATFORM_MCP_AGENT_ID_ENV_VARS = [\n\t\"MAESTRO_AGENT_ID\",\n\t\"MAESTRO_EVALOPS_AGENT_ID\",\n] as const;\nconst PLATFORM_MCP_SCOPES_ENV_VARS = [\n\t\"MAESTRO_PLATFORM_MCP_SCOPES\",\n\t\"MAESTRO_AGENT_MCP_SCOPES\",\n\t\"MAESTRO_EVALOPS_AGENT_MCP_SCOPES\",\n\t\"MAESTRO_CEREBRO_MCP_SCOPES\",\n] as const;\nconst DEFAULT_PLATFORM_MCP_SERVER_NAME = \"evalops\";\nconst AGENT_MCP_MANIFEST_PATH = \"/.well-known/evalops/agent-mcp.json\";\nconst AGENT_MCP_PATH = \"/mcp\";\n\nfunction isPlatformMcpExplicitlyDisabled(): boolean {\n\tconst enabled = getEnvValue(PLATFORM_MCP_ENABLED_ENV_VARS);\n\tif (!enabled) {\n\t\treturn false;\n\t}\n\treturn PLATFORM_MCP_DISABLED_VALUES.has(enabled.trim().toLowerCase());\n}\n\nfunction buildPlatformMcpHeaders(): Record<string, string> | undefined {\n\tconst stored = getStoredEvalOpsAgentMcpMetadata();\n\tconst token =\n\t\tgetEnvValue(PLATFORM_MCP_TOKEN_ENV_VARS) ??\n\t\tstored?.apiKey ??\n\t\tresolveConfiguredToken(PLATFORM_MCP_TOKEN_ENV_VARS);\n\tconst workspaceId =\n\t\tresolveWorkspaceId(PLATFORM_MCP_WORKSPACE_ENV_VARS) ?? stored?.workspaceId;\n\tconst headers = Object.fromEntries(\n\t\tObject.entries({\n\t\t\t...(token ? { Authorization: `Bearer ${token}` } : {}),\n\t\t\t\"Mcp-Session-Id\": getEnvValue([\"MAESTRO_SESSION_ID\"]),\n\t\t\t\"X-EvalOps-Workspace-Id\": workspaceId,\n\t\t\t\"X-EvalOps-Session-Id\": getEnvValue([\"MAESTRO_SESSION_ID\"]),\n\t\t\t\"X-EvalOps-Agent-Id\":\n\t\t\t\tgetEnvValue(PLATFORM_MCP_AGENT_ID_ENV_VARS) ?? stored?.agentId,\n\t\t\t\"X-EvalOps-Agent-Run-Id\":\n\t\t\t\tgetEnvValue([\"MAESTRO_AGENT_RUN_ID\"]) ?? stored?.runId,\n\t\t\t\"X-EvalOps-Scopes\": getEnvValue(PLATFORM_MCP_SCOPES_ENV_VARS),\n\t\t\t\"X-EvalOps-Request-Id\": getEnvValue([\"MAESTRO_REQUEST_ID\"]),\n\t\t\t\"X-EvalOps-Trace-Id\": getEnvValue([\"TRACE_ID\", \"OTEL_TRACE_ID\"]),\n\t\t\t\"X-EvalOps-Maestro-Surface\":\n\t\t\t\tgetEnvValue([\"MAESTRO_SURFACE\"]) ?? \"maestro\",\n\t\t}).filter(\n\t\t\t(entry): entry is [string, string] =>\n\t\t\t\ttypeof entry[1] === \"string\" && entry[1].trim().length > 0,\n\t\t),\n\t);\n\treturn Object.keys(headers).length > 0 ? headers : undefined;\n}\n\nfunction normalizePlatformMcpEndpoint(url: string): string {\n\tconst normalized = normalizeBaseUrl(url);\n\ttry {\n\t\tconst parsed = new URL(normalized);\n\t\tif (\n\t\t\tparsed.pathname === \"\" ||\n\t\t\tparsed.pathname === \"/\" ||\n\t\t\tparsed.pathname === AGENT_MCP_MANIFEST_PATH\n\t\t) {\n\t\t\tparsed.pathname = AGENT_MCP_PATH;\n\t\t\tparsed.search = \"\";\n\t\t\tparsed.hash = \"\";\n\t\t\treturn normalizeBaseUrl(parsed.toString());\n\t\t}\n\t} catch {\n\t\t// Keep the existing permissive behavior for non-standard local test URLs.\n\t}\n\treturn normalized;\n}\n\nfunction resolvePlatformMcpURL(): string | undefined {\n\treturn (\n\t\tgetEnvValue(PLATFORM_MCP_URL_ENV_VARS) ??\n\t\tgetEnvValue(PLATFORM_MCP_MANIFEST_URL_ENV_VARS) ??\n\t\tgetStoredEvalOpsAgentMcpMetadata()?.endpoint\n\t);\n}\n\nexport function getPlatformMcpPluginServers(): McpServerConfig[] {\n\tif (isPlatformMcpExplicitlyDisabled()) {\n\t\treturn [];\n\t}\n\n\tconst url = resolvePlatformMcpURL();\n\tif (!url) {\n\t\treturn [];\n\t}\n\n\treturn [\n\t\t{\n\t\t\tname:\n\t\t\t\tgetEnvValue(PLATFORM_MCP_NAME_ENV_VARS) ??\n\t\t\t\tDEFAULT_PLATFORM_MCP_SERVER_NAME,\n\t\t\ttransport: \"http\",\n\t\t\turl: normalizePlatformMcpEndpoint(url),\n\t\t\theaders: buildPlatformMcpHeaders(),\n\t\t\tscope: \"plugin\",\n\t\t},\n\t];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"platform-plugin.js","sourceRoot":"","sources":["../../src/mcp/platform-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EACN,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,GAClB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AAC1E,MAAM,6BAA6B,GAAG;IACrC,8BAA8B;IAC9B,2BAA2B;CAClB,CAAC;AACX,MAAM,0BAA0B,GAAG;IAClC,2BAA2B;IAC3B,wBAAwB;CACf,CAAC;AACX,MAAM,yBAAyB,GAAG;IACjC,0BAA0B;IAC1B,uBAAuB;IACvB,+BAA+B;CACtB,CAAC;AACX,MAAM,kCAAkC,GAAG;IAC1C,mCAAmC;IACnC,gCAAgC;IAChC,wCAAwC;CAC/B,CAAC;AACX,MAAM,2BAA2B,GAAG;IACnC,4BAA4B;IAC5B,yBAAyB;IACzB,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AC,QAAQ,KAAK,uBAAuB,EAC1C,CAAC;YACF,MAAM,CAAC,QAAQ,GAAG,cAAc,CAAC;YACjC,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC;YACnB,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC;YACjB,OAAO,gBAAgB,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC5C,CAAC;IACF,CAAC;IAAC,MAAM,CAAC;QACR,0EAA0E;IAC3E,CAAC;IACD,OAAO,UAAU,CAAC;AACnB,CAAC;AAED,SAAS,qBAAqB;IAC7B,OAAO,CACN,WAAW,CAAC,yBAAyB,CAAC;QACtC,WAAW,CAAC,kCAAkC,CAAC;QAC/C,gCAAgC,EAAE,EAAE,QAAQ,CAC5C,CAAC;AACH,CAAC;AAED,MAAM,UAAU,2BAA2B;IAC1C,IAAI,+BAA+B,EAAE,EAAE,CAAC;QACvC,OAAO,EAAE,CAAC;IACX,CAAC;IAED,MAAM,GAAG,GAAG,qBAAqB,EAAE,CAAC;IACpC,IAAI,CAAC,GAAG,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;IACX,CAAC;IAED,OAAO;QACN;YACC,IAAI,EACH,WAAW,CAAC,0BAA0B,CAAC;gBACvC,gCAAgC;YACjC,SAAS,EAAE,MAAM;YACjB,GAAG,EAAE,4BAA4B,CAAC,GAAG,CAAC;YACtC,OAAO,EAAE,uBAAuB,EAAE;YAClC,KAAK,EAAE,QAAQ;SACf;KACD,CAAC;AACH,CAAC","sourcesContent":["import { getStoredEvalOpsAgentMcpMetadata } from \"../evalops/agent-bootstrap.js\";\nimport {\n\tgetEnvValue,\n\tnormalizeBaseUrl,\n\tresolveConfiguredToken,\n\tresolveWorkspaceId,\n} from \"../platform/client.js\";\nimport type { McpServerConfig } from \"./types.js\";\n\nconst PLATFORM_MCP_DISABLED_VALUES = new Set([\"0\", \"false\", \"no\", \"off\"]);\nconst PLATFORM_MCP_ENABLED_ENV_VARS = [\n\t\"MAESTRO_PLATFORM_MCP_ENABLED\",\n\t\"MAESTRO_AGENT_MCP_ENABLED\",\n] as const;\nconst PLATFORM_MCP_NAME_ENV_VARS = [\n\t\"MAESTRO_PLATFORM_MCP_NAME\",\n\t\"MAESTRO_AGENT_MCP_NAME\",\n] as const;\nconst PLATFORM_MCP_URL_ENV_VARS = [\n\t\"MAESTRO_PLATFORM_MCP_URL\",\n\t\"MAESTRO_AGENT_MCP_URL\",\n\t\"MAESTRO_EVALOPS_AGENT_MCP_URL\",\n] as const;\nconst PLATFORM_MCP_MANIFEST_URL_ENV_VARS = [\n\t\"MAESTRO_PLATFORM_MCP_MANIFEST_URL\",\n\t\"MAESTRO_AGENT_MCP_MANIFEST_URL\",\n\t\"MAESTRO_EVALOPS_AGENT_MCP_MANIFEST_URL\",\n] as const;\nconst PLATFORM_MCP_TOKEN_ENV_VARS = [\n\t\"MAESTRO_PLATFORM_MCP_TOKEN\",\n\t\"MAESTRO_AGENT_MCP_TOKEN\",\n\t\"MAESTRO_EVALOPS_ACCESS_TOKEN\",\n\t\"EVALOPS_TOKEN\",\n] as const;\nconst PLATFORM_MCP_WORKSPACE_ENV_VARS = [\n\t\"MAESTRO_WORKSPACE_ID\",\n\t\"MAESTRO_EVALOPS_WORKSPACE_ID\",\n\t\"MAESTRO_EVALOPS_ORG_ID\",\n\t\"EVALOPS_ORGANIZATION_ID\",\n\t\"MAESTRO_ENTERPRISE_ORG_ID\",\n] as const;\nconst PLATFORM_MCP_AGENT_ID_ENV_VARS = [\n\t\"MAESTRO_AGENT_ID\",\n\t\"MAESTRO_EVALOPS_AGENT_ID\",\n] as const;\nconst PLATFORM_MCP_SCOPES_ENV_VARS = [\n\t\"MAESTRO_PLATFORM_MCP_SCOPES\",\n\t\"MAESTRO_AGENT_MCP_SCOPES\",\n\t\"MAESTRO_EVALOPS_AGENT_MCP_SCOPES\",\n\t\"MAESTRO_CEREBRO_MCP_SCOPES\",\n] as const;\nconst DEFAULT_PLATFORM_MCP_SERVER_NAME = \"evalops\";\nconst AGENT_MCP_MANIFEST_PATH = \"/.well-known/evalops/agent-mcp.json\";\nconst AGENT_MCP_PATH = \"/mcp\";\n\nfunction isPlatformMcpExplicitlyDisabled(): boolean {\n\tconst enabled = getEnvValue(PLATFORM_MCP_ENABLED_ENV_VARS);\n\tif (!enabled) {\n\t\treturn false;\n\t}\n\treturn PLATFORM_MCP_DISABLED_VALUES.has(enabled.trim().toLowerCase());\n}\n\nfunction buildPlatformMcpHeaders(): Record<string, string> | undefined {\n\tconst stored = getStoredEvalOpsAgentMcpMetadata();\n\tconst token =\n\t\tgetEnvValue(PLATFORM_MCP_TOKEN_ENV_VARS) ??\n\t\tstored?.apiKey ??\n\t\tresolveConfiguredToken(PLATFORM_MCP_TOKEN_ENV_VARS);\n\tconst workspaceId =\n\t\tresolveWorkspaceId(PLATFORM_MCP_WORKSPACE_ENV_VARS) ?? stored?.workspaceId;\n\tconst headers = Object.fromEntries(\n\t\tObject.entries({\n\t\t\t...(token ? { Authorization: `Bearer ${token}` } : {}),\n\t\t\t\"Mcp-Session-Id\": getEnvValue([\"MAESTRO_SESSION_ID\"]),\n\t\t\t\"X-EvalOps-Workspace-Id\": workspaceId,\n\t\t\t\"X-EvalOps-Session-Id\": getEnvValue([\"MAESTRO_SESSION_ID\"]),\n\t\t\t\"X-EvalOps-Agent-Id\":\n\t\t\t\tgetEnvValue(PLATFORM_MCP_AGENT_ID_ENV_VARS) ?? stored?.agentId,\n\t\t\t\"X-EvalOps-Agent-Run-Id\":\n\t\t\t\tgetEnvValue([\"MAESTRO_AGENT_RUN_ID\"]) ?? stored?.runId,\n\t\t\t\"X-EvalOps-Integration-Profile\": stored?.integrationProfile,\n\t\t\t\"X-EvalOps-Memory-Mode\": stored?.memoryMode,\n\t\t\t\"X-EvalOps-Runtime-Owner\": stored?.runtimeOwner,\n\t\t\t\"X-EvalOps-Scopes\": getEnvValue(PLATFORM_MCP_SCOPES_ENV_VARS),\n\t\t\t\"X-EvalOps-Shim-Type\": stored?.shimType,\n\t\t\t\"X-EvalOps-Request-Id\": getEnvValue([\"MAESTRO_REQUEST_ID\"]),\n\t\t\t\"X-EvalOps-Trace-Id\": getEnvValue([\"TRACE_ID\", \"OTEL_TRACE_ID\"]),\n\t\t\t\"X-EvalOps-Trace-Mode\": stored?.traceMode,\n\t\t\t\"X-EvalOps-Maestro-Surface\":\n\t\t\t\tgetEnvValue([\"MAESTRO_SURFACE\"]) ?? \"maestro\",\n\t\t}).filter(\n\t\t\t(entry): entry is [string, string] =>\n\t\t\t\ttypeof entry[1] === \"string\" && entry[1].trim().length > 0,\n\t\t),\n\t);\n\treturn Object.keys(headers).length > 0 ? headers : undefined;\n}\n\nfunction normalizePlatformMcpEndpoint(url: string): string {\n\tconst normalized = normalizeBaseUrl(url);\n\ttry {\n\t\tconst parsed = new URL(normalized);\n\t\tif (\n\t\t\tparsed.pathname === \"\" ||\n\t\t\tparsed.pathname === \"/\" ||\n\t\t\tparsed.pathname === AGENT_MCP_MANIFEST_PATH\n\t\t) {\n\t\t\tparsed.pathname = AGENT_MCP_PATH;\n\t\t\tparsed.search = \"\";\n\t\t\tparsed.hash = \"\";\n\t\t\treturn normalizeBaseUrl(parsed.toString());\n\t\t}\n\t} catch {\n\t\t// Keep the existing permissive behavior for non-standard local test URLs.\n\t}\n\treturn normalized;\n}\n\nfunction resolvePlatformMcpURL(): string | undefined {\n\treturn (\n\t\tgetEnvValue(PLATFORM_MCP_URL_ENV_VARS) ??\n\t\tgetEnvValue(PLATFORM_MCP_MANIFEST_URL_ENV_VARS) ??\n\t\tgetStoredEvalOpsAgentMcpMetadata()?.endpoint\n\t);\n}\n\nexport function getPlatformMcpPluginServers(): McpServerConfig[] {\n\tif (isPlatformMcpExplicitlyDisabled()) {\n\t\treturn [];\n\t}\n\n\tconst url = resolvePlatformMcpURL();\n\tif (!url) {\n\t\treturn [];\n\t}\n\n\treturn [\n\t\t{\n\t\t\tname:\n\t\t\t\tgetEnvValue(PLATFORM_MCP_NAME_ENV_VARS) ??\n\t\t\t\tDEFAULT_PLATFORM_MCP_SERVER_NAME,\n\t\t\ttransport: \"http\",\n\t\t\turl: normalizePlatformMcpEndpoint(url),\n\t\t\theaders: buildPlatformMcpHeaders(),\n\t\t\tscope: \"plugin\",\n\t\t},\n\t];\n}\n"]}
|
package/dist/version.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.10.
|
|
3
|
-
"notes": "Maestro by EvalOps - Deterministic coding agent with TUI/CLI and Web UI for AI-assisted development v0.10.
|
|
2
|
+
"version": "0.10.15",
|
|
3
|
+
"notes": "Maestro by EvalOps - Deterministic coding agent with TUI/CLI and Web UI for AI-assisted development v0.10.15 is now available."
|
|
4
4
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evalops/maestro",
|
|
3
3
|
"description": "Maestro by EvalOps - Deterministic coding agent with TUI/CLI and Web UI for AI-assisted development",
|
|
4
|
-
"version": "0.10.
|
|
4
|
+
"version": "0.10.15",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"workspaces": [
|
|
@@ -127,8 +127,8 @@
|
|
|
127
127
|
"@aws-sdk/client-bedrock-runtime": "^3.1020.0",
|
|
128
128
|
"@crosscopy/clipboard": "^0.2.8",
|
|
129
129
|
"@daytonaio/sdk": "^0.155.0",
|
|
130
|
-
"@evalops/contracts": "^0.10.
|
|
131
|
-
"@evalops/tui": "^0.10.
|
|
130
|
+
"@evalops/contracts": "^0.10.15",
|
|
131
|
+
"@evalops/tui": "^0.10.15",
|
|
132
132
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
133
133
|
"@opentelemetry/api": "^1.9.1",
|
|
134
134
|
"@opentelemetry/auto-instrumentations-node": "^0.74.0",
|