@annals/agent-mesh 0.17.0 → 0.17.2
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/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
} from "./chunk-KEUGYA3L.js";
|
|
34
34
|
|
|
35
35
|
// src/index.ts
|
|
36
|
-
import { createRequire } from "module";
|
|
36
|
+
import { createRequire as createRequire2 } from "module";
|
|
37
37
|
import { program } from "commander";
|
|
38
38
|
|
|
39
39
|
// src/platform/auth.ts
|
|
@@ -271,12 +271,43 @@ import { BridgeErrorCode } from "@annals/bridge-protocol";
|
|
|
271
271
|
|
|
272
272
|
// src/utils/webrtc-transfer.ts
|
|
273
273
|
import { createHash } from "crypto";
|
|
274
|
+
import { createRequire } from "module";
|
|
275
|
+
import { existsSync, copyFileSync, mkdirSync } from "fs";
|
|
276
|
+
import { join, dirname } from "path";
|
|
274
277
|
var ICE_SERVERS = ["stun:stun.l.google.com:19302"];
|
|
275
278
|
var CHUNK_SIZE = 64 * 1024;
|
|
276
279
|
var ndcModule;
|
|
280
|
+
function ensurePrebuilt() {
|
|
281
|
+
try {
|
|
282
|
+
const require3 = createRequire(import.meta.url);
|
|
283
|
+
const ndcMain = require3.resolve("node-datachannel");
|
|
284
|
+
let ndcRoot = dirname(ndcMain);
|
|
285
|
+
for (let i = 0; i < 5; i++) {
|
|
286
|
+
if (existsSync(join(ndcRoot, "package.json"))) break;
|
|
287
|
+
ndcRoot = dirname(ndcRoot);
|
|
288
|
+
}
|
|
289
|
+
const target = join(ndcRoot, "build", "Release", "node_datachannel.node");
|
|
290
|
+
if (existsSync(target)) return true;
|
|
291
|
+
const platform = process.platform;
|
|
292
|
+
const arch = process.arch;
|
|
293
|
+
const ourPkgRoot = join(dirname(import.meta.url.replace("file://", "")), "..", "..");
|
|
294
|
+
const prebuiltSrc = join(ourPkgRoot, "prebuilds", `${platform}-${arch}`, "node_datachannel.node");
|
|
295
|
+
if (!existsSync(prebuiltSrc)) {
|
|
296
|
+
log.warn(`No prebuilt binary for ${platform}-${arch}`);
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
mkdirSync(join(ndcRoot, "build", "Release"), { recursive: true });
|
|
300
|
+
copyFileSync(prebuiltSrc, target);
|
|
301
|
+
log.info(`Installed node-datachannel prebuilt for ${platform}-${arch}`);
|
|
302
|
+
return true;
|
|
303
|
+
} catch {
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
277
307
|
async function loadNdc() {
|
|
278
308
|
if (ndcModule !== void 0) return ndcModule;
|
|
279
309
|
try {
|
|
310
|
+
ensurePrebuilt();
|
|
280
311
|
ndcModule = await import("node-datachannel");
|
|
281
312
|
return ndcModule;
|
|
282
313
|
} catch {
|
|
@@ -411,15 +442,15 @@ var SessionPool = class {
|
|
|
411
442
|
|
|
412
443
|
// src/utils/local-runtime-queue.ts
|
|
413
444
|
import {
|
|
414
|
-
existsSync,
|
|
415
|
-
mkdirSync,
|
|
445
|
+
existsSync as existsSync2,
|
|
446
|
+
mkdirSync as mkdirSync2,
|
|
416
447
|
readFileSync,
|
|
417
448
|
renameSync,
|
|
418
449
|
rmSync,
|
|
419
450
|
statSync,
|
|
420
451
|
writeFileSync
|
|
421
452
|
} from "fs";
|
|
422
|
-
import { join } from "path";
|
|
453
|
+
import { join as join2 } from "path";
|
|
423
454
|
import { homedir } from "os";
|
|
424
455
|
var DEFAULT_LOCK_STALE_MS = 3e4;
|
|
425
456
|
var DEFAULT_LOCK_WAIT_MS = 1e4;
|
|
@@ -476,10 +507,10 @@ var LocalRuntimeQueue = class {
|
|
|
476
507
|
leaseHeartbeatMs;
|
|
477
508
|
constructor(config, opts = {}) {
|
|
478
509
|
this.config = config;
|
|
479
|
-
const baseDir = opts.baseDir ||
|
|
480
|
-
this.runtimeRoot =
|
|
481
|
-
this.statePath =
|
|
482
|
-
this.lockPath =
|
|
510
|
+
const baseDir = opts.baseDir || join2(homedir(), ".agent-mesh");
|
|
511
|
+
this.runtimeRoot = join2(baseDir, "runtime");
|
|
512
|
+
this.statePath = join2(this.runtimeRoot, "queue-state.json");
|
|
513
|
+
this.lockPath = join2(this.runtimeRoot, "queue.lock");
|
|
483
514
|
this.lockStaleMs = opts.lockStaleMs ?? DEFAULT_LOCK_STALE_MS;
|
|
484
515
|
this.lockWaitMs = opts.lockWaitMs ?? DEFAULT_LOCK_WAIT_MS;
|
|
485
516
|
this.lockRetryMs = opts.lockRetryMs ?? DEFAULT_LOCK_RETRY_MS;
|
|
@@ -651,8 +682,8 @@ var LocalRuntimeQueue = class {
|
|
|
651
682
|
}
|
|
652
683
|
}
|
|
653
684
|
ensureRuntimeDir() {
|
|
654
|
-
if (!
|
|
655
|
-
|
|
685
|
+
if (!existsSync2(this.runtimeRoot)) {
|
|
686
|
+
mkdirSync2(this.runtimeRoot, { recursive: true, mode: 448 });
|
|
656
687
|
}
|
|
657
688
|
}
|
|
658
689
|
defaultState() {
|
|
@@ -707,7 +738,7 @@ var LocalRuntimeQueue = class {
|
|
|
707
738
|
const acquiredAt = Date.now();
|
|
708
739
|
while (true) {
|
|
709
740
|
try {
|
|
710
|
-
|
|
741
|
+
mkdirSync2(this.lockPath, { mode: 448 });
|
|
711
742
|
break;
|
|
712
743
|
} catch (err) {
|
|
713
744
|
const e = err;
|
|
@@ -1254,7 +1285,7 @@ import { spawn } from "child_process";
|
|
|
1254
1285
|
|
|
1255
1286
|
// src/utils/sandbox.ts
|
|
1256
1287
|
import { execSync } from "child_process";
|
|
1257
|
-
import { join as
|
|
1288
|
+
import { join as join3 } from "path";
|
|
1258
1289
|
var SRT_PACKAGE = "@anthropic-ai/sandbox-runtime";
|
|
1259
1290
|
var SENSITIVE_PATHS = [
|
|
1260
1291
|
// SSH & crypto keys
|
|
@@ -1313,7 +1344,7 @@ var sandboxInitialized = false;
|
|
|
1313
1344
|
async function importSandboxManager() {
|
|
1314
1345
|
try {
|
|
1315
1346
|
const globalRoot = execSync("npm root -g", { encoding: "utf-8" }).trim();
|
|
1316
|
-
const srtPath =
|
|
1347
|
+
const srtPath = join3(globalRoot, "@anthropic-ai/sandbox-runtime/dist/index.js");
|
|
1317
1348
|
const mod = await import(srtPath);
|
|
1318
1349
|
return mod.SandboxManager;
|
|
1319
1350
|
} catch {
|
|
@@ -1519,8 +1550,8 @@ function which(command) {
|
|
|
1519
1550
|
}
|
|
1520
1551
|
|
|
1521
1552
|
// src/utils/client-workspace.ts
|
|
1522
|
-
import { mkdirSync as
|
|
1523
|
-
import { join as
|
|
1553
|
+
import { mkdirSync as mkdirSync3, readdirSync, symlinkSync, existsSync as existsSync3, lstatSync } from "fs";
|
|
1554
|
+
import { join as join4, relative } from "path";
|
|
1524
1555
|
var SYMLINK_ALLOW = /* @__PURE__ */ new Set([
|
|
1525
1556
|
"CLAUDE.md",
|
|
1526
1557
|
".claude",
|
|
@@ -1549,19 +1580,19 @@ function shouldInclude(name) {
|
|
|
1549
1580
|
return false;
|
|
1550
1581
|
}
|
|
1551
1582
|
function createClientWorkspace(projectPath, clientId) {
|
|
1552
|
-
const wsDir =
|
|
1553
|
-
const isNew = !
|
|
1554
|
-
|
|
1583
|
+
const wsDir = join4(projectPath, ".bridge-clients", clientId);
|
|
1584
|
+
const isNew = !existsSync3(wsDir);
|
|
1585
|
+
mkdirSync3(wsDir, { recursive: true });
|
|
1555
1586
|
const entries = readdirSync(projectPath, { withFileTypes: true });
|
|
1556
1587
|
for (const entry of entries) {
|
|
1557
1588
|
if (!shouldInclude(entry.name)) continue;
|
|
1558
|
-
const link =
|
|
1589
|
+
const link = join4(wsDir, entry.name);
|
|
1559
1590
|
try {
|
|
1560
1591
|
lstatSync(link);
|
|
1561
1592
|
continue;
|
|
1562
1593
|
} catch {
|
|
1563
1594
|
}
|
|
1564
|
-
const target =
|
|
1595
|
+
const target = join4(projectPath, entry.name);
|
|
1565
1596
|
const relTarget = relative(wsDir, target);
|
|
1566
1597
|
try {
|
|
1567
1598
|
symlinkSync(relTarget, link);
|
|
@@ -1577,11 +1608,11 @@ function createClientWorkspace(projectPath, clientId) {
|
|
|
1577
1608
|
|
|
1578
1609
|
// src/adapters/claude.ts
|
|
1579
1610
|
import { writeFile, mkdir, stat as stat2 } from "fs/promises";
|
|
1580
|
-
import { join as
|
|
1611
|
+
import { join as join6, relative as relative3, basename } from "path";
|
|
1581
1612
|
|
|
1582
1613
|
// src/utils/auto-upload.ts
|
|
1583
1614
|
import { readdir, readFile, stat } from "fs/promises";
|
|
1584
|
-
import { join as
|
|
1615
|
+
import { join as join5, relative as relative2 } from "path";
|
|
1585
1616
|
var MAX_AUTO_UPLOAD_FILE_SIZE = 10 * 1024 * 1024;
|
|
1586
1617
|
var SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
1587
1618
|
".git",
|
|
@@ -1606,7 +1637,7 @@ async function collectRealFiles(dir, maxFiles = Infinity) {
|
|
|
1606
1637
|
for (const entry of entries) {
|
|
1607
1638
|
if (files.length >= maxFiles) return;
|
|
1608
1639
|
if (entry.isSymbolicLink()) continue;
|
|
1609
|
-
const fullPath =
|
|
1640
|
+
const fullPath = join5(d, entry.name);
|
|
1610
1641
|
if (entry.isDirectory()) {
|
|
1611
1642
|
if (SKIP_DIRS.has(entry.name)) continue;
|
|
1612
1643
|
await walk(fullPath);
|
|
@@ -1843,7 +1874,7 @@ var ClaudeSession = class {
|
|
|
1843
1874
|
await mkdir(workspaceRoot, { recursive: true });
|
|
1844
1875
|
for (const att of attachments) {
|
|
1845
1876
|
const safeName = basename(att.name).replace(/[^a-zA-Z0-9._-]/g, "_") || "attachment";
|
|
1846
|
-
const destPath =
|
|
1877
|
+
const destPath = join6(workspaceRoot, safeName);
|
|
1847
1878
|
try {
|
|
1848
1879
|
const res = await fetch(att.url);
|
|
1849
1880
|
if (!res.ok) {
|
|
@@ -2760,7 +2791,7 @@ function registerRestartCommand(program2) {
|
|
|
2760
2791
|
|
|
2761
2792
|
// src/commands/logs.ts
|
|
2762
2793
|
import { spawn as spawn2 } from "child_process";
|
|
2763
|
-
import { existsSync as
|
|
2794
|
+
import { existsSync as existsSync4 } from "fs";
|
|
2764
2795
|
function registerLogsCommand(program2) {
|
|
2765
2796
|
program2.command("logs <name>").description("View agent logs (follows in real-time)").option("-n, --lines <number>", "Number of lines to show", "50").action((name, opts) => {
|
|
2766
2797
|
const entry = getAgent(name);
|
|
@@ -2769,7 +2800,7 @@ function registerLogsCommand(program2) {
|
|
|
2769
2800
|
process.exit(1);
|
|
2770
2801
|
}
|
|
2771
2802
|
const logPath = getLogPath(name);
|
|
2772
|
-
if (!
|
|
2803
|
+
if (!existsSync4(logPath)) {
|
|
2773
2804
|
log.error(`No log file found for "${name}". Has this agent been started before?`);
|
|
2774
2805
|
process.exit(1);
|
|
2775
2806
|
}
|
|
@@ -2850,14 +2881,14 @@ function registerOpenCommand(program2) {
|
|
|
2850
2881
|
}
|
|
2851
2882
|
|
|
2852
2883
|
// src/commands/install.ts
|
|
2853
|
-
import { writeFileSync as writeFileSync2, existsSync as
|
|
2854
|
-
import { join as
|
|
2884
|
+
import { writeFileSync as writeFileSync2, existsSync as existsSync5, mkdirSync as mkdirSync4 } from "fs";
|
|
2885
|
+
import { join as join7 } from "path";
|
|
2855
2886
|
import { homedir as homedir4 } from "os";
|
|
2856
2887
|
import { execSync as execSync2 } from "child_process";
|
|
2857
2888
|
var LABEL = "com.agents-hot.agent-mesh";
|
|
2858
|
-
var PLIST_DIR =
|
|
2859
|
-
var PLIST_PATH =
|
|
2860
|
-
var LOG_PATH =
|
|
2889
|
+
var PLIST_DIR = join7(homedir4(), "Library", "LaunchAgents");
|
|
2890
|
+
var PLIST_PATH = join7(PLIST_DIR, `${LABEL}.plist`);
|
|
2891
|
+
var LOG_PATH = join7(homedir4(), ".agent-mesh", "logs", "launchd.log");
|
|
2861
2892
|
function detectPaths() {
|
|
2862
2893
|
return {
|
|
2863
2894
|
node: process.execPath,
|
|
@@ -2904,7 +2935,7 @@ function registerInstallCommand(program2) {
|
|
|
2904
2935
|
log.error("LaunchAgent is macOS only. On Linux, use systemd user service instead.");
|
|
2905
2936
|
process.exit(1);
|
|
2906
2937
|
}
|
|
2907
|
-
if (
|
|
2938
|
+
if (existsSync5(PLIST_PATH) && !opts.force) {
|
|
2908
2939
|
console.log(`
|
|
2909
2940
|
${YELLOW}\u2298${RESET} LaunchAgent already installed at:`);
|
|
2910
2941
|
console.log(` ${GRAY}${PLIST_PATH}${RESET}`);
|
|
@@ -2914,10 +2945,10 @@ function registerInstallCommand(program2) {
|
|
|
2914
2945
|
return;
|
|
2915
2946
|
}
|
|
2916
2947
|
const { node, script } = detectPaths();
|
|
2917
|
-
if (!
|
|
2918
|
-
|
|
2948
|
+
if (!existsSync5(PLIST_DIR)) {
|
|
2949
|
+
mkdirSync4(PLIST_DIR, { recursive: true });
|
|
2919
2950
|
}
|
|
2920
|
-
if (
|
|
2951
|
+
if (existsSync5(PLIST_PATH)) {
|
|
2921
2952
|
try {
|
|
2922
2953
|
execSync2(`launchctl bootout gui/$(id -u) "${PLIST_PATH}" 2>/dev/null`, { stdio: "ignore" });
|
|
2923
2954
|
} catch {
|
|
@@ -2950,19 +2981,19 @@ function registerInstallCommand(program2) {
|
|
|
2950
2981
|
}
|
|
2951
2982
|
|
|
2952
2983
|
// src/commands/uninstall.ts
|
|
2953
|
-
import { existsSync as
|
|
2954
|
-
import { join as
|
|
2984
|
+
import { existsSync as existsSync6, unlinkSync as unlinkSync2 } from "fs";
|
|
2985
|
+
import { join as join8 } from "path";
|
|
2955
2986
|
import { homedir as homedir5 } from "os";
|
|
2956
2987
|
import { execSync as execSync3 } from "child_process";
|
|
2957
2988
|
var LABEL2 = "com.agents-hot.agent-mesh";
|
|
2958
|
-
var PLIST_PATH2 =
|
|
2989
|
+
var PLIST_PATH2 = join8(homedir5(), "Library", "LaunchAgents", `${LABEL2}.plist`);
|
|
2959
2990
|
function registerUninstallCommand(program2) {
|
|
2960
2991
|
program2.command("uninstall").description("Remove macOS LaunchAgent (agents will no longer auto-start)").action(async () => {
|
|
2961
2992
|
if (process.platform !== "darwin") {
|
|
2962
2993
|
log.error("LaunchAgent is macOS only.");
|
|
2963
2994
|
process.exit(1);
|
|
2964
2995
|
}
|
|
2965
|
-
if (!
|
|
2996
|
+
if (!existsSync6(PLIST_PATH2)) {
|
|
2966
2997
|
console.log(`
|
|
2967
2998
|
${YELLOW}\u2298${RESET} No LaunchAgent found at ${GRAY}${PLIST_PATH2}${RESET}
|
|
2968
2999
|
`);
|
|
@@ -3648,11 +3679,11 @@ function registerChatCommand(program2) {
|
|
|
3648
3679
|
|
|
3649
3680
|
// src/commands/skills.ts
|
|
3650
3681
|
import { readFile as readFile3, writeFile as writeFile3, readdir as readdir2, mkdir as mkdir2, rm, symlink, unlink } from "fs/promises";
|
|
3651
|
-
import { join as
|
|
3682
|
+
import { join as join10, resolve, relative as relative4 } from "path";
|
|
3652
3683
|
|
|
3653
3684
|
// src/utils/skill-parser.ts
|
|
3654
3685
|
import { readFile as readFile2, writeFile as writeFile2, stat as stat3 } from "fs/promises";
|
|
3655
|
-
import { join as
|
|
3686
|
+
import { join as join9 } from "path";
|
|
3656
3687
|
function parseSkillMd(raw) {
|
|
3657
3688
|
const trimmed = raw.trimStart();
|
|
3658
3689
|
if (!trimmed.startsWith("---")) {
|
|
@@ -3734,7 +3765,7 @@ function parseSkillMd(raw) {
|
|
|
3734
3765
|
return { frontmatter, content };
|
|
3735
3766
|
}
|
|
3736
3767
|
async function loadSkillManifest(dir) {
|
|
3737
|
-
const skillMdPath =
|
|
3768
|
+
const skillMdPath = join9(dir, "SKILL.md");
|
|
3738
3769
|
try {
|
|
3739
3770
|
const raw = await readFile2(skillMdPath, "utf-8");
|
|
3740
3771
|
const { frontmatter } = parseSkillMd(raw);
|
|
@@ -3839,13 +3870,13 @@ function skillApiPath(authorLogin, slug) {
|
|
|
3839
3870
|
}
|
|
3840
3871
|
async function resolveSkillsRootAsync(pathArg) {
|
|
3841
3872
|
const projectRoot = pathArg ? resolve(pathArg) : process.cwd();
|
|
3842
|
-
const skillsDir =
|
|
3843
|
-
const claudeSkillsDir =
|
|
3873
|
+
const skillsDir = join10(projectRoot, ".agents", "skills");
|
|
3874
|
+
const claudeSkillsDir = join10(projectRoot, ".claude", "skills");
|
|
3844
3875
|
return { projectRoot, skillsDir, claudeSkillsDir };
|
|
3845
3876
|
}
|
|
3846
3877
|
async function ensureClaudeSymlink(claudeSkillsDir, slug) {
|
|
3847
3878
|
await mkdir2(claudeSkillsDir, { recursive: true });
|
|
3848
|
-
const linkPath =
|
|
3879
|
+
const linkPath = join10(claudeSkillsDir, slug);
|
|
3849
3880
|
try {
|
|
3850
3881
|
await unlink(linkPath);
|
|
3851
3882
|
} catch {
|
|
@@ -3865,7 +3896,7 @@ async function collectPackFiles(dir, manifest) {
|
|
|
3865
3896
|
}
|
|
3866
3897
|
const mainFile = manifest.main || "SKILL.md";
|
|
3867
3898
|
if (!results.includes(mainFile)) {
|
|
3868
|
-
const mainPath =
|
|
3899
|
+
const mainPath = join10(dir, mainFile);
|
|
3869
3900
|
if (await pathExists(mainPath)) {
|
|
3870
3901
|
results.unshift(mainFile);
|
|
3871
3902
|
}
|
|
@@ -3882,7 +3913,7 @@ async function walkDir(dir) {
|
|
|
3882
3913
|
}
|
|
3883
3914
|
for (const entry of entries) {
|
|
3884
3915
|
if (entry.isSymbolicLink()) continue;
|
|
3885
|
-
const fullPath =
|
|
3916
|
+
const fullPath = join10(dir, entry.name);
|
|
3886
3917
|
if (entry.isDirectory()) {
|
|
3887
3918
|
if (SKIP_DIRS.has(entry.name) || entry.name.startsWith(".")) continue;
|
|
3888
3919
|
const sub = await walkDir(fullPath);
|
|
@@ -3900,7 +3931,7 @@ async function packSkill(dir, manifest) {
|
|
|
3900
3931
|
}
|
|
3901
3932
|
const entries = [];
|
|
3902
3933
|
for (const relPath of fileList) {
|
|
3903
|
-
const absPath =
|
|
3934
|
+
const absPath = join10(dir, relPath);
|
|
3904
3935
|
try {
|
|
3905
3936
|
const data = await readFile3(absPath);
|
|
3906
3937
|
entries.push({ path: relPath.replace(/\\/g, "/"), data });
|
|
@@ -3934,7 +3965,7 @@ function bumpVersion(current, bump) {
|
|
|
3934
3965
|
}
|
|
3935
3966
|
async function downloadAndInstallSkill(client, authorLogin, slug, skillsDir) {
|
|
3936
3967
|
const meta = await client.get(skillApiPath(authorLogin, slug));
|
|
3937
|
-
const targetDir =
|
|
3968
|
+
const targetDir = join10(skillsDir, slug);
|
|
3938
3969
|
await mkdir2(targetDir, { recursive: true });
|
|
3939
3970
|
if (meta.has_files) {
|
|
3940
3971
|
const res = await client.getRaw(`${skillApiPath(authorLogin, slug)}/download`);
|
|
@@ -3942,8 +3973,8 @@ async function downloadAndInstallSkill(client, authorLogin, slug, skillsDir) {
|
|
|
3942
3973
|
const buf = Buffer.from(arrayBuf);
|
|
3943
3974
|
const entries = extractZipBuffer(buf);
|
|
3944
3975
|
for (const entry of entries) {
|
|
3945
|
-
const filePath =
|
|
3946
|
-
const dir =
|
|
3976
|
+
const filePath = join10(targetDir, entry.path);
|
|
3977
|
+
const dir = join10(filePath, "..");
|
|
3947
3978
|
await mkdir2(dir, { recursive: true });
|
|
3948
3979
|
await writeFile3(filePath, entry.data);
|
|
3949
3980
|
}
|
|
@@ -3956,7 +3987,7 @@ async function downloadAndInstallSkill(client, authorLogin, slug, skillsDir) {
|
|
|
3956
3987
|
} else {
|
|
3957
3988
|
const res = await client.getRaw(`${skillApiPath(authorLogin, slug)}/raw`);
|
|
3958
3989
|
const content = await res.text();
|
|
3959
|
-
await writeFile3(
|
|
3990
|
+
await writeFile3(join10(targetDir, "SKILL.md"), content);
|
|
3960
3991
|
return {
|
|
3961
3992
|
slug,
|
|
3962
3993
|
name: meta.name,
|
|
@@ -3985,7 +4016,7 @@ function registerSkillsCommand(program2) {
|
|
|
3985
4016
|
try {
|
|
3986
4017
|
const dir = resolveSkillDir(pathArg);
|
|
3987
4018
|
await mkdir2(dir, { recursive: true });
|
|
3988
|
-
const skillMdPath =
|
|
4019
|
+
const skillMdPath = join10(dir, "SKILL.md");
|
|
3989
4020
|
if (await pathExists(skillMdPath)) {
|
|
3990
4021
|
const raw = await readFile3(skillMdPath, "utf-8");
|
|
3991
4022
|
const { frontmatter } = parseSkillMd(raw);
|
|
@@ -4014,7 +4045,7 @@ function registerSkillsCommand(program2) {
|
|
|
4014
4045
|
const dir = resolveSkillDir(pathArg);
|
|
4015
4046
|
const manifest = await loadSkillManifest(dir);
|
|
4016
4047
|
const result = await packSkill(dir, manifest);
|
|
4017
|
-
const outPath =
|
|
4048
|
+
const outPath = join10(dir, result.filename);
|
|
4018
4049
|
await writeFile3(outPath, result.buffer);
|
|
4019
4050
|
slog.info(`Packed ${result.files.length} files \u2192 ${result.filename} (${result.size} bytes)`);
|
|
4020
4051
|
outputJson({
|
|
@@ -4060,7 +4091,7 @@ function registerSkillsCommand(program2) {
|
|
|
4060
4091
|
if (opts.name) manifest.name = opts.name;
|
|
4061
4092
|
if (opts.version) manifest.version = opts.version;
|
|
4062
4093
|
if (opts.private !== void 0) manifest.private = opts.private;
|
|
4063
|
-
content = await readFile3(
|
|
4094
|
+
content = await readFile3(join10(dir, manifest.main || "SKILL.md"), "utf-8");
|
|
4064
4095
|
packResult = await packSkill(dir, manifest);
|
|
4065
4096
|
slog.info(`Packed ${packResult.files.length} files (${packResult.size} bytes)`);
|
|
4066
4097
|
}
|
|
@@ -4197,7 +4228,7 @@ function registerSkillsCommand(program2) {
|
|
|
4197
4228
|
skills.command("version <bump> [path]").description("Bump skill version (patch | minor | major | x.y.z)").action(async (bump, pathArg) => {
|
|
4198
4229
|
try {
|
|
4199
4230
|
const dir = resolveSkillDir(pathArg);
|
|
4200
|
-
const skillMdPath =
|
|
4231
|
+
const skillMdPath = join10(dir, "SKILL.md");
|
|
4201
4232
|
if (!await pathExists(skillMdPath)) {
|
|
4202
4233
|
outputError("not_found", "No SKILL.md found. Run `agent-mesh skills init` first.");
|
|
4203
4234
|
}
|
|
@@ -4217,7 +4248,7 @@ function registerSkillsCommand(program2) {
|
|
|
4217
4248
|
try {
|
|
4218
4249
|
const { authorLogin, slug } = parseSkillRef(ref);
|
|
4219
4250
|
const { skillsDir, claudeSkillsDir } = await resolveSkillsRootAsync(pathArg);
|
|
4220
|
-
const targetDir =
|
|
4251
|
+
const targetDir = join10(skillsDir, slug);
|
|
4221
4252
|
if (await pathExists(targetDir)) {
|
|
4222
4253
|
if (!opts.force) {
|
|
4223
4254
|
outputError("already_installed", `Skill "${slug}" is already installed at ${targetDir}. Use --force to overwrite.`);
|
|
@@ -4256,11 +4287,11 @@ function registerSkillsCommand(program2) {
|
|
|
4256
4287
|
const failed = [];
|
|
4257
4288
|
if (ref) {
|
|
4258
4289
|
const { authorLogin, slug } = parseSkillRef(ref);
|
|
4259
|
-
const targetDir =
|
|
4290
|
+
const targetDir = join10(skillsDir, slug);
|
|
4260
4291
|
if (!await pathExists(targetDir)) {
|
|
4261
4292
|
outputError("not_installed", `Skill "${slug}" is not installed. Use "skills install ${ref}" first.`);
|
|
4262
4293
|
}
|
|
4263
|
-
const skillMdPath =
|
|
4294
|
+
const skillMdPath = join10(targetDir, "SKILL.md");
|
|
4264
4295
|
let localVersion = "0.0.0";
|
|
4265
4296
|
if (await pathExists(skillMdPath)) {
|
|
4266
4297
|
const raw = await readFile3(skillMdPath, "utf-8");
|
|
@@ -4287,7 +4318,7 @@ function registerSkillsCommand(program2) {
|
|
|
4287
4318
|
for (const entry of entries) {
|
|
4288
4319
|
if (!entry.isDirectory()) continue;
|
|
4289
4320
|
const slug = entry.name;
|
|
4290
|
-
const skillMdPath =
|
|
4321
|
+
const skillMdPath = join10(skillsDir, slug, "SKILL.md");
|
|
4291
4322
|
if (!await pathExists(skillMdPath)) {
|
|
4292
4323
|
skipped.push({ slug, reason: "no_skill_md" });
|
|
4293
4324
|
continue;
|
|
@@ -4307,7 +4338,7 @@ function registerSkillsCommand(program2) {
|
|
|
4307
4338
|
skipped.push({ slug, reason: "up_to_date" });
|
|
4308
4339
|
} else {
|
|
4309
4340
|
slog.info(`Updating ${slug}: v${localVersion} \u2192 v${remoteVersion}...`);
|
|
4310
|
-
await rm(
|
|
4341
|
+
await rm(join10(skillsDir, slug), { recursive: true, force: true });
|
|
4311
4342
|
await downloadAndInstallSkill(client, authorLogin, slug, skillsDir);
|
|
4312
4343
|
updated.push({ slug, name: remote.name, old_version: localVersion, new_version: remoteVersion });
|
|
4313
4344
|
}
|
|
@@ -4328,13 +4359,13 @@ function registerSkillsCommand(program2) {
|
|
|
4328
4359
|
skills.command("remove <slug> [path]").description("Remove a locally installed skill").action(async (slug, pathArg) => {
|
|
4329
4360
|
try {
|
|
4330
4361
|
const { skillsDir, claudeSkillsDir } = await resolveSkillsRootAsync(pathArg);
|
|
4331
|
-
const targetDir =
|
|
4362
|
+
const targetDir = join10(skillsDir, slug);
|
|
4332
4363
|
if (!await pathExists(targetDir)) {
|
|
4333
4364
|
outputError("not_installed", `Skill "${slug}" is not installed at ${targetDir}`);
|
|
4334
4365
|
}
|
|
4335
4366
|
await rm(targetDir, { recursive: true, force: true });
|
|
4336
4367
|
try {
|
|
4337
|
-
await unlink(
|
|
4368
|
+
await unlink(join10(claudeSkillsDir, slug));
|
|
4338
4369
|
} catch {
|
|
4339
4370
|
}
|
|
4340
4371
|
slog.success(`Removed skill: ${slug}`);
|
|
@@ -4359,7 +4390,7 @@ function registerSkillsCommand(program2) {
|
|
|
4359
4390
|
for (const entry of entries) {
|
|
4360
4391
|
if (!entry.isDirectory()) continue;
|
|
4361
4392
|
const slug = entry.name;
|
|
4362
|
-
const skillMdPath =
|
|
4393
|
+
const skillMdPath = join10(skillsDir, slug, "SKILL.md");
|
|
4363
4394
|
if (!await pathExists(skillMdPath)) continue;
|
|
4364
4395
|
const raw = await readFile3(skillMdPath, "utf-8");
|
|
4365
4396
|
const { frontmatter } = parseSkillMd(raw);
|
|
@@ -5456,7 +5487,7 @@ function maybeAutoUpgradeOnStartup(opts) {
|
|
|
5456
5487
|
}
|
|
5457
5488
|
|
|
5458
5489
|
// src/index.ts
|
|
5459
|
-
var require2 =
|
|
5490
|
+
var require2 = createRequire2(import.meta.url);
|
|
5460
5491
|
var { version } = require2("../package.json");
|
|
5461
5492
|
var autoUpgrade = maybeAutoUpgradeOnStartup({ currentVersion: version });
|
|
5462
5493
|
if (autoUpgrade.relaunched) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@annals/agent-mesh",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.2",
|
|
4
4
|
"description": "CLI bridge connecting local AI agents to the Agents.Hot platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"typescript": "^5.7.0"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
|
-
"dist"
|
|
22
|
+
"dist",
|
|
23
|
+
"prebuilds"
|
|
23
24
|
],
|
|
24
25
|
"license": "MIT",
|
|
25
26
|
"repository": {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|