@deeplake/hivemind 0.7.29 → 0.7.31

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/bundle/cli.js CHANGED
@@ -17,21 +17,21 @@ __export(index_marker_store_exports, {
17
17
  hasFreshIndexMarker: () => hasFreshIndexMarker,
18
18
  writeIndexMarker: () => writeIndexMarker
19
19
  });
20
- import { existsSync as existsSync12, mkdirSync as mkdirSync3, readFileSync as readFileSync9, writeFileSync as writeFileSync6 } from "node:fs";
21
- import { join as join15 } from "node:path";
20
+ import { existsSync as existsSync13, mkdirSync as mkdirSync3, readFileSync as readFileSync10, writeFileSync as writeFileSync7 } from "node:fs";
21
+ import { join as join16 } from "node:path";
22
22
  import { tmpdir } from "node:os";
23
23
  function getIndexMarkerDir() {
24
- return process.env.HIVEMIND_INDEX_MARKER_DIR ?? join15(tmpdir(), "hivemind-deeplake-indexes");
24
+ return process.env.HIVEMIND_INDEX_MARKER_DIR ?? join16(tmpdir(), "hivemind-deeplake-indexes");
25
25
  }
26
26
  function buildIndexMarkerPath(workspaceId, orgId, table, suffix) {
27
27
  const markerKey = [workspaceId, orgId, table, suffix].join("__").replace(/[^a-zA-Z0-9_.-]/g, "_");
28
- return join15(getIndexMarkerDir(), `${markerKey}.json`);
28
+ return join16(getIndexMarkerDir(), `${markerKey}.json`);
29
29
  }
