@deeplake/hivemind 0.7.46 → 0.7.47

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 (38) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +64 -0
  4. package/bundle/cli.js +17230 -4177
  5. package/codex/bundle/capture.js +185 -0
  6. package/codex/bundle/commands/auth-login.js +185 -0
  7. package/codex/bundle/graph-pull-worker.js +185 -0
  8. package/codex/bundle/pre-tool-use.js +185 -0
  9. package/codex/bundle/session-start-setup.js +185 -0
  10. package/codex/bundle/session-start.js +185 -0
  11. package/codex/bundle/shell/deeplake-shell.js +451 -3
  12. package/codex/bundle/skillify-worker.js +64 -0
  13. package/codex/bundle/stop.js +185 -0
  14. package/codex/skills/hivemind-goals/SKILL.md +157 -0
  15. package/cursor/bundle/capture.js +185 -0
  16. package/cursor/bundle/commands/auth-login.js +185 -0
  17. package/cursor/bundle/graph-pull-worker.js +185 -0
  18. package/cursor/bundle/pre-tool-use.js +185 -0
  19. package/cursor/bundle/session-end.js +16 -0
  20. package/cursor/bundle/session-start.js +596 -6
  21. package/cursor/bundle/shell/deeplake-shell.js +451 -3
  22. package/cursor/bundle/skillify-worker.js +64 -0
  23. package/hermes/bundle/capture.js +185 -0
  24. package/hermes/bundle/commands/auth-login.js +185 -0
  25. package/hermes/bundle/graph-pull-worker.js +185 -0
  26. package/hermes/bundle/pre-tool-use.js +185 -0
  27. package/hermes/bundle/session-end.js +16 -0
  28. package/hermes/bundle/session-start.js +596 -6
  29. package/hermes/bundle/shell/deeplake-shell.js +451 -3
  30. package/hermes/bundle/skillify-worker.js +64 -0
  31. package/mcp/bundle/server.js +185 -0
  32. package/openclaw/dist/chunks/{config-O5PDJQ7Y.js → config-FH6JYSJW.js} +16 -0
  33. package/openclaw/dist/index.js +262 -2
  34. package/openclaw/dist/skillify-worker.js +64 -0
  35. package/openclaw/openclaw.plugin.json +4 -2
  36. package/openclaw/package.json +1 -1
  37. package/openclaw/skills/hivemind-goals/SKILL.md +30 -0
  38. package/package.json +2 -1
@@ -97,6 +97,22 @@ 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
+ // Defaults match the table name written into the SQL — keep aligned
101
+ // with RULES_COLUMNS / TASKS_COLUMNS / TASK_EVENTS_COLUMNS in
102
+ // deeplake-schema.ts and with the e2e test-org override convention
103
+ // (memory_test / sessions_test → goals_test, etc.) documented in
104
+ // CLAUDE.md.
105
+ rulesTableName: process.env.HIVEMIND_RULES_TABLE ?? "hivemind_rules",
106
+ tasksTableName: process.env.HIVEMIND_TASKS_TABLE ?? "hivemind_tasks",
107
+ taskEventsTableName: process.env.HIVEMIND_TASK_EVENTS_TABLE ?? "hivemind_task_events",
108
+ // Goals + KPIs (refined design — VFS path classifier maps
109
+ // memory/goal/<user>/<status>/<uuid>.md → hivemind_goals row
110
+ // memory/kpi/<uuid>/<kpi_id>.md → hivemind_kpis row
111
+ // See src/shell/deeplake-fs.ts for the translation logic and
112
+ // GOALS_COLUMNS / KPIS_COLUMNS in deeplake-schema.ts for the
113
+ // table shape.
114
+ goalsTableName: process.env.HIVEMIND_GOALS_TABLE ?? "hivemind_goals",
115
+ kpisTableName: process.env.HIVEMIND_KPIS_TABLE ?? "hivemind_kpis",
100
116
  codebaseTableName: process.env.HIVEMIND_CODEBASE_TABLE ?? "codebase",
101
117
  memoryPath: process.env.HIVEMIND_MEMORY_PATH ?? join(home, ".deeplake", "memory")
102
118
  };
@@ -198,6 +214,65 @@ var SKILLS_COLUMNS = Object.freeze([
198
214
  { name: "created_at", sql: "TEXT NOT NULL DEFAULT ''" },
199
215
  { name: "updated_at", sql: "TEXT NOT NULL DEFAULT ''" }
200
216
  ]);
