@vm0/cli 3.7.0 → 3.8.1

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/index.js +48 -19
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -13115,20 +13115,20 @@ var DEFAULT_TIMEOUT_SECONDS = 120;
13115
13115
  async function pollEvents(runId, timeoutSeconds, options) {
13116
13116
  let nextSequence = -1;
13117
13117
  let complete = false;
13118
- let runSucceeded = true;
13118
+ let result = { succeeded: true };
13119
13119
  const pollIntervalMs = 500;
13120
13120
  const timeoutMs = timeoutSeconds * 1e3;
13121
- const startTime = Date.now();
13121
+ let lastEventTime = Date.now();
13122
13122
  const startTimestamp = options.startTimestamp;
13123
13123
  let previousTimestamp = startTimestamp;
13124
13124
  const verbose = options.verbose;
13125
13125
  while (!complete) {
13126
- const elapsed = Date.now() - startTime;
13127
- if (elapsed > timeoutMs) {
13126
+ const timeSinceLastEvent = Date.now() - lastEventTime;
13127
+ if (timeSinceLastEvent > timeoutMs) {
13128
13128
  console.error(
13129
13129
  chalk4.red(
13130
13130
  `
13131
- \u2717 Agent execution timed out after ${timeoutSeconds} seconds without receiving events`
13131
+ \u2717 Agent execution timed out after ${timeoutSeconds} seconds without receiving new events`
13132
13132
  )
13133
13133
  );
13134
13134
  throw new Error("Agent execution timed out");
@@ -13149,19 +13149,26 @@ async function pollEvents(runId, timeoutSeconds, options) {
13149
13149
  previousTimestamp = parsed.timestamp;
13150
13150
  if (parsed.type === "vm0_result") {
13151
13151
  complete = true;
13152
- runSucceeded = true;
13152
+ result = {
13153
+ succeeded: true,
13154
+ sessionId: parsed.data.agentSessionId,
13155
+ checkpointId: parsed.data.checkpointId
13156
+ };
13153
13157
  } else if (parsed.type === "vm0_error") {
13154
13158
  complete = true;
13155
- runSucceeded = false;
13159
+ result = { succeeded: false };
13156
13160
  }
13157
13161
  }
13158
13162
  }
13159
13163
  nextSequence = response.nextSequence;
13164
+ if (response.events.length > 0) {
13165
+ lastEventTime = Date.now();
13166
+ }
13160
13167
  if (response.events.length === 0 && !complete) {
13161
13168
  await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
13162
13169
  }
13163
13170
  }
13164
- return runSucceeded;
13171
+ return result;
13165
13172
  }
13166
13173
  function logVerbosePreFlight(action, details) {
13167
13174
  console.log(chalk4.blue(`
@@ -13175,6 +13182,25 @@ ${action}...`));
13175
13182
  console.log(chalk4.blue("Executing in sandbox..."));
13176
13183
  console.log();
13177
13184
  }
13185
+ function showNextSteps(result) {
13186
+ const { sessionId, checkpointId } = result;
13187
+ if (sessionId || checkpointId) {
13188
+ console.log();
13189
+ console.log("Next steps:");
13190
+ if (sessionId) {
13191
+ console.log(" Continue with session (latest state):");
13192
+ console.log(
13193
+ chalk4.cyan(` vm0 run continue ${sessionId} "your next prompt"`)
13194
+ );
13195
+ }
13196
+ if (checkpointId) {
13197
+ console.log(" Resume from checkpoint (exact snapshot state):");
13198
+ console.log(
13199
+ chalk4.cyan(` vm0 run resume ${checkpointId} "your next prompt"`)
13200
+ );
13201
+ }
13202
+ }
13203
+ }
13178
13204
  var runCmd = new Command2().name("run").description("Execute an agent").argument(
13179
13205
  "<identifier>",
13180
13206
  "Agent name, config ID, or name:version (e.g., 'my-agent', 'my-agent:abc123', 'my-agent:latest')"
@@ -13196,7 +13222,7 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
13196
13222
  "Resume from conversation ID (for fine-grained control)"
13197
13223
  ).option(
13198
13224
  "-t, --timeout <seconds>",
13199
- "Polling timeout in seconds (default: 120)",
13225
+ "Timeout in seconds without new events (default: 120)",
13200
13226
  String(DEFAULT_TIMEOUT_SECONDS)
13201
13227
  ).option("-v, --verbose", "Show verbose output with timing information").action(
13202
13228
  async (identifier, prompt, options) => {
@@ -13305,13 +13331,14 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
13305
13331
  volumeVersions: Object.keys(options.volumeVersion).length > 0 ? options.volumeVersion : void 0,
13306
13332
  conversationId: options.conversation
13307
13333
  });
13308
- const succeeded = await pollEvents(response.runId, timeoutSeconds, {
13334
+ const result = await pollEvents(response.runId, timeoutSeconds, {
13309
13335
  verbose,
13310
13336
  startTimestamp
13311
13337
  });
13312
- if (!succeeded) {
13338
+ if (!result.succeeded) {
13313
13339
  process.exit(1);
13314
13340
  }
13341
+ showNextSteps(result);
13315
13342
  } catch (error43) {
13316
13343
  if (error43 instanceof Error) {
13317
13344
  if (error43.message.includes("Not authenticated")) {
@@ -13341,7 +13368,7 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
13341
13368
  {}
13342
13369
  ).option(
13343
13370
  "-t, --timeout <seconds>",
13344
- "Polling timeout in seconds (default: 120)",
13371
+ "Timeout in seconds without new events (default: 120)",
13345
13372
  String(DEFAULT_TIMEOUT_SECONDS)
13346
13373
  ).option("-v, --verbose", "Show verbose output with timing information").action(
13347
13374
  async (checkpointId, prompt, options, command) => {
@@ -13378,13 +13405,14 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
13378
13405
  prompt,
13379
13406
  volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0
13380
13407
  });
13381
- const succeeded = await pollEvents(response.runId, timeoutSeconds, {
13408
+ const result = await pollEvents(response.runId, timeoutSeconds, {
13382
13409
  verbose,
13383
13410
  startTimestamp
13384
13411
  });
13385
- if (!succeeded) {
13412
+ if (!result.succeeded) {
13386
13413
  process.exit(1);
13387
13414
  }
13415
+ showNextSteps(result);
13388
13416
  } catch (error43) {
13389
13417
  if (error43 instanceof Error) {
13390
13418
  if (error43.message.includes("Not authenticated")) {
@@ -13413,7 +13441,7 @@ runCmd.command("continue").description(
13413
13441
  {}
13414
13442
  ).option(
13415
13443
  "-t, --timeout <seconds>",
13416
- "Polling timeout in seconds (default: 120)",
13444
+ "Timeout in seconds without new events (default: 120)",
13417
13445
  String(DEFAULT_TIMEOUT_SECONDS)
13418
13446
  ).option("-v, --verbose", "Show verbose output with timing information").action(
13419
13447
  async (agentSessionId, prompt, options, command) => {
@@ -13451,13 +13479,14 @@ runCmd.command("continue").description(
13451
13479
  prompt,
13452
13480
  volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0
13453
13481
  });
13454
- const succeeded = await pollEvents(response.runId, timeoutSeconds, {
13482
+ const result = await pollEvents(response.runId, timeoutSeconds, {
13455
13483
  verbose,
13456
13484
  startTimestamp
13457
13485
  });
13458
- if (!succeeded) {
13486
+ if (!result.succeeded) {
13459
13487
  process.exit(1);
13460
13488
  }
13489
+ showNextSteps(result);
13461
13490
  } catch (error43) {
13462
13491
  if (error43 instanceof Error) {
13463
13492
  if (error43.message.includes("Not authenticated")) {
@@ -14384,7 +14413,7 @@ function escapeRegExp(str) {
14384
14413
  }
14385
14414
  var cookCommand = new Command15().name("cook").description("One-click agent preparation and execution from vm0.yaml").argument("[prompt]", "Prompt for the agent").option(
14386
14415
  "-t, --timeout <seconds>",
14387
- "Polling timeout in seconds for agent run (default: 120)"
14416
+ "Timeout in seconds without new events for agent run (default: 120)"
14388
14417
  ).action(async (prompt, options) => {
14389
14418
  const cwd = process.cwd();
14390
14419
  console.log(chalk14.blue(`Reading config: ${CONFIG_FILE3}`));
@@ -14552,7 +14581,7 @@ var cookCommand = new Command15().name("cook").description("One-click agent prep
14552
14581
 
14553
14582
  // src/index.ts
14554
14583
  var program = new Command16();
14555
- program.name("vm0").description("VM0 CLI - A modern build tool").version("3.7.0");
14584
+ program.name("vm0").description("VM0 CLI - A modern build tool").version("3.8.1");
14556
14585
  program.command("hello").description("Say hello from the App").action(() => {
14557
14586
  console.log(chalk15.blue("Welcome to the VM0 CLI!"));
14558
14587
  console.log(chalk15.green(`Core says: ${FOO}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "3.7.0",
3
+ "version": "3.8.1",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",