@deeplake/hivemind 0.7.27 → 0.7.29
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 +66 -24
- 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 +10 -5
- 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/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 +10 -5
- 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 +10 -5
- 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 +70 -21
- 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
|
@@ -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");
|
|
@@ -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
|
`);
|
package/mcp/bundle/server.js
CHANGED
|
@@ -23335,10 +23335,12 @@ import { randomUUID } from "node:crypto";
|
|
|
23335
23335
|
import { appendFileSync } from "node:fs";
|
|
23336
23336
|
import { join as join3 } from "node:path";
|
|
23337
23337
|
import { homedir as homedir3 } from "node:os";
|
|
23338
|
-
var DEBUG = process.env.HIVEMIND_DEBUG === "1";
|
|
23339
23338
|
var LOG = join3(homedir3(), ".deeplake", "hook-debug.log");
|
|
23339
|
+
function isDebug() {
|
|
23340
|
+
return process.env.HIVEMIND_DEBUG === "1";
|
|
23341
|
+
}
|
|
23340
23342
|
function log(tag, msg) {
|
|
23341
|
-
if (!
|
|
23343
|
+
if (!isDebug())
|
|
23342
23344
|
return;
|
|
23343
23345
|
appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
|
|
23344
23346
|
`);
|
|
@@ -23387,7 +23389,9 @@ var RETRYABLE_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
|
|
|
23387
23389
|
var MAX_RETRIES = 3;
|
|
23388
23390
|
var BASE_DELAY_MS = 500;
|
|
23389
23391
|
var MAX_CONCURRENCY = 5;
|
|
23390
|
-
|
|
23392
|
+
function getQueryTimeoutMs() {
|
|
23393
|
+
return Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
|
|
23394
|
+
}
|
|
23391
23395
|
function sleep(ms) {
|
|
23392
23396
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
23393
23397
|
}
|
|
@@ -23468,8 +23472,9 @@ var DeeplakeApi = class {
|
|
|
23468
23472
|
let lastError;
|
|
23469
23473
|
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
23470
23474
|
let resp;
|
|
23475
|
+
const timeoutMs = getQueryTimeoutMs();
|
|
23471
23476
|
try {
|
|
23472
|
-
const signal = AbortSignal.timeout(
|
|
23477
|
+
const signal = AbortSignal.timeout(timeoutMs);
|
|
23473
23478
|
resp = await fetch(`${this.apiUrl}/workspaces/${this.workspaceId}/tables/query`, {
|
|
23474
23479
|
method: "POST",
|
|
23475
23480
|
headers: {
|
|
@@ -23483,7 +23488,7 @@ var DeeplakeApi = class {
|
|
|
23483
23488
|
});
|
|
23484
23489
|
} catch (e) {
|
|
23485
23490
|
if (isTimeoutError(e)) {
|
|
23486
|
-
lastError = new Error(`Query timeout after ${
|
|
23491
|
+
lastError = new Error(`Query timeout after ${timeoutMs}ms`);
|
|
23487
23492
|
throw lastError;
|
|
23488
23493
|
}
|
|
23489
23494
|
lastError = e instanceof Error ? e : new Error(String(e));
|
package/openclaw/dist/chunks/{index-marker-store-PGT5CW6T.js → index-marker-store-CPGF2BI7.js}
RENAMED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
globalThis.__hivemind_tuning__ ??= {};
|
|
2
|
+
|
|
1
3
|
// src/index-marker-store.ts
|
|
2
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
5
|
import { join } from "node:path";
|
|
4
6
|
import { tmpdir } from "node:os";
|
|
5
|
-
var INDEX_MARKER_TTL_MS = Number(6 * 60 * 6e4);
|
|
7
|
+
var INDEX_MARKER_TTL_MS = Number(globalThis.__hivemind_tuning__.HIVEMIND_INDEX_MARKER_TTL_MS ?? 6 * 60 * 6e4);
|
|
6
8
|
function getIndexMarkerDir() {
|
|
7
|
-
return join(tmpdir(), "hivemind-deeplake-indexes");
|
|
9
|
+
return globalThis.__hivemind_tuning__.HIVEMIND_INDEX_MARKER_DIR ?? join(tmpdir(), "hivemind-deeplake-indexes");
|
|
8
10
|
}
|
|
9
11
|
function buildIndexMarkerPath(workspaceId, orgId, table, suffix) {
|
|
10
12
|
const markerKey = [workspaceId, orgId, table, suffix].join("__").replace(/[^a-zA-Z0-9_.-]/g, "_");
|
package/openclaw/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
globalThis.__hivemind_tuning__ ??= {};
|
|
1
2
|
import {
|
|
2
3
|
loadCredentials,
|
|
3
4
|
saveCredentials
|
|
4
|
-
} from "./chunks/chunk-
|
|
5
|
+
} from "./chunks/chunk-OSD5GJJ5.js";
|
|
5
6
|
|
|
6
7
|
// src/utils/client-header.ts
|
|
7
8
|
var DEEPLAKE_CLIENT_HEADER = "X-Deeplake-Client";
|
|
@@ -75,10 +76,12 @@ import { randomUUID } from "node:crypto";
|
|
|
75
76
|
import { appendFileSync } from "node:fs";
|
|
76
77
|
import { join } from "node:path";
|
|
77
78
|
import { homedir } from "node:os";
|
|
78
|
-
var DEBUG = false;
|
|
79
79
|
var LOG = join(homedir(), ".deeplake", "hook-debug.log");
|
|
80
|
+
function isDebug() {
|
|
81
|
+
return globalThis.__hivemind_tuning__.HIVEMIND_DEBUG === "1";
|
|
82
|
+
}
|
|
80
83
|
function log(tag, msg) {
|
|
81
|
-
if (!
|
|
84
|
+
if (!isDebug()) return;
|
|
82
85
|
appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
|
|
83
86
|
`);
|
|
84
87
|
}
|
|
@@ -104,7 +107,7 @@ var MESSAGE_EMBEDDING_COL = "message_embedding";
|
|
|
104
107
|
// src/deeplake-api.ts
|
|
105
108
|
var indexMarkerStorePromise = null;
|
|
106
109
|
function getIndexMarkerStore() {
|
|
107
|
-
if (!indexMarkerStorePromise) indexMarkerStorePromise = import("./chunks/index-marker-store-
|
|
110
|
+
if (!indexMarkerStorePromise) indexMarkerStorePromise = import("./chunks/index-marker-store-CPGF2BI7.js");
|
|
108
111
|
return indexMarkerStorePromise;
|
|
109
112
|
}
|
|
110
113
|
var log2 = (msg) => log("sdk", msg);
|
|
@@ -113,17 +116,19 @@ function summarizeSql(sql, maxLen = 220) {
|
|
|
113
116
|
return compact.length > maxLen ? `${compact.slice(0, maxLen)}...` : compact;
|
|
114
117
|
}
|
|
115
118
|
function traceSql(msg) {
|
|
116
|
-
const traceEnabled =
|
|
119
|
+
const traceEnabled = globalThis.__hivemind_tuning__.HIVEMIND_TRACE_SQL === "1" || globalThis.__hivemind_tuning__.HIVEMIND_DEBUG === "1";
|
|
117
120
|
if (!traceEnabled) return;
|
|
118
121
|
process.stderr.write(`[deeplake-sql] ${msg}
|
|
119
122
|
`);
|
|
120
|
-
if (
|
|
123
|
+
if (globalThis.__hivemind_tuning__.HIVEMIND_DEBUG === "1") log2(msg);
|
|
121
124
|
}
|
|
122
125
|
var RETRYABLE_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
|
|
123
126
|
var MAX_RETRIES = 3;
|
|
124
127
|
var BASE_DELAY_MS = 500;
|
|
125
128
|
var MAX_CONCURRENCY = 5;
|
|
126
|
-
|
|
129
|
+
function getQueryTimeoutMs() {
|
|
130
|
+
return Number(globalThis.__hivemind_tuning__.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
|
|
131
|
+
}
|
|
127
132
|
function sleep(ms) {
|
|
128
133
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
129
134
|
}
|
|
@@ -204,8 +209,9 @@ var DeeplakeApi = class {
|
|
|
204
209
|
let lastError;
|
|
205
210
|
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
206
211
|
let resp;
|
|
212
|
+
const timeoutMs = getQueryTimeoutMs();
|
|
207
213
|
try {
|
|
208
|
-
const signal = AbortSignal.timeout(
|
|
214
|
+
const signal = AbortSignal.timeout(timeoutMs);
|
|
209
215
|
resp = await fetch(`${this.apiUrl}/workspaces/${this.workspaceId}/tables/query`, {
|
|
210
216
|
method: "POST",
|
|
211
217
|
headers: {
|
|
@@ -219,7 +225,7 @@ var DeeplakeApi = class {
|
|
|
219
225
|
});
|
|
220
226
|
} catch (e) {
|
|
221
227
|
if (isTimeoutError(e)) {
|
|
222
|
-
lastError = new Error(`Query timeout after ${
|
|
228
|
+
lastError = new Error(`Query timeout after ${timeoutMs}ms`);
|
|
223
229
|
throw lastError;
|
|
224
230
|
}
|
|
225
231
|
lastError = e instanceof Error ? e : new Error(String(e));
|
|
@@ -724,11 +730,11 @@ async function searchDeeplakeTables(api2, memoryTable2, sessionsTable2, opts) {
|
|
|
724
730
|
const vecLit = serializeFloat4Array(queryEmbedding);
|
|
725
731
|
const semanticLimit = Math.min(
|
|
726
732
|
limit,
|
|
727
|
-
Number(
|
|
733
|
+
Number(globalThis.__hivemind_tuning__.HIVEMIND_SEMANTIC_LIMIT ?? "20")
|
|
728
734
|
);
|
|
729
735
|
const lexicalLimit = Math.min(
|
|
730
736
|
limit,
|
|
731
|
-
Number(
|
|
737
|
+
Number(globalThis.__hivemind_tuning__.HIVEMIND_HYBRID_LEXICAL_LIMIT ?? "20")
|
|
732
738
|
);
|
|
733
739
|
const filterPatternsForLex = contentScanOnly ? prefilterPatterns && prefilterPatterns.length > 0 ? prefilterPatterns : prefilterPattern ? [prefilterPattern] : [] : [escapedPattern];
|
|
734
740
|
const memLexFilter = buildContentFilter("summary::text", likeOp, filterPatternsForLex);
|
|
@@ -850,7 +856,7 @@ function buildGrepSearchOptions(params, targetPath) {
|
|
|
850
856
|
return {
|
|
851
857
|
pathFilter: buildPathFilter(targetPath),
|
|
852
858
|
contentScanOnly: hasRegexMeta,
|
|
853
|
-
likeOp:
|
|
859
|
+
likeOp: globalThis.__hivemind_tuning__.HIVEMIND_GREP_LIKE === "case-sensitive" ? "LIKE" : "ILIKE",
|
|
854
860
|
escapedPattern: sqlLike(params.pattern),
|
|
855
861
|
prefilterPattern: literalPrefilter ? sqlLike(literalPrefilter) : void 0,
|
|
856
862
|
prefilterPatterns: alternationPrefilters?.map((literal) => sqlLike(literal)),
|
|
@@ -1038,16 +1044,16 @@ function definePluginEntry(entry) {
|
|
|
1038
1044
|
return entry;
|
|
1039
1045
|
}
|
|
1040
1046
|
function loadSetupConfig() {
|
|
1041
|
-
return import("./chunks/setup-config-
|
|
1047
|
+
return import("./chunks/setup-config-VI54GEUM.js");
|
|
1042
1048
|
}
|
|
1043
1049
|
var credsModulePromise = null;
|
|
1044
1050
|
var configModulePromise = null;
|
|
1045
1051
|
function loadCredsModule() {
|
|
1046
|
-
if (!credsModulePromise) credsModulePromise = import("./chunks/auth-creds-
|
|
1052
|
+
if (!credsModulePromise) credsModulePromise = import("./chunks/auth-creds-KKTYIP27.js");
|
|
1047
1053
|
return credsModulePromise;
|
|
1048
1054
|
}
|
|
1049
1055
|
function loadConfigModule() {
|
|
1050
|
-
if (!configModulePromise) configModulePromise = import("./chunks/config-
|
|
1056
|
+
if (!configModulePromise) configModulePromise = import("./chunks/config-XEK4MJJS.js");
|
|
1051
1057
|
return configModulePromise;
|
|
1052
1058
|
}
|
|
1053
1059
|
async function loadCredentials2() {
|
|
@@ -1065,6 +1071,35 @@ async function loadConfig() {
|
|
|
1065
1071
|
}
|
|
1066
1072
|
var requireFromOpenclaw = createRequire(import.meta.url);
|
|
1067
1073
|
var { spawn: realSpawn, execFileSync: realExecFileSync } = requireFromOpenclaw("node:child_process");
|
|
1074
|
+
var inheritedEnv = process;
|
|
1075
|
+
function applyOpenclawTuning(pluginConfig) {
|
|
1076
|
+
const cfg = pluginConfig ?? {};
|
|
1077
|
+
const tuning = cfg.tuning ?? {};
|
|
1078
|
+
const dispatch = {};
|
|
1079
|
+
const setStr = (k, v) => {
|
|
1080
|
+
if (v === void 0 || v === null) return;
|
|
1081
|
+
dispatch[k] = typeof v === "string" ? v : String(v);
|
|
1082
|
+
};
|
|
1083
|
+
const setBool = (k, v) => {
|
|
1084
|
+
if (v === void 0 || v === null) return;
|
|
1085
|
+
dispatch[k] = v ? "1" : "";
|
|
1086
|
+
};
|
|
1087
|
+
const setFalseOrOmit = (k, v) => {
|
|
1088
|
+
if (v === false) dispatch[k] = "false";
|
|
1089
|
+
};
|
|
1090
|
+
setBool("HIVEMIND_DEBUG", tuning.debug);
|
|
1091
|
+
setBool("HIVEMIND_TRACE_SQL", tuning.traceSql);
|
|
1092
|
+
setStr("HIVEMIND_QUERY_TIMEOUT_MS", tuning.queryTimeoutMs);
|
|
1093
|
+
setStr("HIVEMIND_INDEX_MARKER_TTL_MS", tuning.indexMarkerTtlMs);
|
|
1094
|
+
setStr("HIVEMIND_INDEX_MARKER_DIR", tuning.indexMarkerDir);
|
|
1095
|
+
setStr("HIVEMIND_SEMANTIC_LIMIT", tuning.semanticLimit);
|
|
1096
|
+
setStr("HIVEMIND_HYBRID_LEXICAL_LIMIT", tuning.hybridLexicalLimit);
|
|
1097
|
+
setStr("HIVEMIND_GREP_LIKE", tuning.grepLike);
|
|
1098
|
+
setStr("HIVEMIND_SEMANTIC_EMBED_TIMEOUT_MS", tuning.semanticEmbedTimeoutMs);
|
|
1099
|
+
setFalseOrOmit("HIVEMIND_SEMANTIC_SEARCH", tuning.semanticSearch);
|
|
1100
|
+
setFalseOrOmit("HIVEMIND_SEMANTIC_EMIT_ALL", tuning.semanticEmitAll);
|
|
1101
|
+
globalThis.__hivemind_tuning__ = dispatch;
|
|
1102
|
+
}
|
|
1068
1103
|
var DEFAULT_API_URL2 = "https://api.deeplake.ai";
|
|
1069
1104
|
var VERSION_URL = "https://registry.npmjs.org/@deeplake/hivemind/latest";
|
|
1070
1105
|
function extractLatestVersion(body) {
|
|
@@ -1073,7 +1108,7 @@ function extractLatestVersion(body) {
|
|
|
1073
1108
|
return typeof v === "string" && v.length > 0 ? v : null;
|
|
1074
1109
|
}
|
|
1075
1110
|
function getInstalledVersion() {
|
|
1076
|
-
return "0.7.
|
|
1111
|
+
return "0.7.29".length > 0 ? "0.7.29" : null;
|
|
1077
1112
|
}
|
|
1078
1113
|
function isNewer(latest, current) {
|
|
1079
1114
|
const parse = (v) => v.replace(/-.*$/, "").split(".").map(Number);
|
|
@@ -1085,7 +1120,7 @@ async function checkForUpdate(logger) {
|
|
|
1085
1120
|
try {
|
|
1086
1121
|
const current = getInstalledVersion();
|
|
1087
1122
|
if (!current) return;
|
|
1088
|
-
const res = await fetch(VERSION_URL, { signal: AbortSignal.timeout(
|
|
1123
|
+
const res = await fetch(VERSION_URL, { signal: AbortSignal.timeout(1e4) });
|
|
1089
1124
|
if (!res.ok) return;
|
|
1090
1125
|
const latest = extractLatestVersion(await res.json());
|
|
1091
1126
|
if (latest && isNewer(latest, current)) {
|
|
@@ -1276,7 +1311,16 @@ function spawnOpenclawSkillifyWorker(a) {
|
|
|
1276
1311
|
hermesProvider: void 0,
|
|
1277
1312
|
hermesModel: void 0,
|
|
1278
1313
|
skillifyLog: joinPath(homedir2(), ".deeplake", "hivemind-openclaw-skillify.log"),
|
|
1279
|
-
currentSessionId: a.sessionId
|
|
1314
|
+
currentSessionId: a.sessionId,
|
|
1315
|
+
// Pass the tuning dispatch through so the worker can repopulate its
|
|
1316
|
+
// own globalThis (each process has its own globalThis). The worker
|
|
1317
|
+
// entry reads cfg.tuning before any shared module's env read fires.
|
|
1318
|
+
// Also force HIVEMIND_SKILLIFY_WORKER="1" so the recursion guard in
|
|
1319
|
+
// triggers.ts / auto-pull.ts short-circuits inside the worker.
|
|
1320
|
+
tuning: {
|
|
1321
|
+
...a.tuning ?? {},
|
|
1322
|
+
HIVEMIND_SKILLIFY_WORKER: "1"
|
|
1323
|
+
}
|
|
1280
1324
|
};
|
|
1281
1325
|
try {
|
|
1282
1326
|
fsWriteFile(configPath, JSON.stringify(config), { mode: 384 });
|
|
@@ -1288,7 +1332,7 @@ function spawnOpenclawSkillifyWorker(a) {
|
|
|
1288
1332
|
realSpawn(process.execPath, [OPENCLAW_SKILLIFY_WORKER_PATH, configPath], {
|
|
1289
1333
|
detached: true,
|
|
1290
1334
|
stdio: "ignore",
|
|
1291
|
-
env: { ...
|
|
1335
|
+
env: { ...inheritedEnv.env, HIVEMIND_SKILLIFY_WORKER: "1", HIVEMIND_CAPTURE: "false" }
|
|
1292
1336
|
}).unref();
|
|
1293
1337
|
} catch (e) {
|
|
1294
1338
|
a.loggerWarn?.(`skillify spawn: spawn failed: ${e?.message ?? e}`);
|
|
@@ -1380,6 +1424,7 @@ var src_default = definePluginEntry({
|
|
|
1380
1424
|
name: "Hivemind",
|
|
1381
1425
|
description: "Cloud-backed shared memory powered by Deeplake",
|
|
1382
1426
|
register(pluginApi) {
|
|
1427
|
+
applyOpenclawTuning(pluginApi.pluginConfig);
|
|
1383
1428
|
void (async () => {
|
|
1384
1429
|
try {
|
|
1385
1430
|
pluginApi.registerCommand({
|
|
@@ -1531,7 +1576,7 @@ Manual fix: open ${result.configPath} and add "hivemind" to the "alsoAllow" arra
|
|
|
1531
1576
|
const current = getInstalledVersion();
|
|
1532
1577
|
if (!current) return { text: "Could not determine installed version." };
|
|
1533
1578
|
try {
|
|
1534
|
-
const res = await fetch(VERSION_URL, { signal: AbortSignal.timeout(
|
|
1579
|
+
const res = await fetch(VERSION_URL, { signal: AbortSignal.timeout(1e4) });
|
|
1535
1580
|
if (!res.ok) return { text: `Current version: ${current}. Could not check for updates.` };
|
|
1536
1581
|
const latest = extractLatestVersion(await res.json());
|
|
1537
1582
|
if (!latest) return { text: `Current version: ${current}. Could not parse latest version.` };
|
|
@@ -1903,7 +1948,11 @@ One brain for every agent on your team.
|
|
|
1903
1948
|
userName: cfg.userName,
|
|
1904
1949
|
channel: ev.channel || "openclaw",
|
|
1905
1950
|
sessionId: sid,
|
|
1906
|
-
loggerWarn: (msg) => logger.error(`Skillify spawn: ${msg}`)
|
|
1951
|
+
loggerWarn: (msg) => logger.error(`Skillify spawn: ${msg}`),
|
|
1952
|
+
// Pass the same tuning dispatch the plugin populated at
|
|
1953
|
+
// register-time. The worker will repopulate its own
|
|
1954
|
+
// globalThis from this.
|
|
1955
|
+
tuning: globalThis.__hivemind_tuning__
|
|
1907
1956
|
});
|
|
1908
1957
|
} catch (e) {
|
|
1909
1958
|
logger.error(`Skillify spawn threw: ${e?.message ?? e}`);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
globalThis.__hivemind_tuning__ ??= {};
|
|
2
3
|
|
|
3
4
|
// dist/src/skillify/skillify-worker.js
|
|
4
5
|
import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, existsSync as existsSync5, appendFileSync as appendFileSync2, rmSync } from "node:fs";
|
|
@@ -8,13 +9,15 @@ import { join as join6 } from "node:path";
|
|
|
8
9
|
import { appendFileSync } from "node:fs";
|
|
9
10
|
import { join } from "node:path";
|
|
10
11
|
import { homedir } from "node:os";
|
|
11
|
-
var DEBUG = process.env.HIVEMIND_DEBUG === "1";
|
|
12
12
|
var LOG = join(homedir(), ".deeplake", "hook-debug.log");
|
|
13
|
+
function isDebug() {
|
|
14
|
+
return globalThis.__hivemind_tuning__.HIVEMIND_DEBUG === "1";
|
|
15
|
+
}
|
|
13
16
|
function utcTimestamp(d = /* @__PURE__ */ new Date()) {
|
|
14
17
|
return d.toISOString().replace("T", " ").slice(0, 19) + " UTC";
|
|
15
18
|
}
|
|
16
19
|
function log(tag, msg) {
|
|
17
|
-
if (!
|
|
20
|
+
if (!isDebug())
|
|
18
21
|
return;
|
|
19
22
|
appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
|
|
20
23
|
`);
|
|
@@ -406,33 +409,69 @@ function parseVerdict(raw) {
|
|
|
406
409
|
}
|
|
407
410
|
|
|
408
411
|
// dist/src/skillify/gate-runner.js
|
|
409
|
-
import { execFileSync } from "node:child_process";
|
|
410
412
|
import { existsSync as existsSync2 } from "node:fs";
|
|
413
|
+
import { createRequire } from "node:module";
|
|
411
414
|
import { homedir as homedir3 } from "node:os";
|
|
412
415
|
import { join as join3 } from "node:path";
|
|
416
|
+
var requireForCp = createRequire(import.meta.url);
|
|
417
|
+
var { execFileSync: runChildProcess } = requireForCp("node:child_process");
|
|
418
|
+
var inheritedEnv = process;
|
|
419
|
+
function firstExistingPath(candidates) {
|
|
420
|
+
for (const c of candidates) {
|
|
421
|
+
if (existsSync2(c))
|
|
422
|
+
return c;
|
|
423
|
+
}
|
|
424
|
+
return null;
|
|
425
|
+
}
|
|
413
426
|
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
|
-
};
|
|
427
|
+
const home = homedir3();
|
|
425
428
|
switch (agent) {
|
|
429
|
+
// /usr/bin/<name> is included in every candidate list — that's the
|
|
430
|
+
// common Linux package-manager install path (apt, dnf, pacman). Old
|
|
431
|
+
// code used `which` which always checked it; the static-scan fix
|
|
432
|
+
// dropped `which`, so /usr/bin needs to be explicit. CodeRabbit on
|
|
433
|
+
// #170 caught the gap.
|
|
426
434
|
case "claude_code":
|
|
427
|
-
return
|
|
435
|
+
return firstExistingPath([
|
|
436
|
+
join3(home, ".claude", "local", "claude"),
|
|
437
|
+
"/usr/local/bin/claude",
|
|
438
|
+
"/usr/bin/claude",
|
|
439
|
+
join3(home, ".npm-global", "bin", "claude"),
|
|
440
|
+
join3(home, ".local", "bin", "claude"),
|
|
441
|
+
"/opt/homebrew/bin/claude"
|
|
442
|
+
]) ?? join3(home, ".claude", "local", "claude");
|
|
428
443
|
case "codex":
|
|
429
|
-
return
|
|
444
|
+
return firstExistingPath([
|
|
445
|
+
"/usr/local/bin/codex",
|
|
446
|
+
"/usr/bin/codex",
|
|
447
|
+
join3(home, ".npm-global", "bin", "codex"),
|
|
448
|
+
join3(home, ".local", "bin", "codex"),
|
|
449
|
+
"/opt/homebrew/bin/codex"
|
|
450
|
+
]) ?? "/usr/local/bin/codex";
|
|
430
451
|
case "cursor":
|
|
431
|
-
return
|
|
452
|
+
return firstExistingPath([
|
|
453
|
+
"/usr/local/bin/cursor-agent",
|
|
454
|
+
"/usr/bin/cursor-agent",
|
|
455
|
+
join3(home, ".npm-global", "bin", "cursor-agent"),
|
|
456
|
+
join3(home, ".local", "bin", "cursor-agent"),
|
|
457
|
+
"/opt/homebrew/bin/cursor-agent"
|
|
458
|
+
]) ?? "/usr/local/bin/cursor-agent";
|
|
432
459
|
case "hermes":
|
|
433
|
-
return
|
|
460
|
+
return firstExistingPath([
|
|
461
|
+
join3(home, ".local", "bin", "hermes"),
|
|
462
|
+
"/usr/local/bin/hermes",
|
|
463
|
+
"/usr/bin/hermes",
|
|
464
|
+
join3(home, ".npm-global", "bin", "hermes"),
|
|
465
|
+
"/opt/homebrew/bin/hermes"
|
|
466
|
+
]) ?? join3(home, ".local", "bin", "hermes");
|
|
434
467
|
case "pi":
|
|
435
|
-
return
|
|
468
|
+
return firstExistingPath([
|
|
469
|
+
join3(home, ".local", "bin", "pi"),
|
|
470
|
+
"/usr/local/bin/pi",
|
|
471
|
+
"/usr/bin/pi",
|
|
472
|
+
join3(home, ".npm-global", "bin", "pi"),
|
|
473
|
+
"/opt/homebrew/bin/pi"
|
|
474
|
+
]) ?? join3(home, ".local", "bin", "pi");
|
|
436
475
|
}
|
|
437
476
|
}
|
|
438
477
|
function buildArgs(agent, prompt, opts) {
|
|
@@ -457,7 +496,7 @@ function buildArgs(agent, prompt, opts) {
|
|
|
457
496
|
return [
|
|
458
497
|
"--print",
|
|
459
498
|
"--model",
|
|
460
|
-
opts.cursorModel ??
|
|
499
|
+
opts.cursorModel ?? globalThis.__hivemind_tuning__.HIVEMIND_CURSOR_MODEL ?? "auto",
|
|
461
500
|
"--force",
|
|
462
501
|
"--output-format",
|
|
463
502
|
"text",
|
|
@@ -468,9 +507,9 @@ function buildArgs(agent, prompt, opts) {
|
|
|
468
507
|
"-z",
|
|
469
508
|
prompt,
|
|
470
509
|
"--provider",
|
|
471
|
-
opts.hermesProvider ??
|
|
510
|
+
opts.hermesProvider ?? globalThis.__hivemind_tuning__.HIVEMIND_HERMES_PROVIDER ?? "openrouter",
|
|
472
511
|
"-m",
|
|
473
|
-
opts.hermesModel ??
|
|
512
|
+
opts.hermesModel ?? globalThis.__hivemind_tuning__.HIVEMIND_HERMES_MODEL ?? "anthropic/claude-haiku-4-5",
|
|
474
513
|
"--yolo",
|
|
475
514
|
"--ignore-user-config"
|
|
476
515
|
];
|
|
@@ -478,9 +517,9 @@ function buildArgs(agent, prompt, opts) {
|
|
|
478
517
|
return [
|
|
479
518
|
"--print",
|
|
480
519
|
"--provider",
|
|
481
|
-
opts.piProvider ??
|
|
520
|
+
opts.piProvider ?? globalThis.__hivemind_tuning__.HIVEMIND_PI_PROVIDER ?? "google",
|
|
482
521
|
"--model",
|
|
483
|
-
opts.piModel ??
|
|
522
|
+
opts.piModel ?? globalThis.__hivemind_tuning__.HIVEMIND_PI_MODEL ?? "gemini-2.5-flash",
|
|
484
523
|
prompt
|
|
485
524
|
];
|
|
486
525
|
}
|
|
@@ -497,11 +536,11 @@ function runGate(opts) {
|
|
|
497
536
|
}
|
|
498
537
|
const args = buildArgs(opts.agent, opts.prompt, opts);
|
|
499
538
|
try {
|
|
500
|
-
const result =
|
|
539
|
+
const result = runChildProcess(bin, args, {
|
|
501
540
|
stdio: ["ignore", "pipe", "pipe"],
|
|
502
541
|
timeout: opts.timeoutMs ?? 12e4,
|
|
503
542
|
maxBuffer: 8 * 1024 * 1024,
|
|
504
|
-
env: { ...
|
|
543
|
+
env: { ...inheritedEnv.env, HIVEMIND_WIKI_WORKER: "1", HIVEMIND_CAPTURE: "false" }
|
|
505
544
|
});
|
|
506
545
|
return { stdout: result.toString("utf-8"), stderr: "", errored: false };
|
|
507
546
|
} catch (e) {
|
|
@@ -564,7 +603,7 @@ var dlog2 = (msg) => log("skillify-state", msg);
|
|
|
564
603
|
var STATE_DIR = join5(homedir5(), ".deeplake", "state", "skillify");
|
|
565
604
|
var YIELD_BUF = new Int32Array(new SharedArrayBuffer(4));
|
|
566
605
|
var TRIGGER_THRESHOLD = (() => {
|
|
567
|
-
const n = Number(
|
|
606
|
+
const n = Number(globalThis.__hivemind_tuning__.HIVEMIND_SKILLIFY_EVERY_N_TURNS ?? "");
|
|
568
607
|
return Number.isInteger(n) && n > 0 ? n : 20;
|
|
569
608
|
})();
|
|
570
609
|
function statePath(projectKey) {
|
|
@@ -665,6 +704,7 @@ function releaseWorkerLock(projectKey) {
|
|
|
665
704
|
|
|
666
705
|
// dist/src/skillify/skillify-worker.js
|
|
667
706
|
var cfg = JSON.parse(readFileSync3(process.argv[2], "utf-8"));
|
|
707
|
+
globalThis.__hivemind_tuning__ = cfg.tuning ?? {};
|
|
668
708
|
var tmpDir = cfg.tmpDir;
|
|
669
709
|
var verdictPath = join6(tmpDir, "verdict.json");
|
|
670
710
|
var promptPath = join6(tmpDir, "prompt.txt");
|
package/openclaw/package.json
CHANGED