@deeplake/hivemind 0.7.79 → 0.7.81

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.
Files changed (46) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/bundle/cli.js +140 -94
  4. package/codex/bundle/capture.js +232 -72
  5. package/codex/bundle/commands/auth-login.js +14 -10
  6. package/codex/bundle/embeddings/embed-daemon.js +9 -5
  7. package/codex/bundle/graph-on-stop.js +32 -28
  8. package/codex/bundle/graph-pull-worker.js +27 -23
  9. package/codex/bundle/pre-tool-use.js +366 -123
  10. package/codex/bundle/session-start-setup.js +18 -14
  11. package/codex/bundle/session-start.js +26 -22
  12. package/codex/bundle/shell/deeplake-shell.js +30 -26
  13. package/codex/bundle/skillify-worker.js +14 -10
  14. package/codex/bundle/skillopt-worker.js +2061 -0
  15. package/codex/bundle/stop.js +50 -45
  16. package/codex/bundle/wiki-worker.js +18 -14
  17. package/cursor/bundle/capture.js +71 -44
  18. package/cursor/bundle/commands/auth-login.js +14 -10
  19. package/cursor/bundle/embeddings/embed-daemon.js +9 -5
  20. package/cursor/bundle/graph-on-stop.js +32 -28
  21. package/cursor/bundle/graph-pull-worker.js +27 -23
  22. package/cursor/bundle/pre-tool-use.js +28 -24
  23. package/cursor/bundle/session-end.js +40 -36
  24. package/cursor/bundle/session-start.js +39 -35
  25. package/cursor/bundle/shell/deeplake-shell.js +30 -26
  26. package/cursor/bundle/skillify-worker.js +14 -10
  27. package/cursor/bundle/wiki-worker.js +18 -14
  28. package/hermes/bundle/capture.js +235 -85
  29. package/hermes/bundle/commands/auth-login.js +14 -10
  30. package/hermes/bundle/embeddings/embed-daemon.js +9 -5
  31. package/hermes/bundle/graph-on-stop.js +32 -28
  32. package/hermes/bundle/graph-pull-worker.js +27 -23
  33. package/hermes/bundle/pre-tool-use.js +298 -74
  34. package/hermes/bundle/session-end.js +40 -36
  35. package/hermes/bundle/session-start.js +39 -35
  36. package/hermes/bundle/shell/deeplake-shell.js +30 -26
  37. package/hermes/bundle/skillify-worker.js +14 -10
  38. package/hermes/bundle/skillopt-worker.js +2061 -0
  39. package/hermes/bundle/wiki-worker.js +18 -14
  40. package/mcp/bundle/server.js +15 -11
  41. package/openclaw/dist/index.js +11 -7
  42. package/openclaw/dist/skillify-worker.js +14 -10
  43. package/openclaw/openclaw.plugin.json +1 -1
  44. package/openclaw/package.json +1 -1
  45. package/package.json +1 -1
  46. package/pi/extension-source/hivemind.ts +93 -0
@@ -17,7 +17,7 @@ __export(index_marker_store_exports, {
17
17
  hasFreshIndexMarker: () => hasFreshIndexMarker,
18
18
  writeIndexMarker: () => writeIndexMarker
19
19
  });
