@deeplake/hivemind 0.7.31 → 0.7.32

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 existsSync13, mkdirSync as mkdirSync3, readFileSync as readFileSync10, writeFileSync as writeFileSync7 } from "node:fs";
21
- import { join as join16 } from "node:path";
20
+ import { existsSync as existsSync14, mkdirSync as mkdirSync4, readFileSync as readFileSync12, writeFileSync as writeFileSync8 } from "node:fs";
21
+ import { join as join17 } from "node:path";
22
22
  import { tmpdir } from "node:os";
23
23
  function getIndexMarkerDir() {
24
- return process.env.HIVEMIND_INDEX_MARKER_DIR ?? join16(tmpdir(), "hivemind-deeplake-indexes");
24
+ return process.env.HIVEMIND_INDEX_MARKER_DIR ?? join17(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 join16(getIndexMarkerDir(), `${markerKey}.json`);
28
+ return join17(getIndexMarkerDir(), `${markerKey}.json`);
29
29
  }
30
30
  function hasFreshIndexMarker(markerPath) {
31
- if (!existsSync13(markerPath))
31
+ if (!existsSync14(markerPath))
32
32
  return false;
33
33
  try {
34
- const raw = JSON.parse(readFileSync10(markerPath, "utf-8"));
34
+ const raw = JSON.parse(readFileSync12(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;
@@ -41,8 +41,8 @@ function hasFreshIndexMarker(markerPath) {
41
41
  }
42
42
  }
43
43
  function writeIndexMarker(markerPath) {
44
- mkdirSync3(getIndexMarkerDir(), { recursive: true });
45
- writeFileSync7(markerPath, JSON.stringify({ updatedAt: (/* @__PURE__ */ new Date()).toISOString() }), "utf-8");
44
+ mkdirSync4(getIndexMarkerDir(), { recursive: true });
45
+ writeFileSync8(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({
@@ -3681,42 +3681,137 @@ function uninstallPi() {
3681
3681
  }
3682
3682
 
3683
3683
  // dist/src/cli/embeddings.js
3684
- import { copyFileSync as copyFileSync3, chmodSync, existsSync as existsSync10, lstatSync as lstatSync2, readdirSync, readlinkSync, rmSync as rmSync4, statSync, unlinkSync as unlinkSync5 } from "node:fs";
3685
- import { execFileSync as execFileSync3 } from "node:child_process";
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");
3684
+ import { copyFileSync as copyFileSync3, chmodSync, existsSync as existsSync11, lstatSync as lstatSync2, readdirSync, readFileSync as readFileSync9, readlinkSync, rmSync as rmSync4, statSync, unlinkSync as unlinkSync5 } from "node:fs";
3685
+ import { execFileSync as execFileSync3, spawnSync } from "node:child_process";
3686
+ import { userInfo } from "node:os";
3687
+ import { join as join12 } from "node:path";
3688
+
3689
+ // dist/src/embeddings/protocol.js
3690
+ var DEFAULT_SOCKET_DIR = "/tmp";
3691
+ var DEFAULT_IDLE_TIMEOUT_MS = 10 * 60 * 1e3;
3692
+ function socketPathFor(uid, dir = DEFAULT_SOCKET_DIR) {
3693
+ return `${dir}/hivemind-embed-${uid}.sock`;
3694
+ }
3695
+ function pidPathFor(uid, dir = DEFAULT_SOCKET_DIR) {
3696
+ return `${dir}/hivemind-embed-${uid}.pid`;
3697
+ }
3698
+
3699
+ // dist/src/user-config.js
3700
+ import { existsSync as existsSync10, mkdirSync as mkdirSync2, readFileSync as readFileSync8, renameSync as renameSync2, writeFileSync as writeFileSync6 } from "node:fs";
3701
+ import { homedir as homedir4 } from "node:os";
3702
+ import { dirname as dirname2, join as join11 } from "node:path";
3703
+ var _configPath = () => process.env.HIVEMIND_CONFIG_PATH ?? join11(homedir4(), ".deeplake", "config.json");
3704
+ var _cache = null;
3705
+ var _migrated = false;
3706
+ function readUserConfig() {
3707
+ if (_cache !== null)
3708
+ return _cache;
3709
+ const path = _configPath();
3710
+ if (!existsSync10(path)) {
3711
+ _cache = {};
3712
+ return _cache;
3713
+ }
3714
+ try {
3715
+ const raw = readFileSync8(path, "utf-8");
3716
+ const parsed = JSON.parse(raw);
3717
+ _cache = isPlainObject(parsed) ? parsed : {};
3718
+ } catch {
3719
+ _cache = {};
3720
+ }
3721
+ return _cache;
3722
+ }
3723
+ function writeUserConfig(patch) {
3724
+ const current = readUserConfig();
3725
+ const merged = deepMerge(current, patch);
3726
+ const path = _configPath();
3727
+ const dir = dirname2(path);
3728
+ if (!existsSync10(dir))
3729
+ mkdirSync2(dir, { recursive: true });
3730
+ const tmp = `${path}.tmp.${process.pid}`;
3731
+ writeFileSync6(tmp, JSON.stringify(merged, null, 2) + "\n", "utf-8");
3732
+ renameSync2(tmp, path);
3733
+ _cache = merged;
3734
+ return merged;
3735
+ }
3736
+ function getEmbeddingsEnabled() {
3737
+ const cfg = readUserConfig();
3738
+ if (cfg.embeddings && typeof cfg.embeddings.enabled === "boolean") {
3739
+ return cfg.embeddings.enabled;
3740
+ }
3741
+ if (_migrated) {
3742
+ return migrationValueFromEnv();
3743
+ }
3744
+ _migrated = true;
3745
+ const enabled = migrationValueFromEnv();
3746
+ try {
3747
+ writeUserConfig({ embeddings: { enabled } });
3748
+ } catch {
3749
+ _cache = { ...cfg ?? {}, embeddings: { ...cfg?.embeddings ?? {}, enabled } };
3750
+ }
3751
+ return enabled;
3752
+ }
3753
+ function migrationValueFromEnv() {
3754
+ const raw = process.env.HIVEMIND_EMBEDDINGS;
3755
+ if (raw === void 0)
3756
+ return false;
3757
+ if (raw === "false")
3758
+ return false;
3759
+ return true;
3760
+ }
3761
+ function setEmbeddingsEnabled(enabled) {
3762
+ writeUserConfig({ embeddings: { enabled } });
3763
+ }
3764
+ function isPlainObject(value) {
3765
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3766
+ }
3767
+ function deepMerge(base, patch) {
3768
+ const out = { ...base };
3769
+ for (const key of Object.keys(patch)) {
3770
+ const patchVal = patch[key];
3771
+ const baseVal = base[key];
3772
+ if (isPlainObject(patchVal) && isPlainObject(baseVal)) {
3773
+ out[key] = { ...baseVal, ...patchVal };
3774
+ } else if (patchVal !== void 0) {
3775
+ out[key] = patchVal;
3776
+ }
3777
+ }
3778
+ return out;
3779
+ }
3780
+
3781
+ // dist/src/cli/embeddings.js
3782
+ var SHARED_DIR = join12(HOME, ".hivemind", "embed-deps");
3783
+ var SHARED_NODE_MODULES = join12(SHARED_DIR, "node_modules");
3784
+ var SHARED_DAEMON_PATH = join12(SHARED_DIR, "embed-daemon.js");
3690
3785
  var TRANSFORMERS_PKG = "@huggingface/transformers";
3691
3786
  var TRANSFORMERS_RANGE = "^3.0.0";
3692
3787
  function findHivemindInstalls(home = HOME) {
3693
3788
  const out = [];
3694
3789
  const fixed = [
3695
- { id: "codex", pluginDir: join11(home, ".codex", "hivemind") },
3696
- { id: "cursor", pluginDir: join11(home, ".cursor", "hivemind") },
3697
- { id: "hermes", pluginDir: join11(home, ".hermes", "hivemind") }
3790
+ { id: "codex", pluginDir: join12(home, ".codex", "hivemind") },
3791
+ { id: "cursor", pluginDir: join12(home, ".cursor", "hivemind") },
3792
+ { id: "hermes", pluginDir: join12(home, ".hermes", "hivemind") }
3698
3793
  ];
3699
3794
  for (const inst of fixed) {
3700
- if (existsSync10(join11(inst.pluginDir, "bundle")))
3795
+ if (existsSync11(join12(inst.pluginDir, "bundle")))
3701
3796
  out.push(inst);
3702
3797
  }
3703
- const ccCache = join11(home, ".claude", "plugins", "cache", "hivemind", "hivemind");
3704
- if (existsSync10(ccCache)) {
3798
+ const ccCache = join12(home, ".claude", "plugins", "cache", "hivemind", "hivemind");
3799
+ if (existsSync11(ccCache)) {
3705
3800
  let entries = [];
3706
3801
  try {
3707
3802
  entries = readdirSync(ccCache);
3708
3803
  } catch {
3709
3804
  }
3710
3805
  for (const ver of entries) {
3711
- const dir = join11(ccCache, ver);
3806
+ const dir = join12(ccCache, ver);
3712
3807
  try {
3713
3808
  if (!statSync(dir).isDirectory())
3714
3809
  continue;
3715
3810
  } catch {
3716
3811
  continue;
3717
3812
  }
3718
- const candidates = [join11(dir, "bundle"), join11(dir, "claude-code", "bundle")];
3719
- if (candidates.some((p) => existsSync10(p))) {
3813
+ const candidates = [join12(dir, "bundle"), join12(dir, "claude-code", "bundle")];
3814
+ if (candidates.some((p) => existsSync11(p))) {
3720
3815
  out.push({ id: `claude (${ver})`, pluginDir: dir });
3721
3816
  }
3722
3817
  }
@@ -3724,10 +3819,10 @@ function findHivemindInstalls(home = HOME) {
3724
3819
  return out;
3725
3820
  }
3726
3821
  function isSharedDepsInstalled(sharedNodeModules = SHARED_NODE_MODULES) {
3727
- return existsSync10(join11(sharedNodeModules, TRANSFORMERS_PKG));
3822
+ return existsSync11(join12(sharedNodeModules, TRANSFORMERS_PKG));
3728
3823
  }
3729
3824
  function isSymlinkToSharedDeps(linkPath, sharedNodeModules) {
3730
- if (!existsSync10(linkPath))
3825
+ if (!existsSync11(linkPath))
3731
3826
  return false;
3732
3827
  try {
3733
3828
  if (!lstatSync2(linkPath).isSymbolicLink())
@@ -3738,8 +3833,8 @@ function isSymlinkToSharedDeps(linkPath, sharedNodeModules) {
3738
3833
  }
3739
3834
  }
3740
3835
  function linkStateFor(install, sharedNodeModules = SHARED_NODE_MODULES) {
3741
- const link = join11(install.pluginDir, "node_modules");
3742
- if (!existsSync10(link) && !isSymbolicLink(link))
3836
+ const link = join12(install.pluginDir, "node_modules");
3837
+ if (!existsSync11(link) && !isSymbolicLink(link))
3743
3838
  return { kind: "no-node-modules" };
3744
3839
  try {
3745
3840
  if (lstatSync2(link).isSymbolicLink()) {
@@ -3763,7 +3858,7 @@ function ensureSharedDeps() {
3763
3858
  log(` Embeddings installing ${TRANSFORMERS_PKG}@${TRANSFORMERS_RANGE} into ${SHARED_DIR}`);
3764
3859
  log(` (~600 MB; first install only \u2014 every agent will share this)`);
3765
3860
  ensureDir(SHARED_DIR);
3766
- writeJson(join11(SHARED_DIR, "package.json"), {
3861
+ writeJson(join12(SHARED_DIR, "package.json"), {
3767
3862
  name: "hivemind-embed-deps",
3768
3863
  version: "1.0.0",
3769
3864
  private: true,
@@ -3777,8 +3872,8 @@ function ensureSharedDeps() {
3777
3872
  log(` Embeddings shared deps already present at ${SHARED_DIR}`);
3778
3873
  }
3779
3874
  ensureDir(SHARED_DIR);
3780
- const src = join11(pkgRoot(), "embeddings", "embed-daemon.js");
3781
- if (existsSync10(src)) {
3875
+ const src = join12(pkgRoot(), "embeddings", "embed-daemon.js");
3876
+ if (existsSync11(src)) {
3782
3877
  copyFileSync3(src, SHARED_DAEMON_PATH);
3783
3878
  chmodSync(SHARED_DAEMON_PATH, 493);
3784
3879
  } else {
@@ -3786,40 +3881,115 @@ function ensureSharedDeps() {
3786
3881
  }
3787
3882
  }
3788
3883
  function linkAgent(install) {
3789
- const link = join11(install.pluginDir, "node_modules");
3884
+ const link = join12(install.pluginDir, "node_modules");
3885
+ const state = linkStateFor(install);
3886
+ if (state.kind === "owns-own-node-modules") {
3887
+ warn(` Embeddings ${install.id.padEnd(20)} owns its own node_modules \u2014 skipping symlink (status: owns-own-node-modules)`);
3888
+ return;
3889
+ }
3790
3890
  symlinkForce(SHARED_NODE_MODULES, link);
3791
3891
  log(` Embeddings linked ${install.id.padEnd(20)} -> shared deps`);
3792
3892
  }
3793
- function enableEmbeddings() {
3893
+ function installEmbeddings() {
3794
3894
  ensureSharedDeps();
3795
3895
  const installs = findHivemindInstalls();
3796
3896
  if (installs.length === 0) {
3797
3897
  warn(" Embeddings no hivemind installs detected \u2014 run `hivemind install` first");
3798
3898
  warn(" (the shared deps are in place; subsequent agent installs will pick them up if you re-run `hivemind embeddings install`)");
3799
- return;
3899
+ } else {
3900
+ for (const inst of installs)
3901
+ linkAgent(inst);
3800
3902
  }
3801
- for (const inst of installs)
3802
- linkAgent(inst);
3803
- log(` Embeddings enabled. Restart your agents to pick up.`);
3903
+ setEmbeddingsEnabled(true);
3904
+ log(` Embeddings enabled in ~/.deeplake/config.json`);
3905
+ log(` Embeddings ready. Restart your agents to pick up.`);
3804
3906
  }
3805
- function disableEmbeddings(opts) {
3907
+ function enableEmbeddings() {
3908
+ setEmbeddingsEnabled(true);
3909
+ log(` Embeddings enabled in ~/.deeplake/config.json`);
3910
+ if (!isSharedDepsInstalled()) {
3911
+ warn(` Embeddings shared deps not installed yet \u2014 run \`hivemind embeddings install\` to download them`);
3912
+ } else {
3913
+ log(` Embeddings shared deps present \u2014 sessions will start producing embeddings on next restart`);
3914
+ }
3915
+ }
3916
+ function uninstallEmbeddings(opts) {
3806
3917
  const installs = findHivemindInstalls();
3807
3918
  for (const inst of installs) {
3808
- const link = join11(inst.pluginDir, "node_modules");
3919
+ const link = join12(inst.pluginDir, "node_modules");
3809
3920
  if (isSymlinkToSharedDeps(link, SHARED_NODE_MODULES)) {
3810
3921
  unlinkSync5(link);
3811
3922
  log(` Embeddings unlinked ${inst.id}`);
3812
3923
  }
3813
3924
  }
3814
- if (opts?.prune && existsSync10(SHARED_DIR)) {
3925
+ if (opts?.prune && existsSync11(SHARED_DIR)) {
3815
3926
  rmSync4(SHARED_DIR, { recursive: true, force: true });
3816
3927
  log(` Embeddings pruned ${SHARED_DIR}`);
3817
3928
  }
3929
+ setEmbeddingsEnabled(false);
3930
+ killEmbedDaemon();
3931
+ log(` Embeddings disabled in ~/.deeplake/config.json`);
3932
+ }
3933
+ function disableEmbeddings() {
3934
+ setEmbeddingsEnabled(false);
3935
+ killEmbedDaemon();
3936
+ log(` Embeddings disabled in ~/.deeplake/config.json`);
3937
+ log(` Embeddings daemon terminated; shared deps preserved (run \`hivemind embeddings uninstall\` to remove)`);
3938
+ }
3939
+ function killEmbedDaemon(socketDir) {
3940
+ const uid = typeof process.getuid === "function" ? process.getuid() : userInfo().uid;
3941
+ const pidPath = pidPathFor(String(uid), socketDir);
3942
+ const sockPath = socketPathFor(String(uid), socketDir);
3943
+ let pid = null;
3944
+ try {
3945
+ pid = Number.parseInt(readFileSync9(pidPath, "utf-8").trim(), 10);
3946
+ } catch {
3947
+ }
3948
+ if (pid !== null && Number.isFinite(pid) && _isDaemonAliveOnSocket(sockPath)) {
3949
+ try {
3950
+ process.kill(pid, "SIGTERM");
3951
+ } catch {
3952
+ }
3953
+ } else if (pid !== null) {
3954
+ log(` Embeddings pidfile present but socket dead \u2014 skipping SIGTERM on possibly-stale pid ${pid}`);
3955
+ }
3956
+ try {
3957
+ unlinkSync5(sockPath);
3958
+ } catch {
3959
+ }
3960
+ try {
3961
+ unlinkSync5(pidPath);
3962
+ } catch {
3963
+ }
3964
+ }
3965
+ function _isDaemonAliveOnSocket(sockPath, timeoutMs = 200) {
3966
+ if (!existsSync11(sockPath))
3967
+ return false;
3968
+ try {
3969
+ const child = spawnSync("node", [
3970
+ "-e",
3971
+ `const n=require("node:net");const s=n.connect(${JSON.stringify(sockPath)});s.once("connect",()=>{s.end();process.exit(0)});s.once("error",()=>process.exit(2));setTimeout(()=>process.exit(3),${timeoutMs});`
3972
+ ], { timeout: timeoutMs + 1e3, stdio: "ignore" });
3973
+ return child.status === 0;
3974
+ } catch {
3975
+ return false;
3976
+ }
3818
3977
  }
3819
3978
  function statusEmbeddings() {
3979
+ const enabled = getEmbeddingsEnabled();
3980
+ log(`Config: ~/.deeplake/config.json embeddings.enabled = ${enabled}`);
3820
3981
  log(`Shared deps: ${SHARED_DIR}`);
3821
3982
  log(`Installed: ${isSharedDepsInstalled() ? "yes" : "no"}`);
3822
- log(`Daemon: ${existsSync10(SHARED_DAEMON_PATH) ? SHARED_DAEMON_PATH : "(not present)"}`);
3983
+ log(`Daemon: ${existsSync11(SHARED_DAEMON_PATH) ? SHARED_DAEMON_PATH : "(not present)"}`);
3984
+ if (!enabled) {
3985
+ log("");
3986
+ log(`Embeddings are DISABLED in user config. Run \`hivemind embeddings enable\` to opt in,`);
3987
+ log(`or \`hivemind embeddings install\` if the shared deps are not yet downloaded.`);
3988
+ } else if (!isSharedDepsInstalled()) {
3989
+ log("");
3990
+ warn(`Embeddings are enabled in config but shared deps are missing.`);
3991
+ warn(`Run \`hivemind embeddings install\` to download @huggingface/transformers.`);
3992
+ }
3823
3993
  log("");
3824
3994
  log(`Agent installs:`);
3825
3995
  const installs = findHivemindInstalls();
@@ -3835,7 +4005,7 @@ function statusEmbeddings() {
3835
4005
  label = "\u2713 linked \u2192 shared";
3836
4006
  break;
3837
4007
  case "no-node-modules":
3838
- label = "\u2717 not linked (embeddings disabled)";
4008
+ label = "\u2717 not linked";
3839
4009
  break;
3840
4010
  case "owns-own-node-modules":
3841
4011
  label = "\u25B3 has its own node_modules (not shared)";
@@ -3850,8 +4020,8 @@ function statusEmbeddings() {
3850
4020
  }
3851
4021
 
3852
4022
  // dist/src/cli/auth.js
3853
- import { existsSync as existsSync11 } from "node:fs";
3854
- import { join as join13 } from "node:path";
4023
+ import { existsSync as existsSync12 } from "node:fs";
4024
+ import { join as join14 } from "node:path";
3855
4025
 
3856
4026
  // dist/src/commands/auth.js
3857
4027
  import { execSync } from "node:child_process";
@@ -3866,25 +4036,25 @@ function deeplakeClientHeader() {
3866
4036
  }
3867
4037
 
3868
4038
  // dist/src/commands/auth-creds.js
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";
4039
+ import { readFileSync as readFileSync10, writeFileSync as writeFileSync7, mkdirSync as mkdirSync3, unlinkSync as unlinkSync6 } from "node:fs";
4040
+ import { join as join13 } from "node:path";
4041
+ import { homedir as homedir5 } from "node:os";
3872
4042
  function configDir() {
3873
- return join12(homedir4(), ".deeplake");
4043
+ return join13(homedir5(), ".deeplake");
3874
4044
  }
3875
4045
  function credsPath() {
3876
- return join12(configDir(), "credentials.json");
4046
+ return join13(configDir(), "credentials.json");
3877
4047
  }
3878
4048
  function loadCredentials() {
3879
4049
  try {
3880
- return JSON.parse(readFileSync8(credsPath(), "utf-8"));
4050
+ return JSON.parse(readFileSync10(credsPath(), "utf-8"));
3881
4051
  } catch {
3882
4052
  return null;
3883
4053
  }
3884
4054
  }
3885
4055
  function saveCredentials(creds) {
3886
- mkdirSync2(configDir(), { recursive: true, mode: 448 });
3887
- writeFileSync6(credsPath(), JSON.stringify({ ...creds, savedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2), { mode: 384 });
4056
+ mkdirSync3(configDir(), { recursive: true, mode: 448 });
4057
+ writeFileSync7(credsPath(), JSON.stringify({ ...creds, savedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2), { mode: 384 });
3888
4058
  }
3889
4059
  function deleteCredentials() {
3890
4060
  try {
@@ -4073,9 +4243,9 @@ Using: ${orgName}
4073
4243
  }
4074
4244
 
4075
4245
  // dist/src/cli/auth.js
4076
- var CREDS_PATH = join13(HOME, ".deeplake", "credentials.json");
4246
+ var CREDS_PATH = join14(HOME, ".deeplake", "credentials.json");
4077
4247
  function isLoggedIn() {
4078
- return existsSync11(CREDS_PATH) && loadCredentials() !== null;
4248
+ return existsSync12(CREDS_PATH) && loadCredentials() !== null;
4079
4249
  }
4080
4250
  async function ensureLoggedIn() {
4081
4251
  if (isLoggedIn())
@@ -4108,16 +4278,16 @@ async function maybeShowOrgChoice() {
4108
4278
  }
4109
4279
 
4110
4280
  // dist/src/config.js
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";
4281
+ import { readFileSync as readFileSync11, existsSync as existsSync13 } from "node:fs";
4282
+ import { join as join15 } from "node:path";
4283
+ import { homedir as homedir6, userInfo as userInfo2 } from "node:os";
4114
4284
  function loadConfig() {
4115
- const home = homedir5();
4116
- const credPath = join14(home, ".deeplake", "credentials.json");
4285
+ const home = homedir6();
4286
+ const credPath = join15(home, ".deeplake", "credentials.json");
4117
4287
  let creds = null;
4118
- if (existsSync12(credPath)) {
4288
+ if (existsSync13(credPath)) {
4119
4289
  try {
4120
- creds = JSON.parse(readFileSync9(credPath, "utf-8"));
4290
+ creds = JSON.parse(readFileSync11(credPath, "utf-8"));
4121
4291
  } catch {
4122
4292
  return null;
4123
4293
  }
@@ -4130,13 +4300,13 @@ function loadConfig() {
4130
4300
  token,
4131
4301
  orgId,
4132
4302
  orgName: creds?.orgName ?? orgId,
4133
- userName: creds?.userName || userInfo().username || "unknown",
4303
+ userName: creds?.userName || userInfo2().username || "unknown",
4134
4304
  workspaceId: process.env.HIVEMIND_WORKSPACE_ID ?? creds?.workspaceId ?? "default",
4135
4305
  apiUrl: process.env.HIVEMIND_API_URL ?? creds?.apiUrl ?? "https://api.deeplake.ai",
4136
4306
  tableName: process.env.HIVEMIND_TABLE ?? "memory",
4137
4307
  sessionsTableName: process.env.HIVEMIND_SESSIONS_TABLE ?? "sessions",
4138
4308
  skillsTableName: process.env.HIVEMIND_SKILLS_TABLE ?? "skills",
4139
- memoryPath: process.env.HIVEMIND_MEMORY_PATH ?? join14(home, ".deeplake", "memory")
4309
+ memoryPath: process.env.HIVEMIND_MEMORY_PATH ?? join15(home, ".deeplake", "memory")
4140
4310
  };
4141
4311
  }
4142
4312
 
@@ -4145,9 +4315,9 @@ import { randomUUID } from "node:crypto";
4145
4315
 
4146
4316
  // dist/src/utils/debug.js
4147
4317
  import { appendFileSync } from "node:fs";
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");
4318
+ import { join as join16 } from "node:path";
4319
+ import { homedir as homedir7 } from "node:os";
4320
+ var LOG = join16(homedir7(), ".deeplake", "hook-debug.log");
4151
4321
  function isDebug() {
4152
4322
  return process.env.HIVEMIND_DEBUG === "1";
4153
4323
  }
@@ -4915,34 +5085,34 @@ if (process.argv[1] && process.argv[1].endsWith("auth-login.js")) {
4915
5085
  }
4916
5086
 
4917
5087
  // dist/src/commands/skillify.js
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";
5088
+ import { readdirSync as readdirSync5, existsSync as existsSync26, readFileSync as readFileSync20, mkdirSync as mkdirSync11, renameSync as renameSync6 } from "node:fs";
5089
+ import { homedir as homedir19 } from "node:os";
5090
+ import { dirname as dirname7, join as join29 } from "node:path";
4921
5091
 
4922
5092
  // dist/src/skillify/scope-config.js
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";
5093
+ import { existsSync as existsSync16, mkdirSync as mkdirSync5, readFileSync as readFileSync13, writeFileSync as writeFileSync9 } from "node:fs";
5094
+ import { homedir as homedir9 } from "node:os";
5095
+ import { join as join19 } from "node:path";
4926
5096
 
4927
5097
  // dist/src/skillify/legacy-migration.js
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";
5098
+ import { existsSync as existsSync15, renameSync as renameSync3 } from "node:fs";
5099
+ import { homedir as homedir8 } from "node:os";
5100
+ import { join as join18 } from "node:path";
4931
5101
  var dlog = (msg) => log2("skillify-migrate", msg);
4932
5102
  var attempted = false;
4933
5103
  function migrateLegacyStateDir() {
4934
5104
  if (attempted)
4935
5105
  return;
4936
5106
  attempted = true;
4937
- const root = join17(homedir7(), ".deeplake", "state");
4938
- const legacy = join17(root, "skilify");
4939
- const current = join17(root, "skillify");
4940
- if (!existsSync14(legacy))
5107
+ const root = join18(homedir8(), ".deeplake", "state");
5108
+ const legacy = join18(root, "skilify");
5109
+ const current = join18(root, "skillify");
5110
+ if (!existsSync15(legacy))
4941
5111
  return;
4942
- if (existsSync14(current))
5112
+ if (existsSync15(current))
4943
5113
  return;
4944
5114
  try {
4945
- renameSync2(legacy, current);
5115
+ renameSync3(legacy, current);
4946
5116
  dlog(`migrated ${legacy} -> ${current}`);
4947
5117
  } catch (err) {
4948
5118
  const code = err.code;
@@ -4955,15 +5125,15 @@ function migrateLegacyStateDir() {
4955
5125
  }
4956
5126
 
4957
5127
  // dist/src/skillify/scope-config.js
4958
- var STATE_DIR = join18(homedir8(), ".deeplake", "state", "skillify");
4959
- var CONFIG_PATH2 = join18(STATE_DIR, "config.json");
5128
+ var STATE_DIR = join19(homedir9(), ".deeplake", "state", "skillify");
5129
+ var CONFIG_PATH2 = join19(STATE_DIR, "config.json");
4960
5130
  var DEFAULT = { scope: "me", team: [], install: "project" };
4961
5131
  function loadScopeConfig() {
4962
5132
  migrateLegacyStateDir();
4963
- if (!existsSync15(CONFIG_PATH2))
5133
+ if (!existsSync16(CONFIG_PATH2))
4964
5134
  return DEFAULT;
4965
5135
  try {
4966
- const raw = JSON.parse(readFileSync11(CONFIG_PATH2, "utf-8"));
5136
+ const raw = JSON.parse(readFileSync13(CONFIG_PATH2, "utf-8"));
4967
5137
  const scope = raw.scope === "team" ? "team" : raw.scope === "org" ? "team" : "me";
4968
5138
  const team = Array.isArray(raw.team) ? raw.team.filter((s) => typeof s === "string") : [];
4969
5139
  const install = raw.install === "global" ? "global" : "project";
@@ -4974,19 +5144,19 @@ function loadScopeConfig() {
4974
5144
  }
4975
5145
  function saveScopeConfig(cfg) {
4976
5146
  migrateLegacyStateDir();
4977
- mkdirSync4(STATE_DIR, { recursive: true });
4978
- writeFileSync8(CONFIG_PATH2, JSON.stringify(cfg, null, 2));
5147
+ mkdirSync5(STATE_DIR, { recursive: true });
5148
+ writeFileSync9(CONFIG_PATH2, JSON.stringify(cfg, null, 2));
4979
5149
  }
4980
5150
 
4981
5151
  // dist/src/skillify/pull.js
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";
5152
+ import { existsSync as existsSync20, readFileSync as readFileSync16, writeFileSync as writeFileSync12, mkdirSync as mkdirSync8, renameSync as renameSync5, lstatSync as lstatSync4, readlinkSync as readlinkSync2, symlinkSync as symlinkSync2, unlinkSync as unlinkSync8 } from "node:fs";
5153
+ import { homedir as homedir13 } from "node:os";
5154
+ import { dirname as dirname4, join as join23 } from "node:path";
4985
5155
 
4986
5156
  // dist/src/skillify/skill-writer.js
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";
5157
+ import { existsSync as existsSync17, mkdirSync as mkdirSync6, readFileSync as readFileSync14, readdirSync as readdirSync2, statSync as statSync2, writeFileSync as writeFileSync10 } from "node:fs";
5158
+ import { homedir as homedir10 } from "node:os";
5159
+ import { join as join20 } from "node:path";
4990
5160
  function assertValidSkillName(name) {
4991
5161
  if (typeof name !== "string" || name.length === 0) {
4992
5162
  throw new Error(`invalid skill name: empty or non-string`);
@@ -5002,10 +5172,10 @@ function assertValidSkillName(name) {
5002
5172
  }
5003
5173
  }
5004
5174
  function skillDir(skillsRoot, name) {
5005
- return join19(skillsRoot, name);
5175
+ return join20(skillsRoot, name);
5006
5176
  }
5007
5177
  function skillPath(skillsRoot, name) {
5008
- return join19(skillDir(skillsRoot, name), "SKILL.md");
5178
+ return join20(skillDir(skillsRoot, name), "SKILL.md");
5009
5179
  }
5010
5180
  function renderFrontmatter(fm) {
5011
5181
  const lines = ["---"];
@@ -5083,10 +5253,10 @@ function writeNewSkill(args) {
5083
5253
  assertValidSkillName(args.name);
5084
5254
  const dir = skillDir(args.skillsRoot, args.name);
5085
5255
  const path = skillPath(args.skillsRoot, args.name);
5086
- if (existsSync16(path)) {
5256
+ if (existsSync17(path)) {
5087
5257
  throw new Error(`skill already exists at ${path}; use mergeSkill`);
5088
5258
  }
5089
- mkdirSync5(dir, { recursive: true });
5259
+ mkdirSync6(dir, { recursive: true });
5090
5260
  const now = (/* @__PURE__ */ new Date()).toISOString();
5091
5261
  const author = args.author && args.author.length > 0 ? args.author : void 0;
5092
5262
  const contributors = author ? [author] : [];
@@ -5106,7 +5276,7 @@ function writeNewSkill(args) {
5106
5276
 
5107
5277
  ${args.body.trim()}
5108
5278
  `;
5109
- writeFileSync9(path, text);
5279
+ writeFileSync10(path, text);
5110
5280
  return {
5111
5281
  path,
5112
5282
  action: "created",
@@ -5118,41 +5288,41 @@ ${args.body.trim()}
5118
5288
  };
5119
5289
  }
5120
5290
  function listSkills(skillsRoot) {
5121
- if (!existsSync16(skillsRoot))
5291
+ if (!existsSync17(skillsRoot))
5122
5292
  return [];
5123
5293
  const out = [];
5124
5294
  for (const name of readdirSync2(skillsRoot)) {
5125
- const skillFile = join19(skillsRoot, name, "SKILL.md");
5126
- if (existsSync16(skillFile) && statSync2(skillFile).isFile()) {
5127
- out.push({ name, body: readFileSync12(skillFile, "utf-8") });
5295
+ const skillFile = join20(skillsRoot, name, "SKILL.md");
5296
+ if (existsSync17(skillFile) && statSync2(skillFile).isFile()) {
5297
+ out.push({ name, body: readFileSync14(skillFile, "utf-8") });
5128
5298
  }
5129
5299
  }
5130
5300
  return out;
5131
5301
  }
5132
5302
  function resolveSkillsRoot(install, cwd) {
5133
5303
  if (install === "global") {
5134
- return join19(homedir9(), ".claude", "skills");
5304
+ return join20(homedir10(), ".claude", "skills");
5135
5305
  }
5136
- return join19(cwd, ".claude", "skills");
5306
+ return join20(cwd, ".claude", "skills");
5137
5307
  }
5138
5308
 
5139
5309
  // dist/src/skillify/manifest.js
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";
5310
+ import { existsSync as existsSync18, lstatSync as lstatSync3, mkdirSync as mkdirSync7, readFileSync as readFileSync15, renameSync as renameSync4, unlinkSync as unlinkSync7, writeFileSync as writeFileSync11 } from "node:fs";
5311
+ import { homedir as homedir11 } from "node:os";
5312
+ import { dirname as dirname3, join as join21 } from "node:path";
5143
5313
  function emptyManifest() {
5144
5314
  return { version: 1, entries: [] };
5145
5315
  }
5146
5316
  function manifestPath() {
5147
- return join20(homedir10(), ".deeplake", "state", "skillify", "pulled.json");
5317
+ return join21(homedir11(), ".deeplake", "state", "skillify", "pulled.json");
5148
5318
  }
5149
5319
  function loadManifest(path = manifestPath()) {
5150
5320
  migrateLegacyStateDir();
5151
- if (!existsSync17(path))
5321
+ if (!existsSync18(path))
5152
5322
  return emptyManifest();
5153
5323
  let raw;
5154
5324
  try {
5155
- raw = readFileSync13(path, "utf-8");
5325
+ raw = readFileSync15(path, "utf-8");
5156
5326
  } catch {
5157
5327
  return emptyManifest();
5158
5328
  }
@@ -5199,10 +5369,10 @@ function loadManifest(path = manifestPath()) {
5199
5369
  }
5200
5370
  function saveManifest(m, path = manifestPath()) {
5201
5371
  migrateLegacyStateDir();
5202
- mkdirSync6(dirname2(path), { recursive: true });
5372
+ mkdirSync7(dirname3(path), { recursive: true });
5203
5373
  const tmp = `${path}.tmp`;
5204
- writeFileSync10(tmp, JSON.stringify(m, null, 2) + "\n", { mode: 384 });
5205
- renameSync3(tmp, path);
5374
+ writeFileSync11(tmp, JSON.stringify(m, null, 2) + "\n", { mode: 384 });
5375
+ renameSync4(tmp, path);
5206
5376
  }
5207
5377
  function recordPull(entry, path = manifestPath()) {
5208
5378
  const m = loadManifest(path);
@@ -5244,7 +5414,7 @@ function pruneOrphanedEntries(path = manifestPath()) {
5244
5414
  const live = [];
5245
5415
  let pruned = 0;
5246
5416
  for (const e of m.entries) {
5247
- if (existsSync17(join20(e.installRoot, e.dirName))) {
5417
+ if (existsSync18(join21(e.installRoot, e.dirName))) {
5248
5418
  live.push(e);
5249
5419
  continue;
5250
5420
  }
@@ -5257,26 +5427,26 @@ function pruneOrphanedEntries(path = manifestPath()) {
5257
5427
  }
5258
5428
 
5259
5429
  // dist/src/skillify/agent-roots.js
5260
- import { existsSync as existsSync18 } from "node:fs";
5261
- import { homedir as homedir11 } from "node:os";
5262
- import { join as join21 } from "node:path";
5430
+ import { existsSync as existsSync19 } from "node:fs";
5431
+ import { homedir as homedir12 } from "node:os";
5432
+ import { join as join22 } from "node:path";
5263
5433
  function resolveDetected(home) {
5264
5434
  const out = [];
5265
- const codexInstalled = existsSync18(join21(home, ".codex"));
5266
- const piInstalled = existsSync18(join21(home, ".pi", "agent"));
5267
- const hermesInstalled = existsSync18(join21(home, ".hermes"));
5435
+ const codexInstalled = existsSync19(join22(home, ".codex"));
5436
+ const piInstalled = existsSync19(join22(home, ".pi", "agent"));
5437
+ const hermesInstalled = existsSync19(join22(home, ".hermes"));
5268
5438
  if (codexInstalled || piInstalled) {
5269
- out.push(join21(home, ".agents", "skills"));
5439
+ out.push(join22(home, ".agents", "skills"));
5270
5440
  }
5271
5441
  if (hermesInstalled) {
5272
- out.push(join21(home, ".hermes", "skills"));
5442
+ out.push(join22(home, ".hermes", "skills"));
5273
5443
  }
5274
5444
  if (piInstalled) {
5275
- out.push(join21(home, ".pi", "agent", "skills"));
5445
+ out.push(join22(home, ".pi", "agent", "skills"));
5276
5446
  }
5277
5447
  return out;
5278
5448
  }
5279
- function detectAgentSkillsRoots(canonicalRoot, home = homedir11()) {
5449
+ function detectAgentSkillsRoots(canonicalRoot, home = homedir12()) {
5280
5450
  return resolveDetected(home).filter((p) => p !== canonicalRoot);
5281
5451
  }
5282
5452
 
@@ -5320,15 +5490,15 @@ function isMissingTableError(message) {
5320
5490
  }
5321
5491
  function resolvePullDestination(install, cwd) {
5322
5492
  if (install === "global")
5323
- return join22(homedir12(), ".claude", "skills");
5493
+ return join23(homedir13(), ".claude", "skills");
5324
5494
  if (!cwd)
5325
5495
  throw new Error("install=project requires a cwd");
5326
- return join22(cwd, ".claude", "skills");
5496
+ return join23(cwd, ".claude", "skills");
5327
5497
  }
5328
5498
  function fanOutSymlinks(canonicalDir, dirName, agentRoots) {
5329
5499
  const out = [];
5330
5500
  for (const root of agentRoots) {
5331
- const link = join22(root, dirName);
5501
+ const link = join23(root, dirName);
5332
5502
  let existing;
5333
5503
  try {
5334
5504
  existing = lstatSync4(link);
@@ -5356,7 +5526,7 @@ function fanOutSymlinks(canonicalDir, dirName, agentRoots) {
5356
5526
  }
5357
5527
  }
5358
5528
  try {
5359
- mkdirSync7(dirname3(link), { recursive: true });
5529
+ mkdirSync8(dirname4(link), { recursive: true });
5360
5530
  symlinkSync2(canonicalDir, link, "dir");
5361
5531
  out.push(link);
5362
5532
  } catch {
@@ -5371,8 +5541,8 @@ function backfillSymlinks(installRoot) {
5371
5541
  return;
5372
5542
  const detected = detectAgentSkillsRoots(installRoot);
5373
5543
  for (const entry of entries) {
5374
- const canonical = join22(entry.installRoot, entry.dirName);
5375
- if (!existsSync19(canonical))
5544
+ const canonical = join23(entry.installRoot, entry.dirName);
5545
+ if (!existsSync20(canonical))
5376
5546
  continue;
5377
5547
  const fresh = fanOutSymlinks(canonical, entry.dirName, detected);
5378
5548
  if (sameSorted(fresh, entry.symlinks))
@@ -5482,10 +5652,10 @@ function renderFrontmatter2(fm) {
5482
5652
  return lines.join("\n");
5483
5653
  }
5484
5654
  function readLocalVersion(path) {
5485
- if (!existsSync19(path))
5655
+ if (!existsSync20(path))
5486
5656
  return null;
5487
5657
  try {
5488
- const text = readFileSync14(path, "utf-8");
5658
+ const text = readFileSync16(path, "utf-8");
5489
5659
  const parsed = parseFrontmatter(text);
5490
5660
  if (!parsed)
5491
5661
  return null;
@@ -5580,8 +5750,8 @@ async function runPull(opts) {
5580
5750
  summary.skipped++;
5581
5751
  continue;
5582
5752
  }
5583
- const skillDir2 = join22(root, dirName);
5584
- const skillFile = join22(skillDir2, "SKILL.md");
5753
+ const skillDir2 = join23(root, dirName);
5754
+ const skillFile = join23(skillDir2, "SKILL.md");
5585
5755
  const remoteVersion = Number(row.version ?? 1);
5586
5756
  const localVersion = readLocalVersion(skillFile);
5587
5757
  const action = decideAction({
@@ -5592,14 +5762,14 @@ async function runPull(opts) {
5592
5762
  });
5593
5763
  let manifestError;
5594
5764
  if (action === "wrote") {
5595
- mkdirSync7(skillDir2, { recursive: true });
5596
- if (existsSync19(skillFile)) {
5765
+ mkdirSync8(skillDir2, { recursive: true });
5766
+ if (existsSync20(skillFile)) {
5597
5767
  try {
5598
- renameSync4(skillFile, `${skillFile}.bak`);
5768
+ renameSync5(skillFile, `${skillFile}.bak`);
5599
5769
  } catch {
5600
5770
  }
5601
5771
  }
5602
- writeFileSync11(skillFile, renderSkillFile(row));
5772
+ writeFileSync12(skillFile, renderSkillFile(row));
5603
5773
  const symlinks = opts.install === "global" ? fanOutSymlinks(skillDir2, dirName, detectAgentSkillsRoots(root)) : [];
5604
5774
  try {
5605
5775
  recordPull({
@@ -5641,15 +5811,15 @@ async function runPull(opts) {
5641
5811
  }
5642
5812
 
5643
5813
  // dist/src/skillify/unpull.js
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";
5814
+ import { existsSync as existsSync21, readdirSync as readdirSync3, rmSync as rmSync5, statSync as statSync3 } from "node:fs";
5815
+ import { homedir as homedir14 } from "node:os";
5816
+ import { join as join24 } from "node:path";
5647
5817
  function resolveUnpullRoot(install, cwd) {
5648
5818
  if (install === "global")
5649
- return join23(homedir13(), ".claude", "skills");
5819
+ return join24(homedir14(), ".claude", "skills");
5650
5820
  if (!cwd)
5651
5821
  throw new Error("cwd required when install === 'project'");
5652
- return join23(cwd, ".claude", "skills");
5822
+ return join24(cwd, ".claude", "skills");
5653
5823
  }
5654
5824
  function runUnpull(opts) {
5655
5825
  const root = resolveUnpullRoot(opts.install, opts.cwd);
@@ -5672,8 +5842,8 @@ function runUnpull(opts) {
5672
5842
  const entries = entriesForRoot(manifest, opts.install, root);
5673
5843
  for (const entry of entries) {
5674
5844
  summary.scanned++;
5675
- const path = join23(root, entry.dirName);
5676
- if (!existsSync20(path)) {
5845
+ const path = join24(root, entry.dirName);
5846
+ if (!existsSync21(path)) {
5677
5847
  if (!opts.dryRun) {
5678
5848
  unlinkSymlinks(entry.symlinks);
5679
5849
  removePullEntry(opts.install, entry.installRoot, entry.dirName);
@@ -5726,12 +5896,12 @@ function runUnpull(opts) {
5726
5896
  }
5727
5897
  summary.entries.push(result);
5728
5898
  }
5729
- if (existsSync20(root) && (opts.all || opts.legacyCleanup)) {
5899
+ if (existsSync21(root) && (opts.all || opts.legacyCleanup)) {
5730
5900
  const manifestDirNames = new Set(entries.map((e) => e.dirName));
5731
5901
  for (const dirName of readdirSync3(root)) {
5732
5902
  if (manifestDirNames.has(dirName))
5733
5903
  continue;
5734
- const path = join23(root, dirName);
5904
+ const path = join24(root, dirName);
5735
5905
  let st;
5736
5906
  try {
5737
5907
  st = statSync3(path);
@@ -5810,30 +5980,30 @@ function decideTargetForManifestEntry(entry, opts, userFilter, haveUserFilter) {
5810
5980
 
5811
5981
  // dist/src/commands/mine-local.js
5812
5982
  import { spawn } from "node:child_process";
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";
5983
+ import { existsSync as existsSync25, mkdirSync as mkdirSync10, readFileSync as readFileSync19, writeFileSync as writeFileSync14 } from "node:fs";
5984
+ import { homedir as homedir18 } from "node:os";
5985
+ import { basename, dirname as dirname6, join as join28 } from "node:path";
5816
5986
 
5817
5987
  // dist/src/skillify/local-source.js
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();
5988
+ import { readdirSync as readdirSync4, readFileSync as readFileSync17, existsSync as existsSync22, statSync as statSync4 } from "node:fs";
5989
+ import { homedir as homedir15 } from "node:os";
5990
+ import { join as join25 } from "node:path";
5991
+ var HOME2 = homedir15();
5822
5992
  function encodeCwdClaudeCode(cwd) {
5823
5993
  return cwd.replace(/[/_]/g, "-");
5824
5994
  }
5825
5995
  function detectInstalledAgents() {
5826
5996
  const installs = [];
5827
- const claudeRoot = join24(HOME2, ".claude", "projects");
5828
- if (existsSync21(claudeRoot)) {
5997
+ const claudeRoot = join25(HOME2, ".claude", "projects");
5998
+ if (existsSync22(claudeRoot)) {
5829
5999
  installs.push({
5830
6000
  agent: "claude_code",
5831
6001
  sessionRoot: claudeRoot,
5832
6002
  encodeCwd: encodeCwdClaudeCode
5833
6003
  });
5834
6004
  }
5835
- const codexRoot = join24(HOME2, ".codex", "sessions");
5836
- if (existsSync21(codexRoot)) {
6005
+ const codexRoot = join25(HOME2, ".codex", "sessions");
6006
+ if (existsSync22(codexRoot)) {
5837
6007
  installs.push({
5838
6008
  agent: "codex",
5839
6009
  sessionRoot: codexRoot,
@@ -5860,7 +6030,7 @@ function listLocalSessions(installs, cwd) {
5860
6030
  continue;
5861
6031
  }
5862
6032
  for (const sub of subdirs) {
5863
- const subdirPath = join24(install.sessionRoot, sub);
6033
+ const subdirPath = join25(install.sessionRoot, sub);
5864
6034
  try {
5865
6035
  if (!statSync4(subdirPath).isDirectory())
5866
6036
  continue;
@@ -5877,7 +6047,7 @@ function listLocalSessions(installs, cwd) {
5877
6047
  for (const f of files) {
5878
6048
  if (!f.endsWith(".jsonl"))
5879
6049
  continue;
5880
- const fullPath = join24(subdirPath, f);
6050
+ const fullPath = join25(subdirPath, f);
5881
6051
  let stats;
5882
6052
  try {
5883
6053
  stats = statSync4(fullPath);
@@ -5938,7 +6108,7 @@ function pickSessions(candidates, opts) {
5938
6108
  function nativeJsonlToRows(filePath, sessionId, agent) {
5939
6109
  let raw;
5940
6110
  try {
5941
- raw = readFileSync15(filePath, "utf-8");
6111
+ raw = readFileSync17(filePath, "utf-8");
5942
6112
  } catch {
5943
6113
  return [];
5944
6114
  }
@@ -6028,22 +6198,22 @@ function extractPairs(rows) {
6028
6198
  }
6029
6199
 
6030
6200
  // dist/src/skillify/gate-runner.js
6031
- import { existsSync as existsSync22 } from "node:fs";
6201
+ import { existsSync as existsSync23 } from "node:fs";
6032
6202
  import { createRequire } from "node:module";
6033
- import { homedir as homedir15 } from "node:os";
6034
- import { join as join25 } from "node:path";
6203
+ import { homedir as homedir16 } from "node:os";
6204
+ import { join as join26 } from "node:path";
6035
6205
  var requireForCp = createRequire(import.meta.url);
6036
6206
  var { execFileSync: runChildProcess } = requireForCp("node:child_process");
6037
6207
  var inheritedEnv = process;
6038
6208
  function firstExistingPath(candidates) {
6039
6209
  for (const c of candidates) {
6040
- if (existsSync22(c))
6210
+ if (existsSync23(c))
6041
6211
  return c;
6042
6212
  }
6043
6213
  return null;
6044
6214
  }
6045
6215
  function findAgentBin(agent) {
6046
- const home = homedir15();
6216
+ const home = homedir16();
6047
6217
  switch (agent) {
6048
6218
  // /usr/bin/<name> is included in every candidate list — that's the
6049
6219
  // common Linux package-manager install path (apt, dnf, pacman). Old
@@ -6052,45 +6222,45 @@ function findAgentBin(agent) {
6052
6222
  // #170 caught the gap.
6053
6223
  case "claude_code":
6054
6224
  return firstExistingPath([
6055
- join25(home, ".claude", "local", "claude"),
6225
+ join26(home, ".claude", "local", "claude"),
6056
6226
  "/usr/local/bin/claude",
6057
6227
  "/usr/bin/claude",
6058
- join25(home, ".npm-global", "bin", "claude"),
6059
- join25(home, ".local", "bin", "claude"),
6228
+ join26(home, ".npm-global", "bin", "claude"),
6229
+ join26(home, ".local", "bin", "claude"),
6060
6230
  "/opt/homebrew/bin/claude"
6061
- ]) ?? join25(home, ".claude", "local", "claude");
6231
+ ]) ?? join26(home, ".claude", "local", "claude");
6062
6232
  case "codex":
6063
6233
  return firstExistingPath([
6064
6234
  "/usr/local/bin/codex",
6065
6235
  "/usr/bin/codex",
6066
- join25(home, ".npm-global", "bin", "codex"),
6067
- join25(home, ".local", "bin", "codex"),
6236
+ join26(home, ".npm-global", "bin", "codex"),
6237
+ join26(home, ".local", "bin", "codex"),
6068
6238
  "/opt/homebrew/bin/codex"
6069
6239
  ]) ?? "/usr/local/bin/codex";
6070
6240
  case "cursor":
6071
6241
  return firstExistingPath([
6072
6242
  "/usr/local/bin/cursor-agent",
6073
6243
  "/usr/bin/cursor-agent",
6074
- join25(home, ".npm-global", "bin", "cursor-agent"),
6075
- join25(home, ".local", "bin", "cursor-agent"),
6244
+ join26(home, ".npm-global", "bin", "cursor-agent"),
6245
+ join26(home, ".local", "bin", "cursor-agent"),
6076
6246
  "/opt/homebrew/bin/cursor-agent"
6077
6247
  ]) ?? "/usr/local/bin/cursor-agent";
6078
6248
  case "hermes":
6079
6249
  return firstExistingPath([
6080
- join25(home, ".local", "bin", "hermes"),
6250
+ join26(home, ".local", "bin", "hermes"),
6081
6251
  "/usr/local/bin/hermes",
6082
6252
  "/usr/bin/hermes",
6083
- join25(home, ".npm-global", "bin", "hermes"),
6253
+ join26(home, ".npm-global", "bin", "hermes"),
6084
6254
  "/opt/homebrew/bin/hermes"
6085
- ]) ?? join25(home, ".local", "bin", "hermes");
6255
+ ]) ?? join26(home, ".local", "bin", "hermes");
6086
6256
  case "pi":
6087
6257
  return firstExistingPath([
6088
- join25(home, ".local", "bin", "pi"),
6258
+ join26(home, ".local", "bin", "pi"),
6089
6259
  "/usr/local/bin/pi",
6090
6260
  "/usr/bin/pi",
6091
- join25(home, ".npm-global", "bin", "pi"),
6261
+ join26(home, ".npm-global", "bin", "pi"),
6092
6262
  "/opt/homebrew/bin/pi"
6093
- ]) ?? join25(home, ".local", "bin", "pi");
6263
+ ]) ?? join26(home, ".local", "bin", "pi");
6094
6264
  }
6095
6265
  }
6096
6266
 
@@ -6120,23 +6290,23 @@ function extractJsonBlock(s) {
6120
6290
  }
6121
6291
 
6122
6292
  // dist/src/skillify/local-manifest.js
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");
6293
+ import { existsSync as existsSync24, mkdirSync as mkdirSync9, readFileSync as readFileSync18, writeFileSync as writeFileSync13 } from "node:fs";
6294
+ import { homedir as homedir17 } from "node:os";
6295
+ import { dirname as dirname5, join as join27 } from "node:path";
6296
+ var LOCAL_MANIFEST_PATH = join27(homedir17(), ".claude", "hivemind", "local-mined.json");
6297
+ var LOCAL_MINE_LOCK_PATH = join27(homedir17(), ".claude", "hivemind", "local-mined.lock");
6128
6298
  function readLocalManifest(path = LOCAL_MANIFEST_PATH) {
6129
- if (!existsSync23(path))
6299
+ if (!existsSync24(path))
6130
6300
  return null;
6131
6301
  try {
6132
- return JSON.parse(readFileSync16(path, "utf-8"));
6302
+ return JSON.parse(readFileSync18(path, "utf-8"));
6133
6303
  } catch {
6134
6304
  return null;
6135
6305
  }
6136
6306
  }
6137
6307
  function writeLocalManifest(m, path = LOCAL_MANIFEST_PATH) {
6138
- mkdirSync8(dirname4(path), { recursive: true });
6139
- writeFileSync12(path, JSON.stringify(m, null, 2));
6308
+ mkdirSync9(dirname5(path), { recursive: true });
6309
+ writeFileSync13(path, JSON.stringify(m, null, 2));
6140
6310
  }
6141
6311
 
6142
6312
  // dist/src/commands/mine-local.js
@@ -6161,7 +6331,7 @@ function runGateViaStdin(opts) {
6161
6331
  });
6162
6332
  return;
6163
6333
  }
6164
- if (!existsSync24(opts.bin)) {
6334
+ if (!existsSync25(opts.bin)) {
6165
6335
  resolve({
6166
6336
  stdout: "",
6167
6337
  stderr: "",
@@ -6506,8 +6676,8 @@ async function runMineLocalImpl(args) {
6506
6676
  console.log(`Dry-run: would invoke ${gateAgent} gate on ${picked.length} session(s) in parallel (concurrency=${GATE_CONCURRENCY}).`);
6507
6677
  return;
6508
6678
  }
6509
- const tmpDir = join27(homedir17(), ".claude", "hivemind", `mine-local-${Date.now()}`);
6510
- mkdirSync9(tmpDir, { recursive: true });
6679
+ const tmpDir = join28(homedir18(), ".claude", "hivemind", `mine-local-${Date.now()}`);
6680
+ mkdirSync10(tmpDir, { recursive: true });
6511
6681
  console.log(`Running ${picked.length} gate call(s) in parallel (concurrency=${GATE_CONCURRENCY}, timeout=${GATE_TIMEOUT_MS / 1e3}s each)...`);
6512
6682
  const results = await parallelMap(picked, GATE_CONCURRENCY, async (s) => {
6513
6683
  const shortId = s.sessionId.slice(0, 8);
@@ -6518,23 +6688,23 @@ async function runMineLocalImpl(args) {
6518
6688
  return { session: s, skills: [], reason: "no pairs", error: null };
6519
6689
  }
6520
6690
  const tail = pairs2.slice(-PER_SESSION_PAIR_CAP);
6521
- const sessionTmp = join27(tmpDir, `s-${shortId}`);
6522
- mkdirSync9(sessionTmp, { recursive: true });
6523
- const verdictPath = join27(sessionTmp, "verdict.json");
6691
+ const sessionTmp = join28(tmpDir, `s-${shortId}`);
6692
+ mkdirSync10(sessionTmp, { recursive: true });
6693
+ const verdictPath = join28(sessionTmp, "verdict.json");
6524
6694
  const prompt = buildSessionPrompt(tail, s, verdictPath);
6525
- writeFileSync13(join27(sessionTmp, "prompt.txt"), prompt);
6695
+ writeFileSync14(join28(sessionTmp, "prompt.txt"), prompt);
6526
6696
  const gate = await runGateViaStdin({ agent: gateAgent, bin: gateBin, prompt, timeoutMs: GATE_TIMEOUT_MS });
6527
6697
  try {
6528
- writeFileSync13(join27(sessionTmp, "gate-stdout.txt"), gate.stdout);
6698
+ writeFileSync14(join28(sessionTmp, "gate-stdout.txt"), gate.stdout);
6529
6699
  if (gate.stderr)
6530
- writeFileSync13(join27(sessionTmp, "gate-stderr.txt"), gate.stderr);
6700
+ writeFileSync14(join28(sessionTmp, "gate-stderr.txt"), gate.stderr);
6531
6701
  } catch {
6532
6702
  }
6533
6703
  if (gate.errored) {
6534
6704
  console.log(` [${shortId}] gate failed: ${gate.errorMessage}`);
6535
6705
  return { session: s, skills: [], reason: null, error: gate.errorMessage ?? "gate failed" };
6536
6706
  }
6537
- const verdictText = existsSync24(verdictPath) ? readFileSync17(verdictPath, "utf-8") : gate.stdout;
6707
+ const verdictText = existsSync25(verdictPath) ? readFileSync19(verdictPath, "utf-8") : gate.stdout;
6538
6708
  const mv = parseMultiVerdict(verdictText);
6539
6709
  if (!mv) {
6540
6710
  console.log(` [${shortId}] unparseable verdict (kept at ${sessionTmp})`);
@@ -6586,7 +6756,7 @@ async function runMineLocalImpl(args) {
6586
6756
  sourceSessions: [session.sessionId],
6587
6757
  agent: gateAgent
6588
6758
  });
6589
- const canonicalDir = dirname5(result.path);
6759
+ const canonicalDir = dirname6(result.path);
6590
6760
  const symlinks = fanOutRoots.length > 0 ? fanOutSymlinks(canonicalDir, basename(canonicalDir), fanOutRoots) : [];
6591
6761
  const symlinkSuffix = symlinks.length > 0 ? `, fan-out \u2192 ${symlinks.length} root(s)` : "";
6592
6762
  console.log(` wrote ${skill.name} \u2190 session ${session.sessionId.slice(0, 8)} (${session.agent}${symlinkSuffix})`);
@@ -6750,7 +6920,7 @@ function wrapAt(s, max) {
6750
6920
 
6751
6921
  // dist/src/commands/skillify.js
6752
6922
  function stateDir() {
6753
- return join28(homedir18(), ".deeplake", "state", "skillify");
6923
+ return join29(homedir19(), ".deeplake", "state", "skillify");
6754
6924
  }
6755
6925
  function showStatus() {
6756
6926
  const cfg = loadScopeConfig();
@@ -6758,7 +6928,7 @@ function showStatus() {
6758
6928
  console.log(`team: ${cfg.team.length === 0 ? "(empty)" : cfg.team.join(", ")}`);
6759
6929
  console.log(`install: ${cfg.install} (${cfg.install === "global" ? "~/.claude/skills/" : "<project>/.claude/skills/"})`);
6760
6930
  const dir = stateDir();
6761
- if (!existsSync25(dir)) {
6931
+ if (!existsSync26(dir)) {
6762
6932
  console.log(`state: (no projects tracked yet)`);
6763
6933
  return;
6764
6934
  }
@@ -6770,7 +6940,7 @@ function showStatus() {
6770
6940
  console.log(`state: ${files.length} project(s) tracked`);
6771
6941
  for (const f of files) {
6772
6942
  try {
6773
- const s = JSON.parse(readFileSync18(join28(dir, f), "utf-8"));
6943
+ const s = JSON.parse(readFileSync20(join29(dir, f), "utf-8"));
6774
6944
  const last = typeof s.updatedAt === "number" ? new Date(s.updatedAt).toISOString() : s.lastDate ?? "never";
6775
6945
  const skills = Array.isArray(s.skillsGenerated) && s.skillsGenerated.length > 0 ? s.skillsGenerated.join(", ") : "none";
6776
6946
  console.log(` - ${s.project} (counter=${s.counter}, last=${last}, skills=${skills})`);
@@ -6797,7 +6967,7 @@ function setInstall(loc) {
6797
6967
  }
6798
6968
  const cfg = loadScopeConfig();
6799
6969
  saveScopeConfig({ ...cfg, install: loc });
6800
- const path = loc === "global" ? join28(homedir18(), ".claude", "skills") : "<cwd>/.claude/skills";
6970
+ const path = loc === "global" ? join29(homedir19(), ".claude", "skills") : "<cwd>/.claude/skills";
6801
6971
  console.log(`Install location set to '${loc}'. New skills will be written to ${path}/<name>/SKILL.md.`);
6802
6972
  }
6803
6973
  function promoteSkill(name, cwd) {
@@ -6805,18 +6975,18 @@ function promoteSkill(name, cwd) {
6805
6975
  console.error("Usage: hivemind skillify promote <skill-name>");
6806
6976
  process.exit(1);
6807
6977
  }
6808
- const projectPath = join28(cwd, ".claude", "skills", name);
6809
- const globalPath = join28(homedir18(), ".claude", "skills", name);
6810
- if (!existsSync25(join28(projectPath, "SKILL.md"))) {
6978
+ const projectPath = join29(cwd, ".claude", "skills", name);
6979
+ const globalPath = join29(homedir19(), ".claude", "skills", name);
6980
+ if (!existsSync26(join29(projectPath, "SKILL.md"))) {
6811
6981
  console.error(`Skill '${name}' not found at ${projectPath}/SKILL.md`);
6812
6982
  process.exit(1);
6813
6983
  }
6814
- if (existsSync25(join28(globalPath, "SKILL.md"))) {
6984
+ if (existsSync26(join29(globalPath, "SKILL.md"))) {
6815
6985
  console.error(`Skill '${name}' already exists at ${globalPath}/SKILL.md \u2014 refusing to overwrite. Remove it first or rename the project skill.`);
6816
6986
  process.exit(1);
6817
6987
  }
6818
- mkdirSync10(dirname6(globalPath), { recursive: true });
6819
- renameSync5(projectPath, globalPath);
6988
+ mkdirSync11(dirname7(globalPath), { recursive: true });
6989
+ renameSync6(projectPath, globalPath);
6820
6990
  console.log(`Promoted '${name}' from ${projectPath} \u2192 ${globalPath}.`);
6821
6991
  }
6822
6992
  function teamAdd(name) {
@@ -6922,7 +7092,7 @@ async function pullSkills(args) {
6922
7092
  console.error(`pull failed: ${e?.message ?? e}`);
6923
7093
  process.exit(1);
6924
7094
  }
6925
- const dest = toRaw === "global" ? join28(homedir18(), ".claude", "skills") : `${process.cwd()}/.claude/skills`;
7095
+ const dest = toRaw === "global" ? join29(homedir19(), ".claude", "skills") : `${process.cwd()}/.claude/skills`;
6926
7096
  const filterDesc = users.length === 0 ? "all users" : users.join(", ");
6927
7097
  console.log(`Destination: ${dest}`);
6928
7098
  console.log(`Filter: ${filterDesc}${skillName ? ` \xB7 skill='${skillName}'` : ""}${dryRun ? " \xB7 dry-run" : ""}${force ? " \xB7 force" : ""}`);
@@ -6972,7 +7142,7 @@ async function unpullSkills(args) {
6972
7142
  all,
6973
7143
  legacyCleanup
6974
7144
  });
6975
- const dest = toRaw === "global" ? join28(homedir18(), ".claude", "skills") : `${process.cwd()}/.claude/skills`;
7145
+ const dest = toRaw === "global" ? join29(homedir19(), ".claude", "skills") : `${process.cwd()}/.claude/skills`;
6976
7146
  const filterParts = [];
6977
7147
  if (users.length > 0)
6978
7148
  filterParts.push(`users=${users.join(",")}`);
@@ -7068,13 +7238,13 @@ if (process.argv[1] && process.argv[1].endsWith("skillify.js")) {
7068
7238
 
7069
7239
  // dist/src/cli/update.js
7070
7240
  import { execFileSync as execFileSync4 } from "node:child_process";
7071
- import { existsSync as existsSync26, readFileSync as readFileSync20, realpathSync } from "node:fs";
7072
- import { dirname as dirname8, sep } from "node:path";
7241
+ import { existsSync as existsSync27, readFileSync as readFileSync22, realpathSync } from "node:fs";
7242
+ import { dirname as dirname9, sep } from "node:path";
7073
7243
  import { fileURLToPath as fileURLToPath2 } from "node:url";
7074
7244
 
7075
7245
  // dist/src/utils/version-check.js
7076
- import { readFileSync as readFileSync19 } from "node:fs";
7077
- import { dirname as dirname7, join as join29 } from "node:path";
7246
+ import { readFileSync as readFileSync21 } from "node:fs";
7247
+ import { dirname as dirname8, join as join30 } from "node:path";
7078
7248
  function isNewer(latest, current) {
7079
7249
  const parse = (v) => v.split(".").map(Number);
7080
7250
  const [la, lb, lc] = parse(latest);
@@ -7093,24 +7263,24 @@ function detectInstallKind(argv1) {
7093
7263
  return argv1 ?? process.argv[1] ?? fileURLToPath2(import.meta.url);
7094
7264
  }
7095
7265
  })();
7096
- let dir = dirname8(realArgv1);
7266
+ let dir = dirname9(realArgv1);
7097
7267
  let installDir = null;
7098
7268
  for (let i = 0; i < 10; i++) {
7099
7269
  const pkgPath = `${dir}${sep}package.json`;
7100
7270
  try {
7101
- const pkg = JSON.parse(readFileSync20(pkgPath, "utf-8"));
7271
+ const pkg = JSON.parse(readFileSync22(pkgPath, "utf-8"));
7102
7272
  if (pkg.name === PKG_NAME || pkg.name === "hivemind") {
7103
7273
  installDir = dir;
7104
7274
  break;
7105
7275
  }
7106
7276
  } catch {
7107
7277
  }
7108
- const parent = dirname8(dir);
7278
+ const parent = dirname9(dir);
7109
7279
  if (parent === dir)
7110
7280
  break;
7111
7281
  dir = parent;
7112
7282
  }
7113
- installDir ??= dirname8(realArgv1);
7283
+ installDir ??= dirname9(realArgv1);
7114
7284
  if (realArgv1.includes(`${sep}_npx${sep}`) || realArgv1.includes(`${sep}.npx${sep}`)) {
7115
7285
  return { kind: "npx", installDir };
7116
7286
  }
@@ -7119,10 +7289,10 @@ function detectInstallKind(argv1) {
7119
7289
  }
7120
7290
  let gitDir = installDir;
7121
7291
  for (let i = 0; i < 6; i++) {
7122
- if (existsSync26(`${gitDir}${sep}.git`)) {
7292
+ if (existsSync27(`${gitDir}${sep}.git`)) {
7123
7293
  return { kind: "local-dev", installDir };
7124
7294
  }
7125
- const parent = dirname8(gitDir);
7295
+ const parent = dirname9(gitDir);
7126
7296
  if (parent === gitDir)
7127
7297
  break;
7128
7298
  gitDir = parent;
@@ -7265,12 +7435,28 @@ Usage:
7265
7435
 
7266
7436
  Semantic search (embeddings):
7267
7437
  hivemind embeddings install Download @huggingface/transformers
7268
- once (~600 MB) into a shared dir
7269
- and symlink every detected agent
7270
- plugin to it. Idempotent.
7271
- hivemind embeddings uninstall [--prune] Remove the per-agent symlinks.
7272
- --prune also deletes the shared dir.
7273
- hivemind embeddings status Show shared-deps + per-agent state.
7438
+ once (~600 MB) into a shared dir,
7439
+ symlink every detected agent
7440
+ plugin to it, and set
7441
+ embeddings.enabled = true in
7442
+ ~/.deeplake/config.json. Idempotent.
7443
+ hivemind embeddings enable Light opt-in: flip
7444
+ embeddings.enabled = true in
7445
+ ~/.deeplake/config.json. Use this
7446
+ after \`disable\` to turn back on
7447
+ without re-running install.
7448
+ hivemind embeddings disable Light opt-out: flip
7449
+ embeddings.enabled = false and
7450
+ SIGTERM the running daemon. Shared
7451
+ deps stay on disk.
7452
+ hivemind embeddings uninstall [--prune] Full opt-out: remove the per-agent
7453
+ symlinks, flip
7454
+ embeddings.enabled = false, and
7455
+ SIGTERM the daemon. --prune also
7456
+ deletes the shared dir to reclaim
7457
+ ~600 MB.
7458
+ hivemind embeddings status Show config + shared-deps + per-
7459
+ agent state.
7274
7460
 
7275
7461
  Add --with-embeddings to "hivemind install" (or "hivemind <agent> install")
7276
7462
  to run "embeddings install" automatically after installing the agent(s).
@@ -7340,7 +7526,7 @@ async function runInstallAll(args) {
7340
7526
  runSingleInstall(id);
7341
7527
  if (withEmbeddings) {
7342
7528
  log("");
7343
- enableEmbeddings();
7529
+ installEmbeddings();
7344
7530
  }
7345
7531
  await maybeShowOrgChoice();
7346
7532
  log("");
@@ -7433,19 +7619,27 @@ async function main() {
7433
7619
  }
7434
7620
  if (cmd === "embeddings") {
7435
7621
  const sub = args[1];
7436
- if (sub === "install" || sub === "enable") {
7622
+ if (sub === "install") {
7623
+ installEmbeddings();
7624
+ return;
7625
+ }
7626
+ if (sub === "enable") {
7437
7627
  enableEmbeddings();
7438
7628
  return;
7439
7629
  }
7440
- if (sub === "uninstall" || sub === "disable") {
7441
- disableEmbeddings({ prune: hasFlag(args.slice(2), "--prune") });
7630
+ if (sub === "disable") {
7631
+ disableEmbeddings();
7632
+ return;
7633
+ }
7634
+ if (sub === "uninstall") {
7635
+ uninstallEmbeddings({ prune: hasFlag(args.slice(2), "--prune") });
7442
7636
  return;
7443
7637
  }
7444
7638
  if (sub === "status") {
7445
7639
  statusEmbeddings();
7446
7640
  return;
7447
7641
  }
7448
- warn("Usage: hivemind embeddings install | uninstall [--prune] | status");
7642
+ warn("Usage: hivemind embeddings install | enable | disable | uninstall [--prune] | status");
7449
7643
  process.exit(1);
7450
7644
  }
7451
7645
  if (AUTH_SUBCOMMANDS.has(cmd)) {
@@ -7459,7 +7653,7 @@ async function main() {
7459
7653
  runSingleInstall(cmd);
7460
7654
  if (hasFlag(args.slice(2), "--with-embeddings")) {
7461
7655
  log("");
7462
- enableEmbeddings();
7656
+ installEmbeddings();
7463
7657
  }
7464
7658
  } else if (sub === "uninstall")
7465
7659
  runSingleUninstall(cmd);