@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;
@@ -53,14 +53,14 @@ var init_index_marker_store = __esm({
53
53
  });
54
54
 
55
55
  // dist/src/hooks/graph-pull-worker.js
56
- import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync8 } from "node:fs";
56
+ import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync9 } from "node:fs";
57
57
  import { join as join10 } from "node:path";
58
58
 
59
59
  // dist/src/graph/deeplake-pull.js
60
60
  import { execFileSync } from "node:child_process";
61
61
  import { createHash as createHash3 } from "node:crypto";
62
- import { existsSync as existsSync5, mkdirSync as mkdirSync7, renameSync as renameSync4, writeFileSync as writeFileSync6 } from "node:fs";
63
- import { dirname as dirname4, join as join9 } from "node:path";
62
+ import { existsSync as existsSync5, mkdirSync as mkdirSync8, renameSync as renameSync4, writeFileSync as writeFileSync6 } from "node:fs";
63
+ import { dirname as dirname5, join as join9 } from "node:path";
64
64
 
65
65
  // dist/src/config.js
66
66
  import { readFileSync, existsSync } from "node:fs";
@@ -113,8 +113,8 @@ function loadConfig() {
113
113
  import { randomUUID } from "node:crypto";
114
114
 
115
115
  // dist/src/utils/debug.js
116
- import { appendFileSync } from "node:fs";
117
- import { join as join2 } from "node:path";
116
+ import { appendFileSync, mkdirSync } from "node:fs";
117
+ import { dirname, join as join2 } from "node:path";
118
118
  import { homedir as homedir2 } from "node:os";
119
119
  var LOG = join2(homedir2(), ".deeplake", "hook-debug.log");
120
120
  function isDebug() {
@@ -123,8 +123,12 @@ function isDebug() {
123
123
  function log(tag, msg) {
124
124
  if (!isDebug())
125
125
  return;
126
- appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
126
+ try {
127
+ mkdirSync(dirname(LOG), { recursive: true });
128
+ appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
127
129
  `);
130
+ } catch {
131
+ }
128
132
  }
129
133
 
130
134
  // dist/src/utils/sql.js
@@ -330,7 +334,7 @@ async function healMissingColumns(args) {
330
334
  }
331
335
 
332
336
  // dist/src/notifications/queue.js
333
- import { readFileSync as readFileSync2, writeFileSync, renameSync, mkdirSync, openSync, closeSync, unlinkSync, statSync } from "node:fs";
337
+ import { readFileSync as readFileSync2, writeFileSync, renameSync, mkdirSync as mkdirSync2, openSync, closeSync, unlinkSync, statSync } from "node:fs";
334
338
  import { join as join3, resolve } from "node:path";
335
339
  import { homedir as homedir3 } from "node:os";
336
340
  import { setTimeout as sleep } from "node:timers/promises";
@@ -368,14 +372,14 @@ function writeQueue(q) {
368
372
  if (!_isQueuePathInsideHome(path, home)) {
369
373
  throw new Error(`notifications-queue write blocked: ${path} is outside ${home}`);
370
374
  }
371
- mkdirSync(join3(home, ".deeplake"), { recursive: true, mode: 448 });
375
+ mkdirSync2(join3(home, ".deeplake"), { recursive: true, mode: 448 });
372
376
  const tmp = `${path}.${process.pid}.tmp`;
373
377
  writeFileSync(tmp, JSON.stringify(q, null, 2), { mode: 384 });
374
378
  renameSync(tmp, path);
375
379
  }
376
380
  async function withQueueLock(fn) {
377
381
  const path = lockPath();
378
- mkdirSync(join3(homedir3(), ".deeplake"), { recursive: true, mode: 448 });
382
+ mkdirSync2(join3(homedir3(), ".deeplake"), { recursive: true, mode: 448 });
379
383
  let fd = null;
380
384
  for (let attempt = 0; attempt < LOCK_RETRY_MAX; attempt++) {
381
385
  try {
@@ -431,7 +435,7 @@ async function enqueueNotification(n) {
431
435
  }
432
436
 
433
437
  // dist/src/commands/auth-creds.js
434
- import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2, unlinkSync as unlinkSync2 } from "node:fs";
438
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync3, unlinkSync as unlinkSync2 } from "node:fs";
435
439
  import { join as join4 } from "node:path";
436
440
  import { homedir as homedir4 } from "node:os";
437
441
  function configDir() {
@@ -1015,8 +1019,8 @@ function deriveProjectKey(cwd) {
1015
1019
  }
1016
1020
 
1017
1021
  // dist/src/graph/last-build.js
1018
- import { existsSync as existsSync3, mkdirSync as mkdirSync4, readFileSync as readFileSync5, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "node:fs";
1019
- import { dirname, join as join6 } from "node:path";
1022
+ import { existsSync as existsSync3, mkdirSync as mkdirSync5, readFileSync as readFileSync5, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "node:fs";
1023
+ import { dirname as dirname2, join as join6 } from "node:path";
1020
1024
  function lastBuildPath(baseDir, worktreeId) {
1021
1025
  if (worktreeId !== void 0) {
1022
1026
  return join6(baseDir, "worktrees", worktreeId, ".last-build.json");
@@ -1026,7 +1030,7 @@ function lastBuildPath(baseDir, worktreeId) {
1026
1030
  function writeLastBuild(baseDir, state, worktreeId) {
1027
1031
  const path = lastBuildPath(baseDir, worktreeId);
1028
1032
  try {
1029
- mkdirSync4(dirname(path), { recursive: true });
1033
+ mkdirSync5(dirname2(path), { recursive: true });
1030
1034
  const tmp = `${path}.tmp.${process.pid}.${Date.now()}`;
1031
1035
  writeFileSync4(tmp, JSON.stringify(state));
1032
1036
  renameSync2(tmp, path);
@@ -1075,15 +1079,15 @@ function readLastBuild(baseDir, worktreeId) {
1075
1079
  }
1076
1080
 
1077
1081
  // dist/src/graph/history.js
1078
- import { appendFileSync as appendFileSync2, existsSync as existsSync4, mkdirSync as mkdirSync5, readFileSync as readFileSync6 } from "node:fs";
1079
- import { dirname as dirname2, join as join7 } from "node:path";
1082
+ import { appendFileSync as appendFileSync2, existsSync as existsSync4, mkdirSync as mkdirSync6, readFileSync as readFileSync6 } from "node:fs";
1083
+ import { dirname as dirname3, join as join7 } from "node:path";
1080
1084
  function historyPath(baseDir) {
1081
1085
  return join7(baseDir, "history.jsonl");
1082
1086
  }
1083
1087
  function appendHistoryEntry(baseDir, entry) {
1084
1088
  const path = historyPath(baseDir);
1085
1089
  try {
1086
- mkdirSync5(dirname2(path), { recursive: true });
1090
+ mkdirSync6(dirname3(path), { recursive: true });
1087
1091
  appendFileSync2(path, JSON.stringify(entry) + "\n");
1088
1092
  } catch {
1089
1093
  }
@@ -1091,9 +1095,9 @@ function appendHistoryEntry(baseDir, entry) {
1091
1095
 
1092
1096
  // dist/src/graph/snapshot.js
1093
1097
  import { createHash as createHash2 } from "node:crypto";
1094
- import { mkdirSync as mkdirSync6, renameSync as renameSync3, writeFileSync as writeFileSync5 } from "node:fs";
1098
+ import { mkdirSync as mkdirSync7, renameSync as renameSync3, writeFileSync as writeFileSync5 } from "node:fs";
1095
1099
  import { homedir as homedir5 } from "node:os";
1096
- import { dirname as dirname3, join as join8 } from "node:path";
1100
+ import { dirname as dirname4, join as join8 } from "node:path";
1097
1101
 
1098
1102
  // dist/src/graph/resolve/cross-file.js
1099
1103
  import { posix } from "node:path";
@@ -1279,7 +1283,7 @@ function coerceSnapshotPayload(raw) {
1279
1283
  return null;
1280
1284
  }
1281
1285
  function writeFileAtomic(filePath, contents) {
1282
- mkdirSync7(dirname4(filePath), { recursive: true });
1286
+ mkdirSync8(dirname5(filePath), { recursive: true });
1283
1287
  const tmp = `${filePath}.tmp.${process.pid}.${Date.now()}`;
1284
1288
  writeFileSync6(tmp, contents);
1285
1289
  renameSync4(tmp, filePath);
@@ -1319,7 +1323,7 @@ async function main() {
1319
1323
  try {
1320
1324
  const { key } = deriveProjectKey(cwd);
1321
1325
  const dir = repoDir(key);
1322
- mkdirSync8(dir, { recursive: true });
1326
+ mkdirSync9(dir, { recursive: true });
1323
1327
  appendFileSync3(join10(dir, ".graph-pull.log"), logLine);
1324
1328
  } catch {
1325
1329
  }
@@ -1351,7 +1355,7 @@ async function main() {
1351
1355
  try {
1352
1356
  const { key } = deriveProjectKey(cwd);
1353
1357
  const dir = repoDir(key);
1354
- mkdirSync8(dir, { recursive: true });
1358
+ mkdirSync9(dir, { recursive: true });
1355
1359
  appendFileSync3(join10(dir, ".graph-pull.log"), logLine);
1356
1360
  } catch {
1357
1361
  }
@@ -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;
@@ -52,6 +52,11 @@ var init_index_marker_store = __esm({
52
52
  }
53
53
  });
54
54
 
55
+ // dist/src/hooks/codex/pre-tool-use.js
56
+ import { join as join19, dirname as dirname10 } from "node:path";
57
+ import { fileURLToPath as fileURLToPath4 } from "node:url";
58
+ import { spawnSync } from "node:child_process";
59
+
55
60
  // dist/src/utils/stdin.js
56
61
  function readStdin() {
57
62
  return new Promise((resolve4, reject) => {
@@ -120,8 +125,8 @@ function loadConfig() {
120
125
  import { randomUUID } from "node:crypto";
121
126
 
122
127
  // dist/src/utils/debug.js
123
- import { appendFileSync } from "node:fs";
124
- import { join as join2 } from "node:path";
128
+ import { appendFileSync, mkdirSync } from "node:fs";
129
+ import { dirname, join as join2 } from "node:path";
125
130
  import { homedir as homedir2 } from "node:os";
126
131
  var LOG = join2(homedir2(), ".deeplake", "hook-debug.log");
127
132
  function isDebug() {
@@ -130,8 +135,12 @@ function isDebug() {
130
135
  function log(tag, msg) {
131
136
  if (!isDebug())
132
137
  return;
133
- appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
138
+ try {
139
+ mkdirSync(dirname(LOG), { recursive: true });
140
+ appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
134
141
  `);
142
+ } catch {
143
+ }
135
144
  }
136
145
 
137
146
  // dist/src/utils/sql.js
@@ -340,7 +349,7 @@ async function healMissingColumns(args) {
340
349
  }
341
350
 
342
351
  // dist/src/notifications/queue.js
343
- import { readFileSync as readFileSync2, writeFileSync, renameSync, mkdirSync, openSync, closeSync, unlinkSync, statSync } from "node:fs";
352
+ import { readFileSync as readFileSync2, writeFileSync, renameSync, mkdirSync as mkdirSync2, openSync, closeSync, unlinkSync, statSync } from "node:fs";
344
353
  import { join as join3, resolve } from "node:path";
345
354
  import { homedir as homedir3 } from "node:os";
346
355
  import { setTimeout as sleep } from "node:timers/promises";
@@ -378,14 +387,14 @@ function writeQueue(q) {
378
387
  if (!_isQueuePathInsideHome(path2, home)) {
379
388
  throw new Error(`notifications-queue write blocked: ${path2} is outside ${home}`);
380
389
  }
381
- mkdirSync(join3(home, ".deeplake"), { recursive: true, mode: 448 });
390
+ mkdirSync2(join3(home, ".deeplake"), { recursive: true, mode: 448 });
382
391
  const tmp = `${path2}.${process.pid}.tmp`;
383
392
  writeFileSync(tmp, JSON.stringify(q, null, 2), { mode: 384 });
384
393
  renameSync(tmp, path2);
385
394
  }
386
395
  async function withQueueLock(fn) {
387
396
  const path2 = lockPath();
388
- mkdirSync(join3(homedir3(), ".deeplake"), { recursive: true, mode: 448 });
397
+ mkdirSync2(join3(homedir3(), ".deeplake"), { recursive: true, mode: 448 });
389
398
  let fd = null;
390
399
  for (let attempt = 0; attempt < LOCK_RETRY_MAX; attempt++) {
391
400
  try {
@@ -441,7 +450,7 @@ async function enqueueNotification(n) {
441
450
  }
442
451
 
443
452
  // dist/src/commands/auth-creds.js
444
- import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2, unlinkSync as unlinkSync2 } from "node:fs";
453
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync3, unlinkSync as unlinkSync2 } from "node:fs";
445
454
  import { join as join4 } from "node:path";
446
455
  import { homedir as homedir4 } from "node:os";
447
456
  function configDir() {
@@ -1848,9 +1857,9 @@ import { join as join8 } from "node:path";
1848
1857
  import { pathToFileURL } from "node:url";
1849
1858
 
1850
1859
  // dist/src/user-config.js
1851
- import { existsSync as existsSync4, mkdirSync as mkdirSync4, readFileSync as readFileSync6, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "node:fs";
1860
+ import { existsSync as existsSync4, mkdirSync as mkdirSync5, readFileSync as readFileSync6, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "node:fs";
1852
1861
  import { homedir as homedir6 } from "node:os";
1853
- import { dirname, join as join7 } from "node:path";
1862
+ import { dirname as dirname2, join as join7 } from "node:path";
1854
1863
  var _configPath = () => process.env.HIVEMIND_CONFIG_PATH ?? join7(homedir6(), ".deeplake", "config.json");
1855
1864
  var _cache = null;
1856
1865
  var _migrated = false;
@@ -1875,9 +1884,9 @@ function writeUserConfig(patch) {
1875
1884
  const current = readUserConfig();
1876
1885
  const merged = deepMerge(current, patch);
1877
1886
  const path2 = _configPath();
1878
- const dir = dirname(path2);
1887
+ const dir = dirname2(path2);
1879
1888
  if (!existsSync4(dir))
1880
- mkdirSync4(dir, { recursive: true });
1889
+ mkdirSync5(dir, { recursive: true });
1881
1890
  const tmp = `${path2}.tmp.${process.pid}`;
1882
1891
  writeFileSync4(tmp, JSON.stringify(merged, null, 2) + "\n", "utf-8");
1883
1892
  renameSync2(tmp, path2);
@@ -1961,11 +1970,11 @@ function embeddingsDisabled() {
1961
1970
 
1962
1971
  // dist/src/hooks/grep-direct.js
1963
1972
  import { fileURLToPath } from "node:url";
1964
- import { dirname as dirname2, join as join9 } from "node:path";
1973
+ import { dirname as dirname3, join as join9 } from "node:path";
1965
1974
  var SEMANTIC_ENABLED = process.env.HIVEMIND_SEMANTIC_SEARCH !== "false" && !embeddingsDisabled();
1966
1975
  var SEMANTIC_TIMEOUT_MS = Number(process.env.HIVEMIND_SEMANTIC_EMBED_TIMEOUT_MS ?? "500");
1967
1976
  function resolveDaemonPath() {
1968
- return join9(dirname2(fileURLToPath(import.meta.url)), "..", "embeddings", "embed-daemon.js");
1977
+ return join9(dirname3(fileURLToPath(import.meta.url)), "..", "embeddings", "embed-daemon.js");
1969
1978
  }
1970
1979
  var sharedEmbedClient = null;
1971
1980
  function getEmbedClient() {
@@ -2318,13 +2327,13 @@ async function handleGrepDirect(api, table, sessionsTable, params) {
2318
2327
  }
2319
2328
 
2320
2329
  // dist/src/graph/vfs-handler.js
2321
- import { existsSync as existsSync7, mkdirSync as mkdirSync8, readFileSync as readFileSync9, renameSync as renameSync5, writeFileSync as writeFileSync7 } from "node:fs";
2330
+ import { existsSync as existsSync7, mkdirSync as mkdirSync9, readFileSync as readFileSync9, renameSync as renameSync5, writeFileSync as writeFileSync7 } from "node:fs";
2322
2331
  import { createHash as createHash3 } from "node:crypto";
2323
- import { join as join13, dirname as dirname6 } from "node:path";
2332
+ import { join as join13, dirname as dirname7 } from "node:path";
2324
2333
 
2325
2334
  // dist/src/graph/last-build.js
2326
- import { existsSync as existsSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync7, renameSync as renameSync3, writeFileSync as writeFileSync5 } from "node:fs";
2327
- import { dirname as dirname3, join as join10 } from "node:path";
2335
+ import { existsSync as existsSync5, mkdirSync as mkdirSync6, readFileSync as readFileSync7, renameSync as renameSync3, writeFileSync as writeFileSync5 } from "node:fs";
2336
+ import { dirname as dirname4, join as join10 } from "node:path";
2328
2337
  function lastBuildPath(baseDir, worktreeId) {
2329
2338
  if (worktreeId !== void 0) {
2330
2339
  return join10(baseDir, "worktrees", worktreeId, ".last-build.json");
@@ -2374,13 +2383,13 @@ function readLastBuild(baseDir, worktreeId) {
2374
2383
 
2375
2384
  // dist/src/graph/snapshot.js
2376
2385
  import { createHash } from "node:crypto";
2377
- import { mkdirSync as mkdirSync7, renameSync as renameSync4, writeFileSync as writeFileSync6 } from "node:fs";
2386
+ import { mkdirSync as mkdirSync8, renameSync as renameSync4, writeFileSync as writeFileSync6 } from "node:fs";
2378
2387
  import { homedir as homedir8 } from "node:os";
2379
- import { dirname as dirname5, join as join12 } from "node:path";
2388
+ import { dirname as dirname6, join as join12 } from "node:path";
2380
2389
 
2381
2390
  // dist/src/graph/history.js
2382
- import { appendFileSync as appendFileSync2, existsSync as existsSync6, mkdirSync as mkdirSync6, readFileSync as readFileSync8 } from "node:fs";
2383
- import { dirname as dirname4, join as join11 } from "node:path";
2391
+ import { appendFileSync as appendFileSync2, existsSync as existsSync6, mkdirSync as mkdirSync7, readFileSync as readFileSync8 } from "node:fs";
2392
+ import { dirname as dirname5, join as join11 } from "node:path";
2384
2393
 
2385
2394
  // dist/src/graph/resolve/cross-file.js
2386
2395
  import { posix } from "node:path";
@@ -3426,7 +3435,7 @@ function saveHandles(baseDir, worktreeId, ids, pattern) {
3426
3435
  const path2 = handlesPath(baseDir, worktreeId);
3427
3436
  const payload = { pattern, ts: Date.now(), ids };
3428
3437
  try {
3429
- mkdirSync8(dirname6(path2), { recursive: true });
3438
+ mkdirSync9(dirname7(path2), { recursive: true });
3430
3439
  const tmp = `${path2}.tmp.${process.pid}.${Date.now()}`;
3431
3440
  writeFileSync7(tmp, JSON.stringify(payload));
3432
3441
  renameSync5(tmp, path2);
@@ -4179,7 +4188,7 @@ async function executeCompiledBashCommand(api, memoryTable, sessionsTable, cmd,
4179
4188
  }
4180
4189
 
4181
4190
  // dist/src/hooks/query-cache.js
4182
- import { mkdirSync as mkdirSync9, readFileSync as readFileSync10, rmSync, writeFileSync as writeFileSync8 } from "node:fs";
4191
+ import { mkdirSync as mkdirSync10, readFileSync as readFileSync10, rmSync, writeFileSync as writeFileSync8 } from "node:fs";
4183
4192
  import { join as join14 } from "node:path";
4184
4193
  import { homedir as homedir9 } from "node:os";
4185
4194
  var log5 = (msg) => log("query-cache", msg);
@@ -4204,7 +4213,7 @@ function writeCachedIndexContent(sessionId, content, deps = {}) {
4204
4213
  const { logFn = log5 } = deps;
4205
4214
  try {
4206
4215
  const dir = getSessionQueryCacheDir(sessionId, deps);
4207
- mkdirSync9(dir, { recursive: true });
4216
+ mkdirSync10(dir, { recursive: true });
4208
4217
  writeFileSync8(join14(dir, INDEX_CACHE_FILE), content, "utf-8");
4209
4218
  } catch (e) {
4210
4219
  logFn(`write failed for session=${sessionId}: ${e.message}`);
@@ -4405,12 +4414,12 @@ function splitOrgSkill(skill) {
4405
4414
  }
4406
4415
 
4407
4416
  // dist/src/skillify/manifest.js
4408
- import { existsSync as existsSync9, lstatSync, mkdirSync as mkdirSync10, readFileSync as readFileSync11, renameSync as renameSync7, unlinkSync as unlinkSync4, writeFileSync as writeFileSync9 } from "node:fs";
4409
- import { dirname as dirname8, join as join18 } from "node:path";
4417
+ import { existsSync as existsSync9, lstatSync, mkdirSync as mkdirSync11, readFileSync as readFileSync11, renameSync as renameSync7, unlinkSync as unlinkSync4, writeFileSync as writeFileSync9 } from "node:fs";
4418
+ import { dirname as dirname9, join as join18 } from "node:path";
4410
4419
 
4411
4420
  // dist/src/skillify/legacy-migration.js
4412
4421
  import { existsSync as existsSync8, renameSync as renameSync6 } from "node:fs";
4413
- import { dirname as dirname7, join as join17 } from "node:path";
4422
+ import { dirname as dirname8, join as join17 } from "node:path";
4414
4423
  var dlog = (msg) => log("skillify-migrate", msg);
4415
4424
  var attempted = false;
4416
4425
  function migrateLegacyStateDir() {
@@ -4420,7 +4429,7 @@ function migrateLegacyStateDir() {
4420
4429
  return;
4421
4430
  attempted = true;
4422
4431
  const current = getStateDir();
4423
- const legacy = join17(dirname7(current), "skilify");
4432
+ const legacy = join17(dirname8(current), "skilify");
4424
4433
  if (!existsSync8(legacy))
4425
4434
  return;
4426
4435
  if (existsSync8(current))
@@ -4592,6 +4601,7 @@ function armSkillOptOnSkillUse(sessionId, toolName, toolInput, toolUseId) {
4592
4601
  }
4593
4602
 
4594
4603
  // dist/src/hooks/codex/pre-tool-use.js
4604
+ var __bundleDir = dirname10(fileURLToPath4(import.meta.url));
4595
4605
  var log6 = (msg) => log("codex-pre", msg);
4596
4606
  function buildUnsupportedGuidance() {
4597
4607
  return "This command is not supported for ~/.deeplake/memory/ operations. Only bash builtins are available: cat, ls, grep, echo, jq, head, tail, wc, sort, find, etc. Do NOT use python, python3, node, curl, or other interpreters. Rewrite your command using only bash tools and retry.";
@@ -4801,12 +4811,22 @@ async function processCodexPreToolUse(input, deps = {}) {
4801
4811
  logFn(`direct query failed: ${e.message}`);
4802
4812
  }
4803
4813
  }
4804
- logFn(`unroutable memory command, blocking with guidance: ${rewritten}`);
4805
- return {
4806
- action: "block",
4807
- output: buildUnsupportedGuidance(),
4808
- rewrittenCommand: rewritten
4809
- };
4814
+ const isWriteRedirect = /^\s*(echo|printf|tee)\b/.test(rewritten) && /\s>>?\s/.test(rewritten);
4815
+ const shellBundle = join19(__bundleDir, "shell", "deeplake-shell.js");
4816
+ logFn(`unroutable memory command, falling back to VFS shell: ${rewritten}`);
4817
+ try {
4818
+ const proc = spawnSync("node", [shellBundle, "-c", rewritten], {
4819
+ encoding: "utf-8",
4820
+ timeout: 1e4
4821
+ });
4822
+ if (proc.status === 0 || proc.stdout && proc.stdout.trim()) {
4823
+ const output = (proc.stdout?.trim() ?? "") || "(done)";
4824
+ return { action: isWriteRedirect ? "guide" : "block", output, rewrittenCommand: rewritten };
4825
+ }
4826
+ return { action: "block", output: buildUnsupportedGuidance(), rewrittenCommand: rewritten };
4827
+ } catch {
4828
+ return { action: "block", output: buildUnsupportedGuidance(), rewrittenCommand: rewritten };
4829
+ }
4810
4830
  }
4811
4831
  async function main() {
4812
4832
  const input = await readStdin();
@@ -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;
@@ -53,7 +53,7 @@ var init_index_marker_store = __esm({
53
53
  });
54
54
 
55
55
  // dist/src/hooks/codex/session-start-setup.js
56
- import { dirname as dirname2, join as join10 } from "node:path";
56
+ import { dirname as dirname3, join as join10 } from "node:path";
57
57
  import { fileURLToPath } from "node:url";
58
58
  import { homedir as homedir6 } from "node:os";
59
59
 
@@ -148,8 +148,8 @@ function loadConfig() {
148
148
  import { randomUUID as randomUUID2 } from "node:crypto";
149
149
 
150
150
  // dist/src/utils/debug.js
151
- import { appendFileSync } from "node:fs";
152
- import { join as join4 } from "node:path";
151
+ import { appendFileSync, mkdirSync as mkdirSync3 } from "node:fs";
152
+ import { dirname, join as join4 } from "node:path";
153
153
  import { homedir as homedir4 } from "node:os";
154
154
  var LOG = join4(homedir4(), ".deeplake", "hook-debug.log");
155
155
  function isDebug() {
@@ -161,8 +161,12 @@ function utcTimestamp(d = /* @__PURE__ */ new Date()) {
161
161
  function log(tag, msg) {
162
162
  if (!isDebug())
163
163
  return;
164
- appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
164
+ try {
165
+ mkdirSync3(dirname(LOG), { recursive: true });
166
+ appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
165
167
  `);
168
+ } catch {
169
+ }
166
170
  }
167
171
 
168
172
  // dist/src/utils/sql.js
@@ -359,7 +363,7 @@ async function healMissingColumns(args) {
359
363
  }
360
364
 
361
365
  // dist/src/notifications/queue.js
362
- import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, renameSync, mkdirSync as mkdirSync3, openSync, closeSync, unlinkSync as unlinkSync2, statSync } from "node:fs";
366
+ import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, renameSync, mkdirSync as mkdirSync4, openSync, closeSync, unlinkSync as unlinkSync2, statSync } from "node:fs";
363
367
  import { join as join5, resolve } from "node:path";
364
368
  import { homedir as homedir5 } from "node:os";
365
369
  import { setTimeout as sleep } from "node:timers/promises";
@@ -397,14 +401,14 @@ function writeQueue(q) {
397
401
  if (!_isQueuePathInsideHome(path, home)) {
398
402
  throw new Error(`notifications-queue write blocked: ${path} is outside ${home}`);
399
403
  }
400
- mkdirSync3(join5(home, ".deeplake"), { recursive: true, mode: 448 });
404
+ mkdirSync4(join5(home, ".deeplake"), { recursive: true, mode: 448 });
401
405
  const tmp = `${path}.${process.pid}.tmp`;
402
406
  writeFileSync3(tmp, JSON.stringify(q, null, 2), { mode: 384 });
403
407
  renameSync(tmp, path);
404
408
  }
405
409
  async function withQueueLock(fn) {
406
410
  const path = lockPath();
407
- mkdirSync3(join5(homedir5(), ".deeplake"), { recursive: true, mode: 448 });
411
+ mkdirSync4(join5(homedir5(), ".deeplake"), { recursive: true, mode: 448 });
408
412
  let fd = null;
409
413
  for (let attempt = 0; attempt < LOCK_RETRY_MAX; attempt++) {
410
414
  try {
@@ -1002,7 +1006,7 @@ function readStdin() {
1002
1006
  }
1003
1007
 
1004
1008
  // dist/src/utils/wiki-log.js
1005
- import { mkdirSync as mkdirSync5, appendFileSync as appendFileSync2 } from "node:fs";
1009
+ import { mkdirSync as mkdirSync6, appendFileSync as appendFileSync2 } from "node:fs";
1006
1010
  import { join as join7 } from "node:path";
1007
1011
  function makeWikiLogger(hooksDir, filename = "deeplake-wiki.log") {
1008
1012
  const path = join7(hooksDir, filename);
@@ -1010,7 +1014,7 @@ function makeWikiLogger(hooksDir, filename = "deeplake-wiki.log") {
1010
1014
  path,
1011
1015
  log(msg) {
1012
1016
  try {
1013
- mkdirSync5(hooksDir, { recursive: true });
1017
+ mkdirSync6(hooksDir, { recursive: true });
1014
1018
  appendFileSync2(path, `[${utcTimestamp()}] ${msg}
1015
1019
  `);
1016
1020
  } catch {
@@ -1074,7 +1078,7 @@ async function autoUpdate(creds, opts) {
1074
1078
 
1075
1079
  // dist/src/utils/version-check.js
1076
1080
  import { readFileSync as readFileSync6 } from "node:fs";
1077
- import { dirname, join as join9 } from "node:path";
1081
+ import { dirname as dirname2, join as join9 } from "node:path";
1078
1082
  function getInstalledVersion(bundleDir, pluginManifestDir) {
1079
1083
  try {
1080
1084
  const pluginJson = join9(bundleDir, "..", pluginManifestDir, "plugin.json");
@@ -1106,7 +1110,7 @@ function getInstalledVersion(bundleDir, pluginManifestDir) {
1106
1110
  return pkg.version;
1107
1111
  } catch {
1108
1112
  }
1109
- const parent = dirname(dir);
1113
+ const parent = dirname2(dir);
1110
1114
  if (parent === dir)
1111
1115
  break;
1112
1116
  dir = parent;
@@ -1117,7 +1121,7 @@ function getInstalledVersion(bundleDir, pluginManifestDir) {
1117
1121
  // dist/src/hooks/codex/session-start-setup.js
1118
1122
  var log5 = (msg) => log("codex-session-setup", msg);
1119
1123
  var { log: wikiLog } = makeWikiLogger(join10(homedir6(), ".codex", "hooks"));
1120
- var __bundleDir = dirname2(fileURLToPath(import.meta.url));
1124
+ var __bundleDir = dirname3(fileURLToPath(import.meta.url));
1121
1125
  var PLUGIN_VERSION = getInstalledVersion(__bundleDir, ".codex-plugin") ?? "";
1122
1126
  async function createPlaceholder(api, table, sessionId, cwd, userName, orgName, workspaceId) {
1123
1127
  const summaryPath = `/summaries/${userName}/${sessionId}.md`;