@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
@@ -406,25 +406,34 @@ function spawnSkillifyWorker(opts) {
406
406
  }
407
407
 
408
408
  // dist/src/skillify/state.js
409
- import { readFileSync as readFileSync4, writeFileSync as writeFileSync4, writeSync as writeSync2, mkdirSync as mkdirSync5, renameSync as renameSync3, existsSync as existsSync5, unlinkSync as unlinkSync2, openSync as openSync2, closeSync as closeSync2 } from "node:fs";
409
+ import { readFileSync as readFileSync4, writeFileSync as writeFileSync4, writeSync as writeSync2, mkdirSync as mkdirSync5, renameSync as renameSync3, rmdirSync, existsSync as existsSync5, lstatSync, unlinkSync as unlinkSync2, openSync as openSync2, closeSync as closeSync2 } from "node:fs";
410
410
  import { execSync as execSync2 } from "node:child_process";
411
- import { homedir as homedir8 } from "node:os";
412
411
  import { createHash } from "node:crypto";
413
- import { join as join10, basename } from "node:path";
412
+ import { join as join11, basename } from "node:path";
414
413
 
415
414
  // dist/src/skillify/legacy-migration.js
416
415
  import { existsSync as existsSync4, renameSync as renameSync2 } from "node:fs";
416
+ import { dirname as dirname4, join as join10 } from "node:path";
417
+
418
+ // dist/src/skillify/state-dir.js
417
419
  import { homedir as homedir7 } from "node:os";
418
420
  import { join as join9 } from "node:path";
421
+ function getStateDir() {
422
+ const override = process.env.HIVEMIND_STATE_DIR?.trim();
423
+ return override && override.length > 0 ? override : join9(homedir7(), ".deeplake", "state", "skillify");
424
+ }
425
+
426
+ // dist/src/skillify/legacy-migration.js
419
427
  var dlog2 = (msg) => log("skillify-migrate", msg);
420
428
  var attempted = false;
