@vm0/cli 9.31.1 → 9.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +620 -508
- 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.
|
|
48
|
+
release: "9.33.0",
|
|
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.
|
|
67
|
+
version: "9.33.0",
|
|
68
68
|
command: process.argv.slice(2).join(" ")
|
|
69
69
|
});
|
|
70
70
|
Sentry.setContext("runtime", {
|
|
@@ -75,7 +75,7 @@ if (DSN) {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
// src/index.ts
|
|
78
|
-
import { Command as
|
|
78
|
+
import { Command as Command77 } from "commander";
|
|
79
79
|
|
|
80
80
|
// src/commands/auth/index.ts
|
|
81
81
|
import { Command as Command5 } from "commander";
|
|
@@ -605,7 +605,7 @@ async function waitForSilentUpgrade(timeout = TIMEOUT_MS) {
|
|
|
605
605
|
// src/commands/info/index.ts
|
|
606
606
|
var CONFIG_PATH = join2(homedir2(), ".vm0", "config.json");
|
|
607
607
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
608
|
-
console.log(chalk7.bold(`VM0 CLI v${"9.
|
|
608
|
+
console.log(chalk7.bold(`VM0 CLI v${"9.33.0"}`));
|
|
609
609
|
console.log();
|
|
610
610
|
const config = await loadConfig();
|
|
611
611
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -740,7 +740,7 @@ var runnerGroupSchema = z3.string().regex(
|
|
|
740
740
|
var jobSchema = z3.object({
|
|
741
741
|
runId: z3.string().uuid(),
|
|
742
742
|
prompt: z3.string(),
|
|
743
|
-
agentComposeVersionId: z3.string(),
|
|
743
|
+
agentComposeVersionId: z3.string().nullable(),
|
|
744
744
|
vars: z3.record(z3.string(), z3.string()).nullable(),
|
|
745
745
|
secretNames: z3.array(z3.string()).nullable(),
|
|
746
746
|
checkpointId: z3.string().uuid().nullable()
|
|
@@ -799,7 +799,7 @@ var storedExecutionContextSchema = z3.object({
|
|
|
799
799
|
var executionContextSchema = z3.object({
|
|
800
800
|
runId: z3.string().uuid(),
|
|
801
801
|
prompt: z3.string(),
|
|
802
|
-
agentComposeVersionId: z3.string(),
|
|
802
|
+
agentComposeVersionId: z3.string().nullable(),
|
|
803
803
|
vars: z3.record(z3.string(), z3.string()).nullable(),
|
|
804
804
|
secretNames: z3.array(z3.string()).nullable(),
|
|
805
805
|
checkpointId: z3.string().uuid().nullable(),
|
|
@@ -1013,6 +1013,27 @@ var composesByIdContract = c2.router({
|
|
|
1013
1013
|
404: apiErrorSchema
|
|
1014
1014
|
},
|
|
1015
1015
|
summary: "Get agent compose by ID"
|
|
1016
|
+
},
|
|
1017
|
+
/**
|
|
1018
|
+
* DELETE /api/agent/composes/:id
|
|
1019
|
+
* Delete agent compose and all associated resources (versions, schedules, permissions, etc.)
|
|
1020
|
+
* Returns 409 Conflict if agent has running or pending runs
|
|
1021
|
+
*/
|
|
1022
|
+
delete: {
|
|
1023
|
+
method: "DELETE",
|
|
1024
|
+
path: "/api/agent/composes/:id",
|
|
1025
|
+
headers: authHeadersSchema,
|
|
1026
|
+
pathParams: z4.object({
|
|
1027
|
+
id: z4.string().uuid("Compose ID is required")
|
|
1028
|
+
}),
|
|
1029
|
+
body: c2.noBody(),
|
|
1030
|
+
responses: {
|
|
1031
|
+
204: c2.noBody(),
|
|
1032
|
+
401: apiErrorSchema,
|
|
1033
|
+
404: apiErrorSchema,
|
|
1034
|
+
409: apiErrorSchema
|
|
1035
|
+
},
|
|
1036
|
+
summary: "Delete agent compose"
|
|
1016
1037
|
}
|
|
1017
1038
|
});
|
|
1018
1039
|
var composesVersionsContract = c2.router({
|
|
@@ -1097,6 +1118,8 @@ var unifiedRunRequestSchema = z5.object({
|
|
|
1097
1118
|
debugNoMockClaude: z5.boolean().optional(),
|
|
1098
1119
|
// Model provider for automatic credential injection
|
|
1099
1120
|
modelProvider: z5.string().optional(),
|
|
1121
|
+
// Environment validation flag - when true, validates secrets/vars before running
|
|
1122
|
+
checkEnv: z5.boolean().optional(),
|
|
1100
1123
|
// Required
|
|
1101
1124
|
prompt: z5.string().min(1, "Missing prompt")
|
|
1102
1125
|
});
|
|
@@ -1111,7 +1134,7 @@ var createRunResponseSchema = z5.object({
|
|
|
1111
1134
|
});
|
|
1112
1135
|
var getRunResponseSchema = z5.object({
|
|
1113
1136
|
runId: z5.string(),
|
|
1114
|
-
agentComposeVersionId: z5.string(),
|
|
1137
|
+
agentComposeVersionId: z5.string().nullable(),
|
|
1115
1138
|
status: runStatusSchema,
|
|
1116
1139
|
prompt: z5.string(),
|
|
1117
1140
|
vars: z5.record(z5.string(), z5.string()).optional(),
|
|
@@ -3555,9 +3578,38 @@ var CONNECTOR_TYPES = {
|
|
|
3555
3578
|
tokenUrl: "https://github.com/login/oauth/access_token",
|
|
3556
3579
|
scopes: ["repo"]
|
|
3557
3580
|
}
|
|
3581
|
+
},
|
|
3582
|
+
notion: {
|
|
3583
|
+
label: "Notion",
|
|
3584
|
+
helpText: "Connect your Notion workspace to access pages and databases",
|
|
3585
|
+
authMethods: {
|
|
3586
|
+
oauth: {
|
|
3587
|
+
label: "OAuth (Recommended)",
|
|
3588
|
+
helpText: "Sign in with Notion to grant access.",
|
|
3589
|
+
secrets: {
|
|
3590
|
+
NOTION_ACCESS_TOKEN: {
|
|
3591
|
+
label: "Access Token",
|
|
3592
|
+
required: true
|
|
3593
|
+
},
|
|
3594
|
+
NOTION_REFRESH_TOKEN: {
|
|
3595
|
+
label: "Refresh Token",
|
|
3596
|
+
required: true
|
|
3597
|
+
}
|
|
3598
|
+
}
|
|
3599
|
+
}
|
|
3600
|
+
},
|
|
3601
|
+
defaultAuthMethod: "oauth",
|
|
3602
|
+
environmentMapping: {
|
|
3603
|
+
NOTION_TOKEN: "$secrets.NOTION_ACCESS_TOKEN"
|
|
3604
|
+
},
|
|
3605
|
+
oauth: {
|
|
3606
|
+
authorizationUrl: "https://api.notion.com/v1/oauth/authorize",
|
|
3607
|
+
tokenUrl: "https://api.notion.com/v1/oauth/token",
|
|
3608
|
+
scopes: []
|
|
3609
|
+
}
|
|
3558
3610
|
}
|
|
3559
3611
|
};
|
|
3560
|
-
var connectorTypeSchema = z23.enum(["github"]);
|
|
3612
|
+
var connectorTypeSchema = z23.enum(["github", "notion"]);
|
|
3561
3613
|
function getConnectorEnvironmentMapping(type2) {
|
|
3562
3614
|
return CONNECTOR_TYPES[type2].environmentMapping;
|
|
3563
3615
|
}
|
|
@@ -4489,6 +4541,17 @@ async function createOrUpdateCompose(body) {
|
|
|
4489
4541
|
}
|
|
4490
4542
|
handleError(result, "Failed to create compose");
|
|
4491
4543
|
}
|
|
4544
|
+
async function deleteCompose(id) {
|
|
4545
|
+
const config = await getClientConfig();
|
|
4546
|
+
const client = initClient(composesByIdContract, config);
|
|
4547
|
+
const result = await client.delete({
|
|
4548
|
+
params: { id }
|
|
4549
|
+
});
|
|
4550
|
+
if (result.status === 204) {
|
|
4551
|
+
return;
|
|
4552
|
+
}
|
|
4553
|
+
handleError(result, "Failed to delete agent");
|
|
4554
|
+
}
|
|
4492
4555
|
|
|
4493
4556
|
// src/lib/api/domains/runs.ts
|
|
4494
4557
|
import { initClient as initClient2 } from "@ts-rest/core";
|
|
@@ -6202,7 +6265,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
6202
6265
|
options.autoUpdate = false;
|
|
6203
6266
|
}
|
|
6204
6267
|
if (options.autoUpdate !== false) {
|
|
6205
|
-
await startSilentUpgrade("9.
|
|
6268
|
+
await startSilentUpgrade("9.33.0");
|
|
6206
6269
|
}
|
|
6207
6270
|
try {
|
|
6208
6271
|
let result;
|
|
@@ -8395,11 +8458,11 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
8395
8458
|
).option("--verbose", "Show full tool inputs and outputs").option(
|
|
8396
8459
|
"--experimental-shared-agent",
|
|
8397
8460
|
"Allow running agents shared by other users (required when running scope/agent format)"
|
|
8398
|
-
).addOption(new Option2("--debug-no-mock-claude").hideHelp()).addOption(new Option2("--no-auto-update").hideHelp()).action(
|
|
8461
|
+
).option("--check-env", "Validate secrets and vars before running").addOption(new Option2("--debug-no-mock-claude").hideHelp()).addOption(new Option2("--no-auto-update").hideHelp()).action(
|
|
8399
8462
|
async (identifier, prompt, options) => {
|
|
8400
8463
|
try {
|
|
8401
8464
|
if (options.autoUpdate !== false) {
|
|
8402
|
-
await startSilentUpgrade("9.
|
|
8465
|
+
await startSilentUpgrade("9.33.0");
|
|
8403
8466
|
}
|
|
8404
8467
|
const { scope, name, version } = parseIdentifier(identifier);
|
|
8405
8468
|
if (scope && !options.experimentalSharedAgent) {
|
|
@@ -8476,6 +8539,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
8476
8539
|
volumeVersions: Object.keys(options.volumeVersion).length > 0 ? options.volumeVersion : void 0,
|
|
8477
8540
|
conversationId: options.conversation,
|
|
8478
8541
|
modelProvider: options.modelProvider,
|
|
8542
|
+
checkEnv: options.checkEnv || void 0,
|
|
8479
8543
|
debugNoMockClaude: options.debugNoMockClaude || void 0
|
|
8480
8544
|
});
|
|
8481
8545
|
if (response.status === "failed") {
|
|
@@ -8532,7 +8596,7 @@ var resumeCommand = new Command9().name("resume").description("Resume an agent r
|
|
|
8532
8596
|
).option(
|
|
8533
8597
|
"--model-provider <type>",
|
|
8534
8598
|
"Override model provider (e.g., anthropic-api-key)"
|
|
8535
|
-
).option("--verbose", "Show full tool inputs and outputs").addOption(new Option3("--debug-no-mock-claude").hideHelp()).action(
|
|
8599
|
+
).option("--verbose", "Show full tool inputs and outputs").option("--check-env", "Validate secrets and vars before running").addOption(new Option3("--debug-no-mock-claude").hideHelp()).action(
|
|
8536
8600
|
async (checkpointId, prompt, options, command) => {
|
|
8537
8601
|
const allOpts = command.optsWithGlobals();
|
|
8538
8602
|
const vars = { ...allOpts.vars, ...options.vars };
|
|
@@ -8556,6 +8620,7 @@ var resumeCommand = new Command9().name("resume").description("Resume an agent r
|
|
|
8556
8620
|
secrets: loadedSecrets,
|
|
8557
8621
|
volumeVersions: Object.keys(allOpts.volumeVersion).length > 0 ? allOpts.volumeVersion : void 0,
|
|
8558
8622
|
modelProvider: options.modelProvider || allOpts.modelProvider,
|
|
8623
|
+
checkEnv: options.checkEnv || allOpts.checkEnv || void 0,
|
|
8559
8624
|
debugNoMockClaude: options.debugNoMockClaude || allOpts.debugNoMockClaude || void 0
|
|
8560
8625
|
});
|
|
8561
8626
|
if (response.status === "failed") {
|
|
@@ -8611,7 +8676,7 @@ var continueCommand = new Command10().name("continue").description(
|
|
|
8611
8676
|
).option(
|
|
8612
8677
|
"--model-provider <type>",
|
|
8613
8678
|
"Override model provider (e.g., anthropic-api-key)"
|
|
8614
|
-
).option("--verbose", "Show full tool inputs and outputs").addOption(new Option4("--debug-no-mock-claude").hideHelp()).action(
|
|
8679
|
+
).option("--verbose", "Show full tool inputs and outputs").option("--check-env", "Validate secrets and vars before running").addOption(new Option4("--debug-no-mock-claude").hideHelp()).action(
|
|
8615
8680
|
async (agentSessionId, prompt, options, command) => {
|
|
8616
8681
|
const allOpts = command.optsWithGlobals();
|
|
8617
8682
|
const vars = { ...allOpts.vars, ...options.vars };
|
|
@@ -8634,6 +8699,7 @@ var continueCommand = new Command10().name("continue").description(
|
|
|
8634
8699
|
vars: Object.keys(vars).length > 0 ? vars : void 0,
|
|
8635
8700
|
secrets: loadedSecrets,
|
|
8636
8701
|
modelProvider: options.modelProvider || allOpts.modelProvider,
|
|
8702
|
+
checkEnv: options.checkEnv || allOpts.checkEnv || void 0,
|
|
8637
8703
|
debugNoMockClaude: options.debugNoMockClaude || allOpts.debugNoMockClaude || void 0
|
|
8638
8704
|
});
|
|
8639
8705
|
if (response.status === "failed") {
|
|
@@ -9972,7 +10038,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
|
|
|
9972
10038
|
).option("-y, --yes", "Skip confirmation prompts").option("-v, --verbose", "Show full tool inputs and outputs").addOption(new Option5("--debug-no-mock-claude").hideHelp()).addOption(new Option5("--no-auto-update").hideHelp()).action(
|
|
9973
10039
|
async (prompt, options) => {
|
|
9974
10040
|
if (options.autoUpdate !== false) {
|
|
9975
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
10041
|
+
const shouldExit = await checkAndUpgrade("9.33.0", prompt);
|
|
9976
10042
|
if (shouldExit) {
|
|
9977
10043
|
process.exit(0);
|
|
9978
10044
|
}
|
|
@@ -10538,7 +10604,7 @@ var setCommand = new Command33().name("set").description("Set your scope slug").
|
|
|
10538
10604
|
var scopeCommand = new Command34().name("scope").description("Manage your scope (namespace for agents)").addCommand(statusCommand4).addCommand(setCommand);
|
|
10539
10605
|
|
|
10540
10606
|
// src/commands/agent/index.ts
|
|
10541
|
-
import { Command as
|
|
10607
|
+
import { Command as Command44 } from "commander";
|
|
10542
10608
|
|
|
10543
10609
|
// src/commands/agent/clone.ts
|
|
10544
10610
|
import { Command as Command35 } from "commander";
|
|
@@ -10660,10 +10726,56 @@ var cloneCommand3 = new Command35().name("clone").description("Clone agent compo
|
|
|
10660
10726
|
}
|
|
10661
10727
|
});
|
|
10662
10728
|
|
|
10663
|
-
// src/commands/agent/
|
|
10729
|
+
// src/commands/agent/delete.ts
|
|
10664
10730
|
import { Command as Command36 } from "commander";
|
|
10665
10731
|
import chalk41 from "chalk";
|
|
10666
|
-
var
|
|
10732
|
+
var deleteCommand = new Command36().name("delete").alias("rm").description("Delete an agent").argument("<name>", "Agent name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
10733
|
+
try {
|
|
10734
|
+
const compose = await getComposeByName(name);
|
|
10735
|
+
if (!compose) {
|
|
10736
|
+
console.error(chalk41.red(`\u2717 Agent '${name}' not found`));
|
|
10737
|
+
console.error(chalk41.dim(" Run: vm0 agent list"));
|
|
10738
|
+
process.exit(1);
|
|
10739
|
+
}
|
|
10740
|
+
if (!options.yes) {
|
|
10741
|
+
if (!isInteractive()) {
|
|
10742
|
+
console.error(
|
|
10743
|
+
chalk41.red("\u2717 --yes flag is required in non-interactive mode")
|
|
10744
|
+
);
|
|
10745
|
+
process.exit(1);
|
|
10746
|
+
}
|
|
10747
|
+
const confirmed = await promptConfirm(`Delete agent '${name}'?`, false);
|
|
10748
|
+
if (!confirmed) {
|
|
10749
|
+
console.log(chalk41.dim("Cancelled"));
|
|
10750
|
+
return;
|
|
10751
|
+
}
|
|
10752
|
+
}
|
|
10753
|
+
await deleteCompose(compose.id);
|
|
10754
|
+
console.log(chalk41.green(`\u2713 Agent '${name}' deleted`));
|
|
10755
|
+
} catch (error) {
|
|
10756
|
+
if (error instanceof Error) {
|
|
10757
|
+
if (error.message.includes("Not authenticated")) {
|
|
10758
|
+
console.error(chalk41.red("\u2717 Not authenticated"));
|
|
10759
|
+
console.error(chalk41.dim(" Run: vm0 auth login"));
|
|
10760
|
+
} else if (error.message.includes("currently running")) {
|
|
10761
|
+
console.error(
|
|
10762
|
+
chalk41.red("\u2717 Cannot delete agent: agent is currently running")
|
|
10763
|
+
);
|
|
10764
|
+
console.error(chalk41.dim(" Run: vm0 run list"));
|
|
10765
|
+
} else {
|
|
10766
|
+
console.error(chalk41.red(`\u2717 ${error.message}`));
|
|
10767
|
+
}
|
|
10768
|
+
} else {
|
|
10769
|
+
console.error(chalk41.red("\u2717 An unexpected error occurred"));
|
|
10770
|
+
}
|
|
10771
|
+
process.exit(1);
|
|
10772
|
+
}
|
|
10773
|
+
});
|
|
10774
|
+
|
|
10775
|
+
// src/commands/agent/list.ts
|
|
10776
|
+
import { Command as Command37 } from "commander";
|
|
10777
|
+
import chalk42 from "chalk";
|
|
10778
|
+
var listCommand4 = new Command37().name("list").alias("ls").description("List all agent composes").action(
|
|
10667
10779
|
withErrorHandler(async () => {
|
|
10668
10780
|
const response = await httpGet("/api/agent/composes/list");
|
|
10669
10781
|
if (!response.ok) {
|
|
@@ -10672,9 +10784,9 @@ var listCommand4 = new Command36().name("list").alias("ls").description("List al
|
|
|
10672
10784
|
}
|
|
10673
10785
|
const data = await response.json();
|
|
10674
10786
|
if (data.composes.length === 0) {
|
|
10675
|
-
console.log(
|
|
10787
|
+
console.log(chalk42.dim("No agent composes found"));
|
|
10676
10788
|
console.log(
|
|
10677
|
-
|
|
10789
|
+
chalk42.dim(" Create one with: vm0 compose <agent-compose.yaml>")
|
|
10678
10790
|
);
|
|
10679
10791
|
return;
|
|
10680
10792
|
}
|
|
@@ -10682,9 +10794,9 @@ var listCommand4 = new Command36().name("list").alias("ls").description("List al
|
|
|
10682
10794
|
const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
|
|
10683
10795
|
" "
|
|
10684
10796
|
);
|
|
10685
|
-
console.log(
|
|
10797
|
+
console.log(chalk42.dim(header));
|
|
10686
10798
|
for (const compose of data.composes) {
|
|
10687
|
-
const versionShort = compose.headVersionId ? compose.headVersionId.slice(0, 8) :
|
|
10799
|
+
const versionShort = compose.headVersionId ? compose.headVersionId.slice(0, 8) : chalk42.dim("-");
|
|
10688
10800
|
const row = [
|
|
10689
10801
|
compose.name.padEnd(nameWidth),
|
|
10690
10802
|
versionShort,
|
|
@@ -10696,8 +10808,8 @@ var listCommand4 = new Command36().name("list").alias("ls").description("List al
|
|
|
10696
10808
|
);
|
|
10697
10809
|
|
|
10698
10810
|
// src/commands/agent/status.ts
|
|
10699
|
-
import { Command as
|
|
10700
|
-
import
|
|
10811
|
+
import { Command as Command38 } from "commander";
|
|
10812
|
+
import chalk43 from "chalk";
|
|
10701
10813
|
|
|
10702
10814
|
// src/lib/domain/source-derivation.ts
|
|
10703
10815
|
import * as fs9 from "fs/promises";
|
|
@@ -10821,27 +10933,27 @@ function formatVariableSources(sources) {
|
|
|
10821
10933
|
if (sources.secrets.length > 0) {
|
|
10822
10934
|
console.log(` Secrets:`);
|
|
10823
10935
|
for (const secret of sources.secrets) {
|
|
10824
|
-
const sourceInfo =
|
|
10936
|
+
const sourceInfo = chalk43.dim(`(${secret.source})`);
|
|
10825
10937
|
console.log(` - ${secret.name.padEnd(20)} ${sourceInfo}`);
|
|
10826
10938
|
}
|
|
10827
10939
|
}
|
|
10828
10940
|
if (sources.vars.length > 0) {
|
|
10829
10941
|
console.log(` Vars:`);
|
|
10830
10942
|
for (const v of sources.vars) {
|
|
10831
|
-
const sourceInfo =
|
|
10943
|
+
const sourceInfo = chalk43.dim(`(${v.source})`);
|
|
10832
10944
|
console.log(` - ${v.name.padEnd(20)} ${sourceInfo}`);
|
|
10833
10945
|
}
|
|
10834
10946
|
}
|
|
10835
10947
|
if (sources.credentials.length > 0) {
|
|
10836
10948
|
console.log(` Credentials:`);
|
|
10837
10949
|
for (const cred of sources.credentials) {
|
|
10838
|
-
const sourceInfo =
|
|
10950
|
+
const sourceInfo = chalk43.dim(`(${cred.source})`);
|
|
10839
10951
|
console.log(` - ${cred.name.padEnd(20)} ${sourceInfo}`);
|
|
10840
10952
|
}
|
|
10841
10953
|
}
|
|
10842
10954
|
}
|
|
10843
10955
|
function formatAgentDetails(agentName, agent, agentSources, volumeConfigs) {
|
|
10844
|
-
console.log(` ${
|
|
10956
|
+
console.log(` ${chalk43.cyan(agentName)}:`);
|
|
10845
10957
|
console.log(` Framework: ${agent.framework}`);
|
|
10846
10958
|
if (agent.image) {
|
|
10847
10959
|
console.log(` Image: ${agent.image}`);
|
|
@@ -10860,16 +10972,16 @@ function formatAgentDetails(agentName, agent, agentSources, volumeConfigs) {
|
|
|
10860
10972
|
}
|
|
10861
10973
|
}
|
|
10862
10974
|
function formatComposeOutput(name, versionId, content, variableSources) {
|
|
10863
|
-
console.log(
|
|
10864
|
-
console.log(
|
|
10975
|
+
console.log(chalk43.bold("Name:") + ` ${name}`);
|
|
10976
|
+
console.log(chalk43.bold("Version:") + ` ${versionId}`);
|
|
10865
10977
|
console.log();
|
|
10866
|
-
console.log(
|
|
10978
|
+
console.log(chalk43.bold("Agents:"));
|
|
10867
10979
|
for (const [agentName, agent] of Object.entries(content.agents)) {
|
|
10868
10980
|
const agentSources = variableSources?.get(agentName);
|
|
10869
10981
|
formatAgentDetails(agentName, agent, agentSources, content.volumes);
|
|
10870
10982
|
}
|
|
10871
10983
|
}
|
|
10872
|
-
var statusCommand5 = new
|
|
10984
|
+
var statusCommand5 = new Command38().name("status").description("Show status of agent compose").argument(
|
|
10873
10985
|
"<name[:version]>",
|
|
10874
10986
|
"Agent name with optional version (e.g., my-agent:latest or my-agent:a1b2c3d4)"
|
|
10875
10987
|
).option("--no-sources", "Skip fetching skills to determine variable sources").action(async (argument, options) => {
|
|
@@ -10886,8 +10998,8 @@ var statusCommand5 = new Command37().name("status").description("Show status of
|
|
|
10886
10998
|
}
|
|
10887
10999
|
const compose = await getComposeByName(name);
|
|
10888
11000
|
if (!compose) {
|
|
10889
|
-
console.error(
|
|
10890
|
-
console.error(
|
|
11001
|
+
console.error(chalk43.red(`\u2717 Agent compose not found: ${name}`));
|
|
11002
|
+
console.error(chalk43.dim(" Run: vm0 agent list"));
|
|
10891
11003
|
process.exit(1);
|
|
10892
11004
|
}
|
|
10893
11005
|
let resolvedVersionId = compose.headVersionId;
|
|
@@ -10898,9 +11010,9 @@ var statusCommand5 = new Command37().name("status").description("Show status of
|
|
|
10898
11010
|
resolvedVersionId = versionInfo.versionId;
|
|
10899
11011
|
} catch (error) {
|
|
10900
11012
|
if (error instanceof Error && error.message.includes("not found")) {
|
|
10901
|
-
console.error(
|
|
11013
|
+
console.error(chalk43.red(`\u2717 Version not found: ${version}`));
|
|
10902
11014
|
console.error(
|
|
10903
|
-
|
|
11015
|
+
chalk43.dim(
|
|
10904
11016
|
` HEAD version: ${compose.headVersionId?.slice(0, 8)}`
|
|
10905
11017
|
)
|
|
10906
11018
|
);
|
|
@@ -10913,7 +11025,7 @@ var statusCommand5 = new Command37().name("status").description("Show status of
|
|
|
10913
11025
|
}
|
|
10914
11026
|
}
|
|
10915
11027
|
if (!resolvedVersionId || !compose.content) {
|
|
10916
|
-
console.error(
|
|
11028
|
+
console.error(chalk43.red(`\u2717 No version found for: ${name}`));
|
|
10917
11029
|
process.exit(1);
|
|
10918
11030
|
}
|
|
10919
11031
|
const content = compose.content;
|
|
@@ -10924,7 +11036,7 @@ var statusCommand5 = new Command37().name("status").description("Show status of
|
|
|
10924
11036
|
});
|
|
10925
11037
|
} catch {
|
|
10926
11038
|
console.error(
|
|
10927
|
-
|
|
11039
|
+
chalk43.yellow(
|
|
10928
11040
|
"\u26A0 Warning: Failed to fetch skill sources, showing basic info"
|
|
10929
11041
|
)
|
|
10930
11042
|
);
|
|
@@ -10936,12 +11048,12 @@ var statusCommand5 = new Command37().name("status").description("Show status of
|
|
|
10936
11048
|
variableSources
|
|
10937
11049
|
);
|
|
10938
11050
|
} catch (error) {
|
|
10939
|
-
console.error(
|
|
11051
|
+
console.error(chalk43.red("\u2717 Failed to get agent compose status"));
|
|
10940
11052
|
if (error instanceof Error) {
|
|
10941
11053
|
if (error.message.includes("Not authenticated")) {
|
|
10942
|
-
console.error(
|
|
11054
|
+
console.error(chalk43.dim(" Run: vm0 auth login"));
|
|
10943
11055
|
} else {
|
|
10944
|
-
console.error(
|
|
11056
|
+
console.error(chalk43.dim(` ${error.message}`));
|
|
10945
11057
|
}
|
|
10946
11058
|
}
|
|
10947
11059
|
process.exit(1);
|
|
@@ -10949,9 +11061,9 @@ var statusCommand5 = new Command37().name("status").description("Show status of
|
|
|
10949
11061
|
});
|
|
10950
11062
|
|
|
10951
11063
|
// src/commands/agent/public.ts
|
|
10952
|
-
import { Command as
|
|
10953
|
-
import
|
|
10954
|
-
var publicCommand = new
|
|
11064
|
+
import { Command as Command39 } from "commander";
|
|
11065
|
+
import chalk44 from "chalk";
|
|
11066
|
+
var publicCommand = new Command39().name("public").description("Make an agent public (accessible to all authenticated users)").argument("<name>", "Agent name").option(
|
|
10955
11067
|
"--experimental-shared-agent",
|
|
10956
11068
|
"Enable experimental agent sharing feature"
|
|
10957
11069
|
).action(
|
|
@@ -10959,18 +11071,18 @@ var publicCommand = new Command38().name("public").description("Make an agent pu
|
|
|
10959
11071
|
async (name, options) => {
|
|
10960
11072
|
if (!options.experimentalSharedAgent) {
|
|
10961
11073
|
console.error(
|
|
10962
|
-
|
|
11074
|
+
chalk44.red(
|
|
10963
11075
|
"\u2717 This command requires --experimental-shared-agent flag"
|
|
10964
11076
|
)
|
|
10965
11077
|
);
|
|
10966
11078
|
console.error();
|
|
10967
11079
|
console.error(
|
|
10968
|
-
|
|
11080
|
+
chalk44.dim(" Agent sharing is an experimental feature.")
|
|
10969
11081
|
);
|
|
10970
11082
|
console.error();
|
|
10971
11083
|
console.error("Example:");
|
|
10972
11084
|
console.error(
|
|
10973
|
-
|
|
11085
|
+
chalk44.cyan(
|
|
10974
11086
|
` vm0 agent public ${name} --experimental-shared-agent`
|
|
10975
11087
|
)
|
|
10976
11088
|
);
|
|
@@ -10978,7 +11090,7 @@ var publicCommand = new Command38().name("public").description("Make an agent pu
|
|
|
10978
11090
|
}
|
|
10979
11091
|
const compose = await getComposeByName(name);
|
|
10980
11092
|
if (!compose) {
|
|
10981
|
-
console.error(
|
|
11093
|
+
console.error(chalk44.red(`\u2717 Agent not found: ${name}`));
|
|
10982
11094
|
process.exit(1);
|
|
10983
11095
|
}
|
|
10984
11096
|
const scope = await getScope();
|
|
@@ -10989,7 +11101,7 @@ var publicCommand = new Command38().name("public").description("Make an agent pu
|
|
|
10989
11101
|
if (!response.ok) {
|
|
10990
11102
|
const error = await response.json();
|
|
10991
11103
|
if (response.status === 409) {
|
|
10992
|
-
console.log(
|
|
11104
|
+
console.log(chalk44.yellow(`Agent "${name}" is already public`));
|
|
10993
11105
|
return;
|
|
10994
11106
|
}
|
|
10995
11107
|
throw new Error(
|
|
@@ -10997,11 +11109,11 @@ var publicCommand = new Command38().name("public").description("Make an agent pu
|
|
|
10997
11109
|
);
|
|
10998
11110
|
}
|
|
10999
11111
|
const fullName = `${scope.slug}/${name}`;
|
|
11000
|
-
console.log(
|
|
11112
|
+
console.log(chalk44.green(`\u2713 Agent "${name}" is now public`));
|
|
11001
11113
|
console.log();
|
|
11002
11114
|
console.log("Others can now run your agent with:");
|
|
11003
11115
|
console.log(
|
|
11004
|
-
|
|
11116
|
+
chalk44.cyan(
|
|
11005
11117
|
` vm0 run ${fullName} --experimental-shared-agent "your prompt"`
|
|
11006
11118
|
)
|
|
11007
11119
|
);
|
|
@@ -11010,9 +11122,9 @@ var publicCommand = new Command38().name("public").description("Make an agent pu
|
|
|
11010
11122
|
);
|
|
11011
11123
|
|
|
11012
11124
|
// src/commands/agent/private.ts
|
|
11013
|
-
import { Command as
|
|
11014
|
-
import
|
|
11015
|
-
var privateCommand = new
|
|
11125
|
+
import { Command as Command40 } from "commander";
|
|
11126
|
+
import chalk45 from "chalk";
|
|
11127
|
+
var privateCommand = new Command40().name("private").description("Make an agent private (remove public access)").argument("<name>", "Agent name").option(
|
|
11016
11128
|
"--experimental-shared-agent",
|
|
11017
11129
|
"Enable experimental agent sharing feature"
|
|
11018
11130
|
).action(
|
|
@@ -11020,18 +11132,18 @@ var privateCommand = new Command39().name("private").description("Make an agent
|
|
|
11020
11132
|
async (name, options) => {
|
|
11021
11133
|
if (!options.experimentalSharedAgent) {
|
|
11022
11134
|
console.error(
|
|
11023
|
-
|
|
11135
|
+
chalk45.red(
|
|
11024
11136
|
"\u2717 This command requires --experimental-shared-agent flag"
|
|
11025
11137
|
)
|
|
11026
11138
|
);
|
|
11027
11139
|
console.error();
|
|
11028
11140
|
console.error(
|
|
11029
|
-
|
|
11141
|
+
chalk45.dim(" Agent sharing is an experimental feature.")
|
|
11030
11142
|
);
|
|
11031
11143
|
console.error();
|
|
11032
11144
|
console.error("Example:");
|
|
11033
11145
|
console.error(
|
|
11034
|
-
|
|
11146
|
+
chalk45.cyan(
|
|
11035
11147
|
` vm0 agent private ${name} --experimental-shared-agent`
|
|
11036
11148
|
)
|
|
11037
11149
|
);
|
|
@@ -11039,7 +11151,7 @@ var privateCommand = new Command39().name("private").description("Make an agent
|
|
|
11039
11151
|
}
|
|
11040
11152
|
const compose = await getComposeByName(name);
|
|
11041
11153
|
if (!compose) {
|
|
11042
|
-
console.error(
|
|
11154
|
+
console.error(chalk45.red(`\u2717 Agent not found: ${name}`));
|
|
11043
11155
|
process.exit(1);
|
|
11044
11156
|
}
|
|
11045
11157
|
const response = await httpDelete(
|
|
@@ -11048,22 +11160,22 @@ var privateCommand = new Command39().name("private").description("Make an agent
|
|
|
11048
11160
|
if (!response.ok) {
|
|
11049
11161
|
const error = await response.json();
|
|
11050
11162
|
if (response.status === 404) {
|
|
11051
|
-
console.log(
|
|
11163
|
+
console.log(chalk45.yellow(`Agent "${name}" is already private`));
|
|
11052
11164
|
return;
|
|
11053
11165
|
}
|
|
11054
11166
|
throw new Error(
|
|
11055
11167
|
error.error?.message || "Failed to make agent private"
|
|
11056
11168
|
);
|
|
11057
11169
|
}
|
|
11058
|
-
console.log(
|
|
11170
|
+
console.log(chalk45.green(`\u2713 Agent "${name}" is now private`));
|
|
11059
11171
|
}
|
|
11060
11172
|
)
|
|
11061
11173
|
);
|
|
11062
11174
|
|
|
11063
11175
|
// src/commands/agent/share.ts
|
|
11064
|
-
import { Command as
|
|
11065
|
-
import
|
|
11066
|
-
var shareCommand = new
|
|
11176
|
+
import { Command as Command41 } from "commander";
|
|
11177
|
+
import chalk46 from "chalk";
|
|
11178
|
+
var shareCommand = new Command41().name("share").description("Share an agent with a user by email").argument("<name>", "Agent name").requiredOption("--email <email>", "Email address to share with").option(
|
|
11067
11179
|
"--experimental-shared-agent",
|
|
11068
11180
|
"Enable experimental agent sharing feature"
|
|
11069
11181
|
).action(
|
|
@@ -11071,18 +11183,18 @@ var shareCommand = new Command40().name("share").description("Share an agent wit
|
|
|
11071
11183
|
async (name, options) => {
|
|
11072
11184
|
if (!options.experimentalSharedAgent) {
|
|
11073
11185
|
console.error(
|
|
11074
|
-
|
|
11186
|
+
chalk46.red(
|
|
11075
11187
|
"\u2717 This command requires --experimental-shared-agent flag"
|
|
11076
11188
|
)
|
|
11077
11189
|
);
|
|
11078
11190
|
console.error();
|
|
11079
11191
|
console.error(
|
|
11080
|
-
|
|
11192
|
+
chalk46.dim(" Agent sharing is an experimental feature.")
|
|
11081
11193
|
);
|
|
11082
11194
|
console.error();
|
|
11083
11195
|
console.error("Example:");
|
|
11084
11196
|
console.error(
|
|
11085
|
-
|
|
11197
|
+
chalk46.cyan(
|
|
11086
11198
|
` vm0 agent share ${name} --email ${options.email} --experimental-shared-agent`
|
|
11087
11199
|
)
|
|
11088
11200
|
);
|
|
@@ -11090,7 +11202,7 @@ var shareCommand = new Command40().name("share").description("Share an agent wit
|
|
|
11090
11202
|
}
|
|
11091
11203
|
const compose = await getComposeByName(name);
|
|
11092
11204
|
if (!compose) {
|
|
11093
|
-
console.error(
|
|
11205
|
+
console.error(chalk46.red(`\u2717 Agent not found: ${name}`));
|
|
11094
11206
|
process.exit(1);
|
|
11095
11207
|
}
|
|
11096
11208
|
const scope = await getScope();
|
|
@@ -11102,7 +11214,7 @@ var shareCommand = new Command40().name("share").description("Share an agent wit
|
|
|
11102
11214
|
const error = await response.json();
|
|
11103
11215
|
if (response.status === 409) {
|
|
11104
11216
|
console.log(
|
|
11105
|
-
|
|
11217
|
+
chalk46.yellow(
|
|
11106
11218
|
`Agent "${name}" is already shared with ${options.email}`
|
|
11107
11219
|
)
|
|
11108
11220
|
);
|
|
@@ -11112,12 +11224,12 @@ var shareCommand = new Command40().name("share").description("Share an agent wit
|
|
|
11112
11224
|
}
|
|
11113
11225
|
const fullName = `${scope.slug}/${name}`;
|
|
11114
11226
|
console.log(
|
|
11115
|
-
|
|
11227
|
+
chalk46.green(`\u2713 Agent "${name}" shared with ${options.email}`)
|
|
11116
11228
|
);
|
|
11117
11229
|
console.log();
|
|
11118
11230
|
console.log("They can now run your agent with:");
|
|
11119
11231
|
console.log(
|
|
11120
|
-
|
|
11232
|
+
chalk46.cyan(
|
|
11121
11233
|
` vm0 run ${fullName} --experimental-shared-agent "your prompt"`
|
|
11122
11234
|
)
|
|
11123
11235
|
);
|
|
@@ -11126,9 +11238,9 @@ var shareCommand = new Command40().name("share").description("Share an agent wit
|
|
|
11126
11238
|
);
|
|
11127
11239
|
|
|
11128
11240
|
// src/commands/agent/unshare.ts
|
|
11129
|
-
import { Command as
|
|
11130
|
-
import
|
|
11131
|
-
var unshareCommand = new
|
|
11241
|
+
import { Command as Command42 } from "commander";
|
|
11242
|
+
import chalk47 from "chalk";
|
|
11243
|
+
var unshareCommand = new Command42().name("unshare").description("Remove sharing from a user").argument("<name>", "Agent name").requiredOption("--email <email>", "Email address to unshare").option(
|
|
11132
11244
|
"--experimental-shared-agent",
|
|
11133
11245
|
"Enable experimental agent sharing feature"
|
|
11134
11246
|
).action(
|
|
@@ -11136,18 +11248,18 @@ var unshareCommand = new Command41().name("unshare").description("Remove sharing
|
|
|
11136
11248
|
async (name, options) => {
|
|
11137
11249
|
if (!options.experimentalSharedAgent) {
|
|
11138
11250
|
console.error(
|
|
11139
|
-
|
|
11251
|
+
chalk47.red(
|
|
11140
11252
|
"\u2717 This command requires --experimental-shared-agent flag"
|
|
11141
11253
|
)
|
|
11142
11254
|
);
|
|
11143
11255
|
console.error();
|
|
11144
11256
|
console.error(
|
|
11145
|
-
|
|
11257
|
+
chalk47.dim(" Agent sharing is an experimental feature.")
|
|
11146
11258
|
);
|
|
11147
11259
|
console.error();
|
|
11148
11260
|
console.error("Example:");
|
|
11149
11261
|
console.error(
|
|
11150
|
-
|
|
11262
|
+
chalk47.cyan(
|
|
11151
11263
|
` vm0 agent unshare ${name} --email ${options.email} --experimental-shared-agent`
|
|
11152
11264
|
)
|
|
11153
11265
|
);
|
|
@@ -11155,7 +11267,7 @@ var unshareCommand = new Command41().name("unshare").description("Remove sharing
|
|
|
11155
11267
|
}
|
|
11156
11268
|
const compose = await getComposeByName(name);
|
|
11157
11269
|
if (!compose) {
|
|
11158
|
-
console.error(
|
|
11270
|
+
console.error(chalk47.red(`\u2717 Agent not found: ${name}`));
|
|
11159
11271
|
process.exit(1);
|
|
11160
11272
|
}
|
|
11161
11273
|
const response = await httpDelete(
|
|
@@ -11165,7 +11277,7 @@ var unshareCommand = new Command41().name("unshare").description("Remove sharing
|
|
|
11165
11277
|
const error = await response.json();
|
|
11166
11278
|
if (response.status === 404) {
|
|
11167
11279
|
console.log(
|
|
11168
|
-
|
|
11280
|
+
chalk47.yellow(
|
|
11169
11281
|
`Agent "${name}" is not shared with ${options.email}`
|
|
11170
11282
|
)
|
|
11171
11283
|
);
|
|
@@ -11174,16 +11286,16 @@ var unshareCommand = new Command41().name("unshare").description("Remove sharing
|
|
|
11174
11286
|
throw new Error(error.error?.message || "Failed to unshare agent");
|
|
11175
11287
|
}
|
|
11176
11288
|
console.log(
|
|
11177
|
-
|
|
11289
|
+
chalk47.green(`\u2713 Removed sharing of "${name}" from ${options.email}`)
|
|
11178
11290
|
);
|
|
11179
11291
|
}
|
|
11180
11292
|
)
|
|
11181
11293
|
);
|
|
11182
11294
|
|
|
11183
11295
|
// src/commands/agent/permission.ts
|
|
11184
|
-
import { Command as
|
|
11185
|
-
import
|
|
11186
|
-
var permissionCommand = new
|
|
11296
|
+
import { Command as Command43 } from "commander";
|
|
11297
|
+
import chalk48 from "chalk";
|
|
11298
|
+
var permissionCommand = new Command43().name("permission").description("List all permissions for an agent").argument("<name>", "Agent name").option(
|
|
11187
11299
|
"--experimental-shared-agent",
|
|
11188
11300
|
"Enable experimental agent sharing feature"
|
|
11189
11301
|
).action(
|
|
@@ -11191,18 +11303,18 @@ var permissionCommand = new Command42().name("permission").description("List all
|
|
|
11191
11303
|
async (name, options) => {
|
|
11192
11304
|
if (!options.experimentalSharedAgent) {
|
|
11193
11305
|
console.error(
|
|
11194
|
-
|
|
11306
|
+
chalk48.red(
|
|
11195
11307
|
"\u2717 This command requires --experimental-shared-agent flag"
|
|
11196
11308
|
)
|
|
11197
11309
|
);
|
|
11198
11310
|
console.error();
|
|
11199
11311
|
console.error(
|
|
11200
|
-
|
|
11312
|
+
chalk48.dim(" Agent sharing is an experimental feature.")
|
|
11201
11313
|
);
|
|
11202
11314
|
console.error();
|
|
11203
11315
|
console.error("Example:");
|
|
11204
11316
|
console.error(
|
|
11205
|
-
|
|
11317
|
+
chalk48.cyan(
|
|
11206
11318
|
` vm0 agent permission ${name} --experimental-shared-agent`
|
|
11207
11319
|
)
|
|
11208
11320
|
);
|
|
@@ -11210,7 +11322,7 @@ var permissionCommand = new Command42().name("permission").description("List all
|
|
|
11210
11322
|
}
|
|
11211
11323
|
const compose = await getComposeByName(name);
|
|
11212
11324
|
if (!compose) {
|
|
11213
|
-
console.error(
|
|
11325
|
+
console.error(chalk48.red(`\u2717 Agent not found: ${name}`));
|
|
11214
11326
|
process.exit(1);
|
|
11215
11327
|
}
|
|
11216
11328
|
const response = await httpGet(
|
|
@@ -11222,16 +11334,16 @@ var permissionCommand = new Command42().name("permission").description("List all
|
|
|
11222
11334
|
}
|
|
11223
11335
|
const data = await response.json();
|
|
11224
11336
|
if (data.permissions.length === 0) {
|
|
11225
|
-
console.log(
|
|
11337
|
+
console.log(chalk48.dim("No permissions set (private agent)"));
|
|
11226
11338
|
return;
|
|
11227
11339
|
}
|
|
11228
11340
|
console.log(
|
|
11229
|
-
|
|
11341
|
+
chalk48.dim(
|
|
11230
11342
|
"TYPE EMAIL PERMISSION GRANTED"
|
|
11231
11343
|
)
|
|
11232
11344
|
);
|
|
11233
11345
|
console.log(
|
|
11234
|
-
|
|
11346
|
+
chalk48.dim(
|
|
11235
11347
|
"------- ----------------------------- ---------- ----------"
|
|
11236
11348
|
)
|
|
11237
11349
|
);
|
|
@@ -11247,11 +11359,11 @@ var permissionCommand = new Command42().name("permission").description("List all
|
|
|
11247
11359
|
);
|
|
11248
11360
|
|
|
11249
11361
|
// src/commands/agent/index.ts
|
|
11250
|
-
var agentCommand = new
|
|
11362
|
+
var agentCommand = new Command44().name("agent").description("Manage agent composes").addCommand(cloneCommand3).addCommand(deleteCommand).addCommand(listCommand4).addCommand(statusCommand5).addCommand(publicCommand).addCommand(privateCommand).addCommand(shareCommand).addCommand(unshareCommand).addCommand(permissionCommand);
|
|
11251
11363
|
|
|
11252
11364
|
// src/commands/init/index.ts
|
|
11253
|
-
import { Command as
|
|
11254
|
-
import
|
|
11365
|
+
import { Command as Command45 } from "commander";
|
|
11366
|
+
import chalk49 from "chalk";
|
|
11255
11367
|
import path15 from "path";
|
|
11256
11368
|
import { existsSync as existsSync11 } from "fs";
|
|
11257
11369
|
import { writeFile as writeFile7 } from "fs/promises";
|
|
@@ -11289,14 +11401,14 @@ function checkExistingFiles() {
|
|
|
11289
11401
|
if (existsSync11(AGENTS_MD_FILE)) existingFiles.push(AGENTS_MD_FILE);
|
|
11290
11402
|
return existingFiles;
|
|
11291
11403
|
}
|
|
11292
|
-
var initCommand3 = new
|
|
11404
|
+
var initCommand3 = new Command45().name("init").description("Initialize a new VM0 project in the current directory").option("-f, --force", "Overwrite existing files").option("-n, --name <name>", "Agent name (required in non-interactive mode)").action(async (options) => {
|
|
11293
11405
|
const existingFiles = checkExistingFiles();
|
|
11294
11406
|
if (existingFiles.length > 0 && !options.force) {
|
|
11295
11407
|
for (const file of existingFiles) {
|
|
11296
|
-
console.error(
|
|
11408
|
+
console.error(chalk49.red(`\u2717 ${file} already exists`));
|
|
11297
11409
|
}
|
|
11298
11410
|
console.error();
|
|
11299
|
-
console.error(`To overwrite: ${
|
|
11411
|
+
console.error(`To overwrite: ${chalk49.cyan("vm0 init --force")}`);
|
|
11300
11412
|
process.exit(1);
|
|
11301
11413
|
}
|
|
11302
11414
|
let agentName;
|
|
@@ -11304,9 +11416,9 @@ var initCommand3 = new Command44().name("init").description("Initialize a new VM
|
|
|
11304
11416
|
agentName = options.name.trim();
|
|
11305
11417
|
} else if (!isInteractive()) {
|
|
11306
11418
|
console.error(
|
|
11307
|
-
|
|
11419
|
+
chalk49.red("\u2717 --name flag is required in non-interactive mode")
|
|
11308
11420
|
);
|
|
11309
|
-
console.error(
|
|
11421
|
+
console.error(chalk49.dim(" Usage: vm0 init --name <agent-name>"));
|
|
11310
11422
|
process.exit(1);
|
|
11311
11423
|
} else {
|
|
11312
11424
|
const dirName = path15.basename(process.cwd());
|
|
@@ -11322,47 +11434,47 @@ var initCommand3 = new Command44().name("init").description("Initialize a new VM
|
|
|
11322
11434
|
}
|
|
11323
11435
|
);
|
|
11324
11436
|
if (name === void 0) {
|
|
11325
|
-
console.log(
|
|
11437
|
+
console.log(chalk49.dim("Cancelled"));
|
|
11326
11438
|
return;
|
|
11327
11439
|
}
|
|
11328
11440
|
agentName = name;
|
|
11329
11441
|
}
|
|
11330
11442
|
if (!agentName || !validateAgentName(agentName)) {
|
|
11331
|
-
console.error(
|
|
11443
|
+
console.error(chalk49.red("\u2717 Invalid agent name"));
|
|
11332
11444
|
console.error(
|
|
11333
|
-
|
|
11445
|
+
chalk49.dim(" Must be 3-64 characters, alphanumeric and hyphens only")
|
|
11334
11446
|
);
|
|
11335
|
-
console.error(
|
|
11447
|
+
console.error(chalk49.dim(" Must start and end with letter or number"));
|
|
11336
11448
|
process.exit(1);
|
|
11337
11449
|
}
|
|
11338
11450
|
await writeFile7(VM0_YAML_FILE, generateVm0Yaml(agentName));
|
|
11339
11451
|
const vm0Status = existingFiles.includes(VM0_YAML_FILE) ? " (overwritten)" : "";
|
|
11340
|
-
console.log(
|
|
11452
|
+
console.log(chalk49.green(`\u2713 Created ${VM0_YAML_FILE}${vm0Status}`));
|
|
11341
11453
|
await writeFile7(AGENTS_MD_FILE, generateAgentsMd());
|
|
11342
11454
|
const agentsStatus = existingFiles.includes(AGENTS_MD_FILE) ? " (overwritten)" : "";
|
|
11343
|
-
console.log(
|
|
11455
|
+
console.log(chalk49.green(`\u2713 Created ${AGENTS_MD_FILE}${agentsStatus}`));
|
|
11344
11456
|
console.log();
|
|
11345
11457
|
console.log("Next steps:");
|
|
11346
11458
|
console.log(
|
|
11347
|
-
` 1. Set up model provider (one-time): ${
|
|
11459
|
+
` 1. Set up model provider (one-time): ${chalk49.cyan("vm0 model-provider setup")}`
|
|
11348
11460
|
);
|
|
11349
11461
|
console.log(
|
|
11350
|
-
` 2. Edit ${
|
|
11462
|
+
` 2. Edit ${chalk49.cyan("AGENTS.md")} to customize your agent's workflow`
|
|
11351
11463
|
);
|
|
11352
11464
|
console.log(
|
|
11353
|
-
` Or install Claude plugin: ${
|
|
11465
|
+
` Or install Claude plugin: ${chalk49.cyan(`vm0 setup-claude && claude "/vm0-agent let's build an agent"`)}`
|
|
11354
11466
|
);
|
|
11355
11467
|
console.log(
|
|
11356
|
-
` 3. Run your agent: ${
|
|
11468
|
+
` 3. Run your agent: ${chalk49.cyan(`vm0 cook "let's start working"`)}`
|
|
11357
11469
|
);
|
|
11358
11470
|
});
|
|
11359
11471
|
|
|
11360
11472
|
// src/commands/schedule/index.ts
|
|
11361
|
-
import { Command as
|
|
11473
|
+
import { Command as Command52 } from "commander";
|
|
11362
11474
|
|
|
11363
11475
|
// src/commands/schedule/setup.ts
|
|
11364
|
-
import { Command as
|
|
11365
|
-
import
|
|
11476
|
+
import { Command as Command46 } from "commander";
|
|
11477
|
+
import chalk50 from "chalk";
|
|
11366
11478
|
|
|
11367
11479
|
// src/lib/domain/schedule-utils.ts
|
|
11368
11480
|
import { parse as parseYaml5 } from "yaml";
|
|
@@ -11584,7 +11696,7 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
|
|
|
11584
11696
|
}
|
|
11585
11697
|
if (!isInteractive()) {
|
|
11586
11698
|
console.error(
|
|
11587
|
-
|
|
11699
|
+
chalk50.red("\u2717 --frequency is required (daily|weekly|monthly|once)")
|
|
11588
11700
|
);
|
|
11589
11701
|
process.exit(1);
|
|
11590
11702
|
}
|
|
@@ -11604,7 +11716,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
11604
11716
|
const day2 = parseDayOption(optionDay, frequency);
|
|
11605
11717
|
if (day2 === void 0) {
|
|
11606
11718
|
console.error(
|
|
11607
|
-
|
|
11719
|
+
chalk50.red(
|
|
11608
11720
|
`\u2717 Invalid day: ${optionDay}. Use mon-sun for weekly or 1-31 for monthly.`
|
|
11609
11721
|
)
|
|
11610
11722
|
);
|
|
@@ -11613,7 +11725,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
11613
11725
|
return day2;
|
|
11614
11726
|
}
|
|
11615
11727
|
if (!isInteractive()) {
|
|
11616
|
-
console.error(
|
|
11728
|
+
console.error(chalk50.red("\u2717 --day is required for weekly/monthly"));
|
|
11617
11729
|
process.exit(1);
|
|
11618
11730
|
}
|
|
11619
11731
|
if (frequency === "weekly") {
|
|
@@ -11632,7 +11744,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
11632
11744
|
if (!dayStr) return null;
|
|
11633
11745
|
const day = parseInt(dayStr, 10);
|
|
11634
11746
|
if (isNaN(day) || day < 1 || day > 31) {
|
|
11635
|
-
console.error(
|
|
11747
|
+
console.error(chalk50.red("\u2717 Day must be between 1 and 31"));
|
|
11636
11748
|
process.exit(1);
|
|
11637
11749
|
}
|
|
11638
11750
|
return day;
|
|
@@ -11641,13 +11753,13 @@ async function gatherRecurringTime(optionTime, existingTime) {
|
|
|
11641
11753
|
if (optionTime) {
|
|
11642
11754
|
const validation = validateTimeFormat(optionTime);
|
|
11643
11755
|
if (validation !== true) {
|
|
11644
|
-
console.error(
|
|
11756
|
+
console.error(chalk50.red(`\u2717 Invalid time: ${validation}`));
|
|
11645
11757
|
process.exit(1);
|
|
11646
11758
|
}
|
|
11647
11759
|
return optionTime;
|
|
11648
11760
|
}
|
|
11649
11761
|
if (!isInteractive()) {
|
|
11650
|
-
console.error(
|
|
11762
|
+
console.error(chalk50.red("\u2717 --time is required (HH:MM format)"));
|
|
11651
11763
|
process.exit(1);
|
|
11652
11764
|
}
|
|
11653
11765
|
return await promptText(
|
|
@@ -11660,7 +11772,7 @@ async function gatherOneTimeSchedule(optionDay, optionTime, existingTime) {
|
|
|
11660
11772
|
if (optionDay && optionTime) {
|
|
11661
11773
|
if (!validateDateFormat(optionDay)) {
|
|
11662
11774
|
console.error(
|
|
11663
|
-
|
|
11775
|
+
chalk50.red(
|
|
11664
11776
|
`\u2717 Invalid date format: ${optionDay}. Use YYYY-MM-DD format.`
|
|
11665
11777
|
)
|
|
11666
11778
|
);
|
|
@@ -11668,16 +11780,16 @@ async function gatherOneTimeSchedule(optionDay, optionTime, existingTime) {
|
|
|
11668
11780
|
}
|
|
11669
11781
|
if (!validateTimeFormat(optionTime)) {
|
|
11670
11782
|
console.error(
|
|
11671
|
-
|
|
11783
|
+
chalk50.red(`\u2717 Invalid time format: ${optionTime}. Use HH:MM format.`)
|
|
11672
11784
|
);
|
|
11673
11785
|
process.exit(1);
|
|
11674
11786
|
}
|
|
11675
11787
|
return `${optionDay} ${optionTime}`;
|
|
11676
11788
|
}
|
|
11677
11789
|
if (!isInteractive()) {
|
|
11678
|
-
console.error(
|
|
11790
|
+
console.error(chalk50.red("\u2717 One-time schedules require interactive mode"));
|
|
11679
11791
|
console.error(
|
|
11680
|
-
|
|
11792
|
+
chalk50.dim(" Or provide --day (YYYY-MM-DD) and --time (HH:MM) flags")
|
|
11681
11793
|
);
|
|
11682
11794
|
process.exit(1);
|
|
11683
11795
|
}
|
|
@@ -11708,7 +11820,7 @@ async function gatherTimezone(optionTimezone, existingTimezone) {
|
|
|
11708
11820
|
async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
11709
11821
|
if (optionPrompt) return optionPrompt;
|
|
11710
11822
|
if (!isInteractive()) {
|
|
11711
|
-
console.error(
|
|
11823
|
+
console.error(chalk50.red("\u2717 --prompt is required"));
|
|
11712
11824
|
process.exit(1);
|
|
11713
11825
|
}
|
|
11714
11826
|
return await promptText(
|
|
@@ -11719,8 +11831,8 @@ async function gatherPromptText(optionPrompt, existingPrompt) {
|
|
|
11719
11831
|
async function resolveAgent(agentName) {
|
|
11720
11832
|
const compose = await getComposeByName(agentName);
|
|
11721
11833
|
if (!compose) {
|
|
11722
|
-
console.error(
|
|
11723
|
-
console.error(
|
|
11834
|
+
console.error(chalk50.red(`\u2717 Agent not found: ${agentName}`));
|
|
11835
|
+
console.error(chalk50.dim(" Make sure the agent is composed first"));
|
|
11724
11836
|
process.exit(1);
|
|
11725
11837
|
}
|
|
11726
11838
|
return {
|
|
@@ -11765,7 +11877,7 @@ async function buildAndDeploy(params) {
|
|
|
11765
11877
|
}
|
|
11766
11878
|
console.log(
|
|
11767
11879
|
`
|
|
11768
|
-
Deploying schedule for agent ${
|
|
11880
|
+
Deploying schedule for agent ${chalk50.cyan(params.agentName)}...`
|
|
11769
11881
|
);
|
|
11770
11882
|
const deployResult = await deploySchedule({
|
|
11771
11883
|
name: params.scheduleName,
|
|
@@ -11781,56 +11893,56 @@ Deploying schedule for agent ${chalk49.cyan(params.agentName)}...`
|
|
|
11781
11893
|
function displayDeployResult(agentName, deployResult) {
|
|
11782
11894
|
if (deployResult.created) {
|
|
11783
11895
|
console.log(
|
|
11784
|
-
|
|
11896
|
+
chalk50.green(`\u2713 Created schedule for agent ${chalk50.cyan(agentName)}`)
|
|
11785
11897
|
);
|
|
11786
11898
|
} else {
|
|
11787
11899
|
console.log(
|
|
11788
|
-
|
|
11900
|
+
chalk50.green(`\u2713 Updated schedule for agent ${chalk50.cyan(agentName)}`)
|
|
11789
11901
|
);
|
|
11790
11902
|
}
|
|
11791
|
-
console.log(
|
|
11903
|
+
console.log(chalk50.dim(` Timezone: ${deployResult.schedule.timezone}`));
|
|
11792
11904
|
if (deployResult.schedule.cronExpression) {
|
|
11793
|
-
console.log(
|
|
11905
|
+
console.log(chalk50.dim(` Cron: ${deployResult.schedule.cronExpression}`));
|
|
11794
11906
|
if (deployResult.schedule.nextRunAt) {
|
|
11795
11907
|
const nextRun = formatInTimezone(
|
|
11796
11908
|
deployResult.schedule.nextRunAt,
|
|
11797
11909
|
deployResult.schedule.timezone
|
|
11798
11910
|
);
|
|
11799
|
-
console.log(
|
|
11911
|
+
console.log(chalk50.dim(` Next run: ${nextRun}`));
|
|
11800
11912
|
}
|
|
11801
11913
|
} else if (deployResult.schedule.atTime) {
|
|
11802
11914
|
const atTimeFormatted = formatInTimezone(
|
|
11803
11915
|
deployResult.schedule.atTime,
|
|
11804
11916
|
deployResult.schedule.timezone
|
|
11805
11917
|
);
|
|
11806
|
-
console.log(
|
|
11918
|
+
console.log(chalk50.dim(` At: ${atTimeFormatted}`));
|
|
11807
11919
|
}
|
|
11808
11920
|
}
|
|
11809
11921
|
async function tryEnableSchedule(scheduleName, composeId, agentName) {
|
|
11810
11922
|
try {
|
|
11811
11923
|
await enableSchedule({ name: scheduleName, composeId });
|
|
11812
11924
|
console.log(
|
|
11813
|
-
|
|
11925
|
+
chalk50.green(`\u2713 Enabled schedule for agent ${chalk50.cyan(agentName)}`)
|
|
11814
11926
|
);
|
|
11815
11927
|
} catch (error) {
|
|
11816
|
-
console.error(
|
|
11928
|
+
console.error(chalk50.yellow("\u26A0 Failed to enable schedule"));
|
|
11817
11929
|
if (error instanceof ApiRequestError) {
|
|
11818
11930
|
if (error.code === "SCHEDULE_PAST") {
|
|
11819
|
-
console.error(
|
|
11931
|
+
console.error(chalk50.dim(" Scheduled time has already passed"));
|
|
11820
11932
|
} else {
|
|
11821
|
-
console.error(
|
|
11933
|
+
console.error(chalk50.dim(` ${error.message}`));
|
|
11822
11934
|
}
|
|
11823
11935
|
} else if (error instanceof Error) {
|
|
11824
|
-
console.error(
|
|
11936
|
+
console.error(chalk50.dim(` ${error.message}`));
|
|
11825
11937
|
}
|
|
11826
11938
|
console.log(
|
|
11827
|
-
` To enable manually: ${
|
|
11939
|
+
` To enable manually: ${chalk50.cyan(`vm0 schedule enable ${agentName}`)}`
|
|
11828
11940
|
);
|
|
11829
11941
|
}
|
|
11830
11942
|
}
|
|
11831
11943
|
function showEnableHint(agentName) {
|
|
11832
11944
|
console.log();
|
|
11833
|
-
console.log(` To enable: ${
|
|
11945
|
+
console.log(` To enable: ${chalk50.cyan(`vm0 schedule enable ${agentName}`)}`);
|
|
11834
11946
|
}
|
|
11835
11947
|
async function handleScheduleEnabling(params) {
|
|
11836
11948
|
const { scheduleName, composeId, agentName, enableFlag, shouldPromptEnable } = params;
|
|
@@ -11851,12 +11963,12 @@ async function handleScheduleEnabling(params) {
|
|
|
11851
11963
|
showEnableHint(agentName);
|
|
11852
11964
|
}
|
|
11853
11965
|
}
|
|
11854
|
-
var setupCommand = new
|
|
11966
|
+
var setupCommand = new Command46().name("setup").description("Create or edit a schedule for an agent").argument("<agent-name>", "Agent name to configure schedule for").option("-f, --frequency <type>", "Frequency: daily|weekly|monthly|once").option("-t, --time <HH:MM>", "Time to run (24-hour format)").option("-d, --day <day>", "Day of week (mon-sun) or day of month (1-31)").option("-z, --timezone <tz>", "IANA timezone").option("-p, --prompt <text>", "Prompt to run").option("--artifact-name <name>", "Artifact name", "artifact").option("-e, --enable", "Enable schedule immediately after creation").action(
|
|
11855
11967
|
withErrorHandler(async (agentName, options) => {
|
|
11856
11968
|
const { composeId, scheduleName } = await resolveAgent(agentName);
|
|
11857
11969
|
const existingSchedule = await findExistingSchedule(agentName);
|
|
11858
11970
|
console.log(
|
|
11859
|
-
|
|
11971
|
+
chalk50.dim(
|
|
11860
11972
|
existingSchedule ? `Editing existing schedule for agent ${agentName}` : `Creating new schedule for agent ${agentName}`
|
|
11861
11973
|
)
|
|
11862
11974
|
);
|
|
@@ -11866,12 +11978,12 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11866
11978
|
defaults.frequency
|
|
11867
11979
|
);
|
|
11868
11980
|
if (!frequency) {
|
|
11869
|
-
console.log(
|
|
11981
|
+
console.log(chalk50.dim("Cancelled"));
|
|
11870
11982
|
return;
|
|
11871
11983
|
}
|
|
11872
11984
|
const timing = await gatherTiming(frequency, options, defaults);
|
|
11873
11985
|
if (!timing) {
|
|
11874
|
-
console.log(
|
|
11986
|
+
console.log(chalk50.dim("Cancelled"));
|
|
11875
11987
|
return;
|
|
11876
11988
|
}
|
|
11877
11989
|
const { day, time, atTime } = timing;
|
|
@@ -11880,7 +11992,7 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11880
11992
|
existingSchedule?.timezone
|
|
11881
11993
|
);
|
|
11882
11994
|
if (!timezone) {
|
|
11883
|
-
console.log(
|
|
11995
|
+
console.log(chalk50.dim("Cancelled"));
|
|
11884
11996
|
return;
|
|
11885
11997
|
}
|
|
11886
11998
|
const promptText_ = await gatherPromptText(
|
|
@@ -11888,7 +12000,7 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11888
12000
|
existingSchedule?.prompt
|
|
11889
12001
|
);
|
|
11890
12002
|
if (!promptText_) {
|
|
11891
|
-
console.log(
|
|
12003
|
+
console.log(chalk50.dim("Cancelled"));
|
|
11892
12004
|
return;
|
|
11893
12005
|
}
|
|
11894
12006
|
const deployResult = await buildAndDeploy({
|
|
@@ -11916,15 +12028,15 @@ var setupCommand = new Command45().name("setup").description("Create or edit a s
|
|
|
11916
12028
|
);
|
|
11917
12029
|
|
|
11918
12030
|
// src/commands/schedule/list.ts
|
|
11919
|
-
import { Command as
|
|
11920
|
-
import
|
|
11921
|
-
var listCommand5 = new
|
|
12031
|
+
import { Command as Command47 } from "commander";
|
|
12032
|
+
import chalk51 from "chalk";
|
|
12033
|
+
var listCommand5 = new Command47().name("list").alias("ls").description("List all schedules").action(
|
|
11922
12034
|
withErrorHandler(async () => {
|
|
11923
12035
|
const result = await listSchedules();
|
|
11924
12036
|
if (result.schedules.length === 0) {
|
|
11925
|
-
console.log(
|
|
12037
|
+
console.log(chalk51.dim("No schedules found"));
|
|
11926
12038
|
console.log(
|
|
11927
|
-
|
|
12039
|
+
chalk51.dim(" Create one with: vm0 schedule setup <agent-name>")
|
|
11928
12040
|
);
|
|
11929
12041
|
return;
|
|
11930
12042
|
}
|
|
@@ -11944,10 +12056,10 @@ var listCommand5 = new Command46().name("list").alias("ls").description("List al
|
|
|
11944
12056
|
"STATUS".padEnd(8),
|
|
11945
12057
|
"NEXT RUN"
|
|
11946
12058
|
].join(" ");
|
|
11947
|
-
console.log(
|
|
12059
|
+
console.log(chalk51.dim(header));
|
|
11948
12060
|
for (const schedule of result.schedules) {
|
|
11949
12061
|
const trigger = schedule.cronExpression ? `${schedule.cronExpression} (${schedule.timezone})` : schedule.atTime || "-";
|
|
11950
|
-
const status = schedule.enabled ?
|
|
12062
|
+
const status = schedule.enabled ? chalk51.green("enabled") : chalk51.yellow("disabled");
|
|
11951
12063
|
const nextRun = schedule.enabled ? formatRelativeTime2(schedule.nextRunAt) : "-";
|
|
11952
12064
|
const row = [
|
|
11953
12065
|
schedule.composeName.padEnd(agentWidth),
|
|
@@ -11962,45 +12074,45 @@ var listCommand5 = new Command46().name("list").alias("ls").description("List al
|
|
|
11962
12074
|
);
|
|
11963
12075
|
|
|
11964
12076
|
// src/commands/schedule/status.ts
|
|
11965
|
-
import { Command as
|
|
11966
|
-
import
|
|
12077
|
+
import { Command as Command48 } from "commander";
|
|
12078
|
+
import chalk52 from "chalk";
|
|
11967
12079
|
function formatDateTimeStyled(dateStr) {
|
|
11968
|
-
if (!dateStr) return
|
|
12080
|
+
if (!dateStr) return chalk52.dim("-");
|
|
11969
12081
|
const formatted = formatDateTime(dateStr);
|
|
11970
|
-
return formatted.replace(/\(([^)]+)\)$/,
|
|
12082
|
+
return formatted.replace(/\(([^)]+)\)$/, chalk52.dim("($1)"));
|
|
11971
12083
|
}
|
|
11972
12084
|
function formatTrigger(schedule) {
|
|
11973
12085
|
if (schedule.cronExpression) {
|
|
11974
12086
|
return schedule.cronExpression;
|
|
11975
12087
|
}
|
|
11976
12088
|
if (schedule.atTime) {
|
|
11977
|
-
return `${schedule.atTime} ${
|
|
12089
|
+
return `${schedule.atTime} ${chalk52.dim("(one-time)")}`;
|
|
11978
12090
|
}
|
|
11979
|
-
return
|
|
12091
|
+
return chalk52.dim("-");
|
|
11980
12092
|
}
|
|
11981
12093
|
function formatRunStatus2(status) {
|
|
11982
12094
|
switch (status) {
|
|
11983
12095
|
case "completed":
|
|
11984
|
-
return
|
|
12096
|
+
return chalk52.green(status);
|
|
11985
12097
|
case "failed":
|
|
11986
12098
|
case "timeout":
|
|
11987
|
-
return
|
|
12099
|
+
return chalk52.red(status);
|
|
11988
12100
|
case "running":
|
|
11989
|
-
return
|
|
12101
|
+
return chalk52.cyan(status);
|
|
11990
12102
|
case "pending":
|
|
11991
|
-
return
|
|
12103
|
+
return chalk52.yellow(status);
|
|
11992
12104
|
default:
|
|
11993
12105
|
return status;
|
|
11994
12106
|
}
|
|
11995
12107
|
}
|
|
11996
12108
|
function printRunConfiguration(schedule) {
|
|
11997
|
-
const statusText = schedule.enabled ?
|
|
12109
|
+
const statusText = schedule.enabled ? chalk52.green("enabled") : chalk52.yellow("disabled");
|
|
11998
12110
|
console.log(`${"Status:".padEnd(16)}${statusText}`);
|
|
11999
12111
|
console.log(
|
|
12000
|
-
`${"Agent:".padEnd(16)}${schedule.composeName} ${
|
|
12112
|
+
`${"Agent:".padEnd(16)}${schedule.composeName} ${chalk52.dim(`(${schedule.scopeSlug})`)}`
|
|
12001
12113
|
);
|
|
12002
12114
|
const promptPreview = schedule.prompt.length > 60 ? schedule.prompt.slice(0, 57) + "..." : schedule.prompt;
|
|
12003
|
-
console.log(`${"Prompt:".padEnd(16)}${
|
|
12115
|
+
console.log(`${"Prompt:".padEnd(16)}${chalk52.dim(promptPreview)}`);
|
|
12004
12116
|
if (schedule.vars && Object.keys(schedule.vars).length > 0) {
|
|
12005
12117
|
console.log(
|
|
12006
12118
|
`${"Variables:".padEnd(16)}${Object.keys(schedule.vars).join(", ")}`
|
|
@@ -12037,7 +12149,7 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
12037
12149
|
console.log();
|
|
12038
12150
|
console.log("Recent Runs:");
|
|
12039
12151
|
console.log(
|
|
12040
|
-
|
|
12152
|
+
chalk52.dim("RUN ID STATUS CREATED")
|
|
12041
12153
|
);
|
|
12042
12154
|
for (const run of runs) {
|
|
12043
12155
|
const id = run.id;
|
|
@@ -12048,24 +12160,24 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
12048
12160
|
}
|
|
12049
12161
|
} catch {
|
|
12050
12162
|
console.log();
|
|
12051
|
-
console.log(
|
|
12163
|
+
console.log(chalk52.dim("Recent Runs: (unable to fetch)"));
|
|
12052
12164
|
}
|
|
12053
12165
|
}
|
|
12054
12166
|
function handleStatusError(error, agentName) {
|
|
12055
|
-
console.error(
|
|
12167
|
+
console.error(chalk52.red("\u2717 Failed to get schedule status"));
|
|
12056
12168
|
if (error instanceof Error) {
|
|
12057
12169
|
if (error.message.includes("Not authenticated")) {
|
|
12058
|
-
console.error(
|
|
12170
|
+
console.error(chalk52.dim(" Run: vm0 auth login"));
|
|
12059
12171
|
} else if (error.message.includes("not found") || error.message.includes("Not found") || error.message.includes("No schedule found")) {
|
|
12060
|
-
console.error(
|
|
12061
|
-
console.error(
|
|
12172
|
+
console.error(chalk52.dim(` No schedule found for agent "${agentName}"`));
|
|
12173
|
+
console.error(chalk52.dim(" Run: vm0 schedule list"));
|
|
12062
12174
|
} else {
|
|
12063
|
-
console.error(
|
|
12175
|
+
console.error(chalk52.dim(` ${error.message}`));
|
|
12064
12176
|
}
|
|
12065
12177
|
}
|
|
12066
12178
|
process.exit(1);
|
|
12067
12179
|
}
|
|
12068
|
-
var statusCommand6 = new
|
|
12180
|
+
var statusCommand6 = new Command48().name("status").description("Show detailed status of a schedule").argument("<agent-name>", "Agent name").option(
|
|
12069
12181
|
"-l, --limit <number>",
|
|
12070
12182
|
"Number of recent runs to show (0 to hide)",
|
|
12071
12183
|
"5"
|
|
@@ -12075,8 +12187,8 @@ var statusCommand6 = new Command47().name("status").description("Show detailed s
|
|
|
12075
12187
|
const { name, composeId } = resolved;
|
|
12076
12188
|
const schedule = await getScheduleByName({ name, composeId });
|
|
12077
12189
|
console.log();
|
|
12078
|
-
console.log(`Schedule for agent: ${
|
|
12079
|
-
console.log(
|
|
12190
|
+
console.log(`Schedule for agent: ${chalk52.cyan(agentName)}`);
|
|
12191
|
+
console.log(chalk52.dim("\u2501".repeat(50)));
|
|
12080
12192
|
printRunConfiguration(schedule);
|
|
12081
12193
|
printTimeSchedule(schedule);
|
|
12082
12194
|
const parsed = parseInt(options.limit, 10);
|
|
@@ -12092,24 +12204,24 @@ var statusCommand6 = new Command47().name("status").description("Show detailed s
|
|
|
12092
12204
|
});
|
|
12093
12205
|
|
|
12094
12206
|
// src/commands/schedule/delete.ts
|
|
12095
|
-
import { Command as
|
|
12096
|
-
import
|
|
12097
|
-
var
|
|
12207
|
+
import { Command as Command49 } from "commander";
|
|
12208
|
+
import chalk53 from "chalk";
|
|
12209
|
+
var deleteCommand2 = new Command49().name("delete").alias("rm").description("Delete a schedule").argument("<agent-name>", "Agent name").option("-f, --force", "Skip confirmation prompt").action(async (agentName, options) => {
|
|
12098
12210
|
try {
|
|
12099
12211
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
12100
12212
|
if (!options.force) {
|
|
12101
12213
|
if (!isInteractive()) {
|
|
12102
12214
|
console.error(
|
|
12103
|
-
|
|
12215
|
+
chalk53.red("\u2717 --force required in non-interactive mode")
|
|
12104
12216
|
);
|
|
12105
12217
|
process.exit(1);
|
|
12106
12218
|
}
|
|
12107
12219
|
const confirmed = await promptConfirm(
|
|
12108
|
-
`Delete schedule for agent ${
|
|
12220
|
+
`Delete schedule for agent ${chalk53.cyan(agentName)}?`,
|
|
12109
12221
|
false
|
|
12110
12222
|
);
|
|
12111
12223
|
if (!confirmed) {
|
|
12112
|
-
console.log(
|
|
12224
|
+
console.log(chalk53.dim("Cancelled"));
|
|
12113
12225
|
return;
|
|
12114
12226
|
}
|
|
12115
12227
|
}
|
|
@@ -12118,20 +12230,20 @@ var deleteCommand = new Command48().name("delete").alias("rm").description("Dele
|
|
|
12118
12230
|
composeId: resolved.composeId
|
|
12119
12231
|
});
|
|
12120
12232
|
console.log(
|
|
12121
|
-
|
|
12233
|
+
chalk53.green(`\u2713 Deleted schedule for agent ${chalk53.cyan(agentName)}`)
|
|
12122
12234
|
);
|
|
12123
12235
|
} catch (error) {
|
|
12124
|
-
console.error(
|
|
12236
|
+
console.error(chalk53.red("\u2717 Failed to delete schedule"));
|
|
12125
12237
|
if (error instanceof Error) {
|
|
12126
12238
|
if (error.message.includes("Not authenticated")) {
|
|
12127
|
-
console.error(
|
|
12239
|
+
console.error(chalk53.dim(" Run: vm0 auth login"));
|
|
12128
12240
|
} else if (error.message.toLowerCase().includes("not found") || error.message.includes("No schedule found")) {
|
|
12129
12241
|
console.error(
|
|
12130
|
-
|
|
12242
|
+
chalk53.dim(` No schedule found for agent "${agentName}"`)
|
|
12131
12243
|
);
|
|
12132
|
-
console.error(
|
|
12244
|
+
console.error(chalk53.dim(" Run: vm0 schedule list"));
|
|
12133
12245
|
} else {
|
|
12134
|
-
console.error(
|
|
12246
|
+
console.error(chalk53.dim(` ${error.message}`));
|
|
12135
12247
|
}
|
|
12136
12248
|
}
|
|
12137
12249
|
process.exit(1);
|
|
@@ -12139,9 +12251,9 @@ var deleteCommand = new Command48().name("delete").alias("rm").description("Dele
|
|
|
12139
12251
|
});
|
|
12140
12252
|
|
|
12141
12253
|
// src/commands/schedule/enable.ts
|
|
12142
|
-
import { Command as
|
|
12143
|
-
import
|
|
12144
|
-
var enableCommand = new
|
|
12254
|
+
import { Command as Command50 } from "commander";
|
|
12255
|
+
import chalk54 from "chalk";
|
|
12256
|
+
var enableCommand = new Command50().name("enable").description("Enable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
12145
12257
|
try {
|
|
12146
12258
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
12147
12259
|
await enableSchedule({
|
|
@@ -12149,34 +12261,34 @@ var enableCommand = new Command49().name("enable").description("Enable a schedul
|
|
|
12149
12261
|
composeId: resolved.composeId
|
|
12150
12262
|
});
|
|
12151
12263
|
console.log(
|
|
12152
|
-
|
|
12264
|
+
chalk54.green(`\u2713 Enabled schedule for agent ${chalk54.cyan(agentName)}`)
|
|
12153
12265
|
);
|
|
12154
12266
|
} catch (error) {
|
|
12155
|
-
console.error(
|
|
12267
|
+
console.error(chalk54.red("\u2717 Failed to enable schedule"));
|
|
12156
12268
|
if (error instanceof ApiRequestError) {
|
|
12157
12269
|
if (error.code === "SCHEDULE_PAST") {
|
|
12158
|
-
console.error(
|
|
12159
|
-
console.error(
|
|
12270
|
+
console.error(chalk54.dim(" Scheduled time has already passed"));
|
|
12271
|
+
console.error(chalk54.dim(` Run: vm0 schedule setup ${agentName}`));
|
|
12160
12272
|
} else if (error.code === "NOT_FOUND") {
|
|
12161
12273
|
console.error(
|
|
12162
|
-
|
|
12274
|
+
chalk54.dim(` No schedule found for agent "${agentName}"`)
|
|
12163
12275
|
);
|
|
12164
|
-
console.error(
|
|
12276
|
+
console.error(chalk54.dim(" Run: vm0 schedule list"));
|
|
12165
12277
|
} else if (error.code === "UNAUTHORIZED") {
|
|
12166
|
-
console.error(
|
|
12278
|
+
console.error(chalk54.dim(" Run: vm0 auth login"));
|
|
12167
12279
|
} else {
|
|
12168
|
-
console.error(
|
|
12280
|
+
console.error(chalk54.dim(` ${error.message}`));
|
|
12169
12281
|
}
|
|
12170
12282
|
} else if (error instanceof Error) {
|
|
12171
12283
|
if (error.message.includes("Not authenticated")) {
|
|
12172
|
-
console.error(
|
|
12284
|
+
console.error(chalk54.dim(" Run: vm0 auth login"));
|
|
12173
12285
|
} else if (error.message.includes("No schedule found")) {
|
|
12174
12286
|
console.error(
|
|
12175
|
-
|
|
12287
|
+
chalk54.dim(` No schedule found for agent "${agentName}"`)
|
|
12176
12288
|
);
|
|
12177
|
-
console.error(
|
|
12289
|
+
console.error(chalk54.dim(" Run: vm0 schedule list"));
|
|
12178
12290
|
} else {
|
|
12179
|
-
console.error(
|
|
12291
|
+
console.error(chalk54.dim(` ${error.message}`));
|
|
12180
12292
|
}
|
|
12181
12293
|
}
|
|
12182
12294
|
process.exit(1);
|
|
@@ -12184,9 +12296,9 @@ var enableCommand = new Command49().name("enable").description("Enable a schedul
|
|
|
12184
12296
|
});
|
|
12185
12297
|
|
|
12186
12298
|
// src/commands/schedule/disable.ts
|
|
12187
|
-
import { Command as
|
|
12188
|
-
import
|
|
12189
|
-
var disableCommand = new
|
|
12299
|
+
import { Command as Command51 } from "commander";
|
|
12300
|
+
import chalk55 from "chalk";
|
|
12301
|
+
var disableCommand = new Command51().name("disable").description("Disable a schedule").argument("<agent-name>", "Agent name").action(async (agentName) => {
|
|
12190
12302
|
try {
|
|
12191
12303
|
const resolved = await resolveScheduleByAgent(agentName);
|
|
12192
12304
|
await disableSchedule({
|
|
@@ -12194,20 +12306,20 @@ var disableCommand = new Command50().name("disable").description("Disable a sche
|
|
|
12194
12306
|
composeId: resolved.composeId
|
|
12195
12307
|
});
|
|
12196
12308
|
console.log(
|
|
12197
|
-
|
|
12309
|
+
chalk55.green(`\u2713 Disabled schedule for agent ${chalk55.cyan(agentName)}`)
|
|
12198
12310
|
);
|
|
12199
12311
|
} catch (error) {
|
|
12200
|
-
console.error(
|
|
12312
|
+
console.error(chalk55.red("\u2717 Failed to disable schedule"));
|
|
12201
12313
|
if (error instanceof Error) {
|
|
12202
12314
|
if (error.message.includes("Not authenticated")) {
|
|
12203
|
-
console.error(
|
|
12315
|
+
console.error(chalk55.dim(" Run: vm0 auth login"));
|
|
12204
12316
|
} else if (error.message.toLowerCase().includes("not found") || error.message.includes("No schedule found")) {
|
|
12205
12317
|
console.error(
|
|
12206
|
-
|
|
12318
|
+
chalk55.dim(` No schedule found for agent "${agentName}"`)
|
|
12207
12319
|
);
|
|
12208
|
-
console.error(
|
|
12320
|
+
console.error(chalk55.dim(" Run: vm0 schedule list"));
|
|
12209
12321
|
} else {
|
|
12210
|
-
console.error(
|
|
12322
|
+
console.error(chalk55.dim(` ${error.message}`));
|
|
12211
12323
|
}
|
|
12212
12324
|
}
|
|
12213
12325
|
process.exit(1);
|
|
@@ -12215,11 +12327,11 @@ var disableCommand = new Command50().name("disable").description("Disable a sche
|
|
|
12215
12327
|
});
|
|
12216
12328
|
|
|
12217
12329
|
// src/commands/schedule/index.ts
|
|
12218
|
-
var scheduleCommand = new
|
|
12330
|
+
var scheduleCommand = new Command52().name("schedule").description("Manage agent schedules").addCommand(setupCommand).addCommand(listCommand5).addCommand(statusCommand6).addCommand(deleteCommand2).addCommand(enableCommand).addCommand(disableCommand);
|
|
12219
12331
|
|
|
12220
12332
|
// src/commands/usage/index.ts
|
|
12221
|
-
import { Command as
|
|
12222
|
-
import
|
|
12333
|
+
import { Command as Command53 } from "commander";
|
|
12334
|
+
import chalk56 from "chalk";
|
|
12223
12335
|
|
|
12224
12336
|
// src/lib/utils/duration-formatter.ts
|
|
12225
12337
|
function formatDuration(ms) {
|
|
@@ -12292,7 +12404,7 @@ function fillMissingDates(daily, startDate, endDate) {
|
|
|
12292
12404
|
result.sort((a, b) => b.date.localeCompare(a.date));
|
|
12293
12405
|
return result;
|
|
12294
12406
|
}
|
|
12295
|
-
var usageCommand = new
|
|
12407
|
+
var usageCommand = new Command53().name("usage").description("View usage statistics").option("--since <date>", "Start date (ISO format or relative: 7d, 30d)").option(
|
|
12296
12408
|
"--until <date>",
|
|
12297
12409
|
"End date (ISO format or relative, defaults to now)"
|
|
12298
12410
|
).action(async (options) => {
|
|
@@ -12306,7 +12418,7 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12306
12418
|
endDate = new Date(untilMs);
|
|
12307
12419
|
} catch {
|
|
12308
12420
|
console.error(
|
|
12309
|
-
|
|
12421
|
+
chalk56.red(
|
|
12310
12422
|
"\u2717 Invalid --until format. Use ISO (2026-01-01) or relative (7d, 30d)"
|
|
12311
12423
|
)
|
|
12312
12424
|
);
|
|
@@ -12321,7 +12433,7 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12321
12433
|
startDate = new Date(sinceMs);
|
|
12322
12434
|
} catch {
|
|
12323
12435
|
console.error(
|
|
12324
|
-
|
|
12436
|
+
chalk56.red(
|
|
12325
12437
|
"\u2717 Invalid --since format. Use ISO (2026-01-01) or relative (7d, 30d)"
|
|
12326
12438
|
)
|
|
12327
12439
|
);
|
|
@@ -12331,13 +12443,13 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12331
12443
|
startDate = new Date(endDate.getTime() - DEFAULT_RANGE_MS);
|
|
12332
12444
|
}
|
|
12333
12445
|
if (startDate >= endDate) {
|
|
12334
|
-
console.error(
|
|
12446
|
+
console.error(chalk56.red("\u2717 --since must be before --until"));
|
|
12335
12447
|
process.exit(1);
|
|
12336
12448
|
}
|
|
12337
12449
|
const rangeMs = endDate.getTime() - startDate.getTime();
|
|
12338
12450
|
if (rangeMs > MAX_RANGE_MS) {
|
|
12339
12451
|
console.error(
|
|
12340
|
-
|
|
12452
|
+
chalk56.red(
|
|
12341
12453
|
"\u2717 Time range exceeds maximum of 30 days. Use --until to specify an end date"
|
|
12342
12454
|
)
|
|
12343
12455
|
);
|
|
@@ -12354,19 +12466,19 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12354
12466
|
);
|
|
12355
12467
|
console.log();
|
|
12356
12468
|
console.log(
|
|
12357
|
-
|
|
12469
|
+
chalk56.bold(
|
|
12358
12470
|
`Usage Summary (${formatDateRange(usage.period.start, usage.period.end)})`
|
|
12359
12471
|
)
|
|
12360
12472
|
);
|
|
12361
12473
|
console.log();
|
|
12362
|
-
console.log(
|
|
12474
|
+
console.log(chalk56.dim("DATE RUNS RUN TIME"));
|
|
12363
12475
|
for (const day of filledDaily) {
|
|
12364
12476
|
const dateDisplay = formatDateDisplay(day.date).padEnd(10);
|
|
12365
12477
|
const runsDisplay = String(day.run_count).padStart(6);
|
|
12366
12478
|
const timeDisplay = formatDuration(day.run_time_ms);
|
|
12367
12479
|
console.log(`${dateDisplay}${runsDisplay} ${timeDisplay}`);
|
|
12368
12480
|
}
|
|
12369
|
-
console.log(
|
|
12481
|
+
console.log(chalk56.dim("\u2500".repeat(29)));
|
|
12370
12482
|
const totalRunsDisplay = String(usage.summary.total_runs).padStart(6);
|
|
12371
12483
|
const totalTimeDisplay = formatDuration(usage.summary.total_run_time_ms);
|
|
12372
12484
|
console.log(
|
|
@@ -12376,72 +12488,72 @@ var usageCommand = new Command52().name("usage").description("View usage statist
|
|
|
12376
12488
|
} catch (error) {
|
|
12377
12489
|
if (error instanceof Error) {
|
|
12378
12490
|
if (error.message.includes("Not authenticated")) {
|
|
12379
|
-
console.error(
|
|
12380
|
-
console.error(
|
|
12491
|
+
console.error(chalk56.red("\u2717 Not authenticated"));
|
|
12492
|
+
console.error(chalk56.dim(" Run: vm0 auth login"));
|
|
12381
12493
|
} else {
|
|
12382
|
-
console.error(
|
|
12494
|
+
console.error(chalk56.red(`\u2717 ${error.message}`));
|
|
12383
12495
|
}
|
|
12384
12496
|
} else {
|
|
12385
|
-
console.error(
|
|
12497
|
+
console.error(chalk56.red("\u2717 An unexpected error occurred"));
|
|
12386
12498
|
}
|
|
12387
12499
|
process.exit(1);
|
|
12388
12500
|
}
|
|
12389
12501
|
});
|
|
12390
12502
|
|
|
12391
12503
|
// src/commands/secret/index.ts
|
|
12392
|
-
import { Command as
|
|
12504
|
+
import { Command as Command57 } from "commander";
|
|
12393
12505
|
|
|
12394
12506
|
// src/commands/secret/list.ts
|
|
12395
|
-
import { Command as
|
|
12396
|
-
import
|
|
12397
|
-
var listCommand6 = new
|
|
12507
|
+
import { Command as Command54 } from "commander";
|
|
12508
|
+
import chalk57 from "chalk";
|
|
12509
|
+
var listCommand6 = new Command54().name("list").alias("ls").description("List all secrets").action(
|
|
12398
12510
|
withErrorHandler(async () => {
|
|
12399
12511
|
const result = await listSecrets();
|
|
12400
12512
|
if (result.secrets.length === 0) {
|
|
12401
|
-
console.log(
|
|
12513
|
+
console.log(chalk57.dim("No secrets found"));
|
|
12402
12514
|
console.log();
|
|
12403
12515
|
console.log("To add a secret:");
|
|
12404
|
-
console.log(
|
|
12516
|
+
console.log(chalk57.cyan(" vm0 secret set MY_API_KEY --body <value>"));
|
|
12405
12517
|
return;
|
|
12406
12518
|
}
|
|
12407
|
-
console.log(
|
|
12519
|
+
console.log(chalk57.bold("Secrets:"));
|
|
12408
12520
|
console.log();
|
|
12409
12521
|
for (const secret of result.secrets) {
|
|
12410
12522
|
let typeIndicator = "";
|
|
12411
12523
|
let derivedLine = null;
|
|
12412
12524
|
if (secret.type === "model-provider") {
|
|
12413
|
-
typeIndicator =
|
|
12525
|
+
typeIndicator = chalk57.dim(" [model-provider]");
|
|
12414
12526
|
} else if (secret.type === "connector") {
|
|
12415
12527
|
const derived = getConnectorDerivedNames(secret.name);
|
|
12416
12528
|
if (derived) {
|
|
12417
|
-
typeIndicator =
|
|
12418
|
-
derivedLine =
|
|
12529
|
+
typeIndicator = chalk57.dim(` [${derived.connectorLabel} connector]`);
|
|
12530
|
+
derivedLine = chalk57.dim(
|
|
12419
12531
|
`Available as: ${derived.envVarNames.join(", ")}`
|
|
12420
12532
|
);
|
|
12421
12533
|
} else {
|
|
12422
|
-
typeIndicator =
|
|
12534
|
+
typeIndicator = chalk57.dim(" [connector]");
|
|
12423
12535
|
}
|
|
12424
12536
|
}
|
|
12425
|
-
console.log(` ${
|
|
12537
|
+
console.log(` ${chalk57.cyan(secret.name)}${typeIndicator}`);
|
|
12426
12538
|
if (derivedLine) {
|
|
12427
12539
|
console.log(` ${derivedLine}`);
|
|
12428
12540
|
}
|
|
12429
12541
|
if (secret.description) {
|
|
12430
|
-
console.log(` ${
|
|
12542
|
+
console.log(` ${chalk57.dim(secret.description)}`);
|
|
12431
12543
|
}
|
|
12432
12544
|
console.log(
|
|
12433
|
-
` ${
|
|
12545
|
+
` ${chalk57.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
12434
12546
|
);
|
|
12435
12547
|
console.log();
|
|
12436
12548
|
}
|
|
12437
|
-
console.log(
|
|
12549
|
+
console.log(chalk57.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
12438
12550
|
})
|
|
12439
12551
|
);
|
|
12440
12552
|
|
|
12441
12553
|
// src/commands/secret/set.ts
|
|
12442
|
-
import { Command as
|
|
12443
|
-
import
|
|
12444
|
-
var setCommand2 = new
|
|
12554
|
+
import { Command as Command55 } from "commander";
|
|
12555
|
+
import chalk58 from "chalk";
|
|
12556
|
+
var setCommand2 = new Command55().name("set").description("Create or update a secret").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
12445
12557
|
"-b, --body <value>",
|
|
12446
12558
|
"Secret value (required in non-interactive mode)"
|
|
12447
12559
|
).option("-d, --description <description>", "Optional description").action(
|
|
@@ -12458,12 +12570,12 @@ var setCommand2 = new Command54().name("set").description("Create or update a se
|
|
|
12458
12570
|
value = prompted;
|
|
12459
12571
|
} else {
|
|
12460
12572
|
console.error(
|
|
12461
|
-
|
|
12573
|
+
chalk58.red("\u2717 --body is required in non-interactive mode")
|
|
12462
12574
|
);
|
|
12463
12575
|
console.error();
|
|
12464
12576
|
console.error("Usage:");
|
|
12465
12577
|
console.error(
|
|
12466
|
-
|
|
12578
|
+
chalk58.cyan(` vm0 secret set ${name} --body "your-secret-value"`)
|
|
12467
12579
|
);
|
|
12468
12580
|
process.exit(1);
|
|
12469
12581
|
}
|
|
@@ -12472,29 +12584,29 @@ var setCommand2 = new Command54().name("set").description("Create or update a se
|
|
|
12472
12584
|
value,
|
|
12473
12585
|
description: options.description
|
|
12474
12586
|
});
|
|
12475
|
-
console.log(
|
|
12587
|
+
console.log(chalk58.green(`\u2713 Secret "${secret.name}" saved`));
|
|
12476
12588
|
console.log();
|
|
12477
12589
|
console.log("Use in vm0.yaml:");
|
|
12478
|
-
console.log(
|
|
12479
|
-
console.log(
|
|
12590
|
+
console.log(chalk58.cyan(` environment:`));
|
|
12591
|
+
console.log(chalk58.cyan(` ${name}: \${{ secrets.${name} }}`));
|
|
12480
12592
|
} catch (error) {
|
|
12481
12593
|
if (error instanceof Error) {
|
|
12482
12594
|
if (error.message.includes("Not authenticated")) {
|
|
12483
12595
|
console.error(
|
|
12484
|
-
|
|
12596
|
+
chalk58.red("\u2717 Not authenticated. Run: vm0 auth login")
|
|
12485
12597
|
);
|
|
12486
12598
|
} else if (error.message.includes("must contain only uppercase")) {
|
|
12487
|
-
console.error(
|
|
12599
|
+
console.error(chalk58.red(`\u2717 ${error.message}`));
|
|
12488
12600
|
console.error();
|
|
12489
12601
|
console.error("Examples of valid secret names:");
|
|
12490
|
-
console.error(
|
|
12491
|
-
console.error(
|
|
12492
|
-
console.error(
|
|
12602
|
+
console.error(chalk58.dim(" MY_API_KEY"));
|
|
12603
|
+
console.error(chalk58.dim(" GITHUB_TOKEN"));
|
|
12604
|
+
console.error(chalk58.dim(" AWS_ACCESS_KEY_ID"));
|
|
12493
12605
|
} else {
|
|
12494
|
-
console.error(
|
|
12606
|
+
console.error(chalk58.red(`\u2717 ${error.message}`));
|
|
12495
12607
|
}
|
|
12496
12608
|
} else {
|
|
12497
|
-
console.error(
|
|
12609
|
+
console.error(chalk58.red("\u2717 An unexpected error occurred"));
|
|
12498
12610
|
}
|
|
12499
12611
|
process.exit(1);
|
|
12500
12612
|
}
|
|
@@ -12502,20 +12614,20 @@ var setCommand2 = new Command54().name("set").description("Create or update a se
|
|
|
12502
12614
|
);
|
|
12503
12615
|
|
|
12504
12616
|
// src/commands/secret/delete.ts
|
|
12505
|
-
import { Command as
|
|
12506
|
-
import
|
|
12507
|
-
var
|
|
12617
|
+
import { Command as Command56 } from "commander";
|
|
12618
|
+
import chalk59 from "chalk";
|
|
12619
|
+
var deleteCommand3 = new Command56().name("delete").description("Delete a secret").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
12508
12620
|
try {
|
|
12509
12621
|
try {
|
|
12510
12622
|
await getSecret(name);
|
|
12511
12623
|
} catch {
|
|
12512
|
-
console.error(
|
|
12624
|
+
console.error(chalk59.red(`\u2717 Secret "${name}" not found`));
|
|
12513
12625
|
process.exit(1);
|
|
12514
12626
|
}
|
|
12515
12627
|
if (!options.yes) {
|
|
12516
12628
|
if (!isInteractive()) {
|
|
12517
12629
|
console.error(
|
|
12518
|
-
|
|
12630
|
+
chalk59.red("\u2717 --yes flag is required in non-interactive mode")
|
|
12519
12631
|
);
|
|
12520
12632
|
process.exit(1);
|
|
12521
12633
|
}
|
|
@@ -12524,72 +12636,72 @@ var deleteCommand2 = new Command55().name("delete").description("Delete a secret
|
|
|
12524
12636
|
false
|
|
12525
12637
|
);
|
|
12526
12638
|
if (!confirmed) {
|
|
12527
|
-
console.log(
|
|
12639
|
+
console.log(chalk59.dim("Cancelled"));
|
|
12528
12640
|
return;
|
|
12529
12641
|
}
|
|
12530
12642
|
}
|
|
12531
12643
|
await deleteSecret(name);
|
|
12532
|
-
console.log(
|
|
12644
|
+
console.log(chalk59.green(`\u2713 Secret "${name}" deleted`));
|
|
12533
12645
|
} catch (error) {
|
|
12534
12646
|
if (error instanceof Error) {
|
|
12535
12647
|
if (error.message.includes("Not authenticated")) {
|
|
12536
|
-
console.error(
|
|
12648
|
+
console.error(chalk59.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12537
12649
|
} else {
|
|
12538
|
-
console.error(
|
|
12650
|
+
console.error(chalk59.red(`\u2717 ${error.message}`));
|
|
12539
12651
|
}
|
|
12540
12652
|
} else {
|
|
12541
|
-
console.error(
|
|
12653
|
+
console.error(chalk59.red("\u2717 An unexpected error occurred"));
|
|
12542
12654
|
}
|
|
12543
12655
|
process.exit(1);
|
|
12544
12656
|
}
|
|
12545
12657
|
});
|
|
12546
12658
|
|
|
12547
12659
|
// src/commands/secret/index.ts
|
|
12548
|
-
var secretCommand = new
|
|
12660
|
+
var secretCommand = new Command57().name("secret").description("Manage stored secrets for agent runs").addCommand(listCommand6).addCommand(setCommand2).addCommand(deleteCommand3);
|
|
12549
12661
|
|
|
12550
12662
|
// src/commands/variable/index.ts
|
|
12551
|
-
import { Command as
|
|
12663
|
+
import { Command as Command61 } from "commander";
|
|
12552
12664
|
|
|
12553
12665
|
// src/commands/variable/list.ts
|
|
12554
|
-
import { Command as
|
|
12555
|
-
import
|
|
12666
|
+
import { Command as Command58 } from "commander";
|
|
12667
|
+
import chalk60 from "chalk";
|
|
12556
12668
|
function truncateValue(value, maxLength = 60) {
|
|
12557
12669
|
if (value.length <= maxLength) {
|
|
12558
12670
|
return value;
|
|
12559
12671
|
}
|
|
12560
12672
|
return value.slice(0, maxLength - 15) + "... [truncated]";
|
|
12561
12673
|
}
|
|
12562
|
-
var listCommand7 = new
|
|
12674
|
+
var listCommand7 = new Command58().name("list").alias("ls").description("List all variables").action(
|
|
12563
12675
|
withErrorHandler(async () => {
|
|
12564
12676
|
const result = await listVariables();
|
|
12565
12677
|
if (result.variables.length === 0) {
|
|
12566
|
-
console.log(
|
|
12678
|
+
console.log(chalk60.dim("No variables found"));
|
|
12567
12679
|
console.log();
|
|
12568
12680
|
console.log("To add a variable:");
|
|
12569
|
-
console.log(
|
|
12681
|
+
console.log(chalk60.cyan(" vm0 variable set MY_VAR <value>"));
|
|
12570
12682
|
return;
|
|
12571
12683
|
}
|
|
12572
|
-
console.log(
|
|
12684
|
+
console.log(chalk60.bold("Variables:"));
|
|
12573
12685
|
console.log();
|
|
12574
12686
|
for (const variable of result.variables) {
|
|
12575
12687
|
const displayValue = truncateValue(variable.value);
|
|
12576
|
-
console.log(` ${
|
|
12688
|
+
console.log(` ${chalk60.cyan(variable.name)} = ${displayValue}`);
|
|
12577
12689
|
if (variable.description) {
|
|
12578
|
-
console.log(` ${
|
|
12690
|
+
console.log(` ${chalk60.dim(variable.description)}`);
|
|
12579
12691
|
}
|
|
12580
12692
|
console.log(
|
|
12581
|
-
` ${
|
|
12693
|
+
` ${chalk60.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
12582
12694
|
);
|
|
12583
12695
|
console.log();
|
|
12584
12696
|
}
|
|
12585
|
-
console.log(
|
|
12697
|
+
console.log(chalk60.dim(`Total: ${result.variables.length} variable(s)`));
|
|
12586
12698
|
})
|
|
12587
12699
|
);
|
|
12588
12700
|
|
|
12589
12701
|
// src/commands/variable/set.ts
|
|
12590
|
-
import { Command as
|
|
12591
|
-
import
|
|
12592
|
-
var setCommand3 = new
|
|
12702
|
+
import { Command as Command59 } from "commander";
|
|
12703
|
+
import chalk61 from "chalk";
|
|
12704
|
+
var setCommand3 = new Command59().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(
|
|
12593
12705
|
async (name, value, options) => {
|
|
12594
12706
|
try {
|
|
12595
12707
|
const variable = await setVariable({
|
|
@@ -12597,29 +12709,29 @@ var setCommand3 = new Command58().name("set").description("Create or update a va
|
|
|
12597
12709
|
value,
|
|
12598
12710
|
description: options.description
|
|
12599
12711
|
});
|
|
12600
|
-
console.log(
|
|
12712
|
+
console.log(chalk61.green(`\u2713 Variable "${variable.name}" saved`));
|
|
12601
12713
|
console.log();
|
|
12602
12714
|
console.log("Use in vm0.yaml:");
|
|
12603
|
-
console.log(
|
|
12604
|
-
console.log(
|
|
12715
|
+
console.log(chalk61.cyan(` environment:`));
|
|
12716
|
+
console.log(chalk61.cyan(` ${name}: \${{ vars.${name} }}`));
|
|
12605
12717
|
} catch (error) {
|
|
12606
12718
|
if (error instanceof Error) {
|
|
12607
12719
|
if (error.message.includes("Not authenticated")) {
|
|
12608
12720
|
console.error(
|
|
12609
|
-
|
|
12721
|
+
chalk61.red("\u2717 Not authenticated. Run: vm0 auth login")
|
|
12610
12722
|
);
|
|
12611
12723
|
} else if (error.message.includes("must contain only uppercase")) {
|
|
12612
|
-
console.error(
|
|
12724
|
+
console.error(chalk61.red(`\u2717 ${error.message}`));
|
|
12613
12725
|
console.error();
|
|
12614
12726
|
console.error("Examples of valid variable names:");
|
|
12615
|
-
console.error(
|
|
12616
|
-
console.error(
|
|
12617
|
-
console.error(
|
|
12727
|
+
console.error(chalk61.dim(" MY_VAR"));
|
|
12728
|
+
console.error(chalk61.dim(" API_URL"));
|
|
12729
|
+
console.error(chalk61.dim(" DEBUG_MODE"));
|
|
12618
12730
|
} else {
|
|
12619
|
-
console.error(
|
|
12731
|
+
console.error(chalk61.red(`\u2717 ${error.message}`));
|
|
12620
12732
|
}
|
|
12621
12733
|
} else {
|
|
12622
|
-
console.error(
|
|
12734
|
+
console.error(chalk61.red("\u2717 An unexpected error occurred"));
|
|
12623
12735
|
}
|
|
12624
12736
|
process.exit(1);
|
|
12625
12737
|
}
|
|
@@ -12627,15 +12739,15 @@ var setCommand3 = new Command58().name("set").description("Create or update a va
|
|
|
12627
12739
|
);
|
|
12628
12740
|
|
|
12629
12741
|
// src/commands/variable/delete.ts
|
|
12630
|
-
import { Command as
|
|
12631
|
-
import
|
|
12632
|
-
var
|
|
12742
|
+
import { Command as Command60 } from "commander";
|
|
12743
|
+
import chalk62 from "chalk";
|
|
12744
|
+
var deleteCommand4 = new Command60().name("delete").description("Delete a variable").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(async (name, options) => {
|
|
12633
12745
|
try {
|
|
12634
12746
|
try {
|
|
12635
12747
|
await getVariable(name);
|
|
12636
12748
|
} catch (error) {
|
|
12637
12749
|
if (error instanceof Error && error.message.toLowerCase().includes("not found")) {
|
|
12638
|
-
console.error(
|
|
12750
|
+
console.error(chalk62.red(`\u2717 Variable "${name}" not found`));
|
|
12639
12751
|
process.exit(1);
|
|
12640
12752
|
}
|
|
12641
12753
|
throw error;
|
|
@@ -12643,7 +12755,7 @@ var deleteCommand3 = new Command59().name("delete").description("Delete a variab
|
|
|
12643
12755
|
if (!options.yes) {
|
|
12644
12756
|
if (!isInteractive()) {
|
|
12645
12757
|
console.error(
|
|
12646
|
-
|
|
12758
|
+
chalk62.red("\u2717 --yes flag is required in non-interactive mode")
|
|
12647
12759
|
);
|
|
12648
12760
|
process.exit(1);
|
|
12649
12761
|
}
|
|
@@ -12652,43 +12764,43 @@ var deleteCommand3 = new Command59().name("delete").description("Delete a variab
|
|
|
12652
12764
|
false
|
|
12653
12765
|
);
|
|
12654
12766
|
if (!confirmed) {
|
|
12655
|
-
console.log(
|
|
12767
|
+
console.log(chalk62.dim("Cancelled"));
|
|
12656
12768
|
return;
|
|
12657
12769
|
}
|
|
12658
12770
|
}
|
|
12659
12771
|
await deleteVariable(name);
|
|
12660
|
-
console.log(
|
|
12772
|
+
console.log(chalk62.green(`\u2713 Variable "${name}" deleted`));
|
|
12661
12773
|
} catch (error) {
|
|
12662
12774
|
if (error instanceof Error) {
|
|
12663
12775
|
if (error.message.includes("Not authenticated")) {
|
|
12664
|
-
console.error(
|
|
12776
|
+
console.error(chalk62.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
12665
12777
|
} else {
|
|
12666
|
-
console.error(
|
|
12778
|
+
console.error(chalk62.red(`\u2717 ${error.message}`));
|
|
12667
12779
|
}
|
|
12668
12780
|
} else {
|
|
12669
|
-
console.error(
|
|
12781
|
+
console.error(chalk62.red("\u2717 An unexpected error occurred"));
|
|
12670
12782
|
}
|
|
12671
12783
|
process.exit(1);
|
|
12672
12784
|
}
|
|
12673
12785
|
});
|
|
12674
12786
|
|
|
12675
12787
|
// src/commands/variable/index.ts
|
|
12676
|
-
var variableCommand = new
|
|
12788
|
+
var variableCommand = new Command61().name("variable").description("Manage stored variables for agent runs").addCommand(listCommand7).addCommand(setCommand3).addCommand(deleteCommand4);
|
|
12677
12789
|
|
|
12678
12790
|
// src/commands/model-provider/index.ts
|
|
12679
|
-
import { Command as
|
|
12791
|
+
import { Command as Command66 } from "commander";
|
|
12680
12792
|
|
|
12681
12793
|
// src/commands/model-provider/list.ts
|
|
12682
|
-
import { Command as
|
|
12683
|
-
import
|
|
12684
|
-
var listCommand8 = new
|
|
12794
|
+
import { Command as Command62 } from "commander";
|
|
12795
|
+
import chalk63 from "chalk";
|
|
12796
|
+
var listCommand8 = new Command62().name("list").alias("ls").description("List all model providers").action(
|
|
12685
12797
|
withErrorHandler(async () => {
|
|
12686
12798
|
const result = await listModelProviders();
|
|
12687
12799
|
if (result.modelProviders.length === 0) {
|
|
12688
|
-
console.log(
|
|
12800
|
+
console.log(chalk63.dim("No model providers configured"));
|
|
12689
12801
|
console.log();
|
|
12690
12802
|
console.log("To add a model provider:");
|
|
12691
|
-
console.log(
|
|
12803
|
+
console.log(chalk63.cyan(" vm0 model-provider setup"));
|
|
12692
12804
|
return;
|
|
12693
12805
|
}
|
|
12694
12806
|
const byFramework = result.modelProviders.reduce(
|
|
@@ -12702,16 +12814,16 @@ var listCommand8 = new Command61().name("list").alias("ls").description("List al
|
|
|
12702
12814
|
},
|
|
12703
12815
|
{}
|
|
12704
12816
|
);
|
|
12705
|
-
console.log(
|
|
12817
|
+
console.log(chalk63.bold("Model Providers:"));
|
|
12706
12818
|
console.log();
|
|
12707
12819
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
12708
|
-
console.log(` ${
|
|
12820
|
+
console.log(` ${chalk63.cyan(framework)}:`);
|
|
12709
12821
|
for (const provider of providers) {
|
|
12710
|
-
const defaultTag = provider.isDefault ?
|
|
12711
|
-
const modelTag = provider.selectedModel ?
|
|
12822
|
+
const defaultTag = provider.isDefault ? chalk63.green(" (default)") : "";
|
|
12823
|
+
const modelTag = provider.selectedModel ? chalk63.dim(` [${provider.selectedModel}]`) : "";
|
|
12712
12824
|
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
12713
12825
|
console.log(
|
|
12714
|
-
|
|
12826
|
+
chalk63.dim(
|
|
12715
12827
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
12716
12828
|
)
|
|
12717
12829
|
);
|
|
@@ -12719,22 +12831,22 @@ var listCommand8 = new Command61().name("list").alias("ls").description("List al
|
|
|
12719
12831
|
console.log();
|
|
12720
12832
|
}
|
|
12721
12833
|
console.log(
|
|
12722
|
-
|
|
12834
|
+
chalk63.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
12723
12835
|
);
|
|
12724
12836
|
})
|
|
12725
12837
|
);
|
|
12726
12838
|
|
|
12727
12839
|
// src/commands/model-provider/setup.ts
|
|
12728
|
-
import { Command as
|
|
12729
|
-
import
|
|
12840
|
+
import { Command as Command63 } from "commander";
|
|
12841
|
+
import chalk64 from "chalk";
|
|
12730
12842
|
import prompts2 from "prompts";
|
|
12731
12843
|
function validateProviderType(typeStr) {
|
|
12732
12844
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
12733
|
-
console.error(
|
|
12845
|
+
console.error(chalk64.red(`\u2717 Invalid type "${typeStr}"`));
|
|
12734
12846
|
console.error();
|
|
12735
12847
|
console.error("Valid types:");
|
|
12736
12848
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
12737
|
-
console.error(` ${
|
|
12849
|
+
console.error(` ${chalk64.cyan(t)} - ${config.label}`);
|
|
12738
12850
|
}
|
|
12739
12851
|
process.exit(1);
|
|
12740
12852
|
}
|
|
@@ -12746,11 +12858,11 @@ function validateModel(type2, modelStr) {
|
|
|
12746
12858
|
return modelStr;
|
|
12747
12859
|
}
|
|
12748
12860
|
if (models && !models.includes(modelStr)) {
|
|
12749
|
-
console.error(
|
|
12861
|
+
console.error(chalk64.red(`\u2717 Invalid model "${modelStr}"`));
|
|
12750
12862
|
console.error();
|
|
12751
12863
|
console.error("Valid models:");
|
|
12752
12864
|
for (const m of models) {
|
|
12753
|
-
console.error(` ${
|
|
12865
|
+
console.error(` ${chalk64.cyan(m)}`);
|
|
12754
12866
|
}
|
|
12755
12867
|
process.exit(1);
|
|
12756
12868
|
}
|
|
@@ -12759,12 +12871,12 @@ function validateModel(type2, modelStr) {
|
|
|
12759
12871
|
function validateAuthMethod(type2, authMethodStr) {
|
|
12760
12872
|
const authMethods = getAuthMethodsForType(type2);
|
|
12761
12873
|
if (!authMethods || !(authMethodStr in authMethods)) {
|
|
12762
|
-
console.error(
|
|
12874
|
+
console.error(chalk64.red(`\u2717 Invalid auth method "${authMethodStr}"`));
|
|
12763
12875
|
console.error();
|
|
12764
12876
|
console.error("Valid auth methods:");
|
|
12765
12877
|
if (authMethods) {
|
|
12766
12878
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
12767
|
-
console.error(` ${
|
|
12879
|
+
console.error(` ${chalk64.cyan(method)} - ${config.label}`);
|
|
12768
12880
|
}
|
|
12769
12881
|
}
|
|
12770
12882
|
process.exit(1);
|
|
@@ -12774,7 +12886,7 @@ function validateAuthMethod(type2, authMethodStr) {
|
|
|
12774
12886
|
function parseSecrets(type2, authMethod, secretArgs) {
|
|
12775
12887
|
const secretsConfig = getSecretsForAuthMethod(type2, authMethod);
|
|
12776
12888
|
if (!secretsConfig) {
|
|
12777
|
-
console.error(
|
|
12889
|
+
console.error(chalk64.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
12778
12890
|
process.exit(1);
|
|
12779
12891
|
}
|
|
12780
12892
|
const secretNames = Object.keys(secretsConfig);
|
|
@@ -12782,19 +12894,19 @@ function parseSecrets(type2, authMethod, secretArgs) {
|
|
|
12782
12894
|
if (secretArgs.length === 1 && firstArg && !firstArg.includes("=")) {
|
|
12783
12895
|
if (secretNames.length !== 1) {
|
|
12784
12896
|
console.error(
|
|
12785
|
-
|
|
12897
|
+
chalk64.red("\u2717 Must use KEY=VALUE format for multi-secret auth methods")
|
|
12786
12898
|
);
|
|
12787
12899
|
console.error();
|
|
12788
12900
|
console.error("Required secrets:");
|
|
12789
12901
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
12790
12902
|
const requiredNote = fieldConfig.required ? " (required)" : "";
|
|
12791
|
-
console.error(` ${
|
|
12903
|
+
console.error(` ${chalk64.cyan(name)}${requiredNote}`);
|
|
12792
12904
|
}
|
|
12793
12905
|
process.exit(1);
|
|
12794
12906
|
}
|
|
12795
12907
|
const firstSecretName = secretNames[0];
|
|
12796
12908
|
if (!firstSecretName) {
|
|
12797
|
-
console.error(
|
|
12909
|
+
console.error(chalk64.red("\u2717 No secrets defined for this auth method"));
|
|
12798
12910
|
process.exit(1);
|
|
12799
12911
|
}
|
|
12800
12912
|
return { [firstSecretName]: firstArg };
|
|
@@ -12803,7 +12915,7 @@ function parseSecrets(type2, authMethod, secretArgs) {
|
|
|
12803
12915
|
for (const arg of secretArgs) {
|
|
12804
12916
|
const eqIndex = arg.indexOf("=");
|
|
12805
12917
|
if (eqIndex === -1) {
|
|
12806
|
-
console.error(
|
|
12918
|
+
console.error(chalk64.red(`\u2717 Invalid secret format "${arg}"`));
|
|
12807
12919
|
console.error();
|
|
12808
12920
|
console.error("Use KEY=VALUE format (e.g., AWS_REGION=us-east-1)");
|
|
12809
12921
|
process.exit(1);
|
|
@@ -12817,17 +12929,17 @@ function parseSecrets(type2, authMethod, secretArgs) {
|
|
|
12817
12929
|
function validateSecrets(type2, authMethod, secrets) {
|
|
12818
12930
|
const secretsConfig = getSecretsForAuthMethod(type2, authMethod);
|
|
12819
12931
|
if (!secretsConfig) {
|
|
12820
|
-
console.error(
|
|
12932
|
+
console.error(chalk64.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
12821
12933
|
process.exit(1);
|
|
12822
12934
|
}
|
|
12823
12935
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
12824
12936
|
if (fieldConfig.required && !secrets[name]) {
|
|
12825
|
-
console.error(
|
|
12937
|
+
console.error(chalk64.red(`\u2717 Missing required secret: ${name}`));
|
|
12826
12938
|
console.error();
|
|
12827
12939
|
console.error("Required secrets:");
|
|
12828
12940
|
for (const [n, fc] of Object.entries(secretsConfig)) {
|
|
12829
12941
|
if (fc.required) {
|
|
12830
|
-
console.error(` ${
|
|
12942
|
+
console.error(` ${chalk64.cyan(n)} - ${fc.label}`);
|
|
12831
12943
|
}
|
|
12832
12944
|
}
|
|
12833
12945
|
process.exit(1);
|
|
@@ -12835,12 +12947,12 @@ function validateSecrets(type2, authMethod, secrets) {
|
|
|
12835
12947
|
}
|
|
12836
12948
|
for (const name of Object.keys(secrets)) {
|
|
12837
12949
|
if (!(name in secretsConfig)) {
|
|
12838
|
-
console.error(
|
|
12950
|
+
console.error(chalk64.red(`\u2717 Unknown secret: ${name}`));
|
|
12839
12951
|
console.error();
|
|
12840
12952
|
console.error("Valid secrets:");
|
|
12841
12953
|
for (const [n, fc] of Object.entries(secretsConfig)) {
|
|
12842
12954
|
const requiredNote = fc.required ? " (required)" : " (optional)";
|
|
12843
|
-
console.error(` ${
|
|
12955
|
+
console.error(` ${chalk64.cyan(n)}${requiredNote}`);
|
|
12844
12956
|
}
|
|
12845
12957
|
process.exit(1);
|
|
12846
12958
|
}
|
|
@@ -12863,7 +12975,7 @@ function handleNonInteractiveMode(options) {
|
|
|
12863
12975
|
const defaultAuthMethod = getDefaultAuthMethod(type2);
|
|
12864
12976
|
const authMethods = getAuthMethodsForType(type2);
|
|
12865
12977
|
if (!defaultAuthMethod || !authMethods) {
|
|
12866
|
-
console.error(
|
|
12978
|
+
console.error(chalk64.red(`\u2717 Provider "${type2}" requires --auth-method`));
|
|
12867
12979
|
process.exit(1);
|
|
12868
12980
|
}
|
|
12869
12981
|
const authMethodNames = Object.keys(authMethods);
|
|
@@ -12871,7 +12983,7 @@ function handleNonInteractiveMode(options) {
|
|
|
12871
12983
|
authMethod = authMethodNames[0];
|
|
12872
12984
|
} else {
|
|
12873
12985
|
console.error(
|
|
12874
|
-
|
|
12986
|
+
chalk64.red(
|
|
12875
12987
|
`\u2717 --auth-method is required for "${type2}" (multiple auth methods available)`
|
|
12876
12988
|
)
|
|
12877
12989
|
);
|
|
@@ -12880,13 +12992,13 @@ function handleNonInteractiveMode(options) {
|
|
|
12880
12992
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
12881
12993
|
const defaultNote = method === defaultAuthMethod ? " (default)" : "";
|
|
12882
12994
|
console.error(
|
|
12883
|
-
` ${
|
|
12995
|
+
` ${chalk64.cyan(method)} - ${config.label}${defaultNote}`
|
|
12884
12996
|
);
|
|
12885
12997
|
}
|
|
12886
12998
|
console.error();
|
|
12887
12999
|
console.error("Example:");
|
|
12888
13000
|
console.error(
|
|
12889
|
-
|
|
13001
|
+
chalk64.cyan(
|
|
12890
13002
|
` vm0 model-provider setup --type ${type2} --auth-method ${authMethodNames[0]} --secret KEY=VALUE`
|
|
12891
13003
|
)
|
|
12892
13004
|
);
|
|
@@ -12906,7 +13018,7 @@ function handleNonInteractiveMode(options) {
|
|
|
12906
13018
|
const secretArgs = options.secret;
|
|
12907
13019
|
const firstArg = secretArgs[0];
|
|
12908
13020
|
if (!firstArg) {
|
|
12909
|
-
console.error(
|
|
13021
|
+
console.error(chalk64.red("\u2717 Secret is required"));
|
|
12910
13022
|
process.exit(1);
|
|
12911
13023
|
}
|
|
12912
13024
|
let secret;
|
|
@@ -12955,7 +13067,7 @@ async function promptForModelSelection(type2) {
|
|
|
12955
13067
|
if (selected === "__custom__") {
|
|
12956
13068
|
const placeholder = getCustomModelPlaceholder(type2);
|
|
12957
13069
|
if (placeholder) {
|
|
12958
|
-
console.log(
|
|
13070
|
+
console.log(chalk64.dim(`Example: ${placeholder}`));
|
|
12959
13071
|
}
|
|
12960
13072
|
const customResponse = await prompts2(
|
|
12961
13073
|
{
|
|
@@ -13000,13 +13112,13 @@ function isSensitiveSecret(name) {
|
|
|
13000
13112
|
async function promptForSecrets(type2, authMethod) {
|
|
13001
13113
|
const secretsConfig = getSecretsForAuthMethod(type2, authMethod);
|
|
13002
13114
|
if (!secretsConfig) {
|
|
13003
|
-
console.error(
|
|
13115
|
+
console.error(chalk64.red(`\u2717 Invalid auth method "${authMethod}"`));
|
|
13004
13116
|
process.exit(1);
|
|
13005
13117
|
}
|
|
13006
13118
|
const secrets = {};
|
|
13007
13119
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
13008
13120
|
if (fieldConfig.helpText) {
|
|
13009
|
-
console.log(
|
|
13121
|
+
console.log(chalk64.dim(fieldConfig.helpText));
|
|
13010
13122
|
}
|
|
13011
13123
|
const isSensitive = isSensitiveSecret(name);
|
|
13012
13124
|
const placeholder = "placeholder" in fieldConfig ? fieldConfig.placeholder : "";
|
|
@@ -13041,11 +13153,11 @@ async function promptForSecrets(type2, authMethod) {
|
|
|
13041
13153
|
}
|
|
13042
13154
|
async function handleInteractiveMode() {
|
|
13043
13155
|
if (!isInteractive()) {
|
|
13044
|
-
console.error(
|
|
13156
|
+
console.error(chalk64.red("\u2717 Interactive mode requires a TTY"));
|
|
13045
13157
|
console.error();
|
|
13046
13158
|
console.error("Use non-interactive mode:");
|
|
13047
13159
|
console.error(
|
|
13048
|
-
|
|
13160
|
+
chalk64.cyan(' vm0 model-provider setup --type <type> --secret "<value>"')
|
|
13049
13161
|
);
|
|
13050
13162
|
process.exit(1);
|
|
13051
13163
|
}
|
|
@@ -13060,7 +13172,7 @@ async function handleInteractiveMode() {
|
|
|
13060
13172
|
title = `${title} \u2713`;
|
|
13061
13173
|
}
|
|
13062
13174
|
if (isExperimental) {
|
|
13063
|
-
title = `${title} ${
|
|
13175
|
+
title = `${title} ${chalk64.dim("(experimental)")}`;
|
|
13064
13176
|
}
|
|
13065
13177
|
return {
|
|
13066
13178
|
title,
|
|
@@ -13107,7 +13219,7 @@ async function handleInteractiveMode() {
|
|
|
13107
13219
|
}
|
|
13108
13220
|
const config = MODEL_PROVIDER_TYPES[type2];
|
|
13109
13221
|
console.log();
|
|
13110
|
-
console.log(
|
|
13222
|
+
console.log(chalk64.dim(config.helpText));
|
|
13111
13223
|
console.log();
|
|
13112
13224
|
if (hasAuthMethods(type2)) {
|
|
13113
13225
|
const authMethod = await promptForAuthMethod(type2);
|
|
@@ -13148,13 +13260,13 @@ async function promptSetAsDefault(type2, framework, isDefault) {
|
|
|
13148
13260
|
);
|
|
13149
13261
|
if (response.setDefault) {
|
|
13150
13262
|
await setModelProviderDefault(type2);
|
|
13151
|
-
console.log(
|
|
13263
|
+
console.log(chalk64.green(`\u2713 Default for ${framework} set to "${type2}"`));
|
|
13152
13264
|
}
|
|
13153
13265
|
}
|
|
13154
13266
|
function collectSecrets(value, previous) {
|
|
13155
13267
|
return previous.concat([value]);
|
|
13156
13268
|
}
|
|
13157
|
-
var setupCommand2 = new
|
|
13269
|
+
var setupCommand2 = new Command63().name("setup").description("Configure a model provider").option("-t, --type <type>", "Provider type (for non-interactive mode)").option(
|
|
13158
13270
|
"-s, --secret <value>",
|
|
13159
13271
|
"Secret value (can be used multiple times, supports VALUE or KEY=VALUE format)",
|
|
13160
13272
|
collectSecrets,
|
|
@@ -13175,7 +13287,7 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13175
13287
|
model: options.model
|
|
13176
13288
|
});
|
|
13177
13289
|
} else if (options.type || secretArgs.length > 0) {
|
|
13178
|
-
console.error(
|
|
13290
|
+
console.error(chalk64.red("\u2717 Both --type and --secret are required"));
|
|
13179
13291
|
process.exit(1);
|
|
13180
13292
|
} else {
|
|
13181
13293
|
const result = await handleInteractiveMode();
|
|
@@ -13193,11 +13305,11 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13193
13305
|
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
13194
13306
|
if (!hasModelSelection(input.type)) {
|
|
13195
13307
|
console.log(
|
|
13196
|
-
|
|
13308
|
+
chalk64.green(`\u2713 Model provider "${input.type}" unchanged`)
|
|
13197
13309
|
);
|
|
13198
13310
|
} else {
|
|
13199
13311
|
console.log(
|
|
13200
|
-
|
|
13312
|
+
chalk64.green(
|
|
13201
13313
|
`\u2713 Model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
13202
13314
|
)
|
|
13203
13315
|
);
|
|
@@ -13222,7 +13334,7 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13222
13334
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
13223
13335
|
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
13224
13336
|
console.log(
|
|
13225
|
-
|
|
13337
|
+
chalk64.green(
|
|
13226
13338
|
`\u2713 Model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
13227
13339
|
)
|
|
13228
13340
|
);
|
|
@@ -13238,82 +13350,82 @@ var setupCommand2 = new Command62().name("setup").description("Configure a model
|
|
|
13238
13350
|
);
|
|
13239
13351
|
|
|
13240
13352
|
// src/commands/model-provider/delete.ts
|
|
13241
|
-
import { Command as
|
|
13242
|
-
import
|
|
13243
|
-
var
|
|
13353
|
+
import { Command as Command64 } from "commander";
|
|
13354
|
+
import chalk65 from "chalk";
|
|
13355
|
+
var deleteCommand5 = new Command64().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(async (type2) => {
|
|
13244
13356
|
try {
|
|
13245
13357
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
13246
|
-
console.error(
|
|
13358
|
+
console.error(chalk65.red(`\u2717 Invalid type "${type2}"`));
|
|
13247
13359
|
console.log();
|
|
13248
13360
|
console.log("Valid types:");
|
|
13249
13361
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
13250
|
-
console.log(` ${
|
|
13362
|
+
console.log(` ${chalk65.cyan(t)} - ${config.label}`);
|
|
13251
13363
|
}
|
|
13252
13364
|
process.exit(1);
|
|
13253
13365
|
}
|
|
13254
13366
|
await deleteModelProvider(type2);
|
|
13255
|
-
console.log(
|
|
13367
|
+
console.log(chalk65.green(`\u2713 Model provider "${type2}" deleted`));
|
|
13256
13368
|
} catch (error) {
|
|
13257
13369
|
if (error instanceof Error) {
|
|
13258
13370
|
if (error.message.includes("not found")) {
|
|
13259
|
-
console.error(
|
|
13371
|
+
console.error(chalk65.red(`\u2717 Model provider "${type2}" not found`));
|
|
13260
13372
|
} else if (error.message.includes("Not authenticated")) {
|
|
13261
|
-
console.error(
|
|
13373
|
+
console.error(chalk65.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13262
13374
|
} else {
|
|
13263
|
-
console.error(
|
|
13375
|
+
console.error(chalk65.red(`\u2717 ${error.message}`));
|
|
13264
13376
|
}
|
|
13265
13377
|
} else {
|
|
13266
|
-
console.error(
|
|
13378
|
+
console.error(chalk65.red("\u2717 An unexpected error occurred"));
|
|
13267
13379
|
}
|
|
13268
13380
|
process.exit(1);
|
|
13269
13381
|
}
|
|
13270
13382
|
});
|
|
13271
13383
|
|
|
13272
13384
|
// src/commands/model-provider/set-default.ts
|
|
13273
|
-
import { Command as
|
|
13274
|
-
import
|
|
13275
|
-
var setDefaultCommand = new
|
|
13385
|
+
import { Command as Command65 } from "commander";
|
|
13386
|
+
import chalk66 from "chalk";
|
|
13387
|
+
var setDefaultCommand = new Command65().name("set-default").description("Set a model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(async (type2) => {
|
|
13276
13388
|
try {
|
|
13277
13389
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
13278
|
-
console.error(
|
|
13390
|
+
console.error(chalk66.red(`\u2717 Invalid type "${type2}"`));
|
|
13279
13391
|
console.log();
|
|
13280
13392
|
console.log("Valid types:");
|
|
13281
13393
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
13282
|
-
console.log(` ${
|
|
13394
|
+
console.log(` ${chalk66.cyan(t)} - ${config.label}`);
|
|
13283
13395
|
}
|
|
13284
13396
|
process.exit(1);
|
|
13285
13397
|
}
|
|
13286
13398
|
const provider = await setModelProviderDefault(type2);
|
|
13287
13399
|
console.log(
|
|
13288
|
-
|
|
13400
|
+
chalk66.green(
|
|
13289
13401
|
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
13290
13402
|
)
|
|
13291
13403
|
);
|
|
13292
13404
|
} catch (error) {
|
|
13293
13405
|
if (error instanceof Error) {
|
|
13294
13406
|
if (error.message.includes("not found")) {
|
|
13295
|
-
console.error(
|
|
13407
|
+
console.error(chalk66.red(`\u2717 Model provider "${type2}" not found`));
|
|
13296
13408
|
} else if (error.message.includes("Not authenticated")) {
|
|
13297
|
-
console.error(
|
|
13409
|
+
console.error(chalk66.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13298
13410
|
} else {
|
|
13299
|
-
console.error(
|
|
13411
|
+
console.error(chalk66.red(`\u2717 ${error.message}`));
|
|
13300
13412
|
}
|
|
13301
13413
|
} else {
|
|
13302
|
-
console.error(
|
|
13414
|
+
console.error(chalk66.red("\u2717 An unexpected error occurred"));
|
|
13303
13415
|
}
|
|
13304
13416
|
process.exit(1);
|
|
13305
13417
|
}
|
|
13306
13418
|
});
|
|
13307
13419
|
|
|
13308
13420
|
// src/commands/model-provider/index.ts
|
|
13309
|
-
var modelProviderCommand = new
|
|
13421
|
+
var modelProviderCommand = new Command66().name("model-provider").description("Manage model providers for agent runs").addCommand(listCommand8).addCommand(setupCommand2).addCommand(deleteCommand5).addCommand(setDefaultCommand);
|
|
13310
13422
|
|
|
13311
13423
|
// src/commands/connector/index.ts
|
|
13312
|
-
import { Command as
|
|
13424
|
+
import { Command as Command71 } from "commander";
|
|
13313
13425
|
|
|
13314
13426
|
// src/commands/connector/connect.ts
|
|
13315
|
-
import { Command as
|
|
13316
|
-
import
|
|
13427
|
+
import { Command as Command67 } from "commander";
|
|
13428
|
+
import chalk67 from "chalk";
|
|
13317
13429
|
import { initClient as initClient12 } from "@ts-rest/core";
|
|
13318
13430
|
function delay2(ms) {
|
|
13319
13431
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -13332,18 +13444,18 @@ async function getHeaders2() {
|
|
|
13332
13444
|
}
|
|
13333
13445
|
return headers;
|
|
13334
13446
|
}
|
|
13335
|
-
var connectCommand = new
|
|
13447
|
+
var connectCommand = new Command67().name("connect").description("Connect a third-party service (e.g., GitHub)").argument("<type>", "Connector type (e.g., github)").action(async (type2) => {
|
|
13336
13448
|
try {
|
|
13337
13449
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
13338
13450
|
if (!parseResult.success) {
|
|
13339
|
-
console.error(
|
|
13451
|
+
console.error(chalk67.red(`\u2717 Unknown connector type: ${type2}`));
|
|
13340
13452
|
console.error("Available connectors: github");
|
|
13341
13453
|
process.exit(1);
|
|
13342
13454
|
}
|
|
13343
13455
|
const connectorType = parseResult.data;
|
|
13344
13456
|
const apiUrl = await getApiUrl();
|
|
13345
13457
|
const headers = await getHeaders2();
|
|
13346
|
-
console.log(`Connecting ${
|
|
13458
|
+
console.log(`Connecting ${chalk67.cyan(type2)}...`);
|
|
13347
13459
|
const sessionsClient = initClient12(connectorSessionsContract, {
|
|
13348
13460
|
baseUrl: apiUrl,
|
|
13349
13461
|
baseHeaders: headers,
|
|
@@ -13356,14 +13468,14 @@ var connectCommand = new Command66().name("connect").description("Connect a thir
|
|
|
13356
13468
|
if (createResult.status !== 200) {
|
|
13357
13469
|
const errorBody = createResult.body;
|
|
13358
13470
|
console.error(
|
|
13359
|
-
|
|
13471
|
+
chalk67.red(`\u2717 Failed to create session: ${errorBody.error?.message}`)
|
|
13360
13472
|
);
|
|
13361
13473
|
process.exit(1);
|
|
13362
13474
|
}
|
|
13363
13475
|
const session = createResult.body;
|
|
13364
13476
|
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
13365
|
-
console.log(
|
|
13366
|
-
console.log(
|
|
13477
|
+
console.log(chalk67.green("\nSession created"));
|
|
13478
|
+
console.log(chalk67.cyan(`
|
|
13367
13479
|
To connect, visit: ${verificationUrl}`));
|
|
13368
13480
|
console.log(
|
|
13369
13481
|
`
|
|
@@ -13390,7 +13502,7 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
13390
13502
|
if (statusResult.status !== 200) {
|
|
13391
13503
|
const errorBody = statusResult.body;
|
|
13392
13504
|
console.error(
|
|
13393
|
-
|
|
13505
|
+
chalk67.red(
|
|
13394
13506
|
`
|
|
13395
13507
|
\u2717 Failed to check status: ${errorBody.error?.message}`
|
|
13396
13508
|
)
|
|
@@ -13400,17 +13512,17 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
13400
13512
|
const status = statusResult.body;
|
|
13401
13513
|
switch (status.status) {
|
|
13402
13514
|
case "complete":
|
|
13403
|
-
console.log(
|
|
13515
|
+
console.log(chalk67.green(`
|
|
13404
13516
|
|
|
13405
13517
|
${type2} connected successfully!`));
|
|
13406
13518
|
return;
|
|
13407
13519
|
case "expired":
|
|
13408
|
-
console.error(
|
|
13520
|
+
console.error(chalk67.red("\n\u2717 Session expired, please try again"));
|
|
13409
13521
|
process.exit(1);
|
|
13410
13522
|
break;
|
|
13411
13523
|
case "error":
|
|
13412
13524
|
console.error(
|
|
13413
|
-
|
|
13525
|
+
chalk67.red(
|
|
13414
13526
|
`
|
|
13415
13527
|
\u2717 Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
13416
13528
|
)
|
|
@@ -13418,29 +13530,29 @@ ${type2} connected successfully!`));
|
|
|
13418
13530
|
process.exit(1);
|
|
13419
13531
|
break;
|
|
13420
13532
|
case "pending":
|
|
13421
|
-
process.stdout.write(
|
|
13533
|
+
process.stdout.write(chalk67.dim("."));
|
|
13422
13534
|
break;
|
|
13423
13535
|
}
|
|
13424
13536
|
}
|
|
13425
|
-
console.error(
|
|
13537
|
+
console.error(chalk67.red("\n\u2717 Session timed out, please try again"));
|
|
13426
13538
|
process.exit(1);
|
|
13427
13539
|
} catch (error) {
|
|
13428
13540
|
if (error instanceof Error) {
|
|
13429
|
-
console.error(
|
|
13541
|
+
console.error(chalk67.red(`\u2717 ${error.message}`));
|
|
13430
13542
|
if (error.cause instanceof Error) {
|
|
13431
|
-
console.error(
|
|
13543
|
+
console.error(chalk67.dim(` Cause: ${error.cause.message}`));
|
|
13432
13544
|
}
|
|
13433
13545
|
} else {
|
|
13434
|
-
console.error(
|
|
13546
|
+
console.error(chalk67.red("\u2717 An unexpected error occurred"));
|
|
13435
13547
|
}
|
|
13436
13548
|
process.exit(1);
|
|
13437
13549
|
}
|
|
13438
13550
|
});
|
|
13439
13551
|
|
|
13440
13552
|
// src/commands/connector/list.ts
|
|
13441
|
-
import { Command as
|
|
13442
|
-
import
|
|
13443
|
-
var listCommand9 = new
|
|
13553
|
+
import { Command as Command68 } from "commander";
|
|
13554
|
+
import chalk68 from "chalk";
|
|
13555
|
+
var listCommand9 = new Command68().name("list").alias("ls").description("List all connectors and their status").action(
|
|
13444
13556
|
withErrorHandler(async () => {
|
|
13445
13557
|
const result = await listConnectors();
|
|
13446
13558
|
const connectedMap = new Map(result.connectors.map((c24) => [c24.type, c24]));
|
|
@@ -13453,42 +13565,42 @@ var listCommand9 = new Command67().name("list").alias("ls").description("List al
|
|
|
13453
13565
|
statusText.padEnd(statusWidth),
|
|
13454
13566
|
"ACCOUNT"
|
|
13455
13567
|
].join(" ");
|
|
13456
|
-
console.log(
|
|
13568
|
+
console.log(chalk68.dim(header));
|
|
13457
13569
|
for (const type2 of allTypes) {
|
|
13458
13570
|
const connector = connectedMap.get(type2);
|
|
13459
|
-
const status = connector ?
|
|
13460
|
-
const account = connector?.externalUsername ? `@${connector.externalUsername}` :
|
|
13571
|
+
const status = connector ? chalk68.green("\u2713".padEnd(statusWidth)) : chalk68.dim("-".padEnd(statusWidth));
|
|
13572
|
+
const account = connector?.externalUsername ? `@${connector.externalUsername}` : chalk68.dim("-");
|
|
13461
13573
|
const row = [type2.padEnd(typeWidth), status, account].join(" ");
|
|
13462
13574
|
console.log(row);
|
|
13463
13575
|
}
|
|
13464
13576
|
console.log();
|
|
13465
|
-
console.log(
|
|
13466
|
-
console.log(
|
|
13577
|
+
console.log(chalk68.dim("To connect a service:"));
|
|
13578
|
+
console.log(chalk68.dim(" vm0 connector connect <type>"));
|
|
13467
13579
|
})
|
|
13468
13580
|
);
|
|
13469
13581
|
|
|
13470
13582
|
// src/commands/connector/status.ts
|
|
13471
|
-
import { Command as
|
|
13472
|
-
import
|
|
13583
|
+
import { Command as Command69 } from "commander";
|
|
13584
|
+
import chalk69 from "chalk";
|
|
13473
13585
|
var LABEL_WIDTH = 16;
|
|
13474
|
-
var statusCommand7 = new
|
|
13586
|
+
var statusCommand7 = new Command69().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").action(
|
|
13475
13587
|
withErrorHandler(async (type2) => {
|
|
13476
13588
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
13477
13589
|
if (!parseResult.success) {
|
|
13478
|
-
console.error(
|
|
13590
|
+
console.error(chalk69.red(`\u2717 Unknown connector type: ${type2}`));
|
|
13479
13591
|
console.error();
|
|
13480
13592
|
console.error("Available connectors:");
|
|
13481
13593
|
for (const [t, config] of Object.entries(CONNECTOR_TYPES)) {
|
|
13482
|
-
console.error(` ${
|
|
13594
|
+
console.error(` ${chalk69.cyan(t)} - ${config.label}`);
|
|
13483
13595
|
}
|
|
13484
13596
|
process.exit(1);
|
|
13485
13597
|
}
|
|
13486
13598
|
const connector = await getConnector(parseResult.data);
|
|
13487
|
-
console.log(`Connector: ${
|
|
13599
|
+
console.log(`Connector: ${chalk69.cyan(type2)}`);
|
|
13488
13600
|
console.log();
|
|
13489
13601
|
if (connector) {
|
|
13490
13602
|
console.log(
|
|
13491
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
13603
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk69.green("connected")}`
|
|
13492
13604
|
);
|
|
13493
13605
|
console.log(
|
|
13494
13606
|
`${"Account:".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`
|
|
@@ -13510,78 +13622,78 @@ var statusCommand7 = new Command68().name("status").description("Show detailed s
|
|
|
13510
13622
|
);
|
|
13511
13623
|
}
|
|
13512
13624
|
console.log();
|
|
13513
|
-
console.log(
|
|
13514
|
-
console.log(
|
|
13625
|
+
console.log(chalk69.dim("To disconnect:"));
|
|
13626
|
+
console.log(chalk69.dim(` vm0 connector disconnect ${type2}`));
|
|
13515
13627
|
} else {
|
|
13516
13628
|
console.log(
|
|
13517
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
13629
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk69.dim("not connected")}`
|
|
13518
13630
|
);
|
|
13519
13631
|
console.log();
|
|
13520
|
-
console.log(
|
|
13521
|
-
console.log(
|
|
13632
|
+
console.log(chalk69.dim("To connect:"));
|
|
13633
|
+
console.log(chalk69.dim(` vm0 connector connect ${type2}`));
|
|
13522
13634
|
}
|
|
13523
13635
|
})
|
|
13524
13636
|
);
|
|
13525
13637
|
|
|
13526
13638
|
// src/commands/connector/disconnect.ts
|
|
13527
|
-
import { Command as
|
|
13528
|
-
import
|
|
13529
|
-
var disconnectCommand = new
|
|
13639
|
+
import { Command as Command70 } from "commander";
|
|
13640
|
+
import chalk70 from "chalk";
|
|
13641
|
+
var disconnectCommand = new Command70().name("disconnect").description("Disconnect a third-party service").argument("<type>", "Connector type to disconnect (e.g., github)").action(async (type2) => {
|
|
13530
13642
|
try {
|
|
13531
13643
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
13532
13644
|
if (!parseResult.success) {
|
|
13533
|
-
console.error(
|
|
13645
|
+
console.error(chalk70.red(`\u2717 Unknown connector type: ${type2}`));
|
|
13534
13646
|
console.error();
|
|
13535
13647
|
console.error("Available connectors:");
|
|
13536
13648
|
for (const [t, config] of Object.entries(CONNECTOR_TYPES)) {
|
|
13537
|
-
console.error(` ${
|
|
13649
|
+
console.error(` ${chalk70.cyan(t)} - ${config.label}`);
|
|
13538
13650
|
}
|
|
13539
13651
|
process.exit(1);
|
|
13540
13652
|
}
|
|
13541
13653
|
await deleteConnector(parseResult.data);
|
|
13542
|
-
console.log(
|
|
13654
|
+
console.log(chalk70.green(`\u2713 Disconnected ${type2}`));
|
|
13543
13655
|
} catch (error) {
|
|
13544
13656
|
if (error instanceof Error) {
|
|
13545
13657
|
if (error.message.includes("not found")) {
|
|
13546
|
-
console.error(
|
|
13658
|
+
console.error(chalk70.red(`\u2717 Connector "${type2}" is not connected`));
|
|
13547
13659
|
} else if (error.message.includes("Not authenticated")) {
|
|
13548
|
-
console.error(
|
|
13660
|
+
console.error(chalk70.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13549
13661
|
} else {
|
|
13550
|
-
console.error(
|
|
13662
|
+
console.error(chalk70.red(`\u2717 ${error.message}`));
|
|
13551
13663
|
if (error.cause instanceof Error) {
|
|
13552
|
-
console.error(
|
|
13664
|
+
console.error(chalk70.dim(` Cause: ${error.cause.message}`));
|
|
13553
13665
|
}
|
|
13554
13666
|
}
|
|
13555
13667
|
} else {
|
|
13556
|
-
console.error(
|
|
13668
|
+
console.error(chalk70.red("\u2717 An unexpected error occurred"));
|
|
13557
13669
|
}
|
|
13558
13670
|
process.exit(1);
|
|
13559
13671
|
}
|
|
13560
13672
|
});
|
|
13561
13673
|
|
|
13562
13674
|
// src/commands/connector/index.ts
|
|
13563
|
-
var connectorCommand = new
|
|
13675
|
+
var connectorCommand = new Command71().name("connector").description("Manage third-party service connections").addCommand(listCommand9).addCommand(statusCommand7).addCommand(connectCommand).addCommand(disconnectCommand);
|
|
13564
13676
|
|
|
13565
13677
|
// src/commands/onboard/index.ts
|
|
13566
|
-
import { Command as
|
|
13567
|
-
import
|
|
13678
|
+
import { Command as Command72 } from "commander";
|
|
13679
|
+
import chalk74 from "chalk";
|
|
13568
13680
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
13569
13681
|
import { existsSync as existsSync12 } from "fs";
|
|
13570
13682
|
|
|
13571
13683
|
// src/lib/ui/welcome-box.ts
|
|
13572
|
-
import
|
|
13684
|
+
import chalk71 from "chalk";
|
|
13573
13685
|
var gradientColors = [
|
|
13574
|
-
|
|
13686
|
+
chalk71.hex("#FFAB5E"),
|
|
13575
13687
|
// Line 1 - lightest
|
|
13576
|
-
|
|
13688
|
+
chalk71.hex("#FF9642"),
|
|
13577
13689
|
// Line 2
|
|
13578
|
-
|
|
13690
|
+
chalk71.hex("#FF8228"),
|
|
13579
13691
|
// Line 3
|
|
13580
|
-
|
|
13692
|
+
chalk71.hex("#FF6D0A"),
|
|
13581
13693
|
// Line 4
|
|
13582
|
-
|
|
13694
|
+
chalk71.hex("#E85D00"),
|
|
13583
13695
|
// Line 5
|
|
13584
|
-
|
|
13696
|
+
chalk71.hex("#CC4E00")
|
|
13585
13697
|
// Line 6 - darkest
|
|
13586
13698
|
];
|
|
13587
13699
|
var vm0LogoLines = [
|
|
@@ -13603,15 +13715,15 @@ function renderVm0Banner() {
|
|
|
13603
13715
|
function renderOnboardWelcome() {
|
|
13604
13716
|
renderVm0Banner();
|
|
13605
13717
|
console.log(` Build agentic workflows using natural language.`);
|
|
13606
|
-
console.log(` ${
|
|
13718
|
+
console.log(` ${chalk71.dim("Currently in beta, enjoy it free")}`);
|
|
13607
13719
|
console.log(
|
|
13608
|
-
` ${
|
|
13720
|
+
` ${chalk71.dim("Star us on GitHub: https://github.com/vm0-ai/vm0")}`
|
|
13609
13721
|
);
|
|
13610
13722
|
console.log();
|
|
13611
13723
|
}
|
|
13612
13724
|
|
|
13613
13725
|
// src/lib/ui/step-runner.ts
|
|
13614
|
-
import
|
|
13726
|
+
import chalk72 from "chalk";
|
|
13615
13727
|
function createStepRunner(options = true) {
|
|
13616
13728
|
const opts = typeof options === "boolean" ? { interactive: options } : options;
|
|
13617
13729
|
const interactive = opts.interactive ?? true;
|
|
@@ -13626,25 +13738,25 @@ function createStepRunner(options = true) {
|
|
|
13626
13738
|
}
|
|
13627
13739
|
for (const [i, step] of completedSteps.entries()) {
|
|
13628
13740
|
if (step.failed) {
|
|
13629
|
-
console.log(
|
|
13741
|
+
console.log(chalk72.red(`\u2717 ${step.label}`));
|
|
13630
13742
|
} else {
|
|
13631
|
-
console.log(
|
|
13743
|
+
console.log(chalk72.green(`\u25CF ${step.label}`));
|
|
13632
13744
|
}
|
|
13633
13745
|
const isLastStep = i === completedSteps.length - 1;
|
|
13634
13746
|
if (!isLastStep || !isFinal) {
|
|
13635
|
-
console.log(
|
|
13747
|
+
console.log(chalk72.dim("\u2502"));
|
|
13636
13748
|
}
|
|
13637
13749
|
}
|
|
13638
13750
|
}
|
|
13639
13751
|
async function executeStep(label, fn, isFinal) {
|
|
13640
13752
|
let stepFailed = false;
|
|
13641
|
-
console.log(
|
|
13753
|
+
console.log(chalk72.yellow(`\u25CB ${label}`));
|
|
13642
13754
|
const ctx = {
|
|
13643
13755
|
connector() {
|
|
13644
|
-
console.log(
|
|
13756
|
+
console.log(chalk72.dim("\u2502"));
|
|
13645
13757
|
},
|
|
13646
13758
|
detail(message) {
|
|
13647
|
-
console.log(`${
|
|
13759
|
+
console.log(`${chalk72.dim("\u2502")} ${message}`);
|
|
13648
13760
|
},
|
|
13649
13761
|
async prompt(promptFn) {
|
|
13650
13762
|
return await promptFn();
|
|
@@ -13661,12 +13773,12 @@ function createStepRunner(options = true) {
|
|
|
13661
13773
|
redrawCompletedSteps(isFinal);
|
|
13662
13774
|
} else {
|
|
13663
13775
|
if (stepFailed) {
|
|
13664
|
-
console.log(
|
|
13776
|
+
console.log(chalk72.red(`\u2717 ${label}`));
|
|
13665
13777
|
} else {
|
|
13666
|
-
console.log(
|
|
13778
|
+
console.log(chalk72.green(`\u25CF ${label}`));
|
|
13667
13779
|
}
|
|
13668
13780
|
if (!isFinal) {
|
|
13669
|
-
console.log(
|
|
13781
|
+
console.log(chalk72.dim("\u2502"));
|
|
13670
13782
|
}
|
|
13671
13783
|
}
|
|
13672
13784
|
}
|
|
@@ -13826,7 +13938,7 @@ async function setupModelProvider(type2, secret, options) {
|
|
|
13826
13938
|
|
|
13827
13939
|
// src/lib/domain/onboard/claude-setup.ts
|
|
13828
13940
|
import { spawn as spawn3 } from "child_process";
|
|
13829
|
-
import
|
|
13941
|
+
import chalk73 from "chalk";
|
|
13830
13942
|
var MARKETPLACE_NAME = "vm0-skills";
|
|
13831
13943
|
var MARKETPLACE_REPO = "vm0-ai/vm0-skills";
|
|
13832
13944
|
var PLUGIN_ID = "vm0@vm0-skills";
|
|
@@ -13863,12 +13975,12 @@ async function runClaudeCommand(args, cwd) {
|
|
|
13863
13975
|
}
|
|
13864
13976
|
function handlePluginError(error, context) {
|
|
13865
13977
|
const displayContext = context ?? "Claude plugin";
|
|
13866
|
-
console.error(
|
|
13978
|
+
console.error(chalk73.red(`\u2717 Failed to install ${displayContext}`));
|
|
13867
13979
|
if (error instanceof Error) {
|
|
13868
|
-
console.error(
|
|
13980
|
+
console.error(chalk73.red(`\u2717 ${error.message}`));
|
|
13869
13981
|
}
|
|
13870
13982
|
console.error(
|
|
13871
|
-
|
|
13983
|
+
chalk73.dim("Please ensure Claude CLI is installed and accessible.")
|
|
13872
13984
|
);
|
|
13873
13985
|
process.exit(1);
|
|
13874
13986
|
}
|
|
@@ -13911,7 +14023,7 @@ async function updateMarketplace() {
|
|
|
13911
14023
|
]);
|
|
13912
14024
|
if (!result.success) {
|
|
13913
14025
|
console.warn(
|
|
13914
|
-
|
|
14026
|
+
chalk73.yellow(
|
|
13915
14027
|
`Warning: Could not update marketplace: ${result.error ?? "unknown error"}`
|
|
13916
14028
|
)
|
|
13917
14029
|
);
|
|
@@ -13949,7 +14061,7 @@ async function handleAuthentication(ctx) {
|
|
|
13949
14061
|
return;
|
|
13950
14062
|
}
|
|
13951
14063
|
if (!ctx.interactive) {
|
|
13952
|
-
console.error(
|
|
14064
|
+
console.error(chalk74.red("\u2717 Not authenticated"));
|
|
13953
14065
|
console.error("Run 'vm0 auth login' first or set VM0_TOKEN");
|
|
13954
14066
|
process.exit(1);
|
|
13955
14067
|
}
|
|
@@ -13957,19 +14069,19 @@ async function handleAuthentication(ctx) {
|
|
|
13957
14069
|
onInitiating: () => {
|
|
13958
14070
|
},
|
|
13959
14071
|
onDeviceCodeReady: (url, code, expiresIn) => {
|
|
13960
|
-
step.detail(`Copy code: ${
|
|
13961
|
-
step.detail(`Open: ${
|
|
13962
|
-
step.detail(
|
|
14072
|
+
step.detail(`Copy code: ${chalk74.cyan.bold(code)}`);
|
|
14073
|
+
step.detail(`Open: ${chalk74.cyan(url)}`);
|
|
14074
|
+
step.detail(chalk74.dim(`Expires in ${expiresIn} minutes`));
|
|
13963
14075
|
},
|
|
13964
14076
|
onPolling: () => {
|
|
13965
14077
|
},
|
|
13966
14078
|
onSuccess: () => {
|
|
13967
14079
|
},
|
|
13968
14080
|
onError: (error) => {
|
|
13969
|
-
console.error(
|
|
14081
|
+
console.error(chalk74.red(`
|
|
13970
14082
|
\u2717 ${error.message}`));
|
|
13971
14083
|
if (error.cause instanceof Error) {
|
|
13972
|
-
console.error(
|
|
14084
|
+
console.error(chalk74.dim(` Cause: ${error.cause.message}`));
|
|
13973
14085
|
}
|
|
13974
14086
|
process.exit(1);
|
|
13975
14087
|
}
|
|
@@ -13983,7 +14095,7 @@ async function handleModelProvider(ctx) {
|
|
|
13983
14095
|
return;
|
|
13984
14096
|
}
|
|
13985
14097
|
if (!ctx.interactive) {
|
|
13986
|
-
console.error(
|
|
14098
|
+
console.error(chalk74.red("\u2717 No model provider configured"));
|
|
13987
14099
|
console.error("Run 'vm0 model-provider setup' first");
|
|
13988
14100
|
process.exit(1);
|
|
13989
14101
|
}
|
|
@@ -14004,14 +14116,14 @@ async function handleModelProvider(ctx) {
|
|
|
14004
14116
|
const selectedChoice = choices.find((c24) => c24.type === providerType);
|
|
14005
14117
|
if (selectedChoice?.helpText) {
|
|
14006
14118
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
14007
|
-
step.detail(
|
|
14119
|
+
step.detail(chalk74.dim(line));
|
|
14008
14120
|
}
|
|
14009
14121
|
}
|
|
14010
14122
|
const secret = await step.prompt(
|
|
14011
14123
|
() => promptPassword(`Enter your ${selectedChoice?.secretLabel ?? "secret"}:`)
|
|
14012
14124
|
);
|
|
14013
14125
|
if (!secret) {
|
|
14014
|
-
console.log(
|
|
14126
|
+
console.log(chalk74.dim("Cancelled"));
|
|
14015
14127
|
process.exit(0);
|
|
14016
14128
|
}
|
|
14017
14129
|
let selectedModel;
|
|
@@ -14030,7 +14142,7 @@ async function handleModelProvider(ctx) {
|
|
|
14030
14142
|
() => promptSelect("Select model:", modelChoices)
|
|
14031
14143
|
);
|
|
14032
14144
|
if (modelSelection === void 0) {
|
|
14033
|
-
console.log(
|
|
14145
|
+
console.log(chalk74.dim("Cancelled"));
|
|
14034
14146
|
process.exit(0);
|
|
14035
14147
|
}
|
|
14036
14148
|
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
@@ -14040,7 +14152,7 @@ async function handleModelProvider(ctx) {
|
|
|
14040
14152
|
});
|
|
14041
14153
|
const modelNote = result.provider.selectedModel ? ` with model: ${result.provider.selectedModel}` : "";
|
|
14042
14154
|
step.detail(
|
|
14043
|
-
|
|
14155
|
+
chalk74.green(
|
|
14044
14156
|
`${providerType} ${result.created ? "created" : "updated"}${result.isDefault ? ` (default for ${result.framework})` : ""}${modelNote}`
|
|
14045
14157
|
)
|
|
14046
14158
|
);
|
|
@@ -14071,7 +14183,7 @@ async function handleAgentCreation(ctx) {
|
|
|
14071
14183
|
agentName = inputName;
|
|
14072
14184
|
if (existsSync12(agentName)) {
|
|
14073
14185
|
step.detail(
|
|
14074
|
-
|
|
14186
|
+
chalk74.yellow(`${agentName}/ already exists, choose another name`)
|
|
14075
14187
|
);
|
|
14076
14188
|
} else {
|
|
14077
14189
|
folderExists = false;
|
|
@@ -14080,22 +14192,22 @@ async function handleAgentCreation(ctx) {
|
|
|
14080
14192
|
} else {
|
|
14081
14193
|
if (!validateAgentName(agentName)) {
|
|
14082
14194
|
console.error(
|
|
14083
|
-
|
|
14195
|
+
chalk74.red(
|
|
14084
14196
|
"Invalid agent name: must be 3-64 chars, alphanumeric + hyphens"
|
|
14085
14197
|
)
|
|
14086
14198
|
);
|
|
14087
14199
|
process.exit(1);
|
|
14088
14200
|
}
|
|
14089
14201
|
if (existsSync12(agentName)) {
|
|
14090
|
-
console.error(
|
|
14202
|
+
console.error(chalk74.red(`\u2717 ${agentName}/ already exists`));
|
|
14091
14203
|
console.error();
|
|
14092
14204
|
console.error("Remove it first or choose a different name:");
|
|
14093
|
-
console.error(
|
|
14205
|
+
console.error(chalk74.cyan(` rm -rf ${agentName}`));
|
|
14094
14206
|
process.exit(1);
|
|
14095
14207
|
}
|
|
14096
14208
|
}
|
|
14097
14209
|
await mkdir8(agentName, { recursive: true });
|
|
14098
|
-
step.detail(
|
|
14210
|
+
step.detail(chalk74.green(`Created ${agentName}/`));
|
|
14099
14211
|
});
|
|
14100
14212
|
return agentName;
|
|
14101
14213
|
}
|
|
@@ -14111,7 +14223,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
14111
14223
|
shouldInstall = confirmed ?? true;
|
|
14112
14224
|
}
|
|
14113
14225
|
if (!shouldInstall) {
|
|
14114
|
-
step.detail(
|
|
14226
|
+
step.detail(chalk74.dim("Skipped"));
|
|
14115
14227
|
return;
|
|
14116
14228
|
}
|
|
14117
14229
|
const scope = "project";
|
|
@@ -14119,7 +14231,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
14119
14231
|
const agentDir = `${process.cwd()}/${agentName}`;
|
|
14120
14232
|
const result = await installVm0Plugin(scope, agentDir);
|
|
14121
14233
|
step.detail(
|
|
14122
|
-
|
|
14234
|
+
chalk74.green(`Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
14123
14235
|
);
|
|
14124
14236
|
pluginInstalled = true;
|
|
14125
14237
|
} catch (error) {
|
|
@@ -14130,18 +14242,18 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
14130
14242
|
}
|
|
14131
14243
|
function printNextSteps(agentName, pluginInstalled) {
|
|
14132
14244
|
console.log();
|
|
14133
|
-
console.log(
|
|
14245
|
+
console.log(chalk74.bold("Next step:"));
|
|
14134
14246
|
console.log();
|
|
14135
14247
|
if (pluginInstalled) {
|
|
14136
14248
|
console.log(
|
|
14137
|
-
` ${
|
|
14249
|
+
` ${chalk74.cyan(`cd ${agentName} && claude "/${PRIMARY_SKILL_NAME} let's build an agent"`)}`
|
|
14138
14250
|
);
|
|
14139
14251
|
} else {
|
|
14140
|
-
console.log(` ${
|
|
14252
|
+
console.log(` ${chalk74.cyan(`cd ${agentName} && vm0 init`)}`);
|
|
14141
14253
|
}
|
|
14142
14254
|
console.log();
|
|
14143
14255
|
}
|
|
14144
|
-
var onboardCommand = new
|
|
14256
|
+
var onboardCommand = new Command72().name("onboard").description("Guided setup for new VM0 users").option("-y, --yes", "Skip confirmation prompts").option("--name <name>", `Agent name (default: ${DEFAULT_AGENT_NAME})`).action(async (options) => {
|
|
14145
14257
|
try {
|
|
14146
14258
|
const interactive = isInteractive();
|
|
14147
14259
|
if (interactive) {
|
|
@@ -14164,33 +14276,33 @@ var onboardCommand = new Command71().name("onboard").description("Guided setup f
|
|
|
14164
14276
|
printNextSteps(agentName, pluginInstalled);
|
|
14165
14277
|
} catch (error) {
|
|
14166
14278
|
if (error instanceof Error) {
|
|
14167
|
-
console.error(
|
|
14279
|
+
console.error(chalk74.red(`\u2717 ${error.message}`));
|
|
14168
14280
|
if (error.cause instanceof Error) {
|
|
14169
|
-
console.error(
|
|
14281
|
+
console.error(chalk74.dim(` Cause: ${error.cause.message}`));
|
|
14170
14282
|
}
|
|
14171
14283
|
} else {
|
|
14172
|
-
console.error(
|
|
14284
|
+
console.error(chalk74.red("\u2717 An unexpected error occurred"));
|
|
14173
14285
|
}
|
|
14174
14286
|
process.exit(1);
|
|
14175
14287
|
}
|
|
14176
14288
|
});
|
|
14177
14289
|
|
|
14178
14290
|
// src/commands/setup-claude/index.ts
|
|
14179
|
-
import { Command as
|
|
14180
|
-
import
|
|
14181
|
-
var setupClaudeCommand = new
|
|
14291
|
+
import { Command as Command73 } from "commander";
|
|
14292
|
+
import chalk75 from "chalk";
|
|
14293
|
+
var setupClaudeCommand = new Command73().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(
|
|
14182
14294
|
withErrorHandler(async (options) => {
|
|
14183
|
-
console.log(
|
|
14295
|
+
console.log(chalk75.dim("Installing VM0 Claude Plugin..."));
|
|
14184
14296
|
const scope = options.scope === "user" ? "user" : "project";
|
|
14185
14297
|
const result = await installVm0Plugin(scope, options.agentDir);
|
|
14186
14298
|
console.log(
|
|
14187
|
-
|
|
14299
|
+
chalk75.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
14188
14300
|
);
|
|
14189
14301
|
console.log();
|
|
14190
14302
|
console.log("Next step:");
|
|
14191
14303
|
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
14192
14304
|
console.log(
|
|
14193
|
-
|
|
14305
|
+
chalk75.cyan(
|
|
14194
14306
|
` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
|
|
14195
14307
|
)
|
|
14196
14308
|
);
|
|
@@ -14198,39 +14310,39 @@ var setupClaudeCommand = new Command72().name("setup-claude").description("Insta
|
|
|
14198
14310
|
);
|
|
14199
14311
|
|
|
14200
14312
|
// src/commands/dashboard/index.ts
|
|
14201
|
-
import { Command as
|
|
14202
|
-
import
|
|
14203
|
-
var dashboardCommand = new
|
|
14313
|
+
import { Command as Command74 } from "commander";
|
|
14314
|
+
import chalk76 from "chalk";
|
|
14315
|
+
var dashboardCommand = new Command74().name("dashboard").description("Quick reference for common query commands").action(() => {
|
|
14204
14316
|
console.log();
|
|
14205
|
-
console.log(
|
|
14317
|
+
console.log(chalk76.bold("VM0 Dashboard"));
|
|
14206
14318
|
console.log();
|
|
14207
|
-
console.log(
|
|
14208
|
-
console.log(
|
|
14319
|
+
console.log(chalk76.bold("Agents"));
|
|
14320
|
+
console.log(chalk76.dim(" List agents: ") + "vm0 agent list");
|
|
14209
14321
|
console.log();
|
|
14210
|
-
console.log(
|
|
14211
|
-
console.log(
|
|
14212
|
-
console.log(
|
|
14322
|
+
console.log(chalk76.bold("Runs"));
|
|
14323
|
+
console.log(chalk76.dim(" Recent runs: ") + "vm0 run list");
|
|
14324
|
+
console.log(chalk76.dim(" View run logs: ") + "vm0 logs <run-id>");
|
|
14213
14325
|
console.log();
|
|
14214
|
-
console.log(
|
|
14215
|
-
console.log(
|
|
14326
|
+
console.log(chalk76.bold("Schedules"));
|
|
14327
|
+
console.log(chalk76.dim(" List schedules: ") + "vm0 schedule list");
|
|
14216
14328
|
console.log();
|
|
14217
|
-
console.log(
|
|
14218
|
-
console.log(
|
|
14219
|
-
console.log(
|
|
14220
|
-
console.log(
|
|
14329
|
+
console.log(chalk76.bold("Account"));
|
|
14330
|
+
console.log(chalk76.dim(" Usage stats: ") + "vm0 usage");
|
|
14331
|
+
console.log(chalk76.dim(" List secrets: ") + "vm0 secret list");
|
|
14332
|
+
console.log(chalk76.dim(" List variables: ") + "vm0 variable list");
|
|
14221
14333
|
console.log();
|
|
14222
14334
|
console.log(
|
|
14223
|
-
|
|
14335
|
+
chalk76.dim("Not logged in? Run: ") + chalk76.cyan("vm0 auth login")
|
|
14224
14336
|
);
|
|
14225
14337
|
console.log();
|
|
14226
14338
|
});
|
|
14227
14339
|
|
|
14228
14340
|
// src/commands/dev-tool/index.ts
|
|
14229
|
-
import { Command as
|
|
14341
|
+
import { Command as Command76 } from "commander";
|
|
14230
14342
|
|
|
14231
14343
|
// src/commands/dev-tool/compose.ts
|
|
14232
|
-
import { Command as
|
|
14233
|
-
import
|
|
14344
|
+
import { Command as Command75 } from "commander";
|
|
14345
|
+
import chalk77 from "chalk";
|
|
14234
14346
|
import { initClient as initClient13 } from "@ts-rest/core";
|
|
14235
14347
|
function sleep2(ms) {
|
|
14236
14348
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -14282,7 +14394,7 @@ async function pollUntilComplete(jobId, intervalMs, timeoutMs, jsonMode) {
|
|
|
14282
14394
|
const job = await getComposeJobStatus(jobId);
|
|
14283
14395
|
if (!jsonMode) {
|
|
14284
14396
|
console.log(
|
|
14285
|
-
|
|
14397
|
+
chalk77.dim(`[${timestamp()}] Polling... status=${job.status}`)
|
|
14286
14398
|
);
|
|
14287
14399
|
}
|
|
14288
14400
|
if (job.status === "completed" || job.status === "failed") {
|
|
@@ -14292,7 +14404,7 @@ async function pollUntilComplete(jobId, intervalMs, timeoutMs, jsonMode) {
|
|
|
14292
14404
|
}
|
|
14293
14405
|
throw new Error(`Timeout after ${timeoutMs / 1e3} seconds`);
|
|
14294
14406
|
}
|
|
14295
|
-
var composeCommand2 = new
|
|
14407
|
+
var composeCommand2 = new Command75().name("compose").description("Test server-side GitHub compose API").argument("<github-url>", "GitHub URL to compose from").option("--overwrite", "Overwrite existing compose", false).option(
|
|
14296
14408
|
"--interval <seconds>",
|
|
14297
14409
|
"Polling interval in seconds",
|
|
14298
14410
|
(v) => parseInt(v, 10),
|
|
@@ -14341,7 +14453,7 @@ var composeCommand2 = new Command74().name("compose").description("Test server-s
|
|
|
14341
14453
|
githubUrl,
|
|
14342
14454
|
options.overwrite
|
|
14343
14455
|
);
|
|
14344
|
-
console.log(`Job ID: ${
|
|
14456
|
+
console.log(`Job ID: ${chalk77.cyan(jobId)}`);
|
|
14345
14457
|
console.log();
|
|
14346
14458
|
if (initialStatus === "completed" || initialStatus === "failed") {
|
|
14347
14459
|
const finalJob2 = await getComposeJobStatus(jobId);
|
|
@@ -14362,21 +14474,21 @@ var composeCommand2 = new Command74().name("compose").description("Test server-s
|
|
|
14362
14474
|
);
|
|
14363
14475
|
function displayResult(job) {
|
|
14364
14476
|
if (job.status === "completed" && job.result) {
|
|
14365
|
-
console.log(
|
|
14366
|
-
console.log(` Compose ID: ${
|
|
14367
|
-
console.log(` Name: ${
|
|
14368
|
-
console.log(` Version: ${
|
|
14477
|
+
console.log(chalk77.green("\u2713 Compose completed!"));
|
|
14478
|
+
console.log(` Compose ID: ${chalk77.cyan(job.result.composeId)}`);
|
|
14479
|
+
console.log(` Name: ${chalk77.cyan(job.result.composeName)}`);
|
|
14480
|
+
console.log(` Version: ${chalk77.cyan(job.result.versionId.slice(0, 8))}`);
|
|
14369
14481
|
if (job.result.warnings.length > 0) {
|
|
14370
14482
|
console.log();
|
|
14371
|
-
console.log(
|
|
14483
|
+
console.log(chalk77.yellow(" Warnings:"));
|
|
14372
14484
|
for (const warning of job.result.warnings) {
|
|
14373
|
-
console.log(
|
|
14485
|
+
console.log(chalk77.yellow(` - ${warning}`));
|
|
14374
14486
|
}
|
|
14375
14487
|
}
|
|
14376
14488
|
} else if (job.status === "failed") {
|
|
14377
|
-
console.error(
|
|
14489
|
+
console.error(chalk77.red("\u2717 Compose failed"));
|
|
14378
14490
|
if (job.error) {
|
|
14379
|
-
console.error(` Error: ${
|
|
14491
|
+
console.error(` Error: ${chalk77.red(job.error)}`);
|
|
14380
14492
|
}
|
|
14381
14493
|
} else {
|
|
14382
14494
|
console.log(`Status: ${job.status}`);
|
|
@@ -14384,11 +14496,11 @@ function displayResult(job) {
|
|
|
14384
14496
|
}
|
|
14385
14497
|
|
|
14386
14498
|
// src/commands/dev-tool/index.ts
|
|
14387
|
-
var devToolCommand = new
|
|
14499
|
+
var devToolCommand = new Command76().name("dev-tool").description("Developer tools for testing and debugging").addCommand(composeCommand2);
|
|
14388
14500
|
|
|
14389
14501
|
// src/index.ts
|
|
14390
|
-
var program = new
|
|
14391
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
14502
|
+
var program = new Command77();
|
|
14503
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.33.0");
|
|
14392
14504
|
program.addCommand(authCommand);
|
|
14393
14505
|
program.addCommand(infoCommand);
|
|
14394
14506
|
program.addCommand(composeCommand);
|