@evalops/maestro 0.10.16 → 0.10.18

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.
Files changed (37) hide show
  1. package/dist/agent/providers/google-gemini-cli.js +3 -5
  2. package/dist/agent/providers/google.js +3 -5
  3. package/dist/agent/providers/vertex.js +3 -5
  4. package/dist/cli/commands/init.d.ts.map +1 -1
  5. package/dist/cli/commands/init.js +6 -0
  6. package/dist/cli/commands/init.js.map +1 -1
  7. package/dist/cli/help.d.ts.map +1 -1
  8. package/dist/cli/help.js +1 -0
  9. package/dist/cli/help.js.map +1 -1
  10. package/dist/cli.js +354 -294
  11. package/dist/evalops/agent-bootstrap.d.ts +1 -0
  12. package/dist/evalops/agent-bootstrap.d.ts.map +1 -1
  13. package/dist/evalops/agent-bootstrap.js +41 -1
  14. package/dist/evalops/agent-bootstrap.js.map +1 -1
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +1 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/main.d.ts.map +1 -1
  20. package/dist/main.js +31 -10
  21. package/dist/main.js.map +1 -1
  22. package/dist/platform/a2a-client.d.ts +98 -0
  23. package/dist/platform/a2a-client.d.ts.map +1 -0
  24. package/dist/platform/a2a-client.js +200 -0
  25. package/dist/platform/a2a-client.js.map +1 -0
  26. package/dist/platform/client.d.ts +2 -0
  27. package/dist/platform/client.d.ts.map +1 -1
  28. package/dist/platform/client.js +4 -2
  29. package/dist/platform/client.js.map +1 -1
  30. package/dist/utils/logger.d.ts +1 -1
  31. package/dist/utils/logger.d.ts.map +1 -1
  32. package/dist/utils/logger.js +3 -5
  33. package/dist/utils/logger.js.map +1 -1
  34. package/dist/version.json +2 -2
  35. package/node_modules/@evalops/contracts/package.json +1 -1
  36. package/node_modules/@evalops/tui/package.json +1 -1
  37. 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 chalk61 from "chalk";
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
- const output = entry2.level === "error" ? console.error : console.log;
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
- output(parts.join(" "));
38044
+ console.error(parts.join(" "));
38047
38045
  if (entry2.error?.stack) {
38048
- output(entry2.error.stack);
38046
+ console.error(entry2.error.stack);
38049
38047
  }
38050
38048
  }
