@deeplake/hivemind 0.6.47 → 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 (41) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +158 -51
  4. package/bundle/cli.js +4103 -282
  5. package/codex/bundle/capture.js +510 -90
  6. package/codex/bundle/commands/auth-login.js +219 -72
  7. package/codex/bundle/embeddings/embed-daemon.js +243 -0
  8. package/codex/bundle/pre-tool-use.js +713 -108
  9. package/codex/bundle/session-start-setup.js +209 -58
  10. package/codex/bundle/session-start.js +40 -11
  11. package/codex/bundle/shell/deeplake-shell.js +679 -112
  12. package/codex/bundle/stop.js +477 -59
  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 +219 -72
  16. package/cursor/bundle/embeddings/embed-daemon.js +243 -0
  17. package/cursor/bundle/pre-tool-use.js +1684 -0
  18. package/cursor/bundle/session-end.js +223 -2
  19. package/cursor/bundle/session-start.js +209 -57
  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 +1194 -0
  23. package/hermes/bundle/commands/auth-login.js +1009 -0
  24. package/hermes/bundle/embeddings/embed-daemon.js +243 -0
  25. package/hermes/bundle/package.json +1 -0
  26. package/hermes/bundle/pre-tool-use.js +1681 -0
  27. package/hermes/bundle/session-end.js +265 -0
  28. package/hermes/bundle/session-start.js +655 -0
  29. package/hermes/bundle/shell/deeplake-shell.js +69905 -0
  30. package/hermes/bundle/wiki-worker.js +572 -0
  31. package/mcp/bundle/server.js +289 -69
  32. package/openclaw/dist/chunks/auth-creds-AEKS6D3P.js +14 -0
  33. package/openclaw/dist/chunks/chunk-SRCBBT4H.js +37 -0
  34. package/openclaw/dist/chunks/config-G23NI5TV.js +33 -0
  35. package/openclaw/dist/chunks/index-marker-store-PGT5CW6T.js +33 -0
  36. package/openclaw/dist/chunks/setup-config-C35UK4LP.js +114 -0
  37. package/openclaw/dist/index.js +752 -702
  38. package/openclaw/openclaw.plugin.json +1 -1
  39. package/openclaw/package.json +1 -1
  40. package/package.json +7 -3
  41. package/pi/extension-source/hivemind.ts +807 -0
@@ -0,0 +1,33 @@
1
+ // src/index-marker-store.ts
2
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { tmpdir } from "node:os";
5
+ var INDEX_MARKER_TTL_MS = Number(6 * 60 * 6e4);
6
+ function getIndexMarkerDir() {
7
+ return join(tmpdir(), "hivemind-deeplake-indexes");
8
+ }
9
+ function buildIndexMarkerPath(workspaceId, orgId, table, suffix) {
10
+ const markerKey = [workspaceId, orgId, table, suffix].join("__").replace(/[^a-zA-Z0-9_.-]/g, "_");
11
+ return join(getIndexMarkerDir(), `${markerKey}.json`);
12
+ }
13
+ function hasFreshIndexMarker(markerPath) {
14
+ if (!existsSync(markerPath)) return false;
15
+ try {
16
+ const raw = JSON.parse(readFileSync(markerPath, "utf-8"));
17
+ const updatedAt = raw.updatedAt ? new Date(raw.updatedAt).getTime() : NaN;
18
+ if (!Number.isFinite(updatedAt) || Date.now() - updatedAt > INDEX_MARKER_TTL_MS) return false;
19
+ return true;
20
+ } catch {
21
+ return false;
22
+ }
23
+ }
24
+ function writeIndexMarker(markerPath) {
25
+ mkdirSync(getIndexMarkerDir(), { recursive: true });
26
+ writeFileSync(markerPath, JSON.stringify({ updatedAt: (/* @__PURE__ */ new Date()).toISOString() }), "utf-8");
27
+ }
28
+ export {
29
+ buildIndexMarkerPath,
30
+ getIndexMarkerDir,
31
+ hasFreshIndexMarker,
32
+ writeIndexMarker
33
+ };
@@ -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
+ };