dsh-mnemon-source-memory-spaces 0.5.25 → 0.5.26
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/lib/index.js +1 -1
- package/lib/native-cli.js +48 -11
- package/package.json +8 -8
package/lib/index.js
CHANGED
|
@@ -1132,7 +1132,7 @@ function processFailureMessage(error, args) {
|
|
|
1132
1132
|
if (reason === "output-limit") return `mnemon ${command ?? "command"} stopped: ${detail.replace(/^mnemon /u, "")}`;
|
|
1133
1133
|
if (reason === "timeout" && command !== void 0) return detail.replace(/^mnemon /u, `mnemon ${command} `);
|
|
1134
1134
|
if (reason !== "launch") return detail;
|
|
1135
|
-
return `${detail}. ${process.platform === "win32" ? "Install the official
|
|
1135
|
+
return `${detail}. ${process.platform === "win32" ? "Install Mnemon with npm install -g @mnemon-dev/mnemon or pnpm add -g @mnemon-dev/mnemon, or use the official Windows release. Ensure DSH can see PATH or PNPM_HOME, or set MNEMON_CLI_PATH or mnemon.cliPath to its absolute path." : "Install Mnemon and ensure \"mnemon\" is on PATH, or set MNEMON_CLI_PATH or mnemon.cliPath."}`;
|
|
1136
1136
|
}
|
|
1137
1137
|
/** Preserve the Host environment while making saved embedding overrides authoritative. */
|
|
1138
1138
|
function processEnvironment(config) {
|
package/lib/native-cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { accessSync, constants, existsSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
|
-
import { dirname, join, posix, win32 } from "node:path";
|
|
4
|
+
import { dirname, isAbsolute, join, posix, resolve, win32 } from "node:path";
|
|
5
5
|
//#region src/native-cli.ts
|
|
6
6
|
function manifest(path) {
|
|
7
7
|
try {
|
|
@@ -18,6 +18,17 @@ function samePath(left, right) {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
const MNEMON_NPM_PACKAGE = "@mnemon-dev/mnemon";
|
|
21
|
+
function verifiedLauncher(path) {
|
|
22
|
+
const root = dirname(dirname(path));
|
|
23
|
+
const pkg = manifest(join(root, "package.json"));
|
|
24
|
+
const bin = typeof pkg?.bin === "string" ? pkg.bin : pkg?.bin?.mnemon;
|
|
25
|
+
if (pkg?.name !== MNEMON_NPM_PACKAGE || pkg.bin !== void 0 && (typeof bin !== "string" || bin.replace(/^\.\//, "") !== "bin/mnemon.js")) return void 0;
|
|
26
|
+
try {
|
|
27
|
+
return samePath(path, join(root, "bin/mnemon.js")) ? realpathSync(path) : void 0;
|
|
28
|
+
} catch {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
21
32
|
/** Execute JavaScript with the Host binary even when it is Electron's GUI executable. */
|
|
22
33
|
function nodeLauncherEnvironment(environment = process.env) {
|
|
23
34
|
return {
|
|
@@ -30,14 +41,21 @@ function mnemonNpmLauncher(command) {
|
|
|
30
41
|
try {
|
|
31
42
|
realCommand = realpathSync(command);
|
|
32
43
|
} catch {}
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
if (/\.cmd$/i.test(command)) {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
const direct = verifiedLauncher(realCommand);
|
|
45
|
+
if (direct !== void 0) return direct;
|
|
46
|
+
if (/\.cmd$/i.test(command)) try {
|
|
47
|
+
const launchers = /* @__PURE__ */ new Set();
|
|
48
|
+
for (const match of readFileSync(command, "utf8").replaceAll("\\", "/").matchAll(/"([^"\r\n]+)"/g)) {
|
|
49
|
+
let target = match[1];
|
|
50
|
+
if (!target.endsWith("/bin/mnemon.js")) continue;
|
|
51
|
+
if (/^%(?:dp0%|~dp0)\//i.test(target)) target = target.replace(/^%(?:dp0%|~dp0)\//i, "");
|
|
52
|
+
else if (!isAbsolute(target)) continue;
|
|
53
|
+
if (target.includes("%")) continue;
|
|
54
|
+
const launcher = verifiedLauncher(resolve(dirname(command), target));
|
|
55
|
+
if (launcher !== void 0) launchers.add(launcher);
|
|
56
|
+
}
|
|
57
|
+
if (launchers.size === 1) return [...launchers][0];
|
|
58
|
+
} catch {}
|
|
41
59
|
}
|
|
42
60
|
/** Resolve only the platform package pinned by the recognized official launcher. */
|
|
43
61
|
function npmNativeBinary(launcher) {
|
|
@@ -112,6 +130,22 @@ function windowsCommonCliPaths(env, home) {
|
|
|
112
130
|
if (localAppData !== void 0 && win32.isAbsolute(localAppData)) candidates.push(win32.join(localAppData, "Programs", "mnemon", "mnemon.exe"));
|
|
113
131
|
const programFiles = envValue(env, "ProgramFiles", "win32")?.trim();
|
|
114
132
|
if (programFiles !== void 0 && win32.isAbsolute(programFiles)) candidates.push(win32.join(programFiles, "mnemon", "mnemon.exe"));
|
|
133
|
+
const directory = (name) => {
|
|
134
|
+
const value = envValue(env, name, "win32")?.trim().replace(/^"(.*)"$/, "$1");
|
|
135
|
+
return value !== void 0 && win32.isAbsolute(value) ? value : void 0;
|
|
136
|
+
};
|
|
137
|
+
const pnpmHome = directory("PNPM_HOME");
|
|
138
|
+
const local = directory("LOCALAPPDATA") ?? win32.join(home, "AppData", "Local");
|
|
139
|
+
const roaming = directory("APPDATA") ?? win32.join(home, "AppData", "Roaming");
|
|
140
|
+
const globalBins = [
|
|
141
|
+
pnpmHome,
|
|
142
|
+
pnpmHome === void 0 ? void 0 : win32.join(pnpmHome, "bin"),
|
|
143
|
+
directory("NVM_SYMLINK"),
|
|
144
|
+
win32.join(local, "pnpm"),
|
|
145
|
+
win32.join(local, "pnpm", "bin"),
|
|
146
|
+
win32.join(roaming, "npm")
|
|
147
|
+
];
|
|
148
|
+
for (const bin of globalBins) if (bin !== void 0 && win32.isAbsolute(bin)) candidates.push(win32.join(bin, "mnemon.exe"), win32.join(bin, "mnemon.cmd"));
|
|
115
149
|
return [...new Set(candidates)];
|
|
116
150
|
}
|
|
117
151
|
function commonCliPaths(platform, env, home) {
|
|
@@ -132,7 +166,7 @@ function findMnemonCommand(config, options = {}) {
|
|
|
132
166
|
for (const directory of (envValue(env, "PATH", platform) ?? "").split(paths.delimiter)) {
|
|
133
167
|
if (directory === "") continue;
|
|
134
168
|
for (const name of names) {
|
|
135
|
-
const path = paths.join(directory, name);
|
|
169
|
+
const path = paths.join(platform === "win32" ? directory.replace(/^"(.*)"$/, "$1") : directory, name);
|
|
136
170
|
if (/\.cmd$/i.test(name) && mnemonNpmLauncher(path) === void 0) continue;
|
|
137
171
|
if (isExecutable(path)) return path;
|
|
138
172
|
}
|
|
@@ -146,7 +180,10 @@ function findMnemonCommand(config, options = {}) {
|
|
|
146
180
|
}
|
|
147
181
|
const fromPath = resolveCommand("mnemon");
|
|
148
182
|
if (fromPath !== void 0) return fromPath;
|
|
149
|
-
for (const path of commonCliPaths(platform, env, home))
|
|
183
|
+
for (const path of commonCliPaths(platform, env, home)) {
|
|
184
|
+
if (/\.cmd$/i.test(path) && mnemonNpmLauncher(path) === void 0) continue;
|
|
185
|
+
if (isExecutable(path)) return path;
|
|
186
|
+
}
|
|
150
187
|
}
|
|
151
188
|
//#endregion
|
|
152
189
|
export { findMnemonCommand, isMnemonExecutable, mnemonNpmLauncher, nodeLauncherEnvironment, resolveMnemonInvocation };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mnemon-source-memory-spaces",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.26",
|
|
4
4
|
"description": "Memory Spaces Source and its private Provider SDK.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -63,18 +63,18 @@
|
|
|
63
63
|
"react": "^18.2.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.
|
|
66
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.5",
|
|
67
67
|
"@testing-library/react": "^16.3.0",
|
|
68
68
|
"@types/node": "^22.0.0",
|
|
69
69
|
"@types/react": "^18.3.0",
|
|
70
70
|
"@types/react-dom": "^18.3.0",
|
|
71
|
-
"dsh-mnemon": "^0.5.
|
|
72
|
-
"dsh-mnemon-provider-byterover": "^0.5.
|
|
71
|
+
"dsh-mnemon": "^0.5.43",
|
|
72
|
+
"dsh-mnemon-provider-byterover": "^0.5.7",
|
|
73
73
|
"dsh-mnemon-provider-hindsight": "^0.5.7",
|
|
74
74
|
"dsh-mnemon-provider-holographic": "^0.5.7",
|
|
75
75
|
"dsh-mnemon-provider-honcho": "^0.5.5",
|
|
76
76
|
"dsh-mnemon-provider-mem0": "^0.5.5",
|
|
77
|
-
"dsh-mnemon-provider-mnemon-native": "^0.5.
|
|
77
|
+
"dsh-mnemon-provider-mnemon-native": "^0.5.11",
|
|
78
78
|
"dsh-mnemon-provider-openviking": "^0.5.9",
|
|
79
79
|
"dsh-mnemon-provider-retaindb": "^0.5.5",
|
|
80
80
|
"dsh-mnemon-provider-supermemory": "^0.5.5",
|
|
@@ -101,9 +101,9 @@
|
|
|
101
101
|
"micromark-util-sanitize-uri": "^2.0.1",
|
|
102
102
|
"micromark-util-symbol": "^2.0.1",
|
|
103
103
|
"shiki": "^4.3.1",
|
|
104
|
-
"@deepseek-ai/dsh-client-store": "0.2.1-rc.
|
|
105
|
-
"@deepseek-ai/dsh-util-code-language": "0.2.1-rc.
|
|
106
|
-
"@deepseek-ai/dsh-util-workspace-path": "0.2.1-rc.
|
|
104
|
+
"@deepseek-ai/dsh-client-store": "0.2.1-rc.5",
|
|
105
|
+
"@deepseek-ai/dsh-util-code-language": "0.2.1-rc.5",
|
|
106
|
+
"@deepseek-ai/dsh-util-workspace-path": "0.2.1-rc.5",
|
|
107
107
|
"diff": "^9.0.0",
|
|
108
108
|
"immer": "^10.1.1",
|
|
109
109
|
"simple-icons": "16.31.0",
|