@deeplake/hivemind 0.7.80 → 0.7.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +1 -1
- package/bundle/cli.js +131 -94
- package/codex/bundle/capture.js +66 -39
- package/codex/bundle/commands/auth-login.js +14 -10
- package/codex/bundle/embeddings/embed-daemon.js +9 -5
- package/codex/bundle/graph-on-stop.js +32 -28
- package/codex/bundle/graph-pull-worker.js +27 -23
- package/codex/bundle/pre-tool-use.js +56 -36
- package/codex/bundle/session-start-setup.js +18 -14
- package/codex/bundle/session-start.js +26 -22
- package/codex/bundle/shell/deeplake-shell.js +30 -26
- package/codex/bundle/skillify-worker.js +14 -10
- package/codex/bundle/skillopt-worker.js +17 -13
- package/codex/bundle/stop.js +50 -45
- package/codex/bundle/wiki-worker.js +18 -14
- package/cursor/bundle/capture.js +71 -44
- package/cursor/bundle/commands/auth-login.js +14 -10
- package/cursor/bundle/embeddings/embed-daemon.js +9 -5
- package/cursor/bundle/graph-on-stop.js +32 -28
- package/cursor/bundle/graph-pull-worker.js +27 -23
- package/cursor/bundle/pre-tool-use.js +28 -24
- package/cursor/bundle/session-end.js +40 -36
- package/cursor/bundle/session-start.js +39 -35
- package/cursor/bundle/shell/deeplake-shell.js +30 -26
- package/cursor/bundle/skillify-worker.js +14 -10
- package/cursor/bundle/wiki-worker.js +18 -14
- package/hermes/bundle/capture.js +73 -46
- package/hermes/bundle/commands/auth-login.js +14 -10
- package/hermes/bundle/embeddings/embed-daemon.js +9 -5
- package/hermes/bundle/graph-on-stop.js +32 -28
- package/hermes/bundle/graph-pull-worker.js +27 -23
- package/hermes/bundle/pre-tool-use.js +32 -28
- package/hermes/bundle/session-end.js +40 -36
- package/hermes/bundle/session-start.js +39 -35
- package/hermes/bundle/shell/deeplake-shell.js +30 -26
- package/hermes/bundle/skillify-worker.js +14 -10
- package/hermes/bundle/skillopt-worker.js +17 -13
- package/hermes/bundle/wiki-worker.js +18 -14
- package/mcp/bundle/server.js +15 -11
- package/openclaw/dist/index.js +11 -7
- package/openclaw/dist/skillify-worker.js +14 -10
- package/openclaw/openclaw.plugin.json +1 -1
- package/openclaw/package.json +1 -1
- package/package.json +1 -1
|
@@ -5,8 +5,8 @@ import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, existsS
|
|
|
5
5
|
import { join as join7 } from "node:path";
|
|
6
6
|
|
|
7
7
|
// dist/src/utils/debug.js
|
|
8
|
-
import { appendFileSync } from "node:fs";
|
|
9
|
-
import { join } from "node:path";
|
|
8
|
+
import { appendFileSync, mkdirSync } from "node:fs";
|
|
9
|
+
import { dirname, join } from "node:path";
|
|
10
10
|
import { homedir } from "node:os";
|
|
11
11
|
var LOG = join(homedir(), ".deeplake", "hook-debug.log");
|
|
12
12
|
function isDebug() {
|
|
@@ -18,8 +18,12 @@ function utcTimestamp(d = /* @__PURE__ */ new Date()) {
|
|
|
18
18
|
function log(tag, msg) {
|
|
19
19
|
if (!isDebug())
|
|
20
20
|
return;
|
|
21
|
-
|
|
21
|
+
try {
|
|
22
|
+
mkdirSync(dirname(LOG), { recursive: true });
|
|
23
|
+
appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
|
|
22
24
|
`);
|
|
25
|
+
} catch {
|
|
26
|
+
}
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
// dist/src/utils/client-header.js
|
|
@@ -63,7 +67,7 @@ function extractPairs(rows) {
|
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
// dist/src/skillify/skill-writer.js
|
|
66
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
70
|
+
import { existsSync, mkdirSync as mkdirSync2, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
67
71
|
import { homedir as homedir2 } from "node:os";
|
|
68
72
|
import { join as join2 } from "node:path";
|
|
69
73
|
function assertValidSkillName(name) {
|
|
@@ -165,7 +169,7 @@ function writeNewSkill(args) {
|
|
|
165
169
|
if (existsSync(path)) {
|
|
166
170
|
throw new Error(`skill already exists at ${path}; use mergeSkill`);
|
|
167
171
|
}
|
|
168
|
-
|
|
172
|
+
mkdirSync2(dir, { recursive: true });
|
|
169
173
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
170
174
|
const author = args.author && args.author.length > 0 ? args.author : void 0;
|
|
171
175
|
const contributors = author ? [author] : [];
|
|
@@ -754,7 +758,7 @@ function resolveRecordScope(args) {
|
|
|
754
758
|
}
|
|
755
759
|
|
|
756
760
|
// dist/src/skillify/state.js
|
|
757
|
-
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, writeSync, mkdirSync as
|
|
761
|
+
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, writeSync, mkdirSync as mkdirSync3, renameSync as renameSync2, rmdirSync, existsSync as existsSync4, lstatSync, unlinkSync, openSync, closeSync } from "node:fs";
|
|
758
762
|
import { join as join6 } from "node:path";
|
|
759
763
|
|
|
760
764
|
// dist/src/utils/repo-identity.js
|
|
@@ -764,7 +768,7 @@ import { basename, resolve } from "node:path";
|
|
|
764
768
|
|
|
765
769
|
// dist/src/skillify/legacy-migration.js
|
|
766
770
|
import { existsSync as existsSync3, renameSync } from "node:fs";
|
|
767
|
-
import { dirname, join as join5 } from "node:path";
|
|
771
|
+
import { dirname as dirname2, join as join5 } from "node:path";
|
|
768
772
|
|
|
769
773
|
// dist/src/skillify/state-dir.js
|
|
770
774
|
import { homedir as homedir4 } from "node:os";
|
|
@@ -784,7 +788,7 @@ function migrateLegacyStateDir() {
|
|
|
784
788
|
return;
|
|
785
789
|
attempted = true;
|
|
786
790
|
const current = getStateDir();
|
|
787
|
-
const legacy = join5(
|
|
791
|
+
const legacy = join5(dirname2(current), "skilify");
|
|
788
792
|
if (!existsSync3(legacy))
|
|
789
793
|
return;
|
|
790
794
|
if (existsSync3(current))
|
|
@@ -828,7 +832,7 @@ function readState(projectKey) {
|
|
|
828
832
|
}
|
|
829
833
|
function writeState(projectKey, state) {
|
|
830
834
|
migrateLegacyStateDir();
|
|
831
|
-
|
|
835
|
+
mkdirSync3(getStateDir(), { recursive: true });
|
|
832
836
|
const p = statePath(projectKey);
|
|
833
837
|
const tmp = `${p}.${process.pid}.${Date.now()}.tmp`;
|
|
834
838
|
writeFileSync2(tmp, JSON.stringify(state, null, 2));
|
|
@@ -836,7 +840,7 @@ function writeState(projectKey, state) {
|
|
|
836
840
|
}
|
|
837
841
|
function withRmwLock(projectKey, fn) {
|
|
838
842
|
migrateLegacyStateDir();
|
|
839
|
-
|
|
843
|
+
mkdirSync3(getStateDir(), { recursive: true });
|
|
840
844
|
const rmw = lockPath(projectKey) + ".rmw";
|
|
841
845
|
const deadline = Date.now() + 2e3;
|
|
842
846
|
let fd = null;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// dist/src/hooks/cursor/wiki-worker.js
|
|
4
|
-
import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, existsSync as existsSync4, appendFileSync as appendFileSync2, mkdirSync as
|
|
4
|
+
import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, existsSync as existsSync4, appendFileSync as appendFileSync2, mkdirSync as mkdirSync4, rmSync } from "node:fs";
|
|
5
5
|
import { execFileSync } from "node:child_process";
|
|
6
|
-
import { dirname as
|
|
6
|
+
import { dirname as dirname3, join as join6 } from "node:path";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
|
|
9
9
|
// dist/src/hooks/summary-state.js
|
|
10
|
-
import { readFileSync, writeFileSync, writeSync, mkdirSync, renameSync, existsSync, unlinkSync, openSync, closeSync, statSync } from "node:fs";
|
|
10
|
+
import { readFileSync, writeFileSync, writeSync, mkdirSync as mkdirSync2, renameSync, existsSync, unlinkSync, openSync, closeSync, statSync } from "node:fs";
|
|
11
11
|
import { homedir as homedir2 } from "node:os";
|
|
12
12
|
import { join as join2 } from "node:path";
|
|
13
13
|
|
|
14
14
|
// dist/src/utils/debug.js
|
|
15
|
-
import { appendFileSync } from "node:fs";
|
|
16
|
-
import { join } from "node:path";
|
|
15
|
+
import { appendFileSync, mkdirSync } from "node:fs";
|
|
16
|
+
import { dirname, join } from "node:path";
|
|
17
17
|
import { homedir } from "node:os";
|
|
18
18
|
var LOG = join(homedir(), ".deeplake", "hook-debug.log");
|
|
19
19
|
function isDebug() {
|
|
@@ -22,8 +22,12 @@ function isDebug() {
|
|
|
22
22
|
function log(tag, msg) {
|
|
23
23
|
if (!isDebug())
|
|
24
24
|
return;
|
|
25
|
-
|
|
25
|
+
try {
|
|
26
|
+
mkdirSync(dirname(LOG), { recursive: true });
|
|
27
|
+
appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
|
|
26
28
|
`);
|
|
29
|
+
} catch {
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
// dist/src/hooks/summary-state.js
|
|
@@ -47,14 +51,14 @@ function readState(sessionId) {
|
|
|
47
51
|
}
|
|
48
52
|
}
|
|
49
53
|
function writeState(sessionId, state) {
|
|
50
|
-
|
|
54
|
+
mkdirSync2(STATE_DIR, { recursive: true });
|
|
51
55
|
const p = statePath(sessionId);
|
|
52
56
|
const tmp = `${p}.${process.pid}.${Date.now()}.tmp`;
|
|
53
57
|
writeFileSync(tmp, JSON.stringify(state));
|
|
54
58
|
renameSync(tmp, p);
|
|
55
59
|
}
|
|
56
60
|
function withRmwLock(sessionId, fn) {
|
|
57
|
-
|
|
61
|
+
mkdirSync2(STATE_DIR, { recursive: true });
|
|
58
62
|
const rmwLock = statePath(sessionId) + ".rmw";
|
|
59
63
|
const deadline = Date.now() + 2e3;
|
|
60
64
|
let fd = null;
|
|
@@ -543,9 +547,9 @@ import { join as join5 } from "node:path";
|
|
|
543
547
|
import { pathToFileURL } from "node:url";
|
|
544
548
|
|
|
545
549
|
// dist/src/user-config.js
|
|
546
|
-
import { existsSync as existsSync3, mkdirSync as
|
|
550
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync3, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
547
551
|
import { homedir as homedir4 } from "node:os";
|
|
548
|
-
import { dirname, join as join4 } from "node:path";
|
|
552
|
+
import { dirname as dirname2, join as join4 } from "node:path";
|
|
549
553
|
var _configPath = () => process.env.HIVEMIND_CONFIG_PATH ?? join4(homedir4(), ".deeplake", "config.json");
|
|
550
554
|
var _cache = null;
|
|
551
555
|
var _migrated = false;
|
|
@@ -570,9 +574,9 @@ function writeUserConfig(patch) {
|
|
|
570
574
|
const current = readUserConfig();
|
|
571
575
|
const merged = deepMerge(current, patch);
|
|
572
576
|
const path = _configPath();
|
|
573
|
-
const dir =
|
|
577
|
+
const dir = dirname2(path);
|
|
574
578
|
if (!existsSync3(dir))
|
|
575
|
-
|
|
579
|
+
mkdirSync3(dir, { recursive: true });
|
|
576
580
|
const tmp = `${path}.tmp.${process.pid}`;
|
|
577
581
|
writeFileSync2(tmp, JSON.stringify(merged, null, 2) + "\n", "utf-8");
|
|
578
582
|
renameSync2(tmp, path);
|
|
@@ -671,7 +675,7 @@ var tmpJsonl = join6(tmpDir, "session.jsonl");
|
|
|
671
675
|
var tmpSummary = join6(tmpDir, "summary.md");
|
|
672
676
|
function wlog(msg) {
|
|
673
677
|
try {
|
|
674
|
-
|
|
678
|
+
mkdirSync4(cfg.hooksDir, { recursive: true });
|
|
675
679
|
appendFileSync2(cfg.wikiLog, `[${(/* @__PURE__ */ new Date()).toISOString().replace("T", " ").slice(0, 19)}] wiki-worker(${cfg.sessionId}): ${msg}
|
|
676
680
|
`);
|
|
677
681
|
} catch {
|
|
@@ -772,7 +776,7 @@ async function main() {
|
|
|
772
776
|
let embedding = null;
|
|
773
777
|
if (!embeddingsDisabled()) {
|
|
774
778
|
try {
|
|
775
|
-
const daemonEntry = join6(
|
|
779
|
+
const daemonEntry = join6(dirname3(fileURLToPath(import.meta.url)), "embeddings", "embed-daemon.js");
|
|
776
780
|
embedding = await new EmbedClient({ daemonEntry }).embed(text, "document");
|
|
777
781
|
} catch (e) {
|
|
778
782
|
wlog(`summary embedding failed, writing NULL: ${e.message}`);
|
package/hermes/bundle/capture.js
CHANGED
|
@@ -16,7 +16,7 @@ __export(index_marker_store_exports, {
|
|
|
16
16
|
hasFreshIndexMarker: () => hasFreshIndexMarker,
|
|
17
17
|
writeIndexMarker: () => writeIndexMarker
|
|
18
18
|
});
|
|
19
|
-
import { existsSync as existsSync2, mkdirSync as
|
|
19
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
20
20
|
import { join as join5 } from "node:path";
|
|
21
21
|
import { tmpdir } from "node:os";
|
|
22
22
|
function getIndexMarkerDir() {
|
|
@@ -40,7 +40,7 @@ function hasFreshIndexMarker(markerPath) {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
function writeIndexMarker(markerPath) {
|
|
43
|
-
|
|
43
|
+
mkdirSync4(getIndexMarkerDir(), { recursive: true });
|
|
44
44
|
writeFileSync3(markerPath, JSON.stringify({ updatedAt: (/* @__PURE__ */ new Date()).toISOString() }), "utf-8");
|
|
45
45
|
}
|
|
46
46
|
var INDEX_MARKER_TTL_MS;
|
|
@@ -119,8 +119,8 @@ function loadConfig() {
|
|
|
119
119
|
import { randomUUID } from "node:crypto";
|
|
120
120
|
|
|
121
121
|
// dist/src/utils/debug.js
|
|
122
|
-
import { appendFileSync } from "node:fs";
|
|
123
|
-
import { join as join2 } from "node:path";
|
|
122
|
+
import { appendFileSync, mkdirSync } from "node:fs";
|
|
123
|
+
import { dirname, join as join2 } from "node:path";
|
|
124
124
|
import { homedir as homedir2 } from "node:os";
|
|
125
125
|
var LOG = join2(homedir2(), ".deeplake", "hook-debug.log");
|
|
126
126
|
function isDebug() {
|
|
@@ -132,8 +132,12 @@ function utcTimestamp(d = /* @__PURE__ */ new Date()) {
|
|
|
132
132
|
function log(tag, msg) {
|
|
133
133
|
if (!isDebug())
|
|
134
134
|
return;
|
|
135
|
-
|
|
135
|
+
try {
|
|
136
|
+
mkdirSync(dirname(LOG), { recursive: true });
|
|
137
|
+
appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
|
|
136
138
|
`);
|
|
139
|
+
} catch {
|
|
140
|
+
}
|
|
137
141
|
}
|
|
138
142
|
|
|
139
143
|
// dist/src/utils/sql.js
|
|
@@ -339,7 +343,7 @@ async function healMissingColumns(args) {
|
|
|
339
343
|
}
|
|
340
344
|
|
|
341
345
|
// dist/src/notifications/queue.js
|
|
342
|
-
import { readFileSync as readFileSync2, writeFileSync, renameSync, mkdirSync, openSync, closeSync, unlinkSync, statSync } from "node:fs";
|
|
346
|
+
import { readFileSync as readFileSync2, writeFileSync, renameSync, mkdirSync as mkdirSync2, openSync, closeSync, unlinkSync, statSync } from "node:fs";
|
|
343
347
|
import { join as join3, resolve } from "node:path";
|
|
344
348
|
import { homedir as homedir3 } from "node:os";
|
|
345
349
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
@@ -377,14 +381,14 @@ function writeQueue(q) {
|
|
|
377
381
|
if (!_isQueuePathInsideHome(path2, home)) {
|
|
378
382
|
throw new Error(`notifications-queue write blocked: ${path2} is outside ${home}`);
|
|
379
383
|
}
|
|
380
|
-
|
|
384
|
+
mkdirSync2(join3(home, ".deeplake"), { recursive: true, mode: 448 });
|
|
381
385
|
const tmp = `${path2}.${process.pid}.tmp`;
|
|
382
386
|
writeFileSync(tmp, JSON.stringify(q, null, 2), { mode: 384 });
|
|
383
387
|
renameSync(tmp, path2);
|
|
384
388
|
}
|
|
385
389
|
async function withQueueLock(fn) {
|
|
386
390
|
const path2 = lockPath();
|
|
387
|
-
|
|
391
|
+
mkdirSync2(join3(homedir3(), ".deeplake"), { recursive: true, mode: 448 });
|
|
388
392
|
let fd = null;
|
|
389
393
|
for (let attempt = 0; attempt < LOCK_RETRY_MAX; attempt++) {
|
|
390
394
|
try {
|
|
@@ -440,7 +444,7 @@ async function enqueueNotification(n) {
|
|
|
440
444
|
}
|
|
441
445
|
|
|
442
446
|
// dist/src/commands/auth-creds.js
|
|
443
|
-
import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as
|
|
447
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync3, unlinkSync as unlinkSync2 } from "node:fs";
|
|
444
448
|
import { join as join4 } from "node:path";
|
|
445
449
|
import { homedir as homedir4 } from "node:os";
|
|
446
450
|
function configDir() {
|
|
@@ -1393,9 +1397,9 @@ import { join as join8 } from "node:path";
|
|
|
1393
1397
|
import { pathToFileURL } from "node:url";
|
|
1394
1398
|
|
|
1395
1399
|
// dist/src/user-config.js
|
|
1396
|
-
import { existsSync as existsSync4, mkdirSync as
|
|
1400
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync5, readFileSync as readFileSync6, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "node:fs";
|
|
1397
1401
|
import { homedir as homedir6 } from "node:os";
|
|
1398
|
-
import { dirname, join as join7 } from "node:path";
|
|
1402
|
+
import { dirname as dirname2, join as join7 } from "node:path";
|
|
1399
1403
|
var _configPath = () => process.env.HIVEMIND_CONFIG_PATH ?? join7(homedir6(), ".deeplake", "config.json");
|
|
1400
1404
|
var _cache = null;
|
|
1401
1405
|
var _migrated = false;
|
|
@@ -1420,9 +1424,9 @@ function writeUserConfig(patch) {
|
|
|
1420
1424
|
const current = readUserConfig();
|
|
1421
1425
|
const merged = deepMerge(current, patch);
|
|
1422
1426
|
const path2 = _configPath();
|
|
1423
|
-
const dir =
|
|
1427
|
+
const dir = dirname2(path2);
|
|
1424
1428
|
if (!existsSync4(dir))
|
|
1425
|
-
|
|
1429
|
+
mkdirSync5(dir, { recursive: true });
|
|
1426
1430
|
const tmp = `${path2}.tmp.${process.pid}`;
|
|
1427
1431
|
writeFileSync4(tmp, JSON.stringify(merged, null, 2) + "\n", "utf-8");
|
|
1428
1432
|
renameSync2(tmp, path2);
|
|
@@ -1505,15 +1509,15 @@ function embeddingsDisabled() {
|
|
|
1505
1509
|
}
|
|
1506
1510
|
|
|
1507
1511
|
// dist/src/embeddings/self-heal.js
|
|
1508
|
-
import { existsSync as existsSync5, lstatSync, mkdirSync as
|
|
1512
|
+
import { existsSync as existsSync5, lstatSync, mkdirSync as mkdirSync6, readlinkSync, renameSync as renameSync3, rmSync, symlinkSync, statSync as statSync2 } from "node:fs";
|
|
1509
1513
|
import { homedir as homedir8 } from "node:os";
|
|
1510
|
-
import { basename as basename2, dirname as
|
|
1514
|
+
import { basename as basename2, dirname as dirname3, join as join9 } from "node:path";
|
|
1511
1515
|
function ensurePluginNodeModulesLink(opts) {
|
|
1512
1516
|
if (basename2(opts.bundleDir) !== "bundle") {
|
|
1513
1517
|
return { kind: "not-bundle-layout", bundleDir: opts.bundleDir };
|
|
1514
1518
|
}
|
|
1515
1519
|
const target = opts.sharedNodeModules ?? join9(homedir8(), ".hivemind", "embed-deps", "node_modules");
|
|
1516
|
-
const pluginDir =
|
|
1520
|
+
const pluginDir = dirname3(opts.bundleDir);
|
|
1517
1521
|
const link = join9(pluginDir, "node_modules");
|
|
1518
1522
|
if (!existsSync5(target)) {
|
|
1519
1523
|
return { kind: "shared-deps-missing", target };
|
|
@@ -1553,9 +1557,9 @@ function ensurePluginNodeModulesLink(opts) {
|
|
|
1553
1557
|
}
|
|
1554
1558
|
function createSymlinkAtomic(target, link) {
|
|
1555
1559
|
try {
|
|
1556
|
-
const parent =
|
|
1560
|
+
const parent = dirname3(link);
|
|
1557
1561
|
if (!existsSync5(parent))
|
|
1558
|
-
|
|
1562
|
+
mkdirSync6(parent, { recursive: true });
|
|
1559
1563
|
const tmp = `${link}.tmp.${process.pid}`;
|
|
1560
1564
|
try {
|
|
1561
1565
|
rmSync(tmp, { force: true });
|
|
@@ -1571,10 +1575,10 @@ function createSymlinkAtomic(target, link) {
|
|
|
1571
1575
|
|
|
1572
1576
|
// dist/src/hooks/hermes/capture.js
|
|
1573
1577
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
1574
|
-
import { dirname as
|
|
1578
|
+
import { dirname as dirname9, join as join22 } from "node:path";
|
|
1575
1579
|
|
|
1576
1580
|
// dist/src/hooks/summary-state.js
|
|
1577
|
-
import { readFileSync as readFileSync7, writeFileSync as writeFileSync5, writeSync as writeSync2, mkdirSync as
|
|
1581
|
+
import { readFileSync as readFileSync7, writeFileSync as writeFileSync5, writeSync as writeSync2, mkdirSync as mkdirSync7, renameSync as renameSync4, existsSync as existsSync6, unlinkSync as unlinkSync4, openSync as openSync3, closeSync as closeSync3, statSync as statSync3 } from "node:fs";
|
|
1578
1582
|
import { homedir as homedir9 } from "node:os";
|
|
1579
1583
|
import { join as join10 } from "node:path";
|
|
1580
1584
|
var dlog = (msg) => log("summary-state", msg);
|
|
@@ -1597,14 +1601,14 @@ function readState(sessionId) {
|
|
|
1597
1601
|
}
|
|
1598
1602
|
}
|
|
1599
1603
|
function writeState(sessionId, state) {
|
|
1600
|
-
|
|
1604
|
+
mkdirSync7(STATE_DIR, { recursive: true });
|
|
1601
1605
|
const p = statePath(sessionId);
|
|
1602
1606
|
const tmp = `${p}.${process.pid}.${Date.now()}.tmp`;
|
|
1603
1607
|
writeFileSync5(tmp, JSON.stringify(state));
|
|
1604
1608
|
renameSync4(tmp, p);
|
|
1605
1609
|
}
|
|
1606
1610
|
function withRmwLock(sessionId, fn) {
|
|
1607
|
-
|
|
1611
|
+
mkdirSync7(STATE_DIR, { recursive: true });
|
|
1608
1612
|
const rmwLock = statePath(sessionId) + ".rmw";
|
|
1609
1613
|
const deadline = Date.now() + 2e3;
|
|
1610
1614
|
let fd = null;
|
|
@@ -1666,7 +1670,7 @@ function shouldTrigger(state, cfg, now = Date.now()) {
|
|
|
1666
1670
|
return false;
|
|
1667
1671
|
}
|
|
1668
1672
|
function tryAcquireLock(sessionId, maxAgeMs = 10 * 60 * 1e3) {
|
|
1669
|
-
|
|
1673
|
+
mkdirSync7(STATE_DIR, { recursive: true });
|
|
1670
1674
|
const p = lockPath2(sessionId);
|
|
1671
1675
|
if (existsSync6(p)) {
|
|
1672
1676
|
try {
|
|
@@ -1710,12 +1714,12 @@ function releaseLock(sessionId) {
|
|
|
1710
1714
|
// dist/src/hooks/hermes/spawn-wiki-worker.js
|
|
1711
1715
|
import { execSync } from "node:child_process";
|
|
1712
1716
|
import { fileURLToPath } from "node:url";
|
|
1713
|
-
import { dirname as
|
|
1714
|
-
import { writeFileSync as writeFileSync6, mkdirSync as
|
|
1717
|
+
import { dirname as dirname5, join as join13 } from "node:path";
|
|
1718
|
+
import { writeFileSync as writeFileSync6, mkdirSync as mkdirSync9 } from "node:fs";
|
|
1715
1719
|
import { homedir as homedir10, tmpdir as tmpdir2 } from "node:os";
|
|
1716
1720
|
|
|
1717
1721
|
// dist/src/utils/wiki-log.js
|
|
1718
|
-
import { mkdirSync as
|
|
1722
|
+
import { mkdirSync as mkdirSync8, appendFileSync as appendFileSync2 } from "node:fs";
|
|
1719
1723
|
import { join as join11 } from "node:path";
|
|
1720
1724
|
function makeWikiLogger(hooksDir, filename = "deeplake-wiki.log") {
|
|
1721
1725
|
const path2 = join11(hooksDir, filename);
|
|
@@ -1723,7 +1727,7 @@ function makeWikiLogger(hooksDir, filename = "deeplake-wiki.log") {
|
|
|
1723
1727
|
path: path2,
|
|
1724
1728
|
log(msg) {
|
|
1725
1729
|
try {
|
|
1726
|
-
|
|
1730
|
+
mkdirSync8(hooksDir, { recursive: true });
|
|
1727
1731
|
appendFileSync2(path2, `[${utcTimestamp()}] ${msg}
|
|
1728
1732
|
`);
|
|
1729
1733
|
} catch {
|
|
@@ -1734,7 +1738,7 @@ function makeWikiLogger(hooksDir, filename = "deeplake-wiki.log") {
|
|
|
1734
1738
|
|
|
1735
1739
|
// dist/src/utils/version-check.js
|
|
1736
1740
|
import { readFileSync as readFileSync8 } from "node:fs";
|
|
1737
|
-
import { dirname as
|
|
1741
|
+
import { dirname as dirname4, join as join12 } from "node:path";
|
|
1738
1742
|
function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
1739
1743
|
try {
|
|
1740
1744
|
const pluginJson = join12(bundleDir, "..", pluginManifestDir, "plugin.json");
|
|
@@ -1766,7 +1770,7 @@ function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
|
1766
1770
|
return pkg.version;
|
|
1767
1771
|
} catch {
|
|
1768
1772
|
}
|
|
1769
|
-
const parent =
|
|
1773
|
+
const parent = dirname4(dir);
|
|
1770
1774
|
if (parent === dir)
|
|
1771
1775
|
break;
|
|
1772
1776
|
dir = parent;
|
|
@@ -1862,7 +1866,7 @@ function spawnHermesWikiWorker(opts) {
|
|
|
1862
1866
|
const { config, sessionId, cwd, bundleDir, reason } = opts;
|
|
1863
1867
|
const projectName = projectNameFromCwd(cwd);
|
|
1864
1868
|
const tmpDir = join13(tmpdir2(), `deeplake-wiki-${sessionId}-${Date.now()}`);
|
|
1865
|
-
|
|
1869
|
+
mkdirSync9(tmpDir, { recursive: true });
|
|
1866
1870
|
const pluginVersion = getInstalledVersion(bundleDir, ".claude-plugin") ?? "";
|
|
1867
1871
|
const configFile = join13(tmpDir, "config.json");
|
|
1868
1872
|
writeFileSync6(configFile, JSON.stringify({
|
|
@@ -1890,13 +1894,13 @@ function spawnHermesWikiWorker(opts) {
|
|
|
1890
1894
|
wikiLog(`${reason}: spawned summary worker for ${sessionId}`);
|
|
1891
1895
|
}
|
|
1892
1896
|
function bundleDirFromImportMeta(importMetaUrl) {
|
|
1893
|
-
return
|
|
1897
|
+
return dirname5(fileURLToPath(importMetaUrl));
|
|
1894
1898
|
}
|
|
1895
1899
|
|
|
1896
1900
|
// dist/src/skillify/spawn-skillify-worker.js
|
|
1897
1901
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
1898
|
-
import { dirname as
|
|
1899
|
-
import { writeFileSync as writeFileSync7, mkdirSync as
|
|
1902
|
+
import { dirname as dirname6, join as join15 } from "node:path";
|
|
1903
|
+
import { writeFileSync as writeFileSync7, mkdirSync as mkdirSync10, appendFileSync as appendFileSync3, chmodSync } from "node:fs";
|
|
1900
1904
|
import { homedir as homedir12, tmpdir as tmpdir3 } from "node:os";
|
|
1901
1905
|
|
|
1902
1906
|
// dist/src/skillify/gate-runner.js
|
|
@@ -1971,7 +1975,7 @@ var HOME2 = homedir12();
|
|
|
1971
1975
|
var SKILLIFY_LOG = join15(HOME2, ".claude", "hooks", "skillify.log");
|
|
1972
1976
|
function skillifyLog(msg) {
|
|
1973
1977
|
try {
|
|
1974
|
-
|
|
1978
|
+
mkdirSync10(dirname6(SKILLIFY_LOG), { recursive: true });
|
|
1975
1979
|
appendFileSync3(SKILLIFY_LOG, `[${utcTimestamp()}] ${msg}
|
|
1976
1980
|
`);
|
|
1977
1981
|
} catch {
|
|
@@ -1980,7 +1984,7 @@ function skillifyLog(msg) {
|
|
|
1980
1984
|
function spawnSkillifyWorker(opts) {
|
|
1981
1985
|
const { config, cwd, projectKey, project, bundleDir, agent, scopeConfig, currentSessionId, reason } = opts;
|
|
1982
1986
|
const tmpDir = join15(tmpdir3(), `deeplake-skillify-${projectKey}-${Date.now()}`);
|
|
1983
|
-
|
|
1987
|
+
mkdirSync10(tmpDir, { recursive: true, mode: 448 });
|
|
1984
1988
|
const gateBin = findAgentBin(agent);
|
|
1985
1989
|
const configFile = join15(tmpDir, "config.json");
|
|
1986
1990
|
writeFileSync7(configFile, JSON.stringify({
|
|
@@ -2019,7 +2023,7 @@ function spawnSkillifyWorker(opts) {
|
|
|
2019
2023
|
}
|
|
2020
2024
|
|
|
2021
2025
|
// dist/src/skillify/state.js
|
|
2022
|
-
import { readFileSync as readFileSync9, writeFileSync as writeFileSync8, writeSync as writeSync3, mkdirSync as
|
|
2026
|
+
import { readFileSync as readFileSync9, writeFileSync as writeFileSync8, writeSync as writeSync3, mkdirSync as mkdirSync11, renameSync as renameSync6, rmdirSync, existsSync as existsSync9, lstatSync as lstatSync2, unlinkSync as unlinkSync5, openSync as openSync4, closeSync as closeSync4 } from "node:fs";
|
|
2023
2027
|
import { join as join18 } from "node:path";
|
|
2024
2028
|
|
|
2025
2029
|
// dist/src/utils/repo-identity.js
|
|
@@ -2071,7 +2075,7 @@ function deriveProjectKey(cwd) {
|
|
|
2071
2075
|
|
|
2072
2076
|
// dist/src/skillify/legacy-migration.js
|
|
2073
2077
|
import { existsSync as existsSync8, renameSync as renameSync5 } from "node:fs";
|
|
2074
|
-
import { dirname as
|
|
2078
|
+
import { dirname as dirname7, join as join17 } from "node:path";
|
|
2075
2079
|
|
|
2076
2080
|
// dist/src/skillify/state-dir.js
|
|
2077
2081
|
import { homedir as homedir13 } from "node:os";
|
|
@@ -2091,7 +2095,7 @@ function migrateLegacyStateDir() {
|
|
|
2091
2095
|
return;
|
|
2092
2096
|
attempted = true;
|
|
2093
2097
|
const current = getStateDir();
|
|
2094
|
-
const legacy = join17(
|
|
2098
|
+
const legacy = join17(dirname7(current), "skilify");
|
|
2095
2099
|
if (!existsSync8(legacy))
|
|
2096
2100
|
return;
|
|
2097
2101
|
if (existsSync8(current))
|
|
@@ -2135,7 +2139,7 @@ function readState2(projectKey) {
|
|
|
2135
2139
|
}
|
|
2136
2140
|
function writeState2(projectKey, state) {
|
|
2137
2141
|
migrateLegacyStateDir();
|
|
2138
|
-
|
|
2142
|
+
mkdirSync11(getStateDir(), { recursive: true });
|
|
2139
2143
|
const p = statePath2(projectKey);
|
|
2140
2144
|
const tmp = `${p}.${process.pid}.${Date.now()}.tmp`;
|
|
2141
2145
|
writeFileSync8(tmp, JSON.stringify(state, null, 2));
|
|
@@ -2143,7 +2147,7 @@ function writeState2(projectKey, state) {
|
|
|
2143
2147
|
}
|
|
2144
2148
|
function withRmwLock2(projectKey, fn) {
|
|
2145
2149
|
migrateLegacyStateDir();
|
|
2146
|
-
|
|
2150
|
+
mkdirSync11(getStateDir(), { recursive: true });
|
|
2147
2151
|
const rmw = lockPath3(projectKey) + ".rmw";
|
|
2148
2152
|
const deadline = Date.now() + 2e3;
|
|
2149
2153
|
let fd = null;
|
|
@@ -2203,7 +2207,7 @@ function resetCounter(projectKey) {
|
|
|
2203
2207
|
}
|
|
2204
2208
|
function tryAcquireWorkerLock(projectKey, maxAgeMs = 10 * 60 * 1e3) {
|
|
2205
2209
|
migrateLegacyStateDir();
|
|
2206
|
-
|
|
2210
|
+
mkdirSync11(getStateDir(), { recursive: true });
|
|
2207
2211
|
const p = lockPath3(projectKey);
|
|
2208
2212
|
if (existsSync9(p)) {
|
|
2209
2213
|
try {
|
|
@@ -2255,7 +2259,7 @@ function releaseWorkerLock(projectKey) {
|
|
|
2255
2259
|
}
|
|
2256
2260
|
|
|
2257
2261
|
// dist/src/skillify/scope-config.js
|
|
2258
|
-
import { existsSync as existsSync10, mkdirSync as
|
|
2262
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync12, readFileSync as readFileSync10, writeFileSync as writeFileSync9 } from "node:fs";
|
|
2259
2263
|
import { join as join19 } from "node:path";
|
|
2260
2264
|
function configPath() {
|
|
2261
2265
|
return join19(getStateDir(), "config.json");
|
|
@@ -2317,6 +2321,25 @@ function tryStopCounterTrigger(opts) {
|
|
|
2317
2321
|
}
|
|
2318
2322
|
}
|
|
2319
2323
|
|
|
2324
|
+
// dist/src/utils/plugin-state.js
|
|
2325
|
+
import { readFileSync as readFileSync11 } from "node:fs";
|
|
2326
|
+
import { join as join20 } from "node:path";
|
|
2327
|
+
import { homedir as homedir14 } from "node:os";
|
|
2328
|
+
var PLUGIN_ID = "hivemind@hivemind";
|
|
2329
|
+
function isHivemindPluginEnabled() {
|
|
2330
|
+
try {
|
|
2331
|
+
const settingsPath = join20(homedir14(), ".claude", "settings.json");
|
|
2332
|
+
const settings = JSON.parse(readFileSync11(settingsPath, "utf-8"));
|
|
2333
|
+
const enabledPlugins = settings?.enabledPlugins;
|
|
2334
|
+
if (enabledPlugins && typeof enabledPlugins === "object" && PLUGIN_ID in enabledPlugins) {
|
|
2335
|
+
return enabledPlugins[PLUGIN_ID] !== false;
|
|
2336
|
+
}
|
|
2337
|
+
return true;
|
|
2338
|
+
} catch {
|
|
2339
|
+
return true;
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2320
2343
|
// dist/src/skillify/skillopt-trigger.js
|
|
2321
2344
|
import { spawn as spawn2 } from "node:child_process";
|
|
2322
2345
|
import fs from "node:fs";
|
|
@@ -2324,8 +2347,8 @@ import path from "node:path";
|
|
|
2324
2347
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
2325
2348
|
|
|
2326
2349
|
// dist/src/skillify/manifest.js
|
|
2327
|
-
import { existsSync as existsSync11, lstatSync as lstatSync3, mkdirSync as
|
|
2328
|
-
import { dirname as
|
|
2350
|
+
import { existsSync as existsSync11, lstatSync as lstatSync3, mkdirSync as mkdirSync13, readFileSync as readFileSync12, renameSync as renameSync7, unlinkSync as unlinkSync6, writeFileSync as writeFileSync10 } from "node:fs";
|
|
2351
|
+
import { dirname as dirname8, join as join21 } from "node:path";
|
|
2329
2352
|
|
|
2330
2353
|
// dist/src/skillify/skillopt-env.js
|
|
2331
2354
|
var SKILLOPT_ENV = {
|
|
@@ -2440,9 +2463,9 @@ function reactSkillOpt(sessionId, prompt, agent) {
|
|
|
2440
2463
|
// dist/src/hooks/hermes/capture.js
|
|
2441
2464
|
var log6 = (msg) => log("hermes-capture", msg);
|
|
2442
2465
|
function resolveEmbedDaemonPath() {
|
|
2443
|
-
return
|
|
2466
|
+
return join22(dirname9(fileURLToPath4(import.meta.url)), "embeddings", "embed-daemon.js");
|
|
2444
2467
|
}
|
|
2445
|
-
var __bundleDir =
|
|
2468
|
+
var __bundleDir = dirname9(fileURLToPath4(import.meta.url));
|
|
2446
2469
|
var PLUGIN_VERSION = getInstalledVersion(__bundleDir, ".claude-plugin") ?? "";
|
|
2447
2470
|
if (!embeddingsDisabled()) {
|
|
2448
2471
|
try {
|
|
@@ -2461,6 +2484,10 @@ function pickString(...candidates) {
|
|
|
2461
2484
|
async function main() {
|
|
2462
2485
|
if (!CAPTURE)
|
|
2463
2486
|
return;
|
|
2487
|
+
if (!isHivemindPluginEnabled()) {
|
|
2488
|
+
log6("plugin disabled, skipping capture");
|
|
2489
|
+
return;
|
|
2490
|
+
}
|
|
2464
2491
|
const input = await readStdin();
|
|
2465
2492
|
const config = loadConfig();
|
|
2466
2493
|
if (!config) {
|
|
@@ -17,7 +17,7 @@ __export(index_marker_store_exports, {
|
|
|
17
17
|
hasFreshIndexMarker: () => hasFreshIndexMarker,
|
|
18
18
|
writeIndexMarker: () => writeIndexMarker
|
|
19
19
|
});
|
|
20
|
-
import { existsSync as existsSync2, mkdirSync as
|
|
20
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync5, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "node:fs";
|
|
21
21
|
import { join as join6 } from "node:path";
|
|
22
22
|
import { tmpdir } from "node:os";
|
|
23
23
|
function getIndexMarkerDir() {
|
|
@@ -41,7 +41,7 @@ function hasFreshIndexMarker(markerPath) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
function writeIndexMarker(markerPath) {
|
|
44
|
-
|
|
44
|
+
mkdirSync5(getIndexMarkerDir(), { recursive: true });
|
|
45
45
|
writeFileSync4(markerPath, JSON.stringify({ updatedAt: (/* @__PURE__ */ new Date()).toISOString() }), "utf-8");
|
|
46
46
|
}
|
|
47
47
|
var INDEX_MARKER_TTL_MS;
|
|
@@ -413,8 +413,8 @@ function loadConfig() {
|
|
|
413
413
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
414
414
|
|
|
415
415
|
// dist/src/utils/debug.js
|
|
416
|
-
import { appendFileSync } from "node:fs";
|
|
417
|
-
import { join as join4 } from "node:path";
|
|
416
|
+
import { appendFileSync, mkdirSync as mkdirSync3 } from "node:fs";
|
|
417
|
+
import { dirname, join as join4 } from "node:path";
|
|
418
418
|
import { homedir as homedir4 } from "node:os";
|
|
419
419
|
var LOG = join4(homedir4(), ".deeplake", "hook-debug.log");
|
|
420
420
|
function isDebug() {
|
|
@@ -423,8 +423,12 @@ function isDebug() {
|
|
|
423
423
|
function log(tag, msg) {
|
|
424
424
|
if (!isDebug())
|
|
425
425
|
return;
|
|
426
|
-
|
|
426
|
+
try {
|
|
427
|
+
mkdirSync3(dirname(LOG), { recursive: true });
|
|
428
|
+
appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
|
|
427
429
|
`);
|
|
430
|
+
} catch {
|
|
431
|
+
}
|
|
428
432
|
}
|
|
429
433
|
|
|
430
434
|
// dist/src/utils/sql.js
|
|
@@ -621,7 +625,7 @@ async function healMissingColumns(args) {
|
|
|
621
625
|
}
|
|
622
626
|
|
|
623
627
|
// dist/src/notifications/queue.js
|
|
624
|
-
import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, renameSync, mkdirSync as
|
|
628
|
+
import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, renameSync, mkdirSync as mkdirSync4, openSync, closeSync, unlinkSync as unlinkSync2, statSync } from "node:fs";
|
|
625
629
|
import { join as join5, resolve } from "node:path";
|
|
626
630
|
import { homedir as homedir5 } from "node:os";
|
|
627
631
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
@@ -659,14 +663,14 @@ function writeQueue(q) {
|
|
|
659
663
|
if (!_isQueuePathInsideHome(path, home)) {
|
|
660
664
|
throw new Error(`notifications-queue write blocked: ${path} is outside ${home}`);
|
|
661
665
|
}
|
|
662
|
-
|
|
666
|
+
mkdirSync4(join5(home, ".deeplake"), { recursive: true, mode: 448 });
|
|
663
667
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
664
668
|
writeFileSync3(tmp, JSON.stringify(q, null, 2), { mode: 384 });
|
|
665
669
|
renameSync(tmp, path);
|
|
666
670
|
}
|
|
667
671
|
async function withQueueLock(fn) {
|
|
668
672
|
const path = lockPath();
|
|
669
|
-
|
|
673
|
+
mkdirSync4(join5(homedir5(), ".deeplake"), { recursive: true, mode: 448 });
|
|
670
674
|
let fd = null;
|
|
671
675
|
for (let attempt = 0; attempt < LOCK_RETRY_MAX; attempt++) {
|
|
672
676
|
try {
|
|
@@ -1241,8 +1245,8 @@ var DeeplakeApi = class {
|
|
|
1241
1245
|
};
|
|
1242
1246
|
|
|
1243
1247
|
// dist/src/cli/util.js
|
|
1244
|
-
import { existsSync as existsSync3, mkdirSync as
|
|
1245
|
-
import { join as join7, dirname } from "node:path";
|
|
1248
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync6, readFileSync as readFileSync6, writeFileSync as writeFileSync5, cpSync, symlinkSync, unlinkSync as unlinkSync3, lstatSync } from "node:fs";
|
|
1249
|
+
import { join as join7, dirname as dirname2 } from "node:path";
|
|
1246
1250
|
import { homedir as homedir6 } from "node:os";
|
|
1247
1251
|
import { fileURLToPath } from "node:url";
|
|
1248
1252
|
import { createInterface } from "node:readline";
|