@deeplake/hivemind 0.7.33 → 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.
@@ -3,7 +3,7 @@ globalThis.__hivemind_tuning__ ??= {};
3
3
 
4
4
  // dist/src/skillify/skillify-worker.js
5
5
  import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, existsSync as existsSync5, appendFileSync as appendFileSync2, rmSync } from "node:fs";
6
- import { join as join6 } from "node:path";
6
+ import { join as join7 } from "node:path";
7
7
 
8
8
  // dist/src/utils/debug.js
9
9
  import { appendFileSync } from "node:fs";
@@ -562,25 +562,34 @@ function resolveRecordScope(args) {
562
562
  }
563
563
 
564
564
  // dist/src/skillify/state.js
565
- import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, writeSync, mkdirSync as mkdirSync2, renameSync as renameSync2, existsSync as existsSync4, unlinkSync, openSync, closeSync } from "node:fs";
565
+ 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";
566
566
  import { execSync } from "node:child_process";
567
- import { homedir as homedir5 } from "node:os";
568
567
  import { createHash } from "node:crypto";
569
- import { join as join5, basename } from "node:path";
568
+ import { join as join6, basename } from "node:path";
570
569
 
571
570
  // dist/src/skillify/legacy-migration.js
572
571
  import { existsSync as existsSync3, renameSync } from "node:fs";
572
+ import { dirname, join as join5 } from "node:path";
573
+
574
+ // dist/src/skillify/state-dir.js
573
575
  import { homedir as homedir4 } from "node:os";
574
576
  import { join as join4 } from "node:path";
577
+ function getStateDir() {
578
+ const override = globalThis.__hivemind_tuning__.HIVEMIND_STATE_DIR?.trim();
579
+ return override && override.length > 0 ? override : join4(homedir4(), ".deeplake", "state", "skillify");
580
+ }
581
+
582
+ // dist/src/skillify/legacy-migration.js
575
583
  var dlog = (msg) => log("skillify-migrate", msg);
576
584
  var attempted = false;
577
585
  function migrateLegacyStateDir() {
586
+ if (globalThis.__hivemind_tuning__.HIVEMIND_STATE_DIR?.trim())
587
+ return;
578
588
  if (attempted)
579
589
  return;
580
590
  attempted = true;
581
- const root = join4(homedir4(), ".deeplake", "state");
582
- const legacy = join4(root, "skilify");
583
- const current = join4(root, "skillify");
591
+ const current = getStateDir();
592
+ const legacy = join5(dirname(current), "skilify");
584
593
  if (!existsSync3(legacy))
585
594
  return;
586
595
  if (existsSync3(current))
@@ -590,8 +599,8 @@ function migrateLegacyStateDir() {
590
599
  dlog(`migrated ${legacy} -> ${current}`);
591
600
  } catch (err) {
592
601
  const code = err.code;
593
- if (code === "EXDEV" || code === "EPERM") {
594
- dlog(`migration failed (${code}); leaving legacy dir in place`);
602
+ if (code === "EXDEV" || code === "EPERM" || code === "ENOENT" || code === "EEXIST" || code === "ENOTEMPTY") {
603
+ dlog(`migration skipped (${code}); legacy dir left as-is or another process handled it`);
595
604
  return;
596
605
  }
597
606
  throw err;
@@ -600,17 +609,16 @@ function migrateLegacyStateDir() {
600
609
 
601
610
  // dist/src/skillify/state.js
602
611
  var dlog2 = (msg) => log("skillify-state", msg);
603
- var STATE_DIR = join5(homedir5(), ".deeplake", "state", "skillify");
604
612
  var YIELD_BUF = new Int32Array(new SharedArrayBuffer(4));
605
613
  var TRIGGER_THRESHOLD = (() => {
606
614
  const n = Number(globalThis.__hivemind_tuning__.HIVEMIND_SKILLIFY_EVERY_N_TURNS ?? "");
607
615
  return Number.isInteger(n) && n > 0 ? n : 20;
608
616
  })();
609
617
  function statePath(projectKey) {
610
- return join5(STATE_DIR, `${projectKey}.json`);
618
+ return join6(getStateDir(), `${projectKey}.json`);
611
619
  }
612
620
  function lockPath(projectKey) {
613
- return join5(STATE_DIR, `${projectKey}.lock`);
621
+ return join6(getStateDir(), `${projectKey}.lock`);
614
622
  }
615
623
  function readState(projectKey) {
616
624
  migrateLegacyStateDir();
@@ -625,7 +633,7 @@ function readState(projectKey) {
625
633
  }
626
634
  function writeState(projectKey, state) {
627
635
  migrateLegacyStateDir();
628
- mkdirSync2(STATE_DIR, { recursive: true });
636
+ mkdirSync2(getStateDir(), { recursive: true });
629
637
  const p = statePath(projectKey);
630
638
  const tmp = `${p}.${process.pid}.${Date.now()}.tmp`;
631
639
  writeFileSync2(tmp, JSON.stringify(state, null, 2));
@@ -633,7 +641,7 @@ function writeState(projectKey, state) {
633
641
  }
634
642
  function withRmwLock(projectKey, fn) {
635
643
  migrateLegacyStateDir();
636
- mkdirSync2(STATE_DIR, { recursive: true });
644
+ mkdirSync2(getStateDir(), { recursive: true });
637
645
  const rmw = lockPath(projectKey) + ".rmw";
638
646
  const deadline = Date.now() + 2e3;
639
647
  let fd = null;
@@ -706,8 +714,8 @@ function releaseWorkerLock(projectKey) {
706
714
  var cfg = JSON.parse(readFileSync3(process.argv[2], "utf-8"));
707
715
  globalThis.__hivemind_tuning__ = cfg.tuning ?? {};
708
716
  var tmpDir = cfg.tmpDir;
709
- var verdictPath = join6(tmpDir, "verdict.json");
710
- var promptPath = join6(tmpDir, "prompt.txt");
717
+ var verdictPath = join7(tmpDir, "verdict.json");
718
+ var promptPath = join7(tmpDir, "prompt.txt");
711
719
  var SESSIONS_TO_MINE = 10;
712
720
  var PAIR_CHAR_CAP = 2e3;
713
721
  var TOTAL_PAIRS_CHAR_CAP = 4e4;
@@ -954,9 +962,9 @@ async function main() {
954
962
  timeoutMs: 12e4
955
963
  });
956
964
  try {
957
- writeFileSync3(join6(tmpDir, "gate-stdout.txt"), gate.stdout);
965
+ writeFileSync3(join7(tmpDir, "gate-stdout.txt"), gate.stdout);
958
966
  if (gate.stderr)
959
- writeFileSync3(join6(tmpDir, "gate-stderr.txt"), gate.stderr);
967
+ writeFileSync3(join7(tmpDir, "gate-stderr.txt"), gate.stderr);
960
968
  } catch {
961
969
  }
962
970
  if (gate.errored) {
@@ -52,5 +52,5 @@
52
52
  }
53
53
  }
54
54
  },
55
- "version": "0.7.33"
55
+ "version": "0.7.34"
56
56
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hivemind",
3
- "version": "0.7.33",
3
+ "version": "0.7.34",
4
4
  "type": "module",
5
5
  "description": "Hivemind — cloud-backed persistent shared memory for AI agents, powered by DeepLake",
6
6
  "license": "Apache-2.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deeplake/hivemind",
3
- "version": "0.7.33",
3
+ "version": "0.7.34",
4
4
  "description": "Cloud-backed persistent shared memory for AI agents powered by Deeplake",
5
5
  "type": "module",
6
6
  "repository": {