@vm0/cli 9.58.1 → 9.59.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +714 -617
- 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.1",
|
|
49
49
|
sendDefaultPii: false,
|
|
50
50
|
tracesSampleRate: 0,
|
|
51
51
|
shutdownTimeout: 500,
|
|
@@ -64,7 +64,7 @@ if (DSN) {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
Sentry.setContext("cli", {
|
|
67
|
-
version: "9.
|
|
67
|
+
version: "9.59.1",
|
|
68
68
|
command: process.argv.slice(2).join(" ")
|
|
69
69
|
});
|
|
70
70
|
Sentry.setContext("runtime", {
|
|
@@ -673,7 +673,7 @@ function getConfigPath() {
|
|
|
673
673
|
return join2(homedir2(), ".vm0", "config.json");
|
|
674
674
|
}
|
|
675
675
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
676
|
-
console.log(chalk4.bold(`VM0 CLI v${"9.
|
|
676
|
+
console.log(chalk4.bold(`VM0 CLI v${"9.59.1"}`));
|
|
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
|
);
|
|
@@ -9302,7 +9393,7 @@ async function uploadAssets(agentName, agent, basePath, jsonMode) {
|
|
|
9302
9393
|
}
|
|
9303
9394
|
return skillResults;
|
|
9304
9395
|
}
|
|
9305
|
-
async function collectSkillVariables(skillResults, environment, agentName) {
|
|
9396
|
+
async function collectSkillVariables(skillResults, environment, agentName, options) {
|
|
9306
9397
|
const skillSecrets = /* @__PURE__ */ new Map();
|
|
9307
9398
|
const skillVars = /* @__PURE__ */ new Map();
|
|
9308
9399
|
for (const result of skillResults) {
|
|
@@ -9330,12 +9421,15 @@ async function collectSkillVariables(skillResults, environment, agentName) {
|
|
|
9330
9421
|
const newVars = [...skillVars.entries()].filter(
|
|
9331
9422
|
([name]) => !(name in environment)
|
|
9332
9423
|
);
|
|
9333
|
-
let
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9424
|
+
let trulyNewSecrets = [];
|
|
9425
|
+
if (!options.json) {
|
|
9426
|
+
let headSecrets = /* @__PURE__ */ new Set();
|
|
9427
|
+
const existingCompose = await getComposeByName(agentName);
|
|
9428
|
+
if (existingCompose?.content) {
|
|
9429
|
+
headSecrets = getSecretsFromComposeContent(existingCompose.content);
|
|
9430
|
+
}
|
|
9431
|
+
trulyNewSecrets = newSecrets.map(([name]) => name).filter((name) => !headSecrets.has(name));
|
|
9337
9432
|
}
|
|
9338
|
-
const trulyNewSecrets = newSecrets.map(([name]) => name).filter((name) => !headSecrets.has(name));
|
|
9339
9433
|
return { newSecrets, newVars, trulyNewSecrets };
|
|
9340
9434
|
}
|
|
9341
9435
|
async function displayAndConfirmVariables(variables, options) {
|
|
@@ -9346,21 +9440,21 @@ async function displayAndConfirmVariables(variables, options) {
|
|
|
9346
9440
|
if (!options.json) {
|
|
9347
9441
|
console.log();
|
|
9348
9442
|
console.log(
|
|
9349
|
-
|
|
9443
|
+
chalk6.bold("Skills require the following environment variables:")
|
|
9350
9444
|
);
|
|
9351
9445
|
console.log();
|
|
9352
9446
|
if (newSecrets.length > 0) {
|
|
9353
|
-
console.log(
|
|
9447
|
+
console.log(chalk6.cyan(" Secrets:"));
|
|
9354
9448
|
for (const [name, skills] of newSecrets) {
|
|
9355
9449
|
const isNew = trulyNewSecrets.includes(name);
|
|
9356
|
-
const newMarker = isNew ?
|
|
9450
|
+
const newMarker = isNew ? chalk6.yellow(" (new)") : "";
|
|
9357
9451
|
console.log(
|
|
9358
9452
|
` ${name.padEnd(24)}${newMarker} <- ${skills.join(", ")}`
|
|
9359
9453
|
);
|
|
9360
9454
|
}
|
|
9361
9455
|
}
|
|
9362
9456
|
if (newVars.length > 0) {
|
|
9363
|
-
console.log(
|
|
9457
|
+
console.log(chalk6.cyan(" Vars:"));
|
|
9364
9458
|
for (const [name, skills] of newVars) {
|
|
9365
9459
|
console.log(` ${name.padEnd(24)} <- ${skills.join(", ")}`);
|
|
9366
9460
|
}
|
|
@@ -9381,7 +9475,7 @@ async function displayAndConfirmVariables(variables, options) {
|
|
|
9381
9475
|
);
|
|
9382
9476
|
if (!confirmed) {
|
|
9383
9477
|
if (!options.json) {
|
|
9384
|
-
console.log(
|
|
9478
|
+
console.log(chalk6.yellow("Compose cancelled"));
|
|
9385
9479
|
}
|
|
9386
9480
|
return false;
|
|
9387
9481
|
}
|
|
@@ -9634,11 +9728,11 @@ async function checkAndPromptMissingItems(config, options) {
|
|
|
9634
9728
|
if (!options.json) {
|
|
9635
9729
|
console.log();
|
|
9636
9730
|
console.log(
|
|
9637
|
-
|
|
9731
|
+
chalk6.yellow(
|
|
9638
9732
|
"\u26A0 Missing secrets/variables detected. Set them up before running your agent:"
|
|
9639
9733
|
)
|
|
9640
9734
|
);
|
|
9641
|
-
console.log(
|
|
9735
|
+
console.log(chalk6.cyan(` ${setupUrl}`));
|
|
9642
9736
|
console.log();
|
|
9643
9737
|
}
|
|
9644
9738
|
return { missingSecrets, missingVars, setupUrl };
|
|
@@ -9654,9 +9748,8 @@ async function finalizeCompose(config, agent, variables, options) {
|
|
|
9654
9748
|
console.log("Uploading compose...");
|
|
9655
9749
|
}
|
|
9656
9750
|
const response = await createOrUpdateCompose({ content: config });
|
|
9657
|
-
const orgResponse = await getOrg();
|
|
9658
9751
|
const shortVersionId = response.versionId.slice(0, 8);
|
|
9659
|
-
const displayName = `${
|
|
9752
|
+
const displayName = options.json ? response.name : `${(await getOrg()).slug}/${response.name}`;
|
|
9660
9753
|
const result = {
|
|
9661
9754
|
composeId: response.composeId,
|
|
9662
9755
|
composeName: response.name,
|
|
@@ -9664,23 +9757,25 @@ async function finalizeCompose(config, agent, variables, options) {
|
|
|
9664
9757
|
action: response.action,
|
|
9665
9758
|
displayName
|
|
9666
9759
|
};
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
|
|
9670
|
-
|
|
9671
|
-
|
|
9760
|
+
if (!options.json) {
|
|
9761
|
+
const missingItems = await checkAndPromptMissingItems(config, options);
|
|
9762
|
+
if (missingItems.missingSecrets.length > 0 || missingItems.missingVars.length > 0) {
|
|
9763
|
+
result.missingSecrets = missingItems.missingSecrets;
|
|
9764
|
+
result.missingVars = missingItems.missingVars;
|
|
9765
|
+
result.setupUrl = missingItems.setupUrl;
|
|
9766
|
+
}
|
|
9672
9767
|
}
|
|
9673
9768
|
if (!options.json) {
|
|
9674
9769
|
if (response.action === "created") {
|
|
9675
|
-
console.log(
|
|
9770
|
+
console.log(chalk6.green(`\u2713 Compose created: ${displayName}`));
|
|
9676
9771
|
} else {
|
|
9677
|
-
console.log(
|
|
9772
|
+
console.log(chalk6.green(`\u2713 Compose version exists: ${displayName}`));
|
|
9678
9773
|
}
|
|
9679
|
-
console.log(
|
|
9774
|
+
console.log(chalk6.dim(` Version: ${shortVersionId}`));
|
|
9680
9775
|
console.log();
|
|
9681
9776
|
console.log(" Run your agent:");
|
|
9682
9777
|
console.log(
|
|
9683
|
-
|
|
9778
|
+
chalk6.cyan(
|
|
9684
9779
|
` vm0 run ${displayName}:${shortVersionId} --artifact-name <artifact> "your prompt"`
|
|
9685
9780
|
)
|
|
9686
9781
|
);
|
|
@@ -9708,7 +9803,7 @@ async function handleGitHubCompose(url, options) {
|
|
|
9708
9803
|
if (!options.json) {
|
|
9709
9804
|
console.log();
|
|
9710
9805
|
console.log(
|
|
9711
|
-
|
|
9806
|
+
chalk6.yellow(`\u26A0 An agent named "${agentName}" already exists.`)
|
|
9712
9807
|
);
|
|
9713
9808
|
}
|
|
9714
9809
|
if (!isInteractive()) {
|
|
@@ -9729,7 +9824,7 @@ async function handleGitHubCompose(url, options) {
|
|
|
9729
9824
|
);
|
|
9730
9825
|
if (!confirmed) {
|
|
9731
9826
|
if (!options.json) {
|
|
9732
|
-
console.log(
|
|
9827
|
+
console.log(chalk6.yellow("Compose cancelled."));
|
|
9733
9828
|
}
|
|
9734
9829
|
process.exit(0);
|
|
9735
9830
|
}
|
|
@@ -9755,7 +9850,8 @@ async function handleGitHubCompose(url, options) {
|
|
|
9755
9850
|
const variables = await collectSkillVariables(
|
|
9756
9851
|
skillResults,
|
|
9757
9852
|
environment,
|
|
9758
|
-
agentName
|
|
9853
|
+
agentName,
|
|
9854
|
+
options
|
|
9759
9855
|
);
|
|
9760
9856
|
return await finalizeCompose(config, agent, variables, options);
|
|
9761
9857
|
} finally {
|
|
@@ -9778,7 +9874,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9778
9874
|
const resolvedConfigFile = configFile ?? DEFAULT_CONFIG_FILE;
|
|
9779
9875
|
if (options.porcelain && !options.json) {
|
|
9780
9876
|
console.error(
|
|
9781
|
-
|
|
9877
|
+
chalk6.yellow("\u26A0 --porcelain is deprecated, use --json instead")
|
|
9782
9878
|
);
|
|
9783
9879
|
options.json = true;
|
|
9784
9880
|
}
|
|
@@ -9787,7 +9883,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9787
9883
|
options.autoUpdate = false;
|
|
9788
9884
|
}
|
|
9789
9885
|
if (options.autoUpdate !== false) {
|
|
9790
|
-
await startSilentUpgrade("9.
|
|
9886
|
+
await startSilentUpgrade("9.59.1");
|
|
9791
9887
|
}
|
|
9792
9888
|
try {
|
|
9793
9889
|
let result;
|
|
@@ -9808,7 +9904,8 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9808
9904
|
const variables = await collectSkillVariables(
|
|
9809
9905
|
skillResults,
|
|
9810
9906
|
environment,
|
|
9811
|
-
agentName
|
|
9907
|
+
agentName,
|
|
9908
|
+
options
|
|
9812
9909
|
);
|
|
9813
9910
|
result = await finalizeCompose(config, agent, variables, options);
|
|
9814
9911
|
}
|
|
@@ -9831,7 +9928,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9831
9928
|
import { Command as Command8, Option as Option2 } from "commander";
|
|
9832
9929
|
|
|
9833
9930
|
// src/commands/run/shared.ts
|
|
9834
|
-
import
|
|
9931
|
+
import chalk10 from "chalk";
|
|
9835
9932
|
import * as fs6 from "fs";
|
|
9836
9933
|
import { config as dotenvConfig } from "dotenv";
|
|
9837
9934
|
|
|
@@ -10119,9 +10216,9 @@ var CodexEventParser = class {
|
|
|
10119
10216
|
if (!item.changes || item.changes.length === 0) {
|
|
10120
10217
|
return null;
|
|
10121
10218
|
}
|
|
10122
|
-
const changes = item.changes.map((
|
|
10123
|
-
const action =
|
|
10124
|
-
return `${action}: ${
|
|
10219
|
+
const changes = item.changes.map((c24) => {
|
|
10220
|
+
const action = c24.kind === "add" ? "Created" : c24.kind === "modify" ? "Modified" : "Deleted";
|
|
10221
|
+
return `${action}: ${c24.path}`;
|
|
10125
10222
|
}).join("\n");
|
|
10126
10223
|
return {
|
|
10127
10224
|
type: "text",
|
|
@@ -10173,10 +10270,10 @@ function parseEvent(rawEvent, framework) {
|
|
|
10173
10270
|
}
|
|
10174
10271
|
|
|
10175
10272
|
// src/lib/events/event-renderer.ts
|
|
10176
|
-
import
|
|
10273
|
+
import chalk8 from "chalk";
|
|
10177
10274
|
|
|
10178
10275
|
// src/lib/events/tool-formatters.ts
|
|
10179
|
-
import
|
|
10276
|
+
import chalk7 from "chalk";
|
|
10180
10277
|
function pluralize(count, singular, plural) {
|
|
10181
10278
|
return count === 1 ? singular : plural;
|
|
10182
10279
|
}
|
|
@@ -10190,15 +10287,15 @@ function formatToolHeader(data) {
|
|
|
10190
10287
|
return [headline];
|
|
10191
10288
|
}
|
|
10192
10289
|
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${
|
|
10290
|
+
Read: (input) => `Read${chalk7.dim(`(${String(input.file_path || "")})`)}`,
|
|
10291
|
+
Edit: (input) => `Edit${chalk7.dim(`(${String(input.file_path || "")})`)}`,
|
|
10292
|
+
Write: (input) => `Write${chalk7.dim(`(${String(input.file_path || "")})`)}`,
|
|
10293
|
+
Bash: (input) => `Bash${chalk7.dim(`(${truncate(String(input.command || ""), 60)})`)}`,
|
|
10294
|
+
Glob: (input) => `Glob${chalk7.dim(`(${String(input.pattern || "")})`)}`,
|
|
10295
|
+
Grep: (input) => `Grep${chalk7.dim(`(${String(input.pattern || "")})`)}`,
|
|
10296
|
+
Task: (input) => `Task${chalk7.dim(`(${truncate(String(input.description || ""), 60)})`)}`,
|
|
10297
|
+
WebFetch: (input) => `WebFetch${chalk7.dim(`(${truncate(String(input.url || ""), 60)})`)}`,
|
|
10298
|
+
WebSearch: (input) => `WebSearch${chalk7.dim(`(${truncate(String(input.query || ""), 60)})`)}`,
|
|
10202
10299
|
TodoWrite: () => "TodoWrite"
|
|
10203
10300
|
};
|
|
10204
10301
|
function getToolHeadline(tool, input) {
|
|
@@ -10231,7 +10328,7 @@ function formatToolResult(toolUse, result, verbose) {
|
|
|
10231
10328
|
}
|
|
10232
10329
|
if (isError) {
|
|
10233
10330
|
const errorMsg = resultText ? truncate(resultText, 80) : "Error";
|
|
10234
|
-
lines.push(`\u2514 \u2717 ${
|
|
10331
|
+
lines.push(`\u2514 \u2717 ${chalk7.dim(errorMsg)}`);
|
|
10235
10332
|
return lines;
|
|
10236
10333
|
}
|
|
10237
10334
|
if (resultText) {
|
|
@@ -10239,23 +10336,23 @@ function formatToolResult(toolUse, result, verbose) {
|
|
|
10239
10336
|
if (verbose) {
|
|
10240
10337
|
for (let i = 0; i < resultLines.length; i++) {
|
|
10241
10338
|
const prefix = i === 0 ? "\u2514 " : " ";
|
|
10242
|
-
lines.push(`${prefix}${
|
|
10339
|
+
lines.push(`${prefix}${chalk7.dim(resultLines[i])}`);
|
|
10243
10340
|
}
|
|
10244
10341
|
} else if (resultLines.length > 0) {
|
|
10245
10342
|
const previewCount = Math.min(3, resultLines.length);
|
|
10246
10343
|
for (let i = 0; i < previewCount; i++) {
|
|
10247
10344
|
const prefix = i === 0 ? "\u2514 " : " ";
|
|
10248
|
-
lines.push(`${prefix}${
|
|
10345
|
+
lines.push(`${prefix}${chalk7.dim(resultLines[i])}`);
|
|
10249
10346
|
}
|
|
10250
10347
|
const remaining = resultLines.length - previewCount;
|
|
10251
10348
|
if (remaining > 0) {
|
|
10252
10349
|
lines.push(
|
|
10253
|
-
` ${
|
|
10350
|
+
` ${chalk7.dim(`\u2026 +${remaining} ${pluralize(remaining, "line", "lines")} (vm0 logs <runId> to see all)`)}`
|
|
10254
10351
|
);
|
|
10255
10352
|
}
|
|
10256
10353
|
}
|
|
10257
10354
|
} else {
|
|
10258
|
-
lines.push(`\u2514 \u2713 ${
|
|
10355
|
+
lines.push(`\u2514 \u2713 ${chalk7.dim("Done")}`);
|
|
10259
10356
|
}
|
|
10260
10357
|
return lines;
|
|
10261
10358
|
}
|
|
@@ -10273,24 +10370,24 @@ function formatReadContent(resultText, verbose) {
|
|
|
10273
10370
|
const displayLines = contentLines.length > 0 ? contentLines : rawLines.filter((line) => line.trim().length > 0);
|
|
10274
10371
|
const totalLines = displayLines.length;
|
|
10275
10372
|
if (totalLines === 0) {
|
|
10276
|
-
lines.push(`\u2514 \u2713 ${
|
|
10373
|
+
lines.push(`\u2514 \u2713 ${chalk7.dim("(empty)")}`);
|
|
10277
10374
|
return lines;
|
|
10278
10375
|
}
|
|
10279
10376
|
if (verbose) {
|
|
10280
10377
|
for (let i = 0; i < displayLines.length; i++) {
|
|
10281
10378
|
const prefix = i === 0 ? "\u2514 " : " ";
|
|
10282
|
-
lines.push(`${prefix}${
|
|
10379
|
+
lines.push(`${prefix}${chalk7.dim(displayLines[i] ?? "")}`);
|
|
10283
10380
|
}
|
|
10284
10381
|
} else {
|
|
10285
10382
|
const previewCount = Math.min(3, totalLines);
|
|
10286
10383
|
for (let i = 0; i < previewCount; i++) {
|
|
10287
10384
|
const prefix = i === 0 ? "\u2514 " : " ";
|
|
10288
|
-
lines.push(`${prefix}${
|
|
10385
|
+
lines.push(`${prefix}${chalk7.dim(displayLines[i] ?? "")}`);
|
|
10289
10386
|
}
|
|
10290
10387
|
const remaining = totalLines - previewCount;
|
|
10291
10388
|
if (remaining > 0) {
|
|
10292
10389
|
lines.push(
|
|
10293
|
-
` ${
|
|
10390
|
+
` ${chalk7.dim(`\u2026 +${remaining} ${pluralize(remaining, "line", "lines")} (vm0 logs <runId> to see all)`)}`
|
|
10294
10391
|
);
|
|
10295
10392
|
}
|
|
10296
10393
|
}
|
|
@@ -10304,18 +10401,18 @@ function formatWritePreview(input, verbose) {
|
|
|
10304
10401
|
if (verbose) {
|
|
10305
10402
|
for (let i = 0; i < contentLines.length; i++) {
|
|
10306
10403
|
const prefix = i === 0 ? "\u23BF " : " ";
|
|
10307
|
-
lines.push(`${prefix}${
|
|
10404
|
+
lines.push(`${prefix}${chalk7.dim(contentLines[i] ?? "")}`);
|
|
10308
10405
|
}
|
|
10309
10406
|
} else {
|
|
10310
10407
|
const previewCount = Math.min(3, totalLines);
|
|
10311
10408
|
for (let i = 0; i < previewCount; i++) {
|
|
10312
10409
|
const prefix = i === 0 ? "\u23BF " : " ";
|
|
10313
|
-
lines.push(`${prefix}${
|
|
10410
|
+
lines.push(`${prefix}${chalk7.dim(contentLines[i] ?? "")}`);
|
|
10314
10411
|
}
|
|
10315
10412
|
const remaining = totalLines - previewCount;
|
|
10316
10413
|
if (remaining > 0) {
|
|
10317
10414
|
lines.push(
|
|
10318
|
-
` ${
|
|
10415
|
+
` ${chalk7.dim(`\u2026 +${remaining} ${pluralize(remaining, "line", "lines")} (vm0 logs <runId> to see all)`)}`
|
|
10319
10416
|
);
|
|
10320
10417
|
}
|
|
10321
10418
|
}
|
|
@@ -10330,34 +10427,34 @@ function formatEditDiff(input, verbose) {
|
|
|
10330
10427
|
const removed = oldLines.length;
|
|
10331
10428
|
const added = newLines.length;
|
|
10332
10429
|
const summary = `Added ${added} ${pluralize(added, "line", "lines")}, removed ${removed} ${pluralize(removed, "line", "lines")}`;
|
|
10333
|
-
lines.push(`\u23BF ${
|
|
10430
|
+
lines.push(`\u23BF ${chalk7.dim(summary)}`);
|
|
10334
10431
|
if (verbose) {
|
|
10335
10432
|
for (const line of oldLines) {
|
|
10336
|
-
lines.push(` - ${
|
|
10433
|
+
lines.push(` - ${chalk7.dim(line)}`);
|
|
10337
10434
|
}
|
|
10338
10435
|
for (const line of newLines) {
|
|
10339
|
-
lines.push(` + ${
|
|
10436
|
+
lines.push(` + ${chalk7.dim(line)}`);
|
|
10340
10437
|
}
|
|
10341
10438
|
} else {
|
|
10342
10439
|
const previewLimit = 3;
|
|
10343
10440
|
const showOld = Math.min(previewLimit, oldLines.length);
|
|
10344
10441
|
const showNew = Math.min(previewLimit, newLines.length);
|
|
10345
10442
|
for (let i = 0; i < showOld; i++) {
|
|
10346
|
-
lines.push(` - ${
|
|
10443
|
+
lines.push(` - ${chalk7.dim(truncate(oldLines[i] ?? "", 60))}`);
|
|
10347
10444
|
}
|
|
10348
10445
|
const remainingOld = oldLines.length - previewLimit;
|
|
10349
10446
|
if (remainingOld > 0) {
|
|
10350
10447
|
lines.push(
|
|
10351
|
-
` ${
|
|
10448
|
+
` ${chalk7.dim(`\u2026 +${remainingOld} ${pluralize(remainingOld, "line", "lines")} (vm0 logs <runId> to see all)`)}`
|
|
10352
10449
|
);
|
|
10353
10450
|
}
|
|
10354
10451
|
for (let i = 0; i < showNew; i++) {
|
|
10355
|
-
lines.push(` + ${
|
|
10452
|
+
lines.push(` + ${chalk7.dim(truncate(newLines[i] ?? "", 60))}`);
|
|
10356
10453
|
}
|
|
10357
10454
|
const remainingNew = newLines.length - previewLimit;
|
|
10358
10455
|
if (remainingNew > 0) {
|
|
10359
10456
|
lines.push(
|
|
10360
|
-
` ${
|
|
10457
|
+
` ${chalk7.dim(`\u2026 +${remainingNew} ${pluralize(remainingNew, "line", "lines")} (vm0 logs <runId> to see all)`)}`
|
|
10361
10458
|
);
|
|
10362
10459
|
}
|
|
10363
10460
|
}
|
|
@@ -10395,12 +10492,12 @@ function getTodoStatusIcon(status) {
|
|
|
10395
10492
|
function formatTodoContent(content, status) {
|
|
10396
10493
|
switch (status) {
|
|
10397
10494
|
case "completed":
|
|
10398
|
-
return
|
|
10495
|
+
return chalk7.dim.strikethrough(content);
|
|
10399
10496
|
case "in_progress":
|
|
10400
10497
|
return content;
|
|
10401
10498
|
case "pending":
|
|
10402
10499
|
default:
|
|
10403
|
-
return
|
|
10500
|
+
return chalk7.dim(content);
|
|
10404
10501
|
}
|
|
10405
10502
|
}
|
|
10406
10503
|
|
|
@@ -10418,12 +10515,12 @@ var EventRenderer = class _EventRenderer {
|
|
|
10418
10515
|
* Called immediately after run is created, before polling events
|
|
10419
10516
|
*/
|
|
10420
10517
|
static renderRunStarted(info) {
|
|
10421
|
-
console.log(
|
|
10422
|
-
console.log(` Run ID: ${
|
|
10518
|
+
console.log(chalk8.bold("\u25B6 Run started"));
|
|
10519
|
+
console.log(` Run ID: ${chalk8.dim(info.runId)}`);
|
|
10423
10520
|
if (info.sandboxId) {
|
|
10424
|
-
console.log(` Sandbox: ${
|
|
10521
|
+
console.log(` Sandbox: ${chalk8.dim(info.sandboxId)}`);
|
|
10425
10522
|
}
|
|
10426
|
-
console.log(
|
|
10523
|
+
console.log(chalk8.dim(` (use "vm0 logs ${info.runId}" to view logs)`));
|
|
10427
10524
|
console.log();
|
|
10428
10525
|
}
|
|
10429
10526
|
/**
|
|
@@ -10461,16 +10558,16 @@ var EventRenderer = class _EventRenderer {
|
|
|
10461
10558
|
*/
|
|
10462
10559
|
static renderRunCompleted(result) {
|
|
10463
10560
|
console.log("");
|
|
10464
|
-
console.log(
|
|
10561
|
+
console.log(chalk8.green("\u2713 Run completed successfully"));
|
|
10465
10562
|
if (result) {
|
|
10466
|
-
console.log(` Checkpoint: ${
|
|
10467
|
-
console.log(` Session: ${
|
|
10468
|
-
console.log(` Conversation: ${
|
|
10563
|
+
console.log(` Checkpoint: ${chalk8.dim(result.checkpointId)}`);
|
|
10564
|
+
console.log(` Session: ${chalk8.dim(result.agentSessionId)}`);
|
|
10565
|
+
console.log(` Conversation: ${chalk8.dim(result.conversationId)}`);
|
|
10469
10566
|
if (result.artifact && Object.keys(result.artifact).length > 0) {
|
|
10470
10567
|
console.log(` Artifact:`);
|
|
10471
10568
|
for (const [name, version] of Object.entries(result.artifact)) {
|
|
10472
10569
|
console.log(
|
|
10473
|
-
` ${name}: ${
|
|
10570
|
+
` ${name}: ${chalk8.dim(_EventRenderer.formatVersion(version))}`
|
|
10474
10571
|
);
|
|
10475
10572
|
}
|
|
10476
10573
|
}
|
|
@@ -10478,7 +10575,7 @@ var EventRenderer = class _EventRenderer {
|
|
|
10478
10575
|
console.log(` Volumes:`);
|
|
10479
10576
|
for (const [name, version] of Object.entries(result.volumes)) {
|
|
10480
10577
|
console.log(
|
|
10481
|
-
` ${name}: ${
|
|
10578
|
+
` ${name}: ${chalk8.dim(_EventRenderer.formatVersion(version))}`
|
|
10482
10579
|
);
|
|
10483
10580
|
}
|
|
10484
10581
|
}
|
|
@@ -10490,10 +10587,10 @@ var EventRenderer = class _EventRenderer {
|
|
|
10490
10587
|
*/
|
|
10491
10588
|
static renderRunFailed(error, runId) {
|
|
10492
10589
|
console.error("");
|
|
10493
|
-
console.error(
|
|
10494
|
-
console.error(` Error: ${
|
|
10590
|
+
console.error(chalk8.red("\u2717 Run failed"));
|
|
10591
|
+
console.error(` Error: ${chalk8.red(error || "Unknown error")}`);
|
|
10495
10592
|
console.error(
|
|
10496
|
-
|
|
10593
|
+
chalk8.dim(` (use "vm0 logs ${runId} --system" to view system logs)`)
|
|
10497
10594
|
);
|
|
10498
10595
|
}
|
|
10499
10596
|
/**
|
|
@@ -10577,13 +10674,13 @@ var EventRenderer = class _EventRenderer {
|
|
|
10577
10674
|
const frameworkStr = String(event.data.framework || "claude-code");
|
|
10578
10675
|
const displayName = isSupportedFramework(frameworkStr) ? getFrameworkDisplayName(frameworkStr) : frameworkStr;
|
|
10579
10676
|
this.frameworkDisplayName = displayName;
|
|
10580
|
-
console.log(prefix +
|
|
10581
|
-
console.log(` Session: ${
|
|
10677
|
+
console.log(prefix + chalk8.bold(`\u25B7 ${displayName} Started`));
|
|
10678
|
+
console.log(` Session: ${chalk8.dim(String(event.data.sessionId || ""))}`);
|
|
10582
10679
|
if (event.data.model) {
|
|
10583
|
-
console.log(` Model: ${
|
|
10680
|
+
console.log(` Model: ${chalk8.dim(String(event.data.model))}`);
|
|
10584
10681
|
}
|
|
10585
10682
|
console.log(
|
|
10586
|
-
` Tools: ${
|
|
10683
|
+
` Tools: ${chalk8.dim(
|
|
10587
10684
|
Array.isArray(event.data.tools) ? event.data.tools.join(", ") : String(event.data.tools || "")
|
|
10588
10685
|
)}`
|
|
10589
10686
|
);
|
|
@@ -10600,16 +10697,16 @@ var EventRenderer = class _EventRenderer {
|
|
|
10600
10697
|
const success = Boolean(event.data.success);
|
|
10601
10698
|
if (success) {
|
|
10602
10699
|
console.log(
|
|
10603
|
-
prefix +
|
|
10700
|
+
prefix + chalk8.bold(`\u25C6 ${this.frameworkDisplayName} Completed`)
|
|
10604
10701
|
);
|
|
10605
10702
|
} else {
|
|
10606
|
-
console.log(prefix +
|
|
10703
|
+
console.log(prefix + chalk8.bold(`\u25C6 ${this.frameworkDisplayName} Failed`));
|
|
10607
10704
|
}
|
|
10608
10705
|
const durationMs = Number(event.data.durationMs || 0);
|
|
10609
10706
|
const durationSec = (durationMs / 1e3).toFixed(1);
|
|
10610
|
-
console.log(` Duration: ${
|
|
10707
|
+
console.log(` Duration: ${chalk8.dim(durationSec + "s")}`);
|
|
10611
10708
|
const numTurns = Number(event.data.numTurns || 0);
|
|
10612
|
-
console.log(` Turns: ${
|
|
10709
|
+
console.log(` Turns: ${chalk8.dim(String(numTurns))}`);
|
|
10613
10710
|
const usage = event.data.usage;
|
|
10614
10711
|
if (usage && typeof usage === "object") {
|
|
10615
10712
|
const inputTokens = Number(usage.input_tokens || 0);
|
|
@@ -10621,7 +10718,7 @@ var EventRenderer = class _EventRenderer {
|
|
|
10621
10718
|
return String(count);
|
|
10622
10719
|
};
|
|
10623
10720
|
console.log(
|
|
10624
|
-
` Tokens: ${
|
|
10721
|
+
` Tokens: ${chalk8.dim(
|
|
10625
10722
|
`input=${formatTokens(inputTokens)} output=${formatTokens(outputTokens)}`
|
|
10626
10723
|
)}`
|
|
10627
10724
|
);
|
|
@@ -10640,7 +10737,7 @@ var EventRenderer = class _EventRenderer {
|
|
|
10640
10737
|
};
|
|
10641
10738
|
|
|
10642
10739
|
// src/lib/events/codex-event-renderer.ts
|
|
10643
|
-
import
|
|
10740
|
+
import chalk9 from "chalk";
|
|
10644
10741
|
var CodexEventRenderer = class {
|
|
10645
10742
|
/**
|
|
10646
10743
|
* Check if an event is a Codex event
|
|
@@ -10687,13 +10784,13 @@ var CodexEventRenderer = class {
|
|
|
10687
10784
|
const cached = event.usage.cached_input_tokens || 0;
|
|
10688
10785
|
const cachedStr = cached ? ` (${cached} cached)` : "";
|
|
10689
10786
|
console.log(
|
|
10690
|
-
"[turn.completed]" +
|
|
10787
|
+
"[turn.completed]" + chalk9.dim(` ${input} in / ${output} out${cachedStr}`)
|
|
10691
10788
|
);
|
|
10692
10789
|
}
|
|
10693
10790
|
}
|
|
10694
10791
|
static renderTurnFailed(event) {
|
|
10695
10792
|
console.log(
|
|
10696
|
-
|
|
10793
|
+
chalk9.red("[turn.failed]") + (event.error ? ` ${event.error}` : "")
|
|
10697
10794
|
);
|
|
10698
10795
|
}
|
|
10699
10796
|
static renderItem(event) {
|
|
@@ -10722,25 +10819,25 @@ var CodexEventRenderer = class {
|
|
|
10722
10819
|
if (output) {
|
|
10723
10820
|
const lines = output.split("\n").filter((l) => l.trim());
|
|
10724
10821
|
const preview = lines.slice(0, 3).join("\n ");
|
|
10725
|
-
const more = lines.length > 3 ?
|
|
10822
|
+
const more = lines.length > 3 ? chalk9.dim(` ... (${lines.length - 3} more lines)`) : "";
|
|
10726
10823
|
console.log(
|
|
10727
|
-
"[output]" + (exitCode !== 0 ?
|
|
10824
|
+
"[output]" + (exitCode !== 0 ? chalk9.red(` exit=${exitCode}`) : "")
|
|
10728
10825
|
);
|
|
10729
10826
|
if (preview) {
|
|
10730
10827
|
console.log(" " + preview + more);
|
|
10731
10828
|
}
|
|
10732
10829
|
} else if (exitCode !== 0) {
|
|
10733
|
-
console.log(
|
|
10830
|
+
console.log(chalk9.red("[output]") + chalk9.red(` exit=${exitCode}`));
|
|
10734
10831
|
}
|
|
10735
10832
|
}
|
|
10736
10833
|
}
|
|
10737
10834
|
static renderFileChange(item) {
|
|
10738
10835
|
if (item.changes && item.changes.length > 0) {
|
|
10739
|
-
const summary = item.changes.map((
|
|
10740
|
-
const icon =
|
|
10741
|
-
return `${icon}${
|
|
10836
|
+
const summary = item.changes.map((c24) => {
|
|
10837
|
+
const icon = c24.kind === "add" ? "+" : c24.kind === "delete" ? "-" : "~";
|
|
10838
|
+
return `${icon}${c24.path}`;
|
|
10742
10839
|
}).join(", ");
|
|
10743
|
-
console.log(
|
|
10840
|
+
console.log(chalk9.green("[files]") + ` ${summary}`);
|
|
10744
10841
|
}
|
|
10745
10842
|
}
|
|
10746
10843
|
static renderFileOperation(item, eventType) {
|
|
@@ -10751,7 +10848,7 @@ var CodexEventRenderer = class {
|
|
|
10751
10848
|
}
|
|
10752
10849
|
static renderError(event) {
|
|
10753
10850
|
console.log(
|
|
10754
|
-
|
|
10851
|
+
chalk9.red("[error]") + ` ${event.message || event.error || "Unknown error"}`
|
|
10755
10852
|
);
|
|
10756
10853
|
}
|
|
10757
10854
|
};
|
|
@@ -10838,10 +10935,10 @@ function parseIdentifier(identifier) {
|
|
|
10838
10935
|
}
|
|
10839
10936
|
function renderRunCreated(response) {
|
|
10840
10937
|
if (response.status === "queued") {
|
|
10841
|
-
console.log(
|
|
10842
|
-
console.log(` Run ID: ${
|
|
10938
|
+
console.log(chalk10.yellow("\u26A0 Run queued \u2014 concurrency limit reached"));
|
|
10939
|
+
console.log(` Run ID: ${chalk10.dim(response.runId)}`);
|
|
10843
10940
|
console.log(
|
|
10844
|
-
|
|
10941
|
+
chalk10.dim(" Will start automatically when a slot is available")
|
|
10845
10942
|
);
|
|
10846
10943
|
console.log();
|
|
10847
10944
|
} else {
|
|
@@ -10889,9 +10986,9 @@ async function pollEvents(runId, options) {
|
|
|
10889
10986
|
result = { succeeded: false, runId };
|
|
10890
10987
|
} else if (runStatus === "timeout") {
|
|
10891
10988
|
complete = true;
|
|
10892
|
-
console.error(
|
|
10989
|
+
console.error(chalk10.red("\n\u2717 Run timed out"));
|
|
10893
10990
|
console.error(
|
|
10894
|
-
|
|
10991
|
+
chalk10.dim(` (use "vm0 logs ${runId} --system" to view system logs)`)
|
|
10895
10992
|
);
|
|
10896
10993
|
result = { succeeded: false, runId };
|
|
10897
10994
|
}
|
|
@@ -10905,11 +11002,11 @@ function showNextSteps(result) {
|
|
|
10905
11002
|
const { runId, sessionId, checkpointId } = result;
|
|
10906
11003
|
console.log();
|
|
10907
11004
|
console.log(" View agent logs:");
|
|
10908
|
-
console.log(
|
|
11005
|
+
console.log(chalk10.cyan(` vm0 logs ${runId}`));
|
|
10909
11006
|
if (sessionId) {
|
|
10910
11007
|
console.log(" Continue with session (latest conversation and artifact):");
|
|
10911
11008
|
console.log(
|
|
10912
|
-
|
|
11009
|
+
chalk10.cyan(` vm0 run continue ${sessionId} "your next prompt"`)
|
|
10913
11010
|
);
|
|
10914
11011
|
}
|
|
10915
11012
|
if (checkpointId) {
|
|
@@ -10917,7 +11014,7 @@ function showNextSteps(result) {
|
|
|
10917
11014
|
" Resume from checkpoint (snapshotted conversation and artifact):"
|
|
10918
11015
|
);
|
|
10919
11016
|
console.log(
|
|
10920
|
-
|
|
11017
|
+
chalk10.cyan(` vm0 run resume ${checkpointId} "your next prompt"`)
|
|
10921
11018
|
);
|
|
10922
11019
|
}
|
|
10923
11020
|
}
|
|
@@ -10960,7 +11057,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
10960
11057
|
withErrorHandler(
|
|
10961
11058
|
async (identifier, prompt, options) => {
|
|
10962
11059
|
if (options.autoUpdate !== false) {
|
|
10963
|
-
await startSilentUpgrade("9.
|
|
11060
|
+
await startSilentUpgrade("9.59.1");
|
|
10964
11061
|
}
|
|
10965
11062
|
const { org, name, version } = parseIdentifier(identifier);
|
|
10966
11063
|
if (org && !options.experimentalSharedAgent) {
|
|
@@ -11179,7 +11276,7 @@ var continueCommand = new Command10().name("continue").description(
|
|
|
11179
11276
|
|
|
11180
11277
|
// src/commands/run/list.ts
|
|
11181
11278
|
import { Command as Command11 } from "commander";
|
|
11182
|
-
import
|
|
11279
|
+
import chalk11 from "chalk";
|
|
11183
11280
|
|
|
11184
11281
|
// src/lib/utils/time-parser.ts
|
|
11185
11282
|
function parseTime(timeStr) {
|
|
@@ -11232,16 +11329,16 @@ function formatRunStatus(status, width) {
|
|
|
11232
11329
|
const paddedStatus = width ? status.padEnd(width) : status;
|
|
11233
11330
|
switch (status) {
|
|
11234
11331
|
case "queued":
|
|
11235
|
-
return
|
|
11332
|
+
return chalk11.blue(paddedStatus);
|
|
11236
11333
|
case "running":
|
|
11237
|
-
return
|
|
11334
|
+
return chalk11.green(paddedStatus);
|
|
11238
11335
|
case "pending":
|
|
11239
|
-
return
|
|
11336
|
+
return chalk11.yellow(paddedStatus);
|
|
11240
11337
|
case "completed":
|
|
11241
|
-
return
|
|
11338
|
+
return chalk11.dim(paddedStatus);
|
|
11242
11339
|
case "failed":
|
|
11243
11340
|
case "timeout":
|
|
11244
|
-
return
|
|
11341
|
+
return chalk11.red(paddedStatus);
|
|
11245
11342
|
default:
|
|
11246
11343
|
return paddedStatus;
|
|
11247
11344
|
}
|
|
@@ -11292,7 +11389,7 @@ function displayRuns(runs) {
|
|
|
11292
11389
|
"STATUS".padEnd(statusWidth),
|
|
11293
11390
|
"CREATED"
|
|
11294
11391
|
].join(" ");
|
|
11295
|
-
console.log(
|
|
11392
|
+
console.log(chalk11.dim(header));
|
|
11296
11393
|
for (const run of runs) {
|
|
11297
11394
|
const row = [
|
|
11298
11395
|
run.id.padEnd(UUID_LENGTH),
|
|
@@ -11305,10 +11402,10 @@ function displayRuns(runs) {
|
|
|
11305
11402
|
}
|
|
11306
11403
|
function displayEmptyState(hasFilters) {
|
|
11307
11404
|
if (hasFilters) {
|
|
11308
|
-
console.log(
|
|
11405
|
+
console.log(chalk11.dim("No runs found matching filters"));
|
|
11309
11406
|
} else {
|
|
11310
|
-
console.log(
|
|
11311
|
-
console.log(
|
|
11407
|
+
console.log(chalk11.dim("No active runs"));
|
|
11408
|
+
console.log(chalk11.dim(' Run: vm0 run <agent> "<prompt>"'));
|
|
11312
11409
|
}
|
|
11313
11410
|
}
|
|
11314
11411
|
var listCommand = new Command11().name("list").alias("ls").description("List runs").option(
|
|
@@ -11345,11 +11442,11 @@ var listCommand = new Command11().name("list").alias("ls").description("List run
|
|
|
11345
11442
|
|
|
11346
11443
|
// src/commands/run/kill.ts
|
|
11347
11444
|
import { Command as Command12 } from "commander";
|
|
11348
|
-
import
|
|
11445
|
+
import chalk12 from "chalk";
|
|
11349
11446
|
var killCommand = new Command12().name("kill").description("Kill (cancel) a pending or running run").argument("<run-id>", "Run ID to kill").action(
|
|
11350
11447
|
withErrorHandler(async (runId) => {
|
|
11351
11448
|
await cancelRun(runId);
|
|
11352
|
-
console.log(
|
|
11449
|
+
console.log(chalk12.green(`\u2713 Run ${runId} cancelled`));
|
|
11353
11450
|
})
|
|
11354
11451
|
);
|
|
11355
11452
|
|
|
@@ -11365,7 +11462,7 @@ import { Command as Command19 } from "commander";
|
|
|
11365
11462
|
|
|
11366
11463
|
// src/commands/volume/init.ts
|
|
11367
11464
|
import { Command as Command13 } from "commander";
|
|
11368
|
-
import
|
|
11465
|
+
import chalk13 from "chalk";
|
|
11369
11466
|
import path7 from "path";
|
|
11370
11467
|
|
|
11371
11468
|
// src/lib/storage/storage-utils.ts
|
|
@@ -11423,10 +11520,10 @@ var initCommand = new Command13().name("init").description("Initialize a volume
|
|
|
11423
11520
|
const existingConfig = await readStorageConfig(cwd);
|
|
11424
11521
|
if (existingConfig) {
|
|
11425
11522
|
console.log(
|
|
11426
|
-
|
|
11523
|
+
chalk13.yellow(`Volume already initialized: ${existingConfig.name}`)
|
|
11427
11524
|
);
|
|
11428
11525
|
console.log(
|
|
11429
|
-
|
|
11526
|
+
chalk13.dim(`Config file: ${path7.join(cwd, ".vm0", "storage.yaml")}`)
|
|
11430
11527
|
);
|
|
11431
11528
|
return;
|
|
11432
11529
|
}
|
|
@@ -11450,7 +11547,7 @@ var initCommand = new Command13().name("init").description("Initialize a volume
|
|
|
11450
11547
|
}
|
|
11451
11548
|
);
|
|
11452
11549
|
if (name === void 0) {
|
|
11453
|
-
console.log(
|
|
11550
|
+
console.log(chalk13.dim("Cancelled"));
|
|
11454
11551
|
return;
|
|
11455
11552
|
}
|
|
11456
11553
|
volumeName = name;
|
|
@@ -11463,9 +11560,9 @@ var initCommand = new Command13().name("init").description("Initialize a volume
|
|
|
11463
11560
|
});
|
|
11464
11561
|
}
|
|
11465
11562
|
await writeStorageConfig(volumeName, cwd);
|
|
11466
|
-
console.log(
|
|
11563
|
+
console.log(chalk13.green(`\u2713 Initialized volume: ${volumeName}`));
|
|
11467
11564
|
console.log(
|
|
11468
|
-
|
|
11565
|
+
chalk13.dim(
|
|
11469
11566
|
` Config saved to ${path7.join(cwd, ".vm0", "storage.yaml")}`
|
|
11470
11567
|
)
|
|
11471
11568
|
);
|
|
@@ -11474,7 +11571,7 @@ var initCommand = new Command13().name("init").description("Initialize a volume
|
|
|
11474
11571
|
|
|
11475
11572
|
// src/commands/volume/push.ts
|
|
11476
11573
|
import { Command as Command14 } from "commander";
|
|
11477
|
-
import
|
|
11574
|
+
import chalk14 from "chalk";
|
|
11478
11575
|
var pushCommand = new Command14().name("push").description("Push local files to cloud volume").option(
|
|
11479
11576
|
"-f, --force",
|
|
11480
11577
|
"Force upload even if content unchanged (recreate archive)"
|
|
@@ -11490,41 +11587,41 @@ var pushCommand = new Command14().name("push").description("Push local files to
|
|
|
11490
11587
|
console.log(`Pushing volume: ${config.name}`);
|
|
11491
11588
|
const result = await directUpload(config.name, "volume", cwd, {
|
|
11492
11589
|
onProgress: (message) => {
|
|
11493
|
-
console.log(
|
|
11590
|
+
console.log(chalk14.dim(message));
|
|
11494
11591
|
},
|
|
11495
11592
|
force: options.force
|
|
11496
11593
|
});
|
|
11497
11594
|
const shortVersion = result.versionId.slice(0, 8);
|
|
11498
11595
|
if (result.empty) {
|
|
11499
|
-
console.log(
|
|
11596
|
+
console.log(chalk14.dim("No files found (empty volume)"));
|
|
11500
11597
|
} else if (result.deduplicated) {
|
|
11501
|
-
console.log(
|
|
11598
|
+
console.log(chalk14.green("\u2713 Content unchanged (deduplicated)"));
|
|
11502
11599
|
} else {
|
|
11503
|
-
console.log(
|
|
11600
|
+
console.log(chalk14.green("\u2713 Upload complete"));
|
|
11504
11601
|
}
|
|
11505
|
-
console.log(
|
|
11506
|
-
console.log(
|
|
11507
|
-
console.log(
|
|
11602
|
+
console.log(chalk14.dim(` Version: ${shortVersion}`));
|
|
11603
|
+
console.log(chalk14.dim(` Files: ${result.fileCount.toLocaleString()}`));
|
|
11604
|
+
console.log(chalk14.dim(` Size: ${formatBytes(result.size)}`));
|
|
11508
11605
|
})
|
|
11509
11606
|
);
|
|
11510
11607
|
|
|
11511
11608
|
// src/commands/volume/pull.ts
|
|
11512
11609
|
import { Command as Command15 } from "commander";
|
|
11513
|
-
import
|
|
11610
|
+
import chalk16 from "chalk";
|
|
11514
11611
|
import path8 from "path";
|
|
11515
11612
|
import * as fs7 from "fs";
|
|
11516
11613
|
import * as os5 from "os";
|
|
11517
11614
|
import * as tar3 from "tar";
|
|
11518
11615
|
|
|
11519
11616
|
// src/lib/storage/pull-utils.ts
|
|
11520
|
-
import
|
|
11617
|
+
import chalk15 from "chalk";
|
|
11521
11618
|
async function handleEmptyStorageResponse(cwd) {
|
|
11522
|
-
console.log(
|
|
11619
|
+
console.log(chalk15.dim("Syncing local files..."));
|
|
11523
11620
|
const removedCount = await removeExtraFiles(cwd, /* @__PURE__ */ new Set());
|
|
11524
11621
|
if (removedCount > 0) {
|
|
11525
|
-
console.log(
|
|
11622
|
+
console.log(chalk15.green(`\u2713 Removed ${removedCount} files not in remote`));
|
|
11526
11623
|
}
|
|
11527
|
-
console.log(
|
|
11624
|
+
console.log(chalk15.green("\u2713 Synced (0 files)"));
|
|
11528
11625
|
return { removedCount };
|
|
11529
11626
|
}
|
|
11530
11627
|
|
|
@@ -11543,7 +11640,7 @@ var pullCommand = new Command15().name("pull").description("Pull cloud files to
|
|
|
11543
11640
|
} else {
|
|
11544
11641
|
console.log(`Pulling volume: ${config.name}`);
|
|
11545
11642
|
}
|
|
11546
|
-
console.log(
|
|
11643
|
+
console.log(chalk16.dim("Getting download URL..."));
|
|
11547
11644
|
const downloadInfo = await getStorageDownload({
|
|
11548
11645
|
name: config.name,
|
|
11549
11646
|
type: "volume",
|
|
@@ -11557,18 +11654,18 @@ var pullCommand = new Command15().name("pull").description("Pull cloud files to
|
|
|
11557
11654
|
if (!downloadUrl) {
|
|
11558
11655
|
throw new Error("No download URL returned");
|
|
11559
11656
|
}
|
|
11560
|
-
console.log(
|
|
11657
|
+
console.log(chalk16.dim("Downloading from S3..."));
|
|
11561
11658
|
const s3Response = await fetch(downloadUrl);
|
|
11562
11659
|
if (!s3Response.ok) {
|
|
11563
11660
|
throw new Error(`S3 download failed: ${s3Response.status}`);
|
|
11564
11661
|
}
|
|
11565
11662
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
11566
11663
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
11567
|
-
console.log(
|
|
11664
|
+
console.log(chalk16.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
11568
11665
|
const tmpDir = fs7.mkdtempSync(path8.join(os5.tmpdir(), "vm0-"));
|
|
11569
11666
|
const tarPath = path8.join(tmpDir, "volume.tar.gz");
|
|
11570
11667
|
await fs7.promises.writeFile(tarPath, tarBuffer);
|
|
11571
|
-
console.log(
|
|
11668
|
+
console.log(chalk16.dim("Syncing local files..."));
|
|
11572
11669
|
const remoteFiles = await listTarFiles(tarPath);
|
|
11573
11670
|
const remoteFilesSet = new Set(
|
|
11574
11671
|
remoteFiles.map((f) => f.replace(/\\/g, "/"))
|
|
@@ -11576,10 +11673,10 @@ var pullCommand = new Command15().name("pull").description("Pull cloud files to
|
|
|
11576
11673
|
const removedCount = await removeExtraFiles(cwd, remoteFilesSet);
|
|
11577
11674
|
if (removedCount > 0) {
|
|
11578
11675
|
console.log(
|
|
11579
|
-
|
|
11676
|
+
chalk16.green(`\u2713 Removed ${removedCount} files not in remote`)
|
|
11580
11677
|
);
|
|
11581
11678
|
}
|
|
11582
|
-
console.log(
|
|
11679
|
+
console.log(chalk16.dim("Extracting files..."));
|
|
11583
11680
|
await tar3.extract({
|
|
11584
11681
|
file: tarPath,
|
|
11585
11682
|
cwd,
|
|
@@ -11587,13 +11684,13 @@ var pullCommand = new Command15().name("pull").description("Pull cloud files to
|
|
|
11587
11684
|
});
|
|
11588
11685
|
await fs7.promises.unlink(tarPath);
|
|
11589
11686
|
await fs7.promises.rmdir(tmpDir);
|
|
11590
|
-
console.log(
|
|
11687
|
+
console.log(chalk16.green(`\u2713 Extracted ${remoteFiles.length} files`));
|
|
11591
11688
|
})
|
|
11592
11689
|
);
|
|
11593
11690
|
|
|
11594
11691
|
// src/commands/volume/status.ts
|
|
11595
11692
|
import { Command as Command16 } from "commander";
|
|
11596
|
-
import
|
|
11693
|
+
import chalk17 from "chalk";
|
|
11597
11694
|
var statusCommand2 = new Command16().name("status").description("Show status of cloud volume").action(
|
|
11598
11695
|
withErrorHandler(async () => {
|
|
11599
11696
|
const cwd = process.cwd();
|
|
@@ -11617,13 +11714,13 @@ var statusCommand2 = new Command16().name("status").description("Show status of
|
|
|
11617
11714
|
});
|
|
11618
11715
|
const shortVersion = info.versionId.slice(0, 8);
|
|
11619
11716
|
if ("empty" in info) {
|
|
11620
|
-
console.log(
|
|
11621
|
-
console.log(
|
|
11717
|
+
console.log(chalk17.green("\u2713 Found (empty)"));
|
|
11718
|
+
console.log(chalk17.dim(` Version: ${shortVersion}`));
|
|
11622
11719
|
} else {
|
|
11623
|
-
console.log(
|
|
11624
|
-
console.log(
|
|
11625
|
-
console.log(
|
|
11626
|
-
console.log(
|
|
11720
|
+
console.log(chalk17.green("\u2713 Found"));
|
|
11721
|
+
console.log(chalk17.dim(` Version: ${shortVersion}`));
|
|
11722
|
+
console.log(chalk17.dim(` Files: ${info.fileCount.toLocaleString()}`));
|
|
11723
|
+
console.log(chalk17.dim(` Size: ${formatBytes(info.size)}`));
|
|
11627
11724
|
}
|
|
11628
11725
|
} catch (error) {
|
|
11629
11726
|
if (error instanceof ApiRequestError && error.status === 404) {
|
|
@@ -11638,14 +11735,14 @@ var statusCommand2 = new Command16().name("status").description("Show status of
|
|
|
11638
11735
|
|
|
11639
11736
|
// src/commands/volume/list.ts
|
|
11640
11737
|
import { Command as Command17 } from "commander";
|
|
11641
|
-
import
|
|
11738
|
+
import chalk18 from "chalk";
|
|
11642
11739
|
var listCommand2 = new Command17().name("list").alias("ls").description("List all remote volumes").action(
|
|
11643
11740
|
withErrorHandler(async () => {
|
|
11644
11741
|
const items = await listStorages({ type: "volume" });
|
|
11645
11742
|
if (items.length === 0) {
|
|
11646
|
-
console.log(
|
|
11743
|
+
console.log(chalk18.dim("No volumes found"));
|
|
11647
11744
|
console.log(
|
|
11648
|
-
|
|
11745
|
+
chalk18.dim(" Create one with: vm0 volume init && vm0 volume push")
|
|
11649
11746
|
);
|
|
11650
11747
|
return;
|
|
11651
11748
|
}
|
|
@@ -11664,7 +11761,7 @@ var listCommand2 = new Command17().name("list").alias("ls").description("List al
|
|
|
11664
11761
|
"FILES".padStart(filesWidth),
|
|
11665
11762
|
"UPDATED"
|
|
11666
11763
|
].join(" ");
|
|
11667
|
-
console.log(
|
|
11764
|
+
console.log(chalk18.dim(header));
|
|
11668
11765
|
for (const item of items) {
|
|
11669
11766
|
const row = [
|
|
11670
11767
|
item.name.padEnd(nameWidth),
|
|
@@ -11679,10 +11776,10 @@ var listCommand2 = new Command17().name("list").alias("ls").description("List al
|
|
|
11679
11776
|
|
|
11680
11777
|
// src/commands/volume/clone.ts
|
|
11681
11778
|
import { Command as Command18 } from "commander";
|
|
11682
|
-
import
|
|
11779
|
+
import chalk20 from "chalk";
|
|
11683
11780
|
|
|
11684
11781
|
// src/lib/storage/clone-utils.ts
|
|
11685
|
-
import
|
|
11782
|
+
import chalk19 from "chalk";
|
|
11686
11783
|
import path9 from "path";
|
|
11687
11784
|
import * as fs8 from "fs";
|
|
11688
11785
|
import * as os6 from "os";
|
|
@@ -11693,18 +11790,18 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
11693
11790
|
if (dirStatus.exists && !dirStatus.empty) {
|
|
11694
11791
|
throw new Error(`Directory "${destination}" is not empty`);
|
|
11695
11792
|
}
|
|
11696
|
-
console.log(
|
|
11793
|
+
console.log(chalk19.dim(`Checking remote ${typeLabel}...`));
|
|
11697
11794
|
const downloadInfo = await getStorageDownload({
|
|
11698
11795
|
name,
|
|
11699
11796
|
type: type2,
|
|
11700
11797
|
version: options.version
|
|
11701
11798
|
});
|
|
11702
|
-
console.log(
|
|
11799
|
+
console.log(chalk19.dim(`Creating directory: ${destination}/`));
|
|
11703
11800
|
await fs8.promises.mkdir(destination, { recursive: true });
|
|
11704
11801
|
if ("empty" in downloadInfo) {
|
|
11705
11802
|
await writeStorageConfig(name, destination, type2);
|
|
11706
|
-
console.log(
|
|
11707
|
-
console.log(
|
|
11803
|
+
console.log(chalk19.green(`\u2713 Cloned empty ${typeLabel}: ${name}`));
|
|
11804
|
+
console.log(chalk19.dim(`\u2713 Initialized .vm0/storage.yaml`));
|
|
11708
11805
|
return {
|
|
11709
11806
|
success: true,
|
|
11710
11807
|
fileCount: 0,
|
|
@@ -11716,7 +11813,7 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
11716
11813
|
if (!downloadUrl) {
|
|
11717
11814
|
throw new Error("No download URL returned");
|
|
11718
11815
|
}
|
|
11719
|
-
console.log(
|
|
11816
|
+
console.log(chalk19.dim("Downloading from S3..."));
|
|
11720
11817
|
const s3Response = await fetch(downloadUrl);
|
|
11721
11818
|
if (!s3Response.ok) {
|
|
11722
11819
|
await fs8.promises.rm(destination, { recursive: true, force: true });
|
|
@@ -11724,12 +11821,12 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
11724
11821
|
}
|
|
11725
11822
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
11726
11823
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
11727
|
-
console.log(
|
|
11824
|
+
console.log(chalk19.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
11728
11825
|
const tmpDir = fs8.mkdtempSync(path9.join(os6.tmpdir(), "vm0-clone-"));
|
|
11729
11826
|
const tarPath = path9.join(tmpDir, "archive.tar.gz");
|
|
11730
11827
|
await fs8.promises.writeFile(tarPath, tarBuffer);
|
|
11731
11828
|
const files = await listTarFiles(tarPath);
|
|
11732
|
-
console.log(
|
|
11829
|
+
console.log(chalk19.dim("Extracting files..."));
|
|
11733
11830
|
await tar4.extract({
|
|
11734
11831
|
file: tarPath,
|
|
11735
11832
|
cwd: destination,
|
|
@@ -11737,9 +11834,9 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
11737
11834
|
});
|
|
11738
11835
|
await fs8.promises.unlink(tarPath);
|
|
11739
11836
|
await fs8.promises.rmdir(tmpDir);
|
|
11740
|
-
console.log(
|
|
11837
|
+
console.log(chalk19.green(`\u2713 Extracted ${files.length} files`));
|
|
11741
11838
|
await writeStorageConfig(name, destination, type2);
|
|
11742
|
-
console.log(
|
|
11839
|
+
console.log(chalk19.green(`\u2713 Initialized .vm0/storage.yaml`));
|
|
11743
11840
|
return {
|
|
11744
11841
|
success: true,
|
|
11745
11842
|
fileCount: downloadInfo.fileCount,
|
|
@@ -11754,10 +11851,10 @@ var cloneCommand = new Command18().name("clone").description("Clone a remote vol
|
|
|
11754
11851
|
const targetDir = destination || name;
|
|
11755
11852
|
console.log(`Cloning volume: ${name}`);
|
|
11756
11853
|
const result = await cloneStorage(name, "volume", targetDir);
|
|
11757
|
-
console.log(
|
|
11854
|
+
console.log(chalk20.green(`
|
|
11758
11855
|
\u2713 Successfully cloned volume: ${name}`));
|
|
11759
|
-
console.log(
|
|
11760
|
-
console.log(
|
|
11856
|
+
console.log(chalk20.dim(` Location: ${targetDir}/`));
|
|
11857
|
+
console.log(chalk20.dim(` Version: ${result.versionId.slice(0, 8)}`));
|
|
11761
11858
|
})
|
|
11762
11859
|
);
|
|
11763
11860
|
|
|
@@ -11769,7 +11866,7 @@ import { Command as Command26 } from "commander";
|
|
|
11769
11866
|
|
|
11770
11867
|
// src/commands/artifact/init.ts
|
|
11771
11868
|
import { Command as Command20 } from "commander";
|
|
11772
|
-
import
|
|
11869
|
+
import chalk21 from "chalk";
|
|
11773
11870
|
import path10 from "path";
|
|
11774
11871
|
var initCommand2 = new Command20().name("init").description("Initialize an artifact in the current directory").option(
|
|
11775
11872
|
"-n, --name <name>",
|
|
@@ -11782,24 +11879,24 @@ var initCommand2 = new Command20().name("init").description("Initialize an artif
|
|
|
11782
11879
|
if (existingConfig) {
|
|
11783
11880
|
if (existingConfig.type === "artifact") {
|
|
11784
11881
|
console.log(
|
|
11785
|
-
|
|
11882
|
+
chalk21.yellow(
|
|
11786
11883
|
`Artifact already initialized: ${existingConfig.name}`
|
|
11787
11884
|
)
|
|
11788
11885
|
);
|
|
11789
11886
|
} else {
|
|
11790
11887
|
console.log(
|
|
11791
|
-
|
|
11888
|
+
chalk21.yellow(
|
|
11792
11889
|
`Directory already initialized as volume: ${existingConfig.name}`
|
|
11793
11890
|
)
|
|
11794
11891
|
);
|
|
11795
11892
|
console.log(
|
|
11796
|
-
|
|
11893
|
+
chalk21.dim(
|
|
11797
11894
|
" To change type, delete .vm0/storage.yaml and reinitialize"
|
|
11798
11895
|
)
|
|
11799
11896
|
);
|
|
11800
11897
|
}
|
|
11801
11898
|
console.log(
|
|
11802
|
-
|
|
11899
|
+
chalk21.dim(`Config file: ${path10.join(cwd, ".vm0", "storage.yaml")}`)
|
|
11803
11900
|
);
|
|
11804
11901
|
return;
|
|
11805
11902
|
}
|
|
@@ -11823,7 +11920,7 @@ var initCommand2 = new Command20().name("init").description("Initialize an artif
|
|
|
11823
11920
|
}
|
|
11824
11921
|
);
|
|
11825
11922
|
if (name === void 0) {
|
|
11826
|
-
console.log(
|
|
11923
|
+
console.log(chalk21.dim("Cancelled"));
|
|
11827
11924
|
return;
|
|
11828
11925
|
}
|
|
11829
11926
|
artifactName = name;
|
|
@@ -11836,9 +11933,9 @@ var initCommand2 = new Command20().name("init").description("Initialize an artif
|
|
|
11836
11933
|
});
|
|
11837
11934
|
}
|
|
11838
11935
|
await writeStorageConfig(artifactName, cwd, "artifact");
|
|
11839
|
-
console.log(
|
|
11936
|
+
console.log(chalk21.green(`\u2713 Initialized artifact: ${artifactName}`));
|
|
11840
11937
|
console.log(
|
|
11841
|
-
|
|
11938
|
+
chalk21.dim(
|
|
11842
11939
|
` Config saved to ${path10.join(cwd, ".vm0", "storage.yaml")}`
|
|
11843
11940
|
)
|
|
11844
11941
|
);
|
|
@@ -11847,7 +11944,7 @@ var initCommand2 = new Command20().name("init").description("Initialize an artif
|
|
|
11847
11944
|
|
|
11848
11945
|
// src/commands/artifact/push.ts
|
|
11849
11946
|
import { Command as Command21 } from "commander";
|
|
11850
|
-
import
|
|
11947
|
+
import chalk22 from "chalk";
|
|
11851
11948
|
var pushCommand2 = new Command21().name("push").description("Push local files to cloud artifact").option(
|
|
11852
11949
|
"-f, --force",
|
|
11853
11950
|
"Force upload even if content unchanged (recreate archive)"
|
|
@@ -11869,27 +11966,27 @@ var pushCommand2 = new Command21().name("push").description("Push local files to
|
|
|
11869
11966
|
console.log(`Pushing artifact: ${config.name}`);
|
|
11870
11967
|
const result = await directUpload(config.name, "artifact", cwd, {
|
|
11871
11968
|
onProgress: (message) => {
|
|
11872
|
-
console.log(
|
|
11969
|
+
console.log(chalk22.dim(message));
|
|
11873
11970
|
},
|
|
11874
11971
|
force: options.force
|
|
11875
11972
|
});
|
|
11876
11973
|
const shortVersion = result.versionId.slice(0, 8);
|
|
11877
11974
|
if (result.empty) {
|
|
11878
|
-
console.log(
|
|
11975
|
+
console.log(chalk22.dim("No files found (empty artifact)"));
|
|
11879
11976
|
} else if (result.deduplicated) {
|
|
11880
|
-
console.log(
|
|
11977
|
+
console.log(chalk22.green("\u2713 Content unchanged (deduplicated)"));
|
|
11881
11978
|
} else {
|
|
11882
|
-
console.log(
|
|
11979
|
+
console.log(chalk22.green("\u2713 Upload complete"));
|
|
11883
11980
|
}
|
|
11884
|
-
console.log(
|
|
11885
|
-
console.log(
|
|
11886
|
-
console.log(
|
|
11981
|
+
console.log(chalk22.dim(` Version: ${shortVersion}`));
|
|
11982
|
+
console.log(chalk22.dim(` Files: ${result.fileCount.toLocaleString()}`));
|
|
11983
|
+
console.log(chalk22.dim(` Size: ${formatBytes(result.size)}`));
|
|
11887
11984
|
})
|
|
11888
11985
|
);
|
|
11889
11986
|
|
|
11890
11987
|
// src/commands/artifact/pull.ts
|
|
11891
11988
|
import { Command as Command22 } from "commander";
|
|
11892
|
-
import
|
|
11989
|
+
import chalk23 from "chalk";
|
|
11893
11990
|
import path11 from "path";
|
|
11894
11991
|
import * as fs9 from "fs";
|
|
11895
11992
|
import * as os7 from "os";
|
|
@@ -11914,7 +12011,7 @@ var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact
|
|
|
11914
12011
|
} else {
|
|
11915
12012
|
console.log(`Pulling artifact: ${config.name}`);
|
|
11916
12013
|
}
|
|
11917
|
-
console.log(
|
|
12014
|
+
console.log(chalk23.dim("Getting download URL..."));
|
|
11918
12015
|
const downloadInfo = await getStorageDownload({
|
|
11919
12016
|
name: config.name,
|
|
11920
12017
|
type: "artifact",
|
|
@@ -11928,18 +12025,18 @@ var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact
|
|
|
11928
12025
|
if (!downloadUrl) {
|
|
11929
12026
|
throw new Error("No download URL returned");
|
|
11930
12027
|
}
|
|
11931
|
-
console.log(
|
|
12028
|
+
console.log(chalk23.dim("Downloading from S3..."));
|
|
11932
12029
|
const s3Response = await fetch(downloadUrl);
|
|
11933
12030
|
if (!s3Response.ok) {
|
|
11934
12031
|
throw new Error(`S3 download failed: ${s3Response.status}`);
|
|
11935
12032
|
}
|
|
11936
12033
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
11937
12034
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
11938
|
-
console.log(
|
|
12035
|
+
console.log(chalk23.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
11939
12036
|
const tmpDir = fs9.mkdtempSync(path11.join(os7.tmpdir(), "vm0-"));
|
|
11940
12037
|
const tarPath = path11.join(tmpDir, "artifact.tar.gz");
|
|
11941
12038
|
await fs9.promises.writeFile(tarPath, tarBuffer);
|
|
11942
|
-
console.log(
|
|
12039
|
+
console.log(chalk23.dim("Syncing local files..."));
|
|
11943
12040
|
const remoteFiles = await listTarFiles(tarPath);
|
|
11944
12041
|
const remoteFilesSet = new Set(
|
|
11945
12042
|
remoteFiles.map((f) => f.replace(/\\/g, "/"))
|
|
@@ -11947,10 +12044,10 @@ var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact
|
|
|
11947
12044
|
const removedCount = await removeExtraFiles(cwd, remoteFilesSet);
|
|
11948
12045
|
if (removedCount > 0) {
|
|
11949
12046
|
console.log(
|
|
11950
|
-
|
|
12047
|
+
chalk23.green(`\u2713 Removed ${removedCount} files not in remote`)
|
|
11951
12048
|
);
|
|
11952
12049
|
}
|
|
11953
|
-
console.log(
|
|
12050
|
+
console.log(chalk23.dim("Extracting files..."));
|
|
11954
12051
|
await tar5.extract({
|
|
11955
12052
|
file: tarPath,
|
|
11956
12053
|
cwd,
|
|
@@ -11958,13 +12055,13 @@ var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact
|
|
|
11958
12055
|
});
|
|
11959
12056
|
await fs9.promises.unlink(tarPath);
|
|
11960
12057
|
await fs9.promises.rmdir(tmpDir);
|
|
11961
|
-
console.log(
|
|
12058
|
+
console.log(chalk23.green(`\u2713 Extracted ${remoteFiles.length} files`));
|
|
11962
12059
|
})
|
|
11963
12060
|
);
|
|
11964
12061
|
|
|
11965
12062
|
// src/commands/artifact/status.ts
|
|
11966
12063
|
import { Command as Command23 } from "commander";
|
|
11967
|
-
import
|
|
12064
|
+
import chalk24 from "chalk";
|
|
11968
12065
|
var statusCommand3 = new Command23().name("status").description("Show status of cloud artifact").action(
|
|
11969
12066
|
withErrorHandler(async () => {
|
|
11970
12067
|
const cwd = process.cwd();
|
|
@@ -11988,13 +12085,13 @@ var statusCommand3 = new Command23().name("status").description("Show status of
|
|
|
11988
12085
|
});
|
|
11989
12086
|
const shortVersion = info.versionId.slice(0, 8);
|
|
11990
12087
|
if ("empty" in info) {
|
|
11991
|
-
console.log(
|
|
11992
|
-
console.log(
|
|
12088
|
+
console.log(chalk24.green("\u2713 Found (empty)"));
|
|
12089
|
+
console.log(chalk24.dim(` Version: ${shortVersion}`));
|
|
11993
12090
|
} else {
|
|
11994
|
-
console.log(
|
|
11995
|
-
console.log(
|
|
11996
|
-
console.log(
|
|
11997
|
-
console.log(
|
|
12091
|
+
console.log(chalk24.green("\u2713 Found"));
|
|
12092
|
+
console.log(chalk24.dim(` Version: ${shortVersion}`));
|
|
12093
|
+
console.log(chalk24.dim(` Files: ${info.fileCount.toLocaleString()}`));
|
|
12094
|
+
console.log(chalk24.dim(` Size: ${formatBytes(info.size)}`));
|
|
11998
12095
|
}
|
|
11999
12096
|
} catch (error) {
|
|
12000
12097
|
if (error instanceof ApiRequestError && error.status === 404) {
|
|
@@ -12009,14 +12106,14 @@ var statusCommand3 = new Command23().name("status").description("Show status of
|
|
|
12009
12106
|
|
|
12010
12107
|
// src/commands/artifact/list.ts
|
|
12011
12108
|
import { Command as Command24 } from "commander";
|
|
12012
|
-
import
|
|
12109
|
+
import chalk25 from "chalk";
|
|
12013
12110
|
var listCommand3 = new Command24().name("list").alias("ls").description("List all remote artifacts").action(
|
|
12014
12111
|
withErrorHandler(async () => {
|
|
12015
12112
|
const items = await listStorages({ type: "artifact" });
|
|
12016
12113
|
if (items.length === 0) {
|
|
12017
|
-
console.log(
|
|
12114
|
+
console.log(chalk25.dim("No artifacts found"));
|
|
12018
12115
|
console.log(
|
|
12019
|
-
|
|
12116
|
+
chalk25.dim(
|
|
12020
12117
|
" Create one with: vm0 artifact init && vm0 artifact push"
|
|
12021
12118
|
)
|
|
12022
12119
|
);
|
|
@@ -12037,7 +12134,7 @@ var listCommand3 = new Command24().name("list").alias("ls").description("List al
|
|
|
12037
12134
|
"FILES".padStart(filesWidth),
|
|
12038
12135
|
"UPDATED"
|
|
12039
12136
|
].join(" ");
|
|
12040
|
-
console.log(
|
|
12137
|
+
console.log(chalk25.dim(header));
|
|
12041
12138
|
for (const item of items) {
|
|
12042
12139
|
const row = [
|
|
12043
12140
|
item.name.padEnd(nameWidth),
|
|
@@ -12052,16 +12149,16 @@ var listCommand3 = new Command24().name("list").alias("ls").description("List al
|
|
|
12052
12149
|
|
|
12053
12150
|
// src/commands/artifact/clone.ts
|
|
12054
12151
|
import { Command as Command25 } from "commander";
|
|
12055
|
-
import
|
|
12152
|
+
import chalk26 from "chalk";
|
|
12056
12153
|
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
12154
|
withErrorHandler(async (name, destination) => {
|
|
12058
12155
|
const targetDir = destination || name;
|
|
12059
12156
|
console.log(`Cloning artifact: ${name}`);
|
|
12060
12157
|
const result = await cloneStorage(name, "artifact", targetDir);
|
|
12061
|
-
console.log(
|
|
12158
|
+
console.log(chalk26.green(`
|
|
12062
12159
|
\u2713 Successfully cloned artifact: ${name}`));
|
|
12063
|
-
console.log(
|
|
12064
|
-
console.log(
|
|
12160
|
+
console.log(chalk26.dim(` Location: ${targetDir}/`));
|
|
12161
|
+
console.log(chalk26.dim(` Version: ${result.versionId.slice(0, 8)}`));
|
|
12065
12162
|
})
|
|
12066
12163
|
);
|
|
12067
12164
|
|
|
@@ -12073,7 +12170,7 @@ import { Command as Command33 } from "commander";
|
|
|
12073
12170
|
|
|
12074
12171
|
// src/commands/memory/init.ts
|
|
12075
12172
|
import { Command as Command27 } from "commander";
|
|
12076
|
-
import
|
|
12173
|
+
import chalk27 from "chalk";
|
|
12077
12174
|
import path12 from "path";
|
|
12078
12175
|
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
12176
|
withErrorHandler(async (options) => {
|
|
@@ -12083,22 +12180,22 @@ var initCommand3 = new Command27().name("init").description("Initialize a memory
|
|
|
12083
12180
|
if (existingConfig) {
|
|
12084
12181
|
if (existingConfig.type === "memory") {
|
|
12085
12182
|
console.log(
|
|
12086
|
-
|
|
12183
|
+
chalk27.yellow(`Memory already initialized: ${existingConfig.name}`)
|
|
12087
12184
|
);
|
|
12088
12185
|
} else {
|
|
12089
12186
|
console.log(
|
|
12090
|
-
|
|
12187
|
+
chalk27.yellow(
|
|
12091
12188
|
`Directory already initialized as ${existingConfig.type}: ${existingConfig.name}`
|
|
12092
12189
|
)
|
|
12093
12190
|
);
|
|
12094
12191
|
console.log(
|
|
12095
|
-
|
|
12192
|
+
chalk27.dim(
|
|
12096
12193
|
" To change type, delete .vm0/storage.yaml and reinitialize"
|
|
12097
12194
|
)
|
|
12098
12195
|
);
|
|
12099
12196
|
}
|
|
12100
12197
|
console.log(
|
|
12101
|
-
|
|
12198
|
+
chalk27.dim(`Config file: ${path12.join(cwd, ".vm0", "storage.yaml")}`)
|
|
12102
12199
|
);
|
|
12103
12200
|
return;
|
|
12104
12201
|
}
|
|
@@ -12122,7 +12219,7 @@ var initCommand3 = new Command27().name("init").description("Initialize a memory
|
|
|
12122
12219
|
}
|
|
12123
12220
|
);
|
|
12124
12221
|
if (name === void 0) {
|
|
12125
|
-
console.log(
|
|
12222
|
+
console.log(chalk27.dim("Cancelled"));
|
|
12126
12223
|
return;
|
|
12127
12224
|
}
|
|
12128
12225
|
memoryName = name;
|
|
@@ -12135,9 +12232,9 @@ var initCommand3 = new Command27().name("init").description("Initialize a memory
|
|
|
12135
12232
|
});
|
|
12136
12233
|
}
|
|
12137
12234
|
await writeStorageConfig(memoryName, cwd, "memory");
|
|
12138
|
-
console.log(
|
|
12235
|
+
console.log(chalk27.green(`\u2713 Initialized memory: ${memoryName}`));
|
|
12139
12236
|
console.log(
|
|
12140
|
-
|
|
12237
|
+
chalk27.dim(
|
|
12141
12238
|
` Config saved to ${path12.join(cwd, ".vm0", "storage.yaml")}`
|
|
12142
12239
|
)
|
|
12143
12240
|
);
|
|
@@ -12146,7 +12243,7 @@ var initCommand3 = new Command27().name("init").description("Initialize a memory
|
|
|
12146
12243
|
|
|
12147
12244
|
// src/commands/memory/push.ts
|
|
12148
12245
|
import { Command as Command28 } from "commander";
|
|
12149
|
-
import
|
|
12246
|
+
import chalk28 from "chalk";
|
|
12150
12247
|
var pushCommand3 = new Command28().name("push").description("Push local files to cloud memory").option(
|
|
12151
12248
|
"-f, --force",
|
|
12152
12249
|
"Force upload even if content unchanged (recreate archive)"
|
|
@@ -12168,42 +12265,42 @@ var pushCommand3 = new Command28().name("push").description("Push local files to
|
|
|
12168
12265
|
console.log(`Pushing memory: ${config.name}`);
|
|
12169
12266
|
const result = await directUpload(config.name, "memory", cwd, {
|
|
12170
12267
|
onProgress: (message) => {
|
|
12171
|
-
console.log(
|
|
12268
|
+
console.log(chalk28.dim(message));
|
|
12172
12269
|
},
|
|
12173
12270
|
force: options.force
|
|
12174
12271
|
});
|
|
12175
12272
|
const shortVersion = result.versionId.slice(0, 8);
|
|
12176
12273
|
if (result.empty) {
|
|
12177
|
-
console.log(
|
|
12274
|
+
console.log(chalk28.dim("No files found (empty memory)"));
|
|
12178
12275
|
} else if (result.deduplicated) {
|
|
12179
|
-
console.log(
|
|
12276
|
+
console.log(chalk28.green("\u2713 Content unchanged (deduplicated)"));
|
|
12180
12277
|
} else {
|
|
12181
|
-
console.log(
|
|
12278
|
+
console.log(chalk28.green("\u2713 Upload complete"));
|
|
12182
12279
|
}
|
|
12183
|
-
console.log(
|
|
12184
|
-
console.log(
|
|
12185
|
-
console.log(
|
|
12280
|
+
console.log(chalk28.dim(` Version: ${shortVersion}`));
|
|
12281
|
+
console.log(chalk28.dim(` Files: ${result.fileCount.toLocaleString()}`));
|
|
12282
|
+
console.log(chalk28.dim(` Size: ${formatBytes(result.size)}`));
|
|
12186
12283
|
})
|
|
12187
12284
|
);
|
|
12188
12285
|
|
|
12189
12286
|
// src/commands/memory/pull.ts
|
|
12190
12287
|
import { Command as Command29 } from "commander";
|
|
12191
|
-
import
|
|
12288
|
+
import chalk29 from "chalk";
|
|
12192
12289
|
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
12290
|
withErrorHandler(async (name, destination) => {
|
|
12194
12291
|
const targetDir = destination || name;
|
|
12195
12292
|
console.log(`Pulling memory: ${name}`);
|
|
12196
12293
|
const result = await cloneStorage(name, "memory", targetDir);
|
|
12197
|
-
console.log(
|
|
12294
|
+
console.log(chalk29.green(`
|
|
12198
12295
|
\u2713 Successfully pulled memory: ${name}`));
|
|
12199
|
-
console.log(
|
|
12200
|
-
console.log(
|
|
12296
|
+
console.log(chalk29.dim(` Location: ${targetDir}/`));
|
|
12297
|
+
console.log(chalk29.dim(` Version: ${result.versionId.slice(0, 8)}`));
|
|
12201
12298
|
})
|
|
12202
12299
|
);
|
|
12203
12300
|
|
|
12204
12301
|
// src/commands/memory/status.ts
|
|
12205
12302
|
import { Command as Command30 } from "commander";
|
|
12206
|
-
import
|
|
12303
|
+
import chalk30 from "chalk";
|
|
12207
12304
|
var statusCommand4 = new Command30().name("status").description("Show status of cloud memory").action(
|
|
12208
12305
|
withErrorHandler(async () => {
|
|
12209
12306
|
const cwd = process.cwd();
|
|
@@ -12227,13 +12324,13 @@ var statusCommand4 = new Command30().name("status").description("Show status of
|
|
|
12227
12324
|
});
|
|
12228
12325
|
const shortVersion = info.versionId.slice(0, 8);
|
|
12229
12326
|
if ("empty" in info) {
|
|
12230
|
-
console.log(
|
|
12231
|
-
console.log(
|
|
12327
|
+
console.log(chalk30.green("\u2713 Found (empty)"));
|
|
12328
|
+
console.log(chalk30.dim(` Version: ${shortVersion}`));
|
|
12232
12329
|
} else {
|
|
12233
|
-
console.log(
|
|
12234
|
-
console.log(
|
|
12235
|
-
console.log(
|
|
12236
|
-
console.log(
|
|
12330
|
+
console.log(chalk30.green("\u2713 Found"));
|
|
12331
|
+
console.log(chalk30.dim(` Version: ${shortVersion}`));
|
|
12332
|
+
console.log(chalk30.dim(` Files: ${info.fileCount.toLocaleString()}`));
|
|
12333
|
+
console.log(chalk30.dim(` Size: ${formatBytes(info.size)}`));
|
|
12237
12334
|
}
|
|
12238
12335
|
} catch (error) {
|
|
12239
12336
|
if (error instanceof ApiRequestError && error.status === 404) {
|
|
@@ -12248,14 +12345,14 @@ var statusCommand4 = new Command30().name("status").description("Show status of
|
|
|
12248
12345
|
|
|
12249
12346
|
// src/commands/memory/list.ts
|
|
12250
12347
|
import { Command as Command31 } from "commander";
|
|
12251
|
-
import
|
|
12348
|
+
import chalk31 from "chalk";
|
|
12252
12349
|
var listCommand4 = new Command31().name("list").alias("ls").description("List all remote memory storages").action(
|
|
12253
12350
|
withErrorHandler(async () => {
|
|
12254
12351
|
const items = await listStorages({ type: "memory" });
|
|
12255
12352
|
if (items.length === 0) {
|
|
12256
|
-
console.log(
|
|
12353
|
+
console.log(chalk31.dim("No memory storages found"));
|
|
12257
12354
|
console.log(
|
|
12258
|
-
|
|
12355
|
+
chalk31.dim(" Memory is created automatically on first agent run")
|
|
12259
12356
|
);
|
|
12260
12357
|
return;
|
|
12261
12358
|
}
|
|
@@ -12274,7 +12371,7 @@ var listCommand4 = new Command31().name("list").alias("ls").description("List al
|
|
|
12274
12371
|
"FILES".padStart(filesWidth),
|
|
12275
12372
|
"UPDATED"
|
|
12276
12373
|
].join(" ");
|
|
12277
|
-
console.log(
|
|
12374
|
+
console.log(chalk31.dim(header));
|
|
12278
12375
|
for (const item of items) {
|
|
12279
12376
|
const row = [
|
|
12280
12377
|
item.name.padEnd(nameWidth),
|
|
@@ -12289,16 +12386,16 @@ var listCommand4 = new Command31().name("list").alias("ls").description("List al
|
|
|
12289
12386
|
|
|
12290
12387
|
// src/commands/memory/clone.ts
|
|
12291
12388
|
import { Command as Command32 } from "commander";
|
|
12292
|
-
import
|
|
12389
|
+
import chalk32 from "chalk";
|
|
12293
12390
|
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
12391
|
withErrorHandler(async (name, destination) => {
|
|
12295
12392
|
const targetDir = destination || name;
|
|
12296
12393
|
console.log(`Cloning memory: ${name}`);
|
|
12297
12394
|
const result = await cloneStorage(name, "memory", targetDir);
|
|
12298
|
-
console.log(
|
|
12395
|
+
console.log(chalk32.green(`
|
|
12299
12396
|
\u2713 Successfully cloned memory: ${name}`));
|
|
12300
|
-
console.log(
|
|
12301
|
-
console.log(
|
|
12397
|
+
console.log(chalk32.dim(` Location: ${targetDir}/`));
|
|
12398
|
+
console.log(chalk32.dim(` Version: ${result.versionId.slice(0, 8)}`));
|
|
12302
12399
|
})
|
|
12303
12400
|
);
|
|
12304
12401
|
|
|
@@ -12307,7 +12404,7 @@ var memoryCommand = new Command33().name("memory").description("Manage agent lon
|
|
|
12307
12404
|
|
|
12308
12405
|
// src/commands/cook/cook.ts
|
|
12309
12406
|
import { Command as Command34, Option as Option5 } from "commander";
|
|
12310
|
-
import
|
|
12407
|
+
import chalk34 from "chalk";
|
|
12311
12408
|
import { readFile as readFile7, mkdir as mkdir6 } from "fs/promises";
|
|
12312
12409
|
import { existsSync as existsSync10 } from "fs";
|
|
12313
12410
|
import path13 from "path";
|
|
@@ -12379,12 +12476,12 @@ async function saveCookState(state) {
|
|
|
12379
12476
|
}
|
|
12380
12477
|
|
|
12381
12478
|
// src/commands/cook/utils.ts
|
|
12382
|
-
import
|
|
12479
|
+
import chalk33 from "chalk";
|
|
12383
12480
|
import { existsSync as existsSync9 } from "fs";
|
|
12384
12481
|
var CONFIG_FILE2 = "vm0.yaml";
|
|
12385
12482
|
var ARTIFACT_DIR = "artifact";
|
|
12386
12483
|
function printCommand(cmd) {
|
|
12387
|
-
console.log(
|
|
12484
|
+
console.log(chalk33.dim(`> ${cmd}`));
|
|
12388
12485
|
}
|
|
12389
12486
|
function execVm0Command(args, options = {}) {
|
|
12390
12487
|
return new Promise((resolve2, reject) => {
|
|
@@ -12483,7 +12580,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
12483
12580
|
);
|
|
12484
12581
|
if (serverVersion && existsSync9(artifactDir)) {
|
|
12485
12582
|
console.log();
|
|
12486
|
-
console.log(
|
|
12583
|
+
console.log(chalk33.bold("Pulling updated artifact:"));
|
|
12487
12584
|
printCommand(`cd ${ARTIFACT_DIR}`);
|
|
12488
12585
|
printCommand(`vm0 artifact pull ${serverVersion}`);
|
|
12489
12586
|
try {
|
|
@@ -12493,9 +12590,9 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
12493
12590
|
});
|
|
12494
12591
|
printCommand("cd ..");
|
|
12495
12592
|
} catch (error) {
|
|
12496
|
-
console.error(
|
|
12593
|
+
console.error(chalk33.red(`\u2717 Artifact pull failed`));
|
|
12497
12594
|
if (error instanceof Error) {
|
|
12498
|
-
console.error(
|
|
12595
|
+
console.error(chalk33.dim(` ${error.message}`));
|
|
12499
12596
|
}
|
|
12500
12597
|
}
|
|
12501
12598
|
}
|
|
@@ -12503,7 +12600,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
12503
12600
|
|
|
12504
12601
|
// src/commands/cook/cook.ts
|
|
12505
12602
|
async function loadAndValidateConfig2() {
|
|
12506
|
-
console.log(
|
|
12603
|
+
console.log(chalk34.bold(`Reading config: ${CONFIG_FILE2}`));
|
|
12507
12604
|
if (!existsSync10(CONFIG_FILE2)) {
|
|
12508
12605
|
throw new Error(`Config file not found: ${CONFIG_FILE2}`);
|
|
12509
12606
|
}
|
|
@@ -12525,7 +12622,7 @@ async function loadAndValidateConfig2() {
|
|
|
12525
12622
|
const agentName = agentNames[0];
|
|
12526
12623
|
const volumeCount = config.volumes ? Object.keys(config.volumes).length : 0;
|
|
12527
12624
|
console.log(
|
|
12528
|
-
|
|
12625
|
+
chalk34.green(`\u2713 Config validated: 1 agent, ${volumeCount} volume(s)`)
|
|
12529
12626
|
);
|
|
12530
12627
|
return { config, agentName, volumeCount };
|
|
12531
12628
|
}
|
|
@@ -12534,7 +12631,7 @@ async function processVolumes(config, cwd) {
|
|
|
12534
12631
|
return;
|
|
12535
12632
|
}
|
|
12536
12633
|
console.log();
|
|
12537
|
-
console.log(
|
|
12634
|
+
console.log(chalk34.bold("Processing volumes:"));
|
|
12538
12635
|
for (const volumeConfig of Object.values(config.volumes)) {
|
|
12539
12636
|
const volumeDir = path13.join(cwd, volumeConfig.name);
|
|
12540
12637
|
if (!existsSync10(volumeDir)) {
|
|
@@ -12568,7 +12665,7 @@ async function processVolumes(config, cwd) {
|
|
|
12568
12665
|
}
|
|
12569
12666
|
async function processArtifact(cwd) {
|
|
12570
12667
|
console.log();
|
|
12571
|
-
console.log(
|
|
12668
|
+
console.log(chalk34.bold("Processing artifact:"));
|
|
12572
12669
|
const artifactDir = path13.join(cwd, ARTIFACT_DIR);
|
|
12573
12670
|
try {
|
|
12574
12671
|
if (!existsSync10(artifactDir)) {
|
|
@@ -12600,7 +12697,7 @@ async function processArtifact(cwd) {
|
|
|
12600
12697
|
}
|
|
12601
12698
|
async function composeAgent(cwd, skipConfirm) {
|
|
12602
12699
|
console.log();
|
|
12603
|
-
console.log(
|
|
12700
|
+
console.log(chalk34.bold("Composing agent:"));
|
|
12604
12701
|
const composeArgs = skipConfirm ? ["compose", "--yes", CONFIG_FILE2] : ["compose", CONFIG_FILE2];
|
|
12605
12702
|
printCommand(`vm0 ${composeArgs.join(" ")}`);
|
|
12606
12703
|
try {
|
|
@@ -12614,7 +12711,7 @@ async function composeAgent(cwd, skipConfirm) {
|
|
|
12614
12711
|
}
|
|
12615
12712
|
async function runAgent(agentName, artifactDir, prompt, cwd, options) {
|
|
12616
12713
|
console.log();
|
|
12617
|
-
console.log(
|
|
12714
|
+
console.log(chalk34.bold("Running agent:"));
|
|
12618
12715
|
printCommand(
|
|
12619
12716
|
`vm0 run ${agentName} --artifact-name ${ARTIFACT_DIR} "${prompt}"`
|
|
12620
12717
|
);
|
|
@@ -12647,7 +12744,7 @@ var cookAction = new Command34().name("cook").description("Quick start: prepare,
|
|
|
12647
12744
|
withErrorHandler(
|
|
12648
12745
|
async (prompt, options) => {
|
|
12649
12746
|
if (options.autoUpdate !== false) {
|
|
12650
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
12747
|
+
const shouldExit = await checkAndUpgrade("9.59.1", prompt);
|
|
12651
12748
|
if (shouldExit) {
|
|
12652
12749
|
process.exit(0);
|
|
12653
12750
|
}
|
|
@@ -12830,7 +12927,7 @@ var cookCommand = cookAction;
|
|
|
12830
12927
|
|
|
12831
12928
|
// src/commands/logs/index.ts
|
|
12832
12929
|
import { Command as Command39 } from "commander";
|
|
12833
|
-
import
|
|
12930
|
+
import chalk36 from "chalk";
|
|
12834
12931
|
|
|
12835
12932
|
// src/lib/api/api-client.ts
|
|
12836
12933
|
import { initClient as initClient12 } from "@ts-rest/core";
|
|
@@ -13528,7 +13625,7 @@ async function paginate(options) {
|
|
|
13528
13625
|
|
|
13529
13626
|
// src/commands/logs/search.ts
|
|
13530
13627
|
import { Command as Command38 } from "commander";
|
|
13531
|
-
import
|
|
13628
|
+
import chalk35 from "chalk";
|
|
13532
13629
|
var SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
13533
13630
|
function renderEvent(event, renderer) {
|
|
13534
13631
|
const eventData = event.eventData;
|
|
@@ -13584,7 +13681,7 @@ function renderResults(response) {
|
|
|
13584
13681
|
isFirstGroup = false;
|
|
13585
13682
|
const firstTimestamp = group.results[0].matchedEvent.createdAt;
|
|
13586
13683
|
console.log(
|
|
13587
|
-
|
|
13684
|
+
chalk35.bold(formatRunHeader(runId, group.agentName, firstTimestamp))
|
|
13588
13685
|
);
|
|
13589
13686
|
for (const result of group.results) {
|
|
13590
13687
|
const renderer = new EventRenderer({
|
|
@@ -13604,7 +13701,7 @@ function renderResults(response) {
|
|
|
13604
13701
|
if (response.hasMore) {
|
|
13605
13702
|
console.log();
|
|
13606
13703
|
console.log(
|
|
13607
|
-
|
|
13704
|
+
chalk35.dim(
|
|
13608
13705
|
` Showing first ${response.results.length} matches. Use --limit to see more.`
|
|
13609
13706
|
)
|
|
13610
13707
|
);
|
|
@@ -13625,9 +13722,9 @@ var searchCommand = new Command38().name("search").description("Search agent eve
|
|
|
13625
13722
|
after
|
|
13626
13723
|
});
|
|
13627
13724
|
if (response.results.length === 0) {
|
|
13628
|
-
console.log(
|
|
13725
|
+
console.log(chalk35.dim("No matches found"));
|
|
13629
13726
|
console.log(
|
|
13630
|
-
|
|
13727
|
+
chalk35.dim(
|
|
13631
13728
|
" Try a broader search with --since 30d or a different keyword"
|
|
13632
13729
|
)
|
|
13633
13730
|
);
|
|
@@ -13664,28 +13761,28 @@ function formatNetworkLog(entry) {
|
|
|
13664
13761
|
let statusColor;
|
|
13665
13762
|
const status = entry.status || 0;
|
|
13666
13763
|
if (status >= 200 && status < 300) {
|
|
13667
|
-
statusColor =
|
|
13764
|
+
statusColor = chalk36.green;
|
|
13668
13765
|
} else if (status >= 300 && status < 400) {
|
|
13669
|
-
statusColor =
|
|
13766
|
+
statusColor = chalk36.yellow;
|
|
13670
13767
|
} else if (status >= 400) {
|
|
13671
|
-
statusColor =
|
|
13768
|
+
statusColor = chalk36.red;
|
|
13672
13769
|
} else {
|
|
13673
|
-
statusColor =
|
|
13770
|
+
statusColor = chalk36.gray;
|
|
13674
13771
|
}
|
|
13675
13772
|
let latencyColor;
|
|
13676
13773
|
const latencyMs = entry.latency_ms || 0;
|
|
13677
13774
|
if (latencyMs < 500) {
|
|
13678
|
-
latencyColor =
|
|
13775
|
+
latencyColor = chalk36.green;
|
|
13679
13776
|
} else if (latencyMs < 2e3) {
|
|
13680
|
-
latencyColor =
|
|
13777
|
+
latencyColor = chalk36.yellow;
|
|
13681
13778
|
} else {
|
|
13682
|
-
latencyColor =
|
|
13779
|
+
latencyColor = chalk36.red;
|
|
13683
13780
|
}
|
|
13684
13781
|
const method = entry.method || "???";
|
|
13685
13782
|
const requestSize = entry.request_size || 0;
|
|
13686
13783
|
const responseSize = entry.response_size || 0;
|
|
13687
13784
|
const url = entry.url || entry.host || "unknown";
|
|
13688
|
-
return `[${entry.timestamp}] ${method.padEnd(6)} ${statusColor(status)} ${latencyColor(latencyMs + "ms")} ${formatBytes(requestSize)}/${formatBytes(responseSize)} ${
|
|
13785
|
+
return `[${entry.timestamp}] ${method.padEnd(6)} ${statusColor(status)} ${latencyColor(latencyMs + "ms")} ${formatBytes(requestSize)}/${formatBytes(responseSize)} ${chalk36.dim(url)}`;
|
|
13689
13786
|
}
|
|
13690
13787
|
function createLogRenderer(verbose) {
|
|
13691
13788
|
return new EventRenderer({
|
|
@@ -13791,7 +13888,7 @@ async function showAgentEvents(runId, options, platformUrl) {
|
|
|
13791
13888
|
order: options.order
|
|
13792
13889
|
});
|
|
13793
13890
|
if (firstResponse.events.length === 0) {
|
|
13794
|
-
console.log(
|
|
13891
|
+
console.log(chalk36.yellow("No agent events found for this run"));
|
|
13795
13892
|
return;
|
|
13796
13893
|
}
|
|
13797
13894
|
const framework = firstResponse.framework;
|
|
@@ -13824,7 +13921,7 @@ async function showAgentEvents(runId, options, platformUrl) {
|
|
|
13824
13921
|
for (const event of events) {
|
|
13825
13922
|
renderAgentEvent(event, framework, renderer);
|
|
13826
13923
|
}
|
|
13827
|
-
console.log(
|
|
13924
|
+
console.log(chalk36.dim(`View on platform: ${platformUrl}`));
|
|
13828
13925
|
}
|
|
13829
13926
|
async function showSystemLog(runId, options) {
|
|
13830
13927
|
const limit = options.targetCount === "all" ? PAGE_LIMIT : Math.min(options.targetCount, PAGE_LIMIT);
|
|
@@ -13834,7 +13931,7 @@ async function showSystemLog(runId, options) {
|
|
|
13834
13931
|
order: options.order
|
|
13835
13932
|
});
|
|
13836
13933
|
if (!response.systemLog) {
|
|
13837
|
-
console.log(
|
|
13934
|
+
console.log(chalk36.yellow("No system log found for this run"));
|
|
13838
13935
|
return;
|
|
13839
13936
|
}
|
|
13840
13937
|
console.log(response.systemLog);
|
|
@@ -13846,7 +13943,7 @@ async function showMetrics(runId, options) {
|
|
|
13846
13943
|
order: options.order
|
|
13847
13944
|
});
|
|
13848
13945
|
if (firstResponse.metrics.length === 0) {
|
|
13849
|
-
console.log(
|
|
13946
|
+
console.log(chalk36.yellow("No metrics found for this run"));
|
|
13850
13947
|
return;
|
|
13851
13948
|
}
|
|
13852
13949
|
let allMetrics;
|
|
@@ -13886,7 +13983,7 @@ async function showNetworkLogs(runId, options) {
|
|
|
13886
13983
|
});
|
|
13887
13984
|
if (firstResponse.networkLogs.length === 0) {
|
|
13888
13985
|
console.log(
|
|
13889
|
-
|
|
13986
|
+
chalk36.yellow(
|
|
13890
13987
|
"No network logs found for this run. Network logs are only captured when using a runner with proxy enabled"
|
|
13891
13988
|
)
|
|
13892
13989
|
);
|
|
@@ -13927,13 +14024,13 @@ import { Command as Command48 } from "commander";
|
|
|
13927
14024
|
|
|
13928
14025
|
// src/commands/org/status.ts
|
|
13929
14026
|
import { Command as Command40 } from "commander";
|
|
13930
|
-
import
|
|
14027
|
+
import chalk37 from "chalk";
|
|
13931
14028
|
var statusCommand5 = new Command40().name("status").description("View current organization status").action(
|
|
13932
14029
|
withErrorHandler(async () => {
|
|
13933
14030
|
try {
|
|
13934
14031
|
const org = await getOrg();
|
|
13935
|
-
console.log(
|
|
13936
|
-
console.log(` Slug: ${
|
|
14032
|
+
console.log(chalk37.bold("Organization Information:"));
|
|
14033
|
+
console.log(` Slug: ${chalk37.green(org.slug)}`);
|
|
13937
14034
|
} catch (error) {
|
|
13938
14035
|
if (error instanceof Error && error.message.includes("No org configured")) {
|
|
13939
14036
|
throw new Error("No organization configured", {
|
|
@@ -13947,7 +14044,7 @@ var statusCommand5 = new Command40().name("status").description("View current or
|
|
|
13947
14044
|
|
|
13948
14045
|
// src/commands/org/set.ts
|
|
13949
14046
|
import { Command as Command41 } from "commander";
|
|
13950
|
-
import
|
|
14047
|
+
import chalk38 from "chalk";
|
|
13951
14048
|
var setCommand = new Command41().name("set").description("Rename your organization slug").argument("<slug>", "The new organization slug").option(
|
|
13952
14049
|
"--force",
|
|
13953
14050
|
"Force change existing organization (may break references)"
|
|
@@ -13965,10 +14062,10 @@ var setCommand = new Command41().name("set").description("Rename your organizati
|
|
|
13965
14062
|
}
|
|
13966
14063
|
const org = await updateOrg({ slug, force: true });
|
|
13967
14064
|
await saveConfig({ activeOrg: org.slug });
|
|
13968
|
-
console.log(
|
|
14065
|
+
console.log(chalk38.green(`\u2713 Organization updated to ${org.slug}`));
|
|
13969
14066
|
console.log();
|
|
13970
14067
|
console.log("Your agents will now be namespaced as:");
|
|
13971
|
-
console.log(
|
|
14068
|
+
console.log(chalk38.cyan(` ${org.slug}/<agent-name>`));
|
|
13972
14069
|
} catch (error) {
|
|
13973
14070
|
if (error instanceof Error && error.message.includes("already exists")) {
|
|
13974
14071
|
throw new Error(
|
|
@@ -13982,17 +14079,17 @@ var setCommand = new Command41().name("set").description("Rename your organizati
|
|
|
13982
14079
|
|
|
13983
14080
|
// src/commands/org/list.ts
|
|
13984
14081
|
import { Command as Command42 } from "commander";
|
|
13985
|
-
import
|
|
14082
|
+
import chalk39 from "chalk";
|
|
13986
14083
|
var listCommand5 = new Command42().name("list").description("List all accessible organizations").action(
|
|
13987
14084
|
withErrorHandler(async () => {
|
|
13988
14085
|
const result = await listOrgs();
|
|
13989
14086
|
const activeOrg = await getActiveOrg();
|
|
13990
|
-
console.log(
|
|
14087
|
+
console.log(chalk39.bold("Available organizations:"));
|
|
13991
14088
|
for (const org of result.orgs) {
|
|
13992
14089
|
const isCurrent = org.slug === activeOrg;
|
|
13993
|
-
const marker = isCurrent ?
|
|
14090
|
+
const marker = isCurrent ? chalk39.green("* ") : " ";
|
|
13994
14091
|
const roleLabel = org.role ? ` (${org.role})` : "";
|
|
13995
|
-
const currentLabel = isCurrent ?
|
|
14092
|
+
const currentLabel = isCurrent ? chalk39.dim(" \u2190 current") : "";
|
|
13996
14093
|
console.log(`${marker}${org.slug}${roleLabel}${currentLabel}`);
|
|
13997
14094
|
}
|
|
13998
14095
|
})
|
|
@@ -14000,13 +14097,13 @@ var listCommand5 = new Command42().name("list").description("List all accessible
|
|
|
14000
14097
|
|
|
14001
14098
|
// src/commands/org/use.ts
|
|
14002
14099
|
import { Command as Command43 } from "commander";
|
|
14003
|
-
import
|
|
14100
|
+
import chalk40 from "chalk";
|
|
14004
14101
|
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
14102
|
withErrorHandler(
|
|
14006
14103
|
async (slug, options) => {
|
|
14007
14104
|
if (options.personal) {
|
|
14008
14105
|
await saveConfig({ activeOrg: void 0 });
|
|
14009
|
-
console.log(
|
|
14106
|
+
console.log(chalk40.green("\u2713 Switched to personal org."));
|
|
14010
14107
|
return;
|
|
14011
14108
|
}
|
|
14012
14109
|
if (!slug) {
|
|
@@ -14022,27 +14119,27 @@ var useCommand = new Command43().name("use").description("Switch to a different
|
|
|
14022
14119
|
);
|
|
14023
14120
|
}
|
|
14024
14121
|
await saveConfig({ activeOrg: slug });
|
|
14025
|
-
console.log(
|
|
14122
|
+
console.log(chalk40.green(`\u2713 Switched to organization: ${slug}`));
|
|
14026
14123
|
}
|
|
14027
14124
|
)
|
|
14028
14125
|
);
|
|
14029
14126
|
|
|
14030
14127
|
// src/commands/org/members.ts
|
|
14031
14128
|
import { Command as Command44 } from "commander";
|
|
14032
|
-
import
|
|
14129
|
+
import chalk41 from "chalk";
|
|
14033
14130
|
var membersCommand = new Command44().name("members").description("View organization members").action(
|
|
14034
14131
|
withErrorHandler(async () => {
|
|
14035
14132
|
try {
|
|
14036
14133
|
const status = await getOrgMembers();
|
|
14037
|
-
console.log(
|
|
14134
|
+
console.log(chalk41.bold(`Organization: ${status.slug}`));
|
|
14038
14135
|
console.log(` Role: ${status.role}`);
|
|
14039
14136
|
console.log(
|
|
14040
14137
|
` Created: ${new Date(status.createdAt).toLocaleDateString()}`
|
|
14041
14138
|
);
|
|
14042
14139
|
console.log();
|
|
14043
|
-
console.log(
|
|
14140
|
+
console.log(chalk41.bold("Members:"));
|
|
14044
14141
|
for (const member of status.members) {
|
|
14045
|
-
const roleTag = member.role === "admin" ?
|
|
14142
|
+
const roleTag = member.role === "admin" ? chalk41.yellow(` (${member.role})`) : chalk41.dim(` (${member.role})`);
|
|
14046
14143
|
console.log(` ${member.email}${roleTag}`);
|
|
14047
14144
|
}
|
|
14048
14145
|
} catch (error) {
|
|
@@ -14058,33 +14155,33 @@ var membersCommand = new Command44().name("members").description("View organizat
|
|
|
14058
14155
|
|
|
14059
14156
|
// src/commands/org/invite.ts
|
|
14060
14157
|
import { Command as Command45 } from "commander";
|
|
14061
|
-
import
|
|
14158
|
+
import chalk42 from "chalk";
|
|
14062
14159
|
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
14160
|
withErrorHandler(async (options) => {
|
|
14064
14161
|
await inviteOrgMember(options.email);
|
|
14065
|
-
console.log(
|
|
14162
|
+
console.log(chalk42.green(`\u2713 Invitation sent to ${options.email}`));
|
|
14066
14163
|
})
|
|
14067
14164
|
);
|
|
14068
14165
|
|
|
14069
14166
|
// src/commands/org/remove.ts
|
|
14070
14167
|
import { Command as Command46 } from "commander";
|
|
14071
|
-
import
|
|
14168
|
+
import chalk43 from "chalk";
|
|
14072
14169
|
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
14170
|
withErrorHandler(async (email) => {
|
|
14074
14171
|
await removeOrgMember(email);
|
|
14075
|
-
console.log(
|
|
14172
|
+
console.log(chalk43.green(`\u2713 Removed ${email} from organization`));
|
|
14076
14173
|
})
|
|
14077
14174
|
);
|
|
14078
14175
|
|
|
14079
14176
|
// src/commands/org/leave.ts
|
|
14080
14177
|
import { Command as Command47 } from "commander";
|
|
14081
|
-
import
|
|
14178
|
+
import chalk44 from "chalk";
|
|
14082
14179
|
var leaveCommand = new Command47().name("leave").description("Leave the current organization").action(
|
|
14083
14180
|
withErrorHandler(async () => {
|
|
14084
14181
|
await leaveOrg();
|
|
14085
14182
|
await saveConfig({ activeOrg: void 0 });
|
|
14086
14183
|
console.log(
|
|
14087
|
-
|
|
14184
|
+
chalk44.green("\u2713 Left organization. Switched to personal org.")
|
|
14088
14185
|
);
|
|
14089
14186
|
})
|
|
14090
14187
|
);
|
|
@@ -14097,7 +14194,7 @@ import { Command as Command58 } from "commander";
|
|
|
14097
14194
|
|
|
14098
14195
|
// src/commands/agent/clone.ts
|
|
14099
14196
|
import { Command as Command49 } from "commander";
|
|
14100
|
-
import
|
|
14197
|
+
import chalk45 from "chalk";
|
|
14101
14198
|
import { mkdtempSync as mkdtempSync5 } from "fs";
|
|
14102
14199
|
import { mkdir as mkdir7, writeFile as writeFile6, readdir as readdir2, copyFile, rm as rm4 } from "fs/promises";
|
|
14103
14200
|
import { join as join10, dirname as dirname3, resolve, sep } from "path";
|
|
@@ -14128,13 +14225,13 @@ async function downloadInstructions(agentName, instructionsPath, destination) {
|
|
|
14128
14225
|
throw new Error("Invalid instructions path: path traversal detected");
|
|
14129
14226
|
}
|
|
14130
14227
|
const volumeName = getInstructionsStorageName(agentName);
|
|
14131
|
-
console.log(
|
|
14228
|
+
console.log(chalk45.dim("Downloading instructions..."));
|
|
14132
14229
|
const downloadInfo = await getStorageDownload({
|
|
14133
14230
|
name: volumeName,
|
|
14134
14231
|
type: "volume"
|
|
14135
14232
|
});
|
|
14136
14233
|
if ("empty" in downloadInfo) {
|
|
14137
|
-
console.log(
|
|
14234
|
+
console.log(chalk45.yellow("\u26A0 Instructions volume is empty"));
|
|
14138
14235
|
return false;
|
|
14139
14236
|
}
|
|
14140
14237
|
const response = await fetch(downloadInfo.url);
|
|
@@ -14149,7 +14246,7 @@ async function downloadInstructions(agentName, instructionsPath, destination) {
|
|
|
14149
14246
|
const files = await readdir2(tmpDir);
|
|
14150
14247
|
const mdFile = files.find((f) => f === "CLAUDE.md" || f === "AGENTS.md");
|
|
14151
14248
|
if (!mdFile) {
|
|
14152
|
-
console.log(
|
|
14249
|
+
console.log(chalk45.yellow("\u26A0 No instructions file found in volume"));
|
|
14153
14250
|
await rm4(tmpDir, { recursive: true, force: true });
|
|
14154
14251
|
return false;
|
|
14155
14252
|
}
|
|
@@ -14179,7 +14276,7 @@ var cloneCommand4 = new Command49().name("clone").description("Clone agent compo
|
|
|
14179
14276
|
await mkdir7(targetDir, { recursive: true });
|
|
14180
14277
|
const yamlPath = join10(targetDir, "vm0.yaml");
|
|
14181
14278
|
await writeFile6(yamlPath, yamlContent, "utf8");
|
|
14182
|
-
console.log(
|
|
14279
|
+
console.log(chalk45.green("\u2713 Created vm0.yaml"));
|
|
14183
14280
|
const agentKey = Object.keys(content.agents)[0];
|
|
14184
14281
|
const agent = agentKey ? content.agents[agentKey] : void 0;
|
|
14185
14282
|
if (agent?.instructions) {
|
|
@@ -14190,26 +14287,26 @@ var cloneCommand4 = new Command49().name("clone").description("Clone agent compo
|
|
|
14190
14287
|
targetDir
|
|
14191
14288
|
);
|
|
14192
14289
|
if (instructionsDownloaded) {
|
|
14193
|
-
console.log(
|
|
14290
|
+
console.log(chalk45.green(`\u2713 Downloaded ${agent.instructions}`));
|
|
14194
14291
|
}
|
|
14195
14292
|
} catch (error) {
|
|
14196
14293
|
console.log(
|
|
14197
|
-
|
|
14294
|
+
chalk45.yellow(
|
|
14198
14295
|
`\u26A0 Could not download instructions: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
14199
14296
|
)
|
|
14200
14297
|
);
|
|
14201
14298
|
}
|
|
14202
14299
|
}
|
|
14203
14300
|
console.log();
|
|
14204
|
-
console.log(
|
|
14205
|
-
console.log(
|
|
14206
|
-
console.log(
|
|
14301
|
+
console.log(chalk45.green(`\u2713 Successfully cloned agent: ${name}`));
|
|
14302
|
+
console.log(chalk45.dim(` Location: ${targetDir}/`));
|
|
14303
|
+
console.log(chalk45.dim(` Version: ${compose.headVersionId.slice(0, 8)}`));
|
|
14207
14304
|
})
|
|
14208
14305
|
);
|
|
14209
14306
|
|
|
14210
14307
|
// src/commands/agent/delete.ts
|
|
14211
14308
|
import { Command as Command50 } from "commander";
|
|
14212
|
-
import
|
|
14309
|
+
import chalk46 from "chalk";
|
|
14213
14310
|
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
14311
|
withErrorHandler(async (name, options) => {
|
|
14215
14312
|
const compose = await getComposeByName(name);
|
|
@@ -14224,7 +14321,7 @@ var deleteCommand = new Command50().name("delete").alias("rm").description("Dele
|
|
|
14224
14321
|
}
|
|
14225
14322
|
const confirmed = await promptConfirm(`Delete agent '${name}'?`, false);
|
|
14226
14323
|
if (!confirmed) {
|
|
14227
|
-
console.log(
|
|
14324
|
+
console.log(chalk46.dim("Cancelled"));
|
|
14228
14325
|
return;
|
|
14229
14326
|
}
|
|
14230
14327
|
}
|
|
@@ -14238,13 +14335,13 @@ var deleteCommand = new Command50().name("delete").alias("rm").description("Dele
|
|
|
14238
14335
|
}
|
|
14239
14336
|
throw error;
|
|
14240
14337
|
}
|
|
14241
|
-
console.log(
|
|
14338
|
+
console.log(chalk46.green(`\u2713 Agent '${name}' deleted`));
|
|
14242
14339
|
})
|
|
14243
14340
|
);
|
|
14244
14341
|
|
|
14245
14342
|
// src/commands/agent/list.ts
|
|
14246
14343
|
import { Command as Command51 } from "commander";
|
|
14247
|
-
import
|
|
14344
|
+
import chalk47 from "chalk";
|
|
14248
14345
|
var listCommand6 = new Command51().name("list").alias("ls").description("List all agent composes").action(
|
|
14249
14346
|
withErrorHandler(async () => {
|
|
14250
14347
|
const response = await httpGet("/api/agent/composes/list");
|
|
@@ -14254,19 +14351,19 @@ var listCommand6 = new Command51().name("list").alias("ls").description("List al
|
|
|
14254
14351
|
}
|
|
14255
14352
|
const data = await response.json();
|
|
14256
14353
|
if (data.composes.length === 0) {
|
|
14257
|
-
console.log(
|
|
14354
|
+
console.log(chalk47.dim("No agent composes found"));
|
|
14258
14355
|
console.log(
|
|
14259
|
-
|
|
14356
|
+
chalk47.dim(" Create one with: vm0 compose <agent-compose.yaml>")
|
|
14260
14357
|
);
|
|
14261
14358
|
return;
|
|
14262
14359
|
}
|
|
14263
|
-
const nameWidth = Math.max(4, ...data.composes.map((
|
|
14360
|
+
const nameWidth = Math.max(4, ...data.composes.map((c24) => c24.name.length));
|
|
14264
14361
|
const header = ["NAME".padEnd(nameWidth), "VERSION", "UPDATED"].join(
|
|
14265
14362
|
" "
|
|
14266
14363
|
);
|
|
14267
|
-
console.log(
|
|
14364
|
+
console.log(chalk47.dim(header));
|
|
14268
14365
|
for (const compose of data.composes) {
|
|
14269
|
-
const versionShort = compose.headVersionId ? compose.headVersionId.slice(0, 8) :
|
|
14366
|
+
const versionShort = compose.headVersionId ? compose.headVersionId.slice(0, 8) : chalk47.dim("-");
|
|
14270
14367
|
const row = [
|
|
14271
14368
|
compose.name.padEnd(nameWidth),
|
|
14272
14369
|
versionShort,
|
|
@@ -14279,7 +14376,7 @@ var listCommand6 = new Command51().name("list").alias("ls").description("List al
|
|
|
14279
14376
|
|
|
14280
14377
|
// src/commands/agent/status.ts
|
|
14281
14378
|
import { Command as Command52 } from "commander";
|
|
14282
|
-
import
|
|
14379
|
+
import chalk48 from "chalk";
|
|
14283
14380
|
|
|
14284
14381
|
// src/lib/domain/source-derivation.ts
|
|
14285
14382
|
import * as fs10 from "fs/promises";
|
|
@@ -14393,20 +14490,20 @@ function formatVariableSources(sources) {
|
|
|
14393
14490
|
if (sources.secrets.length > 0) {
|
|
14394
14491
|
console.log(` Secrets:`);
|
|
14395
14492
|
for (const secret of sources.secrets) {
|
|
14396
|
-
const sourceInfo =
|
|
14493
|
+
const sourceInfo = chalk48.dim(`(${secret.source})`);
|
|
14397
14494
|
console.log(` - ${secret.name.padEnd(20)} ${sourceInfo}`);
|
|
14398
14495
|
}
|
|
14399
14496
|
}
|
|
14400
14497
|
if (sources.vars.length > 0) {
|
|
14401
14498
|
console.log(` Vars:`);
|
|
14402
14499
|
for (const v of sources.vars) {
|
|
14403
|
-
const sourceInfo =
|
|
14500
|
+
const sourceInfo = chalk48.dim(`(${v.source})`);
|
|
14404
14501
|
console.log(` - ${v.name.padEnd(20)} ${sourceInfo}`);
|
|
14405
14502
|
}
|
|
14406
14503
|
}
|
|
14407
14504
|
}
|
|
14408
14505
|
function formatAgentDetails(agentName, agent, agentSources, volumeConfigs) {
|
|
14409
|
-
console.log(` ${
|
|
14506
|
+
console.log(` ${chalk48.cyan(agentName)}:`);
|
|
14410
14507
|
console.log(` Framework: ${agent.framework}`);
|
|
14411
14508
|
if (agent.image) {
|
|
14412
14509
|
console.log(` Image: ${agent.image}`);
|
|
@@ -14424,10 +14521,10 @@ function formatAgentDetails(agentName, agent, agentSources, volumeConfigs) {
|
|
|
14424
14521
|
}
|
|
14425
14522
|
}
|
|
14426
14523
|
function formatComposeOutput(name, versionId, content, variableSources) {
|
|
14427
|
-
console.log(
|
|
14428
|
-
console.log(
|
|
14524
|
+
console.log(chalk48.bold("Name:") + ` ${name}`);
|
|
14525
|
+
console.log(chalk48.bold("Version:") + ` ${versionId}`);
|
|
14429
14526
|
console.log();
|
|
14430
|
-
console.log(
|
|
14527
|
+
console.log(chalk48.bold("Agents:"));
|
|
14431
14528
|
for (const [agentName, agent] of Object.entries(content.agents)) {
|
|
14432
14529
|
const agentSources = variableSources?.get(agentName);
|
|
14433
14530
|
formatAgentDetails(agentName, agent, agentSources, content.volumes);
|
|
@@ -14486,7 +14583,7 @@ var statusCommand6 = new Command52().name("status").description("Show status of
|
|
|
14486
14583
|
});
|
|
14487
14584
|
} catch {
|
|
14488
14585
|
console.error(
|
|
14489
|
-
|
|
14586
|
+
chalk48.yellow(
|
|
14490
14587
|
"\u26A0 Warning: Failed to fetch skill sources, showing basic info"
|
|
14491
14588
|
)
|
|
14492
14589
|
);
|
|
@@ -14503,7 +14600,7 @@ var statusCommand6 = new Command52().name("status").description("Show status of
|
|
|
14503
14600
|
|
|
14504
14601
|
// src/commands/agent/public.ts
|
|
14505
14602
|
import { Command as Command53 } from "commander";
|
|
14506
|
-
import
|
|
14603
|
+
import chalk49 from "chalk";
|
|
14507
14604
|
var publicCommand = new Command53().name("public").description("Make an agent public (accessible to all authenticated users)").argument("<name>", "Agent name").option(
|
|
14508
14605
|
"--experimental-shared-agent",
|
|
14509
14606
|
"Enable experimental agent sharing feature"
|
|
@@ -14532,7 +14629,7 @@ var publicCommand = new Command53().name("public").description("Make an agent pu
|
|
|
14532
14629
|
if (!response.ok) {
|
|
14533
14630
|
const error = await response.json();
|
|
14534
14631
|
if (response.status === 409) {
|
|
14535
|
-
console.log(
|
|
14632
|
+
console.log(chalk49.yellow(`Agent "${name}" is already public`));
|
|
14536
14633
|
return;
|
|
14537
14634
|
}
|
|
14538
14635
|
throw new Error(
|
|
@@ -14540,11 +14637,11 @@ var publicCommand = new Command53().name("public").description("Make an agent pu
|
|
|
14540
14637
|
);
|
|
14541
14638
|
}
|
|
14542
14639
|
const fullName = `${org.slug}/${name}`;
|
|
14543
|
-
console.log(
|
|
14640
|
+
console.log(chalk49.green(`\u2713 Agent "${name}" is now public`));
|
|
14544
14641
|
console.log();
|
|
14545
14642
|
console.log("Others can now run your agent with:");
|
|
14546
14643
|
console.log(
|
|
14547
|
-
|
|
14644
|
+
chalk49.cyan(
|
|
14548
14645
|
` vm0 run ${fullName} --experimental-shared-agent "your prompt"`
|
|
14549
14646
|
)
|
|
14550
14647
|
);
|
|
@@ -14554,7 +14651,7 @@ var publicCommand = new Command53().name("public").description("Make an agent pu
|
|
|
14554
14651
|
|
|
14555
14652
|
// src/commands/agent/private.ts
|
|
14556
14653
|
import { Command as Command54 } from "commander";
|
|
14557
|
-
import
|
|
14654
|
+
import chalk50 from "chalk";
|
|
14558
14655
|
var privateCommand = new Command54().name("private").description("Make an agent private (remove public access)").argument("<name>", "Agent name").option(
|
|
14559
14656
|
"--experimental-shared-agent",
|
|
14560
14657
|
"Enable experimental agent sharing feature"
|
|
@@ -14581,21 +14678,21 @@ var privateCommand = new Command54().name("private").description("Make an agent
|
|
|
14581
14678
|
if (!response.ok) {
|
|
14582
14679
|
const error = await response.json();
|
|
14583
14680
|
if (response.status === 404) {
|
|
14584
|
-
console.log(
|
|
14681
|
+
console.log(chalk50.yellow(`Agent "${name}" is already private`));
|
|
14585
14682
|
return;
|
|
14586
14683
|
}
|
|
14587
14684
|
throw new Error(
|
|
14588
14685
|
error.error?.message || "Failed to make agent private"
|
|
14589
14686
|
);
|
|
14590
14687
|
}
|
|
14591
|
-
console.log(
|
|
14688
|
+
console.log(chalk50.green(`\u2713 Agent "${name}" is now private`));
|
|
14592
14689
|
}
|
|
14593
14690
|
)
|
|
14594
14691
|
);
|
|
14595
14692
|
|
|
14596
14693
|
// src/commands/agent/share.ts
|
|
14597
14694
|
import { Command as Command55 } from "commander";
|
|
14598
|
-
import
|
|
14695
|
+
import chalk51 from "chalk";
|
|
14599
14696
|
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
14697
|
"--experimental-shared-agent",
|
|
14601
14698
|
"Enable experimental agent sharing feature"
|
|
@@ -14625,7 +14722,7 @@ var shareCommand = new Command55().name("share").description("Share an agent wit
|
|
|
14625
14722
|
const error = await response.json();
|
|
14626
14723
|
if (response.status === 409) {
|
|
14627
14724
|
console.log(
|
|
14628
|
-
|
|
14725
|
+
chalk51.yellow(
|
|
14629
14726
|
`Agent "${name}" is already shared with ${options.email}`
|
|
14630
14727
|
)
|
|
14631
14728
|
);
|
|
@@ -14635,12 +14732,12 @@ var shareCommand = new Command55().name("share").description("Share an agent wit
|
|
|
14635
14732
|
}
|
|
14636
14733
|
const fullName = `${org.slug}/${name}`;
|
|
14637
14734
|
console.log(
|
|
14638
|
-
|
|
14735
|
+
chalk51.green(`\u2713 Agent "${name}" shared with ${options.email}`)
|
|
14639
14736
|
);
|
|
14640
14737
|
console.log();
|
|
14641
14738
|
console.log("They can now run your agent with:");
|
|
14642
14739
|
console.log(
|
|
14643
|
-
|
|
14740
|
+
chalk51.cyan(
|
|
14644
14741
|
` vm0 run ${fullName} --experimental-shared-agent "your prompt"`
|
|
14645
14742
|
)
|
|
14646
14743
|
);
|
|
@@ -14650,7 +14747,7 @@ var shareCommand = new Command55().name("share").description("Share an agent wit
|
|
|
14650
14747
|
|
|
14651
14748
|
// src/commands/agent/unshare.ts
|
|
14652
14749
|
import { Command as Command56 } from "commander";
|
|
14653
|
-
import
|
|
14750
|
+
import chalk52 from "chalk";
|
|
14654
14751
|
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
14752
|
"--experimental-shared-agent",
|
|
14656
14753
|
"Enable experimental agent sharing feature"
|
|
@@ -14678,7 +14775,7 @@ var unshareCommand = new Command56().name("unshare").description("Remove sharing
|
|
|
14678
14775
|
const error = await response.json();
|
|
14679
14776
|
if (response.status === 404) {
|
|
14680
14777
|
console.log(
|
|
14681
|
-
|
|
14778
|
+
chalk52.yellow(
|
|
14682
14779
|
`Agent "${name}" is not shared with ${options.email}`
|
|
14683
14780
|
)
|
|
14684
14781
|
);
|
|
@@ -14687,7 +14784,7 @@ var unshareCommand = new Command56().name("unshare").description("Remove sharing
|
|
|
14687
14784
|
throw new Error(error.error?.message || "Failed to unshare agent");
|
|
14688
14785
|
}
|
|
14689
14786
|
console.log(
|
|
14690
|
-
|
|
14787
|
+
chalk52.green(`\u2713 Removed sharing of "${name}" from ${options.email}`)
|
|
14691
14788
|
);
|
|
14692
14789
|
}
|
|
14693
14790
|
)
|
|
@@ -14695,7 +14792,7 @@ var unshareCommand = new Command56().name("unshare").description("Remove sharing
|
|
|
14695
14792
|
|
|
14696
14793
|
// src/commands/agent/permission.ts
|
|
14697
14794
|
import { Command as Command57 } from "commander";
|
|
14698
|
-
import
|
|
14795
|
+
import chalk53 from "chalk";
|
|
14699
14796
|
var permissionCommand = new Command57().name("permission").description("List all permissions for an agent").argument("<name>", "Agent name").option(
|
|
14700
14797
|
"--experimental-shared-agent",
|
|
14701
14798
|
"Enable experimental agent sharing feature"
|
|
@@ -14725,16 +14822,16 @@ var permissionCommand = new Command57().name("permission").description("List all
|
|
|
14725
14822
|
}
|
|
14726
14823
|
const data = await response.json();
|
|
14727
14824
|
if (data.permissions.length === 0) {
|
|
14728
|
-
console.log(
|
|
14825
|
+
console.log(chalk53.dim("No permissions set (private agent)"));
|
|
14729
14826
|
return;
|
|
14730
14827
|
}
|
|
14731
14828
|
console.log(
|
|
14732
|
-
|
|
14829
|
+
chalk53.dim(
|
|
14733
14830
|
"TYPE EMAIL PERMISSION GRANTED"
|
|
14734
14831
|
)
|
|
14735
14832
|
);
|
|
14736
14833
|
console.log(
|
|
14737
|
-
|
|
14834
|
+
chalk53.dim(
|
|
14738
14835
|
"------- ----------------------------- ---------- ----------"
|
|
14739
14836
|
)
|
|
14740
14837
|
);
|
|
@@ -14754,7 +14851,7 @@ var agentCommand = new Command58().name("agent").description("Manage agent compo
|
|
|
14754
14851
|
|
|
14755
14852
|
// src/commands/init/index.ts
|
|
14756
14853
|
import { Command as Command59 } from "commander";
|
|
14757
|
-
import
|
|
14854
|
+
import chalk54 from "chalk";
|
|
14758
14855
|
import path17 from "path";
|
|
14759
14856
|
import { existsSync as existsSync11 } from "fs";
|
|
14760
14857
|
import { writeFile as writeFile7 } from "fs/promises";
|
|
@@ -14821,7 +14918,7 @@ var initCommand4 = new Command59().name("init").description("Initialize a new VM
|
|
|
14821
14918
|
}
|
|
14822
14919
|
);
|
|
14823
14920
|
if (name === void 0) {
|
|
14824
|
-
console.log(
|
|
14921
|
+
console.log(chalk54.dim("Cancelled"));
|
|
14825
14922
|
return;
|
|
14826
14923
|
}
|
|
14827
14924
|
agentName = name;
|
|
@@ -14835,23 +14932,23 @@ var initCommand4 = new Command59().name("init").description("Initialize a new VM
|
|
|
14835
14932
|
}
|
|
14836
14933
|
await writeFile7(VM0_YAML_FILE, generateVm0Yaml(agentName));
|
|
14837
14934
|
const vm0Status = existingFiles.includes(VM0_YAML_FILE) ? " (overwritten)" : "";
|
|
14838
|
-
console.log(
|
|
14935
|
+
console.log(chalk54.green(`\u2713 Created ${VM0_YAML_FILE}${vm0Status}`));
|
|
14839
14936
|
await writeFile7(AGENTS_MD_FILE, generateAgentsMd());
|
|
14840
14937
|
const agentsStatus = existingFiles.includes(AGENTS_MD_FILE) ? " (overwritten)" : "";
|
|
14841
|
-
console.log(
|
|
14938
|
+
console.log(chalk54.green(`\u2713 Created ${AGENTS_MD_FILE}${agentsStatus}`));
|
|
14842
14939
|
console.log();
|
|
14843
14940
|
console.log("Next steps:");
|
|
14844
14941
|
console.log(
|
|
14845
|
-
` 1. Set up model provider (one-time): ${
|
|
14942
|
+
` 1. Set up model provider (one-time): ${chalk54.cyan("vm0 model-provider setup")}`
|
|
14846
14943
|
);
|
|
14847
14944
|
console.log(
|
|
14848
|
-
` 2. Edit ${
|
|
14945
|
+
` 2. Edit ${chalk54.cyan("AGENTS.md")} to customize your agent's workflow`
|
|
14849
14946
|
);
|
|
14850
14947
|
console.log(
|
|
14851
|
-
` Or install Claude plugin: ${
|
|
14948
|
+
` Or install Claude plugin: ${chalk54.cyan(`vm0 setup-claude && claude "/vm0-agent let's build an agent"`)}`
|
|
14852
14949
|
);
|
|
14853
14950
|
console.log(
|
|
14854
|
-
` 3. Run your agent: ${
|
|
14951
|
+
` 3. Run your agent: ${chalk54.cyan(`vm0 cook "let's start working"`)}`
|
|
14855
14952
|
);
|
|
14856
14953
|
})
|
|
14857
14954
|
);
|
|
@@ -14861,7 +14958,7 @@ import { Command as Command66 } from "commander";
|
|
|
14861
14958
|
|
|
14862
14959
|
// src/commands/schedule/setup.ts
|
|
14863
14960
|
import { Command as Command60 } from "commander";
|
|
14864
|
-
import
|
|
14961
|
+
import chalk55 from "chalk";
|
|
14865
14962
|
|
|
14866
14963
|
// src/lib/domain/schedule-utils.ts
|
|
14867
14964
|
import { parse as parseYaml5 } from "yaml";
|
|
@@ -15112,7 +15209,7 @@ async function gatherFrequency(optionFrequency, existingFrequency) {
|
|
|
15112
15209
|
if (!isInteractive()) {
|
|
15113
15210
|
throw new Error("--frequency is required (daily|weekly|monthly|once|loop)");
|
|
15114
15211
|
}
|
|
15115
|
-
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((
|
|
15212
|
+
const defaultIndex = existingFrequency ? FREQUENCY_CHOICES.findIndex((c24) => c24.value === existingFrequency) : 0;
|
|
15116
15213
|
frequency = await promptSelect(
|
|
15117
15214
|
"Schedule frequency",
|
|
15118
15215
|
FREQUENCY_CHOICES,
|
|
@@ -15137,7 +15234,7 @@ async function gatherDay(frequency, optionDay, existingDay) {
|
|
|
15137
15234
|
throw new Error("--day is required for weekly/monthly");
|
|
15138
15235
|
}
|
|
15139
15236
|
if (frequency === "weekly") {
|
|
15140
|
-
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((
|
|
15237
|
+
const defaultDayIndex = existingDay !== void 0 ? DAY_OF_WEEK_CHOICES.findIndex((c24) => c24.value === existingDay) : 0;
|
|
15141
15238
|
const day2 = await promptSelect(
|
|
15142
15239
|
"Day of week",
|
|
15143
15240
|
DAY_OF_WEEK_CHOICES,
|
|
@@ -15328,7 +15425,7 @@ async function buildAndDeploy(params) {
|
|
|
15328
15425
|
}
|
|
15329
15426
|
console.log(
|
|
15330
15427
|
`
|
|
15331
|
-
Deploying schedule for agent ${
|
|
15428
|
+
Deploying schedule for agent ${chalk55.cyan(params.agentName)}...`
|
|
15332
15429
|
);
|
|
15333
15430
|
const deployResult = await deploySchedule({
|
|
15334
15431
|
name: params.scheduleName,
|
|
@@ -15345,62 +15442,62 @@ Deploying schedule for agent ${chalk54.cyan(params.agentName)}...`
|
|
|
15345
15442
|
function displayDeployResult(agentName, deployResult) {
|
|
15346
15443
|
if (deployResult.created) {
|
|
15347
15444
|
console.log(
|
|
15348
|
-
|
|
15445
|
+
chalk55.green(`\u2713 Created schedule for agent ${chalk55.cyan(agentName)}`)
|
|
15349
15446
|
);
|
|
15350
15447
|
} else {
|
|
15351
15448
|
console.log(
|
|
15352
|
-
|
|
15449
|
+
chalk55.green(`\u2713 Updated schedule for agent ${chalk55.cyan(agentName)}`)
|
|
15353
15450
|
);
|
|
15354
15451
|
}
|
|
15355
|
-
console.log(
|
|
15452
|
+
console.log(chalk55.dim(` Timezone: ${deployResult.schedule.timezone}`));
|
|
15356
15453
|
if (deployResult.schedule.triggerType === "loop" && deployResult.schedule.intervalSeconds != null) {
|
|
15357
15454
|
console.log(
|
|
15358
|
-
|
|
15455
|
+
chalk55.dim(
|
|
15359
15456
|
` Mode: Loop (interval ${deployResult.schedule.intervalSeconds}s)`
|
|
15360
15457
|
)
|
|
15361
15458
|
);
|
|
15362
15459
|
} else if (deployResult.schedule.cronExpression) {
|
|
15363
|
-
console.log(
|
|
15460
|
+
console.log(chalk55.dim(` Cron: ${deployResult.schedule.cronExpression}`));
|
|
15364
15461
|
if (deployResult.schedule.nextRunAt) {
|
|
15365
15462
|
const nextRun = formatInTimezone(
|
|
15366
15463
|
deployResult.schedule.nextRunAt,
|
|
15367
15464
|
deployResult.schedule.timezone
|
|
15368
15465
|
);
|
|
15369
|
-
console.log(
|
|
15466
|
+
console.log(chalk55.dim(` Next run: ${nextRun}`));
|
|
15370
15467
|
}
|
|
15371
15468
|
} else if (deployResult.schedule.atTime) {
|
|
15372
15469
|
const atTimeFormatted = formatInTimezone(
|
|
15373
15470
|
deployResult.schedule.atTime,
|
|
15374
15471
|
deployResult.schedule.timezone
|
|
15375
15472
|
);
|
|
15376
|
-
console.log(
|
|
15473
|
+
console.log(chalk55.dim(` At: ${atTimeFormatted}`));
|
|
15377
15474
|
}
|
|
15378
15475
|
}
|
|
15379
15476
|
async function tryEnableSchedule(scheduleName, composeId, agentName) {
|
|
15380
15477
|
try {
|
|
15381
15478
|
await enableSchedule({ name: scheduleName, composeId });
|
|
15382
15479
|
console.log(
|
|
15383
|
-
|
|
15480
|
+
chalk55.green(`\u2713 Enabled schedule for agent ${chalk55.cyan(agentName)}`)
|
|
15384
15481
|
);
|
|
15385
15482
|
} catch (error) {
|
|
15386
|
-
console.error(
|
|
15483
|
+
console.error(chalk55.yellow("\u26A0 Failed to enable schedule"));
|
|
15387
15484
|
if (error instanceof ApiRequestError) {
|
|
15388
15485
|
if (error.code === "SCHEDULE_PAST") {
|
|
15389
|
-
console.error(
|
|
15486
|
+
console.error(chalk55.dim(" Scheduled time has already passed"));
|
|
15390
15487
|
} else {
|
|
15391
|
-
console.error(
|
|
15488
|
+
console.error(chalk55.dim(` ${error.message}`));
|
|
15392
15489
|
}
|
|
15393
15490
|
} else if (error instanceof Error) {
|
|
15394
|
-
console.error(
|
|
15491
|
+
console.error(chalk55.dim(` ${error.message}`));
|
|
15395
15492
|
}
|
|
15396
15493
|
console.log(
|
|
15397
|
-
` To enable manually: ${
|
|
15494
|
+
` To enable manually: ${chalk55.cyan(`vm0 schedule enable ${agentName}`)}`
|
|
15398
15495
|
);
|
|
15399
15496
|
}
|
|
15400
15497
|
}
|
|
15401
15498
|
function showEnableHint(agentName) {
|
|
15402
15499
|
console.log();
|
|
15403
|
-
console.log(` To enable: ${
|
|
15500
|
+
console.log(` To enable: ${chalk55.cyan(`vm0 schedule enable ${agentName}`)}`);
|
|
15404
15501
|
}
|
|
15405
15502
|
async function handleScheduleEnabling(params) {
|
|
15406
15503
|
const { scheduleName, composeId, agentName, enableFlag, shouldPromptEnable } = params;
|
|
@@ -15432,7 +15529,7 @@ var setupCommand = new Command60().name("setup").description("Create or edit a s
|
|
|
15432
15529
|
scheduleName
|
|
15433
15530
|
);
|
|
15434
15531
|
console.log(
|
|
15435
|
-
|
|
15532
|
+
chalk55.dim(
|
|
15436
15533
|
existingSchedule ? `Editing existing schedule for agent ${agentName}` : `Creating new schedule for agent ${agentName}`
|
|
15437
15534
|
)
|
|
15438
15535
|
);
|
|
@@ -15442,12 +15539,12 @@ var setupCommand = new Command60().name("setup").description("Create or edit a s
|
|
|
15442
15539
|
defaults.frequency
|
|
15443
15540
|
);
|
|
15444
15541
|
if (!frequency) {
|
|
15445
|
-
console.log(
|
|
15542
|
+
console.log(chalk55.dim("Cancelled"));
|
|
15446
15543
|
return;
|
|
15447
15544
|
}
|
|
15448
15545
|
const timing = await gatherTiming(frequency, options, defaults);
|
|
15449
15546
|
if (!timing) {
|
|
15450
|
-
console.log(
|
|
15547
|
+
console.log(chalk55.dim("Cancelled"));
|
|
15451
15548
|
return;
|
|
15452
15549
|
}
|
|
15453
15550
|
const { day, time, atTime, intervalSeconds } = timing;
|
|
@@ -15456,7 +15553,7 @@ var setupCommand = new Command60().name("setup").description("Create or edit a s
|
|
|
15456
15553
|
existingSchedule?.timezone
|
|
15457
15554
|
);
|
|
15458
15555
|
if (!timezone) {
|
|
15459
|
-
console.log(
|
|
15556
|
+
console.log(chalk55.dim("Cancelled"));
|
|
15460
15557
|
return;
|
|
15461
15558
|
}
|
|
15462
15559
|
const promptText_ = await gatherPromptText(
|
|
@@ -15464,7 +15561,7 @@ var setupCommand = new Command60().name("setup").description("Create or edit a s
|
|
|
15464
15561
|
existingSchedule?.prompt
|
|
15465
15562
|
);
|
|
15466
15563
|
if (!promptText_) {
|
|
15467
|
-
console.log(
|
|
15564
|
+
console.log(chalk55.dim("Cancelled"));
|
|
15468
15565
|
return;
|
|
15469
15566
|
}
|
|
15470
15567
|
const deployResult = await buildAndDeploy({
|
|
@@ -15494,14 +15591,14 @@ var setupCommand = new Command60().name("setup").description("Create or edit a s
|
|
|
15494
15591
|
|
|
15495
15592
|
// src/commands/schedule/list.ts
|
|
15496
15593
|
import { Command as Command61 } from "commander";
|
|
15497
|
-
import
|
|
15594
|
+
import chalk56 from "chalk";
|
|
15498
15595
|
var listCommand7 = new Command61().name("list").alias("ls").description("List all schedules").action(
|
|
15499
15596
|
withErrorHandler(async () => {
|
|
15500
15597
|
const result = await listSchedules();
|
|
15501
15598
|
if (result.schedules.length === 0) {
|
|
15502
|
-
console.log(
|
|
15599
|
+
console.log(chalk56.dim("No schedules found"));
|
|
15503
15600
|
console.log(
|
|
15504
|
-
|
|
15601
|
+
chalk56.dim(" Create one with: vm0 schedule setup <agent-name>")
|
|
15505
15602
|
);
|
|
15506
15603
|
return;
|
|
15507
15604
|
}
|
|
@@ -15526,10 +15623,10 @@ var listCommand7 = new Command61().name("list").alias("ls").description("List al
|
|
|
15526
15623
|
"STATUS".padEnd(8),
|
|
15527
15624
|
"NEXT RUN"
|
|
15528
15625
|
].join(" ");
|
|
15529
|
-
console.log(
|
|
15626
|
+
console.log(chalk56.dim(header));
|
|
15530
15627
|
for (const schedule of result.schedules) {
|
|
15531
15628
|
const trigger = schedule.cronExpression ? `${schedule.cronExpression} (${schedule.timezone})` : schedule.atTime || "-";
|
|
15532
|
-
const status = schedule.enabled ?
|
|
15629
|
+
const status = schedule.enabled ? chalk56.green("enabled") : chalk56.yellow("disabled");
|
|
15533
15630
|
const nextRun = schedule.enabled ? formatRelativeTime2(schedule.nextRunAt) : "-";
|
|
15534
15631
|
const row = [
|
|
15535
15632
|
schedule.composeName.padEnd(agentWidth),
|
|
@@ -15546,47 +15643,47 @@ var listCommand7 = new Command61().name("list").alias("ls").description("List al
|
|
|
15546
15643
|
|
|
15547
15644
|
// src/commands/schedule/status.ts
|
|
15548
15645
|
import { Command as Command62 } from "commander";
|
|
15549
|
-
import
|
|
15646
|
+
import chalk57 from "chalk";
|
|
15550
15647
|
function formatDateTimeStyled(dateStr) {
|
|
15551
|
-
if (!dateStr) return
|
|
15648
|
+
if (!dateStr) return chalk57.dim("-");
|
|
15552
15649
|
const formatted = formatDateTime(dateStr);
|
|
15553
|
-
return formatted.replace(/\(([^)]+)\)$/,
|
|
15650
|
+
return formatted.replace(/\(([^)]+)\)$/, chalk57.dim("($1)"));
|
|
15554
15651
|
}
|
|
15555
15652
|
function formatTrigger(schedule) {
|
|
15556
15653
|
if (schedule.triggerType === "loop" && schedule.intervalSeconds !== null) {
|
|
15557
|
-
return `interval ${schedule.intervalSeconds}s ${
|
|
15654
|
+
return `interval ${schedule.intervalSeconds}s ${chalk57.dim("(loop)")}`;
|
|
15558
15655
|
}
|
|
15559
15656
|
if (schedule.cronExpression) {
|
|
15560
15657
|
return schedule.cronExpression;
|
|
15561
15658
|
}
|
|
15562
15659
|
if (schedule.atTime) {
|
|
15563
|
-
return `${schedule.atTime} ${
|
|
15660
|
+
return `${schedule.atTime} ${chalk57.dim("(one-time)")}`;
|
|
15564
15661
|
}
|
|
15565
|
-
return
|
|
15662
|
+
return chalk57.dim("-");
|
|
15566
15663
|
}
|
|
15567
15664
|
function formatRunStatus2(status) {
|
|
15568
15665
|
switch (status) {
|
|
15569
15666
|
case "completed":
|
|
15570
|
-
return
|
|
15667
|
+
return chalk57.green(status);
|
|
15571
15668
|
case "failed":
|
|
15572
15669
|
case "timeout":
|
|
15573
|
-
return
|
|
15670
|
+
return chalk57.red(status);
|
|
15574
15671
|
case "running":
|
|
15575
|
-
return
|
|
15672
|
+
return chalk57.cyan(status);
|
|
15576
15673
|
case "pending":
|
|
15577
|
-
return
|
|
15674
|
+
return chalk57.yellow(status);
|
|
15578
15675
|
default:
|
|
15579
15676
|
return status;
|
|
15580
15677
|
}
|
|
15581
15678
|
}
|
|
15582
15679
|
function printRunConfiguration(schedule) {
|
|
15583
|
-
const statusText = schedule.enabled ?
|
|
15680
|
+
const statusText = schedule.enabled ? chalk57.green("enabled") : chalk57.yellow("disabled");
|
|
15584
15681
|
console.log(`${"Status:".padEnd(16)}${statusText}`);
|
|
15585
15682
|
console.log(
|
|
15586
|
-
`${"Agent:".padEnd(16)}${schedule.composeName} ${
|
|
15683
|
+
`${"Agent:".padEnd(16)}${schedule.composeName} ${chalk57.dim(`(${schedule.orgSlug})`)}`
|
|
15587
15684
|
);
|
|
15588
15685
|
const promptPreview = schedule.prompt.length > 60 ? schedule.prompt.slice(0, 57) + "..." : schedule.prompt;
|
|
15589
|
-
console.log(`${"Prompt:".padEnd(16)}${
|
|
15686
|
+
console.log(`${"Prompt:".padEnd(16)}${chalk57.dim(promptPreview)}`);
|
|
15590
15687
|
if (schedule.vars && Object.keys(schedule.vars).length > 0) {
|
|
15591
15688
|
console.log(
|
|
15592
15689
|
`${"Variables:".padEnd(16)}${Object.keys(schedule.vars).join(", ")}`
|
|
@@ -15615,7 +15712,7 @@ function printTimeSchedule(schedule) {
|
|
|
15615
15712
|
);
|
|
15616
15713
|
}
|
|
15617
15714
|
if (schedule.triggerType === "loop") {
|
|
15618
|
-
const failureText = schedule.consecutiveFailures > 0 ?
|
|
15715
|
+
const failureText = schedule.consecutiveFailures > 0 ? chalk57.yellow(`${schedule.consecutiveFailures}/3`) : chalk57.dim("0/3");
|
|
15619
15716
|
console.log(`${"Failures:".padEnd(16)}${failureText}`);
|
|
15620
15717
|
}
|
|
15621
15718
|
}
|
|
@@ -15631,7 +15728,7 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
15631
15728
|
console.log();
|
|
15632
15729
|
console.log("Recent Runs:");
|
|
15633
15730
|
console.log(
|
|
15634
|
-
|
|
15731
|
+
chalk57.dim("RUN ID STATUS CREATED")
|
|
15635
15732
|
);
|
|
15636
15733
|
for (const run of runs) {
|
|
15637
15734
|
const id = run.id;
|
|
@@ -15642,7 +15739,7 @@ async function printRecentRuns(name, composeId, limit) {
|
|
|
15642
15739
|
}
|
|
15643
15740
|
} catch {
|
|
15644
15741
|
console.log();
|
|
15645
|
-
console.log(
|
|
15742
|
+
console.log(chalk57.dim("Recent Runs: (unable to fetch)"));
|
|
15646
15743
|
}
|
|
15647
15744
|
}
|
|
15648
15745
|
var statusCommand7 = new Command62().name("status").description("Show detailed status of a schedule").argument("<agent-name>", "Agent name").option(
|
|
@@ -15659,8 +15756,8 @@ var statusCommand7 = new Command62().name("status").description("Show detailed s
|
|
|
15659
15756
|
const { name, composeId } = resolved;
|
|
15660
15757
|
const schedule = await getScheduleByName({ name, composeId });
|
|
15661
15758
|
console.log();
|
|
15662
|
-
console.log(`Schedule for agent: ${
|
|
15663
|
-
console.log(
|
|
15759
|
+
console.log(`Schedule for agent: ${chalk57.cyan(agentName)}`);
|
|
15760
|
+
console.log(chalk57.dim("\u2501".repeat(50)));
|
|
15664
15761
|
printRunConfiguration(schedule);
|
|
15665
15762
|
printTimeSchedule(schedule);
|
|
15666
15763
|
const parsed = parseInt(options.limit, 10);
|
|
@@ -15676,7 +15773,7 @@ var statusCommand7 = new Command62().name("status").description("Show detailed s
|
|
|
15676
15773
|
|
|
15677
15774
|
// src/commands/schedule/delete.ts
|
|
15678
15775
|
import { Command as Command63 } from "commander";
|
|
15679
|
-
import
|
|
15776
|
+
import chalk58 from "chalk";
|
|
15680
15777
|
var deleteCommand2 = new Command63().name("delete").alias("rm").description("Delete a schedule").argument("<agent-name>", "Agent name").option(
|
|
15681
15778
|
"-n, --name <schedule-name>",
|
|
15682
15779
|
"Schedule name (required when agent has multiple schedules)"
|
|
@@ -15689,11 +15786,11 @@ var deleteCommand2 = new Command63().name("delete").alias("rm").description("Del
|
|
|
15689
15786
|
throw new Error("--yes flag is required in non-interactive mode");
|
|
15690
15787
|
}
|
|
15691
15788
|
const confirmed = await promptConfirm(
|
|
15692
|
-
`Delete schedule for agent ${
|
|
15789
|
+
`Delete schedule for agent ${chalk58.cyan(agentName)}?`,
|
|
15693
15790
|
false
|
|
15694
15791
|
);
|
|
15695
15792
|
if (!confirmed) {
|
|
15696
|
-
console.log(
|
|
15793
|
+
console.log(chalk58.dim("Cancelled"));
|
|
15697
15794
|
return;
|
|
15698
15795
|
}
|
|
15699
15796
|
}
|
|
@@ -15702,7 +15799,7 @@ var deleteCommand2 = new Command63().name("delete").alias("rm").description("Del
|
|
|
15702
15799
|
composeId: resolved.composeId
|
|
15703
15800
|
});
|
|
15704
15801
|
console.log(
|
|
15705
|
-
|
|
15802
|
+
chalk58.green(`\u2713 Deleted schedule for agent ${chalk58.cyan(agentName)}`)
|
|
15706
15803
|
);
|
|
15707
15804
|
}
|
|
15708
15805
|
)
|
|
@@ -15710,7 +15807,7 @@ var deleteCommand2 = new Command63().name("delete").alias("rm").description("Del
|
|
|
15710
15807
|
|
|
15711
15808
|
// src/commands/schedule/enable.ts
|
|
15712
15809
|
import { Command as Command64 } from "commander";
|
|
15713
|
-
import
|
|
15810
|
+
import chalk59 from "chalk";
|
|
15714
15811
|
var enableCommand = new Command64().name("enable").description("Enable a schedule").argument("<agent-name>", "Agent name").option(
|
|
15715
15812
|
"-n, --name <schedule-name>",
|
|
15716
15813
|
"Schedule name (required when agent has multiple schedules)"
|
|
@@ -15722,14 +15819,14 @@ var enableCommand = new Command64().name("enable").description("Enable a schedul
|
|
|
15722
15819
|
composeId: resolved.composeId
|
|
15723
15820
|
});
|
|
15724
15821
|
console.log(
|
|
15725
|
-
|
|
15822
|
+
chalk59.green(`\u2713 Enabled schedule for agent ${chalk59.cyan(agentName)}`)
|
|
15726
15823
|
);
|
|
15727
15824
|
})
|
|
15728
15825
|
);
|
|
15729
15826
|
|
|
15730
15827
|
// src/commands/schedule/disable.ts
|
|
15731
15828
|
import { Command as Command65 } from "commander";
|
|
15732
|
-
import
|
|
15829
|
+
import chalk60 from "chalk";
|
|
15733
15830
|
var disableCommand = new Command65().name("disable").description("Disable a schedule").argument("<agent-name>", "Agent name").option(
|
|
15734
15831
|
"-n, --name <schedule-name>",
|
|
15735
15832
|
"Schedule name (required when agent has multiple schedules)"
|
|
@@ -15741,7 +15838,7 @@ var disableCommand = new Command65().name("disable").description("Disable a sche
|
|
|
15741
15838
|
composeId: resolved.composeId
|
|
15742
15839
|
});
|
|
15743
15840
|
console.log(
|
|
15744
|
-
|
|
15841
|
+
chalk60.green(`\u2713 Disabled schedule for agent ${chalk60.cyan(agentName)}`)
|
|
15745
15842
|
);
|
|
15746
15843
|
})
|
|
15747
15844
|
);
|
|
@@ -15751,7 +15848,7 @@ var scheduleCommand = new Command66().name("schedule").description("Manage agent
|
|
|
15751
15848
|
|
|
15752
15849
|
// src/commands/usage/index.ts
|
|
15753
15850
|
import { Command as Command67 } from "commander";
|
|
15754
|
-
import
|
|
15851
|
+
import chalk61 from "chalk";
|
|
15755
15852
|
|
|
15756
15853
|
// src/lib/utils/duration-formatter.ts
|
|
15757
15854
|
function formatDuration(ms) {
|
|
@@ -15876,19 +15973,19 @@ var usageCommand = new Command67().name("usage").description("View usage statist
|
|
|
15876
15973
|
);
|
|
15877
15974
|
console.log();
|
|
15878
15975
|
console.log(
|
|
15879
|
-
|
|
15976
|
+
chalk61.bold(
|
|
15880
15977
|
`Usage Summary (${formatDateRange(usage.period.start, usage.period.end)})`
|
|
15881
15978
|
)
|
|
15882
15979
|
);
|
|
15883
15980
|
console.log();
|
|
15884
|
-
console.log(
|
|
15981
|
+
console.log(chalk61.dim("DATE RUNS RUN TIME"));
|
|
15885
15982
|
for (const day of filledDaily) {
|
|
15886
15983
|
const dateDisplay = formatDateDisplay(day.date).padEnd(10);
|
|
15887
15984
|
const runsDisplay = String(day.run_count).padStart(6);
|
|
15888
15985
|
const timeDisplay = formatDuration(day.run_time_ms);
|
|
15889
15986
|
console.log(`${dateDisplay}${runsDisplay} ${timeDisplay}`);
|
|
15890
15987
|
}
|
|
15891
|
-
console.log(
|
|
15988
|
+
console.log(chalk61.dim("\u2500".repeat(29)));
|
|
15892
15989
|
const totalRunsDisplay = String(usage.summary.total_runs).padStart(6);
|
|
15893
15990
|
const totalTimeDisplay = formatDuration(usage.summary.total_run_time_ms);
|
|
15894
15991
|
console.log(
|
|
@@ -15903,62 +16000,62 @@ import { Command as Command71 } from "commander";
|
|
|
15903
16000
|
|
|
15904
16001
|
// src/commands/secret/list.ts
|
|
15905
16002
|
import { Command as Command68 } from "commander";
|
|
15906
|
-
import
|
|
16003
|
+
import chalk62 from "chalk";
|
|
15907
16004
|
var listCommand8 = new Command68().name("list").alias("ls").description("List all secrets").action(
|
|
15908
16005
|
withErrorHandler(async () => {
|
|
15909
16006
|
const result = await listSecrets();
|
|
15910
16007
|
if (result.secrets.length === 0) {
|
|
15911
|
-
console.log(
|
|
16008
|
+
console.log(chalk62.dim("No secrets found"));
|
|
15912
16009
|
console.log();
|
|
15913
16010
|
console.log("To add a secret:");
|
|
15914
|
-
console.log(
|
|
16011
|
+
console.log(chalk62.cyan(" vm0 secret set MY_API_KEY --body <value>"));
|
|
15915
16012
|
return;
|
|
15916
16013
|
}
|
|
15917
|
-
console.log(
|
|
16014
|
+
console.log(chalk62.bold("Secrets:"));
|
|
15918
16015
|
console.log();
|
|
15919
16016
|
for (const secret of result.secrets) {
|
|
15920
16017
|
let typeIndicator = "";
|
|
15921
16018
|
let derivedLine = null;
|
|
15922
16019
|
if (secret.type === "model-provider") {
|
|
15923
|
-
typeIndicator =
|
|
16020
|
+
typeIndicator = chalk62.dim(" [model-provider]");
|
|
15924
16021
|
} else if (secret.type === "connector") {
|
|
15925
16022
|
const derived = getConnectorDerivedNames(secret.name);
|
|
15926
16023
|
if (derived) {
|
|
15927
|
-
typeIndicator =
|
|
15928
|
-
derivedLine =
|
|
16024
|
+
typeIndicator = chalk62.dim(` [${derived.connectorLabel} connector]`);
|
|
16025
|
+
derivedLine = chalk62.dim(
|
|
15929
16026
|
`Available as: ${derived.envVarNames.join(", ")}`
|
|
15930
16027
|
);
|
|
15931
16028
|
} else {
|
|
15932
|
-
typeIndicator =
|
|
16029
|
+
typeIndicator = chalk62.dim(" [connector]");
|
|
15933
16030
|
}
|
|
15934
16031
|
} else if (secret.type === "user") {
|
|
15935
16032
|
const derived = getConnectorDerivedNames(secret.name);
|
|
15936
16033
|
if (derived) {
|
|
15937
|
-
typeIndicator =
|
|
15938
|
-
derivedLine =
|
|
16034
|
+
typeIndicator = chalk62.dim(` [${derived.connectorLabel} connector]`);
|
|
16035
|
+
derivedLine = chalk62.dim(
|
|
15939
16036
|
`Available as: ${derived.envVarNames.join(", ")}`
|
|
15940
16037
|
);
|
|
15941
16038
|
}
|
|
15942
16039
|
}
|
|
15943
|
-
console.log(` ${
|
|
16040
|
+
console.log(` ${chalk62.cyan(secret.name)}${typeIndicator}`);
|
|
15944
16041
|
if (derivedLine) {
|
|
15945
16042
|
console.log(` ${derivedLine}`);
|
|
15946
16043
|
}
|
|
15947
16044
|
if (secret.description) {
|
|
15948
|
-
console.log(` ${
|
|
16045
|
+
console.log(` ${chalk62.dim(secret.description)}`);
|
|
15949
16046
|
}
|
|
15950
16047
|
console.log(
|
|
15951
|
-
` ${
|
|
16048
|
+
` ${chalk62.dim(`Updated: ${new Date(secret.updatedAt).toLocaleString()}`)}`
|
|
15952
16049
|
);
|
|
15953
16050
|
console.log();
|
|
15954
16051
|
}
|
|
15955
|
-
console.log(
|
|
16052
|
+
console.log(chalk62.dim(`Total: ${result.secrets.length} secret(s)`));
|
|
15956
16053
|
})
|
|
15957
16054
|
);
|
|
15958
16055
|
|
|
15959
16056
|
// src/commands/secret/set.ts
|
|
15960
16057
|
import { Command as Command69 } from "commander";
|
|
15961
|
-
import
|
|
16058
|
+
import chalk63 from "chalk";
|
|
15962
16059
|
var setCommand2 = new Command69().name("set").description("Create or update a secret").argument("<name>", "Secret name (uppercase, e.g., MY_API_KEY)").option(
|
|
15963
16060
|
"-b, --body <value>",
|
|
15964
16061
|
"Secret value (required in non-interactive mode)"
|
|
@@ -15998,18 +16095,18 @@ var setCommand2 = new Command69().name("set").description("Create or update a se
|
|
|
15998
16095
|
}
|
|
15999
16096
|
throw error;
|
|
16000
16097
|
}
|
|
16001
|
-
console.log(
|
|
16098
|
+
console.log(chalk63.green(`\u2713 Secret "${secret.name}" saved`));
|
|
16002
16099
|
console.log();
|
|
16003
16100
|
console.log("Use in vm0.yaml:");
|
|
16004
|
-
console.log(
|
|
16005
|
-
console.log(
|
|
16101
|
+
console.log(chalk63.cyan(` environment:`));
|
|
16102
|
+
console.log(chalk63.cyan(` ${name}: \${{ secrets.${name} }}`));
|
|
16006
16103
|
}
|
|
16007
16104
|
)
|
|
16008
16105
|
);
|
|
16009
16106
|
|
|
16010
16107
|
// src/commands/secret/delete.ts
|
|
16011
16108
|
import { Command as Command70 } from "commander";
|
|
16012
|
-
import
|
|
16109
|
+
import chalk64 from "chalk";
|
|
16013
16110
|
var deleteCommand3 = new Command70().name("delete").description("Delete a secret").argument("<name>", "Secret name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
16014
16111
|
withErrorHandler(async (name, options) => {
|
|
16015
16112
|
try {
|
|
@@ -16029,12 +16126,12 @@ var deleteCommand3 = new Command70().name("delete").description("Delete a secret
|
|
|
16029
16126
|
false
|
|
16030
16127
|
);
|
|
16031
16128
|
if (!confirmed) {
|
|
16032
|
-
console.log(
|
|
16129
|
+
console.log(chalk64.dim("Cancelled"));
|
|
16033
16130
|
return;
|
|
16034
16131
|
}
|
|
16035
16132
|
}
|
|
16036
16133
|
await deleteSecret(name);
|
|
16037
|
-
console.log(
|
|
16134
|
+
console.log(chalk64.green(`\u2713 Secret "${name}" deleted`));
|
|
16038
16135
|
})
|
|
16039
16136
|
);
|
|
16040
16137
|
|
|
@@ -16046,7 +16143,7 @@ import { Command as Command75 } from "commander";
|
|
|
16046
16143
|
|
|
16047
16144
|
// src/commands/variable/list.ts
|
|
16048
16145
|
import { Command as Command72 } from "commander";
|
|
16049
|
-
import
|
|
16146
|
+
import chalk65 from "chalk";
|
|
16050
16147
|
function truncateValue(value, maxLength = 60) {
|
|
16051
16148
|
if (value.length <= maxLength) {
|
|
16052
16149
|
return value;
|
|
@@ -16057,32 +16154,32 @@ var listCommand9 = new Command72().name("list").alias("ls").description("List al
|
|
|
16057
16154
|
withErrorHandler(async () => {
|
|
16058
16155
|
const result = await listVariables();
|
|
16059
16156
|
if (result.variables.length === 0) {
|
|
16060
|
-
console.log(
|
|
16157
|
+
console.log(chalk65.dim("No variables found"));
|
|
16061
16158
|
console.log();
|
|
16062
16159
|
console.log("To add a variable:");
|
|
16063
|
-
console.log(
|
|
16160
|
+
console.log(chalk65.cyan(" vm0 variable set MY_VAR <value>"));
|
|
16064
16161
|
return;
|
|
16065
16162
|
}
|
|
16066
|
-
console.log(
|
|
16163
|
+
console.log(chalk65.bold("Variables:"));
|
|
16067
16164
|
console.log();
|
|
16068
16165
|
for (const variable of result.variables) {
|
|
16069
16166
|
const displayValue = truncateValue(variable.value);
|
|
16070
|
-
console.log(` ${
|
|
16167
|
+
console.log(` ${chalk65.cyan(variable.name)} = ${displayValue}`);
|
|
16071
16168
|
if (variable.description) {
|
|
16072
|
-
console.log(` ${
|
|
16169
|
+
console.log(` ${chalk65.dim(variable.description)}`);
|
|
16073
16170
|
}
|
|
16074
16171
|
console.log(
|
|
16075
|
-
` ${
|
|
16172
|
+
` ${chalk65.dim(`Updated: ${new Date(variable.updatedAt).toLocaleString()}`)}`
|
|
16076
16173
|
);
|
|
16077
16174
|
console.log();
|
|
16078
16175
|
}
|
|
16079
|
-
console.log(
|
|
16176
|
+
console.log(chalk65.dim(`Total: ${result.variables.length} variable(s)`));
|
|
16080
16177
|
})
|
|
16081
16178
|
);
|
|
16082
16179
|
|
|
16083
16180
|
// src/commands/variable/set.ts
|
|
16084
16181
|
import { Command as Command73 } from "commander";
|
|
16085
|
-
import
|
|
16182
|
+
import chalk66 from "chalk";
|
|
16086
16183
|
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
16184
|
withErrorHandler(
|
|
16088
16185
|
async (name, value, options) => {
|
|
@@ -16103,18 +16200,18 @@ var setCommand3 = new Command73().name("set").description("Create or update a va
|
|
|
16103
16200
|
}
|
|
16104
16201
|
throw error;
|
|
16105
16202
|
}
|
|
16106
|
-
console.log(
|
|
16203
|
+
console.log(chalk66.green(`\u2713 Variable "${variable.name}" saved`));
|
|
16107
16204
|
console.log();
|
|
16108
16205
|
console.log("Use in vm0.yaml:");
|
|
16109
|
-
console.log(
|
|
16110
|
-
console.log(
|
|
16206
|
+
console.log(chalk66.cyan(` environment:`));
|
|
16207
|
+
console.log(chalk66.cyan(` ${name}: \${{ vars.${name} }}`));
|
|
16111
16208
|
}
|
|
16112
16209
|
)
|
|
16113
16210
|
);
|
|
16114
16211
|
|
|
16115
16212
|
// src/commands/variable/delete.ts
|
|
16116
16213
|
import { Command as Command74 } from "commander";
|
|
16117
|
-
import
|
|
16214
|
+
import chalk67 from "chalk";
|
|
16118
16215
|
var deleteCommand4 = new Command74().name("delete").description("Delete a variable").argument("<name>", "Variable name to delete").option("-y, --yes", "Skip confirmation prompt").action(
|
|
16119
16216
|
withErrorHandler(async (name, options) => {
|
|
16120
16217
|
try {
|
|
@@ -16134,12 +16231,12 @@ var deleteCommand4 = new Command74().name("delete").description("Delete a variab
|
|
|
16134
16231
|
false
|
|
16135
16232
|
);
|
|
16136
16233
|
if (!confirmed) {
|
|
16137
|
-
console.log(
|
|
16234
|
+
console.log(chalk67.dim("Cancelled"));
|
|
16138
16235
|
return;
|
|
16139
16236
|
}
|
|
16140
16237
|
}
|
|
16141
16238
|
await deleteVariable(name);
|
|
16142
|
-
console.log(
|
|
16239
|
+
console.log(chalk67.green(`\u2713 Variable "${name}" deleted`));
|
|
16143
16240
|
})
|
|
16144
16241
|
);
|
|
16145
16242
|
|
|
@@ -16151,15 +16248,15 @@ import { Command as Command80 } from "commander";
|
|
|
16151
16248
|
|
|
16152
16249
|
// src/commands/model-provider/list.ts
|
|
16153
16250
|
import { Command as Command76 } from "commander";
|
|
16154
|
-
import
|
|
16251
|
+
import chalk68 from "chalk";
|
|
16155
16252
|
var listCommand10 = new Command76().name("list").alias("ls").description("List all model providers").action(
|
|
16156
16253
|
withErrorHandler(async () => {
|
|
16157
16254
|
const result = await listModelProviders();
|
|
16158
16255
|
if (result.modelProviders.length === 0) {
|
|
16159
|
-
console.log(
|
|
16256
|
+
console.log(chalk68.dim("No model providers configured"));
|
|
16160
16257
|
console.log();
|
|
16161
16258
|
console.log("To add a model provider:");
|
|
16162
|
-
console.log(
|
|
16259
|
+
console.log(chalk68.cyan(" vm0 model-provider setup"));
|
|
16163
16260
|
return;
|
|
16164
16261
|
}
|
|
16165
16262
|
const byFramework = result.modelProviders.reduce(
|
|
@@ -16173,16 +16270,16 @@ var listCommand10 = new Command76().name("list").alias("ls").description("List a
|
|
|
16173
16270
|
},
|
|
16174
16271
|
{}
|
|
16175
16272
|
);
|
|
16176
|
-
console.log(
|
|
16273
|
+
console.log(chalk68.bold("Model Providers:"));
|
|
16177
16274
|
console.log();
|
|
16178
16275
|
for (const [framework, providers] of Object.entries(byFramework)) {
|
|
16179
|
-
console.log(` ${
|
|
16276
|
+
console.log(` ${chalk68.cyan(framework)}:`);
|
|
16180
16277
|
for (const provider of providers) {
|
|
16181
|
-
const defaultTag = provider.isDefault ?
|
|
16182
|
-
const modelTag = provider.selectedModel ?
|
|
16278
|
+
const defaultTag = provider.isDefault ? chalk68.green(" (default)") : "";
|
|
16279
|
+
const modelTag = provider.selectedModel ? chalk68.dim(` [${provider.selectedModel}]`) : "";
|
|
16183
16280
|
console.log(` ${provider.type}${defaultTag}${modelTag}`);
|
|
16184
16281
|
console.log(
|
|
16185
|
-
|
|
16282
|
+
chalk68.dim(
|
|
16186
16283
|
` Updated: ${new Date(provider.updatedAt).toLocaleString()}`
|
|
16187
16284
|
)
|
|
16188
16285
|
);
|
|
@@ -16190,14 +16287,14 @@ var listCommand10 = new Command76().name("list").alias("ls").description("List a
|
|
|
16190
16287
|
console.log();
|
|
16191
16288
|
}
|
|
16192
16289
|
console.log(
|
|
16193
|
-
|
|
16290
|
+
chalk68.dim(`Total: ${result.modelProviders.length} provider(s)`)
|
|
16194
16291
|
);
|
|
16195
16292
|
})
|
|
16196
16293
|
);
|
|
16197
16294
|
|
|
16198
16295
|
// src/commands/model-provider/setup.ts
|
|
16199
16296
|
import { Command as Command77 } from "commander";
|
|
16200
|
-
import
|
|
16297
|
+
import chalk69 from "chalk";
|
|
16201
16298
|
import prompts2 from "prompts";
|
|
16202
16299
|
function validateProviderType(typeStr) {
|
|
16203
16300
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
@@ -16381,7 +16478,7 @@ async function promptForModelSelection(type2) {
|
|
|
16381
16478
|
if (selected === "__custom__") {
|
|
16382
16479
|
const placeholder = getCustomModelPlaceholder(type2);
|
|
16383
16480
|
if (placeholder) {
|
|
16384
|
-
console.log(
|
|
16481
|
+
console.log(chalk69.dim(`Example: ${placeholder}`));
|
|
16385
16482
|
}
|
|
16386
16483
|
const customResponse = await prompts2(
|
|
16387
16484
|
{
|
|
@@ -16431,7 +16528,7 @@ async function promptForSecrets(type2, authMethod) {
|
|
|
16431
16528
|
const secrets = {};
|
|
16432
16529
|
for (const [name, fieldConfig] of Object.entries(secretsConfig)) {
|
|
16433
16530
|
if (fieldConfig.helpText) {
|
|
16434
|
-
console.log(
|
|
16531
|
+
console.log(chalk69.dim(fieldConfig.helpText));
|
|
16435
16532
|
}
|
|
16436
16533
|
const isSensitive = isSensitiveSecret(name);
|
|
16437
16534
|
const placeholder = "placeholder" in fieldConfig ? fieldConfig.placeholder : "";
|
|
@@ -16483,7 +16580,7 @@ async function handleInteractiveMode() {
|
|
|
16483
16580
|
title = `${title} \u2713`;
|
|
16484
16581
|
}
|
|
16485
16582
|
if (isExperimental) {
|
|
16486
|
-
title = `${title} ${
|
|
16583
|
+
title = `${title} ${chalk69.dim("(experimental)")}`;
|
|
16487
16584
|
}
|
|
16488
16585
|
return {
|
|
16489
16586
|
title,
|
|
@@ -16530,7 +16627,7 @@ async function handleInteractiveMode() {
|
|
|
16530
16627
|
}
|
|
16531
16628
|
const config = MODEL_PROVIDER_TYPES[type2];
|
|
16532
16629
|
console.log();
|
|
16533
|
-
console.log(
|
|
16630
|
+
console.log(chalk69.dim(config.helpText));
|
|
16534
16631
|
console.log();
|
|
16535
16632
|
if (hasAuthMethods(type2)) {
|
|
16536
16633
|
const authMethod = await promptForAuthMethod(type2);
|
|
@@ -16571,7 +16668,7 @@ async function promptSetAsDefault(type2, framework, isDefault) {
|
|
|
16571
16668
|
);
|
|
16572
16669
|
if (response.setDefault) {
|
|
16573
16670
|
await setModelProviderDefault(type2);
|
|
16574
|
-
console.log(
|
|
16671
|
+
console.log(chalk69.green(`\u2713 Default for ${framework} set to "${type2}"`));
|
|
16575
16672
|
}
|
|
16576
16673
|
}
|
|
16577
16674
|
function collectSecrets(value, previous) {
|
|
@@ -16615,11 +16712,11 @@ var setupCommand2 = new Command77().name("setup").description("Configure a model
|
|
|
16615
16712
|
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
16616
16713
|
if (!hasModelSelection(input.type)) {
|
|
16617
16714
|
console.log(
|
|
16618
|
-
|
|
16715
|
+
chalk69.green(`\u2713 Model provider "${input.type}" unchanged`)
|
|
16619
16716
|
);
|
|
16620
16717
|
} else {
|
|
16621
16718
|
console.log(
|
|
16622
|
-
|
|
16719
|
+
chalk69.green(
|
|
16623
16720
|
`\u2713 Model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
16624
16721
|
)
|
|
16625
16722
|
);
|
|
@@ -16644,7 +16741,7 @@ var setupCommand2 = new Command77().name("setup").description("Configure a model
|
|
|
16644
16741
|
const defaultNote = provider.isDefault ? ` (default for ${provider.framework})` : "";
|
|
16645
16742
|
const modelNote = provider.selectedModel ? ` with model: ${provider.selectedModel}` : "";
|
|
16646
16743
|
console.log(
|
|
16647
|
-
|
|
16744
|
+
chalk69.green(
|
|
16648
16745
|
`\u2713 Model provider "${input.type}" ${action}${defaultNote}${modelNote}`
|
|
16649
16746
|
)
|
|
16650
16747
|
);
|
|
@@ -16661,7 +16758,7 @@ var setupCommand2 = new Command77().name("setup").description("Configure a model
|
|
|
16661
16758
|
|
|
16662
16759
|
// src/commands/model-provider/delete.ts
|
|
16663
16760
|
import { Command as Command78 } from "commander";
|
|
16664
|
-
import
|
|
16761
|
+
import chalk70 from "chalk";
|
|
16665
16762
|
var deleteCommand5 = new Command78().name("delete").description("Delete a model provider").argument("<type>", "Model provider type to delete").action(
|
|
16666
16763
|
withErrorHandler(async (type2) => {
|
|
16667
16764
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
@@ -16671,13 +16768,13 @@ var deleteCommand5 = new Command78().name("delete").description("Delete a model
|
|
|
16671
16768
|
});
|
|
16672
16769
|
}
|
|
16673
16770
|
await deleteModelProvider(type2);
|
|
16674
|
-
console.log(
|
|
16771
|
+
console.log(chalk70.green(`\u2713 Model provider "${type2}" deleted`));
|
|
16675
16772
|
})
|
|
16676
16773
|
);
|
|
16677
16774
|
|
|
16678
16775
|
// src/commands/model-provider/set-default.ts
|
|
16679
16776
|
import { Command as Command79 } from "commander";
|
|
16680
|
-
import
|
|
16777
|
+
import chalk71 from "chalk";
|
|
16681
16778
|
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
16779
|
withErrorHandler(async (type2) => {
|
|
16683
16780
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(type2)) {
|
|
@@ -16688,7 +16785,7 @@ var setDefaultCommand = new Command79().name("set-default").description("Set a m
|
|
|
16688
16785
|
}
|
|
16689
16786
|
const provider = await setModelProviderDefault(type2);
|
|
16690
16787
|
console.log(
|
|
16691
|
-
|
|
16788
|
+
chalk71.green(
|
|
16692
16789
|
`\u2713 Default for ${provider.framework} set to "${provider.type}"`
|
|
16693
16790
|
)
|
|
16694
16791
|
);
|
|
@@ -16703,7 +16800,7 @@ import { Command as Command85 } from "commander";
|
|
|
16703
16800
|
|
|
16704
16801
|
// src/commands/connector/connect.ts
|
|
16705
16802
|
import { Command as Command81 } from "commander";
|
|
16706
|
-
import
|
|
16803
|
+
import chalk73 from "chalk";
|
|
16707
16804
|
import { initClient as initClient13 } from "@ts-rest/core";
|
|
16708
16805
|
|
|
16709
16806
|
// src/commands/connector/lib/computer/start-services.ts
|
|
@@ -16712,7 +16809,7 @@ import { access as access2, constants } from "fs/promises";
|
|
|
16712
16809
|
import { createServer } from "net";
|
|
16713
16810
|
import { homedir as homedir4 } from "os";
|
|
16714
16811
|
import { join as join12 } from "path";
|
|
16715
|
-
import
|
|
16812
|
+
import chalk72 from "chalk";
|
|
16716
16813
|
|
|
16717
16814
|
// src/commands/connector/lib/computer/ngrok.ts
|
|
16718
16815
|
import ngrok from "@ngrok/ngrok";
|
|
@@ -16786,7 +16883,7 @@ async function checkComputerDependencies() {
|
|
|
16786
16883
|
}
|
|
16787
16884
|
}
|
|
16788
16885
|
async function startComputerServices(credentials) {
|
|
16789
|
-
console.log(
|
|
16886
|
+
console.log(chalk72.cyan("Starting computer connector services..."));
|
|
16790
16887
|
const wsgidavBinary = await findBinary("wsgidav");
|
|
16791
16888
|
if (!wsgidavBinary) {
|
|
16792
16889
|
throw new Error(
|
|
@@ -16813,7 +16910,7 @@ async function startComputerServices(credentials) {
|
|
|
16813
16910
|
);
|
|
16814
16911
|
wsgidav.stdout?.on("data", (data) => process.stdout.write(data));
|
|
16815
16912
|
wsgidav.stderr?.on("data", (data) => process.stderr.write(data));
|
|
16816
|
-
console.log(
|
|
16913
|
+
console.log(chalk72.green("\u2713 WebDAV server started"));
|
|
16817
16914
|
const chrome = spawn2(
|
|
16818
16915
|
chromeBinary,
|
|
16819
16916
|
[
|
|
@@ -16827,7 +16924,7 @@ async function startComputerServices(credentials) {
|
|
|
16827
16924
|
);
|
|
16828
16925
|
chrome.stdout?.on("data", (data) => process.stdout.write(data));
|
|
16829
16926
|
chrome.stderr?.on("data", (data) => process.stderr.write(data));
|
|
16830
|
-
console.log(
|
|
16927
|
+
console.log(chalk72.green("\u2713 Chrome started"));
|
|
16831
16928
|
try {
|
|
16832
16929
|
await startNgrokTunnels(
|
|
16833
16930
|
credentials.ngrokToken,
|
|
@@ -16836,18 +16933,18 @@ async function startComputerServices(credentials) {
|
|
|
16836
16933
|
cdpPort
|
|
16837
16934
|
);
|
|
16838
16935
|
console.log(
|
|
16839
|
-
|
|
16936
|
+
chalk72.green(
|
|
16840
16937
|
`\u2713 ngrok tunnels: webdav.${credentials.domain}, chrome.${credentials.domain}`
|
|
16841
16938
|
)
|
|
16842
16939
|
);
|
|
16843
16940
|
console.log();
|
|
16844
|
-
console.log(
|
|
16941
|
+
console.log(chalk72.green("\u2713 Computer connector active"));
|
|
16845
16942
|
console.log(` WebDAV: ~/Downloads \u2192 webdav.${credentials.domain}`);
|
|
16846
16943
|
console.log(
|
|
16847
16944
|
` Chrome CDP: port ${cdpPort} \u2192 chrome.${credentials.domain}`
|
|
16848
16945
|
);
|
|
16849
16946
|
console.log();
|
|
16850
|
-
console.log(
|
|
16947
|
+
console.log(chalk72.dim("Press ^C twice to disconnect"));
|
|
16851
16948
|
console.log();
|
|
16852
16949
|
let sigintCount = 0;
|
|
16853
16950
|
await new Promise((resolve2) => {
|
|
@@ -16861,7 +16958,7 @@ async function startComputerServices(credentials) {
|
|
|
16861
16958
|
const onSigint = () => {
|
|
16862
16959
|
sigintCount++;
|
|
16863
16960
|
if (sigintCount === 1) {
|
|
16864
|
-
console.log(
|
|
16961
|
+
console.log(chalk72.dim("\nPress ^C again to disconnect and exit..."));
|
|
16865
16962
|
} else {
|
|
16866
16963
|
done();
|
|
16867
16964
|
}
|
|
@@ -16871,11 +16968,11 @@ async function startComputerServices(credentials) {
|
|
|
16871
16968
|
});
|
|
16872
16969
|
} finally {
|
|
16873
16970
|
console.log();
|
|
16874
|
-
console.log(
|
|
16971
|
+
console.log(chalk72.cyan("Stopping services..."));
|
|
16875
16972
|
wsgidav.kill("SIGTERM");
|
|
16876
16973
|
chrome.kill("SIGTERM");
|
|
16877
16974
|
await stopNgrokTunnels();
|
|
16878
|
-
console.log(
|
|
16975
|
+
console.log(chalk72.green("\u2713 Services stopped"));
|
|
16879
16976
|
}
|
|
16880
16977
|
}
|
|
16881
16978
|
|
|
@@ -16900,10 +16997,10 @@ async function getHeaders2() {
|
|
|
16900
16997
|
function renderHelpText(text) {
|
|
16901
16998
|
return text.replace(
|
|
16902
16999
|
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
16903
|
-
(_m, label, url) => `${label} (${
|
|
16904
|
-
).replace(/\*\*([^*]+)\*\*/g, (_m, content) =>
|
|
17000
|
+
(_m, label, url) => `${label} (${chalk73.cyan(url)})`
|
|
17001
|
+
).replace(/\*\*([^*]+)\*\*/g, (_m, content) => chalk73.bold(content)).replace(
|
|
16905
17002
|
/^> (.+)$/gm,
|
|
16906
|
-
(_m, content) =>
|
|
17003
|
+
(_m, content) => chalk73.yellow(` ${content}`)
|
|
16907
17004
|
);
|
|
16908
17005
|
}
|
|
16909
17006
|
async function connectViaApiToken(connectorType, tokenValue) {
|
|
@@ -16928,7 +17025,7 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
16928
17025
|
for (const [secretName, secretConfig] of secretEntries) {
|
|
16929
17026
|
if (!secretConfig.required) continue;
|
|
16930
17027
|
const value = await promptPassword(
|
|
16931
|
-
`${secretConfig.label}${secretConfig.placeholder ?
|
|
17028
|
+
`${secretConfig.label}${secretConfig.placeholder ? chalk73.dim(` (${secretConfig.placeholder})`) : ""}:`
|
|
16932
17029
|
);
|
|
16933
17030
|
if (!value) {
|
|
16934
17031
|
throw new Error("Cancelled");
|
|
@@ -16944,13 +17041,13 @@ async function connectViaApiToken(connectorType, tokenValue) {
|
|
|
16944
17041
|
});
|
|
16945
17042
|
}
|
|
16946
17043
|
console.log(
|
|
16947
|
-
|
|
17044
|
+
chalk73.green(`
|
|
16948
17045
|
\u2713 ${config.label} connected successfully via API token!`)
|
|
16949
17046
|
);
|
|
16950
17047
|
}
|
|
16951
17048
|
async function connectComputer(apiUrl, headers) {
|
|
16952
17049
|
await checkComputerDependencies();
|
|
16953
|
-
console.log(
|
|
17050
|
+
console.log(chalk73.cyan("Setting up computer connector..."));
|
|
16954
17051
|
const computerClient = initClient13(computerConnectorContract, {
|
|
16955
17052
|
baseUrl: apiUrl,
|
|
16956
17053
|
baseHeaders: headers,
|
|
@@ -16965,9 +17062,9 @@ async function connectComputer(apiUrl, headers) {
|
|
|
16965
17062
|
}
|
|
16966
17063
|
const credentials = createResult.body;
|
|
16967
17064
|
await startComputerServices(credentials);
|
|
16968
|
-
console.log(
|
|
17065
|
+
console.log(chalk73.cyan("Disconnecting computer connector..."));
|
|
16969
17066
|
await deleteConnector("computer");
|
|
16970
|
-
console.log(
|
|
17067
|
+
console.log(chalk73.green("\u2713 Disconnected computer"));
|
|
16971
17068
|
process.exit(0);
|
|
16972
17069
|
}
|
|
16973
17070
|
async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
@@ -17006,7 +17103,7 @@ async function resolveAuthMethod(connectorType, tokenFlag) {
|
|
|
17006
17103
|
);
|
|
17007
17104
|
}
|
|
17008
17105
|
async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
17009
|
-
console.log(`Connecting ${
|
|
17106
|
+
console.log(`Connecting ${chalk73.cyan(connectorType)}...`);
|
|
17010
17107
|
const sessionsClient = initClient13(connectorSessionsContract, {
|
|
17011
17108
|
baseUrl: apiUrl,
|
|
17012
17109
|
baseHeaders: headers,
|
|
@@ -17022,8 +17119,8 @@ async function connectViaOAuth(connectorType, apiUrl, headers) {
|
|
|
17022
17119
|
}
|
|
17023
17120
|
const session = createResult.body;
|
|
17024
17121
|
const verificationUrl = `${apiUrl}${session.verificationUrl}`;
|
|
17025
|
-
console.log(
|
|
17026
|
-
console.log(
|
|
17122
|
+
console.log(chalk73.green("\nSession created"));
|
|
17123
|
+
console.log(chalk73.cyan(`
|
|
17027
17124
|
To connect, visit: ${verificationUrl}`));
|
|
17028
17125
|
console.log(
|
|
17029
17126
|
`
|
|
@@ -17055,7 +17152,7 @@ The session expires in ${Math.floor(session.expiresIn / 60)} minutes.`
|
|
|
17055
17152
|
switch (status.status) {
|
|
17056
17153
|
case "complete":
|
|
17057
17154
|
console.log(
|
|
17058
|
-
|
|
17155
|
+
chalk73.green(`
|
|
17059
17156
|
|
|
17060
17157
|
${connectorType} connected successfully!`)
|
|
17061
17158
|
);
|
|
@@ -17067,7 +17164,7 @@ ${connectorType} connected successfully!`)
|
|
|
17067
17164
|
`Connection failed: ${status.errorMessage || "Unknown error"}`
|
|
17068
17165
|
);
|
|
17069
17166
|
case "pending":
|
|
17070
|
-
process.stdout.write(
|
|
17167
|
+
process.stdout.write(chalk73.dim("."));
|
|
17071
17168
|
break;
|
|
17072
17169
|
}
|
|
17073
17170
|
}
|
|
@@ -17099,11 +17196,11 @@ var connectCommand = new Command81().name("connect").description("Connect a thir
|
|
|
17099
17196
|
|
|
17100
17197
|
// src/commands/connector/list.ts
|
|
17101
17198
|
import { Command as Command82 } from "commander";
|
|
17102
|
-
import
|
|
17199
|
+
import chalk74 from "chalk";
|
|
17103
17200
|
var listCommand11 = new Command82().name("list").alias("ls").description("List all connectors and their status").action(
|
|
17104
17201
|
withErrorHandler(async () => {
|
|
17105
17202
|
const result = await listConnectors();
|
|
17106
|
-
const connectedMap = new Map(result.connectors.map((
|
|
17203
|
+
const connectedMap = new Map(result.connectors.map((c24) => [c24.type, c24]));
|
|
17107
17204
|
const allTypesRaw = Object.keys(CONNECTOR_TYPES);
|
|
17108
17205
|
const allTypes = [];
|
|
17109
17206
|
for (const type2 of allTypesRaw) {
|
|
@@ -17122,23 +17219,23 @@ var listCommand11 = new Command82().name("list").alias("ls").description("List a
|
|
|
17122
17219
|
statusText.padEnd(statusWidth),
|
|
17123
17220
|
"ACCOUNT"
|
|
17124
17221
|
].join(" ");
|
|
17125
|
-
console.log(
|
|
17222
|
+
console.log(chalk74.dim(header));
|
|
17126
17223
|
for (const type2 of allTypes) {
|
|
17127
17224
|
const connector = connectedMap.get(type2);
|
|
17128
|
-
const status = connector ?
|
|
17129
|
-
const account = connector?.externalUsername ? `@${connector.externalUsername}` :
|
|
17225
|
+
const status = connector ? chalk74.green("\u2713".padEnd(statusWidth)) : chalk74.dim("-".padEnd(statusWidth));
|
|
17226
|
+
const account = connector?.externalUsername ? `@${connector.externalUsername}` : chalk74.dim("-");
|
|
17130
17227
|
const row = [type2.padEnd(typeWidth), status, account].join(" ");
|
|
17131
17228
|
console.log(row);
|
|
17132
17229
|
}
|
|
17133
17230
|
console.log();
|
|
17134
|
-
console.log(
|
|
17135
|
-
console.log(
|
|
17231
|
+
console.log(chalk74.dim("To connect a service:"));
|
|
17232
|
+
console.log(chalk74.dim(" vm0 connector connect <type>"));
|
|
17136
17233
|
})
|
|
17137
17234
|
);
|
|
17138
17235
|
|
|
17139
17236
|
// src/commands/connector/status.ts
|
|
17140
17237
|
import { Command as Command83 } from "commander";
|
|
17141
|
-
import
|
|
17238
|
+
import chalk75 from "chalk";
|
|
17142
17239
|
var LABEL_WIDTH = 16;
|
|
17143
17240
|
var statusCommand8 = new Command83().name("status").description("Show detailed status of a connector").argument("<type>", "Connector type (e.g., github)").action(
|
|
17144
17241
|
withErrorHandler(async (type2) => {
|
|
@@ -17150,11 +17247,11 @@ var statusCommand8 = new Command83().name("status").description("Show detailed s
|
|
|
17150
17247
|
});
|
|
17151
17248
|
}
|
|
17152
17249
|
const connector = await getConnector(parseResult.data);
|
|
17153
|
-
console.log(`Connector: ${
|
|
17250
|
+
console.log(`Connector: ${chalk75.cyan(type2)}`);
|
|
17154
17251
|
console.log();
|
|
17155
17252
|
if (connector) {
|
|
17156
17253
|
console.log(
|
|
17157
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
17254
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk75.green("connected")}`
|
|
17158
17255
|
);
|
|
17159
17256
|
console.log(
|
|
17160
17257
|
`${"Account:".padEnd(LABEL_WIDTH)}@${connector.externalUsername}`
|
|
@@ -17176,22 +17273,22 @@ var statusCommand8 = new Command83().name("status").description("Show detailed s
|
|
|
17176
17273
|
);
|
|
17177
17274
|
}
|
|
17178
17275
|
console.log();
|
|
17179
|
-
console.log(
|
|
17180
|
-
console.log(
|
|
17276
|
+
console.log(chalk75.dim("To disconnect:"));
|
|
17277
|
+
console.log(chalk75.dim(` vm0 connector disconnect ${type2}`));
|
|
17181
17278
|
} else {
|
|
17182
17279
|
console.log(
|
|
17183
|
-
`${"Status:".padEnd(LABEL_WIDTH)}${
|
|
17280
|
+
`${"Status:".padEnd(LABEL_WIDTH)}${chalk75.dim("not connected")}`
|
|
17184
17281
|
);
|
|
17185
17282
|
console.log();
|
|
17186
|
-
console.log(
|
|
17187
|
-
console.log(
|
|
17283
|
+
console.log(chalk75.dim("To connect:"));
|
|
17284
|
+
console.log(chalk75.dim(` vm0 connector connect ${type2}`));
|
|
17188
17285
|
}
|
|
17189
17286
|
})
|
|
17190
17287
|
);
|
|
17191
17288
|
|
|
17192
17289
|
// src/commands/connector/disconnect.ts
|
|
17193
17290
|
import { Command as Command84 } from "commander";
|
|
17194
|
-
import
|
|
17291
|
+
import chalk76 from "chalk";
|
|
17195
17292
|
var disconnectCommand = new Command84().name("disconnect").description("Disconnect a third-party service").argument("<type>", "Connector type to disconnect (e.g., github)").action(
|
|
17196
17293
|
withErrorHandler(async (type2) => {
|
|
17197
17294
|
const parseResult = connectorTypeSchema.safeParse(type2);
|
|
@@ -17203,7 +17300,7 @@ var disconnectCommand = new Command84().name("disconnect").description("Disconne
|
|
|
17203
17300
|
}
|
|
17204
17301
|
const connectorType = parseResult.data;
|
|
17205
17302
|
await deleteConnector(connectorType);
|
|
17206
|
-
console.log(
|
|
17303
|
+
console.log(chalk76.green(`\u2713 Disconnected ${type2}`));
|
|
17207
17304
|
})
|
|
17208
17305
|
);
|
|
17209
17306
|
|
|
@@ -17212,24 +17309,24 @@ var connectorCommand = new Command85().name("connector").description("Manage thi
|
|
|
17212
17309
|
|
|
17213
17310
|
// src/commands/onboard/index.ts
|
|
17214
17311
|
import { Command as Command86 } from "commander";
|
|
17215
|
-
import
|
|
17312
|
+
import chalk80 from "chalk";
|
|
17216
17313
|
import { mkdir as mkdir8 } from "fs/promises";
|
|
17217
17314
|
import { existsSync as existsSync12 } from "fs";
|
|
17218
17315
|
|
|
17219
17316
|
// src/lib/ui/welcome-box.ts
|
|
17220
|
-
import
|
|
17317
|
+
import chalk77 from "chalk";
|
|
17221
17318
|
var gradientColors = [
|
|
17222
|
-
|
|
17319
|
+
chalk77.hex("#FFAB5E"),
|
|
17223
17320
|
// Line 1 - lightest
|
|
17224
|
-
|
|
17321
|
+
chalk77.hex("#FF9642"),
|
|
17225
17322
|
// Line 2
|
|
17226
|
-
|
|
17323
|
+
chalk77.hex("#FF8228"),
|
|
17227
17324
|
// Line 3
|
|
17228
|
-
|
|
17325
|
+
chalk77.hex("#FF6D0A"),
|
|
17229
17326
|
// Line 4
|
|
17230
|
-
|
|
17327
|
+
chalk77.hex("#E85D00"),
|
|
17231
17328
|
// Line 5
|
|
17232
|
-
|
|
17329
|
+
chalk77.hex("#CC4E00")
|
|
17233
17330
|
// Line 6 - darkest
|
|
17234
17331
|
];
|
|
17235
17332
|
var vm0LogoLines = [
|
|
@@ -17251,15 +17348,15 @@ function renderVm0Banner() {
|
|
|
17251
17348
|
function renderOnboardWelcome() {
|
|
17252
17349
|
renderVm0Banner();
|
|
17253
17350
|
console.log(` Build agentic workflows using natural language.`);
|
|
17254
|
-
console.log(` ${
|
|
17351
|
+
console.log(` ${chalk77.dim("Currently in beta, enjoy it free")}`);
|
|
17255
17352
|
console.log(
|
|
17256
|
-
` ${
|
|
17353
|
+
` ${chalk77.dim("Star us on GitHub: https://github.com/vm0-ai/vm0")}`
|
|
17257
17354
|
);
|
|
17258
17355
|
console.log();
|
|
17259
17356
|
}
|
|
17260
17357
|
|
|
17261
17358
|
// src/lib/ui/step-runner.ts
|
|
17262
|
-
import
|
|
17359
|
+
import chalk78 from "chalk";
|
|
17263
17360
|
function createStepRunner(options = true) {
|
|
17264
17361
|
const opts = typeof options === "boolean" ? { interactive: options } : options;
|
|
17265
17362
|
const interactive = opts.interactive ?? true;
|
|
@@ -17274,25 +17371,25 @@ function createStepRunner(options = true) {
|
|
|
17274
17371
|
}
|
|
17275
17372
|
for (const [i, step] of completedSteps.entries()) {
|
|
17276
17373
|
if (step.failed) {
|
|
17277
|
-
console.log(
|
|
17374
|
+
console.log(chalk78.red(`\u2717 ${step.label}`));
|
|
17278
17375
|
} else {
|
|
17279
|
-
console.log(
|
|
17376
|
+
console.log(chalk78.green(`\u25CF ${step.label}`));
|
|
17280
17377
|
}
|
|
17281
17378
|
const isLastStep = i === completedSteps.length - 1;
|
|
17282
17379
|
if (!isLastStep || !isFinal) {
|
|
17283
|
-
console.log(
|
|
17380
|
+
console.log(chalk78.dim("\u2502"));
|
|
17284
17381
|
}
|
|
17285
17382
|
}
|
|
17286
17383
|
}
|
|
17287
17384
|
async function executeStep(label, fn, isFinal) {
|
|
17288
17385
|
let stepFailed = false;
|
|
17289
|
-
console.log(
|
|
17386
|
+
console.log(chalk78.yellow(`\u25CB ${label}`));
|
|
17290
17387
|
const ctx = {
|
|
17291
17388
|
connector() {
|
|
17292
|
-
console.log(
|
|
17389
|
+
console.log(chalk78.dim("\u2502"));
|
|
17293
17390
|
},
|
|
17294
17391
|
detail(message) {
|
|
17295
|
-
console.log(`${
|
|
17392
|
+
console.log(`${chalk78.dim("\u2502")} ${message}`);
|
|
17296
17393
|
},
|
|
17297
17394
|
async prompt(promptFn) {
|
|
17298
17395
|
return await promptFn();
|
|
@@ -17309,12 +17406,12 @@ function createStepRunner(options = true) {
|
|
|
17309
17406
|
redrawCompletedSteps(isFinal);
|
|
17310
17407
|
} else {
|
|
17311
17408
|
if (stepFailed) {
|
|
17312
|
-
console.log(
|
|
17409
|
+
console.log(chalk78.red(`\u2717 ${label}`));
|
|
17313
17410
|
} else {
|
|
17314
|
-
console.log(
|
|
17411
|
+
console.log(chalk78.green(`\u25CF ${label}`));
|
|
17315
17412
|
}
|
|
17316
17413
|
if (!isFinal) {
|
|
17317
|
-
console.log(
|
|
17414
|
+
console.log(chalk78.dim("\u2502"));
|
|
17318
17415
|
}
|
|
17319
17416
|
}
|
|
17320
17417
|
}
|
|
@@ -17474,7 +17571,7 @@ async function setupModelProvider(type2, secret, options) {
|
|
|
17474
17571
|
|
|
17475
17572
|
// src/lib/domain/onboard/claude-setup.ts
|
|
17476
17573
|
import { spawn as spawn3 } from "child_process";
|
|
17477
|
-
import
|
|
17574
|
+
import chalk79 from "chalk";
|
|
17478
17575
|
var MARKETPLACE_NAME = "vm0-skills";
|
|
17479
17576
|
var MARKETPLACE_REPO = "vm0-ai/vm0-skills";
|
|
17480
17577
|
var PLUGIN_ID = "vm0@vm0-skills";
|
|
@@ -17511,12 +17608,12 @@ async function runClaudeCommand(args, cwd) {
|
|
|
17511
17608
|
}
|
|
17512
17609
|
function handlePluginError(error, context) {
|
|
17513
17610
|
const displayContext = context ?? "Claude plugin";
|
|
17514
|
-
console.error(
|
|
17611
|
+
console.error(chalk79.red(`\u2717 Failed to install ${displayContext}`));
|
|
17515
17612
|
if (error instanceof Error) {
|
|
17516
|
-
console.error(
|
|
17613
|
+
console.error(chalk79.red(`\u2717 ${error.message}`));
|
|
17517
17614
|
}
|
|
17518
17615
|
console.error(
|
|
17519
|
-
|
|
17616
|
+
chalk79.dim("Please ensure Claude CLI is installed and accessible.")
|
|
17520
17617
|
);
|
|
17521
17618
|
process.exit(1);
|
|
17522
17619
|
}
|
|
@@ -17559,7 +17656,7 @@ async function updateMarketplace() {
|
|
|
17559
17656
|
]);
|
|
17560
17657
|
if (!result.success) {
|
|
17561
17658
|
console.warn(
|
|
17562
|
-
|
|
17659
|
+
chalk79.yellow(
|
|
17563
17660
|
`Warning: Could not update marketplace: ${result.error ?? "unknown error"}`
|
|
17564
17661
|
)
|
|
17565
17662
|
);
|
|
@@ -17605,9 +17702,9 @@ async function handleAuthentication(ctx) {
|
|
|
17605
17702
|
onInitiating: () => {
|
|
17606
17703
|
},
|
|
17607
17704
|
onDeviceCodeReady: (url, code, expiresIn) => {
|
|
17608
|
-
step.detail(`Copy code: ${
|
|
17609
|
-
step.detail(`Open: ${
|
|
17610
|
-
step.detail(
|
|
17705
|
+
step.detail(`Copy code: ${chalk80.cyan.bold(code)}`);
|
|
17706
|
+
step.detail(`Open: ${chalk80.cyan(url)}`);
|
|
17707
|
+
step.detail(chalk80.dim(`Expires in ${expiresIn} minutes`));
|
|
17611
17708
|
},
|
|
17612
17709
|
onPolling: () => {
|
|
17613
17710
|
},
|
|
@@ -17635,26 +17732,26 @@ async function handleModelProvider(ctx) {
|
|
|
17635
17732
|
const providerType = await step.prompt(
|
|
17636
17733
|
() => promptSelect(
|
|
17637
17734
|
"Select provider type:",
|
|
17638
|
-
choices.map((
|
|
17639
|
-
title:
|
|
17640
|
-
value:
|
|
17735
|
+
choices.map((c24) => ({
|
|
17736
|
+
title: c24.label,
|
|
17737
|
+
value: c24.type
|
|
17641
17738
|
}))
|
|
17642
17739
|
)
|
|
17643
17740
|
);
|
|
17644
17741
|
if (!providerType) {
|
|
17645
17742
|
process.exit(0);
|
|
17646
17743
|
}
|
|
17647
|
-
const selectedChoice = choices.find((
|
|
17744
|
+
const selectedChoice = choices.find((c24) => c24.type === providerType);
|
|
17648
17745
|
if (selectedChoice?.helpText) {
|
|
17649
17746
|
for (const line of selectedChoice.helpText.split("\n")) {
|
|
17650
|
-
step.detail(
|
|
17747
|
+
step.detail(chalk80.dim(line));
|
|
17651
17748
|
}
|
|
17652
17749
|
}
|
|
17653
17750
|
const secret = await step.prompt(
|
|
17654
17751
|
() => promptPassword(`Enter your ${selectedChoice?.secretLabel ?? "secret"}:`)
|
|
17655
17752
|
);
|
|
17656
17753
|
if (!secret) {
|
|
17657
|
-
console.log(
|
|
17754
|
+
console.log(chalk80.dim("Cancelled"));
|
|
17658
17755
|
process.exit(0);
|
|
17659
17756
|
}
|
|
17660
17757
|
let selectedModel;
|
|
@@ -17673,7 +17770,7 @@ async function handleModelProvider(ctx) {
|
|
|
17673
17770
|
() => promptSelect("Select model:", modelChoices)
|
|
17674
17771
|
);
|
|
17675
17772
|
if (modelSelection === void 0) {
|
|
17676
|
-
console.log(
|
|
17773
|
+
console.log(chalk80.dim("Cancelled"));
|
|
17677
17774
|
process.exit(0);
|
|
17678
17775
|
}
|
|
17679
17776
|
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
@@ -17683,7 +17780,7 @@ async function handleModelProvider(ctx) {
|
|
|
17683
17780
|
});
|
|
17684
17781
|
const modelNote = result.provider.selectedModel ? ` with model: ${result.provider.selectedModel}` : "";
|
|
17685
17782
|
step.detail(
|
|
17686
|
-
|
|
17783
|
+
chalk80.green(
|
|
17687
17784
|
`${providerType} ${result.created ? "created" : "updated"}${result.isDefault ? ` (default for ${result.framework})` : ""}${modelNote}`
|
|
17688
17785
|
)
|
|
17689
17786
|
);
|
|
@@ -17714,7 +17811,7 @@ async function handleAgentCreation(ctx) {
|
|
|
17714
17811
|
agentName = inputName;
|
|
17715
17812
|
if (existsSync12(agentName)) {
|
|
17716
17813
|
step.detail(
|
|
17717
|
-
|
|
17814
|
+
chalk80.yellow(`${agentName}/ already exists, choose another name`)
|
|
17718
17815
|
);
|
|
17719
17816
|
} else {
|
|
17720
17817
|
folderExists = false;
|
|
@@ -17735,7 +17832,7 @@ async function handleAgentCreation(ctx) {
|
|
|
17735
17832
|
}
|
|
17736
17833
|
}
|
|
17737
17834
|
await mkdir8(agentName, { recursive: true });
|
|
17738
|
-
step.detail(
|
|
17835
|
+
step.detail(chalk80.green(`Created ${agentName}/`));
|
|
17739
17836
|
});
|
|
17740
17837
|
return agentName;
|
|
17741
17838
|
}
|
|
@@ -17751,7 +17848,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17751
17848
|
shouldInstall = confirmed ?? true;
|
|
17752
17849
|
}
|
|
17753
17850
|
if (!shouldInstall) {
|
|
17754
|
-
step.detail(
|
|
17851
|
+
step.detail(chalk80.dim("Skipped"));
|
|
17755
17852
|
return;
|
|
17756
17853
|
}
|
|
17757
17854
|
const scope = "project";
|
|
@@ -17759,7 +17856,7 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17759
17856
|
const agentDir = `${process.cwd()}/${agentName}`;
|
|
17760
17857
|
const result = await installVm0Plugin(scope, agentDir);
|
|
17761
17858
|
step.detail(
|
|
17762
|
-
|
|
17859
|
+
chalk80.green(`Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
17763
17860
|
);
|
|
17764
17861
|
pluginInstalled = true;
|
|
17765
17862
|
} catch (error) {
|
|
@@ -17770,14 +17867,14 @@ async function handlePluginInstallation(ctx, agentName) {
|
|
|
17770
17867
|
}
|
|
17771
17868
|
function printNextSteps(agentName, pluginInstalled) {
|
|
17772
17869
|
console.log();
|
|
17773
|
-
console.log(
|
|
17870
|
+
console.log(chalk80.bold("Next step:"));
|
|
17774
17871
|
console.log();
|
|
17775
17872
|
if (pluginInstalled) {
|
|
17776
17873
|
console.log(
|
|
17777
|
-
` ${
|
|
17874
|
+
` ${chalk80.cyan(`cd ${agentName} && claude "/${PRIMARY_SKILL_NAME} let's build an agent"`)}`
|
|
17778
17875
|
);
|
|
17779
17876
|
} else {
|
|
17780
|
-
console.log(` ${
|
|
17877
|
+
console.log(` ${chalk80.cyan(`cd ${agentName} && vm0 init`)}`);
|
|
17781
17878
|
}
|
|
17782
17879
|
console.log();
|
|
17783
17880
|
}
|
|
@@ -17807,20 +17904,20 @@ var onboardCommand = new Command86().name("onboard").description("Guided setup f
|
|
|
17807
17904
|
|
|
17808
17905
|
// src/commands/setup-claude/index.ts
|
|
17809
17906
|
import { Command as Command87 } from "commander";
|
|
17810
|
-
import
|
|
17907
|
+
import chalk81 from "chalk";
|
|
17811
17908
|
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
17909
|
withErrorHandler(async (options) => {
|
|
17813
|
-
console.log(
|
|
17910
|
+
console.log(chalk81.dim("Installing VM0 Claude Plugin..."));
|
|
17814
17911
|
const scope = options.scope === "user" ? "user" : "project";
|
|
17815
17912
|
const result = await installVm0Plugin(scope, options.agentDir);
|
|
17816
17913
|
console.log(
|
|
17817
|
-
|
|
17914
|
+
chalk81.green(`\u2713 Installed ${result.pluginId} (scope: ${result.scope})`)
|
|
17818
17915
|
);
|
|
17819
17916
|
console.log();
|
|
17820
17917
|
console.log("Next step:");
|
|
17821
17918
|
const cdPrefix = options.agentDir ? `cd ${options.agentDir} && ` : "";
|
|
17822
17919
|
console.log(
|
|
17823
|
-
|
|
17920
|
+
chalk81.cyan(
|
|
17824
17921
|
` ${cdPrefix}claude "/${PRIMARY_SKILL_NAME} let's build a workflow"`
|
|
17825
17922
|
)
|
|
17826
17923
|
);
|
|
@@ -17829,35 +17926,35 @@ var setupClaudeCommand = new Command87().name("setup-claude").description("Insta
|
|
|
17829
17926
|
|
|
17830
17927
|
// src/commands/dashboard/index.ts
|
|
17831
17928
|
import { Command as Command88 } from "commander";
|
|
17832
|
-
import
|
|
17929
|
+
import chalk82 from "chalk";
|
|
17833
17930
|
var dashboardCommand = new Command88().name("dashboard").description("Quick reference for common query commands").action(() => {
|
|
17834
17931
|
console.log();
|
|
17835
|
-
console.log(
|
|
17932
|
+
console.log(chalk82.bold("VM0 Dashboard"));
|
|
17836
17933
|
console.log();
|
|
17837
|
-
console.log(
|
|
17838
|
-
console.log(
|
|
17934
|
+
console.log(chalk82.bold("Agents"));
|
|
17935
|
+
console.log(chalk82.dim(" List agents: ") + "vm0 agent list");
|
|
17839
17936
|
console.log();
|
|
17840
|
-
console.log(
|
|
17841
|
-
console.log(
|
|
17842
|
-
console.log(
|
|
17937
|
+
console.log(chalk82.bold("Runs"));
|
|
17938
|
+
console.log(chalk82.dim(" Recent runs: ") + "vm0 run list");
|
|
17939
|
+
console.log(chalk82.dim(" View run logs: ") + "vm0 logs <run-id>");
|
|
17843
17940
|
console.log();
|
|
17844
|
-
console.log(
|
|
17845
|
-
console.log(
|
|
17941
|
+
console.log(chalk82.bold("Schedules"));
|
|
17942
|
+
console.log(chalk82.dim(" List schedules: ") + "vm0 schedule list");
|
|
17846
17943
|
console.log();
|
|
17847
|
-
console.log(
|
|
17848
|
-
console.log(
|
|
17849
|
-
console.log(
|
|
17850
|
-
console.log(
|
|
17944
|
+
console.log(chalk82.bold("Account"));
|
|
17945
|
+
console.log(chalk82.dim(" Usage stats: ") + "vm0 usage");
|
|
17946
|
+
console.log(chalk82.dim(" List secrets: ") + "vm0 secret list");
|
|
17947
|
+
console.log(chalk82.dim(" List variables: ") + "vm0 variable list");
|
|
17851
17948
|
console.log();
|
|
17852
17949
|
console.log(
|
|
17853
|
-
|
|
17950
|
+
chalk82.dim("Not logged in? Run: ") + chalk82.cyan("vm0 auth login")
|
|
17854
17951
|
);
|
|
17855
17952
|
console.log();
|
|
17856
17953
|
});
|
|
17857
17954
|
|
|
17858
17955
|
// src/commands/preference/index.ts
|
|
17859
17956
|
import { Command as Command89 } from "commander";
|
|
17860
|
-
import
|
|
17957
|
+
import chalk83 from "chalk";
|
|
17861
17958
|
function detectTimezone2() {
|
|
17862
17959
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
17863
17960
|
}
|
|
@@ -17878,15 +17975,15 @@ function parseOnOff(flag, value) {
|
|
|
17878
17975
|
);
|
|
17879
17976
|
}
|
|
17880
17977
|
function displayPreferences(prefs) {
|
|
17881
|
-
console.log(
|
|
17978
|
+
console.log(chalk83.bold("Current preferences:"));
|
|
17882
17979
|
console.log(
|
|
17883
|
-
` Timezone: ${prefs.timezone ?
|
|
17980
|
+
` Timezone: ${prefs.timezone ? chalk83.cyan(prefs.timezone) : chalk83.dim("not set")}`
|
|
17884
17981
|
);
|
|
17885
17982
|
console.log(
|
|
17886
|
-
` Email notify: ${prefs.notifyEmail ?
|
|
17983
|
+
` Email notify: ${prefs.notifyEmail ? chalk83.green("on") : chalk83.dim("off")}`
|
|
17887
17984
|
);
|
|
17888
17985
|
console.log(
|
|
17889
|
-
` Slack notify: ${prefs.notifySlack ?
|
|
17986
|
+
` Slack notify: ${prefs.notifySlack ? chalk83.green("on") : chalk83.dim("off")}`
|
|
17890
17987
|
);
|
|
17891
17988
|
}
|
|
17892
17989
|
function buildUpdates(opts) {
|
|
@@ -17916,21 +18013,21 @@ function buildUpdates(opts) {
|
|
|
17916
18013
|
function printUpdateResult(updates, result) {
|
|
17917
18014
|
if (updates.timezone !== void 0) {
|
|
17918
18015
|
console.log(
|
|
17919
|
-
|
|
17920
|
-
`Timezone set to ${
|
|
18016
|
+
chalk83.green(
|
|
18017
|
+
`Timezone set to ${chalk83.cyan(result.timezone ?? updates.timezone)}`
|
|
17921
18018
|
)
|
|
17922
18019
|
);
|
|
17923
18020
|
}
|
|
17924
18021
|
if (updates.notifyEmail !== void 0) {
|
|
17925
18022
|
console.log(
|
|
17926
|
-
|
|
18023
|
+
chalk83.green(
|
|
17927
18024
|
`Email notifications ${result.notifyEmail ? "enabled" : "disabled"}`
|
|
17928
18025
|
)
|
|
17929
18026
|
);
|
|
17930
18027
|
}
|
|
17931
18028
|
if (updates.notifySlack !== void 0) {
|
|
17932
18029
|
console.log(
|
|
17933
|
-
|
|
18030
|
+
chalk83.green(
|
|
17934
18031
|
`Slack notifications ${result.notifySlack ? "enabled" : "disabled"}`
|
|
17935
18032
|
)
|
|
17936
18033
|
);
|
|
@@ -17939,7 +18036,7 @@ function printUpdateResult(updates, result) {
|
|
|
17939
18036
|
async function interactiveSetup(prefs) {
|
|
17940
18037
|
if (!prefs.timezone) {
|
|
17941
18038
|
const detectedTz = detectTimezone2();
|
|
17942
|
-
console.log(
|
|
18039
|
+
console.log(chalk83.dim(`
|
|
17943
18040
|
System timezone detected: ${detectedTz}`));
|
|
17944
18041
|
const tz = await promptText(
|
|
17945
18042
|
"Set timezone? (enter timezone or leave empty to skip)",
|
|
@@ -17950,7 +18047,7 @@ System timezone detected: ${detectedTz}`));
|
|
|
17950
18047
|
throw new Error(`Invalid timezone: ${tz.trim()}`);
|
|
17951
18048
|
}
|
|
17952
18049
|
await updateUserPreferences({ timezone: tz.trim() });
|
|
17953
|
-
console.log(
|
|
18050
|
+
console.log(chalk83.green(`Timezone set to ${chalk83.cyan(tz.trim())}`));
|
|
17954
18051
|
}
|
|
17955
18052
|
}
|
|
17956
18053
|
if (!prefs.notifyEmail) {
|
|
@@ -17960,7 +18057,7 @@ System timezone detected: ${detectedTz}`));
|
|
|
17960
18057
|
);
|
|
17961
18058
|
if (enable) {
|
|
17962
18059
|
await updateUserPreferences({ notifyEmail: true });
|
|
17963
|
-
console.log(
|
|
18060
|
+
console.log(chalk83.green("Email notifications enabled"));
|
|
17964
18061
|
}
|
|
17965
18062
|
}
|
|
17966
18063
|
}
|
|
@@ -17979,10 +18076,10 @@ var preferenceCommand = new Command89().name("preference").description("View or
|
|
|
17979
18076
|
} else if (!prefs.timezone) {
|
|
17980
18077
|
console.log();
|
|
17981
18078
|
console.log(
|
|
17982
|
-
`To set timezone: ${
|
|
18079
|
+
`To set timezone: ${chalk83.cyan("vm0 preference --timezone <timezone>")}`
|
|
17983
18080
|
);
|
|
17984
18081
|
console.log(
|
|
17985
|
-
|
|
18082
|
+
chalk83.dim("Example: vm0 preference --timezone America/New_York")
|
|
17986
18083
|
);
|
|
17987
18084
|
}
|
|
17988
18085
|
})
|
|
@@ -17990,7 +18087,7 @@ var preferenceCommand = new Command89().name("preference").description("View or
|
|
|
17990
18087
|
|
|
17991
18088
|
// src/commands/upgrade/index.ts
|
|
17992
18089
|
import { Command as Command90 } from "commander";
|
|
17993
|
-
import
|
|
18090
|
+
import chalk84 from "chalk";
|
|
17994
18091
|
var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CLI to the latest version").action(
|
|
17995
18092
|
withErrorHandler(async () => {
|
|
17996
18093
|
console.log("Checking for updates...");
|
|
@@ -17998,13 +18095,13 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
17998
18095
|
if (latestVersion === null) {
|
|
17999
18096
|
throw new Error("Could not check for updates. Please try again later.");
|
|
18000
18097
|
}
|
|
18001
|
-
if (latestVersion === "9.
|
|
18002
|
-
console.log(
|
|
18098
|
+
if (latestVersion === "9.59.1") {
|
|
18099
|
+
console.log(chalk84.green(`\u2713 Already up to date (${"9.59.1"})`));
|
|
18003
18100
|
return;
|
|
18004
18101
|
}
|
|
18005
18102
|
console.log(
|
|
18006
|
-
|
|
18007
|
-
`Current version: ${"9.
|
|
18103
|
+
chalk84.yellow(
|
|
18104
|
+
`Current version: ${"9.59.1"} -> Latest version: ${latestVersion}`
|
|
18008
18105
|
)
|
|
18009
18106
|
);
|
|
18010
18107
|
console.log();
|
|
@@ -18012,26 +18109,26 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
18012
18109
|
if (!isAutoUpgradeSupported(packageManager)) {
|
|
18013
18110
|
if (packageManager === "unknown") {
|
|
18014
18111
|
console.log(
|
|
18015
|
-
|
|
18112
|
+
chalk84.yellow(
|
|
18016
18113
|
"Could not detect your package manager for auto-upgrade."
|
|
18017
18114
|
)
|
|
18018
18115
|
);
|
|
18019
18116
|
} else {
|
|
18020
18117
|
console.log(
|
|
18021
|
-
|
|
18118
|
+
chalk84.yellow(
|
|
18022
18119
|
`Auto-upgrade is not supported for ${packageManager}.`
|
|
18023
18120
|
)
|
|
18024
18121
|
);
|
|
18025
18122
|
}
|
|
18026
|
-
console.log(
|
|
18027
|
-
console.log(
|
|
18123
|
+
console.log(chalk84.yellow("Please upgrade manually:"));
|
|
18124
|
+
console.log(chalk84.cyan(` ${getManualUpgradeCommand(packageManager)}`));
|
|
18028
18125
|
return;
|
|
18029
18126
|
}
|
|
18030
18127
|
console.log(`Upgrading via ${packageManager}...`);
|
|
18031
18128
|
const success = await performUpgrade(packageManager);
|
|
18032
18129
|
if (success) {
|
|
18033
18130
|
console.log(
|
|
18034
|
-
|
|
18131
|
+
chalk84.green(`\u2713 Upgraded from ${"9.59.1"} to ${latestVersion}`)
|
|
18035
18132
|
);
|
|
18036
18133
|
return;
|
|
18037
18134
|
}
|
|
@@ -18045,7 +18142,7 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
18045
18142
|
|
|
18046
18143
|
// src/index.ts
|
|
18047
18144
|
var program = new Command91();
|
|
18048
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
18145
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.59.1");
|
|
18049
18146
|
program.addCommand(authCommand);
|
|
18050
18147
|
program.addCommand(infoCommand);
|
|
18051
18148
|
program.addCommand(composeCommand);
|