@vm0/cli 5.7.2 → 5.9.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 +1033 -486
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import { Command as Command35 } from "commander";
5
- import chalk36 from "chalk";
4
+ import { Command as Command40 } from "commander";
5
+ import chalk40 from "chalk";
6
6
 
7
7
  // src/lib/api/auth.ts
8
8
  import chalk from "chalk";
@@ -192,7 +192,7 @@ import { parse as parseYaml2 } from "yaml";
192
192
  import prompts from "prompts";
193
193
 
194
194
  // ../../packages/core/src/variable-expander.ts
195
- var VARIABLE_PATTERN = /\$\{\{\s*(env|vars|secrets)\.([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g;
195
+ var VARIABLE_PATTERN = /\$\{\{\s*(env|vars|secrets|credentials)\.([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g;
196
196
  function extractVariableReferencesFromString(value) {
197
197
  const refs = [];
198
198
  const matches = value.matchAll(VARIABLE_PATTERN);
@@ -237,7 +237,8 @@ function groupVariablesBySource(refs) {
237
237
  const groups = {
238
238
  env: [],
239
239
  vars: [],
240
- secrets: []
240
+ secrets: [],
241
+ credentials: []
241
242
  };
242
243
  for (const ref of refs) {
243
244
  groups[ref.source].push(ref);
@@ -333,7 +334,9 @@ var storedExecutionContextSchema = z2.object({
333
334
  encryptedSecrets: z2.string().nullable(),
334
335
  // AES-256-GCM encrypted secrets
335
336
  cliAgentType: z2.string(),
336
- experimentalFirewall: experimentalFirewallSchema.optional()
337
+ experimentalFirewall: experimentalFirewallSchema.optional(),
338
+ // Debug flag to force real Claude in mock environments (internal use only)
339
+ debugNoMockClaude: z2.boolean().optional()
337
340
  });
338
341
  var executionContextSchema = z2.object({
339
342
  runId: z2.string().uuid(),
@@ -351,7 +354,9 @@ var executionContextSchema = z2.object({
351
354
  secretValues: z2.array(z2.string()).nullable(),
352
355
  cliAgentType: z2.string(),
353
356
  // Experimental firewall configuration
354
- experimentalFirewall: experimentalFirewallSchema.optional()
357
+ experimentalFirewall: experimentalFirewallSchema.optional(),
358
+ // Debug flag to force real Claude in mock environments (internal use only)
359
+ debugNoMockClaude: z2.boolean().optional()
355
360
  });
356
361
  var runnersJobClaimContract = c.router({
357
362
  claim: {
@@ -634,6 +639,8 @@ var unifiedRunRequestSchema = z4.object({
634
639
  vars: z4.record(z4.string(), z4.string()).optional(),
635
640
  secrets: z4.record(z4.string(), z4.string()).optional(),
636
641
  volumeVersions: z4.record(z4.string(), z4.string()).optional(),
642
+ // Debug flag to force real Claude in mock environments (internal use only)
643
+ debugNoMockClaude: z4.boolean().optional(),
637
644
  // Required
638
645
  prompt: z4.string().min(1, "Missing prompt")
639
646
  });
@@ -1640,43 +1647,137 @@ var scopeContract = c9.router({
1640
1647
  }
1641
1648
  });
1642
1649
 
1643
- // ../../packages/core/src/contracts/sessions.ts
1650
+ // ../../packages/core/src/contracts/credentials.ts
1644
1651
  import { z as z12 } from "zod";
1645
1652
  var c10 = initContract();
1646
- var sessionResponseSchema = z12.object({
1647
- id: z12.string(),
1648
- agentComposeId: z12.string(),
1649
- agentComposeVersionId: z12.string().nullable(),
1650
- conversationId: z12.string().nullable(),
1651
- artifactName: z12.string().nullable(),
1652
- vars: z12.record(z12.string(), z12.string()).nullable(),
1653
- secretNames: z12.array(z12.string()).nullable(),
1654
- volumeVersions: z12.record(z12.string(), z12.string()).nullable(),
1653
+ var credentialNameSchema = z12.string().min(1, "Credential name is required").max(255, "Credential name must be at most 255 characters").regex(
1654
+ /^[A-Z][A-Z0-9_]*$/,
1655
+ "Credential name must contain only uppercase letters, numbers, and underscores, and must start with a letter (e.g., MY_API_KEY)"
1656
+ );
1657
+ var credentialResponseSchema = z12.object({
1658
+ id: z12.string().uuid(),
1659
+ name: z12.string(),
1660
+ description: z12.string().nullable(),
1655
1661
  createdAt: z12.string(),
1656
1662
  updatedAt: z12.string()
1657
1663
  });
1658
- var agentComposeSnapshotSchema = z12.object({
1659
- agentComposeVersionId: z12.string(),
1660
- vars: z12.record(z12.string(), z12.string()).optional(),
1661
- secretNames: z12.array(z12.string()).optional()
1664
+ var credentialListResponseSchema = z12.object({
1665
+ credentials: z12.array(credentialResponseSchema)
1662
1666
  });
1663
- var artifactSnapshotSchema2 = z12.object({
1664
- artifactName: z12.string(),
1665
- artifactVersion: z12.string()
1667
+ var setCredentialRequestSchema = z12.object({
1668
+ name: credentialNameSchema,
1669
+ value: z12.string().min(1, "Credential value is required"),
1670
+ description: z12.string().max(1e3).optional()
1666
1671
  });
1667
- var volumeVersionsSnapshotSchema2 = z12.object({
1668
- versions: z12.record(z12.string(), z12.string())
1672
+ var credentialsMainContract = c10.router({
1673
+ /**
1674
+ * GET /api/credentials
1675
+ * List all credentials for the current user's scope (metadata only)
1676
+ */
1677
+ list: {
1678
+ method: "GET",
1679
+ path: "/api/credentials",
1680
+ responses: {
1681
+ 200: credentialListResponseSchema,
1682
+ 401: apiErrorSchema,
1683
+ 500: apiErrorSchema
1684
+ },
1685
+ summary: "List all credentials (metadata only)"
1686
+ },
1687
+ /**
1688
+ * PUT /api/credentials
1689
+ * Create or update a credential
1690
+ */
1691
+ set: {
1692
+ method: "PUT",
1693
+ path: "/api/credentials",
1694
+ body: setCredentialRequestSchema,
1695
+ responses: {
1696
+ 200: credentialResponseSchema,
1697
+ 201: credentialResponseSchema,
1698
+ 400: apiErrorSchema,
1699
+ 401: apiErrorSchema,
1700
+ 500: apiErrorSchema
1701
+ },
1702
+ summary: "Create or update a credential"
1703
+ }
1669
1704
  });
1670
- var checkpointResponseSchema = z12.object({
1671
- id: z12.string(),
1672
- runId: z12.string(),
1673
- conversationId: z12.string(),
1705
+ var credentialsByNameContract = c10.router({
1706
+ /**
1707
+ * GET /api/credentials/:name
1708
+ * Get a credential by name (metadata only)
1709
+ */
1710
+ get: {
1711
+ method: "GET",
1712
+ path: "/api/credentials/:name",
1713
+ pathParams: z12.object({
1714
+ name: credentialNameSchema
1715
+ }),
1716
+ responses: {
1717
+ 200: credentialResponseSchema,
1718
+ 401: apiErrorSchema,
1719
+ 404: apiErrorSchema,
1720
+ 500: apiErrorSchema
1721
+ },
1722
+ summary: "Get credential metadata by name"
1723
+ },
1724
+ /**
1725
+ * DELETE /api/credentials/:name
1726
+ * Delete a credential by name
1727
+ */
1728
+ delete: {
1729
+ method: "DELETE",
1730
+ path: "/api/credentials/:name",
1731
+ pathParams: z12.object({
1732
+ name: credentialNameSchema
1733
+ }),
1734
+ responses: {
1735
+ 204: z12.undefined(),
1736
+ 401: apiErrorSchema,
1737
+ 404: apiErrorSchema,
1738
+ 500: apiErrorSchema
1739
+ },
1740
+ summary: "Delete a credential"
1741
+ }
1742
+ });
1743
+
1744
+ // ../../packages/core/src/contracts/sessions.ts
1745
+ import { z as z13 } from "zod";
1746
+ var c11 = initContract();
1747
+ var sessionResponseSchema = z13.object({
1748
+ id: z13.string(),
1749
+ agentComposeId: z13.string(),
1750
+ agentComposeVersionId: z13.string().nullable(),
1751
+ conversationId: z13.string().nullable(),
1752
+ artifactName: z13.string().nullable(),
1753
+ vars: z13.record(z13.string(), z13.string()).nullable(),
1754
+ secretNames: z13.array(z13.string()).nullable(),
1755
+ volumeVersions: z13.record(z13.string(), z13.string()).nullable(),
1756
+ createdAt: z13.string(),
1757
+ updatedAt: z13.string()
1758
+ });
1759
+ var agentComposeSnapshotSchema = z13.object({
1760
+ agentComposeVersionId: z13.string(),
1761
+ vars: z13.record(z13.string(), z13.string()).optional(),
1762
+ secretNames: z13.array(z13.string()).optional()
1763
+ });
1764
+ var artifactSnapshotSchema2 = z13.object({
1765
+ artifactName: z13.string(),
1766
+ artifactVersion: z13.string()
1767
+ });
1768
+ var volumeVersionsSnapshotSchema2 = z13.object({
1769
+ versions: z13.record(z13.string(), z13.string())
1770
+ });
1771
+ var checkpointResponseSchema = z13.object({
1772
+ id: z13.string(),
1773
+ runId: z13.string(),
1774
+ conversationId: z13.string(),
1674
1775
  agentComposeSnapshot: agentComposeSnapshotSchema,
1675
1776
  artifactSnapshot: artifactSnapshotSchema2.nullable(),
1676
1777
  volumeVersionsSnapshot: volumeVersionsSnapshotSchema2.nullable(),
1677
- createdAt: z12.string()
1778
+ createdAt: z13.string()
1678
1779
  });
1679
- var sessionsByIdContract = c10.router({
1780
+ var sessionsByIdContract = c11.router({
1680
1781
  /**
1681
1782
  * GET /api/agent/sessions/:id
1682
1783
  * Get session by ID
@@ -1684,8 +1785,8 @@ var sessionsByIdContract = c10.router({
1684
1785
  getById: {
1685
1786
  method: "GET",
1686
1787
  path: "/api/agent/sessions/:id",
1687
- pathParams: z12.object({
1688
- id: z12.string().min(1, "Session ID is required")
1788
+ pathParams: z13.object({
1789
+ id: z13.string().min(1, "Session ID is required")
1689
1790
  }),
1690
1791
  responses: {
1691
1792
  200: sessionResponseSchema,
@@ -1696,7 +1797,7 @@ var sessionsByIdContract = c10.router({
1696
1797
  summary: "Get session by ID"
1697
1798
  }
1698
1799
  });
1699
- var checkpointsByIdContract = c10.router({
1800
+ var checkpointsByIdContract = c11.router({
1700
1801
  /**
1701
1802
  * GET /api/agent/checkpoints/:id
1702
1803
  * Get checkpoint by ID
@@ -1704,8 +1805,8 @@ var checkpointsByIdContract = c10.router({
1704
1805
  getById: {
1705
1806
  method: "GET",
1706
1807
  path: "/api/agent/checkpoints/:id",
1707
- pathParams: z12.object({
1708
- id: z12.string().min(1, "Checkpoint ID is required")
1808
+ pathParams: z13.object({
1809
+ id: z13.string().min(1, "Checkpoint ID is required")
1709
1810
  }),
1710
1811
  responses: {
1711
1812
  200: checkpointResponseSchema,
@@ -1718,91 +1819,91 @@ var checkpointsByIdContract = c10.router({
1718
1819
  });
1719
1820
 
1720
1821
  // ../../packages/core/src/contracts/schedules.ts
1721
- import { z as z13 } from "zod";
1722
- var c11 = initContract();
1723
- var scheduleTriggerSchema = z13.object({
1724
- cron: z13.string().optional(),
1725
- at: z13.string().optional(),
1726
- timezone: z13.string().default("UTC")
1822
+ import { z as z14 } from "zod";
1823
+ var c12 = initContract();
1824
+ var scheduleTriggerSchema = z14.object({
1825
+ cron: z14.string().optional(),
1826
+ at: z14.string().optional(),
1827
+ timezone: z14.string().default("UTC")
1727
1828
  }).refine((data) => data.cron && !data.at || !data.cron && data.at, {
1728
1829
  message: "Exactly one of 'cron' or 'at' must be specified"
1729
1830
  });
1730
- var scheduleRunConfigSchema = z13.object({
1731
- agent: z13.string().min(1, "Agent reference required"),
1732
- prompt: z13.string().min(1, "Prompt required"),
1733
- vars: z13.record(z13.string(), z13.string()).optional(),
1734
- secrets: z13.record(z13.string(), z13.string()).optional(),
1735
- artifactName: z13.string().optional(),
1736
- artifactVersion: z13.string().optional(),
1737
- volumeVersions: z13.record(z13.string(), z13.string()).optional()
1831
+ var scheduleRunConfigSchema = z14.object({
1832
+ agent: z14.string().min(1, "Agent reference required"),
1833
+ prompt: z14.string().min(1, "Prompt required"),
1834
+ vars: z14.record(z14.string(), z14.string()).optional(),
1835
+ secrets: z14.record(z14.string(), z14.string()).optional(),
1836
+ artifactName: z14.string().optional(),
1837
+ artifactVersion: z14.string().optional(),
1838
+ volumeVersions: z14.record(z14.string(), z14.string()).optional()
1738
1839
  });
1739
- var scheduleDefinitionSchema = z13.object({
1840
+ var scheduleDefinitionSchema = z14.object({
1740
1841
  on: scheduleTriggerSchema,
1741
1842
  run: scheduleRunConfigSchema
1742
1843
  });
1743
- var scheduleYamlSchema = z13.object({
1744
- version: z13.literal("1.0"),
1745
- schedules: z13.record(z13.string(), scheduleDefinitionSchema)
1746
- });
1747
- var deployScheduleRequestSchema = z13.object({
1748
- name: z13.string().min(1).max(64, "Schedule name max 64 chars"),
1749
- cronExpression: z13.string().optional(),
1750
- atTime: z13.string().optional(),
1751
- timezone: z13.string().default("UTC"),
1752
- prompt: z13.string().min(1, "Prompt required"),
1753
- vars: z13.record(z13.string(), z13.string()).optional(),
1754
- secrets: z13.record(z13.string(), z13.string()).optional(),
1755
- artifactName: z13.string().optional(),
1756
- artifactVersion: z13.string().optional(),
1757
- volumeVersions: z13.record(z13.string(), z13.string()).optional(),
1844
+ var scheduleYamlSchema = z14.object({
1845
+ version: z14.literal("1.0"),
1846
+ schedules: z14.record(z14.string(), scheduleDefinitionSchema)
1847
+ });
1848
+ var deployScheduleRequestSchema = z14.object({
1849
+ name: z14.string().min(1).max(64, "Schedule name max 64 chars"),
1850
+ cronExpression: z14.string().optional(),
1851
+ atTime: z14.string().optional(),
1852
+ timezone: z14.string().default("UTC"),
1853
+ prompt: z14.string().min(1, "Prompt required"),
1854
+ vars: z14.record(z14.string(), z14.string()).optional(),
1855
+ secrets: z14.record(z14.string(), z14.string()).optional(),
1856
+ artifactName: z14.string().optional(),
1857
+ artifactVersion: z14.string().optional(),
1858
+ volumeVersions: z14.record(z14.string(), z14.string()).optional(),
1758
1859
  // Resolved agent compose ID (CLI resolves scope/name:version → composeId)
1759
- composeId: z13.string().uuid("Invalid compose ID")
1860
+ composeId: z14.string().uuid("Invalid compose ID")
1760
1861
  }).refine(
1761
1862
  (data) => data.cronExpression && !data.atTime || !data.cronExpression && data.atTime,
1762
1863
  {
1763
1864
  message: "Exactly one of 'cronExpression' or 'atTime' must be specified"
1764
1865
  }
1765
1866
  );
1766
- var scheduleResponseSchema = z13.object({
1767
- id: z13.string().uuid(),
1768
- composeId: z13.string().uuid(),
1769
- composeName: z13.string(),
1770
- scopeSlug: z13.string(),
1771
- name: z13.string(),
1772
- cronExpression: z13.string().nullable(),
1773
- atTime: z13.string().nullable(),
1774
- timezone: z13.string(),
1775
- prompt: z13.string(),
1776
- vars: z13.record(z13.string(), z13.string()).nullable(),
1867
+ var scheduleResponseSchema = z14.object({
1868
+ id: z14.string().uuid(),
1869
+ composeId: z14.string().uuid(),
1870
+ composeName: z14.string(),
1871
+ scopeSlug: z14.string(),
1872
+ name: z14.string(),
1873
+ cronExpression: z14.string().nullable(),
1874
+ atTime: z14.string().nullable(),
1875
+ timezone: z14.string(),
1876
+ prompt: z14.string(),
1877
+ vars: z14.record(z14.string(), z14.string()).nullable(),
1777
1878
  // Secret names only (values are never returned)
1778
- secretNames: z13.array(z13.string()).nullable(),
1779
- artifactName: z13.string().nullable(),
1780
- artifactVersion: z13.string().nullable(),
1781
- volumeVersions: z13.record(z13.string(), z13.string()).nullable(),
1782
- enabled: z13.boolean(),
1783
- nextRunAt: z13.string().nullable(),
1784
- createdAt: z13.string(),
1785
- updatedAt: z13.string()
1786
- });
1787
- var runSummarySchema = z13.object({
1788
- id: z13.string().uuid(),
1789
- status: z13.enum(["pending", "running", "completed", "failed", "timeout"]),
1790
- createdAt: z13.string(),
1791
- completedAt: z13.string().nullable(),
1792
- error: z13.string().nullable()
1793
- });
1794
- var scheduleRunsResponseSchema = z13.object({
1795
- runs: z13.array(runSummarySchema)
1796
- });
1797
- var scheduleListResponseSchema = z13.object({
1798
- schedules: z13.array(scheduleResponseSchema)
1799
- });
1800
- var deployScheduleResponseSchema = z13.object({
1879
+ secretNames: z14.array(z14.string()).nullable(),
1880
+ artifactName: z14.string().nullable(),
1881
+ artifactVersion: z14.string().nullable(),
1882
+ volumeVersions: z14.record(z14.string(), z14.string()).nullable(),
1883
+ enabled: z14.boolean(),
1884
+ nextRunAt: z14.string().nullable(),
1885
+ createdAt: z14.string(),
1886
+ updatedAt: z14.string()
1887
+ });
1888
+ var runSummarySchema = z14.object({
1889
+ id: z14.string().uuid(),
1890
+ status: z14.enum(["pending", "running", "completed", "failed", "timeout"]),
1891
+ createdAt: z14.string(),
1892
+ completedAt: z14.string().nullable(),
1893
+ error: z14.string().nullable()
1894
+ });
1895
+ var scheduleRunsResponseSchema = z14.object({
1896
+ runs: z14.array(runSummarySchema)
1897
+ });
1898
+ var scheduleListResponseSchema = z14.object({
1899
+ schedules: z14.array(scheduleResponseSchema)
1900
+ });
1901
+ var deployScheduleResponseSchema = z14.object({
1801
1902
  schedule: scheduleResponseSchema,
1802
- created: z13.boolean()
1903
+ created: z14.boolean()
1803
1904
  // true if created, false if updated
1804
1905
  });
1805
- var schedulesMainContract = c11.router({
1906
+ var schedulesMainContract = c12.router({
1806
1907
  /**
1807
1908
  * POST /api/agent/schedules
1808
1909
  * Deploy (create or update) a schedule
@@ -1838,7 +1939,7 @@ var schedulesMainContract = c11.router({
1838
1939
  summary: "List all schedules"
1839
1940
  }
1840
1941
  });
1841
- var schedulesByNameContract = c11.router({
1942
+ var schedulesByNameContract = c12.router({
1842
1943
  /**
1843
1944
  * GET /api/agent/schedules/:name
1844
1945
  * Get schedule by name
@@ -1846,11 +1947,11 @@ var schedulesByNameContract = c11.router({
1846
1947
  getByName: {
1847
1948
  method: "GET",
1848
1949
  path: "/api/agent/schedules/:name",
1849
- pathParams: z13.object({
1850
- name: z13.string().min(1, "Schedule name required")
1950
+ pathParams: z14.object({
1951
+ name: z14.string().min(1, "Schedule name required")
1851
1952
  }),
1852
- query: z13.object({
1853
- composeId: z13.string().uuid("Compose ID required")
1953
+ query: z14.object({
1954
+ composeId: z14.string().uuid("Compose ID required")
1854
1955
  }),
1855
1956
  responses: {
1856
1957
  200: scheduleResponseSchema,
@@ -1866,21 +1967,21 @@ var schedulesByNameContract = c11.router({
1866
1967
  delete: {
1867
1968
  method: "DELETE",
1868
1969
  path: "/api/agent/schedules/:name",
1869
- pathParams: z13.object({
1870
- name: z13.string().min(1, "Schedule name required")
1970
+ pathParams: z14.object({
1971
+ name: z14.string().min(1, "Schedule name required")
1871
1972
  }),
1872
- query: z13.object({
1873
- composeId: z13.string().uuid("Compose ID required")
1973
+ query: z14.object({
1974
+ composeId: z14.string().uuid("Compose ID required")
1874
1975
  }),
1875
1976
  responses: {
1876
- 204: z13.undefined(),
1977
+ 204: z14.undefined(),
1877
1978
  401: apiErrorSchema,
1878
1979
  404: apiErrorSchema
1879
1980
  },
1880
1981
  summary: "Delete schedule"
1881
1982
  }
1882
1983
  });
1883
- var schedulesEnableContract = c11.router({
1984
+ var schedulesEnableContract = c12.router({
1884
1985
  /**
1885
1986
  * POST /api/agent/schedules/:name/enable
1886
1987
  * Enable a disabled schedule
@@ -1888,11 +1989,11 @@ var schedulesEnableContract = c11.router({
1888
1989
  enable: {
1889
1990
  method: "POST",
1890
1991
  path: "/api/agent/schedules/:name/enable",
1891
- pathParams: z13.object({
1892
- name: z13.string().min(1, "Schedule name required")
1992
+ pathParams: z14.object({
1993
+ name: z14.string().min(1, "Schedule name required")
1893
1994
  }),
1894
- body: z13.object({
1895
- composeId: z13.string().uuid("Compose ID required")
1995
+ body: z14.object({
1996
+ composeId: z14.string().uuid("Compose ID required")
1896
1997
  }),
1897
1998
  responses: {
1898
1999
  200: scheduleResponseSchema,
@@ -1908,11 +2009,11 @@ var schedulesEnableContract = c11.router({
1908
2009
  disable: {
1909
2010
  method: "POST",
1910
2011
  path: "/api/agent/schedules/:name/disable",
1911
- pathParams: z13.object({
1912
- name: z13.string().min(1, "Schedule name required")
2012
+ pathParams: z14.object({
2013
+ name: z14.string().min(1, "Schedule name required")
1913
2014
  }),
1914
- body: z13.object({
1915
- composeId: z13.string().uuid("Compose ID required")
2015
+ body: z14.object({
2016
+ composeId: z14.string().uuid("Compose ID required")
1916
2017
  }),
1917
2018
  responses: {
1918
2019
  200: scheduleResponseSchema,
@@ -1922,7 +2023,7 @@ var schedulesEnableContract = c11.router({
1922
2023
  summary: "Disable schedule"
1923
2024
  }
1924
2025
  });
1925
- var scheduleRunsContract = c11.router({
2026
+ var scheduleRunsContract = c12.router({
1926
2027
  /**
1927
2028
  * GET /api/agent/schedules/:name/runs
1928
2029
  * List recent runs for a schedule
@@ -1930,12 +2031,12 @@ var scheduleRunsContract = c11.router({
1930
2031
  listRuns: {
1931
2032
  method: "GET",
1932
2033
  path: "/api/agent/schedules/:name/runs",
1933
- pathParams: z13.object({
1934
- name: z13.string().min(1, "Schedule name required")
2034
+ pathParams: z14.object({
2035
+ name: z14.string().min(1, "Schedule name required")
1935
2036
  }),
1936
- query: z13.object({
1937
- composeId: z13.string().uuid("Compose ID required"),
1938
- limit: z13.coerce.number().min(0).max(100).default(5)
2037
+ query: z14.object({
2038
+ composeId: z14.string().uuid("Compose ID required"),
2039
+ limit: z14.coerce.number().min(0).max(100).default(5)
1939
2040
  }),
1940
2041
  responses: {
1941
2042
  200: scheduleRunsResponseSchema,
@@ -1947,8 +2048,8 @@ var scheduleRunsContract = c11.router({
1947
2048
  });
1948
2049
 
1949
2050
  // ../../packages/core/src/contracts/public/common.ts
1950
- import { z as z14 } from "zod";
1951
- var publicApiErrorTypeSchema = z14.enum([
2051
+ import { z as z15 } from "zod";
2052
+ var publicApiErrorTypeSchema = z15.enum([
1952
2053
  "api_error",
1953
2054
  // Internal server error (5xx)
1954
2055
  "invalid_request_error",
@@ -1960,55 +2061,55 @@ var publicApiErrorTypeSchema = z14.enum([
1960
2061
  "conflict_error"
1961
2062
  // Resource conflict (409)
1962
2063
  ]);
1963
- var publicApiErrorSchema = z14.object({
1964
- error: z14.object({
2064
+ var publicApiErrorSchema = z15.object({
2065
+ error: z15.object({
1965
2066
  type: publicApiErrorTypeSchema,
1966
- code: z14.string(),
1967
- message: z14.string(),
1968
- param: z14.string().optional(),
1969
- doc_url: z14.string().url().optional()
2067
+ code: z15.string(),
2068
+ message: z15.string(),
2069
+ param: z15.string().optional(),
2070
+ doc_url: z15.string().url().optional()
1970
2071
  })
1971
2072
  });
1972
- var paginationSchema = z14.object({
1973
- has_more: z14.boolean(),
1974
- next_cursor: z14.string().nullable()
2073
+ var paginationSchema = z15.object({
2074
+ has_more: z15.boolean(),
2075
+ next_cursor: z15.string().nullable()
1975
2076
  });
1976
2077
  function createPaginatedResponseSchema(dataSchema) {
1977
- return z14.object({
1978
- data: z14.array(dataSchema),
2078
+ return z15.object({
2079
+ data: z15.array(dataSchema),
1979
2080
  pagination: paginationSchema
1980
2081
  });
1981
2082
  }
1982
- var listQuerySchema = z14.object({
1983
- cursor: z14.string().optional(),
1984
- limit: z14.coerce.number().min(1).max(100).default(20)
2083
+ var listQuerySchema = z15.object({
2084
+ cursor: z15.string().optional(),
2085
+ limit: z15.coerce.number().min(1).max(100).default(20)
1985
2086
  });
1986
- var requestIdSchema = z14.string().uuid();
1987
- var timestampSchema = z14.string().datetime();
2087
+ var requestIdSchema = z15.string().uuid();
2088
+ var timestampSchema = z15.string().datetime();
1988
2089
 
1989
2090
  // ../../packages/core/src/contracts/public/agents.ts
1990
- import { z as z15 } from "zod";
1991
- var c12 = initContract();
1992
- var publicAgentSchema = z15.object({
1993
- id: z15.string(),
1994
- name: z15.string(),
1995
- current_version_id: z15.string().nullable(),
2091
+ import { z as z16 } from "zod";
2092
+ var c13 = initContract();
2093
+ var publicAgentSchema = z16.object({
2094
+ id: z16.string(),
2095
+ name: z16.string(),
2096
+ current_version_id: z16.string().nullable(),
1996
2097
  created_at: timestampSchema,
1997
2098
  updated_at: timestampSchema
1998
2099
  });
1999
- var agentVersionSchema = z15.object({
2000
- id: z15.string(),
2001
- agent_id: z15.string(),
2002
- version_number: z15.number(),
2100
+ var agentVersionSchema = z16.object({
2101
+ id: z16.string(),
2102
+ agent_id: z16.string(),
2103
+ version_number: z16.number(),
2003
2104
  created_at: timestampSchema
2004
2105
  });
2005
2106
  var publicAgentDetailSchema = publicAgentSchema;
2006
2107
  var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
2007
2108
  var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
2008
2109
  var agentListQuerySchema = listQuerySchema.extend({
2009
- name: z15.string().optional()
2110
+ name: z16.string().optional()
2010
2111
  });
2011
- var publicAgentsListContract = c12.router({
2112
+ var publicAgentsListContract = c13.router({
2012
2113
  list: {
2013
2114
  method: "GET",
2014
2115
  path: "/v1/agents",
@@ -2022,12 +2123,12 @@ var publicAgentsListContract = c12.router({
2022
2123
  description: "List all agents in the current scope with pagination. Use the `name` query parameter to filter by agent name."
2023
2124
  }
2024
2125
  });
2025
- var publicAgentByIdContract = c12.router({
2126
+ var publicAgentByIdContract = c13.router({
2026
2127
  get: {
2027
2128
  method: "GET",
2028
2129
  path: "/v1/agents/:id",
2029
- pathParams: z15.object({
2030
- id: z15.string().min(1, "Agent ID is required")
2130
+ pathParams: z16.object({
2131
+ id: z16.string().min(1, "Agent ID is required")
2031
2132
  }),
2032
2133
  responses: {
2033
2134
  200: publicAgentDetailSchema,
@@ -2039,12 +2140,12 @@ var publicAgentByIdContract = c12.router({
2039
2140
  description: "Get agent details by ID"
2040
2141
  }
2041
2142
  });
2042
- var publicAgentVersionsContract = c12.router({
2143
+ var publicAgentVersionsContract = c13.router({
2043
2144
  list: {
2044
2145
  method: "GET",
2045
2146
  path: "/v1/agents/:id/versions",
2046
- pathParams: z15.object({
2047
- id: z15.string().min(1, "Agent ID is required")
2147
+ pathParams: z16.object({
2148
+ id: z16.string().min(1, "Agent ID is required")
2048
2149
  }),
2049
2150
  query: listQuerySchema,
2050
2151
  responses: {
@@ -2059,9 +2160,9 @@ var publicAgentVersionsContract = c12.router({
2059
2160
  });
2060
2161
 
2061
2162
  // ../../packages/core/src/contracts/public/runs.ts
2062
- import { z as z16 } from "zod";
2063
- var c13 = initContract();
2064
- var publicRunStatusSchema = z16.enum([
2163
+ import { z as z17 } from "zod";
2164
+ var c14 = initContract();
2165
+ var publicRunStatusSchema = z17.enum([
2065
2166
  "pending",
2066
2167
  "running",
2067
2168
  "completed",
@@ -2069,56 +2170,56 @@ var publicRunStatusSchema = z16.enum([
2069
2170
  "timeout",
2070
2171
  "cancelled"
2071
2172
  ]);
2072
- var publicRunSchema = z16.object({
2073
- id: z16.string(),
2074
- agent_id: z16.string(),
2075
- agent_name: z16.string(),
2173
+ var publicRunSchema = z17.object({
2174
+ id: z17.string(),
2175
+ agent_id: z17.string(),
2176
+ agent_name: z17.string(),
2076
2177
  status: publicRunStatusSchema,
2077
- prompt: z16.string(),
2178
+ prompt: z17.string(),
2078
2179
  created_at: timestampSchema,
2079
2180
  started_at: timestampSchema.nullable(),
2080
2181
  completed_at: timestampSchema.nullable()
2081
2182
  });
2082
2183
  var publicRunDetailSchema = publicRunSchema.extend({
2083
- error: z16.string().nullable(),
2084
- execution_time_ms: z16.number().nullable(),
2085
- checkpoint_id: z16.string().nullable(),
2086
- session_id: z16.string().nullable(),
2087
- artifact_name: z16.string().nullable(),
2088
- artifact_version: z16.string().nullable(),
2089
- volumes: z16.record(z16.string(), z16.string()).optional()
2184
+ error: z17.string().nullable(),
2185
+ execution_time_ms: z17.number().nullable(),
2186
+ checkpoint_id: z17.string().nullable(),
2187
+ session_id: z17.string().nullable(),
2188
+ artifact_name: z17.string().nullable(),
2189
+ artifact_version: z17.string().nullable(),
2190
+ volumes: z17.record(z17.string(), z17.string()).optional()
2090
2191
  });
2091
2192
  var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
2092
- var createRunRequestSchema = z16.object({
2193
+ var createRunRequestSchema = z17.object({
2093
2194
  // Agent identification (one of: agent, agent_id, session_id, checkpoint_id)
2094
- agent: z16.string().optional(),
2195
+ agent: z17.string().optional(),
2095
2196
  // Agent name
2096
- agent_id: z16.string().optional(),
2197
+ agent_id: z17.string().optional(),
2097
2198
  // Agent ID
2098
- agent_version: z16.string().optional(),
2199
+ agent_version: z17.string().optional(),
2099
2200
  // Version specifier (e.g., "latest", "v1", specific ID)
2100
2201
  // Continue session
2101
- session_id: z16.string().optional(),
2202
+ session_id: z17.string().optional(),
2102
2203
  // Resume from checkpoint
2103
- checkpoint_id: z16.string().optional(),
2204
+ checkpoint_id: z17.string().optional(),
2104
2205
  // Required
2105
- prompt: z16.string().min(1, "Prompt is required"),
2206
+ prompt: z17.string().min(1, "Prompt is required"),
2106
2207
  // Optional configuration
2107
- variables: z16.record(z16.string(), z16.string()).optional(),
2108
- secrets: z16.record(z16.string(), z16.string()).optional(),
2109
- artifact_name: z16.string().optional(),
2208
+ variables: z17.record(z17.string(), z17.string()).optional(),
2209
+ secrets: z17.record(z17.string(), z17.string()).optional(),
2210
+ artifact_name: z17.string().optional(),
2110
2211
  // Artifact name to mount
2111
- artifact_version: z16.string().optional(),
2212
+ artifact_version: z17.string().optional(),
2112
2213
  // Artifact version (defaults to latest)
2113
- volumes: z16.record(z16.string(), z16.string()).optional()
2214
+ volumes: z17.record(z17.string(), z17.string()).optional()
2114
2215
  // volume_name -> version
2115
2216
  });
2116
2217
  var runListQuerySchema = listQuerySchema.extend({
2117
- agent_id: z16.string().optional(),
2218
+ agent_id: z17.string().optional(),
2118
2219
  status: publicRunStatusSchema.optional(),
2119
2220
  since: timestampSchema.optional()
2120
2221
  });
2121
- var publicRunsListContract = c13.router({
2222
+ var publicRunsListContract = c14.router({
2122
2223
  list: {
2123
2224
  method: "GET",
2124
2225
  path: "/v1/runs",
@@ -2147,12 +2248,12 @@ var publicRunsListContract = c13.router({
2147
2248
  description: "Create and execute a new agent run. Returns 202 Accepted as runs execute asynchronously."
2148
2249
  }
2149
2250
  });
2150
- var publicRunByIdContract = c13.router({
2251
+ var publicRunByIdContract = c14.router({
2151
2252
  get: {
2152
2253
  method: "GET",
2153
2254
  path: "/v1/runs/:id",
2154
- pathParams: z16.object({
2155
- id: z16.string().min(1, "Run ID is required")
2255
+ pathParams: z17.object({
2256
+ id: z17.string().min(1, "Run ID is required")
2156
2257
  }),
2157
2258
  responses: {
2158
2259
  200: publicRunDetailSchema,
@@ -2164,14 +2265,14 @@ var publicRunByIdContract = c13.router({
2164
2265
  description: "Get run details by ID"
2165
2266
  }
2166
2267
  });
2167
- var publicRunCancelContract = c13.router({
2268
+ var publicRunCancelContract = c14.router({
2168
2269
  cancel: {
2169
2270
  method: "POST",
2170
2271
  path: "/v1/runs/:id/cancel",
2171
- pathParams: z16.object({
2172
- id: z16.string().min(1, "Run ID is required")
2272
+ pathParams: z17.object({
2273
+ id: z17.string().min(1, "Run ID is required")
2173
2274
  }),
2174
- body: z16.undefined(),
2275
+ body: z17.undefined(),
2175
2276
  responses: {
2176
2277
  200: publicRunDetailSchema,
2177
2278
  400: publicApiErrorSchema,
@@ -2184,26 +2285,26 @@ var publicRunCancelContract = c13.router({
2184
2285
  description: "Cancel a pending or running execution"
2185
2286
  }
2186
2287
  });
2187
- var logEntrySchema = z16.object({
2288
+ var logEntrySchema = z17.object({
2188
2289
  timestamp: timestampSchema,
2189
- type: z16.enum(["agent", "system", "network"]),
2190
- level: z16.enum(["debug", "info", "warn", "error"]),
2191
- message: z16.string(),
2192
- metadata: z16.record(z16.string(), z16.unknown()).optional()
2290
+ type: z17.enum(["agent", "system", "network"]),
2291
+ level: z17.enum(["debug", "info", "warn", "error"]),
2292
+ message: z17.string(),
2293
+ metadata: z17.record(z17.string(), z17.unknown()).optional()
2193
2294
  });
2194
2295
  var paginatedLogsSchema = createPaginatedResponseSchema(logEntrySchema);
2195
2296
  var logsQuerySchema = listQuerySchema.extend({
2196
- type: z16.enum(["agent", "system", "network", "all"]).default("all"),
2297
+ type: z17.enum(["agent", "system", "network", "all"]).default("all"),
2197
2298
  since: timestampSchema.optional(),
2198
2299
  until: timestampSchema.optional(),
2199
- order: z16.enum(["asc", "desc"]).default("asc")
2300
+ order: z17.enum(["asc", "desc"]).default("asc")
2200
2301
  });
2201
- var publicRunLogsContract = c13.router({
2302
+ var publicRunLogsContract = c14.router({
2202
2303
  getLogs: {
2203
2304
  method: "GET",
2204
2305
  path: "/v1/runs/:id/logs",
2205
- pathParams: z16.object({
2206
- id: z16.string().min(1, "Run ID is required")
2306
+ pathParams: z17.object({
2307
+ id: z17.string().min(1, "Run ID is required")
2207
2308
  }),
2208
2309
  query: logsQuerySchema,
2209
2310
  responses: {
@@ -2216,29 +2317,29 @@ var publicRunLogsContract = c13.router({
2216
2317
  description: "Get unified logs for a run. Combines agent, system, and network logs."
2217
2318
  }
2218
2319
  });
2219
- var metricPointSchema = z16.object({
2320
+ var metricPointSchema = z17.object({
2220
2321
  timestamp: timestampSchema,
2221
- cpu_percent: z16.number(),
2222
- memory_used_mb: z16.number(),
2223
- memory_total_mb: z16.number(),
2224
- disk_used_mb: z16.number(),
2225
- disk_total_mb: z16.number()
2226
- });
2227
- var metricsSummarySchema = z16.object({
2228
- avg_cpu_percent: z16.number(),
2229
- max_memory_used_mb: z16.number(),
2230
- total_duration_ms: z16.number().nullable()
2231
- });
2232
- var metricsResponseSchema2 = z16.object({
2233
- data: z16.array(metricPointSchema),
2322
+ cpu_percent: z17.number(),
2323
+ memory_used_mb: z17.number(),
2324
+ memory_total_mb: z17.number(),
2325
+ disk_used_mb: z17.number(),
2326
+ disk_total_mb: z17.number()
2327
+ });
2328
+ var metricsSummarySchema = z17.object({
2329
+ avg_cpu_percent: z17.number(),
2330
+ max_memory_used_mb: z17.number(),
2331
+ total_duration_ms: z17.number().nullable()
2332
+ });
2333
+ var metricsResponseSchema2 = z17.object({
2334
+ data: z17.array(metricPointSchema),
2234
2335
  summary: metricsSummarySchema
2235
2336
  });
2236
- var publicRunMetricsContract = c13.router({
2337
+ var publicRunMetricsContract = c14.router({
2237
2338
  getMetrics: {
2238
2339
  method: "GET",
2239
2340
  path: "/v1/runs/:id/metrics",
2240
- pathParams: z16.object({
2241
- id: z16.string().min(1, "Run ID is required")
2341
+ pathParams: z17.object({
2342
+ id: z17.string().min(1, "Run ID is required")
2242
2343
  }),
2243
2344
  responses: {
2244
2345
  200: metricsResponseSchema2,
@@ -2250,7 +2351,7 @@ var publicRunMetricsContract = c13.router({
2250
2351
  description: "Get CPU, memory, and disk metrics for a run"
2251
2352
  }
2252
2353
  });
2253
- var sseEventTypeSchema = z16.enum([
2354
+ var sseEventTypeSchema = z17.enum([
2254
2355
  "status",
2255
2356
  // Run status change
2256
2357
  "output",
@@ -2262,25 +2363,25 @@ var sseEventTypeSchema = z16.enum([
2262
2363
  "heartbeat"
2263
2364
  // Keep-alive
2264
2365
  ]);
2265
- var sseEventSchema = z16.object({
2366
+ var sseEventSchema = z17.object({
2266
2367
  event: sseEventTypeSchema,
2267
- data: z16.unknown(),
2268
- id: z16.string().optional()
2368
+ data: z17.unknown(),
2369
+ id: z17.string().optional()
2269
2370
  // For Last-Event-ID reconnection
2270
2371
  });
2271
- var publicRunEventsContract = c13.router({
2372
+ var publicRunEventsContract = c14.router({
2272
2373
  streamEvents: {
2273
2374
  method: "GET",
2274
2375
  path: "/v1/runs/:id/events",
2275
- pathParams: z16.object({
2276
- id: z16.string().min(1, "Run ID is required")
2376
+ pathParams: z17.object({
2377
+ id: z17.string().min(1, "Run ID is required")
2277
2378
  }),
2278
- query: z16.object({
2279
- last_event_id: z16.string().optional()
2379
+ query: z17.object({
2380
+ last_event_id: z17.string().optional()
2280
2381
  // For reconnection
2281
2382
  }),
2282
2383
  responses: {
2283
- 200: z16.any(),
2384
+ 200: z17.any(),
2284
2385
  // SSE stream - actual content is text/event-stream
2285
2386
  401: publicApiErrorSchema,
2286
2387
  404: publicApiErrorSchema,
@@ -2292,28 +2393,28 @@ var publicRunEventsContract = c13.router({
2292
2393
  });
2293
2394
 
2294
2395
  // ../../packages/core/src/contracts/public/artifacts.ts
2295
- import { z as z17 } from "zod";
2296
- var c14 = initContract();
2297
- var publicArtifactSchema = z17.object({
2298
- id: z17.string(),
2299
- name: z17.string(),
2300
- current_version_id: z17.string().nullable(),
2301
- size: z17.number(),
2396
+ import { z as z18 } from "zod";
2397
+ var c15 = initContract();
2398
+ var publicArtifactSchema = z18.object({
2399
+ id: z18.string(),
2400
+ name: z18.string(),
2401
+ current_version_id: z18.string().nullable(),
2402
+ size: z18.number(),
2302
2403
  // Total size in bytes
2303
- file_count: z17.number(),
2404
+ file_count: z18.number(),
2304
2405
  created_at: timestampSchema,
2305
2406
  updated_at: timestampSchema
2306
2407
  });
2307
- var artifactVersionSchema = z17.object({
2308
- id: z17.string(),
2408
+ var artifactVersionSchema = z18.object({
2409
+ id: z18.string(),
2309
2410
  // SHA-256 content hash
2310
- artifact_id: z17.string(),
2311
- size: z17.number(),
2411
+ artifact_id: z18.string(),
2412
+ size: z18.number(),
2312
2413
  // Size in bytes
2313
- file_count: z17.number(),
2314
- message: z17.string().nullable(),
2414
+ file_count: z18.number(),
2415
+ message: z18.string().nullable(),
2315
2416
  // Optional commit message
2316
- created_by: z17.string(),
2417
+ created_by: z18.string(),
2317
2418
  created_at: timestampSchema
2318
2419
  });
2319
2420
  var publicArtifactDetailSchema = publicArtifactSchema.extend({
@@ -2323,7 +2424,7 @@ var paginatedArtifactsSchema = createPaginatedResponseSchema(publicArtifactSchem
2323
2424
  var paginatedArtifactVersionsSchema = createPaginatedResponseSchema(
2324
2425
  artifactVersionSchema
2325
2426
  );
2326
- var publicArtifactsListContract = c14.router({
2427
+ var publicArtifactsListContract = c15.router({
2327
2428
  list: {
2328
2429
  method: "GET",
2329
2430
  path: "/v1/artifacts",
@@ -2337,12 +2438,12 @@ var publicArtifactsListContract = c14.router({
2337
2438
  description: "List all artifacts in the current scope with pagination"
2338
2439
  }
2339
2440
  });
2340
- var publicArtifactByIdContract = c14.router({
2441
+ var publicArtifactByIdContract = c15.router({
2341
2442
  get: {
2342
2443
  method: "GET",
2343
2444
  path: "/v1/artifacts/:id",
2344
- pathParams: z17.object({
2345
- id: z17.string().min(1, "Artifact ID is required")
2445
+ pathParams: z18.object({
2446
+ id: z18.string().min(1, "Artifact ID is required")
2346
2447
  }),
2347
2448
  responses: {
2348
2449
  200: publicArtifactDetailSchema,
@@ -2354,12 +2455,12 @@ var publicArtifactByIdContract = c14.router({
2354
2455
  description: "Get artifact details by ID"
2355
2456
  }
2356
2457
  });
2357
- var publicArtifactVersionsContract = c14.router({
2458
+ var publicArtifactVersionsContract = c15.router({
2358
2459
  list: {
2359
2460
  method: "GET",
2360
2461
  path: "/v1/artifacts/:id/versions",
2361
- pathParams: z17.object({
2362
- id: z17.string().min(1, "Artifact ID is required")
2462
+ pathParams: z18.object({
2463
+ id: z18.string().min(1, "Artifact ID is required")
2363
2464
  }),
2364
2465
  query: listQuerySchema,
2365
2466
  responses: {
@@ -2372,19 +2473,19 @@ var publicArtifactVersionsContract = c14.router({
2372
2473
  description: "List all versions of an artifact with pagination"
2373
2474
  }
2374
2475
  });
2375
- var publicArtifactDownloadContract = c14.router({
2476
+ var publicArtifactDownloadContract = c15.router({
2376
2477
  download: {
2377
2478
  method: "GET",
2378
2479
  path: "/v1/artifacts/:id/download",
2379
- pathParams: z17.object({
2380
- id: z17.string().min(1, "Artifact ID is required")
2480
+ pathParams: z18.object({
2481
+ id: z18.string().min(1, "Artifact ID is required")
2381
2482
  }),
2382
- query: z17.object({
2383
- version_id: z17.string().optional()
2483
+ query: z18.object({
2484
+ version_id: z18.string().optional()
2384
2485
  // Defaults to current version
2385
2486
  }),
2386
2487
  responses: {
2387
- 302: z17.undefined(),
2488
+ 302: z18.undefined(),
2388
2489
  // Redirect to presigned URL
2389
2490
  401: publicApiErrorSchema,
2390
2491
  404: publicApiErrorSchema,
@@ -2396,28 +2497,28 @@ var publicArtifactDownloadContract = c14.router({
2396
2497
  });
2397
2498
 
2398
2499
  // ../../packages/core/src/contracts/public/volumes.ts
2399
- import { z as z18 } from "zod";
2400
- var c15 = initContract();
2401
- var publicVolumeSchema = z18.object({
2402
- id: z18.string(),
2403
- name: z18.string(),
2404
- current_version_id: z18.string().nullable(),
2405
- size: z18.number(),
2500
+ import { z as z19 } from "zod";
2501
+ var c16 = initContract();
2502
+ var publicVolumeSchema = z19.object({
2503
+ id: z19.string(),
2504
+ name: z19.string(),
2505
+ current_version_id: z19.string().nullable(),
2506
+ size: z19.number(),
2406
2507
  // Total size in bytes
2407
- file_count: z18.number(),
2508
+ file_count: z19.number(),
2408
2509
  created_at: timestampSchema,
2409
2510
  updated_at: timestampSchema
2410
2511
  });
2411
- var volumeVersionSchema = z18.object({
2412
- id: z18.string(),
2512
+ var volumeVersionSchema = z19.object({
2513
+ id: z19.string(),
2413
2514
  // SHA-256 content hash
2414
- volume_id: z18.string(),
2415
- size: z18.number(),
2515
+ volume_id: z19.string(),
2516
+ size: z19.number(),
2416
2517
  // Size in bytes
2417
- file_count: z18.number(),
2418
- message: z18.string().nullable(),
2518
+ file_count: z19.number(),
2519
+ message: z19.string().nullable(),
2419
2520
  // Optional commit message
2420
- created_by: z18.string(),
2521
+ created_by: z19.string(),
2421
2522
  created_at: timestampSchema
2422
2523
  });
2423
2524
  var publicVolumeDetailSchema = publicVolumeSchema.extend({
@@ -2425,7 +2526,7 @@ var publicVolumeDetailSchema = publicVolumeSchema.extend({
2425
2526
  });
2426
2527
  var paginatedVolumesSchema = createPaginatedResponseSchema(publicVolumeSchema);
2427
2528
  var paginatedVolumeVersionsSchema = createPaginatedResponseSchema(volumeVersionSchema);
2428
- var publicVolumesListContract = c15.router({
2529
+ var publicVolumesListContract = c16.router({
2429
2530
  list: {
2430
2531
  method: "GET",
2431
2532
  path: "/v1/volumes",
@@ -2439,12 +2540,12 @@ var publicVolumesListContract = c15.router({
2439
2540
  description: "List all volumes in the current scope with pagination"
2440
2541
  }
2441
2542
  });
2442
- var publicVolumeByIdContract = c15.router({
2543
+ var publicVolumeByIdContract = c16.router({
2443
2544
  get: {
2444
2545
  method: "GET",
2445
2546
  path: "/v1/volumes/:id",
2446
- pathParams: z18.object({
2447
- id: z18.string().min(1, "Volume ID is required")
2547
+ pathParams: z19.object({
2548
+ id: z19.string().min(1, "Volume ID is required")
2448
2549
  }),
2449
2550
  responses: {
2450
2551
  200: publicVolumeDetailSchema,
@@ -2456,12 +2557,12 @@ var publicVolumeByIdContract = c15.router({
2456
2557
  description: "Get volume details by ID"
2457
2558
  }
2458
2559
  });
2459
- var publicVolumeVersionsContract = c15.router({
2560
+ var publicVolumeVersionsContract = c16.router({
2460
2561
  list: {
2461
2562
  method: "GET",
2462
2563
  path: "/v1/volumes/:id/versions",
2463
- pathParams: z18.object({
2464
- id: z18.string().min(1, "Volume ID is required")
2564
+ pathParams: z19.object({
2565
+ id: z19.string().min(1, "Volume ID is required")
2465
2566
  }),
2466
2567
  query: listQuerySchema,
2467
2568
  responses: {
@@ -2474,19 +2575,19 @@ var publicVolumeVersionsContract = c15.router({
2474
2575
  description: "List all versions of a volume with pagination"
2475
2576
  }
2476
2577
  });
2477
- var publicVolumeDownloadContract = c15.router({
2578
+ var publicVolumeDownloadContract = c16.router({
2478
2579
  download: {
2479
2580
  method: "GET",
2480
2581
  path: "/v1/volumes/:id/download",
2481
- pathParams: z18.object({
2482
- id: z18.string().min(1, "Volume ID is required")
2582
+ pathParams: z19.object({
2583
+ id: z19.string().min(1, "Volume ID is required")
2483
2584
  }),
2484
- query: z18.object({
2485
- version_id: z18.string().optional()
2585
+ query: z19.object({
2586
+ version_id: z19.string().optional()
2486
2587
  // Defaults to current version
2487
2588
  }),
2488
2589
  responses: {
2489
- 302: z18.undefined(),
2590
+ 302: z19.undefined(),
2490
2591
  // Redirect to presigned URL
2491
2592
  401: publicApiErrorSchema,
2492
2593
  404: publicApiErrorSchema,
@@ -2586,6 +2687,16 @@ function getProviderDisplayName(provider) {
2586
2687
  return PROVIDER_DISPLAY_NAMES[provider];
2587
2688
  }
2588
2689
 
2690
+ // ../../packages/core/src/feature-switch.ts
2691
+ var PricingSwitch = {
2692
+ key: "pricing" /* Pricing */,
2693
+ maintainer: "ethan@vm0.ai",
2694
+ enabled: false
2695
+ };
2696
+ var FEATURE_SWITCHES = {
2697
+ ["pricing" /* Pricing */]: PricingSwitch
2698
+ };
2699
+
2589
2700
  // src/lib/api/api-client.ts
2590
2701
  import { initClient } from "@ts-rest/core";
2591
2702
  var ApiClient = class {
@@ -3256,6 +3367,106 @@ var ApiClient = class {
3256
3367
  const message = errorBody.error?.message || `Volume "${id}" not found`;
3257
3368
  throw new Error(message);
3258
3369
  }
3370
+ /**
3371
+ * Get usage statistics
3372
+ */
3373
+ async getUsage(options) {
3374
+ const baseUrl = await this.getBaseUrl();
3375
+ const headers = await this.getHeaders();
3376
+ const params = new URLSearchParams({
3377
+ start_date: options.startDate,
3378
+ end_date: options.endDate
3379
+ });
3380
+ const response = await fetch(`${baseUrl}/api/usage?${params}`, {
3381
+ method: "GET",
3382
+ headers
3383
+ });
3384
+ if (!response.ok) {
3385
+ const error = await response.json();
3386
+ throw new Error(error.error?.message || "Failed to fetch usage data");
3387
+ }
3388
+ return response.json();
3389
+ }
3390
+ /**
3391
+ * List credentials (metadata only, no values)
3392
+ */
3393
+ async listCredentials() {
3394
+ const baseUrl = await this.getBaseUrl();
3395
+ const headers = await this.getHeaders();
3396
+ const client = initClient(credentialsMainContract, {
3397
+ baseUrl,
3398
+ baseHeaders: headers,
3399
+ jsonQuery: true
3400
+ });
3401
+ const result = await client.list();
3402
+ if (result.status === 200) {
3403
+ return result.body;
3404
+ }
3405
+ const errorBody = result.body;
3406
+ const message = errorBody.error?.message || "Failed to list credentials";
3407
+ throw new Error(message);
3408
+ }
3409
+ /**
3410
+ * Get credential by name (metadata only, no value)
3411
+ */
3412
+ async getCredential(name) {
3413
+ const baseUrl = await this.getBaseUrl();
3414
+ const headers = await this.getHeaders();
3415
+ const client = initClient(credentialsByNameContract, {
3416
+ baseUrl,
3417
+ baseHeaders: headers,
3418
+ jsonQuery: true
3419
+ });
3420
+ const result = await client.get({
3421
+ params: { name }
3422
+ });
3423
+ if (result.status === 200) {
3424
+ return result.body;
3425
+ }
3426
+ const errorBody = result.body;
3427
+ const message = errorBody.error?.message || `Credential "${name}" not found`;
3428
+ throw new Error(message);
3429
+ }
3430
+ /**
3431
+ * Set (create or update) a credential
3432
+ */
3433
+ async setCredential(body) {
3434
+ const baseUrl = await this.getBaseUrl();
3435
+ const headers = await this.getHeaders();
3436
+ const client = initClient(credentialsMainContract, {
3437
+ baseUrl,
3438
+ baseHeaders: headers,
3439
+ jsonQuery: true
3440
+ });
3441
+ const result = await client.set({ body });
3442
+ if (result.status === 200 || result.status === 201) {
3443
+ return result.body;
3444
+ }
3445
+ const errorBody = result.body;
3446
+ const message = errorBody.error?.message || "Failed to set credential";
3447
+ throw new Error(message);
3448
+ }
3449
+ /**
3450
+ * Delete a credential by name
3451
+ */
3452
+ async deleteCredential(name) {
3453
+ const baseUrl = await this.getBaseUrl();
3454
+ const headers = await this.getHeaders();
3455
+ const client = initClient(credentialsByNameContract, {
3456
+ baseUrl,
3457
+ baseHeaders: headers,
3458
+ jsonQuery: true
3459
+ });
3460
+ const result = await client.delete({
3461
+ params: { name }
3462
+ });
3463
+ if (result.status === 204) {
3464
+ return;
3465
+ }
3466
+ const errorBody = result.body;
3467
+ const message = errorBody.error?.message || `Credential "${name}" not found`;
3468
+ throw new Error(message);
3469
+ }
3259
3470
  /**
3260
3471
  * Generic GET request
3261
3472
  */
@@ -3327,7 +3538,7 @@ var ApiClient = class {
3327
3538
  var apiClient = new ApiClient();
3328
3539
 
3329
3540
  // src/lib/domain/yaml-validator.ts
3330
- import { z as z19 } from "zod";
3541
+ import { z as z20 } from "zod";
3331
3542
 
3332
3543
  // src/lib/domain/provider-config.ts
3333
3544
  var PROVIDER_DEFAULTS = {
@@ -3394,7 +3605,7 @@ function getDefaultImageWithApps(provider, apps) {
3394
3605
  }
3395
3606
 
3396
3607
  // src/lib/domain/yaml-validator.ts
3397
- var cliAgentNameSchema = z19.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
3608
+ var cliAgentNameSchema = z20.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
3398
3609
  /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
3399
3610
  "Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
3400
3611
  );
@@ -3407,14 +3618,14 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
3407
3618
  const providerSupported = isProviderSupported(agent.provider);
3408
3619
  if (!agent.image && !providerSupported) {
3409
3620
  ctx.addIssue({
3410
- code: z19.ZodIssueCode.custom,
3621
+ code: z20.ZodIssueCode.custom,
3411
3622
  message: "Missing agent.image (required when provider is not auto-configured)",
3412
3623
  path: ["image"]
3413
3624
  });
3414
3625
  }
3415
3626
  if (!agent.working_dir && !providerSupported) {
3416
3627
  ctx.addIssue({
3417
- code: z19.ZodIssueCode.custom,
3628
+ code: z20.ZodIssueCode.custom,
3418
3629
  message: "Missing agent.working_dir (required when provider is not auto-configured)",
3419
3630
  path: ["working_dir"]
3420
3631
  });
@@ -3424,7 +3635,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
3424
3635
  const skillUrl = agent.skills[i];
3425
3636
  if (skillUrl && !validateGitHubTreeUrl(skillUrl)) {
3426
3637
  ctx.addIssue({
3427
- code: z19.ZodIssueCode.custom,
3638
+ code: z20.ZodIssueCode.custom,
3428
3639
  message: `Invalid skill URL: ${skillUrl}. Expected format: https://github.com/{owner}/{repo}/tree/{branch}/{path}`,
3429
3640
  path: ["skills", i]
3430
3641
  });
@@ -3433,15 +3644,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
3433
3644
  }
3434
3645
  }
3435
3646
  );
3436
- var cliComposeSchema = z19.object({
3437
- version: z19.string().min(1, "Missing config.version"),
3438
- agents: z19.record(cliAgentNameSchema, cliAgentDefinitionSchema),
3439
- volumes: z19.record(z19.string(), volumeConfigSchema).optional()
3647
+ var cliComposeSchema = z20.object({
3648
+ version: z20.string().min(1, "Missing config.version"),
3649
+ agents: z20.record(cliAgentNameSchema, cliAgentDefinitionSchema),
3650
+ volumes: z20.record(z20.string(), volumeConfigSchema).optional()
3440
3651
  }).superRefine((config, ctx) => {
3441
3652
  const agentKeys = Object.keys(config.agents);
3442
3653
  if (agentKeys.length === 0) {
3443
3654
  ctx.addIssue({
3444
- code: z19.ZodIssueCode.custom,
3655
+ code: z20.ZodIssueCode.custom,
3445
3656
  message: "agents must have at least one agent defined",
3446
3657
  path: ["agents"]
3447
3658
  });
@@ -3449,7 +3660,7 @@ var cliComposeSchema = z19.object({
3449
3660
  }
3450
3661
  if (agentKeys.length > 1) {
3451
3662
  ctx.addIssue({
3452
- code: z19.ZodIssueCode.custom,
3663
+ code: z20.ZodIssueCode.custom,
3453
3664
  message: "Multiple agents not supported yet. Only one agent allowed.",
3454
3665
  path: ["agents"]
3455
3666
  });
@@ -3461,7 +3672,7 @@ var cliComposeSchema = z19.object({
3461
3672
  if (agentVolumes && agentVolumes.length > 0) {
3462
3673
  if (!config.volumes) {
3463
3674
  ctx.addIssue({
3464
- code: z19.ZodIssueCode.custom,
3675
+ code: z20.ZodIssueCode.custom,
3465
3676
  message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
3466
3677
  path: ["volumes"]
3467
3678
  });
@@ -3471,7 +3682,7 @@ var cliComposeSchema = z19.object({
3471
3682
  const parts = volDeclaration.split(":");
3472
3683
  if (parts.length !== 2) {
3473
3684
  ctx.addIssue({
3474
- code: z19.ZodIssueCode.custom,
3685
+ code: z20.ZodIssueCode.custom,
3475
3686
  message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
3476
3687
  path: ["agents", agentName, "volumes"]
3477
3688
  });
@@ -3480,7 +3691,7 @@ var cliComposeSchema = z19.object({
3480
3691
  const volumeKey = parts[0].trim();
3481
3692
  if (!config.volumes[volumeKey]) {
3482
3693
  ctx.addIssue({
3483
- code: z19.ZodIssueCode.custom,
3694
+ code: z20.ZodIssueCode.custom,
3484
3695
  message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
3485
3696
  path: ["volumes", volumeKey]
3486
3697
  });
@@ -4541,9 +4752,9 @@ var CodexEventParser = class {
4541
4752
  }
4542
4753
  }
4543
4754
  if (itemType === "file_change" && item.changes && item.changes.length > 0) {
4544
- const changes = item.changes.map((c16) => {
4545
- const action = c16.kind === "add" ? "Created" : c16.kind === "modify" ? "Modified" : "Deleted";
4546
- return `${action}: ${c16.path}`;
4755
+ const changes = item.changes.map((c17) => {
4756
+ const action = c17.kind === "add" ? "Created" : c17.kind === "modify" ? "Modified" : "Deleted";
4757
+ return `${action}: ${c17.path}`;
4547
4758
  }).join("\n");
4548
4759
  return {
4549
4760
  type: "text",
@@ -4884,9 +5095,9 @@ var CodexEventRenderer = class {
4884
5095
  return;
4885
5096
  }
4886
5097
  if (itemType === "file_change" && item.changes && item.changes.length > 0) {
4887
- const summary = item.changes.map((c16) => {
4888
- const icon = c16.kind === "add" ? "+" : c16.kind === "delete" ? "-" : "~";
4889
- return `${icon}${c16.path}`;
5098
+ const summary = item.changes.map((c17) => {
5099
+ const icon = c17.kind === "add" ? "+" : c17.kind === "delete" ? "-" : "~";
5100
+ return `${icon}${c17.path}`;
4890
5101
  }).join(", ");
4891
5102
  console.log(chalk4.green("[files]") + ` ${summary}`);
4892
5103
  return;
@@ -5103,7 +5314,7 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
5103
5314
  ).option(
5104
5315
  "--conversation <id>",
5105
5316
  "Resume from conversation ID (for fine-grained control)"
5106
- ).option("-v, --verbose", "Show verbose output with timing information").action(
5317
+ ).option("-v, --verbose", "Show verbose output with timing information").option("--debug-no-mock-claude").action(
5107
5318
  async (identifier, prompt, options) => {
5108
5319
  const startTimestamp = /* @__PURE__ */ new Date();
5109
5320
  const verbose = options.verbose;
@@ -5204,7 +5415,8 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
5204
5415
  artifactName: options.artifactName,
5205
5416
  artifactVersion: options.artifactVersion,
5206
5417
  volumeVersions: Object.keys(options.volumeVersion).length > 0 ? options.volumeVersion : void 0,
5207
- conversationId: options.conversation
5418
+ conversationId: options.conversation,
5419
+ debugNoMockClaude: options.debugNoMockClaude || void 0
5208
5420
  });
5209
5421
  if (response.status === "failed") {
5210
5422
  console.error(chalk5.red("\u2717 Run preparation failed"));
@@ -5269,7 +5481,7 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
5269
5481
  "Volume version override (repeatable)",
5270
5482
  collectVolumeVersions,
5271
5483
  {}
5272
- ).option("-v, --verbose", "Show verbose output with timing information").action(
5484
+ ).option("-v, --verbose", "Show verbose output with timing information").option("--debug-no-mock-claude").action(
5273
5485
  async (checkpointId, prompt, options, command) => {
5274
5486
  const startTimestamp = /* @__PURE__ */ new Date();
5275
5487
  const allOpts = command.optsWithGlobals();
@@ -5310,7 +5522,8 @@ runCmd.command("resume").description("Resume an agent run from a checkpoint (use
5310
5522
  prompt,
5311
5523
  vars: Object.keys(vars).length > 0 ? vars : void 0,
5312
5524
  secrets: loadedSecrets,
5313
- volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0
5525
+ volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0,
5526
+ debugNoMockClaude: options.debugNoMockClaude || allOpts.debugNoMockClaude || void 0
5314
5527
  });
5315
5528
  if (response.status === "failed") {
5316
5529
  console.error(chalk5.red("\u2717 Run preparation failed"));
@@ -5367,7 +5580,7 @@ runCmd.command("continue").description(
5367
5580
  "Volume version override (repeatable)",
5368
5581
  collectVolumeVersions,
5369
5582
  {}
5370
- ).option("-v, --verbose", "Show verbose output with timing information").action(
5583
+ ).option("-v, --verbose", "Show verbose output with timing information").option("--debug-no-mock-claude").action(
5371
5584
  async (agentSessionId, prompt, options, command) => {
5372
5585
  const startTimestamp = /* @__PURE__ */ new Date();
5373
5586
  const allOpts = command.optsWithGlobals();
@@ -5409,7 +5622,8 @@ runCmd.command("continue").description(
5409
5622
  prompt,
5410
5623
  vars: Object.keys(vars).length > 0 ? vars : void 0,
5411
5624
  secrets: loadedSecrets,
5412
- volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0
5625
+ volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0,
5626
+ debugNoMockClaude: options.debugNoMockClaude || allOpts.debugNoMockClaude || void 0
5413
5627
  });
5414
5628
  if (response.status === "failed") {
5415
5629
  console.error(chalk5.red("\u2717 Run preparation failed"));
@@ -6731,180 +6945,186 @@ async function autoPullArtifact(runOutput, artifactDir) {
6731
6945
  }
6732
6946
  }
6733
6947
  var cookCmd = new Command17().name("cook").description("One-click agent preparation and execution from vm0.yaml");
6734
- cookCmd.argument("[prompt]", "Prompt for the agent").option("-y, --yes", "Skip confirmation prompts").action(async (prompt, options) => {
6735
- const shouldExit = await checkAndUpgrade("5.7.2", prompt);
6736
- if (shouldExit) {
6737
- process.exit(0);
6738
- }
6739
- const cwd = process.cwd();
6740
- console.log(chalk21.bold(`Reading config: ${CONFIG_FILE3}`));
6741
- if (!existsSync8(CONFIG_FILE3)) {
6742
- console.error(chalk21.red(`\u2717 Config file not found: ${CONFIG_FILE3}`));
6743
- process.exit(1);
6744
- }
6745
- let config;
6746
- try {
6747
- const content = await readFile7(CONFIG_FILE3, "utf8");
6748
- config = parseYaml4(content);
6749
- } catch (error) {
6750
- console.error(chalk21.red("\u2717 Invalid YAML format"));
6751
- if (error instanceof Error) {
6752
- console.error(chalk21.dim(` ${error.message}`));
6948
+ cookCmd.argument("[prompt]", "Prompt for the agent").option("-y, --yes", "Skip confirmation prompts").option("--debug-no-mock-claude").action(
6949
+ async (prompt, options) => {
6950
+ const shouldExit = await checkAndUpgrade("5.9.0", prompt);
6951
+ if (shouldExit) {
6952
+ process.exit(0);
6753
6953
  }
6754
- process.exit(1);
6755
- }
6756
- const validation = validateAgentCompose(config);
6757
- if (!validation.valid) {
6758
- console.error(chalk21.red(`\u2717 ${validation.error}`));
6759
- process.exit(1);
6760
- }
6761
- const agentNames = Object.keys(config.agents);
6762
- const agentName = agentNames[0];
6763
- const volumeCount = config.volumes ? Object.keys(config.volumes).length : 0;
6764
- console.log(
6765
- chalk21.green(`\u2713 Config validated: 1 agent, ${volumeCount} volume(s)`)
6766
- );
6767
- const requiredVarNames = extractRequiredVarNames(config);
6768
- if (requiredVarNames.length > 0) {
6769
- const envFilePath = path12.join(cwd, ".env");
6770
- const missingVars = checkMissingVariables(requiredVarNames, envFilePath);
6771
- if (missingVars.length > 0) {
6772
- await generateEnvPlaceholders(missingVars, envFilePath);
6773
- console.log();
6774
- console.log(
6775
- chalk21.yellow(
6776
- `\u26A0 Missing environment variables. Please fill in values in .env file:`
6777
- )
6778
- );
6779
- for (const varName of missingVars) {
6780
- console.log(chalk21.yellow(` ${varName}`));
6954
+ const cwd = process.cwd();
6955
+ console.log(chalk21.bold(`Reading config: ${CONFIG_FILE3}`));
6956
+ if (!existsSync8(CONFIG_FILE3)) {
6957
+ console.error(chalk21.red(`\u2717 Config file not found: ${CONFIG_FILE3}`));
6958
+ process.exit(1);
6959
+ }
6960
+ let config;
6961
+ try {
6962
+ const content = await readFile7(CONFIG_FILE3, "utf8");
6963
+ config = parseYaml4(content);
6964
+ } catch (error) {
6965
+ console.error(chalk21.red("\u2717 Invalid YAML format"));
6966
+ if (error instanceof Error) {
6967
+ console.error(chalk21.dim(` ${error.message}`));
6781
6968
  }
6782
6969
  process.exit(1);
6783
6970
  }
6784
- }
6785
- if (config.volumes && Object.keys(config.volumes).length > 0) {
6786
- console.log();
6787
- console.log(chalk21.bold("Processing volumes:"));
6788
- for (const volumeConfig of Object.values(config.volumes)) {
6789
- const volumeDir = path12.join(cwd, volumeConfig.name);
6790
- if (!existsSync8(volumeDir)) {
6791
- console.error(
6792
- chalk21.red(
6793
- `\u2717 Directory not found: ${volumeConfig.name}. Create the directory and add files first.`
6971
+ const validation = validateAgentCompose(config);
6972
+ if (!validation.valid) {
6973
+ console.error(chalk21.red(`\u2717 ${validation.error}`));
6974
+ process.exit(1);
6975
+ }
6976
+ const agentNames = Object.keys(config.agents);
6977
+ const agentName = agentNames[0];
6978
+ const volumeCount = config.volumes ? Object.keys(config.volumes).length : 0;
6979
+ console.log(
6980
+ chalk21.green(`\u2713 Config validated: 1 agent, ${volumeCount} volume(s)`)
6981
+ );
6982
+ const requiredVarNames = extractRequiredVarNames(config);
6983
+ if (requiredVarNames.length > 0) {
6984
+ const envFilePath = path12.join(cwd, ".env");
6985
+ const missingVars = checkMissingVariables(
6986
+ requiredVarNames,
6987
+ envFilePath
6988
+ );
6989
+ if (missingVars.length > 0) {
6990
+ await generateEnvPlaceholders(missingVars, envFilePath);
6991
+ console.log();
6992
+ console.log(
6993
+ chalk21.yellow(
6994
+ `\u26A0 Missing environment variables. Please fill in values in .env file:`
6794
6995
  )
6795
6996
  );
6997
+ for (const varName of missingVars) {
6998
+ console.log(chalk21.yellow(` ${varName}`));
6999
+ }
6796
7000
  process.exit(1);
6797
7001
  }
6798
- try {
6799
- printCommand(`cd ${volumeConfig.name}`);
6800
- const existingConfig = await readStorageConfig(volumeDir);
6801
- if (!existingConfig) {
6802
- printCommand(`vm0 volume init --name ${volumeConfig.name}`);
6803
- await execVm0Command(
6804
- ["volume", "init", "--name", volumeConfig.name],
6805
- {
6806
- cwd: volumeDir,
6807
- silent: true
6808
- }
7002
+ }
7003
+ if (config.volumes && Object.keys(config.volumes).length > 0) {
7004
+ console.log();
7005
+ console.log(chalk21.bold("Processing volumes:"));
7006
+ for (const volumeConfig of Object.values(config.volumes)) {
7007
+ const volumeDir = path12.join(cwd, volumeConfig.name);
7008
+ if (!existsSync8(volumeDir)) {
7009
+ console.error(
7010
+ chalk21.red(
7011
+ `\u2717 Directory not found: ${volumeConfig.name}. Create the directory and add files first.`
7012
+ )
6809
7013
  );
7014
+ process.exit(1);
6810
7015
  }
6811
- printCommand("vm0 volume push");
6812
- await execVm0Command(["volume", "push"], {
6813
- cwd: volumeDir,
6814
- silent: true
6815
- });
6816
- printCommand("cd ..");
6817
- } catch (error) {
6818
- console.error(chalk21.red(`\u2717 Failed`));
6819
- if (error instanceof Error) {
6820
- console.error(chalk21.dim(` ${error.message}`));
7016
+ try {
7017
+ printCommand(`cd ${volumeConfig.name}`);
7018
+ const existingConfig = await readStorageConfig(volumeDir);
7019
+ if (!existingConfig) {
7020
+ printCommand(`vm0 volume init --name ${volumeConfig.name}`);
7021
+ await execVm0Command(
7022
+ ["volume", "init", "--name", volumeConfig.name],
7023
+ {
7024
+ cwd: volumeDir,
7025
+ silent: true
7026
+ }
7027
+ );
7028
+ }
7029
+ printCommand("vm0 volume push");
7030
+ await execVm0Command(["volume", "push"], {
7031
+ cwd: volumeDir,
7032
+ silent: true
7033
+ });
7034
+ printCommand("cd ..");
7035
+ } catch (error) {
7036
+ console.error(chalk21.red(`\u2717 Failed`));
7037
+ if (error instanceof Error) {
7038
+ console.error(chalk21.dim(` ${error.message}`));
7039
+ }
7040
+ process.exit(1);
6821
7041
  }
6822
- process.exit(1);
6823
7042
  }
6824
7043
  }
6825
- }
6826
- console.log();
6827
- console.log(chalk21.bold("Processing artifact:"));
6828
- const artifactDir = path12.join(cwd, ARTIFACT_DIR);
6829
- try {
6830
- if (!existsSync8(artifactDir)) {
6831
- printCommand(`mkdir ${ARTIFACT_DIR}`);
6832
- await mkdir6(artifactDir, { recursive: true });
6833
- }
6834
- printCommand(`cd ${ARTIFACT_DIR}`);
6835
- const existingConfig = await readStorageConfig(artifactDir);
6836
- if (!existingConfig) {
6837
- printCommand(`vm0 artifact init --name ${ARTIFACT_DIR}`);
6838
- await execVm0Command(["artifact", "init", "--name", ARTIFACT_DIR], {
7044
+ console.log();
7045
+ console.log(chalk21.bold("Processing artifact:"));
7046
+ const artifactDir = path12.join(cwd, ARTIFACT_DIR);
7047
+ try {
7048
+ if (!existsSync8(artifactDir)) {
7049
+ printCommand(`mkdir ${ARTIFACT_DIR}`);
7050
+ await mkdir6(artifactDir, { recursive: true });
7051
+ }
7052
+ printCommand(`cd ${ARTIFACT_DIR}`);
7053
+ const existingConfig = await readStorageConfig(artifactDir);
7054
+ if (!existingConfig) {
7055
+ printCommand(`vm0 artifact init --name ${ARTIFACT_DIR}`);
7056
+ await execVm0Command(["artifact", "init", "--name", ARTIFACT_DIR], {
7057
+ cwd: artifactDir,
7058
+ silent: true
7059
+ });
7060
+ }
7061
+ printCommand("vm0 artifact push");
7062
+ await execVm0Command(["artifact", "push"], {
6839
7063
  cwd: artifactDir,
6840
7064
  silent: true
6841
7065
  });
7066
+ printCommand("cd ..");
7067
+ } catch (error) {
7068
+ console.error(chalk21.red(`\u2717 Failed`));
7069
+ if (error instanceof Error) {
7070
+ console.error(chalk21.dim(` ${error.message}`));
7071
+ }
7072
+ process.exit(1);
6842
7073
  }
6843
- printCommand("vm0 artifact push");
6844
- await execVm0Command(["artifact", "push"], {
6845
- cwd: artifactDir,
6846
- silent: true
6847
- });
6848
- printCommand("cd ..");
6849
- } catch (error) {
6850
- console.error(chalk21.red(`\u2717 Failed`));
6851
- if (error instanceof Error) {
6852
- console.error(chalk21.dim(` ${error.message}`));
6853
- }
6854
- process.exit(1);
6855
- }
6856
- console.log();
6857
- console.log(chalk21.bold("Composing agent:"));
6858
- const composeArgs = options.yes ? ["compose", "--yes", CONFIG_FILE3] : ["compose", CONFIG_FILE3];
6859
- printCommand(`vm0 ${composeArgs.join(" ")}`);
6860
- try {
6861
- await execVm0Command(composeArgs, {
6862
- cwd
6863
- });
6864
- } catch (error) {
6865
- console.error(chalk21.red(`\u2717 Compose failed`));
6866
- if (error instanceof Error) {
6867
- console.error(chalk21.dim(` ${error.message}`));
6868
- }
6869
- process.exit(1);
6870
- }
6871
- if (prompt) {
6872
- console.log();
6873
- console.log(chalk21.bold("Running agent:"));
6874
- printCommand(
6875
- `vm0 run ${agentName} --artifact-name ${ARTIFACT_DIR} "${prompt}"`
6876
- );
6877
7074
  console.log();
6878
- let runOutput;
7075
+ console.log(chalk21.bold("Composing agent:"));
7076
+ const composeArgs = options.yes ? ["compose", "--yes", CONFIG_FILE3] : ["compose", CONFIG_FILE3];
7077
+ printCommand(`vm0 ${composeArgs.join(" ")}`);
6879
7078
  try {
6880
- const runArgs = [
6881
- "run",
6882
- agentName,
6883
- "--artifact-name",
6884
- ARTIFACT_DIR,
6885
- prompt
6886
- ];
6887
- runOutput = await execVm0RunWithCapture(runArgs, { cwd });
6888
- } catch {
7079
+ await execVm0Command(composeArgs, {
7080
+ cwd
7081
+ });
7082
+ } catch (error) {
7083
+ console.error(chalk21.red(`\u2717 Compose failed`));
7084
+ if (error instanceof Error) {
7085
+ console.error(chalk21.dim(` ${error.message}`));
7086
+ }
6889
7087
  process.exit(1);
6890
7088
  }
6891
- const runIds = parseRunIdsFromOutput(runOutput);
6892
- if (runIds.runId || runIds.sessionId || runIds.checkpointId) {
6893
- await saveCookState({
6894
- lastRunId: runIds.runId,
6895
- lastSessionId: runIds.sessionId,
6896
- lastCheckpointId: runIds.checkpointId
6897
- });
7089
+ if (prompt) {
7090
+ console.log();
7091
+ console.log(chalk21.bold("Running agent:"));
7092
+ printCommand(
7093
+ `vm0 run ${agentName} --artifact-name ${ARTIFACT_DIR} "${prompt}"`
7094
+ );
7095
+ console.log();
7096
+ let runOutput;
7097
+ try {
7098
+ const runArgs = [
7099
+ "run",
7100
+ agentName,
7101
+ "--artifact-name",
7102
+ ARTIFACT_DIR,
7103
+ ...options.debugNoMockClaude ? ["--debug-no-mock-claude"] : [],
7104
+ prompt
7105
+ ];
7106
+ runOutput = await execVm0RunWithCapture(runArgs, { cwd });
7107
+ } catch {
7108
+ process.exit(1);
7109
+ }
7110
+ const runIds = parseRunIdsFromOutput(runOutput);
7111
+ if (runIds.runId || runIds.sessionId || runIds.checkpointId) {
7112
+ await saveCookState({
7113
+ lastRunId: runIds.runId,
7114
+ lastSessionId: runIds.sessionId,
7115
+ lastCheckpointId: runIds.checkpointId
7116
+ });
7117
+ }
7118
+ await autoPullArtifact(runOutput, artifactDir);
7119
+ } else {
7120
+ console.log();
7121
+ console.log("To run your agent:");
7122
+ printCommand(
7123
+ `vm0 run ${agentName} --artifact-name ${ARTIFACT_DIR} "your prompt"`
7124
+ );
6898
7125
  }
6899
- await autoPullArtifact(runOutput, artifactDir);
6900
- } else {
6901
- console.log();
6902
- console.log("To run your agent:");
6903
- printCommand(
6904
- `vm0 run ${agentName} --artifact-name ${ARTIFACT_DIR} "your prompt"`
6905
- );
6906
7126
  }
6907
- });
7127
+ );
6908
7128
  cookCmd.command("logs").description("View logs from the last cook run").option("-a, --agent", "Show agent events (default)").option("-s, --system", "Show system log").option("-m, --metrics", "Show metrics").option("-n, --network", "Show network logs (proxy traffic)").option(
6909
7129
  "--since <time>",
6910
7130
  "Show logs since timestamp (e.g., 5m, 2h, 1d, 2024-01-15T10:30:00Z)"
@@ -6952,7 +7172,7 @@ cookCmd.command("logs").description("View logs from the last cook run").option("
6952
7172
  );
6953
7173
  cookCmd.command("continue").description(
6954
7174
  "Continue from the last session (latest conversation and artifact)"
6955
- ).argument("<prompt>", "Prompt for the continued agent").action(async (prompt) => {
7175
+ ).argument("<prompt>", "Prompt for the continued agent").option("--debug-no-mock-claude").action(async (prompt, options) => {
6956
7176
  const state = await loadCookState();
6957
7177
  if (!state.lastSessionId) {
6958
7178
  console.error(chalk21.red("\u2717 No previous session found"));
@@ -6966,7 +7186,13 @@ cookCmd.command("continue").description(
6966
7186
  let runOutput;
6967
7187
  try {
6968
7188
  runOutput = await execVm0RunWithCapture(
6969
- ["run", "continue", state.lastSessionId, prompt],
7189
+ [
7190
+ "run",
7191
+ "continue",
7192
+ state.lastSessionId,
7193
+ ...options.debugNoMockClaude ? ["--debug-no-mock-claude"] : [],
7194
+ prompt
7195
+ ],
6970
7196
  { cwd }
6971
7197
  );
6972
7198
  } catch {
@@ -6984,7 +7210,7 @@ cookCmd.command("continue").description(
6984
7210
  });
6985
7211
  cookCmd.command("resume").description(
6986
7212
  "Resume from the last checkpoint (snapshotted conversation and artifact)"
6987
- ).argument("<prompt>", "Prompt for the resumed agent").action(async (prompt) => {
7213
+ ).argument("<prompt>", "Prompt for the resumed agent").option("--debug-no-mock-claude").action(async (prompt, options) => {
6988
7214
  const state = await loadCookState();
6989
7215
  if (!state.lastCheckpointId) {
6990
7216
  console.error(chalk21.red("\u2717 No previous checkpoint found"));
@@ -6998,7 +7224,13 @@ cookCmd.command("resume").description(
6998
7224
  let runOutput;
6999
7225
  try {
7000
7226
  runOutput = await execVm0RunWithCapture(
7001
- ["run", "resume", state.lastCheckpointId, prompt],
7227
+ [
7228
+ "run",
7229
+ "resume",
7230
+ state.lastCheckpointId,
7231
+ ...options.debugNoMockClaude ? ["--debug-no-mock-claude"] : [],
7232
+ prompt
7233
+ ],
7002
7234
  { cwd }
7003
7235
  );
7004
7236
  } catch {
@@ -7394,10 +7626,10 @@ var setCommand = new Command20().name("set").description("Set your scope slug").
7394
7626
  // src/commands/scope/index.ts
7395
7627
  var scopeCommand = new Command21().name("scope").description("Manage your scope (namespace for images)").addCommand(statusCommand3).addCommand(setCommand);
7396
7628
 
7397
- // src/commands/agents/index.ts
7629
+ // src/commands/agent/index.ts
7398
7630
  import { Command as Command24 } from "commander";
7399
7631
 
7400
- // src/commands/agents/list.ts
7632
+ // src/commands/agent/list.ts
7401
7633
  import { Command as Command22 } from "commander";
7402
7634
  import chalk25 from "chalk";
7403
7635
  var listCommand3 = new Command22().name("list").alias("ls").description("List all agent composes").option("-s, --scope <scope>", "Scope to list composes from").action(async (options) => {
@@ -7416,7 +7648,7 @@ var listCommand3 = new Command22().name("list").alias("ls").description("List al
7416
7648
  );
7417
7649
  return;
7418
7650
  }
7419
- const nameWidth = Math.max(4, ...data.composes.map((c16) => c16.name.length));
7651
+ const nameWidth = Math.max(4, ...data.composes.map((c17) => c17.name.length));
7420
7652
  const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
7421
7653
  " "
7422
7654
  );
@@ -7443,7 +7675,7 @@ var listCommand3 = new Command22().name("list").alias("ls").description("List al
7443
7675
  }
7444
7676
  });
7445
7677
 
7446
- // src/commands/agents/inspect.ts
7678
+ // src/commands/agent/inspect.ts
7447
7679
  import { Command as Command23 } from "commander";
7448
7680
  import chalk26 from "chalk";
7449
7681
 
@@ -7553,7 +7785,7 @@ async function deriveComposeVariableSources(content, options) {
7553
7785
  return results;
7554
7786
  }
7555
7787
 
7556
- // src/commands/agents/inspect.ts
7788
+ // src/commands/agent/inspect.ts
7557
7789
  function formatComposeOutput(name, versionId, content, variableSources) {
7558
7790
  console.log(chalk26.bold("Name:") + ` ${name}`);
7559
7791
  console.log(chalk26.bold("Version:") + ` ${versionId}`);
@@ -7635,7 +7867,7 @@ var inspectCommand = new Command23().name("inspect").description("Inspect an age
7635
7867
  } catch (error) {
7636
7868
  if (error instanceof Error && error.message.includes("not found")) {
7637
7869
  console.error(chalk26.red(`\u2717 Agent compose not found: ${name}`));
7638
- console.error(chalk26.dim(" Run: vm0 agents list"));
7870
+ console.error(chalk26.dim(" Run: vm0 agent list"));
7639
7871
  process.exit(1);
7640
7872
  }
7641
7873
  throw error;
@@ -7702,8 +7934,8 @@ var inspectCommand = new Command23().name("inspect").description("Inspect an age
7702
7934
  }
7703
7935
  );
7704
7936
 
7705
- // src/commands/agents/index.ts
7706
- var agentsCommand = new Command24().name("agents").description("Manage agent composes").addCommand(listCommand3).addCommand(inspectCommand);
7937
+ // src/commands/agent/index.ts
7938
+ var agentCommand = new Command24().name("agent").description("Manage agent composes").addCommand(listCommand3).addCommand(inspectCommand);
7707
7939
 
7708
7940
  // src/commands/init.ts
7709
7941
  import { Command as Command25 } from "commander";
@@ -9398,11 +9630,324 @@ var disableCommand = new Command33().name("disable").description("Disable a sche
9398
9630
  // src/commands/schedule/index.ts
9399
9631
  var scheduleCommand = new Command34().name("schedule").description("Manage agent schedules").addCommand(initCommand4).addCommand(deployCommand).addCommand(listCommand4).addCommand(statusCommand4).addCommand(deleteCommand).addCommand(enableCommand).addCommand(disableCommand);
9400
9632
 
9633
+ // src/commands/usage.ts
9634
+ import { Command as Command35 } from "commander";
9635
+ import chalk36 from "chalk";
9636
+
9637
+ // src/lib/utils/duration-formatter.ts
9638
+ function formatDuration(ms) {
9639
+ if (ms === null || ms === void 0 || ms === 0) {
9640
+ return "-";
9641
+ }
9642
+ if (ms < 0) {
9643
+ return "-";
9644
+ }
9645
+ const totalSeconds = Math.floor(ms / 1e3);
9646
+ if (totalSeconds === 0) {
9647
+ return "< 1s";
9648
+ }
9649
+ const hours = Math.floor(totalSeconds / 3600);
9650
+ const minutes = Math.floor(totalSeconds % 3600 / 60);
9651
+ const seconds = totalSeconds % 60;
9652
+ const parts = [];
9653
+ if (hours > 0) {
9654
+ parts.push(`${hours}h`);
9655
+ }
9656
+ if (minutes > 0) {
9657
+ parts.push(`${minutes}m`);
9658
+ }
9659
+ if (seconds > 0) {
9660
+ parts.push(`${seconds}s`);
9661
+ }
9662
+ return parts.join(" ");
9663
+ }
9664
+
9665
+ // src/commands/usage.ts
9666
+ var MAX_RANGE_MS = 30 * 24 * 60 * 60 * 1e3;
9667
+ var DEFAULT_RANGE_MS = 7 * 24 * 60 * 60 * 1e3;
9668
+ function formatDateDisplay(dateStr) {
9669
+ const date = new Date(dateStr);
9670
+ return date.toLocaleDateString("en-US", { month: "short", day: "numeric" });
9671
+ }
9672
+ function formatDateRange(start, end) {
9673
+ const startDate = new Date(start);
9674
+ const endDate = new Date(end);
9675
+ endDate.setDate(endDate.getDate() - 1);
9676
+ const startStr = startDate.toLocaleDateString("en-US", {
9677
+ month: "short",
9678
+ day: "numeric"
9679
+ });
9680
+ const endStr = endDate.toLocaleDateString("en-US", {
9681
+ month: "short",
9682
+ day: "numeric",
9683
+ year: "numeric"
9684
+ });
9685
+ return `${startStr} - ${endStr}`;
9686
+ }
9687
+ function fillMissingDates(daily, startDate, endDate) {
9688
+ const dateMap = /* @__PURE__ */ new Map();
9689
+ for (const day of daily) {
9690
+ dateMap.set(day.date, day);
9691
+ }
9692
+ const result = [];
9693
+ const current = new Date(startDate);
9694
+ current.setUTCHours(0, 0, 0, 0);
9695
+ while (current < endDate) {
9696
+ const dateStr = current.toISOString().split("T")[0];
9697
+ const existing = dateMap.get(dateStr);
9698
+ if (existing) {
9699
+ result.push(existing);
9700
+ } else {
9701
+ result.push({ date: dateStr, run_count: 0, run_time_ms: 0 });
9702
+ }
9703
+ current.setDate(current.getDate() + 1);
9704
+ }
9705
+ result.sort((a, b) => b.date.localeCompare(a.date));
9706
+ return result;
9707
+ }
9708
+ var usageCommand = new Command35().name("usage").description("View usage statistics").option("--since <date>", "Start date (ISO format or relative: 7d, 30d)").option(
9709
+ "--until <date>",
9710
+ "End date (ISO format or relative, defaults to now)"
9711
+ ).action(async (options) => {
9712
+ try {
9713
+ const now = /* @__PURE__ */ new Date();
9714
+ let endDate;
9715
+ let startDate;
9716
+ if (options.until) {
9717
+ try {
9718
+ const untilMs = parseTime(options.until);
9719
+ endDate = new Date(untilMs);
9720
+ } catch {
9721
+ console.error(
9722
+ chalk36.red(
9723
+ "Error: Invalid --until format. Use ISO (2026-01-01) or relative (7d, 30d)"
9724
+ )
9725
+ );
9726
+ process.exit(1);
9727
+ }
9728
+ } else {
9729
+ endDate = now;
9730
+ }
9731
+ if (options.since) {
9732
+ try {
9733
+ const sinceMs = parseTime(options.since);
9734
+ startDate = new Date(sinceMs);
9735
+ } catch {
9736
+ console.error(
9737
+ chalk36.red(
9738
+ "Error: Invalid --since format. Use ISO (2026-01-01) or relative (7d, 30d)"
9739
+ )
9740
+ );
9741
+ process.exit(1);
9742
+ }
9743
+ } else {
9744
+ startDate = new Date(endDate.getTime() - DEFAULT_RANGE_MS);
9745
+ }
9746
+ if (startDate >= endDate) {
9747
+ console.error(chalk36.red("Error: --since must be before --until"));
9748
+ process.exit(1);
9749
+ }
9750
+ const rangeMs = endDate.getTime() - startDate.getTime();
9751
+ if (rangeMs > MAX_RANGE_MS) {
9752
+ console.error(
9753
+ chalk36.red(
9754
+ "Error: Time range exceeds maximum of 30 days. Use --until to specify an end date."
9755
+ )
9756
+ );
9757
+ process.exit(1);
9758
+ }
9759
+ const usage = await apiClient.getUsage({
9760
+ startDate: startDate.toISOString(),
9761
+ endDate: endDate.toISOString()
9762
+ });
9763
+ const filledDaily = fillMissingDates(
9764
+ usage.daily,
9765
+ new Date(usage.period.start),
9766
+ new Date(usage.period.end)
9767
+ );
9768
+ console.log();
9769
+ console.log(
9770
+ chalk36.bold(
9771
+ `Usage Summary (${formatDateRange(usage.period.start, usage.period.end)})`
9772
+ )
9773
+ );
9774
+ console.log();
9775
+ console.log(chalk36.dim("DATE RUNS RUN TIME"));
9776
+ for (const day of filledDaily) {
9777
+ const dateDisplay = formatDateDisplay(day.date).padEnd(10);
9778
+ const runsDisplay = String(day.run_count).padStart(6);
9779
+ const timeDisplay = formatDuration(day.run_time_ms);
9780
+ console.log(`${dateDisplay}${runsDisplay} ${timeDisplay}`);
9781
+ }
9782
+ console.log(chalk36.dim("\u2500".repeat(29)));
9783
+ const totalRunsDisplay = String(usage.summary.total_runs).padStart(6);
9784
+ const totalTimeDisplay = formatDuration(usage.summary.total_run_time_ms);
9785
+ console.log(
9786
+ `${"TOTAL".padEnd(10)}${totalRunsDisplay} ${totalTimeDisplay}`
9787
+ );
9788
+ console.log();
9789
+ } catch (error) {
9790
+ if (error instanceof Error) {
9791
+ if (error.message.includes("Not authenticated")) {
9792
+ console.error(
9793
+ chalk36.red("Error: Not authenticated. Run: vm0 auth login")
9794
+ );
9795
+ } else {
9796
+ console.error(chalk36.red(`Error: ${error.message}`));
9797
+ }
9798
+ } else {
9799
+ console.error(chalk36.red("Error: An unexpected error occurred"));
9800
+ }
9801
+ process.exit(1);
9802
+ }
9803
+ });
9804
+
9805
+ // src/commands/credential/index.ts
9806
+ import { Command as Command39 } from "commander";
9807
+
9808
+ // src/commands/credential/list.ts
9809
+ import { Command as Command36 } from "commander";
9810
+ import chalk37 from "chalk";
9811
+ var listCommand5 = new Command36().name("list").description("List all credentials").option("--json", "Output in JSON format").action(async (options) => {
9812
+ try {
9813
+ const result = await apiClient.listCredentials();
9814
+ if (options.json) {
9815
+ console.log(JSON.stringify(result.credentials, null, 2));
9816
+ return;
9817
+ }
9818
+ if (result.credentials.length === 0) {
9819
+ console.log(chalk37.dim("No credentials found."));
9820
+ console.log();
9821
+ console.log("To add a credential:");
9822
+ console.log(chalk37.cyan(" vm0 credential set MY_API_KEY <value>"));
9823
+ return;
9824
+ }
9825
+ console.log(chalk37.bold("Credentials:"));
9826
+ console.log();
9827
+ for (const credential of result.credentials) {
9828
+ console.log(` ${chalk37.cyan(credential.name)}`);
9829
+ if (credential.description) {
9830
+ console.log(` ${chalk37.dim(credential.description)}`);
9831
+ }
9832
+ console.log(
9833
+ ` ${chalk37.dim(`Updated: ${new Date(credential.updatedAt).toLocaleString()}`)}`
9834
+ );
9835
+ console.log();
9836
+ }
9837
+ console.log(
9838
+ chalk37.dim(`Total: ${result.credentials.length} credential(s)`)
9839
+ );
9840
+ } catch (error) {
9841
+ if (error instanceof Error) {
9842
+ if (error.message.includes("Not authenticated")) {
9843
+ console.error(chalk37.red("\u2717 Not authenticated. Run: vm0 auth login"));
9844
+ } else {
9845
+ console.error(chalk37.red(`\u2717 ${error.message}`));
9846
+ }
9847
+ } else {
9848
+ console.error(chalk37.red("\u2717 An unexpected error occurred"));
9849
+ }
9850
+ process.exit(1);
9851
+ }
9852
+ });
9853
+
9854
+ // src/commands/credential/set.ts
9855
+ import { Command as Command37 } from "commander";
9856
+ import chalk38 from "chalk";
9857
+ var setCommand2 = new Command37().name("set").description("Create or update a credential").argument("<name>", "Credential name (uppercase, e.g., MY_API_KEY)").argument("<value>", "Credential value").option("-d, --description <description>", "Optional description").action(
9858
+ async (name, value, options) => {
9859
+ try {
9860
+ const credential = await apiClient.setCredential({
9861
+ name,
9862
+ value,
9863
+ description: options.description
9864
+ });
9865
+ console.log(chalk38.green(`\u2713 Credential "${credential.name}" saved`));
9866
+ console.log();
9867
+ console.log("Use in vm0.yaml:");
9868
+ console.log(chalk38.cyan(` environment:`));
9869
+ console.log(chalk38.cyan(` ${name}: \${{ credentials.${name} }}`));
9870
+ } catch (error) {
9871
+ if (error instanceof Error) {
9872
+ if (error.message.includes("Not authenticated")) {
9873
+ console.error(
9874
+ chalk38.red("\u2717 Not authenticated. Run: vm0 auth login")
9875
+ );
9876
+ } else if (error.message.includes("must contain only uppercase")) {
9877
+ console.error(chalk38.red(`\u2717 ${error.message}`));
9878
+ console.log();
9879
+ console.log("Examples of valid credential names:");
9880
+ console.log(chalk38.dim(" MY_API_KEY"));
9881
+ console.log(chalk38.dim(" GITHUB_TOKEN"));
9882
+ console.log(chalk38.dim(" AWS_ACCESS_KEY_ID"));
9883
+ } else {
9884
+ console.error(chalk38.red(`\u2717 ${error.message}`));
9885
+ }
9886
+ } else {
9887
+ console.error(chalk38.red("\u2717 An unexpected error occurred"));
9888
+ }
9889
+ process.exit(1);
9890
+ }
9891
+ }
9892
+ );
9893
+
9894
+ // src/commands/credential/delete.ts
9895
+ import { Command as Command38 } from "commander";
9896
+ import chalk39 from "chalk";
9897
+ var deleteCommand2 = new Command38().name("delete").description("Delete a credential").argument("<name>", "Credential name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
9898
+ try {
9899
+ try {
9900
+ await apiClient.getCredential(name);
9901
+ } catch {
9902
+ console.error(chalk39.red(`\u2717 Credential "${name}" not found`));
9903
+ process.exit(1);
9904
+ }
9905
+ if (!options.yes) {
9906
+ const readline2 = await import("readline");
9907
+ const rl = readline2.createInterface({
9908
+ input: process.stdin,
9909
+ output: process.stdout
9910
+ });
9911
+ const confirmed = await new Promise((resolve2) => {
9912
+ rl.question(
9913
+ chalk39.yellow(
9914
+ `Are you sure you want to delete credential "${name}"? (y/N) `
9915
+ ),
9916
+ (answer) => {
9917
+ rl.close();
9918
+ resolve2(answer.toLowerCase() === "y");
9919
+ }
9920
+ );
9921
+ });
9922
+ if (!confirmed) {
9923
+ console.log(chalk39.dim("Cancelled."));
9924
+ return;
9925
+ }
9926
+ }
9927
+ await apiClient.deleteCredential(name);
9928
+ console.log(chalk39.green(`\u2713 Credential "${name}" deleted`));
9929
+ } catch (error) {
9930
+ if (error instanceof Error) {
9931
+ if (error.message.includes("Not authenticated")) {
9932
+ console.error(chalk39.red("\u2717 Not authenticated. Run: vm0 auth login"));
9933
+ } else {
9934
+ console.error(chalk39.red(`\u2717 ${error.message}`));
9935
+ }
9936
+ } else {
9937
+ console.error(chalk39.red("\u2717 An unexpected error occurred"));
9938
+ }
9939
+ process.exit(1);
9940
+ }
9941
+ });
9942
+
9943
+ // src/commands/credential/index.ts
9944
+ var credentialCommand = new Command39().name("experimental-credential").description("[Experimental] Manage stored credentials for agent runs").addCommand(listCommand5).addCommand(setCommand2).addCommand(deleteCommand2);
9945
+
9401
9946
  // src/index.ts
9402
- var program = new Command35();
9403
- program.name("vm0").description("VM0 CLI - A modern build tool").version("5.7.2");
9947
+ var program = new Command40();
9948
+ program.name("vm0").description("VM0 CLI - A modern build tool").version("5.9.0");
9404
9949
  program.command("info").description("Display environment information").action(async () => {
9405
- console.log(chalk36.bold("System Information:"));
9950
+ console.log(chalk40.bold("System Information:"));
9406
9951
  console.log(`Node Version: ${process.version}`);
9407
9952
  console.log(`Platform: ${process.platform}`);
9408
9953
  console.log(`Architecture: ${process.arch}`);
@@ -9429,10 +9974,12 @@ program.addCommand(artifactCommand);
9429
9974
  program.addCommand(cookCommand);
9430
9975
  program.addCommand(logsCommand);
9431
9976
  program.addCommand(scopeCommand);
9432
- program.addCommand(agentsCommand);
9977
+ program.addCommand(agentCommand);
9433
9978
  program.addCommand(initCommand3);
9434
9979
  program.addCommand(setupGithubCommand);
9435
9980
  program.addCommand(scheduleCommand);
9981
+ program.addCommand(usageCommand);
9982
+ program.addCommand(credentialCommand);
9436
9983
  if (process.argv[1]?.endsWith("index.js") || process.argv[1]?.endsWith("index.ts") || process.argv[1]?.endsWith("vm0")) {
9437
9984
  program.parse();
9438
9985
  }