@vm0/cli 6.0.0 → 6.2.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 +864 -376
  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 Command42 } from "commander";
5
- import chalk43 from "chalk";
4
+ import { Command as Command47 } from "commander";
5
+ import chalk47 from "chalk";
6
6
 
7
7
  // src/lib/api/auth.ts
8
8
  import chalk from "chalk";
@@ -641,6 +641,8 @@ var unifiedRunRequestSchema = z4.object({
641
641
  volumeVersions: z4.record(z4.string(), z4.string()).optional(),
642
642
  // Debug flag to force real Claude in mock environments (internal use only)
643
643
  debugNoMockClaude: z4.boolean().optional(),
644
+ // Model provider for automatic LLM credential injection
645
+ modelProvider: z4.string().optional(),
644
646
  // Required
645
647
  prompt: z4.string().min(1, "Missing prompt")
646
648
  });
@@ -1654,10 +1656,12 @@ var credentialNameSchema = z12.string().min(1, "Credential name is required").ma
1654
1656
  /^[A-Z][A-Z0-9_]*$/,
1655
1657
  "Credential name must contain only uppercase letters, numbers, and underscores, and must start with a letter (e.g., MY_API_KEY)"
1656
1658
  );
1659
+ var credentialTypeSchema = z12.enum(["user", "model-provider"]);
1657
1660
  var credentialResponseSchema = z12.object({
1658
1661
  id: z12.string().uuid(),
1659
1662
  name: z12.string(),
1660
1663
  description: z12.string().nullable(),
1664
+ type: credentialTypeSchema,
1661
1665
  createdAt: z12.string(),
1662
1666
  updatedAt: z12.string()
1663
1667
  });
@@ -1741,43 +1745,191 @@ var credentialsByNameContract = c10.router({
1741
1745
  }
1742
1746
  });
1743
1747
 
1744
- // ../../packages/core/src/contracts/sessions.ts
1748
+ // ../../packages/core/src/contracts/model-providers.ts
1745
1749
  import { z as z13 } from "zod";
1746
1750
  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(),
1751
+ var MODEL_PROVIDER_TYPES = {
1752
+ "claude-code-oauth-token": {
1753
+ framework: "claude-code",
1754
+ credentialName: "CLAUDE_CODE_OAUTH_TOKEN",
1755
+ label: "Claude Code (OAuth Token)",
1756
+ credentialLabel: "OAuth token"
1757
+ },
1758
+ "anthropic-api-key": {
1759
+ framework: "claude-code",
1760
+ credentialName: "ANTHROPIC_API_KEY",
1761
+ label: "Anthropic API Key",
1762
+ credentialLabel: "API key"
1763
+ },
1764
+ "openai-api-key": {
1765
+ framework: "codex",
1766
+ credentialName: "OPENAI_API_KEY",
1767
+ label: "OpenAI API Key",
1768
+ credentialLabel: "API key"
1769
+ }
1770
+ };
1771
+ var modelProviderTypeSchema = z13.enum([
1772
+ "claude-code-oauth-token",
1773
+ "anthropic-api-key",
1774
+ "openai-api-key"
1775
+ ]);
1776
+ var modelProviderFrameworkSchema = z13.enum(["claude-code", "codex"]);
1777
+ var modelProviderResponseSchema = z13.object({
1778
+ id: z13.string().uuid(),
1779
+ type: modelProviderTypeSchema,
1780
+ framework: modelProviderFrameworkSchema,
1781
+ credentialName: z13.string(),
1782
+ isDefault: z13.boolean(),
1756
1783
  createdAt: z13.string(),
1757
1784
  updatedAt: z13.string()
1758
1785
  });
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()
1786
+ var modelProviderListResponseSchema = z13.object({
1787
+ modelProviders: z13.array(modelProviderResponseSchema)
1788
+ });
1789
+ var upsertModelProviderRequestSchema = z13.object({
1790
+ type: modelProviderTypeSchema,
1791
+ credential: z13.string().min(1, "Credential is required"),
1792
+ convert: z13.boolean().optional()
1793
+ });
1794
+ var upsertModelProviderResponseSchema = z13.object({
1795
+ provider: modelProviderResponseSchema,
1796
+ created: z13.boolean()
1797
+ });
1798
+ var checkCredentialResponseSchema = z13.object({
1799
+ exists: z13.boolean(),
1800
+ credentialName: z13.string(),
1801
+ currentType: z13.enum(["user", "model-provider"]).optional()
1802
+ });
1803
+ var modelProvidersMainContract = c11.router({
1804
+ list: {
1805
+ method: "GET",
1806
+ path: "/api/model-providers",
1807
+ responses: {
1808
+ 200: modelProviderListResponseSchema,
1809
+ 401: apiErrorSchema,
1810
+ 500: apiErrorSchema
1811
+ },
1812
+ summary: "List all model providers"
1813
+ },
1814
+ upsert: {
1815
+ method: "PUT",
1816
+ path: "/api/model-providers",
1817
+ body: upsertModelProviderRequestSchema,
1818
+ responses: {
1819
+ 200: upsertModelProviderResponseSchema,
1820
+ 201: upsertModelProviderResponseSchema,
1821
+ 400: apiErrorSchema,
1822
+ 401: apiErrorSchema,
1823
+ 409: apiErrorSchema,
1824
+ 500: apiErrorSchema
1825
+ },
1826
+ summary: "Create or update a model provider"
1827
+ }
1828
+ });
1829
+ var modelProvidersCheckContract = c11.router({
1830
+ check: {
1831
+ method: "GET",
1832
+ path: "/api/model-providers/check/:type",
1833
+ pathParams: z13.object({
1834
+ type: modelProviderTypeSchema
1835
+ }),
1836
+ responses: {
1837
+ 200: checkCredentialResponseSchema,
1838
+ 401: apiErrorSchema,
1839
+ 500: apiErrorSchema
1840
+ },
1841
+ summary: "Check if credential exists for a model provider type"
1842
+ }
1843
+ });
1844
+ var modelProvidersByTypeContract = c11.router({
1845
+ delete: {
1846
+ method: "DELETE",
1847
+ path: "/api/model-providers/:type",
1848
+ pathParams: z13.object({
1849
+ type: modelProviderTypeSchema
1850
+ }),
1851
+ responses: {
1852
+ 204: z13.undefined(),
1853
+ 401: apiErrorSchema,
1854
+ 404: apiErrorSchema,
1855
+ 500: apiErrorSchema
1856
+ },
1857
+ summary: "Delete a model provider"
1858
+ }
1859
+ });
1860
+ var modelProvidersConvertContract = c11.router({
1861
+ convert: {
1862
+ method: "POST",
1863
+ path: "/api/model-providers/:type/convert",
1864
+ pathParams: z13.object({
1865
+ type: modelProviderTypeSchema
1866
+ }),
1867
+ body: z13.undefined(),
1868
+ responses: {
1869
+ 200: modelProviderResponseSchema,
1870
+ 400: apiErrorSchema,
1871
+ 401: apiErrorSchema,
1872
+ 404: apiErrorSchema,
1873
+ 500: apiErrorSchema
1874
+ },
1875
+ summary: "Convert existing user credential to model provider"
1876
+ }
1877
+ });
1878
+ var modelProvidersSetDefaultContract = c11.router({
1879
+ setDefault: {
1880
+ method: "POST",
1881
+ path: "/api/model-providers/:type/set-default",
1882
+ pathParams: z13.object({
1883
+ type: modelProviderTypeSchema
1884
+ }),
1885
+ body: z13.undefined(),
1886
+ responses: {
1887
+ 200: modelProviderResponseSchema,
1888
+ 401: apiErrorSchema,
1889
+ 404: apiErrorSchema,
1890
+ 500: apiErrorSchema
1891
+ },
1892
+ summary: "Set a model provider as default for its framework"
1893
+ }
1894
+ });
1895
+
1896
+ // ../../packages/core/src/contracts/sessions.ts
1897
+ import { z as z14 } from "zod";
1898
+ var c12 = initContract();
1899
+ var sessionResponseSchema = z14.object({
1900
+ id: z14.string(),
1901
+ agentComposeId: z14.string(),
1902
+ agentComposeVersionId: z14.string().nullable(),
1903
+ conversationId: z14.string().nullable(),
1904
+ artifactName: z14.string().nullable(),
1905
+ vars: z14.record(z14.string(), z14.string()).nullable(),
1906
+ secretNames: z14.array(z14.string()).nullable(),
1907
+ volumeVersions: z14.record(z14.string(), z14.string()).nullable(),
1908
+ createdAt: z14.string(),
1909
+ updatedAt: z14.string()
1910
+ });
1911
+ var agentComposeSnapshotSchema = z14.object({
1912
+ agentComposeVersionId: z14.string(),
1913
+ vars: z14.record(z14.string(), z14.string()).optional(),
1914
+ secretNames: z14.array(z14.string()).optional()
1763
1915
  });
