@deeplake/hivemind 0.7.44 → 0.7.46
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 +3 -3
- package/.claude-plugin/plugin.json +1 -1
- package/bundle/cli.js +3116 -208
- package/codex/bundle/capture.js +43 -0
- package/codex/bundle/commands/auth-login.js +43 -0
- package/codex/bundle/graph-pull-worker.js +1185 -0
- package/codex/bundle/pre-tool-use.js +43 -0
- package/codex/bundle/session-start-setup.js +43 -0
- package/codex/bundle/session-start.js +70 -4
- package/codex/bundle/shell/deeplake-shell.js +577 -25
- package/codex/bundle/skillify-worker.js +30 -3
- package/codex/bundle/stop.js +97 -50
- package/cursor/bundle/capture.js +97 -50
- package/cursor/bundle/commands/auth-login.js +43 -0
- package/cursor/bundle/graph-pull-worker.js +1185 -0
- package/cursor/bundle/pre-tool-use.js +43 -0
- package/cursor/bundle/session-end.js +49 -44
- package/cursor/bundle/session-start.js +66 -0
- package/cursor/bundle/shell/deeplake-shell.js +577 -25
- package/cursor/bundle/skillify-worker.js +30 -3
- package/hermes/bundle/capture.js +97 -50
- package/hermes/bundle/commands/auth-login.js +43 -0
- package/hermes/bundle/graph-pull-worker.js +1185 -0
- package/hermes/bundle/pre-tool-use.js +43 -0
- package/hermes/bundle/session-end.js +49 -44
- package/hermes/bundle/session-start.js +66 -0
- package/hermes/bundle/shell/deeplake-shell.js +577 -25
- package/hermes/bundle/skillify-worker.js +30 -3
- package/mcp/bundle/server.js +43 -0
- package/openclaw/dist/chunks/{config-XEK4MJJS.js → config-O5PDJQ7Y.js} +1 -0
- package/openclaw/dist/index.js +47 -2
- package/openclaw/dist/skillify-worker.js +30 -3
- package/openclaw/openclaw.plugin.json +1 -1
- package/openclaw/package.json +1 -1
- package/package.json +3 -1
|
@@ -97,6 +97,7 @@ function loadConfig() {
|
|
|
97
97
|
tableName: process.env.HIVEMIND_TABLE ?? "memory",
|
|
98
98
|
sessionsTableName: process.env.HIVEMIND_SESSIONS_TABLE ?? "sessions",
|
|
99
99
|
skillsTableName: process.env.HIVEMIND_SKILLS_TABLE ?? "skills",
|
|
100
|
+
codebaseTableName: process.env.HIVEMIND_CODEBASE_TABLE ?? "codebase",
|
|
100
101
|
memoryPath: process.env.HIVEMIND_MEMORY_PATH ?? join(home, ".deeplake", "memory")
|
|
101
102
|
};
|
|
102
103
|
}
|
|
@@ -214,9 +215,33 @@ function validateSchema(label, cols) {
|
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
217
|
}
|
|
218
|
+
var CODEBASE_COLUMNS = Object.freeze([
|
|
219
|
+
// Identity key (matches the PK below)
|
|
220
|
+
{ name: "org_id", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
221
|
+
{ name: "workspace_id", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
222
|
+
{ name: "repo_slug", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
223
|
+
{ name: "user_id", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
224
|
+
{ name: "worktree_id", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
225
|
+
{ name: "commit_sha", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
226
|
+
// Observation metadata
|
|
227
|
+
{ name: "parent_sha", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
228
|
+
{ name: "branch", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
229
|
+
{ name: "ts", sql: "TIMESTAMP" },
|
|
230
|
+
{ name: "pushed_by", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
231
|
+
// Snapshot payload
|
|
232
|
+
{ name: "snapshot_sha256", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
233
|
+
{ name: "snapshot_jsonb", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
234
|
+
{ name: "node_count", sql: "BIGINT NOT NULL DEFAULT 0" },
|
|
235
|
+
{ name: "edge_count", sql: "BIGINT NOT NULL DEFAULT 0" },
|
|
236
|
+
// Generator metadata (for drift diagnostics — what hivemind version produced this?)
|
|
237
|
+
{ name: "generator", sql: "TEXT NOT NULL DEFAULT 'hivemind-graph'" },
|
|
238
|
+
{ name: "generator_version", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
239
|
+
{ name: "schema_version", sql: "BIGINT NOT NULL DEFAULT 1" }
|
|
240
|
+
]);
|
|
217
241
|
validateSchema("MEMORY_COLUMNS", MEMORY_COLUMNS);
|
|
218
242
|
validateSchema("SESSIONS_COLUMNS", SESSIONS_COLUMNS);
|
|
219
243
|
validateSchema("SKILLS_COLUMNS", SKILLS_COLUMNS);
|
|
244
|
+
validateSchema("CODEBASE_COLUMNS", CODEBASE_COLUMNS);
|
|
220
245
|
function buildCreateTableSql(tableName, cols) {
|
|
221
246
|
const safe = sqlIdent(tableName);
|
|
222
247
|
const colSql = cols.map((c) => `${c.name} ${c.sql}`).join(", ");
|
|
@@ -781,6 +806,24 @@ var DeeplakeApi = class {
|
|
|
781
806
|
* This sidesteps the Deeplake UPDATE-coalescing quirk that bit the wiki
|
|
782
807
|
* worker.
|
|
783
808
|
*/
|
|
809
|
+
/**
|
|
810
|
+
* Create the codebase table. One row per (org, workspace, repo, user,
|
|
811
|
+
* worktree, commit) — see CODEBASE_COLUMNS for the schema. Healing
|
|
812
|
+
* + index follow the same pattern as ensureSessionsTable.
|
|
813
|
+
*/
|
|
814
|
+
async ensureCodebaseTable(name) {
|
|
815
|
+
const safe = sqlIdent(name);
|
|
816
|
+
const tables = await this.listTables();
|
|
817
|
+
if (!tables.includes(safe)) {
|
|
818
|
+
log3(`table "${safe}" not found, creating`);
|
|
819
|
+
await this.createTableWithRetry(buildCreateTableSql(safe, CODEBASE_COLUMNS), safe);
|
|
820
|
+
log3(`table "${safe}" created`);
|
|
821
|
+
if (!tables.includes(safe))
|
|
822
|
+
this._tablesCache = [...tables, safe];
|
|
823
|
+
}
|
|
824
|
+
await this.healSchema(safe, CODEBASE_COLUMNS);
|
|
825
|
+
await this.ensureLookupIndex(safe, "codebase_identity", `("org_id", "workspace_id", "repo_slug", "user_id", "worktree_id", "commit_sha")`);
|
|
826
|
+
}
|
|
784
827
|
async ensureSkillsTable(name) {
|
|
785
828
|
const safe = sqlIdent(name);
|
|
786
829
|
const tables = await this.listTables();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// dist/src/utils/stdin.js
|
|
2
2
|
function readStdin() {
|
|
3
|
-
return new Promise((
|
|
3
|
+
return new Promise((resolve2, reject) => {
|
|
4
4
|
let data = "";
|
|
5
5
|
process.stdin.setEncoding("utf-8");
|
|
6
6
|
process.stdin.on("data", (chunk) => data += chunk);
|
|
7
7
|
process.stdin.on("end", () => {
|
|
8
8
|
try {
|
|
9
|
-
|
|
9
|
+
resolve2(JSON.parse(data));
|
|
10
10
|
} catch (err) {
|
|
11
11
|
reject(new Error(`Failed to parse hook input: ${err}`));
|
|
12
12
|
}
|
|
@@ -62,6 +62,7 @@ function loadConfig() {
|
|
|
62
62
|
tableName: process.env.HIVEMIND_TABLE ?? "memory",
|
|
63
63
|
sessionsTableName: process.env.HIVEMIND_SESSIONS_TABLE ?? "sessions",
|
|
64
64
|
skillsTableName: process.env.HIVEMIND_SKILLS_TABLE ?? "skills",
|
|
65
|
+
codebaseTableName: process.env.HIVEMIND_CODEBASE_TABLE ?? "codebase",
|
|
65
66
|
memoryPath: process.env.HIVEMIND_MEMORY_PATH ?? join2(home, ".deeplake", "memory")
|
|
66
67
|
};
|
|
67
68
|
}
|
|
@@ -406,9 +407,54 @@ function spawnSkillifyWorker(opts) {
|
|
|
406
407
|
|
|
407
408
|
// dist/src/skillify/state.js
|
|
408
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
|
+
import { join as join11 } from "node:path";
|
|
411
|
+
|
|
412
|
+
// dist/src/utils/repo-identity.js
|
|
409
413
|
import { execSync as execSync2 } from "node:child_process";
|
|
410
414
|
import { createHash } from "node:crypto";
|
|
411
|
-
import {
|
|
415
|
+
import { basename, resolve } from "node:path";
|
|
416
|
+
var DEFAULT_PORTS = {
|
|
417
|
+
http: "80",
|
|
418
|
+
https: "443",
|
|
419
|
+
ssh: "22",
|
|
420
|
+
git: "9418"
|
|
421
|
+
};
|
|
422
|
+
function normalizeGitRemoteUrl(url) {
|
|
423
|
+
let s = url.trim();
|
|
424
|
+
const schemeMatch = s.match(/^([a-z][a-z0-9+.-]*):\/\//i);
|
|
425
|
+
const scheme = schemeMatch ? schemeMatch[1].toLowerCase() : null;
|
|
426
|
+
if (schemeMatch)
|
|
427
|
+
s = s.slice(schemeMatch[0].length);
|
|
428
|
+
if (!scheme) {
|
|
429
|
+
const scp = s.match(/^(?:[^@/\s]+@)?([^:/\s]+):(.+)$/);
|
|
430
|
+
if (scp)
|
|
431
|
+
s = `${scp[1]}/${scp[2]}`;
|
|
432
|
+
}
|
|
433
|
+
s = s.replace(/^[^@/]+@/, "");
|
|
434
|
+
if (scheme && DEFAULT_PORTS[scheme]) {
|
|
435
|
+
s = s.replace(new RegExp(`^([^/]+):${DEFAULT_PORTS[scheme]}(/|$)`), "$1$2");
|
|
436
|
+
}
|
|
437
|
+
s = s.replace(/\.git\/?$/i, "");
|
|
438
|
+
s = s.replace(/\/+$/, "");
|
|
439
|
+
return s.toLowerCase();
|
|
440
|
+
}
|
|
441
|
+
function deriveProjectKey(cwd) {
|
|
442
|
+
const absCwd = resolve(cwd);
|
|
443
|
+
const project = basename(absCwd) || "unknown";
|
|
444
|
+
let signature = null;
|
|
445
|
+
try {
|
|
446
|
+
const raw = execSync2("git config --get remote.origin.url", {
|
|
447
|
+
cwd: absCwd,
|
|
448
|
+
encoding: "utf-8",
|
|
449
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
450
|
+
}).trim();
|
|
451
|
+
signature = raw ? normalizeGitRemoteUrl(raw) : null;
|
|
452
|
+
} catch {
|
|
453
|
+
}
|
|
454
|
+
const input = signature ?? absCwd;
|
|
455
|
+
const key = createHash("sha1").update(input).digest("hex").slice(0, 16);
|
|
456
|
+
return { key, project };
|
|
457
|
+
}
|
|
412
458
|
|
|
413
459
|
// dist/src/skillify/legacy-migration.js
|
|
414
460
|
import { existsSync as existsSync4, renameSync as renameSync2 } from "node:fs";
|
|
@@ -463,47 +509,6 @@ function statePath(projectKey) {
|
|
|
463
509
|
function lockPath2(projectKey) {
|
|
464
510
|
return join11(getStateDir(), `${projectKey}.lock`);
|
|
465
511
|
}
|
|
466
|
-
var DEFAULT_PORTS = {
|
|
467
|
-
http: "80",
|
|
468
|
-
https: "443",
|
|
469
|
-
ssh: "22",
|
|
470
|
-
git: "9418"
|
|
471
|
-
};
|
|
472
|
-
function normalizeGitRemoteUrl(url) {
|
|
473
|
-
let s = url.trim();
|
|
474
|
-
const schemeMatch = s.match(/^([a-z][a-z0-9+.-]*):\/\//i);
|
|
475
|
-
const scheme = schemeMatch ? schemeMatch[1].toLowerCase() : null;
|
|
476
|
-
if (schemeMatch)
|
|
477
|
-
s = s.slice(schemeMatch[0].length);
|
|
478
|
-
if (!scheme) {
|
|
479
|
-
const scp = s.match(/^(?:[^@/\s]+@)?([^:/\s]+):(.+)$/);
|
|
480
|
-
if (scp)
|
|
481
|
-
s = `${scp[1]}/${scp[2]}`;
|
|
482
|
-
}
|
|
483
|
-
s = s.replace(/^[^@/]+@/, "");
|
|
484
|
-
if (scheme && DEFAULT_PORTS[scheme]) {
|
|
485
|
-
s = s.replace(new RegExp(`^([^/]+):${DEFAULT_PORTS[scheme]}(/|$)`), "$1$2");
|
|
486
|
-
}
|
|
487
|
-
s = s.replace(/\.git\/?$/i, "");
|
|
488
|
-
s = s.replace(/\/+$/, "");
|
|
489
|
-
return s.toLowerCase();
|
|
490
|
-
}
|
|
491
|
-
function deriveProjectKey(cwd) {
|
|
492
|
-
const project = basename(cwd) || "unknown";
|
|
493
|
-
let signature = null;
|
|
494
|
-
try {
|
|
495
|
-
const raw = execSync2("git config --get remote.origin.url", {
|
|
496
|
-
cwd,
|
|
497
|
-
encoding: "utf-8",
|
|
498
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
499
|
-
}).trim();
|
|
500
|
-
signature = raw ? normalizeGitRemoteUrl(raw) : null;
|
|
501
|
-
} catch {
|
|
502
|
-
}
|
|
503
|
-
const input = signature ?? cwd;
|
|
504
|
-
const key = createHash("sha1").update(input).digest("hex").slice(0, 16);
|
|
505
|
-
return { key, project };
|
|
506
|
-
}
|
|
507
512
|
function readState(projectKey) {
|
|
508
513
|
migrateLegacyStateDir();
|
|
509
514
|
const p = statePath(projectKey);
|
|
@@ -120,6 +120,7 @@ function loadConfig() {
|
|
|
120
120
|
tableName: process.env.HIVEMIND_TABLE ?? "memory",
|
|
121
121
|
sessionsTableName: process.env.HIVEMIND_SESSIONS_TABLE ?? "sessions",
|
|
122
122
|
skillsTableName: process.env.HIVEMIND_SKILLS_TABLE ?? "skills",
|
|
123
|
+
codebaseTableName: process.env.HIVEMIND_CODEBASE_TABLE ?? "codebase",
|
|
123
124
|
memoryPath: process.env.HIVEMIND_MEMORY_PATH ?? join3(home, ".deeplake", "memory")
|
|
124
125
|
};
|
|
125
126
|
}
|
|
@@ -225,9 +226,33 @@ function validateSchema(label, cols) {
|
|
|
225
226
|
}
|
|
226
227
|
}
|
|
227
228
|
}
|
|
229
|
+
var CODEBASE_COLUMNS = Object.freeze([
|
|
230
|
+
// Identity key (matches the PK below)
|
|
231
|
+
{ name: "org_id", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
232
|
+
{ name: "workspace_id", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
233
|
+
{ name: "repo_slug", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
234
|
+
{ name: "user_id", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
235
|
+
{ name: "worktree_id", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
236
|
+
{ name: "commit_sha", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
237
|
+
// Observation metadata
|
|
238
|
+
{ name: "parent_sha", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
239
|
+
{ name: "branch", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
240
|
+
{ name: "ts", sql: "TIMESTAMP" },
|
|
241
|
+
{ name: "pushed_by", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
242
|
+
// Snapshot payload
|
|
243
|
+
{ name: "snapshot_sha256", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
244
|
+
{ name: "snapshot_jsonb", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
245
|
+
{ name: "node_count", sql: "BIGINT NOT NULL DEFAULT 0" },
|
|
246
|
+
{ name: "edge_count", sql: "BIGINT NOT NULL DEFAULT 0" },
|
|
247
|
+
// Generator metadata (for drift diagnostics — what hivemind version produced this?)
|
|
248
|
+
{ name: "generator", sql: "TEXT NOT NULL DEFAULT 'hivemind-graph'" },
|
|
249
|
+
{ name: "generator_version", sql: "TEXT NOT NULL DEFAULT ''" },
|
|
250
|
+
{ name: "schema_version", sql: "BIGINT NOT NULL DEFAULT 1" }
|
|
251
|
+
]);
|
|
228
252
|
validateSchema("MEMORY_COLUMNS", MEMORY_COLUMNS);
|
|
229
253
|
validateSchema("SESSIONS_COLUMNS", SESSIONS_COLUMNS);
|
|
230
254
|
validateSchema("SKILLS_COLUMNS", SKILLS_COLUMNS);
|
|
255
|
+
validateSchema("CODEBASE_COLUMNS", CODEBASE_COLUMNS);
|
|
231
256
|
function buildCreateTableSql(tableName, cols) {
|
|
232
257
|
const safe = sqlIdent(tableName);
|
|
233
258
|
const colSql = cols.map((c) => `${c.name} ${c.sql}`).join(", ");
|
|
@@ -774,6 +799,24 @@ var DeeplakeApi = class {
|
|
|
774
799
|
* This sidesteps the Deeplake UPDATE-coalescing quirk that bit the wiki
|
|
775
800
|
* worker.
|
|
776
801
|
*/
|
|
802
|
+
/**
|
|
803
|
+
* Create the codebase table. One row per (org, workspace, repo, user,
|
|
804
|
+
* worktree, commit) — see CODEBASE_COLUMNS for the schema. Healing
|
|
805
|
+
* + index follow the same pattern as ensureSessionsTable.
|
|
806
|
+
*/
|
|
807
|
+
async ensureCodebaseTable(name) {
|
|
808
|
+
const safe = sqlIdent(name);
|
|
809
|
+
const tables = await this.listTables();
|
|
810
|
+
if (!tables.includes(safe)) {
|
|
811
|
+
log3(`table "${safe}" not found, creating`);
|
|
812
|
+
await this.createTableWithRetry(buildCreateTableSql(safe, CODEBASE_COLUMNS), safe);
|
|
813
|
+
log3(`table "${safe}" created`);
|
|
814
|
+
if (!tables.includes(safe))
|
|
815
|
+
this._tablesCache = [...tables, safe];
|
|
816
|
+
}
|
|
817
|
+
await this.healSchema(safe, CODEBASE_COLUMNS);
|
|
818
|
+
await this.ensureLookupIndex(safe, "codebase_identity", `("org_id", "workspace_id", "repo_slug", "user_id", "worktree_id", "commit_sha")`);
|
|
819
|
+
}
|
|
777
820
|
async ensureSkillsTable(name) {
|
|
778
821
|
const safe = sqlIdent(name);
|
|
779
822
|
const tables = await this.listTables();
|
|
@@ -1722,6 +1765,27 @@ async function autoPullSkills(deps = {}) {
|
|
|
1722
1765
|
}
|
|
1723
1766
|
}
|
|
1724
1767
|
|
|
1768
|
+
// dist/src/graph/spawn-pull-worker.js
|
|
1769
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
1770
|
+
import { join as join17 } from "node:path";
|
|
1771
|
+
function spawnGraphPullWorker(cwd, bundleDir, deps = {}) {
|
|
1772
|
+
if (process.env.HIVEMIND_GRAPH_PULL === "0")
|
|
1773
|
+
return;
|
|
1774
|
+
const workerPath = join17(bundleDir, "graph-pull-worker.js");
|
|
1775
|
+
const opts = {
|
|
1776
|
+
detached: true,
|
|
1777
|
+
stdio: ["ignore", "ignore", "ignore"]
|
|
1778
|
+
};
|
|
1779
|
+
try {
|
|
1780
|
+
const sp = deps.spawn ?? spawn3;
|
|
1781
|
+
const child = sp("nohup", ["node", workerPath, "--cwd", cwd], opts);
|
|
1782
|
+
child.on("error", () => {
|
|
1783
|
+
});
|
|
1784
|
+
child.unref();
|
|
1785
|
+
} catch {
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1725
1789
|
// dist/src/hooks/hermes/session-start.js
|
|
1726
1790
|
var log6 = (msg) => log("hermes-session-start", msg);
|
|
1727
1791
|
var __bundleDir = dirname7(fileURLToPath2(import.meta.url));
|
|
@@ -1809,6 +1873,8 @@ Hivemind v${current}`;
|
|
|
1809
1873
|
const localMined = countLocalManifestEntries();
|
|
1810
1874
|
const localMinedNote = localMined > 0 ? `
|
|
1811
1875
|
${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.` : "";
|
|
1876
|
+
if (creds?.token)
|
|
1877
|
+
spawnGraphPullWorker(cwd, __bundleDir);
|
|
1812
1878
|
const additional = creds?.token ? `${context}
|
|
1813
1879
|
Logged in to Deeplake as org: ${creds.orgName ?? creds.orgId} (workspace: ${creds.workspaceId ?? "default"})${versionNotice}` : `${context}
|
|
1814
1880
|
Not logged in to Deeplake. Run: hivemind login${localMinedNote}${versionNotice}`;
|