217
+ var RULES_COLUMNS = Object.freeze([
218
+ { name: "id", sql: "TEXT NOT NULL DEFAULT ''" },
219
+ { name: "rule_id", sql: "TEXT NOT NULL DEFAULT ''" },
220
+ { name: "text", sql: "TEXT NOT NULL DEFAULT ''" },
221
+ { name: "scope", sql: "TEXT NOT NULL DEFAULT 'team'" },
222
+ { name: "status", sql: "TEXT NOT NULL DEFAULT 'active'" },
223
+ { name: "assigned_by", sql: "TEXT NOT NULL DEFAULT ''" },
224
+ { name: "version", sql: "BIGINT NOT NULL DEFAULT 1" },
225
+ { name: "created_at", sql: "TEXT NOT NULL DEFAULT ''" },
226
+ { name: "agent", sql: "TEXT NOT NULL DEFAULT 'manual'" },
227
+ { name: "plugin_version", sql: "TEXT NOT NULL DEFAULT ''" }
228
+ ]);
229
+ var TASKS_COLUMNS = Object.freeze([
230
+ { name: "id", sql: "TEXT NOT NULL DEFAULT ''" },
231
+ { name: "task_id", sql: "TEXT NOT NULL DEFAULT ''" },
232
+ { name: "text", sql: "TEXT NOT NULL DEFAULT ''" },
233
+ { name: "scope", sql: "TEXT NOT NULL DEFAULT 'me'" },
234
+ { name: "status", sql: "TEXT NOT NULL DEFAULT 'active'" },
235
+ { name: "assigned_to", sql: "TEXT NOT NULL DEFAULT ''" },
236
+ { name: "assigned_by", sql: "TEXT NOT NULL DEFAULT ''" },
237
+ { name: "kpis", sql: "JSONB" },
238
+ { name: "version", sql: "BIGINT NOT NULL DEFAULT 1" },
239
+ { name: "created_at", sql: "TEXT NOT NULL DEFAULT ''" },
240
+ { name: "agent", sql: "TEXT NOT NULL DEFAULT 'manual'" },
241
+ { name: "plugin_version", sql: "TEXT NOT NULL DEFAULT ''" }
242
+ ]);
243
+ var TASK_EVENTS_COLUMNS = Object.freeze([
244
+ { name: "id", sql: "TEXT NOT NULL DEFAULT ''" },
245
+ { name: "task_id", sql: "TEXT NOT NULL DEFAULT ''" },
246
+ { name: "task_version", sql: "BIGINT NOT NULL DEFAULT 1" },
247
+ { name: "kpi_id", sql: "TEXT NOT NULL DEFAULT ''" },
248
+ { name: "value", sql: "BIGINT NOT NULL DEFAULT 0" },
249
+ { name: "note", sql: "TEXT NOT NULL DEFAULT ''" },
250
+ { name: "source", sql: "TEXT NOT NULL DEFAULT 'user'" },
251
+ { name: "agent", sql: "TEXT NOT NULL DEFAULT ''" },
252
+ { name: "ts", sql: "TEXT NOT NULL DEFAULT ''" },
253
+ { name: "plugin_version", sql: "TEXT NOT NULL DEFAULT ''" }
254
+ ]);
255
+ var GOALS_COLUMNS = Object.freeze([
256
+ { name: "id", sql: "TEXT NOT NULL DEFAULT ''" },
257
+ { name: "goal_id", sql: "TEXT NOT NULL DEFAULT ''" },
258
+ { name: "owner", sql: "TEXT NOT NULL DEFAULT ''" },
259
+ { name: "status", sql: "TEXT NOT NULL DEFAULT 'opened'" },
260
+ { name: "content", sql: "TEXT NOT NULL DEFAULT ''" },
261
+ { name: "version", sql: "BIGINT NOT NULL DEFAULT 1" },
262
+ { name: "created_at", sql: "TEXT NOT NULL DEFAULT ''" },
263
+ { name: "agent", sql: "TEXT NOT NULL DEFAULT 'manual'" },
264
+ { name: "plugin_version", sql: "TEXT NOT NULL DEFAULT ''" }
265
+ ]);
266
+ var KPIS_COLUMNS = Object.freeze([
267
+ { name: "id", sql: "TEXT NOT NULL DEFAULT ''" },
268
+ { name: "goal_id", sql: "TEXT NOT NULL DEFAULT ''" },
269
+ { name: "kpi_id", sql: "TEXT NOT NULL DEFAULT ''" },
270
+ { name: "content", sql: "TEXT NOT NULL DEFAULT ''" },
271
+ { name: "version", sql: "BIGINT NOT NULL DEFAULT 1" },
272
+ { name: "created_at", sql: "TEXT NOT NULL DEFAULT ''" },
273
+ { name: "agent", sql: "TEXT NOT NULL DEFAULT 'manual'" },
274
+ { name: "plugin_version", sql: "TEXT NOT NULL DEFAULT ''" }
275
+ ]);
201
276
  function validateSchema(label, cols) {
202
277
  const seen = /* @__PURE__ */ new Set();
203
278
  for (const col of cols) {
@@ -241,6 +316,11 @@ var CODEBASE_COLUMNS = Object.freeze([
241
316
  validateSchema("MEMORY_COLUMNS", MEMORY_COLUMNS);
242
317
  validateSchema("SESSIONS_COLUMNS", SESSIONS_COLUMNS);
243
318
  validateSchema("SKILLS_COLUMNS", SKILLS_COLUMNS);
319
+ validateSchema("RULES_COLUMNS", RULES_COLUMNS);
320
+ validateSchema("TASKS_COLUMNS", TASKS_COLUMNS);
321
+ validateSchema("TASK_EVENTS_COLUMNS", TASK_EVENTS_COLUMNS);
322
+ validateSchema("GOALS_COLUMNS", GOALS_COLUMNS);
323
+ validateSchema("KPIS_COLUMNS", KPIS_COLUMNS);
244
324
  validateSchema("CODEBASE_COLUMNS", CODEBASE_COLUMNS);
245
325
  function buildCreateTableSql(tableName, cols) {
246
326
  const safe = sqlIdent(tableName);
@@ -837,6 +917,111 @@ var DeeplakeApi = class {
837
917
  await this.healSchema(safe, SKILLS_COLUMNS);
838
918
  await this.ensureLookupIndex(safe, "project_key_name", `("project_key", "name")`);
839
919
  }
920
+ /**
921
+ * Create the rules table.
922
+ *
923
+ * One row per rule version (same write pattern as skills): edits INSERT
924
+ * a fresh row with version+1, reads pick latest per rule_id via
925
+ * `ORDER BY version DESC LIMIT 1`. Sidesteps the Deeplake
926
+ * UPDATE-coalescing quirk by never UPDATEing.
927
+ */
928
+ async ensureRulesTable(name) {
929
+ const safe = sqlIdent(name);
930
+ const tables = await this.listTables();
931
+ if (!tables.includes(safe)) {
932
+ log3(`table "${safe}" not found, creating`);
933
+ await this.createTableWithRetry(buildCreateTableSql(safe, RULES_COLUMNS), safe);
934
+ log3(`table "${safe}" created`);
935
+ if (!tables.includes(safe))
936
+ this._tablesCache = [...tables, safe];
937
+ }
938
+ await this.healSchema(safe, RULES_COLUMNS);
939
+ await this.ensureLookupIndex(safe, "rule_id_version", `("rule_id", "version")`);
940
+ }
941
+ /**
942
+ * Create the tasks table.
943
+ *
944
+ * Same write pattern as rules + skills. `kpis` is a nullable JSONB
945
+ * column with the agent's KPI metadata; KPI current values come from
946
+ * `task_events` (SUM(value)), not this snapshot.
947
+ */
948
+ async ensureTasksTable(name) {
949
+ const safe = sqlIdent(name);
950
+ const tables = await this.listTables();
951
+ if (!tables.includes(safe)) {
952
+ log3(`table "${safe}" not found, creating`);
953
+ await this.createTableWithRetry(buildCreateTableSql(safe, TASKS_COLUMNS), safe);
954
+ log3(`table "${safe}" created`);
955
+ if (!tables.includes(safe))
956
+ this._tablesCache = [...tables, safe];
957
+ }
958
+ await this.healSchema(safe, TASKS_COLUMNS);
959
+ await this.ensureLookupIndex(safe, "task_id_version", `("task_id", "version")`);
960
+ }
961
+ /**
962
+ * Create the task-events table.
963
+ *
964
+ * Append-only. Every INSERT is a fresh row; never UPDATE. KPI current
965
+ * value is `SUM(value) WHERE task_id=? AND kpi_id=?`. Index on
966
+ * (task_id, kpi_id) is the canonical aggregation key.
967
+ */
968
+ async ensureTaskEventsTable(name) {
969
+ const safe = sqlIdent(name);
970
+ const tables = await this.listTables();
971
+ if (!tables.includes(safe)) {
972
+ log3(`table "${safe}" not found, creating`);
973
+ await this.createTableWithRetry(buildCreateTableSql(safe, TASK_EVENTS_COLUMNS), safe);
974
+ log3(`table "${safe}" created`);
975
+ if (!tables.includes(safe))
976
+ this._tablesCache = [...tables, safe];
977
+ }
978
+ await this.healSchema(safe, TASK_EVENTS_COLUMNS);
979
+ await this.ensureLookupIndex(safe, "task_id_kpi_id", `("task_id", "kpi_id")`);
980
+ }
981
+ /**
982
+ * Create the goals table.
983
+ *
984
+ * Backed by the VFS path convention memory/goal/<owner>/<status>/<goal_id>.md.
985
+ * INSERT-only version-bumped: rm and mv operations translate to fresh
986
+ * v=N+1 rows (status flips for mv → closed; rm is the same soft-close).
987
+ * The (goal_id, version) index lets the VFS dispatch a cheap latest-row
988
+ * read on cat / Read of a single goal.
989
+ */
990
+ async ensureGoalsTable(name) {
991
+ const safe = sqlIdent(name);
992
+ const tables = await this.listTables();
993
+ if (!tables.includes(safe)) {
994
+ log3(`table "${safe}" not found, creating`);
995
+ await this.createTableWithRetry(buildCreateTableSql(safe, GOALS_COLUMNS), safe);
996
+ log3(`table "${safe}" created`);
997
+ if (!tables.includes(safe))
998
+ this._tablesCache = [...tables, safe];
999
+ }
1000
+ await this.healSchema(safe, GOALS_COLUMNS);
1001
+ await this.ensureLookupIndex(safe, "goal_id_version", `("goal_id", "version")`);
1002
+ await this.ensureLookupIndex(safe, "owner_status", `("owner", "status")`);
1003
+ }
1004
+ /**
1005
+ * Create the kpis table.
1006
+ *
1007
+ * Backed by memory/kpi/<goal_id>/<kpi_id>.md. KPI rows do NOT carry
1008
+ * owner — ownership derives from the parent goal via logical join on
1009
+ * goal_id. INSERT-only version-bumped. (goal_id, kpi_id) index is the
1010
+ * canonical lookup the VFS uses on Read and Write.
1011
+ */
1012
+ async ensureKpisTable(name) {
1013
+ const safe = sqlIdent(name);
1014
+ const tables = await this.listTables();
1015
+ if (!tables.includes(safe)) {
1016
+ log3(`table "${safe}" not found, creating`);
1017
+ await this.createTableWithRetry(buildCreateTableSql(safe, KPIS_COLUMNS), safe);
1018
+ log3(`table "${safe}" created`);
1019
+ if (!tables.includes(safe))
1020
+ this._tablesCache = [...tables, safe];
1021
+ }
1022
+ await this.healSchema(safe, KPIS_COLUMNS);
1023
+ await this.ensureLookupIndex(safe, "goal_id_kpi_id", `("goal_id", "kpi_id")`);
1024
+ }
840
1025
  };
841
1026
 
842
1027
  // dist/src/shell/grep-core.js
@@ -62,6 +62,22 @@ 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
+ // Defaults match the table name written into the SQL — keep aligned
66
+ // with RULES_COLUMNS / TASKS_COLUMNS / TASK_EVENTS_COLUMNS in
67
+ // deeplake-schema.ts and with the e2e test-org override convention
68
+ // (memory_test / sessions_test → goals_test, etc.) documented in
69
+ // CLAUDE.md.
70
+ rulesTableName: process.env.HIVEMIND_RULES_TABLE ?? "hivemind_rules",
71
+ tasksTableName: process.env.HIVEMIND_TASKS_TABLE ?? "hivemind_tasks",
72
+ taskEventsTableName: process.env.HIVEMIND_TASK_EVENTS_TABLE ?? "hivemind_task_events",
73
+ // Goals + KPIs (refined design — VFS path classifier maps
74
+ // memory/goal/<user>/<status>/<uuid>.md → hivemind_goals row
75
+ // memory/kpi/<uuid>/<kpi_id>.md → hivemind_kpis row
76
+ // See src/shell/deeplake-fs.ts for the translation logic and
77
+ // GOALS_COLUMNS / KPIS_COLUMNS in deeplake-schema.ts for the
78
+ // table shape.
79
+ goalsTableName: process.env.HIVEMIND_GOALS_TABLE ?? "hivemind_goals",
80
+ kpisTableName: process.env.HIVEMIND_KPIS_TABLE ?? "hivemind_kpis",
65
81
  codebaseTableName: process.env.HIVEMIND_CODEBASE_TABLE ?? "codebase",
66
82
  memoryPath: process.env.HIVEMIND_MEMORY_PATH ?? join2(home, ".deeplake", "memory")
67
83
  };