@vm0/cli 4.32.0 → 4.33.0

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 +135 -16
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2760,7 +2760,7 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
2760
2760
  function isValidBase64URL(data) {
2761
2761
  if (!base64url.test(data))
2762
2762
  return false;
2763
- const base643 = data.replace(/[-_]/g, (c10) => c10 === "-" ? "+" : "/");
2763
+ const base643 = data.replace(/[-_]/g, (c11) => c11 === "-" ? "+" : "/");
2764
2764
  const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
2765
2765
  return isValidBase64(padded);
2766
2766
  }
@@ -11672,9 +11672,9 @@ var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
11672
11672
  ZodType.init(inst, def);
11673
11673
  inst.min = (value, params) => inst.check(_gte(value, params));
11674
11674
  inst.max = (value, params) => inst.check(_lte(value, params));
11675
- const c10 = inst._zod.bag;
11676
- inst.minDate = c10.minimum ? new Date(c10.minimum) : null;
11677
- inst.maxDate = c10.maximum ? new Date(c10.maximum) : null;
11675
+ const c11 = inst._zod.bag;
11676
+ inst.minDate = c11.minimum ? new Date(c11.minimum) : null;
11677
+ inst.maxDate = c11.maximum ? new Date(c11.maximum) : null;
11678
11678
  });
11679
11679
  function date3(params) {
11680
11680
  return _date(ZodDate, params);
@@ -13526,6 +13526,82 @@ var scopeContract = c9.router({
13526
13526
  }
13527
13527
  });
13528
13528
 
13529
+ // ../../packages/core/src/contracts/sessions.ts
13530
+ var c10 = initContract();
13531
+ var sessionResponseSchema = external_exports.object({
13532
+ id: external_exports.string(),
13533
+ agentComposeId: external_exports.string(),
13534
+ agentComposeVersionId: external_exports.string().nullable(),
13535
+ conversationId: external_exports.string().nullable(),
13536
+ artifactName: external_exports.string().nullable(),
13537
+ vars: external_exports.record(external_exports.string(), external_exports.string()).nullable(),
13538
+ secretNames: external_exports.array(external_exports.string()).nullable(),
13539
+ volumeVersions: external_exports.record(external_exports.string(), external_exports.string()).nullable(),
13540
+ createdAt: external_exports.string(),
13541
+ updatedAt: external_exports.string()
13542
+ });
13543
+ var agentComposeSnapshotSchema = external_exports.object({
13544
+ agentComposeVersionId: external_exports.string(),
13545
+ vars: external_exports.record(external_exports.string(), external_exports.string()).optional(),
13546
+ secretNames: external_exports.array(external_exports.string()).optional()
13547
+ });
13548
+ var artifactSnapshotSchema2 = external_exports.object({
13549
+ artifactName: external_exports.string(),
13550
+ artifactVersion: external_exports.string()
13551
+ });
13552
+ var volumeVersionsSnapshotSchema2 = external_exports.object({
13553
+ versions: external_exports.record(external_exports.string(), external_exports.string())
13554
+ });
13555
+ var checkpointResponseSchema = external_exports.object({
13556
+ id: external_exports.string(),
13557
+ runId: external_exports.string(),
13558
+ conversationId: external_exports.string(),
13559
+ agentComposeSnapshot: agentComposeSnapshotSchema,
13560
+ artifactSnapshot: artifactSnapshotSchema2.nullable(),
13561
+ volumeVersionsSnapshot: volumeVersionsSnapshotSchema2.nullable(),
13562
+ createdAt: external_exports.string()
13563
+ });
13564
+ var sessionsByIdContract = c10.router({
13565
+ /**
13566
+ * GET /api/agent/sessions/:id
13567
+ * Get session by ID
13568
+ */
13569
+ getById: {
13570
+ method: "GET",
13571
+ path: "/api/agent/sessions/:id",
13572
+ pathParams: external_exports.object({
13573
+ id: external_exports.string().min(1, "Session ID is required")
13574
+ }),
13575
+ responses: {
13576
+ 200: sessionResponseSchema,
13577
+ 401: apiErrorSchema,
13578
+ 403: apiErrorSchema,
13579
+ 404: apiErrorSchema
13580
+ },
13581
+ summary: "Get session by ID"
13582
+ }
13583
+ });
13584
+ var checkpointsByIdContract = c10.router({
13585
+ /**
13586
+ * GET /api/agent/checkpoints/:id
13587
+ * Get checkpoint by ID
13588
+ */
13589
+ getById: {
13590
+ method: "GET",
13591
+ path: "/api/agent/checkpoints/:id",
13592
+ pathParams: external_exports.object({
13593
+ id: external_exports.string().min(1, "Checkpoint ID is required")
13594
+ }),
13595
+ responses: {
13596
+ 200: checkpointResponseSchema,
13597
+ 401: apiErrorSchema,
13598
+ 403: apiErrorSchema,
13599
+ 404: apiErrorSchema
13600
+ },
13601
+ summary: "Get checkpoint by ID"
13602
+ }
13603
+ });
13604
+
13529
13605
  // ../../packages/core/src/scope-reference.ts
