@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.
Files changed (35) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/bundle/cli.js +2215 -341
  4. package/codex/bundle/capture.js +43 -0
  5. package/codex/bundle/commands/auth-login.js +43 -0
  6. package/codex/bundle/graph-pull-worker.js +1185 -0
  7. package/codex/bundle/pre-tool-use.js +43 -0
  8. package/codex/bundle/session-start-setup.js +43 -0
  9. package/codex/bundle/session-start.js +70 -4
  10. package/codex/bundle/shell/deeplake-shell.js +577 -25
  11. package/codex/bundle/skillify-worker.js +30 -3
  12. package/codex/bundle/stop.js +97 -50
  13. package/cursor/bundle/capture.js +97 -50
  14. package/cursor/bundle/commands/auth-login.js +43 -0
  15. package/cursor/bundle/graph-pull-worker.js +1185 -0
  16. package/cursor/bundle/pre-tool-use.js +43 -0
  17. package/cursor/bundle/session-end.js +49 -44
  18. package/cursor/bundle/session-start.js +66 -0
  19. package/cursor/bundle/shell/deeplake-shell.js +577 -25
  20. package/cursor/bundle/skillify-worker.js +30 -3
  21. package/hermes/bundle/capture.js +97 -50
  22. package/hermes/bundle/commands/auth-login.js +43 -0
  23. package/hermes/bundle/graph-pull-worker.js +1185 -0
  24. package/hermes/bundle/pre-tool-use.js +43 -0
  25. package/hermes/bundle/session-end.js +49 -44
  26. package/hermes/bundle/session-start.js +66 -0
  27. package/hermes/bundle/shell/deeplake-shell.js +577 -25
  28. package/hermes/bundle/skillify-worker.js +30 -3
  29. package/mcp/bundle/server.js +43 -0
  30. package/openclaw/dist/chunks/{config-XEK4MJJS.js → config-O5PDJQ7Y.js} +1 -0
  31. package/openclaw/dist/index.js +47 -2
  32. package/openclaw/dist/skillify-worker.js +30 -3
  33. package/openclaw/openclaw.plugin.json +1 -1
  34. package/openclaw/package.json +1 -1
  35. package/package.json +3 -1
@@ -104,6 +104,7 @@ function loadConfig() {
104
104
  tableName: process.env.HIVEMIND_TABLE ?? "memory",
105
105
  sessionsTableName: process.env.HIVEMIND_SESSIONS_TABLE ?? "sessions",
106
106
  skillsTableName: process.env.HIVEMIND_SKILLS_TABLE ?? "skills",
107
+ codebaseTableName: process.env.HIVEMIND_CODEBASE_TABLE ?? "codebase",
107
108
  memoryPath: process.env.HIVEMIND_MEMORY_PATH ?? join(home, ".deeplake", "memory")
108
109
  };
109
110
  }
@@ -221,9 +222,33 @@ function validateSchema(label, cols) {
221
222
  }
222
223
  }
223
224
  }
225
+ var CODEBASE_COLUMNS = Object.freeze([
226
+ // Identity key (matches the PK below)
227
+ { name: "org_id", sql: "TEXT NOT NULL DEFAULT ''" },
228
+ { name: "workspace_id", sql: "TEXT NOT NULL DEFAULT ''" },
229
+ { name: "repo_slug", sql: "TEXT NOT NULL DEFAULT ''" },
230
+ { name: "user_id", sql: "TEXT NOT NULL DEFAULT ''" },
231
+ { name: "worktree_id", sql: "TEXT NOT NULL DEFAULT ''" },
232
+ { name: "commit_sha", sql: "TEXT NOT NULL DEFAULT ''" },
233
+ // Observation metadata
234
+ { name: "parent_sha", sql: "TEXT NOT NULL DEFAULT ''" },
235
+ { name: "branch", sql: "TEXT NOT NULL DEFAULT ''" },
236
+ { name: "ts", sql: "TIMESTAMP" },
237
+ { name: "pushed_by", sql: "TEXT NOT NULL DEFAULT ''" },
238
+ // Snapshot payload
239
+ { name: "snapshot_sha256", sql: "TEXT NOT NULL DEFAULT ''" },
240
+ { name: "snapshot_jsonb", sql: "TEXT NOT NULL DEFAULT ''" },
241
+ { name: "node_count", sql: "BIGINT NOT NULL DEFAULT 0" },
242
+ { name: "edge_count", sql: "BIGINT NOT NULL DEFAULT 0" },
243
+ // Generator metadata (for drift diagnostics — what hivemind version produced this?)
244
+ { name: "generator", sql: "TEXT NOT NULL DEFAULT 'hivemind-graph'" },
245
+ { name: "generator_version", sql: "TEXT NOT NULL DEFAULT ''" },
246
+ { name: "schema_version", sql: "BIGINT NOT NULL DEFAULT 1" }
247
+ ]);
224
248
  validateSchema("MEMORY_COLUMNS", MEMORY_COLUMNS);