1764
- var artifactSnapshotSchema2 = z13.object({
1765
- artifactName: z13.string(),
1766
- artifactVersion: z13.string()
1916
+ var artifactSnapshotSchema2 = z14.object({
1917
+ artifactName: z14.string(),
1918
+ artifactVersion: z14.string()
1767
1919
  });
1768
- var volumeVersionsSnapshotSchema2 = z13.object({
1769
- versions: z13.record(z13.string(), z13.string())
1920
+ var volumeVersionsSnapshotSchema2 = z14.object({
1921
+ versions: z14.record(z14.string(), z14.string())
1770
1922
  });
1771
- var checkpointResponseSchema = z13.object({
1772
- id: z13.string(),
1773
- runId: z13.string(),
1774
- conversationId: z13.string(),
1923
+ var checkpointResponseSchema = z14.object({
1924
+ id: z14.string(),
1925
+ runId: z14.string(),
1926
+ conversationId: z14.string(),
1775
1927
  agentComposeSnapshot: agentComposeSnapshotSchema,
1776
1928
  artifactSnapshot: artifactSnapshotSchema2.nullable(),
1777
1929
  volumeVersionsSnapshot: volumeVersionsSnapshotSchema2.nullable(),
1778
- createdAt: z13.string()
1930
+ createdAt: z14.string()
1779
1931
  });
1780
- var sessionsByIdContract = c11.router({
1932
+ var sessionsByIdContract = c12.router({
1781
1933
  /**
1782
1934
  * GET /api/agent/sessions/:id
1783
1935
  * Get session by ID
@@ -1785,8 +1937,8 @@ var sessionsByIdContract = c11.router({
1785
1937
  getById: {
1786
1938
  method: "GET",
1787
1939
  path: "/api/agent/sessions/:id",
1788
- pathParams: z13.object({
1789
- id: z13.string().min(1, "Session ID is required")
1940
+ pathParams: z14.object({
1941
+ id: z14.string().min(1, "Session ID is required")
1790
1942
  }),
1791
1943
  responses: {
1792
1944
  200: sessionResponseSchema,
@@ -1797,7 +1949,7 @@ var sessionsByIdContract = c11.router({
1797
1949
  summary: "Get session by ID"
1798
1950
  }
1799
1951
  });
1800
- var checkpointsByIdContract = c11.router({
1952
+ var checkpointsByIdContract = c12.router({
1801
1953
  /**
1802
1954
  * GET /api/agent/checkpoints/:id
1803
1955
  * Get checkpoint by ID
@@ -1805,8 +1957,8 @@ var checkpointsByIdContract = c11.router({
1805
1957
  getById: {
1806
1958
  method: "GET",
1807
1959
  path: "/api/agent/checkpoints/:id",
1808
- pathParams: z13.object({
1809
- id: z13.string().min(1, "Checkpoint ID is required")
1960
+ pathParams: z14.object({
1961
+ id: z14.string().min(1, "Checkpoint ID is required")
1810
1962
  }),
1811
1963
  responses: {
1812
1964
  200: checkpointResponseSchema,
@@ -1819,91 +1971,91 @@ var checkpointsByIdContract = c11.router({
1819
1971
  });
1820
1972
 
1821
1973
  // ../../packages/core/src/contracts/schedules.ts
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")
1974
+ import { z as z15 } from "zod";
1975
+ var c13 = initContract();
1976
+ var scheduleTriggerSchema = z15.object({
1977
+ cron: z15.string().optional(),
1978
+ at: z15.string().optional(),
1979
+ timezone: z15.string().default("UTC")
1828
1980
  }).refine((data) => data.cron && !data.at || !data.cron && data.at, {
1829
1981
  message: "Exactly one of 'cron' or 'at' must be specified"
1830
1982
  });
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()
1983
+ var scheduleRunConfigSchema = z15.object({
1984
+ agent: z15.string().min(1, "Agent reference required"),
1985
+ prompt: z15.string().min(1, "Prompt required"),
1986
+ vars: z15.record(z15.string(), z15.string()).optional(),
1987
+ secrets: z15.record(z15.string(), z15.string()).optional(),
1988
+ artifactName: z15.string().optional(),
1989
+ artifactVersion: z15.string().optional(),
1990
+ volumeVersions: z15.record(z15.string(), z15.string()).optional()
1839
1991
  });
1840
- var scheduleDefinitionSchema = z14.object({
1992
+ var scheduleDefinitionSchema = z15.object({
1841
1993
  on: scheduleTriggerSchema,
1842
1994
  run: scheduleRunConfigSchema
1843
1995
  });
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(),
1996
+ var scheduleYamlSchema = z15.object({
1997
+ version: z15.literal("1.0"),
1998
+ schedules: z15.record(z15.string(), scheduleDefinitionSchema)
1999
+ });
2000
+ var deployScheduleRequestSchema = z15.object({
2001
+ name: z15.string().min(1).max(64, "Schedule name max 64 chars"),
2002
+ cronExpression: z15.string().optional(),
2003
+ atTime: z15.string().optional(),
2004
+ timezone: z15.string().default("UTC"),
2005
+ prompt: z15.string().min(1, "Prompt required"),
2006
+ vars: z15.record(z15.string(), z15.string()).optional(),
2007
+ secrets: z15.record(z15.string(), z15.string()).optional(),
2008
+ artifactName: z15.string().optional(),
2009
+ artifactVersion: z15.string().optional(),
2010
+ volumeVersions: z15.record(z15.string(), z15.string()).optional(),
1859
2011
  // Resolved agent compose ID (CLI resolves scope/name:version → composeId)
1860
- composeId: z14.string().uuid("Invalid compose ID")
2012
+ composeId: z15.string().uuid("Invalid compose ID")
1861
2013
  }).refine(
1862
2014
  (data) => data.cronExpression && !data.atTime || !data.cronExpression && data.atTime,
1863
2015
  {
1864
2016
  message: "Exactly one of 'cronExpression' or 'atTime' must be specified"
1865
2017
  }
1866
2018
  );
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(),
2019
+ var scheduleResponseSchema = z15.object({
2020
+ id: z15.string().uuid(),
2021
+ composeId: z15.string().uuid(),
2022
+ composeName: z15.string(),
2023
+ scopeSlug: z15.string(),
2024
+ name: z15.string(),
2025
+ cronExpression: z15.string().nullable(),
2026
+ atTime: z15.string().nullable(),
2027
+ timezone: z15.string(),
2028
+ prompt: z15.string(),
2029
+ vars: z15.record(z15.string(), z15.string()).nullable(),
1878
2030
  // Secret names only (values are never returned)
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({
2031
+ secretNames: z15.array(z15.string()).nullable(),
2032
+ artifactName: z15.string().nullable(),
2033
+ artifactVersion: z15.string().nullable(),
2034
+ volumeVersions: z15.record(z15.string(), z15.string()).nullable(),
2035
+ enabled: z15.boolean(),
2036
+ nextRunAt: z15.string().nullable(),
2037
+ createdAt: z15.string(),
2038
+ updatedAt: z15.string()
2039
+ });
2040
+ var runSummarySchema = z15.object({
2041
+ id: z15.string().uuid(),
2042
+ status: z15.enum(["pending", "running", "completed", "failed", "timeout"]),
2043
+ createdAt: z15.string(),
2044
+ completedAt: z15.string().nullable(),
2045
+ error: z15.string().nullable()
2046
+ });
2047
+ var scheduleRunsResponseSchema = z15.object({
2048
+ runs: z15.array(runSummarySchema)
2049
+ });
2050
+ var scheduleListResponseSchema = z15.object({
2051
+ schedules: z15.array(scheduleResponseSchema)
2052
+ });
2053
+ var deployScheduleResponseSchema = z15.object({
1902
2054
  schedule: scheduleResponseSchema,
1903
- created: z14.boolean()
2055
+ created: z15.boolean()
1904
2056
  // true if created, false if updated
1905
2057
  });
1906
- var schedulesMainContract = c12.router({
2058
+ var schedulesMainContract = c13.router({
1907
2059
  /**
1908
2060
  * POST /api/agent/schedules
1909
2061
  * Deploy (create or update) a schedule
@@ -1939,7 +2091,7 @@ var schedulesMainContract = c12.router({
1939
2091
  summary: "List all schedules"
1940
2092
  }
1941
2093
  });
1942
- var schedulesByNameContract = c12.router({
2094
+ var schedulesByNameContract = c13.router({
1943
2095
  /**
1944
2096
  * GET /api/agent/schedules/:name
1945
2097
  * Get schedule by name
@@ -1947,11 +2099,11 @@ var schedulesByNameContract = c12.router({
1947
2099
  getByName: {
1948
2100
  method: "GET",
1949
2101
  path: "/api/agent/schedules/:name",
1950
- pathParams: z14.object({
1951
- name: z14.string().min(1, "Schedule name required")
2102
+ pathParams: z15.object({
2103
+ name: z15.string().min(1, "Schedule name required")
1952
2104
  }),
1953
- query: z14.object({
1954
- composeId: z14.string().uuid("Compose ID required")
2105
+ query: z15.object({
2106
+ composeId: z15.string().uuid("Compose ID required")
1955
2107
  }),
1956
2108
  responses: {
1957
2109
  200: scheduleResponseSchema,
@@ -1967,21 +2119,21 @@ var schedulesByNameContract = c12.router({
1967
2119
  delete: {
1968
2120
  method: "DELETE",
1969
2121
  path: "/api/agent/schedules/:name",
1970
- pathParams: z14.object({
1971
- name: z14.string().min(1, "Schedule name required")
2122
+ pathParams: z15.object({
2123
+ name: z15.string().min(1, "Schedule name required")
1972
2124
  }),
1973
- query: z14.object({
1974
- composeId: z14.string().uuid("Compose ID required")
2125
+ query: z15.object({
2126
+ composeId: z15.string().uuid("Compose ID required")
1975
2127
  }),
1976
2128
  responses: {
1977
- 204: z14.undefined(),
2129
+ 204: z15.undefined(),
1978
2130
  401: apiErrorSchema,
1979
2131
  404: apiErrorSchema
1980
2132
  },
1981
2133
  summary: "Delete schedule"
1982
2134
  }
1983
2135
  });
1984
- var schedulesEnableContract = c12.router({
2136
+ var schedulesEnableContract = c13.router({
1985
2137
  /**
1986
2138
  * POST /api/agent/schedules/:name/enable
1987
2139
  * Enable a disabled schedule
@@ -1989,11 +2141,11 @@ var schedulesEnableContract = c12.router({
1989
2141
  enable: {
1990
2142
  method: "POST",
1991
2143
  path: "/api/agent/schedules/:name/enable",
1992
- pathParams: z14.object({
1993
- name: z14.string().min(1, "Schedule name required")
2144
+ pathParams: z15.object({
2145
+ name: z15.string().min(1, "Schedule name required")
1994
2146
  }),
1995
- body: z14.object({
1996
- composeId: z14.string().uuid("Compose ID required")
2147
+ body: z15.object({
2148
+ composeId: z15.string().uuid("Compose ID required")
1997
2149
  }),
1998
2150
  responses: {
1999
2151
  200: scheduleResponseSchema,
@@ -2009,11 +2161,11 @@ var schedulesEnableContract = c12.router({
2009
2161
  disable: {
2010
2162
  method: "POST",
2011
2163
  path: "/api/agent/schedules/:name/disable",
2012
- pathParams: z14.object({
2013
- name: z14.string().min(1, "Schedule name required")
2164
+ pathParams: z15.object({
2165
+ name: z15.string().min(1, "Schedule name required")
2014
2166
  }),
2015
- body: z14.object({
2016
- composeId: z14.string().uuid("Compose ID required")
2167
+ body: z15.object({
2168
+ composeId: z15.string().uuid("Compose ID required")
2017
2169
  }),
2018
2170
  responses: {
2019
2171
  200: scheduleResponseSchema,
@@ -2023,7 +2175,7 @@ var schedulesEnableContract = c12.router({
2023
2175
  summary: "Disable schedule"
2024
2176
  }
2025
2177
  });
2026
- var scheduleRunsContract = c12.router({
2178
+ var scheduleRunsContract = c13.router({
2027
2179
  /**
2028
2180
  * GET /api/agent/schedules/:name/runs
2029
2181
  * List recent runs for a schedule
@@ -2031,12 +2183,12 @@ var scheduleRunsContract = c12.router({
2031
2183
  listRuns: {
2032
2184
  method: "GET",
2033
2185
  path: "/api/agent/schedules/:name/runs",
2034
- pathParams: z14.object({
2035
- name: z14.string().min(1, "Schedule name required")
2186
+ pathParams: z15.object({
2187
+ name: z15.string().min(1, "Schedule name required")
2036
2188
  }),
2037
- query: z14.object({
2038
- composeId: z14.string().uuid("Compose ID required"),
2039
- limit: z14.coerce.number().min(0).max(100).default(5)
2189
+ query: z15.object({
2190
+ composeId: z15.string().uuid("Compose ID required"),
2191
+ limit: z15.coerce.number().min(0).max(100).default(5)
2040
2192
  }),
2041
2193
  responses: {
2042
2194
  200: scheduleRunsResponseSchema,
@@ -2048,18 +2200,18 @@ var scheduleRunsContract = c12.router({
2048
2200
  });
2049
2201
 
2050
2202
  // ../../packages/core/src/contracts/realtime.ts
2051
- import { z as z15 } from "zod";
2052
- var c13 = initContract();
2053
- var ablyTokenRequestSchema = z15.object({
2054
- keyName: z15.string(),
2055
- ttl: z15.number().optional(),
2056
- timestamp: z15.number(),
2057
- capability: z15.string(),
2058
- clientId: z15.string().optional(),
2059
- nonce: z15.string(),
2060
- mac: z15.string()
2061
- });
2062
- var realtimeTokenContract = c13.router({
2203
+ import { z as z16 } from "zod";
2204
+ var c14 = initContract();
2205
+ var ablyTokenRequestSchema = z16.object({
2206
+ keyName: z16.string(),
2207
+ ttl: z16.number().optional(),
2208
+ timestamp: z16.number(),
2209
+ capability: z16.string(),
2210
+ clientId: z16.string().optional(),
2211
+ nonce: z16.string(),
2212
+ mac: z16.string()
2213
+ });
2214
+ var realtimeTokenContract = c14.router({
2063
2215
  /**
2064
2216
  * POST /api/realtime/token
2065
2217
  * Get an Ably token to subscribe to a run's events channel
@@ -2067,8 +2219,8 @@ var realtimeTokenContract = c13.router({
2067
2219
  create: {
2068
2220
  method: "POST",
2069
2221
  path: "/api/realtime/token",
2070
- body: z15.object({
2071
- runId: z15.string().uuid("runId must be a valid UUID")
2222
+ body: z16.object({
2223
+ runId: z16.string().uuid("runId must be a valid UUID")
2072
2224
  }),
2073
2225
  responses: {
2074
2226
  200: ablyTokenRequestSchema,
@@ -2082,8 +2234,8 @@ var realtimeTokenContract = c13.router({
2082
2234
  });
2083
2235
 
2084
2236
  // ../../packages/core/src/contracts/public/common.ts
2085
- import { z as z16 } from "zod";
2086
- var publicApiErrorTypeSchema = z16.enum([
2237
+ import { z as z17 } from "zod";
2238
+ var publicApiErrorTypeSchema = z17.enum([
2087
2239
  "api_error",
2088
2240
  // Internal server error (5xx)
2089
2241
  "invalid_request_error",
@@ -2095,55 +2247,55 @@ var publicApiErrorTypeSchema = z16.enum([
2095
2247
  "conflict_error"
2096
2248
  // Resource conflict (409)
2097
2249
  ]);
2098
- var publicApiErrorSchema = z16.object({
2099
- error: z16.object({
2250
+ var publicApiErrorSchema = z17.object({
2251
+ error: z17.object({
2100
2252
  type: publicApiErrorTypeSchema,
2101
- code: z16.string(),
2102
- message: z16.string(),
2103
- param: z16.string().optional(),
2104
- doc_url: z16.string().url().optional()
2253
+ code: z17.string(),
2254
+ message: z17.string(),
2255
+ param: z17.string().optional(),
2256
+ doc_url: z17.string().url().optional()
2105
2257
  })
2106
2258
  });
2107
- var paginationSchema = z16.object({
2108
- has_more: z16.boolean(),
2109
- next_cursor: z16.string().nullable()
2259
+ var paginationSchema = z17.object({
2260
+ has_more: z17.boolean(),
2261
+ next_cursor: z17.string().nullable()
2110
2262
  });
2111
2263
  function createPaginatedResponseSchema(dataSchema) {
2112
- return z16.object({
2113
- data: z16.array(dataSchema),
2264
+ return z17.object({
2265
+ data: z17.array(dataSchema),
2114
2266
  pagination: paginationSchema
2115
2267
  });
2116
2268
  }
2117
- var listQuerySchema = z16.object({
2118
- cursor: z16.string().optional(),
2119
- limit: z16.coerce.number().min(1).max(100).default(20)
2269
+ var listQuerySchema = z17.object({
2270
+ cursor: z17.string().optional(),
2271
+ limit: z17.coerce.number().min(1).max(100).default(20)
2120
2272
  });
2121
- var requestIdSchema = z16.string().uuid();
2122
- var timestampSchema = z16.string().datetime();
2273
+ var requestIdSchema = z17.string().uuid();
2274
+ var timestampSchema = z17.string().datetime();
2123
2275
 
2124
2276
  // ../../packages/core/src/contracts/public/agents.ts
2125
- import { z as z17 } from "zod";
2126
- var c14 = initContract();
2127
- var publicAgentSchema = z17.object({
2128
- id: z17.string(),
2129
- name: z17.string(),
2130
- current_version_id: z17.string().nullable(),
2277
+ import { z as z18 } from "zod";
2278
+ var c15 = initContract();
2279
+ var publicAgentSchema = z18.object({
2280
+ id: z18.string(),
2281
+ name: z18.string(),
2282
+ current_version_id: z18.string().nullable(),
2131
2283
  created_at: timestampSchema,
2132
2284
  updated_at: timestampSchema
2133
2285
  });
2134
- var agentVersionSchema = z17.object({
2135
- id: z17.string(),
2136
- agent_id: z17.string(),
2137
- version_number: z17.number(),
2286
+ var agentVersionSchema = z18.object({
2287
+ id: z18.string(),
2288
+ agent_id: z18.string(),
2289
+ version_number: z18.number(),
2138
2290
  created_at: timestampSchema
2139
2291
  });
2140
2292
  var publicAgentDetailSchema = publicAgentSchema;
2141
2293
  var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
2142
2294
  var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
2143
2295
  var agentListQuerySchema = listQuerySchema.extend({
2144
- name: z17.string().optional()
2296
+ name: z18.string().optional()
2145
2297
  });
2146
- var publicAgentsListContract = c14.router({
2298
+ var publicAgentsListContract = c15.router({
2147
2299
  list: {
2148
2300
  method: "GET",
2149
2301
  path: "/v1/agents",
@@ -2157,12 +2309,12 @@ var publicAgentsListContract = c14.router({
2157
2309
  description: "List all agents in the current scope with pagination. Use the `name` query parameter to filter by agent name."
2158
2310
  }
2159
2311
  });
2160
- var publicAgentByIdContract = c14.router({
2312
+ var publicAgentByIdContract = c15.router({
2161
2313
  get: {
2162
2314
  method: "GET",
2163
2315
  path: "/v1/agents/:id",
2164
- pathParams: z17.object({
2165
- id: z17.string().min(1, "Agent ID is required")
2316
+ pathParams: z18.object({
2317
+ id: z18.string().min(1, "Agent ID is required")
2166
2318
  }),
2167
2319
  responses: {
2168
2320
  200: publicAgentDetailSchema,
@@ -2174,12 +2326,12 @@ var publicAgentByIdContract = c14.router({
2174
2326
  description: "Get agent details by ID"
2175
2327
  }
2176
2328
  });
2177
- var publicAgentVersionsContract = c14.router({
2329
+ var publicAgentVersionsContract = c15.router({
2178
2330
  list: {
2179
2331
  method: "GET",
2180
2332
  path: "/v1/agents/:id/versions",
2181
- pathParams: z17.object({
2182
- id: z17.string().min(1, "Agent ID is required")
2333
+ pathParams: z18.object({
2334
+ id: z18.string().min(1, "Agent ID is required")
2183
2335
  }),
2184
2336
  query: listQuerySchema,
2185
2337
  responses: {
@@ -2194,9 +2346,9 @@ var publicAgentVersionsContract = c14.router({
2194
2346
  });
2195
2347
 
2196
2348
  // ../../packages/core/src/contracts/public/runs.ts
2197
- import { z as z18 } from "zod";
2198
- var c15 = initContract();
2199
- var publicRunStatusSchema = z18.enum([
2349
+ import { z as z19 } from "zod";
2350
+ var c16 = initContract();
2351
+ var publicRunStatusSchema = z19.enum([
2200
2352
  "pending",
2201
2353
  "running",
2202
2354
  "completed",
@@ -2204,56 +2356,56 @@ var publicRunStatusSchema = z18.enum([
2204
2356
  "timeout",
2205
2357
  "cancelled"
2206
2358
  ]);
2207
- var publicRunSchema = z18.object({
2208
- id: z18.string(),
2209
- agent_id: z18.string(),
2210
- agent_name: z18.string(),
2359
+ var publicRunSchema = z19.object({
2360
+ id: z19.string(),
2361
+ agent_id: z19.string(),
2362
+ agent_name: z19.string(),
2211
2363
  status: publicRunStatusSchema,
2212
- prompt: z18.string(),
2364
+ prompt: z19.string(),
2213
2365
  created_at: timestampSchema,
2214
2366
  started_at: timestampSchema.nullable(),
2215
2367
  completed_at: timestampSchema.nullable()
2216
2368
  });
2217
2369
  var publicRunDetailSchema = publicRunSchema.extend({
2218
- error: z18.string().nullable(),
2219
- execution_time_ms: z18.number().nullable(),
2220
- checkpoint_id: z18.string().nullable(),
2221
- session_id: z18.string().nullable(),
2222
- artifact_name: z18.string().nullable(),
2223
- artifact_version: z18.string().nullable(),
2224
- volumes: z18.record(z18.string(), z18.string()).optional()
2370
+ error: z19.string().nullable(),
2371
+ execution_time_ms: z19.number().nullable(),
2372
+ checkpoint_id: z19.string().nullable(),
2373
+ session_id: z19.string().nullable(),
2374
+ artifact_name: z19.string().nullable(),
2375
+ artifact_version: z19.string().nullable(),
2376
+ volumes: z19.record(z19.string(), z19.string()).optional()
2225
2377
  });
2226
2378
  var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
2227
- var createRunRequestSchema = z18.object({
2379
+ var createRunRequestSchema = z19.object({
2228
2380
  // Agent identification (one of: agent, agent_id, session_id, checkpoint_id)
2229
- agent: z18.string().optional(),
2381
+ agent: z19.string().optional(),
2230
2382
  // Agent name
2231
- agent_id: z18.string().optional(),
2383
+ agent_id: z19.string().optional(),
2232
2384
  // Agent ID
2233
- agent_version: z18.string().optional(),
2385
+ agent_version: z19.string().optional(),
2234
2386
  // Version specifier (e.g., "latest", "v1", specific ID)
2235
2387
  // Continue session
2236
- session_id: z18.string().optional(),
2388
+ session_id: z19.string().optional(),
2237
2389
  // Resume from checkpoint
2238
- checkpoint_id: z18.string().optional(),
2390
+ checkpoint_id: z19.string().optional(),
2239
2391
  // Required
2240
- prompt: z18.string().min(1, "Prompt is required"),
2392
+ prompt: z19.string().min(1, "Prompt is required"),
2241
2393
  // Optional configuration
2242
- variables: z18.record(z18.string(), z18.string()).optional(),
2243
- secrets: z18.record(z18.string(), z18.string()).optional(),
2244
- artifact_name: z18.string().optional(),
2394
+ variables: z19.record(z19.string(), z19.string()).optional(),
2395
+ secrets: z19.record(z19.string(), z19.string()).optional(),
2396
+ artifact_name: z19.string().optional(),
2245
2397
  // Artifact name to mount
2246
- artifact_version: z18.string().optional(),
2398
+ artifact_version: z19.string().optional(),
2247
2399
  // Artifact version (defaults to latest)
2248
- volumes: z18.record(z18.string(), z18.string()).optional()
2400
+ volumes: z19.record(z19.string(), z19.string()).optional()
2249
2401
  // volume_name -> version
2250
2402
  });
2251
2403
  var runListQuerySchema = listQuerySchema.extend({
2252
- agent_id: z18.string().optional(),
2404
+ agent_id: z19.string().optional(),
2253
2405
  status: publicRunStatusSchema.optional(),
2254
2406
  since: timestampSchema.optional()
2255
2407
  });
2256
- var publicRunsListContract = c15.router({
2408
+ var publicRunsListContract = c16.router({
2257
2409
  list: {
2258
2410
  method: "GET",
2259
2411
  path: "/v1/runs",
@@ -2282,12 +2434,12 @@ var publicRunsListContract = c15.router({
2282
2434
  description: "Create and execute a new agent run. Returns 202 Accepted as runs execute asynchronously."
2283
2435
  }
2284
2436
  });
2285
- var publicRunByIdContract = c15.router({
2437
+ var publicRunByIdContract = c16.router({
2286
2438
  get: {
2287
2439
  method: "GET",
2288
2440
  path: "/v1/runs/:id",
2289
- pathParams: z18.object({
2290
- id: z18.string().min(1, "Run ID is required")
2441
+ pathParams: z19.object({
2442
+ id: z19.string().min(1, "Run ID is required")
2291
2443
  }),
2292
2444
  responses: {
2293
2445
  200: publicRunDetailSchema,
@@ -2299,14 +2451,14 @@ var publicRunByIdContract = c15.router({
2299
2451
  description: "Get run details by ID"
2300
2452
  }
2301
2453
  });
2302
- var publicRunCancelContract = c15.router({
2454
+ var publicRunCancelContract = c16.router({
2303
2455
  cancel: {
2304
2456
  method: "POST",
2305
2457
  path: "/v1/runs/:id/cancel",
2306
- pathParams: z18.object({
2307
- id: z18.string().min(1, "Run ID is required")
2458
+ pathParams: z19.object({
2459
+ id: z19.string().min(1, "Run ID is required")
2308
2460
  }),
2309
- body: z18.undefined(),
2461
+ body: z19.undefined(),
2310
2462
  responses: {
2311
2463
  200: publicRunDetailSchema,
2312
2464
  400: publicApiErrorSchema,
@@ -2319,26 +2471,26 @@ var publicRunCancelContract = c15.router({
2319
2471
  description: "Cancel a pending or running execution"
2320
2472
  }
2321
2473
  });
2322
- var logEntrySchema = z18.object({
2474
+ var logEntrySchema = z19.object({
2323
2475
  timestamp: timestampSchema,
2324
- type: z18.enum(["agent", "system", "network"]),
2325
- level: z18.enum(["debug", "info", "warn", "error"]),
2326
- message: z18.string(),
2327
- metadata: z18.record(z18.string(), z18.unknown()).optional()
2476
+ type: z19.enum(["agent", "system", "network"]),
2477
+ level: z19.enum(["debug", "info", "warn", "error"]),
2478
+ message: z19.string(),
2479
+ metadata: z19.record(z19.string(), z19.unknown()).optional()
2328
2480
  });
2329
2481
  var paginatedLogsSchema = createPaginatedResponseSchema(logEntrySchema);
2330
2482
  var logsQuerySchema = listQuerySchema.extend({
2331
- type: z18.enum(["agent", "system", "network", "all"]).default("all"),
2483
+ type: z19.enum(["agent", "system", "network", "all"]).default("all"),
2332
2484
  since: timestampSchema.optional(),
2333
2485
  until: timestampSchema.optional(),
2334
- order: z18.enum(["asc", "desc"]).default("asc")
2486
+ order: z19.enum(["asc", "desc"]).default("asc")
2335
2487
  });
2336
- var publicRunLogsContract = c15.router({
2488
+ var publicRunLogsContract = c16.router({
2337
2489
  getLogs: {
2338
2490
  method: "GET",
2339
2491
  path: "/v1/runs/:id/logs",
2340
- pathParams: z18.object({
2341
- id: z18.string().min(1, "Run ID is required")
2492
+ pathParams: z19.object({
2493
+ id: z19.string().min(1, "Run ID is required")
2342
2494
  }),
2343
2495
  query: logsQuerySchema,
2344
2496
  responses: {
@@ -2351,29 +2503,29 @@ var publicRunLogsContract = c15.router({
2351
2503
  description: "Get unified logs for a run. Combines agent, system, and network logs."
2352
2504
  }
2353
2505
  });
2354
- var metricPointSchema = z18.object({
2506
+ var metricPointSchema = z19.object({
2355
2507
  timestamp: timestampSchema,
2356
- cpu_percent: z18.number(),
2357
- memory_used_mb: z18.number(),
2358
- memory_total_mb: z18.number(),
2359
- disk_used_mb: z18.number(),
2360
- disk_total_mb: z18.number()
2361
- });
2362
- var metricsSummarySchema = z18.object({
2363
- avg_cpu_percent: z18.number(),
2364
- max_memory_used_mb: z18.number(),
2365
- total_duration_ms: z18.number().nullable()
2366
- });
2367
- var metricsResponseSchema2 = z18.object({
2368
- data: z18.array(metricPointSchema),
2508
+ cpu_percent: z19.number(),
2509
+ memory_used_mb: z19.number(),
2510
+ memory_total_mb: z19.number(),
2511
+ disk_used_mb: z19.number(),
2512
+ disk_total_mb: z19.number()
2513
+ });
2514
+ var metricsSummarySchema = z19.object({
2515
+ avg_cpu_percent: z19.number(),
2516
+ max_memory_used_mb: z19.number(),
2517
+ total_duration_ms: z19.number().nullable()
2518
+ });
2519
+ var metricsResponseSchema2 = z19.object({
2520
+ data: z19.array(metricPointSchema),
2369
2521
  summary: metricsSummarySchema
2370
2522
  });
2371
- var publicRunMetricsContract = c15.router({
2523
+ var publicRunMetricsContract = c16.router({
2372
2524
  getMetrics: {
2373
2525
  method: "GET",
2374
2526
  path: "/v1/runs/:id/metrics",
2375
- pathParams: z18.object({
2376
- id: z18.string().min(1, "Run ID is required")
2527
+ pathParams: z19.object({
2528
+ id: z19.string().min(1, "Run ID is required")
2377
2529
  }),
2378
2530
  responses: {
2379
2531
  200: metricsResponseSchema2,
@@ -2385,7 +2537,7 @@ var publicRunMetricsContract = c15.router({
2385
2537
  description: "Get CPU, memory, and disk metrics for a run"
2386
2538
  }
2387
2539
  });
2388
- var sseEventTypeSchema = z18.enum([
2540
+ var sseEventTypeSchema = z19.enum([
2389
2541
  "status",
2390
2542
  // Run status change
2391
2543
  "output",
@@ -2397,25 +2549,25 @@ var sseEventTypeSchema = z18.enum([
2397
2549
  "heartbeat"
2398
2550
  // Keep-alive
2399
2551
  ]);
2400
- var sseEventSchema = z18.object({
2552
+ var sseEventSchema = z19.object({
2401
2553
  event: sseEventTypeSchema,
2402
- data: z18.unknown(),
2403
- id: z18.string().optional()
2554
+ data: z19.unknown(),
2555
+ id: z19.string().optional()
2404
2556
  // For Last-Event-ID reconnection
2405
2557
  });
2406
- var publicRunEventsContract = c15.router({
2558
+ var publicRunEventsContract = c16.router({
2407
2559
  streamEvents: {
2408
2560
  method: "GET",
2409
2561
  path: "/v1/runs/:id/events",
2410
- pathParams: z18.object({
2411
- id: z18.string().min(1, "Run ID is required")
2562
+ pathParams: z19.object({
2563
+ id: z19.string().min(1, "Run ID is required")
2412
2564
  }),
2413
- query: z18.object({
2414
- last_event_id: z18.string().optional()
2565
+ query: z19.object({
2566
+ last_event_id: z19.string().optional()
2415
2567
  // For reconnection
2416
2568
  }),
2417
2569
  responses: {
2418
- 200: z18.any(),
2570
+ 200: z19.any(),
2419
2571
  // SSE stream - actual content is text/event-stream
2420
2572
  401: publicApiErrorSchema,
2421
2573
  404: publicApiErrorSchema,
@@ -2427,28 +2579,28 @@ var publicRunEventsContract = c15.router({
2427
2579
  });
2428
2580
 
2429
2581
  // ../../packages/core/src/contracts/public/artifacts.ts
2430
- import { z as z19 } from "zod";
2431
- var c16 = initContract();
2432
- var publicArtifactSchema = z19.object({
2433
- id: z19.string(),
2434
- name: z19.string(),
2435
- current_version_id: z19.string().nullable(),
2436
- size: z19.number(),
2582
+ import { z as z20 } from "zod";
2583
+ var c17 = initContract();
2584
+ var publicArtifactSchema = z20.object({
2585
+ id: z20.string(),
2586
+ name: z20.string(),
2587
+ current_version_id: z20.string().nullable(),
2588
+ size: z20.number(),
2437
2589
  // Total size in bytes
2438
- file_count: z19.number(),
2590
+ file_count: z20.number(),
2439
2591
  created_at: timestampSchema,
2440
2592
  updated_at: timestampSchema
2441
2593
  });
2442
- var artifactVersionSchema = z19.object({
2443
- id: z19.string(),
2594
+ var artifactVersionSchema = z20.object({
2595
+ id: z20.string(),
2444
2596
  // SHA-256 content hash
2445
- artifact_id: z19.string(),
2446
- size: z19.number(),
2597
+ artifact_id: z20.string(),
2598
+ size: z20.number(),
2447
2599
  // Size in bytes
2448
- file_count: z19.number(),
2449
- message: z19.string().nullable(),
2600
+ file_count: z20.number(),
2601
+ message: z20.string().nullable(),
2450
2602
  // Optional commit message
2451
- created_by: z19.string(),
2603
+ created_by: z20.string(),
2452
2604
  created_at: timestampSchema
2453
2605
  });
2454
2606
  var publicArtifactDetailSchema = publicArtifactSchema.extend({
@@ -2458,7 +2610,7 @@ var paginatedArtifactsSchema = createPaginatedResponseSchema(publicArtifactSchem
2458
2610
  var paginatedArtifactVersionsSchema = createPaginatedResponseSchema(
2459
2611
  artifactVersionSchema
2460
2612
  );
2461
- var publicArtifactsListContract = c16.router({
2613
+ var publicArtifactsListContract = c17.router({
2462
2614
  list: {
2463
2615
  method: "GET",
2464
2616
  path: "/v1/artifacts",
@@ -2472,12 +2624,12 @@ var publicArtifactsListContract = c16.router({
2472
2624
  description: "List all artifacts in the current scope with pagination"
2473
2625
  }
2474
2626
  });
2475
- var publicArtifactByIdContract = c16.router({
2627
+ var publicArtifactByIdContract = c17.router({
2476
2628
  get: {
2477
2629
  method: "GET",
2478
2630
  path: "/v1/artifacts/:id",
2479
- pathParams: z19.object({
2480
- id: z19.string().min(1, "Artifact ID is required")
2631
+ pathParams: z20.object({
2632
+ id: z20.string().min(1, "Artifact ID is required")
2481
2633
  }),
2482
2634
  responses: {
2483
2635
  200: publicArtifactDetailSchema,
@@ -2489,12 +2641,12 @@ var publicArtifactByIdContract = c16.router({
2489
2641
  description: "Get artifact details by ID"
2490
2642
  }
2491
2643
  });
2492
- var publicArtifactVersionsContract = c16.router({
2644
+ var publicArtifactVersionsContract = c17.router({
2493
2645
  list: {
2494
2646
  method: "GET",
2495
2647
  path: "/v1/artifacts/:id/versions",
2496
- pathParams: z19.object({
2497
- id: z19.string().min(1, "Artifact ID is required")
2648
+ pathParams: z20.object({
2649
+ id: z20.string().min(1, "Artifact ID is required")
2498
2650
  }),
2499
2651
  query: listQuerySchema,
2500
2652
  responses: {
@@ -2507,19 +2659,19 @@ var publicArtifactVersionsContract = c16.router({
2507
2659
  description: "List all versions of an artifact with pagination"
2508
2660
  }
2509
2661
  });
2510
- var publicArtifactDownloadContract = c16.router({
2662
+ var publicArtifactDownloadContract = c17.router({
2511
2663
  download: {
2512
2664
  method: "GET",
2513
2665
  path: "/v1/artifacts/:id/download",
2514
- pathParams: z19.object({
2515
- id: z19.string().min(1, "Artifact ID is required")
2666
+ pathParams: z20.object({
2667
+ id: z20.string().min(1, "Artifact ID is required")
2516
2668
  }),
2517
- query: z19.object({
2518
- version_id: z19.string().optional()
2669
+ query: z20.object({
2670
+ version_id: z20.string().optional()
2519
2671
  // Defaults to current version
2520
2672
  }),
2521
2673
  responses: {
2522
- 302: z19.undefined(),
2674
+ 302: z20.undefined(),
2523
2675
  // Redirect to presigned URL
2524
2676
  401: publicApiErrorSchema,
2525
2677
  404: publicApiErrorSchema,
@@ -2531,28 +2683,28 @@ var publicArtifactDownloadContract = c16.router({
2531
2683
  });
2532
2684
 
2533
2685
  // ../../packages/core/src/contracts/public/volumes.ts
2534
- import { z as z20 } from "zod";
2535
- var c17 = initContract();
2536
- var publicVolumeSchema = z20.object({
2537
- id: z20.string(),
2538
- name: z20.string(),
2539
- current_version_id: z20.string().nullable(),
2540
- size: z20.number(),
2686
+ import { z as z21 } from "zod";
2687
+ var c18 = initContract();
2688
+ var publicVolumeSchema = z21.object({
2689
+ id: z21.string(),
2690
+ name: z21.string(),
2691
+ current_version_id: z21.string().nullable(),
2692
+ size: z21.number(),
2541
2693
  // Total size in bytes
2542
- file_count: z20.number(),
2694
+ file_count: z21.number(),
2543
2695
  created_at: timestampSchema,
2544
2696
  updated_at: timestampSchema
2545
2697
  });
2546
- var volumeVersionSchema = z20.object({
2547
- id: z20.string(),
2698
+ var volumeVersionSchema = z21.object({
2699
+ id: z21.string(),
2548
2700
  // SHA-256 content hash
2549
- volume_id: z20.string(),
2550
- size: z20.number(),
2701
+ volume_id: z21.string(),
2702
+ size: z21.number(),
2551
2703
  // Size in bytes
2552
- file_count: z20.number(),
2553
- message: z20.string().nullable(),
2704
+ file_count: z21.number(),
2705
+ message: z21.string().nullable(),
2554
2706
  // Optional commit message
2555
- created_by: z20.string(),
2707
+ created_by: z21.string(),
2556
2708
  created_at: timestampSchema
2557
2709
  });
2558
2710
  var publicVolumeDetailSchema = publicVolumeSchema.extend({
@@ -2560,7 +2712,7 @@ var publicVolumeDetailSchema = publicVolumeSchema.extend({
2560
2712
  });
2561
2713
  var paginatedVolumesSchema = createPaginatedResponseSchema(publicVolumeSchema);
2562
2714
  var paginatedVolumeVersionsSchema = createPaginatedResponseSchema(volumeVersionSchema);
2563
- var publicVolumesListContract = c17.router({
2715
+ var publicVolumesListContract = c18.router({
2564
2716
  list: {
2565
2717
  method: "GET",
2566
2718
  path: "/v1/volumes",
@@ -2574,12 +2726,12 @@ var publicVolumesListContract = c17.router({
2574
2726
  description: "List all volumes in the current scope with pagination"
2575
2727
  }
2576
2728
  });
2577
- var publicVolumeByIdContract = c17.router({
2729
+ var publicVolumeByIdContract = c18.router({
2578
2730
  get: {
2579
2731
  method: "GET",
2580
2732
  path: "/v1/volumes/:id",
2581
- pathParams: z20.object({
2582
- id: z20.string().min(1, "Volume ID is required")
2733
+ pathParams: z21.object({
2734
+ id: z21.string().min(1, "Volume ID is required")
2583
2735
  }),
2584
2736
  responses: {
2585
2737
  200: publicVolumeDetailSchema,
@@ -2591,12 +2743,12 @@ var publicVolumeByIdContract = c17.router({
2591
2743
  description: "Get volume details by ID"
2592
2744
  }
2593
2745
  });
2594
- var publicVolumeVersionsContract = c17.router({
2746
+ var publicVolumeVersionsContract = c18.router({
2595
2747
  list: {
2596
2748
  method: "GET",
2597
2749
  path: "/v1/volumes/:id/versions",
2598
- pathParams: z20.object({
2599
- id: z20.string().min(1, "Volume ID is required")
2750
+ pathParams: z21.object({
2751
+ id: z21.string().min(1, "Volume ID is required")
2600
2752
  }),
2601
2753
  query: listQuerySchema,
2602
2754
  responses: {
@@ -2609,19 +2761,19 @@ var publicVolumeVersionsContract = c17.router({
2609
2761
  description: "List all versions of a volume with pagination"
2610
2762
  }
2611
2763
  });
2612
- var publicVolumeDownloadContract = c17.router({
2764
+ var publicVolumeDownloadContract = c18.router({
2613
2765
  download: {
2614
2766
  method: "GET",
2615
2767
  path: "/v1/volumes/:id/download",
2616
- pathParams: z20.object({
2617
- id: z20.string().min(1, "Volume ID is required")
2768
+ pathParams: z21.object({
2769
+ id: z21.string().min(1, "Volume ID is required")
2618
2770
  }),
2619
- query: z20.object({
2620
- version_id: z20.string().optional()
2771
+ query: z21.object({
2772
+ version_id: z21.string().optional()
2621
2773
  // Defaults to current version
2622
2774
  }),
2623
2775
  responses: {
2624
- 302: z20.undefined(),
2776
+ 302: z21.undefined(),
2625
2777
  // Redirect to presigned URL
2626
2778
  401: publicApiErrorSchema,
2627
2779
  404: publicApiErrorSchema,
@@ -3091,6 +3243,71 @@ async function deleteCredential(name) {
3091
3243
  handleError(result, `Credential "${name}" not found`);
3092
3244
  }
3093
3245
 
3246
+ // src/lib/api/domains/model-providers.ts
3247
+ import { initClient as initClient8 } from "@ts-rest/core";
3248
+ async function listModelProviders() {
3249
+ const config = await getClientConfig();
3250
+ const client = initClient8(modelProvidersMainContract, config);
3251
+ const result = await client.list();
3252
+ if (result.status === 200) {
3253
+ return result.body;
3254
+ }
3255
+ handleError(result, "Failed to list model providers");
3256
+ }
3257
+ async function upsertModelProvider(body) {
3258
+ const config = await getClientConfig();
3259
+ const client = initClient8(modelProvidersMainContract, config);
3260
+ const result = await client.upsert({ body });
3261
+ if (result.status === 200 || result.status === 201) {
3262
+ return result.body;
3263
+ }
3264
+ handleError(result, "Failed to set model provider");
3265
+ }
3266
+ async function checkModelProviderCredential(type) {
3267
+ const config = await getClientConfig();
3268
+ const client = initClient8(modelProvidersCheckContract, config);
3269
+ const result = await client.check({
3270
+ params: { type }
3271
+ });
3272
+ if (result.status === 200) {
3273
+ return result.body;
3274
+ }
3275
+ handleError(result, "Failed to check credential");
3276
+ }
3277
+ async function deleteModelProvider(type) {
3278
+ const config = await getClientConfig();
3279
+ const client = initClient8(modelProvidersByTypeContract, config);
3280
+ const result = await client.delete({
3281
+ params: { type }
3282
+ });
3283
+ if (result.status === 204) {
3284
+ return;
3285
+ }
3286
+ handleError(result, `Model provider "${type}" not found`);
3287
+ }
3288
+ async function convertModelProviderCredential(type) {
3289
+ const config = await getClientConfig();
3290
+ const client = initClient8(modelProvidersConvertContract, config);
3291
+ const result = await client.convert({
3292
+ params: { type }
3293
+ });
3294
+ if (result.status === 200) {
3295
+ return result.body;
3296
+ }
3297
+ handleError(result, "Failed to convert credential");
3298
+ }
3299
+ async function setModelProviderDefault(type) {
3300
+ const config = await getClientConfig();
3301
+ const client = initClient8(modelProvidersSetDefaultContract, config);
3302
+ const result = await client.setDefault({
3303
+ params: { type }
3304
+ });
3305
+ if (result.status === 200) {
3306
+ return result.body;
3307
+ }
3308
+ handleError(result, "Failed to set default model provider");
3309
+ }
3310
+
3094
3311
  // src/lib/api/domains/usage.ts
3095
3312
  async function getUsage(options) {
3096
3313
  const baseUrl = await getBaseUrl();
@@ -3111,7 +3328,7 @@ async function getUsage(options) {
3111
3328
  }
3112
3329
 
3113
3330
  // src/lib/domain/yaml-validator.ts
3114
- import { z as z21 } from "zod";
3331
+ import { z as z22 } from "zod";
3115
3332
 
3116
3333
  // src/lib/domain/framework-config.ts
3117
3334
  var FRAMEWORK_DEFAULTS = {
@@ -3178,7 +3395,7 @@ function getDefaultImageWithApps(framework, apps) {
3178
3395
  }
3179
3396
 
3180
3397
  // src/lib/domain/yaml-validator.ts
3181
- var cliAgentNameSchema = z21.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
3398
+ var cliAgentNameSchema = z22.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
3182
3399
  /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
3183
3400
  "Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
3184
3401
  );
@@ -3191,14 +3408,14 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
3191
3408
  const frameworkSupported = isFrameworkSupported(agent.framework);
3192
3409
  if (!agent.image && !frameworkSupported) {
3193
3410
  ctx.addIssue({
3194
- code: z21.ZodIssueCode.custom,
3411
+ code: z22.ZodIssueCode.custom,
3195
3412
  message: "Missing agent.image (required when framework is not auto-configured)",
3196
3413
  path: ["image"]
3197
3414
  });
3198
3415
  }
3199
3416
  if (!agent.working_dir && !frameworkSupported) {
3200
3417
  ctx.addIssue({
3201
- code: z21.ZodIssueCode.custom,
3418
+ code: z22.ZodIssueCode.custom,
3202
3419
  message: "Missing agent.working_dir (required when framework is not auto-configured)",
3203
3420
  path: ["working_dir"]
3204
3421
  });
@@ -3208,7 +3425,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
3208
3425
  const skillUrl = agent.skills[i];
3209
3426
  if (skillUrl && !validateGitHubTreeUrl(skillUrl)) {
3210
3427
  ctx.addIssue({
3211
- code: z21.ZodIssueCode.custom,
3428
+ code: z22.ZodIssueCode.custom,
3212
3429
  message: `Invalid skill URL: ${skillUrl}. Expected format: https://github.com/{owner}/{repo}/tree/{branch}/{path}`,
3213
3430
  path: ["skills", i]
3214
3431
  });
@@ -3217,15 +3434,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
3217
3434
  }
3218
3435
  }
3219
3436
  );
3220
- var cliComposeSchema = z21.object({
3221
- version: z21.string().min(1, "Missing config.version"),
3222
- agents: z21.record(cliAgentNameSchema, cliAgentDefinitionSchema),
3223
- volumes: z21.record(z21.string(), volumeConfigSchema).optional()
3437
+ var cliComposeSchema = z22.object({
3438
+ version: z22.string().min(1, "Missing config.version"),
3439
+ agents: z22.record(cliAgentNameSchema, cliAgentDefinitionSchema),
3440
+ volumes: z22.record(z22.string(), volumeConfigSchema).optional()
3224
3441
  }).superRefine((config, ctx) => {
3225
3442
  const agentKeys = Object.keys(config.agents);
3226
3443
  if (agentKeys.length === 0) {
3227
3444
  ctx.addIssue({
3228
- code: z21.ZodIssueCode.custom,
3445
+ code: z22.ZodIssueCode.custom,
3229
3446
  message: "agents must have at least one agent defined",
3230
3447
  path: ["agents"]
3231
3448
  });
@@ -3233,7 +3450,7 @@ var cliComposeSchema = z21.object({
3233
3450
  }
3234
3451
  if (agentKeys.length > 1) {
3235
3452
  ctx.addIssue({
3236
- code: z21.ZodIssueCode.custom,
3453
+ code: z22.ZodIssueCode.custom,
3237
3454
  message: "Multiple agents not supported yet. Only one agent allowed.",
3238
3455
  path: ["agents"]
3239
3456
  });
@@ -3245,7 +3462,7 @@ var cliComposeSchema = z21.object({
3245
3462
  if (agentVolumes && agentVolumes.length > 0) {
3246
3463
  if (!config.volumes) {
3247
3464
  ctx.addIssue({
3248
- code: z21.ZodIssueCode.custom,
3465
+ code: z22.ZodIssueCode.custom,
3249
3466
  message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
3250
3467
  path: ["volumes"]
3251
3468
  });
@@ -3255,7 +3472,7 @@ var cliComposeSchema = z21.object({
3255
3472
  const parts = volDeclaration.split(":");
3256
3473
  if (parts.length !== 2) {
3257
3474
  ctx.addIssue({
3258
- code: z21.ZodIssueCode.custom,
3475
+ code: z22.ZodIssueCode.custom,
3259
3476
  message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
3260
3477
  path: ["agents", agentName, "volumes"]
3261
3478
  });
@@ -3264,7 +3481,7 @@ var cliComposeSchema = z21.object({
3264
3481
  const volumeKey = parts[0].trim();
3265
3482
  if (!config.volumes[volumeKey]) {
3266
3483
  ctx.addIssue({
3267
- code: z21.ZodIssueCode.custom,
3484
+ code: z22.ZodIssueCode.custom,
3268
3485
  message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
3269
3486
  path: ["volumes", volumeKey]
3270
3487
  });
@@ -4085,7 +4302,7 @@ var composeCommand = new Command().name("compose").description("Create or update
4085
4302
  });
4086
4303
 
4087
4304
  // src/commands/run/run.ts
4088
- import { Command as Command2 } from "commander";
4305
+ import { Command as Command2, Option } from "commander";
4089
4306
  import chalk6 from "chalk";
4090
4307
 
4091
4308
  // src/lib/events/event-renderer.ts
@@ -4540,9 +4757,9 @@ var CodexEventParser = class {
4540
4757
  }
4541
4758
  }
4542
4759
  if (itemType === "file_change" && item.changes && item.changes.length > 0) {
4543
- const changes = item.changes.map((c18) => {
4544
- const action = c18.kind === "add" ? "Created" : c18.kind === "modify" ? "Modified" : "Deleted";
4545
- return `${action}: ${c18.path}`;
4760
+ const changes = item.changes.map((c19) => {
4761
+ const action = c19.kind === "add" ? "Created" : c19.kind === "modify" ? "Modified" : "Deleted";
4762
+ return `${action}: ${c19.path}`;
4546
4763
  }).join("\n");
4547
4764
  return {
4548
4765
  type: "text",
@@ -4695,9 +4912,9 @@ var CodexEventRenderer = class {
4695
4912
  return;
4696
4913
  }
4697
4914
  if (itemType === "file_change" && item.changes && item.changes.length > 0) {
4698
- const summary = item.changes.map((c18) => {
4699
- const icon = c18.kind === "add" ? "+" : c18.kind === "delete" ? "-" : "~";
4700
- return `${icon}${c18.path}`;
4915
+ const summary = item.changes.map((c19) => {
4916
+ const icon = c19.kind === "add" ? "+" : c19.kind === "delete" ? "-" : "~";
4917
+ return `${icon}${c19.path}`;
4701
4918
  }).join(", ");
4702
4919
  console.log(chalk4.green("[files]") + ` ${summary}`);
4703
4920
  return;
@@ -4718,7 +4935,7 @@ var CodexEventRenderer = class {
4718
4935
  };
4719
4936
 
4720
4937
  // src/lib/api/api-client.ts
4721
- import { initClient as initClient8 } from "@ts-rest/core";
4938
+ import { initClient as initClient9 } from "@ts-rest/core";
4722
4939
  var ApiClient = class {
4723
4940
  async getHeaders() {
4724
4941
  const token = await getToken();
@@ -4744,7 +4961,7 @@ var ApiClient = class {
4744
4961
  async getComposeByName(name, scope) {
4745
4962
  const baseUrl = await this.getBaseUrl();
4746
4963
  const headers = await this.getHeaders();
4747
- const client = initClient8(composesMainContract, {
4964
+ const client = initClient9(composesMainContract, {
4748
4965
  baseUrl,
4749
4966
  baseHeaders: headers,
4750
4967
  jsonQuery: true
@@ -4765,7 +4982,7 @@ var ApiClient = class {
4765
4982
  async getComposeById(id) {
4766
4983
  const baseUrl = await this.getBaseUrl();
4767
4984
  const headers = await this.getHeaders();
4768
- const client = initClient8(composesByIdContract, {
4985
+ const client = initClient9(composesByIdContract, {
4769
4986
  baseUrl,
4770
4987
  baseHeaders: headers,
4771
4988
  jsonQuery: true
@@ -4787,7 +5004,7 @@ var ApiClient = class {
4787
5004
  async getComposeVersion(composeId, version) {
4788
5005
  const baseUrl = await this.getBaseUrl();
4789
5006
  const headers = await this.getHeaders();
4790
- const client = initClient8(composesVersionsContract, {
5007
+ const client = initClient9(composesVersionsContract, {
4791
5008
  baseUrl,
4792
5009
  baseHeaders: headers,
4793
5010
  jsonQuery: true
@@ -4808,7 +5025,7 @@ var ApiClient = class {
4808
5025
  async createOrUpdateCompose(body) {
4809
5026
  const baseUrl = await this.getBaseUrl();
4810
5027
  const headers = await this.getHeaders();
4811
- const client = initClient8(composesMainContract, {
5028
+ const client = initClient9(composesMainContract, {
4812
5029
  baseUrl,
4813
5030
  baseHeaders: headers,
4814
5031
  jsonQuery: true
@@ -4831,7 +5048,7 @@ var ApiClient = class {
4831
5048
  async createRun(body) {
4832
5049
  const baseUrl = await this.getBaseUrl();
4833
5050
  const headers = await this.getHeaders();
4834
- const client = initClient8(runsMainContract, {
5051
+ const client = initClient9(runsMainContract, {
4835
5052
  baseUrl,
4836
5053
  baseHeaders: headers,
4837
5054
  jsonQuery: true
@@ -4847,7 +5064,7 @@ var ApiClient = class {
4847
5064
  async getEvents(runId, options) {
4848
5065
  const baseUrl = await this.getBaseUrl();
4849
5066
  const headers = await this.getHeaders();
4850
- const client = initClient8(runEventsContract, {
5067
+ const client = initClient9(runEventsContract, {
4851
5068
  baseUrl,
4852
5069
  baseHeaders: headers,
4853
5070
  jsonQuery: true
@@ -4869,7 +5086,7 @@ var ApiClient = class {
4869
5086
  async getSystemLog(runId, options) {
4870
5087
  const baseUrl = await this.getBaseUrl();
4871
5088
  const headers = await this.getHeaders();
4872
- const client = initClient8(runSystemLogContract, {
5089
+ const client = initClient9(runSystemLogContract, {
4873
5090
  baseUrl,
4874
5091
  baseHeaders: headers,
4875
5092
  jsonQuery: true
@@ -4892,7 +5109,7 @@ var ApiClient = class {
4892
5109
  async getMetrics(runId, options) {
4893
5110
  const baseUrl = await this.getBaseUrl();
4894
5111
  const headers = await this.getHeaders();
4895
- const client = initClient8(runMetricsContract, {
5112
+ const client = initClient9(runMetricsContract, {
4896
5113
  baseUrl,
4897
5114
  baseHeaders: headers,
4898
5115
  jsonQuery: true
@@ -4915,7 +5132,7 @@ var ApiClient = class {
4915
5132
  async getAgentEvents(runId, options) {
4916
5133
  const baseUrl = await this.getBaseUrl();
4917
5134
  const headers = await this.getHeaders();
4918
- const client = initClient8(runAgentEventsContract, {
5135
+ const client = initClient9(runAgentEventsContract, {
4919
5136
  baseUrl,
4920
5137
  baseHeaders: headers,
4921
5138
  jsonQuery: true
@@ -4938,7 +5155,7 @@ var ApiClient = class {
4938
5155
  async getNetworkLogs(runId, options) {
4939
5156
  const baseUrl = await this.getBaseUrl();
4940
5157
  const headers = await this.getHeaders();
4941
- const client = initClient8(runNetworkLogsContract, {
5158
+ const client = initClient9(runNetworkLogsContract, {
4942
5159
  baseUrl,
4943
5160
  baseHeaders: headers,
4944
5161
  jsonQuery: true
@@ -4964,7 +5181,7 @@ var ApiClient = class {
4964
5181
  async getScope() {
4965
5182
  const baseUrl = await this.getBaseUrl();
4966
5183
  const headers = await this.getHeaders();
4967
- const client = initClient8(scopeContract, {
5184
+ const client = initClient9(scopeContract, {
4968
5185
  baseUrl,
4969
5186
  baseHeaders: headers,
4970
5187
  jsonQuery: true
@@ -4983,7 +5200,7 @@ var ApiClient = class {
4983
5200
  async createScope(body) {
4984
5201
  const baseUrl = await this.getBaseUrl();
4985
5202
  const headers = await this.getHeaders();
4986
- const client = initClient8(scopeContract, {
5203
+ const client = initClient9(scopeContract, {
4987
5204
  baseUrl,
4988
5205
  baseHeaders: headers,
4989
5206
  jsonQuery: true
@@ -5002,7 +5219,7 @@ var ApiClient = class {
5002
5219
  async updateScope(body) {
5003
5220
  const baseUrl = await this.getBaseUrl();
5004
5221
  const headers = await this.getHeaders();
5005
- const client = initClient8(scopeContract, {
5222
+ const client = initClient9(scopeContract, {
5006
5223
  baseUrl,
5007
5224
  baseHeaders: headers,
5008
5225
  jsonQuery: true
@@ -5022,7 +5239,7 @@ var ApiClient = class {
5022
5239
  async getSession(sessionId) {
5023
5240
  const baseUrl = await this.getBaseUrl();
5024
5241
  const headers = await this.getHeaders();
5025
- const client = initClient8(sessionsByIdContract, {
5242
+ const client = initClient9(sessionsByIdContract, {
5026
5243
  baseUrl,
5027
5244
  baseHeaders: headers,
5028
5245
  jsonQuery: true
@@ -5044,7 +5261,7 @@ var ApiClient = class {
5044
5261
  async getCheckpoint(checkpointId) {
5045
5262
  const baseUrl = await this.getBaseUrl();
5046
5263
  const headers = await this.getHeaders();
5047
- const client = initClient8(checkpointsByIdContract, {
5264
+ const client = initClient9(checkpointsByIdContract, {
5048
5265
  baseUrl,
5049
5266
  baseHeaders: headers,
5050
5267
  jsonQuery: true
@@ -5065,7 +5282,7 @@ var ApiClient = class {
5065
5282
  async prepareStorage(body) {
5066
5283
  const baseUrl = await this.getBaseUrl();
5067
5284
  const headers = await this.getHeaders();
5068
- const client = initClient8(storagesPrepareContract, {
5285
+ const client = initClient9(storagesPrepareContract, {
5069
5286
  baseUrl,
5070
5287
  baseHeaders: headers,
5071
5288
  jsonQuery: true
@@ -5084,7 +5301,7 @@ var ApiClient = class {
5084
5301
  async commitStorage(body) {
5085
5302
  const baseUrl = await this.getBaseUrl();
5086
5303
  const headers = await this.getHeaders();
5087
- const client = initClient8(storagesCommitContract, {
5304
+ const client = initClient9(storagesCommitContract, {
5088
5305
  baseUrl,
5089
5306
  baseHeaders: headers,
5090
5307
  jsonQuery: true
@@ -5103,7 +5320,7 @@ var ApiClient = class {
5103
5320
  async getStorageDownload(query) {
5104
5321
  const baseUrl = await this.getBaseUrl();
5105
5322
  const headers = await this.getHeaders();
5106
- const client = initClient8(storagesDownloadContract, {
5323
+ const client = initClient9(storagesDownloadContract, {
5107
5324
  baseUrl,
5108
5325
  baseHeaders: headers,
5109
5326
  jsonQuery: true
@@ -5128,7 +5345,7 @@ var ApiClient = class {
5128
5345
  async listStorages(query) {
5129
5346
  const baseUrl = await this.getBaseUrl();
5130
5347
  const headers = await this.getHeaders();
5131
- const client = initClient8(storagesListContract, {
5348
+ const client = initClient9(storagesListContract, {
5132
5349
  baseUrl,
5133
5350
  baseHeaders: headers,
5134
5351
  jsonQuery: true
@@ -5147,7 +5364,7 @@ var ApiClient = class {
5147
5364
  async deploySchedule(body) {
5148
5365
  const baseUrl = await this.getBaseUrl();
5149
5366
  const headers = await this.getHeaders();
5150
- const client = initClient8(schedulesMainContract, {
5367
+ const client = initClient9(schedulesMainContract, {
5151
5368
  baseUrl,
5152
5369
  baseHeaders: headers,
5153
5370
  jsonQuery: true
@@ -5166,7 +5383,7 @@ var ApiClient = class {
5166
5383
  async listSchedules() {
5167
5384
  const baseUrl = await this.getBaseUrl();
5168
5385
  const headers = await this.getHeaders();
5169
- const client = initClient8(schedulesMainContract, {
5386
+ const client = initClient9(schedulesMainContract, {
5170
5387
  baseUrl,
5171
5388
  baseHeaders: headers,
5172
5389
  jsonQuery: true
@@ -5185,7 +5402,7 @@ var ApiClient = class {
5185
5402
  async getScheduleByName(params) {
5186
5403
  const baseUrl = await this.getBaseUrl();
5187
5404
  const headers = await this.getHeaders();
5188
- const client = initClient8(schedulesByNameContract, {
5405
+ const client = initClient9(schedulesByNameContract, {
5189
5406
  baseUrl,
5190
5407
  baseHeaders: headers,
5191
5408
  jsonQuery: true
@@ -5207,7 +5424,7 @@ var ApiClient = class {
5207
5424
  async deleteSchedule(params) {
5208
5425
  const baseUrl = await this.getBaseUrl();
5209
5426
  const headers = await this.getHeaders();
5210
- const client = initClient8(schedulesByNameContract, {
5427
+ const client = initClient9(schedulesByNameContract, {
5211
5428
  baseUrl,
5212
5429
  baseHeaders: headers,
5213
5430
  jsonQuery: true
@@ -5229,7 +5446,7 @@ var ApiClient = class {
5229
5446
  async enableSchedule(params) {
5230
5447
  const baseUrl = await this.getBaseUrl();
5231
5448
  const headers = await this.getHeaders();
5232
- const client = initClient8(schedulesEnableContract, {
5449
+ const client = initClient9(schedulesEnableContract, {
5233
5450
  baseUrl,
5234
5451
  baseHeaders: headers,
5235
5452
  jsonQuery: true
@@ -5251,7 +5468,7 @@ var ApiClient = class {
5251
5468
  async disableSchedule(params) {
5252
5469
  const baseUrl = await this.getBaseUrl();
5253
5470
  const headers = await this.getHeaders();
5254
- const client = initClient8(schedulesEnableContract, {
5471
+ const client = initClient9(schedulesEnableContract, {
5255
5472
  baseUrl,
5256
5473
  baseHeaders: headers,
5257
5474
  jsonQuery: true
@@ -5273,7 +5490,7 @@ var ApiClient = class {
5273
5490
  async listScheduleRuns(params) {
5274
5491
  const baseUrl = await this.getBaseUrl();
5275
5492
  const headers = await this.getHeaders();
5276
- const client = initClient8(scheduleRunsContract, {
5493
+ const client = initClient9(scheduleRunsContract, {
5277
5494
  baseUrl,
5278
5495
  baseHeaders: headers,
5279
5496
  jsonQuery: true
@@ -5298,7 +5515,7 @@ var ApiClient = class {
5298
5515
  async listPublicAgents(query) {
5299
5516
  const baseUrl = await this.getBaseUrl();
5300
5517
  const headers = await this.getHeaders();
5301
- const client = initClient8(publicAgentsListContract, {
5518
+ const client = initClient9(publicAgentsListContract, {
5302
5519
  baseUrl,
5303
5520
  baseHeaders: headers,
5304
5521
  jsonQuery: true
@@ -5317,7 +5534,7 @@ var ApiClient = class {
5317
5534
  async listPublicArtifacts(query) {
5318
5535
  const baseUrl = await this.getBaseUrl();
5319
5536
  const headers = await this.getHeaders();
5320
- const client = initClient8(publicArtifactsListContract, {
5537
+ const client = initClient9(publicArtifactsListContract, {
5321
5538
  baseUrl,
5322
5539
  baseHeaders: headers,
5323
5540
  jsonQuery: true
@@ -5336,7 +5553,7 @@ var ApiClient = class {
5336
5553
  async getPublicArtifact(id) {
5337
5554
  const baseUrl = await this.getBaseUrl();
5338
5555
  const headers = await this.getHeaders();
5339
- const client = initClient8(publicArtifactByIdContract, {
5556
+ const client = initClient9(publicArtifactByIdContract, {
5340
5557
  baseUrl,
5341
5558
  baseHeaders: headers,
5342
5559
  jsonQuery: true
@@ -5355,7 +5572,7 @@ var ApiClient = class {
5355
5572
  async listPublicVolumes(query) {
5356
5573
  const baseUrl = await this.getBaseUrl();
5357
5574
  const headers = await this.getHeaders();
5358
- const client = initClient8(publicVolumesListContract, {
5575
+ const client = initClient9(publicVolumesListContract, {
5359
5576
  baseUrl,
5360
5577
  baseHeaders: headers,
5361
5578
  jsonQuery: true
@@ -5374,7 +5591,7 @@ var ApiClient = class {
5374
5591
  async getPublicVolume(id) {
5375
5592
  const baseUrl = await this.getBaseUrl();
5376
5593
  const headers = await this.getHeaders();
5377
- const client = initClient8(publicVolumeByIdContract, {
5594
+ const client = initClient9(publicVolumeByIdContract, {
5378
5595
  baseUrl,
5379
5596
  baseHeaders: headers,
5380
5597
  jsonQuery: true
@@ -5413,7 +5630,7 @@ var ApiClient = class {
5413
5630
  async listCredentials() {
5414
5631
  const baseUrl = await this.getBaseUrl();
5415
5632
  const headers = await this.getHeaders();
5416
- const client = initClient8(credentialsMainContract, {
5633
+ const client = initClient9(credentialsMainContract, {
5417
5634
  baseUrl,
5418
5635
  baseHeaders: headers,
5419
5636
  jsonQuery: true
@@ -5432,7 +5649,7 @@ var ApiClient = class {
5432
5649
  async getCredential(name) {
5433
5650
  const baseUrl = await this.getBaseUrl();
5434
5651
  const headers = await this.getHeaders();
5435
- const client = initClient8(credentialsByNameContract, {
5652
+ const client = initClient9(credentialsByNameContract, {
5436
5653
  baseUrl,
5437
5654
  baseHeaders: headers,
5438
5655
  jsonQuery: true
@@ -5453,7 +5670,7 @@ var ApiClient = class {
5453
5670
  async setCredential(body) {
5454
5671
  const baseUrl = await this.getBaseUrl();
5455
5672
  const headers = await this.getHeaders();
5456
- const client = initClient8(credentialsMainContract, {
5673
+ const client = initClient9(credentialsMainContract, {
5457
5674
  baseUrl,
5458
5675
  baseHeaders: headers,
5459
5676
  jsonQuery: true
@@ -5472,7 +5689,7 @@ var ApiClient = class {
5472
5689
  async deleteCredential(name) {
5473
5690
  const baseUrl = await this.getBaseUrl();
5474
5691
  const headers = await this.getHeaders();
5475
- const client = initClient8(credentialsByNameContract, {
5692
+ const client = initClient9(credentialsByNameContract, {
5476
5693
  baseUrl,
5477
5694
  baseHeaders: headers,
5478
5695
  jsonQuery: true
@@ -5493,7 +5710,7 @@ var ApiClient = class {
5493
5710
  async getRealtimeToken(runId) {
5494
5711
  const baseUrl = await this.getBaseUrl();
5495
5712
  const headers = await this.getHeaders();
5496
- const client = initClient8(realtimeTokenContract, {
5713
+ const client = initClient9(realtimeTokenContract, {
5497
5714
  baseUrl,
5498
5715
  baseHeaders: headers,
5499
5716
  jsonQuery: true
@@ -5924,7 +6141,10 @@ var mainRunCommand = new Command2().name("run").description("Execute an agent").
5924
6141
  ).option("-v, --verbose", "Show verbose output with timing information").option(
5925
6142
  "--experimental-realtime",
5926
6143
  "Use realtime event streaming instead of polling (experimental)"
5927
- ).option("--debug-no-mock-claude").action(
6144
+ ).option(
6145
+ "--model-provider <type>",
6146
+ "Override model provider for LLM credentials (e.g., anthropic-api-key)"
6147
+ ).addOption(new Option("--debug-no-mock-claude").hideHelp()).action(
5928
6148
  async (identifier, prompt, options) => {
5929
6149
  const startTimestamp = /* @__PURE__ */ new Date();
5930
6150
  const verbose = options.verbose;
@@ -6023,6 +6243,7 @@ var mainRunCommand = new Command2().name("run").description("Execute an agent").
6023
6243
  artifactVersion: options.artifactVersion,
6024
6244
  volumeVersions: Object.keys(options.volumeVersion).length > 0 ? options.volumeVersion : void 0,
6025
6245
  conversationId: options.conversation,
6246
+ modelProvider: options.modelProvider,
6026
6247
  debugNoMockClaude: options.debugNoMockClaude || void 0
6027
6248
  });
6028
6249
  if (response.status === "failed") {
@@ -6084,7 +6305,7 @@ var mainRunCommand = new Command2().name("run").description("Execute an agent").
6084
6305
  );
6085
6306
 
6086
6307
  // src/commands/run/resume.ts
6087
- import { Command as Command3 } from "commander";
6308
+ import { Command as Command3, Option as Option2 } from "commander";
6088
6309
  import chalk7 from "chalk";
6089
6310
  var resumeCommand = new Command3().name("resume").description("Resume an agent run from a checkpoint (uses all snapshot data)").argument("<checkpointId>", "Checkpoint ID to resume from").argument("<prompt>", "Prompt for the resumed agent").option(
6090
6311
  "--vars <KEY=value>",
@@ -6104,7 +6325,10 @@ var resumeCommand = new Command3().name("resume").description("Resume an agent r
6104
6325
  ).option("-v, --verbose", "Show verbose output with timing information").option(
6105
6326
  "--experimental-realtime",
6106
6327
  "Use realtime event streaming instead of polling (experimental)"
6107
- ).option("--debug-no-mock-claude").action(
6328
+ ).option(
6329
+ "--model-provider <type>",
6330
+ "Override model provider for LLM credentials (e.g., anthropic-api-key)"
6331
+ ).addOption(new Option2("--debug-no-mock-claude").hideHelp()).action(
6108
6332
  async (checkpointId, prompt, options, command) => {
6109
6333
  const startTimestamp = /* @__PURE__ */ new Date();
6110
6334
  const allOpts = command.optsWithGlobals();
@@ -6146,6 +6370,7 @@ var resumeCommand = new Command3().name("resume").description("Resume an agent r
6146
6370
  vars: Object.keys(vars).length > 0 ? vars : void 0,
6147
6371
  secrets: loadedSecrets,
6148
6372
  volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0,
6373
+ modelProvider: options.modelProvider || allOpts.modelProvider,
6149
6374
  debugNoMockClaude: options.debugNoMockClaude || allOpts.debugNoMockClaude || void 0
6150
6375
  });
6151
6376
  if (response.status === "failed") {
@@ -6198,7 +6423,7 @@ var resumeCommand = new Command3().name("resume").description("Resume an agent r
6198
6423
  );
6199
6424
 
6200
6425
  // src/commands/run/continue.ts
6201
- import { Command as Command4 } from "commander";
6426
+ import { Command as Command4, Option as Option3 } from "commander";
6202
6427
  import chalk8 from "chalk";
6203
6428
  var continueCommand = new Command4().name("continue").description(
6204
6429
  "Continue an agent run from a session (uses latest artifact version)"
@@ -6220,7 +6445,10 @@ var continueCommand = new Command4().name("continue").description(
6220
6445
  ).option("-v, --verbose", "Show verbose output with timing information").option(
6221
6446
  "--experimental-realtime",
6222
6447
  "Use realtime event streaming instead of polling (experimental)"
6223
- ).option("--debug-no-mock-claude").action(
6448
+ ).option(
6449
+ "--model-provider <type>",
6450
+ "Override model provider for LLM credentials (e.g., anthropic-api-key)"
6451
+ ).addOption(new Option3("--debug-no-mock-claude").hideHelp()).action(
6224
6452
  async (agentSessionId, prompt, options, command) => {
6225
6453
  const startTimestamp = /* @__PURE__ */ new Date();
6226
6454
  const allOpts = command.optsWithGlobals();
@@ -6263,6 +6491,7 @@ var continueCommand = new Command4().name("continue").description(
6263
6491
  vars: Object.keys(vars).length > 0 ? vars : void 0,
6264
6492
  secrets: loadedSecrets,
6265
6493
  volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0,
6494
+ modelProvider: options.modelProvider || allOpts.modelProvider,
6266
6495
  debugNoMockClaude: options.debugNoMockClaude || allOpts.debugNoMockClaude || void 0
6267
6496
  });
6268
6497
  if (response.status === "failed") {
@@ -7258,7 +7487,7 @@ var cloneCommand2 = new Command17().name("clone").description("Clone a remote ar
7258
7487
  var artifactCommand = new Command18().name("artifact").description("Manage cloud artifacts (work products)").addCommand(initCommand2).addCommand(pushCommand2).addCommand(pullCommand2).addCommand(statusCommand2).addCommand(listCommand2).addCommand(cloneCommand2);
7259
7488
 
7260
7489
  // src/commands/cook.ts
7261
- import { Command as Command19 } from "commander";
7490
+ import { Command as Command19, Option as Option4 } from "commander";
7262
7491
  import chalk24 from "chalk";
7263
7492
  import { readFile as readFile7, mkdir as mkdir6, writeFile as writeFile6, appendFile } from "fs/promises";
7264
7493
  import { existsSync as existsSync8, readFileSync } from "fs";
@@ -7590,9 +7819,9 @@ async function autoPullArtifact(runOutput, artifactDir) {
7590
7819
  }
7591
7820
  }
7592
7821
  var cookCmd = new Command19().name("cook").description("One-click agent preparation and execution from vm0.yaml");
7593
- cookCmd.argument("[prompt]", "Prompt for the agent").option("-y, --yes", "Skip confirmation prompts").option("--debug-no-mock-claude").action(
7822
+ cookCmd.argument("[prompt]", "Prompt for the agent").option("-y, --yes", "Skip confirmation prompts").addOption(new Option4("--debug-no-mock-claude").hideHelp()).action(
7594
7823
  async (prompt, options) => {
7595
- const shouldExit = await checkAndUpgrade("6.0.0", prompt);
7824
+ const shouldExit = await checkAndUpgrade("6.2.0", prompt);
7596
7825
  if (shouldExit) {
7597
7826
  process.exit(0);
7598
7827
  }
@@ -7817,7 +8046,7 @@ cookCmd.command("logs").description("View logs from the last cook run").option("
7817
8046
  );
7818
8047
  cookCmd.command("continue").description(
7819
8048
  "Continue from the last session (latest conversation and artifact)"
7820
- ).argument("<prompt>", "Prompt for the continued agent").option("--debug-no-mock-claude").action(async (prompt, options) => {
8049
+ ).argument("<prompt>", "Prompt for the continued agent").addOption(new Option4("--debug-no-mock-claude").hideHelp()).action(async (prompt, options) => {
7821
8050
  const state = await loadCookState();
7822
8051
  if (!state.lastSessionId) {
7823
8052
  console.error(chalk24.red("\u2717 No previous session found"));
@@ -7855,7 +8084,7 @@ cookCmd.command("continue").description(
7855
8084
  });
7856
8085
  cookCmd.command("resume").description(
7857
8086
  "Resume from the last checkpoint (snapshotted conversation and artifact)"
7858
- ).argument("<prompt>", "Prompt for the resumed agent").option("--debug-no-mock-claude").action(async (prompt, options) => {
8087
+ ).argument("<prompt>", "Prompt for the resumed agent").addOption(new Option4("--debug-no-mock-claude").hideHelp()).action(async (prompt, options) => {
7859
8088
  const state = await loadCookState();
7860
8089
  if (!state.lastCheckpointId) {
7861
8090
  console.error(chalk24.red("\u2717 No previous checkpoint found"));
@@ -8293,7 +8522,7 @@ var listCommand3 = new Command24().name("list").alias("ls").description("List al
8293
8522
  );
8294
8523
  return;
8295
8524
  }
8296
- const nameWidth = Math.max(4, ...data.composes.map((c18) => c18.name.length));
8525
+ const nameWidth = Math.max(4, ...data.composes.map((c19) => c19.name.length));
8297
8526
  const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
8298
8527
  " "
8299
8528
  );
@@ -10469,7 +10698,8 @@ var listCommand5 = new Command38().name("list").description("List all credential
10469
10698
  console.log(chalk40.bold("Credentials:"));
10470
10699
  console.log();
10471
10700
  for (const credential of result.credentials) {
10472
- console.log(` ${chalk40.cyan(credential.name)}`);
10701
+ const typeIndicator = credential.type === "model-provider" ? chalk40.dim(" [model-provider]") : "";
10702
+ console.log(` ${chalk40.cyan(credential.name)}${typeIndicator}`);
10473
10703
  if (credential.description) {
10474
10704
  console.log(` ${chalk40.dim(credential.description)}`);
10475
10705
  }
@@ -10587,11 +10817,268 @@ var deleteCommand2 = new Command40().name("delete").description("Delete a creden
10587
10817
  // src/commands/credential/index.ts
10588
10818
  var credentialCommand = new Command41().name("experimental-credential").description("[Experimental] Manage stored credentials for agent runs").addCommand(listCommand5).addCommand(setCommand2).addCommand(deleteCommand2);
10589
10819
 
10820
+ // src/commands/model-provider/index.ts
10821
+ import { Command as Command46 } from "commander";
10822
+
10823
+ // src/commands/model-provider/list.ts
10824
+ import { Command as Command42 } from "commander";
10825
+ import chalk43 from "chalk";
10826
+ var listCommand6 = new Command42().name("list").alias("ls").description("List all model providers").action(async () => {
10827
+ try {
10828
+ const result = await listModelProviders();
10829
+ if (result.modelProviders.length === 0) {
10830
+ console.log(chalk43.dim("No model providers configured."));
10831
+ console.log();
10832
+ console.log("To add a model provider:");
10833
+ console.log(chalk43.cyan(" vm0 model-provider setup"));
10834
+ return;
10835
+ }
10836
+ const byFramework = result.modelProviders.reduce(
10837
+ (acc, p) => {
10838
+ const fw = p.framework;
10839
+ if (!acc[fw]) {
10840
+ acc[fw] = [];
10841
+ }
10842
+ acc[fw].push(p);
10843
+ return acc;
10844
+ },
10845
+ {}
10846
+ );
10847
+ console.log(chalk43.bold("Model Providers:"));
10848
+ console.log();
10849
+ for (const [framework, providers] of Object.entries(byFramework)) {
10850
+ console.log(` ${chalk43.cyan(framework)}:`);
10851
+ for (const provider of providers) {
10852
+ const defaultTag = provider.isDefault ? chalk43.green(" (default)") : "";
10853
+ console.log(` ${provider.type}${defaultTag}`);
10854
+ console.log(
10855
+ chalk43.dim(
10856
+ ` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
10857
+ )
10858
+ );
10859
+ }
10860
+ console.log();
10861
+ }
10862
+ console.log(
10863
+ chalk43.dim(`Total: ${result.modelProviders.length} provider(s)`)
10864
+ );
10865
+ } catch (error) {
10866
+ if (error instanceof Error) {
10867
+ if (error.message.includes("Not authenticated")) {
10868
+ console.error(chalk43.red("x Not authenticated. Run: vm0 auth login"));
10869
+ } else {
10870
+ console.error(chalk43.red(`x ${error.message}`));
10871
+ }
10872
+ } else {
10873
+ console.error(chalk43.red("x An unexpected error occurred"));
10874
+ }
10875
+ process.exit(1);
10876
+ }
10877
+ });
10878
+
10879
+ // src/commands/model-provider/setup.ts
10880
+ import { Command as Command43 } from "commander";
10881
+ import chalk44 from "chalk";
10882
+ import prompts3 from "prompts";
10883
+ var providerChoices = Object.entries(MODEL_PROVIDER_TYPES).map(
10884
+ ([type, config]) => ({
10885
+ title: config.label,
10886
+ value: type
10887
+ })
10888
+ );
10889
+ var setupCommand = new Command43().name("setup").description("Configure a model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
10890
+ "-c, --credential <credential>",
10891
+ "Credential value (for non-interactive mode)"
10892
+ ).option("--convert", "Convert existing user credential to model provider").action(
10893
+ async (options) => {
10894
+ try {
10895
+ let type;
10896
+ let credential;
10897
+ const shouldConvert = options.convert ?? false;
10898
+ if (options.type && options.credential) {
10899
+ if (!Object.keys(MODEL_PROVIDER_TYPES).includes(options.type)) {
10900
+ console.error(chalk44.red(`x Invalid type "${options.type}"`));
10901
+ console.log();
10902
+ console.log("Valid types:");
10903
+ for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
10904
+ console.log(` ${chalk44.cyan(t)} - ${config.label}`);
10905
+ }
10906
+ process.exit(1);
10907
+ }
10908
+ type = options.type;
10909
+ credential = options.credential;
10910
+ } else if (options.type || options.credential) {
10911
+ console.error(
10912
+ chalk44.red("x Both --type and --credential are required")
10913
+ );
10914
+ process.exit(1);
10915
+ } else {
10916
+ if (!isInteractive()) {
10917
+ console.error(chalk44.red("x Interactive mode requires a TTY"));
10918
+ console.log();
10919
+ console.log("Use non-interactive mode:");
10920
+ console.log(
10921
+ chalk44.cyan(
10922
+ ' vm0 model-provider setup --type <type> --credential "<value>"'
10923
+ )
10924
+ );
10925
+ process.exit(1);
10926
+ }
10927
+ const typeResponse = await prompts3(
10928
+ {
10929
+ type: "select",
10930
+ name: "type",
10931
+ message: "Select provider type:",
10932
+ choices: providerChoices
10933
+ },
10934
+ { onCancel: () => process.exit(0) }
10935
+ );
10936
+ type = typeResponse.type;
10937
+ const checkResult = await checkModelProviderCredential(type);
10938
+ if (checkResult.exists && checkResult.currentType === "user") {
10939
+ const convertResponse = await prompts3(
10940
+ {
10941
+ type: "confirm",
10942
+ name: "convert",
10943
+ message: `Credential "${checkResult.credentialName}" already exists. Convert to model provider?`,
10944
+ initial: true
10945
+ },
10946
+ { onCancel: () => process.exit(0) }
10947
+ );
10948
+ if (convertResponse.convert) {
10949
+ const provider2 = await convertModelProviderCredential(type);
10950
+ const defaultNote2 = provider2.isDefault ? ` (default for ${provider2.framework})` : "";
10951
+ console.log(
10952
+ chalk44.green(
10953
+ `Done Converted "${checkResult.credentialName}" to model provider${defaultNote2}`
10954
+ )
10955
+ );
10956
+ return;
10957
+ } else {
10958
+ console.log(chalk44.dim("Aborted."));
10959
+ process.exit(0);
10960
+ }
10961
+ }
10962
+ const config = MODEL_PROVIDER_TYPES[type];
10963
+ const credentialResponse = await prompts3(
10964
+ {
10965
+ type: "password",
10966
+ name: "credential",
10967
+ message: `Enter your ${config.credentialLabel}:`,
10968
+ validate: (value) => value.length > 0 || `${config.credentialLabel} is required`
10969
+ },
10970
+ { onCancel: () => process.exit(0) }
10971
+ );
10972
+ credential = credentialResponse.credential;
10973
+ }
10974
+ const { provider, created } = await upsertModelProvider({
10975
+ type,
10976
+ credential,
10977
+ convert: shouldConvert
10978
+ });
10979
+ const action = created ? "created" : "updated";
10980
+ const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
10981
+ console.log(
10982
+ chalk44.green(`Done Model provider "${type}" ${action}${defaultNote}`)
10983
+ );
10984
+ } catch (error) {
10985
+ if (error instanceof Error) {
10986
+ if (error.message.includes("already exists")) {
10987
+ console.error(chalk44.red(`x ${error.message}`));
10988
+ console.log();
10989
+ console.log("To convert the existing credential, run:");
10990
+ console.log(chalk44.cyan(" vm0 model-provider setup --convert"));
10991
+ } else if (error.message.includes("Not authenticated")) {
10992
+ console.error(
10993
+ chalk44.red("x Not authenticated. Run: vm0 auth login")
10994
+ );
10995
+ } else {
10996
+ console.error(chalk44.red(`x ${error.message}`));
10997
+ }
10998
+ } else {
10999
+ console.error(chalk44.red("x An unexpected error occurred"));
11000
+ }
11001
+ process.exit(1);
11002
+ }
11003
+ }
11004
+ );
11005
+
11006
+ // src/commands/model-provider/delete.ts
11007
+ import { Command as Command44 } from "commander";
11008
+ import chalk45 from "chalk";
11009
+ var deleteCommand3 = new Command44().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(async (type) => {
11010
+ try {
11011
+ if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
11012
+ console.error(chalk45.red(`x Invalid type "${type}"`));
11013
+ console.log();
11014
+ console.log("Valid types:");
11015
+ for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
11016
+ console.log(` ${chalk45.cyan(t)} - ${config.label}`);
11017
+ }
11018
+ process.exit(1);
11019
+ }
11020
+ await deleteModelProvider(type);
11021
+ console.log(chalk45.green(`Done Model provider "${type}" deleted`));
11022
+ } catch (error) {
11023
+ if (error instanceof Error) {
11024
+ if (error.message.includes("not found")) {
11025
+ console.error(chalk45.red(`x Model provider "${type}" not found`));
11026
+ } else if (error.message.includes("Not authenticated")) {
11027
+ console.error(chalk45.red("x Not authenticated. Run: vm0 auth login"));
11028
+ } else {
11029
+ console.error(chalk45.red(`x ${error.message}`));
11030
+ }
11031
+ } else {
11032
+ console.error(chalk45.red("x An unexpected error occurred"));
11033
+ }
11034
+ process.exit(1);
11035
+ }
11036
+ });
11037
+
11038
+ // src/commands/model-provider/set-default.ts
11039
+ import { Command as Command45 } from "commander";
11040
+ import chalk46 from "chalk";
11041
+ var setDefaultCommand = new Command45().name("set-default").description("Set a model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(async (type) => {
11042
+ try {
11043
+ if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
11044
+ console.error(chalk46.red(`x Invalid type "${type}"`));
11045
+ console.log();
11046
+ console.log("Valid types:");
11047
+ for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
11048
+ console.log(` ${chalk46.cyan(t)} - ${config.label}`);
11049
+ }
11050
+ process.exit(1);
11051
+ }
11052
+ const provider = await setModelProviderDefault(type);
11053
+ console.log(
11054
+ chalk46.green(
11055
+ `Done Default for ${provider.framework} set to "${provider.type}"`
11056
+ )
11057
+ );
11058
+ } catch (error) {
11059
+ if (error instanceof Error) {
11060
+ if (error.message.includes("not found")) {
11061
+ console.error(chalk46.red(`x Model provider "${type}" not found`));
11062
+ } else if (error.message.includes("Not authenticated")) {
11063
+ console.error(chalk46.red("x Not authenticated. Run: vm0 auth login"));
11064
+ } else {
11065
+ console.error(chalk46.red(`x ${error.message}`));
11066
+ }
11067
+ } else {
11068
+ console.error(chalk46.red("x An unexpected error occurred"));
11069
+ }
11070
+ process.exit(1);
11071
+ }
11072
+ });
11073
+
11074
+ // src/commands/model-provider/index.ts
11075
+ var modelProviderCommand = new Command46().name("model-provider").description("Manage model providers for agent runs").addCommand(listCommand6).addCommand(setupCommand).addCommand(deleteCommand3).addCommand(setDefaultCommand);
11076
+
10590
11077
  // src/index.ts
10591
- var program = new Command42();
10592
- program.name("vm0").description("VM0 CLI - A modern build tool").version("6.0.0");
11078
+ var program = new Command47();
11079
+ program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("6.2.0");
10593
11080
  program.command("info").description("Display environment information").action(async () => {
10594
- console.log(chalk43.bold("System Information:"));
11081
+ console.log(chalk47.bold("System Information:"));
10595
11082
  console.log(`Node Version: ${process.version}`);
10596
11083
  console.log(`Platform: ${process.platform}`);
10597
11084
  console.log(`Architecture: ${process.arch}`);
@@ -10624,6 +11111,7 @@ program.addCommand(setupGithubCommand);
10624
11111
  program.addCommand(scheduleCommand);
10625
11112
  program.addCommand(usageCommand);
10626
11113
  program.addCommand(credentialCommand);
11114
+ program.addCommand(modelProviderCommand);
10627
11115
  if (process.argv[1]?.endsWith("index.js") || process.argv[1]?.endsWith("index.ts") || process.argv[1]?.endsWith("vm0")) {
10628
11116
  program.parse();
10629
11117
  }