@evalops/maestro 0.10.15 → 0.10.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/providers/google-gemini-cli.js +3 -5
- package/dist/agent/providers/google.js +3 -5
- package/dist/agent/providers/vertex.js +3 -5
- package/dist/cli.js +367 -302
- package/dist/evalops/managed-context.d.ts.map +1 -1
- package/dist/evalops/managed-context.js +27 -5
- package/dist/evalops/managed-context.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +31 -10
- package/dist/main.js.map +1 -1
- package/dist/mcp/platform-plugin.d.ts.map +1 -1
- package/dist/mcp/platform-plugin.js +27 -5
- package/dist/mcp/platform-plugin.js.map +1 -1
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +3 -5
- package/dist/utils/logger.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/dist/cli.js
CHANGED
|
@@ -37563,16 +37563,16 @@ import { WebSocketServer } from "ws";
|
|
|
37563
37563
|
import { realpath as realpath3, stat as stat8 } from "node:fs/promises";
|
|
37564
37564
|
import { resolve as resolve58 } from "node:path";
|
|
37565
37565
|
import chalk60 from "chalk";
|
|
37566
|
+
import chalk61 from "chalk";
|
|
37567
|
+
import chalk62 from "chalk";
|
|
37566
37568
|
import { existsSync as existsSync103, mkdirSync as mkdirSync40, readFileSync as readFileSync75, writeFileSync as writeFileSync41 } from "node:fs";
|
|
37567
37569
|
import { join as join82 } from "node:path";
|
|
37568
|
-
import
|
|
37570
|
+
import chalk63 from "chalk";
|
|
37569
37571
|
import { timingSafeEqual as timingSafeEqual7 } from "node:crypto";
|
|
37570
37572
|
import {
|
|
37571
37573
|
createServer as createServer7
|
|
37572
37574
|
} from "node:http";
|
|
37573
37575
|
import { URL as URL2 } from "node:url";
|
|
37574
|
-
import chalk62 from "chalk";
|
|
37575
|
-
import chalk63 from "chalk";
|
|
37576
37576
|
import chalk64 from "chalk";
|
|
37577
37577
|
import chalk65 from "chalk";
|
|
37578
37578
|
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
@@ -38029,11 +38029,9 @@ var Logger = class {
|
|
|
38029
38029
|
}
|
|
38030
38030
|
}
|
|
38031
38031
|
outputJson(entry2) {
|
|
38032
|
-
|
|
38033
|
-
output(JSON.stringify(entry2));
|
|
38032
|
+
console.error(JSON.stringify(entry2));
|
|
38034
38033
|
}
|
|
38035
38034
|
outputPretty(entry2) {
|
|
38036
|
-
const output = entry2.level === "error" ? console.error : console.log;
|
|
38037
38035
|
const parts = [];
|
|
38038
38036
|
if (this.config.timestamps) {
|
|
38039
38037
|
parts.push(`[${entry2.timestamp}]`);
|
|
@@ -38043,9 +38041,9 @@ var Logger = class {
|
|
|
38043
38041
|
if (entry2.context && Object.keys(entry2.context).length > 0) {
|
|
38044
38042
|
parts.push(JSON.stringify(entry2.context));
|
|
38045
38043
|
}
|
|
38046
|
-
|
|
38044
|
+
console.error(parts.join(" "));
|
|
38047
38045
|
if (entry2.error?.stack) {
|
|
38048
|
-
|
|
38046
|
+
console.error(entry2.error.stack);
|
|
38049
38047
|
}
|
|
38050
38048
|
}
|
|
38051
38049
|
debug(message, context2) {
|
|
@@ -38353,20 +38351,20 @@ function resolveManagedEvalOpsContext(env = process.env, loadCredentials) {
|
|
|
38353
38351
|
evidencePublisher: managed ? "EvalOps" : "none",
|
|
38354
38352
|
expiresAt: credentials?.expires,
|
|
38355
38353
|
inference: managed ? "managed" : "local",
|
|
38356
|
-
integrationProfile: agentMcp?.integrationProfile,
|
|
38354
|
+
integrationProfile: readEnv2(env, INTEGRATION_PROFILE_ENV) ?? agentMcp?.integrationProfile,
|
|
38357
38355
|
keyPrefix: agentMcp?.keyPrefix,
|
|
38358
38356
|
managed,
|
|
38359
|
-
memoryMode: agentMcp?.memoryMode,
|
|
38357
|
+
memoryMode: readEnv2(env, MEMORY_MODE_ENV) ?? agentMcp?.memoryMode,
|
|
38360
38358
|
mode,
|
|
38361
38359
|
organizationId,
|
|
38362
38360
|
providerRef,
|
|
38363
38361
|
runId,
|
|
38364
|
-
runtimeOwner: agentMcp?.runtimeOwner,
|
|
38362
|
+
runtimeOwner: readEnv2(env, RUNTIME_OWNER_ENV) ?? agentMcp?.runtimeOwner,
|
|
38365
38363
|
sessionExpiresAt: agentMcp?.sessionExpiresAt,
|
|
38366
38364
|
sessionId: readEnv2(env, ["MAESTRO_SESSION_ID"]),
|
|
38367
|
-
shimType: agentMcp?.shimType,
|
|
38365
|
+
shimType: readEnv2(env, SHIM_TYPE_ENV) ?? agentMcp?.shimType,
|
|
38368
38366
|
traceIngestion: managed && runId ? "live" : "not configured",
|
|
38369
|
-
traceMode: agentMcp?.traceMode,
|
|
38367
|
+
traceMode: readEnv2(env, TRACE_MODE_ENV) ?? agentMcp?.traceMode,
|
|
38370
38368
|
userEmail: nonEmptyString(metadata?.email),
|
|
38371
38369
|
userId: readEnv2(env, USER_ENV) ?? nonEmptyString(metadata?.userId),
|
|
38372
38370
|
workspaceId
|
|
@@ -38397,6 +38395,8 @@ function formatManagedEvalOpsStatus(context2, options = {}) {
|
|
|
38397
38395
|
if (context2.integrationProfile) {
|
|
38398
38396
|
lines.push(`${dim("Integration profile")}: ${context2.integrationProfile}`);
|
|
38399
38397
|
}
|
|
38398
|
+
if (context2.runtimeOwner)
|
|
38399
|
+
lines.push(`${dim("Runtime owner")}: ${context2.runtimeOwner}`);
|
|
38400
38400
|
if (context2.shimType)
|
|
38401
38401
|
lines.push(`${dim("Shim")}: ${context2.shimType}`);
|
|
38402
38402
|
if (context2.traceMode)
|
|
@@ -38430,6 +38430,11 @@ var ORG_ENV;
|
|
|
38430
38430
|
var WORKSPACE_ENV;
|
|
38431
38431
|
var USER_ENV;
|
|
38432
38432
|
var TOKEN_ENV;
|
|
38433
|
+
var INTEGRATION_PROFILE_ENV;
|
|
38434
|
+
var MEMORY_MODE_ENV;
|
|
38435
|
+
var RUNTIME_OWNER_ENV;
|
|
38436
|
+
var SHIM_TYPE_ENV;
|
|
38437
|
+
var TRACE_MODE_ENV;
|
|
38433
38438
|
var init_managed_context = __esm2(() => {
|
|
38434
38439
|
init_storage();
|
|
38435
38440
|
ORG_ENV = [
|
|
@@ -38452,6 +38457,26 @@ var init_managed_context = __esm2(() => {
|
|
|
38452
38457
|
"MAESTRO_USER_ID"
|
|
38453
38458
|
];
|
|
38454
38459
|
TOKEN_ENV = ["MAESTRO_EVALOPS_ACCESS_TOKEN", "EVALOPS_TOKEN"];
|
|
38460
|
+
INTEGRATION_PROFILE_ENV = [
|
|
38461
|
+
"MAESTRO_EVALOPS_INTEGRATION_PROFILE",
|
|
38462
|
+
"MAESTRO_INTEGRATION_PROFILE"
|
|
38463
|
+
];
|
|
38464
|
+
MEMORY_MODE_ENV = [
|
|
38465
|
+
"MAESTRO_EVALOPS_MEMORY_MODE",
|
|
38466
|
+
"MAESTRO_MEMORY_MODE"
|
|
38467
|
+
];
|
|
38468
|
+
RUNTIME_OWNER_ENV = [
|
|
38469
|
+
"MAESTRO_EVALOPS_RUNTIME_OWNER",
|
|
38470
|
+
"MAESTRO_RUNTIME_OWNER"
|
|
38471
|
+
];
|
|
38472
|
+
SHIM_TYPE_ENV = [
|
|
38473
|
+
"MAESTRO_EVALOPS_SHIM_TYPE",
|
|
38474
|
+
"MAESTRO_SHIM_TYPE"
|
|
38475
|
+
];
|
|
38476
|
+
TRACE_MODE_ENV = [
|
|
38477
|
+
"MAESTRO_EVALOPS_TRACE_MODE",
|
|
38478
|
+
"MAESTRO_TRACE_MODE"
|
|
38479
|
+
];
|
|
38455
38480
|
});
|
|
38456
38481
|
function entry(type, category, protoMessage, platformConsumers) {
|
|
38457
38482
|
return {
|
|
@@ -87970,14 +87995,14 @@ function buildPlatformMcpHeaders() {
|
|
|
87970
87995
|
"X-EvalOps-Session-Id": getEnvValue3(["MAESTRO_SESSION_ID"]),
|
|
87971
87996
|
"X-EvalOps-Agent-Id": getEnvValue3(PLATFORM_MCP_AGENT_ID_ENV_VARS) ?? stored?.agentId,
|
|
87972
87997
|
"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,
|
|
87998
|
+
"X-EvalOps-Integration-Profile": getEnvValue3(PLATFORM_MCP_INTEGRATION_PROFILE_ENV_VARS) ?? stored?.integrationProfile,
|
|
87999
|
+
"X-EvalOps-Memory-Mode": getEnvValue3(PLATFORM_MCP_MEMORY_MODE_ENV_VARS) ?? stored?.memoryMode,
|
|
88000
|
+
"X-EvalOps-Runtime-Owner": getEnvValue3(PLATFORM_MCP_RUNTIME_OWNER_ENV_VARS) ?? stored?.runtimeOwner,
|
|
87976
88001
|
"X-EvalOps-Scopes": getEnvValue3(PLATFORM_MCP_SCOPES_ENV_VARS),
|
|
87977
|
-
"X-EvalOps-Shim-Type": stored?.shimType,
|
|
88002
|
+
"X-EvalOps-Shim-Type": getEnvValue3(PLATFORM_MCP_SHIM_TYPE_ENV_VARS) ?? stored?.shimType,
|
|
87978
88003
|
"X-EvalOps-Request-Id": getEnvValue3(["MAESTRO_REQUEST_ID"]),
|
|
87979
88004
|
"X-EvalOps-Trace-Id": getEnvValue3(["TRACE_ID", "OTEL_TRACE_ID"]),
|
|
87980
|
-
"X-EvalOps-Trace-Mode": stored?.traceMode,
|
|
88005
|
+
"X-EvalOps-Trace-Mode": getEnvValue3(PLATFORM_MCP_TRACE_MODE_ENV_VARS) ?? stored?.traceMode,
|
|
87981
88006
|
"X-EvalOps-Maestro-Surface": getEnvValue3(["MAESTRO_SURFACE"]) ?? "maestro"
|
|
87982
88007
|
}).filter((entry2) => typeof entry2[1] === "string" && entry2[1].trim().length > 0));
|
|
87983
88008
|
return Object.keys(headers).length > 0 ? headers : void 0;
|
|
@@ -88026,6 +88051,11 @@ var PLATFORM_MCP_TOKEN_ENV_VARS;
|
|
|
88026
88051
|
var PLATFORM_MCP_WORKSPACE_ENV_VARS;
|
|
88027
88052
|
var PLATFORM_MCP_AGENT_ID_ENV_VARS;
|
|
88028
88053
|
var PLATFORM_MCP_SCOPES_ENV_VARS;
|
|
88054
|
+
var PLATFORM_MCP_INTEGRATION_PROFILE_ENV_VARS;
|
|
88055
|
+
var PLATFORM_MCP_MEMORY_MODE_ENV_VARS;
|
|
88056
|
+
var PLATFORM_MCP_RUNTIME_OWNER_ENV_VARS;
|
|
88057
|
+
var PLATFORM_MCP_SHIM_TYPE_ENV_VARS;
|
|
88058
|
+
var PLATFORM_MCP_TRACE_MODE_ENV_VARS;
|
|
88029
88059
|
var DEFAULT_PLATFORM_MCP_SERVER_NAME = "evalops";
|
|
88030
88060
|
var AGENT_MCP_MANIFEST_PATH2 = "/.well-known/evalops/agent-mcp.json";
|
|
88031
88061
|
var AGENT_MCP_PATH2 = "/mcp";
|
|
@@ -88074,6 +88104,26 @@ var init_platform_plugin = __esm2(() => {
|
|
|
88074
88104
|
"MAESTRO_EVALOPS_AGENT_MCP_SCOPES",
|
|
88075
88105
|
"MAESTRO_CEREBRO_MCP_SCOPES"
|
|
88076
88106
|
];
|
|
88107
|
+
PLATFORM_MCP_INTEGRATION_PROFILE_ENV_VARS = [
|
|
88108
|
+
"MAESTRO_EVALOPS_INTEGRATION_PROFILE",
|
|
88109
|
+
"MAESTRO_INTEGRATION_PROFILE"
|
|
88110
|
+
];
|
|
88111
|
+
PLATFORM_MCP_MEMORY_MODE_ENV_VARS = [
|
|
88112
|
+
"MAESTRO_EVALOPS_MEMORY_MODE",
|
|
88113
|
+
"MAESTRO_MEMORY_MODE"
|
|
88114
|
+
];
|
|
88115
|
+
PLATFORM_MCP_RUNTIME_OWNER_ENV_VARS = [
|
|
88116
|
+
"MAESTRO_EVALOPS_RUNTIME_OWNER",
|
|
88117
|
+
"MAESTRO_RUNTIME_OWNER"
|
|
88118
|
+
];
|
|
88119
|
+
PLATFORM_MCP_SHIM_TYPE_ENV_VARS = [
|
|
88120
|
+
"MAESTRO_EVALOPS_SHIM_TYPE",
|
|
88121
|
+
"MAESTRO_SHIM_TYPE"
|
|
88122
|
+
];
|
|
88123
|
+
PLATFORM_MCP_TRACE_MODE_ENV_VARS = [
|
|
88124
|
+
"MAESTRO_EVALOPS_TRACE_MODE",
|
|
88125
|
+
"MAESTRO_TRACE_MODE"
|
|
88126
|
+
];
|
|
88077
88127
|
});
|
|
88078
88128
|
var mcpNameSchema;
|
|
88079
88129
|
var mcpTransportSchema;
|
|
@@ -170388,6 +170438,223 @@ Environment:
|
|
|
170388
170438
|
MAESTRO_ATTACH_AUDIENCE`;
|
|
170389
170439
|
var init_hosted_runner = () => {
|
|
170390
170440
|
};
|
|
170441
|
+
var exports_init = {};
|
|
170442
|
+
__export2(exports_init, {
|
|
170443
|
+
parseInitArgs: () => parseInitArgs,
|
|
170444
|
+
handleInitCommand: () => handleInitCommand2,
|
|
170445
|
+
formatInitSuccess: () => formatInitSuccess,
|
|
170446
|
+
formatInitHelp: () => formatInitHelp
|
|
170447
|
+
});
|
|
170448
|
+
function formatInitHelp() {
|
|
170449
|
+
return `${sectionHeading("maestro init")}${muted(` maestro init Login, create or reuse an API key, and register this agent
|
|
170450
|
+
maestro init --rotate-key Replace the stored agent MCP API key
|
|
170451
|
+
maestro init --mcp-url <url> Override the EvalOps agent MCP endpoint
|
|
170452
|
+
maestro init --json Emit machine-readable bootstrap output
|
|
170453
|
+
|
|
170454
|
+
Options
|
|
170455
|
+
--agent-type <type> Agent type to register, defaults to maestro
|
|
170456
|
+
--surface <surface> Surface to register, defaults to cli
|
|
170457
|
+
--integration-profile <profile> mcp_only, mcp_otlp, managed_runtime, sdk_integrated, or provider_proxy
|
|
170458
|
+
--shim-type <type> native_mcp, command_wrapper, hook, provider_proxy, sdk, or mcp_firewall_proxy
|
|
170459
|
+
--trace-mode <mode> none, mcp_events, or otlp
|
|
170460
|
+
--memory-mode <mode> none, read_only, durable, or cerebro
|
|
170461
|
+
--runtime-owner <owner> external or evalops
|
|
170462
|
+
--workspace, --workspace-id <id> Workspace to associate with the registration
|
|
170463
|
+
--scope <scope[,scope...]> Registration scopes to request
|
|
170464
|
+
--key-scope <scope[,scope...]> API key scopes to request
|
|
170465
|
+
--expires-in-days <days> API key TTL in days
|
|
170466
|
+
--force-login Re-run EvalOps OAuth before bootstrapping
|
|
170467
|
+
--manifest-url <url> Override the agent MCP manifest URL
|
|
170468
|
+
--ttl-seconds <seconds> Registration TTL in seconds`)}`;
|
|
170469
|
+
}
|
|
170470
|
+
function readValue(args, index2, flag) {
|
|
170471
|
+
const value = args[index2 + 1];
|
|
170472
|
+
if (!value || value.startsWith("-")) {
|
|
170473
|
+
throw new Error(`${flag} requires a value`);
|
|
170474
|
+
}
|
|
170475
|
+
return value;
|
|
170476
|
+
}
|
|
170477
|
+
function parsePositiveInteger(value, flag) {
|
|
170478
|
+
const parsed = Number.parseInt(value, 10);
|
|
170479
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
170480
|
+
throw new Error(`${flag} must be a positive integer`);
|
|
170481
|
+
}
|
|
170482
|
+
return parsed;
|
|
170483
|
+
}
|
|
170484
|
+
function appendScopes(existing, value) {
|
|
170485
|
+
return [
|
|
170486
|
+
...existing ?? [],
|
|
170487
|
+
...value.split(",").map((entry2) => entry2.trim()).filter((entry2) => entry2.length > 0)
|
|
170488
|
+
];
|
|
170489
|
+
}
|
|
170490
|
+
function parseInitArgs(args) {
|
|
170491
|
+
const options = {};
|
|
170492
|
+
for (let i2 = 0; i2 < args.length; i2++) {
|
|
170493
|
+
const arg = args[i2];
|
|
170494
|
+
switch (arg) {
|
|
170495
|
+
case "--agent-mcp-url":
|
|
170496
|
+
case "--mcp-url":
|
|
170497
|
+
options.mcpUrl = readValue(args, i2, arg);
|
|
170498
|
+
i2++;
|
|
170499
|
+
break;
|
|
170500
|
+
case "--agent-type":
|
|
170501
|
+
options.agentType = readValue(args, i2, arg);
|
|
170502
|
+
i2++;
|
|
170503
|
+
break;
|
|
170504
|
+
case "--api-key-scope":
|
|
170505
|
+
case "--key-scope":
|
|
170506
|
+
options.apiKeyScopes = appendScopes(options.apiKeyScopes, readValue(args, i2, arg));
|
|
170507
|
+
i2++;
|
|
170508
|
+
break;
|
|
170509
|
+
case "--expires-in-days":
|
|
170510
|
+
options.expiresInDays = parsePositiveInteger(readValue(args, i2, arg), arg);
|
|
170511
|
+
i2++;
|
|
170512
|
+
break;
|
|
170513
|
+
case "--force-login":
|
|
170514
|
+
options.forceLogin = true;
|
|
170515
|
+
break;
|
|
170516
|
+
case "--integration-profile":
|
|
170517
|
+
options.integrationProfile = readValue(args, i2, arg);
|
|
170518
|
+
i2++;
|
|
170519
|
+
break;
|
|
170520
|
+
case "--json":
|
|
170521
|
+
options.json = true;
|
|
170522
|
+
break;
|
|
170523
|
+
case "--key-name":
|
|
170524
|
+
options.keyName = readValue(args, i2, arg);
|
|
170525
|
+
i2++;
|
|
170526
|
+
break;
|
|
170527
|
+
case "--manifest-url":
|
|
170528
|
+
options.manifestUrl = readValue(args, i2, arg);
|
|
170529
|
+
i2++;
|
|
170530
|
+
break;
|
|
170531
|
+
case "--memory-mode":
|
|
170532
|
+
options.memoryMode = readValue(args, i2, arg);
|
|
170533
|
+
i2++;
|
|
170534
|
+
break;
|
|
170535
|
+
case "--register-scope":
|
|
170536
|
+
case "--scope":
|
|
170537
|
+
options.registerScopes = appendScopes(options.registerScopes, readValue(args, i2, arg));
|
|
170538
|
+
i2++;
|
|
170539
|
+
break;
|
|
170540
|
+
case "--rotate-key":
|
|
170541
|
+
options.rotateKey = true;
|
|
170542
|
+
break;
|
|
170543
|
+
case "--runtime-owner":
|
|
170544
|
+
options.runtimeOwner = readValue(args, i2, arg);
|
|
170545
|
+
i2++;
|
|
170546
|
+
break;
|
|
170547
|
+
case "--shim-type":
|
|
170548
|
+
options.shimType = readValue(args, i2, arg);
|
|
170549
|
+
i2++;
|
|
170550
|
+
break;
|
|
170551
|
+
case "--surface":
|
|
170552
|
+
options.surface = readValue(args, i2, arg);
|
|
170553
|
+
i2++;
|
|
170554
|
+
break;
|
|
170555
|
+
case "--trace-mode":
|
|
170556
|
+
options.traceMode = readValue(args, i2, arg);
|
|
170557
|
+
i2++;
|
|
170558
|
+
break;
|
|
170559
|
+
case "--ttl-seconds":
|
|
170560
|
+
options.ttlSeconds = parsePositiveInteger(readValue(args, i2, arg), arg);
|
|
170561
|
+
i2++;
|
|
170562
|
+
break;
|
|
170563
|
+
case "--workspace":
|
|
170564
|
+
case "--workspace-id":
|
|
170565
|
+
options.workspaceId = readValue(args, i2, arg);
|
|
170566
|
+
i2++;
|
|
170567
|
+
break;
|
|
170568
|
+
default:
|
|
170569
|
+
if (arg?.startsWith("-")) {
|
|
170570
|
+
throw new Error(`Unknown maestro init option: ${arg}`);
|
|
170571
|
+
}
|
|
170572
|
+
throw new Error(`Unexpected maestro init argument: ${arg}`);
|
|
170573
|
+
}
|
|
170574
|
+
}
|
|
170575
|
+
return options;
|
|
170576
|
+
}
|
|
170577
|
+
function checkLine(text2) {
|
|
170578
|
+
return `${chalk61.green("\u2713")} ${text2}`;
|
|
170579
|
+
}
|
|
170580
|
+
function formatInitSuccess(result) {
|
|
170581
|
+
const keyMode = result.apiKeyCreated ? "Created" : "Reused";
|
|
170582
|
+
const authenticatedAs = result.authenticatedAs ?? "EvalOps";
|
|
170583
|
+
const governedActions = result.governedActionsLoaded ?? 0;
|
|
170584
|
+
const lines = [
|
|
170585
|
+
chalk61.bold("EvalOps Maestro bootstrap"),
|
|
170586
|
+
"",
|
|
170587
|
+
checkLine(`Authenticated as ${authenticatedAs}`),
|
|
170588
|
+
checkLine(`${keyMode} managed inference key`),
|
|
170589
|
+
checkLine("Registered local agent runtime"),
|
|
170590
|
+
checkLine(`Integration profile ${result.integrationProfile ?? "managed_runtime"} via ${result.shimType ?? "sdk"}`),
|
|
170591
|
+
checkLine(`Loaded ${governedActions} governed actions`),
|
|
170592
|
+
checkLine(result.approvalPolicyAttached ? "Attached default approval policy" : "Queued approval policy review"),
|
|
170593
|
+
checkLine(result.traceIngestionStarted ? "Started trace ingestion" : "Requested trace ingestion"),
|
|
170594
|
+
checkLine(result.governedInferenceCheckRan ? "Ran first governed inference check" : "Queued first governed inference check"),
|
|
170595
|
+
checkLine(result.evidenceEventPublished ? "Published evidence event" : "Queued evidence event"),
|
|
170596
|
+
"",
|
|
170597
|
+
"Open console:",
|
|
170598
|
+
result.consoleUrl ?? "https://app.evalops.dev/overview?env=production"
|
|
170599
|
+
];
|
|
170600
|
+
return lines.join(`
|
|
170601
|
+
`);
|
|
170602
|
+
}
|
|
170603
|
+
async function handleInitCommand2(args = []) {
|
|
170604
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
170605
|
+
console.log(formatInitHelp());
|
|
170606
|
+
return;
|
|
170607
|
+
}
|
|
170608
|
+
let options;
|
|
170609
|
+
try {
|
|
170610
|
+
options = parseInitArgs(args);
|
|
170611
|
+
} catch (error) {
|
|
170612
|
+
console.error(chalk61.red(error instanceof Error ? error.message : String(error)));
|
|
170613
|
+
process.exit(1);
|
|
170614
|
+
}
|
|
170615
|
+
const result = await bootstrapEvalOpsAgent(options, {
|
|
170616
|
+
onAuthUrl: (url) => {
|
|
170617
|
+
if (options.json) {
|
|
170618
|
+
console.error("Open this URL in your browser to authenticate with EvalOps:");
|
|
170619
|
+
console.error(url);
|
|
170620
|
+
return;
|
|
170621
|
+
}
|
|
170622
|
+
console.log(chalk61.yellow("Open this URL in your browser to authenticate with EvalOps:"));
|
|
170623
|
+
console.log(chalk61.underline(url));
|
|
170624
|
+
},
|
|
170625
|
+
onStatus: (status) => {
|
|
170626
|
+
if (options.json) {
|
|
170627
|
+
console.error(status.message);
|
|
170628
|
+
return;
|
|
170629
|
+
}
|
|
170630
|
+
console.log(chalk61.dim(status.message));
|
|
170631
|
+
}
|
|
170632
|
+
});
|
|
170633
|
+
if (options.json) {
|
|
170634
|
+
console.log(JSON.stringify(result, null, 2));
|
|
170635
|
+
return;
|
|
170636
|
+
}
|
|
170637
|
+
console.log(formatInitSuccess(result));
|
|
170638
|
+
}
|
|
170639
|
+
var init_init = __esm2(() => {
|
|
170640
|
+
init_agent_bootstrap();
|
|
170641
|
+
init_theme2();
|
|
170642
|
+
});
|
|
170643
|
+
var exports_status = {};
|
|
170644
|
+
__export2(exports_status, {
|
|
170645
|
+
handleStatusCommand: () => handleStatusCommand
|
|
170646
|
+
});
|
|
170647
|
+
async function handleStatusCommand() {
|
|
170648
|
+
const context2 = resolveManagedEvalOpsContext();
|
|
170649
|
+
console.log(chalk62.bold("Maestro status"));
|
|
170650
|
+
console.log(formatManagedEvalOpsStatus(context2));
|
|
170651
|
+
if (!context2.authenticated) {
|
|
170652
|
+
console.log(chalk62.dim('Run "maestro init" to bring EvalOps managed mode online.'));
|
|
170653
|
+
}
|
|
170654
|
+
}
|
|
170655
|
+
var init_status4 = __esm2(() => {
|
|
170656
|
+
init_managed_context();
|
|
170657
|
+
});
|
|
170391
170658
|
var exports_config = {};
|
|
170392
170659
|
__export2(exports_config, {
|
|
170393
170660
|
handleConfigValidate: () => handleConfigValidate,
|
|
@@ -170557,7 +170824,7 @@ function buildConfigShowSections(inspection, options) {
|
|
|
170557
170824
|
output.push(badge(`Providers (${inspection.providers.length})`, void 0, "info"));
|
|
170558
170825
|
for (const provider of inspection.providers) {
|
|
170559
170826
|
const isOverrideOnly = provider.modelCount === 0;
|
|
170560
|
-
const heading2 = `${
|
|
170827
|
+
const heading2 = `${chalk63.cyan(provider.id)} ${muted(`(${provider.modelCount} models)`)}`;
|
|
170561
170828
|
const enabledBadge = provider.enabled ? badge("enabled", void 0, "success") : badge("disabled", void 0, "warn");
|
|
170562
170829
|
const metaBadges = [];
|
|
170563
170830
|
if (isOverrideOnly) {
|
|
@@ -170612,7 +170879,7 @@ function buildConfigShowSections(inspection, options) {
|
|
|
170612
170879
|
for (const envVar of inspection.envVars) {
|
|
170613
170880
|
const status = envVar.set ? badge("set", void 0, "success") : badge("missing", void 0, "warn");
|
|
170614
170881
|
const value = envVar.maskedValue ? envVar.maskedValue : "(not set)";
|
|
170615
|
-
output.push(` ${status} ${
|
|
170882
|
+
output.push(` ${status} ${chalk63.cyan(envVar.name)}: ${muted(value)}`);
|
|
170616
170883
|
}
|
|
170617
170884
|
output.push("");
|
|
170618
170885
|
}
|
|
@@ -170636,14 +170903,14 @@ async function handleConfigValidate() {
|
|
|
170636
170903
|
if (result.errors.length > 0) {
|
|
170637
170904
|
console.log(badge("[ERROR] Errors", void 0, "danger"));
|
|
170638
170905
|
for (const error of result.errors) {
|
|
170639
|
-
console.log(
|
|
170906
|
+
console.log(chalk63.red(` \u2022 ${error}`));
|
|
170640
170907
|
}
|
|
170641
170908
|
console.log();
|
|
170642
170909
|
}
|
|
170643
170910
|
if (result.warnings.length > 0) {
|
|
170644
170911
|
console.log(badge("[WARN] Warnings", void 0, "warn"));
|
|
170645
170912
|
for (const warning of result.warnings) {
|
|
170646
|
-
console.log(
|
|
170913
|
+
console.log(chalk63.yellow(` \u2022 ${warning}`));
|
|
170647
170914
|
}
|
|
170648
170915
|
console.log();
|
|
170649
170916
|
}
|
|
@@ -170677,7 +170944,7 @@ function renderConfigShowLegacy(inspection, hierarchy, homeDir) {
|
|
|
170677
170944
|
console.log(badge(`Providers (${inspection.providers.length})`, void 0, "info"));
|
|
170678
170945
|
for (const provider of inspection.providers) {
|
|
170679
170946
|
const isOverrideOnly = provider.modelCount === 0;
|
|
170680
|
-
const heading2 = `${
|
|
170947
|
+
const heading2 = `${chalk63.cyan(provider.id)} ${muted(`(${provider.modelCount} models)`)}`;
|
|
170681
170948
|
const enabledBadge = provider.enabled ? badge("enabled", void 0, "success") : badge("disabled", void 0, "warn");
|
|
170682
170949
|
const metaBadges = [];
|
|
170683
170950
|
if (isOverrideOnly) {
|
|
@@ -170733,7 +171000,7 @@ function renderConfigShowLegacy(inspection, hierarchy, homeDir) {
|
|
|
170733
171000
|
for (const envVar of inspection.envVars) {
|
|
170734
171001
|
const status = envVar.set ? badge("set", void 0, "success") : badge("missing", void 0, "warn");
|
|
170735
171002
|
const value = envVar.maskedValue ? envVar.maskedValue : "(not set)";
|
|
170736
|
-
console.log(` ${status} ${
|
|
171003
|
+
console.log(` ${status} ${chalk63.cyan(envVar.name)}: ${muted(value)}`);
|
|
170737
171004
|
}
|
|
170738
171005
|
console.log();
|
|
170739
171006
|
}
|
|
@@ -170770,7 +171037,7 @@ async function handleConfigInit() {
|
|
|
170770
171037
|
const configPath2 = join82(configDir, "config.json");
|
|
170771
171038
|
const promptsDir = join82(configDir, "prompts");
|
|
170772
171039
|
if (existsSync103(configPath2)) {
|
|
170773
|
-
const overwrite = await rl.question(
|
|
171040
|
+
const overwrite = await rl.question(chalk63.yellow(`Config already exists at ${configPath2}. Overwrite? (y/N): `));
|
|
170774
171041
|
if (overwrite.toLowerCase() !== "y") {
|
|
170775
171042
|
console.log(muted(`
|
|
170776
171043
|
Cancelled.`));
|
|
@@ -170784,23 +171051,23 @@ Cancelled.`));
|
|
|
170784
171051
|
console.log(`
|
|
170785
171052
|
${badge("1. Choose your provider", void 0, "info")}`);
|
|
170786
171053
|
providerPresets.forEach((preset2, idx) => {
|
|
170787
|
-
const note = preset2.note ?
|
|
171054
|
+
const note = preset2.note ? chalk63.dim(` \u2014 ${preset2.note}`) : "";
|
|
170788
171055
|
console.log(` ${idx + 1}) ${preset2.name}${note}`);
|
|
170789
171056
|
});
|
|
170790
171057
|
let preset;
|
|
170791
171058
|
if (presetId) {
|
|
170792
171059
|
const found = providerPresets.find((p) => p.id.toLowerCase() === presetId.toLowerCase());
|
|
170793
171060
|
if (!found) {
|
|
170794
|
-
console.log(
|
|
171061
|
+
console.log(chalk63.yellow(`
|
|
170795
171062
|
Unknown preset "${presetId}", falling back to menu selection.`));
|
|
170796
171063
|
} else {
|
|
170797
171064
|
preset = found;
|
|
170798
|
-
console.log(
|
|
171065
|
+
console.log(chalk63.green(`
|
|
170799
171066
|
Using preset: ${preset.name}`));
|
|
170800
171067
|
}
|
|
170801
171068
|
}
|
|
170802
171069
|
if (!preset) {
|
|
170803
|
-
const providerChoice = await rl.question(
|
|
171070
|
+
const providerChoice = await rl.question(chalk63.cyan(`
|
|
170804
171071
|
Provider (1-${providerPresets.length}): `));
|
|
170805
171072
|
const presetIndex = Number.parseInt(providerChoice.trim(), 10) - 1 >= 0 && Number.parseInt(providerChoice.trim(), 10) - 1 < providerPresets.length ? Number.parseInt(providerChoice.trim(), 10) - 1 : 0;
|
|
170806
171073
|
preset = providerPresets[presetIndex] ?? providerPresets[0];
|
|
@@ -170823,17 +171090,17 @@ Provider (1-${providerPresets.length}): `));
|
|
|
170823
171090
|
${badge("2. How would you like to provide your API key?", void 0, "info")}`);
|
|
170824
171091
|
console.log(" 1) Environment variable (recommended)");
|
|
170825
171092
|
console.log(" 2) Direct in config (not recommended)");
|
|
170826
|
-
const keyChoice = await rl.question(
|
|
171093
|
+
const keyChoice = await rl.question(chalk63.cyan(`
|
|
170827
171094
|
Choice (1-2): `));
|
|
170828
171095
|
useEnv = keyChoice.trim() !== "2";
|
|
170829
171096
|
if (useEnv) {
|
|
170830
171097
|
const fallbackEnv = getEnvVarsForProvider(providerId)[0] ?? `${providerId.toUpperCase().replace(/[^A-Z0-9]/g, "_")}_API_KEY`;
|
|
170831
171098
|
const envVarName = preset.apiKeyEnv ?? fallbackEnv;
|
|
170832
171099
|
apiKeyField = { apiKeyEnv: envVarName };
|
|
170833
|
-
console.log(
|
|
171100
|
+
console.log(chalk63.dim(`
|
|
170834
171101
|
Using environment variable: ${envVarName}`));
|
|
170835
171102
|
} else {
|
|
170836
|
-
const apiKey = await rl.question(
|
|
171103
|
+
const apiKey = await rl.question(chalk63.cyan(`
|
|
170837
171104
|
Enter API key: `));
|
|
170838
171105
|
apiKeyField = { apiKey: apiKey.trim() };
|
|
170839
171106
|
}
|
|
@@ -170842,12 +171109,12 @@ Enter API key: `));
|
|
|
170842
171109
|
const noKeyMessage = isEvalOpsManagedProvider(providerId) ? `
|
|
170843
171110
|
Managed gateway preset does not use a local API key. Run maestro evalops login after setup.` : `
|
|
170844
171111
|
Local providers do not require API keys. Skipping step.`;
|
|
170845
|
-
console.log(
|
|
171112
|
+
console.log(chalk63.dim(noKeyMessage));
|
|
170846
171113
|
}
|
|
170847
171114
|
console.log(`
|
|
170848
171115
|
${badge("3. Would you like to use file references for prompts?", void 0, "info")}`);
|
|
170849
171116
|
console.log(" This creates a prompts/ folder for better organization.");
|
|
170850
|
-
const useFiles = await rl.question(
|
|
171117
|
+
const useFiles = await rl.question(chalk63.cyan(`
|
|
170851
171118
|
Use file references? (Y/n): `));
|
|
170852
171119
|
const createPrompts = useFiles.toLowerCase() !== "n";
|
|
170853
171120
|
mkdirSync40(configDir, { recursive: true });
|
|
@@ -170990,11 +171257,11 @@ async function checkLocalEndpoint(name, baseUrl) {
|
|
|
170990
171257
|
url.pathname = "/models";
|
|
170991
171258
|
const response = await fetch(url.toString(), { method: "GET" });
|
|
170992
171259
|
if (response.ok) {
|
|
170993
|
-
return `${badge(name, void 0, "success")} ${
|
|
171260
|
+
return `${badge(name, void 0, "success")} ${chalk63.dim(`responded with ${response.status}`)}`;
|
|
170994
171261
|
}
|
|
170995
|
-
return `${badge(name, void 0, "warn")} ${
|
|
171262
|
+
return `${badge(name, void 0, "warn")} ${chalk63.dim(`HTTP ${response.status}`)}`;
|
|
170996
171263
|
} catch (error) {
|
|
170997
|
-
return `${badge(name, void 0, "danger")} ${
|
|
171264
|
+
return `${badge(name, void 0, "danger")} ${chalk63.dim(error instanceof Error ? error.message : String(error))}`;
|
|
170998
171265
|
}
|
|
170999
171266
|
}
|
|
171000
171267
|
async function handleConfigLocal() {
|
|
@@ -171009,7 +171276,7 @@ async function handleConfigLocal() {
|
|
|
171009
171276
|
console.log(" 2) Add Ollama provider");
|
|
171010
171277
|
console.log(" 3) Check local endpoints");
|
|
171011
171278
|
console.log(" 4) Cancel");
|
|
171012
|
-
const choice = (await rl.question(
|
|
171279
|
+
const choice = (await rl.question(chalk63.cyan(`
|
|
171013
171280
|
Choice (1-4): `))).trim();
|
|
171014
171281
|
if (choice === "4") {
|
|
171015
171282
|
console.log(muted(`
|
|
@@ -171033,12 +171300,12 @@ Cancelled.`));
|
|
|
171033
171300
|
const templateKey = choice === "2" ? "ollama" : "lmstudio";
|
|
171034
171301
|
const template = LOCAL_PROVIDER_TEMPLATES[templateKey];
|
|
171035
171302
|
if (!template) {
|
|
171036
|
-
console.log(
|
|
171303
|
+
console.log(chalk63.red(`
|
|
171037
171304
|
Unknown template: ${templateKey}`));
|
|
171038
171305
|
rl.close();
|
|
171039
171306
|
return;
|
|
171040
171307
|
}
|
|
171041
|
-
const scope = (await rl.question(
|
|
171308
|
+
const scope = (await rl.question(chalk63.cyan(`
|
|
171042
171309
|
Save provider to:
|
|
171043
171310
|
1) Project (.maestro/local.json)
|
|
171044
171311
|
2) Home (~/.maestro/local.json)
|
|
@@ -171048,14 +171315,14 @@ Choice (1-2): `))).trim();
|
|
|
171048
171315
|
mkdirSync40(targetDir, { recursive: true });
|
|
171049
171316
|
const localPath = join82(targetDir, "local.json");
|
|
171050
171317
|
const config2 = loadLocalConfig(localPath);
|
|
171051
|
-
const providerId = (await rl.question(
|
|
171318
|
+
const providerId = (await rl.question(chalk63.cyan(`
|
|
171052
171319
|
Provider id (${template.id}): `))).trim() || template.id;
|
|
171053
|
-
const providerName = (await rl.question(
|
|
171054
|
-
const baseUrl = (await rl.question(
|
|
171055
|
-
const modelId = (await rl.question(
|
|
171056
|
-
const modelName = (await rl.question(
|
|
171057
|
-
const contextWindowAnswer = (await rl.question(
|
|
171058
|
-
const maxTokensAnswer = (await rl.question(
|
|
171320
|
+
const providerName = (await rl.question(chalk63.cyan(`Provider name (${template.name}): `))).trim() || template.name;
|
|
171321
|
+
const baseUrl = (await rl.question(chalk63.cyan(`Base URL (${template.baseUrl}): `))).trim() || template.baseUrl;
|
|
171322
|
+
const modelId = (await rl.question(chalk63.cyan(`Model id (${template.model.id}): `))).trim() || template.model.id;
|
|
171323
|
+
const modelName = (await rl.question(chalk63.cyan(`Model name (${template.model.name}): `))).trim() || template.model.name;
|
|
171324
|
+
const contextWindowAnswer = (await rl.question(chalk63.cyan(`Context window (${template.model.contextWindow}): `))).trim();
|
|
171325
|
+
const maxTokensAnswer = (await rl.question(chalk63.cyan(`Max output tokens (${template.model.maxTokens}): `))).trim();
|
|
171059
171326
|
const contextWindow = Number.parseInt(contextWindowAnswer, 10) || template.model.contextWindow;
|
|
171060
171327
|
const maxTokens = Number.parseInt(maxTokensAnswer, 10) || template.model.maxTokens;
|
|
171061
171328
|
upsertLocalProvider(config2, template, {
|
|
@@ -171099,7 +171366,7 @@ function formatModelLabel2(model) {
|
|
|
171099
171366
|
if (model.input?.includes("image")) {
|
|
171100
171367
|
caps.push("vision");
|
|
171101
171368
|
}
|
|
171102
|
-
const suffix = caps.length ? ` ${
|
|
171369
|
+
const suffix = caps.length ? ` ${chalk63.dim(`[${caps.join(", ")}]`)}` : "";
|
|
171103
171370
|
return `${model.id}${suffix}`;
|
|
171104
171371
|
}
|
|
171105
171372
|
var ANSI_STRING_TERMINATORS3 = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
@@ -171161,15 +171428,15 @@ async function handleOpenAICommand(subcommand, _params = []) {
|
|
|
171161
171428
|
await handleStatus2();
|
|
171162
171429
|
return;
|
|
171163
171430
|
default:
|
|
171164
|
-
console.error(
|
|
171431
|
+
console.error(chalk64.red('Unknown openai subcommand. Try "maestro openai login", "logout", or "status".'));
|
|
171165
171432
|
process.exit(1);
|
|
171166
171433
|
}
|
|
171167
171434
|
}
|
|
171168
171435
|
async function handleLogin2() {
|
|
171169
|
-
console.log(
|
|
171436
|
+
console.log(chalk64.bold("Maestro OpenAI Login"));
|
|
171170
171437
|
const { url, verifier, state: state2 } = await generateOpenAILoginUrl();
|
|
171171
|
-
console.log(
|
|
171172
|
-
console.log(
|
|
171438
|
+
console.log(chalk64.yellow("Please open the following URL in your browser to authenticate:"));
|
|
171439
|
+
console.log(chalk64.underline(url));
|
|
171173
171440
|
const server = createServer7(async (req, res) => {
|
|
171174
171441
|
const reqUrl = new URL2(req.url ?? "", CALLBACK_ORIGIN4);
|
|
171175
171442
|
if (reqUrl.pathname === "/auth/callback") {
|
|
@@ -171206,12 +171473,12 @@ async function handleLogin2() {
|
|
|
171206
171473
|
});
|
|
171207
171474
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
171208
171475
|
res.end("<html><body><h1>Login Successful</h1><p>You can close this tab and return to the terminal.</p></body></html>");
|
|
171209
|
-
console.log(
|
|
171476
|
+
console.log(chalk64.green(`
|
|
171210
171477
|
OpenAI credentials saved successfully.`));
|
|
171211
|
-
console.log(
|
|
171478
|
+
console.log(chalk64.dim("Future runs can use --auth auto (default) or provide an OpenAI API key."));
|
|
171212
171479
|
} catch (error) {
|
|
171213
171480
|
const errorMsg = error instanceof Error ? error.message : "Unknown error";
|
|
171214
|
-
console.error(
|
|
171481
|
+
console.error(chalk64.red(`
|
|
171215
171482
|
Login failed: ${errorMsg}`));
|
|
171216
171483
|
res.writeHead(500, { "Content-Type": "text/plain" });
|
|
171217
171484
|
res.end("Login failed. Check terminal for details.");
|
|
@@ -171225,32 +171492,32 @@ Login failed: ${errorMsg}`));
|
|
|
171225
171492
|
});
|
|
171226
171493
|
server.on("error", (e2) => {
|
|
171227
171494
|
if (e2.code === "EADDRINUSE") {
|
|
171228
|
-
console.error(
|
|
171495
|
+
console.error(chalk64.red(`Port ${DEFAULT_PORT} is already in use. Please close the other process and try again.`));
|
|
171229
171496
|
process.exit(1);
|
|
171230
171497
|
}
|
|
171231
|
-
console.error(
|
|
171498
|
+
console.error(chalk64.red(`Server error: ${e2.message}`));
|
|
171232
171499
|
process.exit(1);
|
|
171233
171500
|
});
|
|
171234
171501
|
server.listen(DEFAULT_PORT, "127.0.0.1");
|
|
171235
171502
|
}
|
|
171236
171503
|
async function handleLogout() {
|
|
171237
171504
|
await deleteOpenAIOAuthCredential();
|
|
171238
|
-
console.log(
|
|
171505
|
+
console.log(chalk64.green("Removed stored OpenAI credentials."));
|
|
171239
171506
|
}
|
|
171240
171507
|
async function handleStatus2() {
|
|
171241
171508
|
const stored = await getStoredOpenAIOAuthCredential();
|
|
171242
171509
|
if (!stored) {
|
|
171243
|
-
console.log(
|
|
171244
|
-
console.log(
|
|
171510
|
+
console.log(chalk64.yellow("No stored OpenAI credentials."));
|
|
171511
|
+
console.log(chalk64.dim('Run "maestro openai login" to authenticate with OpenAI.'));
|
|
171245
171512
|
return;
|
|
171246
171513
|
}
|
|
171247
171514
|
const remainingMs = Math.max(0, stored.expiresAt - Date.now());
|
|
171248
171515
|
const minutes = Math.round(remainingMs / 6e4);
|
|
171249
|
-
console.log(
|
|
171250
|
-
console.log(
|
|
171516
|
+
console.log(chalk64.green("Stored OpenAI credentials detected."));
|
|
171517
|
+
console.log(chalk64.dim(`Access token expires in ~${minutes} minute${minutes === 1 ? "" : "s"} (auto-refresh enabled).`));
|
|
171251
171518
|
const fresh = await getFreshOpenAIOAuthCredential();
|
|
171252
171519
|
if (fresh) {
|
|
171253
|
-
console.log(
|
|
171520
|
+
console.log(chalk64.dim("Credentials refreshed."));
|
|
171254
171521
|
}
|
|
171255
171522
|
}
|
|
171256
171523
|
var CALLBACK_ORIGIN4;
|
|
@@ -171258,208 +171525,6 @@ var init_openai3 = __esm2(() => {
|
|
|
171258
171525
|
init_openai_auth();
|
|
171259
171526
|
CALLBACK_ORIGIN4 = `http://127.0.0.1:${DEFAULT_PORT}`;
|
|
171260
171527
|
});
|
|
171261
|
-
var exports_init = {};
|
|
171262
|
-
__export2(exports_init, {
|
|
171263
|
-
parseInitArgs: () => parseInitArgs,
|
|
171264
|
-
handleInitCommand: () => handleInitCommand2,
|
|
171265
|
-
formatInitSuccess: () => formatInitSuccess,
|
|
171266
|
-
formatInitHelp: () => formatInitHelp
|
|
171267
|
-
});
|
|
171268
|
-
function formatInitHelp() {
|
|
171269
|
-
return `${sectionHeading("maestro init")}${muted(` maestro init Login, create or reuse an API key, and register this agent
|
|
171270
|
-
maestro init --rotate-key Replace the stored agent MCP API key
|
|
171271
|
-
maestro init --mcp-url <url> Override the EvalOps agent MCP endpoint
|
|
171272
|
-
maestro init --json Emit machine-readable bootstrap output
|
|
171273
|
-
|
|
171274
|
-
Options
|
|
171275
|
-
--agent-type <type> Agent type to register, defaults to maestro
|
|
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
|
|
171282
|
-
--workspace, --workspace-id <id> Workspace to associate with the registration
|
|
171283
|
-
--scope <scope[,scope...]> Registration scopes to request
|
|
171284
|
-
--key-scope <scope[,scope...]> API key scopes to request
|
|
171285
|
-
--expires-in-days <days> API key TTL in days
|
|
171286
|
-
--force-login Re-run EvalOps OAuth before bootstrapping
|
|
171287
|
-
--manifest-url <url> Override the agent MCP manifest URL
|
|
171288
|
-
--ttl-seconds <seconds> Registration TTL in seconds`)}`;
|
|
171289
|
-
}
|
|
171290
|
-
function readValue(args, index2, flag) {
|
|
171291
|
-
const value = args[index2 + 1];
|
|
171292
|
-
if (!value || value.startsWith("-")) {
|
|
171293
|
-
throw new Error(`${flag} requires a value`);
|
|
171294
|
-
}
|
|
171295
|
-
return value;
|
|
171296
|
-
}
|
|
171297
|
-
function parsePositiveInteger(value, flag) {
|
|
171298
|
-
const parsed = Number.parseInt(value, 10);
|
|
171299
|
-
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
171300
|
-
throw new Error(`${flag} must be a positive integer`);
|
|
171301
|
-
}
|
|
171302
|
-
return parsed;
|
|
171303
|
-
}
|
|
171304
|
-
function appendScopes(existing, value) {
|
|
171305
|
-
return [
|
|
171306
|
-
...existing ?? [],
|
|
171307
|
-
...value.split(",").map((entry2) => entry2.trim()).filter((entry2) => entry2.length > 0)
|
|
171308
|
-
];
|
|
171309
|
-
}
|
|
171310
|
-
function parseInitArgs(args) {
|
|
171311
|
-
const options = {};
|
|
171312
|
-
for (let i2 = 0; i2 < args.length; i2++) {
|
|
171313
|
-
const arg = args[i2];
|
|
171314
|
-
switch (arg) {
|
|
171315
|
-
case "--agent-mcp-url":
|
|
171316
|
-
case "--mcp-url":
|
|
171317
|
-
options.mcpUrl = readValue(args, i2, arg);
|
|
171318
|
-
i2++;
|
|
171319
|
-
break;
|
|
171320
|
-
case "--agent-type":
|
|
171321
|
-
options.agentType = readValue(args, i2, arg);
|
|
171322
|
-
i2++;
|
|
171323
|
-
break;
|
|
171324
|
-
case "--api-key-scope":
|
|
171325
|
-
case "--key-scope":
|
|
171326
|
-
options.apiKeyScopes = appendScopes(options.apiKeyScopes, readValue(args, i2, arg));
|
|
171327
|
-
i2++;
|
|
171328
|
-
break;
|
|
171329
|
-
case "--expires-in-days":
|
|
171330
|
-
options.expiresInDays = parsePositiveInteger(readValue(args, i2, arg), arg);
|
|
171331
|
-
i2++;
|
|
171332
|
-
break;
|
|
171333
|
-
case "--force-login":
|
|
171334
|
-
options.forceLogin = true;
|
|
171335
|
-
break;
|
|
171336
|
-
case "--integration-profile":
|
|
171337
|
-
options.integrationProfile = readValue(args, i2, arg);
|
|
171338
|
-
i2++;
|
|
171339
|
-
break;
|
|
171340
|
-
case "--json":
|
|
171341
|
-
options.json = true;
|
|
171342
|
-
break;
|
|
171343
|
-
case "--key-name":
|
|
171344
|
-
options.keyName = readValue(args, i2, arg);
|
|
171345
|
-
i2++;
|
|
171346
|
-
break;
|
|
171347
|
-
case "--manifest-url":
|
|
171348
|
-
options.manifestUrl = readValue(args, i2, arg);
|
|
171349
|
-
i2++;
|
|
171350
|
-
break;
|
|
171351
|
-
case "--memory-mode":
|
|
171352
|
-
options.memoryMode = readValue(args, i2, arg);
|
|
171353
|
-
i2++;
|
|
171354
|
-
break;
|
|
171355
|
-
case "--register-scope":
|
|
171356
|
-
case "--scope":
|
|
171357
|
-
options.registerScopes = appendScopes(options.registerScopes, readValue(args, i2, arg));
|
|
171358
|
-
i2++;
|
|
171359
|
-
break;
|
|
171360
|
-
case "--rotate-key":
|
|
171361
|
-
options.rotateKey = true;
|
|
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;
|
|
171371
|
-
case "--surface":
|
|
171372
|
-
options.surface = readValue(args, i2, arg);
|
|
171373
|
-
i2++;
|
|
171374
|
-
break;
|
|
171375
|
-
case "--trace-mode":
|
|
171376
|
-
options.traceMode = readValue(args, i2, arg);
|
|
171377
|
-
i2++;
|
|
171378
|
-
break;
|
|
171379
|
-
case "--ttl-seconds":
|
|
171380
|
-
options.ttlSeconds = parsePositiveInteger(readValue(args, i2, arg), arg);
|
|
171381
|
-
i2++;
|
|
171382
|
-
break;
|
|
171383
|
-
case "--workspace":
|
|
171384
|
-
case "--workspace-id":
|
|
171385
|
-
options.workspaceId = readValue(args, i2, arg);
|
|
171386
|
-
i2++;
|
|
171387
|
-
break;
|
|
171388
|
-
default:
|
|
171389
|
-
if (arg?.startsWith("-")) {
|
|
171390
|
-
throw new Error(`Unknown maestro init option: ${arg}`);
|
|
171391
|
-
}
|
|
171392
|
-
throw new Error(`Unexpected maestro init argument: ${arg}`);
|
|
171393
|
-
}
|
|
171394
|
-
}
|
|
171395
|
-
return options;
|
|
171396
|
-
}
|
|
171397
|
-
function checkLine(text2) {
|
|
171398
|
-
return `${chalk63.green("\u2713")} ${text2}`;
|
|
171399
|
-
}
|
|
171400
|
-
function formatInitSuccess(result) {
|
|
171401
|
-
const keyMode = result.apiKeyCreated ? "Created" : "Reused";
|
|
171402
|
-
const authenticatedAs = result.authenticatedAs ?? "EvalOps";
|
|
171403
|
-
const governedActions = result.governedActionsLoaded ?? 0;
|
|
171404
|
-
const lines = [
|
|
171405
|
-
chalk63.bold("EvalOps Maestro bootstrap"),
|
|
171406
|
-
"",
|
|
171407
|
-
checkLine(`Authenticated as ${authenticatedAs}`),
|
|
171408
|
-
checkLine(`${keyMode} managed inference key`),
|
|
171409
|
-
checkLine("Registered local agent runtime"),
|
|
171410
|
-
checkLine(`Integration profile ${result.integrationProfile ?? "managed_runtime"} via ${result.shimType ?? "sdk"}`),
|
|
171411
|
-
checkLine(`Loaded ${governedActions} governed actions`),
|
|
171412
|
-
checkLine(result.approvalPolicyAttached ? "Attached default approval policy" : "Queued approval policy review"),
|
|
171413
|
-
checkLine(result.traceIngestionStarted ? "Started trace ingestion" : "Requested trace ingestion"),
|
|
171414
|
-
checkLine(result.governedInferenceCheckRan ? "Ran first governed inference check" : "Queued first governed inference check"),
|
|
171415
|
-
checkLine(result.evidenceEventPublished ? "Published evidence event" : "Queued evidence event"),
|
|
171416
|
-
"",
|
|
171417
|
-
"Open console:",
|
|
171418
|
-
result.consoleUrl ?? "https://app.evalops.dev/overview?env=production"
|
|
171419
|
-
];
|
|
171420
|
-
return lines.join(`
|
|
171421
|
-
`);
|
|
171422
|
-
}
|
|
171423
|
-
async function handleInitCommand2(args = []) {
|
|
171424
|
-
if (args.includes("--help") || args.includes("-h")) {
|
|
171425
|
-
console.log(formatInitHelp());
|
|
171426
|
-
return;
|
|
171427
|
-
}
|
|
171428
|
-
let options;
|
|
171429
|
-
try {
|
|
171430
|
-
options = parseInitArgs(args);
|
|
171431
|
-
} catch (error) {
|
|
171432
|
-
console.error(chalk63.red(error instanceof Error ? error.message : String(error)));
|
|
171433
|
-
process.exit(1);
|
|
171434
|
-
}
|
|
171435
|
-
const result = await bootstrapEvalOpsAgent(options, {
|
|
171436
|
-
onAuthUrl: (url) => {
|
|
171437
|
-
if (options.json) {
|
|
171438
|
-
console.error("Open this URL in your browser to authenticate with EvalOps:");
|
|
171439
|
-
console.error(url);
|
|
171440
|
-
return;
|
|
171441
|
-
}
|
|
171442
|
-
console.log(chalk63.yellow("Open this URL in your browser to authenticate with EvalOps:"));
|
|
171443
|
-
console.log(chalk63.underline(url));
|
|
171444
|
-
},
|
|
171445
|
-
onStatus: (status) => {
|
|
171446
|
-
if (options.json) {
|
|
171447
|
-
console.error(status.message);
|
|
171448
|
-
return;
|
|
171449
|
-
}
|
|
171450
|
-
console.log(chalk63.dim(status.message));
|
|
171451
|
-
}
|
|
171452
|
-
});
|
|
171453
|
-
if (options.json) {
|
|
171454
|
-
console.log(JSON.stringify(result, null, 2));
|
|
171455
|
-
return;
|
|
171456
|
-
}
|
|
171457
|
-
console.log(formatInitSuccess(result));
|
|
171458
|
-
}
|
|
171459
|
-
var init_init = __esm2(() => {
|
|
171460
|
-
init_agent_bootstrap();
|
|
171461
|
-
init_theme2();
|
|
171462
|
-
});
|
|
171463
171528
|
var exports_evalops = {};
|
|
171464
171529
|
__export2(exports_evalops, {
|
|
171465
171530
|
handleEvalOpsStatus: () => handleEvalOpsStatus,
|
|
@@ -171482,58 +171547,43 @@ async function handleEvalOpsCommand(subcommand, args = []) {
|
|
|
171482
171547
|
await handleEvalOpsStatus();
|
|
171483
171548
|
return;
|
|
171484
171549
|
default:
|
|
171485
|
-
console.error(
|
|
171550
|
+
console.error(chalk65.red('Unknown evalops subcommand. Try "maestro init" for setup, or "maestro evalops login", "logout", or "status".'));
|
|
171486
171551
|
process.exit(1);
|
|
171487
171552
|
}
|
|
171488
171553
|
}
|
|
171489
171554
|
async function handleLogin3() {
|
|
171490
|
-
console.log(
|
|
171555
|
+
console.log(chalk65.bold("Maestro EvalOps Login"));
|
|
171491
171556
|
await login("evalops", {
|
|
171492
171557
|
onAuthUrl: (url) => {
|
|
171493
|
-
console.log(
|
|
171494
|
-
console.log(
|
|
171558
|
+
console.log(chalk65.yellow("Open this URL in your browser to authenticate with EvalOps:"));
|
|
171559
|
+
console.log(chalk65.underline(url));
|
|
171495
171560
|
},
|
|
171496
|
-
onStatus: (status) => console.log(
|
|
171561
|
+
onStatus: (status) => console.log(chalk65.dim(status))
|
|
171497
171562
|
});
|
|
171498
|
-
console.log(
|
|
171499
|
-
console.log(
|
|
171563
|
+
console.log(chalk65.green("EvalOps credentials saved successfully."));
|
|
171564
|
+
console.log(chalk65.dim('Try "maestro --provider evalops --model gpt-4o-mini".'));
|
|
171500
171565
|
}
|
|
171501
171566
|
async function handleLogout2() {
|
|
171502
171567
|
await logout("evalops");
|
|
171503
|
-
console.log(
|
|
171568
|
+
console.log(chalk65.green("Removed stored EvalOps credentials."));
|
|
171504
171569
|
}
|
|
171505
171570
|
async function handleEvalOpsStatus() {
|
|
171506
171571
|
if (!hasOAuthCredentials("evalops")) {
|
|
171507
|
-
console.log(
|
|
171508
|
-
console.log(
|
|
171572
|
+
console.log(chalk65.yellow("No stored EvalOps credentials."));
|
|
171573
|
+
console.log(chalk65.dim('Run "maestro evalops login" to authenticate with EvalOps.'));
|
|
171509
171574
|
return;
|
|
171510
171575
|
}
|
|
171511
|
-
console.log(
|
|
171576
|
+
console.log(chalk65.green("Stored EvalOps credentials detected."));
|
|
171512
171577
|
const context2 = resolveManagedEvalOpsContext();
|
|
171513
171578
|
console.log(formatManagedEvalOpsStatus(context2));
|
|
171514
171579
|
if (!context2.managed) {
|
|
171515
|
-
console.log(
|
|
171580
|
+
console.log(chalk65.yellow('No EvalOps agent session yet. Run "maestro init".'));
|
|
171516
171581
|
}
|
|
171517
171582
|
}
|
|
171518
171583
|
var init_evalops2 = __esm2(() => {
|
|
171519
171584
|
init_managed_context();
|
|
171520
171585
|
init_oauth();
|
|
171521
171586
|
});
|
|
171522
|
-
var exports_status = {};
|
|
171523
|
-
__export2(exports_status, {
|
|
171524
|
-
handleStatusCommand: () => handleStatusCommand
|
|
171525
|
-
});
|
|
171526
|
-
async function handleStatusCommand() {
|
|
171527
|
-
const context2 = resolveManagedEvalOpsContext();
|
|
171528
|
-
console.log(chalk65.bold("Maestro status"));
|
|
171529
|
-
console.log(formatManagedEvalOpsStatus(context2));
|
|
171530
|
-
if (!context2.authenticated) {
|
|
171531
|
-
console.log(chalk65.dim('Run "maestro init" to bring EvalOps managed mode online.'));
|
|
171532
|
-
}
|
|
171533
|
-
}
|
|
171534
|
-
var init_status4 = __esm2(() => {
|
|
171535
|
-
init_managed_context();
|
|
171536
|
-
});
|
|
171537
171587
|
var exports_codex = {};
|
|
171538
171588
|
__export2(exports_codex, {
|
|
171539
171589
|
handleCodexCommand: () => handleCodexCommand
|
|
@@ -176372,6 +176422,11 @@ async function main(args) {
|
|
|
176372
176422
|
console.error(chalk81.red(parsed.error));
|
|
176373
176423
|
process.exit(1);
|
|
176374
176424
|
}
|
|
176425
|
+
const exitWithEarlyStartupError = (error) => {
|
|
176426
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
176427
|
+
console.error(chalk81.red(message));
|
|
176428
|
+
process.exit(1);
|
|
176429
|
+
};
|
|
176375
176430
|
if (parsed.command === "hosted-runner") {
|
|
176376
176431
|
const { handleHostedRunnerCommand: handleHostedRunnerCommand2 } = await Promise.resolve().then(() => (init_hosted_runner(), exports_hosted_runner));
|
|
176377
176432
|
await handleHostedRunnerCommand2(parsed.commandArgs ?? [], {
|
|
@@ -176391,6 +176446,26 @@ async function main(args) {
|
|
|
176391
176446
|
await startWebServer2(port, { skipStartupMigration: true });
|
|
176392
176447
|
return;
|
|
176393
176448
|
}
|
|
176449
|
+
if (parsed.command === "init") {
|
|
176450
|
+
try {
|
|
176451
|
+
validateCodexFlags(args, parsed.command);
|
|
176452
|
+
} catch (error) {
|
|
176453
|
+
exitWithEarlyStartupError(error);
|
|
176454
|
+
}
|
|
176455
|
+
const { handleInitCommand: handleInitCommand3 } = await Promise.resolve().then(() => (init_init(), exports_init));
|
|
176456
|
+
await handleInitCommand3(parsed.commandArgs ?? []);
|
|
176457
|
+
return;
|
|
176458
|
+
}
|
|
176459
|
+
if (parsed.command === "status") {
|
|
176460
|
+
try {
|
|
176461
|
+
validateCodexFlags(args, parsed.command);
|
|
176462
|
+
} catch (error) {
|
|
176463
|
+
exitWithEarlyStartupError(error);
|
|
176464
|
+
}
|
|
176465
|
+
const { handleStatusCommand: handleStatusCommand2 } = await Promise.resolve().then(() => (init_status4(), exports_status));
|
|
176466
|
+
await handleStatusCommand2();
|
|
176467
|
+
return;
|
|
176468
|
+
}
|
|
176394
176469
|
const isLikelyInteractiveTui = !parsed.messages.length && (parsed.mode === "text" || parsed.mode === void 0) && parsed.command === void 0;
|
|
176395
176470
|
const isHeadlessMode = parsed.headless || parsed.mode === "headless";
|
|
176396
176471
|
if (isLikelyInteractiveTui || isHeadlessMode) {
|
|
@@ -176550,16 +176625,6 @@ Available commands:`));
|
|
|
176550
176625
|
await handleEvalOpsCommand2(parsed.subcommand, parsed.commandArgs ?? []);
|
|
176551
176626
|
return;
|
|
176552
176627
|
}
|
|
176553
|
-
if (parsed.command === "status") {
|
|
176554
|
-
const { handleStatusCommand: handleStatusCommand2 } = await Promise.resolve().then(() => (init_status4(), exports_status));
|
|
176555
|
-
await handleStatusCommand2();
|
|
176556
|
-
return;
|
|
176557
|
-
}
|
|
176558
|
-
if (parsed.command === "init") {
|
|
176559
|
-
const { handleInitCommand: handleInitCommand3 } = await Promise.resolve().then(() => (init_init(), exports_init));
|
|
176560
|
-
await handleInitCommand3(parsed.commandArgs ?? []);
|
|
176561
|
-
return;
|
|
176562
|
-
}
|
|
176563
176628
|
if (parsed.command === "codex") {
|
|
176564
176629
|
const { handleCodexCommand: handleCodexCommand2 } = await Promise.resolve().then(() => (init_codex(), exports_codex));
|
|
176565
176630
|
await handleCodexCommand2(parsed.subcommand, parsed.messages);
|