@vm0/cli 9.38.1 → 9.38.3
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 +171 -164
- 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.38.
|
|
48
|
+
release: "9.38.3",
|
|
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.38.
|
|
67
|
+
version: "9.38.3",
|
|
68
68
|
command: process.argv.slice(2).join(" ")
|
|
69
69
|
});
|
|
70
70
|
Sentry.setContext("runtime", {
|
|
@@ -607,7 +607,7 @@ function getConfigPath() {
|
|
|
607
607
|
return join2(homedir2(), ".vm0", "config.json");
|
|
608
608
|
}
|
|
609
609
|
var infoCommand = new Command6().name("info").description("Display environment and debug information").action(async () => {
|
|
610
|
-
console.log(chalk7.bold(`VM0 CLI v${"9.38.
|
|
610
|
+
console.log(chalk7.bold(`VM0 CLI v${"9.38.3"}`));
|
|
611
611
|
console.log();
|
|
612
612
|
const config = await loadConfig();
|
|
613
613
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -641,7 +641,7 @@ import { Command as Command7, Option } from "commander";
|
|
|
641
641
|
import chalk8 from "chalk";
|
|
642
642
|
import { readFile as readFile4, rm as rm3 } from "fs/promises";
|
|
643
643
|
import { existsSync as existsSync5 } from "fs";
|
|
644
|
-
import { dirname as dirname2, join as
|
|
644
|
+
import { dirname as dirname2, join as join8 } from "path";
|
|
645
645
|
import { parse as parseYaml2 } from "yaml";
|
|
646
646
|
|
|
647
647
|
// ../../packages/core/src/variable-expander.ts
|
|
@@ -4590,6 +4590,14 @@ function getFrameworkDisplayName(framework) {
|
|
|
4590
4590
|
assertSupportedFramework(framework);
|
|
4591
4591
|
return FRAMEWORK_DISPLAY_NAMES[framework];
|
|
4592
4592
|
}
|
|
4593
|
+
var FRAMEWORK_INSTRUCTIONS_FILENAMES = {
|
|
4594
|
+
"claude-code": "CLAUDE.md",
|
|
4595
|
+
codex: "AGENTS.md"
|
|
4596
|
+
};
|
|
4597
|
+
function getInstructionsFilename(framework) {
|
|
4598
|
+
const validated = getValidatedFramework(framework);
|
|
4599
|
+
return FRAMEWORK_INSTRUCTIONS_FILENAMES[validated];
|
|
4600
|
+
}
|
|
4593
4601
|
|
|
4594
4602
|
// ../../packages/core/src/feature-switch.ts
|
|
4595
4603
|
var FEATURE_SWITCHES = {
|
|
@@ -4646,18 +4654,18 @@ async function getRawHeaders() {
|
|
|
4646
4654
|
}
|
|
4647
4655
|
return headers;
|
|
4648
4656
|
}
|
|
4649
|
-
async function httpGet(
|
|
4657
|
+
async function httpGet(path17) {
|
|
4650
4658
|
const baseUrl = await getBaseUrl();
|
|
4651
4659
|
const headers = await getRawHeaders();
|
|
4652
|
-
return fetch(`${baseUrl}${
|
|
4660
|
+
return fetch(`${baseUrl}${path17}`, {
|
|
4653
4661
|
method: "GET",
|
|
4654
4662
|
headers
|
|
4655
4663
|
});
|
|
4656
4664
|
}
|
|
4657
|
-
async function httpPost(
|
|
4665
|
+
async function httpPost(path17, body) {
|
|
4658
4666
|
const baseUrl = await getBaseUrl();
|
|
4659
4667
|
const headers = await getRawHeaders();
|
|
4660
|
-
return fetch(`${baseUrl}${
|
|
4668
|
+
return fetch(`${baseUrl}${path17}`, {
|
|
4661
4669
|
method: "POST",
|
|
4662
4670
|
headers: {
|
|
4663
4671
|
...headers,
|
|
@@ -4666,10 +4674,10 @@ async function httpPost(path16, body) {
|
|
|
4666
4674
|
body: JSON.stringify(body)
|
|
4667
4675
|
});
|
|
4668
4676
|
}
|
|
4669
|
-
async function httpDelete(
|
|
4677
|
+
async function httpDelete(path17) {
|
|
4670
4678
|
const baseUrl = await getBaseUrl();
|
|
4671
4679
|
const headers = await getRawHeaders();
|
|
4672
|
-
return fetch(`${baseUrl}${
|
|
4680
|
+
return fetch(`${baseUrl}${path17}`, {
|
|
4673
4681
|
method: "DELETE",
|
|
4674
4682
|
headers
|
|
4675
4683
|
});
|
|
@@ -5287,29 +5295,29 @@ var cliComposeSchema = z29.object({
|
|
|
5287
5295
|
}
|
|
5288
5296
|
}
|
|
5289
5297
|
});
|
|
5290
|
-
function formatInvalidTypeIssue(
|
|
5298
|
+
function formatInvalidTypeIssue(path17, issue) {
|
|
5291
5299
|
const received = issue.received;
|
|
5292
5300
|
const isMissing = received === "undefined" || issue.message.includes("received undefined") || issue.message === "Required";
|
|
5293
|
-
if (
|
|
5301
|
+
if (path17 === "version" && isMissing) {
|
|
5294
5302
|
return "Missing config.version";
|
|
5295
5303
|
}
|
|
5296
|
-
if (
|
|
5304
|
+
if (path17 === "agents" && isMissing) {
|
|
5297
5305
|
return "Missing agents object in config";
|
|
5298
5306
|
}
|
|
5299
|
-
if (
|
|
5300
|
-
const volumeKey =
|
|
5307
|
+
if (path17.startsWith("volumes.") && path17.endsWith(".name")) {
|
|
5308
|
+
const volumeKey = path17.split(".")[1];
|
|
5301
5309
|
return `Volume "${volumeKey}" must have a 'name' field (string)`;
|
|
5302
5310
|
}
|
|
5303
|
-
if (
|
|
5304
|
-
const volumeKey =
|
|
5311
|
+
if (path17.startsWith("volumes.") && path17.endsWith(".version")) {
|
|
5312
|
+
const volumeKey = path17.split(".")[1];
|
|
5305
5313
|
return `Volume "${volumeKey}" must have a 'version' field (string)`;
|
|
5306
5314
|
}
|
|
5307
5315
|
if (issue.expected === "array") {
|
|
5308
|
-
const fieldName =
|
|
5316
|
+
const fieldName = path17.replace(/^agents\.[^.]+\./, "agent.");
|
|
5309
5317
|
return `${fieldName} must be an array`;
|
|
5310
5318
|
}
|
|
5311
5319
|
if (issue.expected === "string" && received === "number") {
|
|
5312
|
-
const fieldName =
|
|
5320
|
+
const fieldName = path17.replace(/^agents\.[^.]+\./, "agent.");
|
|
5313
5321
|
const match = fieldName.match(/^(agent\.[^.]+)\.\d+$/);
|
|
5314
5322
|
if (match) {
|
|
5315
5323
|
return `Each entry in ${match[1]?.replace("agent.", "")} must be a string`;
|
|
@@ -5320,24 +5328,24 @@ function formatInvalidTypeIssue(path16, issue) {
|
|
|
5320
5328
|
function formatZodError(error) {
|
|
5321
5329
|
const issue = error.issues[0];
|
|
5322
5330
|
if (!issue) return "Validation failed";
|
|
5323
|
-
const
|
|
5331
|
+
const path17 = issue.path.join(".");
|
|
5324
5332
|
const message = issue.message;
|
|
5325
|
-
if (!
|
|
5333
|
+
if (!path17) return message;
|
|
5326
5334
|
if (issue.code === "invalid_type") {
|
|
5327
|
-
const formatted = formatInvalidTypeIssue(
|
|
5335
|
+
const formatted = formatInvalidTypeIssue(path17, issue);
|
|
5328
5336
|
if (formatted) return formatted;
|
|
5329
5337
|
}
|
|
5330
|
-
if (issue.code === "invalid_key" &&
|
|
5338
|
+
if (issue.code === "invalid_key" && path17.startsWith("agents.")) {
|
|
5331
5339
|
return "Invalid agent name format. Must be 3-64 characters, letters, numbers, and hyphens only. Must start and end with letter or number.";
|
|
5332
5340
|
}
|
|
5333
|
-
if (message === "Invalid key in record" &&
|
|
5341
|
+
if (message === "Invalid key in record" && path17.startsWith("agents.")) {
|
|
5334
5342
|
return "Invalid agent name format. Must be 3-64 characters, letters, numbers, and hyphens only. Must start and end with letter or number.";
|
|
5335
5343
|
}
|
|
5336
5344
|
if (issue.code === "custom") {
|
|
5337
5345
|
return message;
|
|
5338
5346
|
}
|
|
5339
|
-
if (
|
|
5340
|
-
const cleanPath =
|
|
5347
|
+
if (path17.startsWith("agents.")) {
|
|
5348
|
+
const cleanPath = path17.replace(/^agents\.[^.]+\./, "agent.");
|
|
5341
5349
|
if (message.startsWith("Invalid input:")) {
|
|
5342
5350
|
const match = message.match(/expected (\w+), received (\w+)/);
|
|
5343
5351
|
if (match && match[1] === "string" && match[2] === "number") {
|
|
@@ -5349,7 +5357,7 @@ function formatZodError(error) {
|
|
|
5349
5357
|
}
|
|
5350
5358
|
return `${cleanPath}: ${message}`;
|
|
5351
5359
|
}
|
|
5352
|
-
return `${
|
|
5360
|
+
return `${path17}: ${message}`;
|
|
5353
5361
|
}
|
|
5354
5362
|
function validateAgentName(name) {
|
|
5355
5363
|
return cliAgentNameSchema.safeParse(name).success;
|
|
@@ -5396,25 +5404,17 @@ function validateAgentCompose(config) {
|
|
|
5396
5404
|
}
|
|
5397
5405
|
|
|
5398
5406
|
// src/lib/domain/github-skills.ts
|
|
5407
|
+
import * as fs2 from "fs/promises";
|
|
5408
|
+
import * as path2 from "path";
|
|
5409
|
+
import { parse as parseYaml } from "yaml";
|
|
5410
|
+
|
|
5411
|
+
// src/lib/external/git-client.ts
|
|
5399
5412
|
import * as fs from "fs/promises";
|
|
5400
5413
|
import * as path from "path";
|
|
5401
5414
|
import * as os2 from "os";
|
|
5402
5415
|
import { exec } from "child_process";
|
|
5403
5416
|
import { promisify } from "util";
|
|
5404
|
-
import { parse as parseYaml } from "yaml";
|
|
5405
5417
|
var execAsync = promisify(exec);
|
|
5406
|
-
function parseGitHubTreeUrl2(url) {
|
|
5407
|
-
const parsed = parseGitHubTreeUrl(url);
|
|
5408
|
-
if (!parsed) {
|
|
5409
|
-
throw new Error(
|
|
5410
|
-
`Invalid GitHub tree URL: ${url}. Expected format: https://github.com/{owner}/{repo}/tree/{branch}/{path}`
|
|
5411
|
-
);
|
|
5412
|
-
}
|
|
5413
|
-
return parsed;
|
|
5414
|
-
}
|
|
5415
|
-
function getSkillStorageName2(parsed) {
|
|
5416
|
-
return getSkillStorageName(parsed.fullPath);
|
|
5417
|
-
}
|
|
5418
5418
|
async function downloadGitHubSkill(parsed, destDir) {
|
|
5419
5419
|
const repoUrl = `https://github.com/${parsed.owner}/${parsed.repo}.git`;
|
|
5420
5420
|
const skillDir = path.join(destDir, parsed.skillName);
|
|
@@ -5512,10 +5512,24 @@ async function downloadGitHubDirectory(url) {
|
|
|
5512
5512
|
throw error;
|
|
5513
5513
|
}
|
|
5514
5514
|
}
|
|
5515
|
+
|
|
5516
|
+
// src/lib/domain/github-skills.ts
|
|
5517
|
+
function parseGitHubTreeUrl2(url) {
|
|
5518
|
+
const parsed = parseGitHubTreeUrl(url);
|
|
5519
|
+
if (!parsed) {
|
|
5520
|
+
throw new Error(
|
|
5521
|
+
`Invalid GitHub tree URL: ${url}. Expected format: https://github.com/{owner}/{repo}/tree/{branch}/{path}`
|
|
5522
|
+
);
|
|
5523
|
+
}
|
|
5524
|
+
return parsed;
|
|
5525
|
+
}
|
|
5526
|
+
function getSkillStorageName2(parsed) {
|
|
5527
|
+
return getSkillStorageName(parsed.fullPath);
|
|
5528
|
+
}
|
|
5515
5529
|
async function validateSkillDirectory(skillDir) {
|
|
5516
|
-
const skillMdPath =
|
|
5530
|
+
const skillMdPath = path2.join(skillDir, "SKILL.md");
|
|
5517
5531
|
try {
|
|
5518
|
-
await
|
|
5532
|
+
await fs2.access(skillMdPath);
|
|
5519
5533
|
} catch {
|
|
5520
5534
|
throw new Error(
|
|
5521
5535
|
`Skill directory missing required SKILL.md file: ${skillDir}`
|
|
@@ -5549,36 +5563,36 @@ function parseSkillFrontmatter(content) {
|
|
|
5549
5563
|
};
|
|
5550
5564
|
}
|
|
5551
5565
|
async function readSkillFrontmatter(skillDir) {
|
|
5552
|
-
const skillMdPath =
|
|
5553
|
-
const content = await
|
|
5566
|
+
const skillMdPath = path2.join(skillDir, "SKILL.md");
|
|
5567
|
+
const content = await fs2.readFile(skillMdPath, "utf8");
|
|
5554
5568
|
return parseSkillFrontmatter(content);
|
|
5555
5569
|
}
|
|
5556
5570
|
|
|
5557
5571
|
// src/lib/storage/system-storage.ts
|
|
5558
|
-
import * as
|
|
5559
|
-
import * as
|
|
5572
|
+
import * as fs5 from "fs/promises";
|
|
5573
|
+
import * as path5 from "path";
|
|
5560
5574
|
import * as os4 from "os";
|
|
5561
5575
|
|
|
5562
5576
|
// src/lib/storage/direct-upload.ts
|
|
5563
5577
|
import { createHash } from "crypto";
|
|
5564
|
-
import * as
|
|
5565
|
-
import * as
|
|
5578
|
+
import * as fs4 from "fs";
|
|
5579
|
+
import * as path4 from "path";
|
|
5566
5580
|
import * as os3 from "os";
|
|
5567
5581
|
import * as tar2 from "tar";
|
|
5568
5582
|
|
|
5569
5583
|
// src/lib/utils/file-utils.ts
|
|
5570
|
-
import * as
|
|
5571
|
-
import * as
|
|
5584
|
+
import * as fs3 from "fs";
|
|
5585
|
+
import * as path3 from "path";
|
|
5572
5586
|
import * as tar from "tar";
|
|
5573
5587
|
function checkDirectoryStatus(dirPath) {
|
|
5574
|
-
if (!
|
|
5588
|
+
if (!fs3.existsSync(dirPath)) {
|
|
5575
5589
|
return { exists: false, empty: true };
|
|
5576
5590
|
}
|
|
5577
|
-
const stat =
|
|
5591
|
+
const stat = fs3.statSync(dirPath);
|
|
5578
5592
|
if (!stat.isDirectory()) {
|
|
5579
5593
|
return { exists: true, empty: false };
|
|
5580
5594
|
}
|
|
5581
|
-
const entries =
|
|
5595
|
+
const entries = fs3.readdirSync(dirPath);
|
|
5582
5596
|
return { exists: true, empty: entries.length === 0 };
|
|
5583
5597
|
}
|
|
5584
5598
|
function formatBytes(bytes) {
|
|
@@ -5623,14 +5637,14 @@ function listTarFiles(tarPath) {
|
|
|
5623
5637
|
async function listLocalFiles(dir, excludeDirs = [".vm0"]) {
|
|
5624
5638
|
const files = [];
|
|
5625
5639
|
async function walkDir(currentDir, relativePath = "") {
|
|
5626
|
-
const entries = await
|
|
5640
|
+
const entries = await fs3.promises.readdir(currentDir, {
|
|
5627
5641
|
withFileTypes: true
|
|
5628
5642
|
});
|
|
5629
5643
|
for (const entry of entries) {
|
|
5630
|
-
const entryRelativePath = relativePath ?
|
|
5644
|
+
const entryRelativePath = relativePath ? path3.join(relativePath, entry.name) : entry.name;
|
|
5631
5645
|
if (entry.isDirectory()) {
|
|
5632
5646
|
if (!excludeDirs.includes(entry.name)) {
|
|
5633
|
-
await walkDir(
|
|
5647
|
+
await walkDir(path3.join(currentDir, entry.name), entryRelativePath);
|
|
5634
5648
|
}
|
|
5635
5649
|
} else {
|
|
5636
5650
|
files.push(entryRelativePath);
|
|
@@ -5646,8 +5660,8 @@ async function removeExtraFiles(dir, remoteFiles, excludeDirs = [".vm0"]) {
|
|
|
5646
5660
|
for (const localFile of localFiles) {
|
|
5647
5661
|
const normalizedPath = localFile.replace(/\\/g, "/");
|
|
5648
5662
|
if (!remoteFiles.has(normalizedPath)) {
|
|
5649
|
-
const fullPath =
|
|
5650
|
-
await
|
|
5663
|
+
const fullPath = path3.join(dir, localFile);
|
|
5664
|
+
await fs3.promises.unlink(fullPath);
|
|
5651
5665
|
removedCount++;
|
|
5652
5666
|
}
|
|
5653
5667
|
}
|
|
@@ -5655,17 +5669,17 @@ async function removeExtraFiles(dir, remoteFiles, excludeDirs = [".vm0"]) {
|
|
|
5655
5669
|
return removedCount;
|
|
5656
5670
|
}
|
|
5657
5671
|
async function removeEmptyDirs(dir, excludeDirs = [".vm0"]) {
|
|
5658
|
-
const entries = await
|
|
5672
|
+
const entries = await fs3.promises.readdir(dir, { withFileTypes: true });
|
|
5659
5673
|
let isEmpty = true;
|
|
5660
5674
|
for (const entry of entries) {
|
|
5661
|
-
const fullPath =
|
|
5675
|
+
const fullPath = path3.join(dir, entry.name);
|
|
5662
5676
|
if (entry.isDirectory()) {
|
|
5663
5677
|
if (excludeDirs.includes(entry.name)) {
|
|
5664
5678
|
isEmpty = false;
|
|
5665
5679
|
} else {
|
|
5666
5680
|
const subDirEmpty = await removeEmptyDirs(fullPath, excludeDirs);
|
|
5667
5681
|
if (subDirEmpty) {
|
|
5668
|
-
await
|
|
5682
|
+
await fs3.promises.rmdir(fullPath);
|
|
5669
5683
|
} else {
|
|
5670
5684
|
isEmpty = false;
|
|
5671
5685
|
}
|
|
@@ -5681,7 +5695,7 @@ async function removeEmptyDirs(dir, excludeDirs = [".vm0"]) {
|
|
|
5681
5695
|
async function hashFileStream(filePath) {
|
|
5682
5696
|
return new Promise((resolve, reject) => {
|
|
5683
5697
|
const hash = createHash("sha256");
|
|
5684
|
-
const stream =
|
|
5698
|
+
const stream = fs4.createReadStream(filePath);
|
|
5685
5699
|
stream.on("data", (chunk) => hash.update(chunk));
|
|
5686
5700
|
stream.on("end", () => resolve(hash.digest("hex")));
|
|
5687
5701
|
stream.on("error", reject);
|
|
@@ -5689,10 +5703,10 @@ async function hashFileStream(filePath) {
|
|
|
5689
5703
|
}
|
|
5690
5704
|
async function getAllFiles(dirPath, baseDir = dirPath) {
|
|
5691
5705
|
const files = [];
|
|
5692
|
-
const entries = await
|
|
5706
|
+
const entries = await fs4.promises.readdir(dirPath, { withFileTypes: true });
|
|
5693
5707
|
for (const entry of entries) {
|
|
5694
|
-
const fullPath =
|
|
5695
|
-
const relativePath =
|
|
5708
|
+
const fullPath = path4.join(dirPath, entry.name);
|
|
5709
|
+
const relativePath = path4.relative(baseDir, fullPath);
|
|
5696
5710
|
if (relativePath.startsWith(".vm0")) {
|
|
5697
5711
|
continue;
|
|
5698
5712
|
}
|
|
@@ -5709,10 +5723,10 @@ async function collectFileMetadata(cwd, files, onProgress) {
|
|
|
5709
5723
|
const fileEntries = [];
|
|
5710
5724
|
for (let i = 0; i < files.length; i++) {
|
|
5711
5725
|
const file = files[i];
|
|
5712
|
-
const relativePath =
|
|
5726
|
+
const relativePath = path4.relative(cwd, file);
|
|
5713
5727
|
const [hash, stats] = await Promise.all([
|
|
5714
5728
|
hashFileStream(file),
|
|
5715
|
-
|
|
5729
|
+
fs4.promises.stat(file)
|
|
5716
5730
|
]);
|
|
5717
5731
|
fileEntries.push({
|
|
5718
5732
|
path: relativePath,
|
|
@@ -5726,10 +5740,10 @@ async function collectFileMetadata(cwd, files, onProgress) {
|
|
|
5726
5740
|
return fileEntries;
|
|
5727
5741
|
}
|
|
5728
5742
|
async function createArchive(cwd, files) {
|
|
5729
|
-
const tmpDir =
|
|
5730
|
-
const tarPath =
|
|
5743
|
+
const tmpDir = fs4.mkdtempSync(path4.join(os3.tmpdir(), "vm0-"));
|
|
5744
|
+
const tarPath = path4.join(tmpDir, "archive.tar.gz");
|
|
5731
5745
|
try {
|
|
5732
|
-
const relativePaths = files.map((file) =>
|
|
5746
|
+
const relativePaths = files.map((file) => path4.relative(cwd, file));
|
|
5733
5747
|
if (relativePaths.length > 0) {
|
|
5734
5748
|
await tar2.create(
|
|
5735
5749
|
{
|
|
@@ -5750,13 +5764,13 @@ async function createArchive(cwd, files) {
|
|
|
5750
5764
|
["."]
|
|
5751
5765
|
);
|
|
5752
5766
|
}
|
|
5753
|
-
const tarBuffer = await
|
|
5767
|
+
const tarBuffer = await fs4.promises.readFile(tarPath);
|
|
5754
5768
|
return tarBuffer;
|
|
5755
5769
|
} finally {
|
|
5756
|
-
if (
|
|
5757
|
-
await
|
|
5770
|
+
if (fs4.existsSync(tarPath)) {
|
|
5771
|
+
await fs4.promises.unlink(tarPath);
|
|
5758
5772
|
}
|
|
5759
|
-
await
|
|
5773
|
+
await fs4.promises.rmdir(tmpDir);
|
|
5760
5774
|
}
|
|
5761
5775
|
}
|
|
5762
5776
|
function createManifest(files) {
|
|
@@ -5872,22 +5886,15 @@ async function directUpload(storageName, storageType, cwd, options) {
|
|
|
5872
5886
|
}
|
|
5873
5887
|
|
|
5874
5888
|
// src/lib/storage/system-storage.ts
|
|
5875
|
-
function getInstructionsFilename(framework) {
|
|
5876
|
-
const validatedFramework = getValidatedFramework(framework);
|
|
5877
|
-
if (validatedFramework === "codex") {
|
|
5878
|
-
return "AGENTS.md";
|
|
5879
|
-
}
|
|
5880
|
-
return "CLAUDE.md";
|
|
5881
|
-
}
|
|
5882
5889
|
async function uploadInstructions(agentName, instructionsFilePath, basePath, framework) {
|
|
5883
5890
|
const storageName = getInstructionsStorageName(agentName.toLowerCase());
|
|
5884
|
-
const absolutePath =
|
|
5885
|
-
const content = await
|
|
5886
|
-
const tmpDir = await
|
|
5887
|
-
const instructionsDir =
|
|
5888
|
-
await
|
|
5891
|
+
const absolutePath = path5.isAbsolute(instructionsFilePath) ? instructionsFilePath : path5.join(basePath, instructionsFilePath);
|
|
5892
|
+
const content = await fs5.readFile(absolutePath, "utf8");
|
|
5893
|
+
const tmpDir = await fs5.mkdtemp(path5.join(os4.tmpdir(), "vm0-instructions-"));
|
|
5894
|
+
const instructionsDir = path5.join(tmpDir, "instructions");
|
|
5895
|
+
await fs5.mkdir(instructionsDir);
|
|
5889
5896
|
const filename = getInstructionsFilename(framework);
|
|
5890
|
-
await
|
|
5897
|
+
await fs5.writeFile(path5.join(instructionsDir, filename), content);
|
|
5891
5898
|
try {
|
|
5892
5899
|
const result = await directUpload(storageName, "volume", instructionsDir);
|
|
5893
5900
|
return {
|
|
@@ -5896,13 +5903,13 @@ async function uploadInstructions(agentName, instructionsFilePath, basePath, fra
|
|
|
5896
5903
|
action: result.deduplicated ? "deduplicated" : "created"
|
|
5897
5904
|
};
|
|
5898
5905
|
} finally {
|
|
5899
|
-
await
|
|
5906
|
+
await fs5.rm(tmpDir, { recursive: true, force: true });
|
|
5900
5907
|
}
|
|
5901
5908
|
}
|
|
5902
5909
|
async function uploadSkill(skillUrl) {
|
|
5903
5910
|
const parsed = parseGitHubTreeUrl2(skillUrl);
|
|
5904
5911
|
const storageName = getSkillStorageName2(parsed);
|
|
5905
|
-
const tmpDir = await
|
|
5912
|
+
const tmpDir = await fs5.mkdtemp(path5.join(os4.tmpdir(), "vm0-skill-"));
|
|
5906
5913
|
try {
|
|
5907
5914
|
const skillDir = await downloadGitHubSkill(parsed, tmpDir);
|
|
5908
5915
|
await validateSkillDirectory(skillDir);
|
|
@@ -5916,7 +5923,7 @@ async function uploadSkill(skillUrl) {
|
|
|
5916
5923
|
frontmatter
|
|
5917
5924
|
};
|
|
5918
5925
|
} finally {
|
|
5919
|
-
await
|
|
5926
|
+
await fs5.rm(tmpDir, { recursive: true, force: true });
|
|
5920
5927
|
}
|
|
5921
5928
|
}
|
|
5922
5929
|
|
|
@@ -6347,7 +6354,7 @@ async function handleGitHubCompose(url, options) {
|
|
|
6347
6354
|
console.log(`Downloading from GitHub: ${url}`);
|
|
6348
6355
|
}
|
|
6349
6356
|
const { dir: downloadedDir, tempRoot } = await downloadGitHubDirectory(url);
|
|
6350
|
-
const configFile =
|
|
6357
|
+
const configFile = join8(downloadedDir, "vm0.yaml");
|
|
6351
6358
|
try {
|
|
6352
6359
|
if (!existsSync5(configFile)) {
|
|
6353
6360
|
if (options.json) {
|
|
@@ -6474,7 +6481,7 @@ var composeCommand = new Command7().name("compose").description("Create or updat
|
|
|
6474
6481
|
options.autoUpdate = false;
|
|
6475
6482
|
}
|
|
6476
6483
|
if (options.autoUpdate !== false) {
|
|
6477
|
-
await startSilentUpgrade("9.38.
|
|
6484
|
+
await startSilentUpgrade("9.38.3");
|
|
6478
6485
|
}
|
|
6479
6486
|
try {
|
|
6480
6487
|
let result;
|
|
@@ -6998,7 +7005,7 @@ var EventRenderer = class _EventRenderer {
|
|
|
6998
7005
|
|
|
6999
7006
|
// src/commands/run/shared.ts
|
|
7000
7007
|
import chalk12 from "chalk";
|
|
7001
|
-
import * as
|
|
7008
|
+
import * as fs6 from "fs";
|
|
7002
7009
|
import { config as dotenvConfig } from "dotenv";
|
|
7003
7010
|
|
|
7004
7011
|
// src/lib/events/claude-event-parser.ts
|
|
@@ -8250,7 +8257,7 @@ var ApiClient = class {
|
|
|
8250
8257
|
/**
|
|
8251
8258
|
* Generic GET request
|
|
8252
8259
|
*/
|
|
8253
|
-
async get(
|
|
8260
|
+
async get(path17) {
|
|
8254
8261
|
const baseUrl = await this.getBaseUrl();
|
|
8255
8262
|
const token = await getToken();
|
|
8256
8263
|
if (!token) {
|
|
@@ -8263,7 +8270,7 @@ var ApiClient = class {
|
|
|
8263
8270
|
if (bypassSecret) {
|
|
8264
8271
|
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
8265
8272
|
}
|
|
8266
|
-
return fetch(`${baseUrl}${
|
|
8273
|
+
return fetch(`${baseUrl}${path17}`, {
|
|
8267
8274
|
method: "GET",
|
|
8268
8275
|
headers
|
|
8269
8276
|
});
|
|
@@ -8271,7 +8278,7 @@ var ApiClient = class {
|
|
|
8271
8278
|
/**
|
|
8272
8279
|
* Generic POST request
|
|
8273
8280
|
*/
|
|
8274
|
-
async post(
|
|
8281
|
+
async post(path17, options) {
|
|
8275
8282
|
const baseUrl = await this.getBaseUrl();
|
|
8276
8283
|
const token = await getToken();
|
|
8277
8284
|
if (!token) {
|
|
@@ -8287,7 +8294,7 @@ var ApiClient = class {
|
|
|
8287
8294
|
if (bypassSecret) {
|
|
8288
8295
|
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
8289
8296
|
}
|
|
8290
|
-
return fetch(`${baseUrl}${
|
|
8297
|
+
return fetch(`${baseUrl}${path17}`, {
|
|
8291
8298
|
method: "POST",
|
|
8292
8299
|
headers,
|
|
8293
8300
|
body: options?.body
|
|
@@ -8296,7 +8303,7 @@ var ApiClient = class {
|
|
|
8296
8303
|
/**
|
|
8297
8304
|
* Generic DELETE request
|
|
8298
8305
|
*/
|
|
8299
|
-
async delete(
|
|
8306
|
+
async delete(path17) {
|
|
8300
8307
|
const baseUrl = await this.getBaseUrl();
|
|
8301
8308
|
const token = await getToken();
|
|
8302
8309
|
if (!token) {
|
|
@@ -8309,7 +8316,7 @@ var ApiClient = class {
|
|
|
8309
8316
|
if (bypassSecret) {
|
|
8310
8317
|
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
8311
8318
|
}
|
|
8312
|
-
return fetch(`${baseUrl}${
|
|
8319
|
+
return fetch(`${baseUrl}${path17}`, {
|
|
8313
8320
|
method: "DELETE",
|
|
8314
8321
|
headers
|
|
8315
8322
|
});
|
|
@@ -8456,7 +8463,7 @@ function loadValues(cliValues, configNames, envFilePath) {
|
|
|
8456
8463
|
}
|
|
8457
8464
|
let fileValues = {};
|
|
8458
8465
|
if (envFilePath) {
|
|
8459
|
-
if (!
|
|
8466
|
+
if (!fs6.existsSync(envFilePath)) {
|
|
8460
8467
|
throw new Error(`Environment file not found: ${envFilePath}`);
|
|
8461
8468
|
}
|
|
8462
8469
|
const dotenvResult = dotenvConfig({ path: envFilePath, quiet: true });
|
|
@@ -8688,7 +8695,7 @@ var mainRunCommand = new Command8().name("run").description("Run an agent").argu
|
|
|
8688
8695
|
async (identifier, prompt, options) => {
|
|
8689
8696
|
try {
|
|
8690
8697
|
if (options.autoUpdate !== false) {
|
|
8691
|
-
await startSilentUpgrade("9.38.
|
|
8698
|
+
await startSilentUpgrade("9.38.3");
|
|
8692
8699
|
}
|
|
8693
8700
|
const { scope, name, version } = parseIdentifier(identifier);
|
|
8694
8701
|
if (scope && !options.experimentalSharedAgent) {
|
|
@@ -9169,13 +9176,13 @@ import { Command as Command19 } from "commander";
|
|
|
9169
9176
|
// src/commands/volume/init.ts
|
|
9170
9177
|
import { Command as Command13 } from "commander";
|
|
9171
9178
|
import chalk18 from "chalk";
|
|
9172
|
-
import
|
|
9179
|
+
import path7 from "path";
|
|
9173
9180
|
|
|
9174
9181
|
// src/lib/storage/storage-utils.ts
|
|
9175
9182
|
import { readFile as readFile5, writeFile as writeFile4, mkdir as mkdir4 } from "fs/promises";
|
|
9176
9183
|
import { existsSync as existsSync7 } from "fs";
|
|
9177
9184
|
import { parse as parseYaml3, stringify as stringifyYaml } from "yaml";
|
|
9178
|
-
import
|
|
9185
|
+
import path6 from "path";
|
|
9179
9186
|
var CONFIG_DIR = ".vm0";
|
|
9180
9187
|
var CONFIG_FILE = "storage.yaml";
|
|
9181
9188
|
function isValidStorageName(name) {
|
|
@@ -9186,8 +9193,8 @@ function isValidStorageName(name) {
|
|
|
9186
9193
|
return pattern.test(name) && !name.includes("--");
|
|
9187
9194
|
}
|
|
9188
9195
|
async function readStorageConfig(basePath = process.cwd()) {
|
|
9189
|
-
const configPath =
|
|
9190
|
-
const legacyConfigPath =
|
|
9196
|
+
const configPath = path6.join(basePath, CONFIG_DIR, CONFIG_FILE);
|
|
9197
|
+
const legacyConfigPath = path6.join(basePath, CONFIG_DIR, "volume.yaml");
|
|
9191
9198
|
let actualPath = null;
|
|
9192
9199
|
if (existsSync7(configPath)) {
|
|
9193
9200
|
actualPath = configPath;
|
|
@@ -9205,8 +9212,8 @@ async function readStorageConfig(basePath = process.cwd()) {
|
|
|
9205
9212
|
return config;
|
|
9206
9213
|
}
|
|
9207
9214
|
async function writeStorageConfig(storageName, basePath = process.cwd(), type2 = "volume") {
|
|
9208
|
-
const configDir =
|
|
9209
|
-
const configPath =
|
|
9215
|
+
const configDir = path6.join(basePath, CONFIG_DIR);
|
|
9216
|
+
const configPath = path6.join(configDir, CONFIG_FILE);
|
|
9210
9217
|
if (!existsSync7(configDir)) {
|
|
9211
9218
|
await mkdir4(configDir, { recursive: true });
|
|
9212
9219
|
}
|
|
@@ -9222,14 +9229,14 @@ async function writeStorageConfig(storageName, basePath = process.cwd(), type2 =
|
|
|
9222
9229
|
var initCommand = new Command13().name("init").description("Initialize a volume in the current directory").option("-n, --name <name>", "Volume name (required in non-interactive mode)").action(
|
|
9223
9230
|
withErrorHandler(async (options) => {
|
|
9224
9231
|
const cwd = process.cwd();
|
|
9225
|
-
const dirName =
|
|
9232
|
+
const dirName = path7.basename(cwd);
|
|
9226
9233
|
const existingConfig = await readStorageConfig(cwd);
|
|
9227
9234
|
if (existingConfig) {
|
|
9228
9235
|
console.log(
|
|
9229
9236
|
chalk18.yellow(`Volume already initialized: ${existingConfig.name}`)
|
|
9230
9237
|
);
|
|
9231
9238
|
console.log(
|
|
9232
|
-
chalk18.dim(`Config file: ${
|
|
9239
|
+
chalk18.dim(`Config file: ${path7.join(cwd, ".vm0", "storage.yaml")}`)
|
|
9233
9240
|
);
|
|
9234
9241
|
return;
|
|
9235
9242
|
}
|
|
@@ -9278,7 +9285,7 @@ var initCommand = new Command13().name("init").description("Initialize a volume
|
|
|
9278
9285
|
console.log(chalk18.green(`\u2713 Initialized volume: ${volumeName}`));
|
|
9279
9286
|
console.log(
|
|
9280
9287
|
chalk18.dim(
|
|
9281
|
-
` Config saved to ${
|
|
9288
|
+
` Config saved to ${path7.join(cwd, ".vm0", "storage.yaml")}`
|
|
9282
9289
|
)
|
|
9283
9290
|
);
|
|
9284
9291
|
})
|
|
@@ -9323,8 +9330,8 @@ var pushCommand = new Command14().name("push").description("Push local files to
|
|
|
9323
9330
|
// src/commands/volume/pull.ts
|
|
9324
9331
|
import { Command as Command15 } from "commander";
|
|
9325
9332
|
import chalk21 from "chalk";
|
|
9326
|
-
import
|
|
9327
|
-
import * as
|
|
9333
|
+
import path8 from "path";
|
|
9334
|
+
import * as fs7 from "fs";
|
|
9328
9335
|
import * as os5 from "os";
|
|
9329
9336
|
import * as tar3 from "tar";
|
|
9330
9337
|
|
|
@@ -9377,9 +9384,9 @@ var pullCommand = new Command15().name("pull").description("Pull cloud files to
|
|
|
9377
9384
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
9378
9385
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
9379
9386
|
console.log(chalk21.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
9380
|
-
const tmpDir =
|
|
9381
|
-
const tarPath =
|
|
9382
|
-
await
|
|
9387
|
+
const tmpDir = fs7.mkdtempSync(path8.join(os5.tmpdir(), "vm0-"));
|
|
9388
|
+
const tarPath = path8.join(tmpDir, "volume.tar.gz");
|
|
9389
|
+
await fs7.promises.writeFile(tarPath, tarBuffer);
|
|
9383
9390
|
console.log(chalk21.dim("Syncing local files..."));
|
|
9384
9391
|
const remoteFiles = await listTarFiles(tarPath);
|
|
9385
9392
|
const remoteFilesSet = new Set(
|
|
@@ -9397,8 +9404,8 @@ var pullCommand = new Command15().name("pull").description("Pull cloud files to
|
|
|
9397
9404
|
cwd,
|
|
9398
9405
|
gzip: true
|
|
9399
9406
|
});
|
|
9400
|
-
await
|
|
9401
|
-
await
|
|
9407
|
+
await fs7.promises.unlink(tarPath);
|
|
9408
|
+
await fs7.promises.rmdir(tmpDir);
|
|
9402
9409
|
console.log(chalk21.green(`\u2713 Extracted ${remoteFiles.length} files`));
|
|
9403
9410
|
})
|
|
9404
9411
|
);
|
|
@@ -9504,8 +9511,8 @@ import chalk25 from "chalk";
|
|
|
9504
9511
|
|
|
9505
9512
|
// src/lib/storage/clone-utils.ts
|
|
9506
9513
|
import chalk24 from "chalk";
|
|
9507
|
-
import
|
|
9508
|
-
import * as
|
|
9514
|
+
import path9 from "path";
|
|
9515
|
+
import * as fs8 from "fs";
|
|
9509
9516
|
import * as os6 from "os";
|
|
9510
9517
|
import * as tar4 from "tar";
|
|
9511
9518
|
async function cloneStorage(name, type2, destination, options = {}) {
|
|
@@ -9521,7 +9528,7 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
9521
9528
|
version: options.version
|
|
9522
9529
|
});
|
|
9523
9530
|
console.log(chalk24.dim(`Creating directory: ${destination}/`));
|
|
9524
|
-
await
|
|
9531
|
+
await fs8.promises.mkdir(destination, { recursive: true });
|
|
9525
9532
|
if ("empty" in downloadInfo) {
|
|
9526
9533
|
await writeStorageConfig(name, destination, type2);
|
|
9527
9534
|
console.log(chalk24.green(`\u2713 Cloned empty ${typeLabel}: ${name}`));
|
|
@@ -9540,15 +9547,15 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
9540
9547
|
console.log(chalk24.dim("Downloading from S3..."));
|
|
9541
9548
|
const s3Response = await fetch(downloadUrl);
|
|
9542
9549
|
if (!s3Response.ok) {
|
|
9543
|
-
await
|
|
9550
|
+
await fs8.promises.rm(destination, { recursive: true, force: true });
|
|
9544
9551
|
throw new Error(`S3 download failed: ${s3Response.status}`);
|
|
9545
9552
|
}
|
|
9546
9553
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
9547
9554
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
9548
9555
|
console.log(chalk24.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
9549
|
-
const tmpDir =
|
|
9550
|
-
const tarPath =
|
|
9551
|
-
await
|
|
9556
|
+
const tmpDir = fs8.mkdtempSync(path9.join(os6.tmpdir(), "vm0-clone-"));
|
|
9557
|
+
const tarPath = path9.join(tmpDir, "archive.tar.gz");
|
|
9558
|
+
await fs8.promises.writeFile(tarPath, tarBuffer);
|
|
9552
9559
|
const files = await listTarFiles(tarPath);
|
|
9553
9560
|
console.log(chalk24.dim("Extracting files..."));
|
|
9554
9561
|
await tar4.extract({
|
|
@@ -9556,8 +9563,8 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
9556
9563
|
cwd: destination,
|
|
9557
9564
|
gzip: true
|
|
9558
9565
|
});
|
|
9559
|
-
await
|
|
9560
|
-
await
|
|
9566
|
+
await fs8.promises.unlink(tarPath);
|
|
9567
|
+
await fs8.promises.rmdir(tmpDir);
|
|
9561
9568
|
console.log(chalk24.green(`\u2713 Extracted ${files.length} files`));
|
|
9562
9569
|
await writeStorageConfig(name, destination, type2);
|
|
9563
9570
|
console.log(chalk24.green(`\u2713 Initialized .vm0/storage.yaml`));
|
|
@@ -9591,14 +9598,14 @@ import { Command as Command26 } from "commander";
|
|
|
9591
9598
|
// src/commands/artifact/init.ts
|
|
9592
9599
|
import { Command as Command20 } from "commander";
|
|
9593
9600
|
import chalk26 from "chalk";
|
|
9594
|
-
import
|
|
9601
|
+
import path10 from "path";
|
|
9595
9602
|
var initCommand2 = new Command20().name("init").description("Initialize an artifact in the current directory").option(
|
|
9596
9603
|
"-n, --name <name>",
|
|
9597
9604
|
"Artifact name (required in non-interactive mode)"
|
|
9598
9605
|
).action(
|
|
9599
9606
|
withErrorHandler(async (options) => {
|
|
9600
9607
|
const cwd = process.cwd();
|
|
9601
|
-
const dirName =
|
|
9608
|
+
const dirName = path10.basename(cwd);
|
|
9602
9609
|
const existingConfig = await readStorageConfig(cwd);
|
|
9603
9610
|
if (existingConfig) {
|
|
9604
9611
|
if (existingConfig.type === "artifact") {
|
|
@@ -9620,7 +9627,7 @@ var initCommand2 = new Command20().name("init").description("Initialize an artif
|
|
|
9620
9627
|
);
|
|
9621
9628
|
}
|
|
9622
9629
|
console.log(
|
|
9623
|
-
chalk26.dim(`Config file: ${
|
|
9630
|
+
chalk26.dim(`Config file: ${path10.join(cwd, ".vm0", "storage.yaml")}`)
|
|
9624
9631
|
);
|
|
9625
9632
|
return;
|
|
9626
9633
|
}
|
|
@@ -9669,7 +9676,7 @@ var initCommand2 = new Command20().name("init").description("Initialize an artif
|
|
|
9669
9676
|
console.log(chalk26.green(`\u2713 Initialized artifact: ${artifactName}`));
|
|
9670
9677
|
console.log(
|
|
9671
9678
|
chalk26.dim(
|
|
9672
|
-
` Config saved to ${
|
|
9679
|
+
` Config saved to ${path10.join(cwd, ".vm0", "storage.yaml")}`
|
|
9673
9680
|
)
|
|
9674
9681
|
);
|
|
9675
9682
|
})
|
|
@@ -9723,8 +9730,8 @@ var pushCommand2 = new Command21().name("push").description("Push local files to
|
|
|
9723
9730
|
// src/commands/artifact/pull.ts
|
|
9724
9731
|
import { Command as Command22 } from "commander";
|
|
9725
9732
|
import chalk28 from "chalk";
|
|
9726
|
-
import
|
|
9727
|
-
import * as
|
|
9733
|
+
import path11 from "path";
|
|
9734
|
+
import * as fs9 from "fs";
|
|
9728
9735
|
import * as os7 from "os";
|
|
9729
9736
|
import * as tar5 from "tar";
|
|
9730
9737
|
var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact to local directory").argument("[versionId]", "Version ID to pull (default: latest)").action(
|
|
@@ -9772,9 +9779,9 @@ var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact
|
|
|
9772
9779
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
9773
9780
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
9774
9781
|
console.log(chalk28.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
9775
|
-
const tmpDir =
|
|
9776
|
-
const tarPath =
|
|
9777
|
-
await
|
|
9782
|
+
const tmpDir = fs9.mkdtempSync(path11.join(os7.tmpdir(), "vm0-"));
|
|
9783
|
+
const tarPath = path11.join(tmpDir, "artifact.tar.gz");
|
|
9784
|
+
await fs9.promises.writeFile(tarPath, tarBuffer);
|
|
9778
9785
|
console.log(chalk28.dim("Syncing local files..."));
|
|
9779
9786
|
const remoteFiles = await listTarFiles(tarPath);
|
|
9780
9787
|
const remoteFilesSet = new Set(
|
|
@@ -9792,8 +9799,8 @@ var pullCommand2 = new Command22().name("pull").description("Pull cloud artifact
|
|
|
9792
9799
|
cwd,
|
|
9793
9800
|
gzip: true
|
|
9794
9801
|
});
|
|
9795
|
-
await
|
|
9796
|
-
await
|
|
9802
|
+
await fs9.promises.unlink(tarPath);
|
|
9803
|
+
await fs9.promises.rmdir(tmpDir);
|
|
9797
9804
|
console.log(chalk28.green(`\u2713 Extracted ${remoteFiles.length} files`));
|
|
9798
9805
|
})
|
|
9799
9806
|
);
|
|
@@ -9914,16 +9921,16 @@ import { Command as Command27, Option as Option5 } from "commander";
|
|
|
9914
9921
|
import chalk33 from "chalk";
|
|
9915
9922
|
import { readFile as readFile7, mkdir as mkdir6 } from "fs/promises";
|
|
9916
9923
|
import { existsSync as existsSync10 } from "fs";
|
|
9917
|
-
import
|
|
9924
|
+
import path12 from "path";
|
|
9918
9925
|
import { parse as parseYaml4 } from "yaml";
|
|
9919
9926
|
|
|
9920
9927
|
// src/lib/domain/cook-state.ts
|
|
9921
9928
|
import { homedir as homedir3 } from "os";
|
|
9922
|
-
import { join as
|
|
9929
|
+
import { join as join9 } from "path";
|
|
9923
9930
|
import { readFile as readFile6, writeFile as writeFile5, mkdir as mkdir5 } from "fs/promises";
|
|
9924
9931
|
import { existsSync as existsSync8 } from "fs";
|
|
9925
|
-
var CONFIG_DIR2 =
|
|
9926
|
-
var COOK_STATE_FILE =
|
|
9932
|
+
var CONFIG_DIR2 = join9(homedir3(), ".vm0");
|
|
9933
|
+
var COOK_STATE_FILE = join9(CONFIG_DIR2, "cook.json");
|
|
9927
9934
|
var STALE_THRESHOLD_MS = 48 * 60 * 60 * 1e3;
|
|
9928
9935
|
async function loadCookStateFile() {
|
|
9929
9936
|
if (!existsSync8(COOK_STATE_FILE)) {
|
|
@@ -10146,7 +10153,7 @@ async function processVolumes(config, cwd) {
|
|
|
10146
10153
|
console.log();
|
|
10147
10154
|
console.log(chalk33.bold("Processing volumes:"));
|
|
10148
10155
|
for (const volumeConfig of Object.values(config.volumes)) {
|
|
10149
|
-
const volumeDir =
|
|
10156
|
+
const volumeDir = path12.join(cwd, volumeConfig.name);
|
|
10150
10157
|
if (!existsSync10(volumeDir)) {
|
|
10151
10158
|
console.error(chalk33.red(`\u2717 Directory not found: ${volumeConfig.name}`));
|
|
10152
10159
|
console.error(chalk33.dim(" Create the directory and add files first"));
|
|
@@ -10180,7 +10187,7 @@ async function processVolumes(config, cwd) {
|
|
|
10180
10187
|
async function processArtifact(cwd) {
|
|
10181
10188
|
console.log();
|
|
10182
10189
|
console.log(chalk33.bold("Processing artifact:"));
|
|
10183
|
-
const artifactDir =
|
|
10190
|
+
const artifactDir = path12.join(cwd, ARTIFACT_DIR);
|
|
10184
10191
|
try {
|
|
10185
10192
|
if (!existsSync10(artifactDir)) {
|
|
10186
10193
|
printCommand(`mkdir ${ARTIFACT_DIR}`);
|
|
@@ -10264,7 +10271,7 @@ var cookAction = new Command27().name("cook").description("Quick start: prepare,
|
|
|
10264
10271
|
).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(
|
|
10265
10272
|
async (prompt, options) => {
|
|
10266
10273
|
if (options.autoUpdate !== false) {
|
|
10267
|
-
const shouldExit = await checkAndUpgrade("9.38.
|
|
10274
|
+
const shouldExit = await checkAndUpgrade("9.38.3", prompt);
|
|
10268
10275
|
if (shouldExit) {
|
|
10269
10276
|
process.exit(0);
|
|
10270
10277
|
}
|
|
@@ -10354,7 +10361,7 @@ var logsCommand = new Command28().name("logs").description("View logs from the l
|
|
|
10354
10361
|
// src/commands/cook/continue.ts
|
|
10355
10362
|
import { Command as Command29, Option as Option6 } from "commander";
|
|
10356
10363
|
import chalk35 from "chalk";
|
|
10357
|
-
import
|
|
10364
|
+
import path13 from "path";
|
|
10358
10365
|
var continueCommand2 = new Command29().name("continue").description(
|
|
10359
10366
|
"Continue from the last session (latest conversation and artifact)"
|
|
10360
10367
|
).argument("<prompt>", "Prompt for the continued agent").option(
|
|
@@ -10370,7 +10377,7 @@ var continueCommand2 = new Command29().name("continue").description(
|
|
|
10370
10377
|
process.exit(1);
|
|
10371
10378
|
}
|
|
10372
10379
|
const cwd = process.cwd();
|
|
10373
|
-
const artifactDir =
|
|
10380
|
+
const artifactDir = path13.join(cwd, ARTIFACT_DIR);
|
|
10374
10381
|
const envFileArg = options.envFile ? ` --env-file ${options.envFile}` : "";
|
|
10375
10382
|
printCommand(
|
|
10376
10383
|
`vm0 run continue${envFileArg} ${state.lastSessionId} "${prompt}"`
|
|
@@ -10419,7 +10426,7 @@ var continueCommand2 = new Command29().name("continue").description(
|
|
|
10419
10426
|
// src/commands/cook/resume.ts
|
|
10420
10427
|
import { Command as Command30, Option as Option7 } from "commander";
|
|
10421
10428
|
import chalk36 from "chalk";
|
|
10422
|
-
import
|
|
10429
|
+
import path14 from "path";
|
|
10423
10430
|
var resumeCommand2 = new Command30().name("resume").description(
|
|
10424
10431
|
"Resume from the last checkpoint (snapshotted conversation and artifact)"
|
|
10425
10432
|
).argument("<prompt>", "Prompt for the resumed agent").option(
|
|
@@ -10435,7 +10442,7 @@ var resumeCommand2 = new Command30().name("resume").description(
|
|
|
10435
10442
|
process.exit(1);
|
|
10436
10443
|
}
|
|
10437
10444
|
const cwd = process.cwd();
|
|
10438
|
-
const artifactDir =
|
|
10445
|
+
const artifactDir = path14.join(cwd, ARTIFACT_DIR);
|
|
10439
10446
|
const envFileArg = options.envFile ? ` --env-file ${options.envFile}` : "";
|
|
10440
10447
|
printCommand(
|
|
10441
10448
|
`vm0 run resume${envFileArg} ${state.lastCheckpointId} "${prompt}"`
|
|
@@ -10948,7 +10955,7 @@ import { Command as Command35 } from "commander";
|
|
|
10948
10955
|
import chalk40 from "chalk";
|
|
10949
10956
|
import { mkdtempSync as mkdtempSync5 } from "fs";
|
|
10950
10957
|
import { mkdir as mkdir7, writeFile as writeFile6, readdir, copyFile, rm as rm4 } from "fs/promises";
|
|
10951
|
-
import { join as
|
|
10958
|
+
import { join as join10, dirname as dirname3 } from "path";
|
|
10952
10959
|
import { tmpdir as tmpdir7 } from "os";
|
|
10953
10960
|
import * as tar6 from "tar";
|
|
10954
10961
|
import { stringify as yamlStringify } from "yaml";
|
|
@@ -10984,8 +10991,8 @@ async function downloadInstructions(agentName, instructionsPath, destination) {
|
|
|
10984
10991
|
throw new Error(`Failed to download instructions: ${response.status}`);
|
|
10985
10992
|
}
|
|
10986
10993
|
const buffer = Buffer.from(await response.arrayBuffer());
|
|
10987
|
-
const tmpDir = mkdtempSync5(
|
|
10988
|
-
const tarPath =
|
|
10994
|
+
const tmpDir = mkdtempSync5(join10(tmpdir7(), "vm0-clone-"));
|
|
10995
|
+
const tarPath = join10(tmpDir, "archive.tar.gz");
|
|
10989
10996
|
await writeFile6(tarPath, buffer);
|
|
10990
10997
|
await tar6.extract({ file: tarPath, cwd: tmpDir, gzip: true });
|
|
10991
10998
|
const files = await readdir(tmpDir);
|
|
@@ -10995,9 +11002,9 @@ async function downloadInstructions(agentName, instructionsPath, destination) {
|
|
|
10995
11002
|
await rm4(tmpDir, { recursive: true, force: true });
|
|
10996
11003
|
return false;
|
|
10997
11004
|
}
|
|
10998
|
-
const destPath =
|
|
11005
|
+
const destPath = join10(destination, instructionsPath);
|
|
10999
11006
|
await mkdir7(dirname3(destPath), { recursive: true });
|
|
11000
|
-
await copyFile(
|
|
11007
|
+
await copyFile(join10(tmpDir, mdFile), destPath);
|
|
11001
11008
|
await rm4(tmpDir, { recursive: true, force: true });
|
|
11002
11009
|
return true;
|
|
11003
11010
|
}
|
|
@@ -11023,7 +11030,7 @@ var cloneCommand3 = new Command35().name("clone").description("Clone agent compo
|
|
|
11023
11030
|
const cleanedContent = cleanComposeContent(content);
|
|
11024
11031
|
const yamlContent = yamlStringify(cleanedContent);
|
|
11025
11032
|
await mkdir7(targetDir, { recursive: true });
|
|
11026
|
-
const yamlPath =
|
|
11033
|
+
const yamlPath = join10(targetDir, "vm0.yaml");
|
|
11027
11034
|
await writeFile6(yamlPath, yamlContent, "utf8");
|
|
11028
11035
|
console.log(chalk40.green("\u2713 Created vm0.yaml"));
|
|
11029
11036
|
const agentKey = Object.keys(content.agents)[0];
|
|
@@ -11149,8 +11156,8 @@ import { Command as Command38 } from "commander";
|
|
|
11149
11156
|
import chalk43 from "chalk";
|
|
11150
11157
|
|
|
11151
11158
|
// src/lib/domain/source-derivation.ts
|
|
11152
|
-
import * as
|
|
11153
|
-
import * as
|
|
11159
|
+
import * as fs10 from "fs/promises";
|
|
11160
|
+
import * as path15 from "path";
|
|
11154
11161
|
import * as os8 from "os";
|
|
11155
11162
|
async function fetchSkillFrontmatter(skillUrl, tempDir) {
|
|
11156
11163
|
try {
|
|
@@ -11190,8 +11197,8 @@ async function deriveAgentVariableSources(agent, options) {
|
|
|
11190
11197
|
credentials: Array.from(credentialSources.values())
|
|
11191
11198
|
};
|
|
11192
11199
|
}
|
|
11193
|
-
const tempDir = await
|
|
11194
|
-
|
|
11200
|
+
const tempDir = await fs10.mkdtemp(
|
|
11201
|
+
path15.join(os8.tmpdir(), "vm0-source-derivation-")
|
|
11195
11202
|
);
|
|
11196
11203
|
try {
|
|
11197
11204
|
const skillResults = await Promise.all(
|
|
@@ -11224,7 +11231,7 @@ async function deriveAgentVariableSources(agent, options) {
|
|
|
11224
11231
|
}
|
|
11225
11232
|
}
|
|
11226
11233
|
} finally {
|
|
11227
|
-
await
|
|
11234
|
+
await fs10.rm(tempDir, { recursive: true, force: true });
|
|
11228
11235
|
}
|
|
11229
11236
|
return {
|
|
11230
11237
|
secrets: Array.from(secretSources.values()),
|
|
@@ -11701,7 +11708,7 @@ var agentCommand = new Command44().name("agent").description("Manage agent compo
|
|
|
11701
11708
|
// src/commands/init/index.ts
|
|
11702
11709
|
import { Command as Command45 } from "commander";
|
|
11703
11710
|
import chalk49 from "chalk";
|
|
11704
|
-
import
|
|
11711
|
+
import path16 from "path";
|
|
11705
11712
|
import { existsSync as existsSync11 } from "fs";
|
|
11706
11713
|
import { writeFile as writeFile7 } from "fs/promises";
|
|
11707
11714
|
var VM0_YAML_FILE = "vm0.yaml";
|
|
@@ -11758,7 +11765,7 @@ var initCommand3 = new Command45().name("init").description("Initialize a new VM
|
|
|
11758
11765
|
console.error(chalk49.dim(" Usage: vm0 init --name <agent-name>"));
|
|
11759
11766
|
process.exit(1);
|
|
11760
11767
|
} else {
|
|
11761
|
-
const dirName =
|
|
11768
|
+
const dirName = path16.basename(process.cwd());
|
|
11762
11769
|
const defaultName = validateAgentName(dirName) ? dirName : void 0;
|
|
11763
11770
|
const name = await promptText(
|
|
11764
11771
|
"Enter agent name",
|
|
@@ -13776,7 +13783,7 @@ import { spawn as spawn3 } from "child_process";
|
|
|
13776
13783
|
import { access as access2, constants } from "fs/promises";
|
|
13777
13784
|
import { createServer } from "net";
|
|
13778
13785
|
import { homedir as homedir4 } from "os";
|
|
13779
|
-
import { join as
|
|
13786
|
+
import { join as join12 } from "path";
|
|
13780
13787
|
import chalk67 from "chalk";
|
|
13781
13788
|
|
|
13782
13789
|
// src/commands/connector/lib/computer/ngrok.ts
|
|
@@ -13864,7 +13871,7 @@ async function startComputerServices(credentials) {
|
|
|
13864
13871
|
}
|
|
13865
13872
|
const webdavPort = await getRandomPort();
|
|
13866
13873
|
const cdpPort = await getRandomPort();
|
|
13867
|
-
const downloadsPath =
|
|
13874
|
+
const downloadsPath = join12(homedir4(), "Downloads");
|
|
13868
13875
|
const wsgidav = spawn3(
|
|
13869
13876
|
wsgidavBinary,
|
|
13870
13877
|
[
|
|
@@ -15192,7 +15199,7 @@ var preferenceCommand = new Command77().name("preference").description("View or
|
|
|
15192
15199
|
|
|
15193
15200
|
// src/index.ts
|
|
15194
15201
|
var program = new Command78();
|
|
15195
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.38.
|
|
15202
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.38.3");
|
|
15196
15203
|
program.addCommand(authCommand);
|
|
15197
15204
|
program.addCommand(infoCommand);
|
|
15198
15205
|
program.addCommand(composeCommand);
|