@vm0/cli 9.58.1 → 9.59.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 +693 -602
- 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.59.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.59.0",
|
|
68
68
|
command: process.argv.slice(2).join(" ")
|
|
69
69
|
});
|
|
70
70
|
Sentry.setContext("runtime", {
|
|
@@ -673,7 +673,7 @@ function getConfigPath() {
|
|
|
673
673
|
return join2(homedir2(), ".vm0", "config.json");
|
|
674
674
|
}
|
|
675
675
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
676
|
-
console.log(chalk4.bold(`VM0 CLI v${"9.
|
|
676
|
+
console.log(chalk4.bold(`VM0 CLI v${"9.59.0"}`));
|
|
677
677
|
console.log();
|
|
678
678
|
const config = await loadConfig();
|
|
679
679
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -704,7 +704,7 @@ var infoCommand = new Command6().name("info").description("Display environment a
|
|
|
704
704
|
|
|
705
705
|
// src/commands/compose/index.ts
|
|
706
706
|
import { Command as Command7, Option } from "commander";
|
|
707
|
-
import
|
|
707
|
+
import chalk6 from "chalk";
|
|
708
708
|
import { readFile as readFile4, rm as rm3 } from "fs/promises";
|
|
709
709
|
import { existsSync as existsSync5 } from "fs";
|
|
710
710
|
import { dirname as dirname2, join as join8 } from "path";
|
|
@@ -871,6 +871,8 @@ var storedExecutionContextSchema = z3.object({
|
|
|
871
871
|
resumeSession: resumeSessionSchema.nullable(),
|
|
872
872
|
encryptedSecrets: z3.string().nullable(),
|
|
873
873
|
// AES-256-GCM encrypted Record<string, string> (secret name → value)
|
|
874
|
+
// Maps secret names to OAuth connector types for runtime token refresh (e.g. { "GMAIL_ACCESS_TOKEN": "gmail" })
|
|
875
|
+
secretConnectorMap: z3.record(z3.string(), z3.string()).nullable().optional(),
|
|
874
876
|
cliAgentType: z3.string(),
|
|
875
877
|
experimentalFirewall: experimentalFirewallSchema.optional(),
|
|
876
878
|
// Debug flag to force real Claude in mock environments (internal use only)
|
|
@@ -902,6 +904,8 @@ var executionContextSchema = z3.object({
|
|
|
902
904
|
secretValues: z3.array(z3.string()).nullable(),
|
|
903
905
|
// AES-256-GCM encrypted Record<string, string> — passed through to mitm-addon for auth resolution
|
|
904
906
|
encryptedSecrets: z3.string().nullable(),
|
|
907
|
+
// Maps secret names to OAuth connector types for runtime token refresh
|
|
908
|
+
secretConnectorMap: z3.record(z3.string(), z3.string()).nullable().optional(),
|
|
905
909
|
cliAgentType: z3.string(),
|
|
906
910
|
// Experimental firewall configuration
|
|
907
911
|
experimentalFirewall: experimentalFirewallSchema.optional(),
|
|
@@ -7213,6 +7217,40 @@ var onboardingStatusContract = c22.router({
|
|
|
7213
7217
|
}
|
|
7214
7218
|
});
|
|
7215
7219
|
|
|
7220
|
+
// ../../packages/core/src/contracts/skills.ts
|
|
7221
|
+
import { z as z25 } from "zod";
|
|
7222
|
+
var c23 = initContract();
|
|
7223
|
+
var skillFrontmatterSchema = z25.object({
|
|
7224
|
+
name: z25.string().optional(),
|
|
7225
|
+
description: z25.string().optional(),
|
|
7226
|
+
vm0_secrets: z25.array(z25.string()).optional(),
|
|
7227
|
+
vm0_vars: z25.array(z25.string()).optional()
|
|
7228
|
+
});
|
|
7229
|
+
var resolvedSkillSchema = z25.object({
|
|
7230
|
+
storageName: z25.string(),
|
|
7231
|
+
versionHash: z25.string(),
|
|
7232
|
+
frontmatter: skillFrontmatterSchema
|
|
7233
|
+
});
|
|
7234
|
+
var skillsResolveContract = c23.router({
|
|
7235
|
+
resolve: {
|
|
7236
|
+
method: "POST",
|
|
7237
|
+
path: "/api/skills/resolve",
|
|
7238
|
+
headers: authHeadersSchema,
|
|
7239
|
+
body: z25.object({
|
|
7240
|
+
skills: z25.array(z25.string().url()).min(1).max(100)
|
|
7241
|
+
}),
|
|
7242
|
+
responses: {
|
|
7243
|
+
200: z25.object({
|
|
7244
|
+
resolved: z25.record(z25.string(), resolvedSkillSchema),
|
|
7245
|
+
unresolved: z25.array(z25.string())
|
|
7246
|
+
}),
|
|
7247
|
+
400: apiErrorSchema,
|
|
7248
|
+
401: apiErrorSchema
|
|
7249
|
+
},
|
|
7250
|
+
summary: "Batch resolve skill URLs to cached version info"
|
|
7251
|
+
}
|
|
7252
|
+
});
|
|
7253
|
+
|
|
7216
7254
|
// ../../packages/core/src/org-reference.ts
|
|
7217
7255
|
function isLegacySystemTemplate(reference) {
|
|
7218
7256
|
return reference.startsWith("vm0-");
|
|
@@ -8348,9 +8386,45 @@ async function updateUserPreferences(body) {
|
|
|
8348
8386
|
handleError(result, "Failed to update user preferences");
|
|
8349
8387
|
}
|
|
8350
8388
|
|
|
8389
|
+
// src/lib/api/domains/skills.ts
|
|
8390
|
+
import chalk5 from "chalk";
|
|
8391
|
+
function isResolveSkillsResponse(value) {
|
|
8392
|
+
if (typeof value !== "object" || value === null) return false;
|
|
8393
|
+
const obj = value;
|
|
8394
|
+
return typeof obj.resolved === "object" && obj.resolved !== null && Array.isArray(obj.unresolved);
|
|
8395
|
+
}
|
|
8396
|
+
async function resolveSkills(skillUrls) {
|
|
8397
|
+
try {
|
|
8398
|
+
const response = await httpPost("/api/skills/resolve", {
|
|
8399
|
+
skills: skillUrls
|
|
8400
|
+
});
|
|
8401
|
+
if (!response.ok) {
|
|
8402
|
+
console.error(
|
|
8403
|
+
chalk5.dim(" Skill resolve unavailable, downloading all skills")
|
|
8404
|
+
);
|
|
8405
|
+
return { resolved: {}, unresolved: skillUrls };
|
|
8406
|
+
}
|
|
8407
|
+
const body = await response.json();
|
|
8408
|
+
if (!isResolveSkillsResponse(body)) {
|
|
8409
|
+
console.error(
|
|
8410
|
+
chalk5.dim(
|
|
8411
|
+
" Skill resolve returned unexpected format, downloading all skills"
|
|
8412
|
+
)
|
|
8413
|
+
);
|
|
8414
|
+
return { resolved: {}, unresolved: skillUrls };
|
|
8415
|
+
}
|
|
8416
|
+
return body;
|
|
8417
|
+
} catch {
|
|
8418
|
+
console.error(
|
|
8419
|
+
chalk5.dim(" Skill resolve unavailable, downloading all skills")
|
|
8420
|
+
);
|
|
8421
|
+
return { resolved: {}, unresolved: skillUrls };
|
|
8422
|
+
}
|
|
8423
|
+
}
|
|
8424
|
+
|
|
8351
8425
|
// src/lib/domain/yaml-validator.ts
|
|
8352
|
-
import { z as
|
|
8353
|
-
var cliAgentNameSchema =
|
|
8426
|
+
import { z as z26 } from "zod";
|
|
8427
|
+
var cliAgentNameSchema = z26.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
|
|
8354
8428
|
/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
|
|
8355
8429
|
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
8356
8430
|
);
|
|
@@ -8364,7 +8438,7 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
8364
8438
|
resolveSkillRef(skillRef);
|
|
8365
8439
|
} catch (error) {
|
|
8366
8440
|
ctx.addIssue({
|
|
8367
|
-
code:
|
|
8441
|
+
code: z26.ZodIssueCode.custom,
|
|
8368
8442
|
message: error instanceof Error ? error.message : `Invalid skill reference: ${skillRef}`,
|
|
8369
8443
|
path: ["skills", i]
|
|
8370
8444
|
});
|
|
@@ -8374,15 +8448,15 @@ var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
|
8374
8448
|
}
|
|
8375
8449
|
}
|
|
8376
8450
|
);
|
|
8377
|
-
var cliComposeSchema =
|
|
8378
|
-
version:
|
|
8379
|
-
agents:
|
|
8380
|
-
volumes:
|
|
8451
|
+
var cliComposeSchema = z26.object({
|
|
8452
|
+
version: z26.string().min(1, "Missing config.version"),
|
|
8453
|
+
agents: z26.record(cliAgentNameSchema, cliAgentDefinitionSchema),
|
|
8454
|
+
volumes: z26.record(z26.string(), volumeConfigSchema).optional()
|
|
8381
8455
|
}).superRefine((config, ctx) => {
|
|
8382
8456
|
const agentKeys = Object.keys(config.agents);
|
|
8383
8457
|
if (agentKeys.length === 0) {
|
|
8384
8458
|
ctx.addIssue({
|
|
8385
|
-
code:
|
|
8459
|
+
code: z26.ZodIssueCode.custom,
|
|
8386
8460
|
message: "agents must have at least one agent defined",
|
|
8387
8461
|
path: ["agents"]
|
|
8388
8462
|
});
|
|
@@ -8390,7 +8464,7 @@ var cliComposeSchema = z25.object({
|
|
|
8390
8464
|
}
|
|
8391
8465
|
if (agentKeys.length > 1) {
|
|
8392
8466
|
ctx.addIssue({
|
|
8393
|
-
code:
|
|
8467
|
+
code: z26.ZodIssueCode.custom,
|
|
8394
8468
|
message: "Multiple agents not supported yet. Only one agent allowed.",
|
|
8395
8469
|
path: ["agents"]
|
|
8396
8470
|
});
|
|
@@ -8402,7 +8476,7 @@ var cliComposeSchema = z25.object({
|
|
|
8402
8476
|
if (agentVolumes && agentVolumes.length > 0) {
|
|
8403
8477
|
if (!config.volumes) {
|
|
8404
8478
|
ctx.addIssue({
|
|
8405
|
-
code:
|
|
8479
|
+
code: z26.ZodIssueCode.custom,
|
|
8406
8480
|
message: "Agent references volumes but no volumes section defined. Each volume must have explicit name and version.",
|
|
8407
8481
|
path: ["volumes"]
|
|
8408
8482
|
});
|
|
@@ -8412,7 +8486,7 @@ var cliComposeSchema = z25.object({
|
|
|
8412
8486
|
const parts = volDeclaration.split(":");
|
|
8413
8487
|
if (parts.length !== 2) {
|
|
8414
8488
|
ctx.addIssue({
|
|
8415
|
-
code:
|
|
8489
|
+
code: z26.ZodIssueCode.custom,
|
|
8416
8490
|
message: `Invalid volume declaration: ${volDeclaration}. Expected format: volume-key:/mount/path`,
|
|
8417
8491
|
path: ["agents", agentName, "volumes"]
|
|
8418
8492
|
});
|
|
@@ -8421,7 +8495,7 @@ var cliComposeSchema = z25.object({
|
|
|
8421
8495
|
const volumeKey = parts[0].trim();
|
|
8422
8496
|
if (!config.volumes[volumeKey]) {
|
|
8423
8497
|
ctx.addIssue({
|
|
8424
|
-
code:
|
|
8498
|
+
code: z26.ZodIssueCode.custom,
|
|
8425
8499
|
message: `Volume "${volumeKey}" is not defined in volumes section. Each volume must have explicit name and version.`,
|
|
8426
8500
|
path: ["volumes", volumeKey]
|
|
8427
8501
|
});
|
|
@@ -9248,13 +9322,13 @@ function checkLegacyImageFormat(config) {
|
|
|
9248
9322
|
const image = agentConfig.image;
|
|
9249
9323
|
if (image) {
|
|
9250
9324
|
console.log(
|
|
9251
|
-
|
|
9325
|
+
chalk6.yellow(
|
|
9252
9326
|
`\u26A0 Agent "${name}": 'image' field is deprecated and will be ignored. The server resolves the image based on the framework.`
|
|
9253
9327
|
)
|
|
9254
9328
|
);
|
|
9255
9329
|
const warning = getLegacySystemTemplateWarning(image);
|
|
9256
9330
|
if (warning) {
|
|
9257
|
-
console.log(
|
|
9331
|
+
console.log(chalk6.yellow(` ${warning}`));
|
|
9258
9332
|
}
|
|
9259
9333
|
}
|
|
9260
9334
|
}
|
|
@@ -9273,7 +9347,7 @@ async function uploadAssets(agentName, agent, basePath, jsonMode) {
|
|
|
9273
9347
|
);
|
|
9274
9348
|
if (!jsonMode) {
|
|
9275
9349
|
console.log(
|
|
9276
|
-
|
|
9350
|
+
chalk6.green(
|
|
9277
9351
|
`\u2713 Instructions ${result.action === "deduplicated" ? "(unchanged)" : "uploaded"}: ${result.versionId.slice(0, 8)}`
|
|
9278
9352
|
)
|
|
9279
9353
|
);
|
|
@@ -9285,15 +9359,32 @@ async function uploadAssets(agentName, agent, basePath, jsonMode) {
|
|
|
9285
9359
|
if (!jsonMode) {
|
|
9286
9360
|
console.log(`Uploading ${agent.skills.length} skill(s)...`);
|
|
9287
9361
|
}
|
|
9362
|
+
const { resolved, unresolved } = await resolveSkills(agent.skills);
|
|
9288
9363
|
for (const skillUrl of agent.skills) {
|
|
9364
|
+
const skill = resolved[skillUrl];
|
|
9365
|
+
if (skill) {
|
|
9366
|
+
const parsed = parseGitHubTreeUrl2(skillUrl);
|
|
9367
|
+
skillResults.push({
|
|
9368
|
+
name: skill.storageName,
|
|
9369
|
+
versionId: skill.versionHash,
|
|
9370
|
+
action: "resolved",
|
|
9371
|
+
skillName: parsed.skillName,
|
|
9372
|
+
frontmatter: skill.frontmatter
|
|
9373
|
+
});
|
|
9374
|
+
if (!jsonMode) {
|
|
9375
|
+
console.log(chalk6.green(` \u2713 ${parsed.skillName} (cached)`));
|
|
9376
|
+
}
|
|
9377
|
+
}
|
|
9378
|
+
}
|
|
9379
|
+
for (const skillUrl of unresolved) {
|
|
9289
9380
|
if (!jsonMode) {
|
|
9290
|
-
console.log(
|
|
9381
|
+
console.log(chalk6.dim(` Downloading: ${skillUrl}`));
|
|
9291
9382
|
}
|
|
9292
9383
|
const result = await uploadSkill(skillUrl);
|
|
9293
9384
|
skillResults.push(result);
|
|
9294
9385
|
if (!jsonMode) {
|
|
9295
9386
|
console.log(
|
|
9296
|
-
|
|
9387
|
+
chalk6.green(
|
|
9297
9388
|
` \u2713 Skill ${result.action === "deduplicated" ? "(unchanged)" : "uploaded"}: ${result.skillName} (${result.versionId.slice(0, 8)})`
|
|
9298
9389
|
)
|
|
9299
9390
|
);
|
|
@@ -9346,21 +9437,21 @@ async function displayAndConfirmVariables(variables, options) {
|
|
|
9346
9437
|
if (!options.json) {
|
|
9347
9438
|
console.log();
|
|
9348
9439
|
console.log(
|
|
9349
|
-
|
|
9440
|
+
chalk6.bold("Skills require the following environment variables:")
|
|
9350
9441
|
);
|
|
9351
9442
|
console.log();
|
|
9352
9443
|
if (newSecrets.length > 0) {
|
|
9353
|
-
console.log(
|
|
9444
|
+
console.log(chalk6.cyan(" Secrets:"));
|
|
9354
9445
|
for (const [name, skills] of newSecrets) {
|
|
9355
9446
|
const isNew = trulyNewSecrets.includes(name);
|
|
9356
|
-
const newMarker = isNew ?
|
|
9447
|
+
const newMarker = isNew ? chalk6.yellow(" (new)") : "";
|
|
9357
9448
|
console.log(
|
|
9358
9449
|
` ${name.padEnd(24)}${newMarker} <- ${skills.join(", ")}`
|
|
9359
9450
|
);
|
|
9360
9451
|
}
|
|
9361
9452
|
}
|
|
9362
9453
|
if (newVars.length > 0) {
|
|
9363
|
-
console.log(
|
|
9454
|
+
console.log(chalk6.cyan(" Vars:"));
|
|
9364
9455
|
for (const [name, skills] of newVars) {
|
|
9365
9456
|
console.log(` ${name.padEnd(24)} <- ${skills.join(", ")}`);
|
|
9366
9457
|
}
|
|
@@ -9381,7 +9472,7 @@ async function displayAndConfirmVariables(variables, options) {
|
|
|
9381
9472
|
);
|
|
9382
9473
|
if (!confirmed) {
|
|
9383
9474
|
if (!options.json) {
|
|
9384
|
-
console.log(
|
|
9475
|
+
console.log(chalk6.yellow("Compose cancelled"));
|
|
9385
9476
|
}
|
|
9386
9477
|
return false;
|
|
9387
9478
|
}
|
|
@@ -9634,11 +9725,11 @@ async function checkAndPromptMissingItems(config, options) {
|
|
|
9634
9725
|
if (!options.json) {
|
|
9635
9726
|
console.log();
|
|
9636
9727
|
console.log(
|
|
9637
|
-
|
|
9728
|
+
chalk6.yellow(
|
|
9638
9729
|
"\u26A0 Missing secrets/variables detected. Set them up before running your agent:"
|
|
9639
9730
|
)
|
|
9640
9731
|
);
|
|
9641
|
-
console.log(
|
|
9732
|
+
console.log(chalk6.cyan(` ${setupUrl}`));
|
|
9642
9733
|
console.log();
|
|
9643
9734
|
}
|
|
9644
9735
|
return { missingSecrets, missingVars, setupUrl };
|
|
@@ -9672,15 +9763,15 @@ async function finalizeCompose(config, agent, variables, options) {
|
|
|
9672
9763
|
}
|
|
9673
9764
|
if (!options.json) {
|
|
9674
9765
|
if (response.action === "created") {
|
|
9675
|
-
console.log(
|
|
9766
|
+
console.log(chalk6.green(`\u2713 Compose created: ${displayName}`));
|
|
9676
9767
|
} else {
|
|
9677
|
-
console.log(
|
|
9768
|
+
console.log(chalk6.green(`\u2713 Compose version exists: ${displayName}`));
|
|
9678
9769
|
}
|
|
9679
|
-
console.log(
|
|
9770
|
+
console.log(chalk6.dim(` Version: ${shortVersionId}`));
|
|
9680
9771
|
console.log();
|
|
9681
9772
|
console.log(" Run your agent:");
|
|
9682
9773
|
console.log(
|
|
9683
|
-
|
|
9774
|
+
chalk6.cyan(
|
|
9684
9775
|
` vm0 run ${displayName}:${shortVersionId} --artifact-name <artifact> "your prompt"`
|
|
9685
9776
|
)
|
|
9686
9777
|
);
|
|
@@ -9708,7 +9799,7 @@ async function handleGitHubCompose(url, options) {
|
|
|
9708
9799
|
if (!options.json) {
|
|
9709
9800
|
console.log();
|
|
9710
9801
|
console.log(
|
|
9711
|
-
|
|
9802
|
+
chalk6.yellow(`\u26A0 An agent named "${agentName}" already exists.`)
|
|
9712
9803
|
);
|
|
9713
9804
|
}
|
|
9714
9805
|
if (!isInteractive()) {
|
|
@@ -9729,7 +9820,7 @@ async function handleGitHubCompose(url, options) {
|
|
|
9729
9820
|
);
|
|
9730
9821
|
if (!confirmed) {
|
|
9731
9822
|
if (!options.json) {
|
|
9732
|
-
console.log(
|
|
9823
|
+
console.log(chalk6.yellow("Compose cancelled."));
|
|
9733
9824
|
}
|
|
9734
9825
|
process.exit(0);
|
|
9735
9826
|
}
|
|
@@ -9778,7 +9869,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9778
9869
|
const resolvedConfigFile = configFile ?? DEFAULT_CONFIG_FILE;
|
|
9779
9870
|
if (options.porcelain && !options.json) {
|
|
9780
9871
|
console.error(
|
|
9781
|
-
|
|
9872
|
+
chalk6.yellow("\u26A0 --porcelain is deprecated, use --json instead")
|
|
9782
9873
|
);
|
|
9783
9874
|
options.json = true;
|
|
9784
9875
|
}
|
|
@@ -9787,7 +9878,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9787
9878
|
options.autoUpdate = false;
|
|
9788
9879
|
}
|
|
9789
9880
|
if (options.autoUpdate !== false) {
|
|
9790
|
-
await startSilentUpgrade("9.
|
|
9881
|
+
await startSilentUpgrade("9.59.0");
|
|
9791
9882
|
}
|
|
9792
9883
|
try {
|
|
9793
9884
|
let result;
|
|
@@ -9831,7 +9922,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9831
9922
|
import { Command as Command8, Option as Option2 } from "commander";
|
|
9832
9923
|
|
|
9833
9924
|
// src/commands/run/shared.ts
|
|
9834
|
-
import
|
|
9925
|
+
import chalk10 from "chalk";
|
|
9835
9926
|
import * as fs6 from "fs";
|
|
9836
9927
|
import { config as dotenvConfig } from "dotenv";
|
|
9837
9928
|
|
|
@@ -10119,9 +10210,9 @@ var CodexEventParser = class {
|
|
|
10119
10210
|
if (!item.changes || item.changes.length === 0) {
|
|
10120
10211
|
return null;
|
|
10121
10212
|
}
|
|
10122
|
-
const changes = item.changes.map((
|
|
10123
|
-
const action =
|
|
10124
|
-
return `${action}: ${
|
|
10213
|
+
const changes = item.changes.map((c24) => {
|
|
10214
|
+
const action = c24.kind === "add" ? "Created" : c24.kind === "modify" ? "Modified" : "Deleted";
|
|
10215
|
+
return `${action}: ${c24.path}`;
|
|
10125
10216
|
}).join("\n");
|
|
10126
10217
|
return {
|
|
10127
10218
|
type: "text",
|
|
@@ -10173,10 +10264,10 @@ function parseEvent(rawEvent, framework) {
|
|
|
10173
10264
|
}
|
|
10174
10265
|
|
|
10175
10266
|
// src/lib/events/event-renderer.ts
|
|
10176
|
-
import
|
|
10267
|
+
import chalk8 from "chalk";
|
|
10177
10268
|
|
|
10178
10269
|
// src/lib/events/tool-formatters.ts
|
|
10179
|
-
import
|
|
10270
|
+
import chalk7 from "chalk";
|
|
10180
10271
|
function pluralize(count, singular, plural) {
|
|
10181
10272
|
return count === 1 ? singular : plural;
|
|
10182
10273
|
}
|
|
@@ -10190,15 +10281,15 @@ function formatToolHeader(data) {
|
|
|
10190
10281
|
return [headline];
|
|
10191
10282
|
}
|
|
10192
10283
|
var toolHeadlineFormatters = {
|
|
10193
|
-
Read: (input) => `Read${
|
|
10194
|
-
Edit: (input) => `Edit${
|
|
10195
|
-
Write: (input) => `Write${
|
|
10196
|
-
Bash: (input) => `Bash${
|
|
10197
|
-
Glob: (input) => `Glob${
|
|
10198
|
-
Grep: (input) => `Grep${
|
|
10199
|
-
Task: (input) => `Task${
|
|
10200
|
-
WebFetch: (input) => `WebFetch${
|
|
10201
|
-
WebSearch: (input) => `WebSearch${
|
|
10284
|
+
Read: (input) => `Read${chalk7.dim(`(${String(input.file_path || "")})`)}`,
|
|
10285
|
+
Edit: (input) => `Edit${chalk7.dim(`(${String(input.file_path || "")})`)}`,
|
|
10286
|
+
Write: (input) => `Write${chalk7.dim(`(${String(input.file_path || "")})`)}`,
|
|
10287
|
+
Bash: (input) => `Bash${chalk7.dim(`(${truncate(String(input.command || ""), 60)})`)}`,
|
|
10288
|
+
Glob: (input) => `Glob${chalk7.dim(`(${String(input.pattern || "")})`)}`,
|
|
10289
|
+
Grep: (input) => `Grep${chalk7.dim(`(${String(input.pattern || "")})`)}`,
|
|
10290
|
+
Task: (input) => `Task${chalk7.dim(`(${truncate(String(input.description || ""), 60)})`)}`,
|
|
10291
|
+
WebFetch: (input) => `WebFetch${chalk7.dim(`(${truncate(String(input.url || ""), 60)})`)}`,
|
|
10292
|
+
WebSearch: (input) => `WebSearch${chalk7.dim(`(${truncate(String(input.query || ""), 60)})`)}`,
|
|
10202
10293
|
TodoWrite: () => "TodoWrite"
|
|
10203
10294
|
};
|
|
10204
10295
|
function getToolHeadline(tool, input) {
|
|
@@ -10231,7 +10322,7 @@ function formatToolResult(toolUse, result, verbose) {
|
|
|
10231
10322
|
}
|
|
10232
10323
|
if (isError) {
|
|
10233
10324
|
const errorMsg = resultText ? truncate(resultText, 80) : "Error";
|
|
10234
|
-
lines.push(`\u2514 \u2717 ${
|
|
10325
|
+
lines.push(`\u2514 \u2717 ${chalk7.dim(errorMsg)}`);
|
|
10235
10326
|
return lines;
|
|
10236
10327
|
}
|
|
10237
10328
|
if (resultText) {
|
|
@@ -10239,23 +10330,23 @@ function formatToolResult(toolUse, result, verbose) {
|
|
|
10239
10330
|
if (verbose) {
|
|
10240
10331
|
for (let i = 0; i < resultLines.length; i++) {
|
|
10241
10332
|
const prefix = i === 0 ? "\u2514 " : " ";
|
|
10242
|
-
lines.push(`${prefix}${
|
|
10333
|
+
lines.push(`${prefix}${chalk7.dim(resultLines[i])}`);
|
|
10243
10334
|
}
|
|
10244
10335
|
} else if (resultLines.length > 0) {
|
|
10245
10336
|
const previewCount = Math.min(3, resultLines.length);
|
|
10246
10337
|
for (let i = 0; i < previewCount; i++) {
|
|
10247
10338
|
const prefix = i === 0 ? "\u2514 " : " ";
|
|
10248
|
-
lines.push(`${prefix}${
|
|
10339
|
+
lines.push(`${prefix}${chalk7.dim(resultLines[i])}`);
|
|
10249
10340
|
}
|
|
10250
10341
|
const remaining = resultLines.length - previewCount;
|
|
10251
10342
|
if (remaining > 0) {
|
|
10252
10343
|
lines.push(
|
|
10253
|
-
` ${
|
|
10344
|
+
` ${chalk7.dim(`\u2026 +${remaining} ${pluralize(remaining, "line", "lines")} (vm0 logs <runId> to see all)`)}`
|
|
10254
10345
|
);
|
|
10255
10346
|
}
|
|
10256
10347
|
}
|
|
10257
10348
|
} else {
|
|
10258
|
-
lines.push(`\u2514 \u2713 ${
|
|
10349
|
+
lines.push(`\u2514 \u2713 ${chalk7.dim("Done")}`);
|
|
10259
10350
|
}
|
|
10260
10351
|
return lines;
|
|
10261
10352
|
}
|
|
@@ -10273,24 +10364,24 @@ function formatReadContent(resultText, verbose) {
|
|
|
10273
10364
|
const displayLines = contentLines.length > 0 ? contentLines : rawLines.filter((line) => line.trim().length > 0);
|
|
10274
10365
|
const totalLines = displayLines.length;
|
|
10275
10366
|
if (totalLines === 0) {
|
|
10276
|
-
lines.push(`\u2514 \u2713 ${
|
|
10367
|
+
lines.push(`\u2514 \u2713 ${chalk7.dim("(empty)")}`);
|
|
10277
10368
|
return lines;
|
|
10278
10369
|
}
|
|
10279
10370
|
if (verbose) {
|
|
10280
10371
|
for (let i = 0; i < displayLines.length; i++) {
|
|
10281
10372
|
const prefix = i === 0 ? "\u2514 " : " ";
|
|
10282
|
-
lines.push(`${prefix}${
|
|
10373
|
+
lines.push(`${prefix}${chalk7.dim(displayLines[i] ?? "")}`);
|
|
10283
10374
|
}
|
|
10284
10375
|
} else {
|
|
10285
10376
|
const previewCount = Math.min(3, totalLines);
|
|
10286
10377
|
for (let i = 0; i < previewCount; i++) {
|
|
10287
10378
|
const prefix = i === 0 ? "\u2514 " : " ";
|
|
10288
|
-
lines.push(`${prefix}${
|
|
10379
|
+
lines.push(`${prefix}${chalk7.dim(displayLines[i] ?? "")}`);
|
|
10289
10380
|
}
|
|
10290
10381
|
const remaining = totalLines - previewCount;
|
|
10291
10382
|
if (remaining > 0) {
|
|
10292
10383
|
lines.push(
|
|
10293
|
-
` ${
|
|
10384
|
+
` ${chalk7.dim(`\u2026 +${remaining} ${pluralize(remaining, "line", "lines")} (vm0 logs <runId> to see all)`)}`
|
|
10294
10385
|
);
|
|
10295
10386
|
}
|
|
10296
10387
|
}
|
|
@@ -10304,18 +10395,18 @@ function formatWritePreview(input, verbose) {
|
|
|
10304
10395
|
if (verbose) {
|
|
10305
10396
|
for (let i = 0; i < contentLines.length; i++) {
|
|
10306
10397
|
const prefix = i === 0 ? "\u23BF " : " ";
|
|
10307
|
-
lines.push(`${prefix}${
|
|
10398
|
+
lines.push(`${prefix}${chalk7.dim(contentLines[i] ?? "")}`);
|
|
10308
10399
|
}
|
|
10309
10400
|
} else {
|
|
10310
10401
|
const previewCount = Math.min(3, totalLines);
|
|
10311
10402
|
for (let i = 0; i < previewCount; i++) {
|
|
10312
10403
|
const prefix = i === 0 ? "\u23BF " : " ";
|
|
10313
|
-
lines.push(`${prefix}${
|
|
10404
|
+
lines.push(`${prefix}${chalk7.dim(contentLines[i] ?? "")}`);
|
|
10314
10405
|
}
|
|
10315
10406
|
const remaining = totalLines - previewCount;
|
|
10316
10407
|
if (remaining > 0) {
|
|
10317
10408
|
lines.push(
|
|
10318
|
-
` ${
|
|
10409
|
+
` ${chalk7.dim(`\u2026 +${remaining} ${pluralize(remaining, "line", "lines")} (vm0 logs <runId> to see all)`)}`
|
|
10319
10410
|
);
|
|
10320
10411
|
}
|
|
10321
10412
|
}
|
|
@@ -10330,34 +10421,34 @@ function formatEditDiff(input, verbose) {
|
|
|
10330
10421
|
const removed = oldLines.length;
|
|
10331
10422
|
const added = newLines.length;
|
|
10332
10423
|
const summary = `Added ${added} ${pluralize(added, "line", "lines")}, removed ${removed} ${pluralize(removed, "line", "lines")}`;
|
|
10333
|
-
lines.push(`\u23BF ${
|
|
10424
|
+
lines.push(`\u23BF ${chalk7.dim(summary)}`);
|
|
10334
10425
|
if (verbose) {
|
|
10335
10426
|
for (const line of oldLines) {
|
|
10336
|
-
lines.push(` - ${
|
|
10427
|
+
lines.push(` - ${chalk7.dim(line)}`);
|
|
10337
10428
|
}
|
|
10338
10429
|
for (const line of newLines) {
|
|
10339
|
-
lines.push(` + ${
|
|
10430
|
+
lines.push(` + ${chalk7.dim(line)}`);
|
|
10340
10431
|
}
|
|
10341
10432
|
} else {
|
|
10342
10433
|
const previewLimit = 3;
|
|
10343
10434
|
const showOld = Math.min(previewLimit, oldLines.length);
|
|
10344
10435
|
const showNew = Math.min(previewLimit, newLines.length);
|
|
10345
10436
|
for (let i = 0; i < showOld; i++) {
|
|
10346
|
-
lines.push(` - ${
|
|
10437
|
+
lines.push(` - ${chalk7.dim(truncate(oldLines[i] ?? "", 60))}`);
|
|
10347
10438
|
}
|
|
10348
10439
|
const remainingOld = oldLines.length - previewLimit;
|
|
10349
10440
|
if (remainingOld > 0) {
|
|
10350
10441
|
lines.push(
|
|
10351
|
-
` ${
|
|
10442
|
+
` ${chalk7.dim(`\u2026 +${remainingOld} ${pluralize(remainingOld, "line", "lines")} (vm0 logs <runId> to see all)`)}`
|
|
10352
10443
|
);
|
|
10353
10444
|
}
|
|
10354
10445
|
for (let i = 0; i < showNew; i++) {
|
|
10355
|
-
lines.push(` + ${
|
|
10446
|
+
lines.push(` + ${chalk7.dim(truncate(newLines[i] ?? "", 60))}`);
|
|
10356
10447
|
}
|
|
10357
10448
|
const remainingNew = newLines.length - previewLimit;
|
|
10358
10449
|
if (remainingNew > 0) {
|
|
10359
10450
|
lines.push(
|
|
10360
|
-
` ${
|
|
10451
|
+
` ${chalk7.dim(`\u2026 +${remainingNew} ${pluralize(remainingNew, "line", "lines")} (vm0 logs <runId> to see all)`)}`
|
|
10361
10452
|
);
|
|
10362
10453
|
}
|
|
10363
10454
|
}
|
|
@@ -10395,12 +10486,12 @@ function getTodoStatusIcon(status) {
|
|
|
10395
10486
|
function formatTodoContent(content, status) {
|
|
10396
10487
|
switch (status) {
|
|
10397
10488
|
case "completed":
|
|
10398
|
-
return
|
|
10489
|
+
return chalk7.dim.strikethrough(content);
|
|
10399
10490
|
case "in_progress":
|
|
10400
10491
|
return content;
|
|
10401
10492
|
case "pending":
|
|
10402
10493
|
default:
|
|
10403
|
-
return
|
|
10494
|
+
return chalk7.dim(content);
|
|
10404
10495
|
}
|
|
10405
10496
|
}
|
|
10406
10497
|
|
|
@@ -10418,12 +10509,12 @@ var EventRenderer = class _EventRenderer {
|
|
|
10418
10509
|
* Called immediately after run is created, before polling events
|
|
10419
10510
|
*/
|
|
10420
10511
|
static renderRunStarted(info) {
|
|
10421
|
-
console.log(
|
|
10422
|
-
console.log(` Run ID: ${
|
|
10512
|
+
console.log(chalk8.bold("\u25B6 Run started"));
|
|
10513
|
+
console.log(` Run ID: ${chalk8.dim(info.runId)}`);
|
|
10423
10514
|
if (info.sandboxId) {
|
|
10424
|
-
console.log(` Sandbox: ${
|
|
10515
|
+
console.log(` Sandbox: ${chalk8.dim(info.sandboxId)}`);
|
|
10425
10516
|
}
|
|
10426
|
-
console.log(
|
|
10517
|
+
console.log(chalk8.dim(` (use "vm0 logs ${info.runId}" to view logs)`));
|
|
10427
10518
|
console.log();
|
|
10428
10519
|
}
|
|
10429
10520
|
/**
|
|
@@ -10461,16 +10552,16 @@ var EventRenderer = class _EventRenderer {
|
|
|
10461
10552
|
*/
|
|
10462
10553
|
static renderRunCompleted(result) {
|
|
10463
10554
|
console.log("");
|
|
10464
|
-
console.log(
|
|
10555
|
+
console.log(chalk8.green("\u2713 Run completed successfully"));
|
|
10465
10556
|
if (result) {
|
|
10466
|
-
console.log(` Checkpoint: ${
|
|
10467
|
-
console.log(` Session: ${
|
|
10468
|
-
console.log(` Conversation: ${
|
|
10557
|
+
console.log(` Checkpoint: ${chalk8.dim(result.checkpointId)}`);
|
|
10558
|
+
console.log(` Session: ${chalk8.dim(result.agentSessionId)}`);
|
|
10559
|
+
console.log(` Conversation: ${chalk8.dim(result.conversationId)}`);
|
|
10469
10560
|
if (result.artifact && Object.keys(result.artifact).length > 0) {
|
|
10470
10561
|
console.log(` Artifact:`);
|
|
10471
10562
|
for (const [name, version] of Object.entries(result.artifact)) {
|
|
10472
10563
|
console.log(
|
|
10473
|
-
` ${name}: ${
|
|
10564
|
+
` ${name}: ${chalk8.dim(_EventRenderer.formatVersion(version))}`
|
|
10474
10565
|
);
|
|
10475
10566
|
}
|
|
10476
10567
|
}
|
|
@@ -10478,7 +10569,7 @@ var EventRenderer = class _EventRenderer {
|
|
|
10478
10569
|
console.log(` Volumes:`);
|
|
10479
10570
|
for (const [name, version] of Object.entries(result.volumes)) {
|
|
10480
10571
|
console.log(
|
|
10481
|
-
` ${name}: ${
|
|
10572
|
+
` ${name}: ${chalk8.dim(_EventRenderer.formatVersion(version))}`
|
|
10482
10573
|
);
|
|
10483
10574
|
}
|
|
10484
10575
|
}
|
|
@@ -10490,10 +10581,10 @@ var EventRenderer = class _EventRenderer {
|
|
|
10490
10581
|
*/
|
|
10491
10582
|
static renderRunFailed(error, runId) {
|
|
10492
10583
|
console.error("");
|
|
10493
|
-
console.error(
|
|
10494
|
-
console.error(` Error: ${
|
|
10584
|
+
console.error(chalk8.red("\u2717 Run failed"));
|
|
10585
|
+
console.error(` Error: ${chalk8.red(error || "Unknown error")}`);
|
|
10495
10586
|
console.error(
|
|
10496
|
-
|
|
10587
|
+
chalk8.dim(` (use "vm0 logs ${runId} --system" to view system logs)`)
|
|
10497
10588
|
);
|
|
10498
10589
|
}
|
|
10499
10590
|
/**
|
|
@@ -10577,13 +10668,13 @@ var EventRenderer = class _EventRenderer {
|
|
|
10577
10668
|
const frameworkStr = String(event.data.framework || "claude-code");
|
|
10578
10669
|
const displayName = isSupportedFramework(frameworkStr) ? getFrameworkDisplayName(frameworkStr) : frameworkStr;
|
|
10579
10670
|
this.frameworkDisplayName = displayName;
|
|
10580
|
-
console.log(prefix +
|
|
10581
|
-
console.log(` Session: ${
|
|
10671
|
+
console.log(prefix + chalk8.bold(`\u25B7 ${displayName} Started`));
|
|
10672
|
+
console.log(` Session: ${chalk8.dim(String(event.data.sessionId || ""))}`);
|
|
10582
10673
|
if (event.data.model) {
|
|
10583
|
-
console.log(` Model: ${
|
|
10674
|
+
console.log(` Model: ${chalk8.dim(String(event.data.model))}`);
|
|
10584
10675
|
}
|
|
10585
10676
|
console.log(
|
|
10586
|
-
` Tools: ${
|
|
10677
|
+
` Tools: ${chalk8.dim(
|
|
10587
10678
|
Array.isArray(event.data.tools) ? event.data.tools.join(", ") : String(event.data.tools || "")
|
|
10588
10679
|
)}`
|
|
10589
10680
|
);
|
|
@@ -10600,16 +10691,16 @@ var EventRenderer = class _EventRenderer {
|
|
|
10600
10691
|
const success = Boolean(event.data.success);
|
|
10601
10692
|
if (success) {
|
|
10602
10693
|
console.log(
|
|
10603
|
-
prefix +
|
|
10694
|
+
prefix + chalk8.bold(`\u25C6 ${this.frameworkDisplayName} Completed`)
|
|
10604
10695
|
);
|
|
10605
10696
|
} else {
|
|
10606
|
-
console.log(prefix +
|
|
10697
|
+
console.log(prefix + chalk8.bold(`\u25C6 ${this.frameworkDisplayName} Failed`));
|
|
10607
10698
|
}
|
|
10608
10699
|
const durationMs = Number(event.data.durationMs || 0);
|
|
10609
10700
|
const durationSec = (durationMs / 1e3).toFixed(1);
|
|
10610
|
-
console.log(` Duration: ${
|
|
10701
|
+
console.log(` Duration: ${chalk8.dim(durationSec + "s")}`);
|
|
10611
10702
|
const numTurns = Number(event.data.numTurns || 0);
|
|
10612
|
-
console.log(` Turns: ${
|
|
10703
|
+
console.log(` Turns: ${chalk8.dim(String(numTurns))}`);
|
|
10613
10704
|
const usage = event.data.usage;
|
|
10614
10705
|
if (usage && typeof usage === "object") {
|
|
10615
10706
|
const inputTokens = Number(usage.input_tokens || 0);
|
|
@@ -10621,7 +10712,7 @@ var EventRenderer = class _EventRenderer {
|
|
|
10621
10712
|
return String(count);
|
|
10622
10713
|
};
|
|
10623
10714
|
console.log(
|
|
10624
|
-
` Tokens: ${
|
|
10715
|
+
` Tokens: ${chalk8.dim(
|
|
10625
10716
|
`input=${formatTokens(inputTokens)} output=${formatTokens(outputTokens)}`
|
|
10626
10717
|
)}`
|
|
10627
10718
|
);
|
|
@@ -10640,7 +10731,7 @@ var EventRenderer = class _EventRenderer {
|
|
|
10640
10731
|
};
|
|
10641
10732
|
|
|
10642
10733
|
// src/lib/events/codex-event-renderer.ts
|
|
10643
|
-
import
|
|
10734
|
+
import chalk9 from "chalk";
|
|
10644
10735
|
var CodexEventRenderer = class {
|
|
10645
10736
|
/**
|
|
10646
10737
|
* Check if an event is a Codex event
|
|
@@ -10687,13 +10778,13 @@ var CodexEventRenderer = class {
|
|
|
10687
10778
|
const cached = event.usage.cached_input_tokens || 0;
|
|
10688
10779
|
const cachedStr = cached ? ` (${cached} cached)` : "";
|
|
10689
10780
|
console.log(
|
|
10690
|
-
"[turn.completed]" +
|
|
10781
|
+
"[turn.completed]" + chalk9.dim(` ${input} in / ${output} out${cachedStr}`)
|
|
10691
10782
|
);
|
|
10692
10783
|
}
|
|
10693
10784
|
}
|
|
10694
10785
|
static renderTurnFailed(event) {
|
|
10695
10786
|
console.log(
|
|
10696
|
-
|
|
10787
|
+
chalk9.red("[turn.failed]") + (event.error ? ` ${event.error}` : "")
|
|
10697
10788
|
);
|
|
10698
10789
|
}
|
|
10699
10790
|
static renderItem(event) {
|
|
@@ -10722,25 +10813,25 @@ var CodexEventRenderer = class {
|
|
|
10722
10813
|
if (output) {
|
|
10723
10814
|
const lines = output.split("\n").filter((l) => l.trim());
|
|
10724
10815
|
const preview = lines.slice(0, 3).join("\n ");
|
|
10725
|
-
const more = lines.length > 3 ?
|
|
10816
|
+
const more = lines.length > 3 ? chalk9.dim(` ... (${lines.length - 3} more lines)`) : "";
|
|
10726
10817
|
console.log(
|
|
10727
|
-
"[output]" + (exitCode !== 0 ?
|
|
10818
|
+
"[output]" + (exitCode !== 0 ? chalk9.red(` exit=${exitCode}`) : "")
|
|
10728
10819
|
);
|
|
10729
10820
|
if (preview) {
|
|
10730
10821
|
console.log(" " + preview + more);
|
|
10731
10822
|
}
|
|
10732
10823
|
} else if (exitCode !== 0) {
|
|
10733
|
-
console.log(
|
|
10824
|
+
console.log(chalk9.red("[output]") + chalk9.red(` exit=${exitCode}`));
|
|
10734
10825
|
}
|
|
10735
10826
|
}
|
|
10736
10827
|
}
|
|
10737
10828
|
static renderFileChange(item) {
|
|
10738
10829
|
if (item.changes && item.changes.length > 0) {
|
|
10739
|
-
const summary = item.changes.map((
|
|
10740
|
-
const icon =
|
|
10741
|
-
return `${icon}${
|
|
10830
|
+
const summary = item.changes.map((c24) => {
|
|
10831
|
+
const icon = c24.kind === "add" ? "+" : c24.kind === "delete" ? "-" : "~";
|
|
10832
|
+
return `${icon}${c24.path}`;
|
|
10742
10833
|
}).join(", ");
|
|
10743
|
-
console.log(
|
|
10834
|
+
console.log(chalk9.green("[files]") + ` ${summary}`);
|
|
10744
10835
|
}
|
|
10745
10836
|
}
|
|
10746
10837
|
static renderFileOperation(item, eventType) {
|
|
@@ -10751,7 +10842,7 @@ var CodexEventRenderer = class {
|
|
|
10751
10842
|
}
|
|
10752
10843
|
static renderError(event) {
|
|
10753
10844
|
console.log(
|
|
10754
|
-
|
|
10845
|
+
chalk9.red("[error]") + ` ${event.message || event.error || "Unknown error"}`
|
|
10755
10846
|
);
|
|
10756
10847
|
}
|
|
10757
10848
|
};
|
|
@@ -10838,10 +10929,10 @@ function parseIdentifier(identifier) {
|
|
|
10838
10929
|
}
|
|
10839
10930
|
function renderRunCreated(response) {
|
|
10840
10931
|
if (response.status === "queued") {
|
|
10841
|
-
console.log(
|
|
10842
|
-
console.log(` Run ID: ${
|
|
10932
|
+
console.log(chalk10.yellow("\u26A0 Run queued \u2014 concurrency limit reached"));
|
|
10933
|
+
console.log(` Run ID: ${chalk10.dim(response.runId)}`);
|
|
10843
10934
|
console.log(
|
|
10844
|
-
|
|
10935
|
+
chalk10.dim(" Will start automatically when a slot is available")
|
|
10845
10936
|
);
|
|
10846
10937
|
console.log();
|
|
10847
10938
|
} else {
|
|
@@ -10889,9 +10980,9 @@ async function pollEvents(runId, options) {
|
|
|
10889
10980
|
result = { succeeded: false, runId };
|
|
10890
10981
|
} else if (runStatus === "timeout") {
|
|
10891
10982
|
complete = true;
|
|
10892
|
-
console.error(
|
|
10983
|
+
console.error(chalk10.red("\n\u2717 Run timed out"));
|
|
10893
10984
|
console.error(
|
|
10894
|
-
|
|
10985
|
+
chalk10.dim(` (use "vm0 logs ${runId} --system" to view system logs)`)
|
|
10895
10986
|
);
|
|
10896
10987
|
result = { succeeded: false, runId };
|
|
10897
10988
|
}
|
|
@@ -10905,11 +10996,11 @@ function showNextSteps(result) {
|
|
|
10905
10996
|
const { runId, sessionId, checkpointId } = result;
|
|
10906
10997
|
console.log();
|
|
10907
10998
|
console.log(" View agent logs:");
|
|
10908
|
-
console.log(
|
|
10999
|
+
console.log(chalk10.cyan(` vm0 logs ${runId}`));
|
|
10909
11000
|
if (sessionId) {
|
|
10910
11001
|
console.log(" Continue with session (latest conversation and artifact):");
|
|
10911
11002
|
console.log(
|
|
10912
|
-
|
|
11003
|
+
chalk10.cyan(` vm0 run continue ${sessionId} "your next prompt"`)
|
|
10913
11004
|
);
|
|
10914
11005
|
}
|
|
10915
11006
|
if (checkpointId) {
|
|
@@ -10917,7 +11008,7 @@ function showNextSteps(result) {
|
|
|
10917
11008
|
" Resume from checkpoint (snapshotted conversation and artifact):"
|
|
10918
11009
|
);
|
|
10919
11010
|
console.log(
|
|
10920
|
-
|
|
11011
|
+
chalk10.cyan(` vm0 run resume ${checkpointId} "your next prompt"`)
|
|
10921
11012
|
);
|
|
10922
11013
|
}
|
|
10923
11014
|
}
|
|
@@ -10960,7 +11051,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
10960
11051
|
withErrorHandler(
|
|
10961
11052
|
async (identifier, prompt, options) => {
|
|
10962
11053
|
if (options.autoUpdate !== false) {
|
|
10963
|
-
await startSilentUpgrade("9.
|
|
11054
|
+
await startSilentUpgrade("9.59.0");
|
|
10964
11055
|
}
|
|
10965
11056
|
const { org, name, version } = parseIdentifier(identifier);
|
|
10966
11057
|
if (org && !options.experimentalSharedAgent) {
|
|
@@ -11179,7 +11270,7 @@ var continueCommand = new Command10().name("continue").description(
|
|
|
11179
11270
|
|
|
11180
11271
|
// src/commands/run/list.ts
|
|
11181
11272
|
import { Command as Command11 } from "commander";
|
|
11182
|
-
import
|
|
11273
|
+
import chalk11 from "chalk";
|
|
11183
11274
|
|
|
11184
11275
|
// src/lib/utils/time-parser.ts
|
|
11185
11276
|
function parseTime(timeStr) {
|
|
@@ -11232,16 +11323,16 @@ function formatRunStatus(status, width) {
|
|
|
11232
11323
|
const paddedStatus = width ? status.padEnd(width) : status;
|
|
11233
11324
|
switch (status) {
|
|
11234
11325
|
case "queued":
|
|
11235
|
-
return
|
|
11326
|
+
return chalk11.blue(paddedStatus);
|
|
11236
11327
|
case "running":
|
|
11237
|
-
return
|
|
11328
|
+
return chalk11.green(paddedStatus);
|
|
11238
11329
|
case "pending":
|
|
11239
|
-
return
|
|
11330
|
+
return chalk11.yellow(paddedStatus);
|
|
11240
11331
|
case "completed":
|
|
11241
|
-
return
|
|
11332
|
+
return chalk11.dim(paddedStatus);
|
|
11242
11333
|
case "failed":
|
|
11243
11334
|
case "timeout":
|
|
11244
|
-
return
|
|
11335
|
+
return chalk11.red(paddedStatus);
|
|
11245
11336
|
default:
|
|
11246
11337
|
return paddedStatus;
|
|
11247
11338
|
}
|
|
@@ -11292,7 +11383,7 @@ function displayRuns(runs) {
|
|
|
11292
11383
|
"STATUS".padEnd(statusWidth),
|
|
11293
11384
|
"CREATED"
|
|
11294
11385
|
].join(" ");
|
|
11295
|
-
console.log(
|
|
11386
|
+
console.log(chalk11.dim(header));
|
|
11296
11387
|
for (const run of runs) {
|
|
11297
11388
|
const row = [
|
|
11298
11389
|
run.id.padEnd(UUID_LENGTH),
|
|
@@ -11305,10 +11396,10 @@ function displayRuns(runs) {
|
|
|
11305
11396
|
}
|
|
11306
11397
|
function displayEmptyState(hasFilters) {
|
|
11307
11398
|
if (hasFilters) {
|
|
11308
|
-
console.log(
|
|
11399
|
+
console.log(chalk11.dim("No runs found matching filters"));
|
|
11309
11400
|
} else {
|
|
11310
|
-
console.log(
|
|
11311
|
-
console.log(
|
|
11401
|
+
console.log(chalk11.dim("No active runs"));
|
|
11402
|
+
console.log(chalk11.dim(' Run: vm0 run <agent> "<prompt>"'));
|
|
11312
11403
|
}
|
|
11313
11404
|
}
|
|
11314
11405
|
var listCommand = new Command11().name("list").alias("ls").description("List runs").option(
|
|
@@ -11345,11 +11436,11 @@ var listCommand = new Command11().name("list").alias("ls").description("List run
|
|
|
11345
11436
|
|
|
11346
11437
|
// src/commands/run/kill.ts
|
|
11347
11438
|
import { Command as Command12 } from "commander";
|
|
11348
|
-
import
|
|
11439
|
+
import chalk12 from "chalk";
|
|
11349
11440
|
var killCommand = new Command12().name("kill").description("Kill (cancel) a pending or running run").argument("<run-id>", "Run ID to kill").action(
|
|
11350
11441
|
withErrorHandler(async (runId) => {
|
|
11351
11442
|
await cancelRun(runId);
|
|
11352
|
-
console.log(
|
|
11443
|
+
console.log(chalk12.green(`\u2713 Run ${runId} cancelled`));
|
|
11353
11444
|
})
|
|
11354
11445
|
);
|
|
11355
11446
|
|
|
@@ -11365,7 +11456,7 @@ import { Command as Command19 } from "commander";
|
|
|
11365
11456
|
|
|
11366
11457
|
// src/commands/volume/init.ts
|
|
11367
11458
|
import { Command as Command13 } from "commander";
|
|
11368
|
-
import
|
|
11459
|
+
import chalk13 from "chalk";
|
|
11369
11460
|
import path7 from "path";
|
|
11370
11461
|
|
|
11371
11462
|
// src/lib/storage/storage-utils.ts
|
|
@@ -11423,10 +11514,10 @@ var initCommand = new Command13().name("init").description("Initialize a volume
|
|
|
11423
11514
|
const existingConfig = await readStorageConfig(cwd);
|
|
11424
11515
|
if (existingConfig) {
|
|
11425
11516
|
console.log(
|
|
11426
|
-
|
|
11517
|
+
chalk13.yellow(`Volume already initialized: ${existingConfig.name}`)
|
|
11427
11518
|
);
|
|
11428
11519
|
console.log(
|
|
11429
|
-
|
|
11520
|
+
chalk13.dim(`Config file: ${path7.join(cwd, ".vm0", "storage.yaml")}`)
|
|
11430
11521
|
);
|
|
11431
11522
|
return;
|
|
11432
11523
|
}
|
|
@@ -11450,7 +11541,7 @@ var initCommand = new Command13().name("init").description("Initialize a volume
|
|
|
11450
11541
|
}
|
|
11451
11542
|
);
|
|
11452
11543
|
if (name === void 0) {
|
|
11453
|
-
console.log(
|
|
11544
|
+
console.log(chalk13.dim("Cancelled"));
|
|
11454
11545
|
return;
|
|
11455
11546
|
}
|
|
11456
11547
|
volumeName = name;
|
|
@@ -11463,9 +11554,9 @@ var initCommand = new Command13().name("init").description("Initialize a volume
|
|
|
11463
11554
|
});
|
|
11464
11555
|
}
|
|
11465
11556
|
await writeStorageConfig(volumeName, cwd);
|
|
11466
|
-
console.log(
|
|
11557
|
+
console.log(chalk13.green(`\u2713 Initialized volume: ${volumeName}`));
|
|
11467
11558
|
console.log(
|
|
11468
|
-
|
|
11559
|
+
chalk13.dim(
|
|
11469
11560
|
` Config saved to ${path7.join(cwd, ".vm0", "storage.yaml")}`
|
|
11470
11561
|
)
|
|
11471
11562
|
);
|
|
@@ -11474,7 +11565,7 @@ var initCommand = new Command13().name("init").description("Initialize a volume
|
|
|
11474
11565
|
|
|
11475
11566
|
// src/commands/volume/push.ts
|
|
11476
11567
|
import { Command as Command14 } from "commander";
|
|
11477
|
-
import
|
|
11568
|
+
import chalk14 from "chalk";
|
|
11478
11569
|
var pushCommand = new Command14().name("push").description("Push local files to cloud volume").option(
|
|
11479
11570
|
"-f, --force",
|
|
11480
11571
|
"Force upload even if content unchanged (recreate archive)"
|
|
@@ -11490,41 +11581,41 @@ var pushCommand = new Command14().name("push").description("Push local files to
|
|
|
11490
11581
|
console.log(`Pushing volume: ${config.name}`);
|
|
11491
11582
|
const result = await directUpload(config.name, "volume", cwd, {
|
|
11492
11583
|
onProgress: (message) => {
|
|
11493
|
-
console.log(
|
|
11584
|
+
console.log(chalk14.dim(message));
|
|
11494
11585
|
},
|
|
11495
11586
|
force: options.force
|
|
11496
11587
|
});
|
|
11497
11588
|
const shortVersion = result.versionId.slice(0, 8);
|
|
11498
11589
|
if (result.empty) {
|
|
11499
|
-
console.log(
|
|
11590
|
+
console.log(chalk14.dim("No files found (empty volume)"));
|
|
11500
11591
|
} else if (result.deduplicated) {
|
|
11501
|
-
console.log(
|
|
11592
|
+
console.log(chalk14.green("\u2713 Content unchanged (deduplicated)"));
|
|
11502
11593
|
} else {
|
|
11503
|
-
console.log(
|
|
11594
|
+
console.log(chalk14.green("\u2713 Upload complete"));
|
|
11504
11595
|
}
|
|
11505
|
-
console.log(
|
|
11506
|
-
console.log(
|
|
11507
|
-
console.log(
|
|
11596
|
+
console.log(chalk14.dim(` Version: ${shortVersion}`));
|
|
11597
|
+
console.log(chalk14.dim(` Files: ${result.fileCount.toLocaleString()}`));
|
|
11598
|
+
console.log(chalk14.dim(` Size: ${formatBytes(result.size)}`));
|
|
11508
11599
|
})
|
|
11509
11600
|
);
|
|
11510
11601
|
|
|
11511
11602
|
// src/commands/volume/pull.ts
|
|
11512
11603
|
import { Command as Command15 } from "commander";
|
|
11513
|
-
import
|
|
11604
|
+
import chalk16 from "chalk";
|
|
11514
11605
|
import path8 from "path";
|
|
11515
11606
|
import * as fs7 from "fs";
|
|
11516
11607
|
import * as os5 from "os";
|
|
11517
11608
|
import * as tar3 from "tar";
|
|
11518
11609
|
|
|
11519
11610
|
// src/lib/storage/pull-utils.ts
|
|
11520
|
-
import
|
|
11611
|
+
import chalk15 from "chalk";
|
|
11521
11612
|
async function handleEmptyStorageResponse(cwd) {
|
|
11522
|
-
console.log(
|
|
11613
|
+
console.log(chalk15.dim("Syncing local files..."));
|
|
11523
11614
|
const removedCount = await removeExtraFiles(cwd, /* @__PURE__ */ new Set());
|
|
11524
11615
|
if (removedCount > 0) {
|
|
11525
|
-
console.log(
|
|
11616
|
+
console.log(chalk15.green(`\u2713 Removed ${removedCount} files not in remote`));
|
|
11526
11617
|
}
|
|
11527
|
-
console.log(
|
|
11618
|
+
console.log(chalk15.green("\u2713 Synced (0 files)"));
|
|
11528
11619
|
return { removedCount };
|
|
11529
11620
|
}
|
|
11530
11621
|
|
|
@@ -11543,7 +11634,7 @@ var pullCommand = new Command15().name("pull").description("Pull cloud files to
|
|
|
11543
11634
|
} else {
|
|
11544
11635
|
console.log(`Pulling volume: ${config.name}`);
|
|
11545
11636
|
}
|
|
11546
|
-
console.log(
|
|
11637
|
+
console.log(chalk16.dim("Getting download URL..."));
|
|
11547
11638
|
const downloadInfo = await getStorageDownload({
|
|
11548
11639
|
name: config.name,
|
|
11549
11640
|
type: "volume",
|
|
@@ -11557,18 +11648,18 @@ var pullCommand = new Command15().name("pull").description("Pull cloud files to
|
|
|
11557
11648
|
if (!downloadUrl) {
|
|
11558
11649
|
throw new Error("No download URL returned");
|
|
11559
11650
|
}
|
|
11560
|
-
console.log(
|
|
11651
|
+
console.log(chalk16.dim("Downloading from S3..."));
|
|
11561
11652
|
const s3Response = await fetch(downloadUrl);
|
|
11562
11653
|
if (!s3Response.ok) {
|
|
11563
11654
|
throw new Error(`S3 download failed: ${s3Response.status}`);
|
|
11564
11655
|
}
|
|
11565
11656
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
11566
11657
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
11567
|
-
console.log(
|
|
11658
|
+
console.log(chalk16.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
11568
11659
|
const tmpDir = fs7.mkdtempSync(path8.join(os5.tmpdir(), "vm0-"));
|
|
11569
11660
|
const tarPath = path8.join(tmpDir, "volume.tar.gz");
|
|
11570
11661
|
await fs7.promises.writeFile(tarPath, tarBuffer);
|
|
11571
|
-
console.log(
|
|
11662
|
+
console.log(chalk16.dim("Syncing local files..."));
|
|
11572
11663
|
const remoteFiles = await listTarFiles(tarPath);
|
|
11573
11664
|
const remoteFilesSet = new Set(
|
|
11574
11665
|
remoteFiles.map((f) => f.replace(/\\/g, "/"))
|
|
@@ -11576,10 +11667,10 @@ var pullCommand = new Command15().name("pull").description("Pull cloud files to
|
|
|
11576
11667
|
const removedCount = await removeExtraFiles(cwd, remoteFilesSet);
|
|
11577
11668
|
if (removedCount > 0) {
|
|
11578
11669
|
console.log(
|
|
11579
|
-
|
|
11670
|
+
chalk16.green(`\u2713 Removed ${removedCount} files not in remote`)
|
|
11580
11671
|
);
|
|
11581
11672
|
}
|
|
11582
|
-
console.log(
|
|
11673
|
+
console.log(chalk16.dim("Extracting files..."));
|
|
11583
11674
|
await tar3.extract({
|
|
11584
11675
|
file: tarPath,
|
|
11585
11676
|
cwd,
|
|
@@ -11587,13 +11678,13 @@ var pullCommand = new Command15().name("pull").description("Pull cloud files to
|
|
|
11587
11678
|
});
|
|
11588
11679
|
await fs7.promises.unlink(tarPath);
|
|
11589
11680
|
await fs7.promises.rmdir(tmpDir);
|
|
11590
|
-
console.log(
|
|
11681
|
+
console.log(chalk16.green(`\u2713 Extracted ${remoteFiles.length} files`));
|
|
11591
11682
|
})
|
|
11592
11683
|
);
|
|
11593
11684
|
|
|
11594
11685
|
// src/commands/volume/status.ts
|
|
11595
11686
|
import { Command as Command16 } from "commander";
|
|
11596
|
-
import
|
|
11687
|
+
import chalk17 from "chalk";
|
|
11597
11688
|
var statusCommand2 = new Command16().name("status").description("Show status of cloud volume").action(
|
|
11598
11689
|
withErrorHandler(async () => {
|
|
11599
11690
|
const cwd = process.cwd();
|
|
@@ -11617,13 +11708,13 @@ var statusCommand2 = new Command16().name("status").description("Show status of
|
|
|
11617
11708
|
});
|
|
11618
11709
|
const shortVersion = info.versionId.slice(0, 8);
|
|
11619
11710
|
if ("empty" in info) {
|
|
11620
|
-
console.log(
|
|
11621
|
-
console.log(
|
|
11711
|
+
console.log(chalk17.green("\u2713 Found (empty)"));
|
|
11712
|
+
console.log(chalk17.dim(` Version: ${shortVersion}`));
|
|
11622
11713
|
} else {
|
|
11623
|
-
console.log(
|
|
11624
|
-
console.log(
|
|
11625
|
-
console.log(
|
|
11626
|
-
console.log(
|
|
11714
|
+
console.log(chalk17.green("\u2713 Found"));
|
|
11715
|
+
console.log(chalk17.dim(` Version: ${shortVersion}`));
|
|
11716
|
+
console.log(chalk17.dim(` Files: ${info.fileCount.toLocaleString()}`));
|
|
11717
|
+
console.log(chalk17.dim(` Size: ${formatBytes(info.size)}`));
|
|
11627
11718
|
}
|
|
11628
11719
|
} catch (error) {
|
|
11629
11720
|
if (error instanceof ApiRequestError && error.status === 404) {
|
|
@@ -11638,14 +11729,14 @@ var statusCommand2 = new Command16().name("status").description("Show status of
|
|
|
11638
11729
|
|
|
11639
11730
|
// src/commands/volume/list.ts
|
|
11640
11731
|
import { Command as Command17 } from "commander";
|
|
11641
|
-
import
|
|
11732
|
+
import chalk18 from "chalk";
|
|
11642
11733
|
var listCommand2 = new Command17().name("list").alias("ls").description("List all remote volumes").action(
|
|
11643
11734
|
withErrorHandler(async () => {
|
|
11644
11735
|
const items = await listStorages({ type: "volume" });
|
|
11645
11736
|
if (items.length === 0) {
|
|
11646
|
-
console.log(
|
|
11737
|
+
console.log(chalk18.dim("No volumes found"));
|
|
11647
11738
|
console.log(
|
|
11648
|
-
|
|
11739
|
+
chalk18.dim(" Create one with: vm0 volume init && vm0 volume push")
|
|
11649
11740
|
);
|
|
11650
11741
|
return;
|
|
11651
11742
|
}
|
|
@@ -11664,7 +11755,7 @@ var listCommand2 = new Command17().name("list").alias("ls").description("List al
|
|
|
11664
11755
|
"FILES".padStart(filesWidth),
|
|
11665
11756
|
"UPDATED"
|
|
11666
11757
|
].join(" ");
|
|
11667
|
-
console.log(
|
|
11758
|
+
console.log(chalk18.dim(header));
|
|
11668
11759
|
for (const item of items) {
|
|
11669
11760
|
const row = [
|
|
11670
11761
|
item.name.padEnd(nameWidth),
|
|
@@ -11679,10 +11770,10 @@ var listCommand2 = new Command17().name("list").alias("ls").description("List al
|
|
|
11679
11770
|
|
|
11680
11771
|
// src/commands/volume/clone.ts
|
|
11681
11772
|
import { Command as Command18 } from "commander";
|
|
11682
|
-
import
|
|
11773
|
+
import chalk20 from "chalk";
|
|
11683
11774
|
|
|
11684
11775
|
// src/lib/storage/clone-utils.ts
|
|
11685
|
-
import
|
|
11776
|
+
import chalk19 from "chalk";
|
|
11686
11777
|
import path9 from "path";
|
|
11687
11778
|
import * as fs8 from "fs";
|
|
11688
11779
|
import * as os6 from "os";
|
|
@@ -11693,18 +11784,18 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
11693
11784
|
if (dirStatus.exists && !dirStatus.empty) {
|
|
11694
11785
|
throw new Error(`Directory "${destination}" is not empty`);
|
|
11695
11786
|
}
|
|
11696
|
-
console.log(
|
|
11787
|
+
console.log(chalk19.dim(`Checking remote ${typeLabel}...`));
|
|
11697
11788
|
const downloadInfo = await getStorageDownload({
|
|
11698
11789
|
name,
|
|
11699
11790
|
type: type2,
|
|
11700
11791
|
version: options.version
|
|
11701
11792
|
});
|
|
11702
|
-
console.log(
|
|
11793
|
+
console.log(chalk19.dim(`Creating directory: ${destination}/`));
|
|
11703
11794
|
await fs8.promises.mkdir(destination, { recursive: true });
|
|
11704
11795
|
if ("empty" in downloadInfo) {
|
|
11705
11796
|
await writeStorageConfig(name, destination, type2);
|
|
11706
|
-
console.log(
|
|
11707
|
-
console.log(
|
|
11797
|
+
console.log(chalk19.green(`\u2713 Cloned empty ${typeLabel}: ${name}`));
|
|
11798
|
+
console.log(chalk19.dim(`\u2713 Initialized .vm0/storage.yaml`));
|
|
11708
11799
|
return {
|
|
11709
11800
|
success: true,
|
|
11710
11801
|
fileCount: 0,
|
|
@@ -11716,7 +11807,7 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
11716
11807
|
if (!downloadUrl) {
|
|
11717
11808
|
throw new Error("No download URL returned");
|
|
11718
11809
|
}
|
|
11719
|
-
console.log(
|
|
11810
|
+
console.log(chalk19.dim("Downloading from S3..."));
|
|
11720
11811
|
const s3Response = await fetch(downloadUrl);
|
|
11721
11812
|
if (!s3Response.ok) {
|
|
11722
11813
|
await fs8.promises.rm(destination, { recursive: true, force: true });
|
|
@@ -11724,12 +11815,12 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
11724
11815
|
}
|
|
11725
11816
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
11726
11817
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
11727
|
-
console.log(
|
|
11818
|
+
console.log(chalk19.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
11728
11819
|
const tmpDir = fs8.mkdtempSync(path9.join(os6.tmpdir(), "vm0-clone-"));
|
|
11729
11820
|
const tarPath = path9.join(tmpDir, "archive.tar.gz");
|
|
11730
11821
|
await fs8.promises.writeFile(tarPath, tarBuffer);
|
|
11731
11822
|
const files = await listTarFiles(tarPath);
|
|
11732
|
-
console.log(
|
|
11823
|
+
console.log(chalk19.dim("Extracting files..."));
|
|
11733
11824
|
await tar4.extract({
|
|
11734
11825
|
file: tarPath,
|
|
11735
11826
|
cwd: destination,
|
|
@@ -11737,9 +11828,9 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
11737
11828
|
});
|
|
11738
11829
|
await fs8.promises.unlink(tarPath);
|
|
11739
11830
|
await fs8.promises.rmdir(tmpDir);
|
|
11740
|
-
console.log(
|
|
11831
|
+
console.log(chalk19.green(`\u2713 Extracted ${files.length} files`));
|
|
11741
11832
|
await writeStorageConfig(name, destination, type2);
|
|
11742
|
-
console.log(
|
|
11833
|
+
console.log(chalk19.green(`\u2713 Initialized .vm0/storage.yaml`));
|
|
11743
11834
|
return {
|
|
11744
11835
|
success: true,
|
|
11745
11836
|
fileCount: downloadInfo.fileCount,
|
|
@@ -11754,10 +11845,10 @@ var cloneCommand = new Command18().name("clone").description("Clone a remote vol
|
|
|
11754
11845
|
const targetDir = destination || name;
|
|
11755
11846
|
console.log(`Cloning volume: ${name}`);
|
|
11756
11847
|
const result = await cloneStorage(name, "volume", targetDir);
|
|
11757
|
-
console.log(
|
|
11848
|
+
console.log(chalk20.green(`
|
|
11758
11849
|
\u2713 Successfully cloned volume: ${name}`));
|
|
11759
|
-
console.log(
|
|
11760
|
-
console.log(
|
|
11850
|
+
console.log(chalk20.dim(` Location: ${targetDir}/`));
|
|
11851
|
+
console.log(chalk20.dim(` Version: ${result.versionId.slice(0, 8)}`));
|
|
11761
11852
|
})
|
|
11762
11853
|
);
|
|
11763
11854
|
|
|
@@ -11769,7 +11860,7 @@ import { Command as Command26 } from "commander";
|
|
|
11769
11860
|
|
|
11770
11861
|
// src/commands/artifact/init.ts
|
|
11771
11862
|
import { Command as Command20 } from "commander";
|
|
11772
|
-
import
|
|
11863
|
+
import chalk21 from "chalk";
|
|
11773
11864
|
import path10 from "path";
|
|
11774
11865
|
var initCommand2 = new Command20().name("init").description("Initialize an artifact in the current directory").option(
|
|
11775
11866
|
"-n, --name <name>",
|
|
@@ -11782,24 +11873,24 @@ var initCommand2 = new Command20().name("init").description("Initialize an artif
|
|
|
11782
11873
|
if (existingConfig) {
|
|
11783
11874
|
if (existingConfig.type === "artifact") {
|
|
11784
11875
|
console.log(
|
|
11785
|
-
|
|
11876
|
+
chalk21.yellow(
|
|
11786
11877
|
`Artifact already initialized: ${existingConfig.name}`
|
|
11787
11878
|
)
|
|
11788
11879
|
);
|
|
11789
11880
|
} else {
|
|
11790
11881
|
console.log(
|
|
11791
|
-
|
|
11882
|
+
chalk21.yellow(
|
|
11792
11883
|
`Directory already initialized as volume: ${existingConfig.name}`
|
|
11793
11884
|
)
|
|
11794
11885
|
);
|
|
11795
11886
|
console.log(
|
|
11796
|
-
|
|
11887
|
+
chalk21.dim(
|
|
11797
11888
|
" To change type, delete .vm0/storage.yaml and reinitialize"
|
|
11798
11889
|
)
|
|
11799
11890
|
);
|
|
11800
11891
|
}
|
|
11801
11892
|
console.log(
|
|
11802
|
-
|
|
11893
|
+
chalk21.dim(`Config file: ${path10.join(cwd, ".vm0", "storage.yaml")}`)
|
|
11803
11894
|
);
|
|
11804
11895
|
return;
|
|
11805
11896
|
}
|
|
@@ -11823,7 +11914,7 @@ var initCommand2 = new Command20().name("init").description("Initialize an artif
|
|
|
11823
11914
|
}
|
|
11824
11915
|
);
|
|
11825
11916
|
if (name === void 0) {
|
|
11826
|
-
console.log(
|
|
11917
|
+
console.log(chalk21.dim("Cancelled"));
|
|
11827
11918
|
return;
|
|
11828
11919
|
}
|
|
11829
11920
|
artifactName = name;
|
|
@@ -11836,9 +11927,9 @@ var initCommand2 = new Command20().name("init").description("Initialize an artif
|
|
|
11836
11927
|
});
|
|
11837
11928
|
}
|
|
11838
11929
|
await writeStorageConfig(artifactName, cwd, "artifact");
|
|
11839
|
-
console.log(
|
|
11930
|
+
console.log(chalk21.green(`\u2713 Initialized artifact: ${artifactName}`));
|
|
11840
11931
|
console.log(
|
|
11841
|
-
|
|
11932
|
+
chalk21.dim(
|
|
11842
11933
|
` Config saved to ${path10.join(cwd, ".vm0", "storage.yaml")}`
|
|
11843
11934
|
)
|
|
11844
11935
|
);
|
|
@@ -11847,7 +11938,7 @@ var initCommand2 = new Command20().name("init").description("Initialize an artif
|
|
|
11847
11938
|
|
|
11848
11939
|
// src/commands/artifact/push.ts
|
|
11849
11940
|
import { Command as Command21 } from "commander";
|
|
11850
|
-
import
|
|
11941
|
+
import chalk22 from "chalk";
|
|
11851
11942
|
var pushCommand2 = new Command21().name("push").description("Push local files to cloud artifact").option(
|
|
11852
11943
|
"-f, --force",
|
|
11853
11944
|
"Force upload even if content unchanged (recreate archive)"
|
|
@@ -11869,27 +11960,27 @@ var pushCommand2 = new Command21().name("push").description("Push local files to
|
|
|
11869
11960
|
console.log(`Pushing artifact: ${config.name}`);
|
|
11870
11961
|
const result = await directUpload(config.name, "artifact", cwd, {
|
|
11871
11962
|
onProgress: (message) => {
|
|
11872
|
-
console.log(
|
|
11963
|
+
console.log(chalk22.dim(message));
|
|
11873
11964
|
},
|
|
11874
11965
|
force: options.force
|
|
11875
11966
|
});
|
|
11876
11967
|
const shortVersion = result.versionId.slice(0, 8);
|
|
11877
11968
|
if (result.empty) {
|
|
11878
|
-
console.log(
|
|
11969
|
+
console.log(chalk22.dim("No files found (empty artifact)"));
|
|
11879
11970
|
} else if (result.deduplicated) {
|
|
11880
|
-
console.log(
|
|
11971
|
+
console.log(chalk22.green("\u2713 Content unchanged (deduplicated)"));
|
|
11881
11972
|
} else {
|
|
11882
|
-
console.log(
|
|
11973
|
+
console.log(chalk22.green("\u2713 Upload complete"));
|
|
11883
11974
|
}
|
|
11884
|
-
console.log(
|
|
11885
|
-
console.log(
|
|
11886
|
-
console.log(
|
|
11975
|
+
console.log(chalk22.dim(` Version: ${shortVersion}`));
|
|
11976
|
+
console.log(chalk22.dim(` Files: ${result.fileCount.toLocaleString()}`));
|
|
11977
|
+
console.log(chalk22.dim(` Size: ${formatBytes(result.size)}`));
|
|
11887
11978
|
})
|
|
11888
11979
|
);
|
|
11889
11980
|
|
|
11890
11981
|
// src/commands/artifact/pull.ts
|
|
11891
11982
|
import { Command as Command22 } from "commander";
|
|
11892
|
-
import
|
|
11983
|
+
import chalk23 from "chalk";
|
|
11893
11984
|
import path11 from "path";
|
|
11894
11985
|
import * as fs9 from "fs";
|
|
11895
11986
|
import * as os7 from "os";
|
|
@@ -11914,7 +12005,7 @@ var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact
|
|
|
11914
12005
|
} else {
|
|
11915
12006
|
console.log(`Pulling artifact: ${config.name}`);
|
|
11916
12007
|
}
|
|
11917
|
-
console.log(
|
|
12008
|
+
console.log(chalk23.dim("Getting download URL..."));
|
|
11918
12009
|
const downloadInfo = await getStorageDownload({
|
|
11919
12010
|
name: config.name,
|
|
11920
12011
|
type: "artifact",
|
|
@@ -11928,18 +12019,18 @@ var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact
|
|
|
11928
12019
|
if (!downloadUrl) {
|
|
11929
12020
|
throw new Error("No download URL returned");
|
|
11930
12021
|
}
|
|
11931
|
-
console.log(
|
|
12022
|
+
console.log(chalk23.dim("Downloading from S3..."));
|
|
11932
12023
|
const s3Response = await fetch(downloadUrl);
|
|
11933
12024
|
if (!s3Response.ok) {
|
|
11934
12025
|
throw new Error(`S3 download failed: ${s3Response.status}`);
|
|
11935
12026
|
}
|
|
11936
12027
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
11937
12028
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
11938
|
-
console.log(
|
|
12029
|
+
console.log(chalk23.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
11939
12030
|
const tmpDir = fs9.mkdtempSync(path11.join(os7.tmpdir(), "vm0-"));
|
|
11940
12031
|
const tarPath = path11.join(tmpDir, "artifact.tar.gz");
|
|
11941
12032
|
await fs9.promises.writeFile(tarPath, tarBuffer);
|
|
11942
|
-
console.log(
|
|
12033
|
+
console.log(chalk23.dim("Syncing local files..."));
|
|
11943
12034
|
const remoteFiles = await listTarFiles(tarPath);
|
|
11944
12035
|
const remoteFilesSet = new Set(
|
|
11945
12036
|
remoteFiles.map((f) => f.replace(/\\/g, "/"))
|
|
@@ -11947,10 +12038,10 @@ var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact
|
|
|
11947
12038
|
const removedCount = await removeExtraFiles(cwd, remoteFilesSet);
|
|
11948
12039
|
if (removedCount > 0) {
|
|
11949
12040
|
console.log(
|
|
11950
|
-
|
|
12041
|
+
chalk23.green(`\u2713 Removed ${removedCount} files not in remote`)
|
|
11951
12042
|
);
|
|
11952
12043
|
}
|
|
11953
|
-
console.log(
|
|
12044
|
+
console.log(chalk23.dim("Extracting files..."));
|
|
11954
12045
|
await tar5.extract({
|
|
11955
12046
|
file: tarPath,
|
|
11956
12047
|
cwd,
|
|
@@ -11958,13 +12049,13 @@ var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact
|
|
|
11958
12049
|
});
|
|
11959
12050
|
await fs9.promises.unlink(tarPath);
|
|
11960
12051
|
await fs9.promises.rmdir(tmpDir);
|
|
11961
|
-
console.log(
|
|
12052
|
+
console.log(chalk23.green(`\u2713 Extracted ${remoteFiles.length} files`));
|
|
11962
12053
|
})
|
|
11963
12054
|
);
|
|
11964
12055
|
|
|
11965
12056
|
// src/commands/artifact/status.ts
|
|
11966
12057
|
import { Command as Command23 } from "commander";
|
|
11967
|
-
import
|
|
12058
|
+
import chalk24 from "chalk";
|
|
11968
12059
|
var statusCommand3 = new Command23().name("status").description("Show status of cloud artifact").action(
|
|
11969
12060
|
withErrorHandler(async () => {
|
|
11970
12061
|
const cwd = process.cwd();
|
|
@@ -11988,13 +12079,13 @@ var statusCommand3 = new Command23().name("status").description("Show status of
|
|
|
11988
12079
|
});
|
|
11989
12080
|
const shortVersion = info.versionId.slice(0, 8);
|
|
11990
12081
|
if ("empty" in info) {
|
|
11991
|
-
console.log(
|
|
11992
|
-
console.log(
|
|
12082
|
+
console.log(chalk24.green("\u2713 Found (empty)"));
|
|
12083
|
+
console.log(chalk24.dim(` Version: ${shortVersion}`));
|
|
11993
12084
|
} else {
|
|
11994
|
-
console.log(
|
|
11995
|
-
console.log(
|
|
11996
|
-
console.log(
|
|
11997
|
-
console.log(
|
|
12085
|
+
console.log(chalk24.green("\u2713 Found"));
|
|
12086
|
+
console.log(chalk24.dim(` Version: ${shortVersion}`));
|
|
12087
|
+
console.log(chalk24.dim(` Files: ${info.fileCount.toLocaleString()}`));
|
|
12088
|
+
console.log(chalk24.dim(` Size: ${formatBytes(info.size)}`));
|
|
11998
12089
|
}
|
|
11999
12090
|
} catch (error) {
|
|
12000
12091
|
if (error instanceof ApiRequestError && error.status === 404) {
|
|
@@ -12009,14 +12100,14 @@ var statusCommand3 = new Command23().name("status").description("Show status of
|
|
|
12009
12100
|
|
|
12010
12101
|
// src/commands/artifact/list.ts
|
|
12011
12102
|
import { Command as Command24 } from "commander";
|
|
12012
|
-
import
|
|
12103
|
+
import chalk25 from "chalk";
|
|
12013
12104
|
var listCommand3 = new Command24().name("list").alias("ls").description("List all remote artifacts").action(
|
|
12014
12105
|
withErrorHandler(async () => {
|
|
12015
12106
|
const items = await listStorages({ type: "artifact" });
|
|
12016
12107
|
if (items.length === 0) {
|
|
12017
|
-
console.log(
|
|
12108
|
+
console.log(chalk25.dim("No artifacts found"));
|
|
12018
12109
|
console.log(
|
|
12019
|
-
|
|
12110
|
+
chalk25.dim(
|
|
12020
12111
|
" Create one with: vm0 artifact init && vm0 artifact push"
|
|
12021
12112
|
)
|
|
12022
12113
|
);
|
|
@@ -12037,7 +12128,7 @@ var listCommand3 = new Command24().name("list").alias("ls").description("List al
|
|
|
12037
12128
|
"FILES".padStart(filesWidth),
|
|
12038
12129
|
"UPDATED"
|
|
12039
12130
|
].join(" ");
|
|
12040
|
-
console.log(
|
|
12131
|
+
console.log(chalk25.dim(header));
|
|
12041
12132
|
for (const item of items) {
|
|
12042
12133
|
const row = [
|
|
12043
12134
|
item.name.padEnd(nameWidth),
|
|
@@ -12052,16 +12143,16 @@ var listCommand3 = new Command24().name("list").alias("ls").description("List al
|
|
|
12052
12143
|
|
|
12053
12144
|
// src/commands/artifact/clone.ts
|
|
12054
12145
|
import { Command as Command25 } from "commander";
|
|
12055
|
-
import
|
|
12146
|
+
import chalk26 from "chalk";
|
|
12056
12147
|
var cloneCommand2 = new Command25().name("clone").description("Clone a remote artifact to local directory (latest version)").argument("<name>", "Artifact name to clone").argument("[destination]", "Destination directory (default: artifact name)").action(
|
|
12057
12148
|
withErrorHandler(async (name, destination) => {
|
|
12058
12149
|
const targetDir = destination || name;
|
|
12059
12150
|
console.log(`Cloning artifact: ${name}`);
|
|
12060
12151
|
const result = await cloneStorage(name, "artifact", targetDir);
|
|
12061
|
-
console.log(
|
|
12152
|
+
console.log(chalk26.green(`
|
|
12062
12153
|
\u2713 Successfully cloned artifact: ${name}`));
|
|
12063
|
-
console.log(
|
|
12064
|
-
console.log(
|
|
12154
|
+
console.log(chalk26.dim(` Location: ${targetDir}/`));
|
|
12155
|
+
console.log(chalk26.dim(` Version: ${result.versionId.slice(0, 8)}`));
|
|
12065
12156
|
})
|
|
12066
12157
|
);
|
|
12067
12158
|
|
|
@@ -12073,7 +12164,7 @@ import { Command as Command33 } from "commander";
|
|
|
12073
12164
|
|
|
12074
12165
|
// src/commands/memory/init.ts
|
|
12075
12166
|
import { Command as Command27 } from "commander";
|
|
12076
|
-
import
|
|
12167
|
+
import chalk27 from "chalk";
|
|
12077
12168
|
import path12 from "path";
|
|
12078
12169
|
var initCommand3 = new Command27().name("init").description("Initialize a memory in the current directory").option("-n, --name <name>", "Memory name (required in non-interactive mode)").action(
|
|
12079
12170
|
withErrorHandler(async (options) => {
|
|
@@ -12083,22 +12174,22 @@ var initCommand3 = new Command27().name("init").description("Initialize a memory
|
|
|
12083
12174
|
if (existingConfig) {
|
|
12084
12175
|
if (existingConfig.type === "memory") {
|
|
12085
12176
|
console.log(
|
|
12086
|
-
|
|
12177
|
+
chalk27.yellow(`Memory already initialized: ${existingConfig.name}`)
|
|
12087
12178
|
);
|
|
12088
12179
|
} else {
|
|
12089
12180
|
console.log(
|
|
12090
|
-
|
|
12181
|
+
chalk27.yellow(
|
|
12091
12182
|
`Directory already initialized as ${existingConfig.type}: ${existingConfig.name}`
|
|
12092
12183
|
)
|
|
12093
12184
|
);
|
|
12094
12185
|
console.log(
|
|
12095
|
-
|
|
12186
|
+
chalk27.dim(
|
|
12096
12187
|
" To change type, delete .vm0/storage.yaml and reinitialize"
|
|
12097
12188
|
)
|
|
12098
12189
|
);
|
|
12099
12190
|
}
|
|
12100
12191
|
console.log(
|
|
12101
|
-
|
|
12192
|
+
chalk27.dim(`Config file: ${path12.join(cwd, ".vm0", "storage.yaml")}`)
|
|
12102
12193
|
);
|
|
12103
12194
|
return;
|
|
12104
12195
|
}
|
|
@@ -12122,7 +12213,7 @@ var initCommand3 = new Command27().name("init").description("Initialize a memory
|
|
|
12122
12213
|
}
|
|
12123
12214
|
);
|
|
12124
12215
|
if (name === void 0) {
|
|
12125
|
-
console.log(
|
|
12216
|
+
console.log(chalk27.dim("Cancelled"));
|
|
12126
12217
|
return;
|
|
12127
12218
|
}
|
|
12128
12219
|
memoryName = name;
|
|
@@ -12135,9 +12226,9 @@ var initCommand3 = new Command27().name("init").description("Initialize a memory
|
|
|
12135
12226
|
});
|
|
12136
12227
|
}
|
|
12137
12228
|
await writeStorageConfig(memoryName, cwd, "memory");
|
|
12138
|
-
console.log(
|
|
12229
|
+
console.log(chalk27.green(`\u2713 Initialized memory: ${memoryName}`));
|
|
12139
12230
|
console.log(
|
|
12140
|
-
|
|
12231
|
+
chalk27.dim(
|
|
12141
12232
|
` Config saved to ${path12.join(cwd, ".vm0", "storage.yaml")}`
|
|
12142
12233
|
)
|
|
12143
12234
|
);
|
|
@@ -12146,7 +12237,7 @@ var initCommand3 = new Command27().name("init").description("Initialize a memory
|
|
|
12146
12237
|
|
|
12147
12238
|
// src/commands/memory/push.ts
|
|
12148
12239
|
import { Command as Command28 } from "commander";
|
|
12149
|
-
import
|
|
12240
|
+
import chalk28 from "chalk";
|
|
12150
12241
|
var pushCommand3 = new Command28().name("push").description("Push local files to cloud memory").option(
|
|
12151
12242
|
"-f, --force",
|
|
12152
12243
|
"Force upload even if content unchanged (recreate archive)"
|
|
@@ -12168,42 +12259,42 @@ var pushCommand3 = new Command28().name("push").description("Push local files to
|
|
|
12168
12259
|
console.log(`Pushing memory: ${config.name}`);
|
|
12169
12260
|
const result = await directUpload(config.name, "memory", cwd, {
|
|
12170
12261
|
onProgress: (message) => {
|
|
12171
|
-
console.log(
|
|
12262
|
+
console.log(chalk28.dim(message));
|
|
12172
12263
|
},
|
|
12173
12264
|
force: options.force
|
|
12174
12265
|
});
|
|
12175
12266
|
const shortVersion = result.versionId.slice(0, 8);
|
|
12176
12267
|
if (result.empty) {
|
|
12177
|
-
console.log(
|
|
12268
|
+
console.log(chalk28.dim("No files found (empty memory)"));
|
|
12178
12269
|
} else if (result.deduplicated) {
|
|
12179
|
-
console.log(
|
|
12270
|
+
console.log(chalk28.green("\u2713 Content unchanged (deduplicated)"));
|
|
12180
12271
|
} else {
|
|
12181
|
-
console.log(
|
|
12272
|
+
console.log(chalk28.green("\u2713 Upload complete"));
|
|
12182
12273
|
}
|
|
12183
|
-
console.log(
|
|
12184
|
-
console.log(
|
|
12185
|
-
console.log(
|
|
12274
|
+
console.log(chalk28.dim(` Version: ${shortVersion}`));
|
|
12275
|
+
console.log(chalk28.dim(` Files: ${result.fileCount.toLocaleString()}`));
|
|
12276
|
+
console.log(chalk28.dim(` Size: ${formatBytes(result.size)}`));
|
|
12186
12277
|
})
|
|
12187
12278
|
);
|
|
12188
12279
|
|
|
12189
12280
|
// src/commands/memory/pull.ts
|
|
12190
12281
|
import { Command as Command29 } from "commander";
|
|
12191
|
-
import
|
|
12282
|
+
import chalk29 from "chalk";
|
|
12192
12283
|
var pullCommand3 = new Command29().name("pull").description("Pull remote memory to local directory (latest version)").argument("[name]", "Memory name to pull", "memory").argument("[destination]", "Destination directory (default: memory name)").action(
|
|
12193
12284
|
withErrorHandler(async (name, destination) => {
|
|
12194
12285
|
const targetDir = destination || name;
|
|
12195
12286
|
console.log(`Pulling memory: ${name}`);
|
|
12196
12287
|
const result = await cloneStorage(name, "memory", targetDir);
|
|
12197
|
-
console.log(
|
|
12288
|
+
console.log(chalk29.green(`
|
|
12198
12289
|
\u2713 Successfully pulled memory: ${name}`));
|
|
12199
|
-
console.log(
|
|
12200
|
-
console.log(
|
|
12290
|
+
console.log(chalk29.dim(` Location: ${targetDir}/`));
|
|
12291
|
+
console.log(chalk29.dim(` Version: ${result.versionId.slice(0, 8)}`));
|
|
12201
12292
|
})
|
|
12202
12293
|
);
|
|
12203
12294
|
|
|
12204
12295
|
// src/commands/memory/status.ts
|
|
12205
12296
|
import { Command as Command30 } from "commander";
|
|
12206
|
-
import
|
|
12297
|
+
import chalk30 from "chalk";
|
|
12207
12298
|
var statusCommand4 = new Command30().name("status").description("Show status of cloud memory").action(
|
|
12208
12299
|
withErrorHandler(async () => {
|
|
12209
12300
|
const cwd = process.cwd();
|
|
@@ -12227,13 +12318,13 @@ var statusCommand4 = new Command30().name("status").description("Show status of
|
|
|
12227
12318
|
});
|
|
12228
12319
|
const shortVersion = info.versionId.slice(0, 8);
|
|
12229
12320
|
if ("empty" in info) {
|
|
12230
|
-
console.log(
|
|
12231
|
-
console.log(
|
|
12321
|
+
console.log(chalk30.green("\u2713 Found (empty)"));
|
|
12322
|
+
console.log(chalk30.dim(` Version: ${shortVersion}`));
|
|
12232
12323
|
} else {
|
|
12233
|
-
console.log(
|
|
12234
|
-
console.log(
|
|
12235
|
-
console.log(
|
|
12236
|
-
console.log(
|
|
12324
|
+
console.log(chalk30.green("\u2713 Found"));
|
|
12325
|
+
console.log(chalk30.dim(` Version: ${shortVersion}`));
|
|
12326
|
+
console.log(chalk30.dim(` Files: ${info.fileCount.toLocaleString()}`));
|
|
12327
|
+
console.log(chalk30.dim(` Size: ${formatBytes(info.size)}`));
|
|
12237
12328
|
}
|
|
12238
12329
|
} catch (error) {
|
|
12239
12330
|
if (error instanceof ApiRequestError && error.status === 404) {
|
|
@@ -12248,14 +12339,14 @@ var statusCommand4 = new Command30().name("status").description("Show status of
|
|
|
12248
12339
|
|
|
12249
12340
|
// src/commands/memory/list.ts
|
|
12250
12341
|
import { Command as Command31 } from "commander";
|
|
12251
|
-
import
|
|
12342
|
+
import chalk31 from "chalk";
|
|
12252
12343
|
var listCommand4 = new Command31().name("list").alias("ls").description("List all remote memory storages").action(
|
|
12253
12344
|
withErrorHandler(async () => {
|
|
12254
12345
|
const items = await listStorages({ type: "memory" });
|
|
12255
12346
|
if (items.length === 0) {
|
|
12256
|
-
console.log(
|
|
12347
|
+
console.log(chalk31.dim("No memory storages found"));
|
|
12257
12348
|
console.log(
|
|
12258
|
-
|
|
12349
|
+
chalk31.dim(" Memory is created automatically on first agent run")
|
|
12259
12350
|
);
|
|
12260
12351
|
return;
|
|
12261
12352
|
}
|
|
@@ -12274,7 +12365,7 @@ var listCommand4 = new Command31().name("list").alias("ls").description("List al
|
|
|
12274
12365
|
"FILES".padStart(filesWidth),
|
|
12275
12366
|
"UPDATED"
|
|
12276
12367
|
].join(" ");
|
|
12277
|
-
console.log(
|
|
12368
|
+
console.log(chalk31.dim(header));
|
|
12278
12369
|
for (const item of items) {
|
|
12279
12370
|
const row = [
|
|
12280
12371
|
item.name.padEnd(nameWidth),
|
|
@@ -12289,16 +12380,16 @@ var listCommand4 = new Command31().name("list").alias("ls").description("List al
|
|
|
12289
12380
|
|
|
12290
12381
|
// src/commands/memory/clone.ts
|
|
12291
12382
|
import { Command as Command32 } from "commander";
|
|
12292
|
-
import
|
|
12383
|
+
import chalk32 from "chalk";
|
|
12293
12384
|
var cloneCommand3 = new Command32().name("clone").description("Clone a remote memory to local directory (latest version)").argument("<name>", "Memory name to clone").argument("[destination]", "Destination directory (default: memory name)").action(
|
|
12294
12385
|
withErrorHandler(async (name, destination) => {
|
|
12295
12386
|
const targetDir = destination || name;
|
|
12296
12387
|
console.log(`Cloning memory: ${name}`);
|
|
12297
12388
|
const result = await cloneStorage(name, "memory", targetDir);
|
|
12298
|
-
console.log(
|
|
12389
|
+
console.log(chalk32.green(`
|
|
12299
12390
|
\u2713 Successfully cloned memory: ${name}`));
|
|
12300
|
-
console.log(
|
|
12301
|
-
console.log(
|
|
12391
|
+
console.log(chalk32.dim(` Location: ${targetDir}/`));
|
|
12392
|
+
console.log(chalk32.dim(` Version: ${result.versionId.slice(0, 8)}`));
|
|
12302
12393
|
})
|
|
12303
12394
|
);
|
|
12304
12395
|
|
|
@@ -12307,7 +12398,7 @@ var memoryCommand = new Command33().name("memory").description("Manage agent lon
|
|
|
12307
12398
|
|
|
12308
12399
|
// src/commands/cook/cook.ts
|
|
12309
12400
|
import { Command as Command34, Option as Option5 } from "commander";
|
|
12310
|
-
import
|
|
12401
|
+
import chalk34 from "chalk";
|
|
12311
12402
|
import { readFile as readFile7, mkdir as mkdir6 } from "fs/promises";
|
|
12312
12403
|
import { existsSync as existsSync10 } from "fs";
|
|
12313
12404
|
import path13 from "path";
|
|
@@ -12379,12 +12470,12 @@ async function saveCookState(state) {
|
|
|
12379
12470
|
}
|
|
12380
12471
|
|
|
12381
12472
|
// src/commands/cook/utils.ts
|
|
12382
|
-
import
|
|
12473
|
+
import chalk33 from "chalk";
|
|
12383
12474
|
import { existsSync as existsSync9 } from "fs";
|
|
12384
12475
|
var CONFIG_FILE2 = "vm0.yaml";
|
|
12385
12476
|
var ARTIFACT_DIR = "artifact";
|
|
12386
12477
|
function printCommand(cmd) {
|
|
12387
|
-
console.log(
|
|
12478
|
+
console.log(chalk33.dim(`> ${cmd}`));
|
|
12388
12479
|
}
|
|
12389
12480
|
function execVm0Command(args, options = {}) {
|
|
12390
12481
|
return new Promise((resolve2, reject) => {
|
|
@@ -12483,7 +12574,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
12483
12574
|
);
|
|
12484
12575
|
if (serverVersion && existsSync9(artifactDir)) {
|
|
12485
12576
|
console.log();
|
|
12486
|
-
console.log(
|
|
12577
|
+
console.log(chalk33.bold("Pulling updated artifact:"));
|
|
12487
12578
|
printCommand(`cd ${ARTIFACT_DIR}`);
|
|
12488
12579
|
printCommand(`vm0 artifact pull ${serverVersion}`);
|
|
12489
12580
|
try {
|
|
@@ -12493,9 +12584,9 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
12493
12584
|
});
|
|
12494
12585
|
printCommand("cd ..");
|
|
12495
12586
|
} catch (error) {
|
|
12496
|
-
console.error(
|
|
12587
|
+
console.error(chalk33.red(`\u2717 Artifact pull failed`));
|
|
12497
12588
|
if (error instanceof Error) {
|
|
12498
|
-
console.error(
|
|
12589
|
+
console.error(chalk33.dim(` ${error.message}`));
|
|
12499
12590
|
}
|
|
12500
12591
|
}
|
|
12501
12592
|
}
|
|
@@ -12503,7 +12594,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
12503
12594
|
|
|
12504
12595
|
// src/commands/cook/cook.ts
|
|
12505
12596
|
async function loadAndValidateConfig2() {
|
|
12506
|
-
console.log(
|
|
12597
|
+
console.log(chalk34.bold(`Reading config: ${CONFIG_FILE2}`));
|
|
12507
12598
|
if (!existsSync10(CONFIG_FILE2)) {
|
|
12508
12599
|
throw new Error(`Config file not found: ${CONFIG_FILE2}`);
|
|
12509
12600
|
}
|
|
@@ -12525,7 +12616,7 @@ async function loadAndValidateConfig2() {
|
|
|
12525
12616
|
const agentName = agentNames[0];
|
|
12526
12617
|
const volumeCount = config.volumes ? Object.keys(config.volumes).length : 0;
|
|
12527
12618
|
console.log(
|
|
12528
|
-
|
|
12619
|
+
chalk34.green(`\u2713 Config validated: 1 agent, ${volumeCount} volume(s)`)
|
|
12529
12620
|
);
|
|
12530
12621
|
return { config, agentName, volumeCount };
|
|
12531
12622
|
}
|
|
@@ -12534,7 +12625,7 @@ async function processVolumes(config, cwd) {
|
|
|
12534
12625
|
return;
|
|
12535
12626
|
}
|
|
12536
12627
|
console.log();
|
|
12537
|
-
console.log(
|
|
12628
|
+
console.log(chalk34.bold("Processing volumes:"));
|
|
12538
12629
|
for (const volumeConfig of Object.values(config.volumes)) {
|
|
12539
12630
|
const volumeDir = path13.join(cwd, volumeConfig.name);
|
|
12540
12631
|
if (!existsSync10(volumeDir)) {
|
|
@@ -12568,7 +12659,7 @@ async function processVolumes(config, cwd) {
|
|
|
12568
12659
|
}
|
|
12569
12660
|
async function processArtifact(cwd) {
|
|
12570
12661
|
console.log();
|
|
12571
|
-
console.log(
|
|
12662
|
+
console.log(chalk34.bold("Processing artifact:"));
|
|
12572
12663
|
const artifactDir = path13.join(cwd, ARTIFACT_DIR);
|
|
12573
12664
|
try {
|
|
12574
12665
|
if (!existsSync10(artifactDir)) {
|
|
@@ -12600,7 +12691,7 @@ async function processArtifact(cwd) {
|
|
|
12600
12691
|
}
|
|
12601
12692
|
async function composeAgent(cwd, skipConfirm) {
|
|
12602
12693
|
console.log();
|
|
12603
|
-
console.log(
|
|
12694
|
+
console.log(chalk34.bold("Composing agent:"));
|
|
12604
12695
|
const composeArgs = skipConfirm ? ["compose", "--yes", CONFIG_FILE2] : ["compose", CONFIG_FILE2];
|
|
12605
12696
|
printCommand(`vm0 ${composeArgs.join(" ")}`);
|
|
12606
12697
|
try {
|
|
@@ -12614,7 +12705,7 @@ async function composeAgent(cwd, skipConfirm) {
|
|
|
12614
12705
|
}
|
|
12615
12706
|
async function runAgent(agentName, artifactDir, prompt, cwd, options) {
|
|
12616
12707
|
console.log();
|
|
12617
|
-
console.log(
|
|
12708
|
+
console.log(chalk34.bold("Running agent:"));
|
|
12618
12709
|
printCommand(
|
|
12619
12710
|
`vm0 run ${agentName} --artifact-name ${ARTIFACT_DIR} "${prompt}"`
|
|
12620
12711
|
);
|
|
@@ -12647,7 +12738,7 @@ var cookAction = new Command34().name("cook").description("Quick start: prepare,
|
|
|
12647
12738
|
withErrorHandler(
|
|
12648
12739
|
async (prompt, options) => {
|
|
12649
12740
|
if (options.autoUpdate !== false) {
|
|
12650
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
12741
|
+
const shouldExit = await checkAndUpgrade("9.59.0", prompt);
|
|
12651
12742
|
if (shouldExit) {
|
|
12652
12743
|
process.exit(0);
|
|
12653
12744
|
}
|
|
@@ -12830,7 +12921,7 @@ var cookCommand = cookAction;
|
|
|
12830
12921
|
|
|
12831
12922
|
// src/commands/logs/index.ts
|
|
12832
12923
|
import { Command as Command39 } from "commander";
|
|
12833
|
-
import
|
|
12924
|
+
import chalk36 from "chalk";
|
|
12834
12925
|
|
|
12835
12926
|
// src/lib/api/api-client.ts
|
|
12836
12927
|
import { initClient as initClient12 } from "@ts-rest/core";
|
|
@@ -13528,7 +13619,7 @@ async function paginate(options) {
|
|
|
13528
13619
|
|
|
13529
13620
|
// src/commands/logs/search.ts
|
|
13530
13621
|
import { Command as Command38 } from "commander";
|
|
13531
|
-
import
|
|
13622
|
+
import chalk35 from "chalk";
|
|
13532
13623
|
var SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
13533
13624
|
function renderEvent(event, renderer) {
|
|
13534
13625
|
const eventData = event.eventData;
|
|
@@ -13584,7 +13675,7 @@ function renderResults(response) {
|
|
|
13584
13675
|
isFirstGroup = false;
|
|
13585
13676
|
const firstTimestamp = group.results[0].matchedEvent.createdAt;
|
|
13586
13677
|
console.log(
|
|
13587
|
-
|
|
13678
|
+
chalk35.bold(formatRunHeader(runId, group.agentName, firstTimestamp))
|
|
13588
13679
|
);
|
|
13589
13680
|
for (const result of group.results) {
|
|
13590
13681
|
const renderer = new EventRenderer({
|
|
@@ -13604,7 +13695,7 @@ function renderResults(response) {
|
|
|
13604
13695
|
if (response.hasMore) {
|
|
13605
13696
|
console.log();
|
|
13606
13697
|
console.log(
|
|
13607
|
-
|
|
13698
|
+
chalk35.dim(
|
|
13608
13699
|
` Showing first ${response.results.length} matches. Use --limit to see more.`
|
|
13609
13700
|
)
|
|
13610
13701
|
);
|
|
@@ -13625,9 +13716,9 @@ var searchCommand = new Command38().name("search").description("Search agent eve
|
|
|
13625
13716
|
after
|
|
13626
13717
|
});
|
|
13627
13718
|
if (response.results.length === 0) {
|
|
13628
|
-
console.log(
|
|
13719
|
+
console.log(chalk35.dim("No matches found"));
|
|
13629
13720
|
console.log(
|
|
13630
|
-
|
|
13721
|
+
chalk35.dim(
|
|
13631
13722
|
" Try a broader search with --since 30d or a different keyword"
|
|
13632
13723
|
)
|
|
13633
13724
|
);
|
|
@@ -13664,28 +13755,28 @@ function formatNetworkLog(entry) {
|
|
|
13664
13755
|
let statusColor;
|
|
13665
13756
|
const status = entry.status || 0;
|
|
13666
13757
|
if (status >= 200 && status < 300) {
|
|
13667
|
-
statusColor =
|
|
13758
|
+
statusColor = chalk36.green;
|
|
13668
13759
|
} else if (status >= 300 && status < 400) {
|
|
13669
|
-
statusColor =
|
|
13760
|
+
statusColor = chalk36.yellow;
|
|
13670
13761
|
} else if (status >= 400) {
|
|
13671
|
-
statusColor =
|
|
13762
|
+
statusColor = chalk36.red;
|
|
13672
13763
|
} else {
|
|
13673
|
-
statusColor =
|
|
13764
|
+
statusColor = chalk36.gray;
|
|
13674
13765
|
}
|
|
13675
13766
|
let latencyColor;
|
|
13676
13767
|
const latencyMs = entry.latency_ms || 0;
|
|
13677
13768
|
if (latencyMs < 500) {
|
|
13678
|
-
latencyColor =
|
|
13769
|
+
latencyColor = chalk36.green;
|
|
13679
13770
|
} else if (latencyMs < 2e3) {
|
|
13680
|
-
latencyColor =
|
|
13771
|
+
latencyColor = chalk36.yellow;
|
|
13681
13772
|
} else {
|
|
13682
|
-
latencyColor =
|
|
13773
|
+
latencyColor = chalk36.red;
|
|
13683
13774
|
}
|
|
13684
13775
|
const method = entry.method || "???";
|
|
13685
13776
|
const requestSize = entry.request_size || 0;
|
|
13686
13777
|
const responseSize = entry.response_size || 0;
|
|
13687
13778
|
const url = entry.url || entry.host || "unknown";
|
|
13688
|
-
return `[${entry.timestamp}] ${method.padEnd(6)} ${statusColor(status)} ${latencyColor(latencyMs + "ms")} ${formatBytes(requestSize)}/${formatBytes(responseSize)} ${
|
|
13779
|
+
return `[${entry.timestamp}] ${method.padEnd(6)} ${statusColor(status)} ${latencyColor(latencyMs + "ms")} ${formatBytes(requestSize)}/${formatBytes(responseSize)} ${chalk36.dim(url)}`;
|
|
13689
13780
|
}
|
|
13690
13781
|
function createLogRenderer(verbose) {
|
|
13691
13782
|
return new EventRenderer({
|
|
@@ -13791,7 +13882,7 @@ async function showAgentEvents(runId, options, platformUrl) {
|
|
|
13791
13882
|
order: options.order
|
|
13792
13883
|
});
|
|
13793
13884
|
if (firstResponse.events.length === 0) {
|
|
13794
|
-
console.log(
|
|
13885
|
+
console.log(chalk36.yellow("No agent events found for this run"));
|
|
13795
13886
|
return;
|
|
13796
13887
|
}
|
|
13797
13888
|
const framework = firstResponse.framework;
|
|
@@ -13824,7 +13915,7 @@ async function showAgentEvents(runId, options, platformUrl) {
|
|
|
13824
13915
|
for (const event of events) {
|
|
13825
13916
|
renderAgentEvent(event, framework, renderer);
|
|
13826
13917
|
}
|
|
13827
|
-
console.log(
|
|
13918
|
+
console.log(chalk36.dim(`View on platform: ${platformUrl}`));
|
|
13828
13919
|
}
|
|
13829
13920
|
async function showSystemLog(runId, options) {
|
|
13830
13921
|
const limit = options.targetCount === "all" ? PAGE_LIMIT : Math.min(options.targetCount, PAGE_LIMIT);
|
|
@@ -13834,7 +13925,7 @@ async function showSystemLog(runId, options) {
|
|
|
13834
13925
|
order: options.order
|
|
13835
13926
|
});
|
|
13836
13927
|
if (!response.systemLog) {
|
|
13837
|
-
console.log(
|
|
13928
|
+
console.log(chalk36.yellow("No system log found for this run"));
|
|
13838
13929
|
return;
|
|
13839
13930
|
}
|
|
13840
13931
|
console.log(response.systemLog);
|
|
@@ -13846,7 +13937,7 @@ async function showMetrics(runId, options) {
|
|
|
13846
13937
|
order: options.order
|
|
13847
13938
|
});
|
|
13848
13939
|
if (firstResponse.metrics.length === 0) {
|
|
13849
|
-
console.log(
|
|
13940
|
+
console.log(chalk36.yellow("No metrics found for this run"));
|
|
13850
13941
|
return;
|
|
13851
13942
|
}
|
|
13852
13943
|
let allMetrics;
|
|
@@ -13886,7 +13977,7 @@ async function showNetworkLogs(runId, options) {
|
|
|
13886
13977
|
});
|
|
13887
13978
|
if (firstResponse.networkLogs.length === 0) {
|
|
13888
13979
|
console.log(
|
|
13889
|
-
|
|
13980
|
+
chalk36.yellow(
|
|
13890
13981
|
"No network logs found for this run. Network logs are only captured when using a runner with proxy enabled"
|
|
13891
13982
|
)
|
|
13892
13983
|
);
|
|
@@ -13927,13 +14018,13 @@ import { Command as Command48 } from "commander";
|
|
|
13927
14018
|
|
|
13928
14019
|
// src/commands/org/status.ts
|
|
13929
14020
|
import { Command as Command40 } from "commander";
|
|
13930
|
-
import
|
|
14021
|
+
import chalk37 from "chalk";
|
|
13931
14022
|
var statusCommand5 = new Command40().name("status").description("View current organization status").action(
|
|
13932
14023
|
withErrorHandler(async () => {
|
|
13933
14024
|
try {
|
|
13934
14025
|
const org = await getOrg();
|
|
13935
|
-
console.log(
|
|
13936
|
-
console.log(` Slug: ${
|
|
14026
|
+
console.log(chalk37.bold("Organization Information:"));
|
|
14027
|
+
console.log(` Slug: ${chalk37.green(org.slug)}`);
|
|
13937
14028
|
} catch (error) {
|
|
13938
14029
|
if (error instanceof Error && error.message.includes("No org configured")) {
|
|
13939
14030
|
throw new Error("No organization configured", {
|
|
@@ -13947,7 +14038,7 @@ var statusCommand5 = new Command40().name("status").description("View current or
|
|
|
13947
14038
|
|
|
13948
14039
|
// src/commands/org/set.ts
|
|
13949
14040
|
import { Command as Command41 } from "commander";
|
|
13950
|
-
import
|
|
14041
|
+
import chalk38 from "chalk";
|
|
13951
14042
|
var setCommand = new Command41().name("set").description("Rename your organization slug").argument("<slug>", "The new organization slug").option(
|
|
13952
14043
|
"--force",
|
|
13953
14044
|
"Force change existing organization (may break references)"
|
|
@@ -13965,10 +14056,10 @@ var setCommand = new Command41().name("set").description("Rename your organizati
|
|
|
13965
14056
|
}
|
|
13966
14057
|
const org = await updateOrg({ slug, force: true });
|
|
13967
14058
|
await saveConfig({ activeOrg: org.slug });
|
|
13968
|
-
console.log(
|
|
14059
|
+
console.log(chalk38.green(`\u2713 Organization updated to ${org.slug}`));
|
|
13969
14060
|
console.log();
|
|
13970
14061
|
console.log("Your agents will now be namespaced as:");
|
|
13971
|
-
console.log(
|
|
14062
|
+
console.log(chalk38.cyan(` ${org.slug}/<agent-name>`));
|
|
13972
14063
|
} catch (error) {
|
|
13973
14064
|
if (error instanceof Error && error.message.includes("already exists")) {
|
|
13974
14065
|
throw new Error(
|
|
@@ -13982,17 +14073,17 @@ var setCommand = new Command41().name("set").description("Rename your organizati
|
|
|
13982
14073
|
|
|
13983
14074
|
// src/commands/org/list.ts
|
|
13984
14075
|
import { Command as Command42 } from "commander";
|
|
13985
|
-
import
|
|
14076
|
+
import chalk39 from "chalk";
|
|
13986
14077
|
var listCommand5 = new Command42().name("list").description("List all accessible organizations").action(
|
|
13987
14078
|
withErrorHandler(async () => {
|
|
13988
14079
|
const result = await listOrgs();
|
|
13989
14080
|
const activeOrg = await getActiveOrg();
|
|
13990
|
-
console.log(
|
|
14081
|
+
console.log(chalk39.bold("Available organizations:"));
|
|
13991
14082
|
for (const org of result.orgs) {
|
|
13992
14083
|
const isCurrent = org.slug === activeOrg;
|
|
13993
|
-
const marker = isCurrent ?
|
|
14084
|
+
const marker = isCurrent ? chalk39.green("* ") : " ";
|
|
13994
14085
|
const roleLabel = org.role ? ` (${org.role})` : "";
|
|
13995
|
-
const currentLabel = isCurrent ?
|
|
14086
|
+
const currentLabel = isCurrent ? chalk39.dim(" \u2190 current") : "";
|
|
13996
14087
|
console.log(`${marker}${org.slug}${roleLabel}${currentLabel}`);
|
|
13997
14088
|
}
|
|
13998
14089
|
})
|
|
@@ -14000,13 +14091,13 @@ var listCommand5 = new Command42().name("list").description("List all accessible
|
|
|
14000
14091
|
|
|
14001
14092
|
// src/commands/org/use.ts
|
|
14002
14093
|
import { Command as Command43 } from "commander";
|
|
14003
|
-
import
|
|
14094
|
+
import chalk40 from "chalk";
|
|
14004
14095
|
var useCommand = new Command43().name("use").description("Switch to a different organization").argument("[slug]", "Organization slug to switch to").option("--personal", "Switch to personal org").action(
|
|
14005
14096
|
withErrorHandler(
|
|
14006
14097
|
async (slug, options) => {
|
|
14007
14098
|
if (options.personal) {
|
|
14008
14099
|
await saveConfig({ activeOrg: void 0 });
|
|
14009
|
-
console.log(
|
|
14100
|
+
console.log(chalk40.green("\u2713 Switched to personal org."));
|
|
14010
14101
|
return;
|
|
14011
14102
|
}
|
|
14012
14103
|
if (!slug) {
|
|
@@ -14022,27 +14113,27 @@ var useCommand = new Command43().name("use").description("Switch to a different
|
|
|
14022
14113
|
);
|
|
14023
14114
|
}
|
|
14024
14115
|
await saveConfig({ activeOrg: slug });
|
|
14025
|
-
console.log(
|
|
14116
|
+
console.log(chalk40.green(`\u2713 Switched to organization: ${slug}`));
|
|
14026
14117
|
}
|
|
14027
14118
|
)
|
|
14028
14119
|
);
|
|
14029
14120
|
|
|
14030
14121
|
// src/commands/org/members.ts
|
|
14031
14122
|
import { Command as Command44 } from "commander";
|
|
14032
|
-
import
|
|
14123
|
+
import chalk41 from "chalk";
|
|
14033
14124
|
var membersCommand = new Command44().name("members").description("View organization members").action(
|
|
14034
14125
|
withErrorHandler(async () => {
|
|
14035
14126
|
try {
|
|
14036
14127
|
const status = await getOrgMembers();
|
|
14037
|
-
console.log(
|
|
14128
|
+
console.log(chalk41.bold(`Organization: ${status.slug}`));
|
|
14038
14129
|
console.log(` Role: ${status.role}`);
|
|
14039
14130
|
console.log(
|
|
14040
14131
|
` Created: ${new Date(status.createdAt).toLocaleDateString()}`
|
|
14041
14132
|
);
|
|
14042
14133
|
console.log();
|
|
14043
|
-
console.log(
|
|
14134
|
+
console.log(chalk41.bold("Members:"));
|
|
14044
14135
|
for (const member of status.members) {
|
|
14045
|
-
const roleTag = member.role === "admin" ?
|
|
14136
|
+
const roleTag = member.role === "admin" ? chalk41.yellow(` (${member.role})`) : chalk41.dim(` (${member.role})`);
|
|
14046
14137
|
console.log(` ${member.email}${roleTag}`);
|
|
14047
14138
|
}
|
|
14048
14139
|
} catch (error) {
|
|
@@ -14058,33 +14149,33 @@ var membersCommand = new Command44().name("members").description("View organizat
|
|
|
14058
14149
|
|
|
14059
14150
|
// src/commands/org/invite.ts
|
|
14060
14151
|
import { Command as Command45 } from "commander";
|
|
14061
|
-
import
|
|
14152
|
+
import chalk42 from "chalk";
|
|
14062
14153
|
var inviteCommand = new Command45().name("invite").description("Invite a member to the current organization").requiredOption("--email <email>", "Email address of the member to invite").action(
|
|
14063
14154
|
withErrorHandler(async (options) => {
|
|
14064
14155
|
await inviteOrgMember(options.email);
|
|
14065
|
-
console.log(
|
|
14156
|
+
console.log(chalk42.green(`\u2713 Invitation sent to ${options.email}`));
|
|
14066
14157
|
})
|
|
14067
14158
|
);
|
|
14068
14159
|
|
|
14069
14160
|
// src/commands/org/remove.ts
|
|
14070
14161
|
import { Command as Command46 } from "commander";
|
|
14071
|
-
import
|
|
14162
|
+
import chalk43 from "chalk";
|
|
14072
14163
|
var removeCommand = new Command46().name("remove").description("Remove a member from the current organization").argument("<email>", "Email address of the member to remove").action(
|
|
14073
14164
|
withErrorHandler(async (email) => {
|
|
14074
14165
|
await removeOrgMember(email);
|
|
14075
|
-
console.log(
|
|
14166
|
+
console.log(chalk43.green(`\u2713 Removed ${email} from organization`));
|
|
14076
14167
|
})
|
|
14077
14168
|
);
|
|
14078
14169
|
|
|
14079
14170
|
// src/commands/org/leave.ts
|
|
14080
14171
|
import { Command as Command47 } from "commander";
|
|
14081
|
-
import
|
|
14172
|
+
import chalk44 from "chalk";
|
|
14082
14173
|
var leaveCommand = new Command47().name("leave").description("Leave the current organization").action(
|
|
14083
14174
|
withErrorHandler(async () => {
|
|
14084
14175
|
await leaveOrg();
|
|
14085
14176
|
await saveConfig({ activeOrg: void 0 });
|
|
14086
14177
|
console.log(
|
|
14087
|
-
|
|
14178
|
+
chalk44.green("\u2713 Left organization. Switched to personal org.")
|
|
14088
14179
|
);
|
|
14089
14180
|
})
|
|
14090
14181
|
);
|
|
@@ -14097,7 +14188,7 @@ import { Command as Command58 } from "commander";
|
|
|
14097
14188
|
|
|
14098
14189
|
// src/commands/agent/clone.ts
|
|
14099
14190
|
import { Command as Command49 } from "commander";
|
|
14100
|
-
import
|
|
14191
|
+
import chalk45 from "chalk";
|
|
14101
14192
|
import { mkdtempSync as mkdtempSync5 } from "fs";
|
|
14102
14193
|
import { mkdir as mkdir7, writeFile as writeFile6, readdir as readdir2, copyFile, rm as rm4 } from "fs/promises";
|
|
14103
14194
|
import { join as join10, dirname as dirname3, resolve, sep } from "path";
|
|
@@ -14128,13 +14219,13 @@ async function downloadInstructions(agentName, instructionsPath, destination) {
|
|
|
14128
14219
|
throw new Error("Invalid instructions path: path traversal detected");
|
|
14129
14220
|
}
|
|
14130
14221
|
const volumeName = getInstructionsStorageName(agentName);
|
|
14131
|
-
console.log(
|
|
14222
|
+
console.log(chalk45.dim("Downloading instructions..."));
|
|
14132
14223
|
const downloadInfo = await getStorageDownload({
|
|
14133
14224
|
name: volumeName,
|
|
14134
14225
|
type: "volume"
|
|
14135
14226
|
});
|
|
14136
14227
|
if ("empty" in downloadInfo) {
|
|
14137
|
-
console.log(
|
|
14228
|
+
console.log(chalk45.yellow("\u26A0 Instructions volume is empty"));
|
|
14138
14229
|
return false;
|
|
14139
14230
|
}
|
|
14140
14231
|
const response = await fetch(downloadInfo.url);
|
|
@@ -14149,7 +14240,7 @@ async function downloadInstructions(agentName, instructionsPath, destination) {
|
|
|
14149
14240
|
const files = await readdir2(tmpDir);
|
|
14150
14241
|
const mdFile = files.find((f) => f === "CLAUDE.md" || f === "AGENTS.md");
|
|
14151
14242
|
if (!mdFile) {
|
|
14152
|
-
console.log(
|
|
14243
|
+
console.log(chalk45.yellow("\u26A0 No instructions file found in volume"));
|
|
14153
14244
|
await rm4(tmpDir, { recursive: true, force: true });
|
|
14154
14245
|
return false;
|
|
14155
14246
|
}
|
|
@@ -14179,7 +14270,7 @@ var cloneCommand4 = new Command49().name("clone").description("Clone agent compo
|
|
|
14179
14270
|
await mkdir7(targetDir, { recursive: true });
|
|
14180
14271
|
const yamlPath = join10(targetDir, "vm0.yaml");
|
|
14181
14272
|
await writeFile6(yamlPath, yamlContent, "utf8");
|
|
14182
|
-
console.log(
|
|
14273
|
+
console.log(chalk45.green("\u2713 Created vm0.yaml"));
|
|
14183
14274
|
const agentKey = Object.keys(content.agents)[0];
|
|
14184
14275
|
const agent = agentKey ? content.agents[agentKey] : void 0;
|
|
14185
14276
|
if (agent?.instructions) {
|
|
@@ -14190,26 +14281,26 @@ var cloneCommand4 = new Command49().name("clone").description("Clone agent compo
|
|
|
14190
14281
|
targetDir
|
|
14191
14282
|
);
|
|
14192
14283
|
if (instructionsDownloaded) {
|
|
14193
|
-
console.log(
|
|
14284
|
+
console.log(chalk45.green(`\u2713 Downloaded ${agent.instructions}`));
|
|
14194
14285
|
}
|
|
14195
14286
|
} catch (error) {
|
|
14196
14287
|
console.log(
|
|
14197
|
-
|
|
14288
|
+
chalk45.yellow(
|
|
14198
14289
|
`\u26A0 Could not download instructions: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
14199
14290
|
)
|
|
14200
14291
|
);
|
|
14201
14292
|
}
|
|
14202
14293
|
}
|
|
14203
14294
|
console.log();
|
|
14204
|
-
console.log(
|
|
14205
|
-
console.log(
|
|
14206
|
-
console.log(
|
|
14295
|
+
console.log(chalk45.green(`\u2713 Successfully cloned agent: ${name}`));
|
|
14296
|
+
console.log(chalk45.dim(` Location: ${targetDir}/`));
|
|
14297
|
+
console.log(chalk45.dim(` Version: ${compose.headVersionId.slice(0, 8)}`));
|
|
14207
14298
|
})
|
|
14208
14299
|
);
|
|
14209
14300
|
|
|
14210
14301
|
// src/commands/agent/delete.ts
|
|
14211
14302
|
import { Command as Command50 } from "commander";
|
|
14212
|
-
import
|
|
14303
|
+
import chalk46 from "chalk";
|
|
14213
14304
|
var deleteCommand = new Command50().name("delete").alias("rm").description("Delete an agent").argument("<name>", "Agent name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
14214
14305
|
withErrorHandler(async (name, options) => {
|
|
14215
14306
|
const compose = await getComposeByName(name);
|
|
@@ -14224,7 +14315,7 @@ var deleteCommand = new Command50().name("delete").alias("rm").description("Dele
|
|
|
14224
14315
|
}
|
|
14225
14316
|
const confirmed = await promptConfirm(`Delete agent '${name}'?`, false);
|
|
14226
14317
|
if (!confirmed) {
|
|
14227
|
-
console.log(
|
|
14318
|
+
console.log(chalk46.dim("Cancelled"));
|
|
14228
14319
|
return;
|
|
14229
14320
|
}
|
|
14230
14321
|
}
|
|
@@ -14238,13 +14329,13 @@ var deleteCommand = new Command50().name("delete").alias("rm").description("Dele
|
|
|
14238
14329
|
}
|
|
14239
14330
|
throw error;
|
|
14240
14331
|
}
|
|
14241
|
-
console.log(
|
|
14332
|
+
console.log(chalk46.green(`\u2713 Agent '${name}' deleted`));
|
|
14242
14333
|
})
|
|
14243
14334
|
);
|
|
14244
14335
|
|
|
14245
14336
|
// src/commands/agent/list.ts
|
|
14246
14337
|
import { Command as Command51 } from "commander";
|
|
14247
|
-
import
|
|
14338
|
+
import chalk47 from "chalk";
|
|
14248
14339
|
var listCommand6 = new Command51().name("list").alias("ls").description("List all agent composes").action(
|
|
14249
14340
|
withErrorHandler(async () => {
|
|
14250
14341
|
const response = await httpGet("/api/agent/composes/list");
|
|
@@ -14254,19 +14345,19 @@ var listCommand6 = new Command51().name("list").alias("ls").description("List al
|
|
|
14254
14345
|
}
|
|
14255
14346
|
const data = await response.json();
|
|
14256
14347
|
if (data.composes.length === 0) {
|
|
14257
|
-
console.log(
|
|
14348
|
+
console.log(chalk47.dim("No agent composes found"));
|
|
14258
14349
|
console.log(
|
|
14259
|
-
|
|
14350
|
+
chalk47.dim(" Create one with: vm0 compose <agent-compose.yaml>")
|
|
14260
14351
|
);
|
|
14261
14352
|
return;
|
|
14262
14353
|
}
|
|
14263
|
-
const nameWidth = Math.max(4, ...data.composes.map((
|
|
14354
|
+
const nameWidth = Math.max(4, ...data.composes.map((c24) => c24.name.length));
|
|
14264
14355
|
const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
|
|
14265
14356
|
" "
|
|
14266
14357
|
);
|
|
14267
|
-
console.log(
|
|
14358
|
+
console.log(chalk47.dim(header));
|
|
14268
14359
|
for (const compose of data.composes) {
|
|
14269
|
-
const versionShort = compose.headVersionId ? compose.headVersionId.slice(0, 8) :
|
|
14360
|
+
const versionShort = compose.headVersionId ? compose.headVersionId.slice(0, 8) : chalk47.dim("-");
|
|
14270
14361
|
const row = [
|
|
14271
14362
|
compose.name.padEnd(nameWidth),
|
|
14272
14363
|
versionShort,
|
|
@@ -14279,7 +14370,7 @@ var listCommand6 = new Command51().name("list").alias("ls").description("List al
|
|
|
14279
14370
|
|
|
14280
14371
|
// src/commands/agent/status.ts
|
|
14281
14372
|
import { Command as Command52 } from "commander";
|
|
14282
|
-
import
|
|
14373
|
+
import chalk48 from "chalk";
|
|
14283
14374
|
|
|
14284
14375
|
// src/lib/domain/source-derivation.ts
|
|
14285
14376
|
import * as fs10 from "fs/promises";
|
|
@@ -14393,20 +14484,20 @@ function formatVariableSources(sources) {
|
|
|
14393
14484
|
if (sources.secrets.length > 0) {
|
|
14394
14485
|
console.log(` Secrets:`);
|
|
14395
14486
|
for (const secret of sources.secrets) {
|
|
14396
|
-
const sourceInfo =
|
|
14487
|
+
const sourceInfo = chalk48.dim(`(${secret.source})`);
|
|
14397
14488
|
console.log(` - ${secret.name.padEnd(20)} ${sourceInfo}`);
|
|
14398
14489
|
}
|
|
14399
14490
|
}
|
|
14400
14491
|
if (sources.vars.length > 0) {
|
|
14401
14492
|
console.log(` Vars:`);
|
|
14402
14493
|
for (const v of sources.vars) {
|
|
14403
|
-
const sourceInfo =
|
|
14494
|
+
const sourceInfo = chalk48.dim(`(${v.source})`);
|
|
14404
14495
|
console.log(` - ${v.name.padEnd(20)} ${sourceInfo}`);
|
|
14405
14496
|
}
|
|
14406
14497
|
}
|
|
14407
14498
|
}
|
|
14408
14499
|
function formatAgentDetails(agentName, agent, agentSources, volumeConfigs) {
|
|
14409
|
-
console.log(` ${
|
|
14500
|
+
console.log(` ${chalk48.cyan(agentName)}:`);
|
|
14410
14501
|
console.log(` Framework: ${agent.framework}`);
|
|
14411
14502
|
if (agent.image) {
|
|
14412
14503
|
console.log(` Image: ${agent.image}`);
|
|
@@ -14424,10 +14515,10 @@ function formatAgentDetails(agentName, agent, agentSources, volumeConfigs) {
|
|
|
14424
14515
|
}
|
|
14425
14516
|
}
|
|
14426
14517
|
function formatComposeOutput(name, versionId, content, variableSources) {
|
|
14427
|
-
console.log(
|
|
14428
|
-
console.log(
|
|
14518
|
+
console.log(chalk48.bold("Name:") + ` ${name}`);
|
|
14519
|
+
console.log(chalk48.bold("Version:") + ` ${versionId}`);
|
|
14429
14520
|
console.log();
|
|
14430
|
-
console.log(
|
|
14521
|
+
console.log(chalk48.bold("Agents:"));
|
|
14431
14522
|
for (const [agentName, agent] of Object.entries(content.agents)) {
|
|
14432
14523
|
const agentSources = variableSources?.get(agentName);
|
|
14433
14524
|
formatAgentDetails(agentName, agent, agentSources, content.volumes);
|
|
@@ -14486,7 +14577,7 @@ var statusCommand6 = new Command52().name("status").description("Show status of
|
|
|
14486
14577
|
});
|
|
14487
14578
|
} catch {
|
|
14488
14579
|
console.error(
|
|
14489
|
-
|
|
14580
|
+
chalk48.yellow(
|
|
14490
14581
|
"\u26A0 Warning: Failed to fetch skill sources, showing basic info"
|
|
14491
14582
|
)
|
|
14492
14583
|
);
|
|
@@ -14503,7 +14594,7 @@ var statusCommand6 = new Command52().name("status").description("Show status of
|
|
|
14503
14594
|
|
|
14504
14595
|
// src/commands/agent/public.ts
|
|
14505
14596
|
import { Command as Command53 } from "commander";
|
|
14506
|
-
import
|
|
14597
|
+
import chalk49 from "chalk";
|
|
14507
14598
|
var publicCommand = new Command53().name("public").description("Make an agent public (accessible to all authenticated users)").argument("<name>", "Agent name").option(
|
|
14508
14599
|
"--experimental-shared-agent",
|
|
14509
14600
|
"Enable experimental agent sharing feature"
|
|
@@ -14532,7 +14623,7 @@ var publicCommand = new Command53().name("public").description("Make an agent pu
|
|
|
14532
14623
|
if (!response.ok) {
|
|
14533
14624
|
const error = await response.json();
|
|
14534
14625
|
if (response.status === 409) {
|
|
14535
|
-
console.log(
|
|
14626
|
+
console.log(chalk49.yellow(`Agent "${name}" is already public`));
|
|
14536
14627
|
return;
|
|
14537
14628
|
}
|
|
14538
14629
|
throw new Error(
|
|
@@ -14540,11 +14631,11 @@ var publicCommand = new Command53().name("public").description("Make an agent pu
|
|
|
14540
14631
|
);
|
|
14541
14632
|
}
|
|
14542
14633
|
const fullName = `${org.slug}/${name}`;
|
|
14543
|
-
console.log(
|
|
14634
|
+
console.log(chalk49.green(`\u2713 Agent "${name}" is now public`));
|
|
14544
14635
|
console.log();
|
|
14545
14636
|
console.log("Others can now run your agent with:");
|
|
14546
14637
|
console.log(
|
|
14547
|
-
|
|
14638
|
+
chalk49.cyan(
|
|
14548
14639
|
` vm0 run ${fullName} --experimental-shared-agent "your prompt"`
|
|
14549
14640
|
)
|
|
14550
14641
|
);
|
|
@@ -14554,7 +14645,7 @@ var publicCommand = new Command53().name("public").description("Make an agent pu
|
|
|
14554
14645
|
|
|
14555
14646
|
// src/commands/agent/private.ts
|
|
14556
14647
|
import { Command as Command54 } from "commander";
|
|
14557
|
-
import
|
|
14648
|
+
import chalk50 from "chalk";
|
|
14558
14649
|
var privateCommand = new Command54().name("private").description("Make an agent private (remove public access)").argument("<name>", "Agent name").option(
|
|
14559
14650
|
"--experimental-shared-agent",
|
|
14560
14651
|
"Enable experimental agent sharing feature"
|
|
@@ -14581,21 +14672,21 @@ var privateCommand = new Command54().name("private").description("Make an agent
|
|
|
14581
14672
|
if (!response.ok) {
|
|
14582
14673
|
const error = await response.json();
|
|
14583
14674
|
if (response.status === 404) {
|
|
14584
|
-
console.log(
|
|
14675
|
+
console.log(chalk50.yellow(`Agent "${name}" is already private`));
|
|
14585
14676
|
return;
|
|
14586
14677
|
}
|
|
14587
14678
|
throw new Error(
|
|
14588
14679
|
error.error?.message || "Failed to make agent private"
|
|
14589
14680
|
);
|
|
14590
14681
|
}
|
|
14591
|
-
console.log(
|
|
14682
|
+
console.log(chalk50.green(`\u2713 Agent "${name}" is now private`));
|
|
14592
14683
|
}
|
|
14593
14684
|
)
|
|
14594
14685
|
);
|
|
14595
14686
|
|
|
14596
14687
|
// src/commands/agent/share.ts
|
|
14597
14688
|
import { Command as Command55 } from "commander";
|
|
14598
|
-
import
|
|
14689
|
+
import chalk51 from "chalk";
|
|
14599
14690
|
var shareCommand = new Command55().name("share").description("Share an agent with a user by email").argument("<name>", "Agent name").requiredOption("--email <email>", "Email address to share with").option(
|
|
14600
14691
|
"--experimental-shared-agent",
|
|
14601
14692
|
"Enable experimental agent sharing feature"
|
|
@@ -14625,7 +14716,7 @@ var shareCommand = new Command55().name("share").description("Share an agent wit
|
|
|
14625
14716
|
const error = await response.json();
|
|
14626
14717
|
if (response.status === 409) {
|
|
14627
14718
|
console.log(
|
|
14628
|
-
|
|
14719
|
+
chalk51.yellow(
|
|
14629
14720
|
`Agent "${name}" is already shared with ${options.email}`
|
|
14630
14721
|
)
|
|
14631
14722
|
);
|
|
@@ -14635,12 +14726,12 @@ var shareCommand = new Command55().name("share").description("Share an agent wit
|
|
|
14635
14726
|
}
|
|
14636
14727
|
const fullName = `${org.slug}/${name}`;
|
|
14637
14728
|
console.log(
|
|
14638
|
-
|
|
14729
|
+
chalk51.green(`\u2713 Agent "${name}" shared with ${options.email}`)
|
|
14639
14730
|
);
|
|
14640
14731
|
console.log();
|
|
14641
14732
|
console.log("They can now run your agent with:");
|
|
14642
14733
|
console.log(
|
|
14643
|
-
|
|
14734
|
+
chalk51.cyan(
|
|
14644
14735
|
` vm0 run ${fullName} --experimental-shared-agent "your prompt"`
|
|
14645
14736
|
)
|
|
14646
14737
|
);
|
|
@@ -14650,7 +14741,7 @@ var shareCommand = new Command55().name("share").description("Share an agent wit
|
|
|
14650
14741
|
|
|
14651
14742
|
// src/commands/agent/unshare.ts
|
|
14652
14743
|
import { Command as Command56 } from "commander";
|
|
14653
|
-
import
|
|
14744
|
+
import chalk52 from "chalk";
|
|
14654
14745
|
var unshareCommand = new Command56().name("unshare").description("Remove sharing from a user").argument("<name>", "Agent name").requiredOption("--email <email>", "Email address to unshare").option(
|
|
14655
14746
|
"--experimental-shared-agent",
|
|
14656
14747
|
"Enable experimental agent sharing feature"
|
|
@@ -14678,7 +14769,7 @@ var unshareCommand = new Command56().name("unshare").description("Remove sharing
|
|
|
14678
14769
|
const error = await response.json();
|
|
14679
14770
|
if (response.status === 404) {
|
|
14680
14771
|
console.log(
|
|
14681
|
-
|
|
14772
|
+
chalk52.yellow(
|
|
14682
14773
|
`Agent "${name}" is not shared with ${options.email}`
|
|
14683
14774
|
)
|
|
14684
14775
|
);
|
|
@@ -14687,7 +14778,7 @@ var unshareCommand = new Command56().name("unshare").description("Remove sharing
|
|
|
14687
14778
|
throw new Error(error.error?.message || "Failed to unshare agent");
|
|
14688
14779
|
}
|
|
14689
14780
|
console.log(
|
|
14690
|
-
|
|
14781
|
+
chalk52.green(`\u2713 Removed sharing of "${name}" from ${options.email}`)
|
|
14691
14782
|
);
|
|
14692
14783
|
}
|
|
14693
14784
|
)
|
|
@@ -14695,7 +14786,7 @@ var unshareCommand = new Command56().name("unshare").description("Remove sharing
|
|
|
14695
14786
|
|
|
14696
14787
|
// src/commands/agent/permission.ts
|
|
14697
14788
|
import { Command as Command57 } from "commander";
|
|
14698
|
-
import
|
|
14789
|
+
import chalk53 from "chalk";
|
|
14699
14790
|
var permissionCommand = new Command57().name("permission").description("List all permissions for an agent").argument("<name>", "Agent name").option(
|
|
14700
14791
|
"--experimental-shared-agent",
|
|
14701
14792
|
"Enable experimental agent sharing feature"
|
|
@@ -14725,16 +14816,16 @@ var permissionCommand = new Command57().name("permission").description("List all
|
|
|
14725
14816
|
}
|
|
14726
14817
|
const data = await response.json();
|
|
14727
14818
|
if (data.permissions.length === 0) {
|
|
14728
|
-
console.log(
|
|
14819
|
+
console.log(chalk53.dim("No permissions set (private agent)"));
|
|
14729
14820
|
return;
|
|
14730
14821
|
}
|
|
14731
14822
|
console.log(
|
|
14732
|
-
|
|
14823
|
+
chalk53.dim(
|
|
14733
14824
|
"TYPE EMAIL PERMISSION GRANTED"
|
|
14734
14825
|
)
|
|
14735
14826
|
);
|
|
14736
14827
|
console.log(
|
|
14737
|
-
|
|
14828
|
+
chalk53.dim(
|
|
14738
14829
|
"------- ----------------------------- ---------- ----------"
|
|
14739
14830
|
)
|
|
14740
14831
|
);
|
|
@@ -14754,7 +14845,7 @@ var agentCommand = new Command58().name("agent").description("Manage agent compo
|
|
|
14754
14845
|
|
|
14755
14846
|
// src/commands/init/index.ts
|
|
14756
14847
|
import { Command as Command59 } from "commander";
|
|
14757
|
-
import
|
|
14848
|
+
import chalk54 from "chalk";
|
|
14758
14849
|
import path17 from "path";
|
|
14759
14850
|
import { existsSync as existsSync11 } from "fs";
|
|
14760
14851
|
import { writeFile as writeFile7 } from "fs/promises";
|
|
@@ -14821,7 +14912,7 @@ var initCommand4 = new Command59().name("init").description("Initialize a new VM
|
|
|
14821
14912
|
}
|
|
14822
14913
|
);
|
|
14823
14914
|
if (name === void 0) {
|
|
14824
|
-
console.log(
|
|
14915
|
+
console.log(chalk54.dim("Cancelled"));
|
|
14825
14916
|
return;
|
|
14826
14917
|
}
|
|
14827
14918
|
agentName = name;
|
|
@@ -14835,23 +14926,23 @@ var initCommand4 = new Command59().name("init").description("Initialize a new VM
|
|
|
14835
14926
|
}
|
|
14836
14927
|
await writeFile7(VM0_YAML_FILE, generateVm0Yaml(agentName));
|
|
14837
14928
|
const vm0Status = existingFiles.includes(VM0_YAML_FILE) ? " (overwritten)" : "";
|
|
14838
|
-
console.log(
|
|
14929
|
+
console.log(chalk54.green(`\u2713 Created ${VM0_YAML_FILE}${vm0Status}`));
|
|
14839
14930
|
await writeFile7(AGENTS_MD_FILE, generateAgentsMd());
|
|
14840
14931
|
const agentsStatus = existingFiles.includes(AGENTS_MD_FILE) ? " (overwritten)" : "";
|
|
14841
|
-
console.log(
|
|
14932
|
+
console.log(chalk54.green(`\u2713 Created ${AGENTS_MD_FILE}${agentsStatus}`));
|
|
14842
14933
|
console.log();
|
|
14843
14934
|
console.log("Next steps:");
|
|
14844
14935
|
console.log(
|
|
14845
|
-
` 1. Set up model provider (one-time): ${
|
|
14936
|
+
` 1. Set up model provider (one-time): ${chalk54.cyan("vm0 model-provider setup")}`
|
|
14846
14937
|
);
|
|
14847
14938
|
console.log(
|
|
14848
|
-
` 2. Edit ${
|
|
14939
|
+
` 2. Edit ${chalk54.cyan("AGENTS.md")} to customize your agent's workflow`
|
|
14849
14940
|
);
|
|
14850
14941
|
console.log(
|
|
14851
|
-
` Or install Claude plugin: ${
|
|
14942
|
+
` Or install Claude plugin: ${chalk54.cyan(`vm0 setup-claude && claude "/vm0-agent let's build an agent"`)}`
|
|
14852
14943
|
);
|
|
14853
14944
|
console.log(
|
|
14854
|
-
` 3. Run your agent: ${
|
|
14945
|
+
` 3. Run your agent: ${chalk54.cyan(`vm0 cook "let's start working"`)}`
|
|
14855
14946
|
);
|
|
14856
14947
|
})
|
|
14857
14948
|
);
|
|
@@ -14861,7 +14952,7 @@ import { Command as Command66 } from "commander";
|
|
|
14861
14952
|
|
|
14862
14953
|
// src/commands/schedule/setup.ts
|
|
14863
14954
|
import { Command as Command60 } from "commander";
|
|
14864
|
-
import
|
|
14955
|
+
import chalk55 from "chalk";
|
|
14865
14956
|
|
|
14866
14957
|
// src/lib/domain/schedule-utils.ts
|
|
14867
14958
|
import { parse as parseYaml5 } from "yaml";
|
|
@@ -15112,7 +15203,7 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
|
|
|
15112
15203
|
if (!isInteractive()) {
|
|
15113
15204
|
throw new Error("--frequency is required (daily|weekly|monthly|once|loop)");
|
|
15114
15205
|
}
|
|
15115
|
-
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((
|
|
15206
|
+
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c24) => c24.value === existingFrequency) : 0;
|
|
15116
15207
|
frequency = await promptSelect(
|
|
15117
15208
|
"Schedule frequency",
|
|
15118
15209
|
FREQUENCY_CHOICES,
|
|
@@ -15137,7 +15228,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
15137
15228
|
throw new Error("--day is required for weekly/monthly");
|
|
15138
15229
|
}
|
|
15139
15230
|
if (frequency === "weekly") {
|
|
15140
|
-
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((
|
|
15231
|
+
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c24) => c24.value === existingDay) : 0;
|
|
15141
15232
|
const day2 = await promptSelect(
|
|
15142
15233
|
"Day of week",
|
|
15143
15234
|
DAY_OF_WEEK_CHOICES,
|
|
@@ -15328,7 +15419,7 @@ async function buildAndDeploy(params) {
|
|
|
15328
15419
|
}
|
|
15329
15420
|
console.log(
|
|
15330
15421
|
`
|
|
15331
|
-
Deploying schedule for agent ${
|
|
15422
|
+
Deploying schedule for agent ${chalk55.cyan(params.agentName)}...`
|
|
15332
15423
|
);
|
|
15333
15424
|
const deployResult = await deploySchedule({
|
|
15334
15425
|
name: params.scheduleName,
|
|
@@ -15345,62 +15436,62 @@ Deploying schedule for agent ${chalk54.cyan(params.agentName)}...`
|
|
|
15345
15436
|
function displayDeployResult(agentName, deployResult) {
|
|
15346
15437
|
if (deployResult.created) {
|
|
15347
15438
|
console.log(
|
|
15348
|
-
|
|
15439
|
+
chalk55.green(`\u2713 Created schedule for agent ${chalk55.cyan(agentName)}`)
|
|
15349
15440
|
);
|
|
15350
15441
|
} else {
|
|
15351
15442
|
console.log(
|
|
15352
|
-
|
|
15443
|
+
chalk55.green(`\u2713 Updated schedule for agent ${chalk55.cyan(agentName)}`)
|
|
15353
15444
|
);
|
|
15354
15445
|
}
|
|
15355
|
-
console.log(
|
|
15446
|
+
console.log(chalk55.dim(` Timezone: ${deployResult.schedule.timezone}`));
|
|
15356
15447
|
if (deployResult.schedule.triggerType === "loop" && deployResult.schedule.intervalSeconds != null) {
|
|
15357
15448
|
console.log(
|
|
15358
|
-
|
|
15449
|
+
chalk55.dim(
|
|
15359
15450
|
` Mode: Loop (interval ${deployResult.schedule.intervalSeconds}s)`
|
|
15360
15451
|
)
|
|
15361
15452
|
);
|
|
15362
15453
|
} else if (deployResult.schedule.cronExpression) {
|
|
15363
|
-
console.log(
|
|
15454
|
+
console.log(chalk55.dim(` Cron: ${deployResult.schedule.cronExpression}`));
|
|
15364
15455
|
if (deployResult.schedule.nextRunAt) {
|
|
15365
15456
|
const nextRun = formatInTimezone(
|
|
15366
15457
|
deployResult.schedule.nextRunAt,
|
|
15367
15458
|
deployResult.schedule.timezone
|
|
15368
15459
|
);
|
|
15369
|
-
console.log(
|
|
15460
|
+
console.log(chalk55.dim(` Next run: ${nextRun}`));
|
|
15370
15461
|
}
|
|
15371
15462
|
} else if (deployResult.schedule.atTime) {
|
|
15372
15463
|
const atTimeFormatted = formatInTimezone(
|
|
15373
15464
|
deployResult.schedule.atTime,
|
|
15374
15465
|
deployResult.schedule.timezone
|
|
15375
15466
|
);
|
|
15376
|
-
console.log(
|
|
15467
|
+
console.log(chalk55.dim(` At: ${atTimeFormatted}`));
|
|
15377
15468
|
}
|
|
15378
15469
|
}
|
|
15379
15470
|
async function tryEnableSchedule(scheduleName, composeId, agentName) {
|
|
15380
15471
|
try {
|
|
15381
15472
|
await enableSchedule({ name: scheduleName, composeId });
|
|
15382
15473
|
console.log(
|
|
15383
|
-
|
|
15474
|
+
chalk55.green(`\u2713 Enabled schedule for agent ${chalk55.cyan(agentName)}`)
|
|
15384
15475
|
);
|
|
15385
15476
|
} catch (error) {
|
|
15386
|
-
console.error(
|
|
15477
|
+
console.error(chalk55.yellow("\u26A0 Failed to enable schedule"));
|
|
15387
15478
|
if (error instanceof ApiRequestError) {
|
|
15388
15479
|
if (error.code === "SCHEDULE_PAST") {
|
|
15389
|
-
console.error(
|
|
15480
|
+
console.error(chalk55.dim(" Scheduled time has already passed"));
|
|
15390
15481
|
} else {
|
|
15391
|
-
console.error(
|
|
15482
|
+
console.error(chalk55.dim(` ${error.message}`));
|
|
15392
15483
|
}
|
|
15393
15484
|
} else if (error instanceof Error) {
|
|
15394
|
-
console.error(
|
|
15485
|
+
console.error(chalk55.dim(` ${error.message}`));
|
|
15395
15486
|
}
|
|
15396
15487
|
console.log(
|
|
15397
|
-
` To enable manually: ${
|
|
15488
|
+
` To enable manually: ${chalk55.cyan(`vm0 schedule enable ${agentName}`)}`
|
|
15398
15489
|
);
|
|
15399
15490
|
}
|
|
15400
15491
|
}
|
|
15401
15492
|
function showEnableHint(agentName) {
|
|
15402
15493
|
console.log();
|
|
15403
|
-
console.log(` To enable: ${
|
|
15494
|
+
console.log(` To enable: ${chalk55.cyan(`vm0 schedule enable ${agentName}`)}`);
|
|
15404
15495
|
}
|
|
15405
15496
|
async function handleScheduleEnabling(params) {
|
|
15406
15497
|
const { scheduleName, composeId, agentName, enableFlag, shouldPromptEnable } = params;
|
|
@@ -15432,7 +15523,7 @@ var setupCommand = new Command60().name("setup").description("Create or edit a s
|
|
|
15432
15523
|
scheduleName
|
|
15433
15524
|
);
|
|
15434
15525
|
console.log(
|
|
15435
|
-
|
|
15526
|
+
chalk55.dim(
|
|
15436
15527
|
existingSchedule ? `Editing existing schedule for agent ${agentName}` : `Creating new schedule for agent ${agentName}`
|
|
15437
15528
|
)
|
|
15438
15529
|
);
|
|
@@ -15442,12 +15533,12 @@ var setupCommand = new Command60().name("setup").description("Create or edit a s
|
|
|
15442
15533
|
defaults.frequency
|
|
15443
15534
|
);
|
|
15444
15535
|
if (!frequency) {
|
|
15445
|
-
console.log(
|
|
15536
|
+
console.log(chalk55.dim("Cancelled"));
|
|
15446
15537
|
return;
|
|
15447
15538
|
}
|
|
15448
15539
|
const timing = await gatherTiming(frequency, options, defaults);
|
|
15449
15540
|
if (!timing) {
|
|
15450
|
-
console.log(
|
|
15541
|
+
console.log(chalk55.dim("Cancelled"));
|
|
15451
15542
|
return;
|
|
15452
15543
|
}
|
|
15453
15544
|
const { day, time, atTime, intervalSeconds } = timing;
|
|
@@ -15456,7 +15547,7 @@ var setupCommand = new Command60().name("setup").description("Create or edit a s
|
|
|
15456
15547
|
existingSchedule?.timezone
|
|
15457
15548
|
);
|
|
15458
15549
|
if (!timezone) {
|
|
15459
|
-
console.log(
|
|
15550
|
+
console.log(chalk55.dim("Cancelled"));
|
|
15460
15551
|
return;
|
|
15461
15552
|
}
|
|
15462
15553
|
const promptText_ = await gatherPromptText(
|
|
@@ -15464,7 +15555,7 @@ var setupCommand = new Command60().name("setup").description("Create or edit a s
|
|
|
15464
15555
|
existingSchedule?.prompt
|
|
15465
15556
|
);
|
|
15466
15557
|
if (!promptText_) {
|
|
15467
|
-
console.log(
|
|
15558
|
+
console.log(chalk55.dim("Cancelled"));
|
|
15468
15559
|
return;
|
|
15469
15560
|
}
|
|
15470
15561
|
const deployResult = await buildAndDeploy({
|
|
@@ -15494,14 +15585,14 @@ var setupCommand = new Command60().name("setup").description("Create or edit a s
|
|
|
15494
15585
|
|
|
15495
15586
|
// src/commands/schedule/list.ts
|
|
15496
15587
|
import { Command as Command61 } from "commander";
|
|
15497
|
-
import
|
|
15588
|
+
import chalk56 from "chalk";
|
|
15498
15589
|
var listCommand7 = new Command61().name("list").alias("ls").description("List all schedules").action(
|
|
15499
15590
|
withErrorHandler(async () => {
|
|
15500
15591
|
const result = await listSchedules();
|
|
15501
15592
|
if (result.schedules.length === 0) {
|
|
15502
|
-
console.log(
|
|
15593
|
+
console.log(chalk56.dim("No schedules found"));
|
|
15503
15594
|
console.log(
|
|
15504
|
-
|
|
15595
|
+
chalk56.dim(" Create one with: vm0 schedule setup <agent-name>")
|
|
15505
15596
|
);
|
|
15506
15597
|
return;
|
|
15507
15598
|
}
|
|
@@ -15526,10 +15617,10 @@ var listCommand7 = new Command61().name("list").alias("ls").description("List al
|
|
|
15526
15617
|
"STATUS".padEnd(8),
|
|
15527
15618
|
"NEXT RUN"
|
|
15528
15619
|
].join(" ");
|
|
15529
|
-
console.log(
|
|
15620
|
+
console.log(chalk56.dim(header));
|
|
15530
15621
|
for (const schedule of result.schedules) {
|
|
15531
15622
|
const trigger = schedule.cronExpression ? `${schedule.cronExpression} (${schedule.timezone})` : schedule.atTime || "-";
|
|
15532
|
-
const status = schedule.enabled ?
|
|
15623
|
+
const status = schedule.enabled ? chalk56.green("enabled") : chalk56.yellow("disabled");
|
|
15533
15624
|
const nextRun = schedule.enabled ? formatRelativeTime2(schedule.nextRunAt) : "-";
|
|
15534
15625
|
const row = [
|
|
15535
15626
|
schedule.composeName.padEnd(agentWidth),
|
|
@@ -15546,47 +15637,47 @@ var listCommand7 = new Command61().name("list").alias("ls").description("List al
|
|
|
15546
15637
|
|
|
15547
15638
|
// src/commands/schedule/status.ts
|
|
15548
15639
|
import { Command as Command62 } from "commander";
|
|
15549
|
-
import
|
|
15640
|
+
import chalk57 from "chalk";
|
|
15550
15641
|
function formatDateTimeStyled(dateStr) {
|
|
15551
|
-
if (!dateStr) return
|
|
15642
|
+
if (!dateStr) return chalk57.dim("-");
|
|
15552
15643
|
const formatted = formatDateTime(dateStr);
|
|
15553
|
-
return formatted.replace(/\(([^)]+)\)$/,
|
|
15644
|
+
return formatted.replace(/\(([^)]+)\)$/, chalk57.dim("($1)"));
|
|
15554
15645
|
}
|
|
15555
15646
|
function formatTrigger(schedule) {
|
|
15556
15647
|
if (schedule.triggerType === "loop" && schedule.intervalSeconds !== null) {
|
|
15557
|
-
return `interval ${schedule.intervalSeconds}s ${
|
|
15648
|
+
return `interval ${schedule.intervalSeconds}s ${chalk57.dim("(loop)")}`;
|
|
15558
15649
|
}
|
|
15559
15650
|
if (schedule.cronExpression) {
|
|
15560
15651
|
return schedule.cronExpression;
|
|
15561
15652
|
}
|
|
15562
15653
|
if (schedule.atTime) {
|
|
15563
|
-
return `${schedule.atTime} ${
|
|
15654
|
+
return `${schedule.atTime} ${chalk57.dim("(one-time)")}`;
|
|
15564
15655
|
}
|
|
15565
|
-
return
|
|
15656
|
+
return chalk57.dim("-");
|
|
15566
15657
|
}
|
|
15567
15658
|
function formatRunStatus2(status) {
|
|
15568
15659
|
switch (status) {
|
|
15569
15660
|
case "completed":
|
|
15570
|
-
return
|
|
15661
|
+
return chalk57.green(status);
|
|
15571
15662
|
case "failed":
|
|
15572
15663
|
case "timeout":
|
|
15573
|
-
return
|
|
15664
|
+
return chalk57.red(status);
|
|
15574
15665
|
case "running":
|
|
15575
|
-
return
|
|
15666
|
+
return chalk57.cyan(status);
|
|
15576
15667
|
case "pending":
|
|
15577
|
-
return
|
|
15668
|
+
return chalk57.yellow(status);
|
|
15578
15669
|
default:
|
|
15579
15670
|
return status;
|
|
15580
15671
|
}
|
|
15581
15672
|
}
|
|
15582
15673
|
function printRunConfiguration(schedule) {
|
|
15583
|
-
const statusText = schedule.enabled ?
|
|
15674
|
+
const statusText = schedule.enabled ? chalk57.green("enabled") : chalk57.yellow("disabled");
|
|
15584
15675
|
console.log(`${"Status:".padEnd(16)}${statusText}`);
|
|
15585
15676
|
console.log(
|
|
15586
|
-
`${"Agent:".padEnd(16)}${schedule.composeName} ${
|
|
15677
|
+
`${"Agent:".padEnd(16)}${schedule.composeName} ${chalk57.dim(`(${schedule.orgSlug})`)}`
|
|
15587
15678
|
);
|
|
15588
15679
|
const promptPreview = schedule.prompt.length > 60 ? schedule.prompt.slice(0, 57) + "..." : schedule.prompt;
|
|
15589
|
-
console.log(`${"Prompt:".padEnd(16)}${
|
|
15680
|
+
console.log(`${"Prompt:".padEnd(16)}${chalk57.dim(promptPreview)}`);
|
|
15590
15681
|
if (schedule.vars && Object.keys(schedule.vars).length > 0) {
|
|
15591
15682
|
console.log(
|
|
15592
15683
|
`${"Variables:".padEnd(16)}${Object.keys(schedule.vars).join(", ")}`
|
|
@@ -15615,7 +15706,7 @@ function printTimeSchedule(schedule) {
|
|
|
15615
15706
|
);
|
|
15616
15707
|
}
|
|
15617
15708
|
if (schedule.triggerType === "loop") {
|
|
15618
|
-
const failureText = schedule.consecutiveFailures > 0 ?
|
|
15709
|
+
const failureText = schedule.consecutiveFailures > 0 ? chalk57.yellow(`${schedule.consecutiveFailures}/3`) : chalk57.dim("0/3");
|
|
15619
15710
|
console.log(`${"Failures:".padEnd(16)}${failureText}`);
|
|
15620
15711
|
}
|
|
15621
15712
|
}
|
|
@@ -15631,7 +15722,7 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
15631
15722
|
console.log();
|
|
15632
15723
|
console.log("Recent Runs:");
|
|
15633
15724
|
console.log(
|
|
15634
|
-
|
|
15725
|
+
chalk57.dim("RUN ID STATUS CREATED")
|
|
15635
15726
|
);
|
|
15636
15727
|
for (const run of runs) {
|
|
15637
15728
|
const id = run.id;
|
|
@@ -15642,7 +15733,7 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
15642
15733
|
}
|
|
15643
15734
|
} catch {
|
|
15644
15735
|
console.log();
|
|
15645
|
-
console.log(
|
|
15736
|
+
console.log(chalk57.dim("Recent Runs: (unable to fetch)"));
|
|
15646
15737
|
}
|
|
15647
15738
|
}
|
|
15648
15739
|
var statusCommand7 = new Command62().name("status").description("Show detailed status of a schedule").argument("<agent-name>", "Agent name").option(
|
|
@@ -15659,8 +15750,8 @@ var statusCommand7 = new Command62().name("status").description("Show detailed s
|
|
|
15659
15750
|
const { name, composeId } = resolved;
|
|
15660
15751
|
const schedule = await getScheduleByName({ name, composeId });
|
|
15661
15752
|
console.log();
|
|
15662
|
-
console.log(`Schedule for agent: ${
|
|
15663
|
-
console.log(
|
|
15753
|
+
console.log(`Schedule for agent: ${chalk57.cyan(agentName)}`);
|
|
15754
|
+
console.log(chalk57.dim("\u2501".repeat(50)));
|
|
15664
15755
|
printRunConfiguration(schedule);
|
|
15665
15756
|
printTimeSchedule(schedule);
|
|
15666
15757
|
const parsed = parseInt(options.limit, 10);
|
|
@@ -15676,7 +15767,7 @@ var statusCommand7 = new Command62().name("status").description("Show detailed s
|
|
|
15676
15767
|
|
|
15677
15768
|
// src/commands/schedule/delete.ts
|
|
15678
15769
|
import { Command as Command63 } from "commander";
|
|
15679
|
-
import
|
|
15770
|
+
import chalk58 from "chalk";
|
|
15680
15771
|
var deleteCommand2 = new Command63().name("delete").alias("rm").description("Delete a schedule").argument("<agent-name>", "Agent name").option(
|
|
15681
15772
|
"-n, --name <schedule-name>",
|
|
15682
15773
|
"Schedule name (required when agent has multiple schedules)"
|
|
@@ -15689,11 +15780,11 @@ var deleteCommand2 = new Command63().name("delete").alias("rm").description("Del
|
|
|
15689
15780
|
throw new Error("--yes flag is required in non-interactive mode");
|
|
15690
15781
|
}
|
|
15691
15782
|
const confirmed = await promptConfirm(
|
|
15692
|
-
`Delete schedule for agent ${
|
|
15783
|
+
`Delete schedule for agent ${chalk58.cyan(agentName)}?`,
|
|
15693
15784
|
false
|
|
15694
15785
|
);
|
|
15695
15786
|
if (!confirmed) {
|
|
15696
|
-
console.log(
|
|
15787
|
+
console.log(chalk58.dim("Cancelled"));
|
|
15697
15788
|
return;
|
|
15698
15789
|
}
|
|
15699
15790
|
}
|
|
@@ -15702,7 +15793,7 @@ var deleteCommand2 = new Command63().name("delete").alias("rm").description("Del
|
|
|
15702
15793
|
composeId: resolved.composeId
|
|
15703
15794
|
});
|
|
15704
15795
|
console.log(
|
|
15705
|
-
|
|
15796
|
+
chalk58.green(`\u2713 Deleted schedule for agent ${chalk58.cyan(agentName)}`)
|
|
15706
15797
|
);
|
|
15707
15798
|
}
|
|
15708
15799
|
)
|
|
@@ -15710,7 +15801,7 @@ var deleteCommand2 = new Command63().name("delete").alias("rm").description("Del
|
|
|
15710
15801
|
|
|
15711
15802
|
// src/commands/schedule/enable.ts
|
|
15712
15803
|
import { Command as Command64 } from "commander";
|
|
15713
|
-
import
|
|
15804
|
+
import chalk59 from "chalk";
|
|
15714
15805
|
var enableCommand = new Command64().name("enable").description("Enable a schedule").argument("<agent-name>", "Agent name").option(
|
|
15715
15806
|
"-n, --name <schedule-name>",
|
|
15716
15807
|
"Schedule name (required when agent has multiple schedules)"
|
|
@@ -15722,14 +15813,14 @@ var enableCommand = new Command64().name("enable").description("Enable a schedul
|
|
|
15722
15813
|
composeId: resolved.composeId
|
|
15723
15814
|
});
|
|
15724
15815
|
console.log(
|
|
15725
|
-
|
|
15816
|
+
chalk59.green(`\u2713 Enabled schedule for agent ${chalk59.cyan(agentName)}`)
|
|
15726
15817
|
);
|
|
15727
15818
|
})
|
|
15728
15819
|
);
|
|
15729
15820
|
|
|
15730
15821
|
// src/commands/schedule/disable.ts
|
|
15731
15822
|
import { Command as Command65 } from "commander";
|
|
15732
|
-
import
|
|
15823
|
+
import chalk60 from "chalk";
|
|
15733
15824
|
var disableCommand = new Command65().name("disable").description("Disable a schedule").argument("<agent-name>", "Agent name").option(
|
|
15734
15825
|
"-n, --name <schedule-name>",
|
|
15735
15826
|
"Schedule name (required when agent has multiple schedules)"
|
|
@@ -15741,7 +15832,7 @@ var disableCommand = new Command65().name("disable").description("Disable a sche
|
|
|
15741
15832
|
composeId: resolved.composeId
|
|
15742
15833
|
});
|
|
15743
15834
|
console.log(
|
|
15744
|
-
|
|
15835
|
+
chalk60.green(`\u2713 Disabled schedule for agent ${chalk60.cyan(agentName)}`)
|
|
15745
15836
|
);
|
|
15746
15837
|
})
|
|
15747
15838
|
);
|
|
@@ -15751,7 +15842,7 @@ var scheduleCommand = new Command66().name("schedule").description("Manage agent
|
|
|
15751
15842
|
|
|
15752
15843
|
// src/commands/usage/index.ts
|
|
15753
15844
|
import { Command as Command67 } from "commander";
|
|
15754
|
-
import
|
|
15845
|
+
import chalk61 from "chalk";
|
|
15755
15846
|
|
|
15756
15847
|
// src/lib/utils/duration-formatter.ts
|
|
15757
15848
|
function formatDuration(ms) {
|
|
@@ -15876,19 +15967,19 @@ var usageCommand = new Command67().name("usage").description("View usage statist
|
|
|
15876
15967
|
);
|
|
15877
15968
|
console.log();
|
|
15878
15969
|
console.log(
|
|
15879
|
-
|
|
15970
|
+
chalk61.bold(
|
|
15880
15971
|
`Usage Summary (${formatDateRange(usage.period.start, usage.period.end)})`
|
|
15881
15972
|
)
|
|
15882
15973
|
);
|
|
15883
15974
|
console.log();
|
|
15884
|
-
console.log(
|
|
15975
|
+
console.log(chalk61.dim("DATE RUNS RUN TIME"));
|
|
15885
15976
|
for (const day of filledDaily) {
|
|
15886
15977
|
const dateDisplay = formatDateDisplay(day.date).padEnd(10);
|
|
15887
15978
|
const runsDisplay = String(day.run_count).padStart(6);
|
|
15888
15979
|
const timeDisplay = formatDuration(day.run_time_ms);
|
|
15889
15980
|
console.log(`${dateDisplay}${runsDisplay} ${timeDisplay}`);
|
|
15890
15981
|
}
|
|
15891
|
-
console.log(
|
|
15982
|
+
console.log(chalk61.dim("\u2500".repeat(29)));
|
|
15892
15983
|
const totalRunsDisplay = String(usage.summary.total_runs).padStart(6);
|
|
15893
15984
|
const totalTimeDisplay = formatDuration(usage.summary.total_run_time_ms);
|
|
15894
15985
|
console.log(
|
|
@@ -15903,62 +15994,62 @@ import { Command as Command71 } from "commander";
|
|
|
15903
15994
|
|
|
15904
15995
|
// src/commands/secret/list.ts
|
|
15905
15996
|
import { Command as Command68 } from "commander";
|
|
15906
|
-
import
|
|
15997
|
+
import chalk62 from "chalk";
|
|
15907
15998
|
var listCommand8 = new Command68().name("list").alias("ls").description("List all secrets").action(
|
|
15908
15999
|
withErrorHandler(async () => {
|
|
15909
16000
|
const result = await listSecrets();
|
|
15910
16001
|
if (result.secrets.length === 0) {
|
|
15911
|
-
console.log(
|
|
16002
|
+
console.log(chalk62.dim("No secrets found"));
|
|
15912
16003
|
console.log();
|
|
15913
16004
|
console.log("To add a secret:");
|
|
15914
|
-
console.log(
|
|
16005
|
+
console.log(chalk62.cyan(" vm0 secret set MY_API_KEY --body <value>"));
|
|
15915
16006
|
return;
|
|
15916
16007
|
}
|
|
15917
|
-
console.log(
|
|
16008
|
+
console.log(chalk62.bold("Secrets:"));
|
|
15918
16009
|
console.log();
|
|
15919
16010
|
for (const secret of result.secrets) {
|
|
15920
16011
|
let typeIndicator = "";
|
|
15921
16012
|
let derivedLine = null;
|
|
15922
16013
|
if (secret.type === "model-provider") {
|
|
15923
|
-
typeIndicator =
|
|
16014
|
+
typeIndicator = chalk62.dim(" [model-provider]");
|
|
15924
16015
|
} else if (secret.type === "connector") {
|
|
15925
16016
|
const derived = getConnectorDerivedNames(secret.name);
|
|
15926
16017
|
if (derived) {
|
|
15927
|
-
typeIndicator =
|
|
15928
|
-
derivedLine =
|
|
16018
|
+
typeIndicator = chalk62.dim(` [${derived.connectorLabel} connector]`);
|
|
16019
|
+
derivedLine = chalk62.dim(
|
|
15929
16020
|
`Available as: ${derived.envVarNames.join(", ")}`
|
|
15930
16021
|
);
|
|
15931
16022
|
} else {
|
|
15932
|
-
typeIndicator =
|
|
16023
|
+
typeIndicator = chalk62.dim(" [connector]");
|
|
15933
16024
|
}
|
|
15934
16025
|
} else if (secret.type === "user") {
|
|
15935
16026
|
const derived = getConnectorDerivedNames(secret.name);
|
|
15936
16027
|
if (derived) {
|
|
15937
|
-
typeIndicator =
|
|
15938
|
-
derivedLine =
|
|
16028
|
+
typeIndicator = chalk62.dim(` [${derived.connectorLabel} connector]`);
|
|
16029
|
+
derivedLine = chalk62.dim(
|
|
15939
16030
|
`Available as: ${derived.envVarNames.join(", ")}`
|
|
15940
16031
|
);
|
|
15941
16032
|
}
|
|
15942
16033
|
}
|
|
15943
|
-
console.log(` ${
|
|
16034
|
+
console.log(` ${chalk62.cyan(secret.name)}${typeIndicator}`);
|
|
15944
16035
|
if (derivedLine) {
|
|
15945
16036
|
console.log(` ${derivedLine}`);
|
|
15946
16037
|
}
|
|
15947
16038
|
if (secret.description) {
|
|
15948
|
-
console.log(` ${
|
|
16039
|
+
console.log(` ${chalk62.dim(secret.description)}`);
|
|
15949
16040
|
}
|
|
15950
16041
|
console.log(
|
|
15951
|
-
` ${
|
|
16042
|
+
` ${chalk62.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
15952
16043
|
);
|
|
15953
16044
|
console.log();
|
|
15954
16045
|
}
|
|
15955
|
-
console.log(
|
|
16046
|
+
console.log(chalk62.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
15956
16047
|
})
|
|
15957
16048
|
);
|
|
15958
16049
|
|
|
15959
16050
|
// src/commands/secret/set.ts
|
|
15960
16051
|
import { Command as Command69 } from "commander";
|
|
15961
|
-
import
|
|
16052
|
+
import chalk63 from "chalk";
|
|
15962
16053
|
var setCommand2 = new Command69().name("set").description("Create or update a secret").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
15963
16054
|
"-b, --body <value>",
|
|
15964
16055
|
"Secret value (required in non-interactive mode)"
|
|
@@ -15998,18 +16089,18 @@ var setCommand2 = new Command69().name("set").description("Create or update a se
|
|
|
15998
16089
|
}
|
|
15999
16090
|
throw error;
|
|
16000
16091
|
}
|
|
16001
|
-
console.log(
|
|
16092
|
+
console.log(chalk63.green(`\u2713 Secret "${secret.name}" saved`));
|
|
16002
16093
|
console.log();
|
|
16003
16094
|
console.log("Use in vm0.yaml:");
|
|
16004
|
-
console.log(
|
|
16005
|
-
console.log(
|
|
16095
|
+
console.log(chalk63.cyan(` environment:`));
|
|
16096
|
+
console.log(chalk63.cyan(` ${name}: \${{ secrets.${name} }}`));
|
|
16006
16097
|
}
|
|
16007
16098
|
)
|
|
16008
16099
|
);
|
|
16009
16100
|
|
|
16010
16101
|
// src/commands/secret/delete.ts
|
|
16011
16102
|
import { Command as Command70 } from "commander";
|
|
16012
|
-
import
|
|
16103
|
+
import chalk64 from "chalk";
|
|
16013
16104
|
var deleteCommand3 = new Command70().name("delete").description("Delete a secret").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
16014
16105
|
withErrorHandler(async (name, options) => {
|
|
16015
16106
|
try {
|
|
@@ -16029,12 +16120,12 @@ var deleteCommand3 = new Command70().name("delete").description("Delete a secret
|
|
|
16029
16120
|
false
|
|
16030
16121
|
);
|
|
16031
16122
|
if (!confirmed) {
|
|
16032
|
-
console.log(
|
|
16123
|
+
console.log(chalk64.dim("Cancelled"));
|
|
16033
16124
|
return;
|
|
16034
16125
|
}
|
|
16035
16126
|
}
|
|
16036
16127
|
await deleteSecret(name);
|
|
16037
|
-
console.log(
|
|
16128
|
+
console.log(chalk64.green(`\u2713 Secret "${name}" deleted`));
|
|
16038
16129
|
})
|
|
16039
16130
|
);
|
|
16040
16131
|
|
|
@@ -16046,7 +16137,7 @@ import { Command as Command75 } from "commander";
|
|
|
16046
16137
|
|
|
16047
16138
|
// src/commands/variable/list.ts
|
|
16048
16139
|
import { Command as Command72 } from "commander";
|
|
16049
|
-
import
|
|
16140
|
+
import chalk65 from "chalk";
|
|
16050
16141
|
function truncateValue(value, maxLength = 60) {
|
|
16051
16142
|
if (value.length <= maxLength) {
|
|
16052
16143
|
return value;
|
|
@@ -16057,32 +16148,32 @@ var listCommand9 = new Command72().name("list").alias("ls").description("List al
|
|
|
16057
16148
|
withErrorHandler(async () => {
|
|
16058
16149
|
const result = await listVariables();
|
|
16059
16150
|
if (result.variables.length === 0) {
|
|
16060
|
-
console.log(
|
|
16151
|
+
console.log(chalk65.dim("No variables found"));
|
|
16061
16152
|
console.log();
|
|
16062
16153
|
console.log("To add a variable:");
|
|
16063
|
-
console.log(
|
|
16154
|
+
console.log(chalk65.cyan(" vm0 variable set MY_VAR <value>"));
|
|
16064
16155
|
return;
|
|
16065
16156
|
}
|
|
16066
|
-
console.log(
|
|
16157
|
+
console.log(chalk65.bold("Variables:"));
|
|
16067
16158
|
console.log();
|
|
16068
16159
|
for (const variable of result.variables) {
|
|
16069
16160
|
const displayValue = truncateValue(variable.value);
|
|
16070
|
-
console.log(` ${
|
|
16161
|
+
console.log(` ${chalk65.cyan(variable.name)} = ${displayValue}`);
|
|
16071
16162
|
if (variable.description) {
|
|
16072
|
-
console.log(` ${
|
|
16163
|
+
console.log(` ${chalk65.dim(variable.description)}`);
|
|
16073
16164
|
}
|
|
16074
16165
|
console.log(
|
|
16075
|
-
` ${
|
|
16166
|
+
` ${chalk65.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
16076
16167
|
);
|
|
16077
16168
|
console.log();
|
|
16078
16169
|
}
|
|
16079
|
-
console.log(
|
|
16170
|
+
console.log(chalk65.dim(`Total: ${result.variables.length} variable(s)`));
|
|
16080
16171
|
})
|
|
16081
16172
|
);
|
|
16082
16173
|
|
|
16083
16174
|
// src/commands/variable/set.ts
|
|
16084
16175
|
import { Command as Command73 } from "commander";
|
|
16085
|
-
import
|
|
16176
|
+
import chalk66 from "chalk";
|
|
16086
16177
|
var setCommand3 = new Command73().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(
|
|
16087
16178
|
withErrorHandler(
|
|
16088
16179
|
async (name, value, options) => {
|
|
@@ -16103,18 +16194,18 @@ var setCommand3 = new Command73().name("set").description("Create or update a va
|
|
|
16103
16194
|
}
|
|
16104
16195
|
throw error;
|
|
16105
16196
|
}
|
|
16106
|
-
console.log(
|
|
16197
|
+
console.log(chalk66.green(`\u2713 Variable "${variable.name}" saved`));
|
|
16107
16198
|
console.log();
|
|
16108
16199
|
console.log("Use in vm0.yaml:");
|
|
16109
|
-
console.log(
|
|
16110
|
-
console.log(
|
|
16200
|
+
console.log(chalk66.cyan(` environment:`));
|
|
16201
|
+
console.log(chalk66.cyan(` ${name}: \${{ vars.${name} }}`));
|
|
16111
16202
|
}
|
|
16112
16203
|
)
|
|
16113
16204
|
);
|
|
16114
16205
|
|
|
16115
16206
|
// src/commands/variable/delete.ts
|
|
16116
16207
|
import { Command as Command74 } from "commander";
|
|
16117
|
-
import
|
|
16208
|
+
import chalk67 from "chalk";
|
|
16118
16209
|
var deleteCommand4 = new Command74().name("delete").description("Delete a variable").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
16119
16210
|
withErrorHandler(async (name, options) => {
|
|
16120
16211
|
try {
|
|
@@ -16134,12 +16225,12 @@ var deleteCommand4 = new Command74().name("delete").description("Delete a variab
|
|
|
16134
16225
|
false
|
|
16135
16226
|
);
|
|
16136
16227
|
if (!confirmed) {
|
|
16137
|
-
console.log(
|
|
16228
|
+
console.log(chalk67.dim("Cancelled"));
|
|
16138
16229
|
return;
|
|
16139
16230
|
}
|
|
16140
16231
|
}
|
|
16141
16232
|
await deleteVariable(name);
|
|
16142
|
-
console.log(
|
|
16233
|
+
console.log(chalk67.green(`\u2713 Variable "${name}" deleted`));
|
|
16143
16234
|
})
|
|
16144
16235
|
);
|
|
16145
16236
|
|
|
@@ -16151,15 +16242,15 @@ import { Command as Command80 } from "commander";
|
|
|
16151
16242
|
|
|
16152
16243
|
// src/commands/model-provider/list.ts
|
|
16153
16244
|
import { Command as Command76 } from "commander";
|
|
16154
|
-
import
|
|
16245
|
+
import chalk68 from "chalk";
|
|
16155
16246
|
var listCommand10 = new Command76().name("list").alias("ls").description("List all model providers").action(
|
|
16156
16247
|
withErrorHandler(async () => {
|
|
16157
16248
|
const result = await listModelProviders();
|
|
16158
16249
|
if (result.modelProviders.length === 0) {
|
|
16159
|
-
console.log(
|
|
16250
|
+
console.log(chalk68.dim("No model providers configured"));
|
|
16160
16251
|
console.log();
|
|
16161
16252
|
console.log("To add a model provider:");
|
|
16162
|
-
console.log(
|
|
16253
|
+
console.log(chalk68.cyan(" vm0 model-provider setup"));
|
|
16163
16254
|
return;
|
|
16164
16255
|
}
|
|
16165
16256
|
const byFramework = result.modelProviders.reduce(
|
|
@@ -16173,16 +16264,16 @@ var listCommand10 = new Command76().name("list").alias("ls").description("List a
|
|
|
16173
16264
|
},
|
|
16174
16265
|
{}
|
|
16175
16266
|
);
|
|
16176
|
-
console.log(
|
|
16267
|
+
console.log(chalk68.bold("Model Providers:"));
|
|
16177
16268
|
console.log();
|
|
16178
16269
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
16179
|
-
console.log(` ${
|
|
16270
|
+
console.log(` ${chalk68.cyan(framework)}:`);
|
|
16180
16271
|
for (const provider of providers) {
|
|
16181
|
-
const defaultTag = provider.isDefault ?
|
|
16182
|
-
const modelTag = provider.selectedModel ?
|
|
16272
|
+
const defaultTag = provider.isDefault ? chalk68.green(" (default)") : "";
|
|
16273
|
+
const modelTag = provider.selectedModel ? chalk68.dim(` [${provider.selectedModel}]`) : "";
|
|
16183
16274
|
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
16184
16275
|
console.log(
|
|
16185
|
-
|
|
16276
|
+
chalk68.dim(
|
|
16186
16277
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
16187
16278
|
)
|
|
16188
16279
|
);
|
|
@@ -16190,14 +16281,14 @@ var listCommand10 = new Command76().name("list").alias("ls").description("List a
|
|
|
16190
16281
|
console.log();
|
|
16191
16282
|
}
|
|
16192
16283
|
console.log(
|
|
16193
|
-
|
|
16284
|
+
chalk68.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
16194
16285
|
);
|
|
16195
16286
|
})
|
|
16196
16287
|
);
|
|
16197
16288
|
|
|
16198
16289
|
// src/commands/model-provider/setup.ts
|
|
16199
16290
|
import { Command as Command77 } from "commander";
|
|
16200
|
-
import
|
|
16291
|
+
import chalk69 from "chalk";
|
|
16201
16292
|
import prompts2 from "prompts";
|
|
16202
16293
|
function validateProviderType(typeStr) {
|
|
16203
16294
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
@@ -16381,7 +16472,7 @@ async function promptForModelSelection(type2) {
|
|
|
16381
16472
|
if (selected === "__custom__") {
|
|
16382
16473
|
const placeholder = getCustomModelPlaceholder(type2);
|
|
16383
16474
|
if (placeholder) {
|
|
16384
|
-
console.log(
|
|
16475
|
+
console.log(chalk69.dim(`Example: ${placeholder}`));
|
|
16385
16476
|
}
|
|
16386
16477
|
const customResponse = await prompts2(
|
|
16387
16478
|
{
|
|
@@ -16431,7 +16522,7 @@ async function promptForSecrets(type2, authMethod) {
|
|
|
16431
16522
|
const secrets = {};
|
|
16432
16523
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
16433
16524
|
if (fieldConfig.helpText) {
|
|
16434
|
-
console.log(
|
|
16525
|
+
console.log(chalk69.dim(fieldConfig.helpText));
|
|
16435
16526
|
}
|
|
16436
16527
|
const isSensitive = isSensitiveSecret(name);
|
|
16437
16528
|
const placeholder = "placeholder" in fieldConfig ? fieldConfig.placeholder : "";
|
|
@@ -16483,7 +16574,7 @@ async function handleInteractiveMode() {
|
|
|
16483
16574
|
title = `${title} \u2713`;
|
|
16484
16575
|
}
|
|
16485
16576
|
if (isExperimental) {
|
|
16486
|
-
title = `${title} ${
|
|
16577
|
+
title = `${title} ${chalk69.dim("(experimental)")}`;
|
|
16487
16578
|
}
|
|
16488
16579
|
return {
|
|
16489
16580
|
title,
|
|
@@ -16530,7 +16621,7 @@ async function handleInteractiveMode() {
|
|
|
16530
16621
|
}
|
|
16531
16622
|
const config = MODEL_PROVIDER_TYPES[type2];
|
|
16532
16623
|
console.log();
|
|
16533
|
-
console.log(
|
|
16624
|
+
console.log(chalk69.dim(config.helpText));
|
|
16534
16625
|
console.log();
|
|
16535
16626
|
if (hasAuthMethods(type2)) {
|
|
16536
16627
|
const authMethod = await promptForAuthMethod(type2);
|
|
@@ -16571,7 +16662,7 @@ async function promptSetAsDefault(type2, framework, isDefault) {
|
|
|
16571
16662
|
);
|
|
16572
16663
|
if (response.setDefault) {
|
|
16573
16664
|
await setModelProviderDefault(type2);
|
|
16574
|
-
console.log(
|
|
16665
|
+
console.log(chalk69.green(`\u2713 Default for ${framework} set to "${type2}"`));
|
|
16575
16666
|
}
|
|
16576
16667
|
}
|
|
16577
16668
|
function collectSecrets(value, previous) {
|
|
@@ -16615,11 +16706,11 @@ var setupCommand2 = new Command77().name("setup").description("Configure a model
|
|
|
16615
16706
|
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
16616
16707
|
if (!hasModelSelection(input.type)) {
|
|
16617
16708
|
console.log(
|
|
16618
|
-
|
|
16709
|
+
chalk69.green(`\u2713 Model provider "${input.type}" unchanged`)
|
|
16619
16710
|
);
|
|
16620
16711
|
} else {
|
|
16621
16712
|
console.log(
|
|
16622
|
-
|
|
16713
|
+
chalk69.green(
|
|
16623
16714
|
`\u2713 Model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
16624
16715
|
)
|
|
16625
16716
|
);
|
|
@@ -16644,7 +16735,7 @@ var setupCommand2 = new Command77().name("setup").description("Configure a model
|
|
|
16644
16735
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
16645
16736
|
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
16646
16737
|
console.log(
|
|
16647
|
-
|
|
16738
|
+
chalk69.green(
|
|
16648
16739
|
`\u2713 Model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
16649
16740
|
)
|
|
16650
16741
|
);
|
|
@@ -16661,7 +16752,7 @@ var setupCommand2 = new Command77().name("setup").description("Configure a model
|
|
|
16661
16752
|
|
|
16662
16753
|
// src/commands/model-provider/delete.ts
|
|
16663
16754
|
import { Command as Command78 } from "commander";
|
|
16664
|
-
import
|
|
16755
|
+
import chalk70 from "chalk";
|
|
16665
16756
|
var deleteCommand5 = new Command78().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(
|
|
16666
16757
|
withErrorHandler(async (type2) => {
|
|
16667
16758
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
@@ -16671,13 +16762,13 @@ var deleteCommand5 = new Command78().name("delete").description("Delete a model
|
|
|
16671
16762
|
});
|
|
16672
16763
|
}
|
|
16673
16764
|
await deleteModelProvider(type2);
|
|
16674
|
-
console.log(
|
|
16765
|
+
console.log(chalk70.green(`\u2713 Model provider "${type2}" deleted`));
|
|
16675
16766
|
})
|
|
16676
16767
|
);
|
|
16677
16768
|
|
|
16678
16769
|
// src/commands/model-provider/set-default.ts
|
|
16679
16770
|
import { Command as Command79 } from "commander";
|
|
16680
|
-
import
|
|
16771
|
+
import chalk71 from "chalk";
|
|
16681
16772
|
var setDefaultCommand = new Command79().name("set-default").description("Set a model provider as default for its framework").argument("<type>", "Model provider type to set as default").action(
|
|
16682
16773
|
withErrorHandler(async (type2) => {
|
|
16683
16774
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
@@ -16688,7 +16779,7 @@ var setDefaultCommand = new Command79().name("set-default").description("Set a m
|
|
|
16688
16779
|
}
|
|
16689
16780
|
const provider = await setModelProviderDefault(type2);
|
|
16690
16781
|
console.log(
|
|
16691
|
-
|
|
16782
|
+
chalk71.green(
|
|
16692
16783
|
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
16693
16784
|
)
|
|
16694
16785
|
);
|
|
@@ -16703,7 +16794,7 @@ import { Command as Command85 } from "commander";
|
|
|
16703
16794
|
|
|
16704
16795
|
// src/commands/connector/connect.ts
|
|
16705
16796
|
import { Command as Command81 } from "commander";
|
|
16706
|
-
import
|
|
16797
|
+
import chalk73 from "chalk";
|
|
16707
16798
|
import { initClient as initClient13 } from "@ts-rest/core";
|
|
16708
16799
|
|
|
16709
16800
|
// src/commands/connector/lib/computer/start-services.ts
|
|
@@ -16712,7 +16803,7 @@ import { access as access2, constants } from "fs/promises";
|
|
|
16712
16803
|
import { createServer } from "net";
|
|
16713
16804
|
import { homedir as homedir4 } from "os";
|
|
16714
16805
|
import { join as join12 } from "path";
|
|
16715
|
-
import
|
|
16806
|
+
import chalk72 from "chalk";
|
|
16716
16807
|
|
|
16717
16808
|
// src/commands/connector/lib/computer/ngrok.ts
|
|
16718
16809
|
import ngrok from "@ngrok/ngrok";
|
|
@@ -16786,7 +16877,7 @@ async function checkComputerDependencies() {
|
|
|
16786
16877
|
}
|
|
16787
16878
|
}
|
|
16788
16879
|
async function startComputerServices(credentials) {
|
|
16789
|
-
console.log(
|
|
16880
|
+
console.log(chalk72.cyan("Starting computer connector services..."));
|
|
16790
16881
|
const wsgidavBinary = await findBinary("wsgidav");
|
|
16791
16882
|
if (!wsgidavBinary) {
|
|
16792
16883
|
throw new Error(
|
|
@@ -16813,7 +16904,7 @@ async function startComputerServices(credentials) {
|
|
|
16813
16904
|
);
|
|
16814
16905
|
wsgidav.stdout?.on("data", (data) => process.stdout.write(data));
|
|
16815
16906
|
wsgidav.stderr?.on("data", (data) => process.stderr.write(data));
|
|
16816
|
-
console.log(
|
|
16907
|
+
console.log(chalk72.green("\u2713 WebDAV server started"));
|
|
16817
16908
|
const chrome = spawn2(
|
|
16818
16909
|
chromeBinary,
|
|
16819
16910
|
[
|
|
@@ -16827,7 +16918,7 @@ async function startComputerServices(credentials) {
|
|
|
16827
16918
|
);
|
|
16828
16919
|
chrome.stdout?.on("data", (data) => process.stdout.write(data));
|
|
16829
16920
|
chrome.stderr?.on("data", (data) => process.stderr.write(data));
|
|
16830
|
-
console.log(
|
|
16921
|
+
console.log(chalk72.green("\u2713 Chrome started"));
|
|
16831
16922
|
try {
|
|
16832
16923
|
await startNgrokTunnels(
|
|
16833
16924
|
credentials.ngrokToken,
|
|
@@ -16836,18 +16927,18 @@ async function startComputerServices(credentials) {
|
|
|
16836
16927
|
cdpPort
|
|
16837
16928
|
);
|
|
16838
16929
|
console.log(
|
|
16839
|
-
|
|
16930
|
+
chalk72.green(
|
|
16840
16931
|
`\u2713 ngrok tunnels: webdav.${credentials.domain}, chrome.${credentials.domain}`
|
|
16841
16932
|
)
|
|
16842
16933
|
);
|
|
16843
16934
|
console.log();
|
|
16844
|
-
console.log(
|
|
16935
|
+
console.log(chalk72.green("\u2713 Computer connector active"));
|
|
16845
16936
|
console.log(` WebDAV: ~/Downloads \u2192 webdav.${credentials.domain}`);
|
|
16846
16937
|
console.log(
|
|
16847
16938
|
` Chrome CDP: port ${cdpPort} \u2192 chrome.${credentials.domain}`
|
|
16848
16939
|
);
|
|
16849
16940
|
console.log();
|
|
16850
|
-
console.log(
|
|
16941
|
+
console.log(chalk72.dim("Press ^C twice to disconnect"));
|
|
16851
16942
|
console.log();
|
|
16852
16943
|
let sigintCount = 0;
|
|
16853
16944
|
await new Promise((resolve2) => {
|
|
@@ -16861,7 +16952,7 @@ async function startComputerServices(credentials) {
|
|
|
16861
16952
|
const onSigint = () => {
|
|
16862
16953
|
sigintCount++;
|
|
16863
16954
|
if (sigintCount === 1) {
|
|
16864
|
-
console.log(
|
|
16955
|
+
console.log(chalk72.dim("\nPress ^C again to disconnect and exit..."));
|
|
16865
16956
|
} else {
|
|
16866
16957
|
done();
|
|
16867
16958
|
}
|
|
@@ -16871,11 +16962,11 @@ async function startComputerServices(credentials) {
|
|
|
16871
16962
|
});
|
|
16872
16963
|
} finally {
|
|
16873
16964
|
console.log();
|
|
16874
|
-
console.log(
|
|
16965
|
+
console.log(chalk72.cyan("Stopping services..."));
|
|
16875
16966
|
wsgidav.kill("SIGTERM");
|
|
16876
16967
|
chrome.kill("SIGTERM");
|
|
16877
16968
|
await stopNgrokTunnels();
|
|
16878
|
-
console.log(
|
|
16969
|
+
console.log(chalk72.green("\u2713 Services stopped"));
|
|
16879
16970
|
}
|
|
16880
16971
|
}
|
|
16881
16972
|
|
|
@@ -16900,10 +16991,10 @@ async function getHeaders2() {
|
|
|
16900
16991
|
function renderHelpText(text) {
|
|
16901
16992
|
return text.replace(
|
|
16902
16993
|
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
16903
|
-
(_m, label, url) => `${label} (${
|
|
16904
|
-
).replace(/\*\*([^*]+)\*\*/g, (_m, content) =>
|
|
16994
|
+
(_m, label, url) => `${label} (${chalk73.cyan(url)})`
|
|
16995
|
+
).replace(/\*\*([^*]+)\*\*/g, (_m, content) => chalk73.bold(content)).replace(
|
|
16905
16996
|
/^> (.+)$/gm,
|
|
16906
|
-
(_m, content) =>
|
|
16997
|
+
(_m, content) => chalk73.yellow(` ${content}`)
|
|
16907
16998
|
);
|
|
16908
16999
|
}
|
|
16909
17000
|
async function connectViaApiToken(connectorType, tokenValue) {
|
|
@@ -16928,7 +17019,7 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
16928
17019
|
for (const [secretName, secretConfig] of secretEntries) {
|
|
16929
17020
|
if (!secretConfig.required) continue;
|
|
16930
17021
|
const value = await promptPassword(
|
|
16931
|
-
`${secretConfig.label}${secretConfig.placeholder ?
|
|
17022
|
+
`${secretConfig.label}${secretConfig.placeholder ? chalk73.dim(` (${secretConfig.placeholder})`) : ""}:`
|
|
16932
17023
|
);
|
|
16933
17024
|
if (!value) {
|
|
16934
17025
|
throw new Error("Cancelled");
|
|
@@ -16944,13 +17035,13 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
16944
17035
|
});
|
|
16945
17036
|
}
|
|
16946
17037
|
console.log(
|
|
16947
|
-
|
|
17038
|
+
chalk73.green(`
|
|
16948
17039
|
\u2713 ${config.label} connected successfully via API token!`)
|
|
16949
17040
|
);
|
|
16950
17041
|
}
|
|
16951
17042
|
async function connectComputer(apiUrl, headers) {
|
|
16952
17043
|
await checkComputerDependencies();
|
|
16953
|
-
console.log(
|
|
17044
|
+
console.log(chalk73.cyan("Setting up computer connector..."));
|
|
16954
17045
|
const computerClient = initClient13(computerConnectorContract, {
|
|
16955
17046
|
baseUrl: apiUrl,
|
|
16956
17047
|
baseHeaders: headers,
|
|
@@ -16965,9 +17056,9 @@ async function connectComputer(apiUrl, headers) {
|
|
|
16965
17056
|
}
|
|
16966
17057
|
const credentials = createResult.body;
|
|
16967
17058
|
await startComputerServices(credentials);
|
|
16968
|
-
console.log(
|
|
17059
|
+
console.log(chalk73.cyan("Disconnecting computer connector..."));
|
|
16969
17060
|
await deleteConnector("computer");
|
|
16970
|
-
console.log(
|
|
17061
|
+
console.log(chalk73.green("\u2713 Disconnected computer"));
|
|
16971
17062
|
process.exit(0);
|
|
16972
17063
|
}
|
|
16973
17064
|
async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
@@ -17006,7 +17097,7 @@ async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
|
17006
17097
|
);
|
|
17007
17098
|
}
|
|
17008
17099
|
async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
17009
|
-
console.log(`Connecting ${
|
|
17100
|
+
console.log(`Connecting ${chalk73.cyan(connectorType)}...`);
|
|
17010
17101
|
const sessionsClient = initClient13(connectorSessionsContract, {
|
|
17011
17102
|
baseUrl: apiUrl,
|
|
17012
17103
|
baseHeaders: headers,
|
|
@@ -17022,8 +17113,8 @@ async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
|
17022
17113
|
}
|
|
17023
17114
|
const session = createResult.body;
|
|
17024
17115
|
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
17025
|
-
console.log(
|
|
17026
|
-
console.log(
|
|
17116
|
+
console.log(chalk73.green("\nSession created"));
|
|
17117
|
+
console.log(chalk73.cyan(`
|
|
17027
17118
|
To connect, visit: ${verificationUrl}`));
|
|
17028
17119
|
console.log(
|
|
17029
17120
|
`
|
|
@@ -17055,7 +17146,7 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
17055
17146
|
switch (status.status) {
|
|
17056
17147
|
case "complete":
|
|
17057
17148
|
console.log(
|
|
17058
|
-
|
|
17149
|
+
chalk73.green(`
|
|
17059
17150
|
|
|
17060
17151
|
${connectorType} connected successfully!`)
|
|
17061
17152
|
);
|
|
@@ -17067,7 +17158,7 @@ ${connectorType} connected successfully!`)
|
|
|
17067
17158
|
`Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
17068
17159
|
);
|
|
17069
17160
|
case "pending":
|
|
17070
|
-
process.stdout.write(
|
|
17161
|
+
process.stdout.write(chalk73.dim("."));
|
|
17071
17162
|
break;
|
|
17072
17163
|
}
|
|
17073
17164
|
}
|
|
@@ -17099,11 +17190,11 @@ var connectCommand = new Command81().name("connect").description("Connect a thir
|
|
|
17099
17190
|
|
|
17100
17191
|
// src/commands/connector/list.ts
|
|
17101
17192
|
import { Command as Command82 } from "commander";
|
|
17102
|
-
import
|
|
17193
|
+
import chalk74 from "chalk";
|
|
17103
17194
|
var listCommand11 = new Command82().name("list").alias("ls").description("List all connectors and their status").action(
|
|
17104
17195
|
withErrorHandler(async () => {
|
|
17105
17196
|
const result = await listConnectors();
|
|
17106
|
-
const connectedMap = new Map(result.connectors.map((
|
|
17197
|
+
const connectedMap = new Map(result.connectors.map((c24) => [c24.type, c24]));
|
|
17107
17198
|
const allTypesRaw = Object.keys(CONNECTOR_TYPES);
|
|
17108
17199
|
const allTypes = [];
|
|
17109
17200
|
for (const type2 of allTypesRaw) {
|
|
@@ -17122,23 +17213,23 @@ var listCommand11 = new Command82().name("list").alias("ls").description("List a
|
|
|
17122
17213
|
statusText.padEnd(statusWidth),
|
|
17123
17214
|
"ACCOUNT"
|
|
17124
17215
|
].join(" ");
|
|
17125
|
-
console.log(
|
|
17216
|
+
console.log(chalk74.dim(header));
|
|
17126
17217
|
for (const type2 of allTypes) {
|
|
17127
17218
|
const connector = connectedMap.get(type2);
|
|
17128
|
-
const status = connector ?
|
|
17129
|
-
const account = connector?.externalUsername ? `@${connector.externalUsername}` :
|
|
17219
|
+
const status = connector ? chalk74.green("\u2713".padEnd(statusWidth)) : chalk74.dim("-".padEnd(statusWidth));
|
|
17220
|
+
const account = connector?.externalUsername ? `@${connector.externalUsername}` : chalk74.dim("-");
|
|
17130
17221
|
const row = [type2.padEnd(typeWidth), status, account].join(" ");
|
|
17131
17222
|
console.log(row);
|
|
17132
17223
|
}
|
|
17133
17224
|
console.log();
|
|
17134
|
-
console.log(
|
|
17135
|
-
console.log(
|
|
17225
|
+
console.log(chalk74.dim("To connect a service:"));
|
|
17226
|
+
console.log(chalk74.dim(" vm0 connector connect <type>"));
|
|
17136
17227
|
})
|
|
17137
17228
|
);
|
|
17138
17229
|
|
|
17139
17230
|
// src/commands/connector/status.ts
|
|
17140
17231
|
import { Command as Command83 } from "commander";
|
|
17141
|
-
import
|
|
17232
|
+
import chalk75 from "chalk";
|
|
17142
17233
|
var LABEL_WIDTH = 16;
|
|
17143
17234
|
var statusCommand8 = new Command83().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").action(
|
|
17144
17235
|
withErrorHandler(async (type2) => {
|
|
@@ -17150,11 +17241,11 @@ var statusCommand8 = new Command83().name("status").description("Show detailed s
|
|
|
17150
17241
|
});
|
|
17151
17242
|
}
|
|
17152
17243
|
const connector = await getConnector(parseResult.data);
|
|
17153
|
-
console.log(`Connector: ${
|
|
17244
|
+
console.log(`Connector: ${chalk75.cyan(type2)}`);
|
|
17154
17245
|
console.log();
|
|
17155
17246
|
if (connector) {
|
|
17156
17247
|
console.log(
|
|
17157
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
17248
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk75.green("connected")}`
|
|
17158
17249
|
);
|
|
17159
17250
|
console.log(
|
|
17160
17251
|
`${"Account:".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`
|
|
@@ -17176,22 +17267,22 @@ var statusCommand8 = new Command83().name("status").description("Show detailed s
|
|
|
17176
17267
|
);
|
|
17177
17268
|
}
|
|
17178
17269
|
console.log();
|
|
17179
|
-
console.log(
|
|
17180
|
-
console.log(
|
|
17270
|
+
console.log(chalk75.dim("To disconnect:"));
|
|
17271
|
+
console.log(chalk75.dim(` vm0 connector disconnect ${type2}`));
|
|
17181
17272
|
} else {
|
|
17182
17273
|
console.log(
|
|
17183
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
17274
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk75.dim("not connected")}`
|
|
17184
17275
|
);
|
|
17185
17276
|
console.log();
|
|
17186
|
-
console.log(
|
|
17187
|
-
console.log(
|
|
17277
|
+
console.log(chalk75.dim("To connect:"));
|
|
17278
|
+
console.log(chalk75.dim(` vm0 connector connect ${type2}`));
|
|
17188
17279
|
}
|
|
17189
17280
|
})
|
|
17190
17281
|
);
|
|
17191
17282
|
|
|
17192
17283
|
// src/commands/connector/disconnect.ts
|
|
17193
17284
|
import { Command as Command84 } from "commander";
|
|
17194
|
-
import
|
|
17285
|
+
import chalk76 from "chalk";
|
|
17195
17286
|
var disconnectCommand = new Command84().name("disconnect").description("Disconnect a third-party service").argument("<type>", "Connector type to disconnect (e.g., github)").action(
|
|
17196
17287
|
withErrorHandler(async (type2) => {
|
|
17197
17288
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
@@ -17203,7 +17294,7 @@ var disconnectCommand = new Command84().name("disconnect").description("Disconne
|
|
|
17203
17294
|
}
|
|
17204
17295
|
const connectorType = parseResult.data;
|
|
17205
17296
|
await deleteConnector(connectorType);
|
|
17206
|
-
console.log(
|
|
17297
|
+
console.log(chalk76.green(`\u2713 Disconnected ${type2}`));
|
|
17207
17298
|
})
|
|
17208
17299
|
);
|
|
17209
17300
|
|
|
@@ -17212,24 +17303,24 @@ var connectorCommand = new Command85().name("connector").description("Manage thi
|
|
|
17212
17303
|
|
|
17213
17304
|
// src/commands/onboard/index.ts
|
|
17214
17305
|
import { Command as Command86 } from "commander";
|
|
17215
|
-
import
|
|
17306
|
+
import chalk80 from "chalk";
|
|
17216
17307
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
17217
17308
|
import { existsSync as existsSync12 } from "fs";
|
|
17218
17309
|
|
|
17219
17310
|
// src/lib/ui/welcome-box.ts
|
|
17220
|
-
import
|
|
17311
|
+
import chalk77 from "chalk";
|
|
17221
17312
|
var gradientColors = [
|
|
17222
|
-
|
|
17313
|
+
chalk77.hex("#FFAB5E"),
|
|
17223
17314
|
// Line 1 - lightest
|
|
17224
|
-
|
|
17315
|
+
chalk77.hex("#FF9642"),
|
|
17225
17316
|
// Line 2
|
|
17226
|
-
|
|
17317
|
+
chalk77.hex("#FF8228"),
|
|
17227
17318
|
// Line 3
|
|
17228
|
-
|
|
17319
|
+
chalk77.hex("#FF6D0A"),
|
|
17229
17320
|
// Line 4
|
|
17230
|
-
|
|
17321
|
+
chalk77.hex("#E85D00"),
|
|
17231
17322
|
// Line 5
|
|
17232
|
-
|
|
17323
|
+
chalk77.hex("#CC4E00")
|
|
17233
17324
|
// Line 6 - darkest
|
|
17234
17325
|
];
|
|
17235
17326
|
var vm0LogoLines = [
|
|
@@ -17251,15 +17342,15 @@ function renderVm0Banner() {
|
|
|
17251
17342
|
function renderOnboardWelcome() {
|
|
17252
17343
|
renderVm0Banner();
|
|
17253
17344
|
console.log(` Build agentic workflows using natural language.`);
|
|
17254
|
-
console.log(` ${
|
|
17345
|
+
console.log(` ${chalk77.dim("Currently in beta, enjoy it free")}`);
|
|
17255
17346
|
console.log(
|
|
17256
|
-
` ${
|
|
17347
|
+
` ${chalk77.dim("Star us on GitHub: https://github.com/vm0-ai/vm0")}`
|
|
17257
17348
|
);
|
|
17258
17349
|
console.log();
|
|
17259
17350
|
}
|
|
17260
17351
|
|
|
17261
17352
|
// src/lib/ui/step-runner.ts
|
|
17262
|
-
import
|
|
17353
|
+
import chalk78 from "chalk";
|
|
17263
17354
|
function createStepRunner(options = true) {
|
|
17264
17355
|
const opts = typeof options === "boolean" ? { interactive: options } : options;
|
|
17265
17356
|
const interactive = opts.interactive ?? true;
|
|
@@ -17274,25 +17365,25 @@ function createStepRunner(options = true) {
|
|
|
17274
17365
|
}
|
|
17275
17366
|
for (const [i, step] of completedSteps.entries()) {
|
|
17276
17367
|
if (step.failed) {
|
|
17277
|
-
console.log(
|
|
17368
|
+
console.log(chalk78.red(`\u2717 ${step.label}`));
|
|
17278
17369
|
} else {
|
|
17279
|
-
console.log(
|
|
17370
|
+
console.log(chalk78.green(`\u25CF ${step.label}`));
|
|
17280
17371
|
}
|
|
17281
17372
|
const isLastStep = i === completedSteps.length - 1;
|
|
17282
17373
|
if (!isLastStep || !isFinal) {
|
|
17283
|
-
console.log(
|
|
17374
|
+
console.log(chalk78.dim("\u2502"));
|
|
17284
17375
|
}
|
|
17285
17376
|
}
|
|
17286
17377
|
}
|
|
17287
17378
|
async function executeStep(label, fn, isFinal) {
|
|
17288
17379
|
let stepFailed = false;
|
|
17289
|
-
console.log(
|
|
17380
|
+
console.log(chalk78.yellow(`\u25CB ${label}`));
|
|
17290
17381
|
const ctx = {
|
|
17291
17382
|
connector() {
|
|
17292
|
-
console.log(
|
|
17383
|
+
console.log(chalk78.dim("\u2502"));
|
|
17293
17384
|
},
|
|
17294
17385
|
detail(message) {
|
|
17295
|
-
console.log(`${
|
|
17386
|
+
console.log(`${chalk78.dim("\u2502")} ${message}`);
|
|
17296
17387
|
},
|
|
17297
17388
|
async prompt(promptFn) {
|
|
17298
17389
|
return await promptFn();
|
|
@@ -17309,12 +17400,12 @@ function createStepRunner(options = true) {
|
|
|
17309
17400
|
redrawCompletedSteps(isFinal);
|
|
17310
17401
|
} else {
|
|
17311
17402
|
if (stepFailed) {
|
|
17312
|
-
console.log(
|
|
17403
|
+
console.log(chalk78.red(`\u2717 ${label}`));
|
|
17313
17404
|
} else {
|
|
17314
|
-
console.log(
|
|
17405
|
+
console.log(chalk78.green(`\u25CF ${label}`));
|
|
17315
17406
|
}
|
|
17316
17407
|
if (!isFinal) {
|
|
17317
|
-
console.log(
|
|
17408
|
+
console.log(chalk78.dim("\u2502"));
|
|
17318
17409
|
}
|
|
17319
17410
|
}
|
|
17320
17411
|
}
|
|
@@ -17474,7 +17565,7 @@ async function setupModelProvider(type2, secret, options) {
|
|
|
17474
17565
|
|
|
17475
17566
|
// src/lib/domain/onboard/claude-setup.ts
|
|
17476
17567
|
import { spawn as spawn3 } from "child_process";
|
|
17477
|
-
import
|
|
17568
|
+
import chalk79 from "chalk";
|
|
17478
17569
|
var MARKETPLACE_NAME = "vm0-skills";
|
|
17479
17570
|
var MARKETPLACE_REPO = "vm0-ai/vm0-skills";
|
|
17480
17571
|
var PLUGIN_ID = "vm0@vm0-skills";
|
|
@@ -17511,12 +17602,12 @@ async function runClaudeCommand(args, cwd) {
|
|
|
17511
17602
|
}
|
|
17512
17603
|
function handlePluginError(error, context) {
|
|
17513
17604
|
const displayContext = context ?? "Claude plugin";
|
|
17514
|
-
console.error(
|
|
17605
|
+
console.error(chalk79.red(`\u2717 Failed to install ${displayContext}`));
|
|
17515
17606
|
if (error instanceof Error) {
|
|
17516
|
-
console.error(
|
|
17607
|
+
console.error(chalk79.red(`\u2717 ${error.message}`));
|
|
17517
17608
|
}
|
|
17518
17609
|
console.error(
|
|
17519
|
-
|
|
17610
|
+
chalk79.dim("Please ensure Claude CLI is installed and accessible.")
|
|
17520
17611
|
);
|
|
17521
17612
|
process.exit(1);
|
|
17522
17613
|
}
|
|
@@ -17559,7 +17650,7 @@ async function updateMarketplace() {
|
|
|
17559
17650
|
]);
|
|
17560
17651
|
if (!result.success) {
|
|
17561
17652
|
console.warn(
|
|
17562
|
-
|
|
17653
|
+
chalk79.yellow(
|
|
17563
17654
|
`Warning: Could not update marketplace: ${result.error ?? "unknown error"}`
|
|
17564
17655
|
)
|
|
17565
17656
|
);
|
|
@@ -17605,9 +17696,9 @@ async function handleAuthentication(ctx) {
|
|
|
17605
17696
|
onInitiating: () => {
|
|
17606
17697
|
},
|
|
17607
17698
|
onDeviceCodeReady: (url, code, expiresIn) => {
|
|
17608
|
-
step.detail(`Copy code: ${
|
|
17609
|
-
step.detail(`Open: ${
|
|
17610
|
-
step.detail(
|
|
17699
|
+
step.detail(`Copy code: ${chalk80.cyan.bold(code)}`);
|
|
17700
|
+
step.detail(`Open: ${chalk80.cyan(url)}`);
|
|
17701
|
+
step.detail(chalk80.dim(`Expires in ${expiresIn} minutes`));
|
|
17611
17702
|
},
|
|
17612
17703
|
onPolling: () => {
|
|
17613
17704
|
},
|
|
@@ -17635,26 +17726,26 @@ async function handleModelProvider(ctx) {
|
|
|
17635
17726
|
const providerType = await step.prompt(
|
|
17636
17727
|
() => promptSelect(
|
|
17637
17728
|
"Select provider type:",
|
|
17638
|
-
choices.map((
|
|
17639
|
-
title:
|
|
17640
|
-
value:
|
|
17729
|
+
choices.map((c24) => ({
|
|
17730
|
+
title: c24.label,
|
|
17731
|
+
value: c24.type
|
|
17641
17732
|
}))
|
|
17642
17733
|
)
|
|
17643
17734
|
);
|
|
17644
17735
|
if (!providerType) {
|
|
17645
17736
|
process.exit(0);
|
|
17646
17737
|
}
|
|
17647
|
-
const selectedChoice = choices.find((
|
|
17738
|
+
const selectedChoice = choices.find((c24) => c24.type === providerType);
|
|
17648
17739
|
if (selectedChoice?.helpText) {
|
|
17649
17740
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
17650
|
-
step.detail(
|
|
17741
|
+
step.detail(chalk80.dim(line));
|
|
17651
17742
|
}
|
|
17652
17743
|
}
|
|
17653
17744
|
const secret = await step.prompt(
|
|
17654
17745
|
() => promptPassword(`Enter your ${selectedChoice?.secretLabel ?? "secret"}:`)
|
|
17655
17746
|
);
|
|
17656
17747
|
if (!secret) {
|
|
17657
|
-
console.log(
|
|
17748
|
+
console.log(chalk80.dim("Cancelled"));
|
|
17658
17749
|
process.exit(0);
|
|
17659
17750
|
}
|
|
17660
17751
|
let selectedModel;
|
|
@@ -17673,7 +17764,7 @@ async function handleModelProvider(ctx) {
|
|
|
17673
17764
|
() => promptSelect("Select model:", modelChoices)
|
|
17674
17765
|
);
|
|
17675
17766
|
if (modelSelection === void 0) {
|
|
17676
|
-
console.log(
|
|
17767
|
+
console.log(chalk80.dim("Cancelled"));
|
|
17677
17768
|
process.exit(0);
|
|
17678
17769
|
}
|
|
17679
17770
|
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
@@ -17683,7 +17774,7 @@ async function handleModelProvider(ctx) {
|
|
|
17683
17774
|
});
|
|
17684
17775
|
const modelNote = result.provider.selectedModel ? ` with model: ${result.provider.selectedModel}` : "";
|
|
17685
17776
|
step.detail(
|
|
17686
|
-
|
|
17777
|
+
chalk80.green(
|
|
17687
17778
|
`${providerType} ${result.created ? "created" : "updated"}${result.isDefault ? ` (default for ${result.framework})` : ""}${modelNote}`
|
|
17688
17779
|
)
|
|
17689
17780
|
);
|
|
@@ -17714,7 +17805,7 @@ async function handleAgentCreation(ctx) {
|
|
|
17714
17805
|
agentName = inputName;
|
|
17715
17806
|
if (existsSync12(agentName)) {
|
|
17716
17807
|
step.detail(
|
|
17717
|
-
|
|
17808
|
+
chalk80.yellow(`${agentName}/ already exists, choose another name`)
|
|
17718
17809
|
);
|
|
17719
17810
|
} else {
|
|
17720
17811
|
folderExists = false;
|
|
@@ -17735,7 +17826,7 @@ async function handleAgentCreation(ctx) {
|
|
|
17735
17826
|
}
|
|
17736
17827
|
}
|
|
17737
17828
|
await mkdir8(agentName, { recursive: true });
|
|
17738
|
-
step.detail(
|
|
17829
|
+
step.detail(chalk80.green(`Created ${agentName}/`));
|
|
17739
17830
|
});
|
|
17740
17831
|
return agentName;
|
|
17741
17832
|
}
|
|
@@ -17751,7 +17842,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17751
17842
|
shouldInstall = confirmed ?? true;
|
|
17752
17843
|
}
|
|
17753
17844
|
if (!shouldInstall) {
|
|
17754
|
-
step.detail(
|
|
17845
|
+
step.detail(chalk80.dim("Skipped"));
|
|
17755
17846
|
return;
|
|
17756
17847
|
}
|
|
17757
17848
|
const scope = "project";
|
|
@@ -17759,7 +17850,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17759
17850
|
const agentDir = `${process.cwd()}/${agentName}`;
|
|
17760
17851
|
const result = await installVm0Plugin(scope, agentDir);
|
|
17761
17852
|
step.detail(
|
|
17762
|
-
|
|
17853
|
+
chalk80.green(`Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
17763
17854
|
);
|
|
17764
17855
|
pluginInstalled = true;
|
|
17765
17856
|
} catch (error) {
|
|
@@ -17770,14 +17861,14 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17770
17861
|
}
|
|
17771
17862
|
function printNextSteps(agentName, pluginInstalled) {
|
|
17772
17863
|
console.log();
|
|
17773
|
-
console.log(
|
|
17864
|
+
console.log(chalk80.bold("Next step:"));
|
|
17774
17865
|
console.log();
|
|
17775
17866
|
if (pluginInstalled) {
|
|
17776
17867
|
console.log(
|
|
17777
|
-
` ${
|
|
17868
|
+
` ${chalk80.cyan(`cd ${agentName} && claude "/${PRIMARY_SKILL_NAME} let's build an agent"`)}`
|
|
17778
17869
|
);
|
|
17779
17870
|
} else {
|
|
17780
|
-
console.log(` ${
|
|
17871
|
+
console.log(` ${chalk80.cyan(`cd ${agentName} && vm0 init`)}`);
|
|
17781
17872
|
}
|
|
17782
17873
|
console.log();
|
|
17783
17874
|
}
|
|
@@ -17807,20 +17898,20 @@ var onboardCommand = new Command86().name("onboard").description("Guided setup f
|
|
|
17807
17898
|
|
|
17808
17899
|
// src/commands/setup-claude/index.ts
|
|
17809
17900
|
import { Command as Command87 } from "commander";
|
|
17810
|
-
import
|
|
17901
|
+
import chalk81 from "chalk";
|
|
17811
17902
|
var setupClaudeCommand = new Command87().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(
|
|
17812
17903
|
withErrorHandler(async (options) => {
|
|
17813
|
-
console.log(
|
|
17904
|
+
console.log(chalk81.dim("Installing VM0 Claude Plugin..."));
|
|
17814
17905
|
const scope = options.scope === "user" ? "user" : "project";
|
|
17815
17906
|
const result = await installVm0Plugin(scope, options.agentDir);
|
|
17816
17907
|
console.log(
|
|
17817
|
-
|
|
17908
|
+
chalk81.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
17818
17909
|
);
|
|
17819
17910
|
console.log();
|
|
17820
17911
|
console.log("Next step:");
|
|
17821
17912
|
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
17822
17913
|
console.log(
|
|
17823
|
-
|
|
17914
|
+
chalk81.cyan(
|
|
17824
17915
|
` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
|
|
17825
17916
|
)
|
|
17826
17917
|
);
|
|
@@ -17829,35 +17920,35 @@ var setupClaudeCommand = new Command87().name("setup-claude").description("Insta
|
|
|
17829
17920
|
|
|
17830
17921
|
// src/commands/dashboard/index.ts
|
|
17831
17922
|
import { Command as Command88 } from "commander";
|
|
17832
|
-
import
|
|
17923
|
+
import chalk82 from "chalk";
|
|
17833
17924
|
var dashboardCommand = new Command88().name("dashboard").description("Quick reference for common query commands").action(() => {
|
|
17834
17925
|
console.log();
|
|
17835
|
-
console.log(
|
|
17926
|
+
console.log(chalk82.bold("VM0 Dashboard"));
|
|
17836
17927
|
console.log();
|
|
17837
|
-
console.log(
|
|
17838
|
-
console.log(
|
|
17928
|
+
console.log(chalk82.bold("Agents"));
|
|
17929
|
+
console.log(chalk82.dim(" List agents: ") + "vm0 agent list");
|
|
17839
17930
|
console.log();
|
|
17840
|
-
console.log(
|
|
17841
|
-
console.log(
|
|
17842
|
-
console.log(
|
|
17931
|
+
console.log(chalk82.bold("Runs"));
|
|
17932
|
+
console.log(chalk82.dim(" Recent runs: ") + "vm0 run list");
|
|
17933
|
+
console.log(chalk82.dim(" View run logs: ") + "vm0 logs <run-id>");
|
|
17843
17934
|
console.log();
|
|
17844
|
-
console.log(
|
|
17845
|
-
console.log(
|
|
17935
|
+
console.log(chalk82.bold("Schedules"));
|
|
17936
|
+
console.log(chalk82.dim(" List schedules: ") + "vm0 schedule list");
|
|
17846
17937
|
console.log();
|
|
17847
|
-
console.log(
|
|
17848
|
-
console.log(
|
|
17849
|
-
console.log(
|
|
17850
|
-
console.log(
|
|
17938
|
+
console.log(chalk82.bold("Account"));
|
|
17939
|
+
console.log(chalk82.dim(" Usage stats: ") + "vm0 usage");
|
|
17940
|
+
console.log(chalk82.dim(" List secrets: ") + "vm0 secret list");
|
|
17941
|
+
console.log(chalk82.dim(" List variables: ") + "vm0 variable list");
|
|
17851
17942
|
console.log();
|
|
17852
17943
|
console.log(
|
|
17853
|
-
|
|
17944
|
+
chalk82.dim("Not logged in? Run: ") + chalk82.cyan("vm0 auth login")
|
|
17854
17945
|
);
|
|
17855
17946
|
console.log();
|
|
17856
17947
|
});
|
|
17857
17948
|
|
|
17858
17949
|
// src/commands/preference/index.ts
|
|
17859
17950
|
import { Command as Command89 } from "commander";
|
|
17860
|
-
import
|
|
17951
|
+
import chalk83 from "chalk";
|
|
17861
17952
|
function detectTimezone2() {
|
|
17862
17953
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
17863
17954
|
}
|
|
@@ -17878,15 +17969,15 @@ function parseOnOff(flag, value) {
|
|
|
17878
17969
|
);
|
|
17879
17970
|
}
|
|
17880
17971
|
function displayPreferences(prefs) {
|
|
17881
|
-
console.log(
|
|
17972
|
+
console.log(chalk83.bold("Current preferences:"));
|
|
17882
17973
|
console.log(
|
|
17883
|
-
` Timezone: ${prefs.timezone ?
|
|
17974
|
+
` Timezone: ${prefs.timezone ? chalk83.cyan(prefs.timezone) : chalk83.dim("not set")}`
|
|
17884
17975
|
);
|
|
17885
17976
|
console.log(
|
|
17886
|
-
` Email notify: ${prefs.notifyEmail ?
|
|
17977
|
+
` Email notify: ${prefs.notifyEmail ? chalk83.green("on") : chalk83.dim("off")}`
|
|
17887
17978
|
);
|
|
17888
17979
|
console.log(
|
|
17889
|
-
` Slack notify: ${prefs.notifySlack ?
|
|
17980
|
+
` Slack notify: ${prefs.notifySlack ? chalk83.green("on") : chalk83.dim("off")}`
|
|
17890
17981
|
);
|
|
17891
17982
|
}
|
|
17892
17983
|
function buildUpdates(opts) {
|
|
@@ -17916,21 +18007,21 @@ function buildUpdates(opts) {
|
|
|
17916
18007
|
function printUpdateResult(updates, result) {
|
|
17917
18008
|
if (updates.timezone !== void 0) {
|
|
17918
18009
|
console.log(
|
|
17919
|
-
|
|
17920
|
-
`Timezone set to ${
|
|
18010
|
+
chalk83.green(
|
|
18011
|
+
`Timezone set to ${chalk83.cyan(result.timezone ?? updates.timezone)}`
|
|
17921
18012
|
)
|
|
17922
18013
|
);
|
|
17923
18014
|
}
|
|
17924
18015
|
if (updates.notifyEmail !== void 0) {
|
|
17925
18016
|
console.log(
|
|
17926
|
-
|
|
18017
|
+
chalk83.green(
|
|
17927
18018
|
`Email notifications ${result.notifyEmail ? "enabled" : "disabled"}`
|
|
17928
18019
|
)
|
|
17929
18020
|
);
|
|
17930
18021
|
}
|
|
17931
18022
|
if (updates.notifySlack !== void 0) {
|
|
17932
18023
|
console.log(
|
|
17933
|
-
|
|
18024
|
+
chalk83.green(
|
|
17934
18025
|
`Slack notifications ${result.notifySlack ? "enabled" : "disabled"}`
|
|
17935
18026
|
)
|
|
17936
18027
|
);
|
|
@@ -17939,7 +18030,7 @@ function printUpdateResult(updates, result) {
|
|
|
17939
18030
|
async function interactiveSetup(prefs) {
|
|
17940
18031
|
if (!prefs.timezone) {
|
|
17941
18032
|
const detectedTz = detectTimezone2();
|
|
17942
|
-
console.log(
|
|
18033
|
+
console.log(chalk83.dim(`
|
|
17943
18034
|
System timezone detected: ${detectedTz}`));
|
|
17944
18035
|
const tz = await promptText(
|
|
17945
18036
|
"Set timezone? (enter timezone or leave empty to skip)",
|
|
@@ -17950,7 +18041,7 @@ System timezone detected: ${detectedTz}`));
|
|
|
17950
18041
|
throw new Error(`Invalid timezone: ${tz.trim()}`);
|
|
17951
18042
|
}
|
|
17952
18043
|
await updateUserPreferences({ timezone: tz.trim() });
|
|
17953
|
-
console.log(
|
|
18044
|
+
console.log(chalk83.green(`Timezone set to ${chalk83.cyan(tz.trim())}`));
|
|
17954
18045
|
}
|
|
17955
18046
|
}
|
|
17956
18047
|
if (!prefs.notifyEmail) {
|
|
@@ -17960,7 +18051,7 @@ System timezone detected: ${detectedTz}`));
|
|
|
17960
18051
|
);
|
|
17961
18052
|
if (enable) {
|
|
17962
18053
|
await updateUserPreferences({ notifyEmail: true });
|
|
17963
|
-
console.log(
|
|
18054
|
+
console.log(chalk83.green("Email notifications enabled"));
|
|
17964
18055
|
}
|
|
17965
18056
|
}
|
|
17966
18057
|
}
|
|
@@ -17979,10 +18070,10 @@ var preferenceCommand = new Command89().name("preference").description("View or
|
|
|
17979
18070
|
} else if (!prefs.timezone) {
|
|
17980
18071
|
console.log();
|
|
17981
18072
|
console.log(
|
|
17982
|
-
`To set timezone: ${
|
|
18073
|
+
`To set timezone: ${chalk83.cyan("vm0 preference --timezone <timezone>")}`
|
|
17983
18074
|
);
|
|
17984
18075
|
console.log(
|
|
17985
|
-
|
|
18076
|
+
chalk83.dim("Example: vm0 preference --timezone America/New_York")
|
|
17986
18077
|
);
|
|
17987
18078
|
}
|
|
17988
18079
|
})
|
|
@@ -17990,7 +18081,7 @@ var preferenceCommand = new Command89().name("preference").description("View or
|
|
|
17990
18081
|
|
|
17991
18082
|
// src/commands/upgrade/index.ts
|
|
17992
18083
|
import { Command as Command90 } from "commander";
|
|
17993
|
-
import
|
|
18084
|
+
import chalk84 from "chalk";
|
|
17994
18085
|
var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CLI to the latest version").action(
|
|
17995
18086
|
withErrorHandler(async () => {
|
|
17996
18087
|
console.log("Checking for updates...");
|
|
@@ -17998,13 +18089,13 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
17998
18089
|
if (latestVersion === null) {
|
|
17999
18090
|
throw new Error("Could not check for updates. Please try again later.");
|
|
18000
18091
|
}
|
|
18001
|
-
if (latestVersion === "9.
|
|
18002
|
-
console.log(
|
|
18092
|
+
if (latestVersion === "9.59.0") {
|
|
18093
|
+
console.log(chalk84.green(`\u2713 Already up to date (${"9.59.0"})`));
|
|
18003
18094
|
return;
|
|
18004
18095
|
}
|
|
18005
18096
|
console.log(
|
|
18006
|
-
|
|
18007
|
-
`Current version: ${"9.
|
|
18097
|
+
chalk84.yellow(
|
|
18098
|
+
`Current version: ${"9.59.0"} -> Latest version: ${latestVersion}`
|
|
18008
18099
|
)
|
|
18009
18100
|
);
|
|
18010
18101
|
console.log();
|
|
@@ -18012,26 +18103,26 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
18012
18103
|
if (!isAutoUpgradeSupported(packageManager)) {
|
|
18013
18104
|
if (packageManager === "unknown") {
|
|
18014
18105
|
console.log(
|
|
18015
|
-
|
|
18106
|
+
chalk84.yellow(
|
|
18016
18107
|
"Could not detect your package manager for auto-upgrade."
|
|
18017
18108
|
)
|
|
18018
18109
|
);
|
|
18019
18110
|
} else {
|
|
18020
18111
|
console.log(
|
|
18021
|
-
|
|
18112
|
+
chalk84.yellow(
|
|
18022
18113
|
`Auto-upgrade is not supported for ${packageManager}.`
|
|
18023
18114
|
)
|
|
18024
18115
|
);
|
|
18025
18116
|
}
|
|
18026
|
-
console.log(
|
|
18027
|
-
console.log(
|
|
18117
|
+
console.log(chalk84.yellow("Please upgrade manually:"));
|
|
18118
|
+
console.log(chalk84.cyan(` ${getManualUpgradeCommand(packageManager)}`));
|
|
18028
18119
|
return;
|
|
18029
18120
|
}
|
|
18030
18121
|
console.log(`Upgrading via ${packageManager}...`);
|
|
18031
18122
|
const success = await performUpgrade(packageManager);
|
|
18032
18123
|
if (success) {
|
|
18033
18124
|
console.log(
|
|
18034
|
-
|
|
18125
|
+
chalk84.green(`\u2713 Upgraded from ${"9.59.0"} to ${latestVersion}`)
|
|
18035
18126
|
);
|
|
18036
18127
|
return;
|
|
18037
18128
|
}
|
|
@@ -18045,7 +18136,7 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
18045
18136
|
|
|
18046
18137
|
// src/index.ts
|
|
18047
18138
|
var program = new Command91();
|
|
18048
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
18139
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.59.0");
|
|
18049
18140
|
program.addCommand(authCommand);
|
|
18050
18141
|
program.addCommand(infoCommand);
|
|
18051
18142
|
program.addCommand(composeCommand);
|