@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
package/codex/bundle/stop.js
CHANGED
|
@@ -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 mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
21
21
|
import { join as join5 } 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
|
+
mkdirSync4(getIndexMarkerDir(), { recursive: true });
|
|
45
45
|
writeFileSync3(markerPath, JSON.stringify({ updatedAt: (/* @__PURE__ */ new Date()).toISOString() }), "utf-8");
|
|
46
46
|
}
|
|
47
47
|
var INDEX_MARKER_TTL_MS;
|
|
@@ -55,7 +55,7 @@ var init_index_marker_store = __esm({
|
|
|
55
55
|
// dist/src/hooks/codex/stop.js
|
|
56
56
|
import { readFileSync as readFileSync11, existsSync as existsSync10 } from "node:fs";
|
|
57
57
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
58
|
-
import { dirname as
|
|
58
|
+
import { dirname as dirname7, join as join19 } from "node:path";
|
|
59
59
|
|
|
60
60
|
// dist/src/utils/stdin.js
|
|
61
61
|
function readStdin() {
|
|
@@ -125,8 +125,8 @@ function loadConfig() {
|
|
|
125
125
|
import { randomUUID } from "node:crypto";
|
|
126
126
|
|
|
127
127
|
// dist/src/utils/debug.js
|
|
128
|
-
import { appendFileSync } from "node:fs";
|
|
129
|
-
import { join as join2 } from "node:path";
|
|
128
|
+
import { appendFileSync, mkdirSync } from "node:fs";
|
|
129
|
+
import { dirname, join as join2 } from "node:path";
|
|
130
130
|
import { homedir as homedir2 } from "node:os";
|
|
131
131
|
var LOG = join2(homedir2(), ".deeplake", "hook-debug.log");
|
|
132
132
|
function isDebug() {
|
|
@@ -138,8 +138,12 @@ function utcTimestamp(d = /* @__PURE__ */ new Date()) {
|
|
|
138
138
|
function log(tag, msg) {
|
|
139
139
|
if (!isDebug())
|
|
140
140
|
return;
|
|
141
|
-
|
|
141
|
+
try {
|
|
142
|
+
mkdirSync(dirname(LOG), { recursive: true });
|
|
143
|
+
appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
|
|
142
144
|
`);
|
|
145
|
+
} catch {
|
|
146
|
+
}
|
|
143
147
|
}
|
|
144
148
|
|
|
145
149
|
// dist/src/utils/sql.js
|
|
@@ -345,7 +349,7 @@ async function healMissingColumns(args) {
|
|
|
345
349
|
}
|
|
346
350
|
|
|
347
351
|
// dist/src/notifications/queue.js
|
|
348
|
-
import { readFileSync as readFileSync2, writeFileSync, renameSync, mkdirSync, openSync, closeSync, unlinkSync, statSync } from "node:fs";
|
|
352
|
+
import { readFileSync as readFileSync2, writeFileSync, renameSync, mkdirSync as mkdirSync2, openSync, closeSync, unlinkSync, statSync } from "node:fs";
|
|
349
353
|
import { join as join3, resolve } from "node:path";
|
|
350
354
|
import { homedir as homedir3 } from "node:os";
|
|
351
355
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
@@ -383,14 +387,14 @@ function writeQueue(q) {
|
|
|
383
387
|
if (!_isQueuePathInsideHome(path, home)) {
|
|
384
388
|
throw new Error(`notifications-queue write blocked: ${path} is outside ${home}`);
|
|
385
389
|
}
|
|
386
|
-
|
|
390
|
+
mkdirSync2(join3(home, ".deeplake"), { recursive: true, mode: 448 });
|
|
387
391
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
388
392
|
writeFileSync(tmp, JSON.stringify(q, null, 2), { mode: 384 });
|
|
389
393
|
renameSync(tmp, path);
|
|
390
394
|
}
|
|
391
395
|
async function withQueueLock(fn) {
|
|
392
396
|
const path = lockPath();
|
|
393
|
-
|
|
397
|
+
mkdirSync2(join3(homedir3(), ".deeplake"), { recursive: true, mode: 448 });
|
|
394
398
|
let fd = null;
|
|
395
399
|
for (let attempt = 0; attempt < LOCK_RETRY_MAX; attempt++) {
|
|
396
400
|
try {
|
|
@@ -446,7 +450,7 @@ async function enqueueNotification(n) {
|
|
|
446
450
|
}
|
|
447
451
|
|
|
448
452
|
// dist/src/commands/auth-creds.js
|
|
449
|
-
import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as
|
|
453
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync3, unlinkSync as unlinkSync2 } from "node:fs";
|
|
450
454
|
import { join as join4 } from "node:path";
|
|
451
455
|
import { homedir as homedir4 } from "node:os";
|
|
452
456
|
function configDir() {
|
|
@@ -991,12 +995,12 @@ function projectNameFromCwd(cwd) {
|
|
|
991
995
|
// dist/src/hooks/codex/spawn-wiki-worker.js
|
|
992
996
|
import { execSync } from "node:child_process";
|
|
993
997
|
import { fileURLToPath } from "node:url";
|
|
994
|
-
import { dirname as
|
|
995
|
-
import { writeFileSync as writeFileSync4, mkdirSync as
|
|
998
|
+
import { dirname as dirname3, join as join8 } from "node:path";
|
|
999
|
+
import { writeFileSync as writeFileSync4, mkdirSync as mkdirSync6 } from "node:fs";
|
|
996
1000
|
import { homedir as homedir5, tmpdir as tmpdir2 } from "node:os";
|
|
997
1001
|
|
|
998
1002
|
// dist/src/utils/wiki-log.js
|
|
999
|
-
import { mkdirSync as
|
|
1003
|
+
import { mkdirSync as mkdirSync5, appendFileSync as appendFileSync2 } from "node:fs";
|
|
1000
1004
|
import { join as join6 } from "node:path";
|
|
1001
1005
|
function makeWikiLogger(hooksDir, filename = "deeplake-wiki.log") {
|
|
1002
1006
|
const path = join6(hooksDir, filename);
|
|
@@ -1004,7 +1008,7 @@ function makeWikiLogger(hooksDir, filename = "deeplake-wiki.log") {
|
|
|
1004
1008
|
path,
|
|
1005
1009
|
log(msg) {
|
|
1006
1010
|
try {
|
|
1007
|
-
|
|
1011
|
+
mkdirSync5(hooksDir, { recursive: true });
|
|
1008
1012
|
appendFileSync2(path, `[${utcTimestamp()}] ${msg}
|
|
1009
1013
|
`);
|
|
1010
1014
|
} catch {
|
|
@@ -1015,7 +1019,7 @@ function makeWikiLogger(hooksDir, filename = "deeplake-wiki.log") {
|
|
|
1015
1019
|
|
|
1016
1020
|
// dist/src/utils/version-check.js
|
|
1017
1021
|
import { readFileSync as readFileSync5 } from "node:fs";
|
|
1018
|
-
import { dirname, join as join7 } from "node:path";
|
|
1022
|
+
import { dirname as dirname2, join as join7 } from "node:path";
|
|
1019
1023
|
function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
1020
1024
|
try {
|
|
1021
1025
|
const pluginJson = join7(bundleDir, "..", pluginManifestDir, "plugin.json");
|
|
@@ -1047,7 +1051,7 @@ function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
|
1047
1051
|
return pkg.version;
|
|
1048
1052
|
} catch {
|
|
1049
1053
|
}
|
|
1050
|
-
const parent =
|
|
1054
|
+
const parent = dirname2(dir);
|
|
1051
1055
|
if (parent === dir)
|
|
1052
1056
|
break;
|
|
1053
1057
|
dir = parent;
|
|
@@ -1143,7 +1147,7 @@ function spawnCodexWikiWorker(opts) {
|
|
|
1143
1147
|
const { config, sessionId, cwd, bundleDir, reason } = opts;
|
|
1144
1148
|
const projectName = projectNameFromCwd(cwd);
|
|
1145
1149
|
const tmpDir = join8(tmpdir2(), `deeplake-wiki-${sessionId}-${Date.now()}`);
|
|
1146
|
-
|
|
1150
|
+
mkdirSync6(tmpDir, { recursive: true });
|
|
1147
1151
|
const pluginVersion = getInstalledVersion(bundleDir, ".codex-plugin") ?? "";
|
|
1148
1152
|
const configFile = join8(tmpDir, "config.json");
|
|
1149
1153
|
writeFileSync4(configFile, JSON.stringify({
|
|
@@ -1169,13 +1173,13 @@ function spawnCodexWikiWorker(opts) {
|
|
|
1169
1173
|
wikiLog(`${reason}: spawned summary worker for ${sessionId}`);
|
|
1170
1174
|
}
|
|
1171
1175
|
function bundleDirFromImportMeta(importMetaUrl) {
|
|
1172
|
-
return
|
|
1176
|
+
return dirname3(fileURLToPath(importMetaUrl));
|
|
1173
1177
|
}
|
|
1174
1178
|
|
|
1175
1179
|
// dist/src/skillify/spawn-skillify-worker.js
|
|
1176
1180
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
1177
|
-
import { dirname as
|
|
1178
|
-
import { writeFileSync as writeFileSync5, mkdirSync as
|
|
1181
|
+
import { dirname as dirname4, join as join10 } from "node:path";
|
|
1182
|
+
import { writeFileSync as writeFileSync5, mkdirSync as mkdirSync7, appendFileSync as appendFileSync3, chmodSync } from "node:fs";
|
|
1179
1183
|
import { homedir as homedir7, tmpdir as tmpdir3 } from "node:os";
|
|
1180
1184
|
|
|
1181
1185
|
// dist/src/skillify/gate-runner.js
|
|
@@ -1250,7 +1254,7 @@ var HOME2 = homedir7();
|
|
|
1250
1254
|
var SKILLIFY_LOG = join10(HOME2, ".claude", "hooks", "skillify.log");
|
|
1251
1255
|
function skillifyLog(msg) {
|
|
1252
1256
|
try {
|
|
1253
|
-
|
|
1257
|
+
mkdirSync7(dirname4(SKILLIFY_LOG), { recursive: true });
|
|
1254
1258
|
appendFileSync3(SKILLIFY_LOG, `[${utcTimestamp()}] ${msg}
|
|
1255
1259
|
`);
|
|
1256
1260
|
} catch {
|
|
@@ -1259,7 +1263,7 @@ function skillifyLog(msg) {
|
|
|
1259
1263
|
function spawnSkillifyWorker(opts) {
|
|
1260
1264
|
const { config, cwd, projectKey, project, bundleDir, agent, scopeConfig, currentSessionId, reason } = opts;
|
|
1261
1265
|
const tmpDir = join10(tmpdir3(), `deeplake-skillify-${projectKey}-${Date.now()}`);
|
|
1262
|
-
|
|
1266
|
+
mkdirSync7(tmpDir, { recursive: true, mode: 448 });
|
|
1263
1267
|
const gateBin = findAgentBin(agent);
|
|
1264
1268
|
const configFile = join10(tmpDir, "config.json");
|
|
1265
1269
|
writeFileSync5(configFile, JSON.stringify({
|
|
@@ -1298,7 +1302,7 @@ function spawnSkillifyWorker(opts) {
|
|
|
1298
1302
|
}
|
|
1299
1303
|
|
|
1300
1304
|
// dist/src/skillify/state.js
|
|
1301
|
-
import { readFileSync as readFileSync6, writeFileSync as writeFileSync6, writeSync, mkdirSync as
|
|
1305
|
+
import { readFileSync as readFileSync6, writeFileSync as writeFileSync6, writeSync, mkdirSync as mkdirSync8, renameSync as renameSync3, rmdirSync, existsSync as existsSync5, lstatSync, unlinkSync as unlinkSync3, openSync as openSync2, closeSync as closeSync2 } from "node:fs";
|
|
1302
1306
|
import { join as join13 } from "node:path";
|
|
1303
1307
|
|
|
1304
1308
|
// dist/src/utils/repo-identity.js
|
|
@@ -1350,7 +1354,7 @@ function deriveProjectKey(cwd) {
|
|
|
1350
1354
|
|
|
1351
1355
|
// dist/src/skillify/legacy-migration.js
|
|
1352
1356
|
import { existsSync as existsSync4, renameSync as renameSync2 } from "node:fs";
|
|
1353
|
-
import { dirname as
|
|
1357
|
+
import { dirname as dirname5, join as join12 } from "node:path";
|
|
1354
1358
|
|
|
1355
1359
|
// dist/src/skillify/state-dir.js
|
|
1356
1360
|
import { homedir as homedir8 } from "node:os";
|
|
@@ -1370,7 +1374,7 @@ function migrateLegacyStateDir() {
|
|
|
1370
1374
|
return;
|
|
1371
1375
|
attempted = true;
|
|
1372
1376
|
const current = getStateDir();
|
|
1373
|
-
const legacy = join12(
|
|
1377
|
+
const legacy = join12(dirname5(current), "skilify");
|
|
1374
1378
|
if (!existsSync4(legacy))
|
|
1375
1379
|
return;
|
|
1376
1380
|
if (existsSync4(current))
|
|
@@ -1414,7 +1418,7 @@ function readState(projectKey) {
|
|
|
1414
1418
|
}
|
|
1415
1419
|
function writeState(projectKey, state) {
|
|
1416
1420
|
migrateLegacyStateDir();
|
|
1417
|
-
|
|
1421
|
+
mkdirSync8(getStateDir(), { recursive: true });
|
|
1418
1422
|
const p = statePath(projectKey);
|
|
1419
1423
|
const tmp = `${p}.${process.pid}.${Date.now()}.tmp`;
|
|
1420
1424
|
writeFileSync6(tmp, JSON.stringify(state, null, 2));
|
|
@@ -1422,7 +1426,7 @@ function writeState(projectKey, state) {
|
|
|
1422
1426
|
}
|
|
1423
1427
|
function withRmwLock(projectKey, fn) {
|
|
1424
1428
|
migrateLegacyStateDir();
|
|
1425
|
-
|
|
1429
|
+
mkdirSync8(getStateDir(), { recursive: true });
|
|
1426
1430
|
const rmw = lockPath2(projectKey) + ".rmw";
|
|
1427
1431
|
const deadline = Date.now() + 2e3;
|
|
1428
1432
|
let fd = null;
|
|
@@ -1465,7 +1469,7 @@ function resetCounter(projectKey) {
|
|
|
1465
1469
|
}
|
|
1466
1470
|
function tryAcquireWorkerLock(projectKey, maxAgeMs = 10 * 60 * 1e3) {
|
|
1467
1471
|
migrateLegacyStateDir();
|
|
1468
|
-
|
|
1472
|
+
mkdirSync8(getStateDir(), { recursive: true });
|
|
1469
1473
|
const p = lockPath2(projectKey);
|
|
1470
1474
|
if (existsSync5(p)) {
|
|
1471
1475
|
try {
|
|
@@ -1517,7 +1521,7 @@ function releaseWorkerLock(projectKey) {
|
|
|
1517
1521
|
}
|
|
1518
1522
|
|
|
1519
1523
|
// dist/src/skillify/scope-config.js
|
|
1520
|
-
import { existsSync as existsSync6, mkdirSync as
|
|
1524
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync9, readFileSync as readFileSync7, writeFileSync as writeFileSync7 } from "node:fs";
|
|
1521
1525
|
import { join as join14 } from "node:path";
|
|
1522
1526
|
function configPath() {
|
|
1523
1527
|
return join14(getStateDir(), "config.json");
|
|
@@ -1580,7 +1584,7 @@ function forceSessionEndTrigger(opts) {
|
|
|
1580
1584
|
}
|
|
1581
1585
|
|
|
1582
1586
|
// dist/src/hooks/summary-state.js
|
|
1583
|
-
import { readFileSync as readFileSync8, writeFileSync as writeFileSync8, writeSync as writeSync2, mkdirSync as
|
|
1587
|
+
import { readFileSync as readFileSync8, writeFileSync as writeFileSync8, writeSync as writeSync2, mkdirSync as mkdirSync10, renameSync as renameSync4, existsSync as existsSync7, unlinkSync as unlinkSync4, openSync as openSync3, closeSync as closeSync3, statSync as statSync2 } from "node:fs";
|
|
1584
1588
|
import { homedir as homedir9 } from "node:os";
|
|
1585
1589
|
import { join as join15 } from "node:path";
|
|
1586
1590
|
var dlog3 = (msg) => log("summary-state", msg);
|
|
@@ -1590,7 +1594,7 @@ function lockPath3(sessionId) {
|
|
|
1590
1594
|
return join15(STATE_DIR, `${sessionId}.lock`);
|
|
1591
1595
|
}
|
|
1592
1596
|
function tryAcquireLock(sessionId, maxAgeMs = 10 * 60 * 1e3) {
|
|
1593
|
-
|
|
1597
|
+
mkdirSync10(STATE_DIR, { recursive: true });
|
|
1594
1598
|
const p = lockPath3(sessionId);
|
|
1595
1599
|
if (existsSync7(p)) {
|
|
1596
1600
|
try {
|
|
@@ -2042,9 +2046,9 @@ import { join as join18 } from "node:path";
|
|
|
2042
2046
|
import { pathToFileURL } from "node:url";
|
|
2043
2047
|
|
|
2044
2048
|
// dist/src/user-config.js
|
|
2045
|
-
import { existsSync as existsSync9, mkdirSync as
|
|
2049
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync11, readFileSync as readFileSync10, renameSync as renameSync5, writeFileSync as writeFileSync9 } from "node:fs";
|
|
2046
2050
|
import { homedir as homedir11 } from "node:os";
|
|
2047
|
-
import { dirname as
|
|
2051
|
+
import { dirname as dirname6, join as join17 } from "node:path";
|
|
2048
2052
|
var _configPath = () => process.env.HIVEMIND_CONFIG_PATH ?? join17(homedir11(), ".deeplake", "config.json");
|
|
2049
2053
|
var _cache = null;
|
|
2050
2054
|
var _migrated = false;
|
|
@@ -2069,9 +2073,9 @@ function writeUserConfig(patch) {
|
|
|
2069
2073
|
const current = readUserConfig();
|
|
2070
2074
|
const merged = deepMerge(current, patch);
|
|
2071
2075
|
const path = _configPath();
|
|
2072
|
-
const dir =
|
|
2076
|
+
const dir = dirname6(path);
|
|
2073
2077
|
if (!existsSync9(dir))
|
|
2074
|
-
|
|
2078
|
+
mkdirSync11(dir, { recursive: true });
|
|
2075
2079
|
const tmp = `${path}.tmp.${process.pid}`;
|
|
2076
2080
|
writeFileSync9(tmp, JSON.stringify(merged, null, 2) + "\n", "utf-8");
|
|
2077
2081
|
renameSync5(tmp, path);
|
|
@@ -2156,9 +2160,9 @@ function embeddingsDisabled() {
|
|
|
2156
2160
|
// dist/src/hooks/codex/stop.js
|
|
2157
2161
|
var log5 = (msg) => log("codex-stop", msg);
|
|
2158
2162
|
function resolveEmbedDaemonPath() {
|
|
2159
|
-
return join19(
|
|
2163
|
+
return join19(dirname7(fileURLToPath3(import.meta.url)), "embeddings", "embed-daemon.js");
|
|
2160
2164
|
}
|
|
2161
|
-
var __bundleDir =
|
|
2165
|
+
var __bundleDir = dirname7(fileURLToPath3(import.meta.url));
|
|
2162
2166
|
var PLUGIN_VERSION = getInstalledVersion(__bundleDir, ".codex-plugin") ?? "";
|
|
2163
2167
|
var CAPTURE = process.env.HIVEMIND_CAPTURE !== "false";
|
|
2164
2168
|
async function main() {
|
|
@@ -2233,6 +2237,14 @@ async function main() {
|
|
|
2233
2237
|
}
|
|
2234
2238
|
if (!CAPTURE)
|
|
2235
2239
|
return;
|
|
2240
|
+
const cwd = input.cwd || process.cwd();
|
|
2241
|
+
forceSessionEndTrigger({
|
|
2242
|
+
config,
|
|
2243
|
+
cwd,
|
|
2244
|
+
bundleDir: bundleDirFromImportMeta(import.meta.url),
|
|
2245
|
+
agent: "codex",
|
|
2246
|
+
sessionId
|
|
2247
|
+
});
|
|
2236
2248
|
if (!tryAcquireLock(sessionId)) {
|
|
2237
2249
|
wikiLog(`Stop: periodic worker already running for ${sessionId}, skipping`);
|
|
2238
2250
|
return;
|
|
@@ -2242,7 +2254,7 @@ async function main() {
|
|
|
2242
2254
|
spawnCodexWikiWorker({
|
|
2243
2255
|
config,
|
|
2244
2256
|
sessionId,
|
|
2245
|
-
cwd
|
|
2257
|
+
cwd,
|
|
2246
2258
|
bundleDir: bundleDirFromImportMeta(import.meta.url),
|
|
2247
2259
|
reason: "Stop"
|
|
2248
2260
|
});
|
|
@@ -2255,13 +2267,6 @@ async function main() {
|
|
|
2255
2267
|
}
|
|
2256
2268
|
throw e;
|
|
2257
2269
|
}
|
|
2258
|
-
forceSessionEndTrigger({
|
|
2259
|
-
config,
|
|
2260
|
-
cwd: input.cwd ?? "",
|
|
2261
|
-
bundleDir: bundleDirFromImportMeta(import.meta.url),
|
|
2262
|
-
agent: "codex",
|
|
2263
|
-
sessionId
|
|
2264
|
-
});
|
|
2265
2270
|
}
|
|
2266
2271
|
main().catch((e) => {
|
|
2267
2272
|
log5(`fatal: ${e.message}`);
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// dist/src/hooks/codex/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 {
|
|
@@ -799,7 +803,7 @@ async function main() {
|
|
|
799
803
|
let embedding = null;
|
|
800
804
|
if (!embeddingsDisabled()) {
|
|
801
805
|
try {
|
|
802
|
-
const daemonEntry = join6(
|
|
806
|
+
const daemonEntry = join6(dirname3(fileURLToPath(import.meta.url)), "embeddings", "embed-daemon.js");
|
|
803
807
|
embedding = await new EmbedClient({ daemonEntry }).embed(text, "document");
|
|
804
808
|
} catch (e) {
|
|
805
809
|
wlog(`summary embedding failed, writing NULL: ${e.message}`);
|