@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
@@ -18,8 +18,8 @@ function readStdin() {
18
18
  }
19
19
 
20
20
  // dist/src/utils/debug.js
21
- import { appendFileSync } from "node:fs";
22
- import { join } from "node:path";
21
+ import { appendFileSync, mkdirSync } from "node:fs";
22
+ import { dirname, join } from "node:path";
23
23
  import { homedir } from "node:os";
24
24
  var LOG = join(homedir(), ".deeplake", "hook-debug.log");
25
25
  function isDebug() {
@@ -31,8 +31,12 @@ function utcTimestamp(d = /* @__PURE__ */ new Date()) {
31
31
  function log(tag, msg) {
32
32
  if (!isDebug())
33
33
  return;
34
- appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
34
+ try {
35
+ mkdirSync(dirname(LOG), { recursive: true });
36
+ appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
35
37
  `);
38
+ } catch {
39
+ }
36
40
  }
37
41
 
38
42
  // dist/src/config.js
@@ -83,7 +87,7 @@ function loadConfig() {
83
87
  }
84
88
 
85
89
  // dist/src/hooks/summary-state.js
86
- import { readFileSync as readFileSync2, writeFileSync, writeSync, mkdirSync, renameSync, existsSync as existsSync2, unlinkSync, openSync, closeSync, statSync } from "node:fs";
90
+ import { readFileSync as readFileSync2, writeFileSync, writeSync, mkdirSync as mkdirSync2, renameSync, existsSync as existsSync2, unlinkSync, openSync, closeSync, statSync } from "node:fs";
87
91
  import { homedir as homedir3 } from "node:os";
88
92
  import { join as join3 } from "node:path";
89
93
  var dlog = (msg) => log("summary-state", msg);
@@ -93,7 +97,7 @@ function lockPath(sessionId) {
93
97
  return join3(STATE_DIR, `${sessionId}.lock`);
94
98
  }
95
99
  function tryAcquireLock(sessionId, maxAgeMs = 10 * 60 * 1e3) {
96
- mkdirSync(STATE_DIR, { recursive: true });
100
+ mkdirSync2(STATE_DIR, { recursive: true });
97
101
  const p = lockPath(sessionId);
98
102
  if (existsSync2(p)) {
99
103
  try {
@@ -128,12 +132,12 @@ function tryAcquireLock(sessionId, maxAgeMs = 10 * 60 * 1e3) {
128
132
  // dist/src/hooks/cursor/spawn-wiki-worker.js
129
133
  import { execSync } from "node:child_process";
130
134
  import { fileURLToPath } from "node:url";
131
- import { dirname as dirname2, join as join6 } from "node:path";
132
- import { writeFileSync as writeFileSync2, mkdirSync as mkdirSync3 } from "node:fs";
135
+ import { dirname as dirname3, join as join6 } from "node:path";
136
+ import { writeFileSync as writeFileSync2, mkdirSync as mkdirSync4 } from "node:fs";
133
137
  import { homedir as homedir4, tmpdir } from "node:os";
134
138
 
135
139
  // dist/src/utils/wiki-log.js
136
- import { mkdirSync as mkdirSync2, appendFileSync as appendFileSync2 } from "node:fs";
140
+ import { mkdirSync as mkdirSync3, appendFileSync as appendFileSync2 } from "node:fs";
137
141
  import { join as join4 } from "node:path";
138
142
  function makeWikiLogger(hooksDir, filename = "deeplake-wiki.log") {
139
143
  const path = join4(hooksDir, filename);
@@ -141,7 +145,7 @@ function makeWikiLogger(hooksDir, filename = "deeplake-wiki.log") {
141
145
  path,
142
146
  log(msg) {
143
147
  try {
144
- mkdirSync2(hooksDir, { recursive: true });
148
+ mkdirSync3(hooksDir, { recursive: true });
145
149
  appendFileSync2(path, `[${utcTimestamp()}] ${msg}
146
150
  `);
147
151
  } catch {
@@ -152,7 +156,7 @@ function makeWikiLogger(hooksDir, filename = "deeplake-wiki.log") {
152
156
 
153
157
  // dist/src/utils/version-check.js
154
158
  import { readFileSync as readFileSync3 } from "node:fs";
155
- import { dirname, join as join5 } from "node:path";
159
+ import { dirname as dirname2, join as join5 } from "node:path";
156
160
  function getInstalledVersion(bundleDir, pluginManifestDir) {
157
161
  try {
158
162
  const pluginJson = join5(bundleDir, "..", pluginManifestDir, "plugin.json");
@@ -184,7 +188,7 @@ function getInstalledVersion(bundleDir, pluginManifestDir) {
184
188
  return pkg.version;
185
189
  } catch {
186
190
  }
187
- const parent = dirname(dir);
191
+ const parent = dirname2(dir);
188
192
  if (parent === dir)
189
193
  break;
190
194
  dir = parent;
@@ -286,7 +290,7 @@ function spawnCursorWikiWorker(opts) {
286
290
  const { config, sessionId, cwd, bundleDir, reason } = opts;
287
291
  const projectName = projectNameFromCwd(cwd);
288
292
  const tmpDir = join6(tmpdir(), `deeplake-wiki-${sessionId}-${Date.now()}`);
289
- mkdirSync3(tmpDir, { recursive: true });
293
+ mkdirSync4(tmpDir, { recursive: true });
290
294
  const pluginVersion = getInstalledVersion(bundleDir, ".claude-plugin") ?? "";
291
295
  const configFile = join6(tmpDir, "config.json");
292
296
  writeFileSync2(configFile, JSON.stringify({
@@ -313,13 +317,13 @@ function spawnCursorWikiWorker(opts) {
313
317
  wikiLog(`${reason}: spawned summary worker for ${sessionId}`);
314
318
  }
315
319
  function bundleDirFromImportMeta(importMetaUrl) {
316
- return dirname2(fileURLToPath(importMetaUrl));
320
+ return dirname3(fileURLToPath(importMetaUrl));
317
321
  }
318
322
 
319
323
  // dist/src/skillify/spawn-skillify-worker.js
320
324
  import { fileURLToPath as fileURLToPath2 } from "node:url";
321
- import { dirname as dirname3, join as join8 } from "node:path";
322
- import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync4, appendFileSync as appendFileSync3, chmodSync } from "node:fs";
325
+ import { dirname as dirname4, join as join8 } from "node:path";
326
+ import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync5, appendFileSync as appendFileSync3, chmodSync } from "node:fs";
323
327
  import { homedir as homedir6, tmpdir as tmpdir2 } from "node:os";
324
328
 
325
329
  // dist/src/skillify/gate-runner.js
@@ -394,7 +398,7 @@ var HOME2 = homedir6();
394
398
  var SKILLIFY_LOG = join8(HOME2, ".claude", "hooks", "skillify.log");
395
399
  function skillifyLog(msg) {
396
400
  try {
397
- mkdirSync4(dirname3(SKILLIFY_LOG), { recursive: true });
401
+ mkdirSync5(dirname4(SKILLIFY_LOG), { recursive: true });
398
402
  appendFileSync3(SKILLIFY_LOG, `[${utcTimestamp()}] ${msg}
399
403
  `);
400
404
  } catch {
@@ -403,7 +407,7 @@ function skillifyLog(msg) {
403
407
  function spawnSkillifyWorker(opts) {
404
408
  const { config, cwd, projectKey, project, bundleDir, agent, scopeConfig, currentSessionId, reason } = opts;
405
409
  const tmpDir = join8(tmpdir2(), `deeplake-skillify-${projectKey}-${Date.now()}`);
406
- mkdirSync4(tmpDir, { recursive: true, mode: 448 });
410
+ mkdirSync5(tmpDir, { recursive: true, mode: 448 });
407
411
  const gateBin = findAgentBin(agent);
408
412
  const configFile = join8(tmpDir, "config.json");
409
413
  writeFileSync3(configFile, JSON.stringify({
@@ -442,7 +446,7 @@ function spawnSkillifyWorker(opts) {
442
446
  }
443
447
 
444
448
  // dist/src/skillify/state.js
445
- import { readFileSync as readFileSync4, writeFileSync as writeFileSync4, writeSync as writeSync2, mkdirSync as mkdirSync5, renameSync as renameSync3, rmdirSync, existsSync as existsSync5, lstatSync, unlinkSync as unlinkSync2, openSync as openSync2, closeSync as closeSync2 } from "node:fs";
449
+ import { readFileSync as readFileSync4, writeFileSync as writeFileSync4, writeSync as writeSync2, mkdirSync as mkdirSync6, renameSync as renameSync3, rmdirSync, existsSync as existsSync5, lstatSync, unlinkSync as unlinkSync2, openSync as openSync2, closeSync as closeSync2 } from "node:fs";
446
450
  import { join as join11 } from "node:path";
447
451
 
448
452
  // dist/src/utils/repo-identity.js
@@ -494,7 +498,7 @@ function deriveProjectKey(cwd) {
494
498
 
495
499
  // dist/src/skillify/legacy-migration.js
496
500
  import { existsSync as existsSync4, renameSync as renameSync2 } from "node:fs";
497
- import { dirname as dirname4, join as join10 } from "node:path";
501
+ import { dirname as dirname5, join as join10 } from "node:path";
498
502
 
499
503
  // dist/src/skillify/state-dir.js
500
504
  import { homedir as homedir7 } from "node:os";
@@ -514,7 +518,7 @@ function migrateLegacyStateDir() {
514
518
  return;
515
519
  attempted = true;
516
520
  const current = getStateDir();
517
- const legacy = join10(dirname4(current), "skilify");
521
+ const legacy = join10(dirname5(current), "skilify");
518
522
  if (!existsSync4(legacy))
519
523
  return;
520
524
  if (existsSync4(current))
@@ -558,7 +562,7 @@ function readState(projectKey) {
558
562
  }
559
563
  function writeState(projectKey, state) {
560
564
  migrateLegacyStateDir();
561
- mkdirSync5(getStateDir(), { recursive: true });
565
+ mkdirSync6(getStateDir(), { recursive: true });
562
566
  const p = statePath(projectKey);
563
567
  const tmp = `${p}.${process.pid}.${Date.now()}.tmp`;
564
568
  writeFileSync4(tmp, JSON.stringify(state, null, 2));
@@ -566,7 +570,7 @@ function writeState(projectKey, state) {
566
570
  }
567
571
  function withRmwLock(projectKey, fn) {
568
572
  migrateLegacyStateDir();
569
- mkdirSync5(getStateDir(), { recursive: true });
573
+ mkdirSync6(getStateDir(), { recursive: true });
570
574
  const rmw = lockPath2(projectKey) + ".rmw";
571
575
  const deadline = Date.now() + 2e3;
572
576
  let fd = null;
@@ -609,7 +613,7 @@ function resetCounter(projectKey) {
609
613
  }
610
614
  function tryAcquireWorkerLock(projectKey, maxAgeMs = 10 * 60 * 1e3) {
611
615
  migrateLegacyStateDir();
612
- mkdirSync5(getStateDir(), { recursive: true });
616
+ mkdirSync6(getStateDir(), { recursive: true });
613
617
  const p = lockPath2(projectKey);
614
618
  if (existsSync5(p)) {
615
619
  try {
@@ -661,7 +665,7 @@ function releaseWorkerLock(projectKey) {
661
665
  }
662
666
 
663
667
  // dist/src/skillify/scope-config.js
664
- import { existsSync as existsSync6, mkdirSync as mkdirSync6, readFileSync as readFileSync5, writeFileSync as writeFileSync5 } from "node:fs";
668
+ import { existsSync as existsSync6, mkdirSync as mkdirSync7, readFileSync as readFileSync5, writeFileSync as writeFileSync5 } from "node:fs";
665
669
  import { join as join12 } from "node:path";
666
670
  function configPath() {
667
671
  return join12(getStateDir(), "config.json");
@@ -733,36 +737,36 @@ async function main() {
733
737
  log2(`session=${sessionId || "?"} reason=${input.reason ?? "?"} status=${input.final_status ?? "?"}`);
734
738
  if (!sessionId)
735
739
  return;
736
- if (!tryAcquireLock(sessionId)) {
737
- wikiLog(`SessionEnd: periodic worker already running for ${sessionId}, skipping final`);
738
- return;
739
- }
740
740
  const config = loadConfig();
741
741
  if (!config) {
742
742
  wikiLog(`SessionEnd: no config, skipping summary`);
743
743
  return;
744
744
  }
745
745
  try {
746
- spawnCursorWikiWorker({
746
+ forceSessionEndTrigger({
747
747
  config,
748
- sessionId,
749
748
  cwd: process.cwd(),
750
749
  bundleDir: bundleDirFromImportMeta(import.meta.url),
751
- reason: "SessionEnd"
750
+ agent: "cursor",
751
+ sessionId
752
752
  });
753
753
  } catch (e) {
754
- wikiLog(`SessionEnd: wiki spawn failed: ${e?.message ?? e}`);
754
+ wikiLog(`SessionEnd: skillify trigger failed: ${e?.message ?? e}`);
755
+ }
756
+ if (!tryAcquireLock(sessionId)) {
757
+ wikiLog(`SessionEnd: periodic worker already running for ${sessionId}, skipping final`);
758
+ return;
755
759
  }
756
760
  try {
757
- forceSessionEndTrigger({
761
+ spawnCursorWikiWorker({
758
762
  config,
763
+ sessionId,
759
764
  cwd: process.cwd(),
760
765
  bundleDir: bundleDirFromImportMeta(import.meta.url),
761
- agent: "cursor",
762
- sessionId
766
+ reason: "SessionEnd"
763
767
  });
764
768
  } catch (e) {
765
- wikiLog(`SessionEnd: skillify trigger failed: ${e?.message ?? e}`);
769
+ wikiLog(`SessionEnd: wiki spawn failed: ${e?.message ?? e}`);
766
770
  }
767
771
  }
768
772
  main().catch((e) => {
@@ -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;
@@ -54,7 +54,7 @@ var init_index_marker_store = __esm({
54
54
 
55
55
  // dist/src/hooks/cursor/session-start.js
56
56
  import { fileURLToPath as fileURLToPath2 } from "node:url";
57
- import { dirname as dirname10 } from "node:path";
57
+ import { dirname as dirname11 } from "node:path";
58
58
 
59
59
  // dist/src/commands/auth.js
60
60
  import { execSync } from "node:child_process";
@@ -251,8 +251,8 @@ function loadConfig() {
251
251
  import { randomUUID as randomUUID2 } from "node:crypto";
252
252
 
253
253
  // dist/src/utils/debug.js
254
- import { appendFileSync } from "node:fs";
255
- import { join as join4 } from "node:path";
254
+ import { appendFileSync, mkdirSync as mkdirSync3 } from "node:fs";
255
+ import { dirname, join as join4 } from "node:path";
256
256
  import { homedir as homedir4 } from "node:os";
257
257
  var LOG = join4(homedir4(), ".deeplake", "hook-debug.log");
258
258
  function isDebug() {
@@ -261,8 +261,12 @@ function isDebug() {
261
261
  function log(tag, msg) {
262
262
  if (!isDebug())
263
263
  return;
264
- appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
264
+ try {
265
+ mkdirSync3(dirname(LOG), { recursive: true });
266
+ appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
265
267
  `);
268
+ } catch {
269
+ }
266
270
  }
267
271
 
268
272
  // dist/src/utils/sql.js
@@ -462,7 +466,7 @@ async function healMissingColumns(args) {
462
466
  }
463
467
 
464
468
  // dist/src/notifications/queue.js
465
- import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, renameSync, mkdirSync as mkdirSync3, openSync, closeSync, unlinkSync as unlinkSync2, statSync } from "node:fs";
469
+ import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, renameSync, mkdirSync as mkdirSync4, openSync, closeSync, unlinkSync as unlinkSync2, statSync } from "node:fs";
466
470
  import { join as join5, resolve } from "node:path";
