@deeplake/hivemind 0.7.26 → 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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/bundle/cli.js +1086 -93
- package/codex/bundle/capture.js +10 -5
- package/codex/bundle/commands/auth-login.js +10 -5
- package/codex/bundle/embeddings/embed-daemon.js +4 -2
- package/codex/bundle/pre-tool-use.js +10 -5
- package/codex/bundle/session-start-setup.js +10 -5
- package/codex/bundle/session-start.js +233 -136
- package/codex/bundle/shell/deeplake-shell.js +10 -5
- package/codex/bundle/skillify-worker.js +60 -21
- package/codex/bundle/stop.js +66 -25
- package/codex/bundle/wiki-worker.js +4 -2
- package/codex/skills/deeplake-memory/SKILL.md +33 -0
- package/cursor/bundle/capture.js +63 -22
- package/cursor/bundle/commands/auth-login.js +10 -5
- package/cursor/bundle/embeddings/embed-daemon.js +4 -2
- package/cursor/bundle/pre-tool-use.js +10 -5
- package/cursor/bundle/session-end.js +57 -19
- package/cursor/bundle/session-start.js +238 -87
- package/cursor/bundle/shell/deeplake-shell.js +10 -5
- package/cursor/bundle/skillify-worker.js +60 -21
- package/cursor/bundle/wiki-worker.js +4 -2
- package/hermes/bundle/capture.js +63 -22
- package/hermes/bundle/commands/auth-login.js +10 -5
- package/hermes/bundle/embeddings/embed-daemon.js +4 -2
- package/hermes/bundle/pre-tool-use.js +10 -5
- package/hermes/bundle/session-end.js +57 -19
- package/hermes/bundle/session-start.js +239 -87
- package/hermes/bundle/shell/deeplake-shell.js +10 -5
- package/hermes/bundle/skillify-worker.js +60 -21
- package/hermes/bundle/wiki-worker.js +4 -2
- package/mcp/bundle/server.js +10 -5
- package/openclaw/dist/chunks/{auth-creds-AEKS6D3P.js → auth-creds-KKTYIP27.js} +2 -1
- package/openclaw/dist/chunks/{chunk-SRCBBT4H.js → chunk-OSD5GJJ5.js} +2 -0
- package/openclaw/dist/chunks/{config-ZLH6JFJS.js → config-XEK4MJJS.js} +2 -0
- package/openclaw/dist/chunks/{index-marker-store-PGT5CW6T.js → index-marker-store-CPGF2BI7.js} +4 -2
- package/openclaw/dist/chunks/{setup-config-C35UK4LP.js → setup-config-VI54GEUM.js} +2 -0
- package/openclaw/dist/index.js +68 -19
- package/openclaw/dist/skillify-worker.js +67 -27
- package/openclaw/openclaw.plugin.json +1 -1
- package/openclaw/package.json +1 -1
- package/package.json +1 -1
- package/pi/extension-source/hivemind.ts +157 -19
|
@@ -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 (!
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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: { ...
|
|
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");
|
package/codex/bundle/stop.js
CHANGED
|
@@ -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 (!
|
|
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
|
-
|
|
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(
|
|
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 ${
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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 (!
|
|
23
|
+
if (!isDebug())
|
|
22
24
|
return;
|
|
23
25
|
appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
|
|
24
26
|
`);
|
|
@@ -45,6 +45,39 @@ Each argument is separate — do NOT quote subcommands together. The auth comman
|
|
|
45
45
|
- `node "<path>/auth-login.js" remove <user-id>` — remove member
|
|
46
46
|
- `node "<path>/auth-login.js" --help` — show all commands
|
|
47
47
|
|
|
48
|
+
## Skill Management (skillify)
|
|
49
|
+
|
|
50
|
+
Hivemind can mine reusable skills from agent session logs and share them across your team. Each argument is separate — do NOT quote subcommands together.
|
|
51
|
+
|
|
52
|
+
- `hivemind skillify` — show current scope, team, install location, per-project state
|
|
53
|
+
- `hivemind skillify pull` — sync project skills from the org table to local FS
|
|
54
|
+
- `hivemind skillify pull --user <email>` — only skills authored by that user
|
|
55
|
+
- `hivemind skillify pull --users <a,b,c>` — multiple authors (CSV)
|
|
56
|
+
- `hivemind skillify pull --all-users` — explicit "no author filter" (default)
|
|
57
|
+
- `hivemind skillify pull --to <project|global>` — install location (project=cwd/.claude/skills, global=~/.claude/skills)
|
|
58
|
+
- `hivemind skillify pull --dry-run` — preview without touching disk
|
|
59
|
+
- `hivemind skillify pull --force` — overwrite local files even if up-to-date (creates .bak)
|
|
60
|
+
- `hivemind skillify pull <skill-name>` — pull only that one skill (combines with --user)
|
|
61
|
+
- `hivemind skillify unpull` — remove every skill previously installed by pull
|
|
62
|
+
- `hivemind skillify unpull --user <email>` — remove only that author's pulls
|
|
63
|
+
- `hivemind skillify unpull --not-mine` — remove all pulls except your own
|
|
64
|
+
- `hivemind skillify unpull --dry-run` — preview without touching disk
|
|
65
|
+
- `hivemind skillify scope <me|team>` — sharing scope for newly mined skills
|
|
66
|
+
- `hivemind skillify install <project|global>` — default install location for new skills
|
|
67
|
+
- `hivemind skillify promote <skill-name>` — move a project skill to the global location
|
|
68
|
+
- `hivemind skillify team add|remove|list <username>` — manage team member list
|
|
69
|
+
- `hivemind skillify mine-local` — one-shot: mine skills from local sessions, no auth needed
|
|
70
|
+
|
|
71
|
+
## Embeddings (semantic memory search)
|
|
72
|
+
|
|
73
|
+
Opt-in, persisted in `~/.deeplake/config.json`.
|
|
74
|
+
|
|
75
|
+
- `hivemind embeddings install` — download deps (~600MB), symlink agents, set enabled:true
|
|
76
|
+
- `hivemind embeddings enable` — flip enabled:true (run install first if deps missing)
|
|
77
|
+
- `hivemind embeddings disable` — flip enabled:false + SIGTERM daemon (deps stay on disk)
|
|
78
|
+
- `hivemind embeddings uninstall [--prune]` — remove agent symlinks + disable; --prune wipes deps too
|
|
79
|
+
- `hivemind embeddings status` — show config + deps + per-agent link state
|
|
80
|
+
|
|
48
81
|
## Important: Bash Only
|
|
49
82
|
|
|
50
83
|
Only use bash commands (cat, ls, grep, echo, jq, head, tail, sed, awk, etc.) to interact with `~/.deeplake/memory/`. Do NOT use python, python3, node, curl, or other interpreters — they are not available in the memory filesystem. If a task seems to require Python, rewrite it using bash tools (e.g., `cat file.json | jq 'keys | length'`).
|
package/cursor/bundle/capture.js
CHANGED
|
@@ -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 (!
|
|
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
|
-
|
|
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(
|
|
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 ${
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 (!
|
|
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
|
-
|
|
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(
|
|
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 ${
|
|
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 (!
|
|
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 (!
|
|
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
|
-
|
|
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(
|
|
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 ${
|
|
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));
|