@vm0/cli 9.24.1 → 9.26.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 +500 -247
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -61,7 +61,7 @@ if (DSN) {
|
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
Sentry.setContext("cli", {
|
|
64
|
-
version: "9.
|
|
64
|
+
version: "9.26.0",
|
|
65
65
|
command: process.argv.slice(2).join(" ")
|
|
66
66
|
});
|
|
67
67
|
Sentry.setContext("runtime", {
|
|
@@ -72,7 +72,7 @@ if (DSN) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// src/index.ts
|
|
75
|
-
import { Command as
|
|
75
|
+
import { Command as Command75 } from "commander";
|
|
76
76
|
|
|
77
77
|
// src/commands/auth/index.ts
|
|
78
78
|
import { Command as Command5 } from "commander";
|
|
@@ -198,7 +198,7 @@ The code expires in ${Math.floor(deviceAuth.expires_in / 60)} minutes.`
|
|
|
198
198
|
apiUrl: targetApiUrl
|
|
199
199
|
});
|
|
200
200
|
console.log(chalk.green("\nAuthentication successful!"));
|
|
201
|
-
console.log("Your credentials have been saved
|
|
201
|
+
console.log("Your credentials have been saved");
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
204
|
if (tokenResult.error === "authorization_pending") {
|
|
@@ -206,28 +206,26 @@ The code expires in ${Math.floor(deviceAuth.expires_in / 60)} minutes.`
|
|
|
206
206
|
continue;
|
|
207
207
|
}
|
|
208
208
|
if (tokenResult.error === "expired_token") {
|
|
209
|
-
console.
|
|
210
|
-
chalk.red("\nThe device code has expired. Please try again.")
|
|
211
|
-
);
|
|
209
|
+
console.error(chalk.red("\n\u2717 Device code expired, please try again"));
|
|
212
210
|
process.exit(1);
|
|
213
211
|
}
|
|
214
212
|
if (tokenResult.error) {
|
|
215
|
-
console.
|
|
213
|
+
console.error(
|
|
216
214
|
chalk.red(
|
|
217
215
|
`
|
|
218
|
-
Authentication failed: ${tokenResult.error_description ?? tokenResult.error}`
|
|
216
|
+
\u2717 Authentication failed: ${tokenResult.error_description ?? tokenResult.error}`
|
|
219
217
|
)
|
|
220
218
|
);
|
|
221
219
|
process.exit(1);
|
|
222
220
|
}
|
|
223
221
|
}
|
|
224
|
-
console.
|
|
222
|
+
console.error(chalk.red("\n\u2717 Authentication timed out, please try again"));
|
|
225
223
|
process.exit(1);
|
|
226
224
|
}
|
|
227
225
|
async function logout() {
|
|
228
226
|
await clearConfig();
|
|
229
227
|
console.log(chalk.green("\u2713 Successfully logged out"));
|
|
230
|
-
console.log("Your credentials have been cleared
|
|
228
|
+
console.log("Your credentials have been cleared");
|
|
231
229
|
}
|
|
232
230
|
async function checkAuthStatus() {
|
|
233
231
|
const config = await loadConfig();
|
|
@@ -235,8 +233,8 @@ async function checkAuthStatus() {
|
|
|
235
233
|
console.log(chalk.green("\u2713 Authenticated"));
|
|
236
234
|
console.log("You are logged in to VM0.");
|
|
237
235
|
} else {
|
|
238
|
-
console.
|
|
239
|
-
console.
|
|
236
|
+
console.error(chalk.red("\u2717 Not authenticated"));
|
|
237
|
+
console.error(chalk.dim(" Run: vm0 auth login"));
|
|
240
238
|
}
|
|
241
239
|
if (process.env.VM0_TOKEN) {
|
|
242
240
|
console.log("Using token from VM0_TOKEN environment variable");
|
|
@@ -1965,7 +1963,7 @@ var secretNameSchema = z14.string().min(1, "Secret name is required").max(255, "
|
|
|
1965
1963
|
/^[A-Z][A-Z0-9_]*$/,
|
|
1966
1964
|
"Secret name must contain only uppercase letters, numbers, and underscores, and must start with a letter (e.g., MY_API_KEY)"
|
|
1967
1965
|
);
|
|
1968
|
-
var secretTypeSchema = z14.enum(["user", "model-provider"]);
|
|
1966
|
+
var secretTypeSchema = z14.enum(["user", "model-provider", "connector"]);
|
|
1969
1967
|
var secretResponseSchema = z14.object({
|
|
1970
1968
|
id: z14.string().uuid(),
|
|
1971
1969
|
name: z14.string(),
|
|
@@ -3234,7 +3232,58 @@ var webhookComposeCompleteContract = c19.router({
|
|
|
3234
3232
|
// ../../packages/core/src/contracts/connectors.ts
|
|
3235
3233
|
import { z as z24 } from "zod";
|
|
3236
3234
|
var c20 = initContract();
|
|
3235
|
+
var CONNECTOR_TYPES = {
|
|
3236
|
+
github: {
|
|
3237
|
+
label: "GitHub",
|
|
3238
|
+
helpText: "Connect your GitHub account to access repositories and GitHub features",
|
|
3239
|
+
authMethods: {
|
|
3240
|
+
oauth: {
|
|
3241
|
+
label: "OAuth (Recommended)",
|
|
3242
|
+
helpText: "Sign in with GitHub to grant access.",
|
|
3243
|
+
secrets: {
|
|
3244
|
+
GITHUB_ACCESS_TOKEN: {
|
|
3245
|
+
label: "Access Token",
|
|
3246
|
+
required: true
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
},
|
|
3251
|
+
defaultAuthMethod: "oauth",
|
|
3252
|
+
environmentMapping: {
|
|
3253
|
+
GH_TOKEN: "$secrets.GITHUB_ACCESS_TOKEN",
|
|
3254
|
+
GITHUB_TOKEN: "$secrets.GITHUB_ACCESS_TOKEN"
|
|
3255
|
+
},
|
|
3256
|
+
oauth: {
|
|
3257
|
+
authorizationUrl: "https://github.com/login/oauth/authorize",
|
|
3258
|
+
tokenUrl: "https://github.com/login/oauth/access_token",
|
|
3259
|
+
scopes: ["repo"]
|
|
3260
|
+
}
|
|
3261
|
+
}
|
|
3262
|
+
};
|
|
3237
3263
|
var connectorTypeSchema = z24.enum(["github"]);
|
|
3264
|
+
function getConnectorDerivedNames(secretName) {
|
|
3265
|
+
const allTypes = Object.keys(CONNECTOR_TYPES);
|
|
3266
|
+
for (const type of allTypes) {
|
|
3267
|
+
const config = CONNECTOR_TYPES[type];
|
|
3268
|
+
const authMethods = config.authMethods;
|
|
3269
|
+
let found = false;
|
|
3270
|
+
for (const method of Object.values(authMethods)) {
|
|
3271
|
+
if (method.secrets && secretName in method.secrets) {
|
|
3272
|
+
found = true;
|
|
3273
|
+
break;
|
|
3274
|
+
}
|
|
3275
|
+
}
|
|
3276
|
+
if (!found) {
|
|
3277
|
+
continue;
|
|
3278
|
+
}
|
|
3279
|
+
const mapping = config.environmentMapping;
|
|
3280
|
+
const envVarNames = Object.entries(mapping).filter(([, valueRef]) => valueRef === `$secrets.${secretName}`).map(([envVar]) => envVar);
|
|
3281
|
+
if (envVarNames.length > 0) {
|
|
3282
|
+
return { connectorLabel: config.label, envVarNames };
|
|
3283
|
+
}
|
|
3284
|
+
}
|
|
3285
|
+
return null;
|
|
3286
|
+
}
|
|
3238
3287
|
var connectorResponseSchema = z24.object({
|
|
3239
3288
|
id: z24.string().uuid(),
|
|
3240
3289
|
type: connectorTypeSchema,
|
|
@@ -4575,6 +4624,43 @@ async function updateModelProviderModel(type, selectedModel) {
|
|
|
4575
4624
|
handleError(result, "Failed to update model provider");
|
|
4576
4625
|
}
|
|
4577
4626
|
|
|
4627
|
+
// src/lib/api/domains/connectors.ts
|
|
4628
|
+
import { initClient as initClient10 } from "@ts-rest/core";
|
|
4629
|
+
async function listConnectors() {
|
|
4630
|
+
const config = await getClientConfig();
|
|
4631
|
+
const client = initClient10(connectorsMainContract, config);
|
|
4632
|
+
const result = await client.list({ headers: {} });
|
|
4633
|
+
if (result.status === 200) {
|
|
4634
|
+
return result.body;
|
|
4635
|
+
}
|
|
4636
|
+
handleError(result, "Failed to list connectors");
|
|
4637
|
+
}
|
|
4638
|
+
async function deleteConnector(type) {
|
|
4639
|
+
const config = await getClientConfig();
|
|
4640
|
+
const client = initClient10(connectorsByTypeContract, config);
|
|
4641
|
+
const result = await client.delete({
|
|
4642
|
+
params: { type }
|
|
4643
|
+
});
|
|
4644
|
+
if (result.status === 204) {
|
|
4645
|
+
return;
|
|
4646
|
+
}
|
|
4647
|
+
handleError(result, `Connector "${type}" not found`);
|
|
4648
|
+
}
|
|
4649
|
+
async function getConnector(type) {
|
|
4650
|
+
const config = await getClientConfig();
|
|
4651
|
+
const client = initClient10(connectorsByTypeContract, config);
|
|
4652
|
+
const result = await client.get({
|
|
4653
|
+
params: { type }
|
|
4654
|
+
});
|
|
4655
|
+
if (result.status === 200) {
|
|
4656
|
+
return result.body;
|
|
4657
|
+
}
|
|
4658
|
+
if (result.status === 404) {
|
|
4659
|
+
return null;
|
|
4660
|
+
}
|
|
4661
|
+
handleError(result, `Failed to get connector "${type}"`);
|
|
4662
|
+
}
|
|
4663
|
+
|
|
4578
4664
|
// src/lib/api/domains/usage.ts
|
|
4579
4665
|
async function getUsage(options) {
|
|
4580
4666
|
const baseUrl = await getBaseUrl();
|
|
@@ -5472,7 +5558,7 @@ function performUpgrade(packageManager) {
|
|
|
5472
5558
|
async function checkAndUpgrade(currentVersion, prompt) {
|
|
5473
5559
|
const latestVersion = await getLatestVersion();
|
|
5474
5560
|
if (latestVersion === null) {
|
|
5475
|
-
console.log(chalk3.yellow("
|
|
5561
|
+
console.log(chalk3.yellow("\u26A0 Could not check for updates"));
|
|
5476
5562
|
console.log();
|
|
5477
5563
|
return false;
|
|
5478
5564
|
}
|
|
@@ -5516,12 +5602,12 @@ async function checkAndUpgrade(currentVersion, prompt) {
|
|
|
5516
5602
|
console.log(chalk3.cyan(` ${buildRerunCommand(prompt)}`));
|
|
5517
5603
|
return true;
|
|
5518
5604
|
}
|
|
5519
|
-
console.
|
|
5520
|
-
console.
|
|
5521
|
-
console.
|
|
5522
|
-
console.
|
|
5523
|
-
console.
|
|
5524
|
-
console.
|
|
5605
|
+
console.error();
|
|
5606
|
+
console.error(chalk3.red("\u2717 Upgrade failed. Please run manually:"));
|
|
5607
|
+
console.error(chalk3.cyan(` ${getManualUpgradeCommand(packageManager)}`));
|
|
5608
|
+
console.error();
|
|
5609
|
+
console.error("Then re-run:");
|
|
5610
|
+
console.error(chalk3.cyan(` ${buildRerunCommand(prompt)}`));
|
|
5525
5611
|
return true;
|
|
5526
5612
|
}
|
|
5527
5613
|
async function silentUpgradeAfterCommand(currentVersion) {
|
|
@@ -5578,9 +5664,9 @@ function getSecretsFromComposeContent(content) {
|
|
|
5578
5664
|
const grouped = groupVariablesBySource(refs);
|
|
5579
5665
|
return new Set(grouped.secrets.map((r) => r.name));
|
|
5580
5666
|
}
|
|
5581
|
-
async function loadAndValidateConfig(configFile,
|
|
5667
|
+
async function loadAndValidateConfig(configFile, jsonMode) {
|
|
5582
5668
|
if (!existsSync4(configFile)) {
|
|
5583
|
-
if (
|
|
5669
|
+
if (jsonMode) {
|
|
5584
5670
|
console.log(
|
|
5585
5671
|
JSON.stringify({ error: `Config file not found: ${configFile}` })
|
|
5586
5672
|
);
|
|
@@ -5595,7 +5681,7 @@ async function loadAndValidateConfig(configFile, porcelainMode) {
|
|
|
5595
5681
|
config = parseYaml2(content);
|
|
5596
5682
|
} catch (error) {
|
|
5597
5683
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
5598
|
-
if (
|
|
5684
|
+
if (jsonMode) {
|
|
5599
5685
|
console.log(JSON.stringify({ error: `Invalid YAML format: ${message}` }));
|
|
5600
5686
|
} else {
|
|
5601
5687
|
console.error(chalk4.red("\u2717 Invalid YAML format"));
|
|
@@ -5605,7 +5691,7 @@ async function loadAndValidateConfig(configFile, porcelainMode) {
|
|
|
5605
5691
|
}
|
|
5606
5692
|
const validation = validateAgentCompose(config);
|
|
5607
5693
|
if (!validation.valid) {
|
|
5608
|
-
if (
|
|
5694
|
+
if (jsonMode) {
|
|
5609
5695
|
console.log(JSON.stringify({ error: validation.error }));
|
|
5610
5696
|
} else {
|
|
5611
5697
|
console.error(chalk4.red(`\u2717 ${validation.error}`));
|
|
@@ -5645,9 +5731,9 @@ function checkLegacyImageFormat(config) {
|
|
|
5645
5731
|
}
|
|
5646
5732
|
}
|
|
5647
5733
|
}
|
|
5648
|
-
async function uploadAssets(agentName, agent, basePath,
|
|
5734
|
+
async function uploadAssets(agentName, agent, basePath, jsonMode) {
|
|
5649
5735
|
if (agent.instructions) {
|
|
5650
|
-
if (!
|
|
5736
|
+
if (!jsonMode) {
|
|
5651
5737
|
console.log(`Uploading instructions: ${agent.instructions}`);
|
|
5652
5738
|
}
|
|
5653
5739
|
const result = await uploadInstructions(
|
|
@@ -5656,7 +5742,7 @@ async function uploadAssets(agentName, agent, basePath, porcelainMode) {
|
|
|
5656
5742
|
basePath,
|
|
5657
5743
|
agent.framework
|
|
5658
5744
|
);
|
|
5659
|
-
if (!
|
|
5745
|
+
if (!jsonMode) {
|
|
5660
5746
|
console.log(
|
|
5661
5747
|
chalk4.green(
|
|
5662
5748
|
`\u2713 Instructions ${result.action === "deduplicated" ? "(unchanged)" : "uploaded"}: ${result.versionId.slice(0, 8)}`
|
|
@@ -5666,16 +5752,16 @@ async function uploadAssets(agentName, agent, basePath, porcelainMode) {
|
|
|
5666
5752
|
}
|
|
5667
5753
|
const skillResults = [];
|
|
5668
5754
|
if (agent.skills && Array.isArray(agent.skills)) {
|
|
5669
|
-
if (!
|
|
5755
|
+
if (!jsonMode) {
|
|
5670
5756
|
console.log(`Uploading ${agent.skills.length} skill(s)...`);
|
|
5671
5757
|
}
|
|
5672
5758
|
for (const skillUrl of agent.skills) {
|
|
5673
|
-
if (!
|
|
5759
|
+
if (!jsonMode) {
|
|
5674
5760
|
console.log(chalk4.dim(` Downloading: ${skillUrl}`));
|
|
5675
5761
|
}
|
|
5676
5762
|
const result = await uploadSkill(skillUrl);
|
|
5677
5763
|
skillResults.push(result);
|
|
5678
|
-
if (!
|
|
5764
|
+
if (!jsonMode) {
|
|
5679
5765
|
console.log(
|
|
5680
5766
|
chalk4.green(
|
|
5681
5767
|
` \u2713 Skill ${result.action === "deduplicated" ? "(unchanged)" : "uploaded"}: ${result.skillName} (${result.versionId.slice(0, 8)})`
|
|
@@ -5727,7 +5813,7 @@ async function displayAndConfirmVariables(variables, options) {
|
|
|
5727
5813
|
if (newSecrets.length === 0 && newVars.length === 0) {
|
|
5728
5814
|
return true;
|
|
5729
5815
|
}
|
|
5730
|
-
if (!options.
|
|
5816
|
+
if (!options.json) {
|
|
5731
5817
|
console.log();
|
|
5732
5818
|
console.log(
|
|
5733
5819
|
chalk4.bold("Skills require the following environment variables:")
|
|
@@ -5753,7 +5839,7 @@ async function displayAndConfirmVariables(variables, options) {
|
|
|
5753
5839
|
}
|
|
5754
5840
|
if (trulyNewSecrets.length > 0 && !options.yes) {
|
|
5755
5841
|
if (!isInteractive()) {
|
|
5756
|
-
if (options.
|
|
5842
|
+
if (options.json) {
|
|
5757
5843
|
console.log(
|
|
5758
5844
|
JSON.stringify({
|
|
5759
5845
|
error: `New secrets detected: ${trulyNewSecrets.join(", ")}. Use --yes flag to approve.`
|
|
@@ -5776,7 +5862,7 @@ async function displayAndConfirmVariables(variables, options) {
|
|
|
5776
5862
|
true
|
|
5777
5863
|
);
|
|
5778
5864
|
if (!confirmed) {
|
|
5779
|
-
if (!options.
|
|
5865
|
+
if (!options.json) {
|
|
5780
5866
|
console.log(chalk4.yellow("Compose cancelled"));
|
|
5781
5867
|
}
|
|
5782
5868
|
return false;
|
|
@@ -5806,7 +5892,7 @@ async function finalizeCompose(config, agent, variables, options) {
|
|
|
5806
5892
|
process.exit(0);
|
|
5807
5893
|
}
|
|
5808
5894
|
mergeSkillVariables(agent, variables);
|
|
5809
|
-
if (!options.
|
|
5895
|
+
if (!options.json) {
|
|
5810
5896
|
console.log("Uploading compose...");
|
|
5811
5897
|
}
|
|
5812
5898
|
const response = await createOrUpdateCompose({ content: config });
|
|
@@ -5820,7 +5906,7 @@ async function finalizeCompose(config, agent, variables, options) {
|
|
|
5820
5906
|
action: response.action,
|
|
5821
5907
|
displayName
|
|
5822
5908
|
};
|
|
5823
|
-
if (!options.
|
|
5909
|
+
if (!options.json) {
|
|
5824
5910
|
if (response.action === "created") {
|
|
5825
5911
|
console.log(chalk4.green(`\u2713 Compose created: ${displayName}`));
|
|
5826
5912
|
} else {
|
|
@@ -5836,19 +5922,19 @@ async function finalizeCompose(config, agent, variables, options) {
|
|
|
5836
5922
|
);
|
|
5837
5923
|
}
|
|
5838
5924
|
if (options.autoUpdate !== false) {
|
|
5839
|
-
await silentUpgradeAfterCommand("9.
|
|
5925
|
+
await silentUpgradeAfterCommand("9.26.0");
|
|
5840
5926
|
}
|
|
5841
5927
|
return result;
|
|
5842
5928
|
}
|
|
5843
5929
|
async function handleGitHubCompose(url, options) {
|
|
5844
|
-
if (!options.
|
|
5930
|
+
if (!options.json) {
|
|
5845
5931
|
console.log(`Downloading from GitHub: ${url}`);
|
|
5846
5932
|
}
|
|
5847
5933
|
const { dir: downloadedDir, tempRoot } = await downloadGitHubDirectory(url);
|
|
5848
5934
|
const configFile = join6(downloadedDir, "vm0.yaml");
|
|
5849
5935
|
try {
|
|
5850
5936
|
if (!existsSync4(configFile)) {
|
|
5851
|
-
if (options.
|
|
5937
|
+
if (options.json) {
|
|
5852
5938
|
console.log(
|
|
5853
5939
|
JSON.stringify({
|
|
5854
5940
|
error: "vm0.yaml not found in the GitHub directory"
|
|
@@ -5864,11 +5950,11 @@ async function handleGitHubCompose(url, options) {
|
|
|
5864
5950
|
}
|
|
5865
5951
|
const { config, agentName, agent, basePath } = await loadAndValidateConfig(
|
|
5866
5952
|
configFile,
|
|
5867
|
-
options.
|
|
5953
|
+
options.json
|
|
5868
5954
|
);
|
|
5869
5955
|
const existingCompose = await getComposeByName(agentName);
|
|
5870
5956
|
if (existingCompose) {
|
|
5871
|
-
if (!options.
|
|
5957
|
+
if (!options.json) {
|
|
5872
5958
|
console.log();
|
|
5873
5959
|
console.log(
|
|
5874
5960
|
chalk4.yellow(`\u26A0 An agent named "${agentName}" already exists.`)
|
|
@@ -5876,7 +5962,7 @@ async function handleGitHubCompose(url, options) {
|
|
|
5876
5962
|
}
|
|
5877
5963
|
if (!isInteractive()) {
|
|
5878
5964
|
if (!options.yes) {
|
|
5879
|
-
if (options.
|
|
5965
|
+
if (options.json) {
|
|
5880
5966
|
console.log(
|
|
5881
5967
|
JSON.stringify({
|
|
5882
5968
|
error: "Cannot overwrite existing agent in non-interactive mode"
|
|
@@ -5902,7 +5988,7 @@ async function handleGitHubCompose(url, options) {
|
|
|
5902
5988
|
false
|
|
5903
5989
|
);
|
|
5904
5990
|
if (!confirmed) {
|
|
5905
|
-
if (!options.
|
|
5991
|
+
if (!options.json) {
|
|
5906
5992
|
console.log(chalk4.yellow("Compose cancelled."));
|
|
5907
5993
|
}
|
|
5908
5994
|
process.exit(0);
|
|
@@ -5910,7 +5996,7 @@ async function handleGitHubCompose(url, options) {
|
|
|
5910
5996
|
}
|
|
5911
5997
|
}
|
|
5912
5998
|
if (hasVolumes(config)) {
|
|
5913
|
-
if (options.
|
|
5999
|
+
if (options.json) {
|
|
5914
6000
|
console.log(
|
|
5915
6001
|
JSON.stringify({
|
|
5916
6002
|
error: "Volumes are not supported for GitHub URL compose"
|
|
@@ -5928,14 +6014,14 @@ async function handleGitHubCompose(url, options) {
|
|
|
5928
6014
|
}
|
|
5929
6015
|
process.exit(1);
|
|
5930
6016
|
}
|
|
5931
|
-
if (!options.
|
|
6017
|
+
if (!options.json) {
|
|
5932
6018
|
checkLegacyImageFormat(config);
|
|
5933
6019
|
}
|
|
5934
6020
|
const skillResults = await uploadAssets(
|
|
5935
6021
|
agentName,
|
|
5936
6022
|
agent,
|
|
5937
6023
|
basePath,
|
|
5938
|
-
options.
|
|
6024
|
+
options.json
|
|
5939
6025
|
);
|
|
5940
6026
|
const environment = agent.environment || {};
|
|
5941
6027
|
const variables = await collectSkillVariables(
|
|
@@ -5954,13 +6040,20 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
5954
6040
|
).option("-y, --yes", "Skip confirmation prompts for skill requirements").option(
|
|
5955
6041
|
"--experimental-shared-compose",
|
|
5956
6042
|
"Enable GitHub URL compose (experimental)"
|
|
5957
|
-
).option(
|
|
6043
|
+
).option("--json", "Output JSON for scripts (suppresses interactive output)").option(
|
|
5958
6044
|
"--porcelain",
|
|
5959
|
-
"Output
|
|
6045
|
+
"[deprecated: use --json] Output JSON for scripts",
|
|
6046
|
+
false
|
|
5960
6047
|
).addOption(new Option("--no-auto-update").hideHelp()).action(
|
|
5961
6048
|
async (configFile, options) => {
|
|
5962
6049
|
const resolvedConfigFile = configFile ?? DEFAULT_CONFIG_FILE;
|
|
5963
|
-
if (options.porcelain) {
|
|
6050
|
+
if (options.porcelain && !options.json) {
|
|
6051
|
+
console.error(
|
|
6052
|
+
chalk4.yellow("\u26A0 --porcelain is deprecated, use --json instead")
|
|
6053
|
+
);
|
|
6054
|
+
options.json = true;
|
|
6055
|
+
}
|
|
6056
|
+
if (options.json) {
|
|
5964
6057
|
options.yes = true;
|
|
5965
6058
|
options.autoUpdate = false;
|
|
5966
6059
|
}
|
|
@@ -5968,7 +6061,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
5968
6061
|
let result;
|
|
5969
6062
|
if (isGitHubUrl(resolvedConfigFile)) {
|
|
5970
6063
|
if (!options.experimentalSharedCompose) {
|
|
5971
|
-
if (options.
|
|
6064
|
+
if (options.json) {
|
|
5972
6065
|
console.log(
|
|
5973
6066
|
JSON.stringify({
|
|
5974
6067
|
error: "Composing shared agents requires --experimental-shared-compose flag"
|
|
@@ -5994,15 +6087,15 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
5994
6087
|
}
|
|
5995
6088
|
result = await handleGitHubCompose(resolvedConfigFile, options);
|
|
5996
6089
|
} else {
|
|
5997
|
-
const { config, agentName, agent, basePath } = await loadAndValidateConfig(resolvedConfigFile, options.
|
|
5998
|
-
if (!options.
|
|
6090
|
+
const { config, agentName, agent, basePath } = await loadAndValidateConfig(resolvedConfigFile, options.json);
|
|
6091
|
+
if (!options.json) {
|
|
5999
6092
|
checkLegacyImageFormat(config);
|
|
6000
6093
|
}
|
|
6001
6094
|
const skillResults = await uploadAssets(
|
|
6002
6095
|
agentName,
|
|
6003
6096
|
agent,
|
|
6004
6097
|
basePath,
|
|
6005
|
-
options.
|
|
6098
|
+
options.json
|
|
6006
6099
|
);
|
|
6007
6100
|
const environment = agent.environment || {};
|
|
6008
6101
|
const variables = await collectSkillVariables(
|
|
@@ -6012,11 +6105,11 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
6012
6105
|
);
|
|
6013
6106
|
result = await finalizeCompose(config, agent, variables, options);
|
|
6014
6107
|
}
|
|
6015
|
-
if (options.
|
|
6108
|
+
if (options.json) {
|
|
6016
6109
|
console.log(JSON.stringify(result));
|
|
6017
6110
|
}
|
|
6018
6111
|
} catch (error) {
|
|
6019
|
-
if (options.
|
|
6112
|
+
if (options.json) {
|
|
6020
6113
|
const message = error instanceof Error ? error.message : "An unexpected error occurred";
|
|
6021
6114
|
console.log(JSON.stringify({ error: message }));
|
|
6022
6115
|
process.exit(1);
|
|
@@ -6359,10 +6452,10 @@ var EventRenderer = class _EventRenderer {
|
|
|
6359
6452
|
* Note: This is run lifecycle status, not an event
|
|
6360
6453
|
*/
|
|
6361
6454
|
static renderRunFailed(error, runId) {
|
|
6362
|
-
console.
|
|
6363
|
-
console.
|
|
6364
|
-
console.
|
|
6365
|
-
console.
|
|
6455
|
+
console.error("");
|
|
6456
|
+
console.error(chalk6.red("\u2717 Run failed"));
|
|
6457
|
+
console.error(` Error: ${chalk6.red(error || "Unknown error")}`);
|
|
6458
|
+
console.error(
|
|
6366
6459
|
chalk6.dim(` (use "vm0 logs ${runId} --system" to view system logs)`)
|
|
6367
6460
|
);
|
|
6368
6461
|
}
|
|
@@ -6952,7 +7045,7 @@ var CodexEventRenderer = class {
|
|
|
6952
7045
|
};
|
|
6953
7046
|
|
|
6954
7047
|
// src/lib/api/api-client.ts
|
|
6955
|
-
import { initClient as
|
|
7048
|
+
import { initClient as initClient11 } from "@ts-rest/core";
|
|
6956
7049
|
var ApiClient = class {
|
|
6957
7050
|
async getHeaders() {
|
|
6958
7051
|
const token = await getToken();
|
|
@@ -6978,7 +7071,7 @@ var ApiClient = class {
|
|
|
6978
7071
|
async getComposeByName(name, scope) {
|
|
6979
7072
|
const baseUrl = await this.getBaseUrl();
|
|
6980
7073
|
const headers = await this.getHeaders();
|
|
6981
|
-
const client =
|
|
7074
|
+
const client = initClient11(composesMainContract, {
|
|
6982
7075
|
baseUrl,
|
|
6983
7076
|
baseHeaders: headers,
|
|
6984
7077
|
jsonQuery: true
|
|
@@ -6999,7 +7092,7 @@ var ApiClient = class {
|
|
|
6999
7092
|
async getComposeById(id) {
|
|
7000
7093
|
const baseUrl = await this.getBaseUrl();
|
|
7001
7094
|
const headers = await this.getHeaders();
|
|
7002
|
-
const client =
|
|
7095
|
+
const client = initClient11(composesByIdContract, {
|
|
7003
7096
|
baseUrl,
|
|
7004
7097
|
baseHeaders: headers,
|
|
7005
7098
|
jsonQuery: true
|
|
@@ -7021,7 +7114,7 @@ var ApiClient = class {
|
|
|
7021
7114
|
async getComposeVersion(composeId, version) {
|
|
7022
7115
|
const baseUrl = await this.getBaseUrl();
|
|
7023
7116
|
const headers = await this.getHeaders();
|
|
7024
|
-
const client =
|
|
7117
|
+
const client = initClient11(composesVersionsContract, {
|
|
7025
7118
|
baseUrl,
|
|
7026
7119
|
baseHeaders: headers,
|
|
7027
7120
|
jsonQuery: true
|
|
@@ -7042,7 +7135,7 @@ var ApiClient = class {
|
|
|
7042
7135
|
async createOrUpdateCompose(body) {
|
|
7043
7136
|
const baseUrl = await this.getBaseUrl();
|
|
7044
7137
|
const headers = await this.getHeaders();
|
|
7045
|
-
const client =
|
|
7138
|
+
const client = initClient11(composesMainContract, {
|
|
7046
7139
|
baseUrl,
|
|
7047
7140
|
baseHeaders: headers,
|
|
7048
7141
|
jsonQuery: true
|
|
@@ -7065,7 +7158,7 @@ var ApiClient = class {
|
|
|
7065
7158
|
async createRun(body) {
|
|
7066
7159
|
const baseUrl = await this.getBaseUrl();
|
|
7067
7160
|
const headers = await this.getHeaders();
|
|
7068
|
-
const client =
|
|
7161
|
+
const client = initClient11(runsMainContract, {
|
|
7069
7162
|
baseUrl,
|
|
7070
7163
|
baseHeaders: headers,
|
|
7071
7164
|
jsonQuery: true
|
|
@@ -7081,7 +7174,7 @@ var ApiClient = class {
|
|
|
7081
7174
|
async getEvents(runId, options) {
|
|
7082
7175
|
const baseUrl = await this.getBaseUrl();
|
|
7083
7176
|
const headers = await this.getHeaders();
|
|
7084
|
-
const client =
|
|
7177
|
+
const client = initClient11(runEventsContract, {
|
|
7085
7178
|
baseUrl,
|
|
7086
7179
|
baseHeaders: headers,
|
|
7087
7180
|
jsonQuery: true
|
|
@@ -7103,7 +7196,7 @@ var ApiClient = class {
|
|
|
7103
7196
|
async getSystemLog(runId, options) {
|
|
7104
7197
|
const baseUrl = await this.getBaseUrl();
|
|
7105
7198
|
const headers = await this.getHeaders();
|
|
7106
|
-
const client =
|
|
7199
|
+
const client = initClient11(runSystemLogContract, {
|
|
7107
7200
|
baseUrl,
|
|
7108
7201
|
baseHeaders: headers,
|
|
7109
7202
|
jsonQuery: true
|
|
@@ -7126,7 +7219,7 @@ var ApiClient = class {
|
|
|
7126
7219
|
async getMetrics(runId, options) {
|
|
7127
7220
|
const baseUrl = await this.getBaseUrl();
|
|
7128
7221
|
const headers = await this.getHeaders();
|
|
7129
|
-
const client =
|
|
7222
|
+
const client = initClient11(runMetricsContract, {
|
|
7130
7223
|
baseUrl,
|
|
7131
7224
|
baseHeaders: headers,
|
|
7132
7225
|
jsonQuery: true
|
|
@@ -7149,7 +7242,7 @@ var ApiClient = class {
|
|
|
7149
7242
|
async getAgentEvents(runId, options) {
|
|
7150
7243
|
const baseUrl = await this.getBaseUrl();
|
|
7151
7244
|
const headers = await this.getHeaders();
|
|
7152
|
-
const client =
|
|
7245
|
+
const client = initClient11(runAgentEventsContract, {
|
|
7153
7246
|
baseUrl,
|
|
7154
7247
|
baseHeaders: headers,
|
|
7155
7248
|
jsonQuery: true
|
|
@@ -7172,7 +7265,7 @@ var ApiClient = class {
|
|
|
7172
7265
|
async getNetworkLogs(runId, options) {
|
|
7173
7266
|
const baseUrl = await this.getBaseUrl();
|
|
7174
7267
|
const headers = await this.getHeaders();
|
|
7175
|
-
const client =
|
|
7268
|
+
const client = initClient11(runNetworkLogsContract, {
|
|
7176
7269
|
baseUrl,
|
|
7177
7270
|
baseHeaders: headers,
|
|
7178
7271
|
jsonQuery: true
|
|
@@ -7198,7 +7291,7 @@ var ApiClient = class {
|
|
|
7198
7291
|
async getScope() {
|
|
7199
7292
|
const baseUrl = await this.getBaseUrl();
|
|
7200
7293
|
const headers = await this.getHeaders();
|
|
7201
|
-
const client =
|
|
7294
|
+
const client = initClient11(scopeContract, {
|
|
7202
7295
|
baseUrl,
|
|
7203
7296
|
baseHeaders: headers,
|
|
7204
7297
|
jsonQuery: true
|
|
@@ -7217,7 +7310,7 @@ var ApiClient = class {
|
|
|
7217
7310
|
async createScope(body) {
|
|
7218
7311
|
const baseUrl = await this.getBaseUrl();
|
|
7219
7312
|
const headers = await this.getHeaders();
|
|
7220
|
-
const client =
|
|
7313
|
+
const client = initClient11(scopeContract, {
|
|
7221
7314
|
baseUrl,
|
|
7222
7315
|
baseHeaders: headers,
|
|
7223
7316
|
jsonQuery: true
|
|
@@ -7236,7 +7329,7 @@ var ApiClient = class {
|
|
|
7236
7329
|
async updateScope(body) {
|
|
7237
7330
|
const baseUrl = await this.getBaseUrl();
|
|
7238
7331
|
const headers = await this.getHeaders();
|
|
7239
|
-
const client =
|
|
7332
|
+
const client = initClient11(scopeContract, {
|
|
7240
7333
|
baseUrl,
|
|
7241
7334
|
baseHeaders: headers,
|
|
7242
7335
|
jsonQuery: true
|
|
@@ -7256,7 +7349,7 @@ var ApiClient = class {
|
|
|
7256
7349
|
async getSession(sessionId) {
|
|
7257
7350
|
const baseUrl = await this.getBaseUrl();
|
|
7258
7351
|
const headers = await this.getHeaders();
|
|
7259
|
-
const client =
|
|
7352
|
+
const client = initClient11(sessionsByIdContract, {
|
|
7260
7353
|
baseUrl,
|
|
7261
7354
|
baseHeaders: headers,
|
|
7262
7355
|
jsonQuery: true
|
|
@@ -7278,7 +7371,7 @@ var ApiClient = class {
|
|
|
7278
7371
|
async getCheckpoint(checkpointId) {
|
|
7279
7372
|
const baseUrl = await this.getBaseUrl();
|
|
7280
7373
|
const headers = await this.getHeaders();
|
|
7281
|
-
const client =
|
|
7374
|
+
const client = initClient11(checkpointsByIdContract, {
|
|
7282
7375
|
baseUrl,
|
|
7283
7376
|
baseHeaders: headers,
|
|
7284
7377
|
jsonQuery: true
|
|
@@ -7299,7 +7392,7 @@ var ApiClient = class {
|
|
|
7299
7392
|
async prepareStorage(body) {
|
|
7300
7393
|
const baseUrl = await this.getBaseUrl();
|
|
7301
7394
|
const headers = await this.getHeaders();
|
|
7302
|
-
const client =
|
|
7395
|
+
const client = initClient11(storagesPrepareContract, {
|
|
7303
7396
|
baseUrl,
|
|
7304
7397
|
baseHeaders: headers,
|
|
7305
7398
|
jsonQuery: true
|
|
@@ -7318,7 +7411,7 @@ var ApiClient = class {
|
|
|
7318
7411
|
async commitStorage(body) {
|
|
7319
7412
|
const baseUrl = await this.getBaseUrl();
|
|
7320
7413
|
const headers = await this.getHeaders();
|
|
7321
|
-
const client =
|
|
7414
|
+
const client = initClient11(storagesCommitContract, {
|
|
7322
7415
|
baseUrl,
|
|
7323
7416
|
baseHeaders: headers,
|
|
7324
7417
|
jsonQuery: true
|
|
@@ -7337,7 +7430,7 @@ var ApiClient = class {
|
|
|
7337
7430
|
async getStorageDownload(query) {
|
|
7338
7431
|
const baseUrl = await this.getBaseUrl();
|
|
7339
7432
|
const headers = await this.getHeaders();
|
|
7340
|
-
const client =
|
|
7433
|
+
const client = initClient11(storagesDownloadContract, {
|
|
7341
7434
|
baseUrl,
|
|
7342
7435
|
baseHeaders: headers,
|
|
7343
7436
|
jsonQuery: true
|
|
@@ -7362,7 +7455,7 @@ var ApiClient = class {
|
|
|
7362
7455
|
async listStorages(query) {
|
|
7363
7456
|
const baseUrl = await this.getBaseUrl();
|
|
7364
7457
|
const headers = await this.getHeaders();
|
|
7365
|
-
const client =
|
|
7458
|
+
const client = initClient11(storagesListContract, {
|
|
7366
7459
|
baseUrl,
|
|
7367
7460
|
baseHeaders: headers,
|
|
7368
7461
|
jsonQuery: true
|
|
@@ -7382,7 +7475,7 @@ var ApiClient = class {
|
|
|
7382
7475
|
async deploySchedule(body) {
|
|
7383
7476
|
const baseUrl = await this.getBaseUrl();
|
|
7384
7477
|
const headers = await this.getHeaders();
|
|
7385
|
-
const client =
|
|
7478
|
+
const client = initClient11(schedulesMainContract, {
|
|
7386
7479
|
baseUrl,
|
|
7387
7480
|
baseHeaders: headers,
|
|
7388
7481
|
jsonQuery: true
|
|
@@ -7401,7 +7494,7 @@ var ApiClient = class {
|
|
|
7401
7494
|
async listSchedules() {
|
|
7402
7495
|
const baseUrl = await this.getBaseUrl();
|
|
7403
7496
|
const headers = await this.getHeaders();
|
|
7404
|
-
const client =
|
|
7497
|
+
const client = initClient11(schedulesMainContract, {
|
|
7405
7498
|
baseUrl,
|
|
7406
7499
|
baseHeaders: headers,
|
|
7407
7500
|
jsonQuery: true
|
|
@@ -7420,7 +7513,7 @@ var ApiClient = class {
|
|
|
7420
7513
|
async getScheduleByName(params) {
|
|
7421
7514
|
const baseUrl = await this.getBaseUrl();
|
|
7422
7515
|
const headers = await this.getHeaders();
|
|
7423
|
-
const client =
|
|
7516
|
+
const client = initClient11(schedulesByNameContract, {
|
|
7424
7517
|
baseUrl,
|
|
7425
7518
|
baseHeaders: headers,
|
|
7426
7519
|
jsonQuery: true
|
|
@@ -7442,7 +7535,7 @@ var ApiClient = class {
|
|
|
7442
7535
|
async deleteSchedule(params) {
|
|
7443
7536
|
const baseUrl = await this.getBaseUrl();
|
|
7444
7537
|
const headers = await this.getHeaders();
|
|
7445
|
-
const client =
|
|
7538
|
+
const client = initClient11(schedulesByNameContract, {
|
|
7446
7539
|
baseUrl,
|
|
7447
7540
|
baseHeaders: headers,
|
|
7448
7541
|
jsonQuery: true
|
|
@@ -7464,7 +7557,7 @@ var ApiClient = class {
|
|
|
7464
7557
|
async enableSchedule(params) {
|
|
7465
7558
|
const baseUrl = await this.getBaseUrl();
|
|
7466
7559
|
const headers = await this.getHeaders();
|
|
7467
|
-
const client =
|
|
7560
|
+
const client = initClient11(schedulesEnableContract, {
|
|
7468
7561
|
baseUrl,
|
|
7469
7562
|
baseHeaders: headers,
|
|
7470
7563
|
jsonQuery: true
|
|
@@ -7486,7 +7579,7 @@ var ApiClient = class {
|
|
|
7486
7579
|
async disableSchedule(params) {
|
|
7487
7580
|
const baseUrl = await this.getBaseUrl();
|
|
7488
7581
|
const headers = await this.getHeaders();
|
|
7489
|
-
const client =
|
|
7582
|
+
const client = initClient11(schedulesEnableContract, {
|
|
7490
7583
|
baseUrl,
|
|
7491
7584
|
baseHeaders: headers,
|
|
7492
7585
|
jsonQuery: true
|
|
@@ -7508,7 +7601,7 @@ var ApiClient = class {
|
|
|
7508
7601
|
async listScheduleRuns(params) {
|
|
7509
7602
|
const baseUrl = await this.getBaseUrl();
|
|
7510
7603
|
const headers = await this.getHeaders();
|
|
7511
|
-
const client =
|
|
7604
|
+
const client = initClient11(scheduleRunsContract, {
|
|
7512
7605
|
baseUrl,
|
|
7513
7606
|
baseHeaders: headers,
|
|
7514
7607
|
jsonQuery: true
|
|
@@ -7533,7 +7626,7 @@ var ApiClient = class {
|
|
|
7533
7626
|
async listPublicAgents(query) {
|
|
7534
7627
|
const baseUrl = await this.getBaseUrl();
|
|
7535
7628
|
const headers = await this.getHeaders();
|
|
7536
|
-
const client =
|
|
7629
|
+
const client = initClient11(publicAgentsListContract, {
|
|
7537
7630
|
baseUrl,
|
|
7538
7631
|
baseHeaders: headers,
|
|
7539
7632
|
jsonQuery: true
|
|
@@ -7552,7 +7645,7 @@ var ApiClient = class {
|
|
|
7552
7645
|
async listPublicArtifacts(query) {
|
|
7553
7646
|
const baseUrl = await this.getBaseUrl();
|
|
7554
7647
|
const headers = await this.getHeaders();
|
|
7555
|
-
const client =
|
|
7648
|
+
const client = initClient11(publicArtifactsListContract, {
|
|
7556
7649
|
baseUrl,
|
|
7557
7650
|
baseHeaders: headers,
|
|
7558
7651
|
jsonQuery: true
|
|
@@ -7571,7 +7664,7 @@ var ApiClient = class {
|
|
|
7571
7664
|
async getPublicArtifact(id) {
|
|
7572
7665
|
const baseUrl = await this.getBaseUrl();
|
|
7573
7666
|
const headers = await this.getHeaders();
|
|
7574
|
-
const client =
|
|
7667
|
+
const client = initClient11(publicArtifactByIdContract, {
|
|
7575
7668
|
baseUrl,
|
|
7576
7669
|
baseHeaders: headers,
|
|
7577
7670
|
jsonQuery: true
|
|
@@ -7590,7 +7683,7 @@ var ApiClient = class {
|
|
|
7590
7683
|
async listPublicVolumes(query) {
|
|
7591
7684
|
const baseUrl = await this.getBaseUrl();
|
|
7592
7685
|
const headers = await this.getHeaders();
|
|
7593
|
-
const client =
|
|
7686
|
+
const client = initClient11(publicVolumesListContract, {
|
|
7594
7687
|
baseUrl,
|
|
7595
7688
|
baseHeaders: headers,
|
|
7596
7689
|
jsonQuery: true
|
|
@@ -7609,7 +7702,7 @@ var ApiClient = class {
|
|
|
7609
7702
|
async getPublicVolume(id) {
|
|
7610
7703
|
const baseUrl = await this.getBaseUrl();
|
|
7611
7704
|
const headers = await this.getHeaders();
|
|
7612
|
-
const client =
|
|
7705
|
+
const client = initClient11(publicVolumeByIdContract, {
|
|
7613
7706
|
baseUrl,
|
|
7614
7707
|
baseHeaders: headers,
|
|
7615
7708
|
jsonQuery: true
|
|
@@ -7648,7 +7741,7 @@ var ApiClient = class {
|
|
|
7648
7741
|
async listCredentials() {
|
|
7649
7742
|
const baseUrl = await this.getBaseUrl();
|
|
7650
7743
|
const headers = await this.getHeaders();
|
|
7651
|
-
const client =
|
|
7744
|
+
const client = initClient11(credentialsMainContract, {
|
|
7652
7745
|
baseUrl,
|
|
7653
7746
|
baseHeaders: headers,
|
|
7654
7747
|
jsonQuery: true
|
|
@@ -7667,7 +7760,7 @@ var ApiClient = class {
|
|
|
7667
7760
|
async getCredential(name) {
|
|
7668
7761
|
const baseUrl = await this.getBaseUrl();
|
|
7669
7762
|
const headers = await this.getHeaders();
|
|
7670
|
-
const client =
|
|
7763
|
+
const client = initClient11(credentialsByNameContract, {
|
|
7671
7764
|
baseUrl,
|
|
7672
7765
|
baseHeaders: headers,
|
|
7673
7766
|
jsonQuery: true
|
|
@@ -7688,7 +7781,7 @@ var ApiClient = class {
|
|
|
7688
7781
|
async setCredential(body) {
|
|
7689
7782
|
const baseUrl = await this.getBaseUrl();
|
|
7690
7783
|
const headers = await this.getHeaders();
|
|
7691
|
-
const client =
|
|
7784
|
+
const client = initClient11(credentialsMainContract, {
|
|
7692
7785
|
baseUrl,
|
|
7693
7786
|
baseHeaders: headers,
|
|
7694
7787
|
jsonQuery: true
|
|
@@ -7707,7 +7800,7 @@ var ApiClient = class {
|
|
|
7707
7800
|
async deleteCredential(name) {
|
|
7708
7801
|
const baseUrl = await this.getBaseUrl();
|
|
7709
7802
|
const headers = await this.getHeaders();
|
|
7710
|
-
const client =
|
|
7803
|
+
const client = initClient11(credentialsByNameContract, {
|
|
7711
7804
|
baseUrl,
|
|
7712
7805
|
baseHeaders: headers,
|
|
7713
7806
|
jsonQuery: true
|
|
@@ -7728,7 +7821,7 @@ var ApiClient = class {
|
|
|
7728
7821
|
async getRealtimeToken(runId) {
|
|
7729
7822
|
const baseUrl = await this.getBaseUrl();
|
|
7730
7823
|
const headers = await this.getHeaders();
|
|
7731
|
-
const client =
|
|
7824
|
+
const client = initClient11(realtimeTokenContract, {
|
|
7732
7825
|
baseUrl,
|
|
7733
7826
|
baseHeaders: headers,
|
|
7734
7827
|
jsonQuery: true
|
|
@@ -8199,7 +8292,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
8199
8292
|
" Running agent from other users carries security risks."
|
|
8200
8293
|
)
|
|
8201
8294
|
);
|
|
8202
|
-
console.error(chalk9.dim(" Only run agents from users you trust
|
|
8295
|
+
console.error(chalk9.dim(" Only run agents from users you trust"));
|
|
8203
8296
|
console.error();
|
|
8204
8297
|
console.error("Example:");
|
|
8205
8298
|
console.error(
|
|
@@ -8279,7 +8372,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
8279
8372
|
}
|
|
8280
8373
|
showNextSteps(result);
|
|
8281
8374
|
if (options.autoUpdate !== false) {
|
|
8282
|
-
await silentUpgradeAfterCommand("9.
|
|
8375
|
+
await silentUpgradeAfterCommand("9.26.0");
|
|
8283
8376
|
}
|
|
8284
8377
|
} catch (error) {
|
|
8285
8378
|
handleRunError(error, identifier);
|
|
@@ -8459,7 +8552,7 @@ function formatRunStatus(status, width) {
|
|
|
8459
8552
|
case "pending":
|
|
8460
8553
|
return chalk12.yellow(paddedStatus);
|
|
8461
8554
|
case "completed":
|
|
8462
|
-
return chalk12.
|
|
8555
|
+
return chalk12.dim(paddedStatus);
|
|
8463
8556
|
case "failed":
|
|
8464
8557
|
case "timeout":
|
|
8465
8558
|
return chalk12.red(paddedStatus);
|
|
@@ -8473,6 +8566,7 @@ var listCommand = new Command11().name("list").alias("ls").description("List act
|
|
|
8473
8566
|
const activeRuns = response.runs;
|
|
8474
8567
|
if (activeRuns.length === 0) {
|
|
8475
8568
|
console.log(chalk12.dim("No active runs"));
|
|
8569
|
+
console.log(chalk12.dim(' Run: vm0 run <agent> "<prompt>"'));
|
|
8476
8570
|
return;
|
|
8477
8571
|
}
|
|
8478
8572
|
const agentWidth = Math.max(
|
|
@@ -9637,7 +9731,7 @@ function validateEnvVariables(config, envFile) {
|
|
|
9637
9731
|
try {
|
|
9638
9732
|
const missingVars = checkMissingVariables(requiredVarNames, envFile);
|
|
9639
9733
|
if (missingVars.length > 0) {
|
|
9640
|
-
console.
|
|
9734
|
+
console.error();
|
|
9641
9735
|
console.error(chalk29.red("\u2717 Missing required variables:"));
|
|
9642
9736
|
for (const varName of missingVars) {
|
|
9643
9737
|
console.error(chalk29.red(` ${varName}`));
|
|
@@ -9780,7 +9874,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
|
|
|
9780
9874
|
).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(
|
|
9781
9875
|
async (prompt, options) => {
|
|
9782
9876
|
if (options.autoUpdate !== false) {
|
|
9783
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
9877
|
+
const shouldExit = await checkAndUpgrade("9.26.0", prompt);
|
|
9784
9878
|
if (shouldExit) {
|
|
9785
9879
|
process.exit(0);
|
|
9786
9880
|
}
|
|
@@ -10233,17 +10327,18 @@ async function showNetworkLogs(runId, options) {
|
|
|
10233
10327
|
function handleError2(error, runId) {
|
|
10234
10328
|
if (error instanceof Error) {
|
|
10235
10329
|
if (error.message.includes("Not authenticated")) {
|
|
10236
|
-
console.error(chalk33.red("Not authenticated
|
|
10330
|
+
console.error(chalk33.red("\u2717 Not authenticated"));
|
|
10331
|
+
console.error(chalk33.dim(" Run: vm0 auth login"));
|
|
10237
10332
|
} else if (error.message.includes("not found")) {
|
|
10238
|
-
console.error(chalk33.red(
|
|
10333
|
+
console.error(chalk33.red(`\u2717 Run not found: ${runId}`));
|
|
10239
10334
|
} else if (error.message.includes("Invalid time format")) {
|
|
10240
|
-
console.error(chalk33.red(error.message));
|
|
10335
|
+
console.error(chalk33.red(`\u2717 ${error.message}`));
|
|
10241
10336
|
} else {
|
|
10242
|
-
console.error(chalk33.red("Failed to fetch logs"));
|
|
10337
|
+
console.error(chalk33.red("\u2717 Failed to fetch logs"));
|
|
10243
10338
|
console.error(chalk33.dim(` ${error.message}`));
|
|
10244
10339
|
}
|
|
10245
10340
|
} else {
|
|
10246
|
-
console.error(chalk33.red("An unexpected error occurred"));
|
|
10341
|
+
console.error(chalk33.red("\u2717 An unexpected error occurred"));
|
|
10247
10342
|
}
|
|
10248
10343
|
}
|
|
10249
10344
|
|
|
@@ -11024,10 +11119,10 @@ var initCommand3 = new Command44().name("init").description("Initialize a new VM
|
|
|
11024
11119
|
const existingFiles = checkExistingFiles();
|
|
11025
11120
|
if (existingFiles.length > 0 && !options.force) {
|
|
11026
11121
|
for (const file of existingFiles) {
|
|
11027
|
-
console.
|
|
11122
|
+
console.error(chalk44.red(`\u2717 ${file} already exists`));
|
|
11028
11123
|
}
|
|
11029
|
-
console.
|
|
11030
|
-
console.
|
|
11124
|
+
console.error();
|
|
11125
|
+
console.error(`To overwrite: ${chalk44.cyan("vm0 init --force")}`);
|
|
11031
11126
|
process.exit(1);
|
|
11032
11127
|
}
|
|
11033
11128
|
let agentName;
|
|
@@ -11059,11 +11154,11 @@ var initCommand3 = new Command44().name("init").description("Initialize a new VM
|
|
|
11059
11154
|
agentName = name;
|
|
11060
11155
|
}
|
|
11061
11156
|
if (!agentName || !validateAgentName(agentName)) {
|
|
11062
|
-
console.
|
|
11063
|
-
console.
|
|
11157
|
+
console.error(chalk44.red("\u2717 Invalid agent name"));
|
|
11158
|
+
console.error(
|
|
11064
11159
|
chalk44.dim(" Must be 3-64 characters, alphanumeric and hyphens only")
|
|
11065
11160
|
);
|
|
11066
|
-
console.
|
|
11161
|
+
console.error(chalk44.dim(" Must start and end with letter or number"));
|
|
11067
11162
|
process.exit(1);
|
|
11068
11163
|
}
|
|
11069
11164
|
await writeFile7(VM0_YAML_FILE, generateVm0Yaml(agentName));
|
|
@@ -11740,7 +11835,7 @@ function formatRunStatus2(status) {
|
|
|
11740
11835
|
case "timeout":
|
|
11741
11836
|
return chalk47.red(status);
|
|
11742
11837
|
case "running":
|
|
11743
|
-
return chalk47.
|
|
11838
|
+
return chalk47.cyan(status);
|
|
11744
11839
|
case "pending":
|
|
11745
11840
|
return chalk47.yellow(status);
|
|
11746
11841
|
default:
|
|
@@ -12161,8 +12256,25 @@ var listCommand6 = new Command53().name("list").alias("ls").description("List al
|
|
|
12161
12256
|
console.log(chalk52.bold("Secrets:"));
|
|
12162
12257
|
console.log();
|
|
12163
12258
|
for (const secret of result.secrets) {
|
|
12164
|
-
|
|
12259
|
+
let typeIndicator = "";
|
|
12260
|
+
let derivedLine = null;
|
|
12261
|
+
if (secret.type === "model-provider") {
|
|
12262
|
+
typeIndicator = chalk52.dim(" [model-provider]");
|
|
12263
|
+
} else if (secret.type === "connector") {
|
|
12264
|
+
const derived = getConnectorDerivedNames(secret.name);
|
|
12265
|
+
if (derived) {
|
|
12266
|
+
typeIndicator = chalk52.dim(` [${derived.connectorLabel} connector]`);
|
|
12267
|
+
derivedLine = chalk52.dim(
|
|
12268
|
+
`Available as: ${derived.envVarNames.join(", ")}`
|
|
12269
|
+
);
|
|
12270
|
+
} else {
|
|
12271
|
+
typeIndicator = chalk52.dim(" [connector]");
|
|
12272
|
+
}
|
|
12273
|
+
}
|
|
12165
12274
|
console.log(` ${chalk52.cyan(secret.name)}${typeIndicator}`);
|
|
12275
|
+
if (derivedLine) {
|
|
12276
|
+
console.log(` ${derivedLine}`);
|
|
12277
|
+
}
|
|
12166
12278
|
if (secret.description) {
|
|
12167
12279
|
console.log(` ${chalk52.dim(secret.description)}`);
|
|
12168
12280
|
}
|
|
@@ -12208,9 +12320,9 @@ var setCommand2 = new Command54().name("set").description("Create or update a se
|
|
|
12208
12320
|
console.error(
|
|
12209
12321
|
chalk53.red("\u2717 --body is required in non-interactive mode")
|
|
12210
12322
|
);
|
|
12211
|
-
console.
|
|
12212
|
-
console.
|
|
12213
|
-
console.
|
|
12323
|
+
console.error();
|
|
12324
|
+
console.error("Usage:");
|
|
12325
|
+
console.error(
|
|
12214
12326
|
chalk53.cyan(` vm0 secret set ${name} --body "your-secret-value"`)
|
|
12215
12327
|
);
|
|
12216
12328
|
process.exit(1);
|
|
@@ -12233,11 +12345,11 @@ var setCommand2 = new Command54().name("set").description("Create or update a se
|
|
|
12233
12345
|
);
|
|
12234
12346
|
} else if (error.message.includes("must contain only uppercase")) {
|
|
12235
12347
|
console.error(chalk53.red(`\u2717 ${error.message}`));
|
|
12236
|
-
console.
|
|
12237
|
-
console.
|
|
12238
|
-
console.
|
|
12239
|
-
console.
|
|
12240
|
-
console.
|
|
12348
|
+
console.error();
|
|
12349
|
+
console.error("Examples of valid secret names:");
|
|
12350
|
+
console.error(chalk53.dim(" MY_API_KEY"));
|
|
12351
|
+
console.error(chalk53.dim(" GITHUB_TOKEN"));
|
|
12352
|
+
console.error(chalk53.dim(" AWS_ACCESS_KEY_ID"));
|
|
12241
12353
|
} else {
|
|
12242
12354
|
console.error(chalk53.red(`\u2717 ${error.message}`));
|
|
12243
12355
|
}
|
|
@@ -12369,11 +12481,11 @@ var setCommand3 = new Command58().name("set").description("Create or update a va
|
|
|
12369
12481
|
);
|
|
12370
12482
|
} else if (error.message.includes("must contain only uppercase")) {
|
|
12371
12483
|
console.error(chalk56.red(`\u2717 ${error.message}`));
|
|
12372
|
-
console.
|
|
12373
|
-
console.
|
|
12374
|
-
console.
|
|
12375
|
-
console.
|
|
12376
|
-
console.
|
|
12484
|
+
console.error();
|
|
12485
|
+
console.error("Examples of valid variable names:");
|
|
12486
|
+
console.error(chalk56.dim(" MY_VAR"));
|
|
12487
|
+
console.error(chalk56.dim(" API_URL"));
|
|
12488
|
+
console.error(chalk56.dim(" DEBUG_MODE"));
|
|
12377
12489
|
} else {
|
|
12378
12490
|
console.error(chalk56.red(`\u2717 ${error.message}`));
|
|
12379
12491
|
}
|
|
@@ -12501,10 +12613,10 @@ import prompts2 from "prompts";
|
|
|
12501
12613
|
function validateProviderType(typeStr) {
|
|
12502
12614
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
12503
12615
|
console.error(chalk59.red(`\u2717 Invalid type "${typeStr}"`));
|
|
12504
|
-
console.
|
|
12505
|
-
console.
|
|
12616
|
+
console.error();
|
|
12617
|
+
console.error("Valid types:");
|
|
12506
12618
|
for (const [t, config] of Object.entries(MODEL_PROVIDER_TYPES)) {
|
|
12507
|
-
console.
|
|
12619
|
+
console.error(` ${chalk59.cyan(t)} - ${config.label}`);
|
|
12508
12620
|
}
|
|
12509
12621
|
process.exit(1);
|
|
12510
12622
|
}
|
|
@@ -12517,10 +12629,10 @@ function validateModel(type, modelStr) {
|
|
|
12517
12629
|
}
|
|
12518
12630
|
if (models && !models.includes(modelStr)) {
|
|
12519
12631
|
console.error(chalk59.red(`\u2717 Invalid model "${modelStr}"`));
|
|
12520
|
-
console.
|
|
12521
|
-
console.
|
|
12632
|
+
console.error();
|
|
12633
|
+
console.error("Valid models:");
|
|
12522
12634
|
for (const m of models) {
|
|
12523
|
-
console.
|
|
12635
|
+
console.error(` ${chalk59.cyan(m)}`);
|
|
12524
12636
|
}
|
|
12525
12637
|
process.exit(1);
|
|
12526
12638
|
}
|
|
@@ -12530,11 +12642,11 @@ function validateAuthMethod(type, authMethodStr) {
|
|
|
12530
12642
|
const authMethods = getAuthMethodsForType(type);
|
|
12531
12643
|
if (!authMethods || !(authMethodStr in authMethods)) {
|
|
12532
12644
|
console.error(chalk59.red(`\u2717 Invalid auth method "${authMethodStr}"`));
|
|
12533
|
-
console.
|
|
12534
|
-
console.
|
|
12645
|
+
console.error();
|
|
12646
|
+
console.error("Valid auth methods:");
|
|
12535
12647
|
if (authMethods) {
|
|
12536
12648
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
12537
|
-
console.
|
|
12649
|
+
console.error(` ${chalk59.cyan(method)} - ${config.label}`);
|
|
12538
12650
|
}
|
|
12539
12651
|
}
|
|
12540
12652
|
process.exit(1);
|
|
@@ -12554,11 +12666,11 @@ function parseSecrets(type, authMethod, secretArgs) {
|
|
|
12554
12666
|
console.error(
|
|
12555
12667
|
chalk59.red("\u2717 Must use KEY=VALUE format for multi-secret auth methods")
|
|
12556
12668
|
);
|
|
12557
|
-
console.
|
|
12558
|
-
console.
|
|
12669
|
+
console.error();
|
|
12670
|
+
console.error("Required secrets:");
|
|
12559
12671
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
12560
12672
|
const requiredNote = fieldConfig.required ? " (required)" : "";
|
|
12561
|
-
console.
|
|
12673
|
+
console.error(` ${chalk59.cyan(name)}${requiredNote}`);
|
|
12562
12674
|
}
|
|
12563
12675
|
process.exit(1);
|
|
12564
12676
|
}
|
|
@@ -12574,8 +12686,8 @@ function parseSecrets(type, authMethod, secretArgs) {
|
|
|
12574
12686
|
const eqIndex = arg.indexOf("=");
|
|
12575
12687
|
if (eqIndex === -1) {
|
|
12576
12688
|
console.error(chalk59.red(`\u2717 Invalid secret format "${arg}"`));
|
|
12577
|
-
console.
|
|
12578
|
-
console.
|
|
12689
|
+
console.error();
|
|
12690
|
+
console.error("Use KEY=VALUE format (e.g., AWS_REGION=us-east-1)");
|
|
12579
12691
|
process.exit(1);
|
|
12580
12692
|
}
|
|
12581
12693
|
const key = arg.slice(0, eqIndex);
|
|
@@ -12593,11 +12705,11 @@ function validateSecrets(type, authMethod, secrets) {
|
|
|
12593
12705
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
12594
12706
|
if (fieldConfig.required && !secrets[name]) {
|
|
12595
12707
|
console.error(chalk59.red(`\u2717 Missing required secret: ${name}`));
|
|
12596
|
-
console.
|
|
12597
|
-
console.
|
|
12708
|
+
console.error();
|
|
12709
|
+
console.error("Required secrets:");
|
|
12598
12710
|
for (const [n, fc] of Object.entries(secretsConfig)) {
|
|
12599
12711
|
if (fc.required) {
|
|
12600
|
-
console.
|
|
12712
|
+
console.error(` ${chalk59.cyan(n)} - ${fc.label}`);
|
|
12601
12713
|
}
|
|
12602
12714
|
}
|
|
12603
12715
|
process.exit(1);
|
|
@@ -12606,11 +12718,11 @@ function validateSecrets(type, authMethod, secrets) {
|
|
|
12606
12718
|
for (const name of Object.keys(secrets)) {
|
|
12607
12719
|
if (!(name in secretsConfig)) {
|
|
12608
12720
|
console.error(chalk59.red(`\u2717 Unknown secret: ${name}`));
|
|
12609
|
-
console.
|
|
12610
|
-
console.
|
|
12721
|
+
console.error();
|
|
12722
|
+
console.error("Valid secrets:");
|
|
12611
12723
|
for (const [n, fc] of Object.entries(secretsConfig)) {
|
|
12612
12724
|
const requiredNote = fc.required ? " (required)" : " (optional)";
|
|
12613
|
-
console.
|
|
12725
|
+
console.error(` ${chalk59.cyan(n)}${requiredNote}`);
|
|
12614
12726
|
}
|
|
12615
12727
|
process.exit(1);
|
|
12616
12728
|
}
|
|
@@ -12645,17 +12757,17 @@ function handleNonInteractiveMode(options) {
|
|
|
12645
12757
|
`\u2717 --auth-method is required for "${type}" (multiple auth methods available)`
|
|
12646
12758
|
)
|
|
12647
12759
|
);
|
|
12648
|
-
console.
|
|
12649
|
-
console.
|
|
12760
|
+
console.error();
|
|
12761
|
+
console.error("Available auth methods:");
|
|
12650
12762
|
for (const [method, config] of Object.entries(authMethods)) {
|
|
12651
12763
|
const defaultNote = method === defaultAuthMethod ? " (default)" : "";
|
|
12652
|
-
console.
|
|
12764
|
+
console.error(
|
|
12653
12765
|
` ${chalk59.cyan(method)} - ${config.label}${defaultNote}`
|
|
12654
12766
|
);
|
|
12655
12767
|
}
|
|
12656
|
-
console.
|
|
12657
|
-
console.
|
|
12658
|
-
console.
|
|
12768
|
+
console.error();
|
|
12769
|
+
console.error("Example:");
|
|
12770
|
+
console.error(
|
|
12659
12771
|
chalk59.cyan(
|
|
12660
12772
|
` vm0 model-provider setup --type ${type} --auth-method ${authMethodNames[0]} --secret KEY=VALUE`
|
|
12661
12773
|
)
|
|
@@ -12812,9 +12924,9 @@ async function promptForSecrets(type, authMethod) {
|
|
|
12812
12924
|
async function handleInteractiveMode() {
|
|
12813
12925
|
if (!isInteractive()) {
|
|
12814
12926
|
console.error(chalk59.red("\u2717 Interactive mode requires a TTY"));
|
|
12815
|
-
console.
|
|
12816
|
-
console.
|
|
12817
|
-
console.
|
|
12927
|
+
console.error();
|
|
12928
|
+
console.error("Use non-interactive mode:");
|
|
12929
|
+
console.error(
|
|
12818
12930
|
chalk59.cyan(' vm0 model-provider setup --type <type> --secret "<value>"')
|
|
12819
12931
|
);
|
|
12820
12932
|
process.exit(1);
|
|
@@ -12851,7 +12963,7 @@ async function handleInteractiveMode() {
|
|
|
12851
12963
|
const checkResult = await checkModelProviderSecret(type);
|
|
12852
12964
|
if (checkResult.exists) {
|
|
12853
12965
|
console.log();
|
|
12854
|
-
console.log(`"${type}" is already configured
|
|
12966
|
+
console.log(`"${type}" is already configured`);
|
|
12855
12967
|
console.log();
|
|
12856
12968
|
const actionResponse = await prompts2(
|
|
12857
12969
|
{
|
|
@@ -12908,7 +13020,8 @@ async function handleInteractiveMode() {
|
|
|
12908
13020
|
function handleSetupError2(error) {
|
|
12909
13021
|
if (error instanceof Error) {
|
|
12910
13022
|
if (error.message.includes("Not authenticated")) {
|
|
12911
|
-
console.error(chalk59.red("\u2717 Not authenticated
|
|
13023
|
+
console.error(chalk59.red("\u2717 Not authenticated"));
|
|
13024
|
+
console.error(chalk59.dim(" Run: vm0 auth login"));
|
|
12912
13025
|
} else {
|
|
12913
13026
|
console.error(chalk59.red(`\u2717 ${error.message}`));
|
|
12914
13027
|
}
|
|
@@ -13093,12 +13206,12 @@ var setDefaultCommand = new Command64().name("set-default").description("Set a m
|
|
|
13093
13206
|
var modelProviderCommand = new Command65().name("model-provider").description("Manage model providers for agent runs").addCommand(listCommand8).addCommand(setupCommand2).addCommand(deleteCommand4).addCommand(setDefaultCommand);
|
|
13094
13207
|
|
|
13095
13208
|
// src/commands/connector/index.ts
|
|
13096
|
-
import { Command as
|
|
13209
|
+
import { Command as Command70 } from "commander";
|
|
13097
13210
|
|
|
13098
13211
|
// src/commands/connector/connect.ts
|
|
13099
13212
|
import { Command as Command66 } from "commander";
|
|
13100
13213
|
import chalk62 from "chalk";
|
|
13101
|
-
import { initClient as
|
|
13214
|
+
import { initClient as initClient12 } from "@ts-rest/core";
|
|
13102
13215
|
function delay2(ms) {
|
|
13103
13216
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
13104
13217
|
}
|
|
@@ -13119,7 +13232,7 @@ async function getHeaders2() {
|
|
|
13119
13232
|
var connectCommand = new Command66().name("connect").description("Connect a third-party service (e.g., GitHub)").argument("<type>", "Connector type (e.g., github)").action(async (type) => {
|
|
13120
13233
|
const parseResult = connectorTypeSchema.safeParse(type);
|
|
13121
13234
|
if (!parseResult.success) {
|
|
13122
|
-
console.error(chalk62.red(
|
|
13235
|
+
console.error(chalk62.red(`\u2717 Unknown connector type: ${type}`));
|
|
13123
13236
|
console.error("Available connectors: github");
|
|
13124
13237
|
process.exit(1);
|
|
13125
13238
|
}
|
|
@@ -13127,7 +13240,7 @@ var connectCommand = new Command66().name("connect").description("Connect a thir
|
|
|
13127
13240
|
const apiUrl = await getApiUrl();
|
|
13128
13241
|
const headers = await getHeaders2();
|
|
13129
13242
|
console.log(`Connecting ${chalk62.cyan(type)}...`);
|
|
13130
|
-
const sessionsClient =
|
|
13243
|
+
const sessionsClient = initClient12(connectorSessionsContract, {
|
|
13131
13244
|
baseUrl: apiUrl,
|
|
13132
13245
|
baseHeaders: headers,
|
|
13133
13246
|
jsonQuery: true
|
|
@@ -13139,7 +13252,7 @@ var connectCommand = new Command66().name("connect").description("Connect a thir
|
|
|
13139
13252
|
if (createResult.status !== 200) {
|
|
13140
13253
|
const errorBody = createResult.body;
|
|
13141
13254
|
console.error(
|
|
13142
|
-
chalk62.red(
|
|
13255
|
+
chalk62.red(`\u2717 Failed to create session: ${errorBody.error?.message}`)
|
|
13143
13256
|
);
|
|
13144
13257
|
process.exit(1);
|
|
13145
13258
|
}
|
|
@@ -13148,13 +13261,12 @@ var connectCommand = new Command66().name("connect").description("Connect a thir
|
|
|
13148
13261
|
console.log(chalk62.green("\nSession created"));
|
|
13149
13262
|
console.log(chalk62.cyan(`
|
|
13150
13263
|
To connect, visit: ${verificationUrl}`));
|
|
13151
|
-
console.log(`Session code: ${chalk62.bold(session.code)}`);
|
|
13152
13264
|
console.log(
|
|
13153
13265
|
`
|
|
13154
13266
|
The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
13155
13267
|
);
|
|
13156
13268
|
console.log("\nWaiting for authorization...");
|
|
13157
|
-
const sessionClient =
|
|
13269
|
+
const sessionClient = initClient12(connectorSessionByIdContract, {
|
|
13158
13270
|
baseUrl: apiUrl,
|
|
13159
13271
|
baseHeaders: headers,
|
|
13160
13272
|
jsonQuery: true
|
|
@@ -13175,7 +13287,7 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
13175
13287
|
const errorBody = statusResult.body;
|
|
13176
13288
|
console.error(
|
|
13177
13289
|
chalk62.red(`
|
|
13178
|
-
Failed to check status: ${errorBody.error?.message}`)
|
|
13290
|
+
\u2717 Failed to check status: ${errorBody.error?.message}`)
|
|
13179
13291
|
);
|
|
13180
13292
|
process.exit(1);
|
|
13181
13293
|
}
|
|
@@ -13187,14 +13299,14 @@ Failed to check status: ${errorBody.error?.message}`)
|
|
|
13187
13299
|
${type} connected successfully!`));
|
|
13188
13300
|
return;
|
|
13189
13301
|
case "expired":
|
|
13190
|
-
console.
|
|
13302
|
+
console.error(chalk62.red("\n\u2717 Session expired, please try again"));
|
|
13191
13303
|
process.exit(1);
|
|
13192
13304
|
break;
|
|
13193
13305
|
case "error":
|
|
13194
|
-
console.
|
|
13306
|
+
console.error(
|
|
13195
13307
|
chalk62.red(
|
|
13196
13308
|
`
|
|
13197
|
-
Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
13309
|
+
\u2717 Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
13198
13310
|
)
|
|
13199
13311
|
);
|
|
13200
13312
|
process.exit(1);
|
|
@@ -13204,33 +13316,174 @@ Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
|
13204
13316
|
break;
|
|
13205
13317
|
}
|
|
13206
13318
|
}
|
|
13207
|
-
console.
|
|
13319
|
+
console.error(chalk62.red("\n\u2717 Session timed out, please try again"));
|
|
13208
13320
|
process.exit(1);
|
|
13209
13321
|
});
|
|
13210
13322
|
|
|
13323
|
+
// src/commands/connector/list.ts
|
|
13324
|
+
import { Command as Command67 } from "commander";
|
|
13325
|
+
import chalk63 from "chalk";
|
|
13326
|
+
var listCommand9 = new Command67().name("list").alias("ls").description("List all connectors and their status").action(async () => {
|
|
13327
|
+
try {
|
|
13328
|
+
const result = await listConnectors();
|
|
13329
|
+
const connectedMap = new Map(result.connectors.map((c25) => [c25.type, c25]));
|
|
13330
|
+
const allTypes = Object.keys(CONNECTOR_TYPES);
|
|
13331
|
+
const typeWidth = Math.max(4, ...allTypes.map((t) => t.length));
|
|
13332
|
+
const statusText = "STATUS";
|
|
13333
|
+
const statusWidth = statusText.length;
|
|
13334
|
+
const header = [
|
|
13335
|
+
"TYPE".padEnd(typeWidth),
|
|
13336
|
+
statusText.padEnd(statusWidth),
|
|
13337
|
+
"ACCOUNT"
|
|
13338
|
+
].join(" ");
|
|
13339
|
+
console.log(chalk63.dim(header));
|
|
13340
|
+
for (const type of allTypes) {
|
|
13341
|
+
const connector = connectedMap.get(type);
|
|
13342
|
+
const status = connector ? chalk63.green("\u2713".padEnd(statusWidth)) : chalk63.dim("-".padEnd(statusWidth));
|
|
13343
|
+
const account = connector?.externalUsername ? `@${connector.externalUsername}` : chalk63.dim("-");
|
|
13344
|
+
const row = [type.padEnd(typeWidth), status, account].join(" ");
|
|
13345
|
+
console.log(row);
|
|
13346
|
+
}
|
|
13347
|
+
console.log();
|
|
13348
|
+
console.log(chalk63.dim("To connect a service:"));
|
|
13349
|
+
console.log(chalk63.dim(" vm0 connector connect <type>"));
|
|
13350
|
+
} catch (error) {
|
|
13351
|
+
if (error instanceof Error) {
|
|
13352
|
+
if (error.message.includes("Not authenticated")) {
|
|
13353
|
+
console.error(chalk63.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13354
|
+
} else {
|
|
13355
|
+
console.error(chalk63.red(`\u2717 ${error.message}`));
|
|
13356
|
+
}
|
|
13357
|
+
} else {
|
|
13358
|
+
console.error(chalk63.red("\u2717 An unexpected error occurred"));
|
|
13359
|
+
}
|
|
13360
|
+
process.exit(1);
|
|
13361
|
+
}
|
|
13362
|
+
});
|
|
13363
|
+
|
|
13364
|
+
// src/commands/connector/status.ts
|
|
13365
|
+
import { Command as Command68 } from "commander";
|
|
13366
|
+
import chalk64 from "chalk";
|
|
13367
|
+
var LABEL_WIDTH = 16;
|
|
13368
|
+
var statusCommand7 = new Command68().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").action(async (type) => {
|
|
13369
|
+
try {
|
|
13370
|
+
const parseResult = connectorTypeSchema.safeParse(type);
|
|
13371
|
+
if (!parseResult.success) {
|
|
13372
|
+
console.error(chalk64.red(`\u2717 Unknown connector type: ${type}`));
|
|
13373
|
+
console.error();
|
|
13374
|
+
console.error("Available connectors:");
|
|
13375
|
+
for (const [t, config] of Object.entries(CONNECTOR_TYPES)) {
|
|
13376
|
+
console.error(` ${chalk64.cyan(t)} - ${config.label}`);
|
|
13377
|
+
}
|
|
13378
|
+
process.exit(1);
|
|
13379
|
+
}
|
|
13380
|
+
const connector = await getConnector(parseResult.data);
|
|
13381
|
+
console.log(`Connector: ${chalk64.cyan(type)}`);
|
|
13382
|
+
console.log();
|
|
13383
|
+
if (connector) {
|
|
13384
|
+
console.log(
|
|
13385
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk64.green("connected")}`
|
|
13386
|
+
);
|
|
13387
|
+
console.log(
|
|
13388
|
+
`${"Account:".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`
|
|
13389
|
+
);
|
|
13390
|
+
console.log(
|
|
13391
|
+
`${"Auth Method:".padEnd(LABEL_WIDTH)}${connector.authMethod}`
|
|
13392
|
+
);
|
|
13393
|
+
if (connector.oauthScopes && connector.oauthScopes.length > 0) {
|
|
13394
|
+
console.log(
|
|
13395
|
+
`${"OAuth Scopes:".padEnd(LABEL_WIDTH)}${connector.oauthScopes.join(", ")}`
|
|
13396
|
+
);
|
|
13397
|
+
}
|
|
13398
|
+
console.log(
|
|
13399
|
+
`${"Connected:".padEnd(LABEL_WIDTH)}${formatDateTime(connector.createdAt)}`
|
|
13400
|
+
);
|
|
13401
|
+
if (connector.updatedAt !== connector.createdAt) {
|
|
13402
|
+
console.log(
|
|
13403
|
+
`${"Last Updated:".padEnd(LABEL_WIDTH)}${formatDateTime(connector.updatedAt)}`
|
|
13404
|
+
);
|
|
13405
|
+
}
|
|
13406
|
+
console.log();
|
|
13407
|
+
console.log(chalk64.dim("To disconnect:"));
|
|
13408
|
+
console.log(chalk64.dim(` vm0 connector disconnect ${type}`));
|
|
13409
|
+
} else {
|
|
13410
|
+
console.log(
|
|
13411
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk64.dim("not connected")}`
|
|
13412
|
+
);
|
|
13413
|
+
console.log();
|
|
13414
|
+
console.log(chalk64.dim("To connect:"));
|
|
13415
|
+
console.log(chalk64.dim(` vm0 connector connect ${type}`));
|
|
13416
|
+
}
|
|
13417
|
+
} catch (error) {
|
|
13418
|
+
if (error instanceof Error) {
|
|
13419
|
+
if (error.message.includes("Not authenticated")) {
|
|
13420
|
+
console.error(chalk64.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13421
|
+
} else {
|
|
13422
|
+
console.error(chalk64.red(`\u2717 ${error.message}`));
|
|
13423
|
+
}
|
|
13424
|
+
} else {
|
|
13425
|
+
console.error(chalk64.red("\u2717 An unexpected error occurred"));
|
|
13426
|
+
}
|
|
13427
|
+
process.exit(1);
|
|
13428
|
+
}
|
|
13429
|
+
});
|
|
13430
|
+
|
|
13431
|
+
// src/commands/connector/disconnect.ts
|
|
13432
|
+
import { Command as Command69 } from "commander";
|
|
13433
|
+
import chalk65 from "chalk";
|
|
13434
|
+
var disconnectCommand = new Command69().name("disconnect").description("Disconnect a third-party service").argument("<type>", "Connector type to disconnect (e.g., github)").action(async (type) => {
|
|
13435
|
+
try {
|
|
13436
|
+
const parseResult = connectorTypeSchema.safeParse(type);
|
|
13437
|
+
if (!parseResult.success) {
|
|
13438
|
+
console.error(chalk65.red(`\u2717 Unknown connector type: ${type}`));
|
|
13439
|
+
console.error();
|
|
13440
|
+
console.error("Available connectors:");
|
|
13441
|
+
for (const [t, config] of Object.entries(CONNECTOR_TYPES)) {
|
|
13442
|
+
console.error(` ${chalk65.cyan(t)} - ${config.label}`);
|
|
13443
|
+
}
|
|
13444
|
+
process.exit(1);
|
|
13445
|
+
}
|
|
13446
|
+
await deleteConnector(parseResult.data);
|
|
13447
|
+
console.log(chalk65.green(`\u2713 Disconnected ${type}`));
|
|
13448
|
+
} catch (error) {
|
|
13449
|
+
if (error instanceof Error) {
|
|
13450
|
+
if (error.message.includes("not found")) {
|
|
13451
|
+
console.error(chalk65.red(`\u2717 Connector "${type}" is not connected`));
|
|
13452
|
+
} else if (error.message.includes("Not authenticated")) {
|
|
13453
|
+
console.error(chalk65.red("\u2717 Not authenticated. Run: vm0 auth login"));
|
|
13454
|
+
} else {
|
|
13455
|
+
console.error(chalk65.red(`\u2717 ${error.message}`));
|
|
13456
|
+
}
|
|
13457
|
+
} else {
|
|
13458
|
+
console.error(chalk65.red("\u2717 An unexpected error occurred"));
|
|
13459
|
+
}
|
|
13460
|
+
process.exit(1);
|
|
13461
|
+
}
|
|
13462
|
+
});
|
|
13463
|
+
|
|
13211
13464
|
// src/commands/connector/index.ts
|
|
13212
|
-
var connectorCommand = new
|
|
13465
|
+
var connectorCommand = new Command70().name("connector").description("Manage third-party service connections").addCommand(listCommand9).addCommand(statusCommand7).addCommand(connectCommand).addCommand(disconnectCommand);
|
|
13213
13466
|
|
|
13214
13467
|
// src/commands/onboard/index.ts
|
|
13215
|
-
import { Command as
|
|
13216
|
-
import
|
|
13468
|
+
import { Command as Command71 } from "commander";
|
|
13469
|
+
import chalk69 from "chalk";
|
|
13217
13470
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
13218
13471
|
import { existsSync as existsSync11 } from "fs";
|
|
13219
13472
|
|
|
13220
13473
|
// src/lib/ui/welcome-box.ts
|
|
13221
|
-
import
|
|
13474
|
+
import chalk66 from "chalk";
|
|
13222
13475
|
var gradientColors = [
|
|
13223
|
-
|
|
13476
|
+
chalk66.hex("#FFAB5E"),
|
|
13224
13477
|
// Line 1 - lightest
|
|
13225
|
-
|
|
13478
|
+
chalk66.hex("#FF9642"),
|
|
13226
13479
|
// Line 2
|
|
13227
|
-
|
|
13480
|
+
chalk66.hex("#FF8228"),
|
|
13228
13481
|
// Line 3
|
|
13229
|
-
|
|
13482
|
+
chalk66.hex("#FF6D0A"),
|
|
13230
13483
|
// Line 4
|
|
13231
|
-
|
|
13484
|
+
chalk66.hex("#E85D00"),
|
|
13232
13485
|
// Line 5
|
|
13233
|
-
|
|
13486
|
+
chalk66.hex("#CC4E00")
|
|
13234
13487
|
// Line 6 - darkest
|
|
13235
13488
|
];
|
|
13236
13489
|
var vm0LogoLines = [
|
|
@@ -13252,15 +13505,15 @@ function renderVm0Banner() {
|
|
|
13252
13505
|
function renderOnboardWelcome() {
|
|
13253
13506
|
renderVm0Banner();
|
|
13254
13507
|
console.log(` Build agentic workflows using natural language.`);
|
|
13255
|
-
console.log(` ${
|
|
13508
|
+
console.log(` ${chalk66.dim("Currently in beta, enjoy it free")}`);
|
|
13256
13509
|
console.log(
|
|
13257
|
-
` ${
|
|
13510
|
+
` ${chalk66.dim("Star us on GitHub: https://github.com/vm0-ai/vm0")}`
|
|
13258
13511
|
);
|
|
13259
13512
|
console.log();
|
|
13260
13513
|
}
|
|
13261
13514
|
|
|
13262
13515
|
// src/lib/ui/step-runner.ts
|
|
13263
|
-
import
|
|
13516
|
+
import chalk67 from "chalk";
|
|
13264
13517
|
function createStepRunner(options = true) {
|
|
13265
13518
|
const opts = typeof options === "boolean" ? { interactive: options } : options;
|
|
13266
13519
|
const interactive = opts.interactive ?? true;
|
|
@@ -13275,25 +13528,25 @@ function createStepRunner(options = true) {
|
|
|
13275
13528
|
}
|
|
13276
13529
|
for (const [i, step] of completedSteps.entries()) {
|
|
13277
13530
|
if (step.failed) {
|
|
13278
|
-
console.log(
|
|
13531
|
+
console.log(chalk67.red(`\u2717 ${step.label}`));
|
|
13279
13532
|
} else {
|
|
13280
|
-
console.log(
|
|
13533
|
+
console.log(chalk67.green(`\u25CF ${step.label}`));
|
|
13281
13534
|
}
|
|
13282
13535
|
const isLastStep = i === completedSteps.length - 1;
|
|
13283
13536
|
if (!isLastStep || !isFinal) {
|
|
13284
|
-
console.log(
|
|
13537
|
+
console.log(chalk67.dim("\u2502"));
|
|
13285
13538
|
}
|
|
13286
13539
|
}
|
|
13287
13540
|
}
|
|
13288
13541
|
async function executeStep(label, fn, isFinal) {
|
|
13289
13542
|
let stepFailed = false;
|
|
13290
|
-
console.log(
|
|
13543
|
+
console.log(chalk67.yellow(`\u25CB ${label}`));
|
|
13291
13544
|
const ctx = {
|
|
13292
13545
|
connector() {
|
|
13293
|
-
console.log(
|
|
13546
|
+
console.log(chalk67.dim("\u2502"));
|
|
13294
13547
|
},
|
|
13295
13548
|
detail(message) {
|
|
13296
|
-
console.log(`${
|
|
13549
|
+
console.log(`${chalk67.dim("\u2502")} ${message}`);
|
|
13297
13550
|
},
|
|
13298
13551
|
async prompt(promptFn) {
|
|
13299
13552
|
return await promptFn();
|
|
@@ -13310,12 +13563,12 @@ function createStepRunner(options = true) {
|
|
|
13310
13563
|
redrawCompletedSteps(isFinal);
|
|
13311
13564
|
} else {
|
|
13312
13565
|
if (stepFailed) {
|
|
13313
|
-
console.log(
|
|
13566
|
+
console.log(chalk67.red(`\u2717 ${label}`));
|
|
13314
13567
|
} else {
|
|
13315
|
-
console.log(
|
|
13568
|
+
console.log(chalk67.green(`\u25CF ${label}`));
|
|
13316
13569
|
}
|
|
13317
13570
|
if (!isFinal) {
|
|
13318
|
-
console.log(
|
|
13571
|
+
console.log(chalk67.dim("\u2502"));
|
|
13319
13572
|
}
|
|
13320
13573
|
}
|
|
13321
13574
|
}
|
|
@@ -13472,7 +13725,7 @@ async function setupModelProvider(type, secret, options) {
|
|
|
13472
13725
|
|
|
13473
13726
|
// src/lib/domain/onboard/claude-setup.ts
|
|
13474
13727
|
import { spawn as spawn3 } from "child_process";
|
|
13475
|
-
import
|
|
13728
|
+
import chalk68 from "chalk";
|
|
13476
13729
|
var MARKETPLACE_NAME = "vm0-skills";
|
|
13477
13730
|
var MARKETPLACE_REPO = "vm0-ai/vm0-skills";
|
|
13478
13731
|
var PLUGIN_ID = "vm0@vm0-skills";
|
|
@@ -13509,12 +13762,12 @@ async function runClaudeCommand(args, cwd) {
|
|
|
13509
13762
|
}
|
|
13510
13763
|
function handlePluginError(error, context) {
|
|
13511
13764
|
const displayContext = context ?? "Claude plugin";
|
|
13512
|
-
console.error(
|
|
13765
|
+
console.error(chalk68.red(`\u2717 Failed to install ${displayContext}`));
|
|
13513
13766
|
if (error instanceof Error) {
|
|
13514
|
-
console.error(
|
|
13767
|
+
console.error(chalk68.red(`\u2717 ${error.message}`));
|
|
13515
13768
|
}
|
|
13516
13769
|
console.error(
|
|
13517
|
-
|
|
13770
|
+
chalk68.dim("Please ensure Claude CLI is installed and accessible.")
|
|
13518
13771
|
);
|
|
13519
13772
|
process.exit(1);
|
|
13520
13773
|
}
|
|
@@ -13557,7 +13810,7 @@ async function updateMarketplace() {
|
|
|
13557
13810
|
]);
|
|
13558
13811
|
if (!result.success) {
|
|
13559
13812
|
console.warn(
|
|
13560
|
-
|
|
13813
|
+
chalk68.yellow(
|
|
13561
13814
|
`Warning: Could not update marketplace: ${result.error ?? "unknown error"}`
|
|
13562
13815
|
)
|
|
13563
13816
|
);
|
|
@@ -13595,7 +13848,7 @@ async function handleAuthentication(ctx) {
|
|
|
13595
13848
|
return;
|
|
13596
13849
|
}
|
|
13597
13850
|
if (!ctx.interactive) {
|
|
13598
|
-
console.error(
|
|
13851
|
+
console.error(chalk69.red("\u2717 Not authenticated"));
|
|
13599
13852
|
console.error("Run 'vm0 auth login' first or set VM0_TOKEN");
|
|
13600
13853
|
process.exit(1);
|
|
13601
13854
|
}
|
|
@@ -13603,17 +13856,17 @@ async function handleAuthentication(ctx) {
|
|
|
13603
13856
|
onInitiating: () => {
|
|
13604
13857
|
},
|
|
13605
13858
|
onDeviceCodeReady: (url, code, expiresIn) => {
|
|
13606
|
-
step.detail(`Copy code: ${
|
|
13607
|
-
step.detail(`Open: ${
|
|
13608
|
-
step.detail(
|
|
13859
|
+
step.detail(`Copy code: ${chalk69.cyan.bold(code)}`);
|
|
13860
|
+
step.detail(`Open: ${chalk69.cyan(url)}`);
|
|
13861
|
+
step.detail(chalk69.dim(`Expires in ${expiresIn} minutes`));
|
|
13609
13862
|
},
|
|
13610
13863
|
onPolling: () => {
|
|
13611
13864
|
},
|
|
13612
13865
|
onSuccess: () => {
|
|
13613
13866
|
},
|
|
13614
13867
|
onError: (error) => {
|
|
13615
|
-
console.error(
|
|
13616
|
-
${error.message}`));
|
|
13868
|
+
console.error(chalk69.red(`
|
|
13869
|
+
\u2717 ${error.message}`));
|
|
13617
13870
|
process.exit(1);
|
|
13618
13871
|
}
|
|
13619
13872
|
});
|
|
@@ -13626,7 +13879,7 @@ async function handleModelProvider(ctx) {
|
|
|
13626
13879
|
return;
|
|
13627
13880
|
}
|
|
13628
13881
|
if (!ctx.interactive) {
|
|
13629
|
-
console.error(
|
|
13882
|
+
console.error(chalk69.red("\u2717 No model provider configured"));
|
|
13630
13883
|
console.error("Run 'vm0 model-provider setup' first");
|
|
13631
13884
|
process.exit(1);
|
|
13632
13885
|
}
|
|
@@ -13647,14 +13900,14 @@ async function handleModelProvider(ctx) {
|
|
|
13647
13900
|
const selectedChoice = choices.find((c25) => c25.type === providerType);
|
|
13648
13901
|
if (selectedChoice?.helpText) {
|
|
13649
13902
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
13650
|
-
step.detail(
|
|
13903
|
+
step.detail(chalk69.dim(line));
|
|
13651
13904
|
}
|
|
13652
13905
|
}
|
|
13653
13906
|
const secret = await step.prompt(
|
|
13654
13907
|
() => promptPassword(`Enter your ${selectedChoice?.secretLabel ?? "secret"}:`)
|
|
13655
13908
|
);
|
|
13656
13909
|
if (!secret) {
|
|
13657
|
-
console.log(
|
|
13910
|
+
console.log(chalk69.dim("Cancelled"));
|
|
13658
13911
|
process.exit(0);
|
|
13659
13912
|
}
|
|
13660
13913
|
let selectedModel;
|
|
@@ -13673,7 +13926,7 @@ async function handleModelProvider(ctx) {
|
|
|
13673
13926
|
() => promptSelect("Select model:", modelChoices)
|
|
13674
13927
|
);
|
|
13675
13928
|
if (modelSelection === void 0) {
|
|
13676
|
-
console.log(
|
|
13929
|
+
console.log(chalk69.dim("Cancelled"));
|
|
13677
13930
|
process.exit(0);
|
|
13678
13931
|
}
|
|
13679
13932
|
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
@@ -13683,7 +13936,7 @@ async function handleModelProvider(ctx) {
|
|
|
13683
13936
|
});
|
|
13684
13937
|
const modelNote = result.provider.selectedModel ? ` with model: ${result.provider.selectedModel}` : "";
|
|
13685
13938
|
step.detail(
|
|
13686
|
-
|
|
13939
|
+
chalk69.green(
|
|
13687
13940
|
`${providerType} ${result.created ? "created" : "updated"}${result.isDefault ? ` (default for ${result.framework})` : ""}${modelNote}`
|
|
13688
13941
|
)
|
|
13689
13942
|
);
|
|
@@ -13714,7 +13967,7 @@ async function handleAgentCreation(ctx) {
|
|
|
13714
13967
|
agentName = inputName;
|
|
13715
13968
|
if (existsSync11(agentName)) {
|
|
13716
13969
|
step.detail(
|
|
13717
|
-
|
|
13970
|
+
chalk69.yellow(`${agentName}/ already exists, choose another name`)
|
|
13718
13971
|
);
|
|
13719
13972
|
} else {
|
|
13720
13973
|
folderExists = false;
|
|
@@ -13723,22 +13976,22 @@ async function handleAgentCreation(ctx) {
|
|
|
13723
13976
|
} else {
|
|
13724
13977
|
if (!validateAgentName(agentName)) {
|
|
13725
13978
|
console.error(
|
|
13726
|
-
|
|
13979
|
+
chalk69.red(
|
|
13727
13980
|
"Invalid agent name: must be 3-64 chars, alphanumeric + hyphens"
|
|
13728
13981
|
)
|
|
13729
13982
|
);
|
|
13730
13983
|
process.exit(1);
|
|
13731
13984
|
}
|
|
13732
13985
|
if (existsSync11(agentName)) {
|
|
13733
|
-
console.error(
|
|
13734
|
-
console.
|
|
13735
|
-
console.
|
|
13736
|
-
console.
|
|
13986
|
+
console.error(chalk69.red(`\u2717 ${agentName}/ already exists`));
|
|
13987
|
+
console.error();
|
|
13988
|
+
console.error("Remove it first or choose a different name:");
|
|
13989
|
+
console.error(chalk69.cyan(` rm -rf ${agentName}`));
|
|
13737
13990
|
process.exit(1);
|
|
13738
13991
|
}
|
|
13739
13992
|
}
|
|
13740
13993
|
await mkdir8(agentName, { recursive: true });
|
|
13741
|
-
step.detail(
|
|
13994
|
+
step.detail(chalk69.green(`Created ${agentName}/`));
|
|
13742
13995
|
});
|
|
13743
13996
|
return agentName;
|
|
13744
13997
|
}
|
|
@@ -13754,7 +14007,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
13754
14007
|
shouldInstall = confirmed ?? true;
|
|
13755
14008
|
}
|
|
13756
14009
|
if (!shouldInstall) {
|
|
13757
|
-
step.detail(
|
|
14010
|
+
step.detail(chalk69.dim("Skipped"));
|
|
13758
14011
|
return;
|
|
13759
14012
|
}
|
|
13760
14013
|
const scope = "project";
|
|
@@ -13762,7 +14015,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
13762
14015
|
const agentDir = `${process.cwd()}/${agentName}`;
|
|
13763
14016
|
const result = await installVm0Plugin(scope, agentDir);
|
|
13764
14017
|
step.detail(
|
|
13765
|
-
|
|
14018
|
+
chalk69.green(`Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
13766
14019
|
);
|
|
13767
14020
|
pluginInstalled = true;
|
|
13768
14021
|
} catch (error) {
|
|
@@ -13773,18 +14026,18 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
13773
14026
|
}
|
|
13774
14027
|
function printNextSteps(agentName, pluginInstalled) {
|
|
13775
14028
|
console.log();
|
|
13776
|
-
console.log(
|
|
14029
|
+
console.log(chalk69.bold("Next step:"));
|
|
13777
14030
|
console.log();
|
|
13778
14031
|
if (pluginInstalled) {
|
|
13779
14032
|
console.log(
|
|
13780
|
-
` ${
|
|
14033
|
+
` ${chalk69.cyan(`cd ${agentName} && claude "/${PRIMARY_SKILL_NAME} let's build an agent"`)}`
|
|
13781
14034
|
);
|
|
13782
14035
|
} else {
|
|
13783
|
-
console.log(` ${
|
|
14036
|
+
console.log(` ${chalk69.cyan(`cd ${agentName} && vm0 init`)}`);
|
|
13784
14037
|
}
|
|
13785
14038
|
console.log();
|
|
13786
14039
|
}
|
|
13787
|
-
var onboardCommand = new
|
|
14040
|
+
var onboardCommand = new Command71().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) => {
|
|
13788
14041
|
const interactive = isInteractive();
|
|
13789
14042
|
if (interactive) {
|
|
13790
14043
|
process.stdout.write("\x1B[2J\x1B[H");
|
|
@@ -13807,15 +14060,15 @@ var onboardCommand = new Command68().name("onboard").description("Guided setup f
|
|
|
13807
14060
|
});
|
|
13808
14061
|
|
|
13809
14062
|
// src/commands/setup-claude/index.ts
|
|
13810
|
-
import { Command as
|
|
13811
|
-
import
|
|
13812
|
-
var setupClaudeCommand = new
|
|
13813
|
-
console.log(
|
|
14063
|
+
import { Command as Command72 } from "commander";
|
|
14064
|
+
import chalk70 from "chalk";
|
|
14065
|
+
var setupClaudeCommand = new Command72().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(async (options) => {
|
|
14066
|
+
console.log(chalk70.dim("Installing VM0 Claude Plugin..."));
|
|
13814
14067
|
const scope = options.scope === "user" ? "user" : "project";
|
|
13815
14068
|
try {
|
|
13816
14069
|
const result = await installVm0Plugin(scope, options.agentDir);
|
|
13817
14070
|
console.log(
|
|
13818
|
-
|
|
14071
|
+
chalk70.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
13819
14072
|
);
|
|
13820
14073
|
} catch (error) {
|
|
13821
14074
|
handlePluginError(error);
|
|
@@ -13824,19 +14077,19 @@ var setupClaudeCommand = new Command69().name("setup-claude").description("Insta
|
|
|
13824
14077
|
console.log("Next step:");
|
|
13825
14078
|
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
13826
14079
|
console.log(
|
|
13827
|
-
|
|
14080
|
+
chalk70.cyan(
|
|
13828
14081
|
` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
|
|
13829
14082
|
)
|
|
13830
14083
|
);
|
|
13831
14084
|
});
|
|
13832
14085
|
|
|
13833
14086
|
// src/commands/dev-tool/index.ts
|
|
13834
|
-
import { Command as
|
|
14087
|
+
import { Command as Command74 } from "commander";
|
|
13835
14088
|
|
|
13836
14089
|
// src/commands/dev-tool/compose.ts
|
|
13837
|
-
import { Command as
|
|
13838
|
-
import
|
|
13839
|
-
import { initClient as
|
|
14090
|
+
import { Command as Command73 } from "commander";
|
|
14091
|
+
import chalk71 from "chalk";
|
|
14092
|
+
import { initClient as initClient13 } from "@ts-rest/core";
|
|
13840
14093
|
function sleep2(ms) {
|
|
13841
14094
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
13842
14095
|
}
|
|
@@ -13845,7 +14098,7 @@ function timestamp() {
|
|
|
13845
14098
|
}
|
|
13846
14099
|
async function createComposeJob(githubUrl, overwrite) {
|
|
13847
14100
|
const config = await getClientConfig();
|
|
13848
|
-
const client =
|
|
14101
|
+
const client = initClient13(composeJobsMainContract, config);
|
|
13849
14102
|
const result = await client.create({
|
|
13850
14103
|
body: { githubUrl, overwrite }
|
|
13851
14104
|
});
|
|
@@ -13862,7 +14115,7 @@ async function createComposeJob(githubUrl, overwrite) {
|
|
|
13862
14115
|
}
|
|
13863
14116
|
async function getComposeJobStatus(jobId) {
|
|
13864
14117
|
const config = await getClientConfig();
|
|
13865
|
-
const client =
|
|
14118
|
+
const client = initClient13(composeJobsByIdContract, config);
|
|
13866
14119
|
const result = await client.getById({
|
|
13867
14120
|
params: { jobId }
|
|
13868
14121
|
});
|
|
@@ -13887,7 +14140,7 @@ async function pollUntilComplete(jobId, intervalMs, timeoutMs, jsonMode) {
|
|
|
13887
14140
|
const job = await getComposeJobStatus(jobId);
|
|
13888
14141
|
if (!jsonMode) {
|
|
13889
14142
|
console.log(
|
|
13890
|
-
|
|
14143
|
+
chalk71.dim(`[${timestamp()}] Polling... status=${job.status}`)
|
|
13891
14144
|
);
|
|
13892
14145
|
}
|
|
13893
14146
|
if (job.status === "completed" || job.status === "failed") {
|
|
@@ -13897,7 +14150,7 @@ async function pollUntilComplete(jobId, intervalMs, timeoutMs, jsonMode) {
|
|
|
13897
14150
|
}
|
|
13898
14151
|
throw new Error(`Timeout after ${timeoutMs / 1e3} seconds`);
|
|
13899
14152
|
}
|
|
13900
|
-
var composeCommand2 = new
|
|
14153
|
+
var composeCommand2 = new Command73().name("compose").description("Test server-side GitHub compose API").argument("<github-url>", "GitHub URL to compose from").option("--overwrite", "Overwrite existing compose", false).option(
|
|
13901
14154
|
"--interval <seconds>",
|
|
13902
14155
|
"Polling interval in seconds",
|
|
13903
14156
|
(v) => parseInt(v, 10),
|
|
@@ -13920,7 +14173,7 @@ var composeCommand2 = new Command70().name("compose").description("Test server-s
|
|
|
13920
14173
|
options.overwrite
|
|
13921
14174
|
);
|
|
13922
14175
|
if (!options.json) {
|
|
13923
|
-
console.log(`Job ID: ${
|
|
14176
|
+
console.log(`Job ID: ${chalk71.cyan(jobId)}`);
|
|
13924
14177
|
console.log();
|
|
13925
14178
|
}
|
|
13926
14179
|
if (initialStatus === "completed" || initialStatus === "failed") {
|
|
@@ -13954,7 +14207,7 @@ var composeCommand2 = new Command70().name("compose").description("Test server-s
|
|
|
13954
14207
|
);
|
|
13955
14208
|
} else {
|
|
13956
14209
|
console.error(
|
|
13957
|
-
|
|
14210
|
+
chalk71.red(
|
|
13958
14211
|
`\u2717 ${error instanceof Error ? error.message : String(error)}`
|
|
13959
14212
|
)
|
|
13960
14213
|
);
|
|
@@ -13965,21 +14218,21 @@ var composeCommand2 = new Command70().name("compose").description("Test server-s
|
|
|
13965
14218
|
);
|
|
13966
14219
|
function displayResult(job) {
|
|
13967
14220
|
if (job.status === "completed" && job.result) {
|
|
13968
|
-
console.log(
|
|
13969
|
-
console.log(` Compose ID: ${
|
|
13970
|
-
console.log(` Name: ${
|
|
13971
|
-
console.log(` Version: ${
|
|
14221
|
+
console.log(chalk71.green("\u2713 Compose completed!"));
|
|
14222
|
+
console.log(` Compose ID: ${chalk71.cyan(job.result.composeId)}`);
|
|
14223
|
+
console.log(` Name: ${chalk71.cyan(job.result.composeName)}`);
|
|
14224
|
+
console.log(` Version: ${chalk71.cyan(job.result.versionId.slice(0, 8))}`);
|
|
13972
14225
|
if (job.result.warnings.length > 0) {
|
|
13973
14226
|
console.log();
|
|
13974
|
-
console.log(
|
|
14227
|
+
console.log(chalk71.yellow(" Warnings:"));
|
|
13975
14228
|
for (const warning of job.result.warnings) {
|
|
13976
|
-
console.log(
|
|
14229
|
+
console.log(chalk71.yellow(` - ${warning}`));
|
|
13977
14230
|
}
|
|
13978
14231
|
}
|
|
13979
14232
|
} else if (job.status === "failed") {
|
|
13980
|
-
console.
|
|
14233
|
+
console.error(chalk71.red("\u2717 Compose failed"));
|
|
13981
14234
|
if (job.error) {
|
|
13982
|
-
console.
|
|
14235
|
+
console.error(` Error: ${chalk71.red(job.error)}`);
|
|
13983
14236
|
}
|
|
13984
14237
|
} else {
|
|
13985
14238
|
console.log(`Status: ${job.status}`);
|
|
@@ -13987,11 +14240,11 @@ function displayResult(job) {
|
|
|
13987
14240
|
}
|
|
13988
14241
|
|
|
13989
14242
|
// src/commands/dev-tool/index.ts
|
|
13990
|
-
var devToolCommand = new
|
|
14243
|
+
var devToolCommand = new Command74().name("dev-tool").description("Developer tools for testing and debugging").addCommand(composeCommand2);
|
|
13991
14244
|
|
|
13992
14245
|
// src/index.ts
|
|
13993
|
-
var program = new
|
|
13994
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
14246
|
+
var program = new Command75();
|
|
14247
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.26.0");
|
|
13995
14248
|
program.addCommand(authCommand);
|
|
13996
14249
|
program.addCommand(infoCommand);
|
|
13997
14250
|
program.addCommand(composeCommand);
|