@deeplake/hivemind 0.7.32 → 0.7.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/bundle/cli.js +332 -189
  4. package/codex/bundle/capture.js +365 -332
  5. package/codex/bundle/commands/auth-login.js +163 -30
  6. package/codex/bundle/pre-tool-use.js +334 -301
  7. package/codex/bundle/session-start-setup.js +193 -60
  8. package/codex/bundle/session-start.js +229 -87
  9. package/codex/bundle/shell/deeplake-shell.js +328 -295
  10. package/codex/bundle/skillify-worker.js +26 -18
  11. package/codex/bundle/stop.js +450 -394
  12. package/codex/bundle/wiki-worker.js +174 -292
  13. package/cursor/bundle/capture.js +448 -392
  14. package/cursor/bundle/commands/auth-login.js +163 -30
  15. package/cursor/bundle/pre-tool-use.js +324 -291
  16. package/cursor/bundle/session-end.js +43 -20
  17. package/cursor/bundle/session-start.js +272 -130
  18. package/cursor/bundle/shell/deeplake-shell.js +328 -295
  19. package/cursor/bundle/skillify-worker.js +26 -18
  20. package/cursor/bundle/wiki-worker.js +174 -292
  21. package/hermes/bundle/capture.js +448 -392
  22. package/hermes/bundle/commands/auth-login.js +163 -30
  23. package/hermes/bundle/pre-tool-use.js +324 -291
  24. package/hermes/bundle/session-end.js +43 -20
  25. package/hermes/bundle/session-start.js +269 -127
  26. package/hermes/bundle/shell/deeplake-shell.js +328 -295
  27. package/hermes/bundle/skillify-worker.js +26 -18
  28. package/hermes/bundle/wiki-worker.js +174 -292
  29. package/mcp/bundle/server.js +190 -57
  30. package/openclaw/dist/index.js +160 -32
  31. package/openclaw/dist/skillify-worker.js +26 -18
  32. package/openclaw/openclaw.plugin.json +1 -1
  33. package/openclaw/package.json +1 -1
  34. package/package.json +1 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  // dist/src/skillify/skillify-worker.js
4
4
  import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, existsSync as existsSync5, appendFileSync as appendFileSync2, rmSync } from "node:fs";
5
- import { join as join6 } from "node:path";
5
+ import { join as join7 } from "node:path";
6
6
 
7
7
  // dist/src/utils/debug.js
8
8
  import { appendFileSync } from "node:fs";
@@ -561,25 +561,34 @@ function resolveRecordScope(args) {
561
561
  }
562
562
 
563
563
  // dist/src/skillify/state.js
564
- import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, writeSync, mkdirSync as mkdirSync2, renameSync as renameSync2, existsSync as existsSync4, unlinkSync, openSync, closeSync } from "node:fs";
564
+ import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, writeSync, mkdirSync as mkdirSync2, renameSync as renameSync2, rmdirSync, existsSync as existsSync4, lstatSync, unlinkSync, openSync, closeSync } from "node:fs";
565
565
  import { execSync } from "node:child_process";
566
- import { homedir as homedir5 } from "node:os";
567
566
  import { createHash } from "node:crypto";
568
- import { join as join5, basename } from "node:path";
567
+ import { join as join6, basename } from "node:path";
569
568
 
570
569
  // dist/src/skillify/legacy-migration.js
571
570
  import { existsSync as existsSync3, renameSync } from "node:fs";
571
+ import { dirname, join as join5 } from "node:path";
572
+
573
+ // dist/src/skillify/state-dir.js
572
574
  import { homedir as homedir4 } from "node:os";
573
575
  import { join as join4 } from "node:path";
576
+ function getStateDir() {
577
+ const override = process.env.HIVEMIND_STATE_DIR?.trim();
578
+ return override && override.length > 0 ? override : join4(homedir4(), ".deeplake", "state", "skillify");
579
+ }
580
+
581
+ // dist/src/skillify/legacy-migration.js
574
582
  var dlog = (msg) => log("skillify-migrate", msg);
575
583
  var attempted = false;