30
30
  function hasFreshIndexMarker(markerPath) {
31
- if (!existsSync12(markerPath))
31
+ if (!existsSync13(markerPath))
32
32
  return false;
33
33
  try {
34
- const raw = JSON.parse(readFileSync9(markerPath, "utf-8"));
34
+ const raw = JSON.parse(readFileSync10(markerPath, "utf-8"));
35
35
  const updatedAt = raw.updatedAt ? new Date(raw.updatedAt).getTime() : NaN;
36
36
  if (!Number.isFinite(updatedAt) || Date.now() - updatedAt > INDEX_MARKER_TTL_MS)
37
37
  return false;
@@ -42,7 +42,7 @@ function hasFreshIndexMarker(markerPath) {
42
42
  }
43
43
  function writeIndexMarker(markerPath) {
44
44
  mkdirSync3(getIndexMarkerDir(), { recursive: true });
45
- writeFileSync6(markerPath, JSON.stringify({ updatedAt: (/* @__PURE__ */ new Date()).toISOString() }), "utf-8");
45
+ writeFileSync7(markerPath, JSON.stringify({ updatedAt: (/* @__PURE__ */ new Date()).toISOString() }), "utf-8");
46
46
  }
47
47
  var INDEX_MARKER_TTL_MS;
48
48
  var init_index_marker_store = __esm({
@@ -488,31 +488,139 @@ function uninstallCodex() {
488
488
  }
489
489
 
490
490
  // dist/src/cli/install-openclaw.js
491
- import { existsSync as existsSync4, copyFileSync, rmSync } from "node:fs";
491
+ import { existsSync as existsSync5, copyFileSync, rmSync } from "node:fs";
492
+ import { join as join6 } from "node:path";
493
+
494
+ // dist/openclaw/src/setup-config.js
495
+ import { existsSync as existsSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync3, renameSync } from "node:fs";
496
+ import { homedir as homedir3 } from "node:os";
492
497
  import { join as join5 } from "node:path";
493
- var PLUGIN_DIR2 = join5(HOME, ".openclaw", "extensions", "hivemind");
498
+ var HIVEMIND_TOOL_NAMES = ["hivemind_search", "hivemind_read", "hivemind_index"];
499
+ function getOpenclawConfigPath() {
500
+ return join5(homedir3(), ".openclaw", "openclaw.json");
501
+ }
502
+ function isAllowlistCoveringHivemind(alsoAllow) {
503
+ if (!Array.isArray(alsoAllow))
504
+ return false;
505
+ for (const entry of alsoAllow) {
506
+ if (typeof entry !== "string")
507
+ continue;
508
+ const normalized = entry.trim().toLowerCase();
509
+ if (normalized === "hivemind")
510
+ return true;
511
+ if (normalized === "group:plugins")
512
+ return true;
513
+ if (HIVEMIND_TOOL_NAMES.includes(normalized))
514
+ return true;
515
+ }
516
+ return false;
517
+ }
518
+ function isPluginsAllowMissingHivemind(allow) {
519
+ return Array.isArray(allow) && allow.length > 0 && !allow.includes("hivemind");
520
+ }
521
+ function ensureHivemindAllowlisted() {
522
+ const configPath = getOpenclawConfigPath();
523
+ if (!existsSync4(configPath)) {
524
+ return { status: "error", configPath, error: "openclaw config file not found" };
525
+ }
526
+ let parsed;
527
+ try {
528
+ const raw = readFileSync5(configPath, "utf-8");
529
+ parsed = JSON.parse(raw);
530
+ } catch (e) {
531
+ return { status: "error", configPath, error: `could not read/parse config: ${e instanceof Error ? e.message : String(e)}` };
532
+ }
533
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
534
+ return { status: "error", configPath, error: "openclaw config is not a JSON object" };
535
+ }
536
+ const plugins = parsed.plugins ?? {};
537
+ const pluginsAllowRaw = plugins.allow;
538
+ const tools = parsed.tools ?? {};
539
+ const alsoAllowRaw = tools.alsoAllow;
540
+ const pluginsAllowNeedsPatch = isPluginsAllowMissingHivemind(pluginsAllowRaw);
541
+ const toolsAlsoAllowNeedsPatch = Array.isArray(alsoAllowRaw) && alsoAllowRaw.length > 0 && !isAllowlistCoveringHivemind(alsoAllowRaw);
542
+ if (!pluginsAllowNeedsPatch && !toolsAlsoAllowNeedsPatch) {
543
+ return { status: "already-set", configPath };
544
+ }
545
+ const updated = { ...parsed };
546
+ if (pluginsAllowNeedsPatch) {
547
+ updated.plugins = {
548
+ ...plugins,
549
+ // Cast safe — isPluginsAllowMissingHivemind guarantees Array.
550
+ allow: [...pluginsAllowRaw, "hivemind"]
551
+ };
552
+ }
553
+ if (toolsAlsoAllowNeedsPatch) {
554
+ updated.tools = {
555
+ ...tools,
556
+ // Cast safe — the needs-patch check above guarantees Array.
557
+ alsoAllow: [...alsoAllowRaw, "hivemind"]
558
+ };
559
+ }
560
+ const backupPath = `${configPath}.bak-hivemind-${Date.now()}`;
561
+ const tmpPath = `${configPath}.tmp-hivemind-${process.pid}`;
562
+ try {
563
+ writeFileSync3(backupPath, readFileSync5(configPath, "utf-8"));
564
+ writeFileSync3(tmpPath, JSON.stringify(updated, null, 2) + "\n");
565
+ renameSync(tmpPath, configPath);
566
+ } catch (e) {
567
+ return { status: "error", configPath, error: `could not write config: ${e instanceof Error ? e.message : String(e)}` };
568
+ }
569
+ return {
570
+ status: "added",
571
+ configPath,
572
+ backupPath,
573
+ delta: {
574
+ pluginsAllow: pluginsAllowNeedsPatch,
575
+ toolsAlsoAllow: toolsAlsoAllowNeedsPatch
576
+ }
577
+ };
578
+ }
579
+
580
+ // dist/src/cli/install-openclaw.js
581
+ var PLUGIN_DIR2 = join6(HOME, ".openclaw", "extensions", "hivemind");
494
582
  function installOpenclaw() {
495
- const srcDist = join5(pkgRoot(), "openclaw", "dist");
496
- const srcManifest = join5(pkgRoot(), "openclaw", "openclaw.plugin.json");
497
- const srcPkg = join5(pkgRoot(), "openclaw", "package.json");
498
- const srcSkills = join5(pkgRoot(), "openclaw", "skills");
499
- if (!existsSync4(srcDist)) {
583
+ const srcDist = join6(pkgRoot(), "openclaw", "dist");
584
+ const srcManifest = join6(pkgRoot(), "openclaw", "openclaw.plugin.json");
585
+ const srcPkg = join6(pkgRoot(), "openclaw", "package.json");
586
+ const srcSkills = join6(pkgRoot(), "openclaw", "skills");
587
+ if (!existsSync5(srcDist)) {
500
588
  throw new Error(`OpenClaw bundle missing at ${srcDist}. Run 'npm run build' first.`);
501
589
  }
502
590
  ensureDir(PLUGIN_DIR2);
503
- rmSync(join5(PLUGIN_DIR2, "dist"), { recursive: true, force: true });
504
- copyDir(srcDist, join5(PLUGIN_DIR2, "dist"));
505
- if (existsSync4(srcManifest))
506
- copyFileSync(srcManifest, join5(PLUGIN_DIR2, "openclaw.plugin.json"));
507
- if (existsSync4(srcPkg))
508
- copyFileSync(srcPkg, join5(PLUGIN_DIR2, "package.json"));
509
- if (existsSync4(srcSkills))
510
- copyDir(srcSkills, join5(PLUGIN_DIR2, "skills"));
591
+ rmSync(join6(PLUGIN_DIR2, "dist"), { recursive: true, force: true });
592
+ copyDir(srcDist, join6(PLUGIN_DIR2, "dist"));
593
+ if (existsSync5(srcManifest))
594
+ copyFileSync(srcManifest, join6(PLUGIN_DIR2, "openclaw.plugin.json"));
595
+ if (existsSync5(srcPkg))
596
+ copyFileSync(srcPkg, join6(PLUGIN_DIR2, "package.json"));
597
+ if (existsSync5(srcSkills))
598
+ copyDir(srcSkills, join6(PLUGIN_DIR2, "skills"));
511
599
  writeVersionStamp(PLUGIN_DIR2, getVersion());
512
600
  log(` OpenClaw installed -> ${PLUGIN_DIR2}`);
601
+ const result = ensureHivemindAllowlisted();
602
+ if (result.status === "added") {
603
+ const touched = [];
604
+ if (result.delta.pluginsAllow)
605
+ touched.push("plugins.allow");
606
+ if (result.delta.toolsAlsoAllow)
607
+ touched.push("tools.alsoAllow");
608
+ log(` OpenClaw patched ${touched.join(" + ")} in ${result.configPath}`);
609
+ log(` OpenClaw backup: ${result.backupPath}`);
610
+ log(` OpenClaw restart the gateway to activate: systemctl --user restart openclaw-gateway.service`);
611
+ log(` OpenClaw capture starts on the NEXT turn \u2014 earlier turns are NOT backfilled`);
612
+ } else if (result.status === "already-set") {
613
+ log(` OpenClaw allowlist already covers hivemind in ${result.configPath}`);
614
+ } else if (result.status === "error") {
615
+ if (result.error === "openclaw config file not found") {
616
+ log(` OpenClaw openclaw.json not present at ${result.configPath} \u2014 run openclaw once, then \`hivemind claw install\` again`);
617
+ } else {
618
+ warn(` OpenClaw could not patch allowlist in ${result.configPath}: ${result.error}`);
619
+ }
620
+ }
513
621
  }
514
622
  function uninstallOpenclaw() {
515
- if (existsSync4(PLUGIN_DIR2)) {
623
+ if (existsSync5(PLUGIN_DIR2)) {
516
624
  rmSync(PLUGIN_DIR2, { recursive: true, force: true });
517
625
  log(` OpenClaw removed ${PLUGIN_DIR2}`);
518
626
  } else {
@@ -521,23 +629,23 @@ function uninstallOpenclaw() {
521
629
  }
522
630
 
523
631
  // dist/src/cli/install-cursor.js
524
- import { existsSync as existsSync5, unlinkSync as unlinkSync3 } from "node:fs";
525
- import { join as join6 } from "node:path";
526
- var CURSOR_HOME = join6(HOME, ".cursor");
527
- var PLUGIN_DIR3 = join6(CURSOR_HOME, "hivemind");
528
- var HOOKS_PATH2 = join6(CURSOR_HOME, "hooks.json");
632
+ import { existsSync as existsSync6, unlinkSync as unlinkSync3 } from "node:fs";
633
+ import { join as join7 } from "node:path";
634
+ var CURSOR_HOME = join7(HOME, ".cursor");
635
+ var PLUGIN_DIR3 = join7(CURSOR_HOME, "hivemind");
636
+ var HOOKS_PATH2 = join7(CURSOR_HOME, "hooks.json");
529
637
  var HIVEMIND_MARKER_KEY = "_hivemindManaged";
530
638
  function buildHookCmd(bundleFile, timeout) {
531
639
  return {
532
640
  type: "command",
533
- command: `node "${join6(PLUGIN_DIR3, "bundle", bundleFile)}"`,
641
+ command: `node "${join7(PLUGIN_DIR3, "bundle", bundleFile)}"`,
534
642
  timeout
535
643
  };
536
644
  }
537
645
  function buildHookCmdShellMatcher(bundleFile, timeout) {
538
646
  return {
539
647
  type: "command",
540
- command: `node "${join6(PLUGIN_DIR3, "bundle", bundleFile)}"`,
648
+ command: `node "${join7(PLUGIN_DIR3, "bundle", bundleFile)}"`,
541
649
  timeout,
542
650
  matcher: "Shell"
543
651
  };
@@ -593,12 +701,12 @@ function stripHooksFromConfig(existing) {
593
701
  return existing;
594
702
  }
595
703
  function installCursor() {
596
- const srcBundle = join6(pkgRoot(), "cursor", "bundle");
597
- if (!existsSync5(srcBundle)) {
704
+ const srcBundle = join7(pkgRoot(), "cursor", "bundle");
705
+ if (!existsSync6(srcBundle)) {
598
706
  throw new Error(`Cursor bundle missing at ${srcBundle}. Run 'npm run build' first.`);
599
707
  }
600
708
  ensureDir(PLUGIN_DIR3);
601
- copyDir(srcBundle, join6(PLUGIN_DIR3, "bundle"));
709
+ copyDir(srcBundle, join7(PLUGIN_DIR3, "bundle"));
602
710
  const existing = readJson(HOOKS_PATH2);
603
711
  const merged = mergeHooks2(existing);
604
712
  writeJson(HOOKS_PATH2, merged);
@@ -614,7 +722,7 @@ function uninstallCursor() {
614
722
  const stripped = stripHooksFromConfig(existing);
615
723
  const meaningfulKeys = stripped ? Object.keys(stripped).filter((k) => k !== "version").length : 0;
616
724
  if (!stripped || meaningfulKeys === 0) {
617
- if (existsSync5(HOOKS_PATH2))
725
+ if (existsSync6(HOOKS_PATH2))
618
726
  unlinkSync3(HOOKS_PATH2);
619
727
  } else {
620
728
  writeJson(HOOKS_PATH2, stripped);
@@ -623,8 +731,8 @@ function uninstallCursor() {
623
731
  }
624
732
 
625
733
  // dist/src/cli/install-hermes.js
626
- import { existsSync as existsSync7, writeFileSync as writeFileSync3, readFileSync as readFileSync5, rmSync as rmSync2, unlinkSync as unlinkSync4 } from "node:fs";
627
- import { join as join8 } from "node:path";
734
+ import { existsSync as existsSync8, writeFileSync as writeFileSync4, readFileSync as readFileSync6, rmSync as rmSync2, unlinkSync as unlinkSync4 } from "node:fs";
735
+ import { join as join9 } from "node:path";
628
736
 
629
737
  // node_modules/js-yaml/dist/js-yaml.mjs
630
738
  function isNothing(subject) {
@@ -3213,15 +3321,15 @@ var safeLoadAll = renamed("safeLoadAll", "loadAll");
3213
3321
  var safeDump = renamed("safeDump", "dump");
3214
3322
 
3215
3323
  // dist/src/cli/install-mcp-shared.js
3216
- import { existsSync as existsSync6 } from "node:fs";
3217
- import { join as join7 } from "node:path";
3218
- var HIVEMIND_DIR = join7(HOME, ".hivemind");
3219
- var MCP_DIR = join7(HIVEMIND_DIR, "mcp");
3220
- var MCP_SERVER_PATH = join7(MCP_DIR, "server.js");
3221
- var MCP_PACKAGE_JSON = join7(MCP_DIR, "package.json");
3324
+ import { existsSync as existsSync7 } from "node:fs";
3325
+ import { join as join8 } from "node:path";
3326
+ var HIVEMIND_DIR = join8(HOME, ".hivemind");
3327
+ var MCP_DIR = join8(HIVEMIND_DIR, "mcp");
3328
+ var MCP_SERVER_PATH = join8(MCP_DIR, "server.js");
3329
+ var MCP_PACKAGE_JSON = join8(MCP_DIR, "package.json");
3222
3330
  function ensureMcpServerInstalled() {
3223
- const srcDir = join7(pkgRoot(), "mcp", "bundle");
3224
- if (!existsSync6(srcDir)) {
3331
+ const srcDir = join8(pkgRoot(), "mcp", "bundle");
3332
+ if (!existsSync7(srcDir)) {
3225
3333
  throw new Error(`MCP server bundle missing at ${srcDir}. Run 'npm run build' to produce it before installing Tier B consumers.`);
3226
3334
  }
3227
3335
  ensureDir(MCP_DIR);
@@ -3231,11 +3339,11 @@ function ensureMcpServerInstalled() {
3231
3339
  }
3232
3340
 
3233
3341
  // dist/src/cli/install-hermes.js
3234
- var HERMES_HOME = join8(HOME, ".hermes");
3235
- var SKILLS_DIR = join8(HERMES_HOME, "skills", "hivemind-memory");
3236
- var HIVEMIND_DIR2 = join8(HERMES_HOME, "hivemind");
3237
- var BUNDLE_DIR = join8(HIVEMIND_DIR2, "bundle");
3238
- var CONFIG_PATH = join8(HERMES_HOME, "config.yaml");
3342
+ var HERMES_HOME = join9(HOME, ".hermes");
3343
+ var SKILLS_DIR = join9(HERMES_HOME, "skills", "hivemind-memory");
3344
+ var HIVEMIND_DIR2 = join9(HERMES_HOME, "hivemind");
3345
+ var BUNDLE_DIR = join9(HIVEMIND_DIR2, "bundle");
3346
+ var CONFIG_PATH = join9(HERMES_HOME, "config.yaml");
3239
3347
  var SERVER_KEY = "hivemind";
3240
3348
  var SKILL_BODY = `---
3241
3349
  name: hivemind-memory
@@ -3293,7 +3401,7 @@ function isHivemindHook(entry) {
3293
3401
  }
3294
3402
  function buildHookEntry(bundleFile, timeout, matcher) {
3295
3403
  const entry = {
3296
- command: `node ${join8(BUNDLE_DIR, bundleFile)}`,
3404
+ command: `node ${join9(BUNDLE_DIR, bundleFile)}`,
3297
3405
  timeout
3298
3406
  };
3299
3407
  if (matcher)
@@ -3337,10 +3445,10 @@ function stripHivemindHooks(existing) {
3337
3445
  return Object.keys(out).length > 0 ? out : void 0;
3338
3446
  }
3339
3447
  function readConfig() {
3340
- if (!existsSync7(CONFIG_PATH))
3448
+ if (!existsSync8(CONFIG_PATH))
3341
3449
  return {};
3342
3450
  try {
3343
- const raw = readFileSync5(CONFIG_PATH, "utf-8");
3451
+ const raw = readFileSync6(CONFIG_PATH, "utf-8");
3344
3452
  const parsed = load(raw);
3345
3453
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
3346
3454
  return parsed;
@@ -3353,15 +3461,15 @@ function readConfig() {
3353
3461
  function writeConfig(cfg) {
3354
3462
  ensureDir(HERMES_HOME);
3355
3463
  const dumped = dump(cfg, { lineWidth: 100, noRefs: true });
3356
- writeFileSync3(CONFIG_PATH, dumped);
3464
+ writeFileSync4(CONFIG_PATH, dumped);
3357
3465
  }
3358
3466
  function installHermes() {
3359
3467
  ensureDir(SKILLS_DIR);
3360
- writeFileSync3(join8(SKILLS_DIR, "SKILL.md"), SKILL_BODY);
3468
+ writeFileSync4(join9(SKILLS_DIR, "SKILL.md"), SKILL_BODY);
3361
3469
  writeVersionStamp(SKILLS_DIR, getVersion());
3362
3470
  log(` Hermes skill installed -> ${SKILLS_DIR}`);
3363
- const srcBundle = join8(pkgRoot(), "hermes", "bundle");
3364
- if (!existsSync7(srcBundle)) {
3471
+ const srcBundle = join9(pkgRoot(), "hermes", "bundle");
3472
+ if (!existsSync8(srcBundle)) {
3365
3473
  throw new Error(`Hermes bundle missing at ${srcBundle}. Run 'npm run build' first.`);
3366
3474
  }
3367
3475
  ensureDir(HIVEMIND_DIR2);
@@ -3382,15 +3490,15 @@ function installHermes() {
3382
3490
  log(` Hermes config updated -> ${CONFIG_PATH} (mcp_servers + hooks + hooks_auto_accept)`);
3383
3491
  }
3384
3492
  function uninstallHermes() {
3385
- if (existsSync7(SKILLS_DIR)) {
3493
+ if (existsSync8(SKILLS_DIR)) {
3386
3494
  rmSync2(SKILLS_DIR, { recursive: true, force: true });
3387
3495
  log(` Hermes removed ${SKILLS_DIR}`);
3388
3496
  }
3389
- if (existsSync7(HIVEMIND_DIR2)) {
3497
+ if (existsSync8(HIVEMIND_DIR2)) {
3390
3498
  rmSync2(HIVEMIND_DIR2, { recursive: true, force: true });
3391
3499
  log(` Hermes removed ${HIVEMIND_DIR2}`);
3392
3500
  }
3393
- if (existsSync7(CONFIG_PATH)) {
3501
+ if (existsSync8(CONFIG_PATH)) {
3394
3502
  const cfg = readConfig();
3395
3503
  let touched = false;
3396
3504
  if (cfg.mcp_servers && typeof cfg.mcp_servers === "object" && SERVER_KEY in cfg.mcp_servers) {
@@ -3423,18 +3531,18 @@ function uninstallHermes() {
3423
3531
  }
3424
3532
 
3425
3533
  // dist/src/cli/install-pi.js
3426
- import { existsSync as existsSync8, writeFileSync as writeFileSync4, rmSync as rmSync3, readFileSync as readFileSync6, copyFileSync as copyFileSync2 } from "node:fs";
3427
- import { join as join9 } from "node:path";
3428
- var PI_AGENT_DIR = join9(HOME, ".pi", "agent");
3429
- var AGENTS_MD = join9(PI_AGENT_DIR, "AGENTS.md");
3430
- var LEGACY_SKILL_DIR = join9(PI_AGENT_DIR, "skills", "hivemind-memory");
3431
- var EXTENSIONS_DIR = join9(PI_AGENT_DIR, "extensions");
3432
- var EXTENSION_PATH = join9(EXTENSIONS_DIR, "hivemind.ts");
3433
- var VERSION_DIR = join9(PI_AGENT_DIR, ".hivemind");
3434
- var WIKI_WORKER_DIR = join9(PI_AGENT_DIR, "hivemind");
3435
- var WIKI_WORKER_PATH = join9(WIKI_WORKER_DIR, "wiki-worker.js");
3436
- var SKILLIFY_WORKER_PATH = join9(WIKI_WORKER_DIR, "skillify-worker.js");
3437
- var AUTOPULL_WORKER_PATH = join9(WIKI_WORKER_DIR, "autopull-worker.js");
3534
+ import { existsSync as existsSync9, writeFileSync as writeFileSync5, rmSync as rmSync3, readFileSync as readFileSync7, copyFileSync as copyFileSync2 } from "node:fs";
3535
+ import { join as join10 } from "node:path";
3536
+ var PI_AGENT_DIR = join10(HOME, ".pi", "agent");
3537
+ var AGENTS_MD = join10(PI_AGENT_DIR, "AGENTS.md");
3538
+ var LEGACY_SKILL_DIR = join10(PI_AGENT_DIR, "skills", "hivemind-memory");
3539
+ var EXTENSIONS_DIR = join10(PI_AGENT_DIR, "extensions");
3540
+ var EXTENSION_PATH = join10(EXTENSIONS_DIR, "hivemind.ts");
3541
+ var VERSION_DIR = join10(PI_AGENT_DIR, ".hivemind");
3542
+ var WIKI_WORKER_DIR = join10(PI_AGENT_DIR, "hivemind");
3543
+ var WIKI_WORKER_PATH = join10(WIKI_WORKER_DIR, "wiki-worker.js");
3544
+ var SKILLIFY_WORKER_PATH = join10(WIKI_WORKER_DIR, "skillify-worker.js");
3545
+ var AUTOPULL_WORKER_PATH = join10(WIKI_WORKER_DIR, "autopull-worker.js");
3438
3546
  var HIVEMIND_BLOCK_START = "<!-- BEGIN hivemind-memory -->";
3439
3547
  var HIVEMIND_BLOCK_END = "<!-- END hivemind-memory -->";
3440
3548
  var HIVEMIND_BLOCK_BODY = `${HIVEMIND_BLOCK_START}
@@ -3502,30 +3610,30 @@ ${after}`;
3502
3610
  }
3503
3611
  function installPi() {
3504
3612
  ensureDir(PI_AGENT_DIR);
3505
- if (existsSync8(LEGACY_SKILL_DIR)) {
3613
+ if (existsSync9(LEGACY_SKILL_DIR)) {
3506
3614
  rmSync3(LEGACY_SKILL_DIR, { recursive: true, force: true });
3507
3615
  }
3508
- const prior = existsSync8(AGENTS_MD) ? readFileSync6(AGENTS_MD, "utf-8") : null;
3616
+ const prior = existsSync9(AGENTS_MD) ? readFileSync7(AGENTS_MD, "utf-8") : null;
3509
3617
  const next = upsertHivemindBlock(prior);
3510
- writeFileSync4(AGENTS_MD, next);
3511
- const srcExtension = join9(pkgRoot(), "pi", "extension-source", "hivemind.ts");
3512
- if (!existsSync8(srcExtension)) {
3618
+ writeFileSync5(AGENTS_MD, next);
3619
+ const srcExtension = join10(pkgRoot(), "pi", "extension-source", "hivemind.ts");
3620
+ if (!existsSync9(srcExtension)) {
3513
3621
  throw new Error(`pi extension source missing at ${srcExtension}. Reinstall the @deeplake/hivemind package.`);
3514
3622
  }
3515
3623
  ensureDir(EXTENSIONS_DIR);
3516
3624
  copyFileSync2(srcExtension, EXTENSION_PATH);
3517
- const srcWorker = join9(pkgRoot(), "pi", "bundle", "wiki-worker.js");
3518
- if (existsSync8(srcWorker)) {
3625
+ const srcWorker = join10(pkgRoot(), "pi", "bundle", "wiki-worker.js");
3626
+ if (existsSync9(srcWorker)) {
3519
3627
  ensureDir(WIKI_WORKER_DIR);
3520
3628
  copyFileSync2(srcWorker, WIKI_WORKER_PATH);
3521
3629
  }
3522
- const srcSkillifyWorker = join9(pkgRoot(), "pi", "bundle", "skillify-worker.js");
3523
- if (existsSync8(srcSkillifyWorker)) {
3630
+ const srcSkillifyWorker = join10(pkgRoot(), "pi", "bundle", "skillify-worker.js");
3631
+ if (existsSync9(srcSkillifyWorker)) {
3524
3632
  ensureDir(WIKI_WORKER_DIR);
3525
3633
  copyFileSync2(srcSkillifyWorker, SKILLIFY_WORKER_PATH);
3526
3634
  }
3527
- const srcAutopullWorker = join9(pkgRoot(), "pi", "bundle", "autopull-worker.js");
3528
- if (existsSync8(srcAutopullWorker)) {
3635
+ const srcAutopullWorker = join10(pkgRoot(), "pi", "bundle", "autopull-worker.js");
3636
+ if (existsSync9(srcAutopullWorker)) {
3529
3637
  ensureDir(WIKI_WORKER_DIR);
3530
3638
  copyFileSync2(srcAutopullWorker, AUTOPULL_WORKER_PATH);
3531
3639
  }
@@ -3533,82 +3641,82 @@ function installPi() {
3533
3641
  writeVersionStamp(VERSION_DIR, getVersion());
3534
3642
  log(` pi AGENTS.md updated -> ${AGENTS_MD}`);
3535
3643
  log(` pi extension installed -> ${EXTENSION_PATH}`);
3536
- if (existsSync8(WIKI_WORKER_PATH)) {
3644
+ if (existsSync9(WIKI_WORKER_PATH)) {
3537
3645
  log(` pi wiki-worker installed -> ${WIKI_WORKER_PATH}`);
3538
3646
  }
3539
- if (existsSync8(SKILLIFY_WORKER_PATH)) {
3647
+ if (existsSync9(SKILLIFY_WORKER_PATH)) {
3540
3648
  log(` pi skillify-worker installed -> ${SKILLIFY_WORKER_PATH}`);
3541
3649
  }
3542
- if (existsSync8(AUTOPULL_WORKER_PATH)) {
3650
+ if (existsSync9(AUTOPULL_WORKER_PATH)) {
3543
3651
  log(` pi autopull-worker installed -> ${AUTOPULL_WORKER_PATH}`);
3544
3652
  }
3545
3653
  }
3546
3654
  function uninstallPi() {
3547
- if (existsSync8(LEGACY_SKILL_DIR)) {
3655
+ if (existsSync9(LEGACY_SKILL_DIR)) {
3548
3656
  rmSync3(LEGACY_SKILL_DIR, { recursive: true, force: true });
3549
3657
  log(` pi removed ${LEGACY_SKILL_DIR}`);
3550
3658
  }
3551
- if (existsSync8(EXTENSION_PATH)) {
3659
+ if (existsSync9(EXTENSION_PATH)) {
3552
3660
  rmSync3(EXTENSION_PATH, { force: true });
3553
3661
  log(` pi removed extension ${EXTENSION_PATH}`);
3554
3662
  }
3555
- if (existsSync8(WIKI_WORKER_DIR)) {
3663
+ if (existsSync9(WIKI_WORKER_DIR)) {
3556
3664
  rmSync3(WIKI_WORKER_DIR, { recursive: true, force: true });
3557
3665
  log(` pi removed wiki-worker dir ${WIKI_WORKER_DIR}`);
3558
3666
  }
3559
- if (existsSync8(AGENTS_MD)) {
3560
- const prior = readFileSync6(AGENTS_MD, "utf-8");
3667
+ if (existsSync9(AGENTS_MD)) {
3668
+ const prior = readFileSync7(AGENTS_MD, "utf-8");
3561
3669
  const stripped = stripHivemindBlock(prior);
3562
3670
  if (stripped.trim().length === 0) {
3563
3671
  rmSync3(AGENTS_MD, { force: true });
3564
3672
  log(` pi removed empty ${AGENTS_MD}`);
3565
3673
  } else {
3566
- writeFileSync4(AGENTS_MD, stripped);
3674
+ writeFileSync5(AGENTS_MD, stripped);
3567
3675
  log(` pi stripped hivemind block from ${AGENTS_MD}`);
3568
3676
  }
3569
3677
  }
3570
- if (existsSync8(VERSION_DIR)) {
3678
+ if (existsSync9(VERSION_DIR)) {
3571
3679
  rmSync3(VERSION_DIR, { recursive: true, force: true });
3572
3680
  }
3573
3681
  }
3574
3682
 
3575
3683
  // dist/src/cli/embeddings.js
3576
- import { copyFileSync as copyFileSync3, chmodSync, existsSync as existsSync9, lstatSync as lstatSync2, readdirSync, readlinkSync, rmSync as rmSync4, statSync, unlinkSync as unlinkSync5 } from "node:fs";
3684
+ import { copyFileSync as copyFileSync3, chmodSync, existsSync as existsSync10, lstatSync as lstatSync2, readdirSync, readlinkSync, rmSync as rmSync4, statSync, unlinkSync as unlinkSync5 } from "node:fs";
3577
3685
  import { execFileSync as execFileSync3 } from "node:child_process";
3578
- import { join as join10 } from "node:path";
3579
- var SHARED_DIR = join10(HOME, ".hivemind", "embed-deps");
3580
- var SHARED_NODE_MODULES = join10(SHARED_DIR, "node_modules");
3581
- var SHARED_DAEMON_PATH = join10(SHARED_DIR, "embed-daemon.js");
3686
+ import { join as join11 } from "node:path";
3687
+ var SHARED_DIR = join11(HOME, ".hivemind", "embed-deps");
3688
+ var SHARED_NODE_MODULES = join11(SHARED_DIR, "node_modules");
3689
+ var SHARED_DAEMON_PATH = join11(SHARED_DIR, "embed-daemon.js");
3582
3690
  var TRANSFORMERS_PKG = "@huggingface/transformers";
3583
3691
  var TRANSFORMERS_RANGE = "^3.0.0";
3584
3692
  function findHivemindInstalls(home = HOME) {
3585
3693
  const out = [];
3586
3694
  const fixed = [
3587
- { id: "codex", pluginDir: join10(home, ".codex", "hivemind") },
3588
- { id: "cursor", pluginDir: join10(home, ".cursor", "hivemind") },
3589
- { id: "hermes", pluginDir: join10(home, ".hermes", "hivemind") }
3695
+ { id: "codex", pluginDir: join11(home, ".codex", "hivemind") },
3696
+ { id: "cursor", pluginDir: join11(home, ".cursor", "hivemind") },
3697
+ { id: "hermes", pluginDir: join11(home, ".hermes", "hivemind") }
3590
3698
  ];
3591
3699
  for (const inst of fixed) {
3592
- if (existsSync9(join10(inst.pluginDir, "bundle")))
3700
+ if (existsSync10(join11(inst.pluginDir, "bundle")))
3593
3701
  out.push(inst);
3594
3702
  }
3595
- const ccCache = join10(home, ".claude", "plugins", "cache", "hivemind", "hivemind");
3596
- if (existsSync9(ccCache)) {
3703
+ const ccCache = join11(home, ".claude", "plugins", "cache", "hivemind", "hivemind");
3704
+ if (existsSync10(ccCache)) {
3597
3705
  let entries = [];
3598
3706
  try {
3599
3707
  entries = readdirSync(ccCache);
3600
3708
  } catch {
3601
3709
  }
3602
3710
  for (const ver of entries) {
3603
- const dir = join10(ccCache, ver);
3711
+ const dir = join11(ccCache, ver);
3604
3712
  try {
3605
3713
  if (!statSync(dir).isDirectory())
3606
3714
  continue;
3607
3715
  } catch {
3608
3716
  continue;
3609
3717
  }
3610
- const candidates = [join10(dir, "bundle"), join10(dir, "claude-code", "bundle")];
3611
- if (candidates.some((p) => existsSync9(p))) {
3718
+ const candidates = [join11(dir, "bundle"), join11(dir, "claude-code", "bundle")];
3719
+ if (candidates.some((p) => existsSync10(p))) {
3612
3720
  out.push({ id: `claude (${ver})`, pluginDir: dir });
3613
3721
  }
3614
3722
  }
@@ -3616,10 +3724,10 @@ function findHivemindInstalls(home = HOME) {
3616
3724
  return out;
3617
3725
  }
3618
3726
  function isSharedDepsInstalled(sharedNodeModules = SHARED_NODE_MODULES) {
3619
- return existsSync9(join10(sharedNodeModules, TRANSFORMERS_PKG));
3727
+ return existsSync10(join11(sharedNodeModules, TRANSFORMERS_PKG));
3620
3728
  }
3621
3729
  function isSymlinkToSharedDeps(linkPath, sharedNodeModules) {
3622
- if (!existsSync9(linkPath))
3730
+ if (!existsSync10(linkPath))
3623
3731
  return false;
3624
3732
  try {
3625
3733
  if (!lstatSync2(linkPath).isSymbolicLink())
@@ -3630,8 +3738,8 @@ function isSymlinkToSharedDeps(linkPath, sharedNodeModules) {
3630
3738
  }
3631
3739
  }
3632
3740
  function linkStateFor(install, sharedNodeModules = SHARED_NODE_MODULES) {
3633
- const link = join10(install.pluginDir, "node_modules");
3634
- if (!existsSync9(link) && !isSymbolicLink(link))
3741
+ const link = join11(install.pluginDir, "node_modules");
3742
+ if (!existsSync10(link) && !isSymbolicLink(link))
3635
3743
  return { kind: "no-node-modules" };
3636
3744
  try {
3637
3745
  if (lstatSync2(link).isSymbolicLink()) {
@@ -3655,7 +3763,7 @@ function ensureSharedDeps() {
3655
3763
  log(` Embeddings installing ${TRANSFORMERS_PKG}@${TRANSFORMERS_RANGE} into ${SHARED_DIR}`);
3656
3764
  log(` (~600 MB; first install only \u2014 every agent will share this)`);
3657
3765
  ensureDir(SHARED_DIR);
3658
- writeJson(join10(SHARED_DIR, "package.json"), {
3766
+ writeJson(join11(SHARED_DIR, "package.json"), {
3659
3767
  name: "hivemind-embed-deps",
3660
3768
  version: "1.0.0",
3661
3769
  private: true,
@@ -3669,8 +3777,8 @@ function ensureSharedDeps() {
3669
3777
  log(` Embeddings shared deps already present at ${SHARED_DIR}`);
3670
3778
  }
3671
3779
  ensureDir(SHARED_DIR);
3672
- const src = join10(pkgRoot(), "embeddings", "embed-daemon.js");
3673
- if (existsSync9(src)) {
3780
+ const src = join11(pkgRoot(), "embeddings", "embed-daemon.js");
3781
+ if (existsSync10(src)) {
3674
3782
  copyFileSync3(src, SHARED_DAEMON_PATH);
3675
3783
  chmodSync(SHARED_DAEMON_PATH, 493);
3676
3784
  } else {
@@ -3678,7 +3786,7 @@ function ensureSharedDeps() {
3678
3786
  }
3679
3787
  }
3680
3788
  function linkAgent(install) {
3681
- const link = join10(install.pluginDir, "node_modules");
3789
+ const link = join11(install.pluginDir, "node_modules");
3682
3790
  symlinkForce(SHARED_NODE_MODULES, link);
3683
3791
  log(` Embeddings linked ${install.id.padEnd(20)} -> shared deps`);
3684
3792
  }
@@ -3697,13 +3805,13 @@ function enableEmbeddings() {
3697
3805
  function disableEmbeddings(opts) {
3698
3806
  const installs = findHivemindInstalls();
3699
3807
  for (const inst of installs) {
3700
- const link = join10(inst.pluginDir, "node_modules");
3808
+ const link = join11(inst.pluginDir, "node_modules");
3701
3809
  if (isSymlinkToSharedDeps(link, SHARED_NODE_MODULES)) {
3702
3810
  unlinkSync5(link);
3703
3811
  log(` Embeddings unlinked ${inst.id}`);
3704
3812
  }
3705
3813
  }
3706
- if (opts?.prune && existsSync9(SHARED_DIR)) {
3814
+ if (opts?.prune && existsSync10(SHARED_DIR)) {
3707
3815
  rmSync4(SHARED_DIR, { recursive: true, force: true });
3708
3816
  log(` Embeddings pruned ${SHARED_DIR}`);
3709
3817
  }
@@ -3711,7 +3819,7 @@ function disableEmbeddings(opts) {
3711
3819
  function statusEmbeddings() {
3712
3820
  log(`Shared deps: ${SHARED_DIR}`);
3713
3821
  log(`Installed: ${isSharedDepsInstalled() ? "yes" : "no"}`);
3714
- log(`Daemon: ${existsSync9(SHARED_DAEMON_PATH) ? SHARED_DAEMON_PATH : "(not present)"}`);
3822
+ log(`Daemon: ${existsSync10(SHARED_DAEMON_PATH) ? SHARED_DAEMON_PATH : "(not present)"}`);
3715
3823
  log("");
3716
3824
  log(`Agent installs:`);
3717
3825
  const installs = findHivemindInstalls();
@@ -3742,8 +3850,8 @@ function statusEmbeddings() {
3742
3850
  }
3743
3851
 
3744
3852
  // dist/src/cli/auth.js
3745
- import { existsSync as existsSync10 } from "node:fs";
3746
- import { join as join12 } from "node:path";
3853
+ import { existsSync as existsSync11 } from "node:fs";
3854
+ import { join as join13 } from "node:path";
3747
3855
 
3748
3856
  // dist/src/commands/auth.js
3749
3857
  import { execSync } from "node:child_process";
@@ -3758,25 +3866,25 @@ function deeplakeClientHeader() {
3758
3866
  }
3759
3867
 
3760
3868
  // dist/src/commands/auth-creds.js
3761
- import { readFileSync as readFileSync7, writeFileSync as writeFileSync5, mkdirSync as mkdirSync2, unlinkSync as unlinkSync6 } from "node:fs";
3762
- import { join as join11 } from "node:path";
3763
- import { homedir as homedir3 } from "node:os";
3869
+ import { readFileSync as readFileSync8, writeFileSync as writeFileSync6, mkdirSync as mkdirSync2, unlinkSync as unlinkSync6 } from "node:fs";
3870
+ import { join as join12 } from "node:path";
3871
+ import { homedir as homedir4 } from "node:os";
3764
3872
  function configDir() {
3765
- return join11(homedir3(), ".deeplake");
3873
+ return join12(homedir4(), ".deeplake");
3766
3874
  }
3767
3875
  function credsPath() {
3768
- return join11(configDir(), "credentials.json");
3876
+ return join12(configDir(), "credentials.json");
3769
3877
  }
3770
3878
  function loadCredentials() {
3771
3879
  try {
3772
- return JSON.parse(readFileSync7(credsPath(), "utf-8"));
3880
+ return JSON.parse(readFileSync8(credsPath(), "utf-8"));
3773
3881
  } catch {
3774
3882
  return null;
3775
3883
  }
3776
3884
  }
3777
3885
  function saveCredentials(creds) {
3778
3886
  mkdirSync2(configDir(), { recursive: true, mode: 448 });
3779
- writeFileSync5(credsPath(), JSON.stringify({ ...creds, savedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2), { mode: 384 });
3887
+ writeFileSync6(credsPath(), JSON.stringify({ ...creds, savedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2), { mode: 384 });
3780
3888
  }
3781
3889
  function deleteCredentials() {
3782
3890
  try {
@@ -3965,9 +4073,9 @@ Using: ${orgName}
3965
4073
  }
3966
4074
 
3967
4075
  // dist/src/cli/auth.js
3968
- var CREDS_PATH = join12(HOME, ".deeplake", "credentials.json");
4076
+ var CREDS_PATH = join13(HOME, ".deeplake", "credentials.json");
3969
4077
  function isLoggedIn() {
3970
- return existsSync10(CREDS_PATH) && loadCredentials() !== null;
4078
+ return existsSync11(CREDS_PATH) && loadCredentials() !== null;
3971
4079
  }
3972
4080
  async function ensureLoggedIn() {
3973
4081
  if (isLoggedIn())
@@ -4000,16 +4108,16 @@ async function maybeShowOrgChoice() {
4000
4108
  }
4001
4109
 
4002
4110
  // dist/src/config.js
4003
- import { readFileSync as readFileSync8, existsSync as existsSync11 } from "node:fs";
4004
- import { join as join13 } from "node:path";
4005
- import { homedir as homedir4, userInfo } from "node:os";
4111
+ import { readFileSync as readFileSync9, existsSync as existsSync12 } from "node:fs";
4112
+ import { join as join14 } from "node:path";
4113
+ import { homedir as homedir5, userInfo } from "node:os";
4006
4114
  function loadConfig() {
4007
- const home = homedir4();
4008
- const credPath = join13(home, ".deeplake", "credentials.json");
4115
+ const home = homedir5();
4116
+ const credPath = join14(home, ".deeplake", "credentials.json");
4009
4117
  let creds = null;
4010
- if (existsSync11(credPath)) {
4118
+ if (existsSync12(credPath)) {
4011
4119
  try {
4012
- creds = JSON.parse(readFileSync8(credPath, "utf-8"));
4120
+ creds = JSON.parse(readFileSync9(credPath, "utf-8"));
4013
4121
  } catch {
4014
4122
  return null;
4015
4123
  }
@@ -4028,7 +4136,7 @@ function loadConfig() {
4028
4136
  tableName: process.env.HIVEMIND_TABLE ?? "memory",
4029
4137
  sessionsTableName: process.env.HIVEMIND_SESSIONS_TABLE ?? "sessions",
4030
4138
  skillsTableName: process.env.HIVEMIND_SKILLS_TABLE ?? "skills",
4031
- memoryPath: process.env.HIVEMIND_MEMORY_PATH ?? join13(home, ".deeplake", "memory")
4139
+ memoryPath: process.env.HIVEMIND_MEMORY_PATH ?? join14(home, ".deeplake", "memory")
4032
4140
  };
4033
4141
  }
4034
4142
 
@@ -4037,9 +4145,9 @@ import { randomUUID } from "node:crypto";
4037
4145
 
4038
4146
  // dist/src/utils/debug.js
4039
4147
  import { appendFileSync } from "node:fs";
4040
- import { join as join14 } from "node:path";
4041
- import { homedir as homedir5 } from "node:os";
4042
- var LOG = join14(homedir5(), ".deeplake", "hook-debug.log");
4148
+ import { join as join15 } from "node:path";
4149
+ import { homedir as homedir6 } from "node:os";
4150
+ var LOG = join15(homedir6(), ".deeplake", "hook-debug.log");
4043
4151
  function isDebug() {
4044
4152
  return process.env.HIVEMIND_DEBUG === "1";
4045
4153
  }
@@ -4807,34 +4915,34 @@ if (process.argv[1] && process.argv[1].endsWith("auth-login.js")) {
4807
4915
  }
4808
4916
 
4809
4917
  // dist/src/commands/skillify.js
4810
- import { readdirSync as readdirSync5, existsSync as existsSync24, readFileSync as readFileSync17, mkdirSync as mkdirSync10, renameSync as renameSync4 } from "node:fs";
4811
- import { homedir as homedir17 } from "node:os";
4812
- import { dirname as dirname6, join as join27 } from "node:path";
4918
+ import { readdirSync as readdirSync5, existsSync as existsSync25, readFileSync as readFileSync18, mkdirSync as mkdirSync10, renameSync as renameSync5 } from "node:fs";
4919
+ import { homedir as homedir18 } from "node:os";
4920
+ import { dirname as dirname6, join as join28 } from "node:path";
4813
4921
 
4814
4922
  // dist/src/skillify/scope-config.js
4815
- import { existsSync as existsSync14, mkdirSync as mkdirSync4, readFileSync as readFileSync10, writeFileSync as writeFileSync7 } from "node:fs";
4816
- import { homedir as homedir7 } from "node:os";
4817
- import { join as join17 } from "node:path";
4923
+ import { existsSync as existsSync15, mkdirSync as mkdirSync4, readFileSync as readFileSync11, writeFileSync as writeFileSync8 } from "node:fs";
4924
+ import { homedir as homedir8 } from "node:os";
4925
+ import { join as join18 } from "node:path";
4818
4926
 
4819
4927
  // dist/src/skillify/legacy-migration.js
4820
- import { existsSync as existsSync13, renameSync } from "node:fs";
4821
- import { homedir as homedir6 } from "node:os";
4822
- import { join as join16 } from "node:path";
4928
+ import { existsSync as existsSync14, renameSync as renameSync2 } from "node:fs";
4929
+ import { homedir as homedir7 } from "node:os";
4930
+ import { join as join17 } from "node:path";
4823
4931
  var dlog = (msg) => log2("skillify-migrate", msg);
4824
4932
  var attempted = false;
4825
4933
  function migrateLegacyStateDir() {
4826
4934
  if (attempted)
4827
4935
  return;
4828
4936
  attempted = true;
4829
- const root = join16(homedir6(), ".deeplake", "state");
4830
- const legacy = join16(root, "skilify");
4831
- const current = join16(root, "skillify");
4832
- if (!existsSync13(legacy))
4937
+ const root = join17(homedir7(), ".deeplake", "state");
4938
+ const legacy = join17(root, "skilify");
4939
+ const current = join17(root, "skillify");
4940
+ if (!existsSync14(legacy))
4833
4941
  return;
4834
- if (existsSync13(current))
4942
+ if (existsSync14(current))
4835
4943
  return;
4836
4944
  try {
4837
- renameSync(legacy, current);
4945
+ renameSync2(legacy, current);
4838
4946
  dlog(`migrated ${legacy} -> ${current}`);
4839
4947
  } catch (err) {
4840
4948
  const code = err.code;
@@ -4847,15 +4955,15 @@ function migrateLegacyStateDir() {
4847
4955
  }
4848
4956
 
4849
4957
  // dist/src/skillify/scope-config.js
4850
- var STATE_DIR = join17(homedir7(), ".deeplake", "state", "skillify");
4851
- var CONFIG_PATH2 = join17(STATE_DIR, "config.json");
4958
+ var STATE_DIR = join18(homedir8(), ".deeplake", "state", "skillify");
4959
+ var CONFIG_PATH2 = join18(STATE_DIR, "config.json");
4852
4960
  var DEFAULT = { scope: "me", team: [], install: "project" };
4853
4961
  function loadScopeConfig() {
4854
4962
  migrateLegacyStateDir();
4855
- if (!existsSync14(CONFIG_PATH2))
4963
+ if (!existsSync15(CONFIG_PATH2))
4856
4964
  return DEFAULT;
4857
4965
  try {
4858
- const raw = JSON.parse(readFileSync10(CONFIG_PATH2, "utf-8"));
4966
+ const raw = JSON.parse(readFileSync11(CONFIG_PATH2, "utf-8"));
4859
4967
  const scope = raw.scope === "team" ? "team" : raw.scope === "org" ? "team" : "me";
4860
4968
  const team = Array.isArray(raw.team) ? raw.team.filter((s) => typeof s === "string") : [];
4861
4969
  const install = raw.install === "global" ? "global" : "project";
@@ -4867,18 +4975,18 @@ function loadScopeConfig() {
4867
4975
  function saveScopeConfig(cfg) {
4868
4976
  migrateLegacyStateDir();
4869
4977
  mkdirSync4(STATE_DIR, { recursive: true });
4870
- writeFileSync7(CONFIG_PATH2, JSON.stringify(cfg, null, 2));
4978
+ writeFileSync8(CONFIG_PATH2, JSON.stringify(cfg, null, 2));
4871
4979
  }
4872
4980
 
4873
4981
  // dist/src/skillify/pull.js
4874
- import { existsSync as existsSync18, readFileSync as readFileSync13, writeFileSync as writeFileSync10, mkdirSync as mkdirSync7, renameSync as renameSync3, lstatSync as lstatSync4, readlinkSync as readlinkSync2, symlinkSync as symlinkSync2, unlinkSync as unlinkSync8 } from "node:fs";
4875
- import { homedir as homedir11 } from "node:os";
4876
- import { dirname as dirname3, join as join21 } from "node:path";
4982
+ import { existsSync as existsSync19, readFileSync as readFileSync14, writeFileSync as writeFileSync11, mkdirSync as mkdirSync7, renameSync as renameSync4, lstatSync as lstatSync4, readlinkSync as readlinkSync2, symlinkSync as symlinkSync2, unlinkSync as unlinkSync8 } from "node:fs";
4983
+ import { homedir as homedir12 } from "node:os";
4984
+ import { dirname as dirname3, join as join22 } from "node:path";
4877
4985
 
4878
4986
  // dist/src/skillify/skill-writer.js
4879
- import { existsSync as existsSync15, mkdirSync as mkdirSync5, readFileSync as readFileSync11, readdirSync as readdirSync2, statSync as statSync2, writeFileSync as writeFileSync8 } from "node:fs";
4880
- import { homedir as homedir8 } from "node:os";
4881
- import { join as join18 } from "node:path";
4987
+ import { existsSync as existsSync16, mkdirSync as mkdirSync5, readFileSync as readFileSync12, readdirSync as readdirSync2, statSync as statSync2, writeFileSync as writeFileSync9 } from "node:fs";
4988
+ import { homedir as homedir9 } from "node:os";
4989
+ import { join as join19 } from "node:path";
4882
4990
  function assertValidSkillName(name) {
4883
4991
  if (typeof name !== "string" || name.length === 0) {
4884
4992
  throw new Error(`invalid skill name: empty or non-string`);
@@ -4894,10 +5002,10 @@ function assertValidSkillName(name) {
4894
5002
  }
4895
5003
  }
4896
5004
  function skillDir(skillsRoot, name) {
4897
- return join18(skillsRoot, name);
5005
+ return join19(skillsRoot, name);
4898
5006
  }
4899
5007
  function skillPath(skillsRoot, name) {
4900
- return join18(skillDir(skillsRoot, name), "SKILL.md");
5008
+ return join19(skillDir(skillsRoot, name), "SKILL.md");
4901
5009
  }
4902
5010
  function renderFrontmatter(fm) {
4903
5011
  const lines = ["---"];
@@ -4975,7 +5083,7 @@ function writeNewSkill(args) {
4975
5083
  assertValidSkillName(args.name);
4976
5084
  const dir = skillDir(args.skillsRoot, args.name);
4977
5085
  const path = skillPath(args.skillsRoot, args.name);
4978
- if (existsSync15(path)) {
5086
+ if (existsSync16(path)) {
4979
5087
  throw new Error(`skill already exists at ${path}; use mergeSkill`);
4980
5088
  }
4981
5089
  mkdirSync5(dir, { recursive: true });
@@ -4998,7 +5106,7 @@ function writeNewSkill(args) {
4998
5106
 
4999
5107
  ${args.body.trim()}
5000
5108
  `;
5001
- writeFileSync8(path, text);
5109
+ writeFileSync9(path, text);
5002
5110
  return {
5003
5111
  path,
5004
5112
  action: "created",
@@ -5010,41 +5118,41 @@ ${args.body.trim()}
5010
5118
  };
5011
5119
  }
5012
5120
  function listSkills(skillsRoot) {
5013
- if (!existsSync15(skillsRoot))
5121
+ if (!existsSync16(skillsRoot))
5014
5122
  return [];
5015
5123
  const out = [];
5016
5124
  for (const name of readdirSync2(skillsRoot)) {
5017
- const skillFile = join18(skillsRoot, name, "SKILL.md");
5018
- if (existsSync15(skillFile) && statSync2(skillFile).isFile()) {
5019
- out.push({ name, body: readFileSync11(skillFile, "utf-8") });
5125
+ const skillFile = join19(skillsRoot, name, "SKILL.md");
5126
+ if (existsSync16(skillFile) && statSync2(skillFile).isFile()) {
5127
+ out.push({ name, body: readFileSync12(skillFile, "utf-8") });
5020
5128
  }
5021
5129
  }
5022
5130
  return out;
5023
5131
  }
5024
5132
  function resolveSkillsRoot(install, cwd) {
5025
5133
  if (install === "global") {
5026
- return join18(homedir8(), ".claude", "skills");
5134
+ return join19(homedir9(), ".claude", "skills");
5027
5135
  }
5028
- return join18(cwd, ".claude", "skills");
5136
+ return join19(cwd, ".claude", "skills");
5029
5137
  }
5030
5138
 
5031
5139
  // dist/src/skillify/manifest.js
5032
- import { existsSync as existsSync16, lstatSync as lstatSync3, mkdirSync as mkdirSync6, readFileSync as readFileSync12, renameSync as renameSync2, unlinkSync as unlinkSync7, writeFileSync as writeFileSync9 } from "node:fs";
5033
- import { homedir as homedir9 } from "node:os";
5034
- import { dirname as dirname2, join as join19 } from "node:path";
5140
+ import { existsSync as existsSync17, lstatSync as lstatSync3, mkdirSync as mkdirSync6, readFileSync as readFileSync13, renameSync as renameSync3, unlinkSync as unlinkSync7, writeFileSync as writeFileSync10 } from "node:fs";
5141
+ import { homedir as homedir10 } from "node:os";
5142
+ import { dirname as dirname2, join as join20 } from "node:path";
5035
5143
  function emptyManifest() {
5036
5144
  return { version: 1, entries: [] };
5037
5145
  }
5038
5146
  function manifestPath() {
5039
- return join19(homedir9(), ".deeplake", "state", "skillify", "pulled.json");
5147
+ return join20(homedir10(), ".deeplake", "state", "skillify", "pulled.json");
5040
5148
  }
5041
5149
  function loadManifest(path = manifestPath()) {
5042
5150
  migrateLegacyStateDir();
5043
- if (!existsSync16(path))
5151
+ if (!existsSync17(path))
5044
5152
  return emptyManifest();
5045
5153
  let raw;
5046
5154
  try {
5047
- raw = readFileSync12(path, "utf-8");
5155
+ raw = readFileSync13(path, "utf-8");
5048
5156
  } catch {
5049
5157
  return emptyManifest();
5050
5158
  }
@@ -5093,8 +5201,8 @@ function saveManifest(m, path = manifestPath()) {
5093
5201
  migrateLegacyStateDir();
5094
5202
  mkdirSync6(dirname2(path), { recursive: true });
5095
5203
  const tmp = `${path}.tmp`;
5096
- writeFileSync9(tmp, JSON.stringify(m, null, 2) + "\n", { mode: 384 });
5097
- renameSync2(tmp, path);
5204
+ writeFileSync10(tmp, JSON.stringify(m, null, 2) + "\n", { mode: 384 });
5205
+ renameSync3(tmp, path);
5098
5206
  }
5099
5207
  function recordPull(entry, path = manifestPath()) {
5100
5208
  const m = loadManifest(path);
@@ -5136,7 +5244,7 @@ function pruneOrphanedEntries(path = manifestPath()) {
5136
5244
  const live = [];
5137
5245
  let pruned = 0;
5138
5246
  for (const e of m.entries) {
5139
- if (existsSync16(join19(e.installRoot, e.dirName))) {
5247
+ if (existsSync17(join20(e.installRoot, e.dirName))) {
5140
5248
  live.push(e);
5141
5249
  continue;
5142
5250
  }
@@ -5149,26 +5257,26 @@ function pruneOrphanedEntries(path = manifestPath()) {
5149
5257
  }
5150
5258
 
5151
5259
  // dist/src/skillify/agent-roots.js
5152
- import { existsSync as existsSync17 } from "node:fs";
5153
- import { homedir as homedir10 } from "node:os";
5154
- import { join as join20 } from "node:path";
5260
+ import { existsSync as existsSync18 } from "node:fs";
5261
+ import { homedir as homedir11 } from "node:os";
5262
+ import { join as join21 } from "node:path";
5155
5263
  function resolveDetected(home) {
5156
5264
  const out = [];
5157
- const codexInstalled = existsSync17(join20(home, ".codex"));
5158
- const piInstalled = existsSync17(join20(home, ".pi", "agent"));
5159
- const hermesInstalled = existsSync17(join20(home, ".hermes"));
5265
+ const codexInstalled = existsSync18(join21(home, ".codex"));
5266
+ const piInstalled = existsSync18(join21(home, ".pi", "agent"));
5267
+ const hermesInstalled = existsSync18(join21(home, ".hermes"));
5160
5268
  if (codexInstalled || piInstalled) {
5161
- out.push(join20(home, ".agents", "skills"));
5269
+ out.push(join21(home, ".agents", "skills"));
5162
5270
  }
5163
5271
  if (hermesInstalled) {
5164
- out.push(join20(home, ".hermes", "skills"));
5272
+ out.push(join21(home, ".hermes", "skills"));
5165
5273
  }
5166
5274
  if (piInstalled) {
5167
- out.push(join20(home, ".pi", "agent", "skills"));
5275
+ out.push(join21(home, ".pi", "agent", "skills"));
5168
5276
  }
5169
5277
  return out;
5170
5278
  }
5171
- function detectAgentSkillsRoots(canonicalRoot, home = homedir10()) {
5279
+ function detectAgentSkillsRoots(canonicalRoot, home = homedir11()) {
5172
5280
  return resolveDetected(home).filter((p) => p !== canonicalRoot);
5173
5281
  }
5174
5282
 
@@ -5212,15 +5320,15 @@ function isMissingTableError(message) {
5212
5320
  }
5213
5321
  function resolvePullDestination(install, cwd) {
5214
5322
  if (install === "global")
5215
- return join21(homedir11(), ".claude", "skills");
5323
+ return join22(homedir12(), ".claude", "skills");
5216
5324
  if (!cwd)
5217
5325
  throw new Error("install=project requires a cwd");
5218
- return join21(cwd, ".claude", "skills");
5326
+ return join22(cwd, ".claude", "skills");
5219
5327
  }
5220
5328
  function fanOutSymlinks(canonicalDir, dirName, agentRoots) {
5221
5329
  const out = [];
5222
5330
  for (const root of agentRoots) {
5223
- const link = join21(root, dirName);
5331
+ const link = join22(root, dirName);
5224
5332
  let existing;
5225
5333
  try {
5226
5334
  existing = lstatSync4(link);
@@ -5263,8 +5371,8 @@ function backfillSymlinks(installRoot) {
5263
5371
  return;
5264
5372
  const detected = detectAgentSkillsRoots(installRoot);
5265
5373
  for (const entry of entries) {
5266
- const canonical = join21(entry.installRoot, entry.dirName);
5267
- if (!existsSync18(canonical))
5374
+ const canonical = join22(entry.installRoot, entry.dirName);
5375
+ if (!existsSync19(canonical))
5268
5376
  continue;
5269
5377
  const fresh = fanOutSymlinks(canonical, entry.dirName, detected);
5270
5378
  if (sameSorted(fresh, entry.symlinks))
@@ -5374,10 +5482,10 @@ function renderFrontmatter2(fm) {
5374
5482
  return lines.join("\n");
5375
5483
  }
5376
5484
  function readLocalVersion(path) {
5377
- if (!existsSync18(path))
5485
+ if (!existsSync19(path))
5378
5486
  return null;
5379
5487
  try {
5380
- const text = readFileSync13(path, "utf-8");
5488
+ const text = readFileSync14(path, "utf-8");
5381
5489
  const parsed = parseFrontmatter(text);
5382
5490
  if (!parsed)
5383
5491
  return null;
@@ -5472,8 +5580,8 @@ async function runPull(opts) {
5472
5580
  summary.skipped++;
5473
5581
  continue;
5474
5582
  }
5475
- const skillDir2 = join21(root, dirName);
5476
- const skillFile = join21(skillDir2, "SKILL.md");
5583
+ const skillDir2 = join22(root, dirName);
5584
+ const skillFile = join22(skillDir2, "SKILL.md");
5477
5585
  const remoteVersion = Number(row.version ?? 1);
5478
5586
  const localVersion = readLocalVersion(skillFile);
5479
5587
  const action = decideAction({
@@ -5485,13 +5593,13 @@ async function runPull(opts) {
5485
5593
  let manifestError;
5486
5594
  if (action === "wrote") {
5487
5595
  mkdirSync7(skillDir2, { recursive: true });
5488
- if (existsSync18(skillFile)) {
5596
+ if (existsSync19(skillFile)) {
5489
5597
  try {
5490
- renameSync3(skillFile, `${skillFile}.bak`);
5598
+ renameSync4(skillFile, `${skillFile}.bak`);
5491
5599
  } catch {
5492
5600
  }
5493
5601
  }
5494
- writeFileSync10(skillFile, renderSkillFile(row));
5602
+ writeFileSync11(skillFile, renderSkillFile(row));
5495
5603
  const symlinks = opts.install === "global" ? fanOutSymlinks(skillDir2, dirName, detectAgentSkillsRoots(root)) : [];
5496
5604
  try {
5497
5605
  recordPull({
@@ -5533,15 +5641,15 @@ async function runPull(opts) {
5533
5641
  }
5534
5642
 
5535
5643
  // dist/src/skillify/unpull.js
5536
- import { existsSync as existsSync19, readdirSync as readdirSync3, rmSync as rmSync5, statSync as statSync3 } from "node:fs";
5537
- import { homedir as homedir12 } from "node:os";
5538
- import { join as join22 } from "node:path";
5644
+ import { existsSync as existsSync20, readdirSync as readdirSync3, rmSync as rmSync5, statSync as statSync3 } from "node:fs";
5645
+ import { homedir as homedir13 } from "node:os";
5646
+ import { join as join23 } from "node:path";
5539
5647
  function resolveUnpullRoot(install, cwd) {
5540
5648
  if (install === "global")
5541
- return join22(homedir12(), ".claude", "skills");
5649
+ return join23(homedir13(), ".claude", "skills");
5542
5650
  if (!cwd)
5543
5651
  throw new Error("cwd required when install === 'project'");
5544
- return join22(cwd, ".claude", "skills");
5652
+ return join23(cwd, ".claude", "skills");
5545
5653
  }
5546
5654
  function runUnpull(opts) {
5547
5655
  const root = resolveUnpullRoot(opts.install, opts.cwd);
@@ -5564,8 +5672,8 @@ function runUnpull(opts) {
5564
5672
  const entries = entriesForRoot(manifest, opts.install, root);
5565
5673
  for (const entry of entries) {
5566
5674
  summary.scanned++;
5567
- const path = join22(root, entry.dirName);
5568
- if (!existsSync19(path)) {
5675
+ const path = join23(root, entry.dirName);
5676
+ if (!existsSync20(path)) {
5569
5677
  if (!opts.dryRun) {
5570
5678
  unlinkSymlinks(entry.symlinks);
5571
5679
  removePullEntry(opts.install, entry.installRoot, entry.dirName);
@@ -5618,12 +5726,12 @@ function runUnpull(opts) {
5618
5726
  }
5619
5727
  summary.entries.push(result);
5620
5728
  }
5621
- if (existsSync19(root) && (opts.all || opts.legacyCleanup)) {
5729
+ if (existsSync20(root) && (opts.all || opts.legacyCleanup)) {
5622
5730
  const manifestDirNames = new Set(entries.map((e) => e.dirName));
5623
5731
  for (const dirName of readdirSync3(root)) {
5624
5732
  if (manifestDirNames.has(dirName))
5625
5733
  continue;
5626
- const path = join22(root, dirName);
5734
+ const path = join23(root, dirName);
5627
5735
  let st;
5628
5736
  try {
5629
5737
  st = statSync3(path);
@@ -5702,30 +5810,30 @@ function decideTargetForManifestEntry(entry, opts, userFilter, haveUserFilter) {
5702
5810
 
5703
5811
  // dist/src/commands/mine-local.js
5704
5812
  import { spawn } from "node:child_process";
5705
- import { existsSync as existsSync23, mkdirSync as mkdirSync9, readFileSync as readFileSync16, writeFileSync as writeFileSync12 } from "node:fs";
5706
- import { homedir as homedir16 } from "node:os";
5707
- import { basename, dirname as dirname5, join as join26 } from "node:path";
5813
+ import { existsSync as existsSync24, mkdirSync as mkdirSync9, readFileSync as readFileSync17, writeFileSync as writeFileSync13 } from "node:fs";
5814
+ import { homedir as homedir17 } from "node:os";
5815
+ import { basename, dirname as dirname5, join as join27 } from "node:path";
5708
5816
 
5709
5817
  // dist/src/skillify/local-source.js
5710
- import { readdirSync as readdirSync4, readFileSync as readFileSync14, existsSync as existsSync20, statSync as statSync4 } from "node:fs";
5711
- import { homedir as homedir13 } from "node:os";
5712
- import { join as join23 } from "node:path";
5713
- var HOME2 = homedir13();
5818
+ import { readdirSync as readdirSync4, readFileSync as readFileSync15, existsSync as existsSync21, statSync as statSync4 } from "node:fs";
5819
+ import { homedir as homedir14 } from "node:os";
5820
+ import { join as join24 } from "node:path";
5821
+ var HOME2 = homedir14();
5714
5822
  function encodeCwdClaudeCode(cwd) {
5715
5823
  return cwd.replace(/[/_]/g, "-");
5716
5824
  }
5717
5825
  function detectInstalledAgents() {
5718
5826
  const installs = [];
5719
- const claudeRoot = join23(HOME2, ".claude", "projects");
5720
- if (existsSync20(claudeRoot)) {
5827
+ const claudeRoot = join24(HOME2, ".claude", "projects");
5828
+ if (existsSync21(claudeRoot)) {
5721
5829
  installs.push({
5722
5830
  agent: "claude_code",
5723
5831
  sessionRoot: claudeRoot,
5724
5832
  encodeCwd: encodeCwdClaudeCode
5725
5833
  });
5726
5834
  }
5727
- const codexRoot = join23(HOME2, ".codex", "sessions");
5728
- if (existsSync20(codexRoot)) {
5835
+ const codexRoot = join24(HOME2, ".codex", "sessions");
5836
+ if (existsSync21(codexRoot)) {
5729
5837
  installs.push({
5730
5838
  agent: "codex",
5731
5839
  sessionRoot: codexRoot,
@@ -5752,7 +5860,7 @@ function listLocalSessions(installs, cwd) {
5752
5860
  continue;
5753
5861
  }
5754
5862
  for (const sub of subdirs) {
5755
- const subdirPath = join23(install.sessionRoot, sub);
5863
+ const subdirPath = join24(install.sessionRoot, sub);
5756
5864
  try {
5757
5865
  if (!statSync4(subdirPath).isDirectory())
5758
5866
  continue;
@@ -5769,7 +5877,7 @@ function listLocalSessions(installs, cwd) {
5769
5877
  for (const f of files) {
5770
5878
  if (!f.endsWith(".jsonl"))
5771
5879
  continue;
5772
- const fullPath = join23(subdirPath, f);
5880
+ const fullPath = join24(subdirPath, f);
5773
5881
  let stats;
5774
5882
  try {
5775
5883
  stats = statSync4(fullPath);
@@ -5830,7 +5938,7 @@ function pickSessions(candidates, opts) {
5830
5938
  function nativeJsonlToRows(filePath, sessionId, agent) {
5831
5939
  let raw;
5832
5940
  try {
5833
- raw = readFileSync14(filePath, "utf-8");
5941
+ raw = readFileSync15(filePath, "utf-8");
5834
5942
  } catch {
5835
5943
  return [];
5836
5944
  }
@@ -5920,22 +6028,22 @@ function extractPairs(rows) {
5920
6028
  }
5921
6029
 
5922
6030
  // dist/src/skillify/gate-runner.js
5923
- import { existsSync as existsSync21 } from "node:fs";
6031
+ import { existsSync as existsSync22 } from "node:fs";
5924
6032
  import { createRequire } from "node:module";
5925
- import { homedir as homedir14 } from "node:os";
5926
- import { join as join24 } from "node:path";
6033
+ import { homedir as homedir15 } from "node:os";
6034
+ import { join as join25 } from "node:path";
5927
6035
  var requireForCp = createRequire(import.meta.url);
5928
6036
  var { execFileSync: runChildProcess } = requireForCp("node:child_process");
5929
6037
  var inheritedEnv = process;
5930
6038
  function firstExistingPath(candidates) {
5931
6039
  for (const c of candidates) {
5932
- if (existsSync21(c))
6040
+ if (existsSync22(c))
5933
6041
  return c;
5934
6042
  }
5935
6043
  return null;
5936
6044
  }
5937
6045
  function findAgentBin(agent) {
5938
- const home = homedir14();
6046
+ const home = homedir15();
5939
6047
  switch (agent) {
5940
6048
  // /usr/bin/<name> is included in every candidate list — that's the
5941
6049
  // common Linux package-manager install path (apt, dnf, pacman). Old
@@ -5944,45 +6052,45 @@ function findAgentBin(agent) {
5944
6052
  // #170 caught the gap.
5945
6053
  case "claude_code":
5946
6054
  return firstExistingPath([
5947
- join24(home, ".claude", "local", "claude"),
6055
+ join25(home, ".claude", "local", "claude"),
5948
6056
  "/usr/local/bin/claude",
5949
6057
  "/usr/bin/claude",
5950
- join24(home, ".npm-global", "bin", "claude"),
5951
- join24(home, ".local", "bin", "claude"),
6058
+ join25(home, ".npm-global", "bin", "claude"),
6059
+ join25(home, ".local", "bin", "claude"),
5952
6060
  "/opt/homebrew/bin/claude"
5953
- ]) ?? join24(home, ".claude", "local", "claude");
6061
+ ]) ?? join25(home, ".claude", "local", "claude");
5954
6062
  case "codex":
5955
6063
  return firstExistingPath([
5956
6064
  "/usr/local/bin/codex",
5957
6065
  "/usr/bin/codex",
5958
- join24(home, ".npm-global", "bin", "codex"),
5959
- join24(home, ".local", "bin", "codex"),
6066
+ join25(home, ".npm-global", "bin", "codex"),
6067
+ join25(home, ".local", "bin", "codex"),
5960
6068
  "/opt/homebrew/bin/codex"
5961
6069
  ]) ?? "/usr/local/bin/codex";
5962
6070
  case "cursor":
5963
6071
  return firstExistingPath([
5964
6072
  "/usr/local/bin/cursor-agent",
5965
6073
  "/usr/bin/cursor-agent",
5966
- join24(home, ".npm-global", "bin", "cursor-agent"),
5967
- join24(home, ".local", "bin", "cursor-agent"),
6074
+ join25(home, ".npm-global", "bin", "cursor-agent"),
6075
+ join25(home, ".local", "bin", "cursor-agent"),
5968
6076
  "/opt/homebrew/bin/cursor-agent"
5969
6077
  ]) ?? "/usr/local/bin/cursor-agent";
5970
6078
  case "hermes":
5971
6079
  return firstExistingPath([
5972
- join24(home, ".local", "bin", "hermes"),
6080
+ join25(home, ".local", "bin", "hermes"),
5973
6081
  "/usr/local/bin/hermes",
5974
6082
  "/usr/bin/hermes",
5975
- join24(home, ".npm-global", "bin", "hermes"),
6083
+ join25(home, ".npm-global", "bin", "hermes"),
5976
6084
  "/opt/homebrew/bin/hermes"
5977
- ]) ?? join24(home, ".local", "bin", "hermes");
6085
+ ]) ?? join25(home, ".local", "bin", "hermes");
5978
6086
  case "pi":
5979
6087
  return firstExistingPath([
5980
- join24(home, ".local", "bin", "pi"),
6088
+ join25(home, ".local", "bin", "pi"),
5981
6089
  "/usr/local/bin/pi",
5982
6090
  "/usr/bin/pi",
5983
- join24(home, ".npm-global", "bin", "pi"),
6091
+ join25(home, ".npm-global", "bin", "pi"),
5984
6092
  "/opt/homebrew/bin/pi"
5985
- ]) ?? join24(home, ".local", "bin", "pi");
6093
+ ]) ?? join25(home, ".local", "bin", "pi");
5986
6094
  }
5987
6095
  }
5988
6096
 
@@ -6012,23 +6120,23 @@ function extractJsonBlock(s) {
6012
6120
  }
6013
6121
 
6014
6122
  // dist/src/skillify/local-manifest.js
6015
- import { existsSync as existsSync22, mkdirSync as mkdirSync8, readFileSync as readFileSync15, writeFileSync as writeFileSync11 } from "node:fs";
6016
- import { homedir as homedir15 } from "node:os";
6017
- import { dirname as dirname4, join as join25 } from "node:path";
6018
- var LOCAL_MANIFEST_PATH = join25(homedir15(), ".claude", "hivemind", "local-mined.json");
6019
- var LOCAL_MINE_LOCK_PATH = join25(homedir15(), ".claude", "hivemind", "local-mined.lock");
6123
+ import { existsSync as existsSync23, mkdirSync as mkdirSync8, readFileSync as readFileSync16, writeFileSync as writeFileSync12 } from "node:fs";
6124
+ import { homedir as homedir16 } from "node:os";
6125
+ import { dirname as dirname4, join as join26 } from "node:path";
6126
+ var LOCAL_MANIFEST_PATH = join26(homedir16(), ".claude", "hivemind", "local-mined.json");
6127
+ var LOCAL_MINE_LOCK_PATH = join26(homedir16(), ".claude", "hivemind", "local-mined.lock");
6020
6128
  function readLocalManifest(path = LOCAL_MANIFEST_PATH) {
6021
- if (!existsSync22(path))
6129
+ if (!existsSync23(path))
6022
6130
  return null;
6023
6131
  try {
6024
- return JSON.parse(readFileSync15(path, "utf-8"));
6132
+ return JSON.parse(readFileSync16(path, "utf-8"));
6025
6133
  } catch {
6026
6134
  return null;
6027
6135
  }
6028
6136
  }
6029
6137
  function writeLocalManifest(m, path = LOCAL_MANIFEST_PATH) {
6030
6138
  mkdirSync8(dirname4(path), { recursive: true });
6031
- writeFileSync11(path, JSON.stringify(m, null, 2));
6139
+ writeFileSync12(path, JSON.stringify(m, null, 2));
6032
6140
  }
6033
6141
 
6034
6142
  // dist/src/commands/mine-local.js
@@ -6053,7 +6161,7 @@ function runGateViaStdin(opts) {
6053
6161
  });
6054
6162
  return;
6055
6163
  }
6056
- if (!existsSync23(opts.bin)) {
6164
+ if (!existsSync24(opts.bin)) {
6057
6165
  resolve({
6058
6166
  stdout: "",
6059
6167
  stderr: "",
@@ -6398,7 +6506,7 @@ async function runMineLocalImpl(args) {
6398
6506
  console.log(`Dry-run: would invoke ${gateAgent} gate on ${picked.length} session(s) in parallel (concurrency=${GATE_CONCURRENCY}).`);
6399
6507
  return;
6400
6508
  }
6401
- const tmpDir = join26(homedir16(), ".claude", "hivemind", `mine-local-${Date.now()}`);
6509
+ const tmpDir = join27(homedir17(), ".claude", "hivemind", `mine-local-${Date.now()}`);
6402
6510
  mkdirSync9(tmpDir, { recursive: true });
6403
6511
  console.log(`Running ${picked.length} gate call(s) in parallel (concurrency=${GATE_CONCURRENCY}, timeout=${GATE_TIMEOUT_MS / 1e3}s each)...`);
6404
6512
  const results = await parallelMap(picked, GATE_CONCURRENCY, async (s) => {
@@ -6410,23 +6518,23 @@ async function runMineLocalImpl(args) {
6410
6518
  return { session: s, skills: [], reason: "no pairs", error: null };
6411
6519
  }
6412
6520
  const tail = pairs2.slice(-PER_SESSION_PAIR_CAP);
6413
- const sessionTmp = join26(tmpDir, `s-${shortId}`);
6521
+ const sessionTmp = join27(tmpDir, `s-${shortId}`);
6414
6522
  mkdirSync9(sessionTmp, { recursive: true });
6415
- const verdictPath = join26(sessionTmp, "verdict.json");
6523
+ const verdictPath = join27(sessionTmp, "verdict.json");
6416
6524
  const prompt = buildSessionPrompt(tail, s, verdictPath);
6417
- writeFileSync12(join26(sessionTmp, "prompt.txt"), prompt);
6525
+ writeFileSync13(join27(sessionTmp, "prompt.txt"), prompt);
6418
6526
  const gate = await runGateViaStdin({ agent: gateAgent, bin: gateBin, prompt, timeoutMs: GATE_TIMEOUT_MS });
6419
6527
  try {
6420
- writeFileSync12(join26(sessionTmp, "gate-stdout.txt"), gate.stdout);
6528
+ writeFileSync13(join27(sessionTmp, "gate-stdout.txt"), gate.stdout);
6421
6529
  if (gate.stderr)
6422
- writeFileSync12(join26(sessionTmp, "gate-stderr.txt"), gate.stderr);
6530
+ writeFileSync13(join27(sessionTmp, "gate-stderr.txt"), gate.stderr);
6423
6531
  } catch {
6424
6532
  }
6425
6533
  if (gate.errored) {
6426
6534
  console.log(` [${shortId}] gate failed: ${gate.errorMessage}`);
6427
6535
  return { session: s, skills: [], reason: null, error: gate.errorMessage ?? "gate failed" };
6428
6536
  }
6429
- const verdictText = existsSync23(verdictPath) ? readFileSync16(verdictPath, "utf-8") : gate.stdout;
6537
+ const verdictText = existsSync24(verdictPath) ? readFileSync17(verdictPath, "utf-8") : gate.stdout;
6430
6538
  const mv = parseMultiVerdict(verdictText);
6431
6539
  if (!mv) {
6432
6540
  console.log(` [${shortId}] unparseable verdict (kept at ${sessionTmp})`);
@@ -6642,7 +6750,7 @@ function wrapAt(s, max) {
6642
6750
 
6643
6751
  // dist/src/commands/skillify.js
6644
6752
  function stateDir() {
6645
- return join27(homedir17(), ".deeplake", "state", "skillify");
6753
+ return join28(homedir18(), ".deeplake", "state", "skillify");
6646
6754
  }
6647
6755
  function showStatus() {
6648
6756
  const cfg = loadScopeConfig();
@@ -6650,7 +6758,7 @@ function showStatus() {
6650
6758
  console.log(`team: ${cfg.team.length === 0 ? "(empty)" : cfg.team.join(", ")}`);
6651
6759
  console.log(`install: ${cfg.install} (${cfg.install === "global" ? "~/.claude/skills/" : "<project>/.claude/skills/"})`);
6652
6760
  const dir = stateDir();
6653
- if (!existsSync24(dir)) {
6761
+ if (!existsSync25(dir)) {
6654
6762
  console.log(`state: (no projects tracked yet)`);
6655
6763
  return;
6656
6764
  }
@@ -6662,7 +6770,7 @@ function showStatus() {
6662
6770
  console.log(`state: ${files.length} project(s) tracked`);
6663
6771
  for (const f of files) {
6664
6772
  try {
6665
- const s = JSON.parse(readFileSync17(join27(dir, f), "utf-8"));
6773
+ const s = JSON.parse(readFileSync18(join28(dir, f), "utf-8"));
6666
6774
  const last = typeof s.updatedAt === "number" ? new Date(s.updatedAt).toISOString() : s.lastDate ?? "never";
6667
6775
  const skills = Array.isArray(s.skillsGenerated) && s.skillsGenerated.length > 0 ? s.skillsGenerated.join(", ") : "none";
6668
6776
  console.log(` - ${s.project} (counter=${s.counter}, last=${last}, skills=${skills})`);
@@ -6689,7 +6797,7 @@ function setInstall(loc) {
6689
6797
  }
6690
6798
  const cfg = loadScopeConfig();
6691
6799
  saveScopeConfig({ ...cfg, install: loc });
6692
- const path = loc === "global" ? join27(homedir17(), ".claude", "skills") : "<cwd>/.claude/skills";
6800
+ const path = loc === "global" ? join28(homedir18(), ".claude", "skills") : "<cwd>/.claude/skills";
6693
6801
  console.log(`Install location set to '${loc}'. New skills will be written to ${path}/<name>/SKILL.md.`);
6694
6802
  }
6695
6803
  function promoteSkill(name, cwd) {
@@ -6697,18 +6805,18 @@ function promoteSkill(name, cwd) {
6697
6805
  console.error("Usage: hivemind skillify promote <skill-name>");
6698
6806
  process.exit(1);
6699
6807
  }
6700
- const projectPath = join27(cwd, ".claude", "skills", name);
6701
- const globalPath = join27(homedir17(), ".claude", "skills", name);
6702
- if (!existsSync24(join27(projectPath, "SKILL.md"))) {
6808
+ const projectPath = join28(cwd, ".claude", "skills", name);
6809
+ const globalPath = join28(homedir18(), ".claude", "skills", name);
6810
+ if (!existsSync25(join28(projectPath, "SKILL.md"))) {
6703
6811
  console.error(`Skill '${name}' not found at ${projectPath}/SKILL.md`);
6704
6812
  process.exit(1);
6705
6813
  }
6706
- if (existsSync24(join27(globalPath, "SKILL.md"))) {
6814
+ if (existsSync25(join28(globalPath, "SKILL.md"))) {
6707
6815
  console.error(`Skill '${name}' already exists at ${globalPath}/SKILL.md \u2014 refusing to overwrite. Remove it first or rename the project skill.`);
6708
6816
  process.exit(1);
6709
6817
  }
6710
6818
  mkdirSync10(dirname6(globalPath), { recursive: true });
6711
- renameSync4(projectPath, globalPath);
6819
+ renameSync5(projectPath, globalPath);
6712
6820
  console.log(`Promoted '${name}' from ${projectPath} \u2192 ${globalPath}.`);
6713
6821
  }
6714
6822
  function teamAdd(name) {
@@ -6814,7 +6922,7 @@ async function pullSkills(args) {
6814
6922
  console.error(`pull failed: ${e?.message ?? e}`);
6815
6923
  process.exit(1);
6816
6924
  }
6817
- const dest = toRaw === "global" ? join27(homedir17(), ".claude", "skills") : `${process.cwd()}/.claude/skills`;
6925
+ const dest = toRaw === "global" ? join28(homedir18(), ".claude", "skills") : `${process.cwd()}/.claude/skills`;
6818
6926
  const filterDesc = users.length === 0 ? "all users" : users.join(", ");
6819
6927
  console.log(`Destination: ${dest}`);
6820
6928
  console.log(`Filter: ${filterDesc}${skillName ? ` \xB7 skill='${skillName}'` : ""}${dryRun ? " \xB7 dry-run" : ""}${force ? " \xB7 force" : ""}`);
@@ -6864,7 +6972,7 @@ async function unpullSkills(args) {
6864
6972
  all,
6865
6973
  legacyCleanup
6866
6974
  });
6867
- const dest = toRaw === "global" ? join27(homedir17(), ".claude", "skills") : `${process.cwd()}/.claude/skills`;
6975
+ const dest = toRaw === "global" ? join28(homedir18(), ".claude", "skills") : `${process.cwd()}/.claude/skills`;
6868
6976
  const filterParts = [];
6869
6977
  if (users.length > 0)
6870
6978
  filterParts.push(`users=${users.join(",")}`);
@@ -6960,13 +7068,13 @@ if (process.argv[1] && process.argv[1].endsWith("skillify.js")) {
6960
7068
 
6961
7069
  // dist/src/cli/update.js
6962
7070
  import { execFileSync as execFileSync4 } from "node:child_process";
6963
- import { existsSync as existsSync25, readFileSync as readFileSync19, realpathSync } from "node:fs";
7071
+ import { existsSync as existsSync26, readFileSync as readFileSync20, realpathSync } from "node:fs";
6964
7072
  import { dirname as dirname8, sep } from "node:path";
6965
7073
  import { fileURLToPath as fileURLToPath2 } from "node:url";
6966
7074
 
6967
7075
  // dist/src/utils/version-check.js
6968
- import { readFileSync as readFileSync18 } from "node:fs";
6969
- import { dirname as dirname7, join as join28 } from "node:path";
7076
+ import { readFileSync as readFileSync19 } from "node:fs";
7077
+ import { dirname as dirname7, join as join29 } from "node:path";
6970
7078
  function isNewer(latest, current) {
6971
7079
  const parse = (v) => v.split(".").map(Number);
6972
7080
  const [la, lb, lc] = parse(latest);
@@ -6990,7 +7098,7 @@ function detectInstallKind(argv1) {
6990
7098
  for (let i = 0; i < 10; i++) {
6991
7099
  const pkgPath = `${dir}${sep}package.json`;
6992
7100
  try {
6993
- const pkg = JSON.parse(readFileSync19(pkgPath, "utf-8"));
7101
+ const pkg = JSON.parse(readFileSync20(pkgPath, "utf-8"));
6994
7102
  if (pkg.name === PKG_NAME || pkg.name === "hivemind") {
6995
7103
  installDir = dir;
6996
7104
  break;
@@ -7011,7 +7119,7 @@ function detectInstallKind(argv1) {
7011
7119
  }
7012
7120
  let gitDir = installDir;
7013
7121
  for (let i = 0; i < 6; i++) {
7014
- if (existsSync25(`${gitDir}${sep}.git`)) {
7122
+ if (existsSync26(`${gitDir}${sep}.git`)) {
7015
7123
  return { kind: "local-dev", installDir };
7016
7124
  }
7017
7125
  const parent = dirname8(gitDir);