225
249
  validateSchema("SESSIONS_COLUMNS", SESSIONS_COLUMNS);
226
250
  validateSchema("SKILLS_COLUMNS", SKILLS_COLUMNS);
251
+ validateSchema("CODEBASE_COLUMNS", CODEBASE_COLUMNS);
227
252
  function buildCreateTableSql(tableName, cols) {
228
253
  const safe = sqlIdent(tableName);
229
254
  const colSql = cols.map((c) => `${c.name} ${c.sql}`).join(", ");
@@ -788,6 +813,24 @@ var DeeplakeApi = class {
788
813
  * This sidesteps the Deeplake UPDATE-coalescing quirk that bit the wiki
789
814
  * worker.
790
815
  */
816
+ /**
817
+ * Create the codebase table. One row per (org, workspace, repo, user,
818
+ * worktree, commit) — see CODEBASE_COLUMNS for the schema. Healing
819
+ * + index follow the same pattern as ensureSessionsTable.
820
+ */
821
+ async ensureCodebaseTable(name) {
822
+ const safe = sqlIdent(name);
823
+ const tables = await this.listTables();
824
+ if (!tables.includes(safe)) {
825
+ log3(`table "${safe}" not found, creating`);
826
+ await this.createTableWithRetry(buildCreateTableSql(safe, CODEBASE_COLUMNS), safe);
827
+ log3(`table "${safe}" created`);
828
+ if (!tables.includes(safe))
829
+ this._tablesCache = [...tables, safe];
830
+ }
831
+ await this.healSchema(safe, CODEBASE_COLUMNS);
832
+ await this.ensureLookupIndex(safe, "codebase_identity", `("org_id", "workspace_id", "repo_slug", "user_id", "worktree_id", "commit_sha")`);
833
+ }
791
834
  async ensureSkillsTable(name) {
792
835
  const safe = sqlIdent(name);
793
836
  const tables = await this.listTables();
@@ -126,6 +126,7 @@ function loadConfig() {
126
126
  tableName: process.env.HIVEMIND_TABLE ?? "memory",
127
127
  sessionsTableName: process.env.HIVEMIND_SESSIONS_TABLE ?? "sessions",
128
128
  skillsTableName: process.env.HIVEMIND_SKILLS_TABLE ?? "skills",
129
+ codebaseTableName: process.env.HIVEMIND_CODEBASE_TABLE ?? "codebase",
129
130
  memoryPath: process.env.HIVEMIND_MEMORY_PATH ?? join3(home, ".deeplake", "memory")
130
131
  };
131
132
  }
@@ -234,9 +235,33 @@ function validateSchema(label, cols) {
234
235
  }
235
236
  }
236
237
  }