576
584
  function migrateLegacyStateDir() {
585
+ if (process.env.HIVEMIND_STATE_DIR?.trim())
586
+ return;
577
587
  if (attempted)
578
588
  return;
579
589
  attempted = true;
580
- const root = join4(homedir4(), ".deeplake", "state");
581
- const legacy = join4(root, "skilify");
582
- const current = join4(root, "skillify");
590
+ const current = getStateDir();
591
+ const legacy = join5(dirname(current), "skilify");
583
592
  if (!existsSync3(legacy))
584
593
  return;
585
594
  if (existsSync3(current))
@@ -589,8 +598,8 @@ function migrateLegacyStateDir() {
589
598
  dlog(`migrated ${legacy} -> ${current}`);
590
599
  } catch (err) {
591
600
  const code = err.code;
592
- if (code === "EXDEV" || code === "EPERM") {
593
- dlog(`migration failed (${code}); leaving legacy dir in place`);
601
+ if (code === "EXDEV" || code === "EPERM" || code === "ENOENT" || code === "EEXIST" || code === "ENOTEMPTY") {
602
+ dlog(`migration skipped (${code}); legacy dir left as-is or another process handled it`);
594
603
  return;
595
604
  }
596
605
  throw err;
@@ -599,17 +608,16 @@ function migrateLegacyStateDir() {
599
608
 
600
609
  // dist/src/skillify/state.js
601
610
  var dlog2 = (msg) => log("skillify-state", msg);
602
- var STATE_DIR = join5(homedir5(), ".deeplake", "state", "skillify");
603
611
  var YIELD_BUF = new Int32Array(new SharedArrayBuffer(4));
604
612
  var TRIGGER_THRESHOLD = (() => {
605
613
  const n = Number(process.env.HIVEMIND_SKILLIFY_EVERY_N_TURNS ?? "");
606
614
  return Number.isInteger(n) && n > 0 ? n : 20;
607
615
  })();
608
616
  function statePath(projectKey) {
609
- return join5(STATE_DIR, `${projectKey}.json`);
617
+ return join6(getStateDir(), `${projectKey}.json`);
610
618
  }
611
619
  function lockPath(projectKey) {
612
- return join5(STATE_DIR, `${projectKey}.lock`);
620
+ return join6(getStateDir(), `${projectKey}.lock`);
613
621
  }
614
622
  function readState(projectKey) {
615
623
  migrateLegacyStateDir();
@@ -624,7 +632,7 @@ function readState(projectKey) {
624
632
  }
625
633
  function writeState(projectKey, state) {
626
634
  migrateLegacyStateDir();
627
- mkdirSync2(STATE_DIR, { recursive: true });
635
+ mkdirSync2(getStateDir(), { recursive: true });
628
636
  const p = statePath(projectKey);
629
637
  const tmp = `${p}.${process.pid}.${Date.now()}.tmp`;
630
638
  writeFileSync2(tmp, JSON.stringify(state, null, 2));
@@ -632,7 +640,7 @@ function writeState(projectKey, state) {
632
640
  }
633
641
  function withRmwLock(projectKey, fn) {
634
642
  migrateLegacyStateDir();
635
- mkdirSync2(STATE_DIR, { recursive: true });
643
+ mkdirSync2(getStateDir(), { recursive: true });
636
644
  const rmw = lockPath(projectKey) + ".rmw";
637
645
  const deadline = Date.now() + 2e3;
638
646
  let fd = null;
@@ -705,8 +713,8 @@ function releaseWorkerLock(projectKey) {
705
713
  var cfg = JSON.parse(readFileSync3(process.argv[2], "utf-8"));
706
714
  globalThis.__hivemind_tuning__ = cfg.tuning ?? {};
707
715
  var tmpDir = cfg.tmpDir;
708
- var verdictPath = join6(tmpDir, "verdict.json");
709
- var promptPath = join6(tmpDir, "prompt.txt");
716
+ var verdictPath = join7(tmpDir, "verdict.json");
717
+ var promptPath = join7(tmpDir, "prompt.txt");
710
718
  var SESSIONS_TO_MINE = 10;
711
719
  var PAIR_CHAR_CAP = 2e3;
712
720
  var TOTAL_PAIRS_CHAR_CAP = 4e4;
@@ -953,9 +961,9 @@ async function main() {
953
961
  timeoutMs: 12e4
954
962
  });
955
963
  try {
956
- writeFileSync3(join6(tmpDir, "gate-stdout.txt"), gate.stdout);
964
+ writeFileSync3(join7(tmpDir, "gate-stdout.txt"), gate.stdout);
957
965
  if (gate.stderr)
958
- writeFileSync3(join6(tmpDir, "gate-stderr.txt"), gate.stderr);
966
+ writeFileSync3(join7(tmpDir, "gate-stderr.txt"), gate.stderr);
959
967
  } catch {
960
968
  }
961
969
  if (gate.errored) {