@deeplake/hivemind 0.6.47 → 0.6.48
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 +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +11 -31
- package/bundle/cli.js +3597 -233
- package/codex/bundle/capture.js +1 -1
- package/codex/bundle/commands/auth-login.js +10 -6
- package/codex/bundle/pre-tool-use.js +84 -4
- package/codex/bundle/session-start-setup.js +15 -1
- package/codex/bundle/session-start.js +15 -1
- package/codex/bundle/stop.js +1 -1
- package/cursor/bundle/commands/auth-login.js +10 -6
- package/cursor/bundle/pre-tool-use.js +1193 -0
- package/cursor/bundle/session-start.js +17 -3
- package/hermes/bundle/capture.js +481 -0
- package/hermes/bundle/commands/auth-login.js +866 -0
- package/hermes/bundle/package.json +1 -0
- package/hermes/bundle/pre-tool-use.js +1190 -0
- package/hermes/bundle/session-end.js +42 -0
- package/hermes/bundle/session-start.js +514 -0
- package/hermes/bundle/shell/deeplake-shell.js +69338 -0
- package/mcp/bundle/server.js +37 -2
- package/openclaw/dist/index.js +1 -1
- package/openclaw/openclaw.plugin.json +1 -1
- package/openclaw/package.json +1 -1
- package/package.json +6 -3
- package/pi/extension-source/hivemind.ts +355 -0
package/codex/bundle/capture.js
CHANGED
|
@@ -703,7 +703,7 @@ async function main() {
|
|
|
703
703
|
log3(`writing to ${sessionPath}`);
|
|
704
704
|
const projectName = (input.cwd ?? "").split("/").pop() || "unknown";
|
|
705
705
|
const filename = sessionPath.split("/").pop() ?? "";
|
|
706
|
-
const jsonForSql =
|
|
706
|
+
const jsonForSql = line.replace(/'/g, "''");
|
|
707
707
|
const insertSql = `INSERT INTO "${sessionsTable}" (id, path, filename, message, author, size_bytes, project, description, agent, creation_date, last_update_date) VALUES ('${crypto.randomUUID()}', '${sqlStr(sessionPath)}', '${sqlStr(filename)}', '${jsonForSql}'::jsonb, '${sqlStr(config.userName)}', ${Buffer.byteLength(line, "utf-8")}, '${sqlStr(projectName)}', '${sqlStr(input.hook_event_name ?? "")}', 'codex', '${ts}', '${ts}')`;
|
|
708
708
|
try {
|
|
709
709
|
await api.query(insertSql);
|
|
@@ -707,8 +707,7 @@ To delete, use: --all, --before <date>, or --session-id <id>`);
|
|
|
707
707
|
}
|
|
708
708
|
|
|
709
709
|
// dist/src/commands/auth-login.js
|
|
710
|
-
async function
|
|
711
|
-
const args = process.argv.slice(2);
|
|
710
|
+
async function runAuthCommand(args) {
|
|
712
711
|
const cmd = args[0] ?? "whoami";
|
|
713
712
|
const creds = loadCredentials();
|
|
714
713
|
const apiUrl = creds?.apiUrl ?? "https://api.deeplake.ai";
|
|
@@ -856,7 +855,12 @@ async function main() {
|
|
|
856
855
|
console.log("Commands: login, logout, whoami, org list, org switch, workspaces, workspace, sessions prune, invite, members, remove, autoupdate");
|
|
857
856
|
}
|
|
858
857
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
858
|
+
if (process.argv[1] && process.argv[1].endsWith("auth-login.js")) {
|
|
859
|
+
runAuthCommand(process.argv.slice(2)).catch((e) => {
|
|
860
|
+
console.error(e.message);
|
|
861
|
+
process.exit(1);
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
export {
|
|
865
|
+
runAuthCommand
|
|
866
|
+
};
|
|
@@ -895,13 +895,16 @@ function parseBashGrep(cmd) {
|
|
|
895
895
|
const first = splitFirstPipelineStage(cmd);
|
|
896
896
|
if (!first)
|
|
897
897
|
return null;
|
|
898
|
-
|
|
898
|
+
const matchTool = first.match(/^(grep|egrep|fgrep|rg)\b/);
|
|
899
|
+
if (!matchTool)
|
|
899
900
|
return null;
|
|
900
|
-
const
|
|
901
|
+
const tool = matchTool[1];
|
|
902
|
+
const isFixed = tool === "fgrep";
|
|
903
|
+
const isRg = tool === "rg";
|
|
901
904
|
const tokens = tokenizeGrepStage(first);
|
|
902
905
|
if (!tokens || tokens.length === 0)
|
|
903
906
|
return null;
|
|
904
|
-
let ignoreCase = false, wordMatch = false, filesOnly = false, countOnly = false, lineNumber =
|
|
907
|
+
let ignoreCase = false, wordMatch = false, filesOnly = false, countOnly = false, lineNumber = isRg, invertMatch = false, fixedString = isFixed;
|
|
905
908
|
const explicitPatterns = [];
|
|
906
909
|
let ti = 1;
|
|
907
910
|
while (ti < tokens.length) {
|
|
@@ -914,6 +917,31 @@ function parseBashGrep(cmd) {
|
|
|
914
917
|
break;
|
|
915
918
|
if (token.startsWith("--")) {
|
|
916
919
|
const [flag, inlineValue] = token.split("=", 2);
|
|
920
|
+
const rgValueLongs = /* @__PURE__ */ new Set([
|
|
921
|
+
"--type",
|
|
922
|
+
"--type-not",
|
|
923
|
+
"--type-add",
|
|
924
|
+
"--type-clear",
|
|
925
|
+
"--glob",
|
|
926
|
+
"--iglob",
|
|
927
|
+
"--threads",
|
|
928
|
+
"--max-columns",
|
|
929
|
+
"--max-depth",
|
|
930
|
+
"--max-filesize",
|
|
931
|
+
"--pre",
|
|
932
|
+
"--pre-glob",
|
|
933
|
+
"--replace",
|
|
934
|
+
"--encoding",
|
|
935
|
+
"--color",
|
|
936
|
+
"--colors",
|
|
937
|
+
"--sort",
|
|
938
|
+
"--sortr",
|
|
939
|
+
"--context-separator",
|
|
940
|
+
"--field-context-separator",
|
|
941
|
+
"--field-match-separator",
|
|
942
|
+
"--path-separator",
|
|
943
|
+
"--hostname-bin"
|
|
944
|
+
]);
|
|
917
945
|
const handlers = {
|
|
918
946
|
"--ignore-case": () => {
|
|
919
947
|
ignoreCase = true;
|
|
@@ -927,14 +955,28 @@ function parseBashGrep(cmd) {
|
|
|
927
955
|
filesOnly = true;
|
|
928
956
|
return false;
|
|
929
957
|
},
|
|
958
|
+
// rg uses `--files` to list files (without searching). For our purposes
|
|
959
|
+
// it's similar enough to `-l` that we treat it as filesOnly.
|
|
960
|
+
"--files": () => {
|
|
961
|
+
filesOnly = true;
|
|
962
|
+
return false;
|
|
963
|
+
},
|
|
930
964
|
"--count": () => {
|
|
931
965
|
countOnly = true;
|
|
932
966
|
return false;
|
|
933
967
|
},
|
|
968
|
+
"--count-matches": () => {
|
|
969
|
+
countOnly = true;
|
|
970
|
+
return false;
|
|
971
|
+
},
|
|
934
972
|
"--line-number": () => {
|
|
935
973
|
lineNumber = true;
|
|
936
974
|
return false;
|
|
937
975
|
},
|
|
976
|
+
"--no-line-number": () => {
|
|
977
|
+
lineNumber = false;
|
|
978
|
+
return false;
|
|
979
|
+
},
|
|
938
980
|
"--invert-match": () => {
|
|
939
981
|
invertMatch = true;
|
|
940
982
|
return false;
|
|
@@ -955,7 +997,10 @@ function parseBashGrep(cmd) {
|
|
|
955
997
|
return true;
|
|
956
998
|
}
|
|
957
999
|
};
|
|
958
|
-
|
|
1000
|
+
let consumeNext = handlers[flag]?.() ?? false;
|
|
1001
|
+
if (!consumeNext && isRg && rgValueLongs.has(flag) && inlineValue === void 0) {
|
|
1002
|
+
consumeNext = true;
|
|
1003
|
+
}
|
|
959
1004
|
if (consumeNext) {
|
|
960
1005
|
ti++;
|
|
961
1006
|
if (ti >= tokens.length)
|
|
@@ -966,7 +1011,9 @@ function parseBashGrep(cmd) {
|
|
|
966
1011
|
ti++;
|
|
967
1012
|
continue;
|
|
968
1013
|
}
|
|
1014
|
+
const rgValueShorts = new Set(isRg ? ["t", "T", "g", "j", "M", "r", "E"] : []);
|
|
969
1015
|
const shortFlags = token.slice(1);
|
|
1016
|
+
let consumedValueFlag = false;
|
|
970
1017
|
for (let i = 0; i < shortFlags.length; i++) {
|
|
971
1018
|
const flag = shortFlags[i];
|
|
972
1019
|
switch (flag) {
|
|
@@ -985,6 +1032,10 @@ function parseBashGrep(cmd) {
|
|
|
985
1032
|
case "n":
|
|
986
1033
|
lineNumber = true;
|
|
987
1034
|
break;
|
|
1035
|
+
case "N":
|
|
1036
|
+
lineNumber = false;
|
|
1037
|
+
break;
|
|
1038
|
+
// rg --no-line-number short form
|
|
988
1039
|
case "v":
|
|
989
1040
|
invertMatch = true;
|
|
990
1041
|
break;
|
|
@@ -992,8 +1043,27 @@ function parseBashGrep(cmd) {
|
|
|
992
1043
|
fixedString = true;
|
|
993
1044
|
break;
|
|
994
1045
|
case "r":
|
|
1046
|
+
if (isRg) {
|
|
1047
|
+
if (i === shortFlags.length - 1) {
|
|
1048
|
+
ti++;
|
|
1049
|
+
if (ti >= tokens.length)
|
|
1050
|
+
return null;
|
|
1051
|
+
}
|
|
1052
|
+
consumedValueFlag = true;
|
|
1053
|
+
i = shortFlags.length;
|
|
1054
|
+
}
|
|
1055
|
+
break;
|
|
995
1056
|
case "R":
|
|
996
1057
|
case "E":
|
|
1058
|
+
if (isRg && flag === "E") {
|
|
1059
|
+
if (i === shortFlags.length - 1) {
|
|
1060
|
+
ti++;
|
|
1061
|
+
if (ti >= tokens.length)
|
|
1062
|
+
return null;
|
|
1063
|
+
}
|
|
1064
|
+
consumedValueFlag = true;
|
|
1065
|
+
i = shortFlags.length;
|
|
1066
|
+
}
|
|
997
1067
|
break;
|
|
998
1068
|
case "A":
|
|
999
1069
|
case "B":
|
|
@@ -1020,9 +1090,19 @@ function parseBashGrep(cmd) {
|
|
|
1020
1090
|
break;
|
|
1021
1091
|
}
|
|
1022
1092
|
default:
|
|
1093
|
+
if (rgValueShorts.has(flag)) {
|
|
1094
|
+
if (i === shortFlags.length - 1) {
|
|
1095
|
+
ti++;
|
|
1096
|
+
if (ti >= tokens.length)
|
|
1097
|
+
return null;
|
|
1098
|
+
}
|
|
1099
|
+
consumedValueFlag = true;
|
|
1100
|
+
i = shortFlags.length;
|
|
1101
|
+
}
|
|
1023
1102
|
break;
|
|
1024
1103
|
}
|
|
1025
1104
|
}
|
|
1105
|
+
void consumedValueFlag;
|
|
1026
1106
|
ti++;
|
|
1027
1107
|
}
|
|
1028
1108
|
const pattern = explicitPatterns.length > 0 ? explicitPatterns[0] : tokens[ti];
|
|
@@ -430,12 +430,26 @@ function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
|
430
430
|
return plugin.version;
|
|
431
431
|
} catch {
|
|
432
432
|
}
|
|
433
|
+
try {
|
|
434
|
+
const stamp = readFileSync4(join5(bundleDir, "..", ".hivemind_version"), "utf-8").trim();
|
|
435
|
+
if (stamp)
|
|
436
|
+
return stamp;
|
|
437
|
+
} catch {
|
|
438
|
+
}
|
|
439
|
+
const HIVEMIND_PKG_NAMES = /* @__PURE__ */ new Set([
|
|
440
|
+
"hivemind",
|
|
441
|
+
"hivemind-codex",
|
|
442
|
+
"@deeplake/hivemind",
|
|
443
|
+
"@deeplake/hivemind-codex",
|
|
444
|
+
"@activeloop/hivemind",
|
|
445
|
+
"@activeloop/hivemind-codex"
|
|
446
|
+
]);
|
|
433
447
|
let dir = bundleDir;
|
|
434
448
|
for (let i = 0; i < 5; i++) {
|
|
435
449
|
const candidate = join5(dir, "package.json");
|
|
436
450
|
try {
|
|
437
451
|
const pkg = JSON.parse(readFileSync4(candidate, "utf-8"));
|
|
438
|
-
if ((pkg.name
|
|
452
|
+
if (HIVEMIND_PKG_NAMES.has(pkg.name) && pkg.version)
|
|
439
453
|
return pkg.version;
|
|
440
454
|
} catch {
|
|
441
455
|
}
|
|
@@ -63,12 +63,26 @@ function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
|
63
63
|
return plugin.version;
|
|
64
64
|
} catch {
|
|
65
65
|
}
|
|
66
|
+
try {
|
|
67
|
+
const stamp = readFileSync2(join3(bundleDir, "..", ".hivemind_version"), "utf-8").trim();
|
|
68
|
+
if (stamp)
|
|
69
|
+
return stamp;
|
|
70
|
+
} catch {
|
|
71
|
+
}
|
|
72
|
+
const HIVEMIND_PKG_NAMES = /* @__PURE__ */ new Set([
|
|
73
|
+
"hivemind",
|
|
74
|
+
"hivemind-codex",
|
|
75
|
+
"@deeplake/hivemind",
|
|
76
|
+
"@deeplake/hivemind-codex",
|
|
77
|
+
"@activeloop/hivemind",
|
|
78
|
+
"@activeloop/hivemind-codex"
|
|
79
|
+
]);
|
|
66
80
|
let dir = bundleDir;
|
|
67
81
|
for (let i = 0; i < 5; i++) {
|
|
68
82
|
const candidate = join3(dir, "package.json");
|
|
69
83
|
try {
|
|
70
84
|
const pkg = JSON.parse(readFileSync2(candidate, "utf-8"));
|
|
71
|
-
if ((pkg.name
|
|
85
|
+
if (HIVEMIND_PKG_NAMES.has(pkg.name) && pkg.version)
|
|
72
86
|
return pkg.version;
|
|
73
87
|
} catch {
|
|
74
88
|
}
|
package/codex/bundle/stop.js
CHANGED
|
@@ -634,7 +634,7 @@ async function main() {
|
|
|
634
634
|
const sessionPath = buildSessionPath(config, sessionId);
|
|
635
635
|
const projectName = (input.cwd ?? "").split("/").pop() || "unknown";
|
|
636
636
|
const filename = sessionPath.split("/").pop() ?? "";
|
|
637
|
-
const jsonForSql =
|
|
637
|
+
const jsonForSql = line.replace(/'/g, "''");
|
|
638
638
|
const insertSql = `INSERT INTO "${sessionsTable}" (id, path, filename, message, author, size_bytes, project, description, agent, creation_date, last_update_date) VALUES ('${crypto.randomUUID()}', '${sqlStr(sessionPath)}', '${sqlStr(filename)}', '${jsonForSql}'::jsonb, '${sqlStr(config.userName)}', ${Buffer.byteLength(line, "utf-8")}, '${sqlStr(projectName)}', 'Stop', 'codex', '${ts}', '${ts}')`;
|
|
639
639
|
await api.query(insertSql);
|
|
640
640
|
log3("stop event captured");
|
|
@@ -707,8 +707,7 @@ To delete, use: --all, --before <date>, or --session-id <id>`);
|
|
|
707
707
|
}
|
|
708
708
|
|
|
709
709
|
// dist/src/commands/auth-login.js
|
|
710
|
-
async function
|
|
711
|
-
const args = process.argv.slice(2);
|
|
710
|
+
async function runAuthCommand(args) {
|
|
712
711
|
const cmd = args[0] ?? "whoami";
|
|
713
712
|
const creds = loadCredentials();
|
|
714
713
|
const apiUrl = creds?.apiUrl ?? "https://api.deeplake.ai";
|
|
@@ -856,7 +855,12 @@ async function main() {
|
|
|
856
855
|
console.log("Commands: login, logout, whoami, org list, org switch, workspaces, workspace, sessions prune, invite, members, remove, autoupdate");
|
|
857
856
|
}
|
|
858
857
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
858
|
+
if (process.argv[1] && process.argv[1].endsWith("auth-login.js")) {
|
|
859
|
+
runAuthCommand(process.argv.slice(2)).catch((e) => {
|
|
860
|
+
console.error(e.message);
|
|
861
|
+
process.exit(1);
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
export {
|
|
865
|
+
runAuthCommand
|
|
866
|
+
};
|