20
- import { existsSync as existsSync2, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
20
+ import { existsSync as existsSync2, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
21
21
  import { join as join5 } from "node:path";
22
22
  import { tmpdir } from "node:os";
23
23
  function getIndexMarkerDir() {
@@ -41,7 +41,7 @@ function hasFreshIndexMarker(markerPath) {
41
41
  }
42
42
  }
43
43
  function writeIndexMarker(markerPath) {
44
- mkdirSync3(getIndexMarkerDir(), { recursive: true });
44
+ mkdirSync4(getIndexMarkerDir(), { recursive: true });
45
45
  writeFileSync3(markerPath, JSON.stringify({ updatedAt: (/* @__PURE__ */ new Date()).toISOString() }), "utf-8");
46
46
  }
47
47
  var INDEX_MARKER_TTL_MS;
@@ -120,8 +120,8 @@ function loadConfig() {
120
120
  import { randomUUID } from "node:crypto";
121
121
 
122
122
  // dist/src/utils/debug.js
123
- import { appendFileSync } from "node:fs";
124
- import { join as join2 } from "node:path";
123
+ import { appendFileSync, mkdirSync } from "node:fs";
124
+ import { dirname, join as join2 } from "node:path";
125
125
  import { homedir as homedir2 } from "node:os";
126
126
  var LOG = join2(homedir2(), ".deeplake", "hook-debug.log");
127
127
  function isDebug() {
@@ -133,8 +133,12 @@ function utcTimestamp(d = /* @__PURE__ */ new Date()) {
133
133
  function log(tag, msg) {
134
134
  if (!isDebug())
135
135
  return;
136
- appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
136
+ try {
137
+ mkdirSync(dirname(LOG), { recursive: true });
138
+ appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
137
139
  `);
140
+ } catch {
141
+ }
138
142
  }
139
143
 
140
144
  // dist/src/utils/sql.js
@@ -340,7 +344,7 @@ async function healMissingColumns(args) {
340
344
  }
341
345
 
342
346
  // dist/src/notifications/queue.js
343
- import { readFileSync as readFileSync2, writeFileSync, renameSync, mkdirSync, openSync, closeSync, unlinkSync, statSync } from "node:fs";
347
+ import { readFileSync as readFileSync2, writeFileSync, renameSync, mkdirSync as mkdirSync2, openSync, closeSync, unlinkSync, statSync } from "node:fs";
344
348
  import { join as join3, resolve } from "node:path";
345
349
  import { homedir as homedir3 } from "node:os";
346
350
  import { setTimeout as sleep } from "node:timers/promises";
@@ -378,14 +382,14 @@ function writeQueue(q) {
378
382
  if (!_isQueuePathInsideHome(path, home)) {
379
383
  throw new Error(`notifications-queue write blocked: ${path} is outside ${home}`);
380
384
  }
381
- mkdirSync(join3(home, ".deeplake"), { recursive: true, mode: 448 });
385
+ mkdirSync2(join3(home, ".deeplake"), { recursive: true, mode: 448 });
382
386
  const tmp = `${path}.${process.pid}.tmp`;
383
387
  writeFileSync(tmp, JSON.stringify(q, null, 2), { mode: 384 });
384
388
  renameSync(tmp, path);
385
389
  }
386
390
  async function withQueueLock(fn) {
387
391
  const path = lockPath();
388
- mkdirSync(join3(homedir3(), ".deeplake"), { recursive: true, mode: 448 });
392
+ mkdirSync2(join3(homedir3(), ".deeplake"), { recursive: true, mode: 448 });
389
393
  let fd = null;
390
394
  for (let attempt = 0; attempt < LOCK_RETRY_MAX; attempt++) {
391
395
  try {
@@ -441,7 +445,7 @@ async function enqueueNotification(n) {
441
445
  }
442
446
 
443
447
  // dist/src/commands/auth-creds.js
444
- import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2, unlinkSync as unlinkSync2 } from "node:fs";
448
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync3, unlinkSync as unlinkSync2 } from "node:fs";
445
449
  import { join as join4 } from "node:path";
446
450
  import { homedir as homedir4 } from "node:os";
447
451
  function configDir() {
@@ -1394,9 +1398,9 @@ import { join as join8 } from "node:path";
1394
1398
  import { pathToFileURL } from "node:url";
1395
1399
 
1396
1400
  // dist/src/user-config.js
1397
- import { existsSync as existsSync4, mkdirSync as mkdirSync4, readFileSync as readFileSync6, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "node:fs";
1401
+ import { existsSync as existsSync4, mkdirSync as mkdirSync5, readFileSync as readFileSync6, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "node:fs";
1398
1402
  import { homedir as homedir6 } from "node:os";
1399
- import { dirname, join as join7 } from "node:path";
1403
+ import { dirname as dirname2, join as join7 } from "node:path";
1400
1404
  var _configPath = () => process.env.HIVEMIND_CONFIG_PATH ?? join7(homedir6(), ".deeplake", "config.json");
1401
1405
  var _cache = null;
1402
1406
  var _migrated = false;
@@ -1421,9 +1425,9 @@ function writeUserConfig(patch) {
1421
1425
  const current = readUserConfig();
1422
1426
  const merged = deepMerge(current, patch);
1423
1427
  const path = _configPath();
1424
- const dir = dirname(path);
1428
+ const dir = dirname2(path);
1425
1429
  if (!existsSync4(dir))
1426
- mkdirSync4(dir, { recursive: true });
1430
+ mkdirSync5(dir, { recursive: true });
1427
1431
  const tmp = `${path}.tmp.${process.pid}`;
1428
1432
  writeFileSync4(tmp, JSON.stringify(merged, null, 2) + "\n", "utf-8");
1429
1433
  renameSync2(tmp, path);
@@ -1506,15 +1510,15 @@ function embeddingsDisabled() {
1506
1510
  }
1507
1511
 
1508
1512
  // dist/src/embeddings/self-heal.js
1509
- import { existsSync as existsSync5, lstatSync, mkdirSync as mkdirSync5, readlinkSync, renameSync as renameSync3, rmSync, symlinkSync, statSync as statSync2 } from "node:fs";
1513
+ import { existsSync as existsSync5, lstatSync, mkdirSync as mkdirSync6, readlinkSync, renameSync as renameSync3, rmSync, symlinkSync, statSync as statSync2 } from "node:fs";
1510
1514
  import { homedir as homedir8 } from "node:os";
1511
- import { basename as basename2, dirname as dirname2, join as join9 } from "node:path";
1515
+ import { basename as basename2, dirname as dirname3, join as join9 } from "node:path";
1512
1516
  function ensurePluginNodeModulesLink(opts) {
1513
1517
  if (basename2(opts.bundleDir) !== "bundle") {
1514
1518
  return { kind: "not-bundle-layout", bundleDir: opts.bundleDir };
1515
1519
  }
1516
1520
  const target = opts.sharedNodeModules ?? join9(homedir8(), ".hivemind", "embed-deps", "node_modules");
1517
- const pluginDir = dirname2(opts.bundleDir);
1521
+ const pluginDir = dirname3(opts.bundleDir);
1518
1522
  const link = join9(pluginDir, "node_modules");
1519
1523
  if (!existsSync5(target)) {
1520
1524
  return { kind: "shared-deps-missing", target };
@@ -1554,9 +1558,9 @@ function ensurePluginNodeModulesLink(opts) {
1554
1558
  }
1555
1559
  function createSymlinkAtomic(target, link) {
1556
1560
  try {
1557
- const parent = dirname2(link);
1561
+ const parent = dirname3(link);
1558
1562
  if (!existsSync5(parent))
1559
- mkdirSync5(parent, { recursive: true });
1563
+ mkdirSync6(parent, { recursive: true });
1560
1564
  const tmp = `${link}.tmp.${process.pid}`;
1561
1565
  try {
1562
1566
  rmSync(tmp, { force: true });
@@ -1572,10 +1576,10 @@ function createSymlinkAtomic(target, link) {
1572
1576
 
1573
1577
  // dist/src/hooks/cursor/capture.js
1574
1578
  import { fileURLToPath as fileURLToPath3 } from "node:url";
1575
- import { dirname as dirname7, join as join20 } from "node:path";
1579
+ import { dirname as dirname8, join as join21 } from "node:path";
1576
1580
 
1577
1581
  // dist/src/hooks/summary-state.js
1578
- import { readFileSync as readFileSync7, writeFileSync as writeFileSync5, writeSync as writeSync2, mkdirSync as mkdirSync6, renameSync as renameSync4, existsSync as existsSync6, unlinkSync as unlinkSync4, openSync as openSync3, closeSync as closeSync3, statSync as statSync3 } from "node:fs";
1582
+ import { readFileSync as readFileSync7, writeFileSync as writeFileSync5, writeSync as writeSync2, mkdirSync as mkdirSync7, renameSync as renameSync4, existsSync as existsSync6, unlinkSync as unlinkSync4, openSync as openSync3, closeSync as closeSync3, statSync as statSync3 } from "node:fs";
1579
1583
  import { homedir as homedir9 } from "node:os";
1580
1584
  import { join as join10 } from "node:path";
1581
1585
  var dlog = (msg) => log("summary-state", msg);
@@ -1598,14 +1602,14 @@ function readState(sessionId) {
1598
1602
  }
1599
1603
  }
1600
1604
  function writeState(sessionId, state) {
1601
- mkdirSync6(STATE_DIR, { recursive: true });
1605
+ mkdirSync7(STATE_DIR, { recursive: true });
1602
1606
  const p = statePath(sessionId);
1603
1607
  const tmp = `${p}.${process.pid}.${Date.now()}.tmp`;
1604
1608
  writeFileSync5(tmp, JSON.stringify(state));
1605
1609
  renameSync4(tmp, p);
1606
1610
  }
1607
1611
  function withRmwLock(sessionId, fn) {
1608
- mkdirSync6(STATE_DIR, { recursive: true });
1612
+ mkdirSync7(STATE_DIR, { recursive: true });
1609
1613
  const rmwLock = statePath(sessionId) + ".rmw";
1610
1614
  const deadline = Date.now() + 2e3;
1611
1615
  let fd = null;
@@ -1667,7 +1671,7 @@ function shouldTrigger(state, cfg, now = Date.now()) {
1667
1671
  return false;
1668
1672
  }
1669
1673
  function tryAcquireLock(sessionId, maxAgeMs = 10 * 60 * 1e3) {
1670
- mkdirSync6(STATE_DIR, { recursive: true });
1674
+ mkdirSync7(STATE_DIR, { recursive: true });
1671
1675
  const p = lockPath2(sessionId);
1672
1676
  if (existsSync6(p)) {
1673
1677
  try {
@@ -1711,12 +1715,12 @@ function releaseLock(sessionId) {
1711
1715
  // dist/src/hooks/cursor/spawn-wiki-worker.js
1712
1716
  import { execSync } from "node:child_process";
1713
1717
  import { fileURLToPath } from "node:url";
1714
- import { dirname as dirname4, join as join13 } from "node:path";
1715
- import { writeFileSync as writeFileSync6, mkdirSync as mkdirSync8 } from "node:fs";
1718
+ import { dirname as dirname5, join as join13 } from "node:path";
1719
+ import { writeFileSync as writeFileSync6, mkdirSync as mkdirSync9 } from "node:fs";
1716
1720
  import { homedir as homedir10, tmpdir as tmpdir2 } from "node:os";
1717
1721
 
1718
1722
  // dist/src/utils/wiki-log.js
1719
- import { mkdirSync as mkdirSync7, appendFileSync as appendFileSync2 } from "node:fs";
1723
+ import { mkdirSync as mkdirSync8, appendFileSync as appendFileSync2 } from "node:fs";
1720
1724
  import { join as join11 } from "node:path";
1721
1725
  function makeWikiLogger(hooksDir, filename = "deeplake-wiki.log") {
1722
1726
  const path = join11(hooksDir, filename);
@@ -1724,7 +1728,7 @@ function makeWikiLogger(hooksDir, filename = "deeplake-wiki.log") {
1724
1728
  path,
1725
1729
  log(msg) {
1726
1730
  try {
1727
- mkdirSync7(hooksDir, { recursive: true });
1731
+ mkdirSync8(hooksDir, { recursive: true });
1728
1732
  appendFileSync2(path, `[${utcTimestamp()}] ${msg}
1729
1733
  `);
1730
1734
  } catch {
@@ -1735,7 +1739,7 @@ function makeWikiLogger(hooksDir, filename = "deeplake-wiki.log") {
1735
1739
 
1736
1740
  // dist/src/utils/version-check.js
1737
1741
  import { readFileSync as readFileSync8 } from "node:fs";
1738
- import { dirname as dirname3, join as join12 } from "node:path";
1742
+ import { dirname as dirname4, join as join12 } from "node:path";
1739
1743
  function getInstalledVersion(bundleDir, pluginManifestDir) {
1740
1744
  try {
1741
1745
  const pluginJson = join12(bundleDir, "..", pluginManifestDir, "plugin.json");
@@ -1767,7 +1771,7 @@ function getInstalledVersion(bundleDir, pluginManifestDir) {
1767
1771
  return pkg.version;
1768
1772
  } catch {
1769
1773
  }
1770
- const parent = dirname3(dir);
1774
+ const parent = dirname4(dir);
1771
1775
  if (parent === dir)
1772
1776
  break;
1773
1777
  dir = parent;
@@ -1863,7 +1867,7 @@ function spawnCursorWikiWorker(opts) {
1863
1867
  const { config, sessionId, cwd, bundleDir, reason } = opts;
1864
1868
  const projectName = projectNameFromCwd(cwd);
1865
1869
  const tmpDir = join13(tmpdir2(), `deeplake-wiki-${sessionId}-${Date.now()}`);
1866
- mkdirSync8(tmpDir, { recursive: true });
1870
+ mkdirSync9(tmpDir, { recursive: true });
1867
1871
  const pluginVersion = getInstalledVersion(bundleDir, ".claude-plugin") ?? "";
1868
1872
  const configFile = join13(tmpDir, "config.json");
1869
1873
  writeFileSync6(configFile, JSON.stringify({
@@ -1890,13 +1894,13 @@ function spawnCursorWikiWorker(opts) {
1890
1894
  wikiLog(`${reason}: spawned summary worker for ${sessionId}`);
1891
1895
  }
1892
1896
  function bundleDirFromImportMeta(importMetaUrl) {
1893
- return dirname4(fileURLToPath(importMetaUrl));
1897
+ return dirname5(fileURLToPath(importMetaUrl));
1894
1898
  }
1895
1899
 
1896
1900
  // dist/src/skillify/spawn-skillify-worker.js
1897
1901
  import { fileURLToPath as fileURLToPath2 } from "node:url";
1898
- import { dirname as dirname5, join as join15 } from "node:path";
1899
- import { writeFileSync as writeFileSync7, mkdirSync as mkdirSync9, appendFileSync as appendFileSync3, chmodSync } from "node:fs";
1902
+ import { dirname as dirname6, join as join15 } from "node:path";
1903
+ import { writeFileSync as writeFileSync7, mkdirSync as mkdirSync10, appendFileSync as appendFileSync3, chmodSync } from "node:fs";
1900
1904
  import { homedir as homedir12, tmpdir as tmpdir3 } from "node:os";
1901
1905
 
1902
1906
  // dist/src/skillify/gate-runner.js
@@ -1971,7 +1975,7 @@ var HOME2 = homedir12();
1971
1975
  var SKILLIFY_LOG = join15(HOME2, ".claude", "hooks", "skillify.log");
1972
1976
  function skillifyLog(msg) {
1973
1977
  try {
1974
- mkdirSync9(dirname5(SKILLIFY_LOG), { recursive: true });
1978
+ mkdirSync10(dirname6(SKILLIFY_LOG), { recursive: true });
1975
1979
  appendFileSync3(SKILLIFY_LOG, `[${utcTimestamp()}] ${msg}
1976
1980
  `);
1977
1981
  } catch {
@@ -1980,7 +1984,7 @@ function skillifyLog(msg) {
1980
1984
  function spawnSkillifyWorker(opts) {
1981
1985
  const { config, cwd, projectKey, project, bundleDir, agent, scopeConfig, currentSessionId, reason } = opts;
1982
1986
  const tmpDir = join15(tmpdir3(), `deeplake-skillify-${projectKey}-${Date.now()}`);
1983
- mkdirSync9(tmpDir, { recursive: true, mode: 448 });
1987
+ mkdirSync10(tmpDir, { recursive: true, mode: 448 });
1984
1988
  const gateBin = findAgentBin(agent);
1985
1989
  const configFile = join15(tmpDir, "config.json");
1986
1990
  writeFileSync7(configFile, JSON.stringify({
@@ -2019,7 +2023,7 @@ function spawnSkillifyWorker(opts) {
2019
2023
  }
2020
2024
 
2021
2025
  // dist/src/skillify/state.js
2022
- import { readFileSync as readFileSync9, writeFileSync as writeFileSync8, writeSync as writeSync3, mkdirSync as mkdirSync10, renameSync as renameSync6, rmdirSync, existsSync as existsSync9, lstatSync as lstatSync2, unlinkSync as unlinkSync5, openSync as openSync4, closeSync as closeSync4 } from "node:fs";
2026
+ import { readFileSync as readFileSync9, writeFileSync as writeFileSync8, writeSync as writeSync3, mkdirSync as mkdirSync11, renameSync as renameSync6, rmdirSync, existsSync as existsSync9, lstatSync as lstatSync2, unlinkSync as unlinkSync5, openSync as openSync4, closeSync as closeSync4 } from "node:fs";
2023
2027
  import { join as join18 } from "node:path";
2024
2028
 
2025
2029
  // dist/src/utils/repo-identity.js
@@ -2071,7 +2075,7 @@ function deriveProjectKey(cwd) {
2071
2075
 
2072
2076
  // dist/src/skillify/legacy-migration.js
2073
2077
  import { existsSync as existsSync8, renameSync as renameSync5 } from "node:fs";
2074
- import { dirname as dirname6, join as join17 } from "node:path";
2078
+ import { dirname as dirname7, join as join17 } from "node:path";
2075
2079
 
2076
2080
  // dist/src/skillify/state-dir.js
2077
2081
  import { homedir as homedir13 } from "node:os";
@@ -2091,7 +2095,7 @@ function migrateLegacyStateDir() {
2091
2095
  return;
2092
2096
  attempted = true;
2093
2097
  const current = getStateDir();
2094
- const legacy = join17(dirname6(current), "skilify");
2098
+ const legacy = join17(dirname7(current), "skilify");
2095
2099
  if (!existsSync8(legacy))
2096
2100
  return;
2097
2101
  if (existsSync8(current))
@@ -2135,7 +2139,7 @@ function readState2(projectKey) {
2135
2139
  }
2136
2140
  function writeState2(projectKey, state) {
2137
2141
  migrateLegacyStateDir();
2138
- mkdirSync10(getStateDir(), { recursive: true });
2142
+ mkdirSync11(getStateDir(), { recursive: true });
2139
2143
  const p = statePath2(projectKey);
2140
2144
  const tmp = `${p}.${process.pid}.${Date.now()}.tmp`;
2141
2145
  writeFileSync8(tmp, JSON.stringify(state, null, 2));
@@ -2143,7 +2147,7 @@ function writeState2(projectKey, state) {
2143
2147
  }
2144
2148
  function withRmwLock2(projectKey, fn) {
2145
2149
  migrateLegacyStateDir();
2146
- mkdirSync10(getStateDir(), { recursive: true });
2150
+ mkdirSync11(getStateDir(), { recursive: true });
2147
2151
  const rmw = lockPath3(projectKey) + ".rmw";
2148
2152
  const deadline = Date.now() + 2e3;
2149
2153
  let fd = null;
@@ -2203,7 +2207,7 @@ function resetCounter(projectKey) {
2203
2207
  }
2204
2208
  function tryAcquireWorkerLock(projectKey, maxAgeMs = 10 * 60 * 1e3) {
2205
2209
  migrateLegacyStateDir();
2206
- mkdirSync10(getStateDir(), { recursive: true });
2210
+ mkdirSync11(getStateDir(), { recursive: true });
2207
2211
  const p = lockPath3(projectKey);
2208
2212
  if (existsSync9(p)) {
2209
2213
  try {
@@ -2255,7 +2259,7 @@ function releaseWorkerLock(projectKey) {
2255
2259
  }
2256
2260
 
2257
2261
  // dist/src/skillify/scope-config.js
2258
- import { existsSync as existsSync10, mkdirSync as mkdirSync11, readFileSync as readFileSync10, writeFileSync as writeFileSync9 } from "node:fs";
2262
+ import { existsSync as existsSync10, mkdirSync as mkdirSync12, readFileSync as readFileSync10, writeFileSync as writeFileSync9 } from "node:fs";
2259
2263
  import { join as join19 } from "node:path";
2260
2264
  function configPath() {
2261
2265
  return join19(getStateDir(), "config.json");
@@ -2317,12 +2321,31 @@ function tryStopCounterTrigger(opts) {
2317
2321
  }
2318
2322
  }
2319
2323
 
2324
+ // dist/src/utils/plugin-state.js
2325
+ import { readFileSync as readFileSync11 } from "node:fs";
2326
+ import { join as join20 } from "node:path";
2327
+ import { homedir as homedir14 } from "node:os";
2328
+ var PLUGIN_ID = "hivemind@hivemind";
2329
+ function isHivemindPluginEnabled() {
2330
+ try {
2331
+ const settingsPath = join20(homedir14(), ".claude", "settings.json");
2332
+ const settings = JSON.parse(readFileSync11(settingsPath, "utf-8"));
2333
+ const enabledPlugins = settings?.enabledPlugins;
2334
+ if (enabledPlugins && typeof enabledPlugins === "object" && PLUGIN_ID in enabledPlugins) {
2335
+ return enabledPlugins[PLUGIN_ID] !== false;
2336
+ }
2337
+ return true;
2338
+ } catch {
2339
+ return true;
2340
+ }
2341
+ }
2342
+
2320
2343
  // dist/src/hooks/cursor/capture.js
2321
2344
  var log5 = (msg) => log("cursor-capture", msg);
2322
2345
  function resolveEmbedDaemonPath() {
2323
- return join20(dirname7(fileURLToPath3(import.meta.url)), "embeddings", "embed-daemon.js");
2346
+ return join21(dirname8(fileURLToPath3(import.meta.url)), "embeddings", "embed-daemon.js");
2324
2347
  }
2325
- var __bundleDir = dirname7(fileURLToPath3(import.meta.url));
2348
+ var __bundleDir = dirname8(fileURLToPath3(import.meta.url));
2326
2349
  var PLUGIN_VERSION = getInstalledVersion(__bundleDir, ".claude-plugin") ?? "";
2327
2350
  if (!embeddingsDisabled()) {
2328
2351
  try {
@@ -2342,6 +2365,10 @@ function resolveCwd(input) {
2342
2365
  async function main() {
2343
2366
  if (!CAPTURE)
2344
2367
  return;
2368
+ if (!isHivemindPluginEnabled()) {
2369
+ log5("plugin disabled, skipping capture");
2370
+ return;
2371
+ }
2345
2372
  const input = await readStdin();
2346
2373
  const config = loadConfig();
2347
2374
  if (!config) {
@@ -17,7 +17,7 @@ __export(index_marker_store_exports, {
17
17
  hasFreshIndexMarker: () => hasFreshIndexMarker,
18
18
  writeIndexMarker: () => writeIndexMarker
19
19
  });
20
- import { existsSync as existsSync2, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "node:fs";
20
+ import { existsSync as existsSync2, mkdirSync as mkdirSync5, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "node:fs";
21
21
  import { join as join6 } from "node:path";
22
22
  import { tmpdir } from "node:os";
23
23
  function getIndexMarkerDir() {
@@ -41,7 +41,7 @@ function hasFreshIndexMarker(markerPath) {
41
41
  }
42
42
  }
43
43
  function writeIndexMarker(markerPath) {
44
- mkdirSync4(getIndexMarkerDir(), { recursive: true });
44
+ mkdirSync5(getIndexMarkerDir(), { recursive: true });
45
45
  writeFileSync4(markerPath, JSON.stringify({ updatedAt: (/* @__PURE__ */ new Date()).toISOString() }), "utf-8");
46
46
  }
47
47
  var INDEX_MARKER_TTL_MS;
@@ -413,8 +413,8 @@ function loadConfig() {
413
413
  import { randomUUID as randomUUID2 } from "node:crypto";
414
414
 
415
415
  // dist/src/utils/debug.js
416
- import { appendFileSync } from "node:fs";
417
- import { join as join4 } from "node:path";
416
+ import { appendFileSync, mkdirSync as mkdirSync3 } from "node:fs";
417
+ import { dirname, join as join4 } from "node:path";
418
418
  import { homedir as homedir4 } from "node:os";
419
419
  var LOG = join4(homedir4(), ".deeplake", "hook-debug.log");
420
420
  function isDebug() {
@@ -423,8 +423,12 @@ function isDebug() {
423
423
  function log(tag, msg) {
424
424
  if (!isDebug())
425
425
  return;
426
- appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
426
+ try {
427
+ mkdirSync3(dirname(LOG), { recursive: true });
428
+ appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
427
429
  `);
430
+ } catch {
431
+ }
428
432
  }
429
433
 
430
434
  // dist/src/utils/sql.js
@@ -621,7 +625,7 @@ async function healMissingColumns(args) {
621
625
  }
622
626
 
623
627
  // dist/src/notifications/queue.js
624
- import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, renameSync, mkdirSync as mkdirSync3, openSync, closeSync, unlinkSync as unlinkSync2, statSync } from "node:fs";
628
+ import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, renameSync, mkdirSync as mkdirSync4, openSync, closeSync, unlinkSync as unlinkSync2, statSync } from "node:fs";
625
629
  import { join as join5, resolve } from "node:path";
626
630
  import { homedir as homedir5 } from "node:os";
627
631
  import { setTimeout as sleep } from "node:timers/promises";
@@ -659,14 +663,14 @@ function writeQueue(q) {
659
663
  if (!_isQueuePathInsideHome(path, home)) {
660
664
  throw new Error(`notifications-queue write blocked: ${path} is outside ${home}`);
661
665
  }
662
- mkdirSync3(join5(home, ".deeplake"), { recursive: true, mode: 448 });
666
+ mkdirSync4(join5(home, ".deeplake"), { recursive: true, mode: 448 });
663
667
  const tmp = `${path}.${process.pid}.tmp`;
664
668
  writeFileSync3(tmp, JSON.stringify(q, null, 2), { mode: 384 });
665
669
  renameSync(tmp, path);
666
670
  }
667
671
  async function withQueueLock(fn) {
668
672
  const path = lockPath();
669
- mkdirSync3(join5(homedir5(), ".deeplake"), { recursive: true, mode: 448 });
673
+ mkdirSync4(join5(homedir5(), ".deeplake"), { recursive: true, mode: 448 });
670
674
  let fd = null;
671
675
  for (let attempt = 0; attempt < LOCK_RETRY_MAX; attempt++) {
672
676
  try {
@@ -1241,8 +1245,8 @@ var DeeplakeApi = class {
1241
1245
  };
1242
1246
 
1243
1247
  // dist/src/cli/util.js
1244
- import { existsSync as existsSync3, mkdirSync as mkdirSync5, readFileSync as readFileSync6, writeFileSync as writeFileSync5, cpSync, symlinkSync, unlinkSync as unlinkSync3, lstatSync } from "node:fs";
1245
- import { join as join7, dirname } from "node:path";
1248
+ import { existsSync as existsSync3, mkdirSync as mkdirSync6, readFileSync as readFileSync6, writeFileSync as writeFileSync5, cpSync, symlinkSync, unlinkSync as unlinkSync3, lstatSync } from "node:fs";
1249
+ import { join as join7, dirname as dirname2 } from "node:path";
1246
1250
  import { homedir as homedir6 } from "node:os";
1247
1251
  import { fileURLToPath } from "node:url";
1248
1252
  import { createInterface } from "node:readline";
@@ -2,7 +2,7 @@
2
2
 
3
3
  // dist/src/embeddings/daemon.js
4
4
  import { createServer } from "node:net";
5
- import { unlinkSync, writeFileSync, existsSync, mkdirSync, chmodSync } from "node:fs";
5
+ import { unlinkSync, writeFileSync, existsSync, mkdirSync as mkdirSync2, chmodSync } from "node:fs";
6
6
 
7
7
  // dist/src/embeddings/nomic.js
8
8
  import { createRequire } from "node:module";
@@ -133,8 +133,8 @@ var NomicEmbedder = class {
133
133
  };
134
134
 
135
135
  // dist/src/utils/debug.js
136
- import { appendFileSync } from "node:fs";
137
- import { join as join2 } from "node:path";
136
+ import { appendFileSync, mkdirSync } from "node:fs";
137
+ import { dirname, join as join2 } from "node:path";
138
138
  import { homedir as homedir2 } from "node:os";
139
139
  var LOG = join2(homedir2(), ".deeplake", "hook-debug.log");
140
140
  function isDebug() {
@@ -143,8 +143,12 @@ function isDebug() {
143
143
  function log(tag, msg) {
144
144
  if (!isDebug())
145
145
  return;
146
- appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
146
+ try {
147
+ mkdirSync(dirname(LOG), { recursive: true });
148
+ appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
147
149
  `);
150
+ } catch {
151
+ }
148
152
  }
149
153
 
150
154
  // dist/src/embeddings/daemon.js
@@ -171,7 +175,7 @@ var EmbedDaemon = class {
171
175
  this.daemonPath = opts.daemonPath ?? process.argv[1] ?? "";
172
176
  }
173
177
  async start() {
174
- mkdirSync(this.socketPath.replace(/\/[^/]+$/, ""), { recursive: true });
178
+ mkdirSync2(this.socketPath.replace(/\/[^/]+$/, ""), { recursive: true });
175
179
  writeFileSync(this.pidPath, String(process.pid), { mode: 384 });
176
180
  if (existsSync(this.socketPath)) {
177
181
  try {