@deeplake/hivemind 0.7.80 → 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 (45) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/bundle/cli.js +131 -94
  4. package/codex/bundle/capture.js +66 -39
  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 +56 -36
  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 +17 -13
  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 +73 -46
  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 +32 -28
  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 +17 -13
  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
@@ -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(path2, home)) {
379
383
  throw new Error(`notifications-queue write blocked: ${path2} 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 = `${path2}.${process.pid}.tmp`;
383
387
  writeFileSync(tmp, JSON.stringify(q, null, 2), { mode: 384 });
384
388
  renameSync(tmp, path2);
385
389
  }
386
390
  async function withQueueLock(fn) {
387
391
  const path2 = 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 path2 = _configPath();
1424
- const dir = dirname(path2);
1428
+ const dir = dirname2(path2);
1425
1429
  if (!existsSync4(dir))
1426
- mkdirSync4(dir, { recursive: true });
1430
+ mkdirSync5(dir, { recursive: true });
1427
1431
  const tmp = `${path2}.tmp.${process.pid}`;
1428
1432
  writeFileSync4(tmp, JSON.stringify(merged, null, 2) + "\n", "utf-8");
1429
1433
  renameSync2(tmp, path2);
@@ -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/codex/capture.js
1574
1578
  import { fileURLToPath as fileURLToPath3 } from "node:url";
1575
- import { dirname as dirname7, join as join17 } from "node:path";
1579
+ import { dirname as dirname8, join as join18 } 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/codex/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 path2 = join11(hooksDir, filename);
@@ -1724,7 +1728,7 @@ function makeWikiLogger(hooksDir, filename = "deeplake-wiki.log") {
1724
1728
  path: path2,
1725
1729
  log(msg) {
1726
1730
  try {
1727
- mkdirSync7(hooksDir, { recursive: true });
1731
+ mkdirSync8(hooksDir, { recursive: true });
1728
1732
  appendFileSync2(path2, `[${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 spawnCodexWikiWorker(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, ".codex-plugin") ?? "";
1868
1872
  const configFile = join13(tmpDir, "config.json");
1869
1873
  writeFileSync6(configFile, JSON.stringify({
@@ -1889,7 +1893,26 @@ function spawnCodexWikiWorker(opts) {
1889
1893
  wikiLog(`${reason}: spawned summary worker for ${sessionId}`);
1890
1894
  }
1891
1895
  function bundleDirFromImportMeta(importMetaUrl) {
1892
- return dirname4(fileURLToPath(importMetaUrl));
1896
+ return dirname5(fileURLToPath(importMetaUrl));
1897
+ }
1898
+
1899
+ // dist/src/utils/plugin-state.js
1900
+ import { readFileSync as readFileSync9 } from "node:fs";
1901
+ import { join as join14 } from "node:path";
1902
+ import { homedir as homedir11 } from "node:os";
1903
+ var PLUGIN_ID = "hivemind@hivemind";
1904
+ function isHivemindPluginEnabled() {
1905
+ try {
1906
+ const settingsPath = join14(homedir11(), ".claude", "settings.json");
1907
+ const settings = JSON.parse(readFileSync9(settingsPath, "utf-8"));
1908
+ const enabledPlugins = settings?.enabledPlugins;
1909
+ if (enabledPlugins && typeof enabledPlugins === "object" && PLUGIN_ID in enabledPlugins) {
1910
+ return enabledPlugins[PLUGIN_ID] !== false;
1911
+ }
1912
+ return true;
1913
+ } catch {
1914
+ return true;
1915
+ }
1893
1916
  }
1894
1917
 
1895
1918
  // dist/src/skillify/skillopt-trigger.js
@@ -1899,20 +1922,20 @@ import path from "node:path";
1899
1922
  import { fileURLToPath as fileURLToPath2 } from "node:url";
1900
1923
 
1901
1924
  // dist/src/skillify/state-dir.js
1902
- import { homedir as homedir11 } from "node:os";
1903
- import { join as join14 } from "node:path";
1925
+ import { homedir as homedir12 } from "node:os";
1926
+ import { join as join15 } from "node:path";
1904
1927
  function getStateDir() {
1905
1928
  const override = process.env.HIVEMIND_STATE_DIR?.trim();
1906
- return override && override.length > 0 ? override : join14(homedir11(), ".deeplake", "state", "skillify");
1929
+ return override && override.length > 0 ? override : join15(homedir12(), ".deeplake", "state", "skillify");
1907
1930
  }
1908
1931
 
1909
1932
  // dist/src/skillify/manifest.js
1910
- import { existsSync as existsSync8, lstatSync as lstatSync2, mkdirSync as mkdirSync9, readFileSync as readFileSync9, renameSync as renameSync6, unlinkSync as unlinkSync5, writeFileSync as writeFileSync7 } from "node:fs";
1911
- import { dirname as dirname6, join as join16 } from "node:path";
1933
+ import { existsSync as existsSync8, lstatSync as lstatSync2, mkdirSync as mkdirSync10, readFileSync as readFileSync10, renameSync as renameSync6, unlinkSync as unlinkSync5, writeFileSync as writeFileSync7 } from "node:fs";
1934
+ import { dirname as dirname7, join as join17 } from "node:path";
1912
1935
 
1913
1936
  // dist/src/skillify/legacy-migration.js
1914
1937
  import { existsSync as existsSync7, renameSync as renameSync5 } from "node:fs";
1915
- import { dirname as dirname5, join as join15 } from "node:path";
1938
+ import { dirname as dirname6, join as join16 } from "node:path";
1916
1939
 
1917
1940
  // dist/src/skillify/skillopt-env.js
1918
1941
  var SKILLOPT_ENV = {
@@ -2027,9 +2050,9 @@ function reactSkillOpt(sessionId, prompt, agent) {
2027
2050
  // dist/src/hooks/codex/capture.js
2028
2051
  var log6 = (msg) => log("codex-capture", msg);
2029
2052
  function resolveEmbedDaemonPath() {
2030
- return join17(dirname7(fileURLToPath3(import.meta.url)), "embeddings", "embed-daemon.js");
2053
+ return join18(dirname8(fileURLToPath3(import.meta.url)), "embeddings", "embed-daemon.js");
2031
2054
  }
2032
- var __bundleDir = dirname7(fileURLToPath3(import.meta.url));
2055
+ var __bundleDir = dirname8(fileURLToPath3(import.meta.url));
2033
2056
  var PLUGIN_VERSION = getInstalledVersion(__bundleDir, ".codex-plugin") ?? "";
2034
2057
  if (!embeddingsDisabled()) {
2035
2058
  try {
@@ -2041,6 +2064,10 @@ var CAPTURE = process.env.HIVEMIND_CAPTURE !== "false";
2041
2064
  async function main() {
2042
2065
  if (!CAPTURE)
2043
2066
  return;
2067
+ if (!isHivemindPluginEnabled()) {
2068
+ log6("plugin disabled, skipping capture");
2069
+ return;
2070
+ }
2044
2071
  const input = await readStdin();
2045
2072
  const config = loadConfig();
2046
2073
  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 {
@@ -16,7 +16,7 @@ __export(index_marker_store_exports, {
16
16
  hasFreshIndexMarker: () => hasFreshIndexMarker,
17
17
  writeIndexMarker: () => writeIndexMarker
18
18
  });
19
- import { existsSync as existsSync4, mkdirSync as mkdirSync5, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "node:fs";
19
+ import { existsSync as existsSync4, mkdirSync as mkdirSync6, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "node:fs";
20
20
  import { join as join8 } from "node:path";
21
21
  import { tmpdir } from "node:os";
22
22
  function getIndexMarkerDir() {
@@ -40,7 +40,7 @@ function hasFreshIndexMarker(markerPath) {
40
40
  }
41
41
  }
42
42
  function writeIndexMarker(markerPath) {
43
- mkdirSync5(getIndexMarkerDir(), { recursive: true });
43
+ mkdirSync6(getIndexMarkerDir(), { recursive: true });
44
44
  writeFileSync5(markerPath, JSON.stringify({ updatedAt: (/* @__PURE__ */ new Date()).toISOString() }), "utf-8");
45
45
  }
46
46
  var INDEX_MARKER_TTL_MS;
@@ -54,7 +54,7 @@ var init_index_marker_store = __esm({
54
54
  // dist/src/hooks/graph-on-stop.js
55
55
  import { execFileSync as execFileSync3 } from "node:child_process";
56
56
  import { createHash as createHash7 } from "node:crypto";
57
- import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync13 } from "node:fs";
57
+ import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync14 } from "node:fs";
58
58
  import { join as join18 } from "node:path";
59
59
 
60
60
  // dist/src/commands/graph.js
@@ -309,8 +309,8 @@ function loadConfig() {
309
309
  import { randomUUID } from "node:crypto";
310
310
 
311
311
  // dist/src/utils/debug.js
312
- import { appendFileSync } from "node:fs";
313
- import { join as join5 } from "node:path";
312
+ import { appendFileSync, mkdirSync as mkdirSync3 } from "node:fs";
313
+ import { dirname as dirname3, join as join5 } from "node:path";
314
314
  import { homedir as homedir3 } from "node:os";
315
315
  var LOG = join5(homedir3(), ".deeplake", "hook-debug.log");
316
316
  function isDebug() {
@@ -319,8 +319,12 @@ function isDebug() {
319
319
  function log(tag, msg) {
320
320
  if (!isDebug())
321
321
  return;
322
- appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
322
+ try {
323
+ mkdirSync3(dirname3(LOG), { recursive: true });
324
+ appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
323
325
  `);
326
+ } catch {
327
+ }
324
328
  }
325
329
 
326
330
  // dist/src/utils/sql.js
@@ -526,7 +530,7 @@ async function healMissingColumns(args) {
526
530
  }
527
531
 
528
532
  // dist/src/notifications/queue.js
529
- import { readFileSync as readFileSync5, writeFileSync as writeFileSync3, renameSync as renameSync2, mkdirSync as mkdirSync3, openSync, closeSync, unlinkSync as unlinkSync2, statSync } from "node:fs";
533
+ import { readFileSync as readFileSync5, writeFileSync as writeFileSync3, renameSync as renameSync2, mkdirSync as mkdirSync4, openSync, closeSync, unlinkSync as unlinkSync2, statSync } from "node:fs";
530
534
  import { join as join6, resolve } from "node:path";
531
535
  import { homedir as homedir4 } from "node:os";
532
536
  import { setTimeout as sleep } from "node:timers/promises";
@@ -564,14 +568,14 @@ function writeQueue(q) {
564
568
  if (!_isQueuePathInsideHome(path, home)) {
565
569
  throw new Error(`notifications-queue write blocked: ${path} is outside ${home}`);
566
570
  }
567
- mkdirSync3(join6(home, ".deeplake"), { recursive: true, mode: 448 });
571
+ mkdirSync4(join6(home, ".deeplake"), { recursive: true, mode: 448 });
568
572
  const tmp = `${path}.${process.pid}.tmp`;
569
573
  writeFileSync3(tmp, JSON.stringify(q, null, 2), { mode: 384 });
570
574
  renameSync2(tmp, path);
571
575
  }
572
576
  async function withQueueLock(fn) {
573
577
  const path = lockPath();
574
- mkdirSync3(join6(homedir4(), ".deeplake"), { recursive: true, mode: 448 });
578
+ mkdirSync4(join6(homedir4(), ".deeplake"), { recursive: true, mode: 448 });
575
579
  let fd = null;
576
580
  for (let attempt = 0; attempt < LOCK_RETRY_MAX; attempt++) {
577
581
  try {
@@ -627,7 +631,7 @@ async function enqueueNotification(n) {
627
631
  }
628
632
 
629
633
  // dist/src/commands/auth-creds.js
630
- import { readFileSync as readFileSync6, writeFileSync as writeFileSync4, mkdirSync as mkdirSync4, unlinkSync as unlinkSync3 } from "node:fs";
634
+ import { readFileSync as readFileSync6, writeFileSync as writeFileSync4, mkdirSync as mkdirSync5, unlinkSync as unlinkSync3 } from "node:fs";
631
635
  import { join as join7 } from "node:path";
632
636
  import { homedir as homedir5 } from "node:os";
633
637
  function configDir() {
@@ -1255,8 +1259,8 @@ function canonicalJSON(value) {
1255
1259
  // dist/src/graph/deeplake-pull.js
1256
1260
  import { execFileSync } from "node:child_process";
1257
1261
  import { createHash as createHash5 } from "node:crypto";
1258
- import { existsSync as existsSync7, mkdirSync as mkdirSync9, renameSync as renameSync5, writeFileSync as writeFileSync8 } from "node:fs";
1259
- import { dirname as dirname6, join as join12 } from "node:path";
1262
+ import { existsSync as existsSync7, mkdirSync as mkdirSync10, renameSync as renameSync5, writeFileSync as writeFileSync8 } from "node:fs";
1263
+ import { dirname as dirname7, join as join12 } from "node:path";
1260
1264
 
1261
1265
  // dist/src/utils/repo-identity.js
1262
1266
  import { execSync } from "node:child_process";
@@ -1306,8 +1310,8 @@ function deriveProjectKey(cwd) {
1306
1310
  }
1307
1311
 
1308
1312
  // dist/src/graph/last-build.js
1309
- import { existsSync as existsSync5, mkdirSync as mkdirSync6, readFileSync as readFileSync8, renameSync as renameSync3, writeFileSync as writeFileSync6 } from "node:fs";
1310
- import { dirname as dirname3, join as join9 } from "node:path";
1313
+ import { existsSync as existsSync5, mkdirSync as mkdirSync7, readFileSync as readFileSync8, renameSync as renameSync3, writeFileSync as writeFileSync6 } from "node:fs";
1314
+ import { dirname as dirname4, join as join9 } from "node:path";
1311
1315
  function lastBuildPath(baseDir, worktreeId) {
1312
1316
  if (worktreeId !== void 0) {
1313
1317
  return join9(baseDir, "worktrees", worktreeId, ".last-build.json");
@@ -1317,7 +1321,7 @@ function lastBuildPath(baseDir, worktreeId) {
1317
1321
  function writeLastBuild(baseDir, state, worktreeId) {
1318
1322
  const path = lastBuildPath(baseDir, worktreeId);
1319
1323
  try {
1320
- mkdirSync6(dirname3(path), { recursive: true });
1324
+ mkdirSync7(dirname4(path), { recursive: true });
1321
1325
  const tmp = `${path}.tmp.${process.pid}.${Date.now()}`;
1322
1326
  writeFileSync6(tmp, JSON.stringify(state));
1323
1327
  renameSync3(tmp, path);
@@ -1366,15 +1370,15 @@ function readLastBuild(baseDir, worktreeId) {
1366
1370
  }
1367
1371
 
1368
1372
  // dist/src/graph/history.js
1369
- import { appendFileSync as appendFileSync2, existsSync as existsSync6, mkdirSync as mkdirSync7, readFileSync as readFileSync9 } from "node:fs";
1370
- import { dirname as dirname4, join as join10 } from "node:path";
1373
+ import { appendFileSync as appendFileSync2, existsSync as existsSync6, mkdirSync as mkdirSync8, readFileSync as readFileSync9 } from "node:fs";
1374
+ import { dirname as dirname5, join as join10 } from "node:path";
1371
1375
  function historyPath(baseDir) {
1372
1376
  return join10(baseDir, "history.jsonl");
1373
1377
  }
1374
1378
  function appendHistoryEntry(baseDir, entry) {
1375
1379
  const path = historyPath(baseDir);
1376
1380
  try {
1377
- mkdirSync7(dirname4(path), { recursive: true });
1381
+ mkdirSync8(dirname5(path), { recursive: true });
1378
1382
  appendFileSync2(path, JSON.stringify(entry) + "\n");
1379
1383
  } catch {
1380
1384
  }
@@ -1392,9 +1396,9 @@ function entryFromSnapshot(snapshot, snapshot_sha256, trigger) {
1392
1396
 
1393
1397
  // dist/src/graph/snapshot.js
1394
1398
  import { createHash as createHash4 } from "node:crypto";
1395
- import { mkdirSync as mkdirSync8, renameSync as renameSync4, writeFileSync as writeFileSync7 } from "node:fs";
1399
+ import { mkdirSync as mkdirSync9, renameSync as renameSync4, writeFileSync as writeFileSync7 } from "node:fs";
1396
1400
  import { homedir as homedir6 } from "node:os";
1397
- import { dirname as dirname5, join as join11 } from "node:path";
1401
+ import { dirname as dirname6, join as join11 } from "node:path";
1398
1402
 
1399
1403
  // dist/src/graph/resolve/cross-file.js
1400
1404
  import { posix } from "node:path";
@@ -1774,7 +1778,7 @@ function writeSnapshot(snapshot, baseDir, trigger = "unknown", worktreeId) {
1774
1778
  return { snapshotPath, latestCommitPath, snapshotSha256: sha256 };
1775
1779
  }
1776
1780
  function writeFileAtomic(filePath, contents) {
1777
- mkdirSync8(dirname5(filePath), { recursive: true });
1781
+ mkdirSync9(dirname6(filePath), { recursive: true });
1778
1782
  const tmp = `${filePath}.tmp.${process.pid}.${Date.now()}`;
1779
1783
  writeFileSync7(tmp, contents);
1780
1784
  renameSync4(tmp, filePath);
@@ -2572,7 +2576,7 @@ function extractFile(sourceCode, relativePath) {
2572
2576
  }
2573
2577
 
2574
2578
  // dist/src/graph/ignore-config.js
2575
- import { mkdirSync as mkdirSync10, readFileSync as readFileSync11, writeFileSync as writeFileSync9 } from "node:fs";
2579
+ import { mkdirSync as mkdirSync11, readFileSync as readFileSync11, writeFileSync as writeFileSync9 } from "node:fs";
2576
2580
  import { homedir as homedir7 } from "node:os";
2577
2581
  import { join as join14 } from "node:path";
2578
2582
  var DEFAULT_IGNORE_DIRS = [
@@ -2653,7 +2657,7 @@ function loadGraphIgnore(deeplakeDir = join14(homedir7(), ".deeplake")) {
2653
2657
  } catch {
2654
2658
  }
2655
2659
  try {
2656
- mkdirSync10(deeplakeDir, { recursive: true });
2660
+ mkdirSync11(deeplakeDir, { recursive: true });
2657
2661
  writeFileSync9(path, JSON.stringify(defaultConfigObject(), null, 2) + "\n", { flag: "wx" });
2658
2662
  } catch {
2659
2663
  }
@@ -2668,8 +2672,8 @@ function pathHasIgnoredSegment(relPath, ignore) {
2668
2672
  }
2669
2673
 
2670
2674
  // dist/src/graph/git-hook-install.js
2671
- import { chmodSync, existsSync as existsSync9, mkdirSync as mkdirSync11, readFileSync as readFileSync12, unlinkSync as unlinkSync4, writeFileSync as writeFileSync10 } from "node:fs";
2672
- import { dirname as dirname7, join as join15, resolve as resolve3 } from "node:path";
2675
+ import { chmodSync, existsSync as existsSync9, mkdirSync as mkdirSync12, readFileSync as readFileSync12, unlinkSync as unlinkSync4, writeFileSync as writeFileSync10 } from "node:fs";
2676
+ import { dirname as dirname8, join as join15, resolve as resolve3 } from "node:path";
2673
2677
  import { execFileSync as execFileSync2 } from "node:child_process";
2674
2678
 
2675
2679
  // dist/src/commands/graph.js
@@ -2946,7 +2950,7 @@ function readGitBranch(cwd) {
2946
2950
  }
2947
2951
 
2948
2952
  // dist/src/graph/build-lock.js
2949
- import { mkdirSync as mkdirSync12, readFileSync as readFileSync14, statSync as statSync2, unlinkSync as unlinkSync5, writeFileSync as writeFileSync11 } from "node:fs";
2953
+ import { mkdirSync as mkdirSync13, readFileSync as readFileSync14, statSync as statSync2, unlinkSync as unlinkSync5, writeFileSync as writeFileSync11 } from "node:fs";
2950
2954
  import { join as join17 } from "node:path";
2951
2955
  var STALE_LOCK_MS = 5 * 60 * 1e3;
2952
2956
  function lockPath2(baseDir) {
@@ -2955,7 +2959,7 @@ function lockPath2(baseDir) {
2955
2959
  function acquireBuildLock(baseDir) {
2956
2960
  const path = lockPath2(baseDir);
2957
2961
  try {
2958
- mkdirSync12(baseDir, { recursive: true });
2962
+ mkdirSync13(baseDir, { recursive: true });
2959
2963
  } catch {
2960
2964
  return { acquired: false, reason: "fs-error" };
2961
2965
  }
@@ -3130,7 +3134,7 @@ function logToFile(cwd, line) {
3130
3134
  try {
3131
3135
  const { key } = deriveProjectKey(cwd);
3132
3136
  const dir = repoDir(key);
3133
- mkdirSync13(dir, { recursive: true });
3137
+ mkdirSync14(dir, { recursive: true });
3134
3138
  appendFileSync3(join18(dir, ".graph-on-stop.log"), `[${(/* @__PURE__ */ new Date()).toISOString()}] ${line}
3135
3139
  `);
3136
3140
  } catch {