@deeplake/hivemind 0.7.30 → 0.7.31

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.
@@ -19,6 +19,9 @@ function isAllowlistCoveringHivemind(alsoAllow) {
19
19
  }
20
20
  return false;
21
21
  }
22
+ function isPluginsAllowMissingHivemind(allow) {
23
+ return Array.isArray(allow) && allow.length > 0 && !allow.includes("hivemind");
24
+ }
22
25
  function ensureHivemindAllowlisted() {
23
26
  const configPath = getOpenclawConfigPath();
24
27
  if (!existsSync(configPath)) {
@@ -31,18 +34,33 @@ function ensureHivemindAllowlisted() {
31
34
  } catch (e) {
32
35
  return { status: "error", configPath, error: `could not read/parse config: ${e instanceof Error ? e.message : String(e)}` };
33
36
  }
37
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
38
+ return { status: "error", configPath, error: "openclaw config is not a JSON object" };
39
+ }
40
+ const plugins = parsed.plugins ?? {};
41
+ const pluginsAllowRaw = plugins.allow;
34
42
  const tools = parsed.tools ?? {};
35
- const alsoAllow = Array.isArray(tools.alsoAllow) ? tools.alsoAllow : [];
36
- if (isAllowlistCoveringHivemind(alsoAllow)) {
43
+ const alsoAllowRaw = tools.alsoAllow;
44
+ const pluginsAllowNeedsPatch = isPluginsAllowMissingHivemind(pluginsAllowRaw);
45
+ const toolsAlsoAllowNeedsPatch = Array.isArray(alsoAllowRaw) && alsoAllowRaw.length > 0 && !isAllowlistCoveringHivemind(alsoAllowRaw);
46
+ if (!pluginsAllowNeedsPatch && !toolsAlsoAllowNeedsPatch) {
37
47
  return { status: "already-set", configPath };
38
48
  }
39
- const updated = {
40
- ...parsed,
41
- tools: {
49
+ const updated = { ...parsed };
50
+ if (pluginsAllowNeedsPatch) {
51
+ updated.plugins = {
52
+ ...plugins,
53
+ // Cast safe — isPluginsAllowMissingHivemind guarantees Array.
54
+ allow: [...pluginsAllowRaw, "hivemind"]
55
+ };
56
+ }
57
+ if (toolsAlsoAllowNeedsPatch) {
58
+ updated.tools = {
42
59
  ...tools,
43
- alsoAllow: [...alsoAllow, "hivemind"]
44
- }
45
- };
60
+ // Cast safe — the needs-patch check above guarantees Array.
61
+ alsoAllow: [...alsoAllowRaw, "hivemind"]
62
+ };
63
+ }
46
64
  const backupPath = `${configPath}.bak-hivemind-${Date.now()}`;
47
65
  const tmpPath = `${configPath}.tmp-hivemind-${process.pid}`;
48
66
  try {
@@ -52,7 +70,15 @@ function ensureHivemindAllowlisted() {
52
70
  } catch (e) {
53
71
  return { status: "error", configPath, error: `could not write config: ${e instanceof Error ? e.message : String(e)}` };
54
72
  }
55
- return { status: "added", configPath, backupPath };
73
+ return {
74
+ status: "added",
75
+ configPath,
76
+ backupPath,
77
+ delta: {
78
+ pluginsAllow: pluginsAllowNeedsPatch,
79
+ toolsAlsoAllow: toolsAlsoAllowNeedsPatch
80
+ }
81
+ };
56
82
  }
57
83
  function toggleAutoUpdateConfig(setTo) {
58
84
  const configPath = getOpenclawConfigPath();
@@ -100,8 +126,12 @@ function detectAllowlistMissing() {
100
126
  if (!existsSync(configPath)) return false;
101
127
  try {
102
128
  const parsed = JSON.parse(readFileSync(configPath, "utf-8"));
129
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return false;
130
+ const plugins = parsed.plugins ?? {};
103
131
  const tools = parsed.tools ?? {};
104
- return !isAllowlistCoveringHivemind(tools.alsoAllow);
132
+ const alsoAllow = tools.alsoAllow;
133
+ const toolsMissing = Array.isArray(alsoAllow) && alsoAllow.length > 0 && !isAllowlistCoveringHivemind(alsoAllow);
134
+ return isPluginsAllowMissingHivemind(plugins.allow) || toolsMissing;
105
135
  } catch {
106
136
  return false;
107
137
  }
@@ -112,5 +142,6 @@ export {
112
142
  ensureHivemindAllowlisted,
113
143
  getOpenclawConfigPath,
114
144
  isAllowlistCoveringHivemind,
145
+ isPluginsAllowMissingHivemind,
115
146
  toggleAutoUpdateConfig
116
147
  };
@@ -1047,7 +1047,7 @@ function definePluginEntry(entry) {
1047
1047
  return entry;
1048
1048
  }
1049
1049
  function loadSetupConfig() {
1050
- return import("./chunks/setup-config-VI54GEUM.js");
1050
+ return import("./chunks/setup-config-ZYMCZQMJ.js");
1051
1051
  }
1052
1052
  var credsModulePromise = null;
1053
1053
  var configModulePromise = null;
@@ -1111,7 +1111,7 @@ function extractLatestVersion(body) {
1111
1111
  return typeof v === "string" && v.length > 0 ? v : null;
1112
1112
  }
1113
1113
  function getInstalledVersion() {
1114
- return "0.7.30".length > 0 ? "0.7.30" : null;
1114
+ return "0.7.31".length > 0 ? "0.7.31" : null;
1115
1115
  }
1116
1116
  function isNewer(latest, current) {
1117
1117
  const parse = (v) => v.replace(/-.*$/, "").split(".").map(Number);
@@ -1384,62 +1384,6 @@ function spawnOpenclawSkillifyWorker(a) {
1384
1384
  function buildSessionPath(config, sessionId) {
1385
1385
  return `/sessions/${config.userName}/${config.userName}_${config.orgName}_${config.workspaceId}_${sessionId}.jsonl`;
1386
1386
  }
1387
- var RECALL_STOPWORDS = /* @__PURE__ */ new Set([
1388
- "the",
1389
- "and",
1390
- "for",
1391
- "are",
1392
- "but",
1393
- "not",
1394
- "you",
1395
- "all",
1396
- "can",
1397
- "had",
1398
- "her",
1399
- "was",
1400
- "one",
1401
- "our",
1402
- "out",
1403
- "has",
1404
- "have",
1405
- "what",
1406
- "does",
1407
- "like",
1408
- "with",
1409
- "this",
1410
- "that",
1411
- "from",
1412
- "they",
1413
- "been",
1414
- "will",
1415
- "more",
1416
- "when",
1417
- "who",
1418
- "how",
1419
- "its",
1420
- "into",
1421
- "some",
1422
- "than",
1423
- "them",
1424
- "these",
1425
- "then",
1426
- "your",
1427
- "just",
1428
- "about",
1429
- "would",
1430
- "could",
1431
- "should",
1432
- "where",
1433
- "which",
1434
- "there",
1435
- "their",
1436
- "being",
1437
- "each",
1438
- "other"
1439
- ]);
1440
- function extractKeywords(prompt) {
1441
- return prompt.toLowerCase().replace(/[^a-z0-9\s]/g, " ").split(/\s+/).filter((w) => w.length >= 3 && !RECALL_STOPWORDS.has(w)).slice(0, 4);
1442
- }
1443
1387
  function normalizeVirtualPath(p) {
1444
1388
  if (!p || typeof p !== "string") return "/";
1445
1389
  const trimmed = p.trim();
@@ -1601,15 +1545,19 @@ Skill mining (skillify) runs in the background after each turn \u2014 your conve
1601
1545
  No changes needed \u2014 memory tools are available to the agent.${skillifyHint}` };
1602
1546
  }
1603
1547
  if (result.status === "added") {
1604
- return { text: `\u2705 Added "hivemind" to your tool allowlist.
1548
+ const touched = [];
1549
+ if (result.delta.pluginsAllow) touched.push(`"hivemind" \u2192 plugins.allow`);
1550
+ if (result.delta.toolsAlsoAllow) touched.push(`"hivemind" \u2192 tools.alsoAllow`);
1551
+ return { text: `\u2705 Added:
1552
+ \u2022 ${touched.join("\n \u2022 ")}
1605
1553
 
1606
- Openclaw will detect the config change and restart. On the next turn, the agent will have access to hivemind_search, hivemind_read, and hivemind_index.
1554
+ Openclaw will detect the config change and restart. On the next turn, the agent will have access to hivemind_search, hivemind_read, and hivemind_index. **Capture starts on the next turn \u2014 earlier turns are NOT backfilled.**
1607
1555
 
1608
1556
  Backup of previous config: ${result.backupPath}${skillifyHint}` };
1609
1557
  }
1610
1558
  return { text: `\u26A0\uFE0F Could not update allowlist: ${result.error}
1611
1559
 
1612
- Manual fix: open ${result.configPath} and add "hivemind" to the "alsoAllow" array under "tools".` };
1560
+ Manual fix: open ${result.configPath}. If \`plugins.allow\` exists as a non-empty array, add "hivemind" to it. If \`tools.alsoAllow\` exists as a non-empty array, add "hivemind" to it. If either is absent or empty, leave it as-is (openclaw treats that as default-allow).` };
1613
1561
  }
1614
1562
  });
1615
1563
  pluginApi.registerCommand({
@@ -1868,26 +1816,25 @@ A newer Hivemind version is available: ${pendingUpdate.current} \u2192 ${pending
1868
1816
  };
1869
1817
  });
1870
1818
  }
1871
- if (config.autoRecall !== false) {
1872
- hook("before_agent_start", async (event) => {
1873
- if (!event.prompt || event.prompt.length < 5) return;
1874
- try {
1875
- const dl = await getApi();
1876
- if (!dl && authUrl) {
1877
- return {
1878
- prependContext: `
1819
+ hook("before_agent_start", async (event) => {
1820
+ if (!event.prompt || event.prompt.length < 5) return;
1821
+ try {
1822
+ const dl = await getApi();
1823
+ if (!dl && authUrl) {
1824
+ return {
1825
+ prependContext: `
1879
1826
 
1880
1827
  IMPORTANT: The user needs to authenticate with Hivemind. Include this link in your reply: ${authUrl}
1881
1828
  Tell them to click it and sign in, then send another message.
1882
1829
  `
1883
- };
1884
- }
1885
- if (!dl) return;
1886
- if (justAuthenticated) {
1887
- justAuthenticated = false;
1888
- const creds2 = await loadCredentials2();
1889
- const orgName = creds2?.orgName ?? creds2?.orgId ?? "unknown";
1890
- return { prependContext: `
1830
+ };
1831
+ }
1832
+ if (!dl) return;
1833
+ if (justAuthenticated) {
1834
+ justAuthenticated = false;
1835
+ const creds2 = await loadCredentials2();
1836
+ const orgName = creds2?.orgName ?? creds2?.orgId ?? "unknown";
1837
+ return { prependContext: `
1891
1838
 
1892
1839
  \u{1F41D} Welcome to Hivemind!
1893
1840
 
@@ -1902,37 +1849,11 @@ Get started:
1902
1849
 
1903
1850
  One brain for every agent on your team.
1904
1851
  ` };
1905
- }
1906
- const keywords = extractKeywords(event.prompt);
1907
- if (!keywords.length) return;
1908
- const grepParams = {
1909
- pattern: keywords.join(" "),
1910
- ignoreCase: true,
1911
- wordMatch: false,
1912
- filesOnly: false,
1913
- countOnly: false,
1914
- lineNumber: false,
1915
- invertMatch: false,
1916
- fixedString: true
1917
- };
1918
- const searchOpts = buildGrepSearchOptions(grepParams, "/");
1919
- searchOpts.limit = 10;
1920
- const rows = await searchDeeplakeTables(dl, memoryTable, sessionsTable, searchOpts);
1921
- if (!rows.length) return;
1922
- const recalled = rows.map((r) => {
1923
- const body = normalizeContent(r.path, r.content);
1924
- return `[${r.path}] ${body.slice(0, 400)}`;
1925
- }).join("\n\n");
1926
- logger.info?.(`Auto-recalled ${rows.length} memories`);
1927
- const instruction = "These are raw Hivemind search hits from prior sessions. Each hit is prefixed with its path (e.g. `/summaries/<username>/...`). Different usernames are different people \u2014 do NOT merge, alias, or conflate them. If you need more detail, call `hivemind_search` with a more specific query or `hivemind_read` on a specific path. If these hits don't answer the question, say so rather than guessing.";
1928
- return {
1929
- prependContext: "\n\n<recalled-memories>\n" + instruction + "\n\n" + recalled + "\n</recalled-memories>\n"
1930
- };
1931
- } catch (err) {
1932
- logger.error(`Auto-recall failed: ${err instanceof Error ? err.message : String(err)}`);
1933
1852
  }
1934
- });
1935
- }
1853
+ } catch (err) {
1854
+ logger.error(`before_agent_start failed: ${err instanceof Error ? err.message : String(err)}`);
1855
+ }
1856
+ });
1936
1857
  if (config.autoCapture !== false) {
1937
1858
  hook("agent_end", async (event) => {
1938
1859
  const ev = event;
@@ -52,5 +52,5 @@
52
52
  }
53
53
  }
54
54
  },
55
- "version": "0.7.30"
55
+ "version": "0.7.31"
56
56
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hivemind",
3
- "version": "0.7.30",
3
+ "version": "0.7.31",
4
4
  "type": "module",
5
5
  "description": "Hivemind — cloud-backed persistent shared memory for AI agents, powered by DeepLake",
6
6
  "license": "Apache-2.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deeplake/hivemind",
3
- "version": "0.7.30",
3
+ "version": "0.7.31",
4
4
  "description": "Cloud-backed persistent shared memory for AI agents powered by Deeplake",
5
5
  "type": "module",
6
6
  "repository": {