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