238
+ var CODEBASE_COLUMNS = Object.freeze([
239
+ // Identity key (matches the PK below)
240
+ { name: "org_id", sql: "TEXT NOT NULL DEFAULT ''" },
241
+ { name: "workspace_id", sql: "TEXT NOT NULL DEFAULT ''" },
242
+ { name: "repo_slug", sql: "TEXT NOT NULL DEFAULT ''" },
243
+ { name: "user_id", sql: "TEXT NOT NULL DEFAULT ''" },
244
+ { name: "worktree_id", sql: "TEXT NOT NULL DEFAULT ''" },
245
+ { name: "commit_sha", sql: "TEXT NOT NULL DEFAULT ''" },
246
+ // Observation metadata
247
+ { name: "parent_sha", sql: "TEXT NOT NULL DEFAULT ''" },
248
+ { name: "branch", sql: "TEXT NOT NULL DEFAULT ''" },
249
+ { name: "ts", sql: "TIMESTAMP" },
250
+ { name: "pushed_by", sql: "TEXT NOT NULL DEFAULT ''" },
251
+ // Snapshot payload
252
+ { name: "snapshot_sha256", sql: "TEXT NOT NULL DEFAULT ''" },
253
+ { name: "snapshot_jsonb", sql: "TEXT NOT NULL DEFAULT ''" },
254
+ { name: "node_count", sql: "BIGINT NOT NULL DEFAULT 0" },
255
+ { name: "edge_count", sql: "BIGINT NOT NULL DEFAULT 0" },
256
+ // Generator metadata (for drift diagnostics — what hivemind version produced this?)
257
+ { name: "generator", sql: "TEXT NOT NULL DEFAULT 'hivemind-graph'" },
258
+ { name: "generator_version", sql: "TEXT NOT NULL DEFAULT ''" },
259
+ { name: "schema_version", sql: "BIGINT NOT NULL DEFAULT 1" }
260
+ ]);
237
261
  validateSchema("MEMORY_COLUMNS", MEMORY_COLUMNS);
238
262
  validateSchema("SESSIONS_COLUMNS", SESSIONS_COLUMNS);
239
263
  validateSchema("SKILLS_COLUMNS", SKILLS_COLUMNS);
264
+ validateSchema("CODEBASE_COLUMNS", CODEBASE_COLUMNS);
240
265
  function buildCreateTableSql(tableName, cols) {
241
266
  const safe = sqlIdent(tableName);
242
267
  const colSql = cols.map((c) => `${c.name} ${c.sql}`).join(", ");
@@ -783,6 +808,24 @@ var DeeplakeApi = class {
783
808
  * This sidesteps the Deeplake UPDATE-coalescing quirk that bit the wiki
784
809
  * worker.
785
810
  */
811
+ /**
812
+ * Create the codebase table. One row per (org, workspace, repo, user,
813
+ * worktree, commit) — see CODEBASE_COLUMNS for the schema. Healing
814
+ * + index follow the same pattern as ensureSessionsTable.
815
+ */
816
+ async ensureCodebaseTable(name) {
817
+ const safe = sqlIdent(name);
818
+ const tables = await this.listTables();
819
+ if (!tables.includes(safe)) {
820
+ log3(`table "${safe}" not found, creating`);
821
+ await this.createTableWithRetry(buildCreateTableSql(safe, CODEBASE_COLUMNS), safe);
822
+ log3(`table "${safe}" created`);
823
+ if (!tables.includes(safe))
824
+ this._tablesCache = [...tables, safe];
825
+ }
826
+ await this.healSchema(safe, CODEBASE_COLUMNS);
827
+ await this.ensureLookupIndex(safe, "codebase_identity", `("org_id", "workspace_id", "repo_slug", "user_id", "worktree_id", "commit_sha")`);
828
+ }
786
829
  async ensureSkillsTable(name) {
787
830
  const safe = sqlIdent(name);
788
831
  const tables = await this.listTables();
@@ -53,9 +53,9 @@ var init_index_marker_store = __esm({
53
53
  });
54
54
 
55
55
  // dist/src/hooks/codex/session-start.js
56
- import { spawn as spawn2 } from "node:child_process";
56
+ import { spawn as spawn3 } from "node:child_process";
57
57
  import { fileURLToPath as fileURLToPath2 } from "node:url";
58
- import { dirname as dirname7, join as join16 } from "node:path";
58
+ import { dirname as dirname7, join as join17 } from "node:path";
59
59
 
60
60
  // dist/src/commands/auth.js
61
61
  import { execSync } from "node:child_process";
@@ -324,6 +324,7 @@ function loadConfig() {
324
324
  tableName: process.env.HIVEMIND_TABLE ?? "memory",
325
325
  sessionsTableName: process.env.HIVEMIND_SESSIONS_TABLE ?? "sessions",
326
326
  skillsTableName: process.env.HIVEMIND_SKILLS_TABLE ?? "skills",
327
+ codebaseTableName: process.env.HIVEMIND_CODEBASE_TABLE ?? "codebase",
327
328
  memoryPath: process.env.HIVEMIND_MEMORY_PATH ?? join7(home, ".deeplake", "memory")
328
329
  };
329
330
  }
@@ -414,9 +415,33 @@ function validateSchema(label, cols) {
414
415
  }
415
416
  }
416
417
  }
