@deeplake/hivemind 0.7.27 → 0.7.28

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 (42) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/bundle/cli.js +66 -24
  4. package/codex/bundle/capture.js +10 -5
  5. package/codex/bundle/commands/auth-login.js +10 -5
  6. package/codex/bundle/embeddings/embed-daemon.js +4 -2
  7. package/codex/bundle/pre-tool-use.js +10 -5
  8. package/codex/bundle/session-start-setup.js +10 -5
  9. package/codex/bundle/session-start.js +10 -5
  10. package/codex/bundle/shell/deeplake-shell.js +10 -5
  11. package/codex/bundle/skillify-worker.js +60 -21
  12. package/codex/bundle/stop.js +66 -25
  13. package/codex/bundle/wiki-worker.js +4 -2
  14. package/cursor/bundle/capture.js +63 -22
  15. package/cursor/bundle/commands/auth-login.js +10 -5
  16. package/cursor/bundle/embeddings/embed-daemon.js +4 -2
  17. package/cursor/bundle/pre-tool-use.js +10 -5
  18. package/cursor/bundle/session-end.js +57 -19
  19. package/cursor/bundle/session-start.js +10 -5
  20. package/cursor/bundle/shell/deeplake-shell.js +10 -5
  21. package/cursor/bundle/skillify-worker.js +60 -21
  22. package/cursor/bundle/wiki-worker.js +4 -2
  23. package/hermes/bundle/capture.js +63 -22
  24. package/hermes/bundle/commands/auth-login.js +10 -5
  25. package/hermes/bundle/embeddings/embed-daemon.js +4 -2
  26. package/hermes/bundle/pre-tool-use.js +10 -5
  27. package/hermes/bundle/session-end.js +57 -19
  28. package/hermes/bundle/session-start.js +10 -5
  29. package/hermes/bundle/shell/deeplake-shell.js +10 -5
  30. package/hermes/bundle/skillify-worker.js +60 -21
  31. package/hermes/bundle/wiki-worker.js +4 -2
  32. package/mcp/bundle/server.js +10 -5
  33. package/openclaw/dist/chunks/{auth-creds-AEKS6D3P.js → auth-creds-KKTYIP27.js} +2 -1
  34. package/openclaw/dist/chunks/{chunk-SRCBBT4H.js → chunk-OSD5GJJ5.js} +2 -0
  35. package/openclaw/dist/chunks/{config-ZLH6JFJS.js → config-XEK4MJJS.js} +2 -0
  36. package/openclaw/dist/chunks/{index-marker-store-PGT5CW6T.js → index-marker-store-CPGF2BI7.js} +4 -2
  37. package/openclaw/dist/chunks/{setup-config-C35UK4LP.js → setup-config-VI54GEUM.js} +2 -0
  38. package/openclaw/dist/index.js +68 -19
  39. package/openclaw/dist/skillify-worker.js +67 -27
  40. package/openclaw/openclaw.plugin.json +1 -1
  41. package/openclaw/package.json +1 -1
  42. package/package.json +1 -1
@@ -114,13 +114,15 @@ import { randomUUID } from "node:crypto";
114
114
  import { appendFileSync } from "node:fs";
115
115
  import { join as join2 } from "node:path";
116
116
  import { homedir as homedir2 } from "node:os";
117
- var DEBUG = process.env.HIVEMIND_DEBUG === "1";
118
117
  var LOG = join2(homedir2(), ".deeplake", "hook-debug.log");
118
+ function isDebug() {
119
+ return process.env.HIVEMIND_DEBUG === "1";
120
+ }
119
121
  function utcTimestamp(d = /* @__PURE__ */ new Date()) {
120
122
  return d.toISOString().replace("T", " ").slice(0, 19) + " UTC";
121
123
  }