421
429
  function migrateLegacyStateDir() {
430
+ if (process.env.HIVEMIND_STATE_DIR?.trim())
431
+ return;
422
432
  if (attempted)
423
433
  return;
424
434
  attempted = true;
425
- const root = join9(homedir7(), ".deeplake", "state");
426
- const legacy = join9(root, "skilify");
427
- const current = join9(root, "skillify");
435
+ const current = getStateDir();
436
+ const legacy = join10(dirname4(current), "skilify");
428
437
  if (!existsSync4(legacy))
429
438
  return;
430
439
  if (existsSync4(current))
@@ -434,8 +443,8 @@ function migrateLegacyStateDir() {
434
443
  dlog2(`migrated ${legacy} -> ${current}`);
435
444
  } catch (err) {
436
445
  const code = err.code;
437
- if (code === "EXDEV" || code === "EPERM") {
438
- dlog2(`migration failed (${code}); leaving legacy dir in place`);
446
+ if (code === "EXDEV" || code === "EPERM" || code === "ENOENT" || code === "EEXIST" || code === "ENOTEMPTY") {
447
+ dlog2(`migration skipped (${code}); legacy dir left as-is or another process handled it`);
439
448
  return;
440
449
  }
441
450
  throw err;
@@ -444,17 +453,16 @@ function migrateLegacyStateDir() {
444
453
 
445
454
  // dist/src/skillify/state.js
446
455
  var dlog3 = (msg) => log("skillify-state", msg);
447
- var STATE_DIR2 = join10(homedir8(), ".deeplake", "state", "skillify");
448
456
  var YIELD_BUF2 = new Int32Array(new SharedArrayBuffer(4));
449
457
  var TRIGGER_THRESHOLD = (() => {
450
458
  const n = Number(process.env.HIVEMIND_SKILLIFY_EVERY_N_TURNS ?? "");
451
459
  return Number.isInteger(n) && n > 0 ? n : 20;
452
460
  })();
453
461
  function statePath(projectKey) {
454
- return join10(STATE_DIR2, `${projectKey}.json`);
462
+ return join11(getStateDir(), `${projectKey}.json`);
455
463
  }
456
464
  function lockPath2(projectKey) {
457
- return join10(STATE_DIR2, `${projectKey}.lock`);
465
+ return join11(getStateDir(), `${projectKey}.lock`);
458
466
  }
459
467
  var DEFAULT_PORTS = {
460
468
  http: "80",
@@ -510,7 +518,7 @@ function readState(projectKey) {
510
518
  }
511
519
  function writeState(projectKey, state) {
512
520
  migrateLegacyStateDir();
513
- mkdirSync5(STATE_DIR2, { recursive: true });
521
+ mkdirSync5(getStateDir(), { recursive: true });
514
522
  const p = statePath(projectKey);
515
523
  const tmp = `${p}.${process.pid}.${Date.now()}.tmp`;
516
524
  writeFileSync4(tmp, JSON.stringify(state, null, 2));
@@ -518,7 +526,7 @@ function writeState(projectKey, state) {
518
526
  }
519
527
  function withRmwLock(projectKey, fn) {
520
528
  migrateLegacyStateDir();
521
- mkdirSync5(STATE_DIR2, { recursive: true });
529
+ mkdirSync5(getStateDir(), { recursive: true });
522
530
  const rmw = lockPath2(projectKey) + ".rmw";
523
531
  const deadline = Date.now() + 2e3;
524
532
  let fd = null;
@@ -561,7 +569,7 @@ function resetCounter(projectKey) {
561
569
  }
562
570
  function tryAcquireWorkerLock(projectKey, maxAgeMs = 10 * 60 * 1e3) {
563
571
  migrateLegacyStateDir();
564
- mkdirSync5(STATE_DIR2, { recursive: true });
572
+ mkdirSync5(getStateDir(), { recursive: true });
565
573
  const p = lockPath2(projectKey);
566
574
  if (existsSync5(p)) {
567
575
  try {
@@ -574,8 +582,22 @@ function tryAcquireWorkerLock(projectKey, maxAgeMs = 10 * 60 * 1e3) {
574
582
  try {
575
583
  unlinkSync2(p);
576
584
  } catch (unlinkErr) {
577
- dlog3(`could not unlink stale worker lock for ${projectKey}: ${unlinkErr.message}`);
578
- return false;
585
+ if (unlinkErr?.code !== "EISDIR" && unlinkErr?.code !== "EPERM" && unlinkErr?.code !== "ENOENT") {
586
+ dlog3(`could not unlink stale worker lock for ${projectKey}: ${unlinkErr.message}`);
587
+ return false;
588
+ }
589
+ let isDir = false;
590
+ try {
591
+ isDir = lstatSync(p).isDirectory();
592
+ } catch {
593
+ }
594
+ if (isDir) {
595
+ try {
596
+ rmdirSync(p);
597
+ } catch (rmErr) {
598
+ dlog3(`rmdir stale lock skipped for ${projectKey}: ${rmErr.message}`);
599
+ }
600
+ }
579
601
  }
580
602
  }
581
603
  try {
@@ -600,13 +622,14 @@ function releaseWorkerLock(projectKey) {
600
622
 
601
623
  // dist/src/skillify/scope-config.js
602
624
  import { existsSync as existsSync6, mkdirSync as mkdirSync6, readFileSync as readFileSync5, writeFileSync as writeFileSync5 } from "node:fs";
603
- import { homedir as homedir9 } from "node:os";
604
- import { join as join11 } from "node:path";
605
- var STATE_DIR3 = join11(homedir9(), ".deeplake", "state", "skillify");
606
- var CONFIG_PATH = join11(STATE_DIR3, "config.json");
625
+ import { join as join12 } from "node:path";
626
+ function configPath() {
627
+ return join12(getStateDir(), "config.json");
628
+ }
607
629
  var DEFAULT = { scope: "me", team: [], install: "project" };
608
630
  function loadScopeConfig() {
609
631
  migrateLegacyStateDir();
632
+ const CONFIG_PATH = configPath();
610
633
  if (!existsSync6(CONFIG_PATH))
611
634
  return DEFAULT;
612
635
  try {