@vm0/cli 9.73.0 → 9.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +731 -544
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -22,6 +22,8 @@ var OPERATIONAL_ERROR_PATTERNS = [
22
22
  // Rate limiting (expected operational condition)
23
23
  /rate limit/i,
24
24
  /concurrent run limit/i,
25
+ /insufficient.*credit/i,
26
+ /no model provider/i,
25
27
  // Network issues (transient, not bugs)
26
28
  /network error/i,
27
29
  /network issue/i,
@@ -45,7 +47,7 @@ if (DSN) {
45
47
  Sentry.init({
46
48
  dsn: DSN,
47
49
  environment: process.env.SENTRY_ENVIRONMENT ?? "production",
48
- release: "9.73.0",
50
+ release: "9.74.0",
49
51
  sendDefaultPii: false,
50
52
  tracesSampleRate: 0,
51
53
  shutdownTimeout: 500,
@@ -64,7 +66,7 @@ if (DSN) {
64
66
  }
65
67
  });
66
68
  Sentry.setContext("cli", {
67
- version: "9.73.0",
69
+ version: "9.74.0",
68
70
  command: process.argv.slice(2).join(" ")
69
71
  });
70
72
  Sentry.setContext("runtime", {
@@ -345,373 +347,6 @@ async function setupToken() {
345
347
  // src/lib/command/with-error-handler.ts
346
348
  import chalk2 from "chalk";
347
349
 
348
- // src/lib/api/core/client-factory.ts
349
- import { tsRestFetchApi } from "@ts-rest/core";
350
- var ApiRequestError = class extends Error {
351
- constructor(message, code, status) {
352
- super(message);
353
- this.code = code;
354
- this.status = status;
355
- this.name = "ApiRequestError";
356
- }
357
- };
358
- async function getHeaders() {
359
- const token = await getActiveToken();
360
- if (!token) {
361
- throw new ApiRequestError("Not authenticated", "UNAUTHORIZED", 401);
362
- }
363
- const headers = {
364
- Authorization: `Bearer ${token}`
365
- };
366
- const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET;
367
- if (bypassSecret) {
368
- headers["x-vercel-protection-bypass"] = bypassSecret;
369
- }
370
- return headers;
371
- }
372
- async function getBaseUrl() {
373
- const apiUrl = await getApiUrl();
374
- if (!apiUrl) {
375
- throw new Error("API URL not configured");
376
- }
377
- return apiUrl;
378
- }
379
- async function getClientConfig() {
380
- const baseUrl = await getBaseUrl();
381
- const baseHeaders = await getHeaders();
382
- const activeOrg = await getActiveOrg();
383
- if (!activeOrg) {
384
- throw new Error(
385
- "No active organization configured. Run: vm0 org use <slug>"
386
- );
387
- }
388
- return {
389
- baseUrl,
390
- baseHeaders,
391
- jsonQuery: false,
392
- api: async (args) => {
393
- const separator = args.path.includes("?") ? "&" : "?";
394
- if (!args.path.includes("org=")) {
395
- args.path = `${args.path}${separator}org=${encodeURIComponent(activeOrg)}`;
396
- }
397
- return tsRestFetchApi(args);
398
- }
399
- };
400
- }
401
- function handleError(result, defaultMessage) {
402
- const errorBody = result.body;
403
- const message = errorBody.error?.message || defaultMessage;
404
- const code = errorBody.error?.code || "UNKNOWN";
405
- throw new ApiRequestError(message, code, result.status);
406
- }
407
-
408
- // src/lib/command/with-error-handler.ts
409
- function withErrorHandler(fn) {
410
- return async (...args) => {
411
- try {
412
- await fn(...args);
413
- } catch (error) {
414
- if (error instanceof ApiRequestError) {
415
- if (error.code === "UNAUTHORIZED") {
416
- console.error(chalk2.red("\u2717 Not authenticated"));
417
- console.error(chalk2.dim(" Run: vm0 auth login"));
418
- } else {
419
- console.error(chalk2.red(`\u2717 ${error.status}: ${error.message}`));
420
- }
421
- } else if (error instanceof Error) {
422
- console.error(chalk2.red(`\u2717 ${error.message}`));
423
- } else {
424
- console.error(chalk2.red("\u2717 An unexpected error occurred"));
425
- }
426
- if (error instanceof Error && error.cause instanceof Error) {
427
- console.error(chalk2.dim(` Cause: ${error.cause.message}`));
428
- }
429
- process.exit(1);
430
- }
431
- };
432
- }
433
-
434
- // src/commands/auth/login.ts
435
- var loginCommand = new Command().name("login").description("Log in to VM0 (use VM0_API_URL env var to set API URL)").action(
436
- withErrorHandler(async () => {
437
- await authenticate();
438
- })
439
- );
440
-
441
- // src/commands/auth/logout.ts
442
- import { Command as Command2 } from "commander";
443
- var logoutCommand = new Command2().name("logout").description("Log out of VM0").action(
444
- withErrorHandler(async () => {
445
- await logout();
446
- })
447
- );
448
-
449
- // src/commands/auth/status.ts
450
- import { Command as Command3 } from "commander";
451
- var statusCommand = new Command3().name("status").description("Show current authentication status").action(
452
- withErrorHandler(async () => {
453
- await checkAuthStatus();
454
- })
455
- );
456
-
457
- // src/commands/auth/setup-token.ts
458
- import { Command as Command4 } from "commander";
459
- var setupTokenCommand = new Command4().name("setup-token").description("Output auth token for CI/CD environments").action(
460
- withErrorHandler(async () => {
461
- await setupToken();
462
- })
463
- );
464
-
465
- // src/commands/auth/index.ts
466
- var authCommand = new Command5().name("auth").description("Authenticate vm0").addCommand(loginCommand).addCommand(logoutCommand).addCommand(statusCommand).addCommand(setupTokenCommand);
467
-
468
- // src/commands/info/index.ts
469
- import { Command as Command6 } from "commander";
470
- import chalk4 from "chalk";
471
- import { existsSync as existsSync2 } from "fs";
472
- import { homedir as homedir2, release as release2, type } from "os";
473
- import { join as join2 } from "path";
474
-
475
- // src/lib/utils/update-checker.ts
476
- import chalk3 from "chalk";
477
-
478
- // src/lib/utils/spawn.ts
479
- import { spawn } from "child_process";
480
- function safeSpawn(command, args, options) {
481
- const isWindows = process.platform === "win32";
482
- const resolvedCommand = isWindows ? `${command}.cmd` : command;
483
- return spawn(resolvedCommand, args, {
484
- ...options,
485
- shell: isWindows
486
- });
487
- }
488
-
489
- // src/lib/utils/update-checker.ts
490
- var PACKAGE_NAME = "@vm0/cli";
491
- var NPM_REGISTRY_URL = `https://registry.npmjs.org/${encodeURIComponent(PACKAGE_NAME)}/latest`;
492
- var TIMEOUT_MS = 5e3;
493
- var pendingUpgrade = null;
494
- function detectPackageManager() {
495
- const execPath = process.argv[1] ?? "";
496
- if (execPath.includes("pnpm")) {
497
- return "pnpm";
498
- }
499
- if (execPath.includes("/.bun/") || execPath.includes("/bun/")) {
500
- return "bun";
501
- }
502
- if (execPath.includes("/.yarn/") || execPath.includes("/yarn/")) {
503
- return "yarn";
504
- }
505
- if (execPath.includes("/usr/local/") || // Homebrew on Intel Mac
506
- execPath.includes("/opt/homebrew/") || // Homebrew on arm64 Mac
507
- execPath.includes("/.nvm/") || execPath.includes("/.fnm/") || execPath.includes("/.volta/") || execPath.includes("/.nodenv/") || execPath.includes("/.n/") || execPath.includes("/node_modules/") || execPath.includes("\\npm\\") || // Windows: AppData\Roaming\npm
508
- execPath.includes("\\nodejs\\")) {
509
- return "npm";
510
- }
511
- return "unknown";
512
- }
513
- function isAutoUpgradeSupported(pm) {
514
- return pm === "npm" || pm === "pnpm";
515
- }
516
- function getManualUpgradeCommand(pm) {
517
- switch (pm) {
518
- case "bun":
519
- return `bun add -g ${PACKAGE_NAME}@latest`;
520
- case "yarn":
521
- return `yarn global add ${PACKAGE_NAME}@latest`;
522
- case "pnpm":
523
- return `pnpm add -g ${PACKAGE_NAME}@latest`;
524
- case "npm":
525
- return `npm install -g ${PACKAGE_NAME}@latest`;
526
- case "unknown":
527
- return `npm install -g ${PACKAGE_NAME}@latest`;
528
- }
529
- }
530
- function escapeForShell(str) {
531
- return `'${str.replace(/'/g, "'\\''")}'`;
532
- }
533
- function buildRerunCommand(prompt) {
534
- if (prompt) {
535
- return `vm0 cook ${escapeForShell(prompt)}`;
536
- }
537
- return "vm0 cook";
538
- }
539
- async function getLatestVersion() {
540
- try {
541
- const controller = new AbortController();
542
- const timeoutId = setTimeout(() => controller.abort(), TIMEOUT_MS);
543
- const response = await fetch(NPM_REGISTRY_URL, {
544
- signal: controller.signal
545
- });
546
- clearTimeout(timeoutId);
547
- if (!response.ok) {
548
- return null;
549
- }
550
- const json = await response.json();
551
- return json.version ?? null;
552
- } catch {
553
- return null;
554
- }
555
- }
556
- function performUpgrade(packageManager) {
557
- return new Promise((resolve2) => {
558
- const args = packageManager === "pnpm" ? ["add", "-g", `${PACKAGE_NAME}@latest`] : ["install", "-g", `${PACKAGE_NAME}@latest`];
559
- const child = safeSpawn(packageManager, args, {
560
- stdio: "inherit"
561
- });
562
- child.on("close", (code) => {
563
- resolve2(code === 0);
564
- });
565
- child.on("error", () => {
566
- resolve2(false);
567
- });
568
- });
569
- }
570
- async function checkAndUpgrade(currentVersion, prompt) {
571
- const latestVersion = await getLatestVersion();
572
- if (latestVersion === null) {
573
- console.log(chalk3.yellow("\u26A0 Could not check for updates"));
574
- console.log();
575
- return false;
576
- }
577
- if (latestVersion === currentVersion) {
578
- return false;
579
- }
580
- console.log(chalk3.yellow("vm0 is currently in beta."));
581
- console.log(
582
- chalk3.yellow(
583
- `Current version: ${currentVersion} -> Latest version: ${latestVersion}`
584
- )
585
- );
586
- console.log(
587
- chalk3.yellow(
588
- "Please always use the latest version for best compatibility."
589
- )
590
- );
591
- console.log();
592
- const packageManager = detectPackageManager();
593
- if (!isAutoUpgradeSupported(packageManager)) {
594
- if (packageManager === "unknown") {
595
- console.log(
596
- chalk3.yellow("Could not detect your package manager for auto-upgrade.")
597
- );
598
- } else {
599
- console.log(
600
- chalk3.yellow(`Auto-upgrade is not supported for ${packageManager}.`)
601
- );
602
- }
603
- console.log(chalk3.yellow("Please upgrade manually:"));
604
- console.log(chalk3.cyan(` ${getManualUpgradeCommand(packageManager)}`));
605
- console.log();
606
- return false;
607
- }
608
- console.log(`Upgrading via ${packageManager}...`);
609
- const success = await performUpgrade(packageManager);
610
- if (success) {
611
- console.log(chalk3.green(`Upgraded to ${latestVersion}`));
612
- console.log();
613
- console.log("To continue, run:");
614
- console.log(chalk3.cyan(` ${buildRerunCommand(prompt)}`));
615
- return true;
616
- }
617
- console.error();
618
- console.error(chalk3.red("\u2717 Upgrade failed. Please run manually:"));
619
- console.error(chalk3.cyan(` ${getManualUpgradeCommand(packageManager)}`));
620
- console.error();
621
- console.error("Then re-run:");
622
- console.error(chalk3.cyan(` ${buildRerunCommand(prompt)}`));
623
- return true;
624
- }
625
- async function startSilentUpgrade(currentVersion) {
626
- pendingUpgrade = null;
627
- const latestVersion = await getLatestVersion();
628
- if (latestVersion === null || latestVersion === currentVersion) {
629
- return;
630
- }
631
- const packageManager = detectPackageManager();
632
- if (!isAutoUpgradeSupported(packageManager)) {
633
- return;
634
- }
635
- const isWindows = process.platform === "win32";
636
- const args = packageManager === "pnpm" ? ["add", "-g", `${PACKAGE_NAME}@latest`] : ["install", "-g", `${PACKAGE_NAME}@latest`];
637
- const child = safeSpawn(packageManager, args, {
638
- stdio: "pipe",
639
- detached: !isWindows,
640
- windowsHide: true
641
- });
642
- const promise = new Promise((resolve2) => {
643
- child.on("close", (code) => resolve2(code === 0));
644
- child.on("error", () => resolve2(false));
645
- });
646
- pendingUpgrade = { promise, child, packageManager };
647
- }
648
- async function waitForSilentUpgrade(timeout = TIMEOUT_MS) {
649
- if (!pendingUpgrade) {
650
- return;
651
- }
652
- const { promise, child, packageManager } = pendingUpgrade;
653
- pendingUpgrade = null;
654
- const result = await Promise.race([
655
- promise,
656
- new Promise((resolve2) => {
657
- setTimeout(() => {
658
- child.kill();
659
- resolve2(false);
660
- }, timeout);
661
- })
662
- ]);
663
- if (!result) {
664
- console.log(
665
- chalk3.yellow(
666
- `
667
- \u26A0 vm0 auto upgrade failed. Please run: ${getManualUpgradeCommand(packageManager)}`
668
- )
669
- );
670
- }
671
- }
672
-
673
- // src/commands/info/index.ts
674
- function getConfigPath() {
675
- return join2(homedir2(), ".vm0", "config.json");
676
- }
677
- var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
678
- console.log(chalk4.bold(`VM0 CLI v${"9.73.0"}`));
679
- console.log();
680
- const config = await loadConfig();
681
- const hasEnvToken = !!process.env.VM0_TOKEN;
682
- const hasConfigToken = !!config.token;
683
- const isAuthenticated2 = hasEnvToken || hasConfigToken;
684
- console.log(chalk4.bold("Authentication:"));
685
- if (isAuthenticated2) {
686
- const tokenSource = hasEnvToken ? "VM0_TOKEN env var" : "config file";
687
- console.log(` ${chalk4.green("\u2713")} Logged in (via ${tokenSource})`);
688
- } else {
689
- console.log(` ${chalk4.red("\u2717")} Not authenticated`);
690
- }
691
- const configExists = existsSync2(getConfigPath());
692
- const configDisplay = configExists ? `~/.vm0/config.json` : `~/.vm0/config.json (not found)`;
693
- console.log(` Config: ${configDisplay}`);
694
- console.log();
695
- const apiUrl = await getApiUrl();
696
- console.log(chalk4.bold("API:"));
697
- console.log(` Host: ${apiUrl}`);
698
- console.log();
699
- console.log(chalk4.bold("System:"));
700
- console.log(` Node: ${process.version}`);
701
- console.log(` Platform: ${process.platform} (${process.arch})`);
702
- console.log(` OS: ${type()} ${release2()}`);
703
- console.log(` Shell: ${process.env.SHELL ?? "unknown"}`);
704
- console.log(` Package Manager: ${detectPackageManager()}`);
705
- });
706
-
707
- // src/commands/compose/index.ts
708
- import { Command as Command7, Option } from "commander";
709
- import chalk6 from "chalk";
710
- import { readFile as readFile4, rm as rm3 } from "fs/promises";
711
- import { existsSync as existsSync5 } from "fs";
712
- import { dirname as dirname2, join as join8 } from "path";
713
- import { parse as parseYaml3 } from "yaml";
714
-
715
350
  // ../../packages/core/src/variable-expander.ts
716
351
  var VARIABLE_PATTERN = /\$\{\{\s*(env|vars|secrets)\.([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g;
717
352
  function extractVariableReferencesFromString(value) {
@@ -780,6 +415,30 @@ var apiErrorSchema = z2.object({
780
415
  code: z2.string()
781
416
  })
782
417
  });
418
+ var RUN_ERROR_GUIDANCE = {
419
+ NO_MODEL_PROVIDER: {
420
+ title: "No model provider configured",
421
+ guidance: "Configure a model provider to start running agents.",
422
+ cliHint: "vm0 org model-provider setup"
423
+ },
424
+ INSUFFICIENT_CREDITS: {
425
+ title: "Credits depleted",
426
+ guidance: "Add credits or configure your own API key to continue.",
427
+ cliHint: "vm0 org billing"
428
+ },
429
+ PROVIDER_INCOMPATIBLE: {
430
+ title: "Provider not compatible",
431
+ guidance: "This session was created with a different provider type."
432
+ },
433
+ PROVIDER_UNAVAILABLE: {
434
+ title: "Provider temporarily unavailable",
435
+ guidance: "The model provider is temporarily unavailable. Please try again later."
436
+ },
437
+ TOO_MANY_REQUESTS: {
438
+ title: "Concurrent run limit reached",
439
+ guidance: "Wait for your current run to complete before starting a new one."
440
+ }
441
+ };
783
442
 
784
443
  // ../../packages/core/src/contracts/composes.ts
785
444
  import { z as z4 } from "zod";
@@ -826,7 +485,8 @@ var VALID_CAPABILITIES = [
826
485
  "agent-run:read",
827
486
  "agent-run:write",
828
487
  "schedule:read",
829
- "schedule:write"
488
+ "schedule:write",
489
+ "integration-slack:write"
830
490
  ];
831
491
  var agentNameSchema = z4.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
832
492
  AGENT_NAME_REGEX,
@@ -1087,6 +747,59 @@ var composesListContract = c.router({
1087
747
  summary: "List all agent composes for an org"
1088
748
  }
1089
749
  });
750
+ var metadataUpdateSchema = z4.object({
751
+ displayName: z4.string().optional(),
752
+ description: z4.string().optional(),
753
+ sound: z4.string().optional()
754
+ });
755
+ var composesMetadataContract = c.router({
756
+ /**
757
+ * PATCH /api/agent/composes/:id/metadata
758
+ * Update agent compose metadata (displayName, description, sound)
759
+ */
760
+ updateMetadata: {
761
+ method: "PATCH",
762
+ path: "/api/agent/composes/:id/metadata",
763
+ headers: authHeadersSchema,
764
+ pathParams: z4.object({
765
+ id: z4.string().min(1, "Compose ID is required")
766
+ }),
767
+ body: metadataUpdateSchema,
768
+ responses: {
769
+ 200: z4.object({ ok: z4.literal(true) }),
770
+ 400: apiErrorSchema,
771
+ 401: apiErrorSchema,
772
+ 403: apiErrorSchema,
773
+ 404: apiErrorSchema
774
+ },
775
+ summary: "Update agent compose metadata"
776
+ }
777
+ });
778
+ var composeInstructionsResponseSchema = z4.object({
779
+ content: z4.string().nullable(),
780
+ filename: z4.string().nullable()
781
+ });
782
+ var composesInstructionsContract = c.router({
783
+ /**
784
+ * GET /api/agent/composes/:id/instructions
785
+ * Get the instructions content for an agent compose
786
+ */
787
+ getInstructions: {
788
+ method: "GET",
789
+ path: "/api/agent/composes/:id/instructions",
790
+ headers: authHeadersSchema,
791
+ pathParams: z4.object({
792
+ id: z4.string().min(1, "Compose ID is required")
793
+ }),
794
+ responses: {
795
+ 200: composeInstructionsResponseSchema,
796
+ 401: apiErrorSchema,
797
+ 403: apiErrorSchema,
798
+ 404: apiErrorSchema
799
+ },
800
+ summary: "Get agent compose instructions content"
801
+ }
802
+ });
1090
803
 
1091
804
  // ../../packages/core/src/contracts/runs.ts
1092
805
  import { z as z8 } from "zod";
@@ -1556,8 +1269,11 @@ var runsMainContract = c5.router({
1556
1269
  201: createRunResponseSchema,
1557
1270
  400: apiErrorSchema,
1558
1271
  401: apiErrorSchema,
1272
+ 402: apiErrorSchema,
1559
1273
  403: apiErrorSchema,
1560
- 404: apiErrorSchema
1274
+ 404: apiErrorSchema,
1275
+ 422: apiErrorSchema,
1276
+ 503: apiErrorSchema
1561
1277
  },
1562
1278
  summary: "Create and execute agent run"
1563
1279
  }
@@ -3845,17 +3561,23 @@ var schedulesEnableContract = c16.router({
3845
3561
  pathParams: z20.object({
3846
3562
  name: z20.string().min(1, "Schedule name required")
3847
3563
  }),
3564
+ query: z20.object({
3565
+ org: z20.string().optional()
3566
+ }),
3848
3567
  body: z20.object({
3849
3568
  composeId: z20.string().uuid("Compose ID required")
3850
3569
  }),
3851
3570
  responses: {
3852
3571
  200: scheduleResponseSchema,
3572
+ 400: apiErrorSchema,
3853
3573
  401: apiErrorSchema,
3854
3574
  403: apiErrorSchema,
3855
3575
  404: apiErrorSchema
3856
3576
  },
3857
3577
  summary: "Enable schedule"
3858
- },
3578
+ }
3579
+ });
3580
+ var schedulesDisableContract = c16.router({
3859
3581
  /**
3860
3582
  * POST /api/agent/schedules/:name/disable
3861
3583
  * Disable an enabled schedule
@@ -3867,11 +3589,15 @@ var schedulesEnableContract = c16.router({
3867
3589
  pathParams: z20.object({
3868
3590
  name: z20.string().min(1, "Schedule name required")
3869
3591
  }),
3592
+ query: z20.object({
3593
+ org: z20.string().optional()
3594
+ }),
3870
3595
  body: z20.object({
3871
3596
  composeId: z20.string().uuid("Compose ID required")
3872
3597
  }),
3873
3598
  responses: {
3874
3599
  200: scheduleResponseSchema,
3600
+ 400: apiErrorSchema,
3875
3601
  401: apiErrorSchema,
3876
3602
  403: apiErrorSchema,
3877
3603
  404: apiErrorSchema
@@ -3904,6 +3630,32 @@ var scheduleRunsContract = c16.router({
3904
3630
  summary: "List recent runs for a schedule"
3905
3631
  }
3906
3632
  });
3633
+ var agentMissingSecretsSchema = z20.object({
3634
+ composeId: z20.string(),
3635
+ agentName: z20.string(),
3636
+ requiredSecrets: z20.array(z20.string()),
3637
+ missingSecrets: z20.array(z20.string())
3638
+ });
3639
+ var schedulesMissingSecretsContract = c16.router({
3640
+ /**
3641
+ * GET /api/agent/schedules/missing-secrets
3642
+ * Check agents for missing secrets
3643
+ */
3644
+ getMissingSecrets: {
3645
+ method: "GET",
3646
+ path: "/api/agent/schedules/missing-secrets",
3647
+ headers: authHeadersSchema,
3648
+ query: z20.object({
3649
+ org: z20.string().optional()
3650
+ }),
3651
+ responses: {
3652
+ 200: z20.object({ agents: z20.array(agentMissingSecretsSchema) }),
3653
+ 401: apiErrorSchema,
3654
+ 403: apiErrorSchema
3655
+ },
3656
+ summary: "Check agents for missing secrets"
3657
+ }
3658
+ });
3907
3659
 
3908
3660
  // ../../packages/core/src/contracts/realtime.ts
3909
3661
  import { z as z21 } from "zod";
@@ -8022,35 +7774,61 @@ var orgVariablesByNameContract = c25.router({
8022
7774
  404: apiErrorSchema,
8023
7775
  500: apiErrorSchema
8024
7776
  },
8025
- summary: "Delete an org-level variable (admin only)"
7777
+ summary: "Delete an org-level variable (admin only)"
7778
+ }
7779
+ });
7780
+
7781
+ // ../../packages/core/src/contracts/required-env.ts
7782
+ import { z as z30 } from "zod";
7783
+ var c26 = initContract();
7784
+ var agentRequiredEnvSchema = z30.object({
7785
+ composeId: z30.string(),
7786
+ agentName: z30.string(),
7787
+ requiredSecrets: z30.array(z30.string()),
7788
+ requiredVariables: z30.array(z30.string())
7789
+ });
7790
+ var requiredEnvContract = c26.router({
7791
+ /**
7792
+ * GET /api/agent/required-env
7793
+ * Get required environment variables for user agents
7794
+ */
7795
+ getRequiredEnv: {
7796
+ method: "GET",
7797
+ path: "/api/agent/required-env",
7798
+ headers: authHeadersSchema,
7799
+ responses: {
7800
+ 200: z30.object({ agents: z30.array(agentRequiredEnvSchema) }),
7801
+ 401: apiErrorSchema
7802
+ },
7803
+ summary: "Get required environment variables for user agents"
8026
7804
  }
8027
7805
  });
8028
7806
 
8029
7807
  // ../../packages/core/src/contracts/zero-agents.ts
8030
- import { z as z30 } from "zod";
8031
- var c26 = initContract();
8032
- var zeroAgentResponseSchema = z30.object({
8033
- name: z30.string(),
8034
- agentComposeId: z30.string(),
8035
- description: z30.string().nullable(),
8036
- displayName: z30.string().nullable(),
8037
- sound: z30.string().nullable(),
8038
- connectors: z30.array(z30.string())
7808
+ import { z as z31 } from "zod";
7809
+ var c27 = initContract();
7810
+ var zeroAgentResponseSchema = z31.object({
7811
+ name: z31.string(),
7812
+ agentComposeId: z31.string(),
7813
+ description: z31.string().nullable(),
7814
+ displayName: z31.string().nullable(),
7815
+ sound: z31.string().nullable(),
7816
+ connectors: z31.array(z31.string())
8039
7817
  });
8040
- var zeroAgentRequestSchema = z30.object({
8041
- description: z30.string().optional(),
8042
- displayName: z30.string().optional(),
8043
- sound: z30.string().optional(),
8044
- connectors: z30.array(z30.string())
7818
+ var zeroAgentRequestSchema = z31.object({
7819
+ description: z31.string().optional(),
7820
+ displayName: z31.string().optional(),
7821
+ sound: z31.string().optional(),
7822
+ connectors: z31.array(z31.string())
8045
7823
  });
8046
- var zeroAgentInstructionsResponseSchema = z30.object({
8047
- content: z30.string().nullable(),
8048
- filename: z30.string().nullable()
7824
+ var zeroAgentInstructionsResponseSchema = z31.object({
7825
+ content: z31.string().nullable(),
7826
+ filename: z31.string().nullable()
8049
7827
  });
8050
- var zeroAgentInstructionsRequestSchema = z30.object({
8051
- content: z30.string()
7828
+ var zeroAgentInstructionsRequestSchema = z31.object({
7829
+ content: z31.string()
8052
7830
  });
8053
- var zeroAgentsMainContract = c26.router({
7831
+ var zeroAgentsMainContract = c27.router({
8054
7832
  create: {
8055
7833
  method: "POST",
8056
7834
  path: "/api/zero/agents",
@@ -8065,12 +7843,12 @@ var zeroAgentsMainContract = c26.router({
8065
7843
  summary: "Create zero agent"
8066
7844
  }
8067
7845
  });
8068
- var zeroAgentsByNameContract = c26.router({
7846
+ var zeroAgentsByNameContract = c27.router({
8069
7847
  get: {
8070
7848
  method: "GET",
8071
7849
  path: "/api/zero/agents/:name",
8072
7850
  headers: authHeadersSchema,
8073
- pathParams: z30.object({ name: z30.string() }),
7851
+ pathParams: z31.object({ name: z31.string() }),
8074
7852
  responses: {
8075
7853
  200: zeroAgentResponseSchema,
8076
7854
  401: apiErrorSchema,
@@ -8082,7 +7860,7 @@ var zeroAgentsByNameContract = c26.router({
8082
7860
  method: "PUT",
8083
7861
  path: "/api/zero/agents/:name",
8084
7862
  headers: authHeadersSchema,
8085
- pathParams: z30.object({ name: z30.string() }),
7863
+ pathParams: z31.object({ name: z31.string() }),
8086
7864
  body: zeroAgentRequestSchema,
8087
7865
  responses: {
8088
7866
  200: zeroAgentResponseSchema,
@@ -8094,12 +7872,12 @@ var zeroAgentsByNameContract = c26.router({
8094
7872
  summary: "Update zero agent"
8095
7873
  }
8096
7874
  });
8097
- var zeroAgentInstructionsContract = c26.router({
7875
+ var zeroAgentInstructionsContract = c27.router({
8098
7876
  get: {
8099
7877
  method: "GET",
8100
7878
  path: "/api/zero/agents/:name/instructions",
8101
7879
  headers: authHeadersSchema,
8102
- pathParams: z30.object({ name: z30.string() }),
7880
+ pathParams: z31.object({ name: z31.string() }),
8103
7881
  responses: {
8104
7882
  200: zeroAgentInstructionsResponseSchema,
8105
7883
  401: apiErrorSchema,
@@ -8111,7 +7889,7 @@ var zeroAgentInstructionsContract = c26.router({
8111
7889
  method: "PUT",
8112
7890
  path: "/api/zero/agents/:name/instructions",
8113
7891
  headers: authHeadersSchema,
8114
- pathParams: z30.object({ name: z30.string() }),
7892
+ pathParams: z31.object({ name: z31.string() }),
8115
7893
  body: zeroAgentInstructionsRequestSchema,
8116
7894
  responses: {
8117
7895
  200: zeroAgentResponseSchema,
@@ -8124,9 +7902,9 @@ var zeroAgentInstructionsContract = c26.router({
8124
7902
  });
8125
7903
 
8126
7904
  // ../../packages/core/src/contracts/zero-connectors.ts
8127
- import { z as z31 } from "zod";
8128
- var c27 = initContract();
8129
- var zeroConnectorsMainContract = c27.router({
7905
+ import { z as z32 } from "zod";
7906
+ var c28 = initContract();
7907
+ var zeroConnectorsMainContract = c28.router({
8130
7908
  list: {
8131
7909
  method: "GET",
8132
7910
  path: "/api/zero/connectors",
@@ -8139,26 +7917,26 @@ var zeroConnectorsMainContract = c27.router({
8139
7917
  summary: "List all connectors (zero proxy)"
8140
7918
  }
8141
7919
  });
8142
- var zeroConnectorsByTypeContract = c27.router({
7920
+ var zeroConnectorsByTypeContract = c28.router({
8143
7921
  delete: {
8144
7922
  method: "DELETE",
8145
7923
  path: "/api/zero/connectors/:type",
8146
7924
  headers: authHeadersSchema,
8147
- pathParams: z31.object({ type: connectorTypeSchema }),
7925
+ pathParams: z32.object({ type: connectorTypeSchema }),
8148
7926
  responses: {
8149
- 204: c27.noBody(),
7927
+ 204: c28.noBody(),
8150
7928
  401: apiErrorSchema,
8151
7929
  404: apiErrorSchema
8152
7930
  },
8153
7931
  summary: "Disconnect a connector (zero proxy)"
8154
7932
  }
8155
7933
  });
8156
- var zeroConnectorScopeDiffContract = c27.router({
7934
+ var zeroConnectorScopeDiffContract = c28.router({
8157
7935
  getScopeDiff: {
8158
7936
  method: "GET",
8159
7937
  path: "/api/zero/connectors/:type/scope-diff",
8160
7938
  headers: authHeadersSchema,
8161
- pathParams: z31.object({ type: connectorTypeSchema }),
7939
+ pathParams: z32.object({ type: connectorTypeSchema }),
8162
7940
  responses: {
8163
7941
  200: scopeDiffResponseSchema,
8164
7942
  401: apiErrorSchema,
@@ -8169,8 +7947,8 @@ var zeroConnectorScopeDiffContract = c27.router({
8169
7947
  });
8170
7948
 
8171
7949
  // ../../packages/core/src/contracts/zero-org.ts
8172
- var c28 = initContract();
8173
- var zeroOrgContract = c28.router({
7950
+ var c29 = initContract();
7951
+ var zeroOrgContract = c29.router({
8174
7952
  get: {
8175
7953
  method: "GET",
8176
7954
  path: "/api/zero/org",
@@ -8185,16 +7963,16 @@ var zeroOrgContract = c28.router({
8185
7963
  });
8186
7964
 
8187
7965
  // ../../packages/core/src/contracts/zero-composes.ts
8188
- import { z as z32 } from "zod";
8189
- var c29 = initContract();
8190
- var zeroComposesMainContract = c29.router({
7966
+ import { z as z33 } from "zod";
7967
+ var c30 = initContract();
7968
+ var zeroComposesMainContract = c30.router({
8191
7969
  getByName: {
8192
7970
  method: "GET",
8193
7971
  path: "/api/zero/composes",
8194
7972
  headers: authHeadersSchema,
8195
- query: z32.object({
8196
- name: z32.string().min(1, "Missing name query parameter"),
8197
- org: z32.string().optional()
7973
+ query: z33.object({
7974
+ name: z33.string().min(1, "Missing name query parameter"),
7975
+ org: z33.string().optional()
8198
7976
  }),
8199
7977
  responses: {
8200
7978
  200: composeResponseSchema,
@@ -8205,13 +7983,13 @@ var zeroComposesMainContract = c29.router({
8205
7983
  summary: "Get agent compose by name (zero proxy)"
8206
7984
  }
8207
7985
  });
8208
- var zeroComposesByIdContract = c29.router({
7986
+ var zeroComposesByIdContract = c30.router({
8209
7987
  getById: {
8210
7988
  method: "GET",
8211
7989
  path: "/api/zero/composes/:id",
8212
7990
  headers: authHeadersSchema,
8213
- pathParams: z32.object({
8214
- id: z32.string().min(1, "Compose ID is required")
7991
+ pathParams: z33.object({
7992
+ id: z33.string().min(1, "Compose ID is required")
8215
7993
  }),
8216
7994
  responses: {
8217
7995
  200: composeResponseSchema,
@@ -8225,12 +8003,12 @@ var zeroComposesByIdContract = c29.router({
8225
8003
  method: "DELETE",
8226
8004
  path: "/api/zero/composes/:id",
8227
8005
  headers: authHeadersSchema,
8228
- pathParams: z32.object({
8229
- id: z32.string().uuid("Compose ID is required")
8006
+ pathParams: z33.object({
8007
+ id: z33.string().uuid("Compose ID is required")
8230
8008
  }),
8231
- body: c29.noBody(),
8009
+ body: c30.noBody(),
8232
8010
  responses: {
8233
- 204: c29.noBody(),
8011
+ 204: c30.noBody(),
8234
8012
  401: apiErrorSchema,
8235
8013
  403: apiErrorSchema,
8236
8014
  404: apiErrorSchema,
@@ -8239,17 +8017,17 @@ var zeroComposesByIdContract = c29.router({
8239
8017
  summary: "Delete agent compose (zero proxy)"
8240
8018
  }
8241
8019
  });
8242
- var zeroComposesListContract = c29.router({
8020
+ var zeroComposesListContract = c30.router({
8243
8021
  list: {
8244
8022
  method: "GET",
8245
8023
  path: "/api/zero/composes/list",
8246
8024
  headers: authHeadersSchema,
8247
- query: z32.object({
8248
- org: z32.string().optional()
8025
+ query: z33.object({
8026
+ org: z33.string().optional()
8249
8027
  }),
8250
8028
  responses: {
8251
- 200: z32.object({
8252
- composes: z32.array(composeListItemSchema)
8029
+ 200: z33.object({
8030
+ composes: z33.array(composeListItemSchema)
8253
8031
  }),
8254
8032
  400: apiErrorSchema,
8255
8033
  401: apiErrorSchema,
@@ -8260,12 +8038,12 @@ var zeroComposesListContract = c29.router({
8260
8038
  });
8261
8039
 
8262
8040
  // ../../packages/core/src/contracts/zero-runs.ts
8263
- import { z as z33 } from "zod";
8041
+ import { z as z34 } from "zod";
8264
8042
  var zeroRunRequestSchema = unifiedRunRequestSchema.omit({
8265
8043
  triggerSource: true
8266
8044
  });
8267
- var c30 = initContract();
8268
- var zeroRunsMainContract = c30.router({
8045
+ var c31 = initContract();
8046
+ var zeroRunsMainContract = c31.router({
8269
8047
  create: {
8270
8048
  method: "POST",
8271
8049
  path: "/api/zero/runs",
@@ -8281,13 +8059,13 @@ var zeroRunsMainContract = c30.router({
8281
8059
  summary: "Create and execute agent run (zero proxy)"
8282
8060
  }
8283
8061
  });
8284
- var zeroRunsByIdContract = c30.router({
8062
+ var zeroRunsByIdContract = c31.router({
8285
8063
  getById: {
8286
8064
  method: "GET",
8287
8065
  path: "/api/zero/runs/:id",
8288
8066
  headers: authHeadersSchema,
8289
- pathParams: z33.object({
8290
- id: z33.string().min(1, "Run ID is required")
8067
+ pathParams: z34.object({
8068
+ id: z34.string().min(1, "Run ID is required")
8291
8069
  }),
8292
8070
  responses: {
8293
8071
  200: getRunResponseSchema,
@@ -8298,15 +8076,15 @@ var zeroRunsByIdContract = c30.router({
8298
8076
  summary: "Get agent run by ID (zero proxy)"
8299
8077
  }
8300
8078
  });
8301
- var zeroRunsCancelContract = c30.router({
8079
+ var zeroRunsCancelContract = c31.router({
8302
8080
  cancel: {
8303
8081
  method: "POST",
8304
8082
  path: "/api/zero/runs/:id/cancel",
8305
8083
  headers: authHeadersSchema,
8306
- pathParams: z33.object({
8307
- id: z33.string().min(1, "Run ID is required")
8084
+ pathParams: z34.object({
8085
+ id: z34.string().min(1, "Run ID is required")
8308
8086
  }),
8309
- body: z33.undefined(),
8087
+ body: z34.undefined(),
8310
8088
  responses: {
8311
8089
  200: cancelRunResponseSchema,
8312
8090
  400: apiErrorSchema,
@@ -8317,7 +8095,7 @@ var zeroRunsCancelContract = c30.router({
8317
8095
  summary: "Cancel a pending or running run (zero proxy)"
8318
8096
  }
8319
8097
  });
8320
- var zeroRunsQueueContract = c30.router({
8098
+ var zeroRunsQueueContract = c31.router({
8321
8099
  getQueue: {
8322
8100
  method: "GET",
8323
8101
  path: "/api/zero/runs/queue",
@@ -8330,18 +8108,18 @@ var zeroRunsQueueContract = c30.router({
8330
8108
  summary: "Get org run queue status (zero proxy)"
8331
8109
  }
8332
8110
  });
8333
- var zeroRunAgentEventsContract = c30.router({
8111
+ var zeroRunAgentEventsContract = c31.router({
8334
8112
  getAgentEvents: {
8335
8113
  method: "GET",
8336
8114
  path: "/api/zero/runs/:id/telemetry/agent",
8337
8115
  headers: authHeadersSchema,
8338
- pathParams: z33.object({
8339
- id: z33.string().min(1, "Run ID is required")
8116
+ pathParams: z34.object({
8117
+ id: z34.string().min(1, "Run ID is required")
8340
8118
  }),
8341
- query: z33.object({
8342
- since: z33.coerce.number().optional(),
8343
- limit: z33.coerce.number().min(1).max(100).default(5),
8344
- order: z33.enum(["asc", "desc"]).default("desc")
8119
+ query: z34.object({
8120
+ since: z34.coerce.number().optional(),
8121
+ limit: z34.coerce.number().min(1).max(100).default(5),
8122
+ order: z34.enum(["asc", "desc"]).default("desc")
8345
8123
  }),
8346
8124
  responses: {
8347
8125
  200: agentEventsResponseSchema,
@@ -8353,9 +8131,9 @@ var zeroRunAgentEventsContract = c30.router({
8353
8131
  });
8354
8132
 
8355
8133
  // ../../packages/core/src/contracts/zero-schedules.ts
8356
- import { z as z34 } from "zod";
8357
- var c31 = initContract();
8358
- var zeroSchedulesMainContract = c31.router({
8134
+ import { z as z35 } from "zod";
8135
+ var c32 = initContract();
8136
+ var zeroSchedulesMainContract = c32.router({
8359
8137
  deploy: {
8360
8138
  method: "POST",
8361
8139
  path: "/api/zero/schedules",
@@ -8383,19 +8161,19 @@ var zeroSchedulesMainContract = c31.router({
8383
8161
  summary: "List all schedules (zero proxy)"
8384
8162
  }
8385
8163
  });
8386
- var zeroSchedulesByNameContract = c31.router({
8164
+ var zeroSchedulesByNameContract = c32.router({
8387
8165
  delete: {
8388
8166
  method: "DELETE",
8389
8167
  path: "/api/zero/schedules/:name",
8390
8168
  headers: authHeadersSchema,
8391
- pathParams: z34.object({
8392
- name: z34.string().min(1, "Schedule name required")
8169
+ pathParams: z35.object({
8170
+ name: z35.string().min(1, "Schedule name required")
8393
8171
  }),
8394
- query: z34.object({
8395
- composeId: z34.string().uuid("Compose ID required")
8172
+ query: z35.object({
8173
+ composeId: z35.string().uuid("Compose ID required")
8396
8174
  }),
8397
8175
  responses: {
8398
- 204: c31.noBody(),
8176
+ 204: c32.noBody(),
8399
8177
  401: apiErrorSchema,
8400
8178
  403: apiErrorSchema,
8401
8179
  404: apiErrorSchema
@@ -8403,16 +8181,16 @@ var zeroSchedulesByNameContract = c31.router({
8403
8181
  summary: "Delete schedule (zero proxy)"
8404
8182
  }
8405
8183
  });
8406
- var zeroSchedulesEnableContract = c31.router({
8184
+ var zeroSchedulesEnableContract = c32.router({
8407
8185
  enable: {
8408
8186
  method: "POST",
8409
8187
  path: "/api/zero/schedules/:name/enable",
8410
8188
  headers: authHeadersSchema,
8411
- pathParams: z34.object({
8412
- name: z34.string().min(1, "Schedule name required")
8189
+ pathParams: z35.object({
8190
+ name: z35.string().min(1, "Schedule name required")
8413
8191
  }),
8414
- body: z34.object({
8415
- composeId: z34.string().uuid("Compose ID required")
8192
+ body: z35.object({
8193
+ composeId: z35.string().uuid("Compose ID required")
8416
8194
  }),
8417
8195
  responses: {
8418
8196
  200: scheduleResponseSchema,
@@ -8427,11 +8205,11 @@ var zeroSchedulesEnableContract = c31.router({
8427
8205
  method: "POST",
8428
8206
  path: "/api/zero/schedules/:name/disable",
8429
8207
  headers: authHeadersSchema,
8430
- pathParams: z34.object({
8431
- name: z34.string().min(1, "Schedule name required")
8208
+ pathParams: z35.object({
8209
+ name: z35.string().min(1, "Schedule name required")
8432
8210
  }),
8433
- body: z34.object({
8434
- composeId: z34.string().uuid("Compose ID required")
8211
+ body: z35.object({
8212
+ composeId: z35.string().uuid("Compose ID required")
8435
8213
  }),
8436
8214
  responses: {
8437
8215
  200: scheduleResponseSchema,
@@ -8445,9 +8223,9 @@ var zeroSchedulesEnableContract = c31.router({
8445
8223
  });
8446
8224
 
8447
8225
  // ../../packages/core/src/contracts/zero-model-providers.ts
8448
- import { z as z35 } from "zod";
8449
- var c32 = initContract();
8450
- var zeroModelProvidersMainContract = c32.router({
8226
+ import { z as z36 } from "zod";
8227
+ var c33 = initContract();
8228
+ var zeroModelProvidersMainContract = c33.router({
8451
8229
  list: {
8452
8230
  method: "GET",
8453
8231
  path: "/api/zero/model-providers",
@@ -8475,16 +8253,16 @@ var zeroModelProvidersMainContract = c32.router({
8475
8253
  summary: "Create or update an org-level model provider (admin only)"
8476
8254
  }
8477
8255
  });
8478
- var zeroModelProvidersByTypeContract = c32.router({
8256
+ var zeroModelProvidersByTypeContract = c33.router({
8479
8257
  delete: {
8480
8258
  method: "DELETE",
8481
8259
  path: "/api/zero/model-providers/:type",
8482
8260
  headers: authHeadersSchema,
8483
- pathParams: z35.object({
8261
+ pathParams: z36.object({
8484
8262
  type: modelProviderTypeSchema
8485
8263
  }),
8486
8264
  responses: {
8487
- 204: c32.noBody(),
8265
+ 204: c33.noBody(),
8488
8266
  401: apiErrorSchema,
8489
8267
  403: apiErrorSchema,
8490
8268
  404: apiErrorSchema,
@@ -8493,15 +8271,15 @@ var zeroModelProvidersByTypeContract = c32.router({
8493
8271
  summary: "Delete an org-level model provider (admin only)"
8494
8272
  }
8495
8273
  });
8496
- var zeroModelProvidersDefaultContract = c32.router({
8274
+ var zeroModelProvidersDefaultContract = c33.router({
8497
8275
  setDefault: {
8498
8276
  method: "POST",
8499
8277
  path: "/api/zero/model-providers/:type/default",
8500
8278
  headers: authHeadersSchema,
8501
- pathParams: z35.object({
8279
+ pathParams: z36.object({
8502
8280
  type: modelProviderTypeSchema
8503
8281
  }),
8504
- body: z35.undefined(),
8282
+ body: z36.undefined(),
8505
8283
  responses: {
8506
8284
  200: modelProviderResponseSchema,
8507
8285
  401: apiErrorSchema,
@@ -8514,8 +8292,8 @@ var zeroModelProvidersDefaultContract = c32.router({
8514
8292
  });
8515
8293
 
8516
8294
  // ../../packages/core/src/contracts/zero-user-preferences.ts
8517
- var c33 = initContract();
8518
- var zeroUserPreferencesContract = c33.router({
8295
+ var c34 = initContract();
8296
+ var zeroUserPreferencesContract = c34.router({
8519
8297
  get: {
8520
8298
  method: "GET",
8521
8299
  path: "/api/zero/user-preferences",
@@ -8543,8 +8321,8 @@ var zeroUserPreferencesContract = c33.router({
8543
8321
  });
8544
8322
 
8545
8323
  // ../../packages/core/src/contracts/zero-secrets.ts
8546
- var c34 = initContract();
8547
- var zeroSecretsContract = c34.router({
8324
+ var c35 = initContract();
8325
+ var zeroSecretsContract = c35.router({
8548
8326
  set: {
8549
8327
  method: "POST",
8550
8328
  path: "/api/zero/secrets",
@@ -8560,7 +8338,7 @@ var zeroSecretsContract = c34.router({
8560
8338
  summary: "Create or update a secret"
8561
8339
  }
8562
8340
  });
8563
- var zeroVariablesContract = c34.router({
8341
+ var zeroVariablesContract = c35.router({
8564
8342
  set: {
8565
8343
  method: "POST",
8566
8344
  path: "/api/zero/variables",
@@ -8578,15 +8356,15 @@ var zeroVariablesContract = c34.router({
8578
8356
  });
8579
8357
 
8580
8358
  // ../../packages/core/src/contracts/zero-sessions.ts
8581
- import { z as z36 } from "zod";
8582
- var c35 = initContract();
8583
- var zeroSessionsByIdContract = c35.router({
8359
+ import { z as z37 } from "zod";
8360
+ var c36 = initContract();
8361
+ var zeroSessionsByIdContract = c36.router({
8584
8362
  getById: {
8585
8363
  method: "GET",
8586
8364
  path: "/api/zero/sessions/:id",
8587
8365
  headers: authHeadersSchema,
8588
- pathParams: z36.object({
8589
- id: z36.string().min(1, "Session ID is required")
8366
+ pathParams: z37.object({
8367
+ id: z37.string().min(1, "Session ID is required")
8590
8368
  }),
8591
8369
  responses: {
8592
8370
  200: sessionResponseSchema,
@@ -8598,6 +8376,35 @@ var zeroSessionsByIdContract = c35.router({
8598
8376
  }
8599
8377
  });
8600
8378
 
8379
+ // ../../packages/core/src/contracts/integrations.ts
8380
+ import { z as z38 } from "zod";
8381
+ var c37 = initContract();
8382
+ var integrationsSlackMessageContract = c37.router({
8383
+ sendMessage: {
8384
+ method: "POST",
8385
+ path: "/api/agent/integrations/slack/message",
8386
+ headers: authHeadersSchema,
8387
+ body: z38.object({
8388
+ channel: z38.string().min(1, "Channel ID is required"),
8389
+ text: z38.string().optional(),
8390
+ threadTs: z38.string().optional(),
8391
+ blocks: z38.array(z38.object({ type: z38.string() }).passthrough()).optional()
8392
+ }),
8393
+ responses: {
8394
+ 200: z38.object({
8395
+ ok: z38.literal(true),
8396
+ ts: z38.string().optional(),
8397
+ channel: z38.string().optional()
8398
+ }),
8399
+ 400: apiErrorSchema,
8400
+ 401: apiErrorSchema,
8401
+ 403: apiErrorSchema,
8402
+ 404: apiErrorSchema
8403
+ },
8404
+ summary: "Send a Slack message via org bot token"
8405
+ }
8406
+ });
8407
+
8601
8408
  // ../../packages/core/src/storage-names.ts
8602
8409
  function getInstructionsStorageName(agentName) {
8603
8410
  return `agent-instructions@${agentName}`;
@@ -8857,46 +8664,422 @@ var FEATURE_SWITCHES = {
8857
8664
  enabled: false,
8858
8665
  enabledUserHashes: STAFF_USER_HASHES
8859
8666
  }
8860
- };
8861
- async function isFeatureEnabled(key, userId, email) {
8862
- const featureSwitch = FEATURE_SWITCHES[key];
8863
- if (featureSwitch.enabled) {
8864
- return true;
8667
+ };
8668
+ async function isFeatureEnabled(key, userId, email) {
8669
+ const featureSwitch = FEATURE_SWITCHES[key];
8670
+ if (featureSwitch.enabled) {
8671
+ return true;
8672
+ }
8673
+ if (userId && featureSwitch.enabledUserHashes?.length) {
8674
+ const hash = await sha1(userId);
8675
+ if (featureSwitch.enabledUserHashes.includes(hash)) return true;
8676
+ }
8677
+ if (email && featureSwitch.enabledEmailHashes?.length) {
8678
+ const hash = await sha1(email.toLowerCase());
8679
+ if (featureSwitch.enabledEmailHashes.includes(hash)) return true;
8680
+ }
8681
+ return false;
8682
+ }
8683
+
8684
+ // ../../packages/core/src/skill-frontmatter.ts
8685
+ import { parse as parseYaml2 } from "yaml";
8686
+ function parseSkillFrontmatter(content) {
8687
+ const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
8688
+ if (!frontmatterMatch) {
8689
+ return {};
8690
+ }
8691
+ const yamlContent = frontmatterMatch[1];
8692
+ if (!yamlContent) {
8693
+ return {};
8694
+ }
8695
+ const parsed = parseYaml2(yamlContent);
8696
+ if (!parsed || typeof parsed !== "object") {
8697
+ return {};
8698
+ }
8699
+ const data = parsed;
8700
+ return {
8701
+ name: typeof data.name === "string" ? data.name : void 0,
8702
+ description: typeof data.description === "string" ? data.description : void 0,
8703
+ vm0_secrets: Array.isArray(data.vm0_secrets) ? data.vm0_secrets.filter((s) => typeof s === "string") : void 0,
8704
+ vm0_vars: Array.isArray(data.vm0_vars) ? data.vm0_vars.filter((s) => typeof s === "string") : void 0
8705
+ };
8706
+ }
8707
+
8708
+ // src/lib/api/core/client-factory.ts
8709
+ import { tsRestFetchApi } from "@ts-rest/core";
8710
+ var ApiRequestError = class extends Error {
8711
+ constructor(message, code, status) {
8712
+ super(message);
8713
+ this.code = code;
8714
+ this.status = status;
8715
+ this.name = "ApiRequestError";
8716
+ }
8717
+ };
8718
+ async function getHeaders() {
8719
+ const token = await getActiveToken();
8720
+ if (!token) {
8721
+ throw new ApiRequestError("Not authenticated", "UNAUTHORIZED", 401);
8722
+ }
8723
+ const headers = {
8724
+ Authorization: `Bearer ${token}`
8725
+ };
8726
+ const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET;
8727
+ if (bypassSecret) {
8728
+ headers["x-vercel-protection-bypass"] = bypassSecret;
8729
+ }
8730
+ return headers;
8731
+ }
8732
+ async function getBaseUrl() {
8733
+ const apiUrl = await getApiUrl();
8734
+ if (!apiUrl) {
8735
+ throw new Error("API URL not configured");
8736
+ }
8737
+ return apiUrl;
8738
+ }
8739
+ async function getClientConfig() {
8740
+ const baseUrl = await getBaseUrl();
8741
+ const baseHeaders = await getHeaders();
8742
+ const activeOrg = await getActiveOrg();
8743
+ if (!activeOrg) {
8744
+ throw new Error(
8745
+ "No active organization configured. Run: vm0 org use <slug>"
8746
+ );
8747
+ }
8748
+ return {
8749
+ baseUrl,
8750
+ baseHeaders,
8751
+ jsonQuery: false,
8752
+ api: async (args) => {
8753
+ const separator = args.path.includes("?") ? "&" : "?";
8754
+ if (!args.path.includes("org=")) {
8755
+ args.path = `${args.path}${separator}org=${encodeURIComponent(activeOrg)}`;
8756
+ }
8757
+ return tsRestFetchApi(args);
8758
+ }
8759
+ };
8760
+ }
8761
+ function handleError(result, defaultMessage) {
8762
+ const errorBody = result.body;
8763
+ const message = errorBody.error?.message || defaultMessage;
8764
+ const code = errorBody.error?.code || "UNKNOWN";
8765
+ throw new ApiRequestError(message, code, result.status);
8766
+ }
8767
+
8768
+ // src/lib/command/with-error-handler.ts
8769
+ function withErrorHandler(fn) {
8770
+ return async (...args) => {
8771
+ try {
8772
+ await fn(...args);
8773
+ } catch (error) {
8774
+ if (error instanceof ApiRequestError) {
8775
+ if (error.code === "UNAUTHORIZED") {
8776
+ console.error(chalk2.red("\u2717 Not authenticated"));
8777
+ console.error(chalk2.dim(" Run: vm0 auth login"));
8778
+ } else {
8779
+ const guidance = RUN_ERROR_GUIDANCE[error.code];
8780
+ if (guidance) {
8781
+ console.error(chalk2.red(`\u2717 ${guidance.title}`));
8782
+ console.error(chalk2.dim(` ${guidance.guidance}`));
8783
+ if (guidance.cliHint) {
8784
+ console.error(chalk2.dim(` Run: ${guidance.cliHint}`));
8785
+ }
8786
+ } else {
8787
+ console.error(chalk2.red(`\u2717 ${error.status}: ${error.message}`));
8788
+ }
8789
+ }
8790
+ } else if (error instanceof Error) {
8791
+ console.error(chalk2.red(`\u2717 ${error.message}`));
8792
+ } else {
8793
+ console.error(chalk2.red("\u2717 An unexpected error occurred"));
8794
+ }
8795
+ if (error instanceof Error && error.cause instanceof Error) {
8796
+ console.error(chalk2.dim(` Cause: ${error.cause.message}`));
8797
+ }
8798
+ process.exit(1);
8799
+ }
8800
+ };
8801
+ }
8802
+
8803
+ // src/commands/auth/login.ts
8804
+ var loginCommand = new Command().name("login").description("Log in to VM0 (use VM0_API_URL env var to set API URL)").action(
8805
+ withErrorHandler(async () => {
8806
+ await authenticate();
8807
+ })
8808
+ );
8809
+
8810
+ // src/commands/auth/logout.ts
8811
+ import { Command as Command2 } from "commander";
8812
+ var logoutCommand = new Command2().name("logout").description("Log out of VM0").action(
8813
+ withErrorHandler(async () => {
8814
+ await logout();
8815
+ })
8816
+ );
8817
+
8818
+ // src/commands/auth/status.ts
8819
+ import { Command as Command3 } from "commander";
8820
+ var statusCommand = new Command3().name("status").description("Show current authentication status").action(
8821
+ withErrorHandler(async () => {
8822
+ await checkAuthStatus();
8823
+ })
8824
+ );
8825
+
8826
+ // src/commands/auth/setup-token.ts
8827
+ import { Command as Command4 } from "commander";
8828
+ var setupTokenCommand = new Command4().name("setup-token").description("Output auth token for CI/CD environments").action(
8829
+ withErrorHandler(async () => {
8830
+ await setupToken();
8831
+ })
8832
+ );
8833
+
8834
+ // src/commands/auth/index.ts
8835
+ var authCommand = new Command5().name("auth").description("Authenticate vm0").addCommand(loginCommand).addCommand(logoutCommand).addCommand(statusCommand).addCommand(setupTokenCommand);
8836
+
8837
+ // src/commands/info/index.ts
8838
+ import { Command as Command6 } from "commander";
8839
+ import chalk4 from "chalk";
8840
+ import { existsSync as existsSync2 } from "fs";
8841
+ import { homedir as homedir2, release as release2, type } from "os";
8842
+ import { join as join2 } from "path";
8843
+
8844
+ // src/lib/utils/update-checker.ts
8845
+ import chalk3 from "chalk";
8846
+
8847
+ // src/lib/utils/spawn.ts
8848
+ import { spawn } from "child_process";
8849
+ function safeSpawn(command, args, options) {
8850
+ const isWindows = process.platform === "win32";
8851
+ const resolvedCommand = isWindows ? `${command}.cmd` : command;
8852
+ return spawn(resolvedCommand, args, {
8853
+ ...options,
8854
+ shell: isWindows
8855
+ });
8856
+ }
8857
+
8858
+ // src/lib/utils/update-checker.ts
8859
+ var PACKAGE_NAME = "@vm0/cli";
8860
+ var NPM_REGISTRY_URL = `https://registry.npmjs.org/${encodeURIComponent(PACKAGE_NAME)}/latest`;
8861
+ var TIMEOUT_MS = 5e3;
8862
+ var pendingUpgrade = null;
8863
+ function detectPackageManager() {
8864
+ const execPath = process.argv[1] ?? "";
8865
+ if (execPath.includes("pnpm")) {
8866
+ return "pnpm";
8867
+ }
8868
+ if (execPath.includes("/.bun/") || execPath.includes("/bun/")) {
8869
+ return "bun";
8865
8870
  }
8866
- if (userId && featureSwitch.enabledUserHashes?.length) {
8867
- const hash = await sha1(userId);
8868
- if (featureSwitch.enabledUserHashes.includes(hash)) return true;
8871
+ if (execPath.includes("/.yarn/") || execPath.includes("/yarn/")) {
8872
+ return "yarn";
8869
8873
  }
8870
- if (email && featureSwitch.enabledEmailHashes?.length) {
8871
- const hash = await sha1(email.toLowerCase());
8872
- if (featureSwitch.enabledEmailHashes.includes(hash)) return true;
8874
+ if (execPath.includes("/usr/local/") || // Homebrew on Intel Mac
8875
+ execPath.includes("/opt/homebrew/") || // Homebrew on arm64 Mac
8876
+ execPath.includes("/.nvm/") || execPath.includes("/.fnm/") || execPath.includes("/.volta/") || execPath.includes("/.nodenv/") || execPath.includes("/.n/") || execPath.includes("/node_modules/") || execPath.includes("\\npm\\") || // Windows: AppData\Roaming\npm
8877
+ execPath.includes("\\nodejs\\")) {
8878
+ return "npm";
8873
8879
  }
8874
- return false;
8880
+ return "unknown";
8875
8881
  }
8876
-
8877
- // ../../packages/core/src/skill-frontmatter.ts
8878
- import { parse as parseYaml2 } from "yaml";
8879
- function parseSkillFrontmatter(content) {
8880
- const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
8881
- if (!frontmatterMatch) {
8882
- return {};
8882
+ function isAutoUpgradeSupported(pm) {
8883
+ return pm === "npm" || pm === "pnpm";
8884
+ }
8885
+ function getManualUpgradeCommand(pm) {
8886
+ switch (pm) {
8887
+ case "bun":
8888
+ return `bun add -g ${PACKAGE_NAME}@latest`;
8889
+ case "yarn":
8890
+ return `yarn global add ${PACKAGE_NAME}@latest`;
8891
+ case "pnpm":
8892
+ return `pnpm add -g ${PACKAGE_NAME}@latest`;
8893
+ case "npm":
8894
+ return `npm install -g ${PACKAGE_NAME}@latest`;
8895
+ case "unknown":
8896
+ return `npm install -g ${PACKAGE_NAME}@latest`;
8883
8897
  }
8884
- const yamlContent = frontmatterMatch[1];
8885
- if (!yamlContent) {
8886
- return {};
8898
+ }
8899
+ function escapeForShell(str) {
8900
+ return `'${str.replace(/'/g, "'\\''")}'`;
8901
+ }
8902
+ function buildRerunCommand(prompt) {
8903
+ if (prompt) {
8904
+ return `vm0 cook ${escapeForShell(prompt)}`;
8887
8905
  }
8888
- const parsed = parseYaml2(yamlContent);
8889
- if (!parsed || typeof parsed !== "object") {
8890
- return {};
8906
+ return "vm0 cook";
8907
+ }
8908
+ async function getLatestVersion() {
8909
+ try {
8910
+ const controller = new AbortController();
8911
+ const timeoutId = setTimeout(() => controller.abort(), TIMEOUT_MS);
8912
+ const response = await fetch(NPM_REGISTRY_URL, {
8913
+ signal: controller.signal
8914
+ });
8915
+ clearTimeout(timeoutId);
8916
+ if (!response.ok) {
8917
+ return null;
8918
+ }
8919
+ const json = await response.json();
8920
+ return json.version ?? null;
8921
+ } catch {
8922
+ return null;
8891
8923
  }
8892
- const data = parsed;
8893
- return {
8894
- name: typeof data.name === "string" ? data.name : void 0,
8895
- description: typeof data.description === "string" ? data.description : void 0,
8896
- vm0_secrets: Array.isArray(data.vm0_secrets) ? data.vm0_secrets.filter((s) => typeof s === "string") : void 0,
8897
- vm0_vars: Array.isArray(data.vm0_vars) ? data.vm0_vars.filter((s) => typeof s === "string") : void 0
8898
- };
8899
8924
  }
8925
+ function performUpgrade(packageManager) {
8926
+ return new Promise((resolve2) => {
8927
+ const args = packageManager === "pnpm" ? ["add", "-g", `${PACKAGE_NAME}@latest`] : ["install", "-g", `${PACKAGE_NAME}@latest`];
8928
+ const child = safeSpawn(packageManager, args, {
8929
+ stdio: "inherit"
8930
+ });
8931
+ child.on("close", (code) => {
8932
+ resolve2(code === 0);
8933
+ });
8934
+ child.on("error", () => {
8935
+ resolve2(false);
8936
+ });
8937
+ });
8938
+ }
8939
+ async function checkAndUpgrade(currentVersion, prompt) {
8940
+ const latestVersion = await getLatestVersion();
8941
+ if (latestVersion === null) {
8942
+ console.log(chalk3.yellow("\u26A0 Could not check for updates"));
8943
+ console.log();
8944
+ return false;
8945
+ }
8946
+ if (latestVersion === currentVersion) {
8947
+ return false;
8948
+ }
8949
+ console.log(chalk3.yellow("vm0 is currently in beta."));
8950
+ console.log(
8951
+ chalk3.yellow(
8952
+ `Current version: ${currentVersion} -> Latest version: ${latestVersion}`
8953
+ )
8954
+ );
8955
+ console.log(
8956
+ chalk3.yellow(
8957
+ "Please always use the latest version for best compatibility."
8958
+ )
8959
+ );
8960
+ console.log();
8961
+ const packageManager = detectPackageManager();
8962
+ if (!isAutoUpgradeSupported(packageManager)) {
8963
+ if (packageManager === "unknown") {
8964
+ console.log(
8965
+ chalk3.yellow("Could not detect your package manager for auto-upgrade.")
8966
+ );
8967
+ } else {
8968
+ console.log(
8969
+ chalk3.yellow(`Auto-upgrade is not supported for ${packageManager}.`)
8970
+ );
8971
+ }
8972
+ console.log(chalk3.yellow("Please upgrade manually:"));
8973
+ console.log(chalk3.cyan(` ${getManualUpgradeCommand(packageManager)}`));
8974
+ console.log();
8975
+ return false;
8976
+ }
8977
+ console.log(`Upgrading via ${packageManager}...`);
8978
+ const success = await performUpgrade(packageManager);
8979
+ if (success) {
8980
+ console.log(chalk3.green(`Upgraded to ${latestVersion}`));
8981
+ console.log();
8982
+ console.log("To continue, run:");
8983
+ console.log(chalk3.cyan(` ${buildRerunCommand(prompt)}`));
8984
+ return true;
8985
+ }
8986
+ console.error();
8987
+ console.error(chalk3.red("\u2717 Upgrade failed. Please run manually:"));
8988
+ console.error(chalk3.cyan(` ${getManualUpgradeCommand(packageManager)}`));
8989
+ console.error();
8990
+ console.error("Then re-run:");
8991
+ console.error(chalk3.cyan(` ${buildRerunCommand(prompt)}`));
8992
+ return true;
8993
+ }
8994
+ async function startSilentUpgrade(currentVersion) {
8995
+ pendingUpgrade = null;
8996
+ const latestVersion = await getLatestVersion();
8997
+ if (latestVersion === null || latestVersion === currentVersion) {
8998
+ return;
8999
+ }
9000
+ const packageManager = detectPackageManager();
9001
+ if (!isAutoUpgradeSupported(packageManager)) {
9002
+ return;
9003
+ }
9004
+ const isWindows = process.platform === "win32";
9005
+ const args = packageManager === "pnpm" ? ["add", "-g", `${PACKAGE_NAME}@latest`] : ["install", "-g", `${PACKAGE_NAME}@latest`];
9006
+ const child = safeSpawn(packageManager, args, {
9007
+ stdio: "pipe",
9008
+ detached: !isWindows,
9009
+ windowsHide: true
9010
+ });
9011
+ const promise = new Promise((resolve2) => {
9012
+ child.on("close", (code) => resolve2(code === 0));
9013
+ child.on("error", () => resolve2(false));
9014
+ });
9015
+ pendingUpgrade = { promise, child, packageManager };
9016
+ }
9017
+ async function waitForSilentUpgrade(timeout = TIMEOUT_MS) {
9018
+ if (!pendingUpgrade) {
9019
+ return;
9020
+ }
9021
+ const { promise, child, packageManager } = pendingUpgrade;
9022
+ pendingUpgrade = null;
9023
+ const result = await Promise.race([
9024
+ promise,
9025
+ new Promise((resolve2) => {
9026
+ setTimeout(() => {
9027
+ child.kill();
9028
+ resolve2(false);
9029
+ }, timeout);
9030
+ })
9031
+ ]);
9032
+ if (!result) {
9033
+ console.log(
9034
+ chalk3.yellow(
9035
+ `
9036
+ \u26A0 vm0 auto upgrade failed. Please run: ${getManualUpgradeCommand(packageManager)}`
9037
+ )
9038
+ );
9039
+ }
9040
+ }
9041
+
9042
+ // src/commands/info/index.ts
9043
+ function getConfigPath() {
9044
+ return join2(homedir2(), ".vm0", "config.json");
9045
+ }
9046
+ var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
9047
+ console.log(chalk4.bold(`VM0 CLI v${"9.74.0"}`));
9048
+ console.log();
9049
+ const config = await loadConfig();
9050
+ const hasEnvToken = !!process.env.VM0_TOKEN;
9051
+ const hasConfigToken = !!config.token;
9052
+ const isAuthenticated2 = hasEnvToken || hasConfigToken;
9053
+ console.log(chalk4.bold("Authentication:"));
9054
+ if (isAuthenticated2) {
9055
+ const tokenSource = hasEnvToken ? "VM0_TOKEN env var" : "config file";
9056
+ console.log(` ${chalk4.green("\u2713")} Logged in (via ${tokenSource})`);
9057
+ } else {
9058
+ console.log(` ${chalk4.red("\u2717")} Not authenticated`);
9059
+ }
9060
+ const configExists = existsSync2(getConfigPath());
9061
+ const configDisplay = configExists ? `~/.vm0/config.json` : `~/.vm0/config.json (not found)`;
9062
+ console.log(` Config: ${configDisplay}`);
9063
+ console.log();
9064
+ const apiUrl = await getApiUrl();
9065
+ console.log(chalk4.bold("API:"));
9066
+ console.log(` Host: ${apiUrl}`);
9067
+ console.log();
9068
+ console.log(chalk4.bold("System:"));
9069
+ console.log(` Node: ${process.version}`);
9070
+ console.log(` Platform: ${process.platform} (${process.arch})`);
9071
+ console.log(` OS: ${type()} ${release2()}`);
9072
+ console.log(` Shell: ${process.env.SHELL ?? "unknown"}`);
9073
+ console.log(` Package Manager: ${detectPackageManager()}`);
9074
+ });
9075
+
9076
+ // src/commands/compose/index.ts
9077
+ import { Command as Command7, Option } from "commander";
9078
+ import chalk6 from "chalk";
9079
+ import { readFile as readFile4, rm as rm3 } from "fs/promises";
9080
+ import { existsSync as existsSync5 } from "fs";
9081
+ import { dirname as dirname2, join as join8 } from "path";
9082
+ import { parse as parseYaml3 } from "yaml";
8900
9083
 
8901
9084
  // src/lib/api/core/http.ts
8902
9085
  async function appendOrgParam(path18) {
@@ -9295,7 +9478,7 @@ async function enableSchedule(params) {
9295
9478
  }
9296
9479
  async function disableSchedule(params) {
9297
9480
  const config = await getClientConfig();
9298
- const client = initClient6(schedulesEnableContract, config);
9481
+ const client = initClient6(schedulesDisableContract, config);
9299
9482
  const result = await client.disable({
9300
9483
  params: { name: params.name },
9301
9484
  body: { composeId: params.composeId }
@@ -9650,8 +9833,8 @@ async function resolveSkills(skillUrls) {
9650
9833
  }
9651
9834
 
9652
9835
  // src/lib/domain/yaml-validator.ts
9653
- import { z as z37 } from "zod";
9654
- var cliAgentNameSchema = z37.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
9836
+ import { z as z39 } from "zod";
9837
+ var cliAgentNameSchema = z39.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
9655
9838
  /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
9656
9839
  "Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
9657
9840
  );
@@ -9665,7 +9848,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
9665
9848
  resolveSkillRef(skillRef);
9666
9849
  } catch (error) {
9667
9850
  ctx.addIssue({
9668
- code: z37.ZodIssueCode.custom,
9851
+ code: z39.ZodIssueCode.custom,
9669
9852
  message: error instanceof Error ? error.message : `Invalid skill reference: ${skillRef}`,
9670
9853
  path: ["skills", i]
9671
9854
  });
@@ -9675,15 +9858,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
9675
9858
  }
9676
9859
  }
9677
9860
  );
9678
- var cliComposeSchema = z37.object({
9679
- version: z37.string().min(1, "Missing config.version"),
9680
- agents: z37.record(cliAgentNameSchema, cliAgentDefinitionSchema),
9681
- volumes: z37.record(z37.string(), volumeConfigSchema).optional()
9861
+ var cliComposeSchema = z39.object({
9862
+ version: z39.string().min(1, "Missing config.version"),
9863
+ agents: z39.record(cliAgentNameSchema, cliAgentDefinitionSchema),
9864
+ volumes: z39.record(z39.string(), volumeConfigSchema).optional()
9682
9865
  }).superRefine((config, ctx) => {
9683
9866
  const agentKeys = Object.keys(config.agents);
9684
9867
  if (agentKeys.length === 0) {
9685
9868
  ctx.addIssue({
9686
- code: z37.ZodIssueCode.custom,
9869
+ code: z39.ZodIssueCode.custom,
9687
9870
  message: "agents must have at least one agent defined",
9688
9871
  path: ["agents"]
9689
9872
  });
@@ -9691,7 +9874,7 @@ var cliComposeSchema = z37.object({
9691
9874
  }
9692
9875
  if (agentKeys.length > 1) {
9693
9876
  ctx.addIssue({
9694
- code: z37.ZodIssueCode.custom,
9877
+ code: z39.ZodIssueCode.custom,
9695
9878
  message: "Multiple agents not supported yet. Only one agent allowed.",
9696
9879
  path: ["agents"]
9697
9880
  });
@@ -9703,7 +9886,7 @@ var cliComposeSchema = z37.object({
9703
9886
  if (agentVolumes && agentVolumes.length > 0) {
9704
9887
  if (!config.volumes) {
9705
9888
  ctx.addIssue({
9706
- code: z37.ZodIssueCode.custom,
9889
+ code: z39.ZodIssueCode.custom,
9707
9890
  message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
9708
9891
  path: ["volumes"]
9709
9892
  });
@@ -9713,7 +9896,7 @@ var cliComposeSchema = z37.object({
9713
9896
  const parts = volDeclaration.split(":");
9714
9897
  if (parts.length !== 2) {
9715
9898
  ctx.addIssue({
9716
- code: z37.ZodIssueCode.custom,
9899
+ code: z39.ZodIssueCode.custom,
9717
9900
  message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
9718
9901
  path: ["agents", agentName, "volumes"]
9719
9902
  });
@@ -9722,7 +9905,7 @@ var cliComposeSchema = z37.object({
9722
9905
  const volumeKey = parts[0].trim();
9723
9906
  if (!config.volumes[volumeKey]) {
9724
9907
  ctx.addIssue({
9725
- code: z37.ZodIssueCode.custom,
9908
+ code: z39.ZodIssueCode.custom,
9726
9909
  message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
9727
9910
  path: ["volumes", volumeKey]
9728
9911
  });
@@ -10921,7 +11104,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
10921
11104
  options.autoUpdate = false;
10922
11105
  }
10923
11106
  if (options.autoUpdate !== false) {
10924
- await startSilentUpgrade("9.73.0");
11107
+ await startSilentUpgrade("9.74.0");
10925
11108
  }
10926
11109
  try {
10927
11110
  let result;
@@ -11677,6 +11860,10 @@ async function pollEvents(runId, options) {
11677
11860
  chalk9.dim(` (use "vm0 logs ${runId} --system" to view system logs)`)
11678
11861
  );
11679
11862
  result = { succeeded: false, runId };
11863
+ } else if (runStatus === "cancelled") {
11864
+ complete = true;
11865
+ console.error(chalk9.yellow("\n\u2717 Run cancelled"));
11866
+ result = { succeeded: false, runId };
11680
11867
  }
11681
11868
  if (!complete) {
11682
11869
  await new Promise((resolve2) => setTimeout(resolve2, pollIntervalMs));
@@ -11752,7 +11939,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
11752
11939
  withErrorHandler(
11753
11940
  async (identifier, prompt, options) => {
11754
11941
  if (options.autoUpdate !== false) {
11755
- await startSilentUpgrade("9.73.0");
11942
+ await startSilentUpgrade("9.74.0");
11756
11943
  }
11757
11944
  const { org, name, version } = parseIdentifier(identifier);
11758
11945
  let composeId;
@@ -13508,7 +13695,7 @@ var cookAction = new Command35().name("cook").description("Quick start: prepare,
13508
13695
  withErrorHandler(
13509
13696
  async (prompt, options) => {
13510
13697
  if (options.autoUpdate !== false) {
13511
- const shouldExit = await checkAndUpgrade("9.73.0", prompt);
13698
+ const shouldExit = await checkAndUpgrade("9.74.0", prompt);
13512
13699
  if (shouldExit) {
13513
13700
  process.exit(0);
13514
13701
  }
@@ -14179,7 +14366,7 @@ var ApiClient = class {
14179
14366
  async disableSchedule(params) {
14180
14367
  const baseUrl = await this.getBaseUrl();
14181
14368
  const headers = await this.getHeaders();
14182
- const client = initClient14(schedulesEnableContract, {
14369
+ const client = initClient14(schedulesDisableContract, {
14183
14370
  baseUrl,
14184
14371
  baseHeaders: headers,
14185
14372
  jsonQuery: false
@@ -15882,7 +16069,7 @@ var listCommand9 = new Command65().name("list").alias("ls").description("List al
15882
16069
  );
15883
16070
  return;
15884
16071
  }
15885
- const nameWidth = Math.max(4, ...data.composes.map((c36) => c36.name.length));
16072
+ const nameWidth = Math.max(4, ...data.composes.map((c38) => c38.name.length));
15886
16073
  const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
15887
16074
  " "
15888
16075
  );
@@ -16483,7 +16670,7 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
16483
16670
  if (!isInteractive()) {
16484
16671
  throw new Error("--frequency is required (daily|weekly|monthly|once|loop)");
16485
16672
  }
16486
- const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c36) => c36.value === existingFrequency) : 0;
16673
+ const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c38) => c38.value === existingFrequency) : 0;
16487
16674
  frequency = await promptSelect(
16488
16675
  "Schedule frequency",
16489
16676
  FREQUENCY_CHOICES,
@@ -16508,7 +16695,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
16508
16695
  throw new Error("--day is required for weekly/monthly");
16509
16696
  }
16510
16697
  if (frequency === "weekly") {
16511
- const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c36) => c36.value === existingDay) : 0;
16698
+ const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c38) => c38.value === existingDay) : 0;
16512
16699
  const day2 = await promptSelect(
16513
16700
  "Day of week",
16514
16701
  DAY_OF_WEEK_CHOICES,
@@ -17958,7 +18145,7 @@ import chalk76 from "chalk";
17958
18145
  var listCommand13 = new Command86().name("list").alias("ls").description("List all connectors and their status").action(
17959
18146
  withErrorHandler(async () => {
17960
18147
  const result = await listConnectors();
17961
- const connectedMap = new Map(result.connectors.map((c36) => [c36.type, c36]));
18148
+ const connectedMap = new Map(result.connectors.map((c38) => [c38.type, c38]));
17962
18149
  const allTypesRaw = Object.keys(CONNECTOR_TYPES);
17963
18150
  const allTypes = [];
17964
18151
  for (const type2 of allTypesRaw) {
@@ -18519,16 +18706,16 @@ async function handleModelProvider(ctx) {
18519
18706
  const providerType = await step.prompt(
18520
18707
  () => promptSelect(
18521
18708
  "Select provider type:",
18522
- choices.map((c36) => ({
18523
- title: c36.label,
18524
- value: c36.type
18709
+ choices.map((c38) => ({
18710
+ title: c38.label,
18711
+ value: c38.type
18525
18712
  }))
18526
18713
  )
18527
18714
  );
18528
18715
  if (!providerType) {
18529
18716
  process.exit(0);
18530
18717
  }
18531
- const selectedChoice = choices.find((c36) => c36.type === providerType);
18718
+ const selectedChoice = choices.find((c38) => c38.type === providerType);
18532
18719
  if (selectedChoice?.helpText) {
18533
18720
  for (const line of selectedChoice.helpText.split("\n")) {
18534
18721
  step.detail(chalk82.dim(line));
@@ -18882,13 +19069,13 @@ var upgradeCommand = new Command94().name("upgrade").description("Upgrade vm0 CL
18882
19069
  if (latestVersion === null) {
18883
19070
  throw new Error("Could not check for updates. Please try again later.");
18884
19071
  }
18885
- if (latestVersion === "9.73.0") {
18886
- console.log(chalk86.green(`\u2713 Already up to date (${"9.73.0"})`));
19072
+ if (latestVersion === "9.74.0") {
19073
+ console.log(chalk86.green(`\u2713 Already up to date (${"9.74.0"})`));
18887
19074
  return;
18888
19075
  }
18889
19076
  console.log(
18890
19077
  chalk86.yellow(
18891
- `Current version: ${"9.73.0"} -> Latest version: ${latestVersion}`
19078
+ `Current version: ${"9.74.0"} -> Latest version: ${latestVersion}`
18892
19079
  )
18893
19080
  );
18894
19081
  console.log();
@@ -18915,7 +19102,7 @@ var upgradeCommand = new Command94().name("upgrade").description("Upgrade vm0 CL
18915
19102
  const success = await performUpgrade(packageManager);
18916
19103
  if (success) {
18917
19104
  console.log(
18918
- chalk86.green(`\u2713 Upgraded from ${"9.73.0"} to ${latestVersion}`)
19105
+ chalk86.green(`\u2713 Upgraded from ${"9.74.0"} to ${latestVersion}`)
18919
19106
  );
18920
19107
  return;
18921
19108
  }
@@ -18989,7 +19176,7 @@ var whoamiCommand = new Command95().name("whoami").description("Show current ide
18989
19176
 
18990
19177
  // src/index.ts
18991
19178
  var program = new Command96();
18992
- program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.73.0");
19179
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.74.0");
18993
19180
  program.addCommand(authCommand);
18994
19181
  program.addCommand(infoCommand);
18995
19182
  program.addCommand(composeCommand);