418
+ var CODEBASE_COLUMNS = Object.freeze([
419
+ // Identity key (matches the PK below)
420
+ { name: "org_id", sql: "TEXT NOT NULL DEFAULT ''" },
421
+ { name: "workspace_id", sql: "TEXT NOT NULL DEFAULT ''" },
422
+ { name: "repo_slug", sql: "TEXT NOT NULL DEFAULT ''" },
423
+ { name: "user_id", sql: "TEXT NOT NULL DEFAULT ''" },
424
+ { name: "worktree_id", sql: "TEXT NOT NULL DEFAULT ''" },
425
+ { name: "commit_sha", sql: "TEXT NOT NULL DEFAULT ''" },
426
+ // Observation metadata
427
+ { name: "parent_sha", sql: "TEXT NOT NULL DEFAULT ''" },
428
+ { name: "branch", sql: "TEXT NOT NULL DEFAULT ''" },
429
+ { name: "ts", sql: "TIMESTAMP" },
430
+ { name: "pushed_by", sql: "TEXT NOT NULL DEFAULT ''" },
431
+ // Snapshot payload
432
+ { name: "snapshot_sha256", sql: "TEXT NOT NULL DEFAULT ''" },
433
+ { name: "snapshot_jsonb", sql: "TEXT NOT NULL DEFAULT ''" },
434
+ { name: "node_count", sql: "BIGINT NOT NULL DEFAULT 0" },
435
+ { name: "edge_count", sql: "BIGINT NOT NULL DEFAULT 0" },
436
+ // Generator metadata (for drift diagnostics — what hivemind version produced this?)
437
+ { name: "generator", sql: "TEXT NOT NULL DEFAULT 'hivemind-graph'" },
438
+ { name: "generator_version", sql: "TEXT NOT NULL DEFAULT ''" },
439
+ { name: "schema_version", sql: "BIGINT NOT NULL DEFAULT 1" }
440
+ ]);
417
441
  validateSchema("MEMORY_COLUMNS", MEMORY_COLUMNS);
418
442
  validateSchema("SESSIONS_COLUMNS", SESSIONS_COLUMNS);
419
443
  validateSchema("SKILLS_COLUMNS", SKILLS_COLUMNS);