122
124
  function log(tag, msg) {
123
- if (!DEBUG)
125
+ if (!isDebug())
124
126
  return;
125
127
  appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
126
128
  `);
@@ -175,7 +177,9 @@ var RETRYABLE_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
175
177
  var MAX_RETRIES = 3;
176
178
  var BASE_DELAY_MS = 500;
177
179
  var MAX_CONCURRENCY = 5;
178
- var QUERY_TIMEOUT_MS = Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
180
+ function getQueryTimeoutMs() {
181
+ return Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
182
+ }
179
183
  function sleep(ms) {
180
184
  return new Promise((resolve) => setTimeout(resolve, ms));
181
185
  }
@@ -256,8 +260,9 @@ var DeeplakeApi = class {
256
260
  let lastError;
257
261
  for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
258
262
  let resp;
263
+ const timeoutMs = getQueryTimeoutMs();
259
264
  try {
260
- const signal = AbortSignal.timeout(QUERY_TIMEOUT_MS);
265
+ const signal = AbortSignal.timeout(timeoutMs);
261
266
  resp = await fetch(`${this.apiUrl}/workspaces/${this.workspaceId}/tables/query`, {
262
267
  method: "POST",
263
268
  headers: {
@@ -271,7 +276,7 @@ var DeeplakeApi = class {
271
276
  });
272
277
  } catch (e) {
273
278
  if (isTimeoutError(e)) {
274
- lastError = new Error(`Query timeout after ${QUERY_TIMEOUT_MS}ms`);
279
+ lastError = new Error(`Query timeout after ${timeoutMs}ms`);
275
280
  throw lastError;
276
281
  }
277
282
  lastError = e instanceof Error ? e : new Error(String(e));
@@ -733,33 +738,69 @@ import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync4, appendFileSyn
733
738
  import { homedir as homedir5, tmpdir as tmpdir3 } from "node:os";
734
739
 
735
740
  // dist/src/skillify/gate-runner.js
736
- import { execFileSync } from "node:child_process";
737
741
  import { existsSync as existsSync3 } from "node:fs";
742
+ import { createRequire } from "node:module";
738
743
  import { homedir as homedir4 } from "node:os";
739
744
  import { join as join7 } from "node:path";
745
+ var requireForCp = createRequire(import.meta.url);
746
+ var { execFileSync: runChildProcess } = requireForCp("node:child_process");
747
+ var inheritedEnv = process;
748
+ function firstExistingPath(candidates) {
749
+ for (const c of candidates) {
750
+ if (existsSync3(c))
751
+ return c;
752
+ }
753
+ return null;
754
+ }
740
755
  function findAgentBin(agent) {
741
- const which = (name) => {
742
- try {
743
- const out = execFileSync("which", [name], {
744
- encoding: "utf-8",
745
- stdio: ["ignore", "pipe", "ignore"]
746
- });
747
- return out.trim() || null;
748
- } catch {
749
- return null;
750
- }
751
- };
756
+ const home = homedir4();
752
757
  switch (agent) {
758
+ // /usr/bin/<name> is included in every candidate list — that's the
759
+ // common Linux package-manager install path (apt, dnf, pacman). Old
760
+ // code used `which` which always checked it; the static-scan fix
761
+ // dropped `which`, so /usr/bin needs to be explicit. CodeRabbit on
762
+ // #170 caught the gap.
753
763
  case "claude_code":
754
- return which("claude") ?? join7(homedir4(), ".claude", "local", "claude");
764
+ return firstExistingPath([
765
+ join7(home, ".claude", "local", "claude"),
766
+ "/usr/local/bin/claude",
767
+ "/usr/bin/claude",
768
+ join7(home, ".npm-global", "bin", "claude"),
769
+ join7(home, ".local", "bin", "claude"),
770
+ "/opt/homebrew/bin/claude"
771
+ ]) ?? join7(home, ".claude", "local", "claude");
755
772
  case "codex":
756
- return which("codex") ?? "/usr/local/bin/codex";
773
+ return firstExistingPath([
774
+ "/usr/local/bin/codex",
775
+ "/usr/bin/codex",
776
+ join7(home, ".npm-global", "bin", "codex"),
777
+ join7(home, ".local", "bin", "codex"),
778
+ "/opt/homebrew/bin/codex"
779
+ ]) ?? "/usr/local/bin/codex";
757
780
  case "cursor":
758
- return which("cursor-agent") ?? "/usr/local/bin/cursor-agent";
781
+ return firstExistingPath([
782
+ "/usr/local/bin/cursor-agent",
783
+ "/usr/bin/cursor-agent",
784
+ join7(home, ".npm-global", "bin", "cursor-agent"),
785
+ join7(home, ".local", "bin", "cursor-agent"),
786
+ "/opt/homebrew/bin/cursor-agent"
787
+ ]) ?? "/usr/local/bin/cursor-agent";
759
788
  case "hermes":
760
- return which("hermes") ?? join7(homedir4(), ".local", "bin", "hermes");
789
+ return firstExistingPath([
790
+ join7(home, ".local", "bin", "hermes"),
791
+ "/usr/local/bin/hermes",
792
+ "/usr/bin/hermes",
793
+ join7(home, ".npm-global", "bin", "hermes"),
794
+ "/opt/homebrew/bin/hermes"
795
+ ]) ?? join7(home, ".local", "bin", "hermes");
761
796
  case "pi":
762
- return which("pi") ?? join7(homedir4(), ".local", "bin", "pi");
797
+ return firstExistingPath([
798
+ join7(home, ".local", "bin", "pi"),
799
+ "/usr/local/bin/pi",
800
+ "/usr/bin/pi",
801
+ join7(home, ".npm-global", "bin", "pi"),
802
+ "/opt/homebrew/bin/pi"
803
+ ]) ?? join7(home, ".local", "bin", "pi");
763
804
  }
764
805
  }
765
806
 
@@ -1373,19 +1414,19 @@ function embeddingSqlLiteral(vec) {
1373
1414
  }
1374
1415
 
1375
1416
  // dist/src/embeddings/disable.js
1376
- import { createRequire } from "node:module";
1417
+ import { createRequire as createRequire2 } from "node:module";
1377
1418
  import { homedir as homedir11 } from "node:os";
1378
1419
  import { join as join14 } from "node:path";
1379
1420
  import { pathToFileURL } from "node:url";
1380
1421
  var cachedStatus = null;
1381
1422
  function defaultResolveTransformers() {
1382
1423
  try {
1383
- createRequire(import.meta.url).resolve("@huggingface/transformers");
1424
+ createRequire2(import.meta.url).resolve("@huggingface/transformers");
1384
1425
  return;
1385
1426
  } catch {
1386
1427
  }
1387
1428
  const sharedDir = join14(homedir11(), ".hivemind", "embed-deps");
1388
- createRequire(pathToFileURL(`${sharedDir}/`).href).resolve("@huggingface/transformers");
1429
+ createRequire2(pathToFileURL(`${sharedDir}/`).href).resolve("@huggingface/transformers");
1389
1430
  }
1390
1431
  var _resolve = defaultResolveTransformers;
1391
1432
  function detectStatus() {
@@ -15,10 +15,12 @@ import { join as join2 } from "node:path";
15
15
  import { appendFileSync } from "node:fs";
16
16
  import { join } from "node:path";
17
17
  import { homedir } from "node:os";
18
- var DEBUG = process.env.HIVEMIND_DEBUG === "1";
19
18
  var LOG = join(homedir(), ".deeplake", "hook-debug.log");
19
+ function isDebug() {
20
+ return process.env.HIVEMIND_DEBUG === "1";
21
+ }
20
22
  function log(tag, msg) {
21
- if (!DEBUG)
23
+ if (!isDebug())
22
24
  return;
23
25
  appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
24
26
  `);