467
471
  import { homedir as homedir5 } from "node:os";
468
472
  import { setTimeout as sleep } from "node:timers/promises";
@@ -500,14 +504,14 @@ function writeQueue(q) {
500
504
  if (!_isQueuePathInsideHome(path, home)) {
501
505
  throw new Error(`notifications-queue write blocked: ${path} is outside ${home}`);
502
506
  }
503
- mkdirSync3(join5(home, ".deeplake"), { recursive: true, mode: 448 });
507
+ mkdirSync4(join5(home, ".deeplake"), { recursive: true, mode: 448 });
504
508
  const tmp = `${path}.${process.pid}.tmp`;
505
509
  writeFileSync3(tmp, JSON.stringify(q, null, 2), { mode: 384 });
506
510
  renameSync(tmp, path);
507
511
  }
508
512
  async function withQueueLock(fn) {
509
513
  const path = lockPath();
510
- mkdirSync3(join5(homedir5(), ".deeplake"), { recursive: true, mode: 448 });
514
+ mkdirSync4(join5(homedir5(), ".deeplake"), { recursive: true, mode: 448 });
511
515
  let fd = null;
512
516
  for (let attempt = 0; attempt < LOCK_RETRY_MAX; attempt++) {
513
517
  try {
@@ -1279,9 +1283,9 @@ function renderSkillifyCommands() {
1279
1283
  }
1280
1284
 
1281
1285
  // dist/src/skillify/local-manifest.js
1282
- import { existsSync as existsSync3, mkdirSync as mkdirSync5, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "node:fs";
1286
+ import { existsSync as existsSync3, mkdirSync as mkdirSync6, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "node:fs";
1283
1287
  import { homedir as homedir6 } from "node:os";
1284
- import { dirname, join as join7 } from "node:path";
1288
+ import { dirname as dirname2, join as join7 } from "node:path";
1285
1289
  var LOCAL_MANIFEST_PATH = join7(homedir6(), ".claude", "hivemind", "local-mined.json");
1286
1290
  var LOCAL_MINE_LOCK_PATH = join7(homedir6(), ".claude", "hivemind", "local-mined.lock");
1287
1291
  function readLocalManifest(path = LOCAL_MANIFEST_PATH) {
@@ -1301,9 +1305,9 @@ var LATEST_RUN_WINDOW_MS = 5 * 60 * 1e3;
1301
1305
 
1302
1306
  // dist/src/skillify/spawn-mine-local-worker.js
1303
1307
  import { execFileSync, spawn } from "node:child_process";
1304
- import { closeSync as closeSync2, existsSync as existsSync4, mkdirSync as mkdirSync6, openSync as openSync2, readdirSync, statSync as statSync2, unlinkSync as unlinkSync3 } from "node:fs";
1308
+ import { closeSync as closeSync2, existsSync as existsSync4, mkdirSync as mkdirSync7, openSync as openSync2, readdirSync, statSync as statSync2, unlinkSync as unlinkSync3 } from "node:fs";
1305
1309
  import { homedir as homedir7 } from "node:os";
1306
- import { dirname as dirname2, join as join8 } from "node:path";
1310
+ import { dirname as dirname3, join as join8 } from "node:path";
1307
1311
  import { fileURLToPath } from "node:url";
1308
1312
  var HOME = homedir7();
1309
1313
  var HIVEMIND_DIR = join8(HOME, ".claude", "hivemind");
@@ -1312,7 +1316,7 @@ var CLAUDE_PROJECTS_DIR = join8(HOME, ".claude", "projects");
1312
1316
  var LOCK_STALE_MS2 = 15 * 60 * 1e3;
1313
1317
  function findBundledCliPath() {
1314
1318
  try {
1315
- const thisDir = dirname2(fileURLToPath(import.meta.url));
1319
+ const thisDir = dirname3(fileURLToPath(import.meta.url));
1316
1320
  const cliPath = join8(thisDir, "..", "..", "bundle", "cli.js");
1317
1321
  return existsSync4(cliPath) ? cliPath : null;
1318
1322
  } catch {
@@ -1379,14 +1383,14 @@ function maybeAutoMineLocal() {
1379
1383
  if (!launcher)
1380
1384
  return { triggered: false, reason: "no-hivemind-bin" };
1381
1385
  try {
1382
- mkdirSync6(HIVEMIND_DIR, { recursive: true });
1386
+ mkdirSync7(HIVEMIND_DIR, { recursive: true });
1383
1387
  const fd = openSync2(LOCAL_MINE_LOCK_PATH, "wx");
1384
1388
  closeSync2(fd);
1385
1389
  } catch {
1386
1390
  return { triggered: false, reason: "lock-acquire-failed" };
1387
1391
  }
1388
1392
  try {
1389
- mkdirSync6(join8(HOME, ".claude", "hooks"), { recursive: true });
1393
+ mkdirSync7(join8(HOME, ".claude", "hooks"), { recursive: true });
1390
1394
  const out = openSync2(LOG_PATH, "a");
1391
1395
  const [cmd, args] = launcher.kind === "node-script" ? [process.execPath, [launcher.path, "skillify", "mine-local"]] : [launcher.path, ["skillify", "mine-local"]];
1392
1396
  const child = spawn(cmd, args, {
@@ -1425,7 +1429,7 @@ function readStdin() {
1425
1429
 
1426
1430
  // dist/src/utils/version-check.js
1427
1431
  import { readFileSync as readFileSync7 } from "node:fs";
1428
- import { dirname as dirname3, join as join9 } from "node:path";
1432
+ import { dirname as dirname4, join as join9 } from "node:path";
1429
1433
  function getInstalledVersion(bundleDir, pluginManifestDir) {
1430
1434
  try {
1431
1435
  const pluginJson = join9(bundleDir, "..", pluginManifestDir, "plugin.json");
@@ -1457,7 +1461,7 @@ function getInstalledVersion(bundleDir, pluginManifestDir) {
1457
1461
  return pkg.version;
1458
1462
  } catch {
1459
1463
  }
1460
- const parent = dirname3(dir);
1464
+ const parent = dirname4(dir);
1461
1465
  if (parent === dir)
1462
1466
  break;
1463
1467
  dir = parent;
@@ -1519,12 +1523,12 @@ async function autoUpdate(creds, opts) {
1519
1523
  }
1520
1524
 
1521
1525
  // dist/src/skillify/pull.js
1522
- import { existsSync as existsSync10, readFileSync as readFileSync10, writeFileSync as writeFileSync8, mkdirSync as mkdirSync9, renameSync as renameSync4, lstatSync as lstatSync2, readlinkSync, symlinkSync, unlinkSync as unlinkSync5 } from "node:fs";
1526
+ import { existsSync as existsSync10, readFileSync as readFileSync10, writeFileSync as writeFileSync8, mkdirSync as mkdirSync10, renameSync as renameSync4, lstatSync as lstatSync2, readlinkSync, symlinkSync, unlinkSync as unlinkSync5 } from "node:fs";
1523
1527
  import { homedir as homedir11 } from "node:os";
1524
- import { dirname as dirname6, join as join16 } from "node:path";
1528
+ import { dirname as dirname7, join as join16 } from "node:path";
1525
1529
 
1526
1530
  // dist/src/skillify/skill-writer.js
1527
- import { existsSync as existsSync6, mkdirSync as mkdirSync7, readFileSync as readFileSync8, readdirSync as readdirSync2, statSync as statSync3, writeFileSync as writeFileSync6 } from "node:fs";
1531
+ import { existsSync as existsSync6, mkdirSync as mkdirSync8, readFileSync as readFileSync8, readdirSync as readdirSync2, statSync as statSync3, writeFileSync as writeFileSync6 } from "node:fs";
1528
1532
  import { homedir as homedir8 } from "node:os";
1529
1533
  import { join as join11 } from "node:path";
1530
1534
  function assertValidSkillName(name) {
@@ -1592,12 +1596,12 @@ function parseFrontmatter(text) {
1592
1596
  }
1593
1597
 
1594
1598
  // dist/src/skillify/manifest.js
1595
- import { existsSync as existsSync8, lstatSync, mkdirSync as mkdirSync8, readFileSync as readFileSync9, renameSync as renameSync3, unlinkSync as unlinkSync4, writeFileSync as writeFileSync7 } from "node:fs";
1596
- import { dirname as dirname5, join as join14 } from "node:path";
1599
+ import { existsSync as existsSync8, lstatSync, mkdirSync as mkdirSync9, readFileSync as readFileSync9, renameSync as renameSync3, unlinkSync as unlinkSync4, writeFileSync as writeFileSync7 } from "node:fs";
1600
+ import { dirname as dirname6, join as join14 } from "node:path";
1597
1601
 
1598
1602
  // dist/src/skillify/legacy-migration.js
1599
1603
  import { existsSync as existsSync7, renameSync as renameSync2 } from "node:fs";
1600
- import { dirname as dirname4, join as join13 } from "node:path";
1604
+ import { dirname as dirname5, join as join13 } from "node:path";
1601
1605
 
1602
1606
  // dist/src/skillify/state-dir.js
1603
1607
  import { homedir as homedir9 } from "node:os";
@@ -1617,7 +1621,7 @@ function migrateLegacyStateDir() {
1617
1621
  return;
1618
1622
  attempted = true;
1619
1623
  const current = getStateDir();
1620
- const legacy = join13(dirname4(current), "skilify");
1624
+ const legacy = join13(dirname5(current), "skilify");
1621
1625
  if (!existsSync7(legacy))
1622
1626
  return;
1623
1627
  if (existsSync7(current))
@@ -1695,7 +1699,7 @@ function loadManifest(path = manifestPath()) {
1695
1699
  }
1696
1700
  function saveManifest(m, path = manifestPath()) {
1697
1701
  migrateLegacyStateDir();
1698
- mkdirSync8(dirname5(path), { recursive: true });
1702
+ mkdirSync9(dirname6(path), { recursive: true });
1699
1703
  const tmp = `${path}.tmp`;
1700
1704
  writeFileSync7(tmp, JSON.stringify(m, null, 2) + "\n", { mode: 384 });
1701
1705
  renameSync3(tmp, path);
@@ -1845,7 +1849,7 @@ function fanOutSymlinks(canonicalDir, dirName, agentRoots) {
1845
1849
  }
1846
1850
  }
1847
1851
  try {
1848
- mkdirSync9(dirname6(link), { recursive: true });
1852
+ mkdirSync10(dirname7(link), { recursive: true });
1849
1853
  symlinkSync(canonicalDir, link, "dir");
1850
1854
  out.push(link);
1851
1855
  } catch {
@@ -2085,7 +2089,7 @@ async function runPull(opts) {
2085
2089
  });
2086
2090
  let manifestError;
2087
2091
  if (action === "wrote") {
2088
- mkdirSync9(skillDir, { recursive: true });
2092
+ mkdirSync10(skillDir, { recursive: true });
2089
2093
  if (existsSync10(skillFile)) {
2090
2094
  try {
2091
2095
  renameSync4(skillFile, `${skillFile}.bak`);
@@ -2261,8 +2265,8 @@ import { existsSync as existsSync13 } from "node:fs";
2261
2265
  import { join as join21 } from "node:path";
2262
2266
 
2263
2267
  // dist/src/graph/last-build.js
2264
- import { existsSync as existsSync11, mkdirSync as mkdirSync10, readFileSync as readFileSync11, renameSync as renameSync5, writeFileSync as writeFileSync9 } from "node:fs";
2265
- import { dirname as dirname7, join as join18 } from "node:path";
2268
+ import { existsSync as existsSync11, mkdirSync as mkdirSync11, readFileSync as readFileSync11, renameSync as renameSync5, writeFileSync as writeFileSync9 } from "node:fs";
2269
+ import { dirname as dirname8, join as join18 } from "node:path";
2266
2270
  function lastBuildPath(baseDir, worktreeId) {
2267
2271
  if (worktreeId !== void 0) {
2268
2272
  return join18(baseDir, "worktrees", worktreeId, ".last-build.json");
@@ -2312,13 +2316,13 @@ function readLastBuild(baseDir, worktreeId) {
2312
2316
 
2313
2317
  // dist/src/graph/snapshot.js
2314
2318
  import { createHash } from "node:crypto";
2315
- import { mkdirSync as mkdirSync12, renameSync as renameSync6, writeFileSync as writeFileSync10 } from "node:fs";
2319
+ import { mkdirSync as mkdirSync13, renameSync as renameSync6, writeFileSync as writeFileSync10 } from "node:fs";
2316
2320
  import { homedir as homedir12 } from "node:os";
2317
- import { dirname as dirname9, join as join20 } from "node:path";
2321
+ import { dirname as dirname10, join as join20 } from "node:path";
2318
2322
 
2319
2323
  // dist/src/graph/history.js
2320
- import { appendFileSync as appendFileSync2, existsSync as existsSync12, mkdirSync as mkdirSync11, readFileSync as readFileSync12 } from "node:fs";
2321
- import { dirname as dirname8, join as join19 } from "node:path";
2324
+ import { appendFileSync as appendFileSync2, existsSync as existsSync12, mkdirSync as mkdirSync12, readFileSync as readFileSync12 } from "node:fs";
2325
+ import { dirname as dirname9, join as join19 } from "node:path";
2322
2326
 
2323
2327
  // dist/src/graph/resolve/cross-file.js
2324
2328
  import { posix } from "node:path";
@@ -2461,7 +2465,7 @@ function formatAge(ms) {
2461
2465
 
2462
2466
  // dist/src/hooks/cursor/session-start.js
2463
2467
  var log6 = (msg) => log("cursor-session-start", msg);
2464
- var __bundleDir = dirname10(fileURLToPath2(import.meta.url));
2468
+ var __bundleDir = dirname11(fileURLToPath2(import.meta.url));
2465
2469
  var context = `DEEPLAKE MEMORY: Persistent memory at ~/.deeplake/memory/ shared across sessions, users, and agents.
2466
2470
 
2467
2471
  Structure: index.md (start here) \u2192 summaries/*.md \u2192 sessions/*.jsonl (last resort). Do NOT jump straight to JSONL.
@@ -59941,7 +59941,7 @@ __export(index_marker_store_exports, {
59941
59941
  hasFreshIndexMarker: () => hasFreshIndexMarker,
59942
59942
  writeIndexMarker: () => writeIndexMarker
59943
59943
  });
59944
- import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
59944
+ import { existsSync as existsSync3, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
59945
59945
  import { join as join8 } from "node:path";
59946
59946
  import { tmpdir } from "node:os";
59947
59947
  function getIndexMarkerDir() {
@@ -59965,7 +59965,7 @@ function hasFreshIndexMarker(markerPath) {
59965
59965
  }
59966
59966
  }
59967
59967
  function writeIndexMarker(markerPath) {
59968
- mkdirSync3(getIndexMarkerDir(), { recursive: true });
59968
+ mkdirSync4(getIndexMarkerDir(), { recursive: true });
59969
59969
  writeFileSync3(markerPath, JSON.stringify({ updatedAt: (/* @__PURE__ */ new Date()).toISOString() }), "utf-8");
59970
59970
  }
59971
59971
  var INDEX_MARKER_TTL_MS;
@@ -66814,8 +66814,8 @@ function loadConfig() {
66814
66814
  import { randomUUID } from "node:crypto";
66815
66815
 
66816
66816
  // dist/src/utils/debug.js
66817
- import { appendFileSync } from "node:fs";
66818
- import { join as join5 } from "node:path";
66817
+ import { appendFileSync, mkdirSync } from "node:fs";
66818
+ import { dirname as dirname4, join as join5 } from "node:path";
66819
66819
  import { homedir as homedir2 } from "node:os";
66820
66820
  var LOG = join5(homedir2(), ".deeplake", "hook-debug.log");
66821
66821
  function isDebug() {
@@ -66824,8 +66824,12 @@ function isDebug() {
66824
66824
  function log(tag, msg) {
66825
66825
  if (!isDebug())
66826
66826
  return;
66827
- appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
66827
+ try {
66828
+ mkdirSync(dirname4(LOG), { recursive: true });
66829
+ appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
66828
66830
  `);
66831
+ } catch {
66832
+ }
66829
66833
  }
66830
66834
 
66831
66835
  // dist/src/utils/sql.js
@@ -67034,7 +67038,7 @@ async function healMissingColumns(args) {
67034
67038
  }
67035
67039
 
67036
67040
  // dist/src/notifications/queue.js
67037
- import { readFileSync as readFileSync2, writeFileSync, renameSync, mkdirSync, openSync, closeSync, unlinkSync, statSync as statSync2 } from "node:fs";
67041
+ import { readFileSync as readFileSync2, writeFileSync, renameSync, mkdirSync as mkdirSync2, openSync, closeSync, unlinkSync, statSync as statSync2 } from "node:fs";
67038
67042
  import { join as join6, resolve as resolve4 } from "node:path";
67039
67043
  import { homedir as homedir3 } from "node:os";
67040
67044
  import { setTimeout as sleep } from "node:timers/promises";
@@ -67072,14 +67076,14 @@ function writeQueue(q17) {
67072
67076
  if (!_isQueuePathInsideHome(path2, home)) {
67073
67077
  throw new Error(`notifications-queue write blocked: ${path2} is outside ${home}`);
67074
67078
  }
67075
- mkdirSync(join6(home, ".deeplake"), { recursive: true, mode: 448 });
67079
+ mkdirSync2(join6(home, ".deeplake"), { recursive: true, mode: 448 });
67076
67080
  const tmp = `${path2}.${process.pid}.tmp`;
67077
67081
  writeFileSync(tmp, JSON.stringify(q17, null, 2), { mode: 384 });
67078
67082
  renameSync(tmp, path2);
67079
67083
  }
67080
67084
  async function withQueueLock(fn4) {
67081
67085
  const path2 = lockPath();
67082
- mkdirSync(join6(homedir3(), ".deeplake"), { recursive: true, mode: 448 });
67086
+ mkdirSync2(join6(homedir3(), ".deeplake"), { recursive: true, mode: 448 });
67083
67087
  let fd = null;
67084
67088
  for (let attempt = 0; attempt < LOCK_RETRY_MAX; attempt++) {
67085
67089
  try {
@@ -67135,7 +67139,7 @@ async function enqueueNotification(n24) {
67135
67139
  }
67136
67140
 
67137
67141
  // dist/src/commands/auth-creds.js
67138
- import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2, unlinkSync as unlinkSync2 } from "node:fs";
67142
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync3, unlinkSync as unlinkSync2 } from "node:fs";
67139
67143
  import { join as join7 } from "node:path";
67140
67144
  import { homedir as homedir4 } from "node:os";
67141
67145
  function configDir() {
@@ -67675,7 +67679,7 @@ var DeeplakeApi = class {
67675
67679
  import { basename as basename5, posix as posix2 } from "node:path";
67676
67680
  import { randomUUID as randomUUID2 } from "node:crypto";
67677
67681
  import { fileURLToPath } from "node:url";
67678
- import { dirname as dirname9, join as join16 } from "node:path";
67682
+ import { dirname as dirname10, join as join16 } from "node:path";
67679
67683
 
67680
67684
  // dist/src/shell/grep-core.js
67681
67685
  var TOOL_INPUT_FIELDS = [
@@ -68507,9 +68511,9 @@ import { join as join11 } from "node:path";
68507
68511
  import { pathToFileURL } from "node:url";
68508
68512
 
68509
68513
  // dist/src/user-config.js
68510
- import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync6, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "node:fs";
68514
+ import { existsSync as existsSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync6, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "node:fs";
68511
68515
  import { homedir as homedir6 } from "node:os";
68512
- import { dirname as dirname4, join as join10 } from "node:path";
68516
+ import { dirname as dirname5, join as join10 } from "node:path";
68513
68517
  var _configPath = () => process.env.HIVEMIND_CONFIG_PATH ?? join10(homedir6(), ".deeplake", "config.json");
68514
68518
  var _cache = null;
68515
68519
  var _migrated = false;
@@ -68534,9 +68538,9 @@ function writeUserConfig(patch) {
68534
68538
  const current = readUserConfig();
68535
68539
  const merged = deepMerge(current, patch);
68536
68540
  const path2 = _configPath();
68537
- const dir = dirname4(path2);
68541
+ const dir = dirname5(path2);
68538
68542
  if (!existsSync5(dir))
68539
- mkdirSync4(dir, { recursive: true });
68543
+ mkdirSync5(dir, { recursive: true });
68540
68544
  const tmp = `${path2}.tmp.${process.pid}`;
68541
68545
  writeFileSync4(tmp, JSON.stringify(merged, null, 2) + "\n", "utf-8");
68542
68546
  renameSync2(tmp, path2);
@@ -68758,13 +68762,13 @@ function composeKpiPath(parts) {
68758
68762
  }
68759
68763
 
68760
68764
  // dist/src/graph/vfs-handler.js
68761
- import { existsSync as existsSync8, mkdirSync as mkdirSync8, readFileSync as readFileSync9, renameSync as renameSync5, writeFileSync as writeFileSync7 } from "node:fs";
68765
+ import { existsSync as existsSync8, mkdirSync as mkdirSync9, readFileSync as readFileSync9, renameSync as renameSync5, writeFileSync as writeFileSync7 } from "node:fs";
68762
68766
  import { createHash as createHash3 } from "node:crypto";
68763
- import { join as join15, dirname as dirname8 } from "node:path";
68767
+ import { join as join15, dirname as dirname9 } from "node:path";
68764
68768
 
68765
68769
  // dist/src/graph/last-build.js
68766
- import { existsSync as existsSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync7, renameSync as renameSync3, writeFileSync as writeFileSync5 } from "node:fs";
68767
- import { dirname as dirname5, join as join12 } from "node:path";
68770
+ import { existsSync as existsSync6, mkdirSync as mkdirSync6, readFileSync as readFileSync7, renameSync as renameSync3, writeFileSync as writeFileSync5 } from "node:fs";
68771
+ import { dirname as dirname6, join as join12 } from "node:path";
68768
68772
  function lastBuildPath(baseDir, worktreeId) {
68769
68773
  if (worktreeId !== void 0) {
68770
68774
  return join12(baseDir, "worktrees", worktreeId, ".last-build.json");
@@ -68814,13 +68818,13 @@ function readLastBuild(baseDir, worktreeId) {
68814
68818
 
68815
68819
  // dist/src/graph/snapshot.js
68816
68820
  import { createHash } from "node:crypto";
68817
- import { mkdirSync as mkdirSync7, renameSync as renameSync4, writeFileSync as writeFileSync6 } from "node:fs";
68821
+ import { mkdirSync as mkdirSync8, renameSync as renameSync4, writeFileSync as writeFileSync6 } from "node:fs";
68818
68822
  import { homedir as homedir8 } from "node:os";
68819
- import { dirname as dirname7, join as join14 } from "node:path";
68823
+ import { dirname as dirname8, join as join14 } from "node:path";
68820
68824
 
68821
68825
  // dist/src/graph/history.js
68822
- import { appendFileSync as appendFileSync2, existsSync as existsSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync8 } from "node:fs";
68823
- import { dirname as dirname6, join as join13 } from "node:path";
68826
+ import { appendFileSync as appendFileSync2, existsSync as existsSync7, mkdirSync as mkdirSync7, readFileSync as readFileSync8 } from "node:fs";
68827
+ import { dirname as dirname7, join as join13 } from "node:path";
68824
68828
 
68825
68829
  // dist/src/graph/resolve/cross-file.js
68826
68830
  import { posix } from "node:path";
@@ -69866,7 +69870,7 @@ function saveHandles(baseDir, worktreeId, ids, pattern) {
69866
69870
  const path2 = handlesPath(baseDir, worktreeId);
69867
69871
  const payload = { pattern, ts: Date.now(), ids };
69868
69872
  try {
69869
- mkdirSync8(dirname8(path2), { recursive: true });
69873
+ mkdirSync9(dirname9(path2), { recursive: true });
69870
69874
  const tmp = `${path2}.tmp.${process.pid}.${Date.now()}`;
69871
69875
  writeFileSync7(tmp, JSON.stringify(payload));
69872
69876
  renameSync5(tmp, path2);
@@ -69925,7 +69929,7 @@ function normalizeSessionMessage(path2, message) {
69925
69929
  return normalizeContent(path2, raw);
69926
69930
  }
69927
69931
  function resolveEmbedDaemonPath() {
69928
- return join16(dirname9(fileURLToPath(import.meta.url)), "..", "embeddings", "embed-daemon.js");
69932
+ return join16(dirname10(fileURLToPath(import.meta.url)), "..", "embeddings", "embed-daemon.js");
69929
69933
  }
69930
69934
  function joinSessionMessages(path2, messages) {
69931
69935
  return messages.map((message) => normalizeSessionMessage(path2, message)).join("\n");
@@ -71744,11 +71748,11 @@ var lib_default = yargsParser;
71744
71748
 
71745
71749
  // dist/src/shell/grep-interceptor.js
71746
71750
  import { fileURLToPath as fileURLToPath2 } from "node:url";
71747
- import { dirname as dirname10, join as join17 } from "node:path";
71751
+ import { dirname as dirname11, join as join17 } from "node:path";
71748
71752
  var SEMANTIC_SEARCH_ENABLED = process.env.HIVEMIND_SEMANTIC_SEARCH !== "false" && !embeddingsDisabled();
71749
71753
  var SEMANTIC_EMBED_TIMEOUT_MS = Number(process.env.HIVEMIND_SEMANTIC_EMBED_TIMEOUT_MS ?? "500");
71750
71754
  function resolveGrepEmbedDaemonPath() {
71751
- return join17(dirname10(fileURLToPath2(import.meta.url)), "..", "embeddings", "embed-daemon.js");
71755
+ return join17(dirname11(fileURLToPath2(import.meta.url)), "..", "embeddings", "embed-daemon.js");
71752
71756
  }
71753
71757
  var sharedGrepEmbedClient = null;
71754
71758
  function getGrepEmbedClient() {