@mutagent/cli 0.2.44 → 0.2.46
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/bin/cli.js +32 -32
- package/package.json +2 -2
package/dist/bin/cli.js
CHANGED
|
@@ -29207,21 +29207,21 @@ async function attachToSandbox(options) {
|
|
|
29207
29207
|
}
|
|
29208
29208
|
}
|
|
29209
29209
|
function reportOutcome(id, result, sink, onDisconnect) {
|
|
29210
|
-
const
|
|
29210
|
+
const sandboxId = result.sandbox?.sandboxId ?? id;
|
|
29211
29211
|
if (result.end === "unfollowable") {
|
|
29212
|
-
sink.notice(`Stream for sandbox ${
|
|
29213
|
-
sink.notice(`Try again with: ${reattachHint(
|
|
29212
|
+
sink.notice(`Stream for sandbox ${sandboxId} ended after the replay — the backend could not follow it from here.`);
|
|
29213
|
+
sink.notice(`Try again with: ${reattachHint(sandboxId, result.lastSeq)}`);
|
|
29214
29214
|
return;
|
|
29215
29215
|
}
|
|
29216
29216
|
if (result.end === "detached") {
|
|
29217
29217
|
if (onDisconnect === "released") {
|
|
29218
|
-
sink.notice(
|
|
29218
|
+
sink.notice(sandboxId === "" ? "Stopped. The turn was cancelled and the sandbox released — nothing is left running." : `Stopped. The turn was cancelled and sandbox ${sandboxId} released — nothing is left running.`);
|
|
29219
29219
|
sink.notice("Run the turn again to retry, or add --keep next time to hold the sandbox open.");
|
|
29220
29220
|
return;
|
|
29221
29221
|
}
|
|
29222
|
-
sink.notice(`Detached. Sandbox ${
|
|
29223
|
-
sink.notice(`Re-attach with: ${reattachHint(
|
|
29224
|
-
sink.notice(`Destroy it with: mutagent sandbox delete ${
|
|
29222
|
+
sink.notice(`Detached. Sandbox ${sandboxId} is still running — nothing was destroyed.`);
|
|
29223
|
+
sink.notice(`Re-attach with: ${reattachHint(sandboxId, result.lastSeq)}`);
|
|
29224
|
+
sink.notice(`Destroy it with: mutagent sandbox delete ${sandboxId} --force`);
|
|
29225
29225
|
return;
|
|
29226
29226
|
}
|
|
29227
29227
|
if (result.gaps > 0) {
|
|
@@ -29235,12 +29235,12 @@ function reportOutcome(id, result, sink, onDisconnect) {
|
|
|
29235
29235
|
}
|
|
29236
29236
|
if (result.exitCode === null) {
|
|
29237
29237
|
const why = result.result?.error;
|
|
29238
|
-
sink.notice(why === undefined ? `Sandbox ${
|
|
29238
|
+
sink.notice(why === undefined ? `Sandbox ${sandboxId} exited (no exit code reported).` : `The turn did not complete: ${why}`);
|
|
29239
29239
|
return;
|
|
29240
29240
|
}
|
|
29241
|
-
sink.notice(result.session === undefined ? `Sandbox ${
|
|
29241
|
+
sink.notice(result.session === undefined ? `Sandbox ${sandboxId} exited with code ${String(result.exitCode)}.` : `Session ${result.session.sessionId} exited with code ${String(result.exitCode)}.`);
|
|
29242
29242
|
if (result.session !== undefined && onDisconnect === "survives") {
|
|
29243
|
-
sink.notice(`Sandbox ${
|
|
29243
|
+
sink.notice(`Sandbox ${sandboxId} is still up — destroy it with: mutagent sandbox delete ${sandboxId} --force`);
|
|
29244
29244
|
}
|
|
29245
29245
|
if (result.exitCode !== 0) {
|
|
29246
29246
|
process.exitCode = result.exitCode;
|
|
@@ -30126,7 +30126,7 @@ async function preflightDefinition(definition, provider) {
|
|
|
30126
30126
|
}
|
|
30127
30127
|
|
|
30128
30128
|
// src/commands/helix/doctor.ts
|
|
30129
|
-
var
|
|
30129
|
+
var IN_SANDBOX_HELIX_BINARY = "/usr/local/bin/helix";
|
|
30130
30130
|
function isRefreshRuntime(arg) {
|
|
30131
30131
|
return arg === "--refresh-runtime" || arg.startsWith("--refresh-runtime=");
|
|
30132
30132
|
}
|
|
@@ -30166,13 +30166,13 @@ AI Agent Directive:
|
|
|
30166
30166
|
if (stray.length > 0)
|
|
30167
30167
|
throw strayArgumentsRefusal("doctor", stray);
|
|
30168
30168
|
const argv = [
|
|
30169
|
-
|
|
30169
|
+
IN_SANDBOX_HELIX_BINARY,
|
|
30170
30170
|
"doctor",
|
|
30171
30171
|
...options.strict === true ? ["--strict"] : [],
|
|
30172
30172
|
...options.welcome === true ? ["--welcome"] : []
|
|
30173
30173
|
];
|
|
30174
|
-
const result = await
|
|
30175
|
-
|
|
30174
|
+
const result = await runInSandbox(argv, options);
|
|
30175
|
+
reportSandboxRun(result, output, isJson, { command: argv });
|
|
30176
30176
|
} catch (error) {
|
|
30177
30177
|
handleError(error, isJson);
|
|
30178
30178
|
}
|
|
@@ -30200,9 +30200,9 @@ AI Agent Directive:
|
|
|
30200
30200
|
throw refreshRuntimeRefusal();
|
|
30201
30201
|
if (stray.length > 0)
|
|
30202
30202
|
throw strayArgumentsRefusal("smoke", stray);
|
|
30203
|
-
const argv = [
|
|
30204
|
-
const result = await
|
|
30205
|
-
|
|
30203
|
+
const argv = [IN_SANDBOX_HELIX_BINARY, "smoke"];
|
|
30204
|
+
const result = await runInSandbox(argv, options);
|
|
30205
|
+
reportSandboxRun(result, output, isJson, { command: argv });
|
|
30206
30206
|
} catch (error) {
|
|
30207
30207
|
handleError(error, isJson);
|
|
30208
30208
|
}
|
|
@@ -30262,7 +30262,7 @@ async function pinnedHelixVersion() {
|
|
|
30262
30262
|
const match = /helix\s+(\d+\.\d+\.\d+[^\s,)]*)/i.exec(preset?.description ?? "");
|
|
30263
30263
|
return match?.[1];
|
|
30264
30264
|
}
|
|
30265
|
-
async function
|
|
30265
|
+
async function runInSandbox(argv, options) {
|
|
30266
30266
|
checkSandboxId(options.sandbox);
|
|
30267
30267
|
const id = options.sandbox?.trim();
|
|
30268
30268
|
if (id !== undefined && id !== "") {
|
|
@@ -30276,7 +30276,7 @@ async function runInBox(argv, options) {
|
|
|
30276
30276
|
...options.preset === undefined ? {} : { preset: options.preset }
|
|
30277
30277
|
});
|
|
30278
30278
|
}
|
|
30279
|
-
function
|
|
30279
|
+
function reportSandboxRun(result, output, isJson, context) {
|
|
30280
30280
|
if (isJson) {
|
|
30281
30281
|
output.output({ success: true, ...context, result });
|
|
30282
30282
|
} else {
|
|
@@ -31122,7 +31122,7 @@ AI Agent Directive:
|
|
|
31122
31122
|
|
|
31123
31123
|
// src/commands/sandbox/index.ts
|
|
31124
31124
|
function createSandboxCommand() {
|
|
31125
|
-
const sandbox = new Command16("sandbox").description("Cloud sandboxes (advanced): run a command in a
|
|
31125
|
+
const sandbox = new Command16("sandbox").description("Cloud sandboxes (advanced): run a command in a sandbox; agent runs use mutagent helix").addHelpText("after", `
|
|
31126
31126
|
Examples:
|
|
31127
31127
|
${chalk39.dim("$")} mutagent sandbox exec -- uname -m ${chalk39.dim("Run one shell command in a fresh cloud sandbox")}
|
|
31128
31128
|
${chalk39.dim("$")} mutagent helix --sandbox-provider mutagent-cloud -p "run the tests" ${chalk39.dim("Run an agent task in a cloud sandbox")}
|
|
@@ -32712,7 +32712,7 @@ function printEnvironment2(environment) {
|
|
|
32712
32712
|
function envHelp(verb) {
|
|
32713
32713
|
const clear = verb === "update" ? `--env "" clears it: runs then load no Environment. Changing or clearing it writes a new version.` : `--env "" is the same as leaving it out: no Environment.`;
|
|
32714
32714
|
return `--env <name> loads that workspace Environment (its variables and secrets, see
|
|
32715
|
-
'mutagent env list') into the
|
|
32715
|
+
'mutagent env list') into the sandbox of every run, exactly like a session started with an
|
|
32716
32716
|
Environment. The workspace must have it when you write this: an unknown name is refused
|
|
32717
32717
|
(ENVIRONMENT_NOT_FOUND). ${clear}`;
|
|
32718
32718
|
}
|
|
@@ -34672,9 +34672,9 @@ var SANDBOX_TELEMETRY_URL_VAR = "MUTAGENT_TELEMETRY_URL";
|
|
|
34672
34672
|
var SDK_TRANSPORT_ERRORS4 = new Set(["ConnectionError", "RequestTimeoutError", "RequestAbortedError", "UnexpectedClientError"]);
|
|
34673
34673
|
var SDK_SCHEMA_ERRORS3 = new Set(["SDKValidationError", "ResponseValidationError"]);
|
|
34674
34674
|
function notSignedIn(inBox) {
|
|
34675
|
-
return inBox ? new MutagentError("AUTH_REQUIRED", "Only `mutagent reports push` works with
|
|
34675
|
+
return inBox ? new MutagentError("AUTH_REQUIRED", "Only `mutagent reports push` works with a sandbox token; reading reports needs a platform API key.", "Run: mutagent login (or set MUTAGENT_API_KEY)") : new MutagentError("AUTH_REQUIRED", "Not signed in.", "Run: mutagent login");
|
|
34676
34676
|
}
|
|
34677
|
-
function
|
|
34677
|
+
function sandboxEndpoint() {
|
|
34678
34678
|
const explicit = process.env.MUTAGENT_ENDPOINT?.trim();
|
|
34679
34679
|
if (explicit !== undefined && explicit !== "")
|
|
34680
34680
|
return endpointOf(explicit);
|
|
@@ -34716,7 +34716,7 @@ function reportsError(error, ctx) {
|
|
|
34716
34716
|
if (tenancy)
|
|
34717
34717
|
return tenancy;
|
|
34718
34718
|
} else if (status === 401) {
|
|
34719
|
-
return new MutagentError("SANDBOX_TOKEN_REFUSED", "The server refused this
|
|
34719
|
+
return new MutagentError("SANDBOX_TOKEN_REFUSED", "The server refused this sandbox's token (expired, or not issued by this server).", "Push from a live sandbox, or sign in: mutagent login");
|
|
34720
34720
|
}
|
|
34721
34721
|
const parsed = parseBody2(body);
|
|
34722
34722
|
if (typeof parsed.code === "string" && typeof parsed.reason === "string") {
|
|
@@ -34764,7 +34764,7 @@ async function connectReports(opts) {
|
|
|
34764
34764
|
throw notSignedIn(true);
|
|
34765
34765
|
registerSecret(token);
|
|
34766
34766
|
secrets.add(token);
|
|
34767
|
-
const endpoint =
|
|
34767
|
+
const endpoint = sandboxEndpoint();
|
|
34768
34768
|
const sdk = new Mutagent5({
|
|
34769
34769
|
security: { bearerAuth: token },
|
|
34770
34770
|
serverURL: endpoint,
|
|
@@ -35211,9 +35211,9 @@ hitl:
|
|
|
35211
35211
|
A hitl report (the reviewer's rulings) has no run id: every push stores a new
|
|
35212
35212
|
report, the render input's runId is not sent, and --run-id / --replace are refused.
|
|
35213
35213
|
|
|
35214
|
-
Inside a
|
|
35215
|
-
With no API key, the
|
|
35216
|
-
workspace. A signed-in key always wins. Only push works this way.
|
|
35214
|
+
Inside a sandbox:
|
|
35215
|
+
With no API key, the sandbox's MUTAGENT_SANDBOX_TOKEN uploads to the
|
|
35216
|
+
sandbox's own workspace. A signed-in key always wins. Only push works this way.
|
|
35217
35217
|
|
|
35218
35218
|
Exit 0: stored, or already stored.
|
|
35219
35219
|
${EXIT_CODES_LINE}
|
|
@@ -37916,7 +37916,7 @@ function helixCloudSurface(cliVersion) {
|
|
|
37916
37916
|
};
|
|
37917
37917
|
}
|
|
37918
37918
|
|
|
37919
|
-
// src/commands/sandbox/
|
|
37919
|
+
// src/commands/sandbox/sandbox-argv.ts
|
|
37920
37920
|
function optionSpec(command) {
|
|
37921
37921
|
const value = new Set;
|
|
37922
37922
|
const boolean = new Set;
|
|
@@ -37927,7 +37927,7 @@ function optionSpec(command) {
|
|
|
37927
37927
|
}
|
|
37928
37928
|
return { value, boolean };
|
|
37929
37929
|
}
|
|
37930
|
-
function
|
|
37930
|
+
function protectSandboxArgv(rawArgs, exec) {
|
|
37931
37931
|
const at = commandPathIndexes(rawArgs, 2);
|
|
37932
37932
|
const group = at[0];
|
|
37933
37933
|
const verb = at[1];
|
|
@@ -38077,7 +38077,7 @@ ${!hasCredentials() ? `
|
|
|
38077
38077
|
${EXIT_CODES_LINE}
|
|
38078
38078
|
`);
|
|
38079
38079
|
const execCommand = program.commands.find((c) => c.name() === "sandbox")?.commands.find((c) => c.name() === "exec");
|
|
38080
|
-
const argvForCommander = execCommand === undefined ? rawArgs :
|
|
38080
|
+
const argvForCommander = execCommand === undefined ? rawArgs : protectSandboxArgv(rawArgs, optionSpec(execCommand));
|
|
38081
38081
|
const json = rawArgs.includes("--json");
|
|
38082
38082
|
if (!helixHelpJson && !answerBareGroup(program, rawArgs, json)) {
|
|
38083
38083
|
await program.parseAsync(argvForCommander, { from: "user" }).catch((error) => {
|
|
@@ -38100,4 +38100,4 @@ if (process.env.CLI_VERSION) {
|
|
|
38100
38100
|
}
|
|
38101
38101
|
runCli(process.argv.slice(2), cliVersion);
|
|
38102
38102
|
|
|
38103
|
-
//# debugId=
|
|
38103
|
+
//# debugId=7181C3F925DEA1DA64756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mutagent/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.46",
|
|
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.
|
|
48
|
+
"@mutagent/sdk": "0.8.25",
|
|
49
49
|
"@sinclair/typebox": "^0.34.0",
|
|
50
50
|
"chalk": "^5.3.0",
|
|
51
51
|
"commander": "^12.1.0",
|