@deeplake/hivemind 0.6.48 → 0.7.4

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 (40) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +147 -20
  4. package/bundle/cli.js +552 -95
  5. package/codex/bundle/capture.js +509 -89
  6. package/codex/bundle/commands/auth-login.js +209 -66
  7. package/codex/bundle/embeddings/embed-daemon.js +243 -0
  8. package/codex/bundle/pre-tool-use.js +629 -104
  9. package/codex/bundle/session-start-setup.js +194 -57
  10. package/codex/bundle/session-start.js +25 -10
  11. package/codex/bundle/shell/deeplake-shell.js +679 -112
  12. package/codex/bundle/stop.js +476 -58
  13. package/codex/bundle/wiki-worker.js +312 -11
  14. package/cursor/bundle/capture.js +768 -57
  15. package/cursor/bundle/commands/auth-login.js +209 -66
  16. package/cursor/bundle/embeddings/embed-daemon.js +243 -0
  17. package/cursor/bundle/pre-tool-use.js +561 -70
  18. package/cursor/bundle/session-end.js +223 -2
  19. package/cursor/bundle/session-start.js +192 -54
  20. package/cursor/bundle/shell/deeplake-shell.js +679 -112
  21. package/cursor/bundle/wiki-worker.js +571 -0
  22. package/hermes/bundle/capture.js +771 -58
  23. package/hermes/bundle/commands/auth-login.js +209 -66
  24. package/hermes/bundle/embeddings/embed-daemon.js +243 -0
  25. package/hermes/bundle/pre-tool-use.js +560 -69
  26. package/hermes/bundle/session-end.js +224 -1
  27. package/hermes/bundle/session-start.js +195 -54
  28. package/hermes/bundle/shell/deeplake-shell.js +679 -112
  29. package/hermes/bundle/wiki-worker.js +572 -0
  30. package/mcp/bundle/server.js +253 -68
  31. package/openclaw/dist/chunks/auth-creds-AEKS6D3P.js +14 -0
  32. package/openclaw/dist/chunks/chunk-SRCBBT4H.js +37 -0
  33. package/openclaw/dist/chunks/config-G23NI5TV.js +33 -0
  34. package/openclaw/dist/chunks/index-marker-store-PGT5CW6T.js +33 -0
  35. package/openclaw/dist/chunks/setup-config-C35UK4LP.js +114 -0
  36. package/openclaw/dist/index.js +752 -702
  37. package/openclaw/openclaw.plugin.json +1 -1
  38. package/openclaw/package.json +1 -1
  39. package/package.json +2 -1
  40. package/pi/extension-source/hivemind.ts +473 -21
