@vm0/cli 9.59.4 → 9.59.5
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 -52
- 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.59.
|
|
48
|
+
release: "9.59.5",
|
|
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.59.
|
|
67
|
+
version: "9.59.5",
|
|
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.59.
|
|
676
|
+
console.log(chalk4.bold(`VM0 CLI v${"9.59.5"}`));
|
|
677
677
|
console.log();
|
|
678
678
|
const config = await loadConfig();
|
|
679
679
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -785,18 +785,6 @@ import { z as z4 } from "zod";
|
|
|
785
785
|
// ../../packages/core/src/contracts/runners.ts
|
|
786
786
|
import { z as z3 } from "zod";
|
|
787
787
|
var c = initContract();
|
|
788
|
-
var firewallRuleSchema = z3.object({
|
|
789
|
-
domain: z3.string().optional(),
|
|
790
|
-
ip: z3.string().optional(),
|
|
791
|
-
/** Terminal rule - value is the action (ALLOW or DENY) */
|
|
792
|
-
final: z3.enum(["ALLOW", "DENY"]).optional(),
|
|
793
|
-
/** Action for domain/ip rules */
|
|
794
|
-
action: z3.enum(["ALLOW", "DENY"]).optional()
|
|
795
|
-
});
|
|
796
|
-
var experimentalFirewallSchema = z3.object({
|
|
797
|
-
enabled: z3.boolean(),
|
|
798
|
-
rules: z3.array(firewallRuleSchema).optional()
|
|
799
|
-
});
|
|
800
788
|
var runnerGroupSchema = z3.string().regex(
|
|
801
789
|
/^[a-z0-9-]+\/[a-z0-9-]+$/,
|
|
802
790
|
"Runner group must be in org/name format (e.g., acme/production)"
|
|
@@ -874,7 +862,6 @@ var storedExecutionContextSchema = z3.object({
|
|
|
874
862
|
// Maps secret names to OAuth connector types for runtime token refresh (e.g. { "GMAIL_ACCESS_TOKEN": "gmail" })
|
|
875
863
|
secretConnectorMap: z3.record(z3.string(), z3.string()).nullable().optional(),
|
|
876
864
|
cliAgentType: z3.string(),
|
|
877
|
-
experimentalFirewall: experimentalFirewallSchema.optional(),
|
|
878
865
|
// Debug flag to force real Claude in mock environments (internal use only)
|
|
879
866
|
debugNoMockClaude: z3.boolean().optional(),
|
|
880
867
|
// Dispatch timestamp for E2E timing metrics
|
|
@@ -907,8 +894,6 @@ var executionContextSchema = z3.object({
|
|
|
907
894
|
// Maps secret names to OAuth connector types for runtime token refresh
|
|
908
895
|
secretConnectorMap: z3.record(z3.string(), z3.string()).nullable().optional(),
|
|
909
896
|
cliAgentType: z3.string(),
|
|
910
|
-
// Experimental firewall configuration
|
|
911
|
-
experimentalFirewall: experimentalFirewallSchema.optional(),
|
|
912
897
|
// Debug flag to force real Claude in mock environments (internal use only)
|
|
913
898
|
debugNoMockClaude: z3.boolean().optional(),
|
|
914
899
|
// Dispatch timestamp for E2E timing metrics
|
|
@@ -954,6 +939,20 @@ var composeVersionQuerySchema = z4.string().min(1, "Missing version query parame
|
|
|
954
939
|
"Version must be 8-64 hex characters or 'latest'"
|
|
955
940
|
);
|
|
956
941
|
var AGENT_NAME_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9-]{1,62}[a-zA-Z0-9]$/;
|
|
942
|
+
var VALID_CAPABILITIES = [
|
|
943
|
+
"volume:read",
|
|
944
|
+
"volume:write",
|
|
945
|
+
"artifact:read",
|
|
946
|
+
"artifact:write",
|
|
947
|
+
"memory:read",
|
|
948
|
+
"memory:write",
|
|
949
|
+
"agent:read",
|
|
950
|
+
"agent:write",
|
|
951
|
+
"agent-run:read",
|
|
952
|
+
"agent-run:write",
|
|
953
|
+
"schedule:read",
|
|
954
|
+
"schedule:write"
|
|
955
|
+
];
|
|
957
956
|
var agentNameSchema = z4.string().min(3, "Agent name must be at least 3 characters").max(64, "Agent name must be 64 characters or less").regex(
|
|
958
957
|
AGENT_NAME_REGEX,
|
|
959
958
|
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
@@ -992,12 +991,6 @@ var agentDefinitionSchema = z4.object({
|
|
|
992
991
|
"Runner group must be in org/name format (e.g., acme/production)"
|
|
993
992
|
)
|
|
994
993
|
}).optional(),
|
|
995
|
-
/**
|
|
996
|
-
* Experimental firewall configuration for network egress control.
|
|
997
|
-
* Requires experimental_runner to be configured.
|
|
998
|
-
* When enabled, filters outbound traffic by domain/IP rules.
|
|
999
|
-
*/
|
|
1000
|
-
experimental_firewall: experimentalFirewallSchema.optional(),
|
|
1001
994
|
/**
|
|
1002
995
|
* External services for proxy-side token replacement.
|
|
1003
996
|
* CLI input: map format { slack: { permissions: [...] | "all" } }
|
|
@@ -1009,6 +1002,13 @@ var agentDefinitionSchema = z4.object({
|
|
|
1009
1002
|
permissions: z4.union([z4.literal("all"), z4.array(z4.string()).min(1)])
|
|
1010
1003
|
})
|
|
1011
1004
|
).optional(),
|
|
1005
|
+
/**
|
|
1006
|
+
* Capabilities that the agent is allowed to use.
|
|
1007
|
+
* Validated against VALID_CAPABILITIES at compose time.
|
|
1008
|
+
*/
|
|
1009
|
+
experimental_capabilities: z4.array(z4.enum(VALID_CAPABILITIES)).refine((arr) => new Set(arr).size === arr.length, {
|
|
1010
|
+
message: "Duplicate capabilities are not allowed"
|
|
1011
|
+
}).optional(),
|
|
1012
1012
|
/**
|
|
1013
1013
|
* Agent metadata for display and personalization.
|
|
1014
1014
|
* - displayName: Human-readable name shown in the UI (preserves original casing).
|
|
@@ -8901,24 +8901,42 @@ import * as path2 from "path";
|
|
|
8901
8901
|
import * as fs from "fs/promises";
|
|
8902
8902
|
import * as path from "path";
|
|
8903
8903
|
import * as os2 from "os";
|
|
8904
|
-
import {
|
|
8904
|
+
import { execFile } from "child_process";
|
|
8905
8905
|
import { promisify } from "util";
|
|
8906
|
-
var
|
|
8906
|
+
var execFileAsync = promisify(execFile);
|
|
8907
|
+
function sanitizeGitArg(value, label) {
|
|
8908
|
+
if (!/^[a-zA-Z0-9._/\-@]+$/.test(value)) {
|
|
8909
|
+
throw new Error(
|
|
8910
|
+
`Invalid ${label}: contains disallowed characters. Only alphanumeric, dash, underscore, dot, slash, and @ are permitted.`
|
|
8911
|
+
);
|
|
8912
|
+
}
|
|
8913
|
+
if (value.startsWith("-")) {
|
|
8914
|
+
throw new Error(`Invalid ${label}: must not start with a dash`);
|
|
8915
|
+
}
|
|
8916
|
+
return value;
|
|
8917
|
+
}
|
|
8907
8918
|
async function downloadGitHubSkill(parsed, destDir) {
|
|
8908
|
-
const
|
|
8919
|
+
const owner = sanitizeGitArg(parsed.owner, "repository owner");
|
|
8920
|
+
const repo = sanitizeGitArg(parsed.repo, "repository name");
|
|
8921
|
+
const branch = sanitizeGitArg(parsed.branch, "branch name");
|
|
8922
|
+
const repoUrl = `https://github.com/${owner}/${repo}.git`;
|
|
8909
8923
|
const skillDir = path.join(destDir, parsed.skillName);
|
|
8910
8924
|
const tempDir = await fs.mkdtemp(path.join(os2.tmpdir(), "vm0-skill-"));
|
|
8911
8925
|
try {
|
|
8912
|
-
await
|
|
8913
|
-
await
|
|
8914
|
-
|
|
8926
|
+
await execFileAsync("git", ["init"], { cwd: tempDir });
|
|
8927
|
+
await execFileAsync("git", ["remote", "add", "origin", repoUrl], {
|
|
8928
|
+
cwd: tempDir
|
|
8929
|
+
});
|
|
8930
|
+
await execFileAsync("git", ["config", "core.sparseCheckout", "true"], {
|
|
8931
|
+
cwd: tempDir
|
|
8932
|
+
});
|
|
8915
8933
|
const sparsePattern = parsed.path || "/*";
|
|
8916
8934
|
const sparseFile = path.join(tempDir, ".git", "info", "sparse-checkout");
|
|
8917
8935
|
await fs.writeFile(sparseFile, sparsePattern + "\n");
|
|
8918
|
-
await
|
|
8936
|
+
await execFileAsync("git", ["fetch", "--depth", "1", "origin", branch], {
|
|
8919
8937
|
cwd: tempDir
|
|
8920
8938
|
});
|
|
8921
|
-
await
|
|
8939
|
+
await execFileAsync("git", ["checkout", branch], { cwd: tempDir });
|
|
8922
8940
|
await fs.mkdir(path.dirname(skillDir), { recursive: true });
|
|
8923
8941
|
if (parsed.path) {
|
|
8924
8942
|
const fetchedPath = path.join(tempDir, parsed.path);
|
|
@@ -8937,11 +8955,16 @@ async function downloadGitHubSkill(parsed, destDir) {
|
|
|
8937
8955
|
}
|
|
8938
8956
|
}
|
|
8939
8957
|
async function getDefaultBranch(owner, repo) {
|
|
8940
|
-
const
|
|
8958
|
+
const safeOwner = sanitizeGitArg(owner, "repository owner");
|
|
8959
|
+
const safeRepo = sanitizeGitArg(repo, "repository name");
|
|
8960
|
+
const repoUrl = `https://github.com/${safeOwner}/${safeRepo}.git`;
|
|
8941
8961
|
try {
|
|
8942
|
-
const { stdout } = await
|
|
8943
|
-
|
|
8944
|
-
|
|
8962
|
+
const { stdout } = await execFileAsync("git", [
|
|
8963
|
+
"ls-remote",
|
|
8964
|
+
"--symref",
|
|
8965
|
+
repoUrl,
|
|
8966
|
+
"HEAD"
|
|
8967
|
+
]);
|
|
8945
8968
|
const match = stdout.match(/ref: refs\/heads\/([^\s]+)/);
|
|
8946
8969
|
if (!match) {
|
|
8947
8970
|
throw new Error(
|
|
@@ -8969,25 +8992,34 @@ async function downloadGitHubDirectory(url) {
|
|
|
8969
8992
|
`Invalid GitHub URL: ${url}. Expected format: https://github.com/{owner}/{repo}[/tree/{branch}[/path]]`
|
|
8970
8993
|
);
|
|
8971
8994
|
}
|
|
8972
|
-
const
|
|
8995
|
+
const safeOwner = sanitizeGitArg(parsed.owner, "repository owner");
|
|
8996
|
+
const safeRepo = sanitizeGitArg(parsed.repo, "repository name");
|
|
8997
|
+
const repoUrl = `https://github.com/${safeOwner}/${safeRepo}.git`;
|
|
8973
8998
|
const tempDir = await fs.mkdtemp(path.join(os2.tmpdir(), "vm0-github-"));
|
|
8974
8999
|
try {
|
|
8975
9000
|
try {
|
|
8976
|
-
await
|
|
9001
|
+
await execFileAsync("git", ["--version"]);
|
|
8977
9002
|
} catch {
|
|
8978
9003
|
throw new Error(
|
|
8979
9004
|
"git command not found. Please install git to use GitHub URLs."
|
|
8980
9005
|
);
|
|
8981
9006
|
}
|
|
8982
|
-
const branch =
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
9007
|
+
const branch = sanitizeGitArg(
|
|
9008
|
+
parsed.branch ?? await getDefaultBranch(safeOwner, safeRepo),
|
|
9009
|
+
"branch name"
|
|
9010
|
+
);
|
|
9011
|
+
await execFileAsync("git", ["init"], { cwd: tempDir });
|
|
9012
|
+
await execFileAsync("git", ["remote", "add", "origin", repoUrl], {
|
|
9013
|
+
cwd: tempDir
|
|
9014
|
+
});
|
|
9015
|
+
await execFileAsync("git", ["config", "core.sparseCheckout", "true"], {
|
|
9016
|
+
cwd: tempDir
|
|
9017
|
+
});
|
|
8986
9018
|
const sparsePattern = parsed.path ?? "/*";
|
|
8987
9019
|
const sparseFile = path.join(tempDir, ".git", "info", "sparse-checkout");
|
|
8988
9020
|
await fs.writeFile(sparseFile, sparsePattern + "\n");
|
|
8989
9021
|
try {
|
|
8990
|
-
await
|
|
9022
|
+
await execFileAsync("git", ["fetch", "--depth", "1", "origin", branch], {
|
|
8991
9023
|
cwd: tempDir
|
|
8992
9024
|
});
|
|
8993
9025
|
} catch (error) {
|
|
@@ -9000,7 +9032,7 @@ async function downloadGitHubDirectory(url) {
|
|
|
9000
9032
|
}
|
|
9001
9033
|
throw error;
|
|
9002
9034
|
}
|
|
9003
|
-
await
|
|
9035
|
+
await execFileAsync("git", ["checkout", branch], { cwd: tempDir });
|
|
9004
9036
|
const downloadedDir = parsed.path ? path.join(tempDir, parsed.path) : tempDir;
|
|
9005
9037
|
return {
|
|
9006
9038
|
dir: downloadedDir,
|
|
@@ -9913,7 +9945,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
9913
9945
|
options.autoUpdate = false;
|
|
9914
9946
|
}
|
|
9915
9947
|
if (options.autoUpdate !== false) {
|
|
9916
|
-
await startSilentUpgrade("9.59.
|
|
9948
|
+
await startSilentUpgrade("9.59.5");
|
|
9917
9949
|
}
|
|
9918
9950
|
try {
|
|
9919
9951
|
let result;
|
|
@@ -11087,7 +11119,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
11087
11119
|
withErrorHandler(
|
|
11088
11120
|
async (identifier, prompt, options) => {
|
|
11089
11121
|
if (options.autoUpdate !== false) {
|
|
11090
|
-
await startSilentUpgrade("9.59.
|
|
11122
|
+
await startSilentUpgrade("9.59.5");
|
|
11091
11123
|
}
|
|
11092
11124
|
const { org, name, version } = parseIdentifier(identifier);
|
|
11093
11125
|
if (org && !options.experimentalSharedAgent) {
|
|
@@ -12774,7 +12806,7 @@ var cookAction = new Command34().name("cook").description("Quick start: prepare,
|
|
|
12774
12806
|
withErrorHandler(
|
|
12775
12807
|
async (prompt, options) => {
|
|
12776
12808
|
if (options.autoUpdate !== false) {
|
|
12777
|
-
const shouldExit = await checkAndUpgrade("9.59.
|
|
12809
|
+
const shouldExit = await checkAndUpgrade("9.59.5", prompt);
|
|
12778
12810
|
if (shouldExit) {
|
|
12779
12811
|
process.exit(0);
|
|
12780
12812
|
}
|
|
@@ -18125,13 +18157,13 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
18125
18157
|
if (latestVersion === null) {
|
|
18126
18158
|
throw new Error("Could not check for updates. Please try again later.");
|
|
18127
18159
|
}
|
|
18128
|
-
if (latestVersion === "9.59.
|
|
18129
|
-
console.log(chalk84.green(`\u2713 Already up to date (${"9.59.
|
|
18160
|
+
if (latestVersion === "9.59.5") {
|
|
18161
|
+
console.log(chalk84.green(`\u2713 Already up to date (${"9.59.5"})`));
|
|
18130
18162
|
return;
|
|
18131
18163
|
}
|
|
18132
18164
|
console.log(
|
|
18133
18165
|
chalk84.yellow(
|
|
18134
|
-
`Current version: ${"9.59.
|
|
18166
|
+
`Current version: ${"9.59.5"} -> Latest version: ${latestVersion}`
|
|
18135
18167
|
)
|
|
18136
18168
|
);
|
|
18137
18169
|
console.log();
|
|
@@ -18158,7 +18190,7 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
18158
18190
|
const success = await performUpgrade(packageManager);
|
|
18159
18191
|
if (success) {
|
|
18160
18192
|
console.log(
|
|
18161
|
-
chalk84.green(`\u2713 Upgraded from ${"9.59.
|
|
18193
|
+
chalk84.green(`\u2713 Upgraded from ${"9.59.5"} to ${latestVersion}`)
|
|
18162
18194
|
);
|
|
18163
18195
|
return;
|
|
18164
18196
|
}
|
|
@@ -18172,7 +18204,7 @@ var upgradeCommand = new Command90().name("upgrade").description("Upgrade vm0 CL
|
|
|
18172
18204
|
|
|
18173
18205
|
// src/index.ts
|
|
18174
18206
|
var program = new Command91();
|
|
18175
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.59.
|
|
18207
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.59.5");
|
|
18176
18208
|
program.addCommand(authCommand);
|
|
18177
18209
|
program.addCommand(infoCommand);
|
|
18178
18210
|
program.addCommand(composeCommand);
|