444
+ validateSchema("CODEBASE_COLUMNS", CODEBASE_COLUMNS);
420
445
  function buildCreateTableSql(tableName, cols) {
421
446
  const safe = sqlIdent(tableName);
422
447
  const colSql = cols.map((c) => `${c.name} ${c.sql}`).join(", ");
@@ -963,6 +988,24 @@ var DeeplakeApi = class {
963
988
  * This sidesteps the Deeplake UPDATE-coalescing quirk that bit the wiki
964
989
  * worker.
965
990
  */
991
+ /**
992
+ * Create the codebase table. One row per (org, workspace, repo, user,
993
+ * worktree, commit) — see CODEBASE_COLUMNS for the schema. Healing
994
+ * + index follow the same pattern as ensureSessionsTable.
995
+ */
996
+ async ensureCodebaseTable(name) {
997
+ const safe = sqlIdent(name);
998
+ const tables = await this.listTables();
999
+ if (!tables.includes(safe)) {
1000
+ log3(`table "${safe}" not found, creating`);
1001
+ await this.createTableWithRetry(buildCreateTableSql(safe, CODEBASE_COLUMNS), safe);
1002
+ log3(`table "${safe}" created`);
1003
+ if (!tables.includes(safe))
1004
+ this._tablesCache = [...tables, safe];
1005
+ }
1006
+ await this.healSchema(safe, CODEBASE_COLUMNS);
1007
+ await this.ensureLookupIndex(safe, "codebase_identity", `("org_id", "workspace_id", "repo_slug", "user_id", "worktree_id", "commit_sha")`);
1008
+ }
966
1009
  async ensureSkillsTable(name) {
967
1010
  const safe = sqlIdent(name);
968
1011
  const tables = await this.listTables();
@@ -1642,6 +1685,27 @@ async function autoPullSkills(deps = {}) {
1642
1685
  }
1643
1686
  }
1644
1687
 
1688
+ // dist/src/graph/spawn-pull-worker.js
1689
+ import { spawn as spawn2 } from "node:child_process";
1690
+ import { join as join16 } from "node:path";
1691
+ function spawnGraphPullWorker(cwd, bundleDir, deps = {}) {
1692
+ if (process.env.HIVEMIND_GRAPH_PULL === "0")
1693
+ return;
1694
+ const workerPath = join16(bundleDir, "graph-pull-worker.js");
1695
+ const opts = {
1696
+ detached: true,
1697
+ stdio: ["ignore", "ignore", "ignore"]
1698
+ };
1699
+ try {
1700
+ const sp = deps.spawn ?? spawn2;
1701
+ const child = sp("nohup", ["node", workerPath, "--cwd", cwd], opts);
1702
+ child.on("error", () => {
1703
+ });
1704
+ child.unref();
1705
+ } catch {
1706
+ }
1707
+ }
1708
+
1645
1709
  // dist/src/hooks/codex/session-start.js
1646
1710
  var log5 = (msg) => log("codex-session-start", msg);
1647
1711
  var __bundleDir = dirname7(fileURLToPath2(import.meta.url));
@@ -1658,8 +1722,8 @@ async function main() {
1658
1722
  log5(`credentials loaded: org=${creds.orgName ?? creds.orgId}`);
1659
1723
  }
1660
1724
  if (creds?.token) {
1661
- const setupScript = join16(__bundleDir, "session-start-setup.js");
1662
- const child = spawn2("node", [setupScript], {
1725
+ const setupScript = join17(__bundleDir, "session-start-setup.js");
1726
+ const child = spawn3("node", [setupScript], {
1663
1727
  detached: true,
1664
1728
  stdio: ["pipe", "ignore", "ignore"],
1665
1729
  env: { ...process.env }
@@ -1679,6 +1743,8 @@ Hivemind v${current}`;
1679
1743
  }
1680
1744
  const localMined = countLocalManifestEntries();
1681
1745
  const skillNoun = localMined === 1 ? "skill" : "skills";
1746
+ if (creds?.token)
1747
+ spawnGraphPullWorker(input.cwd, __bundleDir);
1682
1748
  const additionalContext = creds?.token ? `Hivemind: logged in as org ${creds.orgName ?? creds.orgId} (workspace: ${creds.workspaceId ?? "default"}).${versionNotice}` : `Hivemind: not logged in. Run \`hivemind login\` to enable shared memory + skill sharing.${versionNotice}`;
1683
1749
  const systemMessage = !creds?.token && localMined > 0 ? `\u{1F4A1} ${localMined} ${skillNoun} mined from your local sessions live in ~/.claude/skills/. Run 'hivemind login' to share them with your team.` : void 0;
1684
1750
  const output = {