@vm0/cli 5.10.0 → 6.1.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.
- package/index.js +938 -439
- 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
|
|
5
|
-
import
|
|
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";
|
|
@@ -434,7 +434,7 @@ var agentDefinitionSchema = z3.object({
|
|
|
434
434
|
* This field will be removed in a future version.
|
|
435
435
|
*/
|
|
436
436
|
image: z3.string().optional(),
|
|
437
|
-
|
|
437
|
+
framework: z3.string().min(1, "Framework is required"),
|
|
438
438
|
/**
|
|
439
439
|
* Array of pre-installed apps/tools for the agent environment.
|
|
440
440
|
* Format: "app" or "app:tag" (e.g., "github", "github:dev", "github:latest")
|
|
@@ -693,7 +693,7 @@ var eventsResponseSchema = z4.object({
|
|
|
693
693
|
hasMore: z4.boolean(),
|
|
694
694
|
nextSequence: z4.number(),
|
|
695
695
|
run: runStateSchema,
|
|
696
|
-
|
|
696
|
+
framework: z4.string()
|
|
697
697
|
});
|
|
698
698
|
var runsMainContract = c3.router({
|
|
699
699
|
/**
|
|
@@ -775,7 +775,7 @@ var metricsResponseSchema = z4.object({
|
|
|
775
775
|
var agentEventsResponseSchema = z4.object({
|
|
776
776
|
events: z4.array(runEventSchema),
|
|
777
777
|
hasMore: z4.boolean(),
|
|
778
|
-
|
|
778
|
+
framework: z4.string()
|
|
779
779
|
});
|
|
780
780
|
var networkLogEntrySchema = z4.object({
|
|
781
781
|
timestamp: z4.string(),
|
|
@@ -1654,10 +1654,12 @@ var credentialNameSchema = z12.string().min(1, "Credential name is required").ma
|
|
|
1654
1654
|
/^[A-Z][A-Z0-9_]*$/,
|
|
1655
1655
|
"Credential name must contain only uppercase letters, numbers, and underscores, and must start with a letter (e.g., MY_API_KEY)"
|
|
1656
1656
|
);
|
|
1657
|
+
var credentialTypeSchema = z12.enum(["user", "model-provider"]);
|
|
1657
1658
|
var credentialResponseSchema = z12.object({
|
|
1658
1659
|
id: z12.string().uuid(),
|
|
1659
1660
|
name: z12.string(),
|
|
1660
1661
|
description: z12.string().nullable(),
|
|
1662
|
+
type: credentialTypeSchema,
|
|
1661
1663
|
createdAt: z12.string(),
|
|
1662
1664
|
updatedAt: z12.string()
|
|
1663
1665
|
});
|
|
@@ -1741,43 +1743,191 @@ var credentialsByNameContract = c10.router({
|
|
|
1741
1743
|
}
|
|
1742
1744
|
});
|
|
1743
1745
|
|
|
1744
|
-
// ../../packages/core/src/contracts/
|
|
1746
|
+
// ../../packages/core/src/contracts/model-providers.ts
|
|
1745
1747
|
import { z as z13 } from "zod";
|
|
1746
1748
|
var c11 = initContract();
|
|
1747
|
-
var
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1749
|
+
var MODEL_PROVIDER_TYPES = {
|
|
1750
|
+
"claude-code-oauth-token": {
|
|
1751
|
+
framework: "claude-code",
|
|
1752
|
+
credentialName: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
1753
|
+
label: "Claude Code (OAuth Token)",
|
|
1754
|
+
credentialLabel: "OAuth token"
|
|
1755
|
+
},
|
|
1756
|
+
"anthropic-api-key": {
|
|
1757
|
+
framework: "claude-code",
|
|
1758
|
+
credentialName: "ANTHROPIC_API_KEY",
|
|
1759
|
+
label: "Anthropic API Key",
|
|
1760
|
+
credentialLabel: "API key"
|
|
1761
|
+
},
|
|
1762
|
+
"openai-api-key": {
|
|
1763
|
+
framework: "codex",
|
|
1764
|
+
credentialName: "OPENAI_API_KEY",
|
|
1765
|
+
label: "OpenAI API Key",
|
|
1766
|
+
credentialLabel: "API key"
|
|
1767
|
+
}
|
|
1768
|
+
};
|
|
1769
|
+
var modelProviderTypeSchema = z13.enum([
|
|
1770
|
+
"claude-code-oauth-token",
|
|
1771
|
+
"anthropic-api-key",
|
|
1772
|
+
"openai-api-key"
|
|
1773
|
+
]);
|
|
1774
|
+
var modelProviderFrameworkSchema = z13.enum(["claude-code", "codex"]);
|
|
1775
|
+
var modelProviderResponseSchema = z13.object({
|
|
1776
|
+
id: z13.string().uuid(),
|
|
1777
|
+
type: modelProviderTypeSchema,
|
|
1778
|
+
framework: modelProviderFrameworkSchema,
|
|
1779
|
+
credentialName: z13.string(),
|
|
1780
|
+
isDefault: z13.boolean(),
|
|
1756
1781
|
createdAt: z13.string(),
|
|
1757
1782
|
updatedAt: z13.string()
|
|
1758
1783
|
});
|
|
1759
|
-
var
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1784
|
+
var modelProviderListResponseSchema = z13.object({
|
|
1785
|
+
modelProviders: z13.array(modelProviderResponseSchema)
|
|
1786
|
+
});
|
|
1787
|
+
var upsertModelProviderRequestSchema = z13.object({
|
|
1788
|
+
type: modelProviderTypeSchema,
|
|
1789
|
+
credential: z13.string().min(1, "Credential is required"),
|
|
1790
|
+
convert: z13.boolean().optional()
|
|
1791
|
+
});
|
|
1792
|
+
var upsertModelProviderResponseSchema = z13.object({
|
|
1793
|
+
provider: modelProviderResponseSchema,
|
|
1794
|
+
created: z13.boolean()
|
|
1795
|
+
});
|
|
1796
|
+
var checkCredentialResponseSchema = z13.object({
|
|
1797
|
+
exists: z13.boolean(),
|
|
1798
|
+
credentialName: z13.string(),
|
|
1799
|
+
currentType: z13.enum(["user", "model-provider"]).optional()
|
|
1800
|
+
});
|
|
1801
|
+
var modelProvidersMainContract = c11.router({
|
|
1802
|
+
list: {
|
|
1803
|
+
method: "GET",
|
|
1804
|
+
path: "/api/model-providers",
|
|
1805
|
+
responses: {
|
|
1806
|
+
200: modelProviderListResponseSchema,
|
|
1807
|
+
401: apiErrorSchema,
|
|
1808
|
+
500: apiErrorSchema
|
|
1809
|
+
},
|
|
1810
|
+
summary: "List all model providers"
|
|
1811
|
+
},
|
|
1812
|
+
upsert: {
|
|
1813
|
+
method: "PUT",
|
|
1814
|
+
path: "/api/model-providers",
|
|
1815
|
+
body: upsertModelProviderRequestSchema,
|
|
1816
|
+
responses: {
|
|
1817
|
+
200: upsertModelProviderResponseSchema,
|
|
1818
|
+
201: upsertModelProviderResponseSchema,
|
|
1819
|
+
400: apiErrorSchema,
|
|
1820
|
+
401: apiErrorSchema,
|
|
1821
|
+
409: apiErrorSchema,
|
|
1822
|
+
500: apiErrorSchema
|
|
1823
|
+
},
|
|
1824
|
+
summary: "Create or update a model provider"
|
|
1825
|
+
}
|
|
1826
|
+
});
|
|
1827
|
+
var modelProvidersCheckContract = c11.router({
|
|
1828
|
+
check: {
|
|
1829
|
+
method: "GET",
|
|
1830
|
+
path: "/api/model-providers/check/:type",
|
|
1831
|
+
pathParams: z13.object({
|
|
1832
|
+
type: modelProviderTypeSchema
|
|
1833
|
+
}),
|
|
1834
|
+
responses: {
|
|
1835
|
+
200: checkCredentialResponseSchema,
|
|
1836
|
+
401: apiErrorSchema,
|
|
1837
|
+
500: apiErrorSchema
|
|
1838
|
+
},
|
|
1839
|
+
summary: "Check if credential exists for a model provider type"
|
|
1840
|
+
}
|
|
1841
|
+
});
|
|
1842
|
+
var modelProvidersByTypeContract = c11.router({
|
|
1843
|
+
delete: {
|
|
1844
|
+
method: "DELETE",
|
|
1845
|
+
path: "/api/model-providers/:type",
|
|
1846
|
+
pathParams: z13.object({
|
|
1847
|
+
type: modelProviderTypeSchema
|
|
1848
|
+
}),
|
|
1849
|
+
responses: {
|
|
1850
|
+
204: z13.undefined(),
|
|
1851
|
+
401: apiErrorSchema,
|
|
1852
|
+
404: apiErrorSchema,
|
|
1853
|
+
500: apiErrorSchema
|
|
1854
|
+
},
|
|
1855
|
+
summary: "Delete a model provider"
|
|
1856
|
+
}
|
|
1857
|
+
});
|
|
1858
|
+
var modelProvidersConvertContract = c11.router({
|
|
1859
|
+
convert: {
|
|
1860
|
+
method: "POST",
|
|
1861
|
+
path: "/api/model-providers/:type/convert",
|
|
1862
|
+
pathParams: z13.object({
|
|
1863
|
+
type: modelProviderTypeSchema
|
|
1864
|
+
}),
|
|
1865
|
+
body: z13.undefined(),
|
|
1866
|
+
responses: {
|
|
1867
|
+
200: modelProviderResponseSchema,
|
|
1868
|
+
400: apiErrorSchema,
|
|
1869
|
+
401: apiErrorSchema,
|
|
1870
|
+
404: apiErrorSchema,
|
|
1871
|
+
500: apiErrorSchema
|
|
1872
|
+
},
|
|
1873
|
+
summary: "Convert existing user credential to model provider"
|
|
1874
|
+
}
|
|
1763
1875
|
});
|
|
1764
|
-
var
|
|
1765
|
-
|
|
1766
|
-
|
|
1876
|
+
var modelProvidersSetDefaultContract = c11.router({
|
|
1877
|
+
setDefault: {
|
|
1878
|
+
method: "POST",
|
|
1879
|
+
path: "/api/model-providers/:type/set-default",
|
|
1880
|
+
pathParams: z13.object({
|
|
1881
|
+
type: modelProviderTypeSchema
|
|
1882
|
+
}),
|
|
1883
|
+
body: z13.undefined(),
|
|
1884
|
+
responses: {
|
|
1885
|
+
200: modelProviderResponseSchema,
|
|
1886
|
+
401: apiErrorSchema,
|
|
1887
|
+
404: apiErrorSchema,
|
|
1888
|
+
500: apiErrorSchema
|
|
1889
|
+
},
|
|
1890
|
+
summary: "Set a model provider as default for its framework"
|
|
1891
|
+
}
|
|
1767
1892
|
});
|
|
1768
|
-
|
|
1769
|
-
|
|
1893
|
+
|
|
1894
|
+
// ../../packages/core/src/contracts/sessions.ts
|
|
1895
|
+
import { z as z14 } from "zod";
|
|
1896
|
+
var c12 = initContract();
|
|
1897
|
+
var sessionResponseSchema = z14.object({
|
|
1898
|
+
id: z14.string(),
|
|
1899
|
+
agentComposeId: z14.string(),
|
|
1900
|
+
agentComposeVersionId: z14.string().nullable(),
|
|
1901
|
+
conversationId: z14.string().nullable(),
|
|
1902
|
+
artifactName: z14.string().nullable(),
|
|
1903
|
+
vars: z14.record(z14.string(), z14.string()).nullable(),
|
|
1904
|
+
secretNames: z14.array(z14.string()).nullable(),
|
|
1905
|
+
volumeVersions: z14.record(z14.string(), z14.string()).nullable(),
|
|
1906
|
+
createdAt: z14.string(),
|
|
1907
|
+
updatedAt: z14.string()
|
|
1908
|
+
});
|
|
1909
|
+
var agentComposeSnapshotSchema = z14.object({
|
|
1910
|
+
agentComposeVersionId: z14.string(),
|
|
1911
|
+
vars: z14.record(z14.string(), z14.string()).optional(),
|
|
1912
|
+
secretNames: z14.array(z14.string()).optional()
|
|
1770
1913
|
});
|
|
1771
|
-
var
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1914
|
+
var artifactSnapshotSchema2 = z14.object({
|
|
1915
|
+
artifactName: z14.string(),
|
|
1916
|
+
artifactVersion: z14.string()
|
|
1917
|
+
});
|
|
1918
|
+
var volumeVersionsSnapshotSchema2 = z14.object({
|
|
1919
|
+
versions: z14.record(z14.string(), z14.string())
|
|
1920
|
+
});
|
|
1921
|
+
var checkpointResponseSchema = z14.object({
|
|
1922
|
+
id: z14.string(),
|
|
1923
|
+
runId: z14.string(),
|
|
1924
|
+
conversationId: z14.string(),
|
|
1775
1925
|
agentComposeSnapshot: agentComposeSnapshotSchema,
|
|
1776
1926
|
artifactSnapshot: artifactSnapshotSchema2.nullable(),
|
|
1777
1927
|
volumeVersionsSnapshot: volumeVersionsSnapshotSchema2.nullable(),
|
|
1778
|
-
createdAt:
|
|
1928
|
+
createdAt: z14.string()
|
|
1779
1929
|
});
|
|
1780
|
-
var sessionsByIdContract =
|
|
1930
|
+
var sessionsByIdContract = c12.router({
|
|
1781
1931
|
/**
|
|
1782
1932
|
* GET /api/agent/sessions/:id
|
|
1783
1933
|
* Get session by ID
|
|
@@ -1785,8 +1935,8 @@ var sessionsByIdContract = c11.router({
|
|
|
1785
1935
|
getById: {
|
|
1786
1936
|
method: "GET",
|
|
1787
1937
|
path: "/api/agent/sessions/:id",
|
|
1788
|
-
pathParams:
|
|
1789
|
-
id:
|
|
1938
|
+
pathParams: z14.object({
|
|
1939
|
+
id: z14.string().min(1, "Session ID is required")
|
|
1790
1940
|
}),
|
|
1791
1941
|
responses: {
|
|
1792
1942
|
200: sessionResponseSchema,
|
|
@@ -1797,7 +1947,7 @@ var sessionsByIdContract = c11.router({
|
|
|
1797
1947
|
summary: "Get session by ID"
|
|
1798
1948
|
}
|
|
1799
1949
|
});
|
|
1800
|
-
var checkpointsByIdContract =
|
|
1950
|
+
var checkpointsByIdContract = c12.router({
|
|
1801
1951
|
/**
|
|
1802
1952
|
* GET /api/agent/checkpoints/:id
|
|
1803
1953
|
* Get checkpoint by ID
|
|
@@ -1805,8 +1955,8 @@ var checkpointsByIdContract = c11.router({
|
|
|
1805
1955
|
getById: {
|
|
1806
1956
|
method: "GET",
|
|
1807
1957
|
path: "/api/agent/checkpoints/:id",
|
|
1808
|
-
pathParams:
|
|
1809
|
-
id:
|
|
1958
|
+
pathParams: z14.object({
|
|
1959
|
+
id: z14.string().min(1, "Checkpoint ID is required")
|
|
1810
1960
|
}),
|
|
1811
1961
|
responses: {
|
|
1812
1962
|
200: checkpointResponseSchema,
|
|
@@ -1819,91 +1969,91 @@ var checkpointsByIdContract = c11.router({
|
|
|
1819
1969
|
});
|
|
1820
1970
|
|
|
1821
1971
|
// ../../packages/core/src/contracts/schedules.ts
|
|
1822
|
-
import { z as
|
|
1823
|
-
var
|
|
1824
|
-
var scheduleTriggerSchema =
|
|
1825
|
-
cron:
|
|
1826
|
-
at:
|
|
1827
|
-
timezone:
|
|
1972
|
+
import { z as z15 } from "zod";
|
|
1973
|
+
var c13 = initContract();
|
|
1974
|
+
var scheduleTriggerSchema = z15.object({
|
|
1975
|
+
cron: z15.string().optional(),
|
|
1976
|
+
at: z15.string().optional(),
|
|
1977
|
+
timezone: z15.string().default("UTC")
|
|
1828
1978
|
}).refine((data) => data.cron && !data.at || !data.cron && data.at, {
|
|
1829
1979
|
message: "Exactly one of 'cron' or 'at' must be specified"
|
|
1830
1980
|
});
|
|
1831
|
-
var scheduleRunConfigSchema =
|
|
1832
|
-
agent:
|
|
1833
|
-
prompt:
|
|
1834
|
-
vars:
|
|
1835
|
-
secrets:
|
|
1836
|
-
artifactName:
|
|
1837
|
-
artifactVersion:
|
|
1838
|
-
volumeVersions:
|
|
1981
|
+
var scheduleRunConfigSchema = z15.object({
|
|
1982
|
+
agent: z15.string().min(1, "Agent reference required"),
|
|
1983
|
+
prompt: z15.string().min(1, "Prompt required"),
|
|
1984
|
+
vars: z15.record(z15.string(), z15.string()).optional(),
|
|
1985
|
+
secrets: z15.record(z15.string(), z15.string()).optional(),
|
|
1986
|
+
artifactName: z15.string().optional(),
|
|
1987
|
+
artifactVersion: z15.string().optional(),
|
|
1988
|
+
volumeVersions: z15.record(z15.string(), z15.string()).optional()
|
|
1839
1989
|
});
|
|
1840
|
-
var scheduleDefinitionSchema =
|
|
1990
|
+
var scheduleDefinitionSchema = z15.object({
|
|
1841
1991
|
on: scheduleTriggerSchema,
|
|
1842
1992
|
run: scheduleRunConfigSchema
|
|
1843
1993
|
});
|
|
1844
|
-
var scheduleYamlSchema =
|
|
1845
|
-
version:
|
|
1846
|
-
schedules:
|
|
1847
|
-
});
|
|
1848
|
-
var deployScheduleRequestSchema =
|
|
1849
|
-
name:
|
|
1850
|
-
cronExpression:
|
|
1851
|
-
atTime:
|
|
1852
|
-
timezone:
|
|
1853
|
-
prompt:
|
|
1854
|
-
vars:
|
|
1855
|
-
secrets:
|
|
1856
|
-
artifactName:
|
|
1857
|
-
artifactVersion:
|
|
1858
|
-
volumeVersions:
|
|
1994
|
+
var scheduleYamlSchema = z15.object({
|
|
1995
|
+
version: z15.literal("1.0"),
|
|
1996
|
+
schedules: z15.record(z15.string(), scheduleDefinitionSchema)
|
|
1997
|
+
});
|
|
1998
|
+
var deployScheduleRequestSchema = z15.object({
|
|
1999
|
+
name: z15.string().min(1).max(64, "Schedule name max 64 chars"),
|
|
2000
|
+
cronExpression: z15.string().optional(),
|
|
2001
|
+
atTime: z15.string().optional(),
|
|
2002
|
+
timezone: z15.string().default("UTC"),
|
|
2003
|
+
prompt: z15.string().min(1, "Prompt required"),
|
|
2004
|
+
vars: z15.record(z15.string(), z15.string()).optional(),
|
|
2005
|
+
secrets: z15.record(z15.string(), z15.string()).optional(),
|
|
2006
|
+
artifactName: z15.string().optional(),
|
|
2007
|
+
artifactVersion: z15.string().optional(),
|
|
2008
|
+
volumeVersions: z15.record(z15.string(), z15.string()).optional(),
|
|
1859
2009
|
// Resolved agent compose ID (CLI resolves scope/name:version → composeId)
|
|
1860
|
-
composeId:
|
|
2010
|
+
composeId: z15.string().uuid("Invalid compose ID")
|
|
1861
2011
|
}).refine(
|
|
1862
2012
|
(data) => data.cronExpression && !data.atTime || !data.cronExpression && data.atTime,
|
|
1863
2013
|
{
|
|
1864
2014
|
message: "Exactly one of 'cronExpression' or 'atTime' must be specified"
|
|
1865
2015
|
}
|
|
1866
2016
|
);
|
|
1867
|
-
var scheduleResponseSchema =
|
|
1868
|
-
id:
|
|
1869
|
-
composeId:
|
|
1870
|
-
composeName:
|
|
1871
|
-
scopeSlug:
|
|
1872
|
-
name:
|
|
1873
|
-
cronExpression:
|
|
1874
|
-
atTime:
|
|
1875
|
-
timezone:
|
|
1876
|
-
prompt:
|
|
1877
|
-
vars:
|
|
2017
|
+
var scheduleResponseSchema = z15.object({
|
|
2018
|
+
id: z15.string().uuid(),
|
|
2019
|
+
composeId: z15.string().uuid(),
|
|
2020
|
+
composeName: z15.string(),
|
|
2021
|
+
scopeSlug: z15.string(),
|
|
2022
|
+
name: z15.string(),
|
|
2023
|
+
cronExpression: z15.string().nullable(),
|
|
2024
|
+
atTime: z15.string().nullable(),
|
|
2025
|
+
timezone: z15.string(),
|
|
2026
|
+
prompt: z15.string(),
|
|
2027
|
+
vars: z15.record(z15.string(), z15.string()).nullable(),
|
|
1878
2028
|
// Secret names only (values are never returned)
|
|
1879
|
-
secretNames:
|
|
1880
|
-
artifactName:
|
|
1881
|
-
artifactVersion:
|
|
1882
|
-
volumeVersions:
|
|
1883
|
-
enabled:
|
|
1884
|
-
nextRunAt:
|
|
1885
|
-
createdAt:
|
|
1886
|
-
updatedAt:
|
|
1887
|
-
});
|
|
1888
|
-
var runSummarySchema =
|
|
1889
|
-
id:
|
|
1890
|
-
status:
|
|
1891
|
-
createdAt:
|
|
1892
|
-
completedAt:
|
|
1893
|
-
error:
|
|
1894
|
-
});
|
|
1895
|
-
var scheduleRunsResponseSchema =
|
|
1896
|
-
runs:
|
|
1897
|
-
});
|
|
1898
|
-
var scheduleListResponseSchema =
|
|
1899
|
-
schedules:
|
|
1900
|
-
});
|
|
1901
|
-
var deployScheduleResponseSchema =
|
|
2029
|
+
secretNames: z15.array(z15.string()).nullable(),
|
|
2030
|
+
artifactName: z15.string().nullable(),
|
|
2031
|
+
artifactVersion: z15.string().nullable(),
|
|
2032
|
+
volumeVersions: z15.record(z15.string(), z15.string()).nullable(),
|
|
2033
|
+
enabled: z15.boolean(),
|
|
2034
|
+
nextRunAt: z15.string().nullable(),
|
|
2035
|
+
createdAt: z15.string(),
|
|
2036
|
+
updatedAt: z15.string()
|
|
2037
|
+
});
|
|
2038
|
+
var runSummarySchema = z15.object({
|
|
2039
|
+
id: z15.string().uuid(),
|
|
2040
|
+
status: z15.enum(["pending", "running", "completed", "failed", "timeout"]),
|
|
2041
|
+
createdAt: z15.string(),
|
|
2042
|
+
completedAt: z15.string().nullable(),
|
|
2043
|
+
error: z15.string().nullable()
|
|
2044
|
+
});
|
|
2045
|
+
var scheduleRunsResponseSchema = z15.object({
|
|
2046
|
+
runs: z15.array(runSummarySchema)
|
|
2047
|
+
});
|
|
2048
|
+
var scheduleListResponseSchema = z15.object({
|
|
2049
|
+
schedules: z15.array(scheduleResponseSchema)
|
|
2050
|
+
});
|
|
2051
|
+
var deployScheduleResponseSchema = z15.object({
|
|
1902
2052
|
schedule: scheduleResponseSchema,
|
|
1903
|
-
created:
|
|
2053
|
+
created: z15.boolean()
|
|
1904
2054
|
// true if created, false if updated
|
|
1905
2055
|
});
|
|
1906
|
-
var schedulesMainContract =
|
|
2056
|
+
var schedulesMainContract = c13.router({
|
|
1907
2057
|
/**
|
|
1908
2058
|
* POST /api/agent/schedules
|
|
1909
2059
|
* Deploy (create or update) a schedule
|
|
@@ -1939,7 +2089,7 @@ var schedulesMainContract = c12.router({
|
|
|
1939
2089
|
summary: "List all schedules"
|
|
1940
2090
|
}
|
|
1941
2091
|
});
|
|
1942
|
-
var schedulesByNameContract =
|
|
2092
|
+
var schedulesByNameContract = c13.router({
|
|
1943
2093
|
/**
|
|
1944
2094
|
* GET /api/agent/schedules/:name
|
|
1945
2095
|
* Get schedule by name
|
|
@@ -1947,11 +2097,11 @@ var schedulesByNameContract = c12.router({
|
|
|
1947
2097
|
getByName: {
|
|
1948
2098
|
method: "GET",
|
|
1949
2099
|
path: "/api/agent/schedules/:name",
|
|
1950
|
-
pathParams:
|
|
1951
|
-
name:
|
|
2100
|
+
pathParams: z15.object({
|
|
2101
|
+
name: z15.string().min(1, "Schedule name required")
|
|
1952
2102
|
}),
|
|
1953
|
-
query:
|
|
1954
|
-
composeId:
|
|
2103
|
+
query: z15.object({
|
|
2104
|
+
composeId: z15.string().uuid("Compose ID required")
|
|
1955
2105
|
}),
|
|
1956
2106
|
responses: {
|
|
1957
2107
|
200: scheduleResponseSchema,
|
|
@@ -1967,21 +2117,21 @@ var schedulesByNameContract = c12.router({
|
|
|
1967
2117
|
delete: {
|
|
1968
2118
|
method: "DELETE",
|
|
1969
2119
|
path: "/api/agent/schedules/:name",
|
|
1970
|
-
pathParams:
|
|
1971
|
-
name:
|
|
2120
|
+
pathParams: z15.object({
|
|
2121
|
+
name: z15.string().min(1, "Schedule name required")
|
|
1972
2122
|
}),
|
|
1973
|
-
query:
|
|
1974
|
-
composeId:
|
|
2123
|
+
query: z15.object({
|
|
2124
|
+
composeId: z15.string().uuid("Compose ID required")
|
|
1975
2125
|
}),
|
|
1976
2126
|
responses: {
|
|
1977
|
-
204:
|
|
2127
|
+
204: z15.undefined(),
|
|
1978
2128
|
401: apiErrorSchema,
|
|
1979
2129
|
404: apiErrorSchema
|
|
1980
2130
|
},
|
|
1981
2131
|
summary: "Delete schedule"
|
|
1982
2132
|
}
|
|
1983
2133
|
});
|
|
1984
|
-
var schedulesEnableContract =
|
|
2134
|
+
var schedulesEnableContract = c13.router({
|
|
1985
2135
|
/**
|
|
1986
2136
|
* POST /api/agent/schedules/:name/enable
|
|
1987
2137
|
* Enable a disabled schedule
|
|
@@ -1989,11 +2139,11 @@ var schedulesEnableContract = c12.router({
|
|
|
1989
2139
|
enable: {
|
|
1990
2140
|
method: "POST",
|
|
1991
2141
|
path: "/api/agent/schedules/:name/enable",
|
|
1992
|
-
pathParams:
|
|
1993
|
-
name:
|
|
2142
|
+
pathParams: z15.object({
|
|
2143
|
+
name: z15.string().min(1, "Schedule name required")
|
|
1994
2144
|
}),
|
|
1995
|
-
body:
|
|
1996
|
-
composeId:
|
|
2145
|
+
body: z15.object({
|
|
2146
|
+
composeId: z15.string().uuid("Compose ID required")
|
|
1997
2147
|
}),
|
|
1998
2148
|
responses: {
|
|
1999
2149
|
200: scheduleResponseSchema,
|
|
@@ -2009,11 +2159,11 @@ var schedulesEnableContract = c12.router({
|
|
|
2009
2159
|
disable: {
|
|
2010
2160
|
method: "POST",
|
|
2011
2161
|
path: "/api/agent/schedules/:name/disable",
|
|
2012
|
-
pathParams:
|
|
2013
|
-
name:
|
|
2162
|
+
pathParams: z15.object({
|
|
2163
|
+
name: z15.string().min(1, "Schedule name required")
|
|
2014
2164
|
}),
|
|
2015
|
-
body:
|
|
2016
|
-
composeId:
|
|
2165
|
+
body: z15.object({
|
|
2166
|
+
composeId: z15.string().uuid("Compose ID required")
|
|
2017
2167
|
}),
|
|
2018
2168
|
responses: {
|
|
2019
2169
|
200: scheduleResponseSchema,
|
|
@@ -2023,7 +2173,7 @@ var schedulesEnableContract = c12.router({
|
|
|
2023
2173
|
summary: "Disable schedule"
|
|
2024
2174
|
}
|
|
2025
2175
|
});
|
|
2026
|
-
var scheduleRunsContract =
|
|
2176
|
+
var scheduleRunsContract = c13.router({
|
|
2027
2177
|
/**
|
|
2028
2178
|
* GET /api/agent/schedules/:name/runs
|
|
2029
2179
|
* List recent runs for a schedule
|
|
@@ -2031,12 +2181,12 @@ var scheduleRunsContract = c12.router({
|
|
|
2031
2181
|
listRuns: {
|
|
2032
2182
|
method: "GET",
|
|
2033
2183
|
path: "/api/agent/schedules/:name/runs",
|
|
2034
|
-
pathParams:
|
|
2035
|
-
name:
|
|
2184
|
+
pathParams: z15.object({
|
|
2185
|
+
name: z15.string().min(1, "Schedule name required")
|
|
2036
2186
|
}),
|
|
2037
|
-
query:
|
|
2038
|
-
composeId:
|
|
2039
|
-
limit:
|
|
2187
|
+
query: z15.object({
|
|
2188
|
+
composeId: z15.string().uuid("Compose ID required"),
|
|
2189
|
+
limit: z15.coerce.number().min(0).max(100).default(5)
|
|
2040
2190
|
}),
|
|
2041
2191
|
responses: {
|
|
2042
2192
|
200: scheduleRunsResponseSchema,
|
|
@@ -2048,18 +2198,18 @@ var scheduleRunsContract = c12.router({
|
|
|
2048
2198
|
});
|
|
2049
2199
|
|
|
2050
2200
|
// ../../packages/core/src/contracts/realtime.ts
|
|
2051
|
-
import { z as
|
|
2052
|
-
var
|
|
2053
|
-
var ablyTokenRequestSchema =
|
|
2054
|
-
keyName:
|
|
2055
|
-
ttl:
|
|
2056
|
-
timestamp:
|
|
2057
|
-
capability:
|
|
2058
|
-
clientId:
|
|
2059
|
-
nonce:
|
|
2060
|
-
mac:
|
|
2061
|
-
});
|
|
2062
|
-
var realtimeTokenContract =
|
|
2201
|
+
import { z as z16 } from "zod";
|
|
2202
|
+
var c14 = initContract();
|
|
2203
|
+
var ablyTokenRequestSchema = z16.object({
|
|
2204
|
+
keyName: z16.string(),
|
|
2205
|
+
ttl: z16.number().optional(),
|
|
2206
|
+
timestamp: z16.number(),
|
|
2207
|
+
capability: z16.string(),
|
|
2208
|
+
clientId: z16.string().optional(),
|
|
2209
|
+
nonce: z16.string(),
|
|
2210
|
+
mac: z16.string()
|
|
2211
|
+
});
|
|
2212
|
+
var realtimeTokenContract = c14.router({
|
|
2063
2213
|
/**
|
|
2064
2214
|
* POST /api/realtime/token
|
|
2065
2215
|
* Get an Ably token to subscribe to a run's events channel
|
|
@@ -2067,8 +2217,8 @@ var realtimeTokenContract = c13.router({
|
|
|
2067
2217
|
create: {
|
|
2068
2218
|
method: "POST",
|
|
2069
2219
|
path: "/api/realtime/token",
|
|
2070
|
-
body:
|
|
2071
|
-
runId:
|
|
2220
|
+
body: z16.object({
|
|
2221
|
+
runId: z16.string().uuid("runId must be a valid UUID")
|
|
2072
2222
|
}),
|
|
2073
2223
|
responses: {
|
|
2074
2224
|
200: ablyTokenRequestSchema,
|
|
@@ -2082,8 +2232,8 @@ var realtimeTokenContract = c13.router({
|
|
|
2082
2232
|
});
|
|
2083
2233
|
|
|
2084
2234
|
// ../../packages/core/src/contracts/public/common.ts
|
|
2085
|
-
import { z as
|
|
2086
|
-
var publicApiErrorTypeSchema =
|
|
2235
|
+
import { z as z17 } from "zod";
|
|
2236
|
+
var publicApiErrorTypeSchema = z17.enum([
|
|
2087
2237
|
"api_error",
|
|
2088
2238
|
// Internal server error (5xx)
|
|
2089
2239
|
"invalid_request_error",
|
|
@@ -2095,55 +2245,55 @@ var publicApiErrorTypeSchema = z16.enum([
|
|
|
2095
2245
|
"conflict_error"
|
|
2096
2246
|
// Resource conflict (409)
|
|
2097
2247
|
]);
|
|
2098
|
-
var publicApiErrorSchema =
|
|
2099
|
-
error:
|
|
2248
|
+
var publicApiErrorSchema = z17.object({
|
|
2249
|
+
error: z17.object({
|
|
2100
2250
|
type: publicApiErrorTypeSchema,
|
|
2101
|
-
code:
|
|
2102
|
-
message:
|
|
2103
|
-
param:
|
|
2104
|
-
doc_url:
|
|
2251
|
+
code: z17.string(),
|
|
2252
|
+
message: z17.string(),
|
|
2253
|
+
param: z17.string().optional(),
|
|
2254
|
+
doc_url: z17.string().url().optional()
|
|
2105
2255
|
})
|
|
2106
2256
|
});
|
|
2107
|
-
var paginationSchema =
|
|
2108
|
-
has_more:
|
|
2109
|
-
next_cursor:
|
|
2257
|
+
var paginationSchema = z17.object({
|
|
2258
|
+
has_more: z17.boolean(),
|
|
2259
|
+
next_cursor: z17.string().nullable()
|
|
2110
2260
|
});
|
|
2111
2261
|
function createPaginatedResponseSchema(dataSchema) {
|
|
2112
|
-
return
|
|
2113
|
-
data:
|
|
2262
|
+
return z17.object({
|
|
2263
|
+
data: z17.array(dataSchema),
|
|
2114
2264
|
pagination: paginationSchema
|
|
2115
2265
|
});
|
|
2116
2266
|
}
|
|
2117
|
-
var listQuerySchema =
|
|
2118
|
-
cursor:
|
|
2119
|
-
limit:
|
|
2267
|
+
var listQuerySchema = z17.object({
|
|
2268
|
+
cursor: z17.string().optional(),
|
|
2269
|
+
limit: z17.coerce.number().min(1).max(100).default(20)
|
|
2120
2270
|
});
|
|
2121
|
-
var requestIdSchema =
|
|
2122
|
-
var timestampSchema =
|
|
2271
|
+
var requestIdSchema = z17.string().uuid();
|
|
2272
|
+
var timestampSchema = z17.string().datetime();
|
|
2123
2273
|
|
|
2124
2274
|
// ../../packages/core/src/contracts/public/agents.ts
|
|
2125
|
-
import { z as
|
|
2126
|
-
var
|
|
2127
|
-
var publicAgentSchema =
|
|
2128
|
-
id:
|
|
2129
|
-
name:
|
|
2130
|
-
current_version_id:
|
|
2275
|
+
import { z as z18 } from "zod";
|
|
2276
|
+
var c15 = initContract();
|
|
2277
|
+
var publicAgentSchema = z18.object({
|
|
2278
|
+
id: z18.string(),
|
|
2279
|
+
name: z18.string(),
|
|
2280
|
+
current_version_id: z18.string().nullable(),
|
|
2131
2281
|
created_at: timestampSchema,
|
|
2132
2282
|
updated_at: timestampSchema
|
|
2133
2283
|
});
|
|
2134
|
-
var agentVersionSchema =
|
|
2135
|
-
id:
|
|
2136
|
-
agent_id:
|
|
2137
|
-
version_number:
|
|
2284
|
+
var agentVersionSchema = z18.object({
|
|
2285
|
+
id: z18.string(),
|
|
2286
|
+
agent_id: z18.string(),
|
|
2287
|
+
version_number: z18.number(),
|
|
2138
2288
|
created_at: timestampSchema
|
|
2139
2289
|
});
|
|
2140
2290
|
var publicAgentDetailSchema = publicAgentSchema;
|
|
2141
2291
|
var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
|
|
2142
2292
|
var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
|
|
2143
2293
|
var agentListQuerySchema = listQuerySchema.extend({
|
|
2144
|
-
name:
|
|
2294
|
+
name: z18.string().optional()
|
|
2145
2295
|
});
|
|
2146
|
-
var publicAgentsListContract =
|
|
2296
|
+
var publicAgentsListContract = c15.router({
|
|
2147
2297
|
list: {
|
|
2148
2298
|
method: "GET",
|
|
2149
2299
|
path: "/v1/agents",
|
|
@@ -2157,12 +2307,12 @@ var publicAgentsListContract = c14.router({
|
|
|
2157
2307
|
description: "List all agents in the current scope with pagination. Use the `name` query parameter to filter by agent name."
|
|
2158
2308
|
}
|
|
2159
2309
|
});
|
|
2160
|
-
var publicAgentByIdContract =
|
|
2310
|
+
var publicAgentByIdContract = c15.router({
|
|
2161
2311
|
get: {
|
|
2162
2312
|
method: "GET",
|
|
2163
2313
|
path: "/v1/agents/:id",
|
|
2164
|
-
pathParams:
|
|
2165
|
-
id:
|
|
2314
|
+
pathParams: z18.object({
|
|
2315
|
+
id: z18.string().min(1, "Agent ID is required")
|
|
2166
2316
|
}),
|
|
2167
2317
|
responses: {
|
|
2168
2318
|
200: publicAgentDetailSchema,
|
|
@@ -2174,12 +2324,12 @@ var publicAgentByIdContract = c14.router({
|
|
|
2174
2324
|
description: "Get agent details by ID"
|
|
2175
2325
|
}
|
|
2176
2326
|
});
|
|
2177
|
-
var publicAgentVersionsContract =
|
|
2327
|
+
var publicAgentVersionsContract = c15.router({
|
|
2178
2328
|
list: {
|
|
2179
2329
|
method: "GET",
|
|
2180
2330
|
path: "/v1/agents/:id/versions",
|
|
2181
|
-
pathParams:
|
|
2182
|
-
id:
|
|
2331
|
+
pathParams: z18.object({
|
|
2332
|
+
id: z18.string().min(1, "Agent ID is required")
|
|
2183
2333
|
}),
|
|
2184
2334
|
query: listQuerySchema,
|
|
2185
2335
|
responses: {
|
|
@@ -2194,9 +2344,9 @@ var publicAgentVersionsContract = c14.router({
|
|
|
2194
2344
|
});
|
|
2195
2345
|
|
|
2196
2346
|
// ../../packages/core/src/contracts/public/runs.ts
|
|
2197
|
-
import { z as
|
|
2198
|
-
var
|
|
2199
|
-
var publicRunStatusSchema =
|
|
2347
|
+
import { z as z19 } from "zod";
|
|
2348
|
+
var c16 = initContract();
|
|
2349
|
+
var publicRunStatusSchema = z19.enum([
|
|
2200
2350
|
"pending",
|
|
2201
2351
|
"running",
|
|
2202
2352
|
"completed",
|
|
@@ -2204,56 +2354,56 @@ var publicRunStatusSchema = z18.enum([
|
|
|
2204
2354
|
"timeout",
|
|
2205
2355
|
"cancelled"
|
|
2206
2356
|
]);
|
|
2207
|
-
var publicRunSchema =
|
|
2208
|
-
id:
|
|
2209
|
-
agent_id:
|
|
2210
|
-
agent_name:
|
|
2357
|
+
var publicRunSchema = z19.object({
|
|
2358
|
+
id: z19.string(),
|
|
2359
|
+
agent_id: z19.string(),
|
|
2360
|
+
agent_name: z19.string(),
|
|
2211
2361
|
status: publicRunStatusSchema,
|
|
2212
|
-
prompt:
|
|
2362
|
+
prompt: z19.string(),
|
|
2213
2363
|
created_at: timestampSchema,
|
|
2214
2364
|
started_at: timestampSchema.nullable(),
|
|
2215
2365
|
completed_at: timestampSchema.nullable()
|
|
2216
2366
|
});
|
|
2217
2367
|
var publicRunDetailSchema = publicRunSchema.extend({
|
|
2218
|
-
error:
|
|
2219
|
-
execution_time_ms:
|
|
2220
|
-
checkpoint_id:
|
|
2221
|
-
session_id:
|
|
2222
|
-
artifact_name:
|
|
2223
|
-
artifact_version:
|
|
2224
|
-
volumes:
|
|
2368
|
+
error: z19.string().nullable(),
|
|
2369
|
+
execution_time_ms: z19.number().nullable(),
|
|
2370
|
+
checkpoint_id: z19.string().nullable(),
|
|
2371
|
+
session_id: z19.string().nullable(),
|
|
2372
|
+
artifact_name: z19.string().nullable(),
|
|
2373
|
+
artifact_version: z19.string().nullable(),
|
|
2374
|
+
volumes: z19.record(z19.string(), z19.string()).optional()
|
|
2225
2375
|
});
|
|
2226
2376
|
var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
|
|
2227
|
-
var createRunRequestSchema =
|
|
2377
|
+
var createRunRequestSchema = z19.object({
|
|
2228
2378
|
// Agent identification (one of: agent, agent_id, session_id, checkpoint_id)
|
|
2229
|
-
agent:
|
|
2379
|
+
agent: z19.string().optional(),
|
|
2230
2380
|
// Agent name
|
|
2231
|
-
agent_id:
|
|
2381
|
+
agent_id: z19.string().optional(),
|
|
2232
2382
|
// Agent ID
|
|
2233
|
-
agent_version:
|
|
2383
|
+
agent_version: z19.string().optional(),
|
|
2234
2384
|
// Version specifier (e.g., "latest", "v1", specific ID)
|
|
2235
2385
|
// Continue session
|
|
2236
|
-
session_id:
|
|
2386
|
+
session_id: z19.string().optional(),
|
|
2237
2387
|
// Resume from checkpoint
|
|
2238
|
-
checkpoint_id:
|
|
2388
|
+
checkpoint_id: z19.string().optional(),
|
|
2239
2389
|
// Required
|
|
2240
|
-
prompt:
|
|
2390
|
+
prompt: z19.string().min(1, "Prompt is required"),
|
|
2241
2391
|
// Optional configuration
|
|
2242
|
-
variables:
|
|
2243
|
-
secrets:
|
|
2244
|
-
artifact_name:
|
|
2392
|
+
variables: z19.record(z19.string(), z19.string()).optional(),
|
|
2393
|
+
secrets: z19.record(z19.string(), z19.string()).optional(),
|
|
2394
|
+
artifact_name: z19.string().optional(),
|
|
2245
2395
|
// Artifact name to mount
|
|
2246
|
-
artifact_version:
|
|
2396
|
+
artifact_version: z19.string().optional(),
|
|
2247
2397
|
// Artifact version (defaults to latest)
|
|
2248
|
-
volumes:
|
|
2398
|
+
volumes: z19.record(z19.string(), z19.string()).optional()
|
|
2249
2399
|
// volume_name -> version
|
|
2250
2400
|
});
|
|
2251
2401
|
var runListQuerySchema = listQuerySchema.extend({
|
|
2252
|
-
agent_id:
|
|
2402
|
+
agent_id: z19.string().optional(),
|
|
2253
2403
|
status: publicRunStatusSchema.optional(),
|
|
2254
2404
|
since: timestampSchema.optional()
|
|
2255
2405
|
});
|
|
2256
|
-
var publicRunsListContract =
|
|
2406
|
+
var publicRunsListContract = c16.router({
|
|
2257
2407
|
list: {
|
|
2258
2408
|
method: "GET",
|
|
2259
2409
|
path: "/v1/runs",
|
|
@@ -2282,12 +2432,12 @@ var publicRunsListContract = c15.router({
|
|
|
2282
2432
|
description: "Create and execute a new agent run. Returns 202 Accepted as runs execute asynchronously."
|
|
2283
2433
|
}
|
|
2284
2434
|
});
|
|
2285
|
-
var publicRunByIdContract =
|
|
2435
|
+
var publicRunByIdContract = c16.router({
|
|
2286
2436
|
get: {
|
|
2287
2437
|
method: "GET",
|
|
2288
2438
|
path: "/v1/runs/:id",
|
|
2289
|
-
pathParams:
|
|
2290
|
-
id:
|
|
2439
|
+
pathParams: z19.object({
|
|
2440
|
+
id: z19.string().min(1, "Run ID is required")
|
|
2291
2441
|
}),
|
|
2292
2442
|
responses: {
|
|
2293
2443
|
200: publicRunDetailSchema,
|
|
@@ -2299,14 +2449,14 @@ var publicRunByIdContract = c15.router({
|
|
|
2299
2449
|
description: "Get run details by ID"
|
|
2300
2450
|
}
|
|
2301
2451
|
});
|
|
2302
|
-
var publicRunCancelContract =
|
|
2452
|
+
var publicRunCancelContract = c16.router({
|
|
2303
2453
|
cancel: {
|
|
2304
2454
|
method: "POST",
|
|
2305
2455
|
path: "/v1/runs/:id/cancel",
|
|
2306
|
-
pathParams:
|
|
2307
|
-
id:
|
|
2456
|
+
pathParams: z19.object({
|
|
2457
|
+
id: z19.string().min(1, "Run ID is required")
|
|
2308
2458
|
}),
|
|
2309
|
-
body:
|
|
2459
|
+
body: z19.undefined(),
|
|
2310
2460
|
responses: {
|
|
2311
2461
|
200: publicRunDetailSchema,
|
|
2312
2462
|
400: publicApiErrorSchema,
|
|
@@ -2319,26 +2469,26 @@ var publicRunCancelContract = c15.router({
|
|
|
2319
2469
|
description: "Cancel a pending or running execution"
|
|
2320
2470
|
}
|
|
2321
2471
|
});
|
|
2322
|
-
var logEntrySchema =
|
|
2472
|
+
var logEntrySchema = z19.object({
|
|
2323
2473
|
timestamp: timestampSchema,
|
|
2324
|
-
type:
|
|
2325
|
-
level:
|
|
2326
|
-
message:
|
|
2327
|
-
metadata:
|
|
2474
|
+
type: z19.enum(["agent", "system", "network"]),
|
|
2475
|
+
level: z19.enum(["debug", "info", "warn", "error"]),
|
|
2476
|
+
message: z19.string(),
|
|
2477
|
+
metadata: z19.record(z19.string(), z19.unknown()).optional()
|
|
2328
2478
|
});
|
|
2329
2479
|
var paginatedLogsSchema = createPaginatedResponseSchema(logEntrySchema);
|
|
2330
2480
|
var logsQuerySchema = listQuerySchema.extend({
|
|
2331
|
-
type:
|
|
2481
|
+
type: z19.enum(["agent", "system", "network", "all"]).default("all"),
|
|
2332
2482
|
since: timestampSchema.optional(),
|
|
2333
2483
|
until: timestampSchema.optional(),
|
|
2334
|
-
order:
|
|
2484
|
+
order: z19.enum(["asc", "desc"]).default("asc")
|
|
2335
2485
|
});
|
|
2336
|
-
var publicRunLogsContract =
|
|
2486
|
+
var publicRunLogsContract = c16.router({
|
|
2337
2487
|
getLogs: {
|
|
2338
2488
|
method: "GET",
|
|
2339
2489
|
path: "/v1/runs/:id/logs",
|
|
2340
|
-
pathParams:
|
|
2341
|
-
id:
|
|
2490
|
+
pathParams: z19.object({
|
|
2491
|
+
id: z19.string().min(1, "Run ID is required")
|
|
2342
2492
|
}),
|
|
2343
2493
|
query: logsQuerySchema,
|
|
2344
2494
|
responses: {
|
|
@@ -2351,29 +2501,29 @@ var publicRunLogsContract = c15.router({
|
|
|
2351
2501
|
description: "Get unified logs for a run. Combines agent, system, and network logs."
|
|
2352
2502
|
}
|
|
2353
2503
|
});
|
|
2354
|
-
var metricPointSchema =
|
|
2504
|
+
var metricPointSchema = z19.object({
|
|
2355
2505
|
timestamp: timestampSchema,
|
|
2356
|
-
cpu_percent:
|
|
2357
|
-
memory_used_mb:
|
|
2358
|
-
memory_total_mb:
|
|
2359
|
-
disk_used_mb:
|
|
2360
|
-
disk_total_mb:
|
|
2361
|
-
});
|
|
2362
|
-
var metricsSummarySchema =
|
|
2363
|
-
avg_cpu_percent:
|
|
2364
|
-
max_memory_used_mb:
|
|
2365
|
-
total_duration_ms:
|
|
2366
|
-
});
|
|
2367
|
-
var metricsResponseSchema2 =
|
|
2368
|
-
data:
|
|
2506
|
+
cpu_percent: z19.number(),
|
|
2507
|
+
memory_used_mb: z19.number(),
|
|
2508
|
+
memory_total_mb: z19.number(),
|
|
2509
|
+
disk_used_mb: z19.number(),
|
|
2510
|
+
disk_total_mb: z19.number()
|
|
2511
|
+
});
|
|
2512
|
+
var metricsSummarySchema = z19.object({
|
|
2513
|
+
avg_cpu_percent: z19.number(),
|
|
2514
|
+
max_memory_used_mb: z19.number(),
|
|
2515
|
+
total_duration_ms: z19.number().nullable()
|
|
2516
|
+
});
|
|
2517
|
+
var metricsResponseSchema2 = z19.object({
|
|
2518
|
+
data: z19.array(metricPointSchema),
|
|
2369
2519
|
summary: metricsSummarySchema
|
|
2370
2520
|
});
|
|
2371
|
-
var publicRunMetricsContract =
|
|
2521
|
+
var publicRunMetricsContract = c16.router({
|
|
2372
2522
|
getMetrics: {
|
|
2373
2523
|
method: "GET",
|
|
2374
2524
|
path: "/v1/runs/:id/metrics",
|
|
2375
|
-
pathParams:
|
|
2376
|
-
id:
|
|
2525
|
+
pathParams: z19.object({
|
|
2526
|
+
id: z19.string().min(1, "Run ID is required")
|
|
2377
2527
|
}),
|
|
2378
2528
|
responses: {
|
|
2379
2529
|
200: metricsResponseSchema2,
|
|
@@ -2385,7 +2535,7 @@ var publicRunMetricsContract = c15.router({
|
|
|
2385
2535
|
description: "Get CPU, memory, and disk metrics for a run"
|
|
2386
2536
|
}
|
|
2387
2537
|
});
|
|
2388
|
-
var sseEventTypeSchema =
|
|
2538
|
+
var sseEventTypeSchema = z19.enum([
|
|
2389
2539
|
"status",
|
|
2390
2540
|
// Run status change
|
|
2391
2541
|
"output",
|
|
@@ -2397,25 +2547,25 @@ var sseEventTypeSchema = z18.enum([
|
|
|
2397
2547
|
"heartbeat"
|
|
2398
2548
|
// Keep-alive
|
|
2399
2549
|
]);
|
|
2400
|
-
var sseEventSchema =
|
|
2550
|
+
var sseEventSchema = z19.object({
|
|
2401
2551
|
event: sseEventTypeSchema,
|
|
2402
|
-
data:
|
|
2403
|
-
id:
|
|
2552
|
+
data: z19.unknown(),
|
|
2553
|
+
id: z19.string().optional()
|
|
2404
2554
|
// For Last-Event-ID reconnection
|
|
2405
2555
|
});
|
|
2406
|
-
var publicRunEventsContract =
|
|
2556
|
+
var publicRunEventsContract = c16.router({
|
|
2407
2557
|
streamEvents: {
|
|
2408
2558
|
method: "GET",
|
|
2409
2559
|
path: "/v1/runs/:id/events",
|
|
2410
|
-
pathParams:
|
|
2411
|
-
id:
|
|
2560
|
+
pathParams: z19.object({
|
|
2561
|
+
id: z19.string().min(1, "Run ID is required")
|
|
2412
2562
|
}),
|
|
2413
|
-
query:
|
|
2414
|
-
last_event_id:
|
|
2563
|
+
query: z19.object({
|
|
2564
|
+
last_event_id: z19.string().optional()
|
|
2415
2565
|
// For reconnection
|
|
2416
2566
|
}),
|
|
2417
2567
|
responses: {
|
|
2418
|
-
200:
|
|
2568
|
+
200: z19.any(),
|
|
2419
2569
|
// SSE stream - actual content is text/event-stream
|
|
2420
2570
|
401: publicApiErrorSchema,
|
|
2421
2571
|
404: publicApiErrorSchema,
|
|
@@ -2427,28 +2577,28 @@ var publicRunEventsContract = c15.router({
|
|
|
2427
2577
|
});
|
|
2428
2578
|
|
|
2429
2579
|
// ../../packages/core/src/contracts/public/artifacts.ts
|
|
2430
|
-
import { z as
|
|
2431
|
-
var
|
|
2432
|
-
var publicArtifactSchema =
|
|
2433
|
-
id:
|
|
2434
|
-
name:
|
|
2435
|
-
current_version_id:
|
|
2436
|
-
size:
|
|
2580
|
+
import { z as z20 } from "zod";
|
|
2581
|
+
var c17 = initContract();
|
|
2582
|
+
var publicArtifactSchema = z20.object({
|
|
2583
|
+
id: z20.string(),
|
|
2584
|
+
name: z20.string(),
|
|
2585
|
+
current_version_id: z20.string().nullable(),
|
|
2586
|
+
size: z20.number(),
|
|
2437
2587
|
// Total size in bytes
|
|
2438
|
-
file_count:
|
|
2588
|
+
file_count: z20.number(),
|
|
2439
2589
|
created_at: timestampSchema,
|
|
2440
2590
|
updated_at: timestampSchema
|
|
2441
2591
|
});
|
|
2442
|
-
var artifactVersionSchema =
|
|
2443
|
-
id:
|
|
2592
|
+
var artifactVersionSchema = z20.object({
|
|
2593
|
+
id: z20.string(),
|
|
2444
2594
|
// SHA-256 content hash
|
|
2445
|
-
artifact_id:
|
|
2446
|
-
size:
|
|
2595
|
+
artifact_id: z20.string(),
|
|
2596
|
+
size: z20.number(),
|
|
2447
2597
|
// Size in bytes
|
|
2448
|
-
file_count:
|
|
2449
|
-
message:
|
|
2598
|
+
file_count: z20.number(),
|
|
2599
|
+
message: z20.string().nullable(),
|
|
2450
2600
|
// Optional commit message
|
|
2451
|
-
created_by:
|
|
2601
|
+
created_by: z20.string(),
|
|
2452
2602
|
created_at: timestampSchema
|
|
2453
2603
|
});
|
|
2454
2604
|
var publicArtifactDetailSchema = publicArtifactSchema.extend({
|
|
@@ -2458,7 +2608,7 @@ var paginatedArtifactsSchema = createPaginatedResponseSchema(publicArtifactSchem
|
|
|
2458
2608
|
var paginatedArtifactVersionsSchema = createPaginatedResponseSchema(
|
|
2459
2609
|
artifactVersionSchema
|
|
2460
2610
|
);
|
|
2461
|
-
var publicArtifactsListContract =
|
|
2611
|
+
var publicArtifactsListContract = c17.router({
|
|
2462
2612
|
list: {
|
|
2463
2613
|
method: "GET",
|
|
2464
2614
|
path: "/v1/artifacts",
|
|
@@ -2472,12 +2622,12 @@ var publicArtifactsListContract = c16.router({
|
|
|
2472
2622
|
description: "List all artifacts in the current scope with pagination"
|
|
2473
2623
|
}
|
|
2474
2624
|
});
|
|
2475
|
-
var publicArtifactByIdContract =
|
|
2625
|
+
var publicArtifactByIdContract = c17.router({
|
|
2476
2626
|
get: {
|
|
2477
2627
|
method: "GET",
|
|
2478
2628
|
path: "/v1/artifacts/:id",
|
|
2479
|
-
pathParams:
|
|
2480
|
-
id:
|
|
2629
|
+
pathParams: z20.object({
|
|
2630
|
+
id: z20.string().min(1, "Artifact ID is required")
|
|
2481
2631
|
}),
|
|
2482
2632
|
responses: {
|
|
2483
2633
|
200: publicArtifactDetailSchema,
|
|
@@ -2489,12 +2639,12 @@ var publicArtifactByIdContract = c16.router({
|
|
|
2489
2639
|
description: "Get artifact details by ID"
|
|
2490
2640
|
}
|
|
2491
2641
|
});
|
|
2492
|
-
var publicArtifactVersionsContract =
|
|
2642
|
+
var publicArtifactVersionsContract = c17.router({
|
|
2493
2643
|
list: {
|
|
2494
2644
|
method: "GET",
|
|
2495
2645
|
path: "/v1/artifacts/:id/versions",
|
|
2496
|
-
pathParams:
|
|
2497
|
-
id:
|
|
2646
|
+
pathParams: z20.object({
|
|
2647
|
+
id: z20.string().min(1, "Artifact ID is required")
|
|
2498
2648
|
}),
|
|
2499
2649
|
query: listQuerySchema,
|
|
2500
2650
|
responses: {
|
|
@@ -2507,19 +2657,19 @@ var publicArtifactVersionsContract = c16.router({
|
|
|
2507
2657
|
description: "List all versions of an artifact with pagination"
|
|
2508
2658
|
}
|
|
2509
2659
|
});
|
|
2510
|
-
var publicArtifactDownloadContract =
|
|
2660
|
+
var publicArtifactDownloadContract = c17.router({
|
|
2511
2661
|
download: {
|
|
2512
2662
|
method: "GET",
|
|
2513
2663
|
path: "/v1/artifacts/:id/download",
|
|
2514
|
-
pathParams:
|
|
2515
|
-
id:
|
|
2664
|
+
pathParams: z20.object({
|
|
2665
|
+
id: z20.string().min(1, "Artifact ID is required")
|
|
2516
2666
|
}),
|
|
2517
|
-
query:
|
|
2518
|
-
version_id:
|
|
2667
|
+
query: z20.object({
|
|
2668
|
+
version_id: z20.string().optional()
|
|
2519
2669
|
// Defaults to current version
|
|
2520
2670
|
}),
|
|
2521
2671
|
responses: {
|
|
2522
|
-
302:
|
|
2672
|
+
302: z20.undefined(),
|
|
2523
2673
|
// Redirect to presigned URL
|
|
2524
2674
|
401: publicApiErrorSchema,
|
|
2525
2675
|
404: publicApiErrorSchema,
|
|
@@ -2531,28 +2681,28 @@ var publicArtifactDownloadContract = c16.router({
|
|
|
2531
2681
|
});
|
|
2532
2682
|
|
|
2533
2683
|
// ../../packages/core/src/contracts/public/volumes.ts
|
|
2534
|
-
import { z as
|
|
2535
|
-
var
|
|
2536
|
-
var publicVolumeSchema =
|
|
2537
|
-
id:
|
|
2538
|
-
name:
|
|
2539
|
-
current_version_id:
|
|
2540
|
-
size:
|
|
2684
|
+
import { z as z21 } from "zod";
|
|
2685
|
+
var c18 = initContract();
|
|
2686
|
+
var publicVolumeSchema = z21.object({
|
|
2687
|
+
id: z21.string(),
|
|
2688
|
+
name: z21.string(),
|
|
2689
|
+
current_version_id: z21.string().nullable(),
|
|
2690
|
+
size: z21.number(),
|
|
2541
2691
|
// Total size in bytes
|
|
2542
|
-
file_count:
|
|
2692
|
+
file_count: z21.number(),
|
|
2543
2693
|
created_at: timestampSchema,
|
|
2544
2694
|
updated_at: timestampSchema
|
|
2545
2695
|
});
|
|
2546
|
-
var volumeVersionSchema =
|
|
2547
|
-
id:
|
|
2696
|
+
var volumeVersionSchema = z21.object({
|
|
2697
|
+
id: z21.string(),
|
|
2548
2698
|
// SHA-256 content hash
|
|
2549
|
-
volume_id:
|
|
2550
|
-
size:
|
|
2699
|
+
volume_id: z21.string(),
|
|
2700
|
+
size: z21.number(),
|
|
2551
2701
|
// Size in bytes
|
|
2552
|
-
file_count:
|
|
2553
|
-
message:
|
|
2702
|
+
file_count: z21.number(),
|
|
2703
|
+
message: z21.string().nullable(),
|
|
2554
2704
|
// Optional commit message
|
|
2555
|
-
created_by:
|
|
2705
|
+
created_by: z21.string(),
|
|
2556
2706
|
created_at: timestampSchema
|
|
2557
2707
|
});
|
|
2558
2708
|
var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
@@ -2560,7 +2710,7 @@ var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
|
2560
2710
|
});
|
|
2561
2711
|
var paginatedVolumesSchema = createPaginatedResponseSchema(publicVolumeSchema);
|
|
2562
2712
|
var paginatedVolumeVersionsSchema = createPaginatedResponseSchema(volumeVersionSchema);
|
|
2563
|
-
var publicVolumesListContract =
|
|
2713
|
+
var publicVolumesListContract = c18.router({
|
|
2564
2714
|
list: {
|
|
2565
2715
|
method: "GET",
|
|
2566
2716
|
path: "/v1/volumes",
|
|
@@ -2574,12 +2724,12 @@ var publicVolumesListContract = c17.router({
|
|
|
2574
2724
|
description: "List all volumes in the current scope with pagination"
|
|
2575
2725
|
}
|
|
2576
2726
|
});
|
|
2577
|
-
var publicVolumeByIdContract =
|
|
2727
|
+
var publicVolumeByIdContract = c18.router({
|
|
2578
2728
|
get: {
|
|
2579
2729
|
method: "GET",
|
|
2580
2730
|
path: "/v1/volumes/:id",
|
|
2581
|
-
pathParams:
|
|
2582
|
-
id:
|
|
2731
|
+
pathParams: z21.object({
|
|
2732
|
+
id: z21.string().min(1, "Volume ID is required")
|
|
2583
2733
|
}),
|
|
2584
2734
|
responses: {
|
|
2585
2735
|
200: publicVolumeDetailSchema,
|
|
@@ -2591,12 +2741,12 @@ var publicVolumeByIdContract = c17.router({
|
|
|
2591
2741
|
description: "Get volume details by ID"
|
|
2592
2742
|
}
|
|
2593
2743
|
});
|
|
2594
|
-
var publicVolumeVersionsContract =
|
|
2744
|
+
var publicVolumeVersionsContract = c18.router({
|
|
2595
2745
|
list: {
|
|
2596
2746
|
method: "GET",
|
|
2597
2747
|
path: "/v1/volumes/:id/versions",
|
|
2598
|
-
pathParams:
|
|
2599
|
-
id:
|
|
2748
|
+
pathParams: z21.object({
|
|
2749
|
+
id: z21.string().min(1, "Volume ID is required")
|
|
2600
2750
|
}),
|
|
2601
2751
|
query: listQuerySchema,
|
|
2602
2752
|
responses: {
|
|
@@ -2609,19 +2759,19 @@ var publicVolumeVersionsContract = c17.router({
|
|
|
2609
2759
|
description: "List all versions of a volume with pagination"
|
|
2610
2760
|
}
|
|
2611
2761
|
});
|
|
2612
|
-
var publicVolumeDownloadContract =
|
|
2762
|
+
var publicVolumeDownloadContract = c18.router({
|
|
2613
2763
|
download: {
|
|
2614
2764
|
method: "GET",
|
|
2615
2765
|
path: "/v1/volumes/:id/download",
|
|
2616
|
-
pathParams:
|
|
2617
|
-
id:
|
|
2766
|
+
pathParams: z21.object({
|
|
2767
|
+
id: z21.string().min(1, "Volume ID is required")
|
|
2618
2768
|
}),
|
|
2619
|
-
query:
|
|
2620
|
-
version_id:
|
|
2769
|
+
query: z21.object({
|
|
2770
|
+
version_id: z21.string().optional()
|
|
2621
2771
|
// Defaults to current version
|
|
2622
2772
|
}),
|
|
2623
2773
|
responses: {
|
|
2624
|
-
302:
|
|
2774
|
+
302: z21.undefined(),
|
|
2625
2775
|
// Redirect to presigned URL
|
|
2626
2776
|
401: publicApiErrorSchema,
|
|
2627
2777
|
404: publicApiErrorSchema,
|
|
@@ -2691,34 +2841,34 @@ function parseGitHubTreeUrl(url) {
|
|
|
2691
2841
|
};
|
|
2692
2842
|
}
|
|
2693
2843
|
|
|
2694
|
-
// ../../packages/core/src/
|
|
2695
|
-
var
|
|
2696
|
-
function
|
|
2697
|
-
if (!
|
|
2698
|
-
return
|
|
2844
|
+
// ../../packages/core/src/frameworks.ts
|
|
2845
|
+
var SUPPORTED_FRAMEWORKS = ["claude-code", "codex"];
|
|
2846
|
+
function isSupportedFramework(framework) {
|
|
2847
|
+
if (!framework) return false;
|
|
2848
|
+
return SUPPORTED_FRAMEWORKS.includes(framework);
|
|
2699
2849
|
}
|
|
2700
|
-
function
|
|
2701
|
-
if (!
|
|
2850
|
+
function assertSupportedFramework(framework, context) {
|
|
2851
|
+
if (!isSupportedFramework(framework)) {
|
|
2702
2852
|
const contextMsg = context ? ` in ${context}` : "";
|
|
2703
2853
|
throw new Error(
|
|
2704
|
-
`Unsupported
|
|
2854
|
+
`Unsupported framework "${framework}"${contextMsg}. Supported frameworks: ${SUPPORTED_FRAMEWORKS.join(", ")}`
|
|
2705
2855
|
);
|
|
2706
2856
|
}
|
|
2707
2857
|
}
|
|
2708
|
-
function
|
|
2709
|
-
if (
|
|
2858
|
+
function getValidatedFramework(framework) {
|
|
2859
|
+
if (framework === void 0) {
|
|
2710
2860
|
return "claude-code";
|
|
2711
2861
|
}
|
|
2712
|
-
|
|
2713
|
-
return
|
|
2862
|
+
assertSupportedFramework(framework);
|
|
2863
|
+
return framework;
|
|
2714
2864
|
}
|
|
2715
|
-
var
|
|
2865
|
+
var FRAMEWORK_DISPLAY_NAMES = {
|
|
2716
2866
|
"claude-code": "Claude Code",
|
|
2717
2867
|
codex: "Codex"
|
|
2718
2868
|
};
|
|
2719
|
-
function
|
|
2720
|
-
|
|
2721
|
-
return
|
|
2869
|
+
function getFrameworkDisplayName(framework) {
|
|
2870
|
+
assertSupportedFramework(framework);
|
|
2871
|
+
return FRAMEWORK_DISPLAY_NAMES[framework];
|
|
2722
2872
|
}
|
|
2723
2873
|
|
|
2724
2874
|
// ../../packages/core/src/feature-switch.ts
|
|
@@ -3091,6 +3241,71 @@ async function deleteCredential(name) {
|
|
|
3091
3241
|
handleError(result, `Credential "${name}" not found`);
|
|
3092
3242
|
}
|
|
3093
3243
|
|
|
3244
|
+
// src/lib/api/domains/model-providers.ts
|
|
3245
|
+
import { initClient as initClient8 } from "@ts-rest/core";
|
|
3246
|
+
async function listModelProviders() {
|
|
3247
|
+
const config = await getClientConfig();
|
|
3248
|
+
const client = initClient8(modelProvidersMainContract, config);
|
|
3249
|
+
const result = await client.list();
|
|
3250
|
+
if (result.status === 200) {
|
|
3251
|
+
return result.body;
|
|
3252
|
+
}
|
|
3253
|
+
handleError(result, "Failed to list model providers");
|
|
3254
|
+
}
|
|
3255
|
+
async function upsertModelProvider(body) {
|
|
3256
|
+
const config = await getClientConfig();
|
|
3257
|
+
const client = initClient8(modelProvidersMainContract, config);
|
|
3258
|
+
const result = await client.upsert({ body });
|
|
3259
|
+
if (result.status === 200 || result.status === 201) {
|
|
3260
|
+
return result.body;
|
|
3261
|
+
}
|
|
3262
|
+
handleError(result, "Failed to set model provider");
|
|
3263
|
+
}
|
|
3264
|
+
async function checkModelProviderCredential(type) {
|
|
3265
|
+
const config = await getClientConfig();
|
|
3266
|
+
const client = initClient8(modelProvidersCheckContract, config);
|
|
3267
|
+
const result = await client.check({
|
|
3268
|
+
params: { type }
|
|
3269
|
+
});
|
|
3270
|
+
if (result.status === 200) {
|
|
3271
|
+
return result.body;
|
|
3272
|
+
}
|
|
3273
|
+
handleError(result, "Failed to check credential");
|
|
3274
|
+
}
|
|
3275
|
+
async function deleteModelProvider(type) {
|
|
3276
|
+
const config = await getClientConfig();
|
|
3277
|
+
const client = initClient8(modelProvidersByTypeContract, config);
|
|
3278
|
+
const result = await client.delete({
|
|
3279
|
+
params: { type }
|
|
3280
|
+
});
|
|
3281
|
+
if (result.status === 204) {
|
|
3282
|
+
return;
|
|
3283
|
+
}
|
|
3284
|
+
handleError(result, `Model provider "${type}" not found`);
|
|
3285
|
+
}
|
|
3286
|
+
async function convertModelProviderCredential(type) {
|
|
3287
|
+
const config = await getClientConfig();
|
|
3288
|
+
const client = initClient8(modelProvidersConvertContract, config);
|
|
3289
|
+
const result = await client.convert({
|
|
3290
|
+
params: { type }
|
|
3291
|
+
});
|
|
3292
|
+
if (result.status === 200) {
|
|
3293
|
+
return result.body;
|
|
3294
|
+
}
|
|
3295
|
+
handleError(result, "Failed to convert credential");
|
|
3296
|
+
}
|
|
3297
|
+
async function setModelProviderDefault(type) {
|
|
3298
|
+
const config = await getClientConfig();
|
|
3299
|
+
const client = initClient8(modelProvidersSetDefaultContract, config);
|
|
3300
|
+
const result = await client.setDefault({
|
|
3301
|
+
params: { type }
|
|
3302
|
+
});
|
|
3303
|
+
if (result.status === 200) {
|
|
3304
|
+
return result.body;
|
|
3305
|
+
}
|
|
3306
|
+
handleError(result, "Failed to set default model provider");
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3094
3309
|
// src/lib/api/domains/usage.ts
|
|
3095
3310
|
async function getUsage(options) {
|
|
3096
3311
|
const baseUrl = await getBaseUrl();
|
|
@@ -3111,10 +3326,10 @@ async function getUsage(options) {
|
|
|
3111
3326
|
}
|
|
3112
3327
|
|
|
3113
3328
|
// src/lib/domain/yaml-validator.ts
|
|
3114
|
-
import { z as
|
|
3329
|
+
import { z as z22 } from "zod";
|
|
3115
3330
|
|
|
3116
|
-
// src/lib/domain/
|
|
3117
|
-
var
|
|
3331
|
+
// src/lib/domain/framework-config.ts
|
|
3332
|
+
var FRAMEWORK_DEFAULTS = {
|
|
3118
3333
|
"claude-code": {
|
|
3119
3334
|
workingDir: "/home/user/workspace",
|
|
3120
3335
|
image: {
|
|
@@ -3130,13 +3345,13 @@ var PROVIDER_DEFAULTS = {
|
|
|
3130
3345
|
}
|
|
3131
3346
|
}
|
|
3132
3347
|
};
|
|
3133
|
-
function
|
|
3134
|
-
return
|
|
3348
|
+
function getFrameworkDefaults(framework) {
|
|
3349
|
+
return FRAMEWORK_DEFAULTS[framework];
|
|
3135
3350
|
}
|
|
3136
|
-
function
|
|
3137
|
-
return
|
|
3351
|
+
function isFrameworkSupported(framework) {
|
|
3352
|
+
return framework in FRAMEWORK_DEFAULTS;
|
|
3138
3353
|
}
|
|
3139
|
-
var
|
|
3354
|
+
var FRAMEWORK_APPS_IMAGES = {
|
|
3140
3355
|
"claude-code": {
|
|
3141
3356
|
github: {
|
|
3142
3357
|
production: "vm0/claude-code-github:latest",
|
|
@@ -3157,16 +3372,16 @@ function parseAppString(appString) {
|
|
|
3157
3372
|
tag: tag === "dev" ? "dev" : "latest"
|
|
3158
3373
|
};
|
|
3159
3374
|
}
|
|
3160
|
-
function getDefaultImageWithApps(
|
|
3161
|
-
const defaults =
|
|
3375
|
+
function getDefaultImageWithApps(framework, apps) {
|
|
3376
|
+
const defaults = FRAMEWORK_DEFAULTS[framework];
|
|
3162
3377
|
if (!defaults) return void 0;
|
|
3163
3378
|
if (apps && apps.length > 0) {
|
|
3164
|
-
const
|
|
3165
|
-
if (
|
|
3379
|
+
const frameworkApps = FRAMEWORK_APPS_IMAGES[framework];
|
|
3380
|
+
if (frameworkApps) {
|
|
3166
3381
|
const firstApp = apps[0];
|
|
3167
3382
|
if (firstApp) {
|
|
3168
3383
|
const { app, tag } = parseAppString(firstApp);
|
|
3169
|
-
const appImage =
|
|
3384
|
+
const appImage = frameworkApps[app];
|
|
3170
3385
|
if (appImage) {
|
|
3171
3386
|
return tag === "dev" ? appImage.development : appImage.production;
|
|
3172
3387
|
}
|
|
@@ -3178,7 +3393,7 @@ function getDefaultImageWithApps(provider, apps) {
|
|
|
3178
3393
|
}
|
|
3179
3394
|
|
|
3180
3395
|
// src/lib/domain/yaml-validator.ts
|
|
3181
|
-
var cliAgentNameSchema =
|
|
3396
|
+
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
3397
|
/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
|
|
3183
3398
|
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
3184
3399
|
);
|
|
@@ -3188,18 +3403,18 @@ function validateGitHubTreeUrl(url) {
|
|
|
3188
3403
|
}
|
|
3189
3404
|
var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
3190
3405
|
(agent, ctx) => {
|
|
3191
|
-
const
|
|
3192
|
-
if (!agent.image && !
|
|
3406
|
+
const frameworkSupported = isFrameworkSupported(agent.framework);
|
|
3407
|
+
if (!agent.image && !frameworkSupported) {
|
|
3193
3408
|
ctx.addIssue({
|
|
3194
|
-
code:
|
|
3195
|
-
message: "Missing agent.image (required when
|
|
3409
|
+
code: z22.ZodIssueCode.custom,
|
|
3410
|
+
message: "Missing agent.image (required when framework is not auto-configured)",
|
|
3196
3411
|
path: ["image"]
|
|
3197
3412
|
});
|
|
3198
3413
|
}
|
|
3199
|
-
if (!agent.working_dir && !
|
|
3414
|
+
if (!agent.working_dir && !frameworkSupported) {
|
|
3200
3415
|
ctx.addIssue({
|
|
3201
|
-
code:
|
|
3202
|
-
message: "Missing agent.working_dir (required when
|
|
3416
|
+
code: z22.ZodIssueCode.custom,
|
|
3417
|
+
message: "Missing agent.working_dir (required when framework is not auto-configured)",
|
|
3203
3418
|
path: ["working_dir"]
|
|
3204
3419
|
});
|
|
3205
3420
|
}
|
|
@@ -3208,7 +3423,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
3208
3423
|
const skillUrl = agent.skills[i];
|
|
3209
3424
|
if (skillUrl && !validateGitHubTreeUrl(skillUrl)) {
|
|
3210
3425
|
ctx.addIssue({
|
|
3211
|
-
code:
|
|
3426
|
+
code: z22.ZodIssueCode.custom,
|
|
3212
3427
|
message: `Invalid skill URL: ${skillUrl}. Expected format: https://github.com/{owner}/{repo}/tree/{branch}/{path}`,
|
|
3213
3428
|
path: ["skills", i]
|
|
3214
3429
|
});
|
|
@@ -3217,15 +3432,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
3217
3432
|
}
|
|
3218
3433
|
}
|
|
3219
3434
|
);
|
|
3220
|
-
var cliComposeSchema =
|
|
3221
|
-
version:
|
|
3222
|
-
agents:
|
|
3223
|
-
volumes:
|
|
3435
|
+
var cliComposeSchema = z22.object({
|
|
3436
|
+
version: z22.string().min(1, "Missing config.version"),
|
|
3437
|
+
agents: z22.record(cliAgentNameSchema, cliAgentDefinitionSchema),
|
|
3438
|
+
volumes: z22.record(z22.string(), volumeConfigSchema).optional()
|
|
3224
3439
|
}).superRefine((config, ctx) => {
|
|
3225
3440
|
const agentKeys = Object.keys(config.agents);
|
|
3226
3441
|
if (agentKeys.length === 0) {
|
|
3227
3442
|
ctx.addIssue({
|
|
3228
|
-
code:
|
|
3443
|
+
code: z22.ZodIssueCode.custom,
|
|
3229
3444
|
message: "agents must have at least one agent defined",
|
|
3230
3445
|
path: ["agents"]
|
|
3231
3446
|
});
|
|
@@ -3233,7 +3448,7 @@ var cliComposeSchema = z21.object({
|
|
|
3233
3448
|
}
|
|
3234
3449
|
if (agentKeys.length > 1) {
|
|
3235
3450
|
ctx.addIssue({
|
|
3236
|
-
code:
|
|
3451
|
+
code: z22.ZodIssueCode.custom,
|
|
3237
3452
|
message: "Multiple agents not supported yet. Only one agent allowed.",
|
|
3238
3453
|
path: ["agents"]
|
|
3239
3454
|
});
|
|
@@ -3245,7 +3460,7 @@ var cliComposeSchema = z21.object({
|
|
|
3245
3460
|
if (agentVolumes && agentVolumes.length > 0) {
|
|
3246
3461
|
if (!config.volumes) {
|
|
3247
3462
|
ctx.addIssue({
|
|
3248
|
-
code:
|
|
3463
|
+
code: z22.ZodIssueCode.custom,
|
|
3249
3464
|
message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
|
|
3250
3465
|
path: ["volumes"]
|
|
3251
3466
|
});
|
|
@@ -3255,7 +3470,7 @@ var cliComposeSchema = z21.object({
|
|
|
3255
3470
|
const parts = volDeclaration.split(":");
|
|
3256
3471
|
if (parts.length !== 2) {
|
|
3257
3472
|
ctx.addIssue({
|
|
3258
|
-
code:
|
|
3473
|
+
code: z22.ZodIssueCode.custom,
|
|
3259
3474
|
message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
|
|
3260
3475
|
path: ["agents", agentName, "volumes"]
|
|
3261
3476
|
});
|
|
@@ -3264,7 +3479,7 @@ var cliComposeSchema = z21.object({
|
|
|
3264
3479
|
const volumeKey = parts[0].trim();
|
|
3265
3480
|
if (!config.volumes[volumeKey]) {
|
|
3266
3481
|
ctx.addIssue({
|
|
3267
|
-
code:
|
|
3482
|
+
code: z22.ZodIssueCode.custom,
|
|
3268
3483
|
message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
|
|
3269
3484
|
path: ["volumes", volumeKey]
|
|
3270
3485
|
});
|
|
@@ -3334,7 +3549,31 @@ function formatZodError(error) {
|
|
|
3334
3549
|
function validateAgentName(name) {
|
|
3335
3550
|
return cliAgentNameSchema.safeParse(name).success;
|
|
3336
3551
|
}
|
|
3552
|
+
function checkForDeprecatedProvider(config) {
|
|
3553
|
+
if (!config || typeof config !== "object") return null;
|
|
3554
|
+
const cfg = config;
|
|
3555
|
+
const agents = cfg.agents;
|
|
3556
|
+
if (!agents || typeof agents !== "object" || Array.isArray(agents))
|
|
3557
|
+
return null;
|
|
3558
|
+
for (const agent of Object.values(agents)) {
|
|
3559
|
+
if (agent && typeof agent === "object" && !Array.isArray(agent)) {
|
|
3560
|
+
if ("provider" in agent && !("framework" in agent)) {
|
|
3561
|
+
const providerValue = agent.provider;
|
|
3562
|
+
return `'provider' field is deprecated. Use 'framework' instead.
|
|
3563
|
+
|
|
3564
|
+
Change in your vm0.yaml:
|
|
3565
|
+
- provider: ${providerValue}
|
|
3566
|
+
+ framework: ${providerValue}`;
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3569
|
+
}
|
|
3570
|
+
return null;
|
|
3571
|
+
}
|
|
3337
3572
|
function validateAgentCompose(config) {
|
|
3573
|
+
const deprecationError = checkForDeprecatedProvider(config);
|
|
3574
|
+
if (deprecationError) {
|
|
3575
|
+
return { valid: false, error: deprecationError };
|
|
3576
|
+
}
|
|
3338
3577
|
if (config && typeof config === "object" && Array.isArray(config.agents)) {
|
|
3339
3578
|
return {
|
|
3340
3579
|
valid: false,
|
|
@@ -3742,21 +3981,21 @@ async function directUpload(storageName, storageType, cwd, options) {
|
|
|
3742
3981
|
}
|
|
3743
3982
|
|
|
3744
3983
|
// src/lib/storage/system-storage.ts
|
|
3745
|
-
function getInstructionsFilename(
|
|
3746
|
-
const
|
|
3747
|
-
if (
|
|
3984
|
+
function getInstructionsFilename(framework) {
|
|
3985
|
+
const validatedFramework = getValidatedFramework(framework);
|
|
3986
|
+
if (validatedFramework === "codex") {
|
|
3748
3987
|
return "AGENTS.md";
|
|
3749
3988
|
}
|
|
3750
3989
|
return "CLAUDE.md";
|
|
3751
3990
|
}
|
|
3752
|
-
async function uploadInstructions(agentName, instructionsFilePath, basePath,
|
|
3991
|
+
async function uploadInstructions(agentName, instructionsFilePath, basePath, framework) {
|
|
3753
3992
|
const storageName = getInstructionsStorageName(agentName);
|
|
3754
3993
|
const absolutePath = path4.isAbsolute(instructionsFilePath) ? instructionsFilePath : path4.join(basePath, instructionsFilePath);
|
|
3755
3994
|
const content = await fs4.readFile(absolutePath, "utf8");
|
|
3756
3995
|
const tmpDir = await fs4.mkdtemp(path4.join(os3.tmpdir(), "vm0-instructions-"));
|
|
3757
3996
|
const instructionsDir = path4.join(tmpDir, "instructions");
|
|
3758
3997
|
await fs4.mkdir(instructionsDir);
|
|
3759
|
-
const filename = getInstructionsFilename(
|
|
3998
|
+
const filename = getInstructionsFilename(framework);
|
|
3760
3999
|
await fs4.writeFile(path4.join(instructionsDir, filename), content);
|
|
3761
4000
|
try {
|
|
3762
4001
|
const result = await directUpload(storageName, "volume", instructionsDir);
|
|
@@ -3868,13 +4107,13 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
3868
4107
|
const agentName = Object.keys(agents)[0];
|
|
3869
4108
|
const agent = agents[agentName];
|
|
3870
4109
|
const basePath = dirname2(configFile);
|
|
3871
|
-
if (agent.
|
|
3872
|
-
const defaults =
|
|
4110
|
+
if (agent.framework) {
|
|
4111
|
+
const defaults = getFrameworkDefaults(agent.framework);
|
|
3873
4112
|
if (defaults) {
|
|
3874
4113
|
if (!agent.image) {
|
|
3875
4114
|
const apps = agent.apps;
|
|
3876
4115
|
const defaultImage = getDefaultImageWithApps(
|
|
3877
|
-
agent.
|
|
4116
|
+
agent.framework,
|
|
3878
4117
|
apps
|
|
3879
4118
|
);
|
|
3880
4119
|
if (defaultImage) {
|
|
@@ -3896,13 +4135,13 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
3896
4135
|
}
|
|
3897
4136
|
if (agent.instructions) {
|
|
3898
4137
|
const instructionsPath = agent.instructions;
|
|
3899
|
-
const
|
|
4138
|
+
const framework = agent.framework;
|
|
3900
4139
|
console.log(`Uploading instructions: ${instructionsPath}`);
|
|
3901
4140
|
const result = await uploadInstructions(
|
|
3902
4141
|
agentName,
|
|
3903
4142
|
instructionsPath,
|
|
3904
4143
|
basePath,
|
|
3905
|
-
|
|
4144
|
+
framework
|
|
3906
4145
|
);
|
|
3907
4146
|
console.log(
|
|
3908
4147
|
chalk2.green(
|
|
@@ -4061,7 +4300,7 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
4061
4300
|
});
|
|
4062
4301
|
|
|
4063
4302
|
// src/commands/run/run.ts
|
|
4064
|
-
import { Command as Command2 } from "commander";
|
|
4303
|
+
import { Command as Command2, Option } from "commander";
|
|
4065
4304
|
import chalk6 from "chalk";
|
|
4066
4305
|
|
|
4067
4306
|
// src/lib/events/event-renderer.ts
|
|
@@ -4174,8 +4413,8 @@ var EventRenderer = class {
|
|
|
4174
4413
|
);
|
|
4175
4414
|
}
|
|
4176
4415
|
static renderInit(event, prefix, suffix) {
|
|
4177
|
-
const
|
|
4178
|
-
const displayName =
|
|
4416
|
+
const frameworkStr = String(event.data.framework || "claude-code");
|
|
4417
|
+
const displayName = isSupportedFramework(frameworkStr) ? getFrameworkDisplayName(frameworkStr) : frameworkStr;
|
|
4179
4418
|
console.log(prefix + "[init]" + suffix + ` Starting ${displayName} agent`);
|
|
4180
4419
|
console.log(` Session: ${chalk3.dim(String(event.data.sessionId || ""))}`);
|
|
4181
4420
|
if (event.data.model) {
|
|
@@ -4289,7 +4528,7 @@ var ClaudeEventParser = class {
|
|
|
4289
4528
|
type: "init",
|
|
4290
4529
|
timestamp: /* @__PURE__ */ new Date(),
|
|
4291
4530
|
data: {
|
|
4292
|
-
|
|
4531
|
+
framework: "claude-code",
|
|
4293
4532
|
sessionId: event.session_id,
|
|
4294
4533
|
model: event.model,
|
|
4295
4534
|
tools: event.tools,
|
|
@@ -4395,7 +4634,7 @@ var CodexEventParser = class {
|
|
|
4395
4634
|
type: "init",
|
|
4396
4635
|
timestamp: /* @__PURE__ */ new Date(),
|
|
4397
4636
|
data: {
|
|
4398
|
-
|
|
4637
|
+
framework: "codex",
|
|
4399
4638
|
sessionId: event.thread_id,
|
|
4400
4639
|
tools: []
|
|
4401
4640
|
}
|
|
@@ -4516,9 +4755,9 @@ var CodexEventParser = class {
|
|
|
4516
4755
|
}
|
|
4517
4756
|
}
|
|
4518
4757
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
4519
|
-
const changes = item.changes.map((
|
|
4520
|
-
const action =
|
|
4521
|
-
return `${action}: ${
|
|
4758
|
+
const changes = item.changes.map((c19) => {
|
|
4759
|
+
const action = c19.kind === "add" ? "Created" : c19.kind === "modify" ? "Modified" : "Deleted";
|
|
4760
|
+
return `${action}: ${c19.path}`;
|
|
4522
4761
|
}).join("\n");
|
|
4523
4762
|
return {
|
|
4524
4763
|
type: "text",
|
|
@@ -4553,7 +4792,7 @@ ${changes}` }
|
|
|
4553
4792
|
};
|
|
4554
4793
|
|
|
4555
4794
|
// src/lib/events/event-parser-factory.ts
|
|
4556
|
-
function
|
|
4795
|
+
function detectFrameworkFromEvent(rawEvent) {
|
|
4557
4796
|
if (!rawEvent || typeof rawEvent !== "object") {
|
|
4558
4797
|
return null;
|
|
4559
4798
|
}
|
|
@@ -4566,15 +4805,15 @@ function detectProviderFromEvent(rawEvent) {
|
|
|
4566
4805
|
}
|
|
4567
4806
|
return null;
|
|
4568
4807
|
}
|
|
4569
|
-
function getEventParser(
|
|
4570
|
-
if (
|
|
4808
|
+
function getEventParser(framework) {
|
|
4809
|
+
if (framework === "codex") {
|
|
4571
4810
|
return CodexEventParser;
|
|
4572
4811
|
}
|
|
4573
4812
|
return ClaudeEventParser;
|
|
4574
4813
|
}
|
|
4575
|
-
function parseEvent(rawEvent,
|
|
4576
|
-
const
|
|
4577
|
-
const Parser = getEventParser(
|
|
4814
|
+
function parseEvent(rawEvent, framework) {
|
|
4815
|
+
const effectiveFramework = framework ? getValidatedFramework(framework) : detectFrameworkFromEvent(rawEvent) || "claude-code";
|
|
4816
|
+
const Parser = getEventParser(effectiveFramework);
|
|
4578
4817
|
return Parser.parse(rawEvent);
|
|
4579
4818
|
}
|
|
4580
4819
|
|
|
@@ -4671,9 +4910,9 @@ var CodexEventRenderer = class {
|
|
|
4671
4910
|
return;
|
|
4672
4911
|
}
|
|
4673
4912
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
4674
|
-
const summary = item.changes.map((
|
|
4675
|
-
const icon =
|
|
4676
|
-
return `${icon}${
|
|
4913
|
+
const summary = item.changes.map((c19) => {
|
|
4914
|
+
const icon = c19.kind === "add" ? "+" : c19.kind === "delete" ? "-" : "~";
|
|
4915
|
+
return `${icon}${c19.path}`;
|
|
4677
4916
|
}).join(", ");
|
|
4678
4917
|
console.log(chalk4.green("[files]") + ` ${summary}`);
|
|
4679
4918
|
return;
|
|
@@ -4694,7 +4933,7 @@ var CodexEventRenderer = class {
|
|
|
4694
4933
|
};
|
|
4695
4934
|
|
|
4696
4935
|
// src/lib/api/api-client.ts
|
|
4697
|
-
import { initClient as
|
|
4936
|
+
import { initClient as initClient9 } from "@ts-rest/core";
|
|
4698
4937
|
var ApiClient = class {
|
|
4699
4938
|
async getHeaders() {
|
|
4700
4939
|
const token = await getToken();
|
|
@@ -4720,7 +4959,7 @@ var ApiClient = class {
|
|
|
4720
4959
|
async getComposeByName(name, scope) {
|
|
4721
4960
|
const baseUrl = await this.getBaseUrl();
|
|
4722
4961
|
const headers = await this.getHeaders();
|
|
4723
|
-
const client =
|
|
4962
|
+
const client = initClient9(composesMainContract, {
|
|
4724
4963
|
baseUrl,
|
|
4725
4964
|
baseHeaders: headers,
|
|
4726
4965
|
jsonQuery: true
|
|
@@ -4741,7 +4980,7 @@ var ApiClient = class {
|
|
|
4741
4980
|
async getComposeById(id) {
|
|
4742
4981
|
const baseUrl = await this.getBaseUrl();
|
|
4743
4982
|
const headers = await this.getHeaders();
|
|
4744
|
-
const client =
|
|
4983
|
+
const client = initClient9(composesByIdContract, {
|
|
4745
4984
|
baseUrl,
|
|
4746
4985
|
baseHeaders: headers,
|
|
4747
4986
|
jsonQuery: true
|
|
@@ -4763,7 +5002,7 @@ var ApiClient = class {
|
|
|
4763
5002
|
async getComposeVersion(composeId, version) {
|
|
4764
5003
|
const baseUrl = await this.getBaseUrl();
|
|
4765
5004
|
const headers = await this.getHeaders();
|
|
4766
|
-
const client =
|
|
5005
|
+
const client = initClient9(composesVersionsContract, {
|
|
4767
5006
|
baseUrl,
|
|
4768
5007
|
baseHeaders: headers,
|
|
4769
5008
|
jsonQuery: true
|
|
@@ -4784,7 +5023,7 @@ var ApiClient = class {
|
|
|
4784
5023
|
async createOrUpdateCompose(body) {
|
|
4785
5024
|
const baseUrl = await this.getBaseUrl();
|
|
4786
5025
|
const headers = await this.getHeaders();
|
|
4787
|
-
const client =
|
|
5026
|
+
const client = initClient9(composesMainContract, {
|
|
4788
5027
|
baseUrl,
|
|
4789
5028
|
baseHeaders: headers,
|
|
4790
5029
|
jsonQuery: true
|
|
@@ -4807,7 +5046,7 @@ var ApiClient = class {
|
|
|
4807
5046
|
async createRun(body) {
|
|
4808
5047
|
const baseUrl = await this.getBaseUrl();
|
|
4809
5048
|
const headers = await this.getHeaders();
|
|
4810
|
-
const client =
|
|
5049
|
+
const client = initClient9(runsMainContract, {
|
|
4811
5050
|
baseUrl,
|
|
4812
5051
|
baseHeaders: headers,
|
|
4813
5052
|
jsonQuery: true
|
|
@@ -4823,7 +5062,7 @@ var ApiClient = class {
|
|
|
4823
5062
|
async getEvents(runId, options) {
|
|
4824
5063
|
const baseUrl = await this.getBaseUrl();
|
|
4825
5064
|
const headers = await this.getHeaders();
|
|
4826
|
-
const client =
|
|
5065
|
+
const client = initClient9(runEventsContract, {
|
|
4827
5066
|
baseUrl,
|
|
4828
5067
|
baseHeaders: headers,
|
|
4829
5068
|
jsonQuery: true
|
|
@@ -4845,7 +5084,7 @@ var ApiClient = class {
|
|
|
4845
5084
|
async getSystemLog(runId, options) {
|
|
4846
5085
|
const baseUrl = await this.getBaseUrl();
|
|
4847
5086
|
const headers = await this.getHeaders();
|
|
4848
|
-
const client =
|
|
5087
|
+
const client = initClient9(runSystemLogContract, {
|
|
4849
5088
|
baseUrl,
|
|
4850
5089
|
baseHeaders: headers,
|
|
4851
5090
|
jsonQuery: true
|
|
@@ -4868,7 +5107,7 @@ var ApiClient = class {
|
|
|
4868
5107
|
async getMetrics(runId, options) {
|
|
4869
5108
|
const baseUrl = await this.getBaseUrl();
|
|
4870
5109
|
const headers = await this.getHeaders();
|
|
4871
|
-
const client =
|
|
5110
|
+
const client = initClient9(runMetricsContract, {
|
|
4872
5111
|
baseUrl,
|
|
4873
5112
|
baseHeaders: headers,
|
|
4874
5113
|
jsonQuery: true
|
|
@@ -4891,7 +5130,7 @@ var ApiClient = class {
|
|
|
4891
5130
|
async getAgentEvents(runId, options) {
|
|
4892
5131
|
const baseUrl = await this.getBaseUrl();
|
|
4893
5132
|
const headers = await this.getHeaders();
|
|
4894
|
-
const client =
|
|
5133
|
+
const client = initClient9(runAgentEventsContract, {
|
|
4895
5134
|
baseUrl,
|
|
4896
5135
|
baseHeaders: headers,
|
|
4897
5136
|
jsonQuery: true
|
|
@@ -4914,7 +5153,7 @@ var ApiClient = class {
|
|
|
4914
5153
|
async getNetworkLogs(runId, options) {
|
|
4915
5154
|
const baseUrl = await this.getBaseUrl();
|
|
4916
5155
|
const headers = await this.getHeaders();
|
|
4917
|
-
const client =
|
|
5156
|
+
const client = initClient9(runNetworkLogsContract, {
|
|
4918
5157
|
baseUrl,
|
|
4919
5158
|
baseHeaders: headers,
|
|
4920
5159
|
jsonQuery: true
|
|
@@ -4940,7 +5179,7 @@ var ApiClient = class {
|
|
|
4940
5179
|
async getScope() {
|
|
4941
5180
|
const baseUrl = await this.getBaseUrl();
|
|
4942
5181
|
const headers = await this.getHeaders();
|
|
4943
|
-
const client =
|
|
5182
|
+
const client = initClient9(scopeContract, {
|
|
4944
5183
|
baseUrl,
|
|
4945
5184
|
baseHeaders: headers,
|
|
4946
5185
|
jsonQuery: true
|
|
@@ -4959,7 +5198,7 @@ var ApiClient = class {
|
|
|
4959
5198
|
async createScope(body) {
|
|
4960
5199
|
const baseUrl = await this.getBaseUrl();
|
|
4961
5200
|
const headers = await this.getHeaders();
|
|
4962
|
-
const client =
|
|
5201
|
+
const client = initClient9(scopeContract, {
|
|
4963
5202
|
baseUrl,
|
|
4964
5203
|
baseHeaders: headers,
|
|
4965
5204
|
jsonQuery: true
|
|
@@ -4978,7 +5217,7 @@ var ApiClient = class {
|
|
|
4978
5217
|
async updateScope(body) {
|
|
4979
5218
|
const baseUrl = await this.getBaseUrl();
|
|
4980
5219
|
const headers = await this.getHeaders();
|
|
4981
|
-
const client =
|
|
5220
|
+
const client = initClient9(scopeContract, {
|
|
4982
5221
|
baseUrl,
|
|
4983
5222
|
baseHeaders: headers,
|
|
4984
5223
|
jsonQuery: true
|
|
@@ -4998,7 +5237,7 @@ var ApiClient = class {
|
|
|
4998
5237
|
async getSession(sessionId) {
|
|
4999
5238
|
const baseUrl = await this.getBaseUrl();
|
|
5000
5239
|
const headers = await this.getHeaders();
|
|
5001
|
-
const client =
|
|
5240
|
+
const client = initClient9(sessionsByIdContract, {
|
|
5002
5241
|
baseUrl,
|
|
5003
5242
|
baseHeaders: headers,
|
|
5004
5243
|
jsonQuery: true
|
|
@@ -5020,7 +5259,7 @@ var ApiClient = class {
|
|
|
5020
5259
|
async getCheckpoint(checkpointId) {
|
|
5021
5260
|
const baseUrl = await this.getBaseUrl();
|
|
5022
5261
|
const headers = await this.getHeaders();
|
|
5023
|
-
const client =
|
|
5262
|
+
const client = initClient9(checkpointsByIdContract, {
|
|
5024
5263
|
baseUrl,
|
|
5025
5264
|
baseHeaders: headers,
|
|
5026
5265
|
jsonQuery: true
|
|
@@ -5041,7 +5280,7 @@ var ApiClient = class {
|
|
|
5041
5280
|
async prepareStorage(body) {
|
|
5042
5281
|
const baseUrl = await this.getBaseUrl();
|
|
5043
5282
|
const headers = await this.getHeaders();
|
|
5044
|
-
const client =
|
|
5283
|
+
const client = initClient9(storagesPrepareContract, {
|
|
5045
5284
|
baseUrl,
|
|
5046
5285
|
baseHeaders: headers,
|
|
5047
5286
|
jsonQuery: true
|
|
@@ -5060,7 +5299,7 @@ var ApiClient = class {
|
|
|
5060
5299
|
async commitStorage(body) {
|
|
5061
5300
|
const baseUrl = await this.getBaseUrl();
|
|
5062
5301
|
const headers = await this.getHeaders();
|
|
5063
|
-
const client =
|
|
5302
|
+
const client = initClient9(storagesCommitContract, {
|
|
5064
5303
|
baseUrl,
|
|
5065
5304
|
baseHeaders: headers,
|
|
5066
5305
|
jsonQuery: true
|
|
@@ -5079,7 +5318,7 @@ var ApiClient = class {
|
|
|
5079
5318
|
async getStorageDownload(query) {
|
|
5080
5319
|
const baseUrl = await this.getBaseUrl();
|
|
5081
5320
|
const headers = await this.getHeaders();
|
|
5082
|
-
const client =
|
|
5321
|
+
const client = initClient9(storagesDownloadContract, {
|
|
5083
5322
|
baseUrl,
|
|
5084
5323
|
baseHeaders: headers,
|
|
5085
5324
|
jsonQuery: true
|
|
@@ -5104,7 +5343,7 @@ var ApiClient = class {
|
|
|
5104
5343
|
async listStorages(query) {
|
|
5105
5344
|
const baseUrl = await this.getBaseUrl();
|
|
5106
5345
|
const headers = await this.getHeaders();
|
|
5107
|
-
const client =
|
|
5346
|
+
const client = initClient9(storagesListContract, {
|
|
5108
5347
|
baseUrl,
|
|
5109
5348
|
baseHeaders: headers,
|
|
5110
5349
|
jsonQuery: true
|
|
@@ -5123,7 +5362,7 @@ var ApiClient = class {
|
|
|
5123
5362
|
async deploySchedule(body) {
|
|
5124
5363
|
const baseUrl = await this.getBaseUrl();
|
|
5125
5364
|
const headers = await this.getHeaders();
|
|
5126
|
-
const client =
|
|
5365
|
+
const client = initClient9(schedulesMainContract, {
|
|
5127
5366
|
baseUrl,
|
|
5128
5367
|
baseHeaders: headers,
|
|
5129
5368
|
jsonQuery: true
|
|
@@ -5142,7 +5381,7 @@ var ApiClient = class {
|
|
|
5142
5381
|
async listSchedules() {
|
|
5143
5382
|
const baseUrl = await this.getBaseUrl();
|
|
5144
5383
|
const headers = await this.getHeaders();
|
|
5145
|
-
const client =
|
|
5384
|
+
const client = initClient9(schedulesMainContract, {
|
|
5146
5385
|
baseUrl,
|
|
5147
5386
|
baseHeaders: headers,
|
|
5148
5387
|
jsonQuery: true
|
|
@@ -5161,7 +5400,7 @@ var ApiClient = class {
|
|
|
5161
5400
|
async getScheduleByName(params) {
|
|
5162
5401
|
const baseUrl = await this.getBaseUrl();
|
|
5163
5402
|
const headers = await this.getHeaders();
|
|
5164
|
-
const client =
|
|
5403
|
+
const client = initClient9(schedulesByNameContract, {
|
|
5165
5404
|
baseUrl,
|
|
5166
5405
|
baseHeaders: headers,
|
|
5167
5406
|
jsonQuery: true
|
|
@@ -5183,7 +5422,7 @@ var ApiClient = class {
|
|
|
5183
5422
|
async deleteSchedule(params) {
|
|
5184
5423
|
const baseUrl = await this.getBaseUrl();
|
|
5185
5424
|
const headers = await this.getHeaders();
|
|
5186
|
-
const client =
|
|
5425
|
+
const client = initClient9(schedulesByNameContract, {
|
|
5187
5426
|
baseUrl,
|
|
5188
5427
|
baseHeaders: headers,
|
|
5189
5428
|
jsonQuery: true
|
|
@@ -5205,7 +5444,7 @@ var ApiClient = class {
|
|
|
5205
5444
|
async enableSchedule(params) {
|
|
5206
5445
|
const baseUrl = await this.getBaseUrl();
|
|
5207
5446
|
const headers = await this.getHeaders();
|
|
5208
|
-
const client =
|
|
5447
|
+
const client = initClient9(schedulesEnableContract, {
|
|
5209
5448
|
baseUrl,
|
|
5210
5449
|
baseHeaders: headers,
|
|
5211
5450
|
jsonQuery: true
|
|
@@ -5227,7 +5466,7 @@ var ApiClient = class {
|
|
|
5227
5466
|
async disableSchedule(params) {
|
|
5228
5467
|
const baseUrl = await this.getBaseUrl();
|
|
5229
5468
|
const headers = await this.getHeaders();
|
|
5230
|
-
const client =
|
|
5469
|
+
const client = initClient9(schedulesEnableContract, {
|
|
5231
5470
|
baseUrl,
|
|
5232
5471
|
baseHeaders: headers,
|
|
5233
5472
|
jsonQuery: true
|
|
@@ -5249,7 +5488,7 @@ var ApiClient = class {
|
|
|
5249
5488
|
async listScheduleRuns(params) {
|
|
5250
5489
|
const baseUrl = await this.getBaseUrl();
|
|
5251
5490
|
const headers = await this.getHeaders();
|
|
5252
|
-
const client =
|
|
5491
|
+
const client = initClient9(scheduleRunsContract, {
|
|
5253
5492
|
baseUrl,
|
|
5254
5493
|
baseHeaders: headers,
|
|
5255
5494
|
jsonQuery: true
|
|
@@ -5274,7 +5513,7 @@ var ApiClient = class {
|
|
|
5274
5513
|
async listPublicAgents(query) {
|
|
5275
5514
|
const baseUrl = await this.getBaseUrl();
|
|
5276
5515
|
const headers = await this.getHeaders();
|
|
5277
|
-
const client =
|
|
5516
|
+
const client = initClient9(publicAgentsListContract, {
|
|
5278
5517
|
baseUrl,
|
|
5279
5518
|
baseHeaders: headers,
|
|
5280
5519
|
jsonQuery: true
|
|
@@ -5293,7 +5532,7 @@ var ApiClient = class {
|
|
|
5293
5532
|
async listPublicArtifacts(query) {
|
|
5294
5533
|
const baseUrl = await this.getBaseUrl();
|
|
5295
5534
|
const headers = await this.getHeaders();
|
|
5296
|
-
const client =
|
|
5535
|
+
const client = initClient9(publicArtifactsListContract, {
|
|
5297
5536
|
baseUrl,
|
|
5298
5537
|
baseHeaders: headers,
|
|
5299
5538
|
jsonQuery: true
|
|
@@ -5312,7 +5551,7 @@ var ApiClient = class {
|
|
|
5312
5551
|
async getPublicArtifact(id) {
|
|
5313
5552
|
const baseUrl = await this.getBaseUrl();
|
|
5314
5553
|
const headers = await this.getHeaders();
|
|
5315
|
-
const client =
|
|
5554
|
+
const client = initClient9(publicArtifactByIdContract, {
|
|
5316
5555
|
baseUrl,
|
|
5317
5556
|
baseHeaders: headers,
|
|
5318
5557
|
jsonQuery: true
|
|
@@ -5331,7 +5570,7 @@ var ApiClient = class {
|
|
|
5331
5570
|
async listPublicVolumes(query) {
|
|
5332
5571
|
const baseUrl = await this.getBaseUrl();
|
|
5333
5572
|
const headers = await this.getHeaders();
|
|
5334
|
-
const client =
|
|
5573
|
+
const client = initClient9(publicVolumesListContract, {
|
|
5335
5574
|
baseUrl,
|
|
5336
5575
|
baseHeaders: headers,
|
|
5337
5576
|
jsonQuery: true
|
|
@@ -5350,7 +5589,7 @@ var ApiClient = class {
|
|
|
5350
5589
|
async getPublicVolume(id) {
|
|
5351
5590
|
const baseUrl = await this.getBaseUrl();
|
|
5352
5591
|
const headers = await this.getHeaders();
|
|
5353
|
-
const client =
|
|
5592
|
+
const client = initClient9(publicVolumeByIdContract, {
|
|
5354
5593
|
baseUrl,
|
|
5355
5594
|
baseHeaders: headers,
|
|
5356
5595
|
jsonQuery: true
|
|
@@ -5389,7 +5628,7 @@ var ApiClient = class {
|
|
|
5389
5628
|
async listCredentials() {
|
|
5390
5629
|
const baseUrl = await this.getBaseUrl();
|
|
5391
5630
|
const headers = await this.getHeaders();
|
|
5392
|
-
const client =
|
|
5631
|
+
const client = initClient9(credentialsMainContract, {
|
|
5393
5632
|
baseUrl,
|
|
5394
5633
|
baseHeaders: headers,
|
|
5395
5634
|
jsonQuery: true
|
|
@@ -5408,7 +5647,7 @@ var ApiClient = class {
|
|
|
5408
5647
|
async getCredential(name) {
|
|
5409
5648
|
const baseUrl = await this.getBaseUrl();
|
|
5410
5649
|
const headers = await this.getHeaders();
|
|
5411
|
-
const client =
|
|
5650
|
+
const client = initClient9(credentialsByNameContract, {
|
|
5412
5651
|
baseUrl,
|
|
5413
5652
|
baseHeaders: headers,
|
|
5414
5653
|
jsonQuery: true
|
|
@@ -5429,7 +5668,7 @@ var ApiClient = class {
|
|
|
5429
5668
|
async setCredential(body) {
|
|
5430
5669
|
const baseUrl = await this.getBaseUrl();
|
|
5431
5670
|
const headers = await this.getHeaders();
|
|
5432
|
-
const client =
|
|
5671
|
+
const client = initClient9(credentialsMainContract, {
|
|
5433
5672
|
baseUrl,
|
|
5434
5673
|
baseHeaders: headers,
|
|
5435
5674
|
jsonQuery: true
|
|
@@ -5448,7 +5687,7 @@ var ApiClient = class {
|
|
|
5448
5687
|
async deleteCredential(name) {
|
|
5449
5688
|
const baseUrl = await this.getBaseUrl();
|
|
5450
5689
|
const headers = await this.getHeaders();
|
|
5451
|
-
const client =
|
|
5690
|
+
const client = initClient9(credentialsByNameContract, {
|
|
5452
5691
|
baseUrl,
|
|
5453
5692
|
baseHeaders: headers,
|
|
5454
5693
|
jsonQuery: true
|
|
@@ -5469,7 +5708,7 @@ var ApiClient = class {
|
|
|
5469
5708
|
async getRealtimeToken(runId) {
|
|
5470
5709
|
const baseUrl = await this.getBaseUrl();
|
|
5471
5710
|
const headers = await this.getHeaders();
|
|
5472
|
-
const client =
|
|
5711
|
+
const client = initClient9(realtimeTokenContract, {
|
|
5473
5712
|
baseUrl,
|
|
5474
5713
|
baseHeaders: headers,
|
|
5475
5714
|
jsonQuery: true
|
|
@@ -5611,8 +5850,8 @@ async function streamEvents(runId, options) {
|
|
|
5611
5850
|
ablyClient.close();
|
|
5612
5851
|
}
|
|
5613
5852
|
function handleMessage(message) {
|
|
5614
|
-
|
|
5615
|
-
|
|
5853
|
+
if (message.name === "events") {
|
|
5854
|
+
const data = message.data;
|
|
5616
5855
|
for (const event of data.events) {
|
|
5617
5856
|
const eventData = event;
|
|
5618
5857
|
const seq = eventData.sequenceNumber;
|
|
@@ -5630,7 +5869,8 @@ async function streamEvents(runId, options) {
|
|
|
5630
5869
|
startTimestamp
|
|
5631
5870
|
});
|
|
5632
5871
|
}
|
|
5633
|
-
} else if (
|
|
5872
|
+
} else if (message.name === "status") {
|
|
5873
|
+
const data = message.data;
|
|
5634
5874
|
if (data.status === "completed") {
|
|
5635
5875
|
onRunCompleted(data.result, {
|
|
5636
5876
|
verbose,
|
|
@@ -5791,7 +6031,7 @@ async function pollEvents(runId, options) {
|
|
|
5791
6031
|
});
|
|
5792
6032
|
for (const event of response.events) {
|
|
5793
6033
|
const eventData = event.eventData;
|
|
5794
|
-
if (response.
|
|
6034
|
+
if (response.framework === "codex") {
|
|
5795
6035
|
CodexEventRenderer.render(eventData);
|
|
5796
6036
|
} else {
|
|
5797
6037
|
const parsed = parseEvent(eventData);
|
|
@@ -5899,7 +6139,7 @@ var mainRunCommand = new Command2().name("run").description("Execute an agent").
|
|
|
5899
6139
|
).option("-v, --verbose", "Show verbose output with timing information").option(
|
|
5900
6140
|
"--experimental-realtime",
|
|
5901
6141
|
"Use realtime event streaming instead of polling (experimental)"
|
|
5902
|
-
).
|
|
6142
|
+
).addOption(new Option("--debug-no-mock-claude").hideHelp()).action(
|
|
5903
6143
|
async (identifier, prompt, options) => {
|
|
5904
6144
|
const startTimestamp = /* @__PURE__ */ new Date();
|
|
5905
6145
|
const verbose = options.verbose;
|
|
@@ -6059,7 +6299,7 @@ var mainRunCommand = new Command2().name("run").description("Execute an agent").
|
|
|
6059
6299
|
);
|
|
6060
6300
|
|
|
6061
6301
|
// src/commands/run/resume.ts
|
|
6062
|
-
import { Command as Command3 } from "commander";
|
|
6302
|
+
import { Command as Command3, Option as Option2 } from "commander";
|
|
6063
6303
|
import chalk7 from "chalk";
|
|
6064
6304
|
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(
|
|
6065
6305
|
"--vars <KEY=value>",
|
|
@@ -6079,7 +6319,7 @@ var resumeCommand = new Command3().name("resume").description("Resume an agent r
|
|
|
6079
6319
|
).option("-v, --verbose", "Show verbose output with timing information").option(
|
|
6080
6320
|
"--experimental-realtime",
|
|
6081
6321
|
"Use realtime event streaming instead of polling (experimental)"
|
|
6082
|
-
).
|
|
6322
|
+
).addOption(new Option2("--debug-no-mock-claude").hideHelp()).action(
|
|
6083
6323
|
async (checkpointId, prompt, options, command) => {
|
|
6084
6324
|
const startTimestamp = /* @__PURE__ */ new Date();
|
|
6085
6325
|
const allOpts = command.optsWithGlobals();
|
|
@@ -6173,7 +6413,7 @@ var resumeCommand = new Command3().name("resume").description("Resume an agent r
|
|
|
6173
6413
|
);
|
|
6174
6414
|
|
|
6175
6415
|
// src/commands/run/continue.ts
|
|
6176
|
-
import { Command as Command4 } from "commander";
|
|
6416
|
+
import { Command as Command4, Option as Option3 } from "commander";
|
|
6177
6417
|
import chalk8 from "chalk";
|
|
6178
6418
|
var continueCommand = new Command4().name("continue").description(
|
|
6179
6419
|
"Continue an agent run from a session (uses latest artifact version)"
|
|
@@ -6195,7 +6435,7 @@ var continueCommand = new Command4().name("continue").description(
|
|
|
6195
6435
|
).option("-v, --verbose", "Show verbose output with timing information").option(
|
|
6196
6436
|
"--experimental-realtime",
|
|
6197
6437
|
"Use realtime event streaming instead of polling (experimental)"
|
|
6198
|
-
).
|
|
6438
|
+
).addOption(new Option3("--debug-no-mock-claude").hideHelp()).action(
|
|
6199
6439
|
async (agentSessionId, prompt, options, command) => {
|
|
6200
6440
|
const startTimestamp = /* @__PURE__ */ new Date();
|
|
6201
6441
|
const allOpts = command.optsWithGlobals();
|
|
@@ -7233,7 +7473,7 @@ var cloneCommand2 = new Command17().name("clone").description("Clone a remote ar
|
|
|
7233
7473
|
var artifactCommand = new Command18().name("artifact").description("Manage cloud artifacts (work products)").addCommand(initCommand2).addCommand(pushCommand2).addCommand(pullCommand2).addCommand(statusCommand2).addCommand(listCommand2).addCommand(cloneCommand2);
|
|
7234
7474
|
|
|
7235
7475
|
// src/commands/cook.ts
|
|
7236
|
-
import { Command as Command19 } from "commander";
|
|
7476
|
+
import { Command as Command19, Option as Option4 } from "commander";
|
|
7237
7477
|
import chalk24 from "chalk";
|
|
7238
7478
|
import { readFile as readFile7, mkdir as mkdir6, writeFile as writeFile6, appendFile } from "fs/promises";
|
|
7239
7479
|
import { existsSync as existsSync8, readFileSync } from "fs";
|
|
@@ -7565,9 +7805,9 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
7565
7805
|
}
|
|
7566
7806
|
}
|
|
7567
7807
|
var cookCmd = new Command19().name("cook").description("One-click agent preparation and execution from vm0.yaml");
|
|
7568
|
-
cookCmd.argument("[prompt]", "Prompt for the agent").option("-y, --yes", "Skip confirmation prompts").
|
|
7808
|
+
cookCmd.argument("[prompt]", "Prompt for the agent").option("-y, --yes", "Skip confirmation prompts").addOption(new Option4("--debug-no-mock-claude").hideHelp()).action(
|
|
7569
7809
|
async (prompt, options) => {
|
|
7570
|
-
const shouldExit = await checkAndUpgrade("
|
|
7810
|
+
const shouldExit = await checkAndUpgrade("6.1.0", prompt);
|
|
7571
7811
|
if (shouldExit) {
|
|
7572
7812
|
process.exit(0);
|
|
7573
7813
|
}
|
|
@@ -7792,7 +8032,7 @@ cookCmd.command("logs").description("View logs from the last cook run").option("
|
|
|
7792
8032
|
);
|
|
7793
8033
|
cookCmd.command("continue").description(
|
|
7794
8034
|
"Continue from the last session (latest conversation and artifact)"
|
|
7795
|
-
).argument("<prompt>", "Prompt for the continued agent").
|
|
8035
|
+
).argument("<prompt>", "Prompt for the continued agent").addOption(new Option4("--debug-no-mock-claude").hideHelp()).action(async (prompt, options) => {
|
|
7796
8036
|
const state = await loadCookState();
|
|
7797
8037
|
if (!state.lastSessionId) {
|
|
7798
8038
|
console.error(chalk24.red("\u2717 No previous session found"));
|
|
@@ -7830,7 +8070,7 @@ cookCmd.command("continue").description(
|
|
|
7830
8070
|
});
|
|
7831
8071
|
cookCmd.command("resume").description(
|
|
7832
8072
|
"Resume from the last checkpoint (snapshotted conversation and artifact)"
|
|
7833
|
-
).argument("<prompt>", "Prompt for the resumed agent").
|
|
8073
|
+
).argument("<prompt>", "Prompt for the resumed agent").addOption(new Option4("--debug-no-mock-claude").hideHelp()).action(async (prompt, options) => {
|
|
7834
8074
|
const state = await loadCookState();
|
|
7835
8075
|
if (!state.lastCheckpointId) {
|
|
7836
8076
|
console.error(chalk24.red("\u2717 No previous checkpoint found"));
|
|
@@ -8045,7 +8285,7 @@ async function showAgentEvents(runId, options) {
|
|
|
8045
8285
|
}
|
|
8046
8286
|
const events = options.order === "desc" ? [...response.events].reverse() : response.events;
|
|
8047
8287
|
for (const event of events) {
|
|
8048
|
-
renderAgentEvent(event, response.
|
|
8288
|
+
renderAgentEvent(event, response.framework);
|
|
8049
8289
|
}
|
|
8050
8290
|
if (response.hasMore) {
|
|
8051
8291
|
console.log();
|
|
@@ -8268,7 +8508,7 @@ var listCommand3 = new Command24().name("list").alias("ls").description("List al
|
|
|
8268
8508
|
);
|
|
8269
8509
|
return;
|
|
8270
8510
|
}
|
|
8271
|
-
const nameWidth = Math.max(4, ...data.composes.map((
|
|
8511
|
+
const nameWidth = Math.max(4, ...data.composes.map((c19) => c19.name.length));
|
|
8272
8512
|
const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
|
|
8273
8513
|
" "
|
|
8274
8514
|
);
|
|
@@ -8413,7 +8653,7 @@ function formatComposeOutput(name, versionId, content, variableSources) {
|
|
|
8413
8653
|
console.log(chalk29.bold("Agents:"));
|
|
8414
8654
|
for (const [agentName, agent] of Object.entries(content.agents)) {
|
|
8415
8655
|
console.log(` ${chalk29.cyan(agentName)}:`);
|
|
8416
|
-
console.log(`
|
|
8656
|
+
console.log(` Framework: ${agent.framework}`);
|
|
8417
8657
|
if (agent.image) {
|
|
8418
8658
|
console.log(` Image: ${agent.image}`);
|
|
8419
8659
|
}
|
|
@@ -8567,7 +8807,7 @@ function generateVm0Yaml(agentName) {
|
|
|
8567
8807
|
|
|
8568
8808
|
agents:
|
|
8569
8809
|
${agentName}:
|
|
8570
|
-
|
|
8810
|
+
framework: claude-code
|
|
8571
8811
|
# Build agentic workflow using natural language
|
|
8572
8812
|
instructions: AGENTS.md
|
|
8573
8813
|
# Agent skills - see https://github.com/vm0-ai/vm0-skills for available skills
|
|
@@ -10444,7 +10684,8 @@ var listCommand5 = new Command38().name("list").description("List all credential
|
|
|
10444
10684
|
console.log(chalk40.bold("Credentials:"));
|
|
10445
10685
|
console.log();
|
|
10446
10686
|
for (const credential of result.credentials) {
|
|
10447
|
-
|
|
10687
|
+
const typeIndicator = credential.type === "model-provider" ? chalk40.dim(" [model-provider]") : "";
|
|
10688
|
+
console.log(` ${chalk40.cyan(credential.name)}${typeIndicator}`);
|
|
10448
10689
|
if (credential.description) {
|
|
10449
10690
|
console.log(` ${chalk40.dim(credential.description)}`);
|
|
10450
10691
|
}
|
|
@@ -10562,11 +10803,268 @@ var deleteCommand2 = new Command40().name("delete").description("Delete a creden
|
|
|
10562
10803
|
// src/commands/credential/index.ts
|
|
10563
10804
|
var credentialCommand = new Command41().name("experimental-credential").description("[Experimental] Manage stored credentials for agent runs").addCommand(listCommand5).addCommand(setCommand2).addCommand(deleteCommand2);
|
|
10564
10805
|
|
|
10806
|
+
// src/commands/model-provider/index.ts
|
|
10807
|
+
import { Command as Command46 } from "commander";
|
|
10808
|
+
|
|
10809
|
+
// src/commands/model-provider/list.ts
|
|
10810
|
+
import { Command as Command42 } from "commander";
|
|
10811
|
+
import chalk43 from "chalk";
|
|
10812
|
+
var listCommand6 = new Command42().name("list").alias("ls").description("List all model providers").action(async () => {
|
|
10813
|
+
try {
|
|
10814
|
+
const result = await listModelProviders();
|
|
10815
|
+
if (result.modelProviders.length === 0) {
|
|
10816
|
+
console.log(chalk43.dim("No model providers configured."));
|
|
10817
|
+
console.log();
|
|
10818
|
+
console.log("To add a model provider:");
|
|
10819
|
+
console.log(chalk43.cyan(" vm0 model-provider setup"));
|
|
10820
|
+
return;
|
|
10821
|
+
}
|
|
10822
|
+
const byFramework = result.modelProviders.reduce(
|
|
10823
|
+
(acc, p) => {
|
|
10824
|
+
const fw = p.framework;
|
|
10825
|
+
if (!acc[fw]) {
|
|
10826
|
+
acc[fw] = [];
|
|
10827
|
+
}
|
|
10828
|
+
acc[fw].push(p);
|
|
10829
|
+
return acc;
|
|
10830
|
+
},
|
|
10831
|
+
{}
|
|
10832
|
+
);
|
|
10833
|
+
console.log(chalk43.bold("Model Providers:"));
|
|
10834
|
+
console.log();
|
|
10835
|
+
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
10836
|
+
console.log(` ${chalk43.cyan(framework)}:`);
|
|
10837
|
+
for (const provider of providers) {
|
|
10838
|
+
const defaultTag = provider.isDefault ? chalk43.green(" (default)") : "";
|
|
10839
|
+
console.log(` ${provider.type}${defaultTag}`);
|
|
10840
|
+
console.log(
|
|
10841
|
+
chalk43.dim(
|
|
10842
|
+
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
10843
|
+
)
|
|
10844
|
+
);
|
|
10845
|
+
}
|
|
10846
|
+
console.log();
|
|
10847
|
+
}
|
|
10848
|
+
console.log(
|
|
10849
|
+
chalk43.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
10850
|
+
);
|
|
10851
|
+
} catch (error) {
|
|
10852
|
+
if (error instanceof Error) {
|
|
10853
|
+
if (error.message.includes("Not authenticated")) {
|
|
10854
|
+
console.error(chalk43.red("x Not authenticated. Run: vm0 auth login"));
|
|
10855
|
+
} else {
|
|
10856
|
+
console.error(chalk43.red(`x ${error.message}`));
|
|
10857
|
+
}
|
|
10858
|
+
} else {
|
|
10859
|
+
console.error(chalk43.red("x An unexpected error occurred"));
|
|
10860
|
+
}
|
|
10861
|
+
process.exit(1);
|
|
10862
|
+
}
|
|
10863
|
+
});
|
|
10864
|
+
|
|
10865
|
+
// src/commands/model-provider/setup.ts
|
|
10866
|
+
import { Command as Command43 } from "commander";
|
|
10867
|
+
import chalk44 from "chalk";
|
|
10868
|
+
import prompts3 from "prompts";
|
|
10869
|
+
var providerChoices = Object.entries(MODEL_PROVIDER_TYPES).map(
|
|
10870
|
+
([type, config]) => ({
|
|
10871
|
+
title: config.label,
|
|
10872
|
+
value: type
|
|
10873
|
+
})
|
|
10874
|
+
);
|
|
10875
|
+
var setupCommand = new Command43().name("setup").description("Configure a model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
|
|
10876
|
+
"-c, --credential <credential>",
|
|
10877
|
+
"Credential value (for non-interactive mode)"
|
|
10878
|
+
).option("--convert", "Convert existing user credential to model provider").action(
|
|
10879
|
+
async (options) => {
|
|
10880
|
+
try {
|
|
10881
|
+
let type;
|
|
10882
|
+
let credential;
|
|
10883
|
+
const shouldConvert = options.convert ?? false;
|
|
10884
|
+
if (options.type && options.credential) {
|
|
10885
|
+
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(options.type)) {
|
|
10886
|
+
console.error(chalk44.red(`x Invalid type "${options.type}"`));
|
|
10887
|
+
console.log();
|
|
10888
|
+
console.log("Valid types:");
|
|
10889
|
+
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
10890
|
+
console.log(` ${chalk44.cyan(t)} - ${config.label}`);
|
|
10891
|
+
}
|
|
10892
|
+
process.exit(1);
|
|
10893
|
+
}
|
|
10894
|
+
type = options.type;
|
|
10895
|
+
credential = options.credential;
|
|
10896
|
+
} else if (options.type || options.credential) {
|
|
10897
|
+
console.error(
|
|
10898
|
+
chalk44.red("x Both --type and --credential are required")
|
|
10899
|
+
);
|
|
10900
|
+
process.exit(1);
|
|
10901
|
+
} else {
|
|
10902
|
+
if (!isInteractive()) {
|
|
10903
|
+
console.error(chalk44.red("x Interactive mode requires a TTY"));
|
|
10904
|
+
console.log();
|
|
10905
|
+
console.log("Use non-interactive mode:");
|
|
10906
|
+
console.log(
|
|
10907
|
+
chalk44.cyan(
|
|
10908
|
+
' vm0 model-provider setup --type <type> --credential "<value>"'
|
|
10909
|
+
)
|
|
10910
|
+
);
|
|
10911
|
+
process.exit(1);
|
|
10912
|
+
}
|
|
10913
|
+
const typeResponse = await prompts3(
|
|
10914
|
+
{
|
|
10915
|
+
type: "select",
|
|
10916
|
+
name: "type",
|
|
10917
|
+
message: "Select provider type:",
|
|
10918
|
+
choices: providerChoices
|
|
10919
|
+
},
|
|
10920
|
+
{ onCancel: () => process.exit(0) }
|
|
10921
|
+
);
|
|
10922
|
+
type = typeResponse.type;
|
|
10923
|
+
const checkResult = await checkModelProviderCredential(type);
|
|
10924
|
+
if (checkResult.exists && checkResult.currentType === "user") {
|
|
10925
|
+
const convertResponse = await prompts3(
|
|
10926
|
+
{
|
|
10927
|
+
type: "confirm",
|
|
10928
|
+
name: "convert",
|
|
10929
|
+
message: `Credential "${checkResult.credentialName}" already exists. Convert to model provider?`,
|
|
10930
|
+
initial: true
|
|
10931
|
+
},
|
|
10932
|
+
{ onCancel: () => process.exit(0) }
|
|
10933
|
+
);
|
|
10934
|
+
if (convertResponse.convert) {
|
|
10935
|
+
const provider2 = await convertModelProviderCredential(type);
|
|
10936
|
+
const defaultNote2 = provider2.isDefault ? ` (default for ${provider2.framework})` : "";
|
|
10937
|
+
console.log(
|
|
10938
|
+
chalk44.green(
|
|
10939
|
+
`Done Converted "${checkResult.credentialName}" to model provider${defaultNote2}`
|
|
10940
|
+
)
|
|
10941
|
+
);
|
|
10942
|
+
return;
|
|
10943
|
+
} else {
|
|
10944
|
+
console.log(chalk44.dim("Aborted."));
|
|
10945
|
+
process.exit(0);
|
|
10946
|
+
}
|
|
10947
|
+
}
|
|
10948
|
+
const config = MODEL_PROVIDER_TYPES[type];
|
|
10949
|
+
const credentialResponse = await prompts3(
|
|
10950
|
+
{
|
|
10951
|
+
type: "password",
|
|
10952
|
+
name: "credential",
|
|
10953
|
+
message: `Enter your ${config.credentialLabel}:`,
|
|
10954
|
+
validate: (value) => value.length > 0 || `${config.credentialLabel} is required`
|
|
10955
|
+
},
|
|
10956
|
+
{ onCancel: () => process.exit(0) }
|
|
10957
|
+
);
|
|
10958
|
+
credential = credentialResponse.credential;
|
|
10959
|
+
}
|
|
10960
|
+
const { provider, created } = await upsertModelProvider({
|
|
10961
|
+
type,
|
|
10962
|
+
credential,
|
|
10963
|
+
convert: shouldConvert
|
|
10964
|
+
});
|
|
10965
|
+
const action = created ? "created" : "updated";
|
|
10966
|
+
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
10967
|
+
console.log(
|
|
10968
|
+
chalk44.green(`Done Model provider "${type}" ${action}${defaultNote}`)
|
|
10969
|
+
);
|
|
10970
|
+
} catch (error) {
|
|
10971
|
+
if (error instanceof Error) {
|
|
10972
|
+
if (error.message.includes("already exists")) {
|
|
10973
|
+
console.error(chalk44.red(`x ${error.message}`));
|
|
10974
|
+
console.log();
|
|
10975
|
+
console.log("To convert the existing credential, run:");
|
|
10976
|
+
console.log(chalk44.cyan(" vm0 model-provider setup --convert"));
|
|
10977
|
+
} else if (error.message.includes("Not authenticated")) {
|
|
10978
|
+
console.error(
|
|
10979
|
+
chalk44.red("x Not authenticated. Run: vm0 auth login")
|
|
10980
|
+
);
|
|
10981
|
+
} else {
|
|
10982
|
+
console.error(chalk44.red(`x ${error.message}`));
|
|
10983
|
+
}
|
|
10984
|
+
} else {
|
|
10985
|
+
console.error(chalk44.red("x An unexpected error occurred"));
|
|
10986
|
+
}
|
|
10987
|
+
process.exit(1);
|
|
10988
|
+
}
|
|
10989
|
+
}
|
|
10990
|
+
);
|
|
10991
|
+
|
|
10992
|
+
// src/commands/model-provider/delete.ts
|
|
10993
|
+
import { Command as Command44 } from "commander";
|
|
10994
|
+
import chalk45 from "chalk";
|
|
10995
|
+
var deleteCommand3 = new Command44().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(async (type) => {
|
|
10996
|
+
try {
|
|
10997
|
+
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
10998
|
+
console.error(chalk45.red(`x Invalid type "${type}"`));
|
|
10999
|
+
console.log();
|
|
11000
|
+
console.log("Valid types:");
|
|
11001
|
+
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
11002
|
+
console.log(` ${chalk45.cyan(t)} - ${config.label}`);
|
|
11003
|
+
}
|
|
11004
|
+
process.exit(1);
|
|
11005
|
+
}
|
|
11006
|
+
await deleteModelProvider(type);
|
|
11007
|
+
console.log(chalk45.green(`Done Model provider "${type}" deleted`));
|
|
11008
|
+
} catch (error) {
|
|
11009
|
+
if (error instanceof Error) {
|
|
11010
|
+
if (error.message.includes("not found")) {
|
|
11011
|
+
console.error(chalk45.red(`x Model provider "${type}" not found`));
|
|
11012
|
+
} else if (error.message.includes("Not authenticated")) {
|
|
11013
|
+
console.error(chalk45.red("x Not authenticated. Run: vm0 auth login"));
|
|
11014
|
+
} else {
|
|
11015
|
+
console.error(chalk45.red(`x ${error.message}`));
|
|
11016
|
+
}
|
|
11017
|
+
} else {
|
|
11018
|
+
console.error(chalk45.red("x An unexpected error occurred"));
|
|
11019
|
+
}
|
|
11020
|
+
process.exit(1);
|
|
11021
|
+
}
|
|
11022
|
+
});
|
|
11023
|
+
|
|
11024
|
+
// src/commands/model-provider/set-default.ts
|
|
11025
|
+
import { Command as Command45 } from "commander";
|
|
11026
|
+
import chalk46 from "chalk";
|
|
11027
|
+
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) => {
|
|
11028
|
+
try {
|
|
11029
|
+
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type)) {
|
|
11030
|
+
console.error(chalk46.red(`x Invalid type "${type}"`));
|
|
11031
|
+
console.log();
|
|
11032
|
+
console.log("Valid types:");
|
|
11033
|
+
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
11034
|
+
console.log(` ${chalk46.cyan(t)} - ${config.label}`);
|
|
11035
|
+
}
|
|
11036
|
+
process.exit(1);
|
|
11037
|
+
}
|
|
11038
|
+
const provider = await setModelProviderDefault(type);
|
|
11039
|
+
console.log(
|
|
11040
|
+
chalk46.green(
|
|
11041
|
+
`Done Default for ${provider.framework} set to "${provider.type}"`
|
|
11042
|
+
)
|
|
11043
|
+
);
|
|
11044
|
+
} catch (error) {
|
|
11045
|
+
if (error instanceof Error) {
|
|
11046
|
+
if (error.message.includes("not found")) {
|
|
11047
|
+
console.error(chalk46.red(`x Model provider "${type}" not found`));
|
|
11048
|
+
} else if (error.message.includes("Not authenticated")) {
|
|
11049
|
+
console.error(chalk46.red("x Not authenticated. Run: vm0 auth login"));
|
|
11050
|
+
} else {
|
|
11051
|
+
console.error(chalk46.red(`x ${error.message}`));
|
|
11052
|
+
}
|
|
11053
|
+
} else {
|
|
11054
|
+
console.error(chalk46.red("x An unexpected error occurred"));
|
|
11055
|
+
}
|
|
11056
|
+
process.exit(1);
|
|
11057
|
+
}
|
|
11058
|
+
});
|
|
11059
|
+
|
|
11060
|
+
// src/commands/model-provider/index.ts
|
|
11061
|
+
var modelProviderCommand = new Command46().name("model-provider").description("Manage model providers for agent runs").addCommand(listCommand6).addCommand(setupCommand).addCommand(deleteCommand3).addCommand(setDefaultCommand);
|
|
11062
|
+
|
|
10565
11063
|
// src/index.ts
|
|
10566
|
-
var program = new
|
|
10567
|
-
program.name("vm0").description("VM0 CLI - A modern build tool").version("
|
|
11064
|
+
var program = new Command47();
|
|
11065
|
+
program.name("vm0").description("VM0 CLI - A modern build tool").version("6.1.0");
|
|
10568
11066
|
program.command("info").description("Display environment information").action(async () => {
|
|
10569
|
-
console.log(
|
|
11067
|
+
console.log(chalk47.bold("System Information:"));
|
|
10570
11068
|
console.log(`Node Version: ${process.version}`);
|
|
10571
11069
|
console.log(`Platform: ${process.platform}`);
|
|
10572
11070
|
console.log(`Architecture: ${process.arch}`);
|
|
@@ -10599,6 +11097,7 @@ program.addCommand(setupGithubCommand);
|
|
|
10599
11097
|
program.addCommand(scheduleCommand);
|
|
10600
11098
|
program.addCommand(usageCommand);
|
|
10601
11099
|
program.addCommand(credentialCommand);
|
|
11100
|
+
program.addCommand(modelProviderCommand);
|
|
10602
11101
|
if (process.argv[1]?.endsWith("index.js") || process.argv[1]?.endsWith("index.ts") || process.argv[1]?.endsWith("vm0")) {
|
|
10603
11102
|
program.parse();
|
|
10604
11103
|
}
|