@vm0/cli 9.68.0 → 9.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +84 -125
- 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.69.0",
|
|
49
49
|
sendDefaultPii: false,
|
|
50
50
|
tracesSampleRate: 0,
|
|
51
51
|
shutdownTimeout: 500,
|
|
@@ -64,7 +64,7 @@ if (DSN) {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
Sentry.setContext("cli", {
|
|
67
|
-
version: "9.
|
|
67
|
+
version: "9.69.0",
|
|
68
68
|
command: process.argv.slice(2).join(" ")
|
|
69
69
|
});
|
|
70
70
|
Sentry.setContext("runtime", {
|
|
@@ -83,7 +83,7 @@ process.stdout.on("error", handleEpipe);
|
|
|
83
83
|
process.stderr.on("error", handleEpipe);
|
|
84
84
|
|
|
85
85
|
// src/index.ts
|
|
86
|
-
import { Command as
|
|
86
|
+
import { Command as Command96 } from "commander";
|
|
87
87
|
|
|
88
88
|
// src/lib/network/proxy.ts
|
|
89
89
|
import { EnvHttpProxyAgent, setGlobalDispatcher } from "undici";
|
|
@@ -675,7 +675,7 @@ function getConfigPath() {
|
|
|
675
675
|
return join2(homedir2(), ".vm0", "config.json");
|
|
676
676
|
}
|
|
677
677
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
678
|
-
console.log(chalk4.bold(`VM0 CLI v${"9.
|
|
678
|
+
console.log(chalk4.bold(`VM0 CLI v${"9.69.0"}`));
|
|
679
679
|
console.log();
|
|
680
680
|
const config = await loadConfig();
|
|
681
681
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -1069,6 +1069,7 @@ var composeListItemSchema = z4.object({
|
|
|
1069
1069
|
name: z4.string(),
|
|
1070
1070
|
displayName: z4.string().nullable().optional(),
|
|
1071
1071
|
description: z4.string().nullable().optional(),
|
|
1072
|
+
sound: z4.string().nullable().optional(),
|
|
1072
1073
|
headVersionId: z4.string().nullable(),
|
|
1073
1074
|
updatedAt: z4.string()
|
|
1074
1075
|
});
|
|
@@ -3271,8 +3272,9 @@ var storedExecutionContextSchema = z18.object({
|
|
|
3271
3272
|
apiStartTime: z18.number().optional(),
|
|
3272
3273
|
// User's timezone preference (IANA format, e.g., "Asia/Shanghai")
|
|
3273
3274
|
userTimezone: z18.string().optional(),
|
|
3274
|
-
// Agent metadata for VM0_AGENT_NAME and VM0_AGENT_ORG env vars
|
|
3275
|
+
// Agent metadata for VM0_AGENT_NAME, VM0_AGENT_COMPOSE_ID, and VM0_AGENT_ORG env vars
|
|
3275
3276
|
agentName: z18.string().optional(),
|
|
3277
|
+
agentComposeId: z18.string().optional(),
|
|
3276
3278
|
agentOrgSlug: z18.string().optional(),
|
|
3277
3279
|
// Memory storage name (for first-run when manifest.memory is null)
|
|
3278
3280
|
memoryName: z18.string().optional(),
|
|
@@ -3310,6 +3312,7 @@ var executionContextSchema = z18.object({
|
|
|
3310
3312
|
userTimezone: z18.string().optional(),
|
|
3311
3313
|
// Agent metadata
|
|
3312
3314
|
agentName: z18.string().optional(),
|
|
3315
|
+
agentComposeId: z18.string().optional(),
|
|
3313
3316
|
agentOrgSlug: z18.string().optional(),
|
|
3314
3317
|
// Memory storage name (for first-run when manifest.memory is null)
|
|
3315
3318
|
memoryName: z18.string().optional(),
|
|
@@ -3364,6 +3367,7 @@ var scheduleTriggerSchema = z19.object({
|
|
|
3364
3367
|
var scheduleRunConfigSchema = z19.object({
|
|
3365
3368
|
agent: z19.string().min(1, "Agent reference required"),
|
|
3366
3369
|
prompt: z19.string().min(1, "Prompt required"),
|
|
3370
|
+
appendSystemPrompt: z19.string().optional(),
|
|
3367
3371
|
vars: z19.record(z19.string(), z19.string()).optional(),
|
|
3368
3372
|
secrets: z19.record(z19.string(), z19.string()).optional(),
|
|
3369
3373
|
artifactName: z19.string().optional(),
|
|
@@ -3385,6 +3389,7 @@ var deployScheduleRequestSchema = z19.object({
|
|
|
3385
3389
|
intervalSeconds: z19.number().int().min(0).optional(),
|
|
3386
3390
|
timezone: z19.string().default("UTC"),
|
|
3387
3391
|
prompt: z19.string().min(1, "Prompt required"),
|
|
3392
|
+
appendSystemPrompt: z19.string().optional(),
|
|
3388
3393
|
// vars and secrets removed - now managed via server-side tables
|
|
3389
3394
|
artifactName: z19.string().optional(),
|
|
3390
3395
|
artifactVersion: z19.string().optional(),
|
|
@@ -3422,6 +3427,7 @@ var scheduleResponseSchema = z19.object({
|
|
|
3422
3427
|
intervalSeconds: z19.number().nullable(),
|
|
3423
3428
|
timezone: z19.string(),
|
|
3424
3429
|
prompt: z19.string(),
|
|
3430
|
+
appendSystemPrompt: z19.string().nullable(),
|
|
3425
3431
|
vars: z19.record(z19.string(), z19.string()).nullable(),
|
|
3426
3432
|
// Secret names only (values are never returned)
|
|
3427
3433
|
secretNames: z19.array(z19.string()).nullable(),
|
|
@@ -7666,112 +7672,6 @@ function parseSkillFrontmatter(content) {
|
|
|
7666
7672
|
};
|
|
7667
7673
|
}
|
|
7668
7674
|
|
|
7669
|
-
// ../../packages/core/src/instructions-frontmatter.ts
|
|
7670
|
-
var LEGACY_PROFILE_START = "<!-- ZERO_PROFILE";
|
|
7671
|
-
var LEGACY_PROFILE_END = "ZERO_PROFILE -->";
|
|
7672
|
-
var PROFILE_START = "[AGENT_PROFILE]";
|
|
7673
|
-
var PROFILE_END = "[/AGENT_PROFILE]";
|
|
7674
|
-
function stripMarkerBlocks(content, startMarker, endMarker) {
|
|
7675
|
-
let result = "";
|
|
7676
|
-
let searchFrom = 0;
|
|
7677
|
-
while (searchFrom < content.length) {
|
|
7678
|
-
const startIdx = content.indexOf(startMarker + "\n", searchFrom);
|
|
7679
|
-
if (startIdx === -1) {
|
|
7680
|
-
result += content.slice(searchFrom);
|
|
7681
|
-
break;
|
|
7682
|
-
}
|
|
7683
|
-
result += content.slice(searchFrom, startIdx);
|
|
7684
|
-
const endIdx = content.indexOf(
|
|
7685
|
-
endMarker,
|
|
7686
|
-
startIdx + startMarker.length + 1
|
|
7687
|
-
);
|
|
7688
|
-
if (endIdx === -1) {
|
|
7689
|
-
result += content.slice(startIdx);
|
|
7690
|
-
break;
|
|
7691
|
-
}
|
|
7692
|
-
let afterEnd = endIdx + endMarker.length;
|
|
7693
|
-
if (content[afterEnd] === "\n") {
|
|
7694
|
-
afterEnd++;
|
|
7695
|
-
}
|
|
7696
|
-
searchFrom = afterEnd;
|
|
7697
|
-
}
|
|
7698
|
-
return result;
|
|
7699
|
-
}
|
|
7700
|
-
function stripProfileBlocks(content) {
|
|
7701
|
-
const withoutLegacy = stripMarkerBlocks(
|
|
7702
|
-
content,
|
|
7703
|
-
LEGACY_PROFILE_START,
|
|
7704
|
-
LEGACY_PROFILE_END
|
|
7705
|
-
);
|
|
7706
|
-
return stripMarkerBlocks(withoutLegacy, PROFILE_START, PROFILE_END);
|
|
7707
|
-
}
|
|
7708
|
-
var LEGACY_METADATA_KEYS = /* @__PURE__ */ new Set(["name", "tone"]);
|
|
7709
|
-
function stripLegacyFrontmatter(content) {
|
|
7710
|
-
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---(\r?\n|$)/);
|
|
7711
|
-
if (!match) {
|
|
7712
|
-
return content;
|
|
7713
|
-
}
|
|
7714
|
-
const rawYaml = match[1] ?? "";
|
|
7715
|
-
const body = content.slice(match[0].length);
|
|
7716
|
-
const remaining = rawYaml.split("\n").filter((line) => {
|
|
7717
|
-
const key = line.split(":")[0]?.trim();
|
|
7718
|
-
return !key || !LEGACY_METADATA_KEYS.has(key);
|
|
7719
|
-
}).join("\n").trim();
|
|
7720
|
-
if (!remaining) {
|
|
7721
|
-
return body.replace(/^\n/, "");
|
|
7722
|
-
}
|
|
7723
|
-
return `---
|
|
7724
|
-
${remaining}
|
|
7725
|
-
---${body}`;
|
|
7726
|
-
}
|
|
7727
|
-
var TONE_DESCRIPTIONS = {
|
|
7728
|
-
professional: "clear, polished, and business-appropriate",
|
|
7729
|
-
friendly: "warm, approachable, and conversational",
|
|
7730
|
-
direct: "concise, to the point, and no-nonsense",
|
|
7731
|
-
supportive: "encouraging, empathetic, and reassuring"
|
|
7732
|
-
};
|
|
7733
|
-
function buildProfileParagraph(metadata) {
|
|
7734
|
-
const parts = [];
|
|
7735
|
-
if (metadata.displayName) {
|
|
7736
|
-
parts.push(`Your name is ${metadata.displayName}.`);
|
|
7737
|
-
}
|
|
7738
|
-
if (metadata.description) {
|
|
7739
|
-
parts.push(metadata.description);
|
|
7740
|
-
}
|
|
7741
|
-
if (metadata.sound) {
|
|
7742
|
-
const desc = TONE_DESCRIPTIONS[metadata.sound] ?? metadata.sound;
|
|
7743
|
-
parts.push(
|
|
7744
|
-
`Communicate in a ${desc} tone. This should be reflected in all your responses.`
|
|
7745
|
-
);
|
|
7746
|
-
}
|
|
7747
|
-
if (parts.length === 0) {
|
|
7748
|
-
return null;
|
|
7749
|
-
}
|
|
7750
|
-
return parts.join(" ");
|
|
7751
|
-
}
|
|
7752
|
-
function injectMetadataFrontmatter(content, metadata) {
|
|
7753
|
-
if (!metadata) {
|
|
7754
|
-
return content;
|
|
7755
|
-
}
|
|
7756
|
-
const paragraph = buildProfileParagraph(metadata);
|
|
7757
|
-
if (!paragraph) {
|
|
7758
|
-
return content;
|
|
7759
|
-
}
|
|
7760
|
-
const block = `${PROFILE_START}
|
|
7761
|
-
${paragraph}
|
|
7762
|
-
${PROFILE_END}`;
|
|
7763
|
-
const stripped = stripProfileBlocks(
|
|
7764
|
-
stripLegacyFrontmatter(content)
|
|
7765
|
-
).trimStart();
|
|
7766
|
-
if (!stripped) {
|
|
7767
|
-
return `${block}
|
|
7768
|
-
`;
|
|
7769
|
-
}
|
|
7770
|
-
return `${block}
|
|
7771
|
-
|
|
7772
|
-
${stripped}`;
|
|
7773
|
-
}
|
|
7774
|
-
|
|
7775
7675
|
// src/lib/api/core/http.ts
|
|
7776
7676
|
async function appendOrgParam(path18) {
|
|
7777
7677
|
const activeOrg = await getActiveOrg();
|
|
@@ -9279,11 +9179,10 @@ async function directUpload(storageName, storageType, cwd, options) {
|
|
|
9279
9179
|
}
|
|
9280
9180
|
|
|
9281
9181
|
// src/lib/storage/system-storage.ts
|
|
9282
|
-
async function uploadInstructions(agentName, instructionsFilePath, basePath, framework
|
|
9182
|
+
async function uploadInstructions(agentName, instructionsFilePath, basePath, framework) {
|
|
9283
9183
|
const storageName = getInstructionsStorageName(agentName.toLowerCase());
|
|
9284
9184
|
const absolutePath = path5.isAbsolute(instructionsFilePath) ? instructionsFilePath : path5.join(basePath, instructionsFilePath);
|
|
9285
|
-
const
|
|
9286
|
-
const content = injectMetadataFrontmatter(rawContent, metadata);
|
|
9185
|
+
const content = await fs5.readFile(absolutePath, "utf8");
|
|
9287
9186
|
const tmpDir = await fs5.mkdtemp(path5.join(os4.tmpdir(), "vm0-instructions-"));
|
|
9288
9187
|
const instructionsDir = path5.join(tmpDir, "instructions");
|
|
9289
9188
|
await fs5.mkdir(instructionsDir);
|
|
@@ -9457,8 +9356,7 @@ async function uploadAssets(agentName, agent, basePath, jsonMode) {
|
|
|
9457
9356
|
agentName,
|
|
9458
9357
|
agent.instructions,
|
|
9459
9358
|
basePath,
|
|
9460
|
-
agent.framework
|
|
9461
|
-
agent.metadata
|
|
9359
|
+
agent.framework
|
|
9462
9360
|
);
|
|
9463
9361
|
if (!jsonMode) {
|
|
9464
9362
|
console.log(
|
|
@@ -9797,7 +9695,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9797
9695
|
options.autoUpdate = false;
|
|
9798
9696
|
}
|
|
9799
9697
|
if (options.autoUpdate !== false) {
|
|
9800
|
-
await startSilentUpgrade("9.
|
|
9698
|
+
await startSilentUpgrade("9.69.0");
|
|
9801
9699
|
}
|
|
9802
9700
|
try {
|
|
9803
9701
|
let result;
|
|
@@ -10619,7 +10517,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
10619
10517
|
withErrorHandler(
|
|
10620
10518
|
async (identifier, prompt, options) => {
|
|
10621
10519
|
if (options.autoUpdate !== false) {
|
|
10622
|
-
await startSilentUpgrade("9.
|
|
10520
|
+
await startSilentUpgrade("9.69.0");
|
|
10623
10521
|
}
|
|
10624
10522
|
const { org, name, version } = parseIdentifier(identifier);
|
|
10625
10523
|
let composeId;
|
|
@@ -12348,7 +12246,7 @@ var cookAction = new Command35().name("cook").description("Quick start: prepare,
|
|
|
12348
12246
|
withErrorHandler(
|
|
12349
12247
|
async (prompt, options) => {
|
|
12350
12248
|
if (options.autoUpdate !== false) {
|
|
12351
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
12249
|
+
const shouldExit = await checkAndUpgrade("9.69.0", prompt);
|
|
12352
12250
|
if (shouldExit) {
|
|
12353
12251
|
process.exit(0);
|
|
12354
12252
|
}
|
|
@@ -17693,13 +17591,13 @@ var upgradeCommand = new Command94().name("upgrade").description("Upgrade vm0 CL
|
|
|
17693
17591
|
if (latestVersion === null) {
|
|
17694
17592
|
throw new Error("Could not check for updates. Please try again later.");
|
|
17695
17593
|
}
|
|
17696
|
-
if (latestVersion === "9.
|
|
17697
|
-
console.log(chalk86.green(`\u2713 Already up to date (${"9.
|
|
17594
|
+
if (latestVersion === "9.69.0") {
|
|
17595
|
+
console.log(chalk86.green(`\u2713 Already up to date (${"9.69.0"})`));
|
|
17698
17596
|
return;
|
|
17699
17597
|
}
|
|
17700
17598
|
console.log(
|
|
17701
17599
|
chalk86.yellow(
|
|
17702
|
-
`Current version: ${"9.
|
|
17600
|
+
`Current version: ${"9.69.0"} -> Latest version: ${latestVersion}`
|
|
17703
17601
|
)
|
|
17704
17602
|
);
|
|
17705
17603
|
console.log();
|
|
@@ -17726,7 +17624,7 @@ var upgradeCommand = new Command94().name("upgrade").description("Upgrade vm0 CL
|
|
|
17726
17624
|
const success = await performUpgrade(packageManager);
|
|
17727
17625
|
if (success) {
|
|
17728
17626
|
console.log(
|
|
17729
|
-
chalk86.green(`\u2713 Upgraded from ${"9.
|
|
17627
|
+
chalk86.green(`\u2713 Upgraded from ${"9.69.0"} to ${latestVersion}`)
|
|
17730
17628
|
);
|
|
17731
17629
|
return;
|
|
17732
17630
|
}
|
|
@@ -17738,9 +17636,69 @@ var upgradeCommand = new Command94().name("upgrade").description("Upgrade vm0 CL
|
|
|
17738
17636
|
})
|
|
17739
17637
|
);
|
|
17740
17638
|
|
|
17639
|
+
// src/commands/whoami.ts
|
|
17640
|
+
import { Command as Command95 } from "commander";
|
|
17641
|
+
import chalk87 from "chalk";
|
|
17642
|
+
function isInsideSandbox() {
|
|
17643
|
+
return !!process.env.VM0_RUN_ID;
|
|
17644
|
+
}
|
|
17645
|
+
async function showSandboxInfo() {
|
|
17646
|
+
const agentName = process.env.VM0_AGENT_NAME;
|
|
17647
|
+
const agentVersion = process.env.VM0_AGENT_VERSION;
|
|
17648
|
+
const agentComposeId = process.env.VM0_AGENT_COMPOSE_ID;
|
|
17649
|
+
const agentOrgSlug = process.env.VM0_AGENT_ORG_SLUG;
|
|
17650
|
+
const cliAgentType = process.env.CLI_AGENT_TYPE;
|
|
17651
|
+
const runId = process.env.VM0_RUN_ID;
|
|
17652
|
+
const activeOrg = process.env.VM0_ACTIVE_ORG;
|
|
17653
|
+
const apiUrl = process.env.VM0_API_URL;
|
|
17654
|
+
const hasAgentInfo = agentName || agentVersion || agentComposeId || agentOrgSlug || cliAgentType;
|
|
17655
|
+
if (hasAgentInfo) {
|
|
17656
|
+
console.log(chalk87.bold("Agent:"));
|
|
17657
|
+
if (agentName) console.log(` Name: ${agentName}`);
|
|
17658
|
+
if (agentVersion) console.log(` Version: ${agentVersion}`);
|
|
17659
|
+
if (agentComposeId) console.log(` Compose ID: ${agentComposeId}`);
|
|
17660
|
+
if (agentOrgSlug) console.log(` Org: ${agentOrgSlug}`);
|
|
17661
|
+
if (cliAgentType) console.log(` Framework: ${cliAgentType}`);
|
|
17662
|
+
console.log();
|
|
17663
|
+
}
|
|
17664
|
+
console.log(chalk87.bold("Run:"));
|
|
17665
|
+
if (runId) console.log(` ID: ${runId}`);
|
|
17666
|
+
if (activeOrg) console.log(` Org: ${activeOrg}`);
|
|
17667
|
+
if (apiUrl) console.log(` API: ${apiUrl}`);
|
|
17668
|
+
}
|
|
17669
|
+
async function showLocalInfo() {
|
|
17670
|
+
const token = await getToken();
|
|
17671
|
+
const apiUrl = await getApiUrl();
|
|
17672
|
+
const activeOrg = await getActiveOrg();
|
|
17673
|
+
console.log(chalk87.bold("Auth:"));
|
|
17674
|
+
if (token) {
|
|
17675
|
+
const tokenSource = process.env.VM0_TOKEN ? "VM0_TOKEN env var" : "config file";
|
|
17676
|
+
console.log(
|
|
17677
|
+
` Status: ${chalk87.green("Authenticated")} (via ${tokenSource})`
|
|
17678
|
+
);
|
|
17679
|
+
} else {
|
|
17680
|
+
console.log(` Status: ${chalk87.dim("Not authenticated")}`);
|
|
17681
|
+
}
|
|
17682
|
+
console.log(` API: ${apiUrl}`);
|
|
17683
|
+
console.log();
|
|
17684
|
+
if (activeOrg) {
|
|
17685
|
+
console.log(chalk87.bold("Org:"));
|
|
17686
|
+
console.log(` Active: ${activeOrg}`);
|
|
17687
|
+
}
|
|
17688
|
+
}
|
|
17689
|
+
var whoamiCommand = new Command95().name("whoami").description("Show current identity and environment information").action(
|
|
17690
|
+
withErrorHandler(async () => {
|
|
17691
|
+
if (isInsideSandbox()) {
|
|
17692
|
+
await showSandboxInfo();
|
|
17693
|
+
} else {
|
|
17694
|
+
await showLocalInfo();
|
|
17695
|
+
}
|
|
17696
|
+
})
|
|
17697
|
+
);
|
|
17698
|
+
|
|
17741
17699
|
// src/index.ts
|
|
17742
|
-
var program = new
|
|
17743
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
17700
|
+
var program = new Command96();
|
|
17701
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.69.0");
|
|
17744
17702
|
program.addCommand(authCommand);
|
|
17745
17703
|
program.addCommand(infoCommand);
|
|
17746
17704
|
program.addCommand(composeCommand);
|
|
@@ -17763,6 +17721,7 @@ program.addCommand(setupClaudeCommand);
|
|
|
17763
17721
|
program.addCommand(dashboardCommand);
|
|
17764
17722
|
program.addCommand(preferenceCommand);
|
|
17765
17723
|
program.addCommand(upgradeCommand);
|
|
17724
|
+
program.addCommand(whoamiCommand);
|
|
17766
17725
|
if (process.argv[1]?.endsWith("index.js") || process.argv[1]?.endsWith("index.ts") || process.argv[1]?.endsWith("vm0")) {
|
|
17767
17726
|
process.stdout.on("error", (err) => {
|
|
17768
17727
|
if (err.code === "EPIPE") process.exit(0);
|