@mutagent/cli 0.2.157 → 0.2.160

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 (3) hide show
  1. package/dist/bin/cli.js +4745 -1139
  2. package/dist/index.js +22 -3
  3. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -453,19 +453,23 @@ function sandboxScopedFailure(failure, commandPath) {
453
453
  if (failure.code !== "AUTH_REQUIRED" || !signedInWithSessionToken())
454
454
  return failure;
455
455
  const command = commandPath === "" ? "This command" : `\`mutagent ${commandPath}\``;
456
+ if (SETUP_NOUNS.has(commandPath.split(" ")[0] ?? "")) {
457
+ return new MutagentError("SANDBOX_SCOPE", `${command} ${SETUP_DONE}`, SETUP_HINT);
458
+ }
456
459
  const alternative = SANDBOX_ALTERNATIVES[commandPath.split(" ")[0] ?? ""];
457
460
  return new MutagentError("SANDBOX_SCOPE", `${command} isn't available inside a cloud session: this session is signed in with its own session token, which covers ${TOKEN_COVERS}.`, alternative === undefined ? IN_SESSION_COMMANDS : `Run: ${alternative}`);
458
461
  }
459
462
  function sandboxSignInRefusal() {
460
463
  return new MutagentError("SANDBOX_SCOPE", `There is nothing to sign in to inside a cloud session: this session is signed in with its own session token, the only credential a sandbox uses, which covers ${TOKEN_COVERS}.`, IN_SESSION_COMMANDS);
461
464
  }
462
- var SANDBOX_TOKEN_VAR2 = "MUTAGENT_SANDBOX_TOKEN", SANDBOX_ALTERNATIVES, TOKEN_COVERS = "the Factory, traces, pushing, updating, listing and showing reports, and this session", IN_SESSION_COMMANDS = "Inside this session use the Factory and traces commands, or reports push, reports update, reports list or reports show (mutagent --help lists them).";
465
+ var SANDBOX_TOKEN_VAR2 = "MUTAGENT_SANDBOX_TOKEN", SANDBOX_ALTERNATIVES, SETUP_NOUNS, SETUP_DONE = "doesn't run inside a cloud session: this workspace is already set up, and its settings live in the web app.", SETUP_HINT = "Tell the user they can see or change this in the web app under Configuration, then carry on. Inside this session, use the Factory, traces and reports commands (mutagent --help lists them).", TOKEN_COVERS = "the Factory, traces, pushing, updating, listing and showing reports, and this session", IN_SESSION_COMMANDS = "Inside this session use the Factory and traces commands, or reports push, reports update, reports list or reports show (mutagent --help lists them).";
463
466
  var init_sandbox_scope_error = __esm(() => {
464
467
  init_config();
465
468
  init_errors();
466
469
  SANDBOX_ALTERNATIVES = {
467
470
  agent: "mutagent factory show"
468
471
  };
472
+ SETUP_NOUNS = new Set(["workspaces", "providers", "usage"]);
469
473
  });
470
474
 
471
475
  // src/lib/output.ts
@@ -889,6 +893,21 @@ var init_errors = __esm(() => {
889
893
  });
890
894
 
891
895
  // src/lib/tenancy-error.ts
896
+ function roleInsufficientFailure(body, scrub) {
897
+ let parsed;
898
+ try {
899
+ parsed = JSON.parse(body);
900
+ } catch {
901
+ return;
902
+ }
903
+ if (!parsed || typeof parsed !== "object")
904
+ return;
905
+ const { code, message } = parsed;
906
+ if (code !== WORKSPACE_ROLE_INSUFFICIENT)
907
+ return;
908
+ const shown = typeof message === "string" && message.trim() !== "" ? scrub(message) : "Your role in this workspace cannot start or list cloud sessions.";
909
+ return new MutagentError(WORKSPACE_ROLE_INSUFFICIENT, shown, ROLE_INSUFFICIENT_FIX);
910
+ }
892
911
  function shellQuote(value) {
893
912
  if (/^[A-Za-z0-9_-]+$/.test(value))
894
913
  return value;
@@ -906,7 +925,7 @@ function workspaceDenied(ctx) {
906
925
  const where = ctx.organizationName ? ` in ${ctx.organizationName}` : "";
907
926
  return new TenancyError(TENANCY_DENIED, `No workspace "${shown}" among your workspaces${where}.`, "See: mutagent workspaces list");
908
927
  }
909
- var TENANCY_DENIED = "TENANCY_DENIED", TenancyError;
928
+ var TENANCY_DENIED = "TENANCY_DENIED", WORKSPACE_ROLE_INSUFFICIENT = "WORKSPACE_ROLE_INSUFFICIENT", ROLE_INSUFFICIENT_FIX = "Ask a workspace admin for editor access", TenancyError;
910
929
  var init_tenancy_error = __esm(() => {
911
930
  init_errors();
912
931
  TenancyError = class TenancyError extends MutagentError {
@@ -2091,4 +2110,4 @@ export {
2091
2110
  version
2092
2111
  };
2093
2112
 
2094
- //# debugId=37053E84CDADCCC664756E2164756E21
2113
+ //# debugId=FA0AB65503397BBF64756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutagent/cli",
3
- "version": "0.2.157",
3
+ "version": "0.2.160",
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.87",
48
+ "@mutagent/sdk": "0.9.0",
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": "38e1a2064b898c62a40b3f62524809472d21cf4a"
97
+ "gitHead": "7fee49f62e195b95f6b52dc18ae9d1a964fc4a8f"
98
98
  }