@deeplake/hivemind 0.6.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.
- package/.claude-plugin/marketplace.json +20 -0
- package/.claude-plugin/plugin.json +19 -0
- package/LICENSE +201 -0
- package/README.md +359 -0
- package/bundle/cli.js +1051 -0
- package/codex/bundle/capture.js +759 -0
- package/codex/bundle/commands/auth-login.js +862 -0
- package/codex/bundle/package.json +1 -0
- package/codex/bundle/pre-tool-use.js +2097 -0
- package/codex/bundle/session-start-setup.js +585 -0
- package/codex/bundle/session-start.js +129 -0
- package/codex/bundle/shell/deeplake-shell.js +69338 -0
- package/codex/bundle/stop.js +673 -0
- package/codex/bundle/wiki-worker.js +266 -0
- package/codex/skills/deeplake-memory/SKILL.md +65 -0
- package/cursor/bundle/capture.js +485 -0
- package/cursor/bundle/commands/auth-login.js +862 -0
- package/cursor/bundle/package.json +1 -0
- package/cursor/bundle/session-end.js +45 -0
- package/cursor/bundle/session-start.js +520 -0
- package/cursor/bundle/shell/deeplake-shell.js +69338 -0
- package/mcp/bundle/package.json +1 -0
- package/mcp/bundle/server.js +24068 -0
- package/openclaw/README.md +89 -0
- package/openclaw/dist/index.js +1714 -0
- package/openclaw/dist/package.json +1 -0
- package/openclaw/openclaw.plugin.json +56 -0
- package/openclaw/package.json +29 -0
- package/openclaw/skills/SKILL.md +61 -0
- package/package.json +69 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// dist/src/hooks/codex/session-start.js
|
|
4
|
+
import { spawn } from "node:child_process";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { dirname as dirname2, join as join4 } from "node:path";
|
|
7
|
+
|
|
8
|
+
// dist/src/commands/auth.js
|
|
9
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync, unlinkSync } from "node:fs";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
import { homedir } from "node:os";
|
|
12
|
+
import { execSync } from "node:child_process";
|
|
13
|
+
var CONFIG_DIR = join(homedir(), ".deeplake");
|
|
14
|
+
var CREDS_PATH = join(CONFIG_DIR, "credentials.json");
|
|
15
|
+
function loadCredentials() {
|
|
16
|
+
if (!existsSync(CREDS_PATH))
|
|
17
|
+
return null;
|
|
18
|
+
try {
|
|
19
|
+
return JSON.parse(readFileSync(CREDS_PATH, "utf-8"));
|
|
20
|
+
} catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// dist/src/utils/stdin.js
|
|
26
|
+
function readStdin() {
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
let data = "";
|
|
29
|
+
process.stdin.setEncoding("utf-8");
|
|
30
|
+
process.stdin.on("data", (chunk) => data += chunk);
|
|
31
|
+
process.stdin.on("end", () => {
|
|
32
|
+
try {
|
|
33
|
+
resolve(JSON.parse(data));
|
|
34
|
+
} catch (err) {
|
|
35
|
+
reject(new Error(`Failed to parse hook input: ${err}`));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
process.stdin.on("error", reject);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// dist/src/utils/debug.js
|
|
43
|
+
import { appendFileSync } from "node:fs";
|
|
44
|
+
import { join as join2 } from "node:path";
|
|
45
|
+
import { homedir as homedir2 } from "node:os";
|
|
46
|
+
var DEBUG = process.env.HIVEMIND_DEBUG === "1";
|
|
47
|
+
var LOG = join2(homedir2(), ".deeplake", "hook-debug.log");
|
|
48
|
+
function log(tag, msg) {
|
|
49
|
+
if (!DEBUG)
|
|
50
|
+
return;
|
|
51
|
+
appendFileSync(LOG, `${(/* @__PURE__ */ new Date()).toISOString()} [${tag}] ${msg}
|
|
52
|
+
`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// dist/src/utils/version-check.js
|
|
56
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
57
|
+
import { dirname, join as join3 } from "node:path";
|
|
58
|
+
function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
59
|
+
try {
|
|
60
|
+
const pluginJson = join3(bundleDir, "..", pluginManifestDir, "plugin.json");
|
|
61
|
+
const plugin = JSON.parse(readFileSync2(pluginJson, "utf-8"));
|
|
62
|
+
if (plugin.version)
|
|
63
|
+
return plugin.version;
|
|
64
|
+
} catch {
|
|
65
|
+
}
|
|
66
|
+
let dir = bundleDir;
|
|
67
|
+
for (let i = 0; i < 5; i++) {
|
|
68
|
+
const candidate = join3(dir, "package.json");
|
|
69
|
+
try {
|
|
70
|
+
const pkg = JSON.parse(readFileSync2(candidate, "utf-8"));
|
|
71
|
+
if ((pkg.name === "hivemind" || pkg.name === "hivemind-codex") && pkg.version)
|
|
72
|
+
return pkg.version;
|
|
73
|
+
} catch {
|
|
74
|
+
}
|
|
75
|
+
const parent = dirname(dir);
|
|
76
|
+
if (parent === dir)
|
|
77
|
+
break;
|
|
78
|
+
dir = parent;
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// dist/src/hooks/codex/session-start.js
|
|
84
|
+
var log2 = (msg) => log("codex-session-start", msg);
|
|
85
|
+
var __bundleDir = dirname2(fileURLToPath(import.meta.url));
|
|
86
|
+
var AUTH_CMD = join4(__bundleDir, "commands", "auth-login.js");
|
|
87
|
+
var context = `DEEPLAKE MEMORY: Persistent memory at ~/.deeplake/memory/ shared across sessions, users, and agents.
|
|
88
|
+
|
|
89
|
+
Structure: index.md (start here) \u2192 summaries/*.md \u2192 sessions/*.jsonl (last resort). Do NOT jump straight to JSONL.
|
|
90
|
+
Search: grep -r "keyword" ~/.deeplake/memory/
|
|
91
|
+
IMPORTANT: Only use bash commands (cat, ls, grep, echo, jq, head, tail, sed, awk, etc.) to interact with ~/.deeplake/memory/. Do NOT use python, python3, node, curl, or other interpreters \u2014 they are not available in the memory filesystem.
|
|
92
|
+
Do NOT spawn subagents to read deeplake memory.`;
|
|
93
|
+
async function main() {
|
|
94
|
+
if (process.env.HIVEMIND_WIKI_WORKER === "1")
|
|
95
|
+
return;
|
|
96
|
+
const input = await readStdin();
|
|
97
|
+
const creds = loadCredentials();
|
|
98
|
+
if (!creds?.token) {
|
|
99
|
+
log2("no credentials found \u2014 run auth login to authenticate");
|
|
100
|
+
} else {
|
|
101
|
+
log2(`credentials loaded: org=${creds.orgName ?? creds.orgId}`);
|
|
102
|
+
}
|
|
103
|
+
if (creds?.token) {
|
|
104
|
+
const setupScript = join4(__bundleDir, "session-start-setup.js");
|
|
105
|
+
const child = spawn("node", [setupScript], {
|
|
106
|
+
detached: true,
|
|
107
|
+
stdio: ["pipe", "ignore", "ignore"],
|
|
108
|
+
env: { ...process.env }
|
|
109
|
+
});
|
|
110
|
+
child.stdin?.write(JSON.stringify(input));
|
|
111
|
+
child.stdin?.end();
|
|
112
|
+
child.unref();
|
|
113
|
+
log2("spawned async setup process");
|
|
114
|
+
}
|
|
115
|
+
let versionNotice = "";
|
|
116
|
+
const current = getInstalledVersion(__bundleDir, ".codex-plugin");
|
|
117
|
+
if (current) {
|
|
118
|
+
versionNotice = `
|
|
119
|
+
Hivemind v${current}`;
|
|
120
|
+
}
|
|
121
|
+
const additionalContext = creds?.token ? `${context}
|
|
122
|
+
Logged in to Deeplake as org: ${creds.orgName ?? creds.orgId} (workspace: ${creds.workspaceId ?? "default"})${versionNotice}` : `${context}
|
|
123
|
+
Not logged in to Deeplake. Run: node "${AUTH_CMD}" login${versionNotice}`;
|
|
124
|
+
console.log(additionalContext);
|
|
125
|
+
}
|
|
126
|
+
main().catch((e) => {
|
|
127
|
+
log2(`fatal: ${e.message}`);
|
|
128
|
+
process.exit(0);
|
|
129
|
+
});
|