@@ -109,13 +109,15 @@ import { randomUUID } from "node:crypto";
109
109
  import { appendFileSync } from "node:fs";
110
110
  import { join as join2 } from "node:path";
111
111
  import { homedir as homedir2 } from "node:os";
112
- var DEBUG = process.env.HIVEMIND_DEBUG === "1";
113
112
  var LOG = join2(homedir2(), ".deeplake", "hook-debug.log");
113
+ function isDebug() {
114
+ return process.env.HIVEMIND_DEBUG === "1";
115
+ }
114
116
  function utcTimestamp(d = /* @__PURE__ */ new Date()) {
115
117
  return d.toISOString().replace("T", " ").slice(0, 19) + " UTC";
116
118
  }
117
119
  function log(tag, msg) {
118
- if (!DEBUG)
120
+ if (!isDebug())
119
121
  return;
120
122
  appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
121
123
  `);
@@ -170,7 +172,9 @@ var RETRYABLE_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
170
172
  var MAX_RETRIES = 3;
171
173
  var BASE_DELAY_MS = 500;
172
174
  var MAX_CONCURRENCY = 5;
173
- var QUERY_TIMEOUT_MS = Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
175
+ function getQueryTimeoutMs() {
176
+ return Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
177
+ }
174
178
  function sleep(ms) {
175
179
  return new Promise((resolve) => setTimeout(resolve, ms));
176
180
  }
@@ -251,8 +255,9 @@ var DeeplakeApi = class {
251
255
  let lastError;
252
256
  for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
253
257
  let resp;
258
+ const timeoutMs = getQueryTimeoutMs();
254
259
  try {
255
- const signal = AbortSignal.timeout(QUERY_TIMEOUT_MS);
260
+ const signal = AbortSignal.timeout(timeoutMs);
256
261
  resp = await fetch(`${this.apiUrl}/workspaces/${this.workspaceId}/tables/query`, {
257
262
  method: "POST",
258
263
  headers: {
@@ -266,7 +271,7 @@ var DeeplakeApi = class {
266
271
  });
267
272
  } catch (e) {
268
273
  if (isTimeoutError(e)) {
269
- lastError = new Error(`Query timeout after ${QUERY_TIMEOUT_MS}ms`);
274
+ lastError = new Error(`Query timeout after ${timeoutMs}ms`);
270
275
  throw lastError;
271
276
  }
272
277
  lastError = e instanceof Error ? e : new Error(String(e));
@@ -1150,33 +1155,69 @@ import { writeFileSync as writeFileSync4, mkdirSync as mkdirSync5, appendFileSyn
1150
1155
  import { homedir as homedir8, tmpdir as tmpdir3 } from "node:os";
1151
1156
 
1152
1157
  // dist/src/skillify/gate-runner.js
1153
- import { execFileSync } from "node:child_process";
1154
1158
  import { existsSync as existsSync5 } from "node:fs";
1159
+ import { createRequire as createRequire2 } from "node:module";
1155
1160
  import { homedir as homedir7 } from "node:os";
1156
1161
  import { join as join10 } from "node:path";
1162
+ var requireForCp = createRequire2(import.meta.url);
1163
+ var { execFileSync: runChildProcess } = requireForCp("node:child_process");
1164
+ var inheritedEnv = process;
1165
+ function firstExistingPath(candidates) {
1166
+ for (const c of candidates) {
1167
+ if (existsSync5(c))
1168
+ return c;
1169
+ }
1170
+ return null;
1171
+ }
1157
1172
  function findAgentBin(agent) {
1158
- const which = (name) => {
1159
- try {
1160
- const out = execFileSync("which", [name], {
1161
- encoding: "utf-8",
1162
- stdio: ["ignore", "pipe", "ignore"]
1163
- });
1164
- return out.trim() || null;
1165
- } catch {
1166
- return null;
1167
- }
1168
- };
1173
+ const home = homedir7();
1169
1174
  switch (agent) {
1175
+ // /usr/bin/<name> is included in every candidate list — that's the
1176
+ // common Linux package-manager install path (apt, dnf, pacman). Old
1177
+ // code used `which` which always checked it; the static-scan fix
1178
+ // dropped `which`, so /usr/bin needs to be explicit. CodeRabbit on
1179
+ // #170 caught the gap.
1170
1180
  case "claude_code":
1171
- return which("claude") ?? join10(homedir7(), ".claude", "local", "claude");
1181
+ return firstExistingPath([
1182
+ join10(home, ".claude", "local", "claude"),
1183
+ "/usr/local/bin/claude",
1184
+ "/usr/bin/claude",
1185
+ join10(home, ".npm-global", "bin", "claude"),
1186
+ join10(home, ".local", "bin", "claude"),
1187
+ "/opt/homebrew/bin/claude"
1188
+ ]) ?? join10(home, ".claude", "local", "claude");
1172
1189
  case "codex":
1173
- return which("codex") ?? "/usr/local/bin/codex";
1190
+ return firstExistingPath([
1191
+ "/usr/local/bin/codex",
1192
+ "/usr/bin/codex",
1193
+ join10(home, ".npm-global", "bin", "codex"),
1194
+ join10(home, ".local", "bin", "codex"),
1195
+ "/opt/homebrew/bin/codex"
1196
+ ]) ?? "/usr/local/bin/codex";
1174
1197
  case "cursor":
1175
- return which("cursor-agent") ?? "/usr/local/bin/cursor-agent";
1198
+ return firstExistingPath([
1199
+ "/usr/local/bin/cursor-agent",
1200
+ "/usr/bin/cursor-agent",
1201
+ join10(home, ".npm-global", "bin", "cursor-agent"),
1202
+ join10(home, ".local", "bin", "cursor-agent"),
1203
+ "/opt/homebrew/bin/cursor-agent"
1204
+ ]) ?? "/usr/local/bin/cursor-agent";
1176
1205
  case "hermes":
1177
- return which("hermes") ?? join10(homedir7(), ".local", "bin", "hermes");
1206
+ return firstExistingPath([
1207
+ join10(home, ".local", "bin", "hermes"),
1208
+ "/usr/local/bin/hermes",
1209
+ "/usr/bin/hermes",
1210
+ join10(home, ".npm-global", "bin", "hermes"),
1211
+ "/opt/homebrew/bin/hermes"
1212
+ ]) ?? join10(home, ".local", "bin", "hermes");
1178
1213
  case "pi":
1179
- return which("pi") ?? join10(homedir7(), ".local", "bin", "pi");
1214
+ return firstExistingPath([
1215
+ join10(home, ".local", "bin", "pi"),
1216
+ "/usr/local/bin/pi",
1217
+ "/usr/bin/pi",
1218
+ join10(home, ".npm-global", "bin", "pi"),
1219
+ "/opt/homebrew/bin/pi"
1220
+ ]) ?? join10(home, ".local", "bin", "pi");
1180
1221
  }
1181
1222
  }
1182
1223
 
@@ -311,10 +311,12 @@ import { randomUUID } from "node:crypto";
311
311
  import { appendFileSync } from "node:fs";
312
312
  import { join as join3 } from "node:path";
313
313
  import { homedir as homedir3 } from "node:os";
314
- var DEBUG = process.env.HIVEMIND_DEBUG === "1";
315
314
  var LOG = join3(homedir3(), ".deeplake", "hook-debug.log");
315
+ function isDebug() {
316
+ return process.env.HIVEMIND_DEBUG === "1";
317
+ }
316
318
  function log(tag, msg) {
317
- if (!DEBUG)
319
+ if (!isDebug())
318
320
  return;
319
321
  appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
320
322
  `);