13530
13606
  function getLegacySystemTemplateWarning(legacyFormat) {
13531
13607
  if (!isLegacySystemTemplate(legacyFormat)) {
@@ -13930,6 +14006,47 @@ var ApiClient = class {
13930
14006
  }
13931
14007
  return await response.json();
13932
14008
  }
14009
+ /**
14010
+ * Get session by ID
14011
+ * Used by run continue to fetch session info including secretNames
14012
+ */
14013
+ async getSession(sessionId) {
14014
+ const baseUrl = await this.getBaseUrl();
14015
+ const headers = await this.getHeaders();
14016
+ const response = await fetch(`${baseUrl}/api/agent/sessions/${sessionId}`, {
14017
+ method: "GET",
14018
+ headers
14019
+ });
14020
+ if (!response.ok) {
14021
+ const error43 = await response.json();
14022
+ throw new Error(
14023
+ error43.error?.message || `Session not found: ${sessionId}`
14024
+ );
14025
+ }
14026
+ return await response.json();
14027
+ }
14028
+ /**
14029
+ * Get checkpoint by ID
14030
+ * Used by run resume to fetch checkpoint info including secretNames
14031
+ */
14032
+ async getCheckpoint(checkpointId) {
14033
+ const baseUrl = await this.getBaseUrl();
14034
+ const headers = await this.getHeaders();
14035
+ const response = await fetch(
14036
+ `${baseUrl}/api/agent/checkpoints/${checkpointId}`,
14037
+ {
14038
+ method: "GET",
14039
+ headers
14040
+ }
14041
+ );
14042
+ if (!response.ok) {
14043
+ const error43 = await response.json();
14044
+ throw new Error(
14045
+ error43.error?.message || `Checkpoint not found: ${checkpointId}`
14046
+ );
14047
+ }
14048
+ return await response.json();
14049
+ }
13933
14050
  /**
13934
14051
  * Generic GET request
13935
14052
  */
@@ -15264,9 +15381,9 @@ var CodexEventParser = class {
15264
15381
  }
15265
15382
  }
15266
15383
  if (itemType === "file_change" && item.changes && item.changes.length > 0) {
15267
- const changes = item.changes.map((c10) => {
15268
- const action = c10.kind === "add" ? "Created" : c10.kind === "modify" ? "Modified" : "Deleted";
15269
- return `${action}: ${c10.path}`;
15384
+ const changes = item.changes.map((c11) => {
15385
+ const action = c11.kind === "add" ? "Created" : c11.kind === "modify" ? "Modified" : "Deleted";
15386
+ return `${action}: ${c11.path}`;
15270
15387
  }).join("\n");
15271
15388
  return {
15272
15389
  type: "text",
@@ -15607,9 +15724,9 @@ var CodexEventRenderer = class {
15607
15724
  return;
15608
15725
  }
15609
15726
  if (itemType === "file_change" && item.changes && item.changes.length > 0) {
15610
- const summary = item.changes.map((c10) => {
15611
- const icon = c10.kind === "add" ? "+" : c10.kind === "delete" ? "-" : "~";
15612
- return `${icon}${c10.path}`;
15727
+ const summary = item.changes.map((c11) => {
15728
+ const icon = c11.kind === "add" ? "+" : c11.kind === "delete" ? "-" : "~";
15729
+ return `${icon}${c11.path}`;
15613
15730
  }).join(", ");
15614
15731
  console.log(chalk4.green("[files]") + ` ${summary}`);
15615
15732
  return;
@@ -16028,8 +16145,9 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
16028
16145
  console.error(chalk5.dim(" Checkpoint ID must be a valid UUID"));
16029
16146
  process.exit(1);
16030
16147
  }
16031
- const secretNames = Object.keys(secrets);
16032
- const loadedSecrets = secretNames.length > 0 ? secrets : loadValues({}, []);
16148
+ const checkpointInfo = await apiClient.getCheckpoint(checkpointId);
16149
+ const requiredSecretNames = checkpointInfo.agentComposeSnapshot.secretNames || [];
16150
+ const loadedSecrets = loadValues(secrets, requiredSecretNames);
16033
16151
  if (verbose) {
16034
16152
  logVerbosePreFlight("Resuming agent run from checkpoint", [
16035
16153
  { label: "Checkpoint ID", value: checkpointId },
@@ -16125,8 +16243,9 @@ runCmd.command("continue").description(
16125
16243
  console.error(chalk5.dim(" Agent session ID must be a valid UUID"));
16126
16244
  process.exit(1);
16127
16245
  }
16128
- const secretNames = Object.keys(secrets);
16129
- const loadedSecrets = secretNames.length > 0 ? secrets : loadValues({}, []);
16246
+ const sessionInfo = await apiClient.getSession(agentSessionId);
16247
+ const requiredSecretNames = sessionInfo.secretNames || [];
16248
+ const loadedSecrets = loadValues(secrets, requiredSecretNames);
16130
16249
  if (verbose) {
16131
16250
  logVerbosePreFlight("Continuing agent run from session", [
16132
16251
  { label: "Session ID", value: agentSessionId },
@@ -17505,7 +17624,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
17505
17624
  }
17506
17625
  var cookCmd = new Command17().name("cook").description("One-click agent preparation and execution from vm0.yaml");
17507
17626
  cookCmd.argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
17508
- const shouldExit = await checkAndUpgrade("4.32.0", prompt);
17627
+ const shouldExit = await checkAndUpgrade("4.33.0", prompt);
17509
17628
  if (shouldExit) {
17510
17629
  process.exit(0);
17511
17630
  }
@@ -19096,7 +19215,7 @@ var setupGithubCommand = new Command28().name("setup-github").description("Initi
19096
19215
 
19097
19216
  // src/index.ts
19098
19217
  var program = new Command29();
19099
- program.name("vm0").description("VM0 CLI - A modern build tool").version("4.32.0");
19218
+ program.name("vm0").description("VM0 CLI - A modern build tool").version("4.33.0");
19100
19219
  program.command("info").description("Display environment information").action(async () => {
19101
19220
  console.log(chalk31.bold("System Information:"));
19102
19221
  console.log(`Node Version: ${process.version}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "4.32.0",
3
+ "version": "4.33.0",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",