@deeplake/hivemind 0.7.26 → 0.7.28
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 +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/bundle/cli.js +1086 -93
- package/codex/bundle/capture.js +10 -5
- package/codex/bundle/commands/auth-login.js +10 -5
- package/codex/bundle/embeddings/embed-daemon.js +4 -2
- package/codex/bundle/pre-tool-use.js +10 -5
- package/codex/bundle/session-start-setup.js +10 -5
- package/codex/bundle/session-start.js +233 -136
- package/codex/bundle/shell/deeplake-shell.js +10 -5
- package/codex/bundle/skillify-worker.js +60 -21
- package/codex/bundle/stop.js +66 -25
- package/codex/bundle/wiki-worker.js +4 -2
- package/codex/skills/deeplake-memory/SKILL.md +33 -0
- package/cursor/bundle/capture.js +63 -22
- package/cursor/bundle/commands/auth-login.js +10 -5
- package/cursor/bundle/embeddings/embed-daemon.js +4 -2
- package/cursor/bundle/pre-tool-use.js +10 -5
- package/cursor/bundle/session-end.js +57 -19
- package/cursor/bundle/session-start.js +238 -87
- package/cursor/bundle/shell/deeplake-shell.js +10 -5
- package/cursor/bundle/skillify-worker.js +60 -21
- package/cursor/bundle/wiki-worker.js +4 -2
- package/hermes/bundle/capture.js +63 -22
- package/hermes/bundle/commands/auth-login.js +10 -5
- package/hermes/bundle/embeddings/embed-daemon.js +4 -2
- package/hermes/bundle/pre-tool-use.js +10 -5
- package/hermes/bundle/session-end.js +57 -19
- package/hermes/bundle/session-start.js +239 -87
- package/hermes/bundle/shell/deeplake-shell.js +10 -5
- package/hermes/bundle/skillify-worker.js +60 -21
- package/hermes/bundle/wiki-worker.js +4 -2
- package/mcp/bundle/server.js +10 -5
- package/openclaw/dist/chunks/{auth-creds-AEKS6D3P.js → auth-creds-KKTYIP27.js} +2 -1
- package/openclaw/dist/chunks/{chunk-SRCBBT4H.js → chunk-OSD5GJJ5.js} +2 -0
- package/openclaw/dist/chunks/{config-ZLH6JFJS.js → config-XEK4MJJS.js} +2 -0
- package/openclaw/dist/chunks/{index-marker-store-PGT5CW6T.js → index-marker-store-CPGF2BI7.js} +4 -2
- package/openclaw/dist/chunks/{setup-config-C35UK4LP.js → setup-config-VI54GEUM.js} +2 -0
- package/openclaw/dist/index.js +68 -19
- package/openclaw/dist/skillify-worker.js +67 -27
- package/openclaw/openclaw.plugin.json +1 -1
- package/openclaw/package.json +1 -1
- package/package.json +1 -1
- package/pi/extension-source/hivemind.ts +157 -19
|
@@ -52,8 +52,8 @@ var init_index_marker_store = __esm({
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
// dist/src/hooks/hermes/session-start.js
|
|
55
|
-
import { fileURLToPath } from "node:url";
|
|
56
|
-
import { dirname as
|
|
55
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
56
|
+
import { dirname as dirname6 } from "node:path";
|
|
57
57
|
|
|
58
58
|
// dist/src/commands/auth.js
|
|
59
59
|
import { execSync } from "node:child_process";
|
|
@@ -125,10 +125,12 @@ import { randomUUID } from "node:crypto";
|
|
|
125
125
|
import { appendFileSync } from "node:fs";
|
|
126
126
|
import { join as join3 } from "node:path";
|
|
127
127
|
import { homedir as homedir3 } from "node:os";
|
|
128
|
-
var DEBUG = process.env.HIVEMIND_DEBUG === "1";
|
|
129
128
|
var LOG = join3(homedir3(), ".deeplake", "hook-debug.log");
|
|
129
|
+
function isDebug() {
|
|
130
|
+
return process.env.HIVEMIND_DEBUG === "1";
|
|
131
|
+
}
|
|
130
132
|
function log(tag, msg) {
|
|
131
|
-
if (!
|
|
133
|
+
if (!isDebug())
|
|
132
134
|
return;
|
|
133
135
|
appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
|
|
134
136
|
`);
|
|
@@ -174,7 +176,9 @@ var RETRYABLE_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
|
|
|
174
176
|
var MAX_RETRIES = 3;
|
|
175
177
|
var BASE_DELAY_MS = 500;
|
|
176
178
|
var MAX_CONCURRENCY = 5;
|
|
177
|
-
|
|
179
|
+
function getQueryTimeoutMs() {
|
|
180
|
+
return Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
|
|
181
|
+
}
|
|
178
182
|
function sleep(ms) {
|
|
179
183
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
180
184
|
}
|
|
@@ -255,8 +259,9 @@ var DeeplakeApi = class {
|
|
|
255
259
|
let lastError;
|
|
256
260
|
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
257
261
|
let resp;
|
|
262
|
+
const timeoutMs = getQueryTimeoutMs();
|
|
258
263
|
try {
|
|
259
|
-
const signal = AbortSignal.timeout(
|
|
264
|
+
const signal = AbortSignal.timeout(timeoutMs);
|
|
260
265
|
resp = await fetch(`${this.apiUrl}/workspaces/${this.workspaceId}/tables/query`, {
|
|
261
266
|
method: "POST",
|
|
262
267
|
headers: {
|
|
@@ -270,7 +275,7 @@ var DeeplakeApi = class {
|
|
|
270
275
|
});
|
|
271
276
|
} catch (e) {
|
|
272
277
|
if (isTimeoutError(e)) {
|
|
273
|
-
lastError = new Error(`Query timeout after ${
|
|
278
|
+
lastError = new Error(`Query timeout after ${timeoutMs}ms`);
|
|
274
279
|
throw lastError;
|
|
275
280
|
}
|
|
276
281
|
lastError = e instanceof Error ? e : new Error(String(e));
|
|
@@ -560,6 +565,162 @@ var DeeplakeApi = class {
|
|
|
560
565
|
}
|
|
561
566
|
};
|
|
562
567
|
|
|
568
|
+
// dist/src/cli/skillify-spec.js
|
|
569
|
+
var SKILLIFY_COMMANDS = [
|
|
570
|
+
{ cmd: "hivemind skillify", desc: "show scope, team, install, per-project state" },
|
|
571
|
+
{ cmd: "hivemind skillify pull", desc: "sync project skills from the org table to local FS" },
|
|
572
|
+
{ cmd: "hivemind skillify pull --user <email>", desc: "only skills authored by that user" },
|
|
573
|
+
{ cmd: "hivemind skillify pull --users <a,b,c>", desc: "only skills from those authors" },
|
|
574
|
+
{ cmd: "hivemind skillify pull --all-users", desc: 'explicit "no author filter" (default)' },
|
|
575
|
+
{ cmd: "hivemind skillify pull --to <project|global>", desc: "install location (project=cwd/.claude/skills, global=~/.claude/skills)" },
|
|
576
|
+
{ cmd: "hivemind skillify pull --dry-run", desc: "preview without touching disk" },
|
|
577
|
+
{ cmd: "hivemind skillify pull --force", desc: "overwrite local files even if up-to-date (creates .bak)" },
|
|
578
|
+
{ cmd: "hivemind skillify pull <skill-name>", desc: "pull only that one skill (combines with --user)" },
|
|
579
|
+
{ cmd: "hivemind skillify unpull", desc: "remove every skill previously installed by pull" },
|
|
580
|
+
{ cmd: "hivemind skillify unpull --user <email>", desc: "remove only that author's pulls" },
|
|
581
|
+
{ cmd: "hivemind skillify unpull --not-mine", desc: "remove all pulls except your own" },
|
|
582
|
+
{ cmd: "hivemind skillify unpull --dry-run", desc: "preview without touching disk" },
|
|
583
|
+
{ cmd: "hivemind skillify scope <me|team|org>", desc: "sharing scope for newly mined skills" },
|
|
584
|
+
{ cmd: "hivemind skillify install <project|global>", desc: "default install location for new skills" },
|
|
585
|
+
{ cmd: "hivemind skillify promote <skill-name>", desc: "move a project skill to the global location" },
|
|
586
|
+
{ cmd: "hivemind skillify team add|remove|list <name>", desc: "manage team member list" },
|
|
587
|
+
{ cmd: "hivemind skillify mine-local", desc: "one-shot: mine skills from local sessions (no auth needed)" },
|
|
588
|
+
{ cmd: "hivemind skillify mine-local --n <num|all>", desc: "how many sessions to mine (default: 8)" },
|
|
589
|
+
{ cmd: "hivemind skillify mine-local --force", desc: "re-run even if the manifest sentinel exists" },
|
|
590
|
+
{ cmd: "hivemind skillify mine-local --dry-run", desc: "stop before calling the LLM gate" }
|
|
591
|
+
];
|
|
592
|
+
function renderSkillifyCommands() {
|
|
593
|
+
const maxLen = Math.max(...SKILLIFY_COMMANDS.map((c) => c.cmd.length));
|
|
594
|
+
return SKILLIFY_COMMANDS.map((c) => `- ${c.cmd.padEnd(maxLen + 2)} \u2014 ${c.desc}`).join("\n");
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// dist/src/skillify/local-manifest.js
|
|
598
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
599
|
+
import { homedir as homedir4 } from "node:os";
|
|
600
|
+
import { dirname, join as join5 } from "node:path";
|
|
601
|
+
var LOCAL_MANIFEST_PATH = join5(homedir4(), ".claude", "hivemind", "local-mined.json");
|
|
602
|
+
var LOCAL_MINE_LOCK_PATH = join5(homedir4(), ".claude", "hivemind", "local-mined.lock");
|
|
603
|
+
function readLocalManifest(path = LOCAL_MANIFEST_PATH) {
|
|
604
|
+
if (!existsSync3(path))
|
|
605
|
+
return null;
|
|
606
|
+
try {
|
|
607
|
+
return JSON.parse(readFileSync4(path, "utf-8"));
|
|
608
|
+
} catch {
|
|
609
|
+
return null;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
function countLocalManifestEntries(path = LOCAL_MANIFEST_PATH) {
|
|
613
|
+
const m = readLocalManifest(path);
|
|
614
|
+
return Array.isArray(m?.entries) ? m.entries.length : 0;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
// dist/src/skillify/spawn-mine-local-worker.js
|
|
618
|
+
import { execFileSync, spawn } from "node:child_process";
|
|
619
|
+
import { closeSync, existsSync as existsSync4, mkdirSync as mkdirSync4, openSync, readdirSync, statSync, unlinkSync as unlinkSync2 } from "node:fs";
|
|
620
|
+
import { homedir as homedir5 } from "node:os";
|
|
621
|
+
import { dirname as dirname2, join as join6 } from "node:path";
|
|
622
|
+
import { fileURLToPath } from "node:url";
|
|
623
|
+
var HOME = homedir5();
|
|
624
|
+
var HIVEMIND_DIR = join6(HOME, ".claude", "hivemind");
|
|
625
|
+
var LOG_PATH = join6(HOME, ".claude", "hooks", "mine-local.log");
|
|
626
|
+
var CLAUDE_PROJECTS_DIR = join6(HOME, ".claude", "projects");
|
|
627
|
+
var LOCK_STALE_MS = 15 * 60 * 1e3;
|
|
628
|
+
function findBundledCliPath() {
|
|
629
|
+
try {
|
|
630
|
+
const thisDir = dirname2(fileURLToPath(import.meta.url));
|
|
631
|
+
const cliPath = join6(thisDir, "..", "..", "bundle", "cli.js");
|
|
632
|
+
return existsSync4(cliPath) ? cliPath : null;
|
|
633
|
+
} catch {
|
|
634
|
+
return null;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
function findHivemindLauncher() {
|
|
638
|
+
const bundled = findBundledCliPath();
|
|
639
|
+
if (bundled)
|
|
640
|
+
return { kind: "node-script", path: bundled };
|
|
641
|
+
try {
|
|
642
|
+
const out = execFileSync("which", ["hivemind"], {
|
|
643
|
+
encoding: "utf-8",
|
|
644
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
645
|
+
});
|
|
646
|
+
const bin = out.trim();
|
|
647
|
+
return bin ? { kind: "bin", path: bin } : null;
|
|
648
|
+
} catch {
|
|
649
|
+
return null;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
function hasLocalClaudeSessions() {
|
|
653
|
+
if (!existsSync4(CLAUDE_PROJECTS_DIR))
|
|
654
|
+
return false;
|
|
655
|
+
let subdirs;
|
|
656
|
+
try {
|
|
657
|
+
subdirs = readdirSync(CLAUDE_PROJECTS_DIR);
|
|
658
|
+
} catch {
|
|
659
|
+
return false;
|
|
660
|
+
}
|
|
661
|
+
for (const sub of subdirs) {
|
|
662
|
+
let files;
|
|
663
|
+
try {
|
|
664
|
+
files = readdirSync(join6(CLAUDE_PROJECTS_DIR, sub));
|
|
665
|
+
} catch {
|
|
666
|
+
continue;
|
|
667
|
+
}
|
|
668
|
+
if (files.some((f) => f.endsWith(".jsonl")))
|
|
669
|
+
return true;
|
|
670
|
+
}
|
|
671
|
+
return false;
|
|
672
|
+
}
|
|
673
|
+
function maybeAutoMineLocal() {
|
|
674
|
+
if (existsSync4(LOCAL_MANIFEST_PATH))
|
|
675
|
+
return { triggered: false, reason: "manifest-exists" };
|
|
676
|
+
if (existsSync4(LOCAL_MINE_LOCK_PATH)) {
|
|
677
|
+
let stale = false;
|
|
678
|
+
try {
|
|
679
|
+
const stats = statSync(LOCAL_MINE_LOCK_PATH);
|
|
680
|
+
stale = Date.now() - stats.mtimeMs > LOCK_STALE_MS;
|
|
681
|
+
} catch {
|
|
682
|
+
}
|
|
683
|
+
if (!stale)
|
|
684
|
+
return { triggered: false, reason: "lock-exists" };
|
|
685
|
+
try {
|
|
686
|
+
unlinkSync2(LOCAL_MINE_LOCK_PATH);
|
|
687
|
+
} catch {
|
|
688
|
+
return { triggered: false, reason: "lock-exists" };
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
if (!hasLocalClaudeSessions())
|
|
692
|
+
return { triggered: false, reason: "no-claude-sessions" };
|
|
693
|
+
const launcher = findHivemindLauncher();
|
|
694
|
+
if (!launcher)
|
|
695
|
+
return { triggered: false, reason: "no-hivemind-bin" };
|
|
696
|
+
try {
|
|
697
|
+
mkdirSync4(HIVEMIND_DIR, { recursive: true });
|
|
698
|
+
const fd = openSync(LOCAL_MINE_LOCK_PATH, "wx");
|
|
699
|
+
closeSync(fd);
|
|
700
|
+
} catch {
|
|
701
|
+
return { triggered: false, reason: "lock-acquire-failed" };
|
|
702
|
+
}
|
|
703
|
+
try {
|
|
704
|
+
mkdirSync4(join6(HOME, ".claude", "hooks"), { recursive: true });
|
|
705
|
+
const out = openSync(LOG_PATH, "a");
|
|
706
|
+
const [cmd, args] = launcher.kind === "node-script" ? [process.execPath, [launcher.path, "skillify", "mine-local"]] : [launcher.path, ["skillify", "mine-local"]];
|
|
707
|
+
const child = spawn(cmd, args, {
|
|
708
|
+
detached: true,
|
|
709
|
+
stdio: ["ignore", out, out],
|
|
710
|
+
env: process.env
|
|
711
|
+
});
|
|
712
|
+
closeSync(out);
|
|
713
|
+
child.unref();
|
|
714
|
+
return { triggered: true };
|
|
715
|
+
} catch {
|
|
716
|
+
try {
|
|
717
|
+
unlinkSync2(LOCAL_MINE_LOCK_PATH);
|
|
718
|
+
} catch {
|
|
719
|
+
}
|
|
720
|
+
return { triggered: false, reason: "spawn-failed" };
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
|
|
563
724
|
// dist/src/utils/stdin.js
|
|
564
725
|
function readStdin() {
|
|
565
726
|
return new Promise((resolve, reject) => {
|
|
@@ -578,18 +739,18 @@ function readStdin() {
|
|
|
578
739
|
}
|
|
579
740
|
|
|
580
741
|
// dist/src/utils/version-check.js
|
|
581
|
-
import { readFileSync as
|
|
582
|
-
import { dirname, join as
|
|
742
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
743
|
+
import { dirname as dirname3, join as join7 } from "node:path";
|
|
583
744
|
function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
584
745
|
try {
|
|
585
|
-
const pluginJson =
|
|
586
|
-
const plugin = JSON.parse(
|
|
746
|
+
const pluginJson = join7(bundleDir, "..", pluginManifestDir, "plugin.json");
|
|
747
|
+
const plugin = JSON.parse(readFileSync5(pluginJson, "utf-8"));
|
|
587
748
|
if (plugin.version)
|
|
588
749
|
return plugin.version;
|
|
589
750
|
} catch {
|
|
590
751
|
}
|
|
591
752
|
try {
|
|
592
|
-
const stamp =
|
|
753
|
+
const stamp = readFileSync5(join7(bundleDir, "..", ".hivemind_version"), "utf-8").trim();
|
|
593
754
|
if (stamp)
|
|
594
755
|
return stamp;
|
|
595
756
|
} catch {
|
|
@@ -604,14 +765,14 @@ function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
|
604
765
|
]);
|
|
605
766
|
let dir = bundleDir;
|
|
606
767
|
for (let i = 0; i < 5; i++) {
|
|
607
|
-
const candidate =
|
|
768
|
+
const candidate = join7(dir, "package.json");
|
|
608
769
|
try {
|
|
609
|
-
const pkg = JSON.parse(
|
|
770
|
+
const pkg = JSON.parse(readFileSync5(candidate, "utf-8"));
|
|
610
771
|
if (HIVEMIND_PKG_NAMES.has(pkg.name) && pkg.version)
|
|
611
772
|
return pkg.version;
|
|
612
773
|
} catch {
|
|
613
774
|
}
|
|
614
|
-
const parent =
|
|
775
|
+
const parent = dirname3(dir);
|
|
615
776
|
if (parent === dir)
|
|
616
777
|
break;
|
|
617
778
|
dir = parent;
|
|
@@ -620,12 +781,12 @@ function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
|
620
781
|
}
|
|
621
782
|
|
|
622
783
|
// dist/src/hooks/shared/autoupdate.js
|
|
623
|
-
import { spawn } from "node:child_process";
|
|
624
|
-
import { existsSync as
|
|
625
|
-
import { join as
|
|
784
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
785
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
786
|
+
import { join as join8 } from "node:path";
|
|
626
787
|
var log3 = (msg) => log("autoupdate", msg);
|
|
627
788
|
var defaultSpawn = (cmd, args) => {
|
|
628
|
-
const child =
|
|
789
|
+
const child = spawn2(cmd, args, {
|
|
629
790
|
detached: true,
|
|
630
791
|
stdio: "ignore"
|
|
631
792
|
});
|
|
@@ -638,8 +799,8 @@ function findHivemindOnPath() {
|
|
|
638
799
|
const PATH = process.env.PATH ?? "";
|
|
639
800
|
const dirs = PATH.split(":").filter(Boolean);
|
|
640
801
|
for (const dir of dirs) {
|
|
641
|
-
const candidate =
|
|
642
|
-
if (
|
|
802
|
+
const candidate = join8(dir, "hivemind");
|
|
803
|
+
if (existsSync5(candidate))
|
|
643
804
|
return candidate;
|
|
644
805
|
}
|
|
645
806
|
return null;
|
|
@@ -673,14 +834,14 @@ async function autoUpdate(creds, opts) {
|
|
|
673
834
|
}
|
|
674
835
|
|
|
675
836
|
// dist/src/skillify/pull.js
|
|
676
|
-
import { existsSync as
|
|
677
|
-
import { homedir as
|
|
678
|
-
import { dirname as
|
|
837
|
+
import { existsSync as existsSync10, readFileSync as readFileSync8, writeFileSync as writeFileSync6, mkdirSync as mkdirSync7, renameSync as renameSync3, lstatSync as lstatSync2, readlinkSync, symlinkSync, unlinkSync as unlinkSync4 } from "node:fs";
|
|
838
|
+
import { homedir as homedir10 } from "node:os";
|
|
839
|
+
import { dirname as dirname5, join as join13 } from "node:path";
|
|
679
840
|
|
|
680
841
|
// dist/src/skillify/skill-writer.js
|
|
681
|
-
import { existsSync as
|
|
682
|
-
import { homedir as
|
|
683
|
-
import { join as
|
|
842
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync6, readdirSync as readdirSync2, statSync as statSync2, writeFileSync as writeFileSync4 } from "node:fs";
|
|
843
|
+
import { homedir as homedir6 } from "node:os";
|
|
844
|
+
import { join as join9 } from "node:path";
|
|
684
845
|
function assertValidSkillName(name) {
|
|
685
846
|
if (typeof name !== "string" || name.length === 0) {
|
|
686
847
|
throw new Error(`invalid skill name: empty or non-string`);
|
|
@@ -746,26 +907,26 @@ function parseFrontmatter(text) {
|
|
|
746
907
|
}
|
|
747
908
|
|
|
748
909
|
// dist/src/skillify/manifest.js
|
|
749
|
-
import { existsSync as
|
|
750
|
-
import { homedir as
|
|
751
|
-
import { dirname as
|
|
910
|
+
import { existsSync as existsSync8, lstatSync, mkdirSync as mkdirSync6, readFileSync as readFileSync7, renameSync as renameSync2, unlinkSync as unlinkSync3, writeFileSync as writeFileSync5 } from "node:fs";
|
|
911
|
+
import { homedir as homedir8 } from "node:os";
|
|
912
|
+
import { dirname as dirname4, join as join11 } from "node:path";
|
|
752
913
|
|
|
753
914
|
// dist/src/skillify/legacy-migration.js
|
|
754
|
-
import { existsSync as
|
|
755
|
-
import { homedir as
|
|
756
|
-
import { join as
|
|
915
|
+
import { existsSync as existsSync7, renameSync } from "node:fs";
|
|
916
|
+
import { homedir as homedir7 } from "node:os";
|
|
917
|
+
import { join as join10 } from "node:path";
|
|
757
918
|
var dlog = (msg) => log("skillify-migrate", msg);
|
|
758
919
|
var attempted = false;
|
|
759
920
|
function migrateLegacyStateDir() {
|
|
760
921
|
if (attempted)
|
|
761
922
|
return;
|
|
762
923
|
attempted = true;
|
|
763
|
-
const root =
|
|
764
|
-
const legacy =
|
|
765
|
-
const current =
|
|
766
|
-
if (!
|
|
924
|
+
const root = join10(homedir7(), ".deeplake", "state");
|
|
925
|
+
const legacy = join10(root, "skilify");
|
|
926
|
+
const current = join10(root, "skillify");
|
|
927
|
+
if (!existsSync7(legacy))
|
|
767
928
|
return;
|
|
768
|
-
if (
|
|
929
|
+
if (existsSync7(current))
|
|
769
930
|
return;
|
|
770
931
|
try {
|
|
771
932
|
renameSync(legacy, current);
|
|
@@ -785,15 +946,15 @@ function emptyManifest() {
|
|
|
785
946
|
return { version: 1, entries: [] };
|
|
786
947
|
}
|
|
787
948
|
function manifestPath() {
|
|
788
|
-
return
|
|
949
|
+
return join11(homedir8(), ".deeplake", "state", "skillify", "pulled.json");
|
|
789
950
|
}
|
|
790
951
|
function loadManifest(path = manifestPath()) {
|
|
791
952
|
migrateLegacyStateDir();
|
|
792
|
-
if (!
|
|
953
|
+
if (!existsSync8(path))
|
|
793
954
|
return emptyManifest();
|
|
794
955
|
let raw;
|
|
795
956
|
try {
|
|
796
|
-
raw =
|
|
957
|
+
raw = readFileSync7(path, "utf-8");
|
|
797
958
|
} catch {
|
|
798
959
|
return emptyManifest();
|
|
799
960
|
}
|
|
@@ -840,9 +1001,9 @@ function loadManifest(path = manifestPath()) {
|
|
|
840
1001
|
}
|
|
841
1002
|
function saveManifest(m, path = manifestPath()) {
|
|
842
1003
|
migrateLegacyStateDir();
|
|
843
|
-
|
|
1004
|
+
mkdirSync6(dirname4(path), { recursive: true });
|
|
844
1005
|
const tmp = `${path}.tmp`;
|
|
845
|
-
|
|
1006
|
+
writeFileSync5(tmp, JSON.stringify(m, null, 2) + "\n", { mode: 384 });
|
|
846
1007
|
renameSync2(tmp, path);
|
|
847
1008
|
}
|
|
848
1009
|
function recordPull(entry, path = manifestPath()) {
|
|
@@ -868,7 +1029,7 @@ function unlinkSymlinks(paths) {
|
|
|
868
1029
|
if (!st.isSymbolicLink())
|
|
869
1030
|
continue;
|
|
870
1031
|
try {
|
|
871
|
-
|
|
1032
|
+
unlinkSync3(path);
|
|
872
1033
|
} catch {
|
|
873
1034
|
}
|
|
874
1035
|
}
|
|
@@ -878,7 +1039,7 @@ function pruneOrphanedEntries(path = manifestPath()) {
|
|
|
878
1039
|
const live = [];
|
|
879
1040
|
let pruned = 0;
|
|
880
1041
|
for (const e of m.entries) {
|
|
881
|
-
if (
|
|
1042
|
+
if (existsSync8(join11(e.installRoot, e.dirName))) {
|
|
882
1043
|
live.push(e);
|
|
883
1044
|
continue;
|
|
884
1045
|
}
|
|
@@ -891,26 +1052,26 @@ function pruneOrphanedEntries(path = manifestPath()) {
|
|
|
891
1052
|
}
|
|
892
1053
|
|
|
893
1054
|
// dist/src/skillify/agent-roots.js
|
|
894
|
-
import { existsSync as
|
|
895
|
-
import { homedir as
|
|
896
|
-
import { join as
|
|
1055
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
1056
|
+
import { homedir as homedir9 } from "node:os";
|
|
1057
|
+
import { join as join12 } from "node:path";
|
|
897
1058
|
function resolveDetected(home) {
|
|
898
1059
|
const out = [];
|
|
899
|
-
const codexInstalled =
|
|
900
|
-
const piInstalled =
|
|
901
|
-
const hermesInstalled =
|
|
1060
|
+
const codexInstalled = existsSync9(join12(home, ".codex"));
|
|
1061
|
+
const piInstalled = existsSync9(join12(home, ".pi", "agent"));
|
|
1062
|
+
const hermesInstalled = existsSync9(join12(home, ".hermes"));
|
|
902
1063
|
if (codexInstalled || piInstalled) {
|
|
903
|
-
out.push(
|
|
1064
|
+
out.push(join12(home, ".agents", "skills"));
|
|
904
1065
|
}
|
|
905
1066
|
if (hermesInstalled) {
|
|
906
|
-
out.push(
|
|
1067
|
+
out.push(join12(home, ".hermes", "skills"));
|
|
907
1068
|
}
|
|
908
1069
|
if (piInstalled) {
|
|
909
|
-
out.push(
|
|
1070
|
+
out.push(join12(home, ".pi", "agent", "skills"));
|
|
910
1071
|
}
|
|
911
1072
|
return out;
|
|
912
1073
|
}
|
|
913
|
-
function detectAgentSkillsRoots(canonicalRoot, home =
|
|
1074
|
+
function detectAgentSkillsRoots(canonicalRoot, home = homedir9()) {
|
|
914
1075
|
return resolveDetected(home).filter((p) => p !== canonicalRoot);
|
|
915
1076
|
}
|
|
916
1077
|
|
|
@@ -954,15 +1115,15 @@ function isMissingTableError(message) {
|
|
|
954
1115
|
}
|
|
955
1116
|
function resolvePullDestination(install, cwd) {
|
|
956
1117
|
if (install === "global")
|
|
957
|
-
return
|
|
1118
|
+
return join13(homedir10(), ".claude", "skills");
|
|
958
1119
|
if (!cwd)
|
|
959
1120
|
throw new Error("install=project requires a cwd");
|
|
960
|
-
return
|
|
1121
|
+
return join13(cwd, ".claude", "skills");
|
|
961
1122
|
}
|
|
962
1123
|
function fanOutSymlinks(canonicalDir, dirName, agentRoots) {
|
|
963
1124
|
const out = [];
|
|
964
1125
|
for (const root of agentRoots) {
|
|
965
|
-
const link =
|
|
1126
|
+
const link = join13(root, dirName);
|
|
966
1127
|
let existing;
|
|
967
1128
|
try {
|
|
968
1129
|
existing = lstatSync2(link);
|
|
@@ -984,13 +1145,13 @@ function fanOutSymlinks(canonicalDir, dirName, agentRoots) {
|
|
|
984
1145
|
continue;
|
|
985
1146
|
}
|
|
986
1147
|
try {
|
|
987
|
-
|
|
1148
|
+
unlinkSync4(link);
|
|
988
1149
|
} catch {
|
|
989
1150
|
continue;
|
|
990
1151
|
}
|
|
991
1152
|
}
|
|
992
1153
|
try {
|
|
993
|
-
|
|
1154
|
+
mkdirSync7(dirname5(link), { recursive: true });
|
|
994
1155
|
symlinkSync(canonicalDir, link, "dir");
|
|
995
1156
|
out.push(link);
|
|
996
1157
|
} catch {
|
|
@@ -1005,8 +1166,8 @@ function backfillSymlinks(installRoot) {
|
|
|
1005
1166
|
return;
|
|
1006
1167
|
const detected = detectAgentSkillsRoots(installRoot);
|
|
1007
1168
|
for (const entry of entries) {
|
|
1008
|
-
const canonical =
|
|
1009
|
-
if (!
|
|
1169
|
+
const canonical = join13(entry.installRoot, entry.dirName);
|
|
1170
|
+
if (!existsSync10(canonical))
|
|
1010
1171
|
continue;
|
|
1011
1172
|
const fresh = fanOutSymlinks(canonical, entry.dirName, detected);
|
|
1012
1173
|
if (sameSorted(fresh, entry.symlinks))
|
|
@@ -1116,10 +1277,10 @@ function renderFrontmatter(fm) {
|
|
|
1116
1277
|
return lines.join("\n");
|
|
1117
1278
|
}
|
|
1118
1279
|
function readLocalVersion(path) {
|
|
1119
|
-
if (!
|
|
1280
|
+
if (!existsSync10(path))
|
|
1120
1281
|
return null;
|
|
1121
1282
|
try {
|
|
1122
|
-
const text =
|
|
1283
|
+
const text = readFileSync8(path, "utf-8");
|
|
1123
1284
|
const parsed = parseFrontmatter(text);
|
|
1124
1285
|
if (!parsed)
|
|
1125
1286
|
return null;
|
|
@@ -1214,8 +1375,8 @@ async function runPull(opts) {
|
|
|
1214
1375
|
summary.skipped++;
|
|
1215
1376
|
continue;
|
|
1216
1377
|
}
|
|
1217
|
-
const skillDir =
|
|
1218
|
-
const skillFile =
|
|
1378
|
+
const skillDir = join13(root, dirName);
|
|
1379
|
+
const skillFile = join13(skillDir, "SKILL.md");
|
|
1219
1380
|
const remoteVersion = Number(row.version ?? 1);
|
|
1220
1381
|
const localVersion = readLocalVersion(skillFile);
|
|
1221
1382
|
const action = decideAction({
|
|
@@ -1226,14 +1387,14 @@ async function runPull(opts) {
|
|
|
1226
1387
|
});
|
|
1227
1388
|
let manifestError;
|
|
1228
1389
|
if (action === "wrote") {
|
|
1229
|
-
|
|
1230
|
-
if (
|
|
1390
|
+
mkdirSync7(skillDir, { recursive: true });
|
|
1391
|
+
if (existsSync10(skillFile)) {
|
|
1231
1392
|
try {
|
|
1232
1393
|
renameSync3(skillFile, `${skillFile}.bak`);
|
|
1233
1394
|
} catch {
|
|
1234
1395
|
}
|
|
1235
1396
|
}
|
|
1236
|
-
|
|
1397
|
+
writeFileSync6(skillFile, renderSkillFile(row));
|
|
1237
1398
|
const symlinks = opts.install === "global" ? fanOutSymlinks(skillDir, dirName, detectAgentSkillsRoots(root)) : [];
|
|
1238
1399
|
try {
|
|
1239
1400
|
recordPull({
|
|
@@ -1329,7 +1490,7 @@ async function autoPullSkills(deps = {}) {
|
|
|
1329
1490
|
|
|
1330
1491
|
// dist/src/hooks/hermes/session-start.js
|
|
1331
1492
|
var log5 = (msg) => log("hermes-session-start", msg);
|
|
1332
|
-
var __bundleDir =
|
|
1493
|
+
var __bundleDir = dirname6(fileURLToPath2(import.meta.url));
|
|
1333
1494
|
var context = `DEEPLAKE MEMORY: Persistent memory at ~/.deeplake/memory/ shared across sessions, users, and agents.
|
|
1334
1495
|
|
|
1335
1496
|
Structure: index.md (start here) \u2192 summaries/*.md \u2192 sessions/*.jsonl (last resort). Do NOT jump straight to JSONL.
|
|
@@ -1350,22 +1511,7 @@ Organization management \u2014 each argument is SEPARATE (do NOT quote subcomman
|
|
|
1350
1511
|
- hivemind remove <user-id> \u2014 remove member
|
|
1351
1512
|
|
|
1352
1513
|
SKILLS (skillify) \u2014 mine + share reusable skills across the org:
|
|
1353
|
-
|
|
1354
|
-
- hivemind skillify pull \u2014 sync project skills from the org table
|
|
1355
|
-
- hivemind skillify pull --user <email> \u2014 only that author's skills
|
|
1356
|
-
- hivemind skillify pull --users a,b,c \u2014 multiple authors (CSV)
|
|
1357
|
-
- hivemind skillify pull --all-users \u2014 explicit "no author filter"
|
|
1358
|
-
- hivemind skillify pull --to project|global \u2014 install location
|
|
1359
|
-
- hivemind skillify pull --dry-run \u2014 preview only
|
|
1360
|
-
- hivemind skillify pull --force \u2014 overwrite local (creates .bak)
|
|
1361
|
-
- hivemind skillify pull <skill-name> \u2014 pull only that skill (combines with --user)
|
|
1362
|
-
- hivemind skillify unpull \u2014 remove every skill previously installed by pull
|
|
1363
|
-
- hivemind skillify unpull --user <email> \u2014 remove only that author's pulls
|
|
1364
|
-
- hivemind skillify unpull --not-mine \u2014 remove all pulls except your own
|
|
1365
|
-
- hivemind skillify unpull --dry-run \u2014 preview without touching disk
|
|
1366
|
-
- hivemind skillify scope <me|team> \u2014 sharing scope for new skills
|
|
1367
|
-
- hivemind skillify install <project|global> \u2014 default install location
|
|
1368
|
-
- hivemind skillify team add|remove|list <name> \u2014 manage team list`;
|
|
1514
|
+
${renderSkillifyCommands()}`;
|
|
1369
1515
|
async function createPlaceholder(api, table, sessionId, cwd, userName, orgName, workspaceId, pluginVersion) {
|
|
1370
1516
|
const summaryPath = `/summaries/${userName}/${sessionId}.md`;
|
|
1371
1517
|
const existing = await api.query(`SELECT path FROM "${table}" WHERE path = '${sqlStr(summaryPath)}' LIMIT 1`);
|
|
@@ -1393,6 +1539,9 @@ async function main() {
|
|
|
1393
1539
|
const cwd = input.cwd ?? process.cwd();
|
|
1394
1540
|
const creds = loadCredentials();
|
|
1395
1541
|
const captureEnabled = process.env.HIVEMIND_CAPTURE !== "false";
|
|
1542
|
+
if (!creds?.token) {
|
|
1543
|
+
maybeAutoMineLocal();
|
|
1544
|
+
}
|
|
1396
1545
|
await autoUpdate(creds, { agent: "hermes" });
|
|
1397
1546
|
const current = getInstalledVersion(__bundleDir, ".claude-plugin");
|
|
1398
1547
|
const pluginVersion = current ?? "";
|
|
@@ -1416,9 +1565,12 @@ async function main() {
|
|
|
1416
1565
|
if (current)
|
|
1417
1566
|
versionNotice = `
|
|
1418
1567
|
Hivemind v${current}`;
|
|
1568
|
+
const localMined = countLocalManifestEntries();
|
|
1569
|
+
const localMinedNote = localMined > 0 ? `
|
|
1570
|
+
${localMined} local skill${localMined === 1 ? "" : "s"} from past 'hivemind skillify mine-local' run(s) live in ~/.claude/skills/. Run 'hivemind login' to start sharing new mining results with your team.` : "";
|
|
1419
1571
|
const additional = creds?.token ? `${context}
|
|
1420
1572
|
Logged in to Deeplake as org: ${creds.orgName ?? creds.orgId} (workspace: ${creds.workspaceId ?? "default"})${versionNotice}` : `${context}
|
|
1421
|
-
Not logged in to Deeplake. Run: hivemind login${versionNotice}`;
|
|
1573
|
+
Not logged in to Deeplake. Run: hivemind login${localMinedNote}${versionNotice}`;
|
|
1422
1574
|
console.log(JSON.stringify({ context: additional }));
|
|
1423
1575
|
}
|
|
1424
1576
|
main().catch((e) => {
|
|
@@ -66803,10 +66803,12 @@ import { randomUUID } from "node:crypto";
|
|
|
66803
66803
|
import { appendFileSync } from "node:fs";
|
|
66804
66804
|
import { join as join5 } from "node:path";
|
|
66805
66805
|
import { homedir as homedir2 } from "node:os";
|
|
66806
|
-
var DEBUG = process.env.HIVEMIND_DEBUG === "1";
|
|
66807
66806
|
var LOG = join5(homedir2(), ".deeplake", "hook-debug.log");
|
|
66807
|
+
function isDebug() {
|
|
66808
|
+
return process.env.HIVEMIND_DEBUG === "1";
|
|
66809
|
+
}
|
|
66808
66810
|
function log(tag, msg) {
|
|
66809
|
-
if (!
|
|
66811
|
+
if (!isDebug())
|
|
66810
66812
|
return;
|
|
66811
66813
|
appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
|
|
66812
66814
|
`);
|
|
@@ -66864,7 +66866,9 @@ var RETRYABLE_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
|
|
|
66864
66866
|
var MAX_RETRIES = 3;
|
|
66865
66867
|
var BASE_DELAY_MS = 500;
|
|
66866
66868
|
var MAX_CONCURRENCY = 5;
|
|
66867
|
-
|
|
66869
|
+
function getQueryTimeoutMs() {
|
|
66870
|
+
return Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
|
|
66871
|
+
}
|
|
66868
66872
|
function sleep(ms3) {
|
|
66869
66873
|
return new Promise((resolve5) => setTimeout(resolve5, ms3));
|
|
66870
66874
|
}
|
|
@@ -66945,8 +66949,9 @@ var DeeplakeApi = class {
|
|
|
66945
66949
|
let lastError;
|
|
66946
66950
|
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
66947
66951
|
let resp;
|
|
66952
|
+
const timeoutMs = getQueryTimeoutMs();
|
|
66948
66953
|
try {
|
|
66949
|
-
const signal = AbortSignal.timeout(
|
|
66954
|
+
const signal = AbortSignal.timeout(timeoutMs);
|
|
66950
66955
|
resp = await fetch(`${this.apiUrl}/workspaces/${this.workspaceId}/tables/query`, {
|
|
66951
66956
|
method: "POST",
|
|
66952
66957
|
headers: {
|
|
@@ -66960,7 +66965,7 @@ var DeeplakeApi = class {
|
|
|
66960
66965
|
});
|
|
66961
66966
|
} catch (e6) {
|
|
66962
66967
|
if (isTimeoutError(e6)) {
|
|
66963
|
-
lastError = new Error(`Query timeout after ${
|
|
66968
|
+
lastError = new Error(`Query timeout after ${timeoutMs}ms`);
|
|
66964
66969
|
throw lastError;
|
|
66965
66970
|
}
|
|
66966
66971
|
lastError = e6 instanceof Error ? e6 : new Error(String(e6));
|