@vm0/cli 5.10.0 → 6.0.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 +90 -65
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -434,7 +434,7 @@ var agentDefinitionSchema = z3.object({
|
|
|
434
434
|
* This field will be removed in a future version.
|
|
435
435
|
*/
|
|
436
436
|
image: z3.string().optional(),
|
|
437
|
-
|
|
437
|
+
framework: z3.string().min(1, "Framework is required"),
|
|
438
438
|
/**
|
|
439
439
|
* Array of pre-installed apps/tools for the agent environment.
|
|
440
440
|
* Format: "app" or "app:tag" (e.g., "github", "github:dev", "github:latest")
|
|
@@ -693,7 +693,7 @@ var eventsResponseSchema = z4.object({
|
|
|
693
693
|
hasMore: z4.boolean(),
|
|
694
694
|
nextSequence: z4.number(),
|
|
695
695
|
run: runStateSchema,
|
|
696
|
-
|
|
696
|
+
framework: z4.string()
|
|
697
697
|
});
|
|
698
698
|
var runsMainContract = c3.router({
|
|
699
699
|
/**
|
|
@@ -775,7 +775,7 @@ var metricsResponseSchema = z4.object({
|
|
|
775
775
|
var agentEventsResponseSchema = z4.object({
|
|
776
776
|
events: z4.array(runEventSchema),
|
|
777
777
|
hasMore: z4.boolean(),
|
|
778
|
-
|
|
778
|
+
framework: z4.string()
|
|
779
779
|
});
|
|
780
780
|
var networkLogEntrySchema = z4.object({
|
|
781
781
|
timestamp: z4.string(),
|
|
@@ -2691,34 +2691,34 @@ function parseGitHubTreeUrl(url) {
|
|
|
2691
2691
|
};
|
|
2692
2692
|
}
|
|
2693
2693
|
|
|
2694
|
-
// ../../packages/core/src/
|
|
2695
|
-
var
|
|
2696
|
-
function
|
|
2697
|
-
if (!
|
|
2698
|
-
return
|
|
2694
|
+
// ../../packages/core/src/frameworks.ts
|
|
2695
|
+
var SUPPORTED_FRAMEWORKS = ["claude-code", "codex"];
|
|
2696
|
+
function isSupportedFramework(framework) {
|
|
2697
|
+
if (!framework) return false;
|
|
2698
|
+
return SUPPORTED_FRAMEWORKS.includes(framework);
|
|
2699
2699
|
}
|
|
2700
|
-
function
|
|
2701
|
-
if (!
|
|
2700
|
+
function assertSupportedFramework(framework, context) {
|
|
2701
|
+
if (!isSupportedFramework(framework)) {
|
|
2702
2702
|
const contextMsg = context ? ` in ${context}` : "";
|
|
2703
2703
|
throw new Error(
|
|
2704
|
-
`Unsupported
|
|
2704
|
+
`Unsupported framework "${framework}"${contextMsg}. Supported frameworks: ${SUPPORTED_FRAMEWORKS.join(", ")}`
|
|
2705
2705
|
);
|
|
2706
2706
|
}
|
|
2707
2707
|
}
|
|
2708
|
-
function
|
|
2709
|
-
if (
|
|
2708
|
+
function getValidatedFramework(framework) {
|
|
2709
|
+
if (framework === void 0) {
|
|
2710
2710
|
return "claude-code";
|
|
2711
2711
|
}
|
|
2712
|
-
|
|
2713
|
-
return
|
|
2712
|
+
assertSupportedFramework(framework);
|
|
2713
|
+
return framework;
|
|
2714
2714
|
}
|
|
2715
|
-
var
|
|
2715
|
+
var FRAMEWORK_DISPLAY_NAMES = {
|
|
2716
2716
|
"claude-code": "Claude Code",
|
|
2717
2717
|
codex: "Codex"
|
|
2718
2718
|
};
|
|
2719
|
-
function
|
|
2720
|
-
|
|
2721
|
-
return
|
|
2719
|
+
function getFrameworkDisplayName(framework) {
|
|
2720
|
+
assertSupportedFramework(framework);
|
|
2721
|
+
return FRAMEWORK_DISPLAY_NAMES[framework];
|
|
2722
2722
|
}
|
|
2723
2723
|
|
|
2724
2724
|
// ../../packages/core/src/feature-switch.ts
|
|
@@ -3113,8 +3113,8 @@ async function getUsage(options) {
|
|
|
3113
3113
|
// src/lib/domain/yaml-validator.ts
|
|
3114
3114
|
import { z as z21 } from "zod";
|
|
3115
3115
|
|
|
3116
|
-
// src/lib/domain/
|
|
3117
|
-
var
|
|
3116
|
+
// src/lib/domain/framework-config.ts
|
|
3117
|
+
var FRAMEWORK_DEFAULTS = {
|
|
3118
3118
|
"claude-code": {
|
|
3119
3119
|
workingDir: "/home/user/workspace",
|
|
3120
3120
|
image: {
|
|
@@ -3130,13 +3130,13 @@ var PROVIDER_DEFAULTS = {
|
|
|
3130
3130
|
}
|
|
3131
3131
|
}
|
|
3132
3132
|
};
|
|
3133
|
-
function
|
|
3134
|
-
return
|
|
3133
|
+
function getFrameworkDefaults(framework) {
|
|
3134
|
+
return FRAMEWORK_DEFAULTS[framework];
|
|
3135
3135
|
}
|
|
3136
|
-
function
|
|
3137
|
-
return
|
|
3136
|
+
function isFrameworkSupported(framework) {
|
|
3137
|
+
return framework in FRAMEWORK_DEFAULTS;
|
|
3138
3138
|
}
|
|
3139
|
-
var
|
|
3139
|
+
var FRAMEWORK_APPS_IMAGES = {
|
|
3140
3140
|
"claude-code": {
|
|
3141
3141
|
github: {
|
|
3142
3142
|
production: "vm0/claude-code-github:latest",
|
|
@@ -3157,16 +3157,16 @@ function parseAppString(appString) {
|
|
|
3157
3157
|
tag: tag === "dev" ? "dev" : "latest"
|
|
3158
3158
|
};
|
|
3159
3159
|
}
|
|
3160
|
-
function getDefaultImageWithApps(
|
|
3161
|
-
const defaults =
|
|
3160
|
+
function getDefaultImageWithApps(framework, apps) {
|
|
3161
|
+
const defaults = FRAMEWORK_DEFAULTS[framework];
|
|
3162
3162
|
if (!defaults) return void 0;
|
|
3163
3163
|
if (apps && apps.length > 0) {
|
|
3164
|
-
const
|
|
3165
|
-
if (
|
|
3164
|
+
const frameworkApps = FRAMEWORK_APPS_IMAGES[framework];
|
|
3165
|
+
if (frameworkApps) {
|
|
3166
3166
|
const firstApp = apps[0];
|
|
3167
3167
|
if (firstApp) {
|
|
3168
3168
|
const { app, tag } = parseAppString(firstApp);
|
|
3169
|
-
const appImage =
|
|
3169
|
+
const appImage = frameworkApps[app];
|
|
3170
3170
|
if (appImage) {
|
|
3171
3171
|
return tag === "dev" ? appImage.development : appImage.production;
|
|
3172
3172
|
}
|
|
@@ -3188,18 +3188,18 @@ function validateGitHubTreeUrl(url) {
|
|
|
3188
3188
|
}
|
|
3189
3189
|
var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
3190
3190
|
(agent, ctx) => {
|
|
3191
|
-
const
|
|
3192
|
-
if (!agent.image && !
|
|
3191
|
+
const frameworkSupported = isFrameworkSupported(agent.framework);
|
|
3192
|
+
if (!agent.image && !frameworkSupported) {
|
|
3193
3193
|
ctx.addIssue({
|
|
3194
3194
|
code: z21.ZodIssueCode.custom,
|
|
3195
|
-
message: "Missing agent.image (required when
|
|
3195
|
+
message: "Missing agent.image (required when framework is not auto-configured)",
|
|
3196
3196
|
path: ["image"]
|
|
3197
3197
|
});
|
|
3198
3198
|
}
|
|
3199
|
-
if (!agent.working_dir && !
|
|
3199
|
+
if (!agent.working_dir && !frameworkSupported) {
|
|
3200
3200
|
ctx.addIssue({
|
|
3201
3201
|
code: z21.ZodIssueCode.custom,
|
|
3202
|
-
message: "Missing agent.working_dir (required when
|
|
3202
|
+
message: "Missing agent.working_dir (required when framework is not auto-configured)",
|
|
3203
3203
|
path: ["working_dir"]
|
|
3204
3204
|
});
|
|
3205
3205
|
}
|
|
@@ -3334,7 +3334,31 @@ function formatZodError(error) {
|
|
|
3334
3334
|
function validateAgentName(name) {
|
|
3335
3335
|
return cliAgentNameSchema.safeParse(name).success;
|
|
3336
3336
|
}
|
|
3337
|
+
function checkForDeprecatedProvider(config) {
|
|
3338
|
+
if (!config || typeof config !== "object") return null;
|
|
3339
|
+
const cfg = config;
|
|
3340
|
+
const agents = cfg.agents;
|
|
3341
|
+
if (!agents || typeof agents !== "object" || Array.isArray(agents))
|
|
3342
|
+
return null;
|
|
3343
|
+
for (const agent of Object.values(agents)) {
|
|
3344
|
+
if (agent && typeof agent === "object" && !Array.isArray(agent)) {
|
|
3345
|
+
if ("provider" in agent && !("framework" in agent)) {
|
|
3346
|
+
const providerValue = agent.provider;
|
|
3347
|
+
return `'provider' field is deprecated. Use 'framework' instead.
|
|
3348
|
+
|
|
3349
|
+
Change in your vm0.yaml:
|
|
3350
|
+
- provider: ${providerValue}
|
|
3351
|
+
+ framework: ${providerValue}`;
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
}
|
|
3355
|
+
return null;
|
|
3356
|
+
}
|
|
3337
3357
|
function validateAgentCompose(config) {
|
|
3358
|
+
const deprecationError = checkForDeprecatedProvider(config);
|
|
3359
|
+
if (deprecationError) {
|
|
3360
|
+
return { valid: false, error: deprecationError };
|
|
3361
|
+
}
|
|
3338
3362
|
if (config && typeof config === "object" && Array.isArray(config.agents)) {
|
|
3339
3363
|
return {
|
|
3340
3364
|
valid: false,
|
|
@@ -3742,21 +3766,21 @@ async function directUpload(storageName, storageType, cwd, options) {
|
|
|
3742
3766
|
}
|
|
3743
3767
|
|
|
3744
3768
|
// src/lib/storage/system-storage.ts
|
|
3745
|
-
function getInstructionsFilename(
|
|
3746
|
-
const
|
|
3747
|
-
if (
|
|
3769
|
+
function getInstructionsFilename(framework) {
|
|
3770
|
+
const validatedFramework = getValidatedFramework(framework);
|
|
3771
|
+
if (validatedFramework === "codex") {
|
|
3748
3772
|
return "AGENTS.md";
|
|
3749
3773
|
}
|
|
3750
3774
|
return "CLAUDE.md";
|
|
3751
3775
|
}
|
|
3752
|
-
async function uploadInstructions(agentName, instructionsFilePath, basePath,
|
|
3776
|
+
async function uploadInstructions(agentName, instructionsFilePath, basePath, framework) {
|
|
3753
3777
|
const storageName = getInstructionsStorageName(agentName);
|
|
3754
3778
|
const absolutePath = path4.isAbsolute(instructionsFilePath) ? instructionsFilePath : path4.join(basePath, instructionsFilePath);
|
|
3755
3779
|
const content = await fs4.readFile(absolutePath, "utf8");
|
|
3756
3780
|
const tmpDir = await fs4.mkdtemp(path4.join(os3.tmpdir(), "vm0-instructions-"));
|
|
3757
3781
|
const instructionsDir = path4.join(tmpDir, "instructions");
|
|
3758
3782
|
await fs4.mkdir(instructionsDir);
|
|
3759
|
-
const filename = getInstructionsFilename(
|
|
3783
|
+
const filename = getInstructionsFilename(framework);
|
|
3760
3784
|
await fs4.writeFile(path4.join(instructionsDir, filename), content);
|
|
3761
3785
|
try {
|
|
3762
3786
|
const result = await directUpload(storageName, "volume", instructionsDir);
|
|
@@ -3868,13 +3892,13 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
3868
3892
|
const agentName = Object.keys(agents)[0];
|
|
3869
3893
|
const agent = agents[agentName];
|
|
3870
3894
|
const basePath = dirname2(configFile);
|
|
3871
|
-
if (agent.
|
|
3872
|
-
const defaults =
|
|
3895
|
+
if (agent.framework) {
|
|
3896
|
+
const defaults = getFrameworkDefaults(agent.framework);
|
|
3873
3897
|
if (defaults) {
|
|
3874
3898
|
if (!agent.image) {
|
|
3875
3899
|
const apps = agent.apps;
|
|
3876
3900
|
const defaultImage = getDefaultImageWithApps(
|
|
3877
|
-
agent.
|
|
3901
|
+
agent.framework,
|
|
3878
3902
|
apps
|
|
3879
3903
|
);
|
|
3880
3904
|
if (defaultImage) {
|
|
@@ -3896,13 +3920,13 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
3896
3920
|
}
|
|
3897
3921
|
if (agent.instructions) {
|
|
3898
3922
|
const instructionsPath = agent.instructions;
|
|
3899
|
-
const
|
|
3923
|
+
const framework = agent.framework;
|
|
3900
3924
|
console.log(`Uploading instructions: ${instructionsPath}`);
|
|
3901
3925
|
const result = await uploadInstructions(
|
|
3902
3926
|
agentName,
|
|
3903
3927
|
instructionsPath,
|
|
3904
3928
|
basePath,
|
|
3905
|
-
|
|
3929
|
+
framework
|
|
3906
3930
|
);
|
|
3907
3931
|
console.log(
|
|
3908
3932
|
chalk2.green(
|
|
@@ -4174,8 +4198,8 @@ var EventRenderer = class {
|
|
|
4174
4198
|
);
|
|
4175
4199
|
}
|
|
4176
4200
|
static renderInit(event, prefix, suffix) {
|
|
4177
|
-
const
|
|
4178
|
-
const displayName =
|
|
4201
|
+
const frameworkStr = String(event.data.framework || "claude-code");
|
|
4202
|
+
const displayName = isSupportedFramework(frameworkStr) ? getFrameworkDisplayName(frameworkStr) : frameworkStr;
|
|
4179
4203
|
console.log(prefix + "[init]" + suffix + ` Starting ${displayName} agent`);
|
|
4180
4204
|
console.log(` Session: ${chalk3.dim(String(event.data.sessionId || ""))}`);
|
|
4181
4205
|
if (event.data.model) {
|
|
@@ -4289,7 +4313,7 @@ var ClaudeEventParser = class {
|
|
|
4289
4313
|
type: "init",
|
|
4290
4314
|
timestamp: /* @__PURE__ */ new Date(),
|
|
4291
4315
|
data: {
|
|
4292
|
-
|
|
4316
|
+
framework: "claude-code",
|
|
4293
4317
|
sessionId: event.session_id,
|
|
4294
4318
|
model: event.model,
|
|
4295
4319
|
tools: event.tools,
|
|
@@ -4395,7 +4419,7 @@ var CodexEventParser = class {
|
|
|
4395
4419
|
type: "init",
|
|
4396
4420
|
timestamp: /* @__PURE__ */ new Date(),
|
|
4397
4421
|
data: {
|
|
4398
|
-
|
|
4422
|
+
framework: "codex",
|
|
4399
4423
|
sessionId: event.thread_id,
|
|
4400
4424
|
tools: []
|
|
4401
4425
|
}
|
|
@@ -4553,7 +4577,7 @@ ${changes}` }
|
|
|
4553
4577
|
};
|
|
4554
4578
|
|
|
4555
4579
|
// src/lib/events/event-parser-factory.ts
|
|
4556
|
-
function
|
|
4580
|
+
function detectFrameworkFromEvent(rawEvent) {
|
|
4557
4581
|
if (!rawEvent || typeof rawEvent !== "object") {
|
|
4558
4582
|
return null;
|
|
4559
4583
|
}
|
|
@@ -4566,15 +4590,15 @@ function detectProviderFromEvent(rawEvent) {
|
|
|
4566
4590
|
}
|
|
4567
4591
|
return null;
|
|
4568
4592
|
}
|
|
4569
|
-
function getEventParser(
|
|
4570
|
-
if (
|
|
4593
|
+
function getEventParser(framework) {
|
|
4594
|
+
if (framework === "codex") {
|
|
4571
4595
|
return CodexEventParser;
|
|
4572
4596
|
}
|
|
4573
4597
|
return ClaudeEventParser;
|
|
4574
4598
|
}
|
|
4575
|
-
function parseEvent(rawEvent,
|
|
4576
|
-
const
|
|
4577
|
-
const Parser = getEventParser(
|
|
4599
|
+
function parseEvent(rawEvent, framework) {
|
|
4600
|
+
const effectiveFramework = framework ? getValidatedFramework(framework) : detectFrameworkFromEvent(rawEvent) || "claude-code";
|
|
4601
|
+
const Parser = getEventParser(effectiveFramework);
|
|
4578
4602
|
return Parser.parse(rawEvent);
|
|
4579
4603
|
}
|
|
4580
4604
|
|
|
@@ -5611,8 +5635,8 @@ async function streamEvents(runId, options) {
|
|
|
5611
5635
|
ablyClient.close();
|
|
5612
5636
|
}
|
|
5613
5637
|
function handleMessage(message) {
|
|
5614
|
-
|
|
5615
|
-
|
|
5638
|
+
if (message.name === "events") {
|
|
5639
|
+
const data = message.data;
|
|
5616
5640
|
for (const event of data.events) {
|
|
5617
5641
|
const eventData = event;
|
|
5618
5642
|
const seq = eventData.sequenceNumber;
|
|
@@ -5630,7 +5654,8 @@ async function streamEvents(runId, options) {
|
|
|
5630
5654
|
startTimestamp
|
|
5631
5655
|
});
|
|
5632
5656
|
}
|
|
5633
|
-
} else if (
|
|
5657
|
+
} else if (message.name === "status") {
|
|
5658
|
+
const data = message.data;
|
|
5634
5659
|
if (data.status === "completed") {
|
|
5635
5660
|
onRunCompleted(data.result, {
|
|
5636
5661
|
verbose,
|
|
@@ -5791,7 +5816,7 @@ async function pollEvents(runId, options) {
|
|
|
5791
5816
|
});
|
|
5792
5817
|
for (const event of response.events) {
|
|
5793
5818
|
const eventData = event.eventData;
|
|
5794
|
-
if (response.
|
|
5819
|
+
if (response.framework === "codex") {
|
|
5795
5820
|
CodexEventRenderer.render(eventData);
|
|
5796
5821
|
} else {
|
|
5797
5822
|
const parsed = parseEvent(eventData);
|
|
@@ -7567,7 +7592,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
7567
7592
|
var cookCmd = new Command19().name("cook").description("One-click agent preparation and execution from vm0.yaml");
|
|
7568
7593
|
cookCmd.argument("[prompt]", "Prompt for the agent").option("-y, --yes", "Skip confirmation prompts").option("--debug-no-mock-claude").action(
|
|
7569
7594
|
async (prompt, options) => {
|
|
7570
|
-
const shouldExit = await checkAndUpgrade("
|
|
7595
|
+
const shouldExit = await checkAndUpgrade("6.0.0", prompt);
|
|
7571
7596
|
if (shouldExit) {
|
|
7572
7597
|
process.exit(0);
|
|
7573
7598
|
}
|
|
@@ -8045,7 +8070,7 @@ async function showAgentEvents(runId, options) {
|
|
|
8045
8070
|
}
|
|
8046
8071
|
const events = options.order === "desc" ? [...response.events].reverse() : response.events;
|
|
8047
8072
|
for (const event of events) {
|
|
8048
|
-
renderAgentEvent(event, response.
|
|
8073
|
+
renderAgentEvent(event, response.framework);
|
|
8049
8074
|
}
|
|
8050
8075
|
if (response.hasMore) {
|
|
8051
8076
|
console.log();
|
|
@@ -8413,7 +8438,7 @@ function formatComposeOutput(name, versionId, content, variableSources) {
|
|
|
8413
8438
|
console.log(chalk29.bold("Agents:"));
|
|
8414
8439
|
for (const [agentName, agent] of Object.entries(content.agents)) {
|
|
8415
8440
|
console.log(` ${chalk29.cyan(agentName)}:`);
|
|
8416
|
-
console.log(`
|
|
8441
|
+
console.log(` Framework: ${agent.framework}`);
|
|
8417
8442
|
if (agent.image) {
|
|
8418
8443
|
console.log(` Image: ${agent.image}`);
|
|
8419
8444
|
}
|
|
@@ -8567,7 +8592,7 @@ function generateVm0Yaml(agentName) {
|
|
|
8567
8592
|
|
|
8568
8593
|
agents:
|
|
8569
8594
|
${agentName}:
|
|
8570
|
-
|
|
8595
|
+
framework: claude-code
|
|
8571
8596
|
# Build agentic workflow using natural language
|
|
8572
8597
|
instructions: AGENTS.md
|
|
8573
8598
|
# Agent skills - see https://github.com/vm0-ai/vm0-skills for available skills
|
|
@@ -10564,7 +10589,7 @@ var credentialCommand = new Command41().name("experimental-credential").descript
|
|
|
10564
10589
|
|
|
10565
10590
|
// src/index.ts
|
|
10566
10591
|
var program = new Command42();
|
|
10567
|
-
program.name("vm0").description("VM0 CLI - A modern build tool").version("
|
|
10592
|
+
program.name("vm0").description("VM0 CLI - A modern build tool").version("6.0.0");
|
|
10568
10593
|
program.command("info").description("Display environment information").action(async () => {
|
|
10569
10594
|
console.log(chalk43.bold("System Information:"));
|
|
10570
10595
|
console.log(`Node Version: ${process.version}`);
|