@vm0/cli 6.0.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 +850 -376
- 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";
|
|
@@ -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()
|
|
1763
1800
|
});
|
|
1764
|
-
var
|
|
1765
|
-
|
|
1766
|
-
|
|
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
|
+
}
|
|
1767
1826
|
});
|
|
1768
|
-
var
|
|
1769
|
-
|
|
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
|
+
}
|
|
1770
1841
|
});
|
|
1771
|
-
var
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
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
|
+
}
|
|
1875
|
+
});
|
|
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
|
+
}
|
|
1892
|
+
});
|
|
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()
|
|
1913
|
+
});
|
|
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,
|
|
@@ -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,7 +3326,7 @@ 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
3331
|
// src/lib/domain/framework-config.ts
|
|
3117
3332
|
var FRAMEWORK_DEFAULTS = {
|
|
@@ -3178,7 +3393,7 @@ function getDefaultImageWithApps(framework, 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
|
);
|
|
@@ -3191,14 +3406,14 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
3191
3406
|
const frameworkSupported = isFrameworkSupported(agent.framework);
|
|
3192
3407
|
if (!agent.image && !frameworkSupported) {
|
|
3193
3408
|
ctx.addIssue({
|
|
3194
|
-
code:
|
|
3409
|
+
code: z22.ZodIssueCode.custom,
|
|
3195
3410
|
message: "Missing agent.image (required when framework is not auto-configured)",
|
|
3196
3411
|
path: ["image"]
|
|
3197
3412
|
});
|
|
3198
3413
|
}
|
|
3199
3414
|
if (!agent.working_dir && !frameworkSupported) {
|
|
3200
3415
|
ctx.addIssue({
|
|
3201
|
-
code:
|
|
3416
|
+
code: z22.ZodIssueCode.custom,
|
|
3202
3417
|
message: "Missing agent.working_dir (required when framework is not auto-configured)",
|
|
3203
3418
|
path: ["working_dir"]
|
|
3204
3419
|
});
|
|
@@ -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
|
});
|
|
@@ -4085,7 +4300,7 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
4085
4300
|
});
|
|
4086
4301
|
|
|
4087
4302
|
// src/commands/run/run.ts
|
|
4088
|
-
import { Command as Command2 } from "commander";
|
|
4303
|
+
import { Command as Command2, Option } from "commander";
|
|
4089
4304
|
import chalk6 from "chalk";
|
|
4090
4305
|
|
|
4091
4306
|
// src/lib/events/event-renderer.ts
|
|
@@ -4540,9 +4755,9 @@ var CodexEventParser = class {
|
|
|
4540
4755
|
}
|
|
4541
4756
|
}
|
|
4542
4757
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
4543
|
-
const changes = item.changes.map((
|
|
4544
|
-
const action =
|
|
4545
|
-
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}`;
|
|
4546
4761
|
}).join("\n");
|
|
4547
4762
|
return {
|
|
4548
4763
|
type: "text",
|
|
@@ -4695,9 +4910,9 @@ var CodexEventRenderer = class {
|
|
|
4695
4910
|
return;
|
|
4696
4911
|
}
|
|
4697
4912
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
4698
|
-
const summary = item.changes.map((
|
|
4699
|
-
const icon =
|
|
4700
|
-
return `${icon}${
|
|
4913
|
+
const summary = item.changes.map((c19) => {
|
|
4914
|
+
const icon = c19.kind === "add" ? "+" : c19.kind === "delete" ? "-" : "~";
|
|
4915
|
+
return `${icon}${c19.path}`;
|
|
4701
4916
|
}).join(", ");
|
|
4702
4917
|
console.log(chalk4.green("[files]") + ` ${summary}`);
|
|
4703
4918
|
return;
|
|
@@ -4718,7 +4933,7 @@ var CodexEventRenderer = class {
|
|
|
4718
4933
|
};
|
|
4719
4934
|
|
|
4720
4935
|
// src/lib/api/api-client.ts
|
|
4721
|
-
import { initClient as
|
|
4936
|
+
import { initClient as initClient9 } from "@ts-rest/core";
|
|
4722
4937
|
var ApiClient = class {
|
|
4723
4938
|
async getHeaders() {
|
|
4724
4939
|
const token = await getToken();
|
|
@@ -4744,7 +4959,7 @@ var ApiClient = class {
|
|
|
4744
4959
|
async getComposeByName(name, scope) {
|
|
4745
4960
|
const baseUrl = await this.getBaseUrl();
|
|
4746
4961
|
const headers = await this.getHeaders();
|
|
4747
|
-
const client =
|
|
4962
|
+
const client = initClient9(composesMainContract, {
|
|
4748
4963
|
baseUrl,
|
|
4749
4964
|
baseHeaders: headers,
|
|
4750
4965
|
jsonQuery: true
|
|
@@ -4765,7 +4980,7 @@ var ApiClient = class {
|
|
|
4765
4980
|
async getComposeById(id) {
|
|
4766
4981
|
const baseUrl = await this.getBaseUrl();
|
|
4767
4982
|
const headers = await this.getHeaders();
|
|
4768
|
-
const client =
|
|
4983
|
+
const client = initClient9(composesByIdContract, {
|
|
4769
4984
|
baseUrl,
|
|
4770
4985
|
baseHeaders: headers,
|
|
4771
4986
|
jsonQuery: true
|
|
@@ -4787,7 +5002,7 @@ var ApiClient = class {
|
|
|
4787
5002
|
async getComposeVersion(composeId, version) {
|
|
4788
5003
|
const baseUrl = await this.getBaseUrl();
|
|
4789
5004
|
const headers = await this.getHeaders();
|
|
4790
|
-
const client =
|
|
5005
|
+
const client = initClient9(composesVersionsContract, {
|
|
4791
5006
|
baseUrl,
|
|
4792
5007
|
baseHeaders: headers,
|
|
4793
5008
|
jsonQuery: true
|
|
@@ -4808,7 +5023,7 @@ var ApiClient = class {
|
|
|
4808
5023
|
async createOrUpdateCompose(body) {
|
|
4809
5024
|
const baseUrl = await this.getBaseUrl();
|
|
4810
5025
|
const headers = await this.getHeaders();
|
|
4811
|
-
const client =
|
|
5026
|
+
const client = initClient9(composesMainContract, {
|
|
4812
5027
|
baseUrl,
|
|
4813
5028
|
baseHeaders: headers,
|
|
4814
5029
|
jsonQuery: true
|
|
@@ -4831,7 +5046,7 @@ var ApiClient = class {
|
|
|
4831
5046
|
async createRun(body) {
|
|
4832
5047
|
const baseUrl = await this.getBaseUrl();
|
|
4833
5048
|
const headers = await this.getHeaders();
|
|
4834
|
-
const client =
|
|
5049
|
+
const client = initClient9(runsMainContract, {
|
|
4835
5050
|
baseUrl,
|
|
4836
5051
|
baseHeaders: headers,
|
|
4837
5052
|
jsonQuery: true
|
|
@@ -4847,7 +5062,7 @@ var ApiClient = class {
|
|
|
4847
5062
|
async getEvents(runId, options) {
|
|
4848
5063
|
const baseUrl = await this.getBaseUrl();
|
|
4849
5064
|
const headers = await this.getHeaders();
|
|
4850
|
-
const client =
|
|
5065
|
+
const client = initClient9(runEventsContract, {
|
|
4851
5066
|
baseUrl,
|
|
4852
5067
|
baseHeaders: headers,
|
|
4853
5068
|
jsonQuery: true
|
|
@@ -4869,7 +5084,7 @@ var ApiClient = class {
|
|
|
4869
5084
|
async getSystemLog(runId, options) {
|
|
4870
5085
|
const baseUrl = await this.getBaseUrl();
|
|
4871
5086
|
const headers = await this.getHeaders();
|
|
4872
|
-
const client =
|
|
5087
|
+
const client = initClient9(runSystemLogContract, {
|
|
4873
5088
|
baseUrl,
|
|
4874
5089
|
baseHeaders: headers,
|
|
4875
5090
|
jsonQuery: true
|
|
@@ -4892,7 +5107,7 @@ var ApiClient = class {
|
|
|
4892
5107
|
async getMetrics(runId, options) {
|
|
4893
5108
|
const baseUrl = await this.getBaseUrl();
|
|
4894
5109
|
const headers = await this.getHeaders();
|
|
4895
|
-
const client =
|
|
5110
|
+
const client = initClient9(runMetricsContract, {
|
|
4896
5111
|
baseUrl,
|
|
4897
5112
|
baseHeaders: headers,
|
|
4898
5113
|
jsonQuery: true
|
|
@@ -4915,7 +5130,7 @@ var ApiClient = class {
|
|
|
4915
5130
|
async getAgentEvents(runId, options) {
|
|
4916
5131
|
const baseUrl = await this.getBaseUrl();
|
|
4917
5132
|
const headers = await this.getHeaders();
|
|
4918
|
-
const client =
|
|
5133
|
+
const client = initClient9(runAgentEventsContract, {
|
|
4919
5134
|
baseUrl,
|
|
4920
5135
|
baseHeaders: headers,
|
|
4921
5136
|
jsonQuery: true
|
|
@@ -4938,7 +5153,7 @@ var ApiClient = class {
|
|
|
4938
5153
|
async getNetworkLogs(runId, options) {
|
|
4939
5154
|
const baseUrl = await this.getBaseUrl();
|
|
4940
5155
|
const headers = await this.getHeaders();
|
|
4941
|
-
const client =
|
|
5156
|
+
const client = initClient9(runNetworkLogsContract, {
|
|
4942
5157
|
baseUrl,
|
|
4943
5158
|
baseHeaders: headers,
|
|
4944
5159
|
jsonQuery: true
|
|
@@ -4964,7 +5179,7 @@ var ApiClient = class {
|
|
|
4964
5179
|
async getScope() {
|
|
4965
5180
|
const baseUrl = await this.getBaseUrl();
|
|
4966
5181
|
const headers = await this.getHeaders();
|
|
4967
|
-
const client =
|
|
5182
|
+
const client = initClient9(scopeContract, {
|
|
4968
5183
|
baseUrl,
|
|
4969
5184
|
baseHeaders: headers,
|
|
4970
5185
|
jsonQuery: true
|
|
@@ -4983,7 +5198,7 @@ var ApiClient = class {
|
|
|
4983
5198
|
async createScope(body) {
|
|
4984
5199
|
const baseUrl = await this.getBaseUrl();
|
|
4985
5200
|
const headers = await this.getHeaders();
|
|
4986
|
-
const client =
|
|
5201
|
+
const client = initClient9(scopeContract, {
|
|
4987
5202
|
baseUrl,
|
|
4988
5203
|
baseHeaders: headers,
|
|
4989
5204
|
jsonQuery: true
|
|
@@ -5002,7 +5217,7 @@ var ApiClient = class {
|
|
|
5002
5217
|
async updateScope(body) {
|
|
5003
5218
|
const baseUrl = await this.getBaseUrl();
|
|
5004
5219
|
const headers = await this.getHeaders();
|
|
5005
|
-
const client =
|
|
5220
|
+
const client = initClient9(scopeContract, {
|
|
5006
5221
|
baseUrl,
|
|
5007
5222
|
baseHeaders: headers,
|
|
5008
5223
|
jsonQuery: true
|
|
@@ -5022,7 +5237,7 @@ var ApiClient = class {
|
|
|
5022
5237
|
async getSession(sessionId) {
|
|
5023
5238
|
const baseUrl = await this.getBaseUrl();
|
|
5024
5239
|
const headers = await this.getHeaders();
|
|
5025
|
-
const client =
|
|
5240
|
+
const client = initClient9(sessionsByIdContract, {
|
|
5026
5241
|
baseUrl,
|
|
5027
5242
|
baseHeaders: headers,
|
|
5028
5243
|
jsonQuery: true
|
|
@@ -5044,7 +5259,7 @@ var ApiClient = class {
|
|
|
5044
5259
|
async getCheckpoint(checkpointId) {
|
|
5045
5260
|
const baseUrl = await this.getBaseUrl();
|
|
5046
5261
|
const headers = await this.getHeaders();
|
|
5047
|
-
const client =
|
|
5262
|
+
const client = initClient9(checkpointsByIdContract, {
|
|
5048
5263
|
baseUrl,
|
|
5049
5264
|
baseHeaders: headers,
|
|
5050
5265
|
jsonQuery: true
|
|
@@ -5065,7 +5280,7 @@ var ApiClient = class {
|
|
|
5065
5280
|
async prepareStorage(body) {
|
|
5066
5281
|
const baseUrl = await this.getBaseUrl();
|
|
5067
5282
|
const headers = await this.getHeaders();
|
|
5068
|
-
const client =
|
|
5283
|
+
const client = initClient9(storagesPrepareContract, {
|
|
5069
5284
|
baseUrl,
|
|
5070
5285
|
baseHeaders: headers,
|
|
5071
5286
|
jsonQuery: true
|
|
@@ -5084,7 +5299,7 @@ var ApiClient = class {
|
|
|
5084
5299
|
async commitStorage(body) {
|
|
5085
5300
|
const baseUrl = await this.getBaseUrl();
|
|
5086
5301
|
const headers = await this.getHeaders();
|
|
5087
|
-
const client =
|
|
5302
|
+
const client = initClient9(storagesCommitContract, {
|
|
5088
5303
|
baseUrl,
|
|
5089
5304
|
baseHeaders: headers,
|
|
5090
5305
|
jsonQuery: true
|
|
@@ -5103,7 +5318,7 @@ var ApiClient = class {
|
|
|
5103
5318
|
async getStorageDownload(query) {
|
|
5104
5319
|
const baseUrl = await this.getBaseUrl();
|
|
5105
5320
|
const headers = await this.getHeaders();
|
|
5106
|
-
const client =
|
|
5321
|
+
const client = initClient9(storagesDownloadContract, {
|
|
5107
5322
|
baseUrl,
|
|
5108
5323
|
baseHeaders: headers,
|
|
5109
5324
|
jsonQuery: true
|
|
@@ -5128,7 +5343,7 @@ var ApiClient = class {
|
|
|
5128
5343
|
async listStorages(query) {
|
|
5129
5344
|
const baseUrl = await this.getBaseUrl();
|
|
5130
5345
|
const headers = await this.getHeaders();
|
|
5131
|
-
const client =
|
|
5346
|
+
const client = initClient9(storagesListContract, {
|
|
5132
5347
|
baseUrl,
|
|
5133
5348
|
baseHeaders: headers,
|
|
5134
5349
|
jsonQuery: true
|
|
@@ -5147,7 +5362,7 @@ var ApiClient = class {
|
|
|
5147
5362
|
async deploySchedule(body) {
|
|
5148
5363
|
const baseUrl = await this.getBaseUrl();
|
|
5149
5364
|
const headers = await this.getHeaders();
|
|
5150
|
-
const client =
|
|
5365
|
+
const client = initClient9(schedulesMainContract, {
|
|
5151
5366
|
baseUrl,
|
|
5152
5367
|
baseHeaders: headers,
|
|
5153
5368
|
jsonQuery: true
|
|
@@ -5166,7 +5381,7 @@ var ApiClient = class {
|
|
|
5166
5381
|
async listSchedules() {
|
|
5167
5382
|
const baseUrl = await this.getBaseUrl();
|
|
5168
5383
|
const headers = await this.getHeaders();
|
|
5169
|
-
const client =
|
|
5384
|
+
const client = initClient9(schedulesMainContract, {
|
|
5170
5385
|
baseUrl,
|
|
5171
5386
|
baseHeaders: headers,
|
|
5172
5387
|
jsonQuery: true
|
|
@@ -5185,7 +5400,7 @@ var ApiClient = class {
|
|
|
5185
5400
|
async getScheduleByName(params) {
|
|
5186
5401
|
const baseUrl = await this.getBaseUrl();
|
|
5187
5402
|
const headers = await this.getHeaders();
|
|
5188
|
-
const client =
|
|
5403
|
+
const client = initClient9(schedulesByNameContract, {
|
|
5189
5404
|
baseUrl,
|
|
5190
5405
|
baseHeaders: headers,
|
|
5191
5406
|
jsonQuery: true
|
|
@@ -5207,7 +5422,7 @@ var ApiClient = class {
|
|
|
5207
5422
|
async deleteSchedule(params) {
|
|
5208
5423
|
const baseUrl = await this.getBaseUrl();
|
|
5209
5424
|
const headers = await this.getHeaders();
|
|
5210
|
-
const client =
|
|
5425
|
+
const client = initClient9(schedulesByNameContract, {
|
|
5211
5426
|
baseUrl,
|
|
5212
5427
|
baseHeaders: headers,
|
|
5213
5428
|
jsonQuery: true
|
|
@@ -5229,7 +5444,7 @@ var ApiClient = class {
|
|
|
5229
5444
|
async enableSchedule(params) {
|
|
5230
5445
|
const baseUrl = await this.getBaseUrl();
|
|
5231
5446
|
const headers = await this.getHeaders();
|
|
5232
|
-
const client =
|
|
5447
|
+
const client = initClient9(schedulesEnableContract, {
|
|
5233
5448
|
baseUrl,
|
|
5234
5449
|
baseHeaders: headers,
|
|
5235
5450
|
jsonQuery: true
|
|
@@ -5251,7 +5466,7 @@ var ApiClient = class {
|
|
|
5251
5466
|
async disableSchedule(params) {
|
|
5252
5467
|
const baseUrl = await this.getBaseUrl();
|
|
5253
5468
|
const headers = await this.getHeaders();
|
|
5254
|
-
const client =
|
|
5469
|
+
const client = initClient9(schedulesEnableContract, {
|
|
5255
5470
|
baseUrl,
|
|
5256
5471
|
baseHeaders: headers,
|
|
5257
5472
|
jsonQuery: true
|
|
@@ -5273,7 +5488,7 @@ var ApiClient = class {
|
|
|
5273
5488
|
async listScheduleRuns(params) {
|
|
5274
5489
|
const baseUrl = await this.getBaseUrl();
|
|
5275
5490
|
const headers = await this.getHeaders();
|
|
5276
|
-
const client =
|
|
5491
|
+
const client = initClient9(scheduleRunsContract, {
|
|
5277
5492
|
baseUrl,
|
|
5278
5493
|
baseHeaders: headers,
|
|
5279
5494
|
jsonQuery: true
|
|
@@ -5298,7 +5513,7 @@ var ApiClient = class {
|
|
|
5298
5513
|
async listPublicAgents(query) {
|
|
5299
5514
|
const baseUrl = await this.getBaseUrl();
|
|
5300
5515
|
const headers = await this.getHeaders();
|
|
5301
|
-
const client =
|
|
5516
|
+
const client = initClient9(publicAgentsListContract, {
|
|
5302
5517
|
baseUrl,
|
|
5303
5518
|
baseHeaders: headers,
|
|
5304
5519
|
jsonQuery: true
|
|
@@ -5317,7 +5532,7 @@ var ApiClient = class {
|
|
|
5317
5532
|
async listPublicArtifacts(query) {
|
|
5318
5533
|
const baseUrl = await this.getBaseUrl();
|
|
5319
5534
|
const headers = await this.getHeaders();
|
|
5320
|
-
const client =
|
|
5535
|
+
const client = initClient9(publicArtifactsListContract, {
|
|
5321
5536
|
baseUrl,
|
|
5322
5537
|
baseHeaders: headers,
|
|
5323
5538
|
jsonQuery: true
|
|
@@ -5336,7 +5551,7 @@ var ApiClient = class {
|
|
|
5336
5551
|
async getPublicArtifact(id) {
|
|
5337
5552
|
const baseUrl = await this.getBaseUrl();
|
|
5338
5553
|
const headers = await this.getHeaders();
|
|
5339
|
-
const client =
|
|
5554
|
+
const client = initClient9(publicArtifactByIdContract, {
|
|
5340
5555
|
baseUrl,
|
|
5341
5556
|
baseHeaders: headers,
|
|
5342
5557
|
jsonQuery: true
|
|
@@ -5355,7 +5570,7 @@ var ApiClient = class {
|
|
|
5355
5570
|
async listPublicVolumes(query) {
|
|
5356
5571
|
const baseUrl = await this.getBaseUrl();
|
|
5357
5572
|
const headers = await this.getHeaders();
|
|
5358
|
-
const client =
|
|
5573
|
+
const client = initClient9(publicVolumesListContract, {
|
|
5359
5574
|
baseUrl,
|
|
5360
5575
|
baseHeaders: headers,
|
|
5361
5576
|
jsonQuery: true
|
|
@@ -5374,7 +5589,7 @@ var ApiClient = class {
|
|
|
5374
5589
|
async getPublicVolume(id) {
|
|
5375
5590
|
const baseUrl = await this.getBaseUrl();
|
|
5376
5591
|
const headers = await this.getHeaders();
|
|
5377
|
-
const client =
|
|
5592
|
+
const client = initClient9(publicVolumeByIdContract, {
|
|
5378
5593
|
baseUrl,
|
|
5379
5594
|
baseHeaders: headers,
|
|
5380
5595
|
jsonQuery: true
|
|
@@ -5413,7 +5628,7 @@ var ApiClient = class {
|
|
|
5413
5628
|
async listCredentials() {
|
|
5414
5629
|
const baseUrl = await this.getBaseUrl();
|
|
5415
5630
|
const headers = await this.getHeaders();
|
|
5416
|
-
const client =
|
|
5631
|
+
const client = initClient9(credentialsMainContract, {
|
|
5417
5632
|
baseUrl,
|
|
5418
5633
|
baseHeaders: headers,
|
|
5419
5634
|
jsonQuery: true
|
|
@@ -5432,7 +5647,7 @@ var ApiClient = class {
|
|
|
5432
5647
|
async getCredential(name) {
|
|
5433
5648
|
const baseUrl = await this.getBaseUrl();
|
|
5434
5649
|
const headers = await this.getHeaders();
|
|
5435
|
-
const client =
|
|
5650
|
+
const client = initClient9(credentialsByNameContract, {
|
|
5436
5651
|
baseUrl,
|
|
5437
5652
|
baseHeaders: headers,
|
|
5438
5653
|
jsonQuery: true
|
|
@@ -5453,7 +5668,7 @@ var ApiClient = class {
|
|
|
5453
5668
|
async setCredential(body) {
|
|
5454
5669
|
const baseUrl = await this.getBaseUrl();
|
|
5455
5670
|
const headers = await this.getHeaders();
|
|
5456
|
-
const client =
|
|
5671
|
+
const client = initClient9(credentialsMainContract, {
|
|
5457
5672
|
baseUrl,
|
|
5458
5673
|
baseHeaders: headers,
|
|
5459
5674
|
jsonQuery: true
|
|
@@ -5472,7 +5687,7 @@ var ApiClient = class {
|
|
|
5472
5687
|
async deleteCredential(name) {
|
|
5473
5688
|
const baseUrl = await this.getBaseUrl();
|
|
5474
5689
|
const headers = await this.getHeaders();
|
|
5475
|
-
const client =
|
|
5690
|
+
const client = initClient9(credentialsByNameContract, {
|
|
5476
5691
|
baseUrl,
|
|
5477
5692
|
baseHeaders: headers,
|
|
5478
5693
|
jsonQuery: true
|
|
@@ -5493,7 +5708,7 @@ var ApiClient = class {
|
|
|
5493
5708
|
async getRealtimeToken(runId) {
|
|
5494
5709
|
const baseUrl = await this.getBaseUrl();
|
|
5495
5710
|
const headers = await this.getHeaders();
|
|
5496
|
-
const client =
|
|
5711
|
+
const client = initClient9(realtimeTokenContract, {
|
|
5497
5712
|
baseUrl,
|
|
5498
5713
|
baseHeaders: headers,
|
|
5499
5714
|
jsonQuery: true
|
|
@@ -5924,7 +6139,7 @@ var mainRunCommand = new Command2().name("run").description("Execute an agent").
|
|
|
5924
6139
|
).option("-v, --verbose", "Show verbose output with timing information").option(
|
|
5925
6140
|
"--experimental-realtime",
|
|
5926
6141
|
"Use realtime event streaming instead of polling (experimental)"
|
|
5927
|
-
).
|
|
6142
|
+
).addOption(new Option("--debug-no-mock-claude").hideHelp()).action(
|
|
5928
6143
|
async (identifier, prompt, options) => {
|
|
5929
6144
|
const startTimestamp = /* @__PURE__ */ new Date();
|
|
5930
6145
|
const verbose = options.verbose;
|
|
@@ -6084,7 +6299,7 @@ var mainRunCommand = new Command2().name("run").description("Execute an agent").
|
|
|
6084
6299
|
);
|
|
6085
6300
|
|
|
6086
6301
|
// src/commands/run/resume.ts
|
|
6087
|
-
import { Command as Command3 } from "commander";
|
|
6302
|
+
import { Command as Command3, Option as Option2 } from "commander";
|
|
6088
6303
|
import chalk7 from "chalk";
|
|
6089
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(
|
|
6090
6305
|
"--vars <KEY=value>",
|
|
@@ -6104,7 +6319,7 @@ var resumeCommand = new Command3().name("resume").description("Resume an agent r
|
|
|
6104
6319
|
).option("-v, --verbose", "Show verbose output with timing information").option(
|
|
6105
6320
|
"--experimental-realtime",
|
|
6106
6321
|
"Use realtime event streaming instead of polling (experimental)"
|
|
6107
|
-
).
|
|
6322
|
+
).addOption(new Option2("--debug-no-mock-claude").hideHelp()).action(
|
|
6108
6323
|
async (checkpointId, prompt, options, command) => {
|
|
6109
6324
|
const startTimestamp = /* @__PURE__ */ new Date();
|
|
6110
6325
|
const allOpts = command.optsWithGlobals();
|
|
@@ -6198,7 +6413,7 @@ var resumeCommand = new Command3().name("resume").description("Resume an agent r
|
|
|
6198
6413
|
);
|
|
6199
6414
|
|
|
6200
6415
|
// src/commands/run/continue.ts
|
|
6201
|
-
import { Command as Command4 } from "commander";
|
|
6416
|
+
import { Command as Command4, Option as Option3 } from "commander";
|
|
6202
6417
|
import chalk8 from "chalk";
|
|
6203
6418
|
var continueCommand = new Command4().name("continue").description(
|
|
6204
6419
|
"Continue an agent run from a session (uses latest artifact version)"
|
|
@@ -6220,7 +6435,7 @@ var continueCommand = new Command4().name("continue").description(
|
|
|
6220
6435
|
).option("-v, --verbose", "Show verbose output with timing information").option(
|
|
6221
6436
|
"--experimental-realtime",
|
|
6222
6437
|
"Use realtime event streaming instead of polling (experimental)"
|
|
6223
|
-
).
|
|
6438
|
+
).addOption(new Option3("--debug-no-mock-claude").hideHelp()).action(
|
|
6224
6439
|
async (agentSessionId, prompt, options, command) => {
|
|
6225
6440
|
const startTimestamp = /* @__PURE__ */ new Date();
|
|
6226
6441
|
const allOpts = command.optsWithGlobals();
|
|
@@ -7258,7 +7473,7 @@ var cloneCommand2 = new Command17().name("clone").description("Clone a remote ar
|
|
|
7258
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);
|
|
7259
7474
|
|
|
7260
7475
|
// src/commands/cook.ts
|
|
7261
|
-
import { Command as Command19 } from "commander";
|
|
7476
|
+
import { Command as Command19, Option as Option4 } from "commander";
|
|
7262
7477
|
import chalk24 from "chalk";
|
|
7263
7478
|
import { readFile as readFile7, mkdir as mkdir6, writeFile as writeFile6, appendFile } from "fs/promises";
|
|
7264
7479
|
import { existsSync as existsSync8, readFileSync } from "fs";
|
|
@@ -7590,9 +7805,9 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
7590
7805
|
}
|
|
7591
7806
|
}
|
|
7592
7807
|
var cookCmd = new Command19().name("cook").description("One-click agent preparation and execution from vm0.yaml");
|
|
7593
|
-
cookCmd.argument("[prompt]", "Prompt for the agent").option("-y, --yes", "Skip confirmation prompts").
|
|
7808
|
+
cookCmd.argument("[prompt]", "Prompt for the agent").option("-y, --yes", "Skip confirmation prompts").addOption(new Option4("--debug-no-mock-claude").hideHelp()).action(
|
|
7594
7809
|
async (prompt, options) => {
|
|
7595
|
-
const shouldExit = await checkAndUpgrade("6.
|
|
7810
|
+
const shouldExit = await checkAndUpgrade("6.1.0", prompt);
|
|
7596
7811
|
if (shouldExit) {
|
|
7597
7812
|
process.exit(0);
|
|
7598
7813
|
}
|
|
@@ -7817,7 +8032,7 @@ cookCmd.command("logs").description("View logs from the last cook run").option("
|
|
|
7817
8032
|
);
|
|
7818
8033
|
cookCmd.command("continue").description(
|
|
7819
8034
|
"Continue from the last session (latest conversation and artifact)"
|
|
7820
|
-
).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) => {
|
|
7821
8036
|
const state = await loadCookState();
|
|
7822
8037
|
if (!state.lastSessionId) {
|
|
7823
8038
|
console.error(chalk24.red("\u2717 No previous session found"));
|
|
@@ -7855,7 +8070,7 @@ cookCmd.command("continue").description(
|
|
|
7855
8070
|
});
|
|
7856
8071
|
cookCmd.command("resume").description(
|
|
7857
8072
|
"Resume from the last checkpoint (snapshotted conversation and artifact)"
|
|
7858
|
-
).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) => {
|
|
7859
8074
|
const state = await loadCookState();
|
|
7860
8075
|
if (!state.lastCheckpointId) {
|
|
7861
8076
|
console.error(chalk24.red("\u2717 No previous checkpoint found"));
|
|
@@ -8293,7 +8508,7 @@ var listCommand3 = new Command24().name("list").alias("ls").description("List al
|
|
|
8293
8508
|
);
|
|
8294
8509
|
return;
|
|
8295
8510
|
}
|
|
8296
|
-
const nameWidth = Math.max(4, ...data.composes.map((
|
|
8511
|
+
const nameWidth = Math.max(4, ...data.composes.map((c19) => c19.name.length));
|
|
8297
8512
|
const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
|
|
8298
8513
|
" "
|
|
8299
8514
|
);
|
|
@@ -10469,7 +10684,8 @@ var listCommand5 = new Command38().name("list").description("List all credential
|
|
|
10469
10684
|
console.log(chalk40.bold("Credentials:"));
|
|
10470
10685
|
console.log();
|
|
10471
10686
|
for (const credential of result.credentials) {
|
|
10472
|
-
|
|
10687
|
+
const typeIndicator = credential.type === "model-provider" ? chalk40.dim(" [model-provider]") : "";
|
|
10688
|
+
console.log(` ${chalk40.cyan(credential.name)}${typeIndicator}`);
|
|
10473
10689
|
if (credential.description) {
|
|
10474
10690
|
console.log(` ${chalk40.dim(credential.description)}`);
|
|
10475
10691
|
}
|
|
@@ -10587,11 +10803,268 @@ var deleteCommand2 = new Command40().name("delete").description("Delete a creden
|
|
|
10587
10803
|
// src/commands/credential/index.ts
|
|
10588
10804
|
var credentialCommand = new Command41().name("experimental-credential").description("[Experimental] Manage stored credentials for agent runs").addCommand(listCommand5).addCommand(setCommand2).addCommand(deleteCommand2);
|
|
10589
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
|
+
|
|
10590
11063
|
// src/index.ts
|
|
10591
|
-
var program = new
|
|
10592
|
-
program.name("vm0").description("VM0 CLI - A modern build tool").version("6.
|
|
11064
|
+
var program = new Command47();
|
|
11065
|
+
program.name("vm0").description("VM0 CLI - A modern build tool").version("6.1.0");
|
|
10593
11066
|
program.command("info").description("Display environment information").action(async () => {
|
|
10594
|
-
console.log(
|
|
11067
|
+
console.log(chalk47.bold("System Information:"));
|
|
10595
11068
|
console.log(`Node Version: ${process.version}`);
|
|
10596
11069
|
console.log(`Platform: ${process.platform}`);
|
|
10597
11070
|
console.log(`Architecture: ${process.arch}`);
|
|
@@ -10624,6 +11097,7 @@ program.addCommand(setupGithubCommand);
|
|
|
10624
11097
|
program.addCommand(scheduleCommand);
|
|
10625
11098
|
program.addCommand(usageCommand);
|
|
10626
11099
|
program.addCommand(credentialCommand);
|
|
11100
|
+
program.addCommand(modelProviderCommand);
|
|
10627
11101
|
if (process.argv[1]?.endsWith("index.js") || process.argv[1]?.endsWith("index.ts") || process.argv[1]?.endsWith("vm0")) {
|
|
10628
11102
|
program.parse();
|
|
10629
11103
|
}
|