@vm0/cli 9.12.0 → 9.13.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 +159 -27
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1905,6 +1905,29 @@ var MODEL_PROVIDER_TYPES = {
|
|
|
1905
1905
|
credentialLabel: "API key",
|
|
1906
1906
|
helpText: "Get your API key at: https://console.anthropic.com/settings/keys"
|
|
1907
1907
|
},
|
|
1908
|
+
"openrouter-api-key": {
|
|
1909
|
+
framework: "claude-code",
|
|
1910
|
+
credentialName: "OPENROUTER_API_KEY",
|
|
1911
|
+
label: "OpenRouter API Key",
|
|
1912
|
+
credentialLabel: "API key",
|
|
1913
|
+
helpText: "Get your API key at: https://openrouter.ai/settings/keys",
|
|
1914
|
+
environmentMapping: {
|
|
1915
|
+
ANTHROPIC_AUTH_TOKEN: "$credential",
|
|
1916
|
+
ANTHROPIC_BASE_URL: "https://openrouter.ai/api",
|
|
1917
|
+
ANTHROPIC_API_KEY: "",
|
|
1918
|
+
ANTHROPIC_MODEL: "$model",
|
|
1919
|
+
ANTHROPIC_DEFAULT_OPUS_MODEL: "$model",
|
|
1920
|
+
ANTHROPIC_DEFAULT_SONNET_MODEL: "$model",
|
|
1921
|
+
ANTHROPIC_DEFAULT_HAIKU_MODEL: "$model",
|
|
1922
|
+
CLAUDE_CODE_SUBAGENT_MODEL: "$model"
|
|
1923
|
+
},
|
|
1924
|
+
models: [
|
|
1925
|
+
"anthropic/claude-sonnet-4.5",
|
|
1926
|
+
"anthropic/claude-opus-4.5",
|
|
1927
|
+
"anthropic/claude-haiku-4.5"
|
|
1928
|
+
],
|
|
1929
|
+
defaultModel: ""
|
|
1930
|
+
},
|
|
1908
1931
|
"moonshot-api-key": {
|
|
1909
1932
|
framework: "claude-code",
|
|
1910
1933
|
credentialName: "MOONSHOT_API_KEY",
|
|
@@ -1926,12 +1949,34 @@ var MODEL_PROVIDER_TYPES = {
|
|
|
1926
1949
|
"kimi-k2-thinking"
|
|
1927
1950
|
],
|
|
1928
1951
|
defaultModel: "kimi-k2.5"
|
|
1952
|
+
},
|
|
1953
|
+
"minimax-api-key": {
|
|
1954
|
+
framework: "claude-code",
|
|
1955
|
+
credentialName: "MINIMAX_API_KEY",
|
|
1956
|
+
label: "MiniMax API Key",
|
|
1957
|
+
credentialLabel: "API key",
|
|
1958
|
+
helpText: "Get your API key at: https://platform.minimax.io/user-center/basic-information/interface-key",
|
|
1959
|
+
environmentMapping: {
|
|
1960
|
+
ANTHROPIC_AUTH_TOKEN: "$credential",
|
|
1961
|
+
ANTHROPIC_BASE_URL: "https://api.minimax.io/anthropic",
|
|
1962
|
+
ANTHROPIC_MODEL: "$model",
|
|
1963
|
+
ANTHROPIC_DEFAULT_OPUS_MODEL: "$model",
|
|
1964
|
+
ANTHROPIC_DEFAULT_SONNET_MODEL: "$model",
|
|
1965
|
+
ANTHROPIC_DEFAULT_HAIKU_MODEL: "$model",
|
|
1966
|
+
CLAUDE_CODE_SUBAGENT_MODEL: "$model",
|
|
1967
|
+
API_TIMEOUT_MS: "3000000",
|
|
1968
|
+
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1"
|
|
1969
|
+
},
|
|
1970
|
+
models: ["MiniMax-M2.1"],
|
|
1971
|
+
defaultModel: "MiniMax-M2.1"
|
|
1929
1972
|
}
|
|
1930
1973
|
};
|
|
1931
1974
|
var modelProviderTypeSchema = z14.enum([
|
|
1932
1975
|
"claude-code-oauth-token",
|
|
1933
1976
|
"anthropic-api-key",
|
|
1934
|
-
"
|
|
1977
|
+
"openrouter-api-key",
|
|
1978
|
+
"moonshot-api-key",
|
|
1979
|
+
"minimax-api-key"
|
|
1935
1980
|
]);
|
|
1936
1981
|
var modelProviderFrameworkSchema = z14.enum(["claude-code", "codex"]);
|
|
1937
1982
|
function getModels(type) {
|
|
@@ -2072,6 +2117,27 @@ var modelProvidersSetDefaultContract = c11.router({
|
|
|
2072
2117
|
summary: "Set a model provider as default for its framework"
|
|
2073
2118
|
}
|
|
2074
2119
|
});
|
|
2120
|
+
var updateModelRequestSchema = z14.object({
|
|
2121
|
+
selectedModel: z14.string().optional()
|
|
2122
|
+
});
|
|
2123
|
+
var modelProvidersUpdateModelContract = c11.router({
|
|
2124
|
+
updateModel: {
|
|
2125
|
+
method: "PATCH",
|
|
2126
|
+
path: "/api/model-providers/:type/model",
|
|
2127
|
+
headers: authHeadersSchema,
|
|
2128
|
+
pathParams: z14.object({
|
|
2129
|
+
type: modelProviderTypeSchema
|
|
2130
|
+
}),
|
|
2131
|
+
body: updateModelRequestSchema,
|
|
2132
|
+
responses: {
|
|
2133
|
+
200: modelProviderResponseSchema,
|
|
2134
|
+
401: apiErrorSchema,
|
|
2135
|
+
404: apiErrorSchema,
|
|
2136
|
+
500: apiErrorSchema
|
|
2137
|
+
},
|
|
2138
|
+
summary: "Update model selection for an existing provider"
|
|
2139
|
+
}
|
|
2140
|
+
});
|
|
2075
2141
|
|
|
2076
2142
|
// ../../packages/core/src/contracts/sessions.ts
|
|
2077
2143
|
import { z as z15 } from "zod";
|
|
@@ -2507,7 +2573,10 @@ var platformLogStatusSchema = z19.enum([
|
|
|
2507
2573
|
"cancelled"
|
|
2508
2574
|
]);
|
|
2509
2575
|
var platformLogEntrySchema = z19.object({
|
|
2510
|
-
id: z19.string().uuid()
|
|
2576
|
+
id: z19.string().uuid(),
|
|
2577
|
+
agentName: z19.string(),
|
|
2578
|
+
status: platformLogStatusSchema,
|
|
2579
|
+
createdAt: z19.string()
|
|
2511
2580
|
});
|
|
2512
2581
|
var platformLogsListResponseSchema = z19.object({
|
|
2513
2582
|
data: z19.array(platformLogEntrySchema),
|
|
@@ -3685,6 +3754,18 @@ async function setModelProviderDefault(type) {
|
|
|
3685
3754
|
}
|
|
3686
3755
|
handleError(result, "Failed to set default model provider");
|
|
3687
3756
|
}
|
|
3757
|
+
async function updateModelProviderModel(type, selectedModel) {
|
|
3758
|
+
const config = await getClientConfig();
|
|
3759
|
+
const client = initClient8(modelProvidersUpdateModelContract, config);
|
|
3760
|
+
const result = await client.updateModel({
|
|
3761
|
+
params: { type },
|
|
3762
|
+
body: { selectedModel }
|
|
3763
|
+
});
|
|
3764
|
+
if (result.status === 200) {
|
|
3765
|
+
return result.body;
|
|
3766
|
+
}
|
|
3767
|
+
handleError(result, "Failed to update model provider");
|
|
3768
|
+
}
|
|
3688
3769
|
|
|
3689
3770
|
// src/lib/api/domains/usage.ts
|
|
3690
3771
|
async function getUsage(options) {
|
|
@@ -4812,7 +4893,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
4812
4893
|
)
|
|
4813
4894
|
);
|
|
4814
4895
|
if (options.autoUpdate !== false) {
|
|
4815
|
-
await silentUpgradeAfterCommand("9.
|
|
4896
|
+
await silentUpgradeAfterCommand("9.13.0");
|
|
4816
4897
|
}
|
|
4817
4898
|
} catch (error) {
|
|
4818
4899
|
if (error instanceof Error) {
|
|
@@ -5272,8 +5353,6 @@ var EventRenderer = class _EventRenderer {
|
|
|
5272
5353
|
const durationMs = Number(event.data.durationMs || 0);
|
|
5273
5354
|
const durationSec = (durationMs / 1e3).toFixed(1);
|
|
5274
5355
|
console.log(` Duration: ${chalk6.dim(durationSec + "s")}`);
|
|
5275
|
-
const cost = Number(event.data.cost || 0);
|
|
5276
|
-
console.log(` Cost: ${chalk6.dim("$" + cost.toFixed(4))}`);
|
|
5277
5356
|
const numTurns = Number(event.data.numTurns || 0);
|
|
5278
5357
|
console.log(` Turns: ${chalk6.dim(String(numTurns))}`);
|
|
5279
5358
|
const usage = event.data.usage;
|
|
@@ -7045,7 +7124,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
7045
7124
|
}
|
|
7046
7125
|
showNextSteps(result);
|
|
7047
7126
|
if (options.autoUpdate !== false) {
|
|
7048
|
-
await silentUpgradeAfterCommand("9.
|
|
7127
|
+
await silentUpgradeAfterCommand("9.13.0");
|
|
7049
7128
|
}
|
|
7050
7129
|
} catch (error) {
|
|
7051
7130
|
handleRunError(error, identifier);
|
|
@@ -8551,7 +8630,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
|
|
|
8551
8630
|
).option("-y, --yes", "Skip confirmation prompts").option("-v, --verbose", "Show full tool inputs and outputs").addOption(new Option5("--debug-no-mock-claude").hideHelp()).addOption(new Option5("--no-auto-update").hideHelp()).action(
|
|
8552
8631
|
async (prompt, options) => {
|
|
8553
8632
|
if (!options.noAutoUpdate) {
|
|
8554
|
-
const shouldExit = await checkAndUpgrade("9.
|
|
8633
|
+
const shouldExit = await checkAndUpgrade("9.13.0", prompt);
|
|
8555
8634
|
if (shouldExit) {
|
|
8556
8635
|
process.exit(0);
|
|
8557
8636
|
}
|
|
@@ -10960,12 +11039,6 @@ var listCommand7 = new Command51().name("list").alias("ls").description("List al
|
|
|
10960
11039
|
import { Command as Command52 } from "commander";
|
|
10961
11040
|
import chalk51 from "chalk";
|
|
10962
11041
|
import prompts2 from "prompts";
|
|
10963
|
-
var providerChoices = Object.entries(MODEL_PROVIDER_TYPES).map(
|
|
10964
|
-
([type, config]) => ({
|
|
10965
|
-
title: config.label,
|
|
10966
|
-
value: type
|
|
10967
|
-
})
|
|
10968
|
-
);
|
|
10969
11042
|
function validateProviderType(typeStr) {
|
|
10970
11043
|
if (!Object.keys(MODEL_PROVIDER_TYPES).includes(typeStr)) {
|
|
10971
11044
|
console.error(chalk51.red(`\u2717 Invalid type "${typeStr}"`));
|
|
@@ -10997,7 +11070,8 @@ function handleNonInteractiveMode(options) {
|
|
|
10997
11070
|
if (options.model) {
|
|
10998
11071
|
selectedModel = validateModel(type, options.model);
|
|
10999
11072
|
} else if (hasModelSelection(type)) {
|
|
11000
|
-
|
|
11073
|
+
const defaultModel = getDefaultModel(type);
|
|
11074
|
+
selectedModel = defaultModel || void 0;
|
|
11001
11075
|
}
|
|
11002
11076
|
return { type, credential: options.credential, selectedModel };
|
|
11003
11077
|
}
|
|
@@ -11007,7 +11081,10 @@ async function promptForModelSelection(type) {
|
|
|
11007
11081
|
}
|
|
11008
11082
|
const models = getModels(type) ?? [];
|
|
11009
11083
|
const defaultModel = getDefaultModel(type);
|
|
11010
|
-
const modelChoices =
|
|
11084
|
+
const modelChoices = defaultModel === "" ? [
|
|
11085
|
+
{ title: "auto (Recommended)", value: "" },
|
|
11086
|
+
...models.map((model) => ({ title: model, value: model }))
|
|
11087
|
+
] : models.map((model) => ({
|
|
11011
11088
|
title: model === defaultModel ? `${model} (Recommended)` : model,
|
|
11012
11089
|
value: model
|
|
11013
11090
|
}));
|
|
@@ -11020,7 +11097,8 @@ async function promptForModelSelection(type) {
|
|
|
11020
11097
|
},
|
|
11021
11098
|
{ onCancel: () => process.exit(0) }
|
|
11022
11099
|
);
|
|
11023
|
-
|
|
11100
|
+
const selected = modelResponse.model;
|
|
11101
|
+
return selected === "" ? void 0 : selected;
|
|
11024
11102
|
}
|
|
11025
11103
|
async function handleInteractiveMode() {
|
|
11026
11104
|
if (!isInteractive()) {
|
|
@@ -11034,12 +11112,20 @@ async function handleInteractiveMode() {
|
|
|
11034
11112
|
);
|
|
11035
11113
|
process.exit(1);
|
|
11036
11114
|
}
|
|
11115
|
+
const { modelProviders: configuredProviders } = await listModelProviders();
|
|
11116
|
+
const configuredTypes = new Set(configuredProviders.map((p) => p.type));
|
|
11117
|
+
const annotatedChoices = Object.entries(MODEL_PROVIDER_TYPES).map(
|
|
11118
|
+
([type2, config2]) => ({
|
|
11119
|
+
title: configuredTypes.has(type2) ? `${config2.label} \u2713` : config2.label,
|
|
11120
|
+
value: type2
|
|
11121
|
+
})
|
|
11122
|
+
);
|
|
11037
11123
|
const typeResponse = await prompts2(
|
|
11038
11124
|
{
|
|
11039
11125
|
type: "select",
|
|
11040
11126
|
name: "type",
|
|
11041
11127
|
message: "Select provider type:",
|
|
11042
|
-
choices:
|
|
11128
|
+
choices: annotatedChoices
|
|
11043
11129
|
},
|
|
11044
11130
|
{ onCancel: () => process.exit(0) }
|
|
11045
11131
|
);
|
|
@@ -11068,6 +11154,27 @@ async function handleInteractiveMode() {
|
|
|
11068
11154
|
console.log(chalk51.dim("Aborted"));
|
|
11069
11155
|
process.exit(0);
|
|
11070
11156
|
}
|
|
11157
|
+
if (checkResult.exists && checkResult.currentType === "model-provider") {
|
|
11158
|
+
console.log();
|
|
11159
|
+
console.log(`"${type}" is already configured.`);
|
|
11160
|
+
console.log();
|
|
11161
|
+
const actionResponse = await prompts2(
|
|
11162
|
+
{
|
|
11163
|
+
type: "select",
|
|
11164
|
+
name: "action",
|
|
11165
|
+
message: "",
|
|
11166
|
+
choices: [
|
|
11167
|
+
{ title: "Keep existing credential", value: "keep" },
|
|
11168
|
+
{ title: "Update credential", value: "update" }
|
|
11169
|
+
]
|
|
11170
|
+
},
|
|
11171
|
+
{ onCancel: () => process.exit(0) }
|
|
11172
|
+
);
|
|
11173
|
+
if (actionResponse.action === "keep") {
|
|
11174
|
+
const selectedModel2 = await promptForModelSelection(type);
|
|
11175
|
+
return { type, keepExistingCredential: true, selectedModel: selectedModel2 };
|
|
11176
|
+
}
|
|
11177
|
+
}
|
|
11071
11178
|
const config = MODEL_PROVIDER_TYPES[type];
|
|
11072
11179
|
console.log();
|
|
11073
11180
|
console.log(chalk51.dim(config.helpText));
|
|
@@ -11128,6 +11235,26 @@ var setupCommand2 = new Command52().name("setup").description("Configure a model
|
|
|
11128
11235
|
}
|
|
11129
11236
|
input = result;
|
|
11130
11237
|
}
|
|
11238
|
+
if (input.keepExistingCredential) {
|
|
11239
|
+
const provider2 = await updateModelProviderModel(
|
|
11240
|
+
input.type,
|
|
11241
|
+
input.selectedModel
|
|
11242
|
+
);
|
|
11243
|
+
const defaultNote2 = provider2.isDefault ? ` (default for ${provider2.framework})` : "";
|
|
11244
|
+
const modelNote2 = provider2.selectedModel ? ` with model: ${provider2.selectedModel}` : "";
|
|
11245
|
+
if (!hasModelSelection(input.type)) {
|
|
11246
|
+
console.log(
|
|
11247
|
+
chalk51.green(`\u2713 Model provider "${input.type}" unchanged`)
|
|
11248
|
+
);
|
|
11249
|
+
} else {
|
|
11250
|
+
console.log(
|
|
11251
|
+
chalk51.green(
|
|
11252
|
+
`\u2713 Model provider "${input.type}" updated${defaultNote2}${modelNote2}`
|
|
11253
|
+
)
|
|
11254
|
+
);
|
|
11255
|
+
}
|
|
11256
|
+
return;
|
|
11257
|
+
}
|
|
11131
11258
|
const { provider, created } = await upsertModelProvider({
|
|
11132
11259
|
type: input.type,
|
|
11133
11260
|
credential: input.credential,
|
|
@@ -11662,19 +11789,24 @@ async function handleModelProvider(ctx) {
|
|
|
11662
11789
|
}
|
|
11663
11790
|
let selectedModel;
|
|
11664
11791
|
if (selectedChoice?.models && selectedChoice.models.length > 0) {
|
|
11665
|
-
|
|
11666
|
-
()
|
|
11667
|
-
|
|
11668
|
-
|
|
11669
|
-
|
|
11670
|
-
|
|
11671
|
-
|
|
11672
|
-
)
|
|
11792
|
+
const modelChoices = selectedChoice.defaultModel === "" ? [
|
|
11793
|
+
{ title: "auto (Recommended)", value: "" },
|
|
11794
|
+
...selectedChoice.models.map((model) => ({
|
|
11795
|
+
title: model,
|
|
11796
|
+
value: model
|
|
11797
|
+
}))
|
|
11798
|
+
] : selectedChoice.models.map((model) => ({
|
|
11799
|
+
title: model === selectedChoice.defaultModel ? `${model} (Recommended)` : model,
|
|
11800
|
+
value: model
|
|
11801
|
+
}));
|
|
11802
|
+
const modelSelection = await step.prompt(
|
|
11803
|
+
() => promptSelect("Select model:", modelChoices)
|
|
11673
11804
|
);
|
|
11674
|
-
if (
|
|
11805
|
+
if (modelSelection === void 0) {
|
|
11675
11806
|
console.log(chalk57.dim("Cancelled"));
|
|
11676
11807
|
process.exit(0);
|
|
11677
11808
|
}
|
|
11809
|
+
selectedModel = modelSelection === "" ? void 0 : modelSelection;
|
|
11678
11810
|
}
|
|
11679
11811
|
const result = await setupModelProvider(providerType, credential, {
|
|
11680
11812
|
selectedModel
|
|
@@ -11830,7 +11962,7 @@ var setupClaudeCommand = new Command57().name("setup-claude").description("Insta
|
|
|
11830
11962
|
|
|
11831
11963
|
// src/index.ts
|
|
11832
11964
|
var program = new Command58();
|
|
11833
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
11965
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.13.0");
|
|
11834
11966
|
program.addCommand(authCommand);
|
|
11835
11967
|
program.addCommand(infoCommand);
|
|
11836
11968
|
program.addCommand(composeCommand);
|