@vm0/cli 9.29.5 → 9.30.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 +723 -892
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -45,7 +45,7 @@ if (DSN) {
45
45
  Sentry.init({
46
46
  dsn: DSN,
47
47
  environment: process.env.SENTRY_ENVIRONMENT ?? "production",
48
- release: "9.29.5",
48
+ release: "9.30.1",
49
49
  sendDefaultPii: false,
50
50
  tracesSampleRate: 0,
51
51
  shutdownTimeout: 500,
@@ -64,7 +64,7 @@ if (DSN) {
64
64
  }
65
65
  });
66
66
  Sentry.setContext("cli", {
67
- version: "9.29.5",
67
+ version: "9.30.1",
68
68
  command: process.argv.slice(2).join(" ")
69
69
  });
70
70
  Sentry.setContext("runtime", {
@@ -82,7 +82,6 @@ import { Command as Command5 } from "commander";
82
82
 
83
83
  // src/commands/auth/login.ts
84
84
  import { Command } from "commander";
85
- import chalk2 from "chalk";
86
85
 
87
86
  // src/lib/api/auth.ts
88
87
  import chalk from "chalk";
@@ -265,23 +264,83 @@ async function setupToken() {
265
264
  );
266
265
  }
267
266
 
268
- // src/commands/auth/login.ts
269
- var loginCommand = new Command().name("login").description("Log in to VM0 (use VM0_API_URL env var to set API URL)").action(async () => {
270
- try {
271
- await authenticate();
272
- } catch (error) {
273
- if (error instanceof Error) {
274
- console.error(chalk2.red(`\u2717 Login failed`));
275
- console.error(chalk2.dim(` ${error.message}`));
276
- if (error.cause instanceof Error) {
267
+ // src/lib/command/with-error-handler.ts
268
+ import chalk2 from "chalk";
269
+
270
+ // src/lib/api/core/client-factory.ts
271
+ var ApiRequestError = class extends Error {
272
+ constructor(message, code, status) {
273
+ super(message);
274
+ this.code = code;
275
+ this.status = status;
276
+ this.name = "ApiRequestError";
277
+ }
278
+ };
279
+ async function getHeaders() {
280
+ const token = await getToken();
281
+ if (!token) {
282
+ throw new ApiRequestError("Not authenticated", "UNAUTHORIZED", 401);
283
+ }
284
+ const headers = {
285
+ Authorization: `Bearer ${token}`
286
+ };
287
+ const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET;
288
+ if (bypassSecret) {
289
+ headers["x-vercel-protection-bypass"] = bypassSecret;
290
+ }
291
+ return headers;
292
+ }
293
+ async function getBaseUrl() {
294
+ const apiUrl = await getApiUrl();
295
+ if (!apiUrl) {
296
+ throw new Error("API URL not configured");
297
+ }
298
+ return apiUrl;
299
+ }
300
+ async function getClientConfig() {
301
+ const baseUrl = await getBaseUrl();
302
+ const baseHeaders = await getHeaders();
303
+ return { baseUrl, baseHeaders, jsonQuery: false };
304
+ }
305
+ function handleError(result, defaultMessage) {
306
+ const errorBody = result.body;
307
+ const message = errorBody.error?.message || defaultMessage;
308
+ const code = errorBody.error?.code || "UNKNOWN";
309
+ throw new ApiRequestError(message, code, result.status);
310
+ }
311
+
312
+ // src/lib/command/with-error-handler.ts
313
+ function withErrorHandler(fn) {
314
+ return async (...args) => {
315
+ try {
316
+ await fn(...args);
317
+ } catch (error) {
318
+ if (error instanceof ApiRequestError) {
319
+ if (error.code === "UNAUTHORIZED") {
320
+ console.error(chalk2.red("\u2717 Not authenticated"));
321
+ console.error(chalk2.dim(" Run: vm0 auth login"));
322
+ } else {
323
+ console.error(chalk2.red(`\u2717 ${error.status}: ${error.message}`));
324
+ }
325
+ } else if (error instanceof Error) {
326
+ console.error(chalk2.red(`\u2717 ${error.message}`));
327
+ } else {
328
+ console.error(chalk2.red("\u2717 An unexpected error occurred"));
329
+ }
330
+ if (error instanceof Error && error.cause instanceof Error) {
277
331
  console.error(chalk2.dim(` Cause: ${error.cause.message}`));
278
332
  }
279
- } else {
280
- console.error(chalk2.red("\u2717 An unexpected error occurred"));
333
+ process.exit(1);
281
334
  }
282
- process.exit(1);
283
- }
284
- });
335
+ };
336
+ }
337
+
338
+ // src/commands/auth/login.ts
339
+ var loginCommand = new Command().name("login").description("Log in to VM0 (use VM0_API_URL env var to set API URL)").action(
340
+ withErrorHandler(async () => {
341
+ await authenticate();
342
+ })
343
+ );
285
344
 
286
345
  // src/commands/auth/logout.ts
287
346
  import { Command as Command2 } from "commander";
@@ -546,7 +605,7 @@ async function waitForSilentUpgrade(timeout = TIMEOUT_MS) {
546
605
  // src/commands/info/index.ts
547
606
  var CONFIG_PATH = join2(homedir2(), ".vm0", "config.json");
548
607
  var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
549
- console.log(chalk7.bold(`VM0 CLI v${"9.29.5"}`));
608
+ console.log(chalk7.bold(`VM0 CLI v${"9.30.1"}`));
550
609
  console.log();
551
610
  const config = await loadConfig();
552
611
  const hasEnvToken = !!process.env.VM0_TOKEN;
@@ -3370,74 +3429,36 @@ var platformArtifactDownloadContract = c17.router({
3370
3429
  }
3371
3430
  });
3372
3431
 
3373
- // ../../packages/core/src/contracts/llm.ts
3432
+ // ../../packages/core/src/contracts/compose-jobs.ts
3374
3433
  import { z as z22 } from "zod";
3375
3434
  var c18 = initContract();
3376
- var messageRoleSchema = z22.enum(["user", "assistant", "system"]);
3377
- var chatMessageSchema = z22.object({
3378
- role: messageRoleSchema,
3379
- content: z22.string()
3380
- });
3381
- var tokenUsageSchema = z22.object({
3382
- promptTokens: z22.number(),
3383
- completionTokens: z22.number(),
3384
- totalTokens: z22.number()
3385
- });
3386
- var llmChatRequestSchema = z22.object({
3387
- model: z22.string().min(1).optional(),
3388
- messages: z22.array(chatMessageSchema).min(1, "At least one message is required"),
3389
- stream: z22.boolean().optional().default(false)
3390
- });
3391
- var llmChatResponseSchema = z22.object({
3392
- content: z22.string(),
3393
- model: z22.string(),
3394
- usage: tokenUsageSchema
3395
- });
3396
- var llmChatContract = c18.router({
3397
- chat: {
3398
- method: "POST",
3399
- path: "/api/llm/chat",
3400
- body: llmChatRequestSchema,
3401
- responses: {
3402
- 200: llmChatResponseSchema,
3403
- 400: apiErrorSchema,
3404
- 500: apiErrorSchema,
3405
- 503: apiErrorSchema
3406
- },
3407
- summary: "Send a chat completion request to OpenRouter"
3408
- }
3409
- });
3410
-
3411
- // ../../packages/core/src/contracts/compose-jobs.ts
3412
- import { z as z23 } from "zod";
3413
- var c19 = initContract();
3414
- var composeJobStatusSchema = z23.enum([
3435
+ var composeJobStatusSchema = z22.enum([
3415
3436
  "pending",
3416
3437
  "running",
3417
3438
  "completed",
3418
3439
  "failed"
3419
3440
  ]);
3420
- var composeJobResultSchema = z23.object({
3421
- composeId: z23.string(),
3422
- composeName: z23.string(),
3423
- versionId: z23.string(),
3424
- warnings: z23.array(z23.string())
3425
- });
3426
- var createComposeJobRequestSchema = z23.object({
3427
- githubUrl: z23.string().url().startsWith("https://github.com/"),
3428
- overwrite: z23.boolean().optional().default(false)
3429
- });
3430
- var composeJobResponseSchema = z23.object({
3431
- jobId: z23.string(),
3441
+ var composeJobResultSchema = z22.object({
3442
+ composeId: z22.string(),
3443
+ composeName: z22.string(),
3444
+ versionId: z22.string(),
3445
+ warnings: z22.array(z22.string())
3446
+ });
3447
+ var createComposeJobRequestSchema = z22.object({
3448
+ githubUrl: z22.string().url().startsWith("https://github.com/"),
3449
+ overwrite: z22.boolean().optional().default(false)
3450
+ });
3451
+ var composeJobResponseSchema = z22.object({
3452
+ jobId: z22.string(),
3432
3453
  status: composeJobStatusSchema,
3433
- githubUrl: z23.string(),
3454
+ githubUrl: z22.string(),
3434
3455
  result: composeJobResultSchema.optional(),
3435
- error: z23.string().optional(),
3436
- createdAt: z23.string(),
3437
- startedAt: z23.string().optional(),
3438
- completedAt: z23.string().optional()
3456
+ error: z22.string().optional(),
3457
+ createdAt: z22.string(),
3458
+ startedAt: z22.string().optional(),
3459
+ completedAt: z22.string().optional()
3439
3460
  });
3440
- var composeJobsMainContract = c19.router({
3461
+ var composeJobsMainContract = c18.router({
3441
3462
  /**
3442
3463
  * POST /api/compose/from-github
3443
3464
  * Create a new compose job from GitHub URL
@@ -3457,7 +3478,7 @@ var composeJobsMainContract = c19.router({
3457
3478
  summary: "Create compose job from GitHub URL"
3458
3479
  }
3459
3480
  });
3460
- var composeJobsByIdContract = c19.router({
3481
+ var composeJobsByIdContract = c18.router({
3461
3482
  /**
3462
3483
  * GET /api/compose/from-github/:jobId
3463
3484
  * Get compose job status and result
@@ -3466,8 +3487,8 @@ var composeJobsByIdContract = c19.router({
3466
3487
  method: "GET",
3467
3488
  path: "/api/compose/from-github/:jobId",
3468
3489
  headers: authHeadersSchema,
3469
- pathParams: z23.object({
3470
- jobId: z23.string().uuid()
3490
+ pathParams: z22.object({
3491
+ jobId: z22.string().uuid()
3471
3492
  }),
3472
3493
  responses: {
3473
3494
  200: composeJobResponseSchema,
@@ -3477,7 +3498,7 @@ var composeJobsByIdContract = c19.router({
3477
3498
  summary: "Get compose job status"
3478
3499
  }
3479
3500
  });
3480
- var webhookComposeCompleteContract = c19.router({
3501
+ var webhookComposeCompleteContract = c18.router({
3481
3502
  /**
3482
3503
  * POST /api/webhooks/compose/complete
3483
3504
  * Handle compose job completion from sandbox
@@ -3486,16 +3507,16 @@ var webhookComposeCompleteContract = c19.router({
3486
3507
  method: "POST",
3487
3508
  path: "/api/webhooks/compose/complete",
3488
3509
  headers: authHeadersSchema,
3489
- body: z23.object({
3490
- jobId: z23.string().uuid(),
3491
- success: z23.boolean(),
3510
+ body: z22.object({
3511
+ jobId: z22.string().uuid(),
3512
+ success: z22.boolean(),
3492
3513
  // Result from CLI compose command
3493
3514
  result: composeJobResultSchema.optional(),
3494
- error: z23.string().optional()
3515
+ error: z22.string().optional()
3495
3516
  }),
3496
3517
  responses: {
3497
- 200: z23.object({
3498
- success: z23.boolean()
3518
+ 200: z22.object({
3519
+ success: z22.boolean()
3499
3520
  }),
3500
3521
  400: apiErrorSchema,
3501
3522
  401: apiErrorSchema,
@@ -3506,8 +3527,8 @@ var webhookComposeCompleteContract = c19.router({
3506
3527
  });
3507
3528
 
3508
3529
  // ../../packages/core/src/contracts/connectors.ts
3509
- import { z as z24 } from "zod";
3510
- var c20 = initContract();
3530
+ import { z as z23 } from "zod";
3531
+ var c19 = initContract();
3511
3532
  var CONNECTOR_TYPES = {
3512
3533
  github: {
3513
3534
  label: "GitHub",
@@ -3536,7 +3557,7 @@ var CONNECTOR_TYPES = {
3536
3557
  }
3537
3558
  }
3538
3559
  };
3539
- var connectorTypeSchema = z24.enum(["github"]);
3560
+ var connectorTypeSchema = z23.enum(["github"]);
3540
3561
  function getConnectorDerivedNames(secretName) {
3541
3562
  const allTypes = Object.keys(CONNECTOR_TYPES);
3542
3563
  for (const type2 of allTypes) {
@@ -3560,21 +3581,21 @@ function getConnectorDerivedNames(secretName) {
3560
3581
  }
3561
3582
  return null;
3562
3583
  }
3563
- var connectorResponseSchema = z24.object({
3564
- id: z24.string().uuid(),
3584
+ var connectorResponseSchema = z23.object({
3585
+ id: z23.string().uuid(),
3565
3586
  type: connectorTypeSchema,
3566
- authMethod: z24.string(),
3567
- externalId: z24.string().nullable(),
3568
- externalUsername: z24.string().nullable(),
3569
- externalEmail: z24.string().nullable(),
3570
- oauthScopes: z24.array(z24.string()).nullable(),
3571
- createdAt: z24.string(),
3572
- updatedAt: z24.string()
3573
- });
3574
- var connectorListResponseSchema = z24.object({
3575
- connectors: z24.array(connectorResponseSchema)
3576
- });
3577
- var connectorsMainContract = c20.router({
3587
+ authMethod: z23.string(),
3588
+ externalId: z23.string().nullable(),
3589
+ externalUsername: z23.string().nullable(),
3590
+ externalEmail: z23.string().nullable(),
3591
+ oauthScopes: z23.array(z23.string()).nullable(),
3592
+ createdAt: z23.string(),
3593
+ updatedAt: z23.string()
3594
+ });
3595
+ var connectorListResponseSchema = z23.object({
3596
+ connectors: z23.array(connectorResponseSchema)
3597
+ });
3598
+ var connectorsMainContract = c19.router({
3578
3599
  list: {
3579
3600
  method: "GET",
3580
3601
  path: "/api/connectors",
@@ -3587,12 +3608,12 @@ var connectorsMainContract = c20.router({
3587
3608
  summary: "List all connectors for the authenticated user"
3588
3609
  }
3589
3610
  });
3590
- var connectorsByTypeContract = c20.router({
3611
+ var connectorsByTypeContract = c19.router({
3591
3612
  get: {
3592
3613
  method: "GET",
3593
3614
  path: "/api/connectors/:type",
3594
3615
  headers: authHeadersSchema,
3595
- pathParams: z24.object({
3616
+ pathParams: z23.object({
3596
3617
  type: connectorTypeSchema
3597
3618
  }),
3598
3619
  responses: {
@@ -3607,11 +3628,11 @@ var connectorsByTypeContract = c20.router({
3607
3628
  method: "DELETE",
3608
3629
  path: "/api/connectors/:type",
3609
3630
  headers: authHeadersSchema,
3610
- pathParams: z24.object({
3631
+ pathParams: z23.object({
3611
3632
  type: connectorTypeSchema
3612
3633
  }),
3613
3634
  responses: {
3614
- 204: c20.noBody(),
3635
+ 204: c19.noBody(),
3615
3636
  401: apiErrorSchema,
3616
3637
  404: apiErrorSchema,
3617
3638
  500: apiErrorSchema
@@ -3619,27 +3640,27 @@ var connectorsByTypeContract = c20.router({
3619
3640
  summary: "Disconnect a connector"
3620
3641
  }
3621
3642
  });
3622
- var connectorSessionStatusSchema = z24.enum([
3643
+ var connectorSessionStatusSchema = z23.enum([
3623
3644
  "pending",
3624
3645
  "complete",
3625
3646
  "expired",
3626
3647
  "error"
3627
3648
  ]);
3628
- var connectorSessionResponseSchema = z24.object({
3629
- id: z24.string().uuid(),
3630
- code: z24.string(),
3649
+ var connectorSessionResponseSchema = z23.object({
3650
+ id: z23.string().uuid(),
3651
+ code: z23.string(),
3631
3652
  type: connectorTypeSchema,
3632
3653
  status: connectorSessionStatusSchema,
3633
- verificationUrl: z24.string(),
3634
- expiresIn: z24.number(),
3635
- interval: z24.number(),
3636
- errorMessage: z24.string().nullable().optional()
3654
+ verificationUrl: z23.string(),
3655
+ expiresIn: z23.number(),
3656
+ interval: z23.number(),
3657
+ errorMessage: z23.string().nullable().optional()
3637
3658
  });
3638
- var connectorSessionStatusResponseSchema = z24.object({
3659
+ var connectorSessionStatusResponseSchema = z23.object({
3639
3660
  status: connectorSessionStatusSchema,
3640
- errorMessage: z24.string().nullable().optional()
3661
+ errorMessage: z23.string().nullable().optional()
3641
3662
  });
3642
- var connectorSessionsContract = c20.router({
3663
+ var connectorSessionsContract = c19.router({
3643
3664
  /**
3644
3665
  * POST /api/connectors/:type/sessions
3645
3666
  * Create a new connector session for CLI device flow
@@ -3648,10 +3669,10 @@ var connectorSessionsContract = c20.router({
3648
3669
  method: "POST",
3649
3670
  path: "/api/connectors/:type/sessions",
3650
3671
  headers: authHeadersSchema,
3651
- pathParams: z24.object({
3672
+ pathParams: z23.object({
3652
3673
  type: connectorTypeSchema
3653
3674
  }),
3654
- body: z24.object({}).optional(),
3675
+ body: z23.object({}).optional(),
3655
3676
  responses: {
3656
3677
  200: connectorSessionResponseSchema,
3657
3678
  400: apiErrorSchema,
@@ -3661,7 +3682,7 @@ var connectorSessionsContract = c20.router({
3661
3682
  summary: "Create connector session for CLI device flow"
3662
3683
  }
3663
3684
  });
3664
- var connectorSessionByIdContract = c20.router({
3685
+ var connectorSessionByIdContract = c19.router({
3665
3686
  /**
3666
3687
  * GET /api/connectors/:type/sessions/:sessionId
3667
3688
  * Get connector session status (for CLI polling)
@@ -3670,9 +3691,9 @@ var connectorSessionByIdContract = c20.router({
3670
3691
  method: "GET",
3671
3692
  path: "/api/connectors/:type/sessions/:sessionId",
3672
3693
  headers: authHeadersSchema,
3673
- pathParams: z24.object({
3694
+ pathParams: z23.object({
3674
3695
  type: connectorTypeSchema,
3675
- sessionId: z24.string().uuid()
3696
+ sessionId: z23.string().uuid()
3676
3697
  }),
3677
3698
  responses: {
3678
3699
  200: connectorSessionStatusResponseSchema,
@@ -3686,28 +3707,28 @@ var connectorSessionByIdContract = c20.router({
3686
3707
  });
3687
3708
 
3688
3709
  // ../../packages/core/src/contracts/public/agents.ts
3689
- import { z as z25 } from "zod";
3690
- var c21 = initContract();
3691
- var publicAgentSchema = z25.object({
3692
- id: z25.string(),
3693
- name: z25.string(),
3694
- currentVersionId: z25.string().nullable(),
3710
+ import { z as z24 } from "zod";
3711
+ var c20 = initContract();
3712
+ var publicAgentSchema = z24.object({
3713
+ id: z24.string(),
3714
+ name: z24.string(),
3715
+ currentVersionId: z24.string().nullable(),
3695
3716
  createdAt: timestampSchema,
3696
3717
  updatedAt: timestampSchema
3697
3718
  });
3698
- var agentVersionSchema = z25.object({
3699
- id: z25.string(),
3700
- agentId: z25.string(),
3701
- versionNumber: z25.number(),
3719
+ var agentVersionSchema = z24.object({
3720
+ id: z24.string(),
3721
+ agentId: z24.string(),
3722
+ versionNumber: z24.number(),
3702
3723
  createdAt: timestampSchema
3703
3724
  });
3704
3725
  var publicAgentDetailSchema = publicAgentSchema;
3705
3726
  var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
3706
3727
  var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
3707
3728
  var agentListQuerySchema = listQuerySchema.extend({
3708
- name: z25.string().optional()
3729
+ name: z24.string().optional()
3709
3730
  });
3710
- var publicAgentsListContract = c21.router({
3731
+ var publicAgentsListContract = c20.router({
3711
3732
  list: {
3712
3733
  method: "GET",
3713
3734
  path: "/v1/agents",
@@ -3722,13 +3743,13 @@ var publicAgentsListContract = c21.router({
3722
3743
  description: "List all agents in the current scope with pagination. Use the `name` query parameter to filter by agent name."
3723
3744
  }
3724
3745
  });
3725
- var publicAgentByIdContract = c21.router({
3746
+ var publicAgentByIdContract = c20.router({
3726
3747
  get: {
3727
3748
  method: "GET",
3728
3749
  path: "/v1/agents/:id",
3729
3750
  headers: authHeadersSchema,
3730
- pathParams: z25.object({
3731
- id: z25.string().min(1, "Agent ID is required")
3751
+ pathParams: z24.object({
3752
+ id: z24.string().min(1, "Agent ID is required")
3732
3753
  }),
3733
3754
  responses: {
3734
3755
  200: publicAgentDetailSchema,
@@ -3740,13 +3761,13 @@ var publicAgentByIdContract = c21.router({
3740
3761
  description: "Get agent details by ID"
3741
3762
  }
3742
3763
  });
3743
- var publicAgentVersionsContract = c21.router({
3764
+ var publicAgentVersionsContract = c20.router({
3744
3765
  list: {
3745
3766
  method: "GET",
3746
3767
  path: "/v1/agents/:id/versions",
3747
3768
  headers: authHeadersSchema,
3748
- pathParams: z25.object({
3749
- id: z25.string().min(1, "Agent ID is required")
3769
+ pathParams: z24.object({
3770
+ id: z24.string().min(1, "Agent ID is required")
3750
3771
  }),
3751
3772
  query: listQuerySchema,
3752
3773
  responses: {
@@ -3761,9 +3782,9 @@ var publicAgentVersionsContract = c21.router({
3761
3782
  });
3762
3783
 
3763
3784
  // ../../packages/core/src/contracts/public/runs.ts
3764
- import { z as z26 } from "zod";
3765
- var c22 = initContract();
3766
- var publicRunStatusSchema = z26.enum([
3785
+ import { z as z25 } from "zod";
3786
+ var c21 = initContract();
3787
+ var publicRunStatusSchema = z25.enum([
3767
3788
  "pending",
3768
3789
  "running",
3769
3790
  "completed",
@@ -3771,54 +3792,54 @@ var publicRunStatusSchema = z26.enum([
3771
3792
  "timeout",
3772
3793
  "cancelled"
3773
3794
  ]);
3774
- var publicRunSchema = z26.object({
3775
- id: z26.string(),
3776
- agentId: z26.string(),
3777
- agentName: z26.string(),
3795
+ var publicRunSchema = z25.object({
3796
+ id: z25.string(),
3797
+ agentId: z25.string(),
3798
+ agentName: z25.string(),
3778
3799
  status: publicRunStatusSchema,
3779
- prompt: z26.string(),
3800
+ prompt: z25.string(),
3780
3801
  createdAt: timestampSchema,
3781
3802
  startedAt: timestampSchema.nullable(),
3782
3803
  completedAt: timestampSchema.nullable()
3783
3804
  });
3784
3805
  var publicRunDetailSchema = publicRunSchema.extend({
3785
- error: z26.string().nullable(),
3786
- executionTimeMs: z26.number().nullable(),
3787
- checkpointId: z26.string().nullable(),
3788
- sessionId: z26.string().nullable(),
3789
- artifactName: z26.string().nullable(),
3790
- artifactVersion: z26.string().nullable(),
3791
- volumes: z26.record(z26.string(), z26.string()).optional()
3806
+ error: z25.string().nullable(),
3807
+ executionTimeMs: z25.number().nullable(),
3808
+ checkpointId: z25.string().nullable(),
3809
+ sessionId: z25.string().nullable(),
3810
+ artifactName: z25.string().nullable(),
3811
+ artifactVersion: z25.string().nullable(),
3812
+ volumes: z25.record(z25.string(), z25.string()).optional()
3792
3813
  });
3793
3814
  var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
3794
- var createRunRequestSchema = z26.object({
3815
+ var createRunRequestSchema = z25.object({
3795
3816
  // Agent identification (one of: agent, agentId, sessionId, checkpointId)
3796
- agent: z26.string().optional(),
3817
+ agent: z25.string().optional(),
3797
3818
  // Agent name
3798
- agentId: z26.string().optional(),
3819
+ agentId: z25.string().optional(),
3799
3820
  // Agent ID
3800
- agentVersion: z26.string().optional(),
3821
+ agentVersion: z25.string().optional(),
3801
3822
  // Version specifier (e.g., "latest", "v1", specific ID)
3802
3823
  // Continue session
3803
- sessionId: z26.string().optional(),
3824
+ sessionId: z25.string().optional(),
3804
3825
  // Resume from checkpoint
3805
- checkpointId: z26.string().optional(),
3826
+ checkpointId: z25.string().optional(),
3806
3827
  // Required
3807
- prompt: z26.string().min(1, "Prompt is required"),
3828
+ prompt: z25.string().min(1, "Prompt is required"),
3808
3829
  // Optional configuration
3809
- variables: z26.record(z26.string(), z26.string()).optional(),
3810
- secrets: z26.record(z26.string(), z26.string()).optional(),
3811
- artifactName: z26.string().optional(),
3830
+ variables: z25.record(z25.string(), z25.string()).optional(),
3831
+ secrets: z25.record(z25.string(), z25.string()).optional(),
3832
+ artifactName: z25.string().optional(),
3812
3833
  // Artifact name to mount
3813
- artifactVersion: z26.string().optional(),
3834
+ artifactVersion: z25.string().optional(),
3814
3835
  // Artifact version (defaults to latest)
3815
- volumes: z26.record(z26.string(), z26.string()).optional()
3836
+ volumes: z25.record(z25.string(), z25.string()).optional()
3816
3837
  // volume_name -> version
3817
3838
  });
3818
3839
  var runListQuerySchema = listQuerySchema.extend({
3819
3840
  status: publicRunStatusSchema.optional()
3820
3841
  });
3821
- var publicRunsListContract = c22.router({
3842
+ var publicRunsListContract = c21.router({
3822
3843
  list: {
3823
3844
  method: "GET",
3824
3845
  path: "/v1/runs",
@@ -3850,13 +3871,13 @@ var publicRunsListContract = c22.router({
3850
3871
  description: "Create and execute a new agent run. Returns 202 Accepted as runs execute asynchronously."
3851
3872
  }
3852
3873
  });
3853
- var publicRunByIdContract = c22.router({
3874
+ var publicRunByIdContract = c21.router({
3854
3875
  get: {
3855
3876
  method: "GET",
3856
3877
  path: "/v1/runs/:id",
3857
3878
  headers: authHeadersSchema,
3858
- pathParams: z26.object({
3859
- id: z26.string().min(1, "Run ID is required")
3879
+ pathParams: z25.object({
3880
+ id: z25.string().min(1, "Run ID is required")
3860
3881
  }),
3861
3882
  responses: {
3862
3883
  200: publicRunDetailSchema,
@@ -3868,15 +3889,15 @@ var publicRunByIdContract = c22.router({
3868
3889
  description: "Get run details by ID"
3869
3890
  }
3870
3891
  });
3871
- var publicRunCancelContract = c22.router({
3892
+ var publicRunCancelContract = c21.router({
3872
3893
  cancel: {
3873
3894
  method: "POST",
3874
3895
  path: "/v1/runs/:id/cancel",
3875
3896
  headers: authHeadersSchema,
3876
- pathParams: z26.object({
3877
- id: z26.string().min(1, "Run ID is required")
3897
+ pathParams: z25.object({
3898
+ id: z25.string().min(1, "Run ID is required")
3878
3899
  }),
3879
- body: z26.undefined(),
3900
+ body: z25.undefined(),
3880
3901
  responses: {
3881
3902
  200: publicRunDetailSchema,
3882
3903
  400: publicApiErrorSchema,
@@ -3889,27 +3910,27 @@ var publicRunCancelContract = c22.router({
3889
3910
  description: "Cancel a pending or running execution"
3890
3911
  }
3891
3912
  });
3892
- var logEntrySchema = z26.object({
3913
+ var logEntrySchema = z25.object({
3893
3914
  timestamp: timestampSchema,
3894
- type: z26.enum(["agent", "system", "network"]),
3895
- level: z26.enum(["debug", "info", "warn", "error"]),
3896
- message: z26.string(),
3897
- metadata: z26.record(z26.string(), z26.unknown()).optional()
3915
+ type: z25.enum(["agent", "system", "network"]),
3916
+ level: z25.enum(["debug", "info", "warn", "error"]),
3917
+ message: z25.string(),
3918
+ metadata: z25.record(z25.string(), z25.unknown()).optional()
3898
3919
  });
3899
3920
  var paginatedLogsSchema = createPaginatedResponseSchema(logEntrySchema);
3900
3921
  var logsQuerySchema = listQuerySchema.extend({
3901
- type: z26.enum(["agent", "system", "network", "all"]).default("all"),
3922
+ type: z25.enum(["agent", "system", "network", "all"]).default("all"),
3902
3923
  since: timestampSchema.optional(),
3903
3924
  until: timestampSchema.optional(),
3904
- order: z26.enum(["asc", "desc"]).default("asc")
3925
+ order: z25.enum(["asc", "desc"]).default("asc")
3905
3926
  });
3906
- var publicRunLogsContract = c22.router({
3927
+ var publicRunLogsContract = c21.router({
3907
3928
  getLogs: {
3908
3929
  method: "GET",
3909
3930
  path: "/v1/runs/:id/logs",
3910
3931
  headers: authHeadersSchema,
3911
- pathParams: z26.object({
3912
- id: z26.string().min(1, "Run ID is required")
3932
+ pathParams: z25.object({
3933
+ id: z25.string().min(1, "Run ID is required")
3913
3934
  }),
3914
3935
  query: logsQuerySchema,
3915
3936
  responses: {
@@ -3922,30 +3943,30 @@ var publicRunLogsContract = c22.router({
3922
3943
  description: "Get unified logs for a run. Combines agent, system, and network logs."
3923
3944
  }
3924
3945
  });
3925
- var metricPointSchema = z26.object({
3946
+ var metricPointSchema = z25.object({
3926
3947
  timestamp: timestampSchema,
3927
- cpuPercent: z26.number(),
3928
- memoryUsedMb: z26.number(),
3929
- memoryTotalMb: z26.number(),
3930
- diskUsedMb: z26.number(),
3931
- diskTotalMb: z26.number()
3932
- });
3933
- var metricsSummarySchema = z26.object({
3934
- avgCpuPercent: z26.number(),
3935
- maxMemoryUsedMb: z26.number(),
3936
- totalDurationMs: z26.number().nullable()
3937
- });
3938
- var metricsResponseSchema2 = z26.object({
3939
- data: z26.array(metricPointSchema),
3948
+ cpuPercent: z25.number(),
3949
+ memoryUsedMb: z25.number(),
3950
+ memoryTotalMb: z25.number(),
3951
+ diskUsedMb: z25.number(),
3952
+ diskTotalMb: z25.number()
3953
+ });
3954
+ var metricsSummarySchema = z25.object({
3955
+ avgCpuPercent: z25.number(),
3956
+ maxMemoryUsedMb: z25.number(),
3957
+ totalDurationMs: z25.number().nullable()
3958
+ });
3959
+ var metricsResponseSchema2 = z25.object({
3960
+ data: z25.array(metricPointSchema),
3940
3961
  summary: metricsSummarySchema
3941
3962
  });
3942
- var publicRunMetricsContract = c22.router({
3963
+ var publicRunMetricsContract = c21.router({
3943
3964
  getMetrics: {
3944
3965
  method: "GET",
3945
3966
  path: "/v1/runs/:id/metrics",
3946
3967
  headers: authHeadersSchema,
3947
- pathParams: z26.object({
3948
- id: z26.string().min(1, "Run ID is required")
3968
+ pathParams: z25.object({
3969
+ id: z25.string().min(1, "Run ID is required")
3949
3970
  }),
3950
3971
  responses: {
3951
3972
  200: metricsResponseSchema2,
@@ -3957,7 +3978,7 @@ var publicRunMetricsContract = c22.router({
3957
3978
  description: "Get CPU, memory, and disk metrics for a run"
3958
3979
  }
3959
3980
  });
3960
- var sseEventTypeSchema = z26.enum([
3981
+ var sseEventTypeSchema = z25.enum([
3961
3982
  "status",
3962
3983
  // Run status change
3963
3984
  "output",
@@ -3969,26 +3990,26 @@ var sseEventTypeSchema = z26.enum([
3969
3990
  "heartbeat"
3970
3991
  // Keep-alive
3971
3992
  ]);
3972
- var sseEventSchema = z26.object({
3993
+ var sseEventSchema = z25.object({
3973
3994
  event: sseEventTypeSchema,
3974
- data: z26.unknown(),
3975
- id: z26.string().optional()
3995
+ data: z25.unknown(),
3996
+ id: z25.string().optional()
3976
3997
  // For Last-Event-ID reconnection
3977
3998
  });
3978
- var publicRunEventsContract = c22.router({
3999
+ var publicRunEventsContract = c21.router({
3979
4000
  streamEvents: {
3980
4001
  method: "GET",
3981
4002
  path: "/v1/runs/:id/events",
3982
4003
  headers: authHeadersSchema,
3983
- pathParams: z26.object({
3984
- id: z26.string().min(1, "Run ID is required")
4004
+ pathParams: z25.object({
4005
+ id: z25.string().min(1, "Run ID is required")
3985
4006
  }),
3986
- query: z26.object({
3987
- lastEventId: z26.string().optional()
4007
+ query: z25.object({
4008
+ lastEventId: z25.string().optional()
3988
4009
  // For reconnection
3989
4010
  }),
3990
4011
  responses: {
3991
- 200: z26.any(),
4012
+ 200: z25.any(),
3992
4013
  // SSE stream - actual content is text/event-stream
3993
4014
  401: publicApiErrorSchema,
3994
4015
  404: publicApiErrorSchema,
@@ -4000,28 +4021,28 @@ var publicRunEventsContract = c22.router({
4000
4021
  });
4001
4022
 
4002
4023
  // ../../packages/core/src/contracts/public/artifacts.ts
4003
- import { z as z27 } from "zod";
4004
- var c23 = initContract();
4005
- var publicArtifactSchema = z27.object({
4006
- id: z27.string(),
4007
- name: z27.string(),
4008
- currentVersionId: z27.string().nullable(),
4009
- size: z27.number(),
4024
+ import { z as z26 } from "zod";
4025
+ var c22 = initContract();
4026
+ var publicArtifactSchema = z26.object({
4027
+ id: z26.string(),
4028
+ name: z26.string(),
4029
+ currentVersionId: z26.string().nullable(),
4030
+ size: z26.number(),
4010
4031
  // Total size in bytes
4011
- fileCount: z27.number(),
4032
+ fileCount: z26.number(),
4012
4033
  createdAt: timestampSchema,
4013
4034
  updatedAt: timestampSchema
4014
4035
  });
4015
- var artifactVersionSchema = z27.object({
4016
- id: z27.string(),
4036
+ var artifactVersionSchema = z26.object({
4037
+ id: z26.string(),
4017
4038
  // SHA-256 content hash
4018
- artifactId: z27.string(),
4019
- size: z27.number(),
4039
+ artifactId: z26.string(),
4040
+ size: z26.number(),
4020
4041
  // Size in bytes
4021
- fileCount: z27.number(),
4022
- message: z27.string().nullable(),
4042
+ fileCount: z26.number(),
4043
+ message: z26.string().nullable(),
4023
4044
  // Optional commit message
4024
- createdBy: z27.string(),
4045
+ createdBy: z26.string(),
4025
4046
  createdAt: timestampSchema
4026
4047
  });
4027
4048
  var publicArtifactDetailSchema = publicArtifactSchema.extend({
@@ -4031,7 +4052,7 @@ var paginatedArtifactsSchema = createPaginatedResponseSchema(publicArtifactSchem
4031
4052
  var paginatedArtifactVersionsSchema = createPaginatedResponseSchema(
4032
4053
  artifactVersionSchema
4033
4054
  );
4034
- var publicArtifactsListContract = c23.router({
4055
+ var publicArtifactsListContract = c22.router({
4035
4056
  list: {
4036
4057
  method: "GET",
4037
4058
  path: "/v1/artifacts",
@@ -4046,13 +4067,13 @@ var publicArtifactsListContract = c23.router({
4046
4067
  description: "List all artifacts in the current scope with pagination"
4047
4068
  }
4048
4069
  });
4049
- var publicArtifactByIdContract = c23.router({
4070
+ var publicArtifactByIdContract = c22.router({
4050
4071
  get: {
4051
4072
  method: "GET",
4052
4073
  path: "/v1/artifacts/:id",
4053
4074
  headers: authHeadersSchema,
4054
- pathParams: z27.object({
4055
- id: z27.string().min(1, "Artifact ID is required")
4075
+ pathParams: z26.object({
4076
+ id: z26.string().min(1, "Artifact ID is required")
4056
4077
  }),
4057
4078
  responses: {
4058
4079
  200: publicArtifactDetailSchema,
@@ -4064,13 +4085,13 @@ var publicArtifactByIdContract = c23.router({
4064
4085
  description: "Get artifact details by ID"
4065
4086
  }
4066
4087
  });
4067
- var publicArtifactVersionsContract = c23.router({
4088
+ var publicArtifactVersionsContract = c22.router({
4068
4089
  list: {
4069
4090
  method: "GET",
4070
4091
  path: "/v1/artifacts/:id/versions",
4071
4092
  headers: authHeadersSchema,
4072
- pathParams: z27.object({
4073
- id: z27.string().min(1, "Artifact ID is required")
4093
+ pathParams: z26.object({
4094
+ id: z26.string().min(1, "Artifact ID is required")
4074
4095
  }),
4075
4096
  query: listQuerySchema,
4076
4097
  responses: {
@@ -4083,20 +4104,20 @@ var publicArtifactVersionsContract = c23.router({
4083
4104
  description: "List all versions of an artifact with pagination"
4084
4105
  }
4085
4106
  });
4086
- var publicArtifactDownloadContract = c23.router({
4107
+ var publicArtifactDownloadContract = c22.router({
4087
4108
  download: {
4088
4109
  method: "GET",
4089
4110
  path: "/v1/artifacts/:id/download",
4090
4111
  headers: authHeadersSchema,
4091
- pathParams: z27.object({
4092
- id: z27.string().min(1, "Artifact ID is required")
4112
+ pathParams: z26.object({
4113
+ id: z26.string().min(1, "Artifact ID is required")
4093
4114
  }),
4094
- query: z27.object({
4095
- versionId: z27.string().optional()
4115
+ query: z26.object({
4116
+ versionId: z26.string().optional()
4096
4117
  // Defaults to current version
4097
4118
  }),
4098
4119
  responses: {
4099
- 302: z27.undefined(),
4120
+ 302: z26.undefined(),
4100
4121
  // Redirect to presigned URL
4101
4122
  401: publicApiErrorSchema,
4102
4123
  404: publicApiErrorSchema,
@@ -4108,28 +4129,28 @@ var publicArtifactDownloadContract = c23.router({
4108
4129
  });
4109
4130
 
4110
4131
  // ../../packages/core/src/contracts/public/volumes.ts
4111
- import { z as z28 } from "zod";
4112
- var c24 = initContract();
4113
- var publicVolumeSchema = z28.object({
4114
- id: z28.string(),
4115
- name: z28.string(),
4116
- currentVersionId: z28.string().nullable(),
4117
- size: z28.number(),
4132
+ import { z as z27 } from "zod";
4133
+ var c23 = initContract();
4134
+ var publicVolumeSchema = z27.object({
4135
+ id: z27.string(),
4136
+ name: z27.string(),
4137
+ currentVersionId: z27.string().nullable(),
4138
+ size: z27.number(),
4118
4139
  // Total size in bytes
4119
- fileCount: z28.number(),
4140
+ fileCount: z27.number(),
4120
4141
  createdAt: timestampSchema,
4121
4142
  updatedAt: timestampSchema
4122
4143
  });
4123
- var volumeVersionSchema = z28.object({
4124
- id: z28.string(),
4144
+ var volumeVersionSchema = z27.object({
4145
+ id: z27.string(),
4125
4146
  // SHA-256 content hash
4126
- volumeId: z28.string(),
4127
- size: z28.number(),
4147
+ volumeId: z27.string(),
4148
+ size: z27.number(),
4128
4149
  // Size in bytes
4129
- fileCount: z28.number(),
4130
- message: z28.string().nullable(),
4150
+ fileCount: z27.number(),
4151
+ message: z27.string().nullable(),
4131
4152
  // Optional commit message
4132
- createdBy: z28.string(),
4153
+ createdBy: z27.string(),
4133
4154
  createdAt: timestampSchema
4134
4155
  });
4135
4156
  var publicVolumeDetailSchema = publicVolumeSchema.extend({
@@ -4137,7 +4158,7 @@ var publicVolumeDetailSchema = publicVolumeSchema.extend({
4137
4158
  });
4138
4159
  var paginatedVolumesSchema = createPaginatedResponseSchema(publicVolumeSchema);
4139
4160
  var paginatedVolumeVersionsSchema = createPaginatedResponseSchema(volumeVersionSchema);
4140
- var publicVolumesListContract = c24.router({
4161
+ var publicVolumesListContract = c23.router({
4141
4162
  list: {
4142
4163
  method: "GET",
4143
4164
  path: "/v1/volumes",
@@ -4152,13 +4173,13 @@ var publicVolumesListContract = c24.router({
4152
4173
  description: "List all volumes in the current scope with pagination"
4153
4174
  }
4154
4175
  });
4155
- var publicVolumeByIdContract = c24.router({
4176
+ var publicVolumeByIdContract = c23.router({
4156
4177
  get: {
4157
4178
  method: "GET",
4158
4179
  path: "/v1/volumes/:id",
4159
4180
  headers: authHeadersSchema,
4160
- pathParams: z28.object({
4161
- id: z28.string().min(1, "Volume ID is required")
4181
+ pathParams: z27.object({
4182
+ id: z27.string().min(1, "Volume ID is required")
4162
4183
  }),
4163
4184
  responses: {
4164
4185
  200: publicVolumeDetailSchema,
@@ -4170,13 +4191,13 @@ var publicVolumeByIdContract = c24.router({
4170
4191
  description: "Get volume details by ID"
4171
4192
  }
4172
4193
  });
4173
- var publicVolumeVersionsContract = c24.router({
4194
+ var publicVolumeVersionsContract = c23.router({
4174
4195
  list: {
4175
4196
  method: "GET",
4176
4197
  path: "/v1/volumes/:id/versions",
4177
4198
  headers: authHeadersSchema,
4178
- pathParams: z28.object({
4179
- id: z28.string().min(1, "Volume ID is required")
4199
+ pathParams: z27.object({
4200
+ id: z27.string().min(1, "Volume ID is required")
4180
4201
  }),
4181
4202
  query: listQuerySchema,
4182
4203
  responses: {
@@ -4189,20 +4210,20 @@ var publicVolumeVersionsContract = c24.router({
4189
4210
  description: "List all versions of a volume with pagination"
4190
4211
  }
4191
4212
  });
4192
- var publicVolumeDownloadContract = c24.router({
4213
+ var publicVolumeDownloadContract = c23.router({
4193
4214
  download: {
4194
4215
  method: "GET",
4195
4216
  path: "/v1/volumes/:id/download",
4196
4217
  headers: authHeadersSchema,
4197
- pathParams: z28.object({
4198
- id: z28.string().min(1, "Volume ID is required")
4218
+ pathParams: z27.object({
4219
+ id: z27.string().min(1, "Volume ID is required")
4199
4220
  }),
4200
- query: z28.object({
4201
- versionId: z28.string().optional()
4221
+ query: z27.object({
4222
+ versionId: z27.string().optional()
4202
4223
  // Defaults to current version
4203
4224
  }),
4204
4225
  responses: {
4205
- 302: z28.undefined(),
4226
+ 302: z27.undefined(),
4206
4227
  // Redirect to presigned URL
4207
4228
  401: publicApiErrorSchema,
4208
4229
  404: publicApiErrorSchema,
@@ -4358,64 +4379,6 @@ var FEATURE_SWITCHES = {
4358
4379
  }
4359
4380
  };
4360
4381
 
4361
- // src/lib/api/core/client-factory.ts
4362
- var ApiRequestError = class extends Error {
4363
- constructor(message, code, status) {
4364
- super(message);
4365
- this.code = code;
4366
- this.status = status;
4367
- this.name = "ApiRequestError";
4368
- }
4369
- };
4370
- async function getHeaders() {
4371
- const token = await getToken();
4372
- if (!token) {
4373
- throw new Error("Not authenticated. Run: vm0 auth login");
4374
- }
4375
- const headers = {
4376
- Authorization: `Bearer ${token}`
4377
- };
4378
- const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET;
4379
- if (bypassSecret) {
4380
- headers["x-vercel-protection-bypass"] = bypassSecret;
4381
- }
4382
- return headers;
4383
- }
4384
- async function getBaseUrl() {
4385
- const apiUrl = await getApiUrl();
4386
- if (!apiUrl) {
4387
- throw new Error("API URL not configured");
4388
- }
4389
- return apiUrl;
4390
- }
4391
- async function getClientConfig() {
4392
- const baseUrl = await getBaseUrl();
4393
- const baseHeaders = await getHeaders();
4394
- return { baseUrl, baseHeaders, jsonQuery: false };
4395
- }
4396
- function handleError(result, defaultMessage, options) {
4397
- if (!options?.useServerMessage) {
4398
- if (result.status === 401) {
4399
- throw new ApiRequestError(
4400
- "Not authenticated. Run: vm0 auth login",
4401
- "UNAUTHORIZED",
4402
- 401
4403
- );
4404
- }
4405
- if (result.status === 403) {
4406
- throw new ApiRequestError(
4407
- "An unexpected network issue occurred",
4408
- "FORBIDDEN",
4409
- 403
4410
- );
4411
- }
4412
- }
4413
- const errorBody = result.body;
4414
- const message = errorBody.error?.message || defaultMessage;
4415
- const code = errorBody.error?.code || "UNKNOWN";
4416
- throw new ApiRequestError(message, code, result.status);
4417
- }
4418
-
4419
4382
  // src/lib/api/core/http.ts
4420
4383
  async function getRawHeaders() {
4421
4384
  const token = await getToken();
@@ -4601,7 +4564,7 @@ async function getScope() {
4601
4564
  if (result.status === 200) {
4602
4565
  return result.body;
4603
4566
  }
4604
- handleError(result, "Failed to get scope", { useServerMessage: true });
4567
+ handleError(result, "Failed to get scope");
4605
4568
  }
4606
4569
  async function createScope(body) {
4607
4570
  const config = await getClientConfig();
@@ -4610,7 +4573,7 @@ async function createScope(body) {
4610
4573
  if (result.status === 201) {
4611
4574
  return result.body;
4612
4575
  }
4613
- handleError(result, "Failed to create scope", { useServerMessage: true });
4576
+ handleError(result, "Failed to create scope");
4614
4577
  }
4615
4578
  async function updateScope(body) {
4616
4579
  const config = await getClientConfig();
@@ -4619,7 +4582,7 @@ async function updateScope(body) {
4619
4582
  if (result.status === 200) {
4620
4583
  return result.body;
4621
4584
  }
4622
- handleError(result, "Failed to update scope", { useServerMessage: true });
4585
+ handleError(result, "Failed to update scope");
4623
4586
  }
4624
4587
 
4625
4588
  // src/lib/api/domains/storages.ts
@@ -4960,8 +4923,8 @@ async function getUsage(options) {
4960
4923
  }
4961
4924
 
4962
4925
  // src/lib/domain/yaml-validator.ts
4963
- import { z as z29 } from "zod";
4964
- var cliAgentNameSchema = z29.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
4926
+ import { z as z28 } from "zod";
4927
+ var cliAgentNameSchema = z28.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
4965
4928
  /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
4966
4929
  "Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
4967
4930
  );
@@ -4976,7 +4939,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
4976
4939
  const skillUrl = agent.skills[i];
4977
4940
  if (skillUrl && !validateGitHubTreeUrl(skillUrl)) {
4978
4941
  ctx.addIssue({
4979
- code: z29.ZodIssueCode.custom,
4942
+ code: z28.ZodIssueCode.custom,
4980
4943
  message: `Invalid skill URL: ${skillUrl}. Expected format: https://github.com/{owner}/{repo}/tree/{branch}/{path}`,
4981
4944
  path: ["skills", i]
4982
4945
  });
@@ -4985,15 +4948,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
4985
4948
  }
4986
4949
  }
4987
4950
  );
4988
- var cliComposeSchema = z29.object({
4989
- version: z29.string().min(1, "Missing config.version"),
4990
- agents: z29.record(cliAgentNameSchema, cliAgentDefinitionSchema),
4991
- volumes: z29.record(z29.string(), volumeConfigSchema).optional()
4951
+ var cliComposeSchema = z28.object({
4952
+ version: z28.string().min(1, "Missing config.version"),
4953
+ agents: z28.record(cliAgentNameSchema, cliAgentDefinitionSchema),
4954
+ volumes: z28.record(z28.string(), volumeConfigSchema).optional()
4992
4955
  }).superRefine((config, ctx) => {
4993
4956
  const agentKeys = Object.keys(config.agents);
4994
4957
  if (agentKeys.length === 0) {
4995
4958
  ctx.addIssue({
4996
- code: z29.ZodIssueCode.custom,
4959
+ code: z28.ZodIssueCode.custom,
4997
4960
  message: "agents must have at least one agent defined",
4998
4961
  path: ["agents"]
4999
4962
  });
@@ -5001,7 +4964,7 @@ var cliComposeSchema = z29.object({
5001
4964
  }
5002
4965
  if (agentKeys.length > 1) {
5003
4966
  ctx.addIssue({
5004
- code: z29.ZodIssueCode.custom,
4967
+ code: z28.ZodIssueCode.custom,
5005
4968
  message: "Multiple agents not supported yet. Only one agent allowed.",
5006
4969
  path: ["agents"]
5007
4970
  });
@@ -5013,7 +4976,7 @@ var cliComposeSchema = z29.object({
5013
4976
  if (agentVolumes && agentVolumes.length > 0) {
5014
4977
  if (!config.volumes) {
5015
4978
  ctx.addIssue({
5016
- code: z29.ZodIssueCode.custom,
4979
+ code: z28.ZodIssueCode.custom,
5017
4980
  message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
5018
4981
  path: ["volumes"]
5019
4982
  });
@@ -5023,7 +4986,7 @@ var cliComposeSchema = z29.object({
5023
4986
  const parts = volDeclaration.split(":");
5024
4987
  if (parts.length !== 2) {
5025
4988
  ctx.addIssue({
5026
- code: z29.ZodIssueCode.custom,
4989
+ code: z28.ZodIssueCode.custom,
5027
4990
  message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
5028
4991
  path: ["agents", agentName, "volumes"]
5029
4992
  });
@@ -5032,7 +4995,7 @@ var cliComposeSchema = z29.object({
5032
4995
  const volumeKey = parts[0].trim();
5033
4996
  if (!config.volumes[volumeKey]) {
5034
4997
  ctx.addIssue({
5035
- code: z29.ZodIssueCode.custom,
4998
+ code: z28.ZodIssueCode.custom,
5036
4999
  message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
5037
5000
  path: ["volumes", volumeKey]
5038
5001
  });
@@ -6136,7 +6099,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
6136
6099
  `Path to agent YAML file or GitHub tree URL (default: ${DEFAULT_CONFIG_FILE})`
6137
6100
  ).option("-y, --yes", "Skip confirmation prompts for skill requirements").option(
6138
6101
  "--experimental-shared-compose",
6139
- "Enable GitHub URL compose (experimental)"
6102
+ "[deprecated] No longer required, kept for backward compatibility"
6140
6103
  ).option("--json", "Output JSON for scripts (suppresses interactive output)").option(
6141
6104
  "--porcelain",
6142
6105
  "[deprecated: use --json] Output JSON for scripts",
@@ -6155,36 +6118,11 @@ var composeCommand = new Command7().name("compose").description("Create or updat
6155
6118
  options.autoUpdate = false;
6156
6119
  }
6157
6120
  if (options.autoUpdate !== false) {
6158
- await startSilentUpgrade("9.29.5");
6121
+ await startSilentUpgrade("9.30.1");
6159
6122
  }
6160
6123
  try {
6161
6124
  let result;
6162
6125
  if (isGitHubUrl(resolvedConfigFile)) {
6163
- if (!options.experimentalSharedCompose) {
6164
- if (options.json) {
6165
- console.log(
6166
- JSON.stringify({
6167
- error: "Composing shared agents requires --experimental-shared-compose flag"
6168
- })
6169
- );
6170
- } else {
6171
- console.error(
6172
- chalk8.red(
6173
- "\u2717 Composing shared agents requires --experimental-shared-compose flag"
6174
- )
6175
- );
6176
- console.error();
6177
- console.error(
6178
- chalk8.dim(
6179
- " Composing agents from other users carries security risks."
6180
- )
6181
- );
6182
- console.error(
6183
- chalk8.dim(" Only compose agents from users you trust.")
6184
- );
6185
- }
6186
- process.exit(1);
6187
- }
6188
6126
  result = await handleGitHubCompose(resolvedConfigFile, options);
6189
6127
  } else {
6190
6128
  const { config, agentName, agent, basePath } = await loadAndValidateConfig(resolvedConfigFile, options.json);
@@ -6966,9 +6904,9 @@ var CodexEventParser = class {
6966
6904
  }
6967
6905
  }
6968
6906
  if (itemType === "file_change" && item.changes && item.changes.length > 0) {
6969
- const changes = item.changes.map((c25) => {
6970
- const action = c25.kind === "add" ? "Created" : c25.kind === "modify" ? "Modified" : "Deleted";
6971
- return `${action}: ${c25.path}`;
6907
+ const changes = item.changes.map((c24) => {
6908
+ const action = c24.kind === "add" ? "Created" : c24.kind === "modify" ? "Modified" : "Deleted";
6909
+ return `${action}: ${c24.path}`;
6972
6910
  }).join("\n");
6973
6911
  return {
6974
6912
  type: "text",
@@ -7122,9 +7060,9 @@ var CodexEventRenderer = class {
7122
7060
  return;
7123
7061
  }
7124
7062
  if (itemType === "file_change" && item.changes && item.changes.length > 0) {
7125
- const summary = item.changes.map((c25) => {
7126
- const icon = c25.kind === "add" ? "+" : c25.kind === "delete" ? "-" : "~";
7127
- return `${icon}${c25.path}`;
7063
+ const summary = item.changes.map((c24) => {
7064
+ const icon = c24.kind === "add" ? "+" : c24.kind === "delete" ? "-" : "~";
7065
+ return `${icon}${c24.path}`;
7128
7066
  }).join(", ");
7129
7067
  console.log(chalk11.green("[files]") + ` ${summary}`);
7130
7068
  return;
@@ -8377,7 +8315,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
8377
8315
  async (identifier, prompt, options) => {
8378
8316
  try {
8379
8317
  if (options.autoUpdate !== false) {
8380
- await startSilentUpgrade("9.29.5");
8318
+ await startSilentUpgrade("9.30.1");
8381
8319
  }
8382
8320
  const { scope, name, version } = parseIdentifier(identifier);
8383
8321
  if (scope && !options.experimentalSharedAgent) {
@@ -8785,8 +8723,8 @@ function displayEmptyState(hasFilters) {
8785
8723
  var listCommand = new Command11().name("list").alias("ls").description("List runs").option(
8786
8724
  "--status <status,...>",
8787
8725
  `Filter by status: ${VALID_STATUSES} (default: pending,running)`
8788
- ).option("--all", "Show all statuses (mutually exclusive with --status)").option("--agent <name>", "Filter by agent name").option("--since <date>", "Start time (ISO format or relative: 1h, 7d, 30d)").option("--until <date>", "End time (defaults to now)").option("--limit <n>", "Maximum number of results (default: 50, max: 100)").action(async (options) => {
8789
- try {
8726
+ ).option("--all", "Show all statuses (mutually exclusive with --status)").option("--agent <name>", "Filter by agent name").option("--since <date>", "Start time (ISO format or relative: 1h, 7d, 30d)").option("--until <date>", "End time (defaults to now)").option("--limit <n>", "Maximum number of results (default: 50, max: 100)").action(
8727
+ withErrorHandler(async (options) => {
8790
8728
  if (options.all && options.status) {
8791
8729
  console.error(
8792
8730
  chalk16.red("Error: --all and --status are mutually exclusive")
@@ -8815,18 +8753,8 @@ var listCommand = new Command11().name("list").alias("ls").description("List run
8815
8753
  return;
8816
8754
  }
8817
8755
  displayRuns(runs);
8818
- } catch (error) {
8819
- console.error(chalk16.red("\u2717 Failed to list runs"));
8820
- if (error instanceof Error) {
8821
- if (error.message.includes("Not authenticated")) {
8822
- console.error(chalk16.dim(" Run: vm0 auth login"));
8823
- } else {
8824
- console.error(chalk16.dim(` ${error.message}`));
8825
- }
8826
- }
8827
- process.exit(1);
8828
- }
8829
- });
8756
+ })
8757
+ );
8830
8758
 
8831
8759
  // src/commands/run/kill.ts
8832
8760
  import { Command as Command12 } from "commander";
@@ -8915,8 +8843,8 @@ async function writeStorageConfig(storageName, basePath = process.cwd(), type2 =
8915
8843
  }
8916
8844
 
8917
8845
  // src/commands/volume/init.ts
8918
- var initCommand = new Command13().name("init").description("Initialize a volume in the current directory").option("-n, --name <name>", "Volume name (required in non-interactive mode)").action(async (options) => {
8919
- try {
8846
+ var initCommand = new Command13().name("init").description("Initialize a volume in the current directory").option("-n, --name <name>", "Volume name (required in non-interactive mode)").action(
8847
+ withErrorHandler(async (options) => {
8920
8848
  const cwd = process.cwd();
8921
8849
  const dirName = path6.basename(cwd);
8922
8850
  const existingConfig = await readStorageConfig(cwd);
@@ -8977,14 +8905,8 @@ var initCommand = new Command13().name("init").description("Initialize a volume
8977
8905
  ` Config saved to ${path6.join(cwd, ".vm0", "storage.yaml")}`
8978
8906
  )
8979
8907
  );
8980
- } catch (error) {
8981
- console.error(chalk18.red("\u2717 Failed to initialize volume"));
8982
- if (error instanceof Error) {
8983
- console.error(chalk18.dim(` ${error.message}`));
8984
- }
8985
- process.exit(1);
8986
- }
8987
- });
8908
+ })
8909
+ );
8988
8910
 
8989
8911
  // src/commands/volume/push.ts
8990
8912
  import { Command as Command14 } from "commander";
@@ -8992,8 +8914,8 @@ import chalk19 from "chalk";
8992
8914
  var pushCommand = new Command14().name("push").description("Push local files to cloud volume").option(
8993
8915
  "-f, --force",
8994
8916
  "Force upload even if content unchanged (recreate archive)"
8995
- ).action(async (options) => {
8996
- try {
8917
+ ).action(
8918
+ withErrorHandler(async (options) => {
8997
8919
  const cwd = process.cwd();
8998
8920
  const config = await readStorageConfig(cwd);
8999
8921
  if (!config) {
@@ -9019,18 +8941,8 @@ var pushCommand = new Command14().name("push").description("Push local files to
9019
8941
  console.log(chalk19.dim(` Version: ${shortVersion}`));
9020
8942
  console.log(chalk19.dim(` Files: ${result.fileCount.toLocaleString()}`));
9021
8943
  console.log(chalk19.dim(` Size: ${formatBytes(result.size)}`));
9022
- } catch (error) {
9023
- console.error(chalk19.red("\u2717 Push failed"));
9024
- if (error instanceof Error) {
9025
- if (error.message.includes("Not authenticated")) {
9026
- console.error(chalk19.dim(" Run: vm0 auth login"));
9027
- } else {
9028
- console.error(chalk19.dim(` ${error.message}`));
9029
- }
9030
- }
9031
- process.exit(1);
9032
- }
9033
- });
8944
+ })
8945
+ );
9034
8946
 
9035
8947
  // src/commands/volume/pull.ts
9036
8948
  import { Command as Command15 } from "commander";
@@ -9053,8 +8965,8 @@ async function handleEmptyStorageResponse(cwd) {
9053
8965
  }
9054
8966
 
9055
8967
  // src/commands/volume/pull.ts
9056
- var pullCommand = new Command15().name("pull").description("Pull cloud files to local directory").argument("[versionId]", "Version ID to pull (default: latest)").action(async (versionId) => {
9057
- try {
8968
+ var pullCommand = new Command15().name("pull").description("Pull cloud files to local directory").argument("[versionId]", "Version ID to pull (default: latest)").action(
8969
+ withErrorHandler(async (versionId) => {
9058
8970
  const cwd = process.cwd();
9059
8971
  const config = await readStorageConfig(cwd);
9060
8972
  if (!config) {
@@ -9112,18 +9024,8 @@ var pullCommand = new Command15().name("pull").description("Pull cloud files to
9112
9024
  await fs6.promises.unlink(tarPath);
9113
9025
  await fs6.promises.rmdir(tmpDir);
9114
9026
  console.log(chalk21.green(`\u2713 Extracted ${remoteFiles.length} files`));
9115
- } catch (error) {
9116
- console.error(chalk21.red("\u2717 Pull failed"));
9117
- if (error instanceof Error) {
9118
- if (error.message.includes("Not authenticated")) {
9119
- console.error(chalk21.dim(" Run: vm0 auth login"));
9120
- } else {
9121
- console.error(chalk21.dim(` ${error.message}`));
9122
- }
9123
- }
9124
- process.exit(1);
9125
- }
9126
- });
9027
+ })
9028
+ );
9127
9029
 
9128
9030
  // src/commands/volume/status.ts
9129
9031
  import { Command as Command16 } from "commander";
@@ -9182,8 +9084,8 @@ var statusCommand2 = new Command16().name("status").description("Show status of
9182
9084
  // src/commands/volume/list.ts
9183
9085
  import { Command as Command17 } from "commander";
9184
9086
  import chalk23 from "chalk";
9185
- var listCommand2 = new Command17().name("list").alias("ls").description("List all remote volumes").action(async () => {
9186
- try {
9087
+ var listCommand2 = new Command17().name("list").alias("ls").description("List all remote volumes").action(
9088
+ withErrorHandler(async () => {
9187
9089
  const items = await listStorages({ type: "volume" });
9188
9090
  if (items.length === 0) {
9189
9091
  console.log(chalk23.dim("No volumes found"));
@@ -9217,18 +9119,8 @@ var listCommand2 = new Command17().name("list").alias("ls").description("List al
9217
9119
  ].join(" ");
9218
9120
  console.log(row);
9219
9121
  }
9220
- } catch (error) {
9221
- console.error(chalk23.red("\u2717 Failed to list volumes"));
9222
- if (error instanceof Error) {
9223
- if (error.message.includes("Not authenticated")) {
9224
- console.error(chalk23.dim(" Run: vm0 auth login"));
9225
- } else {
9226
- console.error(chalk23.dim(` ${error.message}`));
9227
- }
9228
- }
9229
- process.exit(1);
9230
- }
9231
- });
9122
+ })
9123
+ );
9232
9124
 
9233
9125
  // src/commands/volume/clone.ts
9234
9126
  import { Command as Command18 } from "commander";
@@ -9302,8 +9194,8 @@ async function cloneStorage(name, type2, destination, options = {}) {
9302
9194
  }
9303
9195
 
9304
9196
  // src/commands/volume/clone.ts
9305
- var cloneCommand = new Command18().name("clone").description("Clone a remote volume to local directory (latest version)").argument("<name>", "Volume name to clone").argument("[destination]", "Destination directory (default: volume name)").action(async (name, destination) => {
9306
- try {
9197
+ var cloneCommand = new Command18().name("clone").description("Clone a remote volume to local directory (latest version)").argument("<name>", "Volume name to clone").argument("[destination]", "Destination directory (default: volume name)").action(
9198
+ withErrorHandler(async (name, destination) => {
9307
9199
  const targetDir = destination || name;
9308
9200
  console.log(`Cloning volume: ${name}`);
9309
9201
  const result = await cloneStorage(name, "volume", targetDir);
@@ -9311,18 +9203,8 @@ var cloneCommand = new Command18().name("clone").description("Clone a remote vol
9311
9203
  \u2713 Successfully cloned volume: ${name}`));
9312
9204
  console.log(chalk25.dim(` Location: ${targetDir}/`));
9313
9205
  console.log(chalk25.dim(` Version: ${result.versionId.slice(0, 8)}`));
9314
- } catch (error) {
9315
- console.error(chalk25.red("\u2717 Clone failed"));
9316
- if (error instanceof Error) {
9317
- if (error.message.includes("Not authenticated")) {
9318
- console.error(chalk25.dim(" Run: vm0 auth login"));
9319
- } else {
9320
- console.error(chalk25.dim(` ${error.message}`));
9321
- }
9322
- }
9323
- process.exit(1);
9324
- }
9325
- });
9206
+ })
9207
+ );
9326
9208
 
9327
9209
  // src/commands/volume/index.ts
9328
9210
  var volumeCommand = new Command19().name("volume").description("Manage volumes (defined in compose, not versioned after run)").addCommand(initCommand).addCommand(pushCommand).addCommand(pullCommand).addCommand(statusCommand2).addCommand(listCommand2).addCommand(cloneCommand);
@@ -9337,8 +9219,8 @@ import path9 from "path";
9337
9219
  var initCommand2 = new Command20().name("init").description("Initialize an artifact in the current directory").option(
9338
9220
  "-n, --name <name>",
9339
9221
  "Artifact name (required in non-interactive mode)"
9340
- ).action(async (options) => {
9341
- try {
9222
+ ).action(
9223
+ withErrorHandler(async (options) => {
9342
9224
  const cwd = process.cwd();
9343
9225
  const dirName = path9.basename(cwd);
9344
9226
  const existingConfig = await readStorageConfig(cwd);
@@ -9414,14 +9296,8 @@ var initCommand2 = new Command20().name("init").description("Initialize an artif
9414
9296
  ` Config saved to ${path9.join(cwd, ".vm0", "storage.yaml")}`
9415
9297
  )
9416
9298
  );
9417
- } catch (error) {
9418
- console.error(chalk26.red("\u2717 Failed to initialize artifact"));
9419
- if (error instanceof Error) {
9420
- console.error(chalk26.dim(` ${error.message}`));
9421
- }
9422
- process.exit(1);
9423
- }
9424
- });
9299
+ })
9300
+ );
9425
9301
 
9426
9302
  // src/commands/artifact/push.ts
9427
9303
  import { Command as Command21 } from "commander";
@@ -9429,8 +9305,8 @@ import chalk27 from "chalk";
9429
9305
  var pushCommand2 = new Command21().name("push").description("Push local files to cloud artifact").option(
9430
9306
  "-f, --force",
9431
9307
  "Force upload even if content unchanged (recreate archive)"
9432
- ).action(async (options) => {
9433
- try {
9308
+ ).action(
9309
+ withErrorHandler(async (options) => {
9434
9310
  const cwd = process.cwd();
9435
9311
  const config = await readStorageConfig(cwd);
9436
9312
  if (!config) {
@@ -9465,14 +9341,8 @@ var pushCommand2 = new Command21().name("push").description("Push local files to
9465
9341
  console.log(chalk27.dim(` Version: ${shortVersion}`));
9466
9342
  console.log(chalk27.dim(` Files: ${result.fileCount.toLocaleString()}`));
9467
9343
  console.log(chalk27.dim(` Size: ${formatBytes(result.size)}`));
9468
- } catch (error) {
9469
- console.error(chalk27.red("\u2717 Push failed"));
9470
- if (error instanceof Error) {
9471
- console.error(chalk27.dim(` ${error.message}`));
9472
- }
9473
- process.exit(1);
9474
- }
9475
- });
9344
+ })
9345
+ );
9476
9346
 
9477
9347
  // src/commands/artifact/pull.ts
9478
9348
  import { Command as Command22 } from "commander";
@@ -9481,8 +9351,8 @@ import path10 from "path";
9481
9351
  import * as fs8 from "fs";
9482
9352
  import * as os7 from "os";
9483
9353
  import * as tar5 from "tar";
9484
- var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact to local directory").argument("[versionId]", "Version ID to pull (default: latest)").action(async (versionId) => {
9485
- try {
9354
+ var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact to local directory").argument("[versionId]", "Version ID to pull (default: latest)").action(
9355
+ withErrorHandler(async (versionId) => {
9486
9356
  const cwd = process.cwd();
9487
9357
  const config = await readStorageConfig(cwd);
9488
9358
  if (!config) {
@@ -9549,14 +9419,8 @@ var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact
9549
9419
  await fs8.promises.unlink(tarPath);
9550
9420
  await fs8.promises.rmdir(tmpDir);
9551
9421
  console.log(chalk28.green(`\u2713 Extracted ${remoteFiles.length} files`));
9552
- } catch (error) {
9553
- console.error(chalk28.red("\u2717 Pull failed"));
9554
- if (error instanceof Error) {
9555
- console.error(chalk28.dim(` ${error.message}`));
9556
- }
9557
- process.exit(1);
9558
- }
9559
- });
9422
+ })
9423
+ );
9560
9424
 
9561
9425
  // src/commands/artifact/status.ts
9562
9426
  import { Command as Command23 } from "commander";
@@ -9611,8 +9475,8 @@ var statusCommand3 = new Command23().name("status").description("Show status of
9611
9475
  // src/commands/artifact/list.ts
9612
9476
  import { Command as Command24 } from "commander";
9613
9477
  import chalk30 from "chalk";
9614
- var listCommand3 = new Command24().name("list").alias("ls").description("List all remote artifacts").action(async () => {
9615
- try {
9478
+ var listCommand3 = new Command24().name("list").alias("ls").description("List all remote artifacts").action(
9479
+ withErrorHandler(async () => {
9616
9480
  const items = await listStorages({ type: "artifact" });
9617
9481
  if (items.length === 0) {
9618
9482
  console.log(chalk30.dim("No artifacts found"));
@@ -9648,24 +9512,14 @@ var listCommand3 = new Command24().name("list").alias("ls").description("List al
9648
9512
  ].join(" ");
9649
9513
  console.log(row);
9650
9514
  }
9651
- } catch (error) {
9652
- console.error(chalk30.red("\u2717 Failed to list artifacts"));
9653
- if (error instanceof Error) {
9654
- if (error.message.includes("Not authenticated")) {
9655
- console.error(chalk30.dim(" Run: vm0 auth login"));
9656
- } else {
9657
- console.error(chalk30.dim(` ${error.message}`));
9658
- }
9659
- }
9660
- process.exit(1);
9661
- }
9662
- });
9515
+ })
9516
+ );
9663
9517
 
9664
9518
  // src/commands/artifact/clone.ts
9665
9519
  import { Command as Command25 } from "commander";
9666
9520
  import chalk31 from "chalk";
9667
- var cloneCommand2 = new Command25().name("clone").description("Clone a remote artifact to local directory (latest version)").argument("<name>", "Artifact name to clone").argument("[destination]", "Destination directory (default: artifact name)").action(async (name, destination) => {
9668
- try {
9521
+ var cloneCommand2 = new Command25().name("clone").description("Clone a remote artifact to local directory (latest version)").argument("<name>", "Artifact name to clone").argument("[destination]", "Destination directory (default: artifact name)").action(
9522
+ withErrorHandler(async (name, destination) => {
9669
9523
  const targetDir = destination || name;
9670
9524
  console.log(`Cloning artifact: ${name}`);
9671
9525
  const result = await cloneStorage(name, "artifact", targetDir);
@@ -9673,18 +9527,8 @@ var cloneCommand2 = new Command25().name("clone").description("Clone a remote ar
9673
9527
  \u2713 Successfully cloned artifact: ${name}`));
9674
9528
  console.log(chalk31.dim(` Location: ${targetDir}/`));
9675
9529
  console.log(chalk31.dim(` Version: ${result.versionId.slice(0, 8)}`));
9676
- } catch (error) {
9677
- console.error(chalk31.red("\u2717 Clone failed"));
9678
- if (error instanceof Error) {
9679
- if (error.message.includes("Not authenticated")) {
9680
- console.error(chalk31.dim(" Run: vm0 auth login"));
9681
- } else {
9682
- console.error(chalk31.dim(` ${error.message}`));
9683
- }
9684
- }
9685
- process.exit(1);
9686
- }
9687
- });
9530
+ })
9531
+ );
9688
9532
 
9689
9533
  // src/commands/artifact/index.ts
9690
9534
  var artifactCommand = new Command26().name("artifact").description("Manage artifacts (specified at run, versioned after run)").addCommand(initCommand2).addCommand(pushCommand2).addCommand(pullCommand2).addCommand(statusCommand3).addCommand(listCommand3).addCommand(cloneCommand2);
@@ -10044,7 +9888,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
10044
9888
  ).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(
10045
9889
  async (prompt, options) => {
10046
9890
  if (options.autoUpdate !== false) {
10047
- const shouldExit = await checkAndUpgrade("9.29.5", prompt);
9891
+ const shouldExit = await checkAndUpgrade("9.30.1", prompt);
10048
9892
  if (shouldExit) {
10049
9893
  process.exit(0);
10050
9894
  }
@@ -10735,8 +10579,8 @@ var cloneCommand3 = new Command35().name("clone").description("Clone agent compo
10735
10579
  // src/commands/agent/list.ts
10736
10580
  import { Command as Command36 } from "commander";
10737
10581
  import chalk41 from "chalk";
10738
- var listCommand4 = new Command36().name("list").alias("ls").description("List all agent composes").action(async () => {
10739
- try {
10582
+ var listCommand4 = new Command36().name("list").alias("ls").description("List all agent composes").action(
10583
+ withErrorHandler(async () => {
10740
10584
  const response = await httpGet("/api/agent/composes/list");
10741
10585
  if (!response.ok) {
10742
10586
  const error = await response.json();
@@ -10750,7 +10594,7 @@ var listCommand4 = new Command36().name("list").alias("ls").description("List al
10750
10594
  );
10751
10595
  return;
10752
10596
  }
10753
- const nameWidth = Math.max(4, ...data.composes.map((c25) => c25.name.length));
10597
+ const nameWidth = Math.max(4, ...data.composes.map((c24) => c24.name.length));
10754
10598
  const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
10755
10599
  " "
10756
10600
  );
@@ -10764,18 +10608,8 @@ var listCommand4 = new Command36().name("list").alias("ls").description("List al
10764
10608
  ].join(" ");
10765
10609
  console.log(row);
10766
10610
  }
10767
- } catch (error) {
10768
- console.error(chalk41.red("\u2717 Failed to list agent composes"));
10769
- if (error instanceof Error) {
10770
- if (error.message.includes("Not authenticated")) {
10771
- console.error(chalk41.dim(" Run: vm0 auth login"));
10772
- } else {
10773
- console.error(chalk41.dim(` ${error.message}`));
10774
- }
10775
- }
10776
- process.exit(1);
10777
- }
10778
- });
10611
+ })
10612
+ );
10779
10613
 
10780
10614
  // src/commands/agent/status.ts
10781
10615
  import { Command as Command37 } from "commander";
@@ -11033,204 +10867,300 @@ var statusCommand5 = new Command37().name("status").description("Show status of
11033
10867
  // src/commands/agent/public.ts
11034
10868
  import { Command as Command38 } from "commander";
11035
10869
  import chalk43 from "chalk";
11036
- var publicCommand = new Command38().name("experimental-public").description("Make an agent public (accessible to all authenticated users)").argument("<name>", "Agent name").action(async (name) => {
11037
- try {
11038
- const compose = await getComposeByName(name);
11039
- if (!compose) {
11040
- console.error(chalk43.red(`\u2717 Agent not found: ${name}`));
11041
- process.exit(1);
11042
- }
11043
- const scope = await getScope();
11044
- const response = await httpPost(
11045
- `/api/agent/composes/${compose.id}/permissions`,
11046
- { granteeType: "public" }
11047
- );
11048
- if (!response.ok) {
11049
- const error = await response.json();
11050
- if (response.status === 409) {
11051
- console.log(chalk43.yellow(`Agent "${name}" is already public`));
11052
- return;
10870
+ var publicCommand = new Command38().name("public").description("Make an agent public (accessible to all authenticated users)").argument("<name>", "Agent name").option(
10871
+ "--experimental-shared-agent",
10872
+ "Enable experimental agent sharing feature"
10873
+ ).action(
10874
+ withErrorHandler(
10875
+ async (name, options) => {
10876
+ if (!options.experimentalSharedAgent) {
10877
+ console.error(
10878
+ chalk43.red(
10879
+ "\u2717 This command requires --experimental-shared-agent flag"
10880
+ )
10881
+ );
10882
+ console.error();
10883
+ console.error(
10884
+ chalk43.dim(" Agent sharing is an experimental feature.")
10885
+ );
10886
+ console.error();
10887
+ console.error("Example:");
10888
+ console.error(
10889
+ chalk43.cyan(
10890
+ ` vm0 agent public ${name} --experimental-shared-agent`
10891
+ )
10892
+ );
10893
+ process.exit(1);
11053
10894
  }
11054
- throw new Error(error.error?.message || "Failed to make agent public");
11055
- }
11056
- const fullName = `${scope.slug}/${name}`;
11057
- console.log(chalk43.green(`\u2713 Agent "${name}" is now public`));
11058
- console.log();
11059
- console.log("Others can now run your agent with:");
11060
- console.log(
11061
- chalk43.cyan(
11062
- ` vm0 run ${fullName} --experimental-shared-agent "your prompt"`
11063
- )
11064
- );
11065
- } catch (error) {
11066
- console.error(chalk43.red("\u2717 Failed to make agent public"));
11067
- if (error instanceof Error) {
11068
- console.error(chalk43.dim(` ${error.message}`));
10895
+ const compose = await getComposeByName(name);
10896
+ if (!compose) {
10897
+ console.error(chalk43.red(`\u2717 Agent not found: ${name}`));
10898
+ process.exit(1);
10899
+ }
10900
+ const scope = await getScope();
10901
+ const response = await httpPost(
10902
+ `/api/agent/composes/${compose.id}/permissions`,
10903
+ { granteeType: "public" }
10904
+ );
10905
+ if (!response.ok) {
10906
+ const error = await response.json();
10907
+ if (response.status === 409) {
10908
+ console.log(chalk43.yellow(`Agent "${name}" is already public`));
10909
+ return;
10910
+ }
10911
+ throw new Error(
10912
+ error.error?.message || "Failed to make agent public"
10913
+ );
10914
+ }
10915
+ const fullName = `${scope.slug}/${name}`;
10916
+ console.log(chalk43.green(`\u2713 Agent "${name}" is now public`));
10917
+ console.log();
10918
+ console.log("Others can now run your agent with:");
10919
+ console.log(
10920
+ chalk43.cyan(
10921
+ ` vm0 run ${fullName} --experimental-shared-agent "your prompt"`
10922
+ )
10923
+ );
11069
10924
  }
11070
- process.exit(1);
11071
- }
11072
- });
10925
+ )
10926
+ );
11073
10927
 
11074
10928
  // src/commands/agent/private.ts
11075
10929
  import { Command as Command39 } from "commander";
11076
10930
  import chalk44 from "chalk";
11077
- var privateCommand = new Command39().name("experimental-private").description("Make an agent private (remove public access)").argument("<name>", "Agent name").action(async (name) => {
11078
- try {
11079
- const compose = await getComposeByName(name);
11080
- if (!compose) {
11081
- console.error(chalk44.red(`\u2717 Agent not found: ${name}`));
11082
- process.exit(1);
11083
- }
11084
- const response = await httpDelete(
11085
- `/api/agent/composes/${compose.id}/permissions?type=public`
11086
- );
11087
- if (!response.ok) {
11088
- const error = await response.json();
11089
- if (response.status === 404) {
11090
- console.log(chalk44.yellow(`Agent "${name}" is already private`));
11091
- return;
10931
+ var privateCommand = new Command39().name("private").description("Make an agent private (remove public access)").argument("<name>", "Agent name").option(
10932
+ "--experimental-shared-agent",
10933
+ "Enable experimental agent sharing feature"
10934
+ ).action(
10935
+ withErrorHandler(
10936
+ async (name, options) => {
10937
+ if (!options.experimentalSharedAgent) {
10938
+ console.error(
10939
+ chalk44.red(
10940
+ "\u2717 This command requires --experimental-shared-agent flag"
10941
+ )
10942
+ );
10943
+ console.error();
10944
+ console.error(
10945
+ chalk44.dim(" Agent sharing is an experimental feature.")
10946
+ );
10947
+ console.error();
10948
+ console.error("Example:");
10949
+ console.error(
10950
+ chalk44.cyan(
10951
+ ` vm0 agent private ${name} --experimental-shared-agent`
10952
+ )
10953
+ );
10954
+ process.exit(1);
11092
10955
  }
11093
- throw new Error(error.error?.message || "Failed to make agent private");
11094
- }
11095
- console.log(chalk44.green(`\u2713 Agent "${name}" is now private`));
11096
- } catch (error) {
11097
- console.error(chalk44.red("\u2717 Failed to make agent private"));
11098
- if (error instanceof Error) {
11099
- console.error(chalk44.dim(` ${error.message}`));
10956
+ const compose = await getComposeByName(name);
10957
+ if (!compose) {
10958
+ console.error(chalk44.red(`\u2717 Agent not found: ${name}`));
10959
+ process.exit(1);
10960
+ }
10961
+ const response = await httpDelete(
10962
+ `/api/agent/composes/${compose.id}/permissions?type=public`
10963
+ );
10964
+ if (!response.ok) {
10965
+ const error = await response.json();
10966
+ if (response.status === 404) {
10967
+ console.log(chalk44.yellow(`Agent "${name}" is already private`));
10968
+ return;
10969
+ }
10970
+ throw new Error(
10971
+ error.error?.message || "Failed to make agent private"
10972
+ );
10973
+ }
10974
+ console.log(chalk44.green(`\u2713 Agent "${name}" is now private`));
11100
10975
  }
11101
- process.exit(1);
11102
- }
11103
- });
10976
+ )
10977
+ );
11104
10978
 
11105
10979
  // src/commands/agent/share.ts
11106
10980
  import { Command as Command40 } from "commander";
11107
10981
  import chalk45 from "chalk";
11108
- var shareCommand = new Command40().name("experimental-share").description("Share an agent with a user by email").argument("<name>", "Agent name").requiredOption("--email <email>", "Email address to share with").action(async (name, options) => {
11109
- try {
11110
- const compose = await getComposeByName(name);
11111
- if (!compose) {
11112
- console.error(chalk45.red(`\u2717 Agent not found: ${name}`));
11113
- process.exit(1);
11114
- }
11115
- const scope = await getScope();
11116
- const response = await httpPost(
11117
- `/api/agent/composes/${compose.id}/permissions`,
11118
- { granteeType: "email", granteeEmail: options.email }
11119
- );
11120
- if (!response.ok) {
11121
- const error = await response.json();
11122
- if (response.status === 409) {
11123
- console.log(
11124
- chalk45.yellow(
11125
- `Agent "${name}" is already shared with ${options.email}`
10982
+ var shareCommand = new Command40().name("share").description("Share an agent with a user by email").argument("<name>", "Agent name").requiredOption("--email <email>", "Email address to share with").option(
10983
+ "--experimental-shared-agent",
10984
+ "Enable experimental agent sharing feature"
10985
+ ).action(
10986
+ withErrorHandler(
10987
+ async (name, options) => {
10988
+ if (!options.experimentalSharedAgent) {
10989
+ console.error(
10990
+ chalk45.red(
10991
+ "\u2717 This command requires --experimental-shared-agent flag"
11126
10992
  )
11127
10993
  );
11128
- return;
10994
+ console.error();
10995
+ console.error(
10996
+ chalk45.dim(" Agent sharing is an experimental feature.")
10997
+ );
10998
+ console.error();
10999
+ console.error("Example:");
11000
+ console.error(
11001
+ chalk45.cyan(
11002
+ ` vm0 agent share ${name} --email ${options.email} --experimental-shared-agent`
11003
+ )
11004
+ );
11005
+ process.exit(1);
11129
11006
  }
11130
- throw new Error(error.error?.message || "Failed to share agent");
11131
- }
11132
- const fullName = `${scope.slug}/${name}`;
11133
- console.log(
11134
- chalk45.green(`\u2713 Agent "${name}" shared with ${options.email}`)
11135
- );
11136
- console.log();
11137
- console.log("They can now run your agent with:");
11138
- console.log(
11139
- chalk45.cyan(
11140
- ` vm0 run ${fullName} --experimental-shared-agent "your prompt"`
11141
- )
11142
- );
11143
- } catch (error) {
11144
- console.error(chalk45.red("\u2717 Failed to share agent"));
11145
- if (error instanceof Error) {
11146
- console.error(chalk45.dim(` ${error.message}`));
11007
+ const compose = await getComposeByName(name);
11008
+ if (!compose) {
11009
+ console.error(chalk45.red(`\u2717 Agent not found: ${name}`));
11010
+ process.exit(1);
11011
+ }
11012
+ const scope = await getScope();
11013
+ const response = await httpPost(
11014
+ `/api/agent/composes/${compose.id}/permissions`,
11015
+ { granteeType: "email", granteeEmail: options.email }
11016
+ );
11017
+ if (!response.ok) {
11018
+ const error = await response.json();
11019
+ if (response.status === 409) {
11020
+ console.log(
11021
+ chalk45.yellow(
11022
+ `Agent "${name}" is already shared with ${options.email}`
11023
+ )
11024
+ );
11025
+ return;
11026
+ }
11027
+ throw new Error(error.error?.message || "Failed to share agent");
11028
+ }
11029
+ const fullName = `${scope.slug}/${name}`;
11030
+ console.log(
11031
+ chalk45.green(`\u2713 Agent "${name}" shared with ${options.email}`)
11032
+ );
11033
+ console.log();
11034
+ console.log("They can now run your agent with:");
11035
+ console.log(
11036
+ chalk45.cyan(
11037
+ ` vm0 run ${fullName} --experimental-shared-agent "your prompt"`
11038
+ )
11039
+ );
11147
11040
  }
11148
- process.exit(1);
11149
- }
11150
- });
11041
+ )
11042
+ );
11151
11043
 
11152
11044
  // src/commands/agent/unshare.ts
11153
11045
  import { Command as Command41 } from "commander";
11154
11046
  import chalk46 from "chalk";
11155
- var unshareCommand = new Command41().name("experimental-unshare").description("Remove sharing from a user").argument("<name>", "Agent name").requiredOption("--email <email>", "Email address to unshare").action(async (name, options) => {
11156
- try {
11157
- const compose = await getComposeByName(name);
11158
- if (!compose) {
11159
- console.error(chalk46.red(`\u2717 Agent not found: ${name}`));
11160
- process.exit(1);
11161
- }
11162
- const response = await httpDelete(
11163
- `/api/agent/composes/${compose.id}/permissions?type=email&email=${encodeURIComponent(options.email)}`
11164
- );
11165
- if (!response.ok) {
11166
- const error = await response.json();
11167
- if (response.status === 404) {
11168
- console.log(
11169
- chalk46.yellow(`Agent "${name}" is not shared with ${options.email}`)
11047
+ var unshareCommand = new Command41().name("unshare").description("Remove sharing from a user").argument("<name>", "Agent name").requiredOption("--email <email>", "Email address to unshare").option(
11048
+ "--experimental-shared-agent",
11049
+ "Enable experimental agent sharing feature"
11050
+ ).action(
11051
+ withErrorHandler(
11052
+ async (name, options) => {
11053
+ if (!options.experimentalSharedAgent) {
11054
+ console.error(
11055
+ chalk46.red(
11056
+ "\u2717 This command requires --experimental-shared-agent flag"
11057
+ )
11170
11058
  );
11171
- return;
11059
+ console.error();
11060
+ console.error(
11061
+ chalk46.dim(" Agent sharing is an experimental feature.")
11062
+ );
11063
+ console.error();
11064
+ console.error("Example:");
11065
+ console.error(
11066
+ chalk46.cyan(
11067
+ ` vm0 agent unshare ${name} --email ${options.email} --experimental-shared-agent`
11068
+ )
11069
+ );
11070
+ process.exit(1);
11172
11071
  }
11173
- throw new Error(error.error?.message || "Failed to unshare agent");
11174
- }
11175
- console.log(
11176
- chalk46.green(`\u2713 Removed sharing of "${name}" from ${options.email}`)
11177
- );
11178
- } catch (error) {
11179
- console.error(chalk46.red("\u2717 Failed to unshare agent"));
11180
- if (error instanceof Error) {
11181
- console.error(chalk46.dim(` ${error.message}`));
11072
+ const compose = await getComposeByName(name);
11073
+ if (!compose) {
11074
+ console.error(chalk46.red(`\u2717 Agent not found: ${name}`));
11075
+ process.exit(1);
11076
+ }
11077
+ const response = await httpDelete(
11078
+ `/api/agent/composes/${compose.id}/permissions?type=email&email=${encodeURIComponent(options.email)}`
11079
+ );
11080
+ if (!response.ok) {
11081
+ const error = await response.json();
11082
+ if (response.status === 404) {
11083
+ console.log(
11084
+ chalk46.yellow(
11085
+ `Agent "${name}" is not shared with ${options.email}`
11086
+ )
11087
+ );
11088
+ return;
11089
+ }
11090
+ throw new Error(error.error?.message || "Failed to unshare agent");
11091
+ }
11092
+ console.log(
11093
+ chalk46.green(`\u2713 Removed sharing of "${name}" from ${options.email}`)
11094
+ );
11182
11095
  }
11183
- process.exit(1);
11184
- }
11185
- });
11096
+ )
11097
+ );
11186
11098
 
11187
11099
  // src/commands/agent/permission.ts
11188
11100
  import { Command as Command42 } from "commander";
11189
11101
  import chalk47 from "chalk";
11190
- var permissionCommand = new Command42().name("experimental-permission").description("List all permissions for an agent").argument("<name>", "Agent name").action(async (name) => {
11191
- try {
11192
- const compose = await getComposeByName(name);
11193
- if (!compose) {
11194
- console.error(chalk47.red(`\u2717 Agent not found: ${name}`));
11195
- process.exit(1);
11196
- }
11197
- const response = await httpGet(
11198
- `/api/agent/composes/${compose.id}/permissions`
11199
- );
11200
- if (!response.ok) {
11201
- const error = await response.json();
11202
- throw new Error(error.error?.message || "Failed to list permissions");
11203
- }
11204
- const data = await response.json();
11205
- if (data.permissions.length === 0) {
11206
- console.log(chalk47.dim("No permissions set (private agent)"));
11207
- return;
11208
- }
11209
- console.log(
11210
- chalk47.dim(
11211
- "TYPE EMAIL PERMISSION GRANTED"
11212
- )
11213
- );
11214
- console.log(
11215
- chalk47.dim(
11216
- "------- ----------------------------- ---------- ----------"
11217
- )
11218
- );
11219
- for (const p of data.permissions) {
11220
- const type2 = p.granteeType.padEnd(7);
11221
- const email = (p.granteeEmail ?? "-").padEnd(29);
11222
- const permission = p.permission.padEnd(10);
11223
- const granted = formatRelativeTime(p.createdAt);
11224
- console.log(`${type2} ${email} ${permission} ${granted}`);
11225
- }
11226
- } catch (error) {
11227
- console.error(chalk47.red("\u2717 Failed to list permissions"));
11228
- if (error instanceof Error) {
11229
- console.error(chalk47.dim(` ${error.message}`));
11102
+ var permissionCommand = new Command42().name("permission").description("List all permissions for an agent").argument("<name>", "Agent name").option(
11103
+ "--experimental-shared-agent",
11104
+ "Enable experimental agent sharing feature"
11105
+ ).action(
11106
+ withErrorHandler(
11107
+ async (name, options) => {
11108
+ if (!options.experimentalSharedAgent) {
11109
+ console.error(
11110
+ chalk47.red(
11111
+ "\u2717 This command requires --experimental-shared-agent flag"
11112
+ )
11113
+ );
11114
+ console.error();
11115
+ console.error(
11116
+ chalk47.dim(" Agent sharing is an experimental feature.")
11117
+ );
11118
+ console.error();
11119
+ console.error("Example:");
11120
+ console.error(
11121
+ chalk47.cyan(
11122
+ ` vm0 agent permission ${name} --experimental-shared-agent`
11123
+ )
11124
+ );
11125
+ process.exit(1);
11126
+ }
11127
+ const compose = await getComposeByName(name);
11128
+ if (!compose) {
11129
+ console.error(chalk47.red(`\u2717 Agent not found: ${name}`));
11130
+ process.exit(1);
11131
+ }
11132
+ const response = await httpGet(
11133
+ `/api/agent/composes/${compose.id}/permissions`
11134
+ );
11135
+ if (!response.ok) {
11136
+ const error = await response.json();
11137
+ throw new Error(error.error?.message || "Failed to list permissions");
11138
+ }
11139
+ const data = await response.json();
11140
+ if (data.permissions.length === 0) {
11141
+ console.log(chalk47.dim("No permissions set (private agent)"));
11142
+ return;
11143
+ }
11144
+ console.log(
11145
+ chalk47.dim(
11146
+ "TYPE EMAIL PERMISSION GRANTED"
11147
+ )
11148
+ );
11149
+ console.log(
11150
+ chalk47.dim(
11151
+ "------- ----------------------------- ---------- ----------"
11152
+ )
11153
+ );
11154
+ for (const p of data.permissions) {
11155
+ const type2 = p.granteeType.padEnd(7);
11156
+ const email = (p.granteeEmail ?? "-").padEnd(29);
11157
+ const permission = p.permission.padEnd(10);
11158
+ const granted = formatRelativeTime(p.createdAt);
11159
+ console.log(`${type2} ${email} ${permission} ${granted}`);
11160
+ }
11230
11161
  }
11231
- process.exit(1);
11232
- }
11233
- });
11162
+ )
11163
+ );
11234
11164
 
11235
11165
  // src/commands/agent/index.ts
11236
11166
  var agentCommand = new Command43().name("agent").description("Manage agent composes").addCommand(cloneCommand3).addCommand(listCommand4).addCommand(statusCommand5).addCommand(publicCommand).addCommand(privateCommand).addCommand(shareCommand).addCommand(unshareCommand).addCommand(permissionCommand);
@@ -11574,7 +11504,7 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
11574
11504
  );
11575
11505
  process.exit(1);
11576
11506
  }
11577
- const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c25) => c25.value === existingFrequency) : 0;
11507
+ const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c24) => c24.value === existingFrequency) : 0;
11578
11508
  frequency = await promptSelect(
11579
11509
  "Schedule frequency",
11580
11510
  FREQUENCY_CHOICES,
@@ -11603,7 +11533,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
11603
11533
  process.exit(1);
11604
11534
  }
11605
11535
  if (frequency === "weekly") {
11606
- const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c25) => c25.value === existingDay) : 0;
11536
+ const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c24) => c24.value === existingDay) : 0;
11607
11537
  const day2 = await promptSelect(
11608
11538
  "Day of week",
11609
11539
  DAY_OF_WEEK_CHOICES,
@@ -11764,17 +11694,6 @@ Deploying schedule for agent ${chalk49.cyan(params.agentName)}...`
11764
11694
  });
11765
11695
  return deployResult;
11766
11696
  }
11767
- function handleSetupError(error) {
11768
- console.error(chalk49.red("\u2717 Failed to setup schedule"));
11769
- if (error instanceof Error) {
11770
- if (error.message.includes("Not authenticated")) {
11771
- console.error(chalk49.dim(" Run: vm0 auth login"));
11772
- } else {
11773
- console.error(chalk49.dim(` ${error.message}`));
11774
- }
11775
- }
11776
- process.exit(1);
11777
- }
11778
11697
  function displayDeployResult(agentName, deployResult) {
11779
11698
  if (deployResult.created) {
11780
11699
  console.log(
@@ -11848,8 +11767,8 @@ async function handleScheduleEnabling(params) {
11848
11767
  showEnableHint(agentName);
11849
11768
  }
11850
11769
  }
11851
- var setupCommand = new Command45().name("setup").description("Create or edit a schedule for an agent").argument("<agent-name>", "Agent name to configure schedule for").option("-f, --frequency <type>", "Frequency: daily|weekly|monthly|once").option("-t, --time <HH:MM>", "Time to run (24-hour format)").option("-d, --day <day>", "Day of week (mon-sun) or day of month (1-31)").option("-z, --timezone <tz>", "IANA timezone").option("-p, --prompt <text>", "Prompt to run").option("--artifact-name <name>", "Artifact name", "artifact").option("-e, --enable", "Enable schedule immediately after creation").action(async (agentName, options) => {
11852
- try {
11770
+ var setupCommand = new Command45().name("setup").description("Create or edit a schedule for an agent").argument("<agent-name>", "Agent name to configure schedule for").option("-f, --frequency <type>", "Frequency: daily|weekly|monthly|once").option("-t, --time <HH:MM>", "Time to run (24-hour format)").option("-d, --day <day>", "Day of week (mon-sun) or day of month (1-31)").option("-z, --timezone <tz>", "IANA timezone").option("-p, --prompt <text>", "Prompt to run").option("--artifact-name <name>", "Artifact name", "artifact").option("-e, --enable", "Enable schedule immediately after creation").action(
11771
+ withErrorHandler(async (agentName, options) => {
11853
11772
  const { composeId, scheduleName } = await resolveAgent(agentName);
11854
11773
  const existingSchedule = await findExistingSchedule(agentName);
11855
11774
  console.log(
@@ -11909,16 +11828,14 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
11909
11828
  enableFlag: options.enable ?? false,
11910
11829
  shouldPromptEnable
11911
11830
  });
11912
- } catch (error) {
11913
- handleSetupError(error);
11914
- }
11915
- });
11831
+ })
11832
+ );
11916
11833
 
11917
11834
  // src/commands/schedule/list.ts
11918
11835
  import { Command as Command46 } from "commander";
11919
11836
  import chalk50 from "chalk";
11920
- var listCommand5 = new Command46().name("list").alias("ls").description("List all schedules").action(async () => {
11921
- try {
11837
+ var listCommand5 = new Command46().name("list").alias("ls").description("List all schedules").action(
11838
+ withErrorHandler(async () => {
11922
11839
  const result = await listSchedules();
11923
11840
  if (result.schedules.length === 0) {
11924
11841
  console.log(chalk50.dim("No schedules found"));
@@ -11957,18 +11874,8 @@ var listCommand5 = new Command46().name("list").alias("ls").description("List al
11957
11874
  ].join(" ");
11958
11875
  console.log(row);
11959
11876
  }
11960
- } catch (error) {
11961
- console.error(chalk50.red("\u2717 Failed to list schedules"));
11962
- if (error instanceof Error) {
11963
- if (error.message.includes("Not authenticated")) {
11964
- console.error(chalk50.dim(" Run: vm0 auth login"));
11965
- } else {
11966
- console.error(chalk50.dim(` ${error.message}`));
11967
- }
11968
- }
11969
- process.exit(1);
11970
- }
11971
- });
11877
+ })
11878
+ );
11972
11879
 
11973
11880
  // src/commands/schedule/status.ts
11974
11881
  import { Command as Command47 } from "commander";
@@ -12403,8 +12310,8 @@ import { Command as Command56 } from "commander";
12403
12310
  // src/commands/secret/list.ts
12404
12311
  import { Command as Command53 } from "commander";
12405
12312
  import chalk56 from "chalk";
12406
- var listCommand6 = new Command53().name("list").alias("ls").description("List all secrets").action(async () => {
12407
- try {
12313
+ var listCommand6 = new Command53().name("list").alias("ls").description("List all secrets").action(
12314
+ withErrorHandler(async () => {
12408
12315
  const result = await listSecrets();
12409
12316
  if (result.secrets.length === 0) {
12410
12317
  console.log(chalk56.dim("No secrets found"));
@@ -12444,19 +12351,8 @@ var listCommand6 = new Command53().name("list").alias("ls").description("List al
12444
12351
  console.log();
12445
12352
  }
12446
12353
  console.log(chalk56.dim(`Total: ${result.secrets.length} secret(s)`));
12447
- } catch (error) {
12448
- if (error instanceof Error) {
12449
- if (error.message.includes("Not authenticated")) {
12450
- console.error(chalk56.red("\u2717 Not authenticated. Run: vm0 auth login"));
12451
- } else {
12452
- console.error(chalk56.red(`\u2717 ${error.message}`));
12453
- }
12454
- } else {
12455
- console.error(chalk56.red("\u2717 An unexpected error occurred"));
12456
- }
12457
- process.exit(1);
12458
- }
12459
- });
12354
+ })
12355
+ );
12460
12356
 
12461
12357
  // src/commands/secret/set.ts
12462
12358
  import { Command as Command54 } from "commander";
@@ -12579,8 +12475,8 @@ function truncateValue(value, maxLength = 60) {
12579
12475
  }
12580
12476
  return value.slice(0, maxLength - 15) + "... [truncated]";
12581
12477
  }
12582
- var listCommand7 = new Command57().name("list").alias("ls").description("List all variables").action(async () => {
12583
- try {
12478
+ var listCommand7 = new Command57().name("list").alias("ls").description("List all variables").action(
12479
+ withErrorHandler(async () => {
12584
12480
  const result = await listVariables();
12585
12481
  if (result.variables.length === 0) {
12586
12482
  console.log(chalk59.dim("No variables found"));
@@ -12603,19 +12499,8 @@ var listCommand7 = new Command57().name("list").alias("ls").description("List al
12603
12499
  console.log();
12604
12500
  }
12605
12501
  console.log(chalk59.dim(`Total: ${result.variables.length} variable(s)`));
12606
- } catch (error) {
12607
- if (error instanceof Error) {
12608
- if (error.message.includes("Not authenticated")) {
12609
- console.error(chalk59.red("\u2717 Not authenticated. Run: vm0 auth login"));
12610
- } else {
12611
- console.error(chalk59.red(`\u2717 ${error.message}`));
12612
- }
12613
- } else {
12614
- console.error(chalk59.red("\u2717 An unexpected error occurred"));
12615
- }
12616
- process.exit(1);
12617
- }
12618
- });
12502
+ })
12503
+ );
12619
12504
 
12620
12505
  // src/commands/variable/set.ts
12621
12506
  import { Command as Command58 } from "commander";
@@ -12712,8 +12597,8 @@ import { Command as Command65 } from "commander";
12712
12597
  // src/commands/model-provider/list.ts
12713
12598
  import { Command as Command61 } from "commander";
12714
12599
  import chalk62 from "chalk";
12715
- var listCommand8 = new Command61().name("list").alias("ls").description("List all model providers").action(async () => {
12716
- try {
12600
+ var listCommand8 = new Command61().name("list").alias("ls").description("List all model providers").action(
12601
+ withErrorHandler(async () => {
12717
12602
  const result = await listModelProviders();
12718
12603
  if (result.modelProviders.length === 0) {
12719
12604
  console.log(chalk62.dim("No model providers configured"));
@@ -12752,19 +12637,8 @@ var listCommand8 = new Command61().name("list").alias("ls").description("List al
12752
12637
  console.log(
12753
12638
  chalk62.dim(`Total: ${result.modelProviders.length} provider(s)`)
12754
12639
  );
12755
- } catch (error) {
12756
- if (error instanceof Error) {
12757
- if (error.message.includes("Not authenticated")) {
12758
- console.error(chalk62.red("\u2717 Not authenticated. Run: vm0 auth login"));
12759
- } else {
12760
- console.error(chalk62.red(`\u2717 ${error.message}`));
12761
- }
12762
- } else {
12763
- console.error(chalk62.red("\u2717 An unexpected error occurred"));
12764
- }
12765
- process.exit(1);
12766
- }
12767
- });
12640
+ })
12641
+ );
12768
12642
 
12769
12643
  // src/commands/model-provider/setup.ts
12770
12644
  import { Command as Command62 } from "commander";
@@ -13177,19 +13051,6 @@ async function handleInteractiveMode() {
13177
13051
  const selectedModel = await promptForModelSelection(type2);
13178
13052
  return { type: type2, secret, selectedModel, isInteractiveMode: true };
13179
13053
  }
13180
- function handleSetupError2(error) {
13181
- if (error instanceof Error) {
13182
- if (error.message.includes("Not authenticated")) {
13183
- console.error(chalk63.red("\u2717 Not authenticated"));
13184
- console.error(chalk63.dim(" Run: vm0 auth login"));
13185
- } else {
13186
- console.error(chalk63.red(`\u2717 ${error.message}`));
13187
- }
13188
- } else {
13189
- console.error(chalk63.red("\u2717 An unexpected error occurred"));
13190
- }
13191
- process.exit(1);
13192
- }
13193
13054
  async function promptSetAsDefault(type2, framework, isDefault) {
13194
13055
  if (isDefault) return;
13195
13056
  const response = await prompts2(
@@ -13218,8 +13079,8 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
13218
13079
  "-a, --auth-method <method>",
13219
13080
  "Auth method (required for multi-auth providers like aws-bedrock)"
13220
13081
  ).option("-m, --model <model>", "Model selection (for non-interactive mode)").action(
13221
- async (options) => {
13222
- try {
13082
+ withErrorHandler(
13083
+ async (options) => {
13223
13084
  let input;
13224
13085
  const secretArgs = options.secret ?? [];
13225
13086
  if (options.type && secretArgs.length > 0) {
@@ -13288,10 +13149,8 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
13288
13149
  provider.isDefault
13289
13150
  );
13290
13151
  }
13291
- } catch (error) {
13292
- handleSetupError2(error);
13293
13152
  }
13294
- }
13153
+ )
13295
13154
  );
13296
13155
 
13297
13156
  // src/commands/model-provider/delete.ts
@@ -13497,10 +13356,10 @@ ${type2} connected successfully!`));
13497
13356
  // src/commands/connector/list.ts
13498
13357
  import { Command as Command67 } from "commander";
13499
13358
  import chalk67 from "chalk";
13500
- var listCommand9 = new Command67().name("list").alias("ls").description("List all connectors and their status").action(async () => {
13501
- try {
13359
+ var listCommand9 = new Command67().name("list").alias("ls").description("List all connectors and their status").action(
13360
+ withErrorHandler(async () => {
13502
13361
  const result = await listConnectors();
13503
- const connectedMap = new Map(result.connectors.map((c25) => [c25.type, c25]));
13362
+ const connectedMap = new Map(result.connectors.map((c24) => [c24.type, c24]));
13504
13363
  const allTypes = Object.keys(CONNECTOR_TYPES);
13505
13364
  const typeWidth = Math.max(4, ...allTypes.map((t) => t.length));
13506
13365
  const statusText = "STATUS";
@@ -13521,29 +13380,15 @@ var listCommand9 = new Command67().name("list").alias("ls").description("List al
13521
13380
  console.log();
13522
13381
  console.log(chalk67.dim("To connect a service:"));
13523
13382
  console.log(chalk67.dim(" vm0 connector connect <type>"));
13524
- } catch (error) {
13525
- if (error instanceof Error) {
13526
- if (error.message.includes("Not authenticated")) {
13527
- console.error(chalk67.red("\u2717 Not authenticated. Run: vm0 auth login"));
13528
- } else {
13529
- console.error(chalk67.red(`\u2717 ${error.message}`));
13530
- if (error.cause instanceof Error) {
13531
- console.error(chalk67.dim(` Cause: ${error.cause.message}`));
13532
- }
13533
- }
13534
- } else {
13535
- console.error(chalk67.red("\u2717 An unexpected error occurred"));
13536
- }
13537
- process.exit(1);
13538
- }
13539
- });
13383
+ })
13384
+ );
13540
13385
 
13541
13386
  // src/commands/connector/status.ts
13542
13387
  import { Command as Command68 } from "commander";
13543
13388
  import chalk68 from "chalk";
13544
13389
  var LABEL_WIDTH = 16;
13545
- var statusCommand7 = new Command68().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").action(async (type2) => {
13546
- try {
13390
+ var statusCommand7 = new Command68().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").action(
13391
+ withErrorHandler(async (type2) => {
13547
13392
  const parseResult = connectorTypeSchema.safeParse(type2);
13548
13393
  if (!parseResult.success) {
13549
13394
  console.error(chalk68.red(`\u2717 Unknown connector type: ${type2}`));
@@ -13591,22 +13436,8 @@ var statusCommand7 = new Command68().name("status").description("Show detailed s
13591
13436
  console.log(chalk68.dim("To connect:"));
13592
13437
  console.log(chalk68.dim(` vm0 connector connect ${type2}`));
13593
13438
  }
13594
- } catch (error) {
13595
- if (error instanceof Error) {
13596
- if (error.message.includes("Not authenticated")) {
13597
- console.error(chalk68.red("\u2717 Not authenticated. Run: vm0 auth login"));
13598
- } else {
13599
- console.error(chalk68.red(`\u2717 ${error.message}`));
13600
- if (error.cause instanceof Error) {
13601
- console.error(chalk68.dim(` Cause: ${error.cause.message}`));
13602
- }
13603
- }
13604
- } else {
13605
- console.error(chalk68.red("\u2717 An unexpected error occurred"));
13606
- }
13607
- process.exit(1);
13608
- }
13609
- });
13439
+ })
13440
+ );
13610
13441
 
13611
13442
  // src/commands/connector/disconnect.ts
13612
13443
  import { Command as Command69 } from "commander";
@@ -14077,16 +13908,16 @@ async function handleModelProvider(ctx) {
14077
13908
  const providerType = await step.prompt(
14078
13909
  () => promptSelect(
14079
13910
  "Select provider type:",
14080
- choices.map((c25) => ({
14081
- title: c25.label,
14082
- value: c25.type
13911
+ choices.map((c24) => ({
13912
+ title: c24.label,
13913
+ value: c24.type
14083
13914
  }))
14084
13915
  )
14085
13916
  );
14086
13917
  if (!providerType) {
14087
13918
  process.exit(0);
14088
13919
  }
14089
- const selectedChoice = choices.find((c25) => c25.type === providerType);
13920
+ const selectedChoice = choices.find((c24) => c24.type === providerType);
14090
13921
  if (selectedChoice?.helpText) {
14091
13922
  for (const line of selectedChoice.helpText.split("\n")) {
14092
13923
  step.detail(chalk73.dim(line));
@@ -14263,26 +14094,24 @@ var onboardCommand = new Command71().name("onboard").description("Guided setup f
14263
14094
  // src/commands/setup-claude/index.ts
14264
14095
  import { Command as Command72 } from "commander";
14265
14096
  import chalk74 from "chalk";
14266
- var setupClaudeCommand = new Command72().name("setup-claude").description("Install VM0 Claude Plugin").option("--agent-dir <dir>", "Agent directory to run install in").option("--scope <scope>", "Installation scope (user or project)", "project").action(async (options) => {
14267
- console.log(chalk74.dim("Installing VM0 Claude Plugin..."));
14268
- const scope = options.scope === "user" ? "user" : "project";
14269
- try {
14097
+ var setupClaudeCommand = new Command72().name("setup-claude").description("Install VM0 Claude Plugin").option("--agent-dir <dir>", "Agent directory to run install in").option("--scope <scope>", "Installation scope (user or project)", "project").action(
14098
+ withErrorHandler(async (options) => {
14099
+ console.log(chalk74.dim("Installing VM0 Claude Plugin..."));
14100
+ const scope = options.scope === "user" ? "user" : "project";
14270
14101
  const result = await installVm0Plugin(scope, options.agentDir);
14271
14102
  console.log(
14272
14103
  chalk74.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
14273
14104
  );
14274
- } catch (error) {
14275
- handlePluginError(error);
14276
- }
14277
- console.log();
14278
- console.log("Next step:");
14279
- const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
14280
- console.log(
14281
- chalk74.cyan(
14282
- ` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
14283
- )
14284
- );
14285
- });
14105
+ console.log();
14106
+ console.log("Next step:");
14107
+ const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
14108
+ console.log(
14109
+ chalk74.cyan(
14110
+ ` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
14111
+ )
14112
+ );
14113
+ })
14114
+ );
14286
14115
 
14287
14116
  // src/commands/dashboard/index.ts
14288
14117
  import { Command as Command73 } from "commander";
@@ -14390,60 +14219,62 @@ var composeCommand2 = new Command74().name("compose").description("Test server-s
14390
14219
  (v) => parseInt(v, 10),
14391
14220
  300
14392
14221
  ).option("--json", "Output result as JSON").action(
14393
- async (githubUrl, options) => {
14394
- const intervalMs = options.interval * 1e3;
14395
- const timeoutMs = options.timeout * 1e3;
14396
- try {
14397
- if (!options.json) {
14398
- console.log("Creating compose job...");
14222
+ withErrorHandler(
14223
+ async (githubUrl, options) => {
14224
+ const intervalMs = options.interval * 1e3;
14225
+ const timeoutMs = options.timeout * 1e3;
14226
+ if (options.json) {
14227
+ try {
14228
+ const { jobId: jobId2, status: initialStatus2 } = await createComposeJob(
14229
+ githubUrl,
14230
+ options.overwrite
14231
+ );
14232
+ if (initialStatus2 === "completed" || initialStatus2 === "failed") {
14233
+ const finalJob3 = await getComposeJobStatus(jobId2);
14234
+ console.log(JSON.stringify(finalJob3, null, 2));
14235
+ process.exit(finalJob3.status === "completed" ? 0 : 1);
14236
+ }
14237
+ const finalJob2 = await pollUntilComplete(
14238
+ jobId2,
14239
+ intervalMs,
14240
+ timeoutMs,
14241
+ true
14242
+ );
14243
+ console.log(JSON.stringify(finalJob2, null, 2));
14244
+ process.exit(finalJob2.status === "completed" ? 0 : 1);
14245
+ } catch (error) {
14246
+ console.log(
14247
+ JSON.stringify({
14248
+ error: error instanceof Error ? error.message : String(error)
14249
+ })
14250
+ );
14251
+ process.exit(1);
14252
+ }
14253
+ return;
14399
14254
  }
14255
+ console.log("Creating compose job...");
14400
14256
  const { jobId, status: initialStatus } = await createComposeJob(
14401
14257
  githubUrl,
14402
14258
  options.overwrite
14403
14259
  );
14404
- if (!options.json) {
14405
- console.log(`Job ID: ${chalk76.cyan(jobId)}`);
14406
- console.log();
14407
- }
14260
+ console.log(`Job ID: ${chalk76.cyan(jobId)}`);
14261
+ console.log();
14408
14262
  if (initialStatus === "completed" || initialStatus === "failed") {
14409
14263
  const finalJob2 = await getComposeJobStatus(jobId);
14410
- if (options.json) {
14411
- console.log(JSON.stringify(finalJob2, null, 2));
14412
- } else {
14413
- displayResult(finalJob2);
14414
- }
14264
+ displayResult(finalJob2);
14415
14265
  process.exit(finalJob2.status === "completed" ? 0 : 1);
14416
14266
  }
14417
14267
  const finalJob = await pollUntilComplete(
14418
14268
  jobId,
14419
14269
  intervalMs,
14420
14270
  timeoutMs,
14421
- !!options.json
14271
+ false
14422
14272
  );
14423
- if (options.json) {
14424
- console.log(JSON.stringify(finalJob, null, 2));
14425
- } else {
14426
- console.log();
14427
- displayResult(finalJob);
14428
- }
14273
+ console.log();
14274
+ displayResult(finalJob);
14429
14275
  process.exit(finalJob.status === "completed" ? 0 : 1);
14430
- } catch (error) {
14431
- if (options.json) {
14432
- console.log(
14433
- JSON.stringify({
14434
- error: error instanceof Error ? error.message : String(error)
14435
- })
14436
- );
14437
- } else {
14438
- console.error(
14439
- chalk76.red(
14440
- `\u2717 ${error instanceof Error ? error.message : String(error)}`
14441
- )
14442
- );
14443
- }
14444
- process.exit(1);
14445
14276
  }
14446
- }
14277
+ )
14447
14278
  );
14448
14279
  function displayResult(job) {
14449
14280
  if (job.status === "completed" && job.result) {
@@ -14473,7 +14304,7 @@ var devToolCommand = new Command75().name("dev-tool").description("Developer too
14473
14304
 
14474
14305
  // src/index.ts
14475
14306
  var program = new Command76();
14476
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.29.5");
14307
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.30.1");
14477
14308
  program.addCommand(authCommand);
14478
14309
  program.addCommand(infoCommand);
14479
14310
  program.addCommand(composeCommand);