@vm0/cli 9.29.1 → 9.29.2
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/index.js +109 -80
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -62,7 +62,7 @@ if (DSN) {
|
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
64
|
Sentry.setContext("cli", {
|
|
65
|
-
version: "9.29.
|
|
65
|
+
version: "9.29.2",
|
|
66
66
|
command: process.argv.slice(2).join(" ")
|
|
67
67
|
});
|
|
68
68
|
Sentry.setContext("runtime", {
|
|
@@ -152,6 +152,9 @@ async function requestDeviceCode(apiUrl) {
|
|
|
152
152
|
body: JSON.stringify({})
|
|
153
153
|
});
|
|
154
154
|
if (!response.ok) {
|
|
155
|
+
if (response.status === 403) {
|
|
156
|
+
throw new Error("An unexpected network issue occurred");
|
|
157
|
+
}
|
|
155
158
|
throw new Error(`Failed to request device code: ${response.statusText}`);
|
|
156
159
|
}
|
|
157
160
|
return response.json();
|
|
@@ -502,7 +505,7 @@ async function waitForSilentUpgrade(timeout = TIMEOUT_MS) {
|
|
|
502
505
|
// src/commands/info/index.ts
|
|
503
506
|
var CONFIG_PATH = join2(homedir2(), ".vm0", "config.json");
|
|
504
507
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
505
|
-
console.log(chalk4.bold(`VM0 CLI v${"9.29.
|
|
508
|
+
console.log(chalk4.bold(`VM0 CLI v${"9.29.2"}`));
|
|
506
509
|
console.log();
|
|
507
510
|
const config = await loadConfig();
|
|
508
511
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -6117,7 +6120,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
6117
6120
|
options.autoUpdate = false;
|
|
6118
6121
|
}
|
|
6119
6122
|
if (options.autoUpdate !== false) {
|
|
6120
|
-
await startSilentUpgrade("9.29.
|
|
6123
|
+
await startSilentUpgrade("9.29.2");
|
|
6121
6124
|
}
|
|
6122
6125
|
try {
|
|
6123
6126
|
let result;
|
|
@@ -8339,7 +8342,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
8339
8342
|
async (identifier, prompt, options) => {
|
|
8340
8343
|
try {
|
|
8341
8344
|
if (options.autoUpdate !== false) {
|
|
8342
|
-
await startSilentUpgrade("9.29.
|
|
8345
|
+
await startSilentUpgrade("9.29.2");
|
|
8343
8346
|
}
|
|
8344
8347
|
const { scope, name, version } = parseIdentifier(identifier);
|
|
8345
8348
|
if (scope && !options.experimentalSharedAgent) {
|
|
@@ -10006,7 +10009,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
|
|
|
10006
10009
|
).option("-y, --yes", "Skip confirmation prompts").option("-v, --verbose", "Show full tool inputs and outputs").addOption(new Option5("--debug-no-mock-claude").hideHelp()).addOption(new Option5("--no-auto-update").hideHelp()).action(
|
|
10007
10010
|
async (prompt, options) => {
|
|
10008
10011
|
if (options.autoUpdate !== false) {
|
|
10009
|
-
const shouldExit = await checkAndUpgrade("9.29.
|
|
10012
|
+
const shouldExit = await checkAndUpgrade("9.29.2", prompt);
|
|
10010
10013
|
if (shouldExit) {
|
|
10011
10014
|
process.exit(0);
|
|
10012
10015
|
}
|
|
@@ -13316,94 +13319,108 @@ async function getHeaders2() {
|
|
|
13316
13319
|
return headers;
|
|
13317
13320
|
}
|
|
13318
13321
|
var connectCommand = new Command66().name("connect").description("Connect a third-party service (e.g., GitHub)").argument("<type>", "Connector type (e.g., github)").action(async (type2) => {
|
|
13319
|
-
|
|
13320
|
-
|
|
13321
|
-
|
|
13322
|
-
|
|
13323
|
-
|
|
13324
|
-
|
|
13325
|
-
const connectorType = parseResult.data;
|
|
13326
|
-
const apiUrl = await getApiUrl();
|
|
13327
|
-
const headers = await getHeaders2();
|
|
13328
|
-
console.log(`Connecting ${chalk63.cyan(type2)}...`);
|
|
13329
|
-
const sessionsClient = initClient12(connectorSessionsContract, {
|
|
13330
|
-
baseUrl: apiUrl,
|
|
13331
|
-
baseHeaders: headers,
|
|
13332
|
-
jsonQuery: true
|
|
13333
|
-
});
|
|
13334
|
-
const createResult = await sessionsClient.create({
|
|
13335
|
-
params: { type: connectorType },
|
|
13336
|
-
body: {}
|
|
13337
|
-
});
|
|
13338
|
-
if (createResult.status !== 200) {
|
|
13339
|
-
const errorBody = createResult.body;
|
|
13340
|
-
console.error(
|
|
13341
|
-
chalk63.red(`\u2717 Failed to create session: ${errorBody.error?.message}`)
|
|
13342
|
-
);
|
|
13343
|
-
process.exit(1);
|
|
13344
|
-
}
|
|
13345
|
-
const session = createResult.body;
|
|
13346
|
-
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
13347
|
-
console.log(chalk63.green("\nSession created"));
|
|
13348
|
-
console.log(chalk63.cyan(`
|
|
13349
|
-
To connect, visit: ${verificationUrl}`));
|
|
13350
|
-
console.log(
|
|
13351
|
-
`
|
|
13352
|
-
The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
13353
|
-
);
|
|
13354
|
-
console.log("\nWaiting for authorization...");
|
|
13355
|
-
const sessionClient = initClient12(connectorSessionByIdContract, {
|
|
13356
|
-
baseUrl: apiUrl,
|
|
13357
|
-
baseHeaders: headers,
|
|
13358
|
-
jsonQuery: true
|
|
13359
|
-
});
|
|
13360
|
-
const startTime = Date.now();
|
|
13361
|
-
const maxWaitTime = session.expiresIn * 1e3;
|
|
13362
|
-
const pollInterval = (session.interval || 5) * 1e3;
|
|
13363
|
-
let isFirstPoll = true;
|
|
13364
|
-
while (Date.now() - startTime < maxWaitTime) {
|
|
13365
|
-
if (!isFirstPoll) {
|
|
13366
|
-
await delay2(pollInterval);
|
|
13322
|
+
try {
|
|
13323
|
+
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
13324
|
+
if (!parseResult.success) {
|
|
13325
|
+
console.error(chalk63.red(`\u2717 Unknown connector type: ${type2}`));
|
|
13326
|
+
console.error("Available connectors: github");
|
|
13327
|
+
process.exit(1);
|
|
13367
13328
|
}
|
|
13368
|
-
|
|
13369
|
-
const
|
|
13370
|
-
|
|
13329
|
+
const connectorType = parseResult.data;
|
|
13330
|
+
const apiUrl = await getApiUrl();
|
|
13331
|
+
const headers = await getHeaders2();
|
|
13332
|
+
console.log(`Connecting ${chalk63.cyan(type2)}...`);
|
|
13333
|
+
const sessionsClient = initClient12(connectorSessionsContract, {
|
|
13334
|
+
baseUrl: apiUrl,
|
|
13335
|
+
baseHeaders: headers,
|
|
13336
|
+
jsonQuery: true
|
|
13337
|
+
});
|
|
13338
|
+
const createResult = await sessionsClient.create({
|
|
13339
|
+
params: { type: connectorType },
|
|
13340
|
+
body: {}
|
|
13371
13341
|
});
|
|
13372
|
-
if (
|
|
13373
|
-
const errorBody =
|
|
13342
|
+
if (createResult.status !== 200) {
|
|
13343
|
+
const errorBody = createResult.body;
|
|
13374
13344
|
console.error(
|
|
13375
|
-
chalk63.red(`
|
|
13376
|
-
\u2717 Failed to check status: ${errorBody.error?.message}`)
|
|
13345
|
+
chalk63.red(`\u2717 Failed to create session: ${errorBody.error?.message}`)
|
|
13377
13346
|
);
|
|
13378
13347
|
process.exit(1);
|
|
13379
13348
|
}
|
|
13380
|
-
const
|
|
13381
|
-
|
|
13382
|
-
|
|
13383
|
-
|
|
13384
|
-
|
|
13385
|
-
|
|
13386
|
-
|
|
13387
|
-
|
|
13388
|
-
|
|
13389
|
-
|
|
13390
|
-
|
|
13391
|
-
|
|
13349
|
+
const session = createResult.body;
|
|
13350
|
+
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
13351
|
+
console.log(chalk63.green("\nSession created"));
|
|
13352
|
+
console.log(chalk63.cyan(`
|
|
13353
|
+
To connect, visit: ${verificationUrl}`));
|
|
13354
|
+
console.log(
|
|
13355
|
+
`
|
|
13356
|
+
The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
13357
|
+
);
|
|
13358
|
+
console.log("\nWaiting for authorization...");
|
|
13359
|
+
const sessionClient = initClient12(connectorSessionByIdContract, {
|
|
13360
|
+
baseUrl: apiUrl,
|
|
13361
|
+
baseHeaders: headers,
|
|
13362
|
+
jsonQuery: true
|
|
13363
|
+
});
|
|
13364
|
+
const startTime = Date.now();
|
|
13365
|
+
const maxWaitTime = session.expiresIn * 1e3;
|
|
13366
|
+
const pollInterval = (session.interval || 5) * 1e3;
|
|
13367
|
+
let isFirstPoll = true;
|
|
13368
|
+
while (Date.now() - startTime < maxWaitTime) {
|
|
13369
|
+
if (!isFirstPoll) {
|
|
13370
|
+
await delay2(pollInterval);
|
|
13371
|
+
}
|
|
13372
|
+
isFirstPoll = false;
|
|
13373
|
+
const statusResult = await sessionClient.get({
|
|
13374
|
+
params: { type: connectorType, sessionId: session.id }
|
|
13375
|
+
});
|
|
13376
|
+
if (statusResult.status !== 200) {
|
|
13377
|
+
const errorBody = statusResult.body;
|
|
13392
13378
|
console.error(
|
|
13393
13379
|
chalk63.red(
|
|
13394
13380
|
`
|
|
13395
|
-
\u2717
|
|
13381
|
+
\u2717 Failed to check status: ${errorBody.error?.message}`
|
|
13396
13382
|
)
|
|
13397
13383
|
);
|
|
13398
13384
|
process.exit(1);
|
|
13399
|
-
|
|
13400
|
-
|
|
13401
|
-
|
|
13402
|
-
|
|
13385
|
+
}
|
|
13386
|
+
const status = statusResult.body;
|
|
13387
|
+
switch (status.status) {
|
|
13388
|
+
case "complete":
|
|
13389
|
+
console.log(chalk63.green(`
|
|
13390
|
+
|
|
13391
|
+
${type2} connected successfully!`));
|
|
13392
|
+
return;
|
|
13393
|
+
case "expired":
|
|
13394
|
+
console.error(chalk63.red("\n\u2717 Session expired, please try again"));
|
|
13395
|
+
process.exit(1);
|
|
13396
|
+
break;
|
|
13397
|
+
case "error":
|
|
13398
|
+
console.error(
|
|
13399
|
+
chalk63.red(
|
|
13400
|
+
`
|
|
13401
|
+
\u2717 Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
13402
|
+
)
|
|
13403
|
+
);
|
|
13404
|
+
process.exit(1);
|
|
13405
|
+
break;
|
|
13406
|
+
case "pending":
|
|
13407
|
+
process.stdout.write(chalk63.dim("."));
|
|
13408
|
+
break;
|
|
13409
|
+
}
|
|
13410
|
+
}
|
|
13411
|
+
console.error(chalk63.red("\n\u2717 Session timed out, please try again"));
|
|
13412
|
+
process.exit(1);
|
|
13413
|
+
} catch (error) {
|
|
13414
|
+
if (error instanceof Error) {
|
|
13415
|
+
console.error(chalk63.red(`\u2717 ${error.message}`));
|
|
13416
|
+
if (error.cause instanceof Error) {
|
|
13417
|
+
console.error(chalk63.dim(` Cause: ${error.cause.message}`));
|
|
13418
|
+
}
|
|
13419
|
+
} else {
|
|
13420
|
+
console.error(chalk63.red("\u2717 An unexpected error occurred"));
|
|
13403
13421
|
}
|
|
13422
|
+
process.exit(1);
|
|
13404
13423
|
}
|
|
13405
|
-
console.error(chalk63.red("\n\u2717 Session timed out, please try again"));
|
|
13406
|
-
process.exit(1);
|
|
13407
13424
|
});
|
|
13408
13425
|
|
|
13409
13426
|
// src/commands/connector/list.ts
|
|
@@ -13439,6 +13456,9 @@ var listCommand9 = new Command67().name("list").alias("ls").description("List al
|
|
|
13439
13456
|
console.error(chalk64.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13440
13457
|
} else {
|
|
13441
13458
|
console.error(chalk64.red(`\u2717 ${error.message}`));
|
|
13459
|
+
if (error.cause instanceof Error) {
|
|
13460
|
+
console.error(chalk64.dim(` Cause: ${error.cause.message}`));
|
|
13461
|
+
}
|
|
13442
13462
|
}
|
|
13443
13463
|
} else {
|
|
13444
13464
|
console.error(chalk64.red("\u2717 An unexpected error occurred"));
|
|
@@ -13506,6 +13526,9 @@ var statusCommand7 = new Command68().name("status").description("Show detailed s
|
|
|
13506
13526
|
console.error(chalk65.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13507
13527
|
} else {
|
|
13508
13528
|
console.error(chalk65.red(`\u2717 ${error.message}`));
|
|
13529
|
+
if (error.cause instanceof Error) {
|
|
13530
|
+
console.error(chalk65.dim(` Cause: ${error.cause.message}`));
|
|
13531
|
+
}
|
|
13509
13532
|
}
|
|
13510
13533
|
} else {
|
|
13511
13534
|
console.error(chalk65.red("\u2717 An unexpected error occurred"));
|
|
@@ -13539,6 +13562,9 @@ var disconnectCommand = new Command69().name("disconnect").description("Disconne
|
|
|
13539
13562
|
console.error(chalk66.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13540
13563
|
} else {
|
|
13541
13564
|
console.error(chalk66.red(`\u2717 ${error.message}`));
|
|
13565
|
+
if (error.cause instanceof Error) {
|
|
13566
|
+
console.error(chalk66.dim(` Cause: ${error.cause.message}`));
|
|
13567
|
+
}
|
|
13542
13568
|
}
|
|
13543
13569
|
} else {
|
|
13544
13570
|
console.error(chalk66.red("\u2717 An unexpected error occurred"));
|
|
@@ -13687,6 +13713,9 @@ async function requestDeviceCode2(apiUrl) {
|
|
|
13687
13713
|
body: JSON.stringify({})
|
|
13688
13714
|
});
|
|
13689
13715
|
if (!response.ok) {
|
|
13716
|
+
if (response.status === 403) {
|
|
13717
|
+
throw new Error("An unexpected network issue occurred");
|
|
13718
|
+
}
|
|
13690
13719
|
throw new Error(`Failed to request device code: ${response.statusText}`);
|
|
13691
13720
|
}
|
|
13692
13721
|
return response.json();
|
|
@@ -14361,7 +14390,7 @@ var devToolCommand = new Command75().name("dev-tool").description("Developer too
|
|
|
14361
14390
|
|
|
14362
14391
|
// src/index.ts
|
|
14363
14392
|
var program = new Command76();
|
|
14364
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.29.
|
|
14393
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.29.2");
|
|
14365
14394
|
program.addCommand(authCommand);
|
|
14366
14395
|
program.addCommand(infoCommand);
|
|
14367
14396
|
program.addCommand(composeCommand);
|