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