@vm0/cli 9.62.0 → 9.62.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 +517 -850
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -45,7 +45,7 @@ if (DSN) {
|
|
|
45
45
|
Sentry.init({
|
|
46
46
|
dsn: DSN,
|
|
47
47
|
environment: process.env.SENTRY_ENVIRONMENT ?? "production",
|
|
48
|
-
release: "9.62.
|
|
48
|
+
release: "9.62.1",
|
|
49
49
|
sendDefaultPii: false,
|
|
50
50
|
tracesSampleRate: 0,
|
|
51
51
|
shutdownTimeout: 500,
|
|
@@ -64,7 +64,7 @@ if (DSN) {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
Sentry.setContext("cli", {
|
|
67
|
-
version: "9.62.
|
|
67
|
+
version: "9.62.1",
|
|
68
68
|
command: process.argv.slice(2).join(" ")
|
|
69
69
|
});
|
|
70
70
|
Sentry.setContext("runtime", {
|
|
@@ -673,7 +673,7 @@ function getConfigPath() {
|
|
|
673
673
|
return join2(homedir2(), ".vm0", "config.json");
|
|
674
674
|
}
|
|
675
675
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
676
|
-
console.log(chalk4.bold(`VM0 CLI v${"9.62.
|
|
676
|
+
console.log(chalk4.bold(`VM0 CLI v${"9.62.1"}`));
|
|
677
677
|
console.log();
|
|
678
678
|
const config = await loadConfig();
|
|
679
679
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -965,7 +965,8 @@ var composesMainContract = c.router({
|
|
|
965
965
|
responses: {
|
|
966
966
|
200: composeResponseSchema,
|
|
967
967
|
400: apiErrorSchema,
|
|
968
|
-
401: apiErrorSchema
|
|
968
|
+
401: apiErrorSchema,
|
|
969
|
+
403: apiErrorSchema
|
|
969
970
|
},
|
|
970
971
|
summary: "Get agent compose by name"
|
|
971
972
|
},
|
|
@@ -987,7 +988,8 @@ var composesMainContract = c.router({
|
|
|
987
988
|
200: createComposeResponseSchema,
|
|
988
989
|
201: createComposeResponseSchema,
|
|
989
990
|
400: apiErrorSchema,
|
|
990
|
-
401: apiErrorSchema
|
|
991
|
+
401: apiErrorSchema,
|
|
992
|
+
403: apiErrorSchema
|
|
991
993
|
},
|
|
992
994
|
summary: "Create or update agent compose version"
|
|
993
995
|
}
|
|
@@ -1007,6 +1009,7 @@ var composesByIdContract = c.router({
|
|
|
1007
1009
|
responses: {
|
|
1008
1010
|
200: composeResponseSchema,
|
|
1009
1011
|
401: apiErrorSchema,
|
|
1012
|
+
403: apiErrorSchema,
|
|
1010
1013
|
404: apiErrorSchema
|
|
1011
1014
|
},
|
|
1012
1015
|
summary: "Get agent compose by ID"
|
|
@@ -1027,6 +1030,7 @@ var composesByIdContract = c.router({
|
|
|
1027
1030
|
responses: {
|
|
1028
1031
|
204: c.noBody(),
|
|
1029
1032
|
401: apiErrorSchema,
|
|
1033
|
+
403: apiErrorSchema,
|
|
1030
1034
|
404: apiErrorSchema,
|
|
1031
1035
|
409: apiErrorSchema
|
|
1032
1036
|
},
|
|
@@ -1053,6 +1057,7 @@ var composesVersionsContract = c.router({
|
|
|
1053
1057
|
}),
|
|
1054
1058
|
400: apiErrorSchema,
|
|
1055
1059
|
401: apiErrorSchema,
|
|
1060
|
+
403: apiErrorSchema,
|
|
1056
1061
|
404: apiErrorSchema
|
|
1057
1062
|
},
|
|
1058
1063
|
summary: "Resolve version specifier to full version ID"
|
|
@@ -1084,7 +1089,8 @@ var composesListContract = c.router({
|
|
|
1084
1089
|
composes: z4.array(composeListItemSchema)
|
|
1085
1090
|
}),
|
|
1086
1091
|
400: apiErrorSchema,
|
|
1087
|
-
401: apiErrorSchema
|
|
1092
|
+
401: apiErrorSchema,
|
|
1093
|
+
403: apiErrorSchema
|
|
1088
1094
|
},
|
|
1089
1095
|
summary: "List all agent composes for an org"
|
|
1090
1096
|
}
|
|
@@ -1302,7 +1308,8 @@ var runsMainContract = c3.router({
|
|
|
1302
1308
|
responses: {
|
|
1303
1309
|
200: runsListResponseSchema,
|
|
1304
1310
|
400: apiErrorSchema,
|
|
1305
|
-
401: apiErrorSchema
|
|
1311
|
+
401: apiErrorSchema,
|
|
1312
|
+
403: apiErrorSchema
|
|
1306
1313
|
},
|
|
1307
1314
|
summary: "List agent runs"
|
|
1308
1315
|
},
|
|
@@ -1319,6 +1326,7 @@ var runsMainContract = c3.router({
|
|
|
1319
1326
|
201: createRunResponseSchema,
|
|
1320
1327
|
400: apiErrorSchema,
|
|
1321
1328
|
401: apiErrorSchema,
|
|
1329
|
+
403: apiErrorSchema,
|
|
1322
1330
|
404: apiErrorSchema
|
|
1323
1331
|
},
|
|
1324
1332
|
summary: "Create and execute agent run"
|
|
@@ -1367,6 +1375,7 @@ var runsCancelContract = c3.router({
|
|
|
1367
1375
|
200: cancelRunResponseSchema,
|
|
1368
1376
|
400: apiErrorSchema,
|
|
1369
1377
|
401: apiErrorSchema,
|
|
1378
|
+
403: apiErrorSchema,
|
|
1370
1379
|
404: apiErrorSchema
|
|
1371
1380
|
},
|
|
1372
1381
|
summary: "Cancel a pending or running run"
|
|
@@ -1744,6 +1753,7 @@ var storagesPrepareContract = c4.router({
|
|
|
1744
1753
|
}),
|
|
1745
1754
|
400: apiErrorSchema,
|
|
1746
1755
|
401: apiErrorSchema,
|
|
1756
|
+
403: apiErrorSchema,
|
|
1747
1757
|
404: apiErrorSchema,
|
|
1748
1758
|
413: apiErrorSchema,
|
|
1749
1759
|
500: apiErrorSchema
|
|
@@ -1775,6 +1785,7 @@ var storagesCommitContract = c4.router({
|
|
|
1775
1785
|
}),
|
|
1776
1786
|
400: apiErrorSchema,
|
|
1777
1787
|
401: apiErrorSchema,
|
|
1788
|
+
403: apiErrorSchema,
|
|
1778
1789
|
404: apiErrorSchema,
|
|
1779
1790
|
409: apiErrorSchema,
|
|
1780
1791
|
// S3 files missing
|
|
@@ -1813,6 +1824,7 @@ var storagesDownloadContract = c4.router({
|
|
|
1813
1824
|
]),
|
|
1814
1825
|
400: apiErrorSchema,
|
|
1815
1826
|
401: apiErrorSchema,
|
|
1827
|
+
403: apiErrorSchema,
|
|
1816
1828
|
404: apiErrorSchema,
|
|
1817
1829
|
500: apiErrorSchema
|
|
1818
1830
|
},
|
|
@@ -1837,6 +1849,7 @@ var storagesListContract = c4.router({
|
|
|
1837
1849
|
})
|
|
1838
1850
|
),
|
|
1839
1851
|
401: apiErrorSchema,
|
|
1852
|
+
403: apiErrorSchema,
|
|
1840
1853
|
500: apiErrorSchema
|
|
1841
1854
|
},
|
|
1842
1855
|
summary: "List user storages by type"
|
|
@@ -2249,6 +2262,7 @@ var authContract = c7.router({
|
|
|
2249
2262
|
email: z10.string()
|
|
2250
2263
|
}),
|
|
2251
2264
|
401: apiErrorSchema,
|
|
2265
|
+
403: apiErrorSchema,
|
|
2252
2266
|
404: apiErrorSchema,
|
|
2253
2267
|
500: apiErrorSchema
|
|
2254
2268
|
},
|
|
@@ -3332,6 +3346,7 @@ var schedulesMainContract = c14.router({
|
|
|
3332
3346
|
// Created
|
|
3333
3347
|
400: apiErrorSchema,
|
|
3334
3348
|
401: apiErrorSchema,
|
|
3349
|
+
403: apiErrorSchema,
|
|
3335
3350
|
404: apiErrorSchema
|
|
3336
3351
|
},
|
|
3337
3352
|
summary: "Deploy schedule (create or update)"
|
|
@@ -3346,7 +3361,8 @@ var schedulesMainContract = c14.router({
|
|
|
3346
3361
|
headers: authHeadersSchema,
|
|
3347
3362
|
responses: {
|
|
3348
3363
|
200: scheduleListResponseSchema,
|
|
3349
|
-
401: apiErrorSchema
|
|
3364
|
+
401: apiErrorSchema,
|
|
3365
|
+
403: apiErrorSchema
|
|
3350
3366
|
},
|
|
3351
3367
|
summary: "List all schedules"
|
|
3352
3368
|
}
|
|
@@ -3369,6 +3385,7 @@ var schedulesByNameContract = c14.router({
|
|
|
3369
3385
|
responses: {
|
|
3370
3386
|
200: scheduleResponseSchema,
|
|
3371
3387
|
401: apiErrorSchema,
|
|
3388
|
+
403: apiErrorSchema,
|
|
3372
3389
|
404: apiErrorSchema
|
|
3373
3390
|
},
|
|
3374
3391
|
summary: "Get schedule by name"
|
|
@@ -3390,6 +3407,7 @@ var schedulesByNameContract = c14.router({
|
|
|
3390
3407
|
responses: {
|
|
3391
3408
|
204: c14.noBody(),
|
|
3392
3409
|
401: apiErrorSchema,
|
|
3410
|
+
403: apiErrorSchema,
|
|
3393
3411
|
404: apiErrorSchema
|
|
3394
3412
|
},
|
|
3395
3413
|
summary: "Delete schedule"
|
|
@@ -3413,6 +3431,7 @@ var schedulesEnableContract = c14.router({
|
|
|
3413
3431
|
responses: {
|
|
3414
3432
|
200: scheduleResponseSchema,
|
|
3415
3433
|
401: apiErrorSchema,
|
|
3434
|
+
403: apiErrorSchema,
|
|
3416
3435
|
404: apiErrorSchema
|
|
3417
3436
|
},
|
|
3418
3437
|
summary: "Enable schedule"
|
|
@@ -3434,6 +3453,7 @@ var schedulesEnableContract = c14.router({
|
|
|
3434
3453
|
responses: {
|
|
3435
3454
|
200: scheduleResponseSchema,
|
|
3436
3455
|
401: apiErrorSchema,
|
|
3456
|
+
403: apiErrorSchema,
|
|
3437
3457
|
404: apiErrorSchema
|
|
3438
3458
|
},
|
|
3439
3459
|
summary: "Disable schedule"
|
|
@@ -3458,6 +3478,7 @@ var scheduleRunsContract = c14.router({
|
|
|
3458
3478
|
responses: {
|
|
3459
3479
|
200: scheduleRunsResponseSchema,
|
|
3460
3480
|
401: apiErrorSchema,
|
|
3481
|
+
403: apiErrorSchema,
|
|
3461
3482
|
404: apiErrorSchema
|
|
3462
3483
|
},
|
|
3463
3484
|
summary: "List recent runs for a schedule"
|
|
@@ -9486,7 +9507,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9486
9507
|
options.autoUpdate = false;
|
|
9487
9508
|
}
|
|
9488
9509
|
if (options.autoUpdate !== false) {
|
|
9489
|
-
await startSilentUpgrade("9.62.
|
|
9510
|
+
await startSilentUpgrade("9.62.1");
|
|
9490
9511
|
}
|
|
9491
9512
|
try {
|
|
9492
9513
|
let result;
|
|
@@ -9531,7 +9552,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9531
9552
|
import { Command as Command8, Option as Option2 } from "commander";
|
|
9532
9553
|
|
|
9533
9554
|
// src/commands/run/shared.ts
|
|
9534
|
-
import
|
|
9555
|
+
import chalk9 from "chalk";
|
|
9535
9556
|
import * as fs6 from "fs";
|
|
9536
9557
|
import { config as dotenvConfig } from "dotenv";
|
|
9537
9558
|
|
|
@@ -9639,237 +9660,9 @@ var ClaudeEventParser = class {
|
|
|
9639
9660
|
}
|
|
9640
9661
|
};
|
|
9641
9662
|
|
|
9642
|
-
// src/lib/events/codex-event-parser.ts
|
|
9643
|
-
var CodexEventParser = class {
|
|
9644
|
-
/**
|
|
9645
|
-
* Parse a raw Codex CLI JSONL event into a simplified format
|
|
9646
|
-
* Returns null if the event type is unknown or malformed
|
|
9647
|
-
*/
|
|
9648
|
-
static parse(rawEvent) {
|
|
9649
|
-
if (!rawEvent || typeof rawEvent !== "object" || !("type" in rawEvent)) {
|
|
9650
|
-
return null;
|
|
9651
|
-
}
|
|
9652
|
-
const eventType = rawEvent.type;
|
|
9653
|
-
if (eventType === "thread.started") {
|
|
9654
|
-
return this.parseThreadStarted(rawEvent);
|
|
9655
|
-
}
|
|
9656
|
-
if (eventType === "turn.completed") {
|
|
9657
|
-
return this.parseTurnCompleted(rawEvent);
|
|
9658
|
-
}
|
|
9659
|
-
if (eventType === "turn.failed") {
|
|
9660
|
-
return this.parseTurnFailed(rawEvent);
|
|
9661
|
-
}
|
|
9662
|
-
if (eventType.startsWith("item.")) {
|
|
9663
|
-
return this.parseItemEvent(rawEvent);
|
|
9664
|
-
}
|
|
9665
|
-
if (eventType === "error") {
|
|
9666
|
-
return this.parseErrorEvent(rawEvent);
|
|
9667
|
-
}
|
|
9668
|
-
return null;
|
|
9669
|
-
}
|
|
9670
|
-
static parseThreadStarted(event) {
|
|
9671
|
-
return {
|
|
9672
|
-
type: "init",
|
|
9673
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
9674
|
-
data: {
|
|
9675
|
-
framework: "codex",
|
|
9676
|
-
sessionId: event.thread_id,
|
|
9677
|
-
tools: []
|
|
9678
|
-
}
|
|
9679
|
-
};
|
|
9680
|
-
}
|
|
9681
|
-
static parseTurnCompleted(event) {
|
|
9682
|
-
return {
|
|
9683
|
-
type: "result",
|
|
9684
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
9685
|
-
data: {
|
|
9686
|
-
success: true,
|
|
9687
|
-
result: "",
|
|
9688
|
-
durationMs: 0,
|
|
9689
|
-
numTurns: 1,
|
|
9690
|
-
cost: 0,
|
|
9691
|
-
usage: event.usage || {}
|
|
9692
|
-
}
|
|
9693
|
-
};
|
|
9694
|
-
}
|
|
9695
|
-
static parseTurnFailed(event) {
|
|
9696
|
-
return {
|
|
9697
|
-
type: "result",
|
|
9698
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
9699
|
-
data: {
|
|
9700
|
-
success: false,
|
|
9701
|
-
result: event.error || "Turn failed",
|
|
9702
|
-
durationMs: 0,
|
|
9703
|
-
numTurns: 1,
|
|
9704
|
-
cost: 0,
|
|
9705
|
-
usage: {}
|
|
9706
|
-
}
|
|
9707
|
-
};
|
|
9708
|
-
}
|
|
9709
|
-
static parseItemEvent(event) {
|
|
9710
|
-
const item = event.item;
|
|
9711
|
-
if (!item) {
|
|
9712
|
-
return null;
|
|
9713
|
-
}
|
|
9714
|
-
const itemType = item.type;
|
|
9715
|
-
if (itemType === "agent_message" && item.text) {
|
|
9716
|
-
return { type: "text", timestamp: /* @__PURE__ */ new Date(), data: { text: item.text } };
|
|
9717
|
-
}
|
|
9718
|
-
if (itemType === "command_execution") {
|
|
9719
|
-
return this.parseCommandExecution(event);
|
|
9720
|
-
}
|
|
9721
|
-
if (itemType === "file_edit" || itemType === "file_write") {
|
|
9722
|
-
return this.parseFileEditOrWrite(event);
|
|
9723
|
-
}
|
|
9724
|
-
if (itemType === "file_read") {
|
|
9725
|
-
return this.parseFileRead(event);
|
|
9726
|
-
}
|
|
9727
|
-
if (itemType === "file_change") {
|
|
9728
|
-
return this.parseFileChange(item);
|
|
9729
|
-
}
|
|
9730
|
-
if (itemType === "reasoning" && item.text) {
|
|
9731
|
-
return {
|
|
9732
|
-
type: "text",
|
|
9733
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
9734
|
-
data: { text: `[thinking] ${item.text}` }
|
|
9735
|
-
};
|
|
9736
|
-
}
|
|
9737
|
-
return null;
|
|
9738
|
-
}
|
|
9739
|
-
static parseCommandExecution(event) {
|
|
9740
|
-
const item = event.item;
|
|
9741
|
-
if (event.type === "item.started" && item.command) {
|
|
9742
|
-
return {
|
|
9743
|
-
type: "tool_use",
|
|
9744
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
9745
|
-
data: {
|
|
9746
|
-
tool: "Bash",
|
|
9747
|
-
toolUseId: item.id,
|
|
9748
|
-
input: { command: item.command }
|
|
9749
|
-
}
|
|
9750
|
-
};
|
|
9751
|
-
}
|
|
9752
|
-
if (event.type === "item.completed") {
|
|
9753
|
-
const output = item.aggregated_output ?? item.output ?? "";
|
|
9754
|
-
return {
|
|
9755
|
-
type: "tool_result",
|
|
9756
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
9757
|
-
data: {
|
|
9758
|
-
toolUseId: item.id,
|
|
9759
|
-
result: output,
|
|
9760
|
-
isError: item.exit_code !== 0
|
|
9761
|
-
}
|
|
9762
|
-
};
|
|
9763
|
-
}
|
|
9764
|
-
return null;
|
|
9765
|
-
}
|
|
9766
|
-
static parseFileEditOrWrite(event) {
|
|
9767
|
-
const item = event.item;
|
|
9768
|
-
if (event.type === "item.started" && item.path) {
|
|
9769
|
-
return {
|
|
9770
|
-
type: "tool_use",
|
|
9771
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
9772
|
-
data: {
|
|
9773
|
-
tool: item.type === "file_edit" ? "Edit" : "Write",
|
|
9774
|
-
toolUseId: item.id,
|
|
9775
|
-
input: { file_path: item.path }
|
|
9776
|
-
}
|
|
9777
|
-
};
|
|
9778
|
-
}
|
|
9779
|
-
if (event.type === "item.completed") {
|
|
9780
|
-
return {
|
|
9781
|
-
type: "tool_result",
|
|
9782
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
9783
|
-
data: {
|
|
9784
|
-
toolUseId: item.id,
|
|
9785
|
-
result: item.diff || "File operation completed",
|
|
9786
|
-
isError: false
|
|
9787
|
-
}
|
|
9788
|
-
};
|
|
9789
|
-
}
|
|
9790
|
-
return null;
|
|
9791
|
-
}
|
|
9792
|
-
static parseFileRead(event) {
|
|
9793
|
-
const item = event.item;
|
|
9794
|
-
if (event.type === "item.started" && item.path) {
|
|
9795
|
-
return {
|
|
9796
|
-
type: "tool_use",
|
|
9797
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
9798
|
-
data: {
|
|
9799
|
-
tool: "Read",
|
|
9800
|
-
toolUseId: item.id,
|
|
9801
|
-
input: { file_path: item.path }
|
|
9802
|
-
}
|
|
9803
|
-
};
|
|
9804
|
-
}
|
|
9805
|
-
if (event.type === "item.completed") {
|
|
9806
|
-
return {
|
|
9807
|
-
type: "tool_result",
|
|
9808
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
9809
|
-
data: {
|
|
9810
|
-
toolUseId: item.id,
|
|
9811
|
-
result: "File read completed",
|
|
9812
|
-
isError: false
|
|
9813
|
-
}
|
|
9814
|
-
};
|
|
9815
|
-
}
|
|
9816
|
-
return null;
|
|
9817
|
-
}
|
|
9818
|
-
static parseFileChange(item) {
|
|
9819
|
-
if (!item.changes || item.changes.length === 0) {
|
|
9820
|
-
return null;
|
|
9821
|
-
}
|
|
9822
|
-
const changes = item.changes.map((c24) => {
|
|
9823
|
-
const action = c24.kind === "add" ? "Created" : c24.kind === "modify" ? "Modified" : "Deleted";
|
|
9824
|
-
return `${action}: ${c24.path}`;
|
|
9825
|
-
}).join("\n");
|
|
9826
|
-
return {
|
|
9827
|
-
type: "text",
|
|
9828
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
9829
|
-
data: { text: `[files]
|
|
9830
|
-
${changes}` }
|
|
9831
|
-
};
|
|
9832
|
-
}
|
|
9833
|
-
static parseErrorEvent(event) {
|
|
9834
|
-
return {
|
|
9835
|
-
type: "result",
|
|
9836
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
9837
|
-
data: {
|
|
9838
|
-
success: false,
|
|
9839
|
-
result: event.message || event.error || "Unknown error",
|
|
9840
|
-
durationMs: 0,
|
|
9841
|
-
numTurns: 0,
|
|
9842
|
-
cost: 0,
|
|
9843
|
-
usage: {}
|
|
9844
|
-
}
|
|
9845
|
-
};
|
|
9846
|
-
}
|
|
9847
|
-
};
|
|
9848
|
-
|
|
9849
9663
|
// src/lib/events/event-parser-factory.ts
|
|
9850
|
-
function
|
|
9851
|
-
|
|
9852
|
-
return null;
|
|
9853
|
-
}
|
|
9854
|
-
const eventType = rawEvent.type;
|
|
9855
|
-
if (eventType === "thread.started" || eventType === "turn.started" || eventType === "turn.completed" || eventType === "turn.failed" || eventType?.startsWith("item.")) {
|
|
9856
|
-
return "codex";
|
|
9857
|
-
}
|
|
9858
|
-
if (eventType === "system" || eventType === "assistant" || eventType === "user" || eventType === "result") {
|
|
9859
|
-
return "claude-code";
|
|
9860
|
-
}
|
|
9861
|
-
return null;
|
|
9862
|
-
}
|
|
9863
|
-
function getEventParser(framework) {
|
|
9864
|
-
if (framework === "codex") {
|
|
9865
|
-
return CodexEventParser;
|
|
9866
|
-
}
|
|
9867
|
-
return ClaudeEventParser;
|
|
9868
|
-
}
|
|
9869
|
-
function parseEvent(rawEvent, framework) {
|
|
9870
|
-
const effectiveFramework = framework ? getValidatedFramework(framework) : detectFrameworkFromEvent(rawEvent) || "claude-code";
|
|
9871
|
-
const Parser = getEventParser(effectiveFramework);
|
|
9872
|
-
return Parser.parse(rawEvent);
|
|
9664
|
+
function parseEvent(rawEvent) {
|
|
9665
|
+
return ClaudeEventParser.parse(rawEvent);
|
|
9873
9666
|
}
|
|
9874
9667
|
|
|
9875
9668
|
// src/lib/events/event-renderer.ts
|
|
@@ -10339,123 +10132,6 @@ var EventRenderer = class _EventRenderer {
|
|
|
10339
10132
|
}
|
|
10340
10133
|
};
|
|
10341
10134
|
|
|
10342
|
-
// src/lib/events/codex-event-renderer.ts
|
|
10343
|
-
import chalk9 from "chalk";
|
|
10344
|
-
var CodexEventRenderer = class {
|
|
10345
|
-
/**
|
|
10346
|
-
* Check if an event is a Codex event
|
|
10347
|
-
*/
|
|
10348
|
-
static isCodexEvent(event) {
|
|
10349
|
-
const type2 = event.type;
|
|
10350
|
-
return type2 === "thread.started" || type2 === "turn.started" || type2 === "turn.completed" || type2 === "turn.failed" || type2?.startsWith("item.") || type2 === "error";
|
|
10351
|
-
}
|
|
10352
|
-
/**
|
|
10353
|
-
* Render a raw Codex event
|
|
10354
|
-
*/
|
|
10355
|
-
static render(rawEvent) {
|
|
10356
|
-
const event = rawEvent;
|
|
10357
|
-
const type2 = event.type;
|
|
10358
|
-
switch (type2) {
|
|
10359
|
-
case "thread.started":
|
|
10360
|
-
this.renderThreadStarted(event);
|
|
10361
|
-
break;
|
|
10362
|
-
case "turn.started":
|
|
10363
|
-
break;
|
|
10364
|
-
case "turn.completed":
|
|
10365
|
-
this.renderTurnCompleted(event);
|
|
10366
|
-
break;
|
|
10367
|
-
case "turn.failed":
|
|
10368
|
-
this.renderTurnFailed(event);
|
|
10369
|
-
break;
|
|
10370
|
-
case "item.started":
|
|
10371
|
-
case "item.updated":
|
|
10372
|
-
case "item.completed":
|
|
10373
|
-
this.renderItem(event);
|
|
10374
|
-
break;
|
|
10375
|
-
case "error":
|
|
10376
|
-
this.renderError(event);
|
|
10377
|
-
break;
|
|
10378
|
-
}
|
|
10379
|
-
}
|
|
10380
|
-
static renderThreadStarted(event) {
|
|
10381
|
-
console.log(`[thread.started] ${event.thread_id}`);
|
|
10382
|
-
}
|
|
10383
|
-
static renderTurnCompleted(event) {
|
|
10384
|
-
if (event.usage) {
|
|
10385
|
-
const input = event.usage.input_tokens || 0;
|
|
10386
|
-
const output = event.usage.output_tokens || 0;
|
|
10387
|
-
const cached = event.usage.cached_input_tokens || 0;
|
|
10388
|
-
const cachedStr = cached ? ` (${cached} cached)` : "";
|
|
10389
|
-
console.log(
|
|
10390
|
-
"[turn.completed]" + chalk9.dim(` ${input} in / ${output} out${cachedStr}`)
|
|
10391
|
-
);
|
|
10392
|
-
}
|
|
10393
|
-
}
|
|
10394
|
-
static renderTurnFailed(event) {
|
|
10395
|
-
console.log(
|
|
10396
|
-
chalk9.red("[turn.failed]") + (event.error ? ` ${event.error}` : "")
|
|
10397
|
-
);
|
|
10398
|
-
}
|
|
10399
|
-
static renderItem(event) {
|
|
10400
|
-
const item = event.item;
|
|
10401
|
-
if (!item) return;
|
|
10402
|
-
const itemType = item.type;
|
|
10403
|
-
const eventType = event.type;
|
|
10404
|
-
if (itemType === "reasoning" && item.text) {
|
|
10405
|
-
console.log(`[reasoning] ${item.text}`);
|
|
10406
|
-
} else if (itemType === "agent_message" && item.text) {
|
|
10407
|
-
console.log(`[message] ${item.text}`);
|
|
10408
|
-
} else if (itemType === "command_execution") {
|
|
10409
|
-
this.renderCommandExecution(item, eventType);
|
|
10410
|
-
} else if (itemType === "file_change") {
|
|
10411
|
-
this.renderFileChange(item);
|
|
10412
|
-
} else if (itemType === "file_edit" || itemType === "file_write" || itemType === "file_read") {
|
|
10413
|
-
this.renderFileOperation(item, eventType);
|
|
10414
|
-
}
|
|
10415
|
-
}
|
|
10416
|
-
static renderCommandExecution(item, eventType) {
|
|
10417
|
-
if (eventType === "item.started" && item.command) {
|
|
10418
|
-
console.log(`[exec] ${item.command}`);
|
|
10419
|
-
} else if (eventType === "item.completed") {
|
|
10420
|
-
const output = item.aggregated_output || "";
|
|
10421
|
-
const exitCode = item.exit_code ?? 0;
|
|
10422
|
-
if (output) {
|
|
10423
|
-
const lines = output.split("\n").filter((l) => l.trim());
|
|
10424
|
-
const preview = lines.slice(0, 3).join("\n ");
|
|
10425
|
-
const more = lines.length > 3 ? chalk9.dim(` ... (${lines.length - 3} more lines)`) : "";
|
|
10426
|
-
console.log(
|
|
10427
|
-
"[output]" + (exitCode !== 0 ? chalk9.red(` exit=${exitCode}`) : "")
|
|
10428
|
-
);
|
|
10429
|
-
if (preview) {
|
|
10430
|
-
console.log(" " + preview + more);
|
|
10431
|
-
}
|
|
10432
|
-
} else if (exitCode !== 0) {
|
|
10433
|
-
console.log(chalk9.red("[output]") + chalk9.red(` exit=${exitCode}`));
|
|
10434
|
-
}
|
|
10435
|
-
}
|
|
10436
|
-
}
|
|
10437
|
-
static renderFileChange(item) {
|
|
10438
|
-
if (item.changes && item.changes.length > 0) {
|
|
10439
|
-
const summary = item.changes.map((c24) => {
|
|
10440
|
-
const icon = c24.kind === "add" ? "+" : c24.kind === "delete" ? "-" : "~";
|
|
10441
|
-
return `${icon}${c24.path}`;
|
|
10442
|
-
}).join(", ");
|
|
10443
|
-
console.log(chalk9.green("[files]") + ` ${summary}`);
|
|
10444
|
-
}
|
|
10445
|
-
}
|
|
10446
|
-
static renderFileOperation(item, eventType) {
|
|
10447
|
-
const action = item.type.replace("file_", "");
|
|
10448
|
-
if (eventType === "item.started" && item.path) {
|
|
10449
|
-
console.log(`[${action}] ${item.path}`);
|
|
10450
|
-
}
|
|
10451
|
-
}
|
|
10452
|
-
static renderError(event) {
|
|
10453
|
-
console.log(
|
|
10454
|
-
chalk9.red("[error]") + ` ${event.message || event.error || "Unknown error"}`
|
|
10455
|
-
);
|
|
10456
|
-
}
|
|
10457
|
-
};
|
|
10458
|
-
|
|
10459
10135
|
// src/commands/run/shared.ts
|
|
10460
10136
|
function collectKeyValue(value, previous) {
|
|
10461
10137
|
const [key, ...valueParts] = value.split("=");
|
|
@@ -10538,10 +10214,10 @@ function parseIdentifier(identifier) {
|
|
|
10538
10214
|
}
|
|
10539
10215
|
function renderRunCreated(response) {
|
|
10540
10216
|
if (response.status === "queued") {
|
|
10541
|
-
console.log(
|
|
10542
|
-
console.log(` Run ID: ${
|
|
10217
|
+
console.log(chalk9.yellow("\u26A0 Run queued \u2014 concurrency limit reached"));
|
|
10218
|
+
console.log(` Run ID: ${chalk9.dim(response.runId)}`);
|
|
10543
10219
|
console.log(
|
|
10544
|
-
|
|
10220
|
+
chalk9.dim(" Will start automatically when a slot is available")
|
|
10545
10221
|
);
|
|
10546
10222
|
console.log();
|
|
10547
10223
|
} else {
|
|
@@ -10563,13 +10239,9 @@ async function pollEvents(runId, options) {
|
|
|
10563
10239
|
});
|
|
10564
10240
|
for (const event of response.events) {
|
|
10565
10241
|
const eventData = event.eventData;
|
|
10566
|
-
|
|
10567
|
-
|
|
10568
|
-
|
|
10569
|
-
const parsed = parseEvent(eventData);
|
|
10570
|
-
if (parsed) {
|
|
10571
|
-
renderer.render(parsed);
|
|
10572
|
-
}
|
|
10242
|
+
const parsed = parseEvent(eventData);
|
|
10243
|
+
if (parsed) {
|
|
10244
|
+
renderer.render(parsed);
|
|
10573
10245
|
}
|
|
10574
10246
|
}
|
|
10575
10247
|
nextSequence = response.nextSequence;
|
|
@@ -10589,9 +10261,9 @@ async function pollEvents(runId, options) {
|
|
|
10589
10261
|
result = { succeeded: false, runId };
|
|
10590
10262
|
} else if (runStatus === "timeout") {
|
|
10591
10263
|
complete = true;
|
|
10592
|
-
console.error(
|
|
10264
|
+
console.error(chalk9.red("\n\u2717 Run timed out"));
|
|
10593
10265
|
console.error(
|
|
10594
|
-
|
|
10266
|
+
chalk9.dim(` (use "vm0 logs ${runId} --system" to view system logs)`)
|
|
10595
10267
|
);
|
|
10596
10268
|
result = { succeeded: false, runId };
|
|
10597
10269
|
}
|
|
@@ -10605,11 +10277,11 @@ function showNextSteps(result) {
|
|
|
10605
10277
|
const { runId, sessionId, checkpointId } = result;
|
|
10606
10278
|
console.log();
|
|
10607
10279
|
console.log(" View agent logs:");
|
|
10608
|
-
console.log(
|
|
10280
|
+
console.log(chalk9.cyan(` vm0 logs ${runId}`));
|
|
10609
10281
|
if (sessionId) {
|
|
10610
10282
|
console.log(" Continue with session (latest conversation and artifact):");
|
|
10611
10283
|
console.log(
|
|
10612
|
-
|
|
10284
|
+
chalk9.cyan(` vm0 run continue ${sessionId} "your next prompt"`)
|
|
10613
10285
|
);
|
|
10614
10286
|
}
|
|
10615
10287
|
if (checkpointId) {
|
|
@@ -10617,7 +10289,7 @@ function showNextSteps(result) {
|
|
|
10617
10289
|
" Resume from checkpoint (snapshotted conversation and artifact):"
|
|
10618
10290
|
);
|
|
10619
10291
|
console.log(
|
|
10620
|
-
|
|
10292
|
+
chalk9.cyan(` vm0 run resume ${checkpointId} "your next prompt"`)
|
|
10621
10293
|
);
|
|
10622
10294
|
}
|
|
10623
10295
|
}
|
|
@@ -10657,7 +10329,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
10657
10329
|
withErrorHandler(
|
|
10658
10330
|
async (identifier, prompt, options) => {
|
|
10659
10331
|
if (options.autoUpdate !== false) {
|
|
10660
|
-
await startSilentUpgrade("9.62.
|
|
10332
|
+
await startSilentUpgrade("9.62.1");
|
|
10661
10333
|
}
|
|
10662
10334
|
const { org, name, version } = parseIdentifier(identifier);
|
|
10663
10335
|
let composeId;
|
|
@@ -10862,7 +10534,7 @@ var continueCommand = new Command10().name("continue").description(
|
|
|
10862
10534
|
|
|
10863
10535
|
// src/commands/run/list.ts
|
|
10864
10536
|
import { Command as Command11 } from "commander";
|
|
10865
|
-
import
|
|
10537
|
+
import chalk10 from "chalk";
|
|
10866
10538
|
|
|
10867
10539
|
// src/lib/utils/time-parser.ts
|
|
10868
10540
|
function parseTime(timeStr) {
|
|
@@ -10915,16 +10587,16 @@ function formatRunStatus(status, width) {
|
|
|
10915
10587
|
const paddedStatus = width ? status.padEnd(width) : status;
|
|
10916
10588
|
switch (status) {
|
|
10917
10589
|
case "queued":
|
|
10918
|
-
return
|
|
10590
|
+
return chalk10.blue(paddedStatus);
|
|
10919
10591
|
case "running":
|
|
10920
|
-
return
|
|
10592
|
+
return chalk10.green(paddedStatus);
|
|
10921
10593
|
case "pending":
|
|
10922
|
-
return
|
|
10594
|
+
return chalk10.yellow(paddedStatus);
|
|
10923
10595
|
case "completed":
|
|
10924
|
-
return
|
|
10596
|
+
return chalk10.dim(paddedStatus);
|
|
10925
10597
|
case "failed":
|
|
10926
10598
|
case "timeout":
|
|
10927
|
-
return
|
|
10599
|
+
return chalk10.red(paddedStatus);
|
|
10928
10600
|
default:
|
|
10929
10601
|
return paddedStatus;
|
|
10930
10602
|
}
|
|
@@ -10975,7 +10647,7 @@ function displayRuns(runs) {
|
|
|
10975
10647
|
"STATUS".padEnd(statusWidth),
|
|
10976
10648
|
"CREATED"
|
|
10977
10649
|
].join(" ");
|
|
10978
|
-
console.log(
|
|
10650
|
+
console.log(chalk10.dim(header));
|
|
10979
10651
|
for (const run of runs) {
|
|
10980
10652
|
const row = [
|
|
10981
10653
|
run.id.padEnd(UUID_LENGTH),
|
|
@@ -10988,10 +10660,10 @@ function displayRuns(runs) {
|
|
|
10988
10660
|
}
|
|
10989
10661
|
function displayEmptyState(hasFilters) {
|
|
10990
10662
|
if (hasFilters) {
|
|
10991
|
-
console.log(
|
|
10663
|
+
console.log(chalk10.dim("No runs found matching filters"));
|
|
10992
10664
|
} else {
|
|
10993
|
-
console.log(
|
|
10994
|
-
console.log(
|
|
10665
|
+
console.log(chalk10.dim("No active runs"));
|
|
10666
|
+
console.log(chalk10.dim(' Run: vm0 run <agent> "<prompt>"'));
|
|
10995
10667
|
}
|
|
10996
10668
|
}
|
|
10997
10669
|
var listCommand = new Command11().name("list").alias("ls").description("List runs").option(
|
|
@@ -11028,17 +10700,17 @@ var listCommand = new Command11().name("list").alias("ls").description("List run
|
|
|
11028
10700
|
|
|
11029
10701
|
// src/commands/run/kill.ts
|
|
11030
10702
|
import { Command as Command12 } from "commander";
|
|
11031
|
-
import
|
|
10703
|
+
import chalk11 from "chalk";
|
|
11032
10704
|
var killCommand = new Command12().name("kill").description("Kill (cancel) a pending or running run").argument("<run-id>", "Run ID to kill").action(
|
|
11033
10705
|
withErrorHandler(async (runId) => {
|
|
11034
10706
|
await cancelRun(runId);
|
|
11035
|
-
console.log(
|
|
10707
|
+
console.log(chalk11.green(`\u2713 Run ${runId} cancelled`));
|
|
11036
10708
|
})
|
|
11037
10709
|
);
|
|
11038
10710
|
|
|
11039
10711
|
// src/commands/run/queue.ts
|
|
11040
10712
|
import { Command as Command13 } from "commander";
|
|
11041
|
-
import
|
|
10713
|
+
import chalk12 from "chalk";
|
|
11042
10714
|
var queueCommand = new Command13().name("queue").description("Show org run queue status").action(
|
|
11043
10715
|
withErrorHandler(async () => {
|
|
11044
10716
|
const data = await getRunQueue();
|
|
@@ -11046,7 +10718,7 @@ var queueCommand = new Command13().name("queue").description("Show org run queue
|
|
|
11046
10718
|
const limitDisplay = concurrency.limit === 0 ? "unlimited" : `${concurrency.active}/${concurrency.limit} slots used`;
|
|
11047
10719
|
console.log(`Concurrency: ${limitDisplay} (${concurrency.tier} tier)`);
|
|
11048
10720
|
if (queue.length === 0) {
|
|
11049
|
-
console.log(
|
|
10721
|
+
console.log(chalk12.dim("Queue: empty \u2014 all slots available"));
|
|
11050
10722
|
return;
|
|
11051
10723
|
}
|
|
11052
10724
|
console.log(
|
|
@@ -11062,9 +10734,9 @@ var queueCommand = new Command13().name("queue").description("Show org run queue
|
|
|
11062
10734
|
"USER".padEnd(emailWidth),
|
|
11063
10735
|
"CREATED"
|
|
11064
10736
|
].join(" ");
|
|
11065
|
-
console.log(
|
|
10737
|
+
console.log(chalk12.dim(header));
|
|
11066
10738
|
for (const entry of queue) {
|
|
11067
|
-
const marker = entry.isOwner ?
|
|
10739
|
+
const marker = entry.isOwner ? chalk12.cyan(" \u2190 you") : "";
|
|
11068
10740
|
const row = [
|
|
11069
10741
|
String(entry.position).padEnd(posWidth),
|
|
11070
10742
|
entry.agentName.padEnd(agentWidth),
|
|
@@ -11089,7 +10761,7 @@ import { Command as Command20 } from "commander";
|
|
|
11089
10761
|
|
|
11090
10762
|
// src/commands/volume/init.ts
|
|
11091
10763
|
import { Command as Command14 } from "commander";
|
|
11092
|
-
import
|
|
10764
|
+
import chalk13 from "chalk";
|
|
11093
10765
|
import path7 from "path";
|
|
11094
10766
|
|
|
11095
10767
|
// src/lib/storage/storage-utils.ts
|
|
@@ -11147,10 +10819,10 @@ var initCommand = new Command14().name("init").description("Initialize a volume
|
|
|
11147
10819
|
const existingConfig = await readStorageConfig(cwd);
|
|
11148
10820
|
if (existingConfig) {
|
|
11149
10821
|
console.log(
|
|
11150
|
-
|
|
10822
|
+
chalk13.yellow(`Volume already initialized: ${existingConfig.name}`)
|
|
11151
10823
|
);
|
|
11152
10824
|
console.log(
|
|
11153
|
-
|
|
10825
|
+
chalk13.dim(`Config file: ${path7.join(cwd, ".vm0", "storage.yaml")}`)
|
|
11154
10826
|
);
|
|
11155
10827
|
return;
|
|
11156
10828
|
}
|
|
@@ -11174,7 +10846,7 @@ var initCommand = new Command14().name("init").description("Initialize a volume
|
|
|
11174
10846
|
}
|
|
11175
10847
|
);
|
|
11176
10848
|
if (name === void 0) {
|
|
11177
|
-
console.log(
|
|
10849
|
+
console.log(chalk13.dim("Cancelled"));
|
|
11178
10850
|
return;
|
|
11179
10851
|
}
|
|
11180
10852
|
volumeName = name;
|
|
@@ -11187,9 +10859,9 @@ var initCommand = new Command14().name("init").description("Initialize a volume
|
|
|
11187
10859
|
});
|
|
11188
10860
|
}
|
|
11189
10861
|
await writeStorageConfig(volumeName, cwd);
|
|
11190
|
-
console.log(
|
|
10862
|
+
console.log(chalk13.green(`\u2713 Initialized volume: ${volumeName}`));
|
|
11191
10863
|
console.log(
|
|
11192
|
-
|
|
10864
|
+
chalk13.dim(
|
|
11193
10865
|
` Config saved to ${path7.join(cwd, ".vm0", "storage.yaml")}`
|
|
11194
10866
|
)
|
|
11195
10867
|
);
|
|
@@ -11198,7 +10870,7 @@ var initCommand = new Command14().name("init").description("Initialize a volume
|
|
|
11198
10870
|
|
|
11199
10871
|
// src/commands/volume/push.ts
|
|
11200
10872
|
import { Command as Command15 } from "commander";
|
|
11201
|
-
import
|
|
10873
|
+
import chalk14 from "chalk";
|
|
11202
10874
|
var pushCommand = new Command15().name("push").description("Push local files to cloud volume").option(
|
|
11203
10875
|
"-f, --force",
|
|
11204
10876
|
"Force upload even if content unchanged (recreate archive)"
|
|
@@ -11214,41 +10886,41 @@ var pushCommand = new Command15().name("push").description("Push local files to
|
|
|
11214
10886
|
console.log(`Pushing volume: ${config.name}`);
|
|
11215
10887
|
const result = await directUpload(config.name, "volume", cwd, {
|
|
11216
10888
|
onProgress: (message) => {
|
|
11217
|
-
console.log(
|
|
10889
|
+
console.log(chalk14.dim(message));
|
|
11218
10890
|
},
|
|
11219
10891
|
force: options.force
|
|
11220
10892
|
});
|
|
11221
10893
|
const shortVersion = result.versionId.slice(0, 8);
|
|
11222
10894
|
if (result.empty) {
|
|
11223
|
-
console.log(
|
|
10895
|
+
console.log(chalk14.dim("No files found (empty volume)"));
|
|
11224
10896
|
} else if (result.deduplicated) {
|
|
11225
|
-
console.log(
|
|
10897
|
+
console.log(chalk14.green("\u2713 Content unchanged (deduplicated)"));
|
|
11226
10898
|
} else {
|
|
11227
|
-
console.log(
|
|
10899
|
+
console.log(chalk14.green("\u2713 Upload complete"));
|
|
11228
10900
|
}
|
|
11229
|
-
console.log(
|
|
11230
|
-
console.log(
|
|
11231
|
-
console.log(
|
|
10901
|
+
console.log(chalk14.dim(` Version: ${shortVersion}`));
|
|
10902
|
+
console.log(chalk14.dim(` Files: ${result.fileCount.toLocaleString()}`));
|
|
10903
|
+
console.log(chalk14.dim(` Size: ${formatBytes(result.size)}`));
|
|
11232
10904
|
})
|
|
11233
10905
|
);
|
|
11234
10906
|
|
|
11235
10907
|
// src/commands/volume/pull.ts
|
|
11236
10908
|
import { Command as Command16 } from "commander";
|
|
11237
|
-
import
|
|
10909
|
+
import chalk16 from "chalk";
|
|
11238
10910
|
import path8 from "path";
|
|
11239
10911
|
import * as fs7 from "fs";
|
|
11240
10912
|
import * as os5 from "os";
|
|
11241
10913
|
import * as tar3 from "tar";
|
|
11242
10914
|
|
|
11243
10915
|
// src/lib/storage/pull-utils.ts
|
|
11244
|
-
import
|
|
10916
|
+
import chalk15 from "chalk";
|
|
11245
10917
|
async function handleEmptyStorageResponse(cwd) {
|
|
11246
|
-
console.log(
|
|
10918
|
+
console.log(chalk15.dim("Syncing local files..."));
|
|
11247
10919
|
const removedCount = await removeExtraFiles(cwd, /* @__PURE__ */ new Set());
|
|
11248
10920
|
if (removedCount > 0) {
|
|
11249
|
-
console.log(
|
|
10921
|
+
console.log(chalk15.green(`\u2713 Removed ${removedCount} files not in remote`));
|
|
11250
10922
|
}
|
|
11251
|
-
console.log(
|
|
10923
|
+
console.log(chalk15.green("\u2713 Synced (0 files)"));
|
|
11252
10924
|
return { removedCount };
|
|
11253
10925
|
}
|
|
11254
10926
|
|
|
@@ -11267,7 +10939,7 @@ var pullCommand = new Command16().name("pull").description("Pull cloud files to
|
|
|
11267
10939
|
} else {
|
|
11268
10940
|
console.log(`Pulling volume: ${config.name}`);
|
|
11269
10941
|
}
|
|
11270
|
-
console.log(
|
|
10942
|
+
console.log(chalk16.dim("Getting download URL..."));
|
|
11271
10943
|
const downloadInfo = await getStorageDownload({
|
|
11272
10944
|
name: config.name,
|
|
11273
10945
|
type: "volume",
|
|
@@ -11281,18 +10953,18 @@ var pullCommand = new Command16().name("pull").description("Pull cloud files to
|
|
|
11281
10953
|
if (!downloadUrl) {
|
|
11282
10954
|
throw new Error("No download URL returned");
|
|
11283
10955
|
}
|
|
11284
|
-
console.log(
|
|
10956
|
+
console.log(chalk16.dim("Downloading from S3..."));
|
|
11285
10957
|
const s3Response = await fetch(downloadUrl);
|
|
11286
10958
|
if (!s3Response.ok) {
|
|
11287
10959
|
throw new Error(`S3 download failed: ${s3Response.status}`);
|
|
11288
10960
|
}
|
|
11289
10961
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
11290
10962
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
11291
|
-
console.log(
|
|
10963
|
+
console.log(chalk16.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
11292
10964
|
const tmpDir = fs7.mkdtempSync(path8.join(os5.tmpdir(), "vm0-"));
|
|
11293
10965
|
const tarPath = path8.join(tmpDir, "volume.tar.gz");
|
|
11294
10966
|
await fs7.promises.writeFile(tarPath, tarBuffer);
|
|
11295
|
-
console.log(
|
|
10967
|
+
console.log(chalk16.dim("Syncing local files..."));
|
|
11296
10968
|
const remoteFiles = await listTarFiles(tarPath);
|
|
11297
10969
|
const remoteFilesSet = new Set(
|
|
11298
10970
|
remoteFiles.map((f) => f.replace(/\\/g, "/"))
|
|
@@ -11300,10 +10972,10 @@ var pullCommand = new Command16().name("pull").description("Pull cloud files to
|
|
|
11300
10972
|
const removedCount = await removeExtraFiles(cwd, remoteFilesSet);
|
|
11301
10973
|
if (removedCount > 0) {
|
|
11302
10974
|
console.log(
|
|
11303
|
-
|
|
10975
|
+
chalk16.green(`\u2713 Removed ${removedCount} files not in remote`)
|
|
11304
10976
|
);
|
|
11305
10977
|
}
|
|
11306
|
-
console.log(
|
|
10978
|
+
console.log(chalk16.dim("Extracting files..."));
|
|
11307
10979
|
await tar3.extract({
|
|
11308
10980
|
file: tarPath,
|
|
11309
10981
|
cwd,
|
|
@@ -11311,13 +10983,13 @@ var pullCommand = new Command16().name("pull").description("Pull cloud files to
|
|
|
11311
10983
|
});
|
|
11312
10984
|
await fs7.promises.unlink(tarPath);
|
|
11313
10985
|
await fs7.promises.rmdir(tmpDir);
|
|
11314
|
-
console.log(
|
|
10986
|
+
console.log(chalk16.green(`\u2713 Extracted ${remoteFiles.length} files`));
|
|
11315
10987
|
})
|
|
11316
10988
|
);
|
|
11317
10989
|
|
|
11318
10990
|
// src/commands/volume/status.ts
|
|
11319
10991
|
import { Command as Command17 } from "commander";
|
|
11320
|
-
import
|
|
10992
|
+
import chalk17 from "chalk";
|
|
11321
10993
|
var statusCommand2 = new Command17().name("status").description("Show status of cloud volume").action(
|
|
11322
10994
|
withErrorHandler(async () => {
|
|
11323
10995
|
const cwd = process.cwd();
|
|
@@ -11341,13 +11013,13 @@ var statusCommand2 = new Command17().name("status").description("Show status of
|
|
|
11341
11013
|
});
|
|
11342
11014
|
const shortVersion = info.versionId.slice(0, 8);
|
|
11343
11015
|
if ("empty" in info) {
|
|
11344
|
-
console.log(
|
|
11345
|
-
console.log(
|
|
11016
|
+
console.log(chalk17.green("\u2713 Found (empty)"));
|
|
11017
|
+
console.log(chalk17.dim(` Version: ${shortVersion}`));
|
|
11346
11018
|
} else {
|
|
11347
|
-
console.log(
|
|
11348
|
-
console.log(
|
|
11349
|
-
console.log(
|
|
11350
|
-
console.log(
|
|
11019
|
+
console.log(chalk17.green("\u2713 Found"));
|
|
11020
|
+
console.log(chalk17.dim(` Version: ${shortVersion}`));
|
|
11021
|
+
console.log(chalk17.dim(` Files: ${info.fileCount.toLocaleString()}`));
|
|
11022
|
+
console.log(chalk17.dim(` Size: ${formatBytes(info.size)}`));
|
|
11351
11023
|
}
|
|
11352
11024
|
} catch (error) {
|
|
11353
11025
|
if (error instanceof ApiRequestError && error.status === 404) {
|
|
@@ -11362,14 +11034,14 @@ var statusCommand2 = new Command17().name("status").description("Show status of
|
|
|
11362
11034
|
|
|
11363
11035
|
// src/commands/volume/list.ts
|
|
11364
11036
|
import { Command as Command18 } from "commander";
|
|
11365
|
-
import
|
|
11037
|
+
import chalk18 from "chalk";
|
|
11366
11038
|
var listCommand2 = new Command18().name("list").alias("ls").description("List all remote volumes").action(
|
|
11367
11039
|
withErrorHandler(async () => {
|
|
11368
11040
|
const items = await listStorages({ type: "volume" });
|
|
11369
11041
|
if (items.length === 0) {
|
|
11370
|
-
console.log(
|
|
11042
|
+
console.log(chalk18.dim("No volumes found"));
|
|
11371
11043
|
console.log(
|
|
11372
|
-
|
|
11044
|
+
chalk18.dim(" Create one with: vm0 volume init && vm0 volume push")
|
|
11373
11045
|
);
|
|
11374
11046
|
return;
|
|
11375
11047
|
}
|
|
@@ -11388,7 +11060,7 @@ var listCommand2 = new Command18().name("list").alias("ls").description("List al
|
|
|
11388
11060
|
"FILES".padStart(filesWidth),
|
|
11389
11061
|
"UPDATED"
|
|
11390
11062
|
].join(" ");
|
|
11391
|
-
console.log(
|
|
11063
|
+
console.log(chalk18.dim(header));
|
|
11392
11064
|
for (const item of items) {
|
|
11393
11065
|
const row = [
|
|
11394
11066
|
item.name.padEnd(nameWidth),
|
|
@@ -11403,10 +11075,10 @@ var listCommand2 = new Command18().name("list").alias("ls").description("List al
|
|
|
11403
11075
|
|
|
11404
11076
|
// src/commands/volume/clone.ts
|
|
11405
11077
|
import { Command as Command19 } from "commander";
|
|
11406
|
-
import
|
|
11078
|
+
import chalk20 from "chalk";
|
|
11407
11079
|
|
|
11408
11080
|
// src/lib/storage/clone-utils.ts
|
|
11409
|
-
import
|
|
11081
|
+
import chalk19 from "chalk";
|
|
11410
11082
|
import path9 from "path";
|
|
11411
11083
|
import * as fs8 from "fs";
|
|
11412
11084
|
import * as os6 from "os";
|
|
@@ -11417,18 +11089,18 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
11417
11089
|
if (dirStatus.exists && !dirStatus.empty) {
|
|
11418
11090
|
throw new Error(`Directory "${destination}" is not empty`);
|
|
11419
11091
|
}
|
|
11420
|
-
console.log(
|
|
11092
|
+
console.log(chalk19.dim(`Checking remote ${typeLabel}...`));
|
|
11421
11093
|
const downloadInfo = await getStorageDownload({
|
|
11422
11094
|
name,
|
|
11423
11095
|
type: type2,
|
|
11424
11096
|
version: options.version
|
|
11425
11097
|
});
|
|
11426
|
-
console.log(
|
|
11098
|
+
console.log(chalk19.dim(`Creating directory: ${destination}/`));
|
|
11427
11099
|
await fs8.promises.mkdir(destination, { recursive: true });
|
|
11428
11100
|
if ("empty" in downloadInfo) {
|
|
11429
11101
|
await writeStorageConfig(name, destination, type2);
|
|
11430
|
-
console.log(
|
|
11431
|
-
console.log(
|
|
11102
|
+
console.log(chalk19.green(`\u2713 Cloned empty ${typeLabel}: ${name}`));
|
|
11103
|
+
console.log(chalk19.dim(`\u2713 Initialized .vm0/storage.yaml`));
|
|
11432
11104
|
return {
|
|
11433
11105
|
success: true,
|
|
11434
11106
|
fileCount: 0,
|
|
@@ -11440,7 +11112,7 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
11440
11112
|
if (!downloadUrl) {
|
|
11441
11113
|
throw new Error("No download URL returned");
|
|
11442
11114
|
}
|
|
11443
|
-
console.log(
|
|
11115
|
+
console.log(chalk19.dim("Downloading from S3..."));
|
|
11444
11116
|
const s3Response = await fetch(downloadUrl);
|
|
11445
11117
|
if (!s3Response.ok) {
|
|
11446
11118
|
await fs8.promises.rm(destination, { recursive: true, force: true });
|
|
@@ -11448,12 +11120,12 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
11448
11120
|
}
|
|
11449
11121
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
11450
11122
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
11451
|
-
console.log(
|
|
11123
|
+
console.log(chalk19.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
11452
11124
|
const tmpDir = fs8.mkdtempSync(path9.join(os6.tmpdir(), "vm0-clone-"));
|
|
11453
11125
|
const tarPath = path9.join(tmpDir, "archive.tar.gz");
|
|
11454
11126
|
await fs8.promises.writeFile(tarPath, tarBuffer);
|
|
11455
11127
|
const files = await listTarFiles(tarPath);
|
|
11456
|
-
console.log(
|
|
11128
|
+
console.log(chalk19.dim("Extracting files..."));
|
|
11457
11129
|
await tar4.extract({
|
|
11458
11130
|
file: tarPath,
|
|
11459
11131
|
cwd: destination,
|
|
@@ -11461,9 +11133,9 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
11461
11133
|
});
|
|
11462
11134
|
await fs8.promises.unlink(tarPath);
|
|
11463
11135
|
await fs8.promises.rmdir(tmpDir);
|
|
11464
|
-
console.log(
|
|
11136
|
+
console.log(chalk19.green(`\u2713 Extracted ${files.length} files`));
|
|
11465
11137
|
await writeStorageConfig(name, destination, type2);
|
|
11466
|
-
console.log(
|
|
11138
|
+
console.log(chalk19.green(`\u2713 Initialized .vm0/storage.yaml`));
|
|
11467
11139
|
return {
|
|
11468
11140
|
success: true,
|
|
11469
11141
|
fileCount: downloadInfo.fileCount,
|
|
@@ -11478,10 +11150,10 @@ var cloneCommand = new Command19().name("clone").description("Clone a remote vol
|
|
|
11478
11150
|
const targetDir = destination || name;
|
|
11479
11151
|
console.log(`Cloning volume: ${name}`);
|
|
11480
11152
|
const result = await cloneStorage(name, "volume", targetDir);
|
|
11481
|
-
console.log(
|
|
11153
|
+
console.log(chalk20.green(`
|
|
11482
11154
|
\u2713 Successfully cloned volume: ${name}`));
|
|
11483
|
-
console.log(
|
|
11484
|
-
console.log(
|
|
11155
|
+
console.log(chalk20.dim(` Location: ${targetDir}/`));
|
|
11156
|
+
console.log(chalk20.dim(` Version: ${result.versionId.slice(0, 8)}`));
|
|
11485
11157
|
})
|
|
11486
11158
|
);
|
|
11487
11159
|
|
|
@@ -11493,7 +11165,7 @@ import { Command as Command27 } from "commander";
|
|
|
11493
11165
|
|
|
11494
11166
|
// src/commands/artifact/init.ts
|
|
11495
11167
|
import { Command as Command21 } from "commander";
|
|
11496
|
-
import
|
|
11168
|
+
import chalk21 from "chalk";
|
|
11497
11169
|
import path10 from "path";
|
|
11498
11170
|
var initCommand2 = new Command21().name("init").description("Initialize an artifact in the current directory").option(
|
|
11499
11171
|
"-n, --name <name>",
|
|
@@ -11506,24 +11178,24 @@ var initCommand2 = new Command21().name("init").description("Initialize an artif
|
|
|
11506
11178
|
if (existingConfig) {
|
|
11507
11179
|
if (existingConfig.type === "artifact") {
|
|
11508
11180
|
console.log(
|
|
11509
|
-
|
|
11181
|
+
chalk21.yellow(
|
|
11510
11182
|
`Artifact already initialized: ${existingConfig.name}`
|
|
11511
11183
|
)
|
|
11512
11184
|
);
|
|
11513
11185
|
} else {
|
|
11514
11186
|
console.log(
|
|
11515
|
-
|
|
11187
|
+
chalk21.yellow(
|
|
11516
11188
|
`Directory already initialized as volume: ${existingConfig.name}`
|
|
11517
11189
|
)
|
|
11518
11190
|
);
|
|
11519
11191
|
console.log(
|
|
11520
|
-
|
|
11192
|
+
chalk21.dim(
|
|
11521
11193
|
" To change type, delete .vm0/storage.yaml and reinitialize"
|
|
11522
11194
|
)
|
|
11523
11195
|
);
|
|
11524
11196
|
}
|
|
11525
11197
|
console.log(
|
|
11526
|
-
|
|
11198
|
+
chalk21.dim(`Config file: ${path10.join(cwd, ".vm0", "storage.yaml")}`)
|
|
11527
11199
|
);
|
|
11528
11200
|
return;
|
|
11529
11201
|
}
|
|
@@ -11547,7 +11219,7 @@ var initCommand2 = new Command21().name("init").description("Initialize an artif
|
|
|
11547
11219
|
}
|
|
11548
11220
|
);
|
|
11549
11221
|
if (name === void 0) {
|
|
11550
|
-
console.log(
|
|
11222
|
+
console.log(chalk21.dim("Cancelled"));
|
|
11551
11223
|
return;
|
|
11552
11224
|
}
|
|
11553
11225
|
artifactName = name;
|
|
@@ -11560,9 +11232,9 @@ var initCommand2 = new Command21().name("init").description("Initialize an artif
|
|
|
11560
11232
|
});
|
|
11561
11233
|
}
|
|
11562
11234
|
await writeStorageConfig(artifactName, cwd, "artifact");
|
|
11563
|
-
console.log(
|
|
11235
|
+
console.log(chalk21.green(`\u2713 Initialized artifact: ${artifactName}`));
|
|
11564
11236
|
console.log(
|
|
11565
|
-
|
|
11237
|
+
chalk21.dim(
|
|
11566
11238
|
` Config saved to ${path10.join(cwd, ".vm0", "storage.yaml")}`
|
|
11567
11239
|
)
|
|
11568
11240
|
);
|
|
@@ -11571,7 +11243,7 @@ var initCommand2 = new Command21().name("init").description("Initialize an artif
|
|
|
11571
11243
|
|
|
11572
11244
|
// src/commands/artifact/push.ts
|
|
11573
11245
|
import { Command as Command22 } from "commander";
|
|
11574
|
-
import
|
|
11246
|
+
import chalk22 from "chalk";
|
|
11575
11247
|
var pushCommand2 = new Command22().name("push").description("Push local files to cloud artifact").option(
|
|
11576
11248
|
"-f, --force",
|
|
11577
11249
|
"Force upload even if content unchanged (recreate archive)"
|
|
@@ -11593,27 +11265,27 @@ var pushCommand2 = new Command22().name("push").description("Push local files to
|
|
|
11593
11265
|
console.log(`Pushing artifact: ${config.name}`);
|
|
11594
11266
|
const result = await directUpload(config.name, "artifact", cwd, {
|
|
11595
11267
|
onProgress: (message) => {
|
|
11596
|
-
console.log(
|
|
11268
|
+
console.log(chalk22.dim(message));
|
|
11597
11269
|
},
|
|
11598
11270
|
force: options.force
|
|
11599
11271
|
});
|
|
11600
11272
|
const shortVersion = result.versionId.slice(0, 8);
|
|
11601
11273
|
if (result.empty) {
|
|
11602
|
-
console.log(
|
|
11274
|
+
console.log(chalk22.dim("No files found (empty artifact)"));
|
|
11603
11275
|
} else if (result.deduplicated) {
|
|
11604
|
-
console.log(
|
|
11276
|
+
console.log(chalk22.green("\u2713 Content unchanged (deduplicated)"));
|
|
11605
11277
|
} else {
|
|
11606
|
-
console.log(
|
|
11278
|
+
console.log(chalk22.green("\u2713 Upload complete"));
|
|
11607
11279
|
}
|
|
11608
|
-
console.log(
|
|
11609
|
-
console.log(
|
|
11610
|
-
console.log(
|
|
11280
|
+
console.log(chalk22.dim(` Version: ${shortVersion}`));
|
|
11281
|
+
console.log(chalk22.dim(` Files: ${result.fileCount.toLocaleString()}`));
|
|
11282
|
+
console.log(chalk22.dim(` Size: ${formatBytes(result.size)}`));
|
|
11611
11283
|
})
|
|
11612
11284
|
);
|
|
11613
11285
|
|
|
11614
11286
|
// src/commands/artifact/pull.ts
|
|
11615
11287
|
import { Command as Command23 } from "commander";
|
|
11616
|
-
import
|
|
11288
|
+
import chalk23 from "chalk";
|
|
11617
11289
|
import path11 from "path";
|
|
11618
11290
|
import * as fs9 from "fs";
|
|
11619
11291
|
import * as os7 from "os";
|
|
@@ -11638,7 +11310,7 @@ var pullCommand2 = new Command23().name("pull").description("Pull cloud artifact
|
|
|
11638
11310
|
} else {
|
|
11639
11311
|
console.log(`Pulling artifact: ${config.name}`);
|
|
11640
11312
|
}
|
|
11641
|
-
console.log(
|
|
11313
|
+
console.log(chalk23.dim("Getting download URL..."));
|
|
11642
11314
|
const downloadInfo = await getStorageDownload({
|
|
11643
11315
|
name: config.name,
|
|
11644
11316
|
type: "artifact",
|
|
@@ -11652,18 +11324,18 @@ var pullCommand2 = new Command23().name("pull").description("Pull cloud artifact
|
|
|
11652
11324
|
if (!downloadUrl) {
|
|
11653
11325
|
throw new Error("No download URL returned");
|
|
11654
11326
|
}
|
|
11655
|
-
console.log(
|
|
11327
|
+
console.log(chalk23.dim("Downloading from S3..."));
|
|
11656
11328
|
const s3Response = await fetch(downloadUrl);
|
|
11657
11329
|
if (!s3Response.ok) {
|
|
11658
11330
|
throw new Error(`S3 download failed: ${s3Response.status}`);
|
|
11659
11331
|
}
|
|
11660
11332
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
11661
11333
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
11662
|
-
console.log(
|
|
11334
|
+
console.log(chalk23.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
11663
11335
|
const tmpDir = fs9.mkdtempSync(path11.join(os7.tmpdir(), "vm0-"));
|
|
11664
11336
|
const tarPath = path11.join(tmpDir, "artifact.tar.gz");
|
|
11665
11337
|
await fs9.promises.writeFile(tarPath, tarBuffer);
|
|
11666
|
-
console.log(
|
|
11338
|
+
console.log(chalk23.dim("Syncing local files..."));
|
|
11667
11339
|
const remoteFiles = await listTarFiles(tarPath);
|
|
11668
11340
|
const remoteFilesSet = new Set(
|
|
11669
11341
|
remoteFiles.map((f) => f.replace(/\\/g, "/"))
|
|
@@ -11671,10 +11343,10 @@ var pullCommand2 = new Command23().name("pull").description("Pull cloud artifact
|
|
|
11671
11343
|
const removedCount = await removeExtraFiles(cwd, remoteFilesSet);
|
|
11672
11344
|
if (removedCount > 0) {
|
|
11673
11345
|
console.log(
|
|
11674
|
-
|
|
11346
|
+
chalk23.green(`\u2713 Removed ${removedCount} files not in remote`)
|
|
11675
11347
|
);
|
|
11676
11348
|
}
|
|
11677
|
-
console.log(
|
|
11349
|
+
console.log(chalk23.dim("Extracting files..."));
|
|
11678
11350
|
await tar5.extract({
|
|
11679
11351
|
file: tarPath,
|
|
11680
11352
|
cwd,
|
|
@@ -11682,13 +11354,13 @@ var pullCommand2 = new Command23().name("pull").description("Pull cloud artifact
|
|
|
11682
11354
|
});
|
|
11683
11355
|
await fs9.promises.unlink(tarPath);
|
|
11684
11356
|
await fs9.promises.rmdir(tmpDir);
|
|
11685
|
-
console.log(
|
|
11357
|
+
console.log(chalk23.green(`\u2713 Extracted ${remoteFiles.length} files`));
|
|
11686
11358
|
})
|
|
11687
11359
|
);
|
|
11688
11360
|
|
|
11689
11361
|
// src/commands/artifact/status.ts
|
|
11690
11362
|
import { Command as Command24 } from "commander";
|
|
11691
|
-
import
|
|
11363
|
+
import chalk24 from "chalk";
|
|
11692
11364
|
var statusCommand3 = new Command24().name("status").description("Show status of cloud artifact").action(
|
|
11693
11365
|
withErrorHandler(async () => {
|
|
11694
11366
|
const cwd = process.cwd();
|
|
@@ -11712,13 +11384,13 @@ var statusCommand3 = new Command24().name("status").description("Show status of
|
|
|
11712
11384
|
});
|
|
11713
11385
|
const shortVersion = info.versionId.slice(0, 8);
|
|
11714
11386
|
if ("empty" in info) {
|
|
11715
|
-
console.log(
|
|
11716
|
-
console.log(
|
|
11387
|
+
console.log(chalk24.green("\u2713 Found (empty)"));
|
|
11388
|
+
console.log(chalk24.dim(` Version: ${shortVersion}`));
|
|
11717
11389
|
} else {
|
|
11718
|
-
console.log(
|
|
11719
|
-
console.log(
|
|
11720
|
-
console.log(
|
|
11721
|
-
console.log(
|
|
11390
|
+
console.log(chalk24.green("\u2713 Found"));
|
|
11391
|
+
console.log(chalk24.dim(` Version: ${shortVersion}`));
|
|
11392
|
+
console.log(chalk24.dim(` Files: ${info.fileCount.toLocaleString()}`));
|
|
11393
|
+
console.log(chalk24.dim(` Size: ${formatBytes(info.size)}`));
|
|
11722
11394
|
}
|
|
11723
11395
|
} catch (error) {
|
|
11724
11396
|
if (error instanceof ApiRequestError && error.status === 404) {
|
|
@@ -11733,14 +11405,14 @@ var statusCommand3 = new Command24().name("status").description("Show status of
|
|
|
11733
11405
|
|
|
11734
11406
|
// src/commands/artifact/list.ts
|
|
11735
11407
|
import { Command as Command25 } from "commander";
|
|
11736
|
-
import
|
|
11408
|
+
import chalk25 from "chalk";
|
|
11737
11409
|
var listCommand3 = new Command25().name("list").alias("ls").description("List all remote artifacts").action(
|
|
11738
11410
|
withErrorHandler(async () => {
|
|
11739
11411
|
const items = await listStorages({ type: "artifact" });
|
|
11740
11412
|
if (items.length === 0) {
|
|
11741
|
-
console.log(
|
|
11413
|
+
console.log(chalk25.dim("No artifacts found"));
|
|
11742
11414
|
console.log(
|
|
11743
|
-
|
|
11415
|
+
chalk25.dim(
|
|
11744
11416
|
" Create one with: vm0 artifact init && vm0 artifact push"
|
|
11745
11417
|
)
|
|
11746
11418
|
);
|
|
@@ -11761,7 +11433,7 @@ var listCommand3 = new Command25().name("list").alias("ls").description("List al
|
|
|
11761
11433
|
"FILES".padStart(filesWidth),
|
|
11762
11434
|
"UPDATED"
|
|
11763
11435
|
].join(" ");
|
|
11764
|
-
console.log(
|
|
11436
|
+
console.log(chalk25.dim(header));
|
|
11765
11437
|
for (const item of items) {
|
|
11766
11438
|
const row = [
|
|
11767
11439
|
item.name.padEnd(nameWidth),
|
|
@@ -11776,16 +11448,16 @@ var listCommand3 = new Command25().name("list").alias("ls").description("List al
|
|
|
11776
11448
|
|
|
11777
11449
|
// src/commands/artifact/clone.ts
|
|
11778
11450
|
import { Command as Command26 } from "commander";
|
|
11779
|
-
import
|
|
11451
|
+
import chalk26 from "chalk";
|
|
11780
11452
|
var cloneCommand2 = new Command26().name("clone").description("Clone a remote artifact to local directory (latest version)").argument("<name>", "Artifact name to clone").argument("[destination]", "Destination directory (default: artifact name)").action(
|
|
11781
11453
|
withErrorHandler(async (name, destination) => {
|
|
11782
11454
|
const targetDir = destination || name;
|
|
11783
11455
|
console.log(`Cloning artifact: ${name}`);
|
|
11784
11456
|
const result = await cloneStorage(name, "artifact", targetDir);
|
|
11785
|
-
console.log(
|
|
11457
|
+
console.log(chalk26.green(`
|
|
11786
11458
|
\u2713 Successfully cloned artifact: ${name}`));
|
|
11787
|
-
console.log(
|
|
11788
|
-
console.log(
|
|
11459
|
+
console.log(chalk26.dim(` Location: ${targetDir}/`));
|
|
11460
|
+
console.log(chalk26.dim(` Version: ${result.versionId.slice(0, 8)}`));
|
|
11789
11461
|
})
|
|
11790
11462
|
);
|
|
11791
11463
|
|
|
@@ -11797,7 +11469,7 @@ import { Command as Command34 } from "commander";
|
|
|
11797
11469
|
|
|
11798
11470
|
// src/commands/memory/init.ts
|
|
11799
11471
|
import { Command as Command28 } from "commander";
|
|
11800
|
-
import
|
|
11472
|
+
import chalk27 from "chalk";
|
|
11801
11473
|
import path12 from "path";
|
|
11802
11474
|
var initCommand3 = new Command28().name("init").description("Initialize a memory in the current directory").option("-n, --name <name>", "Memory name (required in non-interactive mode)").action(
|
|
11803
11475
|
withErrorHandler(async (options) => {
|
|
@@ -11807,22 +11479,22 @@ var initCommand3 = new Command28().name("init").description("Initialize a memory
|
|
|
11807
11479
|
if (existingConfig) {
|
|
11808
11480
|
if (existingConfig.type === "memory") {
|
|
11809
11481
|
console.log(
|
|
11810
|
-
|
|
11482
|
+
chalk27.yellow(`Memory already initialized: ${existingConfig.name}`)
|
|
11811
11483
|
);
|
|
11812
11484
|
} else {
|
|
11813
11485
|
console.log(
|
|
11814
|
-
|
|
11486
|
+
chalk27.yellow(
|
|
11815
11487
|
`Directory already initialized as ${existingConfig.type}: ${existingConfig.name}`
|
|
11816
11488
|
)
|
|
11817
11489
|
);
|
|
11818
11490
|
console.log(
|
|
11819
|
-
|
|
11491
|
+
chalk27.dim(
|
|
11820
11492
|
" To change type, delete .vm0/storage.yaml and reinitialize"
|
|
11821
11493
|
)
|
|
11822
11494
|
);
|
|
11823
11495
|
}
|
|
11824
11496
|
console.log(
|
|
11825
|
-
|
|
11497
|
+
chalk27.dim(`Config file: ${path12.join(cwd, ".vm0", "storage.yaml")}`)
|
|
11826
11498
|
);
|
|
11827
11499
|
return;
|
|
11828
11500
|
}
|
|
@@ -11846,7 +11518,7 @@ var initCommand3 = new Command28().name("init").description("Initialize a memory
|
|
|
11846
11518
|
}
|
|
11847
11519
|
);
|
|
11848
11520
|
if (name === void 0) {
|
|
11849
|
-
console.log(
|
|
11521
|
+
console.log(chalk27.dim("Cancelled"));
|
|
11850
11522
|
return;
|
|
11851
11523
|
}
|
|
11852
11524
|
memoryName = name;
|
|
@@ -11859,9 +11531,9 @@ var initCommand3 = new Command28().name("init").description("Initialize a memory
|
|
|
11859
11531
|
});
|
|
11860
11532
|
}
|
|
11861
11533
|
await writeStorageConfig(memoryName, cwd, "memory");
|
|
11862
|
-
console.log(
|
|
11534
|
+
console.log(chalk27.green(`\u2713 Initialized memory: ${memoryName}`));
|
|
11863
11535
|
console.log(
|
|
11864
|
-
|
|
11536
|
+
chalk27.dim(
|
|
11865
11537
|
` Config saved to ${path12.join(cwd, ".vm0", "storage.yaml")}`
|
|
11866
11538
|
)
|
|
11867
11539
|
);
|
|
@@ -11870,7 +11542,7 @@ var initCommand3 = new Command28().name("init").description("Initialize a memory
|
|
|
11870
11542
|
|
|
11871
11543
|
// src/commands/memory/push.ts
|
|
11872
11544
|
import { Command as Command29 } from "commander";
|
|
11873
|
-
import
|
|
11545
|
+
import chalk28 from "chalk";
|
|
11874
11546
|
var pushCommand3 = new Command29().name("push").description("Push local files to cloud memory").option(
|
|
11875
11547
|
"-f, --force",
|
|
11876
11548
|
"Force upload even if content unchanged (recreate archive)"
|
|
@@ -11892,42 +11564,42 @@ var pushCommand3 = new Command29().name("push").description("Push local files to
|
|
|
11892
11564
|
console.log(`Pushing memory: ${config.name}`);
|
|
11893
11565
|
const result = await directUpload(config.name, "memory", cwd, {
|
|
11894
11566
|
onProgress: (message) => {
|
|
11895
|
-
console.log(
|
|
11567
|
+
console.log(chalk28.dim(message));
|
|
11896
11568
|
},
|
|
11897
11569
|
force: options.force
|
|
11898
11570
|
});
|
|
11899
11571
|
const shortVersion = result.versionId.slice(0, 8);
|
|
11900
11572
|
if (result.empty) {
|
|
11901
|
-
console.log(
|
|
11573
|
+
console.log(chalk28.dim("No files found (empty memory)"));
|
|
11902
11574
|
} else if (result.deduplicated) {
|
|
11903
|
-
console.log(
|
|
11575
|
+
console.log(chalk28.green("\u2713 Content unchanged (deduplicated)"));
|
|
11904
11576
|
} else {
|
|
11905
|
-
console.log(
|
|
11577
|
+
console.log(chalk28.green("\u2713 Upload complete"));
|
|
11906
11578
|
}
|
|
11907
|
-
console.log(
|
|
11908
|
-
console.log(
|
|
11909
|
-
console.log(
|
|
11579
|
+
console.log(chalk28.dim(` Version: ${shortVersion}`));
|
|
11580
|
+
console.log(chalk28.dim(` Files: ${result.fileCount.toLocaleString()}`));
|
|
11581
|
+
console.log(chalk28.dim(` Size: ${formatBytes(result.size)}`));
|
|
11910
11582
|
})
|
|
11911
11583
|
);
|
|
11912
11584
|
|
|
11913
11585
|
// src/commands/memory/pull.ts
|
|
11914
11586
|
import { Command as Command30 } from "commander";
|
|
11915
|
-
import
|
|
11587
|
+
import chalk29 from "chalk";
|
|
11916
11588
|
var pullCommand3 = new Command30().name("pull").description("Pull remote memory to local directory (latest version)").argument("[name]", "Memory name to pull", "memory").argument("[destination]", "Destination directory (default: memory name)").action(
|
|
11917
11589
|
withErrorHandler(async (name, destination) => {
|
|
11918
11590
|
const targetDir = destination || name;
|
|
11919
11591
|
console.log(`Pulling memory: ${name}`);
|
|
11920
11592
|
const result = await cloneStorage(name, "memory", targetDir);
|
|
11921
|
-
console.log(
|
|
11593
|
+
console.log(chalk29.green(`
|
|
11922
11594
|
\u2713 Successfully pulled memory: ${name}`));
|
|
11923
|
-
console.log(
|
|
11924
|
-
console.log(
|
|
11595
|
+
console.log(chalk29.dim(` Location: ${targetDir}/`));
|
|
11596
|
+
console.log(chalk29.dim(` Version: ${result.versionId.slice(0, 8)}`));
|
|
11925
11597
|
})
|
|
11926
11598
|
);
|
|
11927
11599
|
|
|
11928
11600
|
// src/commands/memory/status.ts
|
|
11929
11601
|
import { Command as Command31 } from "commander";
|
|
11930
|
-
import
|
|
11602
|
+
import chalk30 from "chalk";
|
|
11931
11603
|
var statusCommand4 = new Command31().name("status").description("Show status of cloud memory").action(
|
|
11932
11604
|
withErrorHandler(async () => {
|
|
11933
11605
|
const cwd = process.cwd();
|
|
@@ -11951,13 +11623,13 @@ var statusCommand4 = new Command31().name("status").description("Show status of
|
|
|
11951
11623
|
});
|
|
11952
11624
|
const shortVersion = info.versionId.slice(0, 8);
|
|
11953
11625
|
if ("empty" in info) {
|
|
11954
|
-
console.log(
|
|
11955
|
-
console.log(
|
|
11626
|
+
console.log(chalk30.green("\u2713 Found (empty)"));
|
|
11627
|
+
console.log(chalk30.dim(` Version: ${shortVersion}`));
|
|
11956
11628
|
} else {
|
|
11957
|
-
console.log(
|
|
11958
|
-
console.log(
|
|
11959
|
-
console.log(
|
|
11960
|
-
console.log(
|
|
11629
|
+
console.log(chalk30.green("\u2713 Found"));
|
|
11630
|
+
console.log(chalk30.dim(` Version: ${shortVersion}`));
|
|
11631
|
+
console.log(chalk30.dim(` Files: ${info.fileCount.toLocaleString()}`));
|
|
11632
|
+
console.log(chalk30.dim(` Size: ${formatBytes(info.size)}`));
|
|
11961
11633
|
}
|
|
11962
11634
|
} catch (error) {
|
|
11963
11635
|
if (error instanceof ApiRequestError && error.status === 404) {
|
|
@@ -11972,14 +11644,14 @@ var statusCommand4 = new Command31().name("status").description("Show status of
|
|
|
11972
11644
|
|
|
11973
11645
|
// src/commands/memory/list.ts
|
|
11974
11646
|
import { Command as Command32 } from "commander";
|
|
11975
|
-
import
|
|
11647
|
+
import chalk31 from "chalk";
|
|
11976
11648
|
var listCommand4 = new Command32().name("list").alias("ls").description("List all remote memory storages").action(
|
|
11977
11649
|
withErrorHandler(async () => {
|
|
11978
11650
|
const items = await listStorages({ type: "memory" });
|
|
11979
11651
|
if (items.length === 0) {
|
|
11980
|
-
console.log(
|
|
11652
|
+
console.log(chalk31.dim("No memory storages found"));
|
|
11981
11653
|
console.log(
|
|
11982
|
-
|
|
11654
|
+
chalk31.dim(" Memory is created automatically on first agent run")
|
|
11983
11655
|
);
|
|
11984
11656
|
return;
|
|
11985
11657
|
}
|
|
@@ -11998,7 +11670,7 @@ var listCommand4 = new Command32().name("list").alias("ls").description("List al
|
|
|
11998
11670
|
"FILES".padStart(filesWidth),
|
|
11999
11671
|
"UPDATED"
|
|
12000
11672
|
].join(" ");
|
|
12001
|
-
console.log(
|
|
11673
|
+
console.log(chalk31.dim(header));
|
|
12002
11674
|
for (const item of items) {
|
|
12003
11675
|
const row = [
|
|
12004
11676
|
item.name.padEnd(nameWidth),
|
|
@@ -12013,16 +11685,16 @@ var listCommand4 = new Command32().name("list").alias("ls").description("List al
|
|
|
12013
11685
|
|
|
12014
11686
|
// src/commands/memory/clone.ts
|
|
12015
11687
|
import { Command as Command33 } from "commander";
|
|
12016
|
-
import
|
|
11688
|
+
import chalk32 from "chalk";
|
|
12017
11689
|
var cloneCommand3 = new Command33().name("clone").description("Clone a remote memory to local directory (latest version)").argument("<name>", "Memory name to clone").argument("[destination]", "Destination directory (default: memory name)").action(
|
|
12018
11690
|
withErrorHandler(async (name, destination) => {
|
|
12019
11691
|
const targetDir = destination || name;
|
|
12020
11692
|
console.log(`Cloning memory: ${name}`);
|
|
12021
11693
|
const result = await cloneStorage(name, "memory", targetDir);
|
|
12022
|
-
console.log(
|
|
11694
|
+
console.log(chalk32.green(`
|
|
12023
11695
|
\u2713 Successfully cloned memory: ${name}`));
|
|
12024
|
-
console.log(
|
|
12025
|
-
console.log(
|
|
11696
|
+
console.log(chalk32.dim(` Location: ${targetDir}/`));
|
|
11697
|
+
console.log(chalk32.dim(` Version: ${result.versionId.slice(0, 8)}`));
|
|
12026
11698
|
})
|
|
12027
11699
|
);
|
|
12028
11700
|
|
|
@@ -12031,7 +11703,7 @@ var memoryCommand = new Command34().name("memory").description("Manage agent lon
|
|
|
12031
11703
|
|
|
12032
11704
|
// src/commands/cook/cook.ts
|
|
12033
11705
|
import { Command as Command35, Option as Option5 } from "commander";
|
|
12034
|
-
import
|
|
11706
|
+
import chalk34 from "chalk";
|
|
12035
11707
|
import { readFile as readFile7, mkdir as mkdir6 } from "fs/promises";
|
|
12036
11708
|
import { existsSync as existsSync10 } from "fs";
|
|
12037
11709
|
import path13 from "path";
|
|
@@ -12103,12 +11775,12 @@ async function saveCookState(state) {
|
|
|
12103
11775
|
}
|
|
12104
11776
|
|
|
12105
11777
|
// src/commands/cook/utils.ts
|
|
12106
|
-
import
|
|
11778
|
+
import chalk33 from "chalk";
|
|
12107
11779
|
import { existsSync as existsSync9 } from "fs";
|
|
12108
11780
|
var CONFIG_FILE2 = "vm0.yaml";
|
|
12109
11781
|
var ARTIFACT_DIR = "artifact";
|
|
12110
11782
|
function printCommand(cmd) {
|
|
12111
|
-
console.log(
|
|
11783
|
+
console.log(chalk33.dim(`> ${cmd}`));
|
|
12112
11784
|
}
|
|
12113
11785
|
function execVm0Command(args, options = {}) {
|
|
12114
11786
|
return new Promise((resolve2, reject) => {
|
|
@@ -12207,7 +11879,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
12207
11879
|
);
|
|
12208
11880
|
if (serverVersion && existsSync9(artifactDir)) {
|
|
12209
11881
|
console.log();
|
|
12210
|
-
console.log(
|
|
11882
|
+
console.log(chalk33.bold("Pulling updated artifact:"));
|
|
12211
11883
|
printCommand(`cd ${ARTIFACT_DIR}`);
|
|
12212
11884
|
printCommand(`vm0 artifact pull ${serverVersion}`);
|
|
12213
11885
|
try {
|
|
@@ -12217,9 +11889,9 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
12217
11889
|
});
|
|
12218
11890
|
printCommand("cd ..");
|
|
12219
11891
|
} catch (error) {
|
|
12220
|
-
console.error(
|
|
11892
|
+
console.error(chalk33.red(`\u2717 Artifact pull failed`));
|
|
12221
11893
|
if (error instanceof Error) {
|
|
12222
|
-
console.error(
|
|
11894
|
+
console.error(chalk33.dim(` ${error.message}`));
|
|
12223
11895
|
}
|
|
12224
11896
|
}
|
|
12225
11897
|
}
|
|
@@ -12227,7 +11899,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
12227
11899
|
|
|
12228
11900
|
// src/commands/cook/cook.ts
|
|
12229
11901
|
async function loadAndValidateConfig2() {
|
|
12230
|
-
console.log(
|
|
11902
|
+
console.log(chalk34.bold(`Reading config: ${CONFIG_FILE2}`));
|
|
12231
11903
|
if (!existsSync10(CONFIG_FILE2)) {
|
|
12232
11904
|
throw new Error(`Config file not found: ${CONFIG_FILE2}`);
|
|
12233
11905
|
}
|
|
@@ -12249,7 +11921,7 @@ async function loadAndValidateConfig2() {
|
|
|
12249
11921
|
const agentName = agentNames[0];
|
|
12250
11922
|
const volumeCount = config.volumes ? Object.keys(config.volumes).length : 0;
|
|
12251
11923
|
console.log(
|
|
12252
|
-
|
|
11924
|
+
chalk34.green(`\u2713 Config validated: 1 agent, ${volumeCount} volume(s)`)
|
|
12253
11925
|
);
|
|
12254
11926
|
return { config, agentName, volumeCount };
|
|
12255
11927
|
}
|
|
@@ -12258,7 +11930,7 @@ async function processVolumes(config, cwd) {
|
|
|
12258
11930
|
return;
|
|
12259
11931
|
}
|
|
12260
11932
|
console.log();
|
|
12261
|
-
console.log(
|
|
11933
|
+
console.log(chalk34.bold("Processing volumes:"));
|
|
12262
11934
|
for (const volumeConfig of Object.values(config.volumes)) {
|
|
12263
11935
|
const volumeDir = path13.join(cwd, volumeConfig.name);
|
|
12264
11936
|
if (!existsSync10(volumeDir)) {
|
|
@@ -12292,7 +11964,7 @@ async function processVolumes(config, cwd) {
|
|
|
12292
11964
|
}
|
|
12293
11965
|
async function processArtifact(cwd) {
|
|
12294
11966
|
console.log();
|
|
12295
|
-
console.log(
|
|
11967
|
+
console.log(chalk34.bold("Processing artifact:"));
|
|
12296
11968
|
const artifactDir = path13.join(cwd, ARTIFACT_DIR);
|
|
12297
11969
|
try {
|
|
12298
11970
|
if (!existsSync10(artifactDir)) {
|
|
@@ -12324,7 +11996,7 @@ async function processArtifact(cwd) {
|
|
|
12324
11996
|
}
|
|
12325
11997
|
async function composeAgent(cwd, skipConfirm) {
|
|
12326
11998
|
console.log();
|
|
12327
|
-
console.log(
|
|
11999
|
+
console.log(chalk34.bold("Composing agent:"));
|
|
12328
12000
|
const composeArgs = skipConfirm ? ["compose", "--yes", CONFIG_FILE2] : ["compose", CONFIG_FILE2];
|
|
12329
12001
|
printCommand(`vm0 ${composeArgs.join(" ")}`);
|
|
12330
12002
|
try {
|
|
@@ -12338,7 +12010,7 @@ async function composeAgent(cwd, skipConfirm) {
|
|
|
12338
12010
|
}
|
|
12339
12011
|
async function runAgent(agentName, artifactDir, prompt, cwd, options) {
|
|
12340
12012
|
console.log();
|
|
12341
|
-
console.log(
|
|
12013
|
+
console.log(chalk34.bold("Running agent:"));
|
|
12342
12014
|
printCommand(
|
|
12343
12015
|
`vm0 run ${agentName} --artifact-name ${ARTIFACT_DIR} "${prompt}"`
|
|
12344
12016
|
);
|
|
@@ -12371,7 +12043,7 @@ var cookAction = new Command35().name("cook").description("Quick start: prepare,
|
|
|
12371
12043
|
withErrorHandler(
|
|
12372
12044
|
async (prompt, options) => {
|
|
12373
12045
|
if (options.autoUpdate !== false) {
|
|
12374
|
-
const shouldExit = await checkAndUpgrade("9.62.
|
|
12046
|
+
const shouldExit = await checkAndUpgrade("9.62.1", prompt);
|
|
12375
12047
|
if (shouldExit) {
|
|
12376
12048
|
process.exit(0);
|
|
12377
12049
|
}
|
|
@@ -12554,7 +12226,7 @@ var cookCommand = cookAction;
|
|
|
12554
12226
|
|
|
12555
12227
|
// src/commands/logs/index.ts
|
|
12556
12228
|
import { Command as Command40 } from "commander";
|
|
12557
|
-
import
|
|
12229
|
+
import chalk36 from "chalk";
|
|
12558
12230
|
|
|
12559
12231
|
// src/lib/api/api-client.ts
|
|
12560
12232
|
import { initClient as initClient12 } from "@ts-rest/core";
|
|
@@ -13252,7 +12924,7 @@ async function paginate(options) {
|
|
|
13252
12924
|
|
|
13253
12925
|
// src/commands/logs/search.ts
|
|
13254
12926
|
import { Command as Command39 } from "commander";
|
|
13255
|
-
import
|
|
12927
|
+
import chalk35 from "chalk";
|
|
13256
12928
|
var SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
13257
12929
|
function renderEvent(event, renderer) {
|
|
13258
12930
|
const eventData = event.eventData;
|
|
@@ -13308,7 +12980,7 @@ function renderResults(response) {
|
|
|
13308
12980
|
isFirstGroup = false;
|
|
13309
12981
|
const firstTimestamp = group.results[0].matchedEvent.createdAt;
|
|
13310
12982
|
console.log(
|
|
13311
|
-
|
|
12983
|
+
chalk35.bold(formatRunHeader(runId, group.agentName, firstTimestamp))
|
|
13312
12984
|
);
|
|
13313
12985
|
for (const result of group.results) {
|
|
13314
12986
|
const renderer = new EventRenderer({
|
|
@@ -13328,7 +13000,7 @@ function renderResults(response) {
|
|
|
13328
13000
|
if (response.hasMore) {
|
|
13329
13001
|
console.log();
|
|
13330
13002
|
console.log(
|
|
13331
|
-
|
|
13003
|
+
chalk35.dim(
|
|
13332
13004
|
` Showing first ${response.results.length} matches. Use --limit to see more.`
|
|
13333
13005
|
)
|
|
13334
13006
|
);
|
|
@@ -13349,9 +13021,9 @@ var searchCommand = new Command39().name("search").description("Search agent eve
|
|
|
13349
13021
|
after
|
|
13350
13022
|
});
|
|
13351
13023
|
if (response.results.length === 0) {
|
|
13352
|
-
console.log(
|
|
13024
|
+
console.log(chalk35.dim("No matches found"));
|
|
13353
13025
|
console.log(
|
|
13354
|
-
|
|
13026
|
+
chalk35.dim(
|
|
13355
13027
|
" Try a broader search with --since 30d or a different keyword"
|
|
13356
13028
|
)
|
|
13357
13029
|
);
|
|
@@ -13388,28 +13060,28 @@ function formatNetworkLog(entry) {
|
|
|
13388
13060
|
let statusColor;
|
|
13389
13061
|
const status = entry.status || 0;
|
|
13390
13062
|
if (status >= 200 && status < 300) {
|
|
13391
|
-
statusColor =
|
|
13063
|
+
statusColor = chalk36.green;
|
|
13392
13064
|
} else if (status >= 300 && status < 400) {
|
|
13393
|
-
statusColor =
|
|
13065
|
+
statusColor = chalk36.yellow;
|
|
13394
13066
|
} else if (status >= 400) {
|
|
13395
|
-
statusColor =
|
|
13067
|
+
statusColor = chalk36.red;
|
|
13396
13068
|
} else {
|
|
13397
|
-
statusColor =
|
|
13069
|
+
statusColor = chalk36.gray;
|
|
13398
13070
|
}
|
|
13399
13071
|
let latencyColor;
|
|
13400
13072
|
const latencyMs = entry.latency_ms || 0;
|
|
13401
13073
|
if (latencyMs < 500) {
|
|
13402
|
-
latencyColor =
|
|
13074
|
+
latencyColor = chalk36.green;
|
|
13403
13075
|
} else if (latencyMs < 2e3) {
|
|
13404
|
-
latencyColor =
|
|
13076
|
+
latencyColor = chalk36.yellow;
|
|
13405
13077
|
} else {
|
|
13406
|
-
latencyColor =
|
|
13078
|
+
latencyColor = chalk36.red;
|
|
13407
13079
|
}
|
|
13408
13080
|
const method = entry.method || "???";
|
|
13409
13081
|
const requestSize = entry.request_size || 0;
|
|
13410
13082
|
const responseSize = entry.response_size || 0;
|
|
13411
13083
|
const url = entry.url || entry.host || "unknown";
|
|
13412
|
-
return `[${entry.timestamp}] ${method.padEnd(6)} ${statusColor(status)} ${latencyColor(latencyMs + "ms")} ${formatBytes(requestSize)}/${formatBytes(responseSize)} ${
|
|
13084
|
+
return `[${entry.timestamp}] ${method.padEnd(6)} ${statusColor(status)} ${latencyColor(latencyMs + "ms")} ${formatBytes(requestSize)}/${formatBytes(responseSize)} ${chalk36.dim(url)}`;
|
|
13413
13085
|
}
|
|
13414
13086
|
function createLogRenderer(verbose) {
|
|
13415
13087
|
return new EventRenderer({
|
|
@@ -13417,16 +13089,12 @@ function createLogRenderer(verbose) {
|
|
|
13417
13089
|
verbose
|
|
13418
13090
|
});
|
|
13419
13091
|
}
|
|
13420
|
-
function renderAgentEvent(event,
|
|
13092
|
+
function renderAgentEvent(event, renderer) {
|
|
13421
13093
|
const eventData = event.eventData;
|
|
13422
|
-
|
|
13423
|
-
|
|
13424
|
-
|
|
13425
|
-
|
|
13426
|
-
if (parsed) {
|
|
13427
|
-
parsed.timestamp = new Date(event.createdAt);
|
|
13428
|
-
renderer.render(parsed);
|
|
13429
|
-
}
|
|
13094
|
+
const parsed = ClaudeEventParser.parse(eventData);
|
|
13095
|
+
if (parsed) {
|
|
13096
|
+
parsed.timestamp = new Date(event.createdAt);
|
|
13097
|
+
renderer.render(parsed);
|
|
13430
13098
|
}
|
|
13431
13099
|
}
|
|
13432
13100
|
function getLogType(options) {
|
|
@@ -13515,10 +13183,9 @@ async function showAgentEvents(runId, options, platformUrl) {
|
|
|
13515
13183
|
order: options.order
|
|
13516
13184
|
});
|
|
13517
13185
|
if (firstResponse.events.length === 0) {
|
|
13518
|
-
console.log(
|
|
13186
|
+
console.log(chalk36.yellow("No agent events found for this run"));
|
|
13519
13187
|
return;
|
|
13520
13188
|
}
|
|
13521
|
-
const framework = firstResponse.framework;
|
|
13522
13189
|
let allEvents;
|
|
13523
13190
|
if (!firstResponse.hasMore || options.targetCount !== "all" && firstResponse.events.length >= options.targetCount) {
|
|
13524
13191
|
allEvents = options.targetCount === "all" ? firstResponse.events : firstResponse.events.slice(0, options.targetCount);
|
|
@@ -13546,9 +13213,9 @@ async function showAgentEvents(runId, options, platformUrl) {
|
|
|
13546
13213
|
const events = options.order === "desc" ? [...allEvents].reverse() : allEvents;
|
|
13547
13214
|
const renderer = createLogRenderer(true);
|
|
13548
13215
|
for (const event of events) {
|
|
13549
|
-
renderAgentEvent(event,
|
|
13216
|
+
renderAgentEvent(event, renderer);
|
|
13550
13217
|
}
|
|
13551
|
-
console.log(
|
|
13218
|
+
console.log(chalk36.dim(`View on platform: ${platformUrl}`));
|
|
13552
13219
|
}
|
|
13553
13220
|
async function showSystemLog(runId, options) {
|
|
13554
13221
|
const limit = options.targetCount === "all" ? PAGE_LIMIT : Math.min(options.targetCount, PAGE_LIMIT);
|
|
@@ -13558,7 +13225,7 @@ async function showSystemLog(runId, options) {
|
|
|
13558
13225
|
order: options.order
|
|
13559
13226
|
});
|
|
13560
13227
|
if (!response.systemLog) {
|
|
13561
|
-
console.log(
|
|
13228
|
+
console.log(chalk36.yellow("No system log found for this run"));
|
|
13562
13229
|
return;
|
|
13563
13230
|
}
|
|
13564
13231
|
console.log(response.systemLog);
|
|
@@ -13570,7 +13237,7 @@ async function showMetrics(runId, options) {
|
|
|
13570
13237
|
order: options.order
|
|
13571
13238
|
});
|
|
13572
13239
|
if (firstResponse.metrics.length === 0) {
|
|
13573
|
-
console.log(
|
|
13240
|
+
console.log(chalk36.yellow("No metrics found for this run"));
|
|
13574
13241
|
return;
|
|
13575
13242
|
}
|
|
13576
13243
|
let allMetrics;
|
|
@@ -13610,7 +13277,7 @@ async function showNetworkLogs(runId, options) {
|
|
|
13610
13277
|
});
|
|
13611
13278
|
if (firstResponse.networkLogs.length === 0) {
|
|
13612
13279
|
console.log(
|
|
13613
|
-
|
|
13280
|
+
chalk36.yellow(
|
|
13614
13281
|
"No network logs found for this run. Network logs are only captured when using a runner with proxy enabled"
|
|
13615
13282
|
)
|
|
13616
13283
|
);
|
|
@@ -13651,13 +13318,13 @@ import { Command as Command49 } from "commander";
|
|
|
13651
13318
|
|
|
13652
13319
|
// src/commands/org/status.ts
|
|
13653
13320
|
import { Command as Command41 } from "commander";
|
|
13654
|
-
import
|
|
13321
|
+
import chalk37 from "chalk";
|
|
13655
13322
|
var statusCommand5 = new Command41().name("status").description("View current organization status").action(
|
|
13656
13323
|
withErrorHandler(async () => {
|
|
13657
13324
|
try {
|
|
13658
13325
|
const org = await getOrg();
|
|
13659
|
-
console.log(
|
|
13660
|
-
console.log(` Slug: ${
|
|
13326
|
+
console.log(chalk37.bold("Organization Information:"));
|
|
13327
|
+
console.log(` Slug: ${chalk37.green(org.slug)}`);
|
|
13661
13328
|
} catch (error) {
|
|
13662
13329
|
if (error instanceof Error && error.message.includes("No org configured")) {
|
|
13663
13330
|
throw new Error("No organization configured", {
|
|
@@ -13671,7 +13338,7 @@ var statusCommand5 = new Command41().name("status").description("View current or
|
|
|
13671
13338
|
|
|
13672
13339
|
// src/commands/org/set.ts
|
|
13673
13340
|
import { Command as Command42 } from "commander";
|
|
13674
|
-
import
|
|
13341
|
+
import chalk38 from "chalk";
|
|
13675
13342
|
var setCommand = new Command42().name("set").description("Rename your organization slug").argument("<slug>", "The new organization slug").option(
|
|
13676
13343
|
"--force",
|
|
13677
13344
|
"Force change existing organization (may break references)"
|
|
@@ -13689,10 +13356,10 @@ var setCommand = new Command42().name("set").description("Rename your organizati
|
|
|
13689
13356
|
}
|
|
13690
13357
|
const org = await updateOrg({ slug, force: true });
|
|
13691
13358
|
await saveConfig({ activeOrg: org.slug });
|
|
13692
|
-
console.log(
|
|
13359
|
+
console.log(chalk38.green(`\u2713 Organization updated to ${org.slug}`));
|
|
13693
13360
|
console.log();
|
|
13694
13361
|
console.log("Your agents will now be namespaced as:");
|
|
13695
|
-
console.log(
|
|
13362
|
+
console.log(chalk38.cyan(` ${org.slug}/<agent-name>`));
|
|
13696
13363
|
} catch (error) {
|
|
13697
13364
|
if (error instanceof Error && error.message.includes("already exists")) {
|
|
13698
13365
|
throw new Error(
|
|
@@ -13706,17 +13373,17 @@ var setCommand = new Command42().name("set").description("Rename your organizati
|
|
|
13706
13373
|
|
|
13707
13374
|
// src/commands/org/list.ts
|
|
13708
13375
|
import { Command as Command43 } from "commander";
|
|
13709
|
-
import
|
|
13376
|
+
import chalk39 from "chalk";
|
|
13710
13377
|
var listCommand5 = new Command43().name("list").description("List all accessible organizations").action(
|
|
13711
13378
|
withErrorHandler(async () => {
|
|
13712
13379
|
const result = await listOrgs();
|
|
13713
13380
|
const activeOrg = await getActiveOrg();
|
|
13714
|
-
console.log(
|
|
13381
|
+
console.log(chalk39.bold("Available organizations:"));
|
|
13715
13382
|
for (const org of result.orgs) {
|
|
13716
13383
|
const isCurrent = org.slug === activeOrg;
|
|
13717
|
-
const marker = isCurrent ?
|
|
13384
|
+
const marker = isCurrent ? chalk39.green("* ") : " ";
|
|
13718
13385
|
const roleLabel = org.role ? ` (${org.role})` : "";
|
|
13719
|
-
const currentLabel = isCurrent ?
|
|
13386
|
+
const currentLabel = isCurrent ? chalk39.dim(" \u2190 current") : "";
|
|
13720
13387
|
console.log(`${marker}${org.slug}${roleLabel}${currentLabel}`);
|
|
13721
13388
|
}
|
|
13722
13389
|
})
|
|
@@ -13724,13 +13391,13 @@ var listCommand5 = new Command43().name("list").description("List all accessible
|
|
|
13724
13391
|
|
|
13725
13392
|
// src/commands/org/use.ts
|
|
13726
13393
|
import { Command as Command44 } from "commander";
|
|
13727
|
-
import
|
|
13394
|
+
import chalk40 from "chalk";
|
|
13728
13395
|
var useCommand = new Command44().name("use").description("Switch to a different organization").argument("[slug]", "Organization slug to switch to").option("--personal", "Switch to personal org").action(
|
|
13729
13396
|
withErrorHandler(
|
|
13730
13397
|
async (slug, options) => {
|
|
13731
13398
|
if (options.personal) {
|
|
13732
13399
|
await saveConfig({ activeOrg: void 0 });
|
|
13733
|
-
console.log(
|
|
13400
|
+
console.log(chalk40.green("\u2713 Switched to personal org."));
|
|
13734
13401
|
return;
|
|
13735
13402
|
}
|
|
13736
13403
|
if (!slug) {
|
|
@@ -13746,27 +13413,27 @@ var useCommand = new Command44().name("use").description("Switch to a different
|
|
|
13746
13413
|
);
|
|
13747
13414
|
}
|
|
13748
13415
|
await saveConfig({ activeOrg: slug });
|
|
13749
|
-
console.log(
|
|
13416
|
+
console.log(chalk40.green(`\u2713 Switched to organization: ${slug}`));
|
|
13750
13417
|
}
|
|
13751
13418
|
)
|
|
13752
13419
|
);
|
|
13753
13420
|
|
|
13754
13421
|
// src/commands/org/members.ts
|
|
13755
13422
|
import { Command as Command45 } from "commander";
|
|
13756
|
-
import
|
|
13423
|
+
import chalk41 from "chalk";
|
|
13757
13424
|
var membersCommand = new Command45().name("members").description("View organization members").action(
|
|
13758
13425
|
withErrorHandler(async () => {
|
|
13759
13426
|
try {
|
|
13760
13427
|
const status = await getOrgMembers();
|
|
13761
|
-
console.log(
|
|
13428
|
+
console.log(chalk41.bold(`Organization: ${status.slug}`));
|
|
13762
13429
|
console.log(` Role: ${status.role}`);
|
|
13763
13430
|
console.log(
|
|
13764
13431
|
` Created: ${new Date(status.createdAt).toLocaleDateString()}`
|
|
13765
13432
|
);
|
|
13766
13433
|
console.log();
|
|
13767
|
-
console.log(
|
|
13434
|
+
console.log(chalk41.bold("Members:"));
|
|
13768
13435
|
for (const member of status.members) {
|
|
13769
|
-
const roleTag = member.role === "admin" ?
|
|
13436
|
+
const roleTag = member.role === "admin" ? chalk41.yellow(` (${member.role})`) : chalk41.dim(` (${member.role})`);
|
|
13770
13437
|
console.log(` ${member.email}${roleTag}`);
|
|
13771
13438
|
}
|
|
13772
13439
|
} catch (error) {
|
|
@@ -13782,33 +13449,33 @@ var membersCommand = new Command45().name("members").description("View organizat
|
|
|
13782
13449
|
|
|
13783
13450
|
// src/commands/org/invite.ts
|
|
13784
13451
|
import { Command as Command46 } from "commander";
|
|
13785
|
-
import
|
|
13452
|
+
import chalk42 from "chalk";
|
|
13786
13453
|
var inviteCommand = new Command46().name("invite").description("Invite a member to the current organization").requiredOption("--email <email>", "Email address of the member to invite").action(
|
|
13787
13454
|
withErrorHandler(async (options) => {
|
|
13788
13455
|
await inviteOrgMember(options.email);
|
|
13789
|
-
console.log(
|
|
13456
|
+
console.log(chalk42.green(`\u2713 Invitation sent to ${options.email}`));
|
|
13790
13457
|
})
|
|
13791
13458
|
);
|
|
13792
13459
|
|
|
13793
13460
|
// src/commands/org/remove.ts
|
|
13794
13461
|
import { Command as Command47 } from "commander";
|
|
13795
|
-
import
|
|
13462
|
+
import chalk43 from "chalk";
|
|
13796
13463
|
var removeCommand = new Command47().name("remove").description("Remove a member from the current organization").argument("<email>", "Email address of the member to remove").action(
|
|
13797
13464
|
withErrorHandler(async (email) => {
|
|
13798
13465
|
await removeOrgMember(email);
|
|
13799
|
-
console.log(
|
|
13466
|
+
console.log(chalk43.green(`\u2713 Removed ${email} from organization`));
|
|
13800
13467
|
})
|
|
13801
13468
|
);
|
|
13802
13469
|
|
|
13803
13470
|
// src/commands/org/leave.ts
|
|
13804
13471
|
import { Command as Command48 } from "commander";
|
|
13805
|
-
import
|
|
13472
|
+
import chalk44 from "chalk";
|
|
13806
13473
|
var leaveCommand = new Command48().name("leave").description("Leave the current organization").action(
|
|
13807
13474
|
withErrorHandler(async () => {
|
|
13808
13475
|
await leaveOrg();
|
|
13809
13476
|
await saveConfig({ activeOrg: void 0 });
|
|
13810
13477
|
console.log(
|
|
13811
|
-
|
|
13478
|
+
chalk44.green("\u2713 Left organization. Switched to personal org.")
|
|
13812
13479
|
);
|
|
13813
13480
|
})
|
|
13814
13481
|
);
|
|
@@ -13821,7 +13488,7 @@ import { Command as Command54 } from "commander";
|
|
|
13821
13488
|
|
|
13822
13489
|
// src/commands/agent/clone.ts
|
|
13823
13490
|
import { Command as Command50 } from "commander";
|
|
13824
|
-
import
|
|
13491
|
+
import chalk45 from "chalk";
|
|
13825
13492
|
import { mkdtempSync as mkdtempSync5 } from "fs";
|
|
13826
13493
|
import { mkdir as mkdir7, writeFile as writeFile6, readdir as readdir2, copyFile, rm as rm4 } from "fs/promises";
|
|
13827
13494
|
import { join as join10, dirname as dirname3, resolve, sep } from "path";
|
|
@@ -13852,13 +13519,13 @@ async function downloadInstructions(agentName, instructionsPath, destination) {
|
|
|
13852
13519
|
throw new Error("Invalid instructions path: path traversal detected");
|
|
13853
13520
|
}
|
|
13854
13521
|
const volumeName = getInstructionsStorageName(agentName);
|
|
13855
|
-
console.log(
|
|
13522
|
+
console.log(chalk45.dim("Downloading instructions..."));
|
|
13856
13523
|
const downloadInfo = await getStorageDownload({
|
|
13857
13524
|
name: volumeName,
|
|
13858
13525
|
type: "volume"
|
|
13859
13526
|
});
|
|
13860
13527
|
if ("empty" in downloadInfo) {
|
|
13861
|
-
console.log(
|
|
13528
|
+
console.log(chalk45.yellow("\u26A0 Instructions volume is empty"));
|
|
13862
13529
|
return false;
|
|
13863
13530
|
}
|
|
13864
13531
|
const response = await fetch(downloadInfo.url);
|
|
@@ -13873,7 +13540,7 @@ async function downloadInstructions(agentName, instructionsPath, destination) {
|
|
|
13873
13540
|
const files = await readdir2(tmpDir);
|
|
13874
13541
|
const mdFile = files.find((f) => f === "CLAUDE.md" || f === "AGENTS.md");
|
|
13875
13542
|
if (!mdFile) {
|
|
13876
|
-
console.log(
|
|
13543
|
+
console.log(chalk45.yellow("\u26A0 No instructions file found in volume"));
|
|
13877
13544
|
await rm4(tmpDir, { recursive: true, force: true });
|
|
13878
13545
|
return false;
|
|
13879
13546
|
}
|
|
@@ -13903,7 +13570,7 @@ var cloneCommand4 = new Command50().name("clone").description("Clone agent compo
|
|
|
13903
13570
|
await mkdir7(targetDir, { recursive: true });
|
|
13904
13571
|
const yamlPath = join10(targetDir, "vm0.yaml");
|
|
13905
13572
|
await writeFile6(yamlPath, yamlContent, "utf8");
|
|
13906
|
-
console.log(
|
|
13573
|
+
console.log(chalk45.green("\u2713 Created vm0.yaml"));
|
|
13907
13574
|
const agentKey = Object.keys(content.agents)[0];
|
|
13908
13575
|
const agent = agentKey ? content.agents[agentKey] : void 0;
|
|
13909
13576
|
if (agent?.instructions) {
|
|
@@ -13914,26 +13581,26 @@ var cloneCommand4 = new Command50().name("clone").description("Clone agent compo
|
|
|
13914
13581
|
targetDir
|
|
13915
13582
|
);
|
|
13916
13583
|
if (instructionsDownloaded) {
|
|
13917
|
-
console.log(
|
|
13584
|
+
console.log(chalk45.green(`\u2713 Downloaded ${agent.instructions}`));
|
|
13918
13585
|
}
|
|
13919
13586
|
} catch (error) {
|
|
13920
13587
|
console.log(
|
|
13921
|
-
|
|
13588
|
+
chalk45.yellow(
|
|
13922
13589
|
`\u26A0 Could not download instructions: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
13923
13590
|
)
|
|
13924
13591
|
);
|
|
13925
13592
|
}
|
|
13926
13593
|
}
|
|
13927
13594
|
console.log();
|
|
13928
|
-
console.log(
|
|
13929
|
-
console.log(
|
|
13930
|
-
console.log(
|
|
13595
|
+
console.log(chalk45.green(`\u2713 Successfully cloned agent: ${name}`));
|
|
13596
|
+
console.log(chalk45.dim(` Location: ${targetDir}/`));
|
|
13597
|
+
console.log(chalk45.dim(` Version: ${compose.headVersionId.slice(0, 8)}`));
|
|
13931
13598
|
})
|
|
13932
13599
|
);
|
|
13933
13600
|
|
|
13934
13601
|
// src/commands/agent/delete.ts
|
|
13935
13602
|
import { Command as Command51 } from "commander";
|
|
13936
|
-
import
|
|
13603
|
+
import chalk46 from "chalk";
|
|
13937
13604
|
var deleteCommand = new Command51().name("delete").alias("rm").description("Delete an agent").argument("<name>", "Agent name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
13938
13605
|
withErrorHandler(async (name, options) => {
|
|
13939
13606
|
const compose = await getComposeByName(name);
|
|
@@ -13948,7 +13615,7 @@ var deleteCommand = new Command51().name("delete").alias("rm").description("Dele
|
|
|
13948
13615
|
}
|
|
13949
13616
|
const confirmed = await promptConfirm(`Delete agent '${name}'?`, false);
|
|
13950
13617
|
if (!confirmed) {
|
|
13951
|
-
console.log(
|
|
13618
|
+
console.log(chalk46.dim("Cancelled"));
|
|
13952
13619
|
return;
|
|
13953
13620
|
}
|
|
13954
13621
|
}
|
|
@@ -13962,13 +13629,13 @@ var deleteCommand = new Command51().name("delete").alias("rm").description("Dele
|
|
|
13962
13629
|
}
|
|
13963
13630
|
throw error;
|
|
13964
13631
|
}
|
|
13965
|
-
console.log(
|
|
13632
|
+
console.log(chalk46.green(`\u2713 Agent '${name}' deleted`));
|
|
13966
13633
|
})
|
|
13967
13634
|
);
|
|
13968
13635
|
|
|
13969
13636
|
// src/commands/agent/list.ts
|
|
13970
13637
|
import { Command as Command52 } from "commander";
|
|
13971
|
-
import
|
|
13638
|
+
import chalk47 from "chalk";
|
|
13972
13639
|
var listCommand6 = new Command52().name("list").alias("ls").description("List all agent composes").action(
|
|
13973
13640
|
withErrorHandler(async () => {
|
|
13974
13641
|
const response = await httpGet("/api/agent/composes/list");
|
|
@@ -13978,9 +13645,9 @@ var listCommand6 = new Command52().name("list").alias("ls").description("List al
|
|
|
13978
13645
|
}
|
|
13979
13646
|
const data = await response.json();
|
|
13980
13647
|
if (data.composes.length === 0) {
|
|
13981
|
-
console.log(
|
|
13648
|
+
console.log(chalk47.dim("No agent composes found"));
|
|
13982
13649
|
console.log(
|
|
13983
|
-
|
|
13650
|
+
chalk47.dim(" Create one with: vm0 compose <agent-compose.yaml>")
|
|
13984
13651
|
);
|
|
13985
13652
|
return;
|
|
13986
13653
|
}
|
|
@@ -13988,9 +13655,9 @@ var listCommand6 = new Command52().name("list").alias("ls").description("List al
|
|
|
13988
13655
|
const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
|
|
13989
13656
|
" "
|
|
13990
13657
|
);
|
|
13991
|
-
console.log(
|
|
13658
|
+
console.log(chalk47.dim(header));
|
|
13992
13659
|
for (const compose of data.composes) {
|
|
13993
|
-
const versionShort = compose.headVersionId ? compose.headVersionId.slice(0, 8) :
|
|
13660
|
+
const versionShort = compose.headVersionId ? compose.headVersionId.slice(0, 8) : chalk47.dim("-");
|
|
13994
13661
|
const row = [
|
|
13995
13662
|
compose.name.padEnd(nameWidth),
|
|
13996
13663
|
versionShort,
|
|
@@ -14003,7 +13670,7 @@ var listCommand6 = new Command52().name("list").alias("ls").description("List al
|
|
|
14003
13670
|
|
|
14004
13671
|
// src/commands/agent/status.ts
|
|
14005
13672
|
import { Command as Command53 } from "commander";
|
|
14006
|
-
import
|
|
13673
|
+
import chalk48 from "chalk";
|
|
14007
13674
|
|
|
14008
13675
|
// src/lib/domain/source-derivation.ts
|
|
14009
13676
|
import * as fs10 from "fs/promises";
|
|
@@ -14117,20 +13784,20 @@ function formatVariableSources(sources) {
|
|
|
14117
13784
|
if (sources.secrets.length > 0) {
|
|
14118
13785
|
console.log(` Secrets:`);
|
|
14119
13786
|
for (const secret of sources.secrets) {
|
|
14120
|
-
const sourceInfo =
|
|
13787
|
+
const sourceInfo = chalk48.dim(`(${secret.source})`);
|
|
14121
13788
|
console.log(` - ${secret.name.padEnd(20)} ${sourceInfo}`);
|
|
14122
13789
|
}
|
|
14123
13790
|
}
|
|
14124
13791
|
if (sources.vars.length > 0) {
|
|
14125
13792
|
console.log(` Vars:`);
|
|
14126
13793
|
for (const v of sources.vars) {
|
|
14127
|
-
const sourceInfo =
|
|
13794
|
+
const sourceInfo = chalk48.dim(`(${v.source})`);
|
|
14128
13795
|
console.log(` - ${v.name.padEnd(20)} ${sourceInfo}`);
|
|
14129
13796
|
}
|
|
14130
13797
|
}
|
|
14131
13798
|
}
|
|
14132
13799
|
function formatAgentDetails(agentName, agent, agentSources, volumeConfigs) {
|
|
14133
|
-
console.log(` ${
|
|
13800
|
+
console.log(` ${chalk48.cyan(agentName)}:`);
|
|
14134
13801
|
console.log(` Framework: ${agent.framework}`);
|
|
14135
13802
|
if (agent.image) {
|
|
14136
13803
|
console.log(` Image: ${agent.image}`);
|
|
@@ -14148,10 +13815,10 @@ function formatAgentDetails(agentName, agent, agentSources, volumeConfigs) {
|
|
|
14148
13815
|
}
|
|
14149
13816
|
}
|
|
14150
13817
|
function formatComposeOutput(name, versionId, content, variableSources) {
|
|
14151
|
-
console.log(
|
|
14152
|
-
console.log(
|
|
13818
|
+
console.log(chalk48.bold("Name:") + ` ${name}`);
|
|
13819
|
+
console.log(chalk48.bold("Version:") + ` ${versionId}`);
|
|
14153
13820
|
console.log();
|
|
14154
|
-
console.log(
|
|
13821
|
+
console.log(chalk48.bold("Agents:"));
|
|
14155
13822
|
for (const [agentName, agent] of Object.entries(content.agents)) {
|
|
14156
13823
|
const agentSources = variableSources?.get(agentName);
|
|
14157
13824
|
formatAgentDetails(agentName, agent, agentSources, content.volumes);
|
|
@@ -14210,7 +13877,7 @@ var statusCommand6 = new Command53().name("status").description("Show status of
|
|
|
14210
13877
|
});
|
|
14211
13878
|
} catch {
|
|
14212
13879
|
console.error(
|
|
14213
|
-
|
|
13880
|
+
chalk48.yellow(
|
|
14214
13881
|
"\u26A0 Warning: Failed to fetch skill sources, showing basic info"
|
|
14215
13882
|
)
|
|
14216
13883
|
);
|
|
@@ -14230,7 +13897,7 @@ var agentCommand = new Command54().name("agent").description("Manage agent compo
|
|
|
14230
13897
|
|
|
14231
13898
|
// src/commands/init/index.ts
|
|
14232
13899
|
import { Command as Command55 } from "commander";
|
|
14233
|
-
import
|
|
13900
|
+
import chalk49 from "chalk";
|
|
14234
13901
|
import path17 from "path";
|
|
14235
13902
|
import { existsSync as existsSync11 } from "fs";
|
|
14236
13903
|
import { writeFile as writeFile7 } from "fs/promises";
|
|
@@ -14297,7 +13964,7 @@ var initCommand4 = new Command55().name("init").description("Initialize a new VM
|
|
|
14297
13964
|
}
|
|
14298
13965
|
);
|
|
14299
13966
|
if (name === void 0) {
|
|
14300
|
-
console.log(
|
|
13967
|
+
console.log(chalk49.dim("Cancelled"));
|
|
14301
13968
|
return;
|
|
14302
13969
|
}
|
|
14303
13970
|
agentName = name;
|
|
@@ -14311,23 +13978,23 @@ var initCommand4 = new Command55().name("init").description("Initialize a new VM
|
|
|
14311
13978
|
}
|
|
14312
13979
|
await writeFile7(VM0_YAML_FILE, generateVm0Yaml(agentName));
|
|
14313
13980
|
const vm0Status = existingFiles.includes(VM0_YAML_FILE) ? " (overwritten)" : "";
|
|
14314
|
-
console.log(
|
|
13981
|
+
console.log(chalk49.green(`\u2713 Created ${VM0_YAML_FILE}${vm0Status}`));
|
|
14315
13982
|
await writeFile7(AGENTS_MD_FILE, generateAgentsMd());
|
|
14316
13983
|
const agentsStatus = existingFiles.includes(AGENTS_MD_FILE) ? " (overwritten)" : "";
|
|
14317
|
-
console.log(
|
|
13984
|
+
console.log(chalk49.green(`\u2713 Created ${AGENTS_MD_FILE}${agentsStatus}`));
|
|
14318
13985
|
console.log();
|
|
14319
13986
|
console.log("Next steps:");
|
|
14320
13987
|
console.log(
|
|
14321
|
-
` 1. Set up model provider (one-time): ${
|
|
13988
|
+
` 1. Set up model provider (one-time): ${chalk49.cyan("vm0 model-provider setup")}`
|
|
14322
13989
|
);
|
|
14323
13990
|
console.log(
|
|
14324
|
-
` 2. Edit ${
|
|
13991
|
+
` 2. Edit ${chalk49.cyan("AGENTS.md")} to customize your agent's workflow`
|
|
14325
13992
|
);
|
|
14326
13993
|
console.log(
|
|
14327
|
-
` Or install Claude plugin: ${
|
|
13994
|
+
` Or install Claude plugin: ${chalk49.cyan(`vm0 setup-claude && claude "/vm0-agent let's build an agent"`)}`
|
|
14328
13995
|
);
|
|
14329
13996
|
console.log(
|
|
14330
|
-
` 3. Run your agent: ${
|
|
13997
|
+
` 3. Run your agent: ${chalk49.cyan(`vm0 cook "let's start working"`)}`
|
|
14331
13998
|
);
|
|
14332
13999
|
})
|
|
14333
14000
|
);
|
|
@@ -14337,7 +14004,7 @@ import { Command as Command62 } from "commander";
|
|
|
14337
14004
|
|
|
14338
14005
|
// src/commands/schedule/setup.ts
|
|
14339
14006
|
import { Command as Command56 } from "commander";
|
|
14340
|
-
import
|
|
14007
|
+
import chalk50 from "chalk";
|
|
14341
14008
|
|
|
14342
14009
|
// src/lib/domain/schedule-utils.ts
|
|
14343
14010
|
import { parse as parseYaml6 } from "yaml";
|
|
@@ -14827,7 +14494,7 @@ async function buildAndDeploy(params) {
|
|
|
14827
14494
|
}
|
|
14828
14495
|
console.log(
|
|
14829
14496
|
`
|
|
14830
|
-
Deploying schedule for agent ${
|
|
14497
|
+
Deploying schedule for agent ${chalk50.cyan(params.agentName)}...`
|
|
14831
14498
|
);
|
|
14832
14499
|
const deployResult = await deploySchedule({
|
|
14833
14500
|
name: params.scheduleName,
|
|
@@ -14850,62 +14517,62 @@ Deploying schedule for agent ${chalk51.cyan(params.agentName)}...`
|
|
|
14850
14517
|
function displayDeployResult(agentName, deployResult) {
|
|
14851
14518
|
if (deployResult.created) {
|
|
14852
14519
|
console.log(
|
|
14853
|
-
|
|
14520
|
+
chalk50.green(`\u2713 Created schedule for agent ${chalk50.cyan(agentName)}`)
|
|
14854
14521
|
);
|
|
14855
14522
|
} else {
|
|
14856
14523
|
console.log(
|
|
14857
|
-
|
|
14524
|
+
chalk50.green(`\u2713 Updated schedule for agent ${chalk50.cyan(agentName)}`)
|
|
14858
14525
|
);
|
|
14859
14526
|
}
|
|
14860
|
-
console.log(
|
|
14527
|
+
console.log(chalk50.dim(` Timezone: ${deployResult.schedule.timezone}`));
|
|
14861
14528
|
if (deployResult.schedule.triggerType === "loop" && deployResult.schedule.intervalSeconds != null) {
|
|
14862
14529
|
console.log(
|
|
14863
|
-
|
|
14530
|
+
chalk50.dim(
|
|
14864
14531
|
` Mode: Loop (interval ${deployResult.schedule.intervalSeconds}s)`
|
|
14865
14532
|
)
|
|
14866
14533
|
);
|
|
14867
14534
|
} else if (deployResult.schedule.cronExpression) {
|
|
14868
|
-
console.log(
|
|
14535
|
+
console.log(chalk50.dim(` Cron: ${deployResult.schedule.cronExpression}`));
|
|
14869
14536
|
if (deployResult.schedule.nextRunAt) {
|
|
14870
14537
|
const nextRun = formatInTimezone(
|
|
14871
14538
|
deployResult.schedule.nextRunAt,
|
|
14872
14539
|
deployResult.schedule.timezone
|
|
14873
14540
|
);
|
|
14874
|
-
console.log(
|
|
14541
|
+
console.log(chalk50.dim(` Next run: ${nextRun}`));
|
|
14875
14542
|
}
|
|
14876
14543
|
} else if (deployResult.schedule.atTime) {
|
|
14877
14544
|
const atTimeFormatted = formatInTimezone(
|
|
14878
14545
|
deployResult.schedule.atTime,
|
|
14879
14546
|
deployResult.schedule.timezone
|
|
14880
14547
|
);
|
|
14881
|
-
console.log(
|
|
14548
|
+
console.log(chalk50.dim(` At: ${atTimeFormatted}`));
|
|
14882
14549
|
}
|
|
14883
14550
|
}
|
|
14884
14551
|
async function tryEnableSchedule(scheduleName, composeId, agentName) {
|
|
14885
14552
|
try {
|
|
14886
14553
|
await enableSchedule({ name: scheduleName, composeId });
|
|
14887
14554
|
console.log(
|
|
14888
|
-
|
|
14555
|
+
chalk50.green(`\u2713 Enabled schedule for agent ${chalk50.cyan(agentName)}`)
|
|
14889
14556
|
);
|
|
14890
14557
|
} catch (error) {
|
|
14891
|
-
console.error(
|
|
14558
|
+
console.error(chalk50.yellow("\u26A0 Failed to enable schedule"));
|
|
14892
14559
|
if (error instanceof ApiRequestError) {
|
|
14893
14560
|
if (error.code === "SCHEDULE_PAST") {
|
|
14894
|
-
console.error(
|
|
14561
|
+
console.error(chalk50.dim(" Scheduled time has already passed"));
|
|
14895
14562
|
} else {
|
|
14896
|
-
console.error(
|
|
14563
|
+
console.error(chalk50.dim(` ${error.message}`));
|
|
14897
14564
|
}
|
|
14898
14565
|
} else if (error instanceof Error) {
|
|
14899
|
-
console.error(
|
|
14566
|
+
console.error(chalk50.dim(` ${error.message}`));
|
|
14900
14567
|
}
|
|
14901
14568
|
console.log(
|
|
14902
|
-
` To enable manually: ${
|
|
14569
|
+
` To enable manually: ${chalk50.cyan(`vm0 schedule enable ${agentName}`)}`
|
|
14903
14570
|
);
|
|
14904
14571
|
}
|
|
14905
14572
|
}
|
|
14906
14573
|
function showEnableHint(agentName) {
|
|
14907
14574
|
console.log();
|
|
14908
|
-
console.log(` To enable: ${
|
|
14575
|
+
console.log(` To enable: ${chalk50.cyan(`vm0 schedule enable ${agentName}`)}`);
|
|
14909
14576
|
}
|
|
14910
14577
|
async function handleScheduleEnabling(params) {
|
|
14911
14578
|
const { scheduleName, composeId, agentName, enableFlag, shouldPromptEnable } = params;
|
|
@@ -14937,7 +14604,7 @@ var setupCommand = new Command56().name("setup").description("Create or edit a s
|
|
|
14937
14604
|
scheduleName
|
|
14938
14605
|
);
|
|
14939
14606
|
console.log(
|
|
14940
|
-
|
|
14607
|
+
chalk50.dim(
|
|
14941
14608
|
existingSchedule ? `Editing existing schedule for agent ${agentName}` : `Creating new schedule for agent ${agentName}`
|
|
14942
14609
|
)
|
|
14943
14610
|
);
|
|
@@ -14947,12 +14614,12 @@ var setupCommand = new Command56().name("setup").description("Create or edit a s
|
|
|
14947
14614
|
defaults.frequency
|
|
14948
14615
|
);
|
|
14949
14616
|
if (!frequency) {
|
|
14950
|
-
console.log(
|
|
14617
|
+
console.log(chalk50.dim("Cancelled"));
|
|
14951
14618
|
return;
|
|
14952
14619
|
}
|
|
14953
14620
|
const timing = await gatherTiming(frequency, options, defaults);
|
|
14954
14621
|
if (!timing) {
|
|
14955
|
-
console.log(
|
|
14622
|
+
console.log(chalk50.dim("Cancelled"));
|
|
14956
14623
|
return;
|
|
14957
14624
|
}
|
|
14958
14625
|
const { day, time, atTime, intervalSeconds } = timing;
|
|
@@ -14961,7 +14628,7 @@ var setupCommand = new Command56().name("setup").description("Create or edit a s
|
|
|
14961
14628
|
existingSchedule?.timezone
|
|
14962
14629
|
);
|
|
14963
14630
|
if (!timezone) {
|
|
14964
|
-
console.log(
|
|
14631
|
+
console.log(chalk50.dim("Cancelled"));
|
|
14965
14632
|
return;
|
|
14966
14633
|
}
|
|
14967
14634
|
const promptText_ = await gatherPromptText(
|
|
@@ -14969,7 +14636,7 @@ var setupCommand = new Command56().name("setup").description("Create or edit a s
|
|
|
14969
14636
|
existingSchedule?.prompt
|
|
14970
14637
|
);
|
|
14971
14638
|
if (!promptText_) {
|
|
14972
|
-
console.log(
|
|
14639
|
+
console.log(chalk50.dim("Cancelled"));
|
|
14973
14640
|
return;
|
|
14974
14641
|
}
|
|
14975
14642
|
const { notifyEmail, notifySlack } = await gatherNotificationPreferences(
|
|
@@ -15006,14 +14673,14 @@ var setupCommand = new Command56().name("setup").description("Create or edit a s
|
|
|
15006
14673
|
|
|
15007
14674
|
// src/commands/schedule/list.ts
|
|
15008
14675
|
import { Command as Command57 } from "commander";
|
|
15009
|
-
import
|
|
14676
|
+
import chalk51 from "chalk";
|
|
15010
14677
|
var listCommand7 = new Command57().name("list").alias("ls").description("List all schedules").action(
|
|
15011
14678
|
withErrorHandler(async () => {
|
|
15012
14679
|
const result = await listSchedules();
|
|
15013
14680
|
if (result.schedules.length === 0) {
|
|
15014
|
-
console.log(
|
|
14681
|
+
console.log(chalk51.dim("No schedules found"));
|
|
15015
14682
|
console.log(
|
|
15016
|
-
|
|
14683
|
+
chalk51.dim(" Create one with: vm0 schedule setup <agent-name>")
|
|
15017
14684
|
);
|
|
15018
14685
|
return;
|
|
15019
14686
|
}
|
|
@@ -15038,10 +14705,10 @@ var listCommand7 = new Command57().name("list").alias("ls").description("List al
|
|
|
15038
14705
|
"STATUS".padEnd(8),
|
|
15039
14706
|
"NEXT RUN"
|
|
15040
14707
|
].join(" ");
|
|
15041
|
-
console.log(
|
|
14708
|
+
console.log(chalk51.dim(header));
|
|
15042
14709
|
for (const schedule of result.schedules) {
|
|
15043
14710
|
const trigger = schedule.cronExpression ? `${schedule.cronExpression} (${schedule.timezone})` : schedule.atTime || "-";
|
|
15044
|
-
const status = schedule.enabled ?
|
|
14711
|
+
const status = schedule.enabled ? chalk51.green("enabled") : chalk51.yellow("disabled");
|
|
15045
14712
|
const nextRun = schedule.enabled ? formatRelativeTime2(schedule.nextRunAt) : "-";
|
|
15046
14713
|
const row = [
|
|
15047
14714
|
schedule.composeName.padEnd(agentWidth),
|
|
@@ -15058,47 +14725,47 @@ var listCommand7 = new Command57().name("list").alias("ls").description("List al
|
|
|
15058
14725
|
|
|
15059
14726
|
// src/commands/schedule/status.ts
|
|
15060
14727
|
import { Command as Command58 } from "commander";
|
|
15061
|
-
import
|
|
14728
|
+
import chalk52 from "chalk";
|
|
15062
14729
|
function formatDateTimeStyled(dateStr) {
|
|
15063
|
-
if (!dateStr) return
|
|
14730
|
+
if (!dateStr) return chalk52.dim("-");
|
|
15064
14731
|
const formatted = formatDateTime(dateStr);
|
|
15065
|
-
return formatted.replace(/\(([^)]+)\)$/,
|
|
14732
|
+
return formatted.replace(/\(([^)]+)\)$/, chalk52.dim("($1)"));
|
|
15066
14733
|
}
|
|
15067
14734
|
function formatTrigger(schedule) {
|
|
15068
14735
|
if (schedule.triggerType === "loop" && schedule.intervalSeconds !== null) {
|
|
15069
|
-
return `interval ${schedule.intervalSeconds}s ${
|
|
14736
|
+
return `interval ${schedule.intervalSeconds}s ${chalk52.dim("(loop)")}`;
|
|
15070
14737
|
}
|
|
15071
14738
|
if (schedule.cronExpression) {
|
|
15072
14739
|
return schedule.cronExpression;
|
|
15073
14740
|
}
|
|
15074
14741
|
if (schedule.atTime) {
|
|
15075
|
-
return `${schedule.atTime} ${
|
|
14742
|
+
return `${schedule.atTime} ${chalk52.dim("(one-time)")}`;
|
|
15076
14743
|
}
|
|
15077
|
-
return
|
|
14744
|
+
return chalk52.dim("-");
|
|
15078
14745
|
}
|
|
15079
14746
|
function formatRunStatus2(status) {
|
|
15080
14747
|
switch (status) {
|
|
15081
14748
|
case "completed":
|
|
15082
|
-
return
|
|
14749
|
+
return chalk52.green(status);
|
|
15083
14750
|
case "failed":
|
|
15084
14751
|
case "timeout":
|
|
15085
|
-
return
|
|
14752
|
+
return chalk52.red(status);
|
|
15086
14753
|
case "running":
|
|
15087
|
-
return
|
|
14754
|
+
return chalk52.cyan(status);
|
|
15088
14755
|
case "pending":
|
|
15089
|
-
return
|
|
14756
|
+
return chalk52.yellow(status);
|
|
15090
14757
|
default:
|
|
15091
14758
|
return status;
|
|
15092
14759
|
}
|
|
15093
14760
|
}
|
|
15094
14761
|
function printRunConfiguration(schedule) {
|
|
15095
|
-
const statusText = schedule.enabled ?
|
|
14762
|
+
const statusText = schedule.enabled ? chalk52.green("enabled") : chalk52.yellow("disabled");
|
|
15096
14763
|
console.log(`${"Status:".padEnd(16)}${statusText}`);
|
|
15097
14764
|
console.log(
|
|
15098
|
-
`${"Agent:".padEnd(16)}${schedule.composeName} ${
|
|
14765
|
+
`${"Agent:".padEnd(16)}${schedule.composeName} ${chalk52.dim(`(${schedule.orgSlug})`)}`
|
|
15099
14766
|
);
|
|
15100
14767
|
const promptPreview = schedule.prompt.length > 60 ? schedule.prompt.slice(0, 57) + "..." : schedule.prompt;
|
|
15101
|
-
console.log(`${"Prompt:".padEnd(16)}${
|
|
14768
|
+
console.log(`${"Prompt:".padEnd(16)}${chalk52.dim(promptPreview)}`);
|
|
15102
14769
|
if (schedule.vars && Object.keys(schedule.vars).length > 0) {
|
|
15103
14770
|
console.log(
|
|
15104
14771
|
`${"Variables:".padEnd(16)}${Object.keys(schedule.vars).join(", ")}`
|
|
@@ -15127,7 +14794,7 @@ function printTimeSchedule(schedule) {
|
|
|
15127
14794
|
);
|
|
15128
14795
|
}
|
|
15129
14796
|
if (schedule.triggerType === "loop") {
|
|
15130
|
-
const failureText = schedule.consecutiveFailures > 0 ?
|
|
14797
|
+
const failureText = schedule.consecutiveFailures > 0 ? chalk52.yellow(`${schedule.consecutiveFailures}/3`) : chalk52.dim("0/3");
|
|
15131
14798
|
console.log(`${"Failures:".padEnd(16)}${failureText}`);
|
|
15132
14799
|
}
|
|
15133
14800
|
}
|
|
@@ -15143,7 +14810,7 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
15143
14810
|
console.log();
|
|
15144
14811
|
console.log("Recent Runs:");
|
|
15145
14812
|
console.log(
|
|
15146
|
-
|
|
14813
|
+
chalk52.dim("RUN ID STATUS CREATED")
|
|
15147
14814
|
);
|
|
15148
14815
|
for (const run of runs) {
|
|
15149
14816
|
const id = run.id;
|
|
@@ -15154,7 +14821,7 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
15154
14821
|
}
|
|
15155
14822
|
} catch {
|
|
15156
14823
|
console.log();
|
|
15157
|
-
console.log(
|
|
14824
|
+
console.log(chalk52.dim("Recent Runs: (unable to fetch)"));
|
|
15158
14825
|
}
|
|
15159
14826
|
}
|
|
15160
14827
|
var statusCommand7 = new Command58().name("status").description("Show detailed status of a schedule").argument("<agent-name>", "Agent name").option(
|
|
@@ -15171,8 +14838,8 @@ var statusCommand7 = new Command58().name("status").description("Show detailed s
|
|
|
15171
14838
|
const { name, composeId } = resolved;
|
|
15172
14839
|
const schedule = await getScheduleByName({ name, composeId });
|
|
15173
14840
|
console.log();
|
|
15174
|
-
console.log(`Schedule for agent: ${
|
|
15175
|
-
console.log(
|
|
14841
|
+
console.log(`Schedule for agent: ${chalk52.cyan(agentName)}`);
|
|
14842
|
+
console.log(chalk52.dim("\u2501".repeat(50)));
|
|
15176
14843
|
printRunConfiguration(schedule);
|
|
15177
14844
|
printTimeSchedule(schedule);
|
|
15178
14845
|
const parsed = parseInt(options.limit, 10);
|
|
@@ -15188,7 +14855,7 @@ var statusCommand7 = new Command58().name("status").description("Show detailed s
|
|
|
15188
14855
|
|
|
15189
14856
|
// src/commands/schedule/delete.ts
|
|
15190
14857
|
import { Command as Command59 } from "commander";
|
|
15191
|
-
import
|
|
14858
|
+
import chalk53 from "chalk";
|
|
15192
14859
|
var deleteCommand2 = new Command59().name("delete").alias("rm").description("Delete a schedule").argument("<agent-name>", "Agent name").option(
|
|
15193
14860
|
"-n, --name <schedule-name>",
|
|
15194
14861
|
"Schedule name (required when agent has multiple schedules)"
|
|
@@ -15201,11 +14868,11 @@ var deleteCommand2 = new Command59().name("delete").alias("rm").description("Del
|
|
|
15201
14868
|
throw new Error("--yes flag is required in non-interactive mode");
|
|
15202
14869
|
}
|
|
15203
14870
|
const confirmed = await promptConfirm(
|
|
15204
|
-
`Delete schedule for agent ${
|
|
14871
|
+
`Delete schedule for agent ${chalk53.cyan(agentName)}?`,
|
|
15205
14872
|
false
|
|
15206
14873
|
);
|
|
15207
14874
|
if (!confirmed) {
|
|
15208
|
-
console.log(
|
|
14875
|
+
console.log(chalk53.dim("Cancelled"));
|
|
15209
14876
|
return;
|
|
15210
14877
|
}
|
|
15211
14878
|
}
|
|
@@ -15214,7 +14881,7 @@ var deleteCommand2 = new Command59().name("delete").alias("rm").description("Del
|
|
|
15214
14881
|
composeId: resolved.composeId
|
|
15215
14882
|
});
|
|
15216
14883
|
console.log(
|
|
15217
|
-
|
|
14884
|
+
chalk53.green(`\u2713 Deleted schedule for agent ${chalk53.cyan(agentName)}`)
|
|
15218
14885
|
);
|
|
15219
14886
|
}
|
|
15220
14887
|
)
|
|
@@ -15222,7 +14889,7 @@ var deleteCommand2 = new Command59().name("delete").alias("rm").description("Del
|
|
|
15222
14889
|
|
|
15223
14890
|
// src/commands/schedule/enable.ts
|
|
15224
14891
|
import { Command as Command60 } from "commander";
|
|
15225
|
-
import
|
|
14892
|
+
import chalk54 from "chalk";
|
|
15226
14893
|
var enableCommand = new Command60().name("enable").description("Enable a schedule").argument("<agent-name>", "Agent name").option(
|
|
15227
14894
|
"-n, --name <schedule-name>",
|
|
15228
14895
|
"Schedule name (required when agent has multiple schedules)"
|
|
@@ -15234,14 +14901,14 @@ var enableCommand = new Command60().name("enable").description("Enable a schedul
|
|
|
15234
14901
|
composeId: resolved.composeId
|
|
15235
14902
|
});
|
|
15236
14903
|
console.log(
|
|
15237
|
-
|
|
14904
|
+
chalk54.green(`\u2713 Enabled schedule for agent ${chalk54.cyan(agentName)}`)
|
|
15238
14905
|
);
|
|
15239
14906
|
})
|
|
15240
14907
|
);
|
|
15241
14908
|
|
|
15242
14909
|
// src/commands/schedule/disable.ts
|
|
15243
14910
|
import { Command as Command61 } from "commander";
|
|
15244
|
-
import
|
|
14911
|
+
import chalk55 from "chalk";
|
|
15245
14912
|
var disableCommand = new Command61().name("disable").description("Disable a schedule").argument("<agent-name>", "Agent name").option(
|
|
15246
14913
|
"-n, --name <schedule-name>",
|
|
15247
14914
|
"Schedule name (required when agent has multiple schedules)"
|
|
@@ -15253,7 +14920,7 @@ var disableCommand = new Command61().name("disable").description("Disable a sche
|
|
|
15253
14920
|
composeId: resolved.composeId
|
|
15254
14921
|
});
|
|
15255
14922
|
console.log(
|
|
15256
|
-
|
|
14923
|
+
chalk55.green(`\u2713 Disabled schedule for agent ${chalk55.cyan(agentName)}`)
|
|
15257
14924
|
);
|
|
15258
14925
|
})
|
|
15259
14926
|
);
|
|
@@ -15263,7 +14930,7 @@ var scheduleCommand = new Command62().name("schedule").description("Manage agent
|
|
|
15263
14930
|
|
|
15264
14931
|
// src/commands/usage/index.ts
|
|
15265
14932
|
import { Command as Command63 } from "commander";
|
|
15266
|
-
import
|
|
14933
|
+
import chalk56 from "chalk";
|
|
15267
14934
|
|
|
15268
14935
|
// src/lib/utils/duration-formatter.ts
|
|
15269
14936
|
function formatDuration(ms) {
|
|
@@ -15388,19 +15055,19 @@ var usageCommand = new Command63().name("usage").description("View usage statist
|
|
|
15388
15055
|
);
|
|
15389
15056
|
console.log();
|
|
15390
15057
|
console.log(
|
|
15391
|
-
|
|
15058
|
+
chalk56.bold(
|
|
15392
15059
|
`Usage Summary (${formatDateRange(usage.period.start, usage.period.end)})`
|
|
15393
15060
|
)
|
|
15394
15061
|
);
|
|
15395
15062
|
console.log();
|
|
15396
|
-
console.log(
|
|
15063
|
+
console.log(chalk56.dim("DATE RUNS RUN TIME"));
|
|
15397
15064
|
for (const day of filledDaily) {
|
|
15398
15065
|
const dateDisplay = formatDateDisplay(day.date).padEnd(10);
|
|
15399
15066
|
const runsDisplay = String(day.run_count).padStart(6);
|
|
15400
15067
|
const timeDisplay = formatDuration(day.run_time_ms);
|
|
15401
15068
|
console.log(`${dateDisplay}${runsDisplay} ${timeDisplay}`);
|
|
15402
15069
|
}
|
|
15403
|
-
console.log(
|
|
15070
|
+
console.log(chalk56.dim("\u2500".repeat(29)));
|
|
15404
15071
|
const totalRunsDisplay = String(usage.summary.total_runs).padStart(6);
|
|
15405
15072
|
const totalTimeDisplay = formatDuration(usage.summary.total_run_time_ms);
|
|
15406
15073
|
console.log(
|
|
@@ -15415,62 +15082,62 @@ import { Command as Command67 } from "commander";
|
|
|
15415
15082
|
|
|
15416
15083
|
// src/commands/secret/list.ts
|
|
15417
15084
|
import { Command as Command64 } from "commander";
|
|
15418
|
-
import
|
|
15085
|
+
import chalk57 from "chalk";
|
|
15419
15086
|
var listCommand8 = new Command64().name("list").alias("ls").description("List all secrets").action(
|
|
15420
15087
|
withErrorHandler(async () => {
|
|
15421
15088
|
const result = await listSecrets();
|
|
15422
15089
|
if (result.secrets.length === 0) {
|
|
15423
|
-
console.log(
|
|
15090
|
+
console.log(chalk57.dim("No secrets found"));
|
|
15424
15091
|
console.log();
|
|
15425
15092
|
console.log("To add a secret:");
|
|
15426
|
-
console.log(
|
|
15093
|
+
console.log(chalk57.cyan(" vm0 secret set MY_API_KEY --body <value>"));
|
|
15427
15094
|
return;
|
|
15428
15095
|
}
|
|
15429
|
-
console.log(
|
|
15096
|
+
console.log(chalk57.bold("Secrets:"));
|
|
15430
15097
|
console.log();
|
|
15431
15098
|
for (const secret of result.secrets) {
|
|
15432
15099
|
let typeIndicator = "";
|
|
15433
15100
|
let derivedLine = null;
|
|
15434
15101
|
if (secret.type === "model-provider") {
|
|
15435
|
-
typeIndicator =
|
|
15102
|
+
typeIndicator = chalk57.dim(" [model-provider]");
|
|
15436
15103
|
} else if (secret.type === "connector") {
|
|
15437
15104
|
const derived = getConnectorDerivedNames(secret.name);
|
|
15438
15105
|
if (derived) {
|
|
15439
|
-
typeIndicator =
|
|
15440
|
-
derivedLine =
|
|
15106
|
+
typeIndicator = chalk57.dim(` [${derived.connectorLabel} connector]`);
|
|
15107
|
+
derivedLine = chalk57.dim(
|
|
15441
15108
|
`Available as: ${derived.envVarNames.join(", ")}`
|
|
15442
15109
|
);
|
|
15443
15110
|
} else {
|
|
15444
|
-
typeIndicator =
|
|
15111
|
+
typeIndicator = chalk57.dim(" [connector]");
|
|
15445
15112
|
}
|
|
15446
15113
|
} else if (secret.type === "user") {
|
|
15447
15114
|
const derived = getConnectorDerivedNames(secret.name);
|
|
15448
15115
|
if (derived) {
|
|
15449
|
-
typeIndicator =
|
|
15450
|
-
derivedLine =
|
|
15116
|
+
typeIndicator = chalk57.dim(` [${derived.connectorLabel} connector]`);
|
|
15117
|
+
derivedLine = chalk57.dim(
|
|
15451
15118
|
`Available as: ${derived.envVarNames.join(", ")}`
|
|
15452
15119
|
);
|
|
15453
15120
|
}
|
|
15454
15121
|
}
|
|
15455
|
-
console.log(` ${
|
|
15122
|
+
console.log(` ${chalk57.cyan(secret.name)}${typeIndicator}`);
|
|
15456
15123
|
if (derivedLine) {
|
|
15457
15124
|
console.log(` ${derivedLine}`);
|
|
15458
15125
|
}
|
|
15459
15126
|
if (secret.description) {
|
|
15460
|
-
console.log(` ${
|
|
15127
|
+
console.log(` ${chalk57.dim(secret.description)}`);
|
|
15461
15128
|
}
|
|
15462
15129
|
console.log(
|
|
15463
|
-
` ${
|
|
15130
|
+
` ${chalk57.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
15464
15131
|
);
|
|
15465
15132
|
console.log();
|
|
15466
15133
|
}
|
|
15467
|
-
console.log(
|
|
15134
|
+
console.log(chalk57.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
15468
15135
|
})
|
|
15469
15136
|
);
|
|
15470
15137
|
|
|
15471
15138
|
// src/commands/secret/set.ts
|
|
15472
15139
|
import { Command as Command65 } from "commander";
|
|
15473
|
-
import
|
|
15140
|
+
import chalk58 from "chalk";
|
|
15474
15141
|
var setCommand2 = new Command65().name("set").description("Create or update a secret").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
15475
15142
|
"-b, --body <value>",
|
|
15476
15143
|
"Secret value (required in non-interactive mode)"
|
|
@@ -15510,18 +15177,18 @@ var setCommand2 = new Command65().name("set").description("Create or update a se
|
|
|
15510
15177
|
}
|
|
15511
15178
|
throw error;
|
|
15512
15179
|
}
|
|
15513
|
-
console.log(
|
|
15180
|
+
console.log(chalk58.green(`\u2713 Secret "${secret.name}" saved`));
|
|
15514
15181
|
console.log();
|
|
15515
15182
|
console.log("Use in vm0.yaml:");
|
|
15516
|
-
console.log(
|
|
15517
|
-
console.log(
|
|
15183
|
+
console.log(chalk58.cyan(` environment:`));
|
|
15184
|
+
console.log(chalk58.cyan(` ${name}: \${{ secrets.${name} }}`));
|
|
15518
15185
|
}
|
|
15519
15186
|
)
|
|
15520
15187
|
);
|
|
15521
15188
|
|
|
15522
15189
|
// src/commands/secret/delete.ts
|
|
15523
15190
|
import { Command as Command66 } from "commander";
|
|
15524
|
-
import
|
|
15191
|
+
import chalk59 from "chalk";
|
|
15525
15192
|
var deleteCommand3 = new Command66().name("delete").description("Delete a secret").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
15526
15193
|
withErrorHandler(async (name, options) => {
|
|
15527
15194
|
try {
|
|
@@ -15541,12 +15208,12 @@ var deleteCommand3 = new Command66().name("delete").description("Delete a secret
|
|
|
15541
15208
|
false
|
|
15542
15209
|
);
|
|
15543
15210
|
if (!confirmed) {
|
|
15544
|
-
console.log(
|
|
15211
|
+
console.log(chalk59.dim("Cancelled"));
|
|
15545
15212
|
return;
|
|
15546
15213
|
}
|
|
15547
15214
|
}
|
|
15548
15215
|
await deleteSecret(name);
|
|
15549
|
-
console.log(
|
|
15216
|
+
console.log(chalk59.green(`\u2713 Secret "${name}" deleted`));
|
|
15550
15217
|
})
|
|
15551
15218
|
);
|
|
15552
15219
|
|
|
@@ -15558,7 +15225,7 @@ import { Command as Command71 } from "commander";
|
|
|
15558
15225
|
|
|
15559
15226
|
// src/commands/variable/list.ts
|
|
15560
15227
|
import { Command as Command68 } from "commander";
|
|
15561
|
-
import
|
|
15228
|
+
import chalk60 from "chalk";
|
|
15562
15229
|
function truncateValue(value, maxLength = 60) {
|
|
15563
15230
|
if (value.length <= maxLength) {
|
|
15564
15231
|
return value;
|
|
@@ -15569,32 +15236,32 @@ var listCommand9 = new Command68().name("list").alias("ls").description("List al
|
|
|
15569
15236
|
withErrorHandler(async () => {
|
|
15570
15237
|
const result = await listVariables();
|
|
15571
15238
|
if (result.variables.length === 0) {
|
|
15572
|
-
console.log(
|
|
15239
|
+
console.log(chalk60.dim("No variables found"));
|
|
15573
15240
|
console.log();
|
|
15574
15241
|
console.log("To add a variable:");
|
|
15575
|
-
console.log(
|
|
15242
|
+
console.log(chalk60.cyan(" vm0 variable set MY_VAR <value>"));
|
|
15576
15243
|
return;
|
|
15577
15244
|
}
|
|
15578
|
-
console.log(
|
|
15245
|
+
console.log(chalk60.bold("Variables:"));
|
|
15579
15246
|
console.log();
|
|
15580
15247
|
for (const variable of result.variables) {
|
|
15581
15248
|
const displayValue = truncateValue(variable.value);
|
|
15582
|
-
console.log(` ${
|
|
15249
|
+
console.log(` ${chalk60.cyan(variable.name)} = ${displayValue}`);
|
|
15583
15250
|
if (variable.description) {
|
|
15584
|
-
console.log(` ${
|
|
15251
|
+
console.log(` ${chalk60.dim(variable.description)}`);
|
|
15585
15252
|
}
|
|
15586
15253
|
console.log(
|
|
15587
|
-
` ${
|
|
15254
|
+
` ${chalk60.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
15588
15255
|
);
|
|
15589
15256
|
console.log();
|
|
15590
15257
|
}
|
|
15591
|
-
console.log(
|
|
15258
|
+
console.log(chalk60.dim(`Total: ${result.variables.length} variable(s)`));
|
|
15592
15259
|
})
|
|
15593
15260
|
);
|
|
15594
15261
|
|
|
15595
15262
|
// src/commands/variable/set.ts
|
|
15596
15263
|
import { Command as Command69 } from "commander";
|
|
15597
|
-
import
|
|
15264
|
+
import chalk61 from "chalk";
|
|
15598
15265
|
var setCommand3 = new Command69().name("set").description("Create or update a variable").argument("<name>", "Variable name (uppercase, e.g., MY_VAR)").argument("<value>", "Variable value").option("-d, --description <description>", "Optional description").action(
|
|
15599
15266
|
withErrorHandler(
|
|
15600
15267
|
async (name, value, options) => {
|
|
@@ -15615,18 +15282,18 @@ var setCommand3 = new Command69().name("set").description("Create or update a va
|
|
|
15615
15282
|
}
|
|
15616
15283
|
throw error;
|
|
15617
15284
|
}
|
|
15618
|
-
console.log(
|
|
15285
|
+
console.log(chalk61.green(`\u2713 Variable "${variable.name}" saved`));
|
|
15619
15286
|
console.log();
|
|
15620
15287
|
console.log("Use in vm0.yaml:");
|
|
15621
|
-
console.log(
|
|
15622
|
-
console.log(
|
|
15288
|
+
console.log(chalk61.cyan(` environment:`));
|
|
15289
|
+
console.log(chalk61.cyan(` ${name}: \${{ vars.${name} }}`));
|
|
15623
15290
|
}
|
|
15624
15291
|
)
|
|
15625
15292
|
);
|
|
15626
15293
|
|
|
15627
15294
|
// src/commands/variable/delete.ts
|
|
15628
15295
|
import { Command as Command70 } from "commander";
|
|
15629
|
-
import
|
|
15296
|
+
import chalk62 from "chalk";
|
|
15630
15297
|
var deleteCommand4 = new Command70().name("delete").description("Delete a variable").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
15631
15298
|
withErrorHandler(async (name, options) => {
|
|
15632
15299
|
try {
|
|
@@ -15646,12 +15313,12 @@ var deleteCommand4 = new Command70().name("delete").description("Delete a variab
|
|
|
15646
15313
|
false
|
|
15647
15314
|
);
|
|
15648
15315
|
if (!confirmed) {
|
|
15649
|
-
console.log(
|
|
15316
|
+
console.log(chalk62.dim("Cancelled"));
|
|
15650
15317
|
return;
|
|
15651
15318
|
}
|
|
15652
15319
|
}
|
|
15653
15320
|
await deleteVariable(name);
|
|
15654
|
-
console.log(
|
|
15321
|
+
console.log(chalk62.green(`\u2713 Variable "${name}" deleted`));
|
|
15655
15322
|
})
|
|
15656
15323
|
);
|
|
15657
15324
|
|
|
@@ -15663,15 +15330,15 @@ import { Command as Command76 } from "commander";
|
|
|
15663
15330
|
|
|
15664
15331
|
// src/commands/model-provider/list.ts
|
|
15665
15332
|
import { Command as Command72 } from "commander";
|
|
15666
|
-
import
|
|
15333
|
+
import chalk63 from "chalk";
|
|
15667
15334
|
var listCommand10 = new Command72().name("list").alias("ls").description("List all model providers").action(
|
|
15668
15335
|
withErrorHandler(async () => {
|
|
15669
15336
|
const result = await listModelProviders();
|
|
15670
15337
|
if (result.modelProviders.length === 0) {
|
|
15671
|
-
console.log(
|
|
15338
|
+
console.log(chalk63.dim("No model providers configured"));
|
|
15672
15339
|
console.log();
|
|
15673
15340
|
console.log("To add a model provider:");
|
|
15674
|
-
console.log(
|
|
15341
|
+
console.log(chalk63.cyan(" vm0 model-provider setup"));
|
|
15675
15342
|
return;
|
|
15676
15343
|
}
|
|
15677
15344
|
const byFramework = result.modelProviders.reduce(
|
|
@@ -15685,16 +15352,16 @@ var listCommand10 = new Command72().name("list").alias("ls").description("List a
|
|
|
15685
15352
|
},
|
|
15686
15353
|
{}
|
|
15687
15354
|
);
|
|
15688
|
-
console.log(
|
|
15355
|
+
console.log(chalk63.bold("Model Providers:"));
|
|
15689
15356
|
console.log();
|
|
15690
15357
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
15691
|
-
console.log(` ${
|
|
15358
|
+
console.log(` ${chalk63.cyan(framework)}:`);
|
|
15692
15359
|
for (const provider of providers) {
|
|
15693
|
-
const defaultTag = provider.isDefault ?
|
|
15694
|
-
const modelTag = provider.selectedModel ?
|
|
15360
|
+
const defaultTag = provider.isDefault ? chalk63.green(" (default)") : "";
|
|
15361
|
+
const modelTag = provider.selectedModel ? chalk63.dim(` [${provider.selectedModel}]`) : "";
|
|
15695
15362
|
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
15696
15363
|
console.log(
|
|
15697
|
-
|
|
15364
|
+
chalk63.dim(
|
|
15698
15365
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
15699
15366
|
)
|
|
15700
15367
|
);
|
|
@@ -15702,14 +15369,14 @@ var listCommand10 = new Command72().name("list").alias("ls").description("List a
|
|
|
15702
15369
|
console.log();
|
|
15703
15370
|
}
|
|
15704
15371
|
console.log(
|
|
15705
|
-
|
|
15372
|
+
chalk63.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
15706
15373
|
);
|
|
15707
15374
|
})
|
|
15708
15375
|
);
|
|
15709
15376
|
|
|
15710
15377
|
// src/commands/model-provider/setup.ts
|
|
15711
15378
|
import { Command as Command73 } from "commander";
|
|
15712
|
-
import
|
|
15379
|
+
import chalk64 from "chalk";
|
|
15713
15380
|
import prompts2 from "prompts";
|
|
15714
15381
|
function validateProviderType(typeStr) {
|
|
15715
15382
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
@@ -15893,7 +15560,7 @@ async function promptForModelSelection(type2) {
|
|
|
15893
15560
|
if (selected === "__custom__") {
|
|
15894
15561
|
const placeholder = getCustomModelPlaceholder(type2);
|
|
15895
15562
|
if (placeholder) {
|
|
15896
|
-
console.log(
|
|
15563
|
+
console.log(chalk64.dim(`Example: ${placeholder}`));
|
|
15897
15564
|
}
|
|
15898
15565
|
const customResponse = await prompts2(
|
|
15899
15566
|
{
|
|
@@ -15943,7 +15610,7 @@ async function promptForSecrets(type2, authMethod) {
|
|
|
15943
15610
|
const secrets = {};
|
|
15944
15611
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
15945
15612
|
if (fieldConfig.helpText) {
|
|
15946
|
-
console.log(
|
|
15613
|
+
console.log(chalk64.dim(fieldConfig.helpText));
|
|
15947
15614
|
}
|
|
15948
15615
|
const isSensitive = isSensitiveSecret(name);
|
|
15949
15616
|
const placeholder = "placeholder" in fieldConfig ? fieldConfig.placeholder : "";
|
|
@@ -15995,7 +15662,7 @@ async function handleInteractiveMode() {
|
|
|
15995
15662
|
title = `${title} \u2713`;
|
|
15996
15663
|
}
|
|
15997
15664
|
if (isExperimental) {
|
|
15998
|
-
title = `${title} ${
|
|
15665
|
+
title = `${title} ${chalk64.dim("(experimental)")}`;
|
|
15999
15666
|
}
|
|
16000
15667
|
return {
|
|
16001
15668
|
title,
|
|
@@ -16042,7 +15709,7 @@ async function handleInteractiveMode() {
|
|
|
16042
15709
|
}
|
|
16043
15710
|
const config = MODEL_PROVIDER_TYPES[type2];
|
|
16044
15711
|
console.log();
|
|
16045
|
-
console.log(
|
|
15712
|
+
console.log(chalk64.dim(config.helpText));
|
|
16046
15713
|
console.log();
|
|
16047
15714
|
if (hasAuthMethods(type2)) {
|
|
16048
15715
|
const authMethod = await promptForAuthMethod(type2);
|
|
@@ -16083,7 +15750,7 @@ async function promptSetAsDefault(type2, framework, isDefault) {
|
|
|
16083
15750
|
);
|
|
16084
15751
|
if (response.setDefault) {
|
|
16085
15752
|
await setModelProviderDefault(type2);
|
|
16086
|
-
console.log(
|
|
15753
|
+
console.log(chalk64.green(`\u2713 Default for ${framework} set to "${type2}"`));
|
|
16087
15754
|
}
|
|
16088
15755
|
}
|
|
16089
15756
|
function collectSecrets(value, previous) {
|
|
@@ -16127,11 +15794,11 @@ var setupCommand2 = new Command73().name("setup").description("Configure a model
|
|
|
16127
15794
|
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
16128
15795
|
if (!hasModelSelection(input.type)) {
|
|
16129
15796
|
console.log(
|
|
16130
|
-
|
|
15797
|
+
chalk64.green(`\u2713 Model provider "${input.type}" unchanged`)
|
|
16131
15798
|
);
|
|
16132
15799
|
} else {
|
|
16133
15800
|
console.log(
|
|
16134
|
-
|
|
15801
|
+
chalk64.green(
|
|
16135
15802
|
`\u2713 Model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
16136
15803
|
)
|
|
16137
15804
|
);
|
|
@@ -16156,7 +15823,7 @@ var setupCommand2 = new Command73().name("setup").description("Configure a model
|
|
|
16156
15823
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
16157
15824
|
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
16158
15825
|
console.log(
|
|
16159
|
-
|
|
15826
|
+
chalk64.green(
|
|
16160
15827
|
`\u2713 Model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
16161
15828
|
)
|
|
16162
15829
|
);
|
|
@@ -16173,7 +15840,7 @@ var setupCommand2 = new Command73().name("setup").description("Configure a model
|
|
|
16173
15840
|
|
|
16174
15841
|
// src/commands/model-provider/delete.ts
|
|
16175
15842
|
import { Command as Command74 } from "commander";
|
|
16176
|
-
import
|
|
15843
|
+
import chalk65 from "chalk";
|
|
16177
15844
|
var deleteCommand5 = new Command74().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(
|
|
16178
15845
|
withErrorHandler(async (type2) => {
|
|
16179
15846
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
@@ -16183,13 +15850,13 @@ var deleteCommand5 = new Command74().name("delete").description("Delete a model
|
|
|
16183
15850
|
});
|
|
16184
15851
|
}
|
|
16185
15852
|
await deleteModelProvider(type2);
|
|
16186
|
-
console.log(
|
|
15853
|
+
console.log(chalk65.green(`\u2713 Model provider "${type2}" deleted`));
|
|
16187
15854
|
})
|
|
16188
15855
|
);
|
|
16189
15856
|
|
|
16190
15857
|
// src/commands/model-provider/set-default.ts
|
|
16191
15858
|
import { Command as Command75 } from "commander";
|
|
16192
|
-
import
|
|
15859
|
+
import chalk66 from "chalk";
|
|
16193
15860
|
var setDefaultCommand = new Command75().name("set-default").description("Set a model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(
|
|
16194
15861
|
withErrorHandler(async (type2) => {
|
|
16195
15862
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
@@ -16200,7 +15867,7 @@ var setDefaultCommand = new Command75().name("set-default").description("Set a m
|
|
|
16200
15867
|
}
|
|
16201
15868
|
const provider = await setModelProviderDefault(type2);
|
|
16202
15869
|
console.log(
|
|
16203
|
-
|
|
15870
|
+
chalk66.green(
|
|
16204
15871
|
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
16205
15872
|
)
|
|
16206
15873
|
);
|
|
@@ -16215,7 +15882,7 @@ import { Command as Command81 } from "commander";
|
|
|
16215
15882
|
|
|
16216
15883
|
// src/commands/connector/connect.ts
|
|
16217
15884
|
import { Command as Command77 } from "commander";
|
|
16218
|
-
import
|
|
15885
|
+
import chalk68 from "chalk";
|
|
16219
15886
|
import { initClient as initClient13 } from "@ts-rest/core";
|
|
16220
15887
|
|
|
16221
15888
|
// src/commands/connector/lib/computer/start-services.ts
|
|
@@ -16224,7 +15891,7 @@ import { access as access2, constants } from "fs/promises";
|
|
|
16224
15891
|
import { createServer } from "net";
|
|
16225
15892
|
import { homedir as homedir4 } from "os";
|
|
16226
15893
|
import { join as join12 } from "path";
|
|
16227
|
-
import
|
|
15894
|
+
import chalk67 from "chalk";
|
|
16228
15895
|
|
|
16229
15896
|
// src/commands/connector/lib/computer/ngrok.ts
|
|
16230
15897
|
import ngrok from "@ngrok/ngrok";
|
|
@@ -16298,7 +15965,7 @@ async function checkComputerDependencies() {
|
|
|
16298
15965
|
}
|
|
16299
15966
|
}
|
|
16300
15967
|
async function startComputerServices(credentials) {
|
|
16301
|
-
console.log(
|
|
15968
|
+
console.log(chalk67.cyan("Starting computer connector services..."));
|
|
16302
15969
|
const wsgidavBinary = await findBinary("wsgidav");
|
|
16303
15970
|
if (!wsgidavBinary) {
|
|
16304
15971
|
throw new Error(
|
|
@@ -16325,7 +15992,7 @@ async function startComputerServices(credentials) {
|
|
|
16325
15992
|
);
|
|
16326
15993
|
wsgidav.stdout?.on("data", (data) => process.stdout.write(data));
|
|
16327
15994
|
wsgidav.stderr?.on("data", (data) => process.stderr.write(data));
|
|
16328
|
-
console.log(
|
|
15995
|
+
console.log(chalk67.green("\u2713 WebDAV server started"));
|
|
16329
15996
|
const chrome = spawn2(
|
|
16330
15997
|
chromeBinary,
|
|
16331
15998
|
[
|
|
@@ -16339,7 +16006,7 @@ async function startComputerServices(credentials) {
|
|
|
16339
16006
|
);
|
|
16340
16007
|
chrome.stdout?.on("data", (data) => process.stdout.write(data));
|
|
16341
16008
|
chrome.stderr?.on("data", (data) => process.stderr.write(data));
|
|
16342
|
-
console.log(
|
|
16009
|
+
console.log(chalk67.green("\u2713 Chrome started"));
|
|
16343
16010
|
try {
|
|
16344
16011
|
await startNgrokTunnels(
|
|
16345
16012
|
credentials.ngrokToken,
|
|
@@ -16348,18 +16015,18 @@ async function startComputerServices(credentials) {
|
|
|
16348
16015
|
cdpPort
|
|
16349
16016
|
);
|
|
16350
16017
|
console.log(
|
|
16351
|
-
|
|
16018
|
+
chalk67.green(
|
|
16352
16019
|
`\u2713 ngrok tunnels: webdav.${credentials.domain}, chrome.${credentials.domain}`
|
|
16353
16020
|
)
|
|
16354
16021
|
);
|
|
16355
16022
|
console.log();
|
|
16356
|
-
console.log(
|
|
16023
|
+
console.log(chalk67.green("\u2713 Computer connector active"));
|
|
16357
16024
|
console.log(` WebDAV: ~/Downloads \u2192 webdav.${credentials.domain}`);
|
|
16358
16025
|
console.log(
|
|
16359
16026
|
` Chrome CDP: port ${cdpPort} \u2192 chrome.${credentials.domain}`
|
|
16360
16027
|
);
|
|
16361
16028
|
console.log();
|
|
16362
|
-
console.log(
|
|
16029
|
+
console.log(chalk67.dim("Press ^C twice to disconnect"));
|
|
16363
16030
|
console.log();
|
|
16364
16031
|
let sigintCount = 0;
|
|
16365
16032
|
await new Promise((resolve2) => {
|
|
@@ -16373,7 +16040,7 @@ async function startComputerServices(credentials) {
|
|
|
16373
16040
|
const onSigint = () => {
|
|
16374
16041
|
sigintCount++;
|
|
16375
16042
|
if (sigintCount === 1) {
|
|
16376
|
-
console.log(
|
|
16043
|
+
console.log(chalk67.dim("\nPress ^C again to disconnect and exit..."));
|
|
16377
16044
|
} else {
|
|
16378
16045
|
done();
|
|
16379
16046
|
}
|
|
@@ -16383,11 +16050,11 @@ async function startComputerServices(credentials) {
|
|
|
16383
16050
|
});
|
|
16384
16051
|
} finally {
|
|
16385
16052
|
console.log();
|
|
16386
|
-
console.log(
|
|
16053
|
+
console.log(chalk67.cyan("Stopping services..."));
|
|
16387
16054
|
wsgidav.kill("SIGTERM");
|
|
16388
16055
|
chrome.kill("SIGTERM");
|
|
16389
16056
|
await stopNgrokTunnels();
|
|
16390
|
-
console.log(
|
|
16057
|
+
console.log(chalk67.green("\u2713 Services stopped"));
|
|
16391
16058
|
}
|
|
16392
16059
|
}
|
|
16393
16060
|
|
|
@@ -16412,10 +16079,10 @@ async function getHeaders2() {
|
|
|
16412
16079
|
function renderHelpText(text) {
|
|
16413
16080
|
return text.replace(
|
|
16414
16081
|
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
16415
|
-
(_m, label, url) => `${label} (${
|
|
16416
|
-
).replace(/\*\*([^*]+)\*\*/g, (_m, content) =>
|
|
16082
|
+
(_m, label, url) => `${label} (${chalk68.cyan(url)})`
|
|
16083
|
+
).replace(/\*\*([^*]+)\*\*/g, (_m, content) => chalk68.bold(content)).replace(
|
|
16417
16084
|
/^> (.+)$/gm,
|
|
16418
|
-
(_m, content) =>
|
|
16085
|
+
(_m, content) => chalk68.yellow(` ${content}`)
|
|
16419
16086
|
);
|
|
16420
16087
|
}
|
|
16421
16088
|
async function connectViaApiToken(connectorType, tokenValue) {
|
|
@@ -16440,7 +16107,7 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
16440
16107
|
for (const [secretName, secretConfig] of secretEntries) {
|
|
16441
16108
|
if (!secretConfig.required) continue;
|
|
16442
16109
|
const value = await promptPassword(
|
|
16443
|
-
`${secretConfig.label}${secretConfig.placeholder ?
|
|
16110
|
+
`${secretConfig.label}${secretConfig.placeholder ? chalk68.dim(` (${secretConfig.placeholder})`) : ""}:`
|
|
16444
16111
|
);
|
|
16445
16112
|
if (!value) {
|
|
16446
16113
|
throw new Error("Cancelled");
|
|
@@ -16456,13 +16123,13 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
16456
16123
|
});
|
|
16457
16124
|
}
|
|
16458
16125
|
console.log(
|
|
16459
|
-
|
|
16126
|
+
chalk68.green(`
|
|
16460
16127
|
\u2713 ${config.label} connected successfully via API token!`)
|
|
16461
16128
|
);
|
|
16462
16129
|
}
|
|
16463
16130
|
async function connectComputer(apiUrl, headers) {
|
|
16464
16131
|
await checkComputerDependencies();
|
|
16465
|
-
console.log(
|
|
16132
|
+
console.log(chalk68.cyan("Setting up computer connector..."));
|
|
16466
16133
|
const computerClient = initClient13(computerConnectorContract, {
|
|
16467
16134
|
baseUrl: apiUrl,
|
|
16468
16135
|
baseHeaders: headers,
|
|
@@ -16477,9 +16144,9 @@ async function connectComputer(apiUrl, headers) {
|
|
|
16477
16144
|
}
|
|
16478
16145
|
const credentials = createResult.body;
|
|
16479
16146
|
await startComputerServices(credentials);
|
|
16480
|
-
console.log(
|
|
16147
|
+
console.log(chalk68.cyan("Disconnecting computer connector..."));
|
|
16481
16148
|
await deleteConnector("computer");
|
|
16482
|
-
console.log(
|
|
16149
|
+
console.log(chalk68.green("\u2713 Disconnected computer"));
|
|
16483
16150
|
process.exit(0);
|
|
16484
16151
|
}
|
|
16485
16152
|
async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
@@ -16518,7 +16185,7 @@ async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
|
16518
16185
|
);
|
|
16519
16186
|
}
|
|
16520
16187
|
async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
16521
|
-
console.log(`Connecting ${
|
|
16188
|
+
console.log(`Connecting ${chalk68.cyan(connectorType)}...`);
|
|
16522
16189
|
const sessionsClient = initClient13(connectorSessionsContract, {
|
|
16523
16190
|
baseUrl: apiUrl,
|
|
16524
16191
|
baseHeaders: headers,
|
|
@@ -16534,8 +16201,8 @@ async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
|
16534
16201
|
}
|
|
16535
16202
|
const session = createResult.body;
|
|
16536
16203
|
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
16537
|
-
console.log(
|
|
16538
|
-
console.log(
|
|
16204
|
+
console.log(chalk68.green("\nSession created"));
|
|
16205
|
+
console.log(chalk68.cyan(`
|
|
16539
16206
|
To connect, visit: ${verificationUrl}`));
|
|
16540
16207
|
console.log(
|
|
16541
16208
|
`
|
|
@@ -16567,7 +16234,7 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
16567
16234
|
switch (status.status) {
|
|
16568
16235
|
case "complete":
|
|
16569
16236
|
console.log(
|
|
16570
|
-
|
|
16237
|
+
chalk68.green(`
|
|
16571
16238
|
|
|
16572
16239
|
${connectorType} connected successfully!`)
|
|
16573
16240
|
);
|
|
@@ -16579,7 +16246,7 @@ ${connectorType} connected successfully!`)
|
|
|
16579
16246
|
`Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
16580
16247
|
);
|
|
16581
16248
|
case "pending":
|
|
16582
|
-
process.stdout.write(
|
|
16249
|
+
process.stdout.write(chalk68.dim("."));
|
|
16583
16250
|
break;
|
|
16584
16251
|
}
|
|
16585
16252
|
}
|
|
@@ -16611,7 +16278,7 @@ var connectCommand = new Command77().name("connect").description("Connect a thir
|
|
|
16611
16278
|
|
|
16612
16279
|
// src/commands/connector/list.ts
|
|
16613
16280
|
import { Command as Command78 } from "commander";
|
|
16614
|
-
import
|
|
16281
|
+
import chalk69 from "chalk";
|
|
16615
16282
|
var listCommand11 = new Command78().name("list").alias("ls").description("List all connectors and their status").action(
|
|
16616
16283
|
withErrorHandler(async () => {
|
|
16617
16284
|
const result = await listConnectors();
|
|
@@ -16634,23 +16301,23 @@ var listCommand11 = new Command78().name("list").alias("ls").description("List a
|
|
|
16634
16301
|
statusText.padEnd(statusWidth),
|
|
16635
16302
|
"ACCOUNT"
|
|
16636
16303
|
].join(" ");
|
|
16637
|
-
console.log(
|
|
16304
|
+
console.log(chalk69.dim(header));
|
|
16638
16305
|
for (const type2 of allTypes) {
|
|
16639
16306
|
const connector = connectedMap.get(type2);
|
|
16640
|
-
const status = connector ?
|
|
16641
|
-
const account = connector?.externalUsername ? `@${connector.externalUsername}` :
|
|
16307
|
+
const status = connector ? chalk69.green("\u2713".padEnd(statusWidth)) : chalk69.dim("-".padEnd(statusWidth));
|
|
16308
|
+
const account = connector?.externalUsername ? `@${connector.externalUsername}` : chalk69.dim("-");
|
|
16642
16309
|
const row = [type2.padEnd(typeWidth), status, account].join(" ");
|
|
16643
16310
|
console.log(row);
|
|
16644
16311
|
}
|
|
16645
16312
|
console.log();
|
|
16646
|
-
console.log(
|
|
16647
|
-
console.log(
|
|
16313
|
+
console.log(chalk69.dim("To connect a service:"));
|
|
16314
|
+
console.log(chalk69.dim(" vm0 connector connect <type>"));
|
|
16648
16315
|
})
|
|
16649
16316
|
);
|
|
16650
16317
|
|
|
16651
16318
|
// src/commands/connector/status.ts
|
|
16652
16319
|
import { Command as Command79 } from "commander";
|
|
16653
|
-
import
|
|
16320
|
+
import chalk70 from "chalk";
|
|
16654
16321
|
var LABEL_WIDTH = 16;
|
|
16655
16322
|
var statusCommand8 = new Command79().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").action(
|
|
16656
16323
|
withErrorHandler(async (type2) => {
|
|
@@ -16662,11 +16329,11 @@ var statusCommand8 = new Command79().name("status").description("Show detailed s
|
|
|
16662
16329
|
});
|
|
16663
16330
|
}
|
|
16664
16331
|
const connector = await getConnector(parseResult.data);
|
|
16665
|
-
console.log(`Connector: ${
|
|
16332
|
+
console.log(`Connector: ${chalk70.cyan(type2)}`);
|
|
16666
16333
|
console.log();
|
|
16667
16334
|
if (connector) {
|
|
16668
16335
|
console.log(
|
|
16669
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
16336
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk70.green("connected")}`
|
|
16670
16337
|
);
|
|
16671
16338
|
console.log(
|
|
16672
16339
|
`${"Account:".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`
|
|
@@ -16688,22 +16355,22 @@ var statusCommand8 = new Command79().name("status").description("Show detailed s
|
|
|
16688
16355
|
);
|
|
16689
16356
|
}
|
|
16690
16357
|
console.log();
|
|
16691
|
-
console.log(
|
|
16692
|
-
console.log(
|
|
16358
|
+
console.log(chalk70.dim("To disconnect:"));
|
|
16359
|
+
console.log(chalk70.dim(` vm0 connector disconnect ${type2}`));
|
|
16693
16360
|
} else {
|
|
16694
16361
|
console.log(
|
|
16695
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
16362
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk70.dim("not connected")}`
|
|
16696
16363
|
);
|
|
16697
16364
|
console.log();
|
|
16698
|
-
console.log(
|
|
16699
|
-
console.log(
|
|
16365
|
+
console.log(chalk70.dim("To connect:"));
|
|
16366
|
+
console.log(chalk70.dim(` vm0 connector connect ${type2}`));
|
|
16700
16367
|
}
|
|
16701
16368
|
})
|
|
16702
16369
|
);
|
|
16703
16370
|
|
|
16704
16371
|
// src/commands/connector/disconnect.ts
|
|
16705
16372
|
import { Command as Command80 } from "commander";
|
|
16706
|
-
import
|
|
16373
|
+
import chalk71 from "chalk";
|
|
16707
16374
|
var disconnectCommand = new Command80().name("disconnect").description("Disconnect a third-party service").argument("<type>", "Connector type to disconnect (e.g., github)").action(
|
|
16708
16375
|
withErrorHandler(async (type2) => {
|
|
16709
16376
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
@@ -16715,7 +16382,7 @@ var disconnectCommand = new Command80().name("disconnect").description("Disconne
|
|
|
16715
16382
|
}
|
|
16716
16383
|
const connectorType = parseResult.data;
|
|
16717
16384
|
await deleteConnector(connectorType);
|
|
16718
|
-
console.log(
|
|
16385
|
+
console.log(chalk71.green(`\u2713 Disconnected ${type2}`));
|
|
16719
16386
|
})
|
|
16720
16387
|
);
|
|
16721
16388
|
|
|
@@ -16724,24 +16391,24 @@ var connectorCommand = new Command81().name("connector").description("Manage thi
|
|
|
16724
16391
|
|
|
16725
16392
|
// src/commands/onboard/index.ts
|
|
16726
16393
|
import { Command as Command82 } from "commander";
|
|
16727
|
-
import
|
|
16394
|
+
import chalk75 from "chalk";
|
|
16728
16395
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
16729
16396
|
import { existsSync as existsSync12 } from "fs";
|
|
16730
16397
|
|
|
16731
16398
|
// src/lib/ui/welcome-box.ts
|
|
16732
|
-
import
|
|
16399
|
+
import chalk72 from "chalk";
|
|
16733
16400
|
var gradientColors = [
|
|
16734
|
-
|
|
16401
|
+
chalk72.hex("#FFAB5E"),
|
|
16735
16402
|
// Line 1 - lightest
|
|
16736
|
-
|
|
16403
|
+
chalk72.hex("#FF9642"),
|
|
16737
16404
|
// Line 2
|
|
16738
|
-
|
|
16405
|
+
chalk72.hex("#FF8228"),
|
|
16739
16406
|
// Line 3
|
|
16740
|
-
|
|
16407
|
+
chalk72.hex("#FF6D0A"),
|
|
16741
16408
|
// Line 4
|
|
16742
|
-
|
|
16409
|
+
chalk72.hex("#E85D00"),
|
|
16743
16410
|
// Line 5
|
|
16744
|
-
|
|
16411
|
+
chalk72.hex("#CC4E00")
|
|
16745
16412
|
// Line 6 - darkest
|
|
16746
16413
|
];
|
|
16747
16414
|
var vm0LogoLines = [
|
|
@@ -16763,15 +16430,15 @@ function renderVm0Banner() {
|
|
|
16763
16430
|
function renderOnboardWelcome() {
|
|
16764
16431
|
renderVm0Banner();
|
|
16765
16432
|
console.log(` Build agentic workflows using natural language.`);
|
|
16766
|
-
console.log(` ${
|
|
16433
|
+
console.log(` ${chalk72.dim("Currently in beta, enjoy it free")}`);
|
|
16767
16434
|
console.log(
|
|
16768
|
-
` ${
|
|
16435
|
+
` ${chalk72.dim("Star us on GitHub: https://github.com/vm0-ai/vm0")}`
|
|
16769
16436
|
);
|
|
16770
16437
|
console.log();
|
|
16771
16438
|
}
|
|
16772
16439
|
|
|
16773
16440
|
// src/lib/ui/step-runner.ts
|
|
16774
|
-
import
|
|
16441
|
+
import chalk73 from "chalk";
|
|
16775
16442
|
function createStepRunner(options = true) {
|
|
16776
16443
|
const opts = typeof options === "boolean" ? { interactive: options } : options;
|
|
16777
16444
|
const interactive = opts.interactive ?? true;
|
|
@@ -16786,25 +16453,25 @@ function createStepRunner(options = true) {
|
|
|
16786
16453
|
}
|
|
16787
16454
|
for (const [i, step] of completedSteps.entries()) {
|
|
16788
16455
|
if (step.failed) {
|
|
16789
|
-
console.log(
|
|
16456
|
+
console.log(chalk73.red(`\u2717 ${step.label}`));
|
|
16790
16457
|
} else {
|
|
16791
|
-
console.log(
|
|
16458
|
+
console.log(chalk73.green(`\u25CF ${step.label}`));
|
|
16792
16459
|
}
|
|
16793
16460
|
const isLastStep = i === completedSteps.length - 1;
|
|
16794
16461
|
if (!isLastStep || !isFinal) {
|
|
16795
|
-
console.log(
|
|
16462
|
+
console.log(chalk73.dim("\u2502"));
|
|
16796
16463
|
}
|
|
16797
16464
|
}
|
|
16798
16465
|
}
|
|
16799
16466
|
async function executeStep(label, fn, isFinal) {
|
|
16800
16467
|
let stepFailed = false;
|
|
16801
|
-
console.log(
|
|
16468
|
+
console.log(chalk73.yellow(`\u25CB ${label}`));
|
|
16802
16469
|
const ctx = {
|
|
16803
16470
|
connector() {
|
|
16804
|
-
console.log(
|
|
16471
|
+
console.log(chalk73.dim("\u2502"));
|
|
16805
16472
|
},
|
|
16806
16473
|
detail(message) {
|
|
16807
|
-
console.log(`${
|
|
16474
|
+
console.log(`${chalk73.dim("\u2502")} ${message}`);
|
|
16808
16475
|
},
|
|
16809
16476
|
async prompt(promptFn) {
|
|
16810
16477
|
return await promptFn();
|
|
@@ -16821,12 +16488,12 @@ function createStepRunner(options = true) {
|
|
|
16821
16488
|
redrawCompletedSteps(isFinal);
|
|
16822
16489
|
} else {
|
|
16823
16490
|
if (stepFailed) {
|
|
16824
|
-
console.log(
|
|
16491
|
+
console.log(chalk73.red(`\u2717 ${label}`));
|
|
16825
16492
|
} else {
|
|
16826
|
-
console.log(
|
|
16493
|
+
console.log(chalk73.green(`\u25CF ${label}`));
|
|
16827
16494
|
}
|
|
16828
16495
|
if (!isFinal) {
|
|
16829
|
-
console.log(
|
|
16496
|
+
console.log(chalk73.dim("\u2502"));
|
|
16830
16497
|
}
|
|
16831
16498
|
}
|
|
16832
16499
|
}
|
|
@@ -16986,7 +16653,7 @@ async function setupModelProvider(type2, secret, options) {
|
|
|
16986
16653
|
|
|
16987
16654
|
// src/lib/domain/onboard/claude-setup.ts
|
|
16988
16655
|
import { spawn as spawn3 } from "child_process";
|
|
16989
|
-
import
|
|
16656
|
+
import chalk74 from "chalk";
|
|
16990
16657
|
var MARKETPLACE_NAME = "vm0-skills";
|
|
16991
16658
|
var MARKETPLACE_REPO = "vm0-ai/vm0-skills";
|
|
16992
16659
|
var PLUGIN_ID = "vm0@vm0-skills";
|
|
@@ -17023,12 +16690,12 @@ async function runClaudeCommand(args, cwd) {
|
|
|
17023
16690
|
}
|
|
17024
16691
|
function handlePluginError(error, context) {
|
|
17025
16692
|
const displayContext = context ?? "Claude plugin";
|
|
17026
|
-
console.error(
|
|
16693
|
+
console.error(chalk74.red(`\u2717 Failed to install ${displayContext}`));
|
|
17027
16694
|
if (error instanceof Error) {
|
|
17028
|
-
console.error(
|
|
16695
|
+
console.error(chalk74.red(`\u2717 ${error.message}`));
|
|
17029
16696
|
}
|
|
17030
16697
|
console.error(
|
|
17031
|
-
|
|
16698
|
+
chalk74.dim("Please ensure Claude CLI is installed and accessible.")
|
|
17032
16699
|
);
|
|
17033
16700
|
process.exit(1);
|
|
17034
16701
|
}
|
|
@@ -17071,7 +16738,7 @@ async function updateMarketplace() {
|
|
|
17071
16738
|
]);
|
|
17072
16739
|
if (!result.success) {
|
|
17073
16740
|
console.warn(
|
|
17074
|
-
|
|
16741
|
+
chalk74.yellow(
|
|
17075
16742
|
`Warning: Could not update marketplace: ${result.error ?? "unknown error"}`
|
|
17076
16743
|
)
|
|
17077
16744
|
);
|
|
@@ -17117,9 +16784,9 @@ async function handleAuthentication(ctx) {
|
|
|
17117
16784
|
onInitiating: () => {
|
|
17118
16785
|
},
|
|
17119
16786
|
onDeviceCodeReady: (url, code, expiresIn) => {
|
|
17120
|
-
step.detail(`Copy code: ${
|
|
17121
|
-
step.detail(`Open: ${
|
|
17122
|
-
step.detail(
|
|
16787
|
+
step.detail(`Copy code: ${chalk75.cyan.bold(code)}`);
|
|
16788
|
+
step.detail(`Open: ${chalk75.cyan(url)}`);
|
|
16789
|
+
step.detail(chalk75.dim(`Expires in ${expiresIn} minutes`));
|
|
17123
16790
|
},
|
|
17124
16791
|
onPolling: () => {
|
|
17125
16792
|
},
|
|
@@ -17159,14 +16826,14 @@ async function handleModelProvider(ctx) {
|
|
|
17159
16826
|
const selectedChoice = choices.find((c24) => c24.type === providerType);
|
|
17160
16827
|
if (selectedChoice?.helpText) {
|
|
17161
16828
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
17162
|
-
step.detail(
|
|
16829
|
+
step.detail(chalk75.dim(line));
|
|
17163
16830
|
}
|
|
17164
16831
|
}
|
|
17165
16832
|
const secret = await step.prompt(
|
|
17166
16833
|
() => promptPassword(`Enter your ${selectedChoice?.secretLabel ?? "secret"}:`)
|
|
17167
16834
|
);
|
|
17168
16835
|
if (!secret) {
|
|
17169
|
-
console.log(
|
|
16836
|
+
console.log(chalk75.dim("Cancelled"));
|
|
17170
16837
|
process.exit(0);
|
|
17171
16838
|
}
|
|
17172
16839
|
let selectedModel;
|
|
@@ -17185,7 +16852,7 @@ async function handleModelProvider(ctx) {
|
|
|
17185
16852
|
() => promptSelect("Select model:", modelChoices)
|
|
17186
16853
|
);
|
|
17187
16854
|
if (modelSelection === void 0) {
|
|
17188
|
-
console.log(
|
|
16855
|
+
console.log(chalk75.dim("Cancelled"));
|
|
17189
16856
|
process.exit(0);
|
|
17190
16857
|
}
|
|
17191
16858
|
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
@@ -17195,7 +16862,7 @@ async function handleModelProvider(ctx) {
|
|
|
17195
16862
|
});
|
|
17196
16863
|
const modelNote = result.provider.selectedModel ? ` with model: ${result.provider.selectedModel}` : "";
|
|
17197
16864
|
step.detail(
|
|
17198
|
-
|
|
16865
|
+
chalk75.green(
|
|
17199
16866
|
`${providerType} ${result.created ? "created" : "updated"}${result.isDefault ? ` (default for ${result.framework})` : ""}${modelNote}`
|
|
17200
16867
|
)
|
|
17201
16868
|
);
|
|
@@ -17226,7 +16893,7 @@ async function handleAgentCreation(ctx) {
|
|
|
17226
16893
|
agentName = inputName;
|
|
17227
16894
|
if (existsSync12(agentName)) {
|
|
17228
16895
|
step.detail(
|
|
17229
|
-
|
|
16896
|
+
chalk75.yellow(`${agentName}/ already exists, choose another name`)
|
|
17230
16897
|
);
|
|
17231
16898
|
} else {
|
|
17232
16899
|
folderExists = false;
|
|
@@ -17247,7 +16914,7 @@ async function handleAgentCreation(ctx) {
|
|
|
17247
16914
|
}
|
|
17248
16915
|
}
|
|
17249
16916
|
await mkdir8(agentName, { recursive: true });
|
|
17250
|
-
step.detail(
|
|
16917
|
+
step.detail(chalk75.green(`Created ${agentName}/`));
|
|
17251
16918
|
});
|
|
17252
16919
|
return agentName;
|
|
17253
16920
|
}
|
|
@@ -17263,7 +16930,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17263
16930
|
shouldInstall = confirmed ?? true;
|
|
17264
16931
|
}
|
|
17265
16932
|
if (!shouldInstall) {
|
|
17266
|
-
step.detail(
|
|
16933
|
+
step.detail(chalk75.dim("Skipped"));
|
|
17267
16934
|
return;
|
|
17268
16935
|
}
|
|
17269
16936
|
const scope = "project";
|
|
@@ -17271,7 +16938,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17271
16938
|
const agentDir = `${process.cwd()}/${agentName}`;
|
|
17272
16939
|
const result = await installVm0Plugin(scope, agentDir);
|
|
17273
16940
|
step.detail(
|
|
17274
|
-
|
|
16941
|
+
chalk75.green(`Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
17275
16942
|
);
|
|
17276
16943
|
pluginInstalled = true;
|
|
17277
16944
|
} catch (error) {
|
|
@@ -17282,14 +16949,14 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17282
16949
|
}
|
|
17283
16950
|
function printNextSteps(agentName, pluginInstalled) {
|
|
17284
16951
|
console.log();
|
|
17285
|
-
console.log(
|
|
16952
|
+
console.log(chalk75.bold("Next step:"));
|
|
17286
16953
|
console.log();
|
|
17287
16954
|
if (pluginInstalled) {
|
|
17288
16955
|
console.log(
|
|
17289
|
-
` ${
|
|
16956
|
+
` ${chalk75.cyan(`cd ${agentName} && claude "/${PRIMARY_SKILL_NAME} let's build an agent"`)}`
|
|
17290
16957
|
);
|
|
17291
16958
|
} else {
|
|
17292
|
-
console.log(` ${
|
|
16959
|
+
console.log(` ${chalk75.cyan(`cd ${agentName} && vm0 init`)}`);
|
|
17293
16960
|
}
|
|
17294
16961
|
console.log();
|
|
17295
16962
|
}
|
|
@@ -17319,20 +16986,20 @@ var onboardCommand = new Command82().name("onboard").description("Guided setup f
|
|
|
17319
16986
|
|
|
17320
16987
|
// src/commands/setup-claude/index.ts
|
|
17321
16988
|
import { Command as Command83 } from "commander";
|
|
17322
|
-
import
|
|
16989
|
+
import chalk76 from "chalk";
|
|
17323
16990
|
var setupClaudeCommand = new Command83().name("setup-claude").description("Install VM0 Claude Plugin").option("--agent-dir <dir>", "Agent directory to run install in").option("--scope <scope>", "Installation scope (user or project)", "project").action(
|
|
17324
16991
|
withErrorHandler(async (options) => {
|
|
17325
|
-
console.log(
|
|
16992
|
+
console.log(chalk76.dim("Installing VM0 Claude Plugin..."));
|
|
17326
16993
|
const scope = options.scope === "user" ? "user" : "project";
|
|
17327
16994
|
const result = await installVm0Plugin(scope, options.agentDir);
|
|
17328
16995
|
console.log(
|
|
17329
|
-
|
|
16996
|
+
chalk76.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
17330
16997
|
);
|
|
17331
16998
|
console.log();
|
|
17332
16999
|
console.log("Next step:");
|
|
17333
17000
|
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
17334
17001
|
console.log(
|
|
17335
|
-
|
|
17002
|
+
chalk76.cyan(
|
|
17336
17003
|
` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
|
|
17337
17004
|
)
|
|
17338
17005
|
);
|
|
@@ -17341,35 +17008,35 @@ var setupClaudeCommand = new Command83().name("setup-claude").description("Insta
|
|
|
17341
17008
|
|
|
17342
17009
|
// src/commands/dashboard/index.ts
|
|
17343
17010
|
import { Command as Command84 } from "commander";
|
|
17344
|
-
import
|
|
17011
|
+
import chalk77 from "chalk";
|
|
17345
17012
|
var dashboardCommand = new Command84().name("dashboard").description("Quick reference for common query commands").action(() => {
|
|
17346
17013
|
console.log();
|
|
17347
|
-
console.log(
|
|
17014
|
+
console.log(chalk77.bold("VM0 Dashboard"));
|
|
17348
17015
|
console.log();
|
|
17349
|
-
console.log(
|
|
17350
|
-
console.log(
|
|
17016
|
+
console.log(chalk77.bold("Agents"));
|
|
17017
|
+
console.log(chalk77.dim(" List agents: ") + "vm0 agent list");
|
|
17351
17018
|
console.log();
|
|
17352
|
-
console.log(
|
|
17353
|
-
console.log(
|
|
17354
|
-
console.log(
|
|
17019
|
+
console.log(chalk77.bold("Runs"));
|
|
17020
|
+
console.log(chalk77.dim(" Recent runs: ") + "vm0 run list");
|
|
17021
|
+
console.log(chalk77.dim(" View run logs: ") + "vm0 logs <run-id>");
|
|
17355
17022
|
console.log();
|
|
17356
|
-
console.log(
|
|
17357
|
-
console.log(
|
|
17023
|
+
console.log(chalk77.bold("Schedules"));
|
|
17024
|
+
console.log(chalk77.dim(" List schedules: ") + "vm0 schedule list");
|
|
17358
17025
|
console.log();
|
|
17359
|
-
console.log(
|
|
17360
|
-
console.log(
|
|
17361
|
-
console.log(
|
|
17362
|
-
console.log(
|
|
17026
|
+
console.log(chalk77.bold("Account"));
|
|
17027
|
+
console.log(chalk77.dim(" Usage stats: ") + "vm0 usage");
|
|
17028
|
+
console.log(chalk77.dim(" List secrets: ") + "vm0 secret list");
|
|
17029
|
+
console.log(chalk77.dim(" List variables: ") + "vm0 variable list");
|
|
17363
17030
|
console.log();
|
|
17364
17031
|
console.log(
|
|
17365
|
-
|
|
17032
|
+
chalk77.dim("Not logged in? Run: ") + chalk77.cyan("vm0 auth login")
|
|
17366
17033
|
);
|
|
17367
17034
|
console.log();
|
|
17368
17035
|
});
|
|
17369
17036
|
|
|
17370
17037
|
// src/commands/preference/index.ts
|
|
17371
17038
|
import { Command as Command85 } from "commander";
|
|
17372
|
-
import
|
|
17039
|
+
import chalk78 from "chalk";
|
|
17373
17040
|
function detectTimezone2() {
|
|
17374
17041
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
17375
17042
|
}
|
|
@@ -17390,15 +17057,15 @@ function parseOnOff(flag, value) {
|
|
|
17390
17057
|
);
|
|
17391
17058
|
}
|
|
17392
17059
|
function displayPreferences(prefs) {
|
|
17393
|
-
console.log(
|
|
17060
|
+
console.log(chalk78.bold("Current preferences:"));
|
|
17394
17061
|
console.log(
|
|
17395
|
-
` Timezone: ${prefs.timezone ?
|
|
17062
|
+
` Timezone: ${prefs.timezone ? chalk78.cyan(prefs.timezone) : chalk78.dim("not set")}`
|
|
17396
17063
|
);
|
|
17397
17064
|
console.log(
|
|
17398
|
-
` Email notify: ${prefs.notifyEmail ?
|
|
17065
|
+
` Email notify: ${prefs.notifyEmail ? chalk78.green("on") : chalk78.dim("off")}`
|
|
17399
17066
|
);
|
|
17400
17067
|
console.log(
|
|
17401
|
-
` Slack notify: ${prefs.notifySlack ?
|
|
17068
|
+
` Slack notify: ${prefs.notifySlack ? chalk78.green("on") : chalk78.dim("off")}`
|
|
17402
17069
|
);
|
|
17403
17070
|
}
|
|
17404
17071
|
function buildUpdates(opts) {
|
|
@@ -17428,21 +17095,21 @@ function buildUpdates(opts) {
|
|
|
17428
17095
|
function printUpdateResult(updates, result) {
|
|
17429
17096
|
if (updates.timezone !== void 0) {
|
|
17430
17097
|
console.log(
|
|
17431
|
-
|
|
17432
|
-
`Timezone set to ${
|
|
17098
|
+
chalk78.green(
|
|
17099
|
+
`Timezone set to ${chalk78.cyan(result.timezone ?? updates.timezone)}`
|
|
17433
17100
|
)
|
|
17434
17101
|
);
|
|
17435
17102
|
}
|
|
17436
17103
|
if (updates.notifyEmail !== void 0) {
|
|
17437
17104
|
console.log(
|
|
17438
|
-
|
|
17105
|
+
chalk78.green(
|
|
17439
17106
|
`Email notifications ${result.notifyEmail ? "enabled" : "disabled"}`
|
|
17440
17107
|
)
|
|
17441
17108
|
);
|
|
17442
17109
|
}
|
|
17443
17110
|
if (updates.notifySlack !== void 0) {
|
|
17444
17111
|
console.log(
|
|
17445
|
-
|
|
17112
|
+
chalk78.green(
|
|
17446
17113
|
`Slack notifications ${result.notifySlack ? "enabled" : "disabled"}`
|
|
17447
17114
|
)
|
|
17448
17115
|
);
|
|
@@ -17451,7 +17118,7 @@ function printUpdateResult(updates, result) {
|
|
|
17451
17118
|
async function interactiveSetup(prefs) {
|
|
17452
17119
|
if (!prefs.timezone) {
|
|
17453
17120
|
const detectedTz = detectTimezone2();
|
|
17454
|
-
console.log(
|
|
17121
|
+
console.log(chalk78.dim(`
|
|
17455
17122
|
System timezone detected: ${detectedTz}`));
|
|
17456
17123
|
const tz = await promptText(
|
|
17457
17124
|
"Set timezone? (enter timezone or leave empty to skip)",
|
|
@@ -17462,7 +17129,7 @@ System timezone detected: ${detectedTz}`));
|
|
|
17462
17129
|
throw new Error(`Invalid timezone: ${tz.trim()}`);
|
|
17463
17130
|
}
|
|
17464
17131
|
await updateUserPreferences({ timezone: tz.trim() });
|
|
17465
|
-
console.log(
|
|
17132
|
+
console.log(chalk78.green(`Timezone set to ${chalk78.cyan(tz.trim())}`));
|
|
17466
17133
|
}
|
|
17467
17134
|
}
|
|
17468
17135
|
if (!prefs.notifyEmail) {
|
|
@@ -17472,7 +17139,7 @@ System timezone detected: ${detectedTz}`));
|
|
|
17472
17139
|
);
|
|
17473
17140
|
if (enable) {
|
|
17474
17141
|
await updateUserPreferences({ notifyEmail: true });
|
|
17475
|
-
console.log(
|
|
17142
|
+
console.log(chalk78.green("Email notifications enabled"));
|
|
17476
17143
|
}
|
|
17477
17144
|
}
|
|
17478
17145
|
}
|
|
@@ -17491,10 +17158,10 @@ var preferenceCommand = new Command85().name("preference").description("View or
|
|
|
17491
17158
|
} else if (!prefs.timezone) {
|
|
17492
17159
|
console.log();
|
|
17493
17160
|
console.log(
|
|
17494
|
-
`To set timezone: ${
|
|
17161
|
+
`To set timezone: ${chalk78.cyan("vm0 preference --timezone <timezone>")}`
|
|
17495
17162
|
);
|
|
17496
17163
|
console.log(
|
|
17497
|
-
|
|
17164
|
+
chalk78.dim("Example: vm0 preference --timezone America/New_York")
|
|
17498
17165
|
);
|
|
17499
17166
|
}
|
|
17500
17167
|
})
|
|
@@ -17502,7 +17169,7 @@ var preferenceCommand = new Command85().name("preference").description("View or
|
|
|
17502
17169
|
|
|
17503
17170
|
// src/commands/upgrade/index.ts
|
|
17504
17171
|
import { Command as Command86 } from "commander";
|
|
17505
|
-
import
|
|
17172
|
+
import chalk79 from "chalk";
|
|
17506
17173
|
var upgradeCommand = new Command86().name("upgrade").description("Upgrade vm0 CLI to the latest version").action(
|
|
17507
17174
|
withErrorHandler(async () => {
|
|
17508
17175
|
console.log("Checking for updates...");
|
|
@@ -17510,13 +17177,13 @@ var upgradeCommand = new Command86().name("upgrade").description("Upgrade vm0 CL
|
|
|
17510
17177
|
if (latestVersion === null) {
|
|
17511
17178
|
throw new Error("Could not check for updates. Please try again later.");
|
|
17512
17179
|
}
|
|
17513
|
-
if (latestVersion === "9.62.
|
|
17514
|
-
console.log(
|
|
17180
|
+
if (latestVersion === "9.62.1") {
|
|
17181
|
+
console.log(chalk79.green(`\u2713 Already up to date (${"9.62.1"})`));
|
|
17515
17182
|
return;
|
|
17516
17183
|
}
|
|
17517
17184
|
console.log(
|
|
17518
|
-
|
|
17519
|
-
`Current version: ${"9.62.
|
|
17185
|
+
chalk79.yellow(
|
|
17186
|
+
`Current version: ${"9.62.1"} -> Latest version: ${latestVersion}`
|
|
17520
17187
|
)
|
|
17521
17188
|
);
|
|
17522
17189
|
console.log();
|
|
@@ -17524,26 +17191,26 @@ var upgradeCommand = new Command86().name("upgrade").description("Upgrade vm0 CL
|
|
|
17524
17191
|
if (!isAutoUpgradeSupported(packageManager)) {
|
|
17525
17192
|
if (packageManager === "unknown") {
|
|
17526
17193
|
console.log(
|
|
17527
|
-
|
|
17194
|
+
chalk79.yellow(
|
|
17528
17195
|
"Could not detect your package manager for auto-upgrade."
|
|
17529
17196
|
)
|
|
17530
17197
|
);
|
|
17531
17198
|
} else {
|
|
17532
17199
|
console.log(
|
|
17533
|
-
|
|
17200
|
+
chalk79.yellow(
|
|
17534
17201
|
`Auto-upgrade is not supported for ${packageManager}.`
|
|
17535
17202
|
)
|
|
17536
17203
|
);
|
|
17537
17204
|
}
|
|
17538
|
-
console.log(
|
|
17539
|
-
console.log(
|
|
17205
|
+
console.log(chalk79.yellow("Please upgrade manually:"));
|
|
17206
|
+
console.log(chalk79.cyan(` ${getManualUpgradeCommand(packageManager)}`));
|
|
17540
17207
|
return;
|
|
17541
17208
|
}
|
|
17542
17209
|
console.log(`Upgrading via ${packageManager}...`);
|
|
17543
17210
|
const success = await performUpgrade(packageManager);
|
|
17544
17211
|
if (success) {
|
|
17545
17212
|
console.log(
|
|
17546
|
-
|
|
17213
|
+
chalk79.green(`\u2713 Upgraded from ${"9.62.1"} to ${latestVersion}`)
|
|
17547
17214
|
);
|
|
17548
17215
|
return;
|
|
17549
17216
|
}
|
|
@@ -17557,7 +17224,7 @@ var upgradeCommand = new Command86().name("upgrade").description("Upgrade vm0 CL
|
|
|
17557
17224
|
|
|
17558
17225
|
// src/index.ts
|
|
17559
17226
|
var program = new Command87();
|
|
17560
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.62.
|
|
17227
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.62.1");
|
|
17561
17228
|
program.addCommand(authCommand);
|
|
17562
17229
|
program.addCommand(infoCommand);
|
|
17563
17230
|
program.addCommand(composeCommand);
|