@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
@@ -6,13 +6,13 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Cloud-backed persistent shared memory for AI agents powered by Deeplake",
9
- "version": "0.7.27"
9
+ "version": "0.7.28"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "hivemind",
14
14
  "description": "Persistent shared memory powered by Deeplake — captures all session activity and provides cross-session, cross-agent memory search",
15
- "version": "0.7.27",
15
+ "version": "0.7.28",
16
16
  "source": "./claude-code",
17
17
  "homepage": "https://github.com/activeloopai/hivemind"
18
18
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hivemind",
3
3
  "description": "Cloud-backed persistent memory powered by Deeplake — read, write, and share memory across Claude Code sessions and agents",
4
- "version": "0.7.27",
4
+ "version": "0.7.28",
5
5
  "author": {
6
6
  "name": "Activeloop",
7
7
  "url": "https://deeplake.ai"
package/bundle/cli.js CHANGED
@@ -500,6 +500,7 @@ function installOpenclaw() {
500
500
  throw new Error(`OpenClaw bundle missing at ${srcDist}. Run 'npm run build' first.`);
501
501
  }
502
502
  ensureDir(PLUGIN_DIR2);
503
+ rmSync(join5(PLUGIN_DIR2, "dist"), { recursive: true, force: true });
503
504
  copyDir(srcDist, join5(PLUGIN_DIR2, "dist"));
504
505
  if (existsSync4(srcManifest))
505
506
  copyFileSync(srcManifest, join5(PLUGIN_DIR2, "openclaw.plugin.json"));
@@ -4038,10 +4039,12 @@ import { randomUUID } from "node:crypto";
4038
4039
  import { appendFileSync } from "node:fs";
4039
4040
  import { join as join14 } from "node:path";
4040
4041
  import { homedir as homedir5 } from "node:os";
4041
- var DEBUG = process.env.HIVEMIND_DEBUG === "1";
4042
4042
  var LOG = join14(homedir5(), ".deeplake", "hook-debug.log");
4043
+ function isDebug() {
4044
+ return process.env.HIVEMIND_DEBUG === "1";
4045
+ }
4043
4046
  function log2(tag, msg) {
4044
- if (!DEBUG)
4047
+ if (!isDebug())
4045
4048
  return;
4046
4049
  appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
4047
4050
  `);
@@ -4087,7 +4090,9 @@ var RETRYABLE_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
4087
4090
  var MAX_RETRIES = 3;
4088
4091
  var BASE_DELAY_MS = 500;
4089
4092
  var MAX_CONCURRENCY = 5;
4090
- var QUERY_TIMEOUT_MS = Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
4093
+ function getQueryTimeoutMs() {
4094
+ return Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
4095
+ }
4091
4096
  function sleep(ms) {
4092
4097
  return new Promise((resolve) => setTimeout(resolve, ms));
4093
4098
  }
@@ -4168,8 +4173,9 @@ var DeeplakeApi = class {
4168
4173
  let lastError;
4169
4174
  for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
4170
4175
  let resp;
4176
+ const timeoutMs = getQueryTimeoutMs();
4171
4177
  try {
4172
- const signal = AbortSignal.timeout(QUERY_TIMEOUT_MS);
4178
+ const signal = AbortSignal.timeout(timeoutMs);
4173
4179
  resp = await fetch(`${this.apiUrl}/workspaces/${this.workspaceId}/tables/query`, {
4174
4180
  method: "POST",
4175
4181
  headers: {
@@ -4183,7 +4189,7 @@ var DeeplakeApi = class {
4183
4189
  });
4184
4190
  } catch (e) {
4185
4191
  if (isTimeoutError(e)) {
4186
- lastError = new Error(`Query timeout after ${QUERY_TIMEOUT_MS}ms`);
4192
+ lastError = new Error(`Query timeout after ${timeoutMs}ms`);
4187
4193
  throw lastError;
4188
4194
  }
4189
4195
  lastError = e instanceof Error ? e : new Error(String(e));
@@ -5914,33 +5920,69 @@ function extractPairs(rows) {
5914
5920
  }
5915
5921
 
5916
5922
  // dist/src/skillify/gate-runner.js
5917
- import { execFileSync as execFileSync4 } from "node:child_process";
5918
5923
  import { existsSync as existsSync21 } from "node:fs";
5924
+ import { createRequire } from "node:module";
5919
5925
  import { homedir as homedir14 } from "node:os";
5920
5926
  import { join as join24 } from "node:path";
5927
+ var requireForCp = createRequire(import.meta.url);
5928
+ var { execFileSync: runChildProcess } = requireForCp("node:child_process");
5929
+ var inheritedEnv = process;
5930
+ function firstExistingPath(candidates) {
5931
+ for (const c of candidates) {
5932
+ if (existsSync21(c))
5933
+ return c;
5934
+ }
5935
+ return null;
5936
+ }
5921
5937
  function findAgentBin(agent) {
5922
- const which = (name) => {
5923
- try {
5924
- const out = execFileSync4("which", [name], {
5925
- encoding: "utf-8",
5926
- stdio: ["ignore", "pipe", "ignore"]
5927
- });
5928
- return out.trim() || null;
5929
- } catch {
5930
- return null;
5931
- }
5932
- };
5938
+ const home = homedir14();
5933
5939
  switch (agent) {
5940
+ // /usr/bin/<name> is included in every candidate list — that's the
5941
+ // common Linux package-manager install path (apt, dnf, pacman). Old
5942
+ // code used `which` which always checked it; the static-scan fix
5943
+ // dropped `which`, so /usr/bin needs to be explicit. CodeRabbit on
5944
+ // #170 caught the gap.
5934
5945
  case "claude_code":
5935
- return which("claude") ?? join24(homedir14(), ".claude", "local", "claude");
5946
+ return firstExistingPath([
5947
+ join24(home, ".claude", "local", "claude"),
5948
+ "/usr/local/bin/claude",
5949
+ "/usr/bin/claude",
5950
+ join24(home, ".npm-global", "bin", "claude"),
5951
+ join24(home, ".local", "bin", "claude"),
5952
+ "/opt/homebrew/bin/claude"
5953
+ ]) ?? join24(home, ".claude", "local", "claude");
5936
5954
  case "codex":
5937
- return which("codex") ?? "/usr/local/bin/codex";
5955
+ return firstExistingPath([
5956
+ "/usr/local/bin/codex",
5957
+ "/usr/bin/codex",
5958
+ join24(home, ".npm-global", "bin", "codex"),
5959
+ join24(home, ".local", "bin", "codex"),
5960
+ "/opt/homebrew/bin/codex"
5961
+ ]) ?? "/usr/local/bin/codex";
5938
5962
  case "cursor":
5939
- return which("cursor-agent") ?? "/usr/local/bin/cursor-agent";
5963
+ return firstExistingPath([
5964
+ "/usr/local/bin/cursor-agent",
5965
+ "/usr/bin/cursor-agent",
5966
+ join24(home, ".npm-global", "bin", "cursor-agent"),
5967
+ join24(home, ".local", "bin", "cursor-agent"),
5968
+ "/opt/homebrew/bin/cursor-agent"
5969
+ ]) ?? "/usr/local/bin/cursor-agent";
5940
5970
  case "hermes":
5941
- return which("hermes") ?? join24(homedir14(), ".local", "bin", "hermes");
5971
+ return firstExistingPath([
5972
+ join24(home, ".local", "bin", "hermes"),
5973
+ "/usr/local/bin/hermes",
5974
+ "/usr/bin/hermes",
5975
+ join24(home, ".npm-global", "bin", "hermes"),
5976
+ "/opt/homebrew/bin/hermes"
5977
+ ]) ?? join24(home, ".local", "bin", "hermes");
5942
5978
  case "pi":
5943
- return which("pi") ?? join24(homedir14(), ".local", "bin", "pi");
5979
+ return firstExistingPath([
5980
+ join24(home, ".local", "bin", "pi"),
5981
+ "/usr/local/bin/pi",
5982
+ "/usr/bin/pi",
5983
+ join24(home, ".npm-global", "bin", "pi"),
5984
+ "/opt/homebrew/bin/pi"
5985
+ ]) ?? join24(home, ".local", "bin", "pi");
5944
5986
  }
5945
5987
  }
5946
5988
 
@@ -6917,7 +6959,7 @@ if (process.argv[1] && process.argv[1].endsWith("skillify.js")) {
6917
6959
  }
6918
6960
 
6919
6961
  // dist/src/cli/update.js
6920
- import { execFileSync as execFileSync5 } from "node:child_process";
6962
+ import { execFileSync as execFileSync4 } from "node:child_process";
6921
6963
  import { existsSync as existsSync25, readFileSync as readFileSync19, realpathSync } from "node:fs";
6922
6964
  import { dirname as dirname8, sep } from "node:path";
6923
6965
  import { fileURLToPath as fileURLToPath2 } from "node:url";
@@ -6991,7 +7033,7 @@ async function getLatestNpmVersion(timeoutMs = 5e3) {
6991
7033
  }
6992
7034
  }
6993
7035
  var defaultSpawn = (cmd, args) => {
6994
- execFileSync5(cmd, args, { stdio: "inherit" });
7036
+ execFileSync4(cmd, args, { stdio: "inherit" });
6995
7037
  };
6996
7038
  async function runUpdate(opts = {}) {
6997
7039
  const current = opts.currentVersionOverride ?? getVersion();
@@ -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));
@@ -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
  `);
@@ -115,10 +115,12 @@ import { randomUUID } from "node:crypto";
115
115
  import { appendFileSync } from "node:fs";
116
116
  import { join as join2 } from "node:path";
117
117
  import { homedir as homedir2 } from "node:os";
118
- var DEBUG = process.env.HIVEMIND_DEBUG === "1";
119
118
  var LOG = join2(homedir2(), ".deeplake", "hook-debug.log");
119
+ function isDebug() {
120
+ return process.env.HIVEMIND_DEBUG === "1";
121
+ }
120
122
  function log(tag, msg) {
121
- if (!DEBUG)
123
+ if (!isDebug())
122
124
  return;
123
125
  appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
124
126
  `);
@@ -176,7 +178,9 @@ var RETRYABLE_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
176
178
  var MAX_RETRIES = 3;
177
179
  var BASE_DELAY_MS = 500;
178
180
  var MAX_CONCURRENCY = 5;
179
- var QUERY_TIMEOUT_MS = Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
181
+ function getQueryTimeoutMs() {
182
+ return Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
183
+ }
180
184
  function sleep(ms) {
181
185
  return new Promise((resolve2) => setTimeout(resolve2, ms));
182
186
  }
@@ -257,8 +261,9 @@ var DeeplakeApi = class {
257
261
  let lastError;
258
262
  for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
259
263
  let resp;
264
+ const timeoutMs = getQueryTimeoutMs();
260
265
  try {
261
- const signal = AbortSignal.timeout(QUERY_TIMEOUT_MS);
266
+ const signal = AbortSignal.timeout(timeoutMs);
262
267
  resp = await fetch(`${this.apiUrl}/workspaces/${this.workspaceId}/tables/query`, {
263
268
  method: "POST",
264
269
  headers: {
@@ -272,7 +277,7 @@ var DeeplakeApi = class {
272
277
  });
273
278
  } catch (e) {
274
279
  if (isTimeoutError(e)) {
275
- lastError = new Error(`Query timeout after ${QUERY_TIMEOUT_MS}ms`);
280
+ lastError = new Error(`Query timeout after ${timeoutMs}ms`);
276
281
  throw lastError;
277
282
  }
278
283
  lastError = e instanceof Error ? e : new Error(String(e));
@@ -131,13 +131,15 @@ import { randomUUID } from "node:crypto";
131
131
  import { appendFileSync } from "node:fs";
132
132
  import { join as join3 } from "node:path";
133
133
  import { homedir as homedir3 } from "node:os";
134
- var DEBUG = process.env.HIVEMIND_DEBUG === "1";
135
134
  var LOG = join3(homedir3(), ".deeplake", "hook-debug.log");
135
+ function isDebug() {
136
+ return process.env.HIVEMIND_DEBUG === "1";
137
+ }
136
138
  function utcTimestamp(d = /* @__PURE__ */ new Date()) {
137
139
  return d.toISOString().replace("T", " ").slice(0, 19) + " UTC";
138
140
  }
139
141
  function log(tag, msg) {
140
- if (!DEBUG)
142
+ if (!isDebug())
141
143
  return;
142
144
  appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
143
145
  `);
@@ -183,7 +185,9 @@ var RETRYABLE_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
183
185
  var MAX_RETRIES = 3;
184
186
  var BASE_DELAY_MS = 500;
185
187
  var MAX_CONCURRENCY = 5;
186
- var QUERY_TIMEOUT_MS = Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
188
+ function getQueryTimeoutMs() {
189
+ return Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
190
+ }
187
191
  function sleep(ms) {
188
192
  return new Promise((resolve) => setTimeout(resolve, ms));
189
193
  }
@@ -264,8 +268,9 @@ var DeeplakeApi = class {
264
268
  let lastError;
265
269
  for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
266
270
  let resp;
271
+ const timeoutMs = getQueryTimeoutMs();
267
272
  try {
268
- const signal = AbortSignal.timeout(QUERY_TIMEOUT_MS);
273
+ const signal = AbortSignal.timeout(timeoutMs);
269
274
  resp = await fetch(`${this.apiUrl}/workspaces/${this.workspaceId}/tables/query`, {
270
275
  method: "POST",
271
276
  headers: {
@@ -279,7 +284,7 @@ var DeeplakeApi = class {
279
284
  });
280
285
  } catch (e) {
281
286
  if (isTimeoutError(e)) {
282
- lastError = new Error(`Query timeout after ${QUERY_TIMEOUT_MS}ms`);
287
+ lastError = new Error(`Query timeout after ${timeoutMs}ms`);
283
288
  throw lastError;
284
289
  }
285
290
  lastError = e instanceof Error ? e : new Error(String(e));
@@ -235,10 +235,12 @@ function maybeAutoMineLocal() {
235
235
  import { appendFileSync } from "node:fs";
236
236
  import { join as join4 } from "node:path";
237
237
  import { homedir as homedir4 } from "node:os";
238
- var DEBUG = process.env.HIVEMIND_DEBUG === "1";
239
238
  var LOG = join4(homedir4(), ".deeplake", "hook-debug.log");
239
+ function isDebug() {
240
+ return process.env.HIVEMIND_DEBUG === "1";
241
+ }
240
242
  function log(tag, msg) {
241
- if (!DEBUG)
243
+ if (!isDebug())
242
244
  return;
243
245
  appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
244
246
  `);
@@ -362,7 +364,9 @@ var RETRYABLE_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
362
364
  var MAX_RETRIES = 3;
363
365
  var BASE_DELAY_MS = 500;
364
366
  var MAX_CONCURRENCY = 5;
365
- var QUERY_TIMEOUT_MS = Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
367
+ function getQueryTimeoutMs() {
368
+ return Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
369
+ }
366
370
  function sleep(ms) {
367
371
  return new Promise((resolve) => setTimeout(resolve, ms));
368
372
  }
@@ -443,8 +447,9 @@ var DeeplakeApi = class {
443
447
  let lastError;
444
448
  for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
445
449
  let resp;
450
+ const timeoutMs = getQueryTimeoutMs();
446
451
  try {
447
- const signal = AbortSignal.timeout(QUERY_TIMEOUT_MS);
452
+ const signal = AbortSignal.timeout(timeoutMs);
448
453
  resp = await fetch(`${this.apiUrl}/workspaces/${this.workspaceId}/tables/query`, {
449
454
  method: "POST",
450
455
  headers: {
@@ -458,7 +463,7 @@ var DeeplakeApi = class {
458
463
  });
459
464
  } catch (e) {
460
465
  if (isTimeoutError(e)) {
461
- lastError = new Error(`Query timeout after ${QUERY_TIMEOUT_MS}ms`);
466
+ lastError = new Error(`Query timeout after ${timeoutMs}ms`);
462
467
  throw lastError;
463
468
  }
464
469
  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));
@@ -8,13 +8,15 @@ import { join as join6 } from "node:path";
8
8
  import { appendFileSync } from "node:fs";
9
9
  import { join } from "node:path";
10
10
  import { homedir } from "node:os";
11
- var DEBUG = process.env.HIVEMIND_DEBUG === "1";
12
11
  var LOG = join(homedir(), ".deeplake", "hook-debug.log");
12
+ function isDebug() {
13
+ return process.env.HIVEMIND_DEBUG === "1";
14
+ }
13
15
  function utcTimestamp(d = /* @__PURE__ */ new Date()) {
14
16
  return d.toISOString().replace("T", " ").slice(0, 19) + " UTC";
15
17
  }
16
18
  function log(tag, msg) {
17
- if (!DEBUG)
19
+ if (!isDebug())
18
20
  return;
19
21
  appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
20
22
  `);
@@ -406,33 +408,69 @@ function parseVerdict(raw) {
406
408
  }
407
409
 
408
410
  // dist/src/skillify/gate-runner.js
409
- import { execFileSync } from "node:child_process";
410
411
  import { existsSync as existsSync2 } from "node:fs";
412
+ import { createRequire } from "node:module";
411
413
  import { homedir as homedir3 } from "node:os";
412
414
  import { join as join3 } from "node:path";
415
+ var requireForCp = createRequire(import.meta.url);
416
+ var { execFileSync: runChildProcess } = requireForCp("node:child_process");
417
+ var inheritedEnv = process;
418
+ function firstExistingPath(candidates) {
419
+ for (const c of candidates) {
420
+ if (existsSync2(c))
421
+ return c;
422
+ }
423
+ return null;
424
+ }
413
425
  function findAgentBin(agent) {
414
- const which = (name) => {
415
- try {
416
- const out = execFileSync("which", [name], {
417
- encoding: "utf-8",
418
- stdio: ["ignore", "pipe", "ignore"]
419
- });
420
- return out.trim() || null;
421
- } catch {
422
- return null;
423
- }
424
- };
426
+ const home = homedir3();
425
427
  switch (agent) {
428
+ // /usr/bin/<name> is included in every candidate list — that's the
429
+ // common Linux package-manager install path (apt, dnf, pacman). Old
430
+ // code used `which` which always checked it; the static-scan fix
431
+ // dropped `which`, so /usr/bin needs to be explicit. CodeRabbit on
432
+ // #170 caught the gap.
426
433
  case "claude_code":
427
- return which("claude") ?? join3(homedir3(), ".claude", "local", "claude");
434
+ return firstExistingPath([
435
+ join3(home, ".claude", "local", "claude"),
436
+ "/usr/local/bin/claude",
437
+ "/usr/bin/claude",
438
+ join3(home, ".npm-global", "bin", "claude"),
439
+ join3(home, ".local", "bin", "claude"),
440
+ "/opt/homebrew/bin/claude"
441
+ ]) ?? join3(home, ".claude", "local", "claude");
428
442
  case "codex":
429
- return which("codex") ?? "/usr/local/bin/codex";
443
+ return firstExistingPath([
444
+ "/usr/local/bin/codex",
445
+ "/usr/bin/codex",
446
+ join3(home, ".npm-global", "bin", "codex"),
447
+ join3(home, ".local", "bin", "codex"),
448
+ "/opt/homebrew/bin/codex"
449
+ ]) ?? "/usr/local/bin/codex";
430
450
  case "cursor":
431
- return which("cursor-agent") ?? "/usr/local/bin/cursor-agent";
451
+ return firstExistingPath([
452
+ "/usr/local/bin/cursor-agent",
453
+ "/usr/bin/cursor-agent",
454
+ join3(home, ".npm-global", "bin", "cursor-agent"),
455
+ join3(home, ".local", "bin", "cursor-agent"),
456
+ "/opt/homebrew/bin/cursor-agent"
457
+ ]) ?? "/usr/local/bin/cursor-agent";
432
458
  case "hermes":
433
- return which("hermes") ?? join3(homedir3(), ".local", "bin", "hermes");
459
+ return firstExistingPath([
460
+ join3(home, ".local", "bin", "hermes"),
461
+ "/usr/local/bin/hermes",
462
+ "/usr/bin/hermes",
463
+ join3(home, ".npm-global", "bin", "hermes"),
464
+ "/opt/homebrew/bin/hermes"
465
+ ]) ?? join3(home, ".local", "bin", "hermes");
434
466
  case "pi":
435
- return which("pi") ?? join3(homedir3(), ".local", "bin", "pi");
467
+ return firstExistingPath([
468
+ join3(home, ".local", "bin", "pi"),
469
+ "/usr/local/bin/pi",
470
+ "/usr/bin/pi",
471
+ join3(home, ".npm-global", "bin", "pi"),
472
+ "/opt/homebrew/bin/pi"
473
+ ]) ?? join3(home, ".local", "bin", "pi");
436
474
  }
437
475
  }
438
476
  function buildArgs(agent, prompt, opts) {
@@ -497,11 +535,11 @@ function runGate(opts) {
497
535
  }
498
536
  const args = buildArgs(opts.agent, opts.prompt, opts);
499
537
  try {
500
- const result = execFileSync(bin, args, {
538
+ const result = runChildProcess(bin, args, {
501
539
  stdio: ["ignore", "pipe", "pipe"],
502
540
  timeout: opts.timeoutMs ?? 12e4,
503
541
  maxBuffer: 8 * 1024 * 1024,
504
- env: { ...process.env, HIVEMIND_WIKI_WORKER: "1", HIVEMIND_CAPTURE: "false" }
542
+ env: { ...inheritedEnv.env, HIVEMIND_WIKI_WORKER: "1", HIVEMIND_CAPTURE: "false" }
505
543
  });
506
544
  return { stdout: result.toString("utf-8"), stderr: "", errored: false };
507
545
  } catch (e) {
@@ -665,6 +703,7 @@ function releaseWorkerLock(projectKey) {
665
703
 
666
704
  // dist/src/skillify/skillify-worker.js
667
705
  var cfg = JSON.parse(readFileSync3(process.argv[2], "utf-8"));
706
+ globalThis.__hivemind_tuning__ = cfg.tuning ?? {};
668
707
  var tmpDir = cfg.tmpDir;
669
708
  var verdictPath = join6(tmpDir, "verdict.json");
670
709
  var promptPath = join6(tmpDir, "prompt.txt");