@vm0/cli 5.8.0 → 5.9.1
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 +635 -316
- 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 Command40 } from "commander";
|
|
5
|
+
import chalk40 from "chalk";
|
|
6
6
|
|
|
7
7
|
// src/lib/api/auth.ts
|
|
8
8
|
import chalk from "chalk";
|
|
@@ -192,7 +192,7 @@ import { parse as parseYaml2 } from "yaml";
|
|
|
192
192
|
import prompts from "prompts";
|
|
193
193
|
|
|
194
194
|
// ../../packages/core/src/variable-expander.ts
|
|
195
|
-
var VARIABLE_PATTERN = /\$\{\{\s*(env|vars|secrets)\.([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g;
|
|
195
|
+
var VARIABLE_PATTERN = /\$\{\{\s*(env|vars|secrets|credentials)\.([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g;
|
|
196
196
|
function extractVariableReferencesFromString(value) {
|
|
197
197
|
const refs = [];
|
|
198
198
|
const matches = value.matchAll(VARIABLE_PATTERN);
|
|
@@ -237,7 +237,8 @@ function groupVariablesBySource(refs) {
|
|
|
237
237
|
const groups = {
|
|
238
238
|
env: [],
|
|
239
239
|
vars: [],
|
|
240
|
-
secrets: []
|
|
240
|
+
secrets: [],
|
|
241
|
+
credentials: []
|
|
241
242
|
};
|
|
242
243
|
for (const ref of refs) {
|
|
243
244
|
groups[ref.source].push(ref);
|
|
@@ -1646,43 +1647,137 @@ var scopeContract = c9.router({
|
|
|
1646
1647
|
}
|
|
1647
1648
|
});
|
|
1648
1649
|
|
|
1649
|
-
// ../../packages/core/src/contracts/
|
|
1650
|
+
// ../../packages/core/src/contracts/credentials.ts
|
|
1650
1651
|
import { z as z12 } from "zod";
|
|
1651
1652
|
var c10 = initContract();
|
|
1652
|
-
var
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
volumeVersions: z12.record(z12.string(), z12.string()).nullable(),
|
|
1653
|
+
var credentialNameSchema = z12.string().min(1, "Credential name is required").max(255, "Credential name must be at most 255 characters").regex(
|
|
1654
|
+
/^[A-Z][A-Z0-9_]*$/,
|
|
1655
|
+
"Credential name must contain only uppercase letters, numbers, and underscores, and must start with a letter (e.g., MY_API_KEY)"
|
|
1656
|
+
);
|
|
1657
|
+
var credentialResponseSchema = z12.object({
|
|
1658
|
+
id: z12.string().uuid(),
|
|
1659
|
+
name: z12.string(),
|
|
1660
|
+
description: z12.string().nullable(),
|
|
1661
1661
|
createdAt: z12.string(),
|
|
1662
1662
|
updatedAt: z12.string()
|
|
1663
1663
|
});
|
|
1664
|
-
var
|
|
1665
|
-
|
|
1666
|
-
vars: z12.record(z12.string(), z12.string()).optional(),
|
|
1667
|
-
secretNames: z12.array(z12.string()).optional()
|
|
1664
|
+
var credentialListResponseSchema = z12.object({
|
|
1665
|
+
credentials: z12.array(credentialResponseSchema)
|
|
1668
1666
|
});
|
|
1669
|
-
var
|
|
1670
|
-
|
|
1671
|
-
|
|
1667
|
+
var setCredentialRequestSchema = z12.object({
|
|
1668
|
+
name: credentialNameSchema,
|
|
1669
|
+
value: z12.string().min(1, "Credential value is required"),
|
|
1670
|
+
description: z12.string().max(1e3).optional()
|
|
1672
1671
|
});
|
|
1673
|
-
var
|
|
1674
|
-
|
|
1672
|
+
var credentialsMainContract = c10.router({
|
|
1673
|
+
/**
|
|
1674
|
+
* GET /api/credentials
|
|
1675
|
+
* List all credentials for the current user's scope (metadata only)
|
|
1676
|
+
*/
|
|
1677
|
+
list: {
|
|
1678
|
+
method: "GET",
|
|
1679
|
+
path: "/api/credentials",
|
|
1680
|
+
responses: {
|
|
1681
|
+
200: credentialListResponseSchema,
|
|
1682
|
+
401: apiErrorSchema,
|
|
1683
|
+
500: apiErrorSchema
|
|
1684
|
+
},
|
|
1685
|
+
summary: "List all credentials (metadata only)"
|
|
1686
|
+
},
|
|
1687
|
+
/**
|
|
1688
|
+
* PUT /api/credentials
|
|
1689
|
+
* Create or update a credential
|
|
1690
|
+
*/
|
|
1691
|
+
set: {
|
|
1692
|
+
method: "PUT",
|
|
1693
|
+
path: "/api/credentials",
|
|
1694
|
+
body: setCredentialRequestSchema,
|
|
1695
|
+
responses: {
|
|
1696
|
+
200: credentialResponseSchema,
|
|
1697
|
+
201: credentialResponseSchema,
|
|
1698
|
+
400: apiErrorSchema,
|
|
1699
|
+
401: apiErrorSchema,
|
|
1700
|
+
500: apiErrorSchema
|
|
1701
|
+
},
|
|
1702
|
+
summary: "Create or update a credential"
|
|
1703
|
+
}
|
|
1675
1704
|
});
|
|
1676
|
-
var
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1705
|
+
var credentialsByNameContract = c10.router({
|
|
1706
|
+
/**
|
|
1707
|
+
* GET /api/credentials/:name
|
|
1708
|
+
* Get a credential by name (metadata only)
|
|
1709
|
+
*/
|
|
1710
|
+
get: {
|
|
1711
|
+
method: "GET",
|
|
1712
|
+
path: "/api/credentials/:name",
|
|
1713
|
+
pathParams: z12.object({
|
|
1714
|
+
name: credentialNameSchema
|
|
1715
|
+
}),
|
|
1716
|
+
responses: {
|
|
1717
|
+
200: credentialResponseSchema,
|
|
1718
|
+
401: apiErrorSchema,
|
|
1719
|
+
404: apiErrorSchema,
|
|
1720
|
+
500: apiErrorSchema
|
|
1721
|
+
},
|
|
1722
|
+
summary: "Get credential metadata by name"
|
|
1723
|
+
},
|
|
1724
|
+
/**
|
|
1725
|
+
* DELETE /api/credentials/:name
|
|
1726
|
+
* Delete a credential by name
|
|
1727
|
+
*/
|
|
1728
|
+
delete: {
|
|
1729
|
+
method: "DELETE",
|
|
1730
|
+
path: "/api/credentials/:name",
|
|
1731
|
+
pathParams: z12.object({
|
|
1732
|
+
name: credentialNameSchema
|
|
1733
|
+
}),
|
|
1734
|
+
responses: {
|
|
1735
|
+
204: z12.undefined(),
|
|
1736
|
+
401: apiErrorSchema,
|
|
1737
|
+
404: apiErrorSchema,
|
|
1738
|
+
500: apiErrorSchema
|
|
1739
|
+
},
|
|
1740
|
+
summary: "Delete a credential"
|
|
1741
|
+
}
|
|
1742
|
+
});
|
|
1743
|
+
|
|
1744
|
+
// ../../packages/core/src/contracts/sessions.ts
|
|
1745
|
+
import { z as z13 } from "zod";
|
|
1746
|
+
var c11 = initContract();
|
|
1747
|
+
var sessionResponseSchema = z13.object({
|
|
1748
|
+
id: z13.string(),
|
|
1749
|
+
agentComposeId: z13.string(),
|
|
1750
|
+
agentComposeVersionId: z13.string().nullable(),
|
|
1751
|
+
conversationId: z13.string().nullable(),
|
|
1752
|
+
artifactName: z13.string().nullable(),
|
|
1753
|
+
vars: z13.record(z13.string(), z13.string()).nullable(),
|
|
1754
|
+
secretNames: z13.array(z13.string()).nullable(),
|
|
1755
|
+
volumeVersions: z13.record(z13.string(), z13.string()).nullable(),
|
|
1756
|
+
createdAt: z13.string(),
|
|
1757
|
+
updatedAt: z13.string()
|
|
1758
|
+
});
|
|
1759
|
+
var agentComposeSnapshotSchema = z13.object({
|
|
1760
|
+
agentComposeVersionId: z13.string(),
|
|
1761
|
+
vars: z13.record(z13.string(), z13.string()).optional(),
|
|
1762
|
+
secretNames: z13.array(z13.string()).optional()
|
|
1763
|
+
});
|
|
1764
|
+
var artifactSnapshotSchema2 = z13.object({
|
|
1765
|
+
artifactName: z13.string(),
|
|
1766
|
+
artifactVersion: z13.string()
|
|
1767
|
+
});
|
|
1768
|
+
var volumeVersionsSnapshotSchema2 = z13.object({
|
|
1769
|
+
versions: z13.record(z13.string(), z13.string())
|
|
1770
|
+
});
|
|
1771
|
+
var checkpointResponseSchema = z13.object({
|
|
1772
|
+
id: z13.string(),
|
|
1773
|
+
runId: z13.string(),
|
|
1774
|
+
conversationId: z13.string(),
|
|
1680
1775
|
agentComposeSnapshot: agentComposeSnapshotSchema,
|
|
1681
1776
|
artifactSnapshot: artifactSnapshotSchema2.nullable(),
|
|
1682
1777
|
volumeVersionsSnapshot: volumeVersionsSnapshotSchema2.nullable(),
|
|
1683
|
-
createdAt:
|
|
1778
|
+
createdAt: z13.string()
|
|
1684
1779
|
});
|
|
1685
|
-
var sessionsByIdContract =
|
|
1780
|
+
var sessionsByIdContract = c11.router({
|
|
1686
1781
|
/**
|
|
1687
1782
|
* GET /api/agent/sessions/:id
|
|
1688
1783
|
* Get session by ID
|
|
@@ -1690,8 +1785,8 @@ var sessionsByIdContract = c10.router({
|
|
|
1690
1785
|
getById: {
|
|
1691
1786
|
method: "GET",
|
|
1692
1787
|
path: "/api/agent/sessions/:id",
|
|
1693
|
-
pathParams:
|
|
1694
|
-
id:
|
|
1788
|
+
pathParams: z13.object({
|
|
1789
|
+
id: z13.string().min(1, "Session ID is required")
|
|
1695
1790
|
}),
|
|
1696
1791
|
responses: {
|
|
1697
1792
|
200: sessionResponseSchema,
|
|
@@ -1702,7 +1797,7 @@ var sessionsByIdContract = c10.router({
|
|
|
1702
1797
|
summary: "Get session by ID"
|
|
1703
1798
|
}
|
|
1704
1799
|
});
|
|
1705
|
-
var checkpointsByIdContract =
|
|
1800
|
+
var checkpointsByIdContract = c11.router({
|
|
1706
1801
|
/**
|
|
1707
1802
|
* GET /api/agent/checkpoints/:id
|
|
1708
1803
|
* Get checkpoint by ID
|
|
@@ -1710,8 +1805,8 @@ var checkpointsByIdContract = c10.router({
|
|
|
1710
1805
|
getById: {
|
|
1711
1806
|
method: "GET",
|
|
1712
1807
|
path: "/api/agent/checkpoints/:id",
|
|
1713
|
-
pathParams:
|
|
1714
|
-
id:
|
|
1808
|
+
pathParams: z13.object({
|
|
1809
|
+
id: z13.string().min(1, "Checkpoint ID is required")
|
|
1715
1810
|
}),
|
|
1716
1811
|
responses: {
|
|
1717
1812
|
200: checkpointResponseSchema,
|
|
@@ -1724,91 +1819,91 @@ var checkpointsByIdContract = c10.router({
|
|
|
1724
1819
|
});
|
|
1725
1820
|
|
|
1726
1821
|
// ../../packages/core/src/contracts/schedules.ts
|
|
1727
|
-
import { z as
|
|
1728
|
-
var
|
|
1729
|
-
var scheduleTriggerSchema =
|
|
1730
|
-
cron:
|
|
1731
|
-
at:
|
|
1732
|
-
timezone:
|
|
1822
|
+
import { z as z14 } from "zod";
|
|
1823
|
+
var c12 = initContract();
|
|
1824
|
+
var scheduleTriggerSchema = z14.object({
|
|
1825
|
+
cron: z14.string().optional(),
|
|
1826
|
+
at: z14.string().optional(),
|
|
1827
|
+
timezone: z14.string().default("UTC")
|
|
1733
1828
|
}).refine((data) => data.cron && !data.at || !data.cron && data.at, {
|
|
1734
1829
|
message: "Exactly one of 'cron' or 'at' must be specified"
|
|
1735
1830
|
});
|
|
1736
|
-
var scheduleRunConfigSchema =
|
|
1737
|
-
agent:
|
|
1738
|
-
prompt:
|
|
1739
|
-
vars:
|
|
1740
|
-
secrets:
|
|
1741
|
-
artifactName:
|
|
1742
|
-
artifactVersion:
|
|
1743
|
-
volumeVersions:
|
|
1831
|
+
var scheduleRunConfigSchema = z14.object({
|
|
1832
|
+
agent: z14.string().min(1, "Agent reference required"),
|
|
1833
|
+
prompt: z14.string().min(1, "Prompt required"),
|
|
1834
|
+
vars: z14.record(z14.string(), z14.string()).optional(),
|
|
1835
|
+
secrets: z14.record(z14.string(), z14.string()).optional(),
|
|
1836
|
+
artifactName: z14.string().optional(),
|
|
1837
|
+
artifactVersion: z14.string().optional(),
|
|
1838
|
+
volumeVersions: z14.record(z14.string(), z14.string()).optional()
|
|
1744
1839
|
});
|
|
1745
|
-
var scheduleDefinitionSchema =
|
|
1840
|
+
var scheduleDefinitionSchema = z14.object({
|
|
1746
1841
|
on: scheduleTriggerSchema,
|
|
1747
1842
|
run: scheduleRunConfigSchema
|
|
1748
1843
|
});
|
|
1749
|
-
var scheduleYamlSchema =
|
|
1750
|
-
version:
|
|
1751
|
-
schedules:
|
|
1752
|
-
});
|
|
1753
|
-
var deployScheduleRequestSchema =
|
|
1754
|
-
name:
|
|
1755
|
-
cronExpression:
|
|
1756
|
-
atTime:
|
|
1757
|
-
timezone:
|
|
1758
|
-
prompt:
|
|
1759
|
-
vars:
|
|
1760
|
-
secrets:
|
|
1761
|
-
artifactName:
|
|
1762
|
-
artifactVersion:
|
|
1763
|
-
volumeVersions:
|
|
1844
|
+
var scheduleYamlSchema = z14.object({
|
|
1845
|
+
version: z14.literal("1.0"),
|
|
1846
|
+
schedules: z14.record(z14.string(), scheduleDefinitionSchema)
|
|
1847
|
+
});
|
|
1848
|
+
var deployScheduleRequestSchema = z14.object({
|
|
1849
|
+
name: z14.string().min(1).max(64, "Schedule name max 64 chars"),
|
|
1850
|
+
cronExpression: z14.string().optional(),
|
|
1851
|
+
atTime: z14.string().optional(),
|
|
1852
|
+
timezone: z14.string().default("UTC"),
|
|
1853
|
+
prompt: z14.string().min(1, "Prompt required"),
|
|
1854
|
+
vars: z14.record(z14.string(), z14.string()).optional(),
|
|
1855
|
+
secrets: z14.record(z14.string(), z14.string()).optional(),
|
|
1856
|
+
artifactName: z14.string().optional(),
|
|
1857
|
+
artifactVersion: z14.string().optional(),
|
|
1858
|
+
volumeVersions: z14.record(z14.string(), z14.string()).optional(),
|
|
1764
1859
|
// Resolved agent compose ID (CLI resolves scope/name:version → composeId)
|
|
1765
|
-
composeId:
|
|
1860
|
+
composeId: z14.string().uuid("Invalid compose ID")
|
|
1766
1861
|
}).refine(
|
|
1767
1862
|
(data) => data.cronExpression && !data.atTime || !data.cronExpression && data.atTime,
|
|
1768
1863
|
{
|
|
1769
1864
|
message: "Exactly one of 'cronExpression' or 'atTime' must be specified"
|
|
1770
1865
|
}
|
|
1771
1866
|
);
|
|
1772
|
-
var scheduleResponseSchema =
|
|
1773
|
-
id:
|
|
1774
|
-
composeId:
|
|
1775
|
-
composeName:
|
|
1776
|
-
scopeSlug:
|
|
1777
|
-
name:
|
|
1778
|
-
cronExpression:
|
|
1779
|
-
atTime:
|
|
1780
|
-
timezone:
|
|
1781
|
-
prompt:
|
|
1782
|
-
vars:
|
|
1867
|
+
var scheduleResponseSchema = z14.object({
|
|
1868
|
+
id: z14.string().uuid(),
|
|
1869
|
+
composeId: z14.string().uuid(),
|
|
1870
|
+
composeName: z14.string(),
|
|
1871
|
+
scopeSlug: z14.string(),
|
|
1872
|
+
name: z14.string(),
|
|
1873
|
+
cronExpression: z14.string().nullable(),
|
|
1874
|
+
atTime: z14.string().nullable(),
|
|
1875
|
+
timezone: z14.string(),
|
|
1876
|
+
prompt: z14.string(),
|
|
1877
|
+
vars: z14.record(z14.string(), z14.string()).nullable(),
|
|
1783
1878
|
// Secret names only (values are never returned)
|
|
1784
|
-
secretNames:
|
|
1785
|
-
artifactName:
|
|
1786
|
-
artifactVersion:
|
|
1787
|
-
volumeVersions:
|
|
1788
|
-
enabled:
|
|
1789
|
-
nextRunAt:
|
|
1790
|
-
createdAt:
|
|
1791
|
-
updatedAt:
|
|
1792
|
-
});
|
|
1793
|
-
var runSummarySchema =
|
|
1794
|
-
id:
|
|
1795
|
-
status:
|
|
1796
|
-
createdAt:
|
|
1797
|
-
completedAt:
|
|
1798
|
-
error:
|
|
1799
|
-
});
|
|
1800
|
-
var scheduleRunsResponseSchema =
|
|
1801
|
-
runs:
|
|
1802
|
-
});
|
|
1803
|
-
var scheduleListResponseSchema =
|
|
1804
|
-
schedules:
|
|
1805
|
-
});
|
|
1806
|
-
var deployScheduleResponseSchema =
|
|
1879
|
+
secretNames: z14.array(z14.string()).nullable(),
|
|
1880
|
+
artifactName: z14.string().nullable(),
|
|
1881
|
+
artifactVersion: z14.string().nullable(),
|
|
1882
|
+
volumeVersions: z14.record(z14.string(), z14.string()).nullable(),
|
|
1883
|
+
enabled: z14.boolean(),
|
|
1884
|
+
nextRunAt: z14.string().nullable(),
|
|
1885
|
+
createdAt: z14.string(),
|
|
1886
|
+
updatedAt: z14.string()
|
|
1887
|
+
});
|
|
1888
|
+
var runSummarySchema = z14.object({
|
|
1889
|
+
id: z14.string().uuid(),
|
|
1890
|
+
status: z14.enum(["pending", "running", "completed", "failed", "timeout"]),
|
|
1891
|
+
createdAt: z14.string(),
|
|
1892
|
+
completedAt: z14.string().nullable(),
|
|
1893
|
+
error: z14.string().nullable()
|
|
1894
|
+
});
|
|
1895
|
+
var scheduleRunsResponseSchema = z14.object({
|
|
1896
|
+
runs: z14.array(runSummarySchema)
|
|
1897
|
+
});
|
|
1898
|
+
var scheduleListResponseSchema = z14.object({
|
|
1899
|
+
schedules: z14.array(scheduleResponseSchema)
|
|
1900
|
+
});
|
|
1901
|
+
var deployScheduleResponseSchema = z14.object({
|
|
1807
1902
|
schedule: scheduleResponseSchema,
|
|
1808
|
-
created:
|
|
1903
|
+
created: z14.boolean()
|
|
1809
1904
|
// true if created, false if updated
|
|
1810
1905
|
});
|
|
1811
|
-
var schedulesMainContract =
|
|
1906
|
+
var schedulesMainContract = c12.router({
|
|
1812
1907
|
/**
|
|
1813
1908
|
* POST /api/agent/schedules
|
|
1814
1909
|
* Deploy (create or update) a schedule
|
|
@@ -1844,7 +1939,7 @@ var schedulesMainContract = c11.router({
|
|
|
1844
1939
|
summary: "List all schedules"
|
|
1845
1940
|
}
|
|
1846
1941
|
});
|
|
1847
|
-
var schedulesByNameContract =
|
|
1942
|
+
var schedulesByNameContract = c12.router({
|
|
1848
1943
|
/**
|
|
1849
1944
|
* GET /api/agent/schedules/:name
|
|
1850
1945
|
* Get schedule by name
|
|
@@ -1852,11 +1947,11 @@ var schedulesByNameContract = c11.router({
|
|
|
1852
1947
|
getByName: {
|
|
1853
1948
|
method: "GET",
|
|
1854
1949
|
path: "/api/agent/schedules/:name",
|
|
1855
|
-
pathParams:
|
|
1856
|
-
name:
|
|
1950
|
+
pathParams: z14.object({
|
|
1951
|
+
name: z14.string().min(1, "Schedule name required")
|
|
1857
1952
|
}),
|
|
1858
|
-
query:
|
|
1859
|
-
composeId:
|
|
1953
|
+
query: z14.object({
|
|
1954
|
+
composeId: z14.string().uuid("Compose ID required")
|
|
1860
1955
|
}),
|
|
1861
1956
|
responses: {
|
|
1862
1957
|
200: scheduleResponseSchema,
|
|
@@ -1872,21 +1967,21 @@ var schedulesByNameContract = c11.router({
|
|
|
1872
1967
|
delete: {
|
|
1873
1968
|
method: "DELETE",
|
|
1874
1969
|
path: "/api/agent/schedules/:name",
|
|
1875
|
-
pathParams:
|
|
1876
|
-
name:
|
|
1970
|
+
pathParams: z14.object({
|
|
1971
|
+
name: z14.string().min(1, "Schedule name required")
|
|
1877
1972
|
}),
|
|
1878
|
-
query:
|
|
1879
|
-
composeId:
|
|
1973
|
+
query: z14.object({
|
|
1974
|
+
composeId: z14.string().uuid("Compose ID required")
|
|
1880
1975
|
}),
|
|
1881
1976
|
responses: {
|
|
1882
|
-
204:
|
|
1977
|
+
204: z14.undefined(),
|
|
1883
1978
|
401: apiErrorSchema,
|
|
1884
1979
|
404: apiErrorSchema
|
|
1885
1980
|
},
|
|
1886
1981
|
summary: "Delete schedule"
|
|
1887
1982
|
}
|
|
1888
1983
|
});
|
|
1889
|
-
var schedulesEnableContract =
|
|
1984
|
+
var schedulesEnableContract = c12.router({
|
|
1890
1985
|
/**
|
|
1891
1986
|
* POST /api/agent/schedules/:name/enable
|
|
1892
1987
|
* Enable a disabled schedule
|
|
@@ -1894,11 +1989,11 @@ var schedulesEnableContract = c11.router({
|
|
|
1894
1989
|
enable: {
|
|
1895
1990
|
method: "POST",
|
|
1896
1991
|
path: "/api/agent/schedules/:name/enable",
|
|
1897
|
-
pathParams:
|
|
1898
|
-
name:
|
|
1992
|
+
pathParams: z14.object({
|
|
1993
|
+
name: z14.string().min(1, "Schedule name required")
|
|
1899
1994
|
}),
|
|
1900
|
-
body:
|
|
1901
|
-
composeId:
|
|
1995
|
+
body: z14.object({
|
|
1996
|
+
composeId: z14.string().uuid("Compose ID required")
|
|
1902
1997
|
}),
|
|
1903
1998
|
responses: {
|
|
1904
1999
|
200: scheduleResponseSchema,
|
|
@@ -1914,11 +2009,11 @@ var schedulesEnableContract = c11.router({
|
|
|
1914
2009
|
disable: {
|
|
1915
2010
|
method: "POST",
|
|
1916
2011
|
path: "/api/agent/schedules/:name/disable",
|
|
1917
|
-
pathParams:
|
|
1918
|
-
name:
|
|
2012
|
+
pathParams: z14.object({
|
|
2013
|
+
name: z14.string().min(1, "Schedule name required")
|
|
1919
2014
|
}),
|
|
1920
|
-
body:
|
|
1921
|
-
composeId:
|
|
2015
|
+
body: z14.object({
|
|
2016
|
+
composeId: z14.string().uuid("Compose ID required")
|
|
1922
2017
|
}),
|
|
1923
2018
|
responses: {
|
|
1924
2019
|
200: scheduleResponseSchema,
|
|
@@ -1928,7 +2023,7 @@ var schedulesEnableContract = c11.router({
|
|
|
1928
2023
|
summary: "Disable schedule"
|
|
1929
2024
|
}
|
|
1930
2025
|
});
|
|
1931
|
-
var scheduleRunsContract =
|
|
2026
|
+
var scheduleRunsContract = c12.router({
|
|
1932
2027
|
/**
|
|
1933
2028
|
* GET /api/agent/schedules/:name/runs
|
|
1934
2029
|
* List recent runs for a schedule
|
|
@@ -1936,12 +2031,12 @@ var scheduleRunsContract = c11.router({
|
|
|
1936
2031
|
listRuns: {
|
|
1937
2032
|
method: "GET",
|
|
1938
2033
|
path: "/api/agent/schedules/:name/runs",
|
|
1939
|
-
pathParams:
|
|
1940
|
-
name:
|
|
2034
|
+
pathParams: z14.object({
|
|
2035
|
+
name: z14.string().min(1, "Schedule name required")
|
|
1941
2036
|
}),
|
|
1942
|
-
query:
|
|
1943
|
-
composeId:
|
|
1944
|
-
limit:
|
|
2037
|
+
query: z14.object({
|
|
2038
|
+
composeId: z14.string().uuid("Compose ID required"),
|
|
2039
|
+
limit: z14.coerce.number().min(0).max(100).default(5)
|
|
1945
2040
|
}),
|
|
1946
2041
|
responses: {
|
|
1947
2042
|
200: scheduleRunsResponseSchema,
|
|
@@ -1953,8 +2048,8 @@ var scheduleRunsContract = c11.router({
|
|
|
1953
2048
|
});
|
|
1954
2049
|
|
|
1955
2050
|
// ../../packages/core/src/contracts/public/common.ts
|
|
1956
|
-
import { z as
|
|
1957
|
-
var publicApiErrorTypeSchema =
|
|
2051
|
+
import { z as z15 } from "zod";
|
|
2052
|
+
var publicApiErrorTypeSchema = z15.enum([
|
|
1958
2053
|
"api_error",
|
|
1959
2054
|
// Internal server error (5xx)
|
|
1960
2055
|
"invalid_request_error",
|
|
@@ -1966,55 +2061,55 @@ var publicApiErrorTypeSchema = z14.enum([
|
|
|
1966
2061
|
"conflict_error"
|
|
1967
2062
|
// Resource conflict (409)
|
|
1968
2063
|
]);
|
|
1969
|
-
var publicApiErrorSchema =
|
|
1970
|
-
error:
|
|
2064
|
+
var publicApiErrorSchema = z15.object({
|
|
2065
|
+
error: z15.object({
|
|
1971
2066
|
type: publicApiErrorTypeSchema,
|
|
1972
|
-
code:
|
|
1973
|
-
message:
|
|
1974
|
-
param:
|
|
1975
|
-
doc_url:
|
|
2067
|
+
code: z15.string(),
|
|
2068
|
+
message: z15.string(),
|
|
2069
|
+
param: z15.string().optional(),
|
|
2070
|
+
doc_url: z15.string().url().optional()
|
|
1976
2071
|
})
|
|
1977
2072
|
});
|
|
1978
|
-
var paginationSchema =
|
|
1979
|
-
has_more:
|
|
1980
|
-
next_cursor:
|
|
2073
|
+
var paginationSchema = z15.object({
|
|
2074
|
+
has_more: z15.boolean(),
|
|
2075
|
+
next_cursor: z15.string().nullable()
|
|
1981
2076
|
});
|
|
1982
2077
|
function createPaginatedResponseSchema(dataSchema) {
|
|
1983
|
-
return
|
|
1984
|
-
data:
|
|
2078
|
+
return z15.object({
|
|
2079
|
+
data: z15.array(dataSchema),
|
|
1985
2080
|
pagination: paginationSchema
|
|
1986
2081
|
});
|
|
1987
2082
|
}
|
|
1988
|
-
var listQuerySchema =
|
|
1989
|
-
cursor:
|
|
1990
|
-
limit:
|
|
2083
|
+
var listQuerySchema = z15.object({
|
|
2084
|
+
cursor: z15.string().optional(),
|
|
2085
|
+
limit: z15.coerce.number().min(1).max(100).default(20)
|
|
1991
2086
|
});
|
|
1992
|
-
var requestIdSchema =
|
|
1993
|
-
var timestampSchema =
|
|
2087
|
+
var requestIdSchema = z15.string().uuid();
|
|
2088
|
+
var timestampSchema = z15.string().datetime();
|
|
1994
2089
|
|
|
1995
2090
|
// ../../packages/core/src/contracts/public/agents.ts
|
|
1996
|
-
import { z as
|
|
1997
|
-
var
|
|
1998
|
-
var publicAgentSchema =
|
|
1999
|
-
id:
|
|
2000
|
-
name:
|
|
2001
|
-
current_version_id:
|
|
2091
|
+
import { z as z16 } from "zod";
|
|
2092
|
+
var c13 = initContract();
|
|
2093
|
+
var publicAgentSchema = z16.object({
|
|
2094
|
+
id: z16.string(),
|
|
2095
|
+
name: z16.string(),
|
|
2096
|
+
current_version_id: z16.string().nullable(),
|
|
2002
2097
|
created_at: timestampSchema,
|
|
2003
2098
|
updated_at: timestampSchema
|
|
2004
2099
|
});
|
|
2005
|
-
var agentVersionSchema =
|
|
2006
|
-
id:
|
|
2007
|
-
agent_id:
|
|
2008
|
-
version_number:
|
|
2100
|
+
var agentVersionSchema = z16.object({
|
|
2101
|
+
id: z16.string(),
|
|
2102
|
+
agent_id: z16.string(),
|
|
2103
|
+
version_number: z16.number(),
|
|
2009
2104
|
created_at: timestampSchema
|
|
2010
2105
|
});
|
|
2011
2106
|
var publicAgentDetailSchema = publicAgentSchema;
|
|
2012
2107
|
var paginatedAgentsSchema = createPaginatedResponseSchema(publicAgentSchema);
|
|
2013
2108
|
var paginatedAgentVersionsSchema = createPaginatedResponseSchema(agentVersionSchema);
|
|
2014
2109
|
var agentListQuerySchema = listQuerySchema.extend({
|
|
2015
|
-
name:
|
|
2110
|
+
name: z16.string().optional()
|
|
2016
2111
|
});
|
|
2017
|
-
var publicAgentsListContract =
|
|
2112
|
+
var publicAgentsListContract = c13.router({
|
|
2018
2113
|
list: {
|
|
2019
2114
|
method: "GET",
|
|
2020
2115
|
path: "/v1/agents",
|
|
@@ -2028,12 +2123,12 @@ var publicAgentsListContract = c12.router({
|
|
|
2028
2123
|
description: "List all agents in the current scope with pagination. Use the `name` query parameter to filter by agent name."
|
|
2029
2124
|
}
|
|
2030
2125
|
});
|
|
2031
|
-
var publicAgentByIdContract =
|
|
2126
|
+
var publicAgentByIdContract = c13.router({
|
|
2032
2127
|
get: {
|
|
2033
2128
|
method: "GET",
|
|
2034
2129
|
path: "/v1/agents/:id",
|
|
2035
|
-
pathParams:
|
|
2036
|
-
id:
|
|
2130
|
+
pathParams: z16.object({
|
|
2131
|
+
id: z16.string().min(1, "Agent ID is required")
|
|
2037
2132
|
}),
|
|
2038
2133
|
responses: {
|
|
2039
2134
|
200: publicAgentDetailSchema,
|
|
@@ -2045,12 +2140,12 @@ var publicAgentByIdContract = c12.router({
|
|
|
2045
2140
|
description: "Get agent details by ID"
|
|
2046
2141
|
}
|
|
2047
2142
|
});
|
|
2048
|
-
var publicAgentVersionsContract =
|
|
2143
|
+
var publicAgentVersionsContract = c13.router({
|
|
2049
2144
|
list: {
|
|
2050
2145
|
method: "GET",
|
|
2051
2146
|
path: "/v1/agents/:id/versions",
|
|
2052
|
-
pathParams:
|
|
2053
|
-
id:
|
|
2147
|
+
pathParams: z16.object({
|
|
2148
|
+
id: z16.string().min(1, "Agent ID is required")
|
|
2054
2149
|
}),
|
|
2055
2150
|
query: listQuerySchema,
|
|
2056
2151
|
responses: {
|
|
@@ -2065,9 +2160,9 @@ var publicAgentVersionsContract = c12.router({
|
|
|
2065
2160
|
});
|
|
2066
2161
|
|
|
2067
2162
|
// ../../packages/core/src/contracts/public/runs.ts
|
|
2068
|
-
import { z as
|
|
2069
|
-
var
|
|
2070
|
-
var publicRunStatusSchema =
|
|
2163
|
+
import { z as z17 } from "zod";
|
|
2164
|
+
var c14 = initContract();
|
|
2165
|
+
var publicRunStatusSchema = z17.enum([
|
|
2071
2166
|
"pending",
|
|
2072
2167
|
"running",
|
|
2073
2168
|
"completed",
|
|
@@ -2075,56 +2170,56 @@ var publicRunStatusSchema = z16.enum([
|
|
|
2075
2170
|
"timeout",
|
|
2076
2171
|
"cancelled"
|
|
2077
2172
|
]);
|
|
2078
|
-
var publicRunSchema =
|
|
2079
|
-
id:
|
|
2080
|
-
agent_id:
|
|
2081
|
-
agent_name:
|
|
2173
|
+
var publicRunSchema = z17.object({
|
|
2174
|
+
id: z17.string(),
|
|
2175
|
+
agent_id: z17.string(),
|
|
2176
|
+
agent_name: z17.string(),
|
|
2082
2177
|
status: publicRunStatusSchema,
|
|
2083
|
-
prompt:
|
|
2178
|
+
prompt: z17.string(),
|
|
2084
2179
|
created_at: timestampSchema,
|
|
2085
2180
|
started_at: timestampSchema.nullable(),
|
|
2086
2181
|
completed_at: timestampSchema.nullable()
|
|
2087
2182
|
});
|
|
2088
2183
|
var publicRunDetailSchema = publicRunSchema.extend({
|
|
2089
|
-
error:
|
|
2090
|
-
execution_time_ms:
|
|
2091
|
-
checkpoint_id:
|
|
2092
|
-
session_id:
|
|
2093
|
-
artifact_name:
|
|
2094
|
-
artifact_version:
|
|
2095
|
-
volumes:
|
|
2184
|
+
error: z17.string().nullable(),
|
|
2185
|
+
execution_time_ms: z17.number().nullable(),
|
|
2186
|
+
checkpoint_id: z17.string().nullable(),
|
|
2187
|
+
session_id: z17.string().nullable(),
|
|
2188
|
+
artifact_name: z17.string().nullable(),
|
|
2189
|
+
artifact_version: z17.string().nullable(),
|
|
2190
|
+
volumes: z17.record(z17.string(), z17.string()).optional()
|
|
2096
2191
|
});
|
|
2097
2192
|
var paginatedRunsSchema = createPaginatedResponseSchema(publicRunSchema);
|
|
2098
|
-
var createRunRequestSchema =
|
|
2193
|
+
var createRunRequestSchema = z17.object({
|
|
2099
2194
|
// Agent identification (one of: agent, agent_id, session_id, checkpoint_id)
|
|
2100
|
-
agent:
|
|
2195
|
+
agent: z17.string().optional(),
|
|
2101
2196
|
// Agent name
|
|
2102
|
-
agent_id:
|
|
2197
|
+
agent_id: z17.string().optional(),
|
|
2103
2198
|
// Agent ID
|
|
2104
|
-
agent_version:
|
|
2199
|
+
agent_version: z17.string().optional(),
|
|
2105
2200
|
// Version specifier (e.g., "latest", "v1", specific ID)
|
|
2106
2201
|
// Continue session
|
|
2107
|
-
session_id:
|
|
2202
|
+
session_id: z17.string().optional(),
|
|
2108
2203
|
// Resume from checkpoint
|
|
2109
|
-
checkpoint_id:
|
|
2204
|
+
checkpoint_id: z17.string().optional(),
|
|
2110
2205
|
// Required
|
|
2111
|
-
prompt:
|
|
2206
|
+
prompt: z17.string().min(1, "Prompt is required"),
|
|
2112
2207
|
// Optional configuration
|
|
2113
|
-
variables:
|
|
2114
|
-
secrets:
|
|
2115
|
-
artifact_name:
|
|
2208
|
+
variables: z17.record(z17.string(), z17.string()).optional(),
|
|
2209
|
+
secrets: z17.record(z17.string(), z17.string()).optional(),
|
|
2210
|
+
artifact_name: z17.string().optional(),
|
|
2116
2211
|
// Artifact name to mount
|
|
2117
|
-
artifact_version:
|
|
2212
|
+
artifact_version: z17.string().optional(),
|
|
2118
2213
|
// Artifact version (defaults to latest)
|
|
2119
|
-
volumes:
|
|
2214
|
+
volumes: z17.record(z17.string(), z17.string()).optional()
|
|
2120
2215
|
// volume_name -> version
|
|
2121
2216
|
});
|
|
2122
2217
|
var runListQuerySchema = listQuerySchema.extend({
|
|
2123
|
-
agent_id:
|
|
2218
|
+
agent_id: z17.string().optional(),
|
|
2124
2219
|
status: publicRunStatusSchema.optional(),
|
|
2125
2220
|
since: timestampSchema.optional()
|
|
2126
2221
|
});
|
|
2127
|
-
var publicRunsListContract =
|
|
2222
|
+
var publicRunsListContract = c14.router({
|
|
2128
2223
|
list: {
|
|
2129
2224
|
method: "GET",
|
|
2130
2225
|
path: "/v1/runs",
|
|
@@ -2153,12 +2248,12 @@ var publicRunsListContract = c13.router({
|
|
|
2153
2248
|
description: "Create and execute a new agent run. Returns 202 Accepted as runs execute asynchronously."
|
|
2154
2249
|
}
|
|
2155
2250
|
});
|
|
2156
|
-
var publicRunByIdContract =
|
|
2251
|
+
var publicRunByIdContract = c14.router({
|
|
2157
2252
|
get: {
|
|
2158
2253
|
method: "GET",
|
|
2159
2254
|
path: "/v1/runs/:id",
|
|
2160
|
-
pathParams:
|
|
2161
|
-
id:
|
|
2255
|
+
pathParams: z17.object({
|
|
2256
|
+
id: z17.string().min(1, "Run ID is required")
|
|
2162
2257
|
}),
|
|
2163
2258
|
responses: {
|
|
2164
2259
|
200: publicRunDetailSchema,
|
|
@@ -2170,14 +2265,14 @@ var publicRunByIdContract = c13.router({
|
|
|
2170
2265
|
description: "Get run details by ID"
|
|
2171
2266
|
}
|
|
2172
2267
|
});
|
|
2173
|
-
var publicRunCancelContract =
|
|
2268
|
+
var publicRunCancelContract = c14.router({
|
|
2174
2269
|
cancel: {
|
|
2175
2270
|
method: "POST",
|
|
2176
2271
|
path: "/v1/runs/:id/cancel",
|
|
2177
|
-
pathParams:
|
|
2178
|
-
id:
|
|
2272
|
+
pathParams: z17.object({
|
|
2273
|
+
id: z17.string().min(1, "Run ID is required")
|
|
2179
2274
|
}),
|
|
2180
|
-
body:
|
|
2275
|
+
body: z17.undefined(),
|
|
2181
2276
|
responses: {
|
|
2182
2277
|
200: publicRunDetailSchema,
|
|
2183
2278
|
400: publicApiErrorSchema,
|
|
@@ -2190,26 +2285,26 @@ var publicRunCancelContract = c13.router({
|
|
|
2190
2285
|
description: "Cancel a pending or running execution"
|
|
2191
2286
|
}
|
|
2192
2287
|
});
|
|
2193
|
-
var logEntrySchema =
|
|
2288
|
+
var logEntrySchema = z17.object({
|
|
2194
2289
|
timestamp: timestampSchema,
|
|
2195
|
-
type:
|
|
2196
|
-
level:
|
|
2197
|
-
message:
|
|
2198
|
-
metadata:
|
|
2290
|
+
type: z17.enum(["agent", "system", "network"]),
|
|
2291
|
+
level: z17.enum(["debug", "info", "warn", "error"]),
|
|
2292
|
+
message: z17.string(),
|
|
2293
|
+
metadata: z17.record(z17.string(), z17.unknown()).optional()
|
|
2199
2294
|
});
|
|
2200
2295
|
var paginatedLogsSchema = createPaginatedResponseSchema(logEntrySchema);
|
|
2201
2296
|
var logsQuerySchema = listQuerySchema.extend({
|
|
2202
|
-
type:
|
|
2297
|
+
type: z17.enum(["agent", "system", "network", "all"]).default("all"),
|
|
2203
2298
|
since: timestampSchema.optional(),
|
|
2204
2299
|
until: timestampSchema.optional(),
|
|
2205
|
-
order:
|
|
2300
|
+
order: z17.enum(["asc", "desc"]).default("asc")
|
|
2206
2301
|
});
|
|
2207
|
-
var publicRunLogsContract =
|
|
2302
|
+
var publicRunLogsContract = c14.router({
|
|
2208
2303
|
getLogs: {
|
|
2209
2304
|
method: "GET",
|
|
2210
2305
|
path: "/v1/runs/:id/logs",
|
|
2211
|
-
pathParams:
|
|
2212
|
-
id:
|
|
2306
|
+
pathParams: z17.object({
|
|
2307
|
+
id: z17.string().min(1, "Run ID is required")
|
|
2213
2308
|
}),
|
|
2214
2309
|
query: logsQuerySchema,
|
|
2215
2310
|
responses: {
|
|
@@ -2222,29 +2317,29 @@ var publicRunLogsContract = c13.router({
|
|
|
2222
2317
|
description: "Get unified logs for a run. Combines agent, system, and network logs."
|
|
2223
2318
|
}
|
|
2224
2319
|
});
|
|
2225
|
-
var metricPointSchema =
|
|
2320
|
+
var metricPointSchema = z17.object({
|
|
2226
2321
|
timestamp: timestampSchema,
|
|
2227
|
-
cpu_percent:
|
|
2228
|
-
memory_used_mb:
|
|
2229
|
-
memory_total_mb:
|
|
2230
|
-
disk_used_mb:
|
|
2231
|
-
disk_total_mb:
|
|
2232
|
-
});
|
|
2233
|
-
var metricsSummarySchema =
|
|
2234
|
-
avg_cpu_percent:
|
|
2235
|
-
max_memory_used_mb:
|
|
2236
|
-
total_duration_ms:
|
|
2237
|
-
});
|
|
2238
|
-
var metricsResponseSchema2 =
|
|
2239
|
-
data:
|
|
2322
|
+
cpu_percent: z17.number(),
|
|
2323
|
+
memory_used_mb: z17.number(),
|
|
2324
|
+
memory_total_mb: z17.number(),
|
|
2325
|
+
disk_used_mb: z17.number(),
|
|
2326
|
+
disk_total_mb: z17.number()
|
|
2327
|
+
});
|
|
2328
|
+
var metricsSummarySchema = z17.object({
|
|
2329
|
+
avg_cpu_percent: z17.number(),
|
|
2330
|
+
max_memory_used_mb: z17.number(),
|
|
2331
|
+
total_duration_ms: z17.number().nullable()
|
|
2332
|
+
});
|
|
2333
|
+
var metricsResponseSchema2 = z17.object({
|
|
2334
|
+
data: z17.array(metricPointSchema),
|
|
2240
2335
|
summary: metricsSummarySchema
|
|
2241
2336
|
});
|
|
2242
|
-
var publicRunMetricsContract =
|
|
2337
|
+
var publicRunMetricsContract = c14.router({
|
|
2243
2338
|
getMetrics: {
|
|
2244
2339
|
method: "GET",
|
|
2245
2340
|
path: "/v1/runs/:id/metrics",
|
|
2246
|
-
pathParams:
|
|
2247
|
-
id:
|
|
2341
|
+
pathParams: z17.object({
|
|
2342
|
+
id: z17.string().min(1, "Run ID is required")
|
|
2248
2343
|
}),
|
|
2249
2344
|
responses: {
|
|
2250
2345
|
200: metricsResponseSchema2,
|
|
@@ -2256,7 +2351,7 @@ var publicRunMetricsContract = c13.router({
|
|
|
2256
2351
|
description: "Get CPU, memory, and disk metrics for a run"
|
|
2257
2352
|
}
|
|
2258
2353
|
});
|
|
2259
|
-
var sseEventTypeSchema =
|
|
2354
|
+
var sseEventTypeSchema = z17.enum([
|
|
2260
2355
|
"status",
|
|
2261
2356
|
// Run status change
|
|
2262
2357
|
"output",
|
|
@@ -2268,25 +2363,25 @@ var sseEventTypeSchema = z16.enum([
|
|
|
2268
2363
|
"heartbeat"
|
|
2269
2364
|
// Keep-alive
|
|
2270
2365
|
]);
|
|
2271
|
-
var sseEventSchema =
|
|
2366
|
+
var sseEventSchema = z17.object({
|
|
2272
2367
|
event: sseEventTypeSchema,
|
|
2273
|
-
data:
|
|
2274
|
-
id:
|
|
2368
|
+
data: z17.unknown(),
|
|
2369
|
+
id: z17.string().optional()
|
|
2275
2370
|
// For Last-Event-ID reconnection
|
|
2276
2371
|
});
|
|
2277
|
-
var publicRunEventsContract =
|
|
2372
|
+
var publicRunEventsContract = c14.router({
|
|
2278
2373
|
streamEvents: {
|
|
2279
2374
|
method: "GET",
|
|
2280
2375
|
path: "/v1/runs/:id/events",
|
|
2281
|
-
pathParams:
|
|
2282
|
-
id:
|
|
2376
|
+
pathParams: z17.object({
|
|
2377
|
+
id: z17.string().min(1, "Run ID is required")
|
|
2283
2378
|
}),
|
|
2284
|
-
query:
|
|
2285
|
-
last_event_id:
|
|
2379
|
+
query: z17.object({
|
|
2380
|
+
last_event_id: z17.string().optional()
|
|
2286
2381
|
// For reconnection
|
|
2287
2382
|
}),
|
|
2288
2383
|
responses: {
|
|
2289
|
-
200:
|
|
2384
|
+
200: z17.any(),
|
|
2290
2385
|
// SSE stream - actual content is text/event-stream
|
|
2291
2386
|
401: publicApiErrorSchema,
|
|
2292
2387
|
404: publicApiErrorSchema,
|
|
@@ -2298,28 +2393,28 @@ var publicRunEventsContract = c13.router({
|
|
|
2298
2393
|
});
|
|
2299
2394
|
|
|
2300
2395
|
// ../../packages/core/src/contracts/public/artifacts.ts
|
|
2301
|
-
import { z as
|
|
2302
|
-
var
|
|
2303
|
-
var publicArtifactSchema =
|
|
2304
|
-
id:
|
|
2305
|
-
name:
|
|
2306
|
-
current_version_id:
|
|
2307
|
-
size:
|
|
2396
|
+
import { z as z18 } from "zod";
|
|
2397
|
+
var c15 = initContract();
|
|
2398
|
+
var publicArtifactSchema = z18.object({
|
|
2399
|
+
id: z18.string(),
|
|
2400
|
+
name: z18.string(),
|
|
2401
|
+
current_version_id: z18.string().nullable(),
|
|
2402
|
+
size: z18.number(),
|
|
2308
2403
|
// Total size in bytes
|
|
2309
|
-
file_count:
|
|
2404
|
+
file_count: z18.number(),
|
|
2310
2405
|
created_at: timestampSchema,
|
|
2311
2406
|
updated_at: timestampSchema
|
|
2312
2407
|
});
|
|
2313
|
-
var artifactVersionSchema =
|
|
2314
|
-
id:
|
|
2408
|
+
var artifactVersionSchema = z18.object({
|
|
2409
|
+
id: z18.string(),
|
|
2315
2410
|
// SHA-256 content hash
|
|
2316
|
-
artifact_id:
|
|
2317
|
-
size:
|
|
2411
|
+
artifact_id: z18.string(),
|
|
2412
|
+
size: z18.number(),
|
|
2318
2413
|
// Size in bytes
|
|
2319
|
-
file_count:
|
|
2320
|
-
message:
|
|
2414
|
+
file_count: z18.number(),
|
|
2415
|
+
message: z18.string().nullable(),
|
|
2321
2416
|
// Optional commit message
|
|
2322
|
-
created_by:
|
|
2417
|
+
created_by: z18.string(),
|
|
2323
2418
|
created_at: timestampSchema
|
|
2324
2419
|
});
|
|
2325
2420
|
var publicArtifactDetailSchema = publicArtifactSchema.extend({
|
|
@@ -2329,7 +2424,7 @@ var paginatedArtifactsSchema = createPaginatedResponseSchema(publicArtifactSchem
|
|
|
2329
2424
|
var paginatedArtifactVersionsSchema = createPaginatedResponseSchema(
|
|
2330
2425
|
artifactVersionSchema
|
|
2331
2426
|
);
|
|
2332
|
-
var publicArtifactsListContract =
|
|
2427
|
+
var publicArtifactsListContract = c15.router({
|
|
2333
2428
|
list: {
|
|
2334
2429
|
method: "GET",
|
|
2335
2430
|
path: "/v1/artifacts",
|
|
@@ -2343,12 +2438,12 @@ var publicArtifactsListContract = c14.router({
|
|
|
2343
2438
|
description: "List all artifacts in the current scope with pagination"
|
|
2344
2439
|
}
|
|
2345
2440
|
});
|
|
2346
|
-
var publicArtifactByIdContract =
|
|
2441
|
+
var publicArtifactByIdContract = c15.router({
|
|
2347
2442
|
get: {
|
|
2348
2443
|
method: "GET",
|
|
2349
2444
|
path: "/v1/artifacts/:id",
|
|
2350
|
-
pathParams:
|
|
2351
|
-
id:
|
|
2445
|
+
pathParams: z18.object({
|
|
2446
|
+
id: z18.string().min(1, "Artifact ID is required")
|
|
2352
2447
|
}),
|
|
2353
2448
|
responses: {
|
|
2354
2449
|
200: publicArtifactDetailSchema,
|
|
@@ -2360,12 +2455,12 @@ var publicArtifactByIdContract = c14.router({
|
|
|
2360
2455
|
description: "Get artifact details by ID"
|
|
2361
2456
|
}
|
|
2362
2457
|
});
|
|
2363
|
-
var publicArtifactVersionsContract =
|
|
2458
|
+
var publicArtifactVersionsContract = c15.router({
|
|
2364
2459
|
list: {
|
|
2365
2460
|
method: "GET",
|
|
2366
2461
|
path: "/v1/artifacts/:id/versions",
|
|
2367
|
-
pathParams:
|
|
2368
|
-
id:
|
|
2462
|
+
pathParams: z18.object({
|
|
2463
|
+
id: z18.string().min(1, "Artifact ID is required")
|
|
2369
2464
|
}),
|
|
2370
2465
|
query: listQuerySchema,
|
|
2371
2466
|
responses: {
|
|
@@ -2378,19 +2473,19 @@ var publicArtifactVersionsContract = c14.router({
|
|
|
2378
2473
|
description: "List all versions of an artifact with pagination"
|
|
2379
2474
|
}
|
|
2380
2475
|
});
|
|
2381
|
-
var publicArtifactDownloadContract =
|
|
2476
|
+
var publicArtifactDownloadContract = c15.router({
|
|
2382
2477
|
download: {
|
|
2383
2478
|
method: "GET",
|
|
2384
2479
|
path: "/v1/artifacts/:id/download",
|
|
2385
|
-
pathParams:
|
|
2386
|
-
id:
|
|
2480
|
+
pathParams: z18.object({
|
|
2481
|
+
id: z18.string().min(1, "Artifact ID is required")
|
|
2387
2482
|
}),
|
|
2388
|
-
query:
|
|
2389
|
-
version_id:
|
|
2483
|
+
query: z18.object({
|
|
2484
|
+
version_id: z18.string().optional()
|
|
2390
2485
|
// Defaults to current version
|
|
2391
2486
|
}),
|
|
2392
2487
|
responses: {
|
|
2393
|
-
302:
|
|
2488
|
+
302: z18.undefined(),
|
|
2394
2489
|
// Redirect to presigned URL
|
|
2395
2490
|
401: publicApiErrorSchema,
|
|
2396
2491
|
404: publicApiErrorSchema,
|
|
@@ -2402,28 +2497,28 @@ var publicArtifactDownloadContract = c14.router({
|
|
|
2402
2497
|
});
|
|
2403
2498
|
|
|
2404
2499
|
// ../../packages/core/src/contracts/public/volumes.ts
|
|
2405
|
-
import { z as
|
|
2406
|
-
var
|
|
2407
|
-
var publicVolumeSchema =
|
|
2408
|
-
id:
|
|
2409
|
-
name:
|
|
2410
|
-
current_version_id:
|
|
2411
|
-
size:
|
|
2500
|
+
import { z as z19 } from "zod";
|
|
2501
|
+
var c16 = initContract();
|
|
2502
|
+
var publicVolumeSchema = z19.object({
|
|
2503
|
+
id: z19.string(),
|
|
2504
|
+
name: z19.string(),
|
|
2505
|
+
current_version_id: z19.string().nullable(),
|
|
2506
|
+
size: z19.number(),
|
|
2412
2507
|
// Total size in bytes
|
|
2413
|
-
file_count:
|
|
2508
|
+
file_count: z19.number(),
|
|
2414
2509
|
created_at: timestampSchema,
|
|
2415
2510
|
updated_at: timestampSchema
|
|
2416
2511
|
});
|
|
2417
|
-
var volumeVersionSchema =
|
|
2418
|
-
id:
|
|
2512
|
+
var volumeVersionSchema = z19.object({
|
|
2513
|
+
id: z19.string(),
|
|
2419
2514
|
// SHA-256 content hash
|
|
2420
|
-
volume_id:
|
|
2421
|
-
size:
|
|
2515
|
+
volume_id: z19.string(),
|
|
2516
|
+
size: z19.number(),
|
|
2422
2517
|
// Size in bytes
|
|
2423
|
-
file_count:
|
|
2424
|
-
message:
|
|
2518
|
+
file_count: z19.number(),
|
|
2519
|
+
message: z19.string().nullable(),
|
|
2425
2520
|
// Optional commit message
|
|
2426
|
-
created_by:
|
|
2521
|
+
created_by: z19.string(),
|
|
2427
2522
|
created_at: timestampSchema
|
|
2428
2523
|
});
|
|
2429
2524
|
var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
@@ -2431,7 +2526,7 @@ var publicVolumeDetailSchema = publicVolumeSchema.extend({
|
|
|
2431
2526
|
});
|
|
2432
2527
|
var paginatedVolumesSchema = createPaginatedResponseSchema(publicVolumeSchema);
|
|
2433
2528
|
var paginatedVolumeVersionsSchema = createPaginatedResponseSchema(volumeVersionSchema);
|
|
2434
|
-
var publicVolumesListContract =
|
|
2529
|
+
var publicVolumesListContract = c16.router({
|
|
2435
2530
|
list: {
|
|
2436
2531
|
method: "GET",
|
|
2437
2532
|
path: "/v1/volumes",
|
|
@@ -2445,12 +2540,12 @@ var publicVolumesListContract = c15.router({
|
|
|
2445
2540
|
description: "List all volumes in the current scope with pagination"
|
|
2446
2541
|
}
|
|
2447
2542
|
});
|
|
2448
|
-
var publicVolumeByIdContract =
|
|
2543
|
+
var publicVolumeByIdContract = c16.router({
|
|
2449
2544
|
get: {
|
|
2450
2545
|
method: "GET",
|
|
2451
2546
|
path: "/v1/volumes/:id",
|
|
2452
|
-
pathParams:
|
|
2453
|
-
id:
|
|
2547
|
+
pathParams: z19.object({
|
|
2548
|
+
id: z19.string().min(1, "Volume ID is required")
|
|
2454
2549
|
}),
|
|
2455
2550
|
responses: {
|
|
2456
2551
|
200: publicVolumeDetailSchema,
|
|
@@ -2462,12 +2557,12 @@ var publicVolumeByIdContract = c15.router({
|
|
|
2462
2557
|
description: "Get volume details by ID"
|
|
2463
2558
|
}
|
|
2464
2559
|
});
|
|
2465
|
-
var publicVolumeVersionsContract =
|
|
2560
|
+
var publicVolumeVersionsContract = c16.router({
|
|
2466
2561
|
list: {
|
|
2467
2562
|
method: "GET",
|
|
2468
2563
|
path: "/v1/volumes/:id/versions",
|
|
2469
|
-
pathParams:
|
|
2470
|
-
id:
|
|
2564
|
+
pathParams: z19.object({
|
|
2565
|
+
id: z19.string().min(1, "Volume ID is required")
|
|
2471
2566
|
}),
|
|
2472
2567
|
query: listQuerySchema,
|
|
2473
2568
|
responses: {
|
|
@@ -2480,19 +2575,19 @@ var publicVolumeVersionsContract = c15.router({
|
|
|
2480
2575
|
description: "List all versions of a volume with pagination"
|
|
2481
2576
|
}
|
|
2482
2577
|
});
|
|
2483
|
-
var publicVolumeDownloadContract =
|
|
2578
|
+
var publicVolumeDownloadContract = c16.router({
|
|
2484
2579
|
download: {
|
|
2485
2580
|
method: "GET",
|
|
2486
2581
|
path: "/v1/volumes/:id/download",
|
|
2487
|
-
pathParams:
|
|
2488
|
-
id:
|
|
2582
|
+
pathParams: z19.object({
|
|
2583
|
+
id: z19.string().min(1, "Volume ID is required")
|
|
2489
2584
|
}),
|
|
2490
|
-
query:
|
|
2491
|
-
version_id:
|
|
2585
|
+
query: z19.object({
|
|
2586
|
+
version_id: z19.string().optional()
|
|
2492
2587
|
// Defaults to current version
|
|
2493
2588
|
}),
|
|
2494
2589
|
responses: {
|
|
2495
|
-
302:
|
|
2590
|
+
302: z19.undefined(),
|
|
2496
2591
|
// Redirect to presigned URL
|
|
2497
2592
|
401: publicApiErrorSchema,
|
|
2498
2593
|
404: publicApiErrorSchema,
|
|
@@ -3292,6 +3387,86 @@ var ApiClient = class {
|
|
|
3292
3387
|
}
|
|
3293
3388
|
return response.json();
|
|
3294
3389
|
}
|
|
3390
|
+
/**
|
|
3391
|
+
* List credentials (metadata only, no values)
|
|
3392
|
+
*/
|
|
3393
|
+
async listCredentials() {
|
|
3394
|
+
const baseUrl = await this.getBaseUrl();
|
|
3395
|
+
const headers = await this.getHeaders();
|
|
3396
|
+
const client = initClient(credentialsMainContract, {
|
|
3397
|
+
baseUrl,
|
|
3398
|
+
baseHeaders: headers,
|
|
3399
|
+
jsonQuery: true
|
|
3400
|
+
});
|
|
3401
|
+
const result = await client.list();
|
|
3402
|
+
if (result.status === 200) {
|
|
3403
|
+
return result.body;
|
|
3404
|
+
}
|
|
3405
|
+
const errorBody = result.body;
|
|
3406
|
+
const message = errorBody.error?.message || "Failed to list credentials";
|
|
3407
|
+
throw new Error(message);
|
|
3408
|
+
}
|
|
3409
|
+
/**
|
|
3410
|
+
* Get credential by name (metadata only, no value)
|
|
3411
|
+
*/
|
|
3412
|
+
async getCredential(name) {
|
|
3413
|
+
const baseUrl = await this.getBaseUrl();
|
|
3414
|
+
const headers = await this.getHeaders();
|
|
3415
|
+
const client = initClient(credentialsByNameContract, {
|
|
3416
|
+
baseUrl,
|
|
3417
|
+
baseHeaders: headers,
|
|
3418
|
+
jsonQuery: true
|
|
3419
|
+
});
|
|
3420
|
+
const result = await client.get({
|
|
3421
|
+
params: { name }
|
|
3422
|
+
});
|
|
3423
|
+
if (result.status === 200) {
|
|
3424
|
+
return result.body;
|
|
3425
|
+
}
|
|
3426
|
+
const errorBody = result.body;
|
|
3427
|
+
const message = errorBody.error?.message || `Credential "${name}" not found`;
|
|
3428
|
+
throw new Error(message);
|
|
3429
|
+
}
|
|
3430
|
+
/**
|
|
3431
|
+
* Set (create or update) a credential
|
|
3432
|
+
*/
|
|
3433
|
+
async setCredential(body) {
|
|
3434
|
+
const baseUrl = await this.getBaseUrl();
|
|
3435
|
+
const headers = await this.getHeaders();
|
|
3436
|
+
const client = initClient(credentialsMainContract, {
|
|
3437
|
+
baseUrl,
|
|
3438
|
+
baseHeaders: headers,
|
|
3439
|
+
jsonQuery: true
|
|
3440
|
+
});
|
|
3441
|
+
const result = await client.set({ body });
|
|
3442
|
+
if (result.status === 200 || result.status === 201) {
|
|
3443
|
+
return result.body;
|
|
3444
|
+
}
|
|
3445
|
+
const errorBody = result.body;
|
|
3446
|
+
const message = errorBody.error?.message || "Failed to set credential";
|
|
3447
|
+
throw new Error(message);
|
|
3448
|
+
}
|
|
3449
|
+
/**
|
|
3450
|
+
* Delete a credential by name
|
|
3451
|
+
*/
|
|
3452
|
+
async deleteCredential(name) {
|
|
3453
|
+
const baseUrl = await this.getBaseUrl();
|
|
3454
|
+
const headers = await this.getHeaders();
|
|
3455
|
+
const client = initClient(credentialsByNameContract, {
|
|
3456
|
+
baseUrl,
|
|
3457
|
+
baseHeaders: headers,
|
|
3458
|
+
jsonQuery: true
|
|
3459
|
+
});
|
|
3460
|
+
const result = await client.delete({
|
|
3461
|
+
params: { name }
|
|
3462
|
+
});
|
|
3463
|
+
if (result.status === 204) {
|
|
3464
|
+
return;
|
|
3465
|
+
}
|
|
3466
|
+
const errorBody = result.body;
|
|
3467
|
+
const message = errorBody.error?.message || `Credential "${name}" not found`;
|
|
3468
|
+
throw new Error(message);
|
|
3469
|
+
}
|
|
3295
3470
|
/**
|
|
3296
3471
|
* Generic GET request
|
|
3297
3472
|
*/
|
|
@@ -3363,7 +3538,7 @@ var ApiClient = class {
|
|
|
3363
3538
|
var apiClient = new ApiClient();
|
|
3364
3539
|
|
|
3365
3540
|
// src/lib/domain/yaml-validator.ts
|
|
3366
|
-
import { z as
|
|
3541
|
+
import { z as z20 } from "zod";
|
|
3367
3542
|
|
|
3368
3543
|
// src/lib/domain/provider-config.ts
|
|
3369
3544
|
var PROVIDER_DEFAULTS = {
|
|
@@ -3430,7 +3605,7 @@ function getDefaultImageWithApps(provider, apps) {
|
|
|
3430
3605
|
}
|
|
3431
3606
|
|
|
3432
3607
|
// src/lib/domain/yaml-validator.ts
|
|
3433
|
-
var cliAgentNameSchema =
|
|
3608
|
+
var cliAgentNameSchema = z20.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
|
|
3434
3609
|
/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
|
|
3435
3610
|
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
3436
3611
|
);
|
|
@@ -3443,14 +3618,14 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
3443
3618
|
const providerSupported = isProviderSupported(agent.provider);
|
|
3444
3619
|
if (!agent.image && !providerSupported) {
|
|
3445
3620
|
ctx.addIssue({
|
|
3446
|
-
code:
|
|
3621
|
+
code: z20.ZodIssueCode.custom,
|
|
3447
3622
|
message: "Missing agent.image (required when provider is not auto-configured)",
|
|
3448
3623
|
path: ["image"]
|
|
3449
3624
|
});
|
|
3450
3625
|
}
|
|
3451
3626
|
if (!agent.working_dir && !providerSupported) {
|
|
3452
3627
|
ctx.addIssue({
|
|
3453
|
-
code:
|
|
3628
|
+
code: z20.ZodIssueCode.custom,
|
|
3454
3629
|
message: "Missing agent.working_dir (required when provider is not auto-configured)",
|
|
3455
3630
|
path: ["working_dir"]
|
|
3456
3631
|
});
|
|
@@ -3460,7 +3635,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
3460
3635
|
const skillUrl = agent.skills[i];
|
|
3461
3636
|
if (skillUrl && !validateGitHubTreeUrl(skillUrl)) {
|
|
3462
3637
|
ctx.addIssue({
|
|
3463
|
-
code:
|
|
3638
|
+
code: z20.ZodIssueCode.custom,
|
|
3464
3639
|
message: `Invalid skill URL: ${skillUrl}. Expected format: https://github.com/{owner}/{repo}/tree/{branch}/{path}`,
|
|
3465
3640
|
path: ["skills", i]
|
|
3466
3641
|
});
|
|
@@ -3469,15 +3644,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
3469
3644
|
}
|
|
3470
3645
|
}
|
|
3471
3646
|
);
|
|
3472
|
-
var cliComposeSchema =
|
|
3473
|
-
version:
|
|
3474
|
-
agents:
|
|
3475
|
-
volumes:
|
|
3647
|
+
var cliComposeSchema = z20.object({
|
|
3648
|
+
version: z20.string().min(1, "Missing config.version"),
|
|
3649
|
+
agents: z20.record(cliAgentNameSchema, cliAgentDefinitionSchema),
|
|
3650
|
+
volumes: z20.record(z20.string(), volumeConfigSchema).optional()
|
|
3476
3651
|
}).superRefine((config, ctx) => {
|
|
3477
3652
|
const agentKeys = Object.keys(config.agents);
|
|
3478
3653
|
if (agentKeys.length === 0) {
|
|
3479
3654
|
ctx.addIssue({
|
|
3480
|
-
code:
|
|
3655
|
+
code: z20.ZodIssueCode.custom,
|
|
3481
3656
|
message: "agents must have at least one agent defined",
|
|
3482
3657
|
path: ["agents"]
|
|
3483
3658
|
});
|
|
@@ -3485,7 +3660,7 @@ var cliComposeSchema = z19.object({
|
|
|
3485
3660
|
}
|
|
3486
3661
|
if (agentKeys.length > 1) {
|
|
3487
3662
|
ctx.addIssue({
|
|
3488
|
-
code:
|
|
3663
|
+
code: z20.ZodIssueCode.custom,
|
|
3489
3664
|
message: "Multiple agents not supported yet. Only one agent allowed.",
|
|
3490
3665
|
path: ["agents"]
|
|
3491
3666
|
});
|
|
@@ -3497,7 +3672,7 @@ var cliComposeSchema = z19.object({
|
|
|
3497
3672
|
if (agentVolumes && agentVolumes.length > 0) {
|
|
3498
3673
|
if (!config.volumes) {
|
|
3499
3674
|
ctx.addIssue({
|
|
3500
|
-
code:
|
|
3675
|
+
code: z20.ZodIssueCode.custom,
|
|
3501
3676
|
message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
|
|
3502
3677
|
path: ["volumes"]
|
|
3503
3678
|
});
|
|
@@ -3507,7 +3682,7 @@ var cliComposeSchema = z19.object({
|
|
|
3507
3682
|
const parts = volDeclaration.split(":");
|
|
3508
3683
|
if (parts.length !== 2) {
|
|
3509
3684
|
ctx.addIssue({
|
|
3510
|
-
code:
|
|
3685
|
+
code: z20.ZodIssueCode.custom,
|
|
3511
3686
|
message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
|
|
3512
3687
|
path: ["agents", agentName, "volumes"]
|
|
3513
3688
|
});
|
|
@@ -3516,7 +3691,7 @@ var cliComposeSchema = z19.object({
|
|
|
3516
3691
|
const volumeKey = parts[0].trim();
|
|
3517
3692
|
if (!config.volumes[volumeKey]) {
|
|
3518
3693
|
ctx.addIssue({
|
|
3519
|
-
code:
|
|
3694
|
+
code: z20.ZodIssueCode.custom,
|
|
3520
3695
|
message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
|
|
3521
3696
|
path: ["volumes", volumeKey]
|
|
3522
3697
|
});
|
|
@@ -4577,9 +4752,9 @@ var CodexEventParser = class {
|
|
|
4577
4752
|
}
|
|
4578
4753
|
}
|
|
4579
4754
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
4580
|
-
const changes = item.changes.map((
|
|
4581
|
-
const action =
|
|
4582
|
-
return `${action}: ${
|
|
4755
|
+
const changes = item.changes.map((c17) => {
|
|
4756
|
+
const action = c17.kind === "add" ? "Created" : c17.kind === "modify" ? "Modified" : "Deleted";
|
|
4757
|
+
return `${action}: ${c17.path}`;
|
|
4583
4758
|
}).join("\n");
|
|
4584
4759
|
return {
|
|
4585
4760
|
type: "text",
|
|
@@ -4920,9 +5095,9 @@ var CodexEventRenderer = class {
|
|
|
4920
5095
|
return;
|
|
4921
5096
|
}
|
|
4922
5097
|
if (itemType === "file_change" && item.changes && item.changes.length > 0) {
|
|
4923
|
-
const summary = item.changes.map((
|
|
4924
|
-
const icon =
|
|
4925
|
-
return `${icon}${
|
|
5098
|
+
const summary = item.changes.map((c17) => {
|
|
5099
|
+
const icon = c17.kind === "add" ? "+" : c17.kind === "delete" ? "-" : "~";
|
|
5100
|
+
return `${icon}${c17.path}`;
|
|
4926
5101
|
}).join(", ");
|
|
4927
5102
|
console.log(chalk4.green("[files]") + ` ${summary}`);
|
|
4928
5103
|
return;
|
|
@@ -6772,7 +6947,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
6772
6947
|
var cookCmd = new Command17().name("cook").description("One-click agent preparation and execution from vm0.yaml");
|
|
6773
6948
|
cookCmd.argument("[prompt]", "Prompt for the agent").option("-y, --yes", "Skip confirmation prompts").option("--debug-no-mock-claude").action(
|
|
6774
6949
|
async (prompt, options) => {
|
|
6775
|
-
const shouldExit = await checkAndUpgrade("5.
|
|
6950
|
+
const shouldExit = await checkAndUpgrade("5.9.1", prompt);
|
|
6776
6951
|
if (shouldExit) {
|
|
6777
6952
|
process.exit(0);
|
|
6778
6953
|
}
|
|
@@ -7473,7 +7648,7 @@ var listCommand3 = new Command22().name("list").alias("ls").description("List al
|
|
|
7473
7648
|
);
|
|
7474
7649
|
return;
|
|
7475
7650
|
}
|
|
7476
|
-
const nameWidth = Math.max(4, ...data.composes.map((
|
|
7651
|
+
const nameWidth = Math.max(4, ...data.composes.map((c17) => c17.name.length));
|
|
7477
7652
|
const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
|
|
7478
7653
|
" "
|
|
7479
7654
|
);
|
|
@@ -9627,11 +9802,154 @@ var usageCommand = new Command35().name("usage").description("View usage statist
|
|
|
9627
9802
|
}
|
|
9628
9803
|
});
|
|
9629
9804
|
|
|
9805
|
+
// src/commands/credential/index.ts
|
|
9806
|
+
import { Command as Command39 } from "commander";
|
|
9807
|
+
|
|
9808
|
+
// src/commands/credential/list.ts
|
|
9809
|
+
import { Command as Command36 } from "commander";
|
|
9810
|
+
import chalk37 from "chalk";
|
|
9811
|
+
var listCommand5 = new Command36().name("list").description("List all credentials").option("--json", "Output in JSON format").action(async (options) => {
|
|
9812
|
+
try {
|
|
9813
|
+
const result = await apiClient.listCredentials();
|
|
9814
|
+
if (options.json) {
|
|
9815
|
+
console.log(JSON.stringify(result.credentials, null, 2));
|
|
9816
|
+
return;
|
|
9817
|
+
}
|
|
9818
|
+
if (result.credentials.length === 0) {
|
|
9819
|
+
console.log(chalk37.dim("No credentials found."));
|
|
9820
|
+
console.log();
|
|
9821
|
+
console.log("To add a credential:");
|
|
9822
|
+
console.log(
|
|
9823
|
+
chalk37.cyan(" vm0 experimental-credential set MY_API_KEY <value>")
|
|
9824
|
+
);
|
|
9825
|
+
return;
|
|
9826
|
+
}
|
|
9827
|
+
console.log(chalk37.bold("Credentials:"));
|
|
9828
|
+
console.log();
|
|
9829
|
+
for (const credential of result.credentials) {
|
|
9830
|
+
console.log(` ${chalk37.cyan(credential.name)}`);
|
|
9831
|
+
if (credential.description) {
|
|
9832
|
+
console.log(` ${chalk37.dim(credential.description)}`);
|
|
9833
|
+
}
|
|
9834
|
+
console.log(
|
|
9835
|
+
` ${chalk37.dim(`Updated: ${new Date(credential.updatedAt).toLocaleString()}`)}`
|
|
9836
|
+
);
|
|
9837
|
+
console.log();
|
|
9838
|
+
}
|
|
9839
|
+
console.log(
|
|
9840
|
+
chalk37.dim(`Total: ${result.credentials.length} credential(s)`)
|
|
9841
|
+
);
|
|
9842
|
+
} catch (error) {
|
|
9843
|
+
if (error instanceof Error) {
|
|
9844
|
+
if (error.message.includes("Not authenticated")) {
|
|
9845
|
+
console.error(chalk37.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
9846
|
+
} else {
|
|
9847
|
+
console.error(chalk37.red(`\u2717 ${error.message}`));
|
|
9848
|
+
}
|
|
9849
|
+
} else {
|
|
9850
|
+
console.error(chalk37.red("\u2717 An unexpected error occurred"));
|
|
9851
|
+
}
|
|
9852
|
+
process.exit(1);
|
|
9853
|
+
}
|
|
9854
|
+
});
|
|
9855
|
+
|
|
9856
|
+
// src/commands/credential/set.ts
|
|
9857
|
+
import { Command as Command37 } from "commander";
|
|
9858
|
+
import chalk38 from "chalk";
|
|
9859
|
+
var setCommand2 = new Command37().name("set").description("Create or update a credential").argument("<name>", "Credential name (uppercase, e.g., MY_API_KEY)").argument("<value>", "Credential value").option("-d, --description <description>", "Optional description").action(
|
|
9860
|
+
async (name, value, options) => {
|
|
9861
|
+
try {
|
|
9862
|
+
const credential = await apiClient.setCredential({
|
|
9863
|
+
name,
|
|
9864
|
+
value,
|
|
9865
|
+
description: options.description
|
|
9866
|
+
});
|
|
9867
|
+
console.log(chalk38.green(`\u2713 Credential "${credential.name}" saved`));
|
|
9868
|
+
console.log();
|
|
9869
|
+
console.log("Use in vm0.yaml:");
|
|
9870
|
+
console.log(chalk38.cyan(` environment:`));
|
|
9871
|
+
console.log(chalk38.cyan(` ${name}: \${{ credentials.${name} }}`));
|
|
9872
|
+
} catch (error) {
|
|
9873
|
+
if (error instanceof Error) {
|
|
9874
|
+
if (error.message.includes("Not authenticated")) {
|
|
9875
|
+
console.error(
|
|
9876
|
+
chalk38.red("\u2717 Not authenticated. Run: vm0 auth login")
|
|
9877
|
+
);
|
|
9878
|
+
} else if (error.message.includes("must contain only uppercase")) {
|
|
9879
|
+
console.error(chalk38.red(`\u2717 ${error.message}`));
|
|
9880
|
+
console.log();
|
|
9881
|
+
console.log("Examples of valid credential names:");
|
|
9882
|
+
console.log(chalk38.dim(" MY_API_KEY"));
|
|
9883
|
+
console.log(chalk38.dim(" GITHUB_TOKEN"));
|
|
9884
|
+
console.log(chalk38.dim(" AWS_ACCESS_KEY_ID"));
|
|
9885
|
+
} else {
|
|
9886
|
+
console.error(chalk38.red(`\u2717 ${error.message}`));
|
|
9887
|
+
}
|
|
9888
|
+
} else {
|
|
9889
|
+
console.error(chalk38.red("\u2717 An unexpected error occurred"));
|
|
9890
|
+
}
|
|
9891
|
+
process.exit(1);
|
|
9892
|
+
}
|
|
9893
|
+
}
|
|
9894
|
+
);
|
|
9895
|
+
|
|
9896
|
+
// src/commands/credential/delete.ts
|
|
9897
|
+
import { Command as Command38 } from "commander";
|
|
9898
|
+
import chalk39 from "chalk";
|
|
9899
|
+
var deleteCommand2 = new Command38().name("delete").description("Delete a credential").argument("<name>", "Credential name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
9900
|
+
try {
|
|
9901
|
+
try {
|
|
9902
|
+
await apiClient.getCredential(name);
|
|
9903
|
+
} catch {
|
|
9904
|
+
console.error(chalk39.red(`\u2717 Credential "${name}" not found`));
|
|
9905
|
+
process.exit(1);
|
|
9906
|
+
}
|
|
9907
|
+
if (!options.yes) {
|
|
9908
|
+
const readline2 = await import("readline");
|
|
9909
|
+
const rl = readline2.createInterface({
|
|
9910
|
+
input: process.stdin,
|
|
9911
|
+
output: process.stdout
|
|
9912
|
+
});
|
|
9913
|
+
const confirmed = await new Promise((resolve2) => {
|
|
9914
|
+
rl.question(
|
|
9915
|
+
chalk39.yellow(
|
|
9916
|
+
`Are you sure you want to delete credential "${name}"? (y/N) `
|
|
9917
|
+
),
|
|
9918
|
+
(answer) => {
|
|
9919
|
+
rl.close();
|
|
9920
|
+
resolve2(answer.toLowerCase() === "y");
|
|
9921
|
+
}
|
|
9922
|
+
);
|
|
9923
|
+
});
|
|
9924
|
+
if (!confirmed) {
|
|
9925
|
+
console.log(chalk39.dim("Cancelled."));
|
|
9926
|
+
return;
|
|
9927
|
+
}
|
|
9928
|
+
}
|
|
9929
|
+
await apiClient.deleteCredential(name);
|
|
9930
|
+
console.log(chalk39.green(`\u2713 Credential "${name}" deleted`));
|
|
9931
|
+
} catch (error) {
|
|
9932
|
+
if (error instanceof Error) {
|
|
9933
|
+
if (error.message.includes("Not authenticated")) {
|
|
9934
|
+
console.error(chalk39.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
9935
|
+
} else {
|
|
9936
|
+
console.error(chalk39.red(`\u2717 ${error.message}`));
|
|
9937
|
+
}
|
|
9938
|
+
} else {
|
|
9939
|
+
console.error(chalk39.red("\u2717 An unexpected error occurred"));
|
|
9940
|
+
}
|
|
9941
|
+
process.exit(1);
|
|
9942
|
+
}
|
|
9943
|
+
});
|
|
9944
|
+
|
|
9945
|
+
// src/commands/credential/index.ts
|
|
9946
|
+
var credentialCommand = new Command39().name("experimental-credential").description("[Experimental] Manage stored credentials for agent runs").addCommand(listCommand5).addCommand(setCommand2).addCommand(deleteCommand2);
|
|
9947
|
+
|
|
9630
9948
|
// src/index.ts
|
|
9631
|
-
var program = new
|
|
9632
|
-
program.name("vm0").description("VM0 CLI - A modern build tool").version("5.
|
|
9949
|
+
var program = new Command40();
|
|
9950
|
+
program.name("vm0").description("VM0 CLI - A modern build tool").version("5.9.1");
|
|
9633
9951
|
program.command("info").description("Display environment information").action(async () => {
|
|
9634
|
-
console.log(
|
|
9952
|
+
console.log(chalk40.bold("System Information:"));
|
|
9635
9953
|
console.log(`Node Version: ${process.version}`);
|
|
9636
9954
|
console.log(`Platform: ${process.platform}`);
|
|
9637
9955
|
console.log(`Architecture: ${process.arch}`);
|
|
@@ -9663,6 +9981,7 @@ program.addCommand(initCommand3);
|
|
|
9663
9981
|
program.addCommand(setupGithubCommand);
|
|
9664
9982
|
program.addCommand(scheduleCommand);
|
|
9665
9983
|
program.addCommand(usageCommand);
|
|
9984
|
+
program.addCommand(credentialCommand);
|
|
9666
9985
|
if (process.argv[1]?.endsWith("index.js") || process.argv[1]?.endsWith("index.ts") || process.argv[1]?.endsWith("vm0")) {
|
|
9667
9986
|
program.parse();
|
|
9668
9987
|
}
|