@vm0/cli 4.27.0 → 4.28.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 +38 -21
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -12404,14 +12404,16 @@ var createComposeResponseSchema = external_exports.object({
|
|
|
12404
12404
|
});
|
|
12405
12405
|
var composesMainContract = c2.router({
|
|
12406
12406
|
/**
|
|
12407
|
-
* GET /api/agent/composes?name={name}
|
|
12407
|
+
* GET /api/agent/composes?name={name}&scope={scope}
|
|
12408
12408
|
* Get agent compose by name with HEAD version content
|
|
12409
|
+
* If scope is not provided, uses the authenticated user's default scope
|
|
12409
12410
|
*/
|
|
12410
12411
|
getByName: {
|
|
12411
12412
|
method: "GET",
|
|
12412
12413
|
path: "/api/agent/composes",
|
|
12413
12414
|
query: external_exports.object({
|
|
12414
|
-
name: external_exports.string().min(1, "Missing name query parameter")
|
|
12415
|
+
name: external_exports.string().min(1, "Missing name query parameter"),
|
|
12416
|
+
scope: external_exports.string().optional()
|
|
12415
12417
|
}),
|
|
12416
12418
|
responses: {
|
|
12417
12419
|
200: composeResponseSchema,
|
|
@@ -13521,11 +13523,15 @@ var ApiClient = class {
|
|
|
13521
13523
|
}
|
|
13522
13524
|
return apiUrl;
|
|
13523
13525
|
}
|
|
13524
|
-
async getComposeByName(name) {
|
|
13526
|
+
async getComposeByName(name, scope) {
|
|
13525
13527
|
const baseUrl = await this.getBaseUrl();
|
|
13526
13528
|
const headers = await this.getHeaders();
|
|
13529
|
+
const params = new URLSearchParams({ name });
|
|
13530
|
+
if (scope) {
|
|
13531
|
+
params.append("scope", scope);
|
|
13532
|
+
}
|
|
13527
13533
|
const response = await fetch(
|
|
13528
|
-
`${baseUrl}/api/agent/composes
|
|
13534
|
+
`${baseUrl}/api/agent/composes?${params.toString()}`,
|
|
13529
13535
|
{
|
|
13530
13536
|
method: "GET",
|
|
13531
13537
|
headers
|
|
@@ -14664,19 +14670,20 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
14664
14670
|
const response = await apiClient.createOrUpdateCompose({
|
|
14665
14671
|
content: config2
|
|
14666
14672
|
});
|
|
14673
|
+
const scopeResponse = await apiClient.getScope();
|
|
14667
14674
|
const shortVersionId = response.versionId.slice(0, 8);
|
|
14675
|
+
const displayName = `${scopeResponse.slug}/${response.name}`;
|
|
14668
14676
|
if (response.action === "created") {
|
|
14669
|
-
console.log(chalk2.green(`\u2713 Compose created: ${
|
|
14677
|
+
console.log(chalk2.green(`\u2713 Compose created: ${displayName}`));
|
|
14670
14678
|
} else {
|
|
14671
|
-
console.log(chalk2.green(`\u2713 Compose version exists: ${
|
|
14679
|
+
console.log(chalk2.green(`\u2713 Compose version exists: ${displayName}`));
|
|
14672
14680
|
}
|
|
14673
|
-
console.log(chalk2.dim(`
|
|
14674
|
-
console.log(chalk2.dim(` Version: ${shortVersionId}`));
|
|
14681
|
+
console.log(chalk2.dim(` Version: ${shortVersionId}`));
|
|
14675
14682
|
console.log();
|
|
14676
14683
|
console.log(" Run your agent:");
|
|
14677
14684
|
console.log(
|
|
14678
14685
|
chalk2.cyan(
|
|
14679
|
-
` vm0 run ${
|
|
14686
|
+
` vm0 run ${displayName}:${shortVersionId} --artifact-name <artifact> "your prompt"`
|
|
14680
14687
|
)
|
|
14681
14688
|
);
|
|
14682
14689
|
} catch (error43) {
|
|
@@ -15390,14 +15397,22 @@ function parseIdentifier(identifier) {
|
|
|
15390
15397
|
if (isUUID(identifier)) {
|
|
15391
15398
|
return { name: identifier };
|
|
15392
15399
|
}
|
|
15393
|
-
|
|
15394
|
-
|
|
15400
|
+
let scope;
|
|
15401
|
+
let rest = identifier;
|
|
15402
|
+
const slashIndex = identifier.indexOf("/");
|
|
15403
|
+
if (slashIndex > 0) {
|
|
15404
|
+
scope = identifier.slice(0, slashIndex);
|
|
15405
|
+
rest = identifier.slice(slashIndex + 1);
|
|
15406
|
+
}
|
|
15407
|
+
const colonIndex = rest.indexOf(":");
|
|
15408
|
+
if (colonIndex > 0 && colonIndex < rest.length - 1) {
|
|
15395
15409
|
return {
|
|
15396
|
-
|
|
15397
|
-
|
|
15410
|
+
scope,
|
|
15411
|
+
name: rest.slice(0, colonIndex),
|
|
15412
|
+
version: rest.slice(colonIndex + 1)
|
|
15398
15413
|
};
|
|
15399
15414
|
}
|
|
15400
|
-
return { name:
|
|
15415
|
+
return { scope, name: rest };
|
|
15401
15416
|
}
|
|
15402
15417
|
async function pollEvents(runId, options) {
|
|
15403
15418
|
let nextSequence = 0;
|
|
@@ -15494,7 +15509,7 @@ function showNextSteps(result) {
|
|
|
15494
15509
|
}
|
|
15495
15510
|
var runCmd = new Command2().name("run").description("Execute an agent").argument(
|
|
15496
15511
|
"<identifier>",
|
|
15497
|
-
"Agent
|
|
15512
|
+
"Agent reference: [scope/]name[:version] (e.g., 'my-agent', 'lancy/my-agent:abc123', 'my-agent:latest')"
|
|
15498
15513
|
).argument("<prompt>", "Prompt for the agent").option(
|
|
15499
15514
|
"--vars <KEY=value>",
|
|
15500
15515
|
"Variables for ${{ vars.xxx }} (repeatable, falls back to env vars and .env)",
|
|
@@ -15521,7 +15536,7 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15521
15536
|
const startTimestamp = /* @__PURE__ */ new Date();
|
|
15522
15537
|
const verbose = options.verbose;
|
|
15523
15538
|
try {
|
|
15524
|
-
const { name, version: version2 } = parseIdentifier(identifier);
|
|
15539
|
+
const { scope, name, version: version2 } = parseIdentifier(identifier);
|
|
15525
15540
|
let composeId;
|
|
15526
15541
|
let composeContent;
|
|
15527
15542
|
if (isUUID(name)) {
|
|
@@ -15540,10 +15555,11 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15540
15555
|
}
|
|
15541
15556
|
} else {
|
|
15542
15557
|
if (verbose) {
|
|
15543
|
-
|
|
15558
|
+
const displayRef = scope ? `${scope}/${name}` : name;
|
|
15559
|
+
console.log(chalk5.dim(` Resolving agent: ${displayRef}`));
|
|
15544
15560
|
}
|
|
15545
15561
|
try {
|
|
15546
|
-
const compose = await apiClient.getComposeByName(name);
|
|
15562
|
+
const compose = await apiClient.getComposeByName(name, scope);
|
|
15547
15563
|
composeId = compose.id;
|
|
15548
15564
|
composeContent = compose.content;
|
|
15549
15565
|
if (verbose) {
|
|
@@ -15551,7 +15567,8 @@ var runCmd = new Command2().name("run").description("Execute an agent").argument
|
|
|
15551
15567
|
}
|
|
15552
15568
|
} catch (error43) {
|
|
15553
15569
|
if (error43 instanceof Error) {
|
|
15554
|
-
|
|
15570
|
+
const displayRef = scope ? `${scope}/${name}` : name;
|
|
15571
|
+
console.error(chalk5.red(`\u2717 Agent not found: ${displayRef}`));
|
|
15555
15572
|
console.error(
|
|
15556
15573
|
chalk5.dim(
|
|
15557
15574
|
" Make sure you've composed the agent with: vm0 compose"
|
|
@@ -16797,7 +16814,7 @@ async function autoPullArtifact(runOutput, artifactDir) {
|
|
|
16797
16814
|
}
|
|
16798
16815
|
var cookCmd = new Command13().name("cook").description("One-click agent preparation and execution from vm0.yaml");
|
|
16799
16816
|
cookCmd.argument("[prompt]", "Prompt for the agent").action(async (prompt) => {
|
|
16800
|
-
const shouldExit = await checkAndUpgrade("4.
|
|
16817
|
+
const shouldExit = await checkAndUpgrade("4.28.0", prompt);
|
|
16801
16818
|
if (shouldExit) {
|
|
16802
16819
|
process.exit(0);
|
|
16803
16820
|
}
|
|
@@ -17937,7 +17954,7 @@ var initCommand3 = new Command23().name("init").description("Initialize a new VM
|
|
|
17937
17954
|
|
|
17938
17955
|
// src/index.ts
|
|
17939
17956
|
var program = new Command24();
|
|
17940
|
-
program.name("vm0").description("VM0 CLI - A modern build tool").version("4.
|
|
17957
|
+
program.name("vm0").description("VM0 CLI - A modern build tool").version("4.28.0");
|
|
17941
17958
|
program.command("info").description("Display environment information").action(async () => {
|
|
17942
17959
|
console.log(chalk25.bold("System Information:"));
|
|
17943
17960
|
console.log(`Node Version: ${process.version}`);
|