@@ -0,0 +1,114 @@
1
+ // openclaw/src/setup-config.ts
2
+ import { existsSync, readFileSync, writeFileSync, renameSync } from "node:fs";
3
+ import { homedir } from "node:os";
4
+ import { join } from "node:path";
5
+ var HIVEMIND_TOOL_NAMES = ["hivemind_search", "hivemind_read", "hivemind_index"];
6
+ function getOpenclawConfigPath() {
7
+ return join(homedir(), ".openclaw", "openclaw.json");
8
+ }
9
+ function isAllowlistCoveringHivemind(alsoAllow) {
10
+ if (!Array.isArray(alsoAllow)) return false;
11
+ for (const entry of alsoAllow) {
12
+ if (typeof entry !== "string") continue;
13
+ const normalized = entry.trim().toLowerCase();
14
+ if (normalized === "hivemind") return true;
15
+ if (normalized === "group:plugins") return true;
16
+ if (HIVEMIND_TOOL_NAMES.includes(normalized)) return true;
17
+ }
18
+ return false;
19
+ }
20
+ function ensureHivemindAllowlisted() {
21
+ const configPath = getOpenclawConfigPath();
22
+ if (!existsSync(configPath)) {
23
+ return { status: "error", configPath, error: "openclaw config file not found" };
24
+ }
25
+ let parsed;
26
+ try {
27
+ const raw = readFileSync(configPath, "utf-8");
28
+ parsed = JSON.parse(raw);
29
+ } catch (e) {
30
+ return { status: "error", configPath, error: `could not read/parse config: ${e instanceof Error ? e.message : String(e)}` };
31
+ }
32
+ const tools = parsed.tools ?? {};
33
+ const alsoAllow = Array.isArray(tools.alsoAllow) ? tools.alsoAllow : [];
34
+ if (isAllowlistCoveringHivemind(alsoAllow)) {
35
+ return { status: "already-set", configPath };
36
+ }
37
+ const updated = {
38
+ ...parsed,
39
+ tools: {
40
+ ...tools,
41
+ alsoAllow: [...alsoAllow, "hivemind"]
42
+ }
43
+ };
44
+ const backupPath = `${configPath}.bak-hivemind-${Date.now()}`;
45
+ const tmpPath = `${configPath}.tmp-hivemind-${process.pid}`;
46
+ try {
47
+ writeFileSync(backupPath, readFileSync(configPath, "utf-8"));
48
+ writeFileSync(tmpPath, JSON.stringify(updated, null, 2) + "\n");
49
+ renameSync(tmpPath, configPath);
50
+ } catch (e) {
51
+ return { status: "error", configPath, error: `could not write config: ${e instanceof Error ? e.message : String(e)}` };
52
+ }
53
+ return { status: "added", configPath, backupPath };
54
+ }
55
+ function toggleAutoUpdateConfig(setTo) {
56
+ const configPath = getOpenclawConfigPath();
57
+ if (!existsSync(configPath)) {
58
+ return { status: "error", configPath, error: "openclaw config file not found" };
59
+ }
60
+ let parsed;
61
+ try {
62
+ parsed = JSON.parse(readFileSync(configPath, "utf-8"));
63
+ } catch (e) {
64
+ return { status: "error", configPath, error: `could not read/parse config: ${e instanceof Error ? e.message : String(e)}` };
65
+ }
66
+ const plugins = parsed.plugins ?? {};
67
+ const entries = plugins.entries ?? {};
68
+ const hivemindEntry = entries.hivemind ?? {};
69
+ const pluginConfig = hivemindEntry.config ?? {};
70
+ const current = pluginConfig.autoUpdate !== false;
71
+ const newValue = typeof setTo === "boolean" ? setTo : !current;
72
+ const updated = {
73
+ ...parsed,
74
+ plugins: {
75
+ ...plugins,
76
+ entries: {
77
+ ...entries,
78
+ hivemind: {
79
+ ...hivemindEntry,
80
+ config: { ...pluginConfig, autoUpdate: newValue }
81
+ }
82
+ }
83
+ }
84
+ };
85
+ const backupPath = `${configPath}.bak-hivemind-${Date.now()}`;
86
+ const tmpPath = `${configPath}.tmp-hivemind-${process.pid}`;
87
+ try {
88
+ writeFileSync(backupPath, readFileSync(configPath, "utf-8"));
89
+ writeFileSync(tmpPath, JSON.stringify(updated, null, 2) + "\n");
90
+ renameSync(tmpPath, configPath);
91
+ } catch (e) {
92
+ return { status: "error", configPath, error: `could not write config: ${e instanceof Error ? e.message : String(e)}` };
93
+ }
94
+ return { status: "updated", configPath, newValue };
95
+ }
96
+ function detectAllowlistMissing() {
97
+ const configPath = getOpenclawConfigPath();
98
+ if (!existsSync(configPath)) return false;
99
+ try {
100
+ const parsed = JSON.parse(readFileSync(configPath, "utf-8"));
101
+ const tools = parsed.tools ?? {};
102
+ return !isAllowlistCoveringHivemind(tools.alsoAllow);
103
+ } catch {
104
+ return false;
105
+ }
106
+ }
107
+ export {
108
+ HIVEMIND_TOOL_NAMES,
109
+ detectAllowlistMissing,
110
+ ensureHivemindAllowlisted,
111
+ getOpenclawConfigPath,
112
+ isAllowlistCoveringHivemind,
113
+ toggleAutoUpdateConfig
114
+ };