@@ -360,7 +362,9 @@ var RETRYABLE_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
360
362
  var MAX_RETRIES = 3;
361
363
  var BASE_DELAY_MS = 500;
362
364
  var MAX_CONCURRENCY = 5;
363
- var QUERY_TIMEOUT_MS = Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
365
+ function getQueryTimeoutMs() {
366
+ return Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
367
+ }
364
368
  function sleep(ms) {
365
369
  return new Promise((resolve) => setTimeout(resolve, ms));
366
370
  }
@@ -441,8 +445,9 @@ var DeeplakeApi = class {
441
445
  let lastError;
442
446
  for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
443
447
  let resp;
448
+ const timeoutMs = getQueryTimeoutMs();
444
449
  try {
445
- const signal = AbortSignal.timeout(QUERY_TIMEOUT_MS);
450
+ const signal = AbortSignal.timeout(timeoutMs);
446
451
  resp = await fetch(`${this.apiUrl}/workspaces/${this.workspaceId}/tables/query`, {
447
452
  method: "POST",
448
453
  headers: {
@@ -456,7 +461,7 @@ var DeeplakeApi = class {
456
461
  });
457
462
  } catch (e) {
458
463
  if (isTimeoutError(e)) {
459
- lastError = new Error(`Query timeout after ${QUERY_TIMEOUT_MS}ms`);
464
+ lastError = new Error(`Query timeout after ${timeoutMs}ms`);
460
465
  throw lastError;
461
466
  }
462
467
  lastError = e instanceof Error ? e : new Error(String(e));
@@ -96,10 +96,12 @@ var NomicEmbedder = class {
96
96
  import { appendFileSync } from "node:fs";
97
97
  import { join } from "node:path";
98
98
  import { homedir } from "node:os";
99
- var DEBUG = process.env.HIVEMIND_DEBUG === "1";
100
99
  var LOG = join(homedir(), ".deeplake", "hook-debug.log");
100
+ function isDebug() {
101
+ return process.env.HIVEMIND_DEBUG === "1";
102
+ }
101
103
  function log(tag, msg) {
102
- if (!DEBUG)
104
+ if (!isDebug())
103
105
  return;
104
106
  appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
105
107
  `);
@@ -108,10 +108,12 @@ import { randomUUID } from "node:crypto";
108
108
  import { appendFileSync } from "node:fs";
109
109
  import { join as join2 } from "node:path";
110
110
  import { homedir as homedir2 } from "node:os";
111
- var DEBUG = process.env.HIVEMIND_DEBUG === "1";
112
111
  var LOG = join2(homedir2(), ".deeplake", "hook-debug.log");
112
+ function isDebug() {
113
+ return process.env.HIVEMIND_DEBUG === "1";
114
+ }
113
115
  function log(tag, msg) {
114
- if (!DEBUG)
116
+ if (!isDebug())
115
117
  return;
116
118
  appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
117
119
  `);
@@ -169,7 +171,9 @@ var RETRYABLE_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
169
171
  var MAX_RETRIES = 3;
170
172
  var BASE_DELAY_MS = 500;
171
173
  var MAX_CONCURRENCY = 5;
172
- var QUERY_TIMEOUT_MS = Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
174
+ function getQueryTimeoutMs() {
175
+ return Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
176
+ }
173
177
  function sleep(ms) {
174
178
  return new Promise((resolve) => setTimeout(resolve, ms));
175
179
  }
@@ -250,8 +254,9 @@ var DeeplakeApi = class {
250
254
  let lastError;
251
255
  for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
252
256
  let resp;
257
+ const timeoutMs = getQueryTimeoutMs();
253
258
  try {
254
- const signal = AbortSignal.timeout(QUERY_TIMEOUT_MS);
259
+ const signal = AbortSignal.timeout(timeoutMs);
255
260
  resp = await fetch(`${this.apiUrl}/workspaces/${this.workspaceId}/tables/query`, {
256
261
  method: "POST",
257
262
  headers: {
@@ -265,7 +270,7 @@ var DeeplakeApi = class {
265
270
  });
266
271
  } catch (e) {
267
272
  if (isTimeoutError(e)) {
268
- lastError = new Error(`Query timeout after ${QUERY_TIMEOUT_MS}ms`);
273
+ lastError = new Error(`Query timeout after ${timeoutMs}ms`);
269
274
  throw lastError;
270
275
  }
271
276
  lastError = e instanceof Error ? e : new Error(String(e));
@@ -21,13 +21,15 @@ function readStdin() {
21
21
  import { appendFileSync } from "node:fs";
22
22
  import { join } from "node:path";
23
23
  import { homedir } from "node:os";
24
- var DEBUG = process.env.HIVEMIND_DEBUG === "1";
25
24
  var LOG = join(homedir(), ".deeplake", "hook-debug.log");
25
+ function isDebug() {
26
+ return process.env.HIVEMIND_DEBUG === "1";
27
+ }
26
28
  function utcTimestamp(d = /* @__PURE__ */ new Date()) {
27
29
  return d.toISOString().replace("T", " ").slice(0, 19) + " UTC";
28
30
  }
29
31
  function log(tag, msg) {
30
- if (!DEBUG)
32
+ if (!isDebug())
31
33
  return;
32
34
  appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
33
35
  `);
@@ -282,33 +284,69 @@ import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync4, appendFileSyn
282
284
  import { homedir as homedir6, tmpdir as tmpdir2 } from "node:os";
283
285
 
284
286
  // dist/src/skillify/gate-runner.js
285
- import { execFileSync } from "node:child_process";
286
287
  import { existsSync as existsSync3 } from "node:fs";
288
+ import { createRequire } from "node:module";
287
289
  import { homedir as homedir5 } from "node:os";
288
290
  import { join as join7 } from "node:path";
291
+ var requireForCp = createRequire(import.meta.url);
292
+ var { execFileSync: runChildProcess } = requireForCp("node:child_process");
293
+ var inheritedEnv = process;
294
+ function firstExistingPath(candidates) {
295
+ for (const c of candidates) {
296
+ if (existsSync3(c))
297
+ return c;
298
+ }
299
+ return null;
300
+ }
289
301
  function findAgentBin(agent) {
290
- const which = (name) => {
291
- try {
292
- const out = execFileSync("which", [name], {
293
- encoding: "utf-8",
294
- stdio: ["ignore", "pipe", "ignore"]
295
- });
296
- return out.trim() || null;
297
- } catch {
298
- return null;
299
- }
300
- };
302
+ const home = homedir5();
301
303
  switch (agent) {
304
+ // /usr/bin/<name> is included in every candidate list — that's the
305
+ // common Linux package-manager install path (apt, dnf, pacman). Old
306
+ // code used `which` which always checked it; the static-scan fix
307
+ // dropped `which`, so /usr/bin needs to be explicit. CodeRabbit on
308
+ // #170 caught the gap.
302
309
  case "claude_code":
303
- return which("claude") ?? join7(homedir5(), ".claude", "local", "claude");
310
+ return firstExistingPath([
311
+ join7(home, ".claude", "local", "claude"),
312
+ "/usr/local/bin/claude",
313
+ "/usr/bin/claude",
314
+ join7(home, ".npm-global", "bin", "claude"),
315
+ join7(home, ".local", "bin", "claude"),
316
+ "/opt/homebrew/bin/claude"
317
+ ]) ?? join7(home, ".claude", "local", "claude");
304
318
  case "codex":
305
- return which("codex") ?? "/usr/local/bin/codex";
319
+ return firstExistingPath([
320
+ "/usr/local/bin/codex",
321
+ "/usr/bin/codex",
322
+ join7(home, ".npm-global", "bin", "codex"),
323
+ join7(home, ".local", "bin", "codex"),
324
+ "/opt/homebrew/bin/codex"
325
+ ]) ?? "/usr/local/bin/codex";
306
326
  case "cursor":
307
- return which("cursor-agent") ?? "/usr/local/bin/cursor-agent";
327
+ return firstExistingPath([
328
+ "/usr/local/bin/cursor-agent",
329
+ "/usr/bin/cursor-agent",
330
+ join7(home, ".npm-global", "bin", "cursor-agent"),
331
+ join7(home, ".local", "bin", "cursor-agent"),
332
+ "/opt/homebrew/bin/cursor-agent"
333
+ ]) ?? "/usr/local/bin/cursor-agent";
308
334
  case "hermes":
309
- return which("hermes") ?? join7(homedir5(), ".local", "bin", "hermes");
335
+ return firstExistingPath([
336
+ join7(home, ".local", "bin", "hermes"),
337
+ "/usr/local/bin/hermes",
338
+ "/usr/bin/hermes",
339
+ join7(home, ".npm-global", "bin", "hermes"),
340
+ "/opt/homebrew/bin/hermes"
341
+ ]) ?? join7(home, ".local", "bin", "hermes");
310
342
  case "pi":
311
- return which("pi") ?? join7(homedir5(), ".local", "bin", "pi");
343
+ return firstExistingPath([
344
+ join7(home, ".local", "bin", "pi"),
345
+ "/usr/local/bin/pi",
346
+ "/usr/bin/pi",
347
+ join7(home, ".npm-global", "bin", "pi"),
348
+ "/opt/homebrew/bin/pi"
349
+ ]) ?? join7(home, ".local", "bin", "pi");
312
350
  }
313
351
  }
314
352
 
@@ -126,10 +126,12 @@ import { randomUUID } from "node:crypto";
126
126
  import { appendFileSync } from "node:fs";
127
127
  import { join as join3 } from "node:path";
128
128
  import { homedir as homedir3 } from "node:os";
129
- var DEBUG = process.env.HIVEMIND_DEBUG === "1";
130
129
  var LOG = join3(homedir3(), ".deeplake", "hook-debug.log");
130
+ function isDebug() {
131
+ return process.env.HIVEMIND_DEBUG === "1";
132
+ }
131
133
  function log(tag, msg) {
132
- if (!DEBUG)
134
+ if (!isDebug())
133
135
  return;
134
136
  appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
135
137
  `);
@@ -175,7 +177,9 @@ var RETRYABLE_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
175
177
  var MAX_RETRIES = 3;
176
178
  var BASE_DELAY_MS = 500;
177
179
  var MAX_CONCURRENCY = 5;
178
- var QUERY_TIMEOUT_MS = Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
180
+ function getQueryTimeoutMs() {
181
+ return Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
182
+ }
179
183
  function sleep(ms) {
180
184
  return new Promise((resolve) => setTimeout(resolve, ms));
181
185
  }
@@ -256,8 +260,9 @@ var DeeplakeApi = class {
256
260
  let lastError;
257
261
  for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
258
262
  let resp;
263
+ const timeoutMs = getQueryTimeoutMs();
259
264
  try {
260
- const signal = AbortSignal.timeout(QUERY_TIMEOUT_MS);
265
+ const signal = AbortSignal.timeout(timeoutMs);
261
266
  resp = await fetch(`${this.apiUrl}/workspaces/${this.workspaceId}/tables/query`, {
262
267
  method: "POST",
263
268
  headers: {
@@ -271,7 +276,7 @@ var DeeplakeApi = class {
271
276
  });
272
277
  } catch (e) {
273
278
  if (isTimeoutError(e)) {
274
- lastError = new Error(`Query timeout after ${QUERY_TIMEOUT_MS}ms`);
279
+ lastError = new Error(`Query timeout after ${timeoutMs}ms`);
275
280
  throw lastError;
276
281
  }
277
282
  lastError = e instanceof Error ? e : new Error(String(e));
@@ -66803,10 +66803,12 @@ import { randomUUID } from "node:crypto";
66803
66803
  import { appendFileSync } from "node:fs";
66804
66804
  import { join as join5 } from "node:path";
66805
66805
  import { homedir as homedir2 } from "node:os";
66806
- var DEBUG = process.env.HIVEMIND_DEBUG === "1";
66807
66806
  var LOG = join5(homedir2(), ".deeplake", "hook-debug.log");
66807
+ function isDebug() {
66808
+ return process.env.HIVEMIND_DEBUG === "1";
66809
+ }
66808
66810
  function log(tag, msg) {
66809
- if (!DEBUG)
66811
+ if (!isDebug())
66810
66812
  return;
66811
66813
  appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
66812
66814
  `);
@@ -66864,7 +66866,9 @@ var RETRYABLE_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
66864
66866
  var MAX_RETRIES = 3;
66865
66867
  var BASE_DELAY_MS = 500;
66866
66868
  var MAX_CONCURRENCY = 5;
66867
- var QUERY_TIMEOUT_MS = Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
66869
+ function getQueryTimeoutMs() {
66870
+ return Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
66871
+ }
66868
66872
  function sleep(ms3) {
66869
66873
  return new Promise((resolve5) => setTimeout(resolve5, ms3));
66870
66874
  }
@@ -66945,8 +66949,9 @@ var DeeplakeApi = class {
66945
66949
  let lastError;
66946
66950
  for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
66947
66951
  let resp;
66952
+ const timeoutMs = getQueryTimeoutMs();
66948
66953
  try {
66949
- const signal = AbortSignal.timeout(QUERY_TIMEOUT_MS);
66954
+ const signal = AbortSignal.timeout(timeoutMs);
66950
66955
  resp = await fetch(`${this.apiUrl}/workspaces/${this.workspaceId}/tables/query`, {
66951
66956
  method: "POST",
66952
66957
  headers: {
@@ -66960,7 +66965,7 @@ var DeeplakeApi = class {
66960
66965
  });
66961
66966
  } catch (e6) {
66962
66967
  if (isTimeoutError(e6)) {
66963
- lastError = new Error(`Query timeout after ${QUERY_TIMEOUT_MS}ms`);
66968
+ lastError = new Error(`Query timeout after ${timeoutMs}ms`);
66964
66969
  throw lastError;
66965
66970
  }
66966
66971
  lastError = e6 instanceof Error ? e6 : new Error(String(e6));