38051
38049
  debug(message, context2) {
@@ -53111,7 +53109,7 @@ async function resolvePlatformServiceConfig(options) {
53111
53109
  if (!organizationId && options.requireOrganizationId !== false) {
53112
53110
  return null;
53113
53111
  }
53114
- const token = await resolvePlatformToken(options.tokenEnvVars);
53112
+ const token = options.allowOAuthTokenFallback === false ? getEnvValue3(options.tokenEnvVars ?? []) : await resolvePlatformToken(options.tokenEnvVars);
53115
53113
  if (!token && options.requireToken !== false) {
53116
53114
  return null;
53117
53115
  }
@@ -87670,6 +87668,23 @@ function memoryModeForOptions(options) {
87670
87668
  function runtimeOwnerForOptions(options) {
87671
87669
  return nonEmptyString2(options.runtimeOwner) ?? (integrationProfileForOptions(options) === "managed_runtime" ? "evalops" : "external");
87672
87670
  }
87671
+ function capabilitiesForOptions(options) {
87672
+ const requested = stringArray(options.capabilities);
87673
+ const defaults = (options.agentType ?? DEFAULT_AGENT_TYPE) === DEFAULT_AGENT_TYPE ? DEFAULT_MAESTRO_AGENT_CAPABILITIES : DEFAULT_AGENT_NEUTRAL_CAPABILITIES;
87674
+ const out = [];
87675
+ const seen = /* @__PURE__ */ new Set();
87676
+ for (const capability of requested ?? defaults) {
87677
+ const normalized = nonEmptyString2(capability);
87678
+ if (!normalized)
87679
+ continue;
87680
+ const key = normalized.toLowerCase();
87681
+ if (seen.has(key))
87682
+ continue;
87683
+ seen.add(key);
87684
+ out.push(normalized);
87685
+ }
87686
+ return out;
87687
+ }
87673
87688
  async function createAgentAPIKey(options, identityBaseUrl, oauthToken, fetchImpl, now2) {
87674
87689
  const expiresInDays = positiveInteger(options.expiresInDays);
87675
87690
  const expiresAt = expiresInDays ? new Date(now2.getTime() + expiresInDays * 24 * 60 * 60 * 1e3).toISOString() : void 0;
@@ -87706,7 +87721,7 @@ async function createAgentAPIKey(options, identityBaseUrl, oauthToken, fetchImpl
87706
87721
  async function registerAgent(options, client) {
87707
87722
  const output = await callConnectedMcpTool(client, "evalops_register", {
87708
87723
  agent_type: options.agentType ?? DEFAULT_AGENT_TYPE,
87709
- capabilities: ["maestro:init", "maestro:cli"],
87724
+ capabilities: capabilitiesForOptions(options),
87710
87725
  integration_profile: integrationProfileForOptions(options),
87711
87726
  memory_mode: memoryModeForOptions(options),
87712
87727
  runtime_owner: runtimeOwnerForOptions(options),
@@ -87962,6 +87977,8 @@ var AGENT_MCP_MANIFEST_PATH = "/.well-known/evalops/agent-mcp.json";
87962
87977
  var AGENT_MCP_PATH = "/mcp";
87963
87978
  var DEFAULT_AGENT_TYPE = "maestro";
87964
87979
  var DEFAULT_SURFACE2 = "cli";
87980
+ var DEFAULT_AGENT_NEUTRAL_CAPABILITIES;
87981
+ var DEFAULT_MAESTRO_AGENT_CAPABILITIES;
87965
87982
  var DEFAULT_API_KEY_SCOPES;
87966
87983
  var init_agent_bootstrap = __esm2(() => {
87967
87984
  init_oauth();
@@ -87969,6 +87986,27 @@ var init_agent_bootstrap = __esm2(() => {
87969
87986
  init_package_metadata();
87970
87987
  init_client();
87971
87988
  init_core_services();
87989
+ DEFAULT_AGENT_NEUTRAL_CAPABILITIES = [
87990
+ "mcp",
87991
+ "tool.use",
87992
+ "responses:create"
87993
+ ];
87994
+ DEFAULT_MAESTRO_AGENT_CAPABILITIES = [
87995
+ "maestro:init",
87996
+ "maestro:cli",
87997
+ "conversation:manage",
87998
+ "workflow:orchestrate",
87999
+ "code:write",
88000
+ "code:review",
88001
+ "code:test",
88002
+ "shell",
88003
+ "git",
88004
+ "fs",
88005
+ "mcp",
88006
+ "tool.use",
88007
+ "research",
88008
+ "responses:create"
88009
+ ];
87972
88010
  DEFAULT_API_KEY_SCOPES = [
87973
88011
  "agent:register",
87974
88012
  "agent:heartbeat",
@@ -136858,6 +136896,7 @@ function printHelp(version3) {
136858
136896
  const initSection = `${sectionHeading("maestro init")}${muted(` maestro init Login, create or reuse an API key, and register this agent
136859
136897
  maestro init --rotate-key Replace the stored agent MCP API key
136860
136898
  maestro init --mcp-url <url> Override the EvalOps agent MCP endpoint
136899
+ maestro init --capability code:write Declare an agent-registry capability
136861
136900
  maestro init --json Emit machine-readable bootstrap output`)}`;
136862
136901
  const hostedRunnerSection = `${sectionHeading("maestro hosted-runner")}${muted(` maestro hosted-runner --runner-session-id <id> --workspace-root <path> [--listen 0.0.0.0:8080]
136863
136902
 
@@ -170440,6 +170479,229 @@ Environment:
170440
170479
  MAESTRO_ATTACH_AUDIENCE`;
170441
170480
  var init_hosted_runner = () => {
170442
170481
  };
170482
+ var exports_init = {};
170483
+ __export2(exports_init, {
170484
+ parseInitArgs: () => parseInitArgs,
170485
+ handleInitCommand: () => handleInitCommand2,
170486
+ formatInitSuccess: () => formatInitSuccess,
170487
+ formatInitHelp: () => formatInitHelp
170488
+ });
170489
+ function formatInitHelp() {
170490
+ return `${sectionHeading("maestro init")}${muted(` maestro init Login, create or reuse an API key, and register this agent
170491
+ maestro init --rotate-key Replace the stored agent MCP API key
170492
+ maestro init --mcp-url <url> Override the EvalOps agent MCP endpoint
170493
+ maestro init --json Emit machine-readable bootstrap output
170494
+
170495
+ Options
170496
+ --agent-type <type> Agent type to register, defaults to maestro
170497
+ --surface <surface> Surface to register, defaults to cli
170498
+ --integration-profile <profile> mcp_only, mcp_otlp, managed_runtime, sdk_integrated, or provider_proxy
170499
+ --shim-type <type> native_mcp, command_wrapper, hook, provider_proxy, sdk, or mcp_firewall_proxy
170500
+ --trace-mode <mode> none, mcp_events, or otlp
170501
+ --memory-mode <mode> none, read_only, durable, or cerebro
170502
+ --runtime-owner <owner> external or evalops
170503
+ --capability <cap[,cap...]> Agent capability to declare; repeatable
170504
+ --workspace, --workspace-id <id> Workspace to associate with the registration
170505
+ --scope <scope[,scope...]> Registration scopes to request
170506
+ --key-scope <scope[,scope...]> API key scopes to request
170507
+ --expires-in-days <days> API key TTL in days
170508
+ --force-login Re-run EvalOps OAuth before bootstrapping
170509
+ --manifest-url <url> Override the agent MCP manifest URL
170510
+ --ttl-seconds <seconds> Registration TTL in seconds`)}`;
170511
+ }
170512
+ function readValue(args, index2, flag) {
170513
+ const value = args[index2 + 1];
170514
+ if (!value || value.startsWith("-")) {
170515
+ throw new Error(`${flag} requires a value`);
170516
+ }
170517
+ return value;
170518
+ }
170519
+ function parsePositiveInteger(value, flag) {
170520
+ const parsed = Number.parseInt(value, 10);
170521
+ if (!Number.isInteger(parsed) || parsed <= 0) {
170522
+ throw new Error(`${flag} must be a positive integer`);
170523
+ }
170524
+ return parsed;
170525
+ }
170526
+ function appendScopes(existing, value) {
170527
+ return [
170528
+ ...existing ?? [],
170529
+ ...value.split(",").map((entry2) => entry2.trim()).filter((entry2) => entry2.length > 0)
170530
+ ];
170531
+ }
170532
+ function parseInitArgs(args) {
170533
+ const options = {};
170534
+ for (let i2 = 0; i2 < args.length; i2++) {
170535
+ const arg = args[i2];
170536
+ switch (arg) {
170537
+ case "--agent-mcp-url":
170538
+ case "--mcp-url":
170539
+ options.mcpUrl = readValue(args, i2, arg);
170540
+ i2++;
170541
+ break;
170542
+ case "--agent-type":
170543
+ options.agentType = readValue(args, i2, arg);
170544
+ i2++;
170545
+ break;
170546
+ case "--api-key-scope":
170547
+ case "--key-scope":
170548
+ options.apiKeyScopes = appendScopes(options.apiKeyScopes, readValue(args, i2, arg));
170549
+ i2++;
170550
+ break;
170551
+ case "--capabilities":
170552
+ case "--capability":
170553
+ options.capabilities = appendScopes(options.capabilities, readValue(args, i2, arg));
170554
+ i2++;
170555
+ break;
170556
+ case "--expires-in-days":
170557
+ options.expiresInDays = parsePositiveInteger(readValue(args, i2, arg), arg);
170558
+ i2++;
170559
+ break;
170560
+ case "--force-login":
170561
+ options.forceLogin = true;
170562
+ break;
170563
+ case "--integration-profile":
170564
+ options.integrationProfile = readValue(args, i2, arg);
170565
+ i2++;
170566
+ break;
170567
+ case "--json":
170568
+ options.json = true;
170569
+ break;
170570
+ case "--key-name":
170571
+ options.keyName = readValue(args, i2, arg);
170572
+ i2++;
170573
+ break;
170574
+ case "--manifest-url":
170575
+ options.manifestUrl = readValue(args, i2, arg);
170576
+ i2++;
170577
+ break;
170578
+ case "--memory-mode":
170579
+ options.memoryMode = readValue(args, i2, arg);
170580
+ i2++;
170581
+ break;
170582
+ case "--register-scope":
170583
+ case "--scope":
170584
+ options.registerScopes = appendScopes(options.registerScopes, readValue(args, i2, arg));
170585
+ i2++;
170586
+ break;
170587
+ case "--rotate-key":
170588
+ options.rotateKey = true;
170589
+ break;
170590
+ case "--runtime-owner":
170591
+ options.runtimeOwner = readValue(args, i2, arg);
170592
+ i2++;
170593
+ break;
170594
+ case "--shim-type":
170595
+ options.shimType = readValue(args, i2, arg);
170596
+ i2++;
170597
+ break;
170598
+ case "--surface":
170599
+ options.surface = readValue(args, i2, arg);
170600
+ i2++;
170601
+ break;
170602
+ case "--trace-mode":
170603
+ options.traceMode = readValue(args, i2, arg);
170604
+ i2++;
170605
+ break;
170606
+ case "--ttl-seconds":
170607
+ options.ttlSeconds = parsePositiveInteger(readValue(args, i2, arg), arg);
170608
+ i2++;
170609
+ break;
170610
+ case "--workspace":
170611
+ case "--workspace-id":
170612
+ options.workspaceId = readValue(args, i2, arg);
170613
+ i2++;
170614
+ break;
170615
+ default:
170616
+ if (arg?.startsWith("-")) {
170617
+ throw new Error(`Unknown maestro init option: ${arg}`);
170618
+ }
170619
+ throw new Error(`Unexpected maestro init argument: ${arg}`);
170620
+ }
170621
+ }
170622
+ return options;
170623
+ }
170624
+ function checkLine(text2) {
170625
+ return `${chalk61.green("\u2713")} ${text2}`;
170626
+ }
170627
+ function formatInitSuccess(result) {
170628
+ const keyMode = result.apiKeyCreated ? "Created" : "Reused";
170629
+ const authenticatedAs = result.authenticatedAs ?? "EvalOps";
170630
+ const governedActions = result.governedActionsLoaded ?? 0;
170631
+ const lines = [
170632
+ chalk61.bold("EvalOps Maestro bootstrap"),
170633
+ "",
170634
+ checkLine(`Authenticated as ${authenticatedAs}`),
170635
+ checkLine(`${keyMode} managed inference key`),
170636
+ checkLine("Registered local agent runtime"),
170637
+ checkLine(`Integration profile ${result.integrationProfile ?? "managed_runtime"} via ${result.shimType ?? "sdk"}`),
170638
+ checkLine(`Loaded ${governedActions} governed actions`),
170639
+ checkLine(result.approvalPolicyAttached ? "Attached default approval policy" : "Queued approval policy review"),
170640
+ checkLine(result.traceIngestionStarted ? "Started trace ingestion" : "Requested trace ingestion"),
170641
+ checkLine(result.governedInferenceCheckRan ? "Ran first governed inference check" : "Queued first governed inference check"),
170642
+ checkLine(result.evidenceEventPublished ? "Published evidence event" : "Queued evidence event"),
170643
+ "",
170644
+ "Open console:",
170645
+ result.consoleUrl ?? "https://app.evalops.dev/overview?env=production"
170646
+ ];
170647
+ return lines.join(`
170648
+ `);
170649
+ }
170650
+ async function handleInitCommand2(args = []) {
170651
+ if (args.includes("--help") || args.includes("-h")) {
170652
+ console.log(formatInitHelp());
170653
+ return;
170654
+ }
170655
+ let options;
170656
+ try {
170657
+ options = parseInitArgs(args);
170658
+ } catch (error) {
170659
+ console.error(chalk61.red(error instanceof Error ? error.message : String(error)));
170660
+ process.exit(1);
170661
+ }
170662
+ const result = await bootstrapEvalOpsAgent(options, {
170663
+ onAuthUrl: (url) => {
170664
+ if (options.json) {
170665
+ console.error("Open this URL in your browser to authenticate with EvalOps:");
170666
+ console.error(url);
170667
+ return;
170668
+ }
170669
+ console.log(chalk61.yellow("Open this URL in your browser to authenticate with EvalOps:"));
170670
+ console.log(chalk61.underline(url));
170671
+ },
170672
+ onStatus: (status) => {
170673
+ if (options.json) {
170674
+ console.error(status.message);
170675
+ return;
170676
+ }
170677
+ console.log(chalk61.dim(status.message));
170678
+ }
170679
+ });
170680
+ if (options.json) {
170681
+ console.log(JSON.stringify(result, null, 2));
170682
+ return;
170683
+ }
170684
+ console.log(formatInitSuccess(result));
170685
+ }
170686
+ var init_init = __esm2(() => {
170687
+ init_agent_bootstrap();
170688
+ init_theme2();
170689
+ });
170690
+ var exports_status = {};
170691
+ __export2(exports_status, {
170692
+ handleStatusCommand: () => handleStatusCommand
170693
+ });
170694
+ async function handleStatusCommand() {
170695
+ const context2 = resolveManagedEvalOpsContext();
170696
+ console.log(chalk62.bold("Maestro status"));
170697
+ console.log(formatManagedEvalOpsStatus(context2));
170698
+ if (!context2.authenticated) {
170699
+ console.log(chalk62.dim('Run "maestro init" to bring EvalOps managed mode online.'));
170700
+ }
170701
+ }
170702
+ var init_status4 = __esm2(() => {
170703
+ init_managed_context();
170704
+ });
170443
170705
  var exports_config = {};
170444
170706
  __export2(exports_config, {
170445
170707
  handleConfigValidate: () => handleConfigValidate,
@@ -170609,7 +170871,7 @@ function buildConfigShowSections(inspection, options) {
170609
170871
  output.push(badge(`Providers (${inspection.providers.length})`, void 0, "info"));
170610
170872
  for (const provider of inspection.providers) {
170611
170873
  const isOverrideOnly = provider.modelCount === 0;
170612
- const heading2 = `${chalk61.cyan(provider.id)} ${muted(`(${provider.modelCount} models)`)}`;
170874
+ const heading2 = `${chalk63.cyan(provider.id)} ${muted(`(${provider.modelCount} models)`)}`;
170613
170875
  const enabledBadge = provider.enabled ? badge("enabled", void 0, "success") : badge("disabled", void 0, "warn");
170614
170876
  const metaBadges = [];
170615
170877
  if (isOverrideOnly) {
@@ -170664,7 +170926,7 @@ function buildConfigShowSections(inspection, options) {
170664
170926
  for (const envVar of inspection.envVars) {
170665
170927
  const status = envVar.set ? badge("set", void 0, "success") : badge("missing", void 0, "warn");
170666
170928
  const value = envVar.maskedValue ? envVar.maskedValue : "(not set)";
170667
- output.push(` ${status} ${chalk61.cyan(envVar.name)}: ${muted(value)}`);
170929
+ output.push(` ${status} ${chalk63.cyan(envVar.name)}: ${muted(value)}`);
170668
170930
  }
170669
170931
  output.push("");
170670
170932
  }
@@ -170688,14 +170950,14 @@ async function handleConfigValidate() {
170688
170950
  if (result.errors.length > 0) {
170689
170951
  console.log(badge("[ERROR] Errors", void 0, "danger"));
170690
170952
  for (const error of result.errors) {
170691
- console.log(chalk61.red(` \u2022 ${error}`));
170953
+ console.log(chalk63.red(` \u2022 ${error}`));
170692
170954
  }
170693
170955
  console.log();
170694
170956
  }
170695
170957
  if (result.warnings.length > 0) {
170696
170958
  console.log(badge("[WARN] Warnings", void 0, "warn"));
170697
170959
  for (const warning of result.warnings) {
170698
- console.log(chalk61.yellow(` \u2022 ${warning}`));
170960
+ console.log(chalk63.yellow(` \u2022 ${warning}`));
170699
170961
  }
170700
170962
  console.log();
170701
170963
  }
@@ -170729,7 +170991,7 @@ function renderConfigShowLegacy(inspection, hierarchy, homeDir) {
170729
170991
  console.log(badge(`Providers (${inspection.providers.length})`, void 0, "info"));
170730
170992
  for (const provider of inspection.providers) {
170731
170993
  const isOverrideOnly = provider.modelCount === 0;
170732
- const heading2 = `${chalk61.cyan(provider.id)} ${muted(`(${provider.modelCount} models)`)}`;
170994
+ const heading2 = `${chalk63.cyan(provider.id)} ${muted(`(${provider.modelCount} models)`)}`;
170733
170995
  const enabledBadge = provider.enabled ? badge("enabled", void 0, "success") : badge("disabled", void 0, "warn");
170734
170996
  const metaBadges = [];
170735
170997
  if (isOverrideOnly) {
@@ -170785,7 +171047,7 @@ function renderConfigShowLegacy(inspection, hierarchy, homeDir) {
170785
171047
  for (const envVar of inspection.envVars) {
170786
171048
  const status = envVar.set ? badge("set", void 0, "success") : badge("missing", void 0, "warn");
170787
171049
  const value = envVar.maskedValue ? envVar.maskedValue : "(not set)";
170788
- console.log(` ${status} ${chalk61.cyan(envVar.name)}: ${muted(value)}`);
171050
+ console.log(` ${status} ${chalk63.cyan(envVar.name)}: ${muted(value)}`);
170789
171051
  }
170790
171052
  console.log();
170791
171053
  }
@@ -170822,7 +171084,7 @@ async function handleConfigInit() {
170822
171084
  const configPath2 = join82(configDir, "config.json");
170823
171085
  const promptsDir = join82(configDir, "prompts");
170824
171086
  if (existsSync103(configPath2)) {
170825
- const overwrite = await rl.question(chalk61.yellow(`Config already exists at ${configPath2}. Overwrite? (y/N): `));
171087
+ const overwrite = await rl.question(chalk63.yellow(`Config already exists at ${configPath2}. Overwrite? (y/N): `));
170826
171088
  if (overwrite.toLowerCase() !== "y") {
170827
171089
  console.log(muted(`
170828
171090
  Cancelled.`));
@@ -170836,23 +171098,23 @@ Cancelled.`));
170836
171098
  console.log(`
170837
171099
  ${badge("1. Choose your provider", void 0, "info")}`);
170838
171100
  providerPresets.forEach((preset2, idx) => {
170839
- const note = preset2.note ? chalk61.dim(` \u2014 ${preset2.note}`) : "";
171101
+ const note = preset2.note ? chalk63.dim(` \u2014 ${preset2.note}`) : "";
170840
171102
  console.log(` ${idx + 1}) ${preset2.name}${note}`);
170841
171103
  });
170842
171104
  let preset;
170843
171105
  if (presetId) {
170844
171106
  const found = providerPresets.find((p) => p.id.toLowerCase() === presetId.toLowerCase());
170845
171107
  if (!found) {
170846
- console.log(chalk61.yellow(`
171108
+ console.log(chalk63.yellow(`
170847
171109
  Unknown preset "${presetId}", falling back to menu selection.`));
170848
171110
  } else {
170849
171111
  preset = found;
170850
- console.log(chalk61.green(`
171112
+ console.log(chalk63.green(`
170851
171113
  Using preset: ${preset.name}`));
170852
171114
  }
170853
171115
  }
170854
171116
  if (!preset) {
170855
- const providerChoice = await rl.question(chalk61.cyan(`
171117
+ const providerChoice = await rl.question(chalk63.cyan(`
170856
171118
  Provider (1-${providerPresets.length}): `));
170857
171119
  const presetIndex = Number.parseInt(providerChoice.trim(), 10) - 1 >= 0 && Number.parseInt(providerChoice.trim(), 10) - 1 < providerPresets.length ? Number.parseInt(providerChoice.trim(), 10) - 1 : 0;
170858
171120
  preset = providerPresets[presetIndex] ?? providerPresets[0];
@@ -170875,17 +171137,17 @@ Provider (1-${providerPresets.length}): `));
170875
171137
  ${badge("2. How would you like to provide your API key?", void 0, "info")}`);
170876
171138
  console.log(" 1) Environment variable (recommended)");
170877
171139
  console.log(" 2) Direct in config (not recommended)");
170878
- const keyChoice = await rl.question(chalk61.cyan(`
171140
+ const keyChoice = await rl.question(chalk63.cyan(`
170879
171141
  Choice (1-2): `));
170880
171142
  useEnv = keyChoice.trim() !== "2";
170881
171143
  if (useEnv) {
170882
171144
  const fallbackEnv = getEnvVarsForProvider(providerId)[0] ?? `${providerId.toUpperCase().replace(/[^A-Z0-9]/g, "_")}_API_KEY`;
170883
171145
  const envVarName = preset.apiKeyEnv ?? fallbackEnv;
170884
171146
  apiKeyField = { apiKeyEnv: envVarName };
170885
- console.log(chalk61.dim(`
171147
+ console.log(chalk63.dim(`
170886
171148
  Using environment variable: ${envVarName}`));
170887
171149
  } else {
170888
- const apiKey = await rl.question(chalk61.cyan(`
171150
+ const apiKey = await rl.question(chalk63.cyan(`
170889
171151
  Enter API key: `));
170890
171152
  apiKeyField = { apiKey: apiKey.trim() };
170891
171153
  }
@@ -170894,12 +171156,12 @@ Enter API key: `));
170894
171156
  const noKeyMessage = isEvalOpsManagedProvider(providerId) ? `
170895
171157
  Managed gateway preset does not use a local API key. Run maestro evalops login after setup.` : `
170896
171158
  Local providers do not require API keys. Skipping step.`;
170897
- console.log(chalk61.dim(noKeyMessage));
171159
+ console.log(chalk63.dim(noKeyMessage));
170898
171160
  }
170899
171161
  console.log(`
170900
171162
  ${badge("3. Would you like to use file references for prompts?", void 0, "info")}`);
170901
171163
  console.log(" This creates a prompts/ folder for better organization.");
170902
- const useFiles = await rl.question(chalk61.cyan(`
171164
+ const useFiles = await rl.question(chalk63.cyan(`
170903
171165
  Use file references? (Y/n): `));
170904
171166
  const createPrompts = useFiles.toLowerCase() !== "n";
170905
171167
  mkdirSync40(configDir, { recursive: true });
@@ -171042,11 +171304,11 @@ async function checkLocalEndpoint(name, baseUrl) {
171042
171304
  url.pathname = "/models";
171043
171305
  const response = await fetch(url.toString(), { method: "GET" });
171044
171306
  if (response.ok) {
171045
- return `${badge(name, void 0, "success")} ${chalk61.dim(`responded with ${response.status}`)}`;
171307
+ return `${badge(name, void 0, "success")} ${chalk63.dim(`responded with ${response.status}`)}`;
171046
171308
  }
171047
- return `${badge(name, void 0, "warn")} ${chalk61.dim(`HTTP ${response.status}`)}`;
171309
+ return `${badge(name, void 0, "warn")} ${chalk63.dim(`HTTP ${response.status}`)}`;
171048
171310
  } catch (error) {
171049
- return `${badge(name, void 0, "danger")} ${chalk61.dim(error instanceof Error ? error.message : String(error))}`;
171311
+ return `${badge(name, void 0, "danger")} ${chalk63.dim(error instanceof Error ? error.message : String(error))}`;
171050
171312
  }
171051
171313
  }
171052
171314
  async function handleConfigLocal() {
@@ -171061,7 +171323,7 @@ async function handleConfigLocal() {
171061
171323
  console.log(" 2) Add Ollama provider");
171062
171324
  console.log(" 3) Check local endpoints");
171063
171325
  console.log(" 4) Cancel");
171064
- const choice = (await rl.question(chalk61.cyan(`
171326
+ const choice = (await rl.question(chalk63.cyan(`
171065
171327
  Choice (1-4): `))).trim();
171066
171328
  if (choice === "4") {
171067
171329
  console.log(muted(`
@@ -171085,12 +171347,12 @@ Cancelled.`));
171085
171347
  const templateKey = choice === "2" ? "ollama" : "lmstudio";
171086
171348
  const template = LOCAL_PROVIDER_TEMPLATES[templateKey];
171087
171349
  if (!template) {
171088
- console.log(chalk61.red(`
171350
+ console.log(chalk63.red(`
171089
171351
  Unknown template: ${templateKey}`));
171090
171352
  rl.close();
171091
171353
  return;
171092
171354
  }
171093
- const scope = (await rl.question(chalk61.cyan(`
171355
+ const scope = (await rl.question(chalk63.cyan(`
171094
171356
  Save provider to:
171095
171357
  1) Project (.maestro/local.json)
171096
171358
  2) Home (~/.maestro/local.json)
@@ -171100,14 +171362,14 @@ Choice (1-2): `))).trim();
171100
171362
  mkdirSync40(targetDir, { recursive: true });
171101
171363
  const localPath = join82(targetDir, "local.json");
171102
171364
  const config2 = loadLocalConfig(localPath);
171103
- const providerId = (await rl.question(chalk61.cyan(`
171365
+ const providerId = (await rl.question(chalk63.cyan(`
171104
171366
  Provider id (${template.id}): `))).trim() || template.id;
171105
- const providerName = (await rl.question(chalk61.cyan(`Provider name (${template.name}): `))).trim() || template.name;
171106
- const baseUrl = (await rl.question(chalk61.cyan(`Base URL (${template.baseUrl}): `))).trim() || template.baseUrl;
171107
- const modelId = (await rl.question(chalk61.cyan(`Model id (${template.model.id}): `))).trim() || template.model.id;
171108
- const modelName = (await rl.question(chalk61.cyan(`Model name (${template.model.name}): `))).trim() || template.model.name;
171109
- const contextWindowAnswer = (await rl.question(chalk61.cyan(`Context window (${template.model.contextWindow}): `))).trim();
171110
- const maxTokensAnswer = (await rl.question(chalk61.cyan(`Max output tokens (${template.model.maxTokens}): `))).trim();
171367
+ const providerName = (await rl.question(chalk63.cyan(`Provider name (${template.name}): `))).trim() || template.name;
171368
+ const baseUrl = (await rl.question(chalk63.cyan(`Base URL (${template.baseUrl}): `))).trim() || template.baseUrl;
171369
+ const modelId = (await rl.question(chalk63.cyan(`Model id (${template.model.id}): `))).trim() || template.model.id;
171370
+ const modelName = (await rl.question(chalk63.cyan(`Model name (${template.model.name}): `))).trim() || template.model.name;
171371
+ const contextWindowAnswer = (await rl.question(chalk63.cyan(`Context window (${template.model.contextWindow}): `))).trim();
171372
+ const maxTokensAnswer = (await rl.question(chalk63.cyan(`Max output tokens (${template.model.maxTokens}): `))).trim();
171111
171373
  const contextWindow = Number.parseInt(contextWindowAnswer, 10) || template.model.contextWindow;
171112
171374
  const maxTokens = Number.parseInt(maxTokensAnswer, 10) || template.model.maxTokens;
171113
171375
  upsertLocalProvider(config2, template, {
@@ -171151,7 +171413,7 @@ function formatModelLabel2(model) {
171151
171413
  if (model.input?.includes("image")) {
171152
171414
  caps.push("vision");
171153
171415
  }
171154
- const suffix = caps.length ? ` ${chalk61.dim(`[${caps.join(", ")}]`)}` : "";
171416
+ const suffix = caps.length ? ` ${chalk63.dim(`[${caps.join(", ")}]`)}` : "";
171155
171417
  return `${model.id}${suffix}`;
171156
171418
  }
171157
171419
  var ANSI_STRING_TERMINATORS3 = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
@@ -171213,15 +171475,15 @@ async function handleOpenAICommand(subcommand, _params = []) {
171213
171475
  await handleStatus2();
171214
171476
  return;
171215
171477
  default:
171216
- console.error(chalk62.red('Unknown openai subcommand. Try "maestro openai login", "logout", or "status".'));
171478
+ console.error(chalk64.red('Unknown openai subcommand. Try "maestro openai login", "logout", or "status".'));
171217
171479
  process.exit(1);
171218
171480
  }
171219
171481
  }
171220
171482
  async function handleLogin2() {
171221
- console.log(chalk62.bold("Maestro OpenAI Login"));
171483
+ console.log(chalk64.bold("Maestro OpenAI Login"));
171222
171484
  const { url, verifier, state: state2 } = await generateOpenAILoginUrl();
171223
- console.log(chalk62.yellow("Please open the following URL in your browser to authenticate:"));
171224
- console.log(chalk62.underline(url));
171485
+ console.log(chalk64.yellow("Please open the following URL in your browser to authenticate:"));
171486
+ console.log(chalk64.underline(url));
171225
171487
  const server = createServer7(async (req, res) => {
171226
171488
  const reqUrl = new URL2(req.url ?? "", CALLBACK_ORIGIN4);
171227
171489
  if (reqUrl.pathname === "/auth/callback") {
@@ -171258,12 +171520,12 @@ async function handleLogin2() {
171258
171520
  });
171259
171521
  res.writeHead(200, { "Content-Type": "text/html" });
171260
171522
  res.end("<html><body><h1>Login Successful</h1><p>You can close this tab and return to the terminal.</p></body></html>");
171261
- console.log(chalk62.green(`
171523
+ console.log(chalk64.green(`
171262
171524
  OpenAI credentials saved successfully.`));
171263
- console.log(chalk62.dim("Future runs can use --auth auto (default) or provide an OpenAI API key."));
171525
+ console.log(chalk64.dim("Future runs can use --auth auto (default) or provide an OpenAI API key."));
171264
171526
  } catch (error) {
171265
171527
  const errorMsg = error instanceof Error ? error.message : "Unknown error";
171266
- console.error(chalk62.red(`
171528
+ console.error(chalk64.red(`
171267
171529
  Login failed: ${errorMsg}`));
171268
171530
  res.writeHead(500, { "Content-Type": "text/plain" });
171269
171531
  res.end("Login failed. Check terminal for details.");
@@ -171277,32 +171539,32 @@ Login failed: ${errorMsg}`));
171277
171539
  });
171278
171540
  server.on("error", (e2) => {
171279
171541
  if (e2.code === "EADDRINUSE") {
171280
- console.error(chalk62.red(`Port ${DEFAULT_PORT} is already in use. Please close the other process and try again.`));
171542
+ console.error(chalk64.red(`Port ${DEFAULT_PORT} is already in use. Please close the other process and try again.`));
171281
171543
  process.exit(1);
171282
171544
  }
171283
- console.error(chalk62.red(`Server error: ${e2.message}`));
171545
+ console.error(chalk64.red(`Server error: ${e2.message}`));
171284
171546
  process.exit(1);
171285
171547
  });
171286
171548
  server.listen(DEFAULT_PORT, "127.0.0.1");
171287
171549
  }
171288
171550
  async function handleLogout() {
171289
171551
  await deleteOpenAIOAuthCredential();
171290
- console.log(chalk62.green("Removed stored OpenAI credentials."));
171552
+ console.log(chalk64.green("Removed stored OpenAI credentials."));
171291
171553
  }
171292
171554
  async function handleStatus2() {
171293
171555
  const stored = await getStoredOpenAIOAuthCredential();
171294
171556
  if (!stored) {
171295
- console.log(chalk62.yellow("No stored OpenAI credentials."));
171296
- console.log(chalk62.dim('Run "maestro openai login" to authenticate with OpenAI.'));
171557
+ console.log(chalk64.yellow("No stored OpenAI credentials."));
171558
+ console.log(chalk64.dim('Run "maestro openai login" to authenticate with OpenAI.'));
171297
171559
  return;
171298
171560
  }
171299
171561
  const remainingMs = Math.max(0, stored.expiresAt - Date.now());
171300
171562
  const minutes = Math.round(remainingMs / 6e4);
171301
- console.log(chalk62.green("Stored OpenAI credentials detected."));
171302
- console.log(chalk62.dim(`Access token expires in ~${minutes} minute${minutes === 1 ? "" : "s"} (auto-refresh enabled).`));
171563
+ console.log(chalk64.green("Stored OpenAI credentials detected."));
171564
+ console.log(chalk64.dim(`Access token expires in ~${minutes} minute${minutes === 1 ? "" : "s"} (auto-refresh enabled).`));
171303
171565
  const fresh = await getFreshOpenAIOAuthCredential();
171304
171566
  if (fresh) {
171305
- console.log(chalk62.dim("Credentials refreshed."));
171567
+ console.log(chalk64.dim("Credentials refreshed."));
171306
171568
  }
171307
171569
  }
171308
171570
  var CALLBACK_ORIGIN4;
@@ -171310,208 +171572,6 @@ var init_openai3 = __esm2(() => {
171310
171572
  init_openai_auth();
171311
171573
  CALLBACK_ORIGIN4 = `http://127.0.0.1:${DEFAULT_PORT}`;
171312
171574
  });
171313
- var exports_init = {};
171314
- __export2(exports_init, {
171315
- parseInitArgs: () => parseInitArgs,
171316
- handleInitCommand: () => handleInitCommand2,
171317
- formatInitSuccess: () => formatInitSuccess,
171318
- formatInitHelp: () => formatInitHelp
171319
- });
171320
- function formatInitHelp() {
171321
- return `${sectionHeading("maestro init")}${muted(` maestro init Login, create or reuse an API key, and register this agent
171322
- maestro init --rotate-key Replace the stored agent MCP API key
171323
- maestro init --mcp-url <url> Override the EvalOps agent MCP endpoint
171324
- maestro init --json Emit machine-readable bootstrap output
171325
-
171326
- Options
171327
- --agent-type <type> Agent type to register, defaults to maestro
171328
- --surface <surface> Surface to register, defaults to cli
171329
- --integration-profile <profile> mcp_only, mcp_otlp, managed_runtime, sdk_integrated, or provider_proxy
171330
- --shim-type <type> native_mcp, command_wrapper, hook, provider_proxy, sdk, or mcp_firewall_proxy
171331
- --trace-mode <mode> none, mcp_events, or otlp
171332
- --memory-mode <mode> none, read_only, durable, or cerebro
171333
- --runtime-owner <owner> external or evalops
171334
- --workspace, --workspace-id <id> Workspace to associate with the registration
171335
- --scope <scope[,scope...]> Registration scopes to request
171336
- --key-scope <scope[,scope...]> API key scopes to request
171337
- --expires-in-days <days> API key TTL in days
171338
- --force-login Re-run EvalOps OAuth before bootstrapping
171339
- --manifest-url <url> Override the agent MCP manifest URL
171340
- --ttl-seconds <seconds> Registration TTL in seconds`)}`;
171341
- }
171342
- function readValue(args, index2, flag) {
171343
- const value = args[index2 + 1];
171344
- if (!value || value.startsWith("-")) {
171345
- throw new Error(`${flag} requires a value`);
171346
- }
171347
- return value;
171348
- }
171349
- function parsePositiveInteger(value, flag) {
171350
- const parsed = Number.parseInt(value, 10);
171351
- if (!Number.isInteger(parsed) || parsed <= 0) {
171352
- throw new Error(`${flag} must be a positive integer`);
171353
- }
171354
- return parsed;
171355
- }
171356
- function appendScopes(existing, value) {
171357
- return [
171358
- ...existing ?? [],
171359
- ...value.split(",").map((entry2) => entry2.trim()).filter((entry2) => entry2.length > 0)
171360
- ];
171361
- }
171362
- function parseInitArgs(args) {
171363
- const options = {};
171364
- for (let i2 = 0; i2 < args.length; i2++) {
171365
- const arg = args[i2];
171366
- switch (arg) {
171367
- case "--agent-mcp-url":
171368
- case "--mcp-url":
171369
- options.mcpUrl = readValue(args, i2, arg);
171370
- i2++;
171371
- break;
171372
- case "--agent-type":
171373
- options.agentType = readValue(args, i2, arg);
171374
- i2++;
171375
- break;
171376
- case "--api-key-scope":
171377
- case "--key-scope":
171378
- options.apiKeyScopes = appendScopes(options.apiKeyScopes, readValue(args, i2, arg));
171379
- i2++;
171380
- break;
171381
- case "--expires-in-days":
171382
- options.expiresInDays = parsePositiveInteger(readValue(args, i2, arg), arg);
171383
- i2++;
171384
- break;
171385
- case "--force-login":
171386
- options.forceLogin = true;
171387
- break;
171388
- case "--integration-profile":
171389
- options.integrationProfile = readValue(args, i2, arg);
171390
- i2++;
171391
- break;
171392
- case "--json":
171393
- options.json = true;
171394
- break;
171395
- case "--key-name":
171396
- options.keyName = readValue(args, i2, arg);
171397
- i2++;
171398
- break;
171399
- case "--manifest-url":
171400
- options.manifestUrl = readValue(args, i2, arg);
171401
- i2++;
171402
- break;
171403
- case "--memory-mode":
171404
- options.memoryMode = readValue(args, i2, arg);
171405
- i2++;
171406
- break;
171407
- case "--register-scope":
171408
- case "--scope":
171409
- options.registerScopes = appendScopes(options.registerScopes, readValue(args, i2, arg));
171410
- i2++;
171411
- break;
171412
- case "--rotate-key":
171413
- options.rotateKey = true;
171414
- break;
171415
- case "--runtime-owner":
171416
- options.runtimeOwner = readValue(args, i2, arg);
171417
- i2++;
171418
- break;
171419
- case "--shim-type":
171420
- options.shimType = readValue(args, i2, arg);
171421
- i2++;
171422
- break;
171423
- case "--surface":
171424
- options.surface = readValue(args, i2, arg);
171425
- i2++;
171426
- break;
171427
- case "--trace-mode":
171428
- options.traceMode = readValue(args, i2, arg);
171429
- i2++;
171430
- break;
171431
- case "--ttl-seconds":
171432
- options.ttlSeconds = parsePositiveInteger(readValue(args, i2, arg), arg);
171433
- i2++;
171434
- break;
171435
- case "--workspace":
171436
- case "--workspace-id":
171437
- options.workspaceId = readValue(args, i2, arg);
171438
- i2++;
171439
- break;
171440
- default:
171441
- if (arg?.startsWith("-")) {
171442
- throw new Error(`Unknown maestro init option: ${arg}`);
171443
- }
171444
- throw new Error(`Unexpected maestro init argument: ${arg}`);
171445
- }
171446
- }
171447
- return options;
171448
- }
171449
- function checkLine(text2) {
171450
- return `${chalk63.green("\u2713")} ${text2}`;
171451
- }
171452
- function formatInitSuccess(result) {
171453
- const keyMode = result.apiKeyCreated ? "Created" : "Reused";
171454
- const authenticatedAs = result.authenticatedAs ?? "EvalOps";
171455
- const governedActions = result.governedActionsLoaded ?? 0;
171456
- const lines = [
171457
- chalk63.bold("EvalOps Maestro bootstrap"),
171458
- "",
171459
- checkLine(`Authenticated as ${authenticatedAs}`),
171460
- checkLine(`${keyMode} managed inference key`),
171461
- checkLine("Registered local agent runtime"),
171462
- checkLine(`Integration profile ${result.integrationProfile ?? "managed_runtime"} via ${result.shimType ?? "sdk"}`),
171463
- checkLine(`Loaded ${governedActions} governed actions`),
171464
- checkLine(result.approvalPolicyAttached ? "Attached default approval policy" : "Queued approval policy review"),
171465
- checkLine(result.traceIngestionStarted ? "Started trace ingestion" : "Requested trace ingestion"),
171466
- checkLine(result.governedInferenceCheckRan ? "Ran first governed inference check" : "Queued first governed inference check"),
171467
- checkLine(result.evidenceEventPublished ? "Published evidence event" : "Queued evidence event"),
171468
- "",
171469
- "Open console:",
171470
- result.consoleUrl ?? "https://app.evalops.dev/overview?env=production"
171471
- ];
171472
- return lines.join(`
171473
- `);
171474
- }
171475
- async function handleInitCommand2(args = []) {
171476
- if (args.includes("--help") || args.includes("-h")) {
171477
- console.log(formatInitHelp());
171478
- return;
171479
- }
171480
- let options;
171481
- try {
171482
- options = parseInitArgs(args);
171483
- } catch (error) {
171484
- console.error(chalk63.red(error instanceof Error ? error.message : String(error)));
171485
- process.exit(1);
171486
- }
171487
- const result = await bootstrapEvalOpsAgent(options, {
171488
- onAuthUrl: (url) => {
171489
- if (options.json) {
171490
- console.error("Open this URL in your browser to authenticate with EvalOps:");
171491
- console.error(url);
171492
- return;
171493
- }
171494
- console.log(chalk63.yellow("Open this URL in your browser to authenticate with EvalOps:"));
171495
- console.log(chalk63.underline(url));
171496
- },
171497
- onStatus: (status) => {
171498
- if (options.json) {
171499
- console.error(status.message);
171500
- return;
171501
- }
171502
- console.log(chalk63.dim(status.message));
171503
- }
171504
- });
171505
- if (options.json) {
171506
- console.log(JSON.stringify(result, null, 2));
171507
- return;
171508
- }
171509
- console.log(formatInitSuccess(result));
171510
- }
171511
- var init_init = __esm2(() => {
171512
- init_agent_bootstrap();
171513
- init_theme2();
171514
- });
171515
171575
  var exports_evalops = {};
171516
171576
  __export2(exports_evalops, {
171517
171577
  handleEvalOpsStatus: () => handleEvalOpsStatus,
@@ -171534,58 +171594,43 @@ async function handleEvalOpsCommand(subcommand, args = []) {
171534
171594
  await handleEvalOpsStatus();
171535
171595
  return;
171536
171596
  default:
171537
- console.error(chalk64.red('Unknown evalops subcommand. Try "maestro init" for setup, or "maestro evalops login", "logout", or "status".'));
171597
+ console.error(chalk65.red('Unknown evalops subcommand. Try "maestro init" for setup, or "maestro evalops login", "logout", or "status".'));
171538
171598
  process.exit(1);
171539
171599
  }
171540
171600
  }
171541
171601
  async function handleLogin3() {
171542
- console.log(chalk64.bold("Maestro EvalOps Login"));
171602
+ console.log(chalk65.bold("Maestro EvalOps Login"));
171543
171603
  await login("evalops", {
171544
171604
  onAuthUrl: (url) => {
171545
- console.log(chalk64.yellow("Open this URL in your browser to authenticate with EvalOps:"));
171546
- console.log(chalk64.underline(url));
171605
+ console.log(chalk65.yellow("Open this URL in your browser to authenticate with EvalOps:"));
171606
+ console.log(chalk65.underline(url));
171547
171607
  },
171548
- onStatus: (status) => console.log(chalk64.dim(status))
171608
+ onStatus: (status) => console.log(chalk65.dim(status))
171549
171609
  });
171550
- console.log(chalk64.green("EvalOps credentials saved successfully."));
171551
- console.log(chalk64.dim('Try "maestro --provider evalops --model gpt-4o-mini".'));
171610
+ console.log(chalk65.green("EvalOps credentials saved successfully."));
171611
+ console.log(chalk65.dim('Try "maestro --provider evalops --model gpt-4o-mini".'));
171552
171612
  }
171553
171613
  async function handleLogout2() {
171554
171614
  await logout("evalops");
171555
- console.log(chalk64.green("Removed stored EvalOps credentials."));
171615
+ console.log(chalk65.green("Removed stored EvalOps credentials."));
171556
171616
  }
171557
171617
  async function handleEvalOpsStatus() {
171558
171618
  if (!hasOAuthCredentials("evalops")) {
171559
- console.log(chalk64.yellow("No stored EvalOps credentials."));
171560
- console.log(chalk64.dim('Run "maestro evalops login" to authenticate with EvalOps.'));
171619
+ console.log(chalk65.yellow("No stored EvalOps credentials."));
171620
+ console.log(chalk65.dim('Run "maestro evalops login" to authenticate with EvalOps.'));
171561
171621
  return;
171562
171622
  }
171563
- console.log(chalk64.green("Stored EvalOps credentials detected."));
171623
+ console.log(chalk65.green("Stored EvalOps credentials detected."));
171564
171624
  const context2 = resolveManagedEvalOpsContext();
171565
171625
  console.log(formatManagedEvalOpsStatus(context2));
171566
171626
  if (!context2.managed) {
171567
- console.log(chalk64.yellow('No EvalOps agent session yet. Run "maestro init".'));
171627
+ console.log(chalk65.yellow('No EvalOps agent session yet. Run "maestro init".'));
171568
171628
  }
171569
171629
  }
171570
171630
  var init_evalops2 = __esm2(() => {
171571
171631
  init_managed_context();
171572
171632
  init_oauth();
171573
171633
  });
171574
- var exports_status = {};
171575
- __export2(exports_status, {
171576
- handleStatusCommand: () => handleStatusCommand
171577
- });
171578
- async function handleStatusCommand() {
171579
- const context2 = resolveManagedEvalOpsContext();
171580
- console.log(chalk65.bold("Maestro status"));
171581
- console.log(formatManagedEvalOpsStatus(context2));
171582
- if (!context2.authenticated) {
171583
- console.log(chalk65.dim('Run "maestro init" to bring EvalOps managed mode online.'));
171584
- }
171585
- }
171586
- var init_status4 = __esm2(() => {
171587
- init_managed_context();
171588
- });
171589
171634
  var exports_codex = {};
171590
171635
  __export2(exports_codex, {
171591
171636
  handleCodexCommand: () => handleCodexCommand
@@ -176424,6 +176469,11 @@ async function main(args) {
176424
176469
  console.error(chalk81.red(parsed.error));
176425
176470
  process.exit(1);
176426
176471
  }
176472
+ const exitWithEarlyStartupError = (error) => {
176473
+ const message = error instanceof Error ? error.message : String(error);
176474
+ console.error(chalk81.red(message));
176475
+ process.exit(1);
176476
+ };
176427
176477
  if (parsed.command === "hosted-runner") {
176428
176478
  const { handleHostedRunnerCommand: handleHostedRunnerCommand2 } = await Promise.resolve().then(() => (init_hosted_runner(), exports_hosted_runner));
176429
176479
  await handleHostedRunnerCommand2(parsed.commandArgs ?? [], {
@@ -176443,6 +176493,26 @@ async function main(args) {
176443
176493
  await startWebServer2(port, { skipStartupMigration: true });
176444
176494
  return;
176445
176495
  }
176496
+ if (parsed.command === "init") {
176497
+ try {
176498
+ validateCodexFlags(args, parsed.command);
176499
+ } catch (error) {
176500
+ exitWithEarlyStartupError(error);
176501
+ }
176502
+ const { handleInitCommand: handleInitCommand3 } = await Promise.resolve().then(() => (init_init(), exports_init));
176503
+ await handleInitCommand3(parsed.commandArgs ?? []);
176504
+ return;
176505
+ }
176506
+ if (parsed.command === "status") {
176507
+ try {
176508
+ validateCodexFlags(args, parsed.command);
176509
+ } catch (error) {
176510
+ exitWithEarlyStartupError(error);
176511
+ }
176512
+ const { handleStatusCommand: handleStatusCommand2 } = await Promise.resolve().then(() => (init_status4(), exports_status));
176513
+ await handleStatusCommand2();
176514
+ return;
176515
+ }
176446
176516
  const isLikelyInteractiveTui = !parsed.messages.length && (parsed.mode === "text" || parsed.mode === void 0) && parsed.command === void 0;
176447
176517
  const isHeadlessMode = parsed.headless || parsed.mode === "headless";
176448
176518
  if (isLikelyInteractiveTui || isHeadlessMode) {
@@ -176602,16 +176672,6 @@ Available commands:`));
176602
176672
  await handleEvalOpsCommand2(parsed.subcommand, parsed.commandArgs ?? []);
176603
176673
  return;
176604
176674
  }
176605
- if (parsed.command === "status") {
176606
- const { handleStatusCommand: handleStatusCommand2 } = await Promise.resolve().then(() => (init_status4(), exports_status));
176607
- await handleStatusCommand2();
176608
- return;
176609
- }
176610
- if (parsed.command === "init") {
176611
- const { handleInitCommand: handleInitCommand3 } = await Promise.resolve().then(() => (init_init(), exports_init));
176612
- await handleInitCommand3(parsed.commandArgs ?? []);
176613
- return;
176614
- }
176615
176675
  if (parsed.command === "codex") {
176616
176676
  const { handleCodexCommand: handleCodexCommand2 } = await Promise.resolve().then(() => (init_codex(), exports_codex));
176617
176677
  await handleCodexCommand2(parsed.subcommand, parsed.messages);