@vm0/cli 9.119.2 → 9.119.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/{chunk-PS4P6JB6.js → chunk-6UFVJSUZ.js} +352 -413
- package/{chunk-PS4P6JB6.js.map → chunk-6UFVJSUZ.js.map} +1 -1
- package/index.js +153 -292
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/zero.js +27 -430
- package/zero.js.map +1 -1
package/index.js
CHANGED
|
@@ -35,7 +35,6 @@ import {
|
|
|
35
35
|
getNetworkLogs,
|
|
36
36
|
getRunQueue,
|
|
37
37
|
getSession,
|
|
38
|
-
getSkillStorageName,
|
|
39
38
|
getStorageDownload,
|
|
40
39
|
getSystemLog,
|
|
41
40
|
getToken,
|
|
@@ -50,11 +49,9 @@ import {
|
|
|
50
49
|
loadValues,
|
|
51
50
|
paginate,
|
|
52
51
|
parseArtifact,
|
|
53
|
-
parseGitHubTreeUrl,
|
|
54
52
|
parseGitHubUrl,
|
|
55
53
|
parseIdentifier,
|
|
56
54
|
parsePermissionPolicies,
|
|
57
|
-
parseSkillFrontmatter,
|
|
58
55
|
parseTime,
|
|
59
56
|
pollEvents,
|
|
60
57
|
prepareStorage,
|
|
@@ -62,15 +59,13 @@ import {
|
|
|
62
59
|
promptText,
|
|
63
60
|
renderRunCreated,
|
|
64
61
|
require_dist,
|
|
65
|
-
resolveSkillRef,
|
|
66
|
-
resolveSkills,
|
|
67
62
|
saveConfig,
|
|
68
63
|
searchLogs,
|
|
69
64
|
showNextSteps,
|
|
70
65
|
source_default,
|
|
71
66
|
volumeConfigSchema,
|
|
72
67
|
withErrorHandler
|
|
73
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-6UFVJSUZ.js";
|
|
74
69
|
import {
|
|
75
70
|
__toESM,
|
|
76
71
|
init_esm_shims
|
|
@@ -403,7 +398,7 @@ function getConfigPath() {
|
|
|
403
398
|
return join(homedir(), ".vm0", "config.json");
|
|
404
399
|
}
|
|
405
400
|
var infoCommand = new Command().name("info").description("Display environment and debug information").action(async () => {
|
|
406
|
-
console.log(source_default.bold(`VM0 CLI v${"9.119.
|
|
401
|
+
console.log(source_default.bold(`VM0 CLI v${"9.119.3"}`));
|
|
407
402
|
console.log();
|
|
408
403
|
const config = await loadConfig();
|
|
409
404
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -435,9 +430,9 @@ var infoCommand = new Command().name("info").description("Display environment an
|
|
|
435
430
|
// src/commands/compose/index.ts
|
|
436
431
|
init_esm_shims();
|
|
437
432
|
var import_yaml = __toESM(require_dist(), 1);
|
|
438
|
-
import { readFile as
|
|
433
|
+
import { readFile as readFile2, rm as rm3 } from "fs/promises";
|
|
439
434
|
import { existsSync as existsSync4 } from "fs";
|
|
440
|
-
import { dirname
|
|
435
|
+
import { dirname, join as join6 } from "path";
|
|
441
436
|
|
|
442
437
|
// src/lib/domain/yaml-validator.ts
|
|
443
438
|
init_esm_shims();
|
|
@@ -445,29 +440,9 @@ var cliAgentNameSchema = external_exports.string().min(3, "Agent name must be at
|
|
|
445
440
|
/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?$/,
|
|
446
441
|
"Agent name must start and end with letter or number, and contain only letters, numbers, and hyphens"
|
|
447
442
|
);
|
|
448
|
-
var cliAgentDefinitionSchema = agentDefinitionSchema.superRefine(
|
|
449
|
-
(agent, ctx) => {
|
|
450
|
-
if (agent.skills) {
|
|
451
|
-
for (let i = 0; i < agent.skills.length; i++) {
|
|
452
|
-
const skillRef = agent.skills[i];
|
|
453
|
-
if (skillRef) {
|
|
454
|
-
try {
|
|
455
|
-
resolveSkillRef(skillRef);
|
|
456
|
-
} catch (error) {
|
|
457
|
-
ctx.addIssue({
|
|
458
|
-
code: external_exports.ZodIssueCode.custom,
|
|
459
|
-
message: error instanceof Error ? error.message : `Invalid skill reference: ${skillRef}`,
|
|
460
|
-
path: ["skills", i]
|
|
461
|
-
});
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
);
|
|
468
443
|
var cliComposeSchema = external_exports.object({
|
|
469
444
|
version: external_exports.string().min(1, "Missing config.version"),
|
|
470
|
-
agents: external_exports.record(cliAgentNameSchema,
|
|
445
|
+
agents: external_exports.record(cliAgentNameSchema, agentDefinitionSchema),
|
|
471
446
|
volumes: external_exports.record(external_exports.string(), volumeConfigSchema).optional()
|
|
472
447
|
}).superRefine((config, ctx) => {
|
|
473
448
|
const agentKeys = Object.keys(config.agents);
|
|
@@ -520,29 +495,29 @@ var cliComposeSchema = external_exports.object({
|
|
|
520
495
|
}
|
|
521
496
|
}
|
|
522
497
|
});
|
|
523
|
-
function formatInvalidTypeIssue(
|
|
498
|
+
function formatInvalidTypeIssue(path13, issue) {
|
|
524
499
|
const received = issue.received;
|
|
525
500
|
const isMissing = received === "undefined" || issue.message.includes("received undefined") || issue.message === "Required";
|
|
526
|
-
if (
|
|
501
|
+
if (path13 === "version" && isMissing) {
|
|
527
502
|
return "Missing config.version";
|
|
528
503
|
}
|
|
529
|
-
if (
|
|
504
|
+
if (path13 === "agents" && isMissing) {
|
|
530
505
|
return "Missing agents object in config";
|
|
531
506
|
}
|
|
532
|
-
if (
|
|
533
|
-
const volumeKey =
|
|
507
|
+
if (path13.startsWith("volumes.") && path13.endsWith(".name")) {
|
|
508
|
+
const volumeKey = path13.split(".")[1];
|
|
534
509
|
return `Volume "${volumeKey}" must have a 'name' field (string)`;
|
|
535
510
|
}
|
|
536
|
-
if (
|
|
537
|
-
const volumeKey =
|
|
511
|
+
if (path13.startsWith("volumes.") && path13.endsWith(".version")) {
|
|
512
|
+
const volumeKey = path13.split(".")[1];
|
|
538
513
|
return `Volume "${volumeKey}" must have a 'version' field (string)`;
|
|
539
514
|
}
|
|
540
515
|
if (issue.expected === "array") {
|
|
541
|
-
const fieldName =
|
|
516
|
+
const fieldName = path13.replace(/^agents\.[^.]+\./, "agent.");
|
|
542
517
|
return `${fieldName} must be an array`;
|
|
543
518
|
}
|
|
544
519
|
if (issue.expected === "string" && received === "number") {
|
|
545
|
-
const fieldName =
|
|
520
|
+
const fieldName = path13.replace(/^agents\.[^.]+\./, "agent.");
|
|
546
521
|
const match = fieldName.match(/^(agent\.[^.]+)\.\d+$/);
|
|
547
522
|
if (match) {
|
|
548
523
|
return `Each entry in ${match[1]?.replace("agent.", "")} must be a string`;
|
|
@@ -553,24 +528,24 @@ function formatInvalidTypeIssue(path14, issue) {
|
|
|
553
528
|
function formatZodError(error) {
|
|
554
529
|
const issue = error.issues[0];
|
|
555
530
|
if (!issue) return "Validation failed";
|
|
556
|
-
const
|
|
531
|
+
const path13 = issue.path.join(".");
|
|
557
532
|
const message = issue.message;
|
|
558
|
-
if (!
|
|
533
|
+
if (!path13) return message;
|
|
559
534
|
if (issue.code === "invalid_type") {
|
|
560
|
-
const formatted = formatInvalidTypeIssue(
|
|
535
|
+
const formatted = formatInvalidTypeIssue(path13, issue);
|
|
561
536
|
if (formatted) return formatted;
|
|
562
537
|
}
|
|
563
|
-
if (issue.code === "invalid_key" &&
|
|
538
|
+
if (issue.code === "invalid_key" && path13.startsWith("agents.")) {
|
|
564
539
|
return "Invalid agent name format. Must be 3-64 characters, letters, numbers, and hyphens only. Must start and end with letter or number.";
|
|
565
540
|
}
|
|
566
|
-
if (message === "Invalid key in record" &&
|
|
541
|
+
if (message === "Invalid key in record" && path13.startsWith("agents.")) {
|
|
567
542
|
return "Invalid agent name format. Must be 3-64 characters, letters, numbers, and hyphens only. Must start and end with letter or number.";
|
|
568
543
|
}
|
|
569
544
|
if (issue.code === "custom") {
|
|
570
545
|
return message;
|
|
571
546
|
}
|
|
572
|
-
if (
|
|
573
|
-
const cleanPath =
|
|
547
|
+
if (path13.startsWith("agents.")) {
|
|
548
|
+
const cleanPath = path13.replace(/^agents\.[^.]+\./, "agent.");
|
|
574
549
|
if (message.startsWith("Invalid input:")) {
|
|
575
550
|
const match = message.match(/expected (\w+), received (\w+)/);
|
|
576
551
|
if (match && match[1] === "string" && match[2] === "number") {
|
|
@@ -582,7 +557,7 @@ function formatZodError(error) {
|
|
|
582
557
|
}
|
|
583
558
|
return `${cleanPath}: ${message}`;
|
|
584
559
|
}
|
|
585
|
-
return `${
|
|
560
|
+
return `${path13}: ${message}`;
|
|
586
561
|
}
|
|
587
562
|
function validateAgentName(name) {
|
|
588
563
|
return cliAgentNameSchema.safeParse(name).success;
|
|
@@ -701,8 +676,6 @@ function validateAgentCompose(config) {
|
|
|
701
676
|
|
|
702
677
|
// src/lib/domain/github-skills.ts
|
|
703
678
|
init_esm_shims();
|
|
704
|
-
import * as fs2 from "fs/promises";
|
|
705
|
-
import * as path2 from "path";
|
|
706
679
|
|
|
707
680
|
// src/lib/external/git-client.ts
|
|
708
681
|
init_esm_shims();
|
|
@@ -723,45 +696,6 @@ function sanitizeGitArg(value, label) {
|
|
|
723
696
|
}
|
|
724
697
|
return value;
|
|
725
698
|
}
|
|
726
|
-
async function downloadGitHubSkill(parsed, destDir) {
|
|
727
|
-
const owner = sanitizeGitArg(parsed.owner, "repository owner");
|
|
728
|
-
const repo = sanitizeGitArg(parsed.repo, "repository name");
|
|
729
|
-
const branch = sanitizeGitArg(parsed.branch, "branch name");
|
|
730
|
-
const repoUrl = `https://github.com/${owner}/${repo}.git`;
|
|
731
|
-
const skillDir = path.join(destDir, parsed.skillName);
|
|
732
|
-
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "vm0-skill-"));
|
|
733
|
-
try {
|
|
734
|
-
await execFileAsync("git", ["init"], { cwd: tempDir });
|
|
735
|
-
await execFileAsync("git", ["remote", "add", "origin", repoUrl], {
|
|
736
|
-
cwd: tempDir
|
|
737
|
-
});
|
|
738
|
-
await execFileAsync("git", ["config", "core.sparseCheckout", "true"], {
|
|
739
|
-
cwd: tempDir
|
|
740
|
-
});
|
|
741
|
-
const sparsePattern = parsed.path || "/*";
|
|
742
|
-
const sparseFile = path.join(tempDir, ".git", "info", "sparse-checkout");
|
|
743
|
-
await fs.writeFile(sparseFile, sparsePattern + "\n");
|
|
744
|
-
await execFileAsync("git", ["fetch", "--depth", "1", "origin", branch], {
|
|
745
|
-
cwd: tempDir
|
|
746
|
-
});
|
|
747
|
-
await execFileAsync("git", ["checkout", branch], { cwd: tempDir });
|
|
748
|
-
await fs.mkdir(path.dirname(skillDir), { recursive: true });
|
|
749
|
-
if (parsed.path) {
|
|
750
|
-
const fetchedPath = path.join(tempDir, parsed.path);
|
|
751
|
-
await fs.rename(fetchedPath, skillDir);
|
|
752
|
-
} else {
|
|
753
|
-
await fs.mkdir(skillDir, { recursive: true });
|
|
754
|
-
const entries = await fs.readdir(tempDir);
|
|
755
|
-
for (const entry of entries) {
|
|
756
|
-
if (entry === ".git") continue;
|
|
757
|
-
await fs.rename(path.join(tempDir, entry), path.join(skillDir, entry));
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
return skillDir;
|
|
761
|
-
} finally {
|
|
762
|
-
await fs.rm(tempDir, { recursive: true, force: true });
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
699
|
async function getDefaultBranch(owner, repo) {
|
|
766
700
|
const safeOwner = sanitizeGitArg(owner, "repository owner");
|
|
767
701
|
const safeRepo = sanitizeGitArg(repo, "repository name");
|
|
@@ -852,46 +786,17 @@ async function downloadGitHubDirectory(url) {
|
|
|
852
786
|
}
|
|
853
787
|
}
|
|
854
788
|
|
|
855
|
-
// src/lib/domain/github-skills.ts
|
|
856
|
-
function parseGitHubTreeUrl2(url) {
|
|
857
|
-
const parsed = parseGitHubTreeUrl(url);
|
|
858
|
-
if (!parsed) {
|
|
859
|
-
throw new Error(
|
|
860
|
-
`Invalid GitHub tree URL: ${url}. Expected format: https://github.com/{owner}/{repo}/tree/{branch}/{path}`
|
|
861
|
-
);
|
|
862
|
-
}
|
|
863
|
-
return parsed;
|
|
864
|
-
}
|
|
865
|
-
function getSkillStorageName2(parsed) {
|
|
866
|
-
return getSkillStorageName(parsed.fullPath);
|
|
867
|
-
}
|
|
868
|
-
async function validateSkillDirectory(skillDir) {
|
|
869
|
-
const skillMdPath = path2.join(skillDir, "SKILL.md");
|
|
870
|
-
try {
|
|
871
|
-
await fs2.access(skillMdPath);
|
|
872
|
-
} catch {
|
|
873
|
-
throw new Error(
|
|
874
|
-
`Skill directory missing required SKILL.md file: ${skillDir}`
|
|
875
|
-
);
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
async function readSkillFrontmatter(skillDir) {
|
|
879
|
-
const skillMdPath = path2.join(skillDir, "SKILL.md");
|
|
880
|
-
const content = await fs2.readFile(skillMdPath, "utf8");
|
|
881
|
-
return parseSkillFrontmatter(content);
|
|
882
|
-
}
|
|
883
|
-
|
|
884
789
|
// src/lib/storage/system-storage.ts
|
|
885
790
|
init_esm_shims();
|
|
886
|
-
import * as
|
|
887
|
-
import * as
|
|
791
|
+
import * as fs5 from "fs/promises";
|
|
792
|
+
import * as path4 from "path";
|
|
888
793
|
import * as os4 from "os";
|
|
889
794
|
|
|
890
795
|
// src/lib/storage/direct-upload.ts
|
|
891
796
|
init_esm_shims();
|
|
892
797
|
import { createHash } from "crypto";
|
|
893
|
-
import * as
|
|
894
|
-
import * as
|
|
798
|
+
import * as fs4 from "fs";
|
|
799
|
+
import * as path3 from "path";
|
|
895
800
|
import * as os3 from "os";
|
|
896
801
|
|
|
897
802
|
// ../../node_modules/.pnpm/tar@7.5.13/node_modules/tar/dist/esm/index.min.js
|
|
@@ -3005,7 +2910,7 @@ var Vn = 512 * 1024;
|
|
|
3005
2910
|
var $n = pr | ur | dr | mr;
|
|
3006
2911
|
var lr = !fr && typeof ar == "number" ? ar | ur | dr | mr : null;
|
|
3007
2912
|
var cs = lr !== null ? () => lr : Kn ? (s3) => s3 < Vn ? $n : "w" : () => "w";
|
|
3008
|
-
var
|
|
2913
|
+
var fs2 = (s3, t, e) => {
|
|
3009
2914
|
try {
|
|
3010
2915
|
return mi.lchownSync(s3, t, e);
|
|
3011
2916
|
} catch (i) {
|
|
@@ -3045,7 +2950,7 @@ var ds = (s3, t, e, i) => {
|
|
|
3045
2950
|
});
|
|
3046
2951
|
};
|
|
3047
2952
|
var qn = (s3, t, e, i) => {
|
|
3048
|
-
t.isDirectory() && us(Ee.resolve(s3, t.name), e, i),
|
|
2953
|
+
t.isDirectory() && us(Ee.resolve(s3, t.name), e, i), fs2(Ee.resolve(s3, t.name), e, i);
|
|
3049
2954
|
};
|
|
3050
2955
|
var us = (s3, t, e) => {
|
|
3051
2956
|
let i;
|
|
@@ -3054,11 +2959,11 @@ var us = (s3, t, e) => {
|
|
|
3054
2959
|
} catch (r) {
|
|
3055
2960
|
let n = r;
|
|
3056
2961
|
if (n?.code === "ENOENT") return;
|
|
3057
|
-
if (n?.code === "ENOTDIR" || n?.code === "ENOTSUP") return
|
|
2962
|
+
if (n?.code === "ENOTDIR" || n?.code === "ENOTSUP") return fs2(s3, t, e);
|
|
3058
2963
|
throw n;
|
|
3059
2964
|
}
|
|
3060
2965
|
for (let r of i) qn(s3, r, t, e);
|
|
3061
|
-
return
|
|
2966
|
+
return fs2(s3, t, e);
|
|
3062
2967
|
};
|
|
3063
2968
|
var we = class extends Error {
|
|
3064
2969
|
path;
|
|
@@ -3796,17 +3701,17 @@ var So = (s3) => {
|
|
|
3796
3701
|
|
|
3797
3702
|
// src/lib/utils/file-utils.ts
|
|
3798
3703
|
init_esm_shims();
|
|
3799
|
-
import * as
|
|
3800
|
-
import * as
|
|
3704
|
+
import * as fs3 from "fs";
|
|
3705
|
+
import * as path2 from "path";
|
|
3801
3706
|
function checkDirectoryStatus(dirPath) {
|
|
3802
|
-
if (!
|
|
3707
|
+
if (!fs3.existsSync(dirPath)) {
|
|
3803
3708
|
return { exists: false, empty: true };
|
|
3804
3709
|
}
|
|
3805
|
-
const stat =
|
|
3710
|
+
const stat = fs3.statSync(dirPath);
|
|
3806
3711
|
if (!stat.isDirectory()) {
|
|
3807
3712
|
return { exists: true, empty: false };
|
|
3808
3713
|
}
|
|
3809
|
-
const entries =
|
|
3714
|
+
const entries = fs3.readdirSync(dirPath);
|
|
3810
3715
|
return { exists: true, empty: entries.length === 0 };
|
|
3811
3716
|
}
|
|
3812
3717
|
function formatBytes(bytes) {
|
|
@@ -3853,14 +3758,14 @@ function listTarFiles(tarPath) {
|
|
|
3853
3758
|
async function listLocalFiles(dir, excludeDirs = [".vm0"]) {
|
|
3854
3759
|
const files = [];
|
|
3855
3760
|
async function walkDir(currentDir, relativePath = "") {
|
|
3856
|
-
const entries = await
|
|
3761
|
+
const entries = await fs3.promises.readdir(currentDir, {
|
|
3857
3762
|
withFileTypes: true
|
|
3858
3763
|
});
|
|
3859
3764
|
for (const entry of entries) {
|
|
3860
|
-
const entryRelativePath = relativePath ?
|
|
3765
|
+
const entryRelativePath = relativePath ? path2.join(relativePath, entry.name) : entry.name;
|
|
3861
3766
|
if (entry.isDirectory()) {
|
|
3862
3767
|
if (!excludeDirs.includes(entry.name)) {
|
|
3863
|
-
await walkDir(
|
|
3768
|
+
await walkDir(path2.join(currentDir, entry.name), entryRelativePath);
|
|
3864
3769
|
}
|
|
3865
3770
|
} else {
|
|
3866
3771
|
files.push(entryRelativePath);
|
|
@@ -3876,8 +3781,8 @@ async function removeExtraFiles(dir, remoteFiles, excludeDirs = [".vm0"]) {
|
|
|
3876
3781
|
for (const localFile of localFiles) {
|
|
3877
3782
|
const normalizedPath = localFile.replace(/\\/g, "/");
|
|
3878
3783
|
if (!remoteFiles.has(normalizedPath)) {
|
|
3879
|
-
const fullPath =
|
|
3880
|
-
await
|
|
3784
|
+
const fullPath = path2.join(dir, localFile);
|
|
3785
|
+
await fs3.promises.unlink(fullPath);
|
|
3881
3786
|
removedCount++;
|
|
3882
3787
|
}
|
|
3883
3788
|
}
|
|
@@ -3885,17 +3790,17 @@ async function removeExtraFiles(dir, remoteFiles, excludeDirs = [".vm0"]) {
|
|
|
3885
3790
|
return removedCount;
|
|
3886
3791
|
}
|
|
3887
3792
|
async function removeEmptyDirs(dir, excludeDirs = [".vm0"]) {
|
|
3888
|
-
const entries = await
|
|
3793
|
+
const entries = await fs3.promises.readdir(dir, { withFileTypes: true });
|
|
3889
3794
|
let isEmpty = true;
|
|
3890
3795
|
for (const entry of entries) {
|
|
3891
|
-
const fullPath =
|
|
3796
|
+
const fullPath = path2.join(dir, entry.name);
|
|
3892
3797
|
if (entry.isDirectory()) {
|
|
3893
3798
|
if (excludeDirs.includes(entry.name)) {
|
|
3894
3799
|
isEmpty = false;
|
|
3895
3800
|
} else {
|
|
3896
3801
|
const subDirEmpty = await removeEmptyDirs(fullPath, excludeDirs);
|
|
3897
3802
|
if (subDirEmpty) {
|
|
3898
|
-
await
|
|
3803
|
+
await fs3.promises.rmdir(fullPath);
|
|
3899
3804
|
} else {
|
|
3900
3805
|
isEmpty = false;
|
|
3901
3806
|
}
|
|
@@ -3911,7 +3816,7 @@ async function removeEmptyDirs(dir, excludeDirs = [".vm0"]) {
|
|
|
3911
3816
|
async function hashFileStream(filePath) {
|
|
3912
3817
|
return new Promise((resolve, reject) => {
|
|
3913
3818
|
const hash = createHash("sha256");
|
|
3914
|
-
const stream =
|
|
3819
|
+
const stream = fs4.createReadStream(filePath);
|
|
3915
3820
|
stream.on("data", (chunk) => {
|
|
3916
3821
|
return hash.update(chunk);
|
|
3917
3822
|
});
|
|
@@ -3923,10 +3828,10 @@ async function hashFileStream(filePath) {
|
|
|
3923
3828
|
}
|
|
3924
3829
|
async function getAllFiles(dirPath, baseDir = dirPath) {
|
|
3925
3830
|
const files = [];
|
|
3926
|
-
const entries = await
|
|
3831
|
+
const entries = await fs4.promises.readdir(dirPath, { withFileTypes: true });
|
|
3927
3832
|
for (const entry of entries) {
|
|
3928
|
-
const fullPath =
|
|
3929
|
-
const relativePath =
|
|
3833
|
+
const fullPath = path3.join(dirPath, entry.name);
|
|
3834
|
+
const relativePath = path3.relative(baseDir, fullPath);
|
|
3930
3835
|
if (relativePath.startsWith(".vm0")) {
|
|
3931
3836
|
continue;
|
|
3932
3837
|
}
|
|
@@ -3943,10 +3848,10 @@ async function collectFileMetadata(cwd, files, onProgress) {
|
|
|
3943
3848
|
const fileEntries = [];
|
|
3944
3849
|
for (let i = 0; i < files.length; i++) {
|
|
3945
3850
|
const file = files[i];
|
|
3946
|
-
const relativePath =
|
|
3851
|
+
const relativePath = path3.relative(cwd, file);
|
|
3947
3852
|
const [hash, stats] = await Promise.all([
|
|
3948
3853
|
hashFileStream(file),
|
|
3949
|
-
|
|
3854
|
+
fs4.promises.stat(file)
|
|
3950
3855
|
]);
|
|
3951
3856
|
fileEntries.push({
|
|
3952
3857
|
path: relativePath,
|
|
@@ -3960,11 +3865,11 @@ async function collectFileMetadata(cwd, files, onProgress) {
|
|
|
3960
3865
|
return fileEntries;
|
|
3961
3866
|
}
|
|
3962
3867
|
async function createArchive(cwd, files) {
|
|
3963
|
-
const tmpDir =
|
|
3964
|
-
const tarPath =
|
|
3868
|
+
const tmpDir = fs4.mkdtempSync(path3.join(os3.tmpdir(), "vm0-"));
|
|
3869
|
+
const tarPath = path3.join(tmpDir, "archive.tar.gz");
|
|
3965
3870
|
try {
|
|
3966
3871
|
const relativePaths = files.map((file) => {
|
|
3967
|
-
return
|
|
3872
|
+
return path3.relative(cwd, file);
|
|
3968
3873
|
});
|
|
3969
3874
|
if (relativePaths.length > 0) {
|
|
3970
3875
|
await Zn(
|
|
@@ -3986,13 +3891,13 @@ async function createArchive(cwd, files) {
|
|
|
3986
3891
|
["."]
|
|
3987
3892
|
);
|
|
3988
3893
|
}
|
|
3989
|
-
const tarBuffer = await
|
|
3894
|
+
const tarBuffer = await fs4.promises.readFile(tarPath);
|
|
3990
3895
|
return tarBuffer;
|
|
3991
3896
|
} finally {
|
|
3992
|
-
if (
|
|
3993
|
-
await
|
|
3897
|
+
if (fs4.existsSync(tarPath)) {
|
|
3898
|
+
await fs4.promises.unlink(tarPath);
|
|
3994
3899
|
}
|
|
3995
|
-
await
|
|
3900
|
+
await fs4.promises.rmdir(tmpDir);
|
|
3996
3901
|
}
|
|
3997
3902
|
}
|
|
3998
3903
|
function createManifest(files) {
|
|
@@ -4112,13 +4017,13 @@ async function directUpload(storageName, storageType, cwd, options) {
|
|
|
4112
4017
|
// src/lib/storage/system-storage.ts
|
|
4113
4018
|
async function uploadInstructions(agentName, instructionsFilePath, basePath, framework) {
|
|
4114
4019
|
const storageName = getInstructionsStorageName(agentName.toLowerCase());
|
|
4115
|
-
const absolutePath =
|
|
4116
|
-
const content = await
|
|
4117
|
-
const tmpDir = await
|
|
4118
|
-
const instructionsDir =
|
|
4119
|
-
await
|
|
4020
|
+
const absolutePath = path4.isAbsolute(instructionsFilePath) ? instructionsFilePath : path4.join(basePath, instructionsFilePath);
|
|
4021
|
+
const content = await fs5.readFile(absolutePath, "utf8");
|
|
4022
|
+
const tmpDir = await fs5.mkdtemp(path4.join(os4.tmpdir(), "vm0-instructions-"));
|
|
4023
|
+
const instructionsDir = path4.join(tmpDir, "instructions");
|
|
4024
|
+
await fs5.mkdir(instructionsDir);
|
|
4120
4025
|
const filename = getInstructionsFilename(framework);
|
|
4121
|
-
await
|
|
4026
|
+
await fs5.writeFile(path4.join(instructionsDir, filename), content);
|
|
4122
4027
|
try {
|
|
4123
4028
|
const result = await directUpload(storageName, "volume", instructionsDir);
|
|
4124
4029
|
return {
|
|
@@ -4127,27 +4032,7 @@ async function uploadInstructions(agentName, instructionsFilePath, basePath, fra
|
|
|
4127
4032
|
action: result.deduplicated ? "deduplicated" : "created"
|
|
4128
4033
|
};
|
|
4129
4034
|
} finally {
|
|
4130
|
-
await
|
|
4131
|
-
}
|
|
4132
|
-
}
|
|
4133
|
-
async function uploadSkill(skillUrl) {
|
|
4134
|
-
const parsed = parseGitHubTreeUrl2(skillUrl);
|
|
4135
|
-
const storageName = getSkillStorageName2(parsed);
|
|
4136
|
-
const tmpDir = await fs6.mkdtemp(path5.join(os4.tmpdir(), "vm0-skill-"));
|
|
4137
|
-
try {
|
|
4138
|
-
const skillDir = await downloadGitHubSkill(parsed, tmpDir);
|
|
4139
|
-
await validateSkillDirectory(skillDir);
|
|
4140
|
-
const frontmatter = await readSkillFrontmatter(skillDir);
|
|
4141
|
-
const result = await directUpload(storageName, "volume", skillDir);
|
|
4142
|
-
return {
|
|
4143
|
-
name: storageName,
|
|
4144
|
-
versionId: result.versionId,
|
|
4145
|
-
action: result.deduplicated ? "deduplicated" : "created",
|
|
4146
|
-
skillName: parsed.skillName,
|
|
4147
|
-
frontmatter
|
|
4148
|
-
};
|
|
4149
|
-
} finally {
|
|
4150
|
-
await fs6.rm(tmpDir, { recursive: true, force: true });
|
|
4035
|
+
await fs5.rm(tmpDir, { recursive: true, force: true });
|
|
4151
4036
|
}
|
|
4152
4037
|
}
|
|
4153
4038
|
|
|
@@ -4176,7 +4061,7 @@ async function loadAndValidateConfig(configFile) {
|
|
|
4176
4061
|
if (!existsSync4(configFile)) {
|
|
4177
4062
|
throw new Error(`Config file not found: ${configFile}`);
|
|
4178
4063
|
}
|
|
4179
|
-
const content = await
|
|
4064
|
+
const content = await readFile2(configFile, "utf8");
|
|
4180
4065
|
let config;
|
|
4181
4066
|
try {
|
|
4182
4067
|
config = (0, import_yaml.parse)(content);
|
|
@@ -4192,7 +4077,7 @@ async function loadAndValidateConfig(configFile) {
|
|
|
4192
4077
|
const agentsConfig = cfg.agents;
|
|
4193
4078
|
const agentName = Object.keys(agentsConfig)[0];
|
|
4194
4079
|
const agent = agentsConfig[agentName];
|
|
4195
|
-
const basePath =
|
|
4080
|
+
const basePath = dirname(configFile);
|
|
4196
4081
|
return { config, agentName, agent, basePath };
|
|
4197
4082
|
}
|
|
4198
4083
|
function hasVolumes(config) {
|
|
@@ -4203,64 +4088,37 @@ function hasVolumes(config) {
|
|
|
4203
4088
|
const volumes = cfg.volumes;
|
|
4204
4089
|
return typeof volumes === "object" && volumes !== null && Object.keys(volumes).length > 0;
|
|
4205
4090
|
}
|
|
4206
|
-
async function
|
|
4207
|
-
if (agent.instructions)
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4091
|
+
async function uploadInstructionsIfPresent(agentName, agent, basePath, jsonMode) {
|
|
4092
|
+
if (!agent.instructions) return;
|
|
4093
|
+
if (!jsonMode) {
|
|
4094
|
+
console.log(`Uploading instructions: ${agent.instructions}`);
|
|
4095
|
+
}
|
|
4096
|
+
const result = await uploadInstructions(
|
|
4097
|
+
agentName,
|
|
4098
|
+
agent.instructions,
|
|
4099
|
+
basePath,
|
|
4100
|
+
agent.framework
|
|
4101
|
+
);
|
|
4102
|
+
if (!jsonMode) {
|
|
4103
|
+
console.log(
|
|
4104
|
+
source_default.green(
|
|
4105
|
+
`\u2713 Instructions ${result.action === "deduplicated" ? "(unchanged)" : "uploaded"}: ${result.versionId.slice(0, 8)}`
|
|
4106
|
+
)
|
|
4216
4107
|
);
|
|
4217
|
-
if (!jsonMode) {
|
|
4218
|
-
console.log(
|
|
4219
|
-
source_default.green(
|
|
4220
|
-
`\u2713 Instructions ${result.action === "deduplicated" ? "(unchanged)" : "uploaded"}: ${result.versionId.slice(0, 8)}`
|
|
4221
|
-
)
|
|
4222
|
-
);
|
|
4223
|
-
}
|
|
4224
4108
|
}
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
const
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
if (skill) {
|
|
4235
|
-
const parsed = parseGitHubTreeUrl2(skillUrl);
|
|
4236
|
-
skillResults.push({
|
|
4237
|
-
name: skill.storageName,
|
|
4238
|
-
versionId: skill.versionHash,
|
|
4239
|
-
action: "resolved",
|
|
4240
|
-
skillName: parsed.skillName,
|
|
4241
|
-
frontmatter: skill.frontmatter
|
|
4242
|
-
});
|
|
4243
|
-
if (!jsonMode) {
|
|
4244
|
-
console.log(source_default.green(` \u2713 ${parsed.skillName} (cached)`));
|
|
4245
|
-
}
|
|
4246
|
-
}
|
|
4247
|
-
}
|
|
4248
|
-
for (const skillUrl of unresolved) {
|
|
4249
|
-
if (!jsonMode) {
|
|
4250
|
-
console.log(source_default.dim(` Downloading: ${skillUrl}`));
|
|
4251
|
-
}
|
|
4252
|
-
const result = await uploadSkill(skillUrl);
|
|
4253
|
-
skillResults.push(result);
|
|
4254
|
-
if (!jsonMode) {
|
|
4255
|
-
console.log(
|
|
4256
|
-
source_default.green(
|
|
4257
|
-
` \u2713 Skill ${result.action === "deduplicated" ? "(unchanged)" : "uploaded"}: ${result.skillName} (${result.versionId.slice(0, 8)})`
|
|
4258
|
-
)
|
|
4259
|
-
);
|
|
4109
|
+
}
|
|
4110
|
+
function stripSkillsFromAgents(config) {
|
|
4111
|
+
if (!config || typeof config !== "object") return config;
|
|
4112
|
+
const cfg = structuredClone(config);
|
|
4113
|
+
const agents = cfg.agents;
|
|
4114
|
+
if (agents && typeof agents === "object" && !Array.isArray(agents)) {
|
|
4115
|
+
for (const agent of Object.values(agents)) {
|
|
4116
|
+
if (agent && typeof agent === "object" && !Array.isArray(agent)) {
|
|
4117
|
+
delete agent.skills;
|
|
4260
4118
|
}
|
|
4261
4119
|
}
|
|
4262
4120
|
}
|
|
4263
|
-
return
|
|
4121
|
+
return cfg;
|
|
4264
4122
|
}
|
|
4265
4123
|
async function checkAndPromptMissingItems(config, options) {
|
|
4266
4124
|
const requiredSecrets = getSecretsFromComposeContent(config);
|
|
@@ -4312,7 +4170,8 @@ async function finalizeCompose(config, agent, options) {
|
|
|
4312
4170
|
if (!options.json) {
|
|
4313
4171
|
console.log("Uploading compose...");
|
|
4314
4172
|
}
|
|
4315
|
-
const
|
|
4173
|
+
const contentToPost = stripSkillsFromAgents(config);
|
|
4174
|
+
const response = await createOrUpdateCompose({ content: contentToPost });
|
|
4316
4175
|
const shortVersionId = response.versionId.slice(0, 8);
|
|
4317
4176
|
const displayName = response.name;
|
|
4318
4177
|
const result = {
|
|
@@ -4354,7 +4213,7 @@ async function handleGitHubCompose(url, options) {
|
|
|
4354
4213
|
console.log(`Downloading from GitHub: ${url}`);
|
|
4355
4214
|
}
|
|
4356
4215
|
const { dir: downloadedDir, tempRoot } = await downloadGitHubDirectory(url);
|
|
4357
|
-
const configFile =
|
|
4216
|
+
const configFile = join6(downloadedDir, "vm0.yaml");
|
|
4358
4217
|
try {
|
|
4359
4218
|
if (!existsSync4(configFile)) {
|
|
4360
4219
|
throw new Error("vm0.yaml not found in the GitHub directory", {
|
|
@@ -4401,7 +4260,7 @@ async function handleGitHubCompose(url, options) {
|
|
|
4401
4260
|
)
|
|
4402
4261
|
});
|
|
4403
4262
|
}
|
|
4404
|
-
await
|
|
4263
|
+
await uploadInstructionsIfPresent(agentName, agent, basePath, options.json);
|
|
4405
4264
|
return await finalizeCompose(config, agent, options);
|
|
4406
4265
|
} finally {
|
|
4407
4266
|
await rm3(tempRoot, { recursive: true, force: true });
|
|
@@ -4432,7 +4291,7 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
4432
4291
|
options.autoUpdate = false;
|
|
4433
4292
|
}
|
|
4434
4293
|
if (options.autoUpdate !== false) {
|
|
4435
|
-
await startSilentUpgrade("9.119.
|
|
4294
|
+
await startSilentUpgrade("9.119.3");
|
|
4436
4295
|
}
|
|
4437
4296
|
try {
|
|
4438
4297
|
let result;
|
|
@@ -4440,7 +4299,12 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
4440
4299
|
result = await handleGitHubCompose(resolvedConfigFile, options);
|
|
4441
4300
|
} else {
|
|
4442
4301
|
const { config, agentName, agent, basePath } = await loadAndValidateConfig(resolvedConfigFile);
|
|
4443
|
-
await
|
|
4302
|
+
await uploadInstructionsIfPresent(
|
|
4303
|
+
agentName,
|
|
4304
|
+
agent,
|
|
4305
|
+
basePath,
|
|
4306
|
+
options.json
|
|
4307
|
+
);
|
|
4444
4308
|
result = await finalizeCompose(config, agent, options);
|
|
4445
4309
|
}
|
|
4446
4310
|
if (options.json) {
|
|
@@ -4517,7 +4381,7 @@ var mainRunCommand = new Command().name("run").description("Run an agent").argum
|
|
|
4517
4381
|
withErrorHandler(
|
|
4518
4382
|
async (identifier, prompt, options) => {
|
|
4519
4383
|
if (options.autoUpdate !== false) {
|
|
4520
|
-
await startSilentUpgrade("9.119.
|
|
4384
|
+
await startSilentUpgrade("9.119.3");
|
|
4521
4385
|
}
|
|
4522
4386
|
const { name, version } = parseIdentifier(identifier);
|
|
4523
4387
|
let composeId;
|
|
@@ -4997,14 +4861,14 @@ init_esm_shims();
|
|
|
4997
4861
|
|
|
4998
4862
|
// src/commands/volume/init.ts
|
|
4999
4863
|
init_esm_shims();
|
|
5000
|
-
import
|
|
4864
|
+
import path6 from "path";
|
|
5001
4865
|
|
|
5002
4866
|
// src/lib/storage/storage-utils.ts
|
|
5003
4867
|
init_esm_shims();
|
|
5004
4868
|
var import_yaml2 = __toESM(require_dist(), 1);
|
|
5005
|
-
import { readFile as
|
|
4869
|
+
import { readFile as readFile3, writeFile as writeFile3, mkdir as mkdir2 } from "fs/promises";
|
|
5006
4870
|
import { existsSync as existsSync5 } from "fs";
|
|
5007
|
-
import
|
|
4871
|
+
import path5 from "path";
|
|
5008
4872
|
var CONFIG_DIR = ".vm0";
|
|
5009
4873
|
var CONFIG_FILE = "storage.yaml";
|
|
5010
4874
|
function isValidStorageName(name) {
|
|
@@ -5015,8 +4879,8 @@ function isValidStorageName(name) {
|
|
|
5015
4879
|
return pattern.test(name) && !name.includes("--");
|
|
5016
4880
|
}
|
|
5017
4881
|
async function readStorageConfig(basePath = process.cwd()) {
|
|
5018
|
-
const configPath =
|
|
5019
|
-
const legacyConfigPath =
|
|
4882
|
+
const configPath = path5.join(basePath, CONFIG_DIR, CONFIG_FILE);
|
|
4883
|
+
const legacyConfigPath = path5.join(basePath, CONFIG_DIR, "volume.yaml");
|
|
5020
4884
|
let actualPath = null;
|
|
5021
4885
|
if (existsSync5(configPath)) {
|
|
5022
4886
|
actualPath = configPath;
|
|
@@ -5026,7 +4890,7 @@ async function readStorageConfig(basePath = process.cwd()) {
|
|
|
5026
4890
|
if (!actualPath) {
|
|
5027
4891
|
return null;
|
|
5028
4892
|
}
|
|
5029
|
-
const content = await
|
|
4893
|
+
const content = await readFile3(actualPath, "utf8");
|
|
5030
4894
|
const config = (0, import_yaml2.parse)(content);
|
|
5031
4895
|
if (!config.type) {
|
|
5032
4896
|
config.type = "volume";
|
|
@@ -5034,10 +4898,10 @@ async function readStorageConfig(basePath = process.cwd()) {
|
|
|
5034
4898
|
return config;
|
|
5035
4899
|
}
|
|
5036
4900
|
async function writeStorageConfig(storageName, basePath = process.cwd(), type2 = "volume") {
|
|
5037
|
-
const configDir =
|
|
5038
|
-
const configPath =
|
|
4901
|
+
const configDir = path5.join(basePath, CONFIG_DIR);
|
|
4902
|
+
const configPath = path5.join(configDir, CONFIG_FILE);
|
|
5039
4903
|
if (!existsSync5(configDir)) {
|
|
5040
|
-
await
|
|
4904
|
+
await mkdir2(configDir, { recursive: true });
|
|
5041
4905
|
}
|
|
5042
4906
|
const config = {
|
|
5043
4907
|
name: storageName,
|
|
@@ -5051,14 +4915,14 @@ async function writeStorageConfig(storageName, basePath = process.cwd(), type2 =
|
|
|
5051
4915
|
var initCommand = new Command().name("init").description("Initialize a volume in the current directory").option("-n, --name <name>", "Volume name (required in non-interactive mode)").action(
|
|
5052
4916
|
withErrorHandler(async (options) => {
|
|
5053
4917
|
const cwd = process.cwd();
|
|
5054
|
-
const dirName =
|
|
4918
|
+
const dirName = path6.basename(cwd);
|
|
5055
4919
|
const existingConfig = await readStorageConfig(cwd);
|
|
5056
4920
|
if (existingConfig) {
|
|
5057
4921
|
console.log(
|
|
5058
4922
|
source_default.yellow(`Volume already initialized: ${existingConfig.name}`)
|
|
5059
4923
|
);
|
|
5060
4924
|
console.log(
|
|
5061
|
-
source_default.dim(`Config file: ${
|
|
4925
|
+
source_default.dim(`Config file: ${path6.join(cwd, ".vm0", "storage.yaml")}`)
|
|
5062
4926
|
);
|
|
5063
4927
|
return;
|
|
5064
4928
|
}
|
|
@@ -5098,7 +4962,7 @@ var initCommand = new Command().name("init").description("Initialize a volume in
|
|
|
5098
4962
|
console.log(source_default.green(`\u2713 Initialized volume: ${volumeName}`));
|
|
5099
4963
|
console.log(
|
|
5100
4964
|
source_default.dim(
|
|
5101
|
-
` Config saved to ${
|
|
4965
|
+
` Config saved to ${path6.join(cwd, ".vm0", "storage.yaml")}`
|
|
5102
4966
|
)
|
|
5103
4967
|
);
|
|
5104
4968
|
})
|
|
@@ -5141,8 +5005,8 @@ var pushCommand = new Command().name("push").description("Push local files to cl
|
|
|
5141
5005
|
|
|
5142
5006
|
// src/commands/volume/pull.ts
|
|
5143
5007
|
init_esm_shims();
|
|
5144
|
-
import
|
|
5145
|
-
import * as
|
|
5008
|
+
import path7 from "path";
|
|
5009
|
+
import * as fs6 from "fs";
|
|
5146
5010
|
import * as os5 from "os";
|
|
5147
5011
|
|
|
5148
5012
|
// src/lib/storage/pull-utils.ts
|
|
@@ -5194,9 +5058,9 @@ var pullCommand = new Command().name("pull").description("Pull cloud files to lo
|
|
|
5194
5058
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
5195
5059
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
5196
5060
|
console.log(source_default.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
5197
|
-
const tmpDir =
|
|
5198
|
-
const tarPath =
|
|
5199
|
-
await
|
|
5061
|
+
const tmpDir = fs6.mkdtempSync(path7.join(os5.tmpdir(), "vm0-"));
|
|
5062
|
+
const tarPath = path7.join(tmpDir, "volume.tar.gz");
|
|
5063
|
+
await fs6.promises.writeFile(tarPath, tarBuffer);
|
|
5200
5064
|
console.log(source_default.dim("Syncing local files..."));
|
|
5201
5065
|
const remoteFiles = await listTarFiles(tarPath);
|
|
5202
5066
|
const remoteFilesSet = new Set(
|
|
@@ -5216,8 +5080,8 @@ var pullCommand = new Command().name("pull").description("Pull cloud files to lo
|
|
|
5216
5080
|
cwd,
|
|
5217
5081
|
gzip: true
|
|
5218
5082
|
});
|
|
5219
|
-
await
|
|
5220
|
-
await
|
|
5083
|
+
await fs6.promises.unlink(tarPath);
|
|
5084
|
+
await fs6.promises.rmdir(tmpDir);
|
|
5221
5085
|
console.log(source_default.green(`\u2713 Extracted ${remoteFiles.length} files`));
|
|
5222
5086
|
})
|
|
5223
5087
|
);
|
|
@@ -5320,8 +5184,8 @@ init_esm_shims();
|
|
|
5320
5184
|
|
|
5321
5185
|
// src/lib/storage/clone-utils.ts
|
|
5322
5186
|
init_esm_shims();
|
|
5323
|
-
import
|
|
5324
|
-
import * as
|
|
5187
|
+
import path8 from "path";
|
|
5188
|
+
import * as fs7 from "fs";
|
|
5325
5189
|
import * as os6 from "os";
|
|
5326
5190
|
async function cloneStorage(name, type2, destination, options = {}) {
|
|
5327
5191
|
const typeLabel = type2;
|
|
@@ -5336,7 +5200,7 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
5336
5200
|
version: options.version
|
|
5337
5201
|
});
|
|
5338
5202
|
console.log(source_default.dim(`Creating directory: ${destination}/`));
|
|
5339
|
-
await
|
|
5203
|
+
await fs7.promises.mkdir(destination, { recursive: true });
|
|
5340
5204
|
if ("empty" in downloadInfo) {
|
|
5341
5205
|
await writeStorageConfig(name, destination, type2);
|
|
5342
5206
|
console.log(source_default.green(`\u2713 Cloned empty ${typeLabel}: ${name}`));
|
|
@@ -5355,15 +5219,15 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
5355
5219
|
console.log(source_default.dim("Downloading from S3..."));
|
|
5356
5220
|
const s3Response = await fetch(downloadUrl);
|
|
5357
5221
|
if (!s3Response.ok) {
|
|
5358
|
-
await
|
|
5222
|
+
await fs7.promises.rm(destination, { recursive: true, force: true });
|
|
5359
5223
|
throw new Error(`S3 download failed: ${s3Response.status}`);
|
|
5360
5224
|
}
|
|
5361
5225
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
5362
5226
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
5363
5227
|
console.log(source_default.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
5364
|
-
const tmpDir =
|
|
5365
|
-
const tarPath =
|
|
5366
|
-
await
|
|
5228
|
+
const tmpDir = fs7.mkdtempSync(path8.join(os6.tmpdir(), "vm0-clone-"));
|
|
5229
|
+
const tarPath = path8.join(tmpDir, "archive.tar.gz");
|
|
5230
|
+
await fs7.promises.writeFile(tarPath, tarBuffer);
|
|
5367
5231
|
const files = await listTarFiles(tarPath);
|
|
5368
5232
|
console.log(source_default.dim("Extracting files..."));
|
|
5369
5233
|
await co({
|
|
@@ -5371,8 +5235,8 @@ async function cloneStorage(name, type2, destination, options = {}) {
|
|
|
5371
5235
|
cwd: destination,
|
|
5372
5236
|
gzip: true
|
|
5373
5237
|
});
|
|
5374
|
-
await
|
|
5375
|
-
await
|
|
5238
|
+
await fs7.promises.unlink(tarPath);
|
|
5239
|
+
await fs7.promises.rmdir(tmpDir);
|
|
5376
5240
|
console.log(source_default.green(`\u2713 Extracted ${files.length} files`));
|
|
5377
5241
|
await writeStorageConfig(name, destination, type2);
|
|
5378
5242
|
console.log(source_default.green(`\u2713 Initialized .vm0/storage.yaml`));
|
|
@@ -5405,14 +5269,14 @@ init_esm_shims();
|
|
|
5405
5269
|
|
|
5406
5270
|
// src/commands/artifact/init.ts
|
|
5407
5271
|
init_esm_shims();
|
|
5408
|
-
import
|
|
5272
|
+
import path9 from "path";
|
|
5409
5273
|
var initCommand2 = new Command().name("init").description("Initialize an artifact in the current directory").option(
|
|
5410
5274
|
"-n, --name <name>",
|
|
5411
5275
|
"Artifact name (required in non-interactive mode)"
|
|
5412
5276
|
).action(
|
|
5413
5277
|
withErrorHandler(async (options) => {
|
|
5414
5278
|
const cwd = process.cwd();
|
|
5415
|
-
const dirName =
|
|
5279
|
+
const dirName = path9.basename(cwd);
|
|
5416
5280
|
const existingConfig = await readStorageConfig(cwd);
|
|
5417
5281
|
if (existingConfig) {
|
|
5418
5282
|
if (existingConfig.type === "artifact") {
|
|
@@ -5434,7 +5298,7 @@ var initCommand2 = new Command().name("init").description("Initialize an artifac
|
|
|
5434
5298
|
);
|
|
5435
5299
|
}
|
|
5436
5300
|
console.log(
|
|
5437
|
-
source_default.dim(`Config file: ${
|
|
5301
|
+
source_default.dim(`Config file: ${path9.join(cwd, ".vm0", "storage.yaml")}`)
|
|
5438
5302
|
);
|
|
5439
5303
|
return;
|
|
5440
5304
|
}
|
|
@@ -5474,7 +5338,7 @@ var initCommand2 = new Command().name("init").description("Initialize an artifac
|
|
|
5474
5338
|
console.log(source_default.green(`\u2713 Initialized artifact: ${artifactName}`));
|
|
5475
5339
|
console.log(
|
|
5476
5340
|
source_default.dim(
|
|
5477
|
-
` Config saved to ${
|
|
5341
|
+
` Config saved to ${path9.join(cwd, ".vm0", "storage.yaml")}`
|
|
5478
5342
|
)
|
|
5479
5343
|
);
|
|
5480
5344
|
})
|
|
@@ -5523,8 +5387,8 @@ var pushCommand2 = new Command().name("push").description("Push local files to c
|
|
|
5523
5387
|
|
|
5524
5388
|
// src/commands/artifact/pull.ts
|
|
5525
5389
|
init_esm_shims();
|
|
5526
|
-
import
|
|
5527
|
-
import * as
|
|
5390
|
+
import path10 from "path";
|
|
5391
|
+
import * as fs8 from "fs";
|
|
5528
5392
|
import * as os7 from "os";
|
|
5529
5393
|
var pullCommand2 = new Command().name("pull").description("Pull cloud artifact to local directory").argument("[versionId]", "Version ID to pull (default: latest)").action(
|
|
5530
5394
|
withErrorHandler(async (versionId) => {
|
|
@@ -5568,9 +5432,9 @@ var pullCommand2 = new Command().name("pull").description("Pull cloud artifact t
|
|
|
5568
5432
|
const arrayBuffer = await s3Response.arrayBuffer();
|
|
5569
5433
|
const tarBuffer = Buffer.from(arrayBuffer);
|
|
5570
5434
|
console.log(source_default.green(`\u2713 Downloaded ${formatBytes(tarBuffer.length)}`));
|
|
5571
|
-
const tmpDir =
|
|
5572
|
-
const tarPath =
|
|
5573
|
-
await
|
|
5435
|
+
const tmpDir = fs8.mkdtempSync(path10.join(os7.tmpdir(), "vm0-"));
|
|
5436
|
+
const tarPath = path10.join(tmpDir, "artifact.tar.gz");
|
|
5437
|
+
await fs8.promises.writeFile(tarPath, tarBuffer);
|
|
5574
5438
|
console.log(source_default.dim("Syncing local files..."));
|
|
5575
5439
|
const remoteFiles = await listTarFiles(tarPath);
|
|
5576
5440
|
const remoteFilesSet = new Set(
|
|
@@ -5590,8 +5454,8 @@ var pullCommand2 = new Command().name("pull").description("Pull cloud artifact t
|
|
|
5590
5454
|
cwd,
|
|
5591
5455
|
gzip: true
|
|
5592
5456
|
});
|
|
5593
|
-
await
|
|
5594
|
-
await
|
|
5457
|
+
await fs8.promises.unlink(tarPath);
|
|
5458
|
+
await fs8.promises.rmdir(tmpDir);
|
|
5595
5459
|
console.log(source_default.green(`\u2713 Extracted ${remoteFiles.length} files`));
|
|
5596
5460
|
})
|
|
5597
5461
|
);
|
|
@@ -5713,11 +5577,11 @@ init_esm_shims();
|
|
|
5713
5577
|
|
|
5714
5578
|
// src/commands/memory/init.ts
|
|
5715
5579
|
init_esm_shims();
|
|
5716
|
-
import
|
|
5580
|
+
import path11 from "path";
|
|
5717
5581
|
var initCommand3 = new Command().name("init").description("Initialize a memory in the current directory").option("-n, --name <name>", "Memory name (required in non-interactive mode)").action(
|
|
5718
5582
|
withErrorHandler(async (options) => {
|
|
5719
5583
|
const cwd = process.cwd();
|
|
5720
|
-
const dirName =
|
|
5584
|
+
const dirName = path11.basename(cwd);
|
|
5721
5585
|
const existingConfig = await readStorageConfig(cwd);
|
|
5722
5586
|
if (existingConfig) {
|
|
5723
5587
|
if (existingConfig.type === "memory") {
|
|
@@ -5737,7 +5601,7 @@ var initCommand3 = new Command().name("init").description("Initialize a memory i
|
|
|
5737
5601
|
);
|
|
5738
5602
|
}
|
|
5739
5603
|
console.log(
|
|
5740
|
-
source_default.dim(`Config file: ${
|
|
5604
|
+
source_default.dim(`Config file: ${path11.join(cwd, ".vm0", "storage.yaml")}`)
|
|
5741
5605
|
);
|
|
5742
5606
|
return;
|
|
5743
5607
|
}
|
|
@@ -5777,7 +5641,7 @@ var initCommand3 = new Command().name("init").description("Initialize a memory i
|
|
|
5777
5641
|
console.log(source_default.green(`\u2713 Initialized memory: ${memoryName}`));
|
|
5778
5642
|
console.log(
|
|
5779
5643
|
source_default.dim(
|
|
5780
|
-
` Config saved to ${
|
|
5644
|
+
` Config saved to ${path11.join(cwd, ".vm0", "storage.yaml")}`
|
|
5781
5645
|
)
|
|
5782
5646
|
);
|
|
5783
5647
|
})
|
|
@@ -6427,7 +6291,7 @@ async function showNetworkLogs(runId, options) {
|
|
|
6427
6291
|
|
|
6428
6292
|
// src/commands/init/index.ts
|
|
6429
6293
|
init_esm_shims();
|
|
6430
|
-
import
|
|
6294
|
+
import path12 from "path";
|
|
6431
6295
|
import { existsSync as existsSync6 } from "fs";
|
|
6432
6296
|
import { writeFile as writeFile4 } from "fs/promises";
|
|
6433
6297
|
var VM0_YAML_FILE = "vm0.yaml";
|
|
@@ -6440,9 +6304,6 @@ agents:
|
|
|
6440
6304
|
framework: claude-code
|
|
6441
6305
|
# Build agentic workflow using natural language
|
|
6442
6306
|
instructions: AGENTS.md
|
|
6443
|
-
# Agent skills - see https://github.com/vm0-ai/vm0-skills for available skills
|
|
6444
|
-
# skills:
|
|
6445
|
-
# - https://github.com/vm0-ai/vm0-skills/tree/main/github
|
|
6446
6307
|
`;
|
|
6447
6308
|
}
|
|
6448
6309
|
function generateAgentsMd() {
|
|
@@ -6480,7 +6341,7 @@ var initCommand4 = new Command().name("init").description("Initialize a new VM0
|
|
|
6480
6341
|
cause: new Error("Usage: vm0 init --name <agent-name>")
|
|
6481
6342
|
});
|
|
6482
6343
|
} else {
|
|
6483
|
-
const dirName =
|
|
6344
|
+
const dirName = path12.basename(process.cwd());
|
|
6484
6345
|
const defaultName = validateAgentName(dirName) ? dirName : void 0;
|
|
6485
6346
|
const name = await promptText(
|
|
6486
6347
|
"Enter agent name",
|
|
@@ -6532,13 +6393,13 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
|
|
|
6532
6393
|
if (latestVersion === null) {
|
|
6533
6394
|
throw new Error("Could not check for updates. Please try again later.");
|
|
6534
6395
|
}
|
|
6535
|
-
if (latestVersion === "9.119.
|
|
6536
|
-
console.log(source_default.green(`\u2713 Already up to date (${"9.119.
|
|
6396
|
+
if (latestVersion === "9.119.3") {
|
|
6397
|
+
console.log(source_default.green(`\u2713 Already up to date (${"9.119.3"})`));
|
|
6537
6398
|
return;
|
|
6538
6399
|
}
|
|
6539
6400
|
console.log(
|
|
6540
6401
|
source_default.yellow(
|
|
6541
|
-
`Current version: ${"9.119.
|
|
6402
|
+
`Current version: ${"9.119.3"} -> Latest version: ${latestVersion}`
|
|
6542
6403
|
)
|
|
6543
6404
|
);
|
|
6544
6405
|
console.log();
|
|
@@ -6565,7 +6426,7 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
|
|
|
6565
6426
|
const success = await performUpgrade(packageManager);
|
|
6566
6427
|
if (success) {
|
|
6567
6428
|
console.log(
|
|
6568
|
-
source_default.green(`\u2713 Upgraded from ${"9.119.
|
|
6429
|
+
source_default.green(`\u2713 Upgraded from ${"9.119.3"} to ${latestVersion}`)
|
|
6569
6430
|
);
|
|
6570
6431
|
return;
|
|
6571
6432
|
}
|
|
@@ -6632,7 +6493,7 @@ var whoamiCommand = new Command().name("whoami").description("Show current ident
|
|
|
6632
6493
|
|
|
6633
6494
|
// src/index.ts
|
|
6634
6495
|
var program = new Command();
|
|
6635
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.119.
|
|
6496
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.119.3");
|
|
6636
6497
|
program.addCommand(authCommand);
|
|
6637
6498
|
program.addCommand(infoCommand);
|
|
6638
6499
|
program.addCommand(composeCommand);
|