@mutagent/cli 0.2.144 → 0.2.145

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 (2) hide show
  1. package/dist/bin/cli.js +58 -37
  2. package/package.json +3 -3
package/dist/bin/cli.js CHANGED
@@ -39536,6 +39536,8 @@ function inputConflict(what, help) {
39536
39536
  }
39537
39537
 
39538
39538
  // src/commands/traces/sessions.ts
39539
+ init_errors();
39540
+ import chalk67 from "chalk";
39539
39541
  import { writeFileSync as writeFileSync8 } from "fs";
39540
39542
  import { resolve as resolve13 } from "path";
39541
39543
  init_output();
@@ -39619,17 +39621,35 @@ function logLine(log) {
39619
39621
  const where = log.kind === "frame" ? `#${String(log.seq ?? "")}` : log.severity ?? "LOG";
39620
39622
  return `${log.at} ${where} ${log.text}`;
39621
39623
  }
39622
- async function follow(conn, ref, query, isJson) {
39624
+ function isExpiredCursor(error) {
39625
+ return error instanceof MutagentError && error.code === "INVALID_CURSOR";
39626
+ }
39627
+ async function follow(conn, ref, initial, isJson) {
39623
39628
  if (isJson)
39624
39629
  startJsonLines();
39625
39630
  const printed = new Set;
39631
+ let query = initial;
39626
39632
  let cursor = query.cursor;
39633
+ let lastAt;
39634
+ let recovered = false;
39627
39635
  const state = { stopped: false };
39628
39636
  process.once("SIGINT", () => {
39629
39637
  state.stopped = true;
39630
39638
  });
39631
39639
  while (!state.stopped) {
39632
- const page = await tracesApi.logs(conn, ref, { ...query, cursor }, "mutagent traces logs --help");
39640
+ let page;
39641
+ try {
39642
+ page = await tracesApi.logs(conn, ref, { ...query, cursor }, "mutagent traces logs --help");
39643
+ } catch (error) {
39644
+ if (cursor === undefined || recovered || !isExpiredCursor(error))
39645
+ throw error;
39646
+ recovered = true;
39647
+ if (!isJson)
39648
+ console.error(chalk67.yellow("⚠ The log cursor expired after a server update; resuming from the latest lines."));
39649
+ query = { ...query, since: lastAt ?? query.since };
39650
+ cursor = undefined;
39651
+ ({ page } = await firstPageWithLines(conn, ref, { ...query, cursor }));
39652
+ }
39633
39653
  let fresh = 0;
39634
39654
  for (const log of page.logs) {
39635
39655
  const key = `${log.at}
@@ -39640,6 +39660,7 @@ ${log.text}`;
39640
39660
  continue;
39641
39661
  printed.add(key);
39642
39662
  fresh += 1;
39663
+ lastAt = log.at;
39643
39664
  console.log(isJson ? JSON.stringify(log) : logLine(log));
39644
39665
  }
39645
39666
  cursor = page.nextCursor ?? cursor;
@@ -39947,7 +39968,7 @@ init_key_check();
39947
39968
  init_config();
39948
39969
  init_organization_scope();
39949
39970
  init_output();
39950
- import chalk67 from "chalk";
39971
+ import chalk68 from "chalk";
39951
39972
 
39952
39973
  // src/lib/brand.ts
39953
39974
  var BRAND = {
@@ -40535,44 +40556,44 @@ A managed agent is an agent.md folder deployed with mutagent agent deploy.
40535
40556
  });
40536
40557
  program.addHelpText("beforeAll", () => renderBanner());
40537
40558
  program.addHelpText("after", `
40538
- ${chalk67.yellow("Get started:")}
40559
+ ${chalk68.yellow("Get started:")}
40539
40560
  1. mutagent login
40540
- ${chalk67.dim("Sign in: in the browser, or with MUTAGENT_API_KEY set")}
40561
+ ${chalk68.dim("Sign in: in the browser, or with MUTAGENT_API_KEY set")}
40541
40562
  2. mutagent providers add --provider openai --name "My OpenAI" --api-key-stdin < key.txt
40542
- ${chalk67.dim("Add your LLM provider key, read from stdin (mutagent providers mirror copies your local Helix logins instead)")}
40563
+ ${chalk68.dim("Add your LLM provider key, read from stdin (mutagent providers mirror copies your local Helix logins instead)")}
40543
40564
  3. mutagent env set staging GREETING=hello --secrets-from-file .env.secrets
40544
- ${chalk67.dim("Create an Environment: the variables and secrets a sandbox gets")}
40565
+ ${chalk68.dim("Create an Environment: the variables and secrets a sandbox gets")}
40545
40566
  4. mutagent helix --env staging -p "<task>"
40546
- ${chalk67.dim("Run Helix on the task in a cloud sandbox and print its answer")}
40547
- ${chalk67.dim("To run Helix on this machine instead: mutagent install helix installs the Helix binary")}
40548
-
40549
- ${chalk67.yellow("Managed agents:")}
40550
- mutagent agent deploy <agent.md> ${chalk67.dim("Check, upload and activate an agent.md folder (--env names the Environment whose slot is used)")}
40551
- mutagent helix agent @<slug> -p "<task>" ${chalk67.dim("Run a managed agent in the cloud")}
40552
- mutagent agent --help ${chalk67.dim("check, pack, run, deploy, activate, list, inspect, retire")}
40553
-
40554
- ${chalk67.yellow("Workspace:")}
40555
- mutagent workspaces use <name> ${chalk67.dim("Choose the workspace every later command works in")}
40556
- mutagent workspaces current ${chalk67.dim("The key's scope, organization and the verified workspace")}
40557
- mutagent workspaces list ${chalk67.dim("Your workspaces in the key's organization")}
40558
- --workspace <name|id> ${chalk67.dim("One command in another workspace (then MUTAGENT_WORKSPACE_ID, then the selection)")}
40559
- mutagent login --org <slug> ${chalk67.dim("Sign in for another organization")}
40560
- mutagent providers list ${chalk67.dim("LLM providers in the workspace")}
40561
- mutagent helix models ${chalk67.dim("Models Helix can use in the cloud, and the workspace default model")}
40562
- mutagent env list ${chalk67.dim("Environments: variables and secrets for tools")}
40563
- mutagent usage ${chalk67.dim("Count the workspace's LLM providers and your workspaces")}
40564
-
40565
- ${chalk67.yellow("Automation:")}
40566
- MUTAGENT_API_KEY=mg_live_... ${chalk67.dim("Sign in without a browser (or --api-key <key>)")}
40567
- --json ${chalk67.dim("Structured output")}
40568
- --non-interactive ${chalk67.dim("No sign-in method or consent prompts (also when CI=true or stdin is not a terminal); a first sign-in in a terminal ends with a menu unless --json")}
40569
- -v, --version ${chalk67.dim("CLI version (only before a subcommand)")}
40570
-
40571
- ${chalk67.yellow("Report a problem:")}
40567
+ ${chalk68.dim("Run Helix on the task in a cloud sandbox and print its answer")}
40568
+ ${chalk68.dim("To run Helix on this machine instead: mutagent install helix installs the Helix binary")}
40569
+
40570
+ ${chalk68.yellow("Managed agents:")}
40571
+ mutagent agent deploy <agent.md> ${chalk68.dim("Check, upload and activate an agent.md folder (--env names the Environment whose slot is used)")}
40572
+ mutagent helix agent @<slug> -p "<task>" ${chalk68.dim("Run a managed agent in the cloud")}
40573
+ mutagent agent --help ${chalk68.dim("check, pack, run, deploy, activate, list, inspect, retire")}
40574
+
40575
+ ${chalk68.yellow("Workspace:")}
40576
+ mutagent workspaces use <name> ${chalk68.dim("Choose the workspace every later command works in")}
40577
+ mutagent workspaces current ${chalk68.dim("The key's scope, organization and the verified workspace")}
40578
+ mutagent workspaces list ${chalk68.dim("Your workspaces in the key's organization")}
40579
+ --workspace <name|id> ${chalk68.dim("One command in another workspace (then MUTAGENT_WORKSPACE_ID, then the selection)")}
40580
+ mutagent login --org <slug> ${chalk68.dim("Sign in for another organization")}
40581
+ mutagent providers list ${chalk68.dim("LLM providers in the workspace")}
40582
+ mutagent helix models ${chalk68.dim("Models Helix can use in the cloud, and the workspace default model")}
40583
+ mutagent env list ${chalk68.dim("Environments: variables and secrets for tools")}
40584
+ mutagent usage ${chalk68.dim("Count the workspace's LLM providers and your workspaces")}
40585
+
40586
+ ${chalk68.yellow("Automation:")}
40587
+ MUTAGENT_API_KEY=mg_live_... ${chalk68.dim("Sign in without a browser (or --api-key <key>)")}
40588
+ --json ${chalk68.dim("Structured output")}
40589
+ --non-interactive ${chalk68.dim("No sign-in method or consent prompts (also when CI=true or stdin is not a terminal); a first sign-in in a terminal ends with a menu unless --json")}
40590
+ -v, --version ${chalk68.dim("CLI version (only before a subcommand)")}
40591
+
40592
+ ${chalk68.yellow("Report a problem:")}
40572
40593
  mutagent feedback send "<what happened>" --category cli
40573
- ${chalk67.dim("--category accepts: cli | helix | stage:<spec|build|evaluate|diagnose|optimize>")}
40594
+ ${chalk68.dim("--category accepts: cli | helix | stage:<spec|build|evaluate|diagnose|optimize>")}
40574
40595
 
40575
- ${chalk67.yellow("AI Agent Directive:")}
40596
+ ${chalk68.yellow("AI Agent Directive:")}
40576
40597
  Install the skill first: mutagent skills install (.claude/skills/mutagent-cli/SKILL.md).
40577
40598
  It holds the full workflows. These rules apply to every command:
40578
40599
  1. Sign in: with MUTAGENT_API_KEY set, run mutagent login --json. To help a user sign in,
@@ -40588,7 +40609,7 @@ ${chalk67.yellow("AI Agent Directive:")}
40588
40609
  6. Ask the user through your own question tool. With --json only mutagent login can prompt, in a terminal; pass --browser or set MUTAGENT_API_KEY.
40589
40610
  7. Keep secrets off the command line: --api-key-stdin for an LLM provider key, --secrets-from-file for Environment secrets.
40590
40611
  ${!hasCredentials() ? `
40591
- ` + chalk67.yellow(" Not signed in: start with step 1, mutagent login.") + `
40612
+ ` + chalk68.yellow(" Not signed in: start with step 1, mutagent login.") + `
40592
40613
  ` : ""}`);
40593
40614
  const rawArgs = rescopeProviderApiKeyFlag(argv);
40594
40615
  if (isGlobalVersionFlag(rawArgs)) {
@@ -40664,4 +40685,4 @@ if (process.env.CLI_VERSION) {
40664
40685
  }
40665
40686
  runCli(process.argv.slice(2), cliVersion);
40666
40687
 
40667
- //# debugId=2B91AA42173EBAAE64756E2164756E21
40688
+ //# debugId=5CA6A0CD832EF73164756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutagent/cli",
3
- "version": "0.2.144",
3
+ "version": "0.2.145",
4
4
  "description": "Bun-native CLI for the MutagenT AI platform - auth, provider config, and lifecycle-tool installer for AI-native workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@inquirer/prompts": "^8.7.2",
48
- "@mutagent/sdk": "0.8.77",
48
+ "@mutagent/sdk": "0.8.78",
49
49
  "@sinclair/typebox": "^0.34.0",
50
50
  "chalk": "^5.3.0",
51
51
  "commander": "^12.1.0",
@@ -94,5 +94,5 @@
94
94
  "bugs": {
95
95
  "url": "https://docs.mutagent.io/support"
96
96
  },
97
- "gitHead": "7a6113174493e768ac3099a744dec7d25baccca5"
97
+ "gitHead": "7cd68d1d01805e88360b7405dafbe6595bc75b